From 29026d04df08b234efd8cf8d45eebd172f1ce668 Mon Sep 17 00:00:00 2001 From: Kieran Farr Date: Tue, 16 Jul 2024 21:17:13 -0700 Subject: [PATCH] use ortho modified three-loader-3dtiles source: https://github.com/3DStreet/three-loader-3dtiles --- .eslintignore | 2 + dist/aframe-loader-3dtiles-component.js | 24 +- dist/aframe-loader-3dtiles-component.min.js | 4 +- index.js | 2 +- lib/three-loader-3dtiles.js | 13550 ++++++++++++++++++ package-lock.json | 21 +- package.json | 1 - 7 files changed, 13571 insertions(+), 33 deletions(-) create mode 100644 .eslintignore create mode 100644 lib/three-loader-3dtiles.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..b09fadb7 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +lib +dist \ No newline at end of file diff --git a/dist/aframe-loader-3dtiles-component.js b/dist/aframe-loader-3dtiles-component.js index b87e4ef4..6a878645 100644 --- a/dist/aframe-loader-3dtiles-component.js +++ b/dist/aframe-loader-3dtiles-component.js @@ -26,7 +26,18 @@ return /******/ (() => { // webpackBootstrap /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three-loader-3dtiles */ \"./node_modules/three-loader-3dtiles/dist/lib/three-loader-3dtiles.js\");\n/* harmony import */ var _textarea__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./textarea */ \"./textarea.js\");\n/* harmony import */ var _textarea__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_textarea__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"three\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_2__);\n\n\n\n\nif (typeof AFRAME === 'undefined') {\n throw new Error('Component attempted to register before AFRAME was available.');\n}\n\nconst POINT_CLOUD_COLORING = {\n white: three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.White,\n intensity: three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.Intensity,\n classification: three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.Classification,\n elevation: three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.Elevation,\n rgb: three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.RGB\n};\n/**\n * 3D Tiles component for A-Frame.\n */\n\nAFRAME.registerComponent('loader-3dtiles', {\n schema: {\n url: {\n type: 'string'\n },\n cameraEl: {\n type: 'selector'\n },\n maximumSSE: {\n type: 'int',\n default: 16\n },\n maximumMem: {\n type: 'int',\n default: 32\n },\n distanceScale: {\n type: 'number',\n default: 1.0\n },\n pointcloudColoring: {\n type: 'string',\n default: 'white'\n },\n pointcloudElevationRange: {\n type: 'array',\n default: ['0', '400']\n },\n wireframe: {\n type: 'boolean',\n default: false\n },\n showStats: {\n type: 'boolean',\n default: false\n },\n cesiumIONToken: {\n type: 'string'\n },\n googleApiKey: {\n type: 'string'\n },\n lat: {\n type: 'number'\n },\n long: {\n type: 'number'\n },\n height: {\n type: 'number',\n default: 0\n },\n copyrightEl: {\n type: 'selector'\n }\n },\n init: async function () {\n const sceneEl = this.el.sceneEl;\n const data = this.data;\n this.camera = data.cameraEl?.object3D.children[0] ?? document.querySelector('a-scene').camera;\n\n if (!this.camera) {\n throw new Error('3D Tiles: Please add an active camera or specify the target camera via the cameraEl property');\n }\n\n this.viewport = {\n width: sceneEl.clientWidth,\n height: sceneEl.clientHeight,\n devicePixelRatio: window.devicePixelRatio\n };\n const {\n model,\n runtime\n } = await this._initTileset();\n this.el.setObject3D('tileset', model);\n this.runtime = runtime;\n this.originalCamera = this.camera;\n sceneEl.addEventListener('camera-set-active', e => {\n // TODO: For some reason after closing the inspector this event is fired with an empty camera,\n // so revert to the original camera used.\n //\n // TODO: Does not provide the right Inspector perspective camera\n this.camera = e.detail.cameraEl.object3D.children[0] ?? this.originalCamera;\n });\n this.el.addEventListener('cameraChange', e => {\n this.camera = e.detail;\n\n if (this.camera.type === 'OrthographicCamera') {\n if (this.camera.rotation.x < -1) {\n // Plan View mode\n // raise the camera to increase the field of view and update a larger area of tiles\n this.camera.position.y = 100;\n } else {\n // Cross Section mode\n this.camera.position.y = 10; // default value for ortho camera in Editor\n }\n }\n\n this.runtime.setViewport(this.viewport);\n });\n sceneEl.addEventListener('enter-vr', e => {\n this.originalCamera = this.camera;\n\n try {\n this.camera = sceneEl.renderer.xr.getCamera(this.camera); // FOV Code from https://github.com/mrdoob/three.js/issues/21869\n\n sceneEl.renderer.xr.getSession().requestAnimationFrame((time, frame) => {\n const ref = sceneEl.renderer.xr.getReferenceSpace();\n const pose = frame.getViewerPose(ref);\n\n if (pose) {\n const fovi = pose.views[0].projectionMatrix[5];\n this.camera.fov = Math.atan2(1, fovi) * 2 * 180 / Math.PI;\n }\n });\n } catch (e) {\n console.warn('Could not get VR camera');\n }\n });\n sceneEl.addEventListener('exit-vr', e => {\n this.camera = this.originalCamera;\n });\n\n if (data.showStats) {\n this.stats = this._initStats();\n }\n\n if (THREE.Cache.enabled) {\n console.warn('3D Tiles loader cannot work with THREE.Cache, disabling.');\n THREE.Cache.enabled = false;\n }\n\n await this._nextFrame();\n this.runtime = runtime;\n this.runtime.setElevationRange(data.pointcloudElevationRange.map(n => Number(n)));\n window.addEventListener('resize', this.onWindowResize.bind(this));\n\n if (AFRAME.INSPECTOR && AFRAME.INSPECTOR.opened) {\n // set active inspector camera\n this.camera = AFRAME.INSPECTOR.camera; // emit play event to start load tiles in aframe-inspector\n\n this.play();\n }\n },\n onWindowResize: function () {\n const sceneEl = this.el.sceneEl;\n this.camera.aspect = sceneEl.clientWidth / sceneEl.clientHeight;\n this.camera.updateProjectionMatrix();\n this.viewport = {\n width: sceneEl.clientWidth,\n height: sceneEl.clientHeight,\n devicePixelRatio: window.devicePixelRatio\n };\n this.runtime.setViewport(this.viewport);\n },\n update: async function (oldData) {\n if (oldData.url !== this.data.url) {\n if (this.runtime) {\n this.runtime.dispose();\n this.runtime = null;\n }\n\n const {\n model,\n runtime\n } = await this._initTileset();\n this.el.setObject3D('tileset', model);\n await this._nextFrame();\n this.runtime = runtime;\n } else if (this.runtime) {\n this.runtime.setPointCloudColoring(this._resolvePointcloudColoring(this.data.pointCloudColoring));\n this.runtime.setWireframe(this.data.wireframe);\n this.runtime.setViewDistanceScale(this.data.distanceScale);\n this.runtime.setElevationRange(this.data.pointcloudElevationRange.map(n => Number(n)));\n }\n\n if (this.data.showStats && !this.stats) {\n this.stats = this._initStats();\n }\n\n if (!this.data.showStats && this.stats) {\n this.el.sceneEl.removeChild(this.stats);\n this.stats = null;\n } // set parameters for google 3dtiles API\n\n\n if (this.data.lat && this.data.long || this.data.height) {\n this.runtime.orientToGeocoord({\n lat: Number(this.data.lat),\n long: Number(this.data.long),\n height: Number(this.data.height)\n });\n }\n },\n tick: function (t, dt) {\n if (this.runtime) {\n this.runtime.update(dt, this.camera);\n\n if (this.stats) {\n const worldPos = new three__WEBPACK_IMPORTED_MODULE_2__.Vector3();\n this.camera.getWorldPosition(worldPos);\n const stats = this.runtime.getStats();\n this.stats.setAttribute('textarea', 'text', Object.values(stats.stats).map(s => `${s.name}: ${s.count}`).join('\\n'));\n const newPos = new three__WEBPACK_IMPORTED_MODULE_2__.Vector3();\n newPos.copy(worldPos);\n newPos.z -= 2;\n this.stats.setAttribute('position', newPos);\n }\n\n if (this.data.copyrightEl) {\n this.data.copyrightEl.innerHTML = this.runtime.getDataAttributions() ?? '';\n }\n }\n },\n remove: function () {\n if (this.runtime) {\n this.runtime.dispose();\n }\n },\n\n _resolvePointcloudColoring() {\n const pointCloudColoring = POINT_CLOUD_COLORING[this.data.pointcloudColoring];\n\n if (!pointCloudColoring) {\n console.warn('Invalid value for point cloud coloring');\n return three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.White;\n } else {\n return pointCloudColoring;\n }\n },\n\n _initTileset: async function () {\n const pointCloudColoring = this._resolvePointcloudColoring(this.data.pointcloudColoring);\n\n return three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.Loader3DTiles.load({\n url: this.data.url,\n renderer: this.el.sceneEl.renderer,\n options: {\n googleApiKey: this.data.googleApiKey,\n cesiumIONToken: this.data.cesiumIONToken,\n dracoDecoderPath: 'https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/draco',\n basisTranscoderPath: 'https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/basis',\n maximumScreenSpaceError: this.data.maximumSSE,\n maximumMemoryUsage: this.data.maximumMem,\n memoryCacheOverflow: 128,\n pointCloudColoring: pointCloudColoring,\n viewDistanceScale: this.data.distanceScale,\n wireframe: this.data.wireframe,\n updateTransforms: true\n },\n viewport: this.viewport\n });\n },\n _initStats: function () {\n const stats = document.createElement('a-entity');\n this.el.sceneEl.appendChild(stats);\n stats.setAttribute('position', '-0.5 0 -1');\n stats.setAttribute('textarea', {\n cols: 30,\n rows: 15,\n text: '',\n color: 'white',\n disabledBackgroundColor: '#0c1e2c',\n disabled: true\n });\n return stats;\n },\n _nextFrame: async function () {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve();\n }, 0);\n });\n }\n});\n\n//# sourceURL=webpack://aframe-loader-3dtiles-component/./index.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _lib_three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/three-loader-3dtiles */ \"./lib/three-loader-3dtiles.js\");\n/* harmony import */ var _textarea__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./textarea */ \"./textarea.js\");\n/* harmony import */ var _textarea__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_textarea__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"three\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_2__);\n\n\n\n\nif (typeof AFRAME === 'undefined') {\n throw new Error('Component attempted to register before AFRAME was available.');\n}\n\nconst POINT_CLOUD_COLORING = {\n white: _lib_three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.White,\n intensity: _lib_three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.Intensity,\n classification: _lib_three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.Classification,\n elevation: _lib_three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.Elevation,\n rgb: _lib_three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.RGB\n};\n/**\n * 3D Tiles component for A-Frame.\n */\n\nAFRAME.registerComponent('loader-3dtiles', {\n schema: {\n url: {\n type: 'string'\n },\n cameraEl: {\n type: 'selector'\n },\n maximumSSE: {\n type: 'int',\n default: 16\n },\n maximumMem: {\n type: 'int',\n default: 32\n },\n distanceScale: {\n type: 'number',\n default: 1.0\n },\n pointcloudColoring: {\n type: 'string',\n default: 'white'\n },\n pointcloudElevationRange: {\n type: 'array',\n default: ['0', '400']\n },\n wireframe: {\n type: 'boolean',\n default: false\n },\n showStats: {\n type: 'boolean',\n default: false\n },\n cesiumIONToken: {\n type: 'string'\n },\n googleApiKey: {\n type: 'string'\n },\n lat: {\n type: 'number'\n },\n long: {\n type: 'number'\n },\n height: {\n type: 'number',\n default: 0\n },\n copyrightEl: {\n type: 'selector'\n }\n },\n init: async function () {\n const sceneEl = this.el.sceneEl;\n const data = this.data;\n this.camera = data.cameraEl?.object3D.children[0] ?? document.querySelector('a-scene').camera;\n\n if (!this.camera) {\n throw new Error('3D Tiles: Please add an active camera or specify the target camera via the cameraEl property');\n }\n\n this.viewport = {\n width: sceneEl.clientWidth,\n height: sceneEl.clientHeight,\n devicePixelRatio: window.devicePixelRatio\n };\n const {\n model,\n runtime\n } = await this._initTileset();\n this.el.setObject3D('tileset', model);\n this.runtime = runtime;\n this.originalCamera = this.camera;\n sceneEl.addEventListener('camera-set-active', e => {\n // TODO: For some reason after closing the inspector this event is fired with an empty camera,\n // so revert to the original camera used.\n //\n // TODO: Does not provide the right Inspector perspective camera\n this.camera = e.detail.cameraEl.object3D.children[0] ?? this.originalCamera;\n });\n this.el.addEventListener('cameraChange', e => {\n this.camera = e.detail;\n\n if (this.camera.type === 'OrthographicCamera') {\n if (this.camera.rotation.x < -1) {\n // Plan View mode\n // raise the camera to increase the field of view and update a larger area of tiles\n this.camera.position.y = 100;\n } else {\n // Cross Section mode\n this.camera.position.y = 10; // default value for ortho camera in Editor\n }\n }\n\n this.runtime.setViewport(this.viewport);\n });\n sceneEl.addEventListener('enter-vr', e => {\n this.originalCamera = this.camera;\n\n try {\n this.camera = sceneEl.renderer.xr.getCamera(this.camera); // FOV Code from https://github.com/mrdoob/three.js/issues/21869\n\n sceneEl.renderer.xr.getSession().requestAnimationFrame((time, frame) => {\n const ref = sceneEl.renderer.xr.getReferenceSpace();\n const pose = frame.getViewerPose(ref);\n\n if (pose) {\n const fovi = pose.views[0].projectionMatrix[5];\n this.camera.fov = Math.atan2(1, fovi) * 2 * 180 / Math.PI;\n }\n });\n } catch (e) {\n console.warn('Could not get VR camera');\n }\n });\n sceneEl.addEventListener('exit-vr', e => {\n this.camera = this.originalCamera;\n });\n\n if (data.showStats) {\n this.stats = this._initStats();\n }\n\n if (THREE.Cache.enabled) {\n console.warn('3D Tiles loader cannot work with THREE.Cache, disabling.');\n THREE.Cache.enabled = false;\n }\n\n await this._nextFrame();\n this.runtime = runtime;\n this.runtime.setElevationRange(data.pointcloudElevationRange.map(n => Number(n)));\n window.addEventListener('resize', this.onWindowResize.bind(this));\n\n if (AFRAME.INSPECTOR && AFRAME.INSPECTOR.opened) {\n // set active inspector camera\n this.camera = AFRAME.INSPECTOR.camera; // emit play event to start load tiles in aframe-inspector\n\n this.play();\n }\n },\n onWindowResize: function () {\n const sceneEl = this.el.sceneEl;\n this.camera.aspect = sceneEl.clientWidth / sceneEl.clientHeight;\n this.camera.updateProjectionMatrix();\n this.viewport = {\n width: sceneEl.clientWidth,\n height: sceneEl.clientHeight,\n devicePixelRatio: window.devicePixelRatio\n };\n this.runtime.setViewport(this.viewport);\n },\n update: async function (oldData) {\n if (oldData.url !== this.data.url) {\n if (this.runtime) {\n this.runtime.dispose();\n this.runtime = null;\n }\n\n const {\n model,\n runtime\n } = await this._initTileset();\n this.el.setObject3D('tileset', model);\n await this._nextFrame();\n this.runtime = runtime;\n } else if (this.runtime) {\n this.runtime.setPointCloudColoring(this._resolvePointcloudColoring(this.data.pointCloudColoring));\n this.runtime.setWireframe(this.data.wireframe);\n this.runtime.setViewDistanceScale(this.data.distanceScale);\n this.runtime.setElevationRange(this.data.pointcloudElevationRange.map(n => Number(n)));\n }\n\n if (this.data.showStats && !this.stats) {\n this.stats = this._initStats();\n }\n\n if (!this.data.showStats && this.stats) {\n this.el.sceneEl.removeChild(this.stats);\n this.stats = null;\n } // set parameters for google 3dtiles API\n\n\n if (this.data.lat && this.data.long || this.data.height) {\n this.runtime.orientToGeocoord({\n lat: Number(this.data.lat),\n long: Number(this.data.long),\n height: Number(this.data.height)\n });\n }\n },\n tick: function (t, dt) {\n if (this.runtime) {\n this.runtime.update(dt, this.camera);\n\n if (this.stats) {\n const worldPos = new three__WEBPACK_IMPORTED_MODULE_2__.Vector3();\n this.camera.getWorldPosition(worldPos);\n const stats = this.runtime.getStats();\n this.stats.setAttribute('textarea', 'text', Object.values(stats.stats).map(s => `${s.name}: ${s.count}`).join('\\n'));\n const newPos = new three__WEBPACK_IMPORTED_MODULE_2__.Vector3();\n newPos.copy(worldPos);\n newPos.z -= 2;\n this.stats.setAttribute('position', newPos);\n }\n\n if (this.data.copyrightEl) {\n this.data.copyrightEl.innerHTML = this.runtime.getDataAttributions() ?? '';\n }\n }\n },\n remove: function () {\n if (this.runtime) {\n this.runtime.dispose();\n }\n },\n\n _resolvePointcloudColoring() {\n const pointCloudColoring = POINT_CLOUD_COLORING[this.data.pointcloudColoring];\n\n if (!pointCloudColoring) {\n console.warn('Invalid value for point cloud coloring');\n return _lib_three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.PointCloudColoring.White;\n } else {\n return pointCloudColoring;\n }\n },\n\n _initTileset: async function () {\n const pointCloudColoring = this._resolvePointcloudColoring(this.data.pointcloudColoring);\n\n return _lib_three_loader_3dtiles__WEBPACK_IMPORTED_MODULE_0__.Loader3DTiles.load({\n url: this.data.url,\n renderer: this.el.sceneEl.renderer,\n options: {\n googleApiKey: this.data.googleApiKey,\n cesiumIONToken: this.data.cesiumIONToken,\n dracoDecoderPath: 'https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/draco',\n basisTranscoderPath: 'https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/basis',\n maximumScreenSpaceError: this.data.maximumSSE,\n maximumMemoryUsage: this.data.maximumMem,\n memoryCacheOverflow: 128,\n pointCloudColoring: pointCloudColoring,\n viewDistanceScale: this.data.distanceScale,\n wireframe: this.data.wireframe,\n updateTransforms: true\n },\n viewport: this.viewport\n });\n },\n _initStats: function () {\n const stats = document.createElement('a-entity');\n this.el.sceneEl.appendChild(stats);\n stats.setAttribute('position', '-0.5 0 -1');\n stats.setAttribute('textarea', {\n cols: 30,\n rows: 15,\n text: '',\n color: 'white',\n disabledBackgroundColor: '#0c1e2c',\n disabled: true\n });\n return stats;\n },\n _nextFrame: async function () {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n resolve();\n }, 0);\n });\n }\n});\n\n//# sourceURL=webpack://aframe-loader-3dtiles-component/./index.js?"); + +/***/ }), + +/***/ "./lib/three-loader-3dtiles.js": +/*!*************************************!*\ + !*** ./lib/three-loader-3dtiles.js ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Loader3DTiles\": () => (/* binding */ t1),\n/* harmony export */ \"PointCloudColoring\": () => (/* binding */ Hc),\n/* harmony export */ \"Shading\": () => (/* binding */ jn)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three/examples/jsm/loaders/KTX2Loader.js */ \"three\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_0__);\nvar jc = Object.defineProperty;\n\nvar kc = (e, t, n) => t in e ? jc(e, t, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: n\n}) : e[t] = n;\n\nvar p = (e, t, n) => (kc(e, typeof t != \"symbol\" ? t + \"\" : t, n), n);\n\n\n\n\n\n\nasync function Ke(e, t, n, s) {\n return s._parse(e, t, n, s);\n}\n\nfunction z(e, t) {\n if (!e) throw new Error(t || \"loader assertion failed.\");\n}\n\nconst kn = !!(typeof process != \"object\" || String(process) !== \"[object process]\" || process.browser),\n Wr = typeof process < \"u\" && process.version && /v([0-9]*)/.exec(process.version);\nWr && parseFloat(Wr[1]);\n\nfunction hu(e, t) {\n return Xo(e || {}, t);\n}\n\nfunction Xo(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;\n if (n > 3) return t;\n const s = { ...e\n };\n\n for (const [r, i] of Object.entries(t)) i && typeof i == \"object\" && !Array.isArray(i) ? s[r] = Xo(s[r] || {}, t[r], n + 1) : s[r] = t[r];\n\n return s;\n}\n\nconst fu = \"latest\";\n\nfunction du() {\n var e;\n return (e = globalThis._loadersgl_) !== null && e !== void 0 && e.version || (globalThis._loadersgl_ = globalThis._loadersgl_ || {}, globalThis._loadersgl_.version = \"4.1.1\"), globalThis._loadersgl_.version;\n}\n\nconst Qo = du();\n\nfunction Jt(e, t) {\n if (!e) throw new Error(t || \"loaders.gl assertion failed.\");\n}\n\nconst bt = typeof process != \"object\" || String(process) !== \"[object process]\" || process.browser,\n fr = typeof importScripts == \"function\",\n mu = typeof window < \"u\" && typeof window.orientation < \"u\",\n Xr = typeof process < \"u\" && process.version && /v([0-9]*)/.exec(process.version);\nXr && parseFloat(Xr[1]);\n\nclass gu {\n constructor(t, n) {\n this.name = void 0, this.workerThread = void 0, this.isRunning = !0, this.result = void 0, this._resolve = () => {}, this._reject = () => {}, this.name = t, this.workerThread = n, this.result = new Promise((s, r) => {\n this._resolve = s, this._reject = r;\n });\n }\n\n postMessage(t, n) {\n this.workerThread.postMessage({\n source: \"loaders.gl\",\n type: t,\n payload: n\n });\n }\n\n done(t) {\n Jt(this.isRunning), this.isRunning = !1, this._resolve(t);\n }\n\n error(t) {\n Jt(this.isRunning), this.isRunning = !1, this._reject(t);\n }\n\n}\n\nclass is {\n terminate() {}\n\n}\n\nconst os = /* @__PURE__ */new Map();\n\nfunction Au(e) {\n Jt(e.source && !e.url || !e.source && e.url);\n let t = os.get(e.source || e.url);\n return t || (e.url && (t = pu(e.url), os.set(e.url, t)), e.source && (t = qo(e.source), os.set(e.source, t))), Jt(t), t;\n}\n\nfunction pu(e) {\n if (!e.startsWith(\"http\")) return e;\n const t = yu(e);\n return qo(t);\n}\n\nfunction qo(e) {\n const t = new Blob([e], {\n type: \"application/javascript\"\n });\n return URL.createObjectURL(t);\n}\n\nfunction yu(e) {\n return `try {\n importScripts('${e}');\n} catch (error) {\n console.error(error);\n throw error;\n}`;\n}\n\nfunction Yo(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0,\n n = arguments.length > 2 ? arguments[2] : void 0;\n const s = n || /* @__PURE__ */new Set();\n\n if (e) {\n if (Qr(e)) s.add(e);else if (Qr(e.buffer)) s.add(e.buffer);else if (!ArrayBuffer.isView(e)) {\n if (t && typeof e == \"object\") for (const r in e) Yo(e[r], t, s);\n }\n }\n\n return n === void 0 ? Array.from(s) : [];\n}\n\nfunction Qr(e) {\n return e ? e instanceof ArrayBuffer || typeof MessagePort < \"u\" && e instanceof MessagePort || typeof ImageBitmap < \"u\" && e instanceof ImageBitmap || typeof OffscreenCanvas < \"u\" && e instanceof OffscreenCanvas : !1;\n}\n\nconst as = () => {};\n\nclass Vs {\n static isSupported() {\n return typeof Worker < \"u\" && bt || typeof is < \"u\" && !bt;\n }\n\n constructor(t) {\n this.name = void 0, this.source = void 0, this.url = void 0, this.terminated = !1, this.worker = void 0, this.onMessage = void 0, this.onError = void 0, this._loadableURL = \"\";\n const {\n name: n,\n source: s,\n url: r\n } = t;\n Jt(s || r), this.name = n, this.source = s, this.url = r, this.onMessage = as, this.onError = i => console.log(i), this.worker = bt ? this._createBrowserWorker() : this._createNodeWorker();\n }\n\n destroy() {\n this.onMessage = as, this.onError = as, this.worker.terminate(), this.terminated = !0;\n }\n\n get isRunning() {\n return !!this.onMessage;\n }\n\n postMessage(t, n) {\n n = n || Yo(t), this.worker.postMessage(t, n);\n }\n\n _getErrorFromErrorEvent(t) {\n let n = \"Failed to load \";\n return n += `worker ${this.name} from ${this.url}. `, t.message && (n += `${t.message} in `), t.lineno && (n += `:${t.lineno}:${t.colno}`), new Error(n);\n }\n\n _createBrowserWorker() {\n this._loadableURL = Au({\n source: this.source,\n url: this.url\n });\n const t = new Worker(this._loadableURL, {\n name: this.name\n });\n return t.onmessage = n => {\n n.data ? this.onMessage(n.data) : this.onError(new Error(\"No data received\"));\n }, t.onerror = n => {\n this.onError(this._getErrorFromErrorEvent(n)), this.terminated = !0;\n }, t.onmessageerror = n => console.error(n), t;\n }\n\n _createNodeWorker() {\n let t;\n\n if (this.url) {\n const s = this.url.includes(\":/\") || this.url.startsWith(\"/\") ? this.url : `./${this.url}`;\n t = new is(s, {\n eval: !1\n });\n } else if (this.source) t = new is(this.source, {\n eval: !0\n });else throw new Error(\"no worker\");\n\n return t.on(\"message\", n => {\n this.onMessage(n);\n }), t.on(\"error\", n => {\n this.onError(n);\n }), t.on(\"exit\", n => {}), t;\n }\n\n}\n\nclass Bu {\n static isSupported() {\n return Vs.isSupported();\n }\n\n constructor(t) {\n this.name = \"unnamed\", this.source = void 0, this.url = void 0, this.maxConcurrency = 1, this.maxMobileConcurrency = 1, this.onDebug = () => {}, this.reuseWorkers = !0, this.props = {}, this.jobQueue = [], this.idleQueue = [], this.count = 0, this.isDestroyed = !1, this.source = t.source, this.url = t.url, this.setProps(t);\n }\n\n destroy() {\n this.idleQueue.forEach(t => t.destroy()), this.isDestroyed = !0;\n }\n\n setProps(t) {\n this.props = { ...this.props,\n ...t\n }, t.name !== void 0 && (this.name = t.name), t.maxConcurrency !== void 0 && (this.maxConcurrency = t.maxConcurrency), t.maxMobileConcurrency !== void 0 && (this.maxMobileConcurrency = t.maxMobileConcurrency), t.reuseWorkers !== void 0 && (this.reuseWorkers = t.reuseWorkers), t.onDebug !== void 0 && (this.onDebug = t.onDebug);\n }\n\n async startJob(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (i, o, a) => i.done(a),\n s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : (i, o) => i.error(o);\n const r = new Promise(i => (this.jobQueue.push({\n name: t,\n onMessage: n,\n onError: s,\n onStart: i\n }), this));\n return this._startQueuedJob(), await r;\n }\n\n async _startQueuedJob() {\n if (!this.jobQueue.length) return;\n\n const t = this._getAvailableWorker();\n\n if (!t) return;\n const n = this.jobQueue.shift();\n\n if (n) {\n this.onDebug({\n message: \"Starting job\",\n name: n.name,\n workerThread: t,\n backlog: this.jobQueue.length\n });\n const s = new gu(n.name, t);\n t.onMessage = r => n.onMessage(s, r.type, r.payload), t.onError = r => n.onError(s, r), n.onStart(s);\n\n try {\n await s.result;\n } catch (r) {\n console.error(`Worker exception: ${r}`);\n } finally {\n this.returnWorkerToQueue(t);\n }\n }\n }\n\n returnWorkerToQueue(t) {\n !bt || this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency() ? (t.destroy(), this.count--) : this.idleQueue.push(t), this.isDestroyed || this._startQueuedJob();\n }\n\n _getAvailableWorker() {\n if (this.idleQueue.length > 0) return this.idleQueue.shift() || null;\n\n if (this.count < this._getMaxConcurrency()) {\n this.count++;\n const t = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;\n return new Vs({\n name: t,\n source: this.source,\n url: this.url\n });\n }\n\n return null;\n }\n\n _getMaxConcurrency() {\n return mu ? this.maxMobileConcurrency : this.maxConcurrency;\n }\n\n}\n\nconst Cu = {\n maxConcurrency: 3,\n maxMobileConcurrency: 1,\n reuseWorkers: !0,\n onDebug: () => {}\n};\n\nclass Nt {\n static isSupported() {\n return Vs.isSupported();\n }\n\n static getWorkerFarm() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n return Nt._workerFarm = Nt._workerFarm || new Nt({}), Nt._workerFarm.setProps(t), Nt._workerFarm;\n }\n\n constructor(t) {\n this.props = void 0, this.workerPools = /* @__PURE__ */new Map(), this.props = { ...Cu\n }, this.setProps(t), this.workerPools = /* @__PURE__ */new Map();\n }\n\n destroy() {\n for (const t of this.workerPools.values()) t.destroy();\n\n this.workerPools = /* @__PURE__ */new Map();\n }\n\n setProps(t) {\n this.props = { ...this.props,\n ...t\n };\n\n for (const n of this.workerPools.values()) n.setProps(this._getWorkerPoolProps());\n }\n\n getWorkerPool(t) {\n const {\n name: n,\n source: s,\n url: r\n } = t;\n let i = this.workerPools.get(n);\n return i || (i = new Bu({\n name: n,\n source: s,\n url: r\n }), i.setProps(this._getWorkerPoolProps()), this.workerPools.set(n, i)), i;\n }\n\n _getWorkerPoolProps() {\n return {\n maxConcurrency: this.props.maxConcurrency,\n maxMobileConcurrency: this.props.maxMobileConcurrency,\n reuseWorkers: this.props.reuseWorkers,\n onDebug: this.props.onDebug\n };\n }\n\n}\n\nNt._workerFarm = void 0;\n\nfunction Eu(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n const n = t[e.id] || {},\n s = bt ? `${e.id}-worker.js` : `${e.id}-worker-node.js`;\n let r = n.workerUrl;\n\n if (!r && e.id === \"compression\" && (r = t.workerUrl), t._workerType === \"test\" && (bt ? r = `modules/${e.module}/dist/${s}` : r = `modules/${e.module}/src/workers/${e.id}-worker-node.ts`), !r) {\n let i = e.version;\n i === \"latest\" && (i = fu);\n const o = i ? `@${i}` : \"\";\n r = `https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${s}`;\n }\n\n return Jt(r), r;\n}\n\nfunction Tu(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Qo;\n Jt(e, \"no worker provided\");\n const n = e.version;\n return !(!t || !n);\n}\n\nconst bu = {},\n _u = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n default: bu\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n cs = {};\n\nasync function Zt(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null,\n n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {},\n s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;\n return t && (e = wu(e, t, n, s)), cs[e] = cs[e] || Ru(e), await cs[e];\n}\n\nfunction wu(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {},\n s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;\n if (!n.useLocalLibraries && e.startsWith(\"http\")) return e;\n s = s || e;\n const r = n.modules || {};\n return r[s] ? r[s] : bt ? n.CDN ? (Jt(n.CDN.startsWith(\"http\")), `${n.CDN}/${t}@${Qo}/dist/libs/${s}`) : fr ? `../src/libs/${s}` : `modules/${t}/src/libs/${s}` : `modules/${t}/dist/libs/${s}`;\n}\n\nasync function Ru(e) {\n if (e.endsWith(\"wasm\")) return await Su(e);\n if (!bt) try {\n return _u && void 0;\n } catch (n) {\n return console.error(n), null;\n }\n if (fr) return importScripts(e);\n const t = await Iu(e);\n return Mu(t, e);\n}\n\nfunction Mu(e, t) {\n if (!bt) return;\n if (fr) return eval.call(globalThis, e), null;\n const n = document.createElement(\"script\");\n n.id = t;\n\n try {\n n.appendChild(document.createTextNode(e));\n } catch {\n n.text = e;\n }\n\n return document.body.appendChild(n), null;\n}\n\nasync function Su(e) {\n return await (await fetch(e)).arrayBuffer();\n}\n\nasync function Iu(e) {\n return await (await fetch(e)).text();\n}\n\nfunction xu(e, t) {\n return !Nt.isSupported() || !bt && !(t != null && t._nodeWorkers) ? !1 : e.worker && (t == null ? void 0 : t.worker);\n}\n\nasync function vu(e, t, n, s, r) {\n const i = e.id,\n o = Eu(e, n),\n c = Nt.getWorkerFarm(n).getWorkerPool({\n name: i,\n url: o\n });\n n = JSON.parse(JSON.stringify(n)), s = JSON.parse(JSON.stringify(s || {}));\n const u = await c.startJob(\"process-on-worker\", Ou.bind(null, r));\n return u.postMessage(\"process\", {\n input: t,\n options: n,\n context: s\n }), await (await u.result).result;\n}\n\nasync function Ou(e, t, n, s) {\n switch (n) {\n case \"done\":\n t.done(s);\n break;\n\n case \"error\":\n t.error(new Error(s.error));\n break;\n\n case \"process\":\n const {\n id: r,\n input: i,\n options: o\n } = s;\n\n try {\n const a = await e(i, o);\n t.postMessage(\"done\", {\n id: r,\n result: a\n });\n } catch (a) {\n const c = a instanceof Error ? a.message : \"unknown error\";\n t.postMessage(\"error\", {\n id: r,\n error: c\n });\n }\n\n break;\n\n default:\n console.warn(`parse-with-worker unknown message ${n}`);\n }\n}\n\nfunction Fu(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 5;\n return typeof e == \"string\" ? e.slice(0, t) : ArrayBuffer.isView(e) ? qr(e.buffer, e.byteOffset, t) : e instanceof ArrayBuffer ? qr(e, 0, t) : \"\";\n}\n\nfunction qr(e, t, n) {\n if (e.byteLength <= t + n) return \"\";\n const s = new DataView(e);\n let r = \"\";\n\n for (let i = 0; i < n; i++) r += String.fromCharCode(s.getUint8(t + i));\n\n return r;\n}\n\nfunction Du(e) {\n try {\n return JSON.parse(e);\n } catch {\n throw new Error(`Failed to parse JSON from data starting with \"${Fu(e)}\"`);\n }\n}\n\nfunction Lu(e, t, n) {\n if (n = n || e.byteLength, e.byteLength < n || t.byteLength < n) return !1;\n const s = new Uint8Array(e),\n r = new Uint8Array(t);\n\n for (let i = 0; i < s.length; ++i) if (s[i] !== r[i]) return !1;\n\n return !0;\n}\n\nfunction Pu() {\n for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];\n\n return Gu(t);\n}\n\nfunction Gu(e) {\n const t = e.map(i => i instanceof ArrayBuffer ? new Uint8Array(i) : i),\n n = t.reduce((i, o) => i + o.byteLength, 0),\n s = new Uint8Array(n);\n let r = 0;\n\n for (const i of t) s.set(i, r), r += i.byteLength;\n\n return s.buffer;\n}\n\nfunction dr(e, t, n) {\n const s = n !== void 0 ? new Uint8Array(e).subarray(t, t + n) : new Uint8Array(e).subarray(t);\n return new Uint8Array(s).buffer;\n}\n\nfunction ze(e, t) {\n return z(e >= 0), z(t > 0), e + (t - 1) & ~(t - 1);\n}\n\nfunction Nu(e, t, n) {\n let s;\n if (e instanceof ArrayBuffer) s = new Uint8Array(e);else {\n const r = e.byteOffset,\n i = e.byteLength;\n s = new Uint8Array(e.buffer || e.arrayBuffer, r, i);\n }\n return t.set(s, n), n + ze(s.byteLength, 4);\n}\n\nasync function Uu(e) {\n const t = [];\n\n for await (const n of e) t.push(n);\n\n return Pu(...t);\n}\n\nfunction Yr() {\n let e;\n if (typeof window < \"u\" && window.performance) e = window.performance.now();else if (typeof process < \"u\" && process.hrtime) {\n const t = process.hrtime();\n e = t[0] * 1e3 + t[1] / 1e6;\n } else e = Date.now();\n return e;\n}\n\nclass $r {\n constructor(t, n) {\n this.name = void 0, this.type = void 0, this.sampleSize = 1, this.time = 0, this.count = 0, this.samples = 0, this.lastTiming = 0, this.lastSampleTime = 0, this.lastSampleCount = 0, this._count = 0, this._time = 0, this._samples = 0, this._startTime = 0, this._timerPending = !1, this.name = t, this.type = n, this.reset();\n }\n\n reset() {\n return this.time = 0, this.count = 0, this.samples = 0, this.lastTiming = 0, this.lastSampleTime = 0, this.lastSampleCount = 0, this._count = 0, this._time = 0, this._samples = 0, this._startTime = 0, this._timerPending = !1, this;\n }\n\n setSampleSize(t) {\n return this.sampleSize = t, this;\n }\n\n incrementCount() {\n return this.addCount(1), this;\n }\n\n decrementCount() {\n return this.subtractCount(1), this;\n }\n\n addCount(t) {\n return this._count += t, this._samples++, this._checkSampling(), this;\n }\n\n subtractCount(t) {\n return this._count -= t, this._samples++, this._checkSampling(), this;\n }\n\n addTime(t) {\n return this._time += t, this.lastTiming = t, this._samples++, this._checkSampling(), this;\n }\n\n timeStart() {\n return this._startTime = Yr(), this._timerPending = !0, this;\n }\n\n timeEnd() {\n return this._timerPending ? (this.addTime(Yr() - this._startTime), this._timerPending = !1, this._checkSampling(), this) : this;\n }\n\n getSampleAverageCount() {\n return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;\n }\n\n getSampleAverageTime() {\n return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;\n }\n\n getSampleHz() {\n return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;\n }\n\n getAverageCount() {\n return this.samples > 0 ? this.count / this.samples : 0;\n }\n\n getAverageTime() {\n return this.samples > 0 ? this.time / this.samples : 0;\n }\n\n getHz() {\n return this.time > 0 ? this.samples / (this.time / 1e3) : 0;\n }\n\n _checkSampling() {\n this._samples === this.sampleSize && (this.lastSampleTime = this._time, this.lastSampleCount = this._count, this.count += this._count, this.time += this._time, this.samples += this._samples, this._time = 0, this._count = 0, this._samples = 0);\n }\n\n}\n\nclass $o {\n constructor(t) {\n this.id = void 0, this.stats = {}, this.id = t.id, this.stats = {}, this._initializeStats(t.stats), Object.seal(this);\n }\n\n get(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"count\";\n return this._getOrCreate({\n name: t,\n type: n\n });\n }\n\n get size() {\n return Object.keys(this.stats).length;\n }\n\n reset() {\n for (const t of Object.values(this.stats)) t.reset();\n\n return this;\n }\n\n forEach(t) {\n for (const n of Object.values(this.stats)) t(n);\n }\n\n getTable() {\n const t = {};\n return this.forEach(n => {\n t[n.name] = {\n time: n.time || 0,\n count: n.count || 0,\n average: n.getAverageTime() || 0,\n hz: n.getHz() || 0\n };\n }), t;\n }\n\n _initializeStats() {\n (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).forEach(n => this._getOrCreate(n));\n }\n\n _getOrCreate(t) {\n const {\n name: n,\n type: s\n } = t;\n let r = this.stats[n];\n return r || (t instanceof $r ? r = t : r = new $r(n, s), this.stats[n] = r), r;\n }\n\n}\n\nlet Hu = \"\";\nconst Zr = {};\n\nfunction Ju(e) {\n for (const t in Zr) if (e.startsWith(t)) {\n const n = Zr[t];\n e = e.replace(t, n);\n }\n\n return !e.startsWith(\"http://\") && !e.startsWith(\"https://\") && (e = `${Hu}${e}`), e;\n}\n\nfunction Vu(e) {\n return e && typeof e == \"object\" && e.isBuffer;\n}\n\nfunction Zo(e) {\n if (Vu(e)) return e;\n if (e instanceof ArrayBuffer) return e;\n if (ArrayBuffer.isView(e)) return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength ? e.buffer : e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);\n\n if (typeof e == \"string\") {\n const t = e;\n return new TextEncoder().encode(t).buffer;\n }\n\n if (e && typeof e == \"object\" && e._toArrayBuffer) return e._toArrayBuffer();\n throw new Error(\"toArrayBuffer\");\n}\n\nfunction ju() {\n var e;\n if (typeof process < \"u\" && typeof process.cwd < \"u\") return process.cwd();\n const t = (e = window.location) === null || e === void 0 ? void 0 : e.pathname;\n return (t == null ? void 0 : t.slice(0, t.lastIndexOf(\"/\") + 1)) || \"\";\n}\n\nfunction ta(e) {\n const t = e ? e.lastIndexOf(\"/\") : -1;\n return t >= 0 ? e.substr(t + 1) : \"\";\n}\n\nfunction ea(e) {\n const t = e ? e.lastIndexOf(\"/\") : -1;\n return t >= 0 ? e.substr(0, t) : \"\";\n}\n\nfunction ku() {\n const e = [];\n\n for (let r = 0; r < arguments.length; r++) e[r] = r < 0 || arguments.length <= r ? void 0 : arguments[r];\n\n let t = \"\",\n n = !1,\n s;\n\n for (let r = e.length - 1; r >= -1 && !n; r--) {\n let i;\n r >= 0 ? i = e[r] : (s === void 0 && (s = ju()), i = s), i.length !== 0 && (t = `${i}/${t}`, n = i.charCodeAt(0) === Ie);\n }\n\n return t = Ku(t, !n), n ? `/${t}` : t.length > 0 ? t : \".\";\n}\n\nconst Ie = 47,\n us = 46;\n\nfunction Ku(e, t) {\n let n = \"\",\n s = -1,\n r = 0,\n i,\n o = !1;\n\n for (let a = 0; a <= e.length; ++a) {\n if (a < e.length) i = e.charCodeAt(a);else {\n if (i === Ie) break;\n i = Ie;\n }\n\n if (i === Ie) {\n if (!(s === a - 1 || r === 1)) if (s !== a - 1 && r === 2) {\n if (n.length < 2 || !o || n.charCodeAt(n.length - 1) !== us || n.charCodeAt(n.length - 2) !== us) {\n if (n.length > 2) {\n const c = n.length - 1;\n let u = c;\n\n for (; u >= 0 && n.charCodeAt(u) !== Ie; --u);\n\n if (u !== c) {\n n = u === -1 ? \"\" : n.slice(0, u), s = a, r = 0, o = !1;\n continue;\n }\n } else if (n.length === 2 || n.length === 1) {\n n = \"\", s = a, r = 0, o = !1;\n continue;\n }\n }\n\n t && (n.length > 0 ? n += \"/..\" : n = \"..\", o = !0);\n } else {\n const c = e.slice(s + 1, a);\n n.length > 0 ? n += `/${c}` : n = c, o = !1;\n }\n s = a, r = 0;\n } else i === us && r !== -1 ? ++r : r = -1;\n }\n\n return n;\n}\n\nconst zu = e => typeof e == \"boolean\",\n ve = e => typeof e == \"function\",\n We = e => e !== null && typeof e == \"object\",\n ti = e => We(e) && e.constructor === {}.constructor,\n Wu = e => !!e && typeof e[Symbol.iterator] == \"function\",\n Xu = e => e && typeof e[Symbol.asyncIterator] == \"function\",\n se = e => typeof Response < \"u\" && e instanceof Response || e && e.arrayBuffer && e.text && e.json,\n re = e => typeof Blob < \"u\" && e instanceof Blob,\n Qu = e => e && typeof e == \"object\" && e.isBuffer,\n qu = e => typeof ReadableStream < \"u\" && e instanceof ReadableStream || We(e) && ve(e.tee) && ve(e.cancel) && ve(e.getReader),\n Yu = e => We(e) && ve(e.read) && ve(e.pipe) && zu(e.readable),\n na = e => qu(e) || Yu(e),\n $u = /^data:([-\\w.]+\\/[-\\w.+]+)(;|,)/,\n Zu = /^([-\\w.]+\\/[-\\w.+]+)/;\n\nfunction tl(e) {\n const t = Zu.exec(e);\n return t ? t[1] : e;\n}\n\nfunction ei(e) {\n const t = $u.exec(e);\n return t ? t[1] : \"\";\n}\n\nconst sa = /\\?.*/;\n\nfunction el(e) {\n const t = e.match(sa);\n return t && t[0];\n}\n\nfunction mr(e) {\n return e.replace(sa, \"\");\n}\n\nfunction Kn(e) {\n return se(e) ? e.url : re(e) ? e.name || \"\" : typeof e == \"string\" ? e : \"\";\n}\n\nfunction gr(e) {\n if (se(e)) {\n const t = e,\n n = t.headers.get(\"content-type\") || \"\",\n s = mr(t.url);\n return tl(n) || ei(s);\n }\n\n return re(e) ? e.type || \"\" : typeof e == \"string\" ? ei(e) : \"\";\n}\n\nfunction nl(e) {\n return se(e) ? e.headers[\"content-length\"] || -1 : re(e) ? e.size : typeof e == \"string\" ? e.length : e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? e.byteLength : -1;\n}\n\nasync function ra(e) {\n if (se(e)) return e;\n const t = {},\n n = nl(e);\n n >= 0 && (t[\"content-length\"] = String(n));\n const s = Kn(e),\n r = gr(e);\n r && (t[\"content-type\"] = r);\n const i = await il(e);\n i && (t[\"x-first-bytes\"] = i), typeof e == \"string\" && (e = new TextEncoder().encode(e));\n const o = new Response(e, {\n headers: t\n });\n return Object.defineProperty(o, \"url\", {\n value: s\n }), o;\n}\n\nasync function sl(e) {\n if (!e.ok) {\n const t = await rl(e);\n throw new Error(t);\n }\n}\n\nasync function rl(e) {\n let t = `Failed to fetch resource ${e.url} (${e.status}): `;\n\n try {\n const n = e.headers.get(\"Content-Type\");\n let s = e.statusText;\n n != null && n.includes(\"application/json\") && (s += ` ${await e.text()}`), t += s, t = t.length > 60 ? `${t.slice(0, 60)}...` : t;\n } catch {}\n\n return t;\n}\n\nasync function il(e) {\n if (typeof e == \"string\") return `data:,${e.slice(0, 5)}`;\n\n if (e instanceof Blob) {\n const n = e.slice(0, 5);\n return await new Promise(s => {\n const r = new FileReader();\n r.onload = i => {\n var o;\n return s(i == null || (o = i.target) === null || o === void 0 ? void 0 : o.result);\n }, r.readAsDataURL(n);\n });\n }\n\n if (e instanceof ArrayBuffer) {\n const n = e.slice(0, 5);\n return `data:base64,${ol(n)}`;\n }\n\n return null;\n}\n\nfunction ol(e) {\n let t = \"\";\n const n = new Uint8Array(e);\n\n for (let s = 0; s < n.byteLength; s++) t += String.fromCharCode(n[s]);\n\n return btoa(t);\n}\n\nfunction al(e) {\n return !cl(e) && !ul(e);\n}\n\nfunction cl(e) {\n return e.startsWith(\"http:\") || e.startsWith(\"https:\");\n}\n\nfunction ul(e) {\n return e.startsWith(\"data:\");\n}\n\nasync function Ge(e, t) {\n if (typeof e == \"string\") {\n const r = Ju(e);\n\n if (al(r)) {\n var n;\n\n if ((n = globalThis.loaders) !== null && n !== void 0 && n.fetchNode) {\n var s;\n return (s = globalThis.loaders) === null || s === void 0 ? void 0 : s.fetchNode(r, t);\n }\n }\n\n return await fetch(r, t);\n }\n\n return await ra(e);\n}\n\nfunction ll(e) {\n if (typeof window < \"u\" && typeof window.process == \"object\" && window.process.type === \"renderer\" || typeof process < \"u\" && typeof process.versions == \"object\" && process.versions.electron) return !0;\n const t = typeof navigator == \"object\" && typeof navigator.userAgent == \"string\" && navigator.userAgent,\n n = e || t;\n return !!(n && n.indexOf(\"Electron\") >= 0);\n}\n\nfunction Xe() {\n return !(typeof process == \"object\" && String(process) === \"[object process]\" && !process.browser) || ll();\n}\n\nconst Ze = globalThis.window || globalThis.self || globalThis.global,\n Ee = globalThis.process || {},\n ia = typeof __VERSION__ < \"u\" ? __VERSION__ : \"untranspiled source\";\nXe();\n\nfunction hl(e) {\n try {\n const t = window[e],\n n = \"__storage_test__\";\n return t.setItem(n, n), t.removeItem(n), t;\n } catch {\n return null;\n }\n}\n\nclass fl {\n constructor(t, n) {\n let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : \"sessionStorage\";\n this.storage = void 0, this.id = void 0, this.config = void 0, this.storage = hl(s), this.id = t, this.config = n, this._loadConfiguration();\n }\n\n getConfiguration() {\n return this.config;\n }\n\n setConfiguration(t) {\n if (Object.assign(this.config, t), this.storage) {\n const n = JSON.stringify(this.config);\n this.storage.setItem(this.id, n);\n }\n }\n\n _loadConfiguration() {\n let t = {};\n\n if (this.storage) {\n const n = this.storage.getItem(this.id);\n t = n ? JSON.parse(n) : {};\n }\n\n return Object.assign(this.config, t), this;\n }\n\n}\n\nfunction dl(e) {\n let t;\n return e < 10 ? t = \"\".concat(e.toFixed(2), \"ms\") : e < 100 ? t = \"\".concat(e.toFixed(1), \"ms\") : e < 1e3 ? t = \"\".concat(e.toFixed(0), \"ms\") : t = \"\".concat((e / 1e3).toFixed(2), \"s\"), t;\n}\n\nfunction ml(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;\n const n = Math.max(t - e.length, 0);\n return \"\".concat(\" \".repeat(n)).concat(e);\n}\n\nfunction ls(e, t, n) {\n let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;\n const r = e.src.replace(/\\(/g, \"%28\").replace(/\\)/g, \"%29\");\n e.width > s && (n = Math.min(n, s / e.width));\n const i = e.width * n,\n o = e.height * n,\n a = [\"font-size:1px;\", \"padding:\".concat(Math.floor(o / 2), \"px \").concat(Math.floor(i / 2), \"px;\"), \"line-height:\".concat(o, \"px;\"), \"background:url(\".concat(r, \");\"), \"background-size:\".concat(i, \"px \").concat(o, \"px;\"), \"color:transparent;\"].join(\"\");\n return [\"\".concat(t, \" %c+\"), a];\n}\n\nlet In;\n\n(function (e) {\n e[e.BLACK = 30] = \"BLACK\", e[e.RED = 31] = \"RED\", e[e.GREEN = 32] = \"GREEN\", e[e.YELLOW = 33] = \"YELLOW\", e[e.BLUE = 34] = \"BLUE\", e[e.MAGENTA = 35] = \"MAGENTA\", e[e.CYAN = 36] = \"CYAN\", e[e.WHITE = 37] = \"WHITE\", e[e.BRIGHT_BLACK = 90] = \"BRIGHT_BLACK\", e[e.BRIGHT_RED = 91] = \"BRIGHT_RED\", e[e.BRIGHT_GREEN = 92] = \"BRIGHT_GREEN\", e[e.BRIGHT_YELLOW = 93] = \"BRIGHT_YELLOW\", e[e.BRIGHT_BLUE = 94] = \"BRIGHT_BLUE\", e[e.BRIGHT_MAGENTA = 95] = \"BRIGHT_MAGENTA\", e[e.BRIGHT_CYAN = 96] = \"BRIGHT_CYAN\", e[e.BRIGHT_WHITE = 97] = \"BRIGHT_WHITE\";\n})(In || (In = {}));\n\nconst gl = 10;\n\nfunction ni(e) {\n return typeof e != \"string\" ? e : (e = e.toUpperCase(), In[e] || In.WHITE);\n}\n\nfunction Al(e, t, n) {\n if (!Xe && typeof e == \"string\") {\n if (t) {\n const s = ni(t);\n e = \"\\x1B[\".concat(s, \"m\").concat(e, \"\\x1B[39m\");\n }\n\n if (n) {\n const s = ni(n);\n e = \"\\x1B[\".concat(s + gl, \"m\").concat(e, \"\\x1B[49m\");\n }\n }\n\n return e;\n}\n\nfunction pl(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [\"constructor\"];\n const n = Object.getPrototypeOf(e),\n s = Object.getOwnPropertyNames(n),\n r = e;\n\n for (const i of s) {\n const o = r[i];\n typeof o == \"function\" && (t.find(a => i === a) || (r[i] = o.bind(e)));\n }\n}\n\nfunction xn(e, t) {\n if (!e) throw new Error(t || \"Assertion failed\");\n}\n\nfunction ae() {\n let e;\n\n if (Xe() && Ze.performance) {\n var t, n;\n e = Ze == null || (t = Ze.performance) === null || t === void 0 || (n = t.now) === null || n === void 0 ? void 0 : n.call(t);\n } else if (\"hrtime\" in Ee) {\n var s;\n const r = Ee == null || (s = Ee.hrtime) === null || s === void 0 ? void 0 : s.call(Ee);\n e = r[0] * 1e3 + r[1] / 1e6;\n } else e = Date.now();\n\n return e;\n}\n\nconst ce = {\n debug: Xe() && console.debug || console.log,\n log: console.log,\n info: console.info,\n warn: console.warn,\n error: console.error\n},\n yl = {\n enabled: !0,\n level: 0\n};\n\nfunction Ct() {}\n\nconst si = {},\n ri = {\n once: !0\n};\n\nclass zn {\n constructor() {\n let {\n id: t\n } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {\n id: \"\"\n };\n this.id = void 0, this.VERSION = ia, this._startTs = ae(), this._deltaTs = ae(), this._storage = void 0, this.userData = {}, this.LOG_THROTTLE_TIMEOUT = 0, this.id = t, this.userData = {}, this._storage = new fl(\"__probe-\".concat(this.id, \"__\"), yl), this.timeStamp(\"\".concat(this.id, \" started\")), pl(this), Object.seal(this);\n }\n\n set level(t) {\n this.setLevel(t);\n }\n\n get level() {\n return this.getLevel();\n }\n\n isEnabled() {\n return this._storage.config.enabled;\n }\n\n getLevel() {\n return this._storage.config.level;\n }\n\n getTotal() {\n return Number((ae() - this._startTs).toPrecision(10));\n }\n\n getDelta() {\n return Number((ae() - this._deltaTs).toPrecision(10));\n }\n\n set priority(t) {\n this.level = t;\n }\n\n get priority() {\n return this.level;\n }\n\n getPriority() {\n return this.level;\n }\n\n enable() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0;\n return this._storage.setConfiguration({\n enabled: t\n }), this;\n }\n\n setLevel(t) {\n return this._storage.setConfiguration({\n level: t\n }), this;\n }\n\n get(t) {\n return this._storage.config[t];\n }\n\n set(t, n) {\n this._storage.setConfiguration({\n [t]: n\n });\n }\n\n settings() {\n console.table ? console.table(this._storage.config) : console.log(this._storage.config);\n }\n\n assert(t, n) {\n xn(t, n);\n }\n\n warn(t) {\n return this._getLogFunction(0, t, ce.warn, arguments, ri);\n }\n\n error(t) {\n return this._getLogFunction(0, t, ce.error, arguments);\n }\n\n deprecated(t, n) {\n return this.warn(\"`\".concat(t, \"` is deprecated and will be removed in a later version. Use `\").concat(n, \"` instead\"));\n }\n\n removed(t, n) {\n return this.error(\"`\".concat(t, \"` has been removed. Use `\").concat(n, \"` instead\"));\n }\n\n probe(t, n) {\n return this._getLogFunction(t, n, ce.log, arguments, {\n time: !0,\n once: !0\n });\n }\n\n log(t, n) {\n return this._getLogFunction(t, n, ce.debug, arguments);\n }\n\n info(t, n) {\n return this._getLogFunction(t, n, console.info, arguments);\n }\n\n once(t, n) {\n return this._getLogFunction(t, n, ce.debug || ce.info, arguments, ri);\n }\n\n table(t, n, s) {\n return n ? this._getLogFunction(t, n, console.table || Ct, s && [s], {\n tag: Tl(n)\n }) : Ct;\n }\n\n image(t) {\n let {\n logLevel: n,\n priority: s,\n image: r,\n message: i = \"\",\n scale: o = 1\n } = t;\n return this._shouldLog(n || s) ? Xe() ? El({\n image: r,\n message: i,\n scale: o\n }) : Cl() : Ct;\n }\n\n time(t, n) {\n return this._getLogFunction(t, n, console.time ? console.time : console.info);\n }\n\n timeEnd(t, n) {\n return this._getLogFunction(t, n, console.timeEnd ? console.timeEnd : console.info);\n }\n\n timeStamp(t, n) {\n return this._getLogFunction(t, n, console.timeStamp || Ct);\n }\n\n group(t, n) {\n let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {\n collapsed: !1\n };\n const r = ii({\n logLevel: t,\n message: n,\n opts: s\n }),\n {\n collapsed: i\n } = s;\n return r.method = (i ? console.groupCollapsed : console.group) || console.info, this._getLogFunction(r);\n }\n\n groupCollapsed(t, n) {\n let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};\n return this.group(t, n, Object.assign({}, s, {\n collapsed: !0\n }));\n }\n\n groupEnd(t) {\n return this._getLogFunction(t, \"\", console.groupEnd || Ct);\n }\n\n withGroup(t, n, s) {\n this.group(t, n)();\n\n try {\n s();\n } finally {\n this.groupEnd(t)();\n }\n }\n\n trace() {\n console.trace && console.trace();\n }\n\n _shouldLog(t) {\n return this.isEnabled() && this.getLevel() >= oa(t);\n }\n\n _getLogFunction(t, n, s, r, i) {\n if (this._shouldLog(t)) {\n i = ii({\n logLevel: t,\n message: n,\n args: r,\n opts: i\n }), s = s || i.method, xn(s), i.total = this.getTotal(), i.delta = this.getDelta(), this._deltaTs = ae();\n const o = i.tag || i.message;\n if (i.once && o) if (!si[o]) si[o] = ae();else return Ct;\n return n = Bl(this.id, i.message, i), s.bind(console, n, ...i.args);\n }\n\n return Ct;\n }\n\n}\n\nzn.VERSION = ia;\n\nfunction oa(e) {\n if (!e) return 0;\n let t;\n\n switch (typeof e) {\n case \"number\":\n t = e;\n break;\n\n case \"object\":\n t = e.logLevel || e.priority || 0;\n break;\n\n default:\n return 0;\n }\n\n return xn(Number.isFinite(t) && t >= 0), t;\n}\n\nfunction ii(e) {\n const {\n logLevel: t,\n message: n\n } = e;\n e.logLevel = oa(t);\n const s = e.args ? Array.from(e.args) : [];\n\n for (; s.length && s.shift() !== n;);\n\n switch (typeof t) {\n case \"string\":\n case \"function\":\n n !== void 0 && s.unshift(n), e.message = t;\n break;\n\n case \"object\":\n Object.assign(e, t);\n break;\n }\n\n typeof e.message == \"function\" && (e.message = e.message());\n const r = typeof e.message;\n return xn(r === \"string\" || r === \"object\"), Object.assign(e, {\n args: s\n }, e.opts);\n}\n\nfunction Bl(e, t, n) {\n if (typeof t == \"string\") {\n const s = n.time ? ml(dl(n.total)) : \"\";\n t = n.time ? \"\".concat(e, \": \").concat(s, \" \").concat(t) : \"\".concat(e, \": \").concat(t), t = Al(t, n.color, n.background);\n }\n\n return t;\n}\n\nfunction Cl(e) {\n return console.warn(\"removed\"), Ct;\n}\n\nfunction El(e) {\n let {\n image: t,\n message: n = \"\",\n scale: s = 1\n } = e;\n\n if (typeof t == \"string\") {\n const i = new Image();\n return i.onload = () => {\n const o = ls(i, n, s);\n console.log(...o);\n }, i.src = t, Ct;\n }\n\n const r = t.nodeName || \"\";\n if (r.toLowerCase() === \"img\") return console.log(...ls(t, n, s)), Ct;\n\n if (r.toLowerCase() === \"canvas\") {\n const i = new Image();\n return i.onload = () => console.log(...ls(i, n, s)), i.src = t.toDataURL(), Ct;\n }\n\n return Ct;\n}\n\nfunction Tl(e) {\n for (const t in e) for (const n in e[t]) return n || \"untitled\";\n\n return \"empty\";\n}\n\nconst aa = new zn({\n id: \"@probe.gl/log\"\n}),\n oi = new zn({\n id: \"loaders.gl\"\n});\n\nclass bl {\n log() {\n return () => {};\n }\n\n info() {\n return () => {};\n }\n\n warn() {\n return () => {};\n }\n\n error() {\n return () => {};\n }\n\n}\n\nclass _l {\n constructor() {\n this.console = void 0, this.console = console;\n }\n\n log() {\n for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) n[s] = arguments[s];\n\n return this.console.log.bind(this.console, ...n);\n }\n\n info() {\n for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) n[s] = arguments[s];\n\n return this.console.info.bind(this.console, ...n);\n }\n\n warn() {\n for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) n[s] = arguments[s];\n\n return this.console.warn.bind(this.console, ...n);\n }\n\n error() {\n for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) n[s] = arguments[s];\n\n return this.console.error.bind(this.console, ...n);\n }\n\n}\n\nconst ca = {\n fetch: null,\n mimeType: void 0,\n nothrow: !1,\n log: new _l(),\n useLocalLibraries: !1,\n CDN: \"https://unpkg.com/@loaders.gl\",\n worker: !0,\n maxConcurrency: 3,\n maxMobileConcurrency: 1,\n reuseWorkers: kn,\n _nodeWorkers: !1,\n _workerType: \"\",\n limit: 0,\n _limitMB: 0,\n batchSize: \"auto\",\n batchDebounceMs: 0,\n metadata: !1,\n transforms: []\n},\n wl = {\n throws: \"nothrow\",\n dataType: \"(no longer used)\",\n uri: \"baseUri\",\n method: \"fetch.method\",\n headers: \"fetch.headers\",\n body: \"fetch.body\",\n mode: \"fetch.mode\",\n credentials: \"fetch.credentials\",\n cache: \"fetch.cache\",\n redirect: \"fetch.redirect\",\n referrer: \"fetch.referrer\",\n referrerPolicy: \"fetch.referrerPolicy\",\n integrity: \"fetch.integrity\",\n keepalive: \"fetch.keepalive\",\n signal: \"fetch.signal\"\n};\n\nfunction ua() {\n globalThis.loaders = globalThis.loaders || {};\n const {\n loaders: e\n } = globalThis;\n return e._state = e._state || {}, e._state;\n}\n\nfunction la() {\n const e = ua();\n return e.globalOptions = e.globalOptions || { ...ca\n }, e.globalOptions;\n}\n\nfunction Rl(e, t, n, s) {\n return n = n || [], n = Array.isArray(n) ? n : [n], Ml(e, n), Il(t, e, s);\n}\n\nfunction Ml(e, t) {\n ai(e, null, ca, wl, t);\n\n for (const n of t) {\n const s = e && e[n.id] || {},\n r = n.options && n.options[n.id] || {},\n i = n.deprecatedOptions && n.deprecatedOptions[n.id] || {};\n ai(s, n.id, r, i, t);\n }\n}\n\nfunction ai(e, t, n, s, r) {\n const i = t || \"Top level\",\n o = t ? `${t}.` : \"\";\n\n for (const a in e) {\n const c = !t && We(e[a]),\n u = a === \"baseUri\" && !t,\n l = a === \"workerUrl\" && t;\n\n if (!(a in n) && !u && !l) {\n if (a in s) oi.warn(`${i} loader option '${o}${a}' no longer supported, use '${s[a]}'`)();else if (!c) {\n const h = Sl(a, r);\n oi.warn(`${i} loader option '${o}${a}' not recognized. ${h}`)();\n }\n }\n }\n}\n\nfunction Sl(e, t) {\n const n = e.toLowerCase();\n let s = \"\";\n\n for (const r of t) for (const i in r.options) {\n if (e === i) return `Did you mean '${r.id}.${i}'?`;\n const o = i.toLowerCase();\n (n.startsWith(o) || o.startsWith(n)) && (s = s || `Did you mean '${r.id}.${i}'?`);\n }\n\n return s;\n}\n\nfunction Il(e, t, n) {\n const r = { ...(e.options || {})\n };\n return xl(r, n), r.log === null && (r.log = new bl()), ci(r, la()), ci(r, t), r;\n}\n\nfunction ci(e, t) {\n for (const n in t) if (n in t) {\n const s = t[n];\n ti(s) && ti(e[n]) ? e[n] = { ...e[n],\n ...t[n]\n } : e[n] = t[n];\n }\n}\n\nfunction xl(e, t) {\n t && !(\"baseUri\" in e) && (e.baseUri = t);\n}\n\nfunction Ar(e) {\n var t;\n return e ? (Array.isArray(e) && (e = e[0]), Array.isArray((t = e) === null || t === void 0 ? void 0 : t.extensions)) : !1;\n}\n\nfunction ha(e) {\n var t, n;\n z(e, \"null loader\"), z(Ar(e), \"invalid loader\");\n let s;\n return Array.isArray(e) && (s = e[1], e = e[0], e = { ...e,\n options: { ...e.options,\n ...s\n }\n }), ((t = e) !== null && t !== void 0 && t.parseTextSync || (n = e) !== null && n !== void 0 && n.parseText) && (e.text = !0), e.text || (e.binary = !0), e;\n}\n\nconst vl = () => {\n const e = ua();\n return e.loaderRegistry = e.loaderRegistry || [], e.loaderRegistry;\n};\n\nfunction Ol() {\n return vl();\n}\n\nconst Fl = new zn({\n id: \"loaders.gl\"\n}),\n Dl = /\\.([^.]+)$/;\n\nasync function Ll(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [],\n n = arguments.length > 2 ? arguments[2] : void 0,\n s = arguments.length > 3 ? arguments[3] : void 0;\n if (!fa(e)) return null;\n let r = ui(e, t, { ...n,\n nothrow: !0\n }, s);\n if (r) return r;\n if (re(e) && (e = await e.slice(0, 10).arrayBuffer(), r = ui(e, t, n, s)), !r && !(n != null && n.nothrow)) throw new Error(da(e));\n return r;\n}\n\nfunction ui(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [],\n n = arguments.length > 2 ? arguments[2] : void 0,\n s = arguments.length > 3 ? arguments[3] : void 0;\n if (!fa(e)) return null;\n if (t && !Array.isArray(t)) return ha(t);\n let r = [];\n t && (r = r.concat(t)), n != null && n.ignoreRegisteredLoaders || r.push(...Ol()), Gl(r);\n const i = Pl(e, r, n, s);\n if (!i && !(n != null && n.nothrow)) throw new Error(da(e));\n return i;\n}\n\nfunction Pl(e, t, n, s) {\n const r = Kn(e),\n i = gr(e),\n o = mr(r) || (s == null ? void 0 : s.url);\n let a = null,\n c = \"\";\n\n if (n != null && n.mimeType && (a = hs(t, n == null ? void 0 : n.mimeType), c = `match forced by supplied MIME type ${n == null ? void 0 : n.mimeType}`), a = a || Nl(t, o), c = c || (a ? `matched url ${o}` : \"\"), a = a || hs(t, i), c = c || (a ? `matched MIME type ${i}` : \"\"), a = a || Hl(t, e), c = c || (a ? `matched initial data ${ma(e)}` : \"\"), n != null && n.fallbackMimeType && (a = a || hs(t, n == null ? void 0 : n.fallbackMimeType), c = c || (a ? `matched fallback MIME type ${i}` : \"\")), c) {\n var u;\n Fl.log(1, `selectLoader selected ${(u = a) === null || u === void 0 ? void 0 : u.name}: ${c}.`);\n }\n\n return a;\n}\n\nfunction fa(e) {\n return !(e instanceof Response && e.status === 204);\n}\n\nfunction da(e) {\n const t = Kn(e),\n n = gr(e);\n let s = \"No valid loader found (\";\n s += t ? `${ta(t)}, ` : \"no url provided, \", s += `MIME type: ${n ? `\"${n}\"` : \"not provided\"}, `;\n const r = e ? ma(e) : \"\";\n return s += r ? ` first bytes: \"${r}\"` : \"first bytes: not available\", s += \")\", s;\n}\n\nfunction Gl(e) {\n for (const t of e) ha(t);\n}\n\nfunction Nl(e, t) {\n const n = t && Dl.exec(t),\n s = n && n[1];\n return s ? Ul(e, s) : null;\n}\n\nfunction Ul(e, t) {\n t = t.toLowerCase();\n\n for (const n of e) for (const s of n.extensions) if (s.toLowerCase() === t) return n;\n\n return null;\n}\n\nfunction hs(e, t) {\n for (const n of e) if (n.mimeTypes && n.mimeTypes.includes(t) || t === `application/x.${n.id}`) return n;\n\n return null;\n}\n\nfunction Hl(e, t) {\n if (!t) return null;\n\n for (const n of e) if (typeof t == \"string\") {\n if (Jl(t, n)) return n;\n } else if (ArrayBuffer.isView(t)) {\n if (li(t.buffer, t.byteOffset, n)) return n;\n } else if (t instanceof ArrayBuffer && li(t, 0, n)) return n;\n\n return null;\n}\n\nfunction Jl(e, t) {\n return t.testText ? t.testText(e) : (Array.isArray(t.tests) ? t.tests : [t.tests]).some(s => e.startsWith(s));\n}\n\nfunction li(e, t, n) {\n return (Array.isArray(n.tests) ? n.tests : [n.tests]).some(r => Vl(e, t, n, r));\n}\n\nfunction Vl(e, t, n, s) {\n if (s instanceof ArrayBuffer) return Lu(s, e, s.byteLength);\n\n switch (typeof s) {\n case \"function\":\n return s(e);\n\n case \"string\":\n const r = js(e, t, s.length);\n return s === r;\n\n default:\n return !1;\n }\n}\n\nfunction ma(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 5;\n return typeof e == \"string\" ? e.slice(0, t) : ArrayBuffer.isView(e) ? js(e.buffer, e.byteOffset, t) : e instanceof ArrayBuffer ? js(e, 0, t) : \"\";\n}\n\nfunction js(e, t, n) {\n if (e.byteLength < t + n) return \"\";\n const s = new DataView(e);\n let r = \"\";\n\n for (let i = 0; i < n; i++) r += String.fromCharCode(s.getUint8(t + i));\n\n return r;\n}\n\nconst jl = 256 * 1024;\n\nfunction* kl(e, t) {\n const n = (t == null ? void 0 : t.chunkSize) || jl;\n let s = 0;\n const r = new TextEncoder();\n\n for (; s < e.length;) {\n const i = Math.min(e.length - s, n),\n o = e.slice(s, s + i);\n s += i, yield r.encode(o);\n }\n}\n\nconst Kl = 256 * 1024;\n\nfunction zl(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n return function* () {\n const {\n chunkSize: n = Kl\n } = t;\n let s = 0;\n\n for (; s < e.byteLength;) {\n const r = Math.min(e.byteLength - s, n),\n i = new ArrayBuffer(r),\n o = new Uint8Array(e, s, r);\n new Uint8Array(i).set(o), s += r, yield i;\n }\n }();\n}\n\nconst Wl = 1024 * 1024;\n\nasync function* Xl(e, t) {\n const n = (t == null ? void 0 : t.chunkSize) || Wl;\n let s = 0;\n\n for (; s < e.size;) {\n const r = s + n,\n i = await e.slice(s, r).arrayBuffer();\n s = r, yield i;\n }\n}\n\nfunction hi(e, t) {\n return kn ? Ql(e, t) : ql(e);\n}\n\nasync function* Ql(e, t) {\n const n = e.getReader();\n let s;\n\n try {\n for (;;) {\n const r = s || n.read();\n t != null && t._streamReadAhead && (s = n.read());\n const {\n done: i,\n value: o\n } = await r;\n if (i) return;\n yield Zo(o);\n }\n } catch {\n n.releaseLock();\n }\n}\n\nasync function* ql(e, t) {\n for await (const n of e) yield Zo(n);\n}\n\nfunction Yl(e, t) {\n if (typeof e == \"string\") return kl(e, t);\n if (e instanceof ArrayBuffer) return zl(e, t);\n if (re(e)) return Xl(e, t);\n if (na(e)) return hi(e, t);\n if (se(e)) return hi(e.body, t);\n throw new Error(\"makeIterator\");\n}\n\nconst ga = \"Cannot convert supplied data type\";\n\nfunction $l(e, t, n) {\n if (t.text && typeof e == \"string\") return e;\n\n if (Qu(e) && (e = e.buffer), e instanceof ArrayBuffer) {\n const s = e;\n return t.text && !t.binary ? new TextDecoder(\"utf8\").decode(s) : s;\n }\n\n if (ArrayBuffer.isView(e)) {\n if (t.text && !t.binary) return new TextDecoder(\"utf8\").decode(e);\n let s = e.buffer;\n const r = e.byteLength || e.length;\n return (e.byteOffset !== 0 || r !== s.byteLength) && (s = s.slice(e.byteOffset, e.byteOffset + r)), s;\n }\n\n throw new Error(ga);\n}\n\nasync function Zl(e, t, n) {\n const s = e instanceof ArrayBuffer || ArrayBuffer.isView(e);\n if (typeof e == \"string\" || s) return $l(e, t);\n\n if (re(e) && (e = await ra(e)), se(e)) {\n const r = e;\n return await sl(r), t.binary ? await r.arrayBuffer() : await r.text();\n }\n\n if (na(e) && (e = Yl(e, n)), Wu(e) || Xu(e)) return Uu(e);\n throw new Error(ga);\n}\n\nfunction Aa(e, t) {\n const n = la(),\n s = e || n;\n return typeof s.fetch == \"function\" ? s.fetch : We(s.fetch) ? r => Ge(r, s.fetch) : t != null && t.fetch ? t == null ? void 0 : t.fetch : Ge;\n}\n\nfunction th(e, t, n) {\n if (n) return n;\n const s = {\n fetch: Aa(t, e),\n ...e\n };\n\n if (s.url) {\n const r = mr(s.url);\n s.baseUrl = r, s.queryString = el(s.url), s.filename = ta(r), s.baseUrl = ea(r);\n }\n\n return Array.isArray(s.loaders) || (s.loaders = null), s;\n}\n\nfunction eh(e, t) {\n if (e && !Array.isArray(e)) return e;\n let n;\n\n if (e && (n = Array.isArray(e) ? e : [e]), t && t.loaders) {\n const s = Array.isArray(t.loaders) ? t.loaders : [t.loaders];\n n = n ? [...n, ...s] : s;\n }\n\n return n && n.length ? n : void 0;\n}\n\nasync function vn(e, t, n, s) {\n t && !Array.isArray(t) && !Ar(t) && (s = void 0, n = t, t = void 0), e = await e, n = n || {};\n const r = Kn(e),\n o = eh(t, s),\n a = await Ll(e, o, n);\n return a ? (n = Rl(n, a, o, r), s = th({\n url: r,\n _parse: vn,\n loaders: o\n }, n, s || null), await nh(a, e, n, s)) : null;\n}\n\nasync function nh(e, t, n, s) {\n if (Tu(e), n = hu(e.options, n), se(t)) {\n const i = t,\n {\n ok: o,\n redirected: a,\n status: c,\n statusText: u,\n type: l,\n url: h\n } = i,\n f = Object.fromEntries(i.headers.entries());\n s.response = {\n headers: f,\n ok: o,\n redirected: a,\n status: c,\n statusText: u,\n type: l,\n url: h\n };\n }\n\n t = await Zl(t, e, n);\n const r = e;\n if (r.parseTextSync && typeof t == \"string\") return r.parseTextSync(t, n, s);\n if (xu(e, n)) return await vu(e, t, n, s, vn);\n if (r.parseText && typeof t == \"string\") return await r.parseText(t, n, s);\n if (r.parse) return await r.parse(t, n, s);\n throw Jt(!r.parseSync), new Error(`${e.id} loader - no parser found and worker is disabled`);\n}\n\nfunction sh(e) {\n switch (e.constructor) {\n case Int8Array:\n return \"int8\";\n\n case Uint8Array:\n case Uint8ClampedArray:\n return \"uint8\";\n\n case Int16Array:\n return \"int16\";\n\n case Uint16Array:\n return \"uint16\";\n\n case Int32Array:\n return \"int32\";\n\n case Uint32Array:\n return \"uint32\";\n\n case Float32Array:\n return \"float32\";\n\n case Float64Array:\n return \"float64\";\n\n default:\n return \"null\";\n }\n}\n\nfunction rh(e) {\n let t = 1 / 0,\n n = 1 / 0,\n s = 1 / 0,\n r = -1 / 0,\n i = -1 / 0,\n o = -1 / 0;\n const a = e.POSITION ? e.POSITION.value : [],\n c = a && a.length;\n\n for (let u = 0; u < c; u += 3) {\n const l = a[u],\n h = a[u + 1],\n f = a[u + 2];\n t = l < t ? l : t, n = h < n ? h : n, s = f < s ? f : s, r = l > r ? l : r, i = h > i ? h : i, o = f > o ? f : o;\n }\n\n return [[t, n, s], [r, i, o]];\n}\n\nfunction ih(e, t, n) {\n const s = sh(t.value),\n r = n || oh(t);\n return {\n name: e,\n type: {\n type: \"fixed-size-list\",\n listSize: t.size,\n children: [{\n name: \"value\",\n type: s\n }]\n },\n nullable: !1,\n metadata: r\n };\n}\n\nfunction oh(e) {\n const t = {};\n return \"byteOffset\" in e && (t.byteOffset = e.byteOffset.toString(10)), \"byteStride\" in e && (t.byteStride = e.byteStride.toString(10)), \"normalized\" in e && (t.normalized = e.normalized.toString()), t;\n}\n\nasync function Ae(e, t, n, s) {\n let r, i;\n !Array.isArray(t) && !Ar(t) ? (r = [], i = t) : (r = t, i = n);\n const o = Aa(i);\n let a = e;\n return typeof e == \"string\" && (a = await o(e)), re(e) && (a = await o(e)), Array.isArray(r) ? await vn(a, r, i) : await vn(a, r, i);\n}\n\nconst ah = 1 / Math.PI * 180,\n ch = 1 / 180 * Math.PI,\n uh = {\n EPSILON: 1e-12,\n debug: !1,\n precision: 4,\n printTypes: !1,\n printDegrees: !1,\n printRowMajor: !0,\n _cartographicRadians: !1\n};\nglobalThis.mathgl = globalThis.mathgl || {\n config: { ...uh\n }\n};\nconst et = globalThis.mathgl.config;\n\nfunction lh(e, {\n precision: t = et.precision\n} = {}) {\n return e = gh(e), \"\".concat(parseFloat(e.toPrecision(t)));\n}\n\nfunction ee(e) {\n return Array.isArray(e) || ArrayBuffer.isView(e) && !(e instanceof DataView);\n}\n\nfunction hh(e) {\n return dh(e);\n}\n\nfunction fh(e) {\n return Rt(e);\n}\n\nfunction dh(e, t) {\n return pr(e, n => n * ch, t);\n}\n\nfunction Rt(e, t) {\n return pr(e, n => n * ah, t);\n}\n\nfunction mh(e, t, n) {\n return pr(e, s => Math.max(t, Math.min(n, s)));\n}\n\nfunction Kt(e, t, n) {\n const s = et.EPSILON;\n n && (et.EPSILON = n);\n\n try {\n if (e === t) return !0;\n\n if (ee(e) && ee(t)) {\n if (e.length !== t.length) return !1;\n\n for (let r = 0; r < e.length; ++r) if (!Kt(e[r], t[r])) return !1;\n\n return !0;\n }\n\n return e && e.equals ? e.equals(t) : t && t.equals ? t.equals(e) : typeof e == \"number\" && typeof t == \"number\" ? Math.abs(e - t) <= et.EPSILON * Math.max(1, Math.abs(e), Math.abs(t)) : !1;\n } finally {\n et.EPSILON = s;\n }\n}\n\nfunction gh(e) {\n return Math.round(e / et.EPSILON) * et.EPSILON;\n}\n\nfunction Ah(e) {\n return e.clone ? e.clone() : new Array(e.length);\n}\n\nfunction pr(e, t, n) {\n if (ee(e)) {\n const s = e;\n n = n || Ah(s);\n\n for (let r = 0; r < n.length && r < s.length; ++r) {\n const i = typeof e == \"number\" ? e : e[r];\n n[r] = t(i, r, n);\n }\n\n return n;\n }\n\n return t(e);\n}\n\nfunction ph(e) {\n function t() {\n var n = Reflect.construct(e, Array.from(arguments));\n return Object.setPrototypeOf(n, Object.getPrototypeOf(this)), n;\n }\n\n return t.prototype = Object.create(e.prototype, {\n constructor: {\n value: e,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e, t;\n}\n\nclass yr extends ph(Array) {\n clone() {\n return new this.constructor().copy(this);\n }\n\n fromArray(t, n = 0) {\n for (let s = 0; s < this.ELEMENTS; ++s) this[s] = t[s + n];\n\n return this.check();\n }\n\n toArray(t = [], n = 0) {\n for (let s = 0; s < this.ELEMENTS; ++s) t[n + s] = this[s];\n\n return t;\n }\n\n toObject(t) {\n return t;\n }\n\n from(t) {\n return Array.isArray(t) ? this.copy(t) : this.fromObject(t);\n }\n\n to(t) {\n return t === this ? this : ee(t) ? this.toArray(t) : this.toObject(t);\n }\n\n toTarget(t) {\n return t ? this.to(t) : this;\n }\n\n toFloat32Array() {\n return new Float32Array(this);\n }\n\n toString() {\n return this.formatString(et);\n }\n\n formatString(t) {\n let n = \"\";\n\n for (let s = 0; s < this.ELEMENTS; ++s) n += (s > 0 ? \", \" : \"\") + lh(this[s], t);\n\n return \"\".concat(t.printTypes ? this.constructor.name : \"\", \"[\").concat(n, \"]\");\n }\n\n equals(t) {\n if (!t || this.length !== t.length) return !1;\n\n for (let n = 0; n < this.ELEMENTS; ++n) if (!Kt(this[n], t[n])) return !1;\n\n return !0;\n }\n\n exactEquals(t) {\n if (!t || this.length !== t.length) return !1;\n\n for (let n = 0; n < this.ELEMENTS; ++n) if (this[n] !== t[n]) return !1;\n\n return !0;\n }\n\n negate() {\n for (let t = 0; t < this.ELEMENTS; ++t) this[t] = -this[t];\n\n return this.check();\n }\n\n lerp(t, n, s) {\n if (s === void 0) return this.lerp(this, t, n);\n\n for (let r = 0; r < this.ELEMENTS; ++r) {\n const i = t[r],\n o = typeof n == \"number\" ? n : n[r];\n this[r] = i + s * (o - i);\n }\n\n return this.check();\n }\n\n min(t) {\n for (let n = 0; n < this.ELEMENTS; ++n) this[n] = Math.min(t[n], this[n]);\n\n return this.check();\n }\n\n max(t) {\n for (let n = 0; n < this.ELEMENTS; ++n) this[n] = Math.max(t[n], this[n]);\n\n return this.check();\n }\n\n clamp(t, n) {\n for (let s = 0; s < this.ELEMENTS; ++s) this[s] = Math.min(Math.max(this[s], t[s]), n[s]);\n\n return this.check();\n }\n\n add(...t) {\n for (const n of t) for (let s = 0; s < this.ELEMENTS; ++s) this[s] += n[s];\n\n return this.check();\n }\n\n subtract(...t) {\n for (const n of t) for (let s = 0; s < this.ELEMENTS; ++s) this[s] -= n[s];\n\n return this.check();\n }\n\n scale(t) {\n if (typeof t == \"number\") for (let n = 0; n < this.ELEMENTS; ++n) this[n] *= t;else for (let n = 0; n < this.ELEMENTS && n < t.length; ++n) this[n] *= t[n];\n return this.check();\n }\n\n multiplyByScalar(t) {\n for (let n = 0; n < this.ELEMENTS; ++n) this[n] *= t;\n\n return this.check();\n }\n\n check() {\n if (et.debug && !this.validate()) throw new Error(\"math.gl: \".concat(this.constructor.name, \" some fields set to invalid numbers'\"));\n return this;\n }\n\n validate() {\n let t = this.length === this.ELEMENTS;\n\n for (let n = 0; n < this.ELEMENTS; ++n) t = t && Number.isFinite(this[n]);\n\n return t;\n }\n\n sub(t) {\n return this.subtract(t);\n }\n\n setScalar(t) {\n for (let n = 0; n < this.ELEMENTS; ++n) this[n] = t;\n\n return this.check();\n }\n\n addScalar(t) {\n for (let n = 0; n < this.ELEMENTS; ++n) this[n] += t;\n\n return this.check();\n }\n\n subScalar(t) {\n return this.addScalar(-t);\n }\n\n multiplyScalar(t) {\n for (let n = 0; n < this.ELEMENTS; ++n) this[n] *= t;\n\n return this.check();\n }\n\n divideScalar(t) {\n return this.multiplyByScalar(1 / t);\n }\n\n clampScalar(t, n) {\n for (let s = 0; s < this.ELEMENTS; ++s) this[s] = Math.min(Math.max(this[s], t), n);\n\n return this.check();\n }\n\n get elements() {\n return this;\n }\n\n}\n\nfunction yh(e, t) {\n if (e.length !== t) return !1;\n\n for (let n = 0; n < e.length; ++n) if (!Number.isFinite(e[n])) return !1;\n\n return !0;\n}\n\nfunction U(e) {\n if (!Number.isFinite(e)) throw new Error(\"Invalid number \".concat(JSON.stringify(e)));\n return e;\n}\n\nfunction Oe(e, t, n = \"\") {\n if (et.debug && !yh(e, t)) throw new Error(\"math.gl: \".concat(n, \" some fields set to invalid numbers'\"));\n return e;\n}\n\nfunction j(e, t) {\n if (!e) throw new Error(\"math.gl assertion \".concat(t));\n}\n\nclass Br extends yr {\n get x() {\n return this[0];\n }\n\n set x(t) {\n this[0] = U(t);\n }\n\n get y() {\n return this[1];\n }\n\n set y(t) {\n this[1] = U(t);\n }\n\n len() {\n return Math.sqrt(this.lengthSquared());\n }\n\n magnitude() {\n return this.len();\n }\n\n lengthSquared() {\n let t = 0;\n\n for (let n = 0; n < this.ELEMENTS; ++n) t += this[n] * this[n];\n\n return t;\n }\n\n magnitudeSquared() {\n return this.lengthSquared();\n }\n\n distance(t) {\n return Math.sqrt(this.distanceSquared(t));\n }\n\n distanceSquared(t) {\n let n = 0;\n\n for (let s = 0; s < this.ELEMENTS; ++s) {\n const r = this[s] - t[s];\n n += r * r;\n }\n\n return U(n);\n }\n\n dot(t) {\n let n = 0;\n\n for (let s = 0; s < this.ELEMENTS; ++s) n += this[s] * t[s];\n\n return U(n);\n }\n\n normalize() {\n const t = this.magnitude();\n if (t !== 0) for (let n = 0; n < this.ELEMENTS; ++n) this[n] /= t;\n return this.check();\n }\n\n multiply(...t) {\n for (const n of t) for (let s = 0; s < this.ELEMENTS; ++s) this[s] *= n[s];\n\n return this.check();\n }\n\n divide(...t) {\n for (const n of t) for (let s = 0; s < this.ELEMENTS; ++s) this[s] /= n[s];\n\n return this.check();\n }\n\n lengthSq() {\n return this.lengthSquared();\n }\n\n distanceTo(t) {\n return this.distance(t);\n }\n\n distanceToSquared(t) {\n return this.distanceSquared(t);\n }\n\n getComponent(t) {\n return j(t >= 0 && t < this.ELEMENTS, \"index is out of range\"), U(this[t]);\n }\n\n setComponent(t, n) {\n return j(t >= 0 && t < this.ELEMENTS, \"index is out of range\"), this[t] = n, this.check();\n }\n\n addVectors(t, n) {\n return this.copy(t).add(n);\n }\n\n subVectors(t, n) {\n return this.copy(t).subtract(n);\n }\n\n multiplyVectors(t, n) {\n return this.copy(t).multiply(n);\n }\n\n addScaledVector(t, n) {\n return this.add(new this.constructor(t).multiplyScalar(n));\n }\n\n}\n\nconst Fe = 1e-6;\nlet It = typeof Float32Array < \"u\" ? Float32Array : Array;\n\nfunction Bh() {\n const e = new It(2);\n return It != Float32Array && (e[0] = 0, e[1] = 0), e;\n}\n\nfunction Ch(e, t, n) {\n const s = t[0],\n r = t[1];\n return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e;\n}\n\nfunction Eh(e, t, n) {\n const s = t[0],\n r = t[1];\n return e[0] = n[0] * s + n[2] * r + n[4], e[1] = n[1] * s + n[3] * r + n[5], e;\n}\n\nfunction pa(e, t, n) {\n const s = t[0],\n r = t[1];\n return e[0] = n[0] * s + n[3] * r + n[6], e[1] = n[1] * s + n[4] * r + n[7], e;\n}\n\nfunction ya(e, t, n) {\n const s = t[0],\n r = t[1];\n return e[0] = n[0] * s + n[4] * r + n[12], e[1] = n[1] * s + n[5] * r + n[13], e;\n}\n\n(function () {\n const e = Bh();\n return function (t, n, s, r, i, o) {\n let a, c;\n\n for (n || (n = 2), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) e[0] = t[a], e[1] = t[a + 1], i(e, e, o), t[a] = e[0], t[a + 1] = e[1];\n\n return t;\n };\n})();\n\nfunction Ba(e, t, n) {\n const s = t[0],\n r = t[1],\n i = n[3] * s + n[7] * r || 1;\n return e[0] = (n[0] * s + n[4] * r) / i, e[1] = (n[1] * s + n[5] * r) / i, e;\n}\n\nfunction Ca(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2],\n o = n[3] * s + n[7] * r + n[11] * i || 1;\n return e[0] = (n[0] * s + n[4] * r + n[8] * i) / o, e[1] = (n[1] * s + n[5] * r + n[9] * i) / o, e[2] = (n[2] * s + n[6] * r + n[10] * i) / o, e;\n}\n\nfunction Th(e, t, n) {\n const s = t[0],\n r = t[1];\n return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e[2] = t[2], e;\n}\n\nfunction bh(e, t, n) {\n const s = t[0],\n r = t[1];\n return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e[2] = t[2], e[3] = t[3], e;\n}\n\nfunction Ea(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2];\n return e[0] = n[0] * s + n[3] * r + n[6] * i, e[1] = n[1] * s + n[4] * r + n[7] * i, e[2] = n[2] * s + n[5] * r + n[8] * i, e[3] = t[3], e;\n}\n\nclass Wn extends Br {\n constructor(t = 0, n = 0) {\n super(2), ee(t) && arguments.length === 1 ? this.copy(t) : (et.debug && (U(t), U(n)), this[0] = t, this[1] = n);\n }\n\n set(t, n) {\n return this[0] = t, this[1] = n, this.check();\n }\n\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this.check();\n }\n\n fromObject(t) {\n return et.debug && (U(t.x), U(t.y)), this[0] = t.x, this[1] = t.y, this.check();\n }\n\n toObject(t) {\n return t.x = this[0], t.y = this[1], t;\n }\n\n get ELEMENTS() {\n return 2;\n }\n\n horizontalAngle() {\n return Math.atan2(this.y, this.x);\n }\n\n verticalAngle() {\n return Math.atan2(this.x, this.y);\n }\n\n transform(t) {\n return this.transformAsPoint(t);\n }\n\n transformAsPoint(t) {\n return ya(this, this, t), this.check();\n }\n\n transformAsVector(t) {\n return Ba(this, this, t), this.check();\n }\n\n transformByMatrix3(t) {\n return pa(this, this, t), this.check();\n }\n\n transformByMatrix2x3(t) {\n return Eh(this, this, t), this.check();\n }\n\n transformByMatrix2(t) {\n return Ch(this, this, t), this.check();\n }\n\n}\n\nfunction Ta() {\n const e = new It(3);\n return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e;\n}\n\nfunction ba(e) {\n const t = e[0],\n n = e[1],\n s = e[2];\n return Math.sqrt(t * t + n * n + s * s);\n}\n\nfunction fi(e, t, n) {\n const s = new It(3);\n return s[0] = e, s[1] = t, s[2] = n, s;\n}\n\nfunction _h(e, t) {\n const n = t[0],\n s = t[1],\n r = t[2];\n let i = n * n + s * s + r * r;\n return i > 0 && (i = 1 / Math.sqrt(i)), e[0] = t[0] * i, e[1] = t[1] * i, e[2] = t[2] * i, e;\n}\n\nfunction Cr(e, t) {\n return e[0] * t[0] + e[1] * t[1] + e[2] * t[2];\n}\n\nfunction Tn(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2],\n o = n[0],\n a = n[1],\n c = n[2];\n return e[0] = r * c - i * a, e[1] = i * o - s * c, e[2] = s * a - r * o, e;\n}\n\nfunction Er(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2];\n let o = n[3] * s + n[7] * r + n[11] * i + n[15];\n return o = o || 1, e[0] = (n[0] * s + n[4] * r + n[8] * i + n[12]) / o, e[1] = (n[1] * s + n[5] * r + n[9] * i + n[13]) / o, e[2] = (n[2] * s + n[6] * r + n[10] * i + n[14]) / o, e;\n}\n\nfunction _a(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2];\n return e[0] = s * n[0] + r * n[3] + i * n[6], e[1] = s * n[1] + r * n[4] + i * n[7], e[2] = s * n[2] + r * n[5] + i * n[8], e;\n}\n\nfunction wa(e, t, n) {\n const s = n[0],\n r = n[1],\n i = n[2],\n o = n[3],\n a = t[0],\n c = t[1],\n u = t[2];\n let l = r * u - i * c,\n h = i * a - s * u,\n f = s * c - r * a,\n d = r * f - i * h,\n m = i * l - s * f,\n g = s * h - r * l;\n const y = o * 2;\n return l *= y, h *= y, f *= y, d *= 2, m *= 2, g *= 2, e[0] = a + l + d, e[1] = c + h + m, e[2] = u + f + g, e;\n}\n\nfunction wh(e, t, n, s) {\n const r = [],\n i = [];\n return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[0], i[1] = r[1] * Math.cos(s) - r[2] * Math.sin(s), i[2] = r[1] * Math.sin(s) + r[2] * Math.cos(s), e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e;\n}\n\nfunction Rh(e, t, n, s) {\n const r = [],\n i = [];\n return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[2] * Math.sin(s) + r[0] * Math.cos(s), i[1] = r[1], i[2] = r[2] * Math.cos(s) - r[0] * Math.sin(s), e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e;\n}\n\nfunction Mh(e, t, n, s) {\n const r = [],\n i = [];\n return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[0] * Math.cos(s) - r[1] * Math.sin(s), i[1] = r[0] * Math.sin(s) + r[1] * Math.cos(s), i[2] = r[2], e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e;\n}\n\nfunction Sh(e, t) {\n const n = e[0],\n s = e[1],\n r = e[2],\n i = t[0],\n o = t[1],\n a = t[2],\n c = Math.sqrt((n * n + s * s + r * r) * (i * i + o * o + a * a)),\n u = c && Cr(e, t) / c;\n return Math.acos(Math.min(Math.max(u, -1), 1));\n}\n\nconst Ih = ba;\n\n(function () {\n const e = Ta();\n return function (t, n, s, r, i, o) {\n let a, c;\n\n for (n || (n = 3), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) e[0] = t[a], e[1] = t[a + 1], e[2] = t[a + 2], i(e, e, o), t[a] = e[0], t[a + 1] = e[1], t[a + 2] = e[2];\n\n return t;\n };\n})();\n\nconst fs = [0, 0, 0];\nlet tn;\n\nclass A extends Br {\n static get ZERO() {\n return tn || (tn = new A(0, 0, 0), Object.freeze(tn)), tn;\n }\n\n constructor(t = 0, n = 0, s = 0) {\n super(-0, -0, -0), arguments.length === 1 && ee(t) ? this.copy(t) : (et.debug && (U(t), U(n), U(s)), this[0] = t, this[1] = n, this[2] = s);\n }\n\n set(t, n, s) {\n return this[0] = t, this[1] = n, this[2] = s, this.check();\n }\n\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this[2] = t[2], this.check();\n }\n\n fromObject(t) {\n return et.debug && (U(t.x), U(t.y), U(t.z)), this[0] = t.x, this[1] = t.y, this[2] = t.z, this.check();\n }\n\n toObject(t) {\n return t.x = this[0], t.y = this[1], t.z = this[2], t;\n }\n\n get ELEMENTS() {\n return 3;\n }\n\n get z() {\n return this[2];\n }\n\n set z(t) {\n this[2] = U(t);\n }\n\n angle(t) {\n return Sh(this, t);\n }\n\n cross(t) {\n return Tn(this, this, t), this.check();\n }\n\n rotateX({\n radians: t,\n origin: n = fs\n }) {\n return wh(this, this, n, t), this.check();\n }\n\n rotateY({\n radians: t,\n origin: n = fs\n }) {\n return Rh(this, this, n, t), this.check();\n }\n\n rotateZ({\n radians: t,\n origin: n = fs\n }) {\n return Mh(this, this, n, t), this.check();\n }\n\n transform(t) {\n return this.transformAsPoint(t);\n }\n\n transformAsPoint(t) {\n return Er(this, this, t), this.check();\n }\n\n transformAsVector(t) {\n return Ca(this, this, t), this.check();\n }\n\n transformByMatrix3(t) {\n return _a(this, this, t), this.check();\n }\n\n transformByMatrix2(t) {\n return Th(this, this, t), this.check();\n }\n\n transformByQuaternion(t) {\n return wa(this, this, t), this.check();\n }\n\n}\n\nlet en;\n\nclass Tr extends Br {\n static get ZERO() {\n return en || (en = new Tr(0, 0, 0, 0), Object.freeze(en)), en;\n }\n\n constructor(t = 0, n = 0, s = 0, r = 0) {\n super(-0, -0, -0, -0), ee(t) && arguments.length === 1 ? this.copy(t) : (et.debug && (U(t), U(n), U(s), U(r)), this[0] = t, this[1] = n, this[2] = s, this[3] = r);\n }\n\n set(t, n, s, r) {\n return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this.check();\n }\n\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this.check();\n }\n\n fromObject(t) {\n return et.debug && (U(t.x), U(t.y), U(t.z), U(t.w)), this[0] = t.x, this[1] = t.y, this[2] = t.z, this[3] = t.w, this;\n }\n\n toObject(t) {\n return t.x = this[0], t.y = this[1], t.z = this[2], t.w = this[3], t;\n }\n\n get ELEMENTS() {\n return 4;\n }\n\n get z() {\n return this[2];\n }\n\n set z(t) {\n this[2] = U(t);\n }\n\n get w() {\n return this[3];\n }\n\n set w(t) {\n this[3] = U(t);\n }\n\n transform(t) {\n return Er(this, this, t), this.check();\n }\n\n transformByMatrix3(t) {\n return Ea(this, this, t), this.check();\n }\n\n transformByMatrix2(t) {\n return bh(this, this, t), this.check();\n }\n\n transformByQuaternion(t) {\n return wa(this, this, t), this.check();\n }\n\n applyMatrix4(t) {\n return t.transform(this, this), this;\n }\n\n}\n\nclass Ra extends yr {\n toString() {\n let t = \"[\";\n\n if (et.printRowMajor) {\n t += \"row-major:\";\n\n for (let n = 0; n < this.RANK; ++n) for (let s = 0; s < this.RANK; ++s) t += \" \".concat(this[s * this.RANK + n]);\n } else {\n t += \"column-major:\";\n\n for (let n = 0; n < this.ELEMENTS; ++n) t += \" \".concat(this[n]);\n }\n\n return t += \"]\", t;\n }\n\n getElementIndex(t, n) {\n return n * this.RANK + t;\n }\n\n getElement(t, n) {\n return this[n * this.RANK + t];\n }\n\n setElement(t, n, s) {\n return this[n * this.RANK + t] = U(s), this;\n }\n\n getColumn(t, n = new Array(this.RANK).fill(-0)) {\n const s = t * this.RANK;\n\n for (let r = 0; r < this.RANK; ++r) n[r] = this[s + r];\n\n return n;\n }\n\n setColumn(t, n) {\n const s = t * this.RANK;\n\n for (let r = 0; r < this.RANK; ++r) this[s + r] = n[r];\n\n return this;\n }\n\n}\n\nfunction xh() {\n const e = new It(9);\n return It != Float32Array && (e[1] = 0, e[2] = 0, e[3] = 0, e[5] = 0, e[6] = 0, e[7] = 0), e[0] = 1, e[4] = 1, e[8] = 1, e;\n}\n\nfunction vh(e, t) {\n if (e === t) {\n const n = t[1],\n s = t[2],\n r = t[5];\n e[1] = t[3], e[2] = t[6], e[3] = n, e[5] = t[7], e[6] = s, e[7] = r;\n } else e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8];\n\n return e;\n}\n\nfunction Oh(e, t) {\n const n = t[0],\n s = t[1],\n r = t[2],\n i = t[3],\n o = t[4],\n a = t[5],\n c = t[6],\n u = t[7],\n l = t[8],\n h = l * o - a * u,\n f = -l * i + a * c,\n d = u * i - o * c;\n let m = n * h + s * f + r * d;\n return m ? (m = 1 / m, e[0] = h * m, e[1] = (-l * s + r * u) * m, e[2] = (a * s - r * o) * m, e[3] = f * m, e[4] = (l * n - r * c) * m, e[5] = (-a * n + r * i) * m, e[6] = d * m, e[7] = (-u * n + s * c) * m, e[8] = (o * n - s * i) * m, e) : null;\n}\n\nfunction Fh(e) {\n const t = e[0],\n n = e[1],\n s = e[2],\n r = e[3],\n i = e[4],\n o = e[5],\n a = e[6],\n c = e[7],\n u = e[8];\n return t * (u * i - o * c) + n * (-u * r + o * a) + s * (c * r - i * a);\n}\n\nfunction di(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2],\n o = t[3],\n a = t[4],\n c = t[5],\n u = t[6],\n l = t[7],\n h = t[8],\n f = n[0],\n d = n[1],\n m = n[2],\n g = n[3],\n y = n[4],\n E = n[5],\n R = n[6],\n B = n[7],\n C = n[8];\n return e[0] = f * s + d * o + m * u, e[1] = f * r + d * a + m * l, e[2] = f * i + d * c + m * h, e[3] = g * s + y * o + E * u, e[4] = g * r + y * a + E * l, e[5] = g * i + y * c + E * h, e[6] = R * s + B * o + C * u, e[7] = R * r + B * a + C * l, e[8] = R * i + B * c + C * h, e;\n}\n\nfunction Dh(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2],\n o = t[3],\n a = t[4],\n c = t[5],\n u = t[6],\n l = t[7],\n h = t[8],\n f = n[0],\n d = n[1];\n return e[0] = s, e[1] = r, e[2] = i, e[3] = o, e[4] = a, e[5] = c, e[6] = f * s + d * o + u, e[7] = f * r + d * a + l, e[8] = f * i + d * c + h, e;\n}\n\nfunction Lh(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2],\n o = t[3],\n a = t[4],\n c = t[5],\n u = t[6],\n l = t[7],\n h = t[8],\n f = Math.sin(n),\n d = Math.cos(n);\n return e[0] = d * s + f * o, e[1] = d * r + f * a, e[2] = d * i + f * c, e[3] = d * o - f * s, e[4] = d * a - f * r, e[5] = d * c - f * i, e[6] = u, e[7] = l, e[8] = h, e;\n}\n\nfunction mi(e, t, n) {\n const s = n[0],\n r = n[1];\n return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = r * t[3], e[4] = r * t[4], e[5] = r * t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8], e;\n}\n\nfunction Ph(e, t) {\n const n = t[0],\n s = t[1],\n r = t[2],\n i = t[3],\n o = n + n,\n a = s + s,\n c = r + r,\n u = n * o,\n l = s * o,\n h = s * a,\n f = r * o,\n d = r * a,\n m = r * c,\n g = i * o,\n y = i * a,\n E = i * c;\n return e[0] = 1 - h - m, e[3] = l - E, e[6] = f + y, e[1] = l + E, e[4] = 1 - u - m, e[7] = d - g, e[2] = f - y, e[5] = d + g, e[8] = 1 - u - h, e;\n}\n\nvar ks;\n\n(function (e) {\n e[e.COL0ROW0 = 0] = \"COL0ROW0\", e[e.COL0ROW1 = 1] = \"COL0ROW1\", e[e.COL0ROW2 = 2] = \"COL0ROW2\", e[e.COL1ROW0 = 3] = \"COL1ROW0\", e[e.COL1ROW1 = 4] = \"COL1ROW1\", e[e.COL1ROW2 = 5] = \"COL1ROW2\", e[e.COL2ROW0 = 6] = \"COL2ROW0\", e[e.COL2ROW1 = 7] = \"COL2ROW1\", e[e.COL2ROW2 = 8] = \"COL2ROW2\";\n})(ks || (ks = {}));\n\nconst Gh = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);\n\nclass X extends Ra {\n static get IDENTITY() {\n return Uh();\n }\n\n static get ZERO() {\n return Nh();\n }\n\n get ELEMENTS() {\n return 9;\n }\n\n get RANK() {\n return 3;\n }\n\n get INDICES() {\n return ks;\n }\n\n constructor(t, ...n) {\n super(-0, -0, -0, -0, -0, -0, -0, -0, -0), arguments.length === 1 && Array.isArray(t) ? this.copy(t) : n.length > 0 ? this.copy([t, ...n]) : this.identity();\n }\n\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this[4] = t[4], this[5] = t[5], this[6] = t[6], this[7] = t[7], this[8] = t[8], this.check();\n }\n\n identity() {\n return this.copy(Gh);\n }\n\n fromObject(t) {\n return this.check();\n }\n\n fromQuaternion(t) {\n return Ph(this, t), this.check();\n }\n\n set(t, n, s, r, i, o, a, c, u) {\n return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this[4] = i, this[5] = o, this[6] = a, this[7] = c, this[8] = u, this.check();\n }\n\n setRowMajor(t, n, s, r, i, o, a, c, u) {\n return this[0] = t, this[1] = r, this[2] = a, this[3] = n, this[4] = i, this[5] = c, this[6] = s, this[7] = o, this[8] = u, this.check();\n }\n\n determinant() {\n return Fh(this);\n }\n\n transpose() {\n return vh(this, this), this.check();\n }\n\n invert() {\n return Oh(this, this), this.check();\n }\n\n multiplyLeft(t) {\n return di(this, t, this), this.check();\n }\n\n multiplyRight(t) {\n return di(this, this, t), this.check();\n }\n\n rotate(t) {\n return Lh(this, this, t), this.check();\n }\n\n scale(t) {\n return Array.isArray(t) ? mi(this, this, t) : mi(this, this, [t, t]), this.check();\n }\n\n translate(t) {\n return Dh(this, this, t), this.check();\n }\n\n transform(t, n) {\n let s;\n\n switch (t.length) {\n case 2:\n s = pa(n || [-0, -0], t, this);\n break;\n\n case 3:\n s = _a(n || [-0, -0, -0], t, this);\n break;\n\n case 4:\n s = Ea(n || [-0, -0, -0, -0], t, this);\n break;\n\n default:\n throw new Error(\"Illegal vector\");\n }\n\n return Oe(s, t.length), s;\n }\n\n transformVector(t, n) {\n return this.transform(t, n);\n }\n\n transformVector2(t, n) {\n return this.transform(t, n);\n }\n\n transformVector3(t, n) {\n return this.transform(t, n);\n }\n\n}\n\nlet nn,\n sn = null;\n\nfunction Nh() {\n return nn || (nn = new X([0, 0, 0, 0, 0, 0, 0, 0, 0]), Object.freeze(nn)), nn;\n}\n\nfunction Uh() {\n return sn || (sn = new X(), Object.freeze(sn)), sn;\n}\n\nfunction Hh(e) {\n return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;\n}\n\nfunction Jh(e, t) {\n if (e === t) {\n const n = t[1],\n s = t[2],\n r = t[3],\n i = t[6],\n o = t[7],\n a = t[11];\n e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = n, e[6] = t[9], e[7] = t[13], e[8] = s, e[9] = i, e[11] = t[14], e[12] = r, e[13] = o, e[14] = a;\n } else e[0] = t[0], e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = t[1], e[5] = t[5], e[6] = t[9], e[7] = t[13], e[8] = t[2], e[9] = t[6], e[10] = t[10], e[11] = t[14], e[12] = t[3], e[13] = t[7], e[14] = t[11], e[15] = t[15];\n\n return e;\n}\n\nfunction Vh(e, t) {\n const n = t[0],\n s = t[1],\n r = t[2],\n i = t[3],\n o = t[4],\n a = t[5],\n c = t[6],\n u = t[7],\n l = t[8],\n h = t[9],\n f = t[10],\n d = t[11],\n m = t[12],\n g = t[13],\n y = t[14],\n E = t[15],\n R = n * a - s * o,\n B = n * c - r * o,\n C = n * u - i * o,\n M = s * c - r * a,\n b = s * u - i * a,\n O = r * u - i * c,\n F = l * g - h * m,\n v = l * y - f * m,\n L = l * E - d * m,\n k = h * y - f * g,\n q = h * E - d * g,\n Y = f * E - d * y;\n let P = R * Y - B * q + C * k + M * L - b * v + O * F;\n return P ? (P = 1 / P, e[0] = (a * Y - c * q + u * k) * P, e[1] = (r * q - s * Y - i * k) * P, e[2] = (g * O - y * b + E * M) * P, e[3] = (f * b - h * O - d * M) * P, e[4] = (c * L - o * Y - u * v) * P, e[5] = (n * Y - r * L + i * v) * P, e[6] = (y * C - m * O - E * B) * P, e[7] = (l * O - f * C + d * B) * P, e[8] = (o * q - a * L + u * F) * P, e[9] = (s * L - n * q - i * F) * P, e[10] = (m * b - g * C + E * R) * P, e[11] = (h * C - l * b - d * R) * P, e[12] = (a * v - o * k - c * F) * P, e[13] = (n * k - s * v + r * F) * P, e[14] = (g * B - m * M - y * R) * P, e[15] = (l * M - h * B + f * R) * P, e) : null;\n}\n\nfunction jh(e) {\n const t = e[0],\n n = e[1],\n s = e[2],\n r = e[3],\n i = e[4],\n o = e[5],\n a = e[6],\n c = e[7],\n u = e[8],\n l = e[9],\n h = e[10],\n f = e[11],\n d = e[12],\n m = e[13],\n g = e[14],\n y = e[15],\n E = t * o - n * i,\n R = t * a - s * i,\n B = n * a - s * o,\n C = u * m - l * d,\n M = u * g - h * d,\n b = l * g - h * m,\n O = t * b - n * M + s * C,\n F = i * b - o * M + a * C,\n v = u * B - l * R + h * E,\n L = d * B - m * R + g * E;\n return c * O - r * F + y * v - f * L;\n}\n\nfunction gi(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2],\n o = t[3],\n a = t[4],\n c = t[5],\n u = t[6],\n l = t[7],\n h = t[8],\n f = t[9],\n d = t[10],\n m = t[11],\n g = t[12],\n y = t[13],\n E = t[14],\n R = t[15];\n let B = n[0],\n C = n[1],\n M = n[2],\n b = n[3];\n return e[0] = B * s + C * a + M * h + b * g, e[1] = B * r + C * c + M * f + b * y, e[2] = B * i + C * u + M * d + b * E, e[3] = B * o + C * l + M * m + b * R, B = n[4], C = n[5], M = n[6], b = n[7], e[4] = B * s + C * a + M * h + b * g, e[5] = B * r + C * c + M * f + b * y, e[6] = B * i + C * u + M * d + b * E, e[7] = B * o + C * l + M * m + b * R, B = n[8], C = n[9], M = n[10], b = n[11], e[8] = B * s + C * a + M * h + b * g, e[9] = B * r + C * c + M * f + b * y, e[10] = B * i + C * u + M * d + b * E, e[11] = B * o + C * l + M * m + b * R, B = n[12], C = n[13], M = n[14], b = n[15], e[12] = B * s + C * a + M * h + b * g, e[13] = B * r + C * c + M * f + b * y, e[14] = B * i + C * u + M * d + b * E, e[15] = B * o + C * l + M * m + b * R, e;\n}\n\nfunction kh(e, t, n) {\n const s = n[0],\n r = n[1],\n i = n[2];\n let o, a, c, u, l, h, f, d, m, g, y, E;\n return t === e ? (e[12] = t[0] * s + t[4] * r + t[8] * i + t[12], e[13] = t[1] * s + t[5] * r + t[9] * i + t[13], e[14] = t[2] * s + t[6] * r + t[10] * i + t[14], e[15] = t[3] * s + t[7] * r + t[11] * i + t[15]) : (o = t[0], a = t[1], c = t[2], u = t[3], l = t[4], h = t[5], f = t[6], d = t[7], m = t[8], g = t[9], y = t[10], E = t[11], e[0] = o, e[1] = a, e[2] = c, e[3] = u, e[4] = l, e[5] = h, e[6] = f, e[7] = d, e[8] = m, e[9] = g, e[10] = y, e[11] = E, e[12] = o * s + l * r + m * i + t[12], e[13] = a * s + h * r + g * i + t[13], e[14] = c * s + f * r + y * i + t[14], e[15] = u * s + d * r + E * i + t[15]), e;\n}\n\nfunction Kh(e, t, n) {\n const s = n[0],\n r = n[1],\n i = n[2];\n return e[0] = t[0] * s, e[1] = t[1] * s, e[2] = t[2] * s, e[3] = t[3] * s, e[4] = t[4] * r, e[5] = t[5] * r, e[6] = t[6] * r, e[7] = t[7] * r, e[8] = t[8] * i, e[9] = t[9] * i, e[10] = t[10] * i, e[11] = t[11] * i, e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e;\n}\n\nfunction zh(e, t, n, s) {\n let r = s[0],\n i = s[1],\n o = s[2],\n a = Math.sqrt(r * r + i * i + o * o),\n c,\n u,\n l,\n h,\n f,\n d,\n m,\n g,\n y,\n E,\n R,\n B,\n C,\n M,\n b,\n O,\n F,\n v,\n L,\n k,\n q,\n Y,\n P,\n ct;\n return a < Fe ? null : (a = 1 / a, r *= a, i *= a, o *= a, u = Math.sin(n), c = Math.cos(n), l = 1 - c, h = t[0], f = t[1], d = t[2], m = t[3], g = t[4], y = t[5], E = t[6], R = t[7], B = t[8], C = t[9], M = t[10], b = t[11], O = r * r * l + c, F = i * r * l + o * u, v = o * r * l - i * u, L = r * i * l - o * u, k = i * i * l + c, q = o * i * l + r * u, Y = r * o * l + i * u, P = i * o * l - r * u, ct = o * o * l + c, e[0] = h * O + g * F + B * v, e[1] = f * O + y * F + C * v, e[2] = d * O + E * F + M * v, e[3] = m * O + R * F + b * v, e[4] = h * L + g * k + B * q, e[5] = f * L + y * k + C * q, e[6] = d * L + E * k + M * q, e[7] = m * L + R * k + b * q, e[8] = h * Y + g * P + B * ct, e[9] = f * Y + y * P + C * ct, e[10] = d * Y + E * P + M * ct, e[11] = m * Y + R * P + b * ct, t !== e && (e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e);\n}\n\nfunction Wh(e, t, n) {\n const s = Math.sin(n),\n r = Math.cos(n),\n i = t[4],\n o = t[5],\n a = t[6],\n c = t[7],\n u = t[8],\n l = t[9],\n h = t[10],\n f = t[11];\n return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = i * r + u * s, e[5] = o * r + l * s, e[6] = a * r + h * s, e[7] = c * r + f * s, e[8] = u * r - i * s, e[9] = l * r - o * s, e[10] = h * r - a * s, e[11] = f * r - c * s, e;\n}\n\nfunction Xh(e, t, n) {\n const s = Math.sin(n),\n r = Math.cos(n),\n i = t[0],\n o = t[1],\n a = t[2],\n c = t[3],\n u = t[8],\n l = t[9],\n h = t[10],\n f = t[11];\n return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = i * r - u * s, e[1] = o * r - l * s, e[2] = a * r - h * s, e[3] = c * r - f * s, e[8] = i * s + u * r, e[9] = o * s + l * r, e[10] = a * s + h * r, e[11] = c * s + f * r, e;\n}\n\nfunction Qh(e, t, n) {\n const s = Math.sin(n),\n r = Math.cos(n),\n i = t[0],\n o = t[1],\n a = t[2],\n c = t[3],\n u = t[4],\n l = t[5],\n h = t[6],\n f = t[7];\n return t !== e && (e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = i * r + u * s, e[1] = o * r + l * s, e[2] = a * r + h * s, e[3] = c * r + f * s, e[4] = u * r - i * s, e[5] = l * r - o * s, e[6] = h * r - a * s, e[7] = f * r - c * s, e;\n}\n\nfunction qh(e, t) {\n const n = t[0],\n s = t[1],\n r = t[2],\n i = t[4],\n o = t[5],\n a = t[6],\n c = t[8],\n u = t[9],\n l = t[10];\n return e[0] = Math.sqrt(n * n + s * s + r * r), e[1] = Math.sqrt(i * i + o * o + a * a), e[2] = Math.sqrt(c * c + u * u + l * l), e;\n}\n\nfunction Yh(e, t) {\n const n = t[0],\n s = t[1],\n r = t[2],\n i = t[3],\n o = n + n,\n a = s + s,\n c = r + r,\n u = n * o,\n l = s * o,\n h = s * a,\n f = r * o,\n d = r * a,\n m = r * c,\n g = i * o,\n y = i * a,\n E = i * c;\n return e[0] = 1 - h - m, e[1] = l + E, e[2] = f - y, e[3] = 0, e[4] = l - E, e[5] = 1 - u - m, e[6] = d + g, e[7] = 0, e[8] = f + y, e[9] = d - g, e[10] = 1 - u - h, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;\n}\n\nfunction $h(e, t, n, s, r, i, o) {\n const a = 1 / (n - t),\n c = 1 / (r - s),\n u = 1 / (i - o);\n return e[0] = i * 2 * a, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = i * 2 * c, e[6] = 0, e[7] = 0, e[8] = (n + t) * a, e[9] = (r + s) * c, e[10] = (o + i) * u, e[11] = -1, e[12] = 0, e[13] = 0, e[14] = o * i * 2 * u, e[15] = 0, e;\n}\n\nfunction Zh(e, t, n, s, r) {\n const i = 1 / Math.tan(t / 2);\n\n if (e[0] = i / n, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = i, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, r != null && r !== 1 / 0) {\n const o = 1 / (s - r);\n e[10] = (r + s) * o, e[14] = 2 * r * s * o;\n } else e[10] = -1, e[14] = -2 * s;\n\n return e;\n}\n\nconst tf = Zh;\n\nfunction ef(e, t, n, s, r, i, o) {\n const a = 1 / (t - n),\n c = 1 / (s - r),\n u = 1 / (i - o);\n return e[0] = -2 * a, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = -2 * c, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 2 * u, e[11] = 0, e[12] = (t + n) * a, e[13] = (r + s) * c, e[14] = (o + i) * u, e[15] = 1, e;\n}\n\nconst nf = ef;\n\nfunction sf(e, t, n, s) {\n let r, i, o, a, c, u, l, h, f, d;\n const m = t[0],\n g = t[1],\n y = t[2],\n E = s[0],\n R = s[1],\n B = s[2],\n C = n[0],\n M = n[1],\n b = n[2];\n return Math.abs(m - C) < Fe && Math.abs(g - M) < Fe && Math.abs(y - b) < Fe ? Hh(e) : (h = m - C, f = g - M, d = y - b, r = 1 / Math.sqrt(h * h + f * f + d * d), h *= r, f *= r, d *= r, i = R * d - B * f, o = B * h - E * d, a = E * f - R * h, r = Math.sqrt(i * i + o * o + a * a), r ? (r = 1 / r, i *= r, o *= r, a *= r) : (i = 0, o = 0, a = 0), c = f * a - d * o, u = d * i - h * a, l = h * o - f * i, r = Math.sqrt(c * c + u * u + l * l), r ? (r = 1 / r, c *= r, u *= r, l *= r) : (c = 0, u = 0, l = 0), e[0] = i, e[1] = c, e[2] = h, e[3] = 0, e[4] = o, e[5] = u, e[6] = f, e[7] = 0, e[8] = a, e[9] = l, e[10] = d, e[11] = 0, e[12] = -(i * m + o * g + a * y), e[13] = -(c * m + u * g + l * y), e[14] = -(h * m + f * g + d * y), e[15] = 1, e);\n}\n\nfunction rf() {\n const e = new It(4);\n return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0), e;\n}\n\nfunction of(e, t, n) {\n return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e;\n}\n\nfunction af(e, t, n) {\n return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e;\n}\n\nfunction cf(e) {\n const t = e[0],\n n = e[1],\n s = e[2],\n r = e[3];\n return Math.sqrt(t * t + n * n + s * s + r * r);\n}\n\nfunction uf(e) {\n const t = e[0],\n n = e[1],\n s = e[2],\n r = e[3];\n return t * t + n * n + s * s + r * r;\n}\n\nfunction lf(e, t) {\n const n = t[0],\n s = t[1],\n r = t[2],\n i = t[3];\n let o = n * n + s * s + r * r + i * i;\n return o > 0 && (o = 1 / Math.sqrt(o)), e[0] = n * o, e[1] = s * o, e[2] = r * o, e[3] = i * o, e;\n}\n\nfunction hf(e, t) {\n return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3];\n}\n\nfunction ff(e, t, n, s) {\n const r = t[0],\n i = t[1],\n o = t[2],\n a = t[3];\n return e[0] = r + s * (n[0] - r), e[1] = i + s * (n[1] - i), e[2] = o + s * (n[2] - o), e[3] = a + s * (n[3] - a), e;\n}\n\nfunction df(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2],\n o = t[3];\n return e[0] = n[0] * s + n[4] * r + n[8] * i + n[12] * o, e[1] = n[1] * s + n[5] * r + n[9] * i + n[13] * o, e[2] = n[2] * s + n[6] * r + n[10] * i + n[14] * o, e[3] = n[3] * s + n[7] * r + n[11] * i + n[15] * o, e;\n}\n\nfunction mf(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2],\n o = n[0],\n a = n[1],\n c = n[2],\n u = n[3],\n l = u * s + a * i - c * r,\n h = u * r + c * s - o * i,\n f = u * i + o * r - a * s,\n d = -o * s - a * r - c * i;\n return e[0] = l * u + d * -o + h * -c - f * -a, e[1] = h * u + d * -a + f * -o - l * -c, e[2] = f * u + d * -c + l * -a - h * -o, e[3] = t[3], e;\n}\n\n(function () {\n const e = rf();\n return function (t, n, s, r, i, o) {\n let a, c;\n\n for (n || (n = 4), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) e[0] = t[a], e[1] = t[a + 1], e[2] = t[a + 2], e[3] = t[a + 3], i(e, e, o), t[a] = e[0], t[a + 1] = e[1], t[a + 2] = e[2], t[a + 3] = e[3];\n\n return t;\n };\n})();\n\nvar Ks;\n\n(function (e) {\n e[e.COL0ROW0 = 0] = \"COL0ROW0\", e[e.COL0ROW1 = 1] = \"COL0ROW1\", e[e.COL0ROW2 = 2] = \"COL0ROW2\", e[e.COL0ROW3 = 3] = \"COL0ROW3\", e[e.COL1ROW0 = 4] = \"COL1ROW0\", e[e.COL1ROW1 = 5] = \"COL1ROW1\", e[e.COL1ROW2 = 6] = \"COL1ROW2\", e[e.COL1ROW3 = 7] = \"COL1ROW3\", e[e.COL2ROW0 = 8] = \"COL2ROW0\", e[e.COL2ROW1 = 9] = \"COL2ROW1\", e[e.COL2ROW2 = 10] = \"COL2ROW2\", e[e.COL2ROW3 = 11] = \"COL2ROW3\", e[e.COL3ROW0 = 12] = \"COL3ROW0\", e[e.COL3ROW1 = 13] = \"COL3ROW1\", e[e.COL3ROW2 = 14] = \"COL3ROW2\", e[e.COL3ROW3 = 15] = \"COL3ROW3\";\n})(Ks || (Ks = {}));\n\nconst gf = 45 * Math.PI / 180,\n Af = 1,\n ds = 0.1,\n ms = 500,\n pf = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);\n\nclass V extends Ra {\n static get IDENTITY() {\n return Bf();\n }\n\n static get ZERO() {\n return yf();\n }\n\n get ELEMENTS() {\n return 16;\n }\n\n get RANK() {\n return 4;\n }\n\n get INDICES() {\n return Ks;\n }\n\n constructor(t) {\n super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0), arguments.length === 1 && Array.isArray(t) ? this.copy(t) : this.identity();\n }\n\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this[4] = t[4], this[5] = t[5], this[6] = t[6], this[7] = t[7], this[8] = t[8], this[9] = t[9], this[10] = t[10], this[11] = t[11], this[12] = t[12], this[13] = t[13], this[14] = t[14], this[15] = t[15], this.check();\n }\n\n set(t, n, s, r, i, o, a, c, u, l, h, f, d, m, g, y) {\n return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this[4] = i, this[5] = o, this[6] = a, this[7] = c, this[8] = u, this[9] = l, this[10] = h, this[11] = f, this[12] = d, this[13] = m, this[14] = g, this[15] = y, this.check();\n }\n\n setRowMajor(t, n, s, r, i, o, a, c, u, l, h, f, d, m, g, y) {\n return this[0] = t, this[1] = i, this[2] = u, this[3] = d, this[4] = n, this[5] = o, this[6] = l, this[7] = m, this[8] = s, this[9] = a, this[10] = h, this[11] = g, this[12] = r, this[13] = c, this[14] = f, this[15] = y, this.check();\n }\n\n toRowMajor(t) {\n return t[0] = this[0], t[1] = this[4], t[2] = this[8], t[3] = this[12], t[4] = this[1], t[5] = this[5], t[6] = this[9], t[7] = this[13], t[8] = this[2], t[9] = this[6], t[10] = this[10], t[11] = this[14], t[12] = this[3], t[13] = this[7], t[14] = this[11], t[15] = this[15], t;\n }\n\n identity() {\n return this.copy(pf);\n }\n\n fromObject(t) {\n return this.check();\n }\n\n fromQuaternion(t) {\n return Yh(this, t), this.check();\n }\n\n frustum(t) {\n const {\n left: n,\n right: s,\n bottom: r,\n top: i,\n near: o = ds,\n far: a = ms\n } = t;\n return a === 1 / 0 ? Cf(this, n, s, r, i, o) : $h(this, n, s, r, i, o, a), this.check();\n }\n\n lookAt(t) {\n const {\n eye: n,\n center: s = [0, 0, 0],\n up: r = [0, 1, 0]\n } = t;\n return sf(this, n, s, r), this.check();\n }\n\n ortho(t) {\n const {\n left: n,\n right: s,\n bottom: r,\n top: i,\n near: o = ds,\n far: a = ms\n } = t;\n return nf(this, n, s, r, i, o, a), this.check();\n }\n\n orthographic(t) {\n const {\n fovy: n = gf,\n aspect: s = Af,\n focalDistance: r = 1,\n near: i = ds,\n far: o = ms\n } = t;\n Ai(n);\n const a = n / 2,\n c = r * Math.tan(a),\n u = c * s;\n return this.ortho({\n left: -u,\n right: u,\n bottom: -c,\n top: c,\n near: i,\n far: o\n });\n }\n\n perspective(t) {\n const {\n fovy: n = 45 * Math.PI / 180,\n aspect: s = 1,\n near: r = 0.1,\n far: i = 500\n } = t;\n return Ai(n), tf(this, n, s, r, i), this.check();\n }\n\n determinant() {\n return jh(this);\n }\n\n getScale(t = [-0, -0, -0]) {\n return t[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]), t[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]), t[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]), t;\n }\n\n getTranslation(t = [-0, -0, -0]) {\n return t[0] = this[12], t[1] = this[13], t[2] = this[14], t;\n }\n\n getRotation(t, n) {\n t = t || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0], n = n || [-0, -0, -0];\n const s = this.getScale(n),\n r = 1 / s[0],\n i = 1 / s[1],\n o = 1 / s[2];\n return t[0] = this[0] * r, t[1] = this[1] * i, t[2] = this[2] * o, t[3] = 0, t[4] = this[4] * r, t[5] = this[5] * i, t[6] = this[6] * o, t[7] = 0, t[8] = this[8] * r, t[9] = this[9] * i, t[10] = this[10] * o, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;\n }\n\n getRotationMatrix3(t, n) {\n t = t || [-0, -0, -0, -0, -0, -0, -0, -0, -0], n = n || [-0, -0, -0];\n const s = this.getScale(n),\n r = 1 / s[0],\n i = 1 / s[1],\n o = 1 / s[2];\n return t[0] = this[0] * r, t[1] = this[1] * i, t[2] = this[2] * o, t[3] = this[4] * r, t[4] = this[5] * i, t[5] = this[6] * o, t[6] = this[8] * r, t[7] = this[9] * i, t[8] = this[10] * o, t;\n }\n\n transpose() {\n return Jh(this, this), this.check();\n }\n\n invert() {\n return Vh(this, this), this.check();\n }\n\n multiplyLeft(t) {\n return gi(this, t, this), this.check();\n }\n\n multiplyRight(t) {\n return gi(this, this, t), this.check();\n }\n\n rotateX(t) {\n return Wh(this, this, t), this.check();\n }\n\n rotateY(t) {\n return Xh(this, this, t), this.check();\n }\n\n rotateZ(t) {\n return Qh(this, this, t), this.check();\n }\n\n rotateXYZ(t) {\n return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2]);\n }\n\n rotateAxis(t, n) {\n return zh(this, this, t, n), this.check();\n }\n\n scale(t) {\n return Kh(this, this, Array.isArray(t) ? t : [t, t, t]), this.check();\n }\n\n translate(t) {\n return kh(this, this, t), this.check();\n }\n\n transform(t, n) {\n return t.length === 4 ? (n = df(n || [-0, -0, -0, -0], t, this), Oe(n, 4), n) : this.transformAsPoint(t, n);\n }\n\n transformAsPoint(t, n) {\n const {\n length: s\n } = t;\n let r;\n\n switch (s) {\n case 2:\n r = ya(n || [-0, -0], t, this);\n break;\n\n case 3:\n r = Er(n || [-0, -0, -0], t, this);\n break;\n\n default:\n throw new Error(\"Illegal vector\");\n }\n\n return Oe(r, t.length), r;\n }\n\n transformAsVector(t, n) {\n let s;\n\n switch (t.length) {\n case 2:\n s = Ba(n || [-0, -0], t, this);\n break;\n\n case 3:\n s = Ca(n || [-0, -0, -0], t, this);\n break;\n\n default:\n throw new Error(\"Illegal vector\");\n }\n\n return Oe(s, t.length), s;\n }\n\n transformPoint(t, n) {\n return this.transformAsPoint(t, n);\n }\n\n transformVector(t, n) {\n return this.transformAsPoint(t, n);\n }\n\n transformDirection(t, n) {\n return this.transformAsVector(t, n);\n }\n\n makeRotationX(t) {\n return this.identity().rotateX(t);\n }\n\n makeTranslation(t, n, s) {\n return this.identity().translate([t, n, s]);\n }\n\n}\n\nlet rn, on;\n\nfunction yf() {\n return rn || (rn = new V([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), Object.freeze(rn)), rn;\n}\n\nfunction Bf() {\n return on || (on = new V(), Object.freeze(on)), on;\n}\n\nfunction Ai(e) {\n if (e > Math.PI * 2) throw Error(\"expected radians\");\n}\n\nfunction Cf(e, t, n, s, r, i) {\n const o = 2 * i / (n - t),\n a = 2 * i / (r - s),\n c = (n + t) / (n - t),\n u = (r + s) / (r - s),\n l = -1,\n h = -1,\n f = -2 * i;\n return e[0] = o, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a, e[6] = 0, e[7] = 0, e[8] = c, e[9] = u, e[10] = l, e[11] = h, e[12] = 0, e[13] = 0, e[14] = f, e[15] = 0, e;\n}\n\nfunction pi() {\n const e = new It(4);\n return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e[3] = 1, e;\n}\n\nfunction Ef(e) {\n return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e;\n}\n\nfunction Ma(e, t, n) {\n n = n * 0.5;\n const s = Math.sin(n);\n return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = Math.cos(n), e;\n}\n\nfunction yi(e, t, n) {\n const s = t[0],\n r = t[1],\n i = t[2],\n o = t[3],\n a = n[0],\n c = n[1],\n u = n[2],\n l = n[3];\n return e[0] = s * l + o * a + r * u - i * c, e[1] = r * l + o * c + i * a - s * u, e[2] = i * l + o * u + s * c - r * a, e[3] = o * l - s * a - r * c - i * u, e;\n}\n\nfunction Tf(e, t, n) {\n n *= 0.5;\n const s = t[0],\n r = t[1],\n i = t[2],\n o = t[3],\n a = Math.sin(n),\n c = Math.cos(n);\n return e[0] = s * c + o * a, e[1] = r * c + i * a, e[2] = i * c - r * a, e[3] = o * c - s * a, e;\n}\n\nfunction bf(e, t, n) {\n n *= 0.5;\n const s = t[0],\n r = t[1],\n i = t[2],\n o = t[3],\n a = Math.sin(n),\n c = Math.cos(n);\n return e[0] = s * c - i * a, e[1] = r * c + o * a, e[2] = i * c + s * a, e[3] = o * c - r * a, e;\n}\n\nfunction _f(e, t, n) {\n n *= 0.5;\n const s = t[0],\n r = t[1],\n i = t[2],\n o = t[3],\n a = Math.sin(n),\n c = Math.cos(n);\n return e[0] = s * c + r * a, e[1] = r * c - s * a, e[2] = i * c + o * a, e[3] = o * c - i * a, e;\n}\n\nfunction wf(e, t) {\n const n = t[0],\n s = t[1],\n r = t[2];\n return e[0] = n, e[1] = s, e[2] = r, e[3] = Math.sqrt(Math.abs(1 - n * n - s * s - r * r)), e;\n}\n\nfunction bn(e, t, n, s) {\n const r = t[0],\n i = t[1],\n o = t[2],\n a = t[3];\n let c = n[0],\n u = n[1],\n l = n[2],\n h = n[3],\n f,\n d,\n m,\n g,\n y;\n return f = r * c + i * u + o * l + a * h, f < 0 && (f = -f, c = -c, u = -u, l = -l, h = -h), 1 - f > Fe ? (d = Math.acos(f), y = Math.sin(d), m = Math.sin((1 - s) * d) / y, g = Math.sin(s * d) / y) : (m = 1 - s, g = s), e[0] = m * r + g * c, e[1] = m * i + g * u, e[2] = m * o + g * l, e[3] = m * a + g * h, e;\n}\n\nfunction Rf(e, t) {\n const n = t[0],\n s = t[1],\n r = t[2],\n i = t[3],\n o = n * n + s * s + r * r + i * i,\n a = o ? 1 / o : 0;\n return e[0] = -n * a, e[1] = -s * a, e[2] = -r * a, e[3] = i * a, e;\n}\n\nfunction Mf(e, t) {\n return e[0] = -t[0], e[1] = -t[1], e[2] = -t[2], e[3] = t[3], e;\n}\n\nfunction Sa(e, t) {\n const n = t[0] + t[4] + t[8];\n let s;\n if (n > 0) s = Math.sqrt(n + 1), e[3] = 0.5 * s, s = 0.5 / s, e[0] = (t[5] - t[7]) * s, e[1] = (t[6] - t[2]) * s, e[2] = (t[1] - t[3]) * s;else {\n let r = 0;\n t[4] > t[0] && (r = 1), t[8] > t[r * 3 + r] && (r = 2);\n const i = (r + 1) % 3,\n o = (r + 2) % 3;\n s = Math.sqrt(t[r * 3 + r] - t[i * 3 + i] - t[o * 3 + o] + 1), e[r] = 0.5 * s, s = 0.5 / s, e[3] = (t[i * 3 + o] - t[o * 3 + i]) * s, e[i] = (t[i * 3 + r] + t[r * 3 + i]) * s, e[o] = (t[o * 3 + r] + t[r * 3 + o]) * s;\n }\n return e;\n}\n\nconst Sf = of,\n If = af,\n xf = hf,\n vf = ff,\n Of = cf,\n Ff = uf,\n Ia = lf,\n Df = function () {\n const e = Ta(),\n t = fi(1, 0, 0),\n n = fi(0, 1, 0);\n return function (s, r, i) {\n const o = Cr(r, i);\n return o < -0.999999 ? (Tn(e, t, r), Ih(e) < 1e-6 && Tn(e, n, r), _h(e, e), Ma(s, e, Math.PI), s) : o > 0.999999 ? (s[0] = 0, s[1] = 0, s[2] = 0, s[3] = 1, s) : (Tn(e, r, i), s[0] = e[0], s[1] = e[1], s[2] = e[2], s[3] = 1 + o, Ia(s, s));\n };\n}();\n\n(function () {\n const e = pi(),\n t = pi();\n return function (n, s, r, i, o, a) {\n return bn(e, s, o, a), bn(t, r, i, a), bn(n, e, t, 2 * a * (1 - a)), n;\n };\n})();\n\n(function () {\n const e = xh();\n return function (t, n, s, r) {\n return e[0] = s[0], e[3] = s[1], e[6] = s[2], e[1] = r[0], e[4] = r[1], e[7] = r[2], e[2] = -n[0], e[5] = -n[1], e[8] = -n[2], Ia(t, Sa(t, e));\n };\n})();\n\nconst Lf = [0, 0, 0, 1];\n\nclass On extends yr {\n constructor(t = 0, n = 0, s = 0, r = 1) {\n super(-0, -0, -0, -0), Array.isArray(t) && arguments.length === 1 ? this.copy(t) : this.set(t, n, s, r);\n }\n\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this.check();\n }\n\n set(t, n, s, r) {\n return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this.check();\n }\n\n fromObject(t) {\n return this[0] = t.x, this[1] = t.y, this[2] = t.z, this[3] = t.w, this.check();\n }\n\n fromMatrix3(t) {\n return Sa(this, t), this.check();\n }\n\n fromAxisRotation(t, n) {\n return Ma(this, t, n), this.check();\n }\n\n identity() {\n return Ef(this), this.check();\n }\n\n setAxisAngle(t, n) {\n return this.fromAxisRotation(t, n);\n }\n\n get ELEMENTS() {\n return 4;\n }\n\n get x() {\n return this[0];\n }\n\n set x(t) {\n this[0] = U(t);\n }\n\n get y() {\n return this[1];\n }\n\n set y(t) {\n this[1] = U(t);\n }\n\n get z() {\n return this[2];\n }\n\n set z(t) {\n this[2] = U(t);\n }\n\n get w() {\n return this[3];\n }\n\n set w(t) {\n this[3] = U(t);\n }\n\n len() {\n return Of(this);\n }\n\n lengthSquared() {\n return Ff(this);\n }\n\n dot(t) {\n return xf(this, t);\n }\n\n rotationTo(t, n) {\n return Df(this, t, n), this.check();\n }\n\n add(t) {\n return Sf(this, this, t), this.check();\n }\n\n calculateW() {\n return wf(this, this), this.check();\n }\n\n conjugate() {\n return Mf(this, this), this.check();\n }\n\n invert() {\n return Rf(this, this), this.check();\n }\n\n lerp(t, n, s) {\n return s === void 0 ? this.lerp(this, t, n) : (vf(this, t, n, s), this.check());\n }\n\n multiplyRight(t) {\n return yi(this, this, t), this.check();\n }\n\n multiplyLeft(t) {\n return yi(this, t, this), this.check();\n }\n\n normalize() {\n const t = this.len(),\n n = t > 0 ? 1 / t : 0;\n return this[0] = this[0] * n, this[1] = this[1] * n, this[2] = this[2] * n, this[3] = this[3] * n, t === 0 && (this[3] = 1), this.check();\n }\n\n rotateX(t) {\n return Tf(this, this, t), this.check();\n }\n\n rotateY(t) {\n return bf(this, this, t), this.check();\n }\n\n rotateZ(t) {\n return _f(this, this, t), this.check();\n }\n\n scale(t) {\n return If(this, this, t), this.check();\n }\n\n slerp(t, n, s) {\n let r, i, o;\n\n switch (arguments.length) {\n case 1:\n ({\n start: r = Lf,\n target: i,\n ratio: o\n } = t);\n break;\n\n case 2:\n r = this, i = t, o = n;\n break;\n\n default:\n r = t, i = n, o = s;\n }\n\n return bn(this, r, i, o), this.check();\n }\n\n transformVector4(t, n = new Tr()) {\n return mf(n, t, this), Oe(n, 4);\n }\n\n lengthSq() {\n return this.lengthSquared();\n }\n\n setFromAxisAngle(t, n) {\n return this.setAxisAngle(t, n);\n }\n\n premultiply(t) {\n return this.multiplyLeft(t);\n }\n\n multiply(t) {\n return this.multiplyRight(t);\n }\n\n}\n\nfunction Ne(e) {\n \"@babel/helpers - typeof\";\n\n return Ne = typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" ? function (t) {\n return typeof t;\n } : function (t) {\n return t && typeof Symbol == \"function\" && t.constructor === Symbol && t !== Symbol.prototype ? \"symbol\" : typeof t;\n }, Ne(e);\n}\n\nfunction Pf(e, t) {\n if (Ne(e) != \"object\" || !e) return e;\n var n = e[Symbol.toPrimitive];\n\n if (n !== void 0) {\n var s = n.call(e, t || \"default\");\n if (Ne(s) != \"object\") return s;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n\n return (t === \"string\" ? String : Number)(e);\n}\n\nfunction Gf(e) {\n var t = Pf(e, \"string\");\n return Ne(t) == \"symbol\" ? t : String(t);\n}\n\nfunction x(e, t, n) {\n return t = Gf(t), t in e ? Object.defineProperty(e, t, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[t] = n, e;\n}\n\nconst Nf = 0.1,\n Uf = 1e-12,\n xa = 1e-15,\n Hf = 1e-20,\n Jf = 6378137,\n Vf = 6378137,\n jf = 6356752314245179e-9;\n\nfunction Xn(e) {\n return e;\n}\n\nnew A();\n\nfunction kf(e, t = [], n = Xn) {\n return \"longitude\" in e ? (t[0] = n(e.longitude), t[1] = n(e.latitude), t[2] = e.height) : \"x\" in e ? (t[0] = n(e.x), t[1] = n(e.y), t[2] = e.z) : (t[0] = n(e[0]), t[1] = n(e[1]), t[2] = e[2]), t;\n}\n\nfunction Kf(e, t = []) {\n return kf(e, t, et._cartographicRadians ? Xn : hh);\n}\n\nfunction zf(e, t, n = Xn) {\n return \"longitude\" in t ? (t.longitude = n(e[0]), t.latitude = n(e[1]), t.height = e[2]) : \"x\" in t ? (t.x = n(e[0]), t.y = n(e[1]), t.z = e[2]) : (t[0] = n(e[0]), t[1] = n(e[1]), t[2] = e[2]), t;\n}\n\nfunction Wf(e, t) {\n return zf(e, t, et._cartographicRadians ? Xn : fh);\n}\n\nconst Bi = 1e-14,\n Xf = new A(),\n Ci = {\n up: {\n south: \"east\",\n north: \"west\",\n west: \"south\",\n east: \"north\"\n },\n down: {\n south: \"west\",\n north: \"east\",\n west: \"north\",\n east: \"south\"\n },\n south: {\n up: \"west\",\n down: \"east\",\n west: \"down\",\n east: \"up\"\n },\n north: {\n up: \"east\",\n down: \"west\",\n west: \"up\",\n east: \"down\"\n },\n west: {\n up: \"north\",\n down: \"south\",\n north: \"down\",\n south: \"up\"\n },\n east: {\n up: \"south\",\n down: \"north\",\n north: \"up\",\n south: \"down\"\n }\n},\n gs = {\n north: [-1, 0, 0],\n east: [0, 1, 0],\n up: [0, 0, 1],\n south: [1, 0, 0],\n west: [0, -1, 0],\n down: [0, 0, -1]\n},\n Te = {\n east: new A(),\n north: new A(),\n up: new A(),\n west: new A(),\n south: new A(),\n down: new A()\n},\n Qf = new A(),\n qf = new A(),\n Yf = new A();\n\nfunction Ei(e, t, n, s, r, i) {\n const o = Ci[t] && Ci[t][n];\n j(o && (!s || s === o));\n let a, c, u;\n const l = Xf.copy(r);\n\n if (Kt(l.x, 0, Bi) && Kt(l.y, 0, Bi)) {\n const f = Math.sign(l.z);\n a = Qf.fromArray(gs[t]), t !== \"east\" && t !== \"west\" && a.scale(f), c = qf.fromArray(gs[n]), n !== \"east\" && n !== \"west\" && c.scale(f), u = Yf.fromArray(gs[s]), s !== \"east\" && s !== \"west\" && u.scale(f);\n } else {\n const {\n up: f,\n east: d,\n north: m\n } = Te;\n d.set(-l.y, l.x, 0).normalize(), e.geodeticSurfaceNormal(l, f), m.copy(f).cross(d);\n const {\n down: g,\n west: y,\n south: E\n } = Te;\n g.copy(f).scale(-1), y.copy(d).scale(-1), E.copy(m).scale(-1), a = Te[t], c = Te[n], u = Te[s];\n }\n\n return i[0] = a.x, i[1] = a.y, i[2] = a.z, i[3] = 0, i[4] = c.x, i[5] = c.y, i[6] = c.z, i[7] = 0, i[8] = u.x, i[9] = u.y, i[10] = u.z, i[11] = 0, i[12] = l.x, i[13] = l.y, i[14] = l.z, i[15] = 1, i;\n}\n\nconst ue = new A(),\n $f = new A(),\n Zf = new A();\n\nfunction td(e, t, n = []) {\n const {\n oneOverRadii: s,\n oneOverRadiiSquared: r,\n centerToleranceSquared: i\n } = t;\n ue.from(e);\n const o = ue.x,\n a = ue.y,\n c = ue.z,\n u = s.x,\n l = s.y,\n h = s.z,\n f = o * o * u * u,\n d = a * a * l * l,\n m = c * c * h * h,\n g = f + d + m,\n y = Math.sqrt(1 / g);\n if (!Number.isFinite(y)) return;\n const E = $f;\n if (E.copy(e).scale(y), g < i) return E.to(n);\n const R = r.x,\n B = r.y,\n C = r.z,\n M = Zf;\n M.set(E.x * R * 2, E.y * B * 2, E.z * C * 2);\n let b = (1 - y) * ue.len() / (0.5 * M.len()),\n O = 0,\n F,\n v,\n L,\n k;\n\n do {\n b -= O, F = 1 / (1 + b * R), v = 1 / (1 + b * B), L = 1 / (1 + b * C);\n const q = F * F,\n Y = v * v,\n P = L * L,\n ct = q * F,\n Wt = Y * v,\n oe = P * L;\n k = f * q + d * Y + m * P - 1;\n const vt = -2 * (f * ct * R + d * Wt * B + m * oe * C);\n O = k / vt;\n } while (Math.abs(k) > Uf);\n\n return ue.scale([F, v, L]).to(n);\n}\n\nconst an = new A(),\n Ti = new A(),\n ed = new A(),\n wt = new A(),\n nd = new A(),\n cn = new A();\n\nclass J {\n constructor(t = 0, n = 0, s = 0) {\n x(this, \"radii\", void 0), x(this, \"radiiSquared\", void 0), x(this, \"radiiToTheFourth\", void 0), x(this, \"oneOverRadii\", void 0), x(this, \"oneOverRadiiSquared\", void 0), x(this, \"minimumRadius\", void 0), x(this, \"maximumRadius\", void 0), x(this, \"centerToleranceSquared\", Nf), x(this, \"squaredXOverSquaredZ\", void 0), j(t >= 0), j(n >= 0), j(s >= 0), this.radii = new A(t, n, s), this.radiiSquared = new A(t * t, n * n, s * s), this.radiiToTheFourth = new A(t * t * t * t, n * n * n * n, s * s * s * s), this.oneOverRadii = new A(t === 0 ? 0 : 1 / t, n === 0 ? 0 : 1 / n, s === 0 ? 0 : 1 / s), this.oneOverRadiiSquared = new A(t === 0 ? 0 : 1 / (t * t), n === 0 ? 0 : 1 / (n * n), s === 0 ? 0 : 1 / (s * s)), this.minimumRadius = Math.min(t, n, s), this.maximumRadius = Math.max(t, n, s), this.radiiSquared.z !== 0 && (this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z), Object.freeze(this);\n }\n\n equals(t) {\n return this === t || !!(t && this.radii.equals(t.radii));\n }\n\n toString() {\n return this.radii.toString();\n }\n\n cartographicToCartesian(t, n = [0, 0, 0]) {\n const s = Ti,\n r = ed,\n [,, i] = t;\n this.geodeticSurfaceNormalCartographic(t, s), r.copy(this.radiiSquared).scale(s);\n const o = Math.sqrt(s.dot(r));\n return r.scale(1 / o), s.scale(i), r.add(s), r.to(n);\n }\n\n cartesianToCartographic(t, n = [0, 0, 0]) {\n cn.from(t);\n const s = this.scaleToGeodeticSurface(cn, wt);\n if (!s) return;\n const r = this.geodeticSurfaceNormal(s, Ti),\n i = nd;\n i.copy(cn).subtract(s);\n const o = Math.atan2(r.y, r.x),\n a = Math.asin(r.z),\n c = Math.sign(Cr(i, cn)) * ba(i);\n return Wf([o, a, c], n);\n }\n\n eastNorthUpToFixedFrame(t, n = new V()) {\n return Ei(this, \"east\", \"north\", \"up\", t, n);\n }\n\n localFrameToFixedFrame(t, n, s, r, i = new V()) {\n return Ei(this, t, n, s, r, i);\n }\n\n geocentricSurfaceNormal(t, n = [0, 0, 0]) {\n return an.from(t).normalize().to(n);\n }\n\n geodeticSurfaceNormalCartographic(t, n = [0, 0, 0]) {\n const s = Kf(t),\n r = s[0],\n i = s[1],\n o = Math.cos(i);\n return an.set(o * Math.cos(r), o * Math.sin(r), Math.sin(i)).normalize(), an.to(n);\n }\n\n geodeticSurfaceNormal(t, n = [0, 0, 0]) {\n return an.from(t).scale(this.oneOverRadiiSquared).normalize().to(n);\n }\n\n scaleToGeodeticSurface(t, n) {\n return td(t, this, n);\n }\n\n scaleToGeocentricSurface(t, n = [0, 0, 0]) {\n wt.from(t);\n const s = wt.x,\n r = wt.y,\n i = wt.z,\n o = this.oneOverRadiiSquared,\n a = 1 / Math.sqrt(s * s * o.x + r * r * o.y + i * i * o.z);\n return wt.multiplyScalar(a).to(n);\n }\n\n transformPositionToScaledSpace(t, n = [0, 0, 0]) {\n return wt.from(t).scale(this.oneOverRadii).to(n);\n }\n\n transformPositionFromScaledSpace(t, n = [0, 0, 0]) {\n return wt.from(t).scale(this.radii).to(n);\n }\n\n getSurfaceNormalIntersectionWithZAxis(t, n = 0, s = [0, 0, 0]) {\n j(Kt(this.radii.x, this.radii.y, xa)), j(this.radii.z > 0), wt.from(t);\n const r = wt.z * (1 - this.squaredXOverSquaredZ);\n if (!(Math.abs(r) >= this.radii.z - n)) return wt.set(0, 0, r).to(s);\n }\n\n}\n\nx(J, \"WGS84\", new J(Jf, Vf, jf));\nconst pt = {\n OUTSIDE: -1,\n INTERSECTING: 0,\n INSIDE: 1\n};\nnew A();\nnew A();\nconst be = new A(),\n bi = new A();\n\nclass Qe {\n constructor(t = [0, 0, 0], n = 0) {\n x(this, \"center\", void 0), x(this, \"radius\", void 0), this.radius = -0, this.center = new A(), this.fromCenterRadius(t, n);\n }\n\n fromCenterRadius(t, n) {\n return this.center.from(t), this.radius = n, this;\n }\n\n fromCornerPoints(t, n) {\n return n = be.from(n), this.center = new A().from(t).add(n).scale(0.5), this.radius = this.center.distance(n), this;\n }\n\n equals(t) {\n return this === t || !!t && this.center.equals(t.center) && this.radius === t.radius;\n }\n\n clone() {\n return new Qe(this.center, this.radius);\n }\n\n union(t) {\n const n = this.center,\n s = this.radius,\n r = t.center,\n i = t.radius,\n o = be.copy(r).subtract(n),\n a = o.magnitude();\n if (s >= a + i) return this.clone();\n if (i >= a + s) return t.clone();\n const c = (s + a + i) * 0.5;\n return bi.copy(o).scale((-s + c) / a).add(n), this.center.copy(bi), this.radius = c, this;\n }\n\n expand(t) {\n const s = be.from(t).subtract(this.center).magnitude();\n return s > this.radius && (this.radius = s), this;\n }\n\n transform(t) {\n this.center.transform(t);\n const n = qh(be, t);\n return this.radius = Math.max(n[0], Math.max(n[1], n[2])) * this.radius, this;\n }\n\n distanceSquaredTo(t) {\n const n = this.distanceTo(t);\n return n * n;\n }\n\n distanceTo(t) {\n const s = be.from(t).subtract(this.center);\n return Math.max(0, s.len() - this.radius);\n }\n\n intersectPlane(t) {\n const n = this.center,\n s = this.radius,\n i = t.normal.dot(n) + t.distance;\n return i < -s ? pt.OUTSIDE : i < s ? pt.INTERSECTING : pt.INSIDE;\n }\n\n}\n\nconst sd = new A(),\n rd = new A(),\n un = new A(),\n ln = new A(),\n hn = new A(),\n id = new A(),\n od = new A(),\n Gt = {\n COLUMN0ROW0: 0,\n COLUMN0ROW1: 1,\n COLUMN0ROW2: 2,\n COLUMN1ROW0: 3,\n COLUMN1ROW1: 4,\n COLUMN1ROW2: 5,\n COLUMN2ROW0: 6,\n COLUMN2ROW1: 7,\n COLUMN2ROW2: 8\n};\n\nclass qe {\n constructor(t = [0, 0, 0], n = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {\n x(this, \"center\", void 0), x(this, \"halfAxes\", void 0), this.center = new A().from(t), this.halfAxes = new X(n);\n }\n\n get halfSize() {\n const t = this.halfAxes.getColumn(0),\n n = this.halfAxes.getColumn(1),\n s = this.halfAxes.getColumn(2);\n return [new A(t).len(), new A(n).len(), new A(s).len()];\n }\n\n get quaternion() {\n const t = this.halfAxes.getColumn(0),\n n = this.halfAxes.getColumn(1),\n s = this.halfAxes.getColumn(2),\n r = new A(t).normalize(),\n i = new A(n).normalize(),\n o = new A(s).normalize();\n return new On().fromMatrix3(new X([...r, ...i, ...o]));\n }\n\n fromCenterHalfSizeQuaternion(t, n, s) {\n const r = new On(s),\n i = new X().fromQuaternion(r);\n return i[0] = i[0] * n[0], i[1] = i[1] * n[0], i[2] = i[2] * n[0], i[3] = i[3] * n[1], i[4] = i[4] * n[1], i[5] = i[5] * n[1], i[6] = i[6] * n[2], i[7] = i[7] * n[2], i[8] = i[8] * n[2], this.center = new A().from(t), this.halfAxes = i, this;\n }\n\n clone() {\n return new qe(this.center, this.halfAxes);\n }\n\n equals(t) {\n return this === t || !!t && this.center.equals(t.center) && this.halfAxes.equals(t.halfAxes);\n }\n\n getBoundingSphere(t = new Qe()) {\n const n = this.halfAxes,\n s = n.getColumn(0, un),\n r = n.getColumn(1, ln),\n i = n.getColumn(2, hn),\n o = sd.copy(s).add(r).add(i);\n return t.center.copy(this.center), t.radius = o.magnitude(), t;\n }\n\n intersectPlane(t) {\n const n = this.center,\n s = t.normal,\n r = this.halfAxes,\n i = s.x,\n o = s.y,\n a = s.z,\n c = Math.abs(i * r[Gt.COLUMN0ROW0] + o * r[Gt.COLUMN0ROW1] + a * r[Gt.COLUMN0ROW2]) + Math.abs(i * r[Gt.COLUMN1ROW0] + o * r[Gt.COLUMN1ROW1] + a * r[Gt.COLUMN1ROW2]) + Math.abs(i * r[Gt.COLUMN2ROW0] + o * r[Gt.COLUMN2ROW1] + a * r[Gt.COLUMN2ROW2]),\n u = s.dot(n) + t.distance;\n return u <= -c ? pt.OUTSIDE : u >= c ? pt.INSIDE : pt.INTERSECTING;\n }\n\n distanceTo(t) {\n return Math.sqrt(this.distanceSquaredTo(t));\n }\n\n distanceSquaredTo(t) {\n const n = rd.from(t).subtract(this.center),\n s = this.halfAxes,\n r = s.getColumn(0, un),\n i = s.getColumn(1, ln),\n o = s.getColumn(2, hn),\n a = r.magnitude(),\n c = i.magnitude(),\n u = o.magnitude();\n r.normalize(), i.normalize(), o.normalize();\n let l = 0,\n h;\n return h = Math.abs(n.dot(r)) - a, h > 0 && (l += h * h), h = Math.abs(n.dot(i)) - c, h > 0 && (l += h * h), h = Math.abs(n.dot(o)) - u, h > 0 && (l += h * h), l;\n }\n\n computePlaneDistances(t, n, s = [-0, -0]) {\n let r = Number.POSITIVE_INFINITY,\n i = Number.NEGATIVE_INFINITY;\n const o = this.center,\n a = this.halfAxes,\n c = a.getColumn(0, un),\n u = a.getColumn(1, ln),\n l = a.getColumn(2, hn),\n h = id.copy(c).add(u).add(l).add(o),\n f = od.copy(h).subtract(t);\n let d = n.dot(f);\n return r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).add(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).subtract(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).subtract(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).add(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).add(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).subtract(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).subtract(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), s[0] = r, s[1] = i, s;\n }\n\n transform(t) {\n this.center.transformAsPoint(t);\n const n = this.halfAxes.getColumn(0, un);\n n.transformAsPoint(t);\n const s = this.halfAxes.getColumn(1, ln);\n s.transformAsPoint(t);\n const r = this.halfAxes.getColumn(2, hn);\n return r.transformAsPoint(t), this.halfAxes = new X([...n, ...s, ...r]), this;\n }\n\n getTransform() {\n throw new Error(\"not implemented\");\n }\n\n}\n\nconst _i = new A(),\n wi = new A();\n\nclass nt {\n constructor(t = [0, 0, 1], n = 0) {\n x(this, \"normal\", void 0), x(this, \"distance\", void 0), this.normal = new A(), this.distance = -0, this.fromNormalDistance(t, n);\n }\n\n fromNormalDistance(t, n) {\n return j(Number.isFinite(n)), this.normal.from(t).normalize(), this.distance = n, this;\n }\n\n fromPointNormal(t, n) {\n t = _i.from(t), this.normal.from(n).normalize();\n const s = -this.normal.dot(t);\n return this.distance = s, this;\n }\n\n fromCoefficients(t, n, s, r) {\n return this.normal.set(t, n, s), j(Kt(this.normal.len(), 1)), this.distance = r, this;\n }\n\n clone() {\n return new nt(this.normal, this.distance);\n }\n\n equals(t) {\n return Kt(this.distance, t.distance) && Kt(this.normal, t.normal);\n }\n\n getPointDistance(t) {\n return this.normal.dot(t) + this.distance;\n }\n\n transform(t) {\n const n = wi.copy(this.normal).transformAsVector(t).normalize(),\n s = this.normal.scale(-this.distance).transform(t);\n return this.fromPointNormal(s, n);\n }\n\n projectPointOntoPlane(t, n = [0, 0, 0]) {\n const s = _i.from(t),\n r = this.getPointDistance(s),\n i = wi.copy(this.normal).scale(r);\n\n return s.subtract(i).to(n);\n }\n\n}\n\nconst Ri = [new A([1, 0, 0]), new A([0, 1, 0]), new A([0, 0, 1])],\n Mi = new A(),\n ad = new A();\n\nclass dt {\n constructor(t = []) {\n x(this, \"planes\", void 0), this.planes = t;\n }\n\n fromBoundingSphere(t) {\n this.planes.length = 2 * Ri.length;\n const n = t.center,\n s = t.radius;\n let r = 0;\n\n for (const i of Ri) {\n let o = this.planes[r],\n a = this.planes[r + 1];\n o || (o = this.planes[r] = new nt()), a || (a = this.planes[r + 1] = new nt());\n const c = Mi.copy(i).scale(-s).add(n);\n o.fromPointNormal(c, i);\n const u = Mi.copy(i).scale(s).add(n),\n l = ad.copy(i).negate();\n a.fromPointNormal(u, l), r += 2;\n }\n\n return this;\n }\n\n computeVisibility(t) {\n let n = pt.INSIDE;\n\n for (const s of this.planes) switch (t.intersectPlane(s)) {\n case pt.OUTSIDE:\n return pt.OUTSIDE;\n\n case pt.INTERSECTING:\n n = pt.INTERSECTING;\n break;\n }\n\n return n;\n }\n\n computeVisibilityWithPlaneMask(t, n) {\n if (j(Number.isFinite(n), \"parentPlaneMask is required.\"), n === dt.MASK_OUTSIDE || n === dt.MASK_INSIDE) return n;\n let s = dt.MASK_INSIDE;\n const r = this.planes;\n\n for (let i = 0; i < this.planes.length; ++i) {\n const o = i < 31 ? 1 << i : 0;\n if (i < 31 && !(n & o)) continue;\n const a = r[i],\n c = t.intersectPlane(a);\n if (c === pt.OUTSIDE) return dt.MASK_OUTSIDE;\n c === pt.INTERSECTING && (s |= o);\n }\n\n return s;\n }\n\n}\n\nx(dt, \"MASK_OUTSIDE\", 4294967295);\nx(dt, \"MASK_INSIDE\", 0);\nx(dt, \"MASK_INDETERMINATE\", 2147483647);\nconst cd = new A(),\n ud = new A(),\n ld = new A(),\n hd = new A(),\n fd = new A();\n\nclass Fn {\n constructor(t = {}) {\n x(this, \"left\", void 0), x(this, \"_left\", void 0), x(this, \"right\", void 0), x(this, \"_right\", void 0), x(this, \"top\", void 0), x(this, \"_top\", void 0), x(this, \"bottom\", void 0), x(this, \"_bottom\", void 0), x(this, \"near\", void 0), x(this, \"_near\", void 0), x(this, \"far\", void 0), x(this, \"_far\", void 0), x(this, \"_cullingVolume\", new dt([new nt(), new nt(), new nt(), new nt(), new nt(), new nt()])), x(this, \"_perspectiveMatrix\", new V()), x(this, \"_infinitePerspective\", new V());\n const {\n near: n = 1,\n far: s = 5e8\n } = t;\n this.left = t.left, this._left = void 0, this.right = t.right, this._right = void 0, this.top = t.top, this._top = void 0, this.bottom = t.bottom, this._bottom = void 0, this.near = n, this._near = n, this.far = s, this._far = s;\n }\n\n clone() {\n return new Fn({\n right: this.right,\n left: this.left,\n top: this.top,\n bottom: this.bottom,\n near: this.near,\n far: this.far\n });\n }\n\n equals(t) {\n return t && t instanceof Fn && this.right === t.right && this.left === t.left && this.top === t.top && this.bottom === t.bottom && this.near === t.near && this.far === t.far;\n }\n\n get projectionMatrix() {\n return this._update(), this._perspectiveMatrix;\n }\n\n get infiniteProjectionMatrix() {\n return this._update(), this._infinitePerspective;\n }\n\n computeCullingVolume(t, n, s) {\n j(t, \"position is required.\"), j(n, \"direction is required.\"), j(s, \"up is required.\");\n const r = this._cullingVolume.planes;\n s = cd.copy(s).normalize();\n const i = ud.copy(n).cross(s).normalize(),\n o = ld.copy(n).multiplyByScalar(this.near).add(t),\n a = hd.copy(n).multiplyByScalar(this.far).add(t);\n let c = fd;\n return c.copy(i).multiplyByScalar(this.left).add(o).subtract(t).cross(s), r[0].fromPointNormal(t, c), c.copy(i).multiplyByScalar(this.right).add(o).subtract(t).cross(s).negate(), r[1].fromPointNormal(t, c), c.copy(s).multiplyByScalar(this.bottom).add(o).subtract(t).cross(i).negate(), r[2].fromPointNormal(t, c), c.copy(s).multiplyByScalar(this.top).add(o).subtract(t).cross(i), r[3].fromPointNormal(t, c), c = new A().copy(n), r[4].fromPointNormal(o, c), c.negate(), r[5].fromPointNormal(a, c), this._cullingVolume;\n }\n\n getPixelDimensions(t, n, s, r) {\n this._update(), j(Number.isFinite(t) && Number.isFinite(n)), j(t > 0), j(n > 0), j(s > 0), j(r);\n const i = 1 / this.near;\n let o = this.top * i;\n const a = 2 * s * o / n;\n o = this.right * i;\n const c = 2 * s * o / t;\n return r.x = c, r.y = a, r;\n }\n\n _update() {\n j(Number.isFinite(this.right) && Number.isFinite(this.left) && Number.isFinite(this.top) && Number.isFinite(this.bottom) && Number.isFinite(this.near) && Number.isFinite(this.far));\n const {\n top: t,\n bottom: n,\n right: s,\n left: r,\n near: i,\n far: o\n } = this;\n (t !== this._top || n !== this._bottom || r !== this._left || s !== this._right || i !== this._near || o !== this._far) && (j(this.near > 0 && this.near < this.far, \"near must be greater than zero and less than far.\"), this._left = r, this._right = s, this._top = t, this._bottom = n, this._near = i, this._far = o, this._perspectiveMatrix = new V().frustum({\n left: r,\n right: s,\n bottom: n,\n top: t,\n near: i,\n far: o\n }), this._infinitePerspective = new V().frustum({\n left: r,\n right: s,\n bottom: n,\n top: t,\n near: i,\n far: 1 / 0\n }));\n }\n\n}\n\nconst dd = e => e !== null && typeof e < \"u\";\n\nclass Dn {\n constructor(t = {}) {\n x(this, \"_offCenterFrustum\", new Fn()), x(this, \"fov\", void 0), x(this, \"_fov\", void 0), x(this, \"_fovy\", void 0), x(this, \"_sseDenominator\", void 0), x(this, \"aspectRatio\", void 0), x(this, \"_aspectRatio\", void 0), x(this, \"near\", void 0), x(this, \"_near\", void 0), x(this, \"far\", void 0), x(this, \"_far\", void 0), x(this, \"xOffset\", void 0), x(this, \"_xOffset\", void 0), x(this, \"yOffset\", void 0), x(this, \"_yOffset\", void 0);\n const {\n fov: n,\n aspectRatio: s,\n near: r = 1,\n far: i = 5e8,\n xOffset: o = 0,\n yOffset: a = 0\n } = t;\n this.fov = n, this.aspectRatio = s, this.near = r, this.far = i, this.xOffset = o, this.yOffset = a;\n }\n\n clone() {\n return new Dn({\n aspectRatio: this.aspectRatio,\n fov: this.fov,\n near: this.near,\n far: this.far\n });\n }\n\n equals(t) {\n return !dd(t) || !(t instanceof Dn) ? !1 : (this._update(), t._update(), this.fov === t.fov && this.aspectRatio === t.aspectRatio && this.near === t.near && this.far === t.far && this._offCenterFrustum.equals(t._offCenterFrustum));\n }\n\n get projectionMatrix() {\n return this._update(), this._offCenterFrustum.projectionMatrix;\n }\n\n get infiniteProjectionMatrix() {\n return this._update(), this._offCenterFrustum.infiniteProjectionMatrix;\n }\n\n get fovy() {\n return this._update(), this._fovy;\n }\n\n get sseDenominator() {\n return this._update(), this._sseDenominator;\n }\n\n computeCullingVolume(t, n, s) {\n return this._update(), this._offCenterFrustum.computeCullingVolume(t, n, s);\n }\n\n getPixelDimensions(t, n, s, r) {\n return this._update(), this._offCenterFrustum.getPixelDimensions(t, n, s, r || new Wn());\n }\n\n _update() {\n j(Number.isFinite(this.fov) && Number.isFinite(this.aspectRatio) && Number.isFinite(this.near) && Number.isFinite(this.far));\n const t = this._offCenterFrustum;\n (this.fov !== this._fov || this.aspectRatio !== this._aspectRatio || this.near !== this._near || this.far !== this._far || this.xOffset !== this._xOffset || this.yOffset !== this._yOffset) && (j(this.fov >= 0 && this.fov < Math.PI), j(this.aspectRatio > 0), j(this.near >= 0 && this.near < this.far), this._aspectRatio = this.aspectRatio, this._fov = this.fov, this._fovy = this.aspectRatio <= 1 ? this.fov : Math.atan(Math.tan(this.fov * 0.5) / this.aspectRatio) * 2, this._near = this.near, this._far = this.far, this._sseDenominator = 2 * Math.tan(0.5 * this._fovy), this._xOffset = this.xOffset, this._yOffset = this.yOffset, t.top = this.near * Math.tan(0.5 * this._fovy), t.bottom = -t.top, t.right = this.aspectRatio * t.top, t.left = -t.right, t.near = this.near, t.far = this.far, t.right += this.xOffset, t.left += this.xOffset, t.top += this.yOffset, t.bottom += this.yOffset);\n }\n\n}\n\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nconst Ot = new X(),\n md = new X(),\n gd = new X(),\n fn = new X(),\n Si = new X();\n\nfunction Ad(e, t = {}) {\n const n = Hf,\n s = 10;\n let r = 0,\n i = 0;\n const o = md,\n a = gd;\n o.identity(), a.copy(e);\n const c = n * pd(a);\n\n for (; i < s && yd(a) > c;) Bd(a, fn), Si.copy(fn).transpose(), a.multiplyRight(fn), a.multiplyLeft(Si), o.multiplyRight(fn), ++r > 2 && (++i, r = 0);\n\n return t.unitary = o.toTarget(t.unitary), t.diagonal = a.toTarget(t.diagonal), t;\n}\n\nfunction pd(e) {\n let t = 0;\n\n for (let n = 0; n < 9; ++n) {\n const s = e[n];\n t += s * s;\n }\n\n return Math.sqrt(t);\n}\n\nconst zs = [1, 0, 0],\n Ws = [2, 2, 1];\n\nfunction yd(e) {\n let t = 0;\n\n for (let n = 0; n < 3; ++n) {\n const s = e[Ot.getElementIndex(Ws[n], zs[n])];\n t += 2 * s * s;\n }\n\n return Math.sqrt(t);\n}\n\nfunction Bd(e, t) {\n const n = xa;\n let s = 0,\n r = 1;\n\n for (let u = 0; u < 3; ++u) {\n const l = Math.abs(e[Ot.getElementIndex(Ws[u], zs[u])]);\n l > s && (r = u, s = l);\n }\n\n const i = zs[r],\n o = Ws[r];\n let a = 1,\n c = 0;\n\n if (Math.abs(e[Ot.getElementIndex(o, i)]) > n) {\n const u = e[Ot.getElementIndex(o, o)],\n l = e[Ot.getElementIndex(i, i)],\n h = e[Ot.getElementIndex(o, i)],\n f = (u - l) / 2 / h;\n let d;\n f < 0 ? d = -1 / (-f + Math.sqrt(1 + f * f)) : d = 1 / (f + Math.sqrt(1 + f * f)), a = 1 / Math.sqrt(1 + d * d), c = d * a;\n }\n\n return X.IDENTITY.to(t), t[Ot.getElementIndex(i, i)] = t[Ot.getElementIndex(o, o)] = a, t[Ot.getElementIndex(o, i)] = c, t[Ot.getElementIndex(i, o)] = -c, t;\n}\n\nconst Vt = new A(),\n Cd = new A(),\n Ed = new A(),\n Td = new A(),\n bd = new A(),\n _d = new X(),\n wd = {\n diagonal: new X(),\n unitary: new X()\n};\n\nfunction Rd(e, t = new qe()) {\n if (!e || e.length === 0) return t.halfAxes = new X([0, 0, 0, 0, 0, 0, 0, 0, 0]), t.center = new A(), t;\n const n = e.length,\n s = new A(0, 0, 0);\n\n for (const v of e) s.add(v);\n\n const r = 1 / n;\n s.multiplyByScalar(r);\n let i = 0,\n o = 0,\n a = 0,\n c = 0,\n u = 0,\n l = 0;\n\n for (const v of e) {\n const L = Vt.copy(v).subtract(s);\n i += L.x * L.x, o += L.x * L.y, a += L.x * L.z, c += L.y * L.y, u += L.y * L.z, l += L.z * L.z;\n }\n\n i *= r, o *= r, a *= r, c *= r, u *= r, l *= r;\n const h = _d;\n h[0] = i, h[1] = o, h[2] = a, h[3] = o, h[4] = c, h[5] = u, h[6] = a, h[7] = u, h[8] = l;\n const {\n unitary: f\n } = Ad(h, wd),\n d = t.halfAxes.copy(f);\n let m = d.getColumn(0, Ed),\n g = d.getColumn(1, Td),\n y = d.getColumn(2, bd),\n E = -Number.MAX_VALUE,\n R = -Number.MAX_VALUE,\n B = -Number.MAX_VALUE,\n C = Number.MAX_VALUE,\n M = Number.MAX_VALUE,\n b = Number.MAX_VALUE;\n\n for (const v of e) Vt.copy(v), E = Math.max(Vt.dot(m), E), R = Math.max(Vt.dot(g), R), B = Math.max(Vt.dot(y), B), C = Math.min(Vt.dot(m), C), M = Math.min(Vt.dot(g), M), b = Math.min(Vt.dot(y), b);\n\n m = m.multiplyByScalar(0.5 * (C + E)), g = g.multiplyByScalar(0.5 * (M + R)), y = y.multiplyByScalar(0.5 * (b + B)), t.center.copy(m).add(g).add(y);\n const O = Cd.set(E - C, R - M, B - b).multiplyByScalar(0.5),\n F = new X([O[0], 0, 0, 0, O[1], 0, 0, 0, O[2]]);\n return t.halfAxes.multiplyRight(F), t;\n}\n\nlet Ii = function (e) {\n return e[e.ADD = 1] = \"ADD\", e[e.REPLACE = 2] = \"REPLACE\", e;\n}({}),\n dn = function (e) {\n return e.EMPTY = \"empty\", e.SCENEGRAPH = \"scenegraph\", e.POINTCLOUD = \"pointcloud\", e.MESH = \"mesh\", e;\n}({}),\n Md = function (e) {\n return e.I3S = \"I3S\", e.TILES3D = \"TILES3D\", e;\n}({}),\n Qn = function (e) {\n return e.GEOMETRIC_ERROR = \"geometricError\", e.MAX_SCREEN_THRESHOLD = \"maxScreenThreshold\", e;\n}({});\n\nconst va = \"4.1.1\",\n _e = {\n COMPOSITE: \"cmpt\",\n POINT_CLOUD: \"pnts\",\n BATCHED_3D_MODEL: \"b3dm\",\n INSTANCED_3D_MODEL: \"i3dm\",\n GEOMETRY: \"geom\",\n VECTOR: \"vect\",\n GLTF: \"glTF\"\n};\n\nfunction Oa(e, t, n) {\n z(e instanceof ArrayBuffer);\n const s = new TextDecoder(\"utf8\"),\n r = new Uint8Array(e, t, n);\n return s.decode(r);\n}\n\nfunction Sd(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;\n const n = new DataView(e);\n return `${String.fromCharCode(n.getUint8(t + 0))}${String.fromCharCode(n.getUint8(t + 1))}${String.fromCharCode(n.getUint8(t + 2))}${String.fromCharCode(n.getUint8(t + 3))}`;\n}\n\nconst Id = \"4.1.1\",\n xd = {\n name: \"Draco\",\n id: \"draco\",\n module: \"draco\",\n version: Id,\n worker: !0,\n extensions: [\"drc\"],\n mimeTypes: [\"application/octet-stream\"],\n binary: !0,\n tests: [\"DRACO\"],\n options: {\n draco: {\n decoderType: typeof WebAssembly == \"object\" ? \"wasm\" : \"js\",\n libraryPath: \"libs/\",\n extraAttributes: {},\n attributeNameEntry: void 0\n }\n }\n};\n\nfunction vd(e, t, n) {\n const s = Fa(t.metadata),\n r = [],\n i = Od(t.attributes);\n\n for (const o in e) {\n const a = e[o],\n c = xi(o, a, i[o]);\n r.push(c);\n }\n\n if (n) {\n const o = xi(\"indices\", n);\n r.push(o);\n }\n\n return {\n fields: r,\n metadata: s\n };\n}\n\nfunction Od(e) {\n const t = {};\n\n for (const n in e) {\n const s = e[n];\n t[s.name || \"undefined\"] = s;\n }\n\n return t;\n}\n\nfunction xi(e, t, n) {\n const s = n ? Fa(n.metadata) : void 0;\n return ih(e, t, s);\n}\n\nfunction Fa(e) {\n Object.entries(e);\n const t = {};\n\n for (const n in e) t[`${n}.string`] = JSON.stringify(e[n]);\n\n return t;\n}\n\nconst vi = {\n POSITION: \"POSITION\",\n NORMAL: \"NORMAL\",\n COLOR: \"COLOR_0\",\n TEX_COORD: \"TEXCOORD_0\"\n},\n Fd = {\n 1: Int8Array,\n 2: Uint8Array,\n 3: Int16Array,\n 4: Uint16Array,\n 5: Int32Array,\n 6: Uint32Array,\n 9: Float32Array\n},\n Dd = 4;\n\nclass Ld {\n constructor(t) {\n this.draco = void 0, this.decoder = void 0, this.metadataQuerier = void 0, this.draco = t, this.decoder = new this.draco.Decoder(), this.metadataQuerier = new this.draco.MetadataQuerier();\n }\n\n destroy() {\n this.draco.destroy(this.decoder), this.draco.destroy(this.metadataQuerier);\n }\n\n parseSync(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n const s = new this.draco.DecoderBuffer();\n s.Init(new Int8Array(t), t.byteLength), this._disableAttributeTransforms(n);\n const r = this.decoder.GetEncodedGeometryType(s),\n i = r === this.draco.TRIANGULAR_MESH ? new this.draco.Mesh() : new this.draco.PointCloud();\n\n try {\n let o;\n\n switch (r) {\n case this.draco.TRIANGULAR_MESH:\n o = this.decoder.DecodeBufferToMesh(s, i);\n break;\n\n case this.draco.POINT_CLOUD:\n o = this.decoder.DecodeBufferToPointCloud(s, i);\n break;\n\n default:\n throw new Error(\"DRACO: Unknown geometry type.\");\n }\n\n if (!o.ok() || !i.ptr) {\n const f = `DRACO decompression failed: ${o.error_msg()}`;\n throw new Error(f);\n }\n\n const a = this._getDracoLoaderData(i, r, n),\n c = this._getMeshData(i, a, n),\n u = rh(c.attributes),\n l = vd(c.attributes, a, c.indices);\n\n return {\n loader: \"draco\",\n loaderData: a,\n header: {\n vertexCount: i.num_points(),\n boundingBox: u\n },\n ...c,\n schema: l\n };\n } finally {\n this.draco.destroy(s), i && this.draco.destroy(i);\n }\n }\n\n _getDracoLoaderData(t, n, s) {\n const r = this._getTopLevelMetadata(t),\n i = this._getDracoAttributes(t, s);\n\n return {\n geometry_type: n,\n num_attributes: t.num_attributes(),\n num_points: t.num_points(),\n num_faces: t instanceof this.draco.Mesh ? t.num_faces() : 0,\n metadata: r,\n attributes: i\n };\n }\n\n _getDracoAttributes(t, n) {\n const s = {};\n\n for (let r = 0; r < t.num_attributes(); r++) {\n const i = this.decoder.GetAttribute(t, r),\n o = this._getAttributeMetadata(t, r);\n\n s[i.unique_id()] = {\n unique_id: i.unique_id(),\n attribute_type: i.attribute_type(),\n data_type: i.data_type(),\n num_components: i.num_components(),\n byte_offset: i.byte_offset(),\n byte_stride: i.byte_stride(),\n normalized: i.normalized(),\n attribute_index: r,\n metadata: o\n };\n\n const a = this._getQuantizationTransform(i, n);\n\n a && (s[i.unique_id()].quantization_transform = a);\n\n const c = this._getOctahedronTransform(i, n);\n\n c && (s[i.unique_id()].octahedron_transform = c);\n }\n\n return s;\n }\n\n _getMeshData(t, n, s) {\n const r = this._getMeshAttributes(n, t, s);\n\n if (!r.POSITION) throw new Error(\"DRACO: No position attribute found.\");\n if (t instanceof this.draco.Mesh) switch (s.topology) {\n case \"triangle-strip\":\n return {\n topology: \"triangle-strip\",\n mode: 4,\n attributes: r,\n indices: {\n value: this._getTriangleStripIndices(t),\n size: 1\n }\n };\n\n case \"triangle-list\":\n default:\n return {\n topology: \"triangle-list\",\n mode: 5,\n attributes: r,\n indices: {\n value: this._getTriangleListIndices(t),\n size: 1\n }\n };\n }\n return {\n topology: \"point-list\",\n mode: 0,\n attributes: r\n };\n }\n\n _getMeshAttributes(t, n, s) {\n const r = {};\n\n for (const i of Object.values(t.attributes)) {\n const o = this._deduceAttributeName(i, s);\n\n i.name = o;\n\n const {\n value: a,\n size: c\n } = this._getAttributeValues(n, i);\n\n r[o] = {\n value: a,\n size: c,\n byteOffset: i.byte_offset,\n byteStride: i.byte_stride,\n normalized: i.normalized\n };\n }\n\n return r;\n }\n\n _getTriangleListIndices(t) {\n const s = t.num_faces() * 3,\n r = s * Dd,\n i = this.draco._malloc(r);\n\n try {\n return this.decoder.GetTrianglesUInt32Array(t, r, i), new Uint32Array(this.draco.HEAPF32.buffer, i, s).slice();\n } finally {\n this.draco._free(i);\n }\n }\n\n _getTriangleStripIndices(t) {\n const n = new this.draco.DracoInt32Array();\n\n try {\n return this.decoder.GetTriangleStripsFromMesh(t, n), Nd(n);\n } finally {\n this.draco.destroy(n);\n }\n }\n\n _getAttributeValues(t, n) {\n const s = Fd[n.data_type],\n r = n.num_components,\n o = t.num_points() * r,\n a = o * s.BYTES_PER_ELEMENT,\n c = Pd(this.draco, s);\n let u;\n\n const l = this.draco._malloc(a);\n\n try {\n const h = this.decoder.GetAttribute(t, n.attribute_index);\n this.decoder.GetAttributeDataArrayForAllPoints(t, h, c, a, l), u = new s(this.draco.HEAPF32.buffer, l, o).slice();\n } finally {\n this.draco._free(l);\n }\n\n return {\n value: u,\n size: r\n };\n }\n\n _deduceAttributeName(t, n) {\n const s = t.unique_id;\n\n for (const [o, a] of Object.entries(n.extraAttributes || {})) if (a === s) return o;\n\n const r = t.attribute_type;\n\n for (const o in vi) if (this.draco[o] === r) return vi[o];\n\n const i = n.attributeNameEntry || \"name\";\n return t.metadata[i] ? t.metadata[i].string : `CUSTOM_ATTRIBUTE_${s}`;\n }\n\n _getTopLevelMetadata(t) {\n const n = this.decoder.GetMetadata(t);\n return this._getDracoMetadata(n);\n }\n\n _getAttributeMetadata(t, n) {\n const s = this.decoder.GetAttributeMetadata(t, n);\n return this._getDracoMetadata(s);\n }\n\n _getDracoMetadata(t) {\n if (!t || !t.ptr) return {};\n const n = {},\n s = this.metadataQuerier.NumEntries(t);\n\n for (let r = 0; r < s; r++) {\n const i = this.metadataQuerier.GetEntryName(t, r);\n n[i] = this._getDracoMetadataField(t, i);\n }\n\n return n;\n }\n\n _getDracoMetadataField(t, n) {\n const s = new this.draco.DracoInt32Array();\n\n try {\n this.metadataQuerier.GetIntEntryArray(t, n, s);\n const r = Gd(s);\n return {\n int: this.metadataQuerier.GetIntEntry(t, n),\n string: this.metadataQuerier.GetStringEntry(t, n),\n double: this.metadataQuerier.GetDoubleEntry(t, n),\n intArray: r\n };\n } finally {\n this.draco.destroy(s);\n }\n }\n\n _disableAttributeTransforms(t) {\n const {\n quantizedAttributes: n = [],\n octahedronAttributes: s = []\n } = t,\n r = [...n, ...s];\n\n for (const i of r) this.decoder.SkipAttributeTransform(this.draco[i]);\n }\n\n _getQuantizationTransform(t, n) {\n const {\n quantizedAttributes: s = []\n } = n,\n r = t.attribute_type();\n\n if (s.map(o => this.decoder[o]).includes(r)) {\n const o = new this.draco.AttributeQuantizationTransform();\n\n try {\n if (o.InitFromAttribute(t)) return {\n quantization_bits: o.quantization_bits(),\n range: o.range(),\n min_values: new Float32Array([1, 2, 3]).map(a => o.min_value(a))\n };\n } finally {\n this.draco.destroy(o);\n }\n }\n\n return null;\n }\n\n _getOctahedronTransform(t, n) {\n const {\n octahedronAttributes: s = []\n } = n,\n r = t.attribute_type();\n\n if (s.map(o => this.decoder[o]).includes(r)) {\n const o = new this.draco.AttributeQuantizationTransform();\n\n try {\n if (o.InitFromAttribute(t)) return {\n quantization_bits: o.quantization_bits()\n };\n } finally {\n this.draco.destroy(o);\n }\n }\n\n return null;\n }\n\n}\n\nfunction Pd(e, t) {\n switch (t) {\n case Float32Array:\n return e.DT_FLOAT32;\n\n case Int8Array:\n return e.DT_INT8;\n\n case Int16Array:\n return e.DT_INT16;\n\n case Int32Array:\n return e.DT_INT32;\n\n case Uint8Array:\n return e.DT_UINT8;\n\n case Uint16Array:\n return e.DT_UINT16;\n\n case Uint32Array:\n return e.DT_UINT32;\n\n default:\n return e.DT_INVALID;\n }\n}\n\nfunction Gd(e) {\n const t = e.size(),\n n = new Int32Array(t);\n\n for (let s = 0; s < t; s++) n[s] = e.GetValue(s);\n\n return n;\n}\n\nfunction Nd(e) {\n const t = e.size(),\n n = new Int32Array(t);\n\n for (let s = 0; s < t; s++) n[s] = e.GetValue(s);\n\n return n;\n}\n\nconst Ud = \"1.5.6\",\n Hd = \"1.4.1\",\n As = `https://www.gstatic.com/draco/versioned/decoders/${Ud}`,\n ft = {\n DECODER: \"draco_wasm_wrapper.js\",\n DECODER_WASM: \"draco_decoder.wasm\",\n FALLBACK_DECODER: \"draco_decoder.js\",\n ENCODER: \"draco_encoder.js\"\n},\n ps = {\n [ft.DECODER]: `${As}/${ft.DECODER}`,\n [ft.DECODER_WASM]: `${As}/${ft.DECODER_WASM}`,\n [ft.FALLBACK_DECODER]: `${As}/${ft.FALLBACK_DECODER}`,\n [ft.ENCODER]: `https://raw.githubusercontent.com/google/draco/${Hd}/javascript/${ft.ENCODER}`\n};\nlet we;\n\nasync function Jd(e) {\n const t = e.modules || {};\n return t.draco3d ? we = we || t.draco3d.createDecoderModule({}).then(n => ({\n draco: n\n })) : we = we || Vd(e), await we;\n}\n\nasync function Vd(e) {\n let t, n;\n\n switch (e.draco && e.draco.decoderType) {\n case \"js\":\n t = await Zt(ps[ft.FALLBACK_DECODER], \"draco\", e, ft.FALLBACK_DECODER);\n break;\n\n case \"wasm\":\n default:\n [t, n] = await Promise.all([await Zt(ps[ft.DECODER], \"draco\", e, ft.DECODER), await Zt(ps[ft.DECODER_WASM], \"draco\", e, ft.DECODER_WASM)]);\n }\n\n return t = t || globalThis.DracoDecoderModule, await jd(t, n);\n}\n\nfunction jd(e, t) {\n const n = {};\n return t && (n.wasmBinary = t), new Promise(s => {\n e({ ...n,\n onModuleLoaded: r => s({\n draco: r\n })\n });\n });\n}\n\nconst Da = { ...xd,\n parse: kd\n};\n\nasync function kd(e, t) {\n const {\n draco: n\n } = await Jd(t),\n s = new Ld(n);\n\n try {\n return s.parseSync(e, t == null ? void 0 : t.draco);\n } finally {\n s.destroy();\n }\n}\n\nconst Kd = {\n POINTS: 0,\n LINES: 1,\n LINE_LOOP: 2,\n LINE_STRIP: 3,\n TRIANGLES: 4,\n TRIANGLE_STRIP: 5,\n TRIANGLE_FAN: 6\n},\n $ = {\n BYTE: 5120,\n UNSIGNED_BYTE: 5121,\n SHORT: 5122,\n UNSIGNED_SHORT: 5123,\n INT: 5124,\n UNSIGNED_INT: 5125,\n FLOAT: 5126,\n DOUBLE: 5130\n},\n G = { ...Kd,\n ...$\n},\n ys = {\n [$.DOUBLE]: Float64Array,\n [$.FLOAT]: Float32Array,\n [$.UNSIGNED_SHORT]: Uint16Array,\n [$.UNSIGNED_INT]: Uint32Array,\n [$.UNSIGNED_BYTE]: Uint8Array,\n [$.BYTE]: Int8Array,\n [$.SHORT]: Int16Array,\n [$.INT]: Int32Array\n},\n zd = {\n DOUBLE: $.DOUBLE,\n FLOAT: $.FLOAT,\n UNSIGNED_SHORT: $.UNSIGNED_SHORT,\n UNSIGNED_INT: $.UNSIGNED_INT,\n UNSIGNED_BYTE: $.UNSIGNED_BYTE,\n BYTE: $.BYTE,\n SHORT: $.SHORT,\n INT: $.INT\n},\n Bs = \"Failed to convert GL type\";\n\nclass Lt {\n static fromTypedArray(t) {\n t = ArrayBuffer.isView(t) ? t.constructor : t;\n\n for (const n in ys) if (ys[n] === t) return n;\n\n throw new Error(Bs);\n }\n\n static fromName(t) {\n const n = zd[t];\n if (!n) throw new Error(Bs);\n return n;\n }\n\n static getArrayType(t) {\n switch (t) {\n case $.UNSIGNED_SHORT_5_6_5:\n case $.UNSIGNED_SHORT_4_4_4_4:\n case $.UNSIGNED_SHORT_5_5_5_1:\n return Uint16Array;\n\n default:\n const n = ys[t];\n if (!n) throw new Error(Bs);\n return n;\n }\n }\n\n static getByteSize(t) {\n return Lt.getArrayType(t).BYTES_PER_ELEMENT;\n }\n\n static validate(t) {\n return !!Lt.getArrayType(t);\n }\n\n static createTypedArray(t, n) {\n let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0,\n r = arguments.length > 3 ? arguments[3] : void 0;\n r === void 0 && (r = (n.byteLength - s) / Lt.getByteSize(t));\n const i = Lt.getArrayType(t);\n return new i(n, s, r);\n }\n\n}\n\nfunction Wd(e, t) {\n if (!e) throw new Error(`math.gl assertion failed. ${t}`);\n}\n\nfunction Xd(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0];\n const n = e >> 11 & 31,\n s = e >> 5 & 63,\n r = e & 31;\n return t[0] = n << 3, t[1] = s << 2, t[2] = r << 3, t;\n}\n\nnew Wn();\nnew A();\nnew Wn();\nnew Wn();\n\nfunction Oi(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 255;\n return mh(e, 0, t) / t * 2 - 1;\n}\n\nfunction Fi(e) {\n return e < 0 ? -1 : 1;\n}\n\nfunction Qd(e, t, n, s) {\n if (Wd(s), e < 0 || e > n || t < 0 || t > n) throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);\n\n if (s.x = Oi(e, n), s.y = Oi(t, n), s.z = 1 - (Math.abs(s.x) + Math.abs(s.y)), s.z < 0) {\n const r = s.x;\n s.x = (1 - Math.abs(s.y)) * Fi(r), s.y = (1 - Math.abs(r)) * Fi(s.y);\n }\n\n return s.normalize();\n}\n\nfunction qd(e, t, n) {\n return Qd(e, t, 255, n);\n}\n\nclass br {\n constructor(t, n) {\n this.json = void 0, this.buffer = void 0, this.featuresLength = 0, this._cachedTypedArrays = {}, this.json = t, this.buffer = n;\n }\n\n getExtension(t) {\n return this.json.extensions && this.json.extensions[t];\n }\n\n hasProperty(t) {\n return !!this.json[t];\n }\n\n getGlobalProperty(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : G.UNSIGNED_INT,\n s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;\n const r = this.json[t];\n return r && Number.isFinite(r.byteOffset) ? this._getTypedArrayFromBinary(t, n, s, 1, r.byteOffset) : r;\n }\n\n getPropertyArray(t, n, s) {\n const r = this.json[t];\n return r && Number.isFinite(r.byteOffset) ? (\"componentType\" in r && (n = Lt.fromName(r.componentType)), this._getTypedArrayFromBinary(t, n, s, this.featuresLength, r.byteOffset)) : this._getTypedArrayFromArray(t, n, r);\n }\n\n getProperty(t, n, s, r, i) {\n const o = this.json[t];\n if (!o) return o;\n const a = this.getPropertyArray(t, n, s);\n if (s === 1) return a[r];\n\n for (let c = 0; c < s; ++c) i[c] = a[s * r + c];\n\n return i;\n }\n\n _getTypedArrayFromBinary(t, n, s, r, i) {\n const o = this._cachedTypedArrays;\n let a = o[t];\n return a || (a = Lt.createTypedArray(n, this.buffer.buffer, this.buffer.byteOffset + i, r * s), o[t] = a), a;\n }\n\n _getTypedArrayFromArray(t, n, s) {\n const r = this._cachedTypedArrays;\n let i = r[t];\n return i || (i = Lt.createTypedArray(n, s), r[t] = i), i;\n }\n\n}\n\nconst Yd = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n},\n $d = {\n SCALAR: (e, t) => e[t],\n VEC2: (e, t) => [e[2 * t + 0], e[2 * t + 1]],\n VEC3: (e, t) => [e[3 * t + 0], e[3 * t + 1], e[3 * t + 2]],\n VEC4: (e, t) => [e[4 * t + 0], e[4 * t + 1], e[4 * t + 2], e[4 * t + 3]],\n MAT2: (e, t) => [e[4 * t + 0], e[4 * t + 1], e[4 * t + 2], e[4 * t + 3]],\n MAT3: (e, t) => [e[9 * t + 0], e[9 * t + 1], e[9 * t + 2], e[9 * t + 3], e[9 * t + 4], e[9 * t + 5], e[9 * t + 6], e[9 * t + 7], e[9 * t + 8]],\n MAT4: (e, t) => [e[16 * t + 0], e[16 * t + 1], e[16 * t + 2], e[16 * t + 3], e[16 * t + 4], e[16 * t + 5], e[16 * t + 6], e[16 * t + 7], e[16 * t + 8], e[16 * t + 9], e[16 * t + 10], e[16 * t + 11], e[16 * t + 12], e[16 * t + 13], e[16 * t + 14], e[16 * t + 15]]\n},\n Zd = {\n SCALAR: (e, t, n) => {\n t[n] = e;\n },\n VEC2: (e, t, n) => {\n t[2 * n + 0] = e[0], t[2 * n + 1] = e[1];\n },\n VEC3: (e, t, n) => {\n t[3 * n + 0] = e[0], t[3 * n + 1] = e[1], t[3 * n + 2] = e[2];\n },\n VEC4: (e, t, n) => {\n t[4 * n + 0] = e[0], t[4 * n + 1] = e[1], t[4 * n + 2] = e[2], t[4 * n + 3] = e[3];\n },\n MAT2: (e, t, n) => {\n t[4 * n + 0] = e[0], t[4 * n + 1] = e[1], t[4 * n + 2] = e[2], t[4 * n + 3] = e[3];\n },\n MAT3: (e, t, n) => {\n t[9 * n + 0] = e[0], t[9 * n + 1] = e[1], t[9 * n + 2] = e[2], t[9 * n + 3] = e[3], t[9 * n + 4] = e[4], t[9 * n + 5] = e[5], t[9 * n + 6] = e[6], t[9 * n + 7] = e[7], t[9 * n + 8] = e[8], t[9 * n + 9] = e[9];\n },\n MAT4: (e, t, n) => {\n t[16 * n + 0] = e[0], t[16 * n + 1] = e[1], t[16 * n + 2] = e[2], t[16 * n + 3] = e[3], t[16 * n + 4] = e[4], t[16 * n + 5] = e[5], t[16 * n + 6] = e[6], t[16 * n + 7] = e[7], t[16 * n + 8] = e[8], t[16 * n + 9] = e[9], t[16 * n + 10] = e[10], t[16 * n + 11] = e[11], t[16 * n + 12] = e[12], t[16 * n + 13] = e[13], t[16 * n + 14] = e[14], t[16 * n + 15] = e[15];\n }\n};\n\nfunction tm(e, t, n, s) {\n const {\n componentType: r\n } = e;\n z(e.componentType);\n const i = typeof r == \"string\" ? Lt.fromName(r) : r,\n o = Yd[e.type],\n a = $d[e.type],\n c = Zd[e.type];\n return n += e.byteOffset, {\n values: Lt.createTypedArray(i, t, n, o * s),\n type: i,\n size: o,\n unpacker: a,\n packer: c\n };\n}\n\nconst Ft = e => e !== void 0;\n\nfunction em(e, t, n) {\n if (!t) return null;\n let s = e.getExtension(\"3DTILES_batch_table_hierarchy\");\n const r = t.HIERARCHY;\n return r && (console.warn(\"3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy.\"), t.extensions = t.extensions || {}, t.extensions[\"3DTILES_batch_table_hierarchy\"] = r, s = r), s ? nm(s, n) : null;\n}\n\nfunction nm(e, t) {\n let n, s, r;\n const i = e.instancesLength,\n o = e.classes;\n let a = e.classIds,\n c = e.parentCounts,\n u = e.parentIds,\n l = i;\n Ft(a.byteOffset) && (a.componentType = defaultValue(a.componentType, GL.UNSIGNED_SHORT), a.type = AttributeType.SCALAR, r = getBinaryAccessor(a), a = r.createArrayBufferView(t.buffer, t.byteOffset + a.byteOffset, i));\n let h;\n if (Ft(c)) for (Ft(c.byteOffset) && (c.componentType = defaultValue(c.componentType, GL.UNSIGNED_SHORT), c.type = AttributeType.SCALAR, r = getBinaryAccessor(c), c = r.createArrayBufferView(t.buffer, t.byteOffset + c.byteOffset, i)), h = new Uint16Array(i), l = 0, n = 0; n < i; ++n) h[n] = l, l += c[n];\n Ft(u) && Ft(u.byteOffset) && (u.componentType = defaultValue(u.componentType, GL.UNSIGNED_SHORT), u.type = AttributeType.SCALAR, r = getBinaryAccessor(u), u = r.createArrayBufferView(t.buffer, t.byteOffset + u.byteOffset, l));\n const f = o.length;\n\n for (n = 0; n < f; ++n) {\n const y = o[n].length,\n E = o[n].instances,\n R = getBinaryProperties(y, E, t);\n o[n].instances = combine(R, E);\n }\n\n const d = new Array(f).fill(0),\n m = new Uint16Array(i);\n\n for (n = 0; n < i; ++n) s = a[n], m[n] = d[s], ++d[s];\n\n const g = {\n classes: o,\n classIds: a,\n classIndexes: m,\n parentCounts: c,\n parentIndexes: h,\n parentIds: u\n };\n return im(g), g;\n}\n\nfunction Re(e, t, n) {\n if (!e) return;\n const s = e.parentCounts;\n return e.parentIds ? n(e, t) : s > 0 ? sm(e, t, n) : rm(e, t, n);\n}\n\nfunction sm(e, t, n) {\n const s = e.classIds,\n r = e.parentCounts,\n i = e.parentIds,\n o = e.parentIndexes,\n a = s.length,\n c = scratchVisited;\n c.length = Math.max(c.length, a);\n const u = ++marker,\n l = scratchStack;\n\n for (l.length = 0, l.push(t); l.length > 0;) {\n if (t = l.pop(), c[t] === u) continue;\n c[t] = u;\n const h = n(e, t);\n if (Ft(h)) return h;\n const f = r[t],\n d = o[t];\n\n for (let m = 0; m < f; ++m) {\n const g = i[d + m];\n g !== t && l.push(g);\n }\n }\n\n return null;\n}\n\nfunction rm(e, t, n) {\n let s = !0;\n\n for (; s;) {\n const r = n(e, t);\n if (Ft(r)) return r;\n const i = e.parentIds[t];\n s = i !== t, t = i;\n }\n\n throw new Error(\"traverseHierarchySingleParent\");\n}\n\nfunction im(e) {\n const n = e.classIds.length;\n\n for (let s = 0; s < n; ++s) La(e, s, stack);\n}\n\nfunction La(e, t, n) {\n const s = e.parentCounts,\n r = e.parentIds,\n i = e.parentIndexes,\n a = e.classIds.length;\n if (!Ft(r)) return;\n assert(t < a, `Parent index ${t} exceeds the total number of instances: ${a}`), assert(n.indexOf(t) === -1, \"Circular dependency detected in the batch table hierarchy.\"), n.push(t);\n const c = Ft(s) ? s[t] : 1,\n u = Ft(s) ? i[t] : t;\n\n for (let l = 0; l < c; ++l) {\n const h = r[u + l];\n h !== t && La(e, h, n);\n }\n\n n.pop(t);\n}\n\nfunction ut(e) {\n return e != null;\n}\n\nconst mn = (e, t) => e,\n om = {\n HIERARCHY: !0,\n extensions: !0,\n extras: !0\n};\n\nclass Pa {\n constructor(t, n, s) {\n var r;\n let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};\n this.json = void 0, this.binary = void 0, this.featureCount = void 0, this._extensions = void 0, this._properties = void 0, this._binaryProperties = void 0, this._hierarchy = void 0, z(s >= 0), this.json = t || {}, this.binary = n, this.featureCount = s, this._extensions = ((r = this.json) === null || r === void 0 ? void 0 : r.extensions) || {}, this._properties = {};\n\n for (const o in this.json) om[o] || (this._properties[o] = this.json[o]);\n\n this._binaryProperties = this._initializeBinaryProperties(), i[\"3DTILES_batch_table_hierarchy\"] && (this._hierarchy = em(this, this.json, this.binary));\n }\n\n getExtension(t) {\n return this.json && this.json.extensions && this.json.extensions[t];\n }\n\n memorySizeInBytes() {\n return 0;\n }\n\n isClass(t, n) {\n if (this._checkBatchId(t), z(typeof n == \"string\", n), this._hierarchy) {\n const s = Re(this._hierarchy, t, (r, i) => {\n const o = r.classIds[i];\n return r.classes[o].name === n;\n });\n return ut(s);\n }\n\n return !1;\n }\n\n isExactClass(t, n) {\n return z(typeof n == \"string\", n), this.getExactClassName(t) === n;\n }\n\n getExactClassName(t) {\n if (this._checkBatchId(t), this._hierarchy) {\n const n = this._hierarchy.classIds[t];\n return this._hierarchy.classes[n].name;\n }\n }\n\n hasProperty(t, n) {\n return this._checkBatchId(t), z(typeof n == \"string\", n), ut(this._properties[n]) || this._hasPropertyInHierarchy(t, n);\n }\n\n getPropertyNames(t, n) {\n this._checkBatchId(t), n = ut(n) ? n : [], n.length = 0;\n const s = Object.keys(this._properties);\n return n.push(...s), this._hierarchy && this._getPropertyNamesInHierarchy(t, n), n;\n }\n\n getProperty(t, n) {\n if (this._checkBatchId(t), z(typeof n == \"string\", n), this._binaryProperties) {\n const r = this._binaryProperties[n];\n if (ut(r)) return this._getBinaryProperty(r, t);\n }\n\n const s = this._properties[n];\n if (ut(s)) return mn(s[t]);\n\n if (this._hierarchy) {\n const r = this._getHierarchyProperty(t, n);\n\n if (ut(r)) return r;\n }\n }\n\n setProperty(t, n, s) {\n const r = this.featureCount;\n\n if (this._checkBatchId(t), z(typeof n == \"string\", n), this._binaryProperties) {\n const o = this._binaryProperties[n];\n\n if (o) {\n this._setBinaryProperty(o, t, s);\n\n return;\n }\n }\n\n if (this._hierarchy && this._setHierarchyProperty(this, t, n, s)) return;\n let i = this._properties[n];\n ut(i) || (this._properties[n] = new Array(r), i = this._properties[n]), i[t] = mn(s);\n }\n\n _checkBatchId(t) {\n if (!(t >= 0 && t < this.featureCount)) throw new Error(\"batchId not in range [0, featureCount - 1].\");\n }\n\n _getBinaryProperty(t, n) {\n return t.unpack(t.typedArray, n);\n }\n\n _setBinaryProperty(t, n, s) {\n t.pack(s, t.typedArray, n);\n }\n\n _initializeBinaryProperties() {\n let t = null;\n\n for (const n in this._properties) {\n const s = this._properties[n],\n r = this._initializeBinaryProperty(n, s);\n\n r && (t = t || {}, t[n] = r);\n }\n\n return t;\n }\n\n _initializeBinaryProperty(t, n) {\n if (\"byteOffset\" in n) {\n const s = n;\n z(this.binary, `Property ${t} requires a batch table binary.`), z(s.type, `Property ${t} requires a type.`);\n const r = tm(s, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount);\n return {\n typedArray: r.values,\n componentCount: r.size,\n unpack: r.unpacker,\n pack: r.packer\n };\n }\n\n return null;\n }\n\n _hasPropertyInHierarchy(t, n) {\n if (!this._hierarchy) return !1;\n const s = Re(this._hierarchy, t, (r, i) => {\n const o = r.classIds[i],\n a = r.classes[o].instances;\n return ut(a[n]);\n });\n return ut(s);\n }\n\n _getPropertyNamesInHierarchy(t, n) {\n Re(this._hierarchy, t, (s, r) => {\n const i = s.classIds[r],\n o = s.classes[i].instances;\n\n for (const a in o) o.hasOwnProperty(a) && n.indexOf(a) === -1 && n.push(a);\n });\n }\n\n _getHierarchyProperty(t, n) {\n return Re(this._hierarchy, t, (s, r) => {\n const i = s.classIds[r],\n o = s.classes[i],\n a = s.classIndexes[r],\n c = o.instances[n];\n return ut(c) ? ut(c.typedArray) ? this._getBinaryProperty(c, a) : mn(c[a]) : null;\n });\n }\n\n _setHierarchyProperty(t, n, s, r) {\n const i = Re(this._hierarchy, n, (o, a) => {\n const c = o.classIds[a],\n u = o.classes[c],\n l = o.classIndexes[a],\n h = u.instances[s];\n return ut(h) ? (z(a === n, `Inherited property \"${s}\" is read-only.`), ut(h.typedArray) ? this._setBinaryProperty(h, l, r) : h[l] = mn(r), !0) : !1;\n });\n return ut(i);\n }\n\n}\n\nconst Cs = 4;\n\nfunction qn(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;\n const s = new DataView(t);\n if (e.magic = s.getUint32(n, !0), n += Cs, e.version = s.getUint32(n, !0), n += Cs, e.byteLength = s.getUint32(n, !0), n += Cs, e.version !== 1) throw new Error(`3D Tile Version ${e.version} not supported`);\n return n;\n}\n\nconst le = 4,\n Di = \"b3dm tile in legacy format.\";\n\nfunction _r(e, t, n) {\n const s = new DataView(t);\n let r;\n e.header = e.header || {};\n let i = s.getUint32(n, !0);\n n += le;\n let o = s.getUint32(n, !0);\n n += le;\n let a = s.getUint32(n, !0);\n n += le;\n let c = s.getUint32(n, !0);\n return n += le, a >= 570425344 ? (n -= le * 2, r = i, a = o, c = 0, i = 0, o = 0, console.warn(Di)) : c >= 570425344 && (n -= le, r = a, a = i, c = o, i = 0, o = 0, console.warn(Di)), e.header.featureTableJsonByteLength = i, e.header.featureTableBinaryByteLength = o, e.header.batchTableJsonByteLength = a, e.header.batchTableBinaryByteLength = c, e.header.batchLength = r, n;\n}\n\nfunction wr(e, t, n, s) {\n return n = am(e, t, n), n = cm(e, t, n), n;\n}\n\nfunction am(e, t, n, s) {\n const {\n featureTableJsonByteLength: r,\n featureTableBinaryByteLength: i,\n batchLength: o\n } = e.header || {};\n\n if (e.featureTableJson = {\n BATCH_LENGTH: o || 0\n }, r && r > 0) {\n const a = Oa(t, n, r);\n e.featureTableJson = JSON.parse(a);\n }\n\n return n += r || 0, e.featureTableBinary = new Uint8Array(t, n, i), n += i || 0, n;\n}\n\nfunction cm(e, t, n, s) {\n const {\n batchTableJsonByteLength: r,\n batchTableBinaryByteLength: i\n } = e.header || {};\n\n if (r && r > 0) {\n const o = Oa(t, n, r);\n e.batchTableJson = JSON.parse(o), n += r, i && i > 0 && (e.batchTableBinary = new Uint8Array(t, n, i), e.batchTableBinary = new Uint8Array(e.batchTableBinary), n += i);\n }\n\n return n;\n}\n\nfunction Ga(e, t, n) {\n if (!t && (!e || !e.batchIds || !n)) return null;\n const {\n batchIds: s,\n isRGB565: r,\n pointCount: i = 0\n } = e;\n\n if (s && n) {\n const o = new Uint8ClampedArray(i * 3);\n\n for (let a = 0; a < i; a++) {\n const c = s[a],\n l = n.getProperty(c, \"dimensions\").map(h => h * 255);\n o[a * 3] = l[0], o[a * 3 + 1] = l[1], o[a * 3 + 2] = l[2];\n }\n\n return {\n type: G.UNSIGNED_BYTE,\n value: o,\n size: 3,\n normalized: !0\n };\n }\n\n if (t && r) {\n const o = new Uint8ClampedArray(i * 3);\n\n for (let a = 0; a < i; a++) {\n const c = Xd(t[a]);\n o[a * 3] = c[0], o[a * 3 + 1] = c[1], o[a * 3 + 2] = c[2];\n }\n\n return {\n type: G.UNSIGNED_BYTE,\n value: o,\n size: 3,\n normalized: !0\n };\n }\n\n return t && t.length === i * 3 ? {\n type: G.UNSIGNED_BYTE,\n value: t,\n size: 3,\n normalized: !0\n } : {\n type: G.UNSIGNED_BYTE,\n value: t || new Uint8ClampedArray(),\n size: 4,\n normalized: !0\n };\n}\n\nconst Li = new A();\n\nfunction um(e, t) {\n if (!t) return null;\n\n if (e.isOctEncoded16P) {\n const n = new Float32Array((e.pointsLength || 0) * 3);\n\n for (let s = 0; s < (e.pointsLength || 0); s++) qd(t[s * 2], t[s * 2 + 1], Li), Li.toArray(n, s * 3);\n\n return {\n type: G.FLOAT,\n size: 2,\n value: n\n };\n }\n\n return {\n type: G.FLOAT,\n size: 2,\n value: t\n };\n}\n\nfunction lm(e, t, n) {\n return e.isQuantized ? n[\"3d-tiles\"] && n[\"3d-tiles\"].decodeQuantizedPositions ? (e.isQuantized = !1, hm(e, t)) : {\n type: G.UNSIGNED_SHORT,\n value: t,\n size: 3,\n normalized: !0\n } : t;\n}\n\nfunction hm(e, t) {\n const n = new A(),\n s = new Float32Array(e.pointCount * 3);\n\n for (let r = 0; r < e.pointCount; r++) n.set(t[r * 3], t[r * 3 + 1], t[r * 3 + 2]).scale(1 / e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(s, r * 3);\n\n return s;\n}\n\nasync function fm(e, t, n, s, r) {\n n = qn(e, t, n), n = _r(e, t, n), n = wr(e, t, n), dm(e);\n const {\n featureTable: i,\n batchTable: o\n } = mm(e);\n return await Bm(e, i, o, s, r), gm(e, i, s), Am(e, i, o), pm(e, i), n;\n}\n\nfunction dm(e) {\n e.attributes = {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n }, e.isQuantized = !1, e.isTranslucent = !1, e.isRGB565 = !1, e.isOctEncoded16P = !1;\n}\n\nfunction mm(e) {\n const t = new br(e.featureTableJson, e.featureTableBinary),\n n = t.getGlobalProperty(\"POINTS_LENGTH\");\n if (!Number.isFinite(n)) throw new Error(\"POINTS_LENGTH must be defined\");\n t.featuresLength = n, e.featuresLength = n, e.pointsLength = n, e.pointCount = n, e.rtcCenter = t.getGlobalProperty(\"RTC_CENTER\", G.FLOAT, 3);\n const s = ym(e, t);\n return {\n featureTable: t,\n batchTable: s\n };\n}\n\nfunction gm(e, t, n) {\n if (e.attributes = e.attributes || {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n }, !e.attributes.positions) {\n if (t.hasProperty(\"POSITION\")) e.attributes.positions = t.getPropertyArray(\"POSITION\", G.FLOAT, 3);else if (t.hasProperty(\"POSITION_QUANTIZED\")) {\n const s = t.getPropertyArray(\"POSITION_QUANTIZED\", G.UNSIGNED_SHORT, 3);\n if (e.isQuantized = !0, e.quantizedRange = 65535, e.quantizedVolumeScale = t.getGlobalProperty(\"QUANTIZED_VOLUME_SCALE\", G.FLOAT, 3), !e.quantizedVolumeScale) throw new Error(\"QUANTIZED_VOLUME_SCALE must be defined for quantized positions.\");\n if (e.quantizedVolumeOffset = t.getGlobalProperty(\"QUANTIZED_VOLUME_OFFSET\", G.FLOAT, 3), !e.quantizedVolumeOffset) throw new Error(\"QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.\");\n e.attributes.positions = lm(e, s, n);\n }\n }\n\n if (!e.attributes.positions) throw new Error(\"Either POSITION or POSITION_QUANTIZED must be defined.\");\n}\n\nfunction Am(e, t, n) {\n if (e.attributes = e.attributes || {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n }, !e.attributes.colors) {\n let s = null;\n t.hasProperty(\"RGBA\") ? (s = t.getPropertyArray(\"RGBA\", G.UNSIGNED_BYTE, 4), e.isTranslucent = !0) : t.hasProperty(\"RGB\") ? s = t.getPropertyArray(\"RGB\", G.UNSIGNED_BYTE, 3) : t.hasProperty(\"RGB565\") && (s = t.getPropertyArray(\"RGB565\", G.UNSIGNED_SHORT, 1), e.isRGB565 = !0), e.attributes.colors = Ga(e, s, n);\n }\n\n t.hasProperty(\"CONSTANT_RGBA\") && (e.constantRGBA = t.getGlobalProperty(\"CONSTANT_RGBA\", G.UNSIGNED_BYTE, 4));\n}\n\nfunction pm(e, t) {\n if (e.attributes = e.attributes || {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n }, !e.attributes.normals) {\n let n = null;\n t.hasProperty(\"NORMAL\") ? n = t.getPropertyArray(\"NORMAL\", G.FLOAT, 3) : t.hasProperty(\"NORMAL_OCT16P\") && (n = t.getPropertyArray(\"NORMAL_OCT16P\", G.UNSIGNED_BYTE, 2), e.isOctEncoded16P = !0), e.attributes.normals = um(e, n);\n }\n}\n\nfunction ym(e, t) {\n let n = null;\n\n if (!e.batchIds && t.hasProperty(\"BATCH_ID\") && (e.batchIds = t.getPropertyArray(\"BATCH_ID\", G.UNSIGNED_SHORT, 1), e.batchIds)) {\n const s = t.getGlobalProperty(\"BATCH_LENGTH\");\n if (!s) throw new Error(\"Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.\");\n const {\n batchTableJson: r,\n batchTableBinary: i\n } = e;\n n = new Pa(r, i, s);\n }\n\n return n;\n}\n\nasync function Bm(e, t, n, s, r) {\n let i, o, a;\n const c = e.batchTableJson && e.batchTableJson.extensions && e.batchTableJson.extensions[\"3DTILES_draco_point_compression\"];\n c && (a = c.properties);\n const u = t.getExtension(\"3DTILES_draco_point_compression\");\n\n if (u) {\n o = u.properties;\n const h = u.byteOffset,\n f = u.byteLength;\n if (!o || !Number.isFinite(h) || !f) throw new Error(\"Draco properties, byteOffset, and byteLength must be defined\");\n i = (e.featureTableBinary || []).slice(h, h + f), e.hasPositions = Number.isFinite(o.POSITION), e.hasColors = Number.isFinite(o.RGB) || Number.isFinite(o.RGBA), e.hasNormals = Number.isFinite(o.NORMAL), e.hasBatchIds = Number.isFinite(o.BATCH_ID), e.isTranslucent = Number.isFinite(o.RGBA);\n }\n\n if (!i) return !0;\n const l = {\n buffer: i,\n properties: { ...o,\n ...a\n },\n featureTableProperties: o,\n batchTableProperties: a,\n dequantizeInShader: !1\n };\n return await Cm(e, l, s, r);\n}\n\nasync function Cm(e, t, n, s) {\n if (!s) return;\n const r = { ...n,\n draco: { ...(n == null ? void 0 : n.draco),\n extraAttributes: t.batchTableProperties || {}\n }\n };\n delete r[\"3d-tiles\"];\n const i = await Ke(t.buffer, Da, r, s),\n o = i.attributes.POSITION && i.attributes.POSITION.value,\n a = i.attributes.COLOR_0 && i.attributes.COLOR_0.value,\n c = i.attributes.NORMAL && i.attributes.NORMAL.value,\n u = i.attributes.BATCH_ID && i.attributes.BATCH_ID.value,\n l = o && i.attributes.POSITION.value.quantization,\n h = c && i.attributes.NORMAL.value.quantization;\n\n if (l) {\n const d = i.POSITION.data.quantization,\n m = d.range;\n e.quantizedVolumeScale = new A(m, m, m), e.quantizedVolumeOffset = new A(d.minValues), e.quantizedRange = (1 << d.quantizationBits) - 1, e.isQuantizedDraco = !0;\n }\n\n h && (e.octEncodedRange = (1 << i.NORMAL.data.quantization.quantizationBits) - 1, e.isOctEncodedDraco = !0);\n const f = {};\n if (t.batchTableProperties) for (const d of Object.keys(t.batchTableProperties)) i.attributes[d] && i.attributes[d].value && (f[d.toLowerCase()] = i.attributes[d].value);\n e.attributes = {\n positions: o,\n colors: Ga(e, a, void 0),\n normals: c,\n batchIds: u,\n ...f\n };\n}\n\nconst Em = \"4.1.1\";\nvar Es;\nconst Tm = (Es = globalThis.loaders) === null || Es === void 0 ? void 0 : Es.parseImageNode,\n Xs = typeof Image < \"u\",\n Qs = typeof ImageBitmap < \"u\",\n bm = !!Tm,\n qs = kn ? !0 : bm;\n\nfunction _m(e) {\n switch (e) {\n case \"auto\":\n return Qs || Xs || qs;\n\n case \"imagebitmap\":\n return Qs;\n\n case \"image\":\n return Xs;\n\n case \"data\":\n return qs;\n\n default:\n throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`);\n }\n}\n\nfunction wm() {\n if (Qs) return \"imagebitmap\";\n if (Xs) return \"image\";\n if (qs) return \"data\";\n throw new Error(\"Install '@loaders.gl/polyfills' to parse images under Node.js\");\n}\n\nfunction Rm(e) {\n const t = Mm(e);\n if (!t) throw new Error(\"Not an image\");\n return t;\n}\n\nfunction Na(e) {\n switch (Rm(e)) {\n case \"data\":\n return e;\n\n case \"image\":\n case \"imagebitmap\":\n const t = document.createElement(\"canvas\"),\n n = t.getContext(\"2d\");\n if (!n) throw new Error(\"getImageData\");\n return t.width = e.width, t.height = e.height, n.drawImage(e, 0, 0), n.getImageData(0, 0, e.width, e.height);\n\n default:\n throw new Error(\"getImageData\");\n }\n}\n\nfunction Mm(e) {\n return typeof ImageBitmap < \"u\" && e instanceof ImageBitmap ? \"imagebitmap\" : typeof Image < \"u\" && e instanceof Image ? \"image\" : e && typeof e == \"object\" && e.data && e.width && e.height ? \"data\" : null;\n}\n\nconst Sm = /^data:image\\/svg\\+xml/,\n Im = /\\.svg((\\?|#).*)?$/;\n\nfunction Rr(e) {\n return e && (Sm.test(e) || Im.test(e));\n}\n\nfunction xm(e, t) {\n if (Rr(t)) {\n let s = new TextDecoder().decode(e);\n\n try {\n typeof unescape == \"function\" && typeof encodeURIComponent == \"function\" && (s = unescape(encodeURIComponent(s)));\n } catch (i) {\n throw new Error(i.message);\n }\n\n return `data:image/svg+xml;base64,${btoa(s)}`;\n }\n\n return Ua(e, t);\n}\n\nfunction Ua(e, t) {\n if (Rr(t)) throw new Error(\"SVG cannot be parsed directly to imagebitmap\");\n return new Blob([new Uint8Array(e)]);\n}\n\nasync function Ha(e, t, n) {\n const s = xm(e, n),\n r = self.URL || self.webkitURL,\n i = typeof s != \"string\" && r.createObjectURL(s);\n\n try {\n return await vm(i || s, t);\n } finally {\n i && r.revokeObjectURL(i);\n }\n}\n\nasync function vm(e, t) {\n const n = new Image();\n return n.src = e, t.image && t.image.decode && n.decode ? (await n.decode(), n) : await new Promise((s, r) => {\n try {\n n.onload = () => s(n), n.onerror = i => {\n const o = i instanceof Error ? i.message : \"error\";\n r(new Error(o));\n };\n } catch (i) {\n r(i);\n }\n });\n}\n\nconst Om = {};\nlet Pi = !0;\n\nasync function Fm(e, t, n) {\n let s;\n Rr(n) ? s = await Ha(e, t, n) : s = Ua(e, n);\n const r = t && t.imagebitmap;\n return await Dm(s, r);\n}\n\nasync function Dm(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;\n if ((Lm(t) || !Pi) && (t = null), t) try {\n return await createImageBitmap(e, t);\n } catch (n) {\n console.warn(n), Pi = !1;\n }\n return await createImageBitmap(e);\n}\n\nfunction Lm(e) {\n for (const t in e || Om) return !1;\n\n return !0;\n}\n\nfunction Pm(e) {\n return !Hm(e, \"ftyp\", 4) || !(e[8] & 96) ? null : Gm(e);\n}\n\nfunction Gm(e) {\n switch (Nm(e, 8, 12).replace(\"\\0\", \" \").trim()) {\n case \"avif\":\n case \"avis\":\n return {\n extension: \"avif\",\n mimeType: \"image/avif\"\n };\n\n default:\n return null;\n }\n}\n\nfunction Nm(e, t, n) {\n return String.fromCharCode(...e.slice(t, n));\n}\n\nfunction Um(e) {\n return [...e].map(t => t.charCodeAt(0));\n}\n\nfunction Hm(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;\n const s = Um(t);\n\n for (let r = 0; r < s.length; ++r) if (s[r] !== e[r + n]) return !1;\n\n return !0;\n}\n\nconst Dt = !1,\n De = !0;\n\nfunction Mr(e) {\n const t = Ye(e);\n return Vm(t) || Km(t) || jm(t) || km(t) || Jm(t);\n}\n\nfunction Jm(e) {\n const t = new Uint8Array(e instanceof DataView ? e.buffer : e),\n n = Pm(t);\n return n ? {\n mimeType: n.mimeType,\n width: 0,\n height: 0\n } : null;\n}\n\nfunction Vm(e) {\n const t = Ye(e);\n return t.byteLength >= 24 && t.getUint32(0, Dt) === 2303741511 ? {\n mimeType: \"image/png\",\n width: t.getUint32(16, Dt),\n height: t.getUint32(20, Dt)\n } : null;\n}\n\nfunction jm(e) {\n const t = Ye(e);\n return t.byteLength >= 10 && t.getUint32(0, Dt) === 1195984440 ? {\n mimeType: \"image/gif\",\n width: t.getUint16(6, De),\n height: t.getUint16(8, De)\n } : null;\n}\n\nfunction km(e) {\n const t = Ye(e);\n return t.byteLength >= 14 && t.getUint16(0, Dt) === 16973 && t.getUint32(2, De) === t.byteLength ? {\n mimeType: \"image/bmp\",\n width: t.getUint32(18, De),\n height: t.getUint32(22, De)\n } : null;\n}\n\nfunction Km(e) {\n const t = Ye(e);\n if (!(t.byteLength >= 3 && t.getUint16(0, Dt) === 65496 && t.getUint8(2) === 255)) return null;\n const {\n tableMarkers: s,\n sofMarkers: r\n } = zm();\n let i = 2;\n\n for (; i + 9 < t.byteLength;) {\n const o = t.getUint16(i, Dt);\n if (r.has(o)) return {\n mimeType: \"image/jpeg\",\n height: t.getUint16(i + 5, Dt),\n width: t.getUint16(i + 7, Dt)\n };\n if (!s.has(o)) return null;\n i += 2, i += t.getUint16(i, Dt);\n }\n\n return null;\n}\n\nfunction zm() {\n const e = /* @__PURE__ */new Set([65499, 65476, 65484, 65501, 65534]);\n\n for (let n = 65504; n < 65520; ++n) e.add(n);\n\n return {\n tableMarkers: e,\n sofMarkers: /* @__PURE__ */new Set([65472, 65473, 65474, 65475, 65477, 65478, 65479, 65481, 65482, 65483, 65485, 65486, 65487, 65502])\n };\n}\n\nfunction Ye(e) {\n if (e instanceof DataView) return e;\n if (ArrayBuffer.isView(e)) return new DataView(e.buffer);\n if (e instanceof ArrayBuffer) return new DataView(e);\n throw new Error(\"toDataView\");\n}\n\nasync function Wm(e, t) {\n var n;\n const {\n mimeType: s\n } = Mr(e) || {},\n r = (n = globalThis.loaders) === null || n === void 0 ? void 0 : n.parseImageNode;\n return z(r), await r(e, s);\n}\n\nasync function Xm(e, t, n) {\n t = t || {};\n const r = (t.image || {}).type || \"auto\",\n {\n url: i\n } = n || {},\n o = Qm(r);\n let a;\n\n switch (o) {\n case \"imagebitmap\":\n a = await Fm(e, t, i);\n break;\n\n case \"image\":\n a = await Ha(e, t, i);\n break;\n\n case \"data\":\n a = await Wm(e);\n break;\n\n default:\n z(!1);\n }\n\n return r === \"data\" && (a = Na(a)), a;\n}\n\nfunction Qm(e) {\n switch (e) {\n case \"auto\":\n case \"data\":\n return wm();\n\n default:\n return _m(e), e;\n }\n}\n\nconst qm = [\"png\", \"jpg\", \"jpeg\", \"gif\", \"webp\", \"bmp\", \"ico\", \"svg\", \"avif\"],\n Ym = [\"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\", \"image/avif\", \"image/bmp\", \"image/vnd.microsoft.icon\", \"image/svg+xml\"],\n $m = {\n image: {\n type: \"auto\",\n decode: !0\n }\n},\n Zm = {\n id: \"image\",\n module: \"images\",\n name: \"Images\",\n version: Em,\n mimeTypes: Ym,\n extensions: qm,\n parse: Xm,\n tests: [e => !!Mr(new DataView(e))],\n options: $m\n},\n Ts = {};\n\nfunction tg(e) {\n if (Ts[e] === void 0) {\n const t = kn ? ng(e) : eg(e);\n Ts[e] = t;\n }\n\n return Ts[e];\n}\n\nfunction eg(e) {\n var t, n;\n const s = [\"image/png\", \"image/jpeg\", \"image/gif\"],\n r = ((t = globalThis.loaders) === null || t === void 0 ? void 0 : t.imageFormatsNode) || s;\n return !!((n = globalThis.loaders) === null || n === void 0 ? void 0 : n.parseImageNode) && r.includes(e);\n}\n\nfunction ng(e) {\n switch (e) {\n case \"image/avif\":\n case \"image/webp\":\n return sg(e);\n\n default:\n return !0;\n }\n}\n\nfunction sg(e) {\n try {\n return document.createElement(\"canvas\").toDataURL(e).indexOf(`data:${e}`) === 0;\n } catch {\n return !1;\n }\n}\n\nfunction yt(e, t) {\n if (!e) throw new Error(t || \"assert failed: gltf\");\n}\n\nconst Ja = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n},\n Va = {\n 5120: 1,\n 5121: 1,\n 5122: 2,\n 5123: 2,\n 5125: 4,\n 5126: 4\n},\n rg = 1.33,\n Gi = [\"SCALAR\", \"VEC2\", \"VEC3\", \"VEC4\"],\n ig = [[Int8Array, 5120], [Uint8Array, 5121], [Int16Array, 5122], [Uint16Array, 5123], [Uint32Array, 5125], [Float32Array, 5126], [Float64Array, 5130]],\n og = new Map(ig),\n ag = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n},\n cg = {\n 5120: 1,\n 5121: 1,\n 5122: 2,\n 5123: 2,\n 5125: 4,\n 5126: 4\n},\n ug = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array\n};\n\nfunction ja(e) {\n return Gi[e - 1] || Gi[0];\n}\n\nfunction Sr(e) {\n const t = og.get(e.constructor);\n if (!t) throw new Error(\"Illegal typed array\");\n return t;\n}\n\nfunction Ir(e, t) {\n const n = ug[e.componentType],\n s = ag[e.type],\n r = cg[e.componentType],\n i = e.count * s,\n o = e.count * s * r;\n yt(o >= 0 && o <= t.byteLength);\n const a = Va[e.componentType],\n c = Ja[e.type];\n return {\n ArrayType: n,\n length: i,\n byteLength: o,\n componentByteSize: a,\n numberOfComponentsInElement: c\n };\n}\n\nfunction ka(e) {\n let {\n images: t,\n bufferViews: n\n } = e;\n t = t || [], n = n || [];\n const s = t.map(o => o.bufferView);\n n = n.filter(o => !s.includes(o));\n const r = n.reduce((o, a) => o + a.byteLength, 0),\n i = t.reduce((o, a) => {\n const {\n width: c,\n height: u\n } = a.image;\n return o + c * u;\n }, 0);\n return r + Math.ceil(4 * i * rg);\n}\n\nfunction lg(e, t, n) {\n const s = e.bufferViews[n];\n yt(s);\n const r = s.buffer,\n i = t[r];\n yt(i);\n const o = (s.byteOffset || 0) + i.byteOffset;\n return new Uint8Array(i.arrayBuffer, o, s.byteLength);\n}\n\nfunction hg(e, t, n) {\n var s, r;\n const i = typeof n == \"number\" ? (s = e.accessors) === null || s === void 0 ? void 0 : s[n] : n;\n if (!i) throw new Error(`No gltf accessor ${JSON.stringify(n)}`);\n const o = (r = e.bufferViews) === null || r === void 0 ? void 0 : r[i.bufferView || 0];\n if (!o) throw new Error(`No gltf buffer view for accessor ${o}`);\n const {\n arrayBuffer: a,\n byteOffset: c\n } = t[o.buffer],\n u = (c || 0) + (i.byteOffset || 0) + (o.byteOffset || 0),\n {\n ArrayType: l,\n length: h,\n componentByteSize: f,\n numberOfComponentsInElement: d\n } = Ir(i, o),\n m = f * d,\n g = o.byteStride || m;\n if (typeof o.byteStride > \"u\" || o.byteStride === m) return new l(a, u, h);\n const y = new l(h);\n\n for (let E = 0; E < i.count; E++) {\n const R = new l(a, u + E * g, d);\n y.set(R, E * d);\n }\n\n return y;\n}\n\nfunction fg() {\n return {\n asset: {\n version: \"2.0\",\n generator: \"loaders.gl\"\n },\n buffers: [],\n extensions: {},\n extensionsRequired: [],\n extensionsUsed: []\n };\n}\n\nclass ot {\n constructor(t) {\n this.gltf = void 0, this.sourceBuffers = void 0, this.byteLength = void 0, this.gltf = {\n json: (t == null ? void 0 : t.json) || fg(),\n buffers: (t == null ? void 0 : t.buffers) || [],\n images: (t == null ? void 0 : t.images) || []\n }, this.sourceBuffers = [], this.byteLength = 0, this.gltf.buffers && this.gltf.buffers[0] && (this.byteLength = this.gltf.buffers[0].byteLength, this.sourceBuffers = [this.gltf.buffers[0]]);\n }\n\n get json() {\n return this.gltf.json;\n }\n\n getApplicationData(t) {\n return this.json[t];\n }\n\n getExtraData(t) {\n return (this.json.extras || {})[t];\n }\n\n hasExtension(t) {\n const n = this.getUsedExtensions().find(r => r === t),\n s = this.getRequiredExtensions().find(r => r === t);\n return typeof n == \"string\" || typeof s == \"string\";\n }\n\n getExtension(t) {\n const n = this.getUsedExtensions().find(r => r === t),\n s = this.json.extensions || {};\n return n ? s[t] : null;\n }\n\n getRequiredExtension(t) {\n return this.getRequiredExtensions().find(s => s === t) ? this.getExtension(t) : null;\n }\n\n getRequiredExtensions() {\n return this.json.extensionsRequired || [];\n }\n\n getUsedExtensions() {\n return this.json.extensionsUsed || [];\n }\n\n getRemovedExtensions() {\n return this.json.extensionsRemoved || [];\n }\n\n getObjectExtension(t, n) {\n return (t.extensions || {})[n];\n }\n\n getScene(t) {\n return this.getObject(\"scenes\", t);\n }\n\n getNode(t) {\n return this.getObject(\"nodes\", t);\n }\n\n getSkin(t) {\n return this.getObject(\"skins\", t);\n }\n\n getMesh(t) {\n return this.getObject(\"meshes\", t);\n }\n\n getMaterial(t) {\n return this.getObject(\"materials\", t);\n }\n\n getAccessor(t) {\n return this.getObject(\"accessors\", t);\n }\n\n getTexture(t) {\n return this.getObject(\"textures\", t);\n }\n\n getSampler(t) {\n return this.getObject(\"samplers\", t);\n }\n\n getImage(t) {\n return this.getObject(\"images\", t);\n }\n\n getBufferView(t) {\n return this.getObject(\"bufferViews\", t);\n }\n\n getBuffer(t) {\n return this.getObject(\"buffers\", t);\n }\n\n getObject(t, n) {\n if (typeof n == \"object\") return n;\n const s = this.json[t] && this.json[t][n];\n if (!s) throw new Error(`glTF file error: Could not find ${t}[${n}]`);\n return s;\n }\n\n getTypedArrayForBufferView(t) {\n t = this.getBufferView(t);\n const n = t.buffer,\n s = this.gltf.buffers[n];\n yt(s);\n const r = (t.byteOffset || 0) + s.byteOffset;\n return new Uint8Array(s.arrayBuffer, r, t.byteLength);\n }\n\n getTypedArrayForAccessor(t) {\n const n = this.getAccessor(t);\n return hg(this.gltf.json, this.gltf.buffers, n);\n }\n\n getTypedArrayForImageData(t) {\n t = this.getAccessor(t);\n const n = this.getBufferView(t.bufferView),\n r = this.getBuffer(n.buffer).data,\n i = n.byteOffset || 0;\n return new Uint8Array(r, i, n.byteLength);\n }\n\n addApplicationData(t, n) {\n return this.json[t] = n, this;\n }\n\n addExtraData(t, n) {\n return this.json.extras = this.json.extras || {}, this.json.extras[t] = n, this;\n }\n\n addObjectExtension(t, n, s) {\n return t.extensions = t.extensions || {}, t.extensions[n] = s, this.registerUsedExtension(n), this;\n }\n\n setObjectExtension(t, n, s) {\n const r = t.extensions || {};\n r[n] = s;\n }\n\n removeObjectExtension(t, n) {\n const s = (t == null ? void 0 : t.extensions) || {};\n\n if (s[n]) {\n this.json.extensionsRemoved = this.json.extensionsRemoved || [];\n const r = this.json.extensionsRemoved;\n r.includes(n) || r.push(n);\n }\n\n delete s[n];\n }\n\n addExtension(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n return yt(n), this.json.extensions = this.json.extensions || {}, this.json.extensions[t] = n, this.registerUsedExtension(t), n;\n }\n\n addRequiredExtension(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n return yt(n), this.addExtension(t, n), this.registerRequiredExtension(t), n;\n }\n\n registerUsedExtension(t) {\n this.json.extensionsUsed = this.json.extensionsUsed || [], this.json.extensionsUsed.find(n => n === t) || this.json.extensionsUsed.push(t);\n }\n\n registerRequiredExtension(t) {\n this.registerUsedExtension(t), this.json.extensionsRequired = this.json.extensionsRequired || [], this.json.extensionsRequired.find(n => n === t) || this.json.extensionsRequired.push(t);\n }\n\n removeExtension(t) {\n var n;\n\n if ((n = this.json.extensions) !== null && n !== void 0 && n[t]) {\n this.json.extensionsRemoved = this.json.extensionsRemoved || [];\n const s = this.json.extensionsRemoved;\n s.includes(t) || s.push(t);\n }\n\n this.json.extensions && delete this.json.extensions[t], this.json.extensionsRequired && this._removeStringFromArray(this.json.extensionsRequired, t), this.json.extensionsUsed && this._removeStringFromArray(this.json.extensionsUsed, t);\n }\n\n setDefaultScene(t) {\n this.json.scene = t;\n }\n\n addScene(t) {\n const {\n nodeIndices: n\n } = t;\n return this.json.scenes = this.json.scenes || [], this.json.scenes.push({\n nodes: n\n }), this.json.scenes.length - 1;\n }\n\n addNode(t) {\n const {\n meshIndex: n,\n matrix: s\n } = t;\n this.json.nodes = this.json.nodes || [];\n const r = {\n mesh: n\n };\n return s && (r.matrix = s), this.json.nodes.push(r), this.json.nodes.length - 1;\n }\n\n addMesh(t) {\n const {\n attributes: n,\n indices: s,\n material: r,\n mode: i = 4\n } = t,\n a = {\n primitives: [{\n attributes: this._addAttributes(n),\n mode: i\n }]\n };\n\n if (s) {\n const c = this._addIndices(s);\n\n a.primitives[0].indices = c;\n }\n\n return Number.isFinite(r) && (a.primitives[0].material = r), this.json.meshes = this.json.meshes || [], this.json.meshes.push(a), this.json.meshes.length - 1;\n }\n\n addPointCloud(t) {\n const s = {\n primitives: [{\n attributes: this._addAttributes(t),\n mode: 0\n }]\n };\n return this.json.meshes = this.json.meshes || [], this.json.meshes.push(s), this.json.meshes.length - 1;\n }\n\n addImage(t, n) {\n const s = Mr(t),\n r = n || (s == null ? void 0 : s.mimeType),\n o = {\n bufferView: this.addBufferView(t),\n mimeType: r\n };\n return this.json.images = this.json.images || [], this.json.images.push(o), this.json.images.length - 1;\n }\n\n addBufferView(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0,\n s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.byteLength;\n const r = t.byteLength;\n yt(Number.isFinite(r)), this.sourceBuffers = this.sourceBuffers || [], this.sourceBuffers.push(t);\n const i = {\n buffer: n,\n byteOffset: s,\n byteLength: r\n };\n return this.byteLength += ze(r, 4), this.json.bufferViews = this.json.bufferViews || [], this.json.bufferViews.push(i), this.json.bufferViews.length - 1;\n }\n\n addAccessor(t, n) {\n const s = {\n bufferView: t,\n type: ja(n.size),\n componentType: n.componentType,\n count: n.count,\n max: n.max,\n min: n.min\n };\n return this.json.accessors = this.json.accessors || [], this.json.accessors.push(s), this.json.accessors.length - 1;\n }\n\n addBinaryBuffer(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {\n size: 3\n };\n const s = this.addBufferView(t);\n let r = {\n min: n.min,\n max: n.max\n };\n (!r.min || !r.max) && (r = this._getAccessorMinMax(t, n.size));\n const i = {\n size: n.size,\n componentType: Sr(t),\n count: Math.round(t.length / n.size),\n min: r.min,\n max: r.max\n };\n return this.addAccessor(s, Object.assign(i, n));\n }\n\n addTexture(t) {\n const {\n imageIndex: n\n } = t,\n s = {\n source: n\n };\n return this.json.textures = this.json.textures || [], this.json.textures.push(s), this.json.textures.length - 1;\n }\n\n addMaterial(t) {\n return this.json.materials = this.json.materials || [], this.json.materials.push(t), this.json.materials.length - 1;\n }\n\n createBinaryChunk() {\n var t, n;\n this.gltf.buffers = [];\n const s = this.byteLength,\n r = new ArrayBuffer(s),\n i = new Uint8Array(r);\n let o = 0;\n\n for (const a of this.sourceBuffers || []) o = Nu(a, i, o);\n\n (t = this.json) !== null && t !== void 0 && (n = t.buffers) !== null && n !== void 0 && n[0] ? this.json.buffers[0].byteLength = s : this.json.buffers = [{\n byteLength: s\n }], this.gltf.binary = r, this.sourceBuffers = [r];\n }\n\n _removeStringFromArray(t, n) {\n let s = !0;\n\n for (; s;) {\n const r = t.indexOf(n);\n r > -1 ? t.splice(r, 1) : s = !1;\n }\n }\n\n _addAttributes() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n const n = {};\n\n for (const s in t) {\n const r = t[s],\n i = this._getGltfAttributeName(s),\n o = this.addBinaryBuffer(r.value, r);\n\n n[i] = o;\n }\n\n return n;\n }\n\n _addIndices(t) {\n return this.addBinaryBuffer(t, {\n size: 1\n });\n }\n\n _getGltfAttributeName(t) {\n switch (t.toLowerCase()) {\n case \"position\":\n case \"positions\":\n case \"vertices\":\n return \"POSITION\";\n\n case \"normal\":\n case \"normals\":\n return \"NORMAL\";\n\n case \"color\":\n case \"colors\":\n return \"COLOR_0\";\n\n case \"texcoord\":\n case \"texcoords\":\n return \"TEXCOORD_0\";\n\n default:\n return t;\n }\n }\n\n _getAccessorMinMax(t, n) {\n const s = {\n min: null,\n max: null\n };\n if (t.length < n) return s;\n s.min = [], s.max = [];\n const r = t.subarray(0, n);\n\n for (const i of r) s.min.push(i), s.max.push(i);\n\n for (let i = n; i < t.length; i += n) for (let o = 0; o < n; o++) s.min[0 + o] = Math.min(s.min[0 + o], t[i + o]), s.max[0 + o] = Math.max(s.max[0 + o], t[i + o]);\n\n return s;\n }\n\n}\n\nfunction Ni(e) {\n return (e % 1 + 1) % 1;\n}\n\nconst Ka = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16,\n BOOLEAN: 1,\n STRING: 1,\n ENUM: 1\n},\n dg = {\n INT8: Int8Array,\n UINT8: Uint8Array,\n INT16: Int16Array,\n UINT16: Uint16Array,\n INT32: Int32Array,\n UINT32: Uint32Array,\n INT64: BigInt64Array,\n UINT64: BigUint64Array,\n FLOAT32: Float32Array,\n FLOAT64: Float64Array\n},\n za = {\n INT8: 1,\n UINT8: 1,\n INT16: 2,\n UINT16: 2,\n INT32: 4,\n UINT32: 4,\n INT64: 8,\n UINT64: 8,\n FLOAT32: 4,\n FLOAT64: 8\n};\n\nfunction xr(e, t) {\n return za[t] * Ka[e];\n}\n\nfunction Yn(e, t, n, s) {\n if (n !== \"UINT8\" && n !== \"UINT16\" && n !== \"UINT32\" && n !== \"UINT64\") return null;\n const r = e.getTypedArrayForBufferView(t),\n i = $n(r, \"SCALAR\", n, s + 1);\n return i instanceof BigInt64Array || i instanceof BigUint64Array ? null : i;\n}\n\nfunction $n(e, t, n) {\n let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;\n const r = Ka[t],\n i = dg[n],\n o = za[n],\n a = s * r,\n c = a * o;\n let u = e.buffer,\n l = e.byteOffset;\n return l % o !== 0 && (u = new Uint8Array(u).slice(l, l + c).buffer, l = 0), new i(u, l, a);\n}\n\nfunction vr(e, t, n) {\n var s, r;\n const i = `TEXCOORD_${t.texCoord || 0}`,\n o = n.attributes[i],\n a = e.getTypedArrayForAccessor(o),\n c = e.gltf.json,\n u = t.index,\n l = (s = c.textures) === null || s === void 0 || (r = s[u]) === null || r === void 0 ? void 0 : r.source;\n\n if (typeof l < \"u\") {\n var h, f, d;\n const m = (h = c.images) === null || h === void 0 || (f = h[l]) === null || f === void 0 ? void 0 : f.mimeType,\n g = (d = e.gltf.images) === null || d === void 0 ? void 0 : d[l];\n\n if (g && typeof g.width < \"u\") {\n const y = [];\n\n for (let E = 0; E < a.length; E += 2) {\n const R = mg(g, m, a, E, t.channels);\n y.push(R);\n }\n\n return y;\n }\n }\n\n return [];\n}\n\nfunction Wa(e, t, n, s, r) {\n if (!(n != null && n.length)) return;\n const i = [];\n\n for (const l of n) {\n let h = s.findIndex(f => f === l);\n h === -1 && (h = s.push(l) - 1), i.push(h);\n }\n\n const o = new Uint32Array(i),\n a = e.gltf.buffers.push({\n arrayBuffer: o.buffer,\n byteOffset: o.byteOffset,\n byteLength: o.byteLength\n }) - 1,\n c = e.addBufferView(o, a, 0),\n u = e.addAccessor(c, {\n size: 1,\n componentType: Sr(o),\n count: o.length\n });\n r.attributes[t] = u;\n}\n\nfunction mg(e, t, n, s) {\n let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [0];\n const i = {\n r: {\n offset: 0,\n shift: 0\n },\n g: {\n offset: 1,\n shift: 8\n },\n b: {\n offset: 2,\n shift: 16\n },\n a: {\n offset: 3,\n shift: 24\n }\n },\n o = n[s],\n a = n[s + 1];\n let c = 1;\n t && (t.indexOf(\"image/jpeg\") !== -1 || t.indexOf(\"image/png\") !== -1) && (c = 4);\n const u = gg(o, a, e, c);\n let l = 0;\n\n for (const h of r) {\n const f = typeof h == \"number\" ? Object.values(i)[h] : i[h],\n d = u + f.offset,\n m = Na(e);\n if (m.data.length <= d) throw new Error(`${m.data.length} <= ${d}`);\n const g = m.data[d];\n l |= g << f.shift;\n }\n\n return l;\n}\n\nfunction gg(e, t, n) {\n let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;\n const r = n.width,\n i = Ni(e) * (r - 1),\n o = Math.round(i),\n a = n.height,\n c = Ni(t) * (a - 1),\n u = Math.round(c),\n l = n.components ? n.components : s;\n return (u * r + o) * l;\n}\n\nfunction Xa(e, t, n, s, r) {\n const i = [];\n\n for (let o = 0; o < t; o++) {\n const a = n[o],\n c = n[o + 1] - n[o];\n if (c + a > s) break;\n const u = a / r,\n l = c / r;\n i.push(e.slice(u, u + l));\n }\n\n return i;\n}\n\nfunction Qa(e, t, n) {\n const s = [];\n\n for (let r = 0; r < t; r++) {\n const i = r * n;\n s.push(e.slice(i, i + n));\n }\n\n return s;\n}\n\nfunction qa(e, t, n, s) {\n if (n) throw new Error(\"Not implemented - arrayOffsets for strings is specified\");\n\n if (s) {\n const r = [],\n i = new TextDecoder(\"utf8\");\n let o = 0;\n\n for (let a = 0; a < e; a++) {\n const c = s[a + 1] - s[a];\n\n if (c + o <= t.length) {\n const u = t.subarray(o, c + o),\n l = i.decode(u);\n r.push(l), o += c;\n }\n }\n\n return r;\n }\n\n return [];\n}\n\nconst Ya = \"EXT_mesh_features\",\n Ag = Ya;\n\nasync function pg(e, t) {\n const n = new ot(e);\n yg(n, t);\n}\n\nfunction yg(e, t) {\n const n = e.gltf.json;\n if (n.meshes) for (const s of n.meshes) for (const r of s.primitives) Bg(e, r, t);\n}\n\nfunction Bg(e, t, n) {\n var s, r;\n if (!(n != null && (s = n.gltf) !== null && s !== void 0 && s.loadBuffers)) return;\n const i = (r = t.extensions) === null || r === void 0 ? void 0 : r[Ya],\n o = i == null ? void 0 : i.featureIds;\n if (o) for (const c of o) {\n var a;\n let u;\n\n if (typeof c.attribute < \"u\") {\n const l = `_FEATURE_ID_${c.attribute}`,\n h = t.attributes[l];\n u = e.getTypedArrayForAccessor(h);\n } else typeof c.texture < \"u\" && n !== null && n !== void 0 && (a = n.gltf) !== null && a !== void 0 && a.loadImages ? u = vr(e, c.texture, t) : u = [];\n\n c.data = u;\n }\n}\n\nconst Cg = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n decode: pg,\n name: Ag\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n Or = \"EXT_structural_metadata\",\n Eg = Or;\n\nasync function Tg(e, t) {\n const n = new ot(e);\n bg(n, t);\n}\n\nfunction bg(e, t) {\n var n, s;\n if (!((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) return;\n const r = e.getExtension(Or);\n r && ((s = t.gltf) !== null && s !== void 0 && s.loadImages && _g(e, r), wg(e, r));\n}\n\nfunction _g(e, t) {\n const n = t.propertyTextures,\n s = e.gltf.json;\n if (n && s.meshes) for (const r of s.meshes) for (const i of r.primitives) Mg(e, n, i, t);\n}\n\nfunction wg(e, t) {\n const n = t.schema;\n if (!n) return;\n const s = n.classes,\n r = t.propertyTables;\n if (s && r) for (const i in s) {\n const o = Rg(r, i);\n o && Ig(e, n, o);\n }\n}\n\nfunction Rg(e, t) {\n for (const n of e) if (n.class === t) return n;\n\n return null;\n}\n\nfunction Mg(e, t, n, s) {\n var r;\n if (!t) return;\n const i = (r = n.extensions) === null || r === void 0 ? void 0 : r[Or],\n o = i == null ? void 0 : i.propertyTextures;\n if (o) for (const a of o) {\n const c = t[a];\n Sg(e, c, n, s);\n }\n}\n\nfunction Sg(e, t, n, s) {\n if (!t.properties) return;\n s.dataAttributeNames || (s.dataAttributeNames = []);\n const r = t.class;\n\n for (const o in t.properties) {\n var i;\n const a = `${r}_${o}`,\n c = (i = t.properties) === null || i === void 0 ? void 0 : i[o];\n if (!c) continue;\n c.data || (c.data = []);\n const u = c.data,\n l = vr(e, c, n);\n l !== null && (Wa(e, a, l, u, n), c.data = u, s.dataAttributeNames.push(a));\n }\n}\n\nfunction Ig(e, t, n) {\n var s;\n const r = (s = t.classes) === null || s === void 0 ? void 0 : s[n.class];\n if (!r) throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);\n const i = n.count;\n\n for (const a in r.properties) {\n var o;\n const c = r.properties[a],\n u = (o = n.properties) === null || o === void 0 ? void 0 : o[a];\n\n if (u) {\n const l = xg(e, t, c, i, u);\n u.data = l;\n }\n }\n}\n\nfunction xg(e, t, n, s, r) {\n let i = [];\n const o = r.values,\n a = e.getTypedArrayForBufferView(o),\n c = vg(e, n, r, s),\n u = Og(e, r, s);\n\n switch (n.type) {\n case \"SCALAR\":\n case \"VEC2\":\n case \"VEC3\":\n case \"VEC4\":\n case \"MAT2\":\n case \"MAT3\":\n case \"MAT4\":\n {\n i = Fg(n, s, a, c);\n break;\n }\n\n case \"BOOLEAN\":\n throw new Error(`Not implemented - classProperty.type=${n.type}`);\n\n case \"STRING\":\n {\n i = qa(s, a, c, u);\n break;\n }\n\n case \"ENUM\":\n {\n i = Dg(t, n, s, a, c);\n break;\n }\n\n default:\n throw new Error(`Unknown classProperty type ${n.type}`);\n }\n\n return i;\n}\n\nfunction vg(e, t, n, s) {\n return t.array && typeof t.count > \"u\" && typeof n.arrayOffsets < \"u\" ? Yn(e, n.arrayOffsets, n.arrayOffsetType || \"UINT32\", s) : null;\n}\n\nfunction Og(e, t, n) {\n return typeof t.stringOffsets < \"u\" ? Yn(e, t.stringOffsets, t.stringOffsetType || \"UINT32\", n) : null;\n}\n\nfunction Fg(e, t, n, s) {\n const r = e.array,\n i = e.count,\n o = xr(e.type, e.componentType),\n a = n.byteLength / o;\n let c;\n return e.componentType ? c = $n(n, e.type, e.componentType, a) : c = n, r ? s ? Xa(c, t, s, n.length, o) : i ? Qa(c, t, i) : [] : c;\n}\n\nfunction Dg(e, t, n, s, r) {\n var i;\n const o = t.enumType;\n if (!o) throw new Error(\"Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM\");\n const a = (i = e.enums) === null || i === void 0 ? void 0 : i[o];\n if (!a) throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);\n const c = a.valueType || \"UINT16\",\n u = xr(t.type, c),\n l = s.byteLength / u;\n let h = $n(s, t.type, c, l);\n\n if (h || (h = s), t.array) {\n if (r) return Lg({\n valuesData: h,\n numberOfElements: n,\n arrayOffsets: r,\n valuesDataBytesLength: s.length,\n elementSize: u,\n enumEntry: a\n });\n const f = t.count;\n return f ? Pg(h, n, f, a) : [];\n }\n\n return Fr(h, 0, n, a);\n}\n\nfunction Lg(e) {\n const {\n valuesData: t,\n numberOfElements: n,\n arrayOffsets: s,\n valuesDataBytesLength: r,\n elementSize: i,\n enumEntry: o\n } = e,\n a = [];\n\n for (let c = 0; c < n; c++) {\n const u = s[c],\n l = s[c + 1] - s[c];\n if (l + u > r) break;\n const h = u / i,\n f = l / i,\n d = Fr(t, h, f, o);\n a.push(d);\n }\n\n return a;\n}\n\nfunction Pg(e, t, n, s) {\n const r = [];\n\n for (let i = 0; i < t; i++) {\n const o = n * i,\n a = Fr(e, o, n, s);\n r.push(a);\n }\n\n return r;\n}\n\nfunction Fr(e, t, n, s) {\n const r = [];\n\n for (let i = 0; i < n; i++) if (e instanceof BigInt64Array || e instanceof BigUint64Array) r.push(\"\");else {\n const o = e[t + i],\n a = Gg(s, o);\n a ? r.push(a.name) : r.push(\"\");\n }\n\n return r;\n}\n\nfunction Gg(e, t) {\n for (const n of e.values) if (n.value === t) return n;\n\n return null;\n}\n\nconst Ng = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n decode: Tg,\n name: Eg\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n $a = \"EXT_feature_metadata\",\n Ug = $a;\n\nasync function Hg(e, t) {\n const n = new ot(e);\n Jg(n, t);\n}\n\nfunction Jg(e, t) {\n var n, s;\n if (!((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) return;\n const r = e.getExtension($a);\n r && ((s = t.gltf) !== null && s !== void 0 && s.loadImages && Vg(e, r), jg(e, r));\n}\n\nfunction Vg(e, t) {\n const n = t.schema;\n if (!n) return;\n const s = n.classes,\n {\n featureTextures: r\n } = t;\n if (s && r) for (const i in s) {\n const o = s[i],\n a = Kg(r, i);\n a && Wg(e, a, o);\n }\n}\n\nfunction jg(e, t) {\n const n = t.schema;\n if (!n) return;\n const s = n.classes,\n r = t.featureTables;\n if (s && r) for (const i in s) {\n const o = kg(r, i);\n o && zg(e, n, o);\n }\n}\n\nfunction kg(e, t) {\n for (const n in e) {\n const s = e[n];\n if (s.class === t) return s;\n }\n\n return null;\n}\n\nfunction Kg(e, t) {\n for (const n in e) {\n const s = e[n];\n if (s.class === t) return s;\n }\n\n return null;\n}\n\nfunction zg(e, t, n) {\n var s;\n if (!n.class) return;\n const r = (s = t.classes) === null || s === void 0 ? void 0 : s[n.class];\n if (!r) throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);\n const i = n.count;\n\n for (const a in r.properties) {\n var o;\n const c = r.properties[a],\n u = (o = n.properties) === null || o === void 0 ? void 0 : o[a];\n\n if (u) {\n const l = Xg(e, t, c, i, u);\n u.data = l;\n }\n }\n}\n\nfunction Wg(e, t, n) {\n const s = t.class;\n\n for (const i in n.properties) {\n var r;\n const o = t == null || (r = t.properties) === null || r === void 0 ? void 0 : r[i];\n\n if (o) {\n const a = Zg(e, o, s);\n o.data = a;\n }\n }\n}\n\nfunction Xg(e, t, n, s, r) {\n let i = [];\n const o = r.bufferView,\n a = e.getTypedArrayForBufferView(o),\n c = Qg(e, n, r, s),\n u = qg(e, n, r, s);\n return n.type === \"STRING\" || n.componentType === \"STRING\" ? i = qa(s, a, c, u) : Yg(n) && (i = $g(n, s, a, c)), i;\n}\n\nfunction Qg(e, t, n, s) {\n return t.type === \"ARRAY\" && typeof t.componentCount > \"u\" && typeof n.arrayOffsetBufferView < \"u\" ? Yn(e, n.arrayOffsetBufferView, n.offsetType || \"UINT32\", s) : null;\n}\n\nfunction qg(e, t, n, s) {\n return typeof n.stringOffsetBufferView < \"u\" ? Yn(e, n.stringOffsetBufferView, n.offsetType || \"UINT32\", s) : null;\n}\n\nfunction Yg(e) {\n const t = [\"UINT8\", \"INT16\", \"UINT16\", \"INT32\", \"UINT32\", \"INT64\", \"UINT64\", \"FLOAT32\", \"FLOAT64\"];\n return t.includes(e.type) || typeof e.componentType < \"u\" && t.includes(e.componentType);\n}\n\nfunction $g(e, t, n, s) {\n const r = e.type === \"ARRAY\",\n i = e.componentCount,\n o = \"SCALAR\",\n a = e.componentType || e.type,\n c = xr(o, a),\n u = n.byteLength / c,\n l = $n(n, o, a, u);\n return r ? s ? Xa(l, t, s, n.length, c) : i ? Qa(l, t, i) : [] : l;\n}\n\nfunction Zg(e, t, n) {\n const s = e.gltf.json;\n if (!s.meshes) return [];\n const r = [];\n\n for (const i of s.meshes) for (const o of i.primitives) t0(e, n, t, r, o);\n\n return r;\n}\n\nfunction t0(e, t, n, s, r) {\n const i = {\n channels: n.channels,\n ...n.texture\n },\n o = vr(e, i, r);\n o && Wa(e, t, o, s, r);\n}\n\nconst e0 = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n decode: Hg,\n name: Ug\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n n0 = \"4.1.1\",\n s0 = \"4.1.1\",\n Ln = {\n TRANSCODER: \"basis_transcoder.js\",\n TRANSCODER_WASM: \"basis_transcoder.wasm\",\n ENCODER: \"basis_encoder.js\",\n ENCODER_WASM: \"basis_encoder.wasm\"\n};\nlet bs;\n\nasync function Ui(e) {\n const t = e.modules || {};\n return t.basis ? t.basis : (bs = bs || r0(e), await bs);\n}\n\nasync function r0(e) {\n let t = null,\n n = null;\n return [t, n] = await Promise.all([await Zt(Ln.TRANSCODER, \"textures\", e), await Zt(Ln.TRANSCODER_WASM, \"textures\", e)]), t = t || globalThis.BASIS, await i0(t, n);\n}\n\nfunction i0(e, t) {\n const n = {};\n return t && (n.wasmBinary = t), new Promise(s => {\n e(n).then(r => {\n const {\n BasisFile: i,\n initializeBasis: o\n } = r;\n o(), s({\n BasisFile: i\n });\n });\n });\n}\n\nlet _s;\n\nasync function Hi(e) {\n const t = e.modules || {};\n return t.basisEncoder ? t.basisEncoder : (_s = _s || o0(e), await _s);\n}\n\nasync function o0(e) {\n let t = null,\n n = null;\n return [t, n] = await Promise.all([await Zt(Ln.ENCODER, \"textures\", e), await Zt(Ln.ENCODER_WASM, \"textures\", e)]), t = t || globalThis.BASIS, await a0(t, n);\n}\n\nfunction a0(e, t) {\n const n = {};\n return t && (n.wasmBinary = t), new Promise(s => {\n e(n).then(r => {\n const {\n BasisFile: i,\n KTX2File: o,\n initializeBasis: a,\n BasisEncoder: c\n } = r;\n a(), s({\n BasisFile: i,\n KTX2File: o,\n BasisEncoder: c\n });\n });\n });\n}\n\nconst he = {\n COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,\n COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,\n COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,\n COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,\n COMPRESSED_R11_EAC: 37488,\n COMPRESSED_SIGNED_R11_EAC: 37489,\n COMPRESSED_RG11_EAC: 37490,\n COMPRESSED_SIGNED_RG11_EAC: 37491,\n COMPRESSED_RGB8_ETC2: 37492,\n COMPRESSED_RGBA8_ETC2_EAC: 37493,\n COMPRESSED_SRGB8_ETC2: 37494,\n COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495,\n COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,\n COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,\n COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,\n COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,\n COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,\n COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,\n COMPRESSED_RGB_ETC1_WEBGL: 36196,\n COMPRESSED_RGB_ATC_WEBGL: 35986,\n COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,\n COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,\n COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,\n COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,\n COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,\n COMPRESSED_RGBA_ASTC_6X5_KHR: 37811,\n COMPRESSED_RGBA_ASTC_6X6_KHR: 37812,\n COMPRESSED_RGBA_ASTC_8X5_KHR: 37813,\n COMPRESSED_RGBA_ASTC_8X6_KHR: 37814,\n COMPRESSED_RGBA_ASTC_8X8_KHR: 37815,\n COMPRESSED_RGBA_ASTC_10X5_KHR: 37816,\n COMPRESSED_RGBA_ASTC_10X6_KHR: 37817,\n COMPRESSED_RGBA_ASTC_10X8_KHR: 37818,\n COMPRESSED_RGBA_ASTC_10X10_KHR: 37819,\n COMPRESSED_RGBA_ASTC_12X10_KHR: 37820,\n COMPRESSED_RGBA_ASTC_12X12_KHR: 37821,\n COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: 37840,\n COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: 37841,\n COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: 37842,\n COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: 37843,\n COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: 37844,\n COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: 37845,\n COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: 37846,\n COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: 37847,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: 37848,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: 37849,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: 37850,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,\n COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,\n COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,\n COMPRESSED_RED_RGTC1_EXT: 36283,\n COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,\n COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,\n COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,\n COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,\n COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,\n COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,\n COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919\n},\n c0 = [\"\", \"WEBKIT_\", \"MOZ_\"],\n Ji = {\n WEBGL_compressed_texture_s3tc: \"dxt\",\n WEBGL_compressed_texture_s3tc_srgb: \"dxt-srgb\",\n WEBGL_compressed_texture_etc1: \"etc1\",\n WEBGL_compressed_texture_etc: \"etc2\",\n WEBGL_compressed_texture_pvrtc: \"pvrtc\",\n WEBGL_compressed_texture_atc: \"atc\",\n WEBGL_compressed_texture_astc: \"astc\",\n EXT_texture_compression_rgtc: \"rgtc\"\n};\nlet gn = null;\n\nfunction u0(e) {\n if (!gn) {\n e = e || l0() || void 0, gn = /* @__PURE__ */new Set();\n\n for (const t of c0) for (const n in Ji) if (e && e.getExtension(`${t}${n}`)) {\n const s = Ji[n];\n gn.add(s);\n }\n }\n\n return gn;\n}\n\nfunction l0() {\n try {\n return document.createElement(\"canvas\").getContext(\"webgl\");\n } catch {\n return null;\n }\n}\n\nvar Vi, ji, ki, Ki, zi, Wi, Xi, Qi;\n(function (e) {\n e[e.NONE = 0] = \"NONE\", e[e.BASISLZ = 1] = \"BASISLZ\", e[e.ZSTD = 2] = \"ZSTD\", e[e.ZLIB = 3] = \"ZLIB\";\n})(Vi || (Vi = {})), function (e) {\n e[e.BASICFORMAT = 0] = \"BASICFORMAT\";\n}(ji || (ji = {})), function (e) {\n e[e.UNSPECIFIED = 0] = \"UNSPECIFIED\", e[e.ETC1S = 163] = \"ETC1S\", e[e.UASTC = 166] = \"UASTC\";\n}(ki || (ki = {})), function (e) {\n e[e.UNSPECIFIED = 0] = \"UNSPECIFIED\", e[e.SRGB = 1] = \"SRGB\";\n}(Ki || (Ki = {})), function (e) {\n e[e.UNSPECIFIED = 0] = \"UNSPECIFIED\", e[e.LINEAR = 1] = \"LINEAR\", e[e.SRGB = 2] = \"SRGB\", e[e.ITU = 3] = \"ITU\", e[e.NTSC = 4] = \"NTSC\", e[e.SLOG = 5] = \"SLOG\", e[e.SLOG2 = 6] = \"SLOG2\";\n}(zi || (zi = {})), function (e) {\n e[e.ALPHA_STRAIGHT = 0] = \"ALPHA_STRAIGHT\", e[e.ALPHA_PREMULTIPLIED = 1] = \"ALPHA_PREMULTIPLIED\";\n}(Wi || (Wi = {})), function (e) {\n e[e.RGB = 0] = \"RGB\", e[e.RRR = 3] = \"RRR\", e[e.GGG = 4] = \"GGG\", e[e.AAA = 15] = \"AAA\";\n}(Xi || (Xi = {})), function (e) {\n e[e.RGB = 0] = \"RGB\", e[e.RGBA = 3] = \"RGBA\", e[e.RRR = 4] = \"RRR\", e[e.RRRG = 5] = \"RRRG\";\n}(Qi || (Qi = {}));\nconst gt = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];\n\nfunction h0(e) {\n const t = new Uint8Array(e);\n return !(t.byteLength < gt.length || t[0] !== gt[0] || t[1] !== gt[1] || t[2] !== gt[2] || t[3] !== gt[3] || t[4] !== gt[4] || t[5] !== gt[5] || t[6] !== gt[6] || t[7] !== gt[7] || t[8] !== gt[8] || t[9] !== gt[9] || t[10] !== gt[10] || t[11] !== gt[11]);\n}\n\nconst f0 = {\n etc1: {\n basisFormat: 0,\n compressed: !0,\n format: he.COMPRESSED_RGB_ETC1_WEBGL\n },\n etc2: {\n basisFormat: 1,\n compressed: !0\n },\n bc1: {\n basisFormat: 2,\n compressed: !0,\n format: he.COMPRESSED_RGB_S3TC_DXT1_EXT\n },\n bc3: {\n basisFormat: 3,\n compressed: !0,\n format: he.COMPRESSED_RGBA_S3TC_DXT5_EXT\n },\n bc4: {\n basisFormat: 4,\n compressed: !0\n },\n bc5: {\n basisFormat: 5,\n compressed: !0\n },\n \"bc7-m6-opaque-only\": {\n basisFormat: 6,\n compressed: !0\n },\n \"bc7-m5\": {\n basisFormat: 7,\n compressed: !0\n },\n \"pvrtc1-4-rgb\": {\n basisFormat: 8,\n compressed: !0,\n format: he.COMPRESSED_RGB_PVRTC_4BPPV1_IMG\n },\n \"pvrtc1-4-rgba\": {\n basisFormat: 9,\n compressed: !0,\n format: he.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG\n },\n \"astc-4x4\": {\n basisFormat: 10,\n compressed: !0,\n format: he.COMPRESSED_RGBA_ASTC_4X4_KHR\n },\n \"atc-rgb\": {\n basisFormat: 11,\n compressed: !0\n },\n \"atc-rgba-interpolated-alpha\": {\n basisFormat: 12,\n compressed: !0\n },\n rgba32: {\n basisFormat: 13,\n compressed: !1\n },\n rgb565: {\n basisFormat: 14,\n compressed: !1\n },\n bgr565: {\n basisFormat: 15,\n compressed: !1\n },\n rgba4444: {\n basisFormat: 16,\n compressed: !1\n }\n};\n\nasync function d0(e, t) {\n if (t.basis.containerFormat === \"auto\") {\n if (h0(e)) {\n const s = await Hi(t);\n return qi(s.KTX2File, e, t);\n }\n\n const {\n BasisFile: n\n } = await Ui(t);\n return ws(n, e, t);\n }\n\n switch (t.basis.module) {\n case \"encoder\":\n const n = await Hi(t);\n\n switch (t.basis.containerFormat) {\n case \"ktx2\":\n return qi(n.KTX2File, e, t);\n\n case \"basis\":\n default:\n return ws(n.BasisFile, e, t);\n }\n\n case \"transcoder\":\n default:\n const {\n BasisFile: s\n } = await Ui(t);\n return ws(s, e, t);\n }\n}\n\nfunction ws(e, t, n) {\n const s = new e(new Uint8Array(t));\n\n try {\n if (!s.startTranscoding()) throw new Error(\"Failed to start basis transcoding\");\n const r = s.getNumImages(),\n i = [];\n\n for (let o = 0; o < r; o++) {\n const a = s.getNumLevels(o),\n c = [];\n\n for (let u = 0; u < a; u++) c.push(m0(s, o, u, n));\n\n i.push(c);\n }\n\n return i;\n } finally {\n s.close(), s.delete();\n }\n}\n\nfunction m0(e, t, n, s) {\n const r = e.getImageWidth(t, n),\n i = e.getImageHeight(t, n),\n o = e.getHasAlpha(),\n {\n compressed: a,\n format: c,\n basisFormat: u\n } = Za(s, o),\n l = e.getImageTranscodedSizeInBytes(t, n, u),\n h = new Uint8Array(l);\n if (!e.transcodeImage(h, t, n, u, 0, 0)) throw new Error(\"failed to start Basis transcoding\");\n return {\n width: r,\n height: i,\n data: h,\n compressed: a,\n format: c,\n hasAlpha: o\n };\n}\n\nfunction qi(e, t, n) {\n const s = new e(new Uint8Array(t));\n\n try {\n if (!s.startTranscoding()) throw new Error(\"failed to start KTX2 transcoding\");\n const r = s.getLevels(),\n i = [];\n\n for (let o = 0; o < r; o++) {\n i.push(g0(s, o, n));\n break;\n }\n\n return [i];\n } finally {\n s.close(), s.delete();\n }\n}\n\nfunction g0(e, t, n) {\n const {\n alphaFlag: s,\n height: r,\n width: i\n } = e.getImageLevelInfo(t, 0, 0),\n {\n compressed: o,\n format: a,\n basisFormat: c\n } = Za(n, s),\n u = e.getImageTranscodedSizeInBytes(t, 0, 0, c),\n l = new Uint8Array(u);\n if (!e.transcodeImage(l, t, 0, 0, c, 0, -1, -1)) throw new Error(\"Failed to transcode KTX2 image\");\n return {\n width: i,\n height: r,\n data: l,\n compressed: o,\n levelSize: u,\n hasAlpha: s,\n format: a\n };\n}\n\nfunction Za(e, t) {\n let n = e && e.basis && e.basis.format;\n return n === \"auto\" && (n = tc()), typeof n == \"object\" && (n = t ? n.alpha : n.noAlpha), n = n.toLowerCase(), f0[n];\n}\n\nfunction tc() {\n const e = u0();\n return e.has(\"astc\") ? \"astc-4x4\" : e.has(\"dxt\") ? {\n alpha: \"bc3\",\n noAlpha: \"bc1\"\n } : e.has(\"pvrtc\") ? {\n alpha: \"pvrtc1-4-rgba\",\n noAlpha: \"pvrtc1-4-rgb\"\n } : e.has(\"etc1\") ? \"etc1\" : e.has(\"etc2\") ? \"etc2\" : \"rgb565\";\n}\n\nconst A0 = {\n name: \"Basis\",\n id: \"basis\",\n module: \"textures\",\n version: s0,\n worker: !0,\n extensions: [\"basis\", \"ktx2\"],\n mimeTypes: [\"application/octet-stream\", \"image/ktx2\"],\n tests: [\"sB\"],\n binary: !0,\n options: {\n basis: {\n format: \"auto\",\n libraryPath: \"libs/\",\n containerFormat: \"auto\",\n module: \"transcoder\"\n }\n }\n},\n p0 = { ...A0,\n parse: d0\n},\n pe = !0,\n Yi = 1735152710,\n Dr = 12,\n Pn = 8,\n y0 = 1313821514,\n B0 = 5130562,\n C0 = 0,\n E0 = 0,\n T0 = 1;\n\nfunction b0(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;\n return `${String.fromCharCode(e.getUint8(t + 0))}${String.fromCharCode(e.getUint8(t + 1))}${String.fromCharCode(e.getUint8(t + 2))}${String.fromCharCode(e.getUint8(t + 3))}`;\n}\n\nfunction _0(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0,\n n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};\n const s = new DataView(e),\n {\n magic: r = Yi\n } = n,\n i = s.getUint32(t, !1);\n return i === r || i === Yi;\n}\n\nfunction w0(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;\n const s = new DataView(t),\n r = b0(s, n + 0),\n i = s.getUint32(n + 4, pe),\n o = s.getUint32(n + 8, pe);\n\n switch (Object.assign(e, {\n header: {\n byteOffset: n,\n byteLength: o,\n hasBinChunk: !1\n },\n type: r,\n version: i,\n json: {},\n binChunks: []\n }), n += Dr, e.version) {\n case 1:\n return R0(e, s, n);\n\n case 2:\n return M0(e, s, n, {});\n\n default:\n throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`);\n }\n}\n\nfunction R0(e, t, n) {\n z(e.header.byteLength > Dr + Pn);\n const s = t.getUint32(n + 0, pe),\n r = t.getUint32(n + 4, pe);\n return n += Pn, z(r === C0), Ys(e, t, n, s), n += s, n += $s(e, t, n, e.header.byteLength), n;\n}\n\nfunction M0(e, t, n, s) {\n return z(e.header.byteLength > Dr + Pn), S0(e, t, n, s), n + e.header.byteLength;\n}\n\nfunction S0(e, t, n, s) {\n for (; n + 8 <= e.header.byteLength;) {\n const r = t.getUint32(n + 0, pe),\n i = t.getUint32(n + 4, pe);\n\n switch (n += Pn, i) {\n case y0:\n Ys(e, t, n, r);\n break;\n\n case B0:\n $s(e, t, n, r);\n break;\n\n case E0:\n s.strict || Ys(e, t, n, r);\n break;\n\n case T0:\n s.strict || $s(e, t, n, r);\n break;\n }\n\n n += ze(r, 4);\n }\n\n return n;\n}\n\nfunction Ys(e, t, n, s) {\n const r = new Uint8Array(t.buffer, n, s),\n o = new TextDecoder(\"utf8\").decode(r);\n return e.json = JSON.parse(o), ze(s, 4);\n}\n\nfunction $s(e, t, n, s) {\n return e.header.hasBinChunk = !0, e.binChunks.push({\n byteOffset: n,\n byteLength: s,\n arrayBuffer: t.buffer\n }), ze(s, 4);\n}\n\nfunction ec(e, t) {\n if (e.startsWith(\"data:\") || e.startsWith(\"http:\") || e.startsWith(\"https:\")) return e;\n const s = t.baseUri || t.uri;\n if (!s) throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);\n return s.substr(0, s.lastIndexOf(\"/\") + 1) + e;\n}\n\nconst I0 = \"B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB\",\n x0 = \"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\",\n v0 = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11]),\n O0 = new Uint8Array([32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113, 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101, 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167]),\n F0 = {\n 0: \"\",\n 1: \"meshopt_decodeFilterOct\",\n 2: \"meshopt_decodeFilterQuat\",\n 3: \"meshopt_decodeFilterExp\",\n NONE: \"\",\n OCTAHEDRAL: \"meshopt_decodeFilterOct\",\n QUATERNION: \"meshopt_decodeFilterQuat\",\n EXPONENTIAL: \"meshopt_decodeFilterExp\"\n},\n D0 = {\n 0: \"meshopt_decodeVertexBuffer\",\n 1: \"meshopt_decodeIndexBuffer\",\n 2: \"meshopt_decodeIndexSequence\",\n ATTRIBUTES: \"meshopt_decodeVertexBuffer\",\n TRIANGLES: \"meshopt_decodeIndexBuffer\",\n INDICES: \"meshopt_decodeIndexSequence\"\n};\n\nasync function L0(e, t, n, s, r) {\n let i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : \"NONE\";\n const o = await P0();\n U0(o, o.exports[D0[r]], e, t, n, s, o.exports[F0[i || \"NONE\"]]);\n}\n\nlet Rs;\n\nasync function P0() {\n return Rs || (Rs = G0()), Rs;\n}\n\nasync function G0() {\n let e = I0;\n WebAssembly.validate(v0) && (e = x0, console.log(\"Warning: meshopt_decoder is using experimental SIMD support\"));\n const t = await WebAssembly.instantiate(N0(e), {});\n return await t.instance.exports.__wasm_call_ctors(), t.instance;\n}\n\nfunction N0(e) {\n const t = new Uint8Array(e.length);\n\n for (let s = 0; s < e.length; ++s) {\n const r = e.charCodeAt(s);\n t[s] = r > 96 ? r - 71 : r > 64 ? r - 65 : r > 47 ? r + 4 : r > 46 ? 63 : 62;\n }\n\n let n = 0;\n\n for (let s = 0; s < e.length; ++s) t[n++] = t[s] < 60 ? O0[t[s]] : (t[s] - 60) * 64 + t[++s];\n\n return t.buffer.slice(0, n);\n}\n\nfunction U0(e, t, n, s, r, i, o) {\n const a = e.exports.sbrk,\n c = s + 3 & -4,\n u = a(c * r),\n l = a(i.length),\n h = new Uint8Array(e.exports.memory.buffer);\n h.set(i, l);\n const f = t(u, s, r, l, i.length);\n if (f === 0 && o && o(u, c, r), n.set(h.subarray(u, u + s * r)), a(u - a(0)), f !== 0) throw new Error(`Malformed buffer data: ${f}`);\n}\n\nconst Gn = \"EXT_meshopt_compression\",\n H0 = Gn;\n\nasync function J0(e, t) {\n var n, s;\n const r = new ot(e);\n if (!(t != null && (n = t.gltf) !== null && n !== void 0 && n.decompressMeshes) || !((s = t.gltf) !== null && s !== void 0 && s.loadBuffers)) return;\n const i = [];\n\n for (const o of e.json.bufferViews || []) i.push(V0(r, o));\n\n await Promise.all(i), r.removeExtension(Gn);\n}\n\nasync function V0(e, t) {\n const n = e.getObjectExtension(t, Gn);\n\n if (n) {\n const {\n byteOffset: s = 0,\n byteLength: r = 0,\n byteStride: i,\n count: o,\n mode: a,\n filter: c = \"NONE\",\n buffer: u\n } = n,\n l = e.gltf.buffers[u],\n h = new Uint8Array(l.arrayBuffer, l.byteOffset + s, r),\n f = new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer, t.byteOffset, t.byteLength);\n await L0(f, o, i, h, a, c), e.removeObjectExtension(t, Gn);\n }\n}\n\nconst j0 = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n decode: J0,\n name: H0\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n fe = \"EXT_texture_webp\",\n k0 = fe;\n\nfunction K0(e, t) {\n const n = new ot(e);\n\n if (!tg(\"image/webp\")) {\n if (n.getRequiredExtensions().includes(fe)) throw new Error(`gltf: Required extension ${fe} not supported by browser`);\n return;\n }\n\n const {\n json: s\n } = n;\n\n for (const r of s.textures || []) {\n const i = n.getObjectExtension(r, fe);\n i && (r.source = i.source), n.removeObjectExtension(r, fe);\n }\n\n n.removeExtension(fe);\n}\n\nconst z0 = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n name: k0,\n preprocess: K0\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n _n = \"KHR_texture_basisu\",\n W0 = _n;\n\nfunction X0(e, t) {\n const n = new ot(e),\n {\n json: s\n } = n;\n\n for (const r of s.textures || []) {\n const i = n.getObjectExtension(r, _n);\n i && (r.source = i.source, n.removeObjectExtension(r, _n));\n }\n\n n.removeExtension(_n);\n}\n\nconst Q0 = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n name: W0,\n preprocess: X0\n}, Symbol.toStringTag, {\n value: \"Module\"\n}));\n\nfunction q0(e) {\n const t = {};\n\n for (const n in e) {\n const s = e[n];\n\n if (n !== \"indices\") {\n const r = nc(s);\n t[n] = r;\n }\n }\n\n return t;\n}\n\nfunction nc(e) {\n const {\n buffer: t,\n size: n,\n count: s\n } = Y0(e);\n return {\n value: t,\n size: n,\n byteOffset: 0,\n count: s,\n type: ja(n),\n componentType: Sr(t)\n };\n}\n\nfunction Y0(e) {\n let t = e,\n n = 1,\n s = 0;\n return e && e.value && (t = e.value, n = e.size || 1), t && (ArrayBuffer.isView(t) || (t = $0(t, Float32Array)), s = t.length / n), {\n buffer: t,\n size: n,\n count: s\n };\n}\n\nfunction $0(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;\n return e ? Array.isArray(e) ? new t(e) : n && !(e instanceof t) ? new t(e) : e : null;\n}\n\nconst zt = \"KHR_draco_mesh_compression\",\n Z0 = zt;\n\nfunction tA(e, t, n) {\n const s = new ot(e);\n\n for (const r of sc(s)) s.getObjectExtension(r, zt);\n}\n\nasync function eA(e, t, n) {\n var s;\n if (!(t != null && (s = t.gltf) !== null && s !== void 0 && s.decompressMeshes)) return;\n const r = new ot(e),\n i = [];\n\n for (const o of sc(r)) r.getObjectExtension(o, zt) && i.push(sA(r, o, t, n));\n\n await Promise.all(i), r.removeExtension(zt);\n}\n\nfunction nA(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n const n = new ot(e);\n\n for (const s of n.json.meshes || []) rA(s, t), n.addRequiredExtension(zt);\n}\n\nasync function sA(e, t, n, s) {\n const r = e.getObjectExtension(t, zt);\n if (!r) return;\n const i = e.getTypedArrayForBufferView(r.bufferView),\n o = dr(i.buffer, i.byteOffset),\n a = { ...n\n };\n delete a[\"3d-tiles\"];\n const c = await Ke(o, Da, a, s),\n u = q0(c.attributes);\n\n for (const [l, h] of Object.entries(u)) if (l in t.attributes) {\n const f = t.attributes[l],\n d = e.getAccessor(f);\n d != null && d.min && d !== null && d !== void 0 && d.max && (h.min = d.min, h.max = d.max);\n }\n\n t.attributes = u, c.indices && (t.indices = nc(c.indices)), e.removeObjectExtension(t, zt), iA(t);\n}\n\nfunction rA(e, t) {\n var n;\n let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 4,\n r = arguments.length > 3 ? arguments[3] : void 0,\n i = arguments.length > 4 ? arguments[4] : void 0;\n if (!r.DracoWriter) throw new Error(\"options.gltf.DracoWriter not provided\");\n\n const o = r.DracoWriter.encodeSync({\n attributes: e\n }),\n a = i == null || (n = i.parseSync) === null || n === void 0 ? void 0 : n.call(i, {\n attributes: e\n }),\n c = r._addFauxAttributes(a.attributes),\n u = r.addBufferView(o);\n\n return {\n primitives: [{\n attributes: c,\n mode: s,\n extensions: {\n [zt]: {\n bufferView: u,\n attributes: c\n }\n }\n }]\n };\n}\n\nfunction iA(e) {\n if (!e.attributes && Object.keys(e.attributes).length > 0) throw new Error(\"glTF: Empty primitive detected: Draco decompression failure?\");\n}\n\nfunction* sc(e) {\n for (const t of e.json.meshes || []) for (const n of t.primitives) yield n;\n}\n\nconst oA = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n decode: eA,\n encode: nA,\n name: Z0,\n preprocess: tA\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n Lr = \"KHR_texture_transform\",\n aA = Lr,\n An = new A(),\n cA = new X(),\n uA = new X();\n\nasync function lA(e, t) {\n var n;\n if (!new ot(e).hasExtension(Lr) || !((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) return;\n const i = e.json.materials || [];\n\n for (let o = 0; o < i.length; o++) hA(o, e);\n}\n\nfunction hA(e, t) {\n var n, s, r;\n const i = [],\n o = (n = t.json.materials) === null || n === void 0 ? void 0 : n[e],\n a = o == null || (s = o.pbrMetallicRoughness) === null || s === void 0 ? void 0 : s.baseColorTexture;\n a && Me(t, e, a, i);\n const c = o == null ? void 0 : o.emissiveTexture;\n c && Me(t, e, c, i);\n const u = o == null ? void 0 : o.normalTexture;\n u && Me(t, e, u, i);\n const l = o == null ? void 0 : o.occlusionTexture;\n l && Me(t, e, l, i);\n const h = o == null || (r = o.pbrMetallicRoughness) === null || r === void 0 ? void 0 : r.metallicRoughnessTexture;\n h && Me(t, e, h, i);\n}\n\nfunction Me(e, t, n, s) {\n const r = fA(n, s);\n if (!r) return;\n const i = e.json.meshes || [];\n\n for (const o of i) for (const a of o.primitives) {\n const c = a.material;\n Number.isFinite(c) && t === c && dA(e, a, r);\n }\n}\n\nfunction fA(e, t) {\n var n;\n const s = (n = e.extensions) === null || n === void 0 ? void 0 : n[Lr],\n {\n texCoord: r = 0\n } = e,\n {\n texCoord: i = r\n } = s;\n\n if (!(t.findIndex(a => {\n let [c, u] = a;\n return c === r && u === i;\n }) !== -1)) {\n const a = AA(s);\n return r !== i && (e.texCoord = i), t.push([r, i]), {\n originalTexCoord: r,\n texCoord: i,\n matrix: a\n };\n }\n\n return null;\n}\n\nfunction dA(e, t, n) {\n const {\n originalTexCoord: s,\n texCoord: r,\n matrix: i\n } = n,\n o = t.attributes[`TEXCOORD_${s}`];\n\n if (Number.isFinite(o)) {\n var a;\n const u = (a = e.json.accessors) === null || a === void 0 ? void 0 : a[o];\n\n if (u && u.bufferView) {\n var c;\n const l = (c = e.json.bufferViews) === null || c === void 0 ? void 0 : c[u.bufferView];\n\n if (l) {\n const {\n arrayBuffer: h,\n byteOffset: f\n } = e.buffers[l.buffer],\n d = (f || 0) + (u.byteOffset || 0) + (l.byteOffset || 0),\n {\n ArrayType: m,\n length: g\n } = Ir(u, l),\n y = Va[u.componentType],\n E = Ja[u.type],\n R = l.byteStride || y * E,\n B = new Float32Array(g);\n\n for (let C = 0; C < u.count; C++) {\n const M = new m(h, d + C * R, 2);\n An.set(M[0], M[1], 1), An.transformByMatrix3(i), B.set([An[0], An[1]], C * E);\n }\n\n s === r ? mA(u, l, e.buffers, B) : gA(r, u, t, e, B);\n }\n }\n }\n}\n\nfunction mA(e, t, n, s) {\n e.componentType = 5126, n.push({\n arrayBuffer: s.buffer,\n byteOffset: 0,\n byteLength: s.buffer.byteLength\n }), t.buffer = n.length - 1, t.byteLength = s.buffer.byteLength, t.byteOffset = 0, delete t.byteStride;\n}\n\nfunction gA(e, t, n, s, r) {\n s.buffers.push({\n arrayBuffer: r.buffer,\n byteOffset: 0,\n byteLength: r.buffer.byteLength\n });\n const i = s.json.bufferViews;\n if (!i) return;\n i.push({\n buffer: s.buffers.length - 1,\n byteLength: r.buffer.byteLength,\n byteOffset: 0\n });\n const o = s.json.accessors;\n o && (o.push({\n bufferView: (i == null ? void 0 : i.length) - 1,\n byteOffset: 0,\n componentType: 5126,\n count: t.count,\n type: \"VEC2\"\n }), n.attributes[`TEXCOORD_${e}`] = o.length - 1);\n}\n\nfunction AA(e) {\n const {\n offset: t = [0, 0],\n rotation: n = 0,\n scale: s = [1, 1]\n } = e,\n r = new X().set(1, 0, 0, 0, 1, 0, t[0], t[1], 1),\n i = cA.set(Math.cos(n), Math.sin(n), 0, -Math.sin(n), Math.cos(n), 0, 0, 0, 1),\n o = uA.set(s[0], 0, 0, 0, s[1], 0, 0, 0, 1);\n return r.multiplyRight(i).multiplyRight(o);\n}\n\nconst pA = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n decode: lA,\n name: aA\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n Yt = \"KHR_lights_punctual\",\n yA = Yt;\n\nasync function BA(e) {\n const t = new ot(e),\n {\n json: n\n } = t,\n s = t.getExtension(Yt);\n s && (t.json.lights = s.lights, t.removeExtension(Yt));\n\n for (const r of n.nodes || []) {\n const i = t.getObjectExtension(r, Yt);\n i && (r.light = i.light), t.removeObjectExtension(r, Yt);\n }\n}\n\nasync function CA(e) {\n const t = new ot(e),\n {\n json: n\n } = t;\n\n if (n.lights) {\n const s = t.addExtension(Yt);\n yt(!s.lights), s.lights = n.lights, delete n.lights;\n }\n\n if (t.json.lights) {\n for (const s of t.json.lights) {\n const r = s.node;\n t.addObjectExtension(r, Yt, s);\n }\n\n delete t.json.lights;\n }\n}\n\nconst EA = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n decode: BA,\n encode: CA,\n name: yA\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n Ue = \"KHR_materials_unlit\",\n TA = Ue;\n\nasync function bA(e) {\n const t = new ot(e),\n {\n json: n\n } = t;\n\n for (const s of n.materials || []) s.extensions && s.extensions.KHR_materials_unlit && (s.unlit = !0), t.removeObjectExtension(s, Ue);\n\n t.removeExtension(Ue);\n}\n\nfunction _A(e) {\n const t = new ot(e),\n {\n json: n\n } = t;\n if (t.materials) for (const s of n.materials || []) s.unlit && (delete s.unlit, t.addObjectExtension(s, Ue, {}), t.addExtension(Ue));\n}\n\nconst wA = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n decode: bA,\n encode: _A,\n name: TA\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n xe = \"KHR_techniques_webgl\",\n RA = xe;\n\nasync function MA(e) {\n const t = new ot(e),\n {\n json: n\n } = t,\n s = t.getExtension(xe);\n\n if (s) {\n const r = IA(s, t);\n\n for (const i of n.materials || []) {\n const o = t.getObjectExtension(i, xe);\n o && (i.technique = Object.assign({}, o, r[o.technique]), i.technique.values = xA(i.technique, t)), t.removeObjectExtension(i, xe);\n }\n\n t.removeExtension(xe);\n }\n}\n\nasync function SA(e, t) {}\n\nfunction IA(e, t) {\n const {\n programs: n = [],\n shaders: s = [],\n techniques: r = []\n } = e,\n i = new TextDecoder();\n return s.forEach(o => {\n if (Number.isFinite(o.bufferView)) o.code = i.decode(t.getTypedArrayForBufferView(o.bufferView));else throw new Error(\"KHR_techniques_webgl: no shader code\");\n }), n.forEach(o => {\n o.fragmentShader = s[o.fragmentShader], o.vertexShader = s[o.vertexShader];\n }), r.forEach(o => {\n o.program = n[o.program];\n }), r;\n}\n\nfunction xA(e, t) {\n const n = Object.assign({}, e.values);\n return Object.keys(e.uniforms || {}).forEach(s => {\n e.uniforms[s].value && !(s in n) && (n[s] = e.uniforms[s].value);\n }), Object.keys(n).forEach(s => {\n typeof n[s] == \"object\" && n[s].index !== void 0 && (n[s].texture = t.getTexture(n[s].index));\n }), n;\n}\n\nconst vA = /* @__PURE__ */Object.freeze( /* @__PURE__ */Object.defineProperty({\n __proto__: null,\n decode: MA,\n encode: SA,\n name: RA\n}, Symbol.toStringTag, {\n value: \"Module\"\n})),\n rc = [Ng, Cg, j0, z0, Q0, oA, EA, wA, vA, pA, e0];\n\nfunction OA(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},\n n = arguments.length > 2 ? arguments[2] : void 0;\n const s = rc.filter(i => ic(i.name, t));\n\n for (const i of s) {\n var r;\n (r = i.preprocess) === null || r === void 0 || r.call(i, e, t, n);\n }\n}\n\nasync function FA(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},\n n = arguments.length > 2 ? arguments[2] : void 0;\n const s = rc.filter(i => ic(i.name, t));\n\n for (const i of s) {\n var r;\n await ((r = i.decode) === null || r === void 0 ? void 0 : r.call(i, e, t, n));\n }\n}\n\nfunction ic(e, t) {\n var n;\n const s = (t == null || (n = t.gltf) === null || n === void 0 ? void 0 : n.excludeExtensions) || {};\n return !(e in s && !s[e]);\n}\n\nconst Ms = \"KHR_binary_glTF\";\n\nfunction DA(e) {\n const t = new ot(e),\n {\n json: n\n } = t;\n\n for (const s of n.images || []) {\n const r = t.getObjectExtension(s, Ms);\n r && Object.assign(s, r), t.removeObjectExtension(s, Ms);\n }\n\n n.buffers && n.buffers[0] && delete n.buffers[0].uri, t.removeExtension(Ms);\n}\n\nconst $i = {\n accessors: \"accessor\",\n animations: \"animation\",\n buffers: \"buffer\",\n bufferViews: \"bufferView\",\n images: \"image\",\n materials: \"material\",\n meshes: \"mesh\",\n nodes: \"node\",\n samplers: \"sampler\",\n scenes: \"scene\",\n skins: \"skin\",\n textures: \"texture\"\n},\n LA = {\n accessor: \"accessors\",\n animations: \"animation\",\n buffer: \"buffers\",\n bufferView: \"bufferViews\",\n image: \"images\",\n material: \"materials\",\n mesh: \"meshes\",\n node: \"nodes\",\n sampler: \"samplers\",\n scene: \"scenes\",\n skin: \"skins\",\n texture: \"textures\"\n};\n\nclass PA {\n constructor() {\n this.idToIndexMap = {\n animations: {},\n accessors: {},\n buffers: {},\n bufferViews: {},\n images: {},\n materials: {},\n meshes: {},\n nodes: {},\n samplers: {},\n scenes: {},\n skins: {},\n textures: {}\n }, this.json = void 0;\n }\n\n normalize(t, n) {\n this.json = t.json;\n const s = t.json;\n\n switch (s.asset && s.asset.version) {\n case \"2.0\":\n return;\n\n case void 0:\n case \"1.0\":\n break;\n\n default:\n console.warn(`glTF: Unknown version ${s.asset.version}`);\n return;\n }\n\n if (!n.normalize) throw new Error(\"glTF v1 is not supported.\");\n console.warn(\"Converting glTF v1 to glTF v2 format. This is experimental and may fail.\"), this._addAsset(s), this._convertTopLevelObjectsToArrays(s), DA(t), this._convertObjectIdsToArrayIndices(s), this._updateObjects(s), this._updateMaterial(s);\n }\n\n _addAsset(t) {\n t.asset = t.asset || {}, t.asset.version = \"2.0\", t.asset.generator = t.asset.generator || \"Normalized to glTF 2.0 by loaders.gl\";\n }\n\n _convertTopLevelObjectsToArrays(t) {\n for (const n in $i) this._convertTopLevelObjectToArray(t, n);\n }\n\n _convertTopLevelObjectToArray(t, n) {\n const s = t[n];\n\n if (!(!s || Array.isArray(s))) {\n t[n] = [];\n\n for (const r in s) {\n const i = s[r];\n i.id = i.id || r;\n const o = t[n].length;\n t[n].push(i), this.idToIndexMap[n][r] = o;\n }\n }\n }\n\n _convertObjectIdsToArrayIndices(t) {\n for (const n in $i) this._convertIdsToIndices(t, n);\n\n \"scene\" in t && (t.scene = this._convertIdToIndex(t.scene, \"scene\"));\n\n for (const n of t.textures) this._convertTextureIds(n);\n\n for (const n of t.meshes) this._convertMeshIds(n);\n\n for (const n of t.nodes) this._convertNodeIds(n);\n\n for (const n of t.scenes) this._convertSceneIds(n);\n }\n\n _convertTextureIds(t) {\n t.source && (t.source = this._convertIdToIndex(t.source, \"image\"));\n }\n\n _convertMeshIds(t) {\n for (const n of t.primitives) {\n const {\n attributes: s,\n indices: r,\n material: i\n } = n;\n\n for (const o in s) s[o] = this._convertIdToIndex(s[o], \"accessor\");\n\n r && (n.indices = this._convertIdToIndex(r, \"accessor\")), i && (n.material = this._convertIdToIndex(i, \"material\"));\n }\n }\n\n _convertNodeIds(t) {\n t.children && (t.children = t.children.map(n => this._convertIdToIndex(n, \"node\"))), t.meshes && (t.meshes = t.meshes.map(n => this._convertIdToIndex(n, \"mesh\")));\n }\n\n _convertSceneIds(t) {\n t.nodes && (t.nodes = t.nodes.map(n => this._convertIdToIndex(n, \"node\")));\n }\n\n _convertIdsToIndices(t, n) {\n t[n] || (console.warn(`gltf v1: json doesn't contain attribute ${n}`), t[n] = []);\n\n for (const s of t[n]) for (const r in s) {\n const i = s[r],\n o = this._convertIdToIndex(i, r);\n\n s[r] = o;\n }\n }\n\n _convertIdToIndex(t, n) {\n const s = LA[n];\n\n if (s in this.idToIndexMap) {\n const r = this.idToIndexMap[s][t];\n if (!Number.isFinite(r)) throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`);\n return r;\n }\n\n return t;\n }\n\n _updateObjects(t) {\n for (const n of this.json.buffers) delete n.type;\n }\n\n _updateMaterial(t) {\n for (const i of t.materials) {\n var n, s, r;\n i.pbrMetallicRoughness = {\n baseColorFactor: [1, 1, 1, 1],\n metallicFactor: 1,\n roughnessFactor: 1\n };\n const o = ((n = i.values) === null || n === void 0 ? void 0 : n.tex) || ((s = i.values) === null || s === void 0 ? void 0 : s.texture2d_0) || ((r = i.values) === null || r === void 0 ? void 0 : r.diffuseTex),\n a = t.textures.findIndex(c => c.id === o);\n a !== -1 && (i.pbrMetallicRoughness.baseColorTexture = {\n index: a\n });\n }\n }\n\n}\n\nfunction GA(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n return new PA().normalize(e, t);\n}\n\nasync function NA(e, t) {\n var n, s, r;\n let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0,\n o = arguments.length > 3 ? arguments[3] : void 0,\n a = arguments.length > 4 ? arguments[4] : void 0;\n return UA(e, t, i, o), GA(e, {\n normalize: o == null || (n = o.gltf) === null || n === void 0 ? void 0 : n.normalize\n }), OA(e, o, a), o != null && (s = o.gltf) !== null && s !== void 0 && s.loadBuffers && e.json.buffers && (await HA(e, o, a)), o != null && (r = o.gltf) !== null && r !== void 0 && r.loadImages && (await JA(e, o, a)), await FA(e, o, a), e;\n}\n\nfunction UA(e, t, n, s) {\n if (s.uri && (e.baseUri = s.uri), t instanceof ArrayBuffer && !_0(t, n, s) && (t = new TextDecoder().decode(t)), typeof t == \"string\") e.json = Du(t);else if (t instanceof ArrayBuffer) {\n const o = {};\n n = w0(o, t, n, s.glb), yt(o.type === \"glTF\", `Invalid GLB magic string ${o.type}`), e._glb = o, e.json = o.json;\n } else yt(!1, \"GLTF: must be ArrayBuffer or string\");\n const r = e.json.buffers || [];\n\n if (e.buffers = new Array(r.length).fill(null), e._glb && e._glb.header.hasBinChunk) {\n const {\n binChunks: o\n } = e._glb;\n e.buffers[0] = {\n arrayBuffer: o[0].arrayBuffer,\n byteOffset: o[0].byteOffset,\n byteLength: o[0].byteLength\n };\n }\n\n const i = e.json.images || [];\n e.images = new Array(i.length).fill({});\n}\n\nasync function HA(e, t, n) {\n const s = e.json.buffers || [];\n\n for (let o = 0; o < s.length; ++o) {\n const a = s[o];\n\n if (a.uri) {\n var r, i;\n const {\n fetch: c\n } = n;\n yt(c);\n const u = ec(a.uri, t),\n l = await (n == null || (r = n.fetch) === null || r === void 0 ? void 0 : r.call(n, u)),\n h = await (l == null || (i = l.arrayBuffer) === null || i === void 0 ? void 0 : i.call(l));\n e.buffers[o] = {\n arrayBuffer: h,\n byteOffset: 0,\n byteLength: h.byteLength\n }, delete a.uri;\n } else e.buffers[o] === null && (e.buffers[o] = {\n arrayBuffer: new ArrayBuffer(a.byteLength),\n byteOffset: 0,\n byteLength: a.byteLength\n });\n }\n}\n\nasync function JA(e, t, n) {\n const s = VA(e),\n r = e.json.images || [],\n i = [];\n\n for (const o of s) i.push(jA(e, r[o], o, t, n));\n\n return await Promise.all(i);\n}\n\nfunction VA(e) {\n const t = /* @__PURE__ */new Set(),\n n = e.json.textures || [];\n\n for (const s of n) s.source !== void 0 && t.add(s.source);\n\n return Array.from(t).sort();\n}\n\nasync function jA(e, t, n, s, r) {\n let i;\n\n if (t.uri && !t.hasOwnProperty(\"bufferView\")) {\n const a = ec(t.uri, s),\n {\n fetch: c\n } = r;\n i = await (await c(a)).arrayBuffer(), t.bufferView = {\n data: i\n };\n }\n\n if (Number.isFinite(t.bufferView)) {\n const a = lg(e.json, e.buffers, t.bufferView);\n i = dr(a.buffer, a.byteOffset, a.byteLength);\n }\n\n yt(i, \"glTF image has no data\");\n let o = await Ke(i, [Zm, p0], { ...s,\n mimeType: t.mimeType,\n basis: s.basis || {\n format: tc()\n }\n }, r);\n o && o[0] && (o = {\n compressed: !0,\n mipmaps: !1,\n width: o[0].width,\n height: o[0].height,\n data: o[0]\n }), e.images = e.images || [], e.images[n] = o;\n}\n\nconst Nn = {\n name: \"glTF\",\n id: \"gltf\",\n module: \"gltf\",\n version: n0,\n extensions: [\"gltf\", \"glb\"],\n mimeTypes: [\"model/gltf+json\", \"model/gltf-binary\"],\n text: !0,\n binary: !0,\n tests: [\"glTF\"],\n parse: kA,\n options: {\n gltf: {\n normalize: !0,\n loadBuffers: !0,\n loadImages: !0,\n decompressMeshes: !0\n },\n log: console\n }\n};\n\nasync function kA(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},\n n = arguments.length > 2 ? arguments[2] : void 0;\n t = { ...Nn.options,\n ...t\n }, t.gltf = { ...Nn.options.gltf,\n ...t.gltf\n };\n const {\n byteOffset: s = 0\n } = t;\n return await NA({}, e, s, t, n);\n}\n\nconst KA = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n},\n zA = {\n 5120: 1,\n 5121: 1,\n 5122: 2,\n 5123: 2,\n 5125: 4,\n 5126: 4\n},\n Bt = {\n TEXTURE_MAG_FILTER: 10240,\n TEXTURE_MIN_FILTER: 10241,\n TEXTURE_WRAP_S: 10242,\n TEXTURE_WRAP_T: 10243,\n REPEAT: 10497,\n LINEAR: 9729,\n NEAREST_MIPMAP_LINEAR: 9986\n},\n WA = {\n magFilter: Bt.TEXTURE_MAG_FILTER,\n minFilter: Bt.TEXTURE_MIN_FILTER,\n wrapS: Bt.TEXTURE_WRAP_S,\n wrapT: Bt.TEXTURE_WRAP_T\n},\n XA = {\n [Bt.TEXTURE_MAG_FILTER]: Bt.LINEAR,\n [Bt.TEXTURE_MIN_FILTER]: Bt.NEAREST_MIPMAP_LINEAR,\n [Bt.TEXTURE_WRAP_S]: Bt.REPEAT,\n [Bt.TEXTURE_WRAP_T]: Bt.REPEAT\n};\n\nfunction QA() {\n return {\n id: \"default-sampler\",\n parameters: XA\n };\n}\n\nfunction qA(e) {\n return zA[e];\n}\n\nfunction YA(e) {\n return KA[e];\n}\n\nclass $A {\n constructor() {\n this.baseUri = \"\", this.jsonUnprocessed = void 0, this.json = void 0, this.buffers = [], this.images = [];\n }\n\n postProcess(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n const {\n json: s,\n buffers: r = [],\n images: i = []\n } = t,\n {\n baseUri: o = \"\"\n } = t;\n return yt(s), this.baseUri = o, this.buffers = r, this.images = i, this.jsonUnprocessed = s, this.json = this._resolveTree(t.json, n), this.json;\n }\n\n _resolveTree(t) {\n const n = { ...t\n };\n return this.json = n, t.bufferViews && (n.bufferViews = t.bufferViews.map((s, r) => this._resolveBufferView(s, r))), t.images && (n.images = t.images.map((s, r) => this._resolveImage(s, r))), t.samplers && (n.samplers = t.samplers.map((s, r) => this._resolveSampler(s, r))), t.textures && (n.textures = t.textures.map((s, r) => this._resolveTexture(s, r))), t.accessors && (n.accessors = t.accessors.map((s, r) => this._resolveAccessor(s, r))), t.materials && (n.materials = t.materials.map((s, r) => this._resolveMaterial(s, r))), t.meshes && (n.meshes = t.meshes.map((s, r) => this._resolveMesh(s, r))), t.nodes && (n.nodes = t.nodes.map((s, r) => this._resolveNode(s, r)), n.nodes = n.nodes.map((s, r) => this._resolveNodeChildren(s))), t.skins && (n.skins = t.skins.map((s, r) => this._resolveSkin(s, r))), t.scenes && (n.scenes = t.scenes.map((s, r) => this._resolveScene(s, r))), typeof this.json.scene == \"number\" && n.scenes && (n.scene = n.scenes[this.json.scene]), n;\n }\n\n getScene(t) {\n return this._get(this.json.scenes, t);\n }\n\n getNode(t) {\n return this._get(this.json.nodes, t);\n }\n\n getSkin(t) {\n return this._get(this.json.skins, t);\n }\n\n getMesh(t) {\n return this._get(this.json.meshes, t);\n }\n\n getMaterial(t) {\n return this._get(this.json.materials, t);\n }\n\n getAccessor(t) {\n return this._get(this.json.accessors, t);\n }\n\n getCamera(t) {\n return this._get(this.json.cameras, t);\n }\n\n getTexture(t) {\n return this._get(this.json.textures, t);\n }\n\n getSampler(t) {\n return this._get(this.json.samplers, t);\n }\n\n getImage(t) {\n return this._get(this.json.images, t);\n }\n\n getBufferView(t) {\n return this._get(this.json.bufferViews, t);\n }\n\n getBuffer(t) {\n return this._get(this.json.buffers, t);\n }\n\n _get(t, n) {\n if (typeof n == \"object\") return n;\n const s = t && t[n];\n return s || console.warn(`glTF file error: Could not find ${t}[${n}]`), s;\n }\n\n _resolveScene(t, n) {\n return { ...t,\n id: t.id || `scene-${n}`,\n nodes: (t.nodes || []).map(s => this.getNode(s))\n };\n }\n\n _resolveNode(t, n) {\n const s = { ...t,\n id: (t == null ? void 0 : t.id) || `node-${n}`\n };\n return t.mesh !== void 0 && (s.mesh = this.getMesh(t.mesh)), t.camera !== void 0 && (s.camera = this.getCamera(t.camera)), t.skin !== void 0 && (s.skin = this.getSkin(t.skin)), t.meshes !== void 0 && t.meshes.length && (s.mesh = t.meshes.reduce((r, i) => {\n const o = this.getMesh(i);\n return r.id = o.id, r.primitives = r.primitives.concat(o.primitives), r;\n }, {\n primitives: []\n })), s;\n }\n\n _resolveNodeChildren(t) {\n return t.children && (t.children = t.children.map(n => this.getNode(n))), t;\n }\n\n _resolveSkin(t, n) {\n const s = typeof t.inverseBindMatrices == \"number\" ? this.getAccessor(t.inverseBindMatrices) : void 0;\n return { ...t,\n id: t.id || `skin-${n}`,\n inverseBindMatrices: s\n };\n }\n\n _resolveMesh(t, n) {\n const s = { ...t,\n id: t.id || `mesh-${n}`,\n primitives: []\n };\n return t.primitives && (s.primitives = t.primitives.map(r => {\n const i = { ...r,\n attributes: {},\n indices: void 0,\n material: void 0\n },\n o = r.attributes;\n\n for (const a in o) i.attributes[a] = this.getAccessor(o[a]);\n\n return r.indices !== void 0 && (i.indices = this.getAccessor(r.indices)), r.material !== void 0 && (i.material = this.getMaterial(r.material)), i;\n })), s;\n }\n\n _resolveMaterial(t, n) {\n const s = { ...t,\n id: t.id || `material-${n}`\n };\n\n if (s.normalTexture && (s.normalTexture = { ...s.normalTexture\n }, s.normalTexture.texture = this.getTexture(s.normalTexture.index)), s.occlusionTexture && (s.occlusionTexture = { ...s.occlusionTexture\n }, s.occlusionTexture.texture = this.getTexture(s.occlusionTexture.index)), s.emissiveTexture && (s.emissiveTexture = { ...s.emissiveTexture\n }, s.emissiveTexture.texture = this.getTexture(s.emissiveTexture.index)), s.emissiveFactor || (s.emissiveFactor = s.emissiveTexture ? [1, 1, 1] : [0, 0, 0]), s.pbrMetallicRoughness) {\n s.pbrMetallicRoughness = { ...s.pbrMetallicRoughness\n };\n const r = s.pbrMetallicRoughness;\n r.baseColorTexture && (r.baseColorTexture = { ...r.baseColorTexture\n }, r.baseColorTexture.texture = this.getTexture(r.baseColorTexture.index)), r.metallicRoughnessTexture && (r.metallicRoughnessTexture = { ...r.metallicRoughnessTexture\n }, r.metallicRoughnessTexture.texture = this.getTexture(r.metallicRoughnessTexture.index));\n }\n\n return s;\n }\n\n _resolveAccessor(t, n) {\n const s = qA(t.componentType),\n r = YA(t.type),\n i = s * r,\n o = { ...t,\n id: t.id || `accessor-${n}`,\n bytesPerComponent: s,\n components: r,\n bytesPerElement: i,\n value: void 0,\n bufferView: void 0,\n sparse: void 0\n };\n\n if (t.bufferView !== void 0 && (o.bufferView = this.getBufferView(t.bufferView)), o.bufferView) {\n const a = o.bufferView.buffer,\n {\n ArrayType: c,\n byteLength: u\n } = Ir(o, o.bufferView),\n l = (o.bufferView.byteOffset || 0) + (o.byteOffset || 0) + a.byteOffset;\n let h = a.arrayBuffer.slice(l, l + u);\n o.bufferView.byteStride && (h = this._getValueFromInterleavedBuffer(a, l, o.bufferView.byteStride, o.bytesPerElement, o.count)), o.value = new c(h);\n }\n\n return o;\n }\n\n _getValueFromInterleavedBuffer(t, n, s, r, i) {\n const o = new Uint8Array(i * r);\n\n for (let a = 0; a < i; a++) {\n const c = n + a * s;\n o.set(new Uint8Array(t.arrayBuffer.slice(c, c + r)), a * r);\n }\n\n return o.buffer;\n }\n\n _resolveTexture(t, n) {\n return { ...t,\n id: t.id || `texture-${n}`,\n sampler: typeof t.sampler == \"number\" ? this.getSampler(t.sampler) : QA(),\n source: typeof t.source == \"number\" ? this.getImage(t.source) : void 0\n };\n }\n\n _resolveSampler(t, n) {\n const s = {\n id: t.id || `sampler-${n}`,\n ...t,\n parameters: {}\n };\n\n for (const r in s) {\n const i = this._enumSamplerParameter(r);\n\n i !== void 0 && (s.parameters[i] = s[r]);\n }\n\n return s;\n }\n\n _enumSamplerParameter(t) {\n return WA[t];\n }\n\n _resolveImage(t, n) {\n const s = { ...t,\n id: t.id || `image-${n}`,\n image: null,\n bufferView: t.bufferView !== void 0 ? this.getBufferView(t.bufferView) : void 0\n },\n r = this.images[n];\n return r && (s.image = r), s;\n }\n\n _resolveBufferView(t, n) {\n const s = t.buffer,\n r = this.buffers[s].arrayBuffer;\n let i = this.buffers[s].byteOffset || 0;\n return t.byteOffset && (i += t.byteOffset), {\n id: `bufferView-${n}`,\n ...t,\n buffer: this.buffers[s],\n data: new Uint8Array(r, i, t.byteLength)\n };\n }\n\n _resolveCamera(t, n) {\n const s = { ...t,\n id: t.id || `camera-${n}`\n };\n return s.perspective, s.orthographic, s;\n }\n\n}\n\nfunction oc(e, t) {\n return new $A().postProcess(e, t);\n}\n\nconst Zs = {\n URI: 0,\n EMBEDDED: 1\n};\n\nfunction ac(e, t, n, s) {\n e.rotateYtoZ = !0;\n const r = (e.byteOffset || 0) + (e.byteLength || 0) - n;\n if (r === 0) throw new Error(\"glTF byte length must be greater than 0.\");\n return e.gltfUpAxis = s != null && s[\"3d-tiles\"] && s[\"3d-tiles\"].assetGltfUpAxis ? s[\"3d-tiles\"].assetGltfUpAxis : \"Y\", e.gltfArrayBuffer = dr(t, n, r), e.gltfByteOffset = 0, e.gltfByteLength = r, n % 4 === 0 || console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`), (e.byteOffset || 0) + (e.byteLength || 0);\n}\n\nasync function cc(e, t, n, s) {\n const r = (n == null ? void 0 : n[\"3d-tiles\"]) || {};\n\n if (ZA(e, t), r.loadGLTF) {\n if (!s) return;\n\n if (e.gltfUrl) {\n const {\n fetch: i\n } = s,\n o = await i(e.gltfUrl, n);\n e.gltfArrayBuffer = await o.arrayBuffer(), e.gltfByteOffset = 0;\n }\n\n if (e.gltfArrayBuffer) {\n const i = await Ke(e.gltfArrayBuffer, Nn, n, s);\n e.gltf = oc(i), e.gpuMemoryUsageInBytes = ka(e.gltf), delete e.gltfArrayBuffer, delete e.gltfByteOffset, delete e.gltfByteLength;\n }\n }\n}\n\nfunction ZA(e, t, n) {\n switch (t) {\n case Zs.URI:\n if (e.gltfArrayBuffer) {\n const s = new Uint8Array(e.gltfArrayBuffer, e.gltfByteOffset),\n i = new TextDecoder().decode(s);\n e.gltfUrl = i.replace(/[\\s\\0]+$/, \"\");\n }\n\n delete e.gltfArrayBuffer, delete e.gltfByteOffset, delete e.gltfByteLength;\n break;\n\n case Zs.EMBEDDED:\n break;\n\n default:\n throw new Error(\"b3dm: Illegal glTF format field\");\n }\n}\n\nasync function tp(e, t, n, s, r) {\n var i;\n n = ep(e, t, n, s), await cc(e, Zs.EMBEDDED, s, r);\n const o = e == null || (i = e.gltf) === null || i === void 0 ? void 0 : i.extensions;\n return o && o.CESIUM_RTC && (e.rtcCenter = o.CESIUM_RTC.center), n;\n}\n\nfunction ep(e, t, n, s, r) {\n n = qn(e, t, n), n = _r(e, t, n), n = wr(e, t, n), n = ac(e, t, n, s);\n const i = new br(e.featureTableJson, e.featureTableBinary);\n return e.rtcCenter = i.getGlobalProperty(\"RTC_CENTER\", G.FLOAT, 3), n;\n}\n\nasync function np(e, t, n, s, r) {\n return n = sp(e, t, n, s), await cc(e, e.gltfFormat || 0, s, r), n;\n}\n\nfunction sp(e, t, n, s, r) {\n var i;\n if (n = qn(e, t, n), e.version !== 1) throw new Error(`Instanced 3D Model version ${e.version} is not supported`);\n n = _r(e, t, n);\n const o = new DataView(t);\n if (e.gltfFormat = o.getUint32(n, !0), n += 4, n = wr(e, t, n), n = ac(e, t, n, s), !(e != null && (i = e.header) !== null && i !== void 0 && i.featureTableJsonByteLength) || e.header.featureTableJsonByteLength === 0) throw new Error(\"i3dm parser: featureTableJsonByteLength is zero.\");\n const a = new br(e.featureTableJson, e.featureTableBinary),\n c = a.getGlobalProperty(\"INSTANCES_LENGTH\");\n if (a.featuresLength = c, !Number.isFinite(c)) throw new Error(\"i3dm parser: INSTANCES_LENGTH must be defined\");\n e.eastNorthUp = a.getGlobalProperty(\"EAST_NORTH_UP\"), e.rtcCenter = a.getGlobalProperty(\"RTC_CENTER\", G.FLOAT, 3);\n const u = new Pa(e.batchTableJson, e.batchTableBinary, c);\n return rp(e, a, u, c), n;\n}\n\nfunction rp(e, t, n, s) {\n const r = new Array(s),\n i = new A();\n new A(), new A(), new A();\n const o = new X(),\n a = new On(),\n c = new A(),\n u = {},\n l = new V(),\n h = [],\n f = [],\n d = [],\n m = [];\n\n for (let g = 0; g < s; g++) {\n let y;\n if (t.hasProperty(\"POSITION\")) y = t.getProperty(\"POSITION\", G.FLOAT, 3, g, i);else if (t.hasProperty(\"POSITION_QUANTIZED\")) {\n y = t.getProperty(\"POSITION_QUANTIZED\", G.UNSIGNED_SHORT, 3, g, i);\n const b = t.getGlobalProperty(\"QUANTIZED_VOLUME_OFFSET\", G.FLOAT, 3);\n if (!b) throw new Error(\"i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.\");\n const O = t.getGlobalProperty(\"QUANTIZED_VOLUME_SCALE\", G.FLOAT, 3);\n if (!O) throw new Error(\"i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.\");\n const F = 65535;\n\n for (let v = 0; v < 3; v++) y[v] = y[v] / F * O[v] + b[v];\n }\n if (!y) throw new Error(\"i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.\");\n\n if (i.copy(y), u.translation = i, e.normalUp = t.getProperty(\"NORMAL_UP\", G.FLOAT, 3, g, h), e.normalRight = t.getProperty(\"NORMAL_RIGHT\", G.FLOAT, 3, g, f), e.normalUp) {\n if (!e.normalRight) throw new Error(\"i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.\");\n e.hasCustomOrientation = !0;\n } else {\n if (e.octNormalUp = t.getProperty(\"NORMAL_UP_OCT32P\", G.UNSIGNED_SHORT, 2, g, h), e.octNormalRight = t.getProperty(\"NORMAL_RIGHT_OCT32P\", G.UNSIGNED_SHORT, 2, g, f), e.octNormalUp) throw e.octNormalRight ? new Error(\"i3dm: oct-encoded orientation not implemented\") : new Error(\"i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P\");\n e.eastNorthUp ? (J.WGS84.eastNorthUpToFixedFrame(i, l), l.getRotationMatrix3(o)) : o.identity();\n }\n\n a.fromMatrix3(o), u.rotation = a, c.set(1, 1, 1);\n const E = t.getProperty(\"SCALE\", G.FLOAT, 1, g, d);\n Number.isFinite(E) && c.multiplyByScalar(E);\n const R = t.getProperty(\"SCALE_NON_UNIFORM\", G.FLOAT, 3, g, h);\n R && c.scale(R), u.scale = c;\n let B = t.getProperty(\"BATCH_ID\", G.UNSIGNED_SHORT, 1, g, m);\n B === void 0 && (B = g);\n const C = new V().fromQuaternion(u.rotation);\n l.identity(), l.translate(u.translation), l.multiplyRight(C), l.scale(u.scale);\n const M = l.clone();\n r[g] = {\n modelMatrix: M,\n batchId: B\n };\n }\n\n e.instances = r;\n}\n\nasync function ip(e, t, n, s, r, i) {\n n = qn(e, t, n);\n const o = new DataView(t);\n\n for (e.tilesLength = o.getUint32(n, !0), n += 4, e.tiles = []; e.tiles.length < e.tilesLength && (e.byteLength || 0) - n > 12;) {\n const a = {\n shape: \"tile3d\"\n };\n e.tiles.push(a), n = await i(t, n, s, r, a);\n }\n\n return n;\n}\n\nasync function op(e, t, n, s) {\n var r, i;\n\n if (e.rotateYtoZ = !0, e.gltfUpAxis = n != null && (r = n[\"3d-tiles\"]) !== null && r !== void 0 && r.assetGltfUpAxis ? n[\"3d-tiles\"].assetGltfUpAxis : \"Y\", n != null && (i = n[\"3d-tiles\"]) !== null && i !== void 0 && i.loadGLTF) {\n if (!s) return t.byteLength;\n const o = await Ke(t, Nn, n, s);\n e.gltf = oc(o), e.gpuMemoryUsageInBytes = ka(e.gltf);\n } else e.gltfArrayBuffer = t;\n\n return t.byteLength;\n}\n\nasync function uc(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0,\n n = arguments.length > 2 ? arguments[2] : void 0,\n s = arguments.length > 3 ? arguments[3] : void 0,\n r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {\n shape: \"tile3d\"\n };\n\n switch (r.byteOffset = t, r.type = Sd(e, t), r.type) {\n case _e.COMPOSITE:\n return await ip(r, e, t, n, s, uc);\n\n case _e.BATCHED_3D_MODEL:\n return await tp(r, e, t, n, s);\n\n case _e.GLTF:\n return await op(r, e, n, s);\n\n case _e.INSTANCED_3D_MODEL:\n return await np(r, e, t, n, s);\n\n case _e.POINT_CLOUD:\n return await fm(r, e, t, n, s);\n\n default:\n throw new Error(`3DTileLoader: unknown type ${r.type}`);\n }\n}\n\nconst ap = 1952609651,\n cp = 1;\n\nasync function up(e, t, n) {\n if (new Uint32Array(e.slice(0, 4))[0] !== ap) throw new Error(\"Wrong subtree file magic number\");\n if (new Uint32Array(e.slice(4, 8))[0] !== cp) throw new Error(\"Wrong subtree file verson, must be 1\");\n const i = Zi(e.slice(8, 16)),\n o = new Uint8Array(e, 24, i),\n c = new TextDecoder(\"utf8\").decode(o),\n u = JSON.parse(c),\n l = Zi(e.slice(16, 24));\n let h = new ArrayBuffer(0);\n if (l && (h = e.slice(24 + i)), await pn(u, u.tileAvailability, h, n), Array.isArray(u.contentAvailability)) for (const f of u.contentAvailability) await pn(u, f, h, n);else await pn(u, u.contentAvailability, h, n);\n return await pn(u, u.childSubtreeAvailability, h, n), u;\n}\n\nasync function pn(e, t, n, s) {\n const r = Number.isFinite(t.bitstream) ? t.bitstream : t.bufferView;\n if (typeof r != \"number\") return;\n const i = e.bufferViews[r],\n o = e.buffers[i.buffer];\n if (!(s != null && s.baseUrl)) throw new Error(\"Url is not provided\");\n if (!s.fetch) throw new Error(\"fetch is not provided\");\n\n if (o.uri) {\n const c = `${(s == null ? void 0 : s.baseUrl) || \"\"}/${o.uri}`,\n l = await (await s.fetch(c)).arrayBuffer();\n t.explicitBitstream = new Uint8Array(l, i.byteOffset, i.byteLength);\n return;\n }\n\n const a = e.buffers.slice(0, i.buffer).reduce((c, u) => c + u.byteLength, 0);\n t.explicitBitstream = new Uint8Array(n.slice(a, a + o.byteLength), i.byteOffset, i.byteLength);\n}\n\nfunction Zi(e) {\n const t = new DataView(e),\n n = t.getUint32(0, !0),\n s = t.getUint32(4, !0);\n return n + 2 ** 32 * s;\n}\n\nconst lc = {\n id: \"3d-tiles-subtree\",\n name: \"3D Tiles Subtree\",\n module: \"3d-tiles\",\n version: va,\n extensions: [\"subtree\"],\n mimeTypes: [\"application/octet-stream\"],\n tests: [\"subtree\"],\n parse: up,\n options: {}\n};\n/**\n * @license\n * Copyright 2009 The Closure Library Authors\n * Copyright 2020 Daniel Wirtz / The long.js Authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\nvar Et = null;\n\ntry {\n Et = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;\n} catch {}\n\nfunction H(e, t, n) {\n this.low = e | 0, this.high = t | 0, this.unsigned = !!n;\n}\n\nH.prototype.__isLong__;\nObject.defineProperty(H.prototype, \"__isLong__\", {\n value: !0\n});\n\nfunction at(e) {\n return (e && e.__isLong__) === !0;\n}\n\nfunction to(e) {\n var t = Math.clz32(e & -e);\n return e ? 31 - t : t;\n}\n\nH.isLong = at;\nvar eo = {},\n no = {};\n\nfunction ie(e, t) {\n var n, s, r;\n return t ? (e >>>= 0, (r = 0 <= e && e < 256) && (s = no[e], s) ? s : (n = N(e, 0, !0), r && (no[e] = n), n)) : (e |= 0, (r = -128 <= e && e < 128) && (s = eo[e], s) ? s : (n = N(e, e < 0 ? -1 : 0, !1), r && (eo[e] = n), n));\n}\n\nH.fromInt = ie;\n\nfunction Tt(e, t) {\n if (isNaN(e)) return t ? Ut : St;\n\n if (t) {\n if (e < 0) return Ut;\n if (e >= hc) return mc;\n } else {\n if (e <= -ro) return mt;\n if (e + 1 >= ro) return dc;\n }\n\n return e < 0 ? Tt(-e, t).neg() : N(e % ye | 0, e / ye | 0, t);\n}\n\nH.fromNumber = Tt;\n\nfunction N(e, t, n) {\n return new H(e, t, n);\n}\n\nH.fromBits = N;\nvar Un = Math.pow;\n\nfunction Pr(e, t, n) {\n if (e.length === 0) throw Error(\"empty string\");\n if (typeof t == \"number\" ? (n = t, t = !1) : t = !!t, e === \"NaN\" || e === \"Infinity\" || e === \"+Infinity\" || e === \"-Infinity\") return t ? Ut : St;\n if (n = n || 10, n < 2 || 36 < n) throw RangeError(\"radix\");\n var s;\n if ((s = e.indexOf(\"-\")) > 0) throw Error(\"interior hyphen\");\n if (s === 0) return Pr(e.substring(1), t, n).neg();\n\n for (var r = Tt(Un(n, 8)), i = St, o = 0; o < e.length; o += 8) {\n var a = Math.min(8, e.length - o),\n c = parseInt(e.substring(o, o + a), n);\n\n if (a < 8) {\n var u = Tt(Un(n, a));\n i = i.mul(u).add(Tt(c));\n } else i = i.mul(r), i = i.add(Tt(c));\n }\n\n return i.unsigned = t, i;\n}\n\nH.fromString = Pr;\n\nfunction xt(e, t) {\n return typeof e == \"number\" ? Tt(e, t) : typeof e == \"string\" ? Pr(e, t) : N(e.low, e.high, typeof t == \"boolean\" ? t : e.unsigned);\n}\n\nH.fromValue = xt;\nvar so = 65536,\n lp = 1 << 24,\n ye = so * so,\n hc = ye * ye,\n ro = hc / 2,\n io = ie(lp),\n St = ie(0);\nH.ZERO = St;\nvar Ut = ie(0, !0);\nH.UZERO = Ut;\nvar de = ie(1);\nH.ONE = de;\nvar fc = ie(1, !0);\nH.UONE = fc;\nvar tr = ie(-1);\nH.NEG_ONE = tr;\nvar dc = N(-1, 2147483647, !1);\nH.MAX_VALUE = dc;\nvar mc = N(-1, -1, !0);\nH.MAX_UNSIGNED_VALUE = mc;\nvar mt = N(0, -2147483648, !1);\nH.MIN_VALUE = mt;\nvar _ = H.prototype;\n\n_.toInt = function () {\n return this.unsigned ? this.low >>> 0 : this.low;\n};\n\n_.toNumber = function () {\n return this.unsigned ? (this.high >>> 0) * ye + (this.low >>> 0) : this.high * ye + (this.low >>> 0);\n};\n\n_.toString = function (t) {\n if (t = t || 10, t < 2 || 36 < t) throw RangeError(\"radix\");\n if (this.isZero()) return \"0\";\n if (this.isNegative()) if (this.eq(mt)) {\n var n = Tt(t),\n s = this.div(n),\n r = s.mul(n).sub(this);\n return s.toString(t) + r.toInt().toString(t);\n } else return \"-\" + this.neg().toString(t);\n\n for (var i = Tt(Un(t, 6), this.unsigned), o = this, a = \"\";;) {\n var c = o.div(i),\n u = o.sub(c.mul(i)).toInt() >>> 0,\n l = u.toString(t);\n if (o = c, o.isZero()) return l + a;\n\n for (; l.length < 6;) l = \"0\" + l;\n\n a = \"\" + l + a;\n }\n};\n\n_.getHighBits = function () {\n return this.high;\n};\n\n_.getHighBitsUnsigned = function () {\n return this.high >>> 0;\n};\n\n_.getLowBits = function () {\n return this.low;\n};\n\n_.getLowBitsUnsigned = function () {\n return this.low >>> 0;\n};\n\n_.getNumBitsAbs = function () {\n if (this.isNegative()) return this.eq(mt) ? 64 : this.neg().getNumBitsAbs();\n\n for (var t = this.high != 0 ? this.high : this.low, n = 31; n > 0 && !(t & 1 << n); n--);\n\n return this.high != 0 ? n + 33 : n + 1;\n};\n\n_.isZero = function () {\n return this.high === 0 && this.low === 0;\n};\n\n_.eqz = _.isZero;\n\n_.isNegative = function () {\n return !this.unsigned && this.high < 0;\n};\n\n_.isPositive = function () {\n return this.unsigned || this.high >= 0;\n};\n\n_.isOdd = function () {\n return (this.low & 1) === 1;\n};\n\n_.isEven = function () {\n return (this.low & 1) === 0;\n};\n\n_.equals = function (t) {\n return at(t) || (t = xt(t)), this.unsigned !== t.unsigned && this.high >>> 31 === 1 && t.high >>> 31 === 1 ? !1 : this.high === t.high && this.low === t.low;\n};\n\n_.eq = _.equals;\n\n_.notEquals = function (t) {\n return !this.eq(\n /* validates */\n t);\n};\n\n_.neq = _.notEquals;\n_.ne = _.notEquals;\n\n_.lessThan = function (t) {\n return this.comp(\n /* validates */\n t) < 0;\n};\n\n_.lt = _.lessThan;\n\n_.lessThanOrEqual = function (t) {\n return this.comp(\n /* validates */\n t) <= 0;\n};\n\n_.lte = _.lessThanOrEqual;\n_.le = _.lessThanOrEqual;\n\n_.greaterThan = function (t) {\n return this.comp(\n /* validates */\n t) > 0;\n};\n\n_.gt = _.greaterThan;\n\n_.greaterThanOrEqual = function (t) {\n return this.comp(\n /* validates */\n t) >= 0;\n};\n\n_.gte = _.greaterThanOrEqual;\n_.ge = _.greaterThanOrEqual;\n\n_.compare = function (t) {\n if (at(t) || (t = xt(t)), this.eq(t)) return 0;\n var n = this.isNegative(),\n s = t.isNegative();\n return n && !s ? -1 : !n && s ? 1 : this.unsigned ? t.high >>> 0 > this.high >>> 0 || t.high === this.high && t.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(t).isNegative() ? -1 : 1;\n};\n\n_.comp = _.compare;\n\n_.negate = function () {\n return !this.unsigned && this.eq(mt) ? mt : this.not().add(de);\n};\n\n_.neg = _.negate;\n\n_.add = function (t) {\n at(t) || (t = xt(t));\n var n = this.high >>> 16,\n s = this.high & 65535,\n r = this.low >>> 16,\n i = this.low & 65535,\n o = t.high >>> 16,\n a = t.high & 65535,\n c = t.low >>> 16,\n u = t.low & 65535,\n l = 0,\n h = 0,\n f = 0,\n d = 0;\n return d += i + u, f += d >>> 16, d &= 65535, f += r + c, h += f >>> 16, f &= 65535, h += s + a, l += h >>> 16, h &= 65535, l += n + o, l &= 65535, N(f << 16 | d, l << 16 | h, this.unsigned);\n};\n\n_.subtract = function (t) {\n return at(t) || (t = xt(t)), this.add(t.neg());\n};\n\n_.sub = _.subtract;\n\n_.multiply = function (t) {\n if (this.isZero()) return this;\n\n if (at(t) || (t = xt(t)), Et) {\n var n = Et.mul(this.low, this.high, t.low, t.high);\n return N(n, Et.get_high(), this.unsigned);\n }\n\n if (t.isZero()) return this.unsigned ? Ut : St;\n if (this.eq(mt)) return t.isOdd() ? mt : St;\n if (t.eq(mt)) return this.isOdd() ? mt : St;\n if (this.isNegative()) return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg();\n if (t.isNegative()) return this.mul(t.neg()).neg();\n if (this.lt(io) && t.lt(io)) return Tt(this.toNumber() * t.toNumber(), this.unsigned);\n var s = this.high >>> 16,\n r = this.high & 65535,\n i = this.low >>> 16,\n o = this.low & 65535,\n a = t.high >>> 16,\n c = t.high & 65535,\n u = t.low >>> 16,\n l = t.low & 65535,\n h = 0,\n f = 0,\n d = 0,\n m = 0;\n return m += o * l, d += m >>> 16, m &= 65535, d += i * l, f += d >>> 16, d &= 65535, d += o * u, f += d >>> 16, d &= 65535, f += r * l, h += f >>> 16, f &= 65535, f += i * u, h += f >>> 16, f &= 65535, f += o * c, h += f >>> 16, f &= 65535, h += s * l + r * u + i * c + o * a, h &= 65535, N(d << 16 | m, h << 16 | f, this.unsigned);\n};\n\n_.mul = _.multiply;\n\n_.divide = function (t) {\n if (at(t) || (t = xt(t)), t.isZero()) throw Error(\"division by zero\");\n\n if (Et) {\n if (!this.unsigned && this.high === -2147483648 && t.low === -1 && t.high === -1) return this;\n var n = (this.unsigned ? Et.div_u : Et.div_s)(this.low, this.high, t.low, t.high);\n return N(n, Et.get_high(), this.unsigned);\n }\n\n if (this.isZero()) return this.unsigned ? Ut : St;\n var s, r, i;\n\n if (this.unsigned) {\n if (t.unsigned || (t = t.toUnsigned()), t.gt(this)) return Ut;\n if (t.gt(this.shru(1))) return fc;\n i = Ut;\n } else {\n if (this.eq(mt)) {\n if (t.eq(de) || t.eq(tr)) return mt;\n if (t.eq(mt)) return de;\n var o = this.shr(1);\n return s = o.div(t).shl(1), s.eq(St) ? t.isNegative() ? de : tr : (r = this.sub(t.mul(s)), i = s.add(r.div(t)), i);\n } else if (t.eq(mt)) return this.unsigned ? Ut : St;\n\n if (this.isNegative()) return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg();\n if (t.isNegative()) return this.div(t.neg()).neg();\n i = St;\n }\n\n for (r = this; r.gte(t);) {\n s = Math.max(1, Math.floor(r.toNumber() / t.toNumber()));\n\n for (var a = Math.ceil(Math.log(s) / Math.LN2), c = a <= 48 ? 1 : Un(2, a - 48), u = Tt(s), l = u.mul(t); l.isNegative() || l.gt(r);) s -= c, u = Tt(s, this.unsigned), l = u.mul(t);\n\n u.isZero() && (u = de), i = i.add(u), r = r.sub(l);\n }\n\n return i;\n};\n\n_.div = _.divide;\n\n_.modulo = function (t) {\n if (at(t) || (t = xt(t)), Et) {\n var n = (this.unsigned ? Et.rem_u : Et.rem_s)(this.low, this.high, t.low, t.high);\n return N(n, Et.get_high(), this.unsigned);\n }\n\n return this.sub(this.div(t).mul(t));\n};\n\n_.mod = _.modulo;\n_.rem = _.modulo;\n\n_.not = function () {\n return N(~this.low, ~this.high, this.unsigned);\n};\n\n_.countLeadingZeros = function () {\n return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;\n};\n\n_.clz = _.countLeadingZeros;\n\n_.countTrailingZeros = function () {\n return this.low ? to(this.low) : to(this.high) + 32;\n};\n\n_.ctz = _.countTrailingZeros;\n\n_.and = function (t) {\n return at(t) || (t = xt(t)), N(this.low & t.low, this.high & t.high, this.unsigned);\n};\n\n_.or = function (t) {\n return at(t) || (t = xt(t)), N(this.low | t.low, this.high | t.high, this.unsigned);\n};\n\n_.xor = function (t) {\n return at(t) || (t = xt(t)), N(this.low ^ t.low, this.high ^ t.high, this.unsigned);\n};\n\n_.shiftLeft = function (t) {\n return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low << t, this.high << t | this.low >>> 32 - t, this.unsigned) : N(0, this.low << t - 32, this.unsigned);\n};\n\n_.shl = _.shiftLeft;\n\n_.shiftRight = function (t) {\n return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low >>> t | this.high << 32 - t, this.high >> t, this.unsigned) : N(this.high >> t - 32, this.high >= 0 ? 0 : -1, this.unsigned);\n};\n\n_.shr = _.shiftRight;\n\n_.shiftRightUnsigned = function (t) {\n return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low >>> t | this.high << 32 - t, this.high >>> t, this.unsigned) : t === 32 ? N(this.high, 0, this.unsigned) : N(this.high >>> t - 32, 0, this.unsigned);\n};\n\n_.shru = _.shiftRightUnsigned;\n_.shr_u = _.shiftRightUnsigned;\n\n_.rotateLeft = function (t) {\n var n;\n return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t === 32 ? N(this.high, this.low, this.unsigned) : t < 32 ? (n = 32 - t, N(this.low << t | this.high >>> n, this.high << t | this.low >>> n, this.unsigned)) : (t -= 32, n = 32 - t, N(this.high << t | this.low >>> n, this.low << t | this.high >>> n, this.unsigned));\n};\n\n_.rotl = _.rotateLeft;\n\n_.rotateRight = function (t) {\n var n;\n return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t === 32 ? N(this.high, this.low, this.unsigned) : t < 32 ? (n = 32 - t, N(this.high << n | this.low >>> t, this.low << n | this.high >>> t, this.unsigned)) : (t -= 32, n = 32 - t, N(this.low << n | this.high >>> t, this.high << n | this.low >>> t, this.unsigned));\n};\n\n_.rotr = _.rotateRight;\n\n_.toSigned = function () {\n return this.unsigned ? N(this.low, this.high, !1) : this;\n};\n\n_.toUnsigned = function () {\n return this.unsigned ? this : N(this.low, this.high, !0);\n};\n\n_.toBytes = function (t) {\n return t ? this.toBytesLE() : this.toBytesBE();\n};\n\n_.toBytesLE = function () {\n var t = this.high,\n n = this.low;\n return [n & 255, n >>> 8 & 255, n >>> 16 & 255, n >>> 24, t & 255, t >>> 8 & 255, t >>> 16 & 255, t >>> 24];\n};\n\n_.toBytesBE = function () {\n var t = this.high,\n n = this.low;\n return [t >>> 24, t >>> 16 & 255, t >>> 8 & 255, t & 255, n >>> 24, n >>> 16 & 255, n >>> 8 & 255, n & 255];\n};\n\nH.fromBytes = function (t, n, s) {\n return s ? H.fromBytesLE(t, n) : H.fromBytesBE(t, n);\n};\n\nH.fromBytesLE = function (t, n) {\n return new H(t[0] | t[1] << 8 | t[2] << 16 | t[3] << 24, t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24, n);\n};\n\nH.fromBytesBE = function (t, n) {\n return new H(t[4] << 24 | t[5] << 16 | t[6] << 8 | t[7], t[0] << 24 | t[1] << 16 | t[2] << 8 | t[3], n);\n};\n\nconst hp = 16;\n\nfunction gc(e) {\n e === \"X\" && (e = \"\");\n const t = e.padEnd(hp, \"0\");\n return H.fromString(t, !0, 16);\n}\n\nfunction fp(e) {\n if (e.isZero()) return \"X\";\n let t = e.countTrailingZeros();\n const n = t % 4;\n t = (t - n) / 4;\n const s = t;\n t *= 4;\n const i = e.shiftRightUnsigned(t).toString(16).replace(/0+$/, \"\");\n return Array(17 - s - i.length).join(\"0\") + i;\n}\n\nfunction dp(e, t) {\n const n = mp(e).shiftRightUnsigned(2);\n return e.add(H.fromNumber(2 * t + 1 - 4).multiply(n));\n}\n\nfunction mp(e) {\n return e.and(e.not().add(1));\n}\n\nconst gp = 3,\n Ap = 30,\n pp = 2 * Ap + 1,\n oo = 180 / Math.PI;\n\nfunction yp(e) {\n if (e.length === 0) throw new Error(`Invalid Hilbert quad key ${e}`);\n const t = e.split(\"/\"),\n n = parseInt(t[0], 10),\n s = t[1],\n r = s.length;\n let i = 0;\n const o = [0, 0];\n\n for (let a = r - 1; a >= 0; a--) {\n i = r - a;\n const c = s[a];\n let u = 0,\n l = 0;\n c === \"1\" ? l = 1 : c === \"2\" ? (u = 1, l = 1) : c === \"3\" && (u = 1);\n const h = Math.pow(2, i - 1);\n Cp(h, o, u, l), o[0] += h * u, o[1] += h * l;\n }\n\n if (n % 2 === 1) {\n const a = o[0];\n o[0] = o[1], o[1] = a;\n }\n\n return {\n face: n,\n ij: o,\n level: i\n };\n}\n\nfunction Bp(e) {\n if (e.isZero()) return \"\";\n let t = e.toString(2);\n\n for (; t.length < gp + pp;) t = \"0\" + t;\n\n const n = t.lastIndexOf(\"1\"),\n s = t.substring(0, 3),\n r = t.substring(3, n),\n i = r.length / 2,\n o = H.fromString(s, !0, 2).toString(10);\n let a = \"\";\n if (i !== 0) for (a = H.fromString(r, !0, 2).toString(4); a.length < i;) a = \"0\" + a;\n return `${o}/${a}`;\n}\n\nfunction Ac(e, t, n) {\n const s = 1 << t;\n return [(e[0] + n[0]) / s, (e[1] + n[1]) / s];\n}\n\nfunction ao(e) {\n return e >= 0.5 ? 1 / 3 * (4 * e * e - 1) : 1 / 3 * (1 - 4 * (1 - e) * (1 - e));\n}\n\nfunction pc(e) {\n return [ao(e[0]), ao(e[1])];\n}\n\nfunction yc(e, t) {\n let [n, s] = t;\n\n switch (e) {\n case 0:\n return [1, n, s];\n\n case 1:\n return [-n, 1, s];\n\n case 2:\n return [-n, -s, 1];\n\n case 3:\n return [-1, -s, -n];\n\n case 4:\n return [s, -1, -n];\n\n case 5:\n return [s, n, -1];\n\n default:\n throw new Error(\"Invalid face\");\n }\n}\n\nfunction Bc(e) {\n let [t, n, s] = e;\n const r = Math.atan2(s, Math.sqrt(t * t + n * n));\n return [Math.atan2(n, t) * oo, r * oo];\n}\n\nfunction Cp(e, t, n, s) {\n if (s === 0) {\n n === 1 && (t[0] = e - 1 - t[0], t[1] = e - 1 - t[1]);\n const r = t[0];\n t[0] = t[1], t[1] = r;\n }\n}\n\nfunction Ep(e) {\n const t = Ac(e.ij, e.level, [0.5, 0.5]),\n n = pc(t),\n s = yc(e.face, n);\n return Bc(s);\n}\n\nconst Tp = 100;\n\nfunction co(e) {\n const {\n face: t,\n ij: n,\n level: s\n } = e,\n r = [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]],\n i = Math.max(1, Math.ceil(Tp * Math.pow(2, -s))),\n o = new Float64Array(4 * i * 2 + 2);\n let a = 0,\n c = 0;\n\n for (let u = 0; u < 4; u++) {\n const l = r[u].slice(0),\n h = r[u + 1],\n f = (h[0] - l[0]) / i,\n d = (h[1] - l[1]) / i;\n\n for (let m = 0; m < i; m++) {\n l[0] += f, l[1] += d;\n const g = Ac(n, s, l),\n y = pc(g),\n E = yc(t, y),\n R = Bc(E);\n Math.abs(R[1]) > 89.999 && (R[0] = c);\n const B = R[0] - c;\n R[0] += B > 180 ? -360 : B < -180 ? 360 : 0, o[a++] = R[0], o[a++] = R[1], c = R[0];\n }\n }\n\n return o[a++] = o[0], o[a++] = o[1], o;\n}\n\nfunction Gr(e) {\n const t = bp(e);\n return yp(t);\n}\n\nfunction bp(e) {\n if (e.indexOf(\"/\") > 0) return e;\n const t = gc(e);\n return Bp(t);\n}\n\nfunction _p(e) {\n const t = Gr(e);\n return Ep(t);\n}\n\nfunction wp(e) {\n let t;\n\n if (e.face === 2 || e.face === 5) {\n let n = null,\n s = 0;\n\n for (let r = 0; r < 4; r++) {\n const i = `${e.face}/${r}`,\n o = Gr(i),\n a = co(o);\n (typeof n > \"u\" || n === null) && (n = new Float64Array(4 * a.length)), n.set(a, s), s += a.length;\n }\n\n t = uo(n);\n } else {\n const n = co(e);\n t = uo(n);\n }\n\n return t;\n}\n\nfunction uo(e) {\n if (e.length % 2 !== 0) throw new Error(\"Invalid corners\");\n const t = [],\n n = [];\n\n for (let s = 0; s < e.length; s += 2) t.push(e[s]), n.push(e[s + 1]);\n\n return t.sort((s, r) => s - r), n.sort((s, r) => s - r), {\n west: t[0],\n east: t[t.length - 1],\n north: n[n.length - 1],\n south: n[0]\n };\n}\n\nfunction Rp(e, t) {\n const n = (t == null ? void 0 : t.minimumHeight) || 0,\n s = (t == null ? void 0 : t.maximumHeight) || 0,\n r = Gr(e),\n i = wp(r),\n o = i.west,\n a = i.south,\n c = i.east,\n u = i.north,\n l = [];\n return l.push(new A(o, u, n)), l.push(new A(c, u, n)), l.push(new A(c, a, n)), l.push(new A(o, a, n)), l.push(new A(o, u, s)), l.push(new A(c, u, s)), l.push(new A(c, a, s)), l.push(new A(o, a, s)), l;\n}\n\nfunction Cc(e) {\n const t = e.token,\n n = {\n minimumHeight: e.minimumHeight,\n maximumHeight: e.maximumHeight\n },\n s = Rp(t, n),\n r = _p(t),\n i = r[0],\n o = r[1],\n a = J.WGS84.cartographicToCartesian([i, o, n.maximumHeight]),\n c = new A(a[0], a[1], a[2]);\n\n s.push(c);\n const u = Rd(s);\n return [...u.center, ...u.halfAxes];\n}\n\nconst Mp = 4,\n Sp = 8,\n Ip = {\n QUADTREE: Mp,\n OCTREE: Sp\n};\n\nfunction xp(e, t, n) {\n if (e != null && e.box) {\n const s = gc(e.s2VolumeInfo.token),\n r = dp(s, t),\n i = fp(r),\n o = { ...e.s2VolumeInfo\n };\n\n switch (o.token = i, n) {\n case \"OCTREE\":\n const u = e.s2VolumeInfo,\n l = u.maximumHeight - u.minimumHeight,\n h = l / 2,\n f = u.minimumHeight + l / 2;\n u.minimumHeight = f - h, u.maximumHeight = f + h;\n break;\n }\n\n return {\n box: Cc(o),\n s2VolumeInfo: o\n };\n }\n}\n\nasync function Ec(e) {\n const {\n implicitOptions: t,\n parentData: n = {\n mortonIndex: 0,\n x: 0,\n y: 0,\n z: 0\n },\n childIndex: s = 0,\n s2VolumeBox: r,\n loaderOptions: i\n } = e;\n let {\n subtree: o,\n level: a = 0,\n globalData: c = {\n level: 0,\n mortonIndex: 0,\n x: 0,\n y: 0,\n z: 0\n }\n } = e;\n const {\n subdivisionScheme: u,\n subtreeLevels: l,\n maximumLevel: h,\n contentUrlTemplate: f,\n subtreesUriTemplate: d,\n basePath: m\n } = t,\n g = {\n children: [],\n lodMetricValue: 0,\n contentUrl: \"\"\n };\n if (!h) return aa.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`), g;\n const y = a + c.level;\n if (y > h) return g;\n const E = Ip[u],\n R = Math.log2(E),\n B = s & 1,\n C = s >> 1 & 1,\n M = s >> 2 & 1,\n b = (E ** a - 1) / (E - 1);\n let O = Qt(n.mortonIndex, s, R),\n F = b + O,\n v = Qt(n.x, B, 1),\n L = Qt(n.y, C, 1),\n k = Qt(n.z, M, 1),\n q = !1;\n a >= l && (q = Ss(o.childSubtreeAvailability, O));\n const Y = Qt(c.x, v, a),\n P = Qt(c.y, L, a),\n ct = Qt(c.z, k, a);\n\n if (q) {\n const st = `${m}/${d}`,\n Pt = er(st, y, Y, P, ct);\n o = await Ae(Pt, lc, i), c = {\n mortonIndex: O,\n x: v,\n y: L,\n z: k,\n level: a\n }, O = 0, F = 0, v = 0, L = 0, k = 0, a = 0;\n }\n\n if (!Ss(o.tileAvailability, F)) return g;\n Ss(o.contentAvailability, F) && (g.contentUrl = er(f, y, Y, P, ct));\n const Be = a + 1,\n vt = {\n mortonIndex: O,\n x: v,\n y: L,\n z: k\n };\n\n for (let st = 0; st < E; st++) {\n const Pt = xp(r, st, u),\n Xt = await Ec({\n subtree: o,\n implicitOptions: t,\n loaderOptions: i,\n parentData: vt,\n childIndex: st,\n level: Be,\n globalData: { ...c\n },\n s2VolumeBox: Pt\n });\n\n if (Xt.contentUrl || Xt.children.length) {\n const Ce = y + 1,\n es = vp(Xt, Ce, {\n childTileX: v,\n childTileY: L,\n childTileZ: k\n }, t, r);\n g.children.push(es);\n }\n }\n\n return g;\n}\n\nfunction Ss(e, t) {\n let n;\n return Array.isArray(e) ? (n = e[0], e.length > 1 && aa.once('Not supported extension \"3DTILES_multiple_contents\" has been detected')) : n = e, \"constant\" in n ? !!n.constant : n.explicitBitstream ? Dp(t, n.explicitBitstream) : !1;\n}\n\nfunction vp(e, t, n, s, r) {\n const {\n basePath: i,\n refine: o,\n getRefine: a,\n lodMetricType: c,\n getTileType: u,\n rootLodMetricValue: l,\n rootBoundingVolume: h\n } = s,\n f = e.contentUrl && e.contentUrl.replace(`${i}/`, \"\"),\n d = l / 2 ** t,\n m = r != null && r.box ? {\n box: r.box\n } : h,\n g = Op(t, m, n);\n return {\n children: e.children,\n contentUrl: e.contentUrl,\n content: {\n uri: f\n },\n id: e.contentUrl,\n refine: a(o),\n type: u(e),\n lodMetricType: c,\n lodMetricValue: d,\n geometricError: d,\n transform: e.transform,\n boundingVolume: g\n };\n}\n\nfunction Op(e, t, n) {\n if (t.region) {\n const {\n childTileX: s,\n childTileY: r,\n childTileZ: i\n } = n,\n [o, a, c, u, l, h] = t.region,\n f = 2 ** e,\n d = (c - o) / f,\n m = (u - a) / f,\n g = (h - l) / f,\n [y, E] = [o + d * s, o + d * (s + 1)],\n [R, B] = [a + m * r, a + m * (r + 1)],\n [C, M] = [l + g * i, l + g * (i + 1)];\n return {\n region: [y, R, E, B, C, M]\n };\n }\n\n if (t.box) return t;\n throw new Error(`Unsupported bounding volume type ${t}`);\n}\n\nfunction Qt(e, t, n) {\n return (e << n) + t;\n}\n\nfunction er(e, t, n, s, r) {\n const i = Fp({\n level: t,\n x: n,\n y: s,\n z: r\n });\n return e.replace(/{level}|{x}|{y}|{z}/gi, o => i[o]);\n}\n\nfunction Fp(e) {\n const t = {};\n\n for (const n in e) t[`{${n}}`] = e[n];\n\n return t;\n}\n\nfunction Dp(e, t) {\n const n = Math.floor(e / 8),\n s = e % 8;\n return (t[n] >> s & 1) === 1;\n}\n\nfunction Nr(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"\";\n if (!t) return dn.EMPTY;\n const s = t.split(\"?\")[0].split(\".\").pop();\n\n switch (s) {\n case \"pnts\":\n return dn.POINTCLOUD;\n\n case \"i3dm\":\n case \"b3dm\":\n case \"glb\":\n case \"gltf\":\n return dn.SCENEGRAPH;\n\n default:\n return s || dn.EMPTY;\n }\n}\n\nfunction Ur(e) {\n switch (e) {\n case \"REPLACE\":\n case \"replace\":\n return Ii.REPLACE;\n\n case \"ADD\":\n case \"add\":\n return Ii.ADD;\n\n default:\n return e;\n }\n}\n\nfunction nr(e, t) {\n if (/^[a-z][0-9a-z+.-]*:/i.test(t)) {\n const s = new URL(e, `${t}/`);\n return decodeURI(s.toString());\n } else if (e.startsWith(\"/\")) return e;\n\n return ku(t, e);\n}\n\nfunction lo(e, t) {\n if (!e) return null;\n let n;\n\n if (e.content) {\n var s;\n const i = e.content.uri || ((s = e.content) === null || s === void 0 ? void 0 : s.url);\n typeof i < \"u\" && (n = nr(i, t));\n }\n\n return { ...e,\n id: n,\n contentUrl: n,\n lodMetricType: Qn.GEOMETRIC_ERROR,\n lodMetricValue: e.geometricError,\n transformMatrix: e.transform,\n type: Nr(e, n),\n refine: Ur(e.refine)\n };\n}\n\nasync function Lp(e, t, n) {\n let s = null;\n const r = fo(e.root);\n r && e.root ? s = await ho(e.root, e, t, r, n) : s = lo(e.root, t);\n const i = [];\n\n for (i.push(s); i.length > 0;) {\n const o = i.pop() || {},\n a = o.children || [],\n c = [];\n\n for (const u of a) {\n const l = fo(u);\n let h;\n l ? h = await ho(u, e, t, l, n) : h = lo(u, t), h && (c.push(h), i.push(h));\n }\n\n o.children = c;\n }\n\n return s;\n}\n\nasync function ho(e, t, n, s, r) {\n var i, o, a;\n const {\n subdivisionScheme: c,\n maximumLevel: u,\n availableLevels: l,\n subtreeLevels: h,\n subtrees: {\n uri: f\n }\n } = s,\n d = er(f, 0, 0, 0, 0),\n m = nr(d, n),\n g = await Ae(m, lc, r),\n y = (i = e.content) === null || i === void 0 ? void 0 : i.uri,\n E = y ? nr(y, n) : \"\",\n R = t == null || (o = t.root) === null || o === void 0 ? void 0 : o.refine,\n B = e.geometricError,\n C = (a = e.boundingVolume.extensions) === null || a === void 0 ? void 0 : a[\"3DTILES_bounding_volume_S2\"];\n\n if (C) {\n const F = {\n box: Cc(C),\n s2VolumeInfo: C\n };\n e.boundingVolume = F;\n }\n\n const M = e.boundingVolume,\n b = {\n contentUrlTemplate: E,\n subtreesUriTemplate: f,\n subdivisionScheme: c,\n subtreeLevels: h,\n maximumLevel: Number.isFinite(l) ? l - 1 : u,\n refine: R,\n basePath: n,\n lodMetricType: Qn.GEOMETRIC_ERROR,\n rootLodMetricValue: B,\n rootBoundingVolume: M,\n getTileType: Nr,\n getRefine: Ur\n };\n return await Pp(e, n, g, b, r);\n}\n\nasync function Pp(e, t, n, s, r) {\n if (!e) return null;\n const {\n children: i,\n contentUrl: o\n } = await Ec({\n subtree: n,\n implicitOptions: s,\n loaderOptions: r\n });\n let a,\n c = null;\n return o && (a = o, c = {\n uri: o.replace(`${t}/`, \"\")\n }), { ...e,\n id: a,\n contentUrl: a,\n lodMetricType: Qn.GEOMETRIC_ERROR,\n lodMetricValue: e.geometricError,\n transformMatrix: e.transform,\n type: Nr(e, a),\n refine: Ur(e.refine),\n content: c || e.content,\n children: i\n };\n}\n\nfunction fo(e) {\n var t;\n return (e == null || (t = e.extensions) === null || t === void 0 ? void 0 : t[\"3DTILES_implicit_tiling\"]) || (e == null ? void 0 : e.implicitTiling);\n}\n\nconst Le = {\n id: \"3d-tiles\",\n name: \"3D Tiles\",\n module: \"3d-tiles\",\n version: va,\n extensions: [\"cmpt\", \"pnts\", \"b3dm\", \"i3dm\"],\n mimeTypes: [\"application/octet-stream\"],\n tests: [\"cmpt\", \"pnts\", \"b3dm\", \"i3dm\"],\n parse: Gp,\n options: {\n \"3d-tiles\": {\n loadGLTF: !0,\n decodeQuantizedPositions: !1,\n isTileset: \"auto\",\n assetGltfUpAxis: null\n }\n }\n};\n\nasync function Gp(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},\n n = arguments.length > 2 ? arguments[2] : void 0;\n const s = t[\"3d-tiles\"] || {};\n let r;\n return s.isTileset === \"auto\" ? r = (n == null ? void 0 : n.url) && n.url.indexOf(\".json\") !== -1 : r = s.isTileset, r ? Np(e, t, n) : Up(e, t, n);\n}\n\nasync function Np(e, t, n) {\n var s;\n const r = JSON.parse(new TextDecoder().decode(e)),\n i = (n == null ? void 0 : n.url) || \"\",\n o = Hp(i),\n a = await Lp(r, o, t || {});\n return { ...r,\n shape: \"tileset3d\",\n loader: Le,\n url: i,\n queryString: (n == null ? void 0 : n.queryString) || \"\",\n basePath: o,\n root: a || r.root,\n type: Md.TILES3D,\n lodMetricType: Qn.GEOMETRIC_ERROR,\n lodMetricValue: ((s = r.root) === null || s === void 0 ? void 0 : s.geometricError) || 0\n };\n}\n\nasync function Up(e, t, n) {\n const s = {\n content: {\n shape: \"tile3d\",\n featureIds: null\n }\n };\n return await uc(e, 0, t, n, s.content), s.content;\n}\n\nfunction Hp(e) {\n return ea(e);\n}\n\nconst Tc = \"https://api.cesium.com/v1/assets\";\n\nasync function Jp(e, t) {\n if (!t) {\n const i = await Vp(e);\n\n for (const o of i.items) o.type === \"3DTILES\" && (t = o.id);\n }\n\n const n = await jp(e, t),\n {\n type: s,\n url: r\n } = n;\n return z(s === \"3DTILES\" && r), n.headers = {\n Authorization: `Bearer ${n.accessToken}`\n }, n;\n}\n\nasync function Vp(e) {\n z(e);\n const t = Tc,\n n = {\n Authorization: `Bearer ${e}`\n },\n s = await Ge(t, {\n headers: n\n });\n if (!s.ok) throw new Error(s.statusText);\n return await s.json();\n}\n\nasync function jp(e, t) {\n z(e, t);\n const n = {\n Authorization: `Bearer ${e}`\n },\n s = `${Tc}/${t}`;\n let r = await Ge(`${s}`, {\n headers: n\n });\n if (!r.ok) throw new Error(r.statusText);\n let i = await r.json();\n if (r = await Ge(`${s}/endpoint`, {\n headers: n\n }), !r.ok) throw new Error(r.statusText);\n const o = await r.json();\n return i = { ...i,\n ...o\n }, i;\n}\n\nasync function kp(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n t = t[\"cesium-ion\"] || {};\n const {\n accessToken: n\n } = t;\n let s = t.assetId;\n\n if (!Number.isFinite(s)) {\n const r = e.match(/\\/([0-9]+)\\/tileset.json/);\n s = r && r[1];\n }\n\n return Jp(n, s);\n}\n\nconst bc = { ...Le,\n id: \"cesium-ion\",\n name: \"Cesium Ion\",\n preload: kp,\n parse: async (e, t, n) => (t = { ...t\n }, t[\"3d-tiles\"] = t[\"cesium-ion\"], t.loader = bc, Le.parse(e, t, n)),\n options: {\n \"cesium-ion\": { ...Le.options[\"3d-tiles\"],\n accessToken: null\n }\n }\n},\n mo = 100;\n\nclass Kp {\n constructor(t, n) {\n if (this.schema = void 0, this.options = void 0, this.shape = void 0, this.length = 0, this.rows = null, this.cursor = 0, this._headers = [], this.options = n, this.schema = t, !Array.isArray(t)) {\n this._headers = [];\n\n for (const s in t) this._headers[t[s].index] = t[s].name;\n }\n }\n\n rowCount() {\n return this.length;\n }\n\n addArrayRow(t, n) {\n Number.isFinite(n) && (this.cursor = n), this.shape = \"array-row-table\", this.rows = this.rows || new Array(mo), this.rows[this.length] = t, this.length++;\n }\n\n addObjectRow(t, n) {\n Number.isFinite(n) && (this.cursor = n), this.shape = \"object-row-table\", this.rows = this.rows || new Array(mo), this.rows[this.length] = t, this.length++;\n }\n\n getBatch() {\n let t = this.rows;\n return t ? (t = t.slice(0, this.length), this.rows = null, {\n shape: this.shape || \"array-row-table\",\n batchType: \"data\",\n data: t,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n }) : null;\n }\n\n}\n\nfunction zp(e, t) {\n if (!e) throw new Error(\"null row\");\n const n = {};\n if (t) for (let s = 0; s < t.length; s++) n[t[s]] = e[s];else for (let s = 0; s < e.length; s++) {\n const r = `column-${s}`;\n n[r] = e[s];\n }\n return n;\n}\n\nfunction Wp(e, t) {\n if (!e) throw new Error(\"null row\");\n\n if (t) {\n const n = new Array(t.length);\n\n for (let s = 0; s < t.length; s++) n[s] = e[t[s]];\n\n return n;\n }\n\n return Object.values(e);\n}\n\nfunction Xp(e) {\n const t = [];\n\n for (let n = 0; n < e.length; n++) {\n const s = `column-${n}`;\n t.push(s);\n }\n\n return t;\n}\n\nfunction Qp(e) {\n return Object.keys(e);\n}\n\nconst go = 100;\n\nclass qp {\n constructor(t, n) {\n if (this.schema = void 0, this.options = void 0, this.length = 0, this.objectRows = null, this.arrayRows = null, this.cursor = 0, this._headers = null, this.options = n, this.schema = t, t) {\n this._headers = [];\n\n for (const s in t) this._headers[t[s].index] = t[s].name;\n }\n }\n\n rowCount() {\n return this.length;\n }\n\n addArrayRow(t, n) {\n switch (Number.isFinite(n) && (this.cursor = n), this._headers || (this._headers = Xp(t)), this.options.shape) {\n case \"object-row-table\":\n const s = zp(t, this._headers);\n this.addObjectRow(s, n);\n break;\n\n case \"array-row-table\":\n this.arrayRows = this.arrayRows || new Array(go), this.arrayRows[this.length] = t, this.length++;\n break;\n }\n }\n\n addObjectRow(t, n) {\n switch (Number.isFinite(n) && (this.cursor = n), this._headers || (this._headers = Qp(t)), this.options.shape) {\n case \"array-row-table\":\n const s = Wp(t, this._headers);\n this.addArrayRow(s, n);\n break;\n\n case \"object-row-table\":\n this.objectRows = this.objectRows || new Array(go), this.objectRows[this.length] = t, this.length++;\n break;\n }\n }\n\n getBatch() {\n let t = this.arrayRows || this.objectRows;\n return t ? (t = t.slice(0, this.length), this.arrayRows = null, this.objectRows = null, {\n shape: this.options.shape,\n batchType: \"data\",\n data: t,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n }) : null;\n }\n\n}\n\nconst Yp = 100;\n\nclass $p {\n constructor(t, n) {\n this.schema = void 0, this.length = 0, this.allocated = 0, this.columns = {}, this.schema = t, this._reallocateColumns();\n }\n\n rowCount() {\n return this.length;\n }\n\n addArrayRow(t) {\n this._reallocateColumns();\n\n let n = 0;\n\n for (const s in this.columns) this.columns[s][this.length] = t[n++];\n\n this.length++;\n }\n\n addObjectRow(t) {\n this._reallocateColumns();\n\n for (const n in t) this.columns[n][this.length] = t[n];\n\n this.length++;\n }\n\n getBatch() {\n this._pruneColumns();\n\n const t = Array.isArray(this.schema) ? this.columns : {};\n if (!Array.isArray(this.schema)) for (const s in this.schema) {\n const r = this.schema[s];\n t[r.name] = this.columns[r.index];\n }\n return this.columns = {}, {\n shape: \"columnar-table\",\n batchType: \"data\",\n data: t,\n schema: this.schema,\n length: this.length\n };\n }\n\n _reallocateColumns() {\n if (!(this.length < this.allocated)) {\n this.allocated = this.allocated > 0 ? this.allocated *= 2 : Yp, this.columns = {};\n\n for (const t in this.schema) {\n const n = this.schema[t],\n s = n.type || Float32Array,\n r = this.columns[n.index];\n\n if (r && ArrayBuffer.isView(r)) {\n const i = new s(this.allocated);\n i.set(r), this.columns[n.index] = i;\n } else r ? (r.length = this.allocated, this.columns[n.index] = r) : this.columns[n.index] = new s(this.allocated);\n }\n }\n }\n\n _pruneColumns() {\n for (const [t, n] of Object.entries(this.columns)) this.columns[t] = n.slice(0, this.length);\n }\n\n}\n\nconst Zp = {\n shape: void 0,\n batchSize: \"auto\",\n batchDebounceMs: 0,\n limit: 0,\n _limitMB: 0\n},\n ty = \"TableBatchBuilder\";\n\nclass He {\n constructor(t, n) {\n this.schema = void 0, this.options = void 0, this.aggregator = null, this.batchCount = 0, this.bytesUsed = 0, this.isChunkComplete = !1, this.lastBatchEmittedMs = Date.now(), this.totalLength = 0, this.totalBytes = 0, this.rowBytes = 0, this.schema = t, this.options = { ...Zp,\n ...n\n };\n }\n\n limitReached() {\n var t, n;\n return !!(!((t = this.options) === null || t === void 0) && t.limit && this.totalLength >= this.options.limit || !((n = this.options) === null || n === void 0) && n._limitMB && this.totalBytes / 1e6 >= this.options._limitMB);\n }\n\n addRow(t) {\n this.limitReached() || (this.totalLength++, this.rowBytes = this.rowBytes || this._estimateRowMB(t), this.totalBytes += this.rowBytes, Array.isArray(t) ? this.addArrayRow(t) : this.addObjectRow(t));\n }\n\n addArrayRow(t) {\n if (!this.aggregator) {\n const n = this._getTableBatchType();\n\n this.aggregator = new n(this.schema, this.options);\n }\n\n this.aggregator.addArrayRow(t);\n }\n\n addObjectRow(t) {\n if (!this.aggregator) {\n const n = this._getTableBatchType();\n\n this.aggregator = new n(this.schema, this.options);\n }\n\n this.aggregator.addObjectRow(t);\n }\n\n chunkComplete(t) {\n t instanceof ArrayBuffer && (this.bytesUsed += t.byteLength), typeof t == \"string\" && (this.bytesUsed += t.length), this.isChunkComplete = !0;\n }\n\n getFullBatch(t) {\n return this._isFull() ? this._getBatch(t) : null;\n }\n\n getFinalBatch(t) {\n return this._getBatch(t);\n }\n\n _estimateRowMB(t) {\n return Array.isArray(t) ? t.length * 8 : Object.keys(t).length * 8;\n }\n\n _isFull() {\n if (!this.aggregator || this.aggregator.rowCount() === 0) return !1;\n\n if (this.options.batchSize === \"auto\") {\n if (!this.isChunkComplete) return !1;\n } else if (this.options.batchSize > this.aggregator.rowCount()) return !1;\n\n return this.options.batchDebounceMs > Date.now() - this.lastBatchEmittedMs ? !1 : (this.isChunkComplete = !1, this.lastBatchEmittedMs = Date.now(), !0);\n }\n\n _getBatch(t) {\n if (!this.aggregator) return null;\n t != null && t.bytesUsed && (this.bytesUsed = t.bytesUsed);\n const n = this.aggregator.getBatch();\n return n.count = this.batchCount, n.bytesUsed = this.bytesUsed, Object.assign(n, t), this.batchCount++, this.aggregator = null, n;\n }\n\n _getTableBatchType() {\n switch (this.options.shape) {\n case \"array-row-table\":\n case \"object-row-table\":\n return qp;\n\n case \"columnar-table\":\n return $p;\n\n case \"arrow-table\":\n if (!He.ArrowBatch) throw new Error(ty);\n return He.ArrowBatch;\n\n default:\n return Kp;\n }\n }\n\n}\n\nHe.ArrowBatch = void 0;\n\nfunction ey(e) {\n try {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n return async function* () {\n const n = new TextDecoder(void 0, t);\n\n for await (const s of e) yield typeof s == \"string\" ? s : n.decode(s, {\n stream: !0\n });\n }();\n } catch (t) {\n return Promise.reject(t);\n }\n}\n\nconst sr = Number.MAX_SAFE_INTEGER;\n\nvar S = function (e) {\n return e[e.BEGIN = 0] = \"BEGIN\", e[e.VALUE = 1] = \"VALUE\", e[e.OPEN_OBJECT = 2] = \"OPEN_OBJECT\", e[e.CLOSE_OBJECT = 3] = \"CLOSE_OBJECT\", e[e.OPEN_ARRAY = 4] = \"OPEN_ARRAY\", e[e.CLOSE_ARRAY = 5] = \"CLOSE_ARRAY\", e[e.TEXT_ESCAPE = 6] = \"TEXT_ESCAPE\", e[e.STRING = 7] = \"STRING\", e[e.BACKSLASH = 8] = \"BACKSLASH\", e[e.END = 9] = \"END\", e[e.OPEN_KEY = 10] = \"OPEN_KEY\", e[e.CLOSE_KEY = 11] = \"CLOSE_KEY\", e[e.TRUE = 12] = \"TRUE\", e[e.TRUE2 = 13] = \"TRUE2\", e[e.TRUE3 = 14] = \"TRUE3\", e[e.FALSE = 15] = \"FALSE\", e[e.FALSE2 = 16] = \"FALSE2\", e[e.FALSE3 = 17] = \"FALSE3\", e[e.FALSE4 = 18] = \"FALSE4\", e[e.NULL = 19] = \"NULL\", e[e.NULL2 = 20] = \"NULL2\", e[e.NULL3 = 21] = \"NULL3\", e[e.NUMBER_DECIMAL_POINT = 22] = \"NUMBER_DECIMAL_POINT\", e[e.NUMBER_DIGIT = 23] = \"NUMBER_DIGIT\", e;\n}(S || {});\n\nconst I = {\n tab: 9,\n lineFeed: 10,\n carriageReturn: 13,\n space: 32,\n doubleQuote: 34,\n plus: 43,\n comma: 44,\n minus: 45,\n period: 46,\n _0: 48,\n _9: 57,\n colon: 58,\n E: 69,\n openBracket: 91,\n backslash: 92,\n closeBracket: 93,\n a: 97,\n b: 98,\n e: 101,\n f: 102,\n l: 108,\n n: 110,\n r: 114,\n s: 115,\n t: 116,\n u: 117,\n openBrace: 123,\n closeBrace: 125\n},\n Ao = /[\\\\\"\\n]/g,\n po = {\n onready: () => {},\n onopenobject: () => {},\n onkey: () => {},\n oncloseobject: () => {},\n onopenarray: () => {},\n onclosearray: () => {},\n onvalue: () => {},\n onerror: () => {},\n onend: () => {},\n onchunkparsed: () => {}\n};\n\nclass ny {\n constructor() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n this.options = po, this.bufferCheckPosition = sr, this.q = \"\", this.c = \"\", this.p = \"\", this.closed = !1, this.closedRoot = !1, this.sawRoot = !1, this.error = null, this.state = S.BEGIN, this.stack = [], this.position = 0, this.column = 0, this.line = 1, this.slashed = !1, this.unicodeI = 0, this.unicodeS = null, this.depth = 0, this.textNode = void 0, this.numberNode = void 0, this.options = { ...po,\n ...t\n }, this.textNode = void 0, this.numberNode = \"\", this.emit(\"onready\");\n }\n\n end() {\n return (this.state !== S.VALUE || this.depth !== 0) && this._error(\"Unexpected end\"), this._closeValue(), this.c = \"\", this.closed = !0, this.emit(\"onend\"), this;\n }\n\n resume() {\n return this.error = null, this;\n }\n\n close() {\n return this.write(null);\n }\n\n emit(t, n) {\n var s, r;\n (s = (r = this.options)[t]) === null || s === void 0 || s.call(r, n, this);\n }\n\n emitNode(t, n) {\n this._closeValue(), this.emit(t, n);\n }\n\n write(t) {\n if (this.error) throw this.error;\n if (this.closed) return this._error(\"Cannot write after close. Assign an onready handler.\");\n if (t === null) return this.end();\n let n = 0,\n s = t.charCodeAt(0),\n r = this.p;\n\n for (; s && (r = s, this.c = s = t.charCodeAt(n++), r !== s ? this.p = r : r = this.p, !!s);) switch (this.position++, s === I.lineFeed ? (this.line++, this.column = 0) : this.column++, this.state) {\n case S.BEGIN:\n s === I.openBrace ? this.state = S.OPEN_OBJECT : s === I.openBracket ? this.state = S.OPEN_ARRAY : Se(s) || this._error(\"Non-whitespace before {[.\");\n continue;\n\n case S.OPEN_KEY:\n case S.OPEN_OBJECT:\n if (Se(s)) continue;\n if (this.state === S.OPEN_KEY) this.stack.push(S.CLOSE_KEY);else if (s === I.closeBrace) {\n this.emit(\"onopenobject\"), this.depth++, this.emit(\"oncloseobject\"), this.depth--, this.state = this.stack.pop() || S.VALUE;\n continue;\n } else this.stack.push(S.CLOSE_OBJECT);\n s === I.doubleQuote ? this.state = S.STRING : this._error('Malformed object key should start with \"');\n continue;\n\n case S.CLOSE_KEY:\n case S.CLOSE_OBJECT:\n if (Se(s)) continue;\n s === I.colon ? (this.state === S.CLOSE_OBJECT ? (this.stack.push(S.CLOSE_OBJECT), this._closeValue(\"onopenobject\"), this.depth++) : this._closeValue(\"onkey\"), this.state = S.VALUE) : s === I.closeBrace ? (this.emitNode(\"oncloseobject\"), this.depth--, this.state = this.stack.pop() || S.VALUE) : s === I.comma ? (this.state === S.CLOSE_OBJECT && this.stack.push(S.CLOSE_OBJECT), this._closeValue(), this.state = S.OPEN_KEY) : this._error(\"Bad object\");\n continue;\n\n case S.OPEN_ARRAY:\n case S.VALUE:\n if (Se(s)) continue;\n if (this.state === S.OPEN_ARRAY) if (this.emit(\"onopenarray\"), this.depth++, this.state = S.VALUE, s === I.closeBracket) {\n this.emit(\"onclosearray\"), this.depth--, this.state = this.stack.pop() || S.VALUE;\n continue;\n } else this.stack.push(S.CLOSE_ARRAY);\n s === I.doubleQuote ? this.state = S.STRING : s === I.openBrace ? this.state = S.OPEN_OBJECT : s === I.openBracket ? this.state = S.OPEN_ARRAY : s === I.t ? this.state = S.TRUE : s === I.f ? this.state = S.FALSE : s === I.n ? this.state = S.NULL : s === I.minus ? this.numberNode += \"-\" : I._0 <= s && s <= I._9 ? (this.numberNode += String.fromCharCode(s), this.state = S.NUMBER_DIGIT) : this._error(\"Bad value\");\n continue;\n\n case S.CLOSE_ARRAY:\n if (s === I.comma) this.stack.push(S.CLOSE_ARRAY), this._closeValue(\"onvalue\"), this.state = S.VALUE;else if (s === I.closeBracket) this.emitNode(\"onclosearray\"), this.depth--, this.state = this.stack.pop() || S.VALUE;else {\n if (Se(s)) continue;\n\n this._error(\"Bad array\");\n }\n continue;\n\n case S.STRING:\n this.textNode === void 0 && (this.textNode = \"\");\n let i = n - 1,\n o = this.slashed,\n a = this.unicodeI;\n\n t: for (;;) {\n for (; a > 0;) if (this.unicodeS += String.fromCharCode(s), s = t.charCodeAt(n++), this.position++, a === 4 ? (this.textNode += String.fromCharCode(parseInt(this.unicodeS, 16)), a = 0, i = n - 1) : a++, !s) break t;\n\n if (s === I.doubleQuote && !o) {\n this.state = this.stack.pop() || S.VALUE, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i;\n break;\n }\n\n if (s === I.backslash && !o && (o = !0, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i, s = t.charCodeAt(n++), this.position++, !s)) break;\n\n if (o) {\n if (o = !1, s === I.n ? this.textNode += `\n` : s === I.r ? this.textNode += \"\\r\" : s === I.t ? this.textNode += \"\t\" : s === I.f ? this.textNode += \"\\f\" : s === I.b ? this.textNode += \"\\b\" : s === I.u ? (a = 1, this.unicodeS = \"\") : this.textNode += String.fromCharCode(s), s = t.charCodeAt(n++), this.position++, i = n - 1, s) continue;\n break;\n }\n\n Ao.lastIndex = n;\n const c = Ao.exec(t);\n\n if (c === null) {\n n = t.length + 1, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i;\n break;\n }\n\n if (n = c.index + 1, s = t.charCodeAt(c.index), !s) {\n this.textNode += t.substring(i, n - 1), this.position += n - 1 - i;\n break;\n }\n }\n\n this.slashed = o, this.unicodeI = a;\n continue;\n\n case S.TRUE:\n s === I.r ? this.state = S.TRUE2 : this._error(`Invalid true started with t${s}`);\n continue;\n\n case S.TRUE2:\n s === I.u ? this.state = S.TRUE3 : this._error(`Invalid true started with tr${s}`);\n continue;\n\n case S.TRUE3:\n s === I.e ? (this.emit(\"onvalue\", !0), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid true started with tru${s}`);\n continue;\n\n case S.FALSE:\n s === I.a ? this.state = S.FALSE2 : this._error(`Invalid false started with f${s}`);\n continue;\n\n case S.FALSE2:\n s === I.l ? this.state = S.FALSE3 : this._error(`Invalid false started with fa${s}`);\n continue;\n\n case S.FALSE3:\n s === I.s ? this.state = S.FALSE4 : this._error(`Invalid false started with fal${s}`);\n continue;\n\n case S.FALSE4:\n s === I.e ? (this.emit(\"onvalue\", !1), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid false started with fals${s}`);\n continue;\n\n case S.NULL:\n s === I.u ? this.state = S.NULL2 : this._error(`Invalid null started with n${s}`);\n continue;\n\n case S.NULL2:\n s === I.l ? this.state = S.NULL3 : this._error(`Invalid null started with nu${s}`);\n continue;\n\n case S.NULL3:\n s === I.l ? (this.emit(\"onvalue\", null), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid null started with nul${s}`);\n continue;\n\n case S.NUMBER_DECIMAL_POINT:\n s === I.period ? (this.numberNode += \".\", this.state = S.NUMBER_DIGIT) : this._error(\"Leading zero not followed by .\");\n continue;\n\n case S.NUMBER_DIGIT:\n I._0 <= s && s <= I._9 ? this.numberNode += String.fromCharCode(s) : s === I.period ? (this.numberNode.indexOf(\".\") !== -1 && this._error(\"Invalid number has two dots\"), this.numberNode += \".\") : s === I.e || s === I.E ? ((this.numberNode.indexOf(\"e\") !== -1 || this.numberNode.indexOf(\"E\") !== -1) && this._error(\"Invalid number has two exponential\"), this.numberNode += \"e\") : s === I.plus || s === I.minus ? (r === I.e || r === I.E || this._error(\"Invalid symbol in number\"), this.numberNode += String.fromCharCode(s)) : (this._closeNumber(), n--, this.state = this.stack.pop() || S.VALUE);\n continue;\n\n default:\n this._error(`Unknown state: ${this.state}`);\n\n }\n\n return this.position >= this.bufferCheckPosition && sy(this), this.emit(\"onchunkparsed\"), this;\n }\n\n _closeValue() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \"onvalue\";\n this.textNode !== void 0 && this.emit(t, this.textNode), this.textNode = void 0;\n }\n\n _closeNumber() {\n this.numberNode && this.emit(\"onvalue\", parseFloat(this.numberNode)), this.numberNode = \"\";\n }\n\n _error() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \"\";\n this._closeValue(), t += `\nLine: ${this.line}\nColumn: ${this.column}\nChar: ${this.c}`;\n const n = new Error(t);\n this.error = n, this.emit(\"onerror\", n);\n }\n\n}\n\nfunction Se(e) {\n return e === I.carriageReturn || e === I.lineFeed || e === I.space || e === I.tab;\n}\n\nfunction sy(e) {\n const t = Math.max(sr, 10);\n let n = 0;\n\n for (const s of [\"textNode\", \"numberNode\"]) {\n const r = e[s] === void 0 ? 0 : e[s].length;\n if (r > t) switch (s) {\n case \"text\":\n break;\n\n default:\n e._error(`Max buffer length exceeded: ${s}`);\n\n }\n n = Math.max(n, r);\n }\n\n e.bufferCheckPosition = sr - n + e.position;\n}\n\nclass te {\n constructor() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;\n\n if (this.path = void 0, this.path = [\"$\"], t instanceof te) {\n this.path = [...t.path];\n return;\n }\n\n if (Array.isArray(t)) {\n this.path.push(...t);\n return;\n }\n\n if (typeof t == \"string\" && (this.path = t.split(\".\"), this.path[0] !== \"$\")) throw new Error(\"JSONPaths must start with $\");\n }\n\n clone() {\n return new te(this);\n }\n\n toString() {\n return this.path.join(\".\");\n }\n\n push(t) {\n this.path.push(t);\n }\n\n pop() {\n return this.path.pop();\n }\n\n set(t) {\n this.path[this.path.length - 1] = t;\n }\n\n equals(t) {\n if (!this || !t || this.path.length !== t.path.length) return !1;\n\n for (let n = 0; n < this.path.length; ++n) if (this.path[n] !== t.path[n]) return !1;\n\n return !0;\n }\n\n setFieldAtPath(t, n) {\n const s = [...this.path];\n s.shift();\n const r = s.pop();\n\n for (const i of s) t = t[i];\n\n t[r] = n;\n }\n\n getFieldAtPath(t) {\n const n = [...this.path];\n n.shift();\n const s = n.pop();\n\n for (const r of n) t = t[r];\n\n return t[s];\n }\n\n}\n\nclass ry {\n constructor(t) {\n this.parser = void 0, this.result = void 0, this.previousStates = [], this.currentState = Object.freeze({\n container: [],\n key: null\n }), this.jsonpath = new te(), this.reset(), this.parser = new ny({\n onready: () => {\n this.jsonpath = new te(), this.previousStates.length = 0, this.currentState.container.length = 0;\n },\n onopenobject: n => {\n this._openObject({}), typeof n < \"u\" && this.parser.emit(\"onkey\", n);\n },\n onkey: n => {\n this.jsonpath.set(n), this.currentState.key = n;\n },\n oncloseobject: () => {\n this._closeObject();\n },\n onopenarray: () => {\n this._openArray();\n },\n onclosearray: () => {\n this._closeArray();\n },\n onvalue: n => {\n this._pushOrSet(n);\n },\n onerror: n => {\n throw n;\n },\n onend: () => {\n this.result = this.currentState.container.pop();\n },\n ...t\n });\n }\n\n reset() {\n this.result = void 0, this.previousStates = [], this.currentState = Object.freeze({\n container: [],\n key: null\n }), this.jsonpath = new te();\n }\n\n write(t) {\n this.parser.write(t);\n }\n\n close() {\n this.parser.close();\n }\n\n _pushOrSet(t) {\n const {\n container: n,\n key: s\n } = this.currentState;\n s !== null ? (n[s] = t, this.currentState.key = null) : n.push(t);\n }\n\n _openArray() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];\n this.jsonpath.push(null), this._pushOrSet(t), this.previousStates.push(this.currentState), this.currentState = {\n container: t,\n isArray: !0,\n key: null\n };\n }\n\n _closeArray() {\n this.jsonpath.pop(), this.currentState = this.previousStates.pop();\n }\n\n _openObject() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n this.jsonpath.push(null), this._pushOrSet(t), this.previousStates.push(this.currentState), this.currentState = {\n container: t,\n isArray: !1,\n key: null\n };\n }\n\n _closeObject() {\n this.jsonpath.pop(), this.currentState = this.previousStates.pop();\n }\n\n}\n\nclass iy extends ry {\n constructor() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n super({\n onopenarray: () => {\n if (!this.streamingArray && this._matchJSONPath()) {\n this.streamingJsonPath = this.getJsonPath().clone(), this.streamingArray = [], this._openArray(this.streamingArray);\n return;\n }\n\n this._openArray();\n },\n onopenobject: s => {\n this.topLevelObject ? this._openObject({}) : (this.topLevelObject = {}, this._openObject(this.topLevelObject)), typeof s < \"u\" && this.parser.emit(\"onkey\", s);\n }\n }), this.jsonPaths = void 0, this.streamingJsonPath = null, this.streamingArray = null, this.topLevelObject = null;\n const n = t.jsonpaths || [];\n this.jsonPaths = n.map(s => new te(s));\n }\n\n write(t) {\n super.write(t);\n let n = [];\n return this.streamingArray && (n = [...this.streamingArray], this.streamingArray.length = 0), n;\n }\n\n getPartialResult() {\n return this.topLevelObject;\n }\n\n getStreamingJsonPath() {\n return this.streamingJsonPath;\n }\n\n getStreamingJsonPathAsString() {\n return this.streamingJsonPath && this.streamingJsonPath.toString();\n }\n\n getJsonPath() {\n return this.jsonpath;\n }\n\n _matchJSONPath() {\n const t = this.getJsonPath();\n if (this.jsonPaths.length === 0) return !0;\n\n for (const n of this.jsonPaths) if (n.equals(t)) return !0;\n\n return !1;\n }\n\n}\n\nasync function* oy(e, t) {\n const n = ey(e),\n {\n metadata: s\n } = t,\n {\n jsonpaths: r\n } = t.json || {};\n let i = !0;\n const o = null,\n a = new He(o, t),\n c = new iy({\n jsonpaths: r\n });\n\n for await (const f of n) {\n const d = c.write(f),\n m = d.length > 0 && c.getStreamingJsonPathAsString();\n\n if (d.length > 0 && i) {\n if (s) {\n var u;\n yield {\n shape: (t == null || (u = t.json) === null || u === void 0 ? void 0 : u.shape) || \"array-row-table\",\n batchType: \"partial-result\",\n data: [],\n length: 0,\n bytesUsed: 0,\n container: c.getPartialResult(),\n jsonpath: m\n };\n }\n\n i = !1;\n }\n\n for (const y of d) {\n a.addRow(y);\n const E = a.getFullBatch({\n jsonpath: m\n });\n E && (yield E);\n }\n\n a.chunkComplete(f);\n const g = a.getFullBatch({\n jsonpath: m\n });\n g && (yield g);\n }\n\n const l = c.getStreamingJsonPathAsString(),\n h = a.getFinalBatch({\n jsonpath: l\n });\n h && (yield h), s && (yield {\n shape: \"json\",\n batchType: \"final-result\",\n container: c.getPartialResult(),\n jsonpath: c.getStreamingJsonPathAsString(),\n data: [],\n length: 0\n });\n}\n\nconst Hn = {\n x: 0,\n y: 1,\n z: 2\n};\n\nfunction _c(e, t = {}) {\n const {\n start: n = 0,\n end: s = e.length,\n plane: r = \"xy\"\n } = t,\n i = t.size || 2;\n let o = 0;\n const a = Hn[r[0]],\n c = Hn[r[1]];\n\n for (let u = n, l = s - i; u < s; u += i) o += (e[u + a] - e[l + a]) * (e[u + c] + e[l + c]), l = u;\n\n return o / 2;\n}\n\nfunction ay(e, t, n = 2, s, r = \"xy\") {\n const i = t && t.length,\n o = i ? t[0] * n : e.length;\n let a = wc(e, 0, o, n, !0, s && s[0], r);\n const c = [];\n if (!a || a.next === a.prev) return c;\n let u, l, h, f, d, m, g;\n\n if (i && (a = fy(e, t, a, n, s, r)), e.length > 80 * n) {\n f = l = e[0], d = h = e[1];\n\n for (let y = n; y < o; y += n) m = e[y], g = e[y + 1], m < f && (f = m), g < d && (d = g), m > l && (l = m), g > h && (h = g);\n\n u = Math.max(l - f, h - d), u = u !== 0 ? 32767 / u : 0;\n }\n\n return Je(a, c, n, f, d, u, 0), c;\n}\n\nfunction wc(e, t, n, s, r, i, o) {\n let a, c;\n i === void 0 && (i = _c(e, {\n start: t,\n end: n,\n size: s,\n plane: o\n }));\n let u = Hn[o[0]],\n l = Hn[o[1]];\n if (r === i < 0) for (a = t; a < n; a += s) c = yo(a, e[a + u], e[a + l], c);else for (a = n - s; a >= t; a -= s) c = yo(a, e[a + u], e[a + l], c);\n return c && Zn(c, c.next) && (je(c), c = c.next), c;\n}\n\nfunction ne(e, t) {\n if (!e) return e;\n t || (t = e);\n let n = e,\n s;\n\n do if (s = !1, !n.steiner && (Zn(n, n.next) || W(n.prev, n, n.next) === 0)) {\n if (je(n), n = t = n.prev, n === n.next) break;\n s = !0;\n } else n = n.next; while (s || n !== t);\n\n return t;\n}\n\nfunction Je(e, t, n, s, r, i, o) {\n if (!e) return;\n !o && i && py(e, s, r, i);\n let a = e,\n c,\n u;\n\n for (; e.prev !== e.next;) {\n if (c = e.prev, u = e.next, i ? uy(e, s, r, i) : cy(e)) {\n t.push(c.i / n | 0), t.push(e.i / n | 0), t.push(u.i / n | 0), je(e), e = u.next, a = u.next;\n continue;\n }\n\n if (e = u, e === a) {\n o ? o === 1 ? (e = ly(ne(e), t, n), Je(e, t, n, s, r, i, 2)) : o === 2 && hy(e, t, n, s, r, i) : Je(ne(e), t, n, s, r, i, 1);\n break;\n }\n }\n}\n\nfunction cy(e) {\n const t = e.prev,\n n = e,\n s = e.next;\n if (W(t, n, s) >= 0) return !1;\n const r = t.x,\n i = n.x,\n o = s.x,\n a = t.y,\n c = n.y,\n u = s.y,\n l = r < i ? r < o ? r : o : i < o ? i : o,\n h = a < c ? a < u ? a : u : c < u ? c : u,\n f = r > i ? r > o ? r : o : i > o ? i : o,\n d = a > c ? a > u ? a : u : c > u ? c : u;\n let m = s.next;\n\n for (; m !== t;) {\n if (m.x >= l && m.x <= f && m.y >= h && m.y <= d && me(r, a, i, c, o, u, m.x, m.y) && W(m.prev, m, m.next) >= 0) return !1;\n m = m.next;\n }\n\n return !0;\n}\n\nfunction uy(e, t, n, s) {\n const r = e.prev,\n i = e,\n o = e.next;\n if (W(r, i, o) >= 0) return !1;\n const a = r.x,\n c = i.x,\n u = o.x,\n l = r.y,\n h = i.y,\n f = o.y,\n d = a < c ? a < u ? a : u : c < u ? c : u,\n m = l < h ? l < f ? l : f : h < f ? h : f,\n g = a > c ? a > u ? a : u : c > u ? c : u,\n y = l > h ? l > f ? l : f : h > f ? h : f,\n E = rr(d, m, t, n, s),\n R = rr(g, y, t, n, s);\n let B = e.prevZ,\n C = e.nextZ;\n\n for (; B && B.z >= E && C && C.z <= R;) {\n if (B.x >= d && B.x <= g && B.y >= m && B.y <= y && B !== r && B !== o && me(a, l, c, h, u, f, B.x, B.y) && W(B.prev, B, B.next) >= 0 || (B = B.prevZ, C.x >= d && C.x <= g && C.y >= m && C.y <= y && C !== r && C !== o && me(a, l, c, h, u, f, C.x, C.y) && W(C.prev, C, C.next) >= 0)) return !1;\n C = C.nextZ;\n }\n\n for (; B && B.z >= E;) {\n if (B.x >= d && B.x <= g && B.y >= m && B.y <= y && B !== r && B !== o && me(a, l, c, h, u, f, B.x, B.y) && W(B.prev, B, B.next) >= 0) return !1;\n B = B.prevZ;\n }\n\n for (; C && C.z <= R;) {\n if (C.x >= d && C.x <= g && C.y >= m && C.y <= y && C !== r && C !== o && me(a, l, c, h, u, f, C.x, C.y) && W(C.prev, C, C.next) >= 0) return !1;\n C = C.nextZ;\n }\n\n return !0;\n}\n\nfunction ly(e, t, n) {\n let s = e;\n\n do {\n const r = s.prev,\n i = s.next.next;\n !Zn(r, i) && Rc(r, s, s.next, i) && Ve(r, i) && Ve(i, r) && (t.push(r.i / n | 0), t.push(s.i / n | 0), t.push(i.i / n | 0), je(s), je(s.next), s = e = i), s = s.next;\n } while (s !== e);\n\n return ne(s);\n}\n\nfunction hy(e, t, n, s, r, i) {\n let o = e;\n\n do {\n let a = o.next.next;\n\n for (; a !== o.prev;) {\n if (o.i !== a.i && Cy(o, a)) {\n let c = Mc(o, a);\n o = ne(o, o.next), c = ne(c, c.next), Je(o, t, n, s, r, i, 0), Je(c, t, n, s, r, i, 0);\n return;\n }\n\n a = a.next;\n }\n\n o = o.next;\n } while (o !== e);\n}\n\nfunction fy(e, t, n, s, r, i) {\n const o = [];\n let a, c, u, l, h;\n\n for (a = 0, c = t.length; a < c; a++) u = t[a] * s, l = a < c - 1 ? t[a + 1] * s : e.length, h = wc(e, u, l, s, !1, r && r[a + 1], i), h === h.next && (h.steiner = !0), o.push(By(h));\n\n for (o.sort(dy), a = 0; a < o.length; a++) n = my(o[a], n);\n\n return n;\n}\n\nfunction dy(e, t) {\n return e.x - t.x;\n}\n\nfunction my(e, t) {\n const n = gy(e, t);\n if (!n) return t;\n const s = Mc(n, e);\n return ne(s, s.next), ne(n, n.next);\n}\n\nfunction gy(e, t) {\n let n = t;\n const s = e.x,\n r = e.y;\n let i = -1 / 0,\n o;\n\n do {\n if (r <= n.y && r >= n.next.y && n.next.y !== n.y) {\n const f = n.x + (r - n.y) * (n.next.x - n.x) / (n.next.y - n.y);\n if (f <= s && f > i && (i = f, o = n.x < n.next.x ? n : n.next, f === s)) return o;\n }\n\n n = n.next;\n } while (n !== t);\n\n if (!o) return null;\n const a = o,\n c = o.x,\n u = o.y;\n let l = 1 / 0,\n h;\n n = o;\n\n do s >= n.x && n.x >= c && s !== n.x && me(r < u ? s : i, r, c, u, r < u ? i : s, r, n.x, n.y) && (h = Math.abs(r - n.y) / (s - n.x), Ve(n, e) && (h < l || h === l && (n.x > o.x || n.x === o.x && Ay(o, n))) && (o = n, l = h)), n = n.next; while (n !== a);\n\n return o;\n}\n\nfunction Ay(e, t) {\n return W(e.prev, e, t.prev) < 0 && W(t.next, e, e.next) < 0;\n}\n\nfunction py(e, t, n, s) {\n let r = e;\n\n do r.z === 0 && (r.z = rr(r.x, r.y, t, n, s)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next; while (r !== e);\n\n r.prevZ.nextZ = null, r.prevZ = null, yy(r);\n}\n\nfunction yy(e) {\n let t,\n n,\n s = 1,\n r,\n i,\n o,\n a,\n c,\n u;\n\n do {\n for (i = e, e = null, u = null, r = 0; i;) {\n for (r++, a = i, o = 0, n = 0; n < s && (o++, a = a.nextZ, !!a); n++);\n\n for (c = s; o > 0 || c > 0 && a;) o !== 0 && (c === 0 || !a || i.z <= a.z) ? (t = i, i = i.nextZ, o--) : (t = a, a = a.nextZ, c--), u ? u.nextZ = t : e = t, t.prevZ = u, u = t;\n\n i = a;\n }\n\n u.nextZ = null, s *= 2;\n } while (r > 1);\n\n return e;\n}\n\nfunction rr(e, t, n, s, r) {\n return e = (e - n) * r | 0, t = (t - s) * r | 0, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, t = (t | t << 8) & 16711935, t = (t | t << 4) & 252645135, t = (t | t << 2) & 858993459, t = (t | t << 1) & 1431655765, e | t << 1;\n}\n\nfunction By(e) {\n let t = e,\n n = e;\n\n do (t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next; while (t !== e);\n\n return n;\n}\n\nfunction me(e, t, n, s, r, i, o, a) {\n return (r - o) * (t - a) >= (e - o) * (i - a) && (e - o) * (s - a) >= (n - o) * (t - a) && (n - o) * (i - a) >= (r - o) * (s - a);\n}\n\nfunction Cy(e, t) {\n return e.next.i !== t.i && e.prev.i !== t.i && !Ey(e, t) && ( // dones't intersect other edges\n Ve(e, t) && Ve(t, e) && Ty(e, t) && ( // locally visible\n W(e.prev, e, t.prev) || W(e, t.prev, t)) || // does not create opposite-facing sectors\n Zn(e, t) && W(e.prev, e, e.next) > 0 && W(t.prev, t, t.next) > 0);\n}\n\nfunction W(e, t, n) {\n return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y);\n}\n\nfunction Zn(e, t) {\n return e.x === t.x && e.y === t.y;\n}\n\nfunction Rc(e, t, n, s) {\n const r = Bn(W(e, t, n)),\n i = Bn(W(e, t, s)),\n o = Bn(W(n, s, e)),\n a = Bn(W(n, s, t));\n return !!(r !== i && o !== a || r === 0 && yn(e, n, t) || i === 0 && yn(e, s, t) || o === 0 && yn(n, e, s) || a === 0 && yn(n, t, s));\n}\n\nfunction yn(e, t, n) {\n return t.x <= Math.max(e.x, n.x) && t.x >= Math.min(e.x, n.x) && t.y <= Math.max(e.y, n.y) && t.y >= Math.min(e.y, n.y);\n}\n\nfunction Bn(e) {\n return e > 0 ? 1 : e < 0 ? -1 : 0;\n}\n\nfunction Ey(e, t) {\n let n = e;\n\n do {\n if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && Rc(n, n.next, e, t)) return !0;\n n = n.next;\n } while (n !== e);\n\n return !1;\n}\n\nfunction Ve(e, t) {\n return W(e.prev, e, e.next) < 0 ? W(e, t, e.next) >= 0 && W(e, e.prev, t) >= 0 : W(e, t, e.prev) < 0 || W(e, e.next, t) < 0;\n}\n\nfunction Ty(e, t) {\n let n = e,\n s = !1;\n const r = (e.x + t.x) / 2,\n i = (e.y + t.y) / 2;\n\n do n.y > i != n.next.y > i && n.next.y !== n.y && r < (n.next.x - n.x) * (i - n.y) / (n.next.y - n.y) + n.x && (s = !s), n = n.next; while (n !== e);\n\n return s;\n}\n\nfunction Mc(e, t) {\n const n = new ir(e.i, e.x, e.y),\n s = new ir(t.i, t.x, t.y),\n r = e.next,\n i = t.prev;\n return e.next = t, t.prev = e, n.next = r, r.prev = n, s.next = n, n.prev = s, i.next = s, s.prev = i, s;\n}\n\nfunction yo(e, t, n, s) {\n const r = new ir(e, t, n);\n return s ? (r.next = s.next, r.prev = s, s.next.prev = r, s.next = r) : (r.prev = r, r.next = r), r;\n}\n\nfunction je(e) {\n e.next.prev = e.prev, e.prev.next = e.next, e.prevZ && (e.prevZ.nextZ = e.nextZ), e.nextZ && (e.nextZ.prevZ = e.prevZ);\n}\n\nclass ir {\n constructor(t, n, s) {\n this.prev = null, this.next = null, this.z = 0, this.prevZ = null, this.nextZ = null, this.steiner = !1, this.i = t, this.x = n, this.y = s;\n }\n\n}\n\nfunction by(e, t, n) {\n const s = _y(e),\n r = Object.keys(s).filter(i => s[i] !== Array);\n\n return wy(e, {\n propArrayTypes: s,\n ...t\n }, {\n numericPropKeys: n && n.numericPropKeys || r,\n PositionDataType: n ? n.PositionDataType : Float32Array,\n triangulate: n ? n.triangulate : !0\n });\n}\n\nfunction _y(e) {\n const t = {};\n\n for (const n of e) if (n.properties) for (const s in n.properties) {\n const r = n.properties[s];\n t[s] = vy(r, t[s]);\n }\n\n return t;\n}\n\nfunction wy(e, t, n) {\n const {\n pointPositionsCount: s,\n pointFeaturesCount: r,\n linePositionsCount: i,\n linePathsCount: o,\n lineFeaturesCount: a,\n polygonPositionsCount: c,\n polygonObjectsCount: u,\n polygonRingsCount: l,\n polygonFeaturesCount: h,\n propArrayTypes: f,\n coordLength: d\n } = t,\n {\n numericPropKeys: m = [],\n PositionDataType: g = Float32Array,\n triangulate: y = !0\n } = n,\n E = e[0] && \"id\" in e[0],\n R = e.length > 65535 ? Uint32Array : Uint16Array,\n B = {\n type: \"Point\",\n positions: new g(s * d),\n globalFeatureIds: new R(s),\n featureIds: r > 65535 ? new Uint32Array(s) : new Uint16Array(s),\n numericProps: {},\n properties: [],\n fields: []\n },\n C = {\n type: \"LineString\",\n pathIndices: i > 65535 ? new Uint32Array(o + 1) : new Uint16Array(o + 1),\n positions: new g(i * d),\n globalFeatureIds: new R(i),\n featureIds: a > 65535 ? new Uint32Array(i) : new Uint16Array(i),\n numericProps: {},\n properties: [],\n fields: []\n },\n M = {\n type: \"Polygon\",\n polygonIndices: c > 65535 ? new Uint32Array(u + 1) : new Uint16Array(u + 1),\n primitivePolygonIndices: c > 65535 ? new Uint32Array(l + 1) : new Uint16Array(l + 1),\n positions: new g(c * d),\n globalFeatureIds: new R(c),\n featureIds: h > 65535 ? new Uint32Array(c) : new Uint16Array(c),\n numericProps: {},\n properties: [],\n fields: []\n };\n y && (M.triangles = []);\n\n for (const O of [B, C, M]) for (const F of m) {\n const v = f[F];\n O.numericProps[F] = new v(O.positions.length / d);\n }\n\n C.pathIndices[o] = i, M.polygonIndices[u] = c, M.primitivePolygonIndices[l] = c;\n const b = {\n pointPosition: 0,\n pointFeature: 0,\n linePosition: 0,\n linePath: 0,\n lineFeature: 0,\n polygonPosition: 0,\n polygonObject: 0,\n polygonRing: 0,\n polygonFeature: 0,\n feature: 0\n };\n\n for (const O of e) {\n const F = O.geometry,\n v = O.properties || {};\n\n switch (F.type) {\n case \"Point\":\n Ry(F, B, b, d, v), B.properties.push(xs(v, m)), E && B.fields.push({\n id: O.id\n }), b.pointFeature++;\n break;\n\n case \"LineString\":\n My(F, C, b, d, v), C.properties.push(xs(v, m)), E && C.fields.push({\n id: O.id\n }), b.lineFeature++;\n break;\n\n case \"Polygon\":\n Sy(F, M, b, d, v), M.properties.push(xs(v, m)), E && M.fields.push({\n id: O.id\n }), b.polygonFeature++;\n break;\n\n default:\n throw new Error(\"Invalid geometry type\");\n }\n\n b.feature++;\n }\n\n return xy(B, C, M, d);\n}\n\nfunction Ry(e, t, n, s, r) {\n t.positions.set(e.data, n.pointPosition * s);\n const i = e.data.length / s;\n Hr(t, r, n.pointPosition, i), t.globalFeatureIds.fill(n.feature, n.pointPosition, n.pointPosition + i), t.featureIds.fill(n.pointFeature, n.pointPosition, n.pointPosition + i), n.pointPosition += i;\n}\n\nfunction My(e, t, n, s, r) {\n t.positions.set(e.data, n.linePosition * s);\n const i = e.data.length / s;\n Hr(t, r, n.linePosition, i), t.globalFeatureIds.fill(n.feature, n.linePosition, n.linePosition + i), t.featureIds.fill(n.lineFeature, n.linePosition, n.linePosition + i);\n\n for (let o = 0, a = e.indices.length; o < a; ++o) {\n const c = e.indices[o],\n u = o === a - 1 ? e.data.length : e.indices[o + 1];\n t.pathIndices[n.linePath++] = n.linePosition, n.linePosition += (u - c) / s;\n }\n}\n\nfunction Sy(e, t, n, s, r) {\n t.positions.set(e.data, n.polygonPosition * s);\n const i = e.data.length / s;\n Hr(t, r, n.polygonPosition, i), t.globalFeatureIds.fill(n.feature, n.polygonPosition, n.polygonPosition + i), t.featureIds.fill(n.polygonFeature, n.polygonPosition, n.polygonPosition + i);\n\n for (let o = 0, a = e.indices.length; o < a; ++o) {\n const c = n.polygonPosition;\n t.polygonIndices[n.polygonObject++] = c;\n const u = e.areas[o],\n l = e.indices[o],\n h = e.indices[o + 1];\n\n for (let d = 0, m = l.length; d < m; ++d) {\n const g = l[d],\n y = d === m - 1 ? h === void 0 ? e.data.length : h[0] : l[d + 1];\n t.primitivePolygonIndices[n.polygonRing++] = n.polygonPosition, n.polygonPosition += (y - g) / s;\n }\n\n const f = n.polygonPosition;\n Iy(t, u, l, {\n startPosition: c,\n endPosition: f,\n coordLength: s\n });\n }\n}\n\nfunction Iy(e, t, n, s) {\n let {\n startPosition: r,\n endPosition: i,\n coordLength: o\n } = s;\n if (!e.triangles) return;\n const a = r * o,\n c = i * o,\n u = e.positions.subarray(a, c),\n l = n[0],\n h = n.slice(1).map(d => (d - l) / o),\n f = ay(u, h, o, t);\n\n for (let d = 0, m = f.length; d < m; ++d) e.triangles.push(r + f[d]);\n}\n\nfunction Is(e, t) {\n const n = {};\n\n for (const s in e) n[s] = {\n value: e[s],\n size: t\n };\n\n return n;\n}\n\nfunction xy(e, t, n, s) {\n const r = {\n shape: \"binary-feature-collection\",\n points: { ...e,\n positions: {\n value: e.positions,\n size: s\n },\n globalFeatureIds: {\n value: e.globalFeatureIds,\n size: 1\n },\n featureIds: {\n value: e.featureIds,\n size: 1\n },\n numericProps: Is(e.numericProps, 1)\n },\n lines: { ...t,\n positions: {\n value: t.positions,\n size: s\n },\n pathIndices: {\n value: t.pathIndices,\n size: 1\n },\n globalFeatureIds: {\n value: t.globalFeatureIds,\n size: 1\n },\n featureIds: {\n value: t.featureIds,\n size: 1\n },\n numericProps: Is(t.numericProps, 1)\n },\n polygons: { ...n,\n positions: {\n value: n.positions,\n size: s\n },\n polygonIndices: {\n value: n.polygonIndices,\n size: 1\n },\n primitivePolygonIndices: {\n value: n.primitivePolygonIndices,\n size: 1\n },\n globalFeatureIds: {\n value: n.globalFeatureIds,\n size: 1\n },\n featureIds: {\n value: n.featureIds,\n size: 1\n },\n numericProps: Is(n.numericProps, 1)\n }\n };\n return r.polygons && n.triangles && (r.polygons.triangles = {\n value: new Uint32Array(n.triangles),\n size: 1\n }), r;\n}\n\nfunction Hr(e, t, n, s) {\n for (const r in e.numericProps) if (r in t) {\n const i = t[r];\n e.numericProps[r].fill(i, n, n + s);\n }\n}\n\nfunction xs(e, t) {\n const n = {};\n\n for (const s in e) t.includes(s) || (n[s] = e[s]);\n\n return n;\n}\n\nfunction vy(e, t) {\n return t === Array || !Number.isFinite(e) ? Array : t === Float64Array || Math.fround(e) !== e ? Float64Array : Float32Array;\n}\n\nfunction Oy(e) {\n let t = 0,\n n = 0,\n s = 0,\n r = 0,\n i = 0,\n o = 0,\n a = 0,\n c = 0,\n u = 0;\n const l = /* @__PURE__ */new Set();\n\n for (const h of e) {\n const f = h.geometry;\n\n switch (f.type) {\n case \"Point\":\n n++, t++, l.add(f.coordinates.length);\n break;\n\n case \"MultiPoint\":\n n++, t += f.coordinates.length;\n\n for (const m of f.coordinates) l.add(m.length);\n\n break;\n\n case \"LineString\":\n i++, s += f.coordinates.length, r++;\n\n for (const m of f.coordinates) l.add(m.length);\n\n break;\n\n case \"MultiLineString\":\n i++;\n\n for (const m of f.coordinates) {\n s += m.length, r++;\n\n for (const g of m) l.add(g.length);\n }\n\n break;\n\n case \"Polygon\":\n u++, a++, c += f.coordinates.length;\n const d = f.coordinates.flat();\n o += d.length;\n\n for (const m of d) l.add(m.length);\n\n break;\n\n case \"MultiPolygon\":\n u++;\n\n for (const m of f.coordinates) {\n a++, c += m.length;\n const g = m.flat();\n o += g.length;\n\n for (const y of g) l.add(y.length);\n }\n\n break;\n\n default:\n throw new Error(`Unsupported geometry type: ${f.type}`);\n }\n }\n\n return {\n coordLength: l.size > 0 ? Math.max(...l) : 2,\n pointPositionsCount: t,\n pointFeaturesCount: n,\n linePositionsCount: s,\n linePathsCount: r,\n lineFeaturesCount: i,\n polygonPositionsCount: o,\n polygonObjectsCount: a,\n polygonRingsCount: c,\n polygonFeaturesCount: u\n };\n}\n\nfunction Fy(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {\n coordLength: 2,\n fixRingWinding: !0\n };\n return e.map(n => Dy(n, t));\n}\n\nfunction Bo(e, t, n, s) {\n n.push(t.length), t.push(...e);\n\n for (let r = e.length; r < s.coordLength; r++) t.push(0);\n}\n\nfunction or(e, t, n, s) {\n n.push(t.length);\n\n for (const r of e) {\n t.push(...r);\n\n for (let i = r.length; i < s.coordLength; i++) t.push(0);\n }\n}\n\nfunction Co(e, t, n, s, r) {\n let i = 0;\n const o = [],\n a = [];\n\n for (const c of e) {\n const u = c.map(f => f.slice(0, 2));\n\n let l = _c(u.flat());\n\n const h = l < 0;\n r.fixRingWinding && (i === 0 && !h || i > 0 && h) && (c.reverse(), l = -l), o.push(l), or(c, t, a, r), i++;\n }\n\n i > 0 && (s.push(o), n.push(a));\n}\n\nfunction Dy(e, t) {\n const {\n geometry: n\n } = e;\n if (n.type === \"GeometryCollection\") throw new Error(\"GeometryCollection type not supported\");\n const s = [],\n r = [];\n let i, o;\n\n switch (n.type) {\n case \"Point\":\n o = \"Point\", Bo(n.coordinates, s, r, t);\n break;\n\n case \"MultiPoint\":\n o = \"Point\", n.coordinates.map(a => Bo(a, s, r, t));\n break;\n\n case \"LineString\":\n o = \"LineString\", or(n.coordinates, s, r, t);\n break;\n\n case \"MultiLineString\":\n o = \"LineString\", n.coordinates.map(a => or(a, s, r, t));\n break;\n\n case \"Polygon\":\n o = \"Polygon\", i = [], Co(n.coordinates, s, r, i, t);\n break;\n\n case \"MultiPolygon\":\n o = \"Polygon\", i = [], n.coordinates.map(a => Co(a, s, r, i, t));\n break;\n\n default:\n throw new Error(`Unknown type: ${o}`);\n }\n\n return { ...e,\n geometry: {\n type: o,\n indices: r,\n data: s,\n areas: i\n }\n };\n}\n\nfunction Sc(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {\n fixRingWinding: !0,\n triangulate: !0\n };\n const n = Oy(e),\n s = n.coordLength,\n {\n fixRingWinding: r\n } = t,\n i = Fy(e, {\n coordLength: s,\n fixRingWinding: r\n });\n return by(i, n, {\n numericPropKeys: t.numericPropKeys,\n PositionDataType: t.PositionDataType || Float32Array,\n triangulate: t.triangulate\n });\n}\n\nconst Ly = \"4.1.4\",\n Py = {\n name: \"GeoJSON\",\n id: \"geojson\",\n module: \"geojson\",\n version: Ly,\n worker: !0,\n extensions: [\"geojson\"],\n mimeTypes: [\"application/geo+json\"],\n category: \"geometry\",\n text: !0,\n options: {\n geojson: {\n shape: \"object-row-table\"\n },\n json: {\n shape: \"object-row-table\",\n jsonpaths: [\"$\", \"$.features\"]\n },\n gis: {\n format: \"geojson\"\n }\n }\n},\n ke = { ...Py,\n parse: Gy,\n parseTextSync: Ic,\n parseInBatches: Ny\n};\n\nasync function Gy(e, t) {\n return Ic(new TextDecoder().decode(e), t);\n}\n\nfunction Ic(e, t) {\n var n;\n t = { ...ke.options,\n ...t\n }, t.geojson = { ...ke.options.geojson,\n ...t.geojson\n }, t.gis = t.gis || {};\n let s;\n\n try {\n s = JSON.parse(e);\n } catch {\n s = {};\n }\n\n const r = {\n shape: \"geojson-table\",\n type: \"FeatureCollection\",\n features: ((n = s) === null || n === void 0 ? void 0 : n.features) || []\n };\n\n switch (t.gis.format) {\n case \"binary\":\n return Sc(r.features);\n\n default:\n return r;\n }\n}\n\nfunction Ny(e, t) {\n t = { ...ke.options,\n ...t\n }, t.json = { ...ke.options.geojson,\n ...t.geojson\n };\n const n = oy(e, t);\n\n switch (t.gis.format) {\n case \"binary\":\n return Uy(n);\n\n default:\n return n;\n }\n}\n\nasync function* Uy(e) {\n for await (const t of e) t.data = Sc(t.data), yield t;\n}\n\nfunction $t(e, t) {\n if (!e) throw new Error(t || \"loader assertion failed.\");\n}\n\nconst Hy = \"Queued Requests\",\n Jy = \"Active Requests\",\n Vy = \"Cancelled Requests\",\n jy = \"Queued Requests Ever\",\n ky = \"Active Requests Ever\",\n Ky = {\n id: \"request-scheduler\",\n\n /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */\n throttleRequests: !0,\n\n /** The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit. */\n maxRequests: 6,\n\n /**\n * Specifies a debounce time, in milliseconds. All requests are queued, until no new requests have\n * been added to the queue for this amount of time.\n */\n debounceTime: 0\n};\n\nclass zy {\n constructor(t = {}) {\n p(this, \"props\");\n p(this, \"stats\");\n p(this, \"activeRequestCount\", 0);\n /** Tracks the number of active requests and prioritizes/cancels queued requests. */\n\n p(this, \"requestQueue\", []);\n p(this, \"requestMap\", /* @__PURE__ */new Map());\n p(this, \"updateTimer\", null);\n this.props = { ...Ky,\n ...t\n }, this.stats = new $o({\n id: this.props.id\n }), this.stats.get(Hy), this.stats.get(Jy), this.stats.get(Vy), this.stats.get(jy), this.stats.get(ky);\n }\n /**\n * Called by an application that wants to issue a request, without having it deeply queued by the browser\n *\n * When the returned promise resolved, it is OK for the application to issue a request.\n * The promise resolves to an object that contains a `done` method.\n * When the application's request has completed (or failed), the application must call the `done` function\n *\n * @param handle\n * @param getPriority will be called when request \"slots\" open up,\n * allowing the caller to update priority or cancel the request\n * Highest priority executes first, priority < 0 cancels the request\n * @returns a promise\n * - resolves to a object (with a `done` field) when the request can be issued without queueing,\n * - resolves to `null` if the request has been cancelled (by the callback return < 0).\n * In this case the application should not issue the request\n */\n\n\n scheduleRequest(t, n = () => 0) {\n if (!this.props.throttleRequests) return Promise.resolve({\n done: () => {}\n });\n if (this.requestMap.has(t)) return this.requestMap.get(t);\n const s = {\n handle: t,\n priority: 0,\n getPriority: n\n },\n r = new Promise(i => (s.resolve = i, s));\n return this.requestQueue.push(s), this.requestMap.set(t, r), this._issueNewRequests(), r;\n } // PRIVATE\n\n\n _issueRequest(t) {\n const {\n handle: n,\n resolve: s\n } = t;\n let r = !1;\n\n const i = () => {\n r || (r = !0, this.requestMap.delete(n), this.activeRequestCount--, this._issueNewRequests());\n };\n\n return this.activeRequestCount++, s ? s({\n done: i\n }) : Promise.resolve({\n done: i\n });\n }\n /** We check requests asynchronously, to prevent multiple updates */\n\n\n _issueNewRequests() {\n this.updateTimer !== null && clearTimeout(this.updateTimer), this.updateTimer = setTimeout(() => this._issueNewRequestsAsync(), this.props.debounceTime);\n }\n /** Refresh all requests */\n\n\n _issueNewRequestsAsync() {\n this.updateTimer !== null && clearTimeout(this.updateTimer), this.updateTimer = null;\n const t = Math.max(this.props.maxRequests - this.activeRequestCount, 0);\n\n if (t !== 0) {\n this._updateAllRequests();\n\n for (let n = 0; n < t; ++n) {\n const s = this.requestQueue.shift();\n s && this._issueRequest(s);\n }\n }\n }\n /** Ensure all requests have updated priorities, and that no longer valid requests are cancelled */\n\n\n _updateAllRequests() {\n const t = this.requestQueue;\n\n for (let n = 0; n < t.length; ++n) {\n const s = t[n];\n this._updateRequest(s) || (t.splice(n, 1), this.requestMap.delete(s.handle), n--);\n }\n\n t.sort((n, s) => n.priority - s.priority);\n }\n /** Update a single request by calling the callback */\n\n\n _updateRequest(t) {\n return t.priority = t.getPriority(t.handle), t.priority < 0 ? (t.resolve(null), !1) : !0;\n }\n\n}\n\nfunction Wy(e) {\n const t = e ? e.lastIndexOf(\"/\") : -1;\n return t >= 0 ? e.substr(0, t) : \"\";\n}\n\nclass Xy {\n constructor(t, n, s) {\n p(this, \"item\");\n p(this, \"previous\");\n p(this, \"next\");\n this.item = t, this.previous = n, this.next = s;\n }\n\n}\n\nclass Qy {\n constructor() {\n p(this, \"head\", null);\n p(this, \"tail\", null);\n p(this, \"_length\", 0);\n }\n\n get length() {\n return this._length;\n }\n /**\n * Adds the item to the end of the list\n * @param {*} [item]\n * @return {DoublyLinkedListNode}\n */\n\n\n add(t) {\n const n = new Xy(t, this.tail, null);\n return this.tail ? (this.tail.next = n, this.tail = n) : (this.head = n, this.tail = n), ++this._length, n;\n }\n /**\n * Removes the given node from the list\n * @param {DoublyLinkedListNode} node\n */\n\n\n remove(t) {\n t && (t.previous && t.next ? (t.previous.next = t.next, t.next.previous = t.previous) : t.previous ? (t.previous.next = null, this.tail = t.previous) : t.next ? (t.next.previous = null, this.head = t.next) : (this.head = null, this.tail = null), t.next = null, t.previous = null, --this._length);\n }\n /**\n * Moves nextNode after node\n * @param {DoublyLinkedListNode} node\n * @param {DoublyLinkedListNode} nextNode\n */\n\n\n splice(t, n) {\n t !== n && (this.remove(n), this._insert(t, n));\n }\n\n _insert(t, n) {\n const s = t.next;\n t.next = n, this.tail === t ? this.tail = n : s.previous = n, n.next = s, n.previous = t, ++this._length;\n }\n\n}\n\nclass qy {\n constructor() {\n p(this, \"_list\");\n p(this, \"_sentinel\");\n p(this, \"_trimTiles\");\n this._list = new Qy(), this._sentinel = this._list.add(\"sentinel\"), this._trimTiles = !1;\n }\n\n reset() {\n this._list.splice(this._list.tail, this._sentinel);\n }\n\n touch(t) {\n const n = t._cacheNode;\n n && this._list.splice(this._sentinel, n);\n }\n\n add(t, n, s) {\n n._cacheNode || (n._cacheNode = this._list.add(n), s && s(t, n));\n }\n\n unloadTile(t, n, s) {\n const r = n._cacheNode;\n r && (this._list.remove(r), n._cacheNode = null, s && s(t, n));\n }\n\n unloadTiles(t, n) {\n const s = this._trimTiles;\n this._trimTiles = !1;\n const r = this._list,\n i = t.maximumMemoryUsage * 1024 * 1024,\n o = this._sentinel;\n let a = r.head;\n\n for (; a !== o && (t.gpuMemoryUsageInBytes > i || s);) {\n const c = a.item;\n a = a.next, this.unloadTile(t, c, n);\n }\n }\n\n trim() {\n this._trimTiles = !0;\n }\n\n}\n\nfunction Yy(e, t) {\n $t(e), $t(t);\n const {\n rtcCenter: n,\n gltfUpAxis: s\n } = t,\n {\n computedTransform: r,\n boundingVolume: {\n center: i\n }\n } = e;\n let o = new V(r);\n\n switch (n && o.translate(n), s) {\n case \"Z\":\n break;\n\n case \"Y\":\n const h = new V().rotateX(Math.PI / 2);\n o = o.multiplyRight(h);\n break;\n\n case \"X\":\n const f = new V().rotateY(-Math.PI / 2);\n o = o.multiplyRight(f);\n break;\n }\n\n t.isQuantized && o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);\n const a = new A(i);\n t.cartesianModelMatrix = o, t.cartesianOrigin = a;\n const c = J.WGS84.cartesianToCartographic(a, new A()),\n l = J.WGS84.eastNorthUpToFixedFrame(a).invert();\n t.cartographicModelMatrix = l.multiplyRight(o), t.cartographicOrigin = c, t.coordinateSystem || (t.modelMatrix = t.cartographicModelMatrix);\n}\n\nconst Eo = new A(),\n vs = new A(),\n ar = new dt([new nt(), new nt(), new nt(), new nt(), new nt(), new nt()]);\n\nfunction $y(e, t) {\n const {\n cameraDirection: n,\n cameraUp: s,\n height: r\n } = e,\n {\n metersPerUnit: i\n } = e.distanceScales,\n o = wn(e, e.center),\n a = J.WGS84.eastNorthUpToFixedFrame(o),\n c = e.unprojectPosition(e.cameraPosition),\n u = J.WGS84.cartographicToCartesian(c, new A()),\n l = new A( // @ts-ignore\n a.transformAsVector(new A(n).scale(i))).normalize(),\n h = new A( // @ts-ignore\n a.transformAsVector(new A(s).scale(i))).normalize();\n tB(e);\n const f = e.constructor,\n {\n longitude: d,\n latitude: m,\n width: g,\n bearing: y,\n zoom: E\n } = e,\n R = new f({\n longitude: d,\n latitude: m,\n height: r,\n width: g,\n bearing: y,\n zoom: E,\n pitch: 0\n });\n return {\n camera: {\n position: u,\n direction: l,\n up: h\n },\n viewport: e,\n topDownViewport: R,\n height: r,\n cullingVolume: ar,\n frameNumber: t,\n // TODO: This can be the same between updates, what number is unique for between updates?\n sseDenominator: 1.15 // Assumes fovy = 60 degrees\n\n };\n}\n\nfunction Zy(e, t, n) {\n if (n === 0 || e.length <= n) return [e, []];\n const s = [],\n {\n longitude: r,\n latitude: i\n } = t.viewport;\n\n for (const [u, l] of e.entries()) {\n const [h, f] = l.header.mbs,\n d = Math.abs(r - h),\n m = Math.abs(i - f),\n g = Math.sqrt(m * m + d * d);\n s.push([u, g]);\n }\n\n const o = s.sort((u, l) => u[1] - l[1]),\n a = [];\n\n for (let u = 0; u < n; u++) a.push(e[o[u][0]]);\n\n const c = [];\n\n for (let u = n; u < o.length; u++) c.push(e[o[u][0]]);\n\n return [a, c];\n}\n\nfunction tB(e) {\n const t = e.getFrustumPlanes(),\n n = To(t.near, e.cameraPosition),\n s = wn(e, n),\n r = wn(e, e.cameraPosition, vs);\n let i = 0;\n ar.planes[i++].fromPointNormal(s, Eo.copy(s).subtract(r));\n\n for (const o in t) {\n if (o === \"near\") continue;\n const a = t[o],\n c = To(a, n, vs),\n u = wn(e, c, vs);\n ar.planes[i++].fromPointNormal(u, // Want the normal to point into the frustum since that's what culling expects\n Eo.copy(s).subtract(u));\n }\n}\n\nfunction To(e, t, n = new A()) {\n const s = e.normal.dot(t);\n return n.copy(e.normal).scale(e.distance - s).add(t), n;\n}\n\nfunction wn(e, t, n = new A()) {\n const s = e.unprojectPosition(t);\n return J.WGS84.cartographicToCartesian(s, n);\n}\n\nconst eB = 6378137,\n nB = 6378137,\n cr = 6356752314245179e-9,\n ge = new A();\n\nfunction sB(e, t) {\n if (e instanceof qe) {\n const {\n halfAxes: n\n } = e,\n s = iB(n);\n return Math.log2(cr / (s + t[2]));\n } else if (e instanceof Qe) {\n const {\n radius: n\n } = e;\n return Math.log2(cr / (n + t[2]));\n } else if (e.width && e.height) {\n const {\n width: n,\n height: s\n } = e,\n r = Math.log2(eB / n),\n i = Math.log2(nB / s);\n return (r + i) / 2;\n }\n\n return 1;\n}\n\nfunction xc(e, t, n) {\n J.WGS84.cartographicToCartesian([e.xmax, e.ymax, e.zmax], ge);\n const s = Math.sqrt(Math.pow(ge[0] - n[0], 2) + Math.pow(ge[1] - n[1], 2) + Math.pow(ge[2] - n[2], 2));\n return Math.log2(cr / (s + t[2]));\n}\n\nfunction rB(e, t, n) {\n const [s, r, i, o] = e;\n return xc({\n xmin: s,\n xmax: i,\n ymin: r,\n ymax: o,\n zmin: 0,\n zmax: 0\n }, t, n);\n}\n\nfunction iB(e) {\n e.getColumn(0, ge);\n const t = e.getColumn(1),\n n = e.getColumn(2);\n return ge.add(t).add(n).len();\n}\n\nconst lt = {\n UNLOADED: 0,\n // Has never been requested\n LOADING: 1,\n // Is waiting on a pending request\n PROCESSING: 2,\n // Request received. Contents are being processed for rendering. Depending on the content, it might make its own requests for external data.\n READY: 3,\n // Ready to render.\n EXPIRED: 4,\n // Is expired and will be unloaded once new content is loaded.\n FAILED: 5 // Request failed.\n\n};\nvar Ht;\n\n(function (e) {\n e[e.ADD = 1] = \"ADD\", e[e.REPLACE = 2] = \"REPLACE\";\n})(Ht || (Ht = {}));\n\nvar Pe;\n\n(function (e) {\n e.EMPTY = \"empty\", e.SCENEGRAPH = \"scenegraph\", e.POINTCLOUD = \"pointcloud\", e.MESH = \"mesh\";\n})(Pe || (Pe = {}));\n\nvar At;\n\n(function (e) {\n e.I3S = \"I3S\", e.TILES3D = \"TILES3D\";\n})(At || (At = {}));\n\nvar bo;\n\n(function (e) {\n e.GEOMETRIC_ERROR = \"geometricError\", e.MAX_SCREEN_THRESHOLD = \"maxScreenThreshold\";\n})(bo || (bo = {}));\n\nconst oB = {\n NOT_COMPUTED: -1,\n USE_OPTIMIZATION: 1,\n SKIP_OPTIMIZATION: 0\n};\n\nfunction vc(e) {\n return e != null;\n}\n\nconst it = new A(),\n Rn = new A(),\n aB = new A(),\n cB = new A(),\n qt = new A(),\n _o = new A(),\n wo = new A(),\n Ro = new A();\n\nfunction Os(e, t, n) {\n if ($t(e, \"3D Tile: boundingVolume must be defined\"), e.box) return Oc(e.box, t, n);\n if (e.region) return hB(e.region);\n if (e.sphere) return lB(e.sphere, t, n);\n throw new Error(\"3D Tile: boundingVolume must contain a sphere, region, or box\");\n}\n\nfunction uB(e, t) {\n if (e.box) return fB(t);\n\n if (e.region) {\n const [n, s, r, i, o, a] = e.region;\n return [[Rt(n), Rt(s), o], [Rt(r), Rt(i), a]];\n }\n\n if (e.sphere) return dB(t);\n throw new Error(\"Unkown boundingVolume type\");\n}\n\nfunction Oc(e, t, n) {\n const s = new A(e[0], e[1], e[2]);\n t.transform(s, s);\n let r = [];\n\n if (e.length === 10) {\n const u = e.slice(3, 6),\n l = new On();\n l.fromArray(e, 6);\n const h = new A([1, 0, 0]),\n f = new A([0, 1, 0]),\n d = new A([0, 0, 1]);\n h.transformByQuaternion(l), h.scale(u[0]), f.transformByQuaternion(l), f.scale(u[1]), d.transformByQuaternion(l), d.scale(u[2]), r = [...h.toArray(), ...f.toArray(), ...d.toArray()];\n } else r = [...e.slice(3, 6), ...e.slice(6, 9), ...e.slice(9, 12)];\n\n const i = t.transformAsVector(r.slice(0, 3)),\n o = t.transformAsVector(r.slice(3, 6)),\n a = t.transformAsVector(r.slice(6, 9)),\n c = new X([i[0], i[1], i[2], o[0], o[1], o[2], a[0], a[1], a[2]]);\n return vc(n) ? (n.center = s, n.halfAxes = c, n) : new qe(s, c);\n}\n\nfunction lB(e, t, n) {\n const s = new A(e[0], e[1], e[2]);\n t.transform(s, s);\n const r = t.getScale(Rn),\n i = Math.max(Math.max(r[0], r[1]), r[2]),\n o = e[3] * i;\n return vc(n) ? (n.center = s, n.radius = o, n) : new Qe(s, o);\n}\n\nfunction hB(e) {\n const [t, n, s, r, i, o] = e,\n a = J.WGS84.cartographicToCartesian([Rt(t), Rt(r), i], aB),\n c = J.WGS84.cartographicToCartesian([Rt(s), Rt(n), o], cB),\n u = new A().addVectors(a, c).multiplyByScalar(0.5);\n return J.WGS84.cartesianToCartographic(u, qt), J.WGS84.cartographicToCartesian([Rt(s), qt[1], qt[2]], _o), J.WGS84.cartographicToCartesian([qt[0], Rt(r), qt[2]], wo), J.WGS84.cartographicToCartesian([qt[0], qt[1], o], Ro), Oc([...u, ..._o.subtract(u), ...wo.subtract(u), ...Ro.subtract(u)], new V());\n}\n\nfunction fB(e) {\n const t = Fc(),\n {\n halfAxes: n\n } = e,\n s = new A(n.getColumn(0)),\n r = new A(n.getColumn(1)),\n i = new A(n.getColumn(2));\n\n for (let o = 0; o < 2; o++) {\n for (let a = 0; a < 2; a++) {\n for (let c = 0; c < 2; c++) it.copy(e.center), it.add(s), it.add(r), it.add(i), Dc(t, it), i.negate();\n\n r.negate();\n }\n\n s.negate();\n }\n\n return t;\n}\n\nfunction dB(e) {\n const t = Fc(),\n {\n center: n,\n radius: s\n } = e,\n r = J.WGS84.scaleToGeodeticSurface(n, it);\n let i;\n r ? i = J.WGS84.geodeticSurfaceNormal(r) : i = new A(0, 0, 1);\n let o = new A(i[2], -i[1], 0);\n o.len() > 0 ? o.normalize() : o = new A(0, 1, 0);\n const a = o.clone().cross(i);\n\n for (const c of [o, a, i]) {\n Rn.copy(c).scale(s);\n\n for (let u = 0; u < 2; u++) it.copy(n), it.add(Rn), Dc(t, it), Rn.negate();\n }\n\n return t;\n}\n\nfunction Fc() {\n return [[1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]];\n}\n\nfunction Dc(e, t) {\n J.WGS84.cartesianToCartographic(t, it), e[0][0] = Math.min(e[0][0], it[0]), e[0][1] = Math.min(e[0][1], it[1]), e[0][2] = Math.min(e[0][2], it[2]), e[1][0] = Math.max(e[1][0], it[0]), e[1][1] = Math.max(e[1][1], it[1]), e[1][2] = Math.max(e[1][2], it[2]);\n}\n\nnew A();\nnew A();\nnew V();\nnew A();\nnew A();\nnew A();\n\nfunction mB(e, t) {\n const n = e * t;\n return 1 - Math.exp(-(n * n));\n}\n\nfunction gB(e, t) {\n if (e.dynamicScreenSpaceError && e.dynamicScreenSpaceErrorComputedDensity) {\n const n = e.dynamicScreenSpaceErrorComputedDensity,\n s = e.dynamicScreenSpaceErrorFactor;\n return mB(t, n) * s;\n }\n\n return 0;\n}\n\nfunction AB(e, t, n) {\n const s = e.tileset,\n r = e.parent && e.parent.lodMetricValue || e.lodMetricValue,\n i = n ? r : e.lodMetricValue;\n if (i === 0) return 0;\n const o = Math.max(e._distanceToCamera, 1e-7),\n {\n height: a,\n sseDenominator: c\n } = t,\n {\n viewDistanceScale: u\n } = s.options;\n let l = i * a * (u || 1) / (o * c);\n return l -= gB(s, o), l;\n}\n\nconst Fs = new A(),\n Mo = new A(),\n jt = new A(),\n So = new A(),\n pB = new A(),\n Ds = new V(),\n Io = new V();\n\nfunction yB(e, t) {\n if (e.lodMetricValue === 0 || isNaN(e.lodMetricValue)) return \"DIG\";\n const n = 2 * Lc(e, t);\n return n < 2 ? \"OUT\" : !e.header.children || n <= e.lodMetricValue ? \"DRAW\" : e.header.children ? \"DIG\" : \"OUT\";\n}\n\nfunction Lc(e, t) {\n const {\n topDownViewport: n\n } = t,\n s = e.header.mbs[1],\n r = e.header.mbs[0],\n i = e.header.mbs[2],\n o = e.header.mbs[3],\n a = [...e.boundingVolume.center],\n c = n.unprojectPosition(n.cameraPosition);\n J.WGS84.cartographicToCartesian(c, Fs), Mo.copy(Fs).subtract(a).normalize(), J.WGS84.eastNorthUpToFixedFrame(a, Ds), Io.copy(Ds).invert(), jt.copy(Fs).transform(Io);\n const u = Math.sqrt(jt[0] * jt[0] + jt[1] * jt[1]),\n l = u * u / jt[2];\n So.copy([jt[0], jt[1], l]);\n const f = So.transform(Ds).subtract(a).normalize(),\n m = Mo.cross(f).normalize().scale(o).add(a),\n g = J.WGS84.cartesianToCartographic(m),\n y = n.project([r, s, i]),\n E = n.project(g);\n return pB.copy(y).subtract(E).magnitude();\n}\n\nfunction BB(e) {\n return {\n assetGltfUpAxis: e.asset && e.asset.gltfUpAxis || \"Y\"\n };\n}\n\nclass xo {\n constructor(t = 0) {\n p(this, \"_map\", /* @__PURE__ */new Map());\n p(this, \"_array\");\n p(this, \"_length\");\n this._array = new Array(t), this._length = t;\n }\n /**\n * Gets or sets the length of the array.\n * If the set length is greater than the length of the internal array, the internal array is resized.\n *\n * @memberof ManagedArray.prototype\n * @type Number\n */\n\n\n get length() {\n return this._length;\n }\n\n set length(t) {\n this._length = t, t > this._array.length && (this._array.length = t);\n }\n /**\n * Gets the internal array.\n *\n * @memberof ManagedArray.prototype\n * @type Array\n * @readonly\n */\n\n\n get values() {\n return this._array;\n }\n /**\n * Gets the element at an index.\n *\n * @param {Number} index The index to get.\n */\n\n\n get(t) {\n return $t(t < this._array.length), this._array[t];\n }\n /**\n * Sets the element at an index. Resizes the array if index is greater than the length of the array.\n *\n * @param {Number} index The index to set.\n * @param {*} element The element to set at index.\n */\n\n\n set(t, n) {\n $t(t >= 0), t >= this.length && (this.length = t + 1), this._map.has(this._array[t]) && this._map.delete(this._array[t]), this._array[t] = n, this._map.set(n, t);\n }\n\n delete(t) {\n const n = this._map.get(t);\n\n n >= 0 && (this._array.splice(n, 1), this._map.delete(t), this.length--);\n }\n /**\n * Returns the last element in the array without modifying the array.\n *\n * @returns {*} The last element in the array.\n */\n\n\n peek() {\n return this._array[this._length - 1];\n }\n /**\n * Push an element into the array.\n *\n * @param {*} element The element to push.\n */\n\n\n push(t) {\n if (!this._map.has(t)) {\n const n = this.length++;\n this._array[n] = t, this._map.set(t, n);\n }\n }\n /**\n * Pop an element from the array.\n *\n * @returns {*} The last element in the array.\n */\n\n\n pop() {\n const t = this._array[--this.length];\n return this._map.delete(t), t;\n }\n /**\n * Resize the internal array if length > _array.length.\n *\n * @param {Number} length The length.\n */\n\n\n reserve(t) {\n $t(t >= 0), t > this._array.length && (this._array.length = t);\n }\n /**\n * Resize the array.\n *\n * @param {Number} length The length.\n */\n\n\n resize(t) {\n $t(t >= 0), this.length = t;\n }\n /**\n * Trim the internal array to the specified length. Defaults to the current length.\n *\n * @param {Number} [length] The length.\n */\n\n\n trim(t) {\n t == null && (t = this.length), this._array.length = t;\n }\n\n reset() {\n this._array = [], this._map = /* @__PURE__ */new Map(), this._length = 0;\n }\n\n find(t) {\n return this._map.has(t);\n }\n\n}\n\nconst CB = {\n loadSiblings: !1,\n skipLevelOfDetail: !1,\n updateTransforms: !0,\n onTraversalEnd: () => {},\n viewportTraversersMap: {},\n basePath: \"\"\n};\n\nclass ts {\n // TODO nested props\n constructor(t) {\n p(this, \"options\"); // fulfill in traverse call\n\n p(this, \"root\", null); // tiles should be rendered\n\n p(this, \"selectedTiles\", {}); // tiles should be loaded from server\n\n p(this, \"requestedTiles\", {}); // tiles does not have render content\n\n p(this, \"emptyTiles\", {});\n p(this, \"lastUpdate\", /* @__PURE__ */new Date().getTime());\n p(this, \"updateDebounceTime\", 1e3);\n /** temporary storage to hold the traversed tiles during a traversal */\n\n p(this, \"_traversalStack\", new xo());\n p(this, \"_emptyTraversalStack\", new xo());\n /** set in every traverse cycle */\n\n p(this, \"_frameNumber\", null);\n this.options = { ...CB,\n ...t\n };\n } // RESULT\n\n\n traversalFinished(t) {\n return !0;\n } // tiles should be visible\n\n\n traverse(t, n, s) {\n this.root = t, this.options = { ...this.options,\n ...s\n }, this.reset(), this.updateTile(t, n), this._frameNumber = n.frameNumber, this.executeTraversal(t, n);\n }\n\n reset() {\n this.requestedTiles = {}, this.selectedTiles = {}, this.emptyTiles = {}, this._traversalStack.reset(), this._emptyTraversalStack.reset();\n }\n /**\n * Execute traverse\n * Depth-first traversal that traverses all visible tiles and marks tiles for selection.\n * If skipLevelOfDetail is off then a tile does not refine until all children are loaded.\n * This is the traditional replacement refinement approach and is called the base traversal.\n * Tiles that have a greater screen space error than the base screen space error are part of the base traversal,\n * all other tiles are part of the skip traversal. The skip traversal allows for skipping levels of the tree\n * and rendering children and parent tiles simultaneously.\n */\n\n /* eslint-disable-next-line complexity, max-statements */\n\n\n executeTraversal(t, n) {\n const s = this._traversalStack;\n\n for (t._selectionDepth = 1, s.push(t); s.length > 0;) {\n const i = s.pop();\n let o = !1;\n this.canTraverse(i, n) && (this.updateChildTiles(i, n), o = this.updateAndPushChildren(i, n, s, i.hasRenderContent ? i._selectionDepth + 1 : i._selectionDepth));\n const a = i.parent,\n c = !!(!a || a._shouldRefine),\n u = !o;\n i.hasRenderContent ? i.refine === Ht.ADD ? (this.loadTile(i, n), this.selectTile(i, n)) : i.refine === Ht.REPLACE && (this.loadTile(i, n), u && this.selectTile(i, n)) : (this.emptyTiles[i.id] = i, this.loadTile(i, n), u && this.selectTile(i, n)), this.touchTile(i, n), i._shouldRefine = o && c;\n }\n\n const r = /* @__PURE__ */new Date().getTime();\n (this.traversalFinished(n) || r - this.lastUpdate > this.updateDebounceTime) && (this.lastUpdate = r, this.options.onTraversalEnd(n));\n }\n\n updateChildTiles(t, n) {\n const s = t.children;\n\n for (const r of s) this.updateTile(r, n);\n }\n /* eslint-disable complexity, max-statements */\n\n\n updateAndPushChildren(t, n, s, r) {\n const {\n loadSiblings: i,\n skipLevelOfDetail: o\n } = this.options,\n a = t.children;\n a.sort(this.compareDistanceToCamera.bind(this));\n const c = t.refine === Ht.REPLACE && t.hasRenderContent && !o;\n let u = !1,\n l = !0;\n\n for (const h of a) if (h._selectionDepth = r, h.isVisibleAndInRequestVolume ? (s.find(h) && s.delete(h), s.push(h), u = !0) : (c || i) && (this.loadTile(h, n), this.touchTile(h, n)), c) {\n let f;\n if (h._inRequestVolume ? h.hasRenderContent ? f = h.contentAvailable : f = this.executeEmptyTraversal(h, n) : f = !1, l = l && f, !l) return !1;\n }\n\n return u || (l = !1), l;\n }\n /* eslint-enable complexity, max-statements */\n\n\n updateTile(t, n) {\n this.updateTileVisibility(t, n);\n } // tile to render in the browser\n\n\n selectTile(t, n) {\n this.shouldSelectTile(t) && (t._selectedFrame = n.frameNumber, this.selectedTiles[t.id] = t);\n } // tile to load from server\n\n\n loadTile(t, n) {\n this.shouldLoadTile(t) && (t._requestedFrame = n.frameNumber, t._priority = t._getPriority(), this.requestedTiles[t.id] = t);\n } // cache tile\n\n\n touchTile(t, n) {\n t.tileset._cache.touch(t), t._touchedFrame = n.frameNumber;\n } // tile should be visible\n // tile should have children\n // tile LoD (level of detail) is not sufficient under current viewport\n\n\n canTraverse(t, n) {\n return t.hasChildren ? t.hasTilesetContent ? !t.contentExpired : this.shouldRefine(t, n) : !1;\n }\n\n shouldLoadTile(t) {\n return t.hasUnloadedContent || t.contentExpired;\n }\n\n shouldSelectTile(t) {\n return t.contentAvailable && !this.options.skipLevelOfDetail;\n }\n /** Decide if tile LoD (level of detail) is not sufficient under current viewport */\n\n\n shouldRefine(t, n, s = !1) {\n let r = t._screenSpaceError;\n return s && (r = t.getScreenSpaceError(n, !0)), r > t.tileset.memoryAdjustedScreenSpaceError;\n }\n\n updateTileVisibility(t, n) {\n const s = [];\n if (this.options.viewportTraversersMap) for (const r in this.options.viewportTraversersMap) this.options.viewportTraversersMap[r] === n.viewport.id && s.push(r);else s.push(n.viewport.id);\n t.updateVisibility(n, s);\n } // UTILITIES\n\n\n compareDistanceToCamera(t, n) {\n return t._distanceToCamera - n._distanceToCamera;\n }\n\n anyChildrenVisible(t, n) {\n let s = !1;\n\n for (const r of t.children) r.updateVisibility(n), s = s || r.isVisibleAndInRequestVolume;\n\n return s;\n } // Depth-first traversal that checks if all nearest descendants with content are loaded.\n // Ignores visibility.\n\n\n executeEmptyTraversal(t, n) {\n let s = !0;\n const r = this._emptyTraversalStack;\n\n for (r.push(t); r.length > 0;) {\n const i = r.pop(),\n o = !i.hasRenderContent && this.canTraverse(i, n),\n a = !i.hasRenderContent && i.children.length === 0;\n\n if (!o && !i.contentAvailable && !a && (s = !1), this.updateTile(i, n), i.isVisibleAndInRequestVolume || (this.loadTile(i, n), this.touchTile(i, n)), o) {\n const c = i.children;\n\n for (const u of c) r.push(u);\n }\n }\n\n return s;\n }\n\n}\n\nconst vo = new A();\n\nfunction EB(e) {\n return e != null;\n}\n\nclass ur {\n // TODO i3s specific, needs to remove\n\n /**\n * @constructs\n * Create a Tile3D instance\n * @param tileset - Tileset3D instance\n * @param header - tile header - JSON loaded from a dataset\n * @param parentHeader - parent Tile3D instance\n * @param extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n */\n // eslint-disable-next-line max-statements\n constructor(t, n, s, r = \"\") {\n p(this, \"tileset\");\n p(this, \"header\");\n p(this, \"id\");\n p(this, \"url\");\n p(this, \"parent\");\n /* Specifies the type of refine that is used when traversing this tile for rendering. */\n\n p(this, \"refine\");\n p(this, \"type\");\n p(this, \"contentUrl\");\n /** Different refinement algorithms used by I3S and 3D tiles */\n\n p(this, \"lodMetricType\", \"geometricError\");\n /** The error, in meters, introduced if this tile is rendered and its children are not. */\n\n p(this, \"lodMetricValue\", 0);\n /** @todo math.gl is not exporting BoundingVolume base type? */\n\n p(this, \"boundingVolume\", null);\n /**\n * The tile's content. This represents the actual tile's payload,\n * not the content's metadata in the tileset JSON file.\n */\n\n p(this, \"content\", null);\n p(this, \"contentState\", lt.UNLOADED);\n p(this, \"gpuMemoryUsageInBytes\", 0);\n /** The tile's children - an array of Tile3D objects. */\n\n p(this, \"children\", []);\n p(this, \"depth\", 0);\n p(this, \"viewportIds\", []);\n p(this, \"transform\", new V());\n p(this, \"extensions\", null);\n /** TODO Cesium 3d tiles specific */\n\n p(this, \"implicitTiling\", null);\n /** Container to store application specific data */\n\n p(this, \"userData\", {});\n p(this, \"computedTransform\");\n p(this, \"hasEmptyContent\", !1);\n p(this, \"hasTilesetContent\", !1);\n p(this, \"traverser\", new ts({}));\n /** Used by TilesetCache */\n\n p(this, \"_cacheNode\", null);\n p(this, \"_frameNumber\", null); // TODO Cesium 3d tiles specific\n\n p(this, \"_expireDate\", null);\n p(this, \"_expiredContent\", null);\n p(this, \"_boundingBox\");\n /** updated every frame for tree traversal and rendering optimizations: */\n\n p(this, \"_distanceToCamera\", 0);\n p(this, \"_screenSpaceError\", 0);\n p(this, \"_visibilityPlaneMask\");\n p(this, \"_visible\");\n p(this, \"_contentBoundingVolume\");\n p(this, \"_viewerRequestVolume\");\n p(this, \"_initialTransform\", new V()); // Used by traverser, cannot be marked private\n\n p(this, \"_priority\", 0);\n p(this, \"_selectedFrame\", 0);\n p(this, \"_requestedFrame\", 0);\n p(this, \"_selectionDepth\", 0);\n p(this, \"_touchedFrame\", 0);\n p(this, \"_centerZDepth\", 0);\n p(this, \"_shouldRefine\", !1);\n p(this, \"_stackLength\", 0);\n p(this, \"_visitedFrame\", 0);\n p(this, \"_inRequestVolume\", !1);\n p(this, \"_lodJudge\", null);\n this.header = n, this.tileset = t, this.id = r || n.id, this.url = n.url, this.parent = s, this.refine = this._getRefine(n.refine), this.type = n.type, this.contentUrl = n.contentUrl, this._initializeLodMetric(n), this._initializeTransforms(n), this._initializeBoundingVolumes(n), this._initializeContent(n), this._initializeRenderingState(n), Object.seal(this);\n }\n\n destroy() {\n this.header = null;\n }\n\n isDestroyed() {\n return this.header === null;\n }\n\n get selected() {\n return this._selectedFrame === this.tileset._frameNumber;\n }\n\n get isVisible() {\n return this._visible;\n }\n\n get isVisibleAndInRequestVolume() {\n return this._visible && this._inRequestVolume;\n }\n /** Returns true if tile is not an empty tile and not an external tileset */\n\n\n get hasRenderContent() {\n return !this.hasEmptyContent && !this.hasTilesetContent;\n }\n /** Returns true if tile has children */\n\n\n get hasChildren() {\n return this.children.length > 0 || this.header.children && this.header.children.length > 0;\n }\n /**\n * Determines if the tile's content is ready. This is automatically `true` for\n * tiles with empty content.\n */\n\n\n get contentReady() {\n return this.contentState === lt.READY || this.hasEmptyContent;\n }\n /**\n * Determines if the tile has available content to render. `true` if the tile's\n * content is ready or if it has expired content this renders while new content loads; otherwise,\n */\n\n\n get contentAvailable() {\n return !!(this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed);\n }\n /** Returns true if tile has renderable content but it's unloaded */\n\n\n get hasUnloadedContent() {\n return this.hasRenderContent && this.contentUnloaded;\n }\n /**\n * Determines if the tile's content has not be requested. `true` if tile's\n * content has not be requested; otherwise, `false`.\n */\n\n\n get contentUnloaded() {\n return this.contentState === lt.UNLOADED;\n }\n /**\n * Determines if the tile's content is expired. `true` if tile's\n * content is expired; otherwise, `false`.\n */\n\n\n get contentExpired() {\n return this.contentState === lt.EXPIRED;\n } // Determines if the tile's content failed to load. `true` if the tile's\n // content failed to load; otherwise, `false`.\n\n\n get contentFailed() {\n return this.contentState === lt.FAILED;\n }\n /**\n * Distance from the tile's bounding volume center to the camera\n */\n\n\n get distanceToCamera() {\n return this._distanceToCamera;\n }\n /**\n * Screen space error for LOD selection\n */\n\n\n get screenSpaceError() {\n return this._screenSpaceError;\n }\n /**\n * Get bounding box in cartographic coordinates\n * @returns [min, max] each in [longitude, latitude, altitude]\n */\n\n\n get boundingBox() {\n return this._boundingBox || (this._boundingBox = uB(this.header.boundingVolume, this.boundingVolume)), this._boundingBox;\n }\n /** Get the tile's screen space error. */\n\n\n getScreenSpaceError(t, n) {\n switch (this.tileset.type) {\n case At.I3S:\n return Lc(this, t);\n\n case At.TILES3D:\n return AB(this, t, n);\n\n default:\n throw new Error(\"Unsupported tileset type\");\n }\n }\n /**\n * Make tile unselected than means it won't be shown\n * but it can be still loaded in memory\n */\n\n\n unselect() {\n this._selectedFrame = 0;\n }\n /**\n * Memory usage of tile on GPU\n */\n\n\n _getGpuMemoryUsageInBytes() {\n return this.content.gpuMemoryUsageInBytes || this.content.byteLength || 0;\n }\n /*\n * If skipLevelOfDetail is off try to load child tiles as soon as possible so that their parent can refine sooner.\n * Tiles are prioritized by screen space error.\n */\n // eslint-disable-next-line complexity\n\n\n _getPriority() {\n const t = this.tileset._traverser,\n {\n skipLevelOfDetail: n\n } = t.options,\n s = this.refine === Ht.ADD || n;\n if (s && !this.isVisible && this._visible !== void 0 || this.tileset._frameNumber - this._touchedFrame >= 1 || this.contentState === lt.UNLOADED) return -1;\n const r = this.parent,\n o = r && (!s || this._screenSpaceError === 0 || r.hasTilesetContent) ? r._screenSpaceError : this._screenSpaceError,\n a = t.root ? t.root._screenSpaceError : 0;\n return Math.max(a - o, 0);\n }\n /**\n * Requests the tile's content.\n * The request may not be made if the Request Scheduler can't prioritize it.\n */\n // eslint-disable-next-line max-statements, complexity\n\n\n async loadContent() {\n if (this.hasEmptyContent) return !1;\n if (this.content) return !0;\n this.contentExpired && (this._expireDate = null), this.contentState = lt.LOADING;\n const n = await this.tileset._requestScheduler.scheduleRequest(this.id, this._getPriority.bind(this));\n if (!n) return this.contentState = lt.UNLOADED, !1;\n\n try {\n const s = this.tileset.getTileUrl(this.contentUrl),\n r = this.tileset.loader,\n i = { ...this.tileset.loadOptions,\n [r.id]: { // @ts-expect-error\n ...this.tileset.loadOptions[r.id],\n isTileset: this.type === \"json\",\n ...this._getLoaderSpecificOptions(r.id)\n }\n };\n return this.content = await Ae(s, r, i), this.tileset.options.contentLoader && (await this.tileset.options.contentLoader(this)), this._isTileset() && this.tileset._initializeTileHeaders(this.content, this), this.contentState = lt.READY, this._onContentLoaded(), !0;\n } catch (s) {\n throw this.contentState = lt.FAILED, s;\n } finally {\n n.done();\n }\n } // Unloads the tile's content.\n\n\n unloadContent() {\n return this.content && this.content.destroy && this.content.destroy(), this.content = null, this.header.content && this.header.content.destroy && this.header.content.destroy(), this.header.content = null, this.contentState = lt.UNLOADED, !0;\n }\n /**\n * Update the tile's visibility\n * @param {Object} frameState - frame state for tile culling\n * @param {string[]} viewportIds - a list of viewport ids that show this tile\n * @return {void}\n */\n\n\n updateVisibility(t, n) {\n if (this._frameNumber === t.frameNumber) return;\n const s = this.parent,\n r = s ? s._visibilityPlaneMask : dt.MASK_INDETERMINATE;\n\n if (this.tileset._traverser.options.updateTransforms) {\n const i = s ? s.computedTransform : this.tileset.modelMatrix;\n\n this._updateTransform(i);\n }\n\n this._distanceToCamera = this.distanceToTile(t), this._screenSpaceError = this.getScreenSpaceError(t, !1), this._visibilityPlaneMask = this.visibility(t, r), this._visible = this._visibilityPlaneMask !== dt.MASK_OUTSIDE, this._inRequestVolume = this.insideViewerRequestVolume(t), this._frameNumber = t.frameNumber, this.viewportIds = n;\n } // Determines whether the tile's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @param {Number} parentVisibilityPlaneMask The parent's plane mask to speed up the visibility check.\n // @returns {Number} A plane mask as described above in {@link CullingVolume#computeVisibilityWithPlaneMask}.\n\n\n visibility(t, n) {\n const {\n cullingVolume: s\n } = t,\n {\n boundingVolume: r\n } = this;\n return s.computeVisibilityWithPlaneMask(r, n);\n } // Assuming the tile's bounding volume intersects the culling volume, determines\n // whether the tile's content's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @returns {Intersect} The result of the intersection: the tile's content is completely outside, completely inside, or intersecting the culling volume.\n\n\n contentVisibility() {\n return !0;\n }\n /**\n * Computes the (potentially approximate) distance from the closest point of the tile's bounding volume to the camera.\n * @param frameState The frame state.\n * @returns {Number} The distance, in meters, or zero if the camera is inside the bounding volume.\n */\n\n\n distanceToTile(t) {\n const n = this.boundingVolume;\n return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position), 0));\n }\n /**\n * Computes the tile's camera-space z-depth.\n * @param frameState The frame state.\n * @returns The distance, in meters.\n */\n\n\n cameraSpaceZDepth({\n camera: t\n }) {\n const n = this.boundingVolume;\n return vo.subVectors(n.center, t.position), t.direction.dot(vo);\n }\n /**\n * Checks if the camera is inside the viewer request volume.\n * @param {FrameState} frameState The frame state.\n * @returns {Boolean} Whether the camera is inside the volume.\n */\n\n\n insideViewerRequestVolume(t) {\n const n = this._viewerRequestVolume;\n return !n || n.distanceSquaredTo(t.camera.position) <= 0;\n } // TODO Cesium specific\n // Update whether the tile has expired.\n\n\n updateExpiration() {\n if (EB(this._expireDate) && this.contentReady && !this.hasEmptyContent) {\n const t = Date.now();\n Date.lessThan(this._expireDate, t) && (this.contentState = lt.EXPIRED, this._expiredContent = this.content);\n }\n }\n\n get extras() {\n return this.header.extras;\n } // INTERNAL METHODS\n\n\n _initializeLodMetric(t) {\n \"lodMetricType\" in t ? this.lodMetricType = t.lodMetricType : (this.lodMetricType = this.parent && this.parent.lodMetricType || this.tileset.lodMetricType, console.warn(\"3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType\")), \"lodMetricValue\" in t ? this.lodMetricValue = t.lodMetricValue : (this.lodMetricValue = this.parent && this.parent.lodMetricValue || this.tileset.lodMetricValue, console.warn(\"3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue\"));\n }\n\n _initializeTransforms(t) {\n this.transform = t.transform ? new V(t.transform) : new V();\n const n = this.parent,\n s = this.tileset,\n r = n && n.computedTransform ? n.computedTransform.clone() : s.modelMatrix.clone();\n this.computedTransform = new V(r).multiplyRight(this.transform);\n const i = n && n._initialTransform ? n._initialTransform.clone() : new V();\n this._initialTransform = new V(i).multiplyRight(this.transform);\n }\n\n _initializeBoundingVolumes(t) {\n this._contentBoundingVolume = null, this._viewerRequestVolume = null, this._updateBoundingVolume(t);\n }\n\n _initializeContent(t) {\n this.content = {\n _tileset: this.tileset,\n _tile: this\n }, this.hasEmptyContent = !0, this.contentState = lt.UNLOADED, this.hasTilesetContent = !1, t.contentUrl && (this.content = null, this.hasEmptyContent = !1);\n } // TODO - remove anything not related to basic visibility detection\n\n\n _initializeRenderingState(t) {\n this.depth = t.level || (this.parent ? this.parent.depth + 1 : 0), this._shouldRefine = !1, this._distanceToCamera = 0, this._centerZDepth = 0, this._screenSpaceError = 0, this._visibilityPlaneMask = dt.MASK_INDETERMINATE, this._visible = void 0, this._inRequestVolume = !1, this._stackLength = 0, this._selectionDepth = 0, this._frameNumber = 0, this._touchedFrame = 0, this._visitedFrame = 0, this._selectedFrame = 0, this._requestedFrame = 0, this._priority = 0;\n }\n\n _getRefine(t) {\n return t || this.parent && this.parent.refine || Ht.REPLACE;\n }\n\n _isTileset() {\n return this.contentUrl.indexOf(\".json\") !== -1;\n }\n\n _onContentLoaded() {\n switch (this.content && this.content.type) {\n case \"vctr\":\n case \"geom\":\n this.tileset._traverser.disableSkipLevelOfDetail = !0;\n break;\n }\n\n this._isTileset() ? this.hasTilesetContent = !0 : this.gpuMemoryUsageInBytes = this._getGpuMemoryUsageInBytes();\n }\n\n _updateBoundingVolume(t) {\n this.boundingVolume = Os(t.boundingVolume, this.computedTransform, this.boundingVolume);\n const n = t.content;\n n && (n.boundingVolume && (this._contentBoundingVolume = Os(n.boundingVolume, this.computedTransform, this._contentBoundingVolume)), t.viewerRequestVolume && (this._viewerRequestVolume = Os(t.viewerRequestVolume, this.computedTransform, this._viewerRequestVolume)));\n } // Update the tile's transform. The transform is applied to the tile's bounding volumes.\n\n\n _updateTransform(t = new V()) {\n const n = t.clone().multiplyRight(this.transform);\n n.equals(this.computedTransform) || (this.computedTransform = n, this._updateBoundingVolume(this.header));\n } // Get options which are applicable only for the particular loader\n\n\n _getLoaderSpecificOptions(t) {\n switch (t) {\n case \"i3s\":\n return { ...this.tileset.options.i3s,\n _tileOptions: {\n attributeUrls: this.header.attributeUrls,\n textureUrl: this.header.textureUrl,\n textureFormat: this.header.textureFormat,\n textureLoaderOptions: this.header.textureLoaderOptions,\n materialDefinition: this.header.materialDefinition,\n isDracoGeometry: this.header.isDracoGeometry,\n mbs: this.header.mbs\n },\n _tilesetOptions: {\n store: this.tileset.tileset.store,\n attributeStorageInfo: this.tileset.tileset.attributeStorageInfo,\n fields: this.tileset.tileset.fields\n },\n isTileHeader: !1\n };\n\n case \"3d-tiles\":\n case \"cesium-ion\":\n default:\n return BB(this.tileset.tileset);\n }\n }\n\n}\n\nclass TB extends ts {\n compareDistanceToCamera(t, n) {\n return n._distanceToCamera === 0 && t._distanceToCamera === 0 ? n._centerZDepth - t._centerZDepth : n._distanceToCamera - t._distanceToCamera;\n }\n\n updateTileVisibility(t, n) {\n if (super.updateTileVisibility(t, n), !t.isVisibleAndInRequestVolume) return;\n const s = t.children.length > 0;\n\n if (t.hasTilesetContent && s) {\n const o = t.children[0];\n this.updateTileVisibility(o, n), t._visible = o._visible;\n return;\n }\n\n if (this.meetsScreenSpaceErrorEarly(t, n)) {\n t._visible = !1;\n return;\n }\n\n const r = t.refine === Ht.REPLACE,\n i = t._optimChildrenWithinParent === oB.USE_OPTIMIZATION;\n\n if (r && i && s && !this.anyChildrenVisible(t, n)) {\n t._visible = !1;\n return;\n }\n }\n\n meetsScreenSpaceErrorEarly(t, n) {\n const {\n parent: s\n } = t;\n return !s || s.hasTilesetContent || s.refine !== Ht.ADD ? !1 : !this.shouldRefine(t, n, !0);\n }\n\n}\n\nclass bB {\n constructor() {\n p(this, \"frameNumberMap\", /* @__PURE__ */new Map());\n }\n /**\n * Register a new pending tile header for the particular frameNumber\n * @param viewportId\n * @param frameNumber\n */\n\n\n register(t, n) {\n const s = this.frameNumberMap.get(t) || /* @__PURE__ */new Map(),\n r = s.get(n) || 0;\n s.set(n, r + 1), this.frameNumberMap.set(t, s);\n }\n /**\n * Deregister a pending tile header for the particular frameNumber\n * @param viewportId\n * @param frameNumber\n */\n\n\n deregister(t, n) {\n const s = this.frameNumberMap.get(t);\n if (!s) return;\n const r = s.get(n) || 1;\n s.set(n, r - 1);\n }\n /**\n * Check is there are no pending tile headers registered for the particular frameNumber\n * @param viewportId\n * @param frameNumber\n * @returns\n */\n\n\n isZero(t, n) {\n var r;\n return (((r = this.frameNumberMap.get(t)) == null ? void 0 : r.get(n)) || 0) === 0;\n }\n\n}\n\nconst Ls = {\n REQUESTED: \"REQUESTED\",\n COMPLETED: \"COMPLETED\",\n ERROR: \"ERROR\"\n};\n\nclass _B {\n constructor() {\n p(this, \"_statusMap\");\n p(this, \"pendingTilesRegister\", new bB());\n this._statusMap = {};\n }\n /**\n * Add request to map\n * @param request - node metadata request\n * @param key - unique key\n * @param callback - callback after request completed\n * @param frameState - frameState data\n */\n\n\n add(t, n, s, r) {\n if (!this._statusMap[n]) {\n const {\n frameNumber: i,\n viewport: {\n id: o\n }\n } = r;\n this._statusMap[n] = {\n request: t,\n callback: s,\n key: n,\n frameState: r,\n status: Ls.REQUESTED\n }, this.pendingTilesRegister.register(o, i), t().then(a => {\n this._statusMap[n].status = Ls.COMPLETED;\n const {\n frameNumber: c,\n viewport: {\n id: u\n }\n } = this._statusMap[n].frameState;\n this.pendingTilesRegister.deregister(u, c), this._statusMap[n].callback(a, r);\n }).catch(a => {\n this._statusMap[n].status = Ls.ERROR;\n const {\n frameNumber: c,\n viewport: {\n id: u\n }\n } = this._statusMap[n].frameState;\n this.pendingTilesRegister.deregister(u, c), s(a);\n });\n }\n }\n /**\n * Update request if it is still actual for the new frameState\n * @param key - unique key\n * @param frameState - frameState data\n */\n\n\n update(t, n) {\n if (this._statusMap[t]) {\n const {\n frameNumber: s,\n viewport: {\n id: r\n }\n } = this._statusMap[t].frameState;\n this.pendingTilesRegister.deregister(r, s);\n const {\n frameNumber: i,\n viewport: {\n id: o\n }\n } = n;\n this.pendingTilesRegister.register(o, i), this._statusMap[t].frameState = n;\n }\n }\n /**\n * Find request in the map\n * @param key - unique key\n * @returns\n */\n\n\n find(t) {\n return this._statusMap[t];\n }\n /**\n * Check it there are pending tile headers for the particular frameNumber\n * @param viewportId\n * @param frameNumber\n * @returns\n */\n\n\n hasPendingTiles(t, n) {\n return !this.pendingTilesRegister.isZero(t, n);\n }\n\n}\n\nclass wB extends ts {\n constructor(n) {\n super(n);\n p(this, \"_tileManager\");\n this._tileManager = new _B();\n }\n /**\n * Check if there are no penging tile header requests,\n * that means the traversal is finished and we can call\n * following-up callbacks.\n */\n\n\n traversalFinished(n) {\n return !this._tileManager.hasPendingTiles(n.viewport.id, this._frameNumber || 0);\n }\n\n shouldRefine(n, s) {\n return n._lodJudge = yB(n, s), n._lodJudge === \"DIG\";\n }\n\n updateChildTiles(n, s) {\n const r = n.header.children || [],\n i = n.children,\n o = n.tileset;\n\n for (const a of r) {\n const c = `${a.id}-${s.viewport.id}`,\n u = i && i.find(l => l.id === c);\n if (u) u && this.updateTile(u, s);else {\n let l = () => this._loadTile(a.id, o);\n\n this._tileManager.find(c) ? this._tileManager.update(c, s) : (o.tileset.nodePages && (l = () => o.tileset.nodePagesTile.formTileFromNodePages(a.id)), this._tileManager.add(l, c, f => this._onTileLoad(f, n, c), s));\n }\n }\n\n return !1;\n }\n\n async _loadTile(n, s) {\n const {\n loader: r\n } = s,\n i = s.getTileUrl(`${s.url}/nodes/${n}`),\n o = { ...s.loadOptions,\n i3s: { ...s.loadOptions.i3s,\n isTileHeader: !0\n }\n };\n return await Ae(i, r, o);\n }\n /**\n * The callback to init Tile3D instance after loading the tile JSON\n * @param {Object} header - the tile JSON from a dataset\n * @param {Tile3D} tile - the parent Tile3D instance\n * @param {string} extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n * @return {void}\n */\n\n\n _onTileLoad(n, s, r) {\n const i = new ur(s.tileset, n, s, r);\n s.children.push(i);\n\n const o = this._tileManager.find(i.id).frameState;\n\n this.updateTile(i, o), this._frameNumber === o.frameNumber && (this.traversalFinished(o) || /* @__PURE__ */new Date().getTime() - this.lastUpdate > this.updateDebounceTime) && this.executeTraversal(i, o);\n }\n\n}\n\nconst RB = {\n description: \"\",\n ellipsoid: J.WGS84,\n modelMatrix: new V(),\n throttleRequests: !0,\n maxRequests: 64,\n\n /** Default memory values optimized for viewing mesh-based 3D Tiles on both mobile and desktop devices */\n maximumMemoryUsage: 32,\n memoryCacheOverflow: 1,\n maximumTilesSelected: 0,\n debounceTime: 0,\n onTileLoad: () => {},\n onTileUnload: () => {},\n onTileError: () => {},\n onTraversalComplete: e => e,\n contentLoader: void 0,\n viewDistanceScale: 1,\n maximumScreenSpaceError: 8,\n memoryAdjustedScreenSpaceError: !1,\n loadTiles: !0,\n updateTransforms: !0,\n viewportTraversersMap: null,\n loadOptions: {\n fetch: {}\n },\n attributions: [],\n basePath: \"\",\n i3s: {}\n},\n Cn = \"Tiles In Tileset(s)\",\n Ps = \"Tiles In Memory\",\n Oo = \"Tiles In View\",\n Fo = \"Tiles To Render\",\n Do = \"Tiles Loaded\",\n Gs = \"Tiles Loading\",\n Lo = \"Tiles Unloaded\",\n Po = \"Failed Tile Loads\",\n Go = \"Points/Vertices\",\n Ns = \"Tile Memory Use\",\n No = \"Maximum Screen Space Error\";\n\nclass MB {\n /**\n * Create a new Tileset3D\n * @param json\n * @param props\n */\n // eslint-disable-next-line max-statements\n constructor(t, n) {\n // props: Tileset3DProps;\n p(this, \"options\");\n p(this, \"loadOptions\");\n p(this, \"type\");\n p(this, \"tileset\");\n p(this, \"loader\");\n p(this, \"url\");\n p(this, \"basePath\");\n p(this, \"modelMatrix\");\n p(this, \"ellipsoid\");\n p(this, \"lodMetricType\");\n p(this, \"lodMetricValue\");\n p(this, \"refine\");\n p(this, \"root\", null);\n p(this, \"roots\", {});\n /** @todo any->unknown */\n\n p(this, \"asset\", {}); // Metadata for the entire tileset\n\n p(this, \"description\", \"\");\n p(this, \"properties\");\n p(this, \"extras\", null);\n p(this, \"attributions\", {});\n p(this, \"credits\", {});\n p(this, \"stats\");\n /** flags that contain information about data types in nested tiles */\n\n p(this, \"contentFormats\", {\n draco: !1,\n meshopt: !1,\n dds: !1,\n ktx2: !1\n }); // view props\n\n p(this, \"cartographicCenter\", null);\n p(this, \"cartesianCenter\", null);\n p(this, \"zoom\", 1);\n p(this, \"boundingVolume\", null);\n /** Updated based on the camera position and direction */\n\n p(this, \"dynamicScreenSpaceErrorComputedDensity\", 0); // METRICS\n\n /**\n * The maximum amount of GPU memory (in MB) that may be used to cache tiles\n * Tiles not in view are unloaded to enforce private\n */\n\n p(this, \"maximumMemoryUsage\", 32);\n /** The total amount of GPU memory in bytes used by the tileset. */\n\n p(this, \"gpuMemoryUsageInBytes\", 0);\n /**\n * If loading the level of detail required by maximumScreenSpaceError\n * results in the memory usage exceeding maximumMemoryUsage (GPU), level of detail refinement\n * will instead use this (larger) adjusted screen space error to achieve the\n * best possible visual quality within the available memory.\n */\n\n p(this, \"memoryAdjustedScreenSpaceError\", 0);\n p(this, \"_cacheBytes\", 0);\n p(this, \"_cacheOverflowBytes\", 0);\n /** Update tracker. increase in each update cycle. */\n\n p(this, \"_frameNumber\", 0);\n p(this, \"_queryParams\", {});\n p(this, \"_extensionsUsed\", []);\n p(this, \"_tiles\", {});\n /** counter for tracking tiles requests */\n\n p(this, \"_pendingCount\", 0);\n /** Hold traversal results */\n\n p(this, \"selectedTiles\", []); // TRAVERSAL\n\n p(this, \"traverseCounter\", 0);\n p(this, \"geometricError\", 0);\n p(this, \"lastUpdatedVieports\", null);\n p(this, \"_requestedTiles\", []);\n p(this, \"_emptyTiles\", []);\n p(this, \"frameStateData\", {});\n p(this, \"_traverser\");\n p(this, \"_cache\", new qy());\n p(this, \"_requestScheduler\"); // Promise tracking\n\n p(this, \"updatePromise\", null);\n p(this, \"tilesetInitializationPromise\");\n this.options = { ...RB,\n ...n\n }, this.tileset = t, this.loader = t.loader, this.type = t.type, this.url = t.url, this.basePath = t.basePath || Wy(this.url), this.modelMatrix = this.options.modelMatrix, this.ellipsoid = this.options.ellipsoid, this.lodMetricType = t.lodMetricType, this.lodMetricValue = t.lodMetricValue, this.refine = t.root.refine, this.loadOptions = this.options.loadOptions || {}, this._traverser = this._initializeTraverser(), this._requestScheduler = new zy({\n throttleRequests: this.options.throttleRequests,\n maxRequests: this.options.maxRequests\n }), this.memoryAdjustedScreenSpaceError = this.options.maximumScreenSpaceError, this._cacheBytes = this.options.maximumMemoryUsage * 1024 * 1024, this._cacheOverflowBytes = this.options.memoryCacheOverflow * 1024 * 1024, this.stats = new $o({\n id: this.url\n }), this._initializeStats(), this.tilesetInitializationPromise = this._initializeTileSet(t);\n }\n /** Release resources */\n\n\n destroy() {\n this._destroy();\n }\n /** Is the tileset loaded (update needs to have been called at least once) */\n\n\n isLoaded() {\n return this._pendingCount === 0 && this._frameNumber !== 0 && this._requestedTiles.length === 0;\n }\n\n get tiles() {\n return Object.values(this._tiles);\n }\n\n get frameNumber() {\n return this._frameNumber;\n }\n\n get queryParams() {\n return new URLSearchParams(this._queryParams).toString();\n }\n\n setProps(t) {\n this.options = { ...this.options,\n ...t\n };\n }\n /** @deprecated */\n // setOptions(options: Tileset3DProps): void {\n // this.options = {...this.options, ...options};\n // }\n\n /**\n * Return a loadable tile url for a specific tile subpath\n * @param tilePath a tile subpath\n */\n\n\n getTileUrl(t) {\n if (t.startsWith(\"data:\")) return t;\n let s = t;\n return this.queryParams.length && (s = `${t}${t.includes(\"?\") ? \"&\" : \"?\"}${this.queryParams}`), s;\n } // TODO CESIUM specific\n\n\n hasExtension(t) {\n return this._extensionsUsed.indexOf(t) > -1;\n }\n /**\n * Update visible tiles relying on a list of viewports\n * @param viewports - list of viewports\n * @deprecated\n */\n\n\n update(t = null) {\n this.tilesetInitializationPromise.then(() => {\n !t && this.lastUpdatedVieports ? t = this.lastUpdatedVieports : this.lastUpdatedVieports = t, t && this.doUpdate(t);\n });\n }\n /**\n * Update visible tiles relying on a list of viewports.\n * Do it with debounce delay to prevent update spam\n * @param viewports viewports\n * @returns Promise of new frameNumber\n */\n\n\n async selectTiles(t = null) {\n return await this.tilesetInitializationPromise, t && (this.lastUpdatedVieports = t), this.updatePromise || (this.updatePromise = new Promise(n => {\n setTimeout(() => {\n this.lastUpdatedVieports && this.doUpdate(this.lastUpdatedVieports), n(this._frameNumber), this.updatePromise = null;\n }, this.options.debounceTime);\n })), this.updatePromise;\n }\n\n adjustScreenSpaceError() {\n this.gpuMemoryUsageInBytes < this._cacheBytes ? this.memoryAdjustedScreenSpaceError = Math.max(this.memoryAdjustedScreenSpaceError / 1.02, this.options.maximumScreenSpaceError) : this.gpuMemoryUsageInBytes > this._cacheBytes + this._cacheOverflowBytes && (this.memoryAdjustedScreenSpaceError *= 1.02);\n }\n /**\n * Update visible tiles relying on a list of viewports\n * @param viewports viewports\n */\n // eslint-disable-next-line max-statements, complexity\n\n\n doUpdate(t) {\n if (\"loadTiles\" in this.options && !this.options.loadTiles || this.traverseCounter > 0) return;\n const n = t instanceof Array ? t : [t];\n this._cache.reset(), this._frameNumber++, this.traverseCounter = n.length;\n const s = [];\n\n for (const r of n) {\n const i = r.id;\n this._needTraverse(i) ? s.push(i) : this.traverseCounter--;\n }\n\n for (const r of n) {\n const i = r.id;\n if (this.roots[i] || (this.roots[i] = this._initializeTileHeaders(this.tileset, null)), !s.includes(i)) continue;\n const o = $y(r, this._frameNumber);\n\n this._traverser.traverse(this.roots[i], o, this.options);\n }\n }\n /**\n * Check if traversal is needed for particular viewport\n * @param {string} viewportId - id of a viewport\n * @return {boolean}\n */\n\n\n _needTraverse(t) {\n let n = t;\n return this.options.viewportTraversersMap && (n = this.options.viewportTraversersMap[t]), n === t;\n }\n /**\n * The callback to post-process tiles after traversal procedure\n * @param frameState - frame state for tile culling\n */\n\n\n _onTraversalEnd(t) {\n const n = t.viewport.id;\n this.frameStateData[n] || (this.frameStateData[n] = {\n selectedTiles: [],\n _requestedTiles: [],\n _emptyTiles: []\n });\n const s = this.frameStateData[n],\n r = Object.values(this._traverser.selectedTiles),\n [i, o] = Zy(r, t, this.options.maximumTilesSelected);\n s.selectedTiles = i;\n\n for (const a of o) a.unselect();\n\n s._requestedTiles = Object.values(this._traverser.requestedTiles), s._emptyTiles = Object.values(this._traverser.emptyTiles), this.traverseCounter--, !(this.traverseCounter > 0) && this._updateTiles();\n }\n /**\n * Update tiles relying on data from all traversers\n */\n\n\n _updateTiles() {\n this.selectedTiles = [], this._requestedTiles = [], this._emptyTiles = [];\n\n for (const t in this.frameStateData) {\n const n = this.frameStateData[t];\n this.selectedTiles = this.selectedTiles.concat(n.selectedTiles), this._requestedTiles = this._requestedTiles.concat(n._requestedTiles), this._emptyTiles = this._emptyTiles.concat(n._emptyTiles);\n }\n\n this.selectedTiles = this.options.onTraversalComplete(this.selectedTiles);\n\n for (const t of this.selectedTiles) this._tiles[t.id] = t;\n\n this._loadTiles(), this._unloadTiles(), this._updateStats();\n }\n\n _tilesChanged(t, n) {\n if (t.length !== n.length) return !0;\n const s = new Set(t.map(o => o.id)),\n r = new Set(n.map(o => o.id));\n let i = t.filter(o => !r.has(o.id)).length > 0;\n return i = i || n.filter(o => !s.has(o.id)).length > 0, i;\n }\n\n _loadTiles() {\n for (const t of this._requestedTiles) t.contentUnloaded && this._loadTile(t);\n }\n\n _unloadTiles() {\n this._cache.unloadTiles(this, (t, n) => t._unloadTile(n));\n }\n\n _updateStats() {\n let t = 0,\n n = 0;\n\n for (const s of this.selectedTiles) s.contentAvailable && s.content && (t++, s.content.pointCount ? n += s.content.pointCount : n += s.content.vertexCount);\n\n this.stats.get(Oo).count = this.selectedTiles.length, this.stats.get(Fo).count = t, this.stats.get(Go).count = n, this.stats.get(No).count = this.memoryAdjustedScreenSpaceError;\n }\n\n async _initializeTileSet(t) {\n this.type === At.I3S && (this.calculateViewPropsI3S(), t.root = await t.root), this.root = this._initializeTileHeaders(t, null), this.type === At.TILES3D && (this._initializeTiles3DTileset(t), this.calculateViewPropsTiles3D()), this.type === At.I3S && this._initializeI3STileset();\n }\n /**\n * Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom.\n * These metrics help apps center view on tileset\n * For I3S there is extent (<1.8 version) or fullExtent (>=1.8 version) to calculate view props\n * @returns\n */\n\n\n calculateViewPropsI3S() {\n var s;\n const t = this.tileset.fullExtent;\n\n if (t) {\n const {\n xmin: r,\n xmax: i,\n ymin: o,\n ymax: a,\n zmin: c,\n zmax: u\n } = t;\n this.cartographicCenter = new A(r + (i - r) / 2, o + (a - o) / 2, c + (u - c) / 2), this.cartesianCenter = new A(), J.WGS84.cartographicToCartesian(this.cartographicCenter, this.cartesianCenter), this.zoom = xc(t, this.cartographicCenter, this.cartesianCenter);\n return;\n }\n\n const n = (s = this.tileset.store) == null ? void 0 : s.extent;\n\n if (n) {\n const [r, i, o, a] = n;\n this.cartographicCenter = new A(r + (o - r) / 2, i + (a - i) / 2, 0), this.cartesianCenter = new A(), J.WGS84.cartographicToCartesian(this.cartographicCenter, this.cartesianCenter), this.zoom = rB(n, this.cartographicCenter, this.cartesianCenter);\n return;\n }\n\n console.warn(\"Extent is not defined in the tileset header\"), this.cartographicCenter = new A(), this.zoom = 1;\n }\n /**\n * Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom.\n * These metrics help apps center view on tileset.\n * For 3DTiles the root tile data is used to calculate view props.\n * @returns\n */\n\n\n calculateViewPropsTiles3D() {\n const t = this.root,\n {\n center: n\n } = t.boundingVolume;\n\n if (!n) {\n console.warn(\"center was not pre-calculated for the root tile\"), this.cartographicCenter = new A(), this.zoom = 1;\n return;\n }\n\n n[0] !== 0 || n[1] !== 0 || n[2] !== 0 ? (this.cartographicCenter = new A(), J.WGS84.cartesianToCartographic(n, this.cartographicCenter)) : this.cartographicCenter = new A(0, 0, -J.WGS84.radii[0]), this.cartesianCenter = n, this.zoom = sB(t.boundingVolume, this.cartographicCenter);\n }\n\n _initializeStats() {\n this.stats.get(Cn), this.stats.get(Gs), this.stats.get(Ps), this.stats.get(Oo), this.stats.get(Fo), this.stats.get(Do), this.stats.get(Lo), this.stats.get(Po), this.stats.get(Go), this.stats.get(Ns, \"memory\"), this.stats.get(No);\n } // Installs the main tileset JSON file or a tileset JSON file referenced from a tile.\n // eslint-disable-next-line max-statements\n\n\n _initializeTileHeaders(t, n) {\n var r;\n const s = new ur(this, t.root, n);\n\n if (n && (n.children.push(s), s.depth = n.depth + 1), this.type === At.TILES3D) {\n const i = [];\n\n for (i.push(s); i.length > 0;) {\n const o = i.pop();\n this.stats.get(Cn).incrementCount();\n const a = o.header.children || [];\n\n for (const c of a) {\n const u = new ur(this, c, o);\n\n if ((r = u.contentUrl) != null && r.includes(\"?session=\")) {\n const h = new URL(u.contentUrl).searchParams.get(\"session\");\n h && (this._queryParams.session = h);\n }\n\n o.children.push(u), u.depth = o.depth + 1, i.push(u);\n }\n }\n }\n\n return s;\n }\n\n _initializeTraverser() {\n let t;\n\n switch (this.type) {\n case At.TILES3D:\n t = TB;\n break;\n\n case At.I3S:\n t = wB;\n break;\n\n default:\n t = ts;\n }\n\n return new t({\n basePath: this.basePath,\n onTraversalEnd: this._onTraversalEnd.bind(this)\n });\n }\n\n _destroyTileHeaders(t) {\n this._destroySubtree(t);\n }\n\n async _loadTile(t) {\n let n;\n\n try {\n this._onStartTileLoading(), n = await t.loadContent();\n } catch (s) {\n this._onTileLoadError(t, s instanceof Error ? s : new Error(\"load failed\"));\n } finally {\n this._onEndTileLoading(), this._onTileLoad(t, n);\n }\n }\n\n _onTileLoadError(t, n) {\n this.stats.get(Po).incrementCount();\n const s = n.message || n.toString(),\n r = t.url;\n console.error(`A 3D tile failed to load: ${t.url} ${s}`), this.options.onTileError(t, s, r);\n }\n\n _onTileLoad(t, n) {\n var s, r;\n\n if (n) {\n if (this.type === At.I3S) {\n const i = ((r = (s = this.tileset) == null ? void 0 : s.nodePagesTile) == null ? void 0 : r.nodesInNodePages) || 0;\n this.stats.get(Cn).reset(), this.stats.get(Cn).addCount(i);\n }\n\n t && t.content && Yy(t, t.content), this.updateContentTypes(t), this._addTileToCache(t), this.options.onTileLoad(t);\n }\n }\n /**\n * Update information about data types in nested tiles\n * @param tile instance of a nested Tile3D\n */\n\n\n updateContentTypes(t) {\n var n;\n if (this.type === At.I3S) switch (t.header.isDracoGeometry && (this.contentFormats.draco = !0), t.header.textureFormat) {\n case \"dds\":\n this.contentFormats.dds = !0;\n break;\n\n case \"ktx2\":\n this.contentFormats.ktx2 = !0;\n break;\n } else if (this.type === At.TILES3D) {\n const {\n extensionsRemoved: s = []\n } = ((n = t.content) == null ? void 0 : n.gltf) || {};\n s.includes(\"KHR_draco_mesh_compression\") && (this.contentFormats.draco = !0), s.includes(\"EXT_meshopt_compression\") && (this.contentFormats.meshopt = !0), s.includes(\"KHR_texture_basisu\") && (this.contentFormats.ktx2 = !0);\n }\n }\n\n _onStartTileLoading() {\n this._pendingCount++, this.stats.get(Gs).incrementCount();\n }\n\n _onEndTileLoading() {\n this._pendingCount--, this.stats.get(Gs).decrementCount();\n }\n\n _addTileToCache(t) {\n this._cache.add(this, t, n => n._updateCacheStats(t));\n }\n\n _updateCacheStats(t) {\n this.stats.get(Do).incrementCount(), this.stats.get(Ps).incrementCount(), this.gpuMemoryUsageInBytes += t.gpuMemoryUsageInBytes || 0, this.stats.get(Ns).count = this.gpuMemoryUsageInBytes, this.options.memoryAdjustedScreenSpaceError && this.adjustScreenSpaceError();\n }\n\n _unloadTile(t) {\n this.gpuMemoryUsageInBytes -= t.gpuMemoryUsageInBytes || 0, this.stats.get(Ps).decrementCount(), this.stats.get(Lo).incrementCount(), this.stats.get(Ns).count = this.gpuMemoryUsageInBytes, this.options.onTileUnload(t), t.unloadContent();\n } // Traverse the tree and destroy all tiles\n\n\n _destroy() {\n const t = [];\n\n for (this.root && t.push(this.root); t.length > 0;) {\n const n = t.pop();\n\n for (const s of n.children) t.push(s);\n\n this._destroyTile(n);\n }\n\n this.root = null;\n } // Traverse the tree and destroy all sub tiles\n\n\n _destroySubtree(t) {\n const n = t,\n s = [];\n\n for (s.push(n); s.length > 0;) {\n t = s.pop();\n\n for (const r of t.children) s.push(r);\n\n t !== n && this._destroyTile(t);\n }\n\n n.children = [];\n }\n\n _destroyTile(t) {\n this._cache.unloadTile(this, t), this._unloadTile(t), t.destroy();\n }\n\n _initializeTiles3DTileset(t) {\n if (t.queryString) {\n const n = new URLSearchParams(t.queryString),\n s = Object.fromEntries(n.entries());\n this._queryParams = { ...this._queryParams,\n ...s\n };\n }\n\n if (this.asset = t.asset, !this.asset) throw new Error(\"Tileset must have an asset property.\");\n if (this.asset.version !== \"0.0\" && this.asset.version !== \"1.0\" && this.asset.version !== \"1.1\") throw new Error(\"The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.\");\n \"tilesetVersion\" in this.asset && (this._queryParams.v = this.asset.tilesetVersion), this.credits = {\n attributions: this.options.attributions || []\n }, this.description = this.options.description || \"\", this.properties = t.properties, this.geometricError = t.geometricError, this._extensionsUsed = t.extensionsUsed || [], this.extras = t.extras;\n }\n\n _initializeI3STileset() {\n this.loadOptions.i3s && \"token\" in this.loadOptions.i3s && (this._queryParams.token = this.loadOptions.i3s.token);\n }\n\n}\n\nfunction SB(e) {\n let t = 0;\n\n for (const s in e.attributes) {\n const r = e.getAttribute(s);\n t += r.count * r.itemSize * r.array.BYTES_PER_ELEMENT;\n }\n\n const n = e.getIndex();\n return t += n ? n.count * n.itemSize * n.array.BYTES_PER_ELEMENT : 0, t;\n}\n\nfunction Pc(e) {\n const n = document.createElement(\"canvas\");\n n.width = 64, n.height = 64;\n const s = n.getContext(\"2d\");\n s.rect(0, 0, 64, 64);\n const r = s.createLinearGradient(0, 0, 64, 64);\n\n for (let o = 0; o < e.length; o++) {\n const a = e[o];\n r.addColorStop(a[0], \"#\" + a[1].getHexString());\n }\n\n s.fillStyle = r, s.fill();\n const i = new three__WEBPACK_IMPORTED_MODULE_0__.CanvasTexture(n);\n return i.needsUpdate = !0, i.minFilter = three__WEBPACK_IMPORTED_MODULE_0__.LinearFilter, i.wrapS = three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping, i.wrapT = three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping, i.repeat.set(2, 2), i;\n}\n\nfunction Uo(e) {\n e.updateMatrix(), e.updateMatrixWorld(), e.matrixWorldInverse.copy(e.matrixWorld).invert();\n const t = new three__WEBPACK_IMPORTED_MODULE_0__.Frustum();\n return t.setFromProjectionMatrix(new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse)), t;\n}\n\nfunction IB(e) {\n const t = new three__WEBPACK_IMPORTED_MODULE_0__.Group(),\n n = new three__WEBPACK_IMPORTED_MODULE_0__.PlaneGeometry(10, 5),\n s = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(...e.projectPointOntoPlane([0, 0, 0])),\n r = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(e.normal.x, e.normal.y, e.normal.z),\n i = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().copy(s).add(r);\n n.lookAt(i), n.translate(s.x, s.y, s.z);\n const o = new three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial({\n color: 65535,\n side: three__WEBPACK_IMPORTED_MODULE_0__.DoubleSide\n }),\n a = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(n, o),\n c = new three__WEBPACK_IMPORTED_MODULE_0__.ArrowHelper(r, s, 5, 16776960);\n return t.add(c), t.add(a), t;\n}\n\nfunction Ho(e) {\n const {\n boundingVolume: t\n } = e;\n let n = 0;\n e.content && (n = Math.min(e.content.byteLength / 5e5, 1));\n const s = new three__WEBPACK_IMPORTED_MODULE_0__.Color(n, 1, 0),\n r = new three__WEBPACK_IMPORTED_MODULE_0__.BoxGeometry(1, 1, 1),\n i = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\n t.halfAxes ? i.copy(Gc(t.halfAxes)) : t.radius && r.scale(t.radius * 2, t.radius * 2, t.radius * 2), r.applyMatrix4(i);\n const o = new three__WEBPACK_IMPORTED_MODULE_0__.EdgesGeometry(r),\n a = new three__WEBPACK_IMPORTED_MODULE_0__.LineSegments(o, new three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial({\n color: s\n }));\n return a.position.copy(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(...t.center)), a;\n}\n\nfunction Gc(e) {\n const t = e;\n return new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().fromArray([t[0] * 2, t[1] * 2, t[2] * 2, 0, t[3] * 2, t[4] * 2, t[5] * 2, 0, t[6] * 2, t[7] * 2, t[8] * 2, 0, 0, 0, 0, 1]);\n}\n\nfunction xB(e, t) {\n const r = 2 * Math.PI * 6378137 / 2,\n i = t * r / 180;\n let o = Math.log(Math.tan((90 + e) * Math.PI / 360)) / (Math.PI / 180);\n return o = o * r / 180, new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(i, o);\n}\n\nfunction vB(e) {\n let t = 0;\n\n if ((e == null ? void 0 : e.userData.mimeType) == \"image/ktx2\" && e.mipmaps) {\n for (let n = 0; n < e.mipmaps.length; n++) t += e.mipmaps[n].data.byteLength;\n\n return t;\n } else if (e.image) {\n const {\n image: n\n } = e,\n s = 4;\n let r = [n.width, n.height];\n\n for (; r[0] > 1 || r[1] > 1;) t += r[0] * r[1] * s, r[0] = Math.max(Math.floor(r[0] / 2), 1), r[1] = Math.max(Math.floor(r[1] / 2), 1);\n\n return t += 1 * 1 * s, t;\n } else return;\n}\n\nfunction Nc(e) {\n return SB(e);\n}\n\nlet ht = null,\n Mt = null,\n Jn = null,\n Mn = null;\nconst Jo = {\n minHeight: 0,\n maxHeight: 300,\n samples: 4,\n sampleStep: 4,\n opacity: 0.5,\n blendingType: three__WEBPACK_IMPORTED_MODULE_0__.NormalBlending\n};\n\nfunction OB(e, t, n, s = Jo) {\n ht && ht.dispose(), Mt || (Mt = n);\n const r = { ...Jo,\n ...s\n };\n ht = new three__WEBPACK_IMPORTED_MODULE_0__.WebGLRenderTarget(e.width * e.devicePixelRatio, e.height * e.devicePixelRatio), ht.texture.minFilter = three__WEBPACK_IMPORTED_MODULE_0__.NearestFilter, ht.texture.magFilter = three__WEBPACK_IMPORTED_MODULE_0__.NearestFilter, ht.stencilBuffer = !1, ht.texture.format = three__WEBPACK_IMPORTED_MODULE_0__.RGBAFormat, ht.texture.type = three__WEBPACK_IMPORTED_MODULE_0__.FloatType, Mt.setPixelRatio(devicePixelRatio), Mt.setSize(e.width, e.height), Mt.setRenderTarget(ht), Jn = new three__WEBPACK_IMPORTED_MODULE_0__.Scene(), Jn.overrideMaterial = LB, Mn = t, kt.uniforms.tPosition.value = ht.texture, kt.uniforms.minHeight.value = r.minHeight, kt.uniforms.maxHeight.value = r.maxHeight, kt.uniforms.samples.value = r.samples, kt.uniforms.sampleStep.value = r.sampleStep, kt.uniforms.opacity.value = r.opacity, kt.blending = r.blendingType;\n}\n\nfunction FB(e) {\n ht.setSize(e.width * e.devicePixelRatio, e.height * e.devicePixelRatio), Mt.setPixelRatio(devicePixelRatio), Mt.setSize(e.width, e.height);\n}\n\nfunction DB(e) {\n if (Mt) {\n const t = Mn.parent;\n Jn.add(Mn), Mt.setRenderTarget(ht), Mt.render(Jn, e), t && t.add(Mn), Mt.setRenderTarget(null);\n }\n}\n\nconst Vn = e => e.toString(),\n LB = new three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial({\n vertexShader: Vn`\n varying vec3 vPosition;\n void main() {\n vPosition = (modelMatrix * vec4(position, 1.0)).xyz;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n `,\n fragmentShader: Vn`\n varying vec3 vPosition;\n void main() {\n gl_FragColor = vec4(vPosition, 1.0);\n }\n `,\n side: three__WEBPACK_IMPORTED_MODULE_0__.DoubleSide\n}),\n PB = Vn`\n #include \n\n varying vec2 vUv;\n varying vec3 vColor;\n uniform sampler2D tPosition;\n uniform float minHeight;\n uniform float maxHeight;\n uniform int samples;\n uniform float sampleStep;\n\n mat4 MVP;\n\n // Convert to normalized screen coordinates\n vec4 toNSC(const in vec4 v) {\n return vec4(0.5 * (v.xyz / v.w) + 0.5, v.w);\n }\n vec4 vertexDraping(\n const in sampler2D positionTex, // Position G-Buffer\n const in vec4 Vin // Vertex to drape\n ) {\n float texSize = float(textureSize(positionTex, 0).x);\n float pixelSize = 1.0 / texSize;\n vec2 stepSize = vec2(sampleStep/texSize);\n vec4 VinWorld = modelMatrix * Vin;\n\n vec4 lineStart = projectionMatrix * viewMatrix * vec4(VinWorld.x, minHeight, VinWorld.z, 1.0);\n vec4 lineEnd = projectionMatrix * viewMatrix * vec4(VinWorld.x, maxHeight, VinWorld.z, 1.0);\n\n vec4 Vout = VinWorld;\n\n // Binary search for line-terrain intersection\n float first = 0.0, last = 1.0;\n while(first <= last) {\n // Compute mid-point\n float mid = first + (last-first) / 2.0;\n // Compute texture coordinates along line\n vec4 texCoords = toNSC(mix(lineStart, lineEnd, mid));\n vec4 texSample = vec4(0.0); // Sample terrain\n for(int s = -samples; s < samples; s++) {\n for(int t = -samples; t < samples; t++) {\n texSample += texture(positionTex,\n texCoords.st + vec2(s,t) * stepSize);\n }\n }\n // Smooth samples obtain from G-Buffer\n texSample = texSample / (float(samples) * float(samples) * 4.0);\n float terrainHeight = texSample.y;\n Vout.y = terrainHeight;\n \n if((last-first) < pixelSize) { // Termination criteria\n return Vout;\n }\n // Perform intersection test\n float depthScene = toNSC(projectionMatrix * viewMatrix * Vout).y;\n if(depthScene >= texCoords.y) {\n first = mid;\n }\n else\n last = mid;\n }\n return Vout;\n }\n\n void main() {\n vColor = color;\n vUv = uv;\n MVP = projectionMatrix * modelViewMatrix;\n vec4 inputVertex = vec4(position, 1.0);\n vec4 outputVertex = vertexDraping(tPosition, inputVertex);\n vec4 finalPosition = projectionMatrix * viewMatrix * outputVertex;\n gl_Position = finalPosition;\n }\n`,\n GB = Vn`\n varying vec3 vColor;\n uniform float opacity;\n\n void main() {\n gl_FragColor = vec4(vColor, opacity);\n }\n`,\n kt = new three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial({\n vertexShader: PB,\n fragmentShader: GB,\n uniforms: {\n tPosition: {\n value: null\n },\n minHeight: {\n value: 0\n },\n maxHeight: {\n value: 300\n },\n opacity: {\n value: 0.5\n },\n samples: {\n value: 4\n },\n sampleStep: {\n value: 4\n }\n },\n vertexColors: !0,\n transparent: !0,\n depthTest: !1,\n blending: three__WEBPACK_IMPORTED_MODULE_0__.NormalBlending\n}),\n Uc = {\n // From chroma spectral http://gka.github.io/chroma.js/\n SPECTRAL: [[0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.3686, 0.3098, 0.6353)], [0.1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.1961, 0.5333, 0.7412)], [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.4, 0.7608, 0.6471)], [0.3, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.6706, 0.8667, 0.6431)], [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.902, 0.9608, 0.5961)], [0.5, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 1, 0.749)], [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.9961, 0.8784, 0.5451)], [0.7, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.9922, 0.6824, 0.3804)], [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.9569, 0.4275, 0.2627)], [0.9, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.8353, 0.2431, 0.3098)], [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.6196, 39e-4, 0.2588)]],\n PLASMA: [[0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.241, 0.015, 0.61)], [0.1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.387, 1e-3, 0.654)], [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.524, 0.025, 0.653)], [0.3, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.651, 0.125, 0.596)], [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.752, 0.227, 0.513)], [0.5, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.837, 0.329, 0.431)], [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.907, 0.435, 0.353)], [0.7, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.963, 0.554, 0.272)], [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.992, 0.681, 0.195)], [0.9, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.987, 0.822, 0.144)], [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.94, 0.975, 0.131)]],\n YELLOW_GREEN: [[0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.1647, 0.2824, 0.3451)], [0.1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.1338, 0.3555, 0.4227)], [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.061, 0.4319, 0.4864)], [0.3, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0.5099, 0.5319)], [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0.5881, 0.5569)], [0.5, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.137, 0.665, 0.5614)], [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.2906, 0.7395, 0.5477)], [0.7, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.4453, 0.8099, 0.5201)], [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.6102, 0.8748, 0.485)], [0.9, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.7883, 0.9323, 0.4514)], [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.9804, 0.9804, 0.4314)]],\n VIRIDIS: [[0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.267, 5e-3, 0.329)], [0.1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.283, 0.141, 0.458)], [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.254, 0.265, 0.53)], [0.3, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.207, 0.372, 0.553)], [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.164, 0.471, 0.558)], [0.5, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.128, 0.567, 0.551)], [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.135, 0.659, 0.518)], [0.7, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.267, 0.749, 0.441)], [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.478, 0.821, 0.318)], [0.9, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.741, 0.873, 0.15)], [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.993, 0.906, 0.144)]],\n INFERNO: [[0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.077, 0.042, 0.206)], [0.1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.225, 0.036, 0.388)], [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.373, 0.074, 0.432)], [0.3, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.522, 0.128, 0.42)], [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.665, 0.182, 0.37)], [0.5, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.797, 0.255, 0.287)], [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.902, 0.364, 0.184)], [0.7, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.969, 0.516, 0.063)], [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.988, 0.683, 0.072)], [0.9, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.961, 0.859, 0.298)], [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.988, 0.998, 0.645)]],\n GRAYSCALE: [[0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0, 0)], [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 1, 1)]],\n // 16 samples of the TURBU color scheme\n // values taken from: https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f\n // original file licensed under Apache-2.0\n TURBO: [[0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.18995, 0.07176, 0.23217)], [0.07, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.25107, 0.25237, 0.63374)], [0.13, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.27628, 0.42118, 0.89123)], [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.25862, 0.57958, 0.99876)], [0.27, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.15844, 0.73551, 0.92305)], [0.33, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.09267, 0.86554, 0.7623)], [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.19659, 0.94901, 0.59466)], [0.47, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.42778, 0.99419, 0.38575)], [0.53, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.64362, 0.98999, 0.23356)], [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.80473, 0.92452, 0.20459)], [0.67, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.93301, 0.81236, 0.22667)], [0.73, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.99314, 0.67408, 0.20348)], [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.9836, 0.49291, 0.12849)], [0.87, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.92105, 0.31489, 0.05475)], [0.93, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.81608, 0.18462, 0.01809)], [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.66449, 0.08436, 424e-5)]],\n RAINBOW: [[0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.278, 0, 0.714)], [1 / 6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0, 1)], [2 / 6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 1, 1)], [3 / 6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 1, 0)], [4 / 6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 1, 0)], [5 / 6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 0.64, 0)], [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 0, 0)]],\n CONTOUR: [[0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0, 0)], [0.03, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0, 0)], [0.04, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 1, 1)], [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 1, 1)]]\n},\n NB = `\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n`,\n UB = `\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n`;\n\nvar Hc = /* @__PURE__ */(e => (e[e.Intensity = 1] = \"Intensity\", e[e.Classification = 2] = \"Classification\", e[e.Elevation = 3] = \"Elevation\", e[e.RGB = 4] = \"RGB\", e[e.White = 5] = \"White\", e))(Hc || {}),\n jn = /* @__PURE__ */(e => (e[e.FlatTexture = 1] = \"FlatTexture\", e[e.ShadedTexture = 2] = \"ShadedTexture\", e[e.ShadedNoTexture = 3] = \"ShadedNoTexture\", e))(jn || {});\n\nconst HB = Uc.RAINBOW,\n JB = typeof document < \"u\" ? Pc(HB) : null,\n VB = Uc.GRAYSCALE,\n jB = typeof document < \"u\" ? Pc(VB) : null,\n kB = {\n throttleRequests: !0,\n maxRequests: 64,\n updateInterval: 0.1,\n maxConcurrency: 1,\n maximumScreenSpaceError: 16,\n memoryAdjustedScreenSpaceError: !0,\n maximumMemoryUsage: 400,\n memoryCacheOverflow: 128,\n viewDistanceScale: 1,\n skipLevelOfDetail: !1,\n resetTransform: !1,\n updateTransforms: !0,\n shading: jn.FlatTexture,\n transparent: !1,\n pointCloudColoring: Hc.White,\n pointSize: 1,\n worker: !0,\n wireframe: !1,\n debug: !1,\n gltfLoader: null,\n basisTranscoderPath: null,\n dracoDecoderPath: null,\n material: null,\n contentPostProcess: void 0,\n preloadTilesCount: null,\n collectAttributions: !1\n};\n\nclass t1 {\n /**\n * Loads a tileset of 3D Tiles according to the given {@link LoaderProps}\n * @public\n *\n * @param props - Properties for this load call {@link LoaderProps}.\n * @returns An object containing the 3D Model to be added to the scene\n * and a runtime engine to be updated every frame.\n */\n static async load(t) {\n const n = { ...kB,\n ...t.options\n },\n {\n url: s\n } = t;\n let {\n viewport: r,\n renderer: i\n } = t;\n const o = n.updateInterval,\n a = 5,\n c = {};\n\n if (n.cesiumIONToken) {\n c[\"cesium-ion\"] = {\n accessToken: n.cesiumIONToken\n };\n const T = await bc.preload(s, c);\n c.fetch = {\n headers: T.headers\n };\n }\n\n n.googleApiKey && (c.fetch = {\n headers: {\n \"X-GOOG-API-KEY\": n.googleApiKey\n }\n }, t.options.hasOwnProperty(\"collectAttributions\") || (n.collectAttributions = !0)), t.loadingManager && t.loadingManager.itemStart(s);\n const u = await Ae(s, Le, { ...c\n }),\n l = {},\n h = {},\n f = [],\n d = new three__WEBPACK_IMPORTED_MODULE_0__.Group(),\n m = new three__WEBPACK_IMPORTED_MODULE_0__.Group();\n n.debug || (m.visible = !1);\n const g = {\n pointSize: {\n type: \"f\",\n value: n.pointSize\n },\n gradient: {\n type: \"t\",\n value: JB\n },\n grayscale: {\n type: \"t\",\n value: jB\n },\n rootCenter: {\n type: \"vec3\",\n value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector3()\n },\n rootNormal: {\n type: \"vec3\",\n value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector3()\n },\n coloring: {\n type: \"i\",\n value: n.pointCloudColoring\n },\n hideGround: {\n type: \"b\",\n value: !0\n },\n elevationRange: {\n type: \"vec2\",\n value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 400)\n },\n maxIntensity: {\n type: \"f\",\n value: 1\n },\n intensityContrast: {\n type: \"f\",\n value: 1\n },\n alpha: {\n type: \"f\",\n value: 1\n }\n },\n y = new three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial({\n uniforms: g,\n vertexShader: UB,\n fragmentShader: NB,\n transparent: n.transparent,\n vertexColors: !0\n });\n let E, R, B;\n n.gltfLoader ? E = n.gltfLoader : (E = new three__WEBPACK_IMPORTED_MODULE_0__.GLTFLoader(), n.basisTranscoderPath && (R = new three__WEBPACK_IMPORTED_MODULE_0__.KTX2Loader(), R.detectSupport(i ?? new three__WEBPACK_IMPORTED_MODULE_0__.WebGLRenderer()), R.setTranscoderPath(n.basisTranscoderPath + \"/\"), R.setWorkerLimit(1), E.setKTX2Loader(R)), n.dracoDecoderPath && (B = new three__WEBPACK_IMPORTED_MODULE_0__.DRACOLoader(), B.setDecoderPath(n.dracoDecoderPath + \"/\"), B.setWorkerLimit(n.maxConcurrency), E.setDRACOLoader(B)));\n const C = new three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial({\n transparent: n.transparent\n }),\n M = {\n maximumMemoryUsage: n.maximumMemoryUsage,\n maximumScreenSpaceError: n.maximumScreenSpaceError,\n memoryAdjustedScreenSpaceError: n.memoryAdjustedScreenSpaceError,\n memoryCacheOverflow: n.memoryCacheOverflow,\n viewDistanceScale: n.viewDistanceScale,\n skipLevelOfDetail: n.skipLevelOfDetail,\n updateTransforms: n.updateTransforms,\n throttleRequests: n.throttleRequests,\n maxRequests: n.maxRequests,\n contentLoader: async T => {\n let D = null;\n\n switch (T.type) {\n case Pe.POINTCLOUD:\n {\n D = zB(T, y, n, Pt);\n break;\n }\n\n case Pe.SCENEGRAPH:\n case Pe.MESH:\n {\n D = await KB(E, T, C, n, Pt);\n break;\n }\n }\n\n if (D && (D.visible = !1, l[T.id] = D, d.add(l[T.id]), n.debug)) {\n const Z = Ho(T);\n m.add(Z), h[T.id] = Z;\n }\n },\n onTileLoad: async T => {\n b && (n.resetTransform && !L && (T == null ? void 0 : T.depth) <= a && Xt(T), Wt = !0);\n },\n onTileUnload: T => {\n f.push(T);\n },\n onTileError: (T, D) => {\n console.warn(\"Tile error\", T.id, D);\n },\n\n onTraversalComplete(T) {\n return n.collectAttributions && (k = XB(T)), T;\n }\n\n },\n b = new MB(u, { ...M,\n loadOptions: { ...c,\n maxConcurrency: n.maxConcurrency,\n worker: n.worker,\n gltf: {\n loadImages: !1\n },\n \"3d-tiles\": {\n loadGLTF: !1\n }\n }\n }),\n O = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4(),\n F = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4(),\n v = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n let L = !1,\n k = \"\";\n\n if (b.root.boundingVolume ? (b.root.header.boundingVolume.region && console.warn(\"Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates.\"), F.setPosition(b.root.boundingVolume.center[0], b.root.boundingVolume.center[1], b.root.boundingVolume.center[2])) : console.warn(\"Bounding volume not found, no transformations applied\"), n.debug) {\n const T = Ho(b.root);\n m.add(T), h[b.root.id] = T;\n }\n\n let q = !1,\n Y = !1;\n g.rootCenter.value.copy(v), g.rootNormal.value.copy(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, 0, 1).normalize()), b.stats.get(\"Loader concurrency\").count = n.maxConcurrency, b.stats.get(\"Maximum mem usage\").count = n.maximumMemoryUsage;\n let P = 0,\n ct = null,\n Wt = !0,\n oe = null;\n const Be = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(1 / 0, 1 / 0, 1 / 0);\n let vt = null;\n d.updateMatrixWorld(!0);\n const st = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(d.matrixWorld),\n Pt = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(st).invert();\n n.resetTransform && Xt(b.root), n.debug && (h[b.root.id].applyMatrix4(O), m.matrixWorld.copy(d.matrixWorld));\n\n function Xt(T) {\n if (!T.boundingVolume.halfAxes) return;\n const D = T.boundingVolume.halfAxes,\n Z = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().extractRotation(Gc(D)).premultiply(new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().extractRotation(Pt));\n\n if (!new three__WEBPACK_IMPORTED_MODULE_0__.Euler().setFromRotationMatrix(Z).equals(new three__WEBPACK_IMPORTED_MODULE_0__.Euler())) {\n L = !0;\n\n const _t = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(F.elements[12], F.elements[13], F.elements[14]);\n\n F.extractRotation(Z), F.setPosition(_t);\n }\n\n Ce();\n }\n\n function Ce() {\n O.copy(st), n.resetTransform && O.multiply(new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(F).invert()), b.modelMatrix = new V(O.toArray());\n }\n\n function $e(T, D, Z, Q) {\n if (q || !Q) return;\n\n if (!vt) {\n if (Q instanceof three__WEBPACK_IMPORTED_MODULE_0__.PerspectiveCamera) vt = new Dn({\n fov: Q.fov / 180 * Math.PI,\n aspectRatio: Q.aspect,\n near: Q.near,\n far: Q.far\n }).sseDenominator;else if (Q instanceof three__WEBPACK_IMPORTED_MODULE_0__.OrthographicCamera) {\n const K = Q.right - Q.left,\n jr = Q.top - Q.bottom,\n Vc = K / jr;\n vt = Math.max(jr / Z.height, K / (Z.height * Vc));\n }\n n.debug && console.log(\"Updated sse denonimator:\", vt);\n }\n\n const ns = Uo(Q).planes.map(K => new nt(K.normal.toArray(), K.constant)),\n Jc = new dt(ns),\n Jr = {\n camera: {\n position: Be.toArray()\n },\n height: Z.height * Z.devicePixelRatio,\n frameNumber: T._frameNumber,\n sseDenominator: vt,\n cullingVolume: Jc,\n viewport: {\n id: 0\n }\n };\n T._cache.reset(), T._traverser.traverse(T.root, Jr, T.options);\n\n for (const K of T.tiles) K.selected ? D[K.id] ? D[K.id].visible = !0 : console.error(\"TILE SELECTED BUT NOT LOADED!!\", K.id) : D[K.id] && (D[K.id].visible = !1);\n\n for (; f.length > 0;) {\n const K = f.pop();\n D[K.id] && K.contentState == lt.UNLOADED && (d.remove(D[K.id]), Us(D[K.id]), delete D[K.id]), h[K.id] && (Us(h[K.id]), m.remove(h[K.id]), delete h[K.id]);\n }\n\n const ss = T.stats.get(\"Tiles Loaded\").count,\n Vr = T.stats.get(\"Tiles Loading\").count;\n return t.onProgress && t.onProgress(ss, ss + Vr), t.loadingManager && !Y && Vr == 0 && (n.preloadTilesCount == null || ss >= n.preloadTilesCount) && (Y = !0, t.loadingManager.itemEnd(t.url)), Jr;\n }\n\n function es(T) {\n const D = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(),\n Z = new three__WEBPACK_IMPORTED_MODULE_0__.Quaternion(),\n Q = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n T.decompose(D, Z, Q), d.position.copy(D), d.quaternion.copy(Z), d.scale.copy(Q), d.updateMatrix(), d.updateMatrixWorld(!0), st.copy(d.matrixWorld), Pt.copy(st).invert(), Ce();\n }\n\n return {\n model: d,\n runtime: {\n getTileset: () => b,\n getStats: () => b.stats,\n getDataAttributions: () => k,\n showTiles: T => {\n m.visible = T;\n },\n setWireframe: T => {\n n.wireframe = T, d.traverse(D => {\n D instanceof three__WEBPACK_IMPORTED_MODULE_0__.Mesh && (D.material.wireframe = T);\n });\n },\n setDebug: T => {\n n.debug = T, m.visible = T;\n },\n setShading: T => {\n n.shading = T;\n },\n getTileBoxes: () => m,\n setViewDistanceScale: T => {\n b.options.viewDistanceScale = T, b._frameNumber++, $e(b, l, r, oe);\n },\n setMaximumScreenSpaceError: T => {\n b.options.maximumScreenSpaceError = T, b._frameNumber++, $e(b, l, r, oe);\n },\n setHideGround: T => {\n g.hideGround.value = T;\n },\n setPointCloudColoring: T => {\n g.coloring.value = T;\n },\n setElevationRange: T => {\n g.elevationRange.value.set(T[0], T[1]);\n },\n setMaxIntensity: T => {\n g.maxIntensity.value = T;\n },\n setIntensityContrast: T => {\n g.intensityContrast.value = T;\n },\n setPointAlpha: T => {\n g.alpha.value = T;\n },\n getLatLongHeightFromPosition: T => {\n const D = b.ellipsoid.cartesianToCartographic(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().copy(T).applyMatrix4(new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(O).invert()).toArray());\n return {\n lat: D[1],\n long: D[0],\n height: D[2]\n };\n },\n getPositionFromLatLongHeight: T => {\n const D = b.ellipsoid.cartographicToCartesian([T.long, T.lat, T.height]);\n return new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(...D).applyMatrix4(O);\n },\n orientToGeocoord: T => {\n const D = [T.long, T.lat, T.height],\n Z = b.ellipsoid.cartographicToCartesian(D),\n Q = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().fromArray(b.ellipsoid.eastNorthUpToFixedFrame(Z)),\n _t = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().makeRotationFromEuler(new three__WEBPACK_IMPORTED_MODULE_0__.Euler(Math.PI / 2, Math.PI / 2, 0)),\n ns = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(Q).multiply(_t).invert();\n\n es(ns);\n },\n getWebMercatorCoord: T => xB(T.lat, T.long),\n getCameraFrustum: T => {\n const Z = Uo(T).planes.map(_t => new nt(_t.normal.toArray(), _t.constant)).map(_t => IB(_t)),\n Q = new three__WEBPACK_IMPORTED_MODULE_0__.Group();\n\n for (const _t of Z) Q.add(_t);\n\n return Q;\n },\n overlayGeoJSON: (T, D) => {\n if (T.applyMatrix4(O), T.updateMatrixWorld(), !i) throw new Error(\"GeoJSON draping requires a renderer reference via LoaderProps\");\n return OB(r, d, i, D), T.material.dispose(), T.material = kt, T;\n },\n setViewport: T => {\n r = T, vt = null, Wt = !0, ht && FB(r);\n },\n setRenderer: T => {\n i = T;\n },\n update: function (T, D) {\n if (oe = D, P += T, ht && DB(D), b && P >= o) {\n if (!st.equals(d.matrixWorld)) {\n P = 0, st.copy(d.matrixWorld), n.updateTransforms && Ce();\n const Z = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().setFromMatrixPosition(st);\n g.rootCenter.value.copy(Z), g.rootNormal.value.copy(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, 0, 1).applyMatrix4(st).normalize()), Pt.copy(st).invert(), n.debug && (h[b.root.id].matrixWorld.copy(O), h[b.root.id].applyMatrix4(st));\n }\n\n ct == null ? ct = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(D.matrixWorld) : (Wt || WB(D, ct)) && (P = 0, Wt = !1, b._frameNumber++, D.getWorldPosition(Be), ct.copy(D.matrixWorld), $e(b, l, r, D));\n }\n },\n dispose: function () {\n for (q = !0, b._destroy(); d.children.length > 0;) {\n const T = d.children[0];\n Us(T), d.remove(T);\n }\n\n for (; m.children.length > 0;) {\n const T = m.children[0];\n m.remove(T), T.geometry.dispose(), T.material.dispose();\n }\n\n R && R.dispose(), B && B.dispose();\n }\n }\n };\n }\n /**\n * Loads a tileset of 3D Tiles according to the given {@link GeoJSONLoaderProps}\n * Could be overlayed on geograpical 3D Tiles using {@link Runtime.overlayGeoJSON}\n * @public\n *\n * @param props - Properties for this load call {@link GeoJSONLoaderProps}.\n * @returns An object containing the 3D Model to be added to the scene\n */\n\n\n static async loadGeoJSON(t) {\n const {\n url: n,\n height: s,\n featureToColor: r\n } = t;\n return Ae(n, ke, {\n worker: !1,\n gis: {\n format: \"binary\"\n }\n }).then(i => {\n const o = i,\n a = new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry(),\n c = o.polygons.positions.value.reduce((h, f, d, m) => {\n if (d % 2 == 0) {\n const g = [f, m[d + 1], s ?? 0],\n y = J.WGS84.cartographicToCartesian(g);\n h.push(...y);\n }\n\n return h;\n }, []);\n\n if (a.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(c, 3)), r) {\n const h = o.polygons.numericProps[r.feature].value.reduce((f, d, m, g) => {\n const y = r.colorMap(d);\n return f[m * 3] = y.r, f[m * 3 + 1] = y.g, f[m * 3 + 2] = y.b, f;\n }, []);\n a.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(h, 3));\n }\n\n a.setIndex(new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(o.polygons.triangles.value, 1));\n const u = new three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial({\n transparent: !0,\n vertexColors: !0,\n opacity: 0.5,\n blending: three__WEBPACK_IMPORTED_MODULE_0__.NormalBlending\n });\n return new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(a, u);\n });\n }\n\n}\n\nasync function KB(e, t, n, s, r) {\n return new Promise((i, o) => {\n const a = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().makeRotationAxis(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(1, 0, 0), Math.PI / 2),\n c = t.content.gltfUpAxis !== \"Z\",\n u = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().fromArray(t.computedTransform).premultiply(r);\n c && u.multiply(a), t.content.byteLength || (t.content.byteLength = t.content.gltfArrayBuffer.byteLength), e.parse(t.content.gltfArrayBuffer, t.contentUrl ? t.contentUrl.substr(0, t.contentUrl.lastIndexOf(\"/\") + 1) : null, l => {\n t.userData.asset = l.asset;\n const h = l.scenes[0];\n h.applyMatrix4(u), t.content.texturesByteLength = 0, t.content.geometriesByteLength = 0, h.traverse(f => {\n if (f.type == \"Mesh\") {\n const d = f;\n t.content.geometriesByteLength += Nc(d.geometry);\n const m = d.material,\n g = m.map;\n\n if (g) {\n const y = vB(g);\n y && (t.content.texturesByteLength += y);\n }\n\n s.material ? (d.material = s.material.clone(), m.dispose()) : s.shading == jn.FlatTexture && d.material.type !== \"MeshBasicMaterial\" && (d.material = n.clone(), m.dispose()), s.shading != jn.ShadedNoTexture ? d.material.type == \"ShaderMaterial\" ? d.material.uniforms.map = {\n value: g\n } : d.material.map = g : (g && g.dispose(), d.material.map = null), d.material.wireframe = s.wireframe, s.contentPostProcess && s.contentPostProcess(d);\n }\n }), t.content.gpuMemoryUsageInBytes = t.content.texturesByteLength + t.content.geometriesByteLength, i(h);\n }, l => {\n o(new Error(`error parsing gltf in tile ${t.id}: ${l}`));\n });\n });\n}\n\nfunction zB(e, t, n, s) {\n const r = {\n rtc_center: e.content.rtcCenter,\n // eslint-disable-line camelcase\n points: e.content.attributes.positions,\n intensities: e.content.attributes.intensity,\n classifications: e.content.attributes.classification,\n rgb: null,\n rgba: null\n },\n {\n colors: i\n } = e.content.attributes;\n i && i.size === 3 && (r.rgb = i.value), i && i.size === 4 && (r.rgba = i.value);\n const o = new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry();\n o.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(r.points, 3));\n const a = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().fromArray(e.computedTransform).premultiply(s);\n r.rgba ? o.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(r.rgba, 4)) : r.rgb && o.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_0__.Uint8BufferAttribute(r.rgb, 3, !0)), r.intensities && o.setAttribute(\"intensity\", // Handles both 16bit or 8bit intensity values\n new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(r.intensities, 1, !0)), r.classifications && o.setAttribute(\"classification\", new three__WEBPACK_IMPORTED_MODULE_0__.Uint8BufferAttribute(r.classifications, 1, !1)), e.content.geometriesByteLength = Nc(o), e.content.gpuMemoryUsageInBytes = e.content.geometriesByteLength;\n const c = new three__WEBPACK_IMPORTED_MODULE_0__.Points(o, n.material || t);\n\n if (r.rtc_center) {\n const u = r.rtc_center;\n a.multiply(new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().makeTranslation(u[0], u[1], u[2]));\n }\n\n return c.applyMatrix4(a), n.contentPostProcess && n.contentPostProcess(c), c;\n}\n\nfunction Vo(e) {\n var t, n, s, r;\n (t = e == null ? void 0 : e.uniforms) != null && t.map ? (s = (n = e == null ? void 0 : e.uniforms) == null ? void 0 : n.map.value) == null || s.dispose() : e.map && ((r = e.map) == null || r.dispose()), e.dispose();\n}\n\nfunction Us(e) {\n e.traverse(t => {\n if (t.isMesh) if (t.geometry.dispose(), t.material.isMaterial) Vo(t.material);else for (const n of t.material) Vo(n);\n });\n\n for (let t = e.children.length - 1; t >= 0; t--) {\n const n = e.children[t];\n e.remove(n);\n }\n}\n\nfunction WB(e, t, n) {\n const s = !e.matrixWorld.equals(t);\n return e instanceof three__WEBPACK_IMPORTED_MODULE_0__.PerspectiveCamera ? s || e.aspect !== n : s;\n}\n\nfunction XB(e) {\n const t = /* @__PURE__ */new Map();\n return e.forEach(r => {\n var o, a;\n const i = (a = (o = r == null ? void 0 : r.userData) == null ? void 0 : o.asset) == null ? void 0 : a.copyright;\n i && i.split(/;/g).map(u => u.trim()).forEach(u => {\n u && t.set(u, (t.get(u) || 0) + 1);\n });\n }), Array.from(t).sort((r, i) => i[1] - r[1]).map(([r]) => r).join(\"; \");\n}\n\n\n\n//# sourceURL=webpack://aframe-loader-3dtiles-component/./lib/three-loader-3dtiles.js?"); /***/ }), @@ -49,17 +60,6 @@ eval("if (typeof AFRAME === 'undefined') {\n throw new Error('Component attempt "use strict"; module.exports = __WEBPACK_EXTERNAL_MODULE_three__; -/***/ }), - -/***/ "./node_modules/three-loader-3dtiles/dist/lib/three-loader-3dtiles.js": -/*!****************************************************************************!*\ - !*** ./node_modules/three-loader-3dtiles/dist/lib/three-loader-3dtiles.js ***! - \****************************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Loader3DTiles\": () => (/* binding */ qB),\n/* harmony export */ \"PointCloudColoring\": () => (/* binding */ Nc),\n/* harmony export */ \"Shading\": () => (/* binding */ jn)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three/examples/jsm/loaders/KTX2Loader.js */ \"three\");\nvar Hc = Object.defineProperty;\nvar Jc = (e, t, n) => t in e ? Hc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;\nvar p = (e, t, n) => (Jc(e, typeof t != \"symbol\" ? t + \"\" : t, n), n);\n\n\n\n\nasync function Ke(e, t, n, s) {\n return s._parse(e, t, n, s);\n}\nfunction K(e, t) {\n if (!e)\n throw new Error(t || \"loader assertion failed.\");\n}\nconst kn = !!(typeof process != \"object\" || String(process) !== \"[object process]\" || process.browser), zr = typeof process < \"u\" && process.version && /v([0-9]*)/.exec(process.version);\nzr && parseFloat(zr[1]);\nfunction au(e, t) {\n return zo(e || {}, t);\n}\nfunction zo(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;\n if (n > 3)\n return t;\n const s = {\n ...e\n };\n for (const [r, i] of Object.entries(t))\n i && typeof i == \"object\" && !Array.isArray(i) ? s[r] = zo(s[r] || {}, t[r], n + 1) : s[r] = t[r];\n return s;\n}\nconst cu = \"latest\";\nfunction uu() {\n var e;\n return (e = globalThis._loadersgl_) !== null && e !== void 0 && e.version || (globalThis._loadersgl_ = globalThis._loadersgl_ || {}, globalThis._loadersgl_.version = \"4.1.1\"), globalThis._loadersgl_.version;\n}\nconst Wo = uu();\nfunction Jt(e, t) {\n if (!e)\n throw new Error(t || \"loaders.gl assertion failed.\");\n}\nconst bt = typeof process != \"object\" || String(process) !== \"[object process]\" || process.browser, fr = typeof importScripts == \"function\", lu = typeof window < \"u\" && typeof window.orientation < \"u\", Wr = typeof process < \"u\" && process.version && /v([0-9]*)/.exec(process.version);\nWr && parseFloat(Wr[1]);\nclass hu {\n constructor(t, n) {\n this.name = void 0, this.workerThread = void 0, this.isRunning = !0, this.result = void 0, this._resolve = () => {\n }, this._reject = () => {\n }, this.name = t, this.workerThread = n, this.result = new Promise((s, r) => {\n this._resolve = s, this._reject = r;\n });\n }\n postMessage(t, n) {\n this.workerThread.postMessage({\n source: \"loaders.gl\",\n type: t,\n payload: n\n });\n }\n done(t) {\n Jt(this.isRunning), this.isRunning = !1, this._resolve(t);\n }\n error(t) {\n Jt(this.isRunning), this.isRunning = !1, this._reject(t);\n }\n}\nclass is {\n terminate() {\n }\n}\nconst os = /* @__PURE__ */ new Map();\nfunction fu(e) {\n Jt(e.source && !e.url || !e.source && e.url);\n let t = os.get(e.source || e.url);\n return t || (e.url && (t = du(e.url), os.set(e.url, t)), e.source && (t = Xo(e.source), os.set(e.source, t))), Jt(t), t;\n}\nfunction du(e) {\n if (!e.startsWith(\"http\"))\n return e;\n const t = mu(e);\n return Xo(t);\n}\nfunction Xo(e) {\n const t = new Blob([e], {\n type: \"application/javascript\"\n });\n return URL.createObjectURL(t);\n}\nfunction mu(e) {\n return `try {\n importScripts('${e}');\n} catch (error) {\n console.error(error);\n throw error;\n}`;\n}\nfunction Qo(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, n = arguments.length > 2 ? arguments[2] : void 0;\n const s = n || /* @__PURE__ */ new Set();\n if (e) {\n if (Xr(e))\n s.add(e);\n else if (Xr(e.buffer))\n s.add(e.buffer);\n else if (!ArrayBuffer.isView(e)) {\n if (t && typeof e == \"object\")\n for (const r in e)\n Qo(e[r], t, s);\n }\n }\n return n === void 0 ? Array.from(s) : [];\n}\nfunction Xr(e) {\n return e ? e instanceof ArrayBuffer || typeof MessagePort < \"u\" && e instanceof MessagePort || typeof ImageBitmap < \"u\" && e instanceof ImageBitmap || typeof OffscreenCanvas < \"u\" && e instanceof OffscreenCanvas : !1;\n}\nconst as = () => {\n};\nclass Vs {\n static isSupported() {\n return typeof Worker < \"u\" && bt || typeof is < \"u\" && !bt;\n }\n constructor(t) {\n this.name = void 0, this.source = void 0, this.url = void 0, this.terminated = !1, this.worker = void 0, this.onMessage = void 0, this.onError = void 0, this._loadableURL = \"\";\n const {\n name: n,\n source: s,\n url: r\n } = t;\n Jt(s || r), this.name = n, this.source = s, this.url = r, this.onMessage = as, this.onError = (i) => console.log(i), this.worker = bt ? this._createBrowserWorker() : this._createNodeWorker();\n }\n destroy() {\n this.onMessage = as, this.onError = as, this.worker.terminate(), this.terminated = !0;\n }\n get isRunning() {\n return !!this.onMessage;\n }\n postMessage(t, n) {\n n = n || Qo(t), this.worker.postMessage(t, n);\n }\n _getErrorFromErrorEvent(t) {\n let n = \"Failed to load \";\n return n += `worker ${this.name} from ${this.url}. `, t.message && (n += `${t.message} in `), t.lineno && (n += `:${t.lineno}:${t.colno}`), new Error(n);\n }\n _createBrowserWorker() {\n this._loadableURL = fu({\n source: this.source,\n url: this.url\n });\n const t = new Worker(this._loadableURL, {\n name: this.name\n });\n return t.onmessage = (n) => {\n n.data ? this.onMessage(n.data) : this.onError(new Error(\"No data received\"));\n }, t.onerror = (n) => {\n this.onError(this._getErrorFromErrorEvent(n)), this.terminated = !0;\n }, t.onmessageerror = (n) => console.error(n), t;\n }\n _createNodeWorker() {\n let t;\n if (this.url) {\n const s = this.url.includes(\":/\") || this.url.startsWith(\"/\") ? this.url : `./${this.url}`;\n t = new is(s, {\n eval: !1\n });\n } else if (this.source)\n t = new is(this.source, {\n eval: !0\n });\n else\n throw new Error(\"no worker\");\n return t.on(\"message\", (n) => {\n this.onMessage(n);\n }), t.on(\"error\", (n) => {\n this.onError(n);\n }), t.on(\"exit\", (n) => {\n }), t;\n }\n}\nclass gu {\n static isSupported() {\n return Vs.isSupported();\n }\n constructor(t) {\n this.name = \"unnamed\", this.source = void 0, this.url = void 0, this.maxConcurrency = 1, this.maxMobileConcurrency = 1, this.onDebug = () => {\n }, this.reuseWorkers = !0, this.props = {}, this.jobQueue = [], this.idleQueue = [], this.count = 0, this.isDestroyed = !1, this.source = t.source, this.url = t.url, this.setProps(t);\n }\n destroy() {\n this.idleQueue.forEach((t) => t.destroy()), this.isDestroyed = !0;\n }\n setProps(t) {\n this.props = {\n ...this.props,\n ...t\n }, t.name !== void 0 && (this.name = t.name), t.maxConcurrency !== void 0 && (this.maxConcurrency = t.maxConcurrency), t.maxMobileConcurrency !== void 0 && (this.maxMobileConcurrency = t.maxMobileConcurrency), t.reuseWorkers !== void 0 && (this.reuseWorkers = t.reuseWorkers), t.onDebug !== void 0 && (this.onDebug = t.onDebug);\n }\n async startJob(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (i, o, a) => i.done(a), s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : (i, o) => i.error(o);\n const r = new Promise((i) => (this.jobQueue.push({\n name: t,\n onMessage: n,\n onError: s,\n onStart: i\n }), this));\n return this._startQueuedJob(), await r;\n }\n async _startQueuedJob() {\n if (!this.jobQueue.length)\n return;\n const t = this._getAvailableWorker();\n if (!t)\n return;\n const n = this.jobQueue.shift();\n if (n) {\n this.onDebug({\n message: \"Starting job\",\n name: n.name,\n workerThread: t,\n backlog: this.jobQueue.length\n });\n const s = new hu(n.name, t);\n t.onMessage = (r) => n.onMessage(s, r.type, r.payload), t.onError = (r) => n.onError(s, r), n.onStart(s);\n try {\n await s.result;\n } catch (r) {\n console.error(`Worker exception: ${r}`);\n } finally {\n this.returnWorkerToQueue(t);\n }\n }\n }\n returnWorkerToQueue(t) {\n !bt || this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency() ? (t.destroy(), this.count--) : this.idleQueue.push(t), this.isDestroyed || this._startQueuedJob();\n }\n _getAvailableWorker() {\n if (this.idleQueue.length > 0)\n return this.idleQueue.shift() || null;\n if (this.count < this._getMaxConcurrency()) {\n this.count++;\n const t = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;\n return new Vs({\n name: t,\n source: this.source,\n url: this.url\n });\n }\n return null;\n }\n _getMaxConcurrency() {\n return lu ? this.maxMobileConcurrency : this.maxConcurrency;\n }\n}\nconst Au = {\n maxConcurrency: 3,\n maxMobileConcurrency: 1,\n reuseWorkers: !0,\n onDebug: () => {\n }\n};\nclass Nt {\n static isSupported() {\n return Vs.isSupported();\n }\n static getWorkerFarm() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n return Nt._workerFarm = Nt._workerFarm || new Nt({}), Nt._workerFarm.setProps(t), Nt._workerFarm;\n }\n constructor(t) {\n this.props = void 0, this.workerPools = /* @__PURE__ */ new Map(), this.props = {\n ...Au\n }, this.setProps(t), this.workerPools = /* @__PURE__ */ new Map();\n }\n destroy() {\n for (const t of this.workerPools.values())\n t.destroy();\n this.workerPools = /* @__PURE__ */ new Map();\n }\n setProps(t) {\n this.props = {\n ...this.props,\n ...t\n };\n for (const n of this.workerPools.values())\n n.setProps(this._getWorkerPoolProps());\n }\n getWorkerPool(t) {\n const {\n name: n,\n source: s,\n url: r\n } = t;\n let i = this.workerPools.get(n);\n return i || (i = new gu({\n name: n,\n source: s,\n url: r\n }), i.setProps(this._getWorkerPoolProps()), this.workerPools.set(n, i)), i;\n }\n _getWorkerPoolProps() {\n return {\n maxConcurrency: this.props.maxConcurrency,\n maxMobileConcurrency: this.props.maxMobileConcurrency,\n reuseWorkers: this.props.reuseWorkers,\n onDebug: this.props.onDebug\n };\n }\n}\nNt._workerFarm = void 0;\nfunction pu(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n const n = t[e.id] || {}, s = bt ? `${e.id}-worker.js` : `${e.id}-worker-node.js`;\n let r = n.workerUrl;\n if (!r && e.id === \"compression\" && (r = t.workerUrl), t._workerType === \"test\" && (bt ? r = `modules/${e.module}/dist/${s}` : r = `modules/${e.module}/src/workers/${e.id}-worker-node.ts`), !r) {\n let i = e.version;\n i === \"latest\" && (i = cu);\n const o = i ? `@${i}` : \"\";\n r = `https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${s}`;\n }\n return Jt(r), r;\n}\nfunction yu(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Wo;\n Jt(e, \"no worker provided\");\n const n = e.version;\n return !(!t || !n);\n}\nconst Bu = {}, Cu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n default: Bu\n}, Symbol.toStringTag, { value: \"Module\" })), cs = {};\nasync function Zt(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;\n return t && (e = Eu(e, t, n, s)), cs[e] = cs[e] || Tu(e), await cs[e];\n}\nfunction Eu(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;\n if (!n.useLocalLibraries && e.startsWith(\"http\"))\n return e;\n s = s || e;\n const r = n.modules || {};\n return r[s] ? r[s] : bt ? n.CDN ? (Jt(n.CDN.startsWith(\"http\")), `${n.CDN}/${t}@${Wo}/dist/libs/${s}`) : fr ? `../src/libs/${s}` : `modules/${t}/src/libs/${s}` : `modules/${t}/dist/libs/${s}`;\n}\nasync function Tu(e) {\n if (e.endsWith(\"wasm\"))\n return await _u(e);\n if (!bt)\n try {\n return Cu && void 0;\n } catch (n) {\n return console.error(n), null;\n }\n if (fr)\n return importScripts(e);\n const t = await wu(e);\n return bu(t, e);\n}\nfunction bu(e, t) {\n if (!bt)\n return;\n if (fr)\n return eval.call(globalThis, e), null;\n const n = document.createElement(\"script\");\n n.id = t;\n try {\n n.appendChild(document.createTextNode(e));\n } catch {\n n.text = e;\n }\n return document.body.appendChild(n), null;\n}\nasync function _u(e) {\n return await (await fetch(e)).arrayBuffer();\n}\nasync function wu(e) {\n return await (await fetch(e)).text();\n}\nfunction Ru(e, t) {\n return !Nt.isSupported() || !bt && !(t != null && t._nodeWorkers) ? !1 : e.worker && (t == null ? void 0 : t.worker);\n}\nasync function Mu(e, t, n, s, r) {\n const i = e.id, o = pu(e, n), c = Nt.getWorkerFarm(n).getWorkerPool({\n name: i,\n url: o\n });\n n = JSON.parse(JSON.stringify(n)), s = JSON.parse(JSON.stringify(s || {}));\n const u = await c.startJob(\"process-on-worker\", Su.bind(null, r));\n return u.postMessage(\"process\", {\n input: t,\n options: n,\n context: s\n }), await (await u.result).result;\n}\nasync function Su(e, t, n, s) {\n switch (n) {\n case \"done\":\n t.done(s);\n break;\n case \"error\":\n t.error(new Error(s.error));\n break;\n case \"process\":\n const {\n id: r,\n input: i,\n options: o\n } = s;\n try {\n const a = await e(i, o);\n t.postMessage(\"done\", {\n id: r,\n result: a\n });\n } catch (a) {\n const c = a instanceof Error ? a.message : \"unknown error\";\n t.postMessage(\"error\", {\n id: r,\n error: c\n });\n }\n break;\n default:\n console.warn(`parse-with-worker unknown message ${n}`);\n }\n}\nfunction Iu(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 5;\n return typeof e == \"string\" ? e.slice(0, t) : ArrayBuffer.isView(e) ? Qr(e.buffer, e.byteOffset, t) : e instanceof ArrayBuffer ? Qr(e, 0, t) : \"\";\n}\nfunction Qr(e, t, n) {\n if (e.byteLength <= t + n)\n return \"\";\n const s = new DataView(e);\n let r = \"\";\n for (let i = 0; i < n; i++)\n r += String.fromCharCode(s.getUint8(t + i));\n return r;\n}\nfunction xu(e) {\n try {\n return JSON.parse(e);\n } catch {\n throw new Error(`Failed to parse JSON from data starting with \"${Iu(e)}\"`);\n }\n}\nfunction vu(e, t, n) {\n if (n = n || e.byteLength, e.byteLength < n || t.byteLength < n)\n return !1;\n const s = new Uint8Array(e), r = new Uint8Array(t);\n for (let i = 0; i < s.length; ++i)\n if (s[i] !== r[i])\n return !1;\n return !0;\n}\nfunction Ou() {\n for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)\n t[n] = arguments[n];\n return Fu(t);\n}\nfunction Fu(e) {\n const t = e.map((i) => i instanceof ArrayBuffer ? new Uint8Array(i) : i), n = t.reduce((i, o) => i + o.byteLength, 0), s = new Uint8Array(n);\n let r = 0;\n for (const i of t)\n s.set(i, r), r += i.byteLength;\n return s.buffer;\n}\nfunction dr(e, t, n) {\n const s = n !== void 0 ? new Uint8Array(e).subarray(t, t + n) : new Uint8Array(e).subarray(t);\n return new Uint8Array(s).buffer;\n}\nfunction ze(e, t) {\n return K(e >= 0), K(t > 0), e + (t - 1) & ~(t - 1);\n}\nfunction Du(e, t, n) {\n let s;\n if (e instanceof ArrayBuffer)\n s = new Uint8Array(e);\n else {\n const r = e.byteOffset, i = e.byteLength;\n s = new Uint8Array(e.buffer || e.arrayBuffer, r, i);\n }\n return t.set(s, n), n + ze(s.byteLength, 4);\n}\nasync function Lu(e) {\n const t = [];\n for await (const n of e)\n t.push(n);\n return Ou(...t);\n}\nfunction qr() {\n let e;\n if (typeof window < \"u\" && window.performance)\n e = window.performance.now();\n else if (typeof process < \"u\" && process.hrtime) {\n const t = process.hrtime();\n e = t[0] * 1e3 + t[1] / 1e6;\n } else\n e = Date.now();\n return e;\n}\nclass Yr {\n constructor(t, n) {\n this.name = void 0, this.type = void 0, this.sampleSize = 1, this.time = 0, this.count = 0, this.samples = 0, this.lastTiming = 0, this.lastSampleTime = 0, this.lastSampleCount = 0, this._count = 0, this._time = 0, this._samples = 0, this._startTime = 0, this._timerPending = !1, this.name = t, this.type = n, this.reset();\n }\n reset() {\n return this.time = 0, this.count = 0, this.samples = 0, this.lastTiming = 0, this.lastSampleTime = 0, this.lastSampleCount = 0, this._count = 0, this._time = 0, this._samples = 0, this._startTime = 0, this._timerPending = !1, this;\n }\n setSampleSize(t) {\n return this.sampleSize = t, this;\n }\n incrementCount() {\n return this.addCount(1), this;\n }\n decrementCount() {\n return this.subtractCount(1), this;\n }\n addCount(t) {\n return this._count += t, this._samples++, this._checkSampling(), this;\n }\n subtractCount(t) {\n return this._count -= t, this._samples++, this._checkSampling(), this;\n }\n addTime(t) {\n return this._time += t, this.lastTiming = t, this._samples++, this._checkSampling(), this;\n }\n timeStart() {\n return this._startTime = qr(), this._timerPending = !0, this;\n }\n timeEnd() {\n return this._timerPending ? (this.addTime(qr() - this._startTime), this._timerPending = !1, this._checkSampling(), this) : this;\n }\n getSampleAverageCount() {\n return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;\n }\n getSampleAverageTime() {\n return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;\n }\n getSampleHz() {\n return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;\n }\n getAverageCount() {\n return this.samples > 0 ? this.count / this.samples : 0;\n }\n getAverageTime() {\n return this.samples > 0 ? this.time / this.samples : 0;\n }\n getHz() {\n return this.time > 0 ? this.samples / (this.time / 1e3) : 0;\n }\n _checkSampling() {\n this._samples === this.sampleSize && (this.lastSampleTime = this._time, this.lastSampleCount = this._count, this.count += this._count, this.time += this._time, this.samples += this._samples, this._time = 0, this._count = 0, this._samples = 0);\n }\n}\nclass qo {\n constructor(t) {\n this.id = void 0, this.stats = {}, this.id = t.id, this.stats = {}, this._initializeStats(t.stats), Object.seal(this);\n }\n get(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"count\";\n return this._getOrCreate({\n name: t,\n type: n\n });\n }\n get size() {\n return Object.keys(this.stats).length;\n }\n reset() {\n for (const t of Object.values(this.stats))\n t.reset();\n return this;\n }\n forEach(t) {\n for (const n of Object.values(this.stats))\n t(n);\n }\n getTable() {\n const t = {};\n return this.forEach((n) => {\n t[n.name] = {\n time: n.time || 0,\n count: n.count || 0,\n average: n.getAverageTime() || 0,\n hz: n.getHz() || 0\n };\n }), t;\n }\n _initializeStats() {\n (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).forEach((n) => this._getOrCreate(n));\n }\n _getOrCreate(t) {\n const {\n name: n,\n type: s\n } = t;\n let r = this.stats[n];\n return r || (t instanceof Yr ? r = t : r = new Yr(n, s), this.stats[n] = r), r;\n }\n}\nlet Pu = \"\";\nconst $r = {};\nfunction Gu(e) {\n for (const t in $r)\n if (e.startsWith(t)) {\n const n = $r[t];\n e = e.replace(t, n);\n }\n return !e.startsWith(\"http://\") && !e.startsWith(\"https://\") && (e = `${Pu}${e}`), e;\n}\nfunction Nu(e) {\n return e && typeof e == \"object\" && e.isBuffer;\n}\nfunction Yo(e) {\n if (Nu(e))\n return e;\n if (e instanceof ArrayBuffer)\n return e;\n if (ArrayBuffer.isView(e))\n return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength ? e.buffer : e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);\n if (typeof e == \"string\") {\n const t = e;\n return new TextEncoder().encode(t).buffer;\n }\n if (e && typeof e == \"object\" && e._toArrayBuffer)\n return e._toArrayBuffer();\n throw new Error(\"toArrayBuffer\");\n}\nfunction Uu() {\n var e;\n if (typeof process < \"u\" && typeof process.cwd < \"u\")\n return process.cwd();\n const t = (e = window.location) === null || e === void 0 ? void 0 : e.pathname;\n return (t == null ? void 0 : t.slice(0, t.lastIndexOf(\"/\") + 1)) || \"\";\n}\nfunction $o(e) {\n const t = e ? e.lastIndexOf(\"/\") : -1;\n return t >= 0 ? e.substr(t + 1) : \"\";\n}\nfunction Zo(e) {\n const t = e ? e.lastIndexOf(\"/\") : -1;\n return t >= 0 ? e.substr(0, t) : \"\";\n}\nfunction Hu() {\n const e = [];\n for (let r = 0; r < arguments.length; r++)\n e[r] = r < 0 || arguments.length <= r ? void 0 : arguments[r];\n let t = \"\", n = !1, s;\n for (let r = e.length - 1; r >= -1 && !n; r--) {\n let i;\n r >= 0 ? i = e[r] : (s === void 0 && (s = Uu()), i = s), i.length !== 0 && (t = `${i}/${t}`, n = i.charCodeAt(0) === Ie);\n }\n return t = Ju(t, !n), n ? `/${t}` : t.length > 0 ? t : \".\";\n}\nconst Ie = 47, us = 46;\nfunction Ju(e, t) {\n let n = \"\", s = -1, r = 0, i, o = !1;\n for (let a = 0; a <= e.length; ++a) {\n if (a < e.length)\n i = e.charCodeAt(a);\n else {\n if (i === Ie)\n break;\n i = Ie;\n }\n if (i === Ie) {\n if (!(s === a - 1 || r === 1))\n if (s !== a - 1 && r === 2) {\n if (n.length < 2 || !o || n.charCodeAt(n.length - 1) !== us || n.charCodeAt(n.length - 2) !== us) {\n if (n.length > 2) {\n const c = n.length - 1;\n let u = c;\n for (; u >= 0 && n.charCodeAt(u) !== Ie; --u)\n ;\n if (u !== c) {\n n = u === -1 ? \"\" : n.slice(0, u), s = a, r = 0, o = !1;\n continue;\n }\n } else if (n.length === 2 || n.length === 1) {\n n = \"\", s = a, r = 0, o = !1;\n continue;\n }\n }\n t && (n.length > 0 ? n += \"/..\" : n = \"..\", o = !0);\n } else {\n const c = e.slice(s + 1, a);\n n.length > 0 ? n += `/${c}` : n = c, o = !1;\n }\n s = a, r = 0;\n } else\n i === us && r !== -1 ? ++r : r = -1;\n }\n return n;\n}\nconst Vu = (e) => typeof e == \"boolean\", ve = (e) => typeof e == \"function\", We = (e) => e !== null && typeof e == \"object\", Zr = (e) => We(e) && e.constructor === {}.constructor, ju = (e) => !!e && typeof e[Symbol.iterator] == \"function\", ku = (e) => e && typeof e[Symbol.asyncIterator] == \"function\", se = (e) => typeof Response < \"u\" && e instanceof Response || e && e.arrayBuffer && e.text && e.json, re = (e) => typeof Blob < \"u\" && e instanceof Blob, Ku = (e) => e && typeof e == \"object\" && e.isBuffer, zu = (e) => typeof ReadableStream < \"u\" && e instanceof ReadableStream || We(e) && ve(e.tee) && ve(e.cancel) && ve(e.getReader), Wu = (e) => We(e) && ve(e.read) && ve(e.pipe) && Vu(e.readable), ta = (e) => zu(e) || Wu(e), Xu = /^data:([-\\w.]+\\/[-\\w.+]+)(;|,)/, Qu = /^([-\\w.]+\\/[-\\w.+]+)/;\nfunction qu(e) {\n const t = Qu.exec(e);\n return t ? t[1] : e;\n}\nfunction ti(e) {\n const t = Xu.exec(e);\n return t ? t[1] : \"\";\n}\nconst ea = /\\?.*/;\nfunction Yu(e) {\n const t = e.match(ea);\n return t && t[0];\n}\nfunction mr(e) {\n return e.replace(ea, \"\");\n}\nfunction Kn(e) {\n return se(e) ? e.url : re(e) ? e.name || \"\" : typeof e == \"string\" ? e : \"\";\n}\nfunction gr(e) {\n if (se(e)) {\n const t = e, n = t.headers.get(\"content-type\") || \"\", s = mr(t.url);\n return qu(n) || ti(s);\n }\n return re(e) ? e.type || \"\" : typeof e == \"string\" ? ti(e) : \"\";\n}\nfunction $u(e) {\n return se(e) ? e.headers[\"content-length\"] || -1 : re(e) ? e.size : typeof e == \"string\" ? e.length : e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? e.byteLength : -1;\n}\nasync function na(e) {\n if (se(e))\n return e;\n const t = {}, n = $u(e);\n n >= 0 && (t[\"content-length\"] = String(n));\n const s = Kn(e), r = gr(e);\n r && (t[\"content-type\"] = r);\n const i = await el(e);\n i && (t[\"x-first-bytes\"] = i), typeof e == \"string\" && (e = new TextEncoder().encode(e));\n const o = new Response(e, {\n headers: t\n });\n return Object.defineProperty(o, \"url\", {\n value: s\n }), o;\n}\nasync function Zu(e) {\n if (!e.ok) {\n const t = await tl(e);\n throw new Error(t);\n }\n}\nasync function tl(e) {\n let t = `Failed to fetch resource ${e.url} (${e.status}): `;\n try {\n const n = e.headers.get(\"Content-Type\");\n let s = e.statusText;\n n != null && n.includes(\"application/json\") && (s += ` ${await e.text()}`), t += s, t = t.length > 60 ? `${t.slice(0, 60)}...` : t;\n } catch {\n }\n return t;\n}\nasync function el(e) {\n if (typeof e == \"string\")\n return `data:,${e.slice(0, 5)}`;\n if (e instanceof Blob) {\n const n = e.slice(0, 5);\n return await new Promise((s) => {\n const r = new FileReader();\n r.onload = (i) => {\n var o;\n return s(i == null || (o = i.target) === null || o === void 0 ? void 0 : o.result);\n }, r.readAsDataURL(n);\n });\n }\n if (e instanceof ArrayBuffer) {\n const n = e.slice(0, 5);\n return `data:base64,${nl(n)}`;\n }\n return null;\n}\nfunction nl(e) {\n let t = \"\";\n const n = new Uint8Array(e);\n for (let s = 0; s < n.byteLength; s++)\n t += String.fromCharCode(n[s]);\n return btoa(t);\n}\nfunction sl(e) {\n return !rl(e) && !il(e);\n}\nfunction rl(e) {\n return e.startsWith(\"http:\") || e.startsWith(\"https:\");\n}\nfunction il(e) {\n return e.startsWith(\"data:\");\n}\nasync function Ge(e, t) {\n if (typeof e == \"string\") {\n const r = Gu(e);\n if (sl(r)) {\n var n;\n if ((n = globalThis.loaders) !== null && n !== void 0 && n.fetchNode) {\n var s;\n return (s = globalThis.loaders) === null || s === void 0 ? void 0 : s.fetchNode(r, t);\n }\n }\n return await fetch(r, t);\n }\n return await na(e);\n}\nfunction ol(e) {\n if (typeof window < \"u\" && typeof window.process == \"object\" && window.process.type === \"renderer\" || typeof process < \"u\" && typeof process.versions == \"object\" && process.versions.electron)\n return !0;\n const t = typeof navigator == \"object\" && typeof navigator.userAgent == \"string\" && navigator.userAgent, n = e || t;\n return !!(n && n.indexOf(\"Electron\") >= 0);\n}\nfunction Xe() {\n return !(typeof process == \"object\" && String(process) === \"[object process]\" && !process.browser) || ol();\n}\nconst Ze = globalThis.window || globalThis.self || globalThis.global, Ee = globalThis.process || {}, sa = typeof __VERSION__ < \"u\" ? __VERSION__ : \"untranspiled source\";\nXe();\nfunction al(e) {\n try {\n const t = window[e], n = \"__storage_test__\";\n return t.setItem(n, n), t.removeItem(n), t;\n } catch {\n return null;\n }\n}\nclass cl {\n constructor(t, n) {\n let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : \"sessionStorage\";\n this.storage = void 0, this.id = void 0, this.config = void 0, this.storage = al(s), this.id = t, this.config = n, this._loadConfiguration();\n }\n getConfiguration() {\n return this.config;\n }\n setConfiguration(t) {\n if (Object.assign(this.config, t), this.storage) {\n const n = JSON.stringify(this.config);\n this.storage.setItem(this.id, n);\n }\n }\n _loadConfiguration() {\n let t = {};\n if (this.storage) {\n const n = this.storage.getItem(this.id);\n t = n ? JSON.parse(n) : {};\n }\n return Object.assign(this.config, t), this;\n }\n}\nfunction ul(e) {\n let t;\n return e < 10 ? t = \"\".concat(e.toFixed(2), \"ms\") : e < 100 ? t = \"\".concat(e.toFixed(1), \"ms\") : e < 1e3 ? t = \"\".concat(e.toFixed(0), \"ms\") : t = \"\".concat((e / 1e3).toFixed(2), \"s\"), t;\n}\nfunction ll(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;\n const n = Math.max(t - e.length, 0);\n return \"\".concat(\" \".repeat(n)).concat(e);\n}\nfunction ls(e, t, n) {\n let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;\n const r = e.src.replace(/\\(/g, \"%28\").replace(/\\)/g, \"%29\");\n e.width > s && (n = Math.min(n, s / e.width));\n const i = e.width * n, o = e.height * n, a = [\"font-size:1px;\", \"padding:\".concat(Math.floor(o / 2), \"px \").concat(Math.floor(i / 2), \"px;\"), \"line-height:\".concat(o, \"px;\"), \"background:url(\".concat(r, \");\"), \"background-size:\".concat(i, \"px \").concat(o, \"px;\"), \"color:transparent;\"].join(\"\");\n return [\"\".concat(t, \" %c+\"), a];\n}\nlet In;\n(function(e) {\n e[e.BLACK = 30] = \"BLACK\", e[e.RED = 31] = \"RED\", e[e.GREEN = 32] = \"GREEN\", e[e.YELLOW = 33] = \"YELLOW\", e[e.BLUE = 34] = \"BLUE\", e[e.MAGENTA = 35] = \"MAGENTA\", e[e.CYAN = 36] = \"CYAN\", e[e.WHITE = 37] = \"WHITE\", e[e.BRIGHT_BLACK = 90] = \"BRIGHT_BLACK\", e[e.BRIGHT_RED = 91] = \"BRIGHT_RED\", e[e.BRIGHT_GREEN = 92] = \"BRIGHT_GREEN\", e[e.BRIGHT_YELLOW = 93] = \"BRIGHT_YELLOW\", e[e.BRIGHT_BLUE = 94] = \"BRIGHT_BLUE\", e[e.BRIGHT_MAGENTA = 95] = \"BRIGHT_MAGENTA\", e[e.BRIGHT_CYAN = 96] = \"BRIGHT_CYAN\", e[e.BRIGHT_WHITE = 97] = \"BRIGHT_WHITE\";\n})(In || (In = {}));\nconst hl = 10;\nfunction ei(e) {\n return typeof e != \"string\" ? e : (e = e.toUpperCase(), In[e] || In.WHITE);\n}\nfunction fl(e, t, n) {\n if (!Xe && typeof e == \"string\") {\n if (t) {\n const s = ei(t);\n e = \"\\x1B[\".concat(s, \"m\").concat(e, \"\\x1B[39m\");\n }\n if (n) {\n const s = ei(n);\n e = \"\\x1B[\".concat(s + hl, \"m\").concat(e, \"\\x1B[49m\");\n }\n }\n return e;\n}\nfunction dl(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [\"constructor\"];\n const n = Object.getPrototypeOf(e), s = Object.getOwnPropertyNames(n), r = e;\n for (const i of s) {\n const o = r[i];\n typeof o == \"function\" && (t.find((a) => i === a) || (r[i] = o.bind(e)));\n }\n}\nfunction xn(e, t) {\n if (!e)\n throw new Error(t || \"Assertion failed\");\n}\nfunction ae() {\n let e;\n if (Xe() && Ze.performance) {\n var t, n;\n e = Ze == null || (t = Ze.performance) === null || t === void 0 || (n = t.now) === null || n === void 0 ? void 0 : n.call(t);\n } else if (\"hrtime\" in Ee) {\n var s;\n const r = Ee == null || (s = Ee.hrtime) === null || s === void 0 ? void 0 : s.call(Ee);\n e = r[0] * 1e3 + r[1] / 1e6;\n } else\n e = Date.now();\n return e;\n}\nconst ce = {\n debug: Xe() && console.debug || console.log,\n log: console.log,\n info: console.info,\n warn: console.warn,\n error: console.error\n}, ml = {\n enabled: !0,\n level: 0\n};\nfunction Ct() {\n}\nconst ni = {}, si = {\n once: !0\n};\nclass zn {\n constructor() {\n let {\n id: t\n } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {\n id: \"\"\n };\n this.id = void 0, this.VERSION = sa, this._startTs = ae(), this._deltaTs = ae(), this._storage = void 0, this.userData = {}, this.LOG_THROTTLE_TIMEOUT = 0, this.id = t, this.userData = {}, this._storage = new cl(\"__probe-\".concat(this.id, \"__\"), ml), this.timeStamp(\"\".concat(this.id, \" started\")), dl(this), Object.seal(this);\n }\n set level(t) {\n this.setLevel(t);\n }\n get level() {\n return this.getLevel();\n }\n isEnabled() {\n return this._storage.config.enabled;\n }\n getLevel() {\n return this._storage.config.level;\n }\n getTotal() {\n return Number((ae() - this._startTs).toPrecision(10));\n }\n getDelta() {\n return Number((ae() - this._deltaTs).toPrecision(10));\n }\n set priority(t) {\n this.level = t;\n }\n get priority() {\n return this.level;\n }\n getPriority() {\n return this.level;\n }\n enable() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0;\n return this._storage.setConfiguration({\n enabled: t\n }), this;\n }\n setLevel(t) {\n return this._storage.setConfiguration({\n level: t\n }), this;\n }\n get(t) {\n return this._storage.config[t];\n }\n set(t, n) {\n this._storage.setConfiguration({\n [t]: n\n });\n }\n settings() {\n console.table ? console.table(this._storage.config) : console.log(this._storage.config);\n }\n assert(t, n) {\n xn(t, n);\n }\n warn(t) {\n return this._getLogFunction(0, t, ce.warn, arguments, si);\n }\n error(t) {\n return this._getLogFunction(0, t, ce.error, arguments);\n }\n deprecated(t, n) {\n return this.warn(\"`\".concat(t, \"` is deprecated and will be removed in a later version. Use `\").concat(n, \"` instead\"));\n }\n removed(t, n) {\n return this.error(\"`\".concat(t, \"` has been removed. Use `\").concat(n, \"` instead\"));\n }\n probe(t, n) {\n return this._getLogFunction(t, n, ce.log, arguments, {\n time: !0,\n once: !0\n });\n }\n log(t, n) {\n return this._getLogFunction(t, n, ce.debug, arguments);\n }\n info(t, n) {\n return this._getLogFunction(t, n, console.info, arguments);\n }\n once(t, n) {\n return this._getLogFunction(t, n, ce.debug || ce.info, arguments, si);\n }\n table(t, n, s) {\n return n ? this._getLogFunction(t, n, console.table || Ct, s && [s], {\n tag: yl(n)\n }) : Ct;\n }\n image(t) {\n let {\n logLevel: n,\n priority: s,\n image: r,\n message: i = \"\",\n scale: o = 1\n } = t;\n return this._shouldLog(n || s) ? Xe() ? pl({\n image: r,\n message: i,\n scale: o\n }) : Al() : Ct;\n }\n time(t, n) {\n return this._getLogFunction(t, n, console.time ? console.time : console.info);\n }\n timeEnd(t, n) {\n return this._getLogFunction(t, n, console.timeEnd ? console.timeEnd : console.info);\n }\n timeStamp(t, n) {\n return this._getLogFunction(t, n, console.timeStamp || Ct);\n }\n group(t, n) {\n let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {\n collapsed: !1\n };\n const r = ri({\n logLevel: t,\n message: n,\n opts: s\n }), {\n collapsed: i\n } = s;\n return r.method = (i ? console.groupCollapsed : console.group) || console.info, this._getLogFunction(r);\n }\n groupCollapsed(t, n) {\n let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};\n return this.group(t, n, Object.assign({}, s, {\n collapsed: !0\n }));\n }\n groupEnd(t) {\n return this._getLogFunction(t, \"\", console.groupEnd || Ct);\n }\n withGroup(t, n, s) {\n this.group(t, n)();\n try {\n s();\n } finally {\n this.groupEnd(t)();\n }\n }\n trace() {\n console.trace && console.trace();\n }\n _shouldLog(t) {\n return this.isEnabled() && this.getLevel() >= ra(t);\n }\n _getLogFunction(t, n, s, r, i) {\n if (this._shouldLog(t)) {\n i = ri({\n logLevel: t,\n message: n,\n args: r,\n opts: i\n }), s = s || i.method, xn(s), i.total = this.getTotal(), i.delta = this.getDelta(), this._deltaTs = ae();\n const o = i.tag || i.message;\n if (i.once && o)\n if (!ni[o])\n ni[o] = ae();\n else\n return Ct;\n return n = gl(this.id, i.message, i), s.bind(console, n, ...i.args);\n }\n return Ct;\n }\n}\nzn.VERSION = sa;\nfunction ra(e) {\n if (!e)\n return 0;\n let t;\n switch (typeof e) {\n case \"number\":\n t = e;\n break;\n case \"object\":\n t = e.logLevel || e.priority || 0;\n break;\n default:\n return 0;\n }\n return xn(Number.isFinite(t) && t >= 0), t;\n}\nfunction ri(e) {\n const {\n logLevel: t,\n message: n\n } = e;\n e.logLevel = ra(t);\n const s = e.args ? Array.from(e.args) : [];\n for (; s.length && s.shift() !== n; )\n ;\n switch (typeof t) {\n case \"string\":\n case \"function\":\n n !== void 0 && s.unshift(n), e.message = t;\n break;\n case \"object\":\n Object.assign(e, t);\n break;\n }\n typeof e.message == \"function\" && (e.message = e.message());\n const r = typeof e.message;\n return xn(r === \"string\" || r === \"object\"), Object.assign(e, {\n args: s\n }, e.opts);\n}\nfunction gl(e, t, n) {\n if (typeof t == \"string\") {\n const s = n.time ? ll(ul(n.total)) : \"\";\n t = n.time ? \"\".concat(e, \": \").concat(s, \" \").concat(t) : \"\".concat(e, \": \").concat(t), t = fl(t, n.color, n.background);\n }\n return t;\n}\nfunction Al(e) {\n return console.warn(\"removed\"), Ct;\n}\nfunction pl(e) {\n let {\n image: t,\n message: n = \"\",\n scale: s = 1\n } = e;\n if (typeof t == \"string\") {\n const i = new Image();\n return i.onload = () => {\n const o = ls(i, n, s);\n console.log(...o);\n }, i.src = t, Ct;\n }\n const r = t.nodeName || \"\";\n if (r.toLowerCase() === \"img\")\n return console.log(...ls(t, n, s)), Ct;\n if (r.toLowerCase() === \"canvas\") {\n const i = new Image();\n return i.onload = () => console.log(...ls(i, n, s)), i.src = t.toDataURL(), Ct;\n }\n return Ct;\n}\nfunction yl(e) {\n for (const t in e)\n for (const n in e[t])\n return n || \"untitled\";\n return \"empty\";\n}\nconst ia = new zn({\n id: \"@probe.gl/log\"\n}), ii = new zn({\n id: \"loaders.gl\"\n});\nclass Bl {\n log() {\n return () => {\n };\n }\n info() {\n return () => {\n };\n }\n warn() {\n return () => {\n };\n }\n error() {\n return () => {\n };\n }\n}\nclass Cl {\n constructor() {\n this.console = void 0, this.console = console;\n }\n log() {\n for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++)\n n[s] = arguments[s];\n return this.console.log.bind(this.console, ...n);\n }\n info() {\n for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++)\n n[s] = arguments[s];\n return this.console.info.bind(this.console, ...n);\n }\n warn() {\n for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++)\n n[s] = arguments[s];\n return this.console.warn.bind(this.console, ...n);\n }\n error() {\n for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++)\n n[s] = arguments[s];\n return this.console.error.bind(this.console, ...n);\n }\n}\nconst oa = {\n fetch: null,\n mimeType: void 0,\n nothrow: !1,\n log: new Cl(),\n useLocalLibraries: !1,\n CDN: \"https://unpkg.com/@loaders.gl\",\n worker: !0,\n maxConcurrency: 3,\n maxMobileConcurrency: 1,\n reuseWorkers: kn,\n _nodeWorkers: !1,\n _workerType: \"\",\n limit: 0,\n _limitMB: 0,\n batchSize: \"auto\",\n batchDebounceMs: 0,\n metadata: !1,\n transforms: []\n}, El = {\n throws: \"nothrow\",\n dataType: \"(no longer used)\",\n uri: \"baseUri\",\n method: \"fetch.method\",\n headers: \"fetch.headers\",\n body: \"fetch.body\",\n mode: \"fetch.mode\",\n credentials: \"fetch.credentials\",\n cache: \"fetch.cache\",\n redirect: \"fetch.redirect\",\n referrer: \"fetch.referrer\",\n referrerPolicy: \"fetch.referrerPolicy\",\n integrity: \"fetch.integrity\",\n keepalive: \"fetch.keepalive\",\n signal: \"fetch.signal\"\n};\nfunction aa() {\n globalThis.loaders = globalThis.loaders || {};\n const {\n loaders: e\n } = globalThis;\n return e._state = e._state || {}, e._state;\n}\nfunction ca() {\n const e = aa();\n return e.globalOptions = e.globalOptions || {\n ...oa\n }, e.globalOptions;\n}\nfunction Tl(e, t, n, s) {\n return n = n || [], n = Array.isArray(n) ? n : [n], bl(e, n), wl(t, e, s);\n}\nfunction bl(e, t) {\n oi(e, null, oa, El, t);\n for (const n of t) {\n const s = e && e[n.id] || {}, r = n.options && n.options[n.id] || {}, i = n.deprecatedOptions && n.deprecatedOptions[n.id] || {};\n oi(s, n.id, r, i, t);\n }\n}\nfunction oi(e, t, n, s, r) {\n const i = t || \"Top level\", o = t ? `${t}.` : \"\";\n for (const a in e) {\n const c = !t && We(e[a]), u = a === \"baseUri\" && !t, l = a === \"workerUrl\" && t;\n if (!(a in n) && !u && !l) {\n if (a in s)\n ii.warn(`${i} loader option '${o}${a}' no longer supported, use '${s[a]}'`)();\n else if (!c) {\n const h = _l(a, r);\n ii.warn(`${i} loader option '${o}${a}' not recognized. ${h}`)();\n }\n }\n }\n}\nfunction _l(e, t) {\n const n = e.toLowerCase();\n let s = \"\";\n for (const r of t)\n for (const i in r.options) {\n if (e === i)\n return `Did you mean '${r.id}.${i}'?`;\n const o = i.toLowerCase();\n (n.startsWith(o) || o.startsWith(n)) && (s = s || `Did you mean '${r.id}.${i}'?`);\n }\n return s;\n}\nfunction wl(e, t, n) {\n const r = {\n ...e.options || {}\n };\n return Rl(r, n), r.log === null && (r.log = new Bl()), ai(r, ca()), ai(r, t), r;\n}\nfunction ai(e, t) {\n for (const n in t)\n if (n in t) {\n const s = t[n];\n Zr(s) && Zr(e[n]) ? e[n] = {\n ...e[n],\n ...t[n]\n } : e[n] = t[n];\n }\n}\nfunction Rl(e, t) {\n t && !(\"baseUri\" in e) && (e.baseUri = t);\n}\nfunction Ar(e) {\n var t;\n return e ? (Array.isArray(e) && (e = e[0]), Array.isArray((t = e) === null || t === void 0 ? void 0 : t.extensions)) : !1;\n}\nfunction ua(e) {\n var t, n;\n K(e, \"null loader\"), K(Ar(e), \"invalid loader\");\n let s;\n return Array.isArray(e) && (s = e[1], e = e[0], e = {\n ...e,\n options: {\n ...e.options,\n ...s\n }\n }), ((t = e) !== null && t !== void 0 && t.parseTextSync || (n = e) !== null && n !== void 0 && n.parseText) && (e.text = !0), e.text || (e.binary = !0), e;\n}\nconst Ml = () => {\n const e = aa();\n return e.loaderRegistry = e.loaderRegistry || [], e.loaderRegistry;\n};\nfunction Sl() {\n return Ml();\n}\nconst Il = new zn({\n id: \"loaders.gl\"\n}), xl = /\\.([^.]+)$/;\nasync function vl(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], n = arguments.length > 2 ? arguments[2] : void 0, s = arguments.length > 3 ? arguments[3] : void 0;\n if (!la(e))\n return null;\n let r = ci(e, t, {\n ...n,\n nothrow: !0\n }, s);\n if (r)\n return r;\n if (re(e) && (e = await e.slice(0, 10).arrayBuffer(), r = ci(e, t, n, s)), !r && !(n != null && n.nothrow))\n throw new Error(ha(e));\n return r;\n}\nfunction ci(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], n = arguments.length > 2 ? arguments[2] : void 0, s = arguments.length > 3 ? arguments[3] : void 0;\n if (!la(e))\n return null;\n if (t && !Array.isArray(t))\n return ua(t);\n let r = [];\n t && (r = r.concat(t)), n != null && n.ignoreRegisteredLoaders || r.push(...Sl()), Fl(r);\n const i = Ol(e, r, n, s);\n if (!i && !(n != null && n.nothrow))\n throw new Error(ha(e));\n return i;\n}\nfunction Ol(e, t, n, s) {\n const r = Kn(e), i = gr(e), o = mr(r) || (s == null ? void 0 : s.url);\n let a = null, c = \"\";\n if (n != null && n.mimeType && (a = hs(t, n == null ? void 0 : n.mimeType), c = `match forced by supplied MIME type ${n == null ? void 0 : n.mimeType}`), a = a || Dl(t, o), c = c || (a ? `matched url ${o}` : \"\"), a = a || hs(t, i), c = c || (a ? `matched MIME type ${i}` : \"\"), a = a || Pl(t, e), c = c || (a ? `matched initial data ${fa(e)}` : \"\"), n != null && n.fallbackMimeType && (a = a || hs(t, n == null ? void 0 : n.fallbackMimeType), c = c || (a ? `matched fallback MIME type ${i}` : \"\")), c) {\n var u;\n Il.log(1, `selectLoader selected ${(u = a) === null || u === void 0 ? void 0 : u.name}: ${c}.`);\n }\n return a;\n}\nfunction la(e) {\n return !(e instanceof Response && e.status === 204);\n}\nfunction ha(e) {\n const t = Kn(e), n = gr(e);\n let s = \"No valid loader found (\";\n s += t ? `${$o(t)}, ` : \"no url provided, \", s += `MIME type: ${n ? `\"${n}\"` : \"not provided\"}, `;\n const r = e ? fa(e) : \"\";\n return s += r ? ` first bytes: \"${r}\"` : \"first bytes: not available\", s += \")\", s;\n}\nfunction Fl(e) {\n for (const t of e)\n ua(t);\n}\nfunction Dl(e, t) {\n const n = t && xl.exec(t), s = n && n[1];\n return s ? Ll(e, s) : null;\n}\nfunction Ll(e, t) {\n t = t.toLowerCase();\n for (const n of e)\n for (const s of n.extensions)\n if (s.toLowerCase() === t)\n return n;\n return null;\n}\nfunction hs(e, t) {\n for (const n of e)\n if (n.mimeTypes && n.mimeTypes.includes(t) || t === `application/x.${n.id}`)\n return n;\n return null;\n}\nfunction Pl(e, t) {\n if (!t)\n return null;\n for (const n of e)\n if (typeof t == \"string\") {\n if (Gl(t, n))\n return n;\n } else if (ArrayBuffer.isView(t)) {\n if (ui(t.buffer, t.byteOffset, n))\n return n;\n } else if (t instanceof ArrayBuffer && ui(t, 0, n))\n return n;\n return null;\n}\nfunction Gl(e, t) {\n return t.testText ? t.testText(e) : (Array.isArray(t.tests) ? t.tests : [t.tests]).some((s) => e.startsWith(s));\n}\nfunction ui(e, t, n) {\n return (Array.isArray(n.tests) ? n.tests : [n.tests]).some((r) => Nl(e, t, n, r));\n}\nfunction Nl(e, t, n, s) {\n if (s instanceof ArrayBuffer)\n return vu(s, e, s.byteLength);\n switch (typeof s) {\n case \"function\":\n return s(e);\n case \"string\":\n const r = js(e, t, s.length);\n return s === r;\n default:\n return !1;\n }\n}\nfunction fa(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 5;\n return typeof e == \"string\" ? e.slice(0, t) : ArrayBuffer.isView(e) ? js(e.buffer, e.byteOffset, t) : e instanceof ArrayBuffer ? js(e, 0, t) : \"\";\n}\nfunction js(e, t, n) {\n if (e.byteLength < t + n)\n return \"\";\n const s = new DataView(e);\n let r = \"\";\n for (let i = 0; i < n; i++)\n r += String.fromCharCode(s.getUint8(t + i));\n return r;\n}\nconst Ul = 256 * 1024;\nfunction* Hl(e, t) {\n const n = (t == null ? void 0 : t.chunkSize) || Ul;\n let s = 0;\n const r = new TextEncoder();\n for (; s < e.length; ) {\n const i = Math.min(e.length - s, n), o = e.slice(s, s + i);\n s += i, yield r.encode(o);\n }\n}\nconst Jl = 256 * 1024;\nfunction Vl(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n return function* () {\n const {\n chunkSize: n = Jl\n } = t;\n let s = 0;\n for (; s < e.byteLength; ) {\n const r = Math.min(e.byteLength - s, n), i = new ArrayBuffer(r), o = new Uint8Array(e, s, r);\n new Uint8Array(i).set(o), s += r, yield i;\n }\n }();\n}\nconst jl = 1024 * 1024;\nasync function* kl(e, t) {\n const n = (t == null ? void 0 : t.chunkSize) || jl;\n let s = 0;\n for (; s < e.size; ) {\n const r = s + n, i = await e.slice(s, r).arrayBuffer();\n s = r, yield i;\n }\n}\nfunction li(e, t) {\n return kn ? Kl(e, t) : zl(e);\n}\nasync function* Kl(e, t) {\n const n = e.getReader();\n let s;\n try {\n for (; ; ) {\n const r = s || n.read();\n t != null && t._streamReadAhead && (s = n.read());\n const {\n done: i,\n value: o\n } = await r;\n if (i)\n return;\n yield Yo(o);\n }\n } catch {\n n.releaseLock();\n }\n}\nasync function* zl(e, t) {\n for await (const n of e)\n yield Yo(n);\n}\nfunction Wl(e, t) {\n if (typeof e == \"string\")\n return Hl(e, t);\n if (e instanceof ArrayBuffer)\n return Vl(e, t);\n if (re(e))\n return kl(e, t);\n if (ta(e))\n return li(e, t);\n if (se(e))\n return li(e.body, t);\n throw new Error(\"makeIterator\");\n}\nconst da = \"Cannot convert supplied data type\";\nfunction Xl(e, t, n) {\n if (t.text && typeof e == \"string\")\n return e;\n if (Ku(e) && (e = e.buffer), e instanceof ArrayBuffer) {\n const s = e;\n return t.text && !t.binary ? new TextDecoder(\"utf8\").decode(s) : s;\n }\n if (ArrayBuffer.isView(e)) {\n if (t.text && !t.binary)\n return new TextDecoder(\"utf8\").decode(e);\n let s = e.buffer;\n const r = e.byteLength || e.length;\n return (e.byteOffset !== 0 || r !== s.byteLength) && (s = s.slice(e.byteOffset, e.byteOffset + r)), s;\n }\n throw new Error(da);\n}\nasync function Ql(e, t, n) {\n const s = e instanceof ArrayBuffer || ArrayBuffer.isView(e);\n if (typeof e == \"string\" || s)\n return Xl(e, t);\n if (re(e) && (e = await na(e)), se(e)) {\n const r = e;\n return await Zu(r), t.binary ? await r.arrayBuffer() : await r.text();\n }\n if (ta(e) && (e = Wl(e, n)), ju(e) || ku(e))\n return Lu(e);\n throw new Error(da);\n}\nfunction ma(e, t) {\n const n = ca(), s = e || n;\n return typeof s.fetch == \"function\" ? s.fetch : We(s.fetch) ? (r) => Ge(r, s.fetch) : t != null && t.fetch ? t == null ? void 0 : t.fetch : Ge;\n}\nfunction ql(e, t, n) {\n if (n)\n return n;\n const s = {\n fetch: ma(t, e),\n ...e\n };\n if (s.url) {\n const r = mr(s.url);\n s.baseUrl = r, s.queryString = Yu(s.url), s.filename = $o(r), s.baseUrl = Zo(r);\n }\n return Array.isArray(s.loaders) || (s.loaders = null), s;\n}\nfunction Yl(e, t) {\n if (e && !Array.isArray(e))\n return e;\n let n;\n if (e && (n = Array.isArray(e) ? e : [e]), t && t.loaders) {\n const s = Array.isArray(t.loaders) ? t.loaders : [t.loaders];\n n = n ? [...n, ...s] : s;\n }\n return n && n.length ? n : void 0;\n}\nasync function vn(e, t, n, s) {\n t && !Array.isArray(t) && !Ar(t) && (s = void 0, n = t, t = void 0), e = await e, n = n || {};\n const r = Kn(e), o = Yl(t, s), a = await vl(e, o, n);\n return a ? (n = Tl(n, a, o, r), s = ql({\n url: r,\n _parse: vn,\n loaders: o\n }, n, s || null), await $l(a, e, n, s)) : null;\n}\nasync function $l(e, t, n, s) {\n if (yu(e), n = au(e.options, n), se(t)) {\n const i = t, {\n ok: o,\n redirected: a,\n status: c,\n statusText: u,\n type: l,\n url: h\n } = i, f = Object.fromEntries(i.headers.entries());\n s.response = {\n headers: f,\n ok: o,\n redirected: a,\n status: c,\n statusText: u,\n type: l,\n url: h\n };\n }\n t = await Ql(t, e, n);\n const r = e;\n if (r.parseTextSync && typeof t == \"string\")\n return r.parseTextSync(t, n, s);\n if (Ru(e, n))\n return await Mu(e, t, n, s, vn);\n if (r.parseText && typeof t == \"string\")\n return await r.parseText(t, n, s);\n if (r.parse)\n return await r.parse(t, n, s);\n throw Jt(!r.parseSync), new Error(`${e.id} loader - no parser found and worker is disabled`);\n}\nfunction Zl(e) {\n switch (e.constructor) {\n case Int8Array:\n return \"int8\";\n case Uint8Array:\n case Uint8ClampedArray:\n return \"uint8\";\n case Int16Array:\n return \"int16\";\n case Uint16Array:\n return \"uint16\";\n case Int32Array:\n return \"int32\";\n case Uint32Array:\n return \"uint32\";\n case Float32Array:\n return \"float32\";\n case Float64Array:\n return \"float64\";\n default:\n return \"null\";\n }\n}\nfunction th(e) {\n let t = 1 / 0, n = 1 / 0, s = 1 / 0, r = -1 / 0, i = -1 / 0, o = -1 / 0;\n const a = e.POSITION ? e.POSITION.value : [], c = a && a.length;\n for (let u = 0; u < c; u += 3) {\n const l = a[u], h = a[u + 1], f = a[u + 2];\n t = l < t ? l : t, n = h < n ? h : n, s = f < s ? f : s, r = l > r ? l : r, i = h > i ? h : i, o = f > o ? f : o;\n }\n return [[t, n, s], [r, i, o]];\n}\nfunction eh(e, t, n) {\n const s = Zl(t.value), r = n || nh(t);\n return {\n name: e,\n type: {\n type: \"fixed-size-list\",\n listSize: t.size,\n children: [{\n name: \"value\",\n type: s\n }]\n },\n nullable: !1,\n metadata: r\n };\n}\nfunction nh(e) {\n const t = {};\n return \"byteOffset\" in e && (t.byteOffset = e.byteOffset.toString(10)), \"byteStride\" in e && (t.byteStride = e.byteStride.toString(10)), \"normalized\" in e && (t.normalized = e.normalized.toString()), t;\n}\nasync function Ae(e, t, n, s) {\n let r, i;\n !Array.isArray(t) && !Ar(t) ? (r = [], i = t) : (r = t, i = n);\n const o = ma(i);\n let a = e;\n return typeof e == \"string\" && (a = await o(e)), re(e) && (a = await o(e)), Array.isArray(r) ? await vn(a, r, i) : await vn(a, r, i);\n}\nconst sh = 1 / Math.PI * 180, rh = 1 / 180 * Math.PI, ih = {\n EPSILON: 1e-12,\n debug: !1,\n precision: 4,\n printTypes: !1,\n printDegrees: !1,\n printRowMajor: !0,\n _cartographicRadians: !1\n};\nglobalThis.mathgl = globalThis.mathgl || {\n config: {\n ...ih\n }\n};\nconst Z = globalThis.mathgl.config;\nfunction oh(e, {\n precision: t = Z.precision\n} = {}) {\n return e = hh(e), \"\".concat(parseFloat(e.toPrecision(t)));\n}\nfunction ee(e) {\n return Array.isArray(e) || ArrayBuffer.isView(e) && !(e instanceof DataView);\n}\nfunction ah(e) {\n return uh(e);\n}\nfunction ch(e) {\n return Rt(e);\n}\nfunction uh(e, t) {\n return pr(e, (n) => n * rh, t);\n}\nfunction Rt(e, t) {\n return pr(e, (n) => n * sh, t);\n}\nfunction lh(e, t, n) {\n return pr(e, (s) => Math.max(t, Math.min(n, s)));\n}\nfunction Kt(e, t, n) {\n const s = Z.EPSILON;\n n && (Z.EPSILON = n);\n try {\n if (e === t)\n return !0;\n if (ee(e) && ee(t)) {\n if (e.length !== t.length)\n return !1;\n for (let r = 0; r < e.length; ++r)\n if (!Kt(e[r], t[r]))\n return !1;\n return !0;\n }\n return e && e.equals ? e.equals(t) : t && t.equals ? t.equals(e) : typeof e == \"number\" && typeof t == \"number\" ? Math.abs(e - t) <= Z.EPSILON * Math.max(1, Math.abs(e), Math.abs(t)) : !1;\n } finally {\n Z.EPSILON = s;\n }\n}\nfunction hh(e) {\n return Math.round(e / Z.EPSILON) * Z.EPSILON;\n}\nfunction fh(e) {\n return e.clone ? e.clone() : new Array(e.length);\n}\nfunction pr(e, t, n) {\n if (ee(e)) {\n const s = e;\n n = n || fh(s);\n for (let r = 0; r < n.length && r < s.length; ++r) {\n const i = typeof e == \"number\" ? e : e[r];\n n[r] = t(i, r, n);\n }\n return n;\n }\n return t(e);\n}\nfunction dh(e) {\n function t() {\n var n = Reflect.construct(e, Array.from(arguments));\n return Object.setPrototypeOf(n, Object.getPrototypeOf(this)), n;\n }\n return t.prototype = Object.create(e.prototype, {\n constructor: {\n value: e,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e, t;\n}\nclass yr extends dh(Array) {\n clone() {\n return new this.constructor().copy(this);\n }\n fromArray(t, n = 0) {\n for (let s = 0; s < this.ELEMENTS; ++s)\n this[s] = t[s + n];\n return this.check();\n }\n toArray(t = [], n = 0) {\n for (let s = 0; s < this.ELEMENTS; ++s)\n t[n + s] = this[s];\n return t;\n }\n toObject(t) {\n return t;\n }\n from(t) {\n return Array.isArray(t) ? this.copy(t) : this.fromObject(t);\n }\n to(t) {\n return t === this ? this : ee(t) ? this.toArray(t) : this.toObject(t);\n }\n toTarget(t) {\n return t ? this.to(t) : this;\n }\n toFloat32Array() {\n return new Float32Array(this);\n }\n toString() {\n return this.formatString(Z);\n }\n formatString(t) {\n let n = \"\";\n for (let s = 0; s < this.ELEMENTS; ++s)\n n += (s > 0 ? \", \" : \"\") + oh(this[s], t);\n return \"\".concat(t.printTypes ? this.constructor.name : \"\", \"[\").concat(n, \"]\");\n }\n equals(t) {\n if (!t || this.length !== t.length)\n return !1;\n for (let n = 0; n < this.ELEMENTS; ++n)\n if (!Kt(this[n], t[n]))\n return !1;\n return !0;\n }\n exactEquals(t) {\n if (!t || this.length !== t.length)\n return !1;\n for (let n = 0; n < this.ELEMENTS; ++n)\n if (this[n] !== t[n])\n return !1;\n return !0;\n }\n negate() {\n for (let t = 0; t < this.ELEMENTS; ++t)\n this[t] = -this[t];\n return this.check();\n }\n lerp(t, n, s) {\n if (s === void 0)\n return this.lerp(this, t, n);\n for (let r = 0; r < this.ELEMENTS; ++r) {\n const i = t[r], o = typeof n == \"number\" ? n : n[r];\n this[r] = i + s * (o - i);\n }\n return this.check();\n }\n min(t) {\n for (let n = 0; n < this.ELEMENTS; ++n)\n this[n] = Math.min(t[n], this[n]);\n return this.check();\n }\n max(t) {\n for (let n = 0; n < this.ELEMENTS; ++n)\n this[n] = Math.max(t[n], this[n]);\n return this.check();\n }\n clamp(t, n) {\n for (let s = 0; s < this.ELEMENTS; ++s)\n this[s] = Math.min(Math.max(this[s], t[s]), n[s]);\n return this.check();\n }\n add(...t) {\n for (const n of t)\n for (let s = 0; s < this.ELEMENTS; ++s)\n this[s] += n[s];\n return this.check();\n }\n subtract(...t) {\n for (const n of t)\n for (let s = 0; s < this.ELEMENTS; ++s)\n this[s] -= n[s];\n return this.check();\n }\n scale(t) {\n if (typeof t == \"number\")\n for (let n = 0; n < this.ELEMENTS; ++n)\n this[n] *= t;\n else\n for (let n = 0; n < this.ELEMENTS && n < t.length; ++n)\n this[n] *= t[n];\n return this.check();\n }\n multiplyByScalar(t) {\n for (let n = 0; n < this.ELEMENTS; ++n)\n this[n] *= t;\n return this.check();\n }\n check() {\n if (Z.debug && !this.validate())\n throw new Error(\"math.gl: \".concat(this.constructor.name, \" some fields set to invalid numbers'\"));\n return this;\n }\n validate() {\n let t = this.length === this.ELEMENTS;\n for (let n = 0; n < this.ELEMENTS; ++n)\n t = t && Number.isFinite(this[n]);\n return t;\n }\n sub(t) {\n return this.subtract(t);\n }\n setScalar(t) {\n for (let n = 0; n < this.ELEMENTS; ++n)\n this[n] = t;\n return this.check();\n }\n addScalar(t) {\n for (let n = 0; n < this.ELEMENTS; ++n)\n this[n] += t;\n return this.check();\n }\n subScalar(t) {\n return this.addScalar(-t);\n }\n multiplyScalar(t) {\n for (let n = 0; n < this.ELEMENTS; ++n)\n this[n] *= t;\n return this.check();\n }\n divideScalar(t) {\n return this.multiplyByScalar(1 / t);\n }\n clampScalar(t, n) {\n for (let s = 0; s < this.ELEMENTS; ++s)\n this[s] = Math.min(Math.max(this[s], t), n);\n return this.check();\n }\n get elements() {\n return this;\n }\n}\nfunction mh(e, t) {\n if (e.length !== t)\n return !1;\n for (let n = 0; n < e.length; ++n)\n if (!Number.isFinite(e[n]))\n return !1;\n return !0;\n}\nfunction U(e) {\n if (!Number.isFinite(e))\n throw new Error(\"Invalid number \".concat(JSON.stringify(e)));\n return e;\n}\nfunction Oe(e, t, n = \"\") {\n if (Z.debug && !mh(e, t))\n throw new Error(\"math.gl: \".concat(n, \" some fields set to invalid numbers'\"));\n return e;\n}\nfunction j(e, t) {\n if (!e)\n throw new Error(\"math.gl assertion \".concat(t));\n}\nclass Br extends yr {\n get x() {\n return this[0];\n }\n set x(t) {\n this[0] = U(t);\n }\n get y() {\n return this[1];\n }\n set y(t) {\n this[1] = U(t);\n }\n len() {\n return Math.sqrt(this.lengthSquared());\n }\n magnitude() {\n return this.len();\n }\n lengthSquared() {\n let t = 0;\n for (let n = 0; n < this.ELEMENTS; ++n)\n t += this[n] * this[n];\n return t;\n }\n magnitudeSquared() {\n return this.lengthSquared();\n }\n distance(t) {\n return Math.sqrt(this.distanceSquared(t));\n }\n distanceSquared(t) {\n let n = 0;\n for (let s = 0; s < this.ELEMENTS; ++s) {\n const r = this[s] - t[s];\n n += r * r;\n }\n return U(n);\n }\n dot(t) {\n let n = 0;\n for (let s = 0; s < this.ELEMENTS; ++s)\n n += this[s] * t[s];\n return U(n);\n }\n normalize() {\n const t = this.magnitude();\n if (t !== 0)\n for (let n = 0; n < this.ELEMENTS; ++n)\n this[n] /= t;\n return this.check();\n }\n multiply(...t) {\n for (const n of t)\n for (let s = 0; s < this.ELEMENTS; ++s)\n this[s] *= n[s];\n return this.check();\n }\n divide(...t) {\n for (const n of t)\n for (let s = 0; s < this.ELEMENTS; ++s)\n this[s] /= n[s];\n return this.check();\n }\n lengthSq() {\n return this.lengthSquared();\n }\n distanceTo(t) {\n return this.distance(t);\n }\n distanceToSquared(t) {\n return this.distanceSquared(t);\n }\n getComponent(t) {\n return j(t >= 0 && t < this.ELEMENTS, \"index is out of range\"), U(this[t]);\n }\n setComponent(t, n) {\n return j(t >= 0 && t < this.ELEMENTS, \"index is out of range\"), this[t] = n, this.check();\n }\n addVectors(t, n) {\n return this.copy(t).add(n);\n }\n subVectors(t, n) {\n return this.copy(t).subtract(n);\n }\n multiplyVectors(t, n) {\n return this.copy(t).multiply(n);\n }\n addScaledVector(t, n) {\n return this.add(new this.constructor(t).multiplyScalar(n));\n }\n}\nconst Fe = 1e-6;\nlet It = typeof Float32Array < \"u\" ? Float32Array : Array;\nfunction gh() {\n const e = new It(2);\n return It != Float32Array && (e[0] = 0, e[1] = 0), e;\n}\nfunction Ah(e, t, n) {\n const s = t[0], r = t[1];\n return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e;\n}\nfunction ph(e, t, n) {\n const s = t[0], r = t[1];\n return e[0] = n[0] * s + n[2] * r + n[4], e[1] = n[1] * s + n[3] * r + n[5], e;\n}\nfunction ga(e, t, n) {\n const s = t[0], r = t[1];\n return e[0] = n[0] * s + n[3] * r + n[6], e[1] = n[1] * s + n[4] * r + n[7], e;\n}\nfunction Aa(e, t, n) {\n const s = t[0], r = t[1];\n return e[0] = n[0] * s + n[4] * r + n[12], e[1] = n[1] * s + n[5] * r + n[13], e;\n}\n(function() {\n const e = gh();\n return function(t, n, s, r, i, o) {\n let a, c;\n for (n || (n = 2), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n)\n e[0] = t[a], e[1] = t[a + 1], i(e, e, o), t[a] = e[0], t[a + 1] = e[1];\n return t;\n };\n})();\nfunction pa(e, t, n) {\n const s = t[0], r = t[1], i = n[3] * s + n[7] * r || 1;\n return e[0] = (n[0] * s + n[4] * r) / i, e[1] = (n[1] * s + n[5] * r) / i, e;\n}\nfunction ya(e, t, n) {\n const s = t[0], r = t[1], i = t[2], o = n[3] * s + n[7] * r + n[11] * i || 1;\n return e[0] = (n[0] * s + n[4] * r + n[8] * i) / o, e[1] = (n[1] * s + n[5] * r + n[9] * i) / o, e[2] = (n[2] * s + n[6] * r + n[10] * i) / o, e;\n}\nfunction yh(e, t, n) {\n const s = t[0], r = t[1];\n return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e[2] = t[2], e;\n}\nfunction Bh(e, t, n) {\n const s = t[0], r = t[1];\n return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e[2] = t[2], e[3] = t[3], e;\n}\nfunction Ba(e, t, n) {\n const s = t[0], r = t[1], i = t[2];\n return e[0] = n[0] * s + n[3] * r + n[6] * i, e[1] = n[1] * s + n[4] * r + n[7] * i, e[2] = n[2] * s + n[5] * r + n[8] * i, e[3] = t[3], e;\n}\nclass Wn extends Br {\n constructor(t = 0, n = 0) {\n super(2), ee(t) && arguments.length === 1 ? this.copy(t) : (Z.debug && (U(t), U(n)), this[0] = t, this[1] = n);\n }\n set(t, n) {\n return this[0] = t, this[1] = n, this.check();\n }\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this.check();\n }\n fromObject(t) {\n return Z.debug && (U(t.x), U(t.y)), this[0] = t.x, this[1] = t.y, this.check();\n }\n toObject(t) {\n return t.x = this[0], t.y = this[1], t;\n }\n get ELEMENTS() {\n return 2;\n }\n horizontalAngle() {\n return Math.atan2(this.y, this.x);\n }\n verticalAngle() {\n return Math.atan2(this.x, this.y);\n }\n transform(t) {\n return this.transformAsPoint(t);\n }\n transformAsPoint(t) {\n return Aa(this, this, t), this.check();\n }\n transformAsVector(t) {\n return pa(this, this, t), this.check();\n }\n transformByMatrix3(t) {\n return ga(this, this, t), this.check();\n }\n transformByMatrix2x3(t) {\n return ph(this, this, t), this.check();\n }\n transformByMatrix2(t) {\n return Ah(this, this, t), this.check();\n }\n}\nfunction Ca() {\n const e = new It(3);\n return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e;\n}\nfunction Ea(e) {\n const t = e[0], n = e[1], s = e[2];\n return Math.sqrt(t * t + n * n + s * s);\n}\nfunction hi(e, t, n) {\n const s = new It(3);\n return s[0] = e, s[1] = t, s[2] = n, s;\n}\nfunction Ch(e, t) {\n const n = t[0], s = t[1], r = t[2];\n let i = n * n + s * s + r * r;\n return i > 0 && (i = 1 / Math.sqrt(i)), e[0] = t[0] * i, e[1] = t[1] * i, e[2] = t[2] * i, e;\n}\nfunction Cr(e, t) {\n return e[0] * t[0] + e[1] * t[1] + e[2] * t[2];\n}\nfunction Tn(e, t, n) {\n const s = t[0], r = t[1], i = t[2], o = n[0], a = n[1], c = n[2];\n return e[0] = r * c - i * a, e[1] = i * o - s * c, e[2] = s * a - r * o, e;\n}\nfunction Er(e, t, n) {\n const s = t[0], r = t[1], i = t[2];\n let o = n[3] * s + n[7] * r + n[11] * i + n[15];\n return o = o || 1, e[0] = (n[0] * s + n[4] * r + n[8] * i + n[12]) / o, e[1] = (n[1] * s + n[5] * r + n[9] * i + n[13]) / o, e[2] = (n[2] * s + n[6] * r + n[10] * i + n[14]) / o, e;\n}\nfunction Ta(e, t, n) {\n const s = t[0], r = t[1], i = t[2];\n return e[0] = s * n[0] + r * n[3] + i * n[6], e[1] = s * n[1] + r * n[4] + i * n[7], e[2] = s * n[2] + r * n[5] + i * n[8], e;\n}\nfunction ba(e, t, n) {\n const s = n[0], r = n[1], i = n[2], o = n[3], a = t[0], c = t[1], u = t[2];\n let l = r * u - i * c, h = i * a - s * u, f = s * c - r * a, d = r * f - i * h, m = i * l - s * f, g = s * h - r * l;\n const y = o * 2;\n return l *= y, h *= y, f *= y, d *= 2, m *= 2, g *= 2, e[0] = a + l + d, e[1] = c + h + m, e[2] = u + f + g, e;\n}\nfunction Eh(e, t, n, s) {\n const r = [], i = [];\n return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[0], i[1] = r[1] * Math.cos(s) - r[2] * Math.sin(s), i[2] = r[1] * Math.sin(s) + r[2] * Math.cos(s), e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e;\n}\nfunction Th(e, t, n, s) {\n const r = [], i = [];\n return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[2] * Math.sin(s) + r[0] * Math.cos(s), i[1] = r[1], i[2] = r[2] * Math.cos(s) - r[0] * Math.sin(s), e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e;\n}\nfunction bh(e, t, n, s) {\n const r = [], i = [];\n return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[0] * Math.cos(s) - r[1] * Math.sin(s), i[1] = r[0] * Math.sin(s) + r[1] * Math.cos(s), i[2] = r[2], e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e;\n}\nfunction _h(e, t) {\n const n = e[0], s = e[1], r = e[2], i = t[0], o = t[1], a = t[2], c = Math.sqrt((n * n + s * s + r * r) * (i * i + o * o + a * a)), u = c && Cr(e, t) / c;\n return Math.acos(Math.min(Math.max(u, -1), 1));\n}\nconst wh = Ea;\n(function() {\n const e = Ca();\n return function(t, n, s, r, i, o) {\n let a, c;\n for (n || (n = 3), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n)\n e[0] = t[a], e[1] = t[a + 1], e[2] = t[a + 2], i(e, e, o), t[a] = e[0], t[a + 1] = e[1], t[a + 2] = e[2];\n return t;\n };\n})();\nconst fs = [0, 0, 0];\nlet tn;\nclass A extends Br {\n static get ZERO() {\n return tn || (tn = new A(0, 0, 0), Object.freeze(tn)), tn;\n }\n constructor(t = 0, n = 0, s = 0) {\n super(-0, -0, -0), arguments.length === 1 && ee(t) ? this.copy(t) : (Z.debug && (U(t), U(n), U(s)), this[0] = t, this[1] = n, this[2] = s);\n }\n set(t, n, s) {\n return this[0] = t, this[1] = n, this[2] = s, this.check();\n }\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this[2] = t[2], this.check();\n }\n fromObject(t) {\n return Z.debug && (U(t.x), U(t.y), U(t.z)), this[0] = t.x, this[1] = t.y, this[2] = t.z, this.check();\n }\n toObject(t) {\n return t.x = this[0], t.y = this[1], t.z = this[2], t;\n }\n get ELEMENTS() {\n return 3;\n }\n get z() {\n return this[2];\n }\n set z(t) {\n this[2] = U(t);\n }\n angle(t) {\n return _h(this, t);\n }\n cross(t) {\n return Tn(this, this, t), this.check();\n }\n rotateX({\n radians: t,\n origin: n = fs\n }) {\n return Eh(this, this, n, t), this.check();\n }\n rotateY({\n radians: t,\n origin: n = fs\n }) {\n return Th(this, this, n, t), this.check();\n }\n rotateZ({\n radians: t,\n origin: n = fs\n }) {\n return bh(this, this, n, t), this.check();\n }\n transform(t) {\n return this.transformAsPoint(t);\n }\n transformAsPoint(t) {\n return Er(this, this, t), this.check();\n }\n transformAsVector(t) {\n return ya(this, this, t), this.check();\n }\n transformByMatrix3(t) {\n return Ta(this, this, t), this.check();\n }\n transformByMatrix2(t) {\n return yh(this, this, t), this.check();\n }\n transformByQuaternion(t) {\n return ba(this, this, t), this.check();\n }\n}\nlet en;\nclass Tr extends Br {\n static get ZERO() {\n return en || (en = new Tr(0, 0, 0, 0), Object.freeze(en)), en;\n }\n constructor(t = 0, n = 0, s = 0, r = 0) {\n super(-0, -0, -0, -0), ee(t) && arguments.length === 1 ? this.copy(t) : (Z.debug && (U(t), U(n), U(s), U(r)), this[0] = t, this[1] = n, this[2] = s, this[3] = r);\n }\n set(t, n, s, r) {\n return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this.check();\n }\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this.check();\n }\n fromObject(t) {\n return Z.debug && (U(t.x), U(t.y), U(t.z), U(t.w)), this[0] = t.x, this[1] = t.y, this[2] = t.z, this[3] = t.w, this;\n }\n toObject(t) {\n return t.x = this[0], t.y = this[1], t.z = this[2], t.w = this[3], t;\n }\n get ELEMENTS() {\n return 4;\n }\n get z() {\n return this[2];\n }\n set z(t) {\n this[2] = U(t);\n }\n get w() {\n return this[3];\n }\n set w(t) {\n this[3] = U(t);\n }\n transform(t) {\n return Er(this, this, t), this.check();\n }\n transformByMatrix3(t) {\n return Ba(this, this, t), this.check();\n }\n transformByMatrix2(t) {\n return Bh(this, this, t), this.check();\n }\n transformByQuaternion(t) {\n return ba(this, this, t), this.check();\n }\n applyMatrix4(t) {\n return t.transform(this, this), this;\n }\n}\nclass _a extends yr {\n toString() {\n let t = \"[\";\n if (Z.printRowMajor) {\n t += \"row-major:\";\n for (let n = 0; n < this.RANK; ++n)\n for (let s = 0; s < this.RANK; ++s)\n t += \" \".concat(this[s * this.RANK + n]);\n } else {\n t += \"column-major:\";\n for (let n = 0; n < this.ELEMENTS; ++n)\n t += \" \".concat(this[n]);\n }\n return t += \"]\", t;\n }\n getElementIndex(t, n) {\n return n * this.RANK + t;\n }\n getElement(t, n) {\n return this[n * this.RANK + t];\n }\n setElement(t, n, s) {\n return this[n * this.RANK + t] = U(s), this;\n }\n getColumn(t, n = new Array(this.RANK).fill(-0)) {\n const s = t * this.RANK;\n for (let r = 0; r < this.RANK; ++r)\n n[r] = this[s + r];\n return n;\n }\n setColumn(t, n) {\n const s = t * this.RANK;\n for (let r = 0; r < this.RANK; ++r)\n this[s + r] = n[r];\n return this;\n }\n}\nfunction Rh() {\n const e = new It(9);\n return It != Float32Array && (e[1] = 0, e[2] = 0, e[3] = 0, e[5] = 0, e[6] = 0, e[7] = 0), e[0] = 1, e[4] = 1, e[8] = 1, e;\n}\nfunction Mh(e, t) {\n if (e === t) {\n const n = t[1], s = t[2], r = t[5];\n e[1] = t[3], e[2] = t[6], e[3] = n, e[5] = t[7], e[6] = s, e[7] = r;\n } else\n e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8];\n return e;\n}\nfunction Sh(e, t) {\n const n = t[0], s = t[1], r = t[2], i = t[3], o = t[4], a = t[5], c = t[6], u = t[7], l = t[8], h = l * o - a * u, f = -l * i + a * c, d = u * i - o * c;\n let m = n * h + s * f + r * d;\n return m ? (m = 1 / m, e[0] = h * m, e[1] = (-l * s + r * u) * m, e[2] = (a * s - r * o) * m, e[3] = f * m, e[4] = (l * n - r * c) * m, e[5] = (-a * n + r * i) * m, e[6] = d * m, e[7] = (-u * n + s * c) * m, e[8] = (o * n - s * i) * m, e) : null;\n}\nfunction Ih(e) {\n const t = e[0], n = e[1], s = e[2], r = e[3], i = e[4], o = e[5], a = e[6], c = e[7], u = e[8];\n return t * (u * i - o * c) + n * (-u * r + o * a) + s * (c * r - i * a);\n}\nfunction fi(e, t, n) {\n const s = t[0], r = t[1], i = t[2], o = t[3], a = t[4], c = t[5], u = t[6], l = t[7], h = t[8], f = n[0], d = n[1], m = n[2], g = n[3], y = n[4], E = n[5], R = n[6], B = n[7], C = n[8];\n return e[0] = f * s + d * o + m * u, e[1] = f * r + d * a + m * l, e[2] = f * i + d * c + m * h, e[3] = g * s + y * o + E * u, e[4] = g * r + y * a + E * l, e[5] = g * i + y * c + E * h, e[6] = R * s + B * o + C * u, e[7] = R * r + B * a + C * l, e[8] = R * i + B * c + C * h, e;\n}\nfunction xh(e, t, n) {\n const s = t[0], r = t[1], i = t[2], o = t[3], a = t[4], c = t[5], u = t[6], l = t[7], h = t[8], f = n[0], d = n[1];\n return e[0] = s, e[1] = r, e[2] = i, e[3] = o, e[4] = a, e[5] = c, e[6] = f * s + d * o + u, e[7] = f * r + d * a + l, e[8] = f * i + d * c + h, e;\n}\nfunction vh(e, t, n) {\n const s = t[0], r = t[1], i = t[2], o = t[3], a = t[4], c = t[5], u = t[6], l = t[7], h = t[8], f = Math.sin(n), d = Math.cos(n);\n return e[0] = d * s + f * o, e[1] = d * r + f * a, e[2] = d * i + f * c, e[3] = d * o - f * s, e[4] = d * a - f * r, e[5] = d * c - f * i, e[6] = u, e[7] = l, e[8] = h, e;\n}\nfunction di(e, t, n) {\n const s = n[0], r = n[1];\n return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = r * t[3], e[4] = r * t[4], e[5] = r * t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8], e;\n}\nfunction Oh(e, t) {\n const n = t[0], s = t[1], r = t[2], i = t[3], o = n + n, a = s + s, c = r + r, u = n * o, l = s * o, h = s * a, f = r * o, d = r * a, m = r * c, g = i * o, y = i * a, E = i * c;\n return e[0] = 1 - h - m, e[3] = l - E, e[6] = f + y, e[1] = l + E, e[4] = 1 - u - m, e[7] = d - g, e[2] = f - y, e[5] = d + g, e[8] = 1 - u - h, e;\n}\nvar ks;\n(function(e) {\n e[e.COL0ROW0 = 0] = \"COL0ROW0\", e[e.COL0ROW1 = 1] = \"COL0ROW1\", e[e.COL0ROW2 = 2] = \"COL0ROW2\", e[e.COL1ROW0 = 3] = \"COL1ROW0\", e[e.COL1ROW1 = 4] = \"COL1ROW1\", e[e.COL1ROW2 = 5] = \"COL1ROW2\", e[e.COL2ROW0 = 6] = \"COL2ROW0\", e[e.COL2ROW1 = 7] = \"COL2ROW1\", e[e.COL2ROW2 = 8] = \"COL2ROW2\";\n})(ks || (ks = {}));\nconst Fh = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);\nclass W extends _a {\n static get IDENTITY() {\n return Lh();\n }\n static get ZERO() {\n return Dh();\n }\n get ELEMENTS() {\n return 9;\n }\n get RANK() {\n return 3;\n }\n get INDICES() {\n return ks;\n }\n constructor(t, ...n) {\n super(-0, -0, -0, -0, -0, -0, -0, -0, -0), arguments.length === 1 && Array.isArray(t) ? this.copy(t) : n.length > 0 ? this.copy([t, ...n]) : this.identity();\n }\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this[4] = t[4], this[5] = t[5], this[6] = t[6], this[7] = t[7], this[8] = t[8], this.check();\n }\n identity() {\n return this.copy(Fh);\n }\n fromObject(t) {\n return this.check();\n }\n fromQuaternion(t) {\n return Oh(this, t), this.check();\n }\n set(t, n, s, r, i, o, a, c, u) {\n return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this[4] = i, this[5] = o, this[6] = a, this[7] = c, this[8] = u, this.check();\n }\n setRowMajor(t, n, s, r, i, o, a, c, u) {\n return this[0] = t, this[1] = r, this[2] = a, this[3] = n, this[4] = i, this[5] = c, this[6] = s, this[7] = o, this[8] = u, this.check();\n }\n determinant() {\n return Ih(this);\n }\n transpose() {\n return Mh(this, this), this.check();\n }\n invert() {\n return Sh(this, this), this.check();\n }\n multiplyLeft(t) {\n return fi(this, t, this), this.check();\n }\n multiplyRight(t) {\n return fi(this, this, t), this.check();\n }\n rotate(t) {\n return vh(this, this, t), this.check();\n }\n scale(t) {\n return Array.isArray(t) ? di(this, this, t) : di(this, this, [t, t]), this.check();\n }\n translate(t) {\n return xh(this, this, t), this.check();\n }\n transform(t, n) {\n let s;\n switch (t.length) {\n case 2:\n s = ga(n || [-0, -0], t, this);\n break;\n case 3:\n s = Ta(n || [-0, -0, -0], t, this);\n break;\n case 4:\n s = Ba(n || [-0, -0, -0, -0], t, this);\n break;\n default:\n throw new Error(\"Illegal vector\");\n }\n return Oe(s, t.length), s;\n }\n transformVector(t, n) {\n return this.transform(t, n);\n }\n transformVector2(t, n) {\n return this.transform(t, n);\n }\n transformVector3(t, n) {\n return this.transform(t, n);\n }\n}\nlet nn, sn = null;\nfunction Dh() {\n return nn || (nn = new W([0, 0, 0, 0, 0, 0, 0, 0, 0]), Object.freeze(nn)), nn;\n}\nfunction Lh() {\n return sn || (sn = new W(), Object.freeze(sn)), sn;\n}\nfunction Ph(e) {\n return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;\n}\nfunction Gh(e, t) {\n if (e === t) {\n const n = t[1], s = t[2], r = t[3], i = t[6], o = t[7], a = t[11];\n e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = n, e[6] = t[9], e[7] = t[13], e[8] = s, e[9] = i, e[11] = t[14], e[12] = r, e[13] = o, e[14] = a;\n } else\n e[0] = t[0], e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = t[1], e[5] = t[5], e[6] = t[9], e[7] = t[13], e[8] = t[2], e[9] = t[6], e[10] = t[10], e[11] = t[14], e[12] = t[3], e[13] = t[7], e[14] = t[11], e[15] = t[15];\n return e;\n}\nfunction Nh(e, t) {\n const n = t[0], s = t[1], r = t[2], i = t[3], o = t[4], a = t[5], c = t[6], u = t[7], l = t[8], h = t[9], f = t[10], d = t[11], m = t[12], g = t[13], y = t[14], E = t[15], R = n * a - s * o, B = n * c - r * o, C = n * u - i * o, M = s * c - r * a, b = s * u - i * a, O = r * u - i * c, F = l * g - h * m, v = l * y - f * m, L = l * E - d * m, k = h * y - f * g, X = h * E - d * g, Q = f * E - d * y;\n let P = R * Q - B * X + C * k + M * L - b * v + O * F;\n return P ? (P = 1 / P, e[0] = (a * Q - c * X + u * k) * P, e[1] = (r * X - s * Q - i * k) * P, e[2] = (g * O - y * b + E * M) * P, e[3] = (f * b - h * O - d * M) * P, e[4] = (c * L - o * Q - u * v) * P, e[5] = (n * Q - r * L + i * v) * P, e[6] = (y * C - m * O - E * B) * P, e[7] = (l * O - f * C + d * B) * P, e[8] = (o * X - a * L + u * F) * P, e[9] = (s * L - n * X - i * F) * P, e[10] = (m * b - g * C + E * R) * P, e[11] = (h * C - l * b - d * R) * P, e[12] = (a * v - o * k - c * F) * P, e[13] = (n * k - s * v + r * F) * P, e[14] = (g * B - m * M - y * R) * P, e[15] = (l * M - h * B + f * R) * P, e) : null;\n}\nfunction Uh(e) {\n const t = e[0], n = e[1], s = e[2], r = e[3], i = e[4], o = e[5], a = e[6], c = e[7], u = e[8], l = e[9], h = e[10], f = e[11], d = e[12], m = e[13], g = e[14], y = e[15], E = t * o - n * i, R = t * a - s * i, B = n * a - s * o, C = u * m - l * d, M = u * g - h * d, b = l * g - h * m, O = t * b - n * M + s * C, F = i * b - o * M + a * C, v = u * B - l * R + h * E, L = d * B - m * R + g * E;\n return c * O - r * F + y * v - f * L;\n}\nfunction mi(e, t, n) {\n const s = t[0], r = t[1], i = t[2], o = t[3], a = t[4], c = t[5], u = t[6], l = t[7], h = t[8], f = t[9], d = t[10], m = t[11], g = t[12], y = t[13], E = t[14], R = t[15];\n let B = n[0], C = n[1], M = n[2], b = n[3];\n return e[0] = B * s + C * a + M * h + b * g, e[1] = B * r + C * c + M * f + b * y, e[2] = B * i + C * u + M * d + b * E, e[3] = B * o + C * l + M * m + b * R, B = n[4], C = n[5], M = n[6], b = n[7], e[4] = B * s + C * a + M * h + b * g, e[5] = B * r + C * c + M * f + b * y, e[6] = B * i + C * u + M * d + b * E, e[7] = B * o + C * l + M * m + b * R, B = n[8], C = n[9], M = n[10], b = n[11], e[8] = B * s + C * a + M * h + b * g, e[9] = B * r + C * c + M * f + b * y, e[10] = B * i + C * u + M * d + b * E, e[11] = B * o + C * l + M * m + b * R, B = n[12], C = n[13], M = n[14], b = n[15], e[12] = B * s + C * a + M * h + b * g, e[13] = B * r + C * c + M * f + b * y, e[14] = B * i + C * u + M * d + b * E, e[15] = B * o + C * l + M * m + b * R, e;\n}\nfunction Hh(e, t, n) {\n const s = n[0], r = n[1], i = n[2];\n let o, a, c, u, l, h, f, d, m, g, y, E;\n return t === e ? (e[12] = t[0] * s + t[4] * r + t[8] * i + t[12], e[13] = t[1] * s + t[5] * r + t[9] * i + t[13], e[14] = t[2] * s + t[6] * r + t[10] * i + t[14], e[15] = t[3] * s + t[7] * r + t[11] * i + t[15]) : (o = t[0], a = t[1], c = t[2], u = t[3], l = t[4], h = t[5], f = t[6], d = t[7], m = t[8], g = t[9], y = t[10], E = t[11], e[0] = o, e[1] = a, e[2] = c, e[3] = u, e[4] = l, e[5] = h, e[6] = f, e[7] = d, e[8] = m, e[9] = g, e[10] = y, e[11] = E, e[12] = o * s + l * r + m * i + t[12], e[13] = a * s + h * r + g * i + t[13], e[14] = c * s + f * r + y * i + t[14], e[15] = u * s + d * r + E * i + t[15]), e;\n}\nfunction Jh(e, t, n) {\n const s = n[0], r = n[1], i = n[2];\n return e[0] = t[0] * s, e[1] = t[1] * s, e[2] = t[2] * s, e[3] = t[3] * s, e[4] = t[4] * r, e[5] = t[5] * r, e[6] = t[6] * r, e[7] = t[7] * r, e[8] = t[8] * i, e[9] = t[9] * i, e[10] = t[10] * i, e[11] = t[11] * i, e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e;\n}\nfunction Vh(e, t, n, s) {\n let r = s[0], i = s[1], o = s[2], a = Math.sqrt(r * r + i * i + o * o), c, u, l, h, f, d, m, g, y, E, R, B, C, M, b, O, F, v, L, k, X, Q, P, at;\n return a < Fe ? null : (a = 1 / a, r *= a, i *= a, o *= a, u = Math.sin(n), c = Math.cos(n), l = 1 - c, h = t[0], f = t[1], d = t[2], m = t[3], g = t[4], y = t[5], E = t[6], R = t[7], B = t[8], C = t[9], M = t[10], b = t[11], O = r * r * l + c, F = i * r * l + o * u, v = o * r * l - i * u, L = r * i * l - o * u, k = i * i * l + c, X = o * i * l + r * u, Q = r * o * l + i * u, P = i * o * l - r * u, at = o * o * l + c, e[0] = h * O + g * F + B * v, e[1] = f * O + y * F + C * v, e[2] = d * O + E * F + M * v, e[3] = m * O + R * F + b * v, e[4] = h * L + g * k + B * X, e[5] = f * L + y * k + C * X, e[6] = d * L + E * k + M * X, e[7] = m * L + R * k + b * X, e[8] = h * Q + g * P + B * at, e[9] = f * Q + y * P + C * at, e[10] = d * Q + E * P + M * at, e[11] = m * Q + R * P + b * at, t !== e && (e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e);\n}\nfunction jh(e, t, n) {\n const s = Math.sin(n), r = Math.cos(n), i = t[4], o = t[5], a = t[6], c = t[7], u = t[8], l = t[9], h = t[10], f = t[11];\n return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = i * r + u * s, e[5] = o * r + l * s, e[6] = a * r + h * s, e[7] = c * r + f * s, e[8] = u * r - i * s, e[9] = l * r - o * s, e[10] = h * r - a * s, e[11] = f * r - c * s, e;\n}\nfunction kh(e, t, n) {\n const s = Math.sin(n), r = Math.cos(n), i = t[0], o = t[1], a = t[2], c = t[3], u = t[8], l = t[9], h = t[10], f = t[11];\n return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = i * r - u * s, e[1] = o * r - l * s, e[2] = a * r - h * s, e[3] = c * r - f * s, e[8] = i * s + u * r, e[9] = o * s + l * r, e[10] = a * s + h * r, e[11] = c * s + f * r, e;\n}\nfunction Kh(e, t, n) {\n const s = Math.sin(n), r = Math.cos(n), i = t[0], o = t[1], a = t[2], c = t[3], u = t[4], l = t[5], h = t[6], f = t[7];\n return t !== e && (e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = i * r + u * s, e[1] = o * r + l * s, e[2] = a * r + h * s, e[3] = c * r + f * s, e[4] = u * r - i * s, e[5] = l * r - o * s, e[6] = h * r - a * s, e[7] = f * r - c * s, e;\n}\nfunction zh(e, t) {\n const n = t[0], s = t[1], r = t[2], i = t[4], o = t[5], a = t[6], c = t[8], u = t[9], l = t[10];\n return e[0] = Math.sqrt(n * n + s * s + r * r), e[1] = Math.sqrt(i * i + o * o + a * a), e[2] = Math.sqrt(c * c + u * u + l * l), e;\n}\nfunction Wh(e, t) {\n const n = t[0], s = t[1], r = t[2], i = t[3], o = n + n, a = s + s, c = r + r, u = n * o, l = s * o, h = s * a, f = r * o, d = r * a, m = r * c, g = i * o, y = i * a, E = i * c;\n return e[0] = 1 - h - m, e[1] = l + E, e[2] = f - y, e[3] = 0, e[4] = l - E, e[5] = 1 - u - m, e[6] = d + g, e[7] = 0, e[8] = f + y, e[9] = d - g, e[10] = 1 - u - h, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;\n}\nfunction Xh(e, t, n, s, r, i, o) {\n const a = 1 / (n - t), c = 1 / (r - s), u = 1 / (i - o);\n return e[0] = i * 2 * a, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = i * 2 * c, e[6] = 0, e[7] = 0, e[8] = (n + t) * a, e[9] = (r + s) * c, e[10] = (o + i) * u, e[11] = -1, e[12] = 0, e[13] = 0, e[14] = o * i * 2 * u, e[15] = 0, e;\n}\nfunction Qh(e, t, n, s, r) {\n const i = 1 / Math.tan(t / 2);\n if (e[0] = i / n, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = i, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, r != null && r !== 1 / 0) {\n const o = 1 / (s - r);\n e[10] = (r + s) * o, e[14] = 2 * r * s * o;\n } else\n e[10] = -1, e[14] = -2 * s;\n return e;\n}\nconst qh = Qh;\nfunction Yh(e, t, n, s, r, i, o) {\n const a = 1 / (t - n), c = 1 / (s - r), u = 1 / (i - o);\n return e[0] = -2 * a, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = -2 * c, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 2 * u, e[11] = 0, e[12] = (t + n) * a, e[13] = (r + s) * c, e[14] = (o + i) * u, e[15] = 1, e;\n}\nconst $h = Yh;\nfunction Zh(e, t, n, s) {\n let r, i, o, a, c, u, l, h, f, d;\n const m = t[0], g = t[1], y = t[2], E = s[0], R = s[1], B = s[2], C = n[0], M = n[1], b = n[2];\n return Math.abs(m - C) < Fe && Math.abs(g - M) < Fe && Math.abs(y - b) < Fe ? Ph(e) : (h = m - C, f = g - M, d = y - b, r = 1 / Math.sqrt(h * h + f * f + d * d), h *= r, f *= r, d *= r, i = R * d - B * f, o = B * h - E * d, a = E * f - R * h, r = Math.sqrt(i * i + o * o + a * a), r ? (r = 1 / r, i *= r, o *= r, a *= r) : (i = 0, o = 0, a = 0), c = f * a - d * o, u = d * i - h * a, l = h * o - f * i, r = Math.sqrt(c * c + u * u + l * l), r ? (r = 1 / r, c *= r, u *= r, l *= r) : (c = 0, u = 0, l = 0), e[0] = i, e[1] = c, e[2] = h, e[3] = 0, e[4] = o, e[5] = u, e[6] = f, e[7] = 0, e[8] = a, e[9] = l, e[10] = d, e[11] = 0, e[12] = -(i * m + o * g + a * y), e[13] = -(c * m + u * g + l * y), e[14] = -(h * m + f * g + d * y), e[15] = 1, e);\n}\nfunction tf() {\n const e = new It(4);\n return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0), e;\n}\nfunction ef(e, t, n) {\n return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e;\n}\nfunction nf(e, t, n) {\n return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e;\n}\nfunction sf(e) {\n const t = e[0], n = e[1], s = e[2], r = e[3];\n return Math.sqrt(t * t + n * n + s * s + r * r);\n}\nfunction rf(e) {\n const t = e[0], n = e[1], s = e[2], r = e[3];\n return t * t + n * n + s * s + r * r;\n}\nfunction of(e, t) {\n const n = t[0], s = t[1], r = t[2], i = t[3];\n let o = n * n + s * s + r * r + i * i;\n return o > 0 && (o = 1 / Math.sqrt(o)), e[0] = n * o, e[1] = s * o, e[2] = r * o, e[3] = i * o, e;\n}\nfunction af(e, t) {\n return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3];\n}\nfunction cf(e, t, n, s) {\n const r = t[0], i = t[1], o = t[2], a = t[3];\n return e[0] = r + s * (n[0] - r), e[1] = i + s * (n[1] - i), e[2] = o + s * (n[2] - o), e[3] = a + s * (n[3] - a), e;\n}\nfunction uf(e, t, n) {\n const s = t[0], r = t[1], i = t[2], o = t[3];\n return e[0] = n[0] * s + n[4] * r + n[8] * i + n[12] * o, e[1] = n[1] * s + n[5] * r + n[9] * i + n[13] * o, e[2] = n[2] * s + n[6] * r + n[10] * i + n[14] * o, e[3] = n[3] * s + n[7] * r + n[11] * i + n[15] * o, e;\n}\nfunction lf(e, t, n) {\n const s = t[0], r = t[1], i = t[2], o = n[0], a = n[1], c = n[2], u = n[3], l = u * s + a * i - c * r, h = u * r + c * s - o * i, f = u * i + o * r - a * s, d = -o * s - a * r - c * i;\n return e[0] = l * u + d * -o + h * -c - f * -a, e[1] = h * u + d * -a + f * -o - l * -c, e[2] = f * u + d * -c + l * -a - h * -o, e[3] = t[3], e;\n}\n(function() {\n const e = tf();\n return function(t, n, s, r, i, o) {\n let a, c;\n for (n || (n = 4), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n)\n e[0] = t[a], e[1] = t[a + 1], e[2] = t[a + 2], e[3] = t[a + 3], i(e, e, o), t[a] = e[0], t[a + 1] = e[1], t[a + 2] = e[2], t[a + 3] = e[3];\n return t;\n };\n})();\nvar Ks;\n(function(e) {\n e[e.COL0ROW0 = 0] = \"COL0ROW0\", e[e.COL0ROW1 = 1] = \"COL0ROW1\", e[e.COL0ROW2 = 2] = \"COL0ROW2\", e[e.COL0ROW3 = 3] = \"COL0ROW3\", e[e.COL1ROW0 = 4] = \"COL1ROW0\", e[e.COL1ROW1 = 5] = \"COL1ROW1\", e[e.COL1ROW2 = 6] = \"COL1ROW2\", e[e.COL1ROW3 = 7] = \"COL1ROW3\", e[e.COL2ROW0 = 8] = \"COL2ROW0\", e[e.COL2ROW1 = 9] = \"COL2ROW1\", e[e.COL2ROW2 = 10] = \"COL2ROW2\", e[e.COL2ROW3 = 11] = \"COL2ROW3\", e[e.COL3ROW0 = 12] = \"COL3ROW0\", e[e.COL3ROW1 = 13] = \"COL3ROW1\", e[e.COL3ROW2 = 14] = \"COL3ROW2\", e[e.COL3ROW3 = 15] = \"COL3ROW3\";\n})(Ks || (Ks = {}));\nconst hf = 45 * Math.PI / 180, ff = 1, ds = 0.1, ms = 500, df = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);\nclass V extends _a {\n static get IDENTITY() {\n return gf();\n }\n static get ZERO() {\n return mf();\n }\n get ELEMENTS() {\n return 16;\n }\n get RANK() {\n return 4;\n }\n get INDICES() {\n return Ks;\n }\n constructor(t) {\n super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0), arguments.length === 1 && Array.isArray(t) ? this.copy(t) : this.identity();\n }\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this[4] = t[4], this[5] = t[5], this[6] = t[6], this[7] = t[7], this[8] = t[8], this[9] = t[9], this[10] = t[10], this[11] = t[11], this[12] = t[12], this[13] = t[13], this[14] = t[14], this[15] = t[15], this.check();\n }\n set(t, n, s, r, i, o, a, c, u, l, h, f, d, m, g, y) {\n return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this[4] = i, this[5] = o, this[6] = a, this[7] = c, this[8] = u, this[9] = l, this[10] = h, this[11] = f, this[12] = d, this[13] = m, this[14] = g, this[15] = y, this.check();\n }\n setRowMajor(t, n, s, r, i, o, a, c, u, l, h, f, d, m, g, y) {\n return this[0] = t, this[1] = i, this[2] = u, this[3] = d, this[4] = n, this[5] = o, this[6] = l, this[7] = m, this[8] = s, this[9] = a, this[10] = h, this[11] = g, this[12] = r, this[13] = c, this[14] = f, this[15] = y, this.check();\n }\n toRowMajor(t) {\n return t[0] = this[0], t[1] = this[4], t[2] = this[8], t[3] = this[12], t[4] = this[1], t[5] = this[5], t[6] = this[9], t[7] = this[13], t[8] = this[2], t[9] = this[6], t[10] = this[10], t[11] = this[14], t[12] = this[3], t[13] = this[7], t[14] = this[11], t[15] = this[15], t;\n }\n identity() {\n return this.copy(df);\n }\n fromObject(t) {\n return this.check();\n }\n fromQuaternion(t) {\n return Wh(this, t), this.check();\n }\n frustum(t) {\n const {\n left: n,\n right: s,\n bottom: r,\n top: i,\n near: o = ds,\n far: a = ms\n } = t;\n return a === 1 / 0 ? Af(this, n, s, r, i, o) : Xh(this, n, s, r, i, o, a), this.check();\n }\n lookAt(t) {\n const {\n eye: n,\n center: s = [0, 0, 0],\n up: r = [0, 1, 0]\n } = t;\n return Zh(this, n, s, r), this.check();\n }\n ortho(t) {\n const {\n left: n,\n right: s,\n bottom: r,\n top: i,\n near: o = ds,\n far: a = ms\n } = t;\n return $h(this, n, s, r, i, o, a), this.check();\n }\n orthographic(t) {\n const {\n fovy: n = hf,\n aspect: s = ff,\n focalDistance: r = 1,\n near: i = ds,\n far: o = ms\n } = t;\n gi(n);\n const a = n / 2, c = r * Math.tan(a), u = c * s;\n return this.ortho({\n left: -u,\n right: u,\n bottom: -c,\n top: c,\n near: i,\n far: o\n });\n }\n perspective(t) {\n const {\n fovy: n = 45 * Math.PI / 180,\n aspect: s = 1,\n near: r = 0.1,\n far: i = 500\n } = t;\n return gi(n), qh(this, n, s, r, i), this.check();\n }\n determinant() {\n return Uh(this);\n }\n getScale(t = [-0, -0, -0]) {\n return t[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]), t[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]), t[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]), t;\n }\n getTranslation(t = [-0, -0, -0]) {\n return t[0] = this[12], t[1] = this[13], t[2] = this[14], t;\n }\n getRotation(t, n) {\n t = t || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0], n = n || [-0, -0, -0];\n const s = this.getScale(n), r = 1 / s[0], i = 1 / s[1], o = 1 / s[2];\n return t[0] = this[0] * r, t[1] = this[1] * i, t[2] = this[2] * o, t[3] = 0, t[4] = this[4] * r, t[5] = this[5] * i, t[6] = this[6] * o, t[7] = 0, t[8] = this[8] * r, t[9] = this[9] * i, t[10] = this[10] * o, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t;\n }\n getRotationMatrix3(t, n) {\n t = t || [-0, -0, -0, -0, -0, -0, -0, -0, -0], n = n || [-0, -0, -0];\n const s = this.getScale(n), r = 1 / s[0], i = 1 / s[1], o = 1 / s[2];\n return t[0] = this[0] * r, t[1] = this[1] * i, t[2] = this[2] * o, t[3] = this[4] * r, t[4] = this[5] * i, t[5] = this[6] * o, t[6] = this[8] * r, t[7] = this[9] * i, t[8] = this[10] * o, t;\n }\n transpose() {\n return Gh(this, this), this.check();\n }\n invert() {\n return Nh(this, this), this.check();\n }\n multiplyLeft(t) {\n return mi(this, t, this), this.check();\n }\n multiplyRight(t) {\n return mi(this, this, t), this.check();\n }\n rotateX(t) {\n return jh(this, this, t), this.check();\n }\n rotateY(t) {\n return kh(this, this, t), this.check();\n }\n rotateZ(t) {\n return Kh(this, this, t), this.check();\n }\n rotateXYZ(t) {\n return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2]);\n }\n rotateAxis(t, n) {\n return Vh(this, this, t, n), this.check();\n }\n scale(t) {\n return Jh(this, this, Array.isArray(t) ? t : [t, t, t]), this.check();\n }\n translate(t) {\n return Hh(this, this, t), this.check();\n }\n transform(t, n) {\n return t.length === 4 ? (n = uf(n || [-0, -0, -0, -0], t, this), Oe(n, 4), n) : this.transformAsPoint(t, n);\n }\n transformAsPoint(t, n) {\n const {\n length: s\n } = t;\n let r;\n switch (s) {\n case 2:\n r = Aa(n || [-0, -0], t, this);\n break;\n case 3:\n r = Er(n || [-0, -0, -0], t, this);\n break;\n default:\n throw new Error(\"Illegal vector\");\n }\n return Oe(r, t.length), r;\n }\n transformAsVector(t, n) {\n let s;\n switch (t.length) {\n case 2:\n s = pa(n || [-0, -0], t, this);\n break;\n case 3:\n s = ya(n || [-0, -0, -0], t, this);\n break;\n default:\n throw new Error(\"Illegal vector\");\n }\n return Oe(s, t.length), s;\n }\n transformPoint(t, n) {\n return this.transformAsPoint(t, n);\n }\n transformVector(t, n) {\n return this.transformAsPoint(t, n);\n }\n transformDirection(t, n) {\n return this.transformAsVector(t, n);\n }\n makeRotationX(t) {\n return this.identity().rotateX(t);\n }\n makeTranslation(t, n, s) {\n return this.identity().translate([t, n, s]);\n }\n}\nlet rn, on;\nfunction mf() {\n return rn || (rn = new V([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), Object.freeze(rn)), rn;\n}\nfunction gf() {\n return on || (on = new V(), Object.freeze(on)), on;\n}\nfunction gi(e) {\n if (e > Math.PI * 2)\n throw Error(\"expected radians\");\n}\nfunction Af(e, t, n, s, r, i) {\n const o = 2 * i / (n - t), a = 2 * i / (r - s), c = (n + t) / (n - t), u = (r + s) / (r - s), l = -1, h = -1, f = -2 * i;\n return e[0] = o, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a, e[6] = 0, e[7] = 0, e[8] = c, e[9] = u, e[10] = l, e[11] = h, e[12] = 0, e[13] = 0, e[14] = f, e[15] = 0, e;\n}\nfunction Ai() {\n const e = new It(4);\n return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e[3] = 1, e;\n}\nfunction pf(e) {\n return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e;\n}\nfunction wa(e, t, n) {\n n = n * 0.5;\n const s = Math.sin(n);\n return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = Math.cos(n), e;\n}\nfunction pi(e, t, n) {\n const s = t[0], r = t[1], i = t[2], o = t[3], a = n[0], c = n[1], u = n[2], l = n[3];\n return e[0] = s * l + o * a + r * u - i * c, e[1] = r * l + o * c + i * a - s * u, e[2] = i * l + o * u + s * c - r * a, e[3] = o * l - s * a - r * c - i * u, e;\n}\nfunction yf(e, t, n) {\n n *= 0.5;\n const s = t[0], r = t[1], i = t[2], o = t[3], a = Math.sin(n), c = Math.cos(n);\n return e[0] = s * c + o * a, e[1] = r * c + i * a, e[2] = i * c - r * a, e[3] = o * c - s * a, e;\n}\nfunction Bf(e, t, n) {\n n *= 0.5;\n const s = t[0], r = t[1], i = t[2], o = t[3], a = Math.sin(n), c = Math.cos(n);\n return e[0] = s * c - i * a, e[1] = r * c + o * a, e[2] = i * c + s * a, e[3] = o * c - r * a, e;\n}\nfunction Cf(e, t, n) {\n n *= 0.5;\n const s = t[0], r = t[1], i = t[2], o = t[3], a = Math.sin(n), c = Math.cos(n);\n return e[0] = s * c + r * a, e[1] = r * c - s * a, e[2] = i * c + o * a, e[3] = o * c - i * a, e;\n}\nfunction Ef(e, t) {\n const n = t[0], s = t[1], r = t[2];\n return e[0] = n, e[1] = s, e[2] = r, e[3] = Math.sqrt(Math.abs(1 - n * n - s * s - r * r)), e;\n}\nfunction bn(e, t, n, s) {\n const r = t[0], i = t[1], o = t[2], a = t[3];\n let c = n[0], u = n[1], l = n[2], h = n[3], f, d, m, g, y;\n return f = r * c + i * u + o * l + a * h, f < 0 && (f = -f, c = -c, u = -u, l = -l, h = -h), 1 - f > Fe ? (d = Math.acos(f), y = Math.sin(d), m = Math.sin((1 - s) * d) / y, g = Math.sin(s * d) / y) : (m = 1 - s, g = s), e[0] = m * r + g * c, e[1] = m * i + g * u, e[2] = m * o + g * l, e[3] = m * a + g * h, e;\n}\nfunction Tf(e, t) {\n const n = t[0], s = t[1], r = t[2], i = t[3], o = n * n + s * s + r * r + i * i, a = o ? 1 / o : 0;\n return e[0] = -n * a, e[1] = -s * a, e[2] = -r * a, e[3] = i * a, e;\n}\nfunction bf(e, t) {\n return e[0] = -t[0], e[1] = -t[1], e[2] = -t[2], e[3] = t[3], e;\n}\nfunction Ra(e, t) {\n const n = t[0] + t[4] + t[8];\n let s;\n if (n > 0)\n s = Math.sqrt(n + 1), e[3] = 0.5 * s, s = 0.5 / s, e[0] = (t[5] - t[7]) * s, e[1] = (t[6] - t[2]) * s, e[2] = (t[1] - t[3]) * s;\n else {\n let r = 0;\n t[4] > t[0] && (r = 1), t[8] > t[r * 3 + r] && (r = 2);\n const i = (r + 1) % 3, o = (r + 2) % 3;\n s = Math.sqrt(t[r * 3 + r] - t[i * 3 + i] - t[o * 3 + o] + 1), e[r] = 0.5 * s, s = 0.5 / s, e[3] = (t[i * 3 + o] - t[o * 3 + i]) * s, e[i] = (t[i * 3 + r] + t[r * 3 + i]) * s, e[o] = (t[o * 3 + r] + t[r * 3 + o]) * s;\n }\n return e;\n}\nconst _f = ef, wf = nf, Rf = af, Mf = cf, Sf = sf, If = rf, Ma = of, xf = function() {\n const e = Ca(), t = hi(1, 0, 0), n = hi(0, 1, 0);\n return function(s, r, i) {\n const o = Cr(r, i);\n return o < -0.999999 ? (Tn(e, t, r), wh(e) < 1e-6 && Tn(e, n, r), Ch(e, e), wa(s, e, Math.PI), s) : o > 0.999999 ? (s[0] = 0, s[1] = 0, s[2] = 0, s[3] = 1, s) : (Tn(e, r, i), s[0] = e[0], s[1] = e[1], s[2] = e[2], s[3] = 1 + o, Ma(s, s));\n };\n}();\n(function() {\n const e = Ai(), t = Ai();\n return function(n, s, r, i, o, a) {\n return bn(e, s, o, a), bn(t, r, i, a), bn(n, e, t, 2 * a * (1 - a)), n;\n };\n})();\n(function() {\n const e = Rh();\n return function(t, n, s, r) {\n return e[0] = s[0], e[3] = s[1], e[6] = s[2], e[1] = r[0], e[4] = r[1], e[7] = r[2], e[2] = -n[0], e[5] = -n[1], e[8] = -n[2], Ma(t, Ra(t, e));\n };\n})();\nconst vf = [0, 0, 0, 1];\nclass On extends yr {\n constructor(t = 0, n = 0, s = 0, r = 1) {\n super(-0, -0, -0, -0), Array.isArray(t) && arguments.length === 1 ? this.copy(t) : this.set(t, n, s, r);\n }\n copy(t) {\n return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this.check();\n }\n set(t, n, s, r) {\n return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this.check();\n }\n fromObject(t) {\n return this[0] = t.x, this[1] = t.y, this[2] = t.z, this[3] = t.w, this.check();\n }\n fromMatrix3(t) {\n return Ra(this, t), this.check();\n }\n fromAxisRotation(t, n) {\n return wa(this, t, n), this.check();\n }\n identity() {\n return pf(this), this.check();\n }\n setAxisAngle(t, n) {\n return this.fromAxisRotation(t, n);\n }\n get ELEMENTS() {\n return 4;\n }\n get x() {\n return this[0];\n }\n set x(t) {\n this[0] = U(t);\n }\n get y() {\n return this[1];\n }\n set y(t) {\n this[1] = U(t);\n }\n get z() {\n return this[2];\n }\n set z(t) {\n this[2] = U(t);\n }\n get w() {\n return this[3];\n }\n set w(t) {\n this[3] = U(t);\n }\n len() {\n return Sf(this);\n }\n lengthSquared() {\n return If(this);\n }\n dot(t) {\n return Rf(this, t);\n }\n rotationTo(t, n) {\n return xf(this, t, n), this.check();\n }\n add(t) {\n return _f(this, this, t), this.check();\n }\n calculateW() {\n return Ef(this, this), this.check();\n }\n conjugate() {\n return bf(this, this), this.check();\n }\n invert() {\n return Tf(this, this), this.check();\n }\n lerp(t, n, s) {\n return s === void 0 ? this.lerp(this, t, n) : (Mf(this, t, n, s), this.check());\n }\n multiplyRight(t) {\n return pi(this, this, t), this.check();\n }\n multiplyLeft(t) {\n return pi(this, t, this), this.check();\n }\n normalize() {\n const t = this.len(), n = t > 0 ? 1 / t : 0;\n return this[0] = this[0] * n, this[1] = this[1] * n, this[2] = this[2] * n, this[3] = this[3] * n, t === 0 && (this[3] = 1), this.check();\n }\n rotateX(t) {\n return yf(this, this, t), this.check();\n }\n rotateY(t) {\n return Bf(this, this, t), this.check();\n }\n rotateZ(t) {\n return Cf(this, this, t), this.check();\n }\n scale(t) {\n return wf(this, this, t), this.check();\n }\n slerp(t, n, s) {\n let r, i, o;\n switch (arguments.length) {\n case 1:\n ({\n start: r = vf,\n target: i,\n ratio: o\n } = t);\n break;\n case 2:\n r = this, i = t, o = n;\n break;\n default:\n r = t, i = n, o = s;\n }\n return bn(this, r, i, o), this.check();\n }\n transformVector4(t, n = new Tr()) {\n return lf(n, t, this), Oe(n, 4);\n }\n lengthSq() {\n return this.lengthSquared();\n }\n setFromAxisAngle(t, n) {\n return this.setAxisAngle(t, n);\n }\n premultiply(t) {\n return this.multiplyLeft(t);\n }\n multiply(t) {\n return this.multiplyRight(t);\n }\n}\nfunction Ne(e) {\n \"@babel/helpers - typeof\";\n return Ne = typeof Symbol == \"function\" && typeof Symbol.iterator == \"symbol\" ? function(t) {\n return typeof t;\n } : function(t) {\n return t && typeof Symbol == \"function\" && t.constructor === Symbol && t !== Symbol.prototype ? \"symbol\" : typeof t;\n }, Ne(e);\n}\nfunction Of(e, t) {\n if (Ne(e) != \"object\" || !e)\n return e;\n var n = e[Symbol.toPrimitive];\n if (n !== void 0) {\n var s = n.call(e, t || \"default\");\n if (Ne(s) != \"object\")\n return s;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (t === \"string\" ? String : Number)(e);\n}\nfunction Ff(e) {\n var t = Of(e, \"string\");\n return Ne(t) == \"symbol\" ? t : String(t);\n}\nfunction x(e, t, n) {\n return t = Ff(t), t in e ? Object.defineProperty(e, t, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[t] = n, e;\n}\nconst Df = 0.1, Lf = 1e-12, Sa = 1e-15, Pf = 1e-20, Gf = 6378137, Nf = 6378137, Uf = 6356752314245179e-9;\nfunction Xn(e) {\n return e;\n}\nnew A();\nfunction Hf(e, t = [], n = Xn) {\n return \"longitude\" in e ? (t[0] = n(e.longitude), t[1] = n(e.latitude), t[2] = e.height) : \"x\" in e ? (t[0] = n(e.x), t[1] = n(e.y), t[2] = e.z) : (t[0] = n(e[0]), t[1] = n(e[1]), t[2] = e[2]), t;\n}\nfunction Jf(e, t = []) {\n return Hf(e, t, Z._cartographicRadians ? Xn : ah);\n}\nfunction Vf(e, t, n = Xn) {\n return \"longitude\" in t ? (t.longitude = n(e[0]), t.latitude = n(e[1]), t.height = e[2]) : \"x\" in t ? (t.x = n(e[0]), t.y = n(e[1]), t.z = e[2]) : (t[0] = n(e[0]), t[1] = n(e[1]), t[2] = e[2]), t;\n}\nfunction jf(e, t) {\n return Vf(e, t, Z._cartographicRadians ? Xn : ch);\n}\nconst yi = 1e-14, kf = new A(), Bi = {\n up: {\n south: \"east\",\n north: \"west\",\n west: \"south\",\n east: \"north\"\n },\n down: {\n south: \"west\",\n north: \"east\",\n west: \"north\",\n east: \"south\"\n },\n south: {\n up: \"west\",\n down: \"east\",\n west: \"down\",\n east: \"up\"\n },\n north: {\n up: \"east\",\n down: \"west\",\n west: \"up\",\n east: \"down\"\n },\n west: {\n up: \"north\",\n down: \"south\",\n north: \"down\",\n south: \"up\"\n },\n east: {\n up: \"south\",\n down: \"north\",\n north: \"up\",\n south: \"down\"\n }\n}, gs = {\n north: [-1, 0, 0],\n east: [0, 1, 0],\n up: [0, 0, 1],\n south: [1, 0, 0],\n west: [0, -1, 0],\n down: [0, 0, -1]\n}, Te = {\n east: new A(),\n north: new A(),\n up: new A(),\n west: new A(),\n south: new A(),\n down: new A()\n}, Kf = new A(), zf = new A(), Wf = new A();\nfunction Ci(e, t, n, s, r, i) {\n const o = Bi[t] && Bi[t][n];\n j(o && (!s || s === o));\n let a, c, u;\n const l = kf.copy(r);\n if (Kt(l.x, 0, yi) && Kt(l.y, 0, yi)) {\n const f = Math.sign(l.z);\n a = Kf.fromArray(gs[t]), t !== \"east\" && t !== \"west\" && a.scale(f), c = zf.fromArray(gs[n]), n !== \"east\" && n !== \"west\" && c.scale(f), u = Wf.fromArray(gs[s]), s !== \"east\" && s !== \"west\" && u.scale(f);\n } else {\n const {\n up: f,\n east: d,\n north: m\n } = Te;\n d.set(-l.y, l.x, 0).normalize(), e.geodeticSurfaceNormal(l, f), m.copy(f).cross(d);\n const {\n down: g,\n west: y,\n south: E\n } = Te;\n g.copy(f).scale(-1), y.copy(d).scale(-1), E.copy(m).scale(-1), a = Te[t], c = Te[n], u = Te[s];\n }\n return i[0] = a.x, i[1] = a.y, i[2] = a.z, i[3] = 0, i[4] = c.x, i[5] = c.y, i[6] = c.z, i[7] = 0, i[8] = u.x, i[9] = u.y, i[10] = u.z, i[11] = 0, i[12] = l.x, i[13] = l.y, i[14] = l.z, i[15] = 1, i;\n}\nconst ue = new A(), Xf = new A(), Qf = new A();\nfunction qf(e, t, n = []) {\n const {\n oneOverRadii: s,\n oneOverRadiiSquared: r,\n centerToleranceSquared: i\n } = t;\n ue.from(e);\n const o = ue.x, a = ue.y, c = ue.z, u = s.x, l = s.y, h = s.z, f = o * o * u * u, d = a * a * l * l, m = c * c * h * h, g = f + d + m, y = Math.sqrt(1 / g);\n if (!Number.isFinite(y))\n return;\n const E = Xf;\n if (E.copy(e).scale(y), g < i)\n return E.to(n);\n const R = r.x, B = r.y, C = r.z, M = Qf;\n M.set(E.x * R * 2, E.y * B * 2, E.z * C * 2);\n let b = (1 - y) * ue.len() / (0.5 * M.len()), O = 0, F, v, L, k;\n do {\n b -= O, F = 1 / (1 + b * R), v = 1 / (1 + b * B), L = 1 / (1 + b * C);\n const X = F * F, Q = v * v, P = L * L, at = X * F, Wt = Q * v, oe = P * L;\n k = f * X + d * Q + m * P - 1;\n const Lt = -2 * (f * at * R + d * Wt * B + m * oe * C);\n O = k / Lt;\n } while (Math.abs(k) > Lf);\n return ue.scale([F, v, L]).to(n);\n}\nconst an = new A(), Ei = new A(), Yf = new A(), wt = new A(), $f = new A(), cn = new A();\nclass J {\n constructor(t = 0, n = 0, s = 0) {\n x(this, \"radii\", void 0), x(this, \"radiiSquared\", void 0), x(this, \"radiiToTheFourth\", void 0), x(this, \"oneOverRadii\", void 0), x(this, \"oneOverRadiiSquared\", void 0), x(this, \"minimumRadius\", void 0), x(this, \"maximumRadius\", void 0), x(this, \"centerToleranceSquared\", Df), x(this, \"squaredXOverSquaredZ\", void 0), j(t >= 0), j(n >= 0), j(s >= 0), this.radii = new A(t, n, s), this.radiiSquared = new A(t * t, n * n, s * s), this.radiiToTheFourth = new A(t * t * t * t, n * n * n * n, s * s * s * s), this.oneOverRadii = new A(t === 0 ? 0 : 1 / t, n === 0 ? 0 : 1 / n, s === 0 ? 0 : 1 / s), this.oneOverRadiiSquared = new A(t === 0 ? 0 : 1 / (t * t), n === 0 ? 0 : 1 / (n * n), s === 0 ? 0 : 1 / (s * s)), this.minimumRadius = Math.min(t, n, s), this.maximumRadius = Math.max(t, n, s), this.radiiSquared.z !== 0 && (this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z), Object.freeze(this);\n }\n equals(t) {\n return this === t || !!(t && this.radii.equals(t.radii));\n }\n toString() {\n return this.radii.toString();\n }\n cartographicToCartesian(t, n = [0, 0, 0]) {\n const s = Ei, r = Yf, [, , i] = t;\n this.geodeticSurfaceNormalCartographic(t, s), r.copy(this.radiiSquared).scale(s);\n const o = Math.sqrt(s.dot(r));\n return r.scale(1 / o), s.scale(i), r.add(s), r.to(n);\n }\n cartesianToCartographic(t, n = [0, 0, 0]) {\n cn.from(t);\n const s = this.scaleToGeodeticSurface(cn, wt);\n if (!s)\n return;\n const r = this.geodeticSurfaceNormal(s, Ei), i = $f;\n i.copy(cn).subtract(s);\n const o = Math.atan2(r.y, r.x), a = Math.asin(r.z), c = Math.sign(Cr(i, cn)) * Ea(i);\n return jf([o, a, c], n);\n }\n eastNorthUpToFixedFrame(t, n = new V()) {\n return Ci(this, \"east\", \"north\", \"up\", t, n);\n }\n localFrameToFixedFrame(t, n, s, r, i = new V()) {\n return Ci(this, t, n, s, r, i);\n }\n geocentricSurfaceNormal(t, n = [0, 0, 0]) {\n return an.from(t).normalize().to(n);\n }\n geodeticSurfaceNormalCartographic(t, n = [0, 0, 0]) {\n const s = Jf(t), r = s[0], i = s[1], o = Math.cos(i);\n return an.set(o * Math.cos(r), o * Math.sin(r), Math.sin(i)).normalize(), an.to(n);\n }\n geodeticSurfaceNormal(t, n = [0, 0, 0]) {\n return an.from(t).scale(this.oneOverRadiiSquared).normalize().to(n);\n }\n scaleToGeodeticSurface(t, n) {\n return qf(t, this, n);\n }\n scaleToGeocentricSurface(t, n = [0, 0, 0]) {\n wt.from(t);\n const s = wt.x, r = wt.y, i = wt.z, o = this.oneOverRadiiSquared, a = 1 / Math.sqrt(s * s * o.x + r * r * o.y + i * i * o.z);\n return wt.multiplyScalar(a).to(n);\n }\n transformPositionToScaledSpace(t, n = [0, 0, 0]) {\n return wt.from(t).scale(this.oneOverRadii).to(n);\n }\n transformPositionFromScaledSpace(t, n = [0, 0, 0]) {\n return wt.from(t).scale(this.radii).to(n);\n }\n getSurfaceNormalIntersectionWithZAxis(t, n = 0, s = [0, 0, 0]) {\n j(Kt(this.radii.x, this.radii.y, Sa)), j(this.radii.z > 0), wt.from(t);\n const r = wt.z * (1 - this.squaredXOverSquaredZ);\n if (!(Math.abs(r) >= this.radii.z - n))\n return wt.set(0, 0, r).to(s);\n }\n}\nx(J, \"WGS84\", new J(Gf, Nf, Uf));\nconst pt = {\n OUTSIDE: -1,\n INTERSECTING: 0,\n INSIDE: 1\n};\nnew A();\nnew A();\nconst be = new A(), Ti = new A();\nclass Qe {\n constructor(t = [0, 0, 0], n = 0) {\n x(this, \"center\", void 0), x(this, \"radius\", void 0), this.radius = -0, this.center = new A(), this.fromCenterRadius(t, n);\n }\n fromCenterRadius(t, n) {\n return this.center.from(t), this.radius = n, this;\n }\n fromCornerPoints(t, n) {\n return n = be.from(n), this.center = new A().from(t).add(n).scale(0.5), this.radius = this.center.distance(n), this;\n }\n equals(t) {\n return this === t || !!t && this.center.equals(t.center) && this.radius === t.radius;\n }\n clone() {\n return new Qe(this.center, this.radius);\n }\n union(t) {\n const n = this.center, s = this.radius, r = t.center, i = t.radius, o = be.copy(r).subtract(n), a = o.magnitude();\n if (s >= a + i)\n return this.clone();\n if (i >= a + s)\n return t.clone();\n const c = (s + a + i) * 0.5;\n return Ti.copy(o).scale((-s + c) / a).add(n), this.center.copy(Ti), this.radius = c, this;\n }\n expand(t) {\n const s = be.from(t).subtract(this.center).magnitude();\n return s > this.radius && (this.radius = s), this;\n }\n transform(t) {\n this.center.transform(t);\n const n = zh(be, t);\n return this.radius = Math.max(n[0], Math.max(n[1], n[2])) * this.radius, this;\n }\n distanceSquaredTo(t) {\n const n = this.distanceTo(t);\n return n * n;\n }\n distanceTo(t) {\n const s = be.from(t).subtract(this.center);\n return Math.max(0, s.len() - this.radius);\n }\n intersectPlane(t) {\n const n = this.center, s = this.radius, i = t.normal.dot(n) + t.distance;\n return i < -s ? pt.OUTSIDE : i < s ? pt.INTERSECTING : pt.INSIDE;\n }\n}\nconst Zf = new A(), td = new A(), un = new A(), ln = new A(), hn = new A(), ed = new A(), nd = new A(), Gt = {\n COLUMN0ROW0: 0,\n COLUMN0ROW1: 1,\n COLUMN0ROW2: 2,\n COLUMN1ROW0: 3,\n COLUMN1ROW1: 4,\n COLUMN1ROW2: 5,\n COLUMN2ROW0: 6,\n COLUMN2ROW1: 7,\n COLUMN2ROW2: 8\n};\nclass qe {\n constructor(t = [0, 0, 0], n = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {\n x(this, \"center\", void 0), x(this, \"halfAxes\", void 0), this.center = new A().from(t), this.halfAxes = new W(n);\n }\n get halfSize() {\n const t = this.halfAxes.getColumn(0), n = this.halfAxes.getColumn(1), s = this.halfAxes.getColumn(2);\n return [new A(t).len(), new A(n).len(), new A(s).len()];\n }\n get quaternion() {\n const t = this.halfAxes.getColumn(0), n = this.halfAxes.getColumn(1), s = this.halfAxes.getColumn(2), r = new A(t).normalize(), i = new A(n).normalize(), o = new A(s).normalize();\n return new On().fromMatrix3(new W([...r, ...i, ...o]));\n }\n fromCenterHalfSizeQuaternion(t, n, s) {\n const r = new On(s), i = new W().fromQuaternion(r);\n return i[0] = i[0] * n[0], i[1] = i[1] * n[0], i[2] = i[2] * n[0], i[3] = i[3] * n[1], i[4] = i[4] * n[1], i[5] = i[5] * n[1], i[6] = i[6] * n[2], i[7] = i[7] * n[2], i[8] = i[8] * n[2], this.center = new A().from(t), this.halfAxes = i, this;\n }\n clone() {\n return new qe(this.center, this.halfAxes);\n }\n equals(t) {\n return this === t || !!t && this.center.equals(t.center) && this.halfAxes.equals(t.halfAxes);\n }\n getBoundingSphere(t = new Qe()) {\n const n = this.halfAxes, s = n.getColumn(0, un), r = n.getColumn(1, ln), i = n.getColumn(2, hn), o = Zf.copy(s).add(r).add(i);\n return t.center.copy(this.center), t.radius = o.magnitude(), t;\n }\n intersectPlane(t) {\n const n = this.center, s = t.normal, r = this.halfAxes, i = s.x, o = s.y, a = s.z, c = Math.abs(i * r[Gt.COLUMN0ROW0] + o * r[Gt.COLUMN0ROW1] + a * r[Gt.COLUMN0ROW2]) + Math.abs(i * r[Gt.COLUMN1ROW0] + o * r[Gt.COLUMN1ROW1] + a * r[Gt.COLUMN1ROW2]) + Math.abs(i * r[Gt.COLUMN2ROW0] + o * r[Gt.COLUMN2ROW1] + a * r[Gt.COLUMN2ROW2]), u = s.dot(n) + t.distance;\n return u <= -c ? pt.OUTSIDE : u >= c ? pt.INSIDE : pt.INTERSECTING;\n }\n distanceTo(t) {\n return Math.sqrt(this.distanceSquaredTo(t));\n }\n distanceSquaredTo(t) {\n const n = td.from(t).subtract(this.center), s = this.halfAxes, r = s.getColumn(0, un), i = s.getColumn(1, ln), o = s.getColumn(2, hn), a = r.magnitude(), c = i.magnitude(), u = o.magnitude();\n r.normalize(), i.normalize(), o.normalize();\n let l = 0, h;\n return h = Math.abs(n.dot(r)) - a, h > 0 && (l += h * h), h = Math.abs(n.dot(i)) - c, h > 0 && (l += h * h), h = Math.abs(n.dot(o)) - u, h > 0 && (l += h * h), l;\n }\n computePlaneDistances(t, n, s = [-0, -0]) {\n let r = Number.POSITIVE_INFINITY, i = Number.NEGATIVE_INFINITY;\n const o = this.center, a = this.halfAxes, c = a.getColumn(0, un), u = a.getColumn(1, ln), l = a.getColumn(2, hn), h = ed.copy(c).add(u).add(l).add(o), f = nd.copy(h).subtract(t);\n let d = n.dot(f);\n return r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).add(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).subtract(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).subtract(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).add(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).add(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).subtract(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).subtract(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), s[0] = r, s[1] = i, s;\n }\n transform(t) {\n this.center.transformAsPoint(t);\n const n = this.halfAxes.getColumn(0, un);\n n.transformAsPoint(t);\n const s = this.halfAxes.getColumn(1, ln);\n s.transformAsPoint(t);\n const r = this.halfAxes.getColumn(2, hn);\n return r.transformAsPoint(t), this.halfAxes = new W([...n, ...s, ...r]), this;\n }\n getTransform() {\n throw new Error(\"not implemented\");\n }\n}\nconst bi = new A(), _i = new A();\nclass tt {\n constructor(t = [0, 0, 1], n = 0) {\n x(this, \"normal\", void 0), x(this, \"distance\", void 0), this.normal = new A(), this.distance = -0, this.fromNormalDistance(t, n);\n }\n fromNormalDistance(t, n) {\n return j(Number.isFinite(n)), this.normal.from(t).normalize(), this.distance = n, this;\n }\n fromPointNormal(t, n) {\n t = bi.from(t), this.normal.from(n).normalize();\n const s = -this.normal.dot(t);\n return this.distance = s, this;\n }\n fromCoefficients(t, n, s, r) {\n return this.normal.set(t, n, s), j(Kt(this.normal.len(), 1)), this.distance = r, this;\n }\n clone() {\n return new tt(this.normal, this.distance);\n }\n equals(t) {\n return Kt(this.distance, t.distance) && Kt(this.normal, t.normal);\n }\n getPointDistance(t) {\n return this.normal.dot(t) + this.distance;\n }\n transform(t) {\n const n = _i.copy(this.normal).transformAsVector(t).normalize(), s = this.normal.scale(-this.distance).transform(t);\n return this.fromPointNormal(s, n);\n }\n projectPointOntoPlane(t, n = [0, 0, 0]) {\n const s = bi.from(t), r = this.getPointDistance(s), i = _i.copy(this.normal).scale(r);\n return s.subtract(i).to(n);\n }\n}\nconst wi = [new A([1, 0, 0]), new A([0, 1, 0]), new A([0, 0, 1])], Ri = new A(), sd = new A();\nclass dt {\n constructor(t = []) {\n x(this, \"planes\", void 0), this.planes = t;\n }\n fromBoundingSphere(t) {\n this.planes.length = 2 * wi.length;\n const n = t.center, s = t.radius;\n let r = 0;\n for (const i of wi) {\n let o = this.planes[r], a = this.planes[r + 1];\n o || (o = this.planes[r] = new tt()), a || (a = this.planes[r + 1] = new tt());\n const c = Ri.copy(i).scale(-s).add(n);\n o.fromPointNormal(c, i);\n const u = Ri.copy(i).scale(s).add(n), l = sd.copy(i).negate();\n a.fromPointNormal(u, l), r += 2;\n }\n return this;\n }\n computeVisibility(t) {\n let n = pt.INSIDE;\n for (const s of this.planes)\n switch (t.intersectPlane(s)) {\n case pt.OUTSIDE:\n return pt.OUTSIDE;\n case pt.INTERSECTING:\n n = pt.INTERSECTING;\n break;\n }\n return n;\n }\n computeVisibilityWithPlaneMask(t, n) {\n if (j(Number.isFinite(n), \"parentPlaneMask is required.\"), n === dt.MASK_OUTSIDE || n === dt.MASK_INSIDE)\n return n;\n let s = dt.MASK_INSIDE;\n const r = this.planes;\n for (let i = 0; i < this.planes.length; ++i) {\n const o = i < 31 ? 1 << i : 0;\n if (i < 31 && !(n & o))\n continue;\n const a = r[i], c = t.intersectPlane(a);\n if (c === pt.OUTSIDE)\n return dt.MASK_OUTSIDE;\n c === pt.INTERSECTING && (s |= o);\n }\n return s;\n }\n}\nx(dt, \"MASK_OUTSIDE\", 4294967295);\nx(dt, \"MASK_INSIDE\", 0);\nx(dt, \"MASK_INDETERMINATE\", 2147483647);\nconst rd = new A(), id = new A(), od = new A(), ad = new A(), cd = new A();\nclass Fn {\n constructor(t = {}) {\n x(this, \"left\", void 0), x(this, \"_left\", void 0), x(this, \"right\", void 0), x(this, \"_right\", void 0), x(this, \"top\", void 0), x(this, \"_top\", void 0), x(this, \"bottom\", void 0), x(this, \"_bottom\", void 0), x(this, \"near\", void 0), x(this, \"_near\", void 0), x(this, \"far\", void 0), x(this, \"_far\", void 0), x(this, \"_cullingVolume\", new dt([new tt(), new tt(), new tt(), new tt(), new tt(), new tt()])), x(this, \"_perspectiveMatrix\", new V()), x(this, \"_infinitePerspective\", new V());\n const {\n near: n = 1,\n far: s = 5e8\n } = t;\n this.left = t.left, this._left = void 0, this.right = t.right, this._right = void 0, this.top = t.top, this._top = void 0, this.bottom = t.bottom, this._bottom = void 0, this.near = n, this._near = n, this.far = s, this._far = s;\n }\n clone() {\n return new Fn({\n right: this.right,\n left: this.left,\n top: this.top,\n bottom: this.bottom,\n near: this.near,\n far: this.far\n });\n }\n equals(t) {\n return t && t instanceof Fn && this.right === t.right && this.left === t.left && this.top === t.top && this.bottom === t.bottom && this.near === t.near && this.far === t.far;\n }\n get projectionMatrix() {\n return this._update(), this._perspectiveMatrix;\n }\n get infiniteProjectionMatrix() {\n return this._update(), this._infinitePerspective;\n }\n computeCullingVolume(t, n, s) {\n j(t, \"position is required.\"), j(n, \"direction is required.\"), j(s, \"up is required.\");\n const r = this._cullingVolume.planes;\n s = rd.copy(s).normalize();\n const i = id.copy(n).cross(s).normalize(), o = od.copy(n).multiplyByScalar(this.near).add(t), a = ad.copy(n).multiplyByScalar(this.far).add(t);\n let c = cd;\n return c.copy(i).multiplyByScalar(this.left).add(o).subtract(t).cross(s), r[0].fromPointNormal(t, c), c.copy(i).multiplyByScalar(this.right).add(o).subtract(t).cross(s).negate(), r[1].fromPointNormal(t, c), c.copy(s).multiplyByScalar(this.bottom).add(o).subtract(t).cross(i).negate(), r[2].fromPointNormal(t, c), c.copy(s).multiplyByScalar(this.top).add(o).subtract(t).cross(i), r[3].fromPointNormal(t, c), c = new A().copy(n), r[4].fromPointNormal(o, c), c.negate(), r[5].fromPointNormal(a, c), this._cullingVolume;\n }\n getPixelDimensions(t, n, s, r) {\n this._update(), j(Number.isFinite(t) && Number.isFinite(n)), j(t > 0), j(n > 0), j(s > 0), j(r);\n const i = 1 / this.near;\n let o = this.top * i;\n const a = 2 * s * o / n;\n o = this.right * i;\n const c = 2 * s * o / t;\n return r.x = c, r.y = a, r;\n }\n _update() {\n j(Number.isFinite(this.right) && Number.isFinite(this.left) && Number.isFinite(this.top) && Number.isFinite(this.bottom) && Number.isFinite(this.near) && Number.isFinite(this.far));\n const {\n top: t,\n bottom: n,\n right: s,\n left: r,\n near: i,\n far: o\n } = this;\n (t !== this._top || n !== this._bottom || r !== this._left || s !== this._right || i !== this._near || o !== this._far) && (j(this.near > 0 && this.near < this.far, \"near must be greater than zero and less than far.\"), this._left = r, this._right = s, this._top = t, this._bottom = n, this._near = i, this._far = o, this._perspectiveMatrix = new V().frustum({\n left: r,\n right: s,\n bottom: n,\n top: t,\n near: i,\n far: o\n }), this._infinitePerspective = new V().frustum({\n left: r,\n right: s,\n bottom: n,\n top: t,\n near: i,\n far: 1 / 0\n }));\n }\n}\nconst ud = (e) => e !== null && typeof e < \"u\";\nclass Dn {\n constructor(t = {}) {\n x(this, \"_offCenterFrustum\", new Fn()), x(this, \"fov\", void 0), x(this, \"_fov\", void 0), x(this, \"_fovy\", void 0), x(this, \"_sseDenominator\", void 0), x(this, \"aspectRatio\", void 0), x(this, \"_aspectRatio\", void 0), x(this, \"near\", void 0), x(this, \"_near\", void 0), x(this, \"far\", void 0), x(this, \"_far\", void 0), x(this, \"xOffset\", void 0), x(this, \"_xOffset\", void 0), x(this, \"yOffset\", void 0), x(this, \"_yOffset\", void 0);\n const {\n fov: n,\n aspectRatio: s,\n near: r = 1,\n far: i = 5e8,\n xOffset: o = 0,\n yOffset: a = 0\n } = t;\n this.fov = n, this.aspectRatio = s, this.near = r, this.far = i, this.xOffset = o, this.yOffset = a;\n }\n clone() {\n return new Dn({\n aspectRatio: this.aspectRatio,\n fov: this.fov,\n near: this.near,\n far: this.far\n });\n }\n equals(t) {\n return !ud(t) || !(t instanceof Dn) ? !1 : (this._update(), t._update(), this.fov === t.fov && this.aspectRatio === t.aspectRatio && this.near === t.near && this.far === t.far && this._offCenterFrustum.equals(t._offCenterFrustum));\n }\n get projectionMatrix() {\n return this._update(), this._offCenterFrustum.projectionMatrix;\n }\n get infiniteProjectionMatrix() {\n return this._update(), this._offCenterFrustum.infiniteProjectionMatrix;\n }\n get fovy() {\n return this._update(), this._fovy;\n }\n get sseDenominator() {\n return this._update(), this._sseDenominator;\n }\n computeCullingVolume(t, n, s) {\n return this._update(), this._offCenterFrustum.computeCullingVolume(t, n, s);\n }\n getPixelDimensions(t, n, s, r) {\n return this._update(), this._offCenterFrustum.getPixelDimensions(t, n, s, r || new Wn());\n }\n _update() {\n j(Number.isFinite(this.fov) && Number.isFinite(this.aspectRatio) && Number.isFinite(this.near) && Number.isFinite(this.far));\n const t = this._offCenterFrustum;\n (this.fov !== this._fov || this.aspectRatio !== this._aspectRatio || this.near !== this._near || this.far !== this._far || this.xOffset !== this._xOffset || this.yOffset !== this._yOffset) && (j(this.fov >= 0 && this.fov < Math.PI), j(this.aspectRatio > 0), j(this.near >= 0 && this.near < this.far), this._aspectRatio = this.aspectRatio, this._fov = this.fov, this._fovy = this.aspectRatio <= 1 ? this.fov : Math.atan(Math.tan(this.fov * 0.5) / this.aspectRatio) * 2, this._near = this.near, this._far = this.far, this._sseDenominator = 2 * Math.tan(0.5 * this._fovy), this._xOffset = this.xOffset, this._yOffset = this.yOffset, t.top = this.near * Math.tan(0.5 * this._fovy), t.bottom = -t.top, t.right = this.aspectRatio * t.top, t.left = -t.right, t.near = this.near, t.far = this.far, t.right += this.xOffset, t.left += this.xOffset, t.top += this.yOffset, t.bottom += this.yOffset);\n }\n}\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nnew A();\nconst vt = new W(), ld = new W(), hd = new W(), fn = new W(), Mi = new W();\nfunction fd(e, t = {}) {\n const n = Pf, s = 10;\n let r = 0, i = 0;\n const o = ld, a = hd;\n o.identity(), a.copy(e);\n const c = n * dd(a);\n for (; i < s && md(a) > c; )\n gd(a, fn), Mi.copy(fn).transpose(), a.multiplyRight(fn), a.multiplyLeft(Mi), o.multiplyRight(fn), ++r > 2 && (++i, r = 0);\n return t.unitary = o.toTarget(t.unitary), t.diagonal = a.toTarget(t.diagonal), t;\n}\nfunction dd(e) {\n let t = 0;\n for (let n = 0; n < 9; ++n) {\n const s = e[n];\n t += s * s;\n }\n return Math.sqrt(t);\n}\nconst zs = [1, 0, 0], Ws = [2, 2, 1];\nfunction md(e) {\n let t = 0;\n for (let n = 0; n < 3; ++n) {\n const s = e[vt.getElementIndex(Ws[n], zs[n])];\n t += 2 * s * s;\n }\n return Math.sqrt(t);\n}\nfunction gd(e, t) {\n const n = Sa;\n let s = 0, r = 1;\n for (let u = 0; u < 3; ++u) {\n const l = Math.abs(e[vt.getElementIndex(Ws[u], zs[u])]);\n l > s && (r = u, s = l);\n }\n const i = zs[r], o = Ws[r];\n let a = 1, c = 0;\n if (Math.abs(e[vt.getElementIndex(o, i)]) > n) {\n const u = e[vt.getElementIndex(o, o)], l = e[vt.getElementIndex(i, i)], h = e[vt.getElementIndex(o, i)], f = (u - l) / 2 / h;\n let d;\n f < 0 ? d = -1 / (-f + Math.sqrt(1 + f * f)) : d = 1 / (f + Math.sqrt(1 + f * f)), a = 1 / Math.sqrt(1 + d * d), c = d * a;\n }\n return W.IDENTITY.to(t), t[vt.getElementIndex(i, i)] = t[vt.getElementIndex(o, o)] = a, t[vt.getElementIndex(o, i)] = c, t[vt.getElementIndex(i, o)] = -c, t;\n}\nconst Vt = new A(), Ad = new A(), pd = new A(), yd = new A(), Bd = new A(), Cd = new W(), Ed = {\n diagonal: new W(),\n unitary: new W()\n};\nfunction Td(e, t = new qe()) {\n if (!e || e.length === 0)\n return t.halfAxes = new W([0, 0, 0, 0, 0, 0, 0, 0, 0]), t.center = new A(), t;\n const n = e.length, s = new A(0, 0, 0);\n for (const v of e)\n s.add(v);\n const r = 1 / n;\n s.multiplyByScalar(r);\n let i = 0, o = 0, a = 0, c = 0, u = 0, l = 0;\n for (const v of e) {\n const L = Vt.copy(v).subtract(s);\n i += L.x * L.x, o += L.x * L.y, a += L.x * L.z, c += L.y * L.y, u += L.y * L.z, l += L.z * L.z;\n }\n i *= r, o *= r, a *= r, c *= r, u *= r, l *= r;\n const h = Cd;\n h[0] = i, h[1] = o, h[2] = a, h[3] = o, h[4] = c, h[5] = u, h[6] = a, h[7] = u, h[8] = l;\n const {\n unitary: f\n } = fd(h, Ed), d = t.halfAxes.copy(f);\n let m = d.getColumn(0, pd), g = d.getColumn(1, yd), y = d.getColumn(2, Bd), E = -Number.MAX_VALUE, R = -Number.MAX_VALUE, B = -Number.MAX_VALUE, C = Number.MAX_VALUE, M = Number.MAX_VALUE, b = Number.MAX_VALUE;\n for (const v of e)\n Vt.copy(v), E = Math.max(Vt.dot(m), E), R = Math.max(Vt.dot(g), R), B = Math.max(Vt.dot(y), B), C = Math.min(Vt.dot(m), C), M = Math.min(Vt.dot(g), M), b = Math.min(Vt.dot(y), b);\n m = m.multiplyByScalar(0.5 * (C + E)), g = g.multiplyByScalar(0.5 * (M + R)), y = y.multiplyByScalar(0.5 * (b + B)), t.center.copy(m).add(g).add(y);\n const O = Ad.set(E - C, R - M, B - b).multiplyByScalar(0.5), F = new W([O[0], 0, 0, 0, O[1], 0, 0, 0, O[2]]);\n return t.halfAxes.multiplyRight(F), t;\n}\nlet Si = function(e) {\n return e[e.ADD = 1] = \"ADD\", e[e.REPLACE = 2] = \"REPLACE\", e;\n}({}), dn = function(e) {\n return e.EMPTY = \"empty\", e.SCENEGRAPH = \"scenegraph\", e.POINTCLOUD = \"pointcloud\", e.MESH = \"mesh\", e;\n}({}), bd = function(e) {\n return e.I3S = \"I3S\", e.TILES3D = \"TILES3D\", e;\n}({}), Qn = function(e) {\n return e.GEOMETRIC_ERROR = \"geometricError\", e.MAX_SCREEN_THRESHOLD = \"maxScreenThreshold\", e;\n}({});\nconst Ia = \"4.1.1\", _e = {\n COMPOSITE: \"cmpt\",\n POINT_CLOUD: \"pnts\",\n BATCHED_3D_MODEL: \"b3dm\",\n INSTANCED_3D_MODEL: \"i3dm\",\n GEOMETRY: \"geom\",\n VECTOR: \"vect\",\n GLTF: \"glTF\"\n};\nfunction xa(e, t, n) {\n K(e instanceof ArrayBuffer);\n const s = new TextDecoder(\"utf8\"), r = new Uint8Array(e, t, n);\n return s.decode(r);\n}\nfunction _d(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;\n const n = new DataView(e);\n return `${String.fromCharCode(n.getUint8(t + 0))}${String.fromCharCode(n.getUint8(t + 1))}${String.fromCharCode(n.getUint8(t + 2))}${String.fromCharCode(n.getUint8(t + 3))}`;\n}\nconst wd = \"4.1.1\", Rd = {\n name: \"Draco\",\n id: \"draco\",\n module: \"draco\",\n version: wd,\n worker: !0,\n extensions: [\"drc\"],\n mimeTypes: [\"application/octet-stream\"],\n binary: !0,\n tests: [\"DRACO\"],\n options: {\n draco: {\n decoderType: typeof WebAssembly == \"object\" ? \"wasm\" : \"js\",\n libraryPath: \"libs/\",\n extraAttributes: {},\n attributeNameEntry: void 0\n }\n }\n};\nfunction Md(e, t, n) {\n const s = va(t.metadata), r = [], i = Sd(t.attributes);\n for (const o in e) {\n const a = e[o], c = Ii(o, a, i[o]);\n r.push(c);\n }\n if (n) {\n const o = Ii(\"indices\", n);\n r.push(o);\n }\n return {\n fields: r,\n metadata: s\n };\n}\nfunction Sd(e) {\n const t = {};\n for (const n in e) {\n const s = e[n];\n t[s.name || \"undefined\"] = s;\n }\n return t;\n}\nfunction Ii(e, t, n) {\n const s = n ? va(n.metadata) : void 0;\n return eh(e, t, s);\n}\nfunction va(e) {\n Object.entries(e);\n const t = {};\n for (const n in e)\n t[`${n}.string`] = JSON.stringify(e[n]);\n return t;\n}\nconst xi = {\n POSITION: \"POSITION\",\n NORMAL: \"NORMAL\",\n COLOR: \"COLOR_0\",\n TEX_COORD: \"TEXCOORD_0\"\n}, Id = {\n 1: Int8Array,\n 2: Uint8Array,\n 3: Int16Array,\n 4: Uint16Array,\n 5: Int32Array,\n 6: Uint32Array,\n 9: Float32Array\n}, xd = 4;\nclass vd {\n constructor(t) {\n this.draco = void 0, this.decoder = void 0, this.metadataQuerier = void 0, this.draco = t, this.decoder = new this.draco.Decoder(), this.metadataQuerier = new this.draco.MetadataQuerier();\n }\n destroy() {\n this.draco.destroy(this.decoder), this.draco.destroy(this.metadataQuerier);\n }\n parseSync(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n const s = new this.draco.DecoderBuffer();\n s.Init(new Int8Array(t), t.byteLength), this._disableAttributeTransforms(n);\n const r = this.decoder.GetEncodedGeometryType(s), i = r === this.draco.TRIANGULAR_MESH ? new this.draco.Mesh() : new this.draco.PointCloud();\n try {\n let o;\n switch (r) {\n case this.draco.TRIANGULAR_MESH:\n o = this.decoder.DecodeBufferToMesh(s, i);\n break;\n case this.draco.POINT_CLOUD:\n o = this.decoder.DecodeBufferToPointCloud(s, i);\n break;\n default:\n throw new Error(\"DRACO: Unknown geometry type.\");\n }\n if (!o.ok() || !i.ptr) {\n const f = `DRACO decompression failed: ${o.error_msg()}`;\n throw new Error(f);\n }\n const a = this._getDracoLoaderData(i, r, n), c = this._getMeshData(i, a, n), u = th(c.attributes), l = Md(c.attributes, a, c.indices);\n return {\n loader: \"draco\",\n loaderData: a,\n header: {\n vertexCount: i.num_points(),\n boundingBox: u\n },\n ...c,\n schema: l\n };\n } finally {\n this.draco.destroy(s), i && this.draco.destroy(i);\n }\n }\n _getDracoLoaderData(t, n, s) {\n const r = this._getTopLevelMetadata(t), i = this._getDracoAttributes(t, s);\n return {\n geometry_type: n,\n num_attributes: t.num_attributes(),\n num_points: t.num_points(),\n num_faces: t instanceof this.draco.Mesh ? t.num_faces() : 0,\n metadata: r,\n attributes: i\n };\n }\n _getDracoAttributes(t, n) {\n const s = {};\n for (let r = 0; r < t.num_attributes(); r++) {\n const i = this.decoder.GetAttribute(t, r), o = this._getAttributeMetadata(t, r);\n s[i.unique_id()] = {\n unique_id: i.unique_id(),\n attribute_type: i.attribute_type(),\n data_type: i.data_type(),\n num_components: i.num_components(),\n byte_offset: i.byte_offset(),\n byte_stride: i.byte_stride(),\n normalized: i.normalized(),\n attribute_index: r,\n metadata: o\n };\n const a = this._getQuantizationTransform(i, n);\n a && (s[i.unique_id()].quantization_transform = a);\n const c = this._getOctahedronTransform(i, n);\n c && (s[i.unique_id()].octahedron_transform = c);\n }\n return s;\n }\n _getMeshData(t, n, s) {\n const r = this._getMeshAttributes(n, t, s);\n if (!r.POSITION)\n throw new Error(\"DRACO: No position attribute found.\");\n if (t instanceof this.draco.Mesh)\n switch (s.topology) {\n case \"triangle-strip\":\n return {\n topology: \"triangle-strip\",\n mode: 4,\n attributes: r,\n indices: {\n value: this._getTriangleStripIndices(t),\n size: 1\n }\n };\n case \"triangle-list\":\n default:\n return {\n topology: \"triangle-list\",\n mode: 5,\n attributes: r,\n indices: {\n value: this._getTriangleListIndices(t),\n size: 1\n }\n };\n }\n return {\n topology: \"point-list\",\n mode: 0,\n attributes: r\n };\n }\n _getMeshAttributes(t, n, s) {\n const r = {};\n for (const i of Object.values(t.attributes)) {\n const o = this._deduceAttributeName(i, s);\n i.name = o;\n const {\n value: a,\n size: c\n } = this._getAttributeValues(n, i);\n r[o] = {\n value: a,\n size: c,\n byteOffset: i.byte_offset,\n byteStride: i.byte_stride,\n normalized: i.normalized\n };\n }\n return r;\n }\n _getTriangleListIndices(t) {\n const s = t.num_faces() * 3, r = s * xd, i = this.draco._malloc(r);\n try {\n return this.decoder.GetTrianglesUInt32Array(t, r, i), new Uint32Array(this.draco.HEAPF32.buffer, i, s).slice();\n } finally {\n this.draco._free(i);\n }\n }\n _getTriangleStripIndices(t) {\n const n = new this.draco.DracoInt32Array();\n try {\n return this.decoder.GetTriangleStripsFromMesh(t, n), Dd(n);\n } finally {\n this.draco.destroy(n);\n }\n }\n _getAttributeValues(t, n) {\n const s = Id[n.data_type], r = n.num_components, o = t.num_points() * r, a = o * s.BYTES_PER_ELEMENT, c = Od(this.draco, s);\n let u;\n const l = this.draco._malloc(a);\n try {\n const h = this.decoder.GetAttribute(t, n.attribute_index);\n this.decoder.GetAttributeDataArrayForAllPoints(t, h, c, a, l), u = new s(this.draco.HEAPF32.buffer, l, o).slice();\n } finally {\n this.draco._free(l);\n }\n return {\n value: u,\n size: r\n };\n }\n _deduceAttributeName(t, n) {\n const s = t.unique_id;\n for (const [o, a] of Object.entries(n.extraAttributes || {}))\n if (a === s)\n return o;\n const r = t.attribute_type;\n for (const o in xi)\n if (this.draco[o] === r)\n return xi[o];\n const i = n.attributeNameEntry || \"name\";\n return t.metadata[i] ? t.metadata[i].string : `CUSTOM_ATTRIBUTE_${s}`;\n }\n _getTopLevelMetadata(t) {\n const n = this.decoder.GetMetadata(t);\n return this._getDracoMetadata(n);\n }\n _getAttributeMetadata(t, n) {\n const s = this.decoder.GetAttributeMetadata(t, n);\n return this._getDracoMetadata(s);\n }\n _getDracoMetadata(t) {\n if (!t || !t.ptr)\n return {};\n const n = {}, s = this.metadataQuerier.NumEntries(t);\n for (let r = 0; r < s; r++) {\n const i = this.metadataQuerier.GetEntryName(t, r);\n n[i] = this._getDracoMetadataField(t, i);\n }\n return n;\n }\n _getDracoMetadataField(t, n) {\n const s = new this.draco.DracoInt32Array();\n try {\n this.metadataQuerier.GetIntEntryArray(t, n, s);\n const r = Fd(s);\n return {\n int: this.metadataQuerier.GetIntEntry(t, n),\n string: this.metadataQuerier.GetStringEntry(t, n),\n double: this.metadataQuerier.GetDoubleEntry(t, n),\n intArray: r\n };\n } finally {\n this.draco.destroy(s);\n }\n }\n _disableAttributeTransforms(t) {\n const {\n quantizedAttributes: n = [],\n octahedronAttributes: s = []\n } = t, r = [...n, ...s];\n for (const i of r)\n this.decoder.SkipAttributeTransform(this.draco[i]);\n }\n _getQuantizationTransform(t, n) {\n const {\n quantizedAttributes: s = []\n } = n, r = t.attribute_type();\n if (s.map((o) => this.decoder[o]).includes(r)) {\n const o = new this.draco.AttributeQuantizationTransform();\n try {\n if (o.InitFromAttribute(t))\n return {\n quantization_bits: o.quantization_bits(),\n range: o.range(),\n min_values: new Float32Array([1, 2, 3]).map((a) => o.min_value(a))\n };\n } finally {\n this.draco.destroy(o);\n }\n }\n return null;\n }\n _getOctahedronTransform(t, n) {\n const {\n octahedronAttributes: s = []\n } = n, r = t.attribute_type();\n if (s.map((o) => this.decoder[o]).includes(r)) {\n const o = new this.draco.AttributeQuantizationTransform();\n try {\n if (o.InitFromAttribute(t))\n return {\n quantization_bits: o.quantization_bits()\n };\n } finally {\n this.draco.destroy(o);\n }\n }\n return null;\n }\n}\nfunction Od(e, t) {\n switch (t) {\n case Float32Array:\n return e.DT_FLOAT32;\n case Int8Array:\n return e.DT_INT8;\n case Int16Array:\n return e.DT_INT16;\n case Int32Array:\n return e.DT_INT32;\n case Uint8Array:\n return e.DT_UINT8;\n case Uint16Array:\n return e.DT_UINT16;\n case Uint32Array:\n return e.DT_UINT32;\n default:\n return e.DT_INVALID;\n }\n}\nfunction Fd(e) {\n const t = e.size(), n = new Int32Array(t);\n for (let s = 0; s < t; s++)\n n[s] = e.GetValue(s);\n return n;\n}\nfunction Dd(e) {\n const t = e.size(), n = new Int32Array(t);\n for (let s = 0; s < t; s++)\n n[s] = e.GetValue(s);\n return n;\n}\nconst Ld = \"1.5.6\", Pd = \"1.4.1\", As = `https://www.gstatic.com/draco/versioned/decoders/${Ld}`, ft = {\n DECODER: \"draco_wasm_wrapper.js\",\n DECODER_WASM: \"draco_decoder.wasm\",\n FALLBACK_DECODER: \"draco_decoder.js\",\n ENCODER: \"draco_encoder.js\"\n}, ps = {\n [ft.DECODER]: `${As}/${ft.DECODER}`,\n [ft.DECODER_WASM]: `${As}/${ft.DECODER_WASM}`,\n [ft.FALLBACK_DECODER]: `${As}/${ft.FALLBACK_DECODER}`,\n [ft.ENCODER]: `https://raw.githubusercontent.com/google/draco/${Pd}/javascript/${ft.ENCODER}`\n};\nlet we;\nasync function Gd(e) {\n const t = e.modules || {};\n return t.draco3d ? we = we || t.draco3d.createDecoderModule({}).then((n) => ({\n draco: n\n })) : we = we || Nd(e), await we;\n}\nasync function Nd(e) {\n let t, n;\n switch (e.draco && e.draco.decoderType) {\n case \"js\":\n t = await Zt(ps[ft.FALLBACK_DECODER], \"draco\", e, ft.FALLBACK_DECODER);\n break;\n case \"wasm\":\n default:\n [t, n] = await Promise.all([await Zt(ps[ft.DECODER], \"draco\", e, ft.DECODER), await Zt(ps[ft.DECODER_WASM], \"draco\", e, ft.DECODER_WASM)]);\n }\n return t = t || globalThis.DracoDecoderModule, await Ud(t, n);\n}\nfunction Ud(e, t) {\n const n = {};\n return t && (n.wasmBinary = t), new Promise((s) => {\n e({\n ...n,\n onModuleLoaded: (r) => s({\n draco: r\n })\n });\n });\n}\nconst Oa = {\n ...Rd,\n parse: Hd\n};\nasync function Hd(e, t) {\n const {\n draco: n\n } = await Gd(t), s = new vd(n);\n try {\n return s.parseSync(e, t == null ? void 0 : t.draco);\n } finally {\n s.destroy();\n }\n}\nconst Jd = {\n POINTS: 0,\n LINES: 1,\n LINE_LOOP: 2,\n LINE_STRIP: 3,\n TRIANGLES: 4,\n TRIANGLE_STRIP: 5,\n TRIANGLE_FAN: 6\n}, Y = {\n BYTE: 5120,\n UNSIGNED_BYTE: 5121,\n SHORT: 5122,\n UNSIGNED_SHORT: 5123,\n INT: 5124,\n UNSIGNED_INT: 5125,\n FLOAT: 5126,\n DOUBLE: 5130\n}, G = {\n ...Jd,\n ...Y\n}, ys = {\n [Y.DOUBLE]: Float64Array,\n [Y.FLOAT]: Float32Array,\n [Y.UNSIGNED_SHORT]: Uint16Array,\n [Y.UNSIGNED_INT]: Uint32Array,\n [Y.UNSIGNED_BYTE]: Uint8Array,\n [Y.BYTE]: Int8Array,\n [Y.SHORT]: Int16Array,\n [Y.INT]: Int32Array\n}, Vd = {\n DOUBLE: Y.DOUBLE,\n FLOAT: Y.FLOAT,\n UNSIGNED_SHORT: Y.UNSIGNED_SHORT,\n UNSIGNED_INT: Y.UNSIGNED_INT,\n UNSIGNED_BYTE: Y.UNSIGNED_BYTE,\n BYTE: Y.BYTE,\n SHORT: Y.SHORT,\n INT: Y.INT\n}, Bs = \"Failed to convert GL type\";\nclass Dt {\n static fromTypedArray(t) {\n t = ArrayBuffer.isView(t) ? t.constructor : t;\n for (const n in ys)\n if (ys[n] === t)\n return n;\n throw new Error(Bs);\n }\n static fromName(t) {\n const n = Vd[t];\n if (!n)\n throw new Error(Bs);\n return n;\n }\n static getArrayType(t) {\n switch (t) {\n case Y.UNSIGNED_SHORT_5_6_5:\n case Y.UNSIGNED_SHORT_4_4_4_4:\n case Y.UNSIGNED_SHORT_5_5_5_1:\n return Uint16Array;\n default:\n const n = ys[t];\n if (!n)\n throw new Error(Bs);\n return n;\n }\n }\n static getByteSize(t) {\n return Dt.getArrayType(t).BYTES_PER_ELEMENT;\n }\n static validate(t) {\n return !!Dt.getArrayType(t);\n }\n static createTypedArray(t, n) {\n let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, r = arguments.length > 3 ? arguments[3] : void 0;\n r === void 0 && (r = (n.byteLength - s) / Dt.getByteSize(t));\n const i = Dt.getArrayType(t);\n return new i(n, s, r);\n }\n}\nfunction jd(e, t) {\n if (!e)\n throw new Error(`math.gl assertion failed. ${t}`);\n}\nfunction kd(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0];\n const n = e >> 11 & 31, s = e >> 5 & 63, r = e & 31;\n return t[0] = n << 3, t[1] = s << 2, t[2] = r << 3, t;\n}\nnew Wn();\nnew A();\nnew Wn();\nnew Wn();\nfunction vi(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 255;\n return lh(e, 0, t) / t * 2 - 1;\n}\nfunction Oi(e) {\n return e < 0 ? -1 : 1;\n}\nfunction Kd(e, t, n, s) {\n if (jd(s), e < 0 || e > n || t < 0 || t > n)\n throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);\n if (s.x = vi(e, n), s.y = vi(t, n), s.z = 1 - (Math.abs(s.x) + Math.abs(s.y)), s.z < 0) {\n const r = s.x;\n s.x = (1 - Math.abs(s.y)) * Oi(r), s.y = (1 - Math.abs(r)) * Oi(s.y);\n }\n return s.normalize();\n}\nfunction zd(e, t, n) {\n return Kd(e, t, 255, n);\n}\nclass br {\n constructor(t, n) {\n this.json = void 0, this.buffer = void 0, this.featuresLength = 0, this._cachedTypedArrays = {}, this.json = t, this.buffer = n;\n }\n getExtension(t) {\n return this.json.extensions && this.json.extensions[t];\n }\n hasProperty(t) {\n return !!this.json[t];\n }\n getGlobalProperty(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : G.UNSIGNED_INT, s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;\n const r = this.json[t];\n return r && Number.isFinite(r.byteOffset) ? this._getTypedArrayFromBinary(t, n, s, 1, r.byteOffset) : r;\n }\n getPropertyArray(t, n, s) {\n const r = this.json[t];\n return r && Number.isFinite(r.byteOffset) ? (\"componentType\" in r && (n = Dt.fromName(r.componentType)), this._getTypedArrayFromBinary(t, n, s, this.featuresLength, r.byteOffset)) : this._getTypedArrayFromArray(t, n, r);\n }\n getProperty(t, n, s, r, i) {\n const o = this.json[t];\n if (!o)\n return o;\n const a = this.getPropertyArray(t, n, s);\n if (s === 1)\n return a[r];\n for (let c = 0; c < s; ++c)\n i[c] = a[s * r + c];\n return i;\n }\n _getTypedArrayFromBinary(t, n, s, r, i) {\n const o = this._cachedTypedArrays;\n let a = o[t];\n return a || (a = Dt.createTypedArray(n, this.buffer.buffer, this.buffer.byteOffset + i, r * s), o[t] = a), a;\n }\n _getTypedArrayFromArray(t, n, s) {\n const r = this._cachedTypedArrays;\n let i = r[t];\n return i || (i = Dt.createTypedArray(n, s), r[t] = i), i;\n }\n}\nconst Wd = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n}, Xd = {\n SCALAR: (e, t) => e[t],\n VEC2: (e, t) => [e[2 * t + 0], e[2 * t + 1]],\n VEC3: (e, t) => [e[3 * t + 0], e[3 * t + 1], e[3 * t + 2]],\n VEC4: (e, t) => [e[4 * t + 0], e[4 * t + 1], e[4 * t + 2], e[4 * t + 3]],\n MAT2: (e, t) => [e[4 * t + 0], e[4 * t + 1], e[4 * t + 2], e[4 * t + 3]],\n MAT3: (e, t) => [e[9 * t + 0], e[9 * t + 1], e[9 * t + 2], e[9 * t + 3], e[9 * t + 4], e[9 * t + 5], e[9 * t + 6], e[9 * t + 7], e[9 * t + 8]],\n MAT4: (e, t) => [e[16 * t + 0], e[16 * t + 1], e[16 * t + 2], e[16 * t + 3], e[16 * t + 4], e[16 * t + 5], e[16 * t + 6], e[16 * t + 7], e[16 * t + 8], e[16 * t + 9], e[16 * t + 10], e[16 * t + 11], e[16 * t + 12], e[16 * t + 13], e[16 * t + 14], e[16 * t + 15]]\n}, Qd = {\n SCALAR: (e, t, n) => {\n t[n] = e;\n },\n VEC2: (e, t, n) => {\n t[2 * n + 0] = e[0], t[2 * n + 1] = e[1];\n },\n VEC3: (e, t, n) => {\n t[3 * n + 0] = e[0], t[3 * n + 1] = e[1], t[3 * n + 2] = e[2];\n },\n VEC4: (e, t, n) => {\n t[4 * n + 0] = e[0], t[4 * n + 1] = e[1], t[4 * n + 2] = e[2], t[4 * n + 3] = e[3];\n },\n MAT2: (e, t, n) => {\n t[4 * n + 0] = e[0], t[4 * n + 1] = e[1], t[4 * n + 2] = e[2], t[4 * n + 3] = e[3];\n },\n MAT3: (e, t, n) => {\n t[9 * n + 0] = e[0], t[9 * n + 1] = e[1], t[9 * n + 2] = e[2], t[9 * n + 3] = e[3], t[9 * n + 4] = e[4], t[9 * n + 5] = e[5], t[9 * n + 6] = e[6], t[9 * n + 7] = e[7], t[9 * n + 8] = e[8], t[9 * n + 9] = e[9];\n },\n MAT4: (e, t, n) => {\n t[16 * n + 0] = e[0], t[16 * n + 1] = e[1], t[16 * n + 2] = e[2], t[16 * n + 3] = e[3], t[16 * n + 4] = e[4], t[16 * n + 5] = e[5], t[16 * n + 6] = e[6], t[16 * n + 7] = e[7], t[16 * n + 8] = e[8], t[16 * n + 9] = e[9], t[16 * n + 10] = e[10], t[16 * n + 11] = e[11], t[16 * n + 12] = e[12], t[16 * n + 13] = e[13], t[16 * n + 14] = e[14], t[16 * n + 15] = e[15];\n }\n};\nfunction qd(e, t, n, s) {\n const {\n componentType: r\n } = e;\n K(e.componentType);\n const i = typeof r == \"string\" ? Dt.fromName(r) : r, o = Wd[e.type], a = Xd[e.type], c = Qd[e.type];\n return n += e.byteOffset, {\n values: Dt.createTypedArray(i, t, n, o * s),\n type: i,\n size: o,\n unpacker: a,\n packer: c\n };\n}\nconst Ot = (e) => e !== void 0;\nfunction Yd(e, t, n) {\n if (!t)\n return null;\n let s = e.getExtension(\"3DTILES_batch_table_hierarchy\");\n const r = t.HIERARCHY;\n return r && (console.warn(\"3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy.\"), t.extensions = t.extensions || {}, t.extensions[\"3DTILES_batch_table_hierarchy\"] = r, s = r), s ? $d(s, n) : null;\n}\nfunction $d(e, t) {\n let n, s, r;\n const i = e.instancesLength, o = e.classes;\n let a = e.classIds, c = e.parentCounts, u = e.parentIds, l = i;\n Ot(a.byteOffset) && (a.componentType = defaultValue(a.componentType, GL.UNSIGNED_SHORT), a.type = AttributeType.SCALAR, r = getBinaryAccessor(a), a = r.createArrayBufferView(t.buffer, t.byteOffset + a.byteOffset, i));\n let h;\n if (Ot(c))\n for (Ot(c.byteOffset) && (c.componentType = defaultValue(c.componentType, GL.UNSIGNED_SHORT), c.type = AttributeType.SCALAR, r = getBinaryAccessor(c), c = r.createArrayBufferView(t.buffer, t.byteOffset + c.byteOffset, i)), h = new Uint16Array(i), l = 0, n = 0; n < i; ++n)\n h[n] = l, l += c[n];\n Ot(u) && Ot(u.byteOffset) && (u.componentType = defaultValue(u.componentType, GL.UNSIGNED_SHORT), u.type = AttributeType.SCALAR, r = getBinaryAccessor(u), u = r.createArrayBufferView(t.buffer, t.byteOffset + u.byteOffset, l));\n const f = o.length;\n for (n = 0; n < f; ++n) {\n const y = o[n].length, E = o[n].instances, R = getBinaryProperties(y, E, t);\n o[n].instances = combine(R, E);\n }\n const d = new Array(f).fill(0), m = new Uint16Array(i);\n for (n = 0; n < i; ++n)\n s = a[n], m[n] = d[s], ++d[s];\n const g = {\n classes: o,\n classIds: a,\n classIndexes: m,\n parentCounts: c,\n parentIndexes: h,\n parentIds: u\n };\n return em(g), g;\n}\nfunction Re(e, t, n) {\n if (!e)\n return;\n const s = e.parentCounts;\n return e.parentIds ? n(e, t) : s > 0 ? Zd(e, t, n) : tm(e, t, n);\n}\nfunction Zd(e, t, n) {\n const s = e.classIds, r = e.parentCounts, i = e.parentIds, o = e.parentIndexes, a = s.length, c = scratchVisited;\n c.length = Math.max(c.length, a);\n const u = ++marker, l = scratchStack;\n for (l.length = 0, l.push(t); l.length > 0; ) {\n if (t = l.pop(), c[t] === u)\n continue;\n c[t] = u;\n const h = n(e, t);\n if (Ot(h))\n return h;\n const f = r[t], d = o[t];\n for (let m = 0; m < f; ++m) {\n const g = i[d + m];\n g !== t && l.push(g);\n }\n }\n return null;\n}\nfunction tm(e, t, n) {\n let s = !0;\n for (; s; ) {\n const r = n(e, t);\n if (Ot(r))\n return r;\n const i = e.parentIds[t];\n s = i !== t, t = i;\n }\n throw new Error(\"traverseHierarchySingleParent\");\n}\nfunction em(e) {\n const n = e.classIds.length;\n for (let s = 0; s < n; ++s)\n Fa(e, s, stack);\n}\nfunction Fa(e, t, n) {\n const s = e.parentCounts, r = e.parentIds, i = e.parentIndexes, a = e.classIds.length;\n if (!Ot(r))\n return;\n assert(t < a, `Parent index ${t} exceeds the total number of instances: ${a}`), assert(n.indexOf(t) === -1, \"Circular dependency detected in the batch table hierarchy.\"), n.push(t);\n const c = Ot(s) ? s[t] : 1, u = Ot(s) ? i[t] : t;\n for (let l = 0; l < c; ++l) {\n const h = r[u + l];\n h !== t && Fa(e, h, n);\n }\n n.pop(t);\n}\nfunction ut(e) {\n return e != null;\n}\nconst mn = (e, t) => e, nm = {\n HIERARCHY: !0,\n extensions: !0,\n extras: !0\n};\nclass Da {\n constructor(t, n, s) {\n var r;\n let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};\n this.json = void 0, this.binary = void 0, this.featureCount = void 0, this._extensions = void 0, this._properties = void 0, this._binaryProperties = void 0, this._hierarchy = void 0, K(s >= 0), this.json = t || {}, this.binary = n, this.featureCount = s, this._extensions = ((r = this.json) === null || r === void 0 ? void 0 : r.extensions) || {}, this._properties = {};\n for (const o in this.json)\n nm[o] || (this._properties[o] = this.json[o]);\n this._binaryProperties = this._initializeBinaryProperties(), i[\"3DTILES_batch_table_hierarchy\"] && (this._hierarchy = Yd(this, this.json, this.binary));\n }\n getExtension(t) {\n return this.json && this.json.extensions && this.json.extensions[t];\n }\n memorySizeInBytes() {\n return 0;\n }\n isClass(t, n) {\n if (this._checkBatchId(t), K(typeof n == \"string\", n), this._hierarchy) {\n const s = Re(this._hierarchy, t, (r, i) => {\n const o = r.classIds[i];\n return r.classes[o].name === n;\n });\n return ut(s);\n }\n return !1;\n }\n isExactClass(t, n) {\n return K(typeof n == \"string\", n), this.getExactClassName(t) === n;\n }\n getExactClassName(t) {\n if (this._checkBatchId(t), this._hierarchy) {\n const n = this._hierarchy.classIds[t];\n return this._hierarchy.classes[n].name;\n }\n }\n hasProperty(t, n) {\n return this._checkBatchId(t), K(typeof n == \"string\", n), ut(this._properties[n]) || this._hasPropertyInHierarchy(t, n);\n }\n getPropertyNames(t, n) {\n this._checkBatchId(t), n = ut(n) ? n : [], n.length = 0;\n const s = Object.keys(this._properties);\n return n.push(...s), this._hierarchy && this._getPropertyNamesInHierarchy(t, n), n;\n }\n getProperty(t, n) {\n if (this._checkBatchId(t), K(typeof n == \"string\", n), this._binaryProperties) {\n const r = this._binaryProperties[n];\n if (ut(r))\n return this._getBinaryProperty(r, t);\n }\n const s = this._properties[n];\n if (ut(s))\n return mn(s[t]);\n if (this._hierarchy) {\n const r = this._getHierarchyProperty(t, n);\n if (ut(r))\n return r;\n }\n }\n setProperty(t, n, s) {\n const r = this.featureCount;\n if (this._checkBatchId(t), K(typeof n == \"string\", n), this._binaryProperties) {\n const o = this._binaryProperties[n];\n if (o) {\n this._setBinaryProperty(o, t, s);\n return;\n }\n }\n if (this._hierarchy && this._setHierarchyProperty(this, t, n, s))\n return;\n let i = this._properties[n];\n ut(i) || (this._properties[n] = new Array(r), i = this._properties[n]), i[t] = mn(s);\n }\n _checkBatchId(t) {\n if (!(t >= 0 && t < this.featureCount))\n throw new Error(\"batchId not in range [0, featureCount - 1].\");\n }\n _getBinaryProperty(t, n) {\n return t.unpack(t.typedArray, n);\n }\n _setBinaryProperty(t, n, s) {\n t.pack(s, t.typedArray, n);\n }\n _initializeBinaryProperties() {\n let t = null;\n for (const n in this._properties) {\n const s = this._properties[n], r = this._initializeBinaryProperty(n, s);\n r && (t = t || {}, t[n] = r);\n }\n return t;\n }\n _initializeBinaryProperty(t, n) {\n if (\"byteOffset\" in n) {\n const s = n;\n K(this.binary, `Property ${t} requires a batch table binary.`), K(s.type, `Property ${t} requires a type.`);\n const r = qd(s, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount);\n return {\n typedArray: r.values,\n componentCount: r.size,\n unpack: r.unpacker,\n pack: r.packer\n };\n }\n return null;\n }\n _hasPropertyInHierarchy(t, n) {\n if (!this._hierarchy)\n return !1;\n const s = Re(this._hierarchy, t, (r, i) => {\n const o = r.classIds[i], a = r.classes[o].instances;\n return ut(a[n]);\n });\n return ut(s);\n }\n _getPropertyNamesInHierarchy(t, n) {\n Re(this._hierarchy, t, (s, r) => {\n const i = s.classIds[r], o = s.classes[i].instances;\n for (const a in o)\n o.hasOwnProperty(a) && n.indexOf(a) === -1 && n.push(a);\n });\n }\n _getHierarchyProperty(t, n) {\n return Re(this._hierarchy, t, (s, r) => {\n const i = s.classIds[r], o = s.classes[i], a = s.classIndexes[r], c = o.instances[n];\n return ut(c) ? ut(c.typedArray) ? this._getBinaryProperty(c, a) : mn(c[a]) : null;\n });\n }\n _setHierarchyProperty(t, n, s, r) {\n const i = Re(this._hierarchy, n, (o, a) => {\n const c = o.classIds[a], u = o.classes[c], l = o.classIndexes[a], h = u.instances[s];\n return ut(h) ? (K(a === n, `Inherited property \"${s}\" is read-only.`), ut(h.typedArray) ? this._setBinaryProperty(h, l, r) : h[l] = mn(r), !0) : !1;\n });\n return ut(i);\n }\n}\nconst Cs = 4;\nfunction qn(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;\n const s = new DataView(t);\n if (e.magic = s.getUint32(n, !0), n += Cs, e.version = s.getUint32(n, !0), n += Cs, e.byteLength = s.getUint32(n, !0), n += Cs, e.version !== 1)\n throw new Error(`3D Tile Version ${e.version} not supported`);\n return n;\n}\nconst le = 4, Fi = \"b3dm tile in legacy format.\";\nfunction _r(e, t, n) {\n const s = new DataView(t);\n let r;\n e.header = e.header || {};\n let i = s.getUint32(n, !0);\n n += le;\n let o = s.getUint32(n, !0);\n n += le;\n let a = s.getUint32(n, !0);\n n += le;\n let c = s.getUint32(n, !0);\n return n += le, a >= 570425344 ? (n -= le * 2, r = i, a = o, c = 0, i = 0, o = 0, console.warn(Fi)) : c >= 570425344 && (n -= le, r = a, a = i, c = o, i = 0, o = 0, console.warn(Fi)), e.header.featureTableJsonByteLength = i, e.header.featureTableBinaryByteLength = o, e.header.batchTableJsonByteLength = a, e.header.batchTableBinaryByteLength = c, e.header.batchLength = r, n;\n}\nfunction wr(e, t, n, s) {\n return n = sm(e, t, n), n = rm(e, t, n), n;\n}\nfunction sm(e, t, n, s) {\n const {\n featureTableJsonByteLength: r,\n featureTableBinaryByteLength: i,\n batchLength: o\n } = e.header || {};\n if (e.featureTableJson = {\n BATCH_LENGTH: o || 0\n }, r && r > 0) {\n const a = xa(t, n, r);\n e.featureTableJson = JSON.parse(a);\n }\n return n += r || 0, e.featureTableBinary = new Uint8Array(t, n, i), n += i || 0, n;\n}\nfunction rm(e, t, n, s) {\n const {\n batchTableJsonByteLength: r,\n batchTableBinaryByteLength: i\n } = e.header || {};\n if (r && r > 0) {\n const o = xa(t, n, r);\n e.batchTableJson = JSON.parse(o), n += r, i && i > 0 && (e.batchTableBinary = new Uint8Array(t, n, i), e.batchTableBinary = new Uint8Array(e.batchTableBinary), n += i);\n }\n return n;\n}\nfunction La(e, t, n) {\n if (!t && (!e || !e.batchIds || !n))\n return null;\n const {\n batchIds: s,\n isRGB565: r,\n pointCount: i = 0\n } = e;\n if (s && n) {\n const o = new Uint8ClampedArray(i * 3);\n for (let a = 0; a < i; a++) {\n const c = s[a], l = n.getProperty(c, \"dimensions\").map((h) => h * 255);\n o[a * 3] = l[0], o[a * 3 + 1] = l[1], o[a * 3 + 2] = l[2];\n }\n return {\n type: G.UNSIGNED_BYTE,\n value: o,\n size: 3,\n normalized: !0\n };\n }\n if (t && r) {\n const o = new Uint8ClampedArray(i * 3);\n for (let a = 0; a < i; a++) {\n const c = kd(t[a]);\n o[a * 3] = c[0], o[a * 3 + 1] = c[1], o[a * 3 + 2] = c[2];\n }\n return {\n type: G.UNSIGNED_BYTE,\n value: o,\n size: 3,\n normalized: !0\n };\n }\n return t && t.length === i * 3 ? {\n type: G.UNSIGNED_BYTE,\n value: t,\n size: 3,\n normalized: !0\n } : {\n type: G.UNSIGNED_BYTE,\n value: t || new Uint8ClampedArray(),\n size: 4,\n normalized: !0\n };\n}\nconst Di = new A();\nfunction im(e, t) {\n if (!t)\n return null;\n if (e.isOctEncoded16P) {\n const n = new Float32Array((e.pointsLength || 0) * 3);\n for (let s = 0; s < (e.pointsLength || 0); s++)\n zd(t[s * 2], t[s * 2 + 1], Di), Di.toArray(n, s * 3);\n return {\n type: G.FLOAT,\n size: 2,\n value: n\n };\n }\n return {\n type: G.FLOAT,\n size: 2,\n value: t\n };\n}\nfunction om(e, t, n) {\n return e.isQuantized ? n[\"3d-tiles\"] && n[\"3d-tiles\"].decodeQuantizedPositions ? (e.isQuantized = !1, am(e, t)) : {\n type: G.UNSIGNED_SHORT,\n value: t,\n size: 3,\n normalized: !0\n } : t;\n}\nfunction am(e, t) {\n const n = new A(), s = new Float32Array(e.pointCount * 3);\n for (let r = 0; r < e.pointCount; r++)\n n.set(t[r * 3], t[r * 3 + 1], t[r * 3 + 2]).scale(1 / e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(s, r * 3);\n return s;\n}\nasync function cm(e, t, n, s, r) {\n n = qn(e, t, n), n = _r(e, t, n), n = wr(e, t, n), um(e);\n const {\n featureTable: i,\n batchTable: o\n } = lm(e);\n return await gm(e, i, o, s, r), hm(e, i, s), fm(e, i, o), dm(e, i), n;\n}\nfunction um(e) {\n e.attributes = {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n }, e.isQuantized = !1, e.isTranslucent = !1, e.isRGB565 = !1, e.isOctEncoded16P = !1;\n}\nfunction lm(e) {\n const t = new br(e.featureTableJson, e.featureTableBinary), n = t.getGlobalProperty(\"POINTS_LENGTH\");\n if (!Number.isFinite(n))\n throw new Error(\"POINTS_LENGTH must be defined\");\n t.featuresLength = n, e.featuresLength = n, e.pointsLength = n, e.pointCount = n, e.rtcCenter = t.getGlobalProperty(\"RTC_CENTER\", G.FLOAT, 3);\n const s = mm(e, t);\n return {\n featureTable: t,\n batchTable: s\n };\n}\nfunction hm(e, t, n) {\n if (e.attributes = e.attributes || {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n }, !e.attributes.positions) {\n if (t.hasProperty(\"POSITION\"))\n e.attributes.positions = t.getPropertyArray(\"POSITION\", G.FLOAT, 3);\n else if (t.hasProperty(\"POSITION_QUANTIZED\")) {\n const s = t.getPropertyArray(\"POSITION_QUANTIZED\", G.UNSIGNED_SHORT, 3);\n if (e.isQuantized = !0, e.quantizedRange = 65535, e.quantizedVolumeScale = t.getGlobalProperty(\"QUANTIZED_VOLUME_SCALE\", G.FLOAT, 3), !e.quantizedVolumeScale)\n throw new Error(\"QUANTIZED_VOLUME_SCALE must be defined for quantized positions.\");\n if (e.quantizedVolumeOffset = t.getGlobalProperty(\"QUANTIZED_VOLUME_OFFSET\", G.FLOAT, 3), !e.quantizedVolumeOffset)\n throw new Error(\"QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.\");\n e.attributes.positions = om(e, s, n);\n }\n }\n if (!e.attributes.positions)\n throw new Error(\"Either POSITION or POSITION_QUANTIZED must be defined.\");\n}\nfunction fm(e, t, n) {\n if (e.attributes = e.attributes || {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n }, !e.attributes.colors) {\n let s = null;\n t.hasProperty(\"RGBA\") ? (s = t.getPropertyArray(\"RGBA\", G.UNSIGNED_BYTE, 4), e.isTranslucent = !0) : t.hasProperty(\"RGB\") ? s = t.getPropertyArray(\"RGB\", G.UNSIGNED_BYTE, 3) : t.hasProperty(\"RGB565\") && (s = t.getPropertyArray(\"RGB565\", G.UNSIGNED_SHORT, 1), e.isRGB565 = !0), e.attributes.colors = La(e, s, n);\n }\n t.hasProperty(\"CONSTANT_RGBA\") && (e.constantRGBA = t.getGlobalProperty(\"CONSTANT_RGBA\", G.UNSIGNED_BYTE, 4));\n}\nfunction dm(e, t) {\n if (e.attributes = e.attributes || {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n }, !e.attributes.normals) {\n let n = null;\n t.hasProperty(\"NORMAL\") ? n = t.getPropertyArray(\"NORMAL\", G.FLOAT, 3) : t.hasProperty(\"NORMAL_OCT16P\") && (n = t.getPropertyArray(\"NORMAL_OCT16P\", G.UNSIGNED_BYTE, 2), e.isOctEncoded16P = !0), e.attributes.normals = im(e, n);\n }\n}\nfunction mm(e, t) {\n let n = null;\n if (!e.batchIds && t.hasProperty(\"BATCH_ID\") && (e.batchIds = t.getPropertyArray(\"BATCH_ID\", G.UNSIGNED_SHORT, 1), e.batchIds)) {\n const s = t.getGlobalProperty(\"BATCH_LENGTH\");\n if (!s)\n throw new Error(\"Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.\");\n const {\n batchTableJson: r,\n batchTableBinary: i\n } = e;\n n = new Da(r, i, s);\n }\n return n;\n}\nasync function gm(e, t, n, s, r) {\n let i, o, a;\n const c = e.batchTableJson && e.batchTableJson.extensions && e.batchTableJson.extensions[\"3DTILES_draco_point_compression\"];\n c && (a = c.properties);\n const u = t.getExtension(\"3DTILES_draco_point_compression\");\n if (u) {\n o = u.properties;\n const h = u.byteOffset, f = u.byteLength;\n if (!o || !Number.isFinite(h) || !f)\n throw new Error(\"Draco properties, byteOffset, and byteLength must be defined\");\n i = (e.featureTableBinary || []).slice(h, h + f), e.hasPositions = Number.isFinite(o.POSITION), e.hasColors = Number.isFinite(o.RGB) || Number.isFinite(o.RGBA), e.hasNormals = Number.isFinite(o.NORMAL), e.hasBatchIds = Number.isFinite(o.BATCH_ID), e.isTranslucent = Number.isFinite(o.RGBA);\n }\n if (!i)\n return !0;\n const l = {\n buffer: i,\n properties: {\n ...o,\n ...a\n },\n featureTableProperties: o,\n batchTableProperties: a,\n dequantizeInShader: !1\n };\n return await Am(e, l, s, r);\n}\nasync function Am(e, t, n, s) {\n if (!s)\n return;\n const r = {\n ...n,\n draco: {\n ...n == null ? void 0 : n.draco,\n extraAttributes: t.batchTableProperties || {}\n }\n };\n delete r[\"3d-tiles\"];\n const i = await Ke(t.buffer, Oa, r, s), o = i.attributes.POSITION && i.attributes.POSITION.value, a = i.attributes.COLOR_0 && i.attributes.COLOR_0.value, c = i.attributes.NORMAL && i.attributes.NORMAL.value, u = i.attributes.BATCH_ID && i.attributes.BATCH_ID.value, l = o && i.attributes.POSITION.value.quantization, h = c && i.attributes.NORMAL.value.quantization;\n if (l) {\n const d = i.POSITION.data.quantization, m = d.range;\n e.quantizedVolumeScale = new A(m, m, m), e.quantizedVolumeOffset = new A(d.minValues), e.quantizedRange = (1 << d.quantizationBits) - 1, e.isQuantizedDraco = !0;\n }\n h && (e.octEncodedRange = (1 << i.NORMAL.data.quantization.quantizationBits) - 1, e.isOctEncodedDraco = !0);\n const f = {};\n if (t.batchTableProperties)\n for (const d of Object.keys(t.batchTableProperties))\n i.attributes[d] && i.attributes[d].value && (f[d.toLowerCase()] = i.attributes[d].value);\n e.attributes = {\n positions: o,\n colors: La(e, a, void 0),\n normals: c,\n batchIds: u,\n ...f\n };\n}\nconst pm = \"4.1.1\";\nvar Es;\nconst ym = (Es = globalThis.loaders) === null || Es === void 0 ? void 0 : Es.parseImageNode, Xs = typeof Image < \"u\", Qs = typeof ImageBitmap < \"u\", Bm = !!ym, qs = kn ? !0 : Bm;\nfunction Cm(e) {\n switch (e) {\n case \"auto\":\n return Qs || Xs || qs;\n case \"imagebitmap\":\n return Qs;\n case \"image\":\n return Xs;\n case \"data\":\n return qs;\n default:\n throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`);\n }\n}\nfunction Em() {\n if (Qs)\n return \"imagebitmap\";\n if (Xs)\n return \"image\";\n if (qs)\n return \"data\";\n throw new Error(\"Install '@loaders.gl/polyfills' to parse images under Node.js\");\n}\nfunction Tm(e) {\n const t = bm(e);\n if (!t)\n throw new Error(\"Not an image\");\n return t;\n}\nfunction Pa(e) {\n switch (Tm(e)) {\n case \"data\":\n return e;\n case \"image\":\n case \"imagebitmap\":\n const t = document.createElement(\"canvas\"), n = t.getContext(\"2d\");\n if (!n)\n throw new Error(\"getImageData\");\n return t.width = e.width, t.height = e.height, n.drawImage(e, 0, 0), n.getImageData(0, 0, e.width, e.height);\n default:\n throw new Error(\"getImageData\");\n }\n}\nfunction bm(e) {\n return typeof ImageBitmap < \"u\" && e instanceof ImageBitmap ? \"imagebitmap\" : typeof Image < \"u\" && e instanceof Image ? \"image\" : e && typeof e == \"object\" && e.data && e.width && e.height ? \"data\" : null;\n}\nconst _m = /^data:image\\/svg\\+xml/, wm = /\\.svg((\\?|#).*)?$/;\nfunction Rr(e) {\n return e && (_m.test(e) || wm.test(e));\n}\nfunction Rm(e, t) {\n if (Rr(t)) {\n let s = new TextDecoder().decode(e);\n try {\n typeof unescape == \"function\" && typeof encodeURIComponent == \"function\" && (s = unescape(encodeURIComponent(s)));\n } catch (i) {\n throw new Error(i.message);\n }\n return `data:image/svg+xml;base64,${btoa(s)}`;\n }\n return Ga(e, t);\n}\nfunction Ga(e, t) {\n if (Rr(t))\n throw new Error(\"SVG cannot be parsed directly to imagebitmap\");\n return new Blob([new Uint8Array(e)]);\n}\nasync function Na(e, t, n) {\n const s = Rm(e, n), r = self.URL || self.webkitURL, i = typeof s != \"string\" && r.createObjectURL(s);\n try {\n return await Mm(i || s, t);\n } finally {\n i && r.revokeObjectURL(i);\n }\n}\nasync function Mm(e, t) {\n const n = new Image();\n return n.src = e, t.image && t.image.decode && n.decode ? (await n.decode(), n) : await new Promise((s, r) => {\n try {\n n.onload = () => s(n), n.onerror = (i) => {\n const o = i instanceof Error ? i.message : \"error\";\n r(new Error(o));\n };\n } catch (i) {\n r(i);\n }\n });\n}\nconst Sm = {};\nlet Li = !0;\nasync function Im(e, t, n) {\n let s;\n Rr(n) ? s = await Na(e, t, n) : s = Ga(e, n);\n const r = t && t.imagebitmap;\n return await xm(s, r);\n}\nasync function xm(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;\n if ((vm(t) || !Li) && (t = null), t)\n try {\n return await createImageBitmap(e, t);\n } catch (n) {\n console.warn(n), Li = !1;\n }\n return await createImageBitmap(e);\n}\nfunction vm(e) {\n for (const t in e || Sm)\n return !1;\n return !0;\n}\nfunction Om(e) {\n return !Pm(e, \"ftyp\", 4) || !(e[8] & 96) ? null : Fm(e);\n}\nfunction Fm(e) {\n switch (Dm(e, 8, 12).replace(\"\\0\", \" \").trim()) {\n case \"avif\":\n case \"avis\":\n return {\n extension: \"avif\",\n mimeType: \"image/avif\"\n };\n default:\n return null;\n }\n}\nfunction Dm(e, t, n) {\n return String.fromCharCode(...e.slice(t, n));\n}\nfunction Lm(e) {\n return [...e].map((t) => t.charCodeAt(0));\n}\nfunction Pm(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;\n const s = Lm(t);\n for (let r = 0; r < s.length; ++r)\n if (s[r] !== e[r + n])\n return !1;\n return !0;\n}\nconst Ft = !1, De = !0;\nfunction Mr(e) {\n const t = Ye(e);\n return Nm(t) || Jm(t) || Um(t) || Hm(t) || Gm(t);\n}\nfunction Gm(e) {\n const t = new Uint8Array(e instanceof DataView ? e.buffer : e), n = Om(t);\n return n ? {\n mimeType: n.mimeType,\n width: 0,\n height: 0\n } : null;\n}\nfunction Nm(e) {\n const t = Ye(e);\n return t.byteLength >= 24 && t.getUint32(0, Ft) === 2303741511 ? {\n mimeType: \"image/png\",\n width: t.getUint32(16, Ft),\n height: t.getUint32(20, Ft)\n } : null;\n}\nfunction Um(e) {\n const t = Ye(e);\n return t.byteLength >= 10 && t.getUint32(0, Ft) === 1195984440 ? {\n mimeType: \"image/gif\",\n width: t.getUint16(6, De),\n height: t.getUint16(8, De)\n } : null;\n}\nfunction Hm(e) {\n const t = Ye(e);\n return t.byteLength >= 14 && t.getUint16(0, Ft) === 16973 && t.getUint32(2, De) === t.byteLength ? {\n mimeType: \"image/bmp\",\n width: t.getUint32(18, De),\n height: t.getUint32(22, De)\n } : null;\n}\nfunction Jm(e) {\n const t = Ye(e);\n if (!(t.byteLength >= 3 && t.getUint16(0, Ft) === 65496 && t.getUint8(2) === 255))\n return null;\n const {\n tableMarkers: s,\n sofMarkers: r\n } = Vm();\n let i = 2;\n for (; i + 9 < t.byteLength; ) {\n const o = t.getUint16(i, Ft);\n if (r.has(o))\n return {\n mimeType: \"image/jpeg\",\n height: t.getUint16(i + 5, Ft),\n width: t.getUint16(i + 7, Ft)\n };\n if (!s.has(o))\n return null;\n i += 2, i += t.getUint16(i, Ft);\n }\n return null;\n}\nfunction Vm() {\n const e = /* @__PURE__ */ new Set([65499, 65476, 65484, 65501, 65534]);\n for (let n = 65504; n < 65520; ++n)\n e.add(n);\n return {\n tableMarkers: e,\n sofMarkers: /* @__PURE__ */ new Set([65472, 65473, 65474, 65475, 65477, 65478, 65479, 65481, 65482, 65483, 65485, 65486, 65487, 65502])\n };\n}\nfunction Ye(e) {\n if (e instanceof DataView)\n return e;\n if (ArrayBuffer.isView(e))\n return new DataView(e.buffer);\n if (e instanceof ArrayBuffer)\n return new DataView(e);\n throw new Error(\"toDataView\");\n}\nasync function jm(e, t) {\n var n;\n const {\n mimeType: s\n } = Mr(e) || {}, r = (n = globalThis.loaders) === null || n === void 0 ? void 0 : n.parseImageNode;\n return K(r), await r(e, s);\n}\nasync function km(e, t, n) {\n t = t || {};\n const r = (t.image || {}).type || \"auto\", {\n url: i\n } = n || {}, o = Km(r);\n let a;\n switch (o) {\n case \"imagebitmap\":\n a = await Im(e, t, i);\n break;\n case \"image\":\n a = await Na(e, t, i);\n break;\n case \"data\":\n a = await jm(e);\n break;\n default:\n K(!1);\n }\n return r === \"data\" && (a = Pa(a)), a;\n}\nfunction Km(e) {\n switch (e) {\n case \"auto\":\n case \"data\":\n return Em();\n default:\n return Cm(e), e;\n }\n}\nconst zm = [\"png\", \"jpg\", \"jpeg\", \"gif\", \"webp\", \"bmp\", \"ico\", \"svg\", \"avif\"], Wm = [\"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\", \"image/avif\", \"image/bmp\", \"image/vnd.microsoft.icon\", \"image/svg+xml\"], Xm = {\n image: {\n type: \"auto\",\n decode: !0\n }\n}, Qm = {\n id: \"image\",\n module: \"images\",\n name: \"Images\",\n version: pm,\n mimeTypes: Wm,\n extensions: zm,\n parse: km,\n tests: [(e) => !!Mr(new DataView(e))],\n options: Xm\n}, Ts = {};\nfunction qm(e) {\n if (Ts[e] === void 0) {\n const t = kn ? $m(e) : Ym(e);\n Ts[e] = t;\n }\n return Ts[e];\n}\nfunction Ym(e) {\n var t, n;\n const s = [\"image/png\", \"image/jpeg\", \"image/gif\"], r = ((t = globalThis.loaders) === null || t === void 0 ? void 0 : t.imageFormatsNode) || s;\n return !!((n = globalThis.loaders) === null || n === void 0 ? void 0 : n.parseImageNode) && r.includes(e);\n}\nfunction $m(e) {\n switch (e) {\n case \"image/avif\":\n case \"image/webp\":\n return Zm(e);\n default:\n return !0;\n }\n}\nfunction Zm(e) {\n try {\n return document.createElement(\"canvas\").toDataURL(e).indexOf(`data:${e}`) === 0;\n } catch {\n return !1;\n }\n}\nfunction yt(e, t) {\n if (!e)\n throw new Error(t || \"assert failed: gltf\");\n}\nconst Ua = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n}, Ha = {\n 5120: 1,\n 5121: 1,\n 5122: 2,\n 5123: 2,\n 5125: 4,\n 5126: 4\n}, tg = 1.33, Pi = [\"SCALAR\", \"VEC2\", \"VEC3\", \"VEC4\"], eg = [[Int8Array, 5120], [Uint8Array, 5121], [Int16Array, 5122], [Uint16Array, 5123], [Uint32Array, 5125], [Float32Array, 5126], [Float64Array, 5130]], ng = new Map(eg), sg = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n}, rg = {\n 5120: 1,\n 5121: 1,\n 5122: 2,\n 5123: 2,\n 5125: 4,\n 5126: 4\n}, ig = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array\n};\nfunction Ja(e) {\n return Pi[e - 1] || Pi[0];\n}\nfunction Sr(e) {\n const t = ng.get(e.constructor);\n if (!t)\n throw new Error(\"Illegal typed array\");\n return t;\n}\nfunction Ir(e, t) {\n const n = ig[e.componentType], s = sg[e.type], r = rg[e.componentType], i = e.count * s, o = e.count * s * r;\n yt(o >= 0 && o <= t.byteLength);\n const a = Ha[e.componentType], c = Ua[e.type];\n return {\n ArrayType: n,\n length: i,\n byteLength: o,\n componentByteSize: a,\n numberOfComponentsInElement: c\n };\n}\nfunction Va(e) {\n let {\n images: t,\n bufferViews: n\n } = e;\n t = t || [], n = n || [];\n const s = t.map((o) => o.bufferView);\n n = n.filter((o) => !s.includes(o));\n const r = n.reduce((o, a) => o + a.byteLength, 0), i = t.reduce((o, a) => {\n const {\n width: c,\n height: u\n } = a.image;\n return o + c * u;\n }, 0);\n return r + Math.ceil(4 * i * tg);\n}\nfunction og(e, t, n) {\n const s = e.bufferViews[n];\n yt(s);\n const r = s.buffer, i = t[r];\n yt(i);\n const o = (s.byteOffset || 0) + i.byteOffset;\n return new Uint8Array(i.arrayBuffer, o, s.byteLength);\n}\nfunction ag(e, t, n) {\n var s, r;\n const i = typeof n == \"number\" ? (s = e.accessors) === null || s === void 0 ? void 0 : s[n] : n;\n if (!i)\n throw new Error(`No gltf accessor ${JSON.stringify(n)}`);\n const o = (r = e.bufferViews) === null || r === void 0 ? void 0 : r[i.bufferView || 0];\n if (!o)\n throw new Error(`No gltf buffer view for accessor ${o}`);\n const {\n arrayBuffer: a,\n byteOffset: c\n } = t[o.buffer], u = (c || 0) + (i.byteOffset || 0) + (o.byteOffset || 0), {\n ArrayType: l,\n length: h,\n componentByteSize: f,\n numberOfComponentsInElement: d\n } = Ir(i, o), m = f * d, g = o.byteStride || m;\n if (typeof o.byteStride > \"u\" || o.byteStride === m)\n return new l(a, u, h);\n const y = new l(h);\n for (let E = 0; E < i.count; E++) {\n const R = new l(a, u + E * g, d);\n y.set(R, E * d);\n }\n return y;\n}\nfunction cg() {\n return {\n asset: {\n version: \"2.0\",\n generator: \"loaders.gl\"\n },\n buffers: [],\n extensions: {},\n extensionsRequired: [],\n extensionsUsed: []\n };\n}\nclass it {\n constructor(t) {\n this.gltf = void 0, this.sourceBuffers = void 0, this.byteLength = void 0, this.gltf = {\n json: (t == null ? void 0 : t.json) || cg(),\n buffers: (t == null ? void 0 : t.buffers) || [],\n images: (t == null ? void 0 : t.images) || []\n }, this.sourceBuffers = [], this.byteLength = 0, this.gltf.buffers && this.gltf.buffers[0] && (this.byteLength = this.gltf.buffers[0].byteLength, this.sourceBuffers = [this.gltf.buffers[0]]);\n }\n get json() {\n return this.gltf.json;\n }\n getApplicationData(t) {\n return this.json[t];\n }\n getExtraData(t) {\n return (this.json.extras || {})[t];\n }\n hasExtension(t) {\n const n = this.getUsedExtensions().find((r) => r === t), s = this.getRequiredExtensions().find((r) => r === t);\n return typeof n == \"string\" || typeof s == \"string\";\n }\n getExtension(t) {\n const n = this.getUsedExtensions().find((r) => r === t), s = this.json.extensions || {};\n return n ? s[t] : null;\n }\n getRequiredExtension(t) {\n return this.getRequiredExtensions().find((s) => s === t) ? this.getExtension(t) : null;\n }\n getRequiredExtensions() {\n return this.json.extensionsRequired || [];\n }\n getUsedExtensions() {\n return this.json.extensionsUsed || [];\n }\n getRemovedExtensions() {\n return this.json.extensionsRemoved || [];\n }\n getObjectExtension(t, n) {\n return (t.extensions || {})[n];\n }\n getScene(t) {\n return this.getObject(\"scenes\", t);\n }\n getNode(t) {\n return this.getObject(\"nodes\", t);\n }\n getSkin(t) {\n return this.getObject(\"skins\", t);\n }\n getMesh(t) {\n return this.getObject(\"meshes\", t);\n }\n getMaterial(t) {\n return this.getObject(\"materials\", t);\n }\n getAccessor(t) {\n return this.getObject(\"accessors\", t);\n }\n getTexture(t) {\n return this.getObject(\"textures\", t);\n }\n getSampler(t) {\n return this.getObject(\"samplers\", t);\n }\n getImage(t) {\n return this.getObject(\"images\", t);\n }\n getBufferView(t) {\n return this.getObject(\"bufferViews\", t);\n }\n getBuffer(t) {\n return this.getObject(\"buffers\", t);\n }\n getObject(t, n) {\n if (typeof n == \"object\")\n return n;\n const s = this.json[t] && this.json[t][n];\n if (!s)\n throw new Error(`glTF file error: Could not find ${t}[${n}]`);\n return s;\n }\n getTypedArrayForBufferView(t) {\n t = this.getBufferView(t);\n const n = t.buffer, s = this.gltf.buffers[n];\n yt(s);\n const r = (t.byteOffset || 0) + s.byteOffset;\n return new Uint8Array(s.arrayBuffer, r, t.byteLength);\n }\n getTypedArrayForAccessor(t) {\n const n = this.getAccessor(t);\n return ag(this.gltf.json, this.gltf.buffers, n);\n }\n getTypedArrayForImageData(t) {\n t = this.getAccessor(t);\n const n = this.getBufferView(t.bufferView), r = this.getBuffer(n.buffer).data, i = n.byteOffset || 0;\n return new Uint8Array(r, i, n.byteLength);\n }\n addApplicationData(t, n) {\n return this.json[t] = n, this;\n }\n addExtraData(t, n) {\n return this.json.extras = this.json.extras || {}, this.json.extras[t] = n, this;\n }\n addObjectExtension(t, n, s) {\n return t.extensions = t.extensions || {}, t.extensions[n] = s, this.registerUsedExtension(n), this;\n }\n setObjectExtension(t, n, s) {\n const r = t.extensions || {};\n r[n] = s;\n }\n removeObjectExtension(t, n) {\n const s = (t == null ? void 0 : t.extensions) || {};\n if (s[n]) {\n this.json.extensionsRemoved = this.json.extensionsRemoved || [];\n const r = this.json.extensionsRemoved;\n r.includes(n) || r.push(n);\n }\n delete s[n];\n }\n addExtension(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n return yt(n), this.json.extensions = this.json.extensions || {}, this.json.extensions[t] = n, this.registerUsedExtension(t), n;\n }\n addRequiredExtension(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n return yt(n), this.addExtension(t, n), this.registerRequiredExtension(t), n;\n }\n registerUsedExtension(t) {\n this.json.extensionsUsed = this.json.extensionsUsed || [], this.json.extensionsUsed.find((n) => n === t) || this.json.extensionsUsed.push(t);\n }\n registerRequiredExtension(t) {\n this.registerUsedExtension(t), this.json.extensionsRequired = this.json.extensionsRequired || [], this.json.extensionsRequired.find((n) => n === t) || this.json.extensionsRequired.push(t);\n }\n removeExtension(t) {\n var n;\n if ((n = this.json.extensions) !== null && n !== void 0 && n[t]) {\n this.json.extensionsRemoved = this.json.extensionsRemoved || [];\n const s = this.json.extensionsRemoved;\n s.includes(t) || s.push(t);\n }\n this.json.extensions && delete this.json.extensions[t], this.json.extensionsRequired && this._removeStringFromArray(this.json.extensionsRequired, t), this.json.extensionsUsed && this._removeStringFromArray(this.json.extensionsUsed, t);\n }\n setDefaultScene(t) {\n this.json.scene = t;\n }\n addScene(t) {\n const {\n nodeIndices: n\n } = t;\n return this.json.scenes = this.json.scenes || [], this.json.scenes.push({\n nodes: n\n }), this.json.scenes.length - 1;\n }\n addNode(t) {\n const {\n meshIndex: n,\n matrix: s\n } = t;\n this.json.nodes = this.json.nodes || [];\n const r = {\n mesh: n\n };\n return s && (r.matrix = s), this.json.nodes.push(r), this.json.nodes.length - 1;\n }\n addMesh(t) {\n const {\n attributes: n,\n indices: s,\n material: r,\n mode: i = 4\n } = t, a = {\n primitives: [{\n attributes: this._addAttributes(n),\n mode: i\n }]\n };\n if (s) {\n const c = this._addIndices(s);\n a.primitives[0].indices = c;\n }\n return Number.isFinite(r) && (a.primitives[0].material = r), this.json.meshes = this.json.meshes || [], this.json.meshes.push(a), this.json.meshes.length - 1;\n }\n addPointCloud(t) {\n const s = {\n primitives: [{\n attributes: this._addAttributes(t),\n mode: 0\n }]\n };\n return this.json.meshes = this.json.meshes || [], this.json.meshes.push(s), this.json.meshes.length - 1;\n }\n addImage(t, n) {\n const s = Mr(t), r = n || (s == null ? void 0 : s.mimeType), o = {\n bufferView: this.addBufferView(t),\n mimeType: r\n };\n return this.json.images = this.json.images || [], this.json.images.push(o), this.json.images.length - 1;\n }\n addBufferView(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.byteLength;\n const r = t.byteLength;\n yt(Number.isFinite(r)), this.sourceBuffers = this.sourceBuffers || [], this.sourceBuffers.push(t);\n const i = {\n buffer: n,\n byteOffset: s,\n byteLength: r\n };\n return this.byteLength += ze(r, 4), this.json.bufferViews = this.json.bufferViews || [], this.json.bufferViews.push(i), this.json.bufferViews.length - 1;\n }\n addAccessor(t, n) {\n const s = {\n bufferView: t,\n type: Ja(n.size),\n componentType: n.componentType,\n count: n.count,\n max: n.max,\n min: n.min\n };\n return this.json.accessors = this.json.accessors || [], this.json.accessors.push(s), this.json.accessors.length - 1;\n }\n addBinaryBuffer(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {\n size: 3\n };\n const s = this.addBufferView(t);\n let r = {\n min: n.min,\n max: n.max\n };\n (!r.min || !r.max) && (r = this._getAccessorMinMax(t, n.size));\n const i = {\n size: n.size,\n componentType: Sr(t),\n count: Math.round(t.length / n.size),\n min: r.min,\n max: r.max\n };\n return this.addAccessor(s, Object.assign(i, n));\n }\n addTexture(t) {\n const {\n imageIndex: n\n } = t, s = {\n source: n\n };\n return this.json.textures = this.json.textures || [], this.json.textures.push(s), this.json.textures.length - 1;\n }\n addMaterial(t) {\n return this.json.materials = this.json.materials || [], this.json.materials.push(t), this.json.materials.length - 1;\n }\n createBinaryChunk() {\n var t, n;\n this.gltf.buffers = [];\n const s = this.byteLength, r = new ArrayBuffer(s), i = new Uint8Array(r);\n let o = 0;\n for (const a of this.sourceBuffers || [])\n o = Du(a, i, o);\n (t = this.json) !== null && t !== void 0 && (n = t.buffers) !== null && n !== void 0 && n[0] ? this.json.buffers[0].byteLength = s : this.json.buffers = [{\n byteLength: s\n }], this.gltf.binary = r, this.sourceBuffers = [r];\n }\n _removeStringFromArray(t, n) {\n let s = !0;\n for (; s; ) {\n const r = t.indexOf(n);\n r > -1 ? t.splice(r, 1) : s = !1;\n }\n }\n _addAttributes() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n const n = {};\n for (const s in t) {\n const r = t[s], i = this._getGltfAttributeName(s), o = this.addBinaryBuffer(r.value, r);\n n[i] = o;\n }\n return n;\n }\n _addIndices(t) {\n return this.addBinaryBuffer(t, {\n size: 1\n });\n }\n _getGltfAttributeName(t) {\n switch (t.toLowerCase()) {\n case \"position\":\n case \"positions\":\n case \"vertices\":\n return \"POSITION\";\n case \"normal\":\n case \"normals\":\n return \"NORMAL\";\n case \"color\":\n case \"colors\":\n return \"COLOR_0\";\n case \"texcoord\":\n case \"texcoords\":\n return \"TEXCOORD_0\";\n default:\n return t;\n }\n }\n _getAccessorMinMax(t, n) {\n const s = {\n min: null,\n max: null\n };\n if (t.length < n)\n return s;\n s.min = [], s.max = [];\n const r = t.subarray(0, n);\n for (const i of r)\n s.min.push(i), s.max.push(i);\n for (let i = n; i < t.length; i += n)\n for (let o = 0; o < n; o++)\n s.min[0 + o] = Math.min(s.min[0 + o], t[i + o]), s.max[0 + o] = Math.max(s.max[0 + o], t[i + o]);\n return s;\n }\n}\nfunction Gi(e) {\n return (e % 1 + 1) % 1;\n}\nconst ja = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16,\n BOOLEAN: 1,\n STRING: 1,\n ENUM: 1\n}, ug = {\n INT8: Int8Array,\n UINT8: Uint8Array,\n INT16: Int16Array,\n UINT16: Uint16Array,\n INT32: Int32Array,\n UINT32: Uint32Array,\n INT64: BigInt64Array,\n UINT64: BigUint64Array,\n FLOAT32: Float32Array,\n FLOAT64: Float64Array\n}, ka = {\n INT8: 1,\n UINT8: 1,\n INT16: 2,\n UINT16: 2,\n INT32: 4,\n UINT32: 4,\n INT64: 8,\n UINT64: 8,\n FLOAT32: 4,\n FLOAT64: 8\n};\nfunction xr(e, t) {\n return ka[t] * ja[e];\n}\nfunction Yn(e, t, n, s) {\n if (n !== \"UINT8\" && n !== \"UINT16\" && n !== \"UINT32\" && n !== \"UINT64\")\n return null;\n const r = e.getTypedArrayForBufferView(t), i = $n(r, \"SCALAR\", n, s + 1);\n return i instanceof BigInt64Array || i instanceof BigUint64Array ? null : i;\n}\nfunction $n(e, t, n) {\n let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;\n const r = ja[t], i = ug[n], o = ka[n], a = s * r, c = a * o;\n let u = e.buffer, l = e.byteOffset;\n return l % o !== 0 && (u = new Uint8Array(u).slice(l, l + c).buffer, l = 0), new i(u, l, a);\n}\nfunction vr(e, t, n) {\n var s, r;\n const i = `TEXCOORD_${t.texCoord || 0}`, o = n.attributes[i], a = e.getTypedArrayForAccessor(o), c = e.gltf.json, u = t.index, l = (s = c.textures) === null || s === void 0 || (r = s[u]) === null || r === void 0 ? void 0 : r.source;\n if (typeof l < \"u\") {\n var h, f, d;\n const m = (h = c.images) === null || h === void 0 || (f = h[l]) === null || f === void 0 ? void 0 : f.mimeType, g = (d = e.gltf.images) === null || d === void 0 ? void 0 : d[l];\n if (g && typeof g.width < \"u\") {\n const y = [];\n for (let E = 0; E < a.length; E += 2) {\n const R = lg(g, m, a, E, t.channels);\n y.push(R);\n }\n return y;\n }\n }\n return [];\n}\nfunction Ka(e, t, n, s, r) {\n if (!(n != null && n.length))\n return;\n const i = [];\n for (const l of n) {\n let h = s.findIndex((f) => f === l);\n h === -1 && (h = s.push(l) - 1), i.push(h);\n }\n const o = new Uint32Array(i), a = e.gltf.buffers.push({\n arrayBuffer: o.buffer,\n byteOffset: o.byteOffset,\n byteLength: o.byteLength\n }) - 1, c = e.addBufferView(o, a, 0), u = e.addAccessor(c, {\n size: 1,\n componentType: Sr(o),\n count: o.length\n });\n r.attributes[t] = u;\n}\nfunction lg(e, t, n, s) {\n let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [0];\n const i = {\n r: {\n offset: 0,\n shift: 0\n },\n g: {\n offset: 1,\n shift: 8\n },\n b: {\n offset: 2,\n shift: 16\n },\n a: {\n offset: 3,\n shift: 24\n }\n }, o = n[s], a = n[s + 1];\n let c = 1;\n t && (t.indexOf(\"image/jpeg\") !== -1 || t.indexOf(\"image/png\") !== -1) && (c = 4);\n const u = hg(o, a, e, c);\n let l = 0;\n for (const h of r) {\n const f = typeof h == \"number\" ? Object.values(i)[h] : i[h], d = u + f.offset, m = Pa(e);\n if (m.data.length <= d)\n throw new Error(`${m.data.length} <= ${d}`);\n const g = m.data[d];\n l |= g << f.shift;\n }\n return l;\n}\nfunction hg(e, t, n) {\n let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;\n const r = n.width, i = Gi(e) * (r - 1), o = Math.round(i), a = n.height, c = Gi(t) * (a - 1), u = Math.round(c), l = n.components ? n.components : s;\n return (u * r + o) * l;\n}\nfunction za(e, t, n, s, r) {\n const i = [];\n for (let o = 0; o < t; o++) {\n const a = n[o], c = n[o + 1] - n[o];\n if (c + a > s)\n break;\n const u = a / r, l = c / r;\n i.push(e.slice(u, u + l));\n }\n return i;\n}\nfunction Wa(e, t, n) {\n const s = [];\n for (let r = 0; r < t; r++) {\n const i = r * n;\n s.push(e.slice(i, i + n));\n }\n return s;\n}\nfunction Xa(e, t, n, s) {\n if (n)\n throw new Error(\"Not implemented - arrayOffsets for strings is specified\");\n if (s) {\n const r = [], i = new TextDecoder(\"utf8\");\n let o = 0;\n for (let a = 0; a < e; a++) {\n const c = s[a + 1] - s[a];\n if (c + o <= t.length) {\n const u = t.subarray(o, c + o), l = i.decode(u);\n r.push(l), o += c;\n }\n }\n return r;\n }\n return [];\n}\nconst Qa = \"EXT_mesh_features\", fg = Qa;\nasync function dg(e, t) {\n const n = new it(e);\n mg(n, t);\n}\nfunction mg(e, t) {\n const n = e.gltf.json;\n if (n.meshes)\n for (const s of n.meshes)\n for (const r of s.primitives)\n gg(e, r, t);\n}\nfunction gg(e, t, n) {\n var s, r;\n if (!(n != null && (s = n.gltf) !== null && s !== void 0 && s.loadBuffers))\n return;\n const i = (r = t.extensions) === null || r === void 0 ? void 0 : r[Qa], o = i == null ? void 0 : i.featureIds;\n if (o)\n for (const c of o) {\n var a;\n let u;\n if (typeof c.attribute < \"u\") {\n const l = `_FEATURE_ID_${c.attribute}`, h = t.attributes[l];\n u = e.getTypedArrayForAccessor(h);\n } else\n typeof c.texture < \"u\" && n !== null && n !== void 0 && (a = n.gltf) !== null && a !== void 0 && a.loadImages ? u = vr(e, c.texture, t) : u = [];\n c.data = u;\n }\n}\nconst Ag = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n decode: dg,\n name: fg\n}, Symbol.toStringTag, { value: \"Module\" })), Or = \"EXT_structural_metadata\", pg = Or;\nasync function yg(e, t) {\n const n = new it(e);\n Bg(n, t);\n}\nfunction Bg(e, t) {\n var n, s;\n if (!((n = t.gltf) !== null && n !== void 0 && n.loadBuffers))\n return;\n const r = e.getExtension(Or);\n r && ((s = t.gltf) !== null && s !== void 0 && s.loadImages && Cg(e, r), Eg(e, r));\n}\nfunction Cg(e, t) {\n const n = t.propertyTextures, s = e.gltf.json;\n if (n && s.meshes)\n for (const r of s.meshes)\n for (const i of r.primitives)\n bg(e, n, i, t);\n}\nfunction Eg(e, t) {\n const n = t.schema;\n if (!n)\n return;\n const s = n.classes, r = t.propertyTables;\n if (s && r)\n for (const i in s) {\n const o = Tg(r, i);\n o && wg(e, n, o);\n }\n}\nfunction Tg(e, t) {\n for (const n of e)\n if (n.class === t)\n return n;\n return null;\n}\nfunction bg(e, t, n, s) {\n var r;\n if (!t)\n return;\n const i = (r = n.extensions) === null || r === void 0 ? void 0 : r[Or], o = i == null ? void 0 : i.propertyTextures;\n if (o)\n for (const a of o) {\n const c = t[a];\n _g(e, c, n, s);\n }\n}\nfunction _g(e, t, n, s) {\n if (!t.properties)\n return;\n s.dataAttributeNames || (s.dataAttributeNames = []);\n const r = t.class;\n for (const o in t.properties) {\n var i;\n const a = `${r}_${o}`, c = (i = t.properties) === null || i === void 0 ? void 0 : i[o];\n if (!c)\n continue;\n c.data || (c.data = []);\n const u = c.data, l = vr(e, c, n);\n l !== null && (Ka(e, a, l, u, n), c.data = u, s.dataAttributeNames.push(a));\n }\n}\nfunction wg(e, t, n) {\n var s;\n const r = (s = t.classes) === null || s === void 0 ? void 0 : s[n.class];\n if (!r)\n throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);\n const i = n.count;\n for (const a in r.properties) {\n var o;\n const c = r.properties[a], u = (o = n.properties) === null || o === void 0 ? void 0 : o[a];\n if (u) {\n const l = Rg(e, t, c, i, u);\n u.data = l;\n }\n }\n}\nfunction Rg(e, t, n, s, r) {\n let i = [];\n const o = r.values, a = e.getTypedArrayForBufferView(o), c = Mg(e, n, r, s), u = Sg(e, r, s);\n switch (n.type) {\n case \"SCALAR\":\n case \"VEC2\":\n case \"VEC3\":\n case \"VEC4\":\n case \"MAT2\":\n case \"MAT3\":\n case \"MAT4\": {\n i = Ig(n, s, a, c);\n break;\n }\n case \"BOOLEAN\":\n throw new Error(`Not implemented - classProperty.type=${n.type}`);\n case \"STRING\": {\n i = Xa(s, a, c, u);\n break;\n }\n case \"ENUM\": {\n i = xg(t, n, s, a, c);\n break;\n }\n default:\n throw new Error(`Unknown classProperty type ${n.type}`);\n }\n return i;\n}\nfunction Mg(e, t, n, s) {\n return t.array && typeof t.count > \"u\" && typeof n.arrayOffsets < \"u\" ? Yn(e, n.arrayOffsets, n.arrayOffsetType || \"UINT32\", s) : null;\n}\nfunction Sg(e, t, n) {\n return typeof t.stringOffsets < \"u\" ? Yn(e, t.stringOffsets, t.stringOffsetType || \"UINT32\", n) : null;\n}\nfunction Ig(e, t, n, s) {\n const r = e.array, i = e.count, o = xr(e.type, e.componentType), a = n.byteLength / o;\n let c;\n return e.componentType ? c = $n(n, e.type, e.componentType, a) : c = n, r ? s ? za(c, t, s, n.length, o) : i ? Wa(c, t, i) : [] : c;\n}\nfunction xg(e, t, n, s, r) {\n var i;\n const o = t.enumType;\n if (!o)\n throw new Error(\"Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM\");\n const a = (i = e.enums) === null || i === void 0 ? void 0 : i[o];\n if (!a)\n throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);\n const c = a.valueType || \"UINT16\", u = xr(t.type, c), l = s.byteLength / u;\n let h = $n(s, t.type, c, l);\n if (h || (h = s), t.array) {\n if (r)\n return vg({\n valuesData: h,\n numberOfElements: n,\n arrayOffsets: r,\n valuesDataBytesLength: s.length,\n elementSize: u,\n enumEntry: a\n });\n const f = t.count;\n return f ? Og(h, n, f, a) : [];\n }\n return Fr(h, 0, n, a);\n}\nfunction vg(e) {\n const {\n valuesData: t,\n numberOfElements: n,\n arrayOffsets: s,\n valuesDataBytesLength: r,\n elementSize: i,\n enumEntry: o\n } = e, a = [];\n for (let c = 0; c < n; c++) {\n const u = s[c], l = s[c + 1] - s[c];\n if (l + u > r)\n break;\n const h = u / i, f = l / i, d = Fr(t, h, f, o);\n a.push(d);\n }\n return a;\n}\nfunction Og(e, t, n, s) {\n const r = [];\n for (let i = 0; i < t; i++) {\n const o = n * i, a = Fr(e, o, n, s);\n r.push(a);\n }\n return r;\n}\nfunction Fr(e, t, n, s) {\n const r = [];\n for (let i = 0; i < n; i++)\n if (e instanceof BigInt64Array || e instanceof BigUint64Array)\n r.push(\"\");\n else {\n const o = e[t + i], a = Fg(s, o);\n a ? r.push(a.name) : r.push(\"\");\n }\n return r;\n}\nfunction Fg(e, t) {\n for (const n of e.values)\n if (n.value === t)\n return n;\n return null;\n}\nconst Dg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n decode: yg,\n name: pg\n}, Symbol.toStringTag, { value: \"Module\" })), qa = \"EXT_feature_metadata\", Lg = qa;\nasync function Pg(e, t) {\n const n = new it(e);\n Gg(n, t);\n}\nfunction Gg(e, t) {\n var n, s;\n if (!((n = t.gltf) !== null && n !== void 0 && n.loadBuffers))\n return;\n const r = e.getExtension(qa);\n r && ((s = t.gltf) !== null && s !== void 0 && s.loadImages && Ng(e, r), Ug(e, r));\n}\nfunction Ng(e, t) {\n const n = t.schema;\n if (!n)\n return;\n const s = n.classes, {\n featureTextures: r\n } = t;\n if (s && r)\n for (const i in s) {\n const o = s[i], a = Jg(r, i);\n a && jg(e, a, o);\n }\n}\nfunction Ug(e, t) {\n const n = t.schema;\n if (!n)\n return;\n const s = n.classes, r = t.featureTables;\n if (s && r)\n for (const i in s) {\n const o = Hg(r, i);\n o && Vg(e, n, o);\n }\n}\nfunction Hg(e, t) {\n for (const n in e) {\n const s = e[n];\n if (s.class === t)\n return s;\n }\n return null;\n}\nfunction Jg(e, t) {\n for (const n in e) {\n const s = e[n];\n if (s.class === t)\n return s;\n }\n return null;\n}\nfunction Vg(e, t, n) {\n var s;\n if (!n.class)\n return;\n const r = (s = t.classes) === null || s === void 0 ? void 0 : s[n.class];\n if (!r)\n throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);\n const i = n.count;\n for (const a in r.properties) {\n var o;\n const c = r.properties[a], u = (o = n.properties) === null || o === void 0 ? void 0 : o[a];\n if (u) {\n const l = kg(e, t, c, i, u);\n u.data = l;\n }\n }\n}\nfunction jg(e, t, n) {\n const s = t.class;\n for (const i in n.properties) {\n var r;\n const o = t == null || (r = t.properties) === null || r === void 0 ? void 0 : r[i];\n if (o) {\n const a = Qg(e, o, s);\n o.data = a;\n }\n }\n}\nfunction kg(e, t, n, s, r) {\n let i = [];\n const o = r.bufferView, a = e.getTypedArrayForBufferView(o), c = Kg(e, n, r, s), u = zg(e, n, r, s);\n return n.type === \"STRING\" || n.componentType === \"STRING\" ? i = Xa(s, a, c, u) : Wg(n) && (i = Xg(n, s, a, c)), i;\n}\nfunction Kg(e, t, n, s) {\n return t.type === \"ARRAY\" && typeof t.componentCount > \"u\" && typeof n.arrayOffsetBufferView < \"u\" ? Yn(e, n.arrayOffsetBufferView, n.offsetType || \"UINT32\", s) : null;\n}\nfunction zg(e, t, n, s) {\n return typeof n.stringOffsetBufferView < \"u\" ? Yn(e, n.stringOffsetBufferView, n.offsetType || \"UINT32\", s) : null;\n}\nfunction Wg(e) {\n const t = [\"UINT8\", \"INT16\", \"UINT16\", \"INT32\", \"UINT32\", \"INT64\", \"UINT64\", \"FLOAT32\", \"FLOAT64\"];\n return t.includes(e.type) || typeof e.componentType < \"u\" && t.includes(e.componentType);\n}\nfunction Xg(e, t, n, s) {\n const r = e.type === \"ARRAY\", i = e.componentCount, o = \"SCALAR\", a = e.componentType || e.type, c = xr(o, a), u = n.byteLength / c, l = $n(n, o, a, u);\n return r ? s ? za(l, t, s, n.length, c) : i ? Wa(l, t, i) : [] : l;\n}\nfunction Qg(e, t, n) {\n const s = e.gltf.json;\n if (!s.meshes)\n return [];\n const r = [];\n for (const i of s.meshes)\n for (const o of i.primitives)\n qg(e, n, t, r, o);\n return r;\n}\nfunction qg(e, t, n, s, r) {\n const i = {\n channels: n.channels,\n ...n.texture\n }, o = vr(e, i, r);\n o && Ka(e, t, o, s, r);\n}\nconst Yg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n decode: Pg,\n name: Lg\n}, Symbol.toStringTag, { value: \"Module\" })), $g = \"4.1.1\", Zg = \"4.1.1\", Ln = {\n TRANSCODER: \"basis_transcoder.js\",\n TRANSCODER_WASM: \"basis_transcoder.wasm\",\n ENCODER: \"basis_encoder.js\",\n ENCODER_WASM: \"basis_encoder.wasm\"\n};\nlet bs;\nasync function Ni(e) {\n const t = e.modules || {};\n return t.basis ? t.basis : (bs = bs || t0(e), await bs);\n}\nasync function t0(e) {\n let t = null, n = null;\n return [t, n] = await Promise.all([await Zt(Ln.TRANSCODER, \"textures\", e), await Zt(Ln.TRANSCODER_WASM, \"textures\", e)]), t = t || globalThis.BASIS, await e0(t, n);\n}\nfunction e0(e, t) {\n const n = {};\n return t && (n.wasmBinary = t), new Promise((s) => {\n e(n).then((r) => {\n const {\n BasisFile: i,\n initializeBasis: o\n } = r;\n o(), s({\n BasisFile: i\n });\n });\n });\n}\nlet _s;\nasync function Ui(e) {\n const t = e.modules || {};\n return t.basisEncoder ? t.basisEncoder : (_s = _s || n0(e), await _s);\n}\nasync function n0(e) {\n let t = null, n = null;\n return [t, n] = await Promise.all([await Zt(Ln.ENCODER, \"textures\", e), await Zt(Ln.ENCODER_WASM, \"textures\", e)]), t = t || globalThis.BASIS, await s0(t, n);\n}\nfunction s0(e, t) {\n const n = {};\n return t && (n.wasmBinary = t), new Promise((s) => {\n e(n).then((r) => {\n const {\n BasisFile: i,\n KTX2File: o,\n initializeBasis: a,\n BasisEncoder: c\n } = r;\n a(), s({\n BasisFile: i,\n KTX2File: o,\n BasisEncoder: c\n });\n });\n });\n}\nconst he = {\n COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,\n COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,\n COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,\n COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,\n COMPRESSED_R11_EAC: 37488,\n COMPRESSED_SIGNED_R11_EAC: 37489,\n COMPRESSED_RG11_EAC: 37490,\n COMPRESSED_SIGNED_RG11_EAC: 37491,\n COMPRESSED_RGB8_ETC2: 37492,\n COMPRESSED_RGBA8_ETC2_EAC: 37493,\n COMPRESSED_SRGB8_ETC2: 37494,\n COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495,\n COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,\n COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,\n COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,\n COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,\n COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,\n COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,\n COMPRESSED_RGB_ETC1_WEBGL: 36196,\n COMPRESSED_RGB_ATC_WEBGL: 35986,\n COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,\n COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,\n COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,\n COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,\n COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,\n COMPRESSED_RGBA_ASTC_6X5_KHR: 37811,\n COMPRESSED_RGBA_ASTC_6X6_KHR: 37812,\n COMPRESSED_RGBA_ASTC_8X5_KHR: 37813,\n COMPRESSED_RGBA_ASTC_8X6_KHR: 37814,\n COMPRESSED_RGBA_ASTC_8X8_KHR: 37815,\n COMPRESSED_RGBA_ASTC_10X5_KHR: 37816,\n COMPRESSED_RGBA_ASTC_10X6_KHR: 37817,\n COMPRESSED_RGBA_ASTC_10X8_KHR: 37818,\n COMPRESSED_RGBA_ASTC_10X10_KHR: 37819,\n COMPRESSED_RGBA_ASTC_12X10_KHR: 37820,\n COMPRESSED_RGBA_ASTC_12X12_KHR: 37821,\n COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: 37840,\n COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: 37841,\n COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: 37842,\n COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: 37843,\n COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: 37844,\n COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: 37845,\n COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: 37846,\n COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: 37847,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: 37848,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: 37849,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: 37850,\n COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,\n COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,\n COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,\n COMPRESSED_RED_RGTC1_EXT: 36283,\n COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,\n COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,\n COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,\n COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,\n COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,\n COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,\n COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919\n}, r0 = [\"\", \"WEBKIT_\", \"MOZ_\"], Hi = {\n WEBGL_compressed_texture_s3tc: \"dxt\",\n WEBGL_compressed_texture_s3tc_srgb: \"dxt-srgb\",\n WEBGL_compressed_texture_etc1: \"etc1\",\n WEBGL_compressed_texture_etc: \"etc2\",\n WEBGL_compressed_texture_pvrtc: \"pvrtc\",\n WEBGL_compressed_texture_atc: \"atc\",\n WEBGL_compressed_texture_astc: \"astc\",\n EXT_texture_compression_rgtc: \"rgtc\"\n};\nlet gn = null;\nfunction i0(e) {\n if (!gn) {\n e = e || o0() || void 0, gn = /* @__PURE__ */ new Set();\n for (const t of r0)\n for (const n in Hi)\n if (e && e.getExtension(`${t}${n}`)) {\n const s = Hi[n];\n gn.add(s);\n }\n }\n return gn;\n}\nfunction o0() {\n try {\n return document.createElement(\"canvas\").getContext(\"webgl\");\n } catch {\n return null;\n }\n}\nvar Ji, Vi, ji, ki, Ki, zi, Wi, Xi;\n(function(e) {\n e[e.NONE = 0] = \"NONE\", e[e.BASISLZ = 1] = \"BASISLZ\", e[e.ZSTD = 2] = \"ZSTD\", e[e.ZLIB = 3] = \"ZLIB\";\n})(Ji || (Ji = {})), function(e) {\n e[e.BASICFORMAT = 0] = \"BASICFORMAT\";\n}(Vi || (Vi = {})), function(e) {\n e[e.UNSPECIFIED = 0] = \"UNSPECIFIED\", e[e.ETC1S = 163] = \"ETC1S\", e[e.UASTC = 166] = \"UASTC\";\n}(ji || (ji = {})), function(e) {\n e[e.UNSPECIFIED = 0] = \"UNSPECIFIED\", e[e.SRGB = 1] = \"SRGB\";\n}(ki || (ki = {})), function(e) {\n e[e.UNSPECIFIED = 0] = \"UNSPECIFIED\", e[e.LINEAR = 1] = \"LINEAR\", e[e.SRGB = 2] = \"SRGB\", e[e.ITU = 3] = \"ITU\", e[e.NTSC = 4] = \"NTSC\", e[e.SLOG = 5] = \"SLOG\", e[e.SLOG2 = 6] = \"SLOG2\";\n}(Ki || (Ki = {})), function(e) {\n e[e.ALPHA_STRAIGHT = 0] = \"ALPHA_STRAIGHT\", e[e.ALPHA_PREMULTIPLIED = 1] = \"ALPHA_PREMULTIPLIED\";\n}(zi || (zi = {})), function(e) {\n e[e.RGB = 0] = \"RGB\", e[e.RRR = 3] = \"RRR\", e[e.GGG = 4] = \"GGG\", e[e.AAA = 15] = \"AAA\";\n}(Wi || (Wi = {})), function(e) {\n e[e.RGB = 0] = \"RGB\", e[e.RGBA = 3] = \"RGBA\", e[e.RRR = 4] = \"RRR\", e[e.RRRG = 5] = \"RRRG\";\n}(Xi || (Xi = {}));\nconst gt = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];\nfunction a0(e) {\n const t = new Uint8Array(e);\n return !(t.byteLength < gt.length || t[0] !== gt[0] || t[1] !== gt[1] || t[2] !== gt[2] || t[3] !== gt[3] || t[4] !== gt[4] || t[5] !== gt[5] || t[6] !== gt[6] || t[7] !== gt[7] || t[8] !== gt[8] || t[9] !== gt[9] || t[10] !== gt[10] || t[11] !== gt[11]);\n}\nconst c0 = {\n etc1: {\n basisFormat: 0,\n compressed: !0,\n format: he.COMPRESSED_RGB_ETC1_WEBGL\n },\n etc2: {\n basisFormat: 1,\n compressed: !0\n },\n bc1: {\n basisFormat: 2,\n compressed: !0,\n format: he.COMPRESSED_RGB_S3TC_DXT1_EXT\n },\n bc3: {\n basisFormat: 3,\n compressed: !0,\n format: he.COMPRESSED_RGBA_S3TC_DXT5_EXT\n },\n bc4: {\n basisFormat: 4,\n compressed: !0\n },\n bc5: {\n basisFormat: 5,\n compressed: !0\n },\n \"bc7-m6-opaque-only\": {\n basisFormat: 6,\n compressed: !0\n },\n \"bc7-m5\": {\n basisFormat: 7,\n compressed: !0\n },\n \"pvrtc1-4-rgb\": {\n basisFormat: 8,\n compressed: !0,\n format: he.COMPRESSED_RGB_PVRTC_4BPPV1_IMG\n },\n \"pvrtc1-4-rgba\": {\n basisFormat: 9,\n compressed: !0,\n format: he.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG\n },\n \"astc-4x4\": {\n basisFormat: 10,\n compressed: !0,\n format: he.COMPRESSED_RGBA_ASTC_4X4_KHR\n },\n \"atc-rgb\": {\n basisFormat: 11,\n compressed: !0\n },\n \"atc-rgba-interpolated-alpha\": {\n basisFormat: 12,\n compressed: !0\n },\n rgba32: {\n basisFormat: 13,\n compressed: !1\n },\n rgb565: {\n basisFormat: 14,\n compressed: !1\n },\n bgr565: {\n basisFormat: 15,\n compressed: !1\n },\n rgba4444: {\n basisFormat: 16,\n compressed: !1\n }\n};\nasync function u0(e, t) {\n if (t.basis.containerFormat === \"auto\") {\n if (a0(e)) {\n const s = await Ui(t);\n return Qi(s.KTX2File, e, t);\n }\n const {\n BasisFile: n\n } = await Ni(t);\n return ws(n, e, t);\n }\n switch (t.basis.module) {\n case \"encoder\":\n const n = await Ui(t);\n switch (t.basis.containerFormat) {\n case \"ktx2\":\n return Qi(n.KTX2File, e, t);\n case \"basis\":\n default:\n return ws(n.BasisFile, e, t);\n }\n case \"transcoder\":\n default:\n const {\n BasisFile: s\n } = await Ni(t);\n return ws(s, e, t);\n }\n}\nfunction ws(e, t, n) {\n const s = new e(new Uint8Array(t));\n try {\n if (!s.startTranscoding())\n throw new Error(\"Failed to start basis transcoding\");\n const r = s.getNumImages(), i = [];\n for (let o = 0; o < r; o++) {\n const a = s.getNumLevels(o), c = [];\n for (let u = 0; u < a; u++)\n c.push(l0(s, o, u, n));\n i.push(c);\n }\n return i;\n } finally {\n s.close(), s.delete();\n }\n}\nfunction l0(e, t, n, s) {\n const r = e.getImageWidth(t, n), i = e.getImageHeight(t, n), o = e.getHasAlpha(), {\n compressed: a,\n format: c,\n basisFormat: u\n } = Ya(s, o), l = e.getImageTranscodedSizeInBytes(t, n, u), h = new Uint8Array(l);\n if (!e.transcodeImage(h, t, n, u, 0, 0))\n throw new Error(\"failed to start Basis transcoding\");\n return {\n width: r,\n height: i,\n data: h,\n compressed: a,\n format: c,\n hasAlpha: o\n };\n}\nfunction Qi(e, t, n) {\n const s = new e(new Uint8Array(t));\n try {\n if (!s.startTranscoding())\n throw new Error(\"failed to start KTX2 transcoding\");\n const r = s.getLevels(), i = [];\n for (let o = 0; o < r; o++) {\n i.push(h0(s, o, n));\n break;\n }\n return [i];\n } finally {\n s.close(), s.delete();\n }\n}\nfunction h0(e, t, n) {\n const {\n alphaFlag: s,\n height: r,\n width: i\n } = e.getImageLevelInfo(t, 0, 0), {\n compressed: o,\n format: a,\n basisFormat: c\n } = Ya(n, s), u = e.getImageTranscodedSizeInBytes(t, 0, 0, c), l = new Uint8Array(u);\n if (!e.transcodeImage(l, t, 0, 0, c, 0, -1, -1))\n throw new Error(\"Failed to transcode KTX2 image\");\n return {\n width: i,\n height: r,\n data: l,\n compressed: o,\n levelSize: u,\n hasAlpha: s,\n format: a\n };\n}\nfunction Ya(e, t) {\n let n = e && e.basis && e.basis.format;\n return n === \"auto\" && (n = $a()), typeof n == \"object\" && (n = t ? n.alpha : n.noAlpha), n = n.toLowerCase(), c0[n];\n}\nfunction $a() {\n const e = i0();\n return e.has(\"astc\") ? \"astc-4x4\" : e.has(\"dxt\") ? {\n alpha: \"bc3\",\n noAlpha: \"bc1\"\n } : e.has(\"pvrtc\") ? {\n alpha: \"pvrtc1-4-rgba\",\n noAlpha: \"pvrtc1-4-rgb\"\n } : e.has(\"etc1\") ? \"etc1\" : e.has(\"etc2\") ? \"etc2\" : \"rgb565\";\n}\nconst f0 = {\n name: \"Basis\",\n id: \"basis\",\n module: \"textures\",\n version: Zg,\n worker: !0,\n extensions: [\"basis\", \"ktx2\"],\n mimeTypes: [\"application/octet-stream\", \"image/ktx2\"],\n tests: [\"sB\"],\n binary: !0,\n options: {\n basis: {\n format: \"auto\",\n libraryPath: \"libs/\",\n containerFormat: \"auto\",\n module: \"transcoder\"\n }\n }\n}, d0 = {\n ...f0,\n parse: u0\n}, pe = !0, qi = 1735152710, Dr = 12, Pn = 8, m0 = 1313821514, g0 = 5130562, A0 = 0, p0 = 0, y0 = 1;\nfunction B0(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;\n return `${String.fromCharCode(e.getUint8(t + 0))}${String.fromCharCode(e.getUint8(t + 1))}${String.fromCharCode(e.getUint8(t + 2))}${String.fromCharCode(e.getUint8(t + 3))}`;\n}\nfunction C0(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};\n const s = new DataView(e), {\n magic: r = qi\n } = n, i = s.getUint32(t, !1);\n return i === r || i === qi;\n}\nfunction E0(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;\n const s = new DataView(t), r = B0(s, n + 0), i = s.getUint32(n + 4, pe), o = s.getUint32(n + 8, pe);\n switch (Object.assign(e, {\n header: {\n byteOffset: n,\n byteLength: o,\n hasBinChunk: !1\n },\n type: r,\n version: i,\n json: {},\n binChunks: []\n }), n += Dr, e.version) {\n case 1:\n return T0(e, s, n);\n case 2:\n return b0(e, s, n, {});\n default:\n throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`);\n }\n}\nfunction T0(e, t, n) {\n K(e.header.byteLength > Dr + Pn);\n const s = t.getUint32(n + 0, pe), r = t.getUint32(n + 4, pe);\n return n += Pn, K(r === A0), Ys(e, t, n, s), n += s, n += $s(e, t, n, e.header.byteLength), n;\n}\nfunction b0(e, t, n, s) {\n return K(e.header.byteLength > Dr + Pn), _0(e, t, n, s), n + e.header.byteLength;\n}\nfunction _0(e, t, n, s) {\n for (; n + 8 <= e.header.byteLength; ) {\n const r = t.getUint32(n + 0, pe), i = t.getUint32(n + 4, pe);\n switch (n += Pn, i) {\n case m0:\n Ys(e, t, n, r);\n break;\n case g0:\n $s(e, t, n, r);\n break;\n case p0:\n s.strict || Ys(e, t, n, r);\n break;\n case y0:\n s.strict || $s(e, t, n, r);\n break;\n }\n n += ze(r, 4);\n }\n return n;\n}\nfunction Ys(e, t, n, s) {\n const r = new Uint8Array(t.buffer, n, s), o = new TextDecoder(\"utf8\").decode(r);\n return e.json = JSON.parse(o), ze(s, 4);\n}\nfunction $s(e, t, n, s) {\n return e.header.hasBinChunk = !0, e.binChunks.push({\n byteOffset: n,\n byteLength: s,\n arrayBuffer: t.buffer\n }), ze(s, 4);\n}\nfunction Za(e, t) {\n if (e.startsWith(\"data:\") || e.startsWith(\"http:\") || e.startsWith(\"https:\"))\n return e;\n const s = t.baseUri || t.uri;\n if (!s)\n throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);\n return s.substr(0, s.lastIndexOf(\"/\") + 1) + e;\n}\nconst w0 = \"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\", R0 = \"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\", M0 = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11]), S0 = new Uint8Array([32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113, 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101, 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167]), I0 = {\n 0: \"\",\n 1: \"meshopt_decodeFilterOct\",\n 2: \"meshopt_decodeFilterQuat\",\n 3: \"meshopt_decodeFilterExp\",\n NONE: \"\",\n OCTAHEDRAL: \"meshopt_decodeFilterOct\",\n QUATERNION: \"meshopt_decodeFilterQuat\",\n EXPONENTIAL: \"meshopt_decodeFilterExp\"\n}, x0 = {\n 0: \"meshopt_decodeVertexBuffer\",\n 1: \"meshopt_decodeIndexBuffer\",\n 2: \"meshopt_decodeIndexSequence\",\n ATTRIBUTES: \"meshopt_decodeVertexBuffer\",\n TRIANGLES: \"meshopt_decodeIndexBuffer\",\n INDICES: \"meshopt_decodeIndexSequence\"\n};\nasync function v0(e, t, n, s, r) {\n let i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : \"NONE\";\n const o = await O0();\n L0(o, o.exports[x0[r]], e, t, n, s, o.exports[I0[i || \"NONE\"]]);\n}\nlet Rs;\nasync function O0() {\n return Rs || (Rs = F0()), Rs;\n}\nasync function F0() {\n let e = w0;\n WebAssembly.validate(M0) && (e = R0, console.log(\"Warning: meshopt_decoder is using experimental SIMD support\"));\n const t = await WebAssembly.instantiate(D0(e), {});\n return await t.instance.exports.__wasm_call_ctors(), t.instance;\n}\nfunction D0(e) {\n const t = new Uint8Array(e.length);\n for (let s = 0; s < e.length; ++s) {\n const r = e.charCodeAt(s);\n t[s] = r > 96 ? r - 71 : r > 64 ? r - 65 : r > 47 ? r + 4 : r > 46 ? 63 : 62;\n }\n let n = 0;\n for (let s = 0; s < e.length; ++s)\n t[n++] = t[s] < 60 ? S0[t[s]] : (t[s] - 60) * 64 + t[++s];\n return t.buffer.slice(0, n);\n}\nfunction L0(e, t, n, s, r, i, o) {\n const a = e.exports.sbrk, c = s + 3 & -4, u = a(c * r), l = a(i.length), h = new Uint8Array(e.exports.memory.buffer);\n h.set(i, l);\n const f = t(u, s, r, l, i.length);\n if (f === 0 && o && o(u, c, r), n.set(h.subarray(u, u + s * r)), a(u - a(0)), f !== 0)\n throw new Error(`Malformed buffer data: ${f}`);\n}\nconst Gn = \"EXT_meshopt_compression\", P0 = Gn;\nasync function G0(e, t) {\n var n, s;\n const r = new it(e);\n if (!(t != null && (n = t.gltf) !== null && n !== void 0 && n.decompressMeshes) || !((s = t.gltf) !== null && s !== void 0 && s.loadBuffers))\n return;\n const i = [];\n for (const o of e.json.bufferViews || [])\n i.push(N0(r, o));\n await Promise.all(i), r.removeExtension(Gn);\n}\nasync function N0(e, t) {\n const n = e.getObjectExtension(t, Gn);\n if (n) {\n const {\n byteOffset: s = 0,\n byteLength: r = 0,\n byteStride: i,\n count: o,\n mode: a,\n filter: c = \"NONE\",\n buffer: u\n } = n, l = e.gltf.buffers[u], h = new Uint8Array(l.arrayBuffer, l.byteOffset + s, r), f = new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer, t.byteOffset, t.byteLength);\n await v0(f, o, i, h, a, c), e.removeObjectExtension(t, Gn);\n }\n}\nconst U0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n decode: G0,\n name: P0\n}, Symbol.toStringTag, { value: \"Module\" })), fe = \"EXT_texture_webp\", H0 = fe;\nfunction J0(e, t) {\n const n = new it(e);\n if (!qm(\"image/webp\")) {\n if (n.getRequiredExtensions().includes(fe))\n throw new Error(`gltf: Required extension ${fe} not supported by browser`);\n return;\n }\n const {\n json: s\n } = n;\n for (const r of s.textures || []) {\n const i = n.getObjectExtension(r, fe);\n i && (r.source = i.source), n.removeObjectExtension(r, fe);\n }\n n.removeExtension(fe);\n}\nconst V0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n name: H0,\n preprocess: J0\n}, Symbol.toStringTag, { value: \"Module\" })), _n = \"KHR_texture_basisu\", j0 = _n;\nfunction k0(e, t) {\n const n = new it(e), {\n json: s\n } = n;\n for (const r of s.textures || []) {\n const i = n.getObjectExtension(r, _n);\n i && (r.source = i.source, n.removeObjectExtension(r, _n));\n }\n n.removeExtension(_n);\n}\nconst K0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n name: j0,\n preprocess: k0\n}, Symbol.toStringTag, { value: \"Module\" }));\nfunction z0(e) {\n const t = {};\n for (const n in e) {\n const s = e[n];\n if (n !== \"indices\") {\n const r = tc(s);\n t[n] = r;\n }\n }\n return t;\n}\nfunction tc(e) {\n const {\n buffer: t,\n size: n,\n count: s\n } = W0(e);\n return {\n value: t,\n size: n,\n byteOffset: 0,\n count: s,\n type: Ja(n),\n componentType: Sr(t)\n };\n}\nfunction W0(e) {\n let t = e, n = 1, s = 0;\n return e && e.value && (t = e.value, n = e.size || 1), t && (ArrayBuffer.isView(t) || (t = X0(t, Float32Array)), s = t.length / n), {\n buffer: t,\n size: n,\n count: s\n };\n}\nfunction X0(e, t) {\n let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;\n return e ? Array.isArray(e) ? new t(e) : n && !(e instanceof t) ? new t(e) : e : null;\n}\nconst zt = \"KHR_draco_mesh_compression\", Q0 = zt;\nfunction q0(e, t, n) {\n const s = new it(e);\n for (const r of ec(s))\n s.getObjectExtension(r, zt);\n}\nasync function Y0(e, t, n) {\n var s;\n if (!(t != null && (s = t.gltf) !== null && s !== void 0 && s.decompressMeshes))\n return;\n const r = new it(e), i = [];\n for (const o of ec(r))\n r.getObjectExtension(o, zt) && i.push(Z0(r, o, t, n));\n await Promise.all(i), r.removeExtension(zt);\n}\nfunction $0(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n const n = new it(e);\n for (const s of n.json.meshes || [])\n tA(s, t), n.addRequiredExtension(zt);\n}\nasync function Z0(e, t, n, s) {\n const r = e.getObjectExtension(t, zt);\n if (!r)\n return;\n const i = e.getTypedArrayForBufferView(r.bufferView), o = dr(i.buffer, i.byteOffset), a = {\n ...n\n };\n delete a[\"3d-tiles\"];\n const c = await Ke(o, Oa, a, s), u = z0(c.attributes);\n for (const [l, h] of Object.entries(u))\n if (l in t.attributes) {\n const f = t.attributes[l], d = e.getAccessor(f);\n d != null && d.min && d !== null && d !== void 0 && d.max && (h.min = d.min, h.max = d.max);\n }\n t.attributes = u, c.indices && (t.indices = tc(c.indices)), e.removeObjectExtension(t, zt), eA(t);\n}\nfunction tA(e, t) {\n var n;\n let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 4, r = arguments.length > 3 ? arguments[3] : void 0, i = arguments.length > 4 ? arguments[4] : void 0;\n if (!r.DracoWriter)\n throw new Error(\"options.gltf.DracoWriter not provided\");\n const o = r.DracoWriter.encodeSync({\n attributes: e\n }), a = i == null || (n = i.parseSync) === null || n === void 0 ? void 0 : n.call(i, {\n attributes: e\n }), c = r._addFauxAttributes(a.attributes), u = r.addBufferView(o);\n return {\n primitives: [{\n attributes: c,\n mode: s,\n extensions: {\n [zt]: {\n bufferView: u,\n attributes: c\n }\n }\n }]\n };\n}\nfunction eA(e) {\n if (!e.attributes && Object.keys(e.attributes).length > 0)\n throw new Error(\"glTF: Empty primitive detected: Draco decompression failure?\");\n}\nfunction* ec(e) {\n for (const t of e.json.meshes || [])\n for (const n of t.primitives)\n yield n;\n}\nconst nA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n decode: Y0,\n encode: $0,\n name: Q0,\n preprocess: q0\n}, Symbol.toStringTag, { value: \"Module\" })), Lr = \"KHR_texture_transform\", sA = Lr, An = new A(), rA = new W(), iA = new W();\nasync function oA(e, t) {\n var n;\n if (!new it(e).hasExtension(Lr) || !((n = t.gltf) !== null && n !== void 0 && n.loadBuffers))\n return;\n const i = e.json.materials || [];\n for (let o = 0; o < i.length; o++)\n aA(o, e);\n}\nfunction aA(e, t) {\n var n, s, r;\n const i = [], o = (n = t.json.materials) === null || n === void 0 ? void 0 : n[e], a = o == null || (s = o.pbrMetallicRoughness) === null || s === void 0 ? void 0 : s.baseColorTexture;\n a && Me(t, e, a, i);\n const c = o == null ? void 0 : o.emissiveTexture;\n c && Me(t, e, c, i);\n const u = o == null ? void 0 : o.normalTexture;\n u && Me(t, e, u, i);\n const l = o == null ? void 0 : o.occlusionTexture;\n l && Me(t, e, l, i);\n const h = o == null || (r = o.pbrMetallicRoughness) === null || r === void 0 ? void 0 : r.metallicRoughnessTexture;\n h && Me(t, e, h, i);\n}\nfunction Me(e, t, n, s) {\n const r = cA(n, s);\n if (!r)\n return;\n const i = e.json.meshes || [];\n for (const o of i)\n for (const a of o.primitives) {\n const c = a.material;\n Number.isFinite(c) && t === c && uA(e, a, r);\n }\n}\nfunction cA(e, t) {\n var n;\n const s = (n = e.extensions) === null || n === void 0 ? void 0 : n[Lr], {\n texCoord: r = 0\n } = e, {\n texCoord: i = r\n } = s;\n if (!(t.findIndex((a) => {\n let [c, u] = a;\n return c === r && u === i;\n }) !== -1)) {\n const a = fA(s);\n return r !== i && (e.texCoord = i), t.push([r, i]), {\n originalTexCoord: r,\n texCoord: i,\n matrix: a\n };\n }\n return null;\n}\nfunction uA(e, t, n) {\n const {\n originalTexCoord: s,\n texCoord: r,\n matrix: i\n } = n, o = t.attributes[`TEXCOORD_${s}`];\n if (Number.isFinite(o)) {\n var a;\n const u = (a = e.json.accessors) === null || a === void 0 ? void 0 : a[o];\n if (u && u.bufferView) {\n var c;\n const l = (c = e.json.bufferViews) === null || c === void 0 ? void 0 : c[u.bufferView];\n if (l) {\n const {\n arrayBuffer: h,\n byteOffset: f\n } = e.buffers[l.buffer], d = (f || 0) + (u.byteOffset || 0) + (l.byteOffset || 0), {\n ArrayType: m,\n length: g\n } = Ir(u, l), y = Ha[u.componentType], E = Ua[u.type], R = l.byteStride || y * E, B = new Float32Array(g);\n for (let C = 0; C < u.count; C++) {\n const M = new m(h, d + C * R, 2);\n An.set(M[0], M[1], 1), An.transformByMatrix3(i), B.set([An[0], An[1]], C * E);\n }\n s === r ? lA(u, l, e.buffers, B) : hA(r, u, t, e, B);\n }\n }\n }\n}\nfunction lA(e, t, n, s) {\n e.componentType = 5126, n.push({\n arrayBuffer: s.buffer,\n byteOffset: 0,\n byteLength: s.buffer.byteLength\n }), t.buffer = n.length - 1, t.byteLength = s.buffer.byteLength, t.byteOffset = 0, delete t.byteStride;\n}\nfunction hA(e, t, n, s, r) {\n s.buffers.push({\n arrayBuffer: r.buffer,\n byteOffset: 0,\n byteLength: r.buffer.byteLength\n });\n const i = s.json.bufferViews;\n if (!i)\n return;\n i.push({\n buffer: s.buffers.length - 1,\n byteLength: r.buffer.byteLength,\n byteOffset: 0\n });\n const o = s.json.accessors;\n o && (o.push({\n bufferView: (i == null ? void 0 : i.length) - 1,\n byteOffset: 0,\n componentType: 5126,\n count: t.count,\n type: \"VEC2\"\n }), n.attributes[`TEXCOORD_${e}`] = o.length - 1);\n}\nfunction fA(e) {\n const {\n offset: t = [0, 0],\n rotation: n = 0,\n scale: s = [1, 1]\n } = e, r = new W().set(1, 0, 0, 0, 1, 0, t[0], t[1], 1), i = rA.set(Math.cos(n), Math.sin(n), 0, -Math.sin(n), Math.cos(n), 0, 0, 0, 1), o = iA.set(s[0], 0, 0, 0, s[1], 0, 0, 0, 1);\n return r.multiplyRight(i).multiplyRight(o);\n}\nconst dA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n decode: oA,\n name: sA\n}, Symbol.toStringTag, { value: \"Module\" })), Yt = \"KHR_lights_punctual\", mA = Yt;\nasync function gA(e) {\n const t = new it(e), {\n json: n\n } = t, s = t.getExtension(Yt);\n s && (t.json.lights = s.lights, t.removeExtension(Yt));\n for (const r of n.nodes || []) {\n const i = t.getObjectExtension(r, Yt);\n i && (r.light = i.light), t.removeObjectExtension(r, Yt);\n }\n}\nasync function AA(e) {\n const t = new it(e), {\n json: n\n } = t;\n if (n.lights) {\n const s = t.addExtension(Yt);\n yt(!s.lights), s.lights = n.lights, delete n.lights;\n }\n if (t.json.lights) {\n for (const s of t.json.lights) {\n const r = s.node;\n t.addObjectExtension(r, Yt, s);\n }\n delete t.json.lights;\n }\n}\nconst pA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n decode: gA,\n encode: AA,\n name: mA\n}, Symbol.toStringTag, { value: \"Module\" })), Ue = \"KHR_materials_unlit\", yA = Ue;\nasync function BA(e) {\n const t = new it(e), {\n json: n\n } = t;\n for (const s of n.materials || [])\n s.extensions && s.extensions.KHR_materials_unlit && (s.unlit = !0), t.removeObjectExtension(s, Ue);\n t.removeExtension(Ue);\n}\nfunction CA(e) {\n const t = new it(e), {\n json: n\n } = t;\n if (t.materials)\n for (const s of n.materials || [])\n s.unlit && (delete s.unlit, t.addObjectExtension(s, Ue, {}), t.addExtension(Ue));\n}\nconst EA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n decode: BA,\n encode: CA,\n name: yA\n}, Symbol.toStringTag, { value: \"Module\" })), xe = \"KHR_techniques_webgl\", TA = xe;\nasync function bA(e) {\n const t = new it(e), {\n json: n\n } = t, s = t.getExtension(xe);\n if (s) {\n const r = wA(s, t);\n for (const i of n.materials || []) {\n const o = t.getObjectExtension(i, xe);\n o && (i.technique = Object.assign({}, o, r[o.technique]), i.technique.values = RA(i.technique, t)), t.removeObjectExtension(i, xe);\n }\n t.removeExtension(xe);\n }\n}\nasync function _A(e, t) {\n}\nfunction wA(e, t) {\n const {\n programs: n = [],\n shaders: s = [],\n techniques: r = []\n } = e, i = new TextDecoder();\n return s.forEach((o) => {\n if (Number.isFinite(o.bufferView))\n o.code = i.decode(t.getTypedArrayForBufferView(o.bufferView));\n else\n throw new Error(\"KHR_techniques_webgl: no shader code\");\n }), n.forEach((o) => {\n o.fragmentShader = s[o.fragmentShader], o.vertexShader = s[o.vertexShader];\n }), r.forEach((o) => {\n o.program = n[o.program];\n }), r;\n}\nfunction RA(e, t) {\n const n = Object.assign({}, e.values);\n return Object.keys(e.uniforms || {}).forEach((s) => {\n e.uniforms[s].value && !(s in n) && (n[s] = e.uniforms[s].value);\n }), Object.keys(n).forEach((s) => {\n typeof n[s] == \"object\" && n[s].index !== void 0 && (n[s].texture = t.getTexture(n[s].index));\n }), n;\n}\nconst MA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n decode: bA,\n encode: _A,\n name: TA\n}, Symbol.toStringTag, { value: \"Module\" })), nc = [Dg, Ag, U0, V0, K0, nA, pA, EA, MA, dA, Yg];\nfunction SA(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 ? arguments[2] : void 0;\n const s = nc.filter((i) => sc(i.name, t));\n for (const i of s) {\n var r;\n (r = i.preprocess) === null || r === void 0 || r.call(i, e, t, n);\n }\n}\nasync function IA(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 ? arguments[2] : void 0;\n const s = nc.filter((i) => sc(i.name, t));\n for (const i of s) {\n var r;\n await ((r = i.decode) === null || r === void 0 ? void 0 : r.call(i, e, t, n));\n }\n}\nfunction sc(e, t) {\n var n;\n const s = (t == null || (n = t.gltf) === null || n === void 0 ? void 0 : n.excludeExtensions) || {};\n return !(e in s && !s[e]);\n}\nconst Ms = \"KHR_binary_glTF\";\nfunction xA(e) {\n const t = new it(e), {\n json: n\n } = t;\n for (const s of n.images || []) {\n const r = t.getObjectExtension(s, Ms);\n r && Object.assign(s, r), t.removeObjectExtension(s, Ms);\n }\n n.buffers && n.buffers[0] && delete n.buffers[0].uri, t.removeExtension(Ms);\n}\nconst Yi = {\n accessors: \"accessor\",\n animations: \"animation\",\n buffers: \"buffer\",\n bufferViews: \"bufferView\",\n images: \"image\",\n materials: \"material\",\n meshes: \"mesh\",\n nodes: \"node\",\n samplers: \"sampler\",\n scenes: \"scene\",\n skins: \"skin\",\n textures: \"texture\"\n}, vA = {\n accessor: \"accessors\",\n animations: \"animation\",\n buffer: \"buffers\",\n bufferView: \"bufferViews\",\n image: \"images\",\n material: \"materials\",\n mesh: \"meshes\",\n node: \"nodes\",\n sampler: \"samplers\",\n scene: \"scenes\",\n skin: \"skins\",\n texture: \"textures\"\n};\nclass OA {\n constructor() {\n this.idToIndexMap = {\n animations: {},\n accessors: {},\n buffers: {},\n bufferViews: {},\n images: {},\n materials: {},\n meshes: {},\n nodes: {},\n samplers: {},\n scenes: {},\n skins: {},\n textures: {}\n }, this.json = void 0;\n }\n normalize(t, n) {\n this.json = t.json;\n const s = t.json;\n switch (s.asset && s.asset.version) {\n case \"2.0\":\n return;\n case void 0:\n case \"1.0\":\n break;\n default:\n console.warn(`glTF: Unknown version ${s.asset.version}`);\n return;\n }\n if (!n.normalize)\n throw new Error(\"glTF v1 is not supported.\");\n console.warn(\"Converting glTF v1 to glTF v2 format. This is experimental and may fail.\"), this._addAsset(s), this._convertTopLevelObjectsToArrays(s), xA(t), this._convertObjectIdsToArrayIndices(s), this._updateObjects(s), this._updateMaterial(s);\n }\n _addAsset(t) {\n t.asset = t.asset || {}, t.asset.version = \"2.0\", t.asset.generator = t.asset.generator || \"Normalized to glTF 2.0 by loaders.gl\";\n }\n _convertTopLevelObjectsToArrays(t) {\n for (const n in Yi)\n this._convertTopLevelObjectToArray(t, n);\n }\n _convertTopLevelObjectToArray(t, n) {\n const s = t[n];\n if (!(!s || Array.isArray(s))) {\n t[n] = [];\n for (const r in s) {\n const i = s[r];\n i.id = i.id || r;\n const o = t[n].length;\n t[n].push(i), this.idToIndexMap[n][r] = o;\n }\n }\n }\n _convertObjectIdsToArrayIndices(t) {\n for (const n in Yi)\n this._convertIdsToIndices(t, n);\n \"scene\" in t && (t.scene = this._convertIdToIndex(t.scene, \"scene\"));\n for (const n of t.textures)\n this._convertTextureIds(n);\n for (const n of t.meshes)\n this._convertMeshIds(n);\n for (const n of t.nodes)\n this._convertNodeIds(n);\n for (const n of t.scenes)\n this._convertSceneIds(n);\n }\n _convertTextureIds(t) {\n t.source && (t.source = this._convertIdToIndex(t.source, \"image\"));\n }\n _convertMeshIds(t) {\n for (const n of t.primitives) {\n const {\n attributes: s,\n indices: r,\n material: i\n } = n;\n for (const o in s)\n s[o] = this._convertIdToIndex(s[o], \"accessor\");\n r && (n.indices = this._convertIdToIndex(r, \"accessor\")), i && (n.material = this._convertIdToIndex(i, \"material\"));\n }\n }\n _convertNodeIds(t) {\n t.children && (t.children = t.children.map((n) => this._convertIdToIndex(n, \"node\"))), t.meshes && (t.meshes = t.meshes.map((n) => this._convertIdToIndex(n, \"mesh\")));\n }\n _convertSceneIds(t) {\n t.nodes && (t.nodes = t.nodes.map((n) => this._convertIdToIndex(n, \"node\")));\n }\n _convertIdsToIndices(t, n) {\n t[n] || (console.warn(`gltf v1: json doesn't contain attribute ${n}`), t[n] = []);\n for (const s of t[n])\n for (const r in s) {\n const i = s[r], o = this._convertIdToIndex(i, r);\n s[r] = o;\n }\n }\n _convertIdToIndex(t, n) {\n const s = vA[n];\n if (s in this.idToIndexMap) {\n const r = this.idToIndexMap[s][t];\n if (!Number.isFinite(r))\n throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`);\n return r;\n }\n return t;\n }\n _updateObjects(t) {\n for (const n of this.json.buffers)\n delete n.type;\n }\n _updateMaterial(t) {\n for (const i of t.materials) {\n var n, s, r;\n i.pbrMetallicRoughness = {\n baseColorFactor: [1, 1, 1, 1],\n metallicFactor: 1,\n roughnessFactor: 1\n };\n const o = ((n = i.values) === null || n === void 0 ? void 0 : n.tex) || ((s = i.values) === null || s === void 0 ? void 0 : s.texture2d_0) || ((r = i.values) === null || r === void 0 ? void 0 : r.diffuseTex), a = t.textures.findIndex((c) => c.id === o);\n a !== -1 && (i.pbrMetallicRoughness.baseColorTexture = {\n index: a\n });\n }\n }\n}\nfunction FA(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n return new OA().normalize(e, t);\n}\nasync function DA(e, t) {\n var n, s, r;\n let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, o = arguments.length > 3 ? arguments[3] : void 0, a = arguments.length > 4 ? arguments[4] : void 0;\n return LA(e, t, i, o), FA(e, {\n normalize: o == null || (n = o.gltf) === null || n === void 0 ? void 0 : n.normalize\n }), SA(e, o, a), o != null && (s = o.gltf) !== null && s !== void 0 && s.loadBuffers && e.json.buffers && await PA(e, o, a), o != null && (r = o.gltf) !== null && r !== void 0 && r.loadImages && await GA(e, o, a), await IA(e, o, a), e;\n}\nfunction LA(e, t, n, s) {\n if (s.uri && (e.baseUri = s.uri), t instanceof ArrayBuffer && !C0(t, n, s) && (t = new TextDecoder().decode(t)), typeof t == \"string\")\n e.json = xu(t);\n else if (t instanceof ArrayBuffer) {\n const o = {};\n n = E0(o, t, n, s.glb), yt(o.type === \"glTF\", `Invalid GLB magic string ${o.type}`), e._glb = o, e.json = o.json;\n } else\n yt(!1, \"GLTF: must be ArrayBuffer or string\");\n const r = e.json.buffers || [];\n if (e.buffers = new Array(r.length).fill(null), e._glb && e._glb.header.hasBinChunk) {\n const {\n binChunks: o\n } = e._glb;\n e.buffers[0] = {\n arrayBuffer: o[0].arrayBuffer,\n byteOffset: o[0].byteOffset,\n byteLength: o[0].byteLength\n };\n }\n const i = e.json.images || [];\n e.images = new Array(i.length).fill({});\n}\nasync function PA(e, t, n) {\n const s = e.json.buffers || [];\n for (let o = 0; o < s.length; ++o) {\n const a = s[o];\n if (a.uri) {\n var r, i;\n const {\n fetch: c\n } = n;\n yt(c);\n const u = Za(a.uri, t), l = await (n == null || (r = n.fetch) === null || r === void 0 ? void 0 : r.call(n, u)), h = await (l == null || (i = l.arrayBuffer) === null || i === void 0 ? void 0 : i.call(l));\n e.buffers[o] = {\n arrayBuffer: h,\n byteOffset: 0,\n byteLength: h.byteLength\n }, delete a.uri;\n } else\n e.buffers[o] === null && (e.buffers[o] = {\n arrayBuffer: new ArrayBuffer(a.byteLength),\n byteOffset: 0,\n byteLength: a.byteLength\n });\n }\n}\nasync function GA(e, t, n) {\n const s = NA(e), r = e.json.images || [], i = [];\n for (const o of s)\n i.push(UA(e, r[o], o, t, n));\n return await Promise.all(i);\n}\nfunction NA(e) {\n const t = /* @__PURE__ */ new Set(), n = e.json.textures || [];\n for (const s of n)\n s.source !== void 0 && t.add(s.source);\n return Array.from(t).sort();\n}\nasync function UA(e, t, n, s, r) {\n let i;\n if (t.uri && !t.hasOwnProperty(\"bufferView\")) {\n const a = Za(t.uri, s), {\n fetch: c\n } = r;\n i = await (await c(a)).arrayBuffer(), t.bufferView = {\n data: i\n };\n }\n if (Number.isFinite(t.bufferView)) {\n const a = og(e.json, e.buffers, t.bufferView);\n i = dr(a.buffer, a.byteOffset, a.byteLength);\n }\n yt(i, \"glTF image has no data\");\n let o = await Ke(i, [Qm, d0], {\n ...s,\n mimeType: t.mimeType,\n basis: s.basis || {\n format: $a()\n }\n }, r);\n o && o[0] && (o = {\n compressed: !0,\n mipmaps: !1,\n width: o[0].width,\n height: o[0].height,\n data: o[0]\n }), e.images = e.images || [], e.images[n] = o;\n}\nconst Nn = {\n name: \"glTF\",\n id: \"gltf\",\n module: \"gltf\",\n version: $g,\n extensions: [\"gltf\", \"glb\"],\n mimeTypes: [\"model/gltf+json\", \"model/gltf-binary\"],\n text: !0,\n binary: !0,\n tests: [\"glTF\"],\n parse: HA,\n options: {\n gltf: {\n normalize: !0,\n loadBuffers: !0,\n loadImages: !0,\n decompressMeshes: !0\n },\n log: console\n }\n};\nasync function HA(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 ? arguments[2] : void 0;\n t = {\n ...Nn.options,\n ...t\n }, t.gltf = {\n ...Nn.options.gltf,\n ...t.gltf\n };\n const {\n byteOffset: s = 0\n } = t;\n return await DA({}, e, s, t, n);\n}\nconst JA = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n}, VA = {\n 5120: 1,\n 5121: 1,\n 5122: 2,\n 5123: 2,\n 5125: 4,\n 5126: 4\n}, Bt = {\n TEXTURE_MAG_FILTER: 10240,\n TEXTURE_MIN_FILTER: 10241,\n TEXTURE_WRAP_S: 10242,\n TEXTURE_WRAP_T: 10243,\n REPEAT: 10497,\n LINEAR: 9729,\n NEAREST_MIPMAP_LINEAR: 9986\n}, jA = {\n magFilter: Bt.TEXTURE_MAG_FILTER,\n minFilter: Bt.TEXTURE_MIN_FILTER,\n wrapS: Bt.TEXTURE_WRAP_S,\n wrapT: Bt.TEXTURE_WRAP_T\n}, kA = {\n [Bt.TEXTURE_MAG_FILTER]: Bt.LINEAR,\n [Bt.TEXTURE_MIN_FILTER]: Bt.NEAREST_MIPMAP_LINEAR,\n [Bt.TEXTURE_WRAP_S]: Bt.REPEAT,\n [Bt.TEXTURE_WRAP_T]: Bt.REPEAT\n};\nfunction KA() {\n return {\n id: \"default-sampler\",\n parameters: kA\n };\n}\nfunction zA(e) {\n return VA[e];\n}\nfunction WA(e) {\n return JA[e];\n}\nclass XA {\n constructor() {\n this.baseUri = \"\", this.jsonUnprocessed = void 0, this.json = void 0, this.buffers = [], this.images = [];\n }\n postProcess(t) {\n let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n const {\n json: s,\n buffers: r = [],\n images: i = []\n } = t, {\n baseUri: o = \"\"\n } = t;\n return yt(s), this.baseUri = o, this.buffers = r, this.images = i, this.jsonUnprocessed = s, this.json = this._resolveTree(t.json, n), this.json;\n }\n _resolveTree(t) {\n const n = {\n ...t\n };\n return this.json = n, t.bufferViews && (n.bufferViews = t.bufferViews.map((s, r) => this._resolveBufferView(s, r))), t.images && (n.images = t.images.map((s, r) => this._resolveImage(s, r))), t.samplers && (n.samplers = t.samplers.map((s, r) => this._resolveSampler(s, r))), t.textures && (n.textures = t.textures.map((s, r) => this._resolveTexture(s, r))), t.accessors && (n.accessors = t.accessors.map((s, r) => this._resolveAccessor(s, r))), t.materials && (n.materials = t.materials.map((s, r) => this._resolveMaterial(s, r))), t.meshes && (n.meshes = t.meshes.map((s, r) => this._resolveMesh(s, r))), t.nodes && (n.nodes = t.nodes.map((s, r) => this._resolveNode(s, r)), n.nodes = n.nodes.map((s, r) => this._resolveNodeChildren(s))), t.skins && (n.skins = t.skins.map((s, r) => this._resolveSkin(s, r))), t.scenes && (n.scenes = t.scenes.map((s, r) => this._resolveScene(s, r))), typeof this.json.scene == \"number\" && n.scenes && (n.scene = n.scenes[this.json.scene]), n;\n }\n getScene(t) {\n return this._get(this.json.scenes, t);\n }\n getNode(t) {\n return this._get(this.json.nodes, t);\n }\n getSkin(t) {\n return this._get(this.json.skins, t);\n }\n getMesh(t) {\n return this._get(this.json.meshes, t);\n }\n getMaterial(t) {\n return this._get(this.json.materials, t);\n }\n getAccessor(t) {\n return this._get(this.json.accessors, t);\n }\n getCamera(t) {\n return this._get(this.json.cameras, t);\n }\n getTexture(t) {\n return this._get(this.json.textures, t);\n }\n getSampler(t) {\n return this._get(this.json.samplers, t);\n }\n getImage(t) {\n return this._get(this.json.images, t);\n }\n getBufferView(t) {\n return this._get(this.json.bufferViews, t);\n }\n getBuffer(t) {\n return this._get(this.json.buffers, t);\n }\n _get(t, n) {\n if (typeof n == \"object\")\n return n;\n const s = t && t[n];\n return s || console.warn(`glTF file error: Could not find ${t}[${n}]`), s;\n }\n _resolveScene(t, n) {\n return {\n ...t,\n id: t.id || `scene-${n}`,\n nodes: (t.nodes || []).map((s) => this.getNode(s))\n };\n }\n _resolveNode(t, n) {\n const s = {\n ...t,\n id: (t == null ? void 0 : t.id) || `node-${n}`\n };\n return t.mesh !== void 0 && (s.mesh = this.getMesh(t.mesh)), t.camera !== void 0 && (s.camera = this.getCamera(t.camera)), t.skin !== void 0 && (s.skin = this.getSkin(t.skin)), t.meshes !== void 0 && t.meshes.length && (s.mesh = t.meshes.reduce((r, i) => {\n const o = this.getMesh(i);\n return r.id = o.id, r.primitives = r.primitives.concat(o.primitives), r;\n }, {\n primitives: []\n })), s;\n }\n _resolveNodeChildren(t) {\n return t.children && (t.children = t.children.map((n) => this.getNode(n))), t;\n }\n _resolveSkin(t, n) {\n const s = typeof t.inverseBindMatrices == \"number\" ? this.getAccessor(t.inverseBindMatrices) : void 0;\n return {\n ...t,\n id: t.id || `skin-${n}`,\n inverseBindMatrices: s\n };\n }\n _resolveMesh(t, n) {\n const s = {\n ...t,\n id: t.id || `mesh-${n}`,\n primitives: []\n };\n return t.primitives && (s.primitives = t.primitives.map((r) => {\n const i = {\n ...r,\n attributes: {},\n indices: void 0,\n material: void 0\n }, o = r.attributes;\n for (const a in o)\n i.attributes[a] = this.getAccessor(o[a]);\n return r.indices !== void 0 && (i.indices = this.getAccessor(r.indices)), r.material !== void 0 && (i.material = this.getMaterial(r.material)), i;\n })), s;\n }\n _resolveMaterial(t, n) {\n const s = {\n ...t,\n id: t.id || `material-${n}`\n };\n if (s.normalTexture && (s.normalTexture = {\n ...s.normalTexture\n }, s.normalTexture.texture = this.getTexture(s.normalTexture.index)), s.occlusionTexture && (s.occlusionTexture = {\n ...s.occlusionTexture\n }, s.occlusionTexture.texture = this.getTexture(s.occlusionTexture.index)), s.emissiveTexture && (s.emissiveTexture = {\n ...s.emissiveTexture\n }, s.emissiveTexture.texture = this.getTexture(s.emissiveTexture.index)), s.emissiveFactor || (s.emissiveFactor = s.emissiveTexture ? [1, 1, 1] : [0, 0, 0]), s.pbrMetallicRoughness) {\n s.pbrMetallicRoughness = {\n ...s.pbrMetallicRoughness\n };\n const r = s.pbrMetallicRoughness;\n r.baseColorTexture && (r.baseColorTexture = {\n ...r.baseColorTexture\n }, r.baseColorTexture.texture = this.getTexture(r.baseColorTexture.index)), r.metallicRoughnessTexture && (r.metallicRoughnessTexture = {\n ...r.metallicRoughnessTexture\n }, r.metallicRoughnessTexture.texture = this.getTexture(r.metallicRoughnessTexture.index));\n }\n return s;\n }\n _resolveAccessor(t, n) {\n const s = zA(t.componentType), r = WA(t.type), i = s * r, o = {\n ...t,\n id: t.id || `accessor-${n}`,\n bytesPerComponent: s,\n components: r,\n bytesPerElement: i,\n value: void 0,\n bufferView: void 0,\n sparse: void 0\n };\n if (t.bufferView !== void 0 && (o.bufferView = this.getBufferView(t.bufferView)), o.bufferView) {\n const a = o.bufferView.buffer, {\n ArrayType: c,\n byteLength: u\n } = Ir(o, o.bufferView), l = (o.bufferView.byteOffset || 0) + (o.byteOffset || 0) + a.byteOffset;\n let h = a.arrayBuffer.slice(l, l + u);\n o.bufferView.byteStride && (h = this._getValueFromInterleavedBuffer(a, l, o.bufferView.byteStride, o.bytesPerElement, o.count)), o.value = new c(h);\n }\n return o;\n }\n _getValueFromInterleavedBuffer(t, n, s, r, i) {\n const o = new Uint8Array(i * r);\n for (let a = 0; a < i; a++) {\n const c = n + a * s;\n o.set(new Uint8Array(t.arrayBuffer.slice(c, c + r)), a * r);\n }\n return o.buffer;\n }\n _resolveTexture(t, n) {\n return {\n ...t,\n id: t.id || `texture-${n}`,\n sampler: typeof t.sampler == \"number\" ? this.getSampler(t.sampler) : KA(),\n source: typeof t.source == \"number\" ? this.getImage(t.source) : void 0\n };\n }\n _resolveSampler(t, n) {\n const s = {\n id: t.id || `sampler-${n}`,\n ...t,\n parameters: {}\n };\n for (const r in s) {\n const i = this._enumSamplerParameter(r);\n i !== void 0 && (s.parameters[i] = s[r]);\n }\n return s;\n }\n _enumSamplerParameter(t) {\n return jA[t];\n }\n _resolveImage(t, n) {\n const s = {\n ...t,\n id: t.id || `image-${n}`,\n image: null,\n bufferView: t.bufferView !== void 0 ? this.getBufferView(t.bufferView) : void 0\n }, r = this.images[n];\n return r && (s.image = r), s;\n }\n _resolveBufferView(t, n) {\n const s = t.buffer, r = this.buffers[s].arrayBuffer;\n let i = this.buffers[s].byteOffset || 0;\n return t.byteOffset && (i += t.byteOffset), {\n id: `bufferView-${n}`,\n ...t,\n buffer: this.buffers[s],\n data: new Uint8Array(r, i, t.byteLength)\n };\n }\n _resolveCamera(t, n) {\n const s = {\n ...t,\n id: t.id || `camera-${n}`\n };\n return s.perspective, s.orthographic, s;\n }\n}\nfunction rc(e, t) {\n return new XA().postProcess(e, t);\n}\nconst Zs = {\n URI: 0,\n EMBEDDED: 1\n};\nfunction ic(e, t, n, s) {\n e.rotateYtoZ = !0;\n const r = (e.byteOffset || 0) + (e.byteLength || 0) - n;\n if (r === 0)\n throw new Error(\"glTF byte length must be greater than 0.\");\n return e.gltfUpAxis = s != null && s[\"3d-tiles\"] && s[\"3d-tiles\"].assetGltfUpAxis ? s[\"3d-tiles\"].assetGltfUpAxis : \"Y\", e.gltfArrayBuffer = dr(t, n, r), e.gltfByteOffset = 0, e.gltfByteLength = r, n % 4 === 0 || console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`), (e.byteOffset || 0) + (e.byteLength || 0);\n}\nasync function oc(e, t, n, s) {\n const r = (n == null ? void 0 : n[\"3d-tiles\"]) || {};\n if (QA(e, t), r.loadGLTF) {\n if (!s)\n return;\n if (e.gltfUrl) {\n const {\n fetch: i\n } = s, o = await i(e.gltfUrl, n);\n e.gltfArrayBuffer = await o.arrayBuffer(), e.gltfByteOffset = 0;\n }\n if (e.gltfArrayBuffer) {\n const i = await Ke(e.gltfArrayBuffer, Nn, n, s);\n e.gltf = rc(i), e.gpuMemoryUsageInBytes = Va(e.gltf), delete e.gltfArrayBuffer, delete e.gltfByteOffset, delete e.gltfByteLength;\n }\n }\n}\nfunction QA(e, t, n) {\n switch (t) {\n case Zs.URI:\n if (e.gltfArrayBuffer) {\n const s = new Uint8Array(e.gltfArrayBuffer, e.gltfByteOffset), i = new TextDecoder().decode(s);\n e.gltfUrl = i.replace(/[\\s\\0]+$/, \"\");\n }\n delete e.gltfArrayBuffer, delete e.gltfByteOffset, delete e.gltfByteLength;\n break;\n case Zs.EMBEDDED:\n break;\n default:\n throw new Error(\"b3dm: Illegal glTF format field\");\n }\n}\nasync function qA(e, t, n, s, r) {\n var i;\n n = YA(e, t, n, s), await oc(e, Zs.EMBEDDED, s, r);\n const o = e == null || (i = e.gltf) === null || i === void 0 ? void 0 : i.extensions;\n return o && o.CESIUM_RTC && (e.rtcCenter = o.CESIUM_RTC.center), n;\n}\nfunction YA(e, t, n, s, r) {\n n = qn(e, t, n), n = _r(e, t, n), n = wr(e, t, n), n = ic(e, t, n, s);\n const i = new br(e.featureTableJson, e.featureTableBinary);\n return e.rtcCenter = i.getGlobalProperty(\"RTC_CENTER\", G.FLOAT, 3), n;\n}\nasync function $A(e, t, n, s, r) {\n return n = ZA(e, t, n, s), await oc(e, e.gltfFormat || 0, s, r), n;\n}\nfunction ZA(e, t, n, s, r) {\n var i;\n if (n = qn(e, t, n), e.version !== 1)\n throw new Error(`Instanced 3D Model version ${e.version} is not supported`);\n n = _r(e, t, n);\n const o = new DataView(t);\n if (e.gltfFormat = o.getUint32(n, !0), n += 4, n = wr(e, t, n), n = ic(e, t, n, s), !(e != null && (i = e.header) !== null && i !== void 0 && i.featureTableJsonByteLength) || e.header.featureTableJsonByteLength === 0)\n throw new Error(\"i3dm parser: featureTableJsonByteLength is zero.\");\n const a = new br(e.featureTableJson, e.featureTableBinary), c = a.getGlobalProperty(\"INSTANCES_LENGTH\");\n if (a.featuresLength = c, !Number.isFinite(c))\n throw new Error(\"i3dm parser: INSTANCES_LENGTH must be defined\");\n e.eastNorthUp = a.getGlobalProperty(\"EAST_NORTH_UP\"), e.rtcCenter = a.getGlobalProperty(\"RTC_CENTER\", G.FLOAT, 3);\n const u = new Da(e.batchTableJson, e.batchTableBinary, c);\n return tp(e, a, u, c), n;\n}\nfunction tp(e, t, n, s) {\n const r = new Array(s), i = new A();\n new A(), new A(), new A();\n const o = new W(), a = new On(), c = new A(), u = {}, l = new V(), h = [], f = [], d = [], m = [];\n for (let g = 0; g < s; g++) {\n let y;\n if (t.hasProperty(\"POSITION\"))\n y = t.getProperty(\"POSITION\", G.FLOAT, 3, g, i);\n else if (t.hasProperty(\"POSITION_QUANTIZED\")) {\n y = t.getProperty(\"POSITION_QUANTIZED\", G.UNSIGNED_SHORT, 3, g, i);\n const b = t.getGlobalProperty(\"QUANTIZED_VOLUME_OFFSET\", G.FLOAT, 3);\n if (!b)\n throw new Error(\"i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.\");\n const O = t.getGlobalProperty(\"QUANTIZED_VOLUME_SCALE\", G.FLOAT, 3);\n if (!O)\n throw new Error(\"i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.\");\n const F = 65535;\n for (let v = 0; v < 3; v++)\n y[v] = y[v] / F * O[v] + b[v];\n }\n if (!y)\n throw new Error(\"i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.\");\n if (i.copy(y), u.translation = i, e.normalUp = t.getProperty(\"NORMAL_UP\", G.FLOAT, 3, g, h), e.normalRight = t.getProperty(\"NORMAL_RIGHT\", G.FLOAT, 3, g, f), e.normalUp) {\n if (!e.normalRight)\n throw new Error(\"i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.\");\n e.hasCustomOrientation = !0;\n } else {\n if (e.octNormalUp = t.getProperty(\"NORMAL_UP_OCT32P\", G.UNSIGNED_SHORT, 2, g, h), e.octNormalRight = t.getProperty(\"NORMAL_RIGHT_OCT32P\", G.UNSIGNED_SHORT, 2, g, f), e.octNormalUp)\n throw e.octNormalRight ? new Error(\"i3dm: oct-encoded orientation not implemented\") : new Error(\"i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P\");\n e.eastNorthUp ? (J.WGS84.eastNorthUpToFixedFrame(i, l), l.getRotationMatrix3(o)) : o.identity();\n }\n a.fromMatrix3(o), u.rotation = a, c.set(1, 1, 1);\n const E = t.getProperty(\"SCALE\", G.FLOAT, 1, g, d);\n Number.isFinite(E) && c.multiplyByScalar(E);\n const R = t.getProperty(\"SCALE_NON_UNIFORM\", G.FLOAT, 3, g, h);\n R && c.scale(R), u.scale = c;\n let B = t.getProperty(\"BATCH_ID\", G.UNSIGNED_SHORT, 1, g, m);\n B === void 0 && (B = g);\n const C = new V().fromQuaternion(u.rotation);\n l.identity(), l.translate(u.translation), l.multiplyRight(C), l.scale(u.scale);\n const M = l.clone();\n r[g] = {\n modelMatrix: M,\n batchId: B\n };\n }\n e.instances = r;\n}\nasync function ep(e, t, n, s, r, i) {\n n = qn(e, t, n);\n const o = new DataView(t);\n for (e.tilesLength = o.getUint32(n, !0), n += 4, e.tiles = []; e.tiles.length < e.tilesLength && (e.byteLength || 0) - n > 12; ) {\n const a = {\n shape: \"tile3d\"\n };\n e.tiles.push(a), n = await i(t, n, s, r, a);\n }\n return n;\n}\nasync function np(e, t, n, s) {\n var r, i;\n if (e.rotateYtoZ = !0, e.gltfUpAxis = n != null && (r = n[\"3d-tiles\"]) !== null && r !== void 0 && r.assetGltfUpAxis ? n[\"3d-tiles\"].assetGltfUpAxis : \"Y\", n != null && (i = n[\"3d-tiles\"]) !== null && i !== void 0 && i.loadGLTF) {\n if (!s)\n return t.byteLength;\n const o = await Ke(t, Nn, n, s);\n e.gltf = rc(o), e.gpuMemoryUsageInBytes = Va(e.gltf);\n } else\n e.gltfArrayBuffer = t;\n return t.byteLength;\n}\nasync function ac(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 ? arguments[2] : void 0, s = arguments.length > 3 ? arguments[3] : void 0, r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {\n shape: \"tile3d\"\n };\n switch (r.byteOffset = t, r.type = _d(e, t), r.type) {\n case _e.COMPOSITE:\n return await ep(r, e, t, n, s, ac);\n case _e.BATCHED_3D_MODEL:\n return await qA(r, e, t, n, s);\n case _e.GLTF:\n return await np(r, e, n, s);\n case _e.INSTANCED_3D_MODEL:\n return await $A(r, e, t, n, s);\n case _e.POINT_CLOUD:\n return await cm(r, e, t, n, s);\n default:\n throw new Error(`3DTileLoader: unknown type ${r.type}`);\n }\n}\nconst sp = 1952609651, rp = 1;\nasync function ip(e, t, n) {\n if (new Uint32Array(e.slice(0, 4))[0] !== sp)\n throw new Error(\"Wrong subtree file magic number\");\n if (new Uint32Array(e.slice(4, 8))[0] !== rp)\n throw new Error(\"Wrong subtree file verson, must be 1\");\n const i = $i(e.slice(8, 16)), o = new Uint8Array(e, 24, i), c = new TextDecoder(\"utf8\").decode(o), u = JSON.parse(c), l = $i(e.slice(16, 24));\n let h = new ArrayBuffer(0);\n if (l && (h = e.slice(24 + i)), await pn(u, u.tileAvailability, h, n), Array.isArray(u.contentAvailability))\n for (const f of u.contentAvailability)\n await pn(u, f, h, n);\n else\n await pn(u, u.contentAvailability, h, n);\n return await pn(u, u.childSubtreeAvailability, h, n), u;\n}\nasync function pn(e, t, n, s) {\n const r = Number.isFinite(t.bitstream) ? t.bitstream : t.bufferView;\n if (typeof r != \"number\")\n return;\n const i = e.bufferViews[r], o = e.buffers[i.buffer];\n if (!(s != null && s.baseUrl))\n throw new Error(\"Url is not provided\");\n if (!s.fetch)\n throw new Error(\"fetch is not provided\");\n if (o.uri) {\n const c = `${(s == null ? void 0 : s.baseUrl) || \"\"}/${o.uri}`, l = await (await s.fetch(c)).arrayBuffer();\n t.explicitBitstream = new Uint8Array(l, i.byteOffset, i.byteLength);\n return;\n }\n const a = e.buffers.slice(0, i.buffer).reduce((c, u) => c + u.byteLength, 0);\n t.explicitBitstream = new Uint8Array(n.slice(a, a + o.byteLength), i.byteOffset, i.byteLength);\n}\nfunction $i(e) {\n const t = new DataView(e), n = t.getUint32(0, !0), s = t.getUint32(4, !0);\n return n + 2 ** 32 * s;\n}\nconst cc = {\n id: \"3d-tiles-subtree\",\n name: \"3D Tiles Subtree\",\n module: \"3d-tiles\",\n version: Ia,\n extensions: [\"subtree\"],\n mimeTypes: [\"application/octet-stream\"],\n tests: [\"subtree\"],\n parse: ip,\n options: {}\n};\n/**\n * @license\n * Copyright 2009 The Closure Library Authors\n * Copyright 2020 Daniel Wirtz / The long.js Authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n */\nvar Et = null;\ntry {\n Et = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\n 0,\n 97,\n 115,\n 109,\n 1,\n 0,\n 0,\n 0,\n 1,\n 13,\n 2,\n 96,\n 0,\n 1,\n 127,\n 96,\n 4,\n 127,\n 127,\n 127,\n 127,\n 1,\n 127,\n 3,\n 7,\n 6,\n 0,\n 1,\n 1,\n 1,\n 1,\n 1,\n 6,\n 6,\n 1,\n 127,\n 1,\n 65,\n 0,\n 11,\n 7,\n 50,\n 6,\n 3,\n 109,\n 117,\n 108,\n 0,\n 1,\n 5,\n 100,\n 105,\n 118,\n 95,\n 115,\n 0,\n 2,\n 5,\n 100,\n 105,\n 118,\n 95,\n 117,\n 0,\n 3,\n 5,\n 114,\n 101,\n 109,\n 95,\n 115,\n 0,\n 4,\n 5,\n 114,\n 101,\n 109,\n 95,\n 117,\n 0,\n 5,\n 8,\n 103,\n 101,\n 116,\n 95,\n 104,\n 105,\n 103,\n 104,\n 0,\n 0,\n 10,\n 191,\n 1,\n 6,\n 4,\n 0,\n 35,\n 0,\n 11,\n 36,\n 1,\n 1,\n 126,\n 32,\n 0,\n 173,\n 32,\n 1,\n 173,\n 66,\n 32,\n 134,\n 132,\n 32,\n 2,\n 173,\n 32,\n 3,\n 173,\n 66,\n 32,\n 134,\n 132,\n 126,\n 34,\n 4,\n 66,\n 32,\n 135,\n 167,\n 36,\n 0,\n 32,\n 4,\n 167,\n 11,\n 36,\n 1,\n 1,\n 126,\n 32,\n 0,\n 173,\n 32,\n 1,\n 173,\n 66,\n 32,\n 134,\n 132,\n 32,\n 2,\n 173,\n 32,\n 3,\n 173,\n 66,\n 32,\n 134,\n 132,\n 127,\n 34,\n 4,\n 66,\n 32,\n 135,\n 167,\n 36,\n 0,\n 32,\n 4,\n 167,\n 11,\n 36,\n 1,\n 1,\n 126,\n 32,\n 0,\n 173,\n 32,\n 1,\n 173,\n 66,\n 32,\n 134,\n 132,\n 32,\n 2,\n 173,\n 32,\n 3,\n 173,\n 66,\n 32,\n 134,\n 132,\n 128,\n 34,\n 4,\n 66,\n 32,\n 135,\n 167,\n 36,\n 0,\n 32,\n 4,\n 167,\n 11,\n 36,\n 1,\n 1,\n 126,\n 32,\n 0,\n 173,\n 32,\n 1,\n 173,\n 66,\n 32,\n 134,\n 132,\n 32,\n 2,\n 173,\n 32,\n 3,\n 173,\n 66,\n 32,\n 134,\n 132,\n 129,\n 34,\n 4,\n 66,\n 32,\n 135,\n 167,\n 36,\n 0,\n 32,\n 4,\n 167,\n 11,\n 36,\n 1,\n 1,\n 126,\n 32,\n 0,\n 173,\n 32,\n 1,\n 173,\n 66,\n 32,\n 134,\n 132,\n 32,\n 2,\n 173,\n 32,\n 3,\n 173,\n 66,\n 32,\n 134,\n 132,\n 130,\n 34,\n 4,\n 66,\n 32,\n 135,\n 167,\n 36,\n 0,\n 32,\n 4,\n 167,\n 11\n ])), {}).exports;\n} catch {\n}\nfunction H(e, t, n) {\n this.low = e | 0, this.high = t | 0, this.unsigned = !!n;\n}\nH.prototype.__isLong__;\nObject.defineProperty(H.prototype, \"__isLong__\", { value: !0 });\nfunction ot(e) {\n return (e && e.__isLong__) === !0;\n}\nfunction Zi(e) {\n var t = Math.clz32(e & -e);\n return e ? 31 - t : t;\n}\nH.isLong = ot;\nvar to = {}, eo = {};\nfunction ie(e, t) {\n var n, s, r;\n return t ? (e >>>= 0, (r = 0 <= e && e < 256) && (s = eo[e], s) ? s : (n = N(e, 0, !0), r && (eo[e] = n), n)) : (e |= 0, (r = -128 <= e && e < 128) && (s = to[e], s) ? s : (n = N(e, e < 0 ? -1 : 0, !1), r && (to[e] = n), n));\n}\nH.fromInt = ie;\nfunction Tt(e, t) {\n if (isNaN(e))\n return t ? Ut : St;\n if (t) {\n if (e < 0)\n return Ut;\n if (e >= uc)\n return fc;\n } else {\n if (e <= -so)\n return mt;\n if (e + 1 >= so)\n return hc;\n }\n return e < 0 ? Tt(-e, t).neg() : N(e % ye | 0, e / ye | 0, t);\n}\nH.fromNumber = Tt;\nfunction N(e, t, n) {\n return new H(e, t, n);\n}\nH.fromBits = N;\nvar Un = Math.pow;\nfunction Pr(e, t, n) {\n if (e.length === 0)\n throw Error(\"empty string\");\n if (typeof t == \"number\" ? (n = t, t = !1) : t = !!t, e === \"NaN\" || e === \"Infinity\" || e === \"+Infinity\" || e === \"-Infinity\")\n return t ? Ut : St;\n if (n = n || 10, n < 2 || 36 < n)\n throw RangeError(\"radix\");\n var s;\n if ((s = e.indexOf(\"-\")) > 0)\n throw Error(\"interior hyphen\");\n if (s === 0)\n return Pr(e.substring(1), t, n).neg();\n for (var r = Tt(Un(n, 8)), i = St, o = 0; o < e.length; o += 8) {\n var a = Math.min(8, e.length - o), c = parseInt(e.substring(o, o + a), n);\n if (a < 8) {\n var u = Tt(Un(n, a));\n i = i.mul(u).add(Tt(c));\n } else\n i = i.mul(r), i = i.add(Tt(c));\n }\n return i.unsigned = t, i;\n}\nH.fromString = Pr;\nfunction xt(e, t) {\n return typeof e == \"number\" ? Tt(e, t) : typeof e == \"string\" ? Pr(e, t) : N(e.low, e.high, typeof t == \"boolean\" ? t : e.unsigned);\n}\nH.fromValue = xt;\nvar no = 65536, op = 1 << 24, ye = no * no, uc = ye * ye, so = uc / 2, ro = ie(op), St = ie(0);\nH.ZERO = St;\nvar Ut = ie(0, !0);\nH.UZERO = Ut;\nvar de = ie(1);\nH.ONE = de;\nvar lc = ie(1, !0);\nH.UONE = lc;\nvar tr = ie(-1);\nH.NEG_ONE = tr;\nvar hc = N(-1, 2147483647, !1);\nH.MAX_VALUE = hc;\nvar fc = N(-1, -1, !0);\nH.MAX_UNSIGNED_VALUE = fc;\nvar mt = N(0, -2147483648, !1);\nH.MIN_VALUE = mt;\nvar _ = H.prototype;\n_.toInt = function() {\n return this.unsigned ? this.low >>> 0 : this.low;\n};\n_.toNumber = function() {\n return this.unsigned ? (this.high >>> 0) * ye + (this.low >>> 0) : this.high * ye + (this.low >>> 0);\n};\n_.toString = function(t) {\n if (t = t || 10, t < 2 || 36 < t)\n throw RangeError(\"radix\");\n if (this.isZero())\n return \"0\";\n if (this.isNegative())\n if (this.eq(mt)) {\n var n = Tt(t), s = this.div(n), r = s.mul(n).sub(this);\n return s.toString(t) + r.toInt().toString(t);\n } else\n return \"-\" + this.neg().toString(t);\n for (var i = Tt(Un(t, 6), this.unsigned), o = this, a = \"\"; ; ) {\n var c = o.div(i), u = o.sub(c.mul(i)).toInt() >>> 0, l = u.toString(t);\n if (o = c, o.isZero())\n return l + a;\n for (; l.length < 6; )\n l = \"0\" + l;\n a = \"\" + l + a;\n }\n};\n_.getHighBits = function() {\n return this.high;\n};\n_.getHighBitsUnsigned = function() {\n return this.high >>> 0;\n};\n_.getLowBits = function() {\n return this.low;\n};\n_.getLowBitsUnsigned = function() {\n return this.low >>> 0;\n};\n_.getNumBitsAbs = function() {\n if (this.isNegative())\n return this.eq(mt) ? 64 : this.neg().getNumBitsAbs();\n for (var t = this.high != 0 ? this.high : this.low, n = 31; n > 0 && !(t & 1 << n); n--)\n ;\n return this.high != 0 ? n + 33 : n + 1;\n};\n_.isZero = function() {\n return this.high === 0 && this.low === 0;\n};\n_.eqz = _.isZero;\n_.isNegative = function() {\n return !this.unsigned && this.high < 0;\n};\n_.isPositive = function() {\n return this.unsigned || this.high >= 0;\n};\n_.isOdd = function() {\n return (this.low & 1) === 1;\n};\n_.isEven = function() {\n return (this.low & 1) === 0;\n};\n_.equals = function(t) {\n return ot(t) || (t = xt(t)), this.unsigned !== t.unsigned && this.high >>> 31 === 1 && t.high >>> 31 === 1 ? !1 : this.high === t.high && this.low === t.low;\n};\n_.eq = _.equals;\n_.notEquals = function(t) {\n return !this.eq(\n /* validates */\n t\n );\n};\n_.neq = _.notEquals;\n_.ne = _.notEquals;\n_.lessThan = function(t) {\n return this.comp(\n /* validates */\n t\n ) < 0;\n};\n_.lt = _.lessThan;\n_.lessThanOrEqual = function(t) {\n return this.comp(\n /* validates */\n t\n ) <= 0;\n};\n_.lte = _.lessThanOrEqual;\n_.le = _.lessThanOrEqual;\n_.greaterThan = function(t) {\n return this.comp(\n /* validates */\n t\n ) > 0;\n};\n_.gt = _.greaterThan;\n_.greaterThanOrEqual = function(t) {\n return this.comp(\n /* validates */\n t\n ) >= 0;\n};\n_.gte = _.greaterThanOrEqual;\n_.ge = _.greaterThanOrEqual;\n_.compare = function(t) {\n if (ot(t) || (t = xt(t)), this.eq(t))\n return 0;\n var n = this.isNegative(), s = t.isNegative();\n return n && !s ? -1 : !n && s ? 1 : this.unsigned ? t.high >>> 0 > this.high >>> 0 || t.high === this.high && t.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(t).isNegative() ? -1 : 1;\n};\n_.comp = _.compare;\n_.negate = function() {\n return !this.unsigned && this.eq(mt) ? mt : this.not().add(de);\n};\n_.neg = _.negate;\n_.add = function(t) {\n ot(t) || (t = xt(t));\n var n = this.high >>> 16, s = this.high & 65535, r = this.low >>> 16, i = this.low & 65535, o = t.high >>> 16, a = t.high & 65535, c = t.low >>> 16, u = t.low & 65535, l = 0, h = 0, f = 0, d = 0;\n return d += i + u, f += d >>> 16, d &= 65535, f += r + c, h += f >>> 16, f &= 65535, h += s + a, l += h >>> 16, h &= 65535, l += n + o, l &= 65535, N(f << 16 | d, l << 16 | h, this.unsigned);\n};\n_.subtract = function(t) {\n return ot(t) || (t = xt(t)), this.add(t.neg());\n};\n_.sub = _.subtract;\n_.multiply = function(t) {\n if (this.isZero())\n return this;\n if (ot(t) || (t = xt(t)), Et) {\n var n = Et.mul(\n this.low,\n this.high,\n t.low,\n t.high\n );\n return N(n, Et.get_high(), this.unsigned);\n }\n if (t.isZero())\n return this.unsigned ? Ut : St;\n if (this.eq(mt))\n return t.isOdd() ? mt : St;\n if (t.eq(mt))\n return this.isOdd() ? mt : St;\n if (this.isNegative())\n return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg();\n if (t.isNegative())\n return this.mul(t.neg()).neg();\n if (this.lt(ro) && t.lt(ro))\n return Tt(this.toNumber() * t.toNumber(), this.unsigned);\n var s = this.high >>> 16, r = this.high & 65535, i = this.low >>> 16, o = this.low & 65535, a = t.high >>> 16, c = t.high & 65535, u = t.low >>> 16, l = t.low & 65535, h = 0, f = 0, d = 0, m = 0;\n return m += o * l, d += m >>> 16, m &= 65535, d += i * l, f += d >>> 16, d &= 65535, d += o * u, f += d >>> 16, d &= 65535, f += r * l, h += f >>> 16, f &= 65535, f += i * u, h += f >>> 16, f &= 65535, f += o * c, h += f >>> 16, f &= 65535, h += s * l + r * u + i * c + o * a, h &= 65535, N(d << 16 | m, h << 16 | f, this.unsigned);\n};\n_.mul = _.multiply;\n_.divide = function(t) {\n if (ot(t) || (t = xt(t)), t.isZero())\n throw Error(\"division by zero\");\n if (Et) {\n if (!this.unsigned && this.high === -2147483648 && t.low === -1 && t.high === -1)\n return this;\n var n = (this.unsigned ? Et.div_u : Et.div_s)(\n this.low,\n this.high,\n t.low,\n t.high\n );\n return N(n, Et.get_high(), this.unsigned);\n }\n if (this.isZero())\n return this.unsigned ? Ut : St;\n var s, r, i;\n if (this.unsigned) {\n if (t.unsigned || (t = t.toUnsigned()), t.gt(this))\n return Ut;\n if (t.gt(this.shru(1)))\n return lc;\n i = Ut;\n } else {\n if (this.eq(mt)) {\n if (t.eq(de) || t.eq(tr))\n return mt;\n if (t.eq(mt))\n return de;\n var o = this.shr(1);\n return s = o.div(t).shl(1), s.eq(St) ? t.isNegative() ? de : tr : (r = this.sub(t.mul(s)), i = s.add(r.div(t)), i);\n } else if (t.eq(mt))\n return this.unsigned ? Ut : St;\n if (this.isNegative())\n return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg();\n if (t.isNegative())\n return this.div(t.neg()).neg();\n i = St;\n }\n for (r = this; r.gte(t); ) {\n s = Math.max(1, Math.floor(r.toNumber() / t.toNumber()));\n for (var a = Math.ceil(Math.log(s) / Math.LN2), c = a <= 48 ? 1 : Un(2, a - 48), u = Tt(s), l = u.mul(t); l.isNegative() || l.gt(r); )\n s -= c, u = Tt(s, this.unsigned), l = u.mul(t);\n u.isZero() && (u = de), i = i.add(u), r = r.sub(l);\n }\n return i;\n};\n_.div = _.divide;\n_.modulo = function(t) {\n if (ot(t) || (t = xt(t)), Et) {\n var n = (this.unsigned ? Et.rem_u : Et.rem_s)(\n this.low,\n this.high,\n t.low,\n t.high\n );\n return N(n, Et.get_high(), this.unsigned);\n }\n return this.sub(this.div(t).mul(t));\n};\n_.mod = _.modulo;\n_.rem = _.modulo;\n_.not = function() {\n return N(~this.low, ~this.high, this.unsigned);\n};\n_.countLeadingZeros = function() {\n return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;\n};\n_.clz = _.countLeadingZeros;\n_.countTrailingZeros = function() {\n return this.low ? Zi(this.low) : Zi(this.high) + 32;\n};\n_.ctz = _.countTrailingZeros;\n_.and = function(t) {\n return ot(t) || (t = xt(t)), N(this.low & t.low, this.high & t.high, this.unsigned);\n};\n_.or = function(t) {\n return ot(t) || (t = xt(t)), N(this.low | t.low, this.high | t.high, this.unsigned);\n};\n_.xor = function(t) {\n return ot(t) || (t = xt(t)), N(this.low ^ t.low, this.high ^ t.high, this.unsigned);\n};\n_.shiftLeft = function(t) {\n return ot(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low << t, this.high << t | this.low >>> 32 - t, this.unsigned) : N(0, this.low << t - 32, this.unsigned);\n};\n_.shl = _.shiftLeft;\n_.shiftRight = function(t) {\n return ot(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low >>> t | this.high << 32 - t, this.high >> t, this.unsigned) : N(this.high >> t - 32, this.high >= 0 ? 0 : -1, this.unsigned);\n};\n_.shr = _.shiftRight;\n_.shiftRightUnsigned = function(t) {\n return ot(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low >>> t | this.high << 32 - t, this.high >>> t, this.unsigned) : t === 32 ? N(this.high, 0, this.unsigned) : N(this.high >>> t - 32, 0, this.unsigned);\n};\n_.shru = _.shiftRightUnsigned;\n_.shr_u = _.shiftRightUnsigned;\n_.rotateLeft = function(t) {\n var n;\n return ot(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t === 32 ? N(this.high, this.low, this.unsigned) : t < 32 ? (n = 32 - t, N(this.low << t | this.high >>> n, this.high << t | this.low >>> n, this.unsigned)) : (t -= 32, n = 32 - t, N(this.high << t | this.low >>> n, this.low << t | this.high >>> n, this.unsigned));\n};\n_.rotl = _.rotateLeft;\n_.rotateRight = function(t) {\n var n;\n return ot(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t === 32 ? N(this.high, this.low, this.unsigned) : t < 32 ? (n = 32 - t, N(this.high << n | this.low >>> t, this.low << n | this.high >>> t, this.unsigned)) : (t -= 32, n = 32 - t, N(this.low << n | this.high >>> t, this.high << n | this.low >>> t, this.unsigned));\n};\n_.rotr = _.rotateRight;\n_.toSigned = function() {\n return this.unsigned ? N(this.low, this.high, !1) : this;\n};\n_.toUnsigned = function() {\n return this.unsigned ? this : N(this.low, this.high, !0);\n};\n_.toBytes = function(t) {\n return t ? this.toBytesLE() : this.toBytesBE();\n};\n_.toBytesLE = function() {\n var t = this.high, n = this.low;\n return [\n n & 255,\n n >>> 8 & 255,\n n >>> 16 & 255,\n n >>> 24,\n t & 255,\n t >>> 8 & 255,\n t >>> 16 & 255,\n t >>> 24\n ];\n};\n_.toBytesBE = function() {\n var t = this.high, n = this.low;\n return [\n t >>> 24,\n t >>> 16 & 255,\n t >>> 8 & 255,\n t & 255,\n n >>> 24,\n n >>> 16 & 255,\n n >>> 8 & 255,\n n & 255\n ];\n};\nH.fromBytes = function(t, n, s) {\n return s ? H.fromBytesLE(t, n) : H.fromBytesBE(t, n);\n};\nH.fromBytesLE = function(t, n) {\n return new H(\n t[0] | t[1] << 8 | t[2] << 16 | t[3] << 24,\n t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24,\n n\n );\n};\nH.fromBytesBE = function(t, n) {\n return new H(\n t[4] << 24 | t[5] << 16 | t[6] << 8 | t[7],\n t[0] << 24 | t[1] << 16 | t[2] << 8 | t[3],\n n\n );\n};\nconst ap = 16;\nfunction dc(e) {\n e === \"X\" && (e = \"\");\n const t = e.padEnd(ap, \"0\");\n return H.fromString(t, !0, 16);\n}\nfunction cp(e) {\n if (e.isZero())\n return \"X\";\n let t = e.countTrailingZeros();\n const n = t % 4;\n t = (t - n) / 4;\n const s = t;\n t *= 4;\n const i = e.shiftRightUnsigned(t).toString(16).replace(/0+$/, \"\");\n return Array(17 - s - i.length).join(\"0\") + i;\n}\nfunction up(e, t) {\n const n = lp(e).shiftRightUnsigned(2);\n return e.add(H.fromNumber(2 * t + 1 - 4).multiply(n));\n}\nfunction lp(e) {\n return e.and(e.not().add(1));\n}\nconst hp = 3, fp = 30, dp = 2 * fp + 1, io = 180 / Math.PI;\nfunction mp(e) {\n if (e.length === 0)\n throw new Error(`Invalid Hilbert quad key ${e}`);\n const t = e.split(\"/\"), n = parseInt(t[0], 10), s = t[1], r = s.length;\n let i = 0;\n const o = [0, 0];\n for (let a = r - 1; a >= 0; a--) {\n i = r - a;\n const c = s[a];\n let u = 0, l = 0;\n c === \"1\" ? l = 1 : c === \"2\" ? (u = 1, l = 1) : c === \"3\" && (u = 1);\n const h = Math.pow(2, i - 1);\n Ap(h, o, u, l), o[0] += h * u, o[1] += h * l;\n }\n if (n % 2 === 1) {\n const a = o[0];\n o[0] = o[1], o[1] = a;\n }\n return {\n face: n,\n ij: o,\n level: i\n };\n}\nfunction gp(e) {\n if (e.isZero())\n return \"\";\n let t = e.toString(2);\n for (; t.length < hp + dp; )\n t = \"0\" + t;\n const n = t.lastIndexOf(\"1\"), s = t.substring(0, 3), r = t.substring(3, n), i = r.length / 2, o = H.fromString(s, !0, 2).toString(10);\n let a = \"\";\n if (i !== 0)\n for (a = H.fromString(r, !0, 2).toString(4); a.length < i; )\n a = \"0\" + a;\n return `${o}/${a}`;\n}\nfunction mc(e, t, n) {\n const s = 1 << t;\n return [(e[0] + n[0]) / s, (e[1] + n[1]) / s];\n}\nfunction oo(e) {\n return e >= 0.5 ? 1 / 3 * (4 * e * e - 1) : 1 / 3 * (1 - 4 * (1 - e) * (1 - e));\n}\nfunction gc(e) {\n return [oo(e[0]), oo(e[1])];\n}\nfunction Ac(e, t) {\n let [n, s] = t;\n switch (e) {\n case 0:\n return [1, n, s];\n case 1:\n return [-n, 1, s];\n case 2:\n return [-n, -s, 1];\n case 3:\n return [-1, -s, -n];\n case 4:\n return [s, -1, -n];\n case 5:\n return [s, n, -1];\n default:\n throw new Error(\"Invalid face\");\n }\n}\nfunction pc(e) {\n let [t, n, s] = e;\n const r = Math.atan2(s, Math.sqrt(t * t + n * n));\n return [Math.atan2(n, t) * io, r * io];\n}\nfunction Ap(e, t, n, s) {\n if (s === 0) {\n n === 1 && (t[0] = e - 1 - t[0], t[1] = e - 1 - t[1]);\n const r = t[0];\n t[0] = t[1], t[1] = r;\n }\n}\nfunction pp(e) {\n const t = mc(e.ij, e.level, [0.5, 0.5]), n = gc(t), s = Ac(e.face, n);\n return pc(s);\n}\nconst yp = 100;\nfunction ao(e) {\n const {\n face: t,\n ij: n,\n level: s\n } = e, r = [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]], i = Math.max(1, Math.ceil(yp * Math.pow(2, -s))), o = new Float64Array(4 * i * 2 + 2);\n let a = 0, c = 0;\n for (let u = 0; u < 4; u++) {\n const l = r[u].slice(0), h = r[u + 1], f = (h[0] - l[0]) / i, d = (h[1] - l[1]) / i;\n for (let m = 0; m < i; m++) {\n l[0] += f, l[1] += d;\n const g = mc(n, s, l), y = gc(g), E = Ac(t, y), R = pc(E);\n Math.abs(R[1]) > 89.999 && (R[0] = c);\n const B = R[0] - c;\n R[0] += B > 180 ? -360 : B < -180 ? 360 : 0, o[a++] = R[0], o[a++] = R[1], c = R[0];\n }\n }\n return o[a++] = o[0], o[a++] = o[1], o;\n}\nfunction Gr(e) {\n const t = Bp(e);\n return mp(t);\n}\nfunction Bp(e) {\n if (e.indexOf(\"/\") > 0)\n return e;\n const t = dc(e);\n return gp(t);\n}\nfunction Cp(e) {\n const t = Gr(e);\n return pp(t);\n}\nfunction Ep(e) {\n let t;\n if (e.face === 2 || e.face === 5) {\n let n = null, s = 0;\n for (let r = 0; r < 4; r++) {\n const i = `${e.face}/${r}`, o = Gr(i), a = ao(o);\n (typeof n > \"u\" || n === null) && (n = new Float64Array(4 * a.length)), n.set(a, s), s += a.length;\n }\n t = co(n);\n } else {\n const n = ao(e);\n t = co(n);\n }\n return t;\n}\nfunction co(e) {\n if (e.length % 2 !== 0)\n throw new Error(\"Invalid corners\");\n const t = [], n = [];\n for (let s = 0; s < e.length; s += 2)\n t.push(e[s]), n.push(e[s + 1]);\n return t.sort((s, r) => s - r), n.sort((s, r) => s - r), {\n west: t[0],\n east: t[t.length - 1],\n north: n[n.length - 1],\n south: n[0]\n };\n}\nfunction Tp(e, t) {\n const n = (t == null ? void 0 : t.minimumHeight) || 0, s = (t == null ? void 0 : t.maximumHeight) || 0, r = Gr(e), i = Ep(r), o = i.west, a = i.south, c = i.east, u = i.north, l = [];\n return l.push(new A(o, u, n)), l.push(new A(c, u, n)), l.push(new A(c, a, n)), l.push(new A(o, a, n)), l.push(new A(o, u, s)), l.push(new A(c, u, s)), l.push(new A(c, a, s)), l.push(new A(o, a, s)), l;\n}\nfunction yc(e) {\n const t = e.token, n = {\n minimumHeight: e.minimumHeight,\n maximumHeight: e.maximumHeight\n }, s = Tp(t, n), r = Cp(t), i = r[0], o = r[1], a = J.WGS84.cartographicToCartesian([i, o, n.maximumHeight]), c = new A(a[0], a[1], a[2]);\n s.push(c);\n const u = Td(s);\n return [...u.center, ...u.halfAxes];\n}\nconst bp = 4, _p = 8, wp = {\n QUADTREE: bp,\n OCTREE: _p\n};\nfunction Rp(e, t, n) {\n if (e != null && e.box) {\n const s = dc(e.s2VolumeInfo.token), r = up(s, t), i = cp(r), o = {\n ...e.s2VolumeInfo\n };\n switch (o.token = i, n) {\n case \"OCTREE\":\n const u = e.s2VolumeInfo, l = u.maximumHeight - u.minimumHeight, h = l / 2, f = u.minimumHeight + l / 2;\n u.minimumHeight = f - h, u.maximumHeight = f + h;\n break;\n }\n return {\n box: yc(o),\n s2VolumeInfo: o\n };\n }\n}\nasync function Bc(e) {\n const {\n implicitOptions: t,\n parentData: n = {\n mortonIndex: 0,\n x: 0,\n y: 0,\n z: 0\n },\n childIndex: s = 0,\n s2VolumeBox: r,\n loaderOptions: i\n } = e;\n let {\n subtree: o,\n level: a = 0,\n globalData: c = {\n level: 0,\n mortonIndex: 0,\n x: 0,\n y: 0,\n z: 0\n }\n } = e;\n const {\n subdivisionScheme: u,\n subtreeLevels: l,\n maximumLevel: h,\n contentUrlTemplate: f,\n subtreesUriTemplate: d,\n basePath: m\n } = t, g = {\n children: [],\n lodMetricValue: 0,\n contentUrl: \"\"\n };\n if (!h)\n return ia.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`), g;\n const y = a + c.level;\n if (y > h)\n return g;\n const E = wp[u], R = Math.log2(E), B = s & 1, C = s >> 1 & 1, M = s >> 2 & 1, b = (E ** a - 1) / (E - 1);\n let O = Qt(n.mortonIndex, s, R), F = b + O, v = Qt(n.x, B, 1), L = Qt(n.y, C, 1), k = Qt(n.z, M, 1), X = !1;\n a >= l && (X = Ss(o.childSubtreeAvailability, O));\n const Q = Qt(c.x, v, a), P = Qt(c.y, L, a), at = Qt(c.z, k, a);\n if (X) {\n const et = `${m}/${d}`, Pt = er(et, y, Q, P, at);\n o = await Ae(Pt, cc, i), c = {\n mortonIndex: O,\n x: v,\n y: L,\n z: k,\n level: a\n }, O = 0, F = 0, v = 0, L = 0, k = 0, a = 0;\n }\n if (!Ss(o.tileAvailability, F))\n return g;\n Ss(o.contentAvailability, F) && (g.contentUrl = er(f, y, Q, P, at));\n const Be = a + 1, Lt = {\n mortonIndex: O,\n x: v,\n y: L,\n z: k\n };\n for (let et = 0; et < E; et++) {\n const Pt = Rp(r, et, u), Xt = await Bc({\n subtree: o,\n implicitOptions: t,\n loaderOptions: i,\n parentData: Lt,\n childIndex: et,\n level: Be,\n globalData: {\n ...c\n },\n s2VolumeBox: Pt\n });\n if (Xt.contentUrl || Xt.children.length) {\n const Ce = y + 1, es = Mp(Xt, Ce, {\n childTileX: v,\n childTileY: L,\n childTileZ: k\n }, t, r);\n g.children.push(es);\n }\n }\n return g;\n}\nfunction Ss(e, t) {\n let n;\n return Array.isArray(e) ? (n = e[0], e.length > 1 && ia.once('Not supported extension \"3DTILES_multiple_contents\" has been detected')) : n = e, \"constant\" in n ? !!n.constant : n.explicitBitstream ? xp(t, n.explicitBitstream) : !1;\n}\nfunction Mp(e, t, n, s, r) {\n const {\n basePath: i,\n refine: o,\n getRefine: a,\n lodMetricType: c,\n getTileType: u,\n rootLodMetricValue: l,\n rootBoundingVolume: h\n } = s, f = e.contentUrl && e.contentUrl.replace(`${i}/`, \"\"), d = l / 2 ** t, m = r != null && r.box ? {\n box: r.box\n } : h, g = Sp(t, m, n);\n return {\n children: e.children,\n contentUrl: e.contentUrl,\n content: {\n uri: f\n },\n id: e.contentUrl,\n refine: a(o),\n type: u(e),\n lodMetricType: c,\n lodMetricValue: d,\n geometricError: d,\n transform: e.transform,\n boundingVolume: g\n };\n}\nfunction Sp(e, t, n) {\n if (t.region) {\n const {\n childTileX: s,\n childTileY: r,\n childTileZ: i\n } = n, [o, a, c, u, l, h] = t.region, f = 2 ** e, d = (c - o) / f, m = (u - a) / f, g = (h - l) / f, [y, E] = [o + d * s, o + d * (s + 1)], [R, B] = [a + m * r, a + m * (r + 1)], [C, M] = [l + g * i, l + g * (i + 1)];\n return {\n region: [y, R, E, B, C, M]\n };\n }\n if (t.box)\n return t;\n throw new Error(`Unsupported bounding volume type ${t}`);\n}\nfunction Qt(e, t, n) {\n return (e << n) + t;\n}\nfunction er(e, t, n, s, r) {\n const i = Ip({\n level: t,\n x: n,\n y: s,\n z: r\n });\n return e.replace(/{level}|{x}|{y}|{z}/gi, (o) => i[o]);\n}\nfunction Ip(e) {\n const t = {};\n for (const n in e)\n t[`{${n}}`] = e[n];\n return t;\n}\nfunction xp(e, t) {\n const n = Math.floor(e / 8), s = e % 8;\n return (t[n] >> s & 1) === 1;\n}\nfunction Nr(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"\";\n if (!t)\n return dn.EMPTY;\n const s = t.split(\"?\")[0].split(\".\").pop();\n switch (s) {\n case \"pnts\":\n return dn.POINTCLOUD;\n case \"i3dm\":\n case \"b3dm\":\n case \"glb\":\n case \"gltf\":\n return dn.SCENEGRAPH;\n default:\n return s || dn.EMPTY;\n }\n}\nfunction Ur(e) {\n switch (e) {\n case \"REPLACE\":\n case \"replace\":\n return Si.REPLACE;\n case \"ADD\":\n case \"add\":\n return Si.ADD;\n default:\n return e;\n }\n}\nfunction nr(e, t) {\n if (/^[a-z][0-9a-z+.-]*:/i.test(t)) {\n const s = new URL(e, `${t}/`);\n return decodeURI(s.toString());\n } else if (e.startsWith(\"/\"))\n return e;\n return Hu(t, e);\n}\nfunction uo(e, t) {\n if (!e)\n return null;\n let n;\n if (e.content) {\n var s;\n const i = e.content.uri || ((s = e.content) === null || s === void 0 ? void 0 : s.url);\n typeof i < \"u\" && (n = nr(i, t));\n }\n return {\n ...e,\n id: n,\n contentUrl: n,\n lodMetricType: Qn.GEOMETRIC_ERROR,\n lodMetricValue: e.geometricError,\n transformMatrix: e.transform,\n type: Nr(e, n),\n refine: Ur(e.refine)\n };\n}\nasync function vp(e, t, n) {\n let s = null;\n const r = ho(e.root);\n r && e.root ? s = await lo(e.root, e, t, r, n) : s = uo(e.root, t);\n const i = [];\n for (i.push(s); i.length > 0; ) {\n const o = i.pop() || {}, a = o.children || [], c = [];\n for (const u of a) {\n const l = ho(u);\n let h;\n l ? h = await lo(u, e, t, l, n) : h = uo(u, t), h && (c.push(h), i.push(h));\n }\n o.children = c;\n }\n return s;\n}\nasync function lo(e, t, n, s, r) {\n var i, o, a;\n const {\n subdivisionScheme: c,\n maximumLevel: u,\n availableLevels: l,\n subtreeLevels: h,\n subtrees: {\n uri: f\n }\n } = s, d = er(f, 0, 0, 0, 0), m = nr(d, n), g = await Ae(m, cc, r), y = (i = e.content) === null || i === void 0 ? void 0 : i.uri, E = y ? nr(y, n) : \"\", R = t == null || (o = t.root) === null || o === void 0 ? void 0 : o.refine, B = e.geometricError, C = (a = e.boundingVolume.extensions) === null || a === void 0 ? void 0 : a[\"3DTILES_bounding_volume_S2\"];\n if (C) {\n const F = {\n box: yc(C),\n s2VolumeInfo: C\n };\n e.boundingVolume = F;\n }\n const M = e.boundingVolume, b = {\n contentUrlTemplate: E,\n subtreesUriTemplate: f,\n subdivisionScheme: c,\n subtreeLevels: h,\n maximumLevel: Number.isFinite(l) ? l - 1 : u,\n refine: R,\n basePath: n,\n lodMetricType: Qn.GEOMETRIC_ERROR,\n rootLodMetricValue: B,\n rootBoundingVolume: M,\n getTileType: Nr,\n getRefine: Ur\n };\n return await Op(e, n, g, b, r);\n}\nasync function Op(e, t, n, s, r) {\n if (!e)\n return null;\n const {\n children: i,\n contentUrl: o\n } = await Bc({\n subtree: n,\n implicitOptions: s,\n loaderOptions: r\n });\n let a, c = null;\n return o && (a = o, c = {\n uri: o.replace(`${t}/`, \"\")\n }), {\n ...e,\n id: a,\n contentUrl: a,\n lodMetricType: Qn.GEOMETRIC_ERROR,\n lodMetricValue: e.geometricError,\n transformMatrix: e.transform,\n type: Nr(e, a),\n refine: Ur(e.refine),\n content: c || e.content,\n children: i\n };\n}\nfunction ho(e) {\n var t;\n return (e == null || (t = e.extensions) === null || t === void 0 ? void 0 : t[\"3DTILES_implicit_tiling\"]) || (e == null ? void 0 : e.implicitTiling);\n}\nconst Le = {\n id: \"3d-tiles\",\n name: \"3D Tiles\",\n module: \"3d-tiles\",\n version: Ia,\n extensions: [\"cmpt\", \"pnts\", \"b3dm\", \"i3dm\"],\n mimeTypes: [\"application/octet-stream\"],\n tests: [\"cmpt\", \"pnts\", \"b3dm\", \"i3dm\"],\n parse: Fp,\n options: {\n \"3d-tiles\": {\n loadGLTF: !0,\n decodeQuantizedPositions: !1,\n isTileset: \"auto\",\n assetGltfUpAxis: null\n }\n }\n};\nasync function Fp(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 ? arguments[2] : void 0;\n const s = t[\"3d-tiles\"] || {};\n let r;\n return s.isTileset === \"auto\" ? r = (n == null ? void 0 : n.url) && n.url.indexOf(\".json\") !== -1 : r = s.isTileset, r ? Dp(e, t, n) : Lp(e, t, n);\n}\nasync function Dp(e, t, n) {\n var s;\n const r = JSON.parse(new TextDecoder().decode(e)), i = (n == null ? void 0 : n.url) || \"\", o = Pp(i), a = await vp(r, o, t || {});\n return {\n ...r,\n shape: \"tileset3d\",\n loader: Le,\n url: i,\n queryString: (n == null ? void 0 : n.queryString) || \"\",\n basePath: o,\n root: a || r.root,\n type: bd.TILES3D,\n lodMetricType: Qn.GEOMETRIC_ERROR,\n lodMetricValue: ((s = r.root) === null || s === void 0 ? void 0 : s.geometricError) || 0\n };\n}\nasync function Lp(e, t, n) {\n const s = {\n content: {\n shape: \"tile3d\",\n featureIds: null\n }\n };\n return await ac(e, 0, t, n, s.content), s.content;\n}\nfunction Pp(e) {\n return Zo(e);\n}\nconst Cc = \"https://api.cesium.com/v1/assets\";\nasync function Gp(e, t) {\n if (!t) {\n const i = await Np(e);\n for (const o of i.items)\n o.type === \"3DTILES\" && (t = o.id);\n }\n const n = await Up(e, t), {\n type: s,\n url: r\n } = n;\n return K(s === \"3DTILES\" && r), n.headers = {\n Authorization: `Bearer ${n.accessToken}`\n }, n;\n}\nasync function Np(e) {\n K(e);\n const t = Cc, n = {\n Authorization: `Bearer ${e}`\n }, s = await Ge(t, {\n headers: n\n });\n if (!s.ok)\n throw new Error(s.statusText);\n return await s.json();\n}\nasync function Up(e, t) {\n K(e, t);\n const n = {\n Authorization: `Bearer ${e}`\n }, s = `${Cc}/${t}`;\n let r = await Ge(`${s}`, {\n headers: n\n });\n if (!r.ok)\n throw new Error(r.statusText);\n let i = await r.json();\n if (r = await Ge(`${s}/endpoint`, {\n headers: n\n }), !r.ok)\n throw new Error(r.statusText);\n const o = await r.json();\n return i = {\n ...i,\n ...o\n }, i;\n}\nasync function Hp(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n t = t[\"cesium-ion\"] || {};\n const {\n accessToken: n\n } = t;\n let s = t.assetId;\n if (!Number.isFinite(s)) {\n const r = e.match(/\\/([0-9]+)\\/tileset.json/);\n s = r && r[1];\n }\n return Gp(n, s);\n}\nconst Ec = {\n ...Le,\n id: \"cesium-ion\",\n name: \"Cesium Ion\",\n preload: Hp,\n parse: async (e, t, n) => (t = {\n ...t\n }, t[\"3d-tiles\"] = t[\"cesium-ion\"], t.loader = Ec, Le.parse(e, t, n)),\n options: {\n \"cesium-ion\": {\n ...Le.options[\"3d-tiles\"],\n accessToken: null\n }\n }\n}, fo = 100;\nclass Jp {\n constructor(t, n) {\n if (this.schema = void 0, this.options = void 0, this.shape = void 0, this.length = 0, this.rows = null, this.cursor = 0, this._headers = [], this.options = n, this.schema = t, !Array.isArray(t)) {\n this._headers = [];\n for (const s in t)\n this._headers[t[s].index] = t[s].name;\n }\n }\n rowCount() {\n return this.length;\n }\n addArrayRow(t, n) {\n Number.isFinite(n) && (this.cursor = n), this.shape = \"array-row-table\", this.rows = this.rows || new Array(fo), this.rows[this.length] = t, this.length++;\n }\n addObjectRow(t, n) {\n Number.isFinite(n) && (this.cursor = n), this.shape = \"object-row-table\", this.rows = this.rows || new Array(fo), this.rows[this.length] = t, this.length++;\n }\n getBatch() {\n let t = this.rows;\n return t ? (t = t.slice(0, this.length), this.rows = null, {\n shape: this.shape || \"array-row-table\",\n batchType: \"data\",\n data: t,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n }) : null;\n }\n}\nfunction Vp(e, t) {\n if (!e)\n throw new Error(\"null row\");\n const n = {};\n if (t)\n for (let s = 0; s < t.length; s++)\n n[t[s]] = e[s];\n else\n for (let s = 0; s < e.length; s++) {\n const r = `column-${s}`;\n n[r] = e[s];\n }\n return n;\n}\nfunction jp(e, t) {\n if (!e)\n throw new Error(\"null row\");\n if (t) {\n const n = new Array(t.length);\n for (let s = 0; s < t.length; s++)\n n[s] = e[t[s]];\n return n;\n }\n return Object.values(e);\n}\nfunction kp(e) {\n const t = [];\n for (let n = 0; n < e.length; n++) {\n const s = `column-${n}`;\n t.push(s);\n }\n return t;\n}\nfunction Kp(e) {\n return Object.keys(e);\n}\nconst mo = 100;\nclass zp {\n constructor(t, n) {\n if (this.schema = void 0, this.options = void 0, this.length = 0, this.objectRows = null, this.arrayRows = null, this.cursor = 0, this._headers = null, this.options = n, this.schema = t, t) {\n this._headers = [];\n for (const s in t)\n this._headers[t[s].index] = t[s].name;\n }\n }\n rowCount() {\n return this.length;\n }\n addArrayRow(t, n) {\n switch (Number.isFinite(n) && (this.cursor = n), this._headers || (this._headers = kp(t)), this.options.shape) {\n case \"object-row-table\":\n const s = Vp(t, this._headers);\n this.addObjectRow(s, n);\n break;\n case \"array-row-table\":\n this.arrayRows = this.arrayRows || new Array(mo), this.arrayRows[this.length] = t, this.length++;\n break;\n }\n }\n addObjectRow(t, n) {\n switch (Number.isFinite(n) && (this.cursor = n), this._headers || (this._headers = Kp(t)), this.options.shape) {\n case \"array-row-table\":\n const s = jp(t, this._headers);\n this.addArrayRow(s, n);\n break;\n case \"object-row-table\":\n this.objectRows = this.objectRows || new Array(mo), this.objectRows[this.length] = t, this.length++;\n break;\n }\n }\n getBatch() {\n let t = this.arrayRows || this.objectRows;\n return t ? (t = t.slice(0, this.length), this.arrayRows = null, this.objectRows = null, {\n shape: this.options.shape,\n batchType: \"data\",\n data: t,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n }) : null;\n }\n}\nconst Wp = 100;\nclass Xp {\n constructor(t, n) {\n this.schema = void 0, this.length = 0, this.allocated = 0, this.columns = {}, this.schema = t, this._reallocateColumns();\n }\n rowCount() {\n return this.length;\n }\n addArrayRow(t) {\n this._reallocateColumns();\n let n = 0;\n for (const s in this.columns)\n this.columns[s][this.length] = t[n++];\n this.length++;\n }\n addObjectRow(t) {\n this._reallocateColumns();\n for (const n in t)\n this.columns[n][this.length] = t[n];\n this.length++;\n }\n getBatch() {\n this._pruneColumns();\n const t = Array.isArray(this.schema) ? this.columns : {};\n if (!Array.isArray(this.schema))\n for (const s in this.schema) {\n const r = this.schema[s];\n t[r.name] = this.columns[r.index];\n }\n return this.columns = {}, {\n shape: \"columnar-table\",\n batchType: \"data\",\n data: t,\n schema: this.schema,\n length: this.length\n };\n }\n _reallocateColumns() {\n if (!(this.length < this.allocated)) {\n this.allocated = this.allocated > 0 ? this.allocated *= 2 : Wp, this.columns = {};\n for (const t in this.schema) {\n const n = this.schema[t], s = n.type || Float32Array, r = this.columns[n.index];\n if (r && ArrayBuffer.isView(r)) {\n const i = new s(this.allocated);\n i.set(r), this.columns[n.index] = i;\n } else\n r ? (r.length = this.allocated, this.columns[n.index] = r) : this.columns[n.index] = new s(this.allocated);\n }\n }\n }\n _pruneColumns() {\n for (const [t, n] of Object.entries(this.columns))\n this.columns[t] = n.slice(0, this.length);\n }\n}\nconst Qp = {\n shape: void 0,\n batchSize: \"auto\",\n batchDebounceMs: 0,\n limit: 0,\n _limitMB: 0\n}, qp = \"TableBatchBuilder\";\nclass He {\n constructor(t, n) {\n this.schema = void 0, this.options = void 0, this.aggregator = null, this.batchCount = 0, this.bytesUsed = 0, this.isChunkComplete = !1, this.lastBatchEmittedMs = Date.now(), this.totalLength = 0, this.totalBytes = 0, this.rowBytes = 0, this.schema = t, this.options = {\n ...Qp,\n ...n\n };\n }\n limitReached() {\n var t, n;\n return !!(!((t = this.options) === null || t === void 0) && t.limit && this.totalLength >= this.options.limit || !((n = this.options) === null || n === void 0) && n._limitMB && this.totalBytes / 1e6 >= this.options._limitMB);\n }\n addRow(t) {\n this.limitReached() || (this.totalLength++, this.rowBytes = this.rowBytes || this._estimateRowMB(t), this.totalBytes += this.rowBytes, Array.isArray(t) ? this.addArrayRow(t) : this.addObjectRow(t));\n }\n addArrayRow(t) {\n if (!this.aggregator) {\n const n = this._getTableBatchType();\n this.aggregator = new n(this.schema, this.options);\n }\n this.aggregator.addArrayRow(t);\n }\n addObjectRow(t) {\n if (!this.aggregator) {\n const n = this._getTableBatchType();\n this.aggregator = new n(this.schema, this.options);\n }\n this.aggregator.addObjectRow(t);\n }\n chunkComplete(t) {\n t instanceof ArrayBuffer && (this.bytesUsed += t.byteLength), typeof t == \"string\" && (this.bytesUsed += t.length), this.isChunkComplete = !0;\n }\n getFullBatch(t) {\n return this._isFull() ? this._getBatch(t) : null;\n }\n getFinalBatch(t) {\n return this._getBatch(t);\n }\n _estimateRowMB(t) {\n return Array.isArray(t) ? t.length * 8 : Object.keys(t).length * 8;\n }\n _isFull() {\n if (!this.aggregator || this.aggregator.rowCount() === 0)\n return !1;\n if (this.options.batchSize === \"auto\") {\n if (!this.isChunkComplete)\n return !1;\n } else if (this.options.batchSize > this.aggregator.rowCount())\n return !1;\n return this.options.batchDebounceMs > Date.now() - this.lastBatchEmittedMs ? !1 : (this.isChunkComplete = !1, this.lastBatchEmittedMs = Date.now(), !0);\n }\n _getBatch(t) {\n if (!this.aggregator)\n return null;\n t != null && t.bytesUsed && (this.bytesUsed = t.bytesUsed);\n const n = this.aggregator.getBatch();\n return n.count = this.batchCount, n.bytesUsed = this.bytesUsed, Object.assign(n, t), this.batchCount++, this.aggregator = null, n;\n }\n _getTableBatchType() {\n switch (this.options.shape) {\n case \"array-row-table\":\n case \"object-row-table\":\n return zp;\n case \"columnar-table\":\n return Xp;\n case \"arrow-table\":\n if (!He.ArrowBatch)\n throw new Error(qp);\n return He.ArrowBatch;\n default:\n return Jp;\n }\n }\n}\nHe.ArrowBatch = void 0;\nfunction Yp(e) {\n try {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n return async function* () {\n const n = new TextDecoder(void 0, t);\n for await (const s of e)\n yield typeof s == \"string\" ? s : n.decode(s, {\n stream: !0\n });\n }();\n } catch (t) {\n return Promise.reject(t);\n }\n}\nconst sr = Number.MAX_SAFE_INTEGER;\nvar S = function(e) {\n return e[e.BEGIN = 0] = \"BEGIN\", e[e.VALUE = 1] = \"VALUE\", e[e.OPEN_OBJECT = 2] = \"OPEN_OBJECT\", e[e.CLOSE_OBJECT = 3] = \"CLOSE_OBJECT\", e[e.OPEN_ARRAY = 4] = \"OPEN_ARRAY\", e[e.CLOSE_ARRAY = 5] = \"CLOSE_ARRAY\", e[e.TEXT_ESCAPE = 6] = \"TEXT_ESCAPE\", e[e.STRING = 7] = \"STRING\", e[e.BACKSLASH = 8] = \"BACKSLASH\", e[e.END = 9] = \"END\", e[e.OPEN_KEY = 10] = \"OPEN_KEY\", e[e.CLOSE_KEY = 11] = \"CLOSE_KEY\", e[e.TRUE = 12] = \"TRUE\", e[e.TRUE2 = 13] = \"TRUE2\", e[e.TRUE3 = 14] = \"TRUE3\", e[e.FALSE = 15] = \"FALSE\", e[e.FALSE2 = 16] = \"FALSE2\", e[e.FALSE3 = 17] = \"FALSE3\", e[e.FALSE4 = 18] = \"FALSE4\", e[e.NULL = 19] = \"NULL\", e[e.NULL2 = 20] = \"NULL2\", e[e.NULL3 = 21] = \"NULL3\", e[e.NUMBER_DECIMAL_POINT = 22] = \"NUMBER_DECIMAL_POINT\", e[e.NUMBER_DIGIT = 23] = \"NUMBER_DIGIT\", e;\n}(S || {});\nconst I = {\n tab: 9,\n lineFeed: 10,\n carriageReturn: 13,\n space: 32,\n doubleQuote: 34,\n plus: 43,\n comma: 44,\n minus: 45,\n period: 46,\n _0: 48,\n _9: 57,\n colon: 58,\n E: 69,\n openBracket: 91,\n backslash: 92,\n closeBracket: 93,\n a: 97,\n b: 98,\n e: 101,\n f: 102,\n l: 108,\n n: 110,\n r: 114,\n s: 115,\n t: 116,\n u: 117,\n openBrace: 123,\n closeBrace: 125\n}, go = /[\\\\\"\\n]/g, Ao = {\n onready: () => {\n },\n onopenobject: () => {\n },\n onkey: () => {\n },\n oncloseobject: () => {\n },\n onopenarray: () => {\n },\n onclosearray: () => {\n },\n onvalue: () => {\n },\n onerror: () => {\n },\n onend: () => {\n },\n onchunkparsed: () => {\n }\n};\nclass $p {\n constructor() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n this.options = Ao, this.bufferCheckPosition = sr, this.q = \"\", this.c = \"\", this.p = \"\", this.closed = !1, this.closedRoot = !1, this.sawRoot = !1, this.error = null, this.state = S.BEGIN, this.stack = [], this.position = 0, this.column = 0, this.line = 1, this.slashed = !1, this.unicodeI = 0, this.unicodeS = null, this.depth = 0, this.textNode = void 0, this.numberNode = void 0, this.options = {\n ...Ao,\n ...t\n }, this.textNode = void 0, this.numberNode = \"\", this.emit(\"onready\");\n }\n end() {\n return (this.state !== S.VALUE || this.depth !== 0) && this._error(\"Unexpected end\"), this._closeValue(), this.c = \"\", this.closed = !0, this.emit(\"onend\"), this;\n }\n resume() {\n return this.error = null, this;\n }\n close() {\n return this.write(null);\n }\n emit(t, n) {\n var s, r;\n (s = (r = this.options)[t]) === null || s === void 0 || s.call(r, n, this);\n }\n emitNode(t, n) {\n this._closeValue(), this.emit(t, n);\n }\n write(t) {\n if (this.error)\n throw this.error;\n if (this.closed)\n return this._error(\"Cannot write after close. Assign an onready handler.\");\n if (t === null)\n return this.end();\n let n = 0, s = t.charCodeAt(0), r = this.p;\n for (; s && (r = s, this.c = s = t.charCodeAt(n++), r !== s ? this.p = r : r = this.p, !!s); )\n switch (this.position++, s === I.lineFeed ? (this.line++, this.column = 0) : this.column++, this.state) {\n case S.BEGIN:\n s === I.openBrace ? this.state = S.OPEN_OBJECT : s === I.openBracket ? this.state = S.OPEN_ARRAY : Se(s) || this._error(\"Non-whitespace before {[.\");\n continue;\n case S.OPEN_KEY:\n case S.OPEN_OBJECT:\n if (Se(s))\n continue;\n if (this.state === S.OPEN_KEY)\n this.stack.push(S.CLOSE_KEY);\n else if (s === I.closeBrace) {\n this.emit(\"onopenobject\"), this.depth++, this.emit(\"oncloseobject\"), this.depth--, this.state = this.stack.pop() || S.VALUE;\n continue;\n } else\n this.stack.push(S.CLOSE_OBJECT);\n s === I.doubleQuote ? this.state = S.STRING : this._error('Malformed object key should start with \"');\n continue;\n case S.CLOSE_KEY:\n case S.CLOSE_OBJECT:\n if (Se(s))\n continue;\n s === I.colon ? (this.state === S.CLOSE_OBJECT ? (this.stack.push(S.CLOSE_OBJECT), this._closeValue(\"onopenobject\"), this.depth++) : this._closeValue(\"onkey\"), this.state = S.VALUE) : s === I.closeBrace ? (this.emitNode(\"oncloseobject\"), this.depth--, this.state = this.stack.pop() || S.VALUE) : s === I.comma ? (this.state === S.CLOSE_OBJECT && this.stack.push(S.CLOSE_OBJECT), this._closeValue(), this.state = S.OPEN_KEY) : this._error(\"Bad object\");\n continue;\n case S.OPEN_ARRAY:\n case S.VALUE:\n if (Se(s))\n continue;\n if (this.state === S.OPEN_ARRAY)\n if (this.emit(\"onopenarray\"), this.depth++, this.state = S.VALUE, s === I.closeBracket) {\n this.emit(\"onclosearray\"), this.depth--, this.state = this.stack.pop() || S.VALUE;\n continue;\n } else\n this.stack.push(S.CLOSE_ARRAY);\n s === I.doubleQuote ? this.state = S.STRING : s === I.openBrace ? this.state = S.OPEN_OBJECT : s === I.openBracket ? this.state = S.OPEN_ARRAY : s === I.t ? this.state = S.TRUE : s === I.f ? this.state = S.FALSE : s === I.n ? this.state = S.NULL : s === I.minus ? this.numberNode += \"-\" : I._0 <= s && s <= I._9 ? (this.numberNode += String.fromCharCode(s), this.state = S.NUMBER_DIGIT) : this._error(\"Bad value\");\n continue;\n case S.CLOSE_ARRAY:\n if (s === I.comma)\n this.stack.push(S.CLOSE_ARRAY), this._closeValue(\"onvalue\"), this.state = S.VALUE;\n else if (s === I.closeBracket)\n this.emitNode(\"onclosearray\"), this.depth--, this.state = this.stack.pop() || S.VALUE;\n else {\n if (Se(s))\n continue;\n this._error(\"Bad array\");\n }\n continue;\n case S.STRING:\n this.textNode === void 0 && (this.textNode = \"\");\n let i = n - 1, o = this.slashed, a = this.unicodeI;\n t:\n for (; ; ) {\n for (; a > 0; )\n if (this.unicodeS += String.fromCharCode(s), s = t.charCodeAt(n++), this.position++, a === 4 ? (this.textNode += String.fromCharCode(parseInt(this.unicodeS, 16)), a = 0, i = n - 1) : a++, !s)\n break t;\n if (s === I.doubleQuote && !o) {\n this.state = this.stack.pop() || S.VALUE, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i;\n break;\n }\n if (s === I.backslash && !o && (o = !0, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i, s = t.charCodeAt(n++), this.position++, !s))\n break;\n if (o) {\n if (o = !1, s === I.n ? this.textNode += `\n` : s === I.r ? this.textNode += \"\\r\" : s === I.t ? this.textNode += \"\t\" : s === I.f ? this.textNode += \"\\f\" : s === I.b ? this.textNode += \"\\b\" : s === I.u ? (a = 1, this.unicodeS = \"\") : this.textNode += String.fromCharCode(s), s = t.charCodeAt(n++), this.position++, i = n - 1, s)\n continue;\n break;\n }\n go.lastIndex = n;\n const c = go.exec(t);\n if (c === null) {\n n = t.length + 1, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i;\n break;\n }\n if (n = c.index + 1, s = t.charCodeAt(c.index), !s) {\n this.textNode += t.substring(i, n - 1), this.position += n - 1 - i;\n break;\n }\n }\n this.slashed = o, this.unicodeI = a;\n continue;\n case S.TRUE:\n s === I.r ? this.state = S.TRUE2 : this._error(`Invalid true started with t${s}`);\n continue;\n case S.TRUE2:\n s === I.u ? this.state = S.TRUE3 : this._error(`Invalid true started with tr${s}`);\n continue;\n case S.TRUE3:\n s === I.e ? (this.emit(\"onvalue\", !0), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid true started with tru${s}`);\n continue;\n case S.FALSE:\n s === I.a ? this.state = S.FALSE2 : this._error(`Invalid false started with f${s}`);\n continue;\n case S.FALSE2:\n s === I.l ? this.state = S.FALSE3 : this._error(`Invalid false started with fa${s}`);\n continue;\n case S.FALSE3:\n s === I.s ? this.state = S.FALSE4 : this._error(`Invalid false started with fal${s}`);\n continue;\n case S.FALSE4:\n s === I.e ? (this.emit(\"onvalue\", !1), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid false started with fals${s}`);\n continue;\n case S.NULL:\n s === I.u ? this.state = S.NULL2 : this._error(`Invalid null started with n${s}`);\n continue;\n case S.NULL2:\n s === I.l ? this.state = S.NULL3 : this._error(`Invalid null started with nu${s}`);\n continue;\n case S.NULL3:\n s === I.l ? (this.emit(\"onvalue\", null), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid null started with nul${s}`);\n continue;\n case S.NUMBER_DECIMAL_POINT:\n s === I.period ? (this.numberNode += \".\", this.state = S.NUMBER_DIGIT) : this._error(\"Leading zero not followed by .\");\n continue;\n case S.NUMBER_DIGIT:\n I._0 <= s && s <= I._9 ? this.numberNode += String.fromCharCode(s) : s === I.period ? (this.numberNode.indexOf(\".\") !== -1 && this._error(\"Invalid number has two dots\"), this.numberNode += \".\") : s === I.e || s === I.E ? ((this.numberNode.indexOf(\"e\") !== -1 || this.numberNode.indexOf(\"E\") !== -1) && this._error(\"Invalid number has two exponential\"), this.numberNode += \"e\") : s === I.plus || s === I.minus ? (r === I.e || r === I.E || this._error(\"Invalid symbol in number\"), this.numberNode += String.fromCharCode(s)) : (this._closeNumber(), n--, this.state = this.stack.pop() || S.VALUE);\n continue;\n default:\n this._error(`Unknown state: ${this.state}`);\n }\n return this.position >= this.bufferCheckPosition && Zp(this), this.emit(\"onchunkparsed\"), this;\n }\n _closeValue() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \"onvalue\";\n this.textNode !== void 0 && this.emit(t, this.textNode), this.textNode = void 0;\n }\n _closeNumber() {\n this.numberNode && this.emit(\"onvalue\", parseFloat(this.numberNode)), this.numberNode = \"\";\n }\n _error() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : \"\";\n this._closeValue(), t += `\nLine: ${this.line}\nColumn: ${this.column}\nChar: ${this.c}`;\n const n = new Error(t);\n this.error = n, this.emit(\"onerror\", n);\n }\n}\nfunction Se(e) {\n return e === I.carriageReturn || e === I.lineFeed || e === I.space || e === I.tab;\n}\nfunction Zp(e) {\n const t = Math.max(sr, 10);\n let n = 0;\n for (const s of [\"textNode\", \"numberNode\"]) {\n const r = e[s] === void 0 ? 0 : e[s].length;\n if (r > t)\n switch (s) {\n case \"text\":\n break;\n default:\n e._error(`Max buffer length exceeded: ${s}`);\n }\n n = Math.max(n, r);\n }\n e.bufferCheckPosition = sr - n + e.position;\n}\nclass te {\n constructor() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;\n if (this.path = void 0, this.path = [\"$\"], t instanceof te) {\n this.path = [...t.path];\n return;\n }\n if (Array.isArray(t)) {\n this.path.push(...t);\n return;\n }\n if (typeof t == \"string\" && (this.path = t.split(\".\"), this.path[0] !== \"$\"))\n throw new Error(\"JSONPaths must start with $\");\n }\n clone() {\n return new te(this);\n }\n toString() {\n return this.path.join(\".\");\n }\n push(t) {\n this.path.push(t);\n }\n pop() {\n return this.path.pop();\n }\n set(t) {\n this.path[this.path.length - 1] = t;\n }\n equals(t) {\n if (!this || !t || this.path.length !== t.path.length)\n return !1;\n for (let n = 0; n < this.path.length; ++n)\n if (this.path[n] !== t.path[n])\n return !1;\n return !0;\n }\n setFieldAtPath(t, n) {\n const s = [...this.path];\n s.shift();\n const r = s.pop();\n for (const i of s)\n t = t[i];\n t[r] = n;\n }\n getFieldAtPath(t) {\n const n = [...this.path];\n n.shift();\n const s = n.pop();\n for (const r of n)\n t = t[r];\n return t[s];\n }\n}\nclass ty {\n constructor(t) {\n this.parser = void 0, this.result = void 0, this.previousStates = [], this.currentState = Object.freeze({\n container: [],\n key: null\n }), this.jsonpath = new te(), this.reset(), this.parser = new $p({\n onready: () => {\n this.jsonpath = new te(), this.previousStates.length = 0, this.currentState.container.length = 0;\n },\n onopenobject: (n) => {\n this._openObject({}), typeof n < \"u\" && this.parser.emit(\"onkey\", n);\n },\n onkey: (n) => {\n this.jsonpath.set(n), this.currentState.key = n;\n },\n oncloseobject: () => {\n this._closeObject();\n },\n onopenarray: () => {\n this._openArray();\n },\n onclosearray: () => {\n this._closeArray();\n },\n onvalue: (n) => {\n this._pushOrSet(n);\n },\n onerror: (n) => {\n throw n;\n },\n onend: () => {\n this.result = this.currentState.container.pop();\n },\n ...t\n });\n }\n reset() {\n this.result = void 0, this.previousStates = [], this.currentState = Object.freeze({\n container: [],\n key: null\n }), this.jsonpath = new te();\n }\n write(t) {\n this.parser.write(t);\n }\n close() {\n this.parser.close();\n }\n _pushOrSet(t) {\n const {\n container: n,\n key: s\n } = this.currentState;\n s !== null ? (n[s] = t, this.currentState.key = null) : n.push(t);\n }\n _openArray() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];\n this.jsonpath.push(null), this._pushOrSet(t), this.previousStates.push(this.currentState), this.currentState = {\n container: t,\n isArray: !0,\n key: null\n };\n }\n _closeArray() {\n this.jsonpath.pop(), this.currentState = this.previousStates.pop();\n }\n _openObject() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n this.jsonpath.push(null), this._pushOrSet(t), this.previousStates.push(this.currentState), this.currentState = {\n container: t,\n isArray: !1,\n key: null\n };\n }\n _closeObject() {\n this.jsonpath.pop(), this.currentState = this.previousStates.pop();\n }\n}\nclass ey extends ty {\n constructor() {\n let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n super({\n onopenarray: () => {\n if (!this.streamingArray && this._matchJSONPath()) {\n this.streamingJsonPath = this.getJsonPath().clone(), this.streamingArray = [], this._openArray(this.streamingArray);\n return;\n }\n this._openArray();\n },\n onopenobject: (s) => {\n this.topLevelObject ? this._openObject({}) : (this.topLevelObject = {}, this._openObject(this.topLevelObject)), typeof s < \"u\" && this.parser.emit(\"onkey\", s);\n }\n }), this.jsonPaths = void 0, this.streamingJsonPath = null, this.streamingArray = null, this.topLevelObject = null;\n const n = t.jsonpaths || [];\n this.jsonPaths = n.map((s) => new te(s));\n }\n write(t) {\n super.write(t);\n let n = [];\n return this.streamingArray && (n = [...this.streamingArray], this.streamingArray.length = 0), n;\n }\n getPartialResult() {\n return this.topLevelObject;\n }\n getStreamingJsonPath() {\n return this.streamingJsonPath;\n }\n getStreamingJsonPathAsString() {\n return this.streamingJsonPath && this.streamingJsonPath.toString();\n }\n getJsonPath() {\n return this.jsonpath;\n }\n _matchJSONPath() {\n const t = this.getJsonPath();\n if (this.jsonPaths.length === 0)\n return !0;\n for (const n of this.jsonPaths)\n if (n.equals(t))\n return !0;\n return !1;\n }\n}\nasync function* ny(e, t) {\n const n = Yp(e), {\n metadata: s\n } = t, {\n jsonpaths: r\n } = t.json || {};\n let i = !0;\n const o = null, a = new He(o, t), c = new ey({\n jsonpaths: r\n });\n for await (const f of n) {\n const d = c.write(f), m = d.length > 0 && c.getStreamingJsonPathAsString();\n if (d.length > 0 && i) {\n if (s) {\n var u;\n yield {\n shape: (t == null || (u = t.json) === null || u === void 0 ? void 0 : u.shape) || \"array-row-table\",\n batchType: \"partial-result\",\n data: [],\n length: 0,\n bytesUsed: 0,\n container: c.getPartialResult(),\n jsonpath: m\n };\n }\n i = !1;\n }\n for (const y of d) {\n a.addRow(y);\n const E = a.getFullBatch({\n jsonpath: m\n });\n E && (yield E);\n }\n a.chunkComplete(f);\n const g = a.getFullBatch({\n jsonpath: m\n });\n g && (yield g);\n }\n const l = c.getStreamingJsonPathAsString(), h = a.getFinalBatch({\n jsonpath: l\n });\n h && (yield h), s && (yield {\n shape: \"json\",\n batchType: \"final-result\",\n container: c.getPartialResult(),\n jsonpath: c.getStreamingJsonPathAsString(),\n data: [],\n length: 0\n });\n}\nconst Hn = {\n x: 0,\n y: 1,\n z: 2\n};\nfunction Tc(e, t = {}) {\n const { start: n = 0, end: s = e.length, plane: r = \"xy\" } = t, i = t.size || 2;\n let o = 0;\n const a = Hn[r[0]], c = Hn[r[1]];\n for (let u = n, l = s - i; u < s; u += i)\n o += (e[u + a] - e[l + a]) * (e[u + c] + e[l + c]), l = u;\n return o / 2;\n}\nfunction sy(e, t, n = 2, s, r = \"xy\") {\n const i = t && t.length, o = i ? t[0] * n : e.length;\n let a = bc(e, 0, o, n, !0, s && s[0], r);\n const c = [];\n if (!a || a.next === a.prev)\n return c;\n let u, l, h, f, d, m, g;\n if (i && (a = cy(e, t, a, n, s, r)), e.length > 80 * n) {\n f = l = e[0], d = h = e[1];\n for (let y = n; y < o; y += n)\n m = e[y], g = e[y + 1], m < f && (f = m), g < d && (d = g), m > l && (l = m), g > h && (h = g);\n u = Math.max(l - f, h - d), u = u !== 0 ? 32767 / u : 0;\n }\n return Je(a, c, n, f, d, u, 0), c;\n}\nfunction bc(e, t, n, s, r, i, o) {\n let a, c;\n i === void 0 && (i = Tc(e, { start: t, end: n, size: s, plane: o }));\n let u = Hn[o[0]], l = Hn[o[1]];\n if (r === i < 0)\n for (a = t; a < n; a += s)\n c = po(a, e[a + u], e[a + l], c);\n else\n for (a = n - s; a >= t; a -= s)\n c = po(a, e[a + u], e[a + l], c);\n return c && Zn(c, c.next) && (je(c), c = c.next), c;\n}\nfunction ne(e, t) {\n if (!e)\n return e;\n t || (t = e);\n let n = e, s;\n do\n if (s = !1, !n.steiner && (Zn(n, n.next) || z(n.prev, n, n.next) === 0)) {\n if (je(n), n = t = n.prev, n === n.next)\n break;\n s = !0;\n } else\n n = n.next;\n while (s || n !== t);\n return t;\n}\nfunction Je(e, t, n, s, r, i, o) {\n if (!e)\n return;\n !o && i && dy(e, s, r, i);\n let a = e, c, u;\n for (; e.prev !== e.next; ) {\n if (c = e.prev, u = e.next, i ? iy(e, s, r, i) : ry(e)) {\n t.push(c.i / n | 0), t.push(e.i / n | 0), t.push(u.i / n | 0), je(e), e = u.next, a = u.next;\n continue;\n }\n if (e = u, e === a) {\n o ? o === 1 ? (e = oy(ne(e), t, n), Je(e, t, n, s, r, i, 2)) : o === 2 && ay(e, t, n, s, r, i) : Je(ne(e), t, n, s, r, i, 1);\n break;\n }\n }\n}\nfunction ry(e) {\n const t = e.prev, n = e, s = e.next;\n if (z(t, n, s) >= 0)\n return !1;\n const r = t.x, i = n.x, o = s.x, a = t.y, c = n.y, u = s.y, l = r < i ? r < o ? r : o : i < o ? i : o, h = a < c ? a < u ? a : u : c < u ? c : u, f = r > i ? r > o ? r : o : i > o ? i : o, d = a > c ? a > u ? a : u : c > u ? c : u;\n let m = s.next;\n for (; m !== t; ) {\n if (m.x >= l && m.x <= f && m.y >= h && m.y <= d && me(r, a, i, c, o, u, m.x, m.y) && z(m.prev, m, m.next) >= 0)\n return !1;\n m = m.next;\n }\n return !0;\n}\nfunction iy(e, t, n, s) {\n const r = e.prev, i = e, o = e.next;\n if (z(r, i, o) >= 0)\n return !1;\n const a = r.x, c = i.x, u = o.x, l = r.y, h = i.y, f = o.y, d = a < c ? a < u ? a : u : c < u ? c : u, m = l < h ? l < f ? l : f : h < f ? h : f, g = a > c ? a > u ? a : u : c > u ? c : u, y = l > h ? l > f ? l : f : h > f ? h : f, E = rr(d, m, t, n, s), R = rr(g, y, t, n, s);\n let B = e.prevZ, C = e.nextZ;\n for (; B && B.z >= E && C && C.z <= R; ) {\n if (B.x >= d && B.x <= g && B.y >= m && B.y <= y && B !== r && B !== o && me(a, l, c, h, u, f, B.x, B.y) && z(B.prev, B, B.next) >= 0 || (B = B.prevZ, C.x >= d && C.x <= g && C.y >= m && C.y <= y && C !== r && C !== o && me(a, l, c, h, u, f, C.x, C.y) && z(C.prev, C, C.next) >= 0))\n return !1;\n C = C.nextZ;\n }\n for (; B && B.z >= E; ) {\n if (B.x >= d && B.x <= g && B.y >= m && B.y <= y && B !== r && B !== o && me(a, l, c, h, u, f, B.x, B.y) && z(B.prev, B, B.next) >= 0)\n return !1;\n B = B.prevZ;\n }\n for (; C && C.z <= R; ) {\n if (C.x >= d && C.x <= g && C.y >= m && C.y <= y && C !== r && C !== o && me(a, l, c, h, u, f, C.x, C.y) && z(C.prev, C, C.next) >= 0)\n return !1;\n C = C.nextZ;\n }\n return !0;\n}\nfunction oy(e, t, n) {\n let s = e;\n do {\n const r = s.prev, i = s.next.next;\n !Zn(r, i) && _c(r, s, s.next, i) && Ve(r, i) && Ve(i, r) && (t.push(r.i / n | 0), t.push(s.i / n | 0), t.push(i.i / n | 0), je(s), je(s.next), s = e = i), s = s.next;\n } while (s !== e);\n return ne(s);\n}\nfunction ay(e, t, n, s, r, i) {\n let o = e;\n do {\n let a = o.next.next;\n for (; a !== o.prev; ) {\n if (o.i !== a.i && Ay(o, a)) {\n let c = wc(o, a);\n o = ne(o, o.next), c = ne(c, c.next), Je(o, t, n, s, r, i, 0), Je(c, t, n, s, r, i, 0);\n return;\n }\n a = a.next;\n }\n o = o.next;\n } while (o !== e);\n}\nfunction cy(e, t, n, s, r, i) {\n const o = [];\n let a, c, u, l, h;\n for (a = 0, c = t.length; a < c; a++)\n u = t[a] * s, l = a < c - 1 ? t[a + 1] * s : e.length, h = bc(e, u, l, s, !1, r && r[a + 1], i), h === h.next && (h.steiner = !0), o.push(gy(h));\n for (o.sort(uy), a = 0; a < o.length; a++)\n n = ly(o[a], n);\n return n;\n}\nfunction uy(e, t) {\n return e.x - t.x;\n}\nfunction ly(e, t) {\n const n = hy(e, t);\n if (!n)\n return t;\n const s = wc(n, e);\n return ne(s, s.next), ne(n, n.next);\n}\nfunction hy(e, t) {\n let n = t;\n const s = e.x, r = e.y;\n let i = -1 / 0, o;\n do {\n if (r <= n.y && r >= n.next.y && n.next.y !== n.y) {\n const f = n.x + (r - n.y) * (n.next.x - n.x) / (n.next.y - n.y);\n if (f <= s && f > i && (i = f, o = n.x < n.next.x ? n : n.next, f === s))\n return o;\n }\n n = n.next;\n } while (n !== t);\n if (!o)\n return null;\n const a = o, c = o.x, u = o.y;\n let l = 1 / 0, h;\n n = o;\n do\n s >= n.x && n.x >= c && s !== n.x && me(r < u ? s : i, r, c, u, r < u ? i : s, r, n.x, n.y) && (h = Math.abs(r - n.y) / (s - n.x), Ve(n, e) && (h < l || h === l && (n.x > o.x || n.x === o.x && fy(o, n))) && (o = n, l = h)), n = n.next;\n while (n !== a);\n return o;\n}\nfunction fy(e, t) {\n return z(e.prev, e, t.prev) < 0 && z(t.next, e, e.next) < 0;\n}\nfunction dy(e, t, n, s) {\n let r = e;\n do\n r.z === 0 && (r.z = rr(r.x, r.y, t, n, s)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next;\n while (r !== e);\n r.prevZ.nextZ = null, r.prevZ = null, my(r);\n}\nfunction my(e) {\n let t, n, s = 1, r, i, o, a, c, u;\n do {\n for (i = e, e = null, u = null, r = 0; i; ) {\n for (r++, a = i, o = 0, n = 0; n < s && (o++, a = a.nextZ, !!a); n++)\n ;\n for (c = s; o > 0 || c > 0 && a; )\n o !== 0 && (c === 0 || !a || i.z <= a.z) ? (t = i, i = i.nextZ, o--) : (t = a, a = a.nextZ, c--), u ? u.nextZ = t : e = t, t.prevZ = u, u = t;\n i = a;\n }\n u.nextZ = null, s *= 2;\n } while (r > 1);\n return e;\n}\nfunction rr(e, t, n, s, r) {\n return e = (e - n) * r | 0, t = (t - s) * r | 0, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, t = (t | t << 8) & 16711935, t = (t | t << 4) & 252645135, t = (t | t << 2) & 858993459, t = (t | t << 1) & 1431655765, e | t << 1;\n}\nfunction gy(e) {\n let t = e, n = e;\n do\n (t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next;\n while (t !== e);\n return n;\n}\nfunction me(e, t, n, s, r, i, o, a) {\n return (r - o) * (t - a) >= (e - o) * (i - a) && (e - o) * (s - a) >= (n - o) * (t - a) && (n - o) * (i - a) >= (r - o) * (s - a);\n}\nfunction Ay(e, t) {\n return e.next.i !== t.i && e.prev.i !== t.i && !py(e, t) && // dones't intersect other edges\n (Ve(e, t) && Ve(t, e) && yy(e, t) && // locally visible\n (z(e.prev, e, t.prev) || z(e, t.prev, t)) || // does not create opposite-facing sectors\n Zn(e, t) && z(e.prev, e, e.next) > 0 && z(t.prev, t, t.next) > 0);\n}\nfunction z(e, t, n) {\n return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y);\n}\nfunction Zn(e, t) {\n return e.x === t.x && e.y === t.y;\n}\nfunction _c(e, t, n, s) {\n const r = Bn(z(e, t, n)), i = Bn(z(e, t, s)), o = Bn(z(n, s, e)), a = Bn(z(n, s, t));\n return !!(r !== i && o !== a || r === 0 && yn(e, n, t) || i === 0 && yn(e, s, t) || o === 0 && yn(n, e, s) || a === 0 && yn(n, t, s));\n}\nfunction yn(e, t, n) {\n return t.x <= Math.max(e.x, n.x) && t.x >= Math.min(e.x, n.x) && t.y <= Math.max(e.y, n.y) && t.y >= Math.min(e.y, n.y);\n}\nfunction Bn(e) {\n return e > 0 ? 1 : e < 0 ? -1 : 0;\n}\nfunction py(e, t) {\n let n = e;\n do {\n if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && _c(n, n.next, e, t))\n return !0;\n n = n.next;\n } while (n !== e);\n return !1;\n}\nfunction Ve(e, t) {\n return z(e.prev, e, e.next) < 0 ? z(e, t, e.next) >= 0 && z(e, e.prev, t) >= 0 : z(e, t, e.prev) < 0 || z(e, e.next, t) < 0;\n}\nfunction yy(e, t) {\n let n = e, s = !1;\n const r = (e.x + t.x) / 2, i = (e.y + t.y) / 2;\n do\n n.y > i != n.next.y > i && n.next.y !== n.y && r < (n.next.x - n.x) * (i - n.y) / (n.next.y - n.y) + n.x && (s = !s), n = n.next;\n while (n !== e);\n return s;\n}\nfunction wc(e, t) {\n const n = new ir(e.i, e.x, e.y), s = new ir(t.i, t.x, t.y), r = e.next, i = t.prev;\n return e.next = t, t.prev = e, n.next = r, r.prev = n, s.next = n, n.prev = s, i.next = s, s.prev = i, s;\n}\nfunction po(e, t, n, s) {\n const r = new ir(e, t, n);\n return s ? (r.next = s.next, r.prev = s, s.next.prev = r, s.next = r) : (r.prev = r, r.next = r), r;\n}\nfunction je(e) {\n e.next.prev = e.prev, e.prev.next = e.next, e.prevZ && (e.prevZ.nextZ = e.nextZ), e.nextZ && (e.nextZ.prevZ = e.prevZ);\n}\nclass ir {\n constructor(t, n, s) {\n this.prev = null, this.next = null, this.z = 0, this.prevZ = null, this.nextZ = null, this.steiner = !1, this.i = t, this.x = n, this.y = s;\n }\n}\nfunction By(e, t, n) {\n const s = Cy(e), r = Object.keys(s).filter((i) => s[i] !== Array);\n return Ey(e, {\n propArrayTypes: s,\n ...t\n }, {\n numericPropKeys: n && n.numericPropKeys || r,\n PositionDataType: n ? n.PositionDataType : Float32Array,\n triangulate: n ? n.triangulate : !0\n });\n}\nfunction Cy(e) {\n const t = {};\n for (const n of e)\n if (n.properties)\n for (const s in n.properties) {\n const r = n.properties[s];\n t[s] = My(r, t[s]);\n }\n return t;\n}\nfunction Ey(e, t, n) {\n const {\n pointPositionsCount: s,\n pointFeaturesCount: r,\n linePositionsCount: i,\n linePathsCount: o,\n lineFeaturesCount: a,\n polygonPositionsCount: c,\n polygonObjectsCount: u,\n polygonRingsCount: l,\n polygonFeaturesCount: h,\n propArrayTypes: f,\n coordLength: d\n } = t, {\n numericPropKeys: m = [],\n PositionDataType: g = Float32Array,\n triangulate: y = !0\n } = n, E = e[0] && \"id\" in e[0], R = e.length > 65535 ? Uint32Array : Uint16Array, B = {\n type: \"Point\",\n positions: new g(s * d),\n globalFeatureIds: new R(s),\n featureIds: r > 65535 ? new Uint32Array(s) : new Uint16Array(s),\n numericProps: {},\n properties: [],\n fields: []\n }, C = {\n type: \"LineString\",\n pathIndices: i > 65535 ? new Uint32Array(o + 1) : new Uint16Array(o + 1),\n positions: new g(i * d),\n globalFeatureIds: new R(i),\n featureIds: a > 65535 ? new Uint32Array(i) : new Uint16Array(i),\n numericProps: {},\n properties: [],\n fields: []\n }, M = {\n type: \"Polygon\",\n polygonIndices: c > 65535 ? new Uint32Array(u + 1) : new Uint16Array(u + 1),\n primitivePolygonIndices: c > 65535 ? new Uint32Array(l + 1) : new Uint16Array(l + 1),\n positions: new g(c * d),\n globalFeatureIds: new R(c),\n featureIds: h > 65535 ? new Uint32Array(c) : new Uint16Array(c),\n numericProps: {},\n properties: [],\n fields: []\n };\n y && (M.triangles = []);\n for (const O of [B, C, M])\n for (const F of m) {\n const v = f[F];\n O.numericProps[F] = new v(O.positions.length / d);\n }\n C.pathIndices[o] = i, M.polygonIndices[u] = c, M.primitivePolygonIndices[l] = c;\n const b = {\n pointPosition: 0,\n pointFeature: 0,\n linePosition: 0,\n linePath: 0,\n lineFeature: 0,\n polygonPosition: 0,\n polygonObject: 0,\n polygonRing: 0,\n polygonFeature: 0,\n feature: 0\n };\n for (const O of e) {\n const F = O.geometry, v = O.properties || {};\n switch (F.type) {\n case \"Point\":\n Ty(F, B, b, d, v), B.properties.push(xs(v, m)), E && B.fields.push({\n id: O.id\n }), b.pointFeature++;\n break;\n case \"LineString\":\n by(F, C, b, d, v), C.properties.push(xs(v, m)), E && C.fields.push({\n id: O.id\n }), b.lineFeature++;\n break;\n case \"Polygon\":\n _y(F, M, b, d, v), M.properties.push(xs(v, m)), E && M.fields.push({\n id: O.id\n }), b.polygonFeature++;\n break;\n default:\n throw new Error(\"Invalid geometry type\");\n }\n b.feature++;\n }\n return Ry(B, C, M, d);\n}\nfunction Ty(e, t, n, s, r) {\n t.positions.set(e.data, n.pointPosition * s);\n const i = e.data.length / s;\n Hr(t, r, n.pointPosition, i), t.globalFeatureIds.fill(n.feature, n.pointPosition, n.pointPosition + i), t.featureIds.fill(n.pointFeature, n.pointPosition, n.pointPosition + i), n.pointPosition += i;\n}\nfunction by(e, t, n, s, r) {\n t.positions.set(e.data, n.linePosition * s);\n const i = e.data.length / s;\n Hr(t, r, n.linePosition, i), t.globalFeatureIds.fill(n.feature, n.linePosition, n.linePosition + i), t.featureIds.fill(n.lineFeature, n.linePosition, n.linePosition + i);\n for (let o = 0, a = e.indices.length; o < a; ++o) {\n const c = e.indices[o], u = o === a - 1 ? e.data.length : e.indices[o + 1];\n t.pathIndices[n.linePath++] = n.linePosition, n.linePosition += (u - c) / s;\n }\n}\nfunction _y(e, t, n, s, r) {\n t.positions.set(e.data, n.polygonPosition * s);\n const i = e.data.length / s;\n Hr(t, r, n.polygonPosition, i), t.globalFeatureIds.fill(n.feature, n.polygonPosition, n.polygonPosition + i), t.featureIds.fill(n.polygonFeature, n.polygonPosition, n.polygonPosition + i);\n for (let o = 0, a = e.indices.length; o < a; ++o) {\n const c = n.polygonPosition;\n t.polygonIndices[n.polygonObject++] = c;\n const u = e.areas[o], l = e.indices[o], h = e.indices[o + 1];\n for (let d = 0, m = l.length; d < m; ++d) {\n const g = l[d], y = d === m - 1 ? h === void 0 ? e.data.length : h[0] : l[d + 1];\n t.primitivePolygonIndices[n.polygonRing++] = n.polygonPosition, n.polygonPosition += (y - g) / s;\n }\n const f = n.polygonPosition;\n wy(t, u, l, {\n startPosition: c,\n endPosition: f,\n coordLength: s\n });\n }\n}\nfunction wy(e, t, n, s) {\n let {\n startPosition: r,\n endPosition: i,\n coordLength: o\n } = s;\n if (!e.triangles)\n return;\n const a = r * o, c = i * o, u = e.positions.subarray(a, c), l = n[0], h = n.slice(1).map((d) => (d - l) / o), f = sy(u, h, o, t);\n for (let d = 0, m = f.length; d < m; ++d)\n e.triangles.push(r + f[d]);\n}\nfunction Is(e, t) {\n const n = {};\n for (const s in e)\n n[s] = {\n value: e[s],\n size: t\n };\n return n;\n}\nfunction Ry(e, t, n, s) {\n const r = {\n shape: \"binary-feature-collection\",\n points: {\n ...e,\n positions: {\n value: e.positions,\n size: s\n },\n globalFeatureIds: {\n value: e.globalFeatureIds,\n size: 1\n },\n featureIds: {\n value: e.featureIds,\n size: 1\n },\n numericProps: Is(e.numericProps, 1)\n },\n lines: {\n ...t,\n positions: {\n value: t.positions,\n size: s\n },\n pathIndices: {\n value: t.pathIndices,\n size: 1\n },\n globalFeatureIds: {\n value: t.globalFeatureIds,\n size: 1\n },\n featureIds: {\n value: t.featureIds,\n size: 1\n },\n numericProps: Is(t.numericProps, 1)\n },\n polygons: {\n ...n,\n positions: {\n value: n.positions,\n size: s\n },\n polygonIndices: {\n value: n.polygonIndices,\n size: 1\n },\n primitivePolygonIndices: {\n value: n.primitivePolygonIndices,\n size: 1\n },\n globalFeatureIds: {\n value: n.globalFeatureIds,\n size: 1\n },\n featureIds: {\n value: n.featureIds,\n size: 1\n },\n numericProps: Is(n.numericProps, 1)\n }\n };\n return r.polygons && n.triangles && (r.polygons.triangles = {\n value: new Uint32Array(n.triangles),\n size: 1\n }), r;\n}\nfunction Hr(e, t, n, s) {\n for (const r in e.numericProps)\n if (r in t) {\n const i = t[r];\n e.numericProps[r].fill(i, n, n + s);\n }\n}\nfunction xs(e, t) {\n const n = {};\n for (const s in e)\n t.includes(s) || (n[s] = e[s]);\n return n;\n}\nfunction My(e, t) {\n return t === Array || !Number.isFinite(e) ? Array : t === Float64Array || Math.fround(e) !== e ? Float64Array : Float32Array;\n}\nfunction Sy(e) {\n let t = 0, n = 0, s = 0, r = 0, i = 0, o = 0, a = 0, c = 0, u = 0;\n const l = /* @__PURE__ */ new Set();\n for (const h of e) {\n const f = h.geometry;\n switch (f.type) {\n case \"Point\":\n n++, t++, l.add(f.coordinates.length);\n break;\n case \"MultiPoint\":\n n++, t += f.coordinates.length;\n for (const m of f.coordinates)\n l.add(m.length);\n break;\n case \"LineString\":\n i++, s += f.coordinates.length, r++;\n for (const m of f.coordinates)\n l.add(m.length);\n break;\n case \"MultiLineString\":\n i++;\n for (const m of f.coordinates) {\n s += m.length, r++;\n for (const g of m)\n l.add(g.length);\n }\n break;\n case \"Polygon\":\n u++, a++, c += f.coordinates.length;\n const d = f.coordinates.flat();\n o += d.length;\n for (const m of d)\n l.add(m.length);\n break;\n case \"MultiPolygon\":\n u++;\n for (const m of f.coordinates) {\n a++, c += m.length;\n const g = m.flat();\n o += g.length;\n for (const y of g)\n l.add(y.length);\n }\n break;\n default:\n throw new Error(`Unsupported geometry type: ${f.type}`);\n }\n }\n return {\n coordLength: l.size > 0 ? Math.max(...l) : 2,\n pointPositionsCount: t,\n pointFeaturesCount: n,\n linePositionsCount: s,\n linePathsCount: r,\n lineFeaturesCount: i,\n polygonPositionsCount: o,\n polygonObjectsCount: a,\n polygonRingsCount: c,\n polygonFeaturesCount: u\n };\n}\nfunction Iy(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {\n coordLength: 2,\n fixRingWinding: !0\n };\n return e.map((n) => xy(n, t));\n}\nfunction yo(e, t, n, s) {\n n.push(t.length), t.push(...e);\n for (let r = e.length; r < s.coordLength; r++)\n t.push(0);\n}\nfunction or(e, t, n, s) {\n n.push(t.length);\n for (const r of e) {\n t.push(...r);\n for (let i = r.length; i < s.coordLength; i++)\n t.push(0);\n }\n}\nfunction Bo(e, t, n, s, r) {\n let i = 0;\n const o = [], a = [];\n for (const c of e) {\n const u = c.map((f) => f.slice(0, 2));\n let l = Tc(u.flat());\n const h = l < 0;\n r.fixRingWinding && (i === 0 && !h || i > 0 && h) && (c.reverse(), l = -l), o.push(l), or(c, t, a, r), i++;\n }\n i > 0 && (s.push(o), n.push(a));\n}\nfunction xy(e, t) {\n const {\n geometry: n\n } = e;\n if (n.type === \"GeometryCollection\")\n throw new Error(\"GeometryCollection type not supported\");\n const s = [], r = [];\n let i, o;\n switch (n.type) {\n case \"Point\":\n o = \"Point\", yo(n.coordinates, s, r, t);\n break;\n case \"MultiPoint\":\n o = \"Point\", n.coordinates.map((a) => yo(a, s, r, t));\n break;\n case \"LineString\":\n o = \"LineString\", or(n.coordinates, s, r, t);\n break;\n case \"MultiLineString\":\n o = \"LineString\", n.coordinates.map((a) => or(a, s, r, t));\n break;\n case \"Polygon\":\n o = \"Polygon\", i = [], Bo(n.coordinates, s, r, i, t);\n break;\n case \"MultiPolygon\":\n o = \"Polygon\", i = [], n.coordinates.map((a) => Bo(a, s, r, i, t));\n break;\n default:\n throw new Error(`Unknown type: ${o}`);\n }\n return {\n ...e,\n geometry: {\n type: o,\n indices: r,\n data: s,\n areas: i\n }\n };\n}\nfunction Rc(e) {\n let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {\n fixRingWinding: !0,\n triangulate: !0\n };\n const n = Sy(e), s = n.coordLength, {\n fixRingWinding: r\n } = t, i = Iy(e, {\n coordLength: s,\n fixRingWinding: r\n });\n return By(i, n, {\n numericPropKeys: t.numericPropKeys,\n PositionDataType: t.PositionDataType || Float32Array,\n triangulate: t.triangulate\n });\n}\nconst vy = \"4.1.4\", Oy = {\n name: \"GeoJSON\",\n id: \"geojson\",\n module: \"geojson\",\n version: vy,\n worker: !0,\n extensions: [\"geojson\"],\n mimeTypes: [\"application/geo+json\"],\n category: \"geometry\",\n text: !0,\n options: {\n geojson: {\n shape: \"object-row-table\"\n },\n json: {\n shape: \"object-row-table\",\n jsonpaths: [\"$\", \"$.features\"]\n },\n gis: {\n format: \"geojson\"\n }\n }\n}, ke = {\n ...Oy,\n parse: Fy,\n parseTextSync: Mc,\n parseInBatches: Dy\n};\nasync function Fy(e, t) {\n return Mc(new TextDecoder().decode(e), t);\n}\nfunction Mc(e, t) {\n var n;\n t = {\n ...ke.options,\n ...t\n }, t.geojson = {\n ...ke.options.geojson,\n ...t.geojson\n }, t.gis = t.gis || {};\n let s;\n try {\n s = JSON.parse(e);\n } catch {\n s = {};\n }\n const r = {\n shape: \"geojson-table\",\n type: \"FeatureCollection\",\n features: ((n = s) === null || n === void 0 ? void 0 : n.features) || []\n };\n switch (t.gis.format) {\n case \"binary\":\n return Rc(r.features);\n default:\n return r;\n }\n}\nfunction Dy(e, t) {\n t = {\n ...ke.options,\n ...t\n }, t.json = {\n ...ke.options.geojson,\n ...t.geojson\n };\n const n = ny(e, t);\n switch (t.gis.format) {\n case \"binary\":\n return Ly(n);\n default:\n return n;\n }\n}\nasync function* Ly(e) {\n for await (const t of e)\n t.data = Rc(t.data), yield t;\n}\nfunction $t(e, t) {\n if (!e)\n throw new Error(t || \"loader assertion failed.\");\n}\nconst Py = \"Queued Requests\", Gy = \"Active Requests\", Ny = \"Cancelled Requests\", Uy = \"Queued Requests Ever\", Hy = \"Active Requests Ever\", Jy = {\n id: \"request-scheduler\",\n /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */\n throttleRequests: !0,\n /** The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit. */\n maxRequests: 6,\n /**\n * Specifies a debounce time, in milliseconds. All requests are queued, until no new requests have\n * been added to the queue for this amount of time.\n */\n debounceTime: 0\n};\nclass Vy {\n constructor(t = {}) {\n p(this, \"props\");\n p(this, \"stats\");\n p(this, \"activeRequestCount\", 0);\n /** Tracks the number of active requests and prioritizes/cancels queued requests. */\n p(this, \"requestQueue\", []);\n p(this, \"requestMap\", /* @__PURE__ */ new Map());\n p(this, \"updateTimer\", null);\n this.props = { ...Jy, ...t }, this.stats = new qo({ id: this.props.id }), this.stats.get(Py), this.stats.get(Gy), this.stats.get(Ny), this.stats.get(Uy), this.stats.get(Hy);\n }\n /**\n * Called by an application that wants to issue a request, without having it deeply queued by the browser\n *\n * When the returned promise resolved, it is OK for the application to issue a request.\n * The promise resolves to an object that contains a `done` method.\n * When the application's request has completed (or failed), the application must call the `done` function\n *\n * @param handle\n * @param getPriority will be called when request \"slots\" open up,\n * allowing the caller to update priority or cancel the request\n * Highest priority executes first, priority < 0 cancels the request\n * @returns a promise\n * - resolves to a object (with a `done` field) when the request can be issued without queueing,\n * - resolves to `null` if the request has been cancelled (by the callback return < 0).\n * In this case the application should not issue the request\n */\n scheduleRequest(t, n = () => 0) {\n if (!this.props.throttleRequests)\n return Promise.resolve({ done: () => {\n } });\n if (this.requestMap.has(t))\n return this.requestMap.get(t);\n const s = { handle: t, priority: 0, getPriority: n }, r = new Promise((i) => (s.resolve = i, s));\n return this.requestQueue.push(s), this.requestMap.set(t, r), this._issueNewRequests(), r;\n }\n // PRIVATE\n _issueRequest(t) {\n const { handle: n, resolve: s } = t;\n let r = !1;\n const i = () => {\n r || (r = !0, this.requestMap.delete(n), this.activeRequestCount--, this._issueNewRequests());\n };\n return this.activeRequestCount++, s ? s({ done: i }) : Promise.resolve({ done: i });\n }\n /** We check requests asynchronously, to prevent multiple updates */\n _issueNewRequests() {\n this.updateTimer !== null && clearTimeout(this.updateTimer), this.updateTimer = setTimeout(() => this._issueNewRequestsAsync(), this.props.debounceTime);\n }\n /** Refresh all requests */\n _issueNewRequestsAsync() {\n this.updateTimer !== null && clearTimeout(this.updateTimer), this.updateTimer = null;\n const t = Math.max(this.props.maxRequests - this.activeRequestCount, 0);\n if (t !== 0) {\n this._updateAllRequests();\n for (let n = 0; n < t; ++n) {\n const s = this.requestQueue.shift();\n s && this._issueRequest(s);\n }\n }\n }\n /** Ensure all requests have updated priorities, and that no longer valid requests are cancelled */\n _updateAllRequests() {\n const t = this.requestQueue;\n for (let n = 0; n < t.length; ++n) {\n const s = t[n];\n this._updateRequest(s) || (t.splice(n, 1), this.requestMap.delete(s.handle), n--);\n }\n t.sort((n, s) => n.priority - s.priority);\n }\n /** Update a single request by calling the callback */\n _updateRequest(t) {\n return t.priority = t.getPriority(t.handle), t.priority < 0 ? (t.resolve(null), !1) : !0;\n }\n}\nfunction jy(e) {\n const t = e ? e.lastIndexOf(\"/\") : -1;\n return t >= 0 ? e.substr(0, t) : \"\";\n}\nclass ky {\n constructor(t, n, s) {\n p(this, \"item\");\n p(this, \"previous\");\n p(this, \"next\");\n this.item = t, this.previous = n, this.next = s;\n }\n}\nclass Ky {\n constructor() {\n p(this, \"head\", null);\n p(this, \"tail\", null);\n p(this, \"_length\", 0);\n }\n get length() {\n return this._length;\n }\n /**\n * Adds the item to the end of the list\n * @param {*} [item]\n * @return {DoublyLinkedListNode}\n */\n add(t) {\n const n = new ky(t, this.tail, null);\n return this.tail ? (this.tail.next = n, this.tail = n) : (this.head = n, this.tail = n), ++this._length, n;\n }\n /**\n * Removes the given node from the list\n * @param {DoublyLinkedListNode} node\n */\n remove(t) {\n t && (t.previous && t.next ? (t.previous.next = t.next, t.next.previous = t.previous) : t.previous ? (t.previous.next = null, this.tail = t.previous) : t.next ? (t.next.previous = null, this.head = t.next) : (this.head = null, this.tail = null), t.next = null, t.previous = null, --this._length);\n }\n /**\n * Moves nextNode after node\n * @param {DoublyLinkedListNode} node\n * @param {DoublyLinkedListNode} nextNode\n */\n splice(t, n) {\n t !== n && (this.remove(n), this._insert(t, n));\n }\n _insert(t, n) {\n const s = t.next;\n t.next = n, this.tail === t ? this.tail = n : s.previous = n, n.next = s, n.previous = t, ++this._length;\n }\n}\nclass zy {\n constructor() {\n p(this, \"_list\");\n p(this, \"_sentinel\");\n p(this, \"_trimTiles\");\n this._list = new Ky(), this._sentinel = this._list.add(\"sentinel\"), this._trimTiles = !1;\n }\n reset() {\n this._list.splice(this._list.tail, this._sentinel);\n }\n touch(t) {\n const n = t._cacheNode;\n n && this._list.splice(this._sentinel, n);\n }\n add(t, n, s) {\n n._cacheNode || (n._cacheNode = this._list.add(n), s && s(t, n));\n }\n unloadTile(t, n, s) {\n const r = n._cacheNode;\n r && (this._list.remove(r), n._cacheNode = null, s && s(t, n));\n }\n unloadTiles(t, n) {\n const s = this._trimTiles;\n this._trimTiles = !1;\n const r = this._list, i = t.maximumMemoryUsage * 1024 * 1024, o = this._sentinel;\n let a = r.head;\n for (; a !== o && (t.gpuMemoryUsageInBytes > i || s); ) {\n const c = a.item;\n a = a.next, this.unloadTile(t, c, n);\n }\n }\n trim() {\n this._trimTiles = !0;\n }\n}\nfunction Wy(e, t) {\n $t(e), $t(t);\n const { rtcCenter: n, gltfUpAxis: s } = t, { computedTransform: r, boundingVolume: { center: i } } = e;\n let o = new V(r);\n switch (n && o.translate(n), s) {\n case \"Z\":\n break;\n case \"Y\":\n const h = new V().rotateX(Math.PI / 2);\n o = o.multiplyRight(h);\n break;\n case \"X\":\n const f = new V().rotateY(-Math.PI / 2);\n o = o.multiplyRight(f);\n break;\n }\n t.isQuantized && o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);\n const a = new A(i);\n t.cartesianModelMatrix = o, t.cartesianOrigin = a;\n const c = J.WGS84.cartesianToCartographic(a, new A()), l = J.WGS84.eastNorthUpToFixedFrame(a).invert();\n t.cartographicModelMatrix = l.multiplyRight(o), t.cartographicOrigin = c, t.coordinateSystem || (t.modelMatrix = t.cartographicModelMatrix);\n}\nconst Co = new A(), vs = new A(), ar = new dt([\n new tt(),\n new tt(),\n new tt(),\n new tt(),\n new tt(),\n new tt()\n]);\nfunction Xy(e, t) {\n const { cameraDirection: n, cameraUp: s, height: r } = e, { metersPerUnit: i } = e.distanceScales, o = wn(e, e.center), a = J.WGS84.eastNorthUpToFixedFrame(o), c = e.unprojectPosition(e.cameraPosition), u = J.WGS84.cartographicToCartesian(c, new A()), l = new A(\n // @ts-ignore\n a.transformAsVector(new A(n).scale(i))\n ).normalize(), h = new A(\n // @ts-ignore\n a.transformAsVector(new A(s).scale(i))\n ).normalize();\n qy(e);\n const f = e.constructor, { longitude: d, latitude: m, width: g, bearing: y, zoom: E } = e, R = new f({\n longitude: d,\n latitude: m,\n height: r,\n width: g,\n bearing: y,\n zoom: E,\n pitch: 0\n });\n return {\n camera: {\n position: u,\n direction: l,\n up: h\n },\n viewport: e,\n topDownViewport: R,\n height: r,\n cullingVolume: ar,\n frameNumber: t,\n // TODO: This can be the same between updates, what number is unique for between updates?\n sseDenominator: 1.15\n // Assumes fovy = 60 degrees\n };\n}\nfunction Qy(e, t, n) {\n if (n === 0 || e.length <= n)\n return [e, []];\n const s = [], { longitude: r, latitude: i } = t.viewport;\n for (const [u, l] of e.entries()) {\n const [h, f] = l.header.mbs, d = Math.abs(r - h), m = Math.abs(i - f), g = Math.sqrt(m * m + d * d);\n s.push([u, g]);\n }\n const o = s.sort((u, l) => u[1] - l[1]), a = [];\n for (let u = 0; u < n; u++)\n a.push(e[o[u][0]]);\n const c = [];\n for (let u = n; u < o.length; u++)\n c.push(e[o[u][0]]);\n return [a, c];\n}\nfunction qy(e) {\n const t = e.getFrustumPlanes(), n = Eo(t.near, e.cameraPosition), s = wn(e, n), r = wn(e, e.cameraPosition, vs);\n let i = 0;\n ar.planes[i++].fromPointNormal(s, Co.copy(s).subtract(r));\n for (const o in t) {\n if (o === \"near\")\n continue;\n const a = t[o], c = Eo(a, n, vs), u = wn(e, c, vs);\n ar.planes[i++].fromPointNormal(\n u,\n // Want the normal to point into the frustum since that's what culling expects\n Co.copy(s).subtract(u)\n );\n }\n}\nfunction Eo(e, t, n = new A()) {\n const s = e.normal.dot(t);\n return n.copy(e.normal).scale(e.distance - s).add(t), n;\n}\nfunction wn(e, t, n = new A()) {\n const s = e.unprojectPosition(t);\n return J.WGS84.cartographicToCartesian(s, n);\n}\nconst Yy = 6378137, $y = 6378137, cr = 6356752314245179e-9, ge = new A();\nfunction Zy(e, t) {\n if (e instanceof qe) {\n const { halfAxes: n } = e, s = eB(n);\n return Math.log2(cr / (s + t[2]));\n } else if (e instanceof Qe) {\n const { radius: n } = e;\n return Math.log2(cr / (n + t[2]));\n } else if (e.width && e.height) {\n const { width: n, height: s } = e, r = Math.log2(Yy / n), i = Math.log2($y / s);\n return (r + i) / 2;\n }\n return 1;\n}\nfunction Sc(e, t, n) {\n J.WGS84.cartographicToCartesian([e.xmax, e.ymax, e.zmax], ge);\n const s = Math.sqrt(Math.pow(ge[0] - n[0], 2) + Math.pow(ge[1] - n[1], 2) + Math.pow(ge[2] - n[2], 2));\n return Math.log2(cr / (s + t[2]));\n}\nfunction tB(e, t, n) {\n const [s, r, i, o] = e;\n return Sc({ xmin: s, xmax: i, ymin: r, ymax: o, zmin: 0, zmax: 0 }, t, n);\n}\nfunction eB(e) {\n e.getColumn(0, ge);\n const t = e.getColumn(1), n = e.getColumn(2);\n return ge.add(t).add(n).len();\n}\nconst lt = {\n UNLOADED: 0,\n // Has never been requested\n LOADING: 1,\n // Is waiting on a pending request\n PROCESSING: 2,\n // Request received. Contents are being processed for rendering. Depending on the content, it might make its own requests for external data.\n READY: 3,\n // Ready to render.\n EXPIRED: 4,\n // Is expired and will be unloaded once new content is loaded.\n FAILED: 5\n // Request failed.\n};\nvar Ht;\n(function(e) {\n e[e.ADD = 1] = \"ADD\", e[e.REPLACE = 2] = \"REPLACE\";\n})(Ht || (Ht = {}));\nvar Pe;\n(function(e) {\n e.EMPTY = \"empty\", e.SCENEGRAPH = \"scenegraph\", e.POINTCLOUD = \"pointcloud\", e.MESH = \"mesh\";\n})(Pe || (Pe = {}));\nvar At;\n(function(e) {\n e.I3S = \"I3S\", e.TILES3D = \"TILES3D\";\n})(At || (At = {}));\nvar To;\n(function(e) {\n e.GEOMETRIC_ERROR = \"geometricError\", e.MAX_SCREEN_THRESHOLD = \"maxScreenThreshold\";\n})(To || (To = {}));\nconst nB = {\n NOT_COMPUTED: -1,\n USE_OPTIMIZATION: 1,\n SKIP_OPTIMIZATION: 0\n};\nfunction Ic(e) {\n return e != null;\n}\nconst rt = new A(), Rn = new A(), sB = new A(), rB = new A(), qt = new A(), bo = new A(), _o = new A(), wo = new A();\nfunction Os(e, t, n) {\n if ($t(e, \"3D Tile: boundingVolume must be defined\"), e.box)\n return xc(e.box, t, n);\n if (e.region)\n return aB(e.region);\n if (e.sphere)\n return oB(e.sphere, t, n);\n throw new Error(\"3D Tile: boundingVolume must contain a sphere, region, or box\");\n}\nfunction iB(e, t) {\n if (e.box)\n return cB(t);\n if (e.region) {\n const [n, s, r, i, o, a] = e.region;\n return [\n [Rt(n), Rt(s), o],\n [Rt(r), Rt(i), a]\n ];\n }\n if (e.sphere)\n return uB(t);\n throw new Error(\"Unkown boundingVolume type\");\n}\nfunction xc(e, t, n) {\n const s = new A(e[0], e[1], e[2]);\n t.transform(s, s);\n let r = [];\n if (e.length === 10) {\n const u = e.slice(3, 6), l = new On();\n l.fromArray(e, 6);\n const h = new A([1, 0, 0]), f = new A([0, 1, 0]), d = new A([0, 0, 1]);\n h.transformByQuaternion(l), h.scale(u[0]), f.transformByQuaternion(l), f.scale(u[1]), d.transformByQuaternion(l), d.scale(u[2]), r = [...h.toArray(), ...f.toArray(), ...d.toArray()];\n } else\n r = [...e.slice(3, 6), ...e.slice(6, 9), ...e.slice(9, 12)];\n const i = t.transformAsVector(r.slice(0, 3)), o = t.transformAsVector(r.slice(3, 6)), a = t.transformAsVector(r.slice(6, 9)), c = new W([\n i[0],\n i[1],\n i[2],\n o[0],\n o[1],\n o[2],\n a[0],\n a[1],\n a[2]\n ]);\n return Ic(n) ? (n.center = s, n.halfAxes = c, n) : new qe(s, c);\n}\nfunction oB(e, t, n) {\n const s = new A(e[0], e[1], e[2]);\n t.transform(s, s);\n const r = t.getScale(Rn), i = Math.max(Math.max(r[0], r[1]), r[2]), o = e[3] * i;\n return Ic(n) ? (n.center = s, n.radius = o, n) : new Qe(s, o);\n}\nfunction aB(e) {\n const [t, n, s, r, i, o] = e, a = J.WGS84.cartographicToCartesian([Rt(t), Rt(r), i], sB), c = J.WGS84.cartographicToCartesian([Rt(s), Rt(n), o], rB), u = new A().addVectors(a, c).multiplyByScalar(0.5);\n return J.WGS84.cartesianToCartographic(u, qt), J.WGS84.cartographicToCartesian([Rt(s), qt[1], qt[2]], bo), J.WGS84.cartographicToCartesian([qt[0], Rt(r), qt[2]], _o), J.WGS84.cartographicToCartesian([qt[0], qt[1], o], wo), xc([\n ...u,\n ...bo.subtract(u),\n ..._o.subtract(u),\n ...wo.subtract(u)\n ], new V());\n}\nfunction cB(e) {\n const t = vc(), { halfAxes: n } = e, s = new A(n.getColumn(0)), r = new A(n.getColumn(1)), i = new A(n.getColumn(2));\n for (let o = 0; o < 2; o++) {\n for (let a = 0; a < 2; a++) {\n for (let c = 0; c < 2; c++)\n rt.copy(e.center), rt.add(s), rt.add(r), rt.add(i), Oc(t, rt), i.negate();\n r.negate();\n }\n s.negate();\n }\n return t;\n}\nfunction uB(e) {\n const t = vc(), { center: n, radius: s } = e, r = J.WGS84.scaleToGeodeticSurface(n, rt);\n let i;\n r ? i = J.WGS84.geodeticSurfaceNormal(r) : i = new A(0, 0, 1);\n let o = new A(i[2], -i[1], 0);\n o.len() > 0 ? o.normalize() : o = new A(0, 1, 0);\n const a = o.clone().cross(i);\n for (const c of [o, a, i]) {\n Rn.copy(c).scale(s);\n for (let u = 0; u < 2; u++)\n rt.copy(n), rt.add(Rn), Oc(t, rt), Rn.negate();\n }\n return t;\n}\nfunction vc() {\n return [\n [1 / 0, 1 / 0, 1 / 0],\n [-1 / 0, -1 / 0, -1 / 0]\n ];\n}\nfunction Oc(e, t) {\n J.WGS84.cartesianToCartographic(t, rt), e[0][0] = Math.min(e[0][0], rt[0]), e[0][1] = Math.min(e[0][1], rt[1]), e[0][2] = Math.min(e[0][2], rt[2]), e[1][0] = Math.max(e[1][0], rt[0]), e[1][1] = Math.max(e[1][1], rt[1]), e[1][2] = Math.max(e[1][2], rt[2]);\n}\nnew A();\nnew A();\nnew V();\nnew A();\nnew A();\nnew A();\nfunction lB(e, t) {\n const n = e * t;\n return 1 - Math.exp(-(n * n));\n}\nfunction hB(e, t) {\n if (e.dynamicScreenSpaceError && e.dynamicScreenSpaceErrorComputedDensity) {\n const n = e.dynamicScreenSpaceErrorComputedDensity, s = e.dynamicScreenSpaceErrorFactor;\n return lB(t, n) * s;\n }\n return 0;\n}\nfunction fB(e, t, n) {\n const s = e.tileset, r = e.parent && e.parent.lodMetricValue || e.lodMetricValue, i = n ? r : e.lodMetricValue;\n if (i === 0)\n return 0;\n const o = Math.max(e._distanceToCamera, 1e-7), { height: a, sseDenominator: c } = t, { viewDistanceScale: u } = s.options;\n let l = i * a * (u || 1) / (o * c);\n return l -= hB(s, o), l;\n}\nconst Fs = new A(), Ro = new A(), jt = new A(), Mo = new A(), dB = new A(), Ds = new V(), So = new V();\nfunction mB(e, t) {\n if (e.lodMetricValue === 0 || isNaN(e.lodMetricValue))\n return \"DIG\";\n const n = 2 * Fc(e, t);\n return n < 2 ? \"OUT\" : !e.header.children || n <= e.lodMetricValue ? \"DRAW\" : e.header.children ? \"DIG\" : \"OUT\";\n}\nfunction Fc(e, t) {\n const { topDownViewport: n } = t, s = e.header.mbs[1], r = e.header.mbs[0], i = e.header.mbs[2], o = e.header.mbs[3], a = [...e.boundingVolume.center], c = n.unprojectPosition(n.cameraPosition);\n J.WGS84.cartographicToCartesian(c, Fs), Ro.copy(Fs).subtract(a).normalize(), J.WGS84.eastNorthUpToFixedFrame(a, Ds), So.copy(Ds).invert(), jt.copy(Fs).transform(So);\n const u = Math.sqrt(jt[0] * jt[0] + jt[1] * jt[1]), l = u * u / jt[2];\n Mo.copy([jt[0], jt[1], l]);\n const f = Mo.transform(Ds).subtract(a).normalize(), m = Ro.cross(f).normalize().scale(o).add(a), g = J.WGS84.cartesianToCartographic(m), y = n.project([r, s, i]), E = n.project(g);\n return dB.copy(y).subtract(E).magnitude();\n}\nfunction gB(e) {\n return {\n assetGltfUpAxis: e.asset && e.asset.gltfUpAxis || \"Y\"\n };\n}\nclass Io {\n constructor(t = 0) {\n p(this, \"_map\", /* @__PURE__ */ new Map());\n p(this, \"_array\");\n p(this, \"_length\");\n this._array = new Array(t), this._length = t;\n }\n /**\n * Gets or sets the length of the array.\n * If the set length is greater than the length of the internal array, the internal array is resized.\n *\n * @memberof ManagedArray.prototype\n * @type Number\n */\n get length() {\n return this._length;\n }\n set length(t) {\n this._length = t, t > this._array.length && (this._array.length = t);\n }\n /**\n * Gets the internal array.\n *\n * @memberof ManagedArray.prototype\n * @type Array\n * @readonly\n */\n get values() {\n return this._array;\n }\n /**\n * Gets the element at an index.\n *\n * @param {Number} index The index to get.\n */\n get(t) {\n return $t(t < this._array.length), this._array[t];\n }\n /**\n * Sets the element at an index. Resizes the array if index is greater than the length of the array.\n *\n * @param {Number} index The index to set.\n * @param {*} element The element to set at index.\n */\n set(t, n) {\n $t(t >= 0), t >= this.length && (this.length = t + 1), this._map.has(this._array[t]) && this._map.delete(this._array[t]), this._array[t] = n, this._map.set(n, t);\n }\n delete(t) {\n const n = this._map.get(t);\n n >= 0 && (this._array.splice(n, 1), this._map.delete(t), this.length--);\n }\n /**\n * Returns the last element in the array without modifying the array.\n *\n * @returns {*} The last element in the array.\n */\n peek() {\n return this._array[this._length - 1];\n }\n /**\n * Push an element into the array.\n *\n * @param {*} element The element to push.\n */\n push(t) {\n if (!this._map.has(t)) {\n const n = this.length++;\n this._array[n] = t, this._map.set(t, n);\n }\n }\n /**\n * Pop an element from the array.\n *\n * @returns {*} The last element in the array.\n */\n pop() {\n const t = this._array[--this.length];\n return this._map.delete(t), t;\n }\n /**\n * Resize the internal array if length > _array.length.\n *\n * @param {Number} length The length.\n */\n reserve(t) {\n $t(t >= 0), t > this._array.length && (this._array.length = t);\n }\n /**\n * Resize the array.\n *\n * @param {Number} length The length.\n */\n resize(t) {\n $t(t >= 0), this.length = t;\n }\n /**\n * Trim the internal array to the specified length. Defaults to the current length.\n *\n * @param {Number} [length] The length.\n */\n trim(t) {\n t == null && (t = this.length), this._array.length = t;\n }\n reset() {\n this._array = [], this._map = /* @__PURE__ */ new Map(), this._length = 0;\n }\n find(t) {\n return this._map.has(t);\n }\n}\nconst AB = {\n loadSiblings: !1,\n skipLevelOfDetail: !1,\n updateTransforms: !0,\n onTraversalEnd: () => {\n },\n viewportTraversersMap: {},\n basePath: \"\"\n};\nclass ts {\n // TODO nested props\n constructor(t) {\n p(this, \"options\");\n // fulfill in traverse call\n p(this, \"root\", null);\n // tiles should be rendered\n p(this, \"selectedTiles\", {});\n // tiles should be loaded from server\n p(this, \"requestedTiles\", {});\n // tiles does not have render content\n p(this, \"emptyTiles\", {});\n p(this, \"lastUpdate\", (/* @__PURE__ */ new Date()).getTime());\n p(this, \"updateDebounceTime\", 1e3);\n /** temporary storage to hold the traversed tiles during a traversal */\n p(this, \"_traversalStack\", new Io());\n p(this, \"_emptyTraversalStack\", new Io());\n /** set in every traverse cycle */\n p(this, \"_frameNumber\", null);\n this.options = { ...AB, ...t };\n }\n // RESULT\n traversalFinished(t) {\n return !0;\n }\n // tiles should be visible\n traverse(t, n, s) {\n this.root = t, this.options = { ...this.options, ...s }, this.reset(), this.updateTile(t, n), this._frameNumber = n.frameNumber, this.executeTraversal(t, n);\n }\n reset() {\n this.requestedTiles = {}, this.selectedTiles = {}, this.emptyTiles = {}, this._traversalStack.reset(), this._emptyTraversalStack.reset();\n }\n /**\n * Execute traverse\n * Depth-first traversal that traverses all visible tiles and marks tiles for selection.\n * If skipLevelOfDetail is off then a tile does not refine until all children are loaded.\n * This is the traditional replacement refinement approach and is called the base traversal.\n * Tiles that have a greater screen space error than the base screen space error are part of the base traversal,\n * all other tiles are part of the skip traversal. The skip traversal allows for skipping levels of the tree\n * and rendering children and parent tiles simultaneously.\n */\n /* eslint-disable-next-line complexity, max-statements */\n executeTraversal(t, n) {\n const s = this._traversalStack;\n for (t._selectionDepth = 1, s.push(t); s.length > 0; ) {\n const i = s.pop();\n let o = !1;\n this.canTraverse(i, n) && (this.updateChildTiles(i, n), o = this.updateAndPushChildren(i, n, s, i.hasRenderContent ? i._selectionDepth + 1 : i._selectionDepth));\n const a = i.parent, c = !!(!a || a._shouldRefine), u = !o;\n i.hasRenderContent ? i.refine === Ht.ADD ? (this.loadTile(i, n), this.selectTile(i, n)) : i.refine === Ht.REPLACE && (this.loadTile(i, n), u && this.selectTile(i, n)) : (this.emptyTiles[i.id] = i, this.loadTile(i, n), u && this.selectTile(i, n)), this.touchTile(i, n), i._shouldRefine = o && c;\n }\n const r = (/* @__PURE__ */ new Date()).getTime();\n (this.traversalFinished(n) || r - this.lastUpdate > this.updateDebounceTime) && (this.lastUpdate = r, this.options.onTraversalEnd(n));\n }\n updateChildTiles(t, n) {\n const s = t.children;\n for (const r of s)\n this.updateTile(r, n);\n }\n /* eslint-disable complexity, max-statements */\n updateAndPushChildren(t, n, s, r) {\n const { loadSiblings: i, skipLevelOfDetail: o } = this.options, a = t.children;\n a.sort(this.compareDistanceToCamera.bind(this));\n const c = t.refine === Ht.REPLACE && t.hasRenderContent && !o;\n let u = !1, l = !0;\n for (const h of a)\n if (h._selectionDepth = r, h.isVisibleAndInRequestVolume ? (s.find(h) && s.delete(h), s.push(h), u = !0) : (c || i) && (this.loadTile(h, n), this.touchTile(h, n)), c) {\n let f;\n if (h._inRequestVolume ? h.hasRenderContent ? f = h.contentAvailable : f = this.executeEmptyTraversal(h, n) : f = !1, l = l && f, !l)\n return !1;\n }\n return u || (l = !1), l;\n }\n /* eslint-enable complexity, max-statements */\n updateTile(t, n) {\n this.updateTileVisibility(t, n);\n }\n // tile to render in the browser\n selectTile(t, n) {\n this.shouldSelectTile(t) && (t._selectedFrame = n.frameNumber, this.selectedTiles[t.id] = t);\n }\n // tile to load from server\n loadTile(t, n) {\n this.shouldLoadTile(t) && (t._requestedFrame = n.frameNumber, t._priority = t._getPriority(), this.requestedTiles[t.id] = t);\n }\n // cache tile\n touchTile(t, n) {\n t.tileset._cache.touch(t), t._touchedFrame = n.frameNumber;\n }\n // tile should be visible\n // tile should have children\n // tile LoD (level of detail) is not sufficient under current viewport\n canTraverse(t, n) {\n return t.hasChildren ? t.hasTilesetContent ? !t.contentExpired : this.shouldRefine(t, n) : !1;\n }\n shouldLoadTile(t) {\n return t.hasUnloadedContent || t.contentExpired;\n }\n shouldSelectTile(t) {\n return t.contentAvailable && !this.options.skipLevelOfDetail;\n }\n /** Decide if tile LoD (level of detail) is not sufficient under current viewport */\n shouldRefine(t, n, s = !1) {\n let r = t._screenSpaceError;\n return s && (r = t.getScreenSpaceError(n, !0)), r > t.tileset.memoryAdjustedScreenSpaceError;\n }\n updateTileVisibility(t, n) {\n const s = [];\n if (this.options.viewportTraversersMap)\n for (const r in this.options.viewportTraversersMap)\n this.options.viewportTraversersMap[r] === n.viewport.id && s.push(r);\n else\n s.push(n.viewport.id);\n t.updateVisibility(n, s);\n }\n // UTILITIES\n compareDistanceToCamera(t, n) {\n return t._distanceToCamera - n._distanceToCamera;\n }\n anyChildrenVisible(t, n) {\n let s = !1;\n for (const r of t.children)\n r.updateVisibility(n), s = s || r.isVisibleAndInRequestVolume;\n return s;\n }\n // Depth-first traversal that checks if all nearest descendants with content are loaded.\n // Ignores visibility.\n executeEmptyTraversal(t, n) {\n let s = !0;\n const r = this._emptyTraversalStack;\n for (r.push(t); r.length > 0; ) {\n const i = r.pop(), o = !i.hasRenderContent && this.canTraverse(i, n), a = !i.hasRenderContent && i.children.length === 0;\n if (!o && !i.contentAvailable && !a && (s = !1), this.updateTile(i, n), i.isVisibleAndInRequestVolume || (this.loadTile(i, n), this.touchTile(i, n)), o) {\n const c = i.children;\n for (const u of c)\n r.push(u);\n }\n }\n return s;\n }\n}\nconst xo = new A();\nfunction pB(e) {\n return e != null;\n}\nclass ur {\n // TODO i3s specific, needs to remove\n /**\n * @constructs\n * Create a Tile3D instance\n * @param tileset - Tileset3D instance\n * @param header - tile header - JSON loaded from a dataset\n * @param parentHeader - parent Tile3D instance\n * @param extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n */\n // eslint-disable-next-line max-statements\n constructor(t, n, s, r = \"\") {\n p(this, \"tileset\");\n p(this, \"header\");\n p(this, \"id\");\n p(this, \"url\");\n p(this, \"parent\");\n /* Specifies the type of refine that is used when traversing this tile for rendering. */\n p(this, \"refine\");\n p(this, \"type\");\n p(this, \"contentUrl\");\n /** Different refinement algorithms used by I3S and 3D tiles */\n p(this, \"lodMetricType\", \"geometricError\");\n /** The error, in meters, introduced if this tile is rendered and its children are not. */\n p(this, \"lodMetricValue\", 0);\n /** @todo math.gl is not exporting BoundingVolume base type? */\n p(this, \"boundingVolume\", null);\n /**\n * The tile's content. This represents the actual tile's payload,\n * not the content's metadata in the tileset JSON file.\n */\n p(this, \"content\", null);\n p(this, \"contentState\", lt.UNLOADED);\n p(this, \"gpuMemoryUsageInBytes\", 0);\n /** The tile's children - an array of Tile3D objects. */\n p(this, \"children\", []);\n p(this, \"depth\", 0);\n p(this, \"viewportIds\", []);\n p(this, \"transform\", new V());\n p(this, \"extensions\", null);\n /** TODO Cesium 3d tiles specific */\n p(this, \"implicitTiling\", null);\n /** Container to store application specific data */\n p(this, \"userData\", {});\n p(this, \"computedTransform\");\n p(this, \"hasEmptyContent\", !1);\n p(this, \"hasTilesetContent\", !1);\n p(this, \"traverser\", new ts({}));\n /** Used by TilesetCache */\n p(this, \"_cacheNode\", null);\n p(this, \"_frameNumber\", null);\n // TODO Cesium 3d tiles specific\n p(this, \"_expireDate\", null);\n p(this, \"_expiredContent\", null);\n p(this, \"_boundingBox\");\n /** updated every frame for tree traversal and rendering optimizations: */\n p(this, \"_distanceToCamera\", 0);\n p(this, \"_screenSpaceError\", 0);\n p(this, \"_visibilityPlaneMask\");\n p(this, \"_visible\");\n p(this, \"_contentBoundingVolume\");\n p(this, \"_viewerRequestVolume\");\n p(this, \"_initialTransform\", new V());\n // Used by traverser, cannot be marked private\n p(this, \"_priority\", 0);\n p(this, \"_selectedFrame\", 0);\n p(this, \"_requestedFrame\", 0);\n p(this, \"_selectionDepth\", 0);\n p(this, \"_touchedFrame\", 0);\n p(this, \"_centerZDepth\", 0);\n p(this, \"_shouldRefine\", !1);\n p(this, \"_stackLength\", 0);\n p(this, \"_visitedFrame\", 0);\n p(this, \"_inRequestVolume\", !1);\n p(this, \"_lodJudge\", null);\n this.header = n, this.tileset = t, this.id = r || n.id, this.url = n.url, this.parent = s, this.refine = this._getRefine(n.refine), this.type = n.type, this.contentUrl = n.contentUrl, this._initializeLodMetric(n), this._initializeTransforms(n), this._initializeBoundingVolumes(n), this._initializeContent(n), this._initializeRenderingState(n), Object.seal(this);\n }\n destroy() {\n this.header = null;\n }\n isDestroyed() {\n return this.header === null;\n }\n get selected() {\n return this._selectedFrame === this.tileset._frameNumber;\n }\n get isVisible() {\n return this._visible;\n }\n get isVisibleAndInRequestVolume() {\n return this._visible && this._inRequestVolume;\n }\n /** Returns true if tile is not an empty tile and not an external tileset */\n get hasRenderContent() {\n return !this.hasEmptyContent && !this.hasTilesetContent;\n }\n /** Returns true if tile has children */\n get hasChildren() {\n return this.children.length > 0 || this.header.children && this.header.children.length > 0;\n }\n /**\n * Determines if the tile's content is ready. This is automatically `true` for\n * tiles with empty content.\n */\n get contentReady() {\n return this.contentState === lt.READY || this.hasEmptyContent;\n }\n /**\n * Determines if the tile has available content to render. `true` if the tile's\n * content is ready or if it has expired content this renders while new content loads; otherwise,\n */\n get contentAvailable() {\n return !!(this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed);\n }\n /** Returns true if tile has renderable content but it's unloaded */\n get hasUnloadedContent() {\n return this.hasRenderContent && this.contentUnloaded;\n }\n /**\n * Determines if the tile's content has not be requested. `true` if tile's\n * content has not be requested; otherwise, `false`.\n */\n get contentUnloaded() {\n return this.contentState === lt.UNLOADED;\n }\n /**\n * Determines if the tile's content is expired. `true` if tile's\n * content is expired; otherwise, `false`.\n */\n get contentExpired() {\n return this.contentState === lt.EXPIRED;\n }\n // Determines if the tile's content failed to load. `true` if the tile's\n // content failed to load; otherwise, `false`.\n get contentFailed() {\n return this.contentState === lt.FAILED;\n }\n /**\n * Distance from the tile's bounding volume center to the camera\n */\n get distanceToCamera() {\n return this._distanceToCamera;\n }\n /**\n * Screen space error for LOD selection\n */\n get screenSpaceError() {\n return this._screenSpaceError;\n }\n /**\n * Get bounding box in cartographic coordinates\n * @returns [min, max] each in [longitude, latitude, altitude]\n */\n get boundingBox() {\n return this._boundingBox || (this._boundingBox = iB(this.header.boundingVolume, this.boundingVolume)), this._boundingBox;\n }\n /** Get the tile's screen space error. */\n getScreenSpaceError(t, n) {\n switch (this.tileset.type) {\n case At.I3S:\n return Fc(this, t);\n case At.TILES3D:\n return fB(this, t, n);\n default:\n throw new Error(\"Unsupported tileset type\");\n }\n }\n /**\n * Make tile unselected than means it won't be shown\n * but it can be still loaded in memory\n */\n unselect() {\n this._selectedFrame = 0;\n }\n /**\n * Memory usage of tile on GPU\n */\n _getGpuMemoryUsageInBytes() {\n return this.content.gpuMemoryUsageInBytes || this.content.byteLength || 0;\n }\n /*\n * If skipLevelOfDetail is off try to load child tiles as soon as possible so that their parent can refine sooner.\n * Tiles are prioritized by screen space error.\n */\n // eslint-disable-next-line complexity\n _getPriority() {\n const t = this.tileset._traverser, { skipLevelOfDetail: n } = t.options, s = this.refine === Ht.ADD || n;\n if (s && !this.isVisible && this._visible !== void 0 || this.tileset._frameNumber - this._touchedFrame >= 1 || this.contentState === lt.UNLOADED)\n return -1;\n const r = this.parent, o = r && (!s || this._screenSpaceError === 0 || r.hasTilesetContent) ? r._screenSpaceError : this._screenSpaceError, a = t.root ? t.root._screenSpaceError : 0;\n return Math.max(a - o, 0);\n }\n /**\n * Requests the tile's content.\n * The request may not be made if the Request Scheduler can't prioritize it.\n */\n // eslint-disable-next-line max-statements, complexity\n async loadContent() {\n if (this.hasEmptyContent)\n return !1;\n if (this.content)\n return !0;\n this.contentExpired && (this._expireDate = null), this.contentState = lt.LOADING;\n const n = await this.tileset._requestScheduler.scheduleRequest(this.id, this._getPriority.bind(this));\n if (!n)\n return this.contentState = lt.UNLOADED, !1;\n try {\n const s = this.tileset.getTileUrl(this.contentUrl), r = this.tileset.loader, i = {\n ...this.tileset.loadOptions,\n [r.id]: {\n // @ts-expect-error\n ...this.tileset.loadOptions[r.id],\n isTileset: this.type === \"json\",\n ...this._getLoaderSpecificOptions(r.id)\n }\n };\n return this.content = await Ae(s, r, i), this.tileset.options.contentLoader && await this.tileset.options.contentLoader(this), this._isTileset() && this.tileset._initializeTileHeaders(this.content, this), this.contentState = lt.READY, this._onContentLoaded(), !0;\n } catch (s) {\n throw this.contentState = lt.FAILED, s;\n } finally {\n n.done();\n }\n }\n // Unloads the tile's content.\n unloadContent() {\n return this.content && this.content.destroy && this.content.destroy(), this.content = null, this.header.content && this.header.content.destroy && this.header.content.destroy(), this.header.content = null, this.contentState = lt.UNLOADED, !0;\n }\n /**\n * Update the tile's visibility\n * @param {Object} frameState - frame state for tile culling\n * @param {string[]} viewportIds - a list of viewport ids that show this tile\n * @return {void}\n */\n updateVisibility(t, n) {\n if (this._frameNumber === t.frameNumber)\n return;\n const s = this.parent, r = s ? s._visibilityPlaneMask : dt.MASK_INDETERMINATE;\n if (this.tileset._traverser.options.updateTransforms) {\n const i = s ? s.computedTransform : this.tileset.modelMatrix;\n this._updateTransform(i);\n }\n this._distanceToCamera = this.distanceToTile(t), this._screenSpaceError = this.getScreenSpaceError(t, !1), this._visibilityPlaneMask = this.visibility(t, r), this._visible = this._visibilityPlaneMask !== dt.MASK_OUTSIDE, this._inRequestVolume = this.insideViewerRequestVolume(t), this._frameNumber = t.frameNumber, this.viewportIds = n;\n }\n // Determines whether the tile's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @param {Number} parentVisibilityPlaneMask The parent's plane mask to speed up the visibility check.\n // @returns {Number} A plane mask as described above in {@link CullingVolume#computeVisibilityWithPlaneMask}.\n visibility(t, n) {\n const { cullingVolume: s } = t, { boundingVolume: r } = this;\n return s.computeVisibilityWithPlaneMask(r, n);\n }\n // Assuming the tile's bounding volume intersects the culling volume, determines\n // whether the tile's content's bounding volume intersects the culling volume.\n // @param {FrameState} frameState The frame state.\n // @returns {Intersect} The result of the intersection: the tile's content is completely outside, completely inside, or intersecting the culling volume.\n contentVisibility() {\n return !0;\n }\n /**\n * Computes the (potentially approximate) distance from the closest point of the tile's bounding volume to the camera.\n * @param frameState The frame state.\n * @returns {Number} The distance, in meters, or zero if the camera is inside the bounding volume.\n */\n distanceToTile(t) {\n const n = this.boundingVolume;\n return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position), 0));\n }\n /**\n * Computes the tile's camera-space z-depth.\n * @param frameState The frame state.\n * @returns The distance, in meters.\n */\n cameraSpaceZDepth({ camera: t }) {\n const n = this.boundingVolume;\n return xo.subVectors(n.center, t.position), t.direction.dot(xo);\n }\n /**\n * Checks if the camera is inside the viewer request volume.\n * @param {FrameState} frameState The frame state.\n * @returns {Boolean} Whether the camera is inside the volume.\n */\n insideViewerRequestVolume(t) {\n const n = this._viewerRequestVolume;\n return !n || n.distanceSquaredTo(t.camera.position) <= 0;\n }\n // TODO Cesium specific\n // Update whether the tile has expired.\n updateExpiration() {\n if (pB(this._expireDate) && this.contentReady && !this.hasEmptyContent) {\n const t = Date.now();\n Date.lessThan(this._expireDate, t) && (this.contentState = lt.EXPIRED, this._expiredContent = this.content);\n }\n }\n get extras() {\n return this.header.extras;\n }\n // INTERNAL METHODS\n _initializeLodMetric(t) {\n \"lodMetricType\" in t ? this.lodMetricType = t.lodMetricType : (this.lodMetricType = this.parent && this.parent.lodMetricType || this.tileset.lodMetricType, console.warn(\"3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType\")), \"lodMetricValue\" in t ? this.lodMetricValue = t.lodMetricValue : (this.lodMetricValue = this.parent && this.parent.lodMetricValue || this.tileset.lodMetricValue, console.warn(\"3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue\"));\n }\n _initializeTransforms(t) {\n this.transform = t.transform ? new V(t.transform) : new V();\n const n = this.parent, s = this.tileset, r = n && n.computedTransform ? n.computedTransform.clone() : s.modelMatrix.clone();\n this.computedTransform = new V(r).multiplyRight(this.transform);\n const i = n && n._initialTransform ? n._initialTransform.clone() : new V();\n this._initialTransform = new V(i).multiplyRight(this.transform);\n }\n _initializeBoundingVolumes(t) {\n this._contentBoundingVolume = null, this._viewerRequestVolume = null, this._updateBoundingVolume(t);\n }\n _initializeContent(t) {\n this.content = { _tileset: this.tileset, _tile: this }, this.hasEmptyContent = !0, this.contentState = lt.UNLOADED, this.hasTilesetContent = !1, t.contentUrl && (this.content = null, this.hasEmptyContent = !1);\n }\n // TODO - remove anything not related to basic visibility detection\n _initializeRenderingState(t) {\n this.depth = t.level || (this.parent ? this.parent.depth + 1 : 0), this._shouldRefine = !1, this._distanceToCamera = 0, this._centerZDepth = 0, this._screenSpaceError = 0, this._visibilityPlaneMask = dt.MASK_INDETERMINATE, this._visible = void 0, this._inRequestVolume = !1, this._stackLength = 0, this._selectionDepth = 0, this._frameNumber = 0, this._touchedFrame = 0, this._visitedFrame = 0, this._selectedFrame = 0, this._requestedFrame = 0, this._priority = 0;\n }\n _getRefine(t) {\n return t || this.parent && this.parent.refine || Ht.REPLACE;\n }\n _isTileset() {\n return this.contentUrl.indexOf(\".json\") !== -1;\n }\n _onContentLoaded() {\n switch (this.content && this.content.type) {\n case \"vctr\":\n case \"geom\":\n this.tileset._traverser.disableSkipLevelOfDetail = !0;\n break;\n }\n this._isTileset() ? this.hasTilesetContent = !0 : this.gpuMemoryUsageInBytes = this._getGpuMemoryUsageInBytes();\n }\n _updateBoundingVolume(t) {\n this.boundingVolume = Os(t.boundingVolume, this.computedTransform, this.boundingVolume);\n const n = t.content;\n n && (n.boundingVolume && (this._contentBoundingVolume = Os(n.boundingVolume, this.computedTransform, this._contentBoundingVolume)), t.viewerRequestVolume && (this._viewerRequestVolume = Os(t.viewerRequestVolume, this.computedTransform, this._viewerRequestVolume)));\n }\n // Update the tile's transform. The transform is applied to the tile's bounding volumes.\n _updateTransform(t = new V()) {\n const n = t.clone().multiplyRight(this.transform);\n n.equals(this.computedTransform) || (this.computedTransform = n, this._updateBoundingVolume(this.header));\n }\n // Get options which are applicable only for the particular loader\n _getLoaderSpecificOptions(t) {\n switch (t) {\n case \"i3s\":\n return {\n ...this.tileset.options.i3s,\n _tileOptions: {\n attributeUrls: this.header.attributeUrls,\n textureUrl: this.header.textureUrl,\n textureFormat: this.header.textureFormat,\n textureLoaderOptions: this.header.textureLoaderOptions,\n materialDefinition: this.header.materialDefinition,\n isDracoGeometry: this.header.isDracoGeometry,\n mbs: this.header.mbs\n },\n _tilesetOptions: {\n store: this.tileset.tileset.store,\n attributeStorageInfo: this.tileset.tileset.attributeStorageInfo,\n fields: this.tileset.tileset.fields\n },\n isTileHeader: !1\n };\n case \"3d-tiles\":\n case \"cesium-ion\":\n default:\n return gB(this.tileset.tileset);\n }\n }\n}\nclass yB extends ts {\n compareDistanceToCamera(t, n) {\n return n._distanceToCamera === 0 && t._distanceToCamera === 0 ? n._centerZDepth - t._centerZDepth : n._distanceToCamera - t._distanceToCamera;\n }\n updateTileVisibility(t, n) {\n if (super.updateTileVisibility(t, n), !t.isVisibleAndInRequestVolume)\n return;\n const s = t.children.length > 0;\n if (t.hasTilesetContent && s) {\n const o = t.children[0];\n this.updateTileVisibility(o, n), t._visible = o._visible;\n return;\n }\n if (this.meetsScreenSpaceErrorEarly(t, n)) {\n t._visible = !1;\n return;\n }\n const r = t.refine === Ht.REPLACE, i = t._optimChildrenWithinParent === nB.USE_OPTIMIZATION;\n if (r && i && s && !this.anyChildrenVisible(t, n)) {\n t._visible = !1;\n return;\n }\n }\n meetsScreenSpaceErrorEarly(t, n) {\n const { parent: s } = t;\n return !s || s.hasTilesetContent || s.refine !== Ht.ADD ? !1 : !this.shouldRefine(t, n, !0);\n }\n}\nclass BB {\n constructor() {\n p(this, \"frameNumberMap\", /* @__PURE__ */ new Map());\n }\n /**\n * Register a new pending tile header for the particular frameNumber\n * @param viewportId\n * @param frameNumber\n */\n register(t, n) {\n const s = this.frameNumberMap.get(t) || /* @__PURE__ */ new Map(), r = s.get(n) || 0;\n s.set(n, r + 1), this.frameNumberMap.set(t, s);\n }\n /**\n * Deregister a pending tile header for the particular frameNumber\n * @param viewportId\n * @param frameNumber\n */\n deregister(t, n) {\n const s = this.frameNumberMap.get(t);\n if (!s)\n return;\n const r = s.get(n) || 1;\n s.set(n, r - 1);\n }\n /**\n * Check is there are no pending tile headers registered for the particular frameNumber\n * @param viewportId\n * @param frameNumber\n * @returns\n */\n isZero(t, n) {\n var r;\n return (((r = this.frameNumberMap.get(t)) == null ? void 0 : r.get(n)) || 0) === 0;\n }\n}\nconst Ls = {\n REQUESTED: \"REQUESTED\",\n COMPLETED: \"COMPLETED\",\n ERROR: \"ERROR\"\n};\nclass CB {\n constructor() {\n p(this, \"_statusMap\");\n p(this, \"pendingTilesRegister\", new BB());\n this._statusMap = {};\n }\n /**\n * Add request to map\n * @param request - node metadata request\n * @param key - unique key\n * @param callback - callback after request completed\n * @param frameState - frameState data\n */\n add(t, n, s, r) {\n if (!this._statusMap[n]) {\n const { frameNumber: i, viewport: { id: o } } = r;\n this._statusMap[n] = { request: t, callback: s, key: n, frameState: r, status: Ls.REQUESTED }, this.pendingTilesRegister.register(o, i), t().then((a) => {\n this._statusMap[n].status = Ls.COMPLETED;\n const { frameNumber: c, viewport: { id: u } } = this._statusMap[n].frameState;\n this.pendingTilesRegister.deregister(u, c), this._statusMap[n].callback(a, r);\n }).catch((a) => {\n this._statusMap[n].status = Ls.ERROR;\n const { frameNumber: c, viewport: { id: u } } = this._statusMap[n].frameState;\n this.pendingTilesRegister.deregister(u, c), s(a);\n });\n }\n }\n /**\n * Update request if it is still actual for the new frameState\n * @param key - unique key\n * @param frameState - frameState data\n */\n update(t, n) {\n if (this._statusMap[t]) {\n const { frameNumber: s, viewport: { id: r } } = this._statusMap[t].frameState;\n this.pendingTilesRegister.deregister(r, s);\n const { frameNumber: i, viewport: { id: o } } = n;\n this.pendingTilesRegister.register(o, i), this._statusMap[t].frameState = n;\n }\n }\n /**\n * Find request in the map\n * @param key - unique key\n * @returns\n */\n find(t) {\n return this._statusMap[t];\n }\n /**\n * Check it there are pending tile headers for the particular frameNumber\n * @param viewportId\n * @param frameNumber\n * @returns\n */\n hasPendingTiles(t, n) {\n return !this.pendingTilesRegister.isZero(t, n);\n }\n}\nclass EB extends ts {\n constructor(n) {\n super(n);\n p(this, \"_tileManager\");\n this._tileManager = new CB();\n }\n /**\n * Check if there are no penging tile header requests,\n * that means the traversal is finished and we can call\n * following-up callbacks.\n */\n traversalFinished(n) {\n return !this._tileManager.hasPendingTiles(n.viewport.id, this._frameNumber || 0);\n }\n shouldRefine(n, s) {\n return n._lodJudge = mB(n, s), n._lodJudge === \"DIG\";\n }\n updateChildTiles(n, s) {\n const r = n.header.children || [], i = n.children, o = n.tileset;\n for (const a of r) {\n const c = `${a.id}-${s.viewport.id}`, u = i && i.find((l) => l.id === c);\n if (u)\n u && this.updateTile(u, s);\n else {\n let l = () => this._loadTile(a.id, o);\n this._tileManager.find(c) ? this._tileManager.update(c, s) : (o.tileset.nodePages && (l = () => o.tileset.nodePagesTile.formTileFromNodePages(a.id)), this._tileManager.add(l, c, (f) => this._onTileLoad(f, n, c), s));\n }\n }\n return !1;\n }\n async _loadTile(n, s) {\n const { loader: r } = s, i = s.getTileUrl(`${s.url}/nodes/${n}`), o = {\n ...s.loadOptions,\n i3s: {\n ...s.loadOptions.i3s,\n isTileHeader: !0\n }\n };\n return await Ae(i, r, o);\n }\n /**\n * The callback to init Tile3D instance after loading the tile JSON\n * @param {Object} header - the tile JSON from a dataset\n * @param {Tile3D} tile - the parent Tile3D instance\n * @param {string} extendedId - optional ID to separate copies of a tile for different viewports.\n * const extendedId = `${tile.id}-${frameState.viewport.id}`;\n * @return {void}\n */\n _onTileLoad(n, s, r) {\n const i = new ur(s.tileset, n, s, r);\n s.children.push(i);\n const o = this._tileManager.find(i.id).frameState;\n this.updateTile(i, o), this._frameNumber === o.frameNumber && (this.traversalFinished(o) || (/* @__PURE__ */ new Date()).getTime() - this.lastUpdate > this.updateDebounceTime) && this.executeTraversal(i, o);\n }\n}\nconst TB = {\n description: \"\",\n ellipsoid: J.WGS84,\n modelMatrix: new V(),\n throttleRequests: !0,\n maxRequests: 64,\n /** Default memory values optimized for viewing mesh-based 3D Tiles on both mobile and desktop devices */\n maximumMemoryUsage: 32,\n memoryCacheOverflow: 1,\n maximumTilesSelected: 0,\n debounceTime: 0,\n onTileLoad: () => {\n },\n onTileUnload: () => {\n },\n onTileError: () => {\n },\n onTraversalComplete: (e) => e,\n contentLoader: void 0,\n viewDistanceScale: 1,\n maximumScreenSpaceError: 8,\n memoryAdjustedScreenSpaceError: !1,\n loadTiles: !0,\n updateTransforms: !0,\n viewportTraversersMap: null,\n loadOptions: { fetch: {} },\n attributions: [],\n basePath: \"\",\n i3s: {}\n}, Cn = \"Tiles In Tileset(s)\", Ps = \"Tiles In Memory\", vo = \"Tiles In View\", Oo = \"Tiles To Render\", Fo = \"Tiles Loaded\", Gs = \"Tiles Loading\", Do = \"Tiles Unloaded\", Lo = \"Failed Tile Loads\", Po = \"Points/Vertices\", Ns = \"Tile Memory Use\", Go = \"Maximum Screen Space Error\";\nclass bB {\n /**\n * Create a new Tileset3D\n * @param json\n * @param props\n */\n // eslint-disable-next-line max-statements\n constructor(t, n) {\n // props: Tileset3DProps;\n p(this, \"options\");\n p(this, \"loadOptions\");\n p(this, \"type\");\n p(this, \"tileset\");\n p(this, \"loader\");\n p(this, \"url\");\n p(this, \"basePath\");\n p(this, \"modelMatrix\");\n p(this, \"ellipsoid\");\n p(this, \"lodMetricType\");\n p(this, \"lodMetricValue\");\n p(this, \"refine\");\n p(this, \"root\", null);\n p(this, \"roots\", {});\n /** @todo any->unknown */\n p(this, \"asset\", {});\n // Metadata for the entire tileset\n p(this, \"description\", \"\");\n p(this, \"properties\");\n p(this, \"extras\", null);\n p(this, \"attributions\", {});\n p(this, \"credits\", {});\n p(this, \"stats\");\n /** flags that contain information about data types in nested tiles */\n p(this, \"contentFormats\", { draco: !1, meshopt: !1, dds: !1, ktx2: !1 });\n // view props\n p(this, \"cartographicCenter\", null);\n p(this, \"cartesianCenter\", null);\n p(this, \"zoom\", 1);\n p(this, \"boundingVolume\", null);\n /** Updated based on the camera position and direction */\n p(this, \"dynamicScreenSpaceErrorComputedDensity\", 0);\n // METRICS\n /**\n * The maximum amount of GPU memory (in MB) that may be used to cache tiles\n * Tiles not in view are unloaded to enforce private\n */\n p(this, \"maximumMemoryUsage\", 32);\n /** The total amount of GPU memory in bytes used by the tileset. */\n p(this, \"gpuMemoryUsageInBytes\", 0);\n /**\n * If loading the level of detail required by maximumScreenSpaceError\n * results in the memory usage exceeding maximumMemoryUsage (GPU), level of detail refinement\n * will instead use this (larger) adjusted screen space error to achieve the\n * best possible visual quality within the available memory.\n */\n p(this, \"memoryAdjustedScreenSpaceError\", 0);\n p(this, \"_cacheBytes\", 0);\n p(this, \"_cacheOverflowBytes\", 0);\n /** Update tracker. increase in each update cycle. */\n p(this, \"_frameNumber\", 0);\n p(this, \"_queryParams\", {});\n p(this, \"_extensionsUsed\", []);\n p(this, \"_tiles\", {});\n /** counter for tracking tiles requests */\n p(this, \"_pendingCount\", 0);\n /** Hold traversal results */\n p(this, \"selectedTiles\", []);\n // TRAVERSAL\n p(this, \"traverseCounter\", 0);\n p(this, \"geometricError\", 0);\n p(this, \"lastUpdatedVieports\", null);\n p(this, \"_requestedTiles\", []);\n p(this, \"_emptyTiles\", []);\n p(this, \"frameStateData\", {});\n p(this, \"_traverser\");\n p(this, \"_cache\", new zy());\n p(this, \"_requestScheduler\");\n // Promise tracking\n p(this, \"updatePromise\", null);\n p(this, \"tilesetInitializationPromise\");\n this.options = { ...TB, ...n }, this.tileset = t, this.loader = t.loader, this.type = t.type, this.url = t.url, this.basePath = t.basePath || jy(this.url), this.modelMatrix = this.options.modelMatrix, this.ellipsoid = this.options.ellipsoid, this.lodMetricType = t.lodMetricType, this.lodMetricValue = t.lodMetricValue, this.refine = t.root.refine, this.loadOptions = this.options.loadOptions || {}, this._traverser = this._initializeTraverser(), this._requestScheduler = new Vy({\n throttleRequests: this.options.throttleRequests,\n maxRequests: this.options.maxRequests\n }), this.memoryAdjustedScreenSpaceError = this.options.maximumScreenSpaceError, this._cacheBytes = this.options.maximumMemoryUsage * 1024 * 1024, this._cacheOverflowBytes = this.options.memoryCacheOverflow * 1024 * 1024, this.stats = new qo({ id: this.url }), this._initializeStats(), this.tilesetInitializationPromise = this._initializeTileSet(t);\n }\n /** Release resources */\n destroy() {\n this._destroy();\n }\n /** Is the tileset loaded (update needs to have been called at least once) */\n isLoaded() {\n return this._pendingCount === 0 && this._frameNumber !== 0 && this._requestedTiles.length === 0;\n }\n get tiles() {\n return Object.values(this._tiles);\n }\n get frameNumber() {\n return this._frameNumber;\n }\n get queryParams() {\n return new URLSearchParams(this._queryParams).toString();\n }\n setProps(t) {\n this.options = { ...this.options, ...t };\n }\n /** @deprecated */\n // setOptions(options: Tileset3DProps): void {\n // this.options = {...this.options, ...options};\n // }\n /**\n * Return a loadable tile url for a specific tile subpath\n * @param tilePath a tile subpath\n */\n getTileUrl(t) {\n if (t.startsWith(\"data:\"))\n return t;\n let s = t;\n return this.queryParams.length && (s = `${t}${t.includes(\"?\") ? \"&\" : \"?\"}${this.queryParams}`), s;\n }\n // TODO CESIUM specific\n hasExtension(t) {\n return this._extensionsUsed.indexOf(t) > -1;\n }\n /**\n * Update visible tiles relying on a list of viewports\n * @param viewports - list of viewports\n * @deprecated\n */\n update(t = null) {\n this.tilesetInitializationPromise.then(() => {\n !t && this.lastUpdatedVieports ? t = this.lastUpdatedVieports : this.lastUpdatedVieports = t, t && this.doUpdate(t);\n });\n }\n /**\n * Update visible tiles relying on a list of viewports.\n * Do it with debounce delay to prevent update spam\n * @param viewports viewports\n * @returns Promise of new frameNumber\n */\n async selectTiles(t = null) {\n return await this.tilesetInitializationPromise, t && (this.lastUpdatedVieports = t), this.updatePromise || (this.updatePromise = new Promise((n) => {\n setTimeout(() => {\n this.lastUpdatedVieports && this.doUpdate(this.lastUpdatedVieports), n(this._frameNumber), this.updatePromise = null;\n }, this.options.debounceTime);\n })), this.updatePromise;\n }\n adjustScreenSpaceError() {\n this.gpuMemoryUsageInBytes < this._cacheBytes ? this.memoryAdjustedScreenSpaceError = Math.max(this.memoryAdjustedScreenSpaceError / 1.02, this.options.maximumScreenSpaceError) : this.gpuMemoryUsageInBytes > this._cacheBytes + this._cacheOverflowBytes && (this.memoryAdjustedScreenSpaceError *= 1.02);\n }\n /**\n * Update visible tiles relying on a list of viewports\n * @param viewports viewports\n */\n // eslint-disable-next-line max-statements, complexity\n doUpdate(t) {\n if (\"loadTiles\" in this.options && !this.options.loadTiles || this.traverseCounter > 0)\n return;\n const n = t instanceof Array ? t : [t];\n this._cache.reset(), this._frameNumber++, this.traverseCounter = n.length;\n const s = [];\n for (const r of n) {\n const i = r.id;\n this._needTraverse(i) ? s.push(i) : this.traverseCounter--;\n }\n for (const r of n) {\n const i = r.id;\n if (this.roots[i] || (this.roots[i] = this._initializeTileHeaders(this.tileset, null)), !s.includes(i))\n continue;\n const o = Xy(r, this._frameNumber);\n this._traverser.traverse(this.roots[i], o, this.options);\n }\n }\n /**\n * Check if traversal is needed for particular viewport\n * @param {string} viewportId - id of a viewport\n * @return {boolean}\n */\n _needTraverse(t) {\n let n = t;\n return this.options.viewportTraversersMap && (n = this.options.viewportTraversersMap[t]), n === t;\n }\n /**\n * The callback to post-process tiles after traversal procedure\n * @param frameState - frame state for tile culling\n */\n _onTraversalEnd(t) {\n const n = t.viewport.id;\n this.frameStateData[n] || (this.frameStateData[n] = { selectedTiles: [], _requestedTiles: [], _emptyTiles: [] });\n const s = this.frameStateData[n], r = Object.values(this._traverser.selectedTiles), [i, o] = Qy(r, t, this.options.maximumTilesSelected);\n s.selectedTiles = i;\n for (const a of o)\n a.unselect();\n s._requestedTiles = Object.values(this._traverser.requestedTiles), s._emptyTiles = Object.values(this._traverser.emptyTiles), this.traverseCounter--, !(this.traverseCounter > 0) && this._updateTiles();\n }\n /**\n * Update tiles relying on data from all traversers\n */\n _updateTiles() {\n this.selectedTiles = [], this._requestedTiles = [], this._emptyTiles = [];\n for (const t in this.frameStateData) {\n const n = this.frameStateData[t];\n this.selectedTiles = this.selectedTiles.concat(n.selectedTiles), this._requestedTiles = this._requestedTiles.concat(n._requestedTiles), this._emptyTiles = this._emptyTiles.concat(n._emptyTiles);\n }\n this.selectedTiles = this.options.onTraversalComplete(this.selectedTiles);\n for (const t of this.selectedTiles)\n this._tiles[t.id] = t;\n this._loadTiles(), this._unloadTiles(), this._updateStats();\n }\n _tilesChanged(t, n) {\n if (t.length !== n.length)\n return !0;\n const s = new Set(t.map((o) => o.id)), r = new Set(n.map((o) => o.id));\n let i = t.filter((o) => !r.has(o.id)).length > 0;\n return i = i || n.filter((o) => !s.has(o.id)).length > 0, i;\n }\n _loadTiles() {\n for (const t of this._requestedTiles)\n t.contentUnloaded && this._loadTile(t);\n }\n _unloadTiles() {\n this._cache.unloadTiles(this, (t, n) => t._unloadTile(n));\n }\n _updateStats() {\n let t = 0, n = 0;\n for (const s of this.selectedTiles)\n s.contentAvailable && s.content && (t++, s.content.pointCount ? n += s.content.pointCount : n += s.content.vertexCount);\n this.stats.get(vo).count = this.selectedTiles.length, this.stats.get(Oo).count = t, this.stats.get(Po).count = n, this.stats.get(Go).count = this.memoryAdjustedScreenSpaceError;\n }\n async _initializeTileSet(t) {\n this.type === At.I3S && (this.calculateViewPropsI3S(), t.root = await t.root), this.root = this._initializeTileHeaders(t, null), this.type === At.TILES3D && (this._initializeTiles3DTileset(t), this.calculateViewPropsTiles3D()), this.type === At.I3S && this._initializeI3STileset();\n }\n /**\n * Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom.\n * These metrics help apps center view on tileset\n * For I3S there is extent (<1.8 version) or fullExtent (>=1.8 version) to calculate view props\n * @returns\n */\n calculateViewPropsI3S() {\n var s;\n const t = this.tileset.fullExtent;\n if (t) {\n const { xmin: r, xmax: i, ymin: o, ymax: a, zmin: c, zmax: u } = t;\n this.cartographicCenter = new A(r + (i - r) / 2, o + (a - o) / 2, c + (u - c) / 2), this.cartesianCenter = new A(), J.WGS84.cartographicToCartesian(this.cartographicCenter, this.cartesianCenter), this.zoom = Sc(t, this.cartographicCenter, this.cartesianCenter);\n return;\n }\n const n = (s = this.tileset.store) == null ? void 0 : s.extent;\n if (n) {\n const [r, i, o, a] = n;\n this.cartographicCenter = new A(r + (o - r) / 2, i + (a - i) / 2, 0), this.cartesianCenter = new A(), J.WGS84.cartographicToCartesian(this.cartographicCenter, this.cartesianCenter), this.zoom = tB(n, this.cartographicCenter, this.cartesianCenter);\n return;\n }\n console.warn(\"Extent is not defined in the tileset header\"), this.cartographicCenter = new A(), this.zoom = 1;\n }\n /**\n * Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom.\n * These metrics help apps center view on tileset.\n * For 3DTiles the root tile data is used to calculate view props.\n * @returns\n */\n calculateViewPropsTiles3D() {\n const t = this.root, { center: n } = t.boundingVolume;\n if (!n) {\n console.warn(\"center was not pre-calculated for the root tile\"), this.cartographicCenter = new A(), this.zoom = 1;\n return;\n }\n n[0] !== 0 || n[1] !== 0 || n[2] !== 0 ? (this.cartographicCenter = new A(), J.WGS84.cartesianToCartographic(n, this.cartographicCenter)) : this.cartographicCenter = new A(0, 0, -J.WGS84.radii[0]), this.cartesianCenter = n, this.zoom = Zy(t.boundingVolume, this.cartographicCenter);\n }\n _initializeStats() {\n this.stats.get(Cn), this.stats.get(Gs), this.stats.get(Ps), this.stats.get(vo), this.stats.get(Oo), this.stats.get(Fo), this.stats.get(Do), this.stats.get(Lo), this.stats.get(Po), this.stats.get(Ns, \"memory\"), this.stats.get(Go);\n }\n // Installs the main tileset JSON file or a tileset JSON file referenced from a tile.\n // eslint-disable-next-line max-statements\n _initializeTileHeaders(t, n) {\n var r;\n const s = new ur(this, t.root, n);\n if (n && (n.children.push(s), s.depth = n.depth + 1), this.type === At.TILES3D) {\n const i = [];\n for (i.push(s); i.length > 0; ) {\n const o = i.pop();\n this.stats.get(Cn).incrementCount();\n const a = o.header.children || [];\n for (const c of a) {\n const u = new ur(this, c, o);\n if ((r = u.contentUrl) != null && r.includes(\"?session=\")) {\n const h = new URL(u.contentUrl).searchParams.get(\"session\");\n h && (this._queryParams.session = h);\n }\n o.children.push(u), u.depth = o.depth + 1, i.push(u);\n }\n }\n }\n return s;\n }\n _initializeTraverser() {\n let t;\n switch (this.type) {\n case At.TILES3D:\n t = yB;\n break;\n case At.I3S:\n t = EB;\n break;\n default:\n t = ts;\n }\n return new t({\n basePath: this.basePath,\n onTraversalEnd: this._onTraversalEnd.bind(this)\n });\n }\n _destroyTileHeaders(t) {\n this._destroySubtree(t);\n }\n async _loadTile(t) {\n let n;\n try {\n this._onStartTileLoading(), n = await t.loadContent();\n } catch (s) {\n this._onTileLoadError(t, s instanceof Error ? s : new Error(\"load failed\"));\n } finally {\n this._onEndTileLoading(), this._onTileLoad(t, n);\n }\n }\n _onTileLoadError(t, n) {\n this.stats.get(Lo).incrementCount();\n const s = n.message || n.toString(), r = t.url;\n console.error(`A 3D tile failed to load: ${t.url} ${s}`), this.options.onTileError(t, s, r);\n }\n _onTileLoad(t, n) {\n var s, r;\n if (n) {\n if (this.type === At.I3S) {\n const i = ((r = (s = this.tileset) == null ? void 0 : s.nodePagesTile) == null ? void 0 : r.nodesInNodePages) || 0;\n this.stats.get(Cn).reset(), this.stats.get(Cn).addCount(i);\n }\n t && t.content && Wy(t, t.content), this.updateContentTypes(t), this._addTileToCache(t), this.options.onTileLoad(t);\n }\n }\n /**\n * Update information about data types in nested tiles\n * @param tile instance of a nested Tile3D\n */\n updateContentTypes(t) {\n var n;\n if (this.type === At.I3S)\n switch (t.header.isDracoGeometry && (this.contentFormats.draco = !0), t.header.textureFormat) {\n case \"dds\":\n this.contentFormats.dds = !0;\n break;\n case \"ktx2\":\n this.contentFormats.ktx2 = !0;\n break;\n }\n else if (this.type === At.TILES3D) {\n const { extensionsRemoved: s = [] } = ((n = t.content) == null ? void 0 : n.gltf) || {};\n s.includes(\"KHR_draco_mesh_compression\") && (this.contentFormats.draco = !0), s.includes(\"EXT_meshopt_compression\") && (this.contentFormats.meshopt = !0), s.includes(\"KHR_texture_basisu\") && (this.contentFormats.ktx2 = !0);\n }\n }\n _onStartTileLoading() {\n this._pendingCount++, this.stats.get(Gs).incrementCount();\n }\n _onEndTileLoading() {\n this._pendingCount--, this.stats.get(Gs).decrementCount();\n }\n _addTileToCache(t) {\n this._cache.add(this, t, (n) => n._updateCacheStats(t));\n }\n _updateCacheStats(t) {\n this.stats.get(Fo).incrementCount(), this.stats.get(Ps).incrementCount(), this.gpuMemoryUsageInBytes += t.gpuMemoryUsageInBytes || 0, this.stats.get(Ns).count = this.gpuMemoryUsageInBytes, this.options.memoryAdjustedScreenSpaceError && this.adjustScreenSpaceError();\n }\n _unloadTile(t) {\n this.gpuMemoryUsageInBytes -= t.gpuMemoryUsageInBytes || 0, this.stats.get(Ps).decrementCount(), this.stats.get(Do).incrementCount(), this.stats.get(Ns).count = this.gpuMemoryUsageInBytes, this.options.onTileUnload(t), t.unloadContent();\n }\n // Traverse the tree and destroy all tiles\n _destroy() {\n const t = [];\n for (this.root && t.push(this.root); t.length > 0; ) {\n const n = t.pop();\n for (const s of n.children)\n t.push(s);\n this._destroyTile(n);\n }\n this.root = null;\n }\n // Traverse the tree and destroy all sub tiles\n _destroySubtree(t) {\n const n = t, s = [];\n for (s.push(n); s.length > 0; ) {\n t = s.pop();\n for (const r of t.children)\n s.push(r);\n t !== n && this._destroyTile(t);\n }\n n.children = [];\n }\n _destroyTile(t) {\n this._cache.unloadTile(this, t), this._unloadTile(t), t.destroy();\n }\n _initializeTiles3DTileset(t) {\n if (t.queryString) {\n const n = new URLSearchParams(t.queryString), s = Object.fromEntries(n.entries());\n this._queryParams = { ...this._queryParams, ...s };\n }\n if (this.asset = t.asset, !this.asset)\n throw new Error(\"Tileset must have an asset property.\");\n if (this.asset.version !== \"0.0\" && this.asset.version !== \"1.0\" && this.asset.version !== \"1.1\")\n throw new Error(\"The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.\");\n \"tilesetVersion\" in this.asset && (this._queryParams.v = this.asset.tilesetVersion), this.credits = {\n attributions: this.options.attributions || []\n }, this.description = this.options.description || \"\", this.properties = t.properties, this.geometricError = t.geometricError, this._extensionsUsed = t.extensionsUsed || [], this.extras = t.extras;\n }\n _initializeI3STileset() {\n this.loadOptions.i3s && \"token\" in this.loadOptions.i3s && (this._queryParams.token = this.loadOptions.i3s.token);\n }\n}\nfunction _B(e) {\n let t = 0;\n for (const s in e.attributes) {\n const r = e.getAttribute(s);\n t += r.count * r.itemSize * r.array.BYTES_PER_ELEMENT;\n }\n const n = e.getIndex();\n return t += n ? n.count * n.itemSize * n.array.BYTES_PER_ELEMENT : 0, t;\n}\nfunction Dc(e) {\n const n = document.createElement(\"canvas\");\n n.width = 64, n.height = 64;\n const s = n.getContext(\"2d\");\n s.rect(0, 0, 64, 64);\n const r = s.createLinearGradient(0, 0, 64, 64);\n for (let o = 0; o < e.length; o++) {\n const a = e[o];\n r.addColorStop(a[0], \"#\" + a[1].getHexString());\n }\n s.fillStyle = r, s.fill();\n const i = new three__WEBPACK_IMPORTED_MODULE_0__.CanvasTexture(n);\n return i.needsUpdate = !0, i.minFilter = three__WEBPACK_IMPORTED_MODULE_0__.LinearFilter, i.wrapS = three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping, i.wrapT = three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping, i.repeat.set(2, 2), i;\n}\nfunction No(e) {\n e.updateMatrix(), e.updateMatrixWorld(), e.matrixWorldInverse.copy(e.matrixWorld).invert();\n const t = new three__WEBPACK_IMPORTED_MODULE_0__.Frustum();\n return t.setFromProjectionMatrix(new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse)), t;\n}\nfunction wB(e) {\n const t = new three__WEBPACK_IMPORTED_MODULE_0__.Group(), n = new three__WEBPACK_IMPORTED_MODULE_0__.PlaneGeometry(10, 5), s = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(...e.projectPointOntoPlane([0, 0, 0])), r = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(e.normal.x, e.normal.y, e.normal.z), i = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().copy(s).add(r);\n n.lookAt(i), n.translate(s.x, s.y, s.z);\n const o = new three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial({ color: 65535, side: three__WEBPACK_IMPORTED_MODULE_0__.DoubleSide }), a = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(n, o), c = new three__WEBPACK_IMPORTED_MODULE_0__.ArrowHelper(r, s, 5, 16776960);\n return t.add(c), t.add(a), t;\n}\nfunction Uo(e) {\n const { boundingVolume: t } = e;\n let n = 0;\n e.content && (n = Math.min(e.content.byteLength / 5e5, 1));\n const s = new three__WEBPACK_IMPORTED_MODULE_0__.Color(n, 1, 0), r = new three__WEBPACK_IMPORTED_MODULE_0__.BoxGeometry(1, 1, 1), i = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\n t.halfAxes ? i.copy(Lc(t.halfAxes)) : t.radius && r.scale(t.radius * 2, t.radius * 2, t.radius * 2), r.applyMatrix4(i);\n const o = new three__WEBPACK_IMPORTED_MODULE_0__.EdgesGeometry(r), a = new three__WEBPACK_IMPORTED_MODULE_0__.LineSegments(o, new three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial({ color: s }));\n return a.position.copy(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(...t.center)), a;\n}\nfunction Lc(e) {\n const t = e;\n return new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().fromArray([\n t[0] * 2,\n t[1] * 2,\n t[2] * 2,\n 0,\n t[3] * 2,\n t[4] * 2,\n t[5] * 2,\n 0,\n t[6] * 2,\n t[7] * 2,\n t[8] * 2,\n 0,\n 0,\n 0,\n 0,\n 1\n ]);\n}\nfunction RB(e, t) {\n const r = 2 * Math.PI * 6378137 / 2, i = t * r / 180;\n let o = Math.log(Math.tan((90 + e) * Math.PI / 360)) / (Math.PI / 180);\n return o = o * r / 180, new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(i, o);\n}\nfunction MB(e) {\n let t = 0;\n if ((e == null ? void 0 : e.userData.mimeType) == \"image/ktx2\" && e.mipmaps) {\n for (let n = 0; n < e.mipmaps.length; n++)\n t += e.mipmaps[n].data.byteLength;\n return t;\n } else if (e.image) {\n const { image: n } = e, s = 4;\n let r = [n.width, n.height];\n for (; r[0] > 1 || r[1] > 1; )\n t += r[0] * r[1] * s, r[0] = Math.max(Math.floor(r[0] / 2), 1), r[1] = Math.max(Math.floor(r[1] / 2), 1);\n return t += 1 * 1 * s, t;\n } else\n return;\n}\nfunction Pc(e) {\n return _B(e);\n}\nlet ht = null, Mt = null, Jn = null, Mn = null;\nconst Ho = {\n minHeight: 0,\n maxHeight: 300,\n samples: 4,\n sampleStep: 4,\n opacity: 0.5,\n blendingType: three__WEBPACK_IMPORTED_MODULE_0__.NormalBlending\n};\nfunction SB(e, t, n, s = Ho) {\n ht && ht.dispose(), Mt || (Mt = n);\n const r = { ...Ho, ...s };\n ht = new three__WEBPACK_IMPORTED_MODULE_0__.WebGLRenderTarget(e.width * e.devicePixelRatio, e.height * e.devicePixelRatio), ht.texture.minFilter = three__WEBPACK_IMPORTED_MODULE_0__.NearestFilter, ht.texture.magFilter = three__WEBPACK_IMPORTED_MODULE_0__.NearestFilter, ht.stencilBuffer = !1, ht.texture.format = three__WEBPACK_IMPORTED_MODULE_0__.RGBAFormat, ht.texture.type = three__WEBPACK_IMPORTED_MODULE_0__.FloatType, Mt.setPixelRatio(devicePixelRatio), Mt.setSize(e.width, e.height), Mt.setRenderTarget(ht), Jn = new three__WEBPACK_IMPORTED_MODULE_0__.Scene(), Jn.overrideMaterial = vB, Mn = t, kt.uniforms.tPosition.value = ht.texture, kt.uniforms.minHeight.value = r.minHeight, kt.uniforms.maxHeight.value = r.maxHeight, kt.uniforms.samples.value = r.samples, kt.uniforms.sampleStep.value = r.sampleStep, kt.uniforms.opacity.value = r.opacity, kt.blending = r.blendingType;\n}\nfunction IB(e) {\n ht.setSize(e.width * e.devicePixelRatio, e.height * e.devicePixelRatio), Mt.setPixelRatio(devicePixelRatio), Mt.setSize(e.width, e.height);\n}\nfunction xB(e) {\n if (Mt) {\n const t = Mn.parent;\n Jn.add(Mn), Mt.setRenderTarget(ht), Mt.render(Jn, e), t && t.add(Mn), Mt.setRenderTarget(null);\n }\n}\nconst Vn = (e) => e.toString(), vB = new three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial({\n vertexShader: Vn`\n varying vec3 vPosition;\n void main() {\n vPosition = (modelMatrix * vec4(position, 1.0)).xyz;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n `,\n fragmentShader: Vn`\n varying vec3 vPosition;\n void main() {\n gl_FragColor = vec4(vPosition, 1.0);\n }\n `,\n side: three__WEBPACK_IMPORTED_MODULE_0__.DoubleSide\n}), OB = Vn`\n #include \n\n varying vec2 vUv;\n varying vec3 vColor;\n uniform sampler2D tPosition;\n uniform float minHeight;\n uniform float maxHeight;\n uniform int samples;\n uniform float sampleStep;\n\n mat4 MVP;\n\n // Convert to normalized screen coordinates\n vec4 toNSC(const in vec4 v) {\n return vec4(0.5 * (v.xyz / v.w) + 0.5, v.w);\n }\n vec4 vertexDraping(\n const in sampler2D positionTex, // Position G-Buffer\n const in vec4 Vin // Vertex to drape\n ) {\n float texSize = float(textureSize(positionTex, 0).x);\n float pixelSize = 1.0 / texSize;\n vec2 stepSize = vec2(sampleStep/texSize);\n vec4 VinWorld = modelMatrix * Vin;\n\n vec4 lineStart = projectionMatrix * viewMatrix * vec4(VinWorld.x, minHeight, VinWorld.z, 1.0);\n vec4 lineEnd = projectionMatrix * viewMatrix * vec4(VinWorld.x, maxHeight, VinWorld.z, 1.0);\n\n vec4 Vout = VinWorld;\n\n // Binary search for line-terrain intersection\n float first = 0.0, last = 1.0;\n while(first <= last) {\n // Compute mid-point\n float mid = first + (last-first) / 2.0;\n // Compute texture coordinates along line\n vec4 texCoords = toNSC(mix(lineStart, lineEnd, mid));\n vec4 texSample = vec4(0.0); // Sample terrain\n for(int s = -samples; s < samples; s++) {\n for(int t = -samples; t < samples; t++) {\n texSample += texture(positionTex,\n texCoords.st + vec2(s,t) * stepSize);\n }\n }\n // Smooth samples obtain from G-Buffer\n texSample = texSample / (float(samples) * float(samples) * 4.0);\n float terrainHeight = texSample.y;\n Vout.y = terrainHeight;\n \n if((last-first) < pixelSize) { // Termination criteria\n return Vout;\n }\n // Perform intersection test\n float depthScene = toNSC(projectionMatrix * viewMatrix * Vout).y;\n if(depthScene >= texCoords.y) {\n first = mid;\n }\n else\n last = mid;\n }\n return Vout;\n }\n\n void main() {\n vColor = color;\n vUv = uv;\n MVP = projectionMatrix * modelViewMatrix;\n vec4 inputVertex = vec4(position, 1.0);\n vec4 outputVertex = vertexDraping(tPosition, inputVertex);\n vec4 finalPosition = projectionMatrix * viewMatrix * outputVertex;\n gl_Position = finalPosition;\n }\n`, FB = Vn`\n varying vec3 vColor;\n uniform float opacity;\n\n void main() {\n gl_FragColor = vec4(vColor, opacity);\n }\n`, kt = new three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial({\n vertexShader: OB,\n fragmentShader: FB,\n uniforms: {\n tPosition: { value: null },\n minHeight: { value: 0 },\n maxHeight: { value: 300 },\n opacity: { value: 0.5 },\n samples: { value: 4 },\n sampleStep: { value: 4 }\n },\n vertexColors: !0,\n transparent: !0,\n depthTest: !1,\n blending: three__WEBPACK_IMPORTED_MODULE_0__.NormalBlending\n}), Gc = {\n // From chroma spectral http://gka.github.io/chroma.js/\n SPECTRAL: [\n [0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.3686, 0.3098, 0.6353)],\n [0.1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.1961, 0.5333, 0.7412)],\n [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.4, 0.7608, 0.6471)],\n [0.3, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.6706, 0.8667, 0.6431)],\n [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.902, 0.9608, 0.5961)],\n [0.5, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 1, 0.749)],\n [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.9961, 0.8784, 0.5451)],\n [0.7, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.9922, 0.6824, 0.3804)],\n [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.9569, 0.4275, 0.2627)],\n [0.9, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.8353, 0.2431, 0.3098)],\n [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.6196, 39e-4, 0.2588)]\n ],\n PLASMA: [\n [0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.241, 0.015, 0.61)],\n [0.1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.387, 1e-3, 0.654)],\n [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.524, 0.025, 0.653)],\n [0.3, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.651, 0.125, 0.596)],\n [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.752, 0.227, 0.513)],\n [0.5, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.837, 0.329, 0.431)],\n [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.907, 0.435, 0.353)],\n [0.7, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.963, 0.554, 0.272)],\n [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.992, 0.681, 0.195)],\n [0.9, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.987, 0.822, 0.144)],\n [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.94, 0.975, 0.131)]\n ],\n YELLOW_GREEN: [\n [0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.1647, 0.2824, 0.3451)],\n [0.1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.1338, 0.3555, 0.4227)],\n [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.061, 0.4319, 0.4864)],\n [0.3, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0.5099, 0.5319)],\n [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0.5881, 0.5569)],\n [0.5, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.137, 0.665, 0.5614)],\n [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.2906, 0.7395, 0.5477)],\n [0.7, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.4453, 0.8099, 0.5201)],\n [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.6102, 0.8748, 0.485)],\n [0.9, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.7883, 0.9323, 0.4514)],\n [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.9804, 0.9804, 0.4314)]\n ],\n VIRIDIS: [\n [0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.267, 5e-3, 0.329)],\n [0.1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.283, 0.141, 0.458)],\n [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.254, 0.265, 0.53)],\n [0.3, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.207, 0.372, 0.553)],\n [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.164, 0.471, 0.558)],\n [0.5, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.128, 0.567, 0.551)],\n [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.135, 0.659, 0.518)],\n [0.7, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.267, 0.749, 0.441)],\n [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.478, 0.821, 0.318)],\n [0.9, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.741, 0.873, 0.15)],\n [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.993, 0.906, 0.144)]\n ],\n INFERNO: [\n [0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.077, 0.042, 0.206)],\n [0.1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.225, 0.036, 0.388)],\n [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.373, 0.074, 0.432)],\n [0.3, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.522, 0.128, 0.42)],\n [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.665, 0.182, 0.37)],\n [0.5, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.797, 0.255, 0.287)],\n [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.902, 0.364, 0.184)],\n [0.7, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.969, 0.516, 0.063)],\n [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.988, 0.683, 0.072)],\n [0.9, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.961, 0.859, 0.298)],\n [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.988, 0.998, 0.645)]\n ],\n GRAYSCALE: [\n [0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0, 0)],\n [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 1, 1)]\n ],\n // 16 samples of the TURBU color scheme\n // values taken from: https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f\n // original file licensed under Apache-2.0\n TURBO: [\n [0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.18995, 0.07176, 0.23217)],\n [0.07, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.25107, 0.25237, 0.63374)],\n [0.13, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.27628, 0.42118, 0.89123)],\n [0.2, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.25862, 0.57958, 0.99876)],\n [0.27, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.15844, 0.73551, 0.92305)],\n [0.33, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.09267, 0.86554, 0.7623)],\n [0.4, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.19659, 0.94901, 0.59466)],\n [0.47, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.42778, 0.99419, 0.38575)],\n [0.53, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.64362, 0.98999, 0.23356)],\n [0.6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.80473, 0.92452, 0.20459)],\n [0.67, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.93301, 0.81236, 0.22667)],\n [0.73, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.99314, 0.67408, 0.20348)],\n [0.8, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.9836, 0.49291, 0.12849)],\n [0.87, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.92105, 0.31489, 0.05475)],\n [0.93, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.81608, 0.18462, 0.01809)],\n [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.66449, 0.08436, 424e-5)]\n ],\n RAINBOW: [\n [0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0.278, 0, 0.714)],\n [1 / 6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0, 1)],\n [2 / 6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 1, 1)],\n [3 / 6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 1, 0)],\n [4 / 6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 1, 0)],\n [5 / 6, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 0.64, 0)],\n [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 0, 0)]\n ],\n CONTOUR: [\n [0, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0, 0)],\n [0.03, new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0, 0)],\n [0.04, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 1, 1)],\n [1, new three__WEBPACK_IMPORTED_MODULE_0__.Color(1, 1, 1)]\n ]\n}, DB = `\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n`, LB = `\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n`;\nvar Nc = /* @__PURE__ */ ((e) => (e[e.Intensity = 1] = \"Intensity\", e[e.Classification = 2] = \"Classification\", e[e.Elevation = 3] = \"Elevation\", e[e.RGB = 4] = \"RGB\", e[e.White = 5] = \"White\", e))(Nc || {}), jn = /* @__PURE__ */ ((e) => (e[e.FlatTexture = 1] = \"FlatTexture\", e[e.ShadedTexture = 2] = \"ShadedTexture\", e[e.ShadedNoTexture = 3] = \"ShadedNoTexture\", e))(jn || {});\nconst PB = Gc.RAINBOW, GB = typeof document < \"u\" ? Dc(PB) : null, NB = Gc.GRAYSCALE, UB = typeof document < \"u\" ? Dc(NB) : null, HB = {\n throttleRequests: !0,\n maxRequests: 64,\n updateInterval: 0.1,\n maxConcurrency: 1,\n maximumScreenSpaceError: 16,\n memoryAdjustedScreenSpaceError: !0,\n maximumMemoryUsage: 400,\n memoryCacheOverflow: 128,\n viewDistanceScale: 1,\n skipLevelOfDetail: !1,\n resetTransform: !1,\n updateTransforms: !0,\n shading: jn.FlatTexture,\n transparent: !1,\n pointCloudColoring: Nc.White,\n pointSize: 1,\n worker: !0,\n wireframe: !1,\n debug: !1,\n gltfLoader: null,\n basisTranscoderPath: null,\n dracoDecoderPath: null,\n material: null,\n contentPostProcess: void 0,\n preloadTilesCount: null,\n collectAttributions: !1\n};\nclass qB {\n /**\n * Loads a tileset of 3D Tiles according to the given {@link LoaderProps}\n * @public\n *\n * @param props - Properties for this load call {@link LoaderProps}.\n * @returns An object containing the 3D Model to be added to the scene\n * and a runtime engine to be updated every frame.\n */\n static async load(t) {\n const n = { ...HB, ...t.options }, { url: s } = t;\n let { viewport: r, renderer: i } = t;\n const o = n.updateInterval, a = 5, c = {};\n if (n.cesiumIONToken) {\n c[\"cesium-ion\"] = {\n accessToken: n.cesiumIONToken\n };\n const T = await Ec.preload(s, c);\n c.fetch = { headers: T.headers };\n }\n n.googleApiKey && (c.fetch = { headers: { \"X-GOOG-API-KEY\": n.googleApiKey } }, t.options.hasOwnProperty(\"collectAttributions\") || (n.collectAttributions = !0)), t.loadingManager && t.loadingManager.itemStart(s);\n const u = await Ae(s, Le, {\n ...c\n }), l = {}, h = {}, f = [], d = new three__WEBPACK_IMPORTED_MODULE_0__.Group(), m = new three__WEBPACK_IMPORTED_MODULE_0__.Group();\n n.debug || (m.visible = !1);\n const g = {\n pointSize: { type: \"f\", value: n.pointSize },\n gradient: { type: \"t\", value: GB },\n grayscale: { type: \"t\", value: UB },\n rootCenter: { type: \"vec3\", value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector3() },\n rootNormal: { type: \"vec3\", value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector3() },\n coloring: { type: \"i\", value: n.pointCloudColoring },\n hideGround: { type: \"b\", value: !0 },\n elevationRange: { type: \"vec2\", value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 400) },\n maxIntensity: { type: \"f\", value: 1 },\n intensityContrast: { type: \"f\", value: 1 },\n alpha: { type: \"f\", value: 1 }\n }, y = new three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial({\n uniforms: g,\n vertexShader: LB,\n fragmentShader: DB,\n transparent: n.transparent,\n vertexColors: !0\n });\n let E, R, B;\n n.gltfLoader ? E = n.gltfLoader : (E = new three__WEBPACK_IMPORTED_MODULE_0__.GLTFLoader(), n.basisTranscoderPath && (R = new three__WEBPACK_IMPORTED_MODULE_0__.KTX2Loader(), R.detectSupport(i ?? new three__WEBPACK_IMPORTED_MODULE_0__.WebGLRenderer()), R.setTranscoderPath(n.basisTranscoderPath + \"/\"), R.setWorkerLimit(1), E.setKTX2Loader(R)), n.dracoDecoderPath && (B = new three__WEBPACK_IMPORTED_MODULE_0__.DRACOLoader(), B.setDecoderPath(n.dracoDecoderPath + \"/\"), B.setWorkerLimit(n.maxConcurrency), E.setDRACOLoader(B)));\n const C = new three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial({ transparent: n.transparent }), M = {\n maximumMemoryUsage: n.maximumMemoryUsage,\n maximumScreenSpaceError: n.maximumScreenSpaceError,\n memoryAdjustedScreenSpaceError: n.memoryAdjustedScreenSpaceError,\n memoryCacheOverflow: n.memoryCacheOverflow,\n viewDistanceScale: n.viewDistanceScale,\n skipLevelOfDetail: n.skipLevelOfDetail,\n updateTransforms: n.updateTransforms,\n throttleRequests: n.throttleRequests,\n maxRequests: n.maxRequests,\n contentLoader: async (T) => {\n let D = null;\n switch (T.type) {\n case Pe.POINTCLOUD: {\n D = VB(T, y, n, Pt);\n break;\n }\n case Pe.SCENEGRAPH:\n case Pe.MESH: {\n D = await JB(E, T, C, n, Pt);\n break;\n }\n }\n if (D && (D.visible = !1, l[T.id] = D, d.add(l[T.id]), n.debug)) {\n const nt = Uo(T);\n m.add(nt), h[T.id] = nt;\n }\n },\n onTileLoad: async (T) => {\n b && (n.resetTransform && !L && (T == null ? void 0 : T.depth) <= a && Xt(T), Wt = !0);\n },\n onTileUnload: (T) => {\n f.push(T);\n },\n onTileError: (T, D) => {\n console.warn(\"Tile error\", T.id, D);\n },\n onTraversalComplete(T) {\n return n.collectAttributions && (k = kB(T)), T;\n }\n }, b = new bB(u, {\n ...M,\n loadOptions: {\n ...c,\n maxConcurrency: n.maxConcurrency,\n worker: n.worker,\n gltf: {\n loadImages: !1\n },\n \"3d-tiles\": {\n loadGLTF: !1\n }\n }\n }), O = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4(), F = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4(), v = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n let L = !1, k = \"\";\n if (b.root.boundingVolume ? (b.root.header.boundingVolume.region && console.warn(\"Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates.\"), F.setPosition(\n b.root.boundingVolume.center[0],\n b.root.boundingVolume.center[1],\n b.root.boundingVolume.center[2]\n )) : console.warn(\"Bounding volume not found, no transformations applied\"), n.debug) {\n const T = Uo(b.root);\n m.add(T), h[b.root.id] = T;\n }\n let X = !1, Q = !1;\n g.rootCenter.value.copy(v), g.rootNormal.value.copy(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, 0, 1).normalize()), b.stats.get(\"Loader concurrency\").count = n.maxConcurrency, b.stats.get(\"Maximum mem usage\").count = n.maximumMemoryUsage;\n let P = 0, at = null, Wt = !0, oe = null;\n const Be = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(1 / 0, 1 / 0, 1 / 0);\n let Lt = null;\n d.updateMatrixWorld(!0);\n const et = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(d.matrixWorld), Pt = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(et).invert();\n n.resetTransform && Xt(b.root), n.debug && (h[b.root.id].applyMatrix4(O), m.matrixWorld.copy(d.matrixWorld));\n function Xt(T) {\n if (!T.boundingVolume.halfAxes)\n return;\n const D = T.boundingVolume.halfAxes, nt = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().extractRotation(Lc(D)).premultiply(new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().extractRotation(Pt));\n if (!new three__WEBPACK_IMPORTED_MODULE_0__.Euler().setFromRotationMatrix(nt).equals(new three__WEBPACK_IMPORTED_MODULE_0__.Euler())) {\n L = !0;\n const _t = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(\n F.elements[12],\n F.elements[13],\n F.elements[14]\n );\n F.extractRotation(nt), F.setPosition(_t);\n }\n Ce();\n }\n function Ce() {\n O.copy(et), n.resetTransform && O.multiply(new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(F).invert()), b.modelMatrix = new V(O.toArray());\n }\n function $e(T, D, nt, ct) {\n if (X || !ct)\n return;\n Lt || (Lt = new Dn({\n fov: ct.fov / 180 * Math.PI,\n aspectRatio: ct.aspect,\n near: ct.near,\n far: ct.far\n }).sseDenominator, n.debug && console.log(\"Updated sse denonimator:\", Lt));\n const ns = No(ct).planes.map((q) => new tt(q.normal.toArray(), q.constant)), Uc = new dt(ns), Jr = {\n camera: {\n position: Be.toArray()\n },\n height: nt.height * nt.devicePixelRatio,\n frameNumber: T._frameNumber,\n sseDenominator: Lt,\n cullingVolume: Uc,\n viewport: {\n id: 0\n }\n };\n T._cache.reset(), T._traverser.traverse(T.root, Jr, T.options);\n for (const q of T.tiles)\n q.selected ? D[q.id] ? D[q.id].visible = !0 : console.error(\"TILE SELECTED BUT NOT LOADED!!\", q.id) : D[q.id] && (D[q.id].visible = !1);\n for (; f.length > 0; ) {\n const q = f.pop();\n D[q.id] && q.contentState == lt.UNLOADED && (d.remove(D[q.id]), Us(D[q.id]), delete D[q.id]), h[q.id] && (Us(h[q.id]), m.remove(h[q.id]), delete h[q.id]);\n }\n const ss = T.stats.get(\"Tiles Loaded\").count, Vr = T.stats.get(\"Tiles Loading\").count;\n return t.onProgress && t.onProgress(\n ss,\n ss + Vr\n ), t.loadingManager && !Q && Vr == 0 && (n.preloadTilesCount == null || ss >= n.preloadTilesCount) && (Q = !0, t.loadingManager.itemEnd(t.url)), Jr;\n }\n function es(T) {\n const D = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(), nt = new three__WEBPACK_IMPORTED_MODULE_0__.Quaternion(), ct = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n T.decompose(D, nt, ct), d.position.copy(D), d.quaternion.copy(nt), d.scale.copy(ct), d.updateMatrix(), d.updateMatrixWorld(!0), et.copy(d.matrixWorld), Pt.copy(et).invert(), Ce();\n }\n return {\n model: d,\n runtime: {\n getTileset: () => b,\n getStats: () => b.stats,\n getDataAttributions: () => k,\n showTiles: (T) => {\n m.visible = T;\n },\n setWireframe: (T) => {\n n.wireframe = T, d.traverse((D) => {\n D instanceof three__WEBPACK_IMPORTED_MODULE_0__.Mesh && (D.material.wireframe = T);\n });\n },\n setDebug: (T) => {\n n.debug = T, m.visible = T;\n },\n setShading: (T) => {\n n.shading = T;\n },\n getTileBoxes: () => m,\n setViewDistanceScale: (T) => {\n b.options.viewDistanceScale = T, b._frameNumber++, $e(b, l, r, oe);\n },\n setMaximumScreenSpaceError: (T) => {\n b.options.maximumScreenSpaceError = T, b._frameNumber++, $e(b, l, r, oe);\n },\n setHideGround: (T) => {\n g.hideGround.value = T;\n },\n setPointCloudColoring: (T) => {\n g.coloring.value = T;\n },\n setElevationRange: (T) => {\n g.elevationRange.value.set(T[0], T[1]);\n },\n setMaxIntensity: (T) => {\n g.maxIntensity.value = T;\n },\n setIntensityContrast: (T) => {\n g.intensityContrast.value = T;\n },\n setPointAlpha: (T) => {\n g.alpha.value = T;\n },\n getLatLongHeightFromPosition: (T) => {\n const D = b.ellipsoid.cartesianToCartographic(\n new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().copy(T).applyMatrix4(new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(O).invert()).toArray()\n );\n return {\n lat: D[1],\n long: D[0],\n height: D[2]\n };\n },\n getPositionFromLatLongHeight: (T) => {\n const D = b.ellipsoid.cartographicToCartesian([\n T.long,\n T.lat,\n T.height\n ]);\n return new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(...D).applyMatrix4(O);\n },\n orientToGeocoord: (T) => {\n const D = [T.long, T.lat, T.height], nt = b.ellipsoid.cartographicToCartesian(D), ct = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().fromArray(b.ellipsoid.eastNorthUpToFixedFrame(nt)), _t = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().makeRotationFromEuler(\n new three__WEBPACK_IMPORTED_MODULE_0__.Euler(Math.PI / 2, Math.PI / 2, 0)\n ), ns = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(ct).multiply(_t).invert();\n es(ns);\n },\n getWebMercatorCoord: (T) => RB(T.lat, T.long),\n getCameraFrustum: (T) => {\n const nt = No(T).planes.map((_t) => new tt(_t.normal.toArray(), _t.constant)).map((_t) => wB(_t)), ct = new three__WEBPACK_IMPORTED_MODULE_0__.Group();\n for (const _t of nt)\n ct.add(_t);\n return ct;\n },\n overlayGeoJSON: (T, D) => {\n if (T.applyMatrix4(O), T.updateMatrixWorld(), !i)\n throw new Error(\"GeoJSON draping requires a renderer reference via LoaderProps\");\n return SB(r, d, i, D), T.material.dispose(), T.material = kt, T;\n },\n setViewport: (T) => {\n r = T, Lt = null, Wt = !0, ht && IB(r);\n },\n setRenderer: (T) => {\n i = T;\n },\n update: function(T, D) {\n if (oe = D, P += T, ht && xB(D), b && P >= o) {\n if (!et.equals(d.matrixWorld)) {\n P = 0, et.copy(d.matrixWorld), n.updateTransforms && Ce();\n const nt = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().setFromMatrixPosition(et);\n g.rootCenter.value.copy(nt), g.rootNormal.value.copy(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, 0, 1).applyMatrix4(et).normalize()), Pt.copy(et).invert(), n.debug && (h[b.root.id].matrixWorld.copy(O), h[b.root.id].applyMatrix4(et));\n }\n at == null ? at = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().copy(D.matrixWorld) : (Wt || jB(D, at)) && (P = 0, Wt = !1, b._frameNumber++, D.getWorldPosition(Be), at.copy(D.matrixWorld), $e(b, l, r, D));\n }\n },\n dispose: function() {\n for (X = !0, b._destroy(); d.children.length > 0; ) {\n const T = d.children[0];\n Us(T), d.remove(T);\n }\n for (; m.children.length > 0; ) {\n const T = m.children[0];\n m.remove(T), T.geometry.dispose(), T.material.dispose();\n }\n R && R.dispose(), B && B.dispose();\n }\n }\n };\n }\n /**\n * Loads a tileset of 3D Tiles according to the given {@link GeoJSONLoaderProps}\n * Could be overlayed on geograpical 3D Tiles using {@link Runtime.overlayGeoJSON}\n * @public\n *\n * @param props - Properties for this load call {@link GeoJSONLoaderProps}.\n * @returns An object containing the 3D Model to be added to the scene\n */\n static async loadGeoJSON(t) {\n const { url: n, height: s, featureToColor: r } = t;\n return Ae(n, ke, { worker: !1, gis: { format: \"binary\" } }).then((i) => {\n const o = i, a = new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry(), c = o.polygons.positions.value.reduce((h, f, d, m) => {\n if (d % 2 == 0) {\n const g = [f, m[d + 1], s ?? 0], y = J.WGS84.cartographicToCartesian(g);\n h.push(...y);\n }\n return h;\n }, []);\n if (a.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(\n c,\n 3\n )), r) {\n const h = o.polygons.numericProps[r.feature].value.reduce((f, d, m, g) => {\n const y = r.colorMap(d);\n return f[m * 3] = y.r, f[m * 3 + 1] = y.g, f[m * 3 + 2] = y.b, f;\n }, []);\n a.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(\n h,\n 3\n ));\n }\n a.setIndex(\n new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(o.polygons.triangles.value, 1)\n );\n const u = new three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial({\n transparent: !0,\n vertexColors: !0,\n opacity: 0.5,\n blending: three__WEBPACK_IMPORTED_MODULE_0__.NormalBlending\n });\n return new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(a, u);\n });\n }\n}\nasync function JB(e, t, n, s, r) {\n return new Promise((i, o) => {\n const a = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().makeRotationAxis(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(1, 0, 0), Math.PI / 2), c = t.content.gltfUpAxis !== \"Z\", u = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().fromArray(t.computedTransform).premultiply(r);\n c && u.multiply(a), t.content.byteLength || (t.content.byteLength = t.content.gltfArrayBuffer.byteLength), e.parse(\n t.content.gltfArrayBuffer,\n t.contentUrl ? t.contentUrl.substr(0, t.contentUrl.lastIndexOf(\"/\") + 1) : null,\n (l) => {\n t.userData.asset = l.asset;\n const h = l.scenes[0];\n h.applyMatrix4(u), t.content.texturesByteLength = 0, t.content.geometriesByteLength = 0, h.traverse((f) => {\n if (f.type == \"Mesh\") {\n const d = f;\n t.content.geometriesByteLength += Pc(d.geometry);\n const m = d.material, g = m.map;\n if (g) {\n const y = MB(g);\n y && (t.content.texturesByteLength += y);\n }\n s.material ? (d.material = s.material.clone(), m.dispose()) : s.shading == jn.FlatTexture && d.material.type !== \"MeshBasicMaterial\" && (d.material = n.clone(), m.dispose()), s.shading != jn.ShadedNoTexture ? d.material.type == \"ShaderMaterial\" ? d.material.uniforms.map = { value: g } : d.material.map = g : (g && g.dispose(), d.material.map = null), d.material.wireframe = s.wireframe, s.contentPostProcess && s.contentPostProcess(d);\n }\n }), t.content.gpuMemoryUsageInBytes = t.content.texturesByteLength + t.content.geometriesByteLength, i(h);\n },\n (l) => {\n o(new Error(`error parsing gltf in tile ${t.id}: ${l}`));\n }\n );\n });\n}\nfunction VB(e, t, n, s) {\n const r = {\n rtc_center: e.content.rtcCenter,\n // eslint-disable-line camelcase\n points: e.content.attributes.positions,\n intensities: e.content.attributes.intensity,\n classifications: e.content.attributes.classification,\n rgb: null,\n rgba: null\n }, { colors: i } = e.content.attributes;\n i && i.size === 3 && (r.rgb = i.value), i && i.size === 4 && (r.rgba = i.value);\n const o = new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry();\n o.setAttribute(\"position\", new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(r.points, 3));\n const a = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().fromArray(e.computedTransform).premultiply(s);\n r.rgba ? o.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(r.rgba, 4)) : r.rgb && o.setAttribute(\"color\", new three__WEBPACK_IMPORTED_MODULE_0__.Uint8BufferAttribute(r.rgb, 3, !0)), r.intensities && o.setAttribute(\n \"intensity\",\n // Handles both 16bit or 8bit intensity values\n new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(r.intensities, 1, !0)\n ), r.classifications && o.setAttribute(\"classification\", new three__WEBPACK_IMPORTED_MODULE_0__.Uint8BufferAttribute(r.classifications, 1, !1)), e.content.geometriesByteLength = Pc(o), e.content.gpuMemoryUsageInBytes = e.content.geometriesByteLength;\n const c = new three__WEBPACK_IMPORTED_MODULE_0__.Points(o, n.material || t);\n if (r.rtc_center) {\n const u = r.rtc_center;\n a.multiply(new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().makeTranslation(u[0], u[1], u[2]));\n }\n return c.applyMatrix4(a), n.contentPostProcess && n.contentPostProcess(c), c;\n}\nfunction Jo(e) {\n var t, n, s, r;\n (t = e == null ? void 0 : e.uniforms) != null && t.map ? (s = (n = e == null ? void 0 : e.uniforms) == null ? void 0 : n.map.value) == null || s.dispose() : e.map && ((r = e.map) == null || r.dispose()), e.dispose();\n}\nfunction Us(e) {\n e.traverse((t) => {\n if (t.isMesh)\n if (t.geometry.dispose(), t.material.isMaterial)\n Jo(t.material);\n else\n for (const n of t.material)\n Jo(n);\n });\n for (let t = e.children.length - 1; t >= 0; t--) {\n const n = e.children[t];\n e.remove(n);\n }\n}\nfunction jB(e, t) {\n return !e.matrixWorld.equals(t);\n}\nfunction kB(e) {\n const t = /* @__PURE__ */ new Map();\n return e.forEach((r) => {\n var o, a;\n const i = (a = (o = r == null ? void 0 : r.userData) == null ? void 0 : o.asset) == null ? void 0 : a.copyright;\n i && i.split(/;/g).map((u) => u.trim()).forEach((u) => {\n u && t.set(u, (t.get(u) || 0) + 1);\n });\n }), Array.from(t).sort((r, i) => i[1] - r[1]).map(([r]) => r).join(\"; \");\n}\n\n\n\n//# sourceURL=webpack://aframe-loader-3dtiles-component/./node_modules/three-loader-3dtiles/dist/lib/three-loader-3dtiles.js?"); - /***/ }) /******/ }); diff --git a/dist/aframe-loader-3dtiles-component.min.js b/dist/aframe-loader-3dtiles-component.min.js index b483d820..286ca52d 100644 --- a/dist/aframe-loader-3dtiles-component.min.js +++ b/dist/aframe-loader-3dtiles-component.min.js @@ -1,5 +1,5 @@ /*! For license information please see aframe-loader-3dtiles-component.min.js.LICENSE.txt */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("THREE"));else if("function"==typeof define&&define.amd)define(["THREE"],e);else{var n="object"==typeof exports?e(require("THREE")):e(t.THREE);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(t=>(()=>{var e={384:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("textarea",{schema:{transparentBG:{type:"boolean",default:!1},cols:{type:"int",default:40},rows:{type:"int",default:20},color:{type:"color",default:"black"},backgroundColor:{type:"color",default:"white"},disabledBackgroundColor:{type:"color",default:"lightgrey"},disabled:{type:"boolean",default:!1},text:{type:"string",default:""}},init:function(){this.text=null,this.lines=[],this.lastBlink=0,this.blinkEnabled=!this.data.disabled,this.charWidth=this.charHeight=null,this.selectionStart=this.selectionEnd=0,this.endIndexInfo=this.startIndexInfo=null,this.origin={x:0,y:0},this.background=document.createElement("a-plane"),this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor),this.el.appendChild(this.background),this.data.transparentBG&&this.background.setAttribute("material",{opacity:0,transparent:!0}),this.textAnchor=document.createElement("a-entity"),this.el.appendChild(this.textAnchor),this.textAnchor.setAttribute("text",{mode:"pre",baseline:"top",anchor:"center",font:"dejavu",wrapCount:this.data.cols,height:this.data.rows,color:this.data.color}),this._initTextarea(),this.el.addEventListener("textfontset",this._updateCharMetrics.bind(this)),this.el.addEventListener("char-metrics-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("text-changed",this._updateLines.bind(this)),this.el.addEventListener("text-changed",this._updateDisplayText.bind(this)),this.el.addEventListener("selection-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("selection-changed",this._updateHorizontalOrigin.bind(this)),this.el.addEventListener("lines-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("index-info-changed",this._updateOrigin.bind(this)),this.el.addEventListener("index-info-changed",this._updateHorizontalOrigin.bind(this)),this.el.addEventListener("origin-changed",this._updateDisplayText.bind(this)),this.el.addEventListener("click",this.focus.bind(this))},update:function(t){this.data.text!==t.text&&this._updateTextarea(),this.data.backgroundColor===t.backgroundColor&&this.data.disabledBackgroundColor===t.disabledBackgroundColor||this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor),this.data.disabled!==t.disabled&&(this.blinkEnabled=!this.data.disabled,this.textarea.disabled=this.data.disabled,this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor))},focus:function(){this.textarea.focus()},_initTextarea:function(){this.textarea=document.createElement("textarea"),document.body.appendChild(this.textarea),this._updateTextarea()},_updateTextarea:function(){this.textarea.style.whiteSpace="pre",this.textarea.style.overflow="hidden",this.textarea.style.opacity="0",this.textarea.cols=this.data.cols,this.textarea.rows=this.data.rows,this.textarea.value=this.data.text,this.textarea.selectionStart=0,this.textarea.selectionEnd=0,this._updateIndexInfo()},_emit:function(t,e){this.el.emit(t,e)},_updateCharMetrics:function(t){const e=this.textAnchor.components.text.geometry.layout,n=t.detail.fontObj.widthFactor;this.charWidth=n*this.textAnchor.object3DMap.text.scale.x,this.charHeight=this.charWidth*e.lineHeight/n,this.textAnchor.setAttribute("position",{x:0,y:this.charHeight*this.data.rows/2,z:0}),this.data.transparentBG||(this.background.setAttribute("scale",{x:1.05,y:this.charHeight*this.data.rows*1.05,z:1}),this.background.setAttribute("position",{x:0,y:0,z:0})),this._emit("char-metrics-changed")},_checkAndUpdateSelection:function(){if(this.selectionStart===this.textarea.selectionStart&&this.selectionEnd===this.textarea.selectionEnd)return;const t=this.selectionStart,e=this.selectionEnd;this.selectionStart=this.textarea.selectionStart,this.selectionEnd=this.textarea.selectionEnd,this._emit("selection-changed",{start:{old:t,new:this.selectionStart,changed:this.selectionStart!==t},end:{old:e,new:this.selectionEnd,changed:this.selectionEnd!==e}})},tick:function(t){t-this.lastBlink>500&&this.blinkEnabled&&(this.lastBlink=t),this._checkAndUpdateSelection(),this._checkAndUpdateText()},_getIndexInfo:function(t,e){const n=Math.max(0,t),r=this.lines[n];return{line:r,x:(e-r.start)*this.charWidth,y:-this.charHeight*n+-this.charHeight/2}},_updateIndexInfo:function(){if(!this.lines.length)return;const t=this.startIndexInfo&&this.startIndexInfo.line.index,e=this.endIndexInfo&&this.endIndexInfo.line.index;let n;this.startIndexInfo=null,this.endIndexInfo=null;let r=!1,i=!1;for(n=0;n<=this.lines.length;n++){const s=this.lines[n-1],o=n===this.lines.length?s.start+s.length+1:this.lines[n].start;if(o>this.selectionStart&&!this.startIndexInfo&&(this.startIndexInfo=this._getIndexInfo(n-1,this.selectionStart),this.startIndexInfo.line.index!==t&&(r=!0)),o>this.selectionEnd){this.endIndexInfo=this._getIndexInfo(n-1,this.selectionEnd),this.endIndexInfo.line.index!==e&&(i=!0);break}}(r||i)&&this._emit("index-info-changed",{start:{changed:r},end:{changed:i}})},_updateOrigin:function(t){let e=!1;if(t.detail.end.changed){const t=this.origin.y+this.data.rows-1;this.endIndexInfo.line.index>t?(this.origin.y=this.endIndexInfo.line.index+1-this.data.rows,e=!0):this.endIndexInfo.line.indexthis.origin.x+this.data.cols?(this.origin.x=t-this.data.cols,e=!0):tthis.origin.x+this.data.cols?(this.origin.x=n-this.data.cols,e=!0):n{"use strict";e.exports=t}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var s=n[t]={exports:{}};return e[t](s,s.exports,r),s.exports}r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i);var t=r(824),e=Object.defineProperty,n=(t,n,r)=>(((t,n,r)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r})(t,"symbol"!=typeof n?n+"":n,r),r);async function s(t,e,n,r){return r._parse(t,e,n,r)}function o(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const a=!("object"==typeof process&&"[object process]"===String(process)&&!process.browser),c=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);function h(t,e){return l(t||{},e)}function l(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(n>3)return e;const r={...t};for(const[t,i]of Object.entries(e))i&&"object"==typeof i&&!Array.isArray(i)?r[t]=l(r[t]||{},e[t],n+1):r[t]=e[t];return r}c&&parseFloat(c[1]);const u="latest",d=(null!==(f=globalThis._loadersgl_)&&void 0!==f&&f.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.1"),globalThis._loadersgl_.version);var f;function m(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const p="object"!=typeof process||"[object process]"!==String(process)||process.browser,g="function"==typeof importScripts,A=typeof window<"u"&&typeof window.orientation<"u",y=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);y&&parseFloat(y[1]);class B{constructor(t,e){this.name=void 0,this.workerThread=void 0,this.isRunning=!0,this.result=void 0,this._resolve=()=>{},this._reject=()=>{},this.name=t,this.workerThread=e,this.result=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){m(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){m(this.isRunning),this.isRunning=!1,this._reject(t)}}class b{terminate(){}}const C=new Map;function w(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function E(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0;const r=n||new Set;if(t)if(v(t))r.add(t);else if(v(t.buffer))r.add(t.buffer);else if(!ArrayBuffer.isView(t)&&e&&"object"==typeof t)for(const n in t)E(t[n],e,r);return void 0===n?Array.from(r):[]}function v(t){return!!t&&(t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)}const T=()=>{};class _{static isSupported(){return typeof Worker<"u"&&p||typeof b<"u"&&!p}constructor(t){this.name=void 0,this.source=void 0,this.url=void 0,this.terminated=!1,this.worker=void 0,this.onMessage=void 0,this.onError=void 0,this._loadableURL="";const{name:e,source:n,url:r}=t;m(n||r),this.name=e,this.source=n,this.url=r,this.onMessage=T,this.onError=t=>console.log(t),this.worker=p?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=T,this.onError=T,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(t,e){e=e||E(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name} from ${this.url}. `,t.message&&(e+=`${t.message} in `),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=function(t){m(t.source&&!t.url||!t.source&&t.url);let e=C.get(t.source||t.url);return e||(t.url&&(e=function(t){return t.startsWith("http")?w(function(t){return`try {\n importScripts('${t}');\n} catch (error) {\n console.error(error);\n throw error;\n}`}(t)):t}(t.url),C.set(t.url,e)),t.source&&(e=w(t.source),C.set(t.source,e))),m(e),e}({source:this.source,url:this.url});const t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},t.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},t.onmessageerror=t=>console.error(t),t}_createNodeWorker(){let t;if(this.url){const e=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new b(e,{eval:!1})}else{if(!this.source)throw new Error("no worker");t=new b(this.source,{eval:!0})}return t.on("message",(t=>{this.onMessage(t)})),t.on("error",(t=>{this.onError(t)})),t.on("exit",(t=>{})),t}}class x{static isSupported(){return _.isSupported()}constructor(t){this.name="unnamed",this.source=void 0,this.url=void 0,this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1,this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach((t=>t.destroy())),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},void 0!==t.name&&(this.name=t.name),void 0!==t.maxConcurrency&&(this.maxConcurrency=t.maxConcurrency),void 0!==t.maxMobileConcurrency&&(this.maxMobileConcurrency=t.maxMobileConcurrency),void 0!==t.reuseWorkers&&(this.reuseWorkers=t.reuseWorkers),void 0!==t.onDebug&&(this.onDebug=t.onDebug)}async startJob(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(t,e,n)=>t.done(n),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(t,e)=>t.error(e);const r=new Promise((r=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:r}),this)));return this._startQueuedJob(),await r}async _startQueuedJob(){if(!this.jobQueue.length)return;const t=this._getAvailableWorker();if(!t)return;const e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});const n=new B(e.name,t);t.onMessage=t=>e.onMessage(n,t.type,t.payload),t.onError=t=>e.onError(n,t),e.onStart(n);try{await n.result}catch(t){console.error(`Worker exception: ${t}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!p||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}};class I{static isSupported(){return _.isSupported()}static getWorkerFarm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return I._workerFarm=I._workerFarm||new I({}),I._workerFarm.setProps(t),I._workerFarm}constructor(t){this.props=void 0,this.workerPools=new Map,this.props={...M},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:n,url:r}=t;let i=this.workerPools.get(e);return i||(i=new x({name:e,source:n,url:r}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}I._workerFarm=void 0;const S=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})),R={};async function O(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return e&&(t=F(t,e,n,r)),R[t]=R[t]||D(t),await R[t]}function F(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!n.useLocalLibraries&&t.startsWith("http"))return t;r=r||t;const i=n.modules||{};return i[r]?i[r]:p?n.CDN?(m(n.CDN.startsWith("http")),`${n.CDN}/${e}@${d}/dist/libs/${r}`):g?`../src/libs/${r}`:`modules/${e}/src/libs/${r}`:`modules/${e}/dist/libs/${r}`}async function D(t){if(t.endsWith("wasm"))return await async function(t){return await(await fetch(t)).arrayBuffer()}(t);if(!p)try{return S&&void 0}catch(t){return console.error(t),null}if(g)return importScripts(t);const e=await async function(t){return await(await fetch(t)).text()}(t);return function(t,e){if(!p)return;if(g)return eval.call(globalThis,t),null;const n=document.createElement("script");n.id=e;try{n.appendChild(document.createTextNode(t))}catch{n.text=t}return document.body.appendChild(n),null}(e,t)}async function G(t,e,n,r,i){const s=t.id,o=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e[t.id]||{},r=p?`${t.id}-worker.js`:`${t.id}-worker-node.js`;let i=n.workerUrl;if(!i&&"compression"===t.id&&(i=e.workerUrl),"test"===e._workerType&&(i=p?`modules/${t.module}/dist/${r}`:`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!i){let e=t.version;"latest"===e&&(e=u);const n=e?`@${e}`:"";i=`https://unpkg.com/@loaders.gl/${t.module}${n}/dist/${r}`}return m(i),i}(t,n),a=I.getWorkerFarm(n).getWorkerPool({name:s,url:o});n=JSON.parse(JSON.stringify(n)),r=JSON.parse(JSON.stringify(r||{}));const c=await a.startJob("process-on-worker",L.bind(null,i));return c.postMessage("process",{input:e,options:n,context:r}),await(await c.result).result}async function L(t,e,n,r){switch(n){case"done":e.done(r);break;case"error":e.error(new Error(r.error));break;case"process":const{id:i,input:s,options:o}=r;try{const n=await t(s,o);e.postMessage("done",{id:i,result:n})}catch(t){const n=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:i,error:n})}break;default:console.warn(`parse-with-worker unknown message ${n}`)}}function U(t,e,n){if(t.byteLength<=e+n)return"";const r=new DataView(t);let i="";for(let t=0;tt instanceof ArrayBuffer?new Uint8Array(t):t)),n=e.reduce(((t,e)=>t+e.byteLength),0),r=new Uint8Array(n);let i=0;for(const t of e)r.set(t,i),i+=t.byteLength;return r.buffer}function P(t,e,n){const r=void 0!==n?new Uint8Array(t).subarray(e,e+n):new Uint8Array(t).subarray(e);return new Uint8Array(r).buffer}function H(t,e){return o(t>=0),o(e>0),t+(e-1)&~(e-1)}function J(t,e,n){let r;if(t instanceof ArrayBuffer)r=new Uint8Array(t);else{const e=t.byteOffset,n=t.byteLength;r=new Uint8Array(t.buffer||t.arrayBuffer,e,n)}return e.set(r,n),n+H(r.byteLength,4)}function j(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){const e=process.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}class k{constructor(t,e){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=j(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(j()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class V{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t of Object.values(this.stats))t.reset();return this}forEach(t){for(const e of Object.values(this.stats))t(e)}getTable(){const t={};return this.forEach((e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}})),t}_initializeStats(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((t=>this._getOrCreate(t)))}_getOrCreate(t){const{name:e,type:n}=t;let r=this.stats[e];return r||(r=t instanceof k?t:new k(e,n),this.stats[e]=r),r}}const K={};function Q(t){if(function(t){return t&&"object"==typeof t&&t.isBuffer}(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return 0===t.byteOffset&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if("string"==typeof t){const e=t;return(new TextEncoder).encode(e).buffer}if(t&&"object"==typeof t&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}function z(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();const e=null===(t=window.location)||void 0===t?void 0:t.pathname;return(null==e?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function q(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function W(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}const Y=47;function X(t,e){let n,r="",i=-1,s=0,o=!1;for(let a=0;a<=t.length;++a){if(a2){const t=r.length-1;let e=t;for(;e>=0&&r.charCodeAt(e)!==Y;--e);if(e!==t){r=-1===e?"":r.slice(0,e),i=a,s=0,o=!1;continue}}else if(2===r.length||1===r.length){r="",i=a,s=0,o=!1;continue}e&&(r.length>0?r+="/..":r="..",o=!0)}else{const e=t.slice(i+1,a);r.length>0?r+=`/${e}`:r=e,o=!1}i=a,s=0}else 46===n&&-1!==s?++s:s=-1}return r}const Z=t=>"function"==typeof t,$=t=>null!==t&&"object"==typeof t,tt=t=>$(t)&&t.constructor==={}.constructor,et=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,nt=t=>typeof Blob<"u"&&t instanceof Blob,rt=t=>(t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||$(t)&&Z(t.tee)&&Z(t.cancel)&&Z(t.getReader))(t)||(t=>$(t)&&Z(t.read)&&Z(t.pipe)&&(t=>"boolean"==typeof t)(t.readable))(t),it=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,st=/^([-\w.]+\/[-\w.+]+)/;function ot(t){const e=it.exec(t);return e?e[1]:""}const at=/\?.*/;function ct(t){return t.replace(at,"")}function ht(t){return et(t)?t.url:nt(t)?t.name||"":"string"==typeof t?t:""}function lt(t){if(et(t)){const e=t,n=e.headers.get("content-type")||"",r=ct(e.url);return function(t){const e=st.exec(t);return e?e[1]:t}(n)||ot(r)}return nt(t)?t.type||"":"string"==typeof t?ot(t):""}async function ut(t){if(et(t))return t;const e={},n=function(t){return et(t)?t.headers["content-length"]||-1:nt(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}(t);n>=0&&(e["content-length"]=String(n));const r=ht(t),i=lt(t);i&&(e["content-type"]=i);const s=await async function(t){if("string"==typeof t)return`data:,${t.slice(0,5)}`;if(t instanceof Blob){const e=t.slice(0,5);return await new Promise((t=>{const n=new FileReader;n.onload=e=>{var n;return t(null==e||null===(n=e.target)||void 0===n?void 0:n.result)},n.readAsDataURL(e)}))}return t instanceof ArrayBuffer?`data:base64,${function(t){let e="";const n=new Uint8Array(t);for(let t=0;t=0)}()}const mt=globalThis.window||globalThis.self||globalThis.global,pt=globalThis.process||{},gt=typeof __VERSION__<"u"?__VERSION__:"untranspiled source";ft();class At{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=function(t){try{const e=window[t],n="__storage_test__";return e.setItem(n,n),e.removeItem(n),e}catch{return null}}(n),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let t={};if(this.storage){const e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}function yt(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>r&&(n=Math.min(n,r/t.width));const s=t.width*n,o=t.height*n,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(s/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(s,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}let Bt;function bt(t){return"string"!=typeof t?t:(t=t.toUpperCase(),Bt[t]||Bt.WHITE)}function Ct(t,e){if(!t)throw new Error(e||"Assertion failed")}function wt(){let t;var e,n;if(ft()&&mt.performance)t=null==mt||null===(e=mt.performance)||void 0===e||null===(n=e.now)||void 0===n?void 0:n.call(e);else if("hrtime"in pt){var r;const e=null==pt||null===(r=pt.hrtime)||void 0===r?void 0:r.call(pt);t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}!function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(Bt||(Bt={}));const Et={debug:ft()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},vt={enabled:!0,level:0};function Tt(){}const _t={},xt={once:!0};class Mt{constructor(){let{id:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};this.id=void 0,this.VERSION=gt,this._startTs=wt(),this._deltaTs=wt(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new At("__probe-".concat(this.id,"__"),vt),this.timeStamp("".concat(this.id," started")),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const n=Object.getPrototypeOf(t),r=Object.getOwnPropertyNames(n),i=t;for(const n of r){const r=i[n];"function"==typeof r&&(e.find((t=>n===t))||(i[n]=r.bind(t)))}}(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((wt()-this._startTs).toPrecision(10))}getDelta(){return Number((wt()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){Ct(t,e)}warn(t){return this._getLogFunction(0,t,Et.warn,arguments,xt)}error(t){return this._getLogFunction(0,t,Et.error,arguments)}deprecated(t,e){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(e,"` instead"))}removed(t,e){return this.error("`".concat(t,"` has been removed. Use `").concat(e,"` instead"))}probe(t,e){return this._getLogFunction(t,e,Et.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,Et.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,Et.debug||Et.info,arguments,xt)}table(t,e,n){return e?this._getLogFunction(t,e,console.table||Tt,n&&[n],{tag:Rt(e)}):Tt}image(t){let{logLevel:e,priority:n,image:r,message:i="",scale:s=1}=t;return this._shouldLog(e||n)?ft()?function(t){let{image:e,message:n="",scale:r=1}=t;if("string"==typeof e){const t=new Image;return t.onload=()=>{const e=yt(t,n,r);console.log(...e)},t.src=e,Tt}const i=e.nodeName||"";if("img"===i.toLowerCase())return console.log(...yt(e,n,r)),Tt;if("canvas"===i.toLowerCase()){const t=new Image;return t.onload=()=>console.log(...yt(t,n,r)),t.src=e.toDataURL(),Tt}return Tt}({image:r,message:i,scale:s}):(console.warn("removed"),Tt):Tt}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||Tt)}group(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const r=St({logLevel:t,message:e,opts:n}),{collapsed:i}=n;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Tt)}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=It(t)}_getLogFunction(t,e,n,r,i){if(this._shouldLog(t)){i=St({logLevel:t,message:e,args:r,opts:i}),Ct(n=n||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=wt();const s=i.tag||i.message;if(i.once&&s){if(_t[s])return Tt;_t[s]=wt()}return e=function(t,e,n){if("string"==typeof e){const r=n.time?function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const n=Math.max(e-t.length,0);return"".concat(" ".repeat(n)).concat(t)}(function(t){let e;return e=t<10?"".concat(t.toFixed(2),"ms"):t<100?"".concat(t.toFixed(1),"ms"):t<1e3?"".concat(t.toFixed(0),"ms"):"".concat((t/1e3).toFixed(2),"s"),e}(n.total)):"";e=n.time?"".concat(t,": ").concat(r," ").concat(e):"".concat(t,": ").concat(e),e=function(t,e,n){if(!ft&&"string"==typeof t){if(e){const n=bt(e);t="[".concat(n,"m").concat(t,"")}if(n){const e=bt(n);t="[".concat(e+10,"m").concat(t,"")}}return t}(e,n.color,n.background)}return e}(this.id,i.message,i),n.bind(console,e,...i.args)}return Tt}}function It(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return Ct(Number.isFinite(e)&&e>=0),e}function St(t){const{logLevel:e,message:n}=t;t.logLevel=It(e);const r=t.args?Array.from(t.args):[];for(;r.length&&r.shift()!==n;);switch(typeof e){case"string":case"function":void 0!==n&&r.unshift(n),t.message=e;break;case"object":Object.assign(t,e)}"function"==typeof t.message&&(t.message=t.message());const i=typeof t.message;return Ct("string"===i||"object"===i),Object.assign(t,{args:r},t.opts)}function Rt(t){for(const e in t)for(const n in t[e])return n||"untitled";return"empty"}Mt.VERSION=gt;const Ot=new Mt({id:"@probe.gl/log"}),Ft=new Mt({id:"loaders.gl"});class Dt{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const Gt={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){this.console=void 0,this.console=console}log(){for(var t=arguments.length,e=new Array(t),n=0;n{const t=Ut();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry})()}const Kt=new Mt({id:"loaders.gl"}),Qt=/\.([^.]+)$/;function zt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!Wt(t))return null;if(e&&!Array.isArray(e))return kt(e);let i=[];e&&(i=i.concat(e)),null!=n&&n.ignoreRegisteredLoaders||i.push(...Vt()),Xt(i);const s=qt(t,i,n,r);if(!(s||null!=n&&n.nothrow))throw new Error(Yt(t));return s}function qt(t,e,n,r){const i=ht(t),s=lt(t),o=ct(i)||(null==r?void 0:r.url);let a=null,c="";var h;return null!=n&&n.mimeType&&(a=Zt(e,null==n?void 0:n.mimeType),c=`match forced by supplied MIME type ${null==n?void 0:n.mimeType}`),a=a||function(t,e){const n=e&&Qt.exec(e),r=n&&n[1];return r?function(t,e){e=e.toLowerCase();for(const n of t)for(const t of n.extensions)if(t.toLowerCase()===e)return n;return null}(t,r):null}(e,o),c=c||(a?`matched url ${o}`:""),a=a||Zt(e,s),c=c||(a?`matched MIME type ${s}`:""),a=a||function(t,e){if(!e)return null;for(const n of t)if("string"==typeof e){if($t(e,n))return n}else if(ArrayBuffer.isView(e)){if(te(e.buffer,e.byteOffset,n))return n}else if(e instanceof ArrayBuffer&&te(e,0,n))return n;return null}(e,t),c=c||(a?`matched initial data ${ee(t)}`:""),null!=n&&n.fallbackMimeType&&(a=a||Zt(e,null==n?void 0:n.fallbackMimeType),c=c||(a?`matched fallback MIME type ${s}`:"")),c&&Kt.log(1,`selectLoader selected ${null===(h=a)||void 0===h?void 0:h.name}: ${c}.`),a}function Wt(t){return!(t instanceof Response&&204===t.status)}function Yt(t){const e=ht(t),n=lt(t);let r="No valid loader found (";r+=e?`${q(e)}, `:"no url provided, ",r+=`MIME type: ${n?`"${n}"`:"not provided"}, `;const i=t?ee(t):"";return r+=i?` first bytes: "${i}"`:"first bytes: not available",r+=")",r}function Xt(t){for(const e of t)kt(e)}function Zt(t,e){for(const n of t)if(n.mimeTypes&&n.mimeTypes.includes(e)||e===`application/x.${n.id}`)return n;return null}function $t(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some((e=>t.startsWith(e)))}function te(t,e,n){return(Array.isArray(n.tests)?n.tests:[n.tests]).some((n=>function(t,e,n,r){if(r instanceof ArrayBuffer)return function(t,e,n){if(n=n||t.byteLength,t.byteLength1&&void 0!==arguments[1]?arguments[1]:5;return"string"==typeof t?t.slice(0,e):ArrayBuffer.isView(t)?ne(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?ne(t,0,e):""}function ne(t,e,n){if(t.byteLengtht&&"object"==typeof t&&t.isBuffer)(t)&&(t=t.buffer),t instanceof ArrayBuffer){const n=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let n=t.buffer;const r=t.byteLength||t.length;return(0!==t.byteOffset||r!==n.byteLength)&&(n=n.slice(t.byteOffset,t.byteOffset+r)),n}throw new Error(se)}(t,e);if(nt(t)&&(t=await ut(t)),et(t)){const n=t;return await async function(t){if(!t.ok){const e=await async function(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{const n=t.headers.get("Content-Type");let r=t.statusText;null!=n&&n.includes("application/json")&&(r+=` ${await t.text()}`),e+=r,e=e.length>60?`${e.slice(0,60)}...`:e}catch{}return e}(t);throw new Error(e)}}(n),e.binary?await n.arrayBuffer():await n.text()}if(rt(t)&&(t=function(t,e){if("string"==typeof t)return function*(t,e){const n=(null==e?void 0:e.chunkSize)||262144;let r=0;const i=new TextEncoder;for(;r1&&void 0!==arguments[1]?arguments[1]:{};return function*(){const{chunkSize:n=re}=e;let r=0;for(;r!!t&&"function"==typeof t[Symbol.iterator])(t)||(t=>t&&"function"==typeof t[Symbol.asyncIterator])(t))return async function(t){const e=[];for await(const n of t)e.push(n);return function(){for(var t=arguments.length,e=new Array(t),n=0;ndt(t,r.fetch):null!=e&&e.fetch?null==e?void 0:e.fetch:dt}async function ce(t,e,n,r){e&&!Array.isArray(e)&&!jt(e)&&(r=void 0,n=e,e=void 0),n=n||{};const i=ht(t=await t),s=function(t,e){if(t&&!Array.isArray(t))return t;let n;if(t&&(n=Array.isArray(t)?t:[t]),e&&e.loaders){const t=Array.isArray(e.loaders)?e.loaders:[e.loaders];n=n?[...n,...t]:t}return n&&n.length?n:void 0}(e,r),o=await async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!Wt(t))return null;let i=zt(t,e,{...n,nothrow:!0},r);if(i)return i;if(nt(t)&&(i=zt(t=await t.slice(0,10).arrayBuffer(),e,n,r)),!(i||null!=n&&n.nothrow))throw new Error(Yt(t));return i}(t,s,n);return o?(r=function(t,e,n){if(n)return n;const r={fetch:ae(e,t),...t};if(r.url){const t=ct(r.url);r.baseUrl=t,r.queryString=function(t){const e=t.match(at);return e&&e[0]}(r.url),r.filename=q(t),r.baseUrl=W(t)}return Array.isArray(r.loaders)||(r.loaders=null),r}({url:i,_parse:ce,loaders:s},n=function(t,e,n,r){return n=n||[],function(t,e){Pt(t,null,Gt,Lt,e);for(const n of e){const r=t&&t[n.id]||{},i=n.options&&n.options[n.id]||{},s=n.deprecatedOptions&&n.deprecatedOptions[n.id]||{};Pt(r,n.id,i,s,e)}}(t,n=Array.isArray(n)?n:[n]),function(t,e,n){const r={...t.options||{}};return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(r,n),null===r.log&&(r.log=new Dt),Jt(r,Nt()),Jt(r,e),r}(e,t,r)}(n,o,s,i),r||null),await async function(t,e,n,r){if(function(t){m(t,"no worker provided");t.version}(t),n=h(t.options,n),et(e)){const t=e,{ok:n,redirected:i,status:s,statusText:o,type:a,url:c}=t,h=Object.fromEntries(t.headers.entries());r.response={headers:h,ok:n,redirected:i,status:s,statusText:o,type:a,url:c}}e=await oe(e,t,n);const i=t;if(i.parseTextSync&&"string"==typeof e)return i.parseTextSync(e,n,r);if(function(t,e){return!(!I.isSupported()||!(p||null!=e&&e._nodeWorkers))&&t.worker&&(null==e?void 0:e.worker)}(t,n))return await G(t,e,n,r,ce);if(i.parseText&&"string"==typeof e)return await i.parseText(e,n,r);if(i.parse)return await i.parse(e,n,r);throw m(!i.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}(o,t,n,r)):null}async function he(t,e,n,r){let i,s;Array.isArray(e)||jt(e)?(i=e,s=n):(i=[],s=e);const o=ae(s);let a=t;return"string"==typeof t&&(a=await o(t)),nt(t)&&(a=await o(t)),Array.isArray(i),await ce(a,i,s)}const le=1/Math.PI*180,ue=1/180*Math.PI;globalThis.mathgl=globalThis.mathgl||{config:{EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1}};const de=globalThis.mathgl.config;function fe(t,{precision:e=de.precision}={}){return t=function(t){return Math.round(t/de.EPSILON)*de.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function me(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function pe(t){return function(t,e){return be(t,(t=>t*ue),void 0)}(t)}function ge(t){return Ae(t)}function Ae(t,e){return be(t,(t=>t*le),e)}function ye(t,e,n){return be(t,(t=>Math.max(e,Math.min(n,t))))}function Be(t,e,n){const r=de.EPSILON;n&&(de.EPSILON=n);try{if(t===e)return!0;if(me(t)&&me(e)){if(t.length!==e.length)return!1;for(let n=0;n0?", ":"")+fe(this[n],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e=0&&t=0&&t0?this.copy([t,...e]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(Ze)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n+n,a=r+r,c=i+i,h=n*o,l=r*o,u=r*a,d=i*o,f=i*a,m=i*c,p=s*o,g=s*a,A=s*c;t[0]=1-u-m,t[3]=l-A,t[6]=d+g,t[1]=l+A,t[4]=1-h-m,t[7]=f-p,t[2]=d-g,t[5]=f+p,t[8]=1-h-u}(this,t),this.check()}set(t,e,n,r,i,s,o,a,c){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=a,this[8]=c,this.check()}setRowMajor(t,e,n,r,i,s,o,a,c){return this[0]=t,this[1]=r,this[2]=o,this[3]=e,this[4]=i,this[5]=a,this[6]=n,this[7]=s,this[8]=c,this.check()}determinant(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],h=t[8];return e*(h*s-o*c)+n*(-h*i+o*a)+r*(c*i-s*a)}(this)}transpose(){return function(t,e){if(t===e){const n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],h=e[7],l=e[8],u=l*o-a*h,d=-l*s+a*c,f=h*s-o*c;let m=n*u+r*d+i*f;m&&(m=1/m,t[0]=u*m,t[1]=(-l*r+i*h)*m,t[2]=(a*r-i*o)*m,t[3]=d*m,t[4]=(l*n-i*c)*m,t[5]=(-a*n+i*s)*m,t[6]=f*m,t[7]=(-h*n+r*c)*m,t[8]=(o*n-r*s)*m)}(this,this),this.check()}multiplyLeft(t){return We(this,t,this),this.check()}multiplyRight(t){return We(this,this,t),this.check()}rotate(t){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=Math.sin(n),f=Math.cos(n);t[0]=f*r+d*o,t[1]=f*i+d*a,t[2]=f*s+d*c,t[3]=f*o-d*r,t[4]=f*a-d*i,t[5]=f*c-d*s,t[6]=h,t[7]=l,t[8]=u}(this,this,t),this.check()}scale(t){return Array.isArray(t)?Ye(this,this,t):Ye(this,this,[t,t]),this.check()}translate(t){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=n[0],f=n[1];t[0]=r,t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=c,t[6]=d*r+f*o+h,t[7]=d*i+f*a+l,t[8]=d*s+f*c+u}(this,this,t),this.check()}transform(t,e){let n;switch(t.length){case 2:n=Me(e||[-0,-0],t,this);break;case 3:n=He(e||[-0,-0,-0],t,this);break;case 4:n=Oe(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(n,t.length),n}transformVector(t,e){return this.transform(t,e)}transformVector2(t,e){return this.transform(t,e)}transformVector3(t,e){return this.transform(t,e)}}let tn,en=null;function nn(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=e[9],f=e[10],m=e[11],p=e[12],g=e[13],A=e[14],y=e[15];let B=n[0],b=n[1],C=n[2],w=n[3];return t[0]=B*r+b*a+C*u+w*p,t[1]=B*i+b*c+C*d+w*g,t[2]=B*s+b*h+C*f+w*A,t[3]=B*o+b*l+C*m+w*y,B=n[4],b=n[5],C=n[6],w=n[7],t[4]=B*r+b*a+C*u+w*p,t[5]=B*i+b*c+C*d+w*g,t[6]=B*s+b*h+C*f+w*A,t[7]=B*o+b*l+C*m+w*y,B=n[8],b=n[9],C=n[10],w=n[11],t[8]=B*r+b*a+C*u+w*p,t[9]=B*i+b*c+C*d+w*g,t[10]=B*s+b*h+C*f+w*A,t[11]=B*o+b*l+C*m+w*y,B=n[12],b=n[13],C=n[14],w=n[15],t[12]=B*r+b*a+C*u+w*p,t[13]=B*i+b*c+C*d+w*g,t[14]=B*s+b*h+C*f+w*A,t[15]=B*o+b*l+C*m+w*y,t}var rn;!function(){const t=new xe(4);xe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"}(rn||(rn={}));const sn=45*Math.PI/180,on=1,an=.1,cn=500,hn=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class ln extends qe{static get IDENTITY(){return dn||(dn=new ln,Object.freeze(dn)),dn}static get ZERO(){return un||(un=new ln([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(un)),un}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return rn}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,n,r,i,s,o,a,c,h,l,u,d,f,m,p){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=a,this[8]=c,this[9]=h,this[10]=l,this[11]=u,this[12]=d,this[13]=f,this[14]=m,this[15]=p,this.check()}setRowMajor(t,e,n,r,i,s,o,a,c,h,l,u,d,f,m,p){return this[0]=t,this[1]=i,this[2]=c,this[3]=d,this[4]=e,this[5]=s,this[6]=h,this[7]=f,this[8]=n,this[9]=o,this[10]=l,this[11]=m,this[12]=r,this[13]=a,this[14]=u,this[15]=p,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(hn)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n+n,a=r+r,c=i+i,h=n*o,l=r*o,u=r*a,d=i*o,f=i*a,m=i*c,p=s*o,g=s*a,A=s*c;t[0]=1-u-m,t[1]=l+A,t[2]=d-g,t[3]=0,t[4]=l-A,t[5]=1-h-m,t[6]=f+p,t[7]=0,t[8]=d+g,t[9]=f-p,t[10]=1-h-u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum(t){const{left:e,right:n,bottom:r,top:i,near:s=an,far:o=cn}=t;return o===1/0?function(t,e,n,r,i,s){const o=2*s/(n-e),a=2*s/(i-r),c=(n+e)/(n-e),h=(i+r)/(i-r),l=-2*s;t[0]=o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=h,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=l,t[15]=0}(this,e,n,r,i,s):function(t,e,n,r,i,s,o){const a=1/(n-e),c=1/(i-r),h=1/(s-o);t[0]=2*s*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*c,t[6]=0,t[7]=0,t[8]=(n+e)*a,t[9]=(i+r)*c,t[10]=(o+s)*h,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*s*2*h,t[15]=0}(this,e,n,r,i,s,o),this.check()}lookAt(t){const{eye:e,center:n=[0,0,0],up:r=[0,1,0]}=t;return function(t,e,n,r){let i,s,o,a,c,h,l,u,d,f;const m=e[0],p=e[1],g=e[2],A=r[0],y=r[1],B=r[2],b=n[0],C=n[1],w=n[2];Math.abs(m-b)<_e&&Math.abs(p-C)<_e&&Math.abs(g-w)<_e?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(u=m-b,d=p-C,f=g-w,i=1/Math.sqrt(u*u+d*d+f*f),u*=i,d*=i,f*=i,s=y*f-B*d,o=B*u-A*f,a=A*d-y*u,i=Math.sqrt(s*s+o*o+a*a),i?(i=1/i,s*=i,o*=i,a*=i):(s=0,o=0,a=0),c=d*a-f*o,h=f*s-u*a,l=u*o-d*s,i=Math.sqrt(c*c+h*h+l*l),i?(i=1/i,c*=i,h*=i,l*=i):(c=0,h=0,l=0),t[0]=s,t[1]=c,t[2]=u,t[3]=0,t[4]=o,t[5]=h,t[6]=d,t[7]=0,t[8]=a,t[9]=l,t[10]=f,t[11]=0,t[12]=-(s*m+o*p+a*g),t[13]=-(c*m+h*p+l*g),t[14]=-(u*m+d*p+f*g),t[15]=1)}(this,e,n,r),this.check()}ortho(t){const{left:e,right:n,bottom:r,top:i,near:s=an,far:o=cn}=t;return function(t,e,n,r,i,s,o){const a=1/(e-n),c=1/(r-i),h=1/(s-o);t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+n)*a,t[13]=(i+r)*c,t[14]=(o+s)*h,t[15]=1}(this,e,n,r,i,s,o),this.check()}orthographic(t){const{fovy:e=sn,aspect:n=on,focalDistance:r=1,near:i=an,far:s=cn}=t;fn(e);const o=e/2,a=r*Math.tan(o),c=a*n;return this.ortho({left:-c,right:c,bottom:-a,top:a,near:i,far:s})}perspective(t){const{fovy:e=45*Math.PI/180,aspect:n=1,near:r=.1,far:i=500}=t;return fn(e),function(t,e,n,r,i){const s=1/Math.tan(e/2);if(t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0){const e=1/(r-i);t[10]=(i+r)*e,t[14]=2*i*r*e}else t[10]=-1,t[14]=-2*r}(this,e,n,r,i),this.check()}determinant(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],h=t[8],l=t[9],u=t[10],d=t[11],f=t[12],m=t[13],p=t[14],g=e*o-n*s,A=e*a-r*s,y=n*a-r*o,B=h*m-l*f,b=h*p-u*f,C=l*p-u*m;return c*(e*C-n*b+r*B)-i*(s*C-o*b+a*B)+t[15]*(h*y-l*A+u*g)-d*(f*y-m*A+p*g)}(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),r=1/n[0],i=1/n[1],s=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*i,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*r,t[9]=this[9]*i,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),r=1/n[0],i=1/n[1],s=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=this[4]*r,t[4]=this[5]*i,t[5]=this[6]*s,t[6]=this[8]*r,t[7]=this[9]*i,t[8]=this[10]*s,t}transpose(){return function(t,e){if(t===e){const n=e[1],r=e[2],i=e[3],s=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=s,t[11]=e[14],t[12]=i,t[13]=o,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],h=e[7],l=e[8],u=e[9],d=e[10],f=e[11],m=e[12],p=e[13],g=e[14],A=e[15],y=n*a-r*o,B=n*c-i*o,b=n*h-s*o,C=r*c-i*a,w=r*h-s*a,E=i*h-s*c,v=l*p-u*m,T=l*g-d*m,_=l*A-f*m,x=u*g-d*p,M=u*A-f*p,I=d*A-f*g;let S=y*I-B*M+b*x+C*_-w*T+E*v;S&&(S=1/S,t[0]=(a*I-c*M+h*x)*S,t[1]=(i*M-r*I-s*x)*S,t[2]=(p*E-g*w+A*C)*S,t[3]=(d*w-u*E-f*C)*S,t[4]=(c*_-o*I-h*T)*S,t[5]=(n*I-i*_+s*T)*S,t[6]=(g*b-m*E-A*B)*S,t[7]=(l*E-d*b+f*B)*S,t[8]=(o*M-a*_+h*v)*S,t[9]=(r*_-n*M-s*v)*S,t[10]=(m*w-p*b+A*y)*S,t[11]=(u*b-l*w-f*y)*S,t[12]=(a*T-o*x-c*v)*S,t[13]=(n*x-r*T+i*v)*S,t[14]=(p*B-m*C-g*y)*S,t[15]=(l*C-u*B+d*y)*S)}(this,this),this.check()}multiplyLeft(t){return nn(this,t,this),this.check()}multiplyRight(t){return nn(this,this,t),this.check()}rotateX(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[4],o=e[5],a=e[6],c=e[7],h=e[8],l=e[9],u=e[10],d=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*i+h*r,t[5]=o*i+l*r,t[6]=a*i+u*r,t[7]=c*i+d*r,t[8]=h*i-s*r,t[9]=l*i-o*r,t[10]=u*i-a*r,t[11]=d*i-c*r}(this,this,t),this.check()}rotateY(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[0],o=e[1],a=e[2],c=e[3],h=e[8],l=e[9],u=e[10],d=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i-h*r,t[1]=o*i-l*r,t[2]=a*i-u*r,t[3]=c*i-d*r,t[8]=s*r+h*i,t[9]=o*r+l*i,t[10]=a*r+u*i,t[11]=c*r+d*i}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[0],o=e[1],a=e[2],c=e[3],h=e[4],l=e[5],u=e[6],d=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i+h*r,t[1]=o*i+l*r,t[2]=a*i+u*r,t[3]=c*i+d*r,t[4]=h*i-s*r,t[5]=l*i-o*r,t[6]=u*i-a*r,t[7]=d*i-c*r}(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return function(t,e,n,r){let i,s,o,a,c,h,l,u,d,f,m,p,g,A,y,B,b,C,w,E,v,T,_,x,M=r[0],I=r[1],S=r[2],R=Math.sqrt(M*M+I*I+S*S);R<_e||(R=1/R,M*=R,I*=R,S*=R,s=Math.sin(n),i=Math.cos(n),o=1-i,a=e[0],c=e[1],h=e[2],l=e[3],u=e[4],d=e[5],f=e[6],m=e[7],p=e[8],g=e[9],A=e[10],y=e[11],B=M*M*o+i,b=I*M*o+S*s,C=S*M*o-I*s,w=M*I*o-S*s,E=I*I*o+i,v=S*I*o+M*s,T=M*S*o+I*s,_=I*S*o-M*s,x=S*S*o+i,t[0]=a*B+u*b+p*C,t[1]=c*B+d*b+g*C,t[2]=h*B+f*b+A*C,t[3]=l*B+m*b+y*C,t[4]=a*w+u*E+p*v,t[5]=c*w+d*E+g*v,t[6]=h*w+f*E+A*v,t[7]=l*w+m*E+y*v,t[8]=a*T+u*_+p*x,t[9]=c*T+d*_+g*x,t[10]=h*T+f*_+A*x,t[11]=l*T+m*_+y*x,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return function(t,e,n){const r=n[0],i=n[1],s=n[2];t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return function(t,e,n){const r=n[0],i=n[1],s=n[2];let o,a,c,h,l,u,d,f,m,p,g,A;e===t?(t[12]=e[0]*r+e[4]*i+e[8]*s+e[12],t[13]=e[1]*r+e[5]*i+e[9]*s+e[13],t[14]=e[2]*r+e[6]*i+e[10]*s+e[14],t[15]=e[3]*r+e[7]*i+e[11]*s+e[15]):(o=e[0],a=e[1],c=e[2],h=e[3],l=e[4],u=e[5],d=e[6],f=e[7],m=e[8],p=e[9],g=e[10],A=e[11],t[0]=o,t[1]=a,t[2]=c,t[3]=h,t[4]=l,t[5]=u,t[6]=d,t[7]=f,t[8]=m,t[9]=p,t[10]=g,t[11]=A,t[12]=o*r+l*i+m*s+e[12],t[13]=a*r+u*i+p*s+e[13],t[14]=c*r+d*i+g*s+e[14],t[15]=h*r+f*i+A*s+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*s+n[12]*o,t[1]=n[1]*r+n[5]*i+n[9]*s+n[13]*o,t[2]=n[2]*r+n[6]*i+n[10]*s+n[14]*o,t[3]=n[3]*r+n[7]*i+n[11]*s+n[15]*o,t}(e||[-0,-0,-0,-0],t,this),Ee(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:n}=t;let r;switch(n){case 2:r=Ie(e||[-0,-0],t,this);break;case 3:r=Pe(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(r,t.length),r}transformAsVector(t,e){let n;switch(t.length){case 2:n=Se(e||[-0,-0],t,this);break;case 3:n=Re(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(n,t.length),n}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,n){return this.identity().translate([t,e,n])}}let un,dn;function fn(t){if(t>2*Math.PI)throw Error("expected radians")}function mn(){const t=new xe(4);return xe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function pn(t,e,n){n*=.5;const r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function gn(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=n[0],c=n[1],h=n[2],l=n[3];return t[0]=r*l+o*a+i*h-s*c,t[1]=i*l+o*c+s*a-r*h,t[2]=s*l+o*h+r*c-i*a,t[3]=o*l-r*a-i*c-s*h,t}const An=function(){const t=De(),e=Le(1,0,0),n=Le(0,1,0);return function(r,i,s){const o=Ue(i,s);return o<-.999999?(Ne(t,e,i),je(t)<1e-6&&Ne(t,n,i),function(t,e){const n=e[0],r=e[1],i=e[2];let s=n*n+r*r+i*i;s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s}(t,t),pn(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Ne(t,i,s),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3];let o=n*n+r*r+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=s*o,t}(r,r))}}();mn(),mn(),function(){const t=new xe(9);xe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1}();const yn=[0,0,0,1];class Bn extends Ce{constructor(t=0,e=0,n=0,r=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,n,r)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,n,r){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return function(t,e){const n=e[0]+e[4]+e[8];let r;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{let n=0;e[4]>e[0]&&(n=1),e[8]>e[3*n+n]&&(n=2);const i=(n+1)%3,s=(n+2)%3;r=Math.sqrt(e[3*n+n]-e[3*i+i]-e[3*s+s]+1),t[n]=.5*r,r=.5/r,t[3]=(e[3*i+s]-e[3*s+i])*r,t[i]=(e[3*i+n]+e[3*n+i])*r,t[s]=(e[3*s+n]+e[3*n+s])*r}}(this,t),this.check()}fromAxisRotation(t,e){return pn(this,t,e),this.check()}identity(){return function(t){t[0]=0,t[1]=0,t[2]=0,t[3]=1}(this),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=we(t)}get y(){return this[1]}set y(t){this[1]=we(t)}get z(){return this[2]}set z(t){this[2]=we(t)}get w(){return this[3]}set w(t){this[3]=we(t)}len(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)}(this)}lengthSquared(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}(this)}dot(t){return function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}(this,t)}rotationTo(t,e){return An(this,t,e),this.check()}add(t){return function(t,e,n){t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3]}(this,this,t),this.check()}calculateW(){return function(t,e){const n=e[0],r=e[1],i=e[2];t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i))}(this,this),this.check()}conjugate(){return function(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n*n+r*r+i*i+s*s,a=o?1/o:0;t[0]=-n*a,t[1]=-r*a,t[2]=-i*a,t[3]=s*a}(this,this),this.check()}lerp(t,e,n){return void 0===n?this.lerp(this,t,e):(function(t,e,n,r){const i=e[0],s=e[1],o=e[2],a=e[3];t[0]=i+r*(n[0]-i),t[1]=s+r*(n[1]-s),t[2]=o+r*(n[2]-o),t[3]=a+r*(n[3]-a)}(this,t,e,n),this.check())}multiplyRight(t){return gn(this,this,t),this.check()}multiplyLeft(t){return gn(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c+o*a,t[1]=i*c+s*a,t[2]=s*c-i*a,t[3]=o*c-r*a}(this,this,t),this.check()}rotateY(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c-s*a,t[1]=i*c+o*a,t[2]=s*c+r*a,t[3]=o*c-i*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c+i*a,t[1]=i*c-r*a,t[2]=s*c+o*a,t[3]=o*c-s*a}(this,this,t),this.check()}scale(t){return function(t,e,n){t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n}(this,this,t),this.check()}slerp(t,e,n){let r,i,s;switch(arguments.length){case 1:({start:r=yn,target:i,ratio:s}=t);break;case 2:r=this,i=t,s=e;break;default:r=t,i=e,s=n}return function(t,e,n,r){const i=e[0],s=e[1],o=e[2],a=e[3];let c,h,l,u,d,f=n[0],m=n[1],p=n[2],g=n[3];c=i*f+s*m+o*p+a*g,c<0&&(c=-c,f=-f,m=-m,p=-p,g=-g),1-c>_e?(h=Math.acos(c),d=Math.sin(h),l=Math.sin((1-r)*h)/d,u=Math.sin(r*h)/d):(l=1-r,u=r),t[0]=l*i+u*f,t[1]=l*s+u*m,t[2]=l*o+u*p,t[3]=l*a+u*g}(this,r,i,s),this.check()}transformVector4(t,e=new ze){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=n[0],a=n[1],c=n[2],h=n[3],l=h*r+a*s-c*i,u=h*i+c*r-o*s,d=h*s+o*i-a*r,f=-o*r-a*i-c*s;t[0]=l*h+f*-o+u*-c-d*-a,t[1]=u*h+f*-a+d*-o-l*-c,t[2]=d*h+f*-c+l*-a-u*-o,t[3]=e[3]}(e,t,this),Ee(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}function bn(t){return(bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Cn(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=bn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=bn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==bn(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wn(t){return t}new Qe;const En=new Qe,vn={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Tn={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_n={east:new Qe,north:new Qe,up:new Qe,west:new Qe,south:new Qe,down:new Qe},xn=new Qe,Mn=new Qe,In=new Qe;function Sn(t,e,n,r,i,s){const o=vn[e]&&vn[e][n];let a,c,h;ve(o&&(!r||r===o));const l=En.copy(i);if(Be(l.x,0,1e-14)&&Be(l.y,0,1e-14)){const t=Math.sign(l.z);a=xn.fromArray(Tn[e]),"east"!==e&&"west"!==e&&a.scale(t),c=Mn.fromArray(Tn[n]),"east"!==n&&"west"!==n&&c.scale(t),h=In.fromArray(Tn[r]),"east"!==r&&"west"!==r&&h.scale(t)}else{const{up:i,east:s,north:o}=_n;s.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,i),o.copy(i).cross(s);const{down:u,west:d,south:f}=_n;u.copy(i).scale(-1),d.copy(s).scale(-1),f.copy(o).scale(-1),a=_n[e],c=_n[n],h=_n[r]}return s[0]=a.x,s[1]=a.y,s[2]=a.z,s[3]=0,s[4]=c.x,s[5]=c.y,s[6]=c.z,s[7]=0,s[8]=h.x,s[9]=h.y,s[10]=h.z,s[11]=0,s[12]=l.x,s[13]=l.y,s[14]=l.z,s[15]=1,s}const Rn=new Qe,On=new Qe,Fn=new Qe,Dn=new Qe,Gn=new Qe,Ln=new Qe,Un=new Qe,Nn=new Qe,Pn=new Qe;class Hn{constructor(t=0,e=0,n=0){Cn(this,"radii",void 0),Cn(this,"radiiSquared",void 0),Cn(this,"radiiToTheFourth",void 0),Cn(this,"oneOverRadii",void 0),Cn(this,"oneOverRadiiSquared",void 0),Cn(this,"minimumRadius",void 0),Cn(this,"maximumRadius",void 0),Cn(this,"centerToleranceSquared",.1),Cn(this,"squaredXOverSquaredZ",void 0),ve(t>=0),ve(e>=0),ve(n>=0),this.radii=new Qe(t,e,n),this.radiiSquared=new Qe(t*t,e*e,n*n),this.radiiToTheFourth=new Qe(t*t*t*t,e*e*e*e,n*n*n*n),this.oneOverRadii=new Qe(0===t?0:1/t,0===e?0:1/e,0===n?0:1/n),this.oneOverRadiiSquared=new Qe(0===t?0:1/(t*t),0===e?0:1/(e*e),0===n?0:1/(n*n)),this.minimumRadius=Math.min(t,e,n),this.maximumRadius=Math.max(t,e,n),0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||!(!t||!this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const n=Gn,r=Ln,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,n),r.copy(this.radiiSquared).scale(n);const s=Math.sqrt(n.dot(r));return r.scale(1/s),n.scale(i),r.add(n),r.to(e)}cartesianToCartographic(t,e=[0,0,0]){Pn.from(t);const n=this.scaleToGeodeticSurface(Pn,Un);if(!n)return;const r=this.geodeticSurfaceNormal(n,Gn),i=Nn;return i.copy(Pn).subtract(n),function(t,e){return function(t,e,n=wn){return"longitude"in e?(e.longitude=n(t[0]),e.latitude=n(t[1]),e.height=t[2]):"x"in e?(e.x=n(t[0]),e.y=n(t[1]),e.z=t[2]):(e[0]=n(t[0]),e[1]=n(t[1]),e[2]=t[2]),e}(t,e,de._cartographicRadians?wn:ge)}([Math.atan2(r.y,r.x),Math.asin(r.z),Math.sign(Ue(i,Pn))*Ge(i)],e)}eastNorthUpToFixedFrame(t,e=new ln){return Sn(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,n,r,i=new ln){return Sn(this,t,e,n,r,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return Dn.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const n=function(t,e=[]){return function(t,e=[],n=wn){return"longitude"in t?(e[0]=n(t.longitude),e[1]=n(t.latitude),e[2]=t.height):"x"in t?(e[0]=n(t.x),e[1]=n(t.y),e[2]=t.z):(e[0]=n(t[0]),e[1]=n(t[1]),e[2]=t[2]),e}(t,e,de._cartographicRadians?wn:pe)}(t),r=n[0],i=n[1],s=Math.cos(i);return Dn.set(s*Math.cos(r),s*Math.sin(r),Math.sin(i)).normalize(),Dn.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return Dn.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,n=[]){const{oneOverRadii:r,oneOverRadiiSquared:i,centerToleranceSquared:s}=e;Rn.from(t);const o=Rn.x,a=Rn.y,c=Rn.z,h=r.x,l=r.y,u=r.z,d=o*o*h*h,f=a*a*l*l,m=c*c*u*u,p=d+f+m,g=Math.sqrt(1/p);if(!Number.isFinite(g))return;const A=On;if(A.copy(t).scale(g),p1e-12);return Rn.scale([w,E,v]).to(n)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){Un.from(t);const n=Un.x,r=Un.y,i=Un.z,s=this.oneOverRadiiSquared,o=1/Math.sqrt(n*n*s.x+r*r*s.y+i*i*s.z);return Un.multiplyScalar(o).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return Un.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return Un.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,n=[0,0,0]){ve(Be(this.radii.x,this.radii.y,1e-15)),ve(this.radii.z>0),Un.from(t);const r=Un.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(r)>=this.radii.z-e))return Un.set(0,0,r).to(n)}}Cn(Hn,"WGS84",new Hn(6378137,6378137,6356752.314245179));new Qe,new Qe;const Jn=new Qe,jn=new Qe;class kn{constructor(t=[0,0,0],e=0){Cn(this,"center",void 0),Cn(this,"radius",void 0),this.radius=-0,this.center=new Qe,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=Jn.from(e),this.center=(new Qe).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new kn(this.center,this.radius)}union(t){const e=this.center,n=this.radius,r=t.center,i=t.radius,s=Jn.copy(r).subtract(e),o=s.magnitude();if(n>=o+i)return this.clone();if(i>=o+n)return t.clone();const a=.5*(n+o+i);return jn.copy(s).scale((-n+a)/o).add(e),this.center.copy(jn),this.radius=a,this}expand(t){const e=Jn.from(t).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=function(t,e){const n=e[0],r=e[1],i=e[2],s=e[4],o=e[5],a=e[6],c=e[8],h=e[9],l=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(s*s+o*o+a*a),t[2]=Math.sqrt(c*c+h*h+l*l),t}(Jn,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){const e=this.distanceTo(t);return e*e}distanceTo(t){const e=Jn.from(t).subtract(this.center);return Math.max(0,e.len()-this.radius)}intersectPlane(t){const e=this.center,n=this.radius,r=t.normal.dot(e)+t.distance;return r<-n?-1:r=a?1:0}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=Kn.from(t).subtract(this.center),n=this.halfAxes,r=n.getColumn(0,Qn),i=n.getColumn(1,zn),s=n.getColumn(2,qn),o=r.magnitude(),a=i.magnitude(),c=s.magnitude();r.normalize(),i.normalize(),s.normalize();let h,l=0;return h=Math.abs(e.dot(r))-o,h>0&&(l+=h*h),h=Math.abs(e.dot(i))-a,h>0&&(l+=h*h),h=Math.abs(e.dot(s))-c,h>0&&(l+=h*h),l}computePlaneDistances(t,e,n=[-0,-0]){let r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const s=this.center,o=this.halfAxes,a=o.getColumn(0,Qn),c=o.getColumn(1,zn),h=o.getColumn(2,qn),l=Wn.copy(a).add(c).add(h).add(s),u=Yn.copy(l).subtract(t);let d=e.dot(u);return r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).add(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).subtract(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).subtract(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).add(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).add(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).subtract(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).subtract(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),n[0]=r,n[1]=i,n}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,Qn);e.transformAsPoint(t);const n=this.halfAxes.getColumn(1,zn);n.transformAsPoint(t);const r=this.halfAxes.getColumn(2,qn);return r.transformAsPoint(t),this.halfAxes=new $e([...e,...n,...r]),this}getTransform(){throw new Error("not implemented")}}const Zn=new Qe,$n=new Qe;class tr{constructor(t=[0,0,1],e=0){Cn(this,"normal",void 0),Cn(this,"distance",void 0),this.normal=new Qe,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return ve(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=Zn.from(t),this.normal.from(e).normalize();const n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,e,n,r){return this.normal.set(t,e,n),ve(Be(this.normal.len(),1)),this.distance=r,this}clone(){return new tr(this.normal,this.distance)}equals(t){return Be(this.distance,t.distance)&&Be(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=$n.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,e)}projectPointOntoPlane(t,e=[0,0,0]){const n=Zn.from(t),r=this.getPointDistance(n),i=$n.copy(this.normal).scale(r);return n.subtract(i).to(e)}}const er=[new Qe([1,0,0]),new Qe([0,1,0]),new Qe([0,0,1])],nr=new Qe,rr=new Qe;class ir{constructor(t=[]){Cn(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*er.length;const e=t.center,n=t.radius;let r=0;for(const t of er){let i=this.planes[r],s=this.planes[r+1];i||(i=this.planes[r]=new tr),s||(s=this.planes[r+1]=new tr);const o=nr.copy(t).scale(-n).add(e);i.fromPointNormal(o,t);const a=nr.copy(t).scale(n).add(e),c=rr.copy(t).negate();s.fromPointNormal(a,c),r+=2}return this}computeVisibility(t){let e=1;for(const n of this.planes)switch(t.intersectPlane(n)){case-1:return-1;case 0:e=0}return e}computeVisibilityWithPlaneMask(t,e){if(ve(Number.isFinite(e),"parentPlaneMask is required."),e===ir.MASK_OUTSIDE||e===ir.MASK_INSIDE)return e;let n=ir.MASK_INSIDE;const r=this.planes;for(let i=0;i0),ve(e>0),ve(n>0),ve(r);const i=1/this.near;let s=this.top*i;const o=2*n*s/e;s=this.right*i;const a=2*n*s/t;return r.x=a,r.y=o,r}_update(){ve(Number.isFinite(this.right)&&Number.isFinite(this.left)&&Number.isFinite(this.top)&&Number.isFinite(this.bottom)&&Number.isFinite(this.near)&&Number.isFinite(this.far));const{top:t,bottom:e,right:n,left:r,near:i,far:s}=this;(t!==this._top||e!==this._bottom||r!==this._left||n!==this._right||i!==this._near||s!==this._far)&&(ve(this.near>0&&this.nearnull!==t&&typeof t<"u")(t)&&t instanceof ur)&&(this._update(),t._update(),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this.near===t.near&&this.far===t.far&&this._offCenterFrustum.equals(t._offCenterFrustum))}get projectionMatrix(){return this._update(),this._offCenterFrustum.projectionMatrix}get infiniteProjectionMatrix(){return this._update(),this._offCenterFrustum.infiniteProjectionMatrix}get fovy(){return this._update(),this._fovy}get sseDenominator(){return this._update(),this._sseDenominator}computeCullingVolume(t,e,n){return this._update(),this._offCenterFrustum.computeCullingVolume(t,e,n)}getPixelDimensions(t,e,n,r){return this._update(),this._offCenterFrustum.getPixelDimensions(t,e,n,r||new Fe)}_update(){ve(Number.isFinite(this.fov)&&Number.isFinite(this.aspectRatio)&&Number.isFinite(this.near)&&Number.isFinite(this.far));const t=this._offCenterFrustum;(this.fov!==this._fov||this.aspectRatio!==this._aspectRatio||this.near!==this._near||this.far!==this._far||this.xOffset!==this._xOffset||this.yOffset!==this._yOffset)&&(ve(this.fov>=0&&this.fov0),ve(this.near>=0&&this.nearn&&(r=e,n=i)}const i=Ar[r],s=yr[r];let o=1,a=0;if(Math.abs(t[dr.getElementIndex(s,i)])>1e-15){const e=(t[dr.getElementIndex(s,s)]-t[dr.getElementIndex(i,i)])/2/t[dr.getElementIndex(s,i)];let n;n=e<0?-1/(-e+Math.sqrt(1+e*e)):1/(e+Math.sqrt(1+e*e)),o=1/Math.sqrt(1+n*n),a=n*o}return $e.IDENTITY.to(e),e[dr.getElementIndex(i,i)]=e[dr.getElementIndex(s,s)]=o,e[dr.getElementIndex(s,i)]=a,e[dr.getElementIndex(i,s)]=-a,e}const Cr=new Qe,wr=new Qe,Er=new Qe,vr=new Qe,Tr=new Qe,_r=new $e,xr={diagonal:new $e,unitary:new $e};let Mr=function(t){return t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE",t}({}),Ir=function(t){return t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh",t}({}),Sr=function(t){return t.I3S="I3S",t.TILES3D="TILES3D",t}({}),Rr=function(t){return t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold",t}({});const Or="4.1.1",Fr="cmpt",Dr="pnts",Gr="b3dm",Lr="i3dm",Ur="glTF";function Nr(t,e,n){o(t instanceof ArrayBuffer);const r=new TextDecoder("utf8"),i=new Uint8Array(t,e,n);return r.decode(i)}function Pr(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=new DataView(t);return`${String.fromCharCode(n.getUint8(e+0))}${String.fromCharCode(n.getUint8(e+1))}${String.fromCharCode(n.getUint8(e+2))}${String.fromCharCode(n.getUint8(e+3))}`}const Hr={name:"Draco",id:"draco",module:"draco",version:"4.1.1",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Jr(t,e,n){return function(t,e,n){const r=function(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}(e.value),i=n||function(t){const e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:r}]},nullable:!1,metadata:i}}(t,e,n?jr(n.metadata):void 0)}function jr(t){Object.entries(t);const e={};for(const n in t)e[`${n}.string`]=JSON.stringify(t[n]);return e}const kr={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Vr={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Kr{constructor(t){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new this.draco.DecoderBuffer;n.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);const r=this.decoder.GetEncodedGeometryType(n),i=r===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let t;switch(r){case this.draco.TRIANGULAR_MESH:t=this.decoder.DecodeBufferToMesh(n,i);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(n,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!i.ptr){const e=`DRACO decompression failed: ${t.error_msg()}`;throw new Error(e)}const s=this._getDracoLoaderData(i,r,e),o=this._getMeshData(i,s,e),a=function(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;const a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let t=0;ti?c:i,s=h>s?h:s,o=l>o?l:o}return[[e,n,r],[i,s,o]]}(o.attributes),c=function(t,e,n){const r=jr(e.metadata),i=[],s=function(t){const e={};for(const n in t){const r=t[n];e[r.name||"undefined"]=r}return e}(e.attributes);for(const e in t){const n=Jr(e,t[e],s[e]);i.push(n)}if(n){const t=Jr("indices",n);i.push(t)}return{fields:i,metadata:r}}(o.attributes,s,o.indices);return{loader:"draco",loaderData:s,header:{vertexCount:i.num_points(),boundingBox:a},...o,schema:c}}finally{this.draco.destroy(n),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,e,n){const r=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,n);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:r,attributes:i}}_getDracoAttributes(t,e){const n={};for(let r=0;rthis.decoder[t])).includes(r)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits(),range:e.range(),min_values:new Float32Array([1,2,3]).map((t=>e.min_value(t)))}}finally{this.draco.destroy(e)}}return null}_getOctahedronTransform(t,e){const{octahedronAttributes:n=[]}=e,r=t.attribute_type();if(n.map((t=>this.decoder[t])).includes(r)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits()}}finally{this.draco.destroy(e)}}return null}}const Qr="https://www.gstatic.com/draco/versioned/decoders/1.5.6",zr="draco_wasm_wrapper.js",qr="draco_decoder.wasm",Wr="draco_decoder.js",Yr="draco_encoder.js",Xr={[zr]:`${Qr}/${zr}`,[qr]:`${Qr}/draco_decoder.wasm`,[Wr]:`${Qr}/draco_decoder.js`,[Yr]:`https://raw.githubusercontent.com/google/draco/1.4.1/javascript/${Yr}`};let Zr;const $r={...Hr,parse:async function(t,e){const{draco:n}=await async function(t){const e=t.modules||{};return Zr=e.draco3d?Zr||e.draco3d.createDecoderModule({}).then((t=>({draco:t}))):Zr||async function(t){let e,n;return"js"===(t.draco&&t.draco.decoderType)?e=await O(Xr["draco_decoder.js"],"draco",t,Wr):[e,n]=await Promise.all([await O(Xr[zr],"draco",t,zr),await O(Xr[qr],"draco",t,qr)]),e=e||globalThis.DracoDecoderModule,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t({...n,onModuleLoaded:t=>e({draco:t})})}))}(e,n)}(t),await Zr}(e),r=new Kr(n);try{return r.parseSync(t,null==e?void 0:e.draco)}finally{r.destroy()}}},ti={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},ei={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...ti},ni={[ti.DOUBLE]:Float64Array,[ti.FLOAT]:Float32Array,[ti.UNSIGNED_SHORT]:Uint16Array,[ti.UNSIGNED_INT]:Uint32Array,[ti.UNSIGNED_BYTE]:Uint8Array,[ti.BYTE]:Int8Array,[ti.SHORT]:Int16Array,[ti.INT]:Int32Array},ri={DOUBLE:ti.DOUBLE,FLOAT:ti.FLOAT,UNSIGNED_SHORT:ti.UNSIGNED_SHORT,UNSIGNED_INT:ti.UNSIGNED_INT,UNSIGNED_BYTE:ti.UNSIGNED_BYTE,BYTE:ti.BYTE,SHORT:ti.SHORT,INT:ti.INT},ii="Failed to convert GL type";class si{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(const e in ni)if(ni[e]===t)return e;throw new Error(ii)}static fromName(t){const e=ri[t];if(!e)throw new Error(ii);return e}static getArrayType(t){switch(t){case ti.UNSIGNED_SHORT_5_6_5:case ti.UNSIGNED_SHORT_4_4_4_4:case ti.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const e=ni[t];if(!e)throw new Error(ii);return e}}static getByteSize(t){return si.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return!!si.getArrayType(t)}static createTypedArray(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;return void 0===r&&(r=(e.byteLength-n)/si.getByteSize(t)),new(si.getArrayType(t))(e,n,r)}}function oi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];const n=t>>11&31,r=t>>5&63,i=31&t;return e[0]=n<<3,e[1]=r<<2,e[2]=i<<3,e}function ai(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:255;return ye(t,0,e)/e*2-1}function ci(t){return t<0?-1:1}function hi(t,e,n){return function(t,e,n,r){if(function(t,e){if(!t)throw new Error("math.gl assertion failed. undefined")}(r),t<0||t>n||e<0||e>n)throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);if(r.x=ai(t,n),r.y=ai(e,n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){const t=r.x;r.x=(1-Math.abs(r.y))*ci(t),r.y=(1-Math.abs(t))*ci(r.y)}return r.normalize()}(t,e,255,n)}new Fe,new Qe,new Fe,new Fe;class li{constructor(t,e){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=t,this.buffer=e}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return!!this.json[t]}getGlobalProperty(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ei.UNSIGNED_INT,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const r=this.json[t];return r&&Number.isFinite(r.byteOffset)?this._getTypedArrayFromBinary(t,e,n,1,r.byteOffset):r}getPropertyArray(t,e,n){const r=this.json[t];return r&&Number.isFinite(r.byteOffset)?("componentType"in r&&(e=si.fromName(r.componentType)),this._getTypedArrayFromBinary(t,e,n,this.featuresLength,r.byteOffset)):this._getTypedArrayFromArray(t,e,r)}getProperty(t,e,n,r,i){const s=this.json[t];if(!s)return s;const o=this.getPropertyArray(t,e,n);if(1===n)return o[r];for(let t=0;tt[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},fi={SCALAR:(t,e,n)=>{e[n]=t},VEC2:(t,e,n)=>{e[2*n+0]=t[0],e[2*n+1]=t[1]},VEC3:(t,e,n)=>{e[3*n+0]=t[0],e[3*n+1]=t[1],e[3*n+2]=t[2]},VEC4:(t,e,n)=>{e[4*n+0]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]},MAT2:(t,e,n)=>{e[4*n+0]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]},MAT3:(t,e,n)=>{e[9*n+0]=t[0],e[9*n+1]=t[1],e[9*n+2]=t[2],e[9*n+3]=t[3],e[9*n+4]=t[4],e[9*n+5]=t[5],e[9*n+6]=t[6],e[9*n+7]=t[7],e[9*n+8]=t[8],e[9*n+9]=t[9]},MAT4:(t,e,n)=>{e[16*n+0]=t[0],e[16*n+1]=t[1],e[16*n+2]=t[2],e[16*n+3]=t[3],e[16*n+4]=t[4],e[16*n+5]=t[5],e[16*n+6]=t[6],e[16*n+7]=t[7],e[16*n+8]=t[8],e[16*n+9]=t[9],e[16*n+10]=t[10],e[16*n+11]=t[11],e[16*n+12]=t[12],e[16*n+13]=t[13],e[16*n+14]=t[14],e[16*n+15]=t[15]}},mi=t=>void 0!==t;function pi(t,e,n){if(!t)return;const r=t.parentCounts;return t.parentIds?n(t,e):r>0?function(t,e,n){const r=t.classIds,i=t.parentCounts,s=t.parentIds,o=t.parentIndexes,a=r.length,c=scratchVisited;c.length=Math.max(c.length,a);const h=++marker,l=scratchStack;for(l.length=0,l.push(e);l.length>0;){if(c[e=l.pop()]===h)continue;c[e]=h;const r=n(t,e);if(mi(r))return r;const a=i[e],u=o[e];for(let t=0;tt,Bi={HIERARCHY:!0,extensions:!0,extras:!0};class bi{constructor(t,e,n){var r;let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,o(n>=0),this.json=t||{},this.binary=e,this.featureCount=n,this._extensions=(null===(r=this.json)||void 0===r?void 0:r.extensions)||{},this._properties={};for(const t in this.json)Bi[t]||(this._properties[t]=this.json[t]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=function(t,e,n){if(!e)return null;let r=t.getExtension("3DTILES_batch_table_hierarchy");const i=e.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=i,r=i),r?function(t,e){let n,r,i;const s=t.instancesLength,o=t.classes;let a,c=t.classIds,h=t.parentCounts,l=t.parentIds,u=s;if(mi(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,s)),mi(h))for(mi(h.byteOffset)&&(h.componentType=defaultValue(h.componentType,GL.UNSIGNED_SHORT),h.type=AttributeType.SCALAR,i=getBinaryAccessor(h),h=i.createArrayBufferView(e.buffer,e.byteOffset+h.byteOffset,s)),a=new Uint16Array(s),u=0,n=0;n{const r=t.classIds[n];return t.classes[r].name===e})))}isExactClass(t,e){return o("string"==typeof e,e),this.getExactClassName(t)===e}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){const e=this._hierarchy.classIds[t];return this._hierarchy.classes[e].name}}hasProperty(t,e){return this._checkBatchId(t),o("string"==typeof e,e),Ai(this._properties[e])||this._hasPropertyInHierarchy(t,e)}getPropertyNames(t,e){this._checkBatchId(t),(e=Ai(e)?e:[]).length=0;const n=Object.keys(this._properties);return e.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(t,e),e}getProperty(t,e){if(this._checkBatchId(t),o("string"==typeof e,e),this._binaryProperties){const n=this._binaryProperties[e];if(Ai(n))return this._getBinaryProperty(n,t)}const n=this._properties[e];if(Ai(n))return yi(n[t]);if(this._hierarchy){const n=this._getHierarchyProperty(t,e);if(Ai(n))return n}}setProperty(t,e,n){const r=this.featureCount;if(this._checkBatchId(t),o("string"==typeof e,e),this._binaryProperties){const r=this._binaryProperties[e];if(r)return void this._setBinaryProperty(r,t,n)}if(this._hierarchy&&this._setHierarchyProperty(this,t,e,n))return;let i=this._properties[e];Ai(i)||(this._properties[e]=new Array(r),i=this._properties[e]),i[t]=yi(n)}_checkBatchId(t){if(!(t>=0&&t{const r=t.classIds[n];return Ai(t.classes[r].instances[e])}));return Ai(n)}_getPropertyNamesInHierarchy(t,e){pi(this._hierarchy,t,((t,n)=>{const r=t.classIds[n],i=t.classes[r].instances;for(const t in i)i.hasOwnProperty(t)&&-1===e.indexOf(t)&&e.push(t)}))}_getHierarchyProperty(t,e){return pi(this._hierarchy,t,((t,n)=>{const r=t.classIds[n],i=t.classes[r],s=t.classIndexes[n],o=i.instances[e];return Ai(o)?Ai(o.typedArray)?this._getBinaryProperty(o,s):yi(o[s]):null}))}_setHierarchyProperty(t,e,n,r){const i=pi(this._hierarchy,e,((t,i)=>{const s=t.classIds[i],a=t.classes[s],c=t.classIndexes[i],h=a.instances[n];return!!Ai(h)&&(o(i===e,`Inherited property "${n}" is read-only.`),Ai(h.typedArray)?this._setBinaryProperty(h,c,r):h[c]=yi(r),!0)}));return Ai(i)}}function Ci(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=new DataView(e);if(t.magic=r.getUint32(n,!0),n+=4,t.version=r.getUint32(n,!0),n+=4,t.byteLength=r.getUint32(n,!0),n+=4,1!==t.version)throw new Error(`3D Tile Version ${t.version} not supported`);return n}const wi="b3dm tile in legacy format.";function Ei(t,e,n){const r=new DataView(e);let i;t.header=t.header||{};let s=r.getUint32(n,!0);n+=4;let o=r.getUint32(n,!0);n+=4;let a=r.getUint32(n,!0);n+=4;let c=r.getUint32(n,!0);return n+=4,a>=570425344?(n-=8,i=s,a=o,c=0,s=0,o=0,console.warn(wi)):c>=570425344&&(n-=4,i=a,a=s,c=o,s=0,o=0,console.warn(wi)),t.header.featureTableJsonByteLength=s,t.header.featureTableBinaryByteLength=o,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=i,n}function vi(t,e,n,r){return n=function(t,e,n,r){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:s,batchLength:o}=t.header||{};if(t.featureTableJson={BATCH_LENGTH:o||0},i&&i>0){const r=Nr(e,n,i);t.featureTableJson=JSON.parse(r)}return n+=i||0,t.featureTableBinary=new Uint8Array(e,n,s),n+(s||0)}(t,e,n),n=function(t,e,n,r){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:s}=t.header||{};if(i&&i>0){const r=Nr(e,n,i);t.batchTableJson=JSON.parse(r),n+=i,s&&s>0&&(t.batchTableBinary=new Uint8Array(e,n,s),t.batchTableBinary=new Uint8Array(t.batchTableBinary),n+=s)}return n}(t,e,n),n}function Ti(t,e,n){if(!(e||t&&t.batchIds&&n))return null;const{batchIds:r,isRGB565:i,pointCount:s=0}=t;if(r&&n){const t=new Uint8ClampedArray(3*s);for(let e=0;e255*t));t[3*e]=s[0],t[3*e+1]=s[1],t[3*e+2]=s[2]}return{type:ei.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}if(e&&i){const t=new Uint8ClampedArray(3*s);for(let n=0;n{try{n.onload=()=>t(n),n.onerror=t=>{const n=t instanceof Error?t.message:"error";e(new Error(n))}}catch(t){e(t)}}))}(s||r,e)}finally{s&&i.revokeObjectURL(s)}}const Pi={};let Hi=!0;function Ji(t){for(const e in t||Pi)return!1;return!0}function ji(t){return[...t].map((t=>t.charCodeAt(0)))}const ki=!1,Vi=!0;function Ki(t){const e=Qi(t);return function(t){const e=Qi(t);return e.byteLength>=24&&2303741511===e.getUint32(0,ki)?{mimeType:"image/png",width:e.getUint32(16,ki),height:e.getUint32(20,ki)}:null}(e)||function(t){const e=Qi(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,ki)&&255===e.getUint8(2)))return null;const{tableMarkers:n,sofMarkers:r}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)t.add(e);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}();let i=2;for(;i+9=10&&1195984440===e.getUint32(0,ki)?{mimeType:"image/gif",width:e.getUint16(6,Vi),height:e.getUint16(8,Vi)}:null}(e)||function(t){const e=Qi(t);return e.byteLength>=14&&16973===e.getUint16(0,ki)&&e.getUint32(2,Vi)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Vi),height:e.getUint32(22,Vi)}:null}(e)||function(t){const e=function(t){return function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=ji(e);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:null;if((Ji(e)||!Hi)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),Hi=!1}return await createImageBitmap(t)}(r,i)}(t,e,i);break;case"image":a=await Ni(t,e,i);break;case"data":a=await async function(t,e){var n;const{mimeType:r}=Ki(t)||{},i=null===(n=globalThis.loaders)||void 0===n?void 0:n.parseImageNode;return o(i),await i(t,r)}(t);break;default:o(!1)}return"data"===r&&(a=Fi(a)),a},tests:[t=>!!Ki(new DataView(t))],options:{image:{type:"auto",decode:!0}}},qi={};function Wi(t,e){if(!t)throw new Error(e||"assert failed: gltf")}const Yi={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Xi={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Zi=["SCALAR","VEC2","VEC3","VEC4"],$i=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],ts=new Map($i),es={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ns={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},rs={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function is(t){return Zi[t-1]||Zi[0]}function ss(t){const e=ts.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function os(t,e){const n=rs[t.componentType],r=es[t.type],i=ns[t.componentType],s=t.count*r,o=t.count*r*i;return Wi(o>=0&&o<=e.byteLength),{ArrayType:n,length:s,byteLength:o,componentByteSize:Xi[t.componentType],numberOfComponentsInElement:Yi[t.type]}}function as(t){let{images:e,bufferViews:n}=t;e=e||[],n=n||[];const r=e.map((t=>t.bufferView));n=n.filter((t=>!r.includes(t)));const i=n.reduce(((t,e)=>t+e.byteLength),0),s=e.reduce(((t,e)=>{const{width:n,height:r}=e.image;return t+n*r}),0);return i+Math.ceil(4*s*1.33)}class cs{constructor(t){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:(null==t?void 0:t.json)||{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]},buffers:(null==t?void 0:t.buffers)||[],images:(null==t?void 0:t.images)||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){const e=this.getUsedExtensions().find((e=>e===t)),n=this.getRequiredExtensions().find((e=>e===t));return"string"==typeof e||"string"==typeof n}getExtension(t){const e=this.getUsedExtensions().find((e=>e===t)),n=this.json.extensions||{};return e?n[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find((e=>e===t))?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,e){return(t.extensions||{})[e]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,e){if("object"==typeof e)return e;const n=this.json[t]&&this.json[t][e];if(!n)throw new Error(`glTF file error: Could not find ${t}[${e}]`);return n}getTypedArrayForBufferView(t){const e=(t=this.getBufferView(t)).buffer,n=this.gltf.buffers[e];Wi(n);const r=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,r,t.byteLength)}getTypedArrayForAccessor(t){const e=this.getAccessor(t);return function(t,e,n){var r,i;const s="number"==typeof n?null===(r=t.accessors)||void 0===r?void 0:r[n]:n;if(!s)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);const o=null===(i=t.bufferViews)||void 0===i?void 0:i[s.bufferView||0];if(!o)throw new Error(`No gltf buffer view for accessor ${o}`);const{arrayBuffer:a,byteOffset:c}=e[o.buffer],h=(c||0)+(s.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:u,componentByteSize:d,numberOfComponentsInElement:f}=os(s,o),m=d*f,p=o.byteStride||m;if(typeof o.byteStride>"u"||o.byteStride===m)return new l(a,h,u);const g=new l(u);for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:{};return Wi(e),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=e,this.registerUsedExtension(t),e}addRequiredExtension(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Wi(e),this.addExtension(t,e),this.registerRequiredExtension(t),e}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((e=>e===t))||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((e=>e===t))||this.json.extensionsRequired.push(t)}removeExtension(t){var e;if(null!==(e=this.json.extensions)&&void 0!==e&&e[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];const e=this.json.extensionsRemoved;e.includes(t)||e.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){const{nodeIndices:e}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:e}),this.json.scenes.length-1}addNode(t){const{meshIndex:e,matrix:n}=t;this.json.nodes=this.json.nodes||[];const r={mesh:e};return n&&(r.matrix=n),this.json.nodes.push(r),this.json.nodes.length-1}addMesh(t){const{attributes:e,indices:n,material:r,mode:i=4}=t,s={primitives:[{attributes:this._addAttributes(e),mode:i}]};if(n){const t=this._addIndices(n);s.primitives[0].indices=t}return Number.isFinite(r)&&(s.primitives[0].material=r),this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(t){const e={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(e),this.json.meshes.length-1}addImage(t,e){const n=Ki(t),r=e||(null==n?void 0:n.mimeType),i={bufferView:this.addBufferView(t),mimeType:r};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.byteLength;const r=t.byteLength;Wi(Number.isFinite(r)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);const i={buffer:e,byteOffset:n,byteLength:r};return this.byteLength+=H(r,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,e){const n={bufferView:t,type:is(e.size),componentType:e.componentType,count:e.count,max:e.max,min:e.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{size:3};const n=this.addBufferView(t);let r={min:e.min,max:e.max};(!r.min||!r.max)&&(r=this._getAccessorMinMax(t,e.size));const i={size:e.size,componentType:ss(t),count:Math.round(t.length/e.size),min:r.min,max:r.max};return this.addAccessor(n,Object.assign(i,e))}addTexture(t){const{imageIndex:e}=t,n={source:e};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,e;this.gltf.buffers=[];const n=this.byteLength,r=new ArrayBuffer(n),i=new Uint8Array(r);let s=0;for(const t of this.sourceBuffers||[])s=J(t,i,s);null!==(t=this.json)&&void 0!==t&&null!==(e=t.buffers)&&void 0!==e&&e[0]?this.json.buffers[0].byteLength=n:this.json.buffers=[{byteLength:n}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(t,e){let n=!0;for(;n;){const r=t.indexOf(e);r>-1?t.splice(r,1):n=!1}}_addAttributes(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={};for(const n in t){const r=t[n],i=this._getGltfAttributeName(n),s=this.addBinaryBuffer(r.value,r);e[i]=s}return e}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,e){const n={min:null,max:null};if(t.length3&&void 0!==arguments[3]?arguments[3]:1;const i=ls[e],s=us[n],o=ds[n],a=r*i,c=a*o;let h=t.buffer,l=t.byteOffset;return l%o!=0&&(h=new Uint8Array(h).slice(l,l+c).buffer,l=0),new s(h,l,a)}function gs(t,e,n){var r,i;const s=`TEXCOORD_${e.texCoord||0}`,o=n.attributes[s],a=t.getTypedArrayForAccessor(o),c=t.gltf.json,h=e.index,l=null===(r=c.textures)||void 0===r||null===(i=r[h])||void 0===i?void 0:i.source;if(typeof l<"u"){var u,d,f;const n=null===(u=c.images)||void 0===u||null===(d=u[l])||void 0===d?void 0:d.mimeType,r=null===(f=t.gltf.images)||void 0===f?void 0:f[l];if(r&&typeof r.width<"u"){const t=[];for(let i=0;ie===t));-1===e&&(e=r.push(t)-1),s.push(e)}const o=new Uint32Array(s),a=t.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,c=t.addBufferView(o,a,0),h=t.addAccessor(c,{size:1,componentType:ss(o),count:o.length});i.attributes[e]=h}function ys(t,e,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[0];const s={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],a=n[r+1];let c=1;e&&(-1!==e.indexOf("image/jpeg")||-1!==e.indexOf("image/png"))&&(c=4);const h=Bs(o,a,t,c);let l=0;for(const e of i){const n="number"==typeof e?Object.values(s)[e]:s[e],r=h+n.offset,i=Fi(t);if(i.data.length<=r)throw new Error(`${i.data.length} <= ${r}`);l|=i.data[r]<3&&void 0!==arguments[3]?arguments[3]:1;const i=n.width,s=hs(t)*(i-1),o=Math.round(s),a=n.height,c=hs(e)*(a-1),h=Math.round(c),l=n.components?n.components:r;return(h*i+o)*l}function bs(t,e,n,r,i){const s=[];for(let o=0;or)break;const c=e/i,h=a/i;s.push(t.slice(c,c+h))}return s}function Cs(t,e,n){const r=[];for(let i=0;i"u"&&typeof n.arrayOffsets<"u"?ms(t,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}(t,n,i,r),h=function(t,e,n){return typeof e.stringOffsets<"u"?ms(t,e.stringOffsets,e.stringOffsetType||"UINT32",n):null}(t,i,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":s=function(t,e,n,r){const i=t.array,s=t.count,o=fs(t.type,t.componentType),a=n.byteLength/o;let c;return c=t.componentType?ps(n,t.type,t.componentType,a):n,i?r?bs(c,e,r,n.length,o):s?Cs(c,e,s):[]:c}(n,r,a,c);break;case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":s=ws(r,a,c,h);break;case"ENUM":s=function(t,e,n,r,i){var s;const o=e.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");const a=null===(s=t.enums)||void 0===s?void 0:s[o];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);const c=a.valueType||"UINT16",h=fs(e.type,c),l=r.byteLength/h;let u=ps(r,e.type,c,l);if(u||(u=r),e.array){if(i)return function(t){const{valuesData:e,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:i,elementSize:s,enumEntry:o}=t,a=[];for(let t=0;ti)break;const h=Rs(e,n/s,c/s,o);a.push(h)}return a}({valuesData:u,numberOfElements:n,arrayOffsets:i,valuesDataBytesLength:r.length,elementSize:h,enumEntry:a});const t=e.count;return t?function(t,e,n,r){const i=[];for(let s=0;s"u"&&typeof n.arrayOffsetBufferView<"u"?ms(t,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}(t,n,i,r),h=function(t,e,n,r){return typeof n.stringOffsetBufferView<"u"?ms(t,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}(t,0,i,r);return"STRING"===n.type||"STRING"===n.componentType?s=ws(r,a,c,h):function(t){const e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(t.type)||typeof t.componentType<"u"&&e.includes(t.componentType)}(n)&&(s=function(t,e,n,r){const i="ARRAY"===t.type,s=t.componentCount,o="SCALAR",a=t.componentType||t.type,c=fs(o,a),h=ps(n,o,a,n.byteLength/c);return i?r?bs(h,e,r,n.length,c):s?Cs(h,e,s):[]:h}(n,r,a,c)),s}function Ps(t,e,n){const r=t.gltf.json;if(!r.meshes)return[];const i=[];for(const s of r.meshes)for(const r of s.primitives)Hs(t,n,e,i,r);return i}function Hs(t,e,n,r,i){const s=gs(t,{channels:n.channels,...n.texture},i);s&&As(t,e,s,r,i)}const Js=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e){!function(t,e){var n,r;if(null===(n=e.gltf)||void 0===n||!n.loadBuffers)return;const i=t.getExtension("EXT_feature_metadata");i&&(null!==(r=e.gltf)&&void 0!==r&&r.loadImages&&function(t,e){const n=e.schema;if(!n)return;const r=n.classes,{featureTextures:i}=e;if(r&&i)for(const e in r){const n=r[e],s=Gs(i,e);s&&Us(t,s,n)}}(t,i),function(t,e){const n=e.schema;if(!n)return;const r=n.classes,i=e.featureTables;if(r&&i)for(const e in r){const r=Ds(i,e);r&&Ls(t,n,r)}}(t,i))}(new cs(t),e)},name:"EXT_feature_metadata"},Symbol.toStringTag,{value:"Module"}));let js,ks;async function Vs(t){const e=t.modules||{};return e.basis?e.basis:(js=js||async function(t){let e=null,n=null;return[e,n]=await Promise.all([await O("basis_transcoder.js","textures",t),await O("basis_transcoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t(n).then((t=>{const{BasisFile:n,initializeBasis:r}=t;r(),e({BasisFile:n})}))}))}(e,n)}(t),await js)}async function Ks(t){const e=t.modules||{};return e.basisEncoder?e.basisEncoder:(ks=ks||async function(t){let e=null,n=null;return[e,n]=await Promise.all([await O("basis_encoder.js","textures",t),await O("basis_encoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t(n).then((t=>{const{BasisFile:n,KTX2File:r,initializeBasis:i,BasisEncoder:s}=t;i(),e({BasisFile:n,KTX2File:r,BasisEncoder:s})}))}))}(e,n)}(t),await ks)}const Qs=["","WEBKIT_","MOZ_"],zs={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"};let qs=null;var Ws,Ys,Xs,Zs,$s,to,eo,no;(function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB"})(Ws||(Ws={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(Ys||(Ys={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(Xs||(Xs={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(Zs||(Zs={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}($s||($s={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(to||(to={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(eo||(eo={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(no||(no={}));const ro=[171,75,84,88,32,50,48,187,13,10,26,10],io={etc1:{basisFormat:0,compressed:!0,format:36196},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:33776},bc3:{basisFormat:3,compressed:!0,format:33779},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:35840},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:35842},"astc-4x4":{basisFormat:10,compressed:!0,format:37808},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};function so(t,e,n){const r=new t(new Uint8Array(e));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");const t=r.getNumImages(),e=[];for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}function go(t,e,n){o(t.header.byteLength>20);const r=e.getUint32(n+0,fo),i=e.getUint32(n+4,fo);return n+=8,o(0===i),yo(t,e,n,r),(n+=r)+Bo(t,e,n,t.header.byteLength)}function Ao(t,e,n,r){return o(t.header.byteLength>20),function(t,e,n,r){for(;n+8<=t.header.byteLength;){const i=e.getUint32(n+0,fo),s=e.getUint32(n+4,fo);switch(n+=8,s){case 1313821514:yo(t,e,n,i);break;case 5130562:Bo(t,e,n,i);break;case 0:r.strict||yo(t,e,n,i);break;case 1:r.strict||Bo(t,e,n,i)}n+=H(i,4)}}(t,e,n,r),n+t.header.byteLength}function yo(t,e,n,r){const i=new Uint8Array(e.buffer,n,r),s=new TextDecoder("utf8").decode(i);return t.json=JSON.parse(s),H(r,4)}function Bo(t,e,n,r){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:e.buffer}),H(r,4)}function bo(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;const n=e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return n.substr(0,n.lastIndexOf("/")+1)+t}const Co=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),wo=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),Eo={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},vo={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};let To;async function _o(){return To||(To=async function(){let t="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";WebAssembly.validate(Co)&&(t="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",console.log("Warning: meshopt_decoder is using experimental SIMD support"));const e=await WebAssembly.instantiate(function(t){const e=new Uint8Array(t.length);for(let n=0;n96?r-71:r>64?r-65:r>47?r+4:r>46?63:62}let n=0;for(let r=0;r5&&void 0!==arguments[5]?arguments[5]:"NONE";const o=await _o();xo(o,o.exports[vo[i]],t,e,n,r,o.exports[Eo[s||"NONE"]])}(d,o,s,u,a,c),t.removeObjectExtension(e,Mo)}}const So=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e){var n,r;const i=new cs(t);if(null==e||null===(n=e.gltf)||void 0===n||!n.decompressMeshes||null===(r=e.gltf)||void 0===r||!r.loadBuffers)return;const s=[];for(const e of t.json.bufferViews||[])s.push(Io(i,e));await Promise.all(s),i.removeExtension(Mo)},name:"EXT_meshopt_compression"},Symbol.toStringTag,{value:"Module"})),Ro="EXT_texture_webp",Oo=Object.freeze(Object.defineProperty({__proto__:null,name:"EXT_texture_webp",preprocess:function(t,e){const n=new cs(t);if(!function(t){if(void 0===qi[t]){const e=a?function(t){switch(t){case"image/avif":case"image/webp":return function(t){try{return 0===document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)}catch{return!1}}(t);default:return!0}}(t):function(t){var e,n;const r=(null===(e=globalThis.loaders)||void 0===e?void 0:e.imageFormatsNode)||["image/png","image/jpeg","image/gif"];return!!(null===(n=globalThis.loaders)||void 0===n?void 0:n.parseImageNode)&&r.includes(t)}(t);qi[t]=e}return qi[t]}("image/webp")){if(n.getRequiredExtensions().includes(Ro))throw new Error(`gltf: Required extension ${Ro} not supported by browser`);return}const{json:r}=n;for(const t of r.textures||[]){const e=n.getObjectExtension(t,Ro);e&&(t.source=e.source),n.removeObjectExtension(t,Ro)}n.removeExtension(Ro)}},Symbol.toStringTag,{value:"Module"})),Fo="KHR_texture_basisu",Do=Object.freeze(Object.defineProperty({__proto__:null,name:"KHR_texture_basisu",preprocess:function(t,e){const n=new cs(t),{json:r}=n;for(const t of r.textures||[]){const e=n.getObjectExtension(t,Fo);e&&(t.source=e.source,n.removeObjectExtension(t,Fo))}n.removeExtension(Fo)}},Symbol.toStringTag,{value:"Module"}));function Go(t){const{buffer:e,size:n,count:r}=function(t){let e=t,n=1,r=0;return t&&t.value&&(e=t.value,n=t.size||1),e&&(ArrayBuffer.isView(e)||(e=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t?Array.isArray(t)?new e(t):!n||t instanceof e?t:new e(t):null}(e,Float32Array)),r=e.length/n),{buffer:e,size:n,count:r}}(t);return{value:e,size:n,byteOffset:0,count:r,type:is(n),componentType:ss(e)}}const Lo="KHR_draco_mesh_compression";async function Uo(t,e,n,r){const i=t.getObjectExtension(e,Lo);if(!i)return;const o=t.getTypedArrayForBufferView(i.bufferView),a=P(o.buffer,o.byteOffset),c={...n};delete c["3d-tiles"];const h=await s(a,$r,c,r),l=function(t){const e={};for(const n in t){const r=t[n];if("indices"!==n){const t=Go(r);e[n]=t}}return e}(h.attributes);for(const[n,r]of Object.entries(l))if(n in e.attributes){const i=e.attributes[n],s=t.getAccessor(i);null!=s&&s.min&&null!=s&&s.max&&(r.min=s.min,r.max=s.max)}e.attributes=l,h.indices&&(e.indices=Go(h.indices)),t.removeObjectExtension(e,Lo),function(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(e)}function No(t,e){var n;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,i=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(!i.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=i.DracoWriter.encodeSync({attributes:t}),a=null==s||null===(n=s.parseSync)||void 0===n?void 0:n.call(s,{attributes:t}),c=i._addFauxAttributes(a.attributes),h=i.addBufferView(o);return{primitives:[{attributes:c,mode:r,extensions:{[Lo]:{bufferView:h,attributes:c}}}]}}function*Po(t){for(const e of t.json.meshes||[])for(const t of e.primitives)yield t}const Ho=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e,n){var r;if(null==e||null===(r=e.gltf)||void 0===r||!r.decompressMeshes)return;const i=new cs(t),s=[];for(const t of Po(i))i.getObjectExtension(t,Lo)&&s.push(Uo(i,t,e,n));await Promise.all(s),i.removeExtension(Lo)},encode:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new cs(t);for(const t of n.json.meshes||[])No(t,e),n.addRequiredExtension(Lo)},name:"KHR_draco_mesh_compression",preprocess:function(t,e,n){const r=new cs(t);for(const t of Po(r))r.getObjectExtension(t,Lo)}},Symbol.toStringTag,{value:"Module"})),Jo="KHR_texture_transform",jo=new Qe,ko=new $e,Vo=new $e;function Ko(t,e){var n,r,i;const s=[],o=null===(n=e.json.materials)||void 0===n?void 0:n[t],a=null==o||null===(r=o.pbrMetallicRoughness)||void 0===r?void 0:r.baseColorTexture;a&&Qo(e,t,a,s);const c=null==o?void 0:o.emissiveTexture;c&&Qo(e,t,c,s);const h=null==o?void 0:o.normalTexture;h&&Qo(e,t,h,s);const l=null==o?void 0:o.occlusionTexture;l&&Qo(e,t,l,s);const u=null==o||null===(i=o.pbrMetallicRoughness)||void 0===i?void 0:i.metallicRoughnessTexture;u&&Qo(e,t,u,s)}function Qo(t,e,n,r){const i=function(t,e){var n;const r=null===(n=t.extensions)||void 0===n?void 0:n[Jo],{texCoord:i=0}=t,{texCoord:s=i}=r;if(-1===e.findIndex((t=>{let[e,n]=t;return e===i&&n===s}))){const n=function(t){const{offset:e=[0,0],rotation:n=0,scale:r=[1,1]}=t,i=(new $e).set(1,0,0,0,1,0,e[0],e[1],1),s=ko.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=Vo.set(r[0],0,0,0,r[1],0,0,0,1);return i.multiplyRight(s).multiplyRight(o)}(r);return i!==s&&(t.texCoord=s),e.push([i,s]),{originalTexCoord:i,texCoord:s,matrix:n}}return null}(n,r);if(!i)return;const s=t.json.meshes||[];for(const n of s)for(const r of n.primitives){const n=r.material;Number.isFinite(n)&&e===n&&zo(t,r,i)}}function zo(t,e,n){const{originalTexCoord:r,texCoord:i,matrix:s}=n,o=e.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){var a;const n=null===(a=t.json.accessors)||void 0===a?void 0:a[o];if(n&&n.bufferView){var c;const o=null===(c=t.json.bufferViews)||void 0===c?void 0:c[n.bufferView];if(o){const{arrayBuffer:a,byteOffset:c}=t.buffers[o.buffer],h=(c||0)+(n.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:u}=os(n,o),d=Xi[n.componentType],f=Yi[n.type],m=o.byteStride||d*f,p=new Float32Array(u);for(let t=0;t{t.uniforms[e].value&&!(e in n)&&(n[e]=t.uniforms[e].value)})),Object.keys(n).forEach((t=>{"object"==typeof n[t]&&void 0!==n[t].index&&(n[t].texture=e.getTexture(n[t].index))})),n}const ea=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t){const e=new cs(t),{json:n}=e,r=e.getExtension($o);if(r){const t=function(t,e){const{programs:n=[],shaders:r=[],techniques:i=[]}=t,s=new TextDecoder;return r.forEach((t=>{if(!Number.isFinite(t.bufferView))throw new Error("KHR_techniques_webgl: no shader code");t.code=s.decode(e.getTypedArrayForBufferView(t.bufferView))})),n.forEach((t=>{t.fragmentShader=r[t.fragmentShader],t.vertexShader=r[t.vertexShader]})),i.forEach((t=>{t.program=n[t.program]})),i}(r,e);for(const r of n.materials||[]){const n=e.getObjectExtension(r,$o);n&&(r.technique=Object.assign({},n,t[n.technique]),r.technique.values=ta(r.technique,e)),e.removeObjectExtension(r,$o)}e.removeExtension($o)}},encode:async function(t,e){},name:"KHR_techniques_webgl"},Symbol.toStringTag,{value:"Module"})),na=[Fs,vs,So,Oo,Do,Ho,Yo,Zo,ea,qo,Js];function ra(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=na.filter((t=>sa(t.name,e)));for(const s of r){var i;null===(i=s.preprocess)||void 0===i||i.call(s,t,e,n)}}async function ia(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=na.filter((t=>sa(t.name,e)));for(const s of r){var i;await(null===(i=s.decode)||void 0===i?void 0:i.call(s,t,e,n))}}function sa(t,e){var n;const r=(null==e||null===(n=e.gltf)||void 0===n?void 0:n.excludeExtensions)||{};return!(t in r&&!r[t])}const oa="KHR_binary_glTF",aa={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},ca={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class ha{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(t,e){this.json=t.json;const n=t.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn(`glTF: Unknown version ${n.asset.version}`)}if(!e.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),function(t){const e=new cs(t),{json:n}=e;for(const t of n.images||[]){const n=e.getObjectExtension(t,oa);n&&Object.assign(t,n),e.removeObjectExtension(t,oa)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,e.removeExtension(oa)}(t),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(const e in aa)this._convertTopLevelObjectToArray(t,e)}_convertTopLevelObjectToArray(t,e){const n=t[e];if(n&&!Array.isArray(n)){t[e]=[];for(const r in n){const i=n[r];i.id=i.id||r;const s=t[e].length;t[e].push(i),this.idToIndexMap[e][r]=s}}}_convertObjectIdsToArrayIndices(t){for(const e in aa)this._convertIdsToIndices(t,e);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(const e of t.textures)this._convertTextureIds(e);for(const e of t.meshes)this._convertMeshIds(e);for(const e of t.nodes)this._convertNodeIds(e);for(const e of t.scenes)this._convertSceneIds(e)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(const e of t.primitives){const{attributes:t,indices:n,material:r}=e;for(const e in t)t[e]=this._convertIdToIndex(t[e],"accessor");n&&(e.indices=this._convertIdToIndex(n,"accessor")),r&&(e.material=this._convertIdToIndex(r,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map((t=>this._convertIdToIndex(t,"node")))),t.meshes&&(t.meshes=t.meshes.map((t=>this._convertIdToIndex(t,"mesh"))))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map((t=>this._convertIdToIndex(t,"node"))))}_convertIdsToIndices(t,e){t[e]||(console.warn(`gltf v1: json doesn't contain attribute ${e}`),t[e]=[]);for(const n of t[e])for(const t in n){const e=n[t],r=this._convertIdToIndex(e,t);n[t]=r}}_convertIdToIndex(t,e){const n=ca[e];if(n in this.idToIndexMap){const r=this.idToIndexMap[n][t];if(!Number.isFinite(r))throw new Error(`gltf v1: failed to resolve ${e} with id ${t}`);return r}return t}_updateObjects(t){for(const t of this.json.buffers)delete t.type}_updateMaterial(t){for(const i of t.materials){var e,n,r;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const s=(null===(e=i.values)||void 0===e?void 0:e.tex)||(null===(n=i.values)||void 0===n?void 0:n.texture2d_0)||(null===(r=i.values)||void 0===r?void 0:r.diffuseTex),o=t.textures.findIndex((t=>t.id===s));-1!==o&&(i.pbrMetallicRoughness.baseColorTexture={index:o})}}}function la(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(new ha).normalize(t,e)}async function ua(t,e){var n,r,i;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return da(t,e,s,o),la(t,{normalize:null==o||null===(n=o.gltf)||void 0===n?void 0:n.normalize}),ra(t,o,a),null!=o&&null!==(r=o.gltf)&&void 0!==r&&r.loadBuffers&&t.json.buffers&&await fa(t,o,a),null!=o&&null!==(i=o.gltf)&&void 0!==i&&i.loadImages&&await ma(t,o,a),await ia(t,o,a),t}function da(t,e,n,r){if(r.uri&&(t.baseUri=r.uri),e instanceof ArrayBuffer&&!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new DataView(t),{magic:i=mo}=n,s=r.getUint32(e,!1);return s===i||s===mo}(e,n,r)&&(e=(new TextDecoder).decode(e)),"string"==typeof e)t.json=function(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;return"string"==typeof t?t.slice(0,e):ArrayBuffer.isView(t)?U(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?U(t,0,e):""}(t)}"`)}}(e);else if(e instanceof ArrayBuffer){const i={};n=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=new DataView(e),i=po(r,n+0),s=r.getUint32(n+4,fo),o=r.getUint32(n+8,fo);switch(Object.assign(t,{header:{byteOffset:n,byteLength:o,hasBinChunk:!1},type:i,version:s,json:{},binChunks:[]}),n+=12,t.version){case 1:return go(t,r,n);case 2:return Ao(t,r,n,{});default:throw new Error(`Invalid GLB version ${t.version}. Only supports version 1 and 2.`)}}(i,e,n,r.glb),Wi("glTF"===i.type,`Invalid GLB magic string ${i.type}`),t._glb=i,t.json=i.json}else Wi(!1,"GLTF: must be ArrayBuffer or string");const i=t.json.buffers||[];if(t.buffers=new Array(i.length).fill(null),t._glb&&t._glb.header.hasBinChunk){const{binChunks:e}=t._glb;t.buffers[0]={arrayBuffer:e[0].arrayBuffer,byteOffset:e[0].byteOffset,byteLength:e[0].byteLength}}const s=t.json.images||[];t.images=new Array(s.length).fill({})}async function fa(t,e,n){const r=t.json.buffers||[];for(let o=0;o1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;e={...ga.options,...e},e.gltf={...ga.options.gltf,...e.gltf};const{byteOffset:r=0}=e;return await ua({},t,r,e,n)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}},Aa={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ya={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ba={magFilter:10240,minFilter:10241,wrapS:10242,wrapT:10243},ba={10240:9729,10241:9986,10242:10497,10243:10497};class Ca{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{json:n,buffers:r=[],images:i=[]}=t,{baseUri:s=""}=t;return Wi(n),this.baseUri=s,this.buffers=r,this.images=i,this.jsonUnprocessed=n,this.json=this._resolveTree(t.json,e),this.json}_resolveTree(t){const e={...t};return this.json=e,t.bufferViews&&(e.bufferViews=t.bufferViews.map(((t,e)=>this._resolveBufferView(t,e)))),t.images&&(e.images=t.images.map(((t,e)=>this._resolveImage(t,e)))),t.samplers&&(e.samplers=t.samplers.map(((t,e)=>this._resolveSampler(t,e)))),t.textures&&(e.textures=t.textures.map(((t,e)=>this._resolveTexture(t,e)))),t.accessors&&(e.accessors=t.accessors.map(((t,e)=>this._resolveAccessor(t,e)))),t.materials&&(e.materials=t.materials.map(((t,e)=>this._resolveMaterial(t,e)))),t.meshes&&(e.meshes=t.meshes.map(((t,e)=>this._resolveMesh(t,e)))),t.nodes&&(e.nodes=t.nodes.map(((t,e)=>this._resolveNode(t,e))),e.nodes=e.nodes.map(((t,e)=>this._resolveNodeChildren(t)))),t.skins&&(e.skins=t.skins.map(((t,e)=>this._resolveSkin(t,e)))),t.scenes&&(e.scenes=t.scenes.map(((t,e)=>this._resolveScene(t,e)))),"number"==typeof this.json.scene&&e.scenes&&(e.scene=e.scenes[this.json.scene]),e}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,e){if("object"==typeof e)return e;const n=t&&t[e];return n||console.warn(`glTF file error: Could not find ${t}[${e}]`),n}_resolveScene(t,e){return{...t,id:t.id||`scene-${e}`,nodes:(t.nodes||[]).map((t=>this.getNode(t)))}}_resolveNode(t,e){const n={...t,id:(null==t?void 0:t.id)||`node-${e}`};return void 0!==t.mesh&&(n.mesh=this.getMesh(t.mesh)),void 0!==t.camera&&(n.camera=this.getCamera(t.camera)),void 0!==t.skin&&(n.skin=this.getSkin(t.skin)),void 0!==t.meshes&&t.meshes.length&&(n.mesh=t.meshes.reduce(((t,e)=>{const n=this.getMesh(e);return t.id=n.id,t.primitives=t.primitives.concat(n.primitives),t}),{primitives:[]})),n}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map((t=>this.getNode(t)))),t}_resolveSkin(t,e){const n="number"==typeof t.inverseBindMatrices?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${e}`,inverseBindMatrices:n}}_resolveMesh(t,e){const n={...t,id:t.id||`mesh-${e}`,primitives:[]};return t.primitives&&(n.primitives=t.primitives.map((t=>{const e={...t,attributes:{},indices:void 0,material:void 0},n=t.attributes;for(const t in n)e.attributes[t]=this.getAccessor(n[t]);return void 0!==t.indices&&(e.indices=this.getAccessor(t.indices)),void 0!==t.material&&(e.material=this.getMaterial(t.material)),e}))),n}_resolveMaterial(t,e){const n={...t,id:t.id||`material-${e}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};const t=n.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,e){const n=function(t){return ya[t]}(t.componentType),r=function(t){return Aa[t]}(t.type),i=n*r,s={...t,id:t.id||`accessor-${e}`,bytesPerComponent:n,components:r,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(void 0!==t.bufferView&&(s.bufferView=this.getBufferView(t.bufferView)),s.bufferView){const t=s.bufferView.buffer,{ArrayType:e,byteLength:n}=os(s,s.bufferView),r=(s.bufferView.byteOffset||0)+(s.byteOffset||0)+t.byteOffset;let i=t.arrayBuffer.slice(r,r+n);s.bufferView.byteStride&&(i=this._getValueFromInterleavedBuffer(t,r,s.bufferView.byteStride,s.bytesPerElement,s.count)),s.value=new e(i)}return s}_getValueFromInterleavedBuffer(t,e,n,r,i){const s=new Uint8Array(i*r);for(let o=0;o12;){const o={shape:"tile3d"};t.tiles.push(o),n=await s(e,n,r,i,o)}return n}async function Ma(t,e,n,r){var i,o;if(t.rotateYtoZ=!0,t.gltfUpAxis=null!=n&&null!==(i=n["3d-tiles"])&&void 0!==i&&i.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",null!=n&&null!==(o=n["3d-tiles"])&&void 0!==o&&o.loadGLTF){if(!r)return e.byteLength;const i=await s(e,ga,n,r);t.gltf=wa(i),t.gpuMemoryUsageInBytes=as(t.gltf)}else t.gltfArrayBuffer=e;return e.byteLength}async function Ia(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{shape:"tile3d"};switch(i.byteOffset=e,i.type=Pr(t,e),i.type){case Fr:return await xa(i,t,e,n,r,Ia);case Gr:return await Ta(i,t,e,n,r);case Ur:return await Ma(i,t,n,r);case Lr:return await _a(i,t,e,n,r);case Dr:return await xi(i,t,e,n,r);default:throw new Error(`3DTileLoader: unknown type ${i.type}`)}}async function Sa(t,e,n,r){const i=Number.isFinite(e.bitstream)?e.bitstream:e.bufferView;if("number"!=typeof i)return;const s=t.bufferViews[i],o=t.buffers[s.buffer];if(null==r||!r.baseUrl)throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){const t=`${(null==r?void 0:r.baseUrl)||""}/${o.uri}`,n=await(await r.fetch(t)).arrayBuffer();return void(e.explicitBitstream=new Uint8Array(n,s.byteOffset,s.byteLength))}const a=t.buffers.slice(0,s.buffer).reduce(((t,e)=>t+e.byteLength),0);e.explicitBitstream=new Uint8Array(n.slice(a,a+o.byteLength),s.byteOffset,s.byteLength)}function Ra(t){const e=new DataView(t);return e.getUint32(0,!0)+2**32*e.getUint32(4,!0)}const Oa={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Or,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:async function(t,e,n){if(1952609651!==new Uint32Array(t.slice(0,4))[0])throw new Error("Wrong subtree file magic number");if(1!==new Uint32Array(t.slice(4,8))[0])throw new Error("Wrong subtree file verson, must be 1");const r=Ra(t.slice(8,16)),i=new Uint8Array(t,24,r),s=new TextDecoder("utf8").decode(i),o=JSON.parse(s),a=Ra(t.slice(16,24));let c=new ArrayBuffer(0);if(a&&(c=t.slice(24+r)),await Sa(o,o.tileAvailability,c,n),Array.isArray(o.contentAvailability))for(const t of o.contentAvailability)await Sa(o,t,c,n);else await Sa(o,o.contentAvailability,c,n);return await Sa(o,o.childSubtreeAvailability,c,n),o},options:{}};var Fa=null;try{Fa=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Da(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function Ga(t){return!0===(t&&t.__isLong__)}function La(t){var e=Math.clz32(t&-t);return t?31-e:e}Da.prototype.__isLong__,Object.defineProperty(Da.prototype,"__isLong__",{value:!0}),Da.isLong=Ga;var Ua={},Na={};function Pa(t,e){var n,r,i;return e?(i=0<=(t>>>=0)&&t<256)&&(r=Na[t])?r:(n=Ja(t,0,!0),i&&(Na[t]=n),n):(i=-128<=(t|=0)&&t<128)&&(r=Ua[t])?r:(n=Ja(t,t<0?-1:0,!1),i&&(Ua[t]=n),n)}function Ha(t,e){if(isNaN(t))return e?Ya:Wa;if(e){if(t<0)return Ya;if(t>=Qa)return ec}else{if(t<=-za)return nc;if(t+1>=za)return tc}return t<0?Ha(-t,e).neg():Ja(t%Ka|0,t/Ka|0,e)}function Ja(t,e,n){return new Da(t,e,n)}Da.fromInt=Pa,Da.fromNumber=Ha,Da.fromBits=Ja;var ja=Math.pow;function ka(t,e,n){if(0===t.length)throw Error("empty string");if("number"==typeof e?(n=e,e=!1):e=!!e,"NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return e?Ya:Wa;if((n=n||10)<2||360)throw Error("interior hyphen");if(0===r)return ka(t.substring(1),e,n).neg();for(var i=Ha(ja(n,8)),s=Wa,o=0;o>>0:this.low},rc.toNumber=function(){return this.unsigned?(this.high>>>0)*Ka+(this.low>>>0):this.high*Ka+(this.low>>>0)},rc.toString=function(t){if((t=t||10)<2||36>>0).toString(t);if((s=a).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},rc.getHighBits=function(){return this.high},rc.getHighBitsUnsigned=function(){return this.high>>>0},rc.getLowBits=function(){return this.low},rc.getLowBitsUnsigned=function(){return this.low>>>0},rc.getNumBitsAbs=function(){if(this.isNegative())return this.eq(nc)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&!(t&1<=0},rc.isOdd=function(){return 1==(1&this.low)},rc.isEven=function(){return 0==(1&this.low)},rc.equals=function(t){return Ga(t)||(t=Va(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&this.high===t.high&&this.low===t.low},rc.eq=rc.equals,rc.notEquals=function(t){return!this.eq(t)},rc.neq=rc.notEquals,rc.ne=rc.notEquals,rc.lessThan=function(t){return this.comp(t)<0},rc.lt=rc.lessThan,rc.lessThanOrEqual=function(t){return this.comp(t)<=0},rc.lte=rc.lessThanOrEqual,rc.le=rc.lessThanOrEqual,rc.greaterThan=function(t){return this.comp(t)>0},rc.gt=rc.greaterThan,rc.greaterThanOrEqual=function(t){return this.comp(t)>=0},rc.gte=rc.greaterThanOrEqual,rc.ge=rc.greaterThanOrEqual,rc.compare=function(t){if(Ga(t)||(t=Va(t)),this.eq(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},rc.comp=rc.compare,rc.negate=function(){return!this.unsigned&&this.eq(nc)?nc:this.not().add(Xa)},rc.neg=rc.negate,rc.add=function(t){Ga(t)||(t=Va(t));var e=this.high>>>16,n=65535&this.high,r=this.low>>>16,i=65535&this.low,s=t.high>>>16,o=65535&t.high,a=t.low>>>16,c=0,h=0,l=0,u=0;return l+=(u+=i+(65535&t.low))>>>16,h+=(l+=r+a)>>>16,c+=(h+=n+o)>>>16,c+=e+s,Ja((l&=65535)<<16|(u&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},rc.subtract=function(t){return Ga(t)||(t=Va(t)),this.add(t.neg())},rc.sub=rc.subtract,rc.multiply=function(t){if(this.isZero())return this;if(Ga(t)||(t=Va(t)),Fa)return Ja(Fa.mul(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned);if(t.isZero())return this.unsigned?Ya:Wa;if(this.eq(nc))return t.isOdd()?nc:Wa;if(t.eq(nc))return this.isOdd()?nc:Wa;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(qa)&&t.lt(qa))return Ha(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,n=65535&this.high,r=this.low>>>16,i=65535&this.low,s=t.high>>>16,o=65535&t.high,a=t.low>>>16,c=65535&t.low,h=0,l=0,u=0,d=0;return u+=(d+=i*c)>>>16,l+=(u+=r*c)>>>16,u&=65535,l+=(u+=i*a)>>>16,h+=(l+=n*c)>>>16,l&=65535,h+=(l+=r*a)>>>16,l&=65535,h+=(l+=i*o)>>>16,h+=e*c+n*a+r*o+i*s,Ja((u&=65535)<<16|(d&=65535),(h&=65535)<<16|(l&=65535),this.unsigned)},rc.mul=rc.multiply,rc.divide=function(t){if(Ga(t)||(t=Va(t)),t.isZero())throw Error("division by zero");var e,n,r;if(Fa)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?Ja((this.unsigned?Fa.div_u:Fa.div_s)(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Ya:Wa;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ya;if(t.gt(this.shru(1)))return Za;r=Ya}else{if(this.eq(nc))return t.eq(Xa)||t.eq($a)?nc:t.eq(nc)?Xa:(e=this.shr(1).div(t).shl(1)).eq(Wa)?t.isNegative()?Xa:$a:(n=this.sub(t.mul(e)),r=e.add(n.div(t)));if(t.eq(nc))return this.unsigned?Ya:Wa;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=Wa}for(n=this;n.gte(t);){e=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var i=Math.ceil(Math.log(e)/Math.LN2),s=i<=48?1:ja(2,i-48),o=Ha(e),a=o.mul(t);a.isNegative()||a.gt(n);)a=(o=Ha(e-=s,this.unsigned)).mul(t);o.isZero()&&(o=Xa),r=r.add(o),n=n.sub(a)}return r},rc.div=rc.divide,rc.modulo=function(t){return Ga(t)||(t=Va(t)),Fa?Ja((this.unsigned?Fa.rem_u:Fa.rem_s)(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},rc.mod=rc.modulo,rc.rem=rc.modulo,rc.not=function(){return Ja(~this.low,~this.high,this.unsigned)},rc.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},rc.clz=rc.countLeadingZeros,rc.countTrailingZeros=function(){return this.low?La(this.low):La(this.high)+32},rc.ctz=rc.countTrailingZeros,rc.and=function(t){return Ga(t)||(t=Va(t)),Ja(this.low&t.low,this.high&t.high,this.unsigned)},rc.or=function(t){return Ga(t)||(t=Va(t)),Ja(this.low|t.low,this.high|t.high,this.unsigned)},rc.xor=function(t){return Ga(t)||(t=Va(t)),Ja(this.low^t.low,this.high^t.high,this.unsigned)},rc.shiftLeft=function(t){return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?Ja(this.low<>>32-t,this.unsigned):Ja(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):Ja(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},rc.shr=rc.shiftRight,rc.shiftRightUnsigned=function(t){return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?Ja(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):Ja(32===t?this.high:this.high>>>t-32,0,this.unsigned)},rc.shru=rc.shiftRightUnsigned,rc.shr_u=rc.shiftRightUnsigned,rc.rotateLeft=function(t){var e;return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:32===t?Ja(this.high,this.low,this.unsigned):t<32?(e=32-t,Ja(this.low<>>e,this.high<>>e,this.unsigned)):(e=32-(t-=32),Ja(this.high<>>e,this.low<>>e,this.unsigned))},rc.rotl=rc.rotateLeft,rc.rotateRight=function(t){var e;return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:32===t?Ja(this.high,this.low,this.unsigned):t<32?(e=32-t,Ja(this.high<>>t,this.low<>>t,this.unsigned)):(e=32-(t-=32),Ja(this.low<>>t,this.high<>>t,this.unsigned))},rc.rotr=rc.rotateRight,rc.toSigned=function(){return this.unsigned?Ja(this.low,this.high,!1):this},rc.toUnsigned=function(){return this.unsigned?this:Ja(this.low,this.high,!0)},rc.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},rc.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},rc.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},Da.fromBytes=function(t,e,n){return n?Da.fromBytesLE(t,e):Da.fromBytesBE(t,e)},Da.fromBytesLE=function(t,e){return new Da(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},Da.fromBytesBE=function(t,e){return new Da(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)};const sc=180/Math.PI;function oc(t,e,n){const r=1<=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function cc(t){return[ac(t[0]),ac(t[1])]}function hc(t,e){let[n,r]=e;switch(t){case 0:return[1,n,r];case 1:return[-n,1,r];case 2:return[-n,-r,1];case 3:return[-1,-r,-n];case 4:return[r,-1,-n];case 5:return[r,n,-1];default:throw new Error("Invalid face")}}function lc(t){let[e,n,r]=t;const i=Math.atan2(r,Math.sqrt(e*e+n*n));return[Math.atan2(n,e)*sc,i*sc]}function uc(t,e,n,r){if(0===r){1===n&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const r=e[0];e[0]=e[1],e[1]=r}}function dc(t){const{face:e,ij:n,level:r}=t,i=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(100*Math.pow(2,-r))),o=new Float64Array(4*s*2+2);let a=0,c=0;for(let t=0;t<4;t++){const h=i[t].slice(0),l=i[t+1],u=(l[0]-h[0])/s,d=(l[1]-h[1])/s;for(let t=0;t89.999&&(t[0]=c);const i=t[0]-c;t[0]+=i>180?-360:i<-180?360:0,o[a++]=t[0],o[a++]=t[1],c=t[0]}}return o[a++]=o[0],o[a++]=o[1],o}function fc(t){const e=function(t){return t.indexOf("/")>0?t:function(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<64;)e="0"+e;const n=e.lastIndexOf("1"),r=e.substring(0,3),i=e.substring(3,n),s=i.length/2,o=Da.fromString(r,!0,2).toString(10);let a="";if(0!==s)for(a=Da.fromString(i,!0,2).toString(4);a.length=0;t--){s=i-t;const e=r[t];let n=0,a=0;"1"===e?a=1:"2"===e?(n=1,a=1):"3"===e&&(n=1);const c=Math.pow(2,s-1);uc(c,o,n,a),o[0]+=c*n,o[1]+=c*a}if(n%2==1){const t=o[0];o[0]=o[1],o[1]=t}return{face:n,ij:o,level:s}}(e)}function mc(t){if(t.length%2!=0)throw new Error("Invalid corners");const e=[],n=[];for(let r=0;rt-e)),n.sort(((t,e)=>t-e)),{west:e[0],east:e[e.length-1],north:n[n.length-1],south:n[0]}}function pc(t){const e=t.token,n={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},r=function(t,e){const n=(null==e?void 0:e.minimumHeight)||0,r=(null==e?void 0:e.maximumHeight)||0,i=function(t){let e;if(2===t.face||5===t.face){let n=null,r=0;for(let e=0;e<4;e++){const i=dc(fc(`${t.face}/${e}`));(typeof n>"u"||null===n)&&(n=new Float64Array(4*i.length)),n.set(i,r),r+=i.length}e=mc(n)}else e=mc(dc(t));return e}(fc(t)),s=i.west,o=i.south,a=i.east,c=i.north,h=[];return h.push(new Qe(s,c,n)),h.push(new Qe(a,c,n)),h.push(new Qe(a,o,n)),h.push(new Qe(s,o,n)),h.push(new Qe(s,c,r)),h.push(new Qe(a,c,r)),h.push(new Qe(a,o,r)),h.push(new Qe(s,o,r)),h}(e,n),i=function(t){return function(t){const e=cc(oc(t.ij,t.level,[.5,.5]));return lc(hc(t.face,e))}(fc(t))}(e),s=i[0],o=i[1],a=Hn.WGS84.cartographicToCartesian([s,o,n.maximumHeight]),c=new Qe(a[0],a[1],a[2]);r.push(c);const h=function(t,e=new Xn){if(!t||0===t.length)return e.halfAxes=new $e([0,0,0,0,0,0,0,0,0]),e.center=new Qe,e;const n=t.length,r=new Qe(0,0,0);for(const e of t)r.add(e);const i=1/n;r.multiplyByScalar(i);let s=0,o=0,a=0,c=0,h=0,l=0;for(const e of t){const t=Cr.copy(e).subtract(r);s+=t.x*t.x,o+=t.x*t.y,a+=t.x*t.z,c+=t.y*t.y,h+=t.y*t.z,l+=t.z*t.z}s*=i,o*=i,a*=i,c*=i,h*=i,l*=i;const u=_r;u[0]=s,u[1]=o,u[2]=a,u[3]=o,u[4]=c,u[5]=h,u[6]=a,u[7]=h,u[8]=l;const{unitary:d}=function(t,e={}){let n=0,r=0;const i=fr,s=mr;i.identity(),s.copy(t);const o=1e-20*function(t){let e=0;for(let n=0;n<9;++n){const r=t[n];e+=r*r}return Math.sqrt(e)}(s);for(;r<10&&Br(s)>o;)br(s,pr),gr.copy(pr).transpose(),s.multiplyRight(pr),s.multiplyLeft(gr),i.multiplyRight(pr),++n>2&&(++r,n=0);return e.unitary=i.toTarget(e.unitary),e.diagonal=s.toTarget(e.diagonal),e}(u,xr),f=e.halfAxes.copy(d);let m=f.getColumn(0,Er),p=f.getColumn(1,vr),g=f.getColumn(2,Tr),A=-Number.MAX_VALUE,y=-Number.MAX_VALUE,B=-Number.MAX_VALUE,b=Number.MAX_VALUE,C=Number.MAX_VALUE,w=Number.MAX_VALUE;for(const e of t)Cr.copy(e),A=Math.max(Cr.dot(m),A),y=Math.max(Cr.dot(p),y),B=Math.max(Cr.dot(g),B),b=Math.min(Cr.dot(m),b),C=Math.min(Cr.dot(p),C),w=Math.min(Cr.dot(g),w);m=m.multiplyByScalar(.5*(b+A)),p=p.multiplyByScalar(.5*(C+y)),g=g.multiplyByScalar(.5*(w+B)),e.center.copy(m).add(p).add(g);const E=wr.set(A-b,y-C,B-w).multiplyByScalar(.5),v=new $e([E[0],0,0,0,E[1],0,0,0,E[2]]);return e.halfAxes.multiplyRight(v),e}(r);return[...h.center,...h.halfAxes]}const gc={QUADTREE:4,OCTREE:8};function Ac(t,e,n){if(null!=t&&t.box){const r=function(t,e){const n=function(t){return t.and(t.not().add(1))}(t).shiftRightUnsigned(2);return t.add(Da.fromNumber(2*e+1-4).multiply(n))}(ic(t.s2VolumeInfo.token),e),i=function(t){if(t.isZero())return"X";let e=t.countTrailingZeros();e=(e-e%4)/4;const n=e;e*=4;const r=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-n-r.length).join("0")+r}(r),s={...t.s2VolumeInfo};if("OCTREE"===(s.token=i,n)){const e=t.s2VolumeInfo,n=e.maximumHeight-e.minimumHeight,r=n/2,i=e.minimumHeight+n/2;e.minimumHeight=i-r,e.maximumHeight=i+r}return{box:pc(s),s2VolumeInfo:s}}}async function yc(t){const{implicitOptions:e,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:i,loaderOptions:s}=t;let{subtree:o,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=t;const{subdivisionScheme:h,subtreeLevels:l,maximumLevel:u,contentUrlTemplate:d,subtreesUriTemplate:f,basePath:m}=e,p={children:[],lodMetricValue:0,contentUrl:""};if(!u)return Ot.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${d} won't be loaded...`),p;const g=a+c.level;if(g>u)return p;const A=gc[h],y=Math.log2(A),B=1&r,b=r>>1&1,C=r>>2&1,w=(A**a-1)/(A-1);let E=Cc(n.mortonIndex,r,y),v=w+E,T=Cc(n.x,B,1),_=Cc(n.y,b,1),x=Cc(n.z,C,1),M=!1;a>=l&&(M=Bc(o.childSubtreeAvailability,E));const I=Cc(c.x,T,a),S=Cc(c.y,_,a),R=Cc(c.z,x,a);if(M){const t=wc(`${m}/${f}`,g,I,S,R);o=await he(t,Oa,s),c={mortonIndex:E,x:T,y:_,z:x,level:a},E=0,v=0,T=0,_=0,x=0,a=0}if(!Bc(o.tileAvailability,v))return p;Bc(o.contentAvailability,v)&&(p.contentUrl=wc(d,g,I,S,R));const O=a+1,F={mortonIndex:E,x:T,y:_,z:x};for(let t=0;t1&&Ot.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=t,"constant"in n?!!n.constant:!!n.explicitBitstream&&function(t,e){const n=t%8;return 1==(e[Math.floor(t/8)]>>n&1)}(e,n.explicitBitstream)}function bc(t,e,n,r,i){const{basePath:s,refine:o,getRefine:a,lodMetricType:c,getTileType:h,rootLodMetricValue:l,rootBoundingVolume:u}=r,d=t.contentUrl&&t.contentUrl.replace(`${s}/`,""),f=l/2**e,m=function(t,e,n){if(e.region){const{childTileX:r,childTileY:i,childTileZ:s}=n,[o,a,c,h,l,u]=e.region,d=2**t,f=(c-o)/d,m=(h-a)/d,p=(u-l)/d,[g,A]=[o+f*r,o+f*(r+1)],[y,B]=[a+m*i,a+m*(i+1)],[b,C]=[l+p*s,l+p*(s+1)];return{region:[g,y,A,B,b,C]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${e}`)}(e,null!=i&&i.box?{box:i.box}:u,n);return{children:t.children,contentUrl:t.contentUrl,content:{uri:d},id:t.contentUrl,refine:a(o),type:h(t),lodMetricType:c,lodMetricValue:f,geometricError:f,transform:t.transform,boundingVolume:m}}function Cc(t,e,n){return(t<s[t]))}function Ec(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!e)return Ir.EMPTY;const n=e.split("?")[0].split(".").pop();switch(n){case"pnts":return Ir.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Ir.SCENEGRAPH;default:return n||Ir.EMPTY}}function vc(t){switch(t){case"REPLACE":case"replace":return Mr.REPLACE;case"ADD":case"add":return Mr.ADD;default:return t}}function Tc(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){const n=new URL(t,`${e}/`);return decodeURI(n.toString())}return t.startsWith("/")?t:function(){const t=[];for(let e=0;e=-1&&!r;i--){let s;i>=0?s=t[i]:(void 0===e&&(e=z()),s=e),0!==s.length&&(n=`${s}/${n}`,r=s.charCodeAt(0)===Y)}return n=X(n,!r),r?`/${n}`:n.length>0?n:"."}(e,t)}function _c(t,e){if(!t)return null;let n;if(t.content){var r;const i=t.content.uri||(null===(r=t.content)||void 0===r?void 0:r.url);typeof i<"u"&&(n=Tc(i,e))}return{...t,id:n,contentUrl:n,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:Ec(t,n),refine:vc(t.refine)}}async function xc(t,e,n,r,i){var s,o,a;const{subdivisionScheme:c,maximumLevel:h,availableLevels:l,subtreeLevels:u,subtrees:{uri:d}}=r,f=Tc(wc(d,0,0,0,0),n),m=await he(f,Oa,i),p=null===(s=t.content)||void 0===s?void 0:s.uri,g=p?Tc(p,n):"",A=null==e||null===(o=e.root)||void 0===o?void 0:o.refine,y=t.geometricError,B=null===(a=t.boundingVolume.extensions)||void 0===a?void 0:a["3DTILES_bounding_volume_S2"];if(B){const e={box:pc(B),s2VolumeInfo:B};t.boundingVolume=e}const b=t.boundingVolume,C={contentUrlTemplate:g,subtreesUriTemplate:d,subdivisionScheme:c,subtreeLevels:u,maximumLevel:Number.isFinite(l)?l-1:h,refine:A,basePath:n,lodMetricType:Rr.GEOMETRIC_ERROR,rootLodMetricValue:y,rootBoundingVolume:b,getTileType:Ec,getRefine:vc};return await async function(t,e,n,r,i){if(!t)return null;const{children:s,contentUrl:o}=await yc({subtree:n,implicitOptions:r,loaderOptions:i});let a,c=null;return o&&(a=o,c={uri:o.replace(`${e}/`,"")}),{...t,id:a,contentUrl:a,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:Ec(t,a),refine:vc(t.refine),content:c||t.content,children:s}}(t,n,m,C,i)}function Mc(t){var e;return(null==t||null===(e=t.extensions)||void 0===e?void 0:e["3DTILES_implicit_tiling"])||(null==t?void 0:t.implicitTiling)}const Ic={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Or,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=e["3d-tiles"]||{};let i;return i="auto"===r.isTileset?(null==n?void 0:n.url)&&-1!==n.url.indexOf(".json"):r.isTileset,i?Sc(t,e,n):Rc(t,e,n)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function Sc(t,e,n){var r;const i=JSON.parse((new TextDecoder).decode(t)),s=(null==n?void 0:n.url)||"",o=function(t){return W(t)}(s),a=await async function(t,e,n){let r=null;const i=Mc(t.root);r=i&&t.root?await xc(t.root,t,e,i,n):_c(t.root,e);const s=[];for(s.push(r);s.length>0;){const r=s.pop()||{},i=r.children||[],o=[];for(const r of i){const i=Mc(r);let a;a=i?await xc(r,t,e,i,n):_c(r,e),a&&(o.push(a),s.push(a))}r.children=o}return r}(i,o,e||{});return{...i,shape:"tileset3d",loader:Ic,url:s,queryString:(null==n?void 0:n.queryString)||"",basePath:o,root:a||i.root,type:Sr.TILES3D,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:(null===(r=i.root)||void 0===r?void 0:r.geometricError)||0}}async function Rc(t,e,n){const r={content:{shape:"tile3d",featureIds:null}};return await Ia(t,0,e,n,r.content),r.content}const Oc="https://api.cesium.com/v1/assets";async function Fc(t,e){if(!e){const n=await async function(t){o(t);const e={Authorization:`Bearer ${t}`},n=await dt("https://api.cesium.com/v1/assets",{headers:e});if(!n.ok)throw new Error(n.statusText);return await n.json()}(t);for(const t of n.items)"3DTILES"===t.type&&(e=t.id)}const n=await async function(t,e){o(t,e);const n={Authorization:`Bearer ${t}`},r=`${Oc}/${e}`;let i=await dt(`${r}`,{headers:n});if(!i.ok)throw new Error(i.statusText);let s=await i.json();if(i=await dt(`${r}/endpoint`,{headers:n}),!i.ok)throw new Error(i.statusText);const a=await i.json();return s={...s,...a},s}(t,e),{type:r,url:i}=n;return o("3DTILES"===r&&i),n.headers={Authorization:`Bearer ${n.accessToken}`},n}const Dc={...Ic,id:"cesium-ion",name:"Cesium Ion",preload:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e["cesium-ion"]||{};const{accessToken:n}=e;let r=e.assetId;if(!Number.isFinite(r)){const e=t.match(/\/([0-9]+)\/tileset.json/);r=e&&e[1]}return Fc(n,r)},parse:async(t,e,n)=>((e={...e})["3d-tiles"]=e["cesium-ion"],e.loader=Dc,Ic.parse(t,e,n)),options:{"cesium-ion":{...Ic.options["3d-tiles"],accessToken:null}}};class Gc{constructor(t,e){if(this.schema=void 0,this.options=void 0,this.shape=void 0,this.length=0,this.rows=null,this.cursor=0,this._headers=[],this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;return t?(t=t.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}}class Lc{constructor(t,e){if(this.schema=void 0,this.options=void 0,this.length=0,this.objectRows=null,this.arrayRows=null,this.cursor=0,this._headers=null,this.options=e,this.schema=t,t){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||(this._headers=function(t){const e=[];for(let n=0;n0?this.allocated*=2:100,this.columns={};for(const t in this.schema){const e=this.schema[t],n=e.type||Float32Array,r=this.columns[e.index];if(r&&ArrayBuffer.isView(r)){const t=new n(this.allocated);t.set(r),this.columns[e.index]=t}else r?(r.length=this.allocated,this.columns[e.index]=r):this.columns[e.index]=new n(this.allocated)}}}_pruneColumns(){for(const[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}}const Nc={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0};class Pc{constructor(t,e){this.schema=void 0,this.options=void 0,this.aggregator=null,this.batchCount=0,this.bytesUsed=0,this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),this.totalLength=0,this.totalBytes=0,this.rowBytes=0,this.schema=t,this.options={...Nc,...e}}limitReached(){var t,e;return!!(null!==(t=this.options)&&void 0!==t&&t.limit&&this.totalLength>=this.options.limit||null!==(e=this.options)&&void 0!==e&&e._limitMB&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),"string"==typeof t&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?8*t.length:8*Object.keys(t).length}_isFull(){if(!this.aggregator||0===this.aggregator.rowCount())return!1;if("auto"===this.options.batchSize){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return!(this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs||(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),0))}_getBatch(t){if(!this.aggregator)return null;null!=t&&t.bytesUsed&&(this.bytesUsed=t.bytesUsed);const e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return Lc;case"columnar-table":return Uc;case"arrow-table":if(!Pc.ArrowBatch)throw new Error("TableBatchBuilder");return Pc.ArrowBatch;default:return Gc}}}Pc.ArrowBatch=void 0;const Hc=Number.MAX_SAFE_INTEGER;var Jc=function(t){return t[t.BEGIN=0]="BEGIN",t[t.VALUE=1]="VALUE",t[t.OPEN_OBJECT=2]="OPEN_OBJECT",t[t.CLOSE_OBJECT=3]="CLOSE_OBJECT",t[t.OPEN_ARRAY=4]="OPEN_ARRAY",t[t.CLOSE_ARRAY=5]="CLOSE_ARRAY",t[t.TEXT_ESCAPE=6]="TEXT_ESCAPE",t[t.STRING=7]="STRING",t[t.BACKSLASH=8]="BACKSLASH",t[t.END=9]="END",t[t.OPEN_KEY=10]="OPEN_KEY",t[t.CLOSE_KEY=11]="CLOSE_KEY",t[t.TRUE=12]="TRUE",t[t.TRUE2=13]="TRUE2",t[t.TRUE3=14]="TRUE3",t[t.FALSE=15]="FALSE",t[t.FALSE2=16]="FALSE2",t[t.FALSE3=17]="FALSE3",t[t.FALSE4=18]="FALSE4",t[t.NULL=19]="NULL",t[t.NULL2=20]="NULL2",t[t.NULL3=21]="NULL3",t[t.NUMBER_DECIMAL_POINT=22]="NUMBER_DECIMAL_POINT",t[t.NUMBER_DIGIT=23]="NUMBER_DIGIT",t}(Jc||{});const jc=101,kc=/[\\"\n]/g,Vc={onready:()=>{},onopenobject:()=>{},onkey:()=>{},oncloseobject:()=>{},onopenarray:()=>{},onclosearray:()=>{},onvalue:()=>{},onerror:()=>{},onend:()=>{},onchunkparsed:()=>{}};class Kc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=Vc,this.bufferCheckPosition=Hc,this.q="",this.c="",this.p="",this.closed=!1,this.closedRoot=!1,this.sawRoot=!1,this.error=null,this.state=Jc.BEGIN,this.stack=[],this.position=0,this.column=0,this.line=1,this.slashed=!1,this.unicodeI=0,this.unicodeS=null,this.depth=0,this.textNode=void 0,this.numberNode=void 0,this.options={...Vc,...t},this.textNode=void 0,this.numberNode="",this.emit("onready")}end(){return(this.state!==Jc.VALUE||0!==this.depth)&&this._error("Unexpected end"),this._closeValue(),this.c="",this.closed=!0,this.emit("onend"),this}resume(){return this.error=null,this}close(){return this.write(null)}emit(t,e){var n,r;null===(n=(r=this.options)[t])||void 0===n||n.call(r,e,this)}emitNode(t,e){this._closeValue(),this.emit(t,e)}write(t){if(this.error)throw this.error;if(this.closed)return this._error("Cannot write after close. Assign an onready handler.");if(null===t)return this.end();let e=0,n=t.charCodeAt(0),r=this.p;for(;n&&(r=n,this.c=n=t.charCodeAt(e++),r!==n?this.p=r:r=this.p,n);)switch(this.position++,10===n?(this.line++,this.column=0):this.column++,this.state){case Jc.BEGIN:123===n?this.state=Jc.OPEN_OBJECT:91===n?this.state=Jc.OPEN_ARRAY:Qc(n)||this._error("Non-whitespace before {[.");continue;case Jc.OPEN_KEY:case Jc.OPEN_OBJECT:if(Qc(n))continue;if(this.state===Jc.OPEN_KEY)this.stack.push(Jc.CLOSE_KEY);else{if(125===n){this.emit("onopenobject"),this.depth++,this.emit("oncloseobject"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;continue}this.stack.push(Jc.CLOSE_OBJECT)}34===n?this.state=Jc.STRING:this._error('Malformed object key should start with "');continue;case Jc.CLOSE_KEY:case Jc.CLOSE_OBJECT:if(Qc(n))continue;58===n?(this.state===Jc.CLOSE_OBJECT?(this.stack.push(Jc.CLOSE_OBJECT),this._closeValue("onopenobject"),this.depth++):this._closeValue("onkey"),this.state=Jc.VALUE):125===n?(this.emitNode("oncloseobject"),this.depth--,this.state=this.stack.pop()||Jc.VALUE):44===n?(this.state===Jc.CLOSE_OBJECT&&this.stack.push(Jc.CLOSE_OBJECT),this._closeValue(),this.state=Jc.OPEN_KEY):this._error("Bad object");continue;case Jc.OPEN_ARRAY:case Jc.VALUE:if(Qc(n))continue;if(this.state===Jc.OPEN_ARRAY){if(this.emit("onopenarray"),this.depth++,this.state=Jc.VALUE,93===n){this.emit("onclosearray"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;continue}this.stack.push(Jc.CLOSE_ARRAY)}34===n?this.state=Jc.STRING:123===n?this.state=Jc.OPEN_OBJECT:91===n?this.state=Jc.OPEN_ARRAY:116===n?this.state=Jc.TRUE:102===n?this.state=Jc.FALSE:110===n?this.state=Jc.NULL:45===n?this.numberNode+="-":48<=n&&n<=57?(this.numberNode+=String.fromCharCode(n),this.state=Jc.NUMBER_DIGIT):this._error("Bad value");continue;case Jc.CLOSE_ARRAY:if(44===n)this.stack.push(Jc.CLOSE_ARRAY),this._closeValue("onvalue"),this.state=Jc.VALUE;else if(93===n)this.emitNode("onclosearray"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;else{if(Qc(n))continue;this._error("Bad array")}continue;case Jc.STRING:void 0===this.textNode&&(this.textNode="");let i=e-1,s=this.slashed,o=this.unicodeI;t:for(;;){for(;o>0;)if(this.unicodeS+=String.fromCharCode(n),n=t.charCodeAt(e++),this.position++,4===o?(this.textNode+=String.fromCharCode(parseInt(this.unicodeS,16)),o=0,i=e-1):o++,!n)break t;if(34===n&&!s){this.state=this.stack.pop()||Jc.VALUE,this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}if(92===n&&!s&&(s=!0,this.textNode+=t.substring(i,e-1),this.position+=e-1-i,n=t.charCodeAt(e++),this.position++,!n))break;if(s){if(s=!1,110===n?this.textNode+="\n":114===n?this.textNode+="\r":116===n?this.textNode+="\t":102===n?this.textNode+="\f":98===n?this.textNode+="\b":117===n?(o=1,this.unicodeS=""):this.textNode+=String.fromCharCode(n),n=t.charCodeAt(e++),this.position++,i=e-1,n)continue;break}kc.lastIndex=e;const r=kc.exec(t);if(null===r){e=t.length+1,this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}if(e=r.index+1,n=t.charCodeAt(r.index),!n){this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}}this.slashed=s,this.unicodeI=o;continue;case Jc.TRUE:114===n?this.state=Jc.TRUE2:this._error(`Invalid true started with t${n}`);continue;case Jc.TRUE2:117===n?this.state=Jc.TRUE3:this._error(`Invalid true started with tr${n}`);continue;case Jc.TRUE3:n===jc?(this.emit("onvalue",!0),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid true started with tru${n}`);continue;case Jc.FALSE:97===n?this.state=Jc.FALSE2:this._error(`Invalid false started with f${n}`);continue;case Jc.FALSE2:108===n?this.state=Jc.FALSE3:this._error(`Invalid false started with fa${n}`);continue;case Jc.FALSE3:115===n?this.state=Jc.FALSE4:this._error(`Invalid false started with fal${n}`);continue;case Jc.FALSE4:n===jc?(this.emit("onvalue",!1),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid false started with fals${n}`);continue;case Jc.NULL:117===n?this.state=Jc.NULL2:this._error(`Invalid null started with n${n}`);continue;case Jc.NULL2:108===n?this.state=Jc.NULL3:this._error(`Invalid null started with nu${n}`);continue;case Jc.NULL3:108===n?(this.emit("onvalue",null),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid null started with nul${n}`);continue;case Jc.NUMBER_DECIMAL_POINT:46===n?(this.numberNode+=".",this.state=Jc.NUMBER_DIGIT):this._error("Leading zero not followed by .");continue;case Jc.NUMBER_DIGIT:48<=n&&n<=57?this.numberNode+=String.fromCharCode(n):46===n?(-1!==this.numberNode.indexOf(".")&&this._error("Invalid number has two dots"),this.numberNode+="."):n===jc||69===n?((-1!==this.numberNode.indexOf("e")||-1!==this.numberNode.indexOf("E"))&&this._error("Invalid number has two exponential"),this.numberNode+="e"):43===n||45===n?(r===jc||69===r||this._error("Invalid symbol in number"),this.numberNode+=String.fromCharCode(n)):(this._closeNumber(),e--,this.state=this.stack.pop()||Jc.VALUE);continue;default:this._error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&function(t){const e=Math.max(Hc,10);let n=0;for(const r of["textNode","numberNode"]){const i=void 0===t[r]?0:t[r].length;i>e&&("text"===r||t._error(`Max buffer length exceeded: ${r}`)),n=Math.max(n,i)}t.bufferCheckPosition=Hc-n+t.position}(this),this.emit("onchunkparsed"),this}_closeValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"onvalue";void 0!==this.textNode&&this.emit(t,this.textNode),this.textNode=void 0}_closeNumber(){this.numberNode&&this.emit("onvalue",parseFloat(this.numberNode)),this.numberNode=""}_error(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this._closeValue(),t+=`\nLine: ${this.line}\nColumn: ${this.column}\nChar: ${this.c}`;const e=new Error(t);this.error=e,this.emit("onerror",e)}}function Qc(t){return 13===t||10===t||32===t||9===t}class zc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.path=void 0,this.path=["$"],t instanceof zc)this.path=[...t.path];else if(Array.isArray(t))this.path.push(...t);else if("string"==typeof t&&(this.path=t.split("."),"$"!==this.path[0]))throw new Error("JSONPaths must start with $")}clone(){return new zc(this)}toString(){return this.path.join(".")}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let e=0;e{this.jsonpath=new zc,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:t=>{this._openObject({}),typeof t<"u"&&this.parser.emit("onkey",t)},onkey:t=>{this.jsonpath.set(t),this.currentState.key=t},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:t=>{this._pushOrSet(t)},onerror:t=>{throw t},onend:()=>{this.result=this.currentState.container.pop()},...t})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new zc}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){const{container:e,key:n}=this.currentState;null!==n?(e[n]=t,this.currentState.key=null):e.push(t)}_openArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}}{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath())return this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],void this._openArray(this.streamingArray);this._openArray()},onopenobject:t=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof t<"u"&&this.parser.emit("onkey",t)}}),this.jsonPaths=void 0,this.streamingJsonPath=null,this.streamingArray=null,this.topLevelObject=null;const e=t.jsonpaths||[];this.jsonPaths=e.map((t=>new zc(t)))}write(t){super.write(t);let e=[];return this.streamingArray&&(e=[...this.streamingArray],this.streamingArray.length=0),e}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){const t=this.getJsonPath();if(0===this.jsonPaths.length)return!0;for(const e of this.jsonPaths)if(e.equals(t))return!0;return!1}}const Wc={x:0,y:1,z:2};function Yc(t,e={}){const{start:n=0,end:r=t.length,plane:i="xy"}=e,s=e.size||2;let o=0;const a=Wc[i[0]],c=Wc[i[1]];for(let e=n,i=r-s;e=e;a-=r)c=yh(a,t[a+h],t[a+l],c);return c&&dh(c,c.next)&&(Bh(c),c=c.next),c}function Zc(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!dh(r,r.next)&&0!==uh(r.prev,r,r.next))r=r.next;else{if(Bh(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function $c(t,e,n,r,i,s,o){if(!t)return;!o&&s&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=ah(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n,r,i,s,o,a,c,h=1;do{for(i=t,t=null,c=null,r=0;i;){for(r++,o=i,s=0,n=0;n0||a>0&&o;)0!==s&&(0===a||!o||i.z<=o.z)?(e=i,i=i.nextZ,s--):(e=o,o=o.nextZ,a--),c?c.nextZ=e:t=e,e.prevZ=c,c=e;i=o}c.nextZ=null,h*=2}while(r>1)}(i)}(t,r,i,s);let a,c,h=t;for(;t.prev!==t.next;)if(a=t.prev,c=t.next,s?eh(t,r,i,s):th(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Bh(t),t=c.next,h=c.next;else if((t=c)===h){o?1===o?$c(t=nh(Zc(t),e,n),e,n,r,i,s,2):2===o&&rh(t,e,n,r,i,s):$c(Zc(t),e,n,r,i,s,1);break}}function th(t){const e=t.prev,n=t,r=t.next;if(uh(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,c=n.y,h=r.y,l=is?i>o?i:o:s>o?s:o,f=a>c?a>h?a:h:c>h?c:h;let m=r.next;for(;m!==e;){if(m.x>=l&&m.x<=d&&m.y>=u&&m.y<=f&&hh(i,a,s,c,o,h,m.x,m.y)&&uh(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function eh(t,e,n,r){const i=t.prev,s=t,o=t.next;if(uh(i,s,o)>=0)return!1;const a=i.x,c=s.x,h=o.x,l=i.y,u=s.y,d=o.y,f=ac?a>h?a:h:c>h?c:h,g=l>u?l>d?l:d:u>d?u:d,A=ah(f,m,e,n,r),y=ah(p,g,e,n,r);let B=t.prevZ,b=t.nextZ;for(;B&&B.z>=A&&b&&b.z<=y;){if(B.x>=f&&B.x<=p&&B.y>=m&&B.y<=g&&B!==i&&B!==o&&hh(a,l,c,u,h,d,B.x,B.y)&&uh(B.prev,B,B.next)>=0||(B=B.prevZ,b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&hh(a,l,c,u,h,d,b.x,b.y)&&uh(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;B&&B.z>=A;){if(B.x>=f&&B.x<=p&&B.y>=m&&B.y<=g&&B!==i&&B!==o&&hh(a,l,c,u,h,d,B.x,B.y)&&uh(B.prev,B,B.next)>=0)return!1;B=B.prevZ}for(;b&&b.z<=y;){if(b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&hh(a,l,c,u,h,d,b.x,b.y)&&uh(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function nh(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!dh(i,s)&&fh(i,r,r.next,s)&&gh(i,s)&&gh(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Bh(r),Bh(r.next),r=t=s),r=r.next}while(r!==t);return Zc(r)}function rh(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&lh(o,t)){let a=Ah(o,t);return o=Zc(o,o.next),a=Zc(a,a.next),$c(o,e,n,r,i,s,0),void $c(a,e,n,r,i,s,0)}t=t.next}o=o.next}while(o!==t)}function ih(t,e){return t.x-e.x}function sh(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let s,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o&&(o=t,s=n.x=n.x&&n.x>=c&&r!==n.x&&hh(is.x||n.x===s.x&&oh(s,n)))&&(s=n,u=l)),n=n.next}while(n!==a);return s}(t,e);if(!n)return e;const r=Ah(n,t);return Zc(r,r.next),Zc(n,n.next)}function oh(t,e){return uh(t.prev,t,e.prev)<0&&uh(e.next,t,t.next)<0}function ah(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ch(t){let e=t,n=t;do{(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function lh(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&fh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(gh(t,e)&&gh(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(uh(t.prev,t,e.prev)||uh(t,e.prev,e))||dh(t,e)&&uh(t.prev,t,t.next)>0&&uh(e.prev,e,e.next)>0)}function uh(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function dh(t,e){return t.x===e.x&&t.y===e.y}function fh(t,e,n,r){const i=ph(uh(t,e,n)),s=ph(uh(t,e,r)),o=ph(uh(n,r,t)),a=ph(uh(n,r,e));return!!(i!==s&&o!==a||0===i&&mh(t,n,e)||0===s&&mh(t,r,e)||0===o&&mh(n,t,r)||0===a&&mh(n,e,r))}function mh(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ph(t){return t>0?1:t<0?-1:0}function gh(t,e){return uh(t.prev,t,t.next)<0?uh(t,e,t.next)>=0&&uh(t,t.prev,e)>=0:uh(t,e,t.prev)<0||uh(t,t.next,e)<0}function Ah(t,e){const n=new bh(t.i,t.x,t.y),r=new bh(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function yh(t,e,n,r){const i=new bh(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Bh(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}class bh{constructor(t,e,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=n}}function Ch(t,e,n){const r=function(t){const e={};for(const n of t)if(n.properties)for(const t in n.properties){const r=n.properties[t];e[t]=Ih(r,e[t])}return e}(t),i=Object.keys(r).filter((t=>r[t]!==Array));return function(t,e,n){const{pointPositionsCount:r,pointFeaturesCount:i,linePositionsCount:s,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:h,polygonRingsCount:l,polygonFeaturesCount:u,propArrayTypes:d,coordLength:f}=e,{numericPropKeys:m=[],PositionDataType:p=Float32Array,triangulate:g=!0}=n,A=t[0]&&"id"in t[0],y=t.length>65535?Uint32Array:Uint16Array,B={type:"Point",positions:new p(r*f),globalFeatureIds:new y(r),featureIds:i>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},b={type:"LineString",pathIndices:s>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new p(s*f),globalFeatureIds:new y(s),featureIds:a>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},C={type:"Polygon",polygonIndices:c>65535?new Uint32Array(h+1):new Uint16Array(h+1),primitivePolygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new p(c*f),globalFeatureIds:new y(c),featureIds:u>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};g&&(C.triangles=[]);for(const t of[B,b,C])for(const e of m){const n=d[e];t.numericProps[e]=new n(t.positions.length/f)}b.pathIndices[o]=s,C.polygonIndices[h]=c,C.primitivePolygonIndices[l]=c;const w={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(const e of t){const t=e.geometry,n=e.properties||{};switch(t.type){case"Point":wh(t,B,w,f,n),B.properties.push(Mh(n,m)),A&&B.fields.push({id:e.id}),w.pointFeature++;break;case"LineString":Eh(t,b,w,f,n),b.properties.push(Mh(n,m)),A&&b.fields.push({id:e.id}),w.lineFeature++;break;case"Polygon":vh(t,C,w,f,n),C.properties.push(Mh(n,m)),A&&C.fields.push({id:e.id}),w.polygonFeature++;break;default:throw new Error("Invalid geometry type")}w.feature++}return function(t,e,n,r){const i={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:r},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:_h(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:r},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:_h(e.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:_h(n.numericProps,1)}};return i.polygons&&n.triangles&&(i.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),i}(B,b,C,f)}(t,{propArrayTypes:r,...e},{numericPropKeys:n&&n.numericPropKeys||i,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:!n||n.triangulate})}function wh(t,e,n,r,i){e.positions.set(t.data,n.pointPosition*r);const s=t.data.length/r;xh(e,i,n.pointPosition,s),e.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+s),e.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+s),n.pointPosition+=s}function Eh(t,e,n,r,i){e.positions.set(t.data,n.linePosition*r);const s=t.data.length/r;xh(e,i,n.linePosition,s),e.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+s),e.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+s);for(let i=0,s=t.indices.length;i80*n){d=l=t[0],f=u=t[1];for(let e=n;el&&(l=m),p>u&&(u=p);h=Math.max(l-d,u-f),h=0!==h?32767/h:0}return $c(a,c,n,d,f,h,0),c}(h,n.slice(1).map((t=>(t-l)/o)),o,e);for(let e=0,n=u.length;e0?Math.max(...l):2,pointPositionsCount:e,pointFeaturesCount:n,linePositionsCount:r,linePathsCount:i,lineFeaturesCount:s,polygonPositionsCount:o,polygonObjectsCount:a,polygonRingsCount:c,polygonFeaturesCount:h}}function Rh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{coordLength:2,fixRingWinding:!0};return t.map((t=>Gh(t,e)))}function Oh(t,e,n,r){n.push(e.length),e.push(...t);for(let n=t.length;nt.slice(0,2))).flat());const r=t<0;i.fixRingWinding&&(0===s&&!r||s>0&&r)&&(n.reverse(),t=-t),o.push(t),Fh(n,e,a,i),s++}s>0&&(r.push(o),n.push(a))}function Gh(t,e){const{geometry:n}=t;if("GeometryCollection"===n.type)throw new Error("GeometryCollection type not supported");const r=[],i=[];let s,o;switch(n.type){case"Point":o="Point",Oh(n.coordinates,r,i,e);break;case"MultiPoint":o="Point",n.coordinates.map((t=>Oh(t,r,i,e)));break;case"LineString":o="LineString",Fh(n.coordinates,r,i,e);break;case"MultiLineString":o="LineString",n.coordinates.map((t=>Fh(t,r,i,e)));break;case"Polygon":o="Polygon",s=[],Dh(n.coordinates,r,i,s,e);break;case"MultiPolygon":o="Polygon",s=[],n.coordinates.map((t=>Dh(t,r,i,s,e)));break;default:throw new Error(`Unknown type: ${o}`)}return{...t,geometry:{type:o,indices:i,data:r,areas:s}}}function Lh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fixRingWinding:!0,triangulate:!0};const n=Sh(t),r=n.coordLength,{fixRingWinding:i}=e,s=Rh(t,{coordLength:r,fixRingWinding:i});return Ch(s,n,{numericPropKeys:e.numericPropKeys,PositionDataType:e.PositionDataType||Float32Array,triangulate:e.triangulate})}const Uh={name:"GeoJSON",id:"geojson",module:"geojson",version:"4.1.4",worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"object-row-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}},parse:async function(t,e){return Nh((new TextDecoder).decode(t),e)},parseTextSync:Nh,parseInBatches:function(t,e){(e={...Uh.options,...e}).json={...Uh.options.geojson,...e.geojson};const n=async function*(t,e){const n=function(t){try{let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){const n=new TextDecoder(void 0,e);for await(const e of t)yield"string"==typeof e?e:n.decode(e,{stream:!0})}()}catch(t){return Promise.reject(t)}}(t),{metadata:r}=e,{jsonpaths:i}=e.json||{};let s=!0;const o=new Pc(null,e),a=new qc({jsonpaths:i});for await(const t of n){const n=a.write(t),i=n.length>0&&a.getStreamingJsonPathAsString();var c;n.length>0&&s&&(r&&(yield{shape:(null==e||null===(c=e.json)||void 0===c?void 0:c.shape)||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:a.getPartialResult(),jsonpath:i}),s=!1);for(const t of n){o.addRow(t);const e=o.getFullBatch({jsonpath:i});e&&(yield e)}o.chunkComplete(t);const h=o.getFullBatch({jsonpath:i});h&&(yield h)}const h=a.getStreamingJsonPathAsString(),l=o.getFinalBatch({jsonpath:h});l&&(yield l),r&&(yield{shape:"json",batchType:"final-result",container:a.getPartialResult(),jsonpath:a.getStreamingJsonPathAsString(),data:[],length:0})}(t,e);return"binary"===e.gis.format?async function*(t){for await(const e of t)e.data=Lh(e.data),yield e}(n):n}};function Nh(t,e){var n;let r;(e={...Uh.options,...e}).geojson={...Uh.options.geojson,...e.geojson},e.gis=e.gis||{};try{r=JSON.parse(t)}catch{r={}}const i={shape:"geojson-table",type:"FeatureCollection",features:(null===(n=r)||void 0===n?void 0:n.features)||[]};return"binary"===e.gis.format?Lh(i.features):i}function Ph(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const Hh={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class Jh{constructor(t={}){n(this,"props"),n(this,"stats"),n(this,"activeRequestCount",0),n(this,"requestQueue",[]),n(this,"requestMap",new Map),n(this,"updateTimer",null),this.props={...Hh,...t},this.stats=new V({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(t,e=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const n={handle:t,priority:0,getPriority:e},r=new Promise((t=>(n.resolve=t,n)));return this.requestQueue.push(n),this.requestMap.set(t,r),this._issueNewRequests(),r}_issueRequest(t){const{handle:e,resolve:n}=t;let r=!1;const i=()=>{r||(r=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:i}):Promise.resolve({done:i})}_issueNewRequests(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout((()=>this._issueNewRequestsAsync()),this.props.debounceTime)}_issueNewRequestsAsync(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=null;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let e=0;et.priority-e.priority))}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0&&(t.resolve(null),1))}}class jh{constructor(t,e,r){n(this,"item"),n(this,"previous"),n(this,"next"),this.item=t,this.previous=e,this.next=r}}class kh{constructor(){n(this,"head",null),n(this,"tail",null),n(this,"_length",0)}get length(){return this._length}add(t){const e=new jh(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),++this._length,e}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,e){t!==e&&(this.remove(e),this._insert(t,e))}_insert(t,e){const n=t.next;t.next=e,this.tail===t?this.tail=e:n.previous=e,e.next=n,e.previous=t,++this._length}}class Vh{constructor(){n(this,"_list"),n(this,"_sentinel"),n(this,"_trimTiles"),this._list=new kh,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){const e=t._cacheNode;e&&this._list.splice(this._sentinel,e)}add(t,e,n){e._cacheNode||(e._cacheNode=this._list.add(e),n&&n(t,e))}unloadTile(t,e,n){const r=e._cacheNode;r&&(this._list.remove(r),e._cacheNode=null,n&&n(t,e))}unloadTiles(t,e){const n=this._trimTiles;this._trimTiles=!1;const r=this._list,i=1024*t.maximumMemoryUsage*1024,s=this._sentinel;let o=r.head;for(;o!==s&&(t.gpuMemoryUsageInBytes>i||n);){const n=o.item;o=o.next,this.unloadTile(t,n,e)}}trim(){this._trimTiles=!0}}const Kh=new Qe,Qh=new Qe,zh=new ir([new tr,new tr,new tr,new tr,new tr,new tr]);function qh(t,e){const{cameraDirection:n,cameraUp:r,height:i}=t,{metersPerUnit:s}=t.distanceScales,o=Yh(t,t.center),a=Hn.WGS84.eastNorthUpToFixedFrame(o),c=t.unprojectPosition(t.cameraPosition),h=Hn.WGS84.cartographicToCartesian(c,new Qe),l=new Qe(a.transformAsVector(new Qe(n).scale(s))).normalize(),u=new Qe(a.transformAsVector(new Qe(r).scale(s))).normalize();!function(t){const e=t.getFrustumPlanes(),n=Wh(e.near,t.cameraPosition),r=Yh(t,n),i=Yh(t,t.cameraPosition,Qh);let s=0;zh.planes[s++].fromPointNormal(r,Kh.copy(r).subtract(i));for(const i in e){if("near"===i)continue;const o=Yh(t,Wh(e[i],n,Qh),Qh);zh.planes[s++].fromPointNormal(o,Kh.copy(r).subtract(o))}}(t);const d=t.constructor,{longitude:f,latitude:m,width:p,bearing:g,zoom:A}=t;return{camera:{position:h,direction:l,up:u},viewport:t,topDownViewport:new d({longitude:f,latitude:m,height:i,width:p,bearing:g,zoom:A,pitch:0}),height:i,cullingVolume:zh,frameNumber:e,sseDenominator:1.15}}function Wh(t,e,n=new Qe){const r=t.normal.dot(e);return n.copy(t.normal).scale(t.distance-r).add(e),n}function Yh(t,e,n=new Qe){const r=t.unprojectPosition(e);return Hn.WGS84.cartographicToCartesian(r,n)}const Xh=6356752.314245179,Zh=new Qe;function $h(t,e,n){Hn.WGS84.cartographicToCartesian([t.xmax,t.ymax,t.zmax],Zh);const r=Math.sqrt(Math.pow(Zh[0]-n[0],2)+Math.pow(Zh[1]-n[1],2)+Math.pow(Zh[2]-n[2],2));return Math.log2(Xh/(r+e[2]))}var tl,el,nl,rl;!function(t){t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE"}(tl||(tl={})),function(t){t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh"}(el||(el={})),function(t){t.I3S="I3S",t.TILES3D="TILES3D"}(nl||(nl={})),function(t){t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold"}(rl||(rl={}));function il(t){return null!=t}const sl=new Qe,ol=new Qe,al=new Qe,cl=new Qe,hl=new Qe,ll=new Qe,ul=new Qe,dl=new Qe;function fl(t,e,n){if(Ph(t,"3D Tile: boundingVolume must be defined"),t.box)return ml(t.box,e,n);if(t.region)return function(t){const[e,n,r,i,s,o]=t,a=Hn.WGS84.cartographicToCartesian([Ae(e),Ae(i),s],al),c=Hn.WGS84.cartographicToCartesian([Ae(r),Ae(n),o],cl),h=(new Qe).addVectors(a,c).multiplyByScalar(.5);return Hn.WGS84.cartesianToCartographic(h,hl),Hn.WGS84.cartographicToCartesian([Ae(r),hl[1],hl[2]],ll),Hn.WGS84.cartographicToCartesian([hl[0],Ae(i),hl[2]],ul),Hn.WGS84.cartographicToCartesian([hl[0],hl[1],o],dl),ml([...h,...ll.subtract(h),...ul.subtract(h),...dl.subtract(h)],new ln)}(t.region);if(t.sphere)return function(t,e,n){const r=new Qe(t[0],t[1],t[2]);e.transform(r,r);const i=e.getScale(ol),s=Math.max(Math.max(i[0],i[1]),i[2]),o=t[3]*s;return il(n)?(n.center=r,n.radius=o,n):new kn(r,o)}(t.sphere,e,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function ml(t,e,n){const r=new Qe(t[0],t[1],t[2]);e.transform(r,r);let i=[];if(10===t.length){const e=t.slice(3,6),n=new Bn;n.fromArray(t,6);const r=new Qe([1,0,0]),s=new Qe([0,1,0]),o=new Qe([0,0,1]);r.transformByQuaternion(n),r.scale(e[0]),s.transformByQuaternion(n),s.scale(e[1]),o.transformByQuaternion(n),o.scale(e[2]),i=[...r.toArray(),...s.toArray(),...o.toArray()]}else i=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];const s=e.transformAsVector(i.slice(0,3)),o=e.transformAsVector(i.slice(3,6)),a=e.transformAsVector(i.slice(6,9)),c=new $e([s[0],s[1],s[2],o[0],o[1],o[2],a[0],a[1],a[2]]);return il(n)?(n.center=r,n.halfAxes=c,n):new Xn(r,c)}function pl(t,e){Hn.WGS84.cartesianToCartographic(e,sl),t[0][0]=Math.min(t[0][0],sl[0]),t[0][1]=Math.min(t[0][1],sl[1]),t[0][2]=Math.min(t[0][2],sl[2]),t[1][0]=Math.max(t[1][0],sl[0]),t[1][1]=Math.max(t[1][1],sl[1]),t[1][2]=Math.max(t[1][2],sl[2])}new Qe,new Qe,new ln,new Qe,new Qe,new Qe;const gl=new Qe,Al=new Qe,yl=new Qe,Bl=new Qe,bl=new Qe,Cl=new ln,wl=new ln;function El(t,e){const{topDownViewport:n}=e,r=t.header.mbs[1],i=t.header.mbs[0],s=t.header.mbs[2],o=t.header.mbs[3],a=[...t.boundingVolume.center],c=n.unprojectPosition(n.cameraPosition);Hn.WGS84.cartographicToCartesian(c,gl),Al.copy(gl).subtract(a).normalize(),Hn.WGS84.eastNorthUpToFixedFrame(a,Cl),wl.copy(Cl).invert(),yl.copy(gl).transform(wl);const h=Math.sqrt(yl[0]*yl[0]+yl[1]*yl[1]),l=h*h/yl[2];Bl.copy([yl[0],yl[1],l]);const u=Bl.transform(Cl).subtract(a).normalize(),d=Al.cross(u).normalize().scale(o).add(a),f=Hn.WGS84.cartesianToCartographic(d),m=n.project([i,r,s]),p=n.project(f);return bl.copy(m).subtract(p).magnitude()}class vl{constructor(t=0){n(this,"_map",new Map),n(this,"_array"),n(this,"_length"),this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return Ph(t=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=e,this._map.set(e,t)}delete(t){const e=this._map.get(t);e>=0&&(this._array.splice(e,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){const e=this.length++;this._array[e]=t,this._map.set(t,e)}}pop(){const t=this._array[--this.length];return this._map.delete(t),t}reserve(t){Ph(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){Ph(t>=0),this.length=t}trim(t){null==t&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}}const Tl={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class _l{constructor(t){n(this,"options"),n(this,"root",null),n(this,"selectedTiles",{}),n(this,"requestedTiles",{}),n(this,"emptyTiles",{}),n(this,"lastUpdate",(new Date).getTime()),n(this,"updateDebounceTime",1e3),n(this,"_traversalStack",new vl),n(this,"_emptyTraversalStack",new vl),n(this,"_frameNumber",null),this.options={...Tl,...t}}traversalFinished(t){return!0}traverse(t,e,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,e),this._frameNumber=e.frameNumber,this.executeTraversal(t,e)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,e){const n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){const t=n.pop();let r=!1;this.canTraverse(t,e)&&(this.updateChildTiles(t,e),r=this.updateAndPushChildren(t,e,n,t.hasRenderContent?t._selectionDepth+1:t._selectionDepth));const i=t.parent,s=!(i&&!i._shouldRefine),o=!r;t.hasRenderContent?t.refine===tl.ADD?(this.loadTile(t,e),this.selectTile(t,e)):t.refine===tl.REPLACE&&(this.loadTile(t,e),o&&this.selectTile(t,e)):(this.emptyTiles[t.id]=t,this.loadTile(t,e),o&&this.selectTile(t,e)),this.touchTile(t,e),t._shouldRefine=r&&s}const r=(new Date).getTime();(this.traversalFinished(e)||r-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=r,this.options.onTraversalEnd(e))}updateChildTiles(t,e){const n=t.children;for(const t of n)this.updateTile(t,e)}updateAndPushChildren(t,e,n,r){const{loadSiblings:i,skipLevelOfDetail:s}=this.options,o=t.children;o.sort(this.compareDistanceToCamera.bind(this));const a=t.refine===tl.REPLACE&&t.hasRenderContent&&!s;let c=!1,h=!0;for(const t of o)if(t._selectionDepth=r,t.isVisibleAndInRequestVolume?(n.find(t)&&n.delete(t),n.push(t),c=!0):(a||i)&&(this.loadTile(t,e),this.touchTile(t,e)),a){let n;if(n=!!t._inRequestVolume&&(t.hasRenderContent?t.contentAvailable:this.executeEmptyTraversal(t,e)),h=h&&n,!h)return!1}return c||(h=!1),h}updateTile(t,e){this.updateTileVisibility(t,e)}selectTile(t,e){this.shouldSelectTile(t)&&(t._selectedFrame=e.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,e){this.shouldLoadTile(t)&&(t._requestedFrame=e.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,e){t.tileset._cache.touch(t),t._touchedFrame=e.frameNumber}canTraverse(t,e){return!!t.hasChildren&&(t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,e))}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,e,n=!1){let r=t._screenSpaceError;return n&&(r=t.getScreenSpaceError(e,!0)),r>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,e){const n=[];if(this.options.viewportTraversersMap)for(const t in this.options.viewportTraversersMap)this.options.viewportTraversersMap[t]===e.viewport.id&&n.push(t);else n.push(e.viewport.id);t.updateVisibility(e,n)}compareDistanceToCamera(t,e){return t._distanceToCamera-e._distanceToCamera}anyChildrenVisible(t,e){let n=!1;for(const r of t.children)r.updateVisibility(e),n=n||r.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,e){let n=!0;const r=this._emptyTraversalStack;for(r.push(t);r.length>0;){const t=r.pop(),i=!t.hasRenderContent&&this.canTraverse(t,e),s=!t.hasRenderContent&&0===t.children.length;if(!i&&!t.contentAvailable&&!s&&(n=!1),this.updateTile(t,e),t.isVisibleAndInRequestVolume||(this.loadTile(t,e),this.touchTile(t,e)),i){const e=t.children;for(const t of e)r.push(t)}}return n}}const xl=new Qe;class Ml{constructor(t,e,r,i=""){n(this,"tileset"),n(this,"header"),n(this,"id"),n(this,"url"),n(this,"parent"),n(this,"refine"),n(this,"type"),n(this,"contentUrl"),n(this,"lodMetricType","geometricError"),n(this,"lodMetricValue",0),n(this,"boundingVolume",null),n(this,"content",null),n(this,"contentState",0),n(this,"gpuMemoryUsageInBytes",0),n(this,"children",[]),n(this,"depth",0),n(this,"viewportIds",[]),n(this,"transform",new ln),n(this,"extensions",null),n(this,"implicitTiling",null),n(this,"userData",{}),n(this,"computedTransform"),n(this,"hasEmptyContent",!1),n(this,"hasTilesetContent",!1),n(this,"traverser",new _l({})),n(this,"_cacheNode",null),n(this,"_frameNumber",null),n(this,"_expireDate",null),n(this,"_expiredContent",null),n(this,"_boundingBox"),n(this,"_distanceToCamera",0),n(this,"_screenSpaceError",0),n(this,"_visibilityPlaneMask"),n(this,"_visible"),n(this,"_contentBoundingVolume"),n(this,"_viewerRequestVolume"),n(this,"_initialTransform",new ln),n(this,"_priority",0),n(this,"_selectedFrame",0),n(this,"_requestedFrame",0),n(this,"_selectionDepth",0),n(this,"_touchedFrame",0),n(this,"_centerZDepth",0),n(this,"_shouldRefine",!1),n(this,"_stackLength",0),n(this,"_visitedFrame",0),n(this,"_inRequestVolume",!1),n(this,"_lodJudge",null),this.header=e,this.tileset=t,this.id=i||e.id,this.url=e.url,this.parent=r,this.refine=this._getRefine(e.refine),this.type=e.type,this.contentUrl=e.contentUrl,this._initializeLodMetric(e),this._initializeTransforms(e),this._initializeBoundingVolumes(e),this._initializeContent(e),this._initializeRenderingState(e),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return 3===this.contentState||this.hasEmptyContent}get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return 0===this.contentState}get contentExpired(){return 4===this.contentState}get contentFailed(){return 5===this.contentState}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=function(t,e){if(t.box)return function(t){const e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],{halfAxes:n}=t,r=new Qe(n.getColumn(0)),i=new Qe(n.getColumn(1)),s=new Qe(n.getColumn(2));for(let n=0;n<2;n++){for(let n=0;n<2;n++){for(let n=0;n<2;n++)sl.copy(t.center),sl.add(r),sl.add(i),sl.add(s),pl(e,sl),s.negate();i.negate()}r.negate()}return e}(e);if(t.region){const[e,n,r,i,s,o]=t.region;return[[Ae(e),Ae(n),s],[Ae(r),Ae(i),o]]}if(t.sphere)return function(t){const e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],{center:n,radius:r}=t,i=Hn.WGS84.scaleToGeodeticSurface(n,sl);let s;s=i?Hn.WGS84.geodeticSurfaceNormal(i):new Qe(0,0,1);let o=new Qe(s[2],-s[1],0);o.len()>0?o.normalize():o=new Qe(0,1,0);const a=o.clone().cross(s);for(const t of[o,a,s]){ol.copy(t).scale(r);for(let t=0;t<2;t++)sl.copy(n),sl.add(ol),pl(e,sl),ol.negate()}return e}(e);throw new Error("Unkown boundingVolume type")}(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,e){switch(this.tileset.type){case nl.I3S:return El(this,t);case nl.TILES3D:return function(t,e,n){const r=t.tileset,i=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,s=n?i:t.lodMetricValue;if(0===s)return 0;const o=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:c}=e,{viewDistanceScale:h}=r.options;let l=s*a*(h||1)/(o*c);return l-=function(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){const n=t.dynamicScreenSpaceErrorComputedDensity,r=t.dynamicScreenSpaceErrorFactor;return function(t,e){const n=t*e;return 1-Math.exp(-n*n)}(e,n)*r}return 0}(r,o),l}(this,t,e);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){const t=this.tileset._traverser,{skipLevelOfDetail:e}=t.options,n=this.refine===tl.ADD||e;if(n&&!this.isVisible&&void 0!==this._visible||this.tileset._frameNumber-this._touchedFrame>=1||0===this.contentState)return-1;const r=this.parent,i=!r||n&&0!==this._screenSpaceError&&!r.hasTilesetContent?this._screenSpaceError:r._screenSpaceError,s=t.root?t.root._screenSpaceError:0;return Math.max(s-i,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=1;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=0,!1;try{const e=this.tileset.getTileUrl(this.contentUrl),n=this.tileset.loader,r={...this.tileset.loadOptions,[n.id]:{...this.tileset.loadOptions[n.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(n.id)}};return this.content=await he(e,n,r),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=3,this._onContentLoaded(),!0}catch(t){throw this.contentState=5,t}finally{t.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=0,!0}updateVisibility(t,e){if(this._frameNumber===t.frameNumber)return;const n=this.parent,r=n?n._visibilityPlaneMask:ir.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const t=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(t)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,r),this._visible=this._visibilityPlaneMask!==ir.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=e}visibility(t,e){const{cullingVolume:n}=t,{boundingVolume:r}=this;return n.computeVisibilityWithPlaneMask(r,e)}contentVisibility(){return!0}distanceToTile(t){const e=this.boundingVolume;return Math.sqrt(Math.max(e.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){const e=this.boundingVolume;return xl.subVectors(e.center,t.position),t.direction.dot(xl)}insideViewerRequestVolume(t){const e=this._viewerRequestVolume;return!e||e.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(function(t){return null!=t}(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){const t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=4,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new ln(t.transform):new ln;const e=this.parent,n=this.tileset,r=e&&e.computedTransform?e.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new ln(r).multiplyRight(this.transform);const i=e&&e._initialTransform?e._initialTransform.clone():new ln;this._initialTransform=new ln(i).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=0,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ir.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||tl.REPLACE}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=fl(t.boundingVolume,this.computedTransform,this.boundingVolume);const e=t.content;e&&(e.boundingVolume&&(this._contentBoundingVolume=fl(e.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=fl(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new ln){const e=t.clone().multiplyRight(this.transform);e.equals(this.computedTransform)||(this.computedTransform=e,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){return"i3s"===t?{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1}:function(t){return{assetGltfUpAxis:t.asset&&t.asset.gltfUpAxis||"Y"}}(this.tileset.tileset)}}class Il extends _l{compareDistanceToCamera(t,e){return 0===e._distanceToCamera&&0===t._distanceToCamera?e._centerZDepth-t._centerZDepth:e._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,e){if(super.updateTileVisibility(t,e),!t.isVisibleAndInRequestVolume)return;const n=t.children.length>0;if(t.hasTilesetContent&&n){const n=t.children[0];return this.updateTileVisibility(n,e),void(t._visible=n._visible)}if(this.meetsScreenSpaceErrorEarly(t,e))return void(t._visible=!1);const r=t.refine===tl.REPLACE,i=1===t._optimChildrenWithinParent;r&&i&&n&&!this.anyChildrenVisible(t,e)&&(t._visible=!1)}meetsScreenSpaceErrorEarly(t,e){const{parent:n}=t;return!(!n||n.hasTilesetContent||n.refine!==tl.ADD||this.shouldRefine(t,e,!0))}}class Sl{constructor(){n(this,"frameNumberMap",new Map)}register(t,e){const n=this.frameNumberMap.get(t)||new Map,r=n.get(e)||0;n.set(e,r+1),this.frameNumberMap.set(t,n)}deregister(t,e){const n=this.frameNumberMap.get(t);if(!n)return;const r=n.get(e)||1;n.set(e,r-1)}isZero(t,e){var n;return 0===((null==(n=this.frameNumberMap.get(t))?void 0:n.get(e))||0)}}class Rl{constructor(){n(this,"_statusMap"),n(this,"pendingTilesRegister",new Sl),this._statusMap={}}add(t,e,n,r){if(!this._statusMap[e]){const{frameNumber:i,viewport:{id:s}}=r;this._statusMap[e]={request:t,callback:n,key:e,frameState:r,status:"REQUESTED"},this.pendingTilesRegister.register(s,i),t().then((t=>{this._statusMap[e].status="COMPLETED";const{frameNumber:n,viewport:{id:i}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(i,n),this._statusMap[e].callback(t,r)})).catch((t=>{this._statusMap[e].status="ERROR";const{frameNumber:r,viewport:{id:i}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(i,r),n(t)}))}}update(t,e){if(this._statusMap[t]){const{frameNumber:n,viewport:{id:r}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(r,n);const{frameNumber:i,viewport:{id:s}}=e;this.pendingTilesRegister.register(s,i),this._statusMap[t].frameState=e}}find(t){return this._statusMap[t]}hasPendingTiles(t,e){return!this.pendingTilesRegister.isZero(t,e)}}class Ol extends _l{constructor(t){super(t),n(this,"_tileManager"),this._tileManager=new Rl}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,e){return t._lodJudge=function(t,e){if(0===t.lodMetricValue||isNaN(t.lodMetricValue))return"DIG";const n=2*El(t,e);return n<2?"OUT":!t.header.children||n<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}(t,e),"DIG"===t._lodJudge}updateChildTiles(t,e){const n=t.header.children||[],r=t.children,i=t.tileset;for(const s of n){const n=`${s.id}-${e.viewport.id}`,o=r&&r.find((t=>t.id===n));if(o)o&&this.updateTile(o,e);else{let r=()=>this._loadTile(s.id,i);this._tileManager.find(n)?this._tileManager.update(n,e):(i.tileset.nodePages&&(r=()=>i.tileset.nodePagesTile.formTileFromNodePages(s.id)),this._tileManager.add(r,n,(e=>this._onTileLoad(e,t,n)),e))}}return!1}async _loadTile(t,e){const{loader:n}=e,r=e.getTileUrl(`${e.url}/nodes/${t}`),i={...e.loadOptions,i3s:{...e.loadOptions.i3s,isTileHeader:!0}};return await he(r,n,i)}_onTileLoad(t,e,n){const r=new Ml(e.tileset,t,e,n);e.children.push(r);const i=this._tileManager.find(r.id).frameState;this.updateTile(r,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||(new Date).getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(r,i)}}const Fl={description:"",ellipsoid:Hn.WGS84,modelMatrix:new ln,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Dl="Tiles In Tileset(s)",Gl="Tiles In Memory",Ll="Tiles In View",Ul="Tiles To Render",Nl="Tiles Loaded",Pl="Tiles Loading",Hl="Tiles Unloaded",Jl="Failed Tile Loads",jl="Points/Vertices",kl="Tile Memory Use",Vl="Maximum Screen Space Error";class Kl{constructor(t,e){n(this,"options"),n(this,"loadOptions"),n(this,"type"),n(this,"tileset"),n(this,"loader"),n(this,"url"),n(this,"basePath"),n(this,"modelMatrix"),n(this,"ellipsoid"),n(this,"lodMetricType"),n(this,"lodMetricValue"),n(this,"refine"),n(this,"root",null),n(this,"roots",{}),n(this,"asset",{}),n(this,"description",""),n(this,"properties"),n(this,"extras",null),n(this,"attributions",{}),n(this,"credits",{}),n(this,"stats"),n(this,"contentFormats",{draco:!1,meshopt:!1,dds:!1,ktx2:!1}),n(this,"cartographicCenter",null),n(this,"cartesianCenter",null),n(this,"zoom",1),n(this,"boundingVolume",null),n(this,"dynamicScreenSpaceErrorComputedDensity",0),n(this,"maximumMemoryUsage",32),n(this,"gpuMemoryUsageInBytes",0),n(this,"memoryAdjustedScreenSpaceError",0),n(this,"_cacheBytes",0),n(this,"_cacheOverflowBytes",0),n(this,"_frameNumber",0),n(this,"_queryParams",{}),n(this,"_extensionsUsed",[]),n(this,"_tiles",{}),n(this,"_pendingCount",0),n(this,"selectedTiles",[]),n(this,"traverseCounter",0),n(this,"geometricError",0),n(this,"lastUpdatedVieports",null),n(this,"_requestedTiles",[]),n(this,"_emptyTiles",[]),n(this,"frameStateData",{}),n(this,"_traverser"),n(this,"_cache",new Vh),n(this,"_requestScheduler"),n(this,"updatePromise",null),n(this,"tilesetInitializationPromise"),this.options={...Fl,...e},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||function(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new Jh({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=1024*this.options.maximumMemoryUsage*1024,this._cacheOverflowBytes=1024*this.options.memoryCacheOverflow*1024,this.stats=new V({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber&&0===this._requestedTiles.length}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let e=t;return this.queryParams.length&&(e=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),e}hasExtension(t){return this._extensionsUsed.indexOf(t)>-1}update(t=null){this.tilesetInitializationPromise.then((()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)}))}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise((t=>{setTimeout((()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),t(this._frameNumber),this.updatePromise=null}),this.options.debounceTime)}))),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytesthis._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;const e=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=e.length;const n=[];for(const t of e){const e=t.id;this._needTraverse(e)?n.push(e):this.traverseCounter--}for(const t of e){const e=t.id;if(this.roots[e]||(this.roots[e]=this._initializeTileHeaders(this.tileset,null)),!n.includes(e))continue;const r=qh(t,this._frameNumber);this._traverser.traverse(this.roots[e],r,this.options)}}_needTraverse(t){let e=t;return this.options.viewportTraversersMap&&(e=this.options.viewportTraversersMap[t]),e===t}_onTraversalEnd(t){const e=t.viewport.id;this.frameStateData[e]||(this.frameStateData[e]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const n=this.frameStateData[e],r=Object.values(this._traverser.selectedTiles),[i,s]=function(t,e,n){if(0===n||t.length<=n)return[t,[]];const r=[],{longitude:i,latitude:s}=e.viewport;for(const[e,n]of t.entries()){const[t,o]=n.header.mbs,a=Math.abs(i-t),c=Math.abs(s-o),h=Math.sqrt(c*c+a*a);r.push([e,h])}const o=r.sort(((t,e)=>t[1]-e[1])),a=[];for(let e=0;e0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const t in this.frameStateData){const e=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(e.selectedTiles),this._requestedTiles=this._requestedTiles.concat(e._requestedTiles),this._emptyTiles=this._emptyTiles.concat(e._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,e){if(t.length!==e.length)return!0;const n=new Set(t.map((t=>t.id))),r=new Set(e.map((t=>t.id)));let i=t.filter((t=>!r.has(t.id))).length>0;return i=i||e.filter((t=>!n.has(t.id))).length>0,i}_loadTiles(){for(const t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,((t,e)=>t._unloadTile(e)))}_updateStats(){let t=0,e=0;for(const n of this.selectedTiles)n.contentAvailable&&n.content&&(t++,n.content.pointCount?e+=n.content.pointCount:e+=n.content.vertexCount);this.stats.get(Ll).count=this.selectedTiles.length,this.stats.get(Ul).count=t,this.stats.get(jl).count=e,this.stats.get(Vl).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===nl.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===nl.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===nl.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var t;const e=this.tileset.fullExtent;if(e){const{xmin:t,xmax:n,ymin:r,ymax:i,zmin:s,zmax:o}=e;return this.cartographicCenter=new Qe(t+(n-t)/2,r+(i-r)/2,s+(o-s)/2),this.cartesianCenter=new Qe,Hn.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),void(this.zoom=$h(e,this.cartographicCenter,this.cartesianCenter))}const n=null==(t=this.tileset.store)?void 0:t.extent;if(n){const[t,e,r,i]=n;return this.cartographicCenter=new Qe(t+(r-t)/2,e+(i-e)/2,0),this.cartesianCenter=new Qe,Hn.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),void(this.zoom=function(t,e,n){const[r,i,s,o]=t;return $h({xmin:r,xmax:s,ymin:i,ymax:o,zmin:0,zmax:0},e,n)}(n,this.cartographicCenter,this.cartesianCenter))}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new Qe,this.zoom=1}calculateViewPropsTiles3D(){const t=this.root,{center:e}=t.boundingVolume;if(!e)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Qe,void(this.zoom=1);0!==e[0]||0!==e[1]||0!==e[2]?(this.cartographicCenter=new Qe,Hn.WGS84.cartesianToCartographic(e,this.cartographicCenter)):this.cartographicCenter=new Qe(0,0,-Hn.WGS84.radii[0]),this.cartesianCenter=e,this.zoom=function(t,e){if(t instanceof Xn){const{halfAxes:n}=t,r=function(t){t.getColumn(0,Zh);const e=t.getColumn(1),n=t.getColumn(2);return Zh.add(e).add(n).len()}(n);return Math.log2(Xh/(r+e[2]))}if(t instanceof kn){const{radius:n}=t;return Math.log2(Xh/(n+e[2]))}if(t.width&&t.height){const{width:e,height:n}=t;return(Math.log2(6378137/e)+Math.log2(6378137/n))/2}return 1}(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Dl),this.stats.get(Pl),this.stats.get(Gl),this.stats.get(Ll),this.stats.get(Ul),this.stats.get(Nl),this.stats.get(Hl),this.stats.get(Jl),this.stats.get(jl),this.stats.get(kl,"memory"),this.stats.get(Vl)}_initializeTileHeaders(t,e){var n;const r=new Ml(this,t.root,e);if(e&&(e.children.push(r),r.depth=e.depth+1),this.type===nl.TILES3D){const t=[];for(t.push(r);t.length>0;){const e=t.pop();this.stats.get(Dl).incrementCount();const r=e.header.children||[];for(const i of r){const r=new Ml(this,i,e);if(null!=(n=r.contentUrl)&&n.includes("?session=")){const t=new URL(r.contentUrl).searchParams.get("session");t&&(this._queryParams.session=t)}e.children.push(r),r.depth=e.depth+1,t.push(r)}}}return r}_initializeTraverser(){let t;switch(this.type){case nl.TILES3D:t=Il;break;case nl.I3S:t=Ol;break;default:t=_l}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let e;try{this._onStartTileLoading(),e=await t.loadContent()}catch(e){this._onTileLoadError(t,e instanceof Error?e:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,e)}}_onTileLoadError(t,e){this.stats.get(Jl).incrementCount();const n=e.message||e.toString(),r=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,r)}_onTileLoad(t,e){var n,r;if(e){if(this.type===nl.I3S){const t=(null==(r=null==(n=this.tileset)?void 0:n.nodePagesTile)?void 0:r.nodesInNodePages)||0;this.stats.get(Dl).reset(),this.stats.get(Dl).addCount(t)}t&&t.content&&function(t,e){Ph(t),Ph(e);const{rtcCenter:n,gltfUpAxis:r}=e,{computedTransform:i,boundingVolume:{center:s}}=t;let o=new ln(i);switch(n&&o.translate(n),r){case"Z":break;case"Y":const t=(new ln).rotateX(Math.PI/2);o=o.multiplyRight(t);break;case"X":const e=(new ln).rotateY(-Math.PI/2);o=o.multiplyRight(e)}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const a=new Qe(s);e.cartesianModelMatrix=o,e.cartesianOrigin=a;const c=Hn.WGS84.cartesianToCartographic(a,new Qe),h=Hn.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=h.multiplyRight(o),e.cartographicOrigin=c,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){var e;if(this.type===nl.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0}else if(this.type===nl.TILES3D){const{extensionsRemoved:n=[]}=(null==(e=t.content)?void 0:e.gltf)||{};n.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),n.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),n.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Pl).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Pl).decrementCount()}_addTileToCache(t){this._cache.add(this,t,(e=>e._updateCacheStats(t)))}_updateCacheStats(t){this.stats.get(Nl).incrementCount(),this.stats.get(Gl).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(kl).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Gl).decrementCount(),this.stats.get(Hl).incrementCount(),this.stats.get(kl).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){const t=[];for(this.root&&t.push(this.root);t.length>0;){const e=t.pop();for(const n of e.children)t.push(n);this._destroyTile(e)}this.root=null}_destroySubtree(t){const e=t,n=[];for(n.push(e);n.length>0;){t=n.pop();for(const e of t.children)n.push(e);t!==e&&this._destroyTile(t)}e.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){const e=new URLSearchParams(t.queryString),n=Object.fromEntries(e.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version&&"1.1"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}function Ql(e){const n=document.createElement("canvas");n.width=64,n.height=64;const r=n.getContext("2d");r.rect(0,0,64,64);const i=r.createLinearGradient(0,0,64,64);for(let t=0;tt.toString(),ru=new t.ShaderMaterial({vertexShader:nu` +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("THREE"));else if("function"==typeof define&&define.amd)define(["THREE"],e);else{var n="object"==typeof exports?e(require("THREE")):e(t.THREE);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(t=>(()=>{var e={384:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("textarea",{schema:{transparentBG:{type:"boolean",default:!1},cols:{type:"int",default:40},rows:{type:"int",default:20},color:{type:"color",default:"black"},backgroundColor:{type:"color",default:"white"},disabledBackgroundColor:{type:"color",default:"lightgrey"},disabled:{type:"boolean",default:!1},text:{type:"string",default:""}},init:function(){this.text=null,this.lines=[],this.lastBlink=0,this.blinkEnabled=!this.data.disabled,this.charWidth=this.charHeight=null,this.selectionStart=this.selectionEnd=0,this.endIndexInfo=this.startIndexInfo=null,this.origin={x:0,y:0},this.background=document.createElement("a-plane"),this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor),this.el.appendChild(this.background),this.data.transparentBG&&this.background.setAttribute("material",{opacity:0,transparent:!0}),this.textAnchor=document.createElement("a-entity"),this.el.appendChild(this.textAnchor),this.textAnchor.setAttribute("text",{mode:"pre",baseline:"top",anchor:"center",font:"dejavu",wrapCount:this.data.cols,height:this.data.rows,color:this.data.color}),this._initTextarea(),this.el.addEventListener("textfontset",this._updateCharMetrics.bind(this)),this.el.addEventListener("char-metrics-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("text-changed",this._updateLines.bind(this)),this.el.addEventListener("text-changed",this._updateDisplayText.bind(this)),this.el.addEventListener("selection-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("selection-changed",this._updateHorizontalOrigin.bind(this)),this.el.addEventListener("lines-changed",this._updateIndexInfo.bind(this)),this.el.addEventListener("index-info-changed",this._updateOrigin.bind(this)),this.el.addEventListener("index-info-changed",this._updateHorizontalOrigin.bind(this)),this.el.addEventListener("origin-changed",this._updateDisplayText.bind(this)),this.el.addEventListener("click",this.focus.bind(this))},update:function(t){this.data.text!==t.text&&this._updateTextarea(),this.data.backgroundColor===t.backgroundColor&&this.data.disabledBackgroundColor===t.disabledBackgroundColor||this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor),this.data.disabled!==t.disabled&&(this.blinkEnabled=!this.data.disabled,this.textarea.disabled=this.data.disabled,this.background.setAttribute("color",this.data.disabled?this.data.disabledBackgroundColor:this.data.backgroundColor))},focus:function(){this.textarea.focus()},_initTextarea:function(){this.textarea=document.createElement("textarea"),document.body.appendChild(this.textarea),this._updateTextarea()},_updateTextarea:function(){this.textarea.style.whiteSpace="pre",this.textarea.style.overflow="hidden",this.textarea.style.opacity="0",this.textarea.cols=this.data.cols,this.textarea.rows=this.data.rows,this.textarea.value=this.data.text,this.textarea.selectionStart=0,this.textarea.selectionEnd=0,this._updateIndexInfo()},_emit:function(t,e){this.el.emit(t,e)},_updateCharMetrics:function(t){const e=this.textAnchor.components.text.geometry.layout,n=t.detail.fontObj.widthFactor;this.charWidth=n*this.textAnchor.object3DMap.text.scale.x,this.charHeight=this.charWidth*e.lineHeight/n,this.textAnchor.setAttribute("position",{x:0,y:this.charHeight*this.data.rows/2,z:0}),this.data.transparentBG||(this.background.setAttribute("scale",{x:1.05,y:this.charHeight*this.data.rows*1.05,z:1}),this.background.setAttribute("position",{x:0,y:0,z:0})),this._emit("char-metrics-changed")},_checkAndUpdateSelection:function(){if(this.selectionStart===this.textarea.selectionStart&&this.selectionEnd===this.textarea.selectionEnd)return;const t=this.selectionStart,e=this.selectionEnd;this.selectionStart=this.textarea.selectionStart,this.selectionEnd=this.textarea.selectionEnd,this._emit("selection-changed",{start:{old:t,new:this.selectionStart,changed:this.selectionStart!==t},end:{old:e,new:this.selectionEnd,changed:this.selectionEnd!==e}})},tick:function(t){t-this.lastBlink>500&&this.blinkEnabled&&(this.lastBlink=t),this._checkAndUpdateSelection(),this._checkAndUpdateText()},_getIndexInfo:function(t,e){const n=Math.max(0,t),r=this.lines[n];return{line:r,x:(e-r.start)*this.charWidth,y:-this.charHeight*n+-this.charHeight/2}},_updateIndexInfo:function(){if(!this.lines.length)return;const t=this.startIndexInfo&&this.startIndexInfo.line.index,e=this.endIndexInfo&&this.endIndexInfo.line.index;let n;this.startIndexInfo=null,this.endIndexInfo=null;let r=!1,i=!1;for(n=0;n<=this.lines.length;n++){const s=this.lines[n-1],o=n===this.lines.length?s.start+s.length+1:this.lines[n].start;if(o>this.selectionStart&&!this.startIndexInfo&&(this.startIndexInfo=this._getIndexInfo(n-1,this.selectionStart),this.startIndexInfo.line.index!==t&&(r=!0)),o>this.selectionEnd){this.endIndexInfo=this._getIndexInfo(n-1,this.selectionEnd),this.endIndexInfo.line.index!==e&&(i=!0);break}}(r||i)&&this._emit("index-info-changed",{start:{changed:r},end:{changed:i}})},_updateOrigin:function(t){let e=!1;if(t.detail.end.changed){const t=this.origin.y+this.data.rows-1;this.endIndexInfo.line.index>t?(this.origin.y=this.endIndexInfo.line.index+1-this.data.rows,e=!0):this.endIndexInfo.line.indexthis.origin.x+this.data.cols?(this.origin.x=t-this.data.cols,e=!0):tthis.origin.x+this.data.cols?(this.origin.x=n-this.data.cols,e=!0):n{"use strict";e.exports=t}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var s=n[t]={exports:{}};return e[t](s,s.exports,r),s.exports}r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i);var t=r(824),e=Object.defineProperty,n=(t,n,r)=>(((t,n,r)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r})(t,"symbol"!=typeof n?n+"":n,r),r);async function s(t,e,n,r){return r._parse(t,e,n,r)}function o(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const a=!("object"==typeof process&&"[object process]"===String(process)&&!process.browser),c=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);function h(t,e){return l(t||{},e)}function l(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(n>3)return e;const r={...t};for(const[t,i]of Object.entries(e))i&&"object"==typeof i&&!Array.isArray(i)?r[t]=l(r[t]||{},e[t],n+1):r[t]=e[t];return r}c&&parseFloat(c[1]);const u="latest",d=(null!==(f=globalThis._loadersgl_)&&void 0!==f&&f.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.1"),globalThis._loadersgl_.version);var f;function m(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const p="object"!=typeof process||"[object process]"!==String(process)||process.browser,g="function"==typeof importScripts,A=typeof window<"u"&&typeof window.orientation<"u",y=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);y&&parseFloat(y[1]);class B{constructor(t,e){this.name=void 0,this.workerThread=void 0,this.isRunning=!0,this.result=void 0,this._resolve=()=>{},this._reject=()=>{},this.name=t,this.workerThread=e,this.result=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){m(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){m(this.isRunning),this.isRunning=!1,this._reject(t)}}class b{terminate(){}}const C=new Map;function w(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function v(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0;const r=n||new Set;if(t)if(E(t))r.add(t);else if(E(t.buffer))r.add(t.buffer);else if(!ArrayBuffer.isView(t)&&e&&"object"==typeof t)for(const n in t)v(t[n],e,r);return void 0===n?Array.from(r):[]}function E(t){return!!t&&(t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)}const T=()=>{};class _{static isSupported(){return typeof Worker<"u"&&p||typeof b<"u"&&!p}constructor(t){this.name=void 0,this.source=void 0,this.url=void 0,this.terminated=!1,this.worker=void 0,this.onMessage=void 0,this.onError=void 0,this._loadableURL="";const{name:e,source:n,url:r}=t;m(n||r),this.name=e,this.source=n,this.url=r,this.onMessage=T,this.onError=t=>console.log(t),this.worker=p?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=T,this.onError=T,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(t,e){e=e||v(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name} from ${this.url}. `,t.message&&(e+=`${t.message} in `),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=function(t){m(t.source&&!t.url||!t.source&&t.url);let e=C.get(t.source||t.url);return e||(t.url&&(e=function(t){return t.startsWith("http")?w(function(t){return`try {\n importScripts('${t}');\n} catch (error) {\n console.error(error);\n throw error;\n}`}(t)):t}(t.url),C.set(t.url,e)),t.source&&(e=w(t.source),C.set(t.source,e))),m(e),e}({source:this.source,url:this.url});const t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},t.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},t.onmessageerror=t=>console.error(t),t}_createNodeWorker(){let t;if(this.url){const e=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new b(e,{eval:!1})}else{if(!this.source)throw new Error("no worker");t=new b(this.source,{eval:!0})}return t.on("message",(t=>{this.onMessage(t)})),t.on("error",(t=>{this.onError(t)})),t.on("exit",(t=>{})),t}}class x{static isSupported(){return _.isSupported()}constructor(t){this.name="unnamed",this.source=void 0,this.url=void 0,this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1,this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach((t=>t.destroy())),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},void 0!==t.name&&(this.name=t.name),void 0!==t.maxConcurrency&&(this.maxConcurrency=t.maxConcurrency),void 0!==t.maxMobileConcurrency&&(this.maxMobileConcurrency=t.maxMobileConcurrency),void 0!==t.reuseWorkers&&(this.reuseWorkers=t.reuseWorkers),void 0!==t.onDebug&&(this.onDebug=t.onDebug)}async startJob(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(t,e,n)=>t.done(n),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(t,e)=>t.error(e);const r=new Promise((r=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:r}),this)));return this._startQueuedJob(),await r}async _startQueuedJob(){if(!this.jobQueue.length)return;const t=this._getAvailableWorker();if(!t)return;const e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});const n=new B(e.name,t);t.onMessage=t=>e.onMessage(n,t.type,t.payload),t.onError=t=>e.onError(n,t),e.onStart(n);try{await n.result}catch(t){console.error(`Worker exception: ${t}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!p||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}};class I{static isSupported(){return _.isSupported()}static getWorkerFarm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return I._workerFarm=I._workerFarm||new I({}),I._workerFarm.setProps(t),I._workerFarm}constructor(t){this.props=void 0,this.workerPools=new Map,this.props={...M},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:n,url:r}=t;let i=this.workerPools.get(e);return i||(i=new x({name:e,source:n,url:r}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}I._workerFarm=void 0;const S=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})),R={};async function O(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return e&&(t=F(t,e,n,r)),R[t]=R[t]||D(t),await R[t]}function F(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!n.useLocalLibraries&&t.startsWith("http"))return t;r=r||t;const i=n.modules||{};return i[r]?i[r]:p?n.CDN?(m(n.CDN.startsWith("http")),`${n.CDN}/${e}@${d}/dist/libs/${r}`):g?`../src/libs/${r}`:`modules/${e}/src/libs/${r}`:`modules/${e}/dist/libs/${r}`}async function D(t){if(t.endsWith("wasm"))return await async function(t){return await(await fetch(t)).arrayBuffer()}(t);if(!p)try{return S&&void 0}catch(t){return console.error(t),null}if(g)return importScripts(t);const e=await async function(t){return await(await fetch(t)).text()}(t);return function(t,e){if(!p)return;if(g)return eval.call(globalThis,t),null;const n=document.createElement("script");n.id=e;try{n.appendChild(document.createTextNode(t))}catch{n.text=t}return document.body.appendChild(n),null}(e,t)}async function G(t,e,n,r,i){const s=t.id,o=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e[t.id]||{},r=p?`${t.id}-worker.js`:`${t.id}-worker-node.js`;let i=n.workerUrl;if(!i&&"compression"===t.id&&(i=e.workerUrl),"test"===e._workerType&&(i=p?`modules/${t.module}/dist/${r}`:`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!i){let e=t.version;"latest"===e&&(e=u);const n=e?`@${e}`:"";i=`https://unpkg.com/@loaders.gl/${t.module}${n}/dist/${r}`}return m(i),i}(t,n),a=I.getWorkerFarm(n).getWorkerPool({name:s,url:o});n=JSON.parse(JSON.stringify(n)),r=JSON.parse(JSON.stringify(r||{}));const c=await a.startJob("process-on-worker",L.bind(null,i));return c.postMessage("process",{input:e,options:n,context:r}),await(await c.result).result}async function L(t,e,n,r){switch(n){case"done":e.done(r);break;case"error":e.error(new Error(r.error));break;case"process":const{id:i,input:s,options:o}=r;try{const n=await t(s,o);e.postMessage("done",{id:i,result:n})}catch(t){const n=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:i,error:n})}break;default:console.warn(`parse-with-worker unknown message ${n}`)}}function U(t,e,n){if(t.byteLength<=e+n)return"";const r=new DataView(t);let i="";for(let t=0;tt instanceof ArrayBuffer?new Uint8Array(t):t)),n=e.reduce(((t,e)=>t+e.byteLength),0),r=new Uint8Array(n);let i=0;for(const t of e)r.set(t,i),i+=t.byteLength;return r.buffer}function P(t,e,n){const r=void 0!==n?new Uint8Array(t).subarray(e,e+n):new Uint8Array(t).subarray(e);return new Uint8Array(r).buffer}function H(t,e){return o(t>=0),o(e>0),t+(e-1)&~(e-1)}function J(t,e,n){let r;if(t instanceof ArrayBuffer)r=new Uint8Array(t);else{const e=t.byteOffset,n=t.byteLength;r=new Uint8Array(t.buffer||t.arrayBuffer,e,n)}return e.set(r,n),n+H(r.byteLength,4)}function j(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){const e=process.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}class k{constructor(t,e){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=e,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=j(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(j()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class V{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t of Object.values(this.stats))t.reset();return this}forEach(t){for(const e of Object.values(this.stats))t(e)}getTable(){const t={};return this.forEach((e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}})),t}_initializeStats(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((t=>this._getOrCreate(t)))}_getOrCreate(t){const{name:e,type:n}=t;let r=this.stats[e];return r||(r=t instanceof k?t:new k(e,n),this.stats[e]=r),r}}const K={};function Q(t){if(function(t){return t&&"object"==typeof t&&t.isBuffer}(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return 0===t.byteOffset&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if("string"==typeof t){const e=t;return(new TextEncoder).encode(e).buffer}if(t&&"object"==typeof t&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}function z(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();const e=null===(t=window.location)||void 0===t?void 0:t.pathname;return(null==e?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function q(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function W(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}const Y=47;function X(t,e){let n,r="",i=-1,s=0,o=!1;for(let a=0;a<=t.length;++a){if(a2){const t=r.length-1;let e=t;for(;e>=0&&r.charCodeAt(e)!==Y;--e);if(e!==t){r=-1===e?"":r.slice(0,e),i=a,s=0,o=!1;continue}}else if(2===r.length||1===r.length){r="",i=a,s=0,o=!1;continue}e&&(r.length>0?r+="/..":r="..",o=!0)}else{const e=t.slice(i+1,a);r.length>0?r+=`/${e}`:r=e,o=!1}i=a,s=0}else 46===n&&-1!==s?++s:s=-1}return r}const Z=t=>"function"==typeof t,$=t=>null!==t&&"object"==typeof t,tt=t=>$(t)&&t.constructor==={}.constructor,et=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,nt=t=>typeof Blob<"u"&&t instanceof Blob,rt=t=>(t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||$(t)&&Z(t.tee)&&Z(t.cancel)&&Z(t.getReader))(t)||(t=>$(t)&&Z(t.read)&&Z(t.pipe)&&(t=>"boolean"==typeof t)(t.readable))(t),it=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,st=/^([-\w.]+\/[-\w.+]+)/;function ot(t){const e=it.exec(t);return e?e[1]:""}const at=/\?.*/;function ct(t){return t.replace(at,"")}function ht(t){return et(t)?t.url:nt(t)?t.name||"":"string"==typeof t?t:""}function lt(t){if(et(t)){const e=t,n=e.headers.get("content-type")||"",r=ct(e.url);return function(t){const e=st.exec(t);return e?e[1]:t}(n)||ot(r)}return nt(t)?t.type||"":"string"==typeof t?ot(t):""}async function ut(t){if(et(t))return t;const e={},n=function(t){return et(t)?t.headers["content-length"]||-1:nt(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}(t);n>=0&&(e["content-length"]=String(n));const r=ht(t),i=lt(t);i&&(e["content-type"]=i);const s=await async function(t){if("string"==typeof t)return`data:,${t.slice(0,5)}`;if(t instanceof Blob){const e=t.slice(0,5);return await new Promise((t=>{const n=new FileReader;n.onload=e=>{var n;return t(null==e||null===(n=e.target)||void 0===n?void 0:n.result)},n.readAsDataURL(e)}))}return t instanceof ArrayBuffer?`data:base64,${function(t){let e="";const n=new Uint8Array(t);for(let t=0;t=0)}()}const mt=globalThis.window||globalThis.self||globalThis.global,pt=globalThis.process||{},gt=typeof __VERSION__<"u"?__VERSION__:"untranspiled source";ft();class At{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=function(t){try{const e=window[t],n="__storage_test__";return e.setItem(n,n),e.removeItem(n),e}catch{return null}}(n),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let t={};if(this.storage){const e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}function yt(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>r&&(n=Math.min(n,r/t.width));const s=t.width*n,o=t.height*n,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(s/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(s,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}let Bt;function bt(t){return"string"!=typeof t?t:(t=t.toUpperCase(),Bt[t]||Bt.WHITE)}function Ct(t,e){if(!t)throw new Error(e||"Assertion failed")}function wt(){let t;var e,n;if(ft()&&mt.performance)t=null==mt||null===(e=mt.performance)||void 0===e||null===(n=e.now)||void 0===n?void 0:n.call(e);else if("hrtime"in pt){var r;const e=null==pt||null===(r=pt.hrtime)||void 0===r?void 0:r.call(pt);t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}!function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(Bt||(Bt={}));const vt={debug:ft()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Et={enabled:!0,level:0};function Tt(){}const _t={},xt={once:!0};class Mt{constructor(){let{id:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};this.id=void 0,this.VERSION=gt,this._startTs=wt(),this._deltaTs=wt(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new At("__probe-".concat(this.id,"__"),Et),this.timeStamp("".concat(this.id," started")),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const n=Object.getPrototypeOf(t),r=Object.getOwnPropertyNames(n),i=t;for(const n of r){const r=i[n];"function"==typeof r&&(e.find((t=>n===t))||(i[n]=r.bind(t)))}}(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((wt()-this._startTs).toPrecision(10))}getDelta(){return Number((wt()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){Ct(t,e)}warn(t){return this._getLogFunction(0,t,vt.warn,arguments,xt)}error(t){return this._getLogFunction(0,t,vt.error,arguments)}deprecated(t,e){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(e,"` instead"))}removed(t,e){return this.error("`".concat(t,"` has been removed. Use `").concat(e,"` instead"))}probe(t,e){return this._getLogFunction(t,e,vt.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,vt.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,vt.debug||vt.info,arguments,xt)}table(t,e,n){return e?this._getLogFunction(t,e,console.table||Tt,n&&[n],{tag:Rt(e)}):Tt}image(t){let{logLevel:e,priority:n,image:r,message:i="",scale:s=1}=t;return this._shouldLog(e||n)?ft()?function(t){let{image:e,message:n="",scale:r=1}=t;if("string"==typeof e){const t=new Image;return t.onload=()=>{const e=yt(t,n,r);console.log(...e)},t.src=e,Tt}const i=e.nodeName||"";if("img"===i.toLowerCase())return console.log(...yt(e,n,r)),Tt;if("canvas"===i.toLowerCase()){const t=new Image;return t.onload=()=>console.log(...yt(t,n,r)),t.src=e.toDataURL(),Tt}return Tt}({image:r,message:i,scale:s}):(console.warn("removed"),Tt):Tt}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||Tt)}group(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const r=St({logLevel:t,message:e,opts:n}),{collapsed:i}=n;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Tt)}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=It(t)}_getLogFunction(t,e,n,r,i){if(this._shouldLog(t)){i=St({logLevel:t,message:e,args:r,opts:i}),Ct(n=n||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=wt();const s=i.tag||i.message;if(i.once&&s){if(_t[s])return Tt;_t[s]=wt()}return e=function(t,e,n){if("string"==typeof e){const r=n.time?function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const n=Math.max(e-t.length,0);return"".concat(" ".repeat(n)).concat(t)}(function(t){let e;return e=t<10?"".concat(t.toFixed(2),"ms"):t<100?"".concat(t.toFixed(1),"ms"):t<1e3?"".concat(t.toFixed(0),"ms"):"".concat((t/1e3).toFixed(2),"s"),e}(n.total)):"";e=n.time?"".concat(t,": ").concat(r," ").concat(e):"".concat(t,": ").concat(e),e=function(t,e,n){if(!ft&&"string"==typeof t){if(e){const n=bt(e);t="[".concat(n,"m").concat(t,"")}if(n){const e=bt(n);t="[".concat(e+10,"m").concat(t,"")}}return t}(e,n.color,n.background)}return e}(this.id,i.message,i),n.bind(console,e,...i.args)}return Tt}}function It(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return Ct(Number.isFinite(e)&&e>=0),e}function St(t){const{logLevel:e,message:n}=t;t.logLevel=It(e);const r=t.args?Array.from(t.args):[];for(;r.length&&r.shift()!==n;);switch(typeof e){case"string":case"function":void 0!==n&&r.unshift(n),t.message=e;break;case"object":Object.assign(t,e)}"function"==typeof t.message&&(t.message=t.message());const i=typeof t.message;return Ct("string"===i||"object"===i),Object.assign(t,{args:r},t.opts)}function Rt(t){for(const e in t)for(const n in t[e])return n||"untitled";return"empty"}Mt.VERSION=gt;const Ot=new Mt({id:"@probe.gl/log"}),Ft=new Mt({id:"loaders.gl"});class Dt{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const Gt={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){this.console=void 0,this.console=console}log(){for(var t=arguments.length,e=new Array(t),n=0;n{const t=Ut();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry})()}const Kt=new Mt({id:"loaders.gl"}),Qt=/\.([^.]+)$/;function zt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!Wt(t))return null;if(e&&!Array.isArray(e))return kt(e);let i=[];e&&(i=i.concat(e)),null!=n&&n.ignoreRegisteredLoaders||i.push(...Vt()),Xt(i);const s=qt(t,i,n,r);if(!(s||null!=n&&n.nothrow))throw new Error(Yt(t));return s}function qt(t,e,n,r){const i=ht(t),s=lt(t),o=ct(i)||(null==r?void 0:r.url);let a=null,c="";var h;return null!=n&&n.mimeType&&(a=Zt(e,null==n?void 0:n.mimeType),c=`match forced by supplied MIME type ${null==n?void 0:n.mimeType}`),a=a||function(t,e){const n=e&&Qt.exec(e),r=n&&n[1];return r?function(t,e){e=e.toLowerCase();for(const n of t)for(const t of n.extensions)if(t.toLowerCase()===e)return n;return null}(t,r):null}(e,o),c=c||(a?`matched url ${o}`:""),a=a||Zt(e,s),c=c||(a?`matched MIME type ${s}`:""),a=a||function(t,e){if(!e)return null;for(const n of t)if("string"==typeof e){if($t(e,n))return n}else if(ArrayBuffer.isView(e)){if(te(e.buffer,e.byteOffset,n))return n}else if(e instanceof ArrayBuffer&&te(e,0,n))return n;return null}(e,t),c=c||(a?`matched initial data ${ee(t)}`:""),null!=n&&n.fallbackMimeType&&(a=a||Zt(e,null==n?void 0:n.fallbackMimeType),c=c||(a?`matched fallback MIME type ${s}`:"")),c&&Kt.log(1,`selectLoader selected ${null===(h=a)||void 0===h?void 0:h.name}: ${c}.`),a}function Wt(t){return!(t instanceof Response&&204===t.status)}function Yt(t){const e=ht(t),n=lt(t);let r="No valid loader found (";r+=e?`${q(e)}, `:"no url provided, ",r+=`MIME type: ${n?`"${n}"`:"not provided"}, `;const i=t?ee(t):"";return r+=i?` first bytes: "${i}"`:"first bytes: not available",r+=")",r}function Xt(t){for(const e of t)kt(e)}function Zt(t,e){for(const n of t)if(n.mimeTypes&&n.mimeTypes.includes(e)||e===`application/x.${n.id}`)return n;return null}function $t(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some((e=>t.startsWith(e)))}function te(t,e,n){return(Array.isArray(n.tests)?n.tests:[n.tests]).some((n=>function(t,e,n,r){if(r instanceof ArrayBuffer)return function(t,e,n){if(n=n||t.byteLength,t.byteLength1&&void 0!==arguments[1]?arguments[1]:5;return"string"==typeof t?t.slice(0,e):ArrayBuffer.isView(t)?ne(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?ne(t,0,e):""}function ne(t,e,n){if(t.byteLengtht&&"object"==typeof t&&t.isBuffer)(t)&&(t=t.buffer),t instanceof ArrayBuffer){const n=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let n=t.buffer;const r=t.byteLength||t.length;return(0!==t.byteOffset||r!==n.byteLength)&&(n=n.slice(t.byteOffset,t.byteOffset+r)),n}throw new Error(se)}(t,e);if(nt(t)&&(t=await ut(t)),et(t)){const n=t;return await async function(t){if(!t.ok){const e=await async function(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{const n=t.headers.get("Content-Type");let r=t.statusText;null!=n&&n.includes("application/json")&&(r+=` ${await t.text()}`),e+=r,e=e.length>60?`${e.slice(0,60)}...`:e}catch{}return e}(t);throw new Error(e)}}(n),e.binary?await n.arrayBuffer():await n.text()}if(rt(t)&&(t=function(t,e){if("string"==typeof t)return function*(t,e){const n=(null==e?void 0:e.chunkSize)||262144;let r=0;const i=new TextEncoder;for(;r1&&void 0!==arguments[1]?arguments[1]:{};return function*(){const{chunkSize:n=re}=e;let r=0;for(;r!!t&&"function"==typeof t[Symbol.iterator])(t)||(t=>t&&"function"==typeof t[Symbol.asyncIterator])(t))return async function(t){const e=[];for await(const n of t)e.push(n);return function(){for(var t=arguments.length,e=new Array(t),n=0;ndt(t,r.fetch):null!=e&&e.fetch?null==e?void 0:e.fetch:dt}async function ce(t,e,n,r){e&&!Array.isArray(e)&&!jt(e)&&(r=void 0,n=e,e=void 0),n=n||{};const i=ht(t=await t),s=function(t,e){if(t&&!Array.isArray(t))return t;let n;if(t&&(n=Array.isArray(t)?t:[t]),e&&e.loaders){const t=Array.isArray(e.loaders)?e.loaders:[e.loaders];n=n?[...n,...t]:t}return n&&n.length?n:void 0}(e,r),o=await async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!Wt(t))return null;let i=zt(t,e,{...n,nothrow:!0},r);if(i)return i;if(nt(t)&&(i=zt(t=await t.slice(0,10).arrayBuffer(),e,n,r)),!(i||null!=n&&n.nothrow))throw new Error(Yt(t));return i}(t,s,n);return o?(r=function(t,e,n){if(n)return n;const r={fetch:ae(e,t),...t};if(r.url){const t=ct(r.url);r.baseUrl=t,r.queryString=function(t){const e=t.match(at);return e&&e[0]}(r.url),r.filename=q(t),r.baseUrl=W(t)}return Array.isArray(r.loaders)||(r.loaders=null),r}({url:i,_parse:ce,loaders:s},n=function(t,e,n,r){return n=n||[],function(t,e){Pt(t,null,Gt,Lt,e);for(const n of e){const r=t&&t[n.id]||{},i=n.options&&n.options[n.id]||{},s=n.deprecatedOptions&&n.deprecatedOptions[n.id]||{};Pt(r,n.id,i,s,e)}}(t,n=Array.isArray(n)?n:[n]),function(t,e,n){const r={...t.options||{}};return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(r,n),null===r.log&&(r.log=new Dt),Jt(r,Nt()),Jt(r,e),r}(e,t,r)}(n,o,s,i),r||null),await async function(t,e,n,r){if(function(t){m(t,"no worker provided");t.version}(t),n=h(t.options,n),et(e)){const t=e,{ok:n,redirected:i,status:s,statusText:o,type:a,url:c}=t,h=Object.fromEntries(t.headers.entries());r.response={headers:h,ok:n,redirected:i,status:s,statusText:o,type:a,url:c}}e=await oe(e,t,n);const i=t;if(i.parseTextSync&&"string"==typeof e)return i.parseTextSync(e,n,r);if(function(t,e){return!(!I.isSupported()||!(p||null!=e&&e._nodeWorkers))&&t.worker&&(null==e?void 0:e.worker)}(t,n))return await G(t,e,n,r,ce);if(i.parseText&&"string"==typeof e)return await i.parseText(e,n,r);if(i.parse)return await i.parse(e,n,r);throw m(!i.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}(o,t,n,r)):null}async function he(t,e,n,r){let i,s;Array.isArray(e)||jt(e)?(i=e,s=n):(i=[],s=e);const o=ae(s);let a=t;return"string"==typeof t&&(a=await o(t)),nt(t)&&(a=await o(t)),Array.isArray(i),await ce(a,i,s)}const le=1/Math.PI*180,ue=1/180*Math.PI;globalThis.mathgl=globalThis.mathgl||{config:{EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1}};const de=globalThis.mathgl.config;function fe(t,{precision:e=de.precision}={}){return t=function(t){return Math.round(t/de.EPSILON)*de.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function me(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function pe(t){return function(t,e){return be(t,(t=>t*ue),void 0)}(t)}function ge(t){return Ae(t)}function Ae(t,e){return be(t,(t=>t*le),e)}function ye(t,e,n){return be(t,(t=>Math.max(e,Math.min(n,t))))}function Be(t,e,n){const r=de.EPSILON;n&&(de.EPSILON=n);try{if(t===e)return!0;if(me(t)&&me(e)){if(t.length!==e.length)return!1;for(let n=0;n0?", ":"")+fe(this[n],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e=0&&t=0&&t0?this.copy([t,...e]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(Ze)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n+n,a=r+r,c=i+i,h=n*o,l=r*o,u=r*a,d=i*o,f=i*a,m=i*c,p=s*o,g=s*a,A=s*c;t[0]=1-u-m,t[3]=l-A,t[6]=d+g,t[1]=l+A,t[4]=1-h-m,t[7]=f-p,t[2]=d-g,t[5]=f+p,t[8]=1-h-u}(this,t),this.check()}set(t,e,n,r,i,s,o,a,c){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=a,this[8]=c,this.check()}setRowMajor(t,e,n,r,i,s,o,a,c){return this[0]=t,this[1]=r,this[2]=o,this[3]=e,this[4]=i,this[5]=a,this[6]=n,this[7]=s,this[8]=c,this.check()}determinant(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],h=t[8];return e*(h*s-o*c)+n*(-h*i+o*a)+r*(c*i-s*a)}(this)}transpose(){return function(t,e){if(t===e){const n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],h=e[7],l=e[8],u=l*o-a*h,d=-l*s+a*c,f=h*s-o*c;let m=n*u+r*d+i*f;m&&(m=1/m,t[0]=u*m,t[1]=(-l*r+i*h)*m,t[2]=(a*r-i*o)*m,t[3]=d*m,t[4]=(l*n-i*c)*m,t[5]=(-a*n+i*s)*m,t[6]=f*m,t[7]=(-h*n+r*c)*m,t[8]=(o*n-r*s)*m)}(this,this),this.check()}multiplyLeft(t){return We(this,t,this),this.check()}multiplyRight(t){return We(this,this,t),this.check()}rotate(t){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=Math.sin(n),f=Math.cos(n);t[0]=f*r+d*o,t[1]=f*i+d*a,t[2]=f*s+d*c,t[3]=f*o-d*r,t[4]=f*a-d*i,t[5]=f*c-d*s,t[6]=h,t[7]=l,t[8]=u}(this,this,t),this.check()}scale(t){return Array.isArray(t)?Ye(this,this,t):Ye(this,this,[t,t]),this.check()}translate(t){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=n[0],f=n[1];t[0]=r,t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=c,t[6]=d*r+f*o+h,t[7]=d*i+f*a+l,t[8]=d*s+f*c+u}(this,this,t),this.check()}transform(t,e){let n;switch(t.length){case 2:n=Me(e||[-0,-0],t,this);break;case 3:n=He(e||[-0,-0,-0],t,this);break;case 4:n=Oe(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ve(n,t.length),n}transformVector(t,e){return this.transform(t,e)}transformVector2(t,e){return this.transform(t,e)}transformVector3(t,e){return this.transform(t,e)}}let tn,en=null;function nn(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],h=e[6],l=e[7],u=e[8],d=e[9],f=e[10],m=e[11],p=e[12],g=e[13],A=e[14],y=e[15];let B=n[0],b=n[1],C=n[2],w=n[3];return t[0]=B*r+b*a+C*u+w*p,t[1]=B*i+b*c+C*d+w*g,t[2]=B*s+b*h+C*f+w*A,t[3]=B*o+b*l+C*m+w*y,B=n[4],b=n[5],C=n[6],w=n[7],t[4]=B*r+b*a+C*u+w*p,t[5]=B*i+b*c+C*d+w*g,t[6]=B*s+b*h+C*f+w*A,t[7]=B*o+b*l+C*m+w*y,B=n[8],b=n[9],C=n[10],w=n[11],t[8]=B*r+b*a+C*u+w*p,t[9]=B*i+b*c+C*d+w*g,t[10]=B*s+b*h+C*f+w*A,t[11]=B*o+b*l+C*m+w*y,B=n[12],b=n[13],C=n[14],w=n[15],t[12]=B*r+b*a+C*u+w*p,t[13]=B*i+b*c+C*d+w*g,t[14]=B*s+b*h+C*f+w*A,t[15]=B*o+b*l+C*m+w*y,t}var rn;!function(){const t=new xe(4);xe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"}(rn||(rn={}));const sn=45*Math.PI/180,on=1,an=.1,cn=500,hn=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class ln extends qe{static get IDENTITY(){return dn||(dn=new ln,Object.freeze(dn)),dn}static get ZERO(){return un||(un=new ln([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(un)),un}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return rn}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,n,r,i,s,o,a,c,h,l,u,d,f,m,p){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this[4]=i,this[5]=s,this[6]=o,this[7]=a,this[8]=c,this[9]=h,this[10]=l,this[11]=u,this[12]=d,this[13]=f,this[14]=m,this[15]=p,this.check()}setRowMajor(t,e,n,r,i,s,o,a,c,h,l,u,d,f,m,p){return this[0]=t,this[1]=i,this[2]=c,this[3]=d,this[4]=e,this[5]=s,this[6]=h,this[7]=f,this[8]=n,this[9]=o,this[10]=l,this[11]=m,this[12]=r,this[13]=a,this[14]=u,this[15]=p,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(hn)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n+n,a=r+r,c=i+i,h=n*o,l=r*o,u=r*a,d=i*o,f=i*a,m=i*c,p=s*o,g=s*a,A=s*c;t[0]=1-u-m,t[1]=l+A,t[2]=d-g,t[3]=0,t[4]=l-A,t[5]=1-h-m,t[6]=f+p,t[7]=0,t[8]=d+g,t[9]=f-p,t[10]=1-h-u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum(t){const{left:e,right:n,bottom:r,top:i,near:s=an,far:o=cn}=t;return o===1/0?function(t,e,n,r,i,s){const o=2*s/(n-e),a=2*s/(i-r),c=(n+e)/(n-e),h=(i+r)/(i-r),l=-2*s;t[0]=o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=h,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=l,t[15]=0}(this,e,n,r,i,s):function(t,e,n,r,i,s,o){const a=1/(n-e),c=1/(i-r),h=1/(s-o);t[0]=2*s*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*c,t[6]=0,t[7]=0,t[8]=(n+e)*a,t[9]=(i+r)*c,t[10]=(o+s)*h,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*s*2*h,t[15]=0}(this,e,n,r,i,s,o),this.check()}lookAt(t){const{eye:e,center:n=[0,0,0],up:r=[0,1,0]}=t;return function(t,e,n,r){let i,s,o,a,c,h,l,u,d,f;const m=e[0],p=e[1],g=e[2],A=r[0],y=r[1],B=r[2],b=n[0],C=n[1],w=n[2];Math.abs(m-b)<_e&&Math.abs(p-C)<_e&&Math.abs(g-w)<_e?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(u=m-b,d=p-C,f=g-w,i=1/Math.sqrt(u*u+d*d+f*f),u*=i,d*=i,f*=i,s=y*f-B*d,o=B*u-A*f,a=A*d-y*u,i=Math.sqrt(s*s+o*o+a*a),i?(i=1/i,s*=i,o*=i,a*=i):(s=0,o=0,a=0),c=d*a-f*o,h=f*s-u*a,l=u*o-d*s,i=Math.sqrt(c*c+h*h+l*l),i?(i=1/i,c*=i,h*=i,l*=i):(c=0,h=0,l=0),t[0]=s,t[1]=c,t[2]=u,t[3]=0,t[4]=o,t[5]=h,t[6]=d,t[7]=0,t[8]=a,t[9]=l,t[10]=f,t[11]=0,t[12]=-(s*m+o*p+a*g),t[13]=-(c*m+h*p+l*g),t[14]=-(u*m+d*p+f*g),t[15]=1)}(this,e,n,r),this.check()}ortho(t){const{left:e,right:n,bottom:r,top:i,near:s=an,far:o=cn}=t;return function(t,e,n,r,i,s,o){const a=1/(e-n),c=1/(r-i),h=1/(s-o);t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+n)*a,t[13]=(i+r)*c,t[14]=(o+s)*h,t[15]=1}(this,e,n,r,i,s,o),this.check()}orthographic(t){const{fovy:e=sn,aspect:n=on,focalDistance:r=1,near:i=an,far:s=cn}=t;fn(e);const o=e/2,a=r*Math.tan(o),c=a*n;return this.ortho({left:-c,right:c,bottom:-a,top:a,near:i,far:s})}perspective(t){const{fovy:e=45*Math.PI/180,aspect:n=1,near:r=.1,far:i=500}=t;return fn(e),function(t,e,n,r,i){const s=1/Math.tan(e/2);if(t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0){const e=1/(r-i);t[10]=(i+r)*e,t[14]=2*i*r*e}else t[10]=-1,t[14]=-2*r}(this,e,n,r,i),this.check()}determinant(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],h=t[8],l=t[9],u=t[10],d=t[11],f=t[12],m=t[13],p=t[14],g=e*o-n*s,A=e*a-r*s,y=n*a-r*o,B=h*m-l*f,b=h*p-u*f,C=l*p-u*m;return c*(e*C-n*b+r*B)-i*(s*C-o*b+a*B)+t[15]*(h*y-l*A+u*g)-d*(f*y-m*A+p*g)}(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),r=1/n[0],i=1/n[1],s=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*i,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*r,t[9]=this[9]*i,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),r=1/n[0],i=1/n[1],s=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=this[4]*r,t[4]=this[5]*i,t[5]=this[6]*s,t[6]=this[8]*r,t[7]=this[9]*i,t[8]=this[10]*s,t}transpose(){return function(t,e){if(t===e){const n=e[1],r=e[2],i=e[3],s=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=s,t[11]=e[14],t[12]=i,t[13]=o,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],h=e[7],l=e[8],u=e[9],d=e[10],f=e[11],m=e[12],p=e[13],g=e[14],A=e[15],y=n*a-r*o,B=n*c-i*o,b=n*h-s*o,C=r*c-i*a,w=r*h-s*a,v=i*h-s*c,E=l*p-u*m,T=l*g-d*m,_=l*A-f*m,x=u*g-d*p,M=u*A-f*p,I=d*A-f*g;let S=y*I-B*M+b*x+C*_-w*T+v*E;S&&(S=1/S,t[0]=(a*I-c*M+h*x)*S,t[1]=(i*M-r*I-s*x)*S,t[2]=(p*v-g*w+A*C)*S,t[3]=(d*w-u*v-f*C)*S,t[4]=(c*_-o*I-h*T)*S,t[5]=(n*I-i*_+s*T)*S,t[6]=(g*b-m*v-A*B)*S,t[7]=(l*v-d*b+f*B)*S,t[8]=(o*M-a*_+h*E)*S,t[9]=(r*_-n*M-s*E)*S,t[10]=(m*w-p*b+A*y)*S,t[11]=(u*b-l*w-f*y)*S,t[12]=(a*T-o*x-c*E)*S,t[13]=(n*x-r*T+i*E)*S,t[14]=(p*B-m*C-g*y)*S,t[15]=(l*C-u*B+d*y)*S)}(this,this),this.check()}multiplyLeft(t){return nn(this,t,this),this.check()}multiplyRight(t){return nn(this,this,t),this.check()}rotateX(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[4],o=e[5],a=e[6],c=e[7],h=e[8],l=e[9],u=e[10],d=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*i+h*r,t[5]=o*i+l*r,t[6]=a*i+u*r,t[7]=c*i+d*r,t[8]=h*i-s*r,t[9]=l*i-o*r,t[10]=u*i-a*r,t[11]=d*i-c*r}(this,this,t),this.check()}rotateY(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[0],o=e[1],a=e[2],c=e[3],h=e[8],l=e[9],u=e[10],d=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i-h*r,t[1]=o*i-l*r,t[2]=a*i-u*r,t[3]=c*i-d*r,t[8]=s*r+h*i,t[9]=o*r+l*i,t[10]=a*r+u*i,t[11]=c*r+d*i}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){const r=Math.sin(n),i=Math.cos(n),s=e[0],o=e[1],a=e[2],c=e[3],h=e[4],l=e[5],u=e[6],d=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i+h*r,t[1]=o*i+l*r,t[2]=a*i+u*r,t[3]=c*i+d*r,t[4]=h*i-s*r,t[5]=l*i-o*r,t[6]=u*i-a*r,t[7]=d*i-c*r}(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return function(t,e,n,r){let i,s,o,a,c,h,l,u,d,f,m,p,g,A,y,B,b,C,w,v,E,T,_,x,M=r[0],I=r[1],S=r[2],R=Math.sqrt(M*M+I*I+S*S);R<_e||(R=1/R,M*=R,I*=R,S*=R,s=Math.sin(n),i=Math.cos(n),o=1-i,a=e[0],c=e[1],h=e[2],l=e[3],u=e[4],d=e[5],f=e[6],m=e[7],p=e[8],g=e[9],A=e[10],y=e[11],B=M*M*o+i,b=I*M*o+S*s,C=S*M*o-I*s,w=M*I*o-S*s,v=I*I*o+i,E=S*I*o+M*s,T=M*S*o+I*s,_=I*S*o-M*s,x=S*S*o+i,t[0]=a*B+u*b+p*C,t[1]=c*B+d*b+g*C,t[2]=h*B+f*b+A*C,t[3]=l*B+m*b+y*C,t[4]=a*w+u*v+p*E,t[5]=c*w+d*v+g*E,t[6]=h*w+f*v+A*E,t[7]=l*w+m*v+y*E,t[8]=a*T+u*_+p*x,t[9]=c*T+d*_+g*x,t[10]=h*T+f*_+A*x,t[11]=l*T+m*_+y*x,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return function(t,e,n){const r=n[0],i=n[1],s=n[2];t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return function(t,e,n){const r=n[0],i=n[1],s=n[2];let o,a,c,h,l,u,d,f,m,p,g,A;e===t?(t[12]=e[0]*r+e[4]*i+e[8]*s+e[12],t[13]=e[1]*r+e[5]*i+e[9]*s+e[13],t[14]=e[2]*r+e[6]*i+e[10]*s+e[14],t[15]=e[3]*r+e[7]*i+e[11]*s+e[15]):(o=e[0],a=e[1],c=e[2],h=e[3],l=e[4],u=e[5],d=e[6],f=e[7],m=e[8],p=e[9],g=e[10],A=e[11],t[0]=o,t[1]=a,t[2]=c,t[3]=h,t[4]=l,t[5]=u,t[6]=d,t[7]=f,t[8]=m,t[9]=p,t[10]=g,t[11]=A,t[12]=o*r+l*i+m*s+e[12],t[13]=a*r+u*i+p*s+e[13],t[14]=c*r+d*i+g*s+e[14],t[15]=h*r+f*i+A*s+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=function(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*s+n[12]*o,t[1]=n[1]*r+n[5]*i+n[9]*s+n[13]*o,t[2]=n[2]*r+n[6]*i+n[10]*s+n[14]*o,t[3]=n[3]*r+n[7]*i+n[11]*s+n[15]*o,t}(e||[-0,-0,-0,-0],t,this),ve(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:n}=t;let r;switch(n){case 2:r=Ie(e||[-0,-0],t,this);break;case 3:r=Pe(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ve(r,t.length),r}transformAsVector(t,e){let n;switch(t.length){case 2:n=Se(e||[-0,-0],t,this);break;case 3:n=Re(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ve(n,t.length),n}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,n){return this.identity().translate([t,e,n])}}let un,dn;function fn(t){if(t>2*Math.PI)throw Error("expected radians")}function mn(){const t=new xe(4);return xe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function pn(t,e,n){n*=.5;const r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function gn(t,e,n){const r=e[0],i=e[1],s=e[2],o=e[3],a=n[0],c=n[1],h=n[2],l=n[3];return t[0]=r*l+o*a+i*h-s*c,t[1]=i*l+o*c+s*a-r*h,t[2]=s*l+o*h+r*c-i*a,t[3]=o*l-r*a-i*c-s*h,t}const An=function(){const t=De(),e=Le(1,0,0),n=Le(0,1,0);return function(r,i,s){const o=Ue(i,s);return o<-.999999?(Ne(t,e,i),je(t)<1e-6&&Ne(t,n,i),function(t,e){const n=e[0],r=e[1],i=e[2];let s=n*n+r*r+i*i;s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s}(t,t),pn(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Ne(t,i,s),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3];let o=n*n+r*r+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=n*o,t[1]=r*o,t[2]=i*o,t[3]=s*o,t}(r,r))}}();mn(),mn(),function(){const t=new xe(9);xe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1}();const yn=[0,0,0,1];class Bn extends Ce{constructor(t=0,e=0,n=0,r=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,n,r)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,n,r){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return function(t,e){const n=e[0]+e[4]+e[8];let r;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{let n=0;e[4]>e[0]&&(n=1),e[8]>e[3*n+n]&&(n=2);const i=(n+1)%3,s=(n+2)%3;r=Math.sqrt(e[3*n+n]-e[3*i+i]-e[3*s+s]+1),t[n]=.5*r,r=.5/r,t[3]=(e[3*i+s]-e[3*s+i])*r,t[i]=(e[3*i+n]+e[3*n+i])*r,t[s]=(e[3*s+n]+e[3*n+s])*r}}(this,t),this.check()}fromAxisRotation(t,e){return pn(this,t,e),this.check()}identity(){return function(t){t[0]=0,t[1]=0,t[2]=0,t[3]=1}(this),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=we(t)}get y(){return this[1]}set y(t){this[1]=we(t)}get z(){return this[2]}set z(t){this[2]=we(t)}get w(){return this[3]}set w(t){this[3]=we(t)}len(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)}(this)}lengthSquared(){return function(t){const e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}(this)}dot(t){return function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}(this,t)}rotationTo(t,e){return An(this,t,e),this.check()}add(t){return function(t,e,n){t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3]}(this,this,t),this.check()}calculateW(){return function(t,e){const n=e[0],r=e[1],i=e[2];t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i))}(this,this),this.check()}conjugate(){return function(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3]}(this,this),this.check()}invert(){return function(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=n*n+r*r+i*i+s*s,a=o?1/o:0;t[0]=-n*a,t[1]=-r*a,t[2]=-i*a,t[3]=s*a}(this,this),this.check()}lerp(t,e,n){return void 0===n?this.lerp(this,t,e):(function(t,e,n,r){const i=e[0],s=e[1],o=e[2],a=e[3];t[0]=i+r*(n[0]-i),t[1]=s+r*(n[1]-s),t[2]=o+r*(n[2]-o),t[3]=a+r*(n[3]-a)}(this,t,e,n),this.check())}multiplyRight(t){return gn(this,this,t),this.check()}multiplyLeft(t){return gn(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c+o*a,t[1]=i*c+s*a,t[2]=s*c-i*a,t[3]=o*c-r*a}(this,this,t),this.check()}rotateY(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c-s*a,t[1]=i*c+o*a,t[2]=s*c+r*a,t[3]=o*c-i*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){n*=.5;const r=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(n),c=Math.cos(n);t[0]=r*c+i*a,t[1]=i*c-r*a,t[2]=s*c+o*a,t[3]=o*c-s*a}(this,this,t),this.check()}scale(t){return function(t,e,n){t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n}(this,this,t),this.check()}slerp(t,e,n){let r,i,s;switch(arguments.length){case 1:({start:r=yn,target:i,ratio:s}=t);break;case 2:r=this,i=t,s=e;break;default:r=t,i=e,s=n}return function(t,e,n,r){const i=e[0],s=e[1],o=e[2],a=e[3];let c,h,l,u,d,f=n[0],m=n[1],p=n[2],g=n[3];c=i*f+s*m+o*p+a*g,c<0&&(c=-c,f=-f,m=-m,p=-p,g=-g),1-c>_e?(h=Math.acos(c),d=Math.sin(h),l=Math.sin((1-r)*h)/d,u=Math.sin(r*h)/d):(l=1-r,u=r),t[0]=l*i+u*f,t[1]=l*s+u*m,t[2]=l*o+u*p,t[3]=l*a+u*g}(this,r,i,s),this.check()}transformVector4(t,e=new ze){return function(t,e,n){const r=e[0],i=e[1],s=e[2],o=n[0],a=n[1],c=n[2],h=n[3],l=h*r+a*s-c*i,u=h*i+c*r-o*s,d=h*s+o*i-a*r,f=-o*r-a*i-c*s;t[0]=l*h+f*-o+u*-c-d*-a,t[1]=u*h+f*-a+d*-o-l*-c,t[2]=d*h+f*-c+l*-a-u*-o,t[3]=e[3]}(e,t,this),ve(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}function bn(t){return(bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Cn(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=bn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=bn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==bn(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wn(t){return t}new Qe;const vn=new Qe,En={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Tn={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_n={east:new Qe,north:new Qe,up:new Qe,west:new Qe,south:new Qe,down:new Qe},xn=new Qe,Mn=new Qe,In=new Qe;function Sn(t,e,n,r,i,s){const o=En[e]&&En[e][n];let a,c,h;Ee(o&&(!r||r===o));const l=vn.copy(i);if(Be(l.x,0,1e-14)&&Be(l.y,0,1e-14)){const t=Math.sign(l.z);a=xn.fromArray(Tn[e]),"east"!==e&&"west"!==e&&a.scale(t),c=Mn.fromArray(Tn[n]),"east"!==n&&"west"!==n&&c.scale(t),h=In.fromArray(Tn[r]),"east"!==r&&"west"!==r&&h.scale(t)}else{const{up:i,east:s,north:o}=_n;s.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,i),o.copy(i).cross(s);const{down:u,west:d,south:f}=_n;u.copy(i).scale(-1),d.copy(s).scale(-1),f.copy(o).scale(-1),a=_n[e],c=_n[n],h=_n[r]}return s[0]=a.x,s[1]=a.y,s[2]=a.z,s[3]=0,s[4]=c.x,s[5]=c.y,s[6]=c.z,s[7]=0,s[8]=h.x,s[9]=h.y,s[10]=h.z,s[11]=0,s[12]=l.x,s[13]=l.y,s[14]=l.z,s[15]=1,s}const Rn=new Qe,On=new Qe,Fn=new Qe,Dn=new Qe,Gn=new Qe,Ln=new Qe,Un=new Qe,Nn=new Qe,Pn=new Qe;class Hn{constructor(t=0,e=0,n=0){Cn(this,"radii",void 0),Cn(this,"radiiSquared",void 0),Cn(this,"radiiToTheFourth",void 0),Cn(this,"oneOverRadii",void 0),Cn(this,"oneOverRadiiSquared",void 0),Cn(this,"minimumRadius",void 0),Cn(this,"maximumRadius",void 0),Cn(this,"centerToleranceSquared",.1),Cn(this,"squaredXOverSquaredZ",void 0),Ee(t>=0),Ee(e>=0),Ee(n>=0),this.radii=new Qe(t,e,n),this.radiiSquared=new Qe(t*t,e*e,n*n),this.radiiToTheFourth=new Qe(t*t*t*t,e*e*e*e,n*n*n*n),this.oneOverRadii=new Qe(0===t?0:1/t,0===e?0:1/e,0===n?0:1/n),this.oneOverRadiiSquared=new Qe(0===t?0:1/(t*t),0===e?0:1/(e*e),0===n?0:1/(n*n)),this.minimumRadius=Math.min(t,e,n),this.maximumRadius=Math.max(t,e,n),0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||!(!t||!this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const n=Gn,r=Ln,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,n),r.copy(this.radiiSquared).scale(n);const s=Math.sqrt(n.dot(r));return r.scale(1/s),n.scale(i),r.add(n),r.to(e)}cartesianToCartographic(t,e=[0,0,0]){Pn.from(t);const n=this.scaleToGeodeticSurface(Pn,Un);if(!n)return;const r=this.geodeticSurfaceNormal(n,Gn),i=Nn;return i.copy(Pn).subtract(n),function(t,e){return function(t,e,n=wn){return"longitude"in e?(e.longitude=n(t[0]),e.latitude=n(t[1]),e.height=t[2]):"x"in e?(e.x=n(t[0]),e.y=n(t[1]),e.z=t[2]):(e[0]=n(t[0]),e[1]=n(t[1]),e[2]=t[2]),e}(t,e,de._cartographicRadians?wn:ge)}([Math.atan2(r.y,r.x),Math.asin(r.z),Math.sign(Ue(i,Pn))*Ge(i)],e)}eastNorthUpToFixedFrame(t,e=new ln){return Sn(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,n,r,i=new ln){return Sn(this,t,e,n,r,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return Dn.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const n=function(t,e=[]){return function(t,e=[],n=wn){return"longitude"in t?(e[0]=n(t.longitude),e[1]=n(t.latitude),e[2]=t.height):"x"in t?(e[0]=n(t.x),e[1]=n(t.y),e[2]=t.z):(e[0]=n(t[0]),e[1]=n(t[1]),e[2]=t[2]),e}(t,e,de._cartographicRadians?wn:pe)}(t),r=n[0],i=n[1],s=Math.cos(i);return Dn.set(s*Math.cos(r),s*Math.sin(r),Math.sin(i)).normalize(),Dn.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return Dn.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,n=[]){const{oneOverRadii:r,oneOverRadiiSquared:i,centerToleranceSquared:s}=e;Rn.from(t);const o=Rn.x,a=Rn.y,c=Rn.z,h=r.x,l=r.y,u=r.z,d=o*o*h*h,f=a*a*l*l,m=c*c*u*u,p=d+f+m,g=Math.sqrt(1/p);if(!Number.isFinite(g))return;const A=On;if(A.copy(t).scale(g),p1e-12);return Rn.scale([w,v,E]).to(n)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){Un.from(t);const n=Un.x,r=Un.y,i=Un.z,s=this.oneOverRadiiSquared,o=1/Math.sqrt(n*n*s.x+r*r*s.y+i*i*s.z);return Un.multiplyScalar(o).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return Un.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return Un.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,n=[0,0,0]){Ee(Be(this.radii.x,this.radii.y,1e-15)),Ee(this.radii.z>0),Un.from(t);const r=Un.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(r)>=this.radii.z-e))return Un.set(0,0,r).to(n)}}Cn(Hn,"WGS84",new Hn(6378137,6378137,6356752.314245179));new Qe,new Qe;const Jn=new Qe,jn=new Qe;class kn{constructor(t=[0,0,0],e=0){Cn(this,"center",void 0),Cn(this,"radius",void 0),this.radius=-0,this.center=new Qe,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=Jn.from(e),this.center=(new Qe).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new kn(this.center,this.radius)}union(t){const e=this.center,n=this.radius,r=t.center,i=t.radius,s=Jn.copy(r).subtract(e),o=s.magnitude();if(n>=o+i)return this.clone();if(i>=o+n)return t.clone();const a=.5*(n+o+i);return jn.copy(s).scale((-n+a)/o).add(e),this.center.copy(jn),this.radius=a,this}expand(t){const e=Jn.from(t).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=function(t,e){const n=e[0],r=e[1],i=e[2],s=e[4],o=e[5],a=e[6],c=e[8],h=e[9],l=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(s*s+o*o+a*a),t[2]=Math.sqrt(c*c+h*h+l*l),t}(Jn,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){const e=this.distanceTo(t);return e*e}distanceTo(t){const e=Jn.from(t).subtract(this.center);return Math.max(0,e.len()-this.radius)}intersectPlane(t){const e=this.center,n=this.radius,r=t.normal.dot(e)+t.distance;return r<-n?-1:r=a?1:0}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=Kn.from(t).subtract(this.center),n=this.halfAxes,r=n.getColumn(0,Qn),i=n.getColumn(1,zn),s=n.getColumn(2,qn),o=r.magnitude(),a=i.magnitude(),c=s.magnitude();r.normalize(),i.normalize(),s.normalize();let h,l=0;return h=Math.abs(e.dot(r))-o,h>0&&(l+=h*h),h=Math.abs(e.dot(i))-a,h>0&&(l+=h*h),h=Math.abs(e.dot(s))-c,h>0&&(l+=h*h),l}computePlaneDistances(t,e,n=[-0,-0]){let r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const s=this.center,o=this.halfAxes,a=o.getColumn(0,Qn),c=o.getColumn(1,zn),h=o.getColumn(2,qn),l=Wn.copy(a).add(c).add(h).add(s),u=Yn.copy(l).subtract(t);let d=e.dot(u);return r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).add(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).subtract(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),l.copy(s).add(a).subtract(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).add(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).add(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).subtract(c).add(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),s.copy(l).subtract(a).subtract(c).subtract(h),u.copy(l).subtract(t),d=e.dot(u),r=Math.min(d,r),i=Math.max(d,i),n[0]=r,n[1]=i,n}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,Qn);e.transformAsPoint(t);const n=this.halfAxes.getColumn(1,zn);n.transformAsPoint(t);const r=this.halfAxes.getColumn(2,qn);return r.transformAsPoint(t),this.halfAxes=new $e([...e,...n,...r]),this}getTransform(){throw new Error("not implemented")}}const Zn=new Qe,$n=new Qe;class tr{constructor(t=[0,0,1],e=0){Cn(this,"normal",void 0),Cn(this,"distance",void 0),this.normal=new Qe,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return Ee(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=Zn.from(t),this.normal.from(e).normalize();const n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,e,n,r){return this.normal.set(t,e,n),Ee(Be(this.normal.len(),1)),this.distance=r,this}clone(){return new tr(this.normal,this.distance)}equals(t){return Be(this.distance,t.distance)&&Be(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=$n.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,e)}projectPointOntoPlane(t,e=[0,0,0]){const n=Zn.from(t),r=this.getPointDistance(n),i=$n.copy(this.normal).scale(r);return n.subtract(i).to(e)}}const er=[new Qe([1,0,0]),new Qe([0,1,0]),new Qe([0,0,1])],nr=new Qe,rr=new Qe;class ir{constructor(t=[]){Cn(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*er.length;const e=t.center,n=t.radius;let r=0;for(const t of er){let i=this.planes[r],s=this.planes[r+1];i||(i=this.planes[r]=new tr),s||(s=this.planes[r+1]=new tr);const o=nr.copy(t).scale(-n).add(e);i.fromPointNormal(o,t);const a=nr.copy(t).scale(n).add(e),c=rr.copy(t).negate();s.fromPointNormal(a,c),r+=2}return this}computeVisibility(t){let e=1;for(const n of this.planes)switch(t.intersectPlane(n)){case-1:return-1;case 0:e=0}return e}computeVisibilityWithPlaneMask(t,e){if(Ee(Number.isFinite(e),"parentPlaneMask is required."),e===ir.MASK_OUTSIDE||e===ir.MASK_INSIDE)return e;let n=ir.MASK_INSIDE;const r=this.planes;for(let i=0;i0),Ee(e>0),Ee(n>0),Ee(r);const i=1/this.near;let s=this.top*i;const o=2*n*s/e;s=this.right*i;const a=2*n*s/t;return r.x=a,r.y=o,r}_update(){Ee(Number.isFinite(this.right)&&Number.isFinite(this.left)&&Number.isFinite(this.top)&&Number.isFinite(this.bottom)&&Number.isFinite(this.near)&&Number.isFinite(this.far));const{top:t,bottom:e,right:n,left:r,near:i,far:s}=this;(t!==this._top||e!==this._bottom||r!==this._left||n!==this._right||i!==this._near||s!==this._far)&&(Ee(this.near>0&&this.nearnull!==t&&typeof t<"u")(t)&&t instanceof ur)&&(this._update(),t._update(),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this.near===t.near&&this.far===t.far&&this._offCenterFrustum.equals(t._offCenterFrustum))}get projectionMatrix(){return this._update(),this._offCenterFrustum.projectionMatrix}get infiniteProjectionMatrix(){return this._update(),this._offCenterFrustum.infiniteProjectionMatrix}get fovy(){return this._update(),this._fovy}get sseDenominator(){return this._update(),this._sseDenominator}computeCullingVolume(t,e,n){return this._update(),this._offCenterFrustum.computeCullingVolume(t,e,n)}getPixelDimensions(t,e,n,r){return this._update(),this._offCenterFrustum.getPixelDimensions(t,e,n,r||new Fe)}_update(){Ee(Number.isFinite(this.fov)&&Number.isFinite(this.aspectRatio)&&Number.isFinite(this.near)&&Number.isFinite(this.far));const t=this._offCenterFrustum;(this.fov!==this._fov||this.aspectRatio!==this._aspectRatio||this.near!==this._near||this.far!==this._far||this.xOffset!==this._xOffset||this.yOffset!==this._yOffset)&&(Ee(this.fov>=0&&this.fov0),Ee(this.near>=0&&this.nearn&&(r=e,n=i)}const i=Ar[r],s=yr[r];let o=1,a=0;if(Math.abs(t[dr.getElementIndex(s,i)])>1e-15){const e=(t[dr.getElementIndex(s,s)]-t[dr.getElementIndex(i,i)])/2/t[dr.getElementIndex(s,i)];let n;n=e<0?-1/(-e+Math.sqrt(1+e*e)):1/(e+Math.sqrt(1+e*e)),o=1/Math.sqrt(1+n*n),a=n*o}return $e.IDENTITY.to(e),e[dr.getElementIndex(i,i)]=e[dr.getElementIndex(s,s)]=o,e[dr.getElementIndex(s,i)]=a,e[dr.getElementIndex(i,s)]=-a,e}const Cr=new Qe,wr=new Qe,vr=new Qe,Er=new Qe,Tr=new Qe,_r=new $e,xr={diagonal:new $e,unitary:new $e};let Mr=function(t){return t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE",t}({}),Ir=function(t){return t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh",t}({}),Sr=function(t){return t.I3S="I3S",t.TILES3D="TILES3D",t}({}),Rr=function(t){return t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold",t}({});const Or="4.1.1",Fr="cmpt",Dr="pnts",Gr="b3dm",Lr="i3dm",Ur="glTF";function Nr(t,e,n){o(t instanceof ArrayBuffer);const r=new TextDecoder("utf8"),i=new Uint8Array(t,e,n);return r.decode(i)}function Pr(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=new DataView(t);return`${String.fromCharCode(n.getUint8(e+0))}${String.fromCharCode(n.getUint8(e+1))}${String.fromCharCode(n.getUint8(e+2))}${String.fromCharCode(n.getUint8(e+3))}`}const Hr={name:"Draco",id:"draco",module:"draco",version:"4.1.1",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Jr(t,e,n){return function(t,e,n){const r=function(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}(e.value),i=n||function(t){const e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:r}]},nullable:!1,metadata:i}}(t,e,n?jr(n.metadata):void 0)}function jr(t){Object.entries(t);const e={};for(const n in t)e[`${n}.string`]=JSON.stringify(t[n]);return e}const kr={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Vr={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Kr{constructor(t){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new this.draco.DecoderBuffer;n.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);const r=this.decoder.GetEncodedGeometryType(n),i=r===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let t;switch(r){case this.draco.TRIANGULAR_MESH:t=this.decoder.DecodeBufferToMesh(n,i);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(n,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!i.ptr){const e=`DRACO decompression failed: ${t.error_msg()}`;throw new Error(e)}const s=this._getDracoLoaderData(i,r,e),o=this._getMeshData(i,s,e),a=function(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;const a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let t=0;ti?c:i,s=h>s?h:s,o=l>o?l:o}return[[e,n,r],[i,s,o]]}(o.attributes),c=function(t,e,n){const r=jr(e.metadata),i=[],s=function(t){const e={};for(const n in t){const r=t[n];e[r.name||"undefined"]=r}return e}(e.attributes);for(const e in t){const n=Jr(e,t[e],s[e]);i.push(n)}if(n){const t=Jr("indices",n);i.push(t)}return{fields:i,metadata:r}}(o.attributes,s,o.indices);return{loader:"draco",loaderData:s,header:{vertexCount:i.num_points(),boundingBox:a},...o,schema:c}}finally{this.draco.destroy(n),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,e,n){const r=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,n);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:r,attributes:i}}_getDracoAttributes(t,e){const n={};for(let r=0;rthis.decoder[t])).includes(r)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits(),range:e.range(),min_values:new Float32Array([1,2,3]).map((t=>e.min_value(t)))}}finally{this.draco.destroy(e)}}return null}_getOctahedronTransform(t,e){const{octahedronAttributes:n=[]}=e,r=t.attribute_type();if(n.map((t=>this.decoder[t])).includes(r)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits()}}finally{this.draco.destroy(e)}}return null}}const Qr="https://www.gstatic.com/draco/versioned/decoders/1.5.6",zr="draco_wasm_wrapper.js",qr="draco_decoder.wasm",Wr="draco_decoder.js",Yr="draco_encoder.js",Xr={[zr]:`${Qr}/${zr}`,[qr]:`${Qr}/draco_decoder.wasm`,[Wr]:`${Qr}/draco_decoder.js`,[Yr]:`https://raw.githubusercontent.com/google/draco/1.4.1/javascript/${Yr}`};let Zr;const $r={...Hr,parse:async function(t,e){const{draco:n}=await async function(t){const e=t.modules||{};return Zr=e.draco3d?Zr||e.draco3d.createDecoderModule({}).then((t=>({draco:t}))):Zr||async function(t){let e,n;return"js"===(t.draco&&t.draco.decoderType)?e=await O(Xr["draco_decoder.js"],"draco",t,Wr):[e,n]=await Promise.all([await O(Xr[zr],"draco",t,zr),await O(Xr[qr],"draco",t,qr)]),e=e||globalThis.DracoDecoderModule,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t({...n,onModuleLoaded:t=>e({draco:t})})}))}(e,n)}(t),await Zr}(e),r=new Kr(n);try{return r.parseSync(t,null==e?void 0:e.draco)}finally{r.destroy()}}},ti={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},ei={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...ti},ni={[ti.DOUBLE]:Float64Array,[ti.FLOAT]:Float32Array,[ti.UNSIGNED_SHORT]:Uint16Array,[ti.UNSIGNED_INT]:Uint32Array,[ti.UNSIGNED_BYTE]:Uint8Array,[ti.BYTE]:Int8Array,[ti.SHORT]:Int16Array,[ti.INT]:Int32Array},ri={DOUBLE:ti.DOUBLE,FLOAT:ti.FLOAT,UNSIGNED_SHORT:ti.UNSIGNED_SHORT,UNSIGNED_INT:ti.UNSIGNED_INT,UNSIGNED_BYTE:ti.UNSIGNED_BYTE,BYTE:ti.BYTE,SHORT:ti.SHORT,INT:ti.INT},ii="Failed to convert GL type";class si{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(const e in ni)if(ni[e]===t)return e;throw new Error(ii)}static fromName(t){const e=ri[t];if(!e)throw new Error(ii);return e}static getArrayType(t){switch(t){case ti.UNSIGNED_SHORT_5_6_5:case ti.UNSIGNED_SHORT_4_4_4_4:case ti.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const e=ni[t];if(!e)throw new Error(ii);return e}}static getByteSize(t){return si.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return!!si.getArrayType(t)}static createTypedArray(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;return void 0===r&&(r=(e.byteLength-n)/si.getByteSize(t)),new(si.getArrayType(t))(e,n,r)}}function oi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];const n=t>>11&31,r=t>>5&63,i=31&t;return e[0]=n<<3,e[1]=r<<2,e[2]=i<<3,e}function ai(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:255;return ye(t,0,e)/e*2-1}function ci(t){return t<0?-1:1}function hi(t,e,n){return function(t,e,n,r){if(function(t,e){if(!t)throw new Error("math.gl assertion failed. undefined")}(r),t<0||t>n||e<0||e>n)throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);if(r.x=ai(t,n),r.y=ai(e,n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){const t=r.x;r.x=(1-Math.abs(r.y))*ci(t),r.y=(1-Math.abs(t))*ci(r.y)}return r.normalize()}(t,e,255,n)}new Fe,new Qe,new Fe,new Fe;class li{constructor(t,e){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=t,this.buffer=e}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return!!this.json[t]}getGlobalProperty(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ei.UNSIGNED_INT,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const r=this.json[t];return r&&Number.isFinite(r.byteOffset)?this._getTypedArrayFromBinary(t,e,n,1,r.byteOffset):r}getPropertyArray(t,e,n){const r=this.json[t];return r&&Number.isFinite(r.byteOffset)?("componentType"in r&&(e=si.fromName(r.componentType)),this._getTypedArrayFromBinary(t,e,n,this.featuresLength,r.byteOffset)):this._getTypedArrayFromArray(t,e,r)}getProperty(t,e,n,r,i){const s=this.json[t];if(!s)return s;const o=this.getPropertyArray(t,e,n);if(1===n)return o[r];for(let t=0;tt[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},fi={SCALAR:(t,e,n)=>{e[n]=t},VEC2:(t,e,n)=>{e[2*n+0]=t[0],e[2*n+1]=t[1]},VEC3:(t,e,n)=>{e[3*n+0]=t[0],e[3*n+1]=t[1],e[3*n+2]=t[2]},VEC4:(t,e,n)=>{e[4*n+0]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]},MAT2:(t,e,n)=>{e[4*n+0]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]},MAT3:(t,e,n)=>{e[9*n+0]=t[0],e[9*n+1]=t[1],e[9*n+2]=t[2],e[9*n+3]=t[3],e[9*n+4]=t[4],e[9*n+5]=t[5],e[9*n+6]=t[6],e[9*n+7]=t[7],e[9*n+8]=t[8],e[9*n+9]=t[9]},MAT4:(t,e,n)=>{e[16*n+0]=t[0],e[16*n+1]=t[1],e[16*n+2]=t[2],e[16*n+3]=t[3],e[16*n+4]=t[4],e[16*n+5]=t[5],e[16*n+6]=t[6],e[16*n+7]=t[7],e[16*n+8]=t[8],e[16*n+9]=t[9],e[16*n+10]=t[10],e[16*n+11]=t[11],e[16*n+12]=t[12],e[16*n+13]=t[13],e[16*n+14]=t[14],e[16*n+15]=t[15]}},mi=t=>void 0!==t;function pi(t,e,n){if(!t)return;const r=t.parentCounts;return t.parentIds?n(t,e):r>0?function(t,e,n){const r=t.classIds,i=t.parentCounts,s=t.parentIds,o=t.parentIndexes,a=r.length,c=scratchVisited;c.length=Math.max(c.length,a);const h=++marker,l=scratchStack;for(l.length=0,l.push(e);l.length>0;){if(c[e=l.pop()]===h)continue;c[e]=h;const r=n(t,e);if(mi(r))return r;const a=i[e],u=o[e];for(let t=0;tt,Bi={HIERARCHY:!0,extensions:!0,extras:!0};class bi{constructor(t,e,n){var r;let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,o(n>=0),this.json=t||{},this.binary=e,this.featureCount=n,this._extensions=(null===(r=this.json)||void 0===r?void 0:r.extensions)||{},this._properties={};for(const t in this.json)Bi[t]||(this._properties[t]=this.json[t]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=function(t,e,n){if(!e)return null;let r=t.getExtension("3DTILES_batch_table_hierarchy");const i=e.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=i,r=i),r?function(t,e){let n,r,i;const s=t.instancesLength,o=t.classes;let a,c=t.classIds,h=t.parentCounts,l=t.parentIds,u=s;if(mi(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,s)),mi(h))for(mi(h.byteOffset)&&(h.componentType=defaultValue(h.componentType,GL.UNSIGNED_SHORT),h.type=AttributeType.SCALAR,i=getBinaryAccessor(h),h=i.createArrayBufferView(e.buffer,e.byteOffset+h.byteOffset,s)),a=new Uint16Array(s),u=0,n=0;n{const r=t.classIds[n];return t.classes[r].name===e})))}isExactClass(t,e){return o("string"==typeof e,e),this.getExactClassName(t)===e}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){const e=this._hierarchy.classIds[t];return this._hierarchy.classes[e].name}}hasProperty(t,e){return this._checkBatchId(t),o("string"==typeof e,e),Ai(this._properties[e])||this._hasPropertyInHierarchy(t,e)}getPropertyNames(t,e){this._checkBatchId(t),(e=Ai(e)?e:[]).length=0;const n=Object.keys(this._properties);return e.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(t,e),e}getProperty(t,e){if(this._checkBatchId(t),o("string"==typeof e,e),this._binaryProperties){const n=this._binaryProperties[e];if(Ai(n))return this._getBinaryProperty(n,t)}const n=this._properties[e];if(Ai(n))return yi(n[t]);if(this._hierarchy){const n=this._getHierarchyProperty(t,e);if(Ai(n))return n}}setProperty(t,e,n){const r=this.featureCount;if(this._checkBatchId(t),o("string"==typeof e,e),this._binaryProperties){const r=this._binaryProperties[e];if(r)return void this._setBinaryProperty(r,t,n)}if(this._hierarchy&&this._setHierarchyProperty(this,t,e,n))return;let i=this._properties[e];Ai(i)||(this._properties[e]=new Array(r),i=this._properties[e]),i[t]=yi(n)}_checkBatchId(t){if(!(t>=0&&t{const r=t.classIds[n];return Ai(t.classes[r].instances[e])}));return Ai(n)}_getPropertyNamesInHierarchy(t,e){pi(this._hierarchy,t,((t,n)=>{const r=t.classIds[n],i=t.classes[r].instances;for(const t in i)i.hasOwnProperty(t)&&-1===e.indexOf(t)&&e.push(t)}))}_getHierarchyProperty(t,e){return pi(this._hierarchy,t,((t,n)=>{const r=t.classIds[n],i=t.classes[r],s=t.classIndexes[n],o=i.instances[e];return Ai(o)?Ai(o.typedArray)?this._getBinaryProperty(o,s):yi(o[s]):null}))}_setHierarchyProperty(t,e,n,r){const i=pi(this._hierarchy,e,((t,i)=>{const s=t.classIds[i],a=t.classes[s],c=t.classIndexes[i],h=a.instances[n];return!!Ai(h)&&(o(i===e,`Inherited property "${n}" is read-only.`),Ai(h.typedArray)?this._setBinaryProperty(h,c,r):h[c]=yi(r),!0)}));return Ai(i)}}function Ci(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=new DataView(e);if(t.magic=r.getUint32(n,!0),n+=4,t.version=r.getUint32(n,!0),n+=4,t.byteLength=r.getUint32(n,!0),n+=4,1!==t.version)throw new Error(`3D Tile Version ${t.version} not supported`);return n}const wi="b3dm tile in legacy format.";function vi(t,e,n){const r=new DataView(e);let i;t.header=t.header||{};let s=r.getUint32(n,!0);n+=4;let o=r.getUint32(n,!0);n+=4;let a=r.getUint32(n,!0);n+=4;let c=r.getUint32(n,!0);return n+=4,a>=570425344?(n-=8,i=s,a=o,c=0,s=0,o=0,console.warn(wi)):c>=570425344&&(n-=4,i=a,a=s,c=o,s=0,o=0,console.warn(wi)),t.header.featureTableJsonByteLength=s,t.header.featureTableBinaryByteLength=o,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=i,n}function Ei(t,e,n,r){return n=function(t,e,n,r){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:s,batchLength:o}=t.header||{};if(t.featureTableJson={BATCH_LENGTH:o||0},i&&i>0){const r=Nr(e,n,i);t.featureTableJson=JSON.parse(r)}return n+=i||0,t.featureTableBinary=new Uint8Array(e,n,s),n+(s||0)}(t,e,n),n=function(t,e,n,r){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:s}=t.header||{};if(i&&i>0){const r=Nr(e,n,i);t.batchTableJson=JSON.parse(r),n+=i,s&&s>0&&(t.batchTableBinary=new Uint8Array(e,n,s),t.batchTableBinary=new Uint8Array(t.batchTableBinary),n+=s)}return n}(t,e,n),n}function Ti(t,e,n){if(!(e||t&&t.batchIds&&n))return null;const{batchIds:r,isRGB565:i,pointCount:s=0}=t;if(r&&n){const t=new Uint8ClampedArray(3*s);for(let e=0;e255*t));t[3*e]=s[0],t[3*e+1]=s[1],t[3*e+2]=s[2]}return{type:ei.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}if(e&&i){const t=new Uint8ClampedArray(3*s);for(let n=0;n{try{n.onload=()=>t(n),n.onerror=t=>{const n=t instanceof Error?t.message:"error";e(new Error(n))}}catch(t){e(t)}}))}(s||r,e)}finally{s&&i.revokeObjectURL(s)}}const Pi={};let Hi=!0;function Ji(t){for(const e in t||Pi)return!1;return!0}function ji(t){return[...t].map((t=>t.charCodeAt(0)))}const ki=!1,Vi=!0;function Ki(t){const e=Qi(t);return function(t){const e=Qi(t);return e.byteLength>=24&&2303741511===e.getUint32(0,ki)?{mimeType:"image/png",width:e.getUint32(16,ki),height:e.getUint32(20,ki)}:null}(e)||function(t){const e=Qi(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,ki)&&255===e.getUint8(2)))return null;const{tableMarkers:n,sofMarkers:r}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)t.add(e);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}();let i=2;for(;i+9=10&&1195984440===e.getUint32(0,ki)?{mimeType:"image/gif",width:e.getUint16(6,Vi),height:e.getUint16(8,Vi)}:null}(e)||function(t){const e=Qi(t);return e.byteLength>=14&&16973===e.getUint16(0,ki)&&e.getUint32(2,Vi)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Vi),height:e.getUint32(22,Vi)}:null}(e)||function(t){const e=function(t){return function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=ji(e);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:null;if((Ji(e)||!Hi)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),Hi=!1}return await createImageBitmap(t)}(r,i)}(t,e,i);break;case"image":a=await Ni(t,e,i);break;case"data":a=await async function(t,e){var n;const{mimeType:r}=Ki(t)||{},i=null===(n=globalThis.loaders)||void 0===n?void 0:n.parseImageNode;return o(i),await i(t,r)}(t);break;default:o(!1)}return"data"===r&&(a=Fi(a)),a},tests:[t=>!!Ki(new DataView(t))],options:{image:{type:"auto",decode:!0}}},qi={};function Wi(t,e){if(!t)throw new Error(e||"assert failed: gltf")}const Yi={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Xi={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Zi=["SCALAR","VEC2","VEC3","VEC4"],$i=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],ts=new Map($i),es={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ns={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},rs={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function is(t){return Zi[t-1]||Zi[0]}function ss(t){const e=ts.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function os(t,e){const n=rs[t.componentType],r=es[t.type],i=ns[t.componentType],s=t.count*r,o=t.count*r*i;return Wi(o>=0&&o<=e.byteLength),{ArrayType:n,length:s,byteLength:o,componentByteSize:Xi[t.componentType],numberOfComponentsInElement:Yi[t.type]}}function as(t){let{images:e,bufferViews:n}=t;e=e||[],n=n||[];const r=e.map((t=>t.bufferView));n=n.filter((t=>!r.includes(t)));const i=n.reduce(((t,e)=>t+e.byteLength),0),s=e.reduce(((t,e)=>{const{width:n,height:r}=e.image;return t+n*r}),0);return i+Math.ceil(4*s*1.33)}class cs{constructor(t){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:(null==t?void 0:t.json)||{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]},buffers:(null==t?void 0:t.buffers)||[],images:(null==t?void 0:t.images)||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){const e=this.getUsedExtensions().find((e=>e===t)),n=this.getRequiredExtensions().find((e=>e===t));return"string"==typeof e||"string"==typeof n}getExtension(t){const e=this.getUsedExtensions().find((e=>e===t)),n=this.json.extensions||{};return e?n[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find((e=>e===t))?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,e){return(t.extensions||{})[e]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,e){if("object"==typeof e)return e;const n=this.json[t]&&this.json[t][e];if(!n)throw new Error(`glTF file error: Could not find ${t}[${e}]`);return n}getTypedArrayForBufferView(t){const e=(t=this.getBufferView(t)).buffer,n=this.gltf.buffers[e];Wi(n);const r=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,r,t.byteLength)}getTypedArrayForAccessor(t){const e=this.getAccessor(t);return function(t,e,n){var r,i;const s="number"==typeof n?null===(r=t.accessors)||void 0===r?void 0:r[n]:n;if(!s)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);const o=null===(i=t.bufferViews)||void 0===i?void 0:i[s.bufferView||0];if(!o)throw new Error(`No gltf buffer view for accessor ${o}`);const{arrayBuffer:a,byteOffset:c}=e[o.buffer],h=(c||0)+(s.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:u,componentByteSize:d,numberOfComponentsInElement:f}=os(s,o),m=d*f,p=o.byteStride||m;if(typeof o.byteStride>"u"||o.byteStride===m)return new l(a,h,u);const g=new l(u);for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:{};return Wi(e),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=e,this.registerUsedExtension(t),e}addRequiredExtension(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Wi(e),this.addExtension(t,e),this.registerRequiredExtension(t),e}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((e=>e===t))||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((e=>e===t))||this.json.extensionsRequired.push(t)}removeExtension(t){var e;if(null!==(e=this.json.extensions)&&void 0!==e&&e[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];const e=this.json.extensionsRemoved;e.includes(t)||e.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){const{nodeIndices:e}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:e}),this.json.scenes.length-1}addNode(t){const{meshIndex:e,matrix:n}=t;this.json.nodes=this.json.nodes||[];const r={mesh:e};return n&&(r.matrix=n),this.json.nodes.push(r),this.json.nodes.length-1}addMesh(t){const{attributes:e,indices:n,material:r,mode:i=4}=t,s={primitives:[{attributes:this._addAttributes(e),mode:i}]};if(n){const t=this._addIndices(n);s.primitives[0].indices=t}return Number.isFinite(r)&&(s.primitives[0].material=r),this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(t){const e={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(e),this.json.meshes.length-1}addImage(t,e){const n=Ki(t),r=e||(null==n?void 0:n.mimeType),i={bufferView:this.addBufferView(t),mimeType:r};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.byteLength;const r=t.byteLength;Wi(Number.isFinite(r)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);const i={buffer:e,byteOffset:n,byteLength:r};return this.byteLength+=H(r,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,e){const n={bufferView:t,type:is(e.size),componentType:e.componentType,count:e.count,max:e.max,min:e.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{size:3};const n=this.addBufferView(t);let r={min:e.min,max:e.max};(!r.min||!r.max)&&(r=this._getAccessorMinMax(t,e.size));const i={size:e.size,componentType:ss(t),count:Math.round(t.length/e.size),min:r.min,max:r.max};return this.addAccessor(n,Object.assign(i,e))}addTexture(t){const{imageIndex:e}=t,n={source:e};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,e;this.gltf.buffers=[];const n=this.byteLength,r=new ArrayBuffer(n),i=new Uint8Array(r);let s=0;for(const t of this.sourceBuffers||[])s=J(t,i,s);null!==(t=this.json)&&void 0!==t&&null!==(e=t.buffers)&&void 0!==e&&e[0]?this.json.buffers[0].byteLength=n:this.json.buffers=[{byteLength:n}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(t,e){let n=!0;for(;n;){const r=t.indexOf(e);r>-1?t.splice(r,1):n=!1}}_addAttributes(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={};for(const n in t){const r=t[n],i=this._getGltfAttributeName(n),s=this.addBinaryBuffer(r.value,r);e[i]=s}return e}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,e){const n={min:null,max:null};if(t.length3&&void 0!==arguments[3]?arguments[3]:1;const i=ls[e],s=us[n],o=ds[n],a=r*i,c=a*o;let h=t.buffer,l=t.byteOffset;return l%o!=0&&(h=new Uint8Array(h).slice(l,l+c).buffer,l=0),new s(h,l,a)}function gs(t,e,n){var r,i;const s=`TEXCOORD_${e.texCoord||0}`,o=n.attributes[s],a=t.getTypedArrayForAccessor(o),c=t.gltf.json,h=e.index,l=null===(r=c.textures)||void 0===r||null===(i=r[h])||void 0===i?void 0:i.source;if(typeof l<"u"){var u,d,f;const n=null===(u=c.images)||void 0===u||null===(d=u[l])||void 0===d?void 0:d.mimeType,r=null===(f=t.gltf.images)||void 0===f?void 0:f[l];if(r&&typeof r.width<"u"){const t=[];for(let i=0;ie===t));-1===e&&(e=r.push(t)-1),s.push(e)}const o=new Uint32Array(s),a=t.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,c=t.addBufferView(o,a,0),h=t.addAccessor(c,{size:1,componentType:ss(o),count:o.length});i.attributes[e]=h}function ys(t,e,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[0];const s={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],a=n[r+1];let c=1;e&&(-1!==e.indexOf("image/jpeg")||-1!==e.indexOf("image/png"))&&(c=4);const h=Bs(o,a,t,c);let l=0;for(const e of i){const n="number"==typeof e?Object.values(s)[e]:s[e],r=h+n.offset,i=Fi(t);if(i.data.length<=r)throw new Error(`${i.data.length} <= ${r}`);l|=i.data[r]<3&&void 0!==arguments[3]?arguments[3]:1;const i=n.width,s=hs(t)*(i-1),o=Math.round(s),a=n.height,c=hs(e)*(a-1),h=Math.round(c),l=n.components?n.components:r;return(h*i+o)*l}function bs(t,e,n,r,i){const s=[];for(let o=0;or)break;const c=e/i,h=a/i;s.push(t.slice(c,c+h))}return s}function Cs(t,e,n){const r=[];for(let i=0;i"u"&&typeof n.arrayOffsets<"u"?ms(t,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}(t,n,i,r),h=function(t,e,n){return typeof e.stringOffsets<"u"?ms(t,e.stringOffsets,e.stringOffsetType||"UINT32",n):null}(t,i,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":s=function(t,e,n,r){const i=t.array,s=t.count,o=fs(t.type,t.componentType),a=n.byteLength/o;let c;return c=t.componentType?ps(n,t.type,t.componentType,a):n,i?r?bs(c,e,r,n.length,o):s?Cs(c,e,s):[]:c}(n,r,a,c);break;case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":s=ws(r,a,c,h);break;case"ENUM":s=function(t,e,n,r,i){var s;const o=e.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");const a=null===(s=t.enums)||void 0===s?void 0:s[o];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);const c=a.valueType||"UINT16",h=fs(e.type,c),l=r.byteLength/h;let u=ps(r,e.type,c,l);if(u||(u=r),e.array){if(i)return function(t){const{valuesData:e,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:i,elementSize:s,enumEntry:o}=t,a=[];for(let t=0;ti)break;const h=Rs(e,n/s,c/s,o);a.push(h)}return a}({valuesData:u,numberOfElements:n,arrayOffsets:i,valuesDataBytesLength:r.length,elementSize:h,enumEntry:a});const t=e.count;return t?function(t,e,n,r){const i=[];for(let s=0;s"u"&&typeof n.arrayOffsetBufferView<"u"?ms(t,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}(t,n,i,r),h=function(t,e,n,r){return typeof n.stringOffsetBufferView<"u"?ms(t,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}(t,0,i,r);return"STRING"===n.type||"STRING"===n.componentType?s=ws(r,a,c,h):function(t){const e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(t.type)||typeof t.componentType<"u"&&e.includes(t.componentType)}(n)&&(s=function(t,e,n,r){const i="ARRAY"===t.type,s=t.componentCount,o="SCALAR",a=t.componentType||t.type,c=fs(o,a),h=ps(n,o,a,n.byteLength/c);return i?r?bs(h,e,r,n.length,c):s?Cs(h,e,s):[]:h}(n,r,a,c)),s}function Ps(t,e,n){const r=t.gltf.json;if(!r.meshes)return[];const i=[];for(const s of r.meshes)for(const r of s.primitives)Hs(t,n,e,i,r);return i}function Hs(t,e,n,r,i){const s=gs(t,{channels:n.channels,...n.texture},i);s&&As(t,e,s,r,i)}const Js=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e){!function(t,e){var n,r;if(null===(n=e.gltf)||void 0===n||!n.loadBuffers)return;const i=t.getExtension("EXT_feature_metadata");i&&(null!==(r=e.gltf)&&void 0!==r&&r.loadImages&&function(t,e){const n=e.schema;if(!n)return;const r=n.classes,{featureTextures:i}=e;if(r&&i)for(const e in r){const n=r[e],s=Gs(i,e);s&&Us(t,s,n)}}(t,i),function(t,e){const n=e.schema;if(!n)return;const r=n.classes,i=e.featureTables;if(r&&i)for(const e in r){const r=Ds(i,e);r&&Ls(t,n,r)}}(t,i))}(new cs(t),e)},name:"EXT_feature_metadata"},Symbol.toStringTag,{value:"Module"}));let js,ks;async function Vs(t){const e=t.modules||{};return e.basis?e.basis:(js=js||async function(t){let e=null,n=null;return[e,n]=await Promise.all([await O("basis_transcoder.js","textures",t),await O("basis_transcoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t(n).then((t=>{const{BasisFile:n,initializeBasis:r}=t;r(),e({BasisFile:n})}))}))}(e,n)}(t),await js)}async function Ks(t){const e=t.modules||{};return e.basisEncoder?e.basisEncoder:(ks=ks||async function(t){let e=null,n=null;return[e,n]=await Promise.all([await O("basis_encoder.js","textures",t),await O("basis_encoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const n={};return e&&(n.wasmBinary=e),new Promise((e=>{t(n).then((t=>{const{BasisFile:n,KTX2File:r,initializeBasis:i,BasisEncoder:s}=t;i(),e({BasisFile:n,KTX2File:r,BasisEncoder:s})}))}))}(e,n)}(t),await ks)}const Qs=["","WEBKIT_","MOZ_"],zs={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"};let qs=null;var Ws,Ys,Xs,Zs,$s,to,eo,no;(function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB"})(Ws||(Ws={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(Ys||(Ys={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(Xs||(Xs={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(Zs||(Zs={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}($s||($s={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(to||(to={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(eo||(eo={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(no||(no={}));const ro=[171,75,84,88,32,50,48,187,13,10,26,10],io={etc1:{basisFormat:0,compressed:!0,format:36196},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:33776},bc3:{basisFormat:3,compressed:!0,format:33779},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:35840},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:35842},"astc-4x4":{basisFormat:10,compressed:!0,format:37808},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};function so(t,e,n){const r=new t(new Uint8Array(e));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");const t=r.getNumImages(),e=[];for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}function go(t,e,n){o(t.header.byteLength>20);const r=e.getUint32(n+0,fo),i=e.getUint32(n+4,fo);return n+=8,o(0===i),yo(t,e,n,r),(n+=r)+Bo(t,e,n,t.header.byteLength)}function Ao(t,e,n,r){return o(t.header.byteLength>20),function(t,e,n,r){for(;n+8<=t.header.byteLength;){const i=e.getUint32(n+0,fo),s=e.getUint32(n+4,fo);switch(n+=8,s){case 1313821514:yo(t,e,n,i);break;case 5130562:Bo(t,e,n,i);break;case 0:r.strict||yo(t,e,n,i);break;case 1:r.strict||Bo(t,e,n,i)}n+=H(i,4)}}(t,e,n,r),n+t.header.byteLength}function yo(t,e,n,r){const i=new Uint8Array(e.buffer,n,r),s=new TextDecoder("utf8").decode(i);return t.json=JSON.parse(s),H(r,4)}function Bo(t,e,n,r){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:e.buffer}),H(r,4)}function bo(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;const n=e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return n.substr(0,n.lastIndexOf("/")+1)+t}const Co=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),wo=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),vo={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Eo={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};let To;async function _o(){return To||(To=async function(){let t="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";WebAssembly.validate(Co)&&(t="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support"));const e=await WebAssembly.instantiate(function(t){const e=new Uint8Array(t.length);for(let n=0;n96?r-71:r>64?r-65:r>47?r+4:r>46?63:62}let n=0;for(let r=0;r5&&void 0!==arguments[5]?arguments[5]:"NONE";const o=await _o();xo(o,o.exports[Eo[i]],t,e,n,r,o.exports[vo[s||"NONE"]])}(d,o,s,u,a,c),t.removeObjectExtension(e,Mo)}}const So=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e){var n,r;const i=new cs(t);if(null==e||null===(n=e.gltf)||void 0===n||!n.decompressMeshes||null===(r=e.gltf)||void 0===r||!r.loadBuffers)return;const s=[];for(const e of t.json.bufferViews||[])s.push(Io(i,e));await Promise.all(s),i.removeExtension(Mo)},name:"EXT_meshopt_compression"},Symbol.toStringTag,{value:"Module"})),Ro="EXT_texture_webp",Oo=Object.freeze(Object.defineProperty({__proto__:null,name:"EXT_texture_webp",preprocess:function(t,e){const n=new cs(t);if(!function(t){if(void 0===qi[t]){const e=a?function(t){switch(t){case"image/avif":case"image/webp":return function(t){try{return 0===document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)}catch{return!1}}(t);default:return!0}}(t):function(t){var e,n;const r=(null===(e=globalThis.loaders)||void 0===e?void 0:e.imageFormatsNode)||["image/png","image/jpeg","image/gif"];return!!(null===(n=globalThis.loaders)||void 0===n?void 0:n.parseImageNode)&&r.includes(t)}(t);qi[t]=e}return qi[t]}("image/webp")){if(n.getRequiredExtensions().includes(Ro))throw new Error(`gltf: Required extension ${Ro} not supported by browser`);return}const{json:r}=n;for(const t of r.textures||[]){const e=n.getObjectExtension(t,Ro);e&&(t.source=e.source),n.removeObjectExtension(t,Ro)}n.removeExtension(Ro)}},Symbol.toStringTag,{value:"Module"})),Fo="KHR_texture_basisu",Do=Object.freeze(Object.defineProperty({__proto__:null,name:"KHR_texture_basisu",preprocess:function(t,e){const n=new cs(t),{json:r}=n;for(const t of r.textures||[]){const e=n.getObjectExtension(t,Fo);e&&(t.source=e.source,n.removeObjectExtension(t,Fo))}n.removeExtension(Fo)}},Symbol.toStringTag,{value:"Module"}));function Go(t){const{buffer:e,size:n,count:r}=function(t){let e=t,n=1,r=0;return t&&t.value&&(e=t.value,n=t.size||1),e&&(ArrayBuffer.isView(e)||(e=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t?Array.isArray(t)?new e(t):!n||t instanceof e?t:new e(t):null}(e,Float32Array)),r=e.length/n),{buffer:e,size:n,count:r}}(t);return{value:e,size:n,byteOffset:0,count:r,type:is(n),componentType:ss(e)}}const Lo="KHR_draco_mesh_compression";async function Uo(t,e,n,r){const i=t.getObjectExtension(e,Lo);if(!i)return;const o=t.getTypedArrayForBufferView(i.bufferView),a=P(o.buffer,o.byteOffset),c={...n};delete c["3d-tiles"];const h=await s(a,$r,c,r),l=function(t){const e={};for(const n in t){const r=t[n];if("indices"!==n){const t=Go(r);e[n]=t}}return e}(h.attributes);for(const[n,r]of Object.entries(l))if(n in e.attributes){const i=e.attributes[n],s=t.getAccessor(i);null!=s&&s.min&&null!=s&&s.max&&(r.min=s.min,r.max=s.max)}e.attributes=l,h.indices&&(e.indices=Go(h.indices)),t.removeObjectExtension(e,Lo),function(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(e)}function No(t,e){var n;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,i=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(!i.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=i.DracoWriter.encodeSync({attributes:t}),a=null==s||null===(n=s.parseSync)||void 0===n?void 0:n.call(s,{attributes:t}),c=i._addFauxAttributes(a.attributes),h=i.addBufferView(o);return{primitives:[{attributes:c,mode:r,extensions:{[Lo]:{bufferView:h,attributes:c}}}]}}function*Po(t){for(const e of t.json.meshes||[])for(const t of e.primitives)yield t}const Ho=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t,e,n){var r;if(null==e||null===(r=e.gltf)||void 0===r||!r.decompressMeshes)return;const i=new cs(t),s=[];for(const t of Po(i))i.getObjectExtension(t,Lo)&&s.push(Uo(i,t,e,n));await Promise.all(s),i.removeExtension(Lo)},encode:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new cs(t);for(const t of n.json.meshes||[])No(t,e),n.addRequiredExtension(Lo)},name:"KHR_draco_mesh_compression",preprocess:function(t,e,n){const r=new cs(t);for(const t of Po(r))r.getObjectExtension(t,Lo)}},Symbol.toStringTag,{value:"Module"})),Jo="KHR_texture_transform",jo=new Qe,ko=new $e,Vo=new $e;function Ko(t,e){var n,r,i;const s=[],o=null===(n=e.json.materials)||void 0===n?void 0:n[t],a=null==o||null===(r=o.pbrMetallicRoughness)||void 0===r?void 0:r.baseColorTexture;a&&Qo(e,t,a,s);const c=null==o?void 0:o.emissiveTexture;c&&Qo(e,t,c,s);const h=null==o?void 0:o.normalTexture;h&&Qo(e,t,h,s);const l=null==o?void 0:o.occlusionTexture;l&&Qo(e,t,l,s);const u=null==o||null===(i=o.pbrMetallicRoughness)||void 0===i?void 0:i.metallicRoughnessTexture;u&&Qo(e,t,u,s)}function Qo(t,e,n,r){const i=function(t,e){var n;const r=null===(n=t.extensions)||void 0===n?void 0:n[Jo],{texCoord:i=0}=t,{texCoord:s=i}=r;if(-1===e.findIndex((t=>{let[e,n]=t;return e===i&&n===s}))){const n=function(t){const{offset:e=[0,0],rotation:n=0,scale:r=[1,1]}=t,i=(new $e).set(1,0,0,0,1,0,e[0],e[1],1),s=ko.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=Vo.set(r[0],0,0,0,r[1],0,0,0,1);return i.multiplyRight(s).multiplyRight(o)}(r);return i!==s&&(t.texCoord=s),e.push([i,s]),{originalTexCoord:i,texCoord:s,matrix:n}}return null}(n,r);if(!i)return;const s=t.json.meshes||[];for(const n of s)for(const r of n.primitives){const n=r.material;Number.isFinite(n)&&e===n&&zo(t,r,i)}}function zo(t,e,n){const{originalTexCoord:r,texCoord:i,matrix:s}=n,o=e.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){var a;const n=null===(a=t.json.accessors)||void 0===a?void 0:a[o];if(n&&n.bufferView){var c;const o=null===(c=t.json.bufferViews)||void 0===c?void 0:c[n.bufferView];if(o){const{arrayBuffer:a,byteOffset:c}=t.buffers[o.buffer],h=(c||0)+(n.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:u}=os(n,o),d=Xi[n.componentType],f=Yi[n.type],m=o.byteStride||d*f,p=new Float32Array(u);for(let t=0;t{t.uniforms[e].value&&!(e in n)&&(n[e]=t.uniforms[e].value)})),Object.keys(n).forEach((t=>{"object"==typeof n[t]&&void 0!==n[t].index&&(n[t].texture=e.getTexture(n[t].index))})),n}const ea=Object.freeze(Object.defineProperty({__proto__:null,decode:async function(t){const e=new cs(t),{json:n}=e,r=e.getExtension($o);if(r){const t=function(t,e){const{programs:n=[],shaders:r=[],techniques:i=[]}=t,s=new TextDecoder;return r.forEach((t=>{if(!Number.isFinite(t.bufferView))throw new Error("KHR_techniques_webgl: no shader code");t.code=s.decode(e.getTypedArrayForBufferView(t.bufferView))})),n.forEach((t=>{t.fragmentShader=r[t.fragmentShader],t.vertexShader=r[t.vertexShader]})),i.forEach((t=>{t.program=n[t.program]})),i}(r,e);for(const r of n.materials||[]){const n=e.getObjectExtension(r,$o);n&&(r.technique=Object.assign({},n,t[n.technique]),r.technique.values=ta(r.technique,e)),e.removeObjectExtension(r,$o)}e.removeExtension($o)}},encode:async function(t,e){},name:"KHR_techniques_webgl"},Symbol.toStringTag,{value:"Module"})),na=[Fs,Es,So,Oo,Do,Ho,Yo,Zo,ea,qo,Js];function ra(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=na.filter((t=>sa(t.name,e)));for(const s of r){var i;null===(i=s.preprocess)||void 0===i||i.call(s,t,e,n)}}async function ia(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=na.filter((t=>sa(t.name,e)));for(const s of r){var i;await(null===(i=s.decode)||void 0===i?void 0:i.call(s,t,e,n))}}function sa(t,e){var n;const r=(null==e||null===(n=e.gltf)||void 0===n?void 0:n.excludeExtensions)||{};return!(t in r&&!r[t])}const oa="KHR_binary_glTF",aa={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},ca={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class ha{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(t,e){this.json=t.json;const n=t.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn(`glTF: Unknown version ${n.asset.version}`)}if(!e.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),function(t){const e=new cs(t),{json:n}=e;for(const t of n.images||[]){const n=e.getObjectExtension(t,oa);n&&Object.assign(t,n),e.removeObjectExtension(t,oa)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,e.removeExtension(oa)}(t),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(const e in aa)this._convertTopLevelObjectToArray(t,e)}_convertTopLevelObjectToArray(t,e){const n=t[e];if(n&&!Array.isArray(n)){t[e]=[];for(const r in n){const i=n[r];i.id=i.id||r;const s=t[e].length;t[e].push(i),this.idToIndexMap[e][r]=s}}}_convertObjectIdsToArrayIndices(t){for(const e in aa)this._convertIdsToIndices(t,e);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(const e of t.textures)this._convertTextureIds(e);for(const e of t.meshes)this._convertMeshIds(e);for(const e of t.nodes)this._convertNodeIds(e);for(const e of t.scenes)this._convertSceneIds(e)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(const e of t.primitives){const{attributes:t,indices:n,material:r}=e;for(const e in t)t[e]=this._convertIdToIndex(t[e],"accessor");n&&(e.indices=this._convertIdToIndex(n,"accessor")),r&&(e.material=this._convertIdToIndex(r,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map((t=>this._convertIdToIndex(t,"node")))),t.meshes&&(t.meshes=t.meshes.map((t=>this._convertIdToIndex(t,"mesh"))))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map((t=>this._convertIdToIndex(t,"node"))))}_convertIdsToIndices(t,e){t[e]||(console.warn(`gltf v1: json doesn't contain attribute ${e}`),t[e]=[]);for(const n of t[e])for(const t in n){const e=n[t],r=this._convertIdToIndex(e,t);n[t]=r}}_convertIdToIndex(t,e){const n=ca[e];if(n in this.idToIndexMap){const r=this.idToIndexMap[n][t];if(!Number.isFinite(r))throw new Error(`gltf v1: failed to resolve ${e} with id ${t}`);return r}return t}_updateObjects(t){for(const t of this.json.buffers)delete t.type}_updateMaterial(t){for(const i of t.materials){var e,n,r;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const s=(null===(e=i.values)||void 0===e?void 0:e.tex)||(null===(n=i.values)||void 0===n?void 0:n.texture2d_0)||(null===(r=i.values)||void 0===r?void 0:r.diffuseTex),o=t.textures.findIndex((t=>t.id===s));-1!==o&&(i.pbrMetallicRoughness.baseColorTexture={index:o})}}}function la(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(new ha).normalize(t,e)}async function ua(t,e){var n,r,i;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return da(t,e,s,o),la(t,{normalize:null==o||null===(n=o.gltf)||void 0===n?void 0:n.normalize}),ra(t,o,a),null!=o&&null!==(r=o.gltf)&&void 0!==r&&r.loadBuffers&&t.json.buffers&&await fa(t,o,a),null!=o&&null!==(i=o.gltf)&&void 0!==i&&i.loadImages&&await ma(t,o,a),await ia(t,o,a),t}function da(t,e,n,r){if(r.uri&&(t.baseUri=r.uri),e instanceof ArrayBuffer&&!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new DataView(t),{magic:i=mo}=n,s=r.getUint32(e,!1);return s===i||s===mo}(e,n,r)&&(e=(new TextDecoder).decode(e)),"string"==typeof e)t.json=function(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;return"string"==typeof t?t.slice(0,e):ArrayBuffer.isView(t)?U(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?U(t,0,e):""}(t)}"`)}}(e);else if(e instanceof ArrayBuffer){const i={};n=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=new DataView(e),i=po(r,n+0),s=r.getUint32(n+4,fo),o=r.getUint32(n+8,fo);switch(Object.assign(t,{header:{byteOffset:n,byteLength:o,hasBinChunk:!1},type:i,version:s,json:{},binChunks:[]}),n+=12,t.version){case 1:return go(t,r,n);case 2:return Ao(t,r,n,{});default:throw new Error(`Invalid GLB version ${t.version}. Only supports version 1 and 2.`)}}(i,e,n,r.glb),Wi("glTF"===i.type,`Invalid GLB magic string ${i.type}`),t._glb=i,t.json=i.json}else Wi(!1,"GLTF: must be ArrayBuffer or string");const i=t.json.buffers||[];if(t.buffers=new Array(i.length).fill(null),t._glb&&t._glb.header.hasBinChunk){const{binChunks:e}=t._glb;t.buffers[0]={arrayBuffer:e[0].arrayBuffer,byteOffset:e[0].byteOffset,byteLength:e[0].byteLength}}const s=t.json.images||[];t.images=new Array(s.length).fill({})}async function fa(t,e,n){const r=t.json.buffers||[];for(let o=0;o1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;e={...ga.options,...e},e.gltf={...ga.options.gltf,...e.gltf};const{byteOffset:r=0}=e;return await ua({},t,r,e,n)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}},Aa={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ya={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ba={magFilter:10240,minFilter:10241,wrapS:10242,wrapT:10243},ba={10240:9729,10241:9986,10242:10497,10243:10497};class Ca{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{json:n,buffers:r=[],images:i=[]}=t,{baseUri:s=""}=t;return Wi(n),this.baseUri=s,this.buffers=r,this.images=i,this.jsonUnprocessed=n,this.json=this._resolveTree(t.json,e),this.json}_resolveTree(t){const e={...t};return this.json=e,t.bufferViews&&(e.bufferViews=t.bufferViews.map(((t,e)=>this._resolveBufferView(t,e)))),t.images&&(e.images=t.images.map(((t,e)=>this._resolveImage(t,e)))),t.samplers&&(e.samplers=t.samplers.map(((t,e)=>this._resolveSampler(t,e)))),t.textures&&(e.textures=t.textures.map(((t,e)=>this._resolveTexture(t,e)))),t.accessors&&(e.accessors=t.accessors.map(((t,e)=>this._resolveAccessor(t,e)))),t.materials&&(e.materials=t.materials.map(((t,e)=>this._resolveMaterial(t,e)))),t.meshes&&(e.meshes=t.meshes.map(((t,e)=>this._resolveMesh(t,e)))),t.nodes&&(e.nodes=t.nodes.map(((t,e)=>this._resolveNode(t,e))),e.nodes=e.nodes.map(((t,e)=>this._resolveNodeChildren(t)))),t.skins&&(e.skins=t.skins.map(((t,e)=>this._resolveSkin(t,e)))),t.scenes&&(e.scenes=t.scenes.map(((t,e)=>this._resolveScene(t,e)))),"number"==typeof this.json.scene&&e.scenes&&(e.scene=e.scenes[this.json.scene]),e}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,e){if("object"==typeof e)return e;const n=t&&t[e];return n||console.warn(`glTF file error: Could not find ${t}[${e}]`),n}_resolveScene(t,e){return{...t,id:t.id||`scene-${e}`,nodes:(t.nodes||[]).map((t=>this.getNode(t)))}}_resolveNode(t,e){const n={...t,id:(null==t?void 0:t.id)||`node-${e}`};return void 0!==t.mesh&&(n.mesh=this.getMesh(t.mesh)),void 0!==t.camera&&(n.camera=this.getCamera(t.camera)),void 0!==t.skin&&(n.skin=this.getSkin(t.skin)),void 0!==t.meshes&&t.meshes.length&&(n.mesh=t.meshes.reduce(((t,e)=>{const n=this.getMesh(e);return t.id=n.id,t.primitives=t.primitives.concat(n.primitives),t}),{primitives:[]})),n}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map((t=>this.getNode(t)))),t}_resolveSkin(t,e){const n="number"==typeof t.inverseBindMatrices?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${e}`,inverseBindMatrices:n}}_resolveMesh(t,e){const n={...t,id:t.id||`mesh-${e}`,primitives:[]};return t.primitives&&(n.primitives=t.primitives.map((t=>{const e={...t,attributes:{},indices:void 0,material:void 0},n=t.attributes;for(const t in n)e.attributes[t]=this.getAccessor(n[t]);return void 0!==t.indices&&(e.indices=this.getAccessor(t.indices)),void 0!==t.material&&(e.material=this.getMaterial(t.material)),e}))),n}_resolveMaterial(t,e){const n={...t,id:t.id||`material-${e}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};const t=n.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,e){const n=function(t){return ya[t]}(t.componentType),r=function(t){return Aa[t]}(t.type),i=n*r,s={...t,id:t.id||`accessor-${e}`,bytesPerComponent:n,components:r,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(void 0!==t.bufferView&&(s.bufferView=this.getBufferView(t.bufferView)),s.bufferView){const t=s.bufferView.buffer,{ArrayType:e,byteLength:n}=os(s,s.bufferView),r=(s.bufferView.byteOffset||0)+(s.byteOffset||0)+t.byteOffset;let i=t.arrayBuffer.slice(r,r+n);s.bufferView.byteStride&&(i=this._getValueFromInterleavedBuffer(t,r,s.bufferView.byteStride,s.bytesPerElement,s.count)),s.value=new e(i)}return s}_getValueFromInterleavedBuffer(t,e,n,r,i){const s=new Uint8Array(i*r);for(let o=0;o12;){const o={shape:"tile3d"};t.tiles.push(o),n=await s(e,n,r,i,o)}return n}async function Ma(t,e,n,r){var i,o;if(t.rotateYtoZ=!0,t.gltfUpAxis=null!=n&&null!==(i=n["3d-tiles"])&&void 0!==i&&i.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",null!=n&&null!==(o=n["3d-tiles"])&&void 0!==o&&o.loadGLTF){if(!r)return e.byteLength;const i=await s(e,ga,n,r);t.gltf=wa(i),t.gpuMemoryUsageInBytes=as(t.gltf)}else t.gltfArrayBuffer=e;return e.byteLength}async function Ia(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{shape:"tile3d"};switch(i.byteOffset=e,i.type=Pr(t,e),i.type){case Fr:return await xa(i,t,e,n,r,Ia);case Gr:return await Ta(i,t,e,n,r);case Ur:return await Ma(i,t,n,r);case Lr:return await _a(i,t,e,n,r);case Dr:return await xi(i,t,e,n,r);default:throw new Error(`3DTileLoader: unknown type ${i.type}`)}}async function Sa(t,e,n,r){const i=Number.isFinite(e.bitstream)?e.bitstream:e.bufferView;if("number"!=typeof i)return;const s=t.bufferViews[i],o=t.buffers[s.buffer];if(null==r||!r.baseUrl)throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){const t=`${(null==r?void 0:r.baseUrl)||""}/${o.uri}`,n=await(await r.fetch(t)).arrayBuffer();return void(e.explicitBitstream=new Uint8Array(n,s.byteOffset,s.byteLength))}const a=t.buffers.slice(0,s.buffer).reduce(((t,e)=>t+e.byteLength),0);e.explicitBitstream=new Uint8Array(n.slice(a,a+o.byteLength),s.byteOffset,s.byteLength)}function Ra(t){const e=new DataView(t);return e.getUint32(0,!0)+2**32*e.getUint32(4,!0)}const Oa={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Or,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:async function(t,e,n){if(1952609651!==new Uint32Array(t.slice(0,4))[0])throw new Error("Wrong subtree file magic number");if(1!==new Uint32Array(t.slice(4,8))[0])throw new Error("Wrong subtree file verson, must be 1");const r=Ra(t.slice(8,16)),i=new Uint8Array(t,24,r),s=new TextDecoder("utf8").decode(i),o=JSON.parse(s),a=Ra(t.slice(16,24));let c=new ArrayBuffer(0);if(a&&(c=t.slice(24+r)),await Sa(o,o.tileAvailability,c,n),Array.isArray(o.contentAvailability))for(const t of o.contentAvailability)await Sa(o,t,c,n);else await Sa(o,o.contentAvailability,c,n);return await Sa(o,o.childSubtreeAvailability,c,n),o},options:{}};var Fa=null;try{Fa=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Da(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function Ga(t){return!0===(t&&t.__isLong__)}function La(t){var e=Math.clz32(t&-t);return t?31-e:e}Da.prototype.__isLong__,Object.defineProperty(Da.prototype,"__isLong__",{value:!0}),Da.isLong=Ga;var Ua={},Na={};function Pa(t,e){var n,r,i;return e?(i=0<=(t>>>=0)&&t<256)&&(r=Na[t])?r:(n=Ja(t,0,!0),i&&(Na[t]=n),n):(i=-128<=(t|=0)&&t<128)&&(r=Ua[t])?r:(n=Ja(t,t<0?-1:0,!1),i&&(Ua[t]=n),n)}function Ha(t,e){if(isNaN(t))return e?Ya:Wa;if(e){if(t<0)return Ya;if(t>=Qa)return ec}else{if(t<=-za)return nc;if(t+1>=za)return tc}return t<0?Ha(-t,e).neg():Ja(t%Ka|0,t/Ka|0,e)}function Ja(t,e,n){return new Da(t,e,n)}Da.fromInt=Pa,Da.fromNumber=Ha,Da.fromBits=Ja;var ja=Math.pow;function ka(t,e,n){if(0===t.length)throw Error("empty string");if("number"==typeof e?(n=e,e=!1):e=!!e,"NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return e?Ya:Wa;if((n=n||10)<2||360)throw Error("interior hyphen");if(0===r)return ka(t.substring(1),e,n).neg();for(var i=Ha(ja(n,8)),s=Wa,o=0;o>>0:this.low},rc.toNumber=function(){return this.unsigned?(this.high>>>0)*Ka+(this.low>>>0):this.high*Ka+(this.low>>>0)},rc.toString=function(t){if((t=t||10)<2||36>>0).toString(t);if((s=a).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},rc.getHighBits=function(){return this.high},rc.getHighBitsUnsigned=function(){return this.high>>>0},rc.getLowBits=function(){return this.low},rc.getLowBitsUnsigned=function(){return this.low>>>0},rc.getNumBitsAbs=function(){if(this.isNegative())return this.eq(nc)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&!(t&1<=0},rc.isOdd=function(){return 1==(1&this.low)},rc.isEven=function(){return 0==(1&this.low)},rc.equals=function(t){return Ga(t)||(t=Va(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&this.high===t.high&&this.low===t.low},rc.eq=rc.equals,rc.notEquals=function(t){return!this.eq(t)},rc.neq=rc.notEquals,rc.ne=rc.notEquals,rc.lessThan=function(t){return this.comp(t)<0},rc.lt=rc.lessThan,rc.lessThanOrEqual=function(t){return this.comp(t)<=0},rc.lte=rc.lessThanOrEqual,rc.le=rc.lessThanOrEqual,rc.greaterThan=function(t){return this.comp(t)>0},rc.gt=rc.greaterThan,rc.greaterThanOrEqual=function(t){return this.comp(t)>=0},rc.gte=rc.greaterThanOrEqual,rc.ge=rc.greaterThanOrEqual,rc.compare=function(t){if(Ga(t)||(t=Va(t)),this.eq(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},rc.comp=rc.compare,rc.negate=function(){return!this.unsigned&&this.eq(nc)?nc:this.not().add(Xa)},rc.neg=rc.negate,rc.add=function(t){Ga(t)||(t=Va(t));var e=this.high>>>16,n=65535&this.high,r=this.low>>>16,i=65535&this.low,s=t.high>>>16,o=65535&t.high,a=t.low>>>16,c=0,h=0,l=0,u=0;return l+=(u+=i+(65535&t.low))>>>16,h+=(l+=r+a)>>>16,c+=(h+=n+o)>>>16,c+=e+s,Ja((l&=65535)<<16|(u&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},rc.subtract=function(t){return Ga(t)||(t=Va(t)),this.add(t.neg())},rc.sub=rc.subtract,rc.multiply=function(t){if(this.isZero())return this;if(Ga(t)||(t=Va(t)),Fa)return Ja(Fa.mul(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned);if(t.isZero())return this.unsigned?Ya:Wa;if(this.eq(nc))return t.isOdd()?nc:Wa;if(t.eq(nc))return this.isOdd()?nc:Wa;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(qa)&&t.lt(qa))return Ha(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,n=65535&this.high,r=this.low>>>16,i=65535&this.low,s=t.high>>>16,o=65535&t.high,a=t.low>>>16,c=65535&t.low,h=0,l=0,u=0,d=0;return u+=(d+=i*c)>>>16,l+=(u+=r*c)>>>16,u&=65535,l+=(u+=i*a)>>>16,h+=(l+=n*c)>>>16,l&=65535,h+=(l+=r*a)>>>16,l&=65535,h+=(l+=i*o)>>>16,h+=e*c+n*a+r*o+i*s,Ja((u&=65535)<<16|(d&=65535),(h&=65535)<<16|(l&=65535),this.unsigned)},rc.mul=rc.multiply,rc.divide=function(t){if(Ga(t)||(t=Va(t)),t.isZero())throw Error("division by zero");var e,n,r;if(Fa)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?Ja((this.unsigned?Fa.div_u:Fa.div_s)(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Ya:Wa;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ya;if(t.gt(this.shru(1)))return Za;r=Ya}else{if(this.eq(nc))return t.eq(Xa)||t.eq($a)?nc:t.eq(nc)?Xa:(e=this.shr(1).div(t).shl(1)).eq(Wa)?t.isNegative()?Xa:$a:(n=this.sub(t.mul(e)),r=e.add(n.div(t)));if(t.eq(nc))return this.unsigned?Ya:Wa;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=Wa}for(n=this;n.gte(t);){e=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var i=Math.ceil(Math.log(e)/Math.LN2),s=i<=48?1:ja(2,i-48),o=Ha(e),a=o.mul(t);a.isNegative()||a.gt(n);)a=(o=Ha(e-=s,this.unsigned)).mul(t);o.isZero()&&(o=Xa),r=r.add(o),n=n.sub(a)}return r},rc.div=rc.divide,rc.modulo=function(t){return Ga(t)||(t=Va(t)),Fa?Ja((this.unsigned?Fa.rem_u:Fa.rem_s)(this.low,this.high,t.low,t.high),Fa.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},rc.mod=rc.modulo,rc.rem=rc.modulo,rc.not=function(){return Ja(~this.low,~this.high,this.unsigned)},rc.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},rc.clz=rc.countLeadingZeros,rc.countTrailingZeros=function(){return this.low?La(this.low):La(this.high)+32},rc.ctz=rc.countTrailingZeros,rc.and=function(t){return Ga(t)||(t=Va(t)),Ja(this.low&t.low,this.high&t.high,this.unsigned)},rc.or=function(t){return Ga(t)||(t=Va(t)),Ja(this.low|t.low,this.high|t.high,this.unsigned)},rc.xor=function(t){return Ga(t)||(t=Va(t)),Ja(this.low^t.low,this.high^t.high,this.unsigned)},rc.shiftLeft=function(t){return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?Ja(this.low<>>32-t,this.unsigned):Ja(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):Ja(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},rc.shr=rc.shiftRight,rc.shiftRightUnsigned=function(t){return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?Ja(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):Ja(32===t?this.high:this.high>>>t-32,0,this.unsigned)},rc.shru=rc.shiftRightUnsigned,rc.shr_u=rc.shiftRightUnsigned,rc.rotateLeft=function(t){var e;return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:32===t?Ja(this.high,this.low,this.unsigned):t<32?(e=32-t,Ja(this.low<>>e,this.high<>>e,this.unsigned)):(e=32-(t-=32),Ja(this.high<>>e,this.low<>>e,this.unsigned))},rc.rotl=rc.rotateLeft,rc.rotateRight=function(t){var e;return Ga(t)&&(t=t.toInt()),0==(t&=63)?this:32===t?Ja(this.high,this.low,this.unsigned):t<32?(e=32-t,Ja(this.high<>>t,this.low<>>t,this.unsigned)):(e=32-(t-=32),Ja(this.low<>>t,this.high<>>t,this.unsigned))},rc.rotr=rc.rotateRight,rc.toSigned=function(){return this.unsigned?Ja(this.low,this.high,!1):this},rc.toUnsigned=function(){return this.unsigned?this:Ja(this.low,this.high,!0)},rc.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},rc.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},rc.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},Da.fromBytes=function(t,e,n){return n?Da.fromBytesLE(t,e):Da.fromBytesBE(t,e)},Da.fromBytesLE=function(t,e){return new Da(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},Da.fromBytesBE=function(t,e){return new Da(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)};const sc=180/Math.PI;function oc(t,e,n){const r=1<=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function cc(t){return[ac(t[0]),ac(t[1])]}function hc(t,e){let[n,r]=e;switch(t){case 0:return[1,n,r];case 1:return[-n,1,r];case 2:return[-n,-r,1];case 3:return[-1,-r,-n];case 4:return[r,-1,-n];case 5:return[r,n,-1];default:throw new Error("Invalid face")}}function lc(t){let[e,n,r]=t;const i=Math.atan2(r,Math.sqrt(e*e+n*n));return[Math.atan2(n,e)*sc,i*sc]}function uc(t,e,n,r){if(0===r){1===n&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const r=e[0];e[0]=e[1],e[1]=r}}function dc(t){const{face:e,ij:n,level:r}=t,i=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(100*Math.pow(2,-r))),o=new Float64Array(4*s*2+2);let a=0,c=0;for(let t=0;t<4;t++){const h=i[t].slice(0),l=i[t+1],u=(l[0]-h[0])/s,d=(l[1]-h[1])/s;for(let t=0;t89.999&&(t[0]=c);const i=t[0]-c;t[0]+=i>180?-360:i<-180?360:0,o[a++]=t[0],o[a++]=t[1],c=t[0]}}return o[a++]=o[0],o[a++]=o[1],o}function fc(t){const e=function(t){return t.indexOf("/")>0?t:function(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<64;)e="0"+e;const n=e.lastIndexOf("1"),r=e.substring(0,3),i=e.substring(3,n),s=i.length/2,o=Da.fromString(r,!0,2).toString(10);let a="";if(0!==s)for(a=Da.fromString(i,!0,2).toString(4);a.length=0;t--){s=i-t;const e=r[t];let n=0,a=0;"1"===e?a=1:"2"===e?(n=1,a=1):"3"===e&&(n=1);const c=Math.pow(2,s-1);uc(c,o,n,a),o[0]+=c*n,o[1]+=c*a}if(n%2==1){const t=o[0];o[0]=o[1],o[1]=t}return{face:n,ij:o,level:s}}(e)}function mc(t){if(t.length%2!=0)throw new Error("Invalid corners");const e=[],n=[];for(let r=0;rt-e)),n.sort(((t,e)=>t-e)),{west:e[0],east:e[e.length-1],north:n[n.length-1],south:n[0]}}function pc(t){const e=t.token,n={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},r=function(t,e){const n=(null==e?void 0:e.minimumHeight)||0,r=(null==e?void 0:e.maximumHeight)||0,i=function(t){let e;if(2===t.face||5===t.face){let n=null,r=0;for(let e=0;e<4;e++){const i=dc(fc(`${t.face}/${e}`));(typeof n>"u"||null===n)&&(n=new Float64Array(4*i.length)),n.set(i,r),r+=i.length}e=mc(n)}else e=mc(dc(t));return e}(fc(t)),s=i.west,o=i.south,a=i.east,c=i.north,h=[];return h.push(new Qe(s,c,n)),h.push(new Qe(a,c,n)),h.push(new Qe(a,o,n)),h.push(new Qe(s,o,n)),h.push(new Qe(s,c,r)),h.push(new Qe(a,c,r)),h.push(new Qe(a,o,r)),h.push(new Qe(s,o,r)),h}(e,n),i=function(t){return function(t){const e=cc(oc(t.ij,t.level,[.5,.5]));return lc(hc(t.face,e))}(fc(t))}(e),s=i[0],o=i[1],a=Hn.WGS84.cartographicToCartesian([s,o,n.maximumHeight]),c=new Qe(a[0],a[1],a[2]);r.push(c);const h=function(t,e=new Xn){if(!t||0===t.length)return e.halfAxes=new $e([0,0,0,0,0,0,0,0,0]),e.center=new Qe,e;const n=t.length,r=new Qe(0,0,0);for(const e of t)r.add(e);const i=1/n;r.multiplyByScalar(i);let s=0,o=0,a=0,c=0,h=0,l=0;for(const e of t){const t=Cr.copy(e).subtract(r);s+=t.x*t.x,o+=t.x*t.y,a+=t.x*t.z,c+=t.y*t.y,h+=t.y*t.z,l+=t.z*t.z}s*=i,o*=i,a*=i,c*=i,h*=i,l*=i;const u=_r;u[0]=s,u[1]=o,u[2]=a,u[3]=o,u[4]=c,u[5]=h,u[6]=a,u[7]=h,u[8]=l;const{unitary:d}=function(t,e={}){let n=0,r=0;const i=fr,s=mr;i.identity(),s.copy(t);const o=1e-20*function(t){let e=0;for(let n=0;n<9;++n){const r=t[n];e+=r*r}return Math.sqrt(e)}(s);for(;r<10&&Br(s)>o;)br(s,pr),gr.copy(pr).transpose(),s.multiplyRight(pr),s.multiplyLeft(gr),i.multiplyRight(pr),++n>2&&(++r,n=0);return e.unitary=i.toTarget(e.unitary),e.diagonal=s.toTarget(e.diagonal),e}(u,xr),f=e.halfAxes.copy(d);let m=f.getColumn(0,vr),p=f.getColumn(1,Er),g=f.getColumn(2,Tr),A=-Number.MAX_VALUE,y=-Number.MAX_VALUE,B=-Number.MAX_VALUE,b=Number.MAX_VALUE,C=Number.MAX_VALUE,w=Number.MAX_VALUE;for(const e of t)Cr.copy(e),A=Math.max(Cr.dot(m),A),y=Math.max(Cr.dot(p),y),B=Math.max(Cr.dot(g),B),b=Math.min(Cr.dot(m),b),C=Math.min(Cr.dot(p),C),w=Math.min(Cr.dot(g),w);m=m.multiplyByScalar(.5*(b+A)),p=p.multiplyByScalar(.5*(C+y)),g=g.multiplyByScalar(.5*(w+B)),e.center.copy(m).add(p).add(g);const v=wr.set(A-b,y-C,B-w).multiplyByScalar(.5),E=new $e([v[0],0,0,0,v[1],0,0,0,v[2]]);return e.halfAxes.multiplyRight(E),e}(r);return[...h.center,...h.halfAxes]}const gc={QUADTREE:4,OCTREE:8};function Ac(t,e,n){if(null!=t&&t.box){const r=function(t,e){const n=function(t){return t.and(t.not().add(1))}(t).shiftRightUnsigned(2);return t.add(Da.fromNumber(2*e+1-4).multiply(n))}(ic(t.s2VolumeInfo.token),e),i=function(t){if(t.isZero())return"X";let e=t.countTrailingZeros();e=(e-e%4)/4;const n=e;e*=4;const r=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-n-r.length).join("0")+r}(r),s={...t.s2VolumeInfo};if("OCTREE"===(s.token=i,n)){const e=t.s2VolumeInfo,n=e.maximumHeight-e.minimumHeight,r=n/2,i=e.minimumHeight+n/2;e.minimumHeight=i-r,e.maximumHeight=i+r}return{box:pc(s),s2VolumeInfo:s}}}async function yc(t){const{implicitOptions:e,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:i,loaderOptions:s}=t;let{subtree:o,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=t;const{subdivisionScheme:h,subtreeLevels:l,maximumLevel:u,contentUrlTemplate:d,subtreesUriTemplate:f,basePath:m}=e,p={children:[],lodMetricValue:0,contentUrl:""};if(!u)return Ot.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${d} won't be loaded...`),p;const g=a+c.level;if(g>u)return p;const A=gc[h],y=Math.log2(A),B=1&r,b=r>>1&1,C=r>>2&1,w=(A**a-1)/(A-1);let v=Cc(n.mortonIndex,r,y),E=w+v,T=Cc(n.x,B,1),_=Cc(n.y,b,1),x=Cc(n.z,C,1),M=!1;a>=l&&(M=Bc(o.childSubtreeAvailability,v));const I=Cc(c.x,T,a),S=Cc(c.y,_,a),R=Cc(c.z,x,a);if(M){const t=wc(`${m}/${f}`,g,I,S,R);o=await he(t,Oa,s),c={mortonIndex:v,x:T,y:_,z:x,level:a},v=0,E=0,T=0,_=0,x=0,a=0}if(!Bc(o.tileAvailability,E))return p;Bc(o.contentAvailability,E)&&(p.contentUrl=wc(d,g,I,S,R));const O=a+1,F={mortonIndex:v,x:T,y:_,z:x};for(let t=0;t1&&Ot.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=t,"constant"in n?!!n.constant:!!n.explicitBitstream&&function(t,e){const n=t%8;return 1==(e[Math.floor(t/8)]>>n&1)}(e,n.explicitBitstream)}function bc(t,e,n,r,i){const{basePath:s,refine:o,getRefine:a,lodMetricType:c,getTileType:h,rootLodMetricValue:l,rootBoundingVolume:u}=r,d=t.contentUrl&&t.contentUrl.replace(`${s}/`,""),f=l/2**e,m=function(t,e,n){if(e.region){const{childTileX:r,childTileY:i,childTileZ:s}=n,[o,a,c,h,l,u]=e.region,d=2**t,f=(c-o)/d,m=(h-a)/d,p=(u-l)/d,[g,A]=[o+f*r,o+f*(r+1)],[y,B]=[a+m*i,a+m*(i+1)],[b,C]=[l+p*s,l+p*(s+1)];return{region:[g,y,A,B,b,C]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${e}`)}(e,null!=i&&i.box?{box:i.box}:u,n);return{children:t.children,contentUrl:t.contentUrl,content:{uri:d},id:t.contentUrl,refine:a(o),type:h(t),lodMetricType:c,lodMetricValue:f,geometricError:f,transform:t.transform,boundingVolume:m}}function Cc(t,e,n){return(t<s[t]))}function vc(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!e)return Ir.EMPTY;const n=e.split("?")[0].split(".").pop();switch(n){case"pnts":return Ir.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Ir.SCENEGRAPH;default:return n||Ir.EMPTY}}function Ec(t){switch(t){case"REPLACE":case"replace":return Mr.REPLACE;case"ADD":case"add":return Mr.ADD;default:return t}}function Tc(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){const n=new URL(t,`${e}/`);return decodeURI(n.toString())}return t.startsWith("/")?t:function(){const t=[];for(let e=0;e=-1&&!r;i--){let s;i>=0?s=t[i]:(void 0===e&&(e=z()),s=e),0!==s.length&&(n=`${s}/${n}`,r=s.charCodeAt(0)===Y)}return n=X(n,!r),r?`/${n}`:n.length>0?n:"."}(e,t)}function _c(t,e){if(!t)return null;let n;if(t.content){var r;const i=t.content.uri||(null===(r=t.content)||void 0===r?void 0:r.url);typeof i<"u"&&(n=Tc(i,e))}return{...t,id:n,contentUrl:n,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:vc(t,n),refine:Ec(t.refine)}}async function xc(t,e,n,r,i){var s,o,a;const{subdivisionScheme:c,maximumLevel:h,availableLevels:l,subtreeLevels:u,subtrees:{uri:d}}=r,f=Tc(wc(d,0,0,0,0),n),m=await he(f,Oa,i),p=null===(s=t.content)||void 0===s?void 0:s.uri,g=p?Tc(p,n):"",A=null==e||null===(o=e.root)||void 0===o?void 0:o.refine,y=t.geometricError,B=null===(a=t.boundingVolume.extensions)||void 0===a?void 0:a["3DTILES_bounding_volume_S2"];if(B){const e={box:pc(B),s2VolumeInfo:B};t.boundingVolume=e}const b=t.boundingVolume,C={contentUrlTemplate:g,subtreesUriTemplate:d,subdivisionScheme:c,subtreeLevels:u,maximumLevel:Number.isFinite(l)?l-1:h,refine:A,basePath:n,lodMetricType:Rr.GEOMETRIC_ERROR,rootLodMetricValue:y,rootBoundingVolume:b,getTileType:vc,getRefine:Ec};return await async function(t,e,n,r,i){if(!t)return null;const{children:s,contentUrl:o}=await yc({subtree:n,implicitOptions:r,loaderOptions:i});let a,c=null;return o&&(a=o,c={uri:o.replace(`${e}/`,"")}),{...t,id:a,contentUrl:a,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:vc(t,a),refine:Ec(t.refine),content:c||t.content,children:s}}(t,n,m,C,i)}function Mc(t){var e;return(null==t||null===(e=t.extensions)||void 0===e?void 0:e["3DTILES_implicit_tiling"])||(null==t?void 0:t.implicitTiling)}const Ic={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Or,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=e["3d-tiles"]||{};let i;return i="auto"===r.isTileset?(null==n?void 0:n.url)&&-1!==n.url.indexOf(".json"):r.isTileset,i?Sc(t,e,n):Rc(t,e,n)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function Sc(t,e,n){var r;const i=JSON.parse((new TextDecoder).decode(t)),s=(null==n?void 0:n.url)||"",o=function(t){return W(t)}(s),a=await async function(t,e,n){let r=null;const i=Mc(t.root);r=i&&t.root?await xc(t.root,t,e,i,n):_c(t.root,e);const s=[];for(s.push(r);s.length>0;){const r=s.pop()||{},i=r.children||[],o=[];for(const r of i){const i=Mc(r);let a;a=i?await xc(r,t,e,i,n):_c(r,e),a&&(o.push(a),s.push(a))}r.children=o}return r}(i,o,e||{});return{...i,shape:"tileset3d",loader:Ic,url:s,queryString:(null==n?void 0:n.queryString)||"",basePath:o,root:a||i.root,type:Sr.TILES3D,lodMetricType:Rr.GEOMETRIC_ERROR,lodMetricValue:(null===(r=i.root)||void 0===r?void 0:r.geometricError)||0}}async function Rc(t,e,n){const r={content:{shape:"tile3d",featureIds:null}};return await Ia(t,0,e,n,r.content),r.content}const Oc="https://api.cesium.com/v1/assets";async function Fc(t,e){if(!e){const n=await async function(t){o(t);const e={Authorization:`Bearer ${t}`},n=await dt("https://api.cesium.com/v1/assets",{headers:e});if(!n.ok)throw new Error(n.statusText);return await n.json()}(t);for(const t of n.items)"3DTILES"===t.type&&(e=t.id)}const n=await async function(t,e){o(t,e);const n={Authorization:`Bearer ${t}`},r=`${Oc}/${e}`;let i=await dt(`${r}`,{headers:n});if(!i.ok)throw new Error(i.statusText);let s=await i.json();if(i=await dt(`${r}/endpoint`,{headers:n}),!i.ok)throw new Error(i.statusText);const a=await i.json();return s={...s,...a},s}(t,e),{type:r,url:i}=n;return o("3DTILES"===r&&i),n.headers={Authorization:`Bearer ${n.accessToken}`},n}const Dc={...Ic,id:"cesium-ion",name:"Cesium Ion",preload:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e["cesium-ion"]||{};const{accessToken:n}=e;let r=e.assetId;if(!Number.isFinite(r)){const e=t.match(/\/([0-9]+)\/tileset.json/);r=e&&e[1]}return Fc(n,r)},parse:async(t,e,n)=>((e={...e})["3d-tiles"]=e["cesium-ion"],e.loader=Dc,Ic.parse(t,e,n)),options:{"cesium-ion":{...Ic.options["3d-tiles"],accessToken:null}}};class Gc{constructor(t,e){if(this.schema=void 0,this.options=void 0,this.shape=void 0,this.length=0,this.rows=null,this.cursor=0,this._headers=[],this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;return t?(t=t.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}}class Lc{constructor(t,e){if(this.schema=void 0,this.options=void 0,this.length=0,this.objectRows=null,this.arrayRows=null,this.cursor=0,this._headers=null,this.options=e,this.schema=t,t){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||(this._headers=function(t){const e=[];for(let n=0;n0?this.allocated*=2:100,this.columns={};for(const t in this.schema){const e=this.schema[t],n=e.type||Float32Array,r=this.columns[e.index];if(r&&ArrayBuffer.isView(r)){const t=new n(this.allocated);t.set(r),this.columns[e.index]=t}else r?(r.length=this.allocated,this.columns[e.index]=r):this.columns[e.index]=new n(this.allocated)}}}_pruneColumns(){for(const[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}}const Nc={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0};class Pc{constructor(t,e){this.schema=void 0,this.options=void 0,this.aggregator=null,this.batchCount=0,this.bytesUsed=0,this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),this.totalLength=0,this.totalBytes=0,this.rowBytes=0,this.schema=t,this.options={...Nc,...e}}limitReached(){var t,e;return!!(null!==(t=this.options)&&void 0!==t&&t.limit&&this.totalLength>=this.options.limit||null!==(e=this.options)&&void 0!==e&&e._limitMB&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),"string"==typeof t&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?8*t.length:8*Object.keys(t).length}_isFull(){if(!this.aggregator||0===this.aggregator.rowCount())return!1;if("auto"===this.options.batchSize){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return!(this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs||(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),0))}_getBatch(t){if(!this.aggregator)return null;null!=t&&t.bytesUsed&&(this.bytesUsed=t.bytesUsed);const e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return Lc;case"columnar-table":return Uc;case"arrow-table":if(!Pc.ArrowBatch)throw new Error("TableBatchBuilder");return Pc.ArrowBatch;default:return Gc}}}Pc.ArrowBatch=void 0;const Hc=Number.MAX_SAFE_INTEGER;var Jc=function(t){return t[t.BEGIN=0]="BEGIN",t[t.VALUE=1]="VALUE",t[t.OPEN_OBJECT=2]="OPEN_OBJECT",t[t.CLOSE_OBJECT=3]="CLOSE_OBJECT",t[t.OPEN_ARRAY=4]="OPEN_ARRAY",t[t.CLOSE_ARRAY=5]="CLOSE_ARRAY",t[t.TEXT_ESCAPE=6]="TEXT_ESCAPE",t[t.STRING=7]="STRING",t[t.BACKSLASH=8]="BACKSLASH",t[t.END=9]="END",t[t.OPEN_KEY=10]="OPEN_KEY",t[t.CLOSE_KEY=11]="CLOSE_KEY",t[t.TRUE=12]="TRUE",t[t.TRUE2=13]="TRUE2",t[t.TRUE3=14]="TRUE3",t[t.FALSE=15]="FALSE",t[t.FALSE2=16]="FALSE2",t[t.FALSE3=17]="FALSE3",t[t.FALSE4=18]="FALSE4",t[t.NULL=19]="NULL",t[t.NULL2=20]="NULL2",t[t.NULL3=21]="NULL3",t[t.NUMBER_DECIMAL_POINT=22]="NUMBER_DECIMAL_POINT",t[t.NUMBER_DIGIT=23]="NUMBER_DIGIT",t}(Jc||{});const jc=101,kc=/[\\"\n]/g,Vc={onready:()=>{},onopenobject:()=>{},onkey:()=>{},oncloseobject:()=>{},onopenarray:()=>{},onclosearray:()=>{},onvalue:()=>{},onerror:()=>{},onend:()=>{},onchunkparsed:()=>{}};class Kc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=Vc,this.bufferCheckPosition=Hc,this.q="",this.c="",this.p="",this.closed=!1,this.closedRoot=!1,this.sawRoot=!1,this.error=null,this.state=Jc.BEGIN,this.stack=[],this.position=0,this.column=0,this.line=1,this.slashed=!1,this.unicodeI=0,this.unicodeS=null,this.depth=0,this.textNode=void 0,this.numberNode=void 0,this.options={...Vc,...t},this.textNode=void 0,this.numberNode="",this.emit("onready")}end(){return(this.state!==Jc.VALUE||0!==this.depth)&&this._error("Unexpected end"),this._closeValue(),this.c="",this.closed=!0,this.emit("onend"),this}resume(){return this.error=null,this}close(){return this.write(null)}emit(t,e){var n,r;null===(n=(r=this.options)[t])||void 0===n||n.call(r,e,this)}emitNode(t,e){this._closeValue(),this.emit(t,e)}write(t){if(this.error)throw this.error;if(this.closed)return this._error("Cannot write after close. Assign an onready handler.");if(null===t)return this.end();let e=0,n=t.charCodeAt(0),r=this.p;for(;n&&(r=n,this.c=n=t.charCodeAt(e++),r!==n?this.p=r:r=this.p,n);)switch(this.position++,10===n?(this.line++,this.column=0):this.column++,this.state){case Jc.BEGIN:123===n?this.state=Jc.OPEN_OBJECT:91===n?this.state=Jc.OPEN_ARRAY:Qc(n)||this._error("Non-whitespace before {[.");continue;case Jc.OPEN_KEY:case Jc.OPEN_OBJECT:if(Qc(n))continue;if(this.state===Jc.OPEN_KEY)this.stack.push(Jc.CLOSE_KEY);else{if(125===n){this.emit("onopenobject"),this.depth++,this.emit("oncloseobject"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;continue}this.stack.push(Jc.CLOSE_OBJECT)}34===n?this.state=Jc.STRING:this._error('Malformed object key should start with "');continue;case Jc.CLOSE_KEY:case Jc.CLOSE_OBJECT:if(Qc(n))continue;58===n?(this.state===Jc.CLOSE_OBJECT?(this.stack.push(Jc.CLOSE_OBJECT),this._closeValue("onopenobject"),this.depth++):this._closeValue("onkey"),this.state=Jc.VALUE):125===n?(this.emitNode("oncloseobject"),this.depth--,this.state=this.stack.pop()||Jc.VALUE):44===n?(this.state===Jc.CLOSE_OBJECT&&this.stack.push(Jc.CLOSE_OBJECT),this._closeValue(),this.state=Jc.OPEN_KEY):this._error("Bad object");continue;case Jc.OPEN_ARRAY:case Jc.VALUE:if(Qc(n))continue;if(this.state===Jc.OPEN_ARRAY){if(this.emit("onopenarray"),this.depth++,this.state=Jc.VALUE,93===n){this.emit("onclosearray"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;continue}this.stack.push(Jc.CLOSE_ARRAY)}34===n?this.state=Jc.STRING:123===n?this.state=Jc.OPEN_OBJECT:91===n?this.state=Jc.OPEN_ARRAY:116===n?this.state=Jc.TRUE:102===n?this.state=Jc.FALSE:110===n?this.state=Jc.NULL:45===n?this.numberNode+="-":48<=n&&n<=57?(this.numberNode+=String.fromCharCode(n),this.state=Jc.NUMBER_DIGIT):this._error("Bad value");continue;case Jc.CLOSE_ARRAY:if(44===n)this.stack.push(Jc.CLOSE_ARRAY),this._closeValue("onvalue"),this.state=Jc.VALUE;else if(93===n)this.emitNode("onclosearray"),this.depth--,this.state=this.stack.pop()||Jc.VALUE;else{if(Qc(n))continue;this._error("Bad array")}continue;case Jc.STRING:void 0===this.textNode&&(this.textNode="");let i=e-1,s=this.slashed,o=this.unicodeI;t:for(;;){for(;o>0;)if(this.unicodeS+=String.fromCharCode(n),n=t.charCodeAt(e++),this.position++,4===o?(this.textNode+=String.fromCharCode(parseInt(this.unicodeS,16)),o=0,i=e-1):o++,!n)break t;if(34===n&&!s){this.state=this.stack.pop()||Jc.VALUE,this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}if(92===n&&!s&&(s=!0,this.textNode+=t.substring(i,e-1),this.position+=e-1-i,n=t.charCodeAt(e++),this.position++,!n))break;if(s){if(s=!1,110===n?this.textNode+="\n":114===n?this.textNode+="\r":116===n?this.textNode+="\t":102===n?this.textNode+="\f":98===n?this.textNode+="\b":117===n?(o=1,this.unicodeS=""):this.textNode+=String.fromCharCode(n),n=t.charCodeAt(e++),this.position++,i=e-1,n)continue;break}kc.lastIndex=e;const r=kc.exec(t);if(null===r){e=t.length+1,this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}if(e=r.index+1,n=t.charCodeAt(r.index),!n){this.textNode+=t.substring(i,e-1),this.position+=e-1-i;break}}this.slashed=s,this.unicodeI=o;continue;case Jc.TRUE:114===n?this.state=Jc.TRUE2:this._error(`Invalid true started with t${n}`);continue;case Jc.TRUE2:117===n?this.state=Jc.TRUE3:this._error(`Invalid true started with tr${n}`);continue;case Jc.TRUE3:n===jc?(this.emit("onvalue",!0),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid true started with tru${n}`);continue;case Jc.FALSE:97===n?this.state=Jc.FALSE2:this._error(`Invalid false started with f${n}`);continue;case Jc.FALSE2:108===n?this.state=Jc.FALSE3:this._error(`Invalid false started with fa${n}`);continue;case Jc.FALSE3:115===n?this.state=Jc.FALSE4:this._error(`Invalid false started with fal${n}`);continue;case Jc.FALSE4:n===jc?(this.emit("onvalue",!1),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid false started with fals${n}`);continue;case Jc.NULL:117===n?this.state=Jc.NULL2:this._error(`Invalid null started with n${n}`);continue;case Jc.NULL2:108===n?this.state=Jc.NULL3:this._error(`Invalid null started with nu${n}`);continue;case Jc.NULL3:108===n?(this.emit("onvalue",null),this.state=this.stack.pop()||Jc.VALUE):this._error(`Invalid null started with nul${n}`);continue;case Jc.NUMBER_DECIMAL_POINT:46===n?(this.numberNode+=".",this.state=Jc.NUMBER_DIGIT):this._error("Leading zero not followed by .");continue;case Jc.NUMBER_DIGIT:48<=n&&n<=57?this.numberNode+=String.fromCharCode(n):46===n?(-1!==this.numberNode.indexOf(".")&&this._error("Invalid number has two dots"),this.numberNode+="."):n===jc||69===n?((-1!==this.numberNode.indexOf("e")||-1!==this.numberNode.indexOf("E"))&&this._error("Invalid number has two exponential"),this.numberNode+="e"):43===n||45===n?(r===jc||69===r||this._error("Invalid symbol in number"),this.numberNode+=String.fromCharCode(n)):(this._closeNumber(),e--,this.state=this.stack.pop()||Jc.VALUE);continue;default:this._error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&function(t){const e=Math.max(Hc,10);let n=0;for(const r of["textNode","numberNode"]){const i=void 0===t[r]?0:t[r].length;i>e&&("text"===r||t._error(`Max buffer length exceeded: ${r}`)),n=Math.max(n,i)}t.bufferCheckPosition=Hc-n+t.position}(this),this.emit("onchunkparsed"),this}_closeValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"onvalue";void 0!==this.textNode&&this.emit(t,this.textNode),this.textNode=void 0}_closeNumber(){this.numberNode&&this.emit("onvalue",parseFloat(this.numberNode)),this.numberNode=""}_error(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this._closeValue(),t+=`\nLine: ${this.line}\nColumn: ${this.column}\nChar: ${this.c}`;const e=new Error(t);this.error=e,this.emit("onerror",e)}}function Qc(t){return 13===t||10===t||32===t||9===t}class zc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.path=void 0,this.path=["$"],t instanceof zc)this.path=[...t.path];else if(Array.isArray(t))this.path.push(...t);else if("string"==typeof t&&(this.path=t.split("."),"$"!==this.path[0]))throw new Error("JSONPaths must start with $")}clone(){return new zc(this)}toString(){return this.path.join(".")}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let e=0;e{this.jsonpath=new zc,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:t=>{this._openObject({}),typeof t<"u"&&this.parser.emit("onkey",t)},onkey:t=>{this.jsonpath.set(t),this.currentState.key=t},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:t=>{this._pushOrSet(t)},onerror:t=>{throw t},onend:()=>{this.result=this.currentState.container.pop()},...t})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new zc}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){const{container:e,key:n}=this.currentState;null!==n?(e[n]=t,this.currentState.key=null):e.push(t)}_openArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}}{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath())return this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],void this._openArray(this.streamingArray);this._openArray()},onopenobject:t=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof t<"u"&&this.parser.emit("onkey",t)}}),this.jsonPaths=void 0,this.streamingJsonPath=null,this.streamingArray=null,this.topLevelObject=null;const e=t.jsonpaths||[];this.jsonPaths=e.map((t=>new zc(t)))}write(t){super.write(t);let e=[];return this.streamingArray&&(e=[...this.streamingArray],this.streamingArray.length=0),e}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){const t=this.getJsonPath();if(0===this.jsonPaths.length)return!0;for(const e of this.jsonPaths)if(e.equals(t))return!0;return!1}}const Wc={x:0,y:1,z:2};function Yc(t,e={}){const{start:n=0,end:r=t.length,plane:i="xy"}=e,s=e.size||2;let o=0;const a=Wc[i[0]],c=Wc[i[1]];for(let e=n,i=r-s;e=e;a-=r)c=yh(a,t[a+h],t[a+l],c);return c&&dh(c,c.next)&&(Bh(c),c=c.next),c}function Zc(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!dh(r,r.next)&&0!==uh(r.prev,r,r.next))r=r.next;else{if(Bh(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function $c(t,e,n,r,i,s,o){if(!t)return;!o&&s&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=ah(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n,r,i,s,o,a,c,h=1;do{for(i=t,t=null,c=null,r=0;i;){for(r++,o=i,s=0,n=0;n0||a>0&&o;)0!==s&&(0===a||!o||i.z<=o.z)?(e=i,i=i.nextZ,s--):(e=o,o=o.nextZ,a--),c?c.nextZ=e:t=e,e.prevZ=c,c=e;i=o}c.nextZ=null,h*=2}while(r>1)}(i)}(t,r,i,s);let a,c,h=t;for(;t.prev!==t.next;)if(a=t.prev,c=t.next,s?eh(t,r,i,s):th(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Bh(t),t=c.next,h=c.next;else if((t=c)===h){o?1===o?$c(t=nh(Zc(t),e,n),e,n,r,i,s,2):2===o&&rh(t,e,n,r,i,s):$c(Zc(t),e,n,r,i,s,1);break}}function th(t){const e=t.prev,n=t,r=t.next;if(uh(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,c=n.y,h=r.y,l=is?i>o?i:o:s>o?s:o,f=a>c?a>h?a:h:c>h?c:h;let m=r.next;for(;m!==e;){if(m.x>=l&&m.x<=d&&m.y>=u&&m.y<=f&&hh(i,a,s,c,o,h,m.x,m.y)&&uh(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function eh(t,e,n,r){const i=t.prev,s=t,o=t.next;if(uh(i,s,o)>=0)return!1;const a=i.x,c=s.x,h=o.x,l=i.y,u=s.y,d=o.y,f=ac?a>h?a:h:c>h?c:h,g=l>u?l>d?l:d:u>d?u:d,A=ah(f,m,e,n,r),y=ah(p,g,e,n,r);let B=t.prevZ,b=t.nextZ;for(;B&&B.z>=A&&b&&b.z<=y;){if(B.x>=f&&B.x<=p&&B.y>=m&&B.y<=g&&B!==i&&B!==o&&hh(a,l,c,u,h,d,B.x,B.y)&&uh(B.prev,B,B.next)>=0||(B=B.prevZ,b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&hh(a,l,c,u,h,d,b.x,b.y)&&uh(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;B&&B.z>=A;){if(B.x>=f&&B.x<=p&&B.y>=m&&B.y<=g&&B!==i&&B!==o&&hh(a,l,c,u,h,d,B.x,B.y)&&uh(B.prev,B,B.next)>=0)return!1;B=B.prevZ}for(;b&&b.z<=y;){if(b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&hh(a,l,c,u,h,d,b.x,b.y)&&uh(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function nh(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!dh(i,s)&&fh(i,r,r.next,s)&&gh(i,s)&&gh(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Bh(r),Bh(r.next),r=t=s),r=r.next}while(r!==t);return Zc(r)}function rh(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&lh(o,t)){let a=Ah(o,t);return o=Zc(o,o.next),a=Zc(a,a.next),$c(o,e,n,r,i,s,0),void $c(a,e,n,r,i,s,0)}t=t.next}o=o.next}while(o!==t)}function ih(t,e){return t.x-e.x}function sh(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let s,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o&&(o=t,s=n.x=n.x&&n.x>=c&&r!==n.x&&hh(is.x||n.x===s.x&&oh(s,n)))&&(s=n,u=l)),n=n.next}while(n!==a);return s}(t,e);if(!n)return e;const r=Ah(n,t);return Zc(r,r.next),Zc(n,n.next)}function oh(t,e){return uh(t.prev,t,e.prev)<0&&uh(e.next,t,t.next)<0}function ah(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ch(t){let e=t,n=t;do{(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function lh(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&fh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(gh(t,e)&&gh(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(uh(t.prev,t,e.prev)||uh(t,e.prev,e))||dh(t,e)&&uh(t.prev,t,t.next)>0&&uh(e.prev,e,e.next)>0)}function uh(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function dh(t,e){return t.x===e.x&&t.y===e.y}function fh(t,e,n,r){const i=ph(uh(t,e,n)),s=ph(uh(t,e,r)),o=ph(uh(n,r,t)),a=ph(uh(n,r,e));return!!(i!==s&&o!==a||0===i&&mh(t,n,e)||0===s&&mh(t,r,e)||0===o&&mh(n,t,r)||0===a&&mh(n,e,r))}function mh(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ph(t){return t>0?1:t<0?-1:0}function gh(t,e){return uh(t.prev,t,t.next)<0?uh(t,e,t.next)>=0&&uh(t,t.prev,e)>=0:uh(t,e,t.prev)<0||uh(t,t.next,e)<0}function Ah(t,e){const n=new bh(t.i,t.x,t.y),r=new bh(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function yh(t,e,n,r){const i=new bh(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Bh(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}class bh{constructor(t,e,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=n}}function Ch(t,e,n){const r=function(t){const e={};for(const n of t)if(n.properties)for(const t in n.properties){const r=n.properties[t];e[t]=Ih(r,e[t])}return e}(t),i=Object.keys(r).filter((t=>r[t]!==Array));return function(t,e,n){const{pointPositionsCount:r,pointFeaturesCount:i,linePositionsCount:s,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:h,polygonRingsCount:l,polygonFeaturesCount:u,propArrayTypes:d,coordLength:f}=e,{numericPropKeys:m=[],PositionDataType:p=Float32Array,triangulate:g=!0}=n,A=t[0]&&"id"in t[0],y=t.length>65535?Uint32Array:Uint16Array,B={type:"Point",positions:new p(r*f),globalFeatureIds:new y(r),featureIds:i>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},b={type:"LineString",pathIndices:s>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new p(s*f),globalFeatureIds:new y(s),featureIds:a>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},C={type:"Polygon",polygonIndices:c>65535?new Uint32Array(h+1):new Uint16Array(h+1),primitivePolygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new p(c*f),globalFeatureIds:new y(c),featureIds:u>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};g&&(C.triangles=[]);for(const t of[B,b,C])for(const e of m){const n=d[e];t.numericProps[e]=new n(t.positions.length/f)}b.pathIndices[o]=s,C.polygonIndices[h]=c,C.primitivePolygonIndices[l]=c;const w={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(const e of t){const t=e.geometry,n=e.properties||{};switch(t.type){case"Point":wh(t,B,w,f,n),B.properties.push(Mh(n,m)),A&&B.fields.push({id:e.id}),w.pointFeature++;break;case"LineString":vh(t,b,w,f,n),b.properties.push(Mh(n,m)),A&&b.fields.push({id:e.id}),w.lineFeature++;break;case"Polygon":Eh(t,C,w,f,n),C.properties.push(Mh(n,m)),A&&C.fields.push({id:e.id}),w.polygonFeature++;break;default:throw new Error("Invalid geometry type")}w.feature++}return function(t,e,n,r){const i={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:r},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:_h(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:r},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:_h(e.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:_h(n.numericProps,1)}};return i.polygons&&n.triangles&&(i.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),i}(B,b,C,f)}(t,{propArrayTypes:r,...e},{numericPropKeys:n&&n.numericPropKeys||i,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:!n||n.triangulate})}function wh(t,e,n,r,i){e.positions.set(t.data,n.pointPosition*r);const s=t.data.length/r;xh(e,i,n.pointPosition,s),e.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+s),e.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+s),n.pointPosition+=s}function vh(t,e,n,r,i){e.positions.set(t.data,n.linePosition*r);const s=t.data.length/r;xh(e,i,n.linePosition,s),e.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+s),e.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+s);for(let i=0,s=t.indices.length;i80*n){d=l=t[0],f=u=t[1];for(let e=n;el&&(l=m),p>u&&(u=p);h=Math.max(l-d,u-f),h=0!==h?32767/h:0}return $c(a,c,n,d,f,h,0),c}(h,n.slice(1).map((t=>(t-l)/o)),o,e);for(let e=0,n=u.length;e0?Math.max(...l):2,pointPositionsCount:e,pointFeaturesCount:n,linePositionsCount:r,linePathsCount:i,lineFeaturesCount:s,polygonPositionsCount:o,polygonObjectsCount:a,polygonRingsCount:c,polygonFeaturesCount:h}}function Rh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{coordLength:2,fixRingWinding:!0};return t.map((t=>Gh(t,e)))}function Oh(t,e,n,r){n.push(e.length),e.push(...t);for(let n=t.length;nt.slice(0,2))).flat());const r=t<0;i.fixRingWinding&&(0===s&&!r||s>0&&r)&&(n.reverse(),t=-t),o.push(t),Fh(n,e,a,i),s++}s>0&&(r.push(o),n.push(a))}function Gh(t,e){const{geometry:n}=t;if("GeometryCollection"===n.type)throw new Error("GeometryCollection type not supported");const r=[],i=[];let s,o;switch(n.type){case"Point":o="Point",Oh(n.coordinates,r,i,e);break;case"MultiPoint":o="Point",n.coordinates.map((t=>Oh(t,r,i,e)));break;case"LineString":o="LineString",Fh(n.coordinates,r,i,e);break;case"MultiLineString":o="LineString",n.coordinates.map((t=>Fh(t,r,i,e)));break;case"Polygon":o="Polygon",s=[],Dh(n.coordinates,r,i,s,e);break;case"MultiPolygon":o="Polygon",s=[],n.coordinates.map((t=>Dh(t,r,i,s,e)));break;default:throw new Error(`Unknown type: ${o}`)}return{...t,geometry:{type:o,indices:i,data:r,areas:s}}}function Lh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fixRingWinding:!0,triangulate:!0};const n=Sh(t),r=n.coordLength,{fixRingWinding:i}=e,s=Rh(t,{coordLength:r,fixRingWinding:i});return Ch(s,n,{numericPropKeys:e.numericPropKeys,PositionDataType:e.PositionDataType||Float32Array,triangulate:e.triangulate})}const Uh={name:"GeoJSON",id:"geojson",module:"geojson",version:"4.1.4",worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"object-row-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}},parse:async function(t,e){return Nh((new TextDecoder).decode(t),e)},parseTextSync:Nh,parseInBatches:function(t,e){(e={...Uh.options,...e}).json={...Uh.options.geojson,...e.geojson};const n=async function*(t,e){const n=function(t){try{let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){const n=new TextDecoder(void 0,e);for await(const e of t)yield"string"==typeof e?e:n.decode(e,{stream:!0})}()}catch(t){return Promise.reject(t)}}(t),{metadata:r}=e,{jsonpaths:i}=e.json||{};let s=!0;const o=new Pc(null,e),a=new qc({jsonpaths:i});for await(const t of n){const n=a.write(t),i=n.length>0&&a.getStreamingJsonPathAsString();var c;n.length>0&&s&&(r&&(yield{shape:(null==e||null===(c=e.json)||void 0===c?void 0:c.shape)||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:a.getPartialResult(),jsonpath:i}),s=!1);for(const t of n){o.addRow(t);const e=o.getFullBatch({jsonpath:i});e&&(yield e)}o.chunkComplete(t);const h=o.getFullBatch({jsonpath:i});h&&(yield h)}const h=a.getStreamingJsonPathAsString(),l=o.getFinalBatch({jsonpath:h});l&&(yield l),r&&(yield{shape:"json",batchType:"final-result",container:a.getPartialResult(),jsonpath:a.getStreamingJsonPathAsString(),data:[],length:0})}(t,e);return"binary"===e.gis.format?async function*(t){for await(const e of t)e.data=Lh(e.data),yield e}(n):n}};function Nh(t,e){var n;let r;(e={...Uh.options,...e}).geojson={...Uh.options.geojson,...e.geojson},e.gis=e.gis||{};try{r=JSON.parse(t)}catch{r={}}const i={shape:"geojson-table",type:"FeatureCollection",features:(null===(n=r)||void 0===n?void 0:n.features)||[]};return"binary"===e.gis.format?Lh(i.features):i}function Ph(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const Hh={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class Jh{constructor(t={}){n(this,"props"),n(this,"stats"),n(this,"activeRequestCount",0),n(this,"requestQueue",[]),n(this,"requestMap",new Map),n(this,"updateTimer",null),this.props={...Hh,...t},this.stats=new V({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(t,e=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const n={handle:t,priority:0,getPriority:e},r=new Promise((t=>(n.resolve=t,n)));return this.requestQueue.push(n),this.requestMap.set(t,r),this._issueNewRequests(),r}_issueRequest(t){const{handle:e,resolve:n}=t;let r=!1;const i=()=>{r||(r=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:i}):Promise.resolve({done:i})}_issueNewRequests(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout((()=>this._issueNewRequestsAsync()),this.props.debounceTime)}_issueNewRequestsAsync(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=null;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let e=0;et.priority-e.priority))}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0&&(t.resolve(null),1))}}class jh{constructor(t,e,r){n(this,"item"),n(this,"previous"),n(this,"next"),this.item=t,this.previous=e,this.next=r}}class kh{constructor(){n(this,"head",null),n(this,"tail",null),n(this,"_length",0)}get length(){return this._length}add(t){const e=new jh(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),++this._length,e}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,e){t!==e&&(this.remove(e),this._insert(t,e))}_insert(t,e){const n=t.next;t.next=e,this.tail===t?this.tail=e:n.previous=e,e.next=n,e.previous=t,++this._length}}class Vh{constructor(){n(this,"_list"),n(this,"_sentinel"),n(this,"_trimTiles"),this._list=new kh,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){const e=t._cacheNode;e&&this._list.splice(this._sentinel,e)}add(t,e,n){e._cacheNode||(e._cacheNode=this._list.add(e),n&&n(t,e))}unloadTile(t,e,n){const r=e._cacheNode;r&&(this._list.remove(r),e._cacheNode=null,n&&n(t,e))}unloadTiles(t,e){const n=this._trimTiles;this._trimTiles=!1;const r=this._list,i=1024*t.maximumMemoryUsage*1024,s=this._sentinel;let o=r.head;for(;o!==s&&(t.gpuMemoryUsageInBytes>i||n);){const n=o.item;o=o.next,this.unloadTile(t,n,e)}}trim(){this._trimTiles=!0}}const Kh=new Qe,Qh=new Qe,zh=new ir([new tr,new tr,new tr,new tr,new tr,new tr]);function qh(t,e){const{cameraDirection:n,cameraUp:r,height:i}=t,{metersPerUnit:s}=t.distanceScales,o=Yh(t,t.center),a=Hn.WGS84.eastNorthUpToFixedFrame(o),c=t.unprojectPosition(t.cameraPosition),h=Hn.WGS84.cartographicToCartesian(c,new Qe),l=new Qe(a.transformAsVector(new Qe(n).scale(s))).normalize(),u=new Qe(a.transformAsVector(new Qe(r).scale(s))).normalize();!function(t){const e=t.getFrustumPlanes(),n=Wh(e.near,t.cameraPosition),r=Yh(t,n),i=Yh(t,t.cameraPosition,Qh);let s=0;zh.planes[s++].fromPointNormal(r,Kh.copy(r).subtract(i));for(const i in e){if("near"===i)continue;const o=Yh(t,Wh(e[i],n,Qh),Qh);zh.planes[s++].fromPointNormal(o,Kh.copy(r).subtract(o))}}(t);const d=t.constructor,{longitude:f,latitude:m,width:p,bearing:g,zoom:A}=t;return{camera:{position:h,direction:l,up:u},viewport:t,topDownViewport:new d({longitude:f,latitude:m,height:i,width:p,bearing:g,zoom:A,pitch:0}),height:i,cullingVolume:zh,frameNumber:e,sseDenominator:1.15}}function Wh(t,e,n=new Qe){const r=t.normal.dot(e);return n.copy(t.normal).scale(t.distance-r).add(e),n}function Yh(t,e,n=new Qe){const r=t.unprojectPosition(e);return Hn.WGS84.cartographicToCartesian(r,n)}const Xh=6356752.314245179,Zh=new Qe;function $h(t,e,n){Hn.WGS84.cartographicToCartesian([t.xmax,t.ymax,t.zmax],Zh);const r=Math.sqrt(Math.pow(Zh[0]-n[0],2)+Math.pow(Zh[1]-n[1],2)+Math.pow(Zh[2]-n[2],2));return Math.log2(Xh/(r+e[2]))}var tl,el,nl,rl;!function(t){t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE"}(tl||(tl={})),function(t){t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh"}(el||(el={})),function(t){t.I3S="I3S",t.TILES3D="TILES3D"}(nl||(nl={})),function(t){t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold"}(rl||(rl={}));function il(t){return null!=t}const sl=new Qe,ol=new Qe,al=new Qe,cl=new Qe,hl=new Qe,ll=new Qe,ul=new Qe,dl=new Qe;function fl(t,e,n){if(Ph(t,"3D Tile: boundingVolume must be defined"),t.box)return ml(t.box,e,n);if(t.region)return function(t){const[e,n,r,i,s,o]=t,a=Hn.WGS84.cartographicToCartesian([Ae(e),Ae(i),s],al),c=Hn.WGS84.cartographicToCartesian([Ae(r),Ae(n),o],cl),h=(new Qe).addVectors(a,c).multiplyByScalar(.5);return Hn.WGS84.cartesianToCartographic(h,hl),Hn.WGS84.cartographicToCartesian([Ae(r),hl[1],hl[2]],ll),Hn.WGS84.cartographicToCartesian([hl[0],Ae(i),hl[2]],ul),Hn.WGS84.cartographicToCartesian([hl[0],hl[1],o],dl),ml([...h,...ll.subtract(h),...ul.subtract(h),...dl.subtract(h)],new ln)}(t.region);if(t.sphere)return function(t,e,n){const r=new Qe(t[0],t[1],t[2]);e.transform(r,r);const i=e.getScale(ol),s=Math.max(Math.max(i[0],i[1]),i[2]),o=t[3]*s;return il(n)?(n.center=r,n.radius=o,n):new kn(r,o)}(t.sphere,e,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function ml(t,e,n){const r=new Qe(t[0],t[1],t[2]);e.transform(r,r);let i=[];if(10===t.length){const e=t.slice(3,6),n=new Bn;n.fromArray(t,6);const r=new Qe([1,0,0]),s=new Qe([0,1,0]),o=new Qe([0,0,1]);r.transformByQuaternion(n),r.scale(e[0]),s.transformByQuaternion(n),s.scale(e[1]),o.transformByQuaternion(n),o.scale(e[2]),i=[...r.toArray(),...s.toArray(),...o.toArray()]}else i=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];const s=e.transformAsVector(i.slice(0,3)),o=e.transformAsVector(i.slice(3,6)),a=e.transformAsVector(i.slice(6,9)),c=new $e([s[0],s[1],s[2],o[0],o[1],o[2],a[0],a[1],a[2]]);return il(n)?(n.center=r,n.halfAxes=c,n):new Xn(r,c)}function pl(t,e){Hn.WGS84.cartesianToCartographic(e,sl),t[0][0]=Math.min(t[0][0],sl[0]),t[0][1]=Math.min(t[0][1],sl[1]),t[0][2]=Math.min(t[0][2],sl[2]),t[1][0]=Math.max(t[1][0],sl[0]),t[1][1]=Math.max(t[1][1],sl[1]),t[1][2]=Math.max(t[1][2],sl[2])}new Qe,new Qe,new ln,new Qe,new Qe,new Qe;const gl=new Qe,Al=new Qe,yl=new Qe,Bl=new Qe,bl=new Qe,Cl=new ln,wl=new ln;function vl(t,e){const{topDownViewport:n}=e,r=t.header.mbs[1],i=t.header.mbs[0],s=t.header.mbs[2],o=t.header.mbs[3],a=[...t.boundingVolume.center],c=n.unprojectPosition(n.cameraPosition);Hn.WGS84.cartographicToCartesian(c,gl),Al.copy(gl).subtract(a).normalize(),Hn.WGS84.eastNorthUpToFixedFrame(a,Cl),wl.copy(Cl).invert(),yl.copy(gl).transform(wl);const h=Math.sqrt(yl[0]*yl[0]+yl[1]*yl[1]),l=h*h/yl[2];Bl.copy([yl[0],yl[1],l]);const u=Bl.transform(Cl).subtract(a).normalize(),d=Al.cross(u).normalize().scale(o).add(a),f=Hn.WGS84.cartesianToCartographic(d),m=n.project([i,r,s]),p=n.project(f);return bl.copy(m).subtract(p).magnitude()}class El{constructor(t=0){n(this,"_map",new Map),n(this,"_array"),n(this,"_length"),this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return Ph(t=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=e,this._map.set(e,t)}delete(t){const e=this._map.get(t);e>=0&&(this._array.splice(e,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){const e=this.length++;this._array[e]=t,this._map.set(t,e)}}pop(){const t=this._array[--this.length];return this._map.delete(t),t}reserve(t){Ph(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){Ph(t>=0),this.length=t}trim(t){null==t&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}}const Tl={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class _l{constructor(t){n(this,"options"),n(this,"root",null),n(this,"selectedTiles",{}),n(this,"requestedTiles",{}),n(this,"emptyTiles",{}),n(this,"lastUpdate",(new Date).getTime()),n(this,"updateDebounceTime",1e3),n(this,"_traversalStack",new El),n(this,"_emptyTraversalStack",new El),n(this,"_frameNumber",null),this.options={...Tl,...t}}traversalFinished(t){return!0}traverse(t,e,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,e),this._frameNumber=e.frameNumber,this.executeTraversal(t,e)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,e){const n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){const t=n.pop();let r=!1;this.canTraverse(t,e)&&(this.updateChildTiles(t,e),r=this.updateAndPushChildren(t,e,n,t.hasRenderContent?t._selectionDepth+1:t._selectionDepth));const i=t.parent,s=!(i&&!i._shouldRefine),o=!r;t.hasRenderContent?t.refine===tl.ADD?(this.loadTile(t,e),this.selectTile(t,e)):t.refine===tl.REPLACE&&(this.loadTile(t,e),o&&this.selectTile(t,e)):(this.emptyTiles[t.id]=t,this.loadTile(t,e),o&&this.selectTile(t,e)),this.touchTile(t,e),t._shouldRefine=r&&s}const r=(new Date).getTime();(this.traversalFinished(e)||r-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=r,this.options.onTraversalEnd(e))}updateChildTiles(t,e){const n=t.children;for(const t of n)this.updateTile(t,e)}updateAndPushChildren(t,e,n,r){const{loadSiblings:i,skipLevelOfDetail:s}=this.options,o=t.children;o.sort(this.compareDistanceToCamera.bind(this));const a=t.refine===tl.REPLACE&&t.hasRenderContent&&!s;let c=!1,h=!0;for(const t of o)if(t._selectionDepth=r,t.isVisibleAndInRequestVolume?(n.find(t)&&n.delete(t),n.push(t),c=!0):(a||i)&&(this.loadTile(t,e),this.touchTile(t,e)),a){let n;if(n=!!t._inRequestVolume&&(t.hasRenderContent?t.contentAvailable:this.executeEmptyTraversal(t,e)),h=h&&n,!h)return!1}return c||(h=!1),h}updateTile(t,e){this.updateTileVisibility(t,e)}selectTile(t,e){this.shouldSelectTile(t)&&(t._selectedFrame=e.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,e){this.shouldLoadTile(t)&&(t._requestedFrame=e.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,e){t.tileset._cache.touch(t),t._touchedFrame=e.frameNumber}canTraverse(t,e){return!!t.hasChildren&&(t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,e))}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,e,n=!1){let r=t._screenSpaceError;return n&&(r=t.getScreenSpaceError(e,!0)),r>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,e){const n=[];if(this.options.viewportTraversersMap)for(const t in this.options.viewportTraversersMap)this.options.viewportTraversersMap[t]===e.viewport.id&&n.push(t);else n.push(e.viewport.id);t.updateVisibility(e,n)}compareDistanceToCamera(t,e){return t._distanceToCamera-e._distanceToCamera}anyChildrenVisible(t,e){let n=!1;for(const r of t.children)r.updateVisibility(e),n=n||r.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,e){let n=!0;const r=this._emptyTraversalStack;for(r.push(t);r.length>0;){const t=r.pop(),i=!t.hasRenderContent&&this.canTraverse(t,e),s=!t.hasRenderContent&&0===t.children.length;if(!i&&!t.contentAvailable&&!s&&(n=!1),this.updateTile(t,e),t.isVisibleAndInRequestVolume||(this.loadTile(t,e),this.touchTile(t,e)),i){const e=t.children;for(const t of e)r.push(t)}}return n}}const xl=new Qe;class Ml{constructor(t,e,r,i=""){n(this,"tileset"),n(this,"header"),n(this,"id"),n(this,"url"),n(this,"parent"),n(this,"refine"),n(this,"type"),n(this,"contentUrl"),n(this,"lodMetricType","geometricError"),n(this,"lodMetricValue",0),n(this,"boundingVolume",null),n(this,"content",null),n(this,"contentState",0),n(this,"gpuMemoryUsageInBytes",0),n(this,"children",[]),n(this,"depth",0),n(this,"viewportIds",[]),n(this,"transform",new ln),n(this,"extensions",null),n(this,"implicitTiling",null),n(this,"userData",{}),n(this,"computedTransform"),n(this,"hasEmptyContent",!1),n(this,"hasTilesetContent",!1),n(this,"traverser",new _l({})),n(this,"_cacheNode",null),n(this,"_frameNumber",null),n(this,"_expireDate",null),n(this,"_expiredContent",null),n(this,"_boundingBox"),n(this,"_distanceToCamera",0),n(this,"_screenSpaceError",0),n(this,"_visibilityPlaneMask"),n(this,"_visible"),n(this,"_contentBoundingVolume"),n(this,"_viewerRequestVolume"),n(this,"_initialTransform",new ln),n(this,"_priority",0),n(this,"_selectedFrame",0),n(this,"_requestedFrame",0),n(this,"_selectionDepth",0),n(this,"_touchedFrame",0),n(this,"_centerZDepth",0),n(this,"_shouldRefine",!1),n(this,"_stackLength",0),n(this,"_visitedFrame",0),n(this,"_inRequestVolume",!1),n(this,"_lodJudge",null),this.header=e,this.tileset=t,this.id=i||e.id,this.url=e.url,this.parent=r,this.refine=this._getRefine(e.refine),this.type=e.type,this.contentUrl=e.contentUrl,this._initializeLodMetric(e),this._initializeTransforms(e),this._initializeBoundingVolumes(e),this._initializeContent(e),this._initializeRenderingState(e),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return 3===this.contentState||this.hasEmptyContent}get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return 0===this.contentState}get contentExpired(){return 4===this.contentState}get contentFailed(){return 5===this.contentState}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=function(t,e){if(t.box)return function(t){const e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],{halfAxes:n}=t,r=new Qe(n.getColumn(0)),i=new Qe(n.getColumn(1)),s=new Qe(n.getColumn(2));for(let n=0;n<2;n++){for(let n=0;n<2;n++){for(let n=0;n<2;n++)sl.copy(t.center),sl.add(r),sl.add(i),sl.add(s),pl(e,sl),s.negate();i.negate()}r.negate()}return e}(e);if(t.region){const[e,n,r,i,s,o]=t.region;return[[Ae(e),Ae(n),s],[Ae(r),Ae(i),o]]}if(t.sphere)return function(t){const e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],{center:n,radius:r}=t,i=Hn.WGS84.scaleToGeodeticSurface(n,sl);let s;s=i?Hn.WGS84.geodeticSurfaceNormal(i):new Qe(0,0,1);let o=new Qe(s[2],-s[1],0);o.len()>0?o.normalize():o=new Qe(0,1,0);const a=o.clone().cross(s);for(const t of[o,a,s]){ol.copy(t).scale(r);for(let t=0;t<2;t++)sl.copy(n),sl.add(ol),pl(e,sl),ol.negate()}return e}(e);throw new Error("Unkown boundingVolume type")}(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,e){switch(this.tileset.type){case nl.I3S:return vl(this,t);case nl.TILES3D:return function(t,e,n){const r=t.tileset,i=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,s=n?i:t.lodMetricValue;if(0===s)return 0;const o=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:c}=e,{viewDistanceScale:h}=r.options;let l=s*a*(h||1)/(o*c);return l-=function(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){const n=t.dynamicScreenSpaceErrorComputedDensity,r=t.dynamicScreenSpaceErrorFactor;return function(t,e){const n=t*e;return 1-Math.exp(-n*n)}(e,n)*r}return 0}(r,o),l}(this,t,e);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){const t=this.tileset._traverser,{skipLevelOfDetail:e}=t.options,n=this.refine===tl.ADD||e;if(n&&!this.isVisible&&void 0!==this._visible||this.tileset._frameNumber-this._touchedFrame>=1||0===this.contentState)return-1;const r=this.parent,i=!r||n&&0!==this._screenSpaceError&&!r.hasTilesetContent?this._screenSpaceError:r._screenSpaceError,s=t.root?t.root._screenSpaceError:0;return Math.max(s-i,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=1;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=0,!1;try{const e=this.tileset.getTileUrl(this.contentUrl),n=this.tileset.loader,r={...this.tileset.loadOptions,[n.id]:{...this.tileset.loadOptions[n.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(n.id)}};return this.content=await he(e,n,r),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=3,this._onContentLoaded(),!0}catch(t){throw this.contentState=5,t}finally{t.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=0,!0}updateVisibility(t,e){if(this._frameNumber===t.frameNumber)return;const n=this.parent,r=n?n._visibilityPlaneMask:ir.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const t=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(t)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,r),this._visible=this._visibilityPlaneMask!==ir.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=e}visibility(t,e){const{cullingVolume:n}=t,{boundingVolume:r}=this;return n.computeVisibilityWithPlaneMask(r,e)}contentVisibility(){return!0}distanceToTile(t){const e=this.boundingVolume;return Math.sqrt(Math.max(e.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){const e=this.boundingVolume;return xl.subVectors(e.center,t.position),t.direction.dot(xl)}insideViewerRequestVolume(t){const e=this._viewerRequestVolume;return!e||e.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(function(t){return null!=t}(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){const t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=4,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new ln(t.transform):new ln;const e=this.parent,n=this.tileset,r=e&&e.computedTransform?e.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new ln(r).multiplyRight(this.transform);const i=e&&e._initialTransform?e._initialTransform.clone():new ln;this._initialTransform=new ln(i).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=0,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ir.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||tl.REPLACE}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=fl(t.boundingVolume,this.computedTransform,this.boundingVolume);const e=t.content;e&&(e.boundingVolume&&(this._contentBoundingVolume=fl(e.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=fl(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new ln){const e=t.clone().multiplyRight(this.transform);e.equals(this.computedTransform)||(this.computedTransform=e,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){return"i3s"===t?{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1}:function(t){return{assetGltfUpAxis:t.asset&&t.asset.gltfUpAxis||"Y"}}(this.tileset.tileset)}}class Il extends _l{compareDistanceToCamera(t,e){return 0===e._distanceToCamera&&0===t._distanceToCamera?e._centerZDepth-t._centerZDepth:e._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,e){if(super.updateTileVisibility(t,e),!t.isVisibleAndInRequestVolume)return;const n=t.children.length>0;if(t.hasTilesetContent&&n){const n=t.children[0];return this.updateTileVisibility(n,e),void(t._visible=n._visible)}if(this.meetsScreenSpaceErrorEarly(t,e))return void(t._visible=!1);const r=t.refine===tl.REPLACE,i=1===t._optimChildrenWithinParent;r&&i&&n&&!this.anyChildrenVisible(t,e)&&(t._visible=!1)}meetsScreenSpaceErrorEarly(t,e){const{parent:n}=t;return!(!n||n.hasTilesetContent||n.refine!==tl.ADD||this.shouldRefine(t,e,!0))}}class Sl{constructor(){n(this,"frameNumberMap",new Map)}register(t,e){const n=this.frameNumberMap.get(t)||new Map,r=n.get(e)||0;n.set(e,r+1),this.frameNumberMap.set(t,n)}deregister(t,e){const n=this.frameNumberMap.get(t);if(!n)return;const r=n.get(e)||1;n.set(e,r-1)}isZero(t,e){var n;return 0===((null==(n=this.frameNumberMap.get(t))?void 0:n.get(e))||0)}}class Rl{constructor(){n(this,"_statusMap"),n(this,"pendingTilesRegister",new Sl),this._statusMap={}}add(t,e,n,r){if(!this._statusMap[e]){const{frameNumber:i,viewport:{id:s}}=r;this._statusMap[e]={request:t,callback:n,key:e,frameState:r,status:"REQUESTED"},this.pendingTilesRegister.register(s,i),t().then((t=>{this._statusMap[e].status="COMPLETED";const{frameNumber:n,viewport:{id:i}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(i,n),this._statusMap[e].callback(t,r)})).catch((t=>{this._statusMap[e].status="ERROR";const{frameNumber:r,viewport:{id:i}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(i,r),n(t)}))}}update(t,e){if(this._statusMap[t]){const{frameNumber:n,viewport:{id:r}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(r,n);const{frameNumber:i,viewport:{id:s}}=e;this.pendingTilesRegister.register(s,i),this._statusMap[t].frameState=e}}find(t){return this._statusMap[t]}hasPendingTiles(t,e){return!this.pendingTilesRegister.isZero(t,e)}}class Ol extends _l{constructor(t){super(t),n(this,"_tileManager"),this._tileManager=new Rl}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,e){return t._lodJudge=function(t,e){if(0===t.lodMetricValue||isNaN(t.lodMetricValue))return"DIG";const n=2*vl(t,e);return n<2?"OUT":!t.header.children||n<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}(t,e),"DIG"===t._lodJudge}updateChildTiles(t,e){const n=t.header.children||[],r=t.children,i=t.tileset;for(const s of n){const n=`${s.id}-${e.viewport.id}`,o=r&&r.find((t=>t.id===n));if(o)o&&this.updateTile(o,e);else{let r=()=>this._loadTile(s.id,i);this._tileManager.find(n)?this._tileManager.update(n,e):(i.tileset.nodePages&&(r=()=>i.tileset.nodePagesTile.formTileFromNodePages(s.id)),this._tileManager.add(r,n,(e=>this._onTileLoad(e,t,n)),e))}}return!1}async _loadTile(t,e){const{loader:n}=e,r=e.getTileUrl(`${e.url}/nodes/${t}`),i={...e.loadOptions,i3s:{...e.loadOptions.i3s,isTileHeader:!0}};return await he(r,n,i)}_onTileLoad(t,e,n){const r=new Ml(e.tileset,t,e,n);e.children.push(r);const i=this._tileManager.find(r.id).frameState;this.updateTile(r,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||(new Date).getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(r,i)}}const Fl={description:"",ellipsoid:Hn.WGS84,modelMatrix:new ln,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Dl="Tiles In Tileset(s)",Gl="Tiles In Memory",Ll="Tiles In View",Ul="Tiles To Render",Nl="Tiles Loaded",Pl="Tiles Loading",Hl="Tiles Unloaded",Jl="Failed Tile Loads",jl="Points/Vertices",kl="Tile Memory Use",Vl="Maximum Screen Space Error";class Kl{constructor(t,e){n(this,"options"),n(this,"loadOptions"),n(this,"type"),n(this,"tileset"),n(this,"loader"),n(this,"url"),n(this,"basePath"),n(this,"modelMatrix"),n(this,"ellipsoid"),n(this,"lodMetricType"),n(this,"lodMetricValue"),n(this,"refine"),n(this,"root",null),n(this,"roots",{}),n(this,"asset",{}),n(this,"description",""),n(this,"properties"),n(this,"extras",null),n(this,"attributions",{}),n(this,"credits",{}),n(this,"stats"),n(this,"contentFormats",{draco:!1,meshopt:!1,dds:!1,ktx2:!1}),n(this,"cartographicCenter",null),n(this,"cartesianCenter",null),n(this,"zoom",1),n(this,"boundingVolume",null),n(this,"dynamicScreenSpaceErrorComputedDensity",0),n(this,"maximumMemoryUsage",32),n(this,"gpuMemoryUsageInBytes",0),n(this,"memoryAdjustedScreenSpaceError",0),n(this,"_cacheBytes",0),n(this,"_cacheOverflowBytes",0),n(this,"_frameNumber",0),n(this,"_queryParams",{}),n(this,"_extensionsUsed",[]),n(this,"_tiles",{}),n(this,"_pendingCount",0),n(this,"selectedTiles",[]),n(this,"traverseCounter",0),n(this,"geometricError",0),n(this,"lastUpdatedVieports",null),n(this,"_requestedTiles",[]),n(this,"_emptyTiles",[]),n(this,"frameStateData",{}),n(this,"_traverser"),n(this,"_cache",new Vh),n(this,"_requestScheduler"),n(this,"updatePromise",null),n(this,"tilesetInitializationPromise"),this.options={...Fl,...e},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||function(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new Jh({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=1024*this.options.maximumMemoryUsage*1024,this._cacheOverflowBytes=1024*this.options.memoryCacheOverflow*1024,this.stats=new V({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber&&0===this._requestedTiles.length}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let e=t;return this.queryParams.length&&(e=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),e}hasExtension(t){return this._extensionsUsed.indexOf(t)>-1}update(t=null){this.tilesetInitializationPromise.then((()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)}))}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise((t=>{setTimeout((()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),t(this._frameNumber),this.updatePromise=null}),this.options.debounceTime)}))),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytesthis._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;const e=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=e.length;const n=[];for(const t of e){const e=t.id;this._needTraverse(e)?n.push(e):this.traverseCounter--}for(const t of e){const e=t.id;if(this.roots[e]||(this.roots[e]=this._initializeTileHeaders(this.tileset,null)),!n.includes(e))continue;const r=qh(t,this._frameNumber);this._traverser.traverse(this.roots[e],r,this.options)}}_needTraverse(t){let e=t;return this.options.viewportTraversersMap&&(e=this.options.viewportTraversersMap[t]),e===t}_onTraversalEnd(t){const e=t.viewport.id;this.frameStateData[e]||(this.frameStateData[e]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const n=this.frameStateData[e],r=Object.values(this._traverser.selectedTiles),[i,s]=function(t,e,n){if(0===n||t.length<=n)return[t,[]];const r=[],{longitude:i,latitude:s}=e.viewport;for(const[e,n]of t.entries()){const[t,o]=n.header.mbs,a=Math.abs(i-t),c=Math.abs(s-o),h=Math.sqrt(c*c+a*a);r.push([e,h])}const o=r.sort(((t,e)=>t[1]-e[1])),a=[];for(let e=0;e0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const t in this.frameStateData){const e=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(e.selectedTiles),this._requestedTiles=this._requestedTiles.concat(e._requestedTiles),this._emptyTiles=this._emptyTiles.concat(e._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,e){if(t.length!==e.length)return!0;const n=new Set(t.map((t=>t.id))),r=new Set(e.map((t=>t.id)));let i=t.filter((t=>!r.has(t.id))).length>0;return i=i||e.filter((t=>!n.has(t.id))).length>0,i}_loadTiles(){for(const t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,((t,e)=>t._unloadTile(e)))}_updateStats(){let t=0,e=0;for(const n of this.selectedTiles)n.contentAvailable&&n.content&&(t++,n.content.pointCount?e+=n.content.pointCount:e+=n.content.vertexCount);this.stats.get(Ll).count=this.selectedTiles.length,this.stats.get(Ul).count=t,this.stats.get(jl).count=e,this.stats.get(Vl).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===nl.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===nl.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===nl.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var t;const e=this.tileset.fullExtent;if(e){const{xmin:t,xmax:n,ymin:r,ymax:i,zmin:s,zmax:o}=e;return this.cartographicCenter=new Qe(t+(n-t)/2,r+(i-r)/2,s+(o-s)/2),this.cartesianCenter=new Qe,Hn.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),void(this.zoom=$h(e,this.cartographicCenter,this.cartesianCenter))}const n=null==(t=this.tileset.store)?void 0:t.extent;if(n){const[t,e,r,i]=n;return this.cartographicCenter=new Qe(t+(r-t)/2,e+(i-e)/2,0),this.cartesianCenter=new Qe,Hn.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),void(this.zoom=function(t,e,n){const[r,i,s,o]=t;return $h({xmin:r,xmax:s,ymin:i,ymax:o,zmin:0,zmax:0},e,n)}(n,this.cartographicCenter,this.cartesianCenter))}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new Qe,this.zoom=1}calculateViewPropsTiles3D(){const t=this.root,{center:e}=t.boundingVolume;if(!e)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Qe,void(this.zoom=1);0!==e[0]||0!==e[1]||0!==e[2]?(this.cartographicCenter=new Qe,Hn.WGS84.cartesianToCartographic(e,this.cartographicCenter)):this.cartographicCenter=new Qe(0,0,-Hn.WGS84.radii[0]),this.cartesianCenter=e,this.zoom=function(t,e){if(t instanceof Xn){const{halfAxes:n}=t,r=function(t){t.getColumn(0,Zh);const e=t.getColumn(1),n=t.getColumn(2);return Zh.add(e).add(n).len()}(n);return Math.log2(Xh/(r+e[2]))}if(t instanceof kn){const{radius:n}=t;return Math.log2(Xh/(n+e[2]))}if(t.width&&t.height){const{width:e,height:n}=t;return(Math.log2(6378137/e)+Math.log2(6378137/n))/2}return 1}(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Dl),this.stats.get(Pl),this.stats.get(Gl),this.stats.get(Ll),this.stats.get(Ul),this.stats.get(Nl),this.stats.get(Hl),this.stats.get(Jl),this.stats.get(jl),this.stats.get(kl,"memory"),this.stats.get(Vl)}_initializeTileHeaders(t,e){var n;const r=new Ml(this,t.root,e);if(e&&(e.children.push(r),r.depth=e.depth+1),this.type===nl.TILES3D){const t=[];for(t.push(r);t.length>0;){const e=t.pop();this.stats.get(Dl).incrementCount();const r=e.header.children||[];for(const i of r){const r=new Ml(this,i,e);if(null!=(n=r.contentUrl)&&n.includes("?session=")){const t=new URL(r.contentUrl).searchParams.get("session");t&&(this._queryParams.session=t)}e.children.push(r),r.depth=e.depth+1,t.push(r)}}}return r}_initializeTraverser(){let t;switch(this.type){case nl.TILES3D:t=Il;break;case nl.I3S:t=Ol;break;default:t=_l}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let e;try{this._onStartTileLoading(),e=await t.loadContent()}catch(e){this._onTileLoadError(t,e instanceof Error?e:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,e)}}_onTileLoadError(t,e){this.stats.get(Jl).incrementCount();const n=e.message||e.toString(),r=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,r)}_onTileLoad(t,e){var n,r;if(e){if(this.type===nl.I3S){const t=(null==(r=null==(n=this.tileset)?void 0:n.nodePagesTile)?void 0:r.nodesInNodePages)||0;this.stats.get(Dl).reset(),this.stats.get(Dl).addCount(t)}t&&t.content&&function(t,e){Ph(t),Ph(e);const{rtcCenter:n,gltfUpAxis:r}=e,{computedTransform:i,boundingVolume:{center:s}}=t;let o=new ln(i);switch(n&&o.translate(n),r){case"Z":break;case"Y":const t=(new ln).rotateX(Math.PI/2);o=o.multiplyRight(t);break;case"X":const e=(new ln).rotateY(-Math.PI/2);o=o.multiplyRight(e)}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const a=new Qe(s);e.cartesianModelMatrix=o,e.cartesianOrigin=a;const c=Hn.WGS84.cartesianToCartographic(a,new Qe),h=Hn.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=h.multiplyRight(o),e.cartographicOrigin=c,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){var e;if(this.type===nl.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0}else if(this.type===nl.TILES3D){const{extensionsRemoved:n=[]}=(null==(e=t.content)?void 0:e.gltf)||{};n.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),n.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),n.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Pl).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Pl).decrementCount()}_addTileToCache(t){this._cache.add(this,t,(e=>e._updateCacheStats(t)))}_updateCacheStats(t){this.stats.get(Nl).incrementCount(),this.stats.get(Gl).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(kl).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Gl).decrementCount(),this.stats.get(Hl).incrementCount(),this.stats.get(kl).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){const t=[];for(this.root&&t.push(this.root);t.length>0;){const e=t.pop();for(const n of e.children)t.push(n);this._destroyTile(e)}this.root=null}_destroySubtree(t){const e=t,n=[];for(n.push(e);n.length>0;){t=n.pop();for(const e of t.children)n.push(e);t!==e&&this._destroyTile(t)}e.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){const e=new URLSearchParams(t.queryString),n=Object.fromEntries(e.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version&&"1.1"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}function Ql(e){const n=document.createElement("canvas");n.width=64,n.height=64;const r=n.getContext("2d");r.rect(0,0,64,64);const i=r.createLinearGradient(0,0,64,64);for(let t=0;tt.toString(),ru=new t.ShaderMaterial({vertexShader:nu` varying vec3 vPosition; void main() { vPosition = (modelMatrix * vec4(position, 1.0)).xyz; @@ -90,4 +90,4 @@ void main() { gl_FragColor = vec4(vColor, opacity); } -`,ou=new t.ShaderMaterial({vertexShader:iu,fragmentShader:su,uniforms:{tPosition:{value:null},minHeight:{value:0},maxHeight:{value:300},opacity:{value:.5},samples:{value:4},sampleStep:{value:4}},vertexColors:!0,transparent:!0,depthTest:!1,blending:t.NormalBlending}),au={SPECTRAL:[[0,new t.Color(.3686,.3098,.6353)],[.1,new t.Color(.1961,.5333,.7412)],[.2,new t.Color(.4,.7608,.6471)],[.3,new t.Color(.6706,.8667,.6431)],[.4,new t.Color(.902,.9608,.5961)],[.5,new t.Color(1,1,.749)],[.6,new t.Color(.9961,.8784,.5451)],[.7,new t.Color(.9922,.6824,.3804)],[.8,new t.Color(.9569,.4275,.2627)],[.9,new t.Color(.8353,.2431,.3098)],[1,new t.Color(.6196,.0039,.2588)]],PLASMA:[[0,new t.Color(.241,.015,.61)],[.1,new t.Color(.387,.001,.654)],[.2,new t.Color(.524,.025,.653)],[.3,new t.Color(.651,.125,.596)],[.4,new t.Color(.752,.227,.513)],[.5,new t.Color(.837,.329,.431)],[.6,new t.Color(.907,.435,.353)],[.7,new t.Color(.963,.554,.272)],[.8,new t.Color(.992,.681,.195)],[.9,new t.Color(.987,.822,.144)],[1,new t.Color(.94,.975,.131)]],YELLOW_GREEN:[[0,new t.Color(.1647,.2824,.3451)],[.1,new t.Color(.1338,.3555,.4227)],[.2,new t.Color(.061,.4319,.4864)],[.3,new t.Color(0,.5099,.5319)],[.4,new t.Color(0,.5881,.5569)],[.5,new t.Color(.137,.665,.5614)],[.6,new t.Color(.2906,.7395,.5477)],[.7,new t.Color(.4453,.8099,.5201)],[.8,new t.Color(.6102,.8748,.485)],[.9,new t.Color(.7883,.9323,.4514)],[1,new t.Color(.9804,.9804,.4314)]],VIRIDIS:[[0,new t.Color(.267,.005,.329)],[.1,new t.Color(.283,.141,.458)],[.2,new t.Color(.254,.265,.53)],[.3,new t.Color(.207,.372,.553)],[.4,new t.Color(.164,.471,.558)],[.5,new t.Color(.128,.567,.551)],[.6,new t.Color(.135,.659,.518)],[.7,new t.Color(.267,.749,.441)],[.8,new t.Color(.478,.821,.318)],[.9,new t.Color(.741,.873,.15)],[1,new t.Color(.993,.906,.144)]],INFERNO:[[0,new t.Color(.077,.042,.206)],[.1,new t.Color(.225,.036,.388)],[.2,new t.Color(.373,.074,.432)],[.3,new t.Color(.522,.128,.42)],[.4,new t.Color(.665,.182,.37)],[.5,new t.Color(.797,.255,.287)],[.6,new t.Color(.902,.364,.184)],[.7,new t.Color(.969,.516,.063)],[.8,new t.Color(.988,.683,.072)],[.9,new t.Color(.961,.859,.298)],[1,new t.Color(.988,.998,.645)]],GRAYSCALE:[[0,new t.Color(0,0,0)],[1,new t.Color(1,1,1)]],TURBO:[[0,new t.Color(.18995,.07176,.23217)],[.07,new t.Color(.25107,.25237,.63374)],[.13,new t.Color(.27628,.42118,.89123)],[.2,new t.Color(.25862,.57958,.99876)],[.27,new t.Color(.15844,.73551,.92305)],[.33,new t.Color(.09267,.86554,.7623)],[.4,new t.Color(.19659,.94901,.59466)],[.47,new t.Color(.42778,.99419,.38575)],[.53,new t.Color(.64362,.98999,.23356)],[.6,new t.Color(.80473,.92452,.20459)],[.67,new t.Color(.93301,.81236,.22667)],[.73,new t.Color(.99314,.67408,.20348)],[.8,new t.Color(.9836,.49291,.12849)],[.87,new t.Color(.92105,.31489,.05475)],[.93,new t.Color(.81608,.18462,.01809)],[1,new t.Color(.66449,.08436,.00424)]],RAINBOW:[[0,new t.Color(.278,0,.714)],[1/6,new t.Color(0,0,1)],[2/6,new t.Color(0,1,1)],[.5,new t.Color(0,1,0)],[4/6,new t.Color(1,1,0)],[5/6,new t.Color(1,.64,0)],[1,new t.Color(1,0,0)]],CONTOUR:[[0,new t.Color(0,0,0)],[.03,new t.Color(0,0,0)],[.04,new t.Color(1,1,1)],[1,new t.Color(1,1,1)]]};var cu=(t=>(t[t.Intensity=1]="Intensity",t[t.Classification=2]="Classification",t[t.Elevation=3]="Elevation",t[t.RGB=4]="RGB",t[t.White=5]="White",t))(cu||{}),hu=(t=>(t[t.FlatTexture=1]="FlatTexture",t[t.ShadedTexture=2]="ShadedTexture",t[t.ShadedNoTexture=3]="ShadedNoTexture",t))(hu||{});const lu=typeof document<"u"?Ql(au.RAINBOW):null,uu=typeof document<"u"?Ql(au.GRAYSCALE):null,du={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxConcurrency:1,maximumScreenSpaceError:16,memoryAdjustedScreenSpaceError:!0,maximumMemoryUsage:400,memoryCacheOverflow:128,viewDistanceScale:1,skipLevelOfDetail:!1,resetTransform:!1,updateTransforms:!0,shading:hu.FlatTexture,transparent:!1,pointCloudColoring:cu.White,pointSize:1,worker:!0,wireframe:!1,debug:!1,gltfLoader:null,basisTranscoderPath:null,dracoDecoderPath:null,material:null,contentPostProcess:void 0,preloadTilesCount:null,collectAttributions:!1};function fu(t){var e,n,r,i;null!=(e=null==t?void 0:t.uniforms)&&e.map?null==(r=null==(n=null==t?void 0:t.uniforms)?void 0:n.map.value)||r.dispose():t.map&&(null==(i=t.map)||i.dispose()),t.dispose()}function mu(t){t.traverse((t=>{if(t.isMesh)if(t.geometry.dispose(),t.material.isMaterial)fu(t.material);else for(const e of t.material)fu(e)}));for(let e=t.children.length-1;e>=0;e--){const n=t.children[e];t.remove(n)}}if(r(384),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const pu={white:cu.White,intensity:cu.Intensity,classification:cu.Classification,elevation:cu.Elevation,rgb:cu.RGB};AFRAME.registerComponent("loader-3dtiles",{schema:{url:{type:"string"},cameraEl:{type:"selector"},maximumSSE:{type:"int",default:16},maximumMem:{type:"int",default:32},distanceScale:{type:"number",default:1},pointcloudColoring:{type:"string",default:"white"},pointcloudElevationRange:{type:"array",default:["0","400"]},wireframe:{type:"boolean",default:!1},showStats:{type:"boolean",default:!1},cesiumIONToken:{type:"string"},googleApiKey:{type:"string"},lat:{type:"number"},long:{type:"number"},height:{type:"number",default:0},copyrightEl:{type:"selector"}},init:async function(){const t=this.el.sceneEl,e=this.data;if(this.camera=e.cameraEl?.object3D.children[0]??document.querySelector("a-scene").camera,!this.camera)throw new Error("3D Tiles: Please add an active camera or specify the target camera via the cameraEl property");this.viewport={width:t.clientWidth,height:t.clientHeight,devicePixelRatio:window.devicePixelRatio};const{model:n,runtime:r}=await this._initTileset();this.el.setObject3D("tileset",n),this.runtime=r,this.originalCamera=this.camera,t.addEventListener("camera-set-active",(t=>{this.camera=t.detail.cameraEl.object3D.children[0]??this.originalCamera})),this.el.addEventListener("cameraChange",(t=>{this.camera=t.detail,"OrthographicCamera"===this.camera.type&&(this.camera.rotation.x<-1?this.camera.position.y=100:this.camera.position.y=10),this.runtime.setViewport(this.viewport)})),t.addEventListener("enter-vr",(e=>{this.originalCamera=this.camera;try{this.camera=t.renderer.xr.getCamera(this.camera),t.renderer.xr.getSession().requestAnimationFrame(((e,n)=>{const r=t.renderer.xr.getReferenceSpace(),i=n.getViewerPose(r);if(i){const t=i.views[0].projectionMatrix[5];this.camera.fov=2*Math.atan2(1,t)*180/Math.PI}}))}catch(e){console.warn("Could not get VR camera")}})),t.addEventListener("exit-vr",(t=>{this.camera=this.originalCamera})),e.showStats&&(this.stats=this._initStats()),THREE.Cache.enabled&&(console.warn("3D Tiles loader cannot work with THREE.Cache, disabling."),THREE.Cache.enabled=!1),await this._nextFrame(),this.runtime=r,this.runtime.setElevationRange(e.pointcloudElevationRange.map((t=>Number(t)))),window.addEventListener("resize",this.onWindowResize.bind(this)),AFRAME.INSPECTOR&&AFRAME.INSPECTOR.opened&&(this.camera=AFRAME.INSPECTOR.camera,this.play())},onWindowResize:function(){const t=this.el.sceneEl;this.camera.aspect=t.clientWidth/t.clientHeight,this.camera.updateProjectionMatrix(),this.viewport={width:t.clientWidth,height:t.clientHeight,devicePixelRatio:window.devicePixelRatio},this.runtime.setViewport(this.viewport)},update:async function(t){if(t.url!==this.data.url){this.runtime&&(this.runtime.dispose(),this.runtime=null);const{model:t,runtime:e}=await this._initTileset();this.el.setObject3D("tileset",t),await this._nextFrame(),this.runtime=e}else this.runtime&&(this.runtime.setPointCloudColoring(this._resolvePointcloudColoring(this.data.pointCloudColoring)),this.runtime.setWireframe(this.data.wireframe),this.runtime.setViewDistanceScale(this.data.distanceScale),this.runtime.setElevationRange(this.data.pointcloudElevationRange.map((t=>Number(t)))));this.data.showStats&&!this.stats&&(this.stats=this._initStats()),!this.data.showStats&&this.stats&&(this.el.sceneEl.removeChild(this.stats),this.stats=null),(this.data.lat&&this.data.long||this.data.height)&&this.runtime.orientToGeocoord({lat:Number(this.data.lat),long:Number(this.data.long),height:Number(this.data.height)})},tick:function(e,n){if(this.runtime){if(this.runtime.update(n,this.camera),this.stats){const e=new t.Vector3;this.camera.getWorldPosition(e);const n=this.runtime.getStats();this.stats.setAttribute("textarea","text",Object.values(n.stats).map((t=>`${t.name}: ${t.count}`)).join("\n"));const r=new t.Vector3;r.copy(e),r.z-=2,this.stats.setAttribute("position",r)}this.data.copyrightEl&&(this.data.copyrightEl.innerHTML=this.runtime.getDataAttributions()??"")}},remove:function(){this.runtime&&this.runtime.dispose()},_resolvePointcloudColoring(){return pu[this.data.pointcloudColoring]||(console.warn("Invalid value for point cloud coloring"),cu.White)},_initTileset:async function(){const e=this._resolvePointcloudColoring(this.data.pointcloudColoring);return class{static async load(e){const n={...du,...e.options},{url:r}=e;let{viewport:i,renderer:s}=e;const o=n.updateInterval,a={};if(n.cesiumIONToken){a["cesium-ion"]={accessToken:n.cesiumIONToken};const t=await Dc.preload(r,a);a.fetch={headers:t.headers}}n.googleApiKey&&(a.fetch={headers:{"X-GOOG-API-KEY":n.googleApiKey}},e.options.hasOwnProperty("collectAttributions")||(n.collectAttributions=!0)),e.loadingManager&&e.loadingManager.itemStart(r);const c=await he(r,Ic,{...a}),h={},l={},u=[],d=new t.Group,f=new t.Group;n.debug||(f.visible=!1);const m={pointSize:{type:"f",value:n.pointSize},gradient:{type:"t",value:lu},grayscale:{type:"t",value:uu},rootCenter:{type:"vec3",value:new t.Vector3},rootNormal:{type:"vec3",value:new t.Vector3},coloring:{type:"i",value:n.pointCloudColoring},hideGround:{type:"b",value:!0},elevationRange:{type:"vec2",value:new t.Vector2(0,400)},maxIntensity:{type:"f",value:1},intensityContrast:{type:"f",value:1},alpha:{type:"f",value:1}},p=new t.ShaderMaterial({uniforms:m,vertexShader:"\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:"\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n",transparent:n.transparent,vertexColors:!0});let g,A,y;n.gltfLoader?g=n.gltfLoader:(g=new t.GLTFLoader,n.basisTranscoderPath&&(A=new t.KTX2Loader,A.detectSupport(s??new t.WebGLRenderer),A.setTranscoderPath(n.basisTranscoderPath+"/"),A.setWorkerLimit(1),g.setKTX2Loader(A)),n.dracoDecoderPath&&(y=new t.DRACOLoader,y.setDecoderPath(n.dracoDecoderPath+"/"),y.setWorkerLimit(n.maxConcurrency),g.setDRACOLoader(y)));const B=new t.MeshBasicMaterial({transparent:n.transparent}),b={maximumMemoryUsage:n.maximumMemoryUsage,maximumScreenSpaceError:n.maximumScreenSpaceError,memoryAdjustedScreenSpaceError:n.memoryAdjustedScreenSpaceError,memoryCacheOverflow:n.memoryCacheOverflow,viewDistanceScale:n.viewDistanceScale,skipLevelOfDetail:n.skipLevelOfDetail,updateTransforms:n.updateTransforms,throttleRequests:n.throttleRequests,maxRequests:n.maxRequests,contentLoader:async e=>{let r=null;switch(e.type){case el.POINTCLOUD:r=function(e,n,r,i){const s={rtc_center:e.content.rtcCenter,points:e.content.attributes.positions,intensities:e.content.attributes.intensity,classifications:e.content.attributes.classification,rgb:null,rgba:null},{colors:o}=e.content.attributes;o&&3===o.size&&(s.rgb=o.value),o&&4===o.size&&(s.rgba=o.value);const a=new t.BufferGeometry;a.setAttribute("position",new t.Float32BufferAttribute(s.points,3));const c=(new t.Matrix4).fromArray(e.computedTransform).premultiply(i);s.rgba?a.setAttribute("color",new t.Float32BufferAttribute(s.rgba,4)):s.rgb&&a.setAttribute("color",new t.Uint8BufferAttribute(s.rgb,3,!0)),s.intensities&&a.setAttribute("intensity",new t.BufferAttribute(s.intensities,1,!0)),s.classifications&&a.setAttribute("classification",new t.Uint8BufferAttribute(s.classifications,1,!1)),e.content.geometriesByteLength=Yl(a),e.content.gpuMemoryUsageInBytes=e.content.geometriesByteLength;const h=new t.Points(a,r.material||n);if(s.rtc_center){const e=s.rtc_center;c.multiply((new t.Matrix4).makeTranslation(e[0],e[1],e[2]))}return h.applyMatrix4(c),r.contentPostProcess&&r.contentPostProcess(h),h}(e,p,n,L);break;case el.SCENEGRAPH:case el.MESH:r=await async function(e,n,r,i,s){return new Promise(((o,a)=>{const c=(new t.Matrix4).makeRotationAxis(new t.Vector3(1,0,0),Math.PI/2),h="Z"!==n.content.gltfUpAxis,l=(new t.Matrix4).fromArray(n.computedTransform).premultiply(s);h&&l.multiply(c),n.content.byteLength||(n.content.byteLength=n.content.gltfArrayBuffer.byteLength),e.parse(n.content.gltfArrayBuffer,n.contentUrl?n.contentUrl.substr(0,n.contentUrl.lastIndexOf("/")+1):null,(t=>{n.userData.asset=t.asset;const e=t.scenes[0];e.applyMatrix4(l),n.content.texturesByteLength=0,n.content.geometriesByteLength=0,e.traverse((t=>{if("Mesh"==t.type){const e=t;n.content.geometriesByteLength+=Yl(e.geometry);const s=e.material,o=s.map;if(o){const t=function(t){let e=0;if("image/ktx2"==(null==t?void 0:t.userData.mimeType)&&t.mipmaps){for(let n=0;n1||i[1]>1;)e+=i[0]*i[1]*r,i[0]=Math.max(Math.floor(i[0]/2),1),i[1]=Math.max(Math.floor(i[1]/2),1);return e+=1*r,e}}(o);t&&(n.content.texturesByteLength+=t)}i.material?(e.material=i.material.clone(),s.dispose()):i.shading==hu.FlatTexture&&"MeshBasicMaterial"!==e.material.type&&(e.material=r.clone(),s.dispose()),i.shading!=hu.ShadedNoTexture?"ShaderMaterial"==e.material.type?e.material.uniforms.map={value:o}:e.material.map=o:(o&&o.dispose(),e.material.map=null),e.material.wireframe=i.wireframe,i.contentPostProcess&&i.contentPostProcess(e)}})),n.content.gpuMemoryUsageInBytes=n.content.texturesByteLength+n.content.geometriesByteLength,o(e)}),(t=>{a(new Error(`error parsing gltf in tile ${n.id}: ${t}`))}))}))}(g,e,B,n,L)}if(r&&(r.visible=!1,h[e.id]=r,d.add(h[e.id]),n.debug)){const t=ql(e);f.add(t),l[e.id]=t}},onTileLoad:async t=>{C&&(n.resetTransform&&!T&&(null==t?void 0:t.depth)<=5&&U(t),R=!0)},onTileUnload:t=>{u.push(t)},onTileError:(t,e)=>{console.warn("Tile error",t.id,e)},onTraversalComplete:t=>(n.collectAttributions&&(_=function(t){const e=new Map;return t.forEach((t=>{var n,r;const i=null==(r=null==(n=null==t?void 0:t.userData)?void 0:n.asset)?void 0:r.copyright;i&&i.split(/;/g).map((t=>t.trim())).forEach((t=>{t&&e.set(t,(e.get(t)||0)+1)}))})),Array.from(e).sort(((t,e)=>e[1]-t[1])).map((([t])=>t)).join("; ")}(t)),t)},C=new Kl(c,{...b,loadOptions:{...a,maxConcurrency:n.maxConcurrency,worker:n.worker,gltf:{loadImages:!1},"3d-tiles":{loadGLTF:!1}}}),w=new t.Matrix4,E=new t.Matrix4,v=new t.Vector3;let T=!1,_="";if(C.root.boundingVolume?(C.root.header.boundingVolume.region&&console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."),E.setPosition(C.root.boundingVolume.center[0],C.root.boundingVolume.center[1],C.root.boundingVolume.center[2])):console.warn("Bounding volume not found, no transformations applied"),n.debug){const t=ql(C.root);f.add(t),l[C.root.id]=t}let x=!1,M=!1;m.rootCenter.value.copy(v),m.rootNormal.value.copy(new t.Vector3(0,0,1).normalize()),C.stats.get("Loader concurrency").count=n.maxConcurrency,C.stats.get("Maximum mem usage").count=n.maximumMemoryUsage;let I=0,S=null,R=!0,O=null;const F=new t.Vector3(1/0,1/0,1/0);let D=null;d.updateMatrixWorld(!0);const G=(new t.Matrix4).copy(d.matrixWorld),L=(new t.Matrix4).copy(G).invert();function U(e){if(!e.boundingVolume.halfAxes)return;const n=e.boundingVolume.halfAxes,r=(new t.Matrix4).extractRotation(Wl(n)).premultiply((new t.Matrix4).extractRotation(L));if(!(new t.Euler).setFromRotationMatrix(r).equals(new t.Euler)){T=!0;const e=new t.Vector3(E.elements[12],E.elements[13],E.elements[14]);E.extractRotation(r),E.setPosition(e)}N()}function N(){w.copy(G),n.resetTransform&&w.multiply((new t.Matrix4).copy(E).invert()),C.modelMatrix=new ln(w.toArray())}function P(t,r,i,s){if(x||!s)return;D||(D=new ur({fov:s.fov/180*Math.PI,aspectRatio:s.aspect,near:s.near,far:s.far}).sseDenominator,n.debug&&console.log("Updated sse denonimator:",D));const o=zl(s).planes.map((t=>new tr(t.normal.toArray(),t.constant))),a=new ir(o),c={camera:{position:F.toArray()},height:i.height*i.devicePixelRatio,frameNumber:t._frameNumber,sseDenominator:D,cullingVolume:a,viewport:{id:0}};t._cache.reset(),t._traverser.traverse(t.root,c,t.options);for(const e of t.tiles)e.selected?r[e.id]?r[e.id].visible=!0:console.error("TILE SELECTED BUT NOT LOADED!!",e.id):r[e.id]&&(r[e.id].visible=!1);for(;u.length>0;){const t=u.pop();r[t.id]&&0==t.contentState&&(d.remove(r[t.id]),mu(r[t.id]),delete r[t.id]),l[t.id]&&(mu(l[t.id]),f.remove(l[t.id]),delete l[t.id])}const h=t.stats.get("Tiles Loaded").count,m=t.stats.get("Tiles Loading").count;return e.onProgress&&e.onProgress(h,h+m),e.loadingManager&&!M&&0==m&&(null==n.preloadTilesCount||h>=n.preloadTilesCount)&&(M=!0,e.loadingManager.itemEnd(e.url)),c}return n.resetTransform&&U(C.root),n.debug&&(l[C.root.id].applyMatrix4(w),f.matrixWorld.copy(d.matrixWorld)),{model:d,runtime:{getTileset:()=>C,getStats:()=>C.stats,getDataAttributions:()=>_,showTiles:t=>{f.visible=t},setWireframe:e=>{n.wireframe=e,d.traverse((n=>{n instanceof t.Mesh&&(n.material.wireframe=e)}))},setDebug:t=>{n.debug=t,f.visible=t},setShading:t=>{n.shading=t},getTileBoxes:()=>f,setViewDistanceScale:t=>{C.options.viewDistanceScale=t,C._frameNumber++,P(C,h,i,O)},setMaximumScreenSpaceError:t=>{C.options.maximumScreenSpaceError=t,C._frameNumber++,P(C,h,i,O)},setHideGround:t=>{m.hideGround.value=t},setPointCloudColoring:t=>{m.coloring.value=t},setElevationRange:t=>{m.elevationRange.value.set(t[0],t[1])},setMaxIntensity:t=>{m.maxIntensity.value=t},setIntensityContrast:t=>{m.intensityContrast.value=t},setPointAlpha:t=>{m.alpha.value=t},getLatLongHeightFromPosition:e=>{const n=C.ellipsoid.cartesianToCartographic((new t.Vector3).copy(e).applyMatrix4((new t.Matrix4).copy(w).invert()).toArray());return{lat:n[1],long:n[0],height:n[2]}},getPositionFromLatLongHeight:e=>{const n=C.ellipsoid.cartographicToCartesian([e.long,e.lat,e.height]);return new t.Vector3(...n).applyMatrix4(w)},orientToGeocoord:e=>{const n=[e.long,e.lat,e.height],r=C.ellipsoid.cartographicToCartesian(n),i=(new t.Matrix4).fromArray(C.ellipsoid.eastNorthUpToFixedFrame(r)),s=(new t.Matrix4).makeRotationFromEuler(new t.Euler(Math.PI/2,Math.PI/2,0));!function(e){const n=new t.Vector3,r=new t.Quaternion,i=new t.Vector3;e.decompose(n,r,i),d.position.copy(n),d.quaternion.copy(r),d.scale.copy(i),d.updateMatrix(),d.updateMatrixWorld(!0),G.copy(d.matrixWorld),L.copy(G).invert(),N()}((new t.Matrix4).copy(i).multiply(s).invert())},getWebMercatorCoord:e=>function(e,n){const r=2*Math.PI*6378137/2,i=n*r/180;let s=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return s=s*r/180,new t.Vector2(i,s)}(e.lat,e.long),getCameraFrustum:e=>{const n=zl(e).planes.map((t=>new tr(t.normal.toArray(),t.constant))).map((e=>function(e){const n=new t.Group,r=new t.PlaneGeometry(10,5),i=new t.Vector3(...e.projectPointOntoPlane([0,0,0])),s=new t.Vector3(e.normal.x,e.normal.y,e.normal.z),o=(new t.Vector3).copy(i).add(s);r.lookAt(o),r.translate(i.x,i.y,i.z);const a=new t.MeshBasicMaterial({color:65535,side:t.DoubleSide}),c=new t.Mesh(r,a),h=new t.ArrowHelper(s,i,5,16776960);return n.add(h),n.add(c),n}(e))),r=new t.Group;for(const t of n)r.add(t);return r},overlayGeoJSON:(e,n)=>{if(e.applyMatrix4(w),e.updateMatrixWorld(),!s)throw new Error("GeoJSON draping requires a renderer reference via LoaderProps");return function(e,n,r,i=eu){Xl&&Xl.dispose(),Zl||(Zl=r);const s={...eu,...i};Xl=new t.WebGLRenderTarget(e.width*e.devicePixelRatio,e.height*e.devicePixelRatio),Xl.texture.minFilter=t.NearestFilter,Xl.texture.magFilter=t.NearestFilter,Xl.stencilBuffer=!1,Xl.texture.format=t.RGBAFormat,Xl.texture.type=t.FloatType,Zl.setPixelRatio(devicePixelRatio),Zl.setSize(e.width,e.height),Zl.setRenderTarget(Xl),$l=new t.Scene,$l.overrideMaterial=ru,tu=n,ou.uniforms.tPosition.value=Xl.texture,ou.uniforms.minHeight.value=s.minHeight,ou.uniforms.maxHeight.value=s.maxHeight,ou.uniforms.samples.value=s.samples,ou.uniforms.sampleStep.value=s.sampleStep,ou.uniforms.opacity.value=s.opacity,ou.blending=s.blendingType}(i,d,s,n),e.material.dispose(),e.material=ou,e},setViewport:t=>{i=t,D=null,R=!0,Xl&&function(t){Xl.setSize(t.width*t.devicePixelRatio,t.height*t.devicePixelRatio),Zl.setPixelRatio(devicePixelRatio),Zl.setSize(t.width,t.height)}(i)},setRenderer:t=>{s=t},update:function(e,r){if(O=r,I+=e,Xl&&function(t){if(Zl){const e=tu.parent;$l.add(tu),Zl.setRenderTarget(Xl),Zl.render($l,t),e&&e.add(tu),Zl.setRenderTarget(null)}}(r),C&&I>=o){if(!G.equals(d.matrixWorld)){I=0,G.copy(d.matrixWorld),n.updateTransforms&&N();const e=(new t.Vector3).setFromMatrixPosition(G);m.rootCenter.value.copy(e),m.rootNormal.value.copy(new t.Vector3(0,0,1).applyMatrix4(G).normalize()),L.copy(G).invert(),n.debug&&(l[C.root.id].matrixWorld.copy(w),l[C.root.id].applyMatrix4(G))}null==S?S=(new t.Matrix4).copy(r.matrixWorld):(R||function(t,e){return!t.matrixWorld.equals(e)}(r,S))&&(I=0,R=!1,C._frameNumber++,r.getWorldPosition(F),S.copy(r.matrixWorld),P(C,h,i,r))}},dispose:function(){for(x=!0,C._destroy();d.children.length>0;){const t=d.children[0];mu(t),d.remove(t)}for(;f.children.length>0;){const t=f.children[0];f.remove(t),t.geometry.dispose(),t.material.dispose()}A&&A.dispose(),y&&y.dispose()}}}}static async loadGeoJSON(e){const{url:n,height:r,featureToColor:i}=e;return he(n,Uh,{worker:!1,gis:{format:"binary"}}).then((e=>{const n=e,s=new t.BufferGeometry,o=n.polygons.positions.value.reduce(((t,e,n,i)=>{if(n%2==0){const s=[e,i[n+1],r??0],o=Hn.WGS84.cartographicToCartesian(s);t.push(...o)}return t}),[]);if(s.setAttribute("position",new t.Float32BufferAttribute(o,3)),i){const e=n.polygons.numericProps[i.feature].value.reduce(((t,e,n,r)=>{const s=i.colorMap(e);return t[3*n]=s.r,t[3*n+1]=s.g,t[3*n+2]=s.b,t}),[]);s.setAttribute("color",new t.Float32BufferAttribute(e,3))}s.setIndex(new t.BufferAttribute(n.polygons.triangles.value,1));const a=new t.MeshBasicMaterial({transparent:!0,vertexColors:!0,opacity:.5,blending:t.NormalBlending});return new t.Mesh(s,a)}))}}.load({url:this.data.url,renderer:this.el.sceneEl.renderer,options:{googleApiKey:this.data.googleApiKey,cesiumIONToken:this.data.cesiumIONToken,dracoDecoderPath:"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/draco",basisTranscoderPath:"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/basis",maximumScreenSpaceError:this.data.maximumSSE,maximumMemoryUsage:this.data.maximumMem,memoryCacheOverflow:128,pointCloudColoring:e,viewDistanceScale:this.data.distanceScale,wireframe:this.data.wireframe,updateTransforms:!0},viewport:this.viewport})},_initStats:function(){const t=document.createElement("a-entity");return this.el.sceneEl.appendChild(t),t.setAttribute("position","-0.5 0 -1"),t.setAttribute("textarea",{cols:30,rows:15,text:"",color:"white",disabledBackgroundColor:"#0c1e2c",disabled:!0}),t},_nextFrame:async function(){return new Promise(((t,e)=>{setTimeout((()=>{t()}),0)}))}})})(),i})())); \ No newline at end of file +`,ou=new t.ShaderMaterial({vertexShader:iu,fragmentShader:su,uniforms:{tPosition:{value:null},minHeight:{value:0},maxHeight:{value:300},opacity:{value:.5},samples:{value:4},sampleStep:{value:4}},vertexColors:!0,transparent:!0,depthTest:!1,blending:t.NormalBlending}),au={SPECTRAL:[[0,new t.Color(.3686,.3098,.6353)],[.1,new t.Color(.1961,.5333,.7412)],[.2,new t.Color(.4,.7608,.6471)],[.3,new t.Color(.6706,.8667,.6431)],[.4,new t.Color(.902,.9608,.5961)],[.5,new t.Color(1,1,.749)],[.6,new t.Color(.9961,.8784,.5451)],[.7,new t.Color(.9922,.6824,.3804)],[.8,new t.Color(.9569,.4275,.2627)],[.9,new t.Color(.8353,.2431,.3098)],[1,new t.Color(.6196,.0039,.2588)]],PLASMA:[[0,new t.Color(.241,.015,.61)],[.1,new t.Color(.387,.001,.654)],[.2,new t.Color(.524,.025,.653)],[.3,new t.Color(.651,.125,.596)],[.4,new t.Color(.752,.227,.513)],[.5,new t.Color(.837,.329,.431)],[.6,new t.Color(.907,.435,.353)],[.7,new t.Color(.963,.554,.272)],[.8,new t.Color(.992,.681,.195)],[.9,new t.Color(.987,.822,.144)],[1,new t.Color(.94,.975,.131)]],YELLOW_GREEN:[[0,new t.Color(.1647,.2824,.3451)],[.1,new t.Color(.1338,.3555,.4227)],[.2,new t.Color(.061,.4319,.4864)],[.3,new t.Color(0,.5099,.5319)],[.4,new t.Color(0,.5881,.5569)],[.5,new t.Color(.137,.665,.5614)],[.6,new t.Color(.2906,.7395,.5477)],[.7,new t.Color(.4453,.8099,.5201)],[.8,new t.Color(.6102,.8748,.485)],[.9,new t.Color(.7883,.9323,.4514)],[1,new t.Color(.9804,.9804,.4314)]],VIRIDIS:[[0,new t.Color(.267,.005,.329)],[.1,new t.Color(.283,.141,.458)],[.2,new t.Color(.254,.265,.53)],[.3,new t.Color(.207,.372,.553)],[.4,new t.Color(.164,.471,.558)],[.5,new t.Color(.128,.567,.551)],[.6,new t.Color(.135,.659,.518)],[.7,new t.Color(.267,.749,.441)],[.8,new t.Color(.478,.821,.318)],[.9,new t.Color(.741,.873,.15)],[1,new t.Color(.993,.906,.144)]],INFERNO:[[0,new t.Color(.077,.042,.206)],[.1,new t.Color(.225,.036,.388)],[.2,new t.Color(.373,.074,.432)],[.3,new t.Color(.522,.128,.42)],[.4,new t.Color(.665,.182,.37)],[.5,new t.Color(.797,.255,.287)],[.6,new t.Color(.902,.364,.184)],[.7,new t.Color(.969,.516,.063)],[.8,new t.Color(.988,.683,.072)],[.9,new t.Color(.961,.859,.298)],[1,new t.Color(.988,.998,.645)]],GRAYSCALE:[[0,new t.Color(0,0,0)],[1,new t.Color(1,1,1)]],TURBO:[[0,new t.Color(.18995,.07176,.23217)],[.07,new t.Color(.25107,.25237,.63374)],[.13,new t.Color(.27628,.42118,.89123)],[.2,new t.Color(.25862,.57958,.99876)],[.27,new t.Color(.15844,.73551,.92305)],[.33,new t.Color(.09267,.86554,.7623)],[.4,new t.Color(.19659,.94901,.59466)],[.47,new t.Color(.42778,.99419,.38575)],[.53,new t.Color(.64362,.98999,.23356)],[.6,new t.Color(.80473,.92452,.20459)],[.67,new t.Color(.93301,.81236,.22667)],[.73,new t.Color(.99314,.67408,.20348)],[.8,new t.Color(.9836,.49291,.12849)],[.87,new t.Color(.92105,.31489,.05475)],[.93,new t.Color(.81608,.18462,.01809)],[1,new t.Color(.66449,.08436,.00424)]],RAINBOW:[[0,new t.Color(.278,0,.714)],[1/6,new t.Color(0,0,1)],[2/6,new t.Color(0,1,1)],[.5,new t.Color(0,1,0)],[4/6,new t.Color(1,1,0)],[5/6,new t.Color(1,.64,0)],[1,new t.Color(1,0,0)]],CONTOUR:[[0,new t.Color(0,0,0)],[.03,new t.Color(0,0,0)],[.04,new t.Color(1,1,1)],[1,new t.Color(1,1,1)]]};var cu=(t=>(t[t.Intensity=1]="Intensity",t[t.Classification=2]="Classification",t[t.Elevation=3]="Elevation",t[t.RGB=4]="RGB",t[t.White=5]="White",t))(cu||{}),hu=(t=>(t[t.FlatTexture=1]="FlatTexture",t[t.ShadedTexture=2]="ShadedTexture",t[t.ShadedNoTexture=3]="ShadedNoTexture",t))(hu||{});const lu=typeof document<"u"?Ql(au.RAINBOW):null,uu=typeof document<"u"?Ql(au.GRAYSCALE):null,du={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxConcurrency:1,maximumScreenSpaceError:16,memoryAdjustedScreenSpaceError:!0,maximumMemoryUsage:400,memoryCacheOverflow:128,viewDistanceScale:1,skipLevelOfDetail:!1,resetTransform:!1,updateTransforms:!0,shading:hu.FlatTexture,transparent:!1,pointCloudColoring:cu.White,pointSize:1,worker:!0,wireframe:!1,debug:!1,gltfLoader:null,basisTranscoderPath:null,dracoDecoderPath:null,material:null,contentPostProcess:void 0,preloadTilesCount:null,collectAttributions:!1};function fu(t){var e,n,r,i;null!=(e=null==t?void 0:t.uniforms)&&e.map?null==(r=null==(n=null==t?void 0:t.uniforms)?void 0:n.map.value)||r.dispose():t.map&&(null==(i=t.map)||i.dispose()),t.dispose()}function mu(t){t.traverse((t=>{if(t.isMesh)if(t.geometry.dispose(),t.material.isMaterial)fu(t.material);else for(const e of t.material)fu(e)}));for(let e=t.children.length-1;e>=0;e--){const n=t.children[e];t.remove(n)}}if(r(384),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const pu={white:cu.White,intensity:cu.Intensity,classification:cu.Classification,elevation:cu.Elevation,rgb:cu.RGB};AFRAME.registerComponent("loader-3dtiles",{schema:{url:{type:"string"},cameraEl:{type:"selector"},maximumSSE:{type:"int",default:16},maximumMem:{type:"int",default:32},distanceScale:{type:"number",default:1},pointcloudColoring:{type:"string",default:"white"},pointcloudElevationRange:{type:"array",default:["0","400"]},wireframe:{type:"boolean",default:!1},showStats:{type:"boolean",default:!1},cesiumIONToken:{type:"string"},googleApiKey:{type:"string"},lat:{type:"number"},long:{type:"number"},height:{type:"number",default:0},copyrightEl:{type:"selector"}},init:async function(){const t=this.el.sceneEl,e=this.data;if(this.camera=e.cameraEl?.object3D.children[0]??document.querySelector("a-scene").camera,!this.camera)throw new Error("3D Tiles: Please add an active camera or specify the target camera via the cameraEl property");this.viewport={width:t.clientWidth,height:t.clientHeight,devicePixelRatio:window.devicePixelRatio};const{model:n,runtime:r}=await this._initTileset();this.el.setObject3D("tileset",n),this.runtime=r,this.originalCamera=this.camera,t.addEventListener("camera-set-active",(t=>{this.camera=t.detail.cameraEl.object3D.children[0]??this.originalCamera})),this.el.addEventListener("cameraChange",(t=>{this.camera=t.detail,"OrthographicCamera"===this.camera.type&&(this.camera.rotation.x<-1?this.camera.position.y=100:this.camera.position.y=10),this.runtime.setViewport(this.viewport)})),t.addEventListener("enter-vr",(e=>{this.originalCamera=this.camera;try{this.camera=t.renderer.xr.getCamera(this.camera),t.renderer.xr.getSession().requestAnimationFrame(((e,n)=>{const r=t.renderer.xr.getReferenceSpace(),i=n.getViewerPose(r);if(i){const t=i.views[0].projectionMatrix[5];this.camera.fov=2*Math.atan2(1,t)*180/Math.PI}}))}catch(e){console.warn("Could not get VR camera")}})),t.addEventListener("exit-vr",(t=>{this.camera=this.originalCamera})),e.showStats&&(this.stats=this._initStats()),THREE.Cache.enabled&&(console.warn("3D Tiles loader cannot work with THREE.Cache, disabling."),THREE.Cache.enabled=!1),await this._nextFrame(),this.runtime=r,this.runtime.setElevationRange(e.pointcloudElevationRange.map((t=>Number(t)))),window.addEventListener("resize",this.onWindowResize.bind(this)),AFRAME.INSPECTOR&&AFRAME.INSPECTOR.opened&&(this.camera=AFRAME.INSPECTOR.camera,this.play())},onWindowResize:function(){const t=this.el.sceneEl;this.camera.aspect=t.clientWidth/t.clientHeight,this.camera.updateProjectionMatrix(),this.viewport={width:t.clientWidth,height:t.clientHeight,devicePixelRatio:window.devicePixelRatio},this.runtime.setViewport(this.viewport)},update:async function(t){if(t.url!==this.data.url){this.runtime&&(this.runtime.dispose(),this.runtime=null);const{model:t,runtime:e}=await this._initTileset();this.el.setObject3D("tileset",t),await this._nextFrame(),this.runtime=e}else this.runtime&&(this.runtime.setPointCloudColoring(this._resolvePointcloudColoring(this.data.pointCloudColoring)),this.runtime.setWireframe(this.data.wireframe),this.runtime.setViewDistanceScale(this.data.distanceScale),this.runtime.setElevationRange(this.data.pointcloudElevationRange.map((t=>Number(t)))));this.data.showStats&&!this.stats&&(this.stats=this._initStats()),!this.data.showStats&&this.stats&&(this.el.sceneEl.removeChild(this.stats),this.stats=null),(this.data.lat&&this.data.long||this.data.height)&&this.runtime.orientToGeocoord({lat:Number(this.data.lat),long:Number(this.data.long),height:Number(this.data.height)})},tick:function(e,n){if(this.runtime){if(this.runtime.update(n,this.camera),this.stats){const e=new t.Vector3;this.camera.getWorldPosition(e);const n=this.runtime.getStats();this.stats.setAttribute("textarea","text",Object.values(n.stats).map((t=>`${t.name}: ${t.count}`)).join("\n"));const r=new t.Vector3;r.copy(e),r.z-=2,this.stats.setAttribute("position",r)}this.data.copyrightEl&&(this.data.copyrightEl.innerHTML=this.runtime.getDataAttributions()??"")}},remove:function(){this.runtime&&this.runtime.dispose()},_resolvePointcloudColoring(){return pu[this.data.pointcloudColoring]||(console.warn("Invalid value for point cloud coloring"),cu.White)},_initTileset:async function(){const e=this._resolvePointcloudColoring(this.data.pointcloudColoring);return class{static async load(e){const n={...du,...e.options},{url:r}=e;let{viewport:i,renderer:s}=e;const o=n.updateInterval,a={};if(n.cesiumIONToken){a["cesium-ion"]={accessToken:n.cesiumIONToken};const t=await Dc.preload(r,a);a.fetch={headers:t.headers}}n.googleApiKey&&(a.fetch={headers:{"X-GOOG-API-KEY":n.googleApiKey}},e.options.hasOwnProperty("collectAttributions")||(n.collectAttributions=!0)),e.loadingManager&&e.loadingManager.itemStart(r);const c=await he(r,Ic,{...a}),h={},l={},u=[],d=new t.Group,f=new t.Group;n.debug||(f.visible=!1);const m={pointSize:{type:"f",value:n.pointSize},gradient:{type:"t",value:lu},grayscale:{type:"t",value:uu},rootCenter:{type:"vec3",value:new t.Vector3},rootNormal:{type:"vec3",value:new t.Vector3},coloring:{type:"i",value:n.pointCloudColoring},hideGround:{type:"b",value:!0},elevationRange:{type:"vec2",value:new t.Vector2(0,400)},maxIntensity:{type:"f",value:1},intensityContrast:{type:"f",value:1},alpha:{type:"f",value:1}},p=new t.ShaderMaterial({uniforms:m,vertexShader:"\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:"\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n",transparent:n.transparent,vertexColors:!0});let g,A,y;n.gltfLoader?g=n.gltfLoader:(g=new t.GLTFLoader,n.basisTranscoderPath&&(A=new t.KTX2Loader,A.detectSupport(s??new t.WebGLRenderer),A.setTranscoderPath(n.basisTranscoderPath+"/"),A.setWorkerLimit(1),g.setKTX2Loader(A)),n.dracoDecoderPath&&(y=new t.DRACOLoader,y.setDecoderPath(n.dracoDecoderPath+"/"),y.setWorkerLimit(n.maxConcurrency),g.setDRACOLoader(y)));const B=new t.MeshBasicMaterial({transparent:n.transparent}),b={maximumMemoryUsage:n.maximumMemoryUsage,maximumScreenSpaceError:n.maximumScreenSpaceError,memoryAdjustedScreenSpaceError:n.memoryAdjustedScreenSpaceError,memoryCacheOverflow:n.memoryCacheOverflow,viewDistanceScale:n.viewDistanceScale,skipLevelOfDetail:n.skipLevelOfDetail,updateTransforms:n.updateTransforms,throttleRequests:n.throttleRequests,maxRequests:n.maxRequests,contentLoader:async e=>{let r=null;switch(e.type){case el.POINTCLOUD:r=function(e,n,r,i){const s={rtc_center:e.content.rtcCenter,points:e.content.attributes.positions,intensities:e.content.attributes.intensity,classifications:e.content.attributes.classification,rgb:null,rgba:null},{colors:o}=e.content.attributes;o&&3===o.size&&(s.rgb=o.value),o&&4===o.size&&(s.rgba=o.value);const a=new t.BufferGeometry;a.setAttribute("position",new t.Float32BufferAttribute(s.points,3));const c=(new t.Matrix4).fromArray(e.computedTransform).premultiply(i);s.rgba?a.setAttribute("color",new t.Float32BufferAttribute(s.rgba,4)):s.rgb&&a.setAttribute("color",new t.Uint8BufferAttribute(s.rgb,3,!0)),s.intensities&&a.setAttribute("intensity",new t.BufferAttribute(s.intensities,1,!0)),s.classifications&&a.setAttribute("classification",new t.Uint8BufferAttribute(s.classifications,1,!1)),e.content.geometriesByteLength=Yl(a),e.content.gpuMemoryUsageInBytes=e.content.geometriesByteLength;const h=new t.Points(a,r.material||n);if(s.rtc_center){const e=s.rtc_center;c.multiply((new t.Matrix4).makeTranslation(e[0],e[1],e[2]))}return h.applyMatrix4(c),r.contentPostProcess&&r.contentPostProcess(h),h}(e,p,n,L);break;case el.SCENEGRAPH:case el.MESH:r=await async function(e,n,r,i,s){return new Promise(((o,a)=>{const c=(new t.Matrix4).makeRotationAxis(new t.Vector3(1,0,0),Math.PI/2),h="Z"!==n.content.gltfUpAxis,l=(new t.Matrix4).fromArray(n.computedTransform).premultiply(s);h&&l.multiply(c),n.content.byteLength||(n.content.byteLength=n.content.gltfArrayBuffer.byteLength),e.parse(n.content.gltfArrayBuffer,n.contentUrl?n.contentUrl.substr(0,n.contentUrl.lastIndexOf("/")+1):null,(t=>{n.userData.asset=t.asset;const e=t.scenes[0];e.applyMatrix4(l),n.content.texturesByteLength=0,n.content.geometriesByteLength=0,e.traverse((t=>{if("Mesh"==t.type){const e=t;n.content.geometriesByteLength+=Yl(e.geometry);const s=e.material,o=s.map;if(o){const t=function(t){let e=0;if("image/ktx2"==(null==t?void 0:t.userData.mimeType)&&t.mipmaps){for(let n=0;n1||i[1]>1;)e+=i[0]*i[1]*r,i[0]=Math.max(Math.floor(i[0]/2),1),i[1]=Math.max(Math.floor(i[1]/2),1);return e+=1*r,e}}(o);t&&(n.content.texturesByteLength+=t)}i.material?(e.material=i.material.clone(),s.dispose()):i.shading==hu.FlatTexture&&"MeshBasicMaterial"!==e.material.type&&(e.material=r.clone(),s.dispose()),i.shading!=hu.ShadedNoTexture?"ShaderMaterial"==e.material.type?e.material.uniforms.map={value:o}:e.material.map=o:(o&&o.dispose(),e.material.map=null),e.material.wireframe=i.wireframe,i.contentPostProcess&&i.contentPostProcess(e)}})),n.content.gpuMemoryUsageInBytes=n.content.texturesByteLength+n.content.geometriesByteLength,o(e)}),(t=>{a(new Error(`error parsing gltf in tile ${n.id}: ${t}`))}))}))}(g,e,B,n,L)}if(r&&(r.visible=!1,h[e.id]=r,d.add(h[e.id]),n.debug)){const t=ql(e);f.add(t),l[e.id]=t}},onTileLoad:async t=>{C&&(n.resetTransform&&!T&&(null==t?void 0:t.depth)<=5&&U(t),R=!0)},onTileUnload:t=>{u.push(t)},onTileError:(t,e)=>{console.warn("Tile error",t.id,e)},onTraversalComplete:t=>(n.collectAttributions&&(_=function(t){const e=new Map;return t.forEach((t=>{var n,r;const i=null==(r=null==(n=null==t?void 0:t.userData)?void 0:n.asset)?void 0:r.copyright;i&&i.split(/;/g).map((t=>t.trim())).forEach((t=>{t&&e.set(t,(e.get(t)||0)+1)}))})),Array.from(e).sort(((t,e)=>e[1]-t[1])).map((([t])=>t)).join("; ")}(t)),t)},C=new Kl(c,{...b,loadOptions:{...a,maxConcurrency:n.maxConcurrency,worker:n.worker,gltf:{loadImages:!1},"3d-tiles":{loadGLTF:!1}}}),w=new t.Matrix4,v=new t.Matrix4,E=new t.Vector3;let T=!1,_="";if(C.root.boundingVolume?(C.root.header.boundingVolume.region&&console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."),v.setPosition(C.root.boundingVolume.center[0],C.root.boundingVolume.center[1],C.root.boundingVolume.center[2])):console.warn("Bounding volume not found, no transformations applied"),n.debug){const t=ql(C.root);f.add(t),l[C.root.id]=t}let x=!1,M=!1;m.rootCenter.value.copy(E),m.rootNormal.value.copy(new t.Vector3(0,0,1).normalize()),C.stats.get("Loader concurrency").count=n.maxConcurrency,C.stats.get("Maximum mem usage").count=n.maximumMemoryUsage;let I=0,S=null,R=!0,O=null;const F=new t.Vector3(1/0,1/0,1/0);let D=null;d.updateMatrixWorld(!0);const G=(new t.Matrix4).copy(d.matrixWorld),L=(new t.Matrix4).copy(G).invert();function U(e){if(!e.boundingVolume.halfAxes)return;const n=e.boundingVolume.halfAxes,r=(new t.Matrix4).extractRotation(Wl(n)).premultiply((new t.Matrix4).extractRotation(L));if(!(new t.Euler).setFromRotationMatrix(r).equals(new t.Euler)){T=!0;const e=new t.Vector3(v.elements[12],v.elements[13],v.elements[14]);v.extractRotation(r),v.setPosition(e)}N()}function N(){w.copy(G),n.resetTransform&&w.multiply((new t.Matrix4).copy(v).invert()),C.modelMatrix=new ln(w.toArray())}function P(r,i,s,o){if(x||!o)return;if(!D){if(o instanceof t.PerspectiveCamera)D=new ur({fov:o.fov/180*Math.PI,aspectRatio:o.aspect,near:o.near,far:o.far}).sseDenominator;else if(o instanceof t.OrthographicCamera){const t=o.right-o.left,e=o.top-o.bottom,n=t/e;D=Math.max(e/s.height,t/(s.height*n))}n.debug&&console.log("Updated sse denonimator:",D)}const a=zl(o).planes.map((t=>new tr(t.normal.toArray(),t.constant))),c=new ir(a),h={camera:{position:F.toArray()},height:s.height*s.devicePixelRatio,frameNumber:r._frameNumber,sseDenominator:D,cullingVolume:c,viewport:{id:0}};r._cache.reset(),r._traverser.traverse(r.root,h,r.options);for(const t of r.tiles)t.selected?i[t.id]?i[t.id].visible=!0:console.error("TILE SELECTED BUT NOT LOADED!!",t.id):i[t.id]&&(i[t.id].visible=!1);for(;u.length>0;){const t=u.pop();i[t.id]&&0==t.contentState&&(d.remove(i[t.id]),mu(i[t.id]),delete i[t.id]),l[t.id]&&(mu(l[t.id]),f.remove(l[t.id]),delete l[t.id])}const m=r.stats.get("Tiles Loaded").count,p=r.stats.get("Tiles Loading").count;return e.onProgress&&e.onProgress(m,m+p),e.loadingManager&&!M&&0==p&&(null==n.preloadTilesCount||m>=n.preloadTilesCount)&&(M=!0,e.loadingManager.itemEnd(e.url)),h}return n.resetTransform&&U(C.root),n.debug&&(l[C.root.id].applyMatrix4(w),f.matrixWorld.copy(d.matrixWorld)),{model:d,runtime:{getTileset:()=>C,getStats:()=>C.stats,getDataAttributions:()=>_,showTiles:t=>{f.visible=t},setWireframe:e=>{n.wireframe=e,d.traverse((n=>{n instanceof t.Mesh&&(n.material.wireframe=e)}))},setDebug:t=>{n.debug=t,f.visible=t},setShading:t=>{n.shading=t},getTileBoxes:()=>f,setViewDistanceScale:t=>{C.options.viewDistanceScale=t,C._frameNumber++,P(C,h,i,O)},setMaximumScreenSpaceError:t=>{C.options.maximumScreenSpaceError=t,C._frameNumber++,P(C,h,i,O)},setHideGround:t=>{m.hideGround.value=t},setPointCloudColoring:t=>{m.coloring.value=t},setElevationRange:t=>{m.elevationRange.value.set(t[0],t[1])},setMaxIntensity:t=>{m.maxIntensity.value=t},setIntensityContrast:t=>{m.intensityContrast.value=t},setPointAlpha:t=>{m.alpha.value=t},getLatLongHeightFromPosition:e=>{const n=C.ellipsoid.cartesianToCartographic((new t.Vector3).copy(e).applyMatrix4((new t.Matrix4).copy(w).invert()).toArray());return{lat:n[1],long:n[0],height:n[2]}},getPositionFromLatLongHeight:e=>{const n=C.ellipsoid.cartographicToCartesian([e.long,e.lat,e.height]);return new t.Vector3(...n).applyMatrix4(w)},orientToGeocoord:e=>{const n=[e.long,e.lat,e.height],r=C.ellipsoid.cartographicToCartesian(n),i=(new t.Matrix4).fromArray(C.ellipsoid.eastNorthUpToFixedFrame(r)),s=(new t.Matrix4).makeRotationFromEuler(new t.Euler(Math.PI/2,Math.PI/2,0));!function(e){const n=new t.Vector3,r=new t.Quaternion,i=new t.Vector3;e.decompose(n,r,i),d.position.copy(n),d.quaternion.copy(r),d.scale.copy(i),d.updateMatrix(),d.updateMatrixWorld(!0),G.copy(d.matrixWorld),L.copy(G).invert(),N()}((new t.Matrix4).copy(i).multiply(s).invert())},getWebMercatorCoord:e=>function(e,n){const r=2*Math.PI*6378137/2,i=n*r/180;let s=Math.log(Math.tan((90+e)*Math.PI/360))/(Math.PI/180);return s=s*r/180,new t.Vector2(i,s)}(e.lat,e.long),getCameraFrustum:e=>{const n=zl(e).planes.map((t=>new tr(t.normal.toArray(),t.constant))).map((e=>function(e){const n=new t.Group,r=new t.PlaneGeometry(10,5),i=new t.Vector3(...e.projectPointOntoPlane([0,0,0])),s=new t.Vector3(e.normal.x,e.normal.y,e.normal.z),o=(new t.Vector3).copy(i).add(s);r.lookAt(o),r.translate(i.x,i.y,i.z);const a=new t.MeshBasicMaterial({color:65535,side:t.DoubleSide}),c=new t.Mesh(r,a),h=new t.ArrowHelper(s,i,5,16776960);return n.add(h),n.add(c),n}(e))),r=new t.Group;for(const t of n)r.add(t);return r},overlayGeoJSON:(e,n)=>{if(e.applyMatrix4(w),e.updateMatrixWorld(),!s)throw new Error("GeoJSON draping requires a renderer reference via LoaderProps");return function(e,n,r,i=eu){Xl&&Xl.dispose(),Zl||(Zl=r);const s={...eu,...i};Xl=new t.WebGLRenderTarget(e.width*e.devicePixelRatio,e.height*e.devicePixelRatio),Xl.texture.minFilter=t.NearestFilter,Xl.texture.magFilter=t.NearestFilter,Xl.stencilBuffer=!1,Xl.texture.format=t.RGBAFormat,Xl.texture.type=t.FloatType,Zl.setPixelRatio(devicePixelRatio),Zl.setSize(e.width,e.height),Zl.setRenderTarget(Xl),$l=new t.Scene,$l.overrideMaterial=ru,tu=n,ou.uniforms.tPosition.value=Xl.texture,ou.uniforms.minHeight.value=s.minHeight,ou.uniforms.maxHeight.value=s.maxHeight,ou.uniforms.samples.value=s.samples,ou.uniforms.sampleStep.value=s.sampleStep,ou.uniforms.opacity.value=s.opacity,ou.blending=s.blendingType}(i,d,s,n),e.material.dispose(),e.material=ou,e},setViewport:t=>{i=t,D=null,R=!0,Xl&&function(t){Xl.setSize(t.width*t.devicePixelRatio,t.height*t.devicePixelRatio),Zl.setPixelRatio(devicePixelRatio),Zl.setSize(t.width,t.height)}(i)},setRenderer:t=>{s=t},update:function(e,r){if(O=r,I+=e,Xl&&function(t){if(Zl){const e=tu.parent;$l.add(tu),Zl.setRenderTarget(Xl),Zl.render($l,t),e&&e.add(tu),Zl.setRenderTarget(null)}}(r),C&&I>=o){if(!G.equals(d.matrixWorld)){I=0,G.copy(d.matrixWorld),n.updateTransforms&&N();const e=(new t.Vector3).setFromMatrixPosition(G);m.rootCenter.value.copy(e),m.rootNormal.value.copy(new t.Vector3(0,0,1).applyMatrix4(G).normalize()),L.copy(G).invert(),n.debug&&(l[C.root.id].matrixWorld.copy(w),l[C.root.id].applyMatrix4(G))}null==S?S=(new t.Matrix4).copy(r.matrixWorld):(R||function(e,n,r){const i=!e.matrixWorld.equals(n);return e instanceof t.PerspectiveCamera?i||void 0!==e.aspect:i}(r,S))&&(I=0,R=!1,C._frameNumber++,r.getWorldPosition(F),S.copy(r.matrixWorld),P(C,h,i,r))}},dispose:function(){for(x=!0,C._destroy();d.children.length>0;){const t=d.children[0];mu(t),d.remove(t)}for(;f.children.length>0;){const t=f.children[0];f.remove(t),t.geometry.dispose(),t.material.dispose()}A&&A.dispose(),y&&y.dispose()}}}}static async loadGeoJSON(e){const{url:n,height:r,featureToColor:i}=e;return he(n,Uh,{worker:!1,gis:{format:"binary"}}).then((e=>{const n=e,s=new t.BufferGeometry,o=n.polygons.positions.value.reduce(((t,e,n,i)=>{if(n%2==0){const s=[e,i[n+1],r??0],o=Hn.WGS84.cartographicToCartesian(s);t.push(...o)}return t}),[]);if(s.setAttribute("position",new t.Float32BufferAttribute(o,3)),i){const e=n.polygons.numericProps[i.feature].value.reduce(((t,e,n,r)=>{const s=i.colorMap(e);return t[3*n]=s.r,t[3*n+1]=s.g,t[3*n+2]=s.b,t}),[]);s.setAttribute("color",new t.Float32BufferAttribute(e,3))}s.setIndex(new t.BufferAttribute(n.polygons.triangles.value,1));const a=new t.MeshBasicMaterial({transparent:!0,vertexColors:!0,opacity:.5,blending:t.NormalBlending});return new t.Mesh(s,a)}))}}.load({url:this.data.url,renderer:this.el.sceneEl.renderer,options:{googleApiKey:this.data.googleApiKey,cesiumIONToken:this.data.cesiumIONToken,dracoDecoderPath:"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/draco",basisTranscoderPath:"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/libs/basis",maximumScreenSpaceError:this.data.maximumSSE,maximumMemoryUsage:this.data.maximumMem,memoryCacheOverflow:128,pointCloudColoring:e,viewDistanceScale:this.data.distanceScale,wireframe:this.data.wireframe,updateTransforms:!0},viewport:this.viewport})},_initStats:function(){const t=document.createElement("a-entity");return this.el.sceneEl.appendChild(t),t.setAttribute("position","-0.5 0 -1"),t.setAttribute("textarea",{cols:30,rows:15,text:"",color:"white",disabledBackgroundColor:"#0c1e2c",disabled:!0}),t},_nextFrame:async function(){return new Promise(((t,e)=>{setTimeout((()=>{t()}),0)}))}})})(),i})())); \ No newline at end of file diff --git a/index.js b/index.js index 3932fb3e..d4d521c0 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -import { Loader3DTiles, PointCloudColoring } from 'three-loader-3dtiles'; +import { Loader3DTiles, PointCloudColoring } from './lib/three-loader-3dtiles'; import './textarea'; import { Vector3 } from 'three'; diff --git a/lib/three-loader-3dtiles.js b/lib/three-loader-3dtiles.js new file mode 100644 index 00000000..9f5fce2f --- /dev/null +++ b/lib/three-loader-3dtiles.js @@ -0,0 +1,13550 @@ +import { CanvasTexture as Kc, LinearFilter as zc, RepeatWrapping as kr, Frustum as Wc, Matrix4 as tt, Group as En, PlaneGeometry as Xc, Vector3 as rt, MeshBasicMaterial as Hs, DoubleSide as jo, Mesh as Js, ArrowHelper as Qc, Color as w, BoxGeometry as qc, EdgesGeometry as Yc, LineSegments as $c, LineBasicMaterial as Zc, Vector2 as ko, ShaderMaterial as lr, NormalBlending as hr, WebGLRenderTarget as tu, NearestFilter as Kr, RGBAFormat as eu, FloatType as nu, Scene as su, WebGLRenderer as ru, Euler as rs, BufferGeometry as Ko, Float32BufferAttribute as Sn, BufferAttribute as zo, PerspectiveCamera as Wo, OrthographicCamera as iu, Quaternion as ou, Uint8BufferAttribute as zr, Points as au } from 'three'; +import { GLTFLoader as cu } from 'three/examples/jsm/loaders/GLTFLoader.js'; +import { DRACOLoader as uu } from 'three/examples/jsm/loaders/DRACOLoader.js'; +import { KTX2Loader as lu } from 'three/examples/jsm/loaders/KTX2Loader.js'; +const jc = Object.defineProperty; +const kc = (e, t, n) => t in e ? jc(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; +const p = (e, t, n) => (kc(e, typeof t !== 'symbol' ? t + '' : t, n), n); +async function Ke (e, t, n, s) { + return s._parse(e, t, n, s); +} +function z (e, t) { + if (!e) { throw new Error(t || 'loader assertion failed.'); } +} +const kn = !!(typeof process !== 'object' || String(process) !== '[object process]' || process.browser); const Wr = typeof process < 'u' && process.version && /v([0-9]*)/.exec(process.version); +Wr && parseFloat(Wr[1]); +function hu (e, t) { + return Xo(e || {}, t); +} +function Xo (e, t) { + const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; + if (n > 3) { return t; } + const s = { + ...e + }; + for (const [r, i] of Object.entries(t)) { i && typeof i === 'object' && !Array.isArray(i) ? s[r] = Xo(s[r] || {}, t[r], n + 1) : s[r] = t[r]; } + return s; +} +const fu = 'latest'; +function du () { + let e; + return (e = globalThis._loadersgl_) !== null && e !== void 0 && e.version || (globalThis._loadersgl_ = globalThis._loadersgl_ || {}, globalThis._loadersgl_.version = '4.1.1'), globalThis._loadersgl_.version; +} +const Qo = du(); +function Jt (e, t) { + if (!e) { throw new Error(t || 'loaders.gl assertion failed.'); } +} +const bt = typeof process !== 'object' || String(process) !== '[object process]' || process.browser; const fr = typeof importScripts === 'function'; const mu = typeof window < 'u' && typeof window.orientation < 'u'; const Xr = typeof process < 'u' && process.version && /v([0-9]*)/.exec(process.version); +Xr && parseFloat(Xr[1]); +class gu { + constructor (t, n) { + this.name = void 0, this.workerThread = void 0, this.isRunning = !0, this.result = void 0, this._resolve = () => { + }, this._reject = () => { + }, this.name = t, this.workerThread = n, this.result = new Promise((s, r) => { + this._resolve = s, this._reject = r; + }); + } + + postMessage (t, n) { + this.workerThread.postMessage({ + source: 'loaders.gl', + type: t, + payload: n + }); + } + + done (t) { + Jt(this.isRunning), this.isRunning = !1, this._resolve(t); + } + + error (t) { + Jt(this.isRunning), this.isRunning = !1, this._reject(t); + } +} +class is { + terminate () { + } +} +const os = /* @__PURE__ */ new Map(); +function Au (e) { + Jt(e.source && !e.url || !e.source && e.url); + let t = os.get(e.source || e.url); + return t || (e.url && (t = pu(e.url), os.set(e.url, t)), e.source && (t = qo(e.source), os.set(e.source, t))), Jt(t), t; +} +function pu (e) { + if (!e.startsWith('http')) { return e; } + const t = yu(e); + return qo(t); +} +function qo (e) { + const t = new Blob([e], { + type: 'application/javascript' + }); + return URL.createObjectURL(t); +} +function yu (e) { + return `try { + importScripts('${e}'); +} catch (error) { + console.error(error); + throw error; +}`; +} +function Yo (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0; const n = arguments.length > 2 ? arguments[2] : void 0; + const s = n || /* @__PURE__ */ new Set(); + if (e) { + if (Qr(e)) { s.add(e); } else if (Qr(e.buffer)) { s.add(e.buffer); } else if (!ArrayBuffer.isView(e)) { + if (t && typeof e === 'object') { + for (const r in e) { Yo(e[r], t, s); } + } + } + } + return n === void 0 ? Array.from(s) : []; +} +function Qr (e) { + return e ? e instanceof ArrayBuffer || typeof MessagePort < 'u' && e instanceof MessagePort || typeof ImageBitmap < 'u' && e instanceof ImageBitmap || typeof OffscreenCanvas < 'u' && e instanceof OffscreenCanvas : !1; +} +const as = () => { +}; +class Vs { + static isSupported () { + return typeof Worker < 'u' && bt || typeof is < 'u' && !bt; + } + + constructor (t) { + this.name = void 0, this.source = void 0, this.url = void 0, this.terminated = !1, this.worker = void 0, this.onMessage = void 0, this.onError = void 0, this._loadableURL = ''; + const { + name: n, + source: s, + url: r + } = t; + Jt(s || r), this.name = n, this.source = s, this.url = r, this.onMessage = as, this.onError = (i) => console.log(i), this.worker = bt ? this._createBrowserWorker() : this._createNodeWorker(); + } + + destroy () { + this.onMessage = as, this.onError = as, this.worker.terminate(), this.terminated = !0; + } + + get isRunning () { + return !!this.onMessage; + } + + postMessage (t, n) { + n = n || Yo(t), this.worker.postMessage(t, n); + } + + _getErrorFromErrorEvent (t) { + let n = 'Failed to load '; + return n += `worker ${this.name} from ${this.url}. `, t.message && (n += `${t.message} in `), t.lineno && (n += `:${t.lineno}:${t.colno}`), new Error(n); + } + + _createBrowserWorker () { + this._loadableURL = Au({ + source: this.source, + url: this.url + }); + const t = new Worker(this._loadableURL, { + name: this.name + }); + return t.onmessage = (n) => { + n.data ? this.onMessage(n.data) : this.onError(new Error('No data received')); + }, t.onerror = (n) => { + this.onError(this._getErrorFromErrorEvent(n)), this.terminated = !0; + }, t.onmessageerror = (n) => console.error(n), t; + } + + _createNodeWorker () { + let t; + if (this.url) { + const s = this.url.includes(':/') || this.url.startsWith('/') ? this.url : `./${this.url}`; + t = new is(s, { + eval: !1 + }); + } else if (this.source) { + t = new is(this.source, { + eval: !0 + }); + } else { throw new Error('no worker'); } + return t.on('message', (n) => { + this.onMessage(n); + }), t.on('error', (n) => { + this.onError(n); + }), t.on('exit', (n) => { + }), t; + } +} +class Bu { + static isSupported () { + return Vs.isSupported(); + } + + constructor (t) { + this.name = 'unnamed', this.source = void 0, this.url = void 0, this.maxConcurrency = 1, this.maxMobileConcurrency = 1, this.onDebug = () => { + }, this.reuseWorkers = !0, this.props = {}, this.jobQueue = [], this.idleQueue = [], this.count = 0, this.isDestroyed = !1, this.source = t.source, this.url = t.url, this.setProps(t); + } + + destroy () { + this.idleQueue.forEach((t) => t.destroy()), this.isDestroyed = !0; + } + + setProps (t) { + this.props = { + ...this.props, + ...t + }, t.name !== void 0 && (this.name = t.name), t.maxConcurrency !== void 0 && (this.maxConcurrency = t.maxConcurrency), t.maxMobileConcurrency !== void 0 && (this.maxMobileConcurrency = t.maxMobileConcurrency), t.reuseWorkers !== void 0 && (this.reuseWorkers = t.reuseWorkers), t.onDebug !== void 0 && (this.onDebug = t.onDebug); + } + + async startJob (t) { + const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (i, o, a) => i.done(a); const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : (i, o) => i.error(o); + const r = new Promise((i) => (this.jobQueue.push({ + name: t, + onMessage: n, + onError: s, + onStart: i + }), this)); + return this._startQueuedJob(), await r; + } + + async _startQueuedJob () { + if (!this.jobQueue.length) { return; } + const t = this._getAvailableWorker(); + if (!t) { return; } + const n = this.jobQueue.shift(); + if (n) { + this.onDebug({ + message: 'Starting job', + name: n.name, + workerThread: t, + backlog: this.jobQueue.length + }); + const s = new gu(n.name, t); + t.onMessage = (r) => n.onMessage(s, r.type, r.payload), t.onError = (r) => n.onError(s, r), n.onStart(s); + try { + await s.result; + } catch (r) { + console.error(`Worker exception: ${r}`); + } finally { + this.returnWorkerToQueue(t); + } + } + } + + returnWorkerToQueue (t) { + !bt || this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency() ? (t.destroy(), this.count--) : this.idleQueue.push(t), this.isDestroyed || this._startQueuedJob(); + } + + _getAvailableWorker () { + if (this.idleQueue.length > 0) { return this.idleQueue.shift() || null; } + if (this.count < this._getMaxConcurrency()) { + this.count++; + const t = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`; + return new Vs({ + name: t, + source: this.source, + url: this.url + }); + } + return null; + } + + _getMaxConcurrency () { + return mu ? this.maxMobileConcurrency : this.maxConcurrency; + } +} +const Cu = { + maxConcurrency: 3, + maxMobileConcurrency: 1, + reuseWorkers: !0, + onDebug: () => { + } +}; +class Nt { + static isSupported () { + return Vs.isSupported(); + } + + static getWorkerFarm () { + const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + return Nt._workerFarm = Nt._workerFarm || new Nt({}), Nt._workerFarm.setProps(t), Nt._workerFarm; + } + + constructor (t) { + this.props = void 0, this.workerPools = /* @__PURE__ */ new Map(), this.props = { + ...Cu + }, this.setProps(t), this.workerPools = /* @__PURE__ */ new Map(); + } + + destroy () { + for (const t of this.workerPools.values()) { t.destroy(); } + this.workerPools = /* @__PURE__ */ new Map(); + } + + setProps (t) { + this.props = { + ...this.props, + ...t + }; + for (const n of this.workerPools.values()) { n.setProps(this._getWorkerPoolProps()); } + } + + getWorkerPool (t) { + const { + name: n, + source: s, + url: r + } = t; + let i = this.workerPools.get(n); + return i || (i = new Bu({ + name: n, + source: s, + url: r + }), i.setProps(this._getWorkerPoolProps()), this.workerPools.set(n, i)), i; + } + + _getWorkerPoolProps () { + return { + maxConcurrency: this.props.maxConcurrency, + maxMobileConcurrency: this.props.maxMobileConcurrency, + reuseWorkers: this.props.reuseWorkers, + onDebug: this.props.onDebug + }; + } +} +Nt._workerFarm = void 0; +function Eu (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + const n = t[e.id] || {}; const s = bt ? `${e.id}-worker.js` : `${e.id}-worker-node.js`; + let r = n.workerUrl; + if (!r && e.id === 'compression' && (r = t.workerUrl), t._workerType === 'test' && (bt ? r = `modules/${e.module}/dist/${s}` : r = `modules/${e.module}/src/workers/${e.id}-worker-node.ts`), !r) { + let i = e.version; + i === 'latest' && (i = fu); + const o = i ? `@${i}` : ''; + r = `https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${s}`; + } + return Jt(r), r; +} +function Tu (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Qo; + Jt(e, 'no worker provided'); + const n = e.version; + return !(!t || !n); +} +const bu = {}; const _u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: bu +}, Symbol.toStringTag, { value: 'Module' })); const cs = {}; +async function Zt (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; const s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null; + return t && (e = wu(e, t, n, s)), cs[e] = cs[e] || Ru(e), await cs[e]; +} +function wu (e, t) { + const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null; + if (!n.useLocalLibraries && e.startsWith('http')) { return e; } + s = s || e; + const r = n.modules || {}; + return r[s] ? r[s] : bt ? n.CDN ? (Jt(n.CDN.startsWith('http')), `${n.CDN}/${t}@${Qo}/dist/libs/${s}`) : fr ? `../src/libs/${s}` : `modules/${t}/src/libs/${s}` : `modules/${t}/dist/libs/${s}`; +} +async function Ru (e) { + if (e.endsWith('wasm')) { return await Su(e); } + if (!bt) { + try { + return _u && void 0; + } catch (n) { + return console.error(n), null; + } + } + if (fr) { return importScripts(e); } + const t = await Iu(e); + return Mu(t, e); +} +function Mu (e, t) { + if (!bt) { return; } + if (fr) { return eval.call(globalThis, e), null; } + const n = document.createElement('script'); + n.id = t; + try { + n.appendChild(document.createTextNode(e)); + } catch { + n.text = e; + } + return document.body.appendChild(n), null; +} +async function Su (e) { + return await (await fetch(e)).arrayBuffer(); +} +async function Iu (e) { + return await (await fetch(e)).text(); +} +function xu (e, t) { + return !Nt.isSupported() || !bt && !(t != null && t._nodeWorkers) ? !1 : e.worker && (t == null ? void 0 : t.worker); +} +async function vu (e, t, n, s, r) { + const i = e.id; const o = Eu(e, n); const c = Nt.getWorkerFarm(n).getWorkerPool({ + name: i, + url: o + }); + n = JSON.parse(JSON.stringify(n)), s = JSON.parse(JSON.stringify(s || {})); + const u = await c.startJob('process-on-worker', Ou.bind(null, r)); + return u.postMessage('process', { + input: t, + options: n, + context: s + }), await (await u.result).result; +} +async function Ou (e, t, n, s) { + switch (n) { + case 'done': + t.done(s); + break; + case 'error': + t.error(new Error(s.error)); + break; + case 'process': + const { + id: r, + input: i, + options: o + } = s; + try { + const a = await e(i, o); + t.postMessage('done', { + id: r, + result: a + }); + } catch (a) { + const c = a instanceof Error ? a.message : 'unknown error'; + t.postMessage('error', { + id: r, + error: c + }); + } + break; + default: + console.warn(`parse-with-worker unknown message ${n}`); + } +} +function Fu (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 5; + return typeof e === 'string' ? e.slice(0, t) : ArrayBuffer.isView(e) ? qr(e.buffer, e.byteOffset, t) : e instanceof ArrayBuffer ? qr(e, 0, t) : ''; +} +function qr (e, t, n) { + if (e.byteLength <= t + n) { return ''; } + const s = new DataView(e); + let r = ''; + for (let i = 0; i < n; i++) { r += String.fromCharCode(s.getUint8(t + i)); } + return r; +} +function Du (e) { + try { + return JSON.parse(e); + } catch { + throw new Error(`Failed to parse JSON from data starting with "${Fu(e)}"`); + } +} +function Lu (e, t, n) { + if (n = n || e.byteLength, e.byteLength < n || t.byteLength < n) { return !1; } + const s = new Uint8Array(e); const r = new Uint8Array(t); + for (let i = 0; i < s.length; ++i) { + if (s[i] !== r[i]) { return !1; } + } + return !0; +} +function Pu () { + for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) { t[n] = arguments[n]; } + return Gu(t); +} +function Gu (e) { + const t = e.map((i) => i instanceof ArrayBuffer ? new Uint8Array(i) : i); const n = t.reduce((i, o) => i + o.byteLength, 0); const s = new Uint8Array(n); + let r = 0; + for (const i of t) { s.set(i, r), r += i.byteLength; } + return s.buffer; +} +function dr (e, t, n) { + const s = n !== void 0 ? new Uint8Array(e).subarray(t, t + n) : new Uint8Array(e).subarray(t); + return new Uint8Array(s).buffer; +} +function ze (e, t) { + return z(e >= 0), z(t > 0), e + (t - 1) & ~(t - 1); +} +function Nu (e, t, n) { + let s; + if (e instanceof ArrayBuffer) { s = new Uint8Array(e); } else { + const r = e.byteOffset; const i = e.byteLength; + s = new Uint8Array(e.buffer || e.arrayBuffer, r, i); + } + return t.set(s, n), n + ze(s.byteLength, 4); +} +async function Uu (e) { + const t = []; + for await (const n of e) { t.push(n); } + return Pu(...t); +} +function Yr () { + let e; + if (typeof window < 'u' && window.performance) { e = window.performance.now(); } else if (typeof process < 'u' && process.hrtime) { + const t = process.hrtime(); + e = t[0] * 1e3 + t[1] / 1e6; + } else { e = Date.now(); } + return e; +} +class $r { + constructor (t, n) { + this.name = void 0, this.type = void 0, this.sampleSize = 1, this.time = 0, this.count = 0, this.samples = 0, this.lastTiming = 0, this.lastSampleTime = 0, this.lastSampleCount = 0, this._count = 0, this._time = 0, this._samples = 0, this._startTime = 0, this._timerPending = !1, this.name = t, this.type = n, this.reset(); + } + + reset () { + return this.time = 0, this.count = 0, this.samples = 0, this.lastTiming = 0, this.lastSampleTime = 0, this.lastSampleCount = 0, this._count = 0, this._time = 0, this._samples = 0, this._startTime = 0, this._timerPending = !1, this; + } + + setSampleSize (t) { + return this.sampleSize = t, this; + } + + incrementCount () { + return this.addCount(1), this; + } + + decrementCount () { + return this.subtractCount(1), this; + } + + addCount (t) { + return this._count += t, this._samples++, this._checkSampling(), this; + } + + subtractCount (t) { + return this._count -= t, this._samples++, this._checkSampling(), this; + } + + addTime (t) { + return this._time += t, this.lastTiming = t, this._samples++, this._checkSampling(), this; + } + + timeStart () { + return this._startTime = Yr(), this._timerPending = !0, this; + } + + timeEnd () { + return this._timerPending ? (this.addTime(Yr() - this._startTime), this._timerPending = !1, this._checkSampling(), this) : this; + } + + getSampleAverageCount () { + return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0; + } + + getSampleAverageTime () { + return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0; + } + + getSampleHz () { + return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0; + } + + getAverageCount () { + return this.samples > 0 ? this.count / this.samples : 0; + } + + getAverageTime () { + return this.samples > 0 ? this.time / this.samples : 0; + } + + getHz () { + return this.time > 0 ? this.samples / (this.time / 1e3) : 0; + } + + _checkSampling () { + this._samples === this.sampleSize && (this.lastSampleTime = this._time, this.lastSampleCount = this._count, this.count += this._count, this.time += this._time, this.samples += this._samples, this._time = 0, this._count = 0, this._samples = 0); + } +} +class $o { + constructor (t) { + this.id = void 0, this.stats = {}, this.id = t.id, this.stats = {}, this._initializeStats(t.stats), Object.seal(this); + } + + get (t) { + const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'count'; + return this._getOrCreate({ + name: t, + type: n + }); + } + + get size () { + return Object.keys(this.stats).length; + } + + reset () { + for (const t of Object.values(this.stats)) { t.reset(); } + return this; + } + + forEach (t) { + for (const n of Object.values(this.stats)) { t(n); } + } + + getTable () { + const t = {}; + return this.forEach((n) => { + t[n.name] = { + time: n.time || 0, + count: n.count || 0, + average: n.getAverageTime() || 0, + hz: n.getHz() || 0 + }; + }), t; + } + + _initializeStats () { + (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).forEach((n) => this._getOrCreate(n)); + } + + _getOrCreate (t) { + const { + name: n, + type: s + } = t; + let r = this.stats[n]; + return r || (t instanceof $r ? r = t : r = new $r(n, s), this.stats[n] = r), r; + } +} +const Hu = ''; +const Zr = {}; +function Ju (e) { + for (const t in Zr) { + if (e.startsWith(t)) { + const n = Zr[t]; + e = e.replace(t, n); + } + } + return !e.startsWith('http://') && !e.startsWith('https://') && (e = `${Hu}${e}`), e; +} +function Vu (e) { + return e && typeof e === 'object' && e.isBuffer; +} +function Zo (e) { + if (Vu(e)) { return e; } + if (e instanceof ArrayBuffer) { return e; } + if (ArrayBuffer.isView(e)) { return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength ? e.buffer : e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength); } + if (typeof e === 'string') { + const t = e; + return new TextEncoder().encode(t).buffer; + } + if (e && typeof e === 'object' && e._toArrayBuffer) { return e._toArrayBuffer(); } + throw new Error('toArrayBuffer'); +} +function ju () { + let e; + if (typeof process < 'u' && typeof process.cwd < 'u') { return process.cwd(); } + const t = (e = window.location) === null || e === void 0 ? void 0 : e.pathname; + return (t == null ? void 0 : t.slice(0, t.lastIndexOf('/') + 1)) || ''; +} +function ta (e) { + const t = e ? e.lastIndexOf('/') : -1; + return t >= 0 ? e.substr(t + 1) : ''; +} +function ea (e) { + const t = e ? e.lastIndexOf('/') : -1; + return t >= 0 ? e.substr(0, t) : ''; +} +function ku () { + const e = []; + for (let r = 0; r < arguments.length; r++) { e[r] = r < 0 || arguments.length <= r ? void 0 : arguments[r]; } + let t = ''; let n = !1; let s; + for (let r = e.length - 1; r >= -1 && !n; r--) { + let i; + r >= 0 ? i = e[r] : (s === void 0 && (s = ju()), i = s), i.length !== 0 && (t = `${i}/${t}`, n = i.charCodeAt(0) === Ie); + } + return t = Ku(t, !n), n ? `/${t}` : t.length > 0 ? t : '.'; +} +const Ie = 47; const us = 46; +function Ku (e, t) { + let n = ''; let s = -1; let r = 0; let i; let o = !1; + for (let a = 0; a <= e.length; ++a) { + if (a < e.length) { i = e.charCodeAt(a); } else { + if (i === Ie) { break; } + i = Ie; + } + if (i === Ie) { + if (!(s === a - 1 || r === 1)) { + if (s !== a - 1 && r === 2) { + if (n.length < 2 || !o || n.charCodeAt(n.length - 1) !== us || n.charCodeAt(n.length - 2) !== us) { + if (n.length > 2) { + const c = n.length - 1; + let u = c; + for (; u >= 0 && n.charCodeAt(u) !== Ie; --u) + ; + if (u !== c) { + n = u === -1 ? '' : n.slice(0, u), s = a, r = 0, o = !1; + continue; + } + } else if (n.length === 2 || n.length === 1) { + n = '', s = a, r = 0, o = !1; + continue; + } + } + t && (n.length > 0 ? n += '/..' : n = '..', o = !0); + } else { + const c = e.slice(s + 1, a); + n.length > 0 ? n += `/${c}` : n = c, o = !1; + } + } + s = a, r = 0; + } else { i === us && r !== -1 ? ++r : r = -1; } + } + return n; +} +const zu = (e) => typeof e === 'boolean'; const ve = (e) => typeof e === 'function'; const We = (e) => e !== null && typeof e === 'object'; const ti = (e) => We(e) && e.constructor === {}.constructor; const Wu = (e) => !!e && typeof e[Symbol.iterator] === 'function'; const Xu = (e) => e && typeof e[Symbol.asyncIterator] === 'function'; const se = (e) => typeof Response < 'u' && e instanceof Response || e && e.arrayBuffer && e.text && e.json; const re = (e) => typeof Blob < 'u' && e instanceof Blob; const Qu = (e) => e && typeof e === 'object' && e.isBuffer; const qu = (e) => typeof ReadableStream < 'u' && e instanceof ReadableStream || We(e) && ve(e.tee) && ve(e.cancel) && ve(e.getReader); const Yu = (e) => We(e) && ve(e.read) && ve(e.pipe) && zu(e.readable); const na = (e) => qu(e) || Yu(e); const $u = /^data:([-\w.]+\/[-\w.+]+)(;|,)/; const Zu = /^([-\w.]+\/[-\w.+]+)/; +function tl (e) { + const t = Zu.exec(e); + return t ? t[1] : e; +} +function ei (e) { + const t = $u.exec(e); + return t ? t[1] : ''; +} +const sa = /\?.*/; +function el (e) { + const t = e.match(sa); + return t && t[0]; +} +function mr (e) { + return e.replace(sa, ''); +} +function Kn (e) { + return se(e) ? e.url : re(e) ? e.name || '' : typeof e === 'string' ? e : ''; +} +function gr (e) { + if (se(e)) { + const t = e; const n = t.headers.get('content-type') || ''; const s = mr(t.url); + return tl(n) || ei(s); + } + return re(e) ? e.type || '' : typeof e === 'string' ? ei(e) : ''; +} +function nl (e) { + return se(e) ? e.headers['content-length'] || -1 : re(e) ? e.size : typeof e === 'string' ? e.length : e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? e.byteLength : -1; +} +async function ra (e) { + if (se(e)) { return e; } + const t = {}; const n = nl(e); + n >= 0 && (t['content-length'] = String(n)); + const s = Kn(e); const r = gr(e); + r && (t['content-type'] = r); + const i = await il(e); + i && (t['x-first-bytes'] = i), typeof e === 'string' && (e = new TextEncoder().encode(e)); + const o = new Response(e, { + headers: t + }); + return Object.defineProperty(o, 'url', { + value: s + }), o; +} +async function sl (e) { + if (!e.ok) { + const t = await rl(e); + throw new Error(t); + } +} +async function rl (e) { + let t = `Failed to fetch resource ${e.url} (${e.status}): `; + try { + const n = e.headers.get('Content-Type'); + let s = e.statusText; + n != null && n.includes('application/json') && (s += ` ${await e.text()}`), t += s, t = t.length > 60 ? `${t.slice(0, 60)}...` : t; + } catch { + } + return t; +} +async function il (e) { + if (typeof e === 'string') { return `data:,${e.slice(0, 5)}`; } + if (e instanceof Blob) { + const n = e.slice(0, 5); + return await new Promise((s) => { + const r = new FileReader(); + r.onload = (i) => { + let o; + return s(i == null || (o = i.target) === null || o === void 0 ? void 0 : o.result); + }, r.readAsDataURL(n); + }); + } + if (e instanceof ArrayBuffer) { + const n = e.slice(0, 5); + return `data:base64,${ol(n)}`; + } + return null; +} +function ol (e) { + let t = ''; + const n = new Uint8Array(e); + for (let s = 0; s < n.byteLength; s++) { t += String.fromCharCode(n[s]); } + return btoa(t); +} +function al (e) { + return !cl(e) && !ul(e); +} +function cl (e) { + return e.startsWith('http:') || e.startsWith('https:'); +} +function ul (e) { + return e.startsWith('data:'); +} +async function Ge (e, t) { + if (typeof e === 'string') { + const r = Ju(e); + if (al(r)) { + let n; + if ((n = globalThis.loaders) !== null && n !== void 0 && n.fetchNode) { + let s; + return (s = globalThis.loaders) === null || s === void 0 ? void 0 : s.fetchNode(r, t); + } + } + return await fetch(r, t); + } + return await ra(e); +} +function ll (e) { + if (typeof window < 'u' && typeof window.process === 'object' && window.process.type === 'renderer' || typeof process < 'u' && typeof process.versions === 'object' && process.versions.electron) { return !0; } + const t = typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent; const n = e || t; + return !!(n && n.indexOf('Electron') >= 0); +} +function Xe () { + return !(typeof process === 'object' && String(process) === '[object process]' && !process.browser) || ll(); +} +const Ze = globalThis.window || globalThis.self || globalThis.global; const Ee = globalThis.process || {}; const ia = typeof __VERSION__ < 'u' ? __VERSION__ : 'untranspiled source'; +Xe(); +function hl (e) { + try { + const t = window[e]; const n = '__storage_test__'; + return t.setItem(n, n), t.removeItem(n), t; + } catch { + return null; + } +} +class fl { + constructor (t, n) { + const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 'sessionStorage'; + this.storage = void 0, this.id = void 0, this.config = void 0, this.storage = hl(s), this.id = t, this.config = n, this._loadConfiguration(); + } + + getConfiguration () { + return this.config; + } + + setConfiguration (t) { + if (Object.assign(this.config, t), this.storage) { + const n = JSON.stringify(this.config); + this.storage.setItem(this.id, n); + } + } + + _loadConfiguration () { + let t = {}; + if (this.storage) { + const n = this.storage.getItem(this.id); + t = n ? JSON.parse(n) : {}; + } + return Object.assign(this.config, t), this; + } +} +function dl (e) { + let t; + return e < 10 ? t = ''.concat(e.toFixed(2), 'ms') : e < 100 ? t = ''.concat(e.toFixed(1), 'ms') : e < 1e3 ? t = ''.concat(e.toFixed(0), 'ms') : t = ''.concat((e / 1e3).toFixed(2), 's'), t; +} +function ml (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8; + const n = Math.max(t - e.length, 0); + return ''.concat(' '.repeat(n)).concat(e); +} +function ls (e, t, n) { + const s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600; + const r = e.src.replace(/\(/g, '%28').replace(/\)/g, '%29'); + e.width > s && (n = Math.min(n, s / e.width)); + const i = e.width * n; const o = e.height * n; const a = ['font-size:1px;', 'padding:'.concat(Math.floor(o / 2), 'px ').concat(Math.floor(i / 2), 'px;'), 'line-height:'.concat(o, 'px;'), 'background:url('.concat(r, ');'), 'background-size:'.concat(i, 'px ').concat(o, 'px;'), 'color:transparent;'].join(''); + return [''.concat(t, ' %c+'), a]; +} +let In; +(function (e) { + e[e.BLACK = 30] = 'BLACK', e[e.RED = 31] = 'RED', e[e.GREEN = 32] = 'GREEN', e[e.YELLOW = 33] = 'YELLOW', e[e.BLUE = 34] = 'BLUE', e[e.MAGENTA = 35] = 'MAGENTA', e[e.CYAN = 36] = 'CYAN', e[e.WHITE = 37] = 'WHITE', e[e.BRIGHT_BLACK = 90] = 'BRIGHT_BLACK', e[e.BRIGHT_RED = 91] = 'BRIGHT_RED', e[e.BRIGHT_GREEN = 92] = 'BRIGHT_GREEN', e[e.BRIGHT_YELLOW = 93] = 'BRIGHT_YELLOW', e[e.BRIGHT_BLUE = 94] = 'BRIGHT_BLUE', e[e.BRIGHT_MAGENTA = 95] = 'BRIGHT_MAGENTA', e[e.BRIGHT_CYAN = 96] = 'BRIGHT_CYAN', e[e.BRIGHT_WHITE = 97] = 'BRIGHT_WHITE'; +})(In || (In = {})); +const gl = 10; +function ni (e) { + return typeof e !== 'string' ? e : (e = e.toUpperCase(), In[e] || In.WHITE); +} +function Al (e, t, n) { + if (!Xe && typeof e === 'string') { + if (t) { + const s = ni(t); + e = '\x1B['.concat(s, 'm').concat(e, '\x1B[39m'); + } + if (n) { + const s = ni(n); + e = '\x1B['.concat(s + gl, 'm').concat(e, '\x1B[49m'); + } + } + return e; +} +function pl (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ['constructor']; + const n = Object.getPrototypeOf(e); const s = Object.getOwnPropertyNames(n); const r = e; + for (const i of s) { + const o = r[i]; + typeof o === 'function' && (t.find((a) => i === a) || (r[i] = o.bind(e))); + } +} +function xn (e, t) { + if (!e) { throw new Error(t || 'Assertion failed'); } +} +function ae () { + let e; + if (Xe() && Ze.performance) { + let t, n; + e = Ze == null || (t = Ze.performance) === null || t === void 0 || (n = t.now) === null || n === void 0 ? void 0 : n.call(t); + } else if ('hrtime' in Ee) { + let s; + const r = Ee == null || (s = Ee.hrtime) === null || s === void 0 ? void 0 : s.call(Ee); + e = r[0] * 1e3 + r[1] / 1e6; + } else { e = Date.now(); } + return e; +} +const ce = { + debug: Xe() && console.debug || console.log, + log: console.log, + info: console.info, + warn: console.warn, + error: console.error +}; const yl = { + enabled: !0, + level: 0 +}; +function Ct () { +} +const si = {}; const ri = { + once: !0 +}; +class zn { + constructor () { + const { + id: t + } = arguments.length > 0 && arguments[0] !== void 0 + ? arguments[0] + : { + id: '' + }; + this.id = void 0, this.VERSION = ia, this._startTs = ae(), this._deltaTs = ae(), this._storage = void 0, this.userData = {}, this.LOG_THROTTLE_TIMEOUT = 0, this.id = t, this.userData = {}, this._storage = new fl('__probe-'.concat(this.id, '__'), yl), this.timeStamp(''.concat(this.id, ' started')), pl(this), Object.seal(this); + } + + set level (t) { + this.setLevel(t); + } + + get level () { + return this.getLevel(); + } + + isEnabled () { + return this._storage.config.enabled; + } + + getLevel () { + return this._storage.config.level; + } + + getTotal () { + return Number((ae() - this._startTs).toPrecision(10)); + } + + getDelta () { + return Number((ae() - this._deltaTs).toPrecision(10)); + } + + set priority (t) { + this.level = t; + } + + get priority () { + return this.level; + } + + getPriority () { + return this.level; + } + + enable () { + const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0; + return this._storage.setConfiguration({ + enabled: t + }), this; + } + + setLevel (t) { + return this._storage.setConfiguration({ + level: t + }), this; + } + + get (t) { + return this._storage.config[t]; + } + + set (t, n) { + this._storage.setConfiguration({ + [t]: n + }); + } + + settings () { + console.table ? console.table(this._storage.config) : console.log(this._storage.config); + } + + assert (t, n) { + xn(t, n); + } + + warn (t) { + return this._getLogFunction(0, t, ce.warn, arguments, ri); + } + + error (t) { + return this._getLogFunction(0, t, ce.error, arguments); + } + + deprecated (t, n) { + return this.warn('`'.concat(t, '` is deprecated and will be removed in a later version. Use `').concat(n, '` instead')); + } + + removed (t, n) { + return this.error('`'.concat(t, '` has been removed. Use `').concat(n, '` instead')); + } + + probe (t, n) { + return this._getLogFunction(t, n, ce.log, arguments, { + time: !0, + once: !0 + }); + } + + log (t, n) { + return this._getLogFunction(t, n, ce.debug, arguments); + } + + info (t, n) { + return this._getLogFunction(t, n, console.info, arguments); + } + + once (t, n) { + return this._getLogFunction(t, n, ce.debug || ce.info, arguments, ri); + } + + table (t, n, s) { + return n + ? this._getLogFunction(t, n, console.table || Ct, s && [s], { + tag: Tl(n) + }) + : Ct; + } + + image (t) { + const { + logLevel: n, + priority: s, + image: r, + message: i = '', + scale: o = 1 + } = t; + return this._shouldLog(n || s) + ? Xe() + ? El({ + image: r, + message: i, + scale: o + }) + : Cl() + : Ct; + } + + time (t, n) { + return this._getLogFunction(t, n, console.time ? console.time : console.info); + } + + timeEnd (t, n) { + return this._getLogFunction(t, n, console.timeEnd ? console.timeEnd : console.info); + } + + timeStamp (t, n) { + return this._getLogFunction(t, n, console.timeStamp || Ct); + } + + group (t, n) { + const s = arguments.length > 2 && arguments[2] !== void 0 + ? arguments[2] + : { + collapsed: !1 + }; + const r = ii({ + logLevel: t, + message: n, + opts: s + }); const { + collapsed: i + } = s; + return r.method = (i ? console.groupCollapsed : console.group) || console.info, this._getLogFunction(r); + } + + groupCollapsed (t, n) { + const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; + return this.group(t, n, Object.assign({}, s, { + collapsed: !0 + })); + } + + groupEnd (t) { + return this._getLogFunction(t, '', console.groupEnd || Ct); + } + + withGroup (t, n, s) { + this.group(t, n)(); + try { + s(); + } finally { + this.groupEnd(t)(); + } + } + + trace () { + console.trace && console.trace(); + } + + _shouldLog (t) { + return this.isEnabled() && this.getLevel() >= oa(t); + } + + _getLogFunction (t, n, s, r, i) { + if (this._shouldLog(t)) { + i = ii({ + logLevel: t, + message: n, + args: r, + opts: i + }), s = s || i.method, xn(s), i.total = this.getTotal(), i.delta = this.getDelta(), this._deltaTs = ae(); + const o = i.tag || i.message; + if (i.once && o) { + if (!si[o]) { si[o] = ae(); } else { return Ct; } + } + return n = Bl(this.id, i.message, i), s.bind(console, n, ...i.args); + } + return Ct; + } +} +zn.VERSION = ia; +function oa (e) { + if (!e) { return 0; } + let t; + switch (typeof e) { + case 'number': + t = e; + break; + case 'object': + t = e.logLevel || e.priority || 0; + break; + default: + return 0; + } + return xn(Number.isFinite(t) && t >= 0), t; +} +function ii (e) { + const { + logLevel: t, + message: n + } = e; + e.logLevel = oa(t); + const s = e.args ? Array.from(e.args) : []; + for (; s.length && s.shift() !== n;) + ; + switch (typeof t) { + case 'string': + case 'function': + n !== void 0 && s.unshift(n), e.message = t; + break; + case 'object': + Object.assign(e, t); + break; + } + typeof e.message === 'function' && (e.message = e.message()); + const r = typeof e.message; + return xn(r === 'string' || r === 'object'), Object.assign(e, { + args: s + }, e.opts); +} +function Bl (e, t, n) { + if (typeof t === 'string') { + const s = n.time ? ml(dl(n.total)) : ''; + t = n.time ? ''.concat(e, ': ').concat(s, ' ').concat(t) : ''.concat(e, ': ').concat(t), t = Al(t, n.color, n.background); + } + return t; +} +function Cl (e) { + return console.warn('removed'), Ct; +} +function El (e) { + const { + image: t, + message: n = '', + scale: s = 1 + } = e; + if (typeof t === 'string') { + const i = new Image(); + return i.onload = () => { + const o = ls(i, n, s); + console.log(...o); + }, i.src = t, Ct; + } + const r = t.nodeName || ''; + if (r.toLowerCase() === 'img') { return console.log(...ls(t, n, s)), Ct; } + if (r.toLowerCase() === 'canvas') { + const i = new Image(); + return i.onload = () => console.log(...ls(i, n, s)), i.src = t.toDataURL(), Ct; + } + return Ct; +} +function Tl (e) { + for (const t in e) { + for (const n in e[t]) { return n || 'untitled'; } + } + return 'empty'; +} +const aa = new zn({ + id: '@probe.gl/log' +}); const oi = new zn({ + id: 'loaders.gl' +}); +class bl { + log () { + return () => { + }; + } + + info () { + return () => { + }; + } + + warn () { + return () => { + }; + } + + error () { + return () => { + }; + } +} +class _l { + constructor () { + this.console = void 0, this.console = console; + } + + log () { + for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) { n[s] = arguments[s]; } + return this.console.log.bind(this.console, ...n); + } + + info () { + for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) { n[s] = arguments[s]; } + return this.console.info.bind(this.console, ...n); + } + + warn () { + for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) { n[s] = arguments[s]; } + return this.console.warn.bind(this.console, ...n); + } + + error () { + for (var t = arguments.length, n = new Array(t), s = 0; s < t; s++) { n[s] = arguments[s]; } + return this.console.error.bind(this.console, ...n); + } +} +const ca = { + fetch: null, + mimeType: void 0, + nothrow: !1, + log: new _l(), + useLocalLibraries: !1, + CDN: 'https://unpkg.com/@loaders.gl', + worker: !0, + maxConcurrency: 3, + maxMobileConcurrency: 1, + reuseWorkers: kn, + _nodeWorkers: !1, + _workerType: '', + limit: 0, + _limitMB: 0, + batchSize: 'auto', + batchDebounceMs: 0, + metadata: !1, + transforms: [] +}; const wl = { + throws: 'nothrow', + dataType: '(no longer used)', + uri: 'baseUri', + method: 'fetch.method', + headers: 'fetch.headers', + body: 'fetch.body', + mode: 'fetch.mode', + credentials: 'fetch.credentials', + cache: 'fetch.cache', + redirect: 'fetch.redirect', + referrer: 'fetch.referrer', + referrerPolicy: 'fetch.referrerPolicy', + integrity: 'fetch.integrity', + keepalive: 'fetch.keepalive', + signal: 'fetch.signal' +}; +function ua () { + globalThis.loaders = globalThis.loaders || {}; + const { + loaders: e + } = globalThis; + return e._state = e._state || {}, e._state; +} +function la () { + const e = ua(); + return e.globalOptions = e.globalOptions || { + ...ca + }, e.globalOptions; +} +function Rl (e, t, n, s) { + return n = n || [], n = Array.isArray(n) ? n : [n], Ml(e, n), Il(t, e, s); +} +function Ml (e, t) { + ai(e, null, ca, wl, t); + for (const n of t) { + const s = e && e[n.id] || {}; const r = n.options && n.options[n.id] || {}; const i = n.deprecatedOptions && n.deprecatedOptions[n.id] || {}; + ai(s, n.id, r, i, t); + } +} +function ai (e, t, n, s, r) { + const i = t || 'Top level'; const o = t ? `${t}.` : ''; + for (const a in e) { + const c = !t && We(e[a]); const u = a === 'baseUri' && !t; const l = a === 'workerUrl' && t; + if (!(a in n) && !u && !l) { + if (a in s) { oi.warn(`${i} loader option '${o}${a}' no longer supported, use '${s[a]}'`)(); } else if (!c) { + const h = Sl(a, r); + oi.warn(`${i} loader option '${o}${a}' not recognized. ${h}`)(); + } + } + } +} +function Sl (e, t) { + const n = e.toLowerCase(); + let s = ''; + for (const r of t) { + for (const i in r.options) { + if (e === i) { return `Did you mean '${r.id}.${i}'?`; } + const o = i.toLowerCase(); + (n.startsWith(o) || o.startsWith(n)) && (s = s || `Did you mean '${r.id}.${i}'?`); + } + } + return s; +} +function Il (e, t, n) { + const r = { + ...e.options || {} + }; + return xl(r, n), r.log === null && (r.log = new bl()), ci(r, la()), ci(r, t), r; +} +function ci (e, t) { + for (const n in t) { + if (n in t) { + const s = t[n]; + ti(s) && ti(e[n]) + ? e[n] = { + ...e[n], + ...t[n] + } + : e[n] = t[n]; + } + } +} +function xl (e, t) { + t && !('baseUri' in e) && (e.baseUri = t); +} +function Ar (e) { + let t; + return e ? (Array.isArray(e) && (e = e[0]), Array.isArray((t = e) === null || t === void 0 ? void 0 : t.extensions)) : !1; +} +function ha (e) { + let t, n; + z(e, 'null loader'), z(Ar(e), 'invalid loader'); + let s; + return Array.isArray(e) && (s = e[1], e = e[0], e = { + ...e, + options: { + ...e.options, + ...s + } + }), ((t = e) !== null && t !== void 0 && t.parseTextSync || (n = e) !== null && n !== void 0 && n.parseText) && (e.text = !0), e.text || (e.binary = !0), e; +} +const vl = () => { + const e = ua(); + return e.loaderRegistry = e.loaderRegistry || [], e.loaderRegistry; +}; +function Ol () { + return vl(); +} +const Fl = new zn({ + id: 'loaders.gl' +}); const Dl = /\.([^.]+)$/; +async function Ll (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; const n = arguments.length > 2 ? arguments[2] : void 0; const s = arguments.length > 3 ? arguments[3] : void 0; + if (!fa(e)) { return null; } + let r = ui(e, t, { + ...n, + nothrow: !0 + }, s); + if (r) { return r; } + if (re(e) && (e = await e.slice(0, 10).arrayBuffer(), r = ui(e, t, n, s)), !r && !(n != null && n.nothrow)) { throw new Error(da(e)); } + return r; +} +function ui (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; const n = arguments.length > 2 ? arguments[2] : void 0; const s = arguments.length > 3 ? arguments[3] : void 0; + if (!fa(e)) { return null; } + if (t && !Array.isArray(t)) { return ha(t); } + let r = []; + t && (r = r.concat(t)), n != null && n.ignoreRegisteredLoaders || r.push(...Ol()), Gl(r); + const i = Pl(e, r, n, s); + if (!i && !(n != null && n.nothrow)) { throw new Error(da(e)); } + return i; +} +function Pl (e, t, n, s) { + const r = Kn(e); const i = gr(e); const o = mr(r) || (s == null ? void 0 : s.url); + let a = null; let c = ''; + if (n != null && n.mimeType && (a = hs(t, n == null ? void 0 : n.mimeType), c = `match forced by supplied MIME type ${n == null ? void 0 : n.mimeType}`), a = a || Nl(t, o), c = c || (a ? `matched url ${o}` : ''), a = a || hs(t, i), c = c || (a ? `matched MIME type ${i}` : ''), a = a || Hl(t, e), c = c || (a ? `matched initial data ${ma(e)}` : ''), n != null && n.fallbackMimeType && (a = a || hs(t, n == null ? void 0 : n.fallbackMimeType), c = c || (a ? `matched fallback MIME type ${i}` : '')), c) { + let u; + Fl.log(1, `selectLoader selected ${(u = a) === null || u === void 0 ? void 0 : u.name}: ${c}.`); + } + return a; +} +function fa (e) { + return !(e instanceof Response && e.status === 204); +} +function da (e) { + const t = Kn(e); const n = gr(e); + let s = 'No valid loader found ('; + s += t ? `${ta(t)}, ` : 'no url provided, ', s += `MIME type: ${n ? `"${n}"` : 'not provided'}, `; + const r = e ? ma(e) : ''; + return s += r ? ` first bytes: "${r}"` : 'first bytes: not available', s += ')', s; +} +function Gl (e) { + for (const t of e) { ha(t); } +} +function Nl (e, t) { + const n = t && Dl.exec(t); const s = n && n[1]; + return s ? Ul(e, s) : null; +} +function Ul (e, t) { + t = t.toLowerCase(); + for (const n of e) { + for (const s of n.extensions) { + if (s.toLowerCase() === t) { return n; } + } + } + return null; +} +function hs (e, t) { + for (const n of e) { + if (n.mimeTypes && n.mimeTypes.includes(t) || t === `application/x.${n.id}`) { return n; } + } + return null; +} +function Hl (e, t) { + if (!t) { return null; } + for (const n of e) { + if (typeof t === 'string') { + if (Jl(t, n)) { return n; } + } else if (ArrayBuffer.isView(t)) { + if (li(t.buffer, t.byteOffset, n)) { return n; } + } else if (t instanceof ArrayBuffer && li(t, 0, n)) { return n; } + } + return null; +} +function Jl (e, t) { + return t.testText ? t.testText(e) : (Array.isArray(t.tests) ? t.tests : [t.tests]).some((s) => e.startsWith(s)); +} +function li (e, t, n) { + return (Array.isArray(n.tests) ? n.tests : [n.tests]).some((r) => Vl(e, t, n, r)); +} +function Vl (e, t, n, s) { + if (s instanceof ArrayBuffer) { return Lu(s, e, s.byteLength); } + switch (typeof s) { + case 'function': + return s(e); + case 'string': + const r = js(e, t, s.length); + return s === r; + default: + return !1; + } +} +function ma (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 5; + return typeof e === 'string' ? e.slice(0, t) : ArrayBuffer.isView(e) ? js(e.buffer, e.byteOffset, t) : e instanceof ArrayBuffer ? js(e, 0, t) : ''; +} +function js (e, t, n) { + if (e.byteLength < t + n) { return ''; } + const s = new DataView(e); + let r = ''; + for (let i = 0; i < n; i++) { r += String.fromCharCode(s.getUint8(t + i)); } + return r; +} +const jl = 256 * 1024; +function * kl (e, t) { + const n = (t == null ? void 0 : t.chunkSize) || jl; + let s = 0; + const r = new TextEncoder(); + for (; s < e.length;) { + const i = Math.min(e.length - s, n); const o = e.slice(s, s + i); + s += i, yield r.encode(o); + } +} +const Kl = 256 * 1024; +function zl (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + return (function * () { + const { + chunkSize: n = Kl + } = t; + let s = 0; + for (; s < e.byteLength;) { + const r = Math.min(e.byteLength - s, n); const i = new ArrayBuffer(r); const o = new Uint8Array(e, s, r); + new Uint8Array(i).set(o), s += r, yield i; + } + }()); +} +const Wl = 1024 * 1024; +async function * Xl (e, t) { + const n = (t == null ? void 0 : t.chunkSize) || Wl; + let s = 0; + for (; s < e.size;) { + const r = s + n; const i = await e.slice(s, r).arrayBuffer(); + s = r, yield i; + } +} +function hi (e, t) { + return kn ? Ql(e, t) : ql(e); +} +async function * Ql (e, t) { + const n = e.getReader(); + let s; + try { + for (; ;) { + const r = s || n.read(); + t != null && t._streamReadAhead && (s = n.read()); + const { + done: i, + value: o + } = await r; + if (i) { return; } + yield Zo(o); + } + } catch { + n.releaseLock(); + } +} +async function * ql (e, t) { + for await (const n of e) { yield Zo(n); } +} +function Yl (e, t) { + if (typeof e === 'string') { return kl(e, t); } + if (e instanceof ArrayBuffer) { return zl(e, t); } + if (re(e)) { return Xl(e, t); } + if (na(e)) { return hi(e, t); } + if (se(e)) { return hi(e.body, t); } + throw new Error('makeIterator'); +} +const ga = 'Cannot convert supplied data type'; +function $l (e, t, n) { + if (t.text && typeof e === 'string') { return e; } + if (Qu(e) && (e = e.buffer), e instanceof ArrayBuffer) { + const s = e; + return t.text && !t.binary ? new TextDecoder('utf8').decode(s) : s; + } + if (ArrayBuffer.isView(e)) { + if (t.text && !t.binary) { return new TextDecoder('utf8').decode(e); } + let s = e.buffer; + const r = e.byteLength || e.length; + return (e.byteOffset !== 0 || r !== s.byteLength) && (s = s.slice(e.byteOffset, e.byteOffset + r)), s; + } + throw new Error(ga); +} +async function Zl (e, t, n) { + const s = e instanceof ArrayBuffer || ArrayBuffer.isView(e); + if (typeof e === 'string' || s) { return $l(e, t); } + if (re(e) && (e = await ra(e)), se(e)) { + const r = e; + return await sl(r), t.binary ? await r.arrayBuffer() : await r.text(); + } + if (na(e) && (e = Yl(e, n)), Wu(e) || Xu(e)) { return Uu(e); } + throw new Error(ga); +} +function Aa (e, t) { + const n = la(); const s = e || n; + return typeof s.fetch === 'function' ? s.fetch : We(s.fetch) ? (r) => Ge(r, s.fetch) : t != null && t.fetch ? t == null ? void 0 : t.fetch : Ge; +} +function th (e, t, n) { + if (n) { return n; } + const s = { + fetch: Aa(t, e), + ...e + }; + if (s.url) { + const r = mr(s.url); + s.baseUrl = r, s.queryString = el(s.url), s.filename = ta(r), s.baseUrl = ea(r); + } + return Array.isArray(s.loaders) || (s.loaders = null), s; +} +function eh (e, t) { + if (e && !Array.isArray(e)) { return e; } + let n; + if (e && (n = Array.isArray(e) ? e : [e]), t && t.loaders) { + const s = Array.isArray(t.loaders) ? t.loaders : [t.loaders]; + n = n ? [...n, ...s] : s; + } + return n && n.length ? n : void 0; +} +async function vn (e, t, n, s) { + t && !Array.isArray(t) && !Ar(t) && (s = void 0, n = t, t = void 0), e = await e, n = n || {}; + const r = Kn(e); const o = eh(t, s); const a = await Ll(e, o, n); + return a + ? (n = Rl(n, a, o, r), s = th({ + url: r, + _parse: vn, + loaders: o + }, n, s || null), await nh(a, e, n, s)) + : null; +} +async function nh (e, t, n, s) { + if (Tu(e), n = hu(e.options, n), se(t)) { + const i = t; const { + ok: o, + redirected: a, + status: c, + statusText: u, + type: l, + url: h + } = i; const f = Object.fromEntries(i.headers.entries()); + s.response = { + headers: f, + ok: o, + redirected: a, + status: c, + statusText: u, + type: l, + url: h + }; + } + t = await Zl(t, e, n); + const r = e; + if (r.parseTextSync && typeof t === 'string') { return r.parseTextSync(t, n, s); } + if (xu(e, n)) { return await vu(e, t, n, s, vn); } + if (r.parseText && typeof t === 'string') { return await r.parseText(t, n, s); } + if (r.parse) { return await r.parse(t, n, s); } + throw Jt(!r.parseSync), new Error(`${e.id} loader - no parser found and worker is disabled`); +} +function sh (e) { + switch (e.constructor) { + case Int8Array: + return 'int8'; + case Uint8Array: + case Uint8ClampedArray: + return 'uint8'; + case Int16Array: + return 'int16'; + case Uint16Array: + return 'uint16'; + case Int32Array: + return 'int32'; + case Uint32Array: + return 'uint32'; + case Float32Array: + return 'float32'; + case Float64Array: + return 'float64'; + default: + return 'null'; + } +} +function rh (e) { + let t = 1 / 0; let n = 1 / 0; let s = 1 / 0; let r = -1 / 0; let i = -1 / 0; let o = -1 / 0; + const a = e.POSITION ? e.POSITION.value : []; const c = a && a.length; + for (let u = 0; u < c; u += 3) { + const l = a[u]; const h = a[u + 1]; const f = a[u + 2]; + t = l < t ? l : t, n = h < n ? h : n, s = f < s ? f : s, r = l > r ? l : r, i = h > i ? h : i, o = f > o ? f : o; + } + return [[t, n, s], [r, i, o]]; +} +function ih (e, t, n) { + const s = sh(t.value); const r = n || oh(t); + return { + name: e, + type: { + type: 'fixed-size-list', + listSize: t.size, + children: [{ + name: 'value', + type: s + }] + }, + nullable: !1, + metadata: r + }; +} +function oh (e) { + const t = {}; + return 'byteOffset' in e && (t.byteOffset = e.byteOffset.toString(10)), 'byteStride' in e && (t.byteStride = e.byteStride.toString(10)), 'normalized' in e && (t.normalized = e.normalized.toString()), t; +} +async function Ae (e, t, n, s) { + let r, i; + !Array.isArray(t) && !Ar(t) ? (r = [], i = t) : (r = t, i = n); + const o = Aa(i); + let a = e; + return typeof e === 'string' && (a = await o(e)), re(e) && (a = await o(e)), Array.isArray(r) ? await vn(a, r, i) : await vn(a, r, i); +} +const ah = 1 / Math.PI * 180; const ch = 1 / 180 * Math.PI; const uh = { + EPSILON: 1e-12, + debug: !1, + precision: 4, + printTypes: !1, + printDegrees: !1, + printRowMajor: !0, + _cartographicRadians: !1 +}; +globalThis.mathgl = globalThis.mathgl || { + config: { + ...uh + } +}; +const et = globalThis.mathgl.config; +function lh (e, { + precision: t = et.precision +} = {}) { + return e = gh(e), ''.concat(parseFloat(e.toPrecision(t))); +} +function ee (e) { + return Array.isArray(e) || ArrayBuffer.isView(e) && !(e instanceof DataView); +} +function hh (e) { + return dh(e); +} +function fh (e) { + return Rt(e); +} +function dh (e, t) { + return pr(e, (n) => n * ch, t); +} +function Rt (e, t) { + return pr(e, (n) => n * ah, t); +} +function mh (e, t, n) { + return pr(e, (s) => Math.max(t, Math.min(n, s))); +} +function Kt (e, t, n) { + const s = et.EPSILON; + n && (et.EPSILON = n); + try { + if (e === t) { return !0; } + if (ee(e) && ee(t)) { + if (e.length !== t.length) { return !1; } + for (let r = 0; r < e.length; ++r) { + if (!Kt(e[r], t[r])) { return !1; } + } + return !0; + } + return e && e.equals ? e.equals(t) : t && t.equals ? t.equals(e) : typeof e === 'number' && typeof t === 'number' ? Math.abs(e - t) <= et.EPSILON * Math.max(1, Math.abs(e), Math.abs(t)) : !1; + } finally { + et.EPSILON = s; + } +} +function gh (e) { + return Math.round(e / et.EPSILON) * et.EPSILON; +} +function Ah (e) { + return e.clone ? e.clone() : new Array(e.length); +} +function pr (e, t, n) { + if (ee(e)) { + const s = e; + n = n || Ah(s); + for (let r = 0; r < n.length && r < s.length; ++r) { + const i = typeof e === 'number' ? e : e[r]; + n[r] = t(i, r, n); + } + return n; + } + return t(e); +} +function ph (e) { + function t () { + const n = Reflect.construct(e, Array.from(arguments)); + return Object.setPrototypeOf(n, Object.getPrototypeOf(this)), n; + } + return t.prototype = Object.create(e.prototype, { + constructor: { + value: e, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e, t; +} +class yr extends ph(Array) { + clone () { + return new this.constructor().copy(this); + } + + fromArray (t, n = 0) { + for (let s = 0; s < this.ELEMENTS; ++s) { this[s] = t[s + n]; } + return this.check(); + } + + toArray (t = [], n = 0) { + for (let s = 0; s < this.ELEMENTS; ++s) { t[n + s] = this[s]; } + return t; + } + + toObject (t) { + return t; + } + + from (t) { + return Array.isArray(t) ? this.copy(t) : this.fromObject(t); + } + + to (t) { + return t === this ? this : ee(t) ? this.toArray(t) : this.toObject(t); + } + + toTarget (t) { + return t ? this.to(t) : this; + } + + toFloat32Array () { + return new Float32Array(this); + } + + toString () { + return this.formatString(et); + } + + formatString (t) { + let n = ''; + for (let s = 0; s < this.ELEMENTS; ++s) { n += (s > 0 ? ', ' : '') + lh(this[s], t); } + return ''.concat(t.printTypes ? this.constructor.name : '', '[').concat(n, ']'); + } + + equals (t) { + if (!t || this.length !== t.length) { return !1; } + for (let n = 0; n < this.ELEMENTS; ++n) { + if (!Kt(this[n], t[n])) { return !1; } + } + return !0; + } + + exactEquals (t) { + if (!t || this.length !== t.length) { return !1; } + for (let n = 0; n < this.ELEMENTS; ++n) { + if (this[n] !== t[n]) { return !1; } + } + return !0; + } + + negate () { + for (let t = 0; t < this.ELEMENTS; ++t) { this[t] = -this[t]; } + return this.check(); + } + + lerp (t, n, s) { + if (s === void 0) { return this.lerp(this, t, n); } + for (let r = 0; r < this.ELEMENTS; ++r) { + const i = t[r]; const o = typeof n === 'number' ? n : n[r]; + this[r] = i + s * (o - i); + } + return this.check(); + } + + min (t) { + for (let n = 0; n < this.ELEMENTS; ++n) { this[n] = Math.min(t[n], this[n]); } + return this.check(); + } + + max (t) { + for (let n = 0; n < this.ELEMENTS; ++n) { this[n] = Math.max(t[n], this[n]); } + return this.check(); + } + + clamp (t, n) { + for (let s = 0; s < this.ELEMENTS; ++s) { this[s] = Math.min(Math.max(this[s], t[s]), n[s]); } + return this.check(); + } + + add (...t) { + for (const n of t) { + for (let s = 0; s < this.ELEMENTS; ++s) { this[s] += n[s]; } + } + return this.check(); + } + + subtract (...t) { + for (const n of t) { + for (let s = 0; s < this.ELEMENTS; ++s) { this[s] -= n[s]; } + } + return this.check(); + } + + scale (t) { + if (typeof t === 'number') { + for (let n = 0; n < this.ELEMENTS; ++n) { this[n] *= t; } + } else { + for (let n = 0; n < this.ELEMENTS && n < t.length; ++n) { this[n] *= t[n]; } + } + return this.check(); + } + + multiplyByScalar (t) { + for (let n = 0; n < this.ELEMENTS; ++n) { this[n] *= t; } + return this.check(); + } + + check () { + if (et.debug && !this.validate()) { throw new Error('math.gl: '.concat(this.constructor.name, " some fields set to invalid numbers'")); } + return this; + } + + validate () { + let t = this.length === this.ELEMENTS; + for (let n = 0; n < this.ELEMENTS; ++n) { t = t && Number.isFinite(this[n]); } + return t; + } + + sub (t) { + return this.subtract(t); + } + + setScalar (t) { + for (let n = 0; n < this.ELEMENTS; ++n) { this[n] = t; } + return this.check(); + } + + addScalar (t) { + for (let n = 0; n < this.ELEMENTS; ++n) { this[n] += t; } + return this.check(); + } + + subScalar (t) { + return this.addScalar(-t); + } + + multiplyScalar (t) { + for (let n = 0; n < this.ELEMENTS; ++n) { this[n] *= t; } + return this.check(); + } + + divideScalar (t) { + return this.multiplyByScalar(1 / t); + } + + clampScalar (t, n) { + for (let s = 0; s < this.ELEMENTS; ++s) { this[s] = Math.min(Math.max(this[s], t), n); } + return this.check(); + } + + get elements () { + return this; + } +} +function yh (e, t) { + if (e.length !== t) { return !1; } + for (let n = 0; n < e.length; ++n) { + if (!Number.isFinite(e[n])) { return !1; } + } + return !0; +} +function U (e) { + if (!Number.isFinite(e)) { throw new Error('Invalid number '.concat(JSON.stringify(e))); } + return e; +} +function Oe (e, t, n = '') { + if (et.debug && !yh(e, t)) { throw new Error('math.gl: '.concat(n, " some fields set to invalid numbers'")); } + return e; +} +function j (e, t) { + if (!e) { throw new Error('math.gl assertion '.concat(t)); } +} +class Br extends yr { + get x () { + return this[0]; + } + + set x (t) { + this[0] = U(t); + } + + get y () { + return this[1]; + } + + set y (t) { + this[1] = U(t); + } + + len () { + return Math.sqrt(this.lengthSquared()); + } + + magnitude () { + return this.len(); + } + + lengthSquared () { + let t = 0; + for (let n = 0; n < this.ELEMENTS; ++n) { t += this[n] * this[n]; } + return t; + } + + magnitudeSquared () { + return this.lengthSquared(); + } + + distance (t) { + return Math.sqrt(this.distanceSquared(t)); + } + + distanceSquared (t) { + let n = 0; + for (let s = 0; s < this.ELEMENTS; ++s) { + const r = this[s] - t[s]; + n += r * r; + } + return U(n); + } + + dot (t) { + let n = 0; + for (let s = 0; s < this.ELEMENTS; ++s) { n += this[s] * t[s]; } + return U(n); + } + + normalize () { + const t = this.magnitude(); + if (t !== 0) { + for (let n = 0; n < this.ELEMENTS; ++n) { this[n] /= t; } + } + return this.check(); + } + + multiply (...t) { + for (const n of t) { + for (let s = 0; s < this.ELEMENTS; ++s) { this[s] *= n[s]; } + } + return this.check(); + } + + divide (...t) { + for (const n of t) { + for (let s = 0; s < this.ELEMENTS; ++s) { this[s] /= n[s]; } + } + return this.check(); + } + + lengthSq () { + return this.lengthSquared(); + } + + distanceTo (t) { + return this.distance(t); + } + + distanceToSquared (t) { + return this.distanceSquared(t); + } + + getComponent (t) { + return j(t >= 0 && t < this.ELEMENTS, 'index is out of range'), U(this[t]); + } + + setComponent (t, n) { + return j(t >= 0 && t < this.ELEMENTS, 'index is out of range'), this[t] = n, this.check(); + } + + addVectors (t, n) { + return this.copy(t).add(n); + } + + subVectors (t, n) { + return this.copy(t).subtract(n); + } + + multiplyVectors (t, n) { + return this.copy(t).multiply(n); + } + + addScaledVector (t, n) { + return this.add(new this.constructor(t).multiplyScalar(n)); + } +} +const Fe = 1e-6; +const It = typeof Float32Array < 'u' ? Float32Array : Array; +function Bh () { + const e = new It(2); + return It != Float32Array && (e[0] = 0, e[1] = 0), e; +} +function Ch (e, t, n) { + const s = t[0]; const r = t[1]; + return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e; +} +function Eh (e, t, n) { + const s = t[0]; const r = t[1]; + return e[0] = n[0] * s + n[2] * r + n[4], e[1] = n[1] * s + n[3] * r + n[5], e; +} +function pa (e, t, n) { + const s = t[0]; const r = t[1]; + return e[0] = n[0] * s + n[3] * r + n[6], e[1] = n[1] * s + n[4] * r + n[7], e; +} +function ya (e, t, n) { + const s = t[0]; const r = t[1]; + return e[0] = n[0] * s + n[4] * r + n[12], e[1] = n[1] * s + n[5] * r + n[13], e; +} +(function () { + const e = Bh(); + return function (t, n, s, r, i, o) { + let a, c; + for (n || (n = 2), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) { e[0] = t[a], e[1] = t[a + 1], i(e, e, o), t[a] = e[0], t[a + 1] = e[1]; } + return t; + }; +})(); +function Ba (e, t, n) { + const s = t[0]; const r = t[1]; const i = n[3] * s + n[7] * r || 1; + return e[0] = (n[0] * s + n[4] * r) / i, e[1] = (n[1] * s + n[5] * r) / i, e; +} +function Ca (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; const o = n[3] * s + n[7] * r + n[11] * i || 1; + return e[0] = (n[0] * s + n[4] * r + n[8] * i) / o, e[1] = (n[1] * s + n[5] * r + n[9] * i) / o, e[2] = (n[2] * s + n[6] * r + n[10] * i) / o, e; +} +function Th (e, t, n) { + const s = t[0]; const r = t[1]; + return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e[2] = t[2], e; +} +function bh (e, t, n) { + const s = t[0]; const r = t[1]; + return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e[2] = t[2], e[3] = t[3], e; +} +function Ea (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; + return e[0] = n[0] * s + n[3] * r + n[6] * i, e[1] = n[1] * s + n[4] * r + n[7] * i, e[2] = n[2] * s + n[5] * r + n[8] * i, e[3] = t[3], e; +} +class Wn extends Br { + constructor (t = 0, n = 0) { + super(2), ee(t) && arguments.length === 1 ? this.copy(t) : (et.debug && (U(t), U(n)), this[0] = t, this[1] = n); + } + + set (t, n) { + return this[0] = t, this[1] = n, this.check(); + } + + copy (t) { + return this[0] = t[0], this[1] = t[1], this.check(); + } + + fromObject (t) { + return et.debug && (U(t.x), U(t.y)), this[0] = t.x, this[1] = t.y, this.check(); + } + + toObject (t) { + return t.x = this[0], t.y = this[1], t; + } + + get ELEMENTS () { + return 2; + } + + horizontalAngle () { + return Math.atan2(this.y, this.x); + } + + verticalAngle () { + return Math.atan2(this.x, this.y); + } + + transform (t) { + return this.transformAsPoint(t); + } + + transformAsPoint (t) { + return ya(this, this, t), this.check(); + } + + transformAsVector (t) { + return Ba(this, this, t), this.check(); + } + + transformByMatrix3 (t) { + return pa(this, this, t), this.check(); + } + + transformByMatrix2x3 (t) { + return Eh(this, this, t), this.check(); + } + + transformByMatrix2 (t) { + return Ch(this, this, t), this.check(); + } +} +function Ta () { + const e = new It(3); + return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e; +} +function ba (e) { + const t = e[0]; const n = e[1]; const s = e[2]; + return Math.sqrt(t * t + n * n + s * s); +} +function fi (e, t, n) { + const s = new It(3); + return s[0] = e, s[1] = t, s[2] = n, s; +} +function _h (e, t) { + const n = t[0]; const s = t[1]; const r = t[2]; + let i = n * n + s * s + r * r; + return i > 0 && (i = 1 / Math.sqrt(i)), e[0] = t[0] * i, e[1] = t[1] * i, e[2] = t[2] * i, e; +} +function Cr (e, t) { + return e[0] * t[0] + e[1] * t[1] + e[2] * t[2]; +} +function Tn (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; const o = n[0]; const a = n[1]; const c = n[2]; + return e[0] = r * c - i * a, e[1] = i * o - s * c, e[2] = s * a - r * o, e; +} +function Er (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; + let o = n[3] * s + n[7] * r + n[11] * i + n[15]; + return o = o || 1, e[0] = (n[0] * s + n[4] * r + n[8] * i + n[12]) / o, e[1] = (n[1] * s + n[5] * r + n[9] * i + n[13]) / o, e[2] = (n[2] * s + n[6] * r + n[10] * i + n[14]) / o, e; +} +function _a (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; + return e[0] = s * n[0] + r * n[3] + i * n[6], e[1] = s * n[1] + r * n[4] + i * n[7], e[2] = s * n[2] + r * n[5] + i * n[8], e; +} +function wa (e, t, n) { + const s = n[0]; const r = n[1]; const i = n[2]; const o = n[3]; const a = t[0]; const c = t[1]; const u = t[2]; + let l = r * u - i * c; let h = i * a - s * u; let f = s * c - r * a; let d = r * f - i * h; let m = i * l - s * f; let g = s * h - r * l; + const y = o * 2; + return l *= y, h *= y, f *= y, d *= 2, m *= 2, g *= 2, e[0] = a + l + d, e[1] = c + h + m, e[2] = u + f + g, e; +} +function wh (e, t, n, s) { + const r = []; const i = []; + return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[0], i[1] = r[1] * Math.cos(s) - r[2] * Math.sin(s), i[2] = r[1] * Math.sin(s) + r[2] * Math.cos(s), e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e; +} +function Rh (e, t, n, s) { + const r = []; const i = []; + return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[2] * Math.sin(s) + r[0] * Math.cos(s), i[1] = r[1], i[2] = r[2] * Math.cos(s) - r[0] * Math.sin(s), e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e; +} +function Mh (e, t, n, s) { + const r = []; const i = []; + return r[0] = t[0] - n[0], r[1] = t[1] - n[1], r[2] = t[2] - n[2], i[0] = r[0] * Math.cos(s) - r[1] * Math.sin(s), i[1] = r[0] * Math.sin(s) + r[1] * Math.cos(s), i[2] = r[2], e[0] = i[0] + n[0], e[1] = i[1] + n[1], e[2] = i[2] + n[2], e; +} +function Sh (e, t) { + const n = e[0]; const s = e[1]; const r = e[2]; const i = t[0]; const o = t[1]; const a = t[2]; const c = Math.sqrt((n * n + s * s + r * r) * (i * i + o * o + a * a)); const u = c && Cr(e, t) / c; + return Math.acos(Math.min(Math.max(u, -1), 1)); +} +const Ih = ba; +(function () { + const e = Ta(); + return function (t, n, s, r, i, o) { + let a, c; + for (n || (n = 3), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) { e[0] = t[a], e[1] = t[a + 1], e[2] = t[a + 2], i(e, e, o), t[a] = e[0], t[a + 1] = e[1], t[a + 2] = e[2]; } + return t; + }; +})(); +const fs = [0, 0, 0]; +let tn; +class A extends Br { + static get ZERO () { + return tn || (tn = new A(0, 0, 0), Object.freeze(tn)), tn; + } + + constructor (t = 0, n = 0, s = 0) { + super(-0, -0, -0), arguments.length === 1 && ee(t) ? this.copy(t) : (et.debug && (U(t), U(n), U(s)), this[0] = t, this[1] = n, this[2] = s); + } + + set (t, n, s) { + return this[0] = t, this[1] = n, this[2] = s, this.check(); + } + + copy (t) { + return this[0] = t[0], this[1] = t[1], this[2] = t[2], this.check(); + } + + fromObject (t) { + return et.debug && (U(t.x), U(t.y), U(t.z)), this[0] = t.x, this[1] = t.y, this[2] = t.z, this.check(); + } + + toObject (t) { + return t.x = this[0], t.y = this[1], t.z = this[2], t; + } + + get ELEMENTS () { + return 3; + } + + get z () { + return this[2]; + } + + set z (t) { + this[2] = U(t); + } + + angle (t) { + return Sh(this, t); + } + + cross (t) { + return Tn(this, this, t), this.check(); + } + + rotateX ({ + radians: t, + origin: n = fs + }) { + return wh(this, this, n, t), this.check(); + } + + rotateY ({ + radians: t, + origin: n = fs + }) { + return Rh(this, this, n, t), this.check(); + } + + rotateZ ({ + radians: t, + origin: n = fs + }) { + return Mh(this, this, n, t), this.check(); + } + + transform (t) { + return this.transformAsPoint(t); + } + + transformAsPoint (t) { + return Er(this, this, t), this.check(); + } + + transformAsVector (t) { + return Ca(this, this, t), this.check(); + } + + transformByMatrix3 (t) { + return _a(this, this, t), this.check(); + } + + transformByMatrix2 (t) { + return Th(this, this, t), this.check(); + } + + transformByQuaternion (t) { + return wa(this, this, t), this.check(); + } +} +let en; +class Tr extends Br { + static get ZERO () { + return en || (en = new Tr(0, 0, 0, 0), Object.freeze(en)), en; + } + + constructor (t = 0, n = 0, s = 0, r = 0) { + super(-0, -0, -0, -0), ee(t) && arguments.length === 1 ? this.copy(t) : (et.debug && (U(t), U(n), U(s), U(r)), this[0] = t, this[1] = n, this[2] = s, this[3] = r); + } + + set (t, n, s, r) { + return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this.check(); + } + + copy (t) { + return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this.check(); + } + + fromObject (t) { + return et.debug && (U(t.x), U(t.y), U(t.z), U(t.w)), this[0] = t.x, this[1] = t.y, this[2] = t.z, this[3] = t.w, this; + } + + toObject (t) { + return t.x = this[0], t.y = this[1], t.z = this[2], t.w = this[3], t; + } + + get ELEMENTS () { + return 4; + } + + get z () { + return this[2]; + } + + set z (t) { + this[2] = U(t); + } + + get w () { + return this[3]; + } + + set w (t) { + this[3] = U(t); + } + + transform (t) { + return Er(this, this, t), this.check(); + } + + transformByMatrix3 (t) { + return Ea(this, this, t), this.check(); + } + + transformByMatrix2 (t) { + return bh(this, this, t), this.check(); + } + + transformByQuaternion (t) { + return wa(this, this, t), this.check(); + } + + applyMatrix4 (t) { + return t.transform(this, this), this; + } +} +class Ra extends yr { + toString () { + let t = '['; + if (et.printRowMajor) { + t += 'row-major:'; + for (let n = 0; n < this.RANK; ++n) { + for (let s = 0; s < this.RANK; ++s) { t += ' '.concat(this[s * this.RANK + n]); } + } + } else { + t += 'column-major:'; + for (let n = 0; n < this.ELEMENTS; ++n) { t += ' '.concat(this[n]); } + } + return t += ']', t; + } + + getElementIndex (t, n) { + return n * this.RANK + t; + } + + getElement (t, n) { + return this[n * this.RANK + t]; + } + + setElement (t, n, s) { + return this[n * this.RANK + t] = U(s), this; + } + + getColumn (t, n = new Array(this.RANK).fill(-0)) { + const s = t * this.RANK; + for (let r = 0; r < this.RANK; ++r) { n[r] = this[s + r]; } + return n; + } + + setColumn (t, n) { + const s = t * this.RANK; + for (let r = 0; r < this.RANK; ++r) { this[s + r] = n[r]; } + return this; + } +} +function xh () { + const e = new It(9); + return It != Float32Array && (e[1] = 0, e[2] = 0, e[3] = 0, e[5] = 0, e[6] = 0, e[7] = 0), e[0] = 1, e[4] = 1, e[8] = 1, e; +} +function vh (e, t) { + if (e === t) { + const n = t[1]; const s = t[2]; const r = t[5]; + e[1] = t[3], e[2] = t[6], e[3] = n, e[5] = t[7], e[6] = s, e[7] = r; + } else { e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8]; } + return e; +} +function Oh (e, t) { + const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; const o = t[4]; const a = t[5]; const c = t[6]; const u = t[7]; const l = t[8]; const h = l * o - a * u; const f = -l * i + a * c; const d = u * i - o * c; + let m = n * h + s * f + r * d; + return m ? (m = 1 / m, e[0] = h * m, e[1] = (-l * s + r * u) * m, e[2] = (a * s - r * o) * m, e[3] = f * m, e[4] = (l * n - r * c) * m, e[5] = (-a * n + r * i) * m, e[6] = d * m, e[7] = (-u * n + s * c) * m, e[8] = (o * n - s * i) * m, e) : null; +} +function Fh (e) { + const t = e[0]; const n = e[1]; const s = e[2]; const r = e[3]; const i = e[4]; const o = e[5]; const a = e[6]; const c = e[7]; const u = e[8]; + return t * (u * i - o * c) + n * (-u * r + o * a) + s * (c * r - i * a); +} +function di (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = t[4]; const c = t[5]; const u = t[6]; const l = t[7]; const h = t[8]; const f = n[0]; const d = n[1]; const m = n[2]; const g = n[3]; const y = n[4]; const E = n[5]; const R = n[6]; const B = n[7]; const C = n[8]; + return e[0] = f * s + d * o + m * u, e[1] = f * r + d * a + m * l, e[2] = f * i + d * c + m * h, e[3] = g * s + y * o + E * u, e[4] = g * r + y * a + E * l, e[5] = g * i + y * c + E * h, e[6] = R * s + B * o + C * u, e[7] = R * r + B * a + C * l, e[8] = R * i + B * c + C * h, e; +} +function Dh (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = t[4]; const c = t[5]; const u = t[6]; const l = t[7]; const h = t[8]; const f = n[0]; const d = n[1]; + return e[0] = s, e[1] = r, e[2] = i, e[3] = o, e[4] = a, e[5] = c, e[6] = f * s + d * o + u, e[7] = f * r + d * a + l, e[8] = f * i + d * c + h, e; +} +function Lh (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = t[4]; const c = t[5]; const u = t[6]; const l = t[7]; const h = t[8]; const f = Math.sin(n); const d = Math.cos(n); + return e[0] = d * s + f * o, e[1] = d * r + f * a, e[2] = d * i + f * c, e[3] = d * o - f * s, e[4] = d * a - f * r, e[5] = d * c - f * i, e[6] = u, e[7] = l, e[8] = h, e; +} +function mi (e, t, n) { + const s = n[0]; const r = n[1]; + return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = r * t[3], e[4] = r * t[4], e[5] = r * t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8], e; +} +function Ph (e, t) { + const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; const o = n + n; const a = s + s; const c = r + r; const u = n * o; const l = s * o; const h = s * a; const f = r * o; const d = r * a; const m = r * c; const g = i * o; const y = i * a; const E = i * c; + return e[0] = 1 - h - m, e[3] = l - E, e[6] = f + y, e[1] = l + E, e[4] = 1 - u - m, e[7] = d - g, e[2] = f - y, e[5] = d + g, e[8] = 1 - u - h, e; +} +let ks; +(function (e) { + e[e.COL0ROW0 = 0] = 'COL0ROW0', e[e.COL0ROW1 = 1] = 'COL0ROW1', e[e.COL0ROW2 = 2] = 'COL0ROW2', e[e.COL1ROW0 = 3] = 'COL1ROW0', e[e.COL1ROW1 = 4] = 'COL1ROW1', e[e.COL1ROW2 = 5] = 'COL1ROW2', e[e.COL2ROW0 = 6] = 'COL2ROW0', e[e.COL2ROW1 = 7] = 'COL2ROW1', e[e.COL2ROW2 = 8] = 'COL2ROW2'; +})(ks || (ks = {})); +const Gh = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]); +class X extends Ra { + static get IDENTITY () { + return Uh(); + } + + static get ZERO () { + return Nh(); + } + + get ELEMENTS () { + return 9; + } + + get RANK () { + return 3; + } + + get INDICES () { + return ks; + } + + constructor (t, ...n) { + super(-0, -0, -0, -0, -0, -0, -0, -0, -0), arguments.length === 1 && Array.isArray(t) ? this.copy(t) : n.length > 0 ? this.copy([t, ...n]) : this.identity(); + } + + copy (t) { + return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this[4] = t[4], this[5] = t[5], this[6] = t[6], this[7] = t[7], this[8] = t[8], this.check(); + } + + identity () { + return this.copy(Gh); + } + + fromObject (t) { + return this.check(); + } + + fromQuaternion (t) { + return Ph(this, t), this.check(); + } + + set (t, n, s, r, i, o, a, c, u) { + return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this[4] = i, this[5] = o, this[6] = a, this[7] = c, this[8] = u, this.check(); + } + + setRowMajor (t, n, s, r, i, o, a, c, u) { + return this[0] = t, this[1] = r, this[2] = a, this[3] = n, this[4] = i, this[5] = c, this[6] = s, this[7] = o, this[8] = u, this.check(); + } + + determinant () { + return Fh(this); + } + + transpose () { + return vh(this, this), this.check(); + } + + invert () { + return Oh(this, this), this.check(); + } + + multiplyLeft (t) { + return di(this, t, this), this.check(); + } + + multiplyRight (t) { + return di(this, this, t), this.check(); + } + + rotate (t) { + return Lh(this, this, t), this.check(); + } + + scale (t) { + return Array.isArray(t) ? mi(this, this, t) : mi(this, this, [t, t]), this.check(); + } + + translate (t) { + return Dh(this, this, t), this.check(); + } + + transform (t, n) { + let s; + switch (t.length) { + case 2: + s = pa(n || [-0, -0], t, this); + break; + case 3: + s = _a(n || [-0, -0, -0], t, this); + break; + case 4: + s = Ea(n || [-0, -0, -0, -0], t, this); + break; + default: + throw new Error('Illegal vector'); + } + return Oe(s, t.length), s; + } + + transformVector (t, n) { + return this.transform(t, n); + } + + transformVector2 (t, n) { + return this.transform(t, n); + } + + transformVector3 (t, n) { + return this.transform(t, n); + } +} +let nn; let sn = null; +function Nh () { + return nn || (nn = new X([0, 0, 0, 0, 0, 0, 0, 0, 0]), Object.freeze(nn)), nn; +} +function Uh () { + return sn || (sn = new X(), Object.freeze(sn)), sn; +} +function Hh (e) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; +} +function Jh (e, t) { + if (e === t) { + const n = t[1]; const s = t[2]; const r = t[3]; const i = t[6]; const o = t[7]; const a = t[11]; + e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = n, e[6] = t[9], e[7] = t[13], e[8] = s, e[9] = i, e[11] = t[14], e[12] = r, e[13] = o, e[14] = a; + } else { e[0] = t[0], e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = t[1], e[5] = t[5], e[6] = t[9], e[7] = t[13], e[8] = t[2], e[9] = t[6], e[10] = t[10], e[11] = t[14], e[12] = t[3], e[13] = t[7], e[14] = t[11], e[15] = t[15]; } + return e; +} +function Vh (e, t) { + const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; const o = t[4]; const a = t[5]; const c = t[6]; const u = t[7]; const l = t[8]; const h = t[9]; const f = t[10]; const d = t[11]; const m = t[12]; const g = t[13]; const y = t[14]; const E = t[15]; const R = n * a - s * o; const B = n * c - r * o; const C = n * u - i * o; const M = s * c - r * a; const b = s * u - i * a; const O = r * u - i * c; const F = l * g - h * m; const v = l * y - f * m; const L = l * E - d * m; const k = h * y - f * g; const q = h * E - d * g; const Y = f * E - d * y; + let P = R * Y - B * q + C * k + M * L - b * v + O * F; + return P ? (P = 1 / P, e[0] = (a * Y - c * q + u * k) * P, e[1] = (r * q - s * Y - i * k) * P, e[2] = (g * O - y * b + E * M) * P, e[3] = (f * b - h * O - d * M) * P, e[4] = (c * L - o * Y - u * v) * P, e[5] = (n * Y - r * L + i * v) * P, e[6] = (y * C - m * O - E * B) * P, e[7] = (l * O - f * C + d * B) * P, e[8] = (o * q - a * L + u * F) * P, e[9] = (s * L - n * q - i * F) * P, e[10] = (m * b - g * C + E * R) * P, e[11] = (h * C - l * b - d * R) * P, e[12] = (a * v - o * k - c * F) * P, e[13] = (n * k - s * v + r * F) * P, e[14] = (g * B - m * M - y * R) * P, e[15] = (l * M - h * B + f * R) * P, e) : null; +} +function jh (e) { + const t = e[0]; const n = e[1]; const s = e[2]; const r = e[3]; const i = e[4]; const o = e[5]; const a = e[6]; const c = e[7]; const u = e[8]; const l = e[9]; const h = e[10]; const f = e[11]; const d = e[12]; const m = e[13]; const g = e[14]; const y = e[15]; const E = t * o - n * i; const R = t * a - s * i; const B = n * a - s * o; const C = u * m - l * d; const M = u * g - h * d; const b = l * g - h * m; const O = t * b - n * M + s * C; const F = i * b - o * M + a * C; const v = u * B - l * R + h * E; const L = d * B - m * R + g * E; + return c * O - r * F + y * v - f * L; +} +function gi (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = t[4]; const c = t[5]; const u = t[6]; const l = t[7]; const h = t[8]; const f = t[9]; const d = t[10]; const m = t[11]; const g = t[12]; const y = t[13]; const E = t[14]; const R = t[15]; + let B = n[0]; let C = n[1]; let M = n[2]; let b = n[3]; + return e[0] = B * s + C * a + M * h + b * g, e[1] = B * r + C * c + M * f + b * y, e[2] = B * i + C * u + M * d + b * E, e[3] = B * o + C * l + M * m + b * R, B = n[4], C = n[5], M = n[6], b = n[7], e[4] = B * s + C * a + M * h + b * g, e[5] = B * r + C * c + M * f + b * y, e[6] = B * i + C * u + M * d + b * E, e[7] = B * o + C * l + M * m + b * R, B = n[8], C = n[9], M = n[10], b = n[11], e[8] = B * s + C * a + M * h + b * g, e[9] = B * r + C * c + M * f + b * y, e[10] = B * i + C * u + M * d + b * E, e[11] = B * o + C * l + M * m + b * R, B = n[12], C = n[13], M = n[14], b = n[15], e[12] = B * s + C * a + M * h + b * g, e[13] = B * r + C * c + M * f + b * y, e[14] = B * i + C * u + M * d + b * E, e[15] = B * o + C * l + M * m + b * R, e; +} +function kh (e, t, n) { + const s = n[0]; const r = n[1]; const i = n[2]; + let o, a, c, u, l, h, f, d, m, g, y, E; + return t === e ? (e[12] = t[0] * s + t[4] * r + t[8] * i + t[12], e[13] = t[1] * s + t[5] * r + t[9] * i + t[13], e[14] = t[2] * s + t[6] * r + t[10] * i + t[14], e[15] = t[3] * s + t[7] * r + t[11] * i + t[15]) : (o = t[0], a = t[1], c = t[2], u = t[3], l = t[4], h = t[5], f = t[6], d = t[7], m = t[8], g = t[9], y = t[10], E = t[11], e[0] = o, e[1] = a, e[2] = c, e[3] = u, e[4] = l, e[5] = h, e[6] = f, e[7] = d, e[8] = m, e[9] = g, e[10] = y, e[11] = E, e[12] = o * s + l * r + m * i + t[12], e[13] = a * s + h * r + g * i + t[13], e[14] = c * s + f * r + y * i + t[14], e[15] = u * s + d * r + E * i + t[15]), e; +} +function Kh (e, t, n) { + const s = n[0]; const r = n[1]; const i = n[2]; + return e[0] = t[0] * s, e[1] = t[1] * s, e[2] = t[2] * s, e[3] = t[3] * s, e[4] = t[4] * r, e[5] = t[5] * r, e[6] = t[6] * r, e[7] = t[7] * r, e[8] = t[8] * i, e[9] = t[9] * i, e[10] = t[10] * i, e[11] = t[11] * i, e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e; +} +function zh (e, t, n, s) { + let r = s[0]; let i = s[1]; let o = s[2]; let a = Math.sqrt(r * r + i * i + o * o); let c; let u; let l; let h; let f; let d; let m; let g; let y; let E; let R; let B; let C; let M; let b; let O; let F; let v; let L; let k; let q; let Y; let P; let ct; + return a < Fe ? null : (a = 1 / a, r *= a, i *= a, o *= a, u = Math.sin(n), c = Math.cos(n), l = 1 - c, h = t[0], f = t[1], d = t[2], m = t[3], g = t[4], y = t[5], E = t[6], R = t[7], B = t[8], C = t[9], M = t[10], b = t[11], O = r * r * l + c, F = i * r * l + o * u, v = o * r * l - i * u, L = r * i * l - o * u, k = i * i * l + c, q = o * i * l + r * u, Y = r * o * l + i * u, P = i * o * l - r * u, ct = o * o * l + c, e[0] = h * O + g * F + B * v, e[1] = f * O + y * F + C * v, e[2] = d * O + E * F + M * v, e[3] = m * O + R * F + b * v, e[4] = h * L + g * k + B * q, e[5] = f * L + y * k + C * q, e[6] = d * L + E * k + M * q, e[7] = m * L + R * k + b * q, e[8] = h * Y + g * P + B * ct, e[9] = f * Y + y * P + C * ct, e[10] = d * Y + E * P + M * ct, e[11] = m * Y + R * P + b * ct, t !== e && (e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e); +} +function Wh (e, t, n) { + const s = Math.sin(n); const r = Math.cos(n); const i = t[4]; const o = t[5]; const a = t[6]; const c = t[7]; const u = t[8]; const l = t[9]; const h = t[10]; const f = t[11]; + return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = i * r + u * s, e[5] = o * r + l * s, e[6] = a * r + h * s, e[7] = c * r + f * s, e[8] = u * r - i * s, e[9] = l * r - o * s, e[10] = h * r - a * s, e[11] = f * r - c * s, e; +} +function Xh (e, t, n) { + const s = Math.sin(n); const r = Math.cos(n); const i = t[0]; const o = t[1]; const a = t[2]; const c = t[3]; const u = t[8]; const l = t[9]; const h = t[10]; const f = t[11]; + return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = i * r - u * s, e[1] = o * r - l * s, e[2] = a * r - h * s, e[3] = c * r - f * s, e[8] = i * s + u * r, e[9] = o * s + l * r, e[10] = a * s + h * r, e[11] = c * s + f * r, e; +} +function Qh (e, t, n) { + const s = Math.sin(n); const r = Math.cos(n); const i = t[0]; const o = t[1]; const a = t[2]; const c = t[3]; const u = t[4]; const l = t[5]; const h = t[6]; const f = t[7]; + return t !== e && (e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = i * r + u * s, e[1] = o * r + l * s, e[2] = a * r + h * s, e[3] = c * r + f * s, e[4] = u * r - i * s, e[5] = l * r - o * s, e[6] = h * r - a * s, e[7] = f * r - c * s, e; +} +function qh (e, t) { + const n = t[0]; const s = t[1]; const r = t[2]; const i = t[4]; const o = t[5]; const a = t[6]; const c = t[8]; const u = t[9]; const l = t[10]; + return e[0] = Math.sqrt(n * n + s * s + r * r), e[1] = Math.sqrt(i * i + o * o + a * a), e[2] = Math.sqrt(c * c + u * u + l * l), e; +} +function Yh (e, t) { + const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; const o = n + n; const a = s + s; const c = r + r; const u = n * o; const l = s * o; const h = s * a; const f = r * o; const d = r * a; const m = r * c; const g = i * o; const y = i * a; const E = i * c; + return e[0] = 1 - h - m, e[1] = l + E, e[2] = f - y, e[3] = 0, e[4] = l - E, e[5] = 1 - u - m, e[6] = d + g, e[7] = 0, e[8] = f + y, e[9] = d - g, e[10] = 1 - u - h, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; +} +function $h (e, t, n, s, r, i, o) { + const a = 1 / (n - t); const c = 1 / (r - s); const u = 1 / (i - o); + return e[0] = i * 2 * a, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = i * 2 * c, e[6] = 0, e[7] = 0, e[8] = (n + t) * a, e[9] = (r + s) * c, e[10] = (o + i) * u, e[11] = -1, e[12] = 0, e[13] = 0, e[14] = o * i * 2 * u, e[15] = 0, e; +} +function Zh (e, t, n, s, r) { + const i = 1 / Math.tan(t / 2); + if (e[0] = i / n, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = i, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, r != null && r !== 1 / 0) { + const o = 1 / (s - r); + e[10] = (r + s) * o, e[14] = 2 * r * s * o; + } else { e[10] = -1, e[14] = -2 * s; } + return e; +} +const tf = Zh; +function ef (e, t, n, s, r, i, o) { + const a = 1 / (t - n); const c = 1 / (s - r); const u = 1 / (i - o); + return e[0] = -2 * a, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = -2 * c, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 2 * u, e[11] = 0, e[12] = (t + n) * a, e[13] = (r + s) * c, e[14] = (o + i) * u, e[15] = 1, e; +} +const nf = ef; +function sf (e, t, n, s) { + let r, i, o, a, c, u, l, h, f, d; + const m = t[0]; const g = t[1]; const y = t[2]; const E = s[0]; const R = s[1]; const B = s[2]; const C = n[0]; const M = n[1]; const b = n[2]; + return Math.abs(m - C) < Fe && Math.abs(g - M) < Fe && Math.abs(y - b) < Fe ? Hh(e) : (h = m - C, f = g - M, d = y - b, r = 1 / Math.sqrt(h * h + f * f + d * d), h *= r, f *= r, d *= r, i = R * d - B * f, o = B * h - E * d, a = E * f - R * h, r = Math.sqrt(i * i + o * o + a * a), r ? (r = 1 / r, i *= r, o *= r, a *= r) : (i = 0, o = 0, a = 0), c = f * a - d * o, u = d * i - h * a, l = h * o - f * i, r = Math.sqrt(c * c + u * u + l * l), r ? (r = 1 / r, c *= r, u *= r, l *= r) : (c = 0, u = 0, l = 0), e[0] = i, e[1] = c, e[2] = h, e[3] = 0, e[4] = o, e[5] = u, e[6] = f, e[7] = 0, e[8] = a, e[9] = l, e[10] = d, e[11] = 0, e[12] = -(i * m + o * g + a * y), e[13] = -(c * m + u * g + l * y), e[14] = -(h * m + f * g + d * y), e[15] = 1, e); +} +function rf () { + const e = new It(4); + return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0), e; +} +function of (e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e; +} +function af (e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e; +} +function cf (e) { + const t = e[0]; const n = e[1]; const s = e[2]; const r = e[3]; + return Math.sqrt(t * t + n * n + s * s + r * r); +} +function uf (e) { + const t = e[0]; const n = e[1]; const s = e[2]; const r = e[3]; + return t * t + n * n + s * s + r * r; +} +function lf (e, t) { + const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; + let o = n * n + s * s + r * r + i * i; + return o > 0 && (o = 1 / Math.sqrt(o)), e[0] = n * o, e[1] = s * o, e[2] = r * o, e[3] = i * o, e; +} +function hf (e, t) { + return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3]; +} +function ff (e, t, n, s) { + const r = t[0]; const i = t[1]; const o = t[2]; const a = t[3]; + return e[0] = r + s * (n[0] - r), e[1] = i + s * (n[1] - i), e[2] = o + s * (n[2] - o), e[3] = a + s * (n[3] - a), e; +} +function df (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; + return e[0] = n[0] * s + n[4] * r + n[8] * i + n[12] * o, e[1] = n[1] * s + n[5] * r + n[9] * i + n[13] * o, e[2] = n[2] * s + n[6] * r + n[10] * i + n[14] * o, e[3] = n[3] * s + n[7] * r + n[11] * i + n[15] * o, e; +} +function mf (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; const o = n[0]; const a = n[1]; const c = n[2]; const u = n[3]; const l = u * s + a * i - c * r; const h = u * r + c * s - o * i; const f = u * i + o * r - a * s; const d = -o * s - a * r - c * i; + return e[0] = l * u + d * -o + h * -c - f * -a, e[1] = h * u + d * -a + f * -o - l * -c, e[2] = f * u + d * -c + l * -a - h * -o, e[3] = t[3], e; +} +(function () { + const e = rf(); + return function (t, n, s, r, i, o) { + let a, c; + for (n || (n = 4), s || (s = 0), r ? c = Math.min(r * n + s, t.length) : c = t.length, a = s; a < c; a += n) { e[0] = t[a], e[1] = t[a + 1], e[2] = t[a + 2], e[3] = t[a + 3], i(e, e, o), t[a] = e[0], t[a + 1] = e[1], t[a + 2] = e[2], t[a + 3] = e[3]; } + return t; + }; +})(); +let Ks; +(function (e) { + e[e.COL0ROW0 = 0] = 'COL0ROW0', e[e.COL0ROW1 = 1] = 'COL0ROW1', e[e.COL0ROW2 = 2] = 'COL0ROW2', e[e.COL0ROW3 = 3] = 'COL0ROW3', e[e.COL1ROW0 = 4] = 'COL1ROW0', e[e.COL1ROW1 = 5] = 'COL1ROW1', e[e.COL1ROW2 = 6] = 'COL1ROW2', e[e.COL1ROW3 = 7] = 'COL1ROW3', e[e.COL2ROW0 = 8] = 'COL2ROW0', e[e.COL2ROW1 = 9] = 'COL2ROW1', e[e.COL2ROW2 = 10] = 'COL2ROW2', e[e.COL2ROW3 = 11] = 'COL2ROW3', e[e.COL3ROW0 = 12] = 'COL3ROW0', e[e.COL3ROW1 = 13] = 'COL3ROW1', e[e.COL3ROW2 = 14] = 'COL3ROW2', e[e.COL3ROW3 = 15] = 'COL3ROW3'; +})(Ks || (Ks = {})); +const gf = 45 * Math.PI / 180; const Af = 1; const ds = 0.1; const ms = 500; const pf = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); +class V extends Ra { + static get IDENTITY () { + return Bf(); + } + + static get ZERO () { + return yf(); + } + + get ELEMENTS () { + return 16; + } + + get RANK () { + return 4; + } + + get INDICES () { + return Ks; + } + + constructor (t) { + super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0), arguments.length === 1 && Array.isArray(t) ? this.copy(t) : this.identity(); + } + + copy (t) { + return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this[4] = t[4], this[5] = t[5], this[6] = t[6], this[7] = t[7], this[8] = t[8], this[9] = t[9], this[10] = t[10], this[11] = t[11], this[12] = t[12], this[13] = t[13], this[14] = t[14], this[15] = t[15], this.check(); + } + + set (t, n, s, r, i, o, a, c, u, l, h, f, d, m, g, y) { + return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this[4] = i, this[5] = o, this[6] = a, this[7] = c, this[8] = u, this[9] = l, this[10] = h, this[11] = f, this[12] = d, this[13] = m, this[14] = g, this[15] = y, this.check(); + } + + setRowMajor (t, n, s, r, i, o, a, c, u, l, h, f, d, m, g, y) { + return this[0] = t, this[1] = i, this[2] = u, this[3] = d, this[4] = n, this[5] = o, this[6] = l, this[7] = m, this[8] = s, this[9] = a, this[10] = h, this[11] = g, this[12] = r, this[13] = c, this[14] = f, this[15] = y, this.check(); + } + + toRowMajor (t) { + return t[0] = this[0], t[1] = this[4], t[2] = this[8], t[3] = this[12], t[4] = this[1], t[5] = this[5], t[6] = this[9], t[7] = this[13], t[8] = this[2], t[9] = this[6], t[10] = this[10], t[11] = this[14], t[12] = this[3], t[13] = this[7], t[14] = this[11], t[15] = this[15], t; + } + + identity () { + return this.copy(pf); + } + + fromObject (t) { + return this.check(); + } + + fromQuaternion (t) { + return Yh(this, t), this.check(); + } + + frustum (t) { + const { + left: n, + right: s, + bottom: r, + top: i, + near: o = ds, + far: a = ms + } = t; + return a === 1 / 0 ? Cf(this, n, s, r, i, o) : $h(this, n, s, r, i, o, a), this.check(); + } + + lookAt (t) { + const { + eye: n, + center: s = [0, 0, 0], + up: r = [0, 1, 0] + } = t; + return sf(this, n, s, r), this.check(); + } + + ortho (t) { + const { + left: n, + right: s, + bottom: r, + top: i, + near: o = ds, + far: a = ms + } = t; + return nf(this, n, s, r, i, o, a), this.check(); + } + + orthographic (t) { + const { + fovy: n = gf, + aspect: s = Af, + focalDistance: r = 1, + near: i = ds, + far: o = ms + } = t; + Ai(n); + const a = n / 2; const c = r * Math.tan(a); const u = c * s; + return this.ortho({ + left: -u, + right: u, + bottom: -c, + top: c, + near: i, + far: o + }); + } + + perspective (t) { + const { + fovy: n = 45 * Math.PI / 180, + aspect: s = 1, + near: r = 0.1, + far: i = 500 + } = t; + return Ai(n), tf(this, n, s, r, i), this.check(); + } + + determinant () { + return jh(this); + } + + getScale (t = [-0, -0, -0]) { + return t[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]), t[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]), t[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]), t; + } + + getTranslation (t = [-0, -0, -0]) { + return t[0] = this[12], t[1] = this[13], t[2] = this[14], t; + } + + getRotation (t, n) { + t = t || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0], n = n || [-0, -0, -0]; + const s = this.getScale(n); const r = 1 / s[0]; const i = 1 / s[1]; const o = 1 / s[2]; + return t[0] = this[0] * r, t[1] = this[1] * i, t[2] = this[2] * o, t[3] = 0, t[4] = this[4] * r, t[5] = this[5] * i, t[6] = this[6] * o, t[7] = 0, t[8] = this[8] * r, t[9] = this[9] * i, t[10] = this[10] * o, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t; + } + + getRotationMatrix3 (t, n) { + t = t || [-0, -0, -0, -0, -0, -0, -0, -0, -0], n = n || [-0, -0, -0]; + const s = this.getScale(n); const r = 1 / s[0]; const i = 1 / s[1]; const o = 1 / s[2]; + return t[0] = this[0] * r, t[1] = this[1] * i, t[2] = this[2] * o, t[3] = this[4] * r, t[4] = this[5] * i, t[5] = this[6] * o, t[6] = this[8] * r, t[7] = this[9] * i, t[8] = this[10] * o, t; + } + + transpose () { + return Jh(this, this), this.check(); + } + + invert () { + return Vh(this, this), this.check(); + } + + multiplyLeft (t) { + return gi(this, t, this), this.check(); + } + + multiplyRight (t) { + return gi(this, this, t), this.check(); + } + + rotateX (t) { + return Wh(this, this, t), this.check(); + } + + rotateY (t) { + return Xh(this, this, t), this.check(); + } + + rotateZ (t) { + return Qh(this, this, t), this.check(); + } + + rotateXYZ (t) { + return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2]); + } + + rotateAxis (t, n) { + return zh(this, this, t, n), this.check(); + } + + scale (t) { + return Kh(this, this, Array.isArray(t) ? t : [t, t, t]), this.check(); + } + + translate (t) { + return kh(this, this, t), this.check(); + } + + transform (t, n) { + return t.length === 4 ? (n = df(n || [-0, -0, -0, -0], t, this), Oe(n, 4), n) : this.transformAsPoint(t, n); + } + + transformAsPoint (t, n) { + const { + length: s + } = t; + let r; + switch (s) { + case 2: + r = ya(n || [-0, -0], t, this); + break; + case 3: + r = Er(n || [-0, -0, -0], t, this); + break; + default: + throw new Error('Illegal vector'); + } + return Oe(r, t.length), r; + } + + transformAsVector (t, n) { + let s; + switch (t.length) { + case 2: + s = Ba(n || [-0, -0], t, this); + break; + case 3: + s = Ca(n || [-0, -0, -0], t, this); + break; + default: + throw new Error('Illegal vector'); + } + return Oe(s, t.length), s; + } + + transformPoint (t, n) { + return this.transformAsPoint(t, n); + } + + transformVector (t, n) { + return this.transformAsPoint(t, n); + } + + transformDirection (t, n) { + return this.transformAsVector(t, n); + } + + makeRotationX (t) { + return this.identity().rotateX(t); + } + + makeTranslation (t, n, s) { + return this.identity().translate([t, n, s]); + } +} +let rn, on; +function yf () { + return rn || (rn = new V([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), Object.freeze(rn)), rn; +} +function Bf () { + return on || (on = new V(), Object.freeze(on)), on; +} +function Ai (e) { + if (e > Math.PI * 2) { throw Error('expected radians'); } +} +function Cf (e, t, n, s, r, i) { + const o = 2 * i / (n - t); const a = 2 * i / (r - s); const c = (n + t) / (n - t); const u = (r + s) / (r - s); const l = -1; const h = -1; const f = -2 * i; + return e[0] = o, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a, e[6] = 0, e[7] = 0, e[8] = c, e[9] = u, e[10] = l, e[11] = h, e[12] = 0, e[13] = 0, e[14] = f, e[15] = 0, e; +} +function pi () { + const e = new It(4); + return It != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e[3] = 1, e; +} +function Ef (e) { + return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e; +} +function Ma (e, t, n) { + n = n * 0.5; + const s = Math.sin(n); + return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = Math.cos(n), e; +} +function yi (e, t, n) { + const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = n[0]; const c = n[1]; const u = n[2]; const l = n[3]; + return e[0] = s * l + o * a + r * u - i * c, e[1] = r * l + o * c + i * a - s * u, e[2] = i * l + o * u + s * c - r * a, e[3] = o * l - s * a - r * c - i * u, e; +} +function Tf (e, t, n) { + n *= 0.5; + const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = Math.sin(n); const c = Math.cos(n); + return e[0] = s * c + o * a, e[1] = r * c + i * a, e[2] = i * c - r * a, e[3] = o * c - s * a, e; +} +function bf (e, t, n) { + n *= 0.5; + const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = Math.sin(n); const c = Math.cos(n); + return e[0] = s * c - i * a, e[1] = r * c + o * a, e[2] = i * c + s * a, e[3] = o * c - r * a, e; +} +function _f (e, t, n) { + n *= 0.5; + const s = t[0]; const r = t[1]; const i = t[2]; const o = t[3]; const a = Math.sin(n); const c = Math.cos(n); + return e[0] = s * c + r * a, e[1] = r * c - s * a, e[2] = i * c + o * a, e[3] = o * c - i * a, e; +} +function wf (e, t) { + const n = t[0]; const s = t[1]; const r = t[2]; + return e[0] = n, e[1] = s, e[2] = r, e[3] = Math.sqrt(Math.abs(1 - n * n - s * s - r * r)), e; +} +function bn (e, t, n, s) { + const r = t[0]; const i = t[1]; const o = t[2]; const a = t[3]; + let c = n[0]; let u = n[1]; let l = n[2]; let h = n[3]; let f; let d; let m; let g; let y; + return f = r * c + i * u + o * l + a * h, f < 0 && (f = -f, c = -c, u = -u, l = -l, h = -h), 1 - f > Fe ? (d = Math.acos(f), y = Math.sin(d), m = Math.sin((1 - s) * d) / y, g = Math.sin(s * d) / y) : (m = 1 - s, g = s), e[0] = m * r + g * c, e[1] = m * i + g * u, e[2] = m * o + g * l, e[3] = m * a + g * h, e; +} +function Rf (e, t) { + const n = t[0]; const s = t[1]; const r = t[2]; const i = t[3]; const o = n * n + s * s + r * r + i * i; const a = o ? 1 / o : 0; + return e[0] = -n * a, e[1] = -s * a, e[2] = -r * a, e[3] = i * a, e; +} +function Mf (e, t) { + return e[0] = -t[0], e[1] = -t[1], e[2] = -t[2], e[3] = t[3], e; +} +function Sa (e, t) { + const n = t[0] + t[4] + t[8]; + let s; + if (n > 0) { s = Math.sqrt(n + 1), e[3] = 0.5 * s, s = 0.5 / s, e[0] = (t[5] - t[7]) * s, e[1] = (t[6] - t[2]) * s, e[2] = (t[1] - t[3]) * s; } else { + let r = 0; + t[4] > t[0] && (r = 1), t[8] > t[r * 3 + r] && (r = 2); + const i = (r + 1) % 3; const o = (r + 2) % 3; + s = Math.sqrt(t[r * 3 + r] - t[i * 3 + i] - t[o * 3 + o] + 1), e[r] = 0.5 * s, s = 0.5 / s, e[3] = (t[i * 3 + o] - t[o * 3 + i]) * s, e[i] = (t[i * 3 + r] + t[r * 3 + i]) * s, e[o] = (t[o * 3 + r] + t[r * 3 + o]) * s; + } + return e; +} +const Sf = of; const If = af; const xf = hf; const vf = ff; const Of = cf; const Ff = uf; const Ia = lf; const Df = (function () { + const e = Ta(); const t = fi(1, 0, 0); const n = fi(0, 1, 0); + return function (s, r, i) { + const o = Cr(r, i); + return o < -0.999999 ? (Tn(e, t, r), Ih(e) < 1e-6 && Tn(e, n, r), _h(e, e), Ma(s, e, Math.PI), s) : o > 0.999999 ? (s[0] = 0, s[1] = 0, s[2] = 0, s[3] = 1, s) : (Tn(e, r, i), s[0] = e[0], s[1] = e[1], s[2] = e[2], s[3] = 1 + o, Ia(s, s)); + }; +}()); +(function () { + const e = pi(); const t = pi(); + return function (n, s, r, i, o, a) { + return bn(e, s, o, a), bn(t, r, i, a), bn(n, e, t, 2 * a * (1 - a)), n; + }; +})(); +(function () { + const e = xh(); + return function (t, n, s, r) { + return e[0] = s[0], e[3] = s[1], e[6] = s[2], e[1] = r[0], e[4] = r[1], e[7] = r[2], e[2] = -n[0], e[5] = -n[1], e[8] = -n[2], Ia(t, Sa(t, e)); + }; +})(); +const Lf = [0, 0, 0, 1]; +class On extends yr { + constructor (t = 0, n = 0, s = 0, r = 1) { + super(-0, -0, -0, -0), Array.isArray(t) && arguments.length === 1 ? this.copy(t) : this.set(t, n, s, r); + } + + copy (t) { + return this[0] = t[0], this[1] = t[1], this[2] = t[2], this[3] = t[3], this.check(); + } + + set (t, n, s, r) { + return this[0] = t, this[1] = n, this[2] = s, this[3] = r, this.check(); + } + + fromObject (t) { + return this[0] = t.x, this[1] = t.y, this[2] = t.z, this[3] = t.w, this.check(); + } + + fromMatrix3 (t) { + return Sa(this, t), this.check(); + } + + fromAxisRotation (t, n) { + return Ma(this, t, n), this.check(); + } + + identity () { + return Ef(this), this.check(); + } + + setAxisAngle (t, n) { + return this.fromAxisRotation(t, n); + } + + get ELEMENTS () { + return 4; + } + + get x () { + return this[0]; + } + + set x (t) { + this[0] = U(t); + } + + get y () { + return this[1]; + } + + set y (t) { + this[1] = U(t); + } + + get z () { + return this[2]; + } + + set z (t) { + this[2] = U(t); + } + + get w () { + return this[3]; + } + + set w (t) { + this[3] = U(t); + } + + len () { + return Of(this); + } + + lengthSquared () { + return Ff(this); + } + + dot (t) { + return xf(this, t); + } + + rotationTo (t, n) { + return Df(this, t, n), this.check(); + } + + add (t) { + return Sf(this, this, t), this.check(); + } + + calculateW () { + return wf(this, this), this.check(); + } + + conjugate () { + return Mf(this, this), this.check(); + } + + invert () { + return Rf(this, this), this.check(); + } + + lerp (t, n, s) { + return s === void 0 ? this.lerp(this, t, n) : (vf(this, t, n, s), this.check()); + } + + multiplyRight (t) { + return yi(this, this, t), this.check(); + } + + multiplyLeft (t) { + return yi(this, t, this), this.check(); + } + + normalize () { + const t = this.len(); const n = t > 0 ? 1 / t : 0; + return this[0] = this[0] * n, this[1] = this[1] * n, this[2] = this[2] * n, this[3] = this[3] * n, t === 0 && (this[3] = 1), this.check(); + } + + rotateX (t) { + return Tf(this, this, t), this.check(); + } + + rotateY (t) { + return bf(this, this, t), this.check(); + } + + rotateZ (t) { + return _f(this, this, t), this.check(); + } + + scale (t) { + return If(this, this, t), this.check(); + } + + slerp (t, n, s) { + let r, i, o; + switch (arguments.length) { + case 1: + ({ + start: r = Lf, + target: i, + ratio: o + } = t); + break; + case 2: + r = this, i = t, o = n; + break; + default: + r = t, i = n, o = s; + } + return bn(this, r, i, o), this.check(); + } + + transformVector4 (t, n = new Tr()) { + return mf(n, t, this), Oe(n, 4); + } + + lengthSq () { + return this.lengthSquared(); + } + + setFromAxisAngle (t, n) { + return this.setAxisAngle(t, n); + } + + premultiply (t) { + return this.multiplyLeft(t); + } + + multiply (t) { + return this.multiplyRight(t); + } +} +function Ne (e) { + '@babel/helpers - typeof'; + return Ne = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' + ? function (t) { + return typeof t; + } + : function (t) { + return t && typeof Symbol === 'function' && t.constructor === Symbol && t !== Symbol.prototype ? 'symbol' : typeof t; + }, Ne(e); +} +function Pf (e, t) { + if (Ne(e) != 'object' || !e) { return e; } + const n = e[Symbol.toPrimitive]; + if (n !== void 0) { + const s = n.call(e, t || 'default'); + if (Ne(s) != 'object') { return s; } + throw new TypeError('@@toPrimitive must return a primitive value.'); + } + return (t === 'string' ? String : Number)(e); +} +function Gf (e) { + const t = Pf(e, 'string'); + return Ne(t) == 'symbol' ? t : String(t); +} +function x (e, t, n) { + return t = Gf(t), t in e + ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) + : e[t] = n, e; +} +const Nf = 0.1; const Uf = 1e-12; const xa = 1e-15; const Hf = 1e-20; const Jf = 6378137; const Vf = 6378137; const jf = 6356752314245179e-9; +function Xn (e) { + return e; +} +new A(); +function kf (e, t = [], n = Xn) { + return 'longitude' in e ? (t[0] = n(e.longitude), t[1] = n(e.latitude), t[2] = e.height) : 'x' in e ? (t[0] = n(e.x), t[1] = n(e.y), t[2] = e.z) : (t[0] = n(e[0]), t[1] = n(e[1]), t[2] = e[2]), t; +} +function Kf (e, t = []) { + return kf(e, t, et._cartographicRadians ? Xn : hh); +} +function zf (e, t, n = Xn) { + return 'longitude' in t ? (t.longitude = n(e[0]), t.latitude = n(e[1]), t.height = e[2]) : 'x' in t ? (t.x = n(e[0]), t.y = n(e[1]), t.z = e[2]) : (t[0] = n(e[0]), t[1] = n(e[1]), t[2] = e[2]), t; +} +function Wf (e, t) { + return zf(e, t, et._cartographicRadians ? Xn : fh); +} +const Bi = 1e-14; const Xf = new A(); const Ci = { + up: { + south: 'east', + north: 'west', + west: 'south', + east: 'north' + }, + down: { + south: 'west', + north: 'east', + west: 'north', + east: 'south' + }, + south: { + up: 'west', + down: 'east', + west: 'down', + east: 'up' + }, + north: { + up: 'east', + down: 'west', + west: 'up', + east: 'down' + }, + west: { + up: 'north', + down: 'south', + north: 'down', + south: 'up' + }, + east: { + up: 'south', + down: 'north', + north: 'up', + south: 'down' + } +}; const gs = { + north: [-1, 0, 0], + east: [0, 1, 0], + up: [0, 0, 1], + south: [1, 0, 0], + west: [0, -1, 0], + down: [0, 0, -1] +}; const Te = { + east: new A(), + north: new A(), + up: new A(), + west: new A(), + south: new A(), + down: new A() +}; const Qf = new A(); const qf = new A(); const Yf = new A(); +function Ei (e, t, n, s, r, i) { + const o = Ci[t] && Ci[t][n]; + j(o && (!s || s === o)); + let a, c, u; + const l = Xf.copy(r); + if (Kt(l.x, 0, Bi) && Kt(l.y, 0, Bi)) { + const f = Math.sign(l.z); + a = Qf.fromArray(gs[t]), t !== 'east' && t !== 'west' && a.scale(f), c = qf.fromArray(gs[n]), n !== 'east' && n !== 'west' && c.scale(f), u = Yf.fromArray(gs[s]), s !== 'east' && s !== 'west' && u.scale(f); + } else { + const { + up: f, + east: d, + north: m + } = Te; + d.set(-l.y, l.x, 0).normalize(), e.geodeticSurfaceNormal(l, f), m.copy(f).cross(d); + const { + down: g, + west: y, + south: E + } = Te; + g.copy(f).scale(-1), y.copy(d).scale(-1), E.copy(m).scale(-1), a = Te[t], c = Te[n], u = Te[s]; + } + return i[0] = a.x, i[1] = a.y, i[2] = a.z, i[3] = 0, i[4] = c.x, i[5] = c.y, i[6] = c.z, i[7] = 0, i[8] = u.x, i[9] = u.y, i[10] = u.z, i[11] = 0, i[12] = l.x, i[13] = l.y, i[14] = l.z, i[15] = 1, i; +} +const ue = new A(); const $f = new A(); const Zf = new A(); +function td (e, t, n = []) { + const { + oneOverRadii: s, + oneOverRadiiSquared: r, + centerToleranceSquared: i + } = t; + ue.from(e); + const o = ue.x; const a = ue.y; const c = ue.z; const u = s.x; const l = s.y; const h = s.z; const f = o * o * u * u; const d = a * a * l * l; const m = c * c * h * h; const g = f + d + m; const y = Math.sqrt(1 / g); + if (!Number.isFinite(y)) { return; } + const E = $f; + if (E.copy(e).scale(y), g < i) { return E.to(n); } + const R = r.x; const B = r.y; const C = r.z; const M = Zf; + M.set(E.x * R * 2, E.y * B * 2, E.z * C * 2); + let b = (1 - y) * ue.len() / (0.5 * M.len()); let O = 0; let F; let v; let L; let k; + do { + b -= O, F = 1 / (1 + b * R), v = 1 / (1 + b * B), L = 1 / (1 + b * C); + const q = F * F; const Y = v * v; const P = L * L; const ct = q * F; const Wt = Y * v; const oe = P * L; + k = f * q + d * Y + m * P - 1; + const vt = -2 * (f * ct * R + d * Wt * B + m * oe * C); + O = k / vt; + } while (Math.abs(k) > Uf); + return ue.scale([F, v, L]).to(n); +} +const an = new A(); const Ti = new A(); const ed = new A(); const wt = new A(); const nd = new A(); const cn = new A(); +class J { + constructor (t = 0, n = 0, s = 0) { + x(this, 'radii', void 0), x(this, 'radiiSquared', void 0), x(this, 'radiiToTheFourth', void 0), x(this, 'oneOverRadii', void 0), x(this, 'oneOverRadiiSquared', void 0), x(this, 'minimumRadius', void 0), x(this, 'maximumRadius', void 0), x(this, 'centerToleranceSquared', Nf), x(this, 'squaredXOverSquaredZ', void 0), j(t >= 0), j(n >= 0), j(s >= 0), this.radii = new A(t, n, s), this.radiiSquared = new A(t * t, n * n, s * s), this.radiiToTheFourth = new A(t * t * t * t, n * n * n * n, s * s * s * s), this.oneOverRadii = new A(t === 0 ? 0 : 1 / t, n === 0 ? 0 : 1 / n, s === 0 ? 0 : 1 / s), this.oneOverRadiiSquared = new A(t === 0 ? 0 : 1 / (t * t), n === 0 ? 0 : 1 / (n * n), s === 0 ? 0 : 1 / (s * s)), this.minimumRadius = Math.min(t, n, s), this.maximumRadius = Math.max(t, n, s), this.radiiSquared.z !== 0 && (this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z), Object.freeze(this); + } + + equals (t) { + return this === t || !!(t && this.radii.equals(t.radii)); + } + + toString () { + return this.radii.toString(); + } + + cartographicToCartesian (t, n = [0, 0, 0]) { + const s = Ti; const r = ed; const [, , i] = t; + this.geodeticSurfaceNormalCartographic(t, s), r.copy(this.radiiSquared).scale(s); + const o = Math.sqrt(s.dot(r)); + return r.scale(1 / o), s.scale(i), r.add(s), r.to(n); + } + + cartesianToCartographic (t, n = [0, 0, 0]) { + cn.from(t); + const s = this.scaleToGeodeticSurface(cn, wt); + if (!s) { return; } + const r = this.geodeticSurfaceNormal(s, Ti); const i = nd; + i.copy(cn).subtract(s); + const o = Math.atan2(r.y, r.x); const a = Math.asin(r.z); const c = Math.sign(Cr(i, cn)) * ba(i); + return Wf([o, a, c], n); + } + + eastNorthUpToFixedFrame (t, n = new V()) { + return Ei(this, 'east', 'north', 'up', t, n); + } + + localFrameToFixedFrame (t, n, s, r, i = new V()) { + return Ei(this, t, n, s, r, i); + } + + geocentricSurfaceNormal (t, n = [0, 0, 0]) { + return an.from(t).normalize().to(n); + } + + geodeticSurfaceNormalCartographic (t, n = [0, 0, 0]) { + const s = Kf(t); const r = s[0]; const i = s[1]; const o = Math.cos(i); + return an.set(o * Math.cos(r), o * Math.sin(r), Math.sin(i)).normalize(), an.to(n); + } + + geodeticSurfaceNormal (t, n = [0, 0, 0]) { + return an.from(t).scale(this.oneOverRadiiSquared).normalize().to(n); + } + + scaleToGeodeticSurface (t, n) { + return td(t, this, n); + } + + scaleToGeocentricSurface (t, n = [0, 0, 0]) { + wt.from(t); + const s = wt.x; const r = wt.y; const i = wt.z; const o = this.oneOverRadiiSquared; const a = 1 / Math.sqrt(s * s * o.x + r * r * o.y + i * i * o.z); + return wt.multiplyScalar(a).to(n); + } + + transformPositionToScaledSpace (t, n = [0, 0, 0]) { + return wt.from(t).scale(this.oneOverRadii).to(n); + } + + transformPositionFromScaledSpace (t, n = [0, 0, 0]) { + return wt.from(t).scale(this.radii).to(n); + } + + getSurfaceNormalIntersectionWithZAxis (t, n = 0, s = [0, 0, 0]) { + j(Kt(this.radii.x, this.radii.y, xa)), j(this.radii.z > 0), wt.from(t); + const r = wt.z * (1 - this.squaredXOverSquaredZ); + if (!(Math.abs(r) >= this.radii.z - n)) { return wt.set(0, 0, r).to(s); } + } +} +x(J, 'WGS84', new J(Jf, Vf, jf)); +const pt = { + OUTSIDE: -1, + INTERSECTING: 0, + INSIDE: 1 +}; +new A(); +new A(); +const be = new A(); const bi = new A(); +class Qe { + constructor (t = [0, 0, 0], n = 0) { + x(this, 'center', void 0), x(this, 'radius', void 0), this.radius = -0, this.center = new A(), this.fromCenterRadius(t, n); + } + + fromCenterRadius (t, n) { + return this.center.from(t), this.radius = n, this; + } + + fromCornerPoints (t, n) { + return n = be.from(n), this.center = new A().from(t).add(n).scale(0.5), this.radius = this.center.distance(n), this; + } + + equals (t) { + return this === t || !!t && this.center.equals(t.center) && this.radius === t.radius; + } + + clone () { + return new Qe(this.center, this.radius); + } + + union (t) { + const n = this.center; const s = this.radius; const r = t.center; const i = t.radius; const o = be.copy(r).subtract(n); const a = o.magnitude(); + if (s >= a + i) { return this.clone(); } + if (i >= a + s) { return t.clone(); } + const c = (s + a + i) * 0.5; + return bi.copy(o).scale((-s + c) / a).add(n), this.center.copy(bi), this.radius = c, this; + } + + expand (t) { + const s = be.from(t).subtract(this.center).magnitude(); + return s > this.radius && (this.radius = s), this; + } + + transform (t) { + this.center.transform(t); + const n = qh(be, t); + return this.radius = Math.max(n[0], Math.max(n[1], n[2])) * this.radius, this; + } + + distanceSquaredTo (t) { + const n = this.distanceTo(t); + return n * n; + } + + distanceTo (t) { + const s = be.from(t).subtract(this.center); + return Math.max(0, s.len() - this.radius); + } + + intersectPlane (t) { + const n = this.center; const s = this.radius; const i = t.normal.dot(n) + t.distance; + return i < -s ? pt.OUTSIDE : i < s ? pt.INTERSECTING : pt.INSIDE; + } +} +const sd = new A(); const rd = new A(); const un = new A(); const ln = new A(); const hn = new A(); const id = new A(); const od = new A(); const Gt = { + COLUMN0ROW0: 0, + COLUMN0ROW1: 1, + COLUMN0ROW2: 2, + COLUMN1ROW0: 3, + COLUMN1ROW1: 4, + COLUMN1ROW2: 5, + COLUMN2ROW0: 6, + COLUMN2ROW1: 7, + COLUMN2ROW2: 8 +}; +class qe { + constructor (t = [0, 0, 0], n = [0, 0, 0, 0, 0, 0, 0, 0, 0]) { + x(this, 'center', void 0), x(this, 'halfAxes', void 0), this.center = new A().from(t), this.halfAxes = new X(n); + } + + get halfSize () { + const t = this.halfAxes.getColumn(0); const n = this.halfAxes.getColumn(1); const s = this.halfAxes.getColumn(2); + return [new A(t).len(), new A(n).len(), new A(s).len()]; + } + + get quaternion () { + const t = this.halfAxes.getColumn(0); const n = this.halfAxes.getColumn(1); const s = this.halfAxes.getColumn(2); const r = new A(t).normalize(); const i = new A(n).normalize(); const o = new A(s).normalize(); + return new On().fromMatrix3(new X([...r, ...i, ...o])); + } + + fromCenterHalfSizeQuaternion (t, n, s) { + const r = new On(s); const i = new X().fromQuaternion(r); + return i[0] = i[0] * n[0], i[1] = i[1] * n[0], i[2] = i[2] * n[0], i[3] = i[3] * n[1], i[4] = i[4] * n[1], i[5] = i[5] * n[1], i[6] = i[6] * n[2], i[7] = i[7] * n[2], i[8] = i[8] * n[2], this.center = new A().from(t), this.halfAxes = i, this; + } + + clone () { + return new qe(this.center, this.halfAxes); + } + + equals (t) { + return this === t || !!t && this.center.equals(t.center) && this.halfAxes.equals(t.halfAxes); + } + + getBoundingSphere (t = new Qe()) { + const n = this.halfAxes; const s = n.getColumn(0, un); const r = n.getColumn(1, ln); const i = n.getColumn(2, hn); const o = sd.copy(s).add(r).add(i); + return t.center.copy(this.center), t.radius = o.magnitude(), t; + } + + intersectPlane (t) { + const n = this.center; const s = t.normal; const r = this.halfAxes; const i = s.x; const o = s.y; const a = s.z; const c = Math.abs(i * r[Gt.COLUMN0ROW0] + o * r[Gt.COLUMN0ROW1] + a * r[Gt.COLUMN0ROW2]) + Math.abs(i * r[Gt.COLUMN1ROW0] + o * r[Gt.COLUMN1ROW1] + a * r[Gt.COLUMN1ROW2]) + Math.abs(i * r[Gt.COLUMN2ROW0] + o * r[Gt.COLUMN2ROW1] + a * r[Gt.COLUMN2ROW2]); const u = s.dot(n) + t.distance; + return u <= -c ? pt.OUTSIDE : u >= c ? pt.INSIDE : pt.INTERSECTING; + } + + distanceTo (t) { + return Math.sqrt(this.distanceSquaredTo(t)); + } + + distanceSquaredTo (t) { + const n = rd.from(t).subtract(this.center); const s = this.halfAxes; const r = s.getColumn(0, un); const i = s.getColumn(1, ln); const o = s.getColumn(2, hn); const a = r.magnitude(); const c = i.magnitude(); const u = o.magnitude(); + r.normalize(), i.normalize(), o.normalize(); + let l = 0; let h; + return h = Math.abs(n.dot(r)) - a, h > 0 && (l += h * h), h = Math.abs(n.dot(i)) - c, h > 0 && (l += h * h), h = Math.abs(n.dot(o)) - u, h > 0 && (l += h * h), l; + } + + computePlaneDistances (t, n, s = [-0, -0]) { + let r = Number.POSITIVE_INFINITY; let i = Number.NEGATIVE_INFINITY; + const o = this.center; const a = this.halfAxes; const c = a.getColumn(0, un); const u = a.getColumn(1, ln); const l = a.getColumn(2, hn); const h = id.copy(c).add(u).add(l).add(o); const f = od.copy(h).subtract(t); + let d = n.dot(f); + return r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).add(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).subtract(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), h.copy(o).add(c).subtract(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).add(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).add(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).subtract(u).add(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), o.copy(h).subtract(c).subtract(u).subtract(l), f.copy(h).subtract(t), d = n.dot(f), r = Math.min(d, r), i = Math.max(d, i), s[0] = r, s[1] = i, s; + } + + transform (t) { + this.center.transformAsPoint(t); + const n = this.halfAxes.getColumn(0, un); + n.transformAsPoint(t); + const s = this.halfAxes.getColumn(1, ln); + s.transformAsPoint(t); + const r = this.halfAxes.getColumn(2, hn); + return r.transformAsPoint(t), this.halfAxes = new X([...n, ...s, ...r]), this; + } + + getTransform () { + throw new Error('not implemented'); + } +} +const _i = new A(); const wi = new A(); +class nt { + constructor (t = [0, 0, 1], n = 0) { + x(this, 'normal', void 0), x(this, 'distance', void 0), this.normal = new A(), this.distance = -0, this.fromNormalDistance(t, n); + } + + fromNormalDistance (t, n) { + return j(Number.isFinite(n)), this.normal.from(t).normalize(), this.distance = n, this; + } + + fromPointNormal (t, n) { + t = _i.from(t), this.normal.from(n).normalize(); + const s = -this.normal.dot(t); + return this.distance = s, this; + } + + fromCoefficients (t, n, s, r) { + return this.normal.set(t, n, s), j(Kt(this.normal.len(), 1)), this.distance = r, this; + } + + clone () { + return new nt(this.normal, this.distance); + } + + equals (t) { + return Kt(this.distance, t.distance) && Kt(this.normal, t.normal); + } + + getPointDistance (t) { + return this.normal.dot(t) + this.distance; + } + + transform (t) { + const n = wi.copy(this.normal).transformAsVector(t).normalize(); const s = this.normal.scale(-this.distance).transform(t); + return this.fromPointNormal(s, n); + } + + projectPointOntoPlane (t, n = [0, 0, 0]) { + const s = _i.from(t); const r = this.getPointDistance(s); const i = wi.copy(this.normal).scale(r); + return s.subtract(i).to(n); + } +} +const Ri = [new A([1, 0, 0]), new A([0, 1, 0]), new A([0, 0, 1])]; const Mi = new A(); const ad = new A(); +class dt { + constructor (t = []) { + x(this, 'planes', void 0), this.planes = t; + } + + fromBoundingSphere (t) { + this.planes.length = 2 * Ri.length; + const n = t.center; const s = t.radius; + let r = 0; + for (const i of Ri) { + let o = this.planes[r]; let a = this.planes[r + 1]; + o || (o = this.planes[r] = new nt()), a || (a = this.planes[r + 1] = new nt()); + const c = Mi.copy(i).scale(-s).add(n); + o.fromPointNormal(c, i); + const u = Mi.copy(i).scale(s).add(n); const l = ad.copy(i).negate(); + a.fromPointNormal(u, l), r += 2; + } + return this; + } + + computeVisibility (t) { + let n = pt.INSIDE; + for (const s of this.planes) { + switch (t.intersectPlane(s)) { + case pt.OUTSIDE: + return pt.OUTSIDE; + case pt.INTERSECTING: + n = pt.INTERSECTING; + break; + } + } + return n; + } + + computeVisibilityWithPlaneMask (t, n) { + if (j(Number.isFinite(n), 'parentPlaneMask is required.'), n === dt.MASK_OUTSIDE || n === dt.MASK_INSIDE) { return n; } + let s = dt.MASK_INSIDE; + const r = this.planes; + for (let i = 0; i < this.planes.length; ++i) { + const o = i < 31 ? 1 << i : 0; + if (i < 31 && !(n & o)) { continue; } + const a = r[i]; const c = t.intersectPlane(a); + if (c === pt.OUTSIDE) { return dt.MASK_OUTSIDE; } + c === pt.INTERSECTING && (s |= o); + } + return s; + } +} +x(dt, 'MASK_OUTSIDE', 4294967295); +x(dt, 'MASK_INSIDE', 0); +x(dt, 'MASK_INDETERMINATE', 2147483647); +const cd = new A(); const ud = new A(); const ld = new A(); const hd = new A(); const fd = new A(); +class Fn { + constructor (t = {}) { + x(this, 'left', void 0), x(this, '_left', void 0), x(this, 'right', void 0), x(this, '_right', void 0), x(this, 'top', void 0), x(this, '_top', void 0), x(this, 'bottom', void 0), x(this, '_bottom', void 0), x(this, 'near', void 0), x(this, '_near', void 0), x(this, 'far', void 0), x(this, '_far', void 0), x(this, '_cullingVolume', new dt([new nt(), new nt(), new nt(), new nt(), new nt(), new nt()])), x(this, '_perspectiveMatrix', new V()), x(this, '_infinitePerspective', new V()); + const { + near: n = 1, + far: s = 5e8 + } = t; + this.left = t.left, this._left = void 0, this.right = t.right, this._right = void 0, this.top = t.top, this._top = void 0, this.bottom = t.bottom, this._bottom = void 0, this.near = n, this._near = n, this.far = s, this._far = s; + } + + clone () { + return new Fn({ + right: this.right, + left: this.left, + top: this.top, + bottom: this.bottom, + near: this.near, + far: this.far + }); + } + + equals (t) { + return t && t instanceof Fn && this.right === t.right && this.left === t.left && this.top === t.top && this.bottom === t.bottom && this.near === t.near && this.far === t.far; + } + + get projectionMatrix () { + return this._update(), this._perspectiveMatrix; + } + + get infiniteProjectionMatrix () { + return this._update(), this._infinitePerspective; + } + + computeCullingVolume (t, n, s) { + j(t, 'position is required.'), j(n, 'direction is required.'), j(s, 'up is required.'); + const r = this._cullingVolume.planes; + s = cd.copy(s).normalize(); + const i = ud.copy(n).cross(s).normalize(); const o = ld.copy(n).multiplyByScalar(this.near).add(t); const a = hd.copy(n).multiplyByScalar(this.far).add(t); + let c = fd; + return c.copy(i).multiplyByScalar(this.left).add(o).subtract(t).cross(s), r[0].fromPointNormal(t, c), c.copy(i).multiplyByScalar(this.right).add(o).subtract(t).cross(s).negate(), r[1].fromPointNormal(t, c), c.copy(s).multiplyByScalar(this.bottom).add(o).subtract(t).cross(i).negate(), r[2].fromPointNormal(t, c), c.copy(s).multiplyByScalar(this.top).add(o).subtract(t).cross(i), r[3].fromPointNormal(t, c), c = new A().copy(n), r[4].fromPointNormal(o, c), c.negate(), r[5].fromPointNormal(a, c), this._cullingVolume; + } + + getPixelDimensions (t, n, s, r) { + this._update(), j(Number.isFinite(t) && Number.isFinite(n)), j(t > 0), j(n > 0), j(s > 0), j(r); + const i = 1 / this.near; + let o = this.top * i; + const a = 2 * s * o / n; + o = this.right * i; + const c = 2 * s * o / t; + return r.x = c, r.y = a, r; + } + + _update () { + j(Number.isFinite(this.right) && Number.isFinite(this.left) && Number.isFinite(this.top) && Number.isFinite(this.bottom) && Number.isFinite(this.near) && Number.isFinite(this.far)); + const { + top: t, + bottom: n, + right: s, + left: r, + near: i, + far: o + } = this; + (t !== this._top || n !== this._bottom || r !== this._left || s !== this._right || i !== this._near || o !== this._far) && (j(this.near > 0 && this.near < this.far, 'near must be greater than zero and less than far.'), this._left = r, this._right = s, this._top = t, this._bottom = n, this._near = i, this._far = o, this._perspectiveMatrix = new V().frustum({ + left: r, + right: s, + bottom: n, + top: t, + near: i, + far: o + }), this._infinitePerspective = new V().frustum({ + left: r, + right: s, + bottom: n, + top: t, + near: i, + far: 1 / 0 + })); + } +} +const dd = (e) => e !== null && typeof e < 'u'; +class Dn { + constructor (t = {}) { + x(this, '_offCenterFrustum', new Fn()), x(this, 'fov', void 0), x(this, '_fov', void 0), x(this, '_fovy', void 0), x(this, '_sseDenominator', void 0), x(this, 'aspectRatio', void 0), x(this, '_aspectRatio', void 0), x(this, 'near', void 0), x(this, '_near', void 0), x(this, 'far', void 0), x(this, '_far', void 0), x(this, 'xOffset', void 0), x(this, '_xOffset', void 0), x(this, 'yOffset', void 0), x(this, '_yOffset', void 0); + const { + fov: n, + aspectRatio: s, + near: r = 1, + far: i = 5e8, + xOffset: o = 0, + yOffset: a = 0 + } = t; + this.fov = n, this.aspectRatio = s, this.near = r, this.far = i, this.xOffset = o, this.yOffset = a; + } + + clone () { + return new Dn({ + aspectRatio: this.aspectRatio, + fov: this.fov, + near: this.near, + far: this.far + }); + } + + equals (t) { + return !dd(t) || !(t instanceof Dn) ? !1 : (this._update(), t._update(), this.fov === t.fov && this.aspectRatio === t.aspectRatio && this.near === t.near && this.far === t.far && this._offCenterFrustum.equals(t._offCenterFrustum)); + } + + get projectionMatrix () { + return this._update(), this._offCenterFrustum.projectionMatrix; + } + + get infiniteProjectionMatrix () { + return this._update(), this._offCenterFrustum.infiniteProjectionMatrix; + } + + get fovy () { + return this._update(), this._fovy; + } + + get sseDenominator () { + return this._update(), this._sseDenominator; + } + + computeCullingVolume (t, n, s) { + return this._update(), this._offCenterFrustum.computeCullingVolume(t, n, s); + } + + getPixelDimensions (t, n, s, r) { + return this._update(), this._offCenterFrustum.getPixelDimensions(t, n, s, r || new Wn()); + } + + _update () { + j(Number.isFinite(this.fov) && Number.isFinite(this.aspectRatio) && Number.isFinite(this.near) && Number.isFinite(this.far)); + const t = this._offCenterFrustum; + (this.fov !== this._fov || this.aspectRatio !== this._aspectRatio || this.near !== this._near || this.far !== this._far || this.xOffset !== this._xOffset || this.yOffset !== this._yOffset) && (j(this.fov >= 0 && this.fov < Math.PI), j(this.aspectRatio > 0), j(this.near >= 0 && this.near < this.far), this._aspectRatio = this.aspectRatio, this._fov = this.fov, this._fovy = this.aspectRatio <= 1 ? this.fov : Math.atan(Math.tan(this.fov * 0.5) / this.aspectRatio) * 2, this._near = this.near, this._far = this.far, this._sseDenominator = 2 * Math.tan(0.5 * this._fovy), this._xOffset = this.xOffset, this._yOffset = this.yOffset, t.top = this.near * Math.tan(0.5 * this._fovy), t.bottom = -t.top, t.right = this.aspectRatio * t.top, t.left = -t.right, t.near = this.near, t.far = this.far, t.right += this.xOffset, t.left += this.xOffset, t.top += this.yOffset, t.bottom += this.yOffset); + } +} +new A(); +new A(); +new A(); +new A(); +new A(); +new A(); +new A(); +new A(); +new A(); +new A(); +new A(); +new A(); +const Ot = new X(); const md = new X(); const gd = new X(); const fn = new X(); const Si = new X(); +function Ad (e, t = {}) { + const n = Hf; const s = 10; + let r = 0; let i = 0; + const o = md; const a = gd; + o.identity(), a.copy(e); + const c = n * pd(a); + for (; i < s && yd(a) > c;) { Bd(a, fn), Si.copy(fn).transpose(), a.multiplyRight(fn), a.multiplyLeft(Si), o.multiplyRight(fn), ++r > 2 && (++i, r = 0); } + return t.unitary = o.toTarget(t.unitary), t.diagonal = a.toTarget(t.diagonal), t; +} +function pd (e) { + let t = 0; + for (let n = 0; n < 9; ++n) { + const s = e[n]; + t += s * s; + } + return Math.sqrt(t); +} +const zs = [1, 0, 0]; const Ws = [2, 2, 1]; +function yd (e) { + let t = 0; + for (let n = 0; n < 3; ++n) { + const s = e[Ot.getElementIndex(Ws[n], zs[n])]; + t += 2 * s * s; + } + return Math.sqrt(t); +} +function Bd (e, t) { + const n = xa; + let s = 0; let r = 1; + for (let u = 0; u < 3; ++u) { + const l = Math.abs(e[Ot.getElementIndex(Ws[u], zs[u])]); + l > s && (r = u, s = l); + } + const i = zs[r]; const o = Ws[r]; + let a = 1; let c = 0; + if (Math.abs(e[Ot.getElementIndex(o, i)]) > n) { + const u = e[Ot.getElementIndex(o, o)]; const l = e[Ot.getElementIndex(i, i)]; const h = e[Ot.getElementIndex(o, i)]; const f = (u - l) / 2 / h; + let d; + f < 0 ? d = -1 / (-f + Math.sqrt(1 + f * f)) : d = 1 / (f + Math.sqrt(1 + f * f)), a = 1 / Math.sqrt(1 + d * d), c = d * a; + } + return X.IDENTITY.to(t), t[Ot.getElementIndex(i, i)] = t[Ot.getElementIndex(o, o)] = a, t[Ot.getElementIndex(o, i)] = c, t[Ot.getElementIndex(i, o)] = -c, t; +} +const Vt = new A(); const Cd = new A(); const Ed = new A(); const Td = new A(); const bd = new A(); const _d = new X(); const wd = { + diagonal: new X(), + unitary: new X() +}; +function Rd (e, t = new qe()) { + if (!e || e.length === 0) { return t.halfAxes = new X([0, 0, 0, 0, 0, 0, 0, 0, 0]), t.center = new A(), t; } + const n = e.length; const s = new A(0, 0, 0); + for (const v of e) { s.add(v); } + const r = 1 / n; + s.multiplyByScalar(r); + let i = 0; let o = 0; let a = 0; let c = 0; let u = 0; let l = 0; + for (const v of e) { + const L = Vt.copy(v).subtract(s); + i += L.x * L.x, o += L.x * L.y, a += L.x * L.z, c += L.y * L.y, u += L.y * L.z, l += L.z * L.z; + } + i *= r, o *= r, a *= r, c *= r, u *= r, l *= r; + const h = _d; + h[0] = i, h[1] = o, h[2] = a, h[3] = o, h[4] = c, h[5] = u, h[6] = a, h[7] = u, h[8] = l; + const { + unitary: f + } = Ad(h, wd); const d = t.halfAxes.copy(f); + let m = d.getColumn(0, Ed); let g = d.getColumn(1, Td); let y = d.getColumn(2, bd); let E = -Number.MAX_VALUE; let R = -Number.MAX_VALUE; let B = -Number.MAX_VALUE; let C = Number.MAX_VALUE; let M = Number.MAX_VALUE; let b = Number.MAX_VALUE; + for (const v of e) { Vt.copy(v), E = Math.max(Vt.dot(m), E), R = Math.max(Vt.dot(g), R), B = Math.max(Vt.dot(y), B), C = Math.min(Vt.dot(m), C), M = Math.min(Vt.dot(g), M), b = Math.min(Vt.dot(y), b); } + m = m.multiplyByScalar(0.5 * (C + E)), g = g.multiplyByScalar(0.5 * (M + R)), y = y.multiplyByScalar(0.5 * (b + B)), t.center.copy(m).add(g).add(y); + const O = Cd.set(E - C, R - M, B - b).multiplyByScalar(0.5); const F = new X([O[0], 0, 0, 0, O[1], 0, 0, 0, O[2]]); + return t.halfAxes.multiplyRight(F), t; +} +const Ii = (function (e) { + return e[e.ADD = 1] = 'ADD', e[e.REPLACE = 2] = 'REPLACE', e; +}({})); const dn = (function (e) { + return e.EMPTY = 'empty', e.SCENEGRAPH = 'scenegraph', e.POINTCLOUD = 'pointcloud', e.MESH = 'mesh', e; +}({})); const Md = (function (e) { + return e.I3S = 'I3S', e.TILES3D = 'TILES3D', e; +}({})); const Qn = (function (e) { + return e.GEOMETRIC_ERROR = 'geometricError', e.MAX_SCREEN_THRESHOLD = 'maxScreenThreshold', e; +}({})); +const va = '4.1.1'; const _e = { + COMPOSITE: 'cmpt', + POINT_CLOUD: 'pnts', + BATCHED_3D_MODEL: 'b3dm', + INSTANCED_3D_MODEL: 'i3dm', + GEOMETRY: 'geom', + VECTOR: 'vect', + GLTF: 'glTF' +}; +function Oa (e, t, n) { + z(e instanceof ArrayBuffer); + const s = new TextDecoder('utf8'); const r = new Uint8Array(e, t, n); + return s.decode(r); +} +function Sd (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; + const n = new DataView(e); + return `${String.fromCharCode(n.getUint8(t + 0))}${String.fromCharCode(n.getUint8(t + 1))}${String.fromCharCode(n.getUint8(t + 2))}${String.fromCharCode(n.getUint8(t + 3))}`; +} +const Id = '4.1.1'; const xd = { + name: 'Draco', + id: 'draco', + module: 'draco', + version: Id, + worker: !0, + extensions: ['drc'], + mimeTypes: ['application/octet-stream'], + binary: !0, + tests: ['DRACO'], + options: { + draco: { + decoderType: typeof WebAssembly === 'object' ? 'wasm' : 'js', + libraryPath: 'libs/', + extraAttributes: {}, + attributeNameEntry: void 0 + } + } +}; +function vd (e, t, n) { + const s = Fa(t.metadata); const r = []; const i = Od(t.attributes); + for (const o in e) { + const a = e[o]; const c = xi(o, a, i[o]); + r.push(c); + } + if (n) { + const o = xi('indices', n); + r.push(o); + } + return { + fields: r, + metadata: s + }; +} +function Od (e) { + const t = {}; + for (const n in e) { + const s = e[n]; + t[s.name || 'undefined'] = s; + } + return t; +} +function xi (e, t, n) { + const s = n ? Fa(n.metadata) : void 0; + return ih(e, t, s); +} +function Fa (e) { + Object.entries(e); + const t = {}; + for (const n in e) { t[`${n}.string`] = JSON.stringify(e[n]); } + return t; +} +const vi = { + POSITION: 'POSITION', + NORMAL: 'NORMAL', + COLOR: 'COLOR_0', + TEX_COORD: 'TEXCOORD_0' +}; const Fd = { + 1: Int8Array, + 2: Uint8Array, + 3: Int16Array, + 4: Uint16Array, + 5: Int32Array, + 6: Uint32Array, + 9: Float32Array +}; const Dd = 4; +class Ld { + constructor (t) { + this.draco = void 0, this.decoder = void 0, this.metadataQuerier = void 0, this.draco = t, this.decoder = new this.draco.Decoder(), this.metadataQuerier = new this.draco.MetadataQuerier(); + } + + destroy () { + this.draco.destroy(this.decoder), this.draco.destroy(this.metadataQuerier); + } + + parseSync (t) { + const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + const s = new this.draco.DecoderBuffer(); + s.Init(new Int8Array(t), t.byteLength), this._disableAttributeTransforms(n); + const r = this.decoder.GetEncodedGeometryType(s); const i = r === this.draco.TRIANGULAR_MESH ? new this.draco.Mesh() : new this.draco.PointCloud(); + try { + let o; + switch (r) { + case this.draco.TRIANGULAR_MESH: + o = this.decoder.DecodeBufferToMesh(s, i); + break; + case this.draco.POINT_CLOUD: + o = this.decoder.DecodeBufferToPointCloud(s, i); + break; + default: + throw new Error('DRACO: Unknown geometry type.'); + } + if (!o.ok() || !i.ptr) { + const f = `DRACO decompression failed: ${o.error_msg()}`; + throw new Error(f); + } + const a = this._getDracoLoaderData(i, r, n); const c = this._getMeshData(i, a, n); const u = rh(c.attributes); const l = vd(c.attributes, a, c.indices); + return { + loader: 'draco', + loaderData: a, + header: { + vertexCount: i.num_points(), + boundingBox: u + }, + ...c, + schema: l + }; + } finally { + this.draco.destroy(s), i && this.draco.destroy(i); + } + } + + _getDracoLoaderData (t, n, s) { + const r = this._getTopLevelMetadata(t); const i = this._getDracoAttributes(t, s); + return { + geometry_type: n, + num_attributes: t.num_attributes(), + num_points: t.num_points(), + num_faces: t instanceof this.draco.Mesh ? t.num_faces() : 0, + metadata: r, + attributes: i + }; + } + + _getDracoAttributes (t, n) { + const s = {}; + for (let r = 0; r < t.num_attributes(); r++) { + const i = this.decoder.GetAttribute(t, r); const o = this._getAttributeMetadata(t, r); + s[i.unique_id()] = { + unique_id: i.unique_id(), + attribute_type: i.attribute_type(), + data_type: i.data_type(), + num_components: i.num_components(), + byte_offset: i.byte_offset(), + byte_stride: i.byte_stride(), + normalized: i.normalized(), + attribute_index: r, + metadata: o + }; + const a = this._getQuantizationTransform(i, n); + a && (s[i.unique_id()].quantization_transform = a); + const c = this._getOctahedronTransform(i, n); + c && (s[i.unique_id()].octahedron_transform = c); + } + return s; + } + + _getMeshData (t, n, s) { + const r = this._getMeshAttributes(n, t, s); + if (!r.POSITION) { throw new Error('DRACO: No position attribute found.'); } + if (t instanceof this.draco.Mesh) { + switch (s.topology) { + case 'triangle-strip': + return { + topology: 'triangle-strip', + mode: 4, + attributes: r, + indices: { + value: this._getTriangleStripIndices(t), + size: 1 + } + }; + case 'triangle-list': + default: + return { + topology: 'triangle-list', + mode: 5, + attributes: r, + indices: { + value: this._getTriangleListIndices(t), + size: 1 + } + }; + } + } + return { + topology: 'point-list', + mode: 0, + attributes: r + }; + } + + _getMeshAttributes (t, n, s) { + const r = {}; + for (const i of Object.values(t.attributes)) { + const o = this._deduceAttributeName(i, s); + i.name = o; + const { + value: a, + size: c + } = this._getAttributeValues(n, i); + r[o] = { + value: a, + size: c, + byteOffset: i.byte_offset, + byteStride: i.byte_stride, + normalized: i.normalized + }; + } + return r; + } + + _getTriangleListIndices (t) { + const s = t.num_faces() * 3; const r = s * Dd; const i = this.draco._malloc(r); + try { + return this.decoder.GetTrianglesUInt32Array(t, r, i), new Uint32Array(this.draco.HEAPF32.buffer, i, s).slice(); + } finally { + this.draco._free(i); + } + } + + _getTriangleStripIndices (t) { + const n = new this.draco.DracoInt32Array(); + try { + return this.decoder.GetTriangleStripsFromMesh(t, n), Nd(n); + } finally { + this.draco.destroy(n); + } + } + + _getAttributeValues (t, n) { + const s = Fd[n.data_type]; const r = n.num_components; const o = t.num_points() * r; const a = o * s.BYTES_PER_ELEMENT; const c = Pd(this.draco, s); + let u; + const l = this.draco._malloc(a); + try { + const h = this.decoder.GetAttribute(t, n.attribute_index); + this.decoder.GetAttributeDataArrayForAllPoints(t, h, c, a, l), u = new s(this.draco.HEAPF32.buffer, l, o).slice(); + } finally { + this.draco._free(l); + } + return { + value: u, + size: r + }; + } + + _deduceAttributeName (t, n) { + const s = t.unique_id; + for (const [o, a] of Object.entries(n.extraAttributes || {})) { + if (a === s) { return o; } + } + const r = t.attribute_type; + for (const o in vi) { + if (this.draco[o] === r) { return vi[o]; } + } + const i = n.attributeNameEntry || 'name'; + return t.metadata[i] ? t.metadata[i].string : `CUSTOM_ATTRIBUTE_${s}`; + } + + _getTopLevelMetadata (t) { + const n = this.decoder.GetMetadata(t); + return this._getDracoMetadata(n); + } + + _getAttributeMetadata (t, n) { + const s = this.decoder.GetAttributeMetadata(t, n); + return this._getDracoMetadata(s); + } + + _getDracoMetadata (t) { + if (!t || !t.ptr) { return {}; } + const n = {}; const s = this.metadataQuerier.NumEntries(t); + for (let r = 0; r < s; r++) { + const i = this.metadataQuerier.GetEntryName(t, r); + n[i] = this._getDracoMetadataField(t, i); + } + return n; + } + + _getDracoMetadataField (t, n) { + const s = new this.draco.DracoInt32Array(); + try { + this.metadataQuerier.GetIntEntryArray(t, n, s); + const r = Gd(s); + return { + int: this.metadataQuerier.GetIntEntry(t, n), + string: this.metadataQuerier.GetStringEntry(t, n), + double: this.metadataQuerier.GetDoubleEntry(t, n), + intArray: r + }; + } finally { + this.draco.destroy(s); + } + } + + _disableAttributeTransforms (t) { + const { + quantizedAttributes: n = [], + octahedronAttributes: s = [] + } = t; const r = [...n, ...s]; + for (const i of r) { this.decoder.SkipAttributeTransform(this.draco[i]); } + } + + _getQuantizationTransform (t, n) { + const { + quantizedAttributes: s = [] + } = n; const r = t.attribute_type(); + if (s.map((o) => this.decoder[o]).includes(r)) { + const o = new this.draco.AttributeQuantizationTransform(); + try { + if (o.InitFromAttribute(t)) { + return { + quantization_bits: o.quantization_bits(), + range: o.range(), + min_values: new Float32Array([1, 2, 3]).map((a) => o.min_value(a)) + }; + } + } finally { + this.draco.destroy(o); + } + } + return null; + } + + _getOctahedronTransform (t, n) { + const { + octahedronAttributes: s = [] + } = n; const r = t.attribute_type(); + if (s.map((o) => this.decoder[o]).includes(r)) { + const o = new this.draco.AttributeQuantizationTransform(); + try { + if (o.InitFromAttribute(t)) { + return { + quantization_bits: o.quantization_bits() + }; + } + } finally { + this.draco.destroy(o); + } + } + return null; + } +} +function Pd (e, t) { + switch (t) { + case Float32Array: + return e.DT_FLOAT32; + case Int8Array: + return e.DT_INT8; + case Int16Array: + return e.DT_INT16; + case Int32Array: + return e.DT_INT32; + case Uint8Array: + return e.DT_UINT8; + case Uint16Array: + return e.DT_UINT16; + case Uint32Array: + return e.DT_UINT32; + default: + return e.DT_INVALID; + } +} +function Gd (e) { + const t = e.size(); const n = new Int32Array(t); + for (let s = 0; s < t; s++) { n[s] = e.GetValue(s); } + return n; +} +function Nd (e) { + const t = e.size(); const n = new Int32Array(t); + for (let s = 0; s < t; s++) { n[s] = e.GetValue(s); } + return n; +} +const Ud = '1.5.6'; const Hd = '1.4.1'; const As = `https://www.gstatic.com/draco/versioned/decoders/${Ud}`; const ft = { + DECODER: 'draco_wasm_wrapper.js', + DECODER_WASM: 'draco_decoder.wasm', + FALLBACK_DECODER: 'draco_decoder.js', + ENCODER: 'draco_encoder.js' +}; const ps = { + [ft.DECODER]: `${As}/${ft.DECODER}`, + [ft.DECODER_WASM]: `${As}/${ft.DECODER_WASM}`, + [ft.FALLBACK_DECODER]: `${As}/${ft.FALLBACK_DECODER}`, + [ft.ENCODER]: `https://raw.githubusercontent.com/google/draco/${Hd}/javascript/${ft.ENCODER}` +}; +let we; +async function Jd (e) { + const t = e.modules || {}; + return t.draco3d + ? we = we || t.draco3d.createDecoderModule({}).then((n) => ({ + draco: n + })) + : we = we || Vd(e), await we; +} +async function Vd (e) { + let t, n; + switch (e.draco && e.draco.decoderType) { + case 'js': + t = await Zt(ps[ft.FALLBACK_DECODER], 'draco', e, ft.FALLBACK_DECODER); + break; + case 'wasm': + default: + [t, n] = await Promise.all([await Zt(ps[ft.DECODER], 'draco', e, ft.DECODER), await Zt(ps[ft.DECODER_WASM], 'draco', e, ft.DECODER_WASM)]); + } + return t = t || globalThis.DracoDecoderModule, await jd(t, n); +} +function jd (e, t) { + const n = {}; + return t && (n.wasmBinary = t), new Promise((s) => { + e({ + ...n, + onModuleLoaded: (r) => s({ + draco: r + }) + }); + }); +} +const Da = { + ...xd, + parse: kd +}; +async function kd (e, t) { + const { + draco: n + } = await Jd(t); const s = new Ld(n); + try { + return s.parseSync(e, t == null ? void 0 : t.draco); + } finally { + s.destroy(); + } +} +const Kd = { + POINTS: 0, + LINES: 1, + LINE_LOOP: 2, + LINE_STRIP: 3, + TRIANGLES: 4, + TRIANGLE_STRIP: 5, + TRIANGLE_FAN: 6 +}; const $ = { + BYTE: 5120, + UNSIGNED_BYTE: 5121, + SHORT: 5122, + UNSIGNED_SHORT: 5123, + INT: 5124, + UNSIGNED_INT: 5125, + FLOAT: 5126, + DOUBLE: 5130 +}; const G = { + ...Kd, + ...$ +}; const ys = { + [$.DOUBLE]: Float64Array, + [$.FLOAT]: Float32Array, + [$.UNSIGNED_SHORT]: Uint16Array, + [$.UNSIGNED_INT]: Uint32Array, + [$.UNSIGNED_BYTE]: Uint8Array, + [$.BYTE]: Int8Array, + [$.SHORT]: Int16Array, + [$.INT]: Int32Array +}; const zd = { + DOUBLE: $.DOUBLE, + FLOAT: $.FLOAT, + UNSIGNED_SHORT: $.UNSIGNED_SHORT, + UNSIGNED_INT: $.UNSIGNED_INT, + UNSIGNED_BYTE: $.UNSIGNED_BYTE, + BYTE: $.BYTE, + SHORT: $.SHORT, + INT: $.INT +}; const Bs = 'Failed to convert GL type'; +class Lt { + static fromTypedArray (t) { + t = ArrayBuffer.isView(t) ? t.constructor : t; + for (const n in ys) { + if (ys[n] === t) { return n; } + } + throw new Error(Bs); + } + + static fromName (t) { + const n = zd[t]; + if (!n) { throw new Error(Bs); } + return n; + } + + static getArrayType (t) { + switch (t) { + case $.UNSIGNED_SHORT_5_6_5: + case $.UNSIGNED_SHORT_4_4_4_4: + case $.UNSIGNED_SHORT_5_5_5_1: + return Uint16Array; + default: + const n = ys[t]; + if (!n) { throw new Error(Bs); } + return n; + } + } + + static getByteSize (t) { + return Lt.getArrayType(t).BYTES_PER_ELEMENT; + } + + static validate (t) { + return !!Lt.getArrayType(t); + } + + static createTypedArray (t, n) { + const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; let r = arguments.length > 3 ? arguments[3] : void 0; + r === void 0 && (r = (n.byteLength - s) / Lt.getByteSize(t)); + const i = Lt.getArrayType(t); + return new i(n, s, r); + } +} +function Wd (e, t) { + if (!e) { throw new Error(`math.gl assertion failed. ${t}`); } +} +function Xd (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0]; + const n = e >> 11 & 31; const s = e >> 5 & 63; const r = e & 31; + return t[0] = n << 3, t[1] = s << 2, t[2] = r << 3, t; +} +new Wn(); +new A(); +new Wn(); +new Wn(); +function Oi (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 255; + return mh(e, 0, t) / t * 2 - 1; +} +function Fi (e) { + return e < 0 ? -1 : 1; +} +function Qd (e, t, n, s) { + if (Wd(s), e < 0 || e > n || t < 0 || t > n) { throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`); } + if (s.x = Oi(e, n), s.y = Oi(t, n), s.z = 1 - (Math.abs(s.x) + Math.abs(s.y)), s.z < 0) { + const r = s.x; + s.x = (1 - Math.abs(s.y)) * Fi(r), s.y = (1 - Math.abs(r)) * Fi(s.y); + } + return s.normalize(); +} +function qd (e, t, n) { + return Qd(e, t, 255, n); +} +class br { + constructor (t, n) { + this.json = void 0, this.buffer = void 0, this.featuresLength = 0, this._cachedTypedArrays = {}, this.json = t, this.buffer = n; + } + + getExtension (t) { + return this.json.extensions && this.json.extensions[t]; + } + + hasProperty (t) { + return !!this.json[t]; + } + + getGlobalProperty (t) { + const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : G.UNSIGNED_INT; const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; + const r = this.json[t]; + return r && Number.isFinite(r.byteOffset) ? this._getTypedArrayFromBinary(t, n, s, 1, r.byteOffset) : r; + } + + getPropertyArray (t, n, s) { + const r = this.json[t]; + return r && Number.isFinite(r.byteOffset) ? ('componentType' in r && (n = Lt.fromName(r.componentType)), this._getTypedArrayFromBinary(t, n, s, this.featuresLength, r.byteOffset)) : this._getTypedArrayFromArray(t, n, r); + } + + getProperty (t, n, s, r, i) { + const o = this.json[t]; + if (!o) { return o; } + const a = this.getPropertyArray(t, n, s); + if (s === 1) { return a[r]; } + for (let c = 0; c < s; ++c) { i[c] = a[s * r + c]; } + return i; + } + + _getTypedArrayFromBinary (t, n, s, r, i) { + const o = this._cachedTypedArrays; + let a = o[t]; + return a || (a = Lt.createTypedArray(n, this.buffer.buffer, this.buffer.byteOffset + i, r * s), o[t] = a), a; + } + + _getTypedArrayFromArray (t, n, s) { + const r = this._cachedTypedArrays; + let i = r[t]; + return i || (i = Lt.createTypedArray(n, s), r[t] = i), i; + } +} +const Yd = { + SCALAR: 1, + VEC2: 2, + VEC3: 3, + VEC4: 4, + MAT2: 4, + MAT3: 9, + MAT4: 16 +}; const $d = { + SCALAR: (e, t) => e[t], + VEC2: (e, t) => [e[2 * t + 0], e[2 * t + 1]], + VEC3: (e, t) => [e[3 * t + 0], e[3 * t + 1], e[3 * t + 2]], + VEC4: (e, t) => [e[4 * t + 0], e[4 * t + 1], e[4 * t + 2], e[4 * t + 3]], + MAT2: (e, t) => [e[4 * t + 0], e[4 * t + 1], e[4 * t + 2], e[4 * t + 3]], + MAT3: (e, t) => [e[9 * t + 0], e[9 * t + 1], e[9 * t + 2], e[9 * t + 3], e[9 * t + 4], e[9 * t + 5], e[9 * t + 6], e[9 * t + 7], e[9 * t + 8]], + MAT4: (e, t) => [e[16 * t + 0], e[16 * t + 1], e[16 * t + 2], e[16 * t + 3], e[16 * t + 4], e[16 * t + 5], e[16 * t + 6], e[16 * t + 7], e[16 * t + 8], e[16 * t + 9], e[16 * t + 10], e[16 * t + 11], e[16 * t + 12], e[16 * t + 13], e[16 * t + 14], e[16 * t + 15]] +}; const Zd = { + SCALAR: (e, t, n) => { + t[n] = e; + }, + VEC2: (e, t, n) => { + t[2 * n + 0] = e[0], t[2 * n + 1] = e[1]; + }, + VEC3: (e, t, n) => { + t[3 * n + 0] = e[0], t[3 * n + 1] = e[1], t[3 * n + 2] = e[2]; + }, + VEC4: (e, t, n) => { + t[4 * n + 0] = e[0], t[4 * n + 1] = e[1], t[4 * n + 2] = e[2], t[4 * n + 3] = e[3]; + }, + MAT2: (e, t, n) => { + t[4 * n + 0] = e[0], t[4 * n + 1] = e[1], t[4 * n + 2] = e[2], t[4 * n + 3] = e[3]; + }, + MAT3: (e, t, n) => { + t[9 * n + 0] = e[0], t[9 * n + 1] = e[1], t[9 * n + 2] = e[2], t[9 * n + 3] = e[3], t[9 * n + 4] = e[4], t[9 * n + 5] = e[5], t[9 * n + 6] = e[6], t[9 * n + 7] = e[7], t[9 * n + 8] = e[8], t[9 * n + 9] = e[9]; + }, + MAT4: (e, t, n) => { + t[16 * n + 0] = e[0], t[16 * n + 1] = e[1], t[16 * n + 2] = e[2], t[16 * n + 3] = e[3], t[16 * n + 4] = e[4], t[16 * n + 5] = e[5], t[16 * n + 6] = e[6], t[16 * n + 7] = e[7], t[16 * n + 8] = e[8], t[16 * n + 9] = e[9], t[16 * n + 10] = e[10], t[16 * n + 11] = e[11], t[16 * n + 12] = e[12], t[16 * n + 13] = e[13], t[16 * n + 14] = e[14], t[16 * n + 15] = e[15]; + } +}; +function tm (e, t, n, s) { + const { + componentType: r + } = e; + z(e.componentType); + const i = typeof r === 'string' ? Lt.fromName(r) : r; const o = Yd[e.type]; const a = $d[e.type]; const c = Zd[e.type]; + return n += e.byteOffset, { + values: Lt.createTypedArray(i, t, n, o * s), + type: i, + size: o, + unpacker: a, + packer: c + }; +} +const Ft = (e) => e !== void 0; +function em (e, t, n) { + if (!t) { return null; } + let s = e.getExtension('3DTILES_batch_table_hierarchy'); + const r = t.HIERARCHY; + return r && (console.warn('3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy.'), t.extensions = t.extensions || {}, t.extensions['3DTILES_batch_table_hierarchy'] = r, s = r), s ? nm(s, n) : null; +} +function nm (e, t) { + let n, s, r; + const i = e.instancesLength; const o = e.classes; + let a = e.classIds; let c = e.parentCounts; let u = e.parentIds; let l = i; + Ft(a.byteOffset) && (a.componentType = defaultValue(a.componentType, GL.UNSIGNED_SHORT), a.type = AttributeType.SCALAR, r = getBinaryAccessor(a), a = r.createArrayBufferView(t.buffer, t.byteOffset + a.byteOffset, i)); + let h; + if (Ft(c)) { + for (Ft(c.byteOffset) && (c.componentType = defaultValue(c.componentType, GL.UNSIGNED_SHORT), c.type = AttributeType.SCALAR, r = getBinaryAccessor(c), c = r.createArrayBufferView(t.buffer, t.byteOffset + c.byteOffset, i)), h = new Uint16Array(i), l = 0, n = 0; n < i; ++n) { h[n] = l, l += c[n]; } + } + Ft(u) && Ft(u.byteOffset) && (u.componentType = defaultValue(u.componentType, GL.UNSIGNED_SHORT), u.type = AttributeType.SCALAR, r = getBinaryAccessor(u), u = r.createArrayBufferView(t.buffer, t.byteOffset + u.byteOffset, l)); + const f = o.length; + for (n = 0; n < f; ++n) { + const y = o[n].length; const E = o[n].instances; const R = getBinaryProperties(y, E, t); + o[n].instances = combine(R, E); + } + const d = new Array(f).fill(0); const m = new Uint16Array(i); + for (n = 0; n < i; ++n) { s = a[n], m[n] = d[s], ++d[s]; } + const g = { + classes: o, + classIds: a, + classIndexes: m, + parentCounts: c, + parentIndexes: h, + parentIds: u + }; + return im(g), g; +} +function Re (e, t, n) { + if (!e) { return; } + const s = e.parentCounts; + return e.parentIds ? n(e, t) : s > 0 ? sm(e, t, n) : rm(e, t, n); +} +function sm (e, t, n) { + const s = e.classIds; const r = e.parentCounts; const i = e.parentIds; const o = e.parentIndexes; const a = s.length; const c = scratchVisited; + c.length = Math.max(c.length, a); + const u = ++marker; const l = scratchStack; + for (l.length = 0, l.push(t); l.length > 0;) { + if (t = l.pop(), c[t] === u) { continue; } + c[t] = u; + const h = n(e, t); + if (Ft(h)) { return h; } + const f = r[t]; const d = o[t]; + for (let m = 0; m < f; ++m) { + const g = i[d + m]; + g !== t && l.push(g); + } + } + return null; +} +function rm (e, t, n) { + let s = !0; + for (; s;) { + const r = n(e, t); + if (Ft(r)) { return r; } + const i = e.parentIds[t]; + s = i !== t, t = i; + } + throw new Error('traverseHierarchySingleParent'); +} +function im (e) { + const n = e.classIds.length; + for (let s = 0; s < n; ++s) { La(e, s, stack); } +} +function La (e, t, n) { + const s = e.parentCounts; const r = e.parentIds; const i = e.parentIndexes; const a = e.classIds.length; + if (!Ft(r)) { return; } + assert(t < a, `Parent index ${t} exceeds the total number of instances: ${a}`), assert(n.indexOf(t) === -1, 'Circular dependency detected in the batch table hierarchy.'), n.push(t); + const c = Ft(s) ? s[t] : 1; const u = Ft(s) ? i[t] : t; + for (let l = 0; l < c; ++l) { + const h = r[u + l]; + h !== t && La(e, h, n); + } + n.pop(t); +} +function ut (e) { + return e != null; +} +const mn = (e, t) => e; const om = { + HIERARCHY: !0, + extensions: !0, + extras: !0 +}; +class Pa { + constructor (t, n, s) { + let r; + const i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; + this.json = void 0, this.binary = void 0, this.featureCount = void 0, this._extensions = void 0, this._properties = void 0, this._binaryProperties = void 0, this._hierarchy = void 0, z(s >= 0), this.json = t || {}, this.binary = n, this.featureCount = s, this._extensions = ((r = this.json) === null || r === void 0 ? void 0 : r.extensions) || {}, this._properties = {}; + for (const o in this.json) { om[o] || (this._properties[o] = this.json[o]); } + this._binaryProperties = this._initializeBinaryProperties(), i['3DTILES_batch_table_hierarchy'] && (this._hierarchy = em(this, this.json, this.binary)); + } + + getExtension (t) { + return this.json && this.json.extensions && this.json.extensions[t]; + } + + memorySizeInBytes () { + return 0; + } + + isClass (t, n) { + if (this._checkBatchId(t), z(typeof n === 'string', n), this._hierarchy) { + const s = Re(this._hierarchy, t, (r, i) => { + const o = r.classIds[i]; + return r.classes[o].name === n; + }); + return ut(s); + } + return !1; + } + + isExactClass (t, n) { + return z(typeof n === 'string', n), this.getExactClassName(t) === n; + } + + getExactClassName (t) { + if (this._checkBatchId(t), this._hierarchy) { + const n = this._hierarchy.classIds[t]; + return this._hierarchy.classes[n].name; + } + } + + hasProperty (t, n) { + return this._checkBatchId(t), z(typeof n === 'string', n), ut(this._properties[n]) || this._hasPropertyInHierarchy(t, n); + } + + getPropertyNames (t, n) { + this._checkBatchId(t), n = ut(n) ? n : [], n.length = 0; + const s = Object.keys(this._properties); + return n.push(...s), this._hierarchy && this._getPropertyNamesInHierarchy(t, n), n; + } + + getProperty (t, n) { + if (this._checkBatchId(t), z(typeof n === 'string', n), this._binaryProperties) { + const r = this._binaryProperties[n]; + if (ut(r)) { return this._getBinaryProperty(r, t); } + } + const s = this._properties[n]; + if (ut(s)) { return mn(s[t]); } + if (this._hierarchy) { + const r = this._getHierarchyProperty(t, n); + if (ut(r)) { return r; } + } + } + + setProperty (t, n, s) { + const r = this.featureCount; + if (this._checkBatchId(t), z(typeof n === 'string', n), this._binaryProperties) { + const o = this._binaryProperties[n]; + if (o) { + this._setBinaryProperty(o, t, s); + return; + } + } + if (this._hierarchy && this._setHierarchyProperty(this, t, n, s)) { return; } + let i = this._properties[n]; + ut(i) || (this._properties[n] = new Array(r), i = this._properties[n]), i[t] = mn(s); + } + + _checkBatchId (t) { + if (!(t >= 0 && t < this.featureCount)) { throw new Error('batchId not in range [0, featureCount - 1].'); } + } + + _getBinaryProperty (t, n) { + return t.unpack(t.typedArray, n); + } + + _setBinaryProperty (t, n, s) { + t.pack(s, t.typedArray, n); + } + + _initializeBinaryProperties () { + let t = null; + for (const n in this._properties) { + const s = this._properties[n]; const r = this._initializeBinaryProperty(n, s); + r && (t = t || {}, t[n] = r); + } + return t; + } + + _initializeBinaryProperty (t, n) { + if ('byteOffset' in n) { + const s = n; + z(this.binary, `Property ${t} requires a batch table binary.`), z(s.type, `Property ${t} requires a type.`); + const r = tm(s, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount); + return { + typedArray: r.values, + componentCount: r.size, + unpack: r.unpacker, + pack: r.packer + }; + } + return null; + } + + _hasPropertyInHierarchy (t, n) { + if (!this._hierarchy) { return !1; } + const s = Re(this._hierarchy, t, (r, i) => { + const o = r.classIds[i]; const a = r.classes[o].instances; + return ut(a[n]); + }); + return ut(s); + } + + _getPropertyNamesInHierarchy (t, n) { + Re(this._hierarchy, t, (s, r) => { + const i = s.classIds[r]; const o = s.classes[i].instances; + for (const a in o) { o.hasOwnProperty(a) && n.indexOf(a) === -1 && n.push(a); } + }); + } + + _getHierarchyProperty (t, n) { + return Re(this._hierarchy, t, (s, r) => { + const i = s.classIds[r]; const o = s.classes[i]; const a = s.classIndexes[r]; const c = o.instances[n]; + return ut(c) ? ut(c.typedArray) ? this._getBinaryProperty(c, a) : mn(c[a]) : null; + }); + } + + _setHierarchyProperty (t, n, s, r) { + const i = Re(this._hierarchy, n, (o, a) => { + const c = o.classIds[a]; const u = o.classes[c]; const l = o.classIndexes[a]; const h = u.instances[s]; + return ut(h) ? (z(a === n, `Inherited property "${s}" is read-only.`), ut(h.typedArray) ? this._setBinaryProperty(h, l, r) : h[l] = mn(r), !0) : !1; + }); + return ut(i); + } +} +const Cs = 4; +function qn (e, t) { + let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; + const s = new DataView(t); + if (e.magic = s.getUint32(n, !0), n += Cs, e.version = s.getUint32(n, !0), n += Cs, e.byteLength = s.getUint32(n, !0), n += Cs, e.version !== 1) { throw new Error(`3D Tile Version ${e.version} not supported`); } + return n; +} +const le = 4; const Di = 'b3dm tile in legacy format.'; +function _r (e, t, n) { + const s = new DataView(t); + let r; + e.header = e.header || {}; + let i = s.getUint32(n, !0); + n += le; + let o = s.getUint32(n, !0); + n += le; + let a = s.getUint32(n, !0); + n += le; + let c = s.getUint32(n, !0); + return n += le, a >= 570425344 ? (n -= le * 2, r = i, a = o, c = 0, i = 0, o = 0, console.warn(Di)) : c >= 570425344 && (n -= le, r = a, a = i, c = o, i = 0, o = 0, console.warn(Di)), e.header.featureTableJsonByteLength = i, e.header.featureTableBinaryByteLength = o, e.header.batchTableJsonByteLength = a, e.header.batchTableBinaryByteLength = c, e.header.batchLength = r, n; +} +function wr (e, t, n, s) { + return n = am(e, t, n), n = cm(e, t, n), n; +} +function am (e, t, n, s) { + const { + featureTableJsonByteLength: r, + featureTableBinaryByteLength: i, + batchLength: o + } = e.header || {}; + if (e.featureTableJson = { + BATCH_LENGTH: o || 0 + }, r && r > 0) { + const a = Oa(t, n, r); + e.featureTableJson = JSON.parse(a); + } + return n += r || 0, e.featureTableBinary = new Uint8Array(t, n, i), n += i || 0, n; +} +function cm (e, t, n, s) { + const { + batchTableJsonByteLength: r, + batchTableBinaryByteLength: i + } = e.header || {}; + if (r && r > 0) { + const o = Oa(t, n, r); + e.batchTableJson = JSON.parse(o), n += r, i && i > 0 && (e.batchTableBinary = new Uint8Array(t, n, i), e.batchTableBinary = new Uint8Array(e.batchTableBinary), n += i); + } + return n; +} +function Ga (e, t, n) { + if (!t && (!e || !e.batchIds || !n)) { return null; } + const { + batchIds: s, + isRGB565: r, + pointCount: i = 0 + } = e; + if (s && n) { + const o = new Uint8ClampedArray(i * 3); + for (let a = 0; a < i; a++) { + const c = s[a]; const l = n.getProperty(c, 'dimensions').map((h) => h * 255); + o[a * 3] = l[0], o[a * 3 + 1] = l[1], o[a * 3 + 2] = l[2]; + } + return { + type: G.UNSIGNED_BYTE, + value: o, + size: 3, + normalized: !0 + }; + } + if (t && r) { + const o = new Uint8ClampedArray(i * 3); + for (let a = 0; a < i; a++) { + const c = Xd(t[a]); + o[a * 3] = c[0], o[a * 3 + 1] = c[1], o[a * 3 + 2] = c[2]; + } + return { + type: G.UNSIGNED_BYTE, + value: o, + size: 3, + normalized: !0 + }; + } + return t && t.length === i * 3 + ? { + type: G.UNSIGNED_BYTE, + value: t, + size: 3, + normalized: !0 + } + : { + type: G.UNSIGNED_BYTE, + value: t || new Uint8ClampedArray(), + size: 4, + normalized: !0 + }; +} +const Li = new A(); +function um (e, t) { + if (!t) { return null; } + if (e.isOctEncoded16P) { + const n = new Float32Array((e.pointsLength || 0) * 3); + for (let s = 0; s < (e.pointsLength || 0); s++) { qd(t[s * 2], t[s * 2 + 1], Li), Li.toArray(n, s * 3); } + return { + type: G.FLOAT, + size: 2, + value: n + }; + } + return { + type: G.FLOAT, + size: 2, + value: t + }; +} +function lm (e, t, n) { + return e.isQuantized + ? n['3d-tiles'] && n['3d-tiles'].decodeQuantizedPositions + ? (e.isQuantized = !1, hm(e, t)) + : { + type: G.UNSIGNED_SHORT, + value: t, + size: 3, + normalized: !0 + } + : t; +} +function hm (e, t) { + const n = new A(); const s = new Float32Array(e.pointCount * 3); + for (let r = 0; r < e.pointCount; r++) { n.set(t[r * 3], t[r * 3 + 1], t[r * 3 + 2]).scale(1 / e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(s, r * 3); } + return s; +} +async function fm (e, t, n, s, r) { + n = qn(e, t, n), n = _r(e, t, n), n = wr(e, t, n), dm(e); + const { + featureTable: i, + batchTable: o + } = mm(e); + return await Bm(e, i, o, s, r), gm(e, i, s), Am(e, i, o), pm(e, i), n; +} +function dm (e) { + e.attributes = { + positions: null, + colors: null, + normals: null, + batchIds: null + }, e.isQuantized = !1, e.isTranslucent = !1, e.isRGB565 = !1, e.isOctEncoded16P = !1; +} +function mm (e) { + const t = new br(e.featureTableJson, e.featureTableBinary); const n = t.getGlobalProperty('POINTS_LENGTH'); + if (!Number.isFinite(n)) { throw new Error('POINTS_LENGTH must be defined'); } + t.featuresLength = n, e.featuresLength = n, e.pointsLength = n, e.pointCount = n, e.rtcCenter = t.getGlobalProperty('RTC_CENTER', G.FLOAT, 3); + const s = ym(e, t); + return { + featureTable: t, + batchTable: s + }; +} +function gm (e, t, n) { + if (e.attributes = e.attributes || { + positions: null, + colors: null, + normals: null, + batchIds: null + }, !e.attributes.positions) { + if (t.hasProperty('POSITION')) { e.attributes.positions = t.getPropertyArray('POSITION', G.FLOAT, 3); } else if (t.hasProperty('POSITION_QUANTIZED')) { + const s = t.getPropertyArray('POSITION_QUANTIZED', G.UNSIGNED_SHORT, 3); + if (e.isQuantized = !0, e.quantizedRange = 65535, e.quantizedVolumeScale = t.getGlobalProperty('QUANTIZED_VOLUME_SCALE', G.FLOAT, 3), !e.quantizedVolumeScale) { throw new Error('QUANTIZED_VOLUME_SCALE must be defined for quantized positions.'); } + if (e.quantizedVolumeOffset = t.getGlobalProperty('QUANTIZED_VOLUME_OFFSET', G.FLOAT, 3), !e.quantizedVolumeOffset) { throw new Error('QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.'); } + e.attributes.positions = lm(e, s, n); + } + } + if (!e.attributes.positions) { throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.'); } +} +function Am (e, t, n) { + if (e.attributes = e.attributes || { + positions: null, + colors: null, + normals: null, + batchIds: null + }, !e.attributes.colors) { + let s = null; + t.hasProperty('RGBA') ? (s = t.getPropertyArray('RGBA', G.UNSIGNED_BYTE, 4), e.isTranslucent = !0) : t.hasProperty('RGB') ? s = t.getPropertyArray('RGB', G.UNSIGNED_BYTE, 3) : t.hasProperty('RGB565') && (s = t.getPropertyArray('RGB565', G.UNSIGNED_SHORT, 1), e.isRGB565 = !0), e.attributes.colors = Ga(e, s, n); + } + t.hasProperty('CONSTANT_RGBA') && (e.constantRGBA = t.getGlobalProperty('CONSTANT_RGBA', G.UNSIGNED_BYTE, 4)); +} +function pm (e, t) { + if (e.attributes = e.attributes || { + positions: null, + colors: null, + normals: null, + batchIds: null + }, !e.attributes.normals) { + let n = null; + t.hasProperty('NORMAL') ? n = t.getPropertyArray('NORMAL', G.FLOAT, 3) : t.hasProperty('NORMAL_OCT16P') && (n = t.getPropertyArray('NORMAL_OCT16P', G.UNSIGNED_BYTE, 2), e.isOctEncoded16P = !0), e.attributes.normals = um(e, n); + } +} +function ym (e, t) { + let n = null; + if (!e.batchIds && t.hasProperty('BATCH_ID') && (e.batchIds = t.getPropertyArray('BATCH_ID', G.UNSIGNED_SHORT, 1), e.batchIds)) { + const s = t.getGlobalProperty('BATCH_LENGTH'); + if (!s) { throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.'); } + const { + batchTableJson: r, + batchTableBinary: i + } = e; + n = new Pa(r, i, s); + } + return n; +} +async function Bm (e, t, n, s, r) { + let i, o, a; + const c = e.batchTableJson && e.batchTableJson.extensions && e.batchTableJson.extensions['3DTILES_draco_point_compression']; + c && (a = c.properties); + const u = t.getExtension('3DTILES_draco_point_compression'); + if (u) { + o = u.properties; + const h = u.byteOffset; const f = u.byteLength; + if (!o || !Number.isFinite(h) || !f) { throw new Error('Draco properties, byteOffset, and byteLength must be defined'); } + i = (e.featureTableBinary || []).slice(h, h + f), e.hasPositions = Number.isFinite(o.POSITION), e.hasColors = Number.isFinite(o.RGB) || Number.isFinite(o.RGBA), e.hasNormals = Number.isFinite(o.NORMAL), e.hasBatchIds = Number.isFinite(o.BATCH_ID), e.isTranslucent = Number.isFinite(o.RGBA); + } + if (!i) { return !0; } + const l = { + buffer: i, + properties: { + ...o, + ...a + }, + featureTableProperties: o, + batchTableProperties: a, + dequantizeInShader: !1 + }; + return await Cm(e, l, s, r); +} +async function Cm (e, t, n, s) { + if (!s) { return; } + const r = { + ...n, + draco: { + ...n == null ? void 0 : n.draco, + extraAttributes: t.batchTableProperties || {} + } + }; + delete r['3d-tiles']; + const i = await Ke(t.buffer, Da, r, s); const o = i.attributes.POSITION && i.attributes.POSITION.value; const a = i.attributes.COLOR_0 && i.attributes.COLOR_0.value; const c = i.attributes.NORMAL && i.attributes.NORMAL.value; const u = i.attributes.BATCH_ID && i.attributes.BATCH_ID.value; const l = o && i.attributes.POSITION.value.quantization; const h = c && i.attributes.NORMAL.value.quantization; + if (l) { + const d = i.POSITION.data.quantization; const m = d.range; + e.quantizedVolumeScale = new A(m, m, m), e.quantizedVolumeOffset = new A(d.minValues), e.quantizedRange = (1 << d.quantizationBits) - 1, e.isQuantizedDraco = !0; + } + h && (e.octEncodedRange = (1 << i.NORMAL.data.quantization.quantizationBits) - 1, e.isOctEncodedDraco = !0); + const f = {}; + if (t.batchTableProperties) { + for (const d of Object.keys(t.batchTableProperties)) { i.attributes[d] && i.attributes[d].value && (f[d.toLowerCase()] = i.attributes[d].value); } + } + e.attributes = { + positions: o, + colors: Ga(e, a, void 0), + normals: c, + batchIds: u, + ...f + }; +} +const Em = '4.1.1'; +let Es; +const Tm = (Es = globalThis.loaders) === null || Es === void 0 ? void 0 : Es.parseImageNode; const Xs = typeof Image < 'u'; const Qs = typeof ImageBitmap < 'u'; const bm = !!Tm; const qs = kn ? !0 : bm; +function _m (e) { + switch (e) { + case 'auto': + return Qs || Xs || qs; + case 'imagebitmap': + return Qs; + case 'image': + return Xs; + case 'data': + return qs; + default: + throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`); + } +} +function wm () { + if (Qs) { return 'imagebitmap'; } + if (Xs) { return 'image'; } + if (qs) { return 'data'; } + throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js"); +} +function Rm (e) { + const t = Mm(e); + if (!t) { throw new Error('Not an image'); } + return t; +} +function Na (e) { + switch (Rm(e)) { + case 'data': + return e; + case 'image': + case 'imagebitmap': + const t = document.createElement('canvas'); const n = t.getContext('2d'); + if (!n) { throw new Error('getImageData'); } + return t.width = e.width, t.height = e.height, n.drawImage(e, 0, 0), n.getImageData(0, 0, e.width, e.height); + default: + throw new Error('getImageData'); + } +} +function Mm (e) { + return typeof ImageBitmap < 'u' && e instanceof ImageBitmap ? 'imagebitmap' : typeof Image < 'u' && e instanceof Image ? 'image' : e && typeof e === 'object' && e.data && e.width && e.height ? 'data' : null; +} +const Sm = /^data:image\/svg\+xml/; const Im = /\.svg((\?|#).*)?$/; +function Rr (e) { + return e && (Sm.test(e) || Im.test(e)); +} +function xm (e, t) { + if (Rr(t)) { + let s = new TextDecoder().decode(e); + try { + typeof unescape === 'function' && typeof encodeURIComponent === 'function' && (s = unescape(encodeURIComponent(s))); + } catch (i) { + throw new Error(i.message); + } + return `data:image/svg+xml;base64,${btoa(s)}`; + } + return Ua(e, t); +} +function Ua (e, t) { + if (Rr(t)) { throw new Error('SVG cannot be parsed directly to imagebitmap'); } + return new Blob([new Uint8Array(e)]); +} +async function Ha (e, t, n) { + const s = xm(e, n); const r = self.URL || self.webkitURL; const i = typeof s !== 'string' && r.createObjectURL(s); + try { + return await vm(i || s, t); + } finally { + i && r.revokeObjectURL(i); + } +} +async function vm (e, t) { + const n = new Image(); + return n.src = e, t.image && t.image.decode && n.decode + ? (await n.decode(), n) + : await new Promise((s, r) => { + try { + n.onload = () => s(n), n.onerror = (i) => { + const o = i instanceof Error ? i.message : 'error'; + r(new Error(o)); + }; + } catch (i) { + r(i); + } + }); +} +const Om = {}; +let Pi = !0; +async function Fm (e, t, n) { + let s; + Rr(n) ? s = await Ha(e, t, n) : s = Ua(e, n); + const r = t && t.imagebitmap; + return await Dm(s, r); +} +async function Dm (e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; + if ((Lm(t) || !Pi) && (t = null), t) { + try { + return await createImageBitmap(e, t); + } catch (n) { + console.warn(n), Pi = !1; + } + } + return await createImageBitmap(e); +} +function Lm (e) { + for (const t in e || Om) { return !1; } + return !0; +} +function Pm (e) { + return !Hm(e, 'ftyp', 4) || !(e[8] & 96) ? null : Gm(e); +} +function Gm (e) { + switch (Nm(e, 8, 12).replace('\0', ' ').trim()) { + case 'avif': + case 'avis': + return { + extension: 'avif', + mimeType: 'image/avif' + }; + default: + return null; + } +} +function Nm (e, t, n) { + return String.fromCharCode(...e.slice(t, n)); +} +function Um (e) { + return [...e].map((t) => t.charCodeAt(0)); +} +function Hm (e, t) { + const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; + const s = Um(t); + for (let r = 0; r < s.length; ++r) { + if (s[r] !== e[r + n]) { return !1; } + } + return !0; +} +const Dt = !1; const De = !0; +function Mr (e) { + const t = Ye(e); + return Vm(t) || Km(t) || jm(t) || km(t) || Jm(t); +} +function Jm (e) { + const t = new Uint8Array(e instanceof DataView ? e.buffer : e); const n = Pm(t); + return n + ? { + mimeType: n.mimeType, + width: 0, + height: 0 + } + : null; +} +function Vm (e) { + const t = Ye(e); + return t.byteLength >= 24 && t.getUint32(0, Dt) === 2303741511 + ? { + mimeType: 'image/png', + width: t.getUint32(16, Dt), + height: t.getUint32(20, Dt) + } + : null; +} +function jm (e) { + const t = Ye(e); + return t.byteLength >= 10 && t.getUint32(0, Dt) === 1195984440 + ? { + mimeType: 'image/gif', + width: t.getUint16(6, De), + height: t.getUint16(8, De) + } + : null; +} +function km (e) { + const t = Ye(e); + return t.byteLength >= 14 && t.getUint16(0, Dt) === 16973 && t.getUint32(2, De) === t.byteLength + ? { + mimeType: 'image/bmp', + width: t.getUint32(18, De), + height: t.getUint32(22, De) + } + : null; +} +function Km (e) { + const t = Ye(e); + if (!(t.byteLength >= 3 && t.getUint16(0, Dt) === 65496 && t.getUint8(2) === 255)) { return null; } + const { + tableMarkers: s, + sofMarkers: r + } = zm(); + let i = 2; + for (; i + 9 < t.byteLength;) { + const o = t.getUint16(i, Dt); + if (r.has(o)) { + return { + mimeType: 'image/jpeg', + height: t.getUint16(i + 5, Dt), + width: t.getUint16(i + 7, Dt) + }; + } + if (!s.has(o)) { return null; } + i += 2, i += t.getUint16(i, Dt); + } + return null; +} +function zm () { + const e = /* @__PURE__ */ new Set([65499, 65476, 65484, 65501, 65534]); + for (let n = 65504; n < 65520; ++n) { e.add(n); } + return { + tableMarkers: e, + sofMarkers: /* @__PURE__ */ new Set([65472, 65473, 65474, 65475, 65477, 65478, 65479, 65481, 65482, 65483, 65485, 65486, 65487, 65502]) + }; +} +function Ye (e) { + if (e instanceof DataView) { return e; } + if (ArrayBuffer.isView(e)) { return new DataView(e.buffer); } + if (e instanceof ArrayBuffer) { return new DataView(e); } + throw new Error('toDataView'); +} +async function Wm (e, t) { + let n; + const { + mimeType: s + } = Mr(e) || {}; const r = (n = globalThis.loaders) === null || n === void 0 ? void 0 : n.parseImageNode; + return z(r), await r(e, s); +} +async function Xm (e, t, n) { + t = t || {}; + const r = (t.image || {}).type || 'auto'; const { + url: i + } = n || {}; const o = Qm(r); + let a; + switch (o) { + case 'imagebitmap': + a = await Fm(e, t, i); + break; + case 'image': + a = await Ha(e, t, i); + break; + case 'data': + a = await Wm(e); + break; + default: + z(!1); + } + return r === 'data' && (a = Na(a)), a; +} +function Qm (e) { + switch (e) { + case 'auto': + case 'data': + return wm(); + default: + return _m(e), e; + } +} +const qm = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'svg', 'avif']; const Ym = ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/avif', 'image/bmp', 'image/vnd.microsoft.icon', 'image/svg+xml']; const $m = { + image: { + type: 'auto', + decode: !0 + } +}; const Zm = { + id: 'image', + module: 'images', + name: 'Images', + version: Em, + mimeTypes: Ym, + extensions: qm, + parse: Xm, + tests: [(e) => !!Mr(new DataView(e))], + options: $m +}; const Ts = {}; +function tg (e) { + if (Ts[e] === void 0) { + const t = kn ? ng(e) : eg(e); + Ts[e] = t; + } + return Ts[e]; +} +function eg (e) { + let t, n; + const s = ['image/png', 'image/jpeg', 'image/gif']; const r = ((t = globalThis.loaders) === null || t === void 0 ? void 0 : t.imageFormatsNode) || s; + return !!((n = globalThis.loaders) === null || n === void 0 ? void 0 : n.parseImageNode) && r.includes(e); +} +function ng (e) { + switch (e) { + case 'image/avif': + case 'image/webp': + return sg(e); + default: + return !0; + } +} +function sg (e) { + try { + return document.createElement('canvas').toDataURL(e).indexOf(`data:${e}`) === 0; + } catch { + return !1; + } +} +function yt (e, t) { + if (!e) { throw new Error(t || 'assert failed: gltf'); } +} +const Ja = { + SCALAR: 1, + VEC2: 2, + VEC3: 3, + VEC4: 4, + MAT2: 4, + MAT3: 9, + MAT4: 16 +}; const Va = { + 5120: 1, + 5121: 1, + 5122: 2, + 5123: 2, + 5125: 4, + 5126: 4 +}; const rg = 1.33; const Gi = ['SCALAR', 'VEC2', 'VEC3', 'VEC4']; const ig = [[Int8Array, 5120], [Uint8Array, 5121], [Int16Array, 5122], [Uint16Array, 5123], [Uint32Array, 5125], [Float32Array, 5126], [Float64Array, 5130]]; const og = new Map(ig); const ag = { + SCALAR: 1, + VEC2: 2, + VEC3: 3, + VEC4: 4, + MAT2: 4, + MAT3: 9, + MAT4: 16 +}; const cg = { + 5120: 1, + 5121: 1, + 5122: 2, + 5123: 2, + 5125: 4, + 5126: 4 +}; const ug = { + 5120: Int8Array, + 5121: Uint8Array, + 5122: Int16Array, + 5123: Uint16Array, + 5125: Uint32Array, + 5126: Float32Array +}; +function ja (e) { + return Gi[e - 1] || Gi[0]; +} +function Sr (e) { + const t = og.get(e.constructor); + if (!t) { throw new Error('Illegal typed array'); } + return t; +} +function Ir (e, t) { + const n = ug[e.componentType]; const s = ag[e.type]; const r = cg[e.componentType]; const i = e.count * s; const o = e.count * s * r; + yt(o >= 0 && o <= t.byteLength); + const a = Va[e.componentType]; const c = Ja[e.type]; + return { + ArrayType: n, + length: i, + byteLength: o, + componentByteSize: a, + numberOfComponentsInElement: c + }; +} +function ka (e) { + let { + images: t, + bufferViews: n + } = e; + t = t || [], n = n || []; + const s = t.map((o) => o.bufferView); + n = n.filter((o) => !s.includes(o)); + const r = n.reduce((o, a) => o + a.byteLength, 0); const i = t.reduce((o, a) => { + const { + width: c, + height: u + } = a.image; + return o + c * u; + }, 0); + return r + Math.ceil(4 * i * rg); +} +function lg (e, t, n) { + const s = e.bufferViews[n]; + yt(s); + const r = s.buffer; const i = t[r]; + yt(i); + const o = (s.byteOffset || 0) + i.byteOffset; + return new Uint8Array(i.arrayBuffer, o, s.byteLength); +} +function hg (e, t, n) { + let s, r; + const i = typeof n === 'number' ? (s = e.accessors) === null || s === void 0 ? void 0 : s[n] : n; + if (!i) { throw new Error(`No gltf accessor ${JSON.stringify(n)}`); } + const o = (r = e.bufferViews) === null || r === void 0 ? void 0 : r[i.bufferView || 0]; + if (!o) { throw new Error(`No gltf buffer view for accessor ${o}`); } + const { + arrayBuffer: a, + byteOffset: c + } = t[o.buffer]; const u = (c || 0) + (i.byteOffset || 0) + (o.byteOffset || 0); const { + ArrayType: l, + length: h, + componentByteSize: f, + numberOfComponentsInElement: d + } = Ir(i, o); const m = f * d; const g = o.byteStride || m; + if (typeof o.byteStride > 'u' || o.byteStride === m) { return new l(a, u, h); } + const y = new l(h); + for (let E = 0; E < i.count; E++) { + const R = new l(a, u + E * g, d); + y.set(R, E * d); + } + return y; +} +function fg () { + return { + asset: { + version: '2.0', + generator: 'loaders.gl' + }, + buffers: [], + extensions: {}, + extensionsRequired: [], + extensionsUsed: [] + }; +} +class ot { + constructor (t) { + this.gltf = void 0, this.sourceBuffers = void 0, this.byteLength = void 0, this.gltf = { + json: (t == null ? void 0 : t.json) || fg(), + buffers: (t == null ? void 0 : t.buffers) || [], + images: (t == null ? void 0 : t.images) || [] + }, this.sourceBuffers = [], this.byteLength = 0, this.gltf.buffers && this.gltf.buffers[0] && (this.byteLength = this.gltf.buffers[0].byteLength, this.sourceBuffers = [this.gltf.buffers[0]]); + } + + get json () { + return this.gltf.json; + } + + getApplicationData (t) { + return this.json[t]; + } + + getExtraData (t) { + return (this.json.extras || {})[t]; + } + + hasExtension (t) { + const n = this.getUsedExtensions().find((r) => r === t); const s = this.getRequiredExtensions().find((r) => r === t); + return typeof n === 'string' || typeof s === 'string'; + } + + getExtension (t) { + const n = this.getUsedExtensions().find((r) => r === t); const s = this.json.extensions || {}; + return n ? s[t] : null; + } + + getRequiredExtension (t) { + return this.getRequiredExtensions().find((s) => s === t) ? this.getExtension(t) : null; + } + + getRequiredExtensions () { + return this.json.extensionsRequired || []; + } + + getUsedExtensions () { + return this.json.extensionsUsed || []; + } + + getRemovedExtensions () { + return this.json.extensionsRemoved || []; + } + + getObjectExtension (t, n) { + return (t.extensions || {})[n]; + } + + getScene (t) { + return this.getObject('scenes', t); + } + + getNode (t) { + return this.getObject('nodes', t); + } + + getSkin (t) { + return this.getObject('skins', t); + } + + getMesh (t) { + return this.getObject('meshes', t); + } + + getMaterial (t) { + return this.getObject('materials', t); + } + + getAccessor (t) { + return this.getObject('accessors', t); + } + + getTexture (t) { + return this.getObject('textures', t); + } + + getSampler (t) { + return this.getObject('samplers', t); + } + + getImage (t) { + return this.getObject('images', t); + } + + getBufferView (t) { + return this.getObject('bufferViews', t); + } + + getBuffer (t) { + return this.getObject('buffers', t); + } + + getObject (t, n) { + if (typeof n === 'object') { return n; } + const s = this.json[t] && this.json[t][n]; + if (!s) { throw new Error(`glTF file error: Could not find ${t}[${n}]`); } + return s; + } + + getTypedArrayForBufferView (t) { + t = this.getBufferView(t); + const n = t.buffer; const s = this.gltf.buffers[n]; + yt(s); + const r = (t.byteOffset || 0) + s.byteOffset; + return new Uint8Array(s.arrayBuffer, r, t.byteLength); + } + + getTypedArrayForAccessor (t) { + const n = this.getAccessor(t); + return hg(this.gltf.json, this.gltf.buffers, n); + } + + getTypedArrayForImageData (t) { + t = this.getAccessor(t); + const n = this.getBufferView(t.bufferView); const r = this.getBuffer(n.buffer).data; const i = n.byteOffset || 0; + return new Uint8Array(r, i, n.byteLength); + } + + addApplicationData (t, n) { + return this.json[t] = n, this; + } + + addExtraData (t, n) { + return this.json.extras = this.json.extras || {}, this.json.extras[t] = n, this; + } + + addObjectExtension (t, n, s) { + return t.extensions = t.extensions || {}, t.extensions[n] = s, this.registerUsedExtension(n), this; + } + + setObjectExtension (t, n, s) { + const r = t.extensions || {}; + r[n] = s; + } + + removeObjectExtension (t, n) { + const s = (t == null ? void 0 : t.extensions) || {}; + if (s[n]) { + this.json.extensionsRemoved = this.json.extensionsRemoved || []; + const r = this.json.extensionsRemoved; + r.includes(n) || r.push(n); + } + delete s[n]; + } + + addExtension (t) { + const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + return yt(n), this.json.extensions = this.json.extensions || {}, this.json.extensions[t] = n, this.registerUsedExtension(t), n; + } + + addRequiredExtension (t) { + const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + return yt(n), this.addExtension(t, n), this.registerRequiredExtension(t), n; + } + + registerUsedExtension (t) { + this.json.extensionsUsed = this.json.extensionsUsed || [], this.json.extensionsUsed.find((n) => n === t) || this.json.extensionsUsed.push(t); + } + + registerRequiredExtension (t) { + this.registerUsedExtension(t), this.json.extensionsRequired = this.json.extensionsRequired || [], this.json.extensionsRequired.find((n) => n === t) || this.json.extensionsRequired.push(t); + } + + removeExtension (t) { + let n; + if ((n = this.json.extensions) !== null && n !== void 0 && n[t]) { + this.json.extensionsRemoved = this.json.extensionsRemoved || []; + const s = this.json.extensionsRemoved; + s.includes(t) || s.push(t); + } + this.json.extensions && delete this.json.extensions[t], this.json.extensionsRequired && this._removeStringFromArray(this.json.extensionsRequired, t), this.json.extensionsUsed && this._removeStringFromArray(this.json.extensionsUsed, t); + } + + setDefaultScene (t) { + this.json.scene = t; + } + + addScene (t) { + const { + nodeIndices: n + } = t; + return this.json.scenes = this.json.scenes || [], this.json.scenes.push({ + nodes: n + }), this.json.scenes.length - 1; + } + + addNode (t) { + const { + meshIndex: n, + matrix: s + } = t; + this.json.nodes = this.json.nodes || []; + const r = { + mesh: n + }; + return s && (r.matrix = s), this.json.nodes.push(r), this.json.nodes.length - 1; + } + + addMesh (t) { + const { + attributes: n, + indices: s, + material: r, + mode: i = 4 + } = t; const a = { + primitives: [{ + attributes: this._addAttributes(n), + mode: i + }] + }; + if (s) { + const c = this._addIndices(s); + a.primitives[0].indices = c; + } + return Number.isFinite(r) && (a.primitives[0].material = r), this.json.meshes = this.json.meshes || [], this.json.meshes.push(a), this.json.meshes.length - 1; + } + + addPointCloud (t) { + const s = { + primitives: [{ + attributes: this._addAttributes(t), + mode: 0 + }] + }; + return this.json.meshes = this.json.meshes || [], this.json.meshes.push(s), this.json.meshes.length - 1; + } + + addImage (t, n) { + const s = Mr(t); const r = n || (s == null ? void 0 : s.mimeType); const o = { + bufferView: this.addBufferView(t), + mimeType: r + }; + return this.json.images = this.json.images || [], this.json.images.push(o), this.json.images.length - 1; + } + + addBufferView (t) { + const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.byteLength; + const r = t.byteLength; + yt(Number.isFinite(r)), this.sourceBuffers = this.sourceBuffers || [], this.sourceBuffers.push(t); + const i = { + buffer: n, + byteOffset: s, + byteLength: r + }; + return this.byteLength += ze(r, 4), this.json.bufferViews = this.json.bufferViews || [], this.json.bufferViews.push(i), this.json.bufferViews.length - 1; + } + + addAccessor (t, n) { + const s = { + bufferView: t, + type: ja(n.size), + componentType: n.componentType, + count: n.count, + max: n.max, + min: n.min + }; + return this.json.accessors = this.json.accessors || [], this.json.accessors.push(s), this.json.accessors.length - 1; + } + + addBinaryBuffer (t) { + const n = arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : { + size: 3 + }; + const s = this.addBufferView(t); + let r = { + min: n.min, + max: n.max + }; + (!r.min || !r.max) && (r = this._getAccessorMinMax(t, n.size)); + const i = { + size: n.size, + componentType: Sr(t), + count: Math.round(t.length / n.size), + min: r.min, + max: r.max + }; + return this.addAccessor(s, Object.assign(i, n)); + } + + addTexture (t) { + const { + imageIndex: n + } = t; const s = { + source: n + }; + return this.json.textures = this.json.textures || [], this.json.textures.push(s), this.json.textures.length - 1; + } + + addMaterial (t) { + return this.json.materials = this.json.materials || [], this.json.materials.push(t), this.json.materials.length - 1; + } + + createBinaryChunk () { + let t, n; + this.gltf.buffers = []; + const s = this.byteLength; const r = new ArrayBuffer(s); const i = new Uint8Array(r); + let o = 0; + for (const a of this.sourceBuffers || []) { o = Nu(a, i, o); } + (t = this.json) !== null && t !== void 0 && (n = t.buffers) !== null && n !== void 0 && n[0] + ? this.json.buffers[0].byteLength = s + : this.json.buffers = [{ + byteLength: s + }], this.gltf.binary = r, this.sourceBuffers = [r]; + } + + _removeStringFromArray (t, n) { + let s = !0; + for (; s;) { + const r = t.indexOf(n); + r > -1 ? t.splice(r, 1) : s = !1; + } + } + + _addAttributes () { + const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + const n = {}; + for (const s in t) { + const r = t[s]; const i = this._getGltfAttributeName(s); const o = this.addBinaryBuffer(r.value, r); + n[i] = o; + } + return n; + } + + _addIndices (t) { + return this.addBinaryBuffer(t, { + size: 1 + }); + } + + _getGltfAttributeName (t) { + switch (t.toLowerCase()) { + case 'position': + case 'positions': + case 'vertices': + return 'POSITION'; + case 'normal': + case 'normals': + return 'NORMAL'; + case 'color': + case 'colors': + return 'COLOR_0'; + case 'texcoord': + case 'texcoords': + return 'TEXCOORD_0'; + default: + return t; + } + } + + _getAccessorMinMax (t, n) { + const s = { + min: null, + max: null + }; + if (t.length < n) { return s; } + s.min = [], s.max = []; + const r = t.subarray(0, n); + for (const i of r) { s.min.push(i), s.max.push(i); } + for (let i = n; i < t.length; i += n) { + for (let o = 0; o < n; o++) { s.min[0 + o] = Math.min(s.min[0 + o], t[i + o]), s.max[0 + o] = Math.max(s.max[0 + o], t[i + o]); } + } + return s; + } +} +function Ni (e) { + return (e % 1 + 1) % 1; +} +const Ka = { + SCALAR: 1, + VEC2: 2, + VEC3: 3, + VEC4: 4, + MAT2: 4, + MAT3: 9, + MAT4: 16, + BOOLEAN: 1, + STRING: 1, + ENUM: 1 +}; const dg = { + INT8: Int8Array, + UINT8: Uint8Array, + INT16: Int16Array, + UINT16: Uint16Array, + INT32: Int32Array, + UINT32: Uint32Array, + INT64: BigInt64Array, + UINT64: BigUint64Array, + FLOAT32: Float32Array, + FLOAT64: Float64Array +}; const za = { + INT8: 1, + UINT8: 1, + INT16: 2, + UINT16: 2, + INT32: 4, + UINT32: 4, + INT64: 8, + UINT64: 8, + FLOAT32: 4, + FLOAT64: 8 +}; +function xr (e, t) { + return za[t] * Ka[e]; +} +function Yn (e, t, n, s) { + if (n !== 'UINT8' && n !== 'UINT16' && n !== 'UINT32' && n !== 'UINT64') { return null; } + const r = e.getTypedArrayForBufferView(t); const i = $n(r, 'SCALAR', n, s + 1); + return i instanceof BigInt64Array || i instanceof BigUint64Array ? null : i; +} +function $n (e, t, n) { + const s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1; + const r = Ka[t]; const i = dg[n]; const o = za[n]; const a = s * r; const c = a * o; + let u = e.buffer; let l = e.byteOffset; + return l % o !== 0 && (u = new Uint8Array(u).slice(l, l + c).buffer, l = 0), new i(u, l, a); +} +function vr (e, t, n) { + let s, r; + const i = `TEXCOORD_${t.texCoord || 0}`; const o = n.attributes[i]; const a = e.getTypedArrayForAccessor(o); const c = e.gltf.json; const u = t.index; const l = (s = c.textures) === null || s === void 0 || (r = s[u]) === null || r === void 0 ? void 0 : r.source; + if (typeof l < 'u') { + let h, f, d; + const m = (h = c.images) === null || h === void 0 || (f = h[l]) === null || f === void 0 ? void 0 : f.mimeType; const g = (d = e.gltf.images) === null || d === void 0 ? void 0 : d[l]; + if (g && typeof g.width < 'u') { + const y = []; + for (let E = 0; E < a.length; E += 2) { + const R = mg(g, m, a, E, t.channels); + y.push(R); + } + return y; + } + } + return []; +} +function Wa (e, t, n, s, r) { + if (!(n != null && n.length)) { return; } + const i = []; + for (const l of n) { + let h = s.findIndex((f) => f === l); + h === -1 && (h = s.push(l) - 1), i.push(h); + } + const o = new Uint32Array(i); const a = e.gltf.buffers.push({ + arrayBuffer: o.buffer, + byteOffset: o.byteOffset, + byteLength: o.byteLength + }) - 1; const c = e.addBufferView(o, a, 0); const u = e.addAccessor(c, { + size: 1, + componentType: Sr(o), + count: o.length + }); + r.attributes[t] = u; +} +function mg (e, t, n, s) { + const r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [0]; + const i = { + r: { + offset: 0, + shift: 0 + }, + g: { + offset: 1, + shift: 8 + }, + b: { + offset: 2, + shift: 16 + }, + a: { + offset: 3, + shift: 24 + } + }; const o = n[s]; const a = n[s + 1]; + let c = 1; + t && (t.indexOf('image/jpeg') !== -1 || t.indexOf('image/png') !== -1) && (c = 4); + const u = gg(o, a, e, c); + let l = 0; + for (const h of r) { + const f = typeof h === 'number' ? Object.values(i)[h] : i[h]; const d = u + f.offset; const m = Na(e); + if (m.data.length <= d) { throw new Error(`${m.data.length} <= ${d}`); } + const g = m.data[d]; + l |= g << f.shift; + } + return l; +} +function gg (e, t, n) { + const s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1; + const r = n.width; const i = Ni(e) * (r - 1); const o = Math.round(i); const a = n.height; const c = Ni(t) * (a - 1); const u = Math.round(c); const l = n.components ? n.components : s; + return (u * r + o) * l; +} +function Xa (e, t, n, s, r) { + const i = []; + for (let o = 0; o < t; o++) { + const a = n[o]; const c = n[o + 1] - n[o]; + if (c + a > s) { break; } + const u = a / r; const l = c / r; + i.push(e.slice(u, u + l)); + } + return i; +} +function Qa (e, t, n) { + const s = []; + for (let r = 0; r < t; r++) { + const i = r * n; + s.push(e.slice(i, i + n)); + } + return s; +} +function qa (e, t, n, s) { + if (n) { throw new Error('Not implemented - arrayOffsets for strings is specified'); } + if (s) { + const r = []; const i = new TextDecoder('utf8'); + let o = 0; + for (let a = 0; a < e; a++) { + const c = s[a + 1] - s[a]; + if (c + o <= t.length) { + const u = t.subarray(o, c + o); const l = i.decode(u); + r.push(l), o += c; + } + } + return r; + } + return []; +} +const Ya = 'EXT_mesh_features'; const Ag = Ya; +async function pg (e, t) { + const n = new ot(e); + yg(n, t); +} +function yg (e, t) { + const n = e.gltf.json; + if (n.meshes) { + for (const s of n.meshes) { + for (const r of s.primitives) { Bg(e, r, t); } + } + } +} +function Bg (e, t, n) { + let s, r; + if (!(n != null && (s = n.gltf) !== null && s !== void 0 && s.loadBuffers)) { return; } + const i = (r = t.extensions) === null || r === void 0 ? void 0 : r[Ya]; const o = i == null ? void 0 : i.featureIds; + if (o) { + for (const c of o) { + var a; + let u; + if (typeof c.attribute < 'u') { + const l = `_FEATURE_ID_${c.attribute}`; const h = t.attributes[l]; + u = e.getTypedArrayForAccessor(h); + } else { typeof c.texture < 'u' && n !== null && n !== void 0 && (a = n.gltf) !== null && a !== void 0 && a.loadImages ? u = vr(e, c.texture, t) : u = []; } + c.data = u; + } + } +} +const Cg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + decode: pg, + name: Ag +}, Symbol.toStringTag, { value: 'Module' })); const Or = 'EXT_structural_metadata'; const Eg = Or; +async function Tg (e, t) { + const n = new ot(e); + bg(n, t); +} +function bg (e, t) { + let n, s; + if (!((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) { return; } + const r = e.getExtension(Or); + r && ((s = t.gltf) !== null && s !== void 0 && s.loadImages && _g(e, r), wg(e, r)); +} +function _g (e, t) { + const n = t.propertyTextures; const s = e.gltf.json; + if (n && s.meshes) { + for (const r of s.meshes) { + for (const i of r.primitives) { Mg(e, n, i, t); } + } + } +} +function wg (e, t) { + const n = t.schema; + if (!n) { return; } + const s = n.classes; const r = t.propertyTables; + if (s && r) { + for (const i in s) { + const o = Rg(r, i); + o && Ig(e, n, o); + } + } +} +function Rg (e, t) { + for (const n of e) { + if (n.class === t) { return n; } + } + return null; +} +function Mg (e, t, n, s) { + let r; + if (!t) { return; } + const i = (r = n.extensions) === null || r === void 0 ? void 0 : r[Or]; const o = i == null ? void 0 : i.propertyTextures; + if (o) { + for (const a of o) { + const c = t[a]; + Sg(e, c, n, s); + } + } +} +function Sg (e, t, n, s) { + if (!t.properties) { return; } + s.dataAttributeNames || (s.dataAttributeNames = []); + const r = t.class; + for (const o in t.properties) { + var i; + const a = `${r}_${o}`; const c = (i = t.properties) === null || i === void 0 ? void 0 : i[o]; + if (!c) { continue; } + c.data || (c.data = []); + const u = c.data; const l = vr(e, c, n); + l !== null && (Wa(e, a, l, u, n), c.data = u, s.dataAttributeNames.push(a)); + } +} +function Ig (e, t, n) { + let s; + const r = (s = t.classes) === null || s === void 0 ? void 0 : s[n.class]; + if (!r) { throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`); } + const i = n.count; + for (const a in r.properties) { + var o; + const c = r.properties[a]; const u = (o = n.properties) === null || o === void 0 ? void 0 : o[a]; + if (u) { + const l = xg(e, t, c, i, u); + u.data = l; + } + } +} +function xg (e, t, n, s, r) { + let i = []; + const o = r.values; const a = e.getTypedArrayForBufferView(o); const c = vg(e, n, r, s); const u = Og(e, r, s); + switch (n.type) { + case 'SCALAR': + case 'VEC2': + case 'VEC3': + case 'VEC4': + case 'MAT2': + case 'MAT3': + case 'MAT4': { + i = Fg(n, s, a, c); + break; + } + case 'BOOLEAN': + throw new Error(`Not implemented - classProperty.type=${n.type}`); + case 'STRING': { + i = qa(s, a, c, u); + break; + } + case 'ENUM': { + i = Dg(t, n, s, a, c); + break; + } + default: + throw new Error(`Unknown classProperty type ${n.type}`); + } + return i; +} +function vg (e, t, n, s) { + return t.array && typeof t.count > 'u' && typeof n.arrayOffsets < 'u' ? Yn(e, n.arrayOffsets, n.arrayOffsetType || 'UINT32', s) : null; +} +function Og (e, t, n) { + return typeof t.stringOffsets < 'u' ? Yn(e, t.stringOffsets, t.stringOffsetType || 'UINT32', n) : null; +} +function Fg (e, t, n, s) { + const r = e.array; const i = e.count; const o = xr(e.type, e.componentType); const a = n.byteLength / o; + let c; + return e.componentType ? c = $n(n, e.type, e.componentType, a) : c = n, r ? s ? Xa(c, t, s, n.length, o) : i ? Qa(c, t, i) : [] : c; +} +function Dg (e, t, n, s, r) { + let i; + const o = t.enumType; + if (!o) { throw new Error('Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM'); } + const a = (i = e.enums) === null || i === void 0 ? void 0 : i[o]; + if (!a) { throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`); } + const c = a.valueType || 'UINT16'; const u = xr(t.type, c); const l = s.byteLength / u; + let h = $n(s, t.type, c, l); + if (h || (h = s), t.array) { + if (r) { + return Lg({ + valuesData: h, + numberOfElements: n, + arrayOffsets: r, + valuesDataBytesLength: s.length, + elementSize: u, + enumEntry: a + }); + } + const f = t.count; + return f ? Pg(h, n, f, a) : []; + } + return Fr(h, 0, n, a); +} +function Lg (e) { + const { + valuesData: t, + numberOfElements: n, + arrayOffsets: s, + valuesDataBytesLength: r, + elementSize: i, + enumEntry: o + } = e; const a = []; + for (let c = 0; c < n; c++) { + const u = s[c]; const l = s[c + 1] - s[c]; + if (l + u > r) { break; } + const h = u / i; const f = l / i; const d = Fr(t, h, f, o); + a.push(d); + } + return a; +} +function Pg (e, t, n, s) { + const r = []; + for (let i = 0; i < t; i++) { + const o = n * i; const a = Fr(e, o, n, s); + r.push(a); + } + return r; +} +function Fr (e, t, n, s) { + const r = []; + for (let i = 0; i < n; i++) { + if (e instanceof BigInt64Array || e instanceof BigUint64Array) { r.push(''); } else { + const o = e[t + i]; const a = Gg(s, o); + a ? r.push(a.name) : r.push(''); + } + } + return r; +} +function Gg (e, t) { + for (const n of e.values) { + if (n.value === t) { return n; } + } + return null; +} +const Ng = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + decode: Tg, + name: Eg +}, Symbol.toStringTag, { value: 'Module' })); const $a = 'EXT_feature_metadata'; const Ug = $a; +async function Hg (e, t) { + const n = new ot(e); + Jg(n, t); +} +function Jg (e, t) { + let n, s; + if (!((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) { return; } + const r = e.getExtension($a); + r && ((s = t.gltf) !== null && s !== void 0 && s.loadImages && Vg(e, r), jg(e, r)); +} +function Vg (e, t) { + const n = t.schema; + if (!n) { return; } + const s = n.classes; const { + featureTextures: r + } = t; + if (s && r) { + for (const i in s) { + const o = s[i]; const a = Kg(r, i); + a && Wg(e, a, o); + } + } +} +function jg (e, t) { + const n = t.schema; + if (!n) { return; } + const s = n.classes; const r = t.featureTables; + if (s && r) { + for (const i in s) { + const o = kg(r, i); + o && zg(e, n, o); + } + } +} +function kg (e, t) { + for (const n in e) { + const s = e[n]; + if (s.class === t) { return s; } + } + return null; +} +function Kg (e, t) { + for (const n in e) { + const s = e[n]; + if (s.class === t) { return s; } + } + return null; +} +function zg (e, t, n) { + let s; + if (!n.class) { return; } + const r = (s = t.classes) === null || s === void 0 ? void 0 : s[n.class]; + if (!r) { throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`); } + const i = n.count; + for (const a in r.properties) { + var o; + const c = r.properties[a]; const u = (o = n.properties) === null || o === void 0 ? void 0 : o[a]; + if (u) { + const l = Xg(e, t, c, i, u); + u.data = l; + } + } +} +function Wg (e, t, n) { + const s = t.class; + for (const i in n.properties) { + var r; + const o = t == null || (r = t.properties) === null || r === void 0 ? void 0 : r[i]; + if (o) { + const a = Zg(e, o, s); + o.data = a; + } + } +} +function Xg (e, t, n, s, r) { + let i = []; + const o = r.bufferView; const a = e.getTypedArrayForBufferView(o); const c = Qg(e, n, r, s); const u = qg(e, n, r, s); + return n.type === 'STRING' || n.componentType === 'STRING' ? i = qa(s, a, c, u) : Yg(n) && (i = $g(n, s, a, c)), i; +} +function Qg (e, t, n, s) { + return t.type === 'ARRAY' && typeof t.componentCount > 'u' && typeof n.arrayOffsetBufferView < 'u' ? Yn(e, n.arrayOffsetBufferView, n.offsetType || 'UINT32', s) : null; +} +function qg (e, t, n, s) { + return typeof n.stringOffsetBufferView < 'u' ? Yn(e, n.stringOffsetBufferView, n.offsetType || 'UINT32', s) : null; +} +function Yg (e) { + const t = ['UINT8', 'INT16', 'UINT16', 'INT32', 'UINT32', 'INT64', 'UINT64', 'FLOAT32', 'FLOAT64']; + return t.includes(e.type) || typeof e.componentType < 'u' && t.includes(e.componentType); +} +function $g (e, t, n, s) { + const r = e.type === 'ARRAY'; const i = e.componentCount; const o = 'SCALAR'; const a = e.componentType || e.type; const c = xr(o, a); const u = n.byteLength / c; const l = $n(n, o, a, u); + return r ? s ? Xa(l, t, s, n.length, c) : i ? Qa(l, t, i) : [] : l; +} +function Zg (e, t, n) { + const s = e.gltf.json; + if (!s.meshes) { return []; } + const r = []; + for (const i of s.meshes) { + for (const o of i.primitives) { t0(e, n, t, r, o); } + } + return r; +} +function t0 (e, t, n, s, r) { + const i = { + channels: n.channels, + ...n.texture + }; const o = vr(e, i, r); + o && Wa(e, t, o, s, r); +} +const e0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + decode: Hg, + name: Ug +}, Symbol.toStringTag, { value: 'Module' })); const n0 = '4.1.1'; const s0 = '4.1.1'; const Ln = { + TRANSCODER: 'basis_transcoder.js', + TRANSCODER_WASM: 'basis_transcoder.wasm', + ENCODER: 'basis_encoder.js', + ENCODER_WASM: 'basis_encoder.wasm' +}; +let bs; +async function Ui (e) { + const t = e.modules || {}; + return t.basis ? t.basis : (bs = bs || r0(e), await bs); +} +async function r0 (e) { + let t = null; let n = null; + return [t, n] = await Promise.all([await Zt(Ln.TRANSCODER, 'textures', e), await Zt(Ln.TRANSCODER_WASM, 'textures', e)]), t = t || globalThis.BASIS, await i0(t, n); +} +function i0 (e, t) { + const n = {}; + return t && (n.wasmBinary = t), new Promise((s) => { + e(n).then((r) => { + const { + BasisFile: i, + initializeBasis: o + } = r; + o(), s({ + BasisFile: i + }); + }); + }); +} +let _s; +async function Hi (e) { + const t = e.modules || {}; + return t.basisEncoder ? t.basisEncoder : (_s = _s || o0(e), await _s); +} +async function o0 (e) { + let t = null; let n = null; + return [t, n] = await Promise.all([await Zt(Ln.ENCODER, 'textures', e), await Zt(Ln.ENCODER_WASM, 'textures', e)]), t = t || globalThis.BASIS, await a0(t, n); +} +function a0 (e, t) { + const n = {}; + return t && (n.wasmBinary = t), new Promise((s) => { + e(n).then((r) => { + const { + BasisFile: i, + KTX2File: o, + initializeBasis: a, + BasisEncoder: c + } = r; + a(), s({ + BasisFile: i, + KTX2File: o, + BasisEncoder: c + }); + }); + }); +} +const he = { + COMPRESSED_RGB_S3TC_DXT1_EXT: 33776, + COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777, + COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778, + COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779, + COMPRESSED_R11_EAC: 37488, + COMPRESSED_SIGNED_R11_EAC: 37489, + COMPRESSED_RG11_EAC: 37490, + COMPRESSED_SIGNED_RG11_EAC: 37491, + COMPRESSED_RGB8_ETC2: 37492, + COMPRESSED_RGBA8_ETC2_EAC: 37493, + COMPRESSED_SRGB8_ETC2: 37494, + COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495, + COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496, + COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497, + COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840, + COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842, + COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841, + COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843, + COMPRESSED_RGB_ETC1_WEBGL: 36196, + COMPRESSED_RGB_ATC_WEBGL: 35986, + COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987, + COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798, + COMPRESSED_RGBA_ASTC_4X4_KHR: 37808, + COMPRESSED_RGBA_ASTC_5X4_KHR: 37809, + COMPRESSED_RGBA_ASTC_5X5_KHR: 37810, + COMPRESSED_RGBA_ASTC_6X5_KHR: 37811, + COMPRESSED_RGBA_ASTC_6X6_KHR: 37812, + COMPRESSED_RGBA_ASTC_8X5_KHR: 37813, + COMPRESSED_RGBA_ASTC_8X6_KHR: 37814, + COMPRESSED_RGBA_ASTC_8X8_KHR: 37815, + COMPRESSED_RGBA_ASTC_10X5_KHR: 37816, + COMPRESSED_RGBA_ASTC_10X6_KHR: 37817, + COMPRESSED_RGBA_ASTC_10X8_KHR: 37818, + COMPRESSED_RGBA_ASTC_10X10_KHR: 37819, + COMPRESSED_RGBA_ASTC_12X10_KHR: 37820, + COMPRESSED_RGBA_ASTC_12X12_KHR: 37821, + COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: 37840, + COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: 37841, + COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: 37842, + COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: 37843, + COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: 37844, + COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: 37845, + COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: 37846, + COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: 37847, + COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: 37848, + COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: 37849, + COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: 37850, + COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851, + COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852, + COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853, + COMPRESSED_RED_RGTC1_EXT: 36283, + COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284, + COMPRESSED_RED_GREEN_RGTC2_EXT: 36285, + COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286, + COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916, + COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917, + COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918, + COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919 +}; const c0 = ['', 'WEBKIT_', 'MOZ_']; const Ji = { + WEBGL_compressed_texture_s3tc: 'dxt', + WEBGL_compressed_texture_s3tc_srgb: 'dxt-srgb', + WEBGL_compressed_texture_etc1: 'etc1', + WEBGL_compressed_texture_etc: 'etc2', + WEBGL_compressed_texture_pvrtc: 'pvrtc', + WEBGL_compressed_texture_atc: 'atc', + WEBGL_compressed_texture_astc: 'astc', + EXT_texture_compression_rgtc: 'rgtc' +}; +let gn = null; +function u0 (e) { + if (!gn) { + e = e || l0() || void 0, gn = /* @__PURE__ */ new Set(); + for (const t of c0) { + for (const n in Ji) { + if (e && e.getExtension(`${t}${n}`)) { + const s = Ji[n]; + gn.add(s); + } + } + } + } + return gn; +} +function l0 () { + try { + return document.createElement('canvas').getContext('webgl'); + } catch { + return null; + } +} +let Vi, ji, ki, Ki, zi, Wi, Xi, Qi; +(function (e) { + e[e.NONE = 0] = 'NONE', e[e.BASISLZ = 1] = 'BASISLZ', e[e.ZSTD = 2] = 'ZSTD', e[e.ZLIB = 3] = 'ZLIB'; +})(Vi || (Vi = {})), (function (e) { + e[e.BASICFORMAT = 0] = 'BASICFORMAT'; +}(ji || (ji = {}))), (function (e) { + e[e.UNSPECIFIED = 0] = 'UNSPECIFIED', e[e.ETC1S = 163] = 'ETC1S', e[e.UASTC = 166] = 'UASTC'; +}(ki || (ki = {}))), (function (e) { + e[e.UNSPECIFIED = 0] = 'UNSPECIFIED', e[e.SRGB = 1] = 'SRGB'; +}(Ki || (Ki = {}))), (function (e) { + e[e.UNSPECIFIED = 0] = 'UNSPECIFIED', e[e.LINEAR = 1] = 'LINEAR', e[e.SRGB = 2] = 'SRGB', e[e.ITU = 3] = 'ITU', e[e.NTSC = 4] = 'NTSC', e[e.SLOG = 5] = 'SLOG', e[e.SLOG2 = 6] = 'SLOG2'; +}(zi || (zi = {}))), (function (e) { + e[e.ALPHA_STRAIGHT = 0] = 'ALPHA_STRAIGHT', e[e.ALPHA_PREMULTIPLIED = 1] = 'ALPHA_PREMULTIPLIED'; +}(Wi || (Wi = {}))), (function (e) { + e[e.RGB = 0] = 'RGB', e[e.RRR = 3] = 'RRR', e[e.GGG = 4] = 'GGG', e[e.AAA = 15] = 'AAA'; +}(Xi || (Xi = {}))), (function (e) { + e[e.RGB = 0] = 'RGB', e[e.RGBA = 3] = 'RGBA', e[e.RRR = 4] = 'RRR', e[e.RRRG = 5] = 'RRRG'; +}(Qi || (Qi = {}))); +const gt = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10]; +function h0 (e) { + const t = new Uint8Array(e); + return !(t.byteLength < gt.length || t[0] !== gt[0] || t[1] !== gt[1] || t[2] !== gt[2] || t[3] !== gt[3] || t[4] !== gt[4] || t[5] !== gt[5] || t[6] !== gt[6] || t[7] !== gt[7] || t[8] !== gt[8] || t[9] !== gt[9] || t[10] !== gt[10] || t[11] !== gt[11]); +} +const f0 = { + etc1: { + basisFormat: 0, + compressed: !0, + format: he.COMPRESSED_RGB_ETC1_WEBGL + }, + etc2: { + basisFormat: 1, + compressed: !0 + }, + bc1: { + basisFormat: 2, + compressed: !0, + format: he.COMPRESSED_RGB_S3TC_DXT1_EXT + }, + bc3: { + basisFormat: 3, + compressed: !0, + format: he.COMPRESSED_RGBA_S3TC_DXT5_EXT + }, + bc4: { + basisFormat: 4, + compressed: !0 + }, + bc5: { + basisFormat: 5, + compressed: !0 + }, + 'bc7-m6-opaque-only': { + basisFormat: 6, + compressed: !0 + }, + 'bc7-m5': { + basisFormat: 7, + compressed: !0 + }, + 'pvrtc1-4-rgb': { + basisFormat: 8, + compressed: !0, + format: he.COMPRESSED_RGB_PVRTC_4BPPV1_IMG + }, + 'pvrtc1-4-rgba': { + basisFormat: 9, + compressed: !0, + format: he.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG + }, + 'astc-4x4': { + basisFormat: 10, + compressed: !0, + format: he.COMPRESSED_RGBA_ASTC_4X4_KHR + }, + 'atc-rgb': { + basisFormat: 11, + compressed: !0 + }, + 'atc-rgba-interpolated-alpha': { + basisFormat: 12, + compressed: !0 + }, + rgba32: { + basisFormat: 13, + compressed: !1 + }, + rgb565: { + basisFormat: 14, + compressed: !1 + }, + bgr565: { + basisFormat: 15, + compressed: !1 + }, + rgba4444: { + basisFormat: 16, + compressed: !1 + } +}; +async function d0 (e, t) { + if (t.basis.containerFormat === 'auto') { + if (h0(e)) { + const s = await Hi(t); + return qi(s.KTX2File, e, t); + } + const { + BasisFile: n + } = await Ui(t); + return ws(n, e, t); + } + switch (t.basis.module) { + case 'encoder': + const n = await Hi(t); + switch (t.basis.containerFormat) { + case 'ktx2': + return qi(n.KTX2File, e, t); + case 'basis': + default: + return ws(n.BasisFile, e, t); + } + case 'transcoder': + default: + const { + BasisFile: s + } = await Ui(t); + return ws(s, e, t); + } +} +function ws (e, t, n) { + const s = new e(new Uint8Array(t)); + try { + if (!s.startTranscoding()) { throw new Error('Failed to start basis transcoding'); } + const r = s.getNumImages(); const i = []; + for (let o = 0; o < r; o++) { + const a = s.getNumLevels(o); const c = []; + for (let u = 0; u < a; u++) { c.push(m0(s, o, u, n)); } + i.push(c); + } + return i; + } finally { + s.close(), s.delete(); + } +} +function m0 (e, t, n, s) { + const r = e.getImageWidth(t, n); const i = e.getImageHeight(t, n); const o = e.getHasAlpha(); const { + compressed: a, + format: c, + basisFormat: u + } = Za(s, o); const l = e.getImageTranscodedSizeInBytes(t, n, u); const h = new Uint8Array(l); + if (!e.transcodeImage(h, t, n, u, 0, 0)) { throw new Error('failed to start Basis transcoding'); } + return { + width: r, + height: i, + data: h, + compressed: a, + format: c, + hasAlpha: o + }; +} +function qi (e, t, n) { + const s = new e(new Uint8Array(t)); + try { + if (!s.startTranscoding()) { throw new Error('failed to start KTX2 transcoding'); } + const r = s.getLevels(); const i = []; + for (let o = 0; o < r; o++) { + i.push(g0(s, o, n)); + break; + } + return [i]; + } finally { + s.close(), s.delete(); + } +} +function g0 (e, t, n) { + const { + alphaFlag: s, + height: r, + width: i + } = e.getImageLevelInfo(t, 0, 0); const { + compressed: o, + format: a, + basisFormat: c + } = Za(n, s); const u = e.getImageTranscodedSizeInBytes(t, 0, 0, c); const l = new Uint8Array(u); + if (!e.transcodeImage(l, t, 0, 0, c, 0, -1, -1)) { throw new Error('Failed to transcode KTX2 image'); } + return { + width: i, + height: r, + data: l, + compressed: o, + levelSize: u, + hasAlpha: s, + format: a + }; +} +function Za (e, t) { + let n = e && e.basis && e.basis.format; + return n === 'auto' && (n = tc()), typeof n === 'object' && (n = t ? n.alpha : n.noAlpha), n = n.toLowerCase(), f0[n]; +} +function tc () { + const e = u0(); + return e.has('astc') + ? 'astc-4x4' + : e.has('dxt') + ? { + alpha: 'bc3', + noAlpha: 'bc1' + } + : e.has('pvrtc') + ? { + alpha: 'pvrtc1-4-rgba', + noAlpha: 'pvrtc1-4-rgb' + } + : e.has('etc1') ? 'etc1' : e.has('etc2') ? 'etc2' : 'rgb565'; +} +const A0 = { + name: 'Basis', + id: 'basis', + module: 'textures', + version: s0, + worker: !0, + extensions: ['basis', 'ktx2'], + mimeTypes: ['application/octet-stream', 'image/ktx2'], + tests: ['sB'], + binary: !0, + options: { + basis: { + format: 'auto', + libraryPath: 'libs/', + containerFormat: 'auto', + module: 'transcoder' + } + } +}; const p0 = { + ...A0, + parse: d0 +}; const pe = !0; const Yi = 1735152710; const Dr = 12; const Pn = 8; const y0 = 1313821514; const B0 = 5130562; const C0 = 0; const E0 = 0; const T0 = 1; +function b0 (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; + return `${String.fromCharCode(e.getUint8(t + 0))}${String.fromCharCode(e.getUint8(t + 1))}${String.fromCharCode(e.getUint8(t + 2))}${String.fromCharCode(e.getUint8(t + 3))}`; +} +function _0 (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; + const s = new DataView(e); const { + magic: r = Yi + } = n; const i = s.getUint32(t, !1); + return i === r || i === Yi; +} +function w0 (e, t) { + let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; + const s = new DataView(t); const r = b0(s, n + 0); const i = s.getUint32(n + 4, pe); const o = s.getUint32(n + 8, pe); + switch (Object.assign(e, { + header: { + byteOffset: n, + byteLength: o, + hasBinChunk: !1 + }, + type: r, + version: i, + json: {}, + binChunks: [] + }), n += Dr, e.version) { + case 1: + return R0(e, s, n); + case 2: + return M0(e, s, n, {}); + default: + throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`); + } +} +function R0 (e, t, n) { + z(e.header.byteLength > Dr + Pn); + const s = t.getUint32(n + 0, pe); const r = t.getUint32(n + 4, pe); + return n += Pn, z(r === C0), Ys(e, t, n, s), n += s, n += $s(e, t, n, e.header.byteLength), n; +} +function M0 (e, t, n, s) { + return z(e.header.byteLength > Dr + Pn), S0(e, t, n, s), n + e.header.byteLength; +} +function S0 (e, t, n, s) { + for (; n + 8 <= e.header.byteLength;) { + const r = t.getUint32(n + 0, pe); const i = t.getUint32(n + 4, pe); + switch (n += Pn, i) { + case y0: + Ys(e, t, n, r); + break; + case B0: + $s(e, t, n, r); + break; + case E0: + s.strict || Ys(e, t, n, r); + break; + case T0: + s.strict || $s(e, t, n, r); + break; + } + n += ze(r, 4); + } + return n; +} +function Ys (e, t, n, s) { + const r = new Uint8Array(t.buffer, n, s); const o = new TextDecoder('utf8').decode(r); + return e.json = JSON.parse(o), ze(s, 4); +} +function $s (e, t, n, s) { + return e.header.hasBinChunk = !0, e.binChunks.push({ + byteOffset: n, + byteLength: s, + arrayBuffer: t.buffer + }), ze(s, 4); +} +function ec (e, t) { + if (e.startsWith('data:') || e.startsWith('http:') || e.startsWith('https:')) { return e; } + const s = t.baseUri || t.uri; + if (!s) { throw new Error(`'baseUri' must be provided to resolve relative url ${e}`); } + return s.substr(0, s.lastIndexOf('/') + 1) + e; +} +const I0 = 'B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB'; const x0 = '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'; const v0 = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11]); const O0 = new Uint8Array([32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113, 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101, 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167]); const F0 = { + 0: '', + 1: 'meshopt_decodeFilterOct', + 2: 'meshopt_decodeFilterQuat', + 3: 'meshopt_decodeFilterExp', + NONE: '', + OCTAHEDRAL: 'meshopt_decodeFilterOct', + QUATERNION: 'meshopt_decodeFilterQuat', + EXPONENTIAL: 'meshopt_decodeFilterExp' +}; const D0 = { + 0: 'meshopt_decodeVertexBuffer', + 1: 'meshopt_decodeIndexBuffer', + 2: 'meshopt_decodeIndexSequence', + ATTRIBUTES: 'meshopt_decodeVertexBuffer', + TRIANGLES: 'meshopt_decodeIndexBuffer', + INDICES: 'meshopt_decodeIndexSequence' +}; +async function L0 (e, t, n, s, r) { + const i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 'NONE'; + const o = await P0(); + U0(o, o.exports[D0[r]], e, t, n, s, o.exports[F0[i || 'NONE']]); +} +let Rs; +async function P0 () { + return Rs || (Rs = G0()), Rs; +} +async function G0 () { + let e = I0; + WebAssembly.validate(v0) && (e = x0, console.log('Warning: meshopt_decoder is using experimental SIMD support')); + const t = await WebAssembly.instantiate(N0(e), {}); + return await t.instance.exports.__wasm_call_ctors(), t.instance; +} +function N0 (e) { + const t = new Uint8Array(e.length); + for (let s = 0; s < e.length; ++s) { + const r = e.charCodeAt(s); + t[s] = r > 96 ? r - 71 : r > 64 ? r - 65 : r > 47 ? r + 4 : r > 46 ? 63 : 62; + } + let n = 0; + for (let s = 0; s < e.length; ++s) { t[n++] = t[s] < 60 ? O0[t[s]] : (t[s] - 60) * 64 + t[++s]; } + return t.buffer.slice(0, n); +} +function U0 (e, t, n, s, r, i, o) { + const a = e.exports.sbrk; const c = s + 3 & -4; const u = a(c * r); const l = a(i.length); const h = new Uint8Array(e.exports.memory.buffer); + h.set(i, l); + const f = t(u, s, r, l, i.length); + if (f === 0 && o && o(u, c, r), n.set(h.subarray(u, u + s * r)), a(u - a(0)), f !== 0) { throw new Error(`Malformed buffer data: ${f}`); } +} +const Gn = 'EXT_meshopt_compression'; const H0 = Gn; +async function J0 (e, t) { + let n, s; + const r = new ot(e); + if (!(t != null && (n = t.gltf) !== null && n !== void 0 && n.decompressMeshes) || !((s = t.gltf) !== null && s !== void 0 && s.loadBuffers)) { return; } + const i = []; + for (const o of e.json.bufferViews || []) { i.push(V0(r, o)); } + await Promise.all(i), r.removeExtension(Gn); +} +async function V0 (e, t) { + const n = e.getObjectExtension(t, Gn); + if (n) { + const { + byteOffset: s = 0, + byteLength: r = 0, + byteStride: i, + count: o, + mode: a, + filter: c = 'NONE', + buffer: u + } = n; const l = e.gltf.buffers[u]; const h = new Uint8Array(l.arrayBuffer, l.byteOffset + s, r); const f = new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer, t.byteOffset, t.byteLength); + await L0(f, o, i, h, a, c), e.removeObjectExtension(t, Gn); + } +} +const j0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + decode: J0, + name: H0 +}, Symbol.toStringTag, { value: 'Module' })); const fe = 'EXT_texture_webp'; const k0 = fe; +function K0 (e, t) { + const n = new ot(e); + if (!tg('image/webp')) { + if (n.getRequiredExtensions().includes(fe)) { throw new Error(`gltf: Required extension ${fe} not supported by browser`); } + return; + } + const { + json: s + } = n; + for (const r of s.textures || []) { + const i = n.getObjectExtension(r, fe); + i && (r.source = i.source), n.removeObjectExtension(r, fe); + } + n.removeExtension(fe); +} +const z0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + name: k0, + preprocess: K0 +}, Symbol.toStringTag, { value: 'Module' })); const _n = 'KHR_texture_basisu'; const W0 = _n; +function X0 (e, t) { + const n = new ot(e); const { + json: s + } = n; + for (const r of s.textures || []) { + const i = n.getObjectExtension(r, _n); + i && (r.source = i.source, n.removeObjectExtension(r, _n)); + } + n.removeExtension(_n); +} +const Q0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + name: W0, + preprocess: X0 +}, Symbol.toStringTag, { value: 'Module' })); +function q0 (e) { + const t = {}; + for (const n in e) { + const s = e[n]; + if (n !== 'indices') { + const r = nc(s); + t[n] = r; + } + } + return t; +} +function nc (e) { + const { + buffer: t, + size: n, + count: s + } = Y0(e); + return { + value: t, + size: n, + byteOffset: 0, + count: s, + type: ja(n), + componentType: Sr(t) + }; +} +function Y0 (e) { + let t = e; let n = 1; let s = 0; + return e && e.value && (t = e.value, n = e.size || 1), t && (ArrayBuffer.isView(t) || (t = $0(t, Float32Array)), s = t.length / n), { + buffer: t, + size: n, + count: s + }; +} +function $0 (e, t) { + const n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; + return e ? Array.isArray(e) ? new t(e) : n && !(e instanceof t) ? new t(e) : e : null; +} +const zt = 'KHR_draco_mesh_compression'; const Z0 = zt; +function tA (e, t, n) { + const s = new ot(e); + for (const r of sc(s)) { s.getObjectExtension(r, zt); } +} +async function eA (e, t, n) { + let s; + if (!(t != null && (s = t.gltf) !== null && s !== void 0 && s.decompressMeshes)) { return; } + const r = new ot(e); const i = []; + for (const o of sc(r)) { r.getObjectExtension(o, zt) && i.push(sA(r, o, t, n)); } + await Promise.all(i), r.removeExtension(zt); +} +function nA (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + const n = new ot(e); + for (const s of n.json.meshes || []) { rA(s, t), n.addRequiredExtension(zt); } +} +async function sA (e, t, n, s) { + const r = e.getObjectExtension(t, zt); + if (!r) { return; } + const i = e.getTypedArrayForBufferView(r.bufferView); const o = dr(i.buffer, i.byteOffset); const a = { + ...n + }; + delete a['3d-tiles']; + const c = await Ke(o, Da, a, s); const u = q0(c.attributes); + for (const [l, h] of Object.entries(u)) { + if (l in t.attributes) { + const f = t.attributes[l]; const d = e.getAccessor(f); + d != null && d.min && d !== null && d !== void 0 && d.max && (h.min = d.min, h.max = d.max); + } + } + t.attributes = u, c.indices && (t.indices = nc(c.indices)), e.removeObjectExtension(t, zt), iA(t); +} +function rA (e, t) { + let n; + const s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 4; const r = arguments.length > 3 ? arguments[3] : void 0; const i = arguments.length > 4 ? arguments[4] : void 0; + if (!r.DracoWriter) { throw new Error('options.gltf.DracoWriter not provided'); } + const o = r.DracoWriter.encodeSync({ + attributes: e + }); const a = i == null || (n = i.parseSync) === null || n === void 0 + ? void 0 + : n.call(i, { + attributes: e + }); const c = r._addFauxAttributes(a.attributes); const u = r.addBufferView(o); + return { + primitives: [{ + attributes: c, + mode: s, + extensions: { + [zt]: { + bufferView: u, + attributes: c + } + } + }] + }; +} +function iA (e) { + if (!e.attributes && Object.keys(e.attributes).length > 0) { throw new Error('glTF: Empty primitive detected: Draco decompression failure?'); } +} +function * sc (e) { + for (const t of e.json.meshes || []) { + for (const n of t.primitives) { yield n; } + } +} +const oA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + decode: eA, + encode: nA, + name: Z0, + preprocess: tA +}, Symbol.toStringTag, { value: 'Module' })); const Lr = 'KHR_texture_transform'; const aA = Lr; const An = new A(); const cA = new X(); const uA = new X(); +async function lA (e, t) { + let n; + if (!new ot(e).hasExtension(Lr) || !((n = t.gltf) !== null && n !== void 0 && n.loadBuffers)) { return; } + const i = e.json.materials || []; + for (let o = 0; o < i.length; o++) { hA(o, e); } +} +function hA (e, t) { + let n, s, r; + const i = []; const o = (n = t.json.materials) === null || n === void 0 ? void 0 : n[e]; const a = o == null || (s = o.pbrMetallicRoughness) === null || s === void 0 ? void 0 : s.baseColorTexture; + a && Me(t, e, a, i); + const c = o == null ? void 0 : o.emissiveTexture; + c && Me(t, e, c, i); + const u = o == null ? void 0 : o.normalTexture; + u && Me(t, e, u, i); + const l = o == null ? void 0 : o.occlusionTexture; + l && Me(t, e, l, i); + const h = o == null || (r = o.pbrMetallicRoughness) === null || r === void 0 ? void 0 : r.metallicRoughnessTexture; + h && Me(t, e, h, i); +} +function Me (e, t, n, s) { + const r = fA(n, s); + if (!r) { return; } + const i = e.json.meshes || []; + for (const o of i) { + for (const a of o.primitives) { + const c = a.material; + Number.isFinite(c) && t === c && dA(e, a, r); + } + } +} +function fA (e, t) { + let n; + const s = (n = e.extensions) === null || n === void 0 ? void 0 : n[Lr]; const { + texCoord: r = 0 + } = e; const { + texCoord: i = r + } = s; + if (!(t.findIndex((a) => { + const [c, u] = a; + return c === r && u === i; + }) !== -1)) { + const a = AA(s); + return r !== i && (e.texCoord = i), t.push([r, i]), { + originalTexCoord: r, + texCoord: i, + matrix: a + }; + } + return null; +} +function dA (e, t, n) { + const { + originalTexCoord: s, + texCoord: r, + matrix: i + } = n; const o = t.attributes[`TEXCOORD_${s}`]; + if (Number.isFinite(o)) { + let a; + const u = (a = e.json.accessors) === null || a === void 0 ? void 0 : a[o]; + if (u && u.bufferView) { + let c; + const l = (c = e.json.bufferViews) === null || c === void 0 ? void 0 : c[u.bufferView]; + if (l) { + const { + arrayBuffer: h, + byteOffset: f + } = e.buffers[l.buffer]; const d = (f || 0) + (u.byteOffset || 0) + (l.byteOffset || 0); const { + ArrayType: m, + length: g + } = Ir(u, l); const y = Va[u.componentType]; const E = Ja[u.type]; const R = l.byteStride || y * E; const B = new Float32Array(g); + for (let C = 0; C < u.count; C++) { + const M = new m(h, d + C * R, 2); + An.set(M[0], M[1], 1), An.transformByMatrix3(i), B.set([An[0], An[1]], C * E); + } + s === r ? mA(u, l, e.buffers, B) : gA(r, u, t, e, B); + } + } + } +} +function mA (e, t, n, s) { + e.componentType = 5126, n.push({ + arrayBuffer: s.buffer, + byteOffset: 0, + byteLength: s.buffer.byteLength + }), t.buffer = n.length - 1, t.byteLength = s.buffer.byteLength, t.byteOffset = 0, delete t.byteStride; +} +function gA (e, t, n, s, r) { + s.buffers.push({ + arrayBuffer: r.buffer, + byteOffset: 0, + byteLength: r.buffer.byteLength + }); + const i = s.json.bufferViews; + if (!i) { return; } + i.push({ + buffer: s.buffers.length - 1, + byteLength: r.buffer.byteLength, + byteOffset: 0 + }); + const o = s.json.accessors; + o && (o.push({ + bufferView: (i == null ? void 0 : i.length) - 1, + byteOffset: 0, + componentType: 5126, + count: t.count, + type: 'VEC2' + }), n.attributes[`TEXCOORD_${e}`] = o.length - 1); +} +function AA (e) { + const { + offset: t = [0, 0], + rotation: n = 0, + scale: s = [1, 1] + } = e; const r = new X().set(1, 0, 0, 0, 1, 0, t[0], t[1], 1); const i = cA.set(Math.cos(n), Math.sin(n), 0, -Math.sin(n), Math.cos(n), 0, 0, 0, 1); const o = uA.set(s[0], 0, 0, 0, s[1], 0, 0, 0, 1); + return r.multiplyRight(i).multiplyRight(o); +} +const pA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + decode: lA, + name: aA +}, Symbol.toStringTag, { value: 'Module' })); const Yt = 'KHR_lights_punctual'; const yA = Yt; +async function BA (e) { + const t = new ot(e); const { + json: n + } = t; const s = t.getExtension(Yt); + s && (t.json.lights = s.lights, t.removeExtension(Yt)); + for (const r of n.nodes || []) { + const i = t.getObjectExtension(r, Yt); + i && (r.light = i.light), t.removeObjectExtension(r, Yt); + } +} +async function CA (e) { + const t = new ot(e); const { + json: n + } = t; + if (n.lights) { + const s = t.addExtension(Yt); + yt(!s.lights), s.lights = n.lights, delete n.lights; + } + if (t.json.lights) { + for (const s of t.json.lights) { + const r = s.node; + t.addObjectExtension(r, Yt, s); + } + delete t.json.lights; + } +} +const EA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + decode: BA, + encode: CA, + name: yA +}, Symbol.toStringTag, { value: 'Module' })); const Ue = 'KHR_materials_unlit'; const TA = Ue; +async function bA (e) { + const t = new ot(e); const { + json: n + } = t; + for (const s of n.materials || []) { s.extensions && s.extensions.KHR_materials_unlit && (s.unlit = !0), t.removeObjectExtension(s, Ue); } + t.removeExtension(Ue); +} +function _A (e) { + const t = new ot(e); const { + json: n + } = t; + if (t.materials) { + for (const s of n.materials || []) { s.unlit && (delete s.unlit, t.addObjectExtension(s, Ue, {}), t.addExtension(Ue)); } + } +} +const wA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + decode: bA, + encode: _A, + name: TA +}, Symbol.toStringTag, { value: 'Module' })); const xe = 'KHR_techniques_webgl'; const RA = xe; +async function MA (e) { + const t = new ot(e); const { + json: n + } = t; const s = t.getExtension(xe); + if (s) { + const r = IA(s, t); + for (const i of n.materials || []) { + const o = t.getObjectExtension(i, xe); + o && (i.technique = Object.assign({}, o, r[o.technique]), i.technique.values = xA(i.technique, t)), t.removeObjectExtension(i, xe); + } + t.removeExtension(xe); + } +} +async function SA (e, t) { +} +function IA (e, t) { + const { + programs: n = [], + shaders: s = [], + techniques: r = [] + } = e; const i = new TextDecoder(); + return s.forEach((o) => { + if (Number.isFinite(o.bufferView)) { o.code = i.decode(t.getTypedArrayForBufferView(o.bufferView)); } else { throw new Error('KHR_techniques_webgl: no shader code'); } + }), n.forEach((o) => { + o.fragmentShader = s[o.fragmentShader], o.vertexShader = s[o.vertexShader]; + }), r.forEach((o) => { + o.program = n[o.program]; + }), r; +} +function xA (e, t) { + const n = Object.assign({}, e.values); + return Object.keys(e.uniforms || {}).forEach((s) => { + e.uniforms[s].value && !(s in n) && (n[s] = e.uniforms[s].value); + }), Object.keys(n).forEach((s) => { + typeof n[s] === 'object' && n[s].index !== void 0 && (n[s].texture = t.getTexture(n[s].index)); + }), n; +} +const vA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + decode: MA, + encode: SA, + name: RA +}, Symbol.toStringTag, { value: 'Module' })); const rc = [Ng, Cg, j0, z0, Q0, oA, EA, wA, vA, pA, e0]; +function OA (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = arguments.length > 2 ? arguments[2] : void 0; + const s = rc.filter((i) => ic(i.name, t)); + for (const i of s) { + var r; + (r = i.preprocess) === null || r === void 0 || r.call(i, e, t, n); + } +} +async function FA (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = arguments.length > 2 ? arguments[2] : void 0; + const s = rc.filter((i) => ic(i.name, t)); + for (const i of s) { + var r; + await ((r = i.decode) === null || r === void 0 ? void 0 : r.call(i, e, t, n)); + } +} +function ic (e, t) { + let n; + const s = (t == null || (n = t.gltf) === null || n === void 0 ? void 0 : n.excludeExtensions) || {}; + return !(e in s && !s[e]); +} +const Ms = 'KHR_binary_glTF'; +function DA (e) { + const t = new ot(e); const { + json: n + } = t; + for (const s of n.images || []) { + const r = t.getObjectExtension(s, Ms); + r && Object.assign(s, r), t.removeObjectExtension(s, Ms); + } + n.buffers && n.buffers[0] && delete n.buffers[0].uri, t.removeExtension(Ms); +} +const $i = { + accessors: 'accessor', + animations: 'animation', + buffers: 'buffer', + bufferViews: 'bufferView', + images: 'image', + materials: 'material', + meshes: 'mesh', + nodes: 'node', + samplers: 'sampler', + scenes: 'scene', + skins: 'skin', + textures: 'texture' +}; const LA = { + accessor: 'accessors', + animations: 'animation', + buffer: 'buffers', + bufferView: 'bufferViews', + image: 'images', + material: 'materials', + mesh: 'meshes', + node: 'nodes', + sampler: 'samplers', + scene: 'scenes', + skin: 'skins', + texture: 'textures' +}; +class PA { + constructor () { + this.idToIndexMap = { + animations: {}, + accessors: {}, + buffers: {}, + bufferViews: {}, + images: {}, + materials: {}, + meshes: {}, + nodes: {}, + samplers: {}, + scenes: {}, + skins: {}, + textures: {} + }, this.json = void 0; + } + + normalize (t, n) { + this.json = t.json; + const s = t.json; + switch (s.asset && s.asset.version) { + case '2.0': + return; + case void 0: + case '1.0': + break; + default: + console.warn(`glTF: Unknown version ${s.asset.version}`); + return; + } + if (!n.normalize) { throw new Error('glTF v1 is not supported.'); } + console.warn('Converting glTF v1 to glTF v2 format. This is experimental and may fail.'), this._addAsset(s), this._convertTopLevelObjectsToArrays(s), DA(t), this._convertObjectIdsToArrayIndices(s), this._updateObjects(s), this._updateMaterial(s); + } + + _addAsset (t) { + t.asset = t.asset || {}, t.asset.version = '2.0', t.asset.generator = t.asset.generator || 'Normalized to glTF 2.0 by loaders.gl'; + } + + _convertTopLevelObjectsToArrays (t) { + for (const n in $i) { this._convertTopLevelObjectToArray(t, n); } + } + + _convertTopLevelObjectToArray (t, n) { + const s = t[n]; + if (!(!s || Array.isArray(s))) { + t[n] = []; + for (const r in s) { + const i = s[r]; + i.id = i.id || r; + const o = t[n].length; + t[n].push(i), this.idToIndexMap[n][r] = o; + } + } + } + + _convertObjectIdsToArrayIndices (t) { + for (const n in $i) { this._convertIdsToIndices(t, n); } + 'scene' in t && (t.scene = this._convertIdToIndex(t.scene, 'scene')); + for (const n of t.textures) { this._convertTextureIds(n); } + for (const n of t.meshes) { this._convertMeshIds(n); } + for (const n of t.nodes) { this._convertNodeIds(n); } + for (const n of t.scenes) { this._convertSceneIds(n); } + } + + _convertTextureIds (t) { + t.source && (t.source = this._convertIdToIndex(t.source, 'image')); + } + + _convertMeshIds (t) { + for (const n of t.primitives) { + const { + attributes: s, + indices: r, + material: i + } = n; + for (const o in s) { s[o] = this._convertIdToIndex(s[o], 'accessor'); } + r && (n.indices = this._convertIdToIndex(r, 'accessor')), i && (n.material = this._convertIdToIndex(i, 'material')); + } + } + + _convertNodeIds (t) { + t.children && (t.children = t.children.map((n) => this._convertIdToIndex(n, 'node'))), t.meshes && (t.meshes = t.meshes.map((n) => this._convertIdToIndex(n, 'mesh'))); + } + + _convertSceneIds (t) { + t.nodes && (t.nodes = t.nodes.map((n) => this._convertIdToIndex(n, 'node'))); + } + + _convertIdsToIndices (t, n) { + t[n] || (console.warn(`gltf v1: json doesn't contain attribute ${n}`), t[n] = []); + for (const s of t[n]) { + for (const r in s) { + const i = s[r]; const o = this._convertIdToIndex(i, r); + s[r] = o; + } + } + } + + _convertIdToIndex (t, n) { + const s = LA[n]; + if (s in this.idToIndexMap) { + const r = this.idToIndexMap[s][t]; + if (!Number.isFinite(r)) { throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`); } + return r; + } + return t; + } + + _updateObjects (t) { + for (const n of this.json.buffers) { delete n.type; } + } + + _updateMaterial (t) { + for (const i of t.materials) { + var n, s, r; + i.pbrMetallicRoughness = { + baseColorFactor: [1, 1, 1, 1], + metallicFactor: 1, + roughnessFactor: 1 + }; + const o = ((n = i.values) === null || n === void 0 ? void 0 : n.tex) || ((s = i.values) === null || s === void 0 ? void 0 : s.texture2d_0) || ((r = i.values) === null || r === void 0 ? void 0 : r.diffuseTex); const a = t.textures.findIndex((c) => c.id === o); + a !== -1 && (i.pbrMetallicRoughness.baseColorTexture = { + index: a + }); + } + } +} +function GA (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + return new PA().normalize(e, t); +} +async function NA (e, t) { + let n, s, r; + const i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; const o = arguments.length > 3 ? arguments[3] : void 0; const a = arguments.length > 4 ? arguments[4] : void 0; + return UA(e, t, i, o), GA(e, { + normalize: o == null || (n = o.gltf) === null || n === void 0 ? void 0 : n.normalize + }), OA(e, o, a), o != null && (s = o.gltf) !== null && s !== void 0 && s.loadBuffers && e.json.buffers && await HA(e, o, a), o != null && (r = o.gltf) !== null && r !== void 0 && r.loadImages && await JA(e, o, a), await FA(e, o, a), e; +} +function UA (e, t, n, s) { + if (s.uri && (e.baseUri = s.uri), t instanceof ArrayBuffer && !_0(t, n, s) && (t = new TextDecoder().decode(t)), typeof t === 'string') { e.json = Du(t); } else if (t instanceof ArrayBuffer) { + const o = {}; + n = w0(o, t, n, s.glb), yt(o.type === 'glTF', `Invalid GLB magic string ${o.type}`), e._glb = o, e.json = o.json; + } else { yt(!1, 'GLTF: must be ArrayBuffer or string'); } + const r = e.json.buffers || []; + if (e.buffers = new Array(r.length).fill(null), e._glb && e._glb.header.hasBinChunk) { + const { + binChunks: o + } = e._glb; + e.buffers[0] = { + arrayBuffer: o[0].arrayBuffer, + byteOffset: o[0].byteOffset, + byteLength: o[0].byteLength + }; + } + const i = e.json.images || []; + e.images = new Array(i.length).fill({}); +} +async function HA (e, t, n) { + const s = e.json.buffers || []; + for (let o = 0; o < s.length; ++o) { + const a = s[o]; + if (a.uri) { + var r, i; + const { + fetch: c + } = n; + yt(c); + const u = ec(a.uri, t); const l = await (n == null || (r = n.fetch) === null || r === void 0 ? void 0 : r.call(n, u)); const h = await (l == null || (i = l.arrayBuffer) === null || i === void 0 ? void 0 : i.call(l)); + e.buffers[o] = { + arrayBuffer: h, + byteOffset: 0, + byteLength: h.byteLength + }, delete a.uri; + } else { + e.buffers[o] === null && (e.buffers[o] = { + arrayBuffer: new ArrayBuffer(a.byteLength), + byteOffset: 0, + byteLength: a.byteLength + }); + } + } +} +async function JA (e, t, n) { + const s = VA(e); const r = e.json.images || []; const i = []; + for (const o of s) { i.push(jA(e, r[o], o, t, n)); } + return await Promise.all(i); +} +function VA (e) { + const t = /* @__PURE__ */ new Set(); const n = e.json.textures || []; + for (const s of n) { s.source !== void 0 && t.add(s.source); } + return Array.from(t).sort(); +} +async function jA (e, t, n, s, r) { + let i; + if (t.uri && !t.hasOwnProperty('bufferView')) { + const a = ec(t.uri, s); const { + fetch: c + } = r; + i = await (await c(a)).arrayBuffer(), t.bufferView = { + data: i + }; + } + if (Number.isFinite(t.bufferView)) { + const a = lg(e.json, e.buffers, t.bufferView); + i = dr(a.buffer, a.byteOffset, a.byteLength); + } + yt(i, 'glTF image has no data'); + let o = await Ke(i, [Zm, p0], { + ...s, + mimeType: t.mimeType, + basis: s.basis || { + format: tc() + } + }, r); + o && o[0] && (o = { + compressed: !0, + mipmaps: !1, + width: o[0].width, + height: o[0].height, + data: o[0] + }), e.images = e.images || [], e.images[n] = o; +} +const Nn = { + name: 'glTF', + id: 'gltf', + module: 'gltf', + version: n0, + extensions: ['gltf', 'glb'], + mimeTypes: ['model/gltf+json', 'model/gltf-binary'], + text: !0, + binary: !0, + tests: ['glTF'], + parse: kA, + options: { + gltf: { + normalize: !0, + loadBuffers: !0, + loadImages: !0, + decompressMeshes: !0 + }, + log: console + } +}; +async function kA (e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = arguments.length > 2 ? arguments[2] : void 0; + t = { + ...Nn.options, + ...t + }, t.gltf = { + ...Nn.options.gltf, + ...t.gltf + }; + const { + byteOffset: s = 0 + } = t; + return await NA({}, e, s, t, n); +} +const KA = { + SCALAR: 1, + VEC2: 2, + VEC3: 3, + VEC4: 4, + MAT2: 4, + MAT3: 9, + MAT4: 16 +}; const zA = { + 5120: 1, + 5121: 1, + 5122: 2, + 5123: 2, + 5125: 4, + 5126: 4 +}; const Bt = { + TEXTURE_MAG_FILTER: 10240, + TEXTURE_MIN_FILTER: 10241, + TEXTURE_WRAP_S: 10242, + TEXTURE_WRAP_T: 10243, + REPEAT: 10497, + LINEAR: 9729, + NEAREST_MIPMAP_LINEAR: 9986 +}; const WA = { + magFilter: Bt.TEXTURE_MAG_FILTER, + minFilter: Bt.TEXTURE_MIN_FILTER, + wrapS: Bt.TEXTURE_WRAP_S, + wrapT: Bt.TEXTURE_WRAP_T +}; const XA = { + [Bt.TEXTURE_MAG_FILTER]: Bt.LINEAR, + [Bt.TEXTURE_MIN_FILTER]: Bt.NEAREST_MIPMAP_LINEAR, + [Bt.TEXTURE_WRAP_S]: Bt.REPEAT, + [Bt.TEXTURE_WRAP_T]: Bt.REPEAT +}; +function QA () { + return { + id: 'default-sampler', + parameters: XA + }; +} +function qA (e) { + return zA[e]; +} +function YA (e) { + return KA[e]; +} +class $A { + constructor () { + this.baseUri = '', this.jsonUnprocessed = void 0, this.json = void 0, this.buffers = [], this.images = []; + } + + postProcess (t) { + const n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + const { + json: s, + buffers: r = [], + images: i = [] + } = t; const { + baseUri: o = '' + } = t; + return yt(s), this.baseUri = o, this.buffers = r, this.images = i, this.jsonUnprocessed = s, this.json = this._resolveTree(t.json, n), this.json; + } + + _resolveTree (t) { + const n = { + ...t + }; + return this.json = n, t.bufferViews && (n.bufferViews = t.bufferViews.map((s, r) => this._resolveBufferView(s, r))), t.images && (n.images = t.images.map((s, r) => this._resolveImage(s, r))), t.samplers && (n.samplers = t.samplers.map((s, r) => this._resolveSampler(s, r))), t.textures && (n.textures = t.textures.map((s, r) => this._resolveTexture(s, r))), t.accessors && (n.accessors = t.accessors.map((s, r) => this._resolveAccessor(s, r))), t.materials && (n.materials = t.materials.map((s, r) => this._resolveMaterial(s, r))), t.meshes && (n.meshes = t.meshes.map((s, r) => this._resolveMesh(s, r))), t.nodes && (n.nodes = t.nodes.map((s, r) => this._resolveNode(s, r)), n.nodes = n.nodes.map((s, r) => this._resolveNodeChildren(s))), t.skins && (n.skins = t.skins.map((s, r) => this._resolveSkin(s, r))), t.scenes && (n.scenes = t.scenes.map((s, r) => this._resolveScene(s, r))), typeof this.json.scene === 'number' && n.scenes && (n.scene = n.scenes[this.json.scene]), n; + } + + getScene (t) { + return this._get(this.json.scenes, t); + } + + getNode (t) { + return this._get(this.json.nodes, t); + } + + getSkin (t) { + return this._get(this.json.skins, t); + } + + getMesh (t) { + return this._get(this.json.meshes, t); + } + + getMaterial (t) { + return this._get(this.json.materials, t); + } + + getAccessor (t) { + return this._get(this.json.accessors, t); + } + + getCamera (t) { + return this._get(this.json.cameras, t); + } + + getTexture (t) { + return this._get(this.json.textures, t); + } + + getSampler (t) { + return this._get(this.json.samplers, t); + } + + getImage (t) { + return this._get(this.json.images, t); + } + + getBufferView (t) { + return this._get(this.json.bufferViews, t); + } + + getBuffer (t) { + return this._get(this.json.buffers, t); + } + + _get (t, n) { + if (typeof n === 'object') { return n; } + const s = t && t[n]; + return s || console.warn(`glTF file error: Could not find ${t}[${n}]`), s; + } + + _resolveScene (t, n) { + return { + ...t, + id: t.id || `scene-${n}`, + nodes: (t.nodes || []).map((s) => this.getNode(s)) + }; + } + + _resolveNode (t, n) { + const s = { + ...t, + id: (t == null ? void 0 : t.id) || `node-${n}` + }; + return t.mesh !== void 0 && (s.mesh = this.getMesh(t.mesh)), t.camera !== void 0 && (s.camera = this.getCamera(t.camera)), t.skin !== void 0 && (s.skin = this.getSkin(t.skin)), t.meshes !== void 0 && t.meshes.length && (s.mesh = t.meshes.reduce((r, i) => { + const o = this.getMesh(i); + return r.id = o.id, r.primitives = r.primitives.concat(o.primitives), r; + }, { + primitives: [] + })), s; + } + + _resolveNodeChildren (t) { + return t.children && (t.children = t.children.map((n) => this.getNode(n))), t; + } + + _resolveSkin (t, n) { + const s = typeof t.inverseBindMatrices === 'number' ? this.getAccessor(t.inverseBindMatrices) : void 0; + return { + ...t, + id: t.id || `skin-${n}`, + inverseBindMatrices: s + }; + } + + _resolveMesh (t, n) { + const s = { + ...t, + id: t.id || `mesh-${n}`, + primitives: [] + }; + return t.primitives && (s.primitives = t.primitives.map((r) => { + const i = { + ...r, + attributes: {}, + indices: void 0, + material: void 0 + }; const o = r.attributes; + for (const a in o) { i.attributes[a] = this.getAccessor(o[a]); } + return r.indices !== void 0 && (i.indices = this.getAccessor(r.indices)), r.material !== void 0 && (i.material = this.getMaterial(r.material)), i; + })), s; + } + + _resolveMaterial (t, n) { + const s = { + ...t, + id: t.id || `material-${n}` + }; + if (s.normalTexture && (s.normalTexture = { + ...s.normalTexture + }, s.normalTexture.texture = this.getTexture(s.normalTexture.index)), s.occlusionTexture && (s.occlusionTexture = { + ...s.occlusionTexture + }, s.occlusionTexture.texture = this.getTexture(s.occlusionTexture.index)), s.emissiveTexture && (s.emissiveTexture = { + ...s.emissiveTexture + }, s.emissiveTexture.texture = this.getTexture(s.emissiveTexture.index)), s.emissiveFactor || (s.emissiveFactor = s.emissiveTexture ? [1, 1, 1] : [0, 0, 0]), s.pbrMetallicRoughness) { + s.pbrMetallicRoughness = { + ...s.pbrMetallicRoughness + }; + const r = s.pbrMetallicRoughness; + r.baseColorTexture && (r.baseColorTexture = { + ...r.baseColorTexture + }, r.baseColorTexture.texture = this.getTexture(r.baseColorTexture.index)), r.metallicRoughnessTexture && (r.metallicRoughnessTexture = { + ...r.metallicRoughnessTexture + }, r.metallicRoughnessTexture.texture = this.getTexture(r.metallicRoughnessTexture.index)); + } + return s; + } + + _resolveAccessor (t, n) { + const s = qA(t.componentType); const r = YA(t.type); const i = s * r; const o = { + ...t, + id: t.id || `accessor-${n}`, + bytesPerComponent: s, + components: r, + bytesPerElement: i, + value: void 0, + bufferView: void 0, + sparse: void 0 + }; + if (t.bufferView !== void 0 && (o.bufferView = this.getBufferView(t.bufferView)), o.bufferView) { + const a = o.bufferView.buffer; const { + ArrayType: c, + byteLength: u + } = Ir(o, o.bufferView); const l = (o.bufferView.byteOffset || 0) + (o.byteOffset || 0) + a.byteOffset; + let h = a.arrayBuffer.slice(l, l + u); + o.bufferView.byteStride && (h = this._getValueFromInterleavedBuffer(a, l, o.bufferView.byteStride, o.bytesPerElement, o.count)), o.value = new c(h); + } + return o; + } + + _getValueFromInterleavedBuffer (t, n, s, r, i) { + const o = new Uint8Array(i * r); + for (let a = 0; a < i; a++) { + const c = n + a * s; + o.set(new Uint8Array(t.arrayBuffer.slice(c, c + r)), a * r); + } + return o.buffer; + } + + _resolveTexture (t, n) { + return { + ...t, + id: t.id || `texture-${n}`, + sampler: typeof t.sampler === 'number' ? this.getSampler(t.sampler) : QA(), + source: typeof t.source === 'number' ? this.getImage(t.source) : void 0 + }; + } + + _resolveSampler (t, n) { + const s = { + id: t.id || `sampler-${n}`, + ...t, + parameters: {} + }; + for (const r in s) { + const i = this._enumSamplerParameter(r); + i !== void 0 && (s.parameters[i] = s[r]); + } + return s; + } + + _enumSamplerParameter (t) { + return WA[t]; + } + + _resolveImage (t, n) { + const s = { + ...t, + id: t.id || `image-${n}`, + image: null, + bufferView: t.bufferView !== void 0 ? this.getBufferView(t.bufferView) : void 0 + }; const r = this.images[n]; + return r && (s.image = r), s; + } + + _resolveBufferView (t, n) { + const s = t.buffer; const r = this.buffers[s].arrayBuffer; + let i = this.buffers[s].byteOffset || 0; + return t.byteOffset && (i += t.byteOffset), { + id: `bufferView-${n}`, + ...t, + buffer: this.buffers[s], + data: new Uint8Array(r, i, t.byteLength) + }; + } + + _resolveCamera (t, n) { + const s = { + ...t, + id: t.id || `camera-${n}` + }; + return s.perspective, s.orthographic, s; + } +} +function oc (e, t) { + return new $A().postProcess(e, t); +} +const Zs = { + URI: 0, + EMBEDDED: 1 +}; +function ac (e, t, n, s) { + e.rotateYtoZ = !0; + const r = (e.byteOffset || 0) + (e.byteLength || 0) - n; + if (r === 0) { throw new Error('glTF byte length must be greater than 0.'); } + return e.gltfUpAxis = s != null && s['3d-tiles'] && s['3d-tiles'].assetGltfUpAxis ? s['3d-tiles'].assetGltfUpAxis : 'Y', e.gltfArrayBuffer = dr(t, n, r), e.gltfByteOffset = 0, e.gltfByteLength = r, n % 4 === 0 || console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`), (e.byteOffset || 0) + (e.byteLength || 0); +} +async function cc (e, t, n, s) { + const r = (n == null ? void 0 : n['3d-tiles']) || {}; + if (ZA(e, t), r.loadGLTF) { + if (!s) { return; } + if (e.gltfUrl) { + const { + fetch: i + } = s; const o = await i(e.gltfUrl, n); + e.gltfArrayBuffer = await o.arrayBuffer(), e.gltfByteOffset = 0; + } + if (e.gltfArrayBuffer) { + const i = await Ke(e.gltfArrayBuffer, Nn, n, s); + e.gltf = oc(i), e.gpuMemoryUsageInBytes = ka(e.gltf), delete e.gltfArrayBuffer, delete e.gltfByteOffset, delete e.gltfByteLength; + } + } +} +function ZA (e, t, n) { + switch (t) { + case Zs.URI: + if (e.gltfArrayBuffer) { + const s = new Uint8Array(e.gltfArrayBuffer, e.gltfByteOffset); const i = new TextDecoder().decode(s); + e.gltfUrl = i.replace(/[\s\0]+$/, ''); + } + delete e.gltfArrayBuffer, delete e.gltfByteOffset, delete e.gltfByteLength; + break; + case Zs.EMBEDDED: + break; + default: + throw new Error('b3dm: Illegal glTF format field'); + } +} +async function tp (e, t, n, s, r) { + let i; + n = ep(e, t, n, s), await cc(e, Zs.EMBEDDED, s, r); + const o = e == null || (i = e.gltf) === null || i === void 0 ? void 0 : i.extensions; + return o && o.CESIUM_RTC && (e.rtcCenter = o.CESIUM_RTC.center), n; +} +function ep (e, t, n, s, r) { + n = qn(e, t, n), n = _r(e, t, n), n = wr(e, t, n), n = ac(e, t, n, s); + const i = new br(e.featureTableJson, e.featureTableBinary); + return e.rtcCenter = i.getGlobalProperty('RTC_CENTER', G.FLOAT, 3), n; +} +async function np (e, t, n, s, r) { + return n = sp(e, t, n, s), await cc(e, e.gltfFormat || 0, s, r), n; +} +function sp (e, t, n, s, r) { + let i; + if (n = qn(e, t, n), e.version !== 1) { throw new Error(`Instanced 3D Model version ${e.version} is not supported`); } + n = _r(e, t, n); + const o = new DataView(t); + if (e.gltfFormat = o.getUint32(n, !0), n += 4, n = wr(e, t, n), n = ac(e, t, n, s), !(e != null && (i = e.header) !== null && i !== void 0 && i.featureTableJsonByteLength) || e.header.featureTableJsonByteLength === 0) { throw new Error('i3dm parser: featureTableJsonByteLength is zero.'); } + const a = new br(e.featureTableJson, e.featureTableBinary); const c = a.getGlobalProperty('INSTANCES_LENGTH'); + if (a.featuresLength = c, !Number.isFinite(c)) { throw new Error('i3dm parser: INSTANCES_LENGTH must be defined'); } + e.eastNorthUp = a.getGlobalProperty('EAST_NORTH_UP'), e.rtcCenter = a.getGlobalProperty('RTC_CENTER', G.FLOAT, 3); + const u = new Pa(e.batchTableJson, e.batchTableBinary, c); + return rp(e, a, u, c), n; +} +function rp (e, t, n, s) { + const r = new Array(s); const i = new A(); + new A(), new A(), new A(); + const o = new X(); const a = new On(); const c = new A(); const u = {}; const l = new V(); const h = []; const f = []; const d = []; const m = []; + for (let g = 0; g < s; g++) { + let y; + if (t.hasProperty('POSITION')) { y = t.getProperty('POSITION', G.FLOAT, 3, g, i); } else if (t.hasProperty('POSITION_QUANTIZED')) { + y = t.getProperty('POSITION_QUANTIZED', G.UNSIGNED_SHORT, 3, g, i); + const b = t.getGlobalProperty('QUANTIZED_VOLUME_OFFSET', G.FLOAT, 3); + if (!b) { throw new Error('i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.'); } + const O = t.getGlobalProperty('QUANTIZED_VOLUME_SCALE', G.FLOAT, 3); + if (!O) { throw new Error('i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.'); } + const F = 65535; + for (let v = 0; v < 3; v++) { y[v] = y[v] / F * O[v] + b[v]; } + } + if (!y) { throw new Error('i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.'); } + if (i.copy(y), u.translation = i, e.normalUp = t.getProperty('NORMAL_UP', G.FLOAT, 3, g, h), e.normalRight = t.getProperty('NORMAL_RIGHT', G.FLOAT, 3, g, f), e.normalUp) { + if (!e.normalRight) { throw new Error('i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.'); } + e.hasCustomOrientation = !0; + } else { + if (e.octNormalUp = t.getProperty('NORMAL_UP_OCT32P', G.UNSIGNED_SHORT, 2, g, h), e.octNormalRight = t.getProperty('NORMAL_RIGHT_OCT32P', G.UNSIGNED_SHORT, 2, g, f), e.octNormalUp) { throw e.octNormalRight ? new Error('i3dm: oct-encoded orientation not implemented') : new Error('i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P'); } + e.eastNorthUp ? (J.WGS84.eastNorthUpToFixedFrame(i, l), l.getRotationMatrix3(o)) : o.identity(); + } + a.fromMatrix3(o), u.rotation = a, c.set(1, 1, 1); + const E = t.getProperty('SCALE', G.FLOAT, 1, g, d); + Number.isFinite(E) && c.multiplyByScalar(E); + const R = t.getProperty('SCALE_NON_UNIFORM', G.FLOAT, 3, g, h); + R && c.scale(R), u.scale = c; + let B = t.getProperty('BATCH_ID', G.UNSIGNED_SHORT, 1, g, m); + B === void 0 && (B = g); + const C = new V().fromQuaternion(u.rotation); + l.identity(), l.translate(u.translation), l.multiplyRight(C), l.scale(u.scale); + const M = l.clone(); + r[g] = { + modelMatrix: M, + batchId: B + }; + } + e.instances = r; +} +async function ip (e, t, n, s, r, i) { + n = qn(e, t, n); + const o = new DataView(t); + for (e.tilesLength = o.getUint32(n, !0), n += 4, e.tiles = []; e.tiles.length < e.tilesLength && (e.byteLength || 0) - n > 12;) { + const a = { + shape: 'tile3d' + }; + e.tiles.push(a), n = await i(t, n, s, r, a); + } + return n; +} +async function op (e, t, n, s) { + let r, i; + if (e.rotateYtoZ = !0, e.gltfUpAxis = n != null && (r = n['3d-tiles']) !== null && r !== void 0 && r.assetGltfUpAxis ? n['3d-tiles'].assetGltfUpAxis : 'Y', n != null && (i = n['3d-tiles']) !== null && i !== void 0 && i.loadGLTF) { + if (!s) { return t.byteLength; } + const o = await Ke(t, Nn, n, s); + e.gltf = oc(o), e.gpuMemoryUsageInBytes = ka(e.gltf); + } else { e.gltfArrayBuffer = t; } + return t.byteLength; +} +async function uc (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; const n = arguments.length > 2 ? arguments[2] : void 0; const s = arguments.length > 3 ? arguments[3] : void 0; const r = arguments.length > 4 && arguments[4] !== void 0 + ? arguments[4] + : { + shape: 'tile3d' + }; + switch (r.byteOffset = t, r.type = Sd(e, t), r.type) { + case _e.COMPOSITE: + return await ip(r, e, t, n, s, uc); + case _e.BATCHED_3D_MODEL: + return await tp(r, e, t, n, s); + case _e.GLTF: + return await op(r, e, n, s); + case _e.INSTANCED_3D_MODEL: + return await np(r, e, t, n, s); + case _e.POINT_CLOUD: + return await fm(r, e, t, n, s); + default: + throw new Error(`3DTileLoader: unknown type ${r.type}`); + } +} +const ap = 1952609651; const cp = 1; +async function up (e, t, n) { + if (new Uint32Array(e.slice(0, 4))[0] !== ap) { throw new Error('Wrong subtree file magic number'); } + if (new Uint32Array(e.slice(4, 8))[0] !== cp) { throw new Error('Wrong subtree file verson, must be 1'); } + const i = Zi(e.slice(8, 16)); const o = new Uint8Array(e, 24, i); const c = new TextDecoder('utf8').decode(o); const u = JSON.parse(c); const l = Zi(e.slice(16, 24)); + let h = new ArrayBuffer(0); + if (l && (h = e.slice(24 + i)), await pn(u, u.tileAvailability, h, n), Array.isArray(u.contentAvailability)) { + for (const f of u.contentAvailability) { await pn(u, f, h, n); } + } else { await pn(u, u.contentAvailability, h, n); } + return await pn(u, u.childSubtreeAvailability, h, n), u; +} +async function pn (e, t, n, s) { + const r = Number.isFinite(t.bitstream) ? t.bitstream : t.bufferView; + if (typeof r !== 'number') { return; } + const i = e.bufferViews[r]; const o = e.buffers[i.buffer]; + if (!(s != null && s.baseUrl)) { throw new Error('Url is not provided'); } + if (!s.fetch) { throw new Error('fetch is not provided'); } + if (o.uri) { + const c = `${(s == null ? void 0 : s.baseUrl) || ''}/${o.uri}`; const l = await (await s.fetch(c)).arrayBuffer(); + t.explicitBitstream = new Uint8Array(l, i.byteOffset, i.byteLength); + return; + } + const a = e.buffers.slice(0, i.buffer).reduce((c, u) => c + u.byteLength, 0); + t.explicitBitstream = new Uint8Array(n.slice(a, a + o.byteLength), i.byteOffset, i.byteLength); +} +function Zi (e) { + const t = new DataView(e); const n = t.getUint32(0, !0); const s = t.getUint32(4, !0); + return n + 2 ** 32 * s; +} +const lc = { + id: '3d-tiles-subtree', + name: '3D Tiles Subtree', + module: '3d-tiles', + version: va, + extensions: ['subtree'], + mimeTypes: ['application/octet-stream'], + tests: ['subtree'], + parse: up, + options: {} +}; +/** + * @license + * Copyright 2009 The Closure Library Authors + * Copyright 2020 Daniel Wirtz / The long.js Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +let Et = null; +try { + Et = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ + 0, + 97, + 115, + 109, + 1, + 0, + 0, + 0, + 1, + 13, + 2, + 96, + 0, + 1, + 127, + 96, + 4, + 127, + 127, + 127, + 127, + 1, + 127, + 3, + 7, + 6, + 0, + 1, + 1, + 1, + 1, + 1, + 6, + 6, + 1, + 127, + 1, + 65, + 0, + 11, + 7, + 50, + 6, + 3, + 109, + 117, + 108, + 0, + 1, + 5, + 100, + 105, + 118, + 95, + 115, + 0, + 2, + 5, + 100, + 105, + 118, + 95, + 117, + 0, + 3, + 5, + 114, + 101, + 109, + 95, + 115, + 0, + 4, + 5, + 114, + 101, + 109, + 95, + 117, + 0, + 5, + 8, + 103, + 101, + 116, + 95, + 104, + 105, + 103, + 104, + 0, + 0, + 10, + 191, + 1, + 6, + 4, + 0, + 35, + 0, + 11, + 36, + 1, + 1, + 126, + 32, + 0, + 173, + 32, + 1, + 173, + 66, + 32, + 134, + 132, + 32, + 2, + 173, + 32, + 3, + 173, + 66, + 32, + 134, + 132, + 126, + 34, + 4, + 66, + 32, + 135, + 167, + 36, + 0, + 32, + 4, + 167, + 11, + 36, + 1, + 1, + 126, + 32, + 0, + 173, + 32, + 1, + 173, + 66, + 32, + 134, + 132, + 32, + 2, + 173, + 32, + 3, + 173, + 66, + 32, + 134, + 132, + 127, + 34, + 4, + 66, + 32, + 135, + 167, + 36, + 0, + 32, + 4, + 167, + 11, + 36, + 1, + 1, + 126, + 32, + 0, + 173, + 32, + 1, + 173, + 66, + 32, + 134, + 132, + 32, + 2, + 173, + 32, + 3, + 173, + 66, + 32, + 134, + 132, + 128, + 34, + 4, + 66, + 32, + 135, + 167, + 36, + 0, + 32, + 4, + 167, + 11, + 36, + 1, + 1, + 126, + 32, + 0, + 173, + 32, + 1, + 173, + 66, + 32, + 134, + 132, + 32, + 2, + 173, + 32, + 3, + 173, + 66, + 32, + 134, + 132, + 129, + 34, + 4, + 66, + 32, + 135, + 167, + 36, + 0, + 32, + 4, + 167, + 11, + 36, + 1, + 1, + 126, + 32, + 0, + 173, + 32, + 1, + 173, + 66, + 32, + 134, + 132, + 32, + 2, + 173, + 32, + 3, + 173, + 66, + 32, + 134, + 132, + 130, + 34, + 4, + 66, + 32, + 135, + 167, + 36, + 0, + 32, + 4, + 167, + 11 + ])), {}).exports; +} catch { +} +function H (e, t, n) { + this.low = e | 0, this.high = t | 0, this.unsigned = !!n; +} +H.prototype.__isLong__; +Object.defineProperty(H.prototype, '__isLong__', { value: !0 }); +function at (e) { + return (e && e.__isLong__) === !0; +} +function to (e) { + const t = Math.clz32(e & -e); + return e ? 31 - t : t; +} +H.isLong = at; +const eo = {}; const no = {}; +function ie (e, t) { + let n, s, r; + return t ? (e >>>= 0, (r = e >= 0 && e < 256) && (s = no[e], s) ? s : (n = N(e, 0, !0), r && (no[e] = n), n)) : (e |= 0, (r = e >= -128 && e < 128) && (s = eo[e], s) ? s : (n = N(e, e < 0 ? -1 : 0, !1), r && (eo[e] = n), n)); +} +H.fromInt = ie; +function Tt (e, t) { + if (isNaN(e)) { return t ? Ut : St; } + if (t) { + if (e < 0) { return Ut; } + if (e >= hc) { return mc; } + } else { + if (e <= -ro) { return mt; } + if (e + 1 >= ro) { return dc; } + } + return e < 0 ? Tt(-e, t).neg() : N(e % ye | 0, e / ye | 0, t); +} +H.fromNumber = Tt; +function N (e, t, n) { + return new H(e, t, n); +} +H.fromBits = N; +const Un = Math.pow; +function Pr (e, t, n) { + if (e.length === 0) { throw Error('empty string'); } + if (typeof t === 'number' ? (n = t, t = !1) : t = !!t, e === 'NaN' || e === 'Infinity' || e === '+Infinity' || e === '-Infinity') { return t ? Ut : St; } + if (n = n || 10, n < 2 || n > 36) { throw RangeError('radix'); } + let s; + if ((s = e.indexOf('-')) > 0) { throw Error('interior hyphen'); } + if (s === 0) { return Pr(e.substring(1), t, n).neg(); } + for (var r = Tt(Un(n, 8)), i = St, o = 0; o < e.length; o += 8) { + const a = Math.min(8, e.length - o); const c = parseInt(e.substring(o, o + a), n); + if (a < 8) { + const u = Tt(Un(n, a)); + i = i.mul(u).add(Tt(c)); + } else { i = i.mul(r), i = i.add(Tt(c)); } + } + return i.unsigned = t, i; +} +H.fromString = Pr; +function xt (e, t) { + return typeof e === 'number' ? Tt(e, t) : typeof e === 'string' ? Pr(e, t) : N(e.low, e.high, typeof t === 'boolean' ? t : e.unsigned); +} +H.fromValue = xt; +const so = 65536; const lp = 1 << 24; var ye = so * so; var hc = ye * ye; var ro = hc / 2; const io = ie(lp); var St = ie(0); +H.ZERO = St; +var Ut = ie(0, !0); +H.UZERO = Ut; +const de = ie(1); +H.ONE = de; +const fc = ie(1, !0); +H.UONE = fc; +const tr = ie(-1); +H.NEG_ONE = tr; +var dc = N(-1, 2147483647, !1); +H.MAX_VALUE = dc; +var mc = N(-1, -1, !0); +H.MAX_UNSIGNED_VALUE = mc; +var mt = N(0, -2147483648, !1); +H.MIN_VALUE = mt; +const _ = H.prototype; +_.toInt = function () { + return this.unsigned ? this.low >>> 0 : this.low; +}; +_.toNumber = function () { + return this.unsigned ? (this.high >>> 0) * ye + (this.low >>> 0) : this.high * ye + (this.low >>> 0); +}; +_.toString = function (t) { + if (t = t || 10, t < 2 || t > 36) { throw RangeError('radix'); } + if (this.isZero()) { return '0'; } + if (this.isNegative()) { + if (this.eq(mt)) { + const n = Tt(t); const s = this.div(n); const r = s.mul(n).sub(this); + return s.toString(t) + r.toInt().toString(t); + } else { return '-' + this.neg().toString(t); } + } + for (let i = Tt(Un(t, 6), this.unsigned), o = this, a = ''; ;) { + const c = o.div(i); const u = o.sub(c.mul(i)).toInt() >>> 0; let l = u.toString(t); + if (o = c, o.isZero()) { return l + a; } + for (; l.length < 6;) { l = '0' + l; } + a = '' + l + a; + } +}; +_.getHighBits = function () { + return this.high; +}; +_.getHighBitsUnsigned = function () { + return this.high >>> 0; +}; +_.getLowBits = function () { + return this.low; +}; +_.getLowBitsUnsigned = function () { + return this.low >>> 0; +}; +_.getNumBitsAbs = function () { + if (this.isNegative()) { return this.eq(mt) ? 64 : this.neg().getNumBitsAbs(); } + for (var t = this.high != 0 ? this.high : this.low, n = 31; n > 0 && !(t & 1 << n); n--) + ; + return this.high != 0 ? n + 33 : n + 1; +}; +_.isZero = function () { + return this.high === 0 && this.low === 0; +}; +_.eqz = _.isZero; +_.isNegative = function () { + return !this.unsigned && this.high < 0; +}; +_.isPositive = function () { + return this.unsigned || this.high >= 0; +}; +_.isOdd = function () { + return (this.low & 1) === 1; +}; +_.isEven = function () { + return (this.low & 1) === 0; +}; +_.equals = function (t) { + return at(t) || (t = xt(t)), this.unsigned !== t.unsigned && this.high >>> 31 === 1 && t.high >>> 31 === 1 ? !1 : this.high === t.high && this.low === t.low; +}; +_.eq = _.equals; +_.notEquals = function (t) { + return !this.eq( + /* validates */ + t + ); +}; +_.neq = _.notEquals; +_.ne = _.notEquals; +_.lessThan = function (t) { + return this.comp( + /* validates */ + t + ) < 0; +}; +_.lt = _.lessThan; +_.lessThanOrEqual = function (t) { + return this.comp( + /* validates */ + t + ) <= 0; +}; +_.lte = _.lessThanOrEqual; +_.le = _.lessThanOrEqual; +_.greaterThan = function (t) { + return this.comp( + /* validates */ + t + ) > 0; +}; +_.gt = _.greaterThan; +_.greaterThanOrEqual = function (t) { + return this.comp( + /* validates */ + t + ) >= 0; +}; +_.gte = _.greaterThanOrEqual; +_.ge = _.greaterThanOrEqual; +_.compare = function (t) { + if (at(t) || (t = xt(t)), this.eq(t)) { return 0; } + const n = this.isNegative(); const s = t.isNegative(); + return n && !s ? -1 : !n && s ? 1 : this.unsigned ? t.high >>> 0 > this.high >>> 0 || t.high === this.high && t.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(t).isNegative() ? -1 : 1; +}; +_.comp = _.compare; +_.negate = function () { + return !this.unsigned && this.eq(mt) ? mt : this.not().add(de); +}; +_.neg = _.negate; +_.add = function (t) { + at(t) || (t = xt(t)); + const n = this.high >>> 16; const s = this.high & 65535; const r = this.low >>> 16; const i = this.low & 65535; const o = t.high >>> 16; const a = t.high & 65535; const c = t.low >>> 16; const u = t.low & 65535; let l = 0; let h = 0; let f = 0; let d = 0; + return d += i + u, f += d >>> 16, d &= 65535, f += r + c, h += f >>> 16, f &= 65535, h += s + a, l += h >>> 16, h &= 65535, l += n + o, l &= 65535, N(f << 16 | d, l << 16 | h, this.unsigned); +}; +_.subtract = function (t) { + return at(t) || (t = xt(t)), this.add(t.neg()); +}; +_.sub = _.subtract; +_.multiply = function (t) { + if (this.isZero()) { return this; } + if (at(t) || (t = xt(t)), Et) { + const n = Et.mul( + this.low, + this.high, + t.low, + t.high + ); + return N(n, Et.get_high(), this.unsigned); + } + if (t.isZero()) { return this.unsigned ? Ut : St; } + if (this.eq(mt)) { return t.isOdd() ? mt : St; } + if (t.eq(mt)) { return this.isOdd() ? mt : St; } + if (this.isNegative()) { return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg(); } + if (t.isNegative()) { return this.mul(t.neg()).neg(); } + if (this.lt(io) && t.lt(io)) { return Tt(this.toNumber() * t.toNumber(), this.unsigned); } + const s = this.high >>> 16; const r = this.high & 65535; const i = this.low >>> 16; const o = this.low & 65535; const a = t.high >>> 16; const c = t.high & 65535; const u = t.low >>> 16; const l = t.low & 65535; let h = 0; let f = 0; let d = 0; let m = 0; + return m += o * l, d += m >>> 16, m &= 65535, d += i * l, f += d >>> 16, d &= 65535, d += o * u, f += d >>> 16, d &= 65535, f += r * l, h += f >>> 16, f &= 65535, f += i * u, h += f >>> 16, f &= 65535, f += o * c, h += f >>> 16, f &= 65535, h += s * l + r * u + i * c + o * a, h &= 65535, N(d << 16 | m, h << 16 | f, this.unsigned); +}; +_.mul = _.multiply; +_.divide = function (t) { + if (at(t) || (t = xt(t)), t.isZero()) { throw Error('division by zero'); } + if (Et) { + if (!this.unsigned && this.high === -2147483648 && t.low === -1 && t.high === -1) { return this; } + const n = (this.unsigned ? Et.div_u : Et.div_s)( + this.low, + this.high, + t.low, + t.high + ); + return N(n, Et.get_high(), this.unsigned); + } + if (this.isZero()) { return this.unsigned ? Ut : St; } + let s, r, i; + if (this.unsigned) { + if (t.unsigned || (t = t.toUnsigned()), t.gt(this)) { return Ut; } + if (t.gt(this.shru(1))) { return fc; } + i = Ut; + } else { + if (this.eq(mt)) { + if (t.eq(de) || t.eq(tr)) { return mt; } + if (t.eq(mt)) { return de; } + const o = this.shr(1); + return s = o.div(t).shl(1), s.eq(St) ? t.isNegative() ? de : tr : (r = this.sub(t.mul(s)), i = s.add(r.div(t)), i); + } else if (t.eq(mt)) { return this.unsigned ? Ut : St; } + if (this.isNegative()) { return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg(); } + if (t.isNegative()) { return this.div(t.neg()).neg(); } + i = St; + } + for (r = this; r.gte(t);) { + s = Math.max(1, Math.floor(r.toNumber() / t.toNumber())); + for (var a = Math.ceil(Math.log(s) / Math.LN2), c = a <= 48 ? 1 : Un(2, a - 48), u = Tt(s), l = u.mul(t); l.isNegative() || l.gt(r);) { s -= c, u = Tt(s, this.unsigned), l = u.mul(t); } + u.isZero() && (u = de), i = i.add(u), r = r.sub(l); + } + return i; +}; +_.div = _.divide; +_.modulo = function (t) { + if (at(t) || (t = xt(t)), Et) { + const n = (this.unsigned ? Et.rem_u : Et.rem_s)( + this.low, + this.high, + t.low, + t.high + ); + return N(n, Et.get_high(), this.unsigned); + } + return this.sub(this.div(t).mul(t)); +}; +_.mod = _.modulo; +_.rem = _.modulo; +_.not = function () { + return N(~this.low, ~this.high, this.unsigned); +}; +_.countLeadingZeros = function () { + return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32; +}; +_.clz = _.countLeadingZeros; +_.countTrailingZeros = function () { + return this.low ? to(this.low) : to(this.high) + 32; +}; +_.ctz = _.countTrailingZeros; +_.and = function (t) { + return at(t) || (t = xt(t)), N(this.low & t.low, this.high & t.high, this.unsigned); +}; +_.or = function (t) { + return at(t) || (t = xt(t)), N(this.low | t.low, this.high | t.high, this.unsigned); +}; +_.xor = function (t) { + return at(t) || (t = xt(t)), N(this.low ^ t.low, this.high ^ t.high, this.unsigned); +}; +_.shiftLeft = function (t) { + return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low << t, this.high << t | this.low >>> 32 - t, this.unsigned) : N(0, this.low << t - 32, this.unsigned); +}; +_.shl = _.shiftLeft; +_.shiftRight = function (t) { + return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low >>> t | this.high << 32 - t, this.high >> t, this.unsigned) : N(this.high >> t - 32, this.high >= 0 ? 0 : -1, this.unsigned); +}; +_.shr = _.shiftRight; +_.shiftRightUnsigned = function (t) { + return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t < 32 ? N(this.low >>> t | this.high << 32 - t, this.high >>> t, this.unsigned) : t === 32 ? N(this.high, 0, this.unsigned) : N(this.high >>> t - 32, 0, this.unsigned); +}; +_.shru = _.shiftRightUnsigned; +_.shr_u = _.shiftRightUnsigned; +_.rotateLeft = function (t) { + let n; + return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t === 32 ? N(this.high, this.low, this.unsigned) : t < 32 ? (n = 32 - t, N(this.low << t | this.high >>> n, this.high << t | this.low >>> n, this.unsigned)) : (t -= 32, n = 32 - t, N(this.high << t | this.low >>> n, this.low << t | this.high >>> n, this.unsigned)); +}; +_.rotl = _.rotateLeft; +_.rotateRight = function (t) { + let n; + return at(t) && (t = t.toInt()), (t &= 63) === 0 ? this : t === 32 ? N(this.high, this.low, this.unsigned) : t < 32 ? (n = 32 - t, N(this.high << n | this.low >>> t, this.low << n | this.high >>> t, this.unsigned)) : (t -= 32, n = 32 - t, N(this.low << n | this.high >>> t, this.high << n | this.low >>> t, this.unsigned)); +}; +_.rotr = _.rotateRight; +_.toSigned = function () { + return this.unsigned ? N(this.low, this.high, !1) : this; +}; +_.toUnsigned = function () { + return this.unsigned ? this : N(this.low, this.high, !0); +}; +_.toBytes = function (t) { + return t ? this.toBytesLE() : this.toBytesBE(); +}; +_.toBytesLE = function () { + const t = this.high; const n = this.low; + return [ + n & 255, + n >>> 8 & 255, + n >>> 16 & 255, + n >>> 24, + t & 255, + t >>> 8 & 255, + t >>> 16 & 255, + t >>> 24 + ]; +}; +_.toBytesBE = function () { + const t = this.high; const n = this.low; + return [ + t >>> 24, + t >>> 16 & 255, + t >>> 8 & 255, + t & 255, + n >>> 24, + n >>> 16 & 255, + n >>> 8 & 255, + n & 255 + ]; +}; +H.fromBytes = function (t, n, s) { + return s ? H.fromBytesLE(t, n) : H.fromBytesBE(t, n); +}; +H.fromBytesLE = function (t, n) { + return new H( + t[0] | t[1] << 8 | t[2] << 16 | t[3] << 24, + t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24, + n + ); +}; +H.fromBytesBE = function (t, n) { + return new H( + t[4] << 24 | t[5] << 16 | t[6] << 8 | t[7], + t[0] << 24 | t[1] << 16 | t[2] << 8 | t[3], + n + ); +}; +const hp = 16; +function gc (e) { + e === 'X' && (e = ''); + const t = e.padEnd(hp, '0'); + return H.fromString(t, !0, 16); +} +function fp (e) { + if (e.isZero()) { return 'X'; } + let t = e.countTrailingZeros(); + const n = t % 4; + t = (t - n) / 4; + const s = t; + t *= 4; + const i = e.shiftRightUnsigned(t).toString(16).replace(/0+$/, ''); + return Array(17 - s - i.length).join('0') + i; +} +function dp (e, t) { + const n = mp(e).shiftRightUnsigned(2); + return e.add(H.fromNumber(2 * t + 1 - 4).multiply(n)); +} +function mp (e) { + return e.and(e.not().add(1)); +} +const gp = 3; const Ap = 30; const pp = 2 * Ap + 1; const oo = 180 / Math.PI; +function yp (e) { + if (e.length === 0) { throw new Error(`Invalid Hilbert quad key ${e}`); } + const t = e.split('/'); const n = parseInt(t[0], 10); const s = t[1]; const r = s.length; + let i = 0; + const o = [0, 0]; + for (let a = r - 1; a >= 0; a--) { + i = r - a; + const c = s[a]; + let u = 0; let l = 0; + c === '1' ? l = 1 : c === '2' ? (u = 1, l = 1) : c === '3' && (u = 1); + const h = Math.pow(2, i - 1); + Cp(h, o, u, l), o[0] += h * u, o[1] += h * l; + } + if (n % 2 === 1) { + const a = o[0]; + o[0] = o[1], o[1] = a; + } + return { + face: n, + ij: o, + level: i + }; +} +function Bp (e) { + if (e.isZero()) { return ''; } + let t = e.toString(2); + for (; t.length < gp + pp;) { t = '0' + t; } + const n = t.lastIndexOf('1'); const s = t.substring(0, 3); const r = t.substring(3, n); const i = r.length / 2; const o = H.fromString(s, !0, 2).toString(10); + let a = ''; + if (i !== 0) { + for (a = H.fromString(r, !0, 2).toString(4); a.length < i;) { a = '0' + a; } + } + return `${o}/${a}`; +} +function Ac (e, t, n) { + const s = 1 << t; + return [(e[0] + n[0]) / s, (e[1] + n[1]) / s]; +} +function ao (e) { + return e >= 0.5 ? 1 / 3 * (4 * e * e - 1) : 1 / 3 * (1 - 4 * (1 - e) * (1 - e)); +} +function pc (e) { + return [ao(e[0]), ao(e[1])]; +} +function yc (e, t) { + const [n, s] = t; + switch (e) { + case 0: + return [1, n, s]; + case 1: + return [-n, 1, s]; + case 2: + return [-n, -s, 1]; + case 3: + return [-1, -s, -n]; + case 4: + return [s, -1, -n]; + case 5: + return [s, n, -1]; + default: + throw new Error('Invalid face'); + } +} +function Bc (e) { + const [t, n, s] = e; + const r = Math.atan2(s, Math.sqrt(t * t + n * n)); + return [Math.atan2(n, t) * oo, r * oo]; +} +function Cp (e, t, n, s) { + if (s === 0) { + n === 1 && (t[0] = e - 1 - t[0], t[1] = e - 1 - t[1]); + const r = t[0]; + t[0] = t[1], t[1] = r; + } +} +function Ep (e) { + const t = Ac(e.ij, e.level, [0.5, 0.5]); const n = pc(t); const s = yc(e.face, n); + return Bc(s); +} +const Tp = 100; +function co (e) { + const { + face: t, + ij: n, + level: s + } = e; const r = [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]; const i = Math.max(1, Math.ceil(Tp * Math.pow(2, -s))); const o = new Float64Array(4 * i * 2 + 2); + let a = 0; let c = 0; + for (let u = 0; u < 4; u++) { + const l = r[u].slice(0); const h = r[u + 1]; const f = (h[0] - l[0]) / i; const d = (h[1] - l[1]) / i; + for (let m = 0; m < i; m++) { + l[0] += f, l[1] += d; + const g = Ac(n, s, l); const y = pc(g); const E = yc(t, y); const R = Bc(E); + Math.abs(R[1]) > 89.999 && (R[0] = c); + const B = R[0] - c; + R[0] += B > 180 ? -360 : B < -180 ? 360 : 0, o[a++] = R[0], o[a++] = R[1], c = R[0]; + } + } + return o[a++] = o[0], o[a++] = o[1], o; +} +function Gr (e) { + const t = bp(e); + return yp(t); +} +function bp (e) { + if (e.indexOf('/') > 0) { return e; } + const t = gc(e); + return Bp(t); +} +function _p (e) { + const t = Gr(e); + return Ep(t); +} +function wp (e) { + let t; + if (e.face === 2 || e.face === 5) { + let n = null; let s = 0; + for (let r = 0; r < 4; r++) { + const i = `${e.face}/${r}`; const o = Gr(i); const a = co(o); + (typeof n > 'u' || n === null) && (n = new Float64Array(4 * a.length)), n.set(a, s), s += a.length; + } + t = uo(n); + } else { + const n = co(e); + t = uo(n); + } + return t; +} +function uo (e) { + if (e.length % 2 !== 0) { throw new Error('Invalid corners'); } + const t = []; const n = []; + for (let s = 0; s < e.length; s += 2) { t.push(e[s]), n.push(e[s + 1]); } + return t.sort((s, r) => s - r), n.sort((s, r) => s - r), { + west: t[0], + east: t[t.length - 1], + north: n[n.length - 1], + south: n[0] + }; +} +function Rp (e, t) { + const n = (t == null ? void 0 : t.minimumHeight) || 0; const s = (t == null ? void 0 : t.maximumHeight) || 0; const r = Gr(e); const i = wp(r); const o = i.west; const a = i.south; const c = i.east; const u = i.north; const l = []; + return l.push(new A(o, u, n)), l.push(new A(c, u, n)), l.push(new A(c, a, n)), l.push(new A(o, a, n)), l.push(new A(o, u, s)), l.push(new A(c, u, s)), l.push(new A(c, a, s)), l.push(new A(o, a, s)), l; +} +function Cc (e) { + const t = e.token; const n = { + minimumHeight: e.minimumHeight, + maximumHeight: e.maximumHeight + }; const s = Rp(t, n); const r = _p(t); const i = r[0]; const o = r[1]; const a = J.WGS84.cartographicToCartesian([i, o, n.maximumHeight]); const c = new A(a[0], a[1], a[2]); + s.push(c); + const u = Rd(s); + return [...u.center, ...u.halfAxes]; +} +const Mp = 4; const Sp = 8; const Ip = { + QUADTREE: Mp, + OCTREE: Sp +}; +function xp (e, t, n) { + if (e != null && e.box) { + const s = gc(e.s2VolumeInfo.token); const r = dp(s, t); const i = fp(r); const o = { + ...e.s2VolumeInfo + }; + switch (o.token = i, n) { + case 'OCTREE': + const u = e.s2VolumeInfo; const l = u.maximumHeight - u.minimumHeight; const h = l / 2; const f = u.minimumHeight + l / 2; + u.minimumHeight = f - h, u.maximumHeight = f + h; + break; + } + return { + box: Cc(o), + s2VolumeInfo: o + }; + } +} +async function Ec (e) { + const { + implicitOptions: t, + parentData: n = { + mortonIndex: 0, + x: 0, + y: 0, + z: 0 + }, + childIndex: s = 0, + s2VolumeBox: r, + loaderOptions: i + } = e; + let { + subtree: o, + level: a = 0, + globalData: c = { + level: 0, + mortonIndex: 0, + x: 0, + y: 0, + z: 0 + } + } = e; + const { + subdivisionScheme: u, + subtreeLevels: l, + maximumLevel: h, + contentUrlTemplate: f, + subtreesUriTemplate: d, + basePath: m + } = t; const g = { + children: [], + lodMetricValue: 0, + contentUrl: '' + }; + if (!h) { return aa.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`), g; } + const y = a + c.level; + if (y > h) { return g; } + const E = Ip[u]; const R = Math.log2(E); const B = s & 1; const C = s >> 1 & 1; const M = s >> 2 & 1; const b = (E ** a - 1) / (E - 1); + let O = Qt(n.mortonIndex, s, R); let F = b + O; let v = Qt(n.x, B, 1); let L = Qt(n.y, C, 1); let k = Qt(n.z, M, 1); let q = !1; + a >= l && (q = Ss(o.childSubtreeAvailability, O)); + const Y = Qt(c.x, v, a); const P = Qt(c.y, L, a); const ct = Qt(c.z, k, a); + if (q) { + const st = `${m}/${d}`; const Pt = er(st, y, Y, P, ct); + o = await Ae(Pt, lc, i), c = { + mortonIndex: O, + x: v, + y: L, + z: k, + level: a + }, O = 0, F = 0, v = 0, L = 0, k = 0, a = 0; + } + if (!Ss(o.tileAvailability, F)) { return g; } + Ss(o.contentAvailability, F) && (g.contentUrl = er(f, y, Y, P, ct)); + const Be = a + 1; const vt = { + mortonIndex: O, + x: v, + y: L, + z: k + }; + for (let st = 0; st < E; st++) { + const Pt = xp(r, st, u); const Xt = await Ec({ + subtree: o, + implicitOptions: t, + loaderOptions: i, + parentData: vt, + childIndex: st, + level: Be, + globalData: { + ...c + }, + s2VolumeBox: Pt + }); + if (Xt.contentUrl || Xt.children.length) { + const Ce = y + 1; const es = vp(Xt, Ce, { + childTileX: v, + childTileY: L, + childTileZ: k + }, t, r); + g.children.push(es); + } + } + return g; +} +function Ss (e, t) { + let n; + return Array.isArray(e) ? (n = e[0], e.length > 1 && aa.once('Not supported extension "3DTILES_multiple_contents" has been detected')) : n = e, 'constant' in n ? !!n.constant : n.explicitBitstream ? Dp(t, n.explicitBitstream) : !1; +} +function vp (e, t, n, s, r) { + const { + basePath: i, + refine: o, + getRefine: a, + lodMetricType: c, + getTileType: u, + rootLodMetricValue: l, + rootBoundingVolume: h + } = s; const f = e.contentUrl && e.contentUrl.replace(`${i}/`, ''); const d = l / 2 ** t; const m = r != null && r.box + ? { + box: r.box + } + : h; const g = Op(t, m, n); + return { + children: e.children, + contentUrl: e.contentUrl, + content: { + uri: f + }, + id: e.contentUrl, + refine: a(o), + type: u(e), + lodMetricType: c, + lodMetricValue: d, + geometricError: d, + transform: e.transform, + boundingVolume: g + }; +} +function Op (e, t, n) { + if (t.region) { + const { + childTileX: s, + childTileY: r, + childTileZ: i + } = n; const [o, a, c, u, l, h] = t.region; const f = 2 ** e; const d = (c - o) / f; const m = (u - a) / f; const g = (h - l) / f; const [y, E] = [o + d * s, o + d * (s + 1)]; const [R, B] = [a + m * r, a + m * (r + 1)]; const [C, M] = [l + g * i, l + g * (i + 1)]; + return { + region: [y, R, E, B, C, M] + }; + } + if (t.box) { return t; } + throw new Error(`Unsupported bounding volume type ${t}`); +} +function Qt (e, t, n) { + return (e << n) + t; +} +function er (e, t, n, s, r) { + const i = Fp({ + level: t, + x: n, + y: s, + z: r + }); + return e.replace(/{level}|{x}|{y}|{z}/gi, (o) => i[o]); +} +function Fp (e) { + const t = {}; + for (const n in e) { t[`{${n}}`] = e[n]; } + return t; +} +function Dp (e, t) { + const n = Math.floor(e / 8); const s = e % 8; + return (t[n] >> s & 1) === 1; +} +function Nr (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ''; + if (!t) { return dn.EMPTY; } + const s = t.split('?')[0].split('.').pop(); + switch (s) { + case 'pnts': + return dn.POINTCLOUD; + case 'i3dm': + case 'b3dm': + case 'glb': + case 'gltf': + return dn.SCENEGRAPH; + default: + return s || dn.EMPTY; + } +} +function Ur (e) { + switch (e) { + case 'REPLACE': + case 'replace': + return Ii.REPLACE; + case 'ADD': + case 'add': + return Ii.ADD; + default: + return e; + } +} +function nr (e, t) { + if (/^[a-z][0-9a-z+.-]*:/i.test(t)) { + const s = new URL(e, `${t}/`); + return decodeURI(s.toString()); + } else if (e.startsWith('/')) { return e; } + return ku(t, e); +} +function lo (e, t) { + if (!e) { return null; } + let n; + if (e.content) { + let s; + const i = e.content.uri || ((s = e.content) === null || s === void 0 ? void 0 : s.url); + typeof i < 'u' && (n = nr(i, t)); + } + return { + ...e, + id: n, + contentUrl: n, + lodMetricType: Qn.GEOMETRIC_ERROR, + lodMetricValue: e.geometricError, + transformMatrix: e.transform, + type: Nr(e, n), + refine: Ur(e.refine) + }; +} +async function Lp (e, t, n) { + let s = null; + const r = fo(e.root); + r && e.root ? s = await ho(e.root, e, t, r, n) : s = lo(e.root, t); + const i = []; + for (i.push(s); i.length > 0;) { + const o = i.pop() || {}; const a = o.children || []; const c = []; + for (const u of a) { + const l = fo(u); + let h; + l ? h = await ho(u, e, t, l, n) : h = lo(u, t), h && (c.push(h), i.push(h)); + } + o.children = c; + } + return s; +} +async function ho (e, t, n, s, r) { + let i, o, a; + const { + subdivisionScheme: c, + maximumLevel: u, + availableLevels: l, + subtreeLevels: h, + subtrees: { + uri: f + } + } = s; const d = er(f, 0, 0, 0, 0); const m = nr(d, n); const g = await Ae(m, lc, r); const y = (i = e.content) === null || i === void 0 ? void 0 : i.uri; const E = y ? nr(y, n) : ''; const R = t == null || (o = t.root) === null || o === void 0 ? void 0 : o.refine; const B = e.geometricError; const C = (a = e.boundingVolume.extensions) === null || a === void 0 ? void 0 : a['3DTILES_bounding_volume_S2']; + if (C) { + const F = { + box: Cc(C), + s2VolumeInfo: C + }; + e.boundingVolume = F; + } + const M = e.boundingVolume; const b = { + contentUrlTemplate: E, + subtreesUriTemplate: f, + subdivisionScheme: c, + subtreeLevels: h, + maximumLevel: Number.isFinite(l) ? l - 1 : u, + refine: R, + basePath: n, + lodMetricType: Qn.GEOMETRIC_ERROR, + rootLodMetricValue: B, + rootBoundingVolume: M, + getTileType: Nr, + getRefine: Ur + }; + return await Pp(e, n, g, b, r); +} +async function Pp (e, t, n, s, r) { + if (!e) { return null; } + const { + children: i, + contentUrl: o + } = await Ec({ + subtree: n, + implicitOptions: s, + loaderOptions: r + }); + let a; let c = null; + return o && (a = o, c = { + uri: o.replace(`${t}/`, '') + }), { + ...e, + id: a, + contentUrl: a, + lodMetricType: Qn.GEOMETRIC_ERROR, + lodMetricValue: e.geometricError, + transformMatrix: e.transform, + type: Nr(e, a), + refine: Ur(e.refine), + content: c || e.content, + children: i + }; +} +function fo (e) { + let t; + return (e == null || (t = e.extensions) === null || t === void 0 ? void 0 : t['3DTILES_implicit_tiling']) || (e == null ? void 0 : e.implicitTiling); +} +const Le = { + id: '3d-tiles', + name: '3D Tiles', + module: '3d-tiles', + version: va, + extensions: ['cmpt', 'pnts', 'b3dm', 'i3dm'], + mimeTypes: ['application/octet-stream'], + tests: ['cmpt', 'pnts', 'b3dm', 'i3dm'], + parse: Gp, + options: { + '3d-tiles': { + loadGLTF: !0, + decodeQuantizedPositions: !1, + isTileset: 'auto', + assetGltfUpAxis: null + } + } +}; +async function Gp (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = arguments.length > 2 ? arguments[2] : void 0; + const s = t['3d-tiles'] || {}; + let r; + return s.isTileset === 'auto' ? r = (n == null ? void 0 : n.url) && n.url.indexOf('.json') !== -1 : r = s.isTileset, r ? Np(e, t, n) : Up(e, t, n); +} +async function Np (e, t, n) { + let s; + const r = JSON.parse(new TextDecoder().decode(e)); const i = (n == null ? void 0 : n.url) || ''; const o = Hp(i); const a = await Lp(r, o, t || {}); + return { + ...r, + shape: 'tileset3d', + loader: Le, + url: i, + queryString: (n == null ? void 0 : n.queryString) || '', + basePath: o, + root: a || r.root, + type: Md.TILES3D, + lodMetricType: Qn.GEOMETRIC_ERROR, + lodMetricValue: ((s = r.root) === null || s === void 0 ? void 0 : s.geometricError) || 0 + }; +} +async function Up (e, t, n) { + const s = { + content: { + shape: 'tile3d', + featureIds: null + } + }; + return await uc(e, 0, t, n, s.content), s.content; +} +function Hp (e) { + return ea(e); +} +const Tc = 'https://api.cesium.com/v1/assets'; +async function Jp (e, t) { + if (!t) { + const i = await Vp(e); + for (const o of i.items) { o.type === '3DTILES' && (t = o.id); } + } + const n = await jp(e, t); const { + type: s, + url: r + } = n; + return z(s === '3DTILES' && r), n.headers = { + Authorization: `Bearer ${n.accessToken}` + }, n; +} +async function Vp (e) { + z(e); + const t = Tc; const n = { + Authorization: `Bearer ${e}` + }; const s = await Ge(t, { + headers: n + }); + if (!s.ok) { throw new Error(s.statusText); } + return await s.json(); +} +async function jp (e, t) { + z(e, t); + const n = { + Authorization: `Bearer ${e}` + }; const s = `${Tc}/${t}`; + let r = await Ge(`${s}`, { + headers: n + }); + if (!r.ok) { throw new Error(r.statusText); } + let i = await r.json(); + if (r = await Ge(`${s}/endpoint`, { + headers: n + }), !r.ok) { throw new Error(r.statusText); } + const o = await r.json(); + return i = { + ...i, + ...o + }, i; +} +async function kp (e) { + let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + t = t['cesium-ion'] || {}; + const { + accessToken: n + } = t; + let s = t.assetId; + if (!Number.isFinite(s)) { + const r = e.match(/\/([0-9]+)\/tileset.json/); + s = r && r[1]; + } + return Jp(n, s); +} +const bc = { + ...Le, + id: 'cesium-ion', + name: 'Cesium Ion', + preload: kp, + parse: async (e, t, n) => (t = { + ...t + }, t['3d-tiles'] = t['cesium-ion'], t.loader = bc, Le.parse(e, t, n)), + options: { + 'cesium-ion': { + ...Le.options['3d-tiles'], + accessToken: null + } + } +}; const mo = 100; +class Kp { + constructor (t, n) { + if (this.schema = void 0, this.options = void 0, this.shape = void 0, this.length = 0, this.rows = null, this.cursor = 0, this._headers = [], this.options = n, this.schema = t, !Array.isArray(t)) { + this._headers = []; + for (const s in t) { this._headers[t[s].index] = t[s].name; } + } + } + + rowCount () { + return this.length; + } + + addArrayRow (t, n) { + Number.isFinite(n) && (this.cursor = n), this.shape = 'array-row-table', this.rows = this.rows || new Array(mo), this.rows[this.length] = t, this.length++; + } + + addObjectRow (t, n) { + Number.isFinite(n) && (this.cursor = n), this.shape = 'object-row-table', this.rows = this.rows || new Array(mo), this.rows[this.length] = t, this.length++; + } + + getBatch () { + let t = this.rows; + return t + ? (t = t.slice(0, this.length), this.rows = null, { + shape: this.shape || 'array-row-table', + batchType: 'data', + data: t, + length: this.length, + schema: this.schema, + cursor: this.cursor + }) + : null; + } +} +function zp (e, t) { + if (!e) { throw new Error('null row'); } + const n = {}; + if (t) { + for (let s = 0; s < t.length; s++) { n[t[s]] = e[s]; } + } else { + for (let s = 0; s < e.length; s++) { + const r = `column-${s}`; + n[r] = e[s]; + } + } + return n; +} +function Wp (e, t) { + if (!e) { throw new Error('null row'); } + if (t) { + const n = new Array(t.length); + for (let s = 0; s < t.length; s++) { n[s] = e[t[s]]; } + return n; + } + return Object.values(e); +} +function Xp (e) { + const t = []; + for (let n = 0; n < e.length; n++) { + const s = `column-${n}`; + t.push(s); + } + return t; +} +function Qp (e) { + return Object.keys(e); +} +const go = 100; +class qp { + constructor (t, n) { + if (this.schema = void 0, this.options = void 0, this.length = 0, this.objectRows = null, this.arrayRows = null, this.cursor = 0, this._headers = null, this.options = n, this.schema = t, t) { + this._headers = []; + for (const s in t) { this._headers[t[s].index] = t[s].name; } + } + } + + rowCount () { + return this.length; + } + + addArrayRow (t, n) { + switch (Number.isFinite(n) && (this.cursor = n), this._headers || (this._headers = Xp(t)), this.options.shape) { + case 'object-row-table': + const s = zp(t, this._headers); + this.addObjectRow(s, n); + break; + case 'array-row-table': + this.arrayRows = this.arrayRows || new Array(go), this.arrayRows[this.length] = t, this.length++; + break; + } + } + + addObjectRow (t, n) { + switch (Number.isFinite(n) && (this.cursor = n), this._headers || (this._headers = Qp(t)), this.options.shape) { + case 'array-row-table': + const s = Wp(t, this._headers); + this.addArrayRow(s, n); + break; + case 'object-row-table': + this.objectRows = this.objectRows || new Array(go), this.objectRows[this.length] = t, this.length++; + break; + } + } + + getBatch () { + let t = this.arrayRows || this.objectRows; + return t + ? (t = t.slice(0, this.length), this.arrayRows = null, this.objectRows = null, { + shape: this.options.shape, + batchType: 'data', + data: t, + length: this.length, + schema: this.schema, + cursor: this.cursor + }) + : null; + } +} +const Yp = 100; +class $p { + constructor (t, n) { + this.schema = void 0, this.length = 0, this.allocated = 0, this.columns = {}, this.schema = t, this._reallocateColumns(); + } + + rowCount () { + return this.length; + } + + addArrayRow (t) { + this._reallocateColumns(); + let n = 0; + for (const s in this.columns) { this.columns[s][this.length] = t[n++]; } + this.length++; + } + + addObjectRow (t) { + this._reallocateColumns(); + for (const n in t) { this.columns[n][this.length] = t[n]; } + this.length++; + } + + getBatch () { + this._pruneColumns(); + const t = Array.isArray(this.schema) ? this.columns : {}; + if (!Array.isArray(this.schema)) { + for (const s in this.schema) { + const r = this.schema[s]; + t[r.name] = this.columns[r.index]; + } + } + return this.columns = {}, { + shape: 'columnar-table', + batchType: 'data', + data: t, + schema: this.schema, + length: this.length + }; + } + + _reallocateColumns () { + if (!(this.length < this.allocated)) { + this.allocated = this.allocated > 0 ? this.allocated *= 2 : Yp, this.columns = {}; + for (const t in this.schema) { + const n = this.schema[t]; const s = n.type || Float32Array; const r = this.columns[n.index]; + if (r && ArrayBuffer.isView(r)) { + const i = new s(this.allocated); + i.set(r), this.columns[n.index] = i; + } else { r ? (r.length = this.allocated, this.columns[n.index] = r) : this.columns[n.index] = new s(this.allocated); } + } + } + } + + _pruneColumns () { + for (const [t, n] of Object.entries(this.columns)) { this.columns[t] = n.slice(0, this.length); } + } +} +const Zp = { + shape: void 0, + batchSize: 'auto', + batchDebounceMs: 0, + limit: 0, + _limitMB: 0 +}; const ty = 'TableBatchBuilder'; +class He { + constructor (t, n) { + this.schema = void 0, this.options = void 0, this.aggregator = null, this.batchCount = 0, this.bytesUsed = 0, this.isChunkComplete = !1, this.lastBatchEmittedMs = Date.now(), this.totalLength = 0, this.totalBytes = 0, this.rowBytes = 0, this.schema = t, this.options = { + ...Zp, + ...n + }; + } + + limitReached () { + let t, n; + return !!(!((t = this.options) === null || t === void 0) && t.limit && this.totalLength >= this.options.limit || !((n = this.options) === null || n === void 0) && n._limitMB && this.totalBytes / 1e6 >= this.options._limitMB); + } + + addRow (t) { + this.limitReached() || (this.totalLength++, this.rowBytes = this.rowBytes || this._estimateRowMB(t), this.totalBytes += this.rowBytes, Array.isArray(t) ? this.addArrayRow(t) : this.addObjectRow(t)); + } + + addArrayRow (t) { + if (!this.aggregator) { + const n = this._getTableBatchType(); + this.aggregator = new n(this.schema, this.options); + } + this.aggregator.addArrayRow(t); + } + + addObjectRow (t) { + if (!this.aggregator) { + const n = this._getTableBatchType(); + this.aggregator = new n(this.schema, this.options); + } + this.aggregator.addObjectRow(t); + } + + chunkComplete (t) { + t instanceof ArrayBuffer && (this.bytesUsed += t.byteLength), typeof t === 'string' && (this.bytesUsed += t.length), this.isChunkComplete = !0; + } + + getFullBatch (t) { + return this._isFull() ? this._getBatch(t) : null; + } + + getFinalBatch (t) { + return this._getBatch(t); + } + + _estimateRowMB (t) { + return Array.isArray(t) ? t.length * 8 : Object.keys(t).length * 8; + } + + _isFull () { + if (!this.aggregator || this.aggregator.rowCount() === 0) { return !1; } + if (this.options.batchSize === 'auto') { + if (!this.isChunkComplete) { return !1; } + } else if (this.options.batchSize > this.aggregator.rowCount()) { return !1; } + return this.options.batchDebounceMs > Date.now() - this.lastBatchEmittedMs ? !1 : (this.isChunkComplete = !1, this.lastBatchEmittedMs = Date.now(), !0); + } + + _getBatch (t) { + if (!this.aggregator) { return null; } + t != null && t.bytesUsed && (this.bytesUsed = t.bytesUsed); + const n = this.aggregator.getBatch(); + return n.count = this.batchCount, n.bytesUsed = this.bytesUsed, Object.assign(n, t), this.batchCount++, this.aggregator = null, n; + } + + _getTableBatchType () { + switch (this.options.shape) { + case 'array-row-table': + case 'object-row-table': + return qp; + case 'columnar-table': + return $p; + case 'arrow-table': + if (!He.ArrowBatch) { throw new Error(ty); } + return He.ArrowBatch; + default: + return Kp; + } + } +} +He.ArrowBatch = void 0; +function ey (e) { + try { + const t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + return (async function * () { + const n = new TextDecoder(void 0, t); + for await (const s of e) { + yield typeof s === 'string' + ? s + : n.decode(s, { + stream: !0 + }); + } + }()); + } catch (t) { + return Promise.reject(t); + } +} +const sr = Number.MAX_SAFE_INTEGER; +var S = (function (e) { + return e[e.BEGIN = 0] = 'BEGIN', e[e.VALUE = 1] = 'VALUE', e[e.OPEN_OBJECT = 2] = 'OPEN_OBJECT', e[e.CLOSE_OBJECT = 3] = 'CLOSE_OBJECT', e[e.OPEN_ARRAY = 4] = 'OPEN_ARRAY', e[e.CLOSE_ARRAY = 5] = 'CLOSE_ARRAY', e[e.TEXT_ESCAPE = 6] = 'TEXT_ESCAPE', e[e.STRING = 7] = 'STRING', e[e.BACKSLASH = 8] = 'BACKSLASH', e[e.END = 9] = 'END', e[e.OPEN_KEY = 10] = 'OPEN_KEY', e[e.CLOSE_KEY = 11] = 'CLOSE_KEY', e[e.TRUE = 12] = 'TRUE', e[e.TRUE2 = 13] = 'TRUE2', e[e.TRUE3 = 14] = 'TRUE3', e[e.FALSE = 15] = 'FALSE', e[e.FALSE2 = 16] = 'FALSE2', e[e.FALSE3 = 17] = 'FALSE3', e[e.FALSE4 = 18] = 'FALSE4', e[e.NULL = 19] = 'NULL', e[e.NULL2 = 20] = 'NULL2', e[e.NULL3 = 21] = 'NULL3', e[e.NUMBER_DECIMAL_POINT = 22] = 'NUMBER_DECIMAL_POINT', e[e.NUMBER_DIGIT = 23] = 'NUMBER_DIGIT', e; +}(S || {})); +const I = { + tab: 9, + lineFeed: 10, + carriageReturn: 13, + space: 32, + doubleQuote: 34, + plus: 43, + comma: 44, + minus: 45, + period: 46, + _0: 48, + _9: 57, + colon: 58, + E: 69, + openBracket: 91, + backslash: 92, + closeBracket: 93, + a: 97, + b: 98, + e: 101, + f: 102, + l: 108, + n: 110, + r: 114, + s: 115, + t: 116, + u: 117, + openBrace: 123, + closeBrace: 125 +}; const Ao = /[\\"\n]/g; const po = { + onready: () => { + }, + onopenobject: () => { + }, + onkey: () => { + }, + oncloseobject: () => { + }, + onopenarray: () => { + }, + onclosearray: () => { + }, + onvalue: () => { + }, + onerror: () => { + }, + onend: () => { + }, + onchunkparsed: () => { + } +}; +class ny { + constructor () { + const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + this.options = po, this.bufferCheckPosition = sr, this.q = '', this.c = '', this.p = '', this.closed = !1, this.closedRoot = !1, this.sawRoot = !1, this.error = null, this.state = S.BEGIN, this.stack = [], this.position = 0, this.column = 0, this.line = 1, this.slashed = !1, this.unicodeI = 0, this.unicodeS = null, this.depth = 0, this.textNode = void 0, this.numberNode = void 0, this.options = { + ...po, + ...t + }, this.textNode = void 0, this.numberNode = '', this.emit('onready'); + } + + end () { + return (this.state !== S.VALUE || this.depth !== 0) && this._error('Unexpected end'), this._closeValue(), this.c = '', this.closed = !0, this.emit('onend'), this; + } + + resume () { + return this.error = null, this; + } + + close () { + return this.write(null); + } + + emit (t, n) { + let s, r; + (s = (r = this.options)[t]) === null || s === void 0 || s.call(r, n, this); + } + + emitNode (t, n) { + this._closeValue(), this.emit(t, n); + } + + write (t) { + if (this.error) { throw this.error; } + if (this.closed) { return this._error('Cannot write after close. Assign an onready handler.'); } + if (t === null) { return this.end(); } + let n = 0; let s = t.charCodeAt(0); let r = this.p; + for (; s && (r = s, this.c = s = t.charCodeAt(n++), r !== s ? this.p = r : r = this.p, !!s);) { + switch (this.position++, s === I.lineFeed ? (this.line++, this.column = 0) : this.column++, this.state) { + case S.BEGIN: + s === I.openBrace ? this.state = S.OPEN_OBJECT : s === I.openBracket ? this.state = S.OPEN_ARRAY : Se(s) || this._error('Non-whitespace before {[.'); + continue; + case S.OPEN_KEY: + case S.OPEN_OBJECT: + if (Se(s)) { continue; } + if (this.state === S.OPEN_KEY) { this.stack.push(S.CLOSE_KEY); } else if (s === I.closeBrace) { + this.emit('onopenobject'), this.depth++, this.emit('oncloseobject'), this.depth--, this.state = this.stack.pop() || S.VALUE; + continue; + } else { this.stack.push(S.CLOSE_OBJECT); } + s === I.doubleQuote ? this.state = S.STRING : this._error('Malformed object key should start with "'); + continue; + case S.CLOSE_KEY: + case S.CLOSE_OBJECT: + if (Se(s)) { continue; } + s === I.colon ? (this.state === S.CLOSE_OBJECT ? (this.stack.push(S.CLOSE_OBJECT), this._closeValue('onopenobject'), this.depth++) : this._closeValue('onkey'), this.state = S.VALUE) : s === I.closeBrace ? (this.emitNode('oncloseobject'), this.depth--, this.state = this.stack.pop() || S.VALUE) : s === I.comma ? (this.state === S.CLOSE_OBJECT && this.stack.push(S.CLOSE_OBJECT), this._closeValue(), this.state = S.OPEN_KEY) : this._error('Bad object'); + continue; + case S.OPEN_ARRAY: + case S.VALUE: + if (Se(s)) { continue; } + if (this.state === S.OPEN_ARRAY) { + if (this.emit('onopenarray'), this.depth++, this.state = S.VALUE, s === I.closeBracket) { + this.emit('onclosearray'), this.depth--, this.state = this.stack.pop() || S.VALUE; + continue; + } else { this.stack.push(S.CLOSE_ARRAY); } + } + s === I.doubleQuote ? this.state = S.STRING : s === I.openBrace ? this.state = S.OPEN_OBJECT : s === I.openBracket ? this.state = S.OPEN_ARRAY : s === I.t ? this.state = S.TRUE : s === I.f ? this.state = S.FALSE : s === I.n ? this.state = S.NULL : s === I.minus ? this.numberNode += '-' : I._0 <= s && s <= I._9 ? (this.numberNode += String.fromCharCode(s), this.state = S.NUMBER_DIGIT) : this._error('Bad value'); + continue; + case S.CLOSE_ARRAY: + if (s === I.comma) { this.stack.push(S.CLOSE_ARRAY), this._closeValue('onvalue'), this.state = S.VALUE; } else if (s === I.closeBracket) { this.emitNode('onclosearray'), this.depth--, this.state = this.stack.pop() || S.VALUE; } else { + if (Se(s)) { continue; } + this._error('Bad array'); + } + continue; + case S.STRING: + this.textNode === void 0 && (this.textNode = ''); + let i = n - 1; let o = this.slashed; let a = this.unicodeI; + t: + for (; ;) { + for (; a > 0;) { + if (this.unicodeS += String.fromCharCode(s), s = t.charCodeAt(n++), this.position++, a === 4 ? (this.textNode += String.fromCharCode(parseInt(this.unicodeS, 16)), a = 0, i = n - 1) : a++, !s) { break t; } + } + if (s === I.doubleQuote && !o) { + this.state = this.stack.pop() || S.VALUE, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i; + break; + } + if (s === I.backslash && !o && (o = !0, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i, s = t.charCodeAt(n++), this.position++, !s)) { break; } + if (o) { + if (o = !1, s === I.n + ? this.textNode += ` +` + : s === I.r ? this.textNode += '\r' : s === I.t ? this.textNode += ' ' : s === I.f ? this.textNode += '\f' : s === I.b ? this.textNode += '\b' : s === I.u ? (a = 1, this.unicodeS = '') : this.textNode += String.fromCharCode(s), s = t.charCodeAt(n++), this.position++, i = n - 1, s) { continue; } + break; + } + Ao.lastIndex = n; + const c = Ao.exec(t); + if (c === null) { + n = t.length + 1, this.textNode += t.substring(i, n - 1), this.position += n - 1 - i; + break; + } + if (n = c.index + 1, s = t.charCodeAt(c.index), !s) { + this.textNode += t.substring(i, n - 1), this.position += n - 1 - i; + break; + } + } + this.slashed = o, this.unicodeI = a; + continue; + case S.TRUE: + s === I.r ? this.state = S.TRUE2 : this._error(`Invalid true started with t${s}`); + continue; + case S.TRUE2: + s === I.u ? this.state = S.TRUE3 : this._error(`Invalid true started with tr${s}`); + continue; + case S.TRUE3: + s === I.e ? (this.emit('onvalue', !0), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid true started with tru${s}`); + continue; + case S.FALSE: + s === I.a ? this.state = S.FALSE2 : this._error(`Invalid false started with f${s}`); + continue; + case S.FALSE2: + s === I.l ? this.state = S.FALSE3 : this._error(`Invalid false started with fa${s}`); + continue; + case S.FALSE3: + s === I.s ? this.state = S.FALSE4 : this._error(`Invalid false started with fal${s}`); + continue; + case S.FALSE4: + s === I.e ? (this.emit('onvalue', !1), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid false started with fals${s}`); + continue; + case S.NULL: + s === I.u ? this.state = S.NULL2 : this._error(`Invalid null started with n${s}`); + continue; + case S.NULL2: + s === I.l ? this.state = S.NULL3 : this._error(`Invalid null started with nu${s}`); + continue; + case S.NULL3: + s === I.l ? (this.emit('onvalue', null), this.state = this.stack.pop() || S.VALUE) : this._error(`Invalid null started with nul${s}`); + continue; + case S.NUMBER_DECIMAL_POINT: + s === I.period ? (this.numberNode += '.', this.state = S.NUMBER_DIGIT) : this._error('Leading zero not followed by .'); + continue; + case S.NUMBER_DIGIT: + I._0 <= s && s <= I._9 ? this.numberNode += String.fromCharCode(s) : s === I.period ? (this.numberNode.indexOf('.') !== -1 && this._error('Invalid number has two dots'), this.numberNode += '.') : s === I.e || s === I.E ? ((this.numberNode.indexOf('e') !== -1 || this.numberNode.indexOf('E') !== -1) && this._error('Invalid number has two exponential'), this.numberNode += 'e') : s === I.plus || s === I.minus ? (r === I.e || r === I.E || this._error('Invalid symbol in number'), this.numberNode += String.fromCharCode(s)) : (this._closeNumber(), n--, this.state = this.stack.pop() || S.VALUE); + continue; + default: + this._error(`Unknown state: ${this.state}`); + } + } + return this.position >= this.bufferCheckPosition && sy(this), this.emit('onchunkparsed'), this; + } + + _closeValue () { + const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'onvalue'; + this.textNode !== void 0 && this.emit(t, this.textNode), this.textNode = void 0; + } + + _closeNumber () { + this.numberNode && this.emit('onvalue', parseFloat(this.numberNode)), this.numberNode = ''; + } + + _error () { + let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ''; + this._closeValue(), t += ` +Line: ${this.line} +Column: ${this.column} +Char: ${this.c}`; + const n = new Error(t); + this.error = n, this.emit('onerror', n); + } +} +function Se (e) { + return e === I.carriageReturn || e === I.lineFeed || e === I.space || e === I.tab; +} +function sy (e) { + const t = Math.max(sr, 10); + let n = 0; + for (const s of ['textNode', 'numberNode']) { + const r = e[s] === void 0 ? 0 : e[s].length; + if (r > t) { + switch (s) { + case 'text': + break; + default: + e._error(`Max buffer length exceeded: ${s}`); + } + } + n = Math.max(n, r); + } + e.bufferCheckPosition = sr - n + e.position; +} +class te { + constructor () { + const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null; + if (this.path = void 0, this.path = ['$'], t instanceof te) { + this.path = [...t.path]; + return; + } + if (Array.isArray(t)) { + this.path.push(...t); + return; + } + if (typeof t === 'string' && (this.path = t.split('.'), this.path[0] !== '$')) { throw new Error('JSONPaths must start with $'); } + } + + clone () { + return new te(this); + } + + toString () { + return this.path.join('.'); + } + + push (t) { + this.path.push(t); + } + + pop () { + return this.path.pop(); + } + + set (t) { + this.path[this.path.length - 1] = t; + } + + equals (t) { + if (!this || !t || this.path.length !== t.path.length) { return !1; } + for (let n = 0; n < this.path.length; ++n) { + if (this.path[n] !== t.path[n]) { return !1; } + } + return !0; + } + + setFieldAtPath (t, n) { + const s = [...this.path]; + s.shift(); + const r = s.pop(); + for (const i of s) { t = t[i]; } + t[r] = n; + } + + getFieldAtPath (t) { + const n = [...this.path]; + n.shift(); + const s = n.pop(); + for (const r of n) { t = t[r]; } + return t[s]; + } +} +class ry { + constructor (t) { + this.parser = void 0, this.result = void 0, this.previousStates = [], this.currentState = Object.freeze({ + container: [], + key: null + }), this.jsonpath = new te(), this.reset(), this.parser = new ny({ + onready: () => { + this.jsonpath = new te(), this.previousStates.length = 0, this.currentState.container.length = 0; + }, + onopenobject: (n) => { + this._openObject({}), typeof n < 'u' && this.parser.emit('onkey', n); + }, + onkey: (n) => { + this.jsonpath.set(n), this.currentState.key = n; + }, + oncloseobject: () => { + this._closeObject(); + }, + onopenarray: () => { + this._openArray(); + }, + onclosearray: () => { + this._closeArray(); + }, + onvalue: (n) => { + this._pushOrSet(n); + }, + onerror: (n) => { + throw n; + }, + onend: () => { + this.result = this.currentState.container.pop(); + }, + ...t + }); + } + + reset () { + this.result = void 0, this.previousStates = [], this.currentState = Object.freeze({ + container: [], + key: null + }), this.jsonpath = new te(); + } + + write (t) { + this.parser.write(t); + } + + close () { + this.parser.close(); + } + + _pushOrSet (t) { + const { + container: n, + key: s + } = this.currentState; + s !== null ? (n[s] = t, this.currentState.key = null) : n.push(t); + } + + _openArray () { + const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; + this.jsonpath.push(null), this._pushOrSet(t), this.previousStates.push(this.currentState), this.currentState = { + container: t, + isArray: !0, + key: null + }; + } + + _closeArray () { + this.jsonpath.pop(), this.currentState = this.previousStates.pop(); + } + + _openObject () { + const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + this.jsonpath.push(null), this._pushOrSet(t), this.previousStates.push(this.currentState), this.currentState = { + container: t, + isArray: !1, + key: null + }; + } + + _closeObject () { + this.jsonpath.pop(), this.currentState = this.previousStates.pop(); + } +} +class iy extends ry { + constructor () { + const t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + super({ + onopenarray: () => { + if (!this.streamingArray && this._matchJSONPath()) { + this.streamingJsonPath = this.getJsonPath().clone(), this.streamingArray = [], this._openArray(this.streamingArray); + return; + } + this._openArray(); + }, + onopenobject: (s) => { + this.topLevelObject ? this._openObject({}) : (this.topLevelObject = {}, this._openObject(this.topLevelObject)), typeof s < 'u' && this.parser.emit('onkey', s); + } + }), this.jsonPaths = void 0, this.streamingJsonPath = null, this.streamingArray = null, this.topLevelObject = null; + const n = t.jsonpaths || []; + this.jsonPaths = n.map((s) => new te(s)); + } + + write (t) { + super.write(t); + let n = []; + return this.streamingArray && (n = [...this.streamingArray], this.streamingArray.length = 0), n; + } + + getPartialResult () { + return this.topLevelObject; + } + + getStreamingJsonPath () { + return this.streamingJsonPath; + } + + getStreamingJsonPathAsString () { + return this.streamingJsonPath && this.streamingJsonPath.toString(); + } + + getJsonPath () { + return this.jsonpath; + } + + _matchJSONPath () { + const t = this.getJsonPath(); + if (this.jsonPaths.length === 0) { return !0; } + for (const n of this.jsonPaths) { + if (n.equals(t)) { return !0; } + } + return !1; + } +} +async function * oy (e, t) { + const n = ey(e); const { + metadata: s + } = t; const { + jsonpaths: r + } = t.json || {}; + let i = !0; + const o = null; const a = new He(o, t); const c = new iy({ + jsonpaths: r + }); + for await (const f of n) { + const d = c.write(f); const m = d.length > 0 && c.getStreamingJsonPathAsString(); + if (d.length > 0 && i) { + if (s) { + var u; + yield { + shape: (t == null || (u = t.json) === null || u === void 0 ? void 0 : u.shape) || 'array-row-table', + batchType: 'partial-result', + data: [], + length: 0, + bytesUsed: 0, + container: c.getPartialResult(), + jsonpath: m + }; + } + i = !1; + } + for (const y of d) { + a.addRow(y); + const E = a.getFullBatch({ + jsonpath: m + }); + E && (yield E); + } + a.chunkComplete(f); + const g = a.getFullBatch({ + jsonpath: m + }); + g && (yield g); + } + const l = c.getStreamingJsonPathAsString(); const h = a.getFinalBatch({ + jsonpath: l + }); + h && (yield h), s && (yield { + shape: 'json', + batchType: 'final-result', + container: c.getPartialResult(), + jsonpath: c.getStreamingJsonPathAsString(), + data: [], + length: 0 + }); +} +const Hn = { + x: 0, + y: 1, + z: 2 +}; +function _c (e, t = {}) { + const { start: n = 0, end: s = e.length, plane: r = 'xy' } = t; const i = t.size || 2; + let o = 0; + const a = Hn[r[0]]; const c = Hn[r[1]]; + for (let u = n, l = s - i; u < s; u += i) { o += (e[u + a] - e[l + a]) * (e[u + c] + e[l + c]), l = u; } + return o / 2; +} +function ay (e, t, n = 2, s, r = 'xy') { + const i = t && t.length; const o = i ? t[0] * n : e.length; + let a = wc(e, 0, o, n, !0, s && s[0], r); + const c = []; + if (!a || a.next === a.prev) { return c; } + let u, l, h, f, d, m, g; + if (i && (a = fy(e, t, a, n, s, r)), e.length > 80 * n) { + f = l = e[0], d = h = e[1]; + for (let y = n; y < o; y += n) { m = e[y], g = e[y + 1], m < f && (f = m), g < d && (d = g), m > l && (l = m), g > h && (h = g); } + u = Math.max(l - f, h - d), u = u !== 0 ? 32767 / u : 0; + } + return Je(a, c, n, f, d, u, 0), c; +} +function wc (e, t, n, s, r, i, o) { + let a, c; + i === void 0 && (i = _c(e, { start: t, end: n, size: s, plane: o })); + const u = Hn[o[0]]; const l = Hn[o[1]]; + if (r === i < 0) { + for (a = t; a < n; a += s) { c = yo(a, e[a + u], e[a + l], c); } + } else { + for (a = n - s; a >= t; a -= s) { c = yo(a, e[a + u], e[a + l], c); } + } + return c && Zn(c, c.next) && (je(c), c = c.next), c; +} +function ne (e, t) { + if (!e) { return e; } + t || (t = e); + let n = e; let s; + do { + if (s = !1, !n.steiner && (Zn(n, n.next) || W(n.prev, n, n.next) === 0)) { + if (je(n), n = t = n.prev, n === n.next) { break; } + s = !0; + } else { n = n.next; } + } + while (s || n !== t); + return t; +} +function Je (e, t, n, s, r, i, o) { + if (!e) { return; } + !o && i && py(e, s, r, i); + let a = e; let c; let u; + for (; e.prev !== e.next;) { + if (c = e.prev, u = e.next, i ? uy(e, s, r, i) : cy(e)) { + t.push(c.i / n | 0), t.push(e.i / n | 0), t.push(u.i / n | 0), je(e), e = u.next, a = u.next; + continue; + } + if (e = u, e === a) { + o ? o === 1 ? (e = ly(ne(e), t, n), Je(e, t, n, s, r, i, 2)) : o === 2 && hy(e, t, n, s, r, i) : Je(ne(e), t, n, s, r, i, 1); + break; + } + } +} +function cy (e) { + const t = e.prev; const n = e; const s = e.next; + if (W(t, n, s) >= 0) { return !1; } + const r = t.x; const i = n.x; const o = s.x; const a = t.y; const c = n.y; const u = s.y; const l = r < i ? r < o ? r : o : i < o ? i : o; const h = a < c ? a < u ? a : u : c < u ? c : u; const f = r > i ? r > o ? r : o : i > o ? i : o; const d = a > c ? a > u ? a : u : c > u ? c : u; + let m = s.next; + for (; m !== t;) { + if (m.x >= l && m.x <= f && m.y >= h && m.y <= d && me(r, a, i, c, o, u, m.x, m.y) && W(m.prev, m, m.next) >= 0) { return !1; } + m = m.next; + } + return !0; +} +function uy (e, t, n, s) { + const r = e.prev; const i = e; const o = e.next; + if (W(r, i, o) >= 0) { return !1; } + const a = r.x; const c = i.x; const u = o.x; const l = r.y; const h = i.y; const f = o.y; const d = a < c ? a < u ? a : u : c < u ? c : u; const m = l < h ? l < f ? l : f : h < f ? h : f; const g = a > c ? a > u ? a : u : c > u ? c : u; const y = l > h ? l > f ? l : f : h > f ? h : f; const E = rr(d, m, t, n, s); const R = rr(g, y, t, n, s); + let B = e.prevZ; let C = e.nextZ; + for (; B && B.z >= E && C && C.z <= R;) { + if (B.x >= d && B.x <= g && B.y >= m && B.y <= y && B !== r && B !== o && me(a, l, c, h, u, f, B.x, B.y) && W(B.prev, B, B.next) >= 0 || (B = B.prevZ, C.x >= d && C.x <= g && C.y >= m && C.y <= y && C !== r && C !== o && me(a, l, c, h, u, f, C.x, C.y) && W(C.prev, C, C.next) >= 0)) { return !1; } + C = C.nextZ; + } + for (; B && B.z >= E;) { + if (B.x >= d && B.x <= g && B.y >= m && B.y <= y && B !== r && B !== o && me(a, l, c, h, u, f, B.x, B.y) && W(B.prev, B, B.next) >= 0) { return !1; } + B = B.prevZ; + } + for (; C && C.z <= R;) { + if (C.x >= d && C.x <= g && C.y >= m && C.y <= y && C !== r && C !== o && me(a, l, c, h, u, f, C.x, C.y) && W(C.prev, C, C.next) >= 0) { return !1; } + C = C.nextZ; + } + return !0; +} +function ly (e, t, n) { + let s = e; + do { + const r = s.prev; const i = s.next.next; + !Zn(r, i) && Rc(r, s, s.next, i) && Ve(r, i) && Ve(i, r) && (t.push(r.i / n | 0), t.push(s.i / n | 0), t.push(i.i / n | 0), je(s), je(s.next), s = e = i), s = s.next; + } while (s !== e); + return ne(s); +} +function hy (e, t, n, s, r, i) { + let o = e; + do { + let a = o.next.next; + for (; a !== o.prev;) { + if (o.i !== a.i && Cy(o, a)) { + let c = Mc(o, a); + o = ne(o, o.next), c = ne(c, c.next), Je(o, t, n, s, r, i, 0), Je(c, t, n, s, r, i, 0); + return; + } + a = a.next; + } + o = o.next; + } while (o !== e); +} +function fy (e, t, n, s, r, i) { + const o = []; + let a, c, u, l, h; + for (a = 0, c = t.length; a < c; a++) { u = t[a] * s, l = a < c - 1 ? t[a + 1] * s : e.length, h = wc(e, u, l, s, !1, r && r[a + 1], i), h === h.next && (h.steiner = !0), o.push(By(h)); } + for (o.sort(dy), a = 0; a < o.length; a++) { n = my(o[a], n); } + return n; +} +function dy (e, t) { + return e.x - t.x; +} +function my (e, t) { + const n = gy(e, t); + if (!n) { return t; } + const s = Mc(n, e); + return ne(s, s.next), ne(n, n.next); +} +function gy (e, t) { + let n = t; + const s = e.x; const r = e.y; + let i = -1 / 0; let o; + do { + if (r <= n.y && r >= n.next.y && n.next.y !== n.y) { + const f = n.x + (r - n.y) * (n.next.x - n.x) / (n.next.y - n.y); + if (f <= s && f > i && (i = f, o = n.x < n.next.x ? n : n.next, f === s)) { return o; } + } + n = n.next; + } while (n !== t); + if (!o) { return null; } + const a = o; const c = o.x; const u = o.y; + let l = 1 / 0; let h; + n = o; + do { s >= n.x && n.x >= c && s !== n.x && me(r < u ? s : i, r, c, u, r < u ? i : s, r, n.x, n.y) && (h = Math.abs(r - n.y) / (s - n.x), Ve(n, e) && (h < l || h === l && (n.x > o.x || n.x === o.x && Ay(o, n))) && (o = n, l = h)), n = n.next; } + while (n !== a); + return o; +} +function Ay (e, t) { + return W(e.prev, e, t.prev) < 0 && W(t.next, e, e.next) < 0; +} +function py (e, t, n, s) { + let r = e; + do { r.z === 0 && (r.z = rr(r.x, r.y, t, n, s)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next; } + while (r !== e); + r.prevZ.nextZ = null, r.prevZ = null, yy(r); +} +function yy (e) { + let t; let n; let s = 1; let r; let i; let o; let a; let c; let u; + do { + for (i = e, e = null, u = null, r = 0; i;) { + for (r++, a = i, o = 0, n = 0; n < s && (o++, a = a.nextZ, !!a); n++) + ; + for (c = s; o > 0 || c > 0 && a;) { o !== 0 && (c === 0 || !a || i.z <= a.z) ? (t = i, i = i.nextZ, o--) : (t = a, a = a.nextZ, c--), u ? u.nextZ = t : e = t, t.prevZ = u, u = t; } + i = a; + } + u.nextZ = null, s *= 2; + } while (r > 1); + return e; +} +function rr (e, t, n, s, r) { + return e = (e - n) * r | 0, t = (t - s) * r | 0, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, t = (t | t << 8) & 16711935, t = (t | t << 4) & 252645135, t = (t | t << 2) & 858993459, t = (t | t << 1) & 1431655765, e | t << 1; +} +function By (e) { + let t = e; let n = e; + do { (t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next; } + while (t !== e); + return n; +} +function me (e, t, n, s, r, i, o, a) { + return (r - o) * (t - a) >= (e - o) * (i - a) && (e - o) * (s - a) >= (n - o) * (t - a) && (n - o) * (i - a) >= (r - o) * (s - a); +} +function Cy (e, t) { + return e.next.i !== t.i && e.prev.i !== t.i && !Ey(e, t) && // dones't intersect other edges + (Ve(e, t) && Ve(t, e) && Ty(e, t) && // locally visible + (W(e.prev, e, t.prev) || W(e, t.prev, t)) || // does not create opposite-facing sectors + Zn(e, t) && W(e.prev, e, e.next) > 0 && W(t.prev, t, t.next) > 0); +} +function W (e, t, n) { + return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y); +} +function Zn (e, t) { + return e.x === t.x && e.y === t.y; +} +function Rc (e, t, n, s) { + const r = Bn(W(e, t, n)); const i = Bn(W(e, t, s)); const o = Bn(W(n, s, e)); const a = Bn(W(n, s, t)); + return !!(r !== i && o !== a || r === 0 && yn(e, n, t) || i === 0 && yn(e, s, t) || o === 0 && yn(n, e, s) || a === 0 && yn(n, t, s)); +} +function yn (e, t, n) { + return t.x <= Math.max(e.x, n.x) && t.x >= Math.min(e.x, n.x) && t.y <= Math.max(e.y, n.y) && t.y >= Math.min(e.y, n.y); +} +function Bn (e) { + return e > 0 ? 1 : e < 0 ? -1 : 0; +} +function Ey (e, t) { + let n = e; + do { + if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && Rc(n, n.next, e, t)) { return !0; } + n = n.next; + } while (n !== e); + return !1; +} +function Ve (e, t) { + return W(e.prev, e, e.next) < 0 ? W(e, t, e.next) >= 0 && W(e, e.prev, t) >= 0 : W(e, t, e.prev) < 0 || W(e, e.next, t) < 0; +} +function Ty (e, t) { + let n = e; let s = !1; + const r = (e.x + t.x) / 2; const i = (e.y + t.y) / 2; + do { n.y > i != n.next.y > i && n.next.y !== n.y && r < (n.next.x - n.x) * (i - n.y) / (n.next.y - n.y) + n.x && (s = !s), n = n.next; } + while (n !== e); + return s; +} +function Mc (e, t) { + const n = new ir(e.i, e.x, e.y); const s = new ir(t.i, t.x, t.y); const r = e.next; const i = t.prev; + return e.next = t, t.prev = e, n.next = r, r.prev = n, s.next = n, n.prev = s, i.next = s, s.prev = i, s; +} +function yo (e, t, n, s) { + const r = new ir(e, t, n); + return s ? (r.next = s.next, r.prev = s, s.next.prev = r, s.next = r) : (r.prev = r, r.next = r), r; +} +function je (e) { + e.next.prev = e.prev, e.prev.next = e.next, e.prevZ && (e.prevZ.nextZ = e.nextZ), e.nextZ && (e.nextZ.prevZ = e.prevZ); +} +class ir { + constructor (t, n, s) { + this.prev = null, this.next = null, this.z = 0, this.prevZ = null, this.nextZ = null, this.steiner = !1, this.i = t, this.x = n, this.y = s; + } +} +function by (e, t, n) { + const s = _y(e); const r = Object.keys(s).filter((i) => s[i] !== Array); + return wy(e, { + propArrayTypes: s, + ...t + }, { + numericPropKeys: n && n.numericPropKeys || r, + PositionDataType: n ? n.PositionDataType : Float32Array, + triangulate: n ? n.triangulate : !0 + }); +} +function _y (e) { + const t = {}; + for (const n of e) { + if (n.properties) { + for (const s in n.properties) { + const r = n.properties[s]; + t[s] = vy(r, t[s]); + } + } + } + return t; +} +function wy (e, t, n) { + const { + pointPositionsCount: s, + pointFeaturesCount: r, + linePositionsCount: i, + linePathsCount: o, + lineFeaturesCount: a, + polygonPositionsCount: c, + polygonObjectsCount: u, + polygonRingsCount: l, + polygonFeaturesCount: h, + propArrayTypes: f, + coordLength: d + } = t; const { + numericPropKeys: m = [], + PositionDataType: g = Float32Array, + triangulate: y = !0 + } = n; const E = e[0] && 'id' in e[0]; const R = e.length > 65535 ? Uint32Array : Uint16Array; const B = { + type: 'Point', + positions: new g(s * d), + globalFeatureIds: new R(s), + featureIds: r > 65535 ? new Uint32Array(s) : new Uint16Array(s), + numericProps: {}, + properties: [], + fields: [] + }; const C = { + type: 'LineString', + pathIndices: i > 65535 ? new Uint32Array(o + 1) : new Uint16Array(o + 1), + positions: new g(i * d), + globalFeatureIds: new R(i), + featureIds: a > 65535 ? new Uint32Array(i) : new Uint16Array(i), + numericProps: {}, + properties: [], + fields: [] + }; const M = { + type: 'Polygon', + polygonIndices: c > 65535 ? new Uint32Array(u + 1) : new Uint16Array(u + 1), + primitivePolygonIndices: c > 65535 ? new Uint32Array(l + 1) : new Uint16Array(l + 1), + positions: new g(c * d), + globalFeatureIds: new R(c), + featureIds: h > 65535 ? new Uint32Array(c) : new Uint16Array(c), + numericProps: {}, + properties: [], + fields: [] + }; + y && (M.triangles = []); + for (const O of [B, C, M]) { + for (const F of m) { + const v = f[F]; + O.numericProps[F] = new v(O.positions.length / d); + } + } + C.pathIndices[o] = i, M.polygonIndices[u] = c, M.primitivePolygonIndices[l] = c; + const b = { + pointPosition: 0, + pointFeature: 0, + linePosition: 0, + linePath: 0, + lineFeature: 0, + polygonPosition: 0, + polygonObject: 0, + polygonRing: 0, + polygonFeature: 0, + feature: 0 + }; + for (const O of e) { + const F = O.geometry; const v = O.properties || {}; + switch (F.type) { + case 'Point': + Ry(F, B, b, d, v), B.properties.push(xs(v, m)), E && B.fields.push({ + id: O.id + }), b.pointFeature++; + break; + case 'LineString': + My(F, C, b, d, v), C.properties.push(xs(v, m)), E && C.fields.push({ + id: O.id + }), b.lineFeature++; + break; + case 'Polygon': + Sy(F, M, b, d, v), M.properties.push(xs(v, m)), E && M.fields.push({ + id: O.id + }), b.polygonFeature++; + break; + default: + throw new Error('Invalid geometry type'); + } + b.feature++; + } + return xy(B, C, M, d); +} +function Ry (e, t, n, s, r) { + t.positions.set(e.data, n.pointPosition * s); + const i = e.data.length / s; + Hr(t, r, n.pointPosition, i), t.globalFeatureIds.fill(n.feature, n.pointPosition, n.pointPosition + i), t.featureIds.fill(n.pointFeature, n.pointPosition, n.pointPosition + i), n.pointPosition += i; +} +function My (e, t, n, s, r) { + t.positions.set(e.data, n.linePosition * s); + const i = e.data.length / s; + Hr(t, r, n.linePosition, i), t.globalFeatureIds.fill(n.feature, n.linePosition, n.linePosition + i), t.featureIds.fill(n.lineFeature, n.linePosition, n.linePosition + i); + for (let o = 0, a = e.indices.length; o < a; ++o) { + const c = e.indices[o]; const u = o === a - 1 ? e.data.length : e.indices[o + 1]; + t.pathIndices[n.linePath++] = n.linePosition, n.linePosition += (u - c) / s; + } +} +function Sy (e, t, n, s, r) { + t.positions.set(e.data, n.polygonPosition * s); + const i = e.data.length / s; + Hr(t, r, n.polygonPosition, i), t.globalFeatureIds.fill(n.feature, n.polygonPosition, n.polygonPosition + i), t.featureIds.fill(n.polygonFeature, n.polygonPosition, n.polygonPosition + i); + for (let o = 0, a = e.indices.length; o < a; ++o) { + const c = n.polygonPosition; + t.polygonIndices[n.polygonObject++] = c; + const u = e.areas[o]; const l = e.indices[o]; const h = e.indices[o + 1]; + for (let d = 0, m = l.length; d < m; ++d) { + const g = l[d]; const y = d === m - 1 ? h === void 0 ? e.data.length : h[0] : l[d + 1]; + t.primitivePolygonIndices[n.polygonRing++] = n.polygonPosition, n.polygonPosition += (y - g) / s; + } + const f = n.polygonPosition; + Iy(t, u, l, { + startPosition: c, + endPosition: f, + coordLength: s + }); + } +} +function Iy (e, t, n, s) { + const { + startPosition: r, + endPosition: i, + coordLength: o + } = s; + if (!e.triangles) { return; } + const a = r * o; const c = i * o; const u = e.positions.subarray(a, c); const l = n[0]; const h = n.slice(1).map((d) => (d - l) / o); const f = ay(u, h, o, t); + for (let d = 0, m = f.length; d < m; ++d) { e.triangles.push(r + f[d]); } +} +function Is (e, t) { + const n = {}; + for (const s in e) { + n[s] = { + value: e[s], + size: t + }; + } + return n; +} +function xy (e, t, n, s) { + const r = { + shape: 'binary-feature-collection', + points: { + ...e, + positions: { + value: e.positions, + size: s + }, + globalFeatureIds: { + value: e.globalFeatureIds, + size: 1 + }, + featureIds: { + value: e.featureIds, + size: 1 + }, + numericProps: Is(e.numericProps, 1) + }, + lines: { + ...t, + positions: { + value: t.positions, + size: s + }, + pathIndices: { + value: t.pathIndices, + size: 1 + }, + globalFeatureIds: { + value: t.globalFeatureIds, + size: 1 + }, + featureIds: { + value: t.featureIds, + size: 1 + }, + numericProps: Is(t.numericProps, 1) + }, + polygons: { + ...n, + positions: { + value: n.positions, + size: s + }, + polygonIndices: { + value: n.polygonIndices, + size: 1 + }, + primitivePolygonIndices: { + value: n.primitivePolygonIndices, + size: 1 + }, + globalFeatureIds: { + value: n.globalFeatureIds, + size: 1 + }, + featureIds: { + value: n.featureIds, + size: 1 + }, + numericProps: Is(n.numericProps, 1) + } + }; + return r.polygons && n.triangles && (r.polygons.triangles = { + value: new Uint32Array(n.triangles), + size: 1 + }), r; +} +function Hr (e, t, n, s) { + for (const r in e.numericProps) { + if (r in t) { + const i = t[r]; + e.numericProps[r].fill(i, n, n + s); + } + } +} +function xs (e, t) { + const n = {}; + for (const s in e) { t.includes(s) || (n[s] = e[s]); } + return n; +} +function vy (e, t) { + return t === Array || !Number.isFinite(e) ? Array : t === Float64Array || Math.fround(e) !== e ? Float64Array : Float32Array; +} +function Oy (e) { + let t = 0; let n = 0; let s = 0; let r = 0; let i = 0; let o = 0; let a = 0; let c = 0; let u = 0; + const l = /* @__PURE__ */ new Set(); + for (const h of e) { + const f = h.geometry; + switch (f.type) { + case 'Point': + n++, t++, l.add(f.coordinates.length); + break; + case 'MultiPoint': + n++, t += f.coordinates.length; + for (const m of f.coordinates) { l.add(m.length); } + break; + case 'LineString': + i++, s += f.coordinates.length, r++; + for (const m of f.coordinates) { l.add(m.length); } + break; + case 'MultiLineString': + i++; + for (const m of f.coordinates) { + s += m.length, r++; + for (const g of m) { l.add(g.length); } + } + break; + case 'Polygon': + u++, a++, c += f.coordinates.length; + const d = f.coordinates.flat(); + o += d.length; + for (const m of d) { l.add(m.length); } + break; + case 'MultiPolygon': + u++; + for (const m of f.coordinates) { + a++, c += m.length; + const g = m.flat(); + o += g.length; + for (const y of g) { l.add(y.length); } + } + break; + default: + throw new Error(`Unsupported geometry type: ${f.type}`); + } + } + return { + coordLength: l.size > 0 ? Math.max(...l) : 2, + pointPositionsCount: t, + pointFeaturesCount: n, + linePositionsCount: s, + linePathsCount: r, + lineFeaturesCount: i, + polygonPositionsCount: o, + polygonObjectsCount: a, + polygonRingsCount: c, + polygonFeaturesCount: u + }; +} +function Fy (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : { + coordLength: 2, + fixRingWinding: !0 + }; + return e.map((n) => Dy(n, t)); +} +function Bo (e, t, n, s) { + n.push(t.length), t.push(...e); + for (let r = e.length; r < s.coordLength; r++) { t.push(0); } +} +function or (e, t, n, s) { + n.push(t.length); + for (const r of e) { + t.push(...r); + for (let i = r.length; i < s.coordLength; i++) { t.push(0); } + } +} +function Co (e, t, n, s, r) { + let i = 0; + const o = []; const a = []; + for (const c of e) { + const u = c.map((f) => f.slice(0, 2)); + let l = _c(u.flat()); + const h = l < 0; + r.fixRingWinding && (i === 0 && !h || i > 0 && h) && (c.reverse(), l = -l), o.push(l), or(c, t, a, r), i++; + } + i > 0 && (s.push(o), n.push(a)); +} +function Dy (e, t) { + const { + geometry: n + } = e; + if (n.type === 'GeometryCollection') { throw new Error('GeometryCollection type not supported'); } + const s = []; const r = []; + let i, o; + switch (n.type) { + case 'Point': + o = 'Point', Bo(n.coordinates, s, r, t); + break; + case 'MultiPoint': + o = 'Point', n.coordinates.map((a) => Bo(a, s, r, t)); + break; + case 'LineString': + o = 'LineString', or(n.coordinates, s, r, t); + break; + case 'MultiLineString': + o = 'LineString', n.coordinates.map((a) => or(a, s, r, t)); + break; + case 'Polygon': + o = 'Polygon', i = [], Co(n.coordinates, s, r, i, t); + break; + case 'MultiPolygon': + o = 'Polygon', i = [], n.coordinates.map((a) => Co(a, s, r, i, t)); + break; + default: + throw new Error(`Unknown type: ${o}`); + } + return { + ...e, + geometry: { + type: o, + indices: r, + data: s, + areas: i + } + }; +} +function Sc (e) { + const t = arguments.length > 1 && arguments[1] !== void 0 + ? arguments[1] + : { + fixRingWinding: !0, + triangulate: !0 + }; + const n = Oy(e); const s = n.coordLength; const { + fixRingWinding: r + } = t; const i = Fy(e, { + coordLength: s, + fixRingWinding: r + }); + return by(i, n, { + numericPropKeys: t.numericPropKeys, + PositionDataType: t.PositionDataType || Float32Array, + triangulate: t.triangulate + }); +} +const Ly = '4.1.4'; const Py = { + name: 'GeoJSON', + id: 'geojson', + module: 'geojson', + version: Ly, + worker: !0, + extensions: ['geojson'], + mimeTypes: ['application/geo+json'], + category: 'geometry', + text: !0, + options: { + geojson: { + shape: 'object-row-table' + }, + json: { + shape: 'object-row-table', + jsonpaths: ['$', '$.features'] + }, + gis: { + format: 'geojson' + } + } +}; const ke = { + ...Py, + parse: Gy, + parseTextSync: Ic, + parseInBatches: Ny +}; +async function Gy (e, t) { + return Ic(new TextDecoder().decode(e), t); +} +function Ic (e, t) { + let n; + t = { + ...ke.options, + ...t + }, t.geojson = { + ...ke.options.geojson, + ...t.geojson + }, t.gis = t.gis || {}; + let s; + try { + s = JSON.parse(e); + } catch { + s = {}; + } + const r = { + shape: 'geojson-table', + type: 'FeatureCollection', + features: ((n = s) === null || n === void 0 ? void 0 : n.features) || [] + }; + switch (t.gis.format) { + case 'binary': + return Sc(r.features); + default: + return r; + } +} +function Ny (e, t) { + t = { + ...ke.options, + ...t + }, t.json = { + ...ke.options.geojson, + ...t.geojson + }; + const n = oy(e, t); + switch (t.gis.format) { + case 'binary': + return Uy(n); + default: + return n; + } +} +async function * Uy (e) { + for await (const t of e) { t.data = Sc(t.data), yield t; } +} +function $t (e, t) { + if (!e) { throw new Error(t || 'loader assertion failed.'); } +} +const Hy = 'Queued Requests'; const Jy = 'Active Requests'; const Vy = 'Cancelled Requests'; const jy = 'Queued Requests Ever'; const ky = 'Active Requests Ever'; const Ky = { + id: 'request-scheduler', + /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */ + throttleRequests: !0, + /** The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit. */ + maxRequests: 6, + /** + * Specifies a debounce time, in milliseconds. All requests are queued, until no new requests have + * been added to the queue for this amount of time. + */ + debounceTime: 0 +}; +class zy { + constructor (t = {}) { + p(this, 'props'); + p(this, 'stats'); + p(this, 'activeRequestCount', 0); + /** Tracks the number of active requests and prioritizes/cancels queued requests. */ + p(this, 'requestQueue', []); + p(this, 'requestMap', /* @__PURE__ */ new Map()); + p(this, 'updateTimer', null); + this.props = { ...Ky, ...t }, this.stats = new $o({ id: this.props.id }), this.stats.get(Hy), this.stats.get(Jy), this.stats.get(Vy), this.stats.get(jy), this.stats.get(ky); + } + + /** + * Called by an application that wants to issue a request, without having it deeply queued by the browser + * + * When the returned promise resolved, it is OK for the application to issue a request. + * The promise resolves to an object that contains a `done` method. + * When the application's request has completed (or failed), the application must call the `done` function + * + * @param handle + * @param getPriority will be called when request "slots" open up, + * allowing the caller to update priority or cancel the request + * Highest priority executes first, priority < 0 cancels the request + * @returns a promise + * - resolves to a object (with a `done` field) when the request can be issued without queueing, + * - resolves to `null` if the request has been cancelled (by the callback return < 0). + * In this case the application should not issue the request + */ + scheduleRequest (t, n = () => 0) { + if (!this.props.throttleRequests) { + return Promise.resolve({ + done: () => { + } + }); + } + if (this.requestMap.has(t)) { return this.requestMap.get(t); } + const s = { handle: t, priority: 0, getPriority: n }; const r = new Promise((i) => (s.resolve = i, s)); + return this.requestQueue.push(s), this.requestMap.set(t, r), this._issueNewRequests(), r; + } + + // PRIVATE + _issueRequest (t) { + const { handle: n, resolve: s } = t; + let r = !1; + const i = () => { + r || (r = !0, this.requestMap.delete(n), this.activeRequestCount--, this._issueNewRequests()); + }; + return this.activeRequestCount++, s ? s({ done: i }) : Promise.resolve({ done: i }); + } + + /** We check requests asynchronously, to prevent multiple updates */ + _issueNewRequests () { + this.updateTimer !== null && clearTimeout(this.updateTimer), this.updateTimer = setTimeout(() => this._issueNewRequestsAsync(), this.props.debounceTime); + } + + /** Refresh all requests */ + _issueNewRequestsAsync () { + this.updateTimer !== null && clearTimeout(this.updateTimer), this.updateTimer = null; + const t = Math.max(this.props.maxRequests - this.activeRequestCount, 0); + if (t !== 0) { + this._updateAllRequests(); + for (let n = 0; n < t; ++n) { + const s = this.requestQueue.shift(); + s && this._issueRequest(s); + } + } + } + + /** Ensure all requests have updated priorities, and that no longer valid requests are cancelled */ + _updateAllRequests () { + const t = this.requestQueue; + for (let n = 0; n < t.length; ++n) { + const s = t[n]; + this._updateRequest(s) || (t.splice(n, 1), this.requestMap.delete(s.handle), n--); + } + t.sort((n, s) => n.priority - s.priority); + } + + /** Update a single request by calling the callback */ + _updateRequest (t) { + return t.priority = t.getPriority(t.handle), t.priority < 0 ? (t.resolve(null), !1) : !0; + } +} +function Wy (e) { + const t = e ? e.lastIndexOf('/') : -1; + return t >= 0 ? e.substr(0, t) : ''; +} +class Xy { + constructor (t, n, s) { + p(this, 'item'); + p(this, 'previous'); + p(this, 'next'); + this.item = t, this.previous = n, this.next = s; + } +} +class Qy { + constructor () { + p(this, 'head', null); + p(this, 'tail', null); + p(this, '_length', 0); + } + + get length () { + return this._length; + } + + /** + * Adds the item to the end of the list + * @param {*} [item] + * @return {DoublyLinkedListNode} + */ + add (t) { + const n = new Xy(t, this.tail, null); + return this.tail ? (this.tail.next = n, this.tail = n) : (this.head = n, this.tail = n), ++this._length, n; + } + + /** + * Removes the given node from the list + * @param {DoublyLinkedListNode} node + */ + remove (t) { + t && (t.previous && t.next ? (t.previous.next = t.next, t.next.previous = t.previous) : t.previous ? (t.previous.next = null, this.tail = t.previous) : t.next ? (t.next.previous = null, this.head = t.next) : (this.head = null, this.tail = null), t.next = null, t.previous = null, --this._length); + } + + /** + * Moves nextNode after node + * @param {DoublyLinkedListNode} node + * @param {DoublyLinkedListNode} nextNode + */ + splice (t, n) { + t !== n && (this.remove(n), this._insert(t, n)); + } + + _insert (t, n) { + const s = t.next; + t.next = n, this.tail === t ? this.tail = n : s.previous = n, n.next = s, n.previous = t, ++this._length; + } +} +class qy { + constructor () { + p(this, '_list'); + p(this, '_sentinel'); + p(this, '_trimTiles'); + this._list = new Qy(), this._sentinel = this._list.add('sentinel'), this._trimTiles = !1; + } + + reset () { + this._list.splice(this._list.tail, this._sentinel); + } + + touch (t) { + const n = t._cacheNode; + n && this._list.splice(this._sentinel, n); + } + + add (t, n, s) { + n._cacheNode || (n._cacheNode = this._list.add(n), s && s(t, n)); + } + + unloadTile (t, n, s) { + const r = n._cacheNode; + r && (this._list.remove(r), n._cacheNode = null, s && s(t, n)); + } + + unloadTiles (t, n) { + const s = this._trimTiles; + this._trimTiles = !1; + const r = this._list; const i = t.maximumMemoryUsage * 1024 * 1024; const o = this._sentinel; + let a = r.head; + for (; a !== o && (t.gpuMemoryUsageInBytes > i || s);) { + const c = a.item; + a = a.next, this.unloadTile(t, c, n); + } + } + + trim () { + this._trimTiles = !0; + } +} +function Yy (e, t) { + $t(e), $t(t); + const { rtcCenter: n, gltfUpAxis: s } = t; const { computedTransform: r, boundingVolume: { center: i } } = e; + let o = new V(r); + switch (n && o.translate(n), s) { + case 'Z': + break; + case 'Y': + const h = new V().rotateX(Math.PI / 2); + o = o.multiplyRight(h); + break; + case 'X': + const f = new V().rotateY(-Math.PI / 2); + o = o.multiplyRight(f); + break; + } + t.isQuantized && o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale); + const a = new A(i); + t.cartesianModelMatrix = o, t.cartesianOrigin = a; + const c = J.WGS84.cartesianToCartographic(a, new A()); const l = J.WGS84.eastNorthUpToFixedFrame(a).invert(); + t.cartographicModelMatrix = l.multiplyRight(o), t.cartographicOrigin = c, t.coordinateSystem || (t.modelMatrix = t.cartographicModelMatrix); +} +const Eo = new A(); const vs = new A(); const ar = new dt([ + new nt(), + new nt(), + new nt(), + new nt(), + new nt(), + new nt() +]); +function $y (e, t) { + const { cameraDirection: n, cameraUp: s, height: r } = e; const { metersPerUnit: i } = e.distanceScales; const o = wn(e, e.center); const a = J.WGS84.eastNorthUpToFixedFrame(o); const c = e.unprojectPosition(e.cameraPosition); const u = J.WGS84.cartographicToCartesian(c, new A()); const l = new A( + // @ts-ignore + a.transformAsVector(new A(n).scale(i)) + ).normalize(); const h = new A( + // @ts-ignore + a.transformAsVector(new A(s).scale(i)) + ).normalize(); + tB(e); + const f = e.constructor; const { longitude: d, latitude: m, width: g, bearing: y, zoom: E } = e; const R = new f({ + longitude: d, + latitude: m, + height: r, + width: g, + bearing: y, + zoom: E, + pitch: 0 + }); + return { + camera: { + position: u, + direction: l, + up: h + }, + viewport: e, + topDownViewport: R, + height: r, + cullingVolume: ar, + frameNumber: t, + // TODO: This can be the same between updates, what number is unique for between updates? + sseDenominator: 1.15 + // Assumes fovy = 60 degrees + }; +} +function Zy (e, t, n) { + if (n === 0 || e.length <= n) { return [e, []]; } + const s = []; const { longitude: r, latitude: i } = t.viewport; + for (const [u, l] of e.entries()) { + const [h, f] = l.header.mbs; const d = Math.abs(r - h); const m = Math.abs(i - f); const g = Math.sqrt(m * m + d * d); + s.push([u, g]); + } + const o = s.sort((u, l) => u[1] - l[1]); const a = []; + for (let u = 0; u < n; u++) { a.push(e[o[u][0]]); } + const c = []; + for (let u = n; u < o.length; u++) { c.push(e[o[u][0]]); } + return [a, c]; +} +function tB (e) { + const t = e.getFrustumPlanes(); const n = To(t.near, e.cameraPosition); const s = wn(e, n); const r = wn(e, e.cameraPosition, vs); + let i = 0; + ar.planes[i++].fromPointNormal(s, Eo.copy(s).subtract(r)); + for (const o in t) { + if (o === 'near') { continue; } + const a = t[o]; const c = To(a, n, vs); const u = wn(e, c, vs); + ar.planes[i++].fromPointNormal( + u, + // Want the normal to point into the frustum since that's what culling expects + Eo.copy(s).subtract(u) + ); + } +} +function To (e, t, n = new A()) { + const s = e.normal.dot(t); + return n.copy(e.normal).scale(e.distance - s).add(t), n; +} +function wn (e, t, n = new A()) { + const s = e.unprojectPosition(t); + return J.WGS84.cartographicToCartesian(s, n); +} +const eB = 6378137; const nB = 6378137; const cr = 6356752314245179e-9; const ge = new A(); +function sB (e, t) { + if (e instanceof qe) { + const { halfAxes: n } = e; const s = iB(n); + return Math.log2(cr / (s + t[2])); + } else if (e instanceof Qe) { + const { radius: n } = e; + return Math.log2(cr / (n + t[2])); + } else if (e.width && e.height) { + const { width: n, height: s } = e; const r = Math.log2(eB / n); const i = Math.log2(nB / s); + return (r + i) / 2; + } + return 1; +} +function xc (e, t, n) { + J.WGS84.cartographicToCartesian([e.xmax, e.ymax, e.zmax], ge); + const s = Math.sqrt(Math.pow(ge[0] - n[0], 2) + Math.pow(ge[1] - n[1], 2) + Math.pow(ge[2] - n[2], 2)); + return Math.log2(cr / (s + t[2])); +} +function rB (e, t, n) { + const [s, r, i, o] = e; + return xc({ xmin: s, xmax: i, ymin: r, ymax: o, zmin: 0, zmax: 0 }, t, n); +} +function iB (e) { + e.getColumn(0, ge); + const t = e.getColumn(1); const n = e.getColumn(2); + return ge.add(t).add(n).len(); +} +const lt = { + UNLOADED: 0, + // Has never been requested + LOADING: 1, + // Is waiting on a pending request + PROCESSING: 2, + // Request received. Contents are being processed for rendering. Depending on the content, it might make its own requests for external data. + READY: 3, + // Ready to render. + EXPIRED: 4, + // Is expired and will be unloaded once new content is loaded. + FAILED: 5 + // Request failed. +}; +let Ht; +(function (e) { + e[e.ADD = 1] = 'ADD', e[e.REPLACE = 2] = 'REPLACE'; +})(Ht || (Ht = {})); +let Pe; +(function (e) { + e.EMPTY = 'empty', e.SCENEGRAPH = 'scenegraph', e.POINTCLOUD = 'pointcloud', e.MESH = 'mesh'; +})(Pe || (Pe = {})); +let At; +(function (e) { + e.I3S = 'I3S', e.TILES3D = 'TILES3D'; +})(At || (At = {})); +let bo; +(function (e) { + e.GEOMETRIC_ERROR = 'geometricError', e.MAX_SCREEN_THRESHOLD = 'maxScreenThreshold'; +})(bo || (bo = {})); +const oB = { + NOT_COMPUTED: -1, + USE_OPTIMIZATION: 1, + SKIP_OPTIMIZATION: 0 +}; +function vc (e) { + return e != null; +} +const it = new A(); const Rn = new A(); const aB = new A(); const cB = new A(); const qt = new A(); const _o = new A(); const wo = new A(); const Ro = new A(); +function Os (e, t, n) { + if ($t(e, '3D Tile: boundingVolume must be defined'), e.box) { return Oc(e.box, t, n); } + if (e.region) { return hB(e.region); } + if (e.sphere) { return lB(e.sphere, t, n); } + throw new Error('3D Tile: boundingVolume must contain a sphere, region, or box'); +} +function uB (e, t) { + if (e.box) { return fB(t); } + if (e.region) { + const [n, s, r, i, o, a] = e.region; + return [ + [Rt(n), Rt(s), o], + [Rt(r), Rt(i), a] + ]; + } + if (e.sphere) { return dB(t); } + throw new Error('Unkown boundingVolume type'); +} +function Oc (e, t, n) { + const s = new A(e[0], e[1], e[2]); + t.transform(s, s); + let r = []; + if (e.length === 10) { + const u = e.slice(3, 6); const l = new On(); + l.fromArray(e, 6); + const h = new A([1, 0, 0]); const f = new A([0, 1, 0]); const d = new A([0, 0, 1]); + h.transformByQuaternion(l), h.scale(u[0]), f.transformByQuaternion(l), f.scale(u[1]), d.transformByQuaternion(l), d.scale(u[2]), r = [...h.toArray(), ...f.toArray(), ...d.toArray()]; + } else { r = [...e.slice(3, 6), ...e.slice(6, 9), ...e.slice(9, 12)]; } + const i = t.transformAsVector(r.slice(0, 3)); const o = t.transformAsVector(r.slice(3, 6)); const a = t.transformAsVector(r.slice(6, 9)); const c = new X([ + i[0], + i[1], + i[2], + o[0], + o[1], + o[2], + a[0], + a[1], + a[2] + ]); + return vc(n) ? (n.center = s, n.halfAxes = c, n) : new qe(s, c); +} +function lB (e, t, n) { + const s = new A(e[0], e[1], e[2]); + t.transform(s, s); + const r = t.getScale(Rn); const i = Math.max(Math.max(r[0], r[1]), r[2]); const o = e[3] * i; + return vc(n) ? (n.center = s, n.radius = o, n) : new Qe(s, o); +} +function hB (e) { + const [t, n, s, r, i, o] = e; const a = J.WGS84.cartographicToCartesian([Rt(t), Rt(r), i], aB); const c = J.WGS84.cartographicToCartesian([Rt(s), Rt(n), o], cB); const u = new A().addVectors(a, c).multiplyByScalar(0.5); + return J.WGS84.cartesianToCartographic(u, qt), J.WGS84.cartographicToCartesian([Rt(s), qt[1], qt[2]], _o), J.WGS84.cartographicToCartesian([qt[0], Rt(r), qt[2]], wo), J.WGS84.cartographicToCartesian([qt[0], qt[1], o], Ro), Oc([ + ...u, + ..._o.subtract(u), + ...wo.subtract(u), + ...Ro.subtract(u) + ], new V()); +} +function fB (e) { + const t = Fc(); const { halfAxes: n } = e; const s = new A(n.getColumn(0)); const r = new A(n.getColumn(1)); const i = new A(n.getColumn(2)); + for (let o = 0; o < 2; o++) { + for (let a = 0; a < 2; a++) { + for (let c = 0; c < 2; c++) { it.copy(e.center), it.add(s), it.add(r), it.add(i), Dc(t, it), i.negate(); } + r.negate(); + } + s.negate(); + } + return t; +} +function dB (e) { + const t = Fc(); const { center: n, radius: s } = e; const r = J.WGS84.scaleToGeodeticSurface(n, it); + let i; + r ? i = J.WGS84.geodeticSurfaceNormal(r) : i = new A(0, 0, 1); + let o = new A(i[2], -i[1], 0); + o.len() > 0 ? o.normalize() : o = new A(0, 1, 0); + const a = o.clone().cross(i); + for (const c of [o, a, i]) { + Rn.copy(c).scale(s); + for (let u = 0; u < 2; u++) { it.copy(n), it.add(Rn), Dc(t, it), Rn.negate(); } + } + return t; +} +function Fc () { + return [ + [1 / 0, 1 / 0, 1 / 0], + [-1 / 0, -1 / 0, -1 / 0] + ]; +} +function Dc (e, t) { + J.WGS84.cartesianToCartographic(t, it), e[0][0] = Math.min(e[0][0], it[0]), e[0][1] = Math.min(e[0][1], it[1]), e[0][2] = Math.min(e[0][2], it[2]), e[1][0] = Math.max(e[1][0], it[0]), e[1][1] = Math.max(e[1][1], it[1]), e[1][2] = Math.max(e[1][2], it[2]); +} +new A(); +new A(); +new V(); +new A(); +new A(); +new A(); +function mB (e, t) { + const n = e * t; + return 1 - Math.exp(-(n * n)); +} +function gB (e, t) { + if (e.dynamicScreenSpaceError && e.dynamicScreenSpaceErrorComputedDensity) { + const n = e.dynamicScreenSpaceErrorComputedDensity; const s = e.dynamicScreenSpaceErrorFactor; + return mB(t, n) * s; + } + return 0; +} +function AB (e, t, n) { + const s = e.tileset; const r = e.parent && e.parent.lodMetricValue || e.lodMetricValue; const i = n ? r : e.lodMetricValue; + if (i === 0) { return 0; } + const o = Math.max(e._distanceToCamera, 1e-7); const { height: a, sseDenominator: c } = t; const { viewDistanceScale: u } = s.options; + let l = i * a * (u || 1) / (o * c); + return l -= gB(s, o), l; +} +const Fs = new A(); const Mo = new A(); const jt = new A(); const So = new A(); const pB = new A(); const Ds = new V(); const Io = new V(); +function yB (e, t) { + if (e.lodMetricValue === 0 || isNaN(e.lodMetricValue)) { return 'DIG'; } + const n = 2 * Lc(e, t); + return n < 2 ? 'OUT' : !e.header.children || n <= e.lodMetricValue ? 'DRAW' : e.header.children ? 'DIG' : 'OUT'; +} +function Lc (e, t) { + const { topDownViewport: n } = t; const s = e.header.mbs[1]; const r = e.header.mbs[0]; const i = e.header.mbs[2]; const o = e.header.mbs[3]; const a = [...e.boundingVolume.center]; const c = n.unprojectPosition(n.cameraPosition); + J.WGS84.cartographicToCartesian(c, Fs), Mo.copy(Fs).subtract(a).normalize(), J.WGS84.eastNorthUpToFixedFrame(a, Ds), Io.copy(Ds).invert(), jt.copy(Fs).transform(Io); + const u = Math.sqrt(jt[0] * jt[0] + jt[1] * jt[1]); const l = u * u / jt[2]; + So.copy([jt[0], jt[1], l]); + const f = So.transform(Ds).subtract(a).normalize(); const m = Mo.cross(f).normalize().scale(o).add(a); const g = J.WGS84.cartesianToCartographic(m); const y = n.project([r, s, i]); const E = n.project(g); + return pB.copy(y).subtract(E).magnitude(); +} +function BB (e) { + return { + assetGltfUpAxis: e.asset && e.asset.gltfUpAxis || 'Y' + }; +} +class xo { + constructor (t = 0) { + p(this, '_map', /* @__PURE__ */ new Map()); + p(this, '_array'); + p(this, '_length'); + this._array = new Array(t), this._length = t; + } + + /** + * Gets or sets the length of the array. + * If the set length is greater than the length of the internal array, the internal array is resized. + * + * @memberof ManagedArray.prototype + * @type Number + */ + get length () { + return this._length; + } + + set length (t) { + this._length = t, t > this._array.length && (this._array.length = t); + } + + /** + * Gets the internal array. + * + * @memberof ManagedArray.prototype + * @type Array + * @readonly + */ + get values () { + return this._array; + } + + /** + * Gets the element at an index. + * + * @param {Number} index The index to get. + */ + get (t) { + return $t(t < this._array.length), this._array[t]; + } + + /** + * Sets the element at an index. Resizes the array if index is greater than the length of the array. + * + * @param {Number} index The index to set. + * @param {*} element The element to set at index. + */ + set (t, n) { + $t(t >= 0), t >= this.length && (this.length = t + 1), this._map.has(this._array[t]) && this._map.delete(this._array[t]), this._array[t] = n, this._map.set(n, t); + } + + delete (t) { + const n = this._map.get(t); + n >= 0 && (this._array.splice(n, 1), this._map.delete(t), this.length--); + } + + /** + * Returns the last element in the array without modifying the array. + * + * @returns {*} The last element in the array. + */ + peek () { + return this._array[this._length - 1]; + } + + /** + * Push an element into the array. + * + * @param {*} element The element to push. + */ + push (t) { + if (!this._map.has(t)) { + const n = this.length++; + this._array[n] = t, this._map.set(t, n); + } + } + + /** + * Pop an element from the array. + * + * @returns {*} The last element in the array. + */ + pop () { + const t = this._array[--this.length]; + return this._map.delete(t), t; + } + + /** + * Resize the internal array if length > _array.length. + * + * @param {Number} length The length. + */ + reserve (t) { + $t(t >= 0), t > this._array.length && (this._array.length = t); + } + + /** + * Resize the array. + * + * @param {Number} length The length. + */ + resize (t) { + $t(t >= 0), this.length = t; + } + + /** + * Trim the internal array to the specified length. Defaults to the current length. + * + * @param {Number} [length] The length. + */ + trim (t) { + t == null && (t = this.length), this._array.length = t; + } + + reset () { + this._array = [], this._map = /* @__PURE__ */ new Map(), this._length = 0; + } + + find (t) { + return this._map.has(t); + } +} +const CB = { + loadSiblings: !1, + skipLevelOfDetail: !1, + updateTransforms: !0, + onTraversalEnd: () => { + }, + viewportTraversersMap: {}, + basePath: '' +}; +class ts { + // TODO nested props + constructor (t) { + p(this, 'options'); + // fulfill in traverse call + p(this, 'root', null); + // tiles should be rendered + p(this, 'selectedTiles', {}); + // tiles should be loaded from server + p(this, 'requestedTiles', {}); + // tiles does not have render content + p(this, 'emptyTiles', {}); + p(this, 'lastUpdate', (/* @__PURE__ */ new Date()).getTime()); + p(this, 'updateDebounceTime', 1e3); + /** temporary storage to hold the traversed tiles during a traversal */ + p(this, '_traversalStack', new xo()); + p(this, '_emptyTraversalStack', new xo()); + /** set in every traverse cycle */ + p(this, '_frameNumber', null); + this.options = { ...CB, ...t }; + } + + // RESULT + traversalFinished (t) { + return !0; + } + + // tiles should be visible + traverse (t, n, s) { + this.root = t, this.options = { ...this.options, ...s }, this.reset(), this.updateTile(t, n), this._frameNumber = n.frameNumber, this.executeTraversal(t, n); + } + + reset () { + this.requestedTiles = {}, this.selectedTiles = {}, this.emptyTiles = {}, this._traversalStack.reset(), this._emptyTraversalStack.reset(); + } + + /** + * Execute traverse + * Depth-first traversal that traverses all visible tiles and marks tiles for selection. + * If skipLevelOfDetail is off then a tile does not refine until all children are loaded. + * This is the traditional replacement refinement approach and is called the base traversal. + * Tiles that have a greater screen space error than the base screen space error are part of the base traversal, + * all other tiles are part of the skip traversal. The skip traversal allows for skipping levels of the tree + * and rendering children and parent tiles simultaneously. + */ + /* eslint-disable-next-line complexity, max-statements */ + executeTraversal (t, n) { + const s = this._traversalStack; + for (t._selectionDepth = 1, s.push(t); s.length > 0;) { + const i = s.pop(); + let o = !1; + this.canTraverse(i, n) && (this.updateChildTiles(i, n), o = this.updateAndPushChildren(i, n, s, i.hasRenderContent ? i._selectionDepth + 1 : i._selectionDepth)); + const a = i.parent; const c = !!(!a || a._shouldRefine); const u = !o; + i.hasRenderContent ? i.refine === Ht.ADD ? (this.loadTile(i, n), this.selectTile(i, n)) : i.refine === Ht.REPLACE && (this.loadTile(i, n), u && this.selectTile(i, n)) : (this.emptyTiles[i.id] = i, this.loadTile(i, n), u && this.selectTile(i, n)), this.touchTile(i, n), i._shouldRefine = o && c; + } + const r = (/* @__PURE__ */ new Date()).getTime(); + (this.traversalFinished(n) || r - this.lastUpdate > this.updateDebounceTime) && (this.lastUpdate = r, this.options.onTraversalEnd(n)); + } + + updateChildTiles (t, n) { + const s = t.children; + for (const r of s) { this.updateTile(r, n); } + } + + /* eslint-disable complexity, max-statements */ + updateAndPushChildren (t, n, s, r) { + const { loadSiblings: i, skipLevelOfDetail: o } = this.options; const a = t.children; + a.sort(this.compareDistanceToCamera.bind(this)); + const c = t.refine === Ht.REPLACE && t.hasRenderContent && !o; + let u = !1; let l = !0; + for (const h of a) { + if (h._selectionDepth = r, h.isVisibleAndInRequestVolume ? (s.find(h) && s.delete(h), s.push(h), u = !0) : (c || i) && (this.loadTile(h, n), this.touchTile(h, n)), c) { + let f; + if (h._inRequestVolume ? h.hasRenderContent ? f = h.contentAvailable : f = this.executeEmptyTraversal(h, n) : f = !1, l = l && f, !l) { return !1; } + } + } + return u || (l = !1), l; + } + + /* eslint-enable complexity, max-statements */ + updateTile (t, n) { + this.updateTileVisibility(t, n); + } + + // tile to render in the browser + selectTile (t, n) { + this.shouldSelectTile(t) && (t._selectedFrame = n.frameNumber, this.selectedTiles[t.id] = t); + } + + // tile to load from server + loadTile (t, n) { + this.shouldLoadTile(t) && (t._requestedFrame = n.frameNumber, t._priority = t._getPriority(), this.requestedTiles[t.id] = t); + } + + // cache tile + touchTile (t, n) { + t.tileset._cache.touch(t), t._touchedFrame = n.frameNumber; + } + + // tile should be visible + // tile should have children + // tile LoD (level of detail) is not sufficient under current viewport + canTraverse (t, n) { + return t.hasChildren ? t.hasTilesetContent ? !t.contentExpired : this.shouldRefine(t, n) : !1; + } + + shouldLoadTile (t) { + return t.hasUnloadedContent || t.contentExpired; + } + + shouldSelectTile (t) { + return t.contentAvailable && !this.options.skipLevelOfDetail; + } + + /** Decide if tile LoD (level of detail) is not sufficient under current viewport */ + shouldRefine (t, n, s = !1) { + let r = t._screenSpaceError; + return s && (r = t.getScreenSpaceError(n, !0)), r > t.tileset.memoryAdjustedScreenSpaceError; + } + + updateTileVisibility (t, n) { + const s = []; + if (this.options.viewportTraversersMap) { + for (const r in this.options.viewportTraversersMap) { this.options.viewportTraversersMap[r] === n.viewport.id && s.push(r); } + } else { s.push(n.viewport.id); } + t.updateVisibility(n, s); + } + + // UTILITIES + compareDistanceToCamera (t, n) { + return t._distanceToCamera - n._distanceToCamera; + } + + anyChildrenVisible (t, n) { + let s = !1; + for (const r of t.children) { r.updateVisibility(n), s = s || r.isVisibleAndInRequestVolume; } + return s; + } + + // Depth-first traversal that checks if all nearest descendants with content are loaded. + // Ignores visibility. + executeEmptyTraversal (t, n) { + let s = !0; + const r = this._emptyTraversalStack; + for (r.push(t); r.length > 0;) { + const i = r.pop(); const o = !i.hasRenderContent && this.canTraverse(i, n); const a = !i.hasRenderContent && i.children.length === 0; + if (!o && !i.contentAvailable && !a && (s = !1), this.updateTile(i, n), i.isVisibleAndInRequestVolume || (this.loadTile(i, n), this.touchTile(i, n)), o) { + const c = i.children; + for (const u of c) { r.push(u); } + } + } + return s; + } +} +const vo = new A(); +function EB (e) { + return e != null; +} +class ur { + // TODO i3s specific, needs to remove + /** + * @constructs + * Create a Tile3D instance + * @param tileset - Tileset3D instance + * @param header - tile header - JSON loaded from a dataset + * @param parentHeader - parent Tile3D instance + * @param extendedId - optional ID to separate copies of a tile for different viewports. + * const extendedId = `${tile.id}-${frameState.viewport.id}`; + */ + // eslint-disable-next-line max-statements + constructor (t, n, s, r = '') { + p(this, 'tileset'); + p(this, 'header'); + p(this, 'id'); + p(this, 'url'); + p(this, 'parent'); + /* Specifies the type of refine that is used when traversing this tile for rendering. */ + p(this, 'refine'); + p(this, 'type'); + p(this, 'contentUrl'); + /** Different refinement algorithms used by I3S and 3D tiles */ + p(this, 'lodMetricType', 'geometricError'); + /** The error, in meters, introduced if this tile is rendered and its children are not. */ + p(this, 'lodMetricValue', 0); + /** @todo math.gl is not exporting BoundingVolume base type? */ + p(this, 'boundingVolume', null); + /** + * The tile's content. This represents the actual tile's payload, + * not the content's metadata in the tileset JSON file. + */ + p(this, 'content', null); + p(this, 'contentState', lt.UNLOADED); + p(this, 'gpuMemoryUsageInBytes', 0); + /** The tile's children - an array of Tile3D objects. */ + p(this, 'children', []); + p(this, 'depth', 0); + p(this, 'viewportIds', []); + p(this, 'transform', new V()); + p(this, 'extensions', null); + /** TODO Cesium 3d tiles specific */ + p(this, 'implicitTiling', null); + /** Container to store application specific data */ + p(this, 'userData', {}); + p(this, 'computedTransform'); + p(this, 'hasEmptyContent', !1); + p(this, 'hasTilesetContent', !1); + p(this, 'traverser', new ts({})); + /** Used by TilesetCache */ + p(this, '_cacheNode', null); + p(this, '_frameNumber', null); + // TODO Cesium 3d tiles specific + p(this, '_expireDate', null); + p(this, '_expiredContent', null); + p(this, '_boundingBox'); + /** updated every frame for tree traversal and rendering optimizations: */ + p(this, '_distanceToCamera', 0); + p(this, '_screenSpaceError', 0); + p(this, '_visibilityPlaneMask'); + p(this, '_visible'); + p(this, '_contentBoundingVolume'); + p(this, '_viewerRequestVolume'); + p(this, '_initialTransform', new V()); + // Used by traverser, cannot be marked private + p(this, '_priority', 0); + p(this, '_selectedFrame', 0); + p(this, '_requestedFrame', 0); + p(this, '_selectionDepth', 0); + p(this, '_touchedFrame', 0); + p(this, '_centerZDepth', 0); + p(this, '_shouldRefine', !1); + p(this, '_stackLength', 0); + p(this, '_visitedFrame', 0); + p(this, '_inRequestVolume', !1); + p(this, '_lodJudge', null); + this.header = n, this.tileset = t, this.id = r || n.id, this.url = n.url, this.parent = s, this.refine = this._getRefine(n.refine), this.type = n.type, this.contentUrl = n.contentUrl, this._initializeLodMetric(n), this._initializeTransforms(n), this._initializeBoundingVolumes(n), this._initializeContent(n), this._initializeRenderingState(n), Object.seal(this); + } + + destroy () { + this.header = null; + } + + isDestroyed () { + return this.header === null; + } + + get selected () { + return this._selectedFrame === this.tileset._frameNumber; + } + + get isVisible () { + return this._visible; + } + + get isVisibleAndInRequestVolume () { + return this._visible && this._inRequestVolume; + } + + /** Returns true if tile is not an empty tile and not an external tileset */ + get hasRenderContent () { + return !this.hasEmptyContent && !this.hasTilesetContent; + } + + /** Returns true if tile has children */ + get hasChildren () { + return this.children.length > 0 || this.header.children && this.header.children.length > 0; + } + + /** + * Determines if the tile's content is ready. This is automatically `true` for + * tiles with empty content. + */ + get contentReady () { + return this.contentState === lt.READY || this.hasEmptyContent; + } + + /** + * Determines if the tile has available content to render. `true` if the tile's + * content is ready or if it has expired content this renders while new content loads; otherwise, + */ + get contentAvailable () { + return !!(this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed); + } + + /** Returns true if tile has renderable content but it's unloaded */ + get hasUnloadedContent () { + return this.hasRenderContent && this.contentUnloaded; + } + + /** + * Determines if the tile's content has not be requested. `true` if tile's + * content has not be requested; otherwise, `false`. + */ + get contentUnloaded () { + return this.contentState === lt.UNLOADED; + } + + /** + * Determines if the tile's content is expired. `true` if tile's + * content is expired; otherwise, `false`. + */ + get contentExpired () { + return this.contentState === lt.EXPIRED; + } + + // Determines if the tile's content failed to load. `true` if the tile's + // content failed to load; otherwise, `false`. + get contentFailed () { + return this.contentState === lt.FAILED; + } + + /** + * Distance from the tile's bounding volume center to the camera + */ + get distanceToCamera () { + return this._distanceToCamera; + } + + /** + * Screen space error for LOD selection + */ + get screenSpaceError () { + return this._screenSpaceError; + } + + /** + * Get bounding box in cartographic coordinates + * @returns [min, max] each in [longitude, latitude, altitude] + */ + get boundingBox () { + return this._boundingBox || (this._boundingBox = uB(this.header.boundingVolume, this.boundingVolume)), this._boundingBox; + } + + /** Get the tile's screen space error. */ + getScreenSpaceError (t, n) { + switch (this.tileset.type) { + case At.I3S: + return Lc(this, t); + case At.TILES3D: + return AB(this, t, n); + default: + throw new Error('Unsupported tileset type'); + } + } + + /** + * Make tile unselected than means it won't be shown + * but it can be still loaded in memory + */ + unselect () { + this._selectedFrame = 0; + } + + /** + * Memory usage of tile on GPU + */ + _getGpuMemoryUsageInBytes () { + return this.content.gpuMemoryUsageInBytes || this.content.byteLength || 0; + } + + /* + * If skipLevelOfDetail is off try to load child tiles as soon as possible so that their parent can refine sooner. + * Tiles are prioritized by screen space error. + */ + // eslint-disable-next-line complexity + _getPriority () { + const t = this.tileset._traverser; const { skipLevelOfDetail: n } = t.options; const s = this.refine === Ht.ADD || n; + if (s && !this.isVisible && this._visible !== void 0 || this.tileset._frameNumber - this._touchedFrame >= 1 || this.contentState === lt.UNLOADED) { return -1; } + const r = this.parent; const o = r && (!s || this._screenSpaceError === 0 || r.hasTilesetContent) ? r._screenSpaceError : this._screenSpaceError; const a = t.root ? t.root._screenSpaceError : 0; + return Math.max(a - o, 0); + } + + /** + * Requests the tile's content. + * The request may not be made if the Request Scheduler can't prioritize it. + */ + // eslint-disable-next-line max-statements, complexity + async loadContent () { + if (this.hasEmptyContent) { return !1; } + if (this.content) { return !0; } + this.contentExpired && (this._expireDate = null), this.contentState = lt.LOADING; + const n = await this.tileset._requestScheduler.scheduleRequest(this.id, this._getPriority.bind(this)); + if (!n) { return this.contentState = lt.UNLOADED, !1; } + try { + const s = this.tileset.getTileUrl(this.contentUrl); const r = this.tileset.loader; const i = { + ...this.tileset.loadOptions, + [r.id]: { + // @ts-expect-error + ...this.tileset.loadOptions[r.id], + isTileset: this.type === 'json', + ...this._getLoaderSpecificOptions(r.id) + } + }; + return this.content = await Ae(s, r, i), this.tileset.options.contentLoader && await this.tileset.options.contentLoader(this), this._isTileset() && this.tileset._initializeTileHeaders(this.content, this), this.contentState = lt.READY, this._onContentLoaded(), !0; + } catch (s) { + throw this.contentState = lt.FAILED, s; + } finally { + n.done(); + } + } + + // Unloads the tile's content. + unloadContent () { + return this.content && this.content.destroy && this.content.destroy(), this.content = null, this.header.content && this.header.content.destroy && this.header.content.destroy(), this.header.content = null, this.contentState = lt.UNLOADED, !0; + } + + /** + * Update the tile's visibility + * @param {Object} frameState - frame state for tile culling + * @param {string[]} viewportIds - a list of viewport ids that show this tile + * @return {void} + */ + updateVisibility (t, n) { + if (this._frameNumber === t.frameNumber) { return; } + const s = this.parent; const r = s ? s._visibilityPlaneMask : dt.MASK_INDETERMINATE; + if (this.tileset._traverser.options.updateTransforms) { + const i = s ? s.computedTransform : this.tileset.modelMatrix; + this._updateTransform(i); + } + this._distanceToCamera = this.distanceToTile(t), this._screenSpaceError = this.getScreenSpaceError(t, !1), this._visibilityPlaneMask = this.visibility(t, r), this._visible = this._visibilityPlaneMask !== dt.MASK_OUTSIDE, this._inRequestVolume = this.insideViewerRequestVolume(t), this._frameNumber = t.frameNumber, this.viewportIds = n; + } + + // Determines whether the tile's bounding volume intersects the culling volume. + // @param {FrameState} frameState The frame state. + // @param {Number} parentVisibilityPlaneMask The parent's plane mask to speed up the visibility check. + // @returns {Number} A plane mask as described above in {@link CullingVolume#computeVisibilityWithPlaneMask}. + visibility (t, n) { + const { cullingVolume: s } = t; const { boundingVolume: r } = this; + return s.computeVisibilityWithPlaneMask(r, n); + } + + // Assuming the tile's bounding volume intersects the culling volume, determines + // whether the tile's content's bounding volume intersects the culling volume. + // @param {FrameState} frameState The frame state. + // @returns {Intersect} The result of the intersection: the tile's content is completely outside, completely inside, or intersecting the culling volume. + contentVisibility () { + return !0; + } + + /** + * Computes the (potentially approximate) distance from the closest point of the tile's bounding volume to the camera. + * @param frameState The frame state. + * @returns {Number} The distance, in meters, or zero if the camera is inside the bounding volume. + */ + distanceToTile (t) { + const n = this.boundingVolume; + return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position), 0)); + } + + /** + * Computes the tile's camera-space z-depth. + * @param frameState The frame state. + * @returns The distance, in meters. + */ + cameraSpaceZDepth ({ camera: t }) { + const n = this.boundingVolume; + return vo.subVectors(n.center, t.position), t.direction.dot(vo); + } + + /** + * Checks if the camera is inside the viewer request volume. + * @param {FrameState} frameState The frame state. + * @returns {Boolean} Whether the camera is inside the volume. + */ + insideViewerRequestVolume (t) { + const n = this._viewerRequestVolume; + return !n || n.distanceSquaredTo(t.camera.position) <= 0; + } + + // TODO Cesium specific + // Update whether the tile has expired. + updateExpiration () { + if (EB(this._expireDate) && this.contentReady && !this.hasEmptyContent) { + const t = Date.now(); + Date.lessThan(this._expireDate, t) && (this.contentState = lt.EXPIRED, this._expiredContent = this.content); + } + } + + get extras () { + return this.header.extras; + } + + // INTERNAL METHODS + _initializeLodMetric (t) { + 'lodMetricType' in t ? this.lodMetricType = t.lodMetricType : (this.lodMetricType = this.parent && this.parent.lodMetricType || this.tileset.lodMetricType, console.warn('3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType')), 'lodMetricValue' in t ? this.lodMetricValue = t.lodMetricValue : (this.lodMetricValue = this.parent && this.parent.lodMetricValue || this.tileset.lodMetricValue, console.warn('3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue')); + } + + _initializeTransforms (t) { + this.transform = t.transform ? new V(t.transform) : new V(); + const n = this.parent; const s = this.tileset; const r = n && n.computedTransform ? n.computedTransform.clone() : s.modelMatrix.clone(); + this.computedTransform = new V(r).multiplyRight(this.transform); + const i = n && n._initialTransform ? n._initialTransform.clone() : new V(); + this._initialTransform = new V(i).multiplyRight(this.transform); + } + + _initializeBoundingVolumes (t) { + this._contentBoundingVolume = null, this._viewerRequestVolume = null, this._updateBoundingVolume(t); + } + + _initializeContent (t) { + this.content = { _tileset: this.tileset, _tile: this }, this.hasEmptyContent = !0, this.contentState = lt.UNLOADED, this.hasTilesetContent = !1, t.contentUrl && (this.content = null, this.hasEmptyContent = !1); + } + + // TODO - remove anything not related to basic visibility detection + _initializeRenderingState (t) { + this.depth = t.level || (this.parent ? this.parent.depth + 1 : 0), this._shouldRefine = !1, this._distanceToCamera = 0, this._centerZDepth = 0, this._screenSpaceError = 0, this._visibilityPlaneMask = dt.MASK_INDETERMINATE, this._visible = void 0, this._inRequestVolume = !1, this._stackLength = 0, this._selectionDepth = 0, this._frameNumber = 0, this._touchedFrame = 0, this._visitedFrame = 0, this._selectedFrame = 0, this._requestedFrame = 0, this._priority = 0; + } + + _getRefine (t) { + return t || this.parent && this.parent.refine || Ht.REPLACE; + } + + _isTileset () { + return this.contentUrl.indexOf('.json') !== -1; + } + + _onContentLoaded () { + switch (this.content && this.content.type) { + case 'vctr': + case 'geom': + this.tileset._traverser.disableSkipLevelOfDetail = !0; + break; + } + this._isTileset() ? this.hasTilesetContent = !0 : this.gpuMemoryUsageInBytes = this._getGpuMemoryUsageInBytes(); + } + + _updateBoundingVolume (t) { + this.boundingVolume = Os(t.boundingVolume, this.computedTransform, this.boundingVolume); + const n = t.content; + n && (n.boundingVolume && (this._contentBoundingVolume = Os(n.boundingVolume, this.computedTransform, this._contentBoundingVolume)), t.viewerRequestVolume && (this._viewerRequestVolume = Os(t.viewerRequestVolume, this.computedTransform, this._viewerRequestVolume))); + } + + // Update the tile's transform. The transform is applied to the tile's bounding volumes. + _updateTransform (t = new V()) { + const n = t.clone().multiplyRight(this.transform); + n.equals(this.computedTransform) || (this.computedTransform = n, this._updateBoundingVolume(this.header)); + } + + // Get options which are applicable only for the particular loader + _getLoaderSpecificOptions (t) { + switch (t) { + case 'i3s': + return { + ...this.tileset.options.i3s, + _tileOptions: { + attributeUrls: this.header.attributeUrls, + textureUrl: this.header.textureUrl, + textureFormat: this.header.textureFormat, + textureLoaderOptions: this.header.textureLoaderOptions, + materialDefinition: this.header.materialDefinition, + isDracoGeometry: this.header.isDracoGeometry, + mbs: this.header.mbs + }, + _tilesetOptions: { + store: this.tileset.tileset.store, + attributeStorageInfo: this.tileset.tileset.attributeStorageInfo, + fields: this.tileset.tileset.fields + }, + isTileHeader: !1 + }; + case '3d-tiles': + case 'cesium-ion': + default: + return BB(this.tileset.tileset); + } + } +} +class TB extends ts { + compareDistanceToCamera (t, n) { + return n._distanceToCamera === 0 && t._distanceToCamera === 0 ? n._centerZDepth - t._centerZDepth : n._distanceToCamera - t._distanceToCamera; + } + + updateTileVisibility (t, n) { + if (super.updateTileVisibility(t, n), !t.isVisibleAndInRequestVolume) { return; } + const s = t.children.length > 0; + if (t.hasTilesetContent && s) { + const o = t.children[0]; + this.updateTileVisibility(o, n), t._visible = o._visible; + return; + } + if (this.meetsScreenSpaceErrorEarly(t, n)) { + t._visible = !1; + return; + } + const r = t.refine === Ht.REPLACE; const i = t._optimChildrenWithinParent === oB.USE_OPTIMIZATION; + if (r && i && s && !this.anyChildrenVisible(t, n)) { + t._visible = !1; + } + } + + meetsScreenSpaceErrorEarly (t, n) { + const { parent: s } = t; + return !s || s.hasTilesetContent || s.refine !== Ht.ADD ? !1 : !this.shouldRefine(t, n, !0); + } +} +class bB { + constructor () { + p(this, 'frameNumberMap', /* @__PURE__ */ new Map()); + } + + /** + * Register a new pending tile header for the particular frameNumber + * @param viewportId + * @param frameNumber + */ + register (t, n) { + const s = this.frameNumberMap.get(t) || /* @__PURE__ */ new Map(); const r = s.get(n) || 0; + s.set(n, r + 1), this.frameNumberMap.set(t, s); + } + + /** + * Deregister a pending tile header for the particular frameNumber + * @param viewportId + * @param frameNumber + */ + deregister (t, n) { + const s = this.frameNumberMap.get(t); + if (!s) { return; } + const r = s.get(n) || 1; + s.set(n, r - 1); + } + + /** + * Check is there are no pending tile headers registered for the particular frameNumber + * @param viewportId + * @param frameNumber + * @returns + */ + isZero (t, n) { + let r; + return (((r = this.frameNumberMap.get(t)) == null ? void 0 : r.get(n)) || 0) === 0; + } +} +const Ls = { + REQUESTED: 'REQUESTED', + COMPLETED: 'COMPLETED', + ERROR: 'ERROR' +}; +class _B { + constructor () { + p(this, '_statusMap'); + p(this, 'pendingTilesRegister', new bB()); + this._statusMap = {}; + } + + /** + * Add request to map + * @param request - node metadata request + * @param key - unique key + * @param callback - callback after request completed + * @param frameState - frameState data + */ + add (t, n, s, r) { + if (!this._statusMap[n]) { + const { frameNumber: i, viewport: { id: o } } = r; + this._statusMap[n] = { request: t, callback: s, key: n, frameState: r, status: Ls.REQUESTED }, this.pendingTilesRegister.register(o, i), t().then((a) => { + this._statusMap[n].status = Ls.COMPLETED; + const { frameNumber: c, viewport: { id: u } } = this._statusMap[n].frameState; + this.pendingTilesRegister.deregister(u, c), this._statusMap[n].callback(a, r); + }).catch((a) => { + this._statusMap[n].status = Ls.ERROR; + const { frameNumber: c, viewport: { id: u } } = this._statusMap[n].frameState; + this.pendingTilesRegister.deregister(u, c), s(a); + }); + } + } + + /** + * Update request if it is still actual for the new frameState + * @param key - unique key + * @param frameState - frameState data + */ + update (t, n) { + if (this._statusMap[t]) { + const { frameNumber: s, viewport: { id: r } } = this._statusMap[t].frameState; + this.pendingTilesRegister.deregister(r, s); + const { frameNumber: i, viewport: { id: o } } = n; + this.pendingTilesRegister.register(o, i), this._statusMap[t].frameState = n; + } + } + + /** + * Find request in the map + * @param key - unique key + * @returns + */ + find (t) { + return this._statusMap[t]; + } + + /** + * Check it there are pending tile headers for the particular frameNumber + * @param viewportId + * @param frameNumber + * @returns + */ + hasPendingTiles (t, n) { + return !this.pendingTilesRegister.isZero(t, n); + } +} +class wB extends ts { + constructor (n) { + super(n); + p(this, '_tileManager'); + this._tileManager = new _B(); + } + + /** + * Check if there are no penging tile header requests, + * that means the traversal is finished and we can call + * following-up callbacks. + */ + traversalFinished (n) { + return !this._tileManager.hasPendingTiles(n.viewport.id, this._frameNumber || 0); + } + + shouldRefine (n, s) { + return n._lodJudge = yB(n, s), n._lodJudge === 'DIG'; + } + + updateChildTiles (n, s) { + const r = n.header.children || []; const i = n.children; const o = n.tileset; + for (const a of r) { + const c = `${a.id}-${s.viewport.id}`; const u = i && i.find((l) => l.id === c); + if (u) { u && this.updateTile(u, s); } else { + let l = () => this._loadTile(a.id, o); + this._tileManager.find(c) ? this._tileManager.update(c, s) : (o.tileset.nodePages && (l = () => o.tileset.nodePagesTile.formTileFromNodePages(a.id)), this._tileManager.add(l, c, (f) => this._onTileLoad(f, n, c), s)); + } + } + return !1; + } + + async _loadTile (n, s) { + const { loader: r } = s; const i = s.getTileUrl(`${s.url}/nodes/${n}`); const o = { + ...s.loadOptions, + i3s: { + ...s.loadOptions.i3s, + isTileHeader: !0 + } + }; + return await Ae(i, r, o); + } + + /** + * The callback to init Tile3D instance after loading the tile JSON + * @param {Object} header - the tile JSON from a dataset + * @param {Tile3D} tile - the parent Tile3D instance + * @param {string} extendedId - optional ID to separate copies of a tile for different viewports. + * const extendedId = `${tile.id}-${frameState.viewport.id}`; + * @return {void} + */ + _onTileLoad (n, s, r) { + const i = new ur(s.tileset, n, s, r); + s.children.push(i); + const o = this._tileManager.find(i.id).frameState; + this.updateTile(i, o), this._frameNumber === o.frameNumber && (this.traversalFinished(o) || (/* @__PURE__ */ new Date()).getTime() - this.lastUpdate > this.updateDebounceTime) && this.executeTraversal(i, o); + } +} +const RB = { + description: '', + ellipsoid: J.WGS84, + modelMatrix: new V(), + throttleRequests: !0, + maxRequests: 64, + /** Default memory values optimized for viewing mesh-based 3D Tiles on both mobile and desktop devices */ + maximumMemoryUsage: 32, + memoryCacheOverflow: 1, + maximumTilesSelected: 0, + debounceTime: 0, + onTileLoad: () => { + }, + onTileUnload: () => { + }, + onTileError: () => { + }, + onTraversalComplete: (e) => e, + contentLoader: void 0, + viewDistanceScale: 1, + maximumScreenSpaceError: 8, + memoryAdjustedScreenSpaceError: !1, + loadTiles: !0, + updateTransforms: !0, + viewportTraversersMap: null, + loadOptions: { fetch: {} }, + attributions: [], + basePath: '', + i3s: {} +}; const Cn = 'Tiles In Tileset(s)'; const Ps = 'Tiles In Memory'; const Oo = 'Tiles In View'; const Fo = 'Tiles To Render'; const Do = 'Tiles Loaded'; const Gs = 'Tiles Loading'; const Lo = 'Tiles Unloaded'; const Po = 'Failed Tile Loads'; const Go = 'Points/Vertices'; const Ns = 'Tile Memory Use'; const No = 'Maximum Screen Space Error'; +class MB { + /** + * Create a new Tileset3D + * @param json + * @param props + */ + // eslint-disable-next-line max-statements + constructor (t, n) { + // props: Tileset3DProps; + p(this, 'options'); + p(this, 'loadOptions'); + p(this, 'type'); + p(this, 'tileset'); + p(this, 'loader'); + p(this, 'url'); + p(this, 'basePath'); + p(this, 'modelMatrix'); + p(this, 'ellipsoid'); + p(this, 'lodMetricType'); + p(this, 'lodMetricValue'); + p(this, 'refine'); + p(this, 'root', null); + p(this, 'roots', {}); + /** @todo any->unknown */ + p(this, 'asset', {}); + // Metadata for the entire tileset + p(this, 'description', ''); + p(this, 'properties'); + p(this, 'extras', null); + p(this, 'attributions', {}); + p(this, 'credits', {}); + p(this, 'stats'); + /** flags that contain information about data types in nested tiles */ + p(this, 'contentFormats', { draco: !1, meshopt: !1, dds: !1, ktx2: !1 }); + // view props + p(this, 'cartographicCenter', null); + p(this, 'cartesianCenter', null); + p(this, 'zoom', 1); + p(this, 'boundingVolume', null); + /** Updated based on the camera position and direction */ + p(this, 'dynamicScreenSpaceErrorComputedDensity', 0); + // METRICS + /** + * The maximum amount of GPU memory (in MB) that may be used to cache tiles + * Tiles not in view are unloaded to enforce private + */ + p(this, 'maximumMemoryUsage', 32); + /** The total amount of GPU memory in bytes used by the tileset. */ + p(this, 'gpuMemoryUsageInBytes', 0); + /** + * If loading the level of detail required by maximumScreenSpaceError + * results in the memory usage exceeding maximumMemoryUsage (GPU), level of detail refinement + * will instead use this (larger) adjusted screen space error to achieve the + * best possible visual quality within the available memory. + */ + p(this, 'memoryAdjustedScreenSpaceError', 0); + p(this, '_cacheBytes', 0); + p(this, '_cacheOverflowBytes', 0); + /** Update tracker. increase in each update cycle. */ + p(this, '_frameNumber', 0); + p(this, '_queryParams', {}); + p(this, '_extensionsUsed', []); + p(this, '_tiles', {}); + /** counter for tracking tiles requests */ + p(this, '_pendingCount', 0); + /** Hold traversal results */ + p(this, 'selectedTiles', []); + // TRAVERSAL + p(this, 'traverseCounter', 0); + p(this, 'geometricError', 0); + p(this, 'lastUpdatedVieports', null); + p(this, '_requestedTiles', []); + p(this, '_emptyTiles', []); + p(this, 'frameStateData', {}); + p(this, '_traverser'); + p(this, '_cache', new qy()); + p(this, '_requestScheduler'); + // Promise tracking + p(this, 'updatePromise', null); + p(this, 'tilesetInitializationPromise'); + this.options = { ...RB, ...n }, this.tileset = t, this.loader = t.loader, this.type = t.type, this.url = t.url, this.basePath = t.basePath || Wy(this.url), this.modelMatrix = this.options.modelMatrix, this.ellipsoid = this.options.ellipsoid, this.lodMetricType = t.lodMetricType, this.lodMetricValue = t.lodMetricValue, this.refine = t.root.refine, this.loadOptions = this.options.loadOptions || {}, this._traverser = this._initializeTraverser(), this._requestScheduler = new zy({ + throttleRequests: this.options.throttleRequests, + maxRequests: this.options.maxRequests + }), this.memoryAdjustedScreenSpaceError = this.options.maximumScreenSpaceError, this._cacheBytes = this.options.maximumMemoryUsage * 1024 * 1024, this._cacheOverflowBytes = this.options.memoryCacheOverflow * 1024 * 1024, this.stats = new $o({ id: this.url }), this._initializeStats(), this.tilesetInitializationPromise = this._initializeTileSet(t); + } + + /** Release resources */ + destroy () { + this._destroy(); + } + + /** Is the tileset loaded (update needs to have been called at least once) */ + isLoaded () { + return this._pendingCount === 0 && this._frameNumber !== 0 && this._requestedTiles.length === 0; + } + + get tiles () { + return Object.values(this._tiles); + } + + get frameNumber () { + return this._frameNumber; + } + + get queryParams () { + return new URLSearchParams(this._queryParams).toString(); + } + + setProps (t) { + this.options = { ...this.options, ...t }; + } + + /** @deprecated */ + // setOptions(options: Tileset3DProps): void { + // this.options = {...this.options, ...options}; + // } + /** + * Return a loadable tile url for a specific tile subpath + * @param tilePath a tile subpath + */ + getTileUrl (t) { + if (t.startsWith('data:')) { return t; } + let s = t; + return this.queryParams.length && (s = `${t}${t.includes('?') ? '&' : '?'}${this.queryParams}`), s; + } + + // TODO CESIUM specific + hasExtension (t) { + return this._extensionsUsed.indexOf(t) > -1; + } + + /** + * Update visible tiles relying on a list of viewports + * @param viewports - list of viewports + * @deprecated + */ + update (t = null) { + this.tilesetInitializationPromise.then(() => { + !t && this.lastUpdatedVieports ? t = this.lastUpdatedVieports : this.lastUpdatedVieports = t, t && this.doUpdate(t); + }); + } + + /** + * Update visible tiles relying on a list of viewports. + * Do it with debounce delay to prevent update spam + * @param viewports viewports + * @returns Promise of new frameNumber + */ + async selectTiles (t = null) { + return await this.tilesetInitializationPromise, t && (this.lastUpdatedVieports = t), this.updatePromise || (this.updatePromise = new Promise((n) => { + setTimeout(() => { + this.lastUpdatedVieports && this.doUpdate(this.lastUpdatedVieports), n(this._frameNumber), this.updatePromise = null; + }, this.options.debounceTime); + })), this.updatePromise; + } + + adjustScreenSpaceError () { + this.gpuMemoryUsageInBytes < this._cacheBytes ? this.memoryAdjustedScreenSpaceError = Math.max(this.memoryAdjustedScreenSpaceError / 1.02, this.options.maximumScreenSpaceError) : this.gpuMemoryUsageInBytes > this._cacheBytes + this._cacheOverflowBytes && (this.memoryAdjustedScreenSpaceError *= 1.02); + } + + /** + * Update visible tiles relying on a list of viewports + * @param viewports viewports + */ + // eslint-disable-next-line max-statements, complexity + doUpdate (t) { + if ('loadTiles' in this.options && !this.options.loadTiles || this.traverseCounter > 0) { return; } + const n = t instanceof Array ? t : [t]; + this._cache.reset(), this._frameNumber++, this.traverseCounter = n.length; + const s = []; + for (const r of n) { + const i = r.id; + this._needTraverse(i) ? s.push(i) : this.traverseCounter--; + } + for (const r of n) { + const i = r.id; + if (this.roots[i] || (this.roots[i] = this._initializeTileHeaders(this.tileset, null)), !s.includes(i)) { continue; } + const o = $y(r, this._frameNumber); + this._traverser.traverse(this.roots[i], o, this.options); + } + } + + /** + * Check if traversal is needed for particular viewport + * @param {string} viewportId - id of a viewport + * @return {boolean} + */ + _needTraverse (t) { + let n = t; + return this.options.viewportTraversersMap && (n = this.options.viewportTraversersMap[t]), n === t; + } + + /** + * The callback to post-process tiles after traversal procedure + * @param frameState - frame state for tile culling + */ + _onTraversalEnd (t) { + const n = t.viewport.id; + this.frameStateData[n] || (this.frameStateData[n] = { selectedTiles: [], _requestedTiles: [], _emptyTiles: [] }); + const s = this.frameStateData[n]; const r = Object.values(this._traverser.selectedTiles); const [i, o] = Zy(r, t, this.options.maximumTilesSelected); + s.selectedTiles = i; + for (const a of o) { a.unselect(); } + s._requestedTiles = Object.values(this._traverser.requestedTiles), s._emptyTiles = Object.values(this._traverser.emptyTiles), this.traverseCounter--, !(this.traverseCounter > 0) && this._updateTiles(); + } + + /** + * Update tiles relying on data from all traversers + */ + _updateTiles () { + this.selectedTiles = [], this._requestedTiles = [], this._emptyTiles = []; + for (const t in this.frameStateData) { + const n = this.frameStateData[t]; + this.selectedTiles = this.selectedTiles.concat(n.selectedTiles), this._requestedTiles = this._requestedTiles.concat(n._requestedTiles), this._emptyTiles = this._emptyTiles.concat(n._emptyTiles); + } + this.selectedTiles = this.options.onTraversalComplete(this.selectedTiles); + for (const t of this.selectedTiles) { this._tiles[t.id] = t; } + this._loadTiles(), this._unloadTiles(), this._updateStats(); + } + + _tilesChanged (t, n) { + if (t.length !== n.length) { return !0; } + const s = new Set(t.map((o) => o.id)); const r = new Set(n.map((o) => o.id)); + let i = t.filter((o) => !r.has(o.id)).length > 0; + return i = i || n.filter((o) => !s.has(o.id)).length > 0, i; + } + + _loadTiles () { + for (const t of this._requestedTiles) { t.contentUnloaded && this._loadTile(t); } + } + + _unloadTiles () { + this._cache.unloadTiles(this, (t, n) => t._unloadTile(n)); + } + + _updateStats () { + let t = 0; let n = 0; + for (const s of this.selectedTiles) { s.contentAvailable && s.content && (t++, s.content.pointCount ? n += s.content.pointCount : n += s.content.vertexCount); } + this.stats.get(Oo).count = this.selectedTiles.length, this.stats.get(Fo).count = t, this.stats.get(Go).count = n, this.stats.get(No).count = this.memoryAdjustedScreenSpaceError; + } + + async _initializeTileSet (t) { + this.type === At.I3S && (this.calculateViewPropsI3S(), t.root = await t.root), this.root = this._initializeTileHeaders(t, null), this.type === At.TILES3D && (this._initializeTiles3DTileset(t), this.calculateViewPropsTiles3D()), this.type === At.I3S && this._initializeI3STileset(); + } + + /** + * Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom. + * These metrics help apps center view on tileset + * For I3S there is extent (<1.8 version) or fullExtent (>=1.8 version) to calculate view props + * @returns + */ + calculateViewPropsI3S () { + let s; + const t = this.tileset.fullExtent; + if (t) { + const { xmin: r, xmax: i, ymin: o, ymax: a, zmin: c, zmax: u } = t; + this.cartographicCenter = new A(r + (i - r) / 2, o + (a - o) / 2, c + (u - c) / 2), this.cartesianCenter = new A(), J.WGS84.cartographicToCartesian(this.cartographicCenter, this.cartesianCenter), this.zoom = xc(t, this.cartographicCenter, this.cartesianCenter); + return; + } + const n = (s = this.tileset.store) == null ? void 0 : s.extent; + if (n) { + const [r, i, o, a] = n; + this.cartographicCenter = new A(r + (o - r) / 2, i + (a - i) / 2, 0), this.cartesianCenter = new A(), J.WGS84.cartographicToCartesian(this.cartographicCenter, this.cartesianCenter), this.zoom = rB(n, this.cartographicCenter, this.cartesianCenter); + return; + } + console.warn('Extent is not defined in the tileset header'), this.cartographicCenter = new A(), this.zoom = 1; + } + + /** + * Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom. + * These metrics help apps center view on tileset. + * For 3DTiles the root tile data is used to calculate view props. + * @returns + */ + calculateViewPropsTiles3D () { + const t = this.root; const { center: n } = t.boundingVolume; + if (!n) { + console.warn('center was not pre-calculated for the root tile'), this.cartographicCenter = new A(), this.zoom = 1; + return; + } + n[0] !== 0 || n[1] !== 0 || n[2] !== 0 ? (this.cartographicCenter = new A(), J.WGS84.cartesianToCartographic(n, this.cartographicCenter)) : this.cartographicCenter = new A(0, 0, -J.WGS84.radii[0]), this.cartesianCenter = n, this.zoom = sB(t.boundingVolume, this.cartographicCenter); + } + + _initializeStats () { + this.stats.get(Cn), this.stats.get(Gs), this.stats.get(Ps), this.stats.get(Oo), this.stats.get(Fo), this.stats.get(Do), this.stats.get(Lo), this.stats.get(Po), this.stats.get(Go), this.stats.get(Ns, 'memory'), this.stats.get(No); + } + + // Installs the main tileset JSON file or a tileset JSON file referenced from a tile. + // eslint-disable-next-line max-statements + _initializeTileHeaders (t, n) { + let r; + const s = new ur(this, t.root, n); + if (n && (n.children.push(s), s.depth = n.depth + 1), this.type === At.TILES3D) { + const i = []; + for (i.push(s); i.length > 0;) { + const o = i.pop(); + this.stats.get(Cn).incrementCount(); + const a = o.header.children || []; + for (const c of a) { + const u = new ur(this, c, o); + if ((r = u.contentUrl) != null && r.includes('?session=')) { + const h = new URL(u.contentUrl).searchParams.get('session'); + h && (this._queryParams.session = h); + } + o.children.push(u), u.depth = o.depth + 1, i.push(u); + } + } + } + return s; + } + + _initializeTraverser () { + let t; + switch (this.type) { + case At.TILES3D: + t = TB; + break; + case At.I3S: + t = wB; + break; + default: + t = ts; + } + return new t({ + basePath: this.basePath, + onTraversalEnd: this._onTraversalEnd.bind(this) + }); + } + + _destroyTileHeaders (t) { + this._destroySubtree(t); + } + + async _loadTile (t) { + let n; + try { + this._onStartTileLoading(), n = await t.loadContent(); + } catch (s) { + this._onTileLoadError(t, s instanceof Error ? s : new Error('load failed')); + } finally { + this._onEndTileLoading(), this._onTileLoad(t, n); + } + } + + _onTileLoadError (t, n) { + this.stats.get(Po).incrementCount(); + const s = n.message || n.toString(); const r = t.url; + console.error(`A 3D tile failed to load: ${t.url} ${s}`), this.options.onTileError(t, s, r); + } + + _onTileLoad (t, n) { + let s, r; + if (n) { + if (this.type === At.I3S) { + const i = ((r = (s = this.tileset) == null ? void 0 : s.nodePagesTile) == null ? void 0 : r.nodesInNodePages) || 0; + this.stats.get(Cn).reset(), this.stats.get(Cn).addCount(i); + } + t && t.content && Yy(t, t.content), this.updateContentTypes(t), this._addTileToCache(t), this.options.onTileLoad(t); + } + } + + /** + * Update information about data types in nested tiles + * @param tile instance of a nested Tile3D + */ + updateContentTypes (t) { + let n; + if (this.type === At.I3S) { + switch (t.header.isDracoGeometry && (this.contentFormats.draco = !0), t.header.textureFormat) { + case 'dds': + this.contentFormats.dds = !0; + break; + case 'ktx2': + this.contentFormats.ktx2 = !0; + break; + } + } else if (this.type === At.TILES3D) { + const { extensionsRemoved: s = [] } = ((n = t.content) == null ? void 0 : n.gltf) || {}; + s.includes('KHR_draco_mesh_compression') && (this.contentFormats.draco = !0), s.includes('EXT_meshopt_compression') && (this.contentFormats.meshopt = !0), s.includes('KHR_texture_basisu') && (this.contentFormats.ktx2 = !0); + } + } + + _onStartTileLoading () { + this._pendingCount++, this.stats.get(Gs).incrementCount(); + } + + _onEndTileLoading () { + this._pendingCount--, this.stats.get(Gs).decrementCount(); + } + + _addTileToCache (t) { + this._cache.add(this, t, (n) => n._updateCacheStats(t)); + } + + _updateCacheStats (t) { + this.stats.get(Do).incrementCount(), this.stats.get(Ps).incrementCount(), this.gpuMemoryUsageInBytes += t.gpuMemoryUsageInBytes || 0, this.stats.get(Ns).count = this.gpuMemoryUsageInBytes, this.options.memoryAdjustedScreenSpaceError && this.adjustScreenSpaceError(); + } + + _unloadTile (t) { + this.gpuMemoryUsageInBytes -= t.gpuMemoryUsageInBytes || 0, this.stats.get(Ps).decrementCount(), this.stats.get(Lo).incrementCount(), this.stats.get(Ns).count = this.gpuMemoryUsageInBytes, this.options.onTileUnload(t), t.unloadContent(); + } + + // Traverse the tree and destroy all tiles + _destroy () { + const t = []; + for (this.root && t.push(this.root); t.length > 0;) { + const n = t.pop(); + for (const s of n.children) { t.push(s); } + this._destroyTile(n); + } + this.root = null; + } + + // Traverse the tree and destroy all sub tiles + _destroySubtree (t) { + const n = t; const s = []; + for (s.push(n); s.length > 0;) { + t = s.pop(); + for (const r of t.children) { s.push(r); } + t !== n && this._destroyTile(t); + } + n.children = []; + } + + _destroyTile (t) { + this._cache.unloadTile(this, t), this._unloadTile(t), t.destroy(); + } + + _initializeTiles3DTileset (t) { + if (t.queryString) { + const n = new URLSearchParams(t.queryString); const s = Object.fromEntries(n.entries()); + this._queryParams = { ...this._queryParams, ...s }; + } + if (this.asset = t.asset, !this.asset) { throw new Error('Tileset must have an asset property.'); } + if (this.asset.version !== '0.0' && this.asset.version !== '1.0' && this.asset.version !== '1.1') { throw new Error('The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.'); } + 'tilesetVersion' in this.asset && (this._queryParams.v = this.asset.tilesetVersion), this.credits = { + attributions: this.options.attributions || [] + }, this.description = this.options.description || '', this.properties = t.properties, this.geometricError = t.geometricError, this._extensionsUsed = t.extensionsUsed || [], this.extras = t.extras; + } + + _initializeI3STileset () { + this.loadOptions.i3s && 'token' in this.loadOptions.i3s && (this._queryParams.token = this.loadOptions.i3s.token); + } +} +function SB (e) { + let t = 0; + for (const s in e.attributes) { + const r = e.getAttribute(s); + t += r.count * r.itemSize * r.array.BYTES_PER_ELEMENT; + } + const n = e.getIndex(); + return t += n ? n.count * n.itemSize * n.array.BYTES_PER_ELEMENT : 0, t; +} +function Pc (e) { + const n = document.createElement('canvas'); + n.width = 64, n.height = 64; + const s = n.getContext('2d'); + s.rect(0, 0, 64, 64); + const r = s.createLinearGradient(0, 0, 64, 64); + for (let o = 0; o < e.length; o++) { + const a = e[o]; + r.addColorStop(a[0], '#' + a[1].getHexString()); + } + s.fillStyle = r, s.fill(); + const i = new Kc(n); + return i.needsUpdate = !0, i.minFilter = zc, i.wrapS = kr, i.wrapT = kr, i.repeat.set(2, 2), i; +} +function Uo (e) { + e.updateMatrix(), e.updateMatrixWorld(), e.matrixWorldInverse.copy(e.matrixWorld).invert(); + const t = new Wc(); + return t.setFromProjectionMatrix(new tt().multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse)), t; +} +function IB (e) { + const t = new En(); const n = new Xc(10, 5); const s = new rt(...e.projectPointOntoPlane([0, 0, 0])); const r = new rt(e.normal.x, e.normal.y, e.normal.z); const i = new rt().copy(s).add(r); + n.lookAt(i), n.translate(s.x, s.y, s.z); + const o = new Hs({ color: 65535, side: jo }); const a = new Js(n, o); const c = new Qc(r, s, 5, 16776960); + return t.add(c), t.add(a), t; +} +function Ho (e) { + const { boundingVolume: t } = e; + let n = 0; + e.content && (n = Math.min(e.content.byteLength / 5e5, 1)); + const s = new w(n, 1, 0); const r = new qc(1, 1, 1); const i = new tt(); + t.halfAxes ? i.copy(Gc(t.halfAxes)) : t.radius && r.scale(t.radius * 2, t.radius * 2, t.radius * 2), r.applyMatrix4(i); + const o = new Yc(r); const a = new $c(o, new Zc({ color: s })); + return a.position.copy(new rt(...t.center)), a; +} +function Gc (e) { + const t = e; + return new tt().fromArray([ + t[0] * 2, + t[1] * 2, + t[2] * 2, + 0, + t[3] * 2, + t[4] * 2, + t[5] * 2, + 0, + t[6] * 2, + t[7] * 2, + t[8] * 2, + 0, + 0, + 0, + 0, + 1 + ]); +} +function xB (e, t) { + const r = 2 * Math.PI * 6378137 / 2; const i = t * r / 180; + let o = Math.log(Math.tan((90 + e) * Math.PI / 360)) / (Math.PI / 180); + return o = o * r / 180, new ko(i, o); +} +function vB (e) { + let t = 0; + if ((e == null ? void 0 : e.userData.mimeType) == 'image/ktx2' && e.mipmaps) { + for (let n = 0; n < e.mipmaps.length; n++) { t += e.mipmaps[n].data.byteLength; } + return t; + } else if (e.image) { + const { image: n } = e; const s = 4; + const r = [n.width, n.height]; + for (; r[0] > 1 || r[1] > 1;) { t += r[0] * r[1] * s, r[0] = Math.max(Math.floor(r[0] / 2), 1), r[1] = Math.max(Math.floor(r[1] / 2), 1); } + return t += 1 * 1 * s, t; + } else {} +} +function Nc (e) { + return SB(e); +} +let ht = null; let Mt = null; let Jn = null; let Mn = null; +const Jo = { + minHeight: 0, + maxHeight: 300, + samples: 4, + sampleStep: 4, + opacity: 0.5, + blendingType: hr +}; +function OB (e, t, n, s = Jo) { + ht && ht.dispose(), Mt || (Mt = n); + const r = { ...Jo, ...s }; + ht = new tu(e.width * e.devicePixelRatio, e.height * e.devicePixelRatio), ht.texture.minFilter = Kr, ht.texture.magFilter = Kr, ht.stencilBuffer = !1, ht.texture.format = eu, ht.texture.type = nu, Mt.setPixelRatio(devicePixelRatio), Mt.setSize(e.width, e.height), Mt.setRenderTarget(ht), Jn = new su(), Jn.overrideMaterial = LB, Mn = t, kt.uniforms.tPosition.value = ht.texture, kt.uniforms.minHeight.value = r.minHeight, kt.uniforms.maxHeight.value = r.maxHeight, kt.uniforms.samples.value = r.samples, kt.uniforms.sampleStep.value = r.sampleStep, kt.uniforms.opacity.value = r.opacity, kt.blending = r.blendingType; +} +function FB (e) { + ht.setSize(e.width * e.devicePixelRatio, e.height * e.devicePixelRatio), Mt.setPixelRatio(devicePixelRatio), Mt.setSize(e.width, e.height); +} +function DB (e) { + if (Mt) { + const t = Mn.parent; + Jn.add(Mn), Mt.setRenderTarget(ht), Mt.render(Jn, e), t && t.add(Mn), Mt.setRenderTarget(null); + } +} +const Vn = (e) => e.toString(); const LB = new lr({ + vertexShader: Vn` + varying vec3 vPosition; + void main() { + vPosition = (modelMatrix * vec4(position, 1.0)).xyz; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); + } + `, + fragmentShader: Vn` + varying vec3 vPosition; + void main() { + gl_FragColor = vec4(vPosition, 1.0); + } + `, + side: jo +}); const PB = Vn` + #include + + varying vec2 vUv; + varying vec3 vColor; + uniform sampler2D tPosition; + uniform float minHeight; + uniform float maxHeight; + uniform int samples; + uniform float sampleStep; + + mat4 MVP; + + // Convert to normalized screen coordinates + vec4 toNSC(const in vec4 v) { + return vec4(0.5 * (v.xyz / v.w) + 0.5, v.w); + } + vec4 vertexDraping( + const in sampler2D positionTex, // Position G-Buffer + const in vec4 Vin // Vertex to drape + ) { + float texSize = float(textureSize(positionTex, 0).x); + float pixelSize = 1.0 / texSize; + vec2 stepSize = vec2(sampleStep/texSize); + vec4 VinWorld = modelMatrix * Vin; + + vec4 lineStart = projectionMatrix * viewMatrix * vec4(VinWorld.x, minHeight, VinWorld.z, 1.0); + vec4 lineEnd = projectionMatrix * viewMatrix * vec4(VinWorld.x, maxHeight, VinWorld.z, 1.0); + + vec4 Vout = VinWorld; + + // Binary search for line-terrain intersection + float first = 0.0, last = 1.0; + while(first <= last) { + // Compute mid-point + float mid = first + (last-first) / 2.0; + // Compute texture coordinates along line + vec4 texCoords = toNSC(mix(lineStart, lineEnd, mid)); + vec4 texSample = vec4(0.0); // Sample terrain + for(int s = -samples; s < samples; s++) { + for(int t = -samples; t < samples; t++) { + texSample += texture(positionTex, + texCoords.st + vec2(s,t) * stepSize); + } + } + // Smooth samples obtain from G-Buffer + texSample = texSample / (float(samples) * float(samples) * 4.0); + float terrainHeight = texSample.y; + Vout.y = terrainHeight; + + if((last-first) < pixelSize) { // Termination criteria + return Vout; + } + // Perform intersection test + float depthScene = toNSC(projectionMatrix * viewMatrix * Vout).y; + if(depthScene >= texCoords.y) { + first = mid; + } + else + last = mid; + } + return Vout; + } + + void main() { + vColor = color; + vUv = uv; + MVP = projectionMatrix * modelViewMatrix; + vec4 inputVertex = vec4(position, 1.0); + vec4 outputVertex = vertexDraping(tPosition, inputVertex); + vec4 finalPosition = projectionMatrix * viewMatrix * outputVertex; + gl_Position = finalPosition; + } +`; const GB = Vn` + varying vec3 vColor; + uniform float opacity; + + void main() { + gl_FragColor = vec4(vColor, opacity); + } +`; const kt = new lr({ + vertexShader: PB, + fragmentShader: GB, + uniforms: { + tPosition: { value: null }, + minHeight: { value: 0 }, + maxHeight: { value: 300 }, + opacity: { value: 0.5 }, + samples: { value: 4 }, + sampleStep: { value: 4 } + }, + vertexColors: !0, + transparent: !0, + depthTest: !1, + blending: hr +}); const Uc = { + // From chroma spectral http://gka.github.io/chroma.js/ + SPECTRAL: [ + [0, new w(0.3686, 0.3098, 0.6353)], + [0.1, new w(0.1961, 0.5333, 0.7412)], + [0.2, new w(0.4, 0.7608, 0.6471)], + [0.3, new w(0.6706, 0.8667, 0.6431)], + [0.4, new w(0.902, 0.9608, 0.5961)], + [0.5, new w(1, 1, 0.749)], + [0.6, new w(0.9961, 0.8784, 0.5451)], + [0.7, new w(0.9922, 0.6824, 0.3804)], + [0.8, new w(0.9569, 0.4275, 0.2627)], + [0.9, new w(0.8353, 0.2431, 0.3098)], + [1, new w(0.6196, 39e-4, 0.2588)] + ], + PLASMA: [ + [0, new w(0.241, 0.015, 0.61)], + [0.1, new w(0.387, 1e-3, 0.654)], + [0.2, new w(0.524, 0.025, 0.653)], + [0.3, new w(0.651, 0.125, 0.596)], + [0.4, new w(0.752, 0.227, 0.513)], + [0.5, new w(0.837, 0.329, 0.431)], + [0.6, new w(0.907, 0.435, 0.353)], + [0.7, new w(0.963, 0.554, 0.272)], + [0.8, new w(0.992, 0.681, 0.195)], + [0.9, new w(0.987, 0.822, 0.144)], + [1, new w(0.94, 0.975, 0.131)] + ], + YELLOW_GREEN: [ + [0, new w(0.1647, 0.2824, 0.3451)], + [0.1, new w(0.1338, 0.3555, 0.4227)], + [0.2, new w(0.061, 0.4319, 0.4864)], + [0.3, new w(0, 0.5099, 0.5319)], + [0.4, new w(0, 0.5881, 0.5569)], + [0.5, new w(0.137, 0.665, 0.5614)], + [0.6, new w(0.2906, 0.7395, 0.5477)], + [0.7, new w(0.4453, 0.8099, 0.5201)], + [0.8, new w(0.6102, 0.8748, 0.485)], + [0.9, new w(0.7883, 0.9323, 0.4514)], + [1, new w(0.9804, 0.9804, 0.4314)] + ], + VIRIDIS: [ + [0, new w(0.267, 5e-3, 0.329)], + [0.1, new w(0.283, 0.141, 0.458)], + [0.2, new w(0.254, 0.265, 0.53)], + [0.3, new w(0.207, 0.372, 0.553)], + [0.4, new w(0.164, 0.471, 0.558)], + [0.5, new w(0.128, 0.567, 0.551)], + [0.6, new w(0.135, 0.659, 0.518)], + [0.7, new w(0.267, 0.749, 0.441)], + [0.8, new w(0.478, 0.821, 0.318)], + [0.9, new w(0.741, 0.873, 0.15)], + [1, new w(0.993, 0.906, 0.144)] + ], + INFERNO: [ + [0, new w(0.077, 0.042, 0.206)], + [0.1, new w(0.225, 0.036, 0.388)], + [0.2, new w(0.373, 0.074, 0.432)], + [0.3, new w(0.522, 0.128, 0.42)], + [0.4, new w(0.665, 0.182, 0.37)], + [0.5, new w(0.797, 0.255, 0.287)], + [0.6, new w(0.902, 0.364, 0.184)], + [0.7, new w(0.969, 0.516, 0.063)], + [0.8, new w(0.988, 0.683, 0.072)], + [0.9, new w(0.961, 0.859, 0.298)], + [1, new w(0.988, 0.998, 0.645)] + ], + GRAYSCALE: [ + [0, new w(0, 0, 0)], + [1, new w(1, 1, 1)] + ], + // 16 samples of the TURBU color scheme + // values taken from: https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f + // original file licensed under Apache-2.0 + TURBO: [ + [0, new w(0.18995, 0.07176, 0.23217)], + [0.07, new w(0.25107, 0.25237, 0.63374)], + [0.13, new w(0.27628, 0.42118, 0.89123)], + [0.2, new w(0.25862, 0.57958, 0.99876)], + [0.27, new w(0.15844, 0.73551, 0.92305)], + [0.33, new w(0.09267, 0.86554, 0.7623)], + [0.4, new w(0.19659, 0.94901, 0.59466)], + [0.47, new w(0.42778, 0.99419, 0.38575)], + [0.53, new w(0.64362, 0.98999, 0.23356)], + [0.6, new w(0.80473, 0.92452, 0.20459)], + [0.67, new w(0.93301, 0.81236, 0.22667)], + [0.73, new w(0.99314, 0.67408, 0.20348)], + [0.8, new w(0.9836, 0.49291, 0.12849)], + [0.87, new w(0.92105, 0.31489, 0.05475)], + [0.93, new w(0.81608, 0.18462, 0.01809)], + [1, new w(0.66449, 0.08436, 424e-5)] + ], + RAINBOW: [ + [0, new w(0.278, 0, 0.714)], + [1 / 6, new w(0, 0, 1)], + [2 / 6, new w(0, 1, 1)], + [3 / 6, new w(0, 1, 0)], + [4 / 6, new w(1, 1, 0)], + [5 / 6, new w(1, 0.64, 0)], + [1, new w(1, 0, 0)] + ], + CONTOUR: [ + [0, new w(0, 0, 0)], + [0.03, new w(0, 0, 0)], + [0.04, new w(1, 1, 1)], + [1, new w(1, 1, 1)] + ] +}; const NB = ` + varying vec3 vColor; + uniform float alpha; + + void main() { + if (vColor == vec3(0.0, 0.0, 0.0)) { + discard; + } else { + gl_FragColor = vec4( vColor, alpha); + } + } +`; const UB = ` + varying vec3 vColor; + uniform sampler2D gradient; + uniform sampler2D grayscale; + attribute float intensity; + attribute float classification; + uniform vec3 rootCenter; + uniform vec3 rootNormal; + uniform vec2 elevationRange; + uniform int coloring; + uniform bool hideGround; + uniform float maxIntensity; + uniform float intensityContrast; + uniform float pointSize; + + #ifdef USE_COLOR + vec3 getRGB() { + vec3 rgb = color; + return rgb; + } + #endif + + vec3 getElevation(){ + vec4 world = modelMatrix * vec4( position, 1.0 ); + float diff = abs(dot(rootNormal, (vec3(world) - rootCenter))); + float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0); + vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb; + + return cElevation; + } + + vec3 getIntensity(){ + // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs + float intmod = pow(intensity, intensityContrast); + vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb; + return cIntensity; + } + + vec3 getClassification(){ + float classNormalized = classification / 255.0; + vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb; + return cClassification; + } + + vec3 getColor(){ + vec3 color; + if (hideGround && classification == 2.0) { + return vec3(0.0, 0.0, 0.0); + } + + if (coloring == 1) { + color = getIntensity(); + } + else if (coloring == 2) { + color = getClassification(); + } else if (coloring == 3) { + color = getElevation(); + } + #ifdef USE_COLOR + else if (coloring == 4) { + color = getRGB(); + } + #endif + else { + color = vec3(1.0, 1.0, 1.0); + } + return color; + } + + void main() { + vColor = getColor(); + + gl_PointSize = pointSize; + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } +`; +var Hc = /* @__PURE__ */ ((e) => (e[e.Intensity = 1] = 'Intensity', e[e.Classification = 2] = 'Classification', e[e.Elevation = 3] = 'Elevation', e[e.RGB = 4] = 'RGB', e[e.White = 5] = 'White', e))(Hc || {}); var jn = /* @__PURE__ */ ((e) => (e[e.FlatTexture = 1] = 'FlatTexture', e[e.ShadedTexture = 2] = 'ShadedTexture', e[e.ShadedNoTexture = 3] = 'ShadedNoTexture', e))(jn || {}); +const HB = Uc.RAINBOW; const JB = typeof document < 'u' ? Pc(HB) : null; const VB = Uc.GRAYSCALE; const jB = typeof document < 'u' ? Pc(VB) : null; const kB = { + throttleRequests: !0, + maxRequests: 64, + updateInterval: 0.1, + maxConcurrency: 1, + maximumScreenSpaceError: 16, + memoryAdjustedScreenSpaceError: !0, + maximumMemoryUsage: 400, + memoryCacheOverflow: 128, + viewDistanceScale: 1, + skipLevelOfDetail: !1, + resetTransform: !1, + updateTransforms: !0, + shading: jn.FlatTexture, + transparent: !1, + pointCloudColoring: Hc.White, + pointSize: 1, + worker: !0, + wireframe: !1, + debug: !1, + gltfLoader: null, + basisTranscoderPath: null, + dracoDecoderPath: null, + material: null, + contentPostProcess: void 0, + preloadTilesCount: null, + collectAttributions: !1 +}; +class t1 { + /** + * Loads a tileset of 3D Tiles according to the given {@link LoaderProps} + * @public + * + * @param props - Properties for this load call {@link LoaderProps}. + * @returns An object containing the 3D Model to be added to the scene + * and a runtime engine to be updated every frame. + */ + static async load (t) { + const n = { ...kB, ...t.options }; const { url: s } = t; + let { viewport: r, renderer: i } = t; + const o = n.updateInterval; const a = 5; const c = {}; + if (n.cesiumIONToken) { + c['cesium-ion'] = { + accessToken: n.cesiumIONToken + }; + const T = await bc.preload(s, c); + c.fetch = { headers: T.headers }; + } + n.googleApiKey && (c.fetch = { headers: { 'X-GOOG-API-KEY': n.googleApiKey } }, t.options.hasOwnProperty('collectAttributions') || (n.collectAttributions = !0)), t.loadingManager && t.loadingManager.itemStart(s); + const u = await Ae(s, Le, { + ...c + }); const l = {}; const h = {}; const f = []; const d = new En(); const m = new En(); + n.debug || (m.visible = !1); + const g = { + pointSize: { type: 'f', value: n.pointSize }, + gradient: { type: 't', value: JB }, + grayscale: { type: 't', value: jB }, + rootCenter: { type: 'vec3', value: new rt() }, + rootNormal: { type: 'vec3', value: new rt() }, + coloring: { type: 'i', value: n.pointCloudColoring }, + hideGround: { type: 'b', value: !0 }, + elevationRange: { type: 'vec2', value: new ko(0, 400) }, + maxIntensity: { type: 'f', value: 1 }, + intensityContrast: { type: 'f', value: 1 }, + alpha: { type: 'f', value: 1 } + }; const y = new lr({ + uniforms: g, + vertexShader: UB, + fragmentShader: NB, + transparent: n.transparent, + vertexColors: !0 + }); + let E, R, B; + n.gltfLoader ? E = n.gltfLoader : (E = new cu(), n.basisTranscoderPath && (R = new lu(), R.detectSupport(i ?? new ru()), R.setTranscoderPath(n.basisTranscoderPath + '/'), R.setWorkerLimit(1), E.setKTX2Loader(R)), n.dracoDecoderPath && (B = new uu(), B.setDecoderPath(n.dracoDecoderPath + '/'), B.setWorkerLimit(n.maxConcurrency), E.setDRACOLoader(B))); + const C = new Hs({ transparent: n.transparent }); const M = { + maximumMemoryUsage: n.maximumMemoryUsage, + maximumScreenSpaceError: n.maximumScreenSpaceError, + memoryAdjustedScreenSpaceError: n.memoryAdjustedScreenSpaceError, + memoryCacheOverflow: n.memoryCacheOverflow, + viewDistanceScale: n.viewDistanceScale, + skipLevelOfDetail: n.skipLevelOfDetail, + updateTransforms: n.updateTransforms, + throttleRequests: n.throttleRequests, + maxRequests: n.maxRequests, + contentLoader: async (T) => { + let D = null; + switch (T.type) { + case Pe.POINTCLOUD: { + D = zB(T, y, n, Pt); + break; + } + case Pe.SCENEGRAPH: + case Pe.MESH: { + D = await KB(E, T, C, n, Pt); + break; + } + } + if (D && (D.visible = !1, l[T.id] = D, d.add(l[T.id]), n.debug)) { + const Z = Ho(T); + m.add(Z), h[T.id] = Z; + } + }, + onTileLoad: async (T) => { + b && (n.resetTransform && !L && (T == null ? void 0 : T.depth) <= a && Xt(T), Wt = !0); + }, + onTileUnload: (T) => { + f.push(T); + }, + onTileError: (T, D) => { + console.warn('Tile error', T.id, D); + }, + onTraversalComplete (T) { + return n.collectAttributions && (k = XB(T)), T; + } + }; const b = new MB(u, { + ...M, + loadOptions: { + ...c, + maxConcurrency: n.maxConcurrency, + worker: n.worker, + gltf: { + loadImages: !1 + }, + '3d-tiles': { + loadGLTF: !1 + } + } + }); const O = new tt(); const F = new tt(); const v = new rt(); + let L = !1; let k = ''; + if (b.root.boundingVolume + ? (b.root.header.boundingVolume.region && console.warn('Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates.'), F.setPosition( + b.root.boundingVolume.center[0], + b.root.boundingVolume.center[1], + b.root.boundingVolume.center[2] + )) + : console.warn('Bounding volume not found, no transformations applied'), n.debug) { + const T = Ho(b.root); + m.add(T), h[b.root.id] = T; + } + let q = !1; let Y = !1; + g.rootCenter.value.copy(v), g.rootNormal.value.copy(new rt(0, 0, 1).normalize()), b.stats.get('Loader concurrency').count = n.maxConcurrency, b.stats.get('Maximum mem usage').count = n.maximumMemoryUsage; + let P = 0; let ct = null; let Wt = !0; let oe = null; + const Be = new rt(1 / 0, 1 / 0, 1 / 0); + let vt = null; + d.updateMatrixWorld(!0); + const st = new tt().copy(d.matrixWorld); const Pt = new tt().copy(st).invert(); + n.resetTransform && Xt(b.root), n.debug && (h[b.root.id].applyMatrix4(O), m.matrixWorld.copy(d.matrixWorld)); + function Xt (T) { + if (!T.boundingVolume.halfAxes) { return; } + const D = T.boundingVolume.halfAxes; const Z = new tt().extractRotation(Gc(D)).premultiply(new tt().extractRotation(Pt)); + if (!new rs().setFromRotationMatrix(Z).equals(new rs())) { + L = !0; + const _t = new rt( + F.elements[12], + F.elements[13], + F.elements[14] + ); + F.extractRotation(Z), F.setPosition(_t); + } + Ce(); + } + function Ce () { + O.copy(st), n.resetTransform && O.multiply(new tt().copy(F).invert()), b.modelMatrix = new V(O.toArray()); + } + function $e (T, D, Z, Q) { + if (q || !Q) { return; } + if (!vt) { + if (Q instanceof Wo) { + vt = new Dn({ + fov: Q.fov / 180 * Math.PI, + aspectRatio: Q.aspect, + near: Q.near, + far: Q.far + }).sseDenominator; + } else if (Q instanceof iu) { + const K = Q.right - Q.left; const jr = Q.top - Q.bottom; const Vc = K / jr; + vt = Math.max(jr / Z.height, K / (Z.height * Vc)); + } + n.debug && console.log('Updated sse denonimator:', vt); + } + const ns = Uo(Q).planes.map((K) => new nt(K.normal.toArray(), K.constant)); const Jc = new dt(ns); const Jr = { + camera: { + position: Be.toArray() + }, + height: Z.height * Z.devicePixelRatio, + frameNumber: T._frameNumber, + sseDenominator: vt, + cullingVolume: Jc, + viewport: { + id: 0 + } + }; + T._cache.reset(), T._traverser.traverse(T.root, Jr, T.options); + for (const K of T.tiles) { K.selected ? D[K.id] ? D[K.id].visible = !0 : console.error('TILE SELECTED BUT NOT LOADED!!', K.id) : D[K.id] && (D[K.id].visible = !1); } + for (; f.length > 0;) { + const K = f.pop(); + D[K.id] && K.contentState == lt.UNLOADED && (d.remove(D[K.id]), Us(D[K.id]), delete D[K.id]), h[K.id] && (Us(h[K.id]), m.remove(h[K.id]), delete h[K.id]); + } + const ss = T.stats.get('Tiles Loaded').count; const Vr = T.stats.get('Tiles Loading').count; + return t.onProgress && t.onProgress( + ss, + ss + Vr + ), t.loadingManager && !Y && Vr == 0 && (n.preloadTilesCount == null || ss >= n.preloadTilesCount) && (Y = !0, t.loadingManager.itemEnd(t.url)), Jr; + } + function es (T) { + const D = new rt(); const Z = new ou(); const Q = new rt(); + T.decompose(D, Z, Q), d.position.copy(D), d.quaternion.copy(Z), d.scale.copy(Q), d.updateMatrix(), d.updateMatrixWorld(!0), st.copy(d.matrixWorld), Pt.copy(st).invert(), Ce(); + } + return { + model: d, + runtime: { + getTileset: () => b, + getStats: () => b.stats, + getDataAttributions: () => k, + showTiles: (T) => { + m.visible = T; + }, + setWireframe: (T) => { + n.wireframe = T, d.traverse((D) => { + D instanceof Js && (D.material.wireframe = T); + }); + }, + setDebug: (T) => { + n.debug = T, m.visible = T; + }, + setShading: (T) => { + n.shading = T; + }, + getTileBoxes: () => m, + setViewDistanceScale: (T) => { + b.options.viewDistanceScale = T, b._frameNumber++, $e(b, l, r, oe); + }, + setMaximumScreenSpaceError: (T) => { + b.options.maximumScreenSpaceError = T, b._frameNumber++, $e(b, l, r, oe); + }, + setHideGround: (T) => { + g.hideGround.value = T; + }, + setPointCloudColoring: (T) => { + g.coloring.value = T; + }, + setElevationRange: (T) => { + g.elevationRange.value.set(T[0], T[1]); + }, + setMaxIntensity: (T) => { + g.maxIntensity.value = T; + }, + setIntensityContrast: (T) => { + g.intensityContrast.value = T; + }, + setPointAlpha: (T) => { + g.alpha.value = T; + }, + getLatLongHeightFromPosition: (T) => { + const D = b.ellipsoid.cartesianToCartographic( + new rt().copy(T).applyMatrix4(new tt().copy(O).invert()).toArray() + ); + return { + lat: D[1], + long: D[0], + height: D[2] + }; + }, + getPositionFromLatLongHeight: (T) => { + const D = b.ellipsoid.cartographicToCartesian([ + T.long, + T.lat, + T.height + ]); + return new rt(...D).applyMatrix4(O); + }, + orientToGeocoord: (T) => { + const D = [T.long, T.lat, T.height]; const Z = b.ellipsoid.cartographicToCartesian(D); const Q = new tt().fromArray(b.ellipsoid.eastNorthUpToFixedFrame(Z)); const _t = new tt().makeRotationFromEuler( + new rs(Math.PI / 2, Math.PI / 2, 0) + ); const ns = new tt().copy(Q).multiply(_t).invert(); + es(ns); + }, + getWebMercatorCoord: (T) => xB(T.lat, T.long), + getCameraFrustum: (T) => { + const Z = Uo(T).planes.map((_t) => new nt(_t.normal.toArray(), _t.constant)).map((_t) => IB(_t)); const Q = new En(); + for (const _t of Z) { Q.add(_t); } + return Q; + }, + overlayGeoJSON: (T, D) => { + if (T.applyMatrix4(O), T.updateMatrixWorld(), !i) { throw new Error('GeoJSON draping requires a renderer reference via LoaderProps'); } + return OB(r, d, i, D), T.material.dispose(), T.material = kt, T; + }, + setViewport: (T) => { + r = T, vt = null, Wt = !0, ht && FB(r); + }, + setRenderer: (T) => { + i = T; + }, + update: function (T, D) { + if (oe = D, P += T, ht && DB(D), b && P >= o) { + if (!st.equals(d.matrixWorld)) { + P = 0, st.copy(d.matrixWorld), n.updateTransforms && Ce(); + const Z = new rt().setFromMatrixPosition(st); + g.rootCenter.value.copy(Z), g.rootNormal.value.copy(new rt(0, 0, 1).applyMatrix4(st).normalize()), Pt.copy(st).invert(), n.debug && (h[b.root.id].matrixWorld.copy(O), h[b.root.id].applyMatrix4(st)); + } + ct == null ? ct = new tt().copy(D.matrixWorld) : (Wt || WB(D, ct)) && (P = 0, Wt = !1, b._frameNumber++, D.getWorldPosition(Be), ct.copy(D.matrixWorld), $e(b, l, r, D)); + } + }, + dispose: function () { + for (q = !0, b._destroy(); d.children.length > 0;) { + const T = d.children[0]; + Us(T), d.remove(T); + } + for (; m.children.length > 0;) { + const T = m.children[0]; + m.remove(T), T.geometry.dispose(), T.material.dispose(); + } + R && R.dispose(), B && B.dispose(); + } + } + }; + } + + /** + * Loads a tileset of 3D Tiles according to the given {@link GeoJSONLoaderProps} + * Could be overlayed on geograpical 3D Tiles using {@link Runtime.overlayGeoJSON} + * @public + * + * @param props - Properties for this load call {@link GeoJSONLoaderProps}. + * @returns An object containing the 3D Model to be added to the scene + */ + static async loadGeoJSON (t) { + const { url: n, height: s, featureToColor: r } = t; + return Ae(n, ke, { worker: !1, gis: { format: 'binary' } }).then((i) => { + const o = i; const a = new Ko(); const c = o.polygons.positions.value.reduce((h, f, d, m) => { + if (d % 2 == 0) { + const g = [f, m[d + 1], s ?? 0]; const y = J.WGS84.cartographicToCartesian(g); + h.push(...y); + } + return h; + }, []); + if (a.setAttribute('position', new Sn( + c, + 3 + )), r) { + const h = o.polygons.numericProps[r.feature].value.reduce((f, d, m, g) => { + const y = r.colorMap(d); + return f[m * 3] = y.r, f[m * 3 + 1] = y.g, f[m * 3 + 2] = y.b, f; + }, []); + a.setAttribute('color', new Sn( + h, + 3 + )); + } + a.setIndex( + new zo(o.polygons.triangles.value, 1) + ); + const u = new Hs({ + transparent: !0, + vertexColors: !0, + opacity: 0.5, + blending: hr + }); + return new Js(a, u); + }); + } +} +async function KB (e, t, n, s, r) { + return new Promise((i, o) => { + const a = new tt().makeRotationAxis(new rt(1, 0, 0), Math.PI / 2); const c = t.content.gltfUpAxis !== 'Z'; const u = new tt().fromArray(t.computedTransform).premultiply(r); + c && u.multiply(a), t.content.byteLength || (t.content.byteLength = t.content.gltfArrayBuffer.byteLength), e.parse( + t.content.gltfArrayBuffer, + t.contentUrl ? t.contentUrl.substr(0, t.contentUrl.lastIndexOf('/') + 1) : null, + (l) => { + t.userData.asset = l.asset; + const h = l.scenes[0]; + h.applyMatrix4(u), t.content.texturesByteLength = 0, t.content.geometriesByteLength = 0, h.traverse((f) => { + if (f.type == 'Mesh') { + const d = f; + t.content.geometriesByteLength += Nc(d.geometry); + const m = d.material; const g = m.map; + if (g) { + const y = vB(g); + y && (t.content.texturesByteLength += y); + } + s.material ? (d.material = s.material.clone(), m.dispose()) : s.shading == jn.FlatTexture && d.material.type !== 'MeshBasicMaterial' && (d.material = n.clone(), m.dispose()), s.shading != jn.ShadedNoTexture ? d.material.type == 'ShaderMaterial' ? d.material.uniforms.map = { value: g } : d.material.map = g : (g && g.dispose(), d.material.map = null), d.material.wireframe = s.wireframe, s.contentPostProcess && s.contentPostProcess(d); + } + }), t.content.gpuMemoryUsageInBytes = t.content.texturesByteLength + t.content.geometriesByteLength, i(h); + }, + (l) => { + o(new Error(`error parsing gltf in tile ${t.id}: ${l}`)); + } + ); + }); +} +function zB (e, t, n, s) { + const r = { + rtc_center: e.content.rtcCenter, + // eslint-disable-line camelcase + points: e.content.attributes.positions, + intensities: e.content.attributes.intensity, + classifications: e.content.attributes.classification, + rgb: null, + rgba: null + }; const { colors: i } = e.content.attributes; + i && i.size === 3 && (r.rgb = i.value), i && i.size === 4 && (r.rgba = i.value); + const o = new Ko(); + o.setAttribute('position', new Sn(r.points, 3)); + const a = new tt().fromArray(e.computedTransform).premultiply(s); + r.rgba ? o.setAttribute('color', new Sn(r.rgba, 4)) : r.rgb && o.setAttribute('color', new zr(r.rgb, 3, !0)), r.intensities && o.setAttribute( + 'intensity', + // Handles both 16bit or 8bit intensity values + new zo(r.intensities, 1, !0) + ), r.classifications && o.setAttribute('classification', new zr(r.classifications, 1, !1)), e.content.geometriesByteLength = Nc(o), e.content.gpuMemoryUsageInBytes = e.content.geometriesByteLength; + const c = new au(o, n.material || t); + if (r.rtc_center) { + const u = r.rtc_center; + a.multiply(new tt().makeTranslation(u[0], u[1], u[2])); + } + return c.applyMatrix4(a), n.contentPostProcess && n.contentPostProcess(c), c; +} +function Vo (e) { + let t, n, s, r; + (t = e == null ? void 0 : e.uniforms) != null && t.map ? (s = (n = e == null ? void 0 : e.uniforms) == null ? void 0 : n.map.value) == null || s.dispose() : e.map && ((r = e.map) == null || r.dispose()), e.dispose(); +} +function Us (e) { + e.traverse((t) => { + if (t.isMesh) { + if (t.geometry.dispose(), t.material.isMaterial) { Vo(t.material); } else { + for (const n of t.material) { Vo(n); } + } + } + }); + for (let t = e.children.length - 1; t >= 0; t--) { + const n = e.children[t]; + e.remove(n); + } +} +function WB (e, t, n) { + const s = !e.matrixWorld.equals(t); + return e instanceof Wo ? s || e.aspect !== n : s; +} +function XB (e) { + const t = /* @__PURE__ */ new Map(); + return e.forEach((r) => { + let o, a; + const i = (a = (o = r == null ? void 0 : r.userData) == null ? void 0 : o.asset) == null ? void 0 : a.copyright; + i && i.split(/;/g).map((u) => u.trim()).forEach((u) => { + u && t.set(u, (t.get(u) || 0) + 1); + }); + }), Array.from(t).sort((r, i) => i[1] - r[1]).map(([r]) => r).join('; '); +} +export { + t1 as Loader3DTiles, + Hc as PointCloudColoring, + jn as Shading +}; diff --git a/package-lock.json b/package-lock.json index 7275188a..61351331 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,6 @@ "snazzy": "^5.0.0", "superagent": "^3.8.2", "three": "^0.160.1", - "three-loader-3dtiles": "^1.2.6", "webpack": "^5.64.1", "webpack-cli": "^4.7.0", "webpack-dev-server": "^4.5.0" @@ -10557,7 +10556,8 @@ "node_modules/three": { "version": "0.160.1", "resolved": "https://registry.npmjs.org/three/-/three-0.160.1.tgz", - "integrity": "sha512-Bgl2wPJypDOZ1stAxwfWAcJ0WQf7QzlptsxkjYiURPz+n5k4RBDLsq+6f9Y75TYxn6aHLcWz+JNmwTOXWrQTBQ==" + "integrity": "sha512-Bgl2wPJypDOZ1stAxwfWAcJ0WQf7QzlptsxkjYiURPz+n5k4RBDLsq+6f9Y75TYxn6aHLcWz+JNmwTOXWrQTBQ==", + "dev": true }, "node_modules/three-bmfont-text": { "version": "3.0.0", @@ -10571,14 +10571,6 @@ "quad-indices": "^2.0.1" } }, - "node_modules/three-loader-3dtiles": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/three-loader-3dtiles/-/three-loader-3dtiles-1.2.6.tgz", - "integrity": "sha512-jCfoZuuPyFdoQw+8BWKbqaxzuufFzcErDKnFvPAqWll3zkChkBxm43sweggkKuA4nO9EqqLo9QXPc34qnXKRuQ==", - "peerDependencies": { - "three": "^0.160.0" - } - }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -19267,7 +19259,8 @@ "three": { "version": "0.160.1", "resolved": "https://registry.npmjs.org/three/-/three-0.160.1.tgz", - "integrity": "sha512-Bgl2wPJypDOZ1stAxwfWAcJ0WQf7QzlptsxkjYiURPz+n5k4RBDLsq+6f9Y75TYxn6aHLcWz+JNmwTOXWrQTBQ==" + "integrity": "sha512-Bgl2wPJypDOZ1stAxwfWAcJ0WQf7QzlptsxkjYiURPz+n5k4RBDLsq+6f9Y75TYxn6aHLcWz+JNmwTOXWrQTBQ==", + "dev": true }, "three-bmfont-text": { "version": "git+ssh://git@github.com/dmarcos/three-bmfont-text.git#eed4878795be9b3e38cf6aec6b903f56acd1f695", @@ -19280,12 +19273,6 @@ "quad-indices": "^2.0.1" } }, - "three-loader-3dtiles": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/three-loader-3dtiles/-/three-loader-3dtiles-1.2.6.tgz", - "integrity": "sha512-jCfoZuuPyFdoQw+8BWKbqaxzuufFzcErDKnFvPAqWll3zkChkBxm43sweggkKuA4nO9EqqLo9QXPc34qnXKRuQ==", - "requires": {} - }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", diff --git a/package.json b/package.json index e3121918..cba66e41 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,6 @@ "snazzy": "^5.0.0", "superagent": "^3.8.2", "three": "^0.160.1", - "three-loader-3dtiles": "^1.2.6", "webpack": "^5.64.1", "webpack-cli": "^4.7.0", "webpack-dev-server": "^4.5.0"