@loaders.gl/tiles 3.1.0-alpha.4 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{esm/bundle.js → bundle.js} +0 -0
- package/dist/bundle.js.map +1 -0
- package/dist/{esm/constants.js → constants.js} +0 -0
- package/dist/constants.js.map +1 -0
- package/dist/{esm/index.js → index.js} +0 -0
- package/dist/index.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/3d-tiles-options.js +0 -0
- package/dist/tileset/helpers/3d-tiles-options.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/bounding-volume.js +0 -0
- package/dist/tileset/helpers/bounding-volume.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/frame-state.js +0 -0
- package/dist/tileset/helpers/frame-state.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/i3s-lod.js +0 -0
- package/dist/tileset/helpers/i3s-lod.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/tiles-3d-lod.js +0 -0
- package/dist/tileset/helpers/tiles-3d-lod.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/transform-utils.js +4 -1
- package/dist/tileset/helpers/transform-utils.js.map +1 -0
- package/dist/{esm/tileset → tileset}/helpers/zoom.js +0 -0
- package/dist/tileset/helpers/zoom.js.map +1 -0
- package/dist/{esm/tileset → tileset}/tile-3d.js +1 -1
- package/dist/tileset/tile-3d.js.map +1 -0
- package/dist/{esm/tileset → tileset}/tileset-3d.js +5 -5
- package/dist/tileset/tileset-3d.js.map +1 -0
- package/dist/{esm/tileset → tileset}/tileset-cache.js +0 -0
- package/dist/tileset/tileset-cache.js.map +1 -0
- package/dist/{esm/tileset → tileset}/traversers/i3s-tile-manager.js +0 -0
- package/dist/tileset/traversers/i3s-tile-manager.js.map +1 -0
- package/dist/{esm/tileset → tileset}/traversers/i3s-tileset-traverser.js +2 -2
- package/dist/tileset/traversers/i3s-tileset-traverser.js.map +1 -0
- package/dist/{esm/tileset → tileset}/traversers/tileset-3d-traverser.js +0 -0
- package/dist/tileset/traversers/tileset-3d-traverser.js.map +1 -0
- package/dist/{esm/tileset → tileset}/traversers/tileset-traverser.js +0 -0
- package/dist/tileset/traversers/tileset-traverser.js.map +1 -0
- package/dist/{esm/utils → utils}/doubly-linked-list-node.js +0 -0
- package/dist/utils/doubly-linked-list-node.js.map +1 -0
- package/dist/{esm/utils → utils}/doubly-linked-list.js +0 -0
- package/dist/{es5/utils → utils}/doubly-linked-list.js.map +1 -1
- package/dist/{esm/utils → utils}/managed-array.js +0 -0
- package/dist/utils/managed-array.js.map +1 -0
- package/package.json +10 -8
- package/src/tileset/helpers/transform-utils.ts +3 -1
- package/dist/dist.min.js +0 -2
- package/dist/dist.min.js.map +0 -1
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/constants.js +0 -44
- package/dist/es5/constants.js.map +0 -1
- package/dist/es5/index.js +0 -96
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/tileset/helpers/3d-tiles-options.js +0 -13
- package/dist/es5/tileset/helpers/3d-tiles-options.js.map +0 -1
- package/dist/es5/tileset/helpers/bounding-volume.js +0 -114
- package/dist/es5/tileset/helpers/bounding-volume.js.map +0 -1
- package/dist/es5/tileset/helpers/frame-state.js +0 -65
- package/dist/es5/tileset/helpers/frame-state.js.map +0 -1
- package/dist/es5/tileset/helpers/i3s-lod.js +0 -133
- package/dist/es5/tileset/helpers/i3s-lod.js.map +0 -1
- package/dist/es5/tileset/helpers/tiles-3d-lod.js +0 -119
- package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/es5/tileset/helpers/transform-utils.js +0 -62
- package/dist/es5/tileset/helpers/transform-utils.js.map +0 -1
- package/dist/es5/tileset/helpers/zoom.js +0 -43
- package/dist/es5/tileset/helpers/zoom.js.map +0 -1
- package/dist/es5/tileset/tile-3d.js +0 -603
- package/dist/es5/tileset/tile-3d.js.map +0 -1
- package/dist/es5/tileset/tileset-3d.js +0 -838
- package/dist/es5/tileset/tileset-3d.js.map +0 -1
- package/dist/es5/tileset/tileset-cache.js +0 -101
- package/dist/es5/tileset/tileset-cache.js.map +0 -1
- package/dist/es5/tileset/traversers/i3s-tile-manager.js +0 -69
- package/dist/es5/tileset/traversers/i3s-tile-manager.js.map +0 -1
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js +0 -185
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js +0 -94
- package/dist/es5/tileset/traversers/tileset-3d-traverser.js.map +0 -1
- package/dist/es5/tileset/traversers/tileset-traverser.js +0 -377
- package/dist/es5/tileset/traversers/tileset-traverser.js.map +0 -1
- package/dist/es5/utils/doubly-linked-list-node.js +0 -20
- package/dist/es5/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/es5/utils/doubly-linked-list.js +0 -102
- package/dist/es5/utils/managed-array.js +0 -143
- package/dist/es5/utils/managed-array.js.map +0 -1
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/tileset/helpers/3d-tiles-options.js.map +0 -1
- package/dist/esm/tileset/helpers/bounding-volume.js.map +0 -1
- package/dist/esm/tileset/helpers/frame-state.js.map +0 -1
- package/dist/esm/tileset/helpers/i3s-lod.js.map +0 -1
- package/dist/esm/tileset/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/esm/tileset/helpers/transform-utils.js.map +0 -1
- package/dist/esm/tileset/helpers/zoom.js.map +0 -1
- package/dist/esm/tileset/tile-3d.js.map +0 -1
- package/dist/esm/tileset/tileset-3d.js.map +0 -1
- package/dist/esm/tileset/tileset-cache.js.map +0 -1
- package/dist/esm/tileset/traversers/i3s-tile-manager.js.map +0 -1
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
- package/dist/esm/tileset/traversers/tileset-3d-traverser.js.map +0 -1
- package/dist/esm/tileset/traversers/tileset-traverser.js.map +0 -1
- package/dist/esm/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/esm/utils/doubly-linked-list.js.map +0 -1
- package/dist/esm/utils/managed-array.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/tileset/traversers/tileset-traverser.ts"],"names":["ManagedArray","TILE_REFINEMENT","DEFAULT_PROPS","loadSiblings","skipLevelOfDetail","maximumScreenSpaceError","updateTransforms","onTraversalEnd","viewportTraversersMap","basePath","TilesetTraverser","constructor","options","_traversalStack","_emptyTraversalStack","_frameNumber","root","selectedTiles","requestedTiles","emptyTiles","traverse","frameState","reset","updateTile","frameNumber","executeTraversal","stack","_selectionDepth","push","length","tile","pop","shouldRefine","canTraverse","updateChildTiles","updateAndPushChildren","hasRenderContent","parent","parentRefines","Boolean","_shouldRefine","stoppedRefining","id","loadTile","selectTile","refine","ADD","REPLACE","touchTile","children","child","depth","sort","compareDistanceToCamera","bind","checkRefines","hasVisibleChild","refines","isVisibleAndInRequestVolume","find","delete","childRefines","_inRequestVolume","executeEmptyTraversal","contentAvailable","updateTileVisibility","shouldSelectTile","_selectedFrame","shouldLoadTile","_requestedFrame","_priority","_getPriority","tileset","_cache","touch","_touchedFrame","useParentMetric","ignoreVisibility","hasChildren","hasTilesetContent","contentExpired","hasUnloadedContent","screenSpaceError","_screenSpaceError","getScreenSpaceError","viewportIds","key","value","viewport","updateVisibility","b","a","_distanceToCamera","anyChildrenVisible","anyVisible","allDescendantsLoaded"],"mappings":";AAAA,OAAOA,YAAP,MAAyB,2BAAzB;AACA,SAAQC,eAAR,QAA8B,iBAA9B;AAqBA,OAAO,MAAMC,aAAoB,GAAG;AAClCC,EAAAA,YAAY,EAAE,KADoB;AAElCC,EAAAA,iBAAiB,EAAE,KAFe;AAGlCC,EAAAA,uBAAuB,EAAE,CAHS;AAIlCC,EAAAA,gBAAgB,EAAE,IAJgB;AAKlCC,EAAAA,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C;AACD;;AACD,WAAOoC,UAAP;AACD;;AAID/B,EAAAA,qBAAqB,CAAC/C,IAAD,EAAOK,UAAP,EAAmB;AACtC,QAAI0E,oBAAoB,GAAG,IAA3B;AACA,UAAMrE,KAAK,GAAG,KAAKZ,oBAAnB;AAEAY,IAAAA,KAAK,CAACE,IAAN,CAAWZ,IAAX;;AAEA,WAAOU,KAAK,CAACG,MAAN,GAAe,CAAf,IAAoBkE,oBAA3B,EAAiD;AAC/C,YAAMjE,IAAI,GAAGJ,KAAK,CAACK,GAAN,EAAb;AAEA,WAAKR,UAAL,CAAgBO,IAAhB,EAAsBT,UAAtB;;AAEA,UAAI,CAACS,IAAI,CAAC4B,2BAAV,EAAuC;AAErC,aAAKf,QAAL,CAAcb,IAAd,EAAoBT,UAApB;AACD;;AAED,WAAK2B,SAAL,CAAelB,IAAf,EAAqBT,UAArB;AAGA,YAAMD,QAAQ,GAAG,CAACU,IAAI,CAACM,gBAAN,IAA0B,KAAKH,WAAL,CAAiBH,IAAjB,EAAuBT,UAAvB,EAAmC,KAAnC,EAA0C,IAA1C,CAA3C;;AAEA,UAAID,QAAJ,EAAc;AACZ,cAAM6B,QAAQ,GAAGnB,IAAI,CAACmB,QAAtB;;AACA,aAAK,MAAMC,KAAX,IAAoBD,QAApB,EAA8B;AAE5B,cAAIvB,KAAK,CAACiC,IAAN,CAAWT,KAAX,CAAJ,EAAuB;AACrBxB,YAAAA,KAAK,CAACkC,MAAN,CAAaV,KAAb;AACD;;AACDxB,UAAAA,KAAK,CAACE,IAAN,CAAWsB,KAAX;AACD;AACF,OATD,MASO,IAAI,CAACpB,IAAI,CAACkC,gBAAV,EAA4B;AACjC+B,QAAAA,oBAAoB,GAAG,KAAvB;AACD;AACF;;AAED,WAAOA,oBAAP;AACD;;AA7UmC","sourcesContent":["import ManagedArray from '../../utils/managed-array';\nimport {TILE_REFINEMENT} from '../../constants';\n\nexport type TilesetTraverserProps = {\n loadSiblings?: boolean;\n skipLevelOfDetail?: boolean;\n maximumScreenSpaceError?: number;\n onTraversalEnd?: (frameState) => any;\n viewportTraversersMap?: {[key: string]: any};\n basePath?: string;\n};\n\nexport type Props = {\n loadSiblings: boolean;\n skipLevelOfDetail: boolean;\n updateTransforms: boolean;\n maximumScreenSpaceError: number;\n onTraversalEnd: (frameState) => any;\n viewportTraversersMap: {[key: string]: any};\n basePath: string;\n};\n\nexport const DEFAULT_PROPS: Props = {\n loadSiblings: false,\n skipLevelOfDetail: false,\n maximumScreenSpaceError: 2,\n updateTransforms: true,\n onTraversalEnd: () => {},\n viewportTraversersMap: {},\n basePath: ''\n};\n\nexport default class TilesetTraverser {\n options: Props;\n\n root: any;\n requestedTiles: object;\n selectedTiles: object;\n emptyTiles: object;\n\n protected _traversalStack: ManagedArray;\n protected _emptyTraversalStack: ManagedArray;\n protected _frameNumber: number | null;\n\n // TODO nested props\n constructor(options: TilesetTraverserProps) {\n this.options = {...DEFAULT_PROPS, ...options};\n // TRAVERSAL\n // temporary storage to hold the traversed tiles during a traversal\n this._traversalStack = new ManagedArray();\n this._emptyTraversalStack = new ManagedArray();\n\n // set in every traverse cycle\n this._frameNumber = null;\n\n // fulfill in traverse call\n this.root = null;\n\n // RESULT\n // tiles should be rendered\n this.selectedTiles = {};\n // tiles should be loaded from server\n this.requestedTiles = {};\n // tiles does not have render content\n this.emptyTiles = {};\n }\n\n // tiles should be visible\n traverse(root, frameState, options) {\n this.root = root; // for root screen space error\n this.options = {...this.options, ...options};\n\n // reset result\n this.reset();\n\n // update tile (visibility and expiration)\n this.updateTile(root, frameState);\n\n this._frameNumber = frameState.frameNumber;\n this.executeTraversal(root, frameState);\n }\n\n reset() {\n this.requestedTiles = {};\n this.selectedTiles = {};\n this.emptyTiles = {};\n this._traversalStack.reset();\n 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 /* eslint-disable-next-line complexity, max-statements */\n executeTraversal(root, frameState) {\n // stack to store traversed tiles, only visible tiles should be added to stack\n // visible: visible in the current view frustum\n const stack = this._traversalStack;\n root._selectionDepth = 1;\n\n stack.push(root);\n while (stack.length > 0) {\n // 1. pop tile\n const tile = stack.pop();\n\n // 2. check if tile needs to be refine, needs refine if a tile's LoD is not sufficient and tile has available children (available content)\n let shouldRefine = false;\n if (this.canTraverse(tile, frameState)) {\n this.updateChildTiles(tile, frameState);\n shouldRefine = this.updateAndPushChildren(\n tile,\n frameState,\n stack,\n tile.hasRenderContent ? tile._selectionDepth + 1 : tile._selectionDepth\n );\n }\n\n // 3. decide if should render (select) this tile\n // - tile does not have render content\n // - tile has render content and tile is `add` type (pointcloud)\n // - tile has render content and tile is `replace` type (photogrammetry) and can't refine any further\n const parent = tile.parent;\n const parentRefines = Boolean(!parent || parent._shouldRefine);\n const stoppedRefining = !shouldRefine;\n\n if (!tile.hasRenderContent) {\n this.emptyTiles[tile.id] = tile;\n this.loadTile(tile, frameState);\n if (stoppedRefining) {\n this.selectTile(tile, frameState);\n }\n // additive tiles\n } else if (tile.refine === TILE_REFINEMENT.ADD) {\n // Additive tiles are always loaded and selected\n this.loadTile(tile, frameState);\n this.selectTile(tile, frameState);\n\n // replace tiles\n } else if (tile.refine === TILE_REFINEMENT.REPLACE) {\n // Always load tiles in the base traversal\n // Select tiles that can't refine further\n this.loadTile(tile, frameState);\n if (stoppedRefining) {\n this.selectTile(tile, frameState);\n }\n }\n\n // 3. update cache, most recent touched tiles have higher priority to be fetched from server\n this.touchTile(tile, frameState);\n\n // 4. update tile refine prop and parent refinement status to trickle down to the descendants\n tile._shouldRefine = shouldRefine && parentRefines;\n }\n\n this.options.onTraversalEnd(frameState);\n }\n\n updateChildTiles(tile, frameState) {\n const children = tile.children;\n for (const child of children) {\n this.updateTile(child, frameState);\n }\n return true;\n }\n\n /* eslint-disable complexity, max-statements */\n updateAndPushChildren(tile, frameState, stack, depth) {\n const {loadSiblings, skipLevelOfDetail} = this.options;\n\n const children = tile.children;\n\n // sort children tiles\n children.sort(this.compareDistanceToCamera.bind(this));\n\n // For traditional replacement refinement only refine if all children are loaded.\n // Empty tiles are exempt since it looks better if children stream in as they are loaded to fill the empty space.\n const checkRefines =\n tile.refine === TILE_REFINEMENT.REPLACE && tile.hasRenderContent && !skipLevelOfDetail;\n\n let hasVisibleChild = false;\n let refines = true;\n\n for (const child of children) {\n child._selectionDepth = depth;\n if (child.isVisibleAndInRequestVolume) {\n if (stack.find(child)) {\n stack.delete(child);\n }\n stack.push(child);\n hasVisibleChild = true;\n } else if (checkRefines || loadSiblings) {\n // Keep non-visible children loaded since they are still needed before the parent can refine.\n // Or loadSiblings is true so always load tiles regardless of visibility.\n this.loadTile(child, frameState);\n this.touchTile(child, frameState);\n }\n\n if (checkRefines) {\n let childRefines;\n if (!child._inRequestVolume) {\n childRefines = false;\n } else if (!child.hasRenderContent) {\n childRefines = this.executeEmptyTraversal(child, frameState);\n } else {\n childRefines = child.contentAvailable;\n }\n refines = refines && childRefines;\n\n if (!refines) {\n return false;\n }\n }\n }\n\n if (!hasVisibleChild) {\n refines = false;\n }\n return refines;\n }\n /* eslint-enable complexity, max-statements */\n\n updateTile(tile, frameState) {\n this.updateTileVisibility(tile, frameState);\n }\n\n // tile to render in the browser\n selectTile(tile, frameState) {\n if (this.shouldSelectTile(tile)) {\n // The tile can be selected right away and does not require traverseAndSelect\n tile._selectedFrame = frameState.frameNumber;\n this.selectedTiles[tile.id] = tile;\n }\n }\n\n // tile to load from server\n loadTile(tile, frameState) {\n if (this.shouldLoadTile(tile)) {\n tile._requestedFrame = frameState.frameNumber;\n tile._priority = tile._getPriority();\n this.requestedTiles[tile.id] = tile;\n }\n }\n\n // cache tile\n touchTile(tile, frameState) {\n tile.tileset._cache.touch(tile);\n tile._touchedFrame = frameState.frameNumber;\n }\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(tile, frameState, useParentMetric = false, ignoreVisibility = false) {\n if (!tile.hasChildren) {\n return false;\n }\n\n // cesium specific\n if (tile.hasTilesetContent) {\n // Traverse external this to visit its root tile\n // Don't traverse if the subtree is expired because it will be destroyed\n return !tile.contentExpired;\n }\n\n if (!ignoreVisibility && !tile.isVisibleAndInRequestVolume) {\n return false;\n }\n\n return this.shouldRefine(tile, frameState, useParentMetric);\n }\n\n shouldLoadTile(tile) {\n // if request tile is in current frame\n // and has unexpired render content\n return tile.hasUnloadedContent || tile.contentExpired;\n }\n\n shouldSelectTile(tile) {\n // if select tile is in current frame\n // and content available\n return tile.contentAvailable && !this.options.skipLevelOfDetail;\n }\n\n // Decide if tile LoD (level of detail) is not sufficient under current viewport\n shouldRefine(tile, frameState, useParentMetric) {\n let screenSpaceError = tile._screenSpaceError;\n if (useParentMetric) {\n screenSpaceError = tile.getScreenSpaceError(frameState, true);\n }\n\n return screenSpaceError > this.options.maximumScreenSpaceError;\n }\n\n updateTileVisibility(tile, frameState) {\n const viewportIds: string[] = [];\n if (this.options.viewportTraversersMap) {\n for (const key in this.options.viewportTraversersMap) {\n const value = this.options.viewportTraversersMap[key];\n if (value === frameState.viewport.id) {\n viewportIds.push(key);\n }\n }\n } else {\n viewportIds.push(frameState.viewport.id);\n }\n tile.updateVisibility(frameState, viewportIds);\n }\n\n // UTILITIES\n\n compareDistanceToCamera(b, a) {\n return b._distanceToCamera - a._distanceToCamera;\n }\n\n anyChildrenVisible(tile, frameState) {\n let anyVisible = false;\n for (const child of tile.children) {\n child.updateVisibility(frameState);\n anyVisible = anyVisible || child.isVisibleAndInRequestVolume;\n }\n return anyVisible;\n }\n\n // Depth-first traversal that checks if all nearest descendants with content are loaded.\n // Ignores visibility.\n executeEmptyTraversal(root, frameState) {\n let allDescendantsLoaded = true;\n const stack = this._emptyTraversalStack;\n\n stack.push(root);\n\n while (stack.length > 0 && allDescendantsLoaded) {\n const tile = stack.pop();\n\n this.updateTile(tile, frameState);\n\n if (!tile.isVisibleAndInRequestVolume) {\n // Load tiles that aren't visible since they are still needed for the parent to refine\n this.loadTile(tile, frameState);\n }\n\n this.touchTile(tile, frameState);\n\n // Only traverse if the tile is empty - traversal stop at descendants with content\n const traverse = !tile.hasRenderContent && this.canTraverse(tile, frameState, false, true);\n\n if (traverse) {\n const children = tile.children;\n for (const child of children) {\n // eslint-disable-next-line max-depth\n if (stack.find(child)) {\n stack.delete(child);\n }\n stack.push(child);\n }\n } else if (!tile.contentAvailable) {\n allDescendantsLoaded = false;\n }\n }\n\n return allDescendantsLoaded;\n }\n}\n\n// TODO\n// enable expiration\n// enable optimization hint\n"],"file":"tileset-traverser.js"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/doubly-linked-list-node.js"],"names":["DoublyLinkedListNode","constructor","item","previous","next"],"mappings":"AAQA,eAAe,MAAMA,oBAAN,CAA2B;AACxCC,EAAAA,WAAW,CAACC,IAAD,EAAOC,QAAP,EAAiBC,IAAjB,EAAuB;AAChC,SAAKF,IAAL,GAAYA,IAAZ;AACA,SAAKC,QAAL,GAAgBA,QAAhB;AACA,SAAKC,IAAL,GAAYA,IAAZ;AACD;;AALuC","sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/**\n * Doubly linked list node\n *\n * @private\n */\nexport default class DoublyLinkedListNode {\n constructor(item, previous, next) {\n this.item = item;\n this.previous = previous;\n this.next = next;\n }\n}\n"],"file":"doubly-linked-list-node.js"}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/doubly-linked-list.js"],"names":["DoublyLinkedListNode","DoublyLinkedList","constructor","head","tail","_length","length","add","item","node","next","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WAAKT,IAAL,GAAYM,IAAI,CAACC,IAAjB;AACD,KAJM,MAIA;AAEL,WAAKP,IAAL,GAAY,IAAZ;AACA,WAAKC,IAAL,GAAY,IAAZ;AACD;;AAEDK,IAAAA,IAAI,CAACC,IAAL,GAAY,IAAZ;AACAD,IAAAA,IAAI,CAACG,QAAL,GAAgB,IAAhB;AAEA,MAAE,KAAKP,OAAP;AACD;;AAODQ,EAAAA,MAAM,CAACJ,IAAD,EAAOK,QAAP,EAAiB;AACrB,QAAIL,IAAI,KAAKK,QAAb,EAAuB;AACrB;AACD;;AAGD,SAAKH,MAAL,CAAYG,QAAZ;;AACA,SAAKC,OAAL,CAAaN,IAAb,EAAmBK,QAAnB;AACD;;AAEDC,EAAAA,OAAO,CAACN,IAAD,EAAOK,QAAP,EAAiB;AACtB,UAAME,WAAW,GAAGP,IAAI,CAACC,IAAzB;AACAD,IAAAA,IAAI,CAACC,IAAL,GAAYI,QAAZ;;AAGA,QAAI,KAAKV,IAAL,KAAcK,IAAlB,EAAwB;AACtB,WAAKL,IAAL,GAAYU,QAAZ;AACD,KAFD,MAEO;AACLE,MAAAA,WAAW,CAACJ,QAAZ,GAAuBE,QAAvB;AACD;;AAEDA,IAAAA,QAAQ,CAACJ,IAAT,GAAgBM,WAAhB;AACAF,IAAAA,QAAQ,CAACF,QAAT,GAAoBH,IAApB;AAEA,MAAE,KAAKJ,OAAP;AACD;;AA9FmC","sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport DoublyLinkedListNode from '../utils/doubly-linked-list-node';\n\n/**\n * Doubly linked list\n *\n * @private\n */\nexport default class DoublyLinkedList {\n constructor() {\n this.head = null;\n this.tail = null;\n this._length = 0;\n }\n\n get length() {\n return this._length;\n }\n\n /**\n * Adds the item to the end of the list\n * @param {*} [item]\n * @return {DoublyLinkedListNode}\n */\n add(item) {\n const node = new DoublyLinkedListNode(item, this.tail, null);\n\n if (this.tail) {\n this.tail.next = node;\n this.tail = node;\n } else {\n this.head = node;\n this.tail = node;\n }\n\n ++this._length;\n\n return node;\n }\n\n /**\n * Removes the given node from the list\n * @param {DoublyLinkedListNode} node\n */\n remove(node) {\n if (!node) {\n return;\n }\n\n if (node.previous && node.next) {\n node.previous.next = node.next;\n node.next.previous = node.previous;\n } else if (node.previous) {\n // Remove last node\n node.previous.next = null;\n this.tail = node.previous;\n } else if (node.next) {\n // Remove first node\n node.next.previous = null;\n this.head = node.next;\n } else {\n // Remove last node in the linked list\n this.head = null;\n this.tail = null;\n }\n\n node.next = null;\n node.previous = null;\n\n --this._length;\n }\n\n /**\n * Moves nextNode after node\n * @param {DoublyLinkedListNode} node\n * @param {DoublyLinkedListNode} nextNode\n */\n splice(node, nextNode) {\n if (node === nextNode) {\n return;\n }\n\n // Remove nextNode, then insert after node\n this.remove(nextNode);\n this._insert(node, nextNode);\n }\n\n _insert(node, nextNode) {\n const oldNodeNext = node.next;\n node.next = nextNode;\n\n // nextNode is the new tail\n if (this.tail === node) {\n this.tail = nextNode;\n } else {\n oldNodeNext.previous = nextNode;\n }\n\n nextNode.next = oldNodeNext;\n nextNode.previous = node;\n\n ++this._length;\n }\n}\n"],"file":"doubly-linked-list.js"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/managed-array.js"],"names":["assert","ManagedArray","constructor","length","_array","Array","_map","Map","_length","values","get","index","set","element","has","delete","splice","peek","push","pop","reserve","resize","trim","undefined","reset","find","target"],"mappings":"AAGA,SAAQA,MAAR,QAAqB,0BAArB;AAWA,eAAe,MAAMC,YAAN,CAAmB;AAChCC,EAAAA,WAAW,CAACC,MAAM,GAAG,CAAV,EAAa;AACtB,SAAKC,MAAL,GAAc,IAAIC,KAAJ,CAAUF,MAAV,CAAd;AACA,SAAKG,IAAL,GAAY,IAAIC,GAAJ,EAAZ;AACA,SAAKC,OAAL,GAAeL,MAAf;AACD;;AASS,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EAAAA,IAAI,CAACC,MAAD,EAAS;AACX,WAAO,KAAKpB,IAAL,CAAUQ,GAAV,CAAcY,MAAd,CAAP;AACD;;AAzJ+B","sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {assert} from '@loaders.gl/loader-utils';\n\n/**\n * A wrapper around arrays so that the internal length of the array can be manually managed.\n *\n * @alias ManagedArray\n * @constructor\n * @private\n *\n * @param {Number} [length=0] The initial length of the array.\n */\nexport default class ManagedArray {\n constructor(length = 0) {\n this._array = new Array(length);\n this._map = new Map();\n this._length = length;\n }\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\n set length(length) {\n this._length = length;\n if (length > this._array.length) {\n this._array.length = length;\n }\n }\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 /**\n * Gets the element at an index.\n *\n * @param {Number} index The index to get.\n */\n get(index) {\n assert(index < this._array.length);\n return this._array[index];\n }\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(index, element) {\n assert(index >= 0);\n\n if (index >= this.length) {\n this.length = index + 1;\n }\n\n if (this._map.has(this._array[index])) {\n this._map.delete(this._array[index]);\n }\n\n this._array[index] = element;\n this._map.set(element, index);\n }\n\n delete(element) {\n const index = this._map.get(element);\n if (index >= 0) {\n this._array.splice(index, 1);\n this._map.delete(element);\n this.length--;\n }\n }\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 /**\n * Push an element into the array.\n *\n * @param {*} element The element to push.\n */\n push(element) {\n if (!this._map.has(element)) {\n const index = this.length++;\n this._array[index] = element;\n this._map.set(element, index);\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 element = this._array[--this.length];\n this._map.delete(element);\n return element;\n }\n\n /**\n * Resize the internal array if length > _array.length.\n *\n * @param {Number} length The length.\n */\n reserve(length) {\n assert(length >= 0);\n\n if (length > this._array.length) {\n this._array.length = length;\n }\n }\n\n /**\n * Resize the array.\n *\n * @param {Number} length The length.\n */\n resize(length) {\n assert(length >= 0);\n\n this.length = length;\n }\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(length) {\n if (length === null || length === undefined) {\n length = this.length;\n }\n this._array.length = length;\n }\n\n reset() {\n this._array = [];\n this._map = new Map();\n this._length = 0;\n }\n\n find(target) {\n return this._map.has(target);\n }\n}\n"],"file":"managed-array.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tiles",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"description": "Common components for different tiles loaders.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"pointcloud"
|
|
21
21
|
],
|
|
22
22
|
"types": "src/index.ts",
|
|
23
|
-
"main": "dist/
|
|
24
|
-
"module": "dist/
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"module": "dist/index.js",
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"files": [
|
|
27
27
|
"src",
|
|
@@ -30,17 +30,19 @@
|
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"pre-build": "npm run build-bundle",
|
|
33
|
-
"build-bundle": "
|
|
33
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@loaders.gl/
|
|
37
|
-
"@loaders.gl/
|
|
38
|
-
"@loaders.gl/math": "3.1.0-alpha.4",
|
|
36
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.1",
|
|
37
|
+
"@loaders.gl/math": "4.0.0-alpha.1",
|
|
39
38
|
"@math.gl/core": "^3.5.1",
|
|
40
39
|
"@math.gl/culling": "^3.5.1",
|
|
41
40
|
"@math.gl/geospatial": "^3.5.1",
|
|
42
41
|
"@math.gl/web-mercator": "^3.5.1",
|
|
43
42
|
"@probe.gl/stats": "^3.4.0"
|
|
44
43
|
},
|
|
45
|
-
"
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@loaders.gl/core": "^3.0.0"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "e48f5534fe7188c810f23f965a440c144b3cf6d0"
|
|
46
48
|
}
|
|
@@ -59,5 +59,7 @@ export function calculateTransformProps(tileHeader, tile) {
|
|
|
59
59
|
tile.cartographicOrigin = cartographicOrigin;
|
|
60
60
|
|
|
61
61
|
// Deprecated, drop
|
|
62
|
-
tile.
|
|
62
|
+
if (!tile.coordinateSystem) {
|
|
63
|
+
tile.modelMatrix = tile.cartographicModelMatrix;
|
|
64
|
+
}
|
|
63
65
|
}
|
package/dist/dist.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var i in r)("object"==typeof exports?exports:t)[i]=r[i]}}(window,(function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)r.d(i,s,function(e){return t[e]}.bind(null,s));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=22)}([,function(t,e,r){"use strict";(function(t,i){r.d(e,"a",(function(){return s}));"undefined"!=typeof self&&self,"undefined"!=typeof window&&window,"undefined"!=typeof document&&document;const s=Boolean("object"!=typeof i||"[object process]"!==String(i)||i.browser),n=void 0!==i&&i.version&&/v([0-9]*)/.exec(i.version);n&&parseFloat(n[1])}).call(this,r(9),r(3))},function(t,e,r){"use strict";(function(t,i){r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return o}));const s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document,process:"object"==typeof i&&i},n=s.window||s.self||s.global,o=s.process||{};console}).call(this,r(9),r(3))},function(t,e){var r,i,s=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===n||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:n}catch(t){r=n}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();var h,c=[],u=!1,l=-1;function d(){u&&h&&(u=!1,h.length?c=h.concat(c):l=-1,c.length&&f())}function f(){if(!u){var t=a(d);u=!0;for(var e=c.length;e;){for(h=c,c=[];++l<e;)h&&h[l].run();l=-1,e=c.length}h=null,u=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new p(t,e)),1!==c.length||u||a(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=m,s.addListener=m,s.once=m,s.off=m,s.removeListener=m,s.removeAllListeners=m,s.emit=m,s.prependListener=m,s.prependOnceListener=m,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(t,e,r){"use strict";(function(t){function i(){let e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if(void 0!==t&&t.hrtime){const r=t.hrtime();e=1e3*r[0]+r[1]/1e6}else e=Date.now();return e}r.d(e,"a",(function(){return i}))}).call(this,r(3))},,function(t,e){},,,function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e){},,,function(t,e){},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return s}));var i=r(15);function s(){return!("object"==typeof t&&"[object process]"===String(t)&&!t.browser)||Object(i.a)()}}).call(this,r(3))},function(t,e,r){"use strict";(function(t){function i(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if(void 0!==t&&"object"==typeof t.versions&&Boolean(t.versions.electron))return!0;const r="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,i=e||r;return!!(i&&i.indexOf("Electron")>=0)}r.d(e,"a",(function(){return i}))}).call(this,r(3))},function(t,e,r){"use strict";(function(t,i){r.d(e,"a",(function(){return s}));"undefined"!=typeof self&&self,"undefined"!=typeof window&&window,"undefined"!=typeof document&&document,"object"!=typeof i||"[object process]"!==String(i)||i.browser;const s="undefined"!=typeof window&&void 0!==window.orientation,n=void 0!==i&&i.version&&/v([0-9]*)/.exec(i.version);n&&parseFloat(n[1])}).call(this,r(9),r(3))},,,,,,function(t,e,r){const i=r(25);globalThis.loaders=globalThis.loaders||{},t.exports=Object.assign(globalThis.loaders,i)},,function(t,e){},function(t,e,r){"use strict";r.r(e),r.d(e,"Tileset3D",(function(){return ns})),r.d(e,"Tile3D",(function(){return Ki})),r.d(e,"TilesetTraverser",(function(){return Qi})),r.d(e,"TilesetCache",(function(){return It})),r.d(e,"createBoundingVolume",(function(){return Di})),r.d(e,"calculateTransformProps",(function(){return Pt})),r.d(e,"getFrameState",(function(){return Ue})),r.d(e,"TILE_CONTENT_STATE",(function(){return Ci})),r.d(e,"TILE_REFINEMENT",(function(){return Ai})),r.d(e,"TILE_TYPE",(function(){return Ri})),r.d(e,"TILESET_TYPE",(function(){return Oi})),r.d(e,"LOD_METRIC_TYPE",(function(){return Li}));var i={};function s(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}r.r(i),r.d(i,"filename",(function(){return Mt})),r.d(i,"dirname",(function(){return St})),r.d(i,"join",(function(){return xt}));const n=1/Math.PI*180,o=1/180*Math.PI,a={};function h(t,{precision:e=a.precision||4}={}){return t=function(t){return Math.round(t/a.EPSILON)*a.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function c(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function u(t,e,r){if(c(t)){r=r||((i=t).clone?i.clone():new Array(i.length));for(let i=0;i<r.length&&i<t.length;++i)r[i]=e(t[i],i,r);return r}var i;return e(t)}function l(t){return function(t,e){return u(t,t=>t*o,e)}(t)}function d(t){return f(t)}function f(t,e){return u(t,t=>t*n,e)}function p(t,e,r){const i=a.EPSILON;r&&(a.EPSILON=r);try{if(t===e)return!0;if(c(t)&&c(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!p(t[r],e[r]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):!(!Number.isFinite(t)||!Number.isFinite(e))&&Math.abs(t-e)<=a.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{a.EPSILON=i}}function m(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function g(t,e,r=""){if(a.debug&&!function(t,e){if(t.length!==e)return!1;for(let e=0;e<t.length;++e)if(!Number.isFinite(t[e]))return!1;return!0}(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}a.EPSILON=1e-12,a.debug=!1,a.precision=4,a.printTypes=!1,a.printDegrees=!1,a.printRowMajor=!0;const y={};function w(t,e){y[t]||(y[t]=!0,console.warn("".concat(t," has been removed in version ").concat(e,", see upgrade guide for more information")))}class v extends(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Array)){get ELEMENTS(){return s(!1),0}clone(){return(new this.constructor).copy(this)}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}fromArray(t,e=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+e];return this.check()}to(t){return t===this?this:c(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toArray(t=[],e=0){for(let r=0;r<this.ELEMENTS;++r)t[e+r]=this[r];return t}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(a)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+h(this[r],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<this.ELEMENTS;++e)if(!p(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,r){void 0===r&&(r=e,e=t,t=this);for(let i=0;i<this.ELEMENTS;++i){const s=t[i];this[i]=s+r*(e[i]-s)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),e[r]);return this.check()}add(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]+=e[t];return this.check()}subtract(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]-=e[t];return this.check()}scale(t){if(Array.isArray(t))return this.multiply(t);for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.scale(1/t)}clampScalar(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),e);return this.check()}multiplyByScalar(t){return this.scale(t)}get elements(){return this}check(){if(a.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 e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}}class _ extends v{get ELEMENTS(){return s(!1),0}get RANK(){return s(!1),0}toString(){let t="[";if(a.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+e])}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=" ".concat(this[e])}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,r){return this[e*this.RANK+t]=m(r),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)e[t]=this[r+t];return e}setColumn(t,e){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)this[r+t]=e[t];return this}}function T(t,e,r){const i=e[0],s=e[1],n=e[2],o=r[3]*i+r[7]*s+r[11]*n||1;return t[0]=(r[0]*i+r[4]*s+r[8]*n)/o,t[1]=(r[1]*i+r[5]*s+r[9]*n)/o,t[2]=(r[2]*i+r[6]*s+r[10]*n)/o,t}var b=1e-6,E="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function M(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=e[6],u=e[7],l=e[8],d=e[9],f=e[10],p=e[11],m=e[12],g=e[13],y=e[14],w=e[15],v=r[0],_=r[1],T=r[2],b=r[3];return t[0]=v*i+_*a+T*l+b*m,t[1]=v*s+_*h+T*d+b*g,t[2]=v*n+_*c+T*f+b*y,t[3]=v*o+_*u+T*p+b*w,v=r[4],_=r[5],T=r[6],b=r[7],t[4]=v*i+_*a+T*l+b*m,t[5]=v*s+_*h+T*d+b*g,t[6]=v*n+_*c+T*f+b*y,t[7]=v*o+_*u+T*p+b*w,v=r[8],_=r[9],T=r[10],b=r[11],t[8]=v*i+_*a+T*l+b*m,t[9]=v*s+_*h+T*d+b*g,t[10]=v*n+_*c+T*f+b*y,t[11]=v*o+_*u+T*p+b*w,v=r[12],_=r[13],T=r[14],b=r[15],t[12]=v*i+_*a+T*l+b*m,t[13]=v*s+_*h+T*d+b*g,t[14]=v*n+_*c+T*f+b*y,t[15]=v*o+_*u+T*p+b*w,t}function S(t,e,r){var i=r[0],s=r[1],n=r[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function x(t,e){var r=e[0],i=e[1],s=e[2],n=e[4],o=e[5],a=e[6],h=e[8],c=e[9],u=e[10];return t[0]=Math.hypot(r,i,s),t[1]=Math.hypot(n,o,a),t[2]=Math.hypot(h,c,u),t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var C,A;C=new E(2),E!=Float32Array&&(C[0]=0,C[1]=0),A=C;function R(){var t=new E(3);return E!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function O(t){var e=t[0],r=t[1],i=t[2];return Math.hypot(e,r,i)}function L(t,e,r){var i=new E(3);return i[0]=t,i[1]=e,i[2]=r,i}function k(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function N(t,e,r){var i=e[0],s=e[1],n=e[2],o=r[0],a=r[1],h=r[2];return t[0]=s*h-n*a,t[1]=n*o-i*h,t[2]=i*a-s*o,t}function I(t,e,r){var i=e[0],s=e[1],n=e[2],o=r[3]*i+r[7]*s+r[11]*n+r[15];return o=o||1,t[0]=(r[0]*i+r[4]*s+r[8]*n+r[12])/o,t[1]=(r[1]*i+r[5]*s+r[9]*n+r[13])/o,t[2]=(r[2]*i+r[6]*s+r[10]*n+r[14])/o,t}function P(t,e,r){var i=e[0],s=e[1],n=e[2];return t[0]=i*r[0]+s*r[3]+n*r[6],t[1]=i*r[1]+s*r[4]+n*r[7],t[2]=i*r[2]+s*r[5]+n*r[8],t}var q=O;!function(){var t=R()}();function D(t){var e=t[0],r=t[1],i=t[2],s=t[3];return Math.hypot(e,r,i,s)}function V(t){var e=t[0],r=t[1],i=t[2],s=t[3];return e*e+r*r+i*i+s*s}!function(){var t=function(){var t=new E(4);return E!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}();const j=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),z=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),U=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),F={};class B extends _{static get IDENTITY(){return F.IDENTITY=F.IDENTITY||Object.freeze(new B(j)),F.IDENTITY}static get ZERO(){return F.ZERO=F.ZERO||Object.freeze(new B(z)),F.ZERO}get INDICES(){return U}get ELEMENTS(){return 16}get RANK(){return 4}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,r,i,s,n,o,a,h,c,u,l,d,f,p,m){return this[0]=t,this[1]=e,this[2]=r,this[3]=i,this[4]=s,this[5]=n,this[6]=o,this[7]=a,this[8]=h,this[9]=c,this[10]=u,this[11]=l,this[12]=d,this[13]=f,this[14]=p,this[15]=m,this.check()}setRowMajor(t,e,r,i,s,n,o,a,h,c,u,l,d,f,p,m){return this[0]=t,this[1]=s,this[2]=h,this[3]=d,this[4]=e,this[5]=n,this[6]=c,this[7]=f,this[8]=r,this[9]=o,this[10]=u,this[11]=p,this[12]=i,this[13]=a,this[14]=l,this[15]=m,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(j)}fromQuaternion(t){return function(t,e){var r=e[0],i=e[1],s=e[2],n=e[3],o=r+r,a=i+i,h=s+s,c=r*o,u=i*o,l=i*a,d=s*o,f=s*a,p=s*h,m=n*o,g=n*a,y=n*h;t[0]=1-l-p,t[1]=u+y,t[2]=d-g,t[3]=0,t[4]=u-y,t[5]=1-c-p,t[6]=f+m,t[7]=0,t[8]=d+g,t[9]=f-m,t[10]=1-c-l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum({left:t,right:e,bottom:r,top:i,near:s,far:n}){return n===1/0?B._computeInfinitePerspectiveOffCenter(this,t,e,r,i,s):function(t,e,r,i,s,n,o){var a=1/(r-e),h=1/(s-i),c=1/(n-o);t[0]=2*n*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*n*h,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(s+i)*h,t[10]=(o+n)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*n*2*c,t[15]=0}(this,t,e,r,i,s,n),this.check()}static _computeInfinitePerspectiveOffCenter(t,e,r,i,s,n){const o=2*n/(r-e),a=2*n/(s-i),h=(r+e)/(r-e),c=(s+i)/(s-i),u=-2*n;return 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]=h,t[9]=c,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=u,t[15]=0,t}lookAt(t,e,r){return 1===arguments.length&&({eye:t,center:e,up:r}=t),function(t,e,r,i){var s,n,o,a,h,c,u,l,d,f,p=e[0],m=e[1],g=e[2],y=i[0],w=i[1],v=i[2],_=r[0],T=r[1],E=r[2];Math.abs(p-_)<b&&Math.abs(m-T)<b&&Math.abs(g-E)<b?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=p-_,l=m-T,d=g-E,s=w*(d*=f=1/Math.hypot(u,l,d))-v*(l*=f),n=v*(u*=f)-y*d,o=y*l-w*u,(f=Math.hypot(s,n,o))?(s*=f=1/f,n*=f,o*=f):(s=0,n=0,o=0),a=l*o-d*n,h=d*s-u*o,c=u*n-l*s,(f=Math.hypot(a,h,c))?(a*=f=1/f,h*=f,c*=f):(a=0,h=0,c=0),t[0]=s,t[1]=a,t[2]=u,t[3]=0,t[4]=n,t[5]=h,t[6]=l,t[7]=0,t[8]=o,t[9]=c,t[10]=d,t[11]=0,t[12]=-(s*p+n*m+o*g),t[13]=-(a*p+h*m+c*g),t[14]=-(u*p+l*m+d*g),t[15]=1)}(this,t,e=e||[0,0,0],r=r||[0,1,0]),this.check()}ortho({left:t,right:e,bottom:r,top:i,near:s=.1,far:n=500}){return function(t,e,r,i,s,n,o){var a=1/(e-r),h=1/(i-s),c=1/(n-o);t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*a,t[13]=(s+i)*h,t[14]=(o+n)*c,t[15]=1}(this,t,e,r,i,s,n),this.check()}orthographic({fovy:t=45*Math.PI/180,aspect:e=1,focalDistance:r=1,near:i=.1,far:s=500}){if(t>2*Math.PI)throw Error("radians");const n=t/2,o=r*Math.tan(n),a=o*e;return(new B).ortho({left:-a,right:a,bottom:-o,top:o,near:i,far:s})}perspective({fovy:t,fov:e=45*Math.PI/180,aspect:r=1,near:i=.1,far:s=500}={}){if((t=t||e)>2*Math.PI)throw Error("radians");return function(t,e,r,i,s){var n,o=1/Math.tan(e/2);t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,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!=s&&s!==1/0?(n=1/(i-s),t[10]=(s+i)*n,t[14]=2*s*i*n):(t[10]=-1,t[14]=-2*i)}(this,t,r,i,s),this.check()}determinant(){return e=(t=this)[0],r=t[1],i=t[2],s=t[3],n=t[4],o=t[5],a=t[6],h=t[7],c=t[8],u=t[9],l=t[10],d=t[11],f=t[12],p=t[13],m=t[14],g=t[15],(e*o-r*n)*(l*g-d*m)-(e*a-i*n)*(u*g-d*p)+(e*h-s*n)*(u*m-l*p)+(r*a-i*o)*(c*g-d*f)-(r*h-s*o)*(c*m-l*f)+(i*h-s*a)*(c*p-u*f);var t,e,r,i,s,n,o,a,h,c,u,l,d,f,p,m,g}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=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const r=this.getScale(e||[-0,-0,-0]),i=1/r[0],s=1/r[1],n=1/r[2];return t[0]=this[0]*i,t[1]=this[1]*s,t[2]=this[2]*n,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*s,t[6]=this[6]*n,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*s,t[10]=this[10]*n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t=[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const r=this.getScale(e||[-0,-0,-0]),i=1/r[0],s=1/r[1],n=1/r[2];return t[0]=this[0]*i,t[1]=this[1]*s,t[2]=this[2]*n,t[3]=this[4]*i,t[4]=this[5]*s,t[5]=this[6]*n,t[6]=this[8]*i,t[7]=this[9]*s,t[8]=this[10]*n,t}transpose(){return function(t,e){if(t===e){var r=e[1],i=e[2],s=e[3],n=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=n,t[11]=e[14],t[12]=s,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){var r=e[0],i=e[1],s=e[2],n=e[3],o=e[4],a=e[5],h=e[6],c=e[7],u=e[8],l=e[9],d=e[10],f=e[11],p=e[12],m=e[13],g=e[14],y=e[15],w=r*a-i*o,v=r*h-s*o,_=r*c-n*o,T=i*h-s*a,b=i*c-n*a,E=s*c-n*h,M=u*m-l*p,S=u*g-d*p,x=u*y-f*p,C=l*g-d*m,A=l*y-f*m,R=d*y-f*g,O=w*R-v*A+_*C+T*x-b*S+E*M;O&&(O=1/O,t[0]=(a*R-h*A+c*C)*O,t[1]=(s*A-i*R-n*C)*O,t[2]=(m*E-g*b+y*T)*O,t[3]=(d*b-l*E-f*T)*O,t[4]=(h*x-o*R-c*S)*O,t[5]=(r*R-s*x+n*S)*O,t[6]=(g*_-p*E-y*v)*O,t[7]=(u*E-d*_+f*v)*O,t[8]=(o*A-a*x+c*M)*O,t[9]=(i*x-r*A-n*M)*O,t[10]=(p*b-m*_+y*w)*O,t[11]=(l*_-u*b-f*w)*O,t[12]=(a*S-o*C-h*M)*O,t[13]=(r*C-i*S+s*M)*O,t[14]=(m*v-p*T-g*w)*O,t[15]=(u*T-l*v+d*w)*O)}(this,this),this.check()}multiplyLeft(t){return M(this,t,this),this.check()}multiplyRight(t){return M(this,this,t),this.check()}rotateX(t){return function(t,e,r){var i=Math.sin(r),s=Math.cos(r),n=e[4],o=e[5],a=e[6],h=e[7],c=e[8],u=e[9],l=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]=n*s+c*i,t[5]=o*s+u*i,t[6]=a*s+l*i,t[7]=h*s+d*i,t[8]=c*s-n*i,t[9]=u*s-o*i,t[10]=l*s-a*i,t[11]=d*s-h*i}(this,this,t),this.check()}rotateY(t){return function(t,e,r){var i=Math.sin(r),s=Math.cos(r),n=e[0],o=e[1],a=e[2],h=e[3],c=e[8],u=e[9],l=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]=n*s-c*i,t[1]=o*s-u*i,t[2]=a*s-l*i,t[3]=h*s-d*i,t[8]=n*i+c*s,t[9]=o*i+u*s,t[10]=a*i+l*s,t[11]=h*i+d*s}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){var i=Math.sin(r),s=Math.cos(r),n=e[0],o=e[1],a=e[2],h=e[3],c=e[4],u=e[5],l=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]=n*s+c*i,t[1]=o*s+u*i,t[2]=a*s+l*i,t[3]=h*s+d*i,t[4]=c*s-n*i,t[5]=u*s-o*i,t[6]=l*s-a*i,t[7]=d*s-h*i}(this,this,t),this.check()}rotateXYZ([t,e,r]){return this.rotateX(t).rotateY(e).rotateZ(r)}rotateAxis(t,e){return function(t,e,r,i){var s,n,o,a,h,c,u,l,d,f,p,m,g,y,w,v,_,T,E,M,S,x,C,A,R=i[0],O=i[1],L=i[2],k=Math.hypot(R,O,L);k<b||(R*=k=1/k,O*=k,L*=k,s=Math.sin(r),o=1-(n=Math.cos(r)),a=e[0],h=e[1],c=e[2],u=e[3],l=e[4],d=e[5],f=e[6],p=e[7],m=e[8],g=e[9],y=e[10],w=e[11],v=R*R*o+n,_=O*R*o+L*s,T=L*R*o-O*s,E=R*O*o-L*s,M=O*O*o+n,S=L*O*o+R*s,x=R*L*o+O*s,C=O*L*o-R*s,A=L*L*o+n,t[0]=a*v+l*_+m*T,t[1]=h*v+d*_+g*T,t[2]=c*v+f*_+y*T,t[3]=u*v+p*_+w*T,t[4]=a*E+l*M+m*S,t[5]=h*E+d*M+g*S,t[6]=c*E+f*M+y*S,t[7]=u*E+p*M+w*S,t[8]=a*x+l*C+m*A,t[9]=h*x+d*C+g*A,t[10]=c*x+f*C+y*A,t[11]=u*x+p*C+w*A,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 Array.isArray(t)?S(this,this,t):S(this,this,[t,t,t]),this.check()}translate(t){return function(t,e,r){var i,s,n,o,a,h,c,u,l,d,f,p,m=r[0],g=r[1],y=r[2];e===t?(t[12]=e[0]*m+e[4]*g+e[8]*y+e[12],t[13]=e[1]*m+e[5]*g+e[9]*y+e[13],t[14]=e[2]*m+e[6]*g+e[10]*y+e[14],t[15]=e[3]*m+e[7]*g+e[11]*y+e[15]):(i=e[0],s=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=e[6],u=e[7],l=e[8],d=e[9],f=e[10],p=e[11],t[0]=i,t[1]=s,t[2]=n,t[3]=o,t[4]=a,t[5]=h,t[6]=c,t[7]=u,t[8]=l,t[9]=d,t[10]=f,t[11]=p,t[12]=i*m+a*g+l*y+e[12],t[13]=s*m+h*g+d*y+e[13],t[14]=n*m+c*g+f*y+e[14],t[15]=o*m+u*g+p*y+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(g(e=function(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3];return t[0]=r[0]*i+r[4]*s+r[8]*n+r[12]*o,t[1]=r[1]*i+r[5]*s+r[9]*n+r[13]*o,t[2]=r[2]*i+r[6]*s+r[10]*n+r[14]*o,t[3]=r[3]*i+r[7]*s+r[11]*n+r[15]*o,t}(e||[-0,-0,-0,-0],t,this),4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:r}=t;switch(r){case 2:e=function(t,e,r){var i=e[0],s=e[1];return t[0]=r[0]*i+r[4]*s+r[12],t[1]=r[1]*i+r[5]*s+r[13],t}(e||[-0,-0],t,this);break;case 3:e=I(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return g(e,t.length),e}transformAsVector(t,e){switch(t.length){case 2:e=function(t,e,r){const i=e[0],s=e[1],n=r[3]*i+r[7]*s||1;return t[0]=(r[0]*i+r[4]*s)/n,t[1]=(r[1]*i+r[5]*s)/n,t}(e||[-0,-0],t,this);break;case 3:e=T(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return g(e,t.length),e}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,r){return this.identity().translate([t,e,r])}transformPoint(t,e){return w("Matrix4.transformPoint","3.0"),this.transformAsPoint(t,e)}transformVector(t,e){return w("Matrix4.transformVector","3.0"),this.transformAsPoint(t,e)}transformDirection(t,e){return w("Matrix4.transformDirection","3.0"),this.transformAsVector(t,e)}}class W extends v{get ELEMENTS(){return s(!1),0}copy(t){return s(!1),this}get x(){return this[0]}set x(t){this[0]=m(t)}get y(){return this[1]}set y(t){this[1]=m(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let r=0;r<this.ELEMENTS;++r){const i=this[r]-t[r];e+=i*i}return m(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return m(e)}normalize(){const t=this.magnitude();if(0!==t)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e[t];return this.check()}divide(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return s(t>=0&&t<this.ELEMENTS,"index is out of range"),m(this[t])}setComponent(t,e){return s(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}const G=[0,0,0],$={};class Q extends W{static get ZERO(){return $.ZERO=$.ZERO||Object.freeze(new Q(0,0,0,0))}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&c(t)?this.copy(t):(a.debug&&(m(t),m(e),m(r)),this[0]=t,this[1]=e,this[2]=r)}set(t,e,r){return this[0]=t,this[1]=e,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return a.debug&&(m(t.x),m(t.y),m(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]=m(t)}angle(t){return r=t,i=(e=this)[0],s=e[1],n=e[2],o=r[0],a=r[1],h=r[2],c=Math.sqrt(i*i+s*s+n*n)*Math.sqrt(o*o+a*a+h*h),u=c&&k(e,r)/c,Math.acos(Math.min(Math.max(u,-1),1));var e,r,i,s,n,o,a,h,c,u}cross(t){return N(this,this,t),this.check()}rotateX({radians:t,origin:e=G}){return function(t,e,r,i){var s=[],n=[];s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],n[0]=s[0],n[1]=s[1]*Math.cos(i)-s[2]*Math.sin(i),n[2]=s[1]*Math.sin(i)+s[2]*Math.cos(i),t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2]}(this,this,e,t),this.check()}rotateY({radians:t,origin:e=G}){return function(t,e,r,i){var s=[],n=[];s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],n[0]=s[2]*Math.sin(i)+s[0]*Math.cos(i),n[1]=s[1],n[2]=s[2]*Math.cos(i)-s[0]*Math.sin(i),t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2]}(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=G}){return function(t,e,r,i){var s=[],n=[];s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],n[0]=s[0]*Math.cos(i)-s[1]*Math.sin(i),n[1]=s[0]*Math.sin(i)+s[1]*Math.cos(i),n[2]=s[2],t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2]}(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return I(this,this,t),this.check()}transformAsVector(t){return T(this,this,t),this.check()}transformByMatrix3(t){return P(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){const i=e[0],s=e[1];t[0]=r[0]*i+r[2]*s,t[1]=r[1]*i+r[3]*s,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return function(t,e,r){var i=r[0],s=r[1],n=r[2],o=r[3],a=e[0],h=e[1],c=e[2],u=s*c-n*h,l=n*a-i*c,d=i*h-s*a,f=s*d-n*l,p=n*u-i*d,m=i*l-s*u,g=2*o;u*=g,l*=g,d*=g,f*=2,p*=2,m*=2,t[0]=a+u+f,t[1]=h+l+p,t[2]=c+d+m}(this,this,t),this.check()}}var Y=.1,H=1e-12,K=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;Math.max(6378137,6378137,6356752.314245179);const Z=t=>t,X=new Q;function J(t,e,r=Z){return c(t)?(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]):"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z),e}function tt(t,e,r=Z){return c(e)?(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]):"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]),e}const et=new Q,rt=new Q,it=new Q;const st=new Q,nt={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"}},ot={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},at={east:new Q,north:new Q,up:new Q,west:new Q,south:new Q,down:new Q},ht=new Q,ct=new Q,ut=new Q;function lt(t,e,r,i,n,o){const a=nt[e]&&nt[e][r];let h,c,u;s(a&&(!i||i===a));const l=st.copy(n);if(p(l.x,0,1e-14)&&p(l.y,0,1e-14)){const t=Math.sign(l.z);h=ht.fromArray(ot[e]),"east"!==e&&"west"!==e&&h.scale(t),c=ct.fromArray(ot[r]),"east"!==r&&"west"!==r&&c.scale(t),u=ut.fromArray(ot[i]),"east"!==i&&"west"!==i&&u.scale(t)}else{const{up:s,east:n,north:o}=at;n.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,s),o.copy(s).cross(n);const{down:a,west:d,south:f}=at;a.copy(s).scale(-1),d.copy(n).scale(-1),f.copy(o).scale(-1),h=at[e],c=at[r],u=at[i]}return o[0]=h.x,o[1]=h.y,o[2]=h.z,o[3]=0,o[4]=c.x,o[5]=c.y,o[6]=c.z,o[7]=0,o[8]=u.x,o[9]=u.y,o[10]=u.z,o[11]=0,o[12]=l.x,o[13]=l.y,o[14]=l.z,o[15]=1,o}const dt=new Q,ft=new Q,pt=new Q,mt=new Q,gt=new Q,yt=new Q;let wt;class vt{static get WGS84(){return wt=wt||new vt(6378137,6378137,6356752.314245179),wt}constructor(t=0,e=0,r=0){s(t>=0),s(e>=0),s(r>=0),this.radii=new Q(t,e,r),this.radiiSquared=new Q(t*t,e*e,r*r),this.radiiToTheFourth=new Q(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new Q(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new Q(0===t?0:1/(t*t),0===e?0:1/(e*e),0===r?0:1/(r*r)),this.minimumRadius=Math.min(t,e,r),this.maximumRadius=Math.max(t,e,r),this.centerToleranceSquared=Y,0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const r=ft,i=pt,[,,s]=t;this.geodeticSurfaceNormalCartographic(t,r),i.copy(this.radiiSquared).scale(r);const n=Math.sqrt(r.dot(i));return i.scale(1/n),r.scale(s),i.add(r),i.to(e)}cartesianToCartographic(t,e=[0,0,0]){yt.from(t);const r=this.scaleToGeodeticSurface(yt,mt);if(!r)return;const i=this.geodeticSurfaceNormal(r,ft),s=gt;s.copy(yt).subtract(r);const n=Math.atan2(i.y,i.x),o=Math.asin(i.z),h=Math.sign(k(s,yt))*O(s);return tt([n,o,h],e,a._cartographicRadians?Z:d)}eastNorthUpToFixedFrame(t,e=new B){return lt(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,i,s=new B){return lt(this,t,e,r,i,s)}geocentricSurfaceNormal(t,e=[0,0,0]){return dt.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=function(t,e=X){return J(t,e,a._cartographicRadians?Z:l)}(t),i=r[0],s=r[1],n=Math.cos(s);return dt.set(n*Math.cos(i),n*Math.sin(i),Math.sin(s)).normalize(),dt.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return dt.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=new Q){const{oneOverRadii:i,oneOverRadiiSquared:s,centerToleranceSquared:n}=e;et.from(t);const o=t.x,a=t.y,h=t.z,c=i.x,u=i.y,l=i.z,d=o*o*c*c,f=a*a*u*u,p=h*h*l*l,m=d+f+p,g=Math.sqrt(1/m);if(!Number.isFinite(g))return;const y=rt;if(y.copy(t).scale(g),m<n)return y.to(r);const w=s.x,v=s.y,_=s.z,T=it;T.set(y.x*w*2,y.y*v*2,y.z*_*2);let b,E,M,S,x=(1-g)*t.len()/(.5*T.len()),C=0;do{x-=C,b=1/(1+x*w),E=1/(1+x*v),M=1/(1+x*_);const t=b*b,e=E*E,r=M*M;S=d*t+f*e+p*r-1;C=S/(-2*(d*(t*b)*w+f*(e*E)*v+p*(r*M)*_))}while(Math.abs(S)>H);return et.scale([b,E,M]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){mt.from(t);const r=mt.x,i=mt.y,s=mt.z,n=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*n.x+i*i*n.y+s*s*n.z);return mt.multiplyScalar(o).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return mt.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return mt.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){s(p(this.radii.x,this.radii.y,K)),s(this.radii.z>0),mt.from(t);const i=mt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-e))return mt.set(0,0,i).to(r)}}var _t=r(4);class Tt{constructor(t,e){this.name=t,this.type=e,this.sampleSize=1,this.reset()}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=Object(_t.a)(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Object(_t.a)()-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}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}_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 bt{constructor({id:t,stats:e}){this.id=t,this.stats={},this._initializeStats(e),Object.seal(this)}get(t,e="count"){return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t in this.stats)this.stats[t].reset();return this}forEach(t){for(const e in this.stats)t(this.stats[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(t=[]){t.forEach(t=>this._getOrCreate(t))}_getOrCreate(t){if(!t||!t.name)return null;const{name:e,type:r}=t;return this.stats[e]||(this.stats[e]=t instanceof Tt?t:new Tt(e,r)),this.stats[e]}}function Et(t,e){if(!t)throw new Error(e||"loader assertion failed.")}function Mt(t){const e=t&&t.lastIndexOf("/");return e>=0?t.substr(e+1):""}function St(t){const e=t&&t.lastIndexOf("/");return e>=0?t.substr(0,e):""}function xt(...t){return(t=t.map((e,r)=>(r&&(e=e.replace(new RegExp("^/"),"")),r!==t.length-1&&(e=e.replace(new RegExp("/$"),"")),e))).join("/")}r(6),r(13);function Ct(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const At={id:"request-scheduler",throttleRequests:!0,maxRequests:6};class Rt{constructor(t={}){Ct(this,"props",void 0),Ct(this,"stats",void 0),Ct(this,"activeRequestCount",0),Ct(this,"requestQueue",[]),Ct(this,"requestMap",new Map),Ct(this,"deferredUpdate",null),this.props={...At,...t},this.stats=new bt({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 r={handle:t,priority:0,getPriority:e},i=new Promise(t=>(r.resolve=t,r));return this.requestQueue.push(r),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){const{handle:e,resolve:r}=t;let i=!1;const s=()=>{i||(i=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:s}):Promise.resolve({done:s})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let e=0;e<t;++e){const t=this.requestQueue.shift();t&&this._issueRequest(t)}}}_updateAllRequests(){const t=this.requestQueue;for(let e=0;e<t.length;++e){const r=t[e];this._updateRequest(r)||(t.splice(e,1),this.requestMap.delete(r.handle),e--)}t.sort((t,e)=>t.priority-e.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0)||(t.resolve(null),!1)}}class Ot{constructor(t,e,r){this.item=t,this.previous=e,this.next=r}}class Lt{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(t){const e=new Ot(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 r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,++this._length}}function kt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Nt(t){return null!=t}class It{constructor(){kt(this,"_list",void 0),kt(this,"_sentinel",void 0),kt(this,"_trimTiles",void 0),this._list=new Lt,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){const e=t._cacheNode;Nt(e)&&this._list.splice(this._sentinel,e)}add(t,e,r){Nt(e._cacheNode)||(e._cacheNode=this._list.add(e),r&&r(t,e))}unloadTile(t,e,r){const i=e._cacheNode;Nt(i)&&(this._list.remove(i),e._cacheNode=void 0,r&&r(t,e))}unloadTiles(t,e){const r=this._trimTiles;this._trimTiles=!1;const i=this._list,s=1024*t.maximumMemoryUsage*1024,n=this._sentinel;let o=i.head;for(;o!==n&&(t.gpuMemoryUsageInBytes>s||r);){const r=o.item;o=o.next,this.unloadTile(t,r,e)}}trim(){this._trimTiles=!0}}function Pt(t,e){Et(t),Et(e);const{rtcCenter:r,gltfUpAxis:i}=e,{computedTransform:s,boundingVolume:{center:n}}=t;let o=new B(s);switch(r&&o.translate(r),i){case"Z":break;case"Y":const t=(new B).rotateX(Math.PI/2);o=o.multiplyRight(t);break;case"X":const e=(new B).rotateY(-Math.PI/2);o=o.multiplyRight(e)}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const a=new Q(n);e.cartesianModelMatrix=o,e.cartesianOrigin=a;const h=vt.WGS84.cartesianToCartographic(a,new Q),c=vt.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=c.multiplyRight(o),e.cartographicOrigin=h,e.modelMatrix=e.cartographicModelMatrix}const qt=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new Q,new Q;const Dt=new Q,Vt=new Q;class jt{constructor(t=[0,0,0],e=0){this.radius=-0,this.center=new Q,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=Dt.from(e),this.center=(new Q).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new jt(this.center,this.radius)}union(t){const e=this.center,r=this.radius,i=t.center,s=t.radius,n=Dt.copy(i).subtract(e),o=n.magnitude();if(r>=o+s)return this.clone();if(s>=o+r)return t.clone();const a=.5*(r+o+s);return Vt.copy(n).scale((-r+a)/o).add(e),this.center.copy(Vt),this.radius=a,this}expand(t){const e=(t=Dt.from(t)).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=x(Dt,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){return(t=Dt.from(t)).subtract(this.center).lengthSquared()-this.radius*this.radius}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}intersectPlane(t){const e=this.center,r=this.radius,i=t.normal.dot(e)+t.distance;return i<-r?qt.OUTSIDE:i<r?qt.INTERSECTING:qt.INSIDE}}function zt(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=e[6],u=e[7],l=e[8],d=r[0],f=r[1],p=r[2],m=r[3],g=r[4],y=r[5],w=r[6],v=r[7],_=r[8];return t[0]=d*i+f*o+p*c,t[1]=d*s+f*a+p*u,t[2]=d*n+f*h+p*l,t[3]=m*i+g*o+y*c,t[4]=m*s+g*a+y*u,t[5]=m*n+g*h+y*l,t[6]=w*i+v*o+_*c,t[7]=w*s+v*a+_*u,t[8]=w*n+v*h+_*l,t}function Ut(t,e,r){var i=r[0],s=r[1];return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=s*e[3],t[4]=s*e[4],t[5]=s*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}const Ft=Object.freeze([1,0,0,0,1,0,0,0,1]),Bt=Object.freeze([0,0,0,0,0,0,0,0,0]),Wt=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Gt={};class $t extends _{static get IDENTITY(){return Gt.IDENTITY=Gt.IDENTITY||Object.freeze(new $t(Ft)),Gt.IDENTITY}static get ZERO(){return Gt.ZERO=Gt.ZERO||Object.freeze(new $t(Bt)),Gt.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Wt}constructor(t){super(-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.check()}set(t,e,r,i,s,n,o,a,h){return this[0]=t,this[1]=e,this[2]=r,this[3]=i,this[4]=s,this[5]=n,this[6]=o,this[7]=a,this[8]=h,this.check()}setRowMajor(t,e,r,i,s,n,o,a,h){return this[0]=t,this[1]=i,this[2]=o,this[3]=e,this[4]=s,this[5]=a,this[6]=r,this[7]=n,this[8]=h,this.check()}determinant(){return e=(t=this)[0],r=t[1],i=t[2],s=t[3],n=t[4],o=t[5],a=t[6],h=t[7],c=t[8],e*(c*n-o*h)+r*(-c*s+o*a)+i*(h*s-n*a);var t,e,r,i,s,n,o,a,h,c}identity(){return this.copy(Ft)}fromQuaternion(t){return function(t,e){var r=e[0],i=e[1],s=e[2],n=e[3],o=r+r,a=i+i,h=s+s,c=r*o,u=i*o,l=i*a,d=s*o,f=s*a,p=s*h,m=n*o,g=n*a,y=n*h;t[0]=1-l-p,t[3]=u-y,t[6]=d+g,t[1]=u+y,t[4]=1-c-p,t[7]=f-m,t[2]=d-g,t[5]=f+m,t[8]=1-c-l}(this,t),this.check()}transpose(){return function(t,e){if(t===e){var r=e[1],i=e[2],s=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=i,t[7]=s}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){var r=e[0],i=e[1],s=e[2],n=e[3],o=e[4],a=e[5],h=e[6],c=e[7],u=e[8],l=u*o-a*c,d=-u*n+a*h,f=c*n-o*h,p=r*l+i*d+s*f;p&&(p=1/p,t[0]=l*p,t[1]=(-u*i+s*c)*p,t[2]=(a*i-s*o)*p,t[3]=d*p,t[4]=(u*r-s*h)*p,t[5]=(-a*r+s*n)*p,t[6]=f*p,t[7]=(-c*r+i*h)*p,t[8]=(o*r-i*n)*p)}(this,this),this.check()}multiplyLeft(t){return zt(this,t,this),this.check()}multiplyRight(t){return zt(this,this,t),this.check()}rotate(t){return function(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=e[6],u=e[7],l=e[8],d=Math.sin(r),f=Math.cos(r);t[0]=f*i+d*o,t[1]=f*s+d*a,t[2]=f*n+d*h,t[3]=f*o-d*i,t[4]=f*a-d*s,t[5]=f*h-d*n,t[6]=c,t[7]=u,t[8]=l}(this,this,t),this.check()}scale(t){return Array.isArray(t)?Ut(this,this,t):Ut(this,this,[t,t,t]),this.check()}translate(t){return function(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=e[6],u=e[7],l=e[8],d=r[0],f=r[1];t[0]=i,t[1]=s,t[2]=n,t[3]=o,t[4]=a,t[5]=h,t[6]=d*i+f*o+c,t[7]=d*s+f*a+u,t[8]=d*n+f*h+l}(this,this,t),this.check()}transform(t,e){switch(t.length){case 2:e=function(t,e,r){var i=e[0],s=e[1];return t[0]=r[0]*i+r[3]*s+r[6],t[1]=r[1]*i+r[4]*s+r[7],t}(e||[-0,-0],t,this);break;case 3:e=P(e||[-0,-0,-0],t,this);break;case 4:e=function(t,e,r){const i=e[0],s=e[1],n=e[2];return t[0]=r[0]*i+r[3]*s+r[6]*n,t[1]=r[1]*i+r[4]*s+r[7]*n,t[2]=r[2]*i+r[5]*s+r[8]*n,t[3]=e[3],t}(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return g(e,t.length),e}transformVector(t,e){return w("Matrix3.transformVector"),this.transform(t,e)}transformVector2(t,e){return w("Matrix3.transformVector"),this.transform(t,e)}transformVector3(t,e){return w("Matrix3.transformVector"),this.transform(t,e)}}function Qt(){var t=new E(4);return E!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Yt(t,e,r){r*=.5;var i=Math.sin(r);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(r),t}function Ht(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3],a=r[0],h=r[1],c=r[2],u=r[3];return t[0]=i*u+o*a+s*c-n*h,t[1]=s*u+o*h+n*a-i*c,t[2]=n*u+o*c+i*h-s*a,t[3]=o*u-i*a-s*h-n*c,t}function Kt(t,e,r,i){var s,n,o,a,h,c=e[0],u=e[1],l=e[2],d=e[3],f=r[0],p=r[1],m=r[2],g=r[3];return(n=c*f+u*p+l*m+d*g)<0&&(n=-n,f=-f,p=-p,m=-m,g=-g),1-n>b?(s=Math.acos(n),o=Math.sin(s),a=Math.sin((1-i)*s)/o,h=Math.sin(i*s)/o):(a=1-i,h=i),t[0]=a*c+h*f,t[1]=a*u+h*p,t[2]=a*l+h*m,t[3]=a*d+h*g,t}function Zt(t,e){var r,i=e[0]+e[4]+e[8];if(i>0)r=Math.sqrt(i+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{var s=0;e[4]>e[0]&&(s=1),e[8]>e[3*s+s]&&(s=2);var n=(s+1)%3,o=(s+2)%3;r=Math.sqrt(e[3*s+s]-e[3*n+n]-e[3*o+o]+1),t[s]=.5*r,r=.5/r,t[3]=(e[3*n+o]-e[3*o+n])*r,t[n]=(e[3*n+s]+e[3*s+n])*r,t[o]=(e[3*o+s]+e[3*s+o])*r}return t}var Xt,Jt,te,ee,re,ie,se=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},ne=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},oe=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},ae=function(t,e,r,i){var s=e[0],n=e[1],o=e[2],a=e[3];return t[0]=s+i*(r[0]-s),t[1]=n+i*(r[1]-n),t[2]=o+i*(r[2]-o),t[3]=a+i*(r[3]-a),t},he=D,ce=V,ue=function(t,e){var r=e[0],i=e[1],s=e[2],n=e[3],o=r*r+i*i+s*s+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=i*o,t[2]=s*o,t[3]=n*o,t},le=(Xt=R(),Jt=L(1,0,0),te=L(0,1,0),function(t,e,r){var i=k(e,r);return i<-.999999?(N(Xt,Jt,e),q(Xt)<1e-6&&N(Xt,te,e),function(t,e){var r=e[0],i=e[1],s=e[2],n=r*r+i*i+s*s;n>0&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n}(Xt,Xt),Yt(t,Xt,Math.PI),t):i>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(N(Xt,e,r),t[0]=Xt[0],t[1]=Xt[1],t[2]=Xt[2],t[3]=1+i,ue(t,t))});ee=Qt(),re=Qt(),ie=function(){var t=new E(9);return E!=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,t}();const de=[0,0,0,1];class fe extends v{constructor(t=0,e=0,r=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,r,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,r,i){return this[0]=t,this[1]=e,this[2]=r,this[3]=i,this.check()}fromMatrix3(t){return Zt(this,t),this.check()}identity(){return function(t){t[0]=0,t[1]=0,t[2]=0,t[3]=1}(this),this.check()}fromAxisRotation(t,e){return Yt(this,t,e),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=m(t)}get y(){return this[1]}set y(t){this[1]=m(t)}get z(){return this[2]}set z(t){this[2]=m(t)}get w(){return this[3]}set w(t){this[3]=m(t)}len(){return he(this)}lengthSquared(){return ce(this)}dot(t,e){if(void 0!==e)throw new Error("Quaternion.dot only takes one argument");return oe(this,t)}rotationTo(t,e){return le(this,t,e),this.check()}add(t,e){if(void 0!==e)throw new Error("Quaternion.add only takes one argument");return se(this,this,t),this.check()}calculateW(){return function(t,e){var r=e[0],i=e[1],s=e[2];t[0]=r,t[1]=i,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-i*i-s*s))}(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){var r=e[0],i=e[1],s=e[2],n=e[3],o=r*r+i*i+s*s+n*n,a=o?1/o:0;t[0]=-r*a,t[1]=-i*a,t[2]=-s*a,t[3]=n*a}(this,this),this.check()}lerp(t,e,r){return ae(this,t,e,r),this.check()}multiplyRight(t,e){return s(!e),Ht(this,this,t),this.check()}multiplyLeft(t,e){return s(!e),Ht(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,r){r*=.5;var i=e[0],s=e[1],n=e[2],o=e[3],a=Math.sin(r),h=Math.cos(r);t[0]=i*h+o*a,t[1]=s*h+n*a,t[2]=n*h-s*a,t[3]=o*h-i*a}(this,this,t),this.check()}rotateY(t){return function(t,e,r){r*=.5;var i=e[0],s=e[1],n=e[2],o=e[3],a=Math.sin(r),h=Math.cos(r);t[0]=i*h-n*a,t[1]=s*h+o*a,t[2]=n*h+i*a,t[3]=o*h-s*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){r*=.5;var i=e[0],s=e[1],n=e[2],o=e[3],a=Math.sin(r),h=Math.cos(r);t[0]=i*h+s*a,t[1]=s*h-i*a,t[2]=n*h+o*a,t[3]=o*h-n*a}(this,this,t),this.check()}scale(t){return ne(this,this,t),this.check()}slerp(t,e,r){switch(arguments.length){case 1:({start:t=de,target:e,ratio:r}=arguments[0]);break;case 2:[e,r]=arguments,t=this}return Kt(this,t,e,r),this.check()}transformVector4(t,e=t){return function(t,e,r){var i=e[0],s=e[1],n=e[2],o=r[0],a=r[1],h=r[2],c=r[3],u=c*i+a*n-h*s,l=c*s+h*i-o*n,d=c*n+o*s-a*i,f=-o*i-a*s-h*n;t[0]=u*c+f*-o+l*-h-d*-a,t[1]=l*c+f*-a+d*-o-u*-h,t[2]=d*c+f*-h+u*-a-l*-o,t[3]=e[3]}(e,t,this),g(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t,e){return this.multiplyLeft(t,e)}multiply(t,e){return this.multiplyRight(t,e)}}const pe=new Q,me=new Q,ge=new Q,ye=new Q,we=new Q,ve=new Q,_e=new Q,Te=0,be=1,Ee=2,Me=3,Se=4,xe=5,Ce=6,Ae=7,Re=8;class Oe{constructor(t=[0,0,0],e=[0,0,0,0,0,0,0,0,0]){this.center=(new Q).from(t),this.halfAxes=new $t(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new Q(t).len(),new Q(e).len(),new Q(r).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),i=new Q(t).normalize(),s=new Q(e).normalize(),n=new Q(r).normalize();return(new fe).fromMatrix3(new $t([...i,...s,...n]))}fromCenterHalfSizeQuaternion(t,e,r){const i=new fe(r),s=(new $t).fromQuaternion(i);return s[0]=s[0]*e[0],s[1]=s[1]*e[0],s[2]=s[2]*e[0],s[3]=s[3]*e[1],s[4]=s[4]*e[1],s[5]=s[5]*e[1],s[6]=s[6]*e[2],s[7]=s[7]*e[2],s[8]=s[8]*e[2],this.center=(new Q).from(t),this.halfAxes=s,this}clone(){return new Oe(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new jt){const e=this.halfAxes,r=e.getColumn(0,ge),i=e.getColumn(1,ye),s=e.getColumn(2,we),n=pe.copy(r).add(i).add(s);return t.center.copy(this.center),t.radius=n.magnitude(),t}intersectPlane(t){const e=this.center,r=t.normal,i=this.halfAxes,s=r.x,n=r.y,o=r.z,a=Math.abs(s*i[Te]+n*i[be]+o*i[Ee])+Math.abs(s*i[Me]+n*i[Se]+o*i[xe])+Math.abs(s*i[Ce]+n*i[Ae]+o*i[Re]),h=r.dot(e)+t.distance;return h<=-a?qt.OUTSIDE:h>=a?qt.INSIDE:qt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=me.from(t).subtract(this.center),r=this.halfAxes,i=r.getColumn(0,ge),s=r.getColumn(1,ye),n=r.getColumn(2,we),o=i.magnitude(),a=s.magnitude(),h=n.magnitude();i.normalize(),s.normalize(),n.normalize();let c,u=0;return c=Math.abs(e.dot(i))-o,c>0&&(u+=c*c),c=Math.abs(e.dot(s))-a,c>0&&(u+=c*c),c=Math.abs(e.dot(n))-h,c>0&&(u+=c*c),u}computePlaneDistances(t,e,r=[-0,-0]){let i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;const n=this.center,o=this.halfAxes,a=o.getColumn(0,ge),h=o.getColumn(1,ye),c=o.getColumn(2,we),u=ve.copy(a).add(h).add(c).add(n),l=_e.copy(u).subtract(t);let d=e.dot(l);return i=Math.min(d,i),s=Math.max(d,s),u.copy(n).add(a).add(h).subtract(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),u.copy(n).add(a).subtract(h).add(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),u.copy(n).add(a).subtract(h).subtract(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),n.copy(u).subtract(a).add(h).add(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),n.copy(u).subtract(a).add(h).subtract(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),n.copy(u).subtract(a).subtract(h).add(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),n.copy(u).subtract(a).subtract(h).subtract(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),r[0]=i,r[1]=s,r}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,ge);e.transformAsPoint(t);const r=this.halfAxes.getColumn(1,ye);r.transformAsPoint(t);const i=this.halfAxes.getColumn(2,we);return i.transformAsPoint(t),this.halfAxes=new $t([...e,...r,...i]),this}getTransform(){throw new Error("not implemented")}}const Le=new Q,ke=new Q;class Ne{constructor(t=[0,0,1],e=0){this.normal=new Q,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return s(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=Le.from(t),this.normal.from(e).normalize();const r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,e,r,i){return this.normal.set(t,e,r),s(p(this.normal.len(),1)),this.distance=i,this}clone(t){return new Ne(this.normal,this.distance)}equals(t){return p(this.distance,t.distance)&&p(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=ke.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,e)}projectPointOntoPlane(t,e=[0,0,0]){t=Le.from(t);const r=this.getPointDistance(t),i=ke.copy(this.normal).scale(r);return t.subtract(i).to(e)}}const Ie=[new Q([1,0,0]),new Q([0,1,0]),new Q([0,0,1])],Pe=new Q,qe=new Q;new Ne(new Q(1,0,0),0);class De{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(t=[]){this.planes=t,s(this.planes.every(t=>t instanceof Ne))}fromBoundingSphere(t){this.planes.length=2*Ie.length;const e=t.center,r=t.radius;let i=0;for(const t of Ie){let s=this.planes[i],n=this.planes[i+1];s||(s=this.planes[i]=new Ne),n||(n=this.planes[i+1]=new Ne);const o=Pe.copy(t).scale(-r).add(e);t.dot(o);s.fromPointNormal(o,t);const a=Pe.copy(t).scale(r).add(e),h=qe.copy(t).negate();h.dot(a);n.fromPointNormal(a,h),i+=2}return this}computeVisibility(t){s(t);let e=qt.INSIDE;for(const r of this.planes){switch(t.intersectPlane(r)){case qt.OUTSIDE:return qt.OUTSIDE;case qt.INTERSECTING:e=qt.INTERSECTING}}return e}computeVisibilityWithPlaneMask(t,e){if(s(t,"boundingVolume is required."),s(Number.isFinite(e),"parentPlaneMask is required."),e===De.MASK_OUTSIDE||e===De.MASK_INSIDE)return e;let r=De.MASK_INSIDE;const i=this.planes;for(let s=0;s<this.planes.length;++s){const n=s<31?1<<s:0;if(s<31&&0==(e&n))continue;const o=i[s],a=t.intersectPlane(o);if(a===qt.OUTSIDE)return De.MASK_OUTSIDE;a===qt.INTERSECTING&&(r|=n)}return r}}new Q,new Q,new Q,new Q,new Q;new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q,Math.PI;new $t,new $t,new $t,new $t,new $t;new Q,new Q,new Q,new Q,new Q,new $t,new $t,new $t;const Ve=new Q,je=new Q,ze=new De([new Ne,new Ne,new Ne,new Ne,new Ne,new Ne]);function Ue(t,e){const{cameraDirection:r,cameraUp:i,height:s}=t,{metersPerUnit:n}=t.distanceScales,o=[t.longitude,t.latitude,0],a=vt.WGS84.cartographicToCartesian(o,new Q),h=vt.WGS84.eastNorthUpToFixedFrame(a),c=t.unprojectPosition(t.cameraPosition),u=vt.WGS84.cartographicToCartesian(c,new Q),l=new Q(h.transformAsVector(new Q(r).scale(n))).normalize(),d=new Q(h.transformAsVector(new Q(i).scale(n))).normalize();return function(t,e){const r=t.getFrustumPlanes();let i=0;for(const s in r){const n=r[s],o=n.normal.dot(t.center);je.copy(n.normal).scale(n.distance-o).add(t.center);const a=t.unprojectPosition(je),h=vt.WGS84.cartographicToCartesian(a,new Q);ze.planes[i++].fromPointNormal(h,Ve.copy(e).subtract(h))}}(t,a),{camera:{position:u,direction:l,up:d},viewport:t,height:s,cullingVolume:ze,frameNumber:e,sseDenominator:1.15}}const Fe=new Q;function Be(t){const{halfAxes:e,radius:r,width:i,height:s}=t;if(e){const t=function(t){t.getColumn(0,Fe);const e=t.getColumn(1),r=t.getColumn(2),i=Fe.add(e).add(r);return i.len()}(e);return Math.log2(6356752.314245179/t)}if(r)return Math.log2(6356752.314245179/r);if(s&&i){return(Math.log2(6378137/i)+Math.log2(6378137/s))/2}return 1}const We=t=>"boolean"==typeof t,Ge=t=>"function"==typeof t,$e=t=>null!==t&&"object"==typeof t,Qe=t=>$e(t)&&t.constructor==={}.constructor,Ye=t=>t&&"function"==typeof t[Symbol.iterator],He=t=>t&&"function"==typeof t[Symbol.asyncIterator],Ke=t=>"undefined"!=typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,Ze=t=>"undefined"!=typeof Blob&&t instanceof Blob,Xe=t=>(t=>"undefined"!=typeof ReadableStream&&t instanceof ReadableStream||$e(t)&&Ge(t.tee)&&Ge(t.cancel)&&Ge(t.getReader))(t)||(t=>$e(t)&&Ge(t.read)&&Ge(t.pipe)&&We(t.readable))(t);function Je(t){var e;if(!t)return!1;Array.isArray(t)&&(t=t[0]);return Array.isArray(null===(e=t)||void 0===e?void 0:e.extensions)}function tr(t){var e,r;let i;return Et(t,"null loader"),Et(Je(t),"invalid loader"),Array.isArray(t)&&(i=t[1],t=t[0],t={...t,options:{...t.options,...i}}),(null!==(e=t)&&void 0!==e&&e.parseTextSync||null!==(r=t)&&void 0!==r&&r.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}let er="";const rr={};const ir=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,sr=/^([-\w.]+\/[-\w.+]+)/;function nr(t){const e=sr.exec(t);return e?e[1]:t}function or(t){const e=ir.exec(t);return e?e[1]:""}const ar=/\?.*/;function hr(t){if(Ke(t)){const e=cr(t.url||"");return{url:e,type:nr(t.headers.get("content-type")||"")||or(e)}}return Ze(t)?{url:cr(t.name||""),type:t.type||""}:"string"==typeof t?{url:cr(t),type:or(t)}:{url:"",type:""}}function cr(t){return t.replace(ar,"")}async function ur(t){if(Ke(t))return t;const e={},r=function(t){return Ke(t)?t.headers["content-length"]||-1:Ze(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}(t);r>=0&&(e["content-length"]=String(r));const{url:i,type:s}=hr(t);s&&(e["content-type"]=s);const n=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 r=new FileReader;r.onload=e=>{var r;return t(null==e||null===(r=e.target)||void 0===r?void 0:r.result)},r.readAsDataURL(e)})}if(t instanceof ArrayBuffer){const e=t.slice(0,5);return"data:base64,"+function(t){let e="";const r=new Uint8Array(t);for(let t=0;t<r.byteLength;t++)e+=String.fromCharCode(r[t]);return btoa(e)}(e)}return null}(t);n&&(e["x-first-bytes"]=n),"string"==typeof t&&(t=(new TextEncoder).encode(t));const o=new Response(t,{headers:e});return Object.defineProperty(o,"url",{value:i}),o}async function lr(t){if(!t.ok){const e=await async function(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{const r=t.headers.get("Content-Type");let i=t.statusText;r.includes("application/json")&&(i+=" "+await t.text()),e+=i,e=e.length>60?e.slice(60)+"...":e}catch(t){}return e}(t);throw new Error(e)}}async function dr(t,e){if("string"==typeof t){t=function(t){for(const e in rr)if(t.startsWith(e)){const r=rr[e];t=t.replace(e,r)}return t.startsWith("http://")||t.startsWith("https://")||(t=`${er}${t}`),t}(t);let r=e;return null!=e&&e.fetch&&"function"!=typeof(null==e?void 0:e.fetch)&&(r=e.fetch),await fetch(t,r)}return await ur(t)}var fr=r(14);const pr=Object(fr.a)();class mr{constructor(t,e,r="sessionStorage"){this.storage=function(t){try{const e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch(t){return null}}(r),this.id=t,this.config={},Object.assign(this.config,e),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){return this.config={},this.updateConfiguration(t)}updateConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}_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 gr(t,e,r,i=600){const s=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>i&&(r=Math.min(r,i/t.width));const n=t.width*r,o=t.height*r,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(n/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(s,");"),"background-size:".concat(n,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}const yr={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function wr(t){return"string"==typeof t?yr[t.toUpperCase()]||yr.WHITE:t}function vr(t,e){if(!t)throw new Error(e||"Assertion failed")}var _r=r(2);function Tr(){let t;if(pr&&_r.b.performance)t=_r.b.performance.now();else if(_r.a.hrtime){const e=_r.a.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}const br={debug:pr&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Er={enabled:!0,level:0};function Mr(){}const Sr={},xr={once:!0};function Cr(t){for(const e in t)for(const r in t[e])return r||"untitled";return"empty"}class Ar{constructor({id:t}={id:""}){this.id=t,this.VERSION="3.1.0-alpha.4",this._startTs=Tr(),this._deltaTs=Tr(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new mr("__probe-".concat(this.id,"__"),Er),this.userData={},this.timeStamp("".concat(this.id," started")),function(t,e=["constructor"]){const r=Object.getPrototypeOf(t),i=Object.getOwnPropertyNames(r);for(const r of i)"function"==typeof t[r]&&(e.find(t=>r===t)||(t[r]=t[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((Tr()-this._startTs).toPrecision(10))}getDelta(){return Number((Tr()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.updateConfiguration({enabled:t}),this}setLevel(t){return this._storage.updateConfiguration({level:t}),this}assert(t,e){vr(t,e)}warn(t){return this._getLogFunction(0,t,br.warn,arguments,xr)}error(t){return this._getLogFunction(0,t,br.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,br.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,br.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,br.debug||br.info,arguments,xr)}table(t,e,r){return e?this._getLogFunction(t,e,console.table||Mr,r&&[r],{tag:Cr(e)}):Mr}image({logLevel:t,priority:e,image:i,message:s="",scale:n=1}){return this._shouldLog(t||e)?pr?function({image:t,message:e="",scale:r=1}){if("string"==typeof t){const i=new Image;return i.onload=()=>{const t=gr(i,e,r);console.log(...t)},i.src=t,Mr}const i=t.nodeName||"";if("img"===i.toLowerCase())return console.log(...gr(t,e,r)),Mr;if("canvas"===i.toLowerCase()){const i=new Image;return i.onload=()=>console.log(...gr(i,e,r)),i.src=t.toDataURL(),Mr}return Mr}({image:i,message:s,scale:n}):function({image:t,message:e="",scale:i=1}){let s=null;try{s=r(24)}catch(t){}if(s)return()=>s(t,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then(t=>console.log(t));return Mr}({image:i,message:s,scale:n}):Mr}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(t){return this._storage.config[t]}set(t,e){this._storage.updateConfiguration({[t]:e})}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||Mr)}group(t,e,r={collapsed:!1}){r=Or({logLevel:t,message:e,opts:r});const{collapsed:i}=r;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e,r={}){return this.group(t,e,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Mr)}withGroup(t,e,r){this.group(t,e)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Rr(t)}_getLogFunction(t,e,r,i=[],s){if(this._shouldLog(t)){s=Or({logLevel:t,message:e,args:i,opts:s}),vr(r=r||s.method),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=Tr();const n=s.tag||s.message;if(s.once){if(Sr[n])return Mr;Sr[n]=Tr()}return e=function(t,e,r){if("string"==typeof e){const o=r.time?function(t,e=8){const r=Math.max(e-t.length,0);return"".concat(" ".repeat(r)).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}(r.total)):"";e=r.time?"".concat(t,": ").concat(o," ").concat(e):"".concat(t,": ").concat(e),i=e,s=r.color,n=r.background,pr||"string"!=typeof i||(s&&(s=wr(s),i="[".concat(s,"m").concat(i,"[39m")),n&&(s=wr(n),i="[".concat(n+10,"m").concat(i,"[49m"))),e=i}var i,s,n;return e}(this.id,s.message,s),r.bind(console,e,...s.args)}return Mr}}function Rr(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 vr(Number.isFinite(e)&&e>=0),e}function Or(t){const{logLevel:e,message:r}=t;t.logLevel=Rr(e);const i=t.args?Array.from(t.args):[];for(;i.length&&i.shift()!==r;);switch(t.args=i,typeof e){case"string":case"function":void 0!==r&&i.unshift(r),t.message=e;break;case"object":Object.assign(t,e)}"function"==typeof t.message&&(t.message=t.message());const s=typeof t.message;return vr("string"===s||"object"===s),Object.assign(t,t.opts)}Ar.VERSION="3.1.0-alpha.4";const Lr=new Ar({id:"loaders.gl"});class kr{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const Nr={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){var t,e,r;r=void 0,(e="console")in(t=this)?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},Ir={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 Pr(){globalThis.loaders=globalThis.loaders||{};const{loaders:t}=globalThis;return t._state=t._state||{},t._state}const qr=()=>{const t=Pr();return t.globalOptions=t.globalOptions||{...Nr},t.globalOptions};function Dr(t,e,r,i){return r=r||[],function(t,e){jr(t,null,Nr,Ir,e);for(const r of e){const i=t&&t[r.id]||{},s=r.options&&r.options[r.id]||{},n=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};jr(i,r.id,s,n,e)}}(t,r=Array.isArray(r)?r:[r]),Ur(e,t,i)}function Vr(t,e){const r=qr(),i=t||r;return"function"==typeof i.fetch?i.fetch:$e(i.fetch)?t=>dr(t,i):null!=e&&e.fetch?null==e?void 0:e.fetch:dr}function jr(t,e,r,i,s){const n=e||"Top level",o=e?e+".":"";for(const a in t){const h=!e&&$e(t[a]),c="baseUri"===a&&!e,u="workerUrl"===a&&e;if(!(a in r)&&!c&&!u)if(a in i)Lr.warn(`${n} loader option '${o}${a}' no longer supported, use '${i[a]}'`)();else if(!h){const t=zr(a,s);Lr.warn(`${n} loader option '${o}${a}' not recognized. ${t}`)()}}}function zr(t,e){const r=t.toLowerCase();let i="";for(const s of e)for(const e in s.options){if(t===e)return`Did you mean '${s.id}.${e}'?`;const n=e.toLowerCase();(r.startsWith(n)||n.startsWith(r))&&(i=i||`Did you mean '${s.id}.${e}'?`)}return i}function Ur(t,e,r){const i={...t.options||{}};return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(i,r),null===i.log&&(i.log=new kr),Fr(i,qr()),Fr(i,e),i}function Fr(t,e){for(const r in e)if(r in e){const i=e[r];Qe(i)&&Qe(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function Br(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var Wr=r(16);const Gr=new Map;function $r(t){Br(t.source&&!t.url||!t.source&&t.url);let e=Gr.get(t.source||t.url);return e||(t.url&&(e=function(t){if(!t.startsWith("http"))return t;return Qr((e=t,`try {\n importScripts('${e}');\n} catch (error) {\n console.error(error);\n throw error;\n}`));var e}(t.url),Gr.set(t.url,e)),t.source&&(e=Qr(t.source),Gr.set(t.source,e))),Br(e),e}function Qr(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function Yr(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&t instanceof MessagePort||("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}function Hr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const Kr=()=>{};class Zr{static isSupported(){return"undefined"!=typeof Worker}constructor(t){Hr(this,"name",void 0),Hr(this,"source",void 0),Hr(this,"url",void 0),Hr(this,"terminated",!1),Hr(this,"worker",void 0),Hr(this,"onMessage",void 0),Hr(this,"onError",void 0),Hr(this,"_loadableURL","");const{name:e,source:r,url:i}=t;Br(r||i),this.name=e,this.source=r,this.url=i,this.onMessage=Kr,this.onError=t=>console.log(t),this.worker=this._createBrowserWorker()}destroy(){this.onMessage=Kr,this.onError=Kr,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||function t(e,r=!0,i){const s=i||new Set;if(e){if(Yr(e))s.add(e);else if(Yr(e.buffer))s.add(e.buffer);else if(ArrayBuffer.isView(e));else if(r&&"object"==typeof e)for(const i in e)t(e[i],r,s)}else;return void 0===i?Array.from(s):[]}(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=$r({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}}function Xr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class Jr{constructor(t,e){Xr(this,"name",void 0),Xr(this,"workerThread",void 0),Xr(this,"isRunning",void 0),Xr(this,"result",void 0),Xr(this,"_resolve",void 0),Xr(this,"_reject",void 0),this.name=t,this.workerThread=e,this.isRunning=!0,this._resolve=()=>{},this._reject=()=>{},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){Br(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Br(this.isRunning),this.isRunning=!1,this._reject(t)}}function ti(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class ei{constructor(t){ti(this,"name","unnamed"),ti(this,"source",void 0),ti(this,"url",void 0),ti(this,"maxConcurrency",1),ti(this,"maxMobileConcurrency",1),ti(this,"onDebug",()=>{}),ti(this,"reuseWorkers",!0),ti(this,"props",{}),ti(this,"jobQueue",[]),ti(this,"idleQueue",[]),ti(this,"count",0),ti(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,e=((t,e,r)=>t.done(r)),r=((t,e)=>t.error(e))){const i=new Promise(i=>(this.jobQueue.push({name:t,onMessage:e,onError:r,onStart:i}),this));return this._startQueuedJob(),await i}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 r=new Jr(e.name,t);t.onMessage=t=>e.onMessage(r,t.type,t.payload),t.onError=t=>e.onError(r,t),e.onStart(r);try{await r.result}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){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 Zr({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Wr.a?this.maxMobileConcurrency:this.maxConcurrency}}function ri(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const ii={maxConcurrency:3,maxMobileConcurrency:1,onDebug:()=>{},reuseWorkers:!0};class si{static isSupported(){return Zr.isSupported()}static getWorkerFarm(t={}){return si._workerFarm=si._workerFarm||new si({}),si._workerFarm.setProps(t),si._workerFarm}constructor(t){ri(this,"props",void 0),ri(this,"workerPools",new Map),this.props={...ii},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy()}setProps(t){this.props={...this.props,...t};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:r,url:i}=t;let s=this.workerPools.get(e);return s||(s=new ei({name:e,source:r,url:i}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}ri(si,"_workerFarm",void 0);async function ni(t,e,r,i,s){const n=t.id,o=function(t,e={}){const r=e[t.id]||{},i=t.id+"-worker.js";let s=r.workerUrl;if("test"===e._workerType&&(s=`modules/${t.module}/dist/${i}`),!s){let e=t.version;"latest"===e&&(e="beta");const r=e?"@"+e:"";s=`https://unpkg.com/@loaders.gl/${t.module}${r}/dist/${i}`}return Br(s),s}(t,r),a=si.getWorkerFarm(r).getWorkerPool({name:n,url:o});r=JSON.parse(JSON.stringify(r));const h=await a.startJob("process-on-worker",oi.bind(null,s));h.postMessage("process",{input:e,options:r});const c=await h.result;return await c.result}async function oi(t,e,r,i){switch(r){case"done":e.done(i);break;case"error":e.error(i.error);break;case"process":const{id:s,input:n,options:o}=i;try{const r=await t(n,o);e.postMessage("done",{id:s,result:r})}catch(t){const r=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:s,error:r})}break;default:console.warn("parse-with-worker unknown message "+r)}}r(10);function ai(t){return t&&"object"==typeof t&&t.isBuffer}function hi(t){if(ai(t))return function(t){if(ai(t)){return new Uint8Array(t.buffer,t.byteOffset,t.length).slice().buffer}return t}(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")}async function ci(t){const e=[];for await(const r of t)e.push(r);return function(...t){const e=t.map(t=>t instanceof ArrayBuffer?new Uint8Array(t):t),r=e.reduce((t,e)=>t+e.byteLength,0),i=new Uint8Array(r);let s=0;for(const t of e)i.set(t,s),s+=t.byteLength;return i.buffer}(...e)}const ui=262144;var li=r(1);function di(t,e){return li.a?async function*(t,e){const r=t.getReader();let i;try{for(;;){const t=i||r.read();null!=e&&e._streamReadAhead&&(i=r.read());const{done:s,value:n}=await t;if(s)return;yield hi(n)}}catch(t){r.releaseLock()}}(t,e):async function*(t,e){for await(const e of t)yield hi(e)}(t)}function fi(t,e){if("string"==typeof t)return function*(t,e){const r=(null==e?void 0:e.chunkSize)||262144;let i=0;const s=new TextEncoder;for(;i<t.length;){const e=Math.min(t.length-i,r),n=t.slice(i,i+e);i+=e,yield s.encode(n)}}(t,e);if(t instanceof ArrayBuffer)return function*(t,e={}){const{chunkSize:r=ui}=e;let i=0;for(;i<t.byteLength;){const e=Math.min(t.byteLength-i,r),s=new ArrayBuffer(e),n=new Uint8Array(t,i,e);new Uint8Array(s).set(n),i+=e,yield s}}(t,e);if(Ze(t))return async function*(t,e){const r=(null==e?void 0:e.chunkSize)||1048576;let i=0;for(;i<t.size;){const e=i+r,s=await t.slice(i,e).arrayBuffer();i=e,yield s}}(t,e);if(Xe(t))return di(t,e);if(Ke(t)){return di(t.body,e)}throw new Error("makeIterator")}const pi="Cannot convert supplied data type";async function mi(t,e,r){const i=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if("string"==typeof t||i)return function(t,e,r){if(e.text&&"string"==typeof t)return t;var i;if((i=t)&&"object"==typeof i&&i.isBuffer&&(t=t.buffer),t instanceof ArrayBuffer){const r=t;if(e.text&&!e.binary){return new TextDecoder("utf8").decode(r)}return r}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary){return new TextDecoder("utf8").decode(t)}let r=t.buffer;const i=t.byteLength||t.length;return 0===t.byteOffset&&i===r.byteLength||(r=r.slice(t.byteOffset,t.byteOffset+i)),r}throw new Error(pi)}(t,e);if(Ze(t)&&(t=await ur(t)),Ke(t)){const r=t;return await lr(r),e.binary?await r.arrayBuffer():await r.text()}if(Xe(t)&&(t=fi(t,r)),Ye(t)||He(t))return ci(t);throw new Error(pi)}const gi=()=>{const t=Pr();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};const yi=/\.([^.]+)$/;function wi(t,e=[],r,i){if(!vi(t))return null;if(e&&!Array.isArray(e))return tr(e);let s=[];e&&(s=s.concat(e)),null!=r&&r.ignoreRegisteredLoaders||s.push(...gi()),function(t){for(const e of t)tr(e)}(s);const n=function(t,e,r,i){const{url:s,type:n}=hr(t),o=s||(null==i?void 0:i.url);let a=null;null!=r&&r.mimeType&&(a=Ti(e,null==r?void 0:r.mimeType));return a=a||function(t,e){const r=e&&yi.exec(e),i=r&&r[1];return i?function(t,e){e=e.toLowerCase();for(const r of t)for(const t of r.extensions)if(t.toLowerCase()===e)return r;return null}(t,i):null}(e,o),a=a||Ti(e,n),a=a||function(t,e){if(!e)return null;for(const r of t)if("string"==typeof e){if(bi(e,r))return r}else if(ArrayBuffer.isView(e)){if(Ei(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer){if(Ei(e,0,r))return r}return null}(e,t),a=a||Ti(e,null==r?void 0:r.fallbackMimeType),a}(t,s,r,i);if(!(n||null!=r&&r.nothrow))throw new Error(_i(t));return n}function vi(t){return!(t instanceof Response&&204===t.status)}function _i(t){const{url:e,type:r}=hr(t);let s="No valid loader found (";s+=e?i.filename(e)+", ":"no url provided, ",s+=`MIME type: ${r?`"${r}"`:"not provided"}, `;const n=t?function(t,e=5){if("string"==typeof t)return t.slice(0,e);if(ArrayBuffer.isView(t))return Mi(t.buffer,t.byteOffset,e);if(t instanceof ArrayBuffer){return Mi(t,0,e)}return""}(t):"";return s+=n?` first bytes: "${n}"`:"first bytes: not available",s+=")",s}function Ti(t,e){for(const r of t){if(r.mimeTypes&&r.mimeTypes.includes(e))return r;if(e==="application/x."+r.id)return r}return null}function bi(t,e){if(e.testText)return e.testText(t);return(Array.isArray(e.tests)?e.tests:[e.tests]).some(e=>t.startsWith(e))}function Ei(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>function(t,e,r,i){if(i instanceof ArrayBuffer)return function(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;const i=new Uint8Array(t),s=new Uint8Array(e);for(let t=0;t<i.length;++t)if(i[t]!==s[t])return!1;return!0}(i,t,i.byteLength);switch(typeof i){case"function":return i(t,r);case"string":const s=Mi(t,e,i.length);return i===s;default:return!1}}(t,e,r,i))}function Mi(t,e,r){if(t.byteLength<e+r)return"";const i=new DataView(t);let s="";for(let t=0;t<r;t++)s+=String.fromCharCode(i.getUint8(e+t));return s}async function Si(t,e,r,i){Br(!i||"object"==typeof i),!e||Array.isArray(e)||Je(e)||(i=void 0,r=e,e=void 0),t=await t,r=r||{};const{url:s}=hr(t),n=function(t,e){if(!e&&t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){const t=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...t]:t}return r&&r.length?r:null}(e,i),o=await async function(t,e=[],r,i){if(!vi(t))return null;let s=wi(t,e,{...r,nothrow:!0},i);if(s)return s;if(Ze(t)&&(s=wi(t=await t.slice(0,10).arrayBuffer(),e,r,i)),!(s||null!=r&&r.nothrow))throw new Error(_i(t));return s}(t,n,r);return o?(i=function(t,e,r=null){if(r)return r;const i={fetch:Vr(e,t),...t};return Array.isArray(i.loaders)||(i.loaders=null),i}({url:s,parse:Si,loaders:n},r=Dr(r,o,n,s),i),await async function(t,e,r,i){if(function(t,e="3.1.0-alpha.4"){Br(t,"no worker provided");const r=t.version}(t),e=await mi(e,t,r),t.parseTextSync&&"string"==typeof e)return r.dataType="text",t.parseTextSync(e,r,i,t);if(function(t,e){return!!si.isSupported()&&(t.worker&&(null==e?void 0:e.worker))}(t,r))return await ni(t,e,r,0,Si);if(t.parseText&&"string"==typeof e)return await t.parseText(e,r,i,t);if(t.parse)return await t.parse(e,r,i,t);throw Br(!t.parseSync),new Error(t.id+" loader - no parser found and worker is disabled")}(o,t,r,i)):null}async function xi(t,e,r,i){Array.isArray(e)||Je(e)||(void 0,r=e,e=void 0);const s=Vr(r);let n=t;return"string"==typeof t&&(n=await s(t)),Ze(t)&&(n=await s(t)),await Si(n,e,r)}const Ci={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Ai={ADD:1,REPLACE:2},Ri={EMPTY:"empty",SCENEGRAPH:"scenegraph",POINTCLOUD:"pointcloud",MESH:"mesh"},Oi={I3S:"I3S",TILES3D:"TILES3D"},Li={GEOMETRIC_ERROR:"geometricError",MAX_SCREEN_THRESHOLD:"maxScreenThreshold"},ki=1;function Ni(t){return null!=t}const Ii=new Q,Pi=new Q,qi=new Q;function Di(t,e,r){if(Et(t,"3D Tile: boundingVolume must be defined"),t.box)return function(t,e,r){const i=new Q(t[0],t[1],t[2]);e.transform(i,i);let s=[];if(10===t.length){const e=t.slice(3,6),r=new fe;r.fromArray(t,6);const i=new Q([1,0,0]),n=new Q([0,1,0]),o=new Q([0,0,1]);i.transformByQuaternion(r),i.scale(e[0]),n.transformByQuaternion(r),n.scale(e[1]),o.transformByQuaternion(r),o.scale(e[2]),s=[...i.toArray(),...n.toArray(),...o.toArray()]}else s=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];const n=e.transformAsVector(s.slice(0,3)),o=e.transformAsVector(s.slice(3,6)),a=e.transformAsVector(s.slice(6,9)),h=new $t([n[0],n[1],n[2],o[0],o[1],o[2],a[0],a[1],a[2]]);if(Ni(r))return r.center=i,r.halfAxes=h,r;return new Oe(i,h)}(t.box,e,r);if(t.region){const[e,r,i,s,n,o]=t.region,a=vt.WGS84.cartographicToCartesian([f(e),f(s),n],Pi),h=vt.WGS84.cartographicToCartesian([f(i),f(r),o],qi),c=(new Q).addVectors(a,h).multiplyScalar(.5),u=(new Q).subVectors(a,h).len()/2;return Vi([c[0],c[1],c[2],u],new B)}if(t.sphere)return Vi(t.sphere,e,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Vi(t,e,r){const i=new Q(t[0],t[1],t[2]);e.transform(i,i);const s=e.getScale(Ii),n=Math.max(Math.max(s[0],s[1]),s[2]),o=t[3]*n;return Ni(r)?(r.center=i,r.radius=o,r):new jt(i,o)}new Q,new Q,new B,new Q,new Q,new Q;function ji(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){const r=t.dynamicScreenSpaceErrorComputedDensity,i=t.dynamicScreenSpaceErrorFactor;return function(t,e){const r=t*e;return 1-Math.exp(-r*r)}(e,r)*i}return 0}const zi=Math.PI/2;function Ui([t,e,r]){const i=l(t),s=l(e),n=1+r/6378137,o=n*Math.cos(s);return[t=o*Math.cos(i),e=o*Math.sin(i),r=n*Math.sin(s)]}function Fi(t,e){const[r,i,s=0]=t,[n,o,a=0]=e,h=Ui([n,o,a]),c=Ui([r,i,s]),u=c[0]-h[0],l=c[1]-h[1],d=c[2]-h[2];return u*u+l*l+d*d}function Bi(t,e){const r=e.viewport,i=t.header.mbs[1],s=[t.header.mbs[0],i,t.header.mbs[2]],n=t.header.mbs[3]/6378137,o=Fi(r.unprojectPosition(r.cameraPosition),s)-n*n;if(o<=0)return 170141175e30;return function(t){const{projectionMatrix:e}=t.viewport;return e[5]}(e)*n/Math.sqrt(o)*300}class Wi{constructor(t=0){this._array=new Array(t),this._map=new Map,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 Et(t<this._array.length),this._array[t]}set(t,e){Et(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){Et(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){Et(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)}}function Gi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const $i={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class Qi{constructor(t){Gi(this,"options",void 0),Gi(this,"root",void 0),Gi(this,"requestedTiles",void 0),Gi(this,"selectedTiles",void 0),Gi(this,"emptyTiles",void 0),Gi(this,"_traversalStack",void 0),Gi(this,"_emptyTraversalStack",void 0),Gi(this,"_frameNumber",void 0),this.options={...$i,...t},this._traversalStack=new Wi,this._emptyTraversalStack=new Wi,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}traverse(t,e,r){this.root=t,this.options={...this.options,...r},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 r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){const t=r.pop();let i=!1;this.canTraverse(t,e)&&(this.updateChildTiles(t,e),i=this.updateAndPushChildren(t,e,r,t.hasRenderContent?t._selectionDepth+1:t._selectionDepth));const s=t.parent,n=Boolean(!s||s._shouldRefine),o=!i;t.hasRenderContent?t.refine===Ai.ADD?(this.loadTile(t,e),this.selectTile(t,e)):t.refine===Ai.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=i&&n}this.options.onTraversalEnd(e)}updateChildTiles(t,e){const r=t.children;for(const t of r)this.updateTile(t,e);return!0}updateAndPushChildren(t,e,r,i){const{loadSiblings:s,skipLevelOfDetail:n}=this.options,o=t.children;o.sort(this.compareDistanceToCamera.bind(this));const a=t.refine===Ai.REPLACE&&t.hasRenderContent&&!n;let h=!1,c=!0;for(const t of o)if(t._selectionDepth=i,t.isVisibleAndInRequestVolume?(r.find(t)&&r.delete(t),r.push(t),h=!0):(a||s)&&(this.loadTile(t,e),this.touchTile(t,e)),a){let r;if(r=!!t._inRequestVolume&&(t.hasRenderContent?t.contentAvailable:this.executeEmptyTraversal(t,e)),c=c&&r,!c)return!1}return h||(c=!1),c}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,r=!1,i=!1){return!!t.hasChildren&&(t.hasTilesetContent?!t.contentExpired:!(!i&&!t.isVisibleAndInRequestVolume)&&this.shouldRefine(t,e,r))}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,e,r){let i=t._screenSpaceError;return r&&(i=t.getScreenSpaceError(e,!0)),i>this.options.maximumScreenSpaceError}updateTileVisibility(t,e){const r=[];if(this.options.viewportTraversersMap)for(const t in this.options.viewportTraversersMap){this.options.viewportTraversersMap[t]===e.viewport.id&&r.push(t)}else r.push(e.viewport.id);t.updateVisibility(e,r)}compareDistanceToCamera(t,e){return t._distanceToCamera-e._distanceToCamera}anyChildrenVisible(t,e){let r=!1;for(const i of t.children)i.updateVisibility(e),r=r||i.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,e){let r=!0;const i=this._emptyTraversalStack;for(i.push(t);i.length>0&&r;){const t=i.pop();this.updateTile(t,e),t.isVisibleAndInRequestVolume||this.loadTile(t,e),this.touchTile(t,e);if(!t.hasRenderContent&&this.canTraverse(t,e,!1,!0)){const e=t.children;for(const t of e)i.find(t)&&i.delete(t),i.push(t)}else t.contentAvailable||(r=!1)}return r}}function Yi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const Hi=new Q;class Ki{constructor(t,e,r,i=""){Yi(this,"tileset",void 0),Yi(this,"header",void 0),Yi(this,"id",void 0),Yi(this,"url",void 0),Yi(this,"parent",void 0),Yi(this,"refine",void 0),Yi(this,"type",void 0),Yi(this,"contentUrl",void 0),Yi(this,"lodMetricType",void 0),Yi(this,"lodMetricValue",void 0),Yi(this,"boundingVolume",void 0),Yi(this,"content",void 0),Yi(this,"contentState",void 0),Yi(this,"gpuMemoryUsageInBytes",void 0),Yi(this,"children",void 0),Yi(this,"depth",void 0),Yi(this,"viewportIds",void 0),Yi(this,"transform",void 0),Yi(this,"userData",void 0),Yi(this,"computedTransform",void 0),Yi(this,"hasEmptyContent",void 0),Yi(this,"hasTilesetContent",void 0),Yi(this,"traverser",void 0),Yi(this,"_cacheNode",void 0),Yi(this,"_frameNumber",void 0),Yi(this,"_lodJudge",void 0),Yi(this,"_expireDate",void 0),Yi(this,"_expiredContent",void 0),Yi(this,"_shouldRefine",void 0),Yi(this,"_distanceToCamera",void 0),Yi(this,"_centerZDepth",void 0),Yi(this,"_screenSpaceError",void 0),Yi(this,"_visibilityPlaneMask",void 0),Yi(this,"_visible",void 0),Yi(this,"_inRequestVolume",void 0),Yi(this,"_stackLength",void 0),Yi(this,"_selectionDepth",void 0),Yi(this,"_touchedFrame",void 0),Yi(this,"_visitedFrame",void 0),Yi(this,"_selectedFrame",void 0),Yi(this,"_requestedFrame",void 0),Yi(this,"_priority",void 0),Yi(this,"_contentBoundingVolume",void 0),Yi(this,"_viewerRequestVolume",void 0),Yi(this,"_initialTransform",void 0),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.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=Ci.UNLOADED,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new Qi({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new B,this.transform=new B,this._initializeLodMetric(e),this._initializeTransforms(e),this._initializeBoundingVolumes(e),this._initializeContent(e),this._initializeRenderingState(e),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,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 this.contentState===Ci.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===Ci.UNLOADED}get contentExpired(){return this.contentState===Ci.EXPIRED}get contentFailed(){return this.contentState===Ci.FAILED}getScreenSpaceError(t,e){switch(this.tileset.type){case Oi.I3S:return Bi(this,t);case Oi.TILES3D:return function(t,e,r){const i=t.tileset,s=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,n=r?s:t.lodMetricValue;if(0===n)return 0;const o=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:h}=e,{viewDistanceScale:c}=i.options;let u=n*a*(c||1)/(o*h);return u-=ji(i,o),u}(this,t,e);default:throw new Error("Unsupported tileset type")}}_getPriority(){const t=this.tileset._traverser,{skipLevelOfDetail:e}=t.options,r=this.refine===Ai.ADD||e;if(r&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===Ci.UNLOADED)return-1;const i=this.parent,s=i&&(!r||0===this._screenSpaceError||i.hasTilesetContent)?i._screenSpaceError:this._screenSpaceError,n=t.root?t.root._screenSpaceError:0;return Math.max(n-s,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=Ci.LOADING;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=Ci.UNLOADED,!1;try{const e=this.tileset.getTileUrl(this.contentUrl),r=this.tileset.loader,i={...this.tileset.loadOptions,[r.id]:{...this.tileset.loadOptions[r.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(r.id)}};return this.content=await xi(e,r,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Ci.READY,this._onContentLoaded(),!0}catch(t){throw this.contentState=Ci.FAILED,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=Ci.UNLOADED,!0}updateVisibility(t,e){if(this._frameNumber===t.frameNumber)return;const r=this.parent,i=r?r._visibilityPlaneMask:De.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const t=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(t)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,i),this._visible=this._visibilityPlaneMask!==De.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=e}visibility(t,e){const{cullingVolume:r}=t,{boundingVolume:i}=this;return r.computeVisibilityWithPlaneMask(i,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 Hi.subVectors(e.center,t.position),t.direction.dot(Hi)}insideViewerRequestVolume(t){const e=this._viewerRequestVolume;return!e||e.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(null!=this._expireDate&&this.contentReady&&!this.hasEmptyContent){const t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=Ci.EXPIRED,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 B(t.transform):new B;const e=this.parent,r=this.tileset,i=e&&e.computedTransform?e.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new B(i).multiplyRight(this.transform);const s=e&&e._initialTransform?e._initialTransform.clone():new B;this._initialTransform=new B(s).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=Ci.UNLOADED,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=De.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||Ai.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)}_updateBoundingVolume(t){this.boundingVolume=Di(t.boundingVolume,this.computedTransform,this.boundingVolume);const e=t.content;e&&(e.boundingVolume&&(this._contentBoundingVolume=Di(e.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Di(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new B){const e=t.clone().multiplyRight(this.transform);!e.equals(this.computedTransform)&&(this.computedTransform=e,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){case"i3s":return{...this.tileset.options.i3s,tile:this.header,tileset:this.tileset.tileset,isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return{assetGltfUpAxis:(e=this.tileset.tileset).asset&&e.asset.gltfUpAxis||"Y"}}var e}}class Zi extends Qi{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 r=t.children.length>0;if(t.hasTilesetContent&&r){const r=t.children[0];return this.updateTileVisibility(r,e),void(t._visible=r._visible)}if(this.meetsScreenSpaceErrorEarly(t,e))return void(t._visible=!1);const i=t.refine===Ai.REPLACE,s=t._optimChildrenWithinParent===ki;i&&s&&r&&!this.anyChildrenVisible(t,e)&&(t._visible=!1)}meetsScreenSpaceErrorEarly(t,e){const{parent:r}=t;return!(!r||r.hasTilesetContent||r.refine!==Ai.ADD)&&!this.shouldRefine(t,e,!0)}}const Xi="REQUESTED",Ji="COMPLETED",ts="ERROR";class es{constructor(){var t,e,r;r=void 0,(e="_statusMap")in(t=this)?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,this._statusMap={}}add(t,e,r,i){this._statusMap[e]||(this._statusMap[e]={request:t,callback:r,key:e,frameState:i,status:Xi},t().then(t=>{this._statusMap[e].status=Ji,this._statusMap[e].callback(t,i)}).catch(t=>{this._statusMap[e].status=ts,r(t)}))}update(t,e){this._statusMap[t]&&(this._statusMap[t].frameState=e)}find(t){return this._statusMap[t]}}class rs extends Qi{constructor(t){var e,r,i;super(t),i=void 0,(r="_tileManager")in(e=this)?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,this._tileManager=new es}shouldRefine(t,e){return t._lodJudge=function(t,e){const r=e.viewport,i=r.metersPerPixel,s=t.header.mbs[1],n=t.header.mbs[0],o=t.header.mbs[2],a=t.header.mbs[3],{height:h,width:c,latitude:u,longitude:l}=r,d=[l,u],f=[n,s,o],p=[l,s],m=[n,u],g=Math.sqrt(h*h+c*c)*i[0],y=.5*h+a/6378137,w=.5*c+a/6378137;if(Fi(d,f)>g+a/6378137)return"OUT";if(Fi(d,p)>y)return"OUT";if(Fi(d,m)>w)return"OUT";if(0===t.lodMetricValue)return"DIG";let v=Bi(t,e);return v*=zi,v<.5?"OUT":!t.header.children||v<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}(t,e),"DIG"===t._lodJudge}updateChildTiles(t,e){const r=t.header.children||[],i=t.children,s=t.tileset;for(const n of r){const r=`${n.id}-${e.viewport.id}`,o=i&&i.find(t=>t.id===r);if(o)o&&this.updateTile(o,e);else{let i=()=>this._loadTile(n.id,s);this._tileManager.find(r)?this._tileManager.update(r,e):(s.tileset.nodePages&&(i=()=>s.tileset.nodePagesTile.formTileFromNodePages(n.id)),this._tileManager.add(i,r,e=>this._onTileLoad(e,t,r),e))}}return!1}async _loadTile(t,e){const{loader:r}=e,i=e.getTileUrl(`${e.url}/nodes/${t}`),s={...e.loadOptions,i3s:{...e.loadOptions.i3s,isTileHeader:!0,loadContent:!1}};return await xi(i,r,s)}_onTileLoad(t,e,r){const i=new Ki(e.tileset,t,e,r);e.children.push(i);const s=this._tileManager.find(i.id).frameState;this.updateTile(i,s),this._frameNumber===s.frameNumber&&this.executeTraversal(i,s)}}function is(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const ss={description:"",ellipsoid:vt.WGS84,modelMatrix:new B,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}};class ns{constructor(t,e){is(this,"options",void 0),is(this,"loadOptions",void 0),is(this,"type",void 0),is(this,"tileset",void 0),is(this,"loader",void 0),is(this,"url",void 0),is(this,"basePath",void 0),is(this,"modelMatrix",void 0),is(this,"ellipsoid",void 0),is(this,"lodMetricType",void 0),is(this,"lodMetricValue",void 0),is(this,"refine",void 0),is(this,"root",void 0),is(this,"roots",void 0),is(this,"asset",void 0),is(this,"description",void 0),is(this,"properties",void 0),is(this,"extras",void 0),is(this,"attributions",void 0),is(this,"credits",void 0),is(this,"stats",void 0),is(this,"traverseCounter",void 0),is(this,"geometricError",void 0),is(this,"selectedTiles",void 0),is(this,"cartographicCenter",void 0),is(this,"cartesianCenter",void 0),is(this,"zoom",void 0),is(this,"boundingVolume",void 0),is(this,"gpuMemoryUsageInBytes",void 0),is(this,"dynamicScreenSpaceErrorComputedDensity",void 0),is(this,"_traverser",void 0),is(this,"_cache",void 0),is(this,"_requestScheduler",void 0),is(this,"_frameNumber",void 0),is(this,"_queryParamsString",void 0),is(this,"_queryParams",void 0),is(this,"_extensionsUsed",void 0),is(this,"_tiles",void 0),is(this,"_pendingCount",void 0),is(this,"lastUpdatedVieports",void 0),is(this,"_requestedTiles",void 0),is(this,"_emptyTiles",void 0),is(this,"frameStateData",void 0),is(this,"maximumMemoryUsage",void 0),Et(t),this.options={...ss,...e},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||i.dirname(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.root=null,this.roots={},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.traverseCounter=0,this.geometricError=0,this._traverser=this._initializeTraverser(),this._cache=new It,this._requestScheduler=new Rt({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this._frameNumber=0,this._pendingCount=0,this._tiles={},this.selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this.frameStateData={},this.lastUpdatedVieports=null,this._queryParams={},this._queryParamsString="",this.maximumMemoryUsage=this.options.maximumMemoryUsage||32,this.gpuMemoryUsageInBytes=0,this.stats=new bt({id:this.url}),this._initializeStats(),this._extensionsUsed=void 0,this.dynamicScreenSpaceErrorComputedDensity=0,this.extras=null,this.asset={},this.credits={},this.description=this.options.description||"",this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return this._queryParamsString||(this._queryParamsString=function(t){const e=[];for(const r of Object.keys(t))e.push(`${r}=${t[r]}`);switch(e.length){case 0:return"";case 1:return"?"+e[0];default:return"?"+e.join("&")}}(this._queryParams)),this._queryParamsString}setProps(t){this.options={...this.options,...t}}setOptions(t){this.options={...this.options,...t}}getTileUrl(t){return t.startsWith("data:")?t:`${t}${this.queryParams}`}hasExtension(t){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(t)>-1)}update(t){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t instanceof Array||(t=[t]),this._cache.reset(),this._frameNumber++,this.traverseCounter=t.length;const e=[];for(const r of t){const t=r.id;this._needTraverse(t)?e.push(t):this.traverseCounter--}for(const r of t){const t=r.id;if(this.roots[t]||(this.roots[t]=this._initializeTileHeaders(this.tileset,null)),!e.includes(t))continue;const i=Ue(r,this._frameNumber);this._traverser.traverse(this.roots[t],i,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 r=this.frameStateData[e],i=Object.values(this._traverser.selectedTiles);r.selectedTiles=i,r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||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 r=new Set(t.map(t=>t.id)),i=new Set(e.map(t=>t.id));let s=t.filter(t=>!i.has(t.id)).length>0;return s=s||e.filter(t=>!r.has(t.id)).length>0,s}_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 r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount&&(e+=r.content.pointCount));this.stats.get("Tiles In View").count=this.selectedTiles.length,this.stats.get("Tiles To Render").count=t,this.stats.get("Points").count=e}_initializeTileSet(t){this.root=this._initializeTileHeaders(t,null),this.type===Oi.TILES3D&&this._initializeCesiumTileset(t),this.type===Oi.I3S&&this._initializeI3STileset(),this._calculateViewProps()}_calculateViewProps(){const t=this.root;Et(t);const{center:e}=t.boundingVolume;if(!e)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Q,void(this.zoom=1);this.cartographicCenter=vt.WGS84.cartesianToCartographic(e,new Q),this.cartesianCenter=e,this.zoom=Be(t.boundingVolume)}_initializeStats(){this.stats.get("Tiles In Tileset(s)"),this.stats.get("Tiles Loading"),this.stats.get("Tiles In Memory"),this.stats.get("Tiles In View"),this.stats.get("Tiles To Render"),this.stats.get("Tiles Loaded"),this.stats.get("Tiles Unloaded"),this.stats.get("Failed Tile Loads"),this.stats.get("Points","memory"),this.stats.get("Tile Memory Use","memory")}_initializeTileHeaders(t,e){const r=new Ki(this,t.root,e);if(e&&(e.children.push(r),r.depth=e.depth+1),this.type===Oi.TILES3D){const t=[];for(t.push(r);t.length>0;){const e=t.pop();this.stats.get("Tiles In Tileset(s)").incrementCount();const r=e.header.children||[];for(const i of r){const r=new Ki(this,i,e);e.children.push(r),r.depth=e.depth+1,t.push(r)}}}return r}_initializeTraverser(){let t;switch(this.type){case Oi.TILES3D:t=Zi;break;case Oi.I3S:t=rs;break;default:t=Qi}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)}finally{this._onEndTileLoading(),this._onTileLoad(t,e)}}_onTileLoadError(t,e){this.stats.get("Failed Tile Loads").incrementCount();const r=e.message||e.toString(),i=t.url;console.error(`A 3D tile failed to load: ${t.url} ${r}`),this.options.onTileError(t,r,i)}_onTileLoad(t,e){e&&(t&&t.content&&Pt(t,t.content),this._addTileToCache(t),this.options.onTileLoad(t))}_onStartTileLoading(){this._pendingCount++,this.stats.get("Tiles Loading").incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get("Tiles Loading").decrementCount()}_addTileToCache(t){this._cache.add(this,t,e=>e._updateCacheStats(t))}_updateCacheStats(t){this.stats.get("Tiles Loaded").incrementCount(),this.stats.get("Tiles In Memory").incrementCount(),this.gpuMemoryUsageInBytes+=t.content.byteLength||0,this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.content&&t.content.byteLength||0,this.stats.get("Tiles In Memory").decrementCount(),this.stats.get("Tiles Unloaded").incrementCount(),this.stats.get("Tile Memory Use").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 r of e.children)t.push(r);this._destroyTile(e)}this.root=null}_destroySubtree(t){const e=t,r=[];for(r.push(e);r.length>0;){t=r.pop();for(const e of t.children)r.push(e);t!==e&&this._destroyTile(t)}e.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeCesiumTileset(t){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)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"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)}}}])}));
|
|
2
|
-
//# sourceMappingURL=dist.min.js.map
|