@loaders.gl/3d-tiles 3.1.0-alpha.1 → 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/bundle.js +2 -4
- package/dist/bundle.js.map +1 -1
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +1 -1
- package/dist/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
- package/dist/lib/classes/tile-3d-batch-table.js +4 -4
- package/dist/lib/classes/tile-3d-batch-table.js.map +1 -1
- package/dist/lib/ion/ion.js +6 -6
- package/dist/lib/ion/ion.js.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +2 -2
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -1
- package/dist/lib/parsers/helpers/parse-utils.js +1 -5
- package/dist/lib/parsers/helpers/parse-utils.js.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-header.js +1 -1
- package/dist/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-instanced-model.js +1 -1
- package/dist/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
- package/dist/lib/parsers/parse-3d-tile.js +1 -1
- package/dist/lib/parsers/parse-3d-tile.js.map +1 -1
- package/dist/lib/utils/version.js +1 -1
- package/package.json +11 -9
- package/src/bundle.ts +2 -3
- package/dist/dist.min.js +0 -2
- package/dist/dist.min.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/parsers/parse-3d-tile-instanced-model.js"],"names":["Vector3","Matrix3","Matrix4","Quaternion","Ellipsoid","GL","Tile3DFeatureTable","Tile3DBatchTable","parse3DTileHeaderSync","parse3DTileTablesHeaderSync","parse3DTileTablesSync","parse3DTileGLTFViewSync","extractGLTF","parseInstancedModel3DTile","tile","arrayBuffer","byteOffset","options","context","parseInstancedModel","gltfFormat","version","Error","view","DataView","getUint32","featureTableJsonByteLength","featureTable","featureTableJson","featureTableBinary","instancesLength","getGlobalProperty","featuresLength","Number","isFinite","eastNorthUp","rtcCenter","FLOAT","batchTable","batchTableJson","batchTableBinary","extractInstancedAttributes","collectionOptions","instances","Array","_batchTable","cull","url","undefined","gltf","basePath","incrementallyLoadTextures","forwardAxis","instancePosition","instanceNormalRight","instanceNormalUp","instanceNormalForward","instanceRotation","instanceQuaternion","instanceScale","instanceTranslationRotationScale","instanceTransform","scratch1","scratch2","scratchVector1","scratchVector2","i","position","hasProperty","getProperty","UNSIGNED_SHORT","quantizedVolumeOffset","quantizedVolumeScale","MAX_UNSIGNED_SHORT","j","copy","translation","normalUp","normalRight","hasCustomOrientation","octNormalUp","octNormalRight","WGS84","eastNorthUpToFixedFrame","getRotationMatrix3","identity","cross","normalize","setColumn","fromMatrix3","rotation","set","scale","multiplyByScalar","nonUniformScale","batchId","rotationMatrix","fromQuaternion","translate","multiplyRight","modelMatrix","clone"],"mappings":"AAGA,SAAQA,OAAR,EAAiBC,OAAjB,EAA0BC,OAA1B,EAAmCC,UAAnC,QAAoD,eAApD;AACA,SAAQC,SAAR,QAAwB,qBAAxB;AACA,SAAQC,EAAR,QAAiB,kBAAjB;AACA,OAAOC,kBAAP,MAA+B,kCAA/B;AACA,OAAOC,gBAAP,MAA6B,gCAA7B;AAEA,SAAQC,qBAAR,QAAoC,gCAApC;AACA,SAAQC,2BAAR,EAAqCC,qBAArC,QAAiE,gCAAjE;AACA,SAAQC,uBAAR,EAAiCC,WAAjC,QAAmD,mCAAnD;AAEA,OAAO,eAAeC,yBAAf,CAAyCC,IAAzC,EAA+CC,WAA/C,EAA4DC,UAA5D,EAAwEC,OAAxE,EAAiFC,OAAjF,EAA0F;AA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CAAwBhC,gCAAgC,CAACgC,KAAzD;AAEA,UAAMQ,WAAW,GAAGvC,iBAAiB,CAACwC,KAAlB,EAApB;AACA1D,IAAAA,SAAS,CAACuB,CAAD,CAAT,GAAe;AACbkC,MAAAA,WADa;AAEbL,MAAAA;AAFa,KAAf;AAID;;AAEDjF,EAAAA,IAAI,CAAC6B,SAAL,GAAiBA,SAAjB;AACD","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 {Vector3, Matrix3, Matrix4, Quaternion} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {GL} from '@loaders.gl/math'; // 'math.gl/geometry';\nimport Tile3DFeatureTable from '../classes/tile-3d-feature-table';\nimport Tile3DBatchTable from '../classes/tile-3d-batch-table';\n\nimport {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';\nimport {parse3DTileTablesHeaderSync, parse3DTileTablesSync} from './helpers/parse-3d-tile-tables';\nimport {parse3DTileGLTFViewSync, extractGLTF} from './helpers/parse-3d-tile-gltf-view';\n\nexport async function parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);\n await extractGLTF(tile, tile.gltfFormat, options, context);\n return byteOffset;\n}\n\nfunction parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n if (tile.version !== 1) {\n throw new Error(`Instanced 3D Model version ${tile.version} is not supported`);\n }\n\n byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);\n\n const view = new DataView(arrayBuffer);\n\n tile.gltfFormat = view.getUint32(byteOffset, true);\n byteOffset += 4;\n\n // PARSE FEATURE TABLE\n byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);\n\n byteOffset = parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options);\n\n // TODO - Is the feature table sometimes optional or can check be moved into table header parser?\n if (tile.featureTableJsonByteLength === 0) {\n throw new Error('i3dm parser: featureTableJsonByteLength is zero.');\n }\n\n const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);\n\n const instancesLength = featureTable.getGlobalProperty('INSTANCES_LENGTH');\n featureTable.featuresLength = instancesLength;\n\n if (!Number.isFinite(instancesLength)) {\n throw new Error('i3dm parser: INSTANCES_LENGTH must be defined');\n }\n\n tile.eastNorthUp = featureTable.getGlobalProperty('EAST_NORTH_UP');\n tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);\n\n const batchTable = new Tile3DBatchTable(\n tile.batchTableJson,\n tile.batchTableBinary,\n instancesLength\n );\n\n extractInstancedAttributes(tile, featureTable, batchTable, instancesLength);\n\n return byteOffset;\n}\n\n// eslint-disable-next-line max-statements, complexity\nfunction extractInstancedAttributes(tile, featureTable, batchTable, instancesLength) {\n // Create model instance collection\n const collectionOptions = {\n instances: new Array(instancesLength),\n batchTable: tile._batchTable,\n cull: false, // Already culled by 3D Tiles\n url: undefined,\n // requestType: RequestType.TILES3D,\n gltf: undefined,\n basePath: undefined,\n incrementallyLoadTextures: false,\n // TODO - tileset is not available at this stage, tile is parsed independently\n // upAxis: (tileset && tileset._gltfUpAxis) || [0, 1, 0],\n forwardAxis: [1, 0, 0]\n };\n\n const instances = collectionOptions.instances;\n const instancePosition = new Vector3();\n const instanceNormalRight = new Vector3();\n const instanceNormalUp = new Vector3();\n const instanceNormalForward = new Vector3();\n const instanceRotation = new Matrix3();\n const instanceQuaternion = new Quaternion();\n const instanceScale = new Vector3();\n const instanceTranslationRotationScale = {};\n const instanceTransform = new Matrix4();\n const scratch1 = [];\n const scratch2 = [];\n const scratchVector1 = new Vector3();\n const scratchVector2 = new Vector3();\n\n for (let i = 0; i < instancesLength; i++) {\n let position;\n\n // Get the instance position\n if (featureTable.hasProperty('POSITION')) {\n position = featureTable.getProperty('POSITION', GL.FLOAT, 3, i, instancePosition);\n } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {\n position = featureTable.getProperty(\n 'POSITION_QUANTIZED',\n GL.UNSIGNED_SHORT,\n 3,\n i,\n instancePosition\n );\n\n const quantizedVolumeOffset = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_OFFSET',\n GL.FLOAT,\n 3,\n scratchVector1\n );\n if (!quantizedVolumeOffset) {\n throw new Error(\n 'i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.'\n );\n }\n\n const quantizedVolumeScale = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_SCALE',\n GL.FLOAT,\n 3,\n scratchVector2\n );\n if (!quantizedVolumeScale) {\n throw new Error(\n 'i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.'\n );\n }\n\n const MAX_UNSIGNED_SHORT = 65535.0;\n for (let j = 0; j < 3; j++) {\n position[j] =\n (position[j] / MAX_UNSIGNED_SHORT) * quantizedVolumeScale[j] + quantizedVolumeOffset[j];\n }\n }\n\n if (!position) {\n throw new Error('i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.');\n }\n\n instancePosition.copy(position);\n instanceTranslationRotationScale.translation = instancePosition;\n\n // Get the instance rotation\n tile.normalUp = featureTable.getProperty('NORMAL_UP', GL.FLOAT, 3, i, scratch1);\n tile.normalRight = featureTable.getProperty('NORMAL_RIGHT', GL.FLOAT, 3, i, scratch2);\n\n const hasCustomOrientation = false;\n if (tile.normalUp) {\n if (!tile.normalRight) {\n throw new Error('i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.');\n }\n // Vector3.unpack(normalUp, 0, instanceNormalUp);\n // Vector3.unpack(normalRight, 0, instanceNormalRight);\n tile.hasCustomOrientation = true;\n } else {\n tile.octNormalUp = featureTable.getProperty(\n 'NORMAL_UP_OCT32P',\n GL.UNSIGNED_SHORT,\n 2,\n scratch1\n );\n tile.octNormalRight = featureTable.getProperty(\n 'NORMAL_RIGHT_OCT32P',\n GL.UNSIGNED_SHORT,\n 2,\n scratch2\n );\n\n if (tile.octNormalUp) {\n if (!tile.octNormalRight) {\n throw new Error(\n 'i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P'\n );\n }\n\n throw new Error('i3dm: oct-encoded orientation not implemented');\n /*\n AttributeCompression.octDecodeInRange(octNormalUp[0], octNormalUp[1], 65535, instanceNormalUp);\n AttributeCompression.octDecodeInRange(octNormalRight[0], octNormalRight[1], 65535, instanceNormalRight);\n hasCustomOrientation = true;\n */\n } else if (tile.eastNorthUp) {\n Ellipsoid.WGS84.eastNorthUpToFixedFrame(instancePosition, instanceTransform);\n instanceTransform.getRotationMatrix3(instanceRotation);\n } else {\n instanceRotation.identity();\n }\n }\n\n if (hasCustomOrientation) {\n instanceNormalForward.copy(instanceNormalRight).cross(instanceNormalUp).normalize();\n instanceRotation.setColumn(0, instanceNormalRight);\n instanceRotation.setColumn(1, instanceNormalUp);\n instanceRotation.setColumn(2, instanceNormalForward);\n }\n\n instanceQuaternion.fromMatrix3(instanceRotation);\n instanceTranslationRotationScale.rotation = instanceQuaternion;\n\n // Get the instance scale\n instanceScale.set(1.0, 1.0, 1.0);\n const scale = featureTable.getProperty('SCALE', GL.FLOAT, 1, i);\n if (Number.isFinite(scale)) {\n instanceScale.multiplyByScalar(scale);\n }\n const nonUniformScale = featureTable.getProperty('SCALE_NON_UNIFORM', GL.FLOAT, 3, i, scratch1);\n if (nonUniformScale) {\n instanceScale.scale(nonUniformScale);\n }\n\n instanceTranslationRotationScale.scale = instanceScale;\n\n // Get the batchId\n let batchId = featureTable.getProperty('BATCH_ID', GL.UNSIGNED_SHORT, 1, i);\n if (batchId === undefined) {\n // If BATCH_ID semantic is undefined, batchId is just the instance number\n batchId = i;\n }\n\n const rotationMatrix = new Matrix4().fromQuaternion(instanceTranslationRotationScale.rotation);\n\n // Create the model matrix and the instance\n instanceTransform.identity();\n instanceTransform.translate(instanceTranslationRotationScale.translation);\n instanceTransform.multiplyRight(rotationMatrix);\n instanceTransform.scale(instanceTranslationRotationScale.scale);\n\n const modelMatrix = instanceTransform.clone();\n instances[i] = {\n modelMatrix,\n batchId\n };\n }\n\n tile.instances = instances;\n}\n"],"file":"parse-3d-tile-instanced-model.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/parsers/parse-3d-tile-instanced-model.js"],"names":["Vector3","Matrix3","Matrix4","Quaternion","Ellipsoid","GL","Tile3DFeatureTable","Tile3DBatchTable","parse3DTileHeaderSync","parse3DTileTablesHeaderSync","parse3DTileTablesSync","parse3DTileGLTFViewSync","extractGLTF","parseInstancedModel3DTile","tile","arrayBuffer","byteOffset","options","context","parseInstancedModel","gltfFormat","version","Error","view","DataView","getUint32","featureTableJsonByteLength","featureTable","featureTableJson","featureTableBinary","instancesLength","getGlobalProperty","featuresLength","Number","isFinite","eastNorthUp","rtcCenter","FLOAT","batchTable","batchTableJson","batchTableBinary","extractInstancedAttributes","collectionOptions","instances","Array","_batchTable","cull","url","undefined","gltf","basePath","incrementallyLoadTextures","forwardAxis","instancePosition","instanceNormalRight","instanceNormalUp","instanceNormalForward","instanceRotation","instanceQuaternion","instanceScale","instanceTranslationRotationScale","instanceTransform","scratch1","scratch2","scratchVector1","scratchVector2","i","position","hasProperty","getProperty","UNSIGNED_SHORT","quantizedVolumeOffset","quantizedVolumeScale","MAX_UNSIGNED_SHORT","j","copy","translation","normalUp","normalRight","hasCustomOrientation","octNormalUp","octNormalRight","WGS84","eastNorthUpToFixedFrame","getRotationMatrix3","identity","cross","normalize","setColumn","fromMatrix3","rotation","set","scale","multiplyByScalar","nonUniformScale","batchId","rotationMatrix","fromQuaternion","translate","multiplyRight","modelMatrix","clone"],"mappings":"AAGA,SAAQA,OAAR,EAAiBC,OAAjB,EAA0BC,OAA1B,EAAmCC,UAAnC,QAAoD,eAApD;AACA,SAAQC,SAAR,QAAwB,qBAAxB;AACA,SAAQC,EAAR,QAAiB,kBAAjB;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,CAAV;AACD;;AAED,UAAM8B,cAAc,GAAG,IAAI9F,OAAJ,GAAc+F,cAAd,CAA6BrC,gCAAgC,CAAC8B,QAA9D,CAAvB;AAGA7B,IAAAA,iBAAiB,CAACwB,QAAlB;AACAxB,IAAAA,iBAAiB,CAACqC,SAAlB,CAA4BtC,gCAAgC,CAACgB,WAA7D;AACAf,IAAAA,iBAAiB,CAACsC,aAAlB,CAAgCH,cAAhC;AACAnC,IAAAA,iBAAiB,CAAC+B,KAAlB,CAAwBhC,gCAAgC,CAACgC,KAAzD;AAEA,UAAMQ,WAAW,GAAGvC,iBAAiB,CAACwC,KAAlB,EAApB;AACA1D,IAAAA,SAAS,CAACuB,CAAD,CAAT,GAAe;AACbkC,MAAAA,WADa;AAEbL,MAAAA;AAFa,KAAf;AAID;;AAEDjF,EAAAA,IAAI,CAAC6B,SAAL,GAAiBA,SAAjB;AACD","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 {Vector3, Matrix3, Matrix4, Quaternion} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {GL} from '@loaders.gl/math'; // 'math.gl/geometry';\nimport Tile3DFeatureTable from '../classes/tile-3d-feature-table';\nimport Tile3DBatchTable from '../classes/tile-3d-batch-table';\n\nimport {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';\nimport {parse3DTileTablesHeaderSync, parse3DTileTablesSync} from './helpers/parse-3d-tile-tables';\nimport {parse3DTileGLTFViewSync, extractGLTF} from './helpers/parse-3d-tile-gltf-view';\n\nexport async function parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);\n await extractGLTF(tile, tile.gltfFormat, options, context);\n return byteOffset;\n}\n\nfunction parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n if (tile.version !== 1) {\n throw new Error(`Instanced 3D Model version ${tile.version} is not supported`);\n }\n\n byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);\n\n const view = new DataView(arrayBuffer);\n\n tile.gltfFormat = view.getUint32(byteOffset, true);\n byteOffset += 4;\n\n // PARSE FEATURE TABLE\n byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);\n\n byteOffset = parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options);\n\n // TODO - Is the feature table sometimes optional or can check be moved into table header parser?\n if (tile.featureTableJsonByteLength === 0) {\n throw new Error('i3dm parser: featureTableJsonByteLength is zero.');\n }\n\n const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);\n\n const instancesLength = featureTable.getGlobalProperty('INSTANCES_LENGTH');\n featureTable.featuresLength = instancesLength;\n\n if (!Number.isFinite(instancesLength)) {\n throw new Error('i3dm parser: INSTANCES_LENGTH must be defined');\n }\n\n tile.eastNorthUp = featureTable.getGlobalProperty('EAST_NORTH_UP');\n tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);\n\n const batchTable = new Tile3DBatchTable(\n tile.batchTableJson,\n tile.batchTableBinary,\n instancesLength\n );\n\n extractInstancedAttributes(tile, featureTable, batchTable, instancesLength);\n\n return byteOffset;\n}\n\n// eslint-disable-next-line max-statements, complexity\nfunction extractInstancedAttributes(tile, featureTable, batchTable, instancesLength) {\n // Create model instance collection\n const collectionOptions = {\n instances: new Array(instancesLength),\n batchTable: tile._batchTable,\n cull: false, // Already culled by 3D Tiles\n url: undefined,\n // requestType: RequestType.TILES3D,\n gltf: undefined,\n basePath: undefined,\n incrementallyLoadTextures: false,\n // TODO - tileset is not available at this stage, tile is parsed independently\n // upAxis: (tileset && tileset._gltfUpAxis) || [0, 1, 0],\n forwardAxis: [1, 0, 0]\n };\n\n const instances = collectionOptions.instances;\n const instancePosition = new Vector3();\n const instanceNormalRight = new Vector3();\n const instanceNormalUp = new Vector3();\n const instanceNormalForward = new Vector3();\n const instanceRotation = new Matrix3();\n const instanceQuaternion = new Quaternion();\n const instanceScale = new Vector3();\n const instanceTranslationRotationScale = {};\n const instanceTransform = new Matrix4();\n const scratch1 = [];\n const scratch2 = [];\n const scratchVector1 = new Vector3();\n const scratchVector2 = new Vector3();\n\n for (let i = 0; i < instancesLength; i++) {\n let position;\n\n // Get the instance position\n if (featureTable.hasProperty('POSITION')) {\n position = featureTable.getProperty('POSITION', GL.FLOAT, 3, i, instancePosition);\n } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {\n position = featureTable.getProperty(\n 'POSITION_QUANTIZED',\n GL.UNSIGNED_SHORT,\n 3,\n i,\n instancePosition\n );\n\n const quantizedVolumeOffset = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_OFFSET',\n GL.FLOAT,\n 3,\n scratchVector1\n );\n if (!quantizedVolumeOffset) {\n throw new Error(\n 'i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.'\n );\n }\n\n const quantizedVolumeScale = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_SCALE',\n GL.FLOAT,\n 3,\n scratchVector2\n );\n if (!quantizedVolumeScale) {\n throw new Error(\n 'i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.'\n );\n }\n\n const MAX_UNSIGNED_SHORT = 65535.0;\n for (let j = 0; j < 3; j++) {\n position[j] =\n (position[j] / MAX_UNSIGNED_SHORT) * quantizedVolumeScale[j] + quantizedVolumeOffset[j];\n }\n }\n\n if (!position) {\n throw new Error('i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.');\n }\n\n instancePosition.copy(position);\n instanceTranslationRotationScale.translation = instancePosition;\n\n // Get the instance rotation\n tile.normalUp = featureTable.getProperty('NORMAL_UP', GL.FLOAT, 3, i, scratch1);\n tile.normalRight = featureTable.getProperty('NORMAL_RIGHT', GL.FLOAT, 3, i, scratch2);\n\n const hasCustomOrientation = false;\n if (tile.normalUp) {\n if (!tile.normalRight) {\n throw new Error('i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.');\n }\n // Vector3.unpack(normalUp, 0, instanceNormalUp);\n // Vector3.unpack(normalRight, 0, instanceNormalRight);\n tile.hasCustomOrientation = true;\n } else {\n tile.octNormalUp = featureTable.getProperty(\n 'NORMAL_UP_OCT32P',\n GL.UNSIGNED_SHORT,\n 2,\n scratch1\n );\n tile.octNormalRight = featureTable.getProperty(\n 'NORMAL_RIGHT_OCT32P',\n GL.UNSIGNED_SHORT,\n 2,\n scratch2\n );\n\n if (tile.octNormalUp) {\n if (!tile.octNormalRight) {\n throw new Error(\n 'i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P'\n );\n }\n\n throw new Error('i3dm: oct-encoded orientation not implemented');\n /*\n AttributeCompression.octDecodeInRange(octNormalUp[0], octNormalUp[1], 65535, instanceNormalUp);\n AttributeCompression.octDecodeInRange(octNormalRight[0], octNormalRight[1], 65535, instanceNormalRight);\n hasCustomOrientation = true;\n */\n } else if (tile.eastNorthUp) {\n Ellipsoid.WGS84.eastNorthUpToFixedFrame(instancePosition, instanceTransform);\n instanceTransform.getRotationMatrix3(instanceRotation);\n } else {\n instanceRotation.identity();\n }\n }\n\n if (hasCustomOrientation) {\n instanceNormalForward.copy(instanceNormalRight).cross(instanceNormalUp).normalize();\n instanceRotation.setColumn(0, instanceNormalRight);\n instanceRotation.setColumn(1, instanceNormalUp);\n instanceRotation.setColumn(2, instanceNormalForward);\n }\n\n instanceQuaternion.fromMatrix3(instanceRotation);\n instanceTranslationRotationScale.rotation = instanceQuaternion;\n\n // Get the instance scale\n instanceScale.set(1.0, 1.0, 1.0);\n const scale = featureTable.getProperty('SCALE', GL.FLOAT, 1, i);\n if (Number.isFinite(scale)) {\n instanceScale.multiplyByScalar(scale);\n }\n const nonUniformScale = featureTable.getProperty('SCALE_NON_UNIFORM', GL.FLOAT, 3, i, scratch1);\n if (nonUniformScale) {\n instanceScale.scale(nonUniformScale);\n }\n\n instanceTranslationRotationScale.scale = instanceScale;\n\n // Get the batchId\n let batchId = featureTable.getProperty('BATCH_ID', GL.UNSIGNED_SHORT, 1, i);\n if (batchId === undefined) {\n // If BATCH_ID semantic is undefined, batchId is just the instance number\n batchId = i;\n }\n\n const rotationMatrix = new Matrix4().fromQuaternion(instanceTranslationRotationScale.rotation);\n\n // Create the model matrix and the instance\n instanceTransform.identity();\n instanceTransform.translate(instanceTranslationRotationScale.translation);\n instanceTransform.multiplyRight(rotationMatrix);\n instanceTransform.scale(instanceTranslationRotationScale.scale);\n\n const modelMatrix = instanceTransform.clone();\n instances[i] = {\n modelMatrix,\n batchId\n };\n }\n\n tile.instances = instances;\n}\n"],"file":"parse-3d-tile-instanced-model.js"}
|
|
@@ -22,7 +22,7 @@ export async function parse3DTile(arrayBuffer, byteOffset = 0, options, context,
|
|
|
22
22
|
return await parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context);
|
|
23
23
|
|
|
24
24
|
default:
|
|
25
|
-
throw new Error(
|
|
25
|
+
throw new Error("3DTileLoader: unknown type ".concat(tile.type));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=parse-3d-tile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/parsers/parse-3d-tile.js"],"names":["TILE3D_TYPE","getMagicString","parsePointCloud3DTile","parseBatchedModel3DTile","parseInstancedModel3DTile","parseComposite3DTile","parse3DTile","arrayBuffer","byteOffset","options","context","tile","type","COMPOSITE","BATCHED_3D_MODEL","INSTANCED_3D_MODEL","POINT_CLOUD","Error"],"mappings":"AAGA,SAAQA,WAAR,QAA0B,cAA1B;AACA,SAAQC,cAAR,QAA6B,uBAA7B;AAEA,SAAQC,qBAAR,QAAoC,6BAApC;AACA,SAAQC,uBAAR,QAAsC,+BAAtC;AACA,SAAQC,yBAAR,QAAwC,iCAAxC;AACA,SAAQC,oBAAR,QAAmC,2BAAnC;AAGA,OAAO,eAAeC,WAAf,CAA2BC,WAA3B,EAAwCC,UAAU,GAAG,CAArD,EAAwDC,OAAxD,EAAiEC,OAAjE,EAA0EC,IAAI,GAAG,EAAjF,EAAqF;AAC1FA,EAAAA,IAAI,CAACH,UAAL,GAAkBA,UAAlB;AACAG,EAAAA,IAAI,CAACC,IAAL,GAAYX,cAAc,CAACM,WAAD,EAAcC,UAAd,CAA1B;;AAEA,UAAQG,IAAI,CAACC,IAAb;AACE,SAAKZ,WAAW,CAACa,SAAjB;AAEE,aAAO,MAAMR,oBAAoB,CAC/BM,IAD+B,EAE/BJ,WAF+B,EAG/BC,UAH+B,EAI/BC,OAJ+B,EAK/BC,OAL+B,EAM/BJ,WAN+B,CAAjC;;AASF,SAAKN,WAAW,CAACc,gBAAjB;AACE,aAAO,MAAMX,uBAAuB,CAACQ,IAAD,EAAOJ,WAAP,EAAoBC,UAApB,EAAgCC,OAAhC,EAAyCC,OAAzC,CAApC;;AAEF,SAAKV,WAAW,CAACe,kBAAjB;AACE,aAAO,MAAMX,yBAAyB,CAACO,IAAD,EAAOJ,WAAP,EAAoBC,UAApB,EAAgCC,OAAhC,EAAyCC,OAAzC,CAAtC;;AAEF,SAAKV,WAAW,CAACgB,WAAjB;AACE,aAAO,MAAMd,qBAAqB,CAACS,IAAD,EAAOJ,WAAP,EAAoBC,UAApB,EAAgCC,OAAhC,EAAyCC,OAAzC,CAAlC;;AAEF;AACE,YAAM,IAAIO,KAAJ,
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/parsers/parse-3d-tile.js"],"names":["TILE3D_TYPE","getMagicString","parsePointCloud3DTile","parseBatchedModel3DTile","parseInstancedModel3DTile","parseComposite3DTile","parse3DTile","arrayBuffer","byteOffset","options","context","tile","type","COMPOSITE","BATCHED_3D_MODEL","INSTANCED_3D_MODEL","POINT_CLOUD","Error"],"mappings":"AAGA,SAAQA,WAAR,QAA0B,cAA1B;AACA,SAAQC,cAAR,QAA6B,uBAA7B;AAEA,SAAQC,qBAAR,QAAoC,6BAApC;AACA,SAAQC,uBAAR,QAAsC,+BAAtC;AACA,SAAQC,yBAAR,QAAwC,iCAAxC;AACA,SAAQC,oBAAR,QAAmC,2BAAnC;AAGA,OAAO,eAAeC,WAAf,CAA2BC,WAA3B,EAAwCC,UAAU,GAAG,CAArD,EAAwDC,OAAxD,EAAiEC,OAAjE,EAA0EC,IAAI,GAAG,EAAjF,EAAqF;AAC1FA,EAAAA,IAAI,CAACH,UAAL,GAAkBA,UAAlB;AACAG,EAAAA,IAAI,CAACC,IAAL,GAAYX,cAAc,CAACM,WAAD,EAAcC,UAAd,CAA1B;;AAEA,UAAQG,IAAI,CAACC,IAAb;AACE,SAAKZ,WAAW,CAACa,SAAjB;AAEE,aAAO,MAAMR,oBAAoB,CAC/BM,IAD+B,EAE/BJ,WAF+B,EAG/BC,UAH+B,EAI/BC,OAJ+B,EAK/BC,OAL+B,EAM/BJ,WAN+B,CAAjC;;AASF,SAAKN,WAAW,CAACc,gBAAjB;AACE,aAAO,MAAMX,uBAAuB,CAACQ,IAAD,EAAOJ,WAAP,EAAoBC,UAApB,EAAgCC,OAAhC,EAAyCC,OAAzC,CAApC;;AAEF,SAAKV,WAAW,CAACe,kBAAjB;AACE,aAAO,MAAMX,yBAAyB,CAACO,IAAD,EAAOJ,WAAP,EAAoBC,UAApB,EAAgCC,OAAhC,EAAyCC,OAAzC,CAAtC;;AAEF,SAAKV,WAAW,CAACgB,WAAjB;AACE,aAAO,MAAMd,qBAAqB,CAACS,IAAD,EAAOJ,WAAP,EAAoBC,UAApB,EAAgCC,OAAhC,EAAyCC,OAAzC,CAAlC;;AAEF;AACE,YAAM,IAAIO,KAAJ,sCAAwCN,IAAI,CAACC,IAA7C,EAAN;AAtBJ;AAwBD","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 {TILE3D_TYPE} from '../constants';\nimport {getMagicString} from './helpers/parse-utils';\n\nimport {parsePointCloud3DTile} from './parse-3d-tile-point-cloud';\nimport {parseBatchedModel3DTile} from './parse-3d-tile-batched-model';\nimport {parseInstancedModel3DTile} from './parse-3d-tile-instanced-model';\nimport {parseComposite3DTile} from './parse-3d-tile-composite';\n\n// Extracts\nexport async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile = {}) {\n tile.byteOffset = byteOffset;\n tile.type = getMagicString(arrayBuffer, byteOffset);\n\n switch (tile.type) {\n case TILE3D_TYPE.COMPOSITE:\n // Note: We pass this function as argument so that embedded tiles can be parsed recursively\n return await parseComposite3DTile(\n tile,\n arrayBuffer,\n byteOffset,\n options,\n context,\n parse3DTile\n );\n\n case TILE3D_TYPE.BATCHED_3D_MODEL:\n return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n case TILE3D_TYPE.INSTANCED_3D_MODEL:\n return await parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n case TILE3D_TYPE.POINT_CLOUD:\n return await parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n default:\n throw new Error(`3DTileLoader: unknown type ${tile.type}`); // eslint-disable-line\n }\n}\n"],"file":"parse-3d-tile.js"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = typeof "
|
|
1
|
+
export const VERSION = typeof "4.0.0-alpha.1" !== 'undefined' ? "4.0.0-alpha.1" : 'latest';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/3d-tiles",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"description": "3D Tiles, an open standard for streaming massive heterogeneous 3D geospatial datasets.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,17 +31,19 @@
|
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
33
|
"pre-build": "npm run build-bundle",
|
|
34
|
-
"build-bundle": "
|
|
34
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@loaders.gl/
|
|
38
|
-
"@loaders.gl/
|
|
39
|
-
"@loaders.gl/
|
|
40
|
-
"@loaders.gl/
|
|
41
|
-
"@loaders.gl/
|
|
42
|
-
"@loaders.gl/tiles": "3.1.0-alpha.1",
|
|
37
|
+
"@loaders.gl/draco": "4.0.0-alpha.1",
|
|
38
|
+
"@loaders.gl/gltf": "4.0.0-alpha.1",
|
|
39
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.1",
|
|
40
|
+
"@loaders.gl/math": "4.0.0-alpha.1",
|
|
41
|
+
"@loaders.gl/tiles": "4.0.0-alpha.1",
|
|
43
42
|
"@math.gl/core": "^3.5.1",
|
|
44
43
|
"@math.gl/geospatial": "^3.5.1"
|
|
45
44
|
},
|
|
46
|
-
"
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@loaders.gl/core": "^3.0.0"
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "e48f5534fe7188c810f23f965a440c144b3cf6d0"
|
|
47
49
|
}
|
package/src/bundle.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
const moduleExports = require('./index');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = Object.assign(_global.loaders, moduleExports);
|
|
3
|
+
globalThis.loaders = globalThis.loaders || {};
|
|
4
|
+
module.exports = Object.assign(globalThis.loaders, moduleExports);
|
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 n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},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 n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)r.d(n,s,function(e){return t[e]}.bind(null,s));return n},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=27)}([function(t,e,r){"use strict";r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return s})),r.d(e,"c",(function(){return i}));var n=1e-6,s="undefined"!=typeof Float32Array?Float32Array:Array,i=Math.random;Math.PI;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)})},function(t,e,r){"use strict";r.d(e,"a",(function(){return s})),r.d(e,"b",(function(){return i})),r.d(e,"c",(function(){return a}));var n=r(3);function s(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function i(t,e,r=""){if(n.b.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}const o={};function a(t,e){o[t]||(o[t]=!0,console.warn("".concat(t," has been removed in version ").concat(e,", see upgrade guide for more information")))}},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"g",(function(){return i})),r.d(e,"e",(function(){return o})),r.d(e,"h",(function(){return a})),r.d(e,"d",(function(){return c})),r.d(e,"c",(function(){return u})),r.d(e,"m",(function(){return h})),r.d(e,"l",(function(){return f})),r.d(e,"n",(function(){return l})),r.d(e,"i",(function(){return d})),r.d(e,"j",(function(){return y})),r.d(e,"k",(function(){return m})),r.d(e,"a",(function(){return g})),r.d(e,"f",(function(){return b}));var n=r(0);function s(){var t=new n.a(3);return n.a!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function i(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function o(t,e,r){var s=new n.a(3);return s[0]=t,s[1]=e,s[2]=r,s}function a(t,e){var r=e[0],n=e[1],s=e[2],i=r*r+n*n+s*s;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function c(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function u(t,e,r){var n=e[0],s=e[1],i=e[2],o=r[0],a=r[1],c=r[2];return t[0]=s*c-i*a,t[1]=i*o-n*c,t[2]=n*a-s*o,t}function h(t,e,r){var n=e[0],s=e[1],i=e[2],o=r[3]*n+r[7]*s+r[11]*i+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*s+r[8]*i+r[12])/o,t[1]=(r[1]*n+r[5]*s+r[9]*i+r[13])/o,t[2]=(r[2]*n+r[6]*s+r[10]*i+r[14])/o,t}function f(t,e,r){var n=e[0],s=e[1],i=e[2];return t[0]=n*r[0]+s*r[3]+i*r[6],t[1]=n*r[1]+s*r[4]+i*r[7],t[2]=n*r[2]+s*r[5]+i*r[8],t}function l(t,e,r){var n=r[0],s=r[1],i=r[2],o=r[3],a=e[0],c=e[1],u=e[2],h=s*u-i*c,f=i*a-n*u,l=n*c-s*a,d=s*l-i*f,y=i*h-n*l,m=n*f-s*h,g=2*o;return h*=g,f*=g,l*=g,d*=2,y*=2,m*=2,t[0]=a+h+d,t[1]=c+f+y,t[2]=u+l+m,t}function d(t,e,r,n){var s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[0],i[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),i[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function y(t,e,r,n){var s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),i[1]=s[1],i[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function m(t,e,r,n){var s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),i[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),i[2]=s[2],t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function g(t,e){var r=t[0],n=t[1],s=t[2],i=e[0],o=e[1],a=e[2],u=Math.sqrt(r*r+n*n+s*s)*Math.sqrt(i*i+o*o+a*a),h=u&&c(t,e)/u;return Math.acos(Math.min(Math.max(h,-1),1))}var p,b=i;p=s()},function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"d",(function(){return o})),r.d(e,"e",(function(){return a})),r.d(e,"g",(function(){return u})),r.d(e,"f",(function(){return h})),r.d(e,"a",(function(){return f})),r.d(e,"c",(function(){return l}));r(6);const n=1/Math.PI*180,s=1/180*Math.PI,i={};function o(t,{precision:e=i.precision||4}={}){return t=function(t){return Math.round(t/i.EPSILON)*i.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function a(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function c(t,e,r){if(a(t)){r=r||((n=t).clone?n.clone():new Array(n.length));for(let n=0;n<r.length&&n<t.length;++n)r[n]=e(t[n],n,r);return r}var n;return e(t)}function u(t){return function(t,e){return c(t,t=>t*s,e)}(t)}function h(t){return function(t,e){return c(t,t=>t*n,e)}(t)}function f(t,e,r){return c(t,t=>Math.max(e,Math.min(r,t)))}function l(t,e,r){const n=i.EPSILON;r&&(i.EPSILON=r);try{if(t===e)return!0;if(a(t)&&a(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!l(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)<=i.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{i.EPSILON=n}}i.EPSILON=1e-12,i.debug=!1,i.precision=4,i.printTypes=!1,i.printDegrees=!1,i.printRowMajor=!0},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"g",(function(){return i})),r.d(e,"c",(function(){return o})),r.d(e,"l",(function(){return a})),r.d(e,"a",(function(){return c})),r.d(e,"k",(function(){return u})),r.d(e,"h",(function(){return h})),r.d(e,"m",(function(){return f})),r.d(e,"j",(function(){return l})),r.d(e,"d",(function(){return d})),r.d(e,"i",(function(){return y})),r.d(e,"n",(function(){return m})),r.d(e,"o",(function(){return g})),r.d(e,"f",(function(){return p})),r.d(e,"e",(function(){return b}));var n=r(0);function s(t){var e=new n.a(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function i(t,e,r,s){var i=new n.a(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=s,i}function o(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function a(t,e,r,n,s){return t[0]=e,t[1]=r,t[2]=n,t[3]=s,t}function c(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}function u(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}function h(t){var e=t[0],r=t[1],n=t[2],s=t[3];return Math.hypot(e,r,n,s)}function f(t){var e=t[0],r=t[1],n=t[2],s=t[3];return e*e+r*r+n*n+s*s}function l(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=r*r+n*n+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=n*o,t[2]=s*o,t[3]=i*o,t}function d(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function y(t,e,r,n){var s=e[0],i=e[1],o=e[2],a=e[3];return t[0]=s+n*(r[0]-s),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t[3]=a+n*(r[3]-a),t}function m(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3];return t[0]=r[0]*n+r[4]*s+r[8]*i+r[12]*o,t[1]=r[1]*n+r[5]*s+r[9]*i+r[13]*o,t[2]=r[2]*n+r[6]*s+r[10]*i+r[14]*o,t[3]=r[3]*n+r[7]*s+r[11]*i+r[15]*o,t}function g(t,e,r){var n=e[0],s=e[1],i=e[2],o=r[0],a=r[1],c=r[2],u=r[3],h=u*n+a*i-c*s,f=u*s+c*n-o*i,l=u*i+o*s-a*n,d=-o*n-a*s-c*i;return t[0]=h*u+d*-o+f*-c-l*-a,t[1]=f*u+d*-a+l*-o-h*-c,t[2]=l*u+d*-c+h*-a-f*-o,t[3]=e[3],t}function p(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function b(t,e){var r=t[0],s=t[1],i=t[2],o=t[3],a=e[0],c=e[1],u=e[2],h=e[3];return Math.abs(r-a)<=n.b*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(s-c)<=n.b*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(i-u)<=n.b*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(o-h)<=n.b*Math.max(1,Math.abs(o),Math.abs(h))}var T,w;T=new n.a(4),n.a!=Float32Array&&(T[0]=0,T[1]=0,T[2]=0,T[3]=0),w=T},function(t,e,r){"use strict";r.d(e,"o",(function(){return s})),r.d(e,"d",(function(){return i})),r.d(e,"a",(function(){return o})),r.d(e,"f",(function(){return a})),r.d(e,"n",(function(){return c})),r.d(e,"m",(function(){return u})),r.d(e,"i",(function(){return h})),r.d(e,"j",(function(){return f})),r.d(e,"k",(function(){return l})),r.d(e,"l",(function(){return d})),r.d(e,"b",(function(){return y})),r.d(e,"c",(function(){return m})),r.d(e,"h",(function(){return g})),r.d(e,"g",(function(){return p})),r.d(e,"e",(function(){return b}));var n=r(0);function s(t,e){if(t===e){var r=e[1],n=e[2],s=e[3],i=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]=n,t[9]=i,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];return t}function i(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],h=e[8],f=e[9],l=e[10],d=e[11],y=e[12],m=e[13],g=e[14],p=e[15],b=r*a-n*o,T=r*c-s*o,w=r*u-i*o,E=n*c-s*a,O=n*u-i*a,_=s*u-i*c,A=h*m-f*y,I=h*g-l*y,v=h*p-d*y,S=f*g-l*m,N=f*p-d*m,x=l*p-d*g,M=b*x-T*N+w*S+E*v-O*I+_*A;return M?(M=1/M,t[0]=(a*x-c*N+u*S)*M,t[1]=(s*N-n*x-i*S)*M,t[2]=(m*_-g*O+p*E)*M,t[3]=(l*O-f*_-d*E)*M,t[4]=(c*v-o*x-u*I)*M,t[5]=(r*x-s*v+i*I)*M,t[6]=(g*w-y*_-p*T)*M,t[7]=(h*_-l*w+d*T)*M,t[8]=(o*N-a*v+u*A)*M,t[9]=(n*v-r*N-i*A)*M,t[10]=(y*O-m*w+p*b)*M,t[11]=(f*w-h*O-d*b)*M,t[12]=(a*I-o*S-c*A)*M,t[13]=(r*S-n*I+s*A)*M,t[14]=(m*T-y*E-g*b)*M,t[15]=(h*E-f*T+l*b)*M,t):null}function o(t){var e=t[0],r=t[1],n=t[2],s=t[3],i=t[4],o=t[5],a=t[6],c=t[7],u=t[8],h=t[9],f=t[10],l=t[11],d=t[12],y=t[13],m=t[14],g=t[15];return(e*o-r*i)*(f*g-l*m)-(e*a-n*i)*(h*g-l*y)+(e*c-s*i)*(h*m-f*y)+(r*a-n*o)*(u*g-l*d)-(r*c-s*o)*(u*m-f*d)+(n*c-s*a)*(u*y-h*d)}function a(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],h=e[7],f=e[8],l=e[9],d=e[10],y=e[11],m=e[12],g=e[13],p=e[14],b=e[15],T=r[0],w=r[1],E=r[2],O=r[3];return t[0]=T*n+w*a+E*f+O*m,t[1]=T*s+w*c+E*l+O*g,t[2]=T*i+w*u+E*d+O*p,t[3]=T*o+w*h+E*y+O*b,T=r[4],w=r[5],E=r[6],O=r[7],t[4]=T*n+w*a+E*f+O*m,t[5]=T*s+w*c+E*l+O*g,t[6]=T*i+w*u+E*d+O*p,t[7]=T*o+w*h+E*y+O*b,T=r[8],w=r[9],E=r[10],O=r[11],t[8]=T*n+w*a+E*f+O*m,t[9]=T*s+w*c+E*l+O*g,t[10]=T*i+w*u+E*d+O*p,t[11]=T*o+w*h+E*y+O*b,T=r[12],w=r[13],E=r[14],O=r[15],t[12]=T*n+w*a+E*f+O*m,t[13]=T*s+w*c+E*l+O*g,t[14]=T*i+w*u+E*d+O*p,t[15]=T*o+w*h+E*y+O*b,t}function c(t,e,r){var n,s,i,o,a,c,u,h,f,l,d,y,m=r[0],g=r[1],p=r[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*p+e[12],t[13]=e[1]*m+e[5]*g+e[9]*p+e[13],t[14]=e[2]*m+e[6]*g+e[10]*p+e[14],t[15]=e[3]*m+e[7]*g+e[11]*p+e[15]):(n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],h=e[7],f=e[8],l=e[9],d=e[10],y=e[11],t[0]=n,t[1]=s,t[2]=i,t[3]=o,t[4]=a,t[5]=c,t[6]=u,t[7]=h,t[8]=f,t[9]=l,t[10]=d,t[11]=y,t[12]=n*m+a*g+f*p+e[12],t[13]=s*m+c*g+l*p+e[13],t[14]=i*m+u*g+d*p+e[14],t[15]=o*m+h*g+y*p+e[15]),t}function u(t,e,r){var n=r[0],s=r[1],i=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function h(t,e,r,s){var i,o,a,c,u,h,f,l,d,y,m,g,p,b,T,w,E,O,_,A,I,v,S,N,x=s[0],M=s[1],L=s[2],j=Math.hypot(x,M,L);return j<n.b?null:(x*=j=1/j,M*=j,L*=j,i=Math.sin(r),a=1-(o=Math.cos(r)),c=e[0],u=e[1],h=e[2],f=e[3],l=e[4],d=e[5],y=e[6],m=e[7],g=e[8],p=e[9],b=e[10],T=e[11],w=x*x*a+o,E=M*x*a+L*i,O=L*x*a-M*i,_=x*M*a-L*i,A=M*M*a+o,I=L*M*a+x*i,v=x*L*a+M*i,S=M*L*a-x*i,N=L*L*a+o,t[0]=c*w+l*E+g*O,t[1]=u*w+d*E+p*O,t[2]=h*w+y*E+b*O,t[3]=f*w+m*E+T*O,t[4]=c*_+l*A+g*I,t[5]=u*_+d*A+p*I,t[6]=h*_+y*A+b*I,t[7]=f*_+m*A+T*I,t[8]=c*v+l*S+g*N,t[9]=u*v+d*S+p*N,t[10]=h*v+y*S+b*N,t[11]=f*v+m*S+T*N,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function f(t,e,r){var n=Math.sin(r),s=Math.cos(r),i=e[4],o=e[5],a=e[6],c=e[7],u=e[8],h=e[9],f=e[10],l=e[11];return 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]=i*s+u*n,t[5]=o*s+h*n,t[6]=a*s+f*n,t[7]=c*s+l*n,t[8]=u*s-i*n,t[9]=h*s-o*n,t[10]=f*s-a*n,t[11]=l*s-c*n,t}function l(t,e,r){var n=Math.sin(r),s=Math.cos(r),i=e[0],o=e[1],a=e[2],c=e[3],u=e[8],h=e[9],f=e[10],l=e[11];return 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]=i*s-u*n,t[1]=o*s-h*n,t[2]=a*s-f*n,t[3]=c*s-l*n,t[8]=i*n+u*s,t[9]=o*n+h*s,t[10]=a*n+f*s,t[11]=c*n+l*s,t}function d(t,e,r){var n=Math.sin(r),s=Math.cos(r),i=e[0],o=e[1],a=e[2],c=e[3],u=e[4],h=e[5],f=e[6],l=e[7];return 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]=i*s+u*n,t[1]=o*s+h*n,t[2]=a*s+f*n,t[3]=c*s+l*n,t[4]=u*s-i*n,t[5]=h*s-o*n,t[6]=f*s-a*n,t[7]=l*s-c*n,t}function y(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=r+r,a=n+n,c=s+s,u=r*o,h=n*o,f=n*a,l=s*o,d=s*a,y=s*c,m=i*o,g=i*a,p=i*c;return t[0]=1-f-y,t[1]=h+p,t[2]=l-g,t[3]=0,t[4]=h-p,t[5]=1-u-y,t[6]=d+m,t[7]=0,t[8]=l+g,t[9]=d-m,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function m(t,e,r,n,s,i,o){var a=1/(r-e),c=1/(s-n),u=1/(i-o);return t[0]=2*i*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*i*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(s+n)*c,t[10]=(o+i)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*i*2*u,t[15]=0,t}function g(t,e,r,n,s){var i,o=1/Math.tan(e/2);return 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?(i=1/(n-s),t[10]=(s+n)*i,t[14]=2*s*n*i):(t[10]=-1,t[14]=-2*n),t}function p(t,e,r,n,s,i,o){var a=1/(e-r),c=1/(n-s),u=1/(i-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*a,t[13]=(s+n)*c,t[14]=(o+i)*u,t[15]=1,t}function b(t,e,r,s){var i,o,a,c,u,h,f,l,d,y,m=e[0],g=e[1],p=e[2],b=s[0],T=s[1],w=s[2],E=r[0],O=r[1],_=r[2];return Math.abs(m-E)<n.b&&Math.abs(g-O)<n.b&&Math.abs(p-_)<n.b?function(t){return 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}(t):(f=m-E,l=g-O,d=p-_,i=T*(d*=y=1/Math.hypot(f,l,d))-w*(l*=y),o=w*(f*=y)-b*d,a=b*l-T*f,(y=Math.hypot(i,o,a))?(i*=y=1/y,o*=y,a*=y):(i=0,o=0,a=0),c=l*a-d*o,u=d*i-f*a,h=f*o-l*i,(y=Math.hypot(c,u,h))?(c*=y=1/y,u*=y,h*=y):(c=0,u=0,h=0),t[0]=i,t[1]=c,t[2]=f,t[3]=0,t[4]=o,t[5]=u,t[6]=l,t[7]=0,t[8]=a,t[9]=h,t[10]=d,t[11]=0,t[12]=-(i*m+o*g+a*p),t[13]=-(c*m+u*g+h*p),t[14]=-(f*m+l*g+d*p),t[15]=1,t)}},function(t,e,r){"use strict";function n(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}r.d(e,"a",(function(){return n}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return s})),r.d(e,"i",(function(){return i})),r.d(e,"d",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"e",(function(){return c})),r.d(e,"h",(function(){return u})),r.d(e,"f",(function(){return h})),r.d(e,"g",(function(){return f})),r.d(e,"c",(function(){return l}));var n=r(0);function s(){var t=new n.a(9);return n.a!=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}function i(t,e){if(t===e){var r=e[1],n=e[2],s=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,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];return t}function o(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],h=e[8],f=h*o-a*u,l=-h*i+a*c,d=u*i-o*c,y=r*f+n*l+s*d;return y?(y=1/y,t[0]=f*y,t[1]=(-h*n+s*u)*y,t[2]=(a*n-s*o)*y,t[3]=l*y,t[4]=(h*r-s*c)*y,t[5]=(-a*r+s*i)*y,t[6]=d*y,t[7]=(-u*r+n*c)*y,t[8]=(o*r-n*i)*y,t):null}function a(t){var e=t[0],r=t[1],n=t[2],s=t[3],i=t[4],o=t[5],a=t[6],c=t[7],u=t[8];return e*(u*i-o*c)+r*(-u*s+o*a)+n*(c*s-i*a)}function c(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],h=e[7],f=e[8],l=r[0],d=r[1],y=r[2],m=r[3],g=r[4],p=r[5],b=r[6],T=r[7],w=r[8];return t[0]=l*n+d*o+y*u,t[1]=l*s+d*a+y*h,t[2]=l*i+d*c+y*f,t[3]=m*n+g*o+p*u,t[4]=m*s+g*a+p*h,t[5]=m*i+g*c+p*f,t[6]=b*n+T*o+w*u,t[7]=b*s+T*a+w*h,t[8]=b*i+T*c+w*f,t}function u(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],h=e[7],f=e[8],l=r[0],d=r[1];return t[0]=n,t[1]=s,t[2]=i,t[3]=o,t[4]=a,t[5]=c,t[6]=l*n+d*o+u,t[7]=l*s+d*a+h,t[8]=l*i+d*c+f,t}function h(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],h=e[7],f=e[8],l=Math.sin(r),d=Math.cos(r);return t[0]=d*n+l*o,t[1]=d*s+l*a,t[2]=d*i+l*c,t[3]=d*o-l*n,t[4]=d*a-l*s,t[5]=d*c-l*i,t[6]=u,t[7]=h,t[8]=f,t}function f(t,e,r){var n=r[0],s=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*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}function l(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=r+r,a=n+n,c=s+s,u=r*o,h=n*o,f=n*a,l=s*o,d=s*a,y=s*c,m=i*o,g=i*a,p=i*c;return t[0]=1-f-y,t[3]=h-p,t[6]=l+g,t[1]=h+p,t[4]=1-u-y,t[7]=d-m,t[2]=l-g,t[5]=d+m,t[8]=1-u-f,t}},function(t,e,r){"use strict";function n(t,e,r){const n=e[0],s=e[1],i=r[3]*n+r[7]*s||1;return t[0]=(r[0]*n+r[4]*s)/i,t[1]=(r[1]*n+r[5]*s)/i,t}function s(t,e,r){const n=e[0],s=e[1],i=e[2],o=r[3]*n+r[7]*s+r[11]*i||1;return t[0]=(r[0]*n+r[4]*s+r[8]*i)/o,t[1]=(r[1]*n+r[5]*s+r[9]*i)/o,t[2]=(r[2]*n+r[6]*s+r[10]*i)/o,t}function i(t,e,r){const n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t[2]=e[2],t}function o(t,e,r){const n=e[0],s=e[1],i=e[2];return t[0]=r[0]*n+r[3]*s+r[6]*i,t[1]=r[1]*n+r[4]*s+r[7]*i,t[2]=r[2]*n+r[5]*s+r[8]*i,t[3]=e[3],t}r.d(e,"a",(function(){return n})),r.d(e,"c",(function(){return s})),r.d(e,"b",(function(){return i})),r.d(e,"d",(function(){return o}))},function(t,e,r){"use strict";r.d(e,"a",(function(){return s})),r.d(e,"b",(function(){return i})),r.d(e,"c",(function(){return o})),r.d(e,"d",(function(){return a}));var n=r(0);function s(t,e,r){var n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t}function i(t,e,r){var n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s+r[4],t[1]=r[1]*n+r[3]*s+r[5],t}function o(t,e,r){var n=e[0],s=e[1];return t[0]=r[0]*n+r[3]*s+r[6],t[1]=r[1]*n+r[4]*s+r[7],t}function a(t,e,r){var n=e[0],s=e[1];return t[0]=r[0]*n+r[4]*s+r[12],t[1]=r[1]*n+r[5]*s+r[13],t}var c,u;c=new n.a(2),n.a!=Float32Array&&(c[0]=0,c[1]=0),u=c},,function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return i})),r.d(e,"b",(function(){return o})),r.d(e,"c",(function(){return a}));const s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},i=s.global||s.self||s.window||{},o="object"!=typeof n||"[object process]"!==String(n)||n.browser,a="function"==typeof importScripts,c=("undefined"!=typeof window&&window.orientation,void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version));c&&parseFloat(c[1])}).call(this,r(20),r(26))},,,function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(3),s=r(6);class i 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 Object(s.a)(!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:Object(n.e)(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(n.b)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+Object(n.d)(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(!Object(n.c)(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 n=0;n<this.ELEMENTS;++n){const s=t[n];this[n]=s+r*(e[n]-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(n.b.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}}},function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return i})),r.d(e,"b",(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},i=s.global||s.self||s.window,o="object"!=typeof n||"[object process]"!==String(n)||n.browser,a=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);a&&parseFloat(a[1])}).call(this,r(20),r(26))},function(t,e){},,function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(14),s=r(1),i=r(6);class o extends n.a{get ELEMENTS(){return Object(i.a)(!1),0}copy(t){return Object(i.a)(!1),this}get x(){return this[0]}set x(t){this[0]=Object(s.a)(t)}get y(){return this[1]}set y(t){this[1]=Object(s.a)(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 n=this[r]-t[r];e+=n*n}return Object(s.a)(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return Object(s.a)(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 Object(i.a)(t>=0&&t<this.ELEMENTS,"index is out of range"),Object(s.a)(this[t])}setComponent(t,e){return Object(i.a)(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))}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(14),s=r(1),i=r(3),o=r(6);class a extends n.a{get ELEMENTS(){return Object(o.a)(!1),0}get RANK(){return Object(o.a)(!1),0}toString(){let t="[";if(i.b.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]=Object(s.a)(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,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){var r,n,s=t.exports={};function i(){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===i||!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:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var c,u=[],h=!1,f=-1;function l(){h&&c&&(h=!1,c.length?u=c.concat(u):f=-1,u.length&&d())}function d(){if(!h){var t=a(l);h=!0;for(var e=u.length;e;){for(c=u,u=[];++f<e;)c&&c[f].run();f=-1,e=u.length}c=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function y(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];u.push(new y(t,e)),1!==u.length||h||a(d)},y.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){(function(e){const n=r(35),s="undefined"==typeof window?e:window;s.loaders=s.loaders||{},t.exports=Object.assign(s.loaders,n)}).call(this,r(20))},,,,,,,,function(t,e,r){"use strict";r.r(e),r.d(e,"Tiles3DLoader",(function(){return Kr})),r.d(e,"CesiumIonLoader",(function(){return un})),r.d(e,"Tile3DWriter",(function(){return bn})),r.d(e,"Tile3DFeatureTable",(function(){return pt})),r.d(e,"Tile3DBatchTable",(function(){return Nt})),r.d(e,"TILE3D_TYPE",(function(){return p})),r.d(e,"_getIonTilesetMetadata",(function(){return cn}));var n={};r.r(n),r.d(n,"dirname",(function(){return c})),r.d(n,"join",(function(){return u}));var s={};r.r(s),r.d(s,"decode",(function(){return De})),r.d(s,"encode",(function(){return Ce}));var i={};r.r(i),r.d(i,"decode",(function(){return ze})),r.d(i,"encode",(function(){return Ve}));var o={};r.r(o),r.d(o,"decode",(function(){return Ge})),r.d(o,"encode",(function(){return qe}));var a={};function c(t){const e=t&&t.lastIndexOf("/");return e>=0?t.substr(0,e):""}function u(...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.r(a),r.d(a,"decode",(function(){return He})),r.d(a,"encode",(function(){return We}));r(25);const h=1,f=2,l="empty",d="scenegraph",y="pointcloud",m="TILES3D",g="geometricError",p={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect"},b=(Object.keys(p),{BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]});function T(t,e){if(!t)throw new Error(e||"loader assertion failed.")}function w(t,e,r){T(t instanceof ArrayBuffer);const n=new TextDecoder("utf8"),s=new Uint8Array(t,e,r);return n.decode(s)}const E={name:"Draco",id:"draco",module:"draco",shapes:["mesh"],version:"3.1.0-alpha.1",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function O(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class _{constructor(t,e){O(this,"fields",void 0),O(this,"metadata",void 0),function(t,e){if(!t)throw new Error(e||"loader assertion failed.")}(Array.isArray(t)),function(t){const e={};for(const r of t)e[r.name]&&console.warn("Schema: duplicated field name",r.name,r),e[r.name]=!0}(t),this.fields=t,this.metadata=e||new Map}compareTo(t){if(this.metadata!==t.metadata)return!1;if(this.fields.length!==t.fields.length)return!1;for(let e=0;e<this.fields.length;++e)if(!this.fields[e].compareTo(t.fields[e]))return!1;return!0}select(...t){const e=Object.create(null);for(const r of t)e[r]=!0;const r=this.fields.filter(t=>e[t.name]);return new _(r,this.metadata)}selectAt(...t){const e=t.map(t=>this.fields[t]).filter(Boolean);return new _(e,this.metadata)}assign(t){let e,r=this.metadata;if(t instanceof _){const n=t;e=n.fields,r=A(A(new Map,this.metadata),n.metadata)}else e=t;const n=Object.create(null);for(const t of this.fields)n[t.name]=t;for(const t of e)n[t.name]=t;const s=Object.values(n);return new _(s,r)}}function A(t,e){return new Map([...t||new Map,...e||new Map])}function I(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class v{constructor(t,e,r=!1,n=new Map){I(this,"name",void 0),I(this,"type",void 0),I(this,"nullable",void 0),I(this,"metadata",void 0),this.name=t,this.type=e,this.nullable=r,this.metadata=n}get typeId(){return this.type&&this.type.typeId}clone(){return new v(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}let S,N,x,M,L,j,R,U,P;function B(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(S||(S={}));class D{static isNull(t){return t&&t.typeId===S.Null}static isInt(t){return t&&t.typeId===S.Int}static isFloat(t){return t&&t.typeId===S.Float}static isBinary(t){return t&&t.typeId===S.Binary}static isUtf8(t){return t&&t.typeId===S.Utf8}static isBool(t){return t&&t.typeId===S.Bool}static isDecimal(t){return t&&t.typeId===S.Decimal}static isDate(t){return t&&t.typeId===S.Date}static isTime(t){return t&&t.typeId===S.Time}static isTimestamp(t){return t&&t.typeId===S.Timestamp}static isInterval(t){return t&&t.typeId===S.Interval}static isList(t){return t&&t.typeId===S.List}static isStruct(t){return t&&t.typeId===S.Struct}static isUnion(t){return t&&t.typeId===S.Union}static isFixedSizeBinary(t){return t&&t.typeId===S.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===S.FixedSizeList}static isMap(t){return t&&t.typeId===S.Map}static isDictionary(t){return t&&t.typeId===S.Dictionary}get typeId(){return S.NONE}compareTo(t){return this===t}}Symbol.toStringTag;Symbol.toStringTag;N=Symbol.toStringTag;class C extends D{constructor(t,e){super(),B(this,"isSigned",void 0),B(this,"bitWidth",void 0),this.isSigned=t,this.bitWidth=e}get typeId(){return S.Int}get[N](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class k extends C{constructor(){super(!0,8)}}class F extends C{constructor(){super(!0,16)}}class z extends C{constructor(){super(!0,32)}}class V extends C{constructor(){super(!1,8)}}class G extends C{constructor(){super(!1,16)}}class q extends C{constructor(){super(!1,32)}}const H=32,W=64;x=Symbol.toStringTag;class $ extends D{constructor(t){super(),B(this,"precision",void 0),this.precision=t}get typeId(){return S.Float}get[x](){return"Float"}toString(){return"Float"+this.precision}}class K extends ${constructor(){super(H)}}class Q extends ${constructor(){super(W)}}Symbol.toStringTag;Symbol.toStringTag;M=Symbol.toStringTag;L=Symbol.toStringTag;j=Symbol.toStringTag;R=Symbol.toStringTag;U=Symbol.toStringTag;class Y extends D{constructor(t,e){super(),B(this,"listSize",void 0),B(this,"children",void 0),this.listSize=t,this.children=[e]}get typeId(){return S.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[U](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}P=Symbol.toStringTag;function Z(t,e,r){const n=function(t){switch(t.constructor){case Int8Array:return new k;case Uint8Array:return new V;case Int16Array:return new F;case Uint16Array:return new G;case Int32Array:return new z;case Uint32Array:return new q;case Float32Array:return new K;case Float64Array:return new Q;default:throw new Error("array type not supported")}}(e.value),s=r||function(t){const e=new Map;"byteOffset"in t&&e.set("byteOffset",t.byteOffset.toString(10));"byteStride"in t&&e.set("byteStride",t.byteStride.toString(10));"normalized"in t&&e.set("normalized",t.normalized.toString());return e}(e);return new v(t,new Y(e.size,new v("value",n)),!1,s)}function J(t,e,r){return Z(t,e,r?X(r.metadata):void 0)}function X(t){const e=new Map;for(const r in t)e.set(r+".string",JSON.stringify(t[r]));return e}function tt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const et={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},rt={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class nt{constructor(t){tt(this,"draco",void 0),tt(this,"decoder",void 0),tt(this,"metadataQuerier",void 0),this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,e={}){const r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);const n=this.decoder.GetEncodedGeometryType(r),s=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let t;switch(n){case this.draco.TRIANGULAR_MESH:t=this.decoder.DecodeBufferToMesh(r,s);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(r,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!s.ptr){const e="DRACO decompression failed: "+t.error_msg();throw new Error(e)}const i=this._getDracoLoaderData(s,n,e),o=this._getMeshData(s,i,e),a=function(t){let e=1/0,r=1/0,n=1/0,s=-1/0,i=-1/0,o=-1/0;const a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let t=0;t<c;t+=3){const c=a[t],u=a[t+1],h=a[t+2];e=c<e?c:e,r=u<r?u:r,n=h<n?h:n,s=c>s?c:s,i=u>i?u:i,o=h>o?h:o}return[[e,r,n],[s,i,o]]}(o.attributes),c=function(t,e,r){const n=X(e.metadata),s=[],i=function(t){const e={};for(const r in t){const n=t[r];e[n.name||"undefined"]=n}return e}(e.attributes);for(const e in t){const r=J(e,t[e],i[e]);s.push(r)}if(r){const t=J("indices",r);s.push(t)}return new _(s,n)}(o.attributes,i,o.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:a},...o,schema:c}}finally{this.draco.destroy(r),s&&this.draco.destroy(s)}}_getDracoLoaderData(t,e,r){const n=this._getTopLevelMetadata(t),s=this._getDracoAttributes(t,r);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:n,attributes:s}}_getDracoAttributes(t,e){const r={};for(let n=0;n<t.num_attributes();n++){const s=this.decoder.GetAttribute(t,n),i=this._getAttributeMetadata(t,n);r[s.unique_id()]={unique_id:s.unique_id(),attribute_type:s.attribute_type(),data_type:s.data_type(),num_components:s.num_components(),byte_offset:s.byte_offset(),byte_stride:s.byte_stride(),normalized:s.normalized(),attribute_index:n,metadata:i};const o=this._getQuantizationTransform(s,e);o&&(r[s.unique_id()].quantization_transform=o);const a=this._getOctahedronTransform(s,e);a&&(r[s.unique_id()].octahedron_transform=a)}return r}_getMeshData(t,e,r){const n=this._getMeshAttributes(e,t,r);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(t,e,r){const n={};for(const s of Object.values(t.attributes)){const t=this._deduceAttributeName(s,r);s.name=t;const{value:i,size:o}=this._getAttributeValues(e,s);n[t]={value:i,size:o,byteOffset:s.byte_offset,byteStride:s.byte_stride,normalized:s.normalized}}return n}_getTriangleListIndices(t){const e=3*t.num_faces(),r=4*e,n=this.draco._malloc(r);try{return this.decoder.GetTrianglesUInt32Array(t,r,n),new Uint32Array(this.draco.HEAPF32.buffer,n,e).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(t){const e=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,e),function(t){const e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){const r=rt[e.data_type],n=e.num_components,s=t.num_points()*n,i=s*r.BYTES_PER_ELEMENT,o=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}(this.draco,r);let a;const c=this.draco._malloc(i);try{const n=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,n,o,i,c),a=new r(this.draco.HEAPF32.buffer,c,s).slice()}finally{this.draco._free(c)}return{value:a,size:n}}_deduceAttributeName(t,e){const r=t.unique_id;for(const[t,n]of Object.entries(e.extraAttributes||{}))if(n===r)return t;const n=t.attribute_type;for(const t in et){if(this.draco[t]===n)return et[t]}const s=e.attributeNameEntry||"name";return t.metadata[s]?t.metadata[s].string:"CUSTOM_ATTRIBUTE_"+r}_getTopLevelMetadata(t){const e=this.decoder.GetMetadata(t);return this._getDracoMetadata(e)}_getAttributeMetadata(t,e){const r=this.decoder.GetAttributeMetadata(t,e);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};const e={},r=this.metadataQuerier.NumEntries(t);for(let n=0;n<r;n++){const r=this.metadataQuerier.GetEntryName(t,n);e[r]=this._getDracoMetadataField(t,r)}return e}_getDracoMetadataField(t,e){const r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,e,r);const n=function(t){const e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}(r);return{int:this.metadataQuerier.GetIntEntry(t,e),string:this.metadataQuerier.GetStringEntry(t,e),double:this.metadataQuerier.GetDoubleEntry(t,e),intArray:n}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){const{quantizedAttributes:e=[],octahedronAttributes:r=[]}=t,n=[...e,...r];for(const t of n)this.decoder.SkipAttributeTransform(this.draco[t])}_getQuantizationTransform(t,e){const{quantizedAttributes:r=[]}=e,n=t.attribute_type();if(r.map(t=>this.decoder[t]).includes(n)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits(),range:e.range(),min_values:new Float32Array([1,2,3]).map(t=>e.min_value(t))}}finally{this.draco.destroy(e)}}return null}_getOctahedronTransform(t,e){const{octahedronAttributes:r=[]}=e,n=t.attribute_type();if(r.map(t=>this.decoder[t]).includes(n)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits()}}finally{this.draco.destroy(e)}}return null}}var st=r(11),it=r(16);const ot={};async function at(t,e=null,r={}){return e&&(t=function(t,e,r){if(t.startsWith("http"))return t;const n=r.modules||{};if(n[t])return n[t];if(!st.b)return`modules/${e}/dist/libs/${t}`;if(r.CDN)return function(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}(r.CDN.startsWith("http")),`${r.CDN}/${e}@3.1.0-alpha.1/dist/libs/${t}`;if(st.c)return"../src/libs/"+t;return`modules/${e}/src/libs/${t}`}(t,e,r)),ot[t]=ot[t]||async function(t){if(t.endsWith("wasm")){const e=await fetch(t);return await e.arrayBuffer()}if(!st.b)return it.requireFromFile&&await it.requireFromFile(t);if(st.c)return importScripts(t);const e=await fetch(t);return function(t,e){if(!st.b)return it.requireFromString&&it.requireFromString(t,e);if(st.c)return eval.call(st.a,t),null;const r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch(e){r.text=t}return document.body.appendChild(r),null}(await e.text(),t)}(t),await ot[t]}let ct;async function ut(t){const e=t.modules||{};return ct=e.draco3d?ct||e.draco3d.createDecoderModule({}).then(t=>({draco:t})):ct||async function(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await at("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",t);break;case"wasm":default:[e,r]=await Promise.all([await at("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",t),await at("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","draco",t)])}return e=e||globalThis.DracoDecoderModule,await function(t,e){const r={};e&&(r.wasmBinary=e);return new Promise(e=>{t({...r,onModuleLoaded:t=>e({draco:t})})})}(e,r)}(t),await ct}const ht={...E,parse:async function(t,e){const{draco:r}=await ut(e),n=new nt(r);try{return n.parseSync(t,null==e?void 0:e.draco)}finally{n.destroy()}}};const ft={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},lt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...ft};var dt=r(40);const yt={[ft.DOUBLE]:Float64Array,[ft.FLOAT]:Float32Array,[ft.UNSIGNED_SHORT]:Uint16Array,[ft.UNSIGNED_INT]:Uint32Array,[ft.UNSIGNED_BYTE]:Uint8Array,[ft.BYTE]:Int8Array,[ft.SHORT]:Int16Array,[ft.INT]:Int32Array},mt={DOUBLE:ft.DOUBLE,FLOAT:ft.FLOAT,UNSIGNED_SHORT:ft.UNSIGNED_SHORT,UNSIGNED_INT:ft.UNSIGNED_INT,UNSIGNED_BYTE:ft.UNSIGNED_BYTE,BYTE:ft.BYTE,SHORT:ft.SHORT,INT:ft.INT};class gt{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(const e in yt){if(yt[e]===t)return e}throw new Error("Failed to convert GL type")}static fromName(t){const e=mt[t];if(!e)throw new Error("Failed to convert GL type");return e}static getArrayType(t){switch(t){case ft.UNSIGNED_SHORT_5_6_5:case ft.UNSIGNED_SHORT_4_4_4_4:case ft.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const e=yt[t];if(!e)throw new Error("Failed to convert GL type");return e}}static getByteSize(t){return gt.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(gt.getArrayType(t))}static createTypedArray(t,e,r=0,n){void 0===n&&(n=(e.byteLength-r)/gt.getByteSize(t));return new(gt.getArrayType(t))(e,r,n)}}class pt{constructor(t,e){this.json=t,this.buffer=e,this.featuresLength=0,this._cachedTypedArrays={}}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,e=lt.UNSIGNED_INT,r=1){const n=this.json[t];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(t,e,r,1,n.byteOffset):n}getPropertyArray(t,e,r){const n=this.json[t];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(e=gt.fromName(n.componentType)),this._getTypedArrayFromBinary(t,e,r,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(t,e,n)}getProperty(t,e,r,n,s){const i=this.json[t];if(!i)return i;const o=this.getPropertyArray(t,e,r);if(1===r)return o[n];for(let t=0;t<r;++t)s[t]=o[r*n+t];return s}_getTypedArrayFromBinary(t,e,r,n,s){const i=this._cachedTypedArrays;let o=i[t];return o||(o=gt.createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+s,n*r),i[t]=o),o}_getTypedArrayFromArray(t,e,r){const n=this._cachedTypedArrays;let s=n[t];return s||(s=gt.createTypedArray(e,r),n[t]=s),s}}const bt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Tt={SCALAR:(t,e)=>t[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},wt={SCALAR:(t,e,r)=>{e[r]=t},VEC2:(t,e,r)=>{e[2*r+0]=t[0],e[2*r+1]=t[1]},VEC3:(t,e,r)=>{e[3*r+0]=t[0],e[3*r+1]=t[1],e[3*r+2]=t[2]},VEC4:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT2:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT3:(t,e,r)=>{e[9*r+0]=t[0],e[9*r+1]=t[1],e[9*r+2]=t[2],e[9*r+3]=t[3],e[9*r+4]=t[4],e[9*r+5]=t[5],e[9*r+6]=t[6],e[9*r+7]=t[7],e[9*r+8]=t[8],e[9*r+9]=t[9]},MAT4:(t,e,r)=>{e[16*r+0]=t[0],e[16*r+1]=t[1],e[16*r+2]=t[2],e[16*r+3]=t[3],e[16*r+4]=t[4],e[16*r+5]=t[5],e[16*r+6]=t[6],e[16*r+7]=t[7],e[16*r+8]=t[8],e[16*r+9]=t[9],e[16*r+10]=t[10],e[16*r+11]=t[11],e[16*r+12]=t[12],e[16*r+13]=t[13],e[16*r+14]=t[14],e[16*r+15]=t[15]}};const Et=t=>void 0!==t;function Ot(t,e,r){if(!e)return null;let n=t.getExtension("3DTILES_batch_table_hierarchy");const s=e.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=s,n=s),n?function(t,e){let r,n,s;const i=t.instancesLength,o=t.classes;let a,c=t.classIds,u=t.parentCounts,h=t.parentIds,f=i;Et(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,i));if(Et(u))for(Et(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,s=getBinaryAccessor(u),u=s.createArrayBufferView(e.buffer,e.byteOffset+u.byteOffset,i)),a=new Uint16Array(i),f=0,r=0;r<i;++r)a[r]=f,f+=u[r];Et(h)&&Et(h.byteOffset)&&(h.componentType=defaultValue(h.componentType,GL.UNSIGNED_SHORT),h.type=AttributeType.SCALAR,s=getBinaryAccessor(h),h=s.createArrayBufferView(e.buffer,e.byteOffset+h.byteOffset,f));const l=o.length;for(r=0;r<l;++r){const t=o[r].length,n=o[r].instances,s=getBinaryProperties(t,n,e);o[r].instances=combine(s,n)}const d=new Array(l).fill(0),y=new Uint16Array(i);for(r=0;r<i;++r)n=c[r],y[r]=d[n],++d[n];const m={classes:o,classIds:c,classIndexes:y,parentCounts:u,parentIndexes:a,parentIds:h};return function(t){const e=t.classIds.length;for(let r=0;r<e;++r)At(t,r,stack)}(m),m}(n,r):null}function _t(t,e,r){if(!t)return;const n=t.parentCounts;return t.parentIds?r(t,e):n>0?function(t,e,r){const n=t.classIds,s=t.parentCounts,i=t.parentIds,o=t.parentIndexes,a=n.length,c=scratchVisited;c.length=Math.max(c.length,a);const u=++marker,h=scratchStack;h.length=0,h.push(e);for(;h.length>0;){if(e=h.pop(),c[e]===u)continue;c[e]=u;const n=r(t,e);if(Et(n))return n;const a=s[e],f=o[e];for(let t=0;t<a;++t){const r=i[f+t];r!==e&&h.push(r)}}return null}(t,e,r):function(t,e,r){let n=!0;for(;n;){const s=r(t,e);if(Et(s))return s;const i=t.parentIds[e];n=i!==e,e=i}throw new Error("traverseHierarchySingleParent")}(t,e,r)}function At(t,e,r){const n=t.parentCounts,s=t.parentIds,i=t.parentIndexes,o=t.classIds.length;if(!Et(s))return;assert(e<o,`Parent index ${e} exceeds the total number of instances: ${o}`),assert(-1===r.indexOf(e),"Circular dependency detected in the batch table hierarchy."),r.push(e);const a=Et(n)?n[e]:1,c=Et(n)?i[e]:e;for(let n=0;n<a;++n){const i=s[c+n];i!==e&&At(t,i,r)}r.pop(e)}function It(t){return null!=t}const vt=(t,e)=>t,St={HIERARCHY:!0,extensions:!0,extras:!0};class Nt{constructor(t,e,r,n={}){var s;T(r>=0),this.json=t||{},this.binary=e,this.featureCount=r,this._extensions=(null===(s=this.json)||void 0===s?void 0:s.extensions)||{},this._properties={};for(const t in this.json)St[t]||(this._properties[t]=this.json[t]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Ot(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,e){if(this._checkBatchId(t),T("string"==typeof e,e),this._hierarchy){return It(_t(this._hierarchy,t,(t,r)=>{const n=t.classIds[r];return t.classes[n].name===e}))}return!1}isExactClass(t,e){return T("string"==typeof e,e),this.getExactClassName(t)===e}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){const e=this._hierarchy.classIds[t];return this._hierarchy.classes[e].name}}hasProperty(t,e){return this._checkBatchId(t),T("string"==typeof e,e),It(this._properties[e])||this._hasPropertyInHierarchy(t,e)}getPropertyNames(t,e){this._checkBatchId(t),(e=It(e)?e:[]).length=0;const r=Object.keys(this._properties);return e.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(t,e),e}getProperty(t,e){if(this._checkBatchId(t),T("string"==typeof e,e),this._binaryProperties){const r=this._binaryProperties[e];if(It(r))return this._getBinaryProperty(r,t)}const r=this._properties[e];if(It(r))return vt(r[t]);if(this._hierarchy){const r=this._getHierarchyProperty(t,e);if(It(r))return r}}setProperty(t,e,r){const n=this.featureCount;if(this._checkBatchId(t),T("string"==typeof e,e),this._binaryProperties){const n=this._binaryProperties[e];if(n)return void this._setBinaryProperty(n,t,r)}if(this._hierarchy&&this._setHierarchyProperty(this,t,e,r))return;let s=this._properties[e];It(s)||(this._properties[e]=new Array(n),s=this._properties[e]),s[t]=vt(r)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,e){return t.unpack(t.typedArray,e)}_setBinaryProperty(t,e,r){t.pack(r,t.typedArray,e)}_initializeBinaryProperties(){let t=null;for(const e in this._properties){const r=this._properties[e],n=this._initializeBinaryProperty(e,r);n&&(t=t||{},t[e]=n)}return t}_initializeBinaryProperty(t,e){if("byteOffset"in e){const r=e;T(this.binary,`Property ${t} requires a batch table binary.`),T(r.type,`Property ${t} requires a type.`);const n=function(t,e,r,n){const{componentType:s}=t;T(t.componentType);const i="string"==typeof s?gt.fromName(s):s,o=bt[t.type],a=Tt[t.type],c=wt[t.type];return r+=t.byteOffset,{values:gt.createTypedArray(i,e,r,o*n),type:i,size:o,unpacker:a,packer:c}}(r,this.binary.buffer,0|this.binary.byteOffset,this.featureCount);return{typedArray:n.values,componentCount:n.size,unpack:n.unpacker,pack:n.packer}}return null}_hasPropertyInHierarchy(t,e){if(!this._hierarchy)return!1;const r=_t(this._hierarchy,t,(t,r)=>{const n=t.classIds[r];return It(t.classes[n].instances[e])});return It(r)}_getPropertyNamesInHierarchy(t,e){_t(this._hierarchy,t,(t,r)=>{const n=t.classIds[r],s=t.classes[n].instances;for(const t in s)s.hasOwnProperty(t)&&-1===e.indexOf(t)&&e.push(t)})}_getHierarchyProperty(t,e){return _t(this._hierarchy,t,(t,r)=>{const n=t.classIds[r],s=t.classes[n],i=t.classIndexes[r],o=s.instances[e];return It(o)?It(o.typedArray)?this._getBinaryProperty(o,i):vt(o[i]):null})}_setHierarchyProperty(t,e,r,n){const s=_t(this._hierarchy,e,(t,s)=>{const i=t.classIds[s],o=t.classes[i],a=t.classIndexes[s],c=o.instances[r];return!!It(c)&&(T(s===e,`Inherited property "${r}" is read-only.`),It(c.typedArray)?this._setBinaryProperty(c,a,n):c[a]=vt(n),!0)});return It(s)}}function xt(t,e,r=0){const n=new DataView(e);if(t.magic=n.getUint32(r,!0),r+=4,t.version=n.getUint32(r,!0),r+=4,t.byteLength=n.getUint32(r,!0),r+=4,1!==t.version)throw new Error(`3D Tile Version ${t.version} not supported`);return r}function Mt(t,e,r){const n=new DataView(e);let s;t.header=t.header||{};let i=n.getUint32(r,!0);r+=4;let o=n.getUint32(r,!0);r+=4;let a=n.getUint32(r,!0);r+=4;let c=n.getUint32(r,!0);return r+=4,a>=570425344?(r-=8,s=i,a=o,c=0,i=0,o=0,console.warn("b3dm tile in legacy format.")):c>=570425344&&(r-=4,s=a,a=i,c=o,i=0,o=0,console.warn("b3dm tile in legacy format.")),t.header.featureTableJsonByteLength=i,t.header.featureTableBinaryByteLength=o,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=s,r}function Lt(t,e,r,n){return r=function(t,e,r,n){const{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=t.header;if(t.featureTableJson={BATCH_LENGTH:o||0},s>0){const n=w(e,r,s);t.featureTableJson=JSON.parse(n)}return r+=s,t.featureTableBinary=new Uint8Array(e,r,i),r+=i}(t,e,r),r=function(t,e,r,n){const{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=t.header;if(s>0){const n=w(e,r,s);t.batchTableJson=JSON.parse(n),r+=s,i>0&&(t.batchTableBinary=new Uint8Array(e,r,i),t.batchTableBinary=new Uint8Array(t.batchTableBinary),r+=i)}return r}(t,e,r)}function jt(t,e=[0,0,0]){const r=t>>11&31,n=t>>5&63,s=31&t;return e[0]=r<<3,e[1]=n<<2,e[2]=s<<3,e}function Rt(t,e,r){if(!(e||t&&t.batchIds&&r))return null;const{batchIds:n,isRGB565:s,pointCount:i}=t;if(n&&r){const t=new Uint8ClampedArray(3*i);for(let e=0;e<i;e++){const s=n[e],i=r.getProperty(s,"dimensions").map(t=>255*t);t[3*e]=i[0],t[3*e+1]=i[1],t[3*e+2]=i[2]}return{type:lt.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}if(s){const t=new Uint8ClampedArray(3*i);for(let r=0;r<i;r++){const n=jt(e[r]);t[3*r]=n[0],t[3*r+1]=n[1],t[3*r+2]=n[2]}return{type:lt.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}return e&&e.length===3*i?{type:lt.UNSIGNED_BYTE,value:e,size:3,normalized:!0}:{type:lt.UNSIGNED_BYTE,value:e,size:4,normalized:!0}}var Ut=r(18),Pt=r(3),Bt=r(1),Dt=r(9),Ct=r(8);class kt extends Ut.a{constructor(t=0,e=0){super(2),Object(Pt.e)(t)&&1===arguments.length?this.copy(t):(Pt.b.debug&&(Object(Bt.a)(t),Object(Bt.a)(e)),this[0]=t,this[1]=e)}set(t,e){return this[0]=t,this[1]=e,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return Pt.b.debug&&(Object(Bt.a)(t.x),Object(Bt.a)(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Dt.d(this,this,t),this.check()}transformAsVector(t){return Object(Ct.a)(this,this,t),this.check()}transformByMatrix3(t){return Dt.c(this,this,t),this.check()}transformByMatrix2x3(t){return Dt.b(this,this,t),this.check()}transformByMatrix2(t){return Dt.a(this,this,t),this.check()}}var Ft=r(41);function zt(t,e){if(!t)throw new Error("math.gl assertion failed. "+e)}new kt,new dt.a,new kt,new kt,new Uint8Array(1);function Vt(t,e=255){return Object(Pt.a)(t,0,e)/e*2-1}function Gt(t){return t<0?-1:1}function qt(t,e,r,n){if(zt(n),t<0||t>r||e<0||e>r)throw new Error("x and y must be unsigned normalized integers between 0 and "+r);if(n.x=Vt(t,r),n.y=Vt(e,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){const t=n.x;n.x=(1-Math.abs(n.y))*Gt(t),n.y=(1-Math.abs(t))*Gt(n.y)}return n.normalize()}function Ht(t,e,r){return qt(t,e,255,r)}const Wt=new dt.a;function $t(t,e,r){return t.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(t.isQuantized=!1,function(t,e){const r=new dt.a,n=new Float32Array(3*t.pointCount);for(let s=0;s<t.pointCount;s++)r.set(e[3*s],e[3*s+1],e[3*s+2]).scale(1/t.quantizedRange).multiply(t.quantizedVolumeScale).add(t.quantizedVolumeOffset).toArray(n,3*s);return n}(t,e)):{type:lt.UNSIGNED_SHORT,value:e,size:3,normalized:!0}:e}async function Kt(t,e,r,n,s){r=Lt(t,e,r=Mt(t,e,r=xt(t,e,r))),function(t){t.attributes={positions:null,colors:null,normals:null,batchIds:null},t.isQuantized=!1,t.isTranslucent=!1,t.isRGB565=!1,t.isOctEncoded16P=!1}(t);const{featureTable:i,batchTable:o}=function(t){const e=new pt(t.featureTableJson,t.featureTableBinary),r=e.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");e.featuresLength=r,t.featuresLength=r,t.pointsLength=r,t.pointCount=r,t.rtcCenter=e.getGlobalProperty("RTC_CENTER",lt.FLOAT,3);const n=function(t,e){let r=null;if(!t.batchIds&&e.hasProperty("BATCH_ID")&&(t.batchIds=e.getPropertyArray("BATCH_ID",lt.UNSIGNED_SHORT,1),t.batchIds)){const n=e.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");const{batchTableJson:s,batchTableBinary:i}=t;r=new Nt(s,i,n)}return r}(t,e);return{featureTable:e,batchTable:n}}(t);return await async function(t,e,r,n,s){let i,o,a;const c=t.batchTableJson&&t.batchTableJson.extensions&&t.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);const u=e.getExtension("3DTILES_draco_point_compression");if(u){o=u.properties;const e=u.byteOffset,r=u.byteLength;if(!o||!Number.isFinite(e)||!r)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=t.featureTableBinary.slice(e,e+r),t.hasPositions=Number.isFinite(o.POSITION),t.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),t.hasNormals=Number.isFinite(o.NORMAL),t.hasBatchIds=Number.isFinite(o.BATCH_ID),t.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;const h={buffer:i,properties:{...o,...a},featureTableProperties:o,batchTableProperties:a,dequantizeInShader:!1};return await async function(t,e,r,n){const{parse:s}=n,i={...r,draco:{...r.draco,extraAttributes:e.batchTableProperties||{}}};delete i["3d-tiles"];const o=await s(e.buffer,ht,i),a=o.attributes.POSITION&&o.attributes.POSITION.value,c=o.attributes.COLOR_0&&o.attributes.COLOR_0.value,u=o.attributes.NORMAL&&o.attributes.NORMAL.value,h=o.attributes.BATCH_ID&&o.attributes.BATCH_ID.value,f=a&&o.attributes.POSITION.value.quantization,l=u&&o.attributes.NORMAL.value.quantization;if(f){const e=o.POSITION.data.quantization,r=e.range;t.quantizedVolumeScale=new dt.a(r,r,r),t.quantizedVolumeOffset=new dt.a(e.minValues),t.quantizedRange=(1<<e.quantizationBits)-1,t.isQuantizedDraco=!0}l&&(t.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,t.isOctEncodedDraco=!0);const d={};if(e.batchTableProperties)for(const t of Object.keys(e.batchTableProperties))o.attributes[t]&&o.attributes[t].value&&(d[t.toLowerCase()]=o.attributes[t].value);t.attributes={positions:a,colors:Rt(t,c),normals:u,batchIds:h,...d}}(t,h,n,s)}(t,i,0,n,s),function(t,e,r){if(!t.attributes.positions)if(e.hasProperty("POSITION"))t.attributes.positions=e.getPropertyArray("POSITION",lt.FLOAT,3);else if(e.hasProperty("POSITION_QUANTIZED")){const n=e.getPropertyArray("POSITION_QUANTIZED",lt.UNSIGNED_SHORT,3);if(t.isQuantized=!0,t.quantizedRange=65535,t.quantizedVolumeScale=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",lt.FLOAT,3),!t.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(t.quantizedVolumeOffset=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",lt.FLOAT,3),!t.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");t.attributes.positions=$t(t,n,r)}if(!t.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}(t,i,n),function(t,e,r){if(!t.attributes.colors){let n=null;e.hasProperty("RGBA")?(n=e.getPropertyArray("RGBA",lt.UNSIGNED_BYTE,4),t.isTranslucent=!0):e.hasProperty("RGB")?n=e.getPropertyArray("RGB",lt.UNSIGNED_BYTE,3):e.hasProperty("RGB565")&&(n=e.getPropertyArray("RGB565",lt.UNSIGNED_SHORT,1),t.isRGB565=!0),t.attributes.colors=Rt(t,n,r)}e.hasProperty("CONSTANT_RGBA")&&(t.constantRGBA=e.getGlobalProperty("CONSTANT_RGBA",lt.UNSIGNED_BYTE,4))}(t,i,o),function(t,e){if(!t.attributes.normals){let r=null;e.hasProperty("NORMAL")?r=e.getPropertyArray("NORMAL",lt.FLOAT,3):e.hasProperty("NORMAL_OCT16P")&&(r=e.getPropertyArray("NORMAL_OCT16P",lt.UNSIGNED_BYTE,2),t.isOctEncoded16P=!0),t.attributes.normals=function(t,e){if(!e)return null;if(t.isOctEncoded16P){const r=new Float32Array(3*t.pointsLength);for(let n=0;n<t.pointsLength;n++)Ht(e[2*n],e[2*n+1],Wt),Wt.toArray(r,3*n);return{type:lt.FLOAT,size:2,value:r}}return{type:lt.FLOAT,size:2,value:e}}(t,r)}}(t,i),r}function Qt(t,e){if(!t)throw new Error(e)}var Yt=r(15);const{_parseImageNode:Zt}=Yt.a,Jt="undefined"!=typeof Image,Xt="undefined"!=typeof ImageBitmap,te=Boolean(Zt),ee=!!Yt.b||te;function re(t){const e=se(t);if(!e)throw new Error("Not an image");return e}function ne(t){switch(re(t)){case"data":return t;case"image":case"imagebitmap":const e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function se(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&t instanceof Image?"image":t&&"object"==typeof t&&t.data&&t.width&&t.height?"data":null}const ie=/^data:image\/svg\+xml/,oe=/\.svg((\?|#).*)?$/;function ae(t){return t&&(ie.test(t)||oe.test(t))}function ce(t,e){if(ae(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function ue(t,e,r){const n=function(t,e){if(ae(e)){let e=(new TextDecoder).decode(t);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(e=unescape(encodeURIComponent(e)))}catch(t){throw new Error(t.message)}return"data:image/svg+xml;base64,"+btoa(e)}return ce(t,e)}(t,r),s=self.URL||self.webkitURL,i="string"!=typeof n&&s.createObjectURL(n);try{return await async function(t,e){const r=new Image;if(r.src=t,e.image&&e.image.decode&&r.decode)return await r.decode(),r;return await new Promise((e,n)=>{try{r.onload=()=>e(r),r.onerror=e=>n(new Error(`Could not load image ${t}: ${e}`))}catch(t){n(t)}})}(i||n,e)}finally{i&&s.revokeObjectURL(i)}}const he={};let fe=!0;async function le(t,e,r){let n;if(ae(r)){n=await ue(t,e,r)}else n=ce(t,r);const s=e&&e.imagebitmap;return await async function(t,e=null){!function(t){for(const e in t||he)return!1;return!0}(e)&&fe||(e=null);if(e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),fe=!1}return await createImageBitmap(t)}(n,s)}function de(t){const e=ye(t);return function(t){const e=ye(t);if(!(e.byteLength>=24&&2303741511===e.getUint32(0,!1)))return null;return{mimeType:"image/png",width:e.getUint32(16,!1),height:e.getUint32(20,!1)}}(e)||function(t){const e=ye(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,!1)&&255===e.getUint8(2)))return null;const{tableMarkers:r,sofMarkers:n}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)t.add(e);const e=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:t,sofMarkers:e}}();let s=2;for(;s+9<e.byteLength;){const t=e.getUint16(s,!1);if(n.has(t))return{mimeType:"image/jpeg",height:e.getUint16(s+5,!1),width:e.getUint16(s+7,!1)};if(!r.has(t))return null;s+=2,s+=e.getUint16(s,!1)}return null}(e)||function(t){const e=ye(t);if(!(e.byteLength>=10&&1195984440===e.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:e.getUint16(6,!0),height:e.getUint16(8,!0)}}(e)||function(t){const e=ye(t);if(!(e.byteLength>=14&&16973===e.getUint16(0,!1)&&e.getUint32(2,!0)===e.byteLength))return null;return{mimeType:"image/bmp",width:e.getUint32(18,!0),height:e.getUint32(22,!0)}}(e)}function ye(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}const me={id:"image",module:"images",name:"Images",version:"3.1.0-alpha.1",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(t,e,r){const n=((e=e||{}).image||{}).type||"auto",{url:s}=r||{};let i;switch(function(t){switch(t){case"auto":case"data":return function(){if(Xt)return"imagebitmap";if(Jt)return"image";if(ee)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return Xt||Jt||ee;case"imagebitmap":return Xt;case"image":return Jt;case"data":return ee;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}(t),t}}(n)){case"imagebitmap":i=await le(t,e,s);break;case"image":i=await ue(t,e,s);break;case"data":i=await function(t,e){const{mimeType:r}=de(t)||{},{_parseImageNode:n}=Yt.a;return Qt(n),n(t,r,e)}(t,e);break;default:Qt(!1)}return"data"===n&&(i=ne(i)),i},tests:[t=>Boolean(de(new DataView(t)))],options:{image:{type:"auto",decode:!0}}};function ge(t,e,r){if(t.byteLength<=e+r)return"";const n=new DataView(t);let s="";for(let t=0;t<r;t++)s+=String.fromCharCode(n.getUint8(e+t));return s}function pe(t){try{return JSON.parse(t)}catch(e){throw new Error(`Failed to parse JSON from data starting with "${function(t,e=5){if("string"==typeof t)return t.slice(0,e);if(ArrayBuffer.isView(t))return ge(t.buffer,t.byteOffset,e);if(t instanceof ArrayBuffer){return ge(t,0,e)}return""}(t)}"`)}}r(21);function be(t,e,r){const n=void 0!==r?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(n).buffer}function Te(t,e){if(!t)throw new Error(e||"assert failed: gltf")}function we(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;const r=e.baseUri||e.uri;if(!r)throw new Error("'baseUri' must be provided to resolve relative url "+t);return r.substr(0,r.lastIndexOf("/")+1)+t}function Ee(t,e,r){const n=t.bufferViews[r];Te(n);const s=e[n.buffer];Te(s);const i=(n.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,i,n.byteLength)}function Oe(t,e){return T(t>=0),T(e>0),t+(e-1)&~(e-1)}function _e(t,e,r){let n;if(t instanceof ArrayBuffer)n=new Uint8Array(t);else{const e=t.byteOffset,r=t.byteLength;n=new Uint8Array(t.buffer||t.arrayBuffer,e,r)}return e.set(n,r),r+Oe(n.byteLength,4)}const Ae=["SCALAR","VEC2","VEC3","VEC4"],Ie=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],ve=new Map(Ie),Se={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ne={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},xe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Me(t){return Ae[t-1]||Ae[0]}function Le(t){const e=ve.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function je(t,e){const r=xe[t.componentType],n=Se[t.type],s=Ne[t.componentType],i=t.count*n,o=t.count*n*s;return Te(o>=0&&o<=e.byteLength),{ArrayType:r,length:i,byteLength:o}}function Re(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const Ue={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class Pe{constructor(t){Re(this,"gltf",void 0),Re(this,"sourceBuffers",void 0),Re(this,"byteLength",void 0),this.gltf=t||{json:{...Ue},buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}getExtension(t){const e=this.getUsedExtensions().find(e=>e===t),r=this.json.extensions||{};return e?r[t]||!0:null}getRequiredExtension(t){return this.getRequiredExtensions().find(e=>e===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(t,e){return(t.extensions||{})[e]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,e){if("object"==typeof e)return e;const r=this.json[t]&&this.json[t][e];if(!r)throw new Error(`glTF file error: Could not find ${t}[${e}]`);return r}getTypedArrayForBufferView(t){const e=(t=this.getBufferView(t)).buffer,r=this.gltf.buffers[e];Te(r);const n=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,n,t.byteLength)}getTypedArrayForAccessor(t){t=this.getAccessor(t);const e=this.getBufferView(t.bufferView),r=this.getBuffer(e.buffer).data,{ArrayType:n,length:s}=je(t,e);return new n(r,e.byteOffset+t.byteOffset,s)}getTypedArrayForImageData(t){t=this.getAccessor(t);const e=this.getBufferView(t.bufferView),r=this.getBuffer(e.buffer).data,n=e.byteOffset||0;return new Uint8Array(r,n,e.byteLength)}addApplicationData(t,e){return this.json[t]=e,this}addExtraData(t,e){return this.json.extras=this.json.extras||{},this.json.extras[t]=e,this}addObjectExtension(t,e,r){return t.extensions=t.extensions||{},t.extensions[e]=r,this.registerUsedExtension(e),this}setObjectExtension(t,e,r){(t.extensions||{})[e]=r}removeObjectExtension(t,e){const r=t.extensions||{},n=r[e];return delete r[e],n}addExtension(t,e={}){return Te(e),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=e,this.registerUsedExtension(t),e}addRequiredExtension(t,e={}){return Te(e),this.addExtension(t,e),this.registerRequiredExtension(t),e}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(e=>e===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(e=>e===t)||this.json.extensionsRequired.push(t)}removeExtension(t){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t),this.json.extensions&&delete this.json.extensions[t]}setDefaultScene(t){this.json.scene=t}addScene(t){const{nodeIndices:e}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:e}),this.json.scenes.length-1}addNode(t){const{meshIndex:e,matrix:r}=t;this.json.nodes=this.json.nodes||[];const n={mesh:e};return r&&(n.matrix=r),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(t){const{attributes:e,indices:r,material:n,mode:s=4}=t,i={primitives:[{attributes:this._addAttributes(e),mode:s}]};if(r){const t=this._addIndices(r);i.primitives[0].indices=t}return Number.isFinite(n)&&(i.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(i),this.json.meshes.length-1}addPointCloud(t){const e={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(e),this.json.meshes.length-1}addImage(t,e){const r=de(t),n=e||(null==r?void 0:r.mimeType),s={bufferView:this.addBufferView(t),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}addBufferView(t){const e=t.byteLength;Te(Number.isFinite(e)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);const r={buffer:0,byteOffset:this.byteLength,byteLength:e};return this.byteLength+=Oe(e,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(r),this.json.bufferViews.length-1}addAccessor(t,e){const r={bufferView:t,type:Me(e.size),componentType:e.componentType,count:e.count,max:e.max,min:e.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t,e={size:3}){const r=this.addBufferView(t);let n={min:e.min,max:e.max};n.min&&n.max||(n=this._getAccessorMinMax(t,e.size));const s={size:e.size,componentType:Le(t),count:Math.round(t.length/e.size),min:n.min,max:n.max};return this.addAccessor(r,Object.assign(s,e))}addTexture(t){const{imageIndex:e}=t,r={source:e};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,e;this.gltf.buffers=[];const r=this.byteLength,n=new ArrayBuffer(r),s=new Uint8Array(n);let i=0;for(const t of this.sourceBuffers||[])i=_e(t,s,i);null!==(t=this.json)&&void 0!==t&&null!==(e=t.buffers)&&void 0!==e&&e[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(t,e){let r=!0;for(;r;){const n=t.indexOf(e);n>-1?t.splice(n,1):r=!1}}_addAttributes(t={}){const e={};for(const r in t){const n=t[r],s=this._getGltfAttributeName(r),i=this.addBinaryBuffer(n.value,n);e[s]=i}return e}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,e){const r={min:null,max:null};if(t.length<e)return r;r.min=[],r.max=[];const n=t.subarray(0,e);for(const t of n)r.min.push(t),r.max.push(t);for(let n=e;n<t.length;n+=e)for(let s=0;s<e;s++)r.min[0+s]=Math.min(r.min[0+s],t[n+s]),r.max[0+s]=Math.max(r.max[0+s],t[n+s]);return r}}function Be(t){const{buffer:e,size:r,count:n}=function(t){let e=t,r=1,n=0;t&&t.value&&(e=t.value,r=t.size||1);e&&(ArrayBuffer.isView(e)||(e=function(t,e,r=!1){if(!t)return null;if(Array.isArray(t))return new e(t);if(r&&!(t instanceof e))return new e(t);return t}(e,Float32Array)),n=e.length/r);return{buffer:e,size:r,count:n}}(t);return{value:e,size:r,byteOffset:0,count:n,type:Me(r),componentType:Le(e)}}async function De(t,e,r){var n;if(null==e||null===(n=e.gltf)||void 0===n||!n.decompressMeshes)return;const s=new Pe(t),i=[];for(const t of function*(t){for(const e of t.json.meshes||[])for(const t of e.primitives)yield t}(s))s.getObjectExtension(t,"KHR_draco_mesh_compression")&&i.push(ke(s,t,e,r));await Promise.all(i),s.removeExtension("KHR_draco_mesh_compression")}function Ce(t,e={}){const r=new Pe(t);for(const t of r.json.meshes||[])Fe(t,e),r.addRequiredExtension("KHR_draco_mesh_compression")}async function ke(t,e,r,n){const s=t.getObjectExtension(e,"KHR_draco_mesh_compression");if(!s)return;const i=t.getTypedArrayForBufferView(s.bufferView),o=be(i.buffer,i.byteOffset),{parse:a}=n,c={...r};delete c["3d-tiles"];const u=await a(o,ht,c,n),h=function(t){const e={};for(const r in t){const n=t[r];if("indices"!==r){const t=Be(n);e[r]=t}}return e}(u.attributes);for(const[r,n]of Object.entries(h))if(r in e.attributes){const s=e.attributes[r],i=t.getAccessor(s);null!=i&&i.min&&null!=i&&i.max&&(n.min=i.min,n.max=i.max)}e.attributes=h,u.indices&&(e.indices=Be(u.indices)),function(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(e)}function Fe(t,e,r=4,n,s){var i;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=n.DracoWriter.encodeSync({attributes:t}),a=null==s||null===(i=s.parseSync)||void 0===i?void 0:i.call(s,{attributes:t}),c=n._addFauxAttributes(a.attributes);return{primitives:[{attributes:c,mode:r,extensions:{KHR_draco_mesh_compression:{bufferView:n.addBufferView(o),attributes:c}}}]}}async function ze(t){const e=new Pe(t),{json:r}=e;e.removeExtension("KHR_materials_unlit");for(const t of r.materials||[]){t.extensions&&t.extensions.KHR_materials_unlit&&(t.unlit=!0),e.removeObjectExtension(t,"KHR_materials_unlit")}}function Ve(t){const e=new Pe(t),{json:r}=e;if(e.materials)for(const t of r.materials||[])t.unlit&&(delete t.unlit,e.addObjectExtension(t,"KHR_materials_unlit",{}),e.addExtension("KHR_materials_unlit"))}async function Ge(t){const e=new Pe(t),{json:r}=e,n=e.getExtension("KHR_lights_punctual");n&&(e.json.lights=n.lights,e.removeExtension("KHR_lights_punctual"));for(const t of r.nodes||[]){const r=e.getObjectExtension(t,"KHR_lights_punctual");r&&(t.light=r.light),e.removeObjectExtension(t,"KHR_lights_punctual")}}async function qe(t){const e=new Pe(t),{json:r}=e;if(r.lights){const t=e.addExtension("KHR_lights_punctual");Te(!t.lights),t.lights=r.lights,delete r.lights}if(e.json.lights){for(const t of e.json.lights){const r=t.node;e.addObjectExtension(r,"KHR_lights_punctual",t)}delete e.json.lights}}async function He(t){const e=new Pe(t),{json:r}=e,n=e.getExtension("KHR_techniques_webgl");if(n){const t=function(t,e){const{programs:r=[],shaders:n=[],techniques:s=[]}=t,i=new TextDecoder;return n.forEach(t=>{if(!Number.isFinite(t.bufferView))throw new Error("KHR_techniques_webgl: no shader code");t.code=i.decode(e.getTypedArrayForBufferView(t.bufferView))}),r.forEach(t=>{t.fragmentShader=n[t.fragmentShader],t.vertexShader=n[t.vertexShader]}),s.forEach(t=>{t.program=r[t.program]}),s}(n,e);for(const n of r.materials||[]){const r=e.getObjectExtension(n,"KHR_techniques_webgl");r&&(n.technique=Object.assign({},r,t[r.technique]),n.technique.values=$e(n.technique,e)),e.removeObjectExtension(n,"KHR_techniques_webgl")}e.removeExtension("KHR_techniques_webgl")}}async function We(t,e){}function $e(t,e){const r=Object.assign({},t.values);return Object.keys(t.uniforms||{}).forEach(e=>{t.uniforms[e].value&&!(e in r)&&(r[e]=t.uniforms[e].value)}),Object.keys(r).forEach(t=>{"object"==typeof r[t]&&void 0!==r[t].index&&(r[t].texture=e.getTexture(r[t].index))}),r}const Ke={KHR_draco_mesh_compression:s,KHR_materials_unlit:i,KHR_lights_punctual:o,KHR_techniques_webgl:a};const Qe={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Ye={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class Ze{constructor(t){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}}normalize(t,e){this.json=t.json;const r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version "+r.asset.version)}if(!e.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),function(t){const e=new Pe(t),{json:r}=e;for(const t of r.images||[]){const r=e.removeObjectExtension(t,"KHR_binary_glTF");r&&Object.assign(t,r)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,e.removeExtension("KHR_binary_glTF")}(t),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(const e in Qe)this._convertTopLevelObjectToArray(t,e)}_convertTopLevelObjectToArray(t,e){const r=t[e];if(r&&!Array.isArray(r)){t[e]=[];for(const n in r){const s=r[n];s.id=s.id||n;const i=t[e].length;t[e].push(s),this.idToIndexMap[e][n]=i}}}_convertObjectIdsToArrayIndices(t){for(const e in Qe)this._convertIdsToIndices(t,e);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(const e of t.textures)this._convertTextureIds(e);for(const e of t.meshes)this._convertMeshIds(e);for(const e of t.nodes)this._convertNodeIds(e);for(const e of t.scenes)this._convertSceneIds(e)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(const e of t.primitives){const{attributes:t,indices:r,material:n}=e;for(const e in t)t[e]=this._convertIdToIndex(t[e],"accessor");r&&(e.indices=this._convertIdToIndex(r,"accessor")),n&&(e.material=this._convertIdToIndex(n,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(t=>this._convertIdToIndex(t,"node"))),t.meshes&&(t.meshes=t.meshes.map(t=>this._convertIdToIndex(t,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(t=>this._convertIdToIndex(t,"node")))}_convertIdsToIndices(t,e){t[e]||(console.warn("gltf v1: json doesn't contain attribute "+e),t[e]=[]);for(const r of t[e])for(const t in r){const e=r[t],n=this._convertIdToIndex(e,t);r[t]=n}}_convertIdToIndex(t,e){const r=Ye[e];if(r in this.idToIndexMap){const n=this.idToIndexMap[r][t];if(!Number.isFinite(n))throw new Error(`gltf v1: failed to resolve ${e} with id ${t}`);return n}return t}_updateObjects(t){for(const t of this.json.buffers)delete t.type}_updateMaterial(t){for(const e of t.materials){e.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const r=e.values&&e.values.tex,n=t.textures.findIndex(t=>t.id===r);-1!==n&&(e.pbrMetallicRoughness.baseColorTexture={index:n})}}}const Je={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Xe={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},tr={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},er={magFilter:tr.TEXTURE_MAG_FILTER,minFilter:tr.TEXTURE_MIN_FILTER,wrapS:tr.TEXTURE_WRAP_S,wrapT:tr.TEXTURE_WRAP_T},rr={[tr.TEXTURE_MAG_FILTER]:tr.LINEAR,[tr.TEXTURE_MIN_FILTER]:tr.NEAREST_MIPMAP_LINEAR,[tr.TEXTURE_WRAP_S]:tr.REPEAT,[tr.TEXTURE_WRAP_]:tr.REPEAT};class nr{postProcess(t,e={}){const{json:r,buffers:n=[],images:s=[],baseUri:i=""}=t;return Te(r),this.baseUri=i,this.json=r,this.buffers=n,this.images=s,this._resolveTree(this.json,e),this.json}_resolveTree(t,e={}){t.bufferViews&&(t.bufferViews=t.bufferViews.map((t,e)=>this._resolveBufferView(t,e))),t.images&&(t.images=t.images.map((t,e)=>this._resolveImage(t,e))),t.samplers&&(t.samplers=t.samplers.map((t,e)=>this._resolveSampler(t,e))),t.textures&&(t.textures=t.textures.map((t,e)=>this._resolveTexture(t,e))),t.accessors&&(t.accessors=t.accessors.map((t,e)=>this._resolveAccessor(t,e))),t.materials&&(t.materials=t.materials.map((t,e)=>this._resolveMaterial(t,e))),t.meshes&&(t.meshes=t.meshes.map((t,e)=>this._resolveMesh(t,e))),t.nodes&&(t.nodes=t.nodes.map((t,e)=>this._resolveNode(t,e))),t.skins&&(t.skins=t.skins.map((t,e)=>this._resolveSkin(t,e))),t.scenes&&(t.scenes=t.scenes.map((t,e)=>this._resolveScene(t,e))),void 0!==t.scene&&(t.scene=t.scenes[this.json.scene])}getScene(t){return this._get("scenes",t)}getNode(t){return this._get("nodes",t)}getSkin(t){return this._get("skins",t)}getMesh(t){return this._get("meshes",t)}getMaterial(t){return this._get("materials",t)}getAccessor(t){return this._get("accessors",t)}getCamera(t){return null}getTexture(t){return this._get("textures",t)}getSampler(t){return this._get("samplers",t)}getImage(t){return this._get("images",t)}getBufferView(t){return this._get("bufferViews",t)}getBuffer(t){return this._get("buffers",t)}_get(t,e){if("object"==typeof e)return e;const r=this.json[t]&&this.json[t][e];return r||console.warn(`glTF file error: Could not find ${t}[${e}]`),r}_resolveScene(t,e){return t.id=t.id||"scene-"+e,t.nodes=(t.nodes||[]).map(t=>this.getNode(t)),t}_resolveNode(t,e){return t.id=t.id||"node-"+e,t.children&&(t.children=t.children.map(t=>this.getNode(t))),void 0!==t.mesh?t.mesh=this.getMesh(t.mesh):void 0!==t.meshes&&t.meshes.length&&(t.mesh=t.meshes.reduce((t,e)=>{const r=this.getMesh(e);return t.id=r.id,t.primitives=t.primitives.concat(r.primitives),t},{primitives:[]})),void 0!==t.camera&&(t.camera=this.getCamera(t.camera)),void 0!==t.skin&&(t.skin=this.getSkin(t.skin)),t}_resolveSkin(t,e){return t.id=t.id||"skin-"+e,t.inverseBindMatrices=this.getAccessor(t.inverseBindMatrices),t}_resolveMesh(t,e){return t.id=t.id||"mesh-"+e,t.primitives&&(t.primitives=t.primitives.map(t=>{const e=(t={...t}).attributes;t.attributes={};for(const r in e)t.attributes[r]=this.getAccessor(e[r]);return void 0!==t.indices&&(t.indices=this.getAccessor(t.indices)),void 0!==t.material&&(t.material=this.getMaterial(t.material)),t})),t}_resolveMaterial(t,e){if(t.id=t.id||"material-"+e,t.normalTexture&&(t.normalTexture={...t.normalTexture},t.normalTexture.texture=this.getTexture(t.normalTexture.index)),t.occlusionTexture&&(t.occlustionTexture={...t.occlustionTexture},t.occlusionTexture.texture=this.getTexture(t.occlusionTexture.index)),t.emissiveTexture&&(t.emmisiveTexture={...t.emmisiveTexture},t.emissiveTexture.texture=this.getTexture(t.emissiveTexture.index)),t.emissiveFactor||(t.emissiveFactor=t.emmisiveTexture?[1,1,1]:[0,0,0]),t.pbrMetallicRoughness){t.pbrMetallicRoughness={...t.pbrMetallicRoughness};const e=t.pbrMetallicRoughness;e.baseColorTexture&&(e.baseColorTexture={...e.baseColorTexture},e.baseColorTexture.texture=this.getTexture(e.baseColorTexture.index)),e.metallicRoughnessTexture&&(e.metallicRoughnessTexture={...e.metallicRoughnessTexture},e.metallicRoughnessTexture.texture=this.getTexture(e.metallicRoughnessTexture.index))}return t}_resolveAccessor(t,e){var r,n;if(t.id=t.id||"accessor-"+e,void 0!==t.bufferView&&(t.bufferView=this.getBufferView(t.bufferView)),t.bytesPerComponent=(r=t.componentType,Xe[r]),t.components=(n=t.type,Je[n]),t.bytesPerElement=t.bytesPerComponent*t.components,t.bufferView){const e=t.bufferView.buffer,{ArrayType:r,byteLength:n}=je(t,t.bufferView),s=(t.bufferView.byteOffset||0)+(t.byteOffset||0)+e.byteOffset,i=e.arrayBuffer.slice(s,s+n);t.value=new r(i)}return t}_resolveTexture(t,e){return t.id=t.id||"texture-"+e,t.sampler="sampler"in t?this.getSampler(t.sampler):rr,t.source=this.getImage(t.source),t}_resolveSampler(t,e){t.id=t.id||"sampler-"+e,t.parameters={};for(const e in t){const r=this._enumSamplerParameter(e);void 0!==r&&(t.parameters[r]=t[e])}return t}_enumSamplerParameter(t){return er[t]}_resolveImage(t,e){t.id=t.id||"image-"+e,void 0!==t.bufferView&&(t.bufferView=this.getBufferView(t.bufferView));const r=this.images[e];return r&&(t.image=r),t}_resolveBufferView(t,e){t.id=t.id||"bufferView-"+e;const r=t.buffer;t.buffer=this.buffers[r];const n=this.buffers[r].arrayBuffer;let s=this.buffers[r].byteOffset||0;return"byteOffset"in t&&(s+=t.byteOffset),t.data=new Uint8Array(n,s,t.byteLength),t}_resolveCamera(t,e){return t.id=t.id||"camera-"+e,t.perspective,t.orthographic,t}}const sr=1735152710;function ir(t,e=0,r={}){const n=new DataView(t),{magic:s=sr}=r,i=n.getUint32(e,!1);return i===s||i===sr}function or(t,e,r=0,n={}){const s=new DataView(e),i=function(t,e=0){return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}(s,r+0),o=s.getUint32(r+4,!0),a=s.getUint32(r+8,!0);switch(Object.assign(t,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),r+=12,t.version){case 1:return function(t,e,r){T(t.header.byteLength>20);const n=e.getUint32(r+0,!0),s=e.getUint32(r+4,!0);return r+=8,T(0===s),ar(t,e,r,n),r+=n,r+=cr(t,e,r,t.header.byteLength)}(t,s,r);case 2:return function(t,e,r,n){return T(t.header.byteLength>20),function(t,e,r,n){for(;r+8<=t.header.byteLength;){const s=e.getUint32(r+0,!0),i=e.getUint32(r+4,!0);switch(r+=8,i){case 1313821514:ar(t,e,r,s);break;case 5130562:cr(t,e,r,s);break;case 0:n.strict||ar(t,e,r,s);break;case 1:n.strict||cr(t,e,r,s)}r+=Oe(s,4)}}(t,e,r,n),r+t.header.byteLength}(t,s,r,{});default:throw new Error(`Invalid GLB version ${t.version}. Only supports v1 and v2.`)}}function ar(t,e,r,n){const s=new Uint8Array(e.buffer,r,n),i=new TextDecoder("utf8").decode(s);return t.json=JSON.parse(i),Oe(n,4)}function cr(t,e,r,n){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:e.buffer}),Oe(n,4)}async function ur(t,e,r=0,n,s){var i,o,a,c;!function(t,e,r,n){n.uri&&(t.baseUri=n.uri);if(e instanceof ArrayBuffer&&!ir(e,r,n)){const t=new TextDecoder;e=t.decode(e)}if("string"==typeof e)t.json=pe(e);else if(e instanceof ArrayBuffer){const s={};r=or(s,e,r,n.glb),Te("glTF"===s.type,"Invalid GLB magic string "+s.type),t._glb=s,t.json=s.json}else Te(!1,"GLTF: must be ArrayBuffer or string");const s=t.json.buffers||[];if(t.buffers=new Array(s.length).fill(null),t._glb&&t._glb.header.hasBinChunk){const{binChunks:e}=t._glb;t.buffers[0]={arrayBuffer:e[0].arrayBuffer,byteOffset:e[0].byteOffset,byteLength:e[0].byteLength}}const i=t.json.images||[];t.images=new Array(i.length).fill({})}(t,e,r,n),function(t,e={}){(new Ze).normalize(t,e)}(t,{normalize:null==n||null===(i=n.gltf)||void 0===i?void 0:i.normalize});const u=[];if(null!=n&&null!==(o=n.gltf)&&void 0!==o&&o.loadBuffers&&t.json.buffers&&await async function(t,e,r){for(let i=0;i<t.json.buffers.length;++i){const o=t.json.buffers[i];if(o.uri){var n,s;const{fetch:a}=r;Te(a);const c=we(o.uri,e),u=await(null==r||null===(n=r.fetch)||void 0===n?void 0:n.call(r,c)),h=await(null==u||null===(s=u.arrayBuffer)||void 0===s?void 0:s.call(u));t.buffers[i]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete o.uri}}}(t,n,s),null!=n&&null!==(a=n.gltf)&&void 0!==a&&a.loadImages){const e=async function(t,e,r){const n=t.json.images||[],s=[];for(let i=0;i<n.length;++i)s.push(hr(t,n[i],i,e,r));return await Promise.all(s)}(t,n,s);u.push(e)}const h=async function(t,e={},r){for(const s in Ke){var n;const i=(null==e||null===(n=e.gltf)||void 0===n?void 0:n.excludeExtensions)||{};if(!(s in i&&!i[s])){const n=Ke[s];await n.decode(t,e,r)}}}(t,n,s);return u.push(h),await Promise.all(u),null!=n&&null!==(c=n.gltf)&&void 0!==c&&c.postProcess?function(t,e){return(new nr).postProcess(t,e)}(t,n):t}async function hr(t,e,r,n,s){const{fetch:i,parse:o}=s;let a;if(e.uri){const t=we(e.uri,n),r=await i(t);a=await r.arrayBuffer()}if(Number.isFinite(e.bufferView)){const r=Ee(t.json,t.buffers,e.bufferView);a=be(r.buffer,r.byteOffset,r.byteLength)}Te(a,"glTF image has no data");const c=await o(a,me,{},s);t.images[r]=c}const fr={name:"glTF",id:"gltf",module:"gltf",version:"3.1.0-alpha.1",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(t,e={},r){(e={...fr.options,...e}).gltf={...fr.options.gltf,...e.gltf};const{byteOffset:n=0}=e;return await ur({},t,n,e,r)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};const lr=0,dr=1;function yr(t,e,r,n){t.rotateYtoZ=!0;const s=t.byteOffset+t.byteLength-r;if(0===s)throw new Error("glTF byte length must be greater than 0.");return t.gltfUpAxis=n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",t.gltfArrayBuffer=be(e,r,s),t.gltfByteOffset=0,t.gltfByteLength=s,r%4==0||console.warn(t.type+": embedded glb is not aligned to a 4-byte boundary."),t.byteOffset+t.byteLength}async function mr(t,e,r,n){const s=r["3d-tiles"]||{};if(function(t,e,r){switch(e){case lr:const e=new Uint8Array(t.gltfArrayBuffer,t.gltfByteOffset),r=(new TextDecoder).decode(e);t.gltfUrl=r.replace(/[\s\0]+$/,""),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;break;case dr:break;default:throw new Error("b3dm: Illegal glTF format field")}}(t,e),s.loadGLTF){const{parse:e,fetch:s}=n;t.gltfUrl&&(t.gltfArrayBuffer=await s(t.gltfUrl,r),t.gltfByteOffset=0),t.gltfArrayBuffer&&(t.gltf=await e(t.gltfArrayBuffer,fr,r,n),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength)}}async function gr(t,e,r,n,s){var i;r=function(t,e,r,n,s){r=xt(t,e,r),r=Mt(t,e,r),r=Lt(t,e,r),r=yr(t,e,r,n);const i=new pt(t.featureTableJson,t.featureTableBinary);return t.rtcCenter=i.getGlobalProperty("RTC_CENTER",lt.FLOAT,3),r}(t,e,r,n),await mr(t,dr,n,s);const o=null==t||null===(i=t.gltf)||void 0===i?void 0:i.extensions;return o&&o.CESIUM_RTC&&(t.rtcCenter=o.CESIUM_RTC.center),r}var pr=r(43),br=r(44),Tr=r(42),wr=r(6),Er=r(2);Math.max(6378137,6378137,6356752.314245179);const Or=t=>t,_r=new dt.a;function Ar(t,e,r=Or){return Object(Pt.e)(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 Ir(t,e,r=Or){return Object(Pt.e)(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 vr=new dt.a,Sr=new dt.a,Nr=new dt.a;const xr=new dt.a,Mr={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"}},Lr={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},jr={east:new dt.a,north:new dt.a,up:new dt.a,west:new dt.a,south:new dt.a,down:new dt.a},Rr=new dt.a,Ur=new dt.a,Pr=new dt.a;function Br(t,e,r,n,s,i){const o=Mr[e]&&Mr[e][r];let a,c,u;Object(wr.a)(o&&(!n||n===o));const h=xr.copy(s);if(Object(Pt.c)(h.x,0,1e-14)&&Object(Pt.c)(h.y,0,1e-14)){const t=Math.sign(h.z);a=Rr.fromArray(Lr[e]),"east"!==e&&"west"!==e&&a.scale(t),c=Ur.fromArray(Lr[r]),"east"!==r&&"west"!==r&&c.scale(t),u=Pr.fromArray(Lr[n]),"east"!==n&&"west"!==n&&u.scale(t)}else{const{up:s,east:i,north:o}=jr;i.set(-h.y,h.x,0).normalize(),t.geodeticSurfaceNormal(h,s),o.copy(s).cross(i);const{down:f,west:l,south:d}=jr;f.copy(s).scale(-1),l.copy(i).scale(-1),d.copy(o).scale(-1),a=jr[e],c=jr[r],u=jr[n]}return i[0]=a.x,i[1]=a.y,i[2]=a.z,i[3]=0,i[4]=c.x,i[5]=c.y,i[6]=c.z,i[7]=0,i[8]=u.x,i[9]=u.y,i[10]=u.z,i[11]=0,i[12]=h.x,i[13]=h.y,i[14]=h.z,i[15]=1,i}const Dr=new dt.a,Cr=new dt.a,kr=new dt.a,Fr=new dt.a,zr=new dt.a,Vr=new dt.a;let Gr;class qr{static get WGS84(){return Gr=Gr||new qr(6378137,6378137,6356752.314245179),Gr}constructor(t=0,e=0,r=0){Object(wr.a)(t>=0),Object(wr.a)(e>=0),Object(wr.a)(r>=0),this.radii=new dt.a(t,e,r),this.radiiSquared=new dt.a(t*t,e*e,r*r),this.radiiToTheFourth=new dt.a(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new dt.a(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new dt.a(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=Ft.a.EPSILON1,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=Cr,n=kr,[,,s]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const i=Math.sqrt(r.dot(n));return n.scale(1/i),r.scale(s),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){Vr.from(t);const r=this.scaleToGeodeticSurface(Vr,Fr);if(!r)return;const n=this.geodeticSurfaceNormal(r,Cr),s=zr;s.copy(Vr).subtract(r);const i=Math.atan2(n.y,n.x),o=Math.asin(n.z),a=Math.sign(Er.d(s,Vr))*Er.g(s);return Ir([i,o,a],e,Pt.b._cartographicRadians?Or:Pt.f)}eastNorthUpToFixedFrame(t,e=new Tr.a){return Br(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,s=new Tr.a){return Br(this,t,e,r,n,s)}geocentricSurfaceNormal(t,e=[0,0,0]){return Dr.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=function(t,e=_r){return Ar(t,e,Pt.b._cartographicRadians?Or:Pt.g)}(t),n=r[0],s=r[1],i=Math.cos(s);return Dr.set(i*Math.cos(n),i*Math.sin(n),Math.sin(s)).normalize(),Dr.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return Dr.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=new dt.a){const{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:i}=e;vr.from(t);const o=t.x,a=t.y,c=t.z,u=n.x,h=n.y,f=n.z,l=o*o*u*u,d=a*a*h*h,y=c*c*f*f,m=l+d+y,g=Math.sqrt(1/m);if(!Number.isFinite(g))return;const p=Sr;if(p.copy(t).scale(g),m<i)return p.to(r);const b=s.x,T=s.y,w=s.z,E=Nr;E.set(p.x*b*2,p.y*T*2,p.z*w*2);let O,_,A,I,v=(1-g)*t.len()/(.5*E.len()),S=0;do{v-=S,O=1/(1+v*b),_=1/(1+v*T),A=1/(1+v*w);const t=O*O,e=_*_,r=A*A;I=l*t+d*e+y*r-1;S=I/(-2*(l*(t*O)*b+d*(e*_)*T+y*(r*A)*w))}while(Math.abs(I)>Ft.a.EPSILON12);return vr.scale([O,_,A]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){Fr.from(t);const r=Fr.x,n=Fr.y,s=Fr.z,i=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*i.x+n*n*i.y+s*s*i.z);return Fr.multiplyScalar(o).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return Fr.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return Fr.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){Object(wr.a)(Object(Pt.c)(this.radii.x,this.radii.y,Ft.a.EPSILON15)),Object(wr.a)(this.radii.z>0),Fr.from(t);const n=Fr.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return Fr.set(0,0,n).to(r)}}async function Hr(t,e,r,n,s){return r=function(t,e,r,n,s){if(r=xt(t,e,r),1!==t.version)throw new Error(`Instanced 3D Model version ${t.version} is not supported`);r=Mt(t,e,r);const i=new DataView(e);if(t.gltfFormat=i.getUint32(r,!0),r=Lt(t,e,r+=4),r=yr(t,e,r,n),0===t.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new pt(t.featureTableJson,t.featureTableBinary),a=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=a,!Number.isFinite(a))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");t.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),t.rtcCenter=o.getGlobalProperty("RTC_CENTER",lt.FLOAT,3);new Nt(t.batchTableJson,t.batchTableBinary,a);return function(t,e,r,n){const s=[new Array(n),t._batchTable][0],i=new dt.a,o=new dt.a,a=new dt.a,c=new dt.a,u=new pr.a,h=new br.a,f=new dt.a,l={},d=new Tr.a,y=[],m=[],g=new dt.a,p=new dt.a;for(let r=0;r<n;r++){let n;if(e.hasProperty("POSITION"))n=e.getProperty("POSITION",lt.FLOAT,3,r,i);else if(e.hasProperty("POSITION_QUANTIZED")){n=e.getProperty("POSITION_QUANTIZED",lt.UNSIGNED_SHORT,3,r,i);const t=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",lt.FLOAT,3,g);if(!t)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const s=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",lt.FLOAT,3,p);if(!s)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=65535;for(let e=0;e<3;e++)n[e]=n[e]/o*s[e]+t[e]}if(!n)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(n),l.translation=i,t.normalUp=e.getProperty("NORMAL_UP",lt.FLOAT,3,r,y),t.normalRight=e.getProperty("NORMAL_RIGHT",lt.FLOAT,3,r,m);const b=!1;if(t.normalUp){if(!t.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");t.hasCustomOrientation=!0}else{if(t.octNormalUp=e.getProperty("NORMAL_UP_OCT32P",lt.UNSIGNED_SHORT,2,y),t.octNormalRight=e.getProperty("NORMAL_RIGHT_OCT32P",lt.UNSIGNED_SHORT,2,m),t.octNormalUp){if(!t.octNormalRight)throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");throw new Error("i3dm: oct-encoded orientation not implemented")}t.eastNorthUp?(qr.WGS84.eastNorthUpToFixedFrame(i,d),d.getRotationMatrix3(u)):u.identity()}b&&(c.copy(o).cross(a).normalize(),u.setColumn(0,o),u.setColumn(1,a),u.setColumn(2,c)),h.fromMatrix3(u),l.rotation=h,f.set(1,1,1);const T=e.getProperty("SCALE",lt.FLOAT,1,r);Number.isFinite(T)&&f.multiplyByScalar(T);const w=e.getProperty("SCALE_NON_UNIFORM",lt.FLOAT,3,r,y);w&&f.scale(w),l.scale=f;let E=e.getProperty("BATCH_ID",lt.UNSIGNED_SHORT,1,r);void 0===E&&(E=r);const O=(new Tr.a).fromQuaternion(l.rotation);d.identity(),d.translate(l.translation),d.multiplyRight(O),d.scale(l.scale);const _=d.clone();s[r]={modelMatrix:_,batchId:E}}t.instances=s}(t,o,0,a),r}(t,e,r,n),await mr(t,t.gltfFormat,n,s),r}async function Wr(t,e=0,r,n,s={}){switch(s.byteOffset=e,s.type=function(t,e=0){const r=new DataView(t);return`${String.fromCharCode(r.getUint8(e+0))}${String.fromCharCode(r.getUint8(e+1))}${String.fromCharCode(r.getUint8(e+2))}${String.fromCharCode(r.getUint8(e+3))}`}(t,e),s.type){case p.COMPOSITE:return await async function(t,e,r,n,s,i){r=xt(t,e,r);const o=new DataView(e);for(t.tilesLength=o.getUint32(r,!0),r+=4,t.tiles=[];t.tiles.length<t.tilesLength&&t.byteLength-r>12;){const o={};t.tiles.push(o),r=await i(e,r,n,s,o)}return r}(s,t,e,r,n,Wr);case p.BATCHED_3D_MODEL:return await gr(s,t,e,r,n);case p.INSTANCED_3D_MODEL:return await Hr(s,t,e,r,n);case p.POINT_CLOUD:return await Kt(s,t,e,r,n);default:throw new Error("3DTileLoader: unknown type "+s.type)}}function $r(t,e){if(!t)return null;if(t.content){const r=t.content.uri||t.content.url;t.contentUrl=`${e.basePath}/${r}`}return t.id=t.contentUrl,t.lodMetricType=g,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform,t.type=function(t){if(!t.contentUrl)return l;const e=t.contentUrl.split(".").pop();switch(e){case"pnts":return y;case"i3dm":case"b3dm":return d;default:return e}}(t),t.refine=function(t){switch(t){case"REPLACE":case"replace":return f;case"ADD":case"add":return h;default:return t}}(t.refine),t}const Kr={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.1.0-alpha.1",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(t,e,r){const s=e["3d-tiles"]||{};let i;i="auto"===s.isTileset?r.url&&-1!==r.url.indexOf(".json"):s.isTileset;t=i?await async function(t,e,r){var s;const i=JSON.parse((new TextDecoder).decode(t));return i.loader=e.loader||Kr,i.url=r.url,i.basePath=function(t){return n.dirname(t.url)}(i),i.root=function(t){const e=t.basePath,r=$r(t.root,t),n=[];for(n.push(r);n.length>0;){const t=(n.pop()||{}).children||[];for(const r of t)$r(r,{basePath:e}),n.push(r)}return r}(i),i.type=m,i.lodMetricType=g,i.lodMetricValue=(null===(s=i.root)||void 0===s?void 0:s.lodMetricValue)||0,i}(t,e,r):await async function(t,e,r){const n={content:{featureIds:null}};return await Wr(t,0,e,r,n.content),n.content}(t,e,r);return t},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};let Qr="";const Yr={};const Zr=t=>"undefined"!=typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,Jr=t=>"undefined"!=typeof Blob&&t instanceof Blob,Xr=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,tn=/^([-\w.]+\/[-\w.+]+)/;function en(t){const e=tn.exec(t);return e?e[1]:t}function rn(t){const e=Xr.exec(t);return e?e[1]:""}const nn=/\?.*/;function sn(t){return t.replace(nn,"")}async function on(t){if(Zr(t))return t;const e={},r=function(t){return Zr(t)?t.headers["content-length"]||-1:Jr(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:n,type:s}=function(t){if(Zr(t)){const e=sn(t.url||"");return{url:e,type:en(t.headers.get("content-type")||"")||rn(e)}}return Jr(t)?{url:sn(t.name||""),type:t.type||""}:"string"==typeof t?{url:sn(t),type:rn(t)}:{url:"",type:""}}(t);s&&(e["content-type"]=s);const i=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);i&&(e["x-first-bytes"]=i),"string"==typeof t&&(t=(new TextEncoder).encode(t));const o=new Response(t,{headers:e});return Object.defineProperty(o,"url",{value:n}),o}async function an(t,e){if("string"==typeof t){t=function(t){for(const e in Yr)if(t.startsWith(e)){const r=Yr[e];t=t.replace(e,r)}return t.startsWith("http://")||t.startsWith("https://")||(t=`${Qr}${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 on(t)}async function cn(t,e){if(!e){const r=await async function(t){T(t);const e={Authorization:"Bearer "+t},r=await an("https://api.cesium.com/v1/assets",{fetch:{headers:e}});if(!r.ok)throw new Error(r.statusText);return await r.json()}(t);for(const t of r.items)"3DTILES"===t.type&&(e=t.id)}const r=await async function(t,e){T(t,e);const r={Authorization:"Bearer "+t},n="https://api.cesium.com/v1/assets/"+e;let s=await an(""+n,{fetch:{headers:r}});if(!s.ok)throw new Error(s.statusText);let i=await s.json();if(s=await an(n+"/endpoint",{fetch:{headers:r}}),!s.ok)throw new Error(s.statusText);const o=await s.json();return i={...i,...o},i}(t,e),{type:n,url:s}=r;return T("3DTILES"===n&&s),r.headers={Authorization:"Bearer "+r.accessToken},r}const un={...Kr,id:"cesium-ion",name:"Cesium Ion",preload:async function(t,e={}){e=e["cesium-ion"]||{};const{accessToken:r}=e;let n=e.assetId;if(!Number.isFinite(n)){const e=t.match(/\/([0-9]+)\/tileset.json/);n=e&&e[1]}return cn(r,n)},parse:async(t,e,r)=>((e={...e})["3d-tiles"]=e["cesium-ion"],e.loader=un,Kr.parse(t,e,r)),options:{"cesium-ion":{...Kr.options["3d-tiles"],accessToken:null}}};function hn(t,e,r){if(!e)return r+12;const{magic:n,version:s=1,byteLength:i=12}=t;return T(Array.isArray(n)&&Number.isFinite(s)&&Number.isFinite(i)),e.setUint8(r+0,n[0]),e.setUint8(r+1,n[1]),e.setUint8(r+2,n[2]),e.setUint8(r+3,n[3]),e.setUint32(r+4,s,!0),e.setUint32(r+8,i,!0),r+=12}function fn(t,e,r){t&&t.setUint32(e+8,r,!0)}function ln(t,e,r,n){return e=function(t,e,r,n){const s=Oe(r.byteLength,n),i=s-r.byteLength;if(t){const n=new Uint8Array(t.buffer,t.byteOffset+e,r.byteLength),s=new Uint8Array(r);n.set(s);for(let n=0;n<i;++n)t.setUint8(e+r.byteLength+n,32)}return e+=s}(t,e,(new TextEncoder).encode(r),n)}function dn(t,e,r,n){if(t)for(let s=0;s<n;s++)t.setUint8(e+s,r.charCodeAt(s));return e+n}function yn(t,e,r,n){if(t)for(let s=0;s<n;s++)t.setUint8(e+s,r[s]);return e+n}const mn={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function gn(t,e,r,n){const{featureTableJson:s=mn}=t;let i=JSON.stringify(s);i=function(t,e){const r=t.length,n=Math.ceil(r/e)*e-r;let s="";for(let t=0;t<n;++t)s+=" ";return t+s}(i,4);const{featureTableJsonByteLength:o=i.length}=t,a=new ArrayBuffer(12),c=a.byteLength,u=r;return r+=hn(t={magic:b.POINT_CLOUD,...t},e,0),e&&(e.setUint32(r+0,o,!0),e.setUint32(r+4,c,!0),e.setUint32(r+8,0,!0),e.setUint32(r+12,0,!0)),r+=16,r+=dn(e,r,i,o),fn(e,u,(r+=yn(e,r,a,c))-u),r}function pn(t,e,r,n){switch(T("string"==typeof t.type),t.type){case p.COMPOSITE:return function(t,e,r,n,s){const i=r;r+=hn(t={magic:b.COMPOSITE,tiles:[],...t},e,r),e&&e.setUint32(r,t.tiles.length,!0),r+=4;for(let i=0;i<t.tiles.length;++i)r+=s(t.tiles[i],e,r,n);return fn(e,i,r-i),r}(t,e,r,n,pn);case p.POINT_CLOUD:return gn(t,e,r);case p.BATCHED_3D_MODEL:return function(t,e,r,n){const{featuresLength:s=0,batchTable:i}=t,o={BATCH_LENGTH:s},a=JSON.stringify(o),c=i?JSON.stringify(i):"",u=Oe(a.length,8),h=c?Oe(c.length,8):0,f=r;r=hn(t={magic:b.BATCHED_MODEL,...t},e,r),e&&(e.setUint32(12,u,!0),e.setUint32(16,0,!0),e.setUint32(20,h,!0),e.setUint32(24,0,!0)),r=ln(e,r+=16,a,8),i&&(r=ln(e,r,c,8));const l=t.gltfEncoded;return l&&(r=yn(e,r,l,l.byteLength)),fn(e,f,r-f),r}(t,e,r);case p.INSTANCED_3D_MODEL:return function(t,e,r,n){const{featuresLength:s=1,gltfFormat:i=1,gltfUri:o=""}=t,a=o.length,c={INSTANCES_LENGTH:s,POSITION:new Array(3*s).fill(0)},u=JSON.stringify(c),h=u.length,f=r;return r=hn(t={magic:b.INSTANCED_MODEL,...t},e,0),e&&(e.setUint32(12,h,!0),e.setUint32(16,0,!0),e.setUint32(20,0,!0),e.setUint32(24,0,!0),e.setUint32(28,i,!0)),r+=20,r+=dn(e,r,u,h),fn(e,f,(r+=dn(e,r,o,a))-f),r}(t,e,r);default:throw new Error("3D Tiles: unknown tile type")}}const bn={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:"3.1.0-alpha.1",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],encodeSync:function(t,e){return function(t,e){const r=pn(t,null,0,e),n=new ArrayBuffer(r);return pn(t,new DataView(n),0,e),n}(t,e)},binary:!0,options:{"3d-tiles":{}}}},,,,,function(t,e,r){"use strict";r.d(e,"a",(function(){return h}));var n=r(18),s=r(3),i=r(1),o=r(2),a=r(8);const c=[0,0,0],u={};class h extends n.a{static get ZERO(){return u.ZERO=u.ZERO||Object.freeze(new h(0,0,0,0))}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&Object(s.e)(t)?this.copy(t):(s.b.debug&&(Object(i.a)(t),Object(i.a)(e),Object(i.a)(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 s.b.debug&&(Object(i.a)(t.x),Object(i.a)(t.y),Object(i.a)(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]=Object(i.a)(t)}angle(t){return o.a(this,t)}cross(t){return o.c(this,this,t),this.check()}rotateX({radians:t,origin:e=c}){return o.i(this,this,e,t),this.check()}rotateY({radians:t,origin:e=c}){return o.j(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=c}){return o.k(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return o.m(this,this,t),this.check()}transformAsVector(t){return Object(a.c)(this,this,t),this.check()}transformByMatrix3(t){return o.l(this,this,t),this.check()}transformByMatrix2(t){return Object(a.b)(this,this,t),this.check()}transformByQuaternion(t){return o.n(this,this,t),this.check()}}},function(t,e,r){"use strict";e.a={EPSILON1:.1,EPSILON2:.01,EPSILON3:.001,EPSILON4:1e-4,EPSILON5:1e-5,EPSILON6:1e-6,EPSILON7:1e-7,EPSILON8:1e-8,EPSILON9:1e-9,EPSILON10:1e-10,EPSILON11:1e-11,EPSILON12:1e-12,EPSILON13:1e-13,EPSILON14:1e-14,EPSILON15:1e-15,EPSILON16:1e-16,EPSILON17:1e-17,EPSILON18:1e-18,EPSILON19:1e-19,EPSILON20:1e-20,PI_OVER_TWO:Math.PI/2,PI_OVER_FOUR:Math.PI/4,PI_OVER_SIX:Math.PI/6,TWO_PI:2*Math.PI}},function(t,e,r){"use strict";r.d(e,"a",(function(){return y}));var n=r(1),s=r(19),i=r(8),o=r(5),a=r(9),c=r(2),u=r(4);const h=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),f=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),l=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}),d={};class y extends s.a{static get IDENTITY(){return d.IDENTITY=d.IDENTITY||Object.freeze(new y(h)),d.IDENTITY}static get ZERO(){return d.ZERO=d.ZERO||Object.freeze(new y(f)),d.ZERO}get INDICES(){return l}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,n,s,i,o,a,c,u,h,f,l,d,y,m){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=s,this[5]=i,this[6]=o,this[7]=a,this[8]=c,this[9]=u,this[10]=h,this[11]=f,this[12]=l,this[13]=d,this[14]=y,this[15]=m,this.check()}setRowMajor(t,e,r,n,s,i,o,a,c,u,h,f,l,d,y,m){return this[0]=t,this[1]=s,this[2]=c,this[3]=l,this[4]=e,this[5]=i,this[6]=u,this[7]=d,this[8]=r,this[9]=o,this[10]=h,this[11]=y,this[12]=n,this[13]=a,this[14]=f,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(h)}fromQuaternion(t){return o.b(this,t),this.check()}frustum({left:t,right:e,bottom:r,top:n,near:s,far:i}){return i===1/0?y._computeInfinitePerspectiveOffCenter(this,t,e,r,n,s):o.c(this,t,e,r,n,s,i),this.check()}static _computeInfinitePerspectiveOffCenter(t,e,r,n,s,i){const o=2*i/(r-e),a=2*i/(s-n),c=(r+e)/(r-e),u=(s+n)/(s-n),h=-2*i;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]=c,t[9]=u,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=h,t[15]=0,t}lookAt(t,e,r){return 1===arguments.length&&({eye:t,center:e,up:r}=t),e=e||[0,0,0],r=r||[0,1,0],o.e(this,t,e,r),this.check()}ortho({left:t,right:e,bottom:r,top:n,near:s=.1,far:i=500}){return o.g(this,t,e,r,n,s,i),this.check()}orthographic({fovy:t=45*Math.PI/180,aspect:e=1,focalDistance:r=1,near:n=.1,far:s=500}){if(t>2*Math.PI)throw Error("radians");const i=t/2,o=r*Math.tan(i),a=o*e;return(new y).ortho({left:-a,right:a,bottom:-o,top:o,near:n,far:s})}perspective({fovy:t,fov:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:s=500}={}){if((t=t||e)>2*Math.PI)throw Error("radians");return o.h(this,t,r,n,s),this.check()}determinant(){return o.a(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t=[-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]),n=1/r[0],s=1/r[1],i=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*s,t[2]=this[2]*i,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*s,t[6]=this[6]*i,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*s,t[10]=this[10]*i,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]),n=1/r[0],s=1/r[1],i=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*s,t[2]=this[2]*i,t[3]=this[4]*n,t[4]=this[5]*s,t[5]=this[6]*i,t[6]=this[8]*n,t[7]=this[9]*s,t[8]=this[10]*i,t}transpose(){return o.o(this,this),this.check()}invert(){return o.d(this,this),this.check()}multiplyLeft(t){return o.f(this,t,this),this.check()}multiplyRight(t){return o.f(this,this,t),this.check()}rotateX(t){return o.j(this,this,t),this.check()}rotateY(t){return o.k(this,this,t),this.check()}rotateZ(t){return o.l(this,this,t),this.check()}rotateXYZ([t,e,r]){return this.rotateX(t).rotateY(e).rotateZ(r)}rotateAxis(t,e){return o.i(this,this,t,e),this.check()}scale(t){return Array.isArray(t)?o.m(this,this,t):o.m(this,this,[t,t,t]),this.check()}translate(t){return o.n(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=u.n(e||[-0,-0,-0,-0],t,this),Object(n.b)(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:r}=t;switch(r){case 2:e=a.d(e||[-0,-0],t,this);break;case 3:e=c.m(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Object(n.b)(e,t.length),e}transformAsVector(t,e){switch(t.length){case 2:e=Object(i.a)(e||[-0,-0],t,this);break;case 3:e=Object(i.c)(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Object(n.b)(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 Object(n.c)("Matrix4.transformPoint","3.0"),this.transformAsPoint(t,e)}transformVector(t,e){return Object(n.c)("Matrix4.transformVector","3.0"),this.transformAsPoint(t,e)}transformDirection(t,e){return Object(n.c)("Matrix4.transformDirection","3.0"),this.transformAsVector(t,e)}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return d}));var n=r(19),s=r(1),i=r(8),o=r(7),a=r(9),c=r(2);const u=Object.freeze([1,0,0,0,1,0,0,0,1]),h=Object.freeze([0,0,0,0,0,0,0,0,0]),f=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),l={};class d extends n.a{static get IDENTITY(){return l.IDENTITY=l.IDENTITY||Object.freeze(new d(u)),l.IDENTITY}static get ZERO(){return l.ZERO=l.ZERO||Object.freeze(new d(h)),l.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return f}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,n,s,i,o,a,c){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=s,this[5]=i,this[6]=o,this[7]=a,this[8]=c,this.check()}setRowMajor(t,e,r,n,s,i,o,a,c){return this[0]=t,this[1]=n,this[2]=o,this[3]=e,this[4]=s,this[5]=a,this[6]=r,this[7]=i,this[8]=c,this.check()}determinant(){return o.b(this)}identity(){return this.copy(u)}fromQuaternion(t){return o.c(this,t),this.check()}transpose(){return o.i(this,this),this.check()}invert(){return o.d(this,this),this.check()}multiplyLeft(t){return o.e(this,t,this),this.check()}multiplyRight(t){return o.e(this,this,t),this.check()}rotate(t){return o.f(this,this,t),this.check()}scale(t){return Array.isArray(t)?o.g(this,this,t):o.g(this,this,[t,t,t]),this.check()}translate(t){return o.h(this,this,t),this.check()}transform(t,e){switch(t.length){case 2:e=a.c(e||[-0,-0],t,this);break;case 3:e=c.l(e||[-0,-0,-0],t,this);break;case 4:e=Object(i.d)(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Object(s.b)(e,t.length),e}transformVector(t,e){return Object(s.c)("Matrix3.transformVector"),this.transform(t,e)}transformVector2(t,e){return Object(s.c)("Matrix3.transformVector"),this.transform(t,e)}transformVector3(t,e){return Object(s.c)("Matrix3.transformVector"),this.transform(t,e)}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return M}));var n=r(14),s=r(1),i=r(6),o=r(0),a=r(7),c=r(2),u=r(4);function h(){var t=new o.a(4);return o.a!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function f(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function l(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3],a=r[0],c=r[1],u=r[2],h=r[3];return t[0]=n*h+o*a+s*u-i*c,t[1]=s*h+o*c+i*a-n*u,t[2]=i*h+o*u+n*c-s*a,t[3]=o*h-n*a-s*c-i*u,t}function d(t,e,r,n){var s,i,a,c,u,h=e[0],f=e[1],l=e[2],d=e[3],y=r[0],m=r[1],g=r[2],p=r[3];return(i=h*y+f*m+l*g+d*p)<0&&(i=-i,y=-y,m=-m,g=-g,p=-p),1-i>o.b?(s=Math.acos(i),a=Math.sin(s),c=Math.sin((1-n)*s)/a,u=Math.sin(n*s)/a):(c=1-n,u=n),t[0]=c*h+u*y,t[1]=c*f+u*m,t[2]=c*l+u*g,t[3]=c*d+u*p,t}function y(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var s=0;e[4]>e[0]&&(s=1),e[8]>e[3*s+s]&&(s=2);var i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(e[3*s+s]-e[3*i+i]-e[3*o+o]+1),t[s]=.5*r,r=.5/r,t[3]=(e[3*i+o]-e[3*o+i])*r,t[i]=(e[3*i+s]+e[3*s+i])*r,t[o]=(e[3*o+s]+e[3*s+o])*r}return t}u.b,u.g,u.c,u.l;var m,g,p,b,T,w,E=u.a,O=u.k,_=u.d,A=u.i,I=u.h,v=u.m,S=u.j,N=(u.f,u.e,m=c.b(),g=c.e(1,0,0),p=c.e(0,1,0),function(t,e,r){var n=c.d(e,r);return n<-.999999?(c.c(m,g,e),c.f(m)<1e-6&&c.c(m,p,e),c.h(m,m),f(t,m,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(c.c(m,e,r),t[0]=m[0],t[1]=m[1],t[2]=m[2],t[3]=1+n,S(t,t))});b=h(),T=h(),w=a.a();const x=[0,0,0,1];class M extends n.a{constructor(t=0,e=0,r=0,n=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,r,n)}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,n){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this.check()}fromMatrix3(t){return y(this,t),this.check()}identity(){var t;return(t=this)[0]=0,t[1]=0,t[2]=0,t[3]=1,this.check()}fromAxisRotation(t,e){return f(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]=Object(s.a)(t)}get y(){return this[1]}set y(t){this[1]=Object(s.a)(t)}get z(){return this[2]}set z(t){this[2]=Object(s.a)(t)}get w(){return this[3]}set w(t){this[3]=Object(s.a)(t)}len(){return I(this)}lengthSquared(){return v(this)}dot(t,e){if(void 0!==e)throw new Error("Quaternion.dot only takes one argument");return _(this,t)}rotationTo(t,e){return N(this,t,e),this.check()}add(t,e){if(void 0!==e)throw new Error("Quaternion.add only takes one argument");return E(this,this,t),this.check()}calculateW(){var t,e,r,n,s;return t=this,r=(e=this)[0],n=e[1],s=e[2],t[0]=r,t[1]=n,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),this.check()}conjugate(){var t,e;return e=this,(t=this)[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],this.check()}invert(){var t,e,r,n,s,i,o,a;return t=this,r=(e=this)[0],n=e[1],s=e[2],i=e[3],a=(o=r*r+n*n+s*s+i*i)?1/o:0,t[0]=-r*a,t[1]=-n*a,t[2]=-s*a,t[3]=i*a,this.check()}lerp(t,e,r){return A(this,t,e,r),this.check()}multiplyRight(t,e){return Object(i.a)(!e),l(this,this,t),this.check()}multiplyLeft(t,e){return Object(i.a)(!e),l(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 n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+o*a,t[1]=s*c+i*a,t[2]=i*c-s*a,t[3]=o*c-n*a}(this,this,t),this.check()}rotateY(t){return function(t,e,r){r*=.5;var n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c-i*a,t[1]=s*c+o*a,t[2]=i*c+n*a,t[3]=o*c-s*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){r*=.5;var n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+s*a,t[1]=s*c-n*a,t[2]=i*c+o*a,t[3]=o*c-i*a}(this,this,t),this.check()}scale(t){return O(this,this,t),this.check()}slerp(t,e,r){switch(arguments.length){case 1:({start:t=x,target:e,ratio:r}=arguments[0]);break;case 2:[e,r]=arguments,t=this}return d(this,t,e,r),this.check()}transformVector4(t,e=t){return u.o(e,t,this),Object(s.b)(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)}}}])}));
|
|
2
|
-
//# sourceMappingURL=dist.min.js.map
|