@realsee/five 6.8.0-alpha.20 → 6.8.0-alpha.21
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/ai_guides/features/material.md +1 -1
- package/ai_guides/release_notes/6.8.md +1 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/five.Five.html +41 -41
- package/docs/classes/five.PBMContainer.html +1 -1
- package/docs/classes/five.PBMGSObject.html +5 -3
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PBMPointCloud.html +1 -1
- package/docs/classes/five.PBMSkinnedMesh.html +1 -1
- package/docs/classes/five.Parameter.html +5 -5
- package/docs/documents/features_material.html +1 -1
- package/docs/documents/release_notes_6.8.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/five.EventCallback.html +1 -1
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ParameterMaterialValue.html +6 -6
- package/docs/interfaces/five.ParameterValue.html +6 -6
- package/docs/interfaces/five.ResolvedParameterValue.html +6 -6
- package/docs/interfaces/five.SplatData.html +2 -2
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/five/application/five.d.ts +1 -6
- package/five/gaussian-splatting/util/renderData.d.ts +52 -0
- package/five/index.js +9 -9
- package/five/index.mjs +443 -230
- package/five/model/index.d.ts +1 -1
- package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz.d.ts +2 -2
- package/five/model/loaders/spz.d.ts +2 -2
- package/five/model/objects/{pbmGSObject.d.ts → pbmGaussianSplattingObject.d.ts} +4 -1
- package/five/model/objects/pbmGaussianSplattingRenderMesh.d.ts +55 -0
- package/five/model/objects/pbmGaussianSplattingTestMesh.d.ts +7 -0
- package/five/model/parameter.d.ts +1 -1
- package/five/model/tile3d/tile-node.d.ts +2 -2
- package/five/utils/memoryUsage.d.ts +2 -2
- package/gltf-loader/index.js +2 -2
- package/gltf-loader/index.mjs +2 -2
- package/line/index.js +2 -2
- package/line/index.mjs +2 -2
- package/package.json +1 -1
- package/plugins/index.js +1 -1
- package/plugins/index.mjs +1 -1
- package/react/index.js +1 -1
- package/react/index.mjs +1 -1
- package/shader-lib/index.js +1 -1
- package/shader-lib/index.mjs +1 -1
- package/sticker/index.js +2 -2
- package/sticker/index.mjs +2 -2
- package/umd/five-gltf-loader.js +2 -2
- package/umd/five-line.js +2 -2
- package/umd/five-plugins.js +1 -1
- package/umd/five-react.js +1 -1
- package/umd/five-shader-lib.js +1 -1
- package/umd/five-sticker.js +2 -2
- package/umd/five-vfx.js +1 -1
- package/umd/five-vue.js +1 -1
- package/umd/five.js +10 -10
- package/vfx/index.js +1 -1
- package/vfx/index.mjs +1 -1
- package/vue/index.js +1 -1
- package/vue/index.mjs +1 -1
- package/work-downloader/index.js +1 -1
- package/work-downloader/index.mjs +1 -1
- package/five/gs/util/renderData.d.ts +0 -32
- package/five/model/objects/pbmGSRenderMesh.d.ts +0 -32
- /package/five/{gs → gaussian-splatting}/wasm/data.d.ts +0 -0
- /package/five/{gs → gaussian-splatting}/wasm/sort.d.ts +0 -0
- /package/five/{gs → gaussian-splatting}/worker/dataWorker.d.ts +0 -0
- /package/five/{gs → gaussian-splatting}/worker/sortWorker.d.ts +0 -0
package/five/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
4
|
* Generated: 3/19/2026
|
|
5
|
-
* Version: 6.8.0-alpha.
|
|
5
|
+
* Version: 6.8.0-alpha.21
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
`)),e.fragmentShader=e.fragmentShader.replace(/MAIN_END/g,a.map(e=>e.fragment.mainEnd).filter(e=>!!e).join(`
|
|
316
316
|
`)),e.fragmentShader=e.fragmentShader.replace(/MAIN_MODEL_COLOR/g,a.map(e=>e.fragment.mainModelColor).filter(e=>!!e).join(`
|
|
317
317
|
`)),e.fragmentShader=e.fragmentShader.replace(/MAIN_PANO_COLOR/g,a.map(e=>e.fragment.mainPanoColor).filter(e=>!!e).join(`
|
|
318
|
-
`));let o=String(this.clippers.length);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,o),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,o);for(let t of a)t.onBeforeCompile&&t.onBeforeCompile(e,r)};let r=``;this.onBeforeRender=(e,i,a,o,s,l)=>{let u=this.shaderType;a instanceof en?(n.pixelRatio.value=a.pixelRatio,n.resolution.value.copy(a.resolution)):(n.pixelRatio.value=e.getPixelRatio(),e.getViewport(Cn),n.resolution.value.set(Cn.width,Cn.height));let d=this.transparent===!1&&this.blending===c.NormalBlending;t.USE_OPAQUE!==d&&(t.USE_OPAQUE=d,this.needsUpdate=!0);let f=this.customShaders.filter(e=>e.type.includes(u)).map(e=>`${e.id}:${e.version}`).join(`|`);r!==f&&(r=f,this.needsUpdate=!0)},Object.defineProperty(this,`uniform`,{configurable:!1,enumerable:!1,writable:!1,value:n}),H(this,`isPBMPointCloudMaterial`,{configurable:!1,writable:!1,value:!0}),H(this,`isShaderMaterial`,{configurable:!1,writable:!1,value:!0}),H(this,`opacity`,{get(){return n.opacity.value},set(e){n.opacity.value=e}}),H(this,`vertexMarks`,{get(){return!!t.USE_VERTEX_MARK},set(e){t.USE_VERTEX_MARK!==e&&(t.USE_VERTEX_MARK=e,this.needsUpdate=!0)}}),H(this,`pointScale`,{get(){return n.pointScale.value},set(e){n.pointScale.value=e}}),H(this,`pointMinPixel`,{get(){return n.pointMinPixel.value},set(e){n.pointMinPixel.value=e}}),H(this,`pointMaxPixel`,{get(){return n.pointMinPixel.value},set(e){n.pointMaxPixel.value=e}}),H(this,`pointSize`,{get(){return this.defines.USE_POINT_SIZE_ATTENUATION===!0?`ATTENUATION`:`FIXED`},set(e){let t=e===`ATTENUATION`;this.defines.USE_POINT_SIZE_ATTENUATION!==t&&(this.defines.USE_POINT_SIZE_ATTENUATION=t,this.needsUpdate=!0)}}),H(this,`pointShape`,{get(){return this.defines.USE_POINT_SHAPE_CIRCLE===!0?`CIRCLE`:`SQUARE`},set(e){let t=e===`CIRCLE`;this.defines.USE_POINT_SHAPE_CIRCLE!==t&&(this.defines.USE_POINT_SHAPE_CIRCLE=t,this.needsUpdate=!0)}}),H(this,`pointBack`,{get(){return this.defines.USE_POINT_BACK_HIDDEN===!0?`HIDDEN`:this.defines.USE_POINT_BACK_DARK===!0?`DARK`:`VISIBLE`},set(e){let t=e===`HIDDEN`,n=e===`DARK`;this.defines.USE_POINT_BACK_HIDDEN!==t&&(this.defines.USE_POINT_BACK_HIDDEN=t,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==n&&(this.defines.USE_POINT_BACK_DARK=n,this.needsUpdate=!0)}}),H(this,`modelAlpha`,{get(){return n.modelAlpha.value},set(e){n.modelAlpha.value=e}}),H(this,`colorStyle`,{get(){return t.USE_COLOR_CONSTANT?`CONSTANT`:t.USE_COLOR_ALTITUDE?`ALTITUDE`:`RGB`},set(e){let n=e===`CONSTANT`,r=e===`ALTITUDE`;t.USE_COLOR_CONSTANT!==n&&(t.USE_COLOR_CONSTANT=n,this.needsUpdate=!0),t.USE_COLOR_ALTITUDE!==r&&(t.USE_COLOR_ALTITUDE=r,this.needsUpdate=!0)}}),H(this,`constantColor`,{get(){return n.constantColor.value},set(e){n.constantColor.value=e}}),H(this,`floorIndex`,{get(){return n.floorIndex.value},set(e){n.floorIndex.value=e}}),H(this,`shownFloorIndex`,{get(){return n.shownFloorIndex.value},set(e){n.shownFloorIndex.value=e}}),H(this,`floorStyle`,{get(){return t.USE_FLOOR_STYLE_VISIBILITY?`VISIBILITY`:`OPACITY`},set(e){let n=e===`VISIBILITY`;t.USE_FLOOR_STYLE_VISIBILITY!==n&&(t.USE_FLOOR_STYLE_VISIBILITY=n,this.needsUpdate=!0)}}),H(this,`gradientTexture`,{get(){return n.gradientTexture.value},set(e){n.gradientTexture.value=e}}),H(this,`brightness`,{get(){return n.brightness.value},set(e){n.brightness.value=e}});let i=[];H(this,`clippers`,{get(){return i},set(e){i!==e&&(i=e,n.clippers.value=i.map(e=>{let t=typeof e.floorIndex==`number`?e.floorIndex:-1;return{matrixInverse:new c.Matrix4().getInverse(e.clippingBoxMatrix),floorIndex:t}}),this.needsUpdate=!0)}}),H(this,`colorSaturation`,{get(){return n.colorSaturation.value},set(e){n.colorSaturation.value=e;let r=n.colorSaturation.value!==0||n.colorBrightness.value!==0||n.outlineGain.value!==0||n.distanceGain.value!==0;t.USE_COLOR_ADJUSTMENT!==r&&(t.USE_COLOR_ADJUSTMENT=r,this.needsUpdate=!0)}}),H(this,`colorBrightness`,{get(){return n.colorBrightness.value},set(e){n.colorBrightness.value=e;let r=n.colorSaturation.value!==0||n.colorBrightness.value!==0||n.outlineGain.value!==0||n.distanceGain.value!==0;t.USE_COLOR_ADJUSTMENT!==r&&(t.USE_COLOR_ADJUSTMENT=r,this.needsUpdate=!0)}}),H(this,`outlineGain`,{get(){return n.outlineGain.value},set(e){n.outlineGain.value=e;let r=n.colorSaturation.value!==0||n.colorBrightness.value!==0||n.outlineGain.value!==0||n.distanceGain.value!==0;t.USE_COLOR_ADJUSTMENT!==r&&(t.USE_COLOR_ADJUSTMENT=r,this.needsUpdate=!0)}}),H(this,`distanceGain`,{get(){return n.distanceGain.value},set(e){n.distanceGain.value=e;let r=n.colorSaturation.value!==0||n.colorBrightness.value!==0||n.outlineGain.value!==0||n.distanceGain.value!==0;t.USE_COLOR_ADJUSTMENT!==r&&(t.USE_COLOR_ADJUSTMENT=r,this.needsUpdate=!0)}}),H(this,`useHQWeight`,{get(){return t.USE_HQ_WEIGHT},set(e){e!==t.USE_HQ_WEIGHT&&(t.USE_HQ_WEIGHT=e,this.needsUpdate=!0)}}),H(this,`useHQDepth`,{get(){return t.USE_HQ_DEPTH},set(e){e!==t.USE_HQ_DEPTH&&(t.USE_HQ_DEPTH=e,this.needsUpdate=!0)}}),H(this,`modelBoundingMin`,{get(){return n.modelBoundingMin.value},set(e){n.modelBoundingMin.value=e}}),H(this,`modelBoundingMax`,{get(){return n.modelBoundingMax.value},set(e){n.modelBoundingMax.value=e}}),typeof e==`object`&&this.setValues(e),Rt(this)}copy(e){return super.copy(e),this.pointScale=e.pointScale,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.customShaders=e.customShaders,this.modelAlpha=e.modelAlpha,this.colorStyle=e.colorStyle,this.constantColor.copy(e.constantColor),this.floorIndex=e.floorIndex,this.shownFloorIndex=e.shownFloorIndex,this.floorStyle=e.floorStyle,this.gradientTexture=e.gradientTexture,this.brightness=e.brightness,this.clippers=e.clippers,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this.outlineGain=e.outlineGain,this.distanceGain=e.distanceGain,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.modelBoundingMin.copy(e.modelBoundingMin),this.modelBoundingMax.copy(e.modelBoundingMax),this}clone(){let e=this.constructor;return new e().copy(this)}refreshUniforms(){}},kn=class extends c.Points{constructor(e,t){super(e,t),this.onBeforeRender=(e,t,n,r,i,a)=>{i instanceof On&&i.onBeforeRender&&i.onBeforeRender(e,t,n,r,this,a)}}},An=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAABCAYAAACouxZ2AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAAQAAAAB7UD0+AAACA0lEQVRIDXWUW3YjIQxEwdnV/GT/q8kO3FO3pAJst3PSAaR6Cbszf//9XeMxxpjXmI+pVXudp2s6PC4dqHff9e6D7/PZLy46xQvG+sZvrfK8xgXUeq85yINe9bdmtOK1+kun5vjgq58a+eZPna9jvmjiserqG/+Whathvo3L3WhV89L9sXI/m18z2uene9ap/ftsuT9WZxoHXzW56/fpj8l7+tTw7P011NdpqnY19sRsfuHMA9u8oZWfDz4+fra/dfG1V60ydZ7qba1g7UNAeK0JP7ydD7/OqH6wO2f7HTq+B/lbL9qsB3/N1/UzR81XfPzw4tp5OPvRneacteq8Xo0xR3vuv/kPz0KtX0Nhg0eHuaNXdWI3X/ld427h++vzyp99V6VPrzWFhbv4ayay4oFecm198MmUXN/mL+x7npq/uJXBGb/MTw4+t+SvbLoTZnUW5uHhz7nWcTxT73OwXV7cxT9wbBf/0LnDBgcnHmtPLYba32Hp808sMy1u88yhr58n70/v4xX92GSN19l/2UsqGmiH94Hpxjcs+DO/ccpIVNVp62PUWXu//ur1GQy1Cf+GZ13rtNYN1po3/NI79fGXibHkq4z25xvV2pW3szpneXsW8SsreTe/NIPrtXMnH7wPf+LEN6tqhUVHj3XKD/72p9eafCeYB3zuonnbv7yqP8d/o4K6gRb1wbYAAAAASUVORK5CYII=`;function jn(e){return Object.keys(e)}function G(e,t){return e==t}function Mn(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}function Nn(e,t){return e instanceof c.Vector3&&t instanceof c.Vector3?e.equals(t):e===t}function Pn(e,t){return e instanceof c.Box3&&t instanceof c.Box3?e.equals(t):e===t}var Fn={customShaders:Mn,castShadow:G,receiveShadow:G,vertexMarks:G,pano0:G,pano1:G,pano0Depth:G,pano1Depth:G,panoFilter:G,refinedScreen:G,modelAlpha:G,progress:G,transition:G,opacity:G,floorStyle:G,colorStyle:G,constantColor:Nn,shownFloorIndex:G,clippers:Mn,brightness:G,useHQWeight:G,useHQDepth:G,pointShape:G,pointSize:G,pointBack:G,pointScale:G,pointMinPixel:G,pointMaxPixel:G,pointAppearAnimation:G,colorSaturation:G,colorBrightness:G,useAddBlend:G,outlineGain:G,distanceGain:G,gradientTexture:G,boundingBox:Pn,gsSHDegree:G,minLevelOfDetail:G,maxLevelOfDetail:G,minGeometricError:G,maxGeometricError:G,panoramaMinGeometricError:G,skipLevelOfDetail:G,mostDetail:G,loadSiblings:G,cameraCulling:G,maxMemoryUsage:G,maxRequests:G,requestOrder:G,maxScreenSpaceError:G,memoryAdjustedScreenSpaceError:G,cacheCameras:Mn},In=(()=>{let e;return e=typeof document<`u`?new c.TextureLoader().load(An):new c.Texture,e.minFilter=c.NearestFilter,e.magFilter=c.NearestFilter,e.wrapS=c.RepeatWrapping,e.wrapT=c.RepeatWrapping,e})(),Ln=Object.freeze(new c.Vector3(.6,.6,.6)),Rn=Object.freeze([]),zn=Object.freeze(new c.Box3),Bn=Object.freeze([]),Vn=Object.freeze([]);function Hn(){return{customShaders:void 0,castShadow:void 0,receiveShadow:void 0,vertexMarks:void 0,pano0:void 0,pano1:void 0,pano0Depth:void 0,pano1Depth:void 0,panoFilter:void 0,refinedScreen:void 0,floorStyle:void 0,colorStyle:void 0,constantColor:void 0,shownFloorIndex:void 0,modelAlpha:void 0,opacity:void 0,progress:void 0,transition:void 0,clippers:void 0,brightness:void 0,useHQWeight:void 0,useHQDepth:void 0,pointSize:void 0,pointBack:void 0,pointShape:void 0,pointScale:void 0,pointMaxPixel:void 0,pointMinPixel:void 0,pointAppearAnimation:void 0,gradientTexture:void 0,colorSaturation:void 0,colorBrightness:void 0,outlineGain:void 0,distanceGain:void 0,useAddBlend:void 0,boundingBox:void 0,gsSHDegree:void 0,minLevelOfDetail:void 0,maxLevelOfDetail:void 0,minGeometricError:void 0,maxGeometricError:void 0,panoramaMinGeometricError:void 0,skipLevelOfDetail:void 0,mostDetail:void 0,loadSiblings:void 0,cameraCulling:void 0,maxMemoryUsage:void 0,maxRequests:void 0,requestOrder:void 0,maxScreenSpaceError:void 0,memoryAdjustedScreenSpaceError:void 0,cacheCameras:void 0}}function Un(){return{customShaders:Bn,castShadow:!1,receiveShadow:!1,vertexMarks:!0,pano0:null,pano1:null,pano0Depth:null,pano1Depth:null,panoFilter:null,refinedScreen:null,floorStyle:`OPACITY`,colorStyle:`RGB`,constantColor:Ln,shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,transition:`FADE`,clippers:Rn,brightness:1,useHQWeight:!1,useHQDepth:!1,pointSize:`ATTENUATION`,pointBack:`DARK`,pointShape:`CIRCLE`,pointScale:.02,pointMaxPixel:40,pointMinPixel:0,pointAppearAnimation:!0,gradientTexture:In,colorSaturation:0,colorBrightness:0,outlineGain:0,distanceGain:0,useAddBlend:!1,boundingBox:zn,gsSHDegree:0,minLevelOfDetail:0,maxLevelOfDetail:20,minGeometricError:0,maxGeometricError:1e4,panoramaMinGeometricError:.04,skipLevelOfDetail:!1,mostDetail:!1,loadSiblings:!1,cameraCulling:!0,maxMemoryUsage:64,maxRequests:6,requestOrder:`SCREEN_SPACE_ERROR`,maxScreenSpaceError:4,memoryAdjustedScreenSpaceError:!1,cacheCameras:Vn}}var Wn=jn(Hn());function Gn(e,t,n){let r=Fn[t];if(!r)return!1;Array.isArray(n)&&(n=n.slice());let i=e[t];return r(i,n)?!1:(e[t]=n,!0)}var K=class e{static createDefault(){return Un()}static resolveValue(...t){let n=Object.assign(this.createDefault(),{versions:[],version:``});for(let r of t){let t=r instanceof e?r.version:nn();n.versions.push(t);for(let e of Wn)r[e]!==void 0&&Gn(n,e,r[e])}return n.version=n.versions.toString(),n}constructor(e){this.id=nn(),this.versionNumber=0,this.unbind=new Map,this.value=Hn(),e&&this.copy(e);for(let e of Wn)Object.defineProperty(this,e,{get(){return this.value[e]}});Rt(this)}get version(){return`${this.id}:${this.versionNumber}`}resolveValue(...t){return e.resolveValue(...t,this)}assignValue(e,t){let n=this.unbind.get(e);n&&(this.unbind.delete(e),n());let r=Gn(this.value,e,t),i=this.value[e];if(i instanceof ln){let t=i.on(`update`,()=>this.versionNumber++);this.unbind.set(e,t)}return r}set(e,t){let n=!1;if(typeof e==`string`)t!==void 0&&this.assignValue(e,t)&&(n=!0);else{let t=e;for(let e of Wn)t[e]!==void 0&&this.assignValue(e,t[e])&&(n=!0)}return n&&this.versionNumber++,this}reset(...e){let t=!1;for(let n of e)this.assignValue(n,void 0)&&(t=!0);return t&&this.versionNumber++,this}resetAll(){return this.reset(...Wn)}copy(e){let t=!0;for(let n of Wn)this.assignValue(n,e[n])&&(t=!0);return t&&this.versionNumber++,this}},Kn=class extends c.Group{constructor(){super(...arguments),this.parameter=new K,this.needsRender=!0}get materialParameters(){return this.parameter.resolveValue()}get pbmMaterialParametersVersion(){return this.parameter.resolveValue().version}setMaterial(e){this.parameter.set(e),this.update(),this.needsRender=!0}getMaterial(){return this.parameter.resolveValue()}update(){let e=this.parameter.resolveValue();this.traverse(t=>{t instanceof yn||t instanceof bn?qn(t,e):t instanceof kn&&Jn(t,e)})}};function qn(e,t){let n=e.material;e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow;for(let e of n)e.customShaders=t.customShaders,e.pano0=t.pano0,e.pano1=t.pano1,e.pano0Depth=t.pano0Depth,e.pano1Depth=t.pano1Depth,e.refinedScreen=t.refinedScreen,e.modelAlpha=t.modelAlpha,e.progress=t.progress,e.transition=t.transition,e.opacity=t.opacity,e.floorStyle=t.floorStyle,e.constantColor=t.constantColor,e.shownFloorIndex=t.shownFloorIndex,e.clippers=t.clippers,e.brightness=t.brightness,e.useHQWeight=t.useHQWeight,e.useHQDepth=t.useHQDepth,e.colorSaturation=t.colorSaturation,e.colorBrightness=t.colorBrightness,e.gradientTexture=t.gradientTexture,e.shaderType===`none`?(e.transparent=!0,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!1,e.depthTest=!0):(e.transparent=e.alphaMode===`BLEND`,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!0,e.depthTest=!0,t.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.shownFloorIndex>-1&&e.shownFloorIndex!==e.floorIndex&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.alphaMap&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),t.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending))}function Jn(e,t){let n=[e.material];e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow;for(let e of n)e.customShaders=t.customShaders,e.pointScale=t.pointScale,e.pointMinPixel=t.pointMinPixel,e.pointMaxPixel=t.pointMaxPixel,e.pointSize=t.pointSize,e.pointShape=t.pointShape,e.pointBack=t.pointBack,e.modelAlpha=t.modelAlpha,e.opacity=t.opacity,e.floorStyle=t.floorStyle,e.constantColor=t.constantColor,e.shownFloorIndex=t.shownFloorIndex,e.clippers=t.clippers,e.brightness=t.brightness,e.useHQWeight=t.useHQWeight,e.useHQDepth=t.useHQDepth,e.colorSaturation=t.colorSaturation,e.colorBrightness=t.colorBrightness,e.outlineGain=t.outlineGain,e.distanceGain=t.distanceGain,e.gradientTexture=t.gradientTexture,e.transparent=!1,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!0,e.depthTest=!0,e.shownFloorIndex>-1&&(e.transparent=e.shownFloorIndex!==e.floorIndex),e.modelAlpha<1&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),t.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.useHQWeight&&(e.depthWrite=!1,e.blending=c.CustomBlending,e.blendSrc=c.SrcAlphaFactor,e.blendSrcAlpha=c.SrcAlphaFactor,e.blendDst=c.OneFactor,e.blendDstAlpha=c.OneFactor)}var Yn=class e extends c.Points{get positions(){let e=this.geometry.getAttribute(`position`);return e?e.array:new Float32Array}get rotations(){let e=this.geometry.getAttribute(`rotation`);return e?e.array:new Float32Array}get scales(){let e=this.geometry.getAttribute(`scale`);return e?e.array:new Float32Array}get colors(){let e=this.geometry.getAttribute(`color`);return e?e.array:new Uint8Array}get selection(){let e=this.geometry.getAttribute(`selection`);return e?e.array:new Uint8Array}get sh1(){let e=this.geometry.getAttribute(`sh1`);return e?e.array:void 0}get sh2(){let e=this.geometry.getAttribute(`sh2`);return e?e.array:void 0}get sh3(){let e=this.geometry.getAttribute(`sh3`);return e?e.array:void 0}constructor(e){var t;let n=new c.BufferGeometry;super(n),this.transformChanged=!1,this.selectedChanged=!1,this.transferDetached=!1,this.maxSHDegree=0,this.usedSHDegree=0,this._selected=!1,this.material.visible=!1,this.numPoints=e?e.numPoints:0,this.maxSHDegree=(t=e==null?void 0:e.shDegree)==null?0:t,this.usedSHDegree=0,e&&e.positions?n.setAttribute(`position`,new c.BufferAttribute(e.positions,3)):n.setAttribute(`position`,new c.BufferAttribute(new Float32Array,3)),e&&e.rotations?n.setAttribute(`rotation`,new c.BufferAttribute(e.rotations,4)):n.setAttribute(`rotation`,new c.BufferAttribute(new Float32Array,4)),e&&e.scales?n.setAttribute(`scale`,new c.BufferAttribute(e.scales,3)):n.setAttribute(`scale`,new c.BufferAttribute(new Float32Array,3)),e&&e.colors?n.setAttribute(`color`,new c.BufferAttribute(e.colors,4,!0)):n.setAttribute(`color`,new c.BufferAttribute(new Uint8Array,4,!0));let r=new Uint8Array(this.numPoints);if(n.setAttribute(`selection`,new c.BufferAttribute(r,1)),e!=null&&e.sh1&&n.setAttribute(`sh1`,new c.BufferAttribute(e.sh1,9)),e!=null&&e.sh2&&n.setAttribute(`sh2`,new c.BufferAttribute(e.sh2,15)),e!=null&&e.sh3&&n.setAttribute(`sh3`,new c.BufferAttribute(e.sh3,21)),this._boundingBox=new c.Box3(new c.Vector3(1/0,1/0,1/0),new c.Vector3(-1/0,-1/0,-1/0)),e&&e.positions)for(let t=0;t<this.numPoints;t++)this._boundingBox.expandByPoint(new c.Vector3(e.positions[3*t],e.positions[3*t+1],e.positions[3*t+2]));this.matrixAutoUpdate=!1,this.lastMatrixWorld=null}serialize(){let t=new Uint8Array(this.numPoints*e.RowLength),n=new Float32Array(t.buffer),r=new Uint8Array(t.buffer),i=this.positions,a=this.colors,o=this.scales,s=this.rotations;for(let e=0;e<this.numPoints;e++)n[8*e+0]=i[3*e+0],n[8*e+1]=i[3*e+1],n[8*e+2]=i[3*e+2],r[32*e+24+0]=a[4*e+0],r[32*e+24+1]=a[4*e+1],r[32*e+24+2]=a[4*e+2],r[32*e+24+3]=a[4*e+3],n[8*e+3+0]=o[3*e+0],n[8*e+3+1]=o[3*e+1],n[8*e+3+2]=o[3*e+2],r[32*e+28+0]=s[4*e+0]*128+128&255,r[32*e+28+1]=s[4*e+1]*128+128&255,r[32*e+28+2]=s[4*e+2]*128+128&255,r[32*e+28+3]=s[4*e+3]*128+128&255;return t}reattach(e,t,n,r,i){let a=new Float32Array(e),o=new Float32Array(t),s=new Float32Array(n),l=new Uint8Array(r),u=new Uint8Array(i);this.geometry.setAttribute(`position`,new c.BufferAttribute(a,3)),this.geometry.setAttribute(`rotation`,new c.BufferAttribute(o,4)),this.geometry.setAttribute(`scale`,new c.BufferAttribute(s,3)),this.geometry.setAttribute(`color`,new c.BufferAttribute(l,4,!0)),this.geometry.setAttribute(`selection`,new c.BufferAttribute(u,1)),this.transferDetached=!1}get selected(){return this._selected}set selected(e){this._selected!==e&&(this._selected=e,this.selectedChanged=!0)}get boundingBox(){let e=new c.Vector3;this._boundingBox.getCenter(e),e.add(this.position);let t=new c.Vector3;this._boundingBox.getSize(t),t.multiply(this.scale);let n=new c.Vector3;return n.copy(t).multiplyScalar(.5),new c.Box3(e.clone().sub(n),e.clone().add(n))}dispose(){}raycast(e,t){var n,r;let i=this.matrixWorld,a=(r=(n=e.params.Points)==null?void 0:n.threshold)==null?0:r;if(this._boundingBox.isEmpty())return;let o=new c.Vector3;this._boundingBox.getCenter(o);let s=new c.Vector3;this._boundingBox.getSize(s);let l=Math.max(s.x,s.y,s.z)*.5,u=new c.Sphere(o,l);if(u.applyMatrix4(i),u.radius+=a,e.ray.intersectsSphere(u)===!1)return;let d=new c.Matrix4;d.getInverse(i);let f=new c.Ray;f.copy(e.ray).applyMatrix4(d);let p=a/((this.scale.x+this.scale.y+this.scale.z)/3),m=p*p,h=this.geometry.getAttribute(`position`);if(!h)return;let g=h.array,_=this.numPoints;for(let n=0;n<_;n++){let r=new c.Vector3(g[n*3],g[n*3+1],g[n*3+2]),a=f.distanceSqToPoint(r);if(a<m){let o=new c.Vector3;f.closestPointToPoint(r,o),o.applyMatrix4(i);let s=e.ray.origin.distanceTo(o);if(s<e.near||s>e.far)continue;t.push({distance:s,distanceToRay:Math.sqrt(a),point:o,index:n,face:null,object:this})}}}};Yn.RowLength=32;var Xn=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),Zn=new c.Matrix4().getInverse(Xn);function q(...e){}var Qn=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],$n=typeof location<`u`?location.href:``,er=/^https\:/.test($n),tr=class extends Error{constructor(e,t,n){super(`[NETWORK]: request proxy error(type: ${t}, reason: ${n}): ${e}`)}},nr=class extends Error{constructor(e,t,n){super(`[NETWORK]: response error(type: ${t}, status: ${n}): ${e}`),this.httpStatus=n}},rr=class extends Error{constructor(e,t,n){super(`[NETWORK]: request timeout(type: ${t}, timeout: ${n}ms): ${e}`)}};function ir(e){if(!e)return{};let t={},n=e.trim().split(`
|
|
318
|
+
`));let o=String(this.clippers.length);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,o),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,o);for(let t of a)t.onBeforeCompile&&t.onBeforeCompile(e,r)};let r=``;this.onBeforeRender=(e,i,a,o,s,l)=>{let u=this.shaderType;a instanceof en?(n.pixelRatio.value=a.pixelRatio,n.resolution.value.copy(a.resolution)):(n.pixelRatio.value=e.getPixelRatio(),e.getViewport(Cn),n.resolution.value.set(Cn.width,Cn.height));let d=this.transparent===!1&&this.blending===c.NormalBlending;t.USE_OPAQUE!==d&&(t.USE_OPAQUE=d,this.needsUpdate=!0);let f=this.customShaders.filter(e=>e.type.includes(u)).map(e=>`${e.id}:${e.version}`).join(`|`);r!==f&&(r=f,this.needsUpdate=!0)},Object.defineProperty(this,`uniform`,{configurable:!1,enumerable:!1,writable:!1,value:n}),H(this,`isPBMPointCloudMaterial`,{configurable:!1,writable:!1,value:!0}),H(this,`isShaderMaterial`,{configurable:!1,writable:!1,value:!0}),H(this,`opacity`,{get(){return n.opacity.value},set(e){n.opacity.value=e}}),H(this,`vertexMarks`,{get(){return!!t.USE_VERTEX_MARK},set(e){t.USE_VERTEX_MARK!==e&&(t.USE_VERTEX_MARK=e,this.needsUpdate=!0)}}),H(this,`pointScale`,{get(){return n.pointScale.value},set(e){n.pointScale.value=e}}),H(this,`pointMinPixel`,{get(){return n.pointMinPixel.value},set(e){n.pointMinPixel.value=e}}),H(this,`pointMaxPixel`,{get(){return n.pointMinPixel.value},set(e){n.pointMaxPixel.value=e}}),H(this,`pointSize`,{get(){return this.defines.USE_POINT_SIZE_ATTENUATION===!0?`ATTENUATION`:`FIXED`},set(e){let t=e===`ATTENUATION`;this.defines.USE_POINT_SIZE_ATTENUATION!==t&&(this.defines.USE_POINT_SIZE_ATTENUATION=t,this.needsUpdate=!0)}}),H(this,`pointShape`,{get(){return this.defines.USE_POINT_SHAPE_CIRCLE===!0?`CIRCLE`:`SQUARE`},set(e){let t=e===`CIRCLE`;this.defines.USE_POINT_SHAPE_CIRCLE!==t&&(this.defines.USE_POINT_SHAPE_CIRCLE=t,this.needsUpdate=!0)}}),H(this,`pointBack`,{get(){return this.defines.USE_POINT_BACK_HIDDEN===!0?`HIDDEN`:this.defines.USE_POINT_BACK_DARK===!0?`DARK`:`VISIBLE`},set(e){let t=e===`HIDDEN`,n=e===`DARK`;this.defines.USE_POINT_BACK_HIDDEN!==t&&(this.defines.USE_POINT_BACK_HIDDEN=t,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==n&&(this.defines.USE_POINT_BACK_DARK=n,this.needsUpdate=!0)}}),H(this,`modelAlpha`,{get(){return n.modelAlpha.value},set(e){n.modelAlpha.value=e}}),H(this,`colorStyle`,{get(){return t.USE_COLOR_CONSTANT?`CONSTANT`:t.USE_COLOR_ALTITUDE?`ALTITUDE`:`RGB`},set(e){let n=e===`CONSTANT`,r=e===`ALTITUDE`;t.USE_COLOR_CONSTANT!==n&&(t.USE_COLOR_CONSTANT=n,this.needsUpdate=!0),t.USE_COLOR_ALTITUDE!==r&&(t.USE_COLOR_ALTITUDE=r,this.needsUpdate=!0)}}),H(this,`constantColor`,{get(){return n.constantColor.value},set(e){n.constantColor.value=e}}),H(this,`floorIndex`,{get(){return n.floorIndex.value},set(e){n.floorIndex.value=e}}),H(this,`shownFloorIndex`,{get(){return n.shownFloorIndex.value},set(e){n.shownFloorIndex.value=e}}),H(this,`floorStyle`,{get(){return t.USE_FLOOR_STYLE_VISIBILITY?`VISIBILITY`:`OPACITY`},set(e){let n=e===`VISIBILITY`;t.USE_FLOOR_STYLE_VISIBILITY!==n&&(t.USE_FLOOR_STYLE_VISIBILITY=n,this.needsUpdate=!0)}}),H(this,`gradientTexture`,{get(){return n.gradientTexture.value},set(e){n.gradientTexture.value=e}}),H(this,`brightness`,{get(){return n.brightness.value},set(e){n.brightness.value=e}});let i=[];H(this,`clippers`,{get(){return i},set(e){i!==e&&(i=e,n.clippers.value=i.map(e=>{let t=typeof e.floorIndex==`number`?e.floorIndex:-1;return{matrixInverse:new c.Matrix4().getInverse(e.clippingBoxMatrix),floorIndex:t}}),this.needsUpdate=!0)}}),H(this,`colorSaturation`,{get(){return n.colorSaturation.value},set(e){n.colorSaturation.value=e;let r=n.colorSaturation.value!==0||n.colorBrightness.value!==0||n.outlineGain.value!==0||n.distanceGain.value!==0;t.USE_COLOR_ADJUSTMENT!==r&&(t.USE_COLOR_ADJUSTMENT=r,this.needsUpdate=!0)}}),H(this,`colorBrightness`,{get(){return n.colorBrightness.value},set(e){n.colorBrightness.value=e;let r=n.colorSaturation.value!==0||n.colorBrightness.value!==0||n.outlineGain.value!==0||n.distanceGain.value!==0;t.USE_COLOR_ADJUSTMENT!==r&&(t.USE_COLOR_ADJUSTMENT=r,this.needsUpdate=!0)}}),H(this,`outlineGain`,{get(){return n.outlineGain.value},set(e){n.outlineGain.value=e;let r=n.colorSaturation.value!==0||n.colorBrightness.value!==0||n.outlineGain.value!==0||n.distanceGain.value!==0;t.USE_COLOR_ADJUSTMENT!==r&&(t.USE_COLOR_ADJUSTMENT=r,this.needsUpdate=!0)}}),H(this,`distanceGain`,{get(){return n.distanceGain.value},set(e){n.distanceGain.value=e;let r=n.colorSaturation.value!==0||n.colorBrightness.value!==0||n.outlineGain.value!==0||n.distanceGain.value!==0;t.USE_COLOR_ADJUSTMENT!==r&&(t.USE_COLOR_ADJUSTMENT=r,this.needsUpdate=!0)}}),H(this,`useHQWeight`,{get(){return t.USE_HQ_WEIGHT},set(e){e!==t.USE_HQ_WEIGHT&&(t.USE_HQ_WEIGHT=e,this.needsUpdate=!0)}}),H(this,`useHQDepth`,{get(){return t.USE_HQ_DEPTH},set(e){e!==t.USE_HQ_DEPTH&&(t.USE_HQ_DEPTH=e,this.needsUpdate=!0)}}),H(this,`modelBoundingMin`,{get(){return n.modelBoundingMin.value},set(e){n.modelBoundingMin.value=e}}),H(this,`modelBoundingMax`,{get(){return n.modelBoundingMax.value},set(e){n.modelBoundingMax.value=e}}),typeof e==`object`&&this.setValues(e),Rt(this)}copy(e){return super.copy(e),this.pointScale=e.pointScale,this.pointMinPixel=e.pointMinPixel,this.pointMaxPixel=e.pointMaxPixel,this.customShaders=e.customShaders,this.modelAlpha=e.modelAlpha,this.colorStyle=e.colorStyle,this.constantColor.copy(e.constantColor),this.floorIndex=e.floorIndex,this.shownFloorIndex=e.shownFloorIndex,this.floorStyle=e.floorStyle,this.gradientTexture=e.gradientTexture,this.brightness=e.brightness,this.clippers=e.clippers,this.colorSaturation=e.colorSaturation,this.colorBrightness=e.colorBrightness,this.outlineGain=e.outlineGain,this.distanceGain=e.distanceGain,this.useHQWeight=e.useHQWeight,this.useHQDepth=e.useHQDepth,this.modelBoundingMin.copy(e.modelBoundingMin),this.modelBoundingMax.copy(e.modelBoundingMax),this}clone(){let e=this.constructor;return new e().copy(this)}refreshUniforms(){}},kn=class extends c.Points{constructor(e,t){super(e,t),this.onBeforeRender=(e,t,n,r,i,a)=>{i instanceof On&&i.onBeforeRender&&i.onBeforeRender(e,t,n,r,this,a)}}},An=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAABCAYAAACouxZ2AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAAQAAAAB7UD0+AAACA0lEQVRIDXWUW3YjIQxEwdnV/GT/q8kO3FO3pAJst3PSAaR6Cbszf//9XeMxxpjXmI+pVXudp2s6PC4dqHff9e6D7/PZLy46xQvG+sZvrfK8xgXUeq85yINe9bdmtOK1+kun5vjgq58a+eZPna9jvmjiserqG/+Whathvo3L3WhV89L9sXI/m18z2uene9ap/ftsuT9WZxoHXzW56/fpj8l7+tTw7P011NdpqnY19sRsfuHMA9u8oZWfDz4+fra/dfG1V60ydZ7qba1g7UNAeK0JP7ydD7/OqH6wO2f7HTq+B/lbL9qsB3/N1/UzR81XfPzw4tp5OPvRneacteq8Xo0xR3vuv/kPz0KtX0Nhg0eHuaNXdWI3X/ld427h++vzyp99V6VPrzWFhbv4ayay4oFecm198MmUXN/mL+x7npq/uJXBGb/MTw4+t+SvbLoTZnUW5uHhz7nWcTxT73OwXV7cxT9wbBf/0LnDBgcnHmtPLYba32Hp808sMy1u88yhr58n70/v4xX92GSN19l/2UsqGmiH94Hpxjcs+DO/ccpIVNVp62PUWXu//ur1GQy1Cf+GZ13rtNYN1po3/NI79fGXibHkq4z25xvV2pW3szpneXsW8SsreTe/NIPrtXMnH7wPf+LEN6tqhUVHj3XKD/72p9eafCeYB3zuonnbv7yqP8d/o4K6gRb1wbYAAAAASUVORK5CYII=`;function jn(e){return Object.keys(e)}function G(e,t){return e==t}function Mn(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}function Nn(e,t){return e instanceof c.Vector3&&t instanceof c.Vector3?e.equals(t):e===t}function Pn(e,t){return e instanceof c.Box3&&t instanceof c.Box3?e.equals(t):e===t}var Fn={customShaders:Mn,castShadow:G,receiveShadow:G,vertexMarks:G,pano0:G,pano1:G,pano0Depth:G,pano1Depth:G,panoFilter:G,refinedScreen:G,modelAlpha:G,progress:G,transition:G,opacity:G,floorStyle:G,colorStyle:G,constantColor:Nn,shownFloorIndex:G,clippers:Mn,brightness:G,useHQWeight:G,useHQDepth:G,pointShape:G,pointSize:G,pointBack:G,pointScale:G,pointMinPixel:G,pointMaxPixel:G,pointAppearAnimation:G,colorSaturation:G,colorBrightness:G,useAddBlend:G,outlineGain:G,distanceGain:G,gradientTexture:G,boundingBox:Pn,gaussianSplattingSHDegree:G,minLevelOfDetail:G,maxLevelOfDetail:G,minGeometricError:G,maxGeometricError:G,panoramaMinGeometricError:G,skipLevelOfDetail:G,mostDetail:G,loadSiblings:G,cameraCulling:G,maxMemoryUsage:G,maxRequests:G,requestOrder:G,maxScreenSpaceError:G,memoryAdjustedScreenSpaceError:G,cacheCameras:Mn},In=(()=>{let e;return e=typeof document<`u`?new c.TextureLoader().load(An):new c.Texture,e.minFilter=c.NearestFilter,e.magFilter=c.NearestFilter,e.wrapS=c.RepeatWrapping,e.wrapT=c.RepeatWrapping,e})(),Ln=Object.freeze(new c.Vector3(.6,.6,.6)),Rn=Object.freeze([]),zn=Object.freeze(new c.Box3),Bn=Object.freeze([]),Vn=Object.freeze([]);function Hn(){return{customShaders:void 0,castShadow:void 0,receiveShadow:void 0,vertexMarks:void 0,pano0:void 0,pano1:void 0,pano0Depth:void 0,pano1Depth:void 0,panoFilter:void 0,refinedScreen:void 0,floorStyle:void 0,colorStyle:void 0,constantColor:void 0,shownFloorIndex:void 0,modelAlpha:void 0,opacity:void 0,progress:void 0,transition:void 0,clippers:void 0,brightness:void 0,useHQWeight:void 0,useHQDepth:void 0,pointSize:void 0,pointBack:void 0,pointShape:void 0,pointScale:void 0,pointMaxPixel:void 0,pointMinPixel:void 0,pointAppearAnimation:void 0,gradientTexture:void 0,colorSaturation:void 0,colorBrightness:void 0,outlineGain:void 0,distanceGain:void 0,useAddBlend:void 0,boundingBox:void 0,gaussianSplattingSHDegree:void 0,minLevelOfDetail:void 0,maxLevelOfDetail:void 0,minGeometricError:void 0,maxGeometricError:void 0,panoramaMinGeometricError:void 0,skipLevelOfDetail:void 0,mostDetail:void 0,loadSiblings:void 0,cameraCulling:void 0,maxMemoryUsage:void 0,maxRequests:void 0,requestOrder:void 0,maxScreenSpaceError:void 0,memoryAdjustedScreenSpaceError:void 0,cacheCameras:void 0}}function Un(){return{customShaders:Bn,castShadow:!1,receiveShadow:!1,vertexMarks:!0,pano0:null,pano1:null,pano0Depth:null,pano1Depth:null,panoFilter:null,refinedScreen:null,floorStyle:`OPACITY`,colorStyle:`RGB`,constantColor:Ln,shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,transition:`FADE`,clippers:Rn,brightness:1,useHQWeight:!1,useHQDepth:!1,pointSize:`ATTENUATION`,pointBack:`DARK`,pointShape:`CIRCLE`,pointScale:.02,pointMaxPixel:40,pointMinPixel:0,pointAppearAnimation:!0,gradientTexture:In,colorSaturation:0,colorBrightness:0,outlineGain:0,distanceGain:0,useAddBlend:!1,boundingBox:zn,gaussianSplattingSHDegree:0,minLevelOfDetail:0,maxLevelOfDetail:20,minGeometricError:0,maxGeometricError:1e4,panoramaMinGeometricError:.04,skipLevelOfDetail:!1,mostDetail:!1,loadSiblings:!1,cameraCulling:!0,maxMemoryUsage:64,maxRequests:6,requestOrder:`SCREEN_SPACE_ERROR`,maxScreenSpaceError:4,memoryAdjustedScreenSpaceError:!1,cacheCameras:Vn}}var Wn=jn(Hn());function Gn(e,t,n){let r=Fn[t];if(!r)return!1;Array.isArray(n)&&(n=n.slice());let i=e[t];return r(i,n)?!1:(e[t]=n,!0)}var K=class e{static createDefault(){return Un()}static resolveValue(...t){let n=Object.assign(this.createDefault(),{versions:[],version:``});for(let r of t){let t=r instanceof e?r.version:nn();n.versions.push(t);for(let e of Wn)r[e]!==void 0&&Gn(n,e,r[e])}return n.version=n.versions.toString(),n}constructor(e){this.id=nn(),this.versionNumber=0,this.unbind=new Map,this.value=Hn(),e&&this.copy(e);for(let e of Wn)Object.defineProperty(this,e,{get(){return this.value[e]}});Rt(this)}get version(){return`${this.id}:${this.versionNumber}`}resolveValue(...t){return e.resolveValue(...t,this)}assignValue(e,t){let n=this.unbind.get(e);n&&(this.unbind.delete(e),n());let r=Gn(this.value,e,t),i=this.value[e];if(i instanceof ln){let t=i.on(`update`,()=>this.versionNumber++);this.unbind.set(e,t)}return r}set(e,t){let n=!1;if(typeof e==`string`)t!==void 0&&this.assignValue(e,t)&&(n=!0);else{let t=e;for(let e of Wn)t[e]!==void 0&&this.assignValue(e,t[e])&&(n=!0)}return n&&this.versionNumber++,this}reset(...e){let t=!1;for(let n of e)this.assignValue(n,void 0)&&(t=!0);return t&&this.versionNumber++,this}resetAll(){return this.reset(...Wn)}copy(e){let t=!0;for(let n of Wn)this.assignValue(n,e[n])&&(t=!0);return t&&this.versionNumber++,this}},Kn=class extends c.Group{constructor(){super(...arguments),this.parameter=new K,this.needsRender=!0}get materialParameters(){return this.parameter.resolveValue()}get pbmMaterialParametersVersion(){return this.parameter.resolveValue().version}setMaterial(e){this.parameter.set(e),this.update(),this.needsRender=!0}getMaterial(){return this.parameter.resolveValue()}update(){let e=this.parameter.resolveValue();this.traverse(t=>{t instanceof yn||t instanceof bn?qn(t,e):t instanceof kn&&Jn(t,e)})}};function qn(e,t){let n=e.material;e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow;for(let e of n)e.customShaders=t.customShaders,e.pano0=t.pano0,e.pano1=t.pano1,e.pano0Depth=t.pano0Depth,e.pano1Depth=t.pano1Depth,e.refinedScreen=t.refinedScreen,e.modelAlpha=t.modelAlpha,e.progress=t.progress,e.transition=t.transition,e.opacity=t.opacity,e.floorStyle=t.floorStyle,e.constantColor=t.constantColor,e.shownFloorIndex=t.shownFloorIndex,e.clippers=t.clippers,e.brightness=t.brightness,e.useHQWeight=t.useHQWeight,e.useHQDepth=t.useHQDepth,e.colorSaturation=t.colorSaturation,e.colorBrightness=t.colorBrightness,e.gradientTexture=t.gradientTexture,e.shaderType===`none`?(e.transparent=!0,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!1,e.depthTest=!0):(e.transparent=e.alphaMode===`BLEND`,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!0,e.depthTest=!0,t.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.shownFloorIndex>-1&&e.shownFloorIndex!==e.floorIndex&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.alphaMap&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),t.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending))}function Jn(e,t){let n=[e.material];e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow;for(let e of n)e.customShaders=t.customShaders,e.pointScale=t.pointScale,e.pointMinPixel=t.pointMinPixel,e.pointMaxPixel=t.pointMaxPixel,e.pointSize=t.pointSize,e.pointShape=t.pointShape,e.pointBack=t.pointBack,e.modelAlpha=t.modelAlpha,e.opacity=t.opacity,e.floorStyle=t.floorStyle,e.constantColor=t.constantColor,e.shownFloorIndex=t.shownFloorIndex,e.clippers=t.clippers,e.brightness=t.brightness,e.useHQWeight=t.useHQWeight,e.useHQDepth=t.useHQDepth,e.colorSaturation=t.colorSaturation,e.colorBrightness=t.colorBrightness,e.outlineGain=t.outlineGain,e.distanceGain=t.distanceGain,e.gradientTexture=t.gradientTexture,e.transparent=!1,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!0,e.depthTest=!0,e.shownFloorIndex>-1&&(e.transparent=e.shownFloorIndex!==e.floorIndex),e.modelAlpha<1&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),t.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.useHQWeight&&(e.depthWrite=!1,e.blending=c.CustomBlending,e.blendSrc=c.SrcAlphaFactor,e.blendSrcAlpha=c.SrcAlphaFactor,e.blendDst=c.OneFactor,e.blendDstAlpha=c.OneFactor)}var Yn=class e extends c.Points{get positions(){let e=this.geometry.getAttribute(`position`);return e?e.array:new Float32Array}get rotations(){let e=this.geometry.getAttribute(`rotation`);return e?e.array:new Float32Array}get scales(){let e=this.geometry.getAttribute(`scale`);return e?e.array:new Float32Array}get colors(){let e=this.geometry.getAttribute(`color`);return e?e.array:new Uint8Array}get selection(){let e=this.geometry.getAttribute(`selection`);return e?e.array:new Uint8Array}get sh1(){let e=this.geometry.getAttribute(`sh1`);return e?e.array:void 0}get sh2(){let e=this.geometry.getAttribute(`sh2`);return e?e.array:void 0}get sh3(){let e=this.geometry.getAttribute(`sh3`);return e?e.array:void 0}constructor(e){var t;let n=new c.BufferGeometry;super(n),this.transformChanged=!1,this.selectedChanged=!1,this.transferDetached=!1,this.maxSHDegree=0,this.usedSHDegree=0,this.gsViewLayerKey=``,this.gsClippers=[],this._selected=!1,this.material.visible=!1,this.numPoints=e?e.numPoints:0,this.maxSHDegree=(t=e==null?void 0:e.shDegree)==null?0:t,this.usedSHDegree=0,e&&e.positions?n.setAttribute(`position`,new c.BufferAttribute(e.positions,3)):n.setAttribute(`position`,new c.BufferAttribute(new Float32Array,3)),e&&e.rotations?n.setAttribute(`rotation`,new c.BufferAttribute(e.rotations,4)):n.setAttribute(`rotation`,new c.BufferAttribute(new Float32Array,4)),e&&e.scales?n.setAttribute(`scale`,new c.BufferAttribute(e.scales,3)):n.setAttribute(`scale`,new c.BufferAttribute(new Float32Array,3)),e&&e.colors?n.setAttribute(`color`,new c.BufferAttribute(e.colors,4,!0)):n.setAttribute(`color`,new c.BufferAttribute(new Uint8Array,4,!0));let r=new Uint8Array(this.numPoints);if(n.setAttribute(`selection`,new c.BufferAttribute(r,1)),e!=null&&e.sh1&&n.setAttribute(`sh1`,new c.BufferAttribute(e.sh1,9)),e!=null&&e.sh2&&n.setAttribute(`sh2`,new c.BufferAttribute(e.sh2,15)),e!=null&&e.sh3&&n.setAttribute(`sh3`,new c.BufferAttribute(e.sh3,21)),this._boundingBox=new c.Box3(new c.Vector3(1/0,1/0,1/0),new c.Vector3(-1/0,-1/0,-1/0)),e&&e.positions)for(let t=0;t<this.numPoints;t++)this._boundingBox.expandByPoint(new c.Vector3(e.positions[3*t],e.positions[3*t+1],e.positions[3*t+2]));this.matrixAutoUpdate=!1,this.lastMatrixWorld=null}serialize(){let t=new Uint8Array(this.numPoints*e.RowLength),n=new Float32Array(t.buffer),r=new Uint8Array(t.buffer),i=this.positions,a=this.colors,o=this.scales,s=this.rotations;for(let e=0;e<this.numPoints;e++)n[8*e+0]=i[3*e+0],n[8*e+1]=i[3*e+1],n[8*e+2]=i[3*e+2],r[32*e+24+0]=a[4*e+0],r[32*e+24+1]=a[4*e+1],r[32*e+24+2]=a[4*e+2],r[32*e+24+3]=a[4*e+3],n[8*e+3+0]=o[3*e+0],n[8*e+3+1]=o[3*e+1],n[8*e+3+2]=o[3*e+2],r[32*e+28+0]=s[4*e+0]*128+128&255,r[32*e+28+1]=s[4*e+1]*128+128&255,r[32*e+28+2]=s[4*e+2]*128+128&255,r[32*e+28+3]=s[4*e+3]*128+128&255;return t}reattach(e,t,n,r,i){let a=new Float32Array(e),o=new Float32Array(t),s=new Float32Array(n),l=new Uint8Array(r),u=new Uint8Array(i);this.geometry.setAttribute(`position`,new c.BufferAttribute(a,3)),this.geometry.setAttribute(`rotation`,new c.BufferAttribute(o,4)),this.geometry.setAttribute(`scale`,new c.BufferAttribute(s,3)),this.geometry.setAttribute(`color`,new c.BufferAttribute(l,4,!0)),this.geometry.setAttribute(`selection`,new c.BufferAttribute(u,1)),this.transferDetached=!1}get selected(){return this._selected}set selected(e){this._selected!==e&&(this._selected=e,this.selectedChanged=!0)}get boundingBox(){let e=new c.Vector3;this._boundingBox.getCenter(e),e.add(this.position);let t=new c.Vector3;this._boundingBox.getSize(t),t.multiply(this.scale);let n=new c.Vector3;return n.copy(t).multiplyScalar(.5),new c.Box3(e.clone().sub(n),e.clone().add(n))}dispose(){}raycast(e,t){var n,r;let i=this.matrixWorld,a=(r=(n=e.params.Points)==null?void 0:n.threshold)==null?0:r;if(this._boundingBox.isEmpty())return;let o=new c.Vector3;this._boundingBox.getCenter(o);let s=new c.Vector3;this._boundingBox.getSize(s);let l=Math.max(s.x,s.y,s.z)*.5,u=new c.Sphere(o,l);if(u.applyMatrix4(i),u.radius+=a,e.ray.intersectsSphere(u)===!1)return;let d=new c.Matrix4;d.getInverse(i);let f=new c.Ray;f.copy(e.ray).applyMatrix4(d);let p=a/((this.scale.x+this.scale.y+this.scale.z)/3),m=p*p,h=this.geometry.getAttribute(`position`);if(!h)return;let g=h.array,_=this.numPoints;for(let n=0;n<_;n++){let r=new c.Vector3(g[n*3],g[n*3+1],g[n*3+2]),a=f.distanceSqToPoint(r);if(a<m){let o=new c.Vector3;f.closestPointToPoint(r,o),o.applyMatrix4(i);let s=e.ray.origin.distanceTo(o);if(s<e.near||s>e.far)continue;t.push({distance:s,distanceToRay:Math.sqrt(a),point:o,index:n,face:null,object:this})}}}};Yn.RowLength=32;var Xn=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),Zn=new c.Matrix4().getInverse(Xn);function q(...e){}var Qn=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],$n=typeof location<`u`?location.href:``,er=/^https\:/.test($n),tr=class extends Error{constructor(e,t,n){super(`[NETWORK]: request proxy error(type: ${t}, reason: ${n}): ${e}`)}},nr=class extends Error{constructor(e,t,n){super(`[NETWORK]: response error(type: ${t}, status: ${n}): ${e}`),this.httpStatus=n}},rr=class extends Error{constructor(e,t,n){super(`[NETWORK]: request timeout(type: ${t}, timeout: ${n}ms): ${e}`)}};function ir(e){if(!e)return{};let t={},n=e.trim().split(`
|
|
319
319
|
`);for(let e=0;e<n.length;e++){let r=n[e],i=r.indexOf(`:`),a=r.slice(0,i).trim().toLowerCase(),o=r.slice(i+1).trim();o&&(t[a]?t[a]+=`, `+o:t[a]=o)}return t}function ar(e){for(let t of Qn){let n=e.match(t);if(n)return`jsonp_`+n[1]}return null}function or(e){return ar(e)!==null}var sr=class extends cn{};function cr(e,t={},n=q,r=q,i=q){let a=U(),o=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>er&&/^http\:/.test(e)?(console.warn(`The page at '${$n}' was loaded over HTTPS, but requested an insecure element '${e}'. This request was automatically upgraded to HTTPS`),e.replace(/^http\:/,`https:`)):e).catch(n=>{var r;ar(e);let i=new tr(o,`XMLHttpRequest`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`XMLHttpRequest`,`forbidden`,i.message),Promise.reject(i)}).then(e=>new Promise((s,c)=>{let l=ar(e);if(l){let i=window,u=null,d=!1,f=document.createElement(`script`);i[l]=p=>{var m,h;let g=U(),_=g-a;if(delete i[l],f.parentNode&&f.parentNode.removeChild(f),u!==null&&(window.clearTimeout(u),u=null),d===!0)return;if(p.indexOf(`data:`)!==0){let n=new nr(e,`XMLHttpRequest`,500);r(n),c(n),(m=t.networkSubscribe)==null||m.emit(`network`,e,`XMLHttpRequest`,`error`,n.message);return}let v=p.split(`,`),y=(v[0].match(/:(.*?);/)||[])[1],b=v[1];if(t.responseType===`arraybuffer`||t.responseType===`blob`){let e=atob(v[1]),n=e.length,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=e.charCodeAt(t);b=t.responseType===`arraybuffer`?r.buffer:new Blob([r],{type:y})}let x={body:b,meta:{origin:o,source:e,requestTime:a,responseTime:g,costs:_,headers:{}}};n(x),s(x),(h=t.networkSubscribe)==null||h.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(x.meta)),d=!0},f.src=e,document.body.appendChild(f),typeof t.timeout==`number`&&(u=window.setTimeout(()=>{var n;if(u=null,d!==!0){d=!0;let i=new rr(e,`XMLHttpRequest`,t.timeout||NaN);r(i),c(i),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,i.message)}},t.timeout))}else{let l=!1,u=new XMLHttpRequest,d=()=>{u&&(u.removeEventListener(`timeout`,f,!1),u.removeEventListener(`progress`,p,!1),u.removeEventListener(`load`,m,!1),u.removeEventListener(`error`,h,!1)),u=null,d=q},f=function(){var n;if(l===!0)return;l=!0,d();let i=new rr(e,`XMLHttpRequest`,t.timeout||NaN);r(i),c(i),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,i.message)},p=function(e){l!==!0&&e.lengthComputable&&(e.total<=0||i(e.loaded/e.total,e.loaded,e.total))},m=function(r){var i;if(l===!0)return;let c=this.status;if(c===0||c>=200&&c<400){l=!0,d();let c=U(),u=c-a,f=ir(this.getAllResponseHeaders()),p=r.total,m={body:this.response,meta:{origin:o,source:e,requestTime:a,responseTime:c,costs:u,headers:f,size:p}};n(m),s(m),(i=t.networkSubscribe)==null||i.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(m.meta))}else h.call(this)},h=function(){var n;if(l===!0)return;l=!0,d();let i=new nr(e,`XMLHttpRequest`,this.status);r(i),c(i),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`error`,i.message)};u.addEventListener(`timeout`,f,!1),u.addEventListener(`progress`,p,!1),u.addEventListener(`load`,m,!1),u.addEventListener(`error`,h,!1),t.responseType&&(u.responseType=t.responseType),typeof t.timeout==`number`&&(u.timeout=t.timeout),u.open(`GET`,e,!0),u.send(null)}}))}var lr={};function ur(e,t={}){let n=U(),r=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>er&&/^http\:/.test(e)?(console.warn(`The page at '${$n}' was loaded over HTTPS, but requested an insecure element '${e}'. This request was automatically upgraded to HTTPS`),e.replace(/^http\:/,`https:`)):e).catch(n=>{var i;let a=new tr(r,`Link`,n&&n.message?String(n.message):String(n));return(i=t.networkSubscribe)==null||i.emit(`network`,e,`Link`,`forbidden`,a.message),Promise.reject(a)}).then(e=>e in lr?lr[e]:lr[e]=new Promise((i,a)=>{let o=document.head||document.getElementsByTagName(`head`)[0],s=document.createElement(`link`),c=!1,l=null;s.onload=a=>{var o;if(l!==null&&(clearTimeout(l),l=null),c===!0)return;c=!0,i(),s.onerror=q,s.onload=q;let u=U(),d={origin:r,source:e,requestTime:n,responseTime:u,costs:u-n,headers:{}};(o=t.networkSubscribe)==null||o.emit(`network`,e,`Link`,`preload`,JSON.stringify(d))},s.onerror=n=>{var r;if(l!==null&&(clearTimeout(l),l=null),c===!0)return;c=!0,delete lr[e],o&&s.parentNode===o&&o.removeChild(s);let i=new nr(e,`Link`,0);a(i),s.onerror=q,s.onload=q,(r=t.networkSubscribe)==null||r.emit(`network`,e,`Link`,`error`,i.message)},typeof t.timeout==`number`&&(l=window.setTimeout(()=>{var a;if(l=null,c===!0)return;c=!0,i(),s.onerror=q,s.onload=q;let o=U(),u={origin:r,source:e,requestTime:n,responseTime:o,costs:o-n,headers:{}};(a=t.networkSubscribe)==null||a.emit(`network`,e,`Link`,`timeout`,JSON.stringify(u))},t.timeout)),s.rel=s.relList&&s.relList.supports(`prefetch`)?`prefetch`:`preload`,s.as=`fetch`,s.crossOrigin=``,s.fetchPriority=`high`,s.href=e,o&&o.appendChild(s)}))}function dr(e,t={},n=q,r=q,i=q,a){let o=U(),s=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>er&&/^http\:/.test(e)?(console.warn(`The page at '${$n}' was loaded over HTTPS, but requested an insecure element '${e}'. This request was automatically upgraded to HTTPS`),e.replace(/^http\:/,`https:`)):e).catch(n=>{var r;let i=new tr(s,`Image`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`forbidden`,i.message),Promise.reject(i)}).then(e=>or(e)?cr(e,{responseType:`blob`,networkSubscribe:t.networkSubscribe}).then(e=>URL.createObjectURL(e.body)):e).then(e=>new Promise((c,l)=>{let u=a==null?new Image:a,d=!1,f=null;typeof t.timeout==`number`&&(f=window.setTimeout(()=>{var n;if(u.onload=q,u.onerror=q,f=null,d===!0)return;d=!0;let i=new rr(e,`Image`,t.timeout);r(i),l(i),(n=t.networkSubscribe)==null||n.emit(`network`,e,`Image`,`timeout`,i.message)},t.timeout)),u.onload=()=>{var r;if(u.onload=q,u.onerror=q,f!==null&&(clearTimeout(f),f=null),d===!0)return;let a=U(),l={headers:{},origin:s,source:e,requestTime:o,responseTime:a,costs:a-o};d=!0;let p={body:u,meta:l};i(1),n(p),c(p),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`ok`,JSON.stringify(p.meta))},u.onerror=()=>{var n;if(u.onload=q,u.onerror=q,f!==null&&(clearTimeout(f),f=null),d===!0)return;d=!0;let i=new nr(e,`Image`,0);r(i),l(i),(n=t.networkSubscribe)==null||n.emit(`network`,e,`Image`,`ok`,i.message)},i(0),u.src=e}))}var fr=class{constructor(e={}){this.options=e}ajax(e,t={},n=q,r=q,i=q){var a;let o=this.options;return cr(e,{responseType:t.responseType,timeout:(a=t.timeout)==null?o.timeout:a,get requestProxy(){var e;return(e=t.requestProxy)==null?o.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?o.networkSubscribe:e}},n,r,i)}loadImage(e,t={},n=q,r=q,i=q,a){var o;let s=this.options;return dr(e,{timeout:(o=t.timeout)==null?s.timeout:o,get requestProxy(){var e;return(e=t.requestProxy)==null?s.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?s.networkSubscribe:e}},n,r,i,a)}preload(e,t={}){var n;let r=this.options;return ur(e,{timeout:(n=t.timeout)==null?r.timeout:n,get requestProxy(){var e;return(e=t.requestProxy)==null?r.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?r.networkSubscribe:e}})}},pr=new fr;function mr(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function hr(e,t){let n={},r=new Set(t);for(let t of Object.keys(e))r.has(t)||(n[t]=e[t]);return n}function gr(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}return t}var _r=typeof document<`u`?document.createElement(`a`):{href:``};function vr(e){return e.indexOf(`/`)===0||/^[0-9a-z]+\:/i.test(e)}function yr(e){if(typeof URL<`u`&&typeof location<`u`)return new URL(e,location.href).href;{_r.href=e;let t=_r.href;return _r.href=``,t}}function br(...e){let t=[];e=e.map(e=>(e==null?``:e).trim()).filter(e=>e.length>0&&!/^\/+$/.test(e));for(let n=0;n<e.length;n++){let r=n===0,i=n===e.length-1,a=e[n];r||(a=a.replace(/^\.\//,``).replace(/^\/+/,``)),i||(a=a.replace(/\/+$/,``)),t.push(a)}return t.join(`/`)}function xr(e,t=``){if((t[0]===`?`||t[0]===`&`)&&(t=t.slice(1)),!t)return e;let n=e.indexOf(`#`),r=``;return n>=0&&(r=e.slice(n),e=e.slice(0,n)),(e[e.length-1]===`?`||e[e.length-1]===`&`)&&(e=e.slice(0,-1)),e.indexOf(`?`)>=0?`${e}&${t}${r}`:`${e}?${t}${r}`}function Sr(e){var t;let n=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(e);if(!n)return e;let r=n[1]||``,i=e.slice(r.length+2),a=i.indexOf(`#`);a>=0&&(e.slice(a),i=e.slice(0,a));let o=i.indexOf(`?`);o>=0&&(e.slice(o),i=e.slice(0,o));let s=i.split(`/`),c=s.shift(),l=(t=s.pop())==null?``:t,u=[];for(let e of s)if(!(e===``||e===`.`)){if(e===`..`){u.pop();continue}u.push(e)}return r+`//`+c+`/`+u.join(`/`)+`/`+l}function Cr(e){let t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(e);if(t){let e=String(t[1]).trim().split(`.`).slice(1).reverse()[0];if(e)return`.`+e}return``}var wr=`data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAIAAUAmJaQAA3AA/vz0AAA=`,Tr=`data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAGhbWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAsaWxvYwAAAABEAAACAAEAAAABAAAB3gAAABkAAgAAAAEAAAHJAAAAFQAAAEJpaW5mAAAAAAACAAAAGmluZmUCAAAAAAEAAGF2MDFDb2xvcgAAAAAaaW5mZQIAAAAAAgAAYXYwMUFscGhhAAAAABppcmVmAAAAAAAAAA5hdXhsAAIAAQABAAAA12lwcnAAAACxaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIAAoAAAAAUaXNwZQAAAAAAAAACAAAAAgAAAA5waXhpAAAAAAEIAAAADGF2MUOBABwAAAAAOGF1eEMAAAAAdXJuOm1wZWc6bXBlZ0I6Y2ljcDpzeXN0ZW1zOmF1eGlsaWFyeTphbHBoYQAAAAAeaXBtYQAAAAAAAAACAAEEAQKDBAACBAUGhwgAAAA2bWRhdBIACgQYADLVMgsWQBhhIAQqrNj/+BIACgUYADLEoDIOFkADDDDCQAACDaqCCb4=`,Er=`data:image/heif;base64,AAAAGGZ0eXBoZWljAAAAAG1pZjFoZWljAAABL21ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAHBpY3QAAAAAAAAAAAAAAAAAAAAADnBpdG0AAAAAAAEAAAAjaWluZgAAAAAAAQAAABVpbmZlAgAAAAABAABodmMxAAAAAK9pcHJwAAAAkmlwY28AAAB2aHZjQwEBYAAAAAAAAAAAAADwAPz9+PgAACcDoAABAB5AAQwG//8BYAAAAwAAAwAAAwAAAwAAAwAAreTLgSChAAEAI0IBBwFgAAADAAADAAADAAADAAADAAChInJJlreTLySZNdggogABAAdEAcA98DMkAAAAFGlzcGUAAAAAAAAAAgAAAAIAAAAVaXBtYQAAAAAAAAABAAECgQIAAAAiaWxvYwAAAABEQAABAAEAAAAAAU8AAQAAAAAAAAAOAAAAFm1kYXQAAAAKJgGvLvkQwuWM4A==`;function Dr(e){return new Promise(t=>{if(typeof Image>`u`){t(!1);return}let n=new Image,r=setTimeout(()=>{n.onload=n.onerror=()=>{},clearTimeout(r),t(!1)},100);n.onload=n.onerror=()=>{n.onload=n.onerror=()=>{},clearTimeout(r),t(n.height===2)},n.src=e})}var Or=null;function kr(){return Or||(Or=Promise.all([Dr(wr),Dr(Tr),Dr(Er)]).then(e=>({webp:e[0],avif:e[1],heif:e[2]})))}var Ar,jr=!1,Mr=!1,Nr=!1;kr().then(e=>{jr=e.avif,Mr=e.webp,Nr=e.heif});var Pr=[`jpg`,`jpeg`,`png`,`heif`,`heic`,`webp`,`avif`];function Fr(e){return Pr.indexOf(e)>=0}var Ir={"vrlab-public.ljcdn.com":{type:`tencentCloud`,pano:[`vrlab-image1.ljcdn.com`,`vrlab-image2.ljcdn.com`],texture:[`vrlab-image3.ljcdn.com`],tile:[`vr-tile-1.realsee-cdn.cn`,`vr-tile-2.realsee-cdn.cn`],model:[`vr-model-1.realsee-cdn.cn`,`vr-model-2.realsee-cdn.cn`],default:[`vrlab-image4.ljcdn.com`]},"vr-public.realsee-cdn.cn":{type:`tencentCloud`,pano:[`vr-image-1.realsee-cdn.cn`,`vr-image-2.realsee-cdn.cn`],texture:[`vr-image-3.realsee-cdn.cn`],tile:[`vr-tile-1.realsee-cdn.cn`,`vr-tile-2.realsee-cdn.cn`],model:[`vr-model-1.realsee-cdn.cn`,`vr-model-2.realsee-cdn.cn`],default:[`vr-image-4.realsee-cdn.cn`]},"vr-public.rscdn.cn":{type:`tencentCloud`,pano:[`vr-image-1.rscdn.cn`,`vr-image-2.rscdn.cn`],texture:[`vr-image-3.rscdn.cn`],tile:[`vr-tile-1.rscdn.cn`,`vr-tile-2.rscdn.cn`],model:[`vr-model-1.rscdn.cn`,`vr-model-2.rscdn.cn`],default:[`vr-image-4.rscdn.cn`]},"mars-public.realsee-cdn.cn":{type:`aliyun`,pano:[`mars-image-1.realsee-cdn.cn`,`mars-image-2.realsee-cdn.cn`],texture:[`mars-image-3.realsee-cdn.cn`],tile:[`mars-tile-1.realsee-cdn.cn`,`mars-tile-2.realsee-cdn.cn`],model:[`mars-model-1.realsee-cdn.cn`,`mars-model-2.realsee-cdn.cn`],default:[`mars-image-4.realsee-cdn.cn`]},"global-public.realsee-cdn.com":{type:`tencentCloud`,pano:[`global-image-1.realsee-cdn.com`,`global-image-2.realsee-cdn.com`],texture:[`global-image-3.realsee-cdn.com`],tile:[`global-tile-1.realsee-cdn.com`,`global-tile-2.realsee-cdn.com`],model:[`global-model-1.realsee-cdn.com`,`global-model-2.realsee-cdn.com`],default:[`global-image-4.realsee-cdn.com`]},"earth-ga-public.realsee-cdn.cn":{type:`tencentCloud`,pano:[`earth-ga-image-1.realsee-cdn.cn`,`earth-ga-image-2.realsee-cdn.cn`],texture:[`earth-ga-image-3.realsee-cdn.cn`],tile:[`earth-ga-tile-1.realsee-cdn.cn`,`earth-ga-tile-2.realsee-cdn.cn`],model:[`earth-ga-model-1.realsee-cdn.cn`,`earth-ga-model-2.realsee-cdn.cn`],default:[`earth-ga-image-4.realsee-cdn.cn`]},"test-vr-public.realsee-cdn.com":{type:`tencentCloud`,pano:[`test-vr-image.realsee-cdn.com`,`test-vr-image.realsee-cdn.com`],texture:[`test-vr-image.realsee-cdn.com`],tile:[`test-vr-image.realsee-cdn.com`,`test-vr-image.realsee-cdn.com`],model:[`test-vr-image.realsee-cdn.com`,`test-vr-image.realsee-cdn.com`],default:[`test-vr-image.realsee-cdn.com`]},"test-vr-public.realsee-cdn.cn":{type:`tencentCloud`,pano:[`test-vr-image.realsee-cdn.cn`,`test-vr-image.realsee-cdn.cn`],texture:[`test-vr-image.realsee-cdn.cn`],tile:[`test-vr-image.realsee-cdn.cn`,`test-vr-image.realsee-cdn.cn`],model:[`test-vr-image.realsee-cdn.cn`,`test-vr-image.realsee-cdn.cn`],default:[`test-vr-image.realsee-cdn.cn`]}},Lr=/^https?\:\/\/?([^\/]+)/;function Rr(e){let t=e.match(Lr);return t===null?null:t[1]}function zr(e,t,n){var r,i;let a=(i=(r=t[n])==null?t[t.length-1]:r)==null?e:i;return e.replace(Lr,(e,t)=>e.slice(0,e.length-t.length)+a)}function Br(e,t,n){let[r,...i]=t.split(`.`);if(r===`texture`)return zr(e,n.texture,0);if(r===`pano`){let[t,r]=i;switch(r){case`front`:case`left`:case`up`:return zr(e,n.pano,0);case`down`:case`right`:case`back`:return zr(e,n.pano,1);default:break}}else if(r===`pano_tile`){let[t,r,a,o,s]=i,c=Math.pow(2,Number(a))*Number(o)+Number(s);if(!isNaN(c))return zr(e,n.tile,c%2)}else if(r===`model`){let[t]=i,r=Number(t);if(!isNaN(r))return zr(e,n.model,r%2)}return zr(e,n.default,0)}var Vr=(e,t)=>{let n=e.split(`?`)[0],r=n.split(`.`).pop();if(r===`jpeg`&&(r=`jpg`),r===`heif`&&(r=`heic`),r&&!Fr(r))return e;let i=[],{format:a,cut:o,quality:s,size:c,sharpen:l,forceUseExifOrientation:u}=t;if(a===`jpeg`&&(a=`jpg`),a===`heif`&&(a=`heic`),(!jr&&(a==null?r:a)===`avif`||!Mr&&(a==null?r:a)===`webp`||!Nr&&(a==null?r:a)===`heic`)&&(a=`jpg`),a!==void 0&&a!==r&&i.push(`format/${a}`),o!==void 0&&i.push(`cut/${o[2]}x${o[3]}x${o[0]}x${o[1]}`),s!==void 0){let e=a==null?r:a;e&&[`jpg`,`webp`,`heic`,`avif`].indexOf(e)>=0&&i.push(`quality/${s}`)}if(c!==void 0){let t=e.match(/\/cube_(\d+)\//);(t?Number(t[1]):NaN)!==Number(c)&&i.push(`thumbnail/${c}x`)}l!==void 0&&i.push(`sharpen/${l}`),u===!0&&i.push(`auto-orient`);let d=``;return i.length&&(d=`?imageMogr2/`+i.join(`/`)),n+d},Hr=(e,t)=>{let n=e.split(`?`)[0],r=n.split(`.`).pop();if(r===`jpeg`&&(r=`jpg`),r===`heif`&&(r=`heic`),r&&!Fr(r))return e;let i=[],{format:a,cut:o,quality:s,size:c,sharpen:l}=t;if(a===`jpeg`&&(a=`jpg`),a===`heif`&&(a=`heic`),(!jr&&(a==null?r:a)===`avif`||!Mr&&(a==null?r:a)===`webp`||!Nr&&(a==null?r:a)===`heic`)&&(a=`jpg`),a!==void 0&&a!==r&&i.push(`format,${a}`),o!==void 0){let[e,t,n,r]=o;i.push(`crop,x_${e},y_${t},w_${n},h_${r},g_nw`)}if(s!==void 0&&s!==100){let e=a==null?r:a;e&&[`jpg`,`webp`,`heic`,`avif`].indexOf(e)>=0&&i.push(`quality,Q_${s}`)}c&&c!==2048&&i.push(`resize,w_${c}`),l!==void 0&&i.push(`sharpen,${l}`);let u=``;return i.length&&(u=`?x-oss-process=image/`+i.join(`/`)),n+u},Ur=9007199254740991;function Wr(e){let t=Math.round(e);return Math.abs(t-e)<.001?t:Math.floor(e)}function Gr(e){return e=Object.assign({},e),e.size!==void 0&&(e.size=Wr(W(e.size,0,Ur))),e.quality!==void 0&&(e.quality=Wr(W(e.quality,0,100))),e.cut!==void 0&&(e.cut=[Wr(W(e.cut[0],0,Ur)),Wr(W(e.cut[1],0,Ur)),Wr(W(e.cut[2],0,Ur)),Wr(W(e.cut[3],0,Ur))]),e.sharpen!==void 0&&(e.sharpen=Wr(W(e.sharpen,0,Ur))),e}function Kr(e,t){let n=Object.assign(Object.assign({},Ir),t.mappings),r=Rr(e);if(r===null)return e;t=Gr(t);let i=n[r];return i?(e=Br(e,t.key,i),/\.basis(\?|$)/.test(e)&&(e=e.replace(/\.basis(\?|$)/,`.jpg$1`)),i.type===`tencentCloud`?Vr(e,t):i.type===`aliyun`?Hr(e,t):e):e}function qr(e,t=Kr,n){let r=t(e,n);if(r===e&&n.cut)throw Error(`ImageURL: cut option not applied.`);return r}var Jr=/\/cube_(\d+)\//;function Yr(e){let t=e.match(Jr);return t?Number(t[1]):null}function Xr(e,t){return e.replace(Jr,`/cube_${t}/`)}var Zr=(Ar=Math.log2)==null?(e=>Math.log(e)*Math.LOG2E):Ar;function Qr(e){return Math.floor(Math.max(Zr(e/512),0))}var $r=(()=>{let e=U();return{requestAnimationFrame(t){let n=U(),r=W(16+(n-e),16,33),i=setTimeout(function(){t(Kt(n+r))},r);return e=n+r,i},cancelAnimationFrame:e=>clearTimeout(e)}})(),ei=typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`?{requestAnimationFrame:e=>requestAnimationFrame(e),cancelAnimationFrame:e=>cancelAnimationFrame(e)}:$r,ti=5,ni=16,ri=class e{static get shared(){return this.sharedInstance||(this.sharedInstance=new e),this.sharedInstance}static getFrameTime(){return ni}constructor(){this.loopType=`raf`,this.frames=[],this.isAnimating=!1,this.context=null;let e=U();this.loop=(...t)=>{if(this.isAnimating===!1)return;let n=U(),r=Math.max(n-e,0);e=n,ni=r;let i=this.frames.slice();for(let e=0;e<i.length;e++){let a=i[e];if(a.delay>0){--a.delay;continue}try{a.callback(n,r,...t)}catch(e){console.error(e)}a.calls++}for(let e=this.frames.length-1;e>=0;e--){let t=this.frames[e];t.once&&t.calls>0&&this.frames.splice(e,1)}this.requestId=this.requestAnimationFrame(this.loop)},this.start()}start(){this.isAnimating!==!0&&(this.isAnimating=!0,this.requestId=this.requestAnimationFrame(this.loop))}stop(){this.isAnimating=!1,this.cancelAnimationFrame(this.requestId)}setContext(e){e!==this.context&&(this.stop(),this.context=e,this.start())}getContext(){return this.context}setLoopType(e){e!==this.loopType&&(this.stop(),this.loopType=e,this.start())}getLoopType(){return this.loopType}requestAnimationFrame(e){let t;if(this.context?t=this.context:this.loopType===`raf`?t=ei:this.loopType===`sto`&&(t=$r),t)return t.requestAnimationFrame(e)}cancelAnimationFrame(e){let t;this.context?t=this.context:this.loopType===`raf`?t=ei:this.loopType===`sto`&&(t=$r),t&&t.cancelAnimationFrame(e)}remove(e){let t=this.frames.indexOf(e);t>=0&&this.frames.splice(t,1)}add(e,t=!1,n=0,r=ti){let i={callback:e,once:t,delay:n,order:r,calls:0},a=this.frames.length;for(;--a>=0;)if(this.frames[a].order<=r){this.frames.splice(a+1,0,i);break}return a<0&&this.frames.unshift(i),()=>this.remove(i)}clear(){this.frames.length=0}},ii=typeof createImageBitmap<`u`&&typeof ImageBitmap<`u`,ai=!1;function oi(e){ai=e}function si(){return ai===!1?!1:ii}function ci(e={}){let t=e.onClose;return Object.assign(document.createElementNS(`http://www.w3.org/1999/xhtml`,`img`),{crossOrigin:``,close(){t&&t.call(this),this.onerror=this.onload=this.close=q,this.removeAttribute(`src`),t=void 0}})}function li(e){if(si())return createImageBitmap(e);{let t=URL.createObjectURL(e),n=function(){this.src===t&&URL.revokeObjectURL(t)};return new Promise((e,r)=>{let i=ci({onClose:n});i.onload=()=>{i.src===t&&URL.revokeObjectURL(t),i.onload=i.onerror=q,ri.shared.add(()=>{e(i)},!0)},i.onerror=()=>{let e=i.src;i.onload=i.onerror=q,i.close(),r(Error(`image load error: ${e}`))},i.decoding=`async`,i.src=t})}}var ui=[];function di(e,t){let n=ui.pop();if(n)return n.width=e,n.height=t,n;let r=Object.assign(document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`),{close:()=>{r.close=q,ui.push(r)}});return r}function fi(e,t){if(t&&(e.width>t.width||e.height>t.height)){let n=di(Math.min(e.width,t.width),Math.min(e.height,t.height)),r=n.getContext(`2d`);r.clearRect(0,0,n.width,n.height),r.drawImage(e,0,0,n.width,n.height),e.close();let i=new c.Texture(n);i.needsUpdate=!0,i.flipY=!0;let a=i.dispose;return i.dispose=function(){n.close(),a.call(i),i.dispose=a},i}else{let t=new c.Texture(e);t.needsUpdate=!0,typeof ImageBitmap<`u`&&e instanceof ImageBitmap?t.flipY=!1:t.flipY=!0,t.flipY===!1&&(t.repeat.y*=-1,t.offset.y+=1,t.updateMatrix());let n=t.dispose;return t.dispose=function(){this.image&&this.image.close(),n.call(t),t.dispose=n},t}}function pi(e){let t=new c.CubeTexture(e);t.needsUpdate=!0,t.flipY=!1;let n=t.dispose;return t.dispose=function(){if(Array.isArray(this.images))for(let e of this.images)e.close();n.call(t),t.dispose=n},t}var mi=[`right`,`left`,`up`,`down`,`front`,`back`],hi=class{loadTexture(e,t,n=q,r=q,i=q,a){var o,s,l,u,d,f,p;let m={};if(t.flipY!==void 0&&(m.flipY=t.flipY),t.format!==void 0)m.format=t.format;else{let t=Cr(e);(t===`.jpg`||t===`.jpeg`)&&(m.format=c.RGBFormat)}t.encoding!==void 0&&(m.encoding=t.encoding),m.generateMipmaps=(o=t.generateMipmaps)==null?!1:o,m.minFilter=(s=t.minFilter)==null?c.LinearFilter:s,m.magFilter=(l=t.magFilter)==null?c.LinearFilter:l;let h=(d=(u=t.imageURL)==null?void 0:u.options)==null?{key:`unknown`}:d;if(e=qr(e,(f=t.imageURL)==null?void 0:f.transform,h),(p=t.viaAjax)==null?si:p)return t.fetcher.ajax(e,{timeout:t.timeout,responseType:`blob`},void 0,void 0,i).then(e=>li(e.body)).then(e=>fi(e,t.maxSize)).then(e=>(Object.assign(e,m),e)).then(e=>{let t={meta:null,body:e};return n(t),t}).catch(e=>(r(e),Promise.reject(e)));{let a=null,o;return Promise.resolve().then(()=>ci()).then(n=>(o=n,t.fetcher.loadImage(e,{timeout:t.timeout},void 0,void 0,i,n))).then(e=>(a=e.meta,fi(e.body,t.maxSize))).then(e=>(Object.assign(e,m),e)).then(e=>{let t={meta:a,body:e};return n(t),t}).catch(e=>(o&&o.close(),r(e),Promise.reject(e)))}}loadCubeTexture(e,t,n=q,r=q,i=q,a){var o,s,l,u,d,f,p;let m={};if(t.format!==void 0)m.format=t.format;else{let t=!0;for(let n of mi){let r=Cr(e[n]);if(r!==`.jpg`&&r!==`.jpeg`){t=!1;break}}t&&(m.format=c.RGBFormat)}m.generateMipmaps=(o=t.generateMipmaps)==null?!1:o,m.minFilter=(s=t.minFilter)==null?c.LinearFilter:s,m.magFilter=(l=t.magFilter)==null?c.LinearFilter:l;let h=[e[mi[0]],e[mi[1]],e[mi[2]],e[mi[3]],e[mi[4]],e[mi[5]]],g=[],_=[0,0,0,0,0,0],v=[];for(let e=0;e<6;e++){let n=(d=(u=t.imageURL)==null?void 0:u.options)==null?{key:`unknown`}:d,r=qr(h[e],(f=t.imageURL)==null?void 0:f.transform,Object.assign(Object.assign({},n),{key:n.key+`.`+mi[e]})),a=t=>{_[e]=t,i(_.reduce((e,t)=>e+t,0)/6)};if((p=t.viaAjax)!=null&&p){let n=t.fetcher.ajax(r,{timeout:t.timeout,responseType:`blob`},void 0,void 0,a).then(t=>(v[e]=t.meta,li(t.body)));g.push(n)}else{let n,i=Promise.resolve().then(()=>ci()).then(e=>(n=e,t.fetcher.loadImage(r,{timeout:t.timeout},void 0,void 0,a,e))).then(t=>(v[e]=t.meta,t.body)).catch(e=>(n&&n.close(),Promise.reject(e)));g.push(i)}}return Promise.all(g).then(e=>pi(e)).then(e=>(Object.assign(e,Object.assign({encoding:c.sRGBEncoding},m)),e)).then(e=>{let t={body:e,meta:v};return n(t),t}).catch(e=>{for(let e of g)e.then(e=>e.close()).catch(q);return r(e),Promise.reject(e)})}},gi=l.Reader,_i=l.util,vi=l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto`]||(l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto`]={}),yi=vi.Model=(()=>{function e(e){if(this.chunks=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.chunks=_i.emptyArray,e.prototype.createAt=_i.Long?_i.Long.fromBits(0,0,!0):0,e.prototype.description=``,e.decode=function(e,t,n){e instanceof gi||(e=gi.create(e));let r=t===void 0?e.len:e.pos+t,i=new vi.Model;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.chunks&&i.chunks.length||(i.chunks=[]),i.chunks.push(vi.Chunk.decode(e,e.uint32()));break;case 2:i.createAt=e.uint64();break;case 3:i.description=e.string();break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Model`},e})();vi.Chunk=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.vertices=null,e.prototype.faces=null,e.prototype.name=``,e.prototype.texture=``,e.decode=function(e,t,n){e instanceof gi||(e=gi.create(e));let r=t===void 0?e.len:e.pos+t,i=new vi.Chunk;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.vertices=vi.Vertices.decode(e,e.uint32());break;case 2:i.faces=vi.Faces.decode(e,e.uint32());break;case 3:i.name=e.string();break;case 4:i.texture=e.string();break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`vertices`))throw _i.ProtocolError(`missing required 'vertices'`,{instance:i});if(!i.hasOwnProperty(`faces`))throw _i.ProtocolError(`missing required 'faces'`,{instance:i});if(!i.hasOwnProperty(`name`))throw _i.ProtocolError(`missing required 'name'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Chunk`},e})(),vi.Vertices=(()=>{function e(e){if(this.xyz=[],this.uvs=[],this.marks=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.xyz=_i.emptyArray,e.prototype.uvs=_i.emptyArray,e.prototype.marks=_i.emptyArray,e.decode=function(e,t,n){e instanceof gi||(e=gi.create(e));let r=t===void 0?e.len:e.pos+t,i=new vi.Vertices;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.xyz&&i.xyz.length||(i.xyz=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.xyz.push(e.float())}else i.xyz.push(e.float());break;case 2:if(i.uvs&&i.uvs.length||(i.uvs=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.uvs.push(e.float())}else i.uvs.push(e.float());break;case 3:if(i.marks&&i.marks.length||(i.marks=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.marks.push(e.int32())}else i.marks.push(e.int32());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Vertices`},e})(),vi.Faces=(()=>{function e(e){if(this.indices=[],this.normals=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.indices=_i.emptyArray,e.prototype.normals=_i.emptyArray,e.decode=function(e,t,n){e instanceof gi||(e=gi.create(e));let r=t===void 0?e.len:e.pos+t,i=new vi.Faces;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.indices&&i.indices.length||(i.indices=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.indices.push(e.uint32())}else i.indices.push(e.uint32());break;case 2:if(i.normals&&i.normals.length||(i.normals=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.normals.push(e.float())}else i.normals.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Faces`},e})(),vi.VertexMark=(()=>{let e={},t=Object.create(e);return t[e[0]=`VERTEX_MARK_UNSPECIFIED`]=0,t[e[1]=`VERTEX_MARK_ROOF`]=1,t})();function bi(e){return isNaN(e)||!isFinite(e)?0:e}function xi(e){let t=0;if(e instanceof c.BufferGeometry){for(let n in e.attributes){let r=e.getAttribute(n),i=4;`BYTES_PER_ELEMENT`in r.array&&typeof r.array.BYTES_PER_ELEMENT==`number`&&(i=r.array.BYTES_PER_ELEMENT),t+=bi(r.count*r.itemSize*i)}let n=e.getIndex();if(n){let e=4;`BYTES_PER_ELEMENT`in n.array&&typeof n.array.BYTES_PER_ELEMENT==`number`&&(e=n.array.BYTES_PER_ELEMENT),t+=bi(n.count*n.itemSize*e)}}else e instanceof c.Geometry&&(t+=bi(e.faces.length*3*3*4),t+=bi(e.faceVertexUvs.length*3*2*4));return t}function Si(e){let t=[e.positions,e.rotations,e.scales,e.colors,e.sh1,e.sh2,e.sh3],n=0;for(let e of t){if(!e)continue;let t=4;`BYTES_PER_ELEMENT`in e&&typeof e.BYTES_PER_ELEMENT==`number`&&(t=e.BYTES_PER_ELEMENT);let r=e.length*t;isNaN(r)||!isFinite(r)||(n+=r)}return n}function J(e,t,n){return function(r,i,a){return((r+e-1)/e|0)*((i+t-1)/t|0)*n*a}}function Ci(e,t,n){return function(r,i,a){return(Math.max(r,e)*Math.max(i,t)/n|0)*a}}var wi=new Map([[c.RGB_S3TC_DXT1_Format,J(4,4,8)],[c.RGBA_S3TC_DXT1_Format,J(4,4,8)],[c.RGBA_S3TC_DXT3_Format,J(4,4,16)],[c.RGBA_S3TC_DXT5_Format,J(4,4,16)],[c.RGB_ETC1_Format,J(4,4,8)],[c.RGB_PVRTC_4BPPV1_Format,Ci(8,8,2)],[c.RGBA_PVRTC_4BPPV1_Format,Ci(8,8,2)],[c.RGB_PVRTC_2BPPV1_Format,Ci(16,8,4)],[c.RGBA_PVRTC_2BPPV1_Format,Ci(16,8,4)],[c.RGB_ETC2_Format,J(4,4,8)],[c.RGBA_ETC2_EAC_Format,J(4,4,16)],[c.RGBA_ASTC_4x4_Format,J(4,4,16)],[c.SRGB8_ALPHA8_ASTC_4x4_Format,J(4,4,16)],[c.RGBA_ASTC_5x4_Format,J(5,4,16)],[c.SRGB8_ALPHA8_ASTC_5x4_Format,J(5,4,16)],[c.RGBA_ASTC_5x5_Format,J(5,5,16)],[c.SRGB8_ALPHA8_ASTC_5x5_Format,J(5,5,16)],[c.RGBA_ASTC_6x5_Format,J(6,5,16)],[c.SRGB8_ALPHA8_ASTC_6x5_Format,J(6,5,16)],[c.RGBA_ASTC_6x6_Format,J(6,6,16)],[c.SRGB8_ALPHA8_ASTC_6x6_Format,J(6,6,16)],[c.RGBA_ASTC_8x5_Format,J(8,5,16)],[c.SRGB8_ALPHA8_ASTC_8x5_Format,J(8,5,16)],[c.RGBA_ASTC_8x6_Format,J(8,6,16)],[c.SRGB8_ALPHA8_ASTC_8x6_Format,J(8,6,16)],[c.RGBA_ASTC_8x8_Format,J(8,8,16)],[c.SRGB8_ALPHA8_ASTC_8x8_Format,J(8,8,16)],[c.RGBA_ASTC_10x5_Format,J(10,5,16)],[c.SRGB8_ALPHA8_ASTC_10x5_Format,J(10,5,16)],[c.RGBA_ASTC_10x6_Format,J(10,6,16)],[c.SRGB8_ALPHA8_ASTC_10x6_Format,J(10,6,16)],[c.RGBA_ASTC_10x8_Format,J(10,8,16)],[c.SRGB8_ALPHA8_ASTC_10x8_Format,J(10,8,16)],[c.RGBA_ASTC_10x10_Format,J(10,10,16)],[c.SRGB8_ALPHA8_ASTC_10x10_Format,J(10,10,16)],[c.RGBA_ASTC_12x10_Format,J(12,10,16)],[c.SRGB8_ALPHA8_ASTC_12x10_Format,J(12,10,16)],[c.RGBA_ASTC_12x12_Format,J(12,12,16)],[c.SRGB8_ALPHA8_ASTC_12x12_Format,J(12,12,16)],[c.RGBA_BPTC_Format,J(4,4,16)]]);function Ti(e){let t=0,n=1;(e.generateMipmaps===!0||e.mipmaps&&e.mipmaps.length>1)&&(n=1.33);let r=e instanceof c.CompressedTexture?wi.get(e.format):void 0,i=[].concat(e.image);for(let e of i)if(e)if(e instanceof c.Texture)t+=Ti(e);else{let{width:i=1,height:a=1,depth:o=1}=e;r?t+=bi(r(i,a,o)*n):t+=bi(i*a*o*4*n)}return t}var Ei=new Set,Di=`map.alphaMap.bumpMap.normalMap.displacementMap.emissiveMap.specularMap.envMap.flipEnvMap.lightMap.aoMap.gradientMap.metalnessMap.roughnessMap.sheenColorMap.sheenRoughnessMap.clearcoatMap.clearcoatRoughnessMap.clearcoatNormalMap.iridescenceMap.iridescenceThicknessMap.transmissionMap.thicknessMap.anisotropyMap.specularColorMap.specularIntensityMap`.split(`.`);function Oi(e){let t=0;if(Ei.clear(),e instanceof c.ShaderMaterial)for(let n in e.uniforms){let r=e.uniforms[n],i=r&&r.value&&r.value instanceof c.Texture?r.value:void 0;i instanceof c.Texture&&(Ei.has(i)||(t=Ti(i),Ei.add(i)))}else for(let n of Di){let r=e[n];r instanceof c.Texture&&(Ei.has(r)||(t=Ti(r),Ei.add(r)))}return Ei.clear(),t}var ki=new Set;function Ai(e){let t=0;return ki.clear(),e.traverse(e=>{if(e instanceof Yn&&(t+=Si(e)),e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points){let n=e.geometry;(n instanceof c.BufferGeometry||n instanceof c.Geometry)&&(ki.has(n)||(t+=xi(n),ki.add(n)));let r=[].concat(e.material);for(let e of r)e instanceof c.Material&&(ki.has(e)||(t+=Oi(e),ki.add(e)))}}),ki.clear(),t}function ji(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t+1).replace(/\/(model)(\/|$)/,(e,t,n)=>`/materials`+n):``}function Mi(e,t={}){var n,r,i,a,o,s,l;let u=(n=t.upAxis)==null?`Z`:n,d=(r=t.light)==null?!1:r,f=(i=t.fetcher)==null?pr:i,p=(a=t.onDownloadProgress)==null?q:a,m=(o=t.textureBaseUri)==null?ji(e):o,h=t.textureBaseUri===void 0?[]:((s=t.textureArray)==null?[]:s).slice(),g=Bi((l=t.textureOptions)==null?{}:l,h.length),_=new Map;for(let e of h){let t=vr(e)?e:br(m,e);_.set(t,Ri(t,g,f))}let v={byteLength:0};return Promise.resolve().then(()=>f.ajax(e,{responseType:`arraybuffer`},void 0,void 0,p)).then(e=>{v.byteLength=e.body.byteLength;let t=new Uint8Array(e.body);return yi.decode(t)}).then(e=>zi(e,d,m,h,g,_,f)).then(t=>{_.clear();let n=new c.Group;n.name=e;for(let e of t.objects)n.add(e);return u===`Y`&&n.applyMatrix4(Zn),{type:`pbm`,modelUpAxis:`Z`,upAxis:u,uri:e,byteLength:v.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}function Ni(e){let t=e.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function Pi(e){let t=e.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function Fi(e){let t=e.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}function Ii(e){let t=Ni(e.name),n=Pi(e.name),r=Fi(e.name);return t*1e6+n*1e3+r}function Li(e){var t,n,r;let i=typeof e.createAt==`number`?e.createAt:0,a=(t=e.description)==null?``:t,o=[],s=!0,c=!0;for(let t of e.chunks)if(!t.vertices.marks||t.vertices.marks.length===0){c=!1;break}for(let t of e.chunks)if(!t.faces.normals||t.faces.normals.length===0){s=!1;break}let l=e.chunks.sort((e,t)=>Ii(e)-Ii(t)),u=[];for(let e of l){let t=Ni(e.name);u[t]||(u[t]=[]),u[t].push(e)}for(let e=0;e<u.length;e++){let t=u[e];if(t)if(s){let r=0;for(let e=0;e<t.length;e++){let n=t[e];r+=n.faces.indices.length}let s=new Float32Array(r*3),l=new Float32Array(r*2),u=new Float32Array(r*3),d=c?new Float32Array(r):void 0,f=[],p=[1/0,1/0,1/0,-1/0,-1/0,-1/0],m=0;for(let e=0;e<t.length;e++){let r=[1/0,1/0,1/0,-1/0,-1/0,-1/0],i=t[e],a=i.vertices.xyz,o=i.vertices.uvs,c=i.faces.indices,h=i.faces.normals,g=i.vertices.marks,_=c.length;for(let e=0;e<_;e++){let t=c[e],n=s[m*3+e*3]=a[t*3],i=s[m*3+e*3+1]=a[t*3+1],f=s[m*3+e*3+2]=a[t*3+2];d&&(d[m+e]=g[t]),l[m*2+e*2]=o[t*2],l[m*2+e*2+1]=o[t*2+1];let p=Math.floor(e/3)*3;u[m*3+e*3]=h[p],u[m*3+e*3+1]=h[p+1],u[m*3+e*3+2]=h[p+2],n<r[0]&&(r[0]=n),i<r[1]&&(r[1]=i),f<r[2]&&(r[2]=f),n>r[3]&&(r[3]=n),i>r[4]&&(r[4]=i),f>r[5]&&(r[5]=f)}r[0]<p[0]&&(p[0]=r[0]),r[1]<p[1]&&(p[1]=r[1]),r[2]<p[2]&&(p[2]=r[2]),r[3]>p[3]&&(p[3]=r[3]),r[4]>p[4]&&(p[4]=r[4]),r[5]>p[5]&&(p[5]=r[5]),f.push({materialIndex:e,name:i.name,chunkName:Pi(i.name),start:m,count:i.faces.indices.length,texture:(n=i.texture)==null?void 0:n}),m+=_}let h={createAt:i,description:a,vertices:s,uvs:l,normals:u,masks:d,indices:null,floorIndex:e,groups:f,extents:p};o.push(h)}else{let n=0,s=0;for(let e=0;e<t.length;e++){let r=t[e];s+=r.vertices.xyz.length/3,n+=r.faces.indices.length}let l=new Float32Array(s*3),u=new Float32Array(s*2),d=new Float32Array(s),f=new Uint32Array(n),p=c?new Float32Array(n):void 0,m=[],h=[1/0,1/0,1/0,-1/0,-1/0,-1/0],g=0,_=0;for(let n=0;n<t.length;n++){let i=[1/0,1/0,1/0,-1/0,-1/0,-1/0],a=t[n],o=a.vertices.xyz,s=a.vertices.marks,c=a.vertices.uvs,v=a.faces.indices,y=o.length/3,b=v.length;for(let t=0;t<y;t++){let n=l[_*3+t*3]=o[t*3],r=l[_*3+t*3+1]=o[t*3+1],a=l[_*3+t*3+2]=o[t*3+2];p&&(p[_+t]=s[t]),u[_*2+t*2]=c[t*2],u[_*2+t*2+1]=c[t*2+1],d[_+t]=e,n<i[0]&&(i[0]=n),r<i[1]&&(i[1]=r),a<i[2]&&(i[2]=a),n>i[3]&&(i[3]=n),r>i[4]&&(i[4]=r),a>i[5]&&(i[5]=a)}i[0]<h[0]&&(h[0]=i[0]),i[1]<h[1]&&(h[1]=i[1]),i[2]<h[2]&&(h[2]=i[2]),i[3]>h[3]&&(h[3]=i[3]),i[4]>h[4]&&(h[4]=i[4]),i[5]>h[5]&&(h[5]=i[5]);for(let e=0;e<b;e++)f[g+e]=_+v[e];m.push({materialIndex:n,name:a.name,chunkName:Pi(a.name),start:g,count:a.faces.indices.length,texture:(r=a.texture)==null?void 0:r}),_+=y,g+=b}let v={createAt:i,description:a,vertices:l,uvs:u,normals:void 0,masks:p,indices:f,floorIndex:e,groups:m,extents:h};o.push(v)}}return o}function Ri(e,t,n){let r=Object.assign({key:`texture.pbm`},mr(t,[`format`,`quality`,`size`,`sharpen`,`forceUseExifOrientation`,`mappings`]));return new hi().loadTexture(e,{imageURL:{transform:t.transform,options:r},encoding:c.sRGBEncoding,wrapS:c.ClampToEdgeWrapping,wrapT:c.ClampToEdgeWrapping,minFilter:c.LinearFilter,maxSize:typeof r.size==`number`?new c.Vector2(r.size,r.size):void 0,fetcher:n}).then(e=>{let t=e.body;return t.needsUpdate=!0,t})}function zi(e,t,n,r,i,a,o){let s=Li(e),l=0,u=``,d=[],f={},p=new Set,m=0;for(let{createAt:e,description:i,vertices:a,masks:o,uvs:h,normals:g,indices:_,floorIndex:v,groups:y,extents:b}of s){let s=new c.Box3;s.min.x=b[0],s.min.y=b[1],s.min.z=b[2],s.max.x=b[3],s.max.y=b[4],s.max.z=b[5];let x=new c.BufferGeometry;x.setAttribute(`position`,new c.BufferAttribute(a,3)),x.setAttribute(`uv`,new c.BufferAttribute(h,2)),g&&x.setAttribute(`normal`,new c.BufferAttribute(g,3)),o&&x.setAttribute(`_feature_id_rsmask`,new c.BufferAttribute(o,1)),_&&x.setIndex(new c.BufferAttribute(_,1)),x.boundingBox=s,x.boundingSphere=s.getBoundingSphere(new c.Sphere);for(let e of y)x.addGroup(e.start,e.count,e.materialIndex);p.add(x);let S=[];for(let e of y){let i;if(e.texture){if(i=e.texture,r.length>0&&r.indexOf(e.texture)===-1){for(let t of r)if((vr(t)?t:br(n,t)).slice(e.texture.length*-1)===e.texture){i=t;break}console.warn(`At3d/Pbm texture not matched. Use ends-guessing mode. ${e.texture} -> ${i}`)}vr(i)||(i=br(n,i))}let a=new vn(t?`phong`:`basic`);a.floorIndex=v,x.attributes.normal===void 0&&(a.flatShading=!0),x.attributes._feature_id_rsmask&&(a.defines.USE_VERTEX_MARK=!0),S.push(a),i?(m++,f[i]?f[i].push(a):f[i]=[a]):a.color=new c.Color(16777215),p.add(a)}let C=new yn(x,S);C.name=`model_floor_`+v,C.userData.createAt=e,C.userData.description=i,C.matrix.compose(C.position,C.quaternion,C.scale),C.matrixAutoUpdate=!1,C.frustumCulled=!1,l=e,u=i,d.push(C)}i=Bi(i,m);let h=[];for(let e of Object.keys(f)){let t;a&&(t=a.get(e)),t||(t=Ri(e,i,o),a&&a.set(e,t)),h.push(t.then(t=>{for(let n of f[e])n.map&&(p.delete(n.map),n.map.dispose()),n.map=t,p.add(t);return t}).catch(()=>{for(let t of f[e])t.map&&(p.delete(t.map),t.map.dispose()),t.map=null,t.color=new c.Color(16777215);return null}))}return Promise.all(h).then(e=>{let t=e.filter(e=>e instanceof c.Texture);return{createAt:l,description:u,objects:d,textures:t,dispose:()=>{p.forEach(e=>{e.dispose()}),p.clear()}}})}function Bi(e,t){return e=Object.assign({},e),e.autoResize!==!1&&(t>96?e.size=Math.min(e.size||1/0,100):t>48?e.size=Math.min(e.size||1/0,200):t>24?e.size=Math.min(e.size||1/0,400):t>22?e.size=Math.min(e.size||1/0,800):t>5&&(e.size=Math.min(e.size||1/0,1024))),e}function Vi(){var e={};return e.OutWindow=function(){this._windowSize=0},e.OutWindow.prototype.create=function(e){(!this._buffer||this._windowSize!==e)&&(this._buffer=[]),this._windowSize=e,this._pos=0,this._streamPos=0},e.OutWindow.prototype.flush=function(){var e=this._pos-this._streamPos;if(e!==0){for(;e--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},e.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},e.OutWindow.prototype.setStream=function(e){this.releaseStream(),this._stream=e},e.OutWindow.prototype.init=function(e){e||(this._streamPos=0,this._pos=0)},e.OutWindow.prototype.copyBlock=function(e,t){var n=this._pos-e-1;for(n<0&&(n+=this._windowSize);t--;)n>=this._windowSize&&(n=0),this._buffer[this._pos++]=this._buffer[n++],this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.putByte=function(e){this._buffer[this._pos++]=e,this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.getByte=function(e){var t=this._pos-e-1;return t<0&&(t+=this._windowSize),this._buffer[t]},e.RangeDecoder=function(){},e.RangeDecoder.prototype.setStream=function(e){this._stream=e},e.RangeDecoder.prototype.releaseStream=function(){this._stream=null},e.RangeDecoder.prototype.init=function(){var e=5;for(this._code=0,this._range=-1;e--;)this._code=this._code<<8|this._stream.readByte()},e.RangeDecoder.prototype.decodeDirectBits=function(e){for(var t=0,n=e,r;n--;)this._range>>>=1,r=this._code-this._range>>>31,this._code-=this._range&r-1,t=t<<1|1-r,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return t},e.RangeDecoder.prototype.decodeBit=function(e,t){var n=e[t],r=(this._range>>>11)*n;return(this._code^2147483648)<(r^2147483648)?(this._range=r,e[t]+=2048-n>>>5,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=r,this._code-=r,e[t]-=n>>>5,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},e.initBitModels=function(e,t){for(;t--;)e[t]=1024},e.BitTreeDecoder=function(e){this._models=[],this._numBitLevels=e},e.BitTreeDecoder.prototype.init=function(){e.initBitModels(this._models,1<<this._numBitLevels)},e.BitTreeDecoder.prototype.decode=function(e){for(var t=1,n=this._numBitLevels;n--;)t=t<<1|e.decodeBit(this._models,t);return t-(1<<this._numBitLevels)},e.BitTreeDecoder.prototype.reverseDecode=function(e){for(var t=1,n=0,r=0,i;r<this._numBitLevels;++r)i=e.decodeBit(this._models,t),t=t<<1|i,n|=i<<r;return n},e.reverseDecode2=function(e,t,n,r){for(var i=1,a=0,o=0,s;o<r;++o)s=n.decodeBit(e,t+i),i=i<<1|s,a|=s<<o;return a},e.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new e.BitTreeDecoder(8),this._numPosStates=0},e.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new e.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new e.BitTreeDecoder(3)},e.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(e.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},e.LenDecoder.prototype.decode=function(e,t){return e.decodeBit(this._choice,0)===0?this._lowCoder[t].decode(e):e.decodeBit(this._choice,1)===0?8+this._midCoder[t].decode(e):16+this._highCoder.decode(e)},e.Decoder2=function(){this._decoders=[]},e.Decoder2.prototype.init=function(){e.initBitModels(this._decoders,768)},e.Decoder2.prototype.decodeNormal=function(e){var t=1;do t=t<<1|e.decodeBit(this._decoders,t);while(t<256);return t&255},e.Decoder2.prototype.decodeWithMatchByte=function(e,t){var n=1,r,i;do if(r=t>>7&1,t<<=1,i=e.decodeBit(this._decoders,(1+r<<8)+n),n=n<<1|i,r!==i){for(;n<256;)n=n<<1|e.decodeBit(this._decoders,n);break}while(n<256);return n&255},e.LiteralDecoder=function(){},e.LiteralDecoder.prototype.create=function(t,n){var r;if(!(this._coders&&this._numPrevBits===n&&this._numPosBits===t))for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=n,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=new e.Decoder2},e.LiteralDecoder.prototype.init=function(){for(var e=1<<this._numPrevBits+this._numPosBits;e--;)this._coders[e].init()},e.LiteralDecoder.prototype.getDecoder=function(e,t){return this._coders[((e&this._posMask)<<this._numPrevBits)+((t&255)>>>8-this._numPrevBits)]},e.Decoder=function(){this._outWindow=new e.OutWindow,this._rangeDecoder=new e.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new e.BitTreeDecoder(4),this._lenDecoder=new e.LenDecoder,this._repLenDecoder=new e.LenDecoder,this._literalDecoder=new e.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new e.BitTreeDecoder(6),this._posSlotDecoder[1]=new e.BitTreeDecoder(6),this._posSlotDecoder[2]=new e.BitTreeDecoder(6),this._posSlotDecoder[3]=new e.BitTreeDecoder(6)},e.Decoder.prototype.setDictionarySize=function(e){return e<0?!1:(this._dictionarySize!==e&&(this._dictionarySize=e,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},e.Decoder.prototype.setLcLpPb=function(e,t,n){var r=1<<n;return e>8||t>4||n>4?!1:(this._literalDecoder.create(t,e),this._lenDecoder.create(r),this._repLenDecoder.create(r),this._posStateMask=r-1,!0)},e.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),e.initBitModels(this._isMatchDecoders,192),e.initBitModels(this._isRep0LongDecoders,192),e.initBitModels(this._isRepDecoders,12),e.initBitModels(this._isRepG0Decoders,12),e.initBitModels(this._isRepG1Decoders,12),e.initBitModels(this._isRepG2Decoders,12),e.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},e.Decoder.prototype.decode=function(t,n,r){var i=0,a=0,o=0,s=0,c=0,l=0,u=0,d,f,p,m,h,g;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(n),this.init();r<0||l<r;)if(d=l&this._posStateMask,this._rangeDecoder.decodeBit(this._isMatchDecoders,(i<<4)+d)===0)f=this._literalDecoder.getDecoder(l++,u),u=i>=7?f.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(a)):f.decodeNormal(this._rangeDecoder),this._outWindow.putByte(u),i=i<4?0:i-(i<10?3:6);else{if(this._rangeDecoder.decodeBit(this._isRepDecoders,i)===1)p=0,this._rangeDecoder.decodeBit(this._isRepG0Decoders,i)===0?this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(i<<4)+d)===0&&(i=i<7?9:11,p=1):(this._rangeDecoder.decodeBit(this._isRepG1Decoders,i)===0?m=o:(this._rangeDecoder.decodeBit(this._isRepG2Decoders,i)===0?m=s:(m=c,c=s),s=o),o=a,a=m),p===0&&(p=2+this._repLenDecoder.decode(this._rangeDecoder,d),i=i<7?8:11);else if(c=s,s=o,o=a,p=2+this._lenDecoder.decode(this._rangeDecoder,d),i=i<7?7:10,h=this._posSlotDecoder[p<=5?p-2:3].decode(this._rangeDecoder),h>=4){if(g=(h>>1)-1,a=(2|h&1)<<g,h<14)a+=e.reverseDecode2(this._posDecoders,a-h-1,this._rangeDecoder,g);else if(a+=this._rangeDecoder.decodeDirectBits(g-4)<<4,a+=this._posAlignDecoder.reverseDecode(this._rangeDecoder),a<0){if(a===-1)break;return!1}}else a=h;if(a>=l||a>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(a,p),l+=p,u=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},e.Decoder.prototype.setDecoderProperties=function(e){var t,n,r,i,a;return e.size<5||(t=e.readByte(),n=t%9,t=~~(t/9),r=t%5,i=~~(t/5),!this.setLcLpPb(n,r,i))?!1:(a=e.readByte(),a|=e.readByte()<<8,a|=e.readByte()<<16,a+=e.readByte()*16777216,this.setDictionarySize(a))},e.decompress=function(t,n,r,i){var a=new e.Decoder;if(!a.setDecoderProperties(t))throw`Incorrect stream properties`;if(!a.decode(n,r,i))throw`Error in data stream`;return!0},e.decompressFile=function(t,n){var r=new e.Decoder,i;if(!r.setDecoderProperties(t))throw`Incorrect stream properties`;if(i=t.readByte(),i|=t.readByte()<<8,i|=t.readByte()<<16,i+=t.readByte()*16777216,t.readByte(),t.readByte(),t.readByte(),t.readByte(),!r.decode(t,n,i))throw`Error in data stream`;return!0},e}var Hi=Vi();function Ui(){function e(e){let t=new Uint8Array(256);for(let e=0;e<64;e++)t[`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charCodeAt(e)]=e;let n=e.length*.75,r=e.length,i,a=0,o,s,c,l;e[e.length-1]===`=`&&(n--,e[e.length-2]===`=`&&n--);let u=new ArrayBuffer(n),d=new Uint8Array(u);for(i=0;i<r;i+=4)o=t[e.charCodeAt(i)],s=t[e.charCodeAt(i+1)],c=t[e.charCodeAt(i+2)],l=t[e.charCodeAt(i+3)],d[a++]=o<<2|s>>4,d[a++]=(s&15)<<4|c>>2,d[a++]=(c&3)<<6|l&63;return u}return e(`AGFzbQEAAAABSg1gAABgAX8Bf2ACf38Bf2AEf39/fwBgA39/fwBgAX8AYAJ/fwBgA39/fwF/YAR/f39/AX9gAn9/AGABfwF/YAABf2AEf39/fwF/AhsCA2VudgVhYm9ydAADA2VudgZtZW1vcnkCAAEDJiUBAQkKAgoKCwsLCwsAAgoBAgQKAQYFCAoFBQQEBwgCBwwCAQAABAQBcAABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwc9BgZtZW1vcnkCAAV0YWJsZQEABXJlc2V0AA0KbmV3VThBcnJheQAQCnVucGFja1NpemUAFAZkZWNvZGUAIwgBJAkHAQBBAAsBJQqAViVoAQN/IABBgICAgARLBEAACyMBIgEgAEEBIABBAUsbakEHakF4cSICPwAiA0EQdEsEQCADIAIgAWtB//8DakGAgHxxQRB2IgAgAyAAShtAAEEASARAIABAAEEASARAAAsLCyACJAEgAQsbAQF/QQFBICAAQQdqZ2t0EAEiASAANgIAIAELkQMBAX8gAUUEQA8LIABBADoAACAAIAFqQQFrQQA6AAAgAUECTQRADwsgAEEBakEAOgAAIABBAmpBADoAACAAIAFqIgJBAmtBADoAACACQQNrQQA6AAAgAUEGTQRADwsgAEEDakEAOgAAIAAgAWpBBGtBADoAACABQQhNBEAPC0EAIABrQQNxIgIgAGoiAEEANgIAIAEgAmtBfHEiASAAakEEa0EANgIAIAFBCE0EQA8LIABBBGpBADYCACAAQQhqQQA2AgAgACABaiICQQxrQQA2AgAgAkEIa0EANgIAIAFBGE0EQA8LIABBDGpBADYCACAAQRBqQQA2AgAgAEEUakEANgIAIABBGGpBADYCACAAIAFqIgJBHGtBADYCACACQRhrQQA2AgAgAkEUa0EANgIAIAJBEGtBADYCACAAQQRxQRhqIgIgAGohACABIAJrIQEDQCABQSBPBEAgAEIANwMAIABBCGpCADcDACAAQRBqQgA3AwAgAEEYakIANwMAIAFBIGshASAAQSBqIQAMAQsLC1EBA38gAEH+////AEsEQEEAQSBBLUEnEAAACyAAQQJ0IgMQAiECQQgQASIBQQA2AgAgAUEANgIEIAEgAjYCACABIAA2AgQgAkEIaiADEAMgAQtmAQF/IAFB/P///wFLBEBBAEHAAEEXQSIQAAALIAFBAXQiARACIgJBCGogARADIABFBEBBDBABIQALIABBADYCACAAQQA2AgQgAEEANgIIIAAgAjYCACAAQQA2AgQgACABNgIIIAALCgBBDBABIAAQBQsuAQF/QQgQASIBQQA2AgAgAUEANgIEIAEgADYCBCABQQEgASgCBHQQBjYCACABC6EBAQR/QRAQASIBQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgxBEBAEIQIDQCAAQRBIBEBBAxAHIQMgAigCACAAQQJ0aiADNgIIIABBAWohAAwBCwsgASACNgIEQRAQBCECQQAhAANAIABBEEgEQEEDEAchAyACKAIAIABBAnRqIAM2AgggAEEBaiEADAELCyABIAI2AgggAUEIEAc2AgwgAQs0AQF/QRQQASIAQQA2AgAgAEEAOgAEIABBADYCCCAAQQA2AgwgAEEANgIQIABBDTYCCCAAC0IBAX9BGRABIgBBADYCACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEANgIUIABBADoAGCAAQQA2AhAgAAu1AgEEf0HQABABIgBBADoAACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEAOgAUIABBADYCGCAAQQA2AhwgAEEANgIgIABBADYCJCAAQQA2AiggAEEANgIsIABBADYCMCAAQQA2AjQgAEEANgI4IABBADYCPCAAQQA2AkAgAEEANgJEIABBADYCSCAAQQA2AkxBBBAEIQIDQCABQQRIBEBBBhAHIQMgAigCACABQQJ0aiADNgIIIAFBAWohAQwBCwsgACACNgIkIABBBBAHNgIoIABB8wAQBjYCLCAAQcABEAY2AjAgAEEMEAY2AjQgAEEMEAY2AjggAEEMEAY2AjwgAEEMEAY2AkAgAEHAARAGNgJEIAAQCDYCSCAAEAg2AkwgABAJNgIEIAAQCjYCCCAACx8BAX9BCBABIgBBADYCACAAQQA2AgQgABALNgIAIAALCgAjACQBEAwkAwthAQF/IAFB+P///wNLBEBBAEHAAEEXQSIQAAALIAEQAiICQQhqIAEQAyAARQRAQQwQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCAAIAI2AgAgAEEANgIEIAAgATYCCCAACwoAQQwQASAAEA4LBgAgABAPCyoAIAEgACgCCE8EQEEAQcAAQSdBPxAAAAsgACgCBCABIAAoAgBqai0ACAssACABIAAoAghPBEBBAEHAAEEyQT8QAAALIAAoAgQgASAAKAIAamogAjoACAtkAQJ/QQ0QDyECA0AgAUENSARAIAIgASAAIAEQEUH/AXEQEiABQQFqIQEMAQsLQQAhAEEAIQEDQCABQQhIBEAgAiABQQVqEBFB/wFxIAFBA3R0IAByIQAgAUEBaiEBDAELCyAACwYAIAAQEwsnACAAIAEQDzYCCCAAQQA2AgwgACABNgIUIABBADoAGCAAQQA2AgALJAAgACgCCCAAKAIYEBUgAEGABiAAKAIMIAAtABRqdBAGNgIgC5UBAQR/IAEhBSAAIgYoAgAhASAAKAIEIQcgACgCCEEBdiEEIAJBAEgEfyACIARqIgBBACAAQQBKGwUgAiIAIAQgACAESBsLIQIgA0EASAR/IAMgBGoiAEEAIABBAEobBSADIgAgBCAAIARIGwshAwNAIAIgA05FBEAgAkEBdCABaiAHaiAFOwEIIAJBAWohAgwBCwsgBgssAQF/AkACQAJAIwRBAWsOAwEBAgALAAtB/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQAUanQhAQNAIAMgAUgEQCACKAIgIgQoAgAhBSAEKAIEIANBAXQgBWpqQYAIOwEIIANBAWohAwwBCwsgAiEBQQAhAgNAIAJBBEkEQCACIAEoAiQoAgAiAygCAEECdkkEfyACQQJ0IANqKAIIBQALKAIAQQEkBBAYGiACQQFqIQIMAQsLIAEoAigoAgBBASQEEBgaIAEoAixBASQEEBgaIAAoAjBBASQEEBgaIAAoAjRBASQEEBgaIAAoAjhBASQEEBgaIAAoAjxBASQEEBgaIAAoAkBBASQEEBgaIAAoAkRBASQEEBgaIAAoAkgQGSAAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAIAFBAmohASAAQQJqIQALIAJBAXEEQCAAIAEtAAA6AAALDwsgAkEgTwRAAkACQAJAIABBA3EiA0EBRwRAIANBAkYNASADQQNGDQIMAwsgASgCACEFIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAAIAJBA2shAgNAIAJBEU8EQCAAIAFBAWooAgAiA0EIdCAFQRh2cjYCACAAQQRqIAFBBWooAgAiBUEIdCADQRh2cjYCACAAQQhqIAFBCWooAgAiA0EIdCAFQRh2cjYCACAAQQxqIAFBDWooAgAiBUEIdCADQRh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsMAgsgASgCACEFIAAgAS0AADoAACAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAAgAkECayECA0AgAkESTwRAIAAgAUECaigCACIDQRB0IAVBEHZyNgIAIABBBGogAUEGaigCACIFQRB0IANBEHZyNgIAIABBCGogAUEKaigCACIDQRB0IAVBEHZyNgIAIABBDGogAUEOaigCACIFQRB0IANBEHZyNgIAIAFBEGohASAAQRBqIQAgAkEQayECDAELCwwBCyABKAIAIQUgACIEQQFqIQAgASIDQQFqIQEgBCADLQAAOgAAIAJBAWshAgNAIAJBE08EQCAAIAFBA2ooAgAiA0EYdCAFQQh2cjYCACAAQQRqIAFBB2ooAgAiBUEYdCADQQh2cjYCACAAQQhqIAFBC2ooAgAiA0EYdCAFQQh2cjYCACAAQQxqIAFBD2ooAgAiBUEYdCADQQh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsLCyACQRBxBEAgACABIgMtAAA6AAAgAEEBaiIBIAEgA0EBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiBEEBaiEAIAFBAWoiA0EBaiEBIAQgAy0AADoAAAsgAkEIcQRAIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiBEEBaiEAIAFBAWoiA0EBaiEBIAQgAy0AADoAAAsgAkEEcQRAIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAALIAJBAnEEQCAAIAEtAAA6AAAgAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAACyACQQFxBEAgACABLQAAOgAACwvVAgECfyAAIAFGBEAPCyABIAJqIABNIgNFBEAgACACaiABTSEDCyADBEAgACABIAIQGw8LIAAgAUkEQCABQQdxIABBB3FGBEADQCAAQQdxBEAgAkUEQA8LIAJBAWshAiAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAMAQsLA0AgAkEITwRAIAAgASkDADcDACACQQhrIQIgAEEIaiEAIAFBCGohAQwBCwsLA0AgAgRAIAAiBEEBaiEAIAEiA0EBaiEBIAQgAy0AADoAACACQQFrIQIMAQsLBSABQQdxIABBB3FGBEADQCAAIAJqQQdxBEAgAkUEQA8LIAJBAWsiAiAAaiABIAJqLQAAOgAADAELCwNAIAJBCE8EQCACQQhrIgIgAGogASACaikDADcDAAwBCwsLA0AgAgRAIAJBAWsiAiAAaiABIAJqLQAAOgAADAELCwsL4AoBCH8gACgCACIGIgQoAgAgBCgCBGovAQgiCCABIgcoAgxBC3ZsIQQgBygCECAESQR/QYAQIAhrQf//A3FBBXYgCGohCCAHIAQ2AgxBAAUgCCAIQf//A3FBBXZrIQggByAHKAIQIARrNgIQIAcgBygCDCAEazYCDEEBCyAGKAIEIAYoAgBqIAg7AQggByIFKAIMIwJJBEAgBSAFKAIMQQh0NgIMIAUoAhBBCHQhByAFKAIAIQYgBSAFKAIIIglBAWo2AgggBSAGIAkQEUH/AXEgB3I2AhALQf//A3FFBEAgAiAAKAIEKAIAIgAoAgBBAnZJBH8gAkECdCAAaigCCAUACyEDIAEhBEEBIQgDQCAKIAMoAgRJBEAgAygCACIHKAIAIQEgBCgCECAHKAIEIAgiBUEBdCIIIAFqai8BCCIGIAQoAgxBC3ZsIglJBH9BgBAgBmtB//8DcUEFdiAGaiEGIAQgCTYCDEEABSAGIAZB//8DcUEFdmshBiAEIAQoAhAgCWs2AhAgBCAEKAIMIAlrNgIMQQELIAcoAgQgBygCACAFQQF0amogBjsBCCAEKAIMIwJJBEAgBCAEKAIMQQh0NgIMIAQoAhBBCHQhACAEKAIAIQUgBCAEKAIIIgFBAWo2AgggBCAFIAEQEUH/AXEgAHI2AhALQf//A3EgCGohCCAKQQFqIQoMAQsLIAhBASADKAIEdGsPCyAAKAIAIgooAgAhCCAFKAIQIAooAgQgCEECamovAQgiBCABKAIMQQt2bCIDSQR/IAUgAzYCDEEAIQlBgBAgBGtB//8DcUEFdiAEagUgBSAFKAIQIANrNgIQIAUgBSgCDCADazYCDEEBIQkgBCAEQf//A3FBBXZrCyEEIAoiBygCBCAHKAIAQQJqaiAEOwEIIAUiBigCDCMCSQRAIAYgBigCDEEIdDYCDCAGKAIQQQh0IQUgBigCACEHIAYgBigCCCIIQQFqNgIIIAYgByAIEBFB/wFxIAVyNgIQCyAJQf//A3FFBEAgAiAAKAIIKAIAIgAoAgBBAnZJBH8gAkECdCAAaigCCAUACyEJIAEhA0EBIQRBACECA0AgAiAJKAIESQRAIAMoAhAgCSgCACIFKAIEIAQiBkEBdCIEIAUoAgBqai8BCCIHIAMoAgxBC3ZsIghJBH9BgBAgB2tB//8DcUEFdiAHaiEHIAMgCDYCDEEABSAHIAdB//8DcUEFdmshByADIAMoAhAgCGs2AhAgAyADKAIMIAhrNgIMQQELIAUoAgQgBSgCACAGQQF0amogBzsBCCADKAIMIwJJBEAgAyADKAIMQQh0NgIMIAMoAhBBCHQhBSADKAIAIQcgAyADKAIIIgZBAWo2AgggAyAHIAYQEUH/AXEgBXI2AhALQf//A3EgBGohBCACQQFqIQIMAQsLIARBASAJKAIEdGtBCGoPCyAAKAIMIQQgASEDQQEhCUEAIQIDQCACIAQoAgRJBEAgBCgCACIIKAIAIQogAygCECAIKAIEIAogCSIHQQF0IgFqai8BCCIFIAMoAgxBC3ZsIgZJBH8gAyAGNgIMQQAhBkGAECAFa0H//wNxQQV2IAVqBSADIAMoAhAgBms2AhAgAyADKAIMIAZrNgIMQQEhBiAFIAVB//8DcUEFdmsLIQUgCCgCBCAIKAIAIAdBAXRqaiAFOwEIIAMoAgwjAkkEQCADIAMoAgxBCHQ2AgwgAygCEEEIdCEAIAMoAgAhBSADIAMoAggiCkEBajYCCCADIAUgChARQf8BcSAAcjYCEAsgBkH//wNxIAFqIQkgAkEBaiECDAELCyAJQQEgBCgCBHRrQRBqC5YCAQh/QQEhBwNAAkAgBiABTg0AIAIoAhAgACgCBCAAKAIAIAMgB2oiCUEBdGpqLwEIIgQgAigCDEELdmwiBUkEfyACIAU2AgxBACEFQYAQIARrQf//A3FBBXYgBGoFIAIgAigCECAFazYCECACIAIoAgwgBWs2AgxBASEFIAQgBEH//wNxQQV2awshBCAAKAIEIAAoAgAgCUEBdGpqIAQ7AQggAiIEKAIMIwJJBEAgBCAEKAIMQQh0NgIMIAQoAhBBCHQhCiAEKAIAIQsgBCAEKAIIIglBAWo2AgggBCALIAkQEUH/AXEgCnI2AhALIAVB//8DcSIEIAdBAXRqIQcgBCAGdCAIciEIIAZBAWohBgwBCwsgCAvwBAEIf0EDIAEgAUEDSxsiAiAAKAIkKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACyEEIAAoAgQhAkEBIQEDQCAHIAQoAgRJBEAgBCgCACIFKAIAIQMgAigCECAFKAIEIAFBAXQiCSADamovAQgiAyACKAIMQQt2bCIGSQR/IAIgBjYCDEEAIQhBgBAgA2tB//8DcUEFdiADagUgAiACKAIQIAZrNgIQIAIgAigCDCAGazYCDEEBIQggAyADQf//A3FBBXZrCyEDIAUoAgQgBSgCACABQQF0amogAzsBCCACKAIMIwJJBEAgAiACKAIMQQh0NgIMIAIoAhBBCHQhBiACKAIAIQUgAiACKAIIIgNBAWo2AgggAiAFIAMQEUH/AXEgBnI2AhALIAhB//8DcSAJaiEBIAdBAWohBwwBCwsgAUEBIAQoAgR0ayIBQQRJBEAgAQ8LIAFBAXFBAnIgAUEBdkEBayICdCEDIAFBDkkEfyAAKAIsIAIgACgCBCADIAFrEB4gA2oFIAAoAgQhASACQQRrIQJBACEEA0AgASABKAIMQQF2NgIMIAEgASgCECABKAIMazYCECABIAEoAhBBACABKAIQQR92ayIHIAEoAgxxajYCECABKAIQIAEoAgxGBEAgAUEBOgAECyABKAIMIwJJBEAgASABKAIMQQh0NgIMIAEoAhBBCHQhBSABKAIAIQggASABKAIIIgZBAWo2AgggASAIIAYQEUH/AXEgBXI2AhALIAdBAWogBEEBdGohBCACQQFrIgINAAsgBEEEdCADaiAAKAIoIgQoAgAgBCgCBCAAKAIEQQAQHmoLC9AcAQ9/IAAQGiAAKAIEIgdBADoABCAHKAIAIAcgBygCCCIDQQFqNgIIIAMQEUH/AXEEQCAHQQE6AAQLIAdBfzYCDCAHQQA2AhBBACEDA0AgA0EESARAIAcoAhBBCHQhBSAHKAIAIQwgByAHKAIIIghBAWo2AgggByAMIAgQEUH/AXEgBXI2AhAgA0EBaiEDDAELCyAHKAIQIAcoAgxGBEAgB0EBOgAECyABBEAgACgCCCACEA82AgQFIAAoAghBBBAPNgIEC0EAIQwDQAJAIAJFIAEgARsiBwR/IAAtAABFBSAHCwRAIAAoAgQoAhBFBEBBAw8LCyAAKAIwIgUoAgAhByAFKAIEIAAoAggoAgBBASAAKAIQdEEBa3EiCyAMQQR0Qf8BcWoiBkEBdCAHamovAQghAyAGIQcgACgCBCIEKAIMQQt2IANsIQggBCgCECAISQR/IAQgCDYCDEEAIQlBgBAgA2tB//8DcUEFdiADagUgBCAEKAIQIAhrNgIQIAQgBCgCDCAIazYCDEEBIQkgAyADQf//A3FBBXZrCyEIIAUiAygCBCADKAIAIAdBAXRqaiAIOwEIIAQiBigCDCMCSQRAIAYgBigCDEEIdDYCDCAGKAIQQQh0IQggBigCACEDIAYgBigCCCIHQQFqNgIIIAYgAyAHEBFB/wFxIAhyNgIQCyAJQf//A3FFBEAgAkUgASABGw0BIAwhCEEAIQYgACgCCCIFKAIMRSIEBH8gBS0AGEUFIAQLRQRAIAAoAggiBSgCCCIGKAIEQQEgBSgCDEwEfyAFKAIMQQFrBSAFKAIMIAUoAhRBAWtqCyAGKAIAamotAAghBgtBASEEIAAoAggoAgBBASAALQAUdEEBa3EgACgCDHQgBkEIIAAoAgxrdmpBgAZsIQcgCEEHTwRAIAAoAggiBigCCCIJKAIEIA5BAWoiDSAGKAIMTAR/IAYoAgwgDWsFIAYoAgwgBigCFCANa2oLIAkoAgBqai0ACCENA0ACQCANQf8BcUEHdiEGIA1BAXQhDSAAKAIgIgkoAgAhCyAJKAIEIAZBAWpBCHQgB2ogBGoiDEEBdCALamovAQgiCyAAKAIEIgMoAgxBC3ZsIQogAygCECAKSQR/QYAQIAtrQf//A3FBBXYgC2ohCyADIAo2AgxBAAUgCyALQf//A3FBBXZrIQsgAyADKAIQIAprNgIQIAMgAygCDCAKazYCDEEBCyEFIAkoAgQgCSgCACAMQQF0amogCzsBCCADIgooAgwjAkkEQCAKIAooAgxBCHQ2AgwgCigCEEEIdCEDIAooAgAhDCAKIAooAggiC0EBajYCCCAKIAwgCxARQf8BcSADcjYCEAsgBEEBdCAFciEEIAVB//8DcSAGRw0AIARB//8DcUGAAkkNAQsLCwNAIARBgAJJBEAgBEEBdCEJIAAoAiAiBSgCACEMIAUoAgQgBCAHaiIGQQF0IAxqai8BCCILIAAoAgQiDSgCDEELdmwhCiANKAIQIApJBH9BgBAgC2tB//8DcUEFdiALaiELIA0gCjYCDEEABSALIAtB//8DcUEFdmshCyANIA0oAhAgCms2AhAgDSANKAIMIAprNgIMQQELIAUoAgQgBSgCACAGQQF0amogCzsBCCANIgooAgwjAkkEQCAKIAooAgxBCHQ2AgwgCigCEEEIdCEGIAooAgAhBSAKIAooAggiDEEBajYCCCAKIAUgDBARQf8BcSAGcjYCEAsgCXIhBAwBCwsgACgCCCIDIAMoAgBBAWo2AgAgAygCCCELIAMgAygCDCIGQQFqNgIMIAsoAgQgCygCACAGamogBEGAAmsiCjoACCADKAIMIAMoAhRGBEAgA0EANgIMIANBAToAGAsgAygCBCgCCCADKAIQRgRAIAMgAygCBCIGKAIIQQF0EA82AgQgAygCBCgCACADKAIEKAIEakEIaiAGKAIAIAYoAgRqQQhqIAYoAggQHCAGKAIAGgsgAygCBCEJIAMgAygCECIMQQFqNgIQIAkoAgQgCSgCACAMamogCjoACCAIIgVBBEkEf0EABSAFQQNrIAVBBmsgBUEKSRsLIQwgAkEBayECDAILIAAoAjQiBigCACEFIAYoAgQgDCIDQQF0IAVqai8BCCIHIAAoAgQiCigCDEELdmwhBCAKKAIQIARJBH9BgBAgB2tB//8DcUEFdiAHaiEHIAogBDYCDEEABSAHIAdB//8DcUEFdmshByAKIAooAhAgBGs2AhAgCiAKKAIMIARrNgIMQQELIAMhBSAGIgMoAgAhDSADKAIEIAVBAXQgDWpqIAc7AQggCiIJKAIMIwJJBEAgCSAJKAIMQQh0NgIMIAkoAhBBCHQhBiAJKAIAIQMgCSAJKAIIIgVBAWo2AgggCSADIAUQEUH/AXEgBnI2AhALQf//A3EEQCACRSABIAEbDQEgACgCCCIIKAIMRSIEBH8gCC0AGEUFIAQLDQEgACgCOCIDKAIAIQggAygCBCAMQQF0IAhqai8BCCIEIAAoAgQiBSgCDEELdmwhByAFKAIQIAdJBH9BgBAgBGtB//8DcUEFdiAEaiEEIAUgBzYCDEEABSAEIARB//8DcUEFdmshBCAFIAUoAhAgB2s2AhAgBSAFKAIMIAdrNgIMQQELIAMoAgQgAygCACAMQQF0amogBDsBCCAFIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEFIAkoAgAhAyAJIAkoAggiCEEBajYCCCAJIAMgCBARQf8BcSAFcjYCEAtB//8DcQRAIAAoAjwiCCgCACEHIAgoAgQgDEEBdCAHamovAQgiBCAAKAIEIgUoAgxBC3ZsIQYgBSgCECAGSQR/QYAQIARrQf//A3FBBXYgBGohBCAFIAY2AgxBAAUgBCAEQf//A3FBBXZrIQQgBSAFKAIQIAZrNgIQIAUgBSgCDCAGazYCDEEBCyAIIgMoAgQgAygCACAMQQF0amogBDsBCCAFIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEIIAkoAgAhAyAJIAkoAggiB0EBajYCCCAJIAMgBxARQf8BcSAIcjYCEAtB//8DcQRAIAAoAkAiAygCACEKIAMoAgQgDEEBdCAKamovAQgiBiAAKAIEIgcoAgxBC3ZsIQQgBygCECAESQR/QYAQIAZrQf//A3FBBXYgBmohBiAHIAQ2AgxBAAUgBiAGQf//A3FBBXZrIQYgByAHKAIQIARrNgIQIAcgBygCDCAEazYCDEEBCyADKAIEIAMoAgAgDEEBdGpqIAY7AQggByIJKAIMIwJJBEAgCSAJKAIMQQh0NgIMIAkoAhBBCHQhCCAJKAIAIQMgCSAJKAIIIgpBAWo2AgggCSADIAoQEUH/AXEgCHI2AhALQf//A3EEQCARIQMgDyERBSAPIQMLIBAhDwUgECEDCyAOIRAgAyEOBSAAKAJEIgYoAgAhCiAGKAIEIAxBBHRB/wFxIAtqIgNBAXQgCmpqLwEIIgcgACgCBCIIKAIMQQt2bCEEIAgoAhAgBEkEf0GAECAHa0H//wNxQQV2IAdqIQcgCCAENgIMQQAFIAcgB0H//wNxQQV2ayEHIAggCCgCECAEazYCECAIIAgoAgwgBGs2AgxBAQsgAyEKIAYiAygCACENIAMoAgQgCkEBdCANamogBzsBCCAIIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEIIAkoAgAhAyAJIAkoAggiCkEBajYCCCAJIAMgChARQf8BcSAIcjYCEAtB//8DcUUEQEEJQQsgDEEHSRshDCAAKAIIIQQgACgCCCIFKAIIIgMoAgQgDkEBaiIHIAUoAgxMBH8gBSgCDCAHawUgBSgCDCAFKAIUIAdragsgAygCAGpqLQAIIQcgBCAEKAIAQQFqNgIAIAQoAgghBSAEIAQoAgwiBkEBajYCDCAFKAIEIAUoAgAgBmpqIAc6AAggBCgCDCAEKAIURgRAIARBADYCDCAEQQE6ABgLIAQoAgQoAgggBCgCEEYEQCAEIAQoAgQiBigCCEEBdBAPNgIEIAQoAgQoAgAgBCgCBCgCBGpBCGogBigCACAGKAIEakEIaiAGKAIIEBwgBigCABoLIAQoAgQhAyAEIAQoAhAiCEEBajYCECADKAIEIAMoAgAgCGpqIAc6AAggAkEBayECDAQLCyAAKAJMIAAoAgQgCxAdIQtBCEELIAxBB0kbIQwFIA8hESAQIQ8gDiEQQQdBCiAMQQdJGyEMIAAgACgCSCAAKAIEIAsQHSILEB8iDkF/RgRAIAAoAgQoAhAEf0EBBUECCw8LIAJFIAEgARsNASAOIAAoAhhPIgUEfyAFBSAOIAAoAggiBCgCDEwiBgR/IAYFIAQtABgLRQsNAQtBACENIAAoAgghBSAOQQFqIQQgAiALQQJqIgtIIAEgARsEQEEBIQ0gAiELCyALIQYDQCAGQQBKBEAgBSIIKAIIIgkoAgQgBCAFKAIMTAR/IAUoAgwgBGsFIAUoAgwgBSgCFCAEa2oLIAkoAgBqai0ACCEHIAggCCgCAEEBajYCACAIKAIIIQMgCCAIKAIMIgpBAWo2AgwgAygCBCADKAIAIApqaiAHOgAIIAgoAgwgCCgCFEYEQCAIQQA2AgwgCEEBOgAYCyAIKAIEKAIIIAgoAhBGBEAgCCAIKAIEIgMoAghBAXQQDzYCBCAIKAIEKAIAIAgoAgQoAgRqQQhqIAMoAgAgAygCBGpBCGogAygCCBAcIAMoAgAaCyAIKAIEIQkgCCAIKAIQIgNBAWo2AhAgCSgCBCAJKAIAIANqaiAHOgAIIAZBAWshBgwBCwsgAiALayECIA1FDQELC0EBCyYBAX9BEBABIgQgADYCACAEIAE2AgQgBCACNgIIIAQgAzYCDCAEC7YEAQZ/IAAgATYCBEENEA8hAgNAAkAgA0ENTg0AIAIgAyABIAMQEUH/AXEQEiADQQFqIQMMAQsLIAAoAgAhBCACIQZBBBAPIgIoAgQgAigCAGogBigCBCAGKAIAai0ACCIDOgAIIANB/wFxQeEBTwRAQQBBgAFBoQFBDBAAAAsgAigCBCACKAIAQQFqaiADQf8BcUEJcCIHOgAIIAIoAgQgAigCAGogA0H/AXFBCW4iAzoACCADQQVwIQUgAigCBCACKAIAQQJqaiADQQVuIgM6AAggAigCBCACKAIAQQNqaiAFOgAIIAQgBzYCDCAEIAM2AhAgBCAFOgAUIARBADYCHEEAIQIDQAJAIAJBBE8NACAEIAQoAhwgBigCBCAGKAIAIAJBAWpqai0ACCACQQN0dHI2AhwgAkEBaiECDAELCyAEIAQoAhw2AhggBCgCGEGAIEkEQCAEQYAgNgIYC0EAIQJBACEFQQAhAwNAAkAgA0EITg0AIAYgA0EFahARQf8BcSIEQf8BRwRAQQEhBQsgBCADQQN0dCACciECIANBAWohAwwBCwsgACgCACAFRToAACAAKAIAKAIEIAE2AgAgACgCABAWAkAgACgCACAFIAIQICIBQQFGDQAgAUEDRwRAIAFBAkYEQCAFBEAgACgCACgCCCgCECACRw0DCwUMAgsLIAAoAgAoAgQtAAQaQQFBACAAKAIAKAIIKAIQIAAoAgAoAggoAgQQIQ8LQQBBAUEAQQAQIQsIACMDIAAQIgsWAEG4ASQAIwAkAUGAgIAIJAIQDCQDCwMAAQsLtwEEAEEICxcKAAAAdQBzAGUAIABzAHQAcgBpAGMAdABBIAsdDQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHMAQcAACzkbAAAAfgBsAGkAYgAvAGkAbgB0AGUAcgBuAGEAbAAvAHQAeQBwAGUAZABhAHIAcgBhAHkALgB0AHMAQYABCzMYAAAAcwByAGMALwBsAHoAbQBhAC8AbAB6AG0AYQAtAGQAZQBjAG8AZABlAHIALgB0AHM=`)}function Wi(e,t,n){try{let r={data:t,offset:0,readByte(){return this.data[this.offset++]}},i=r.data.length,a={data:[],offset:0,writeByte(e){let t=Math.floor(this.offset/i);this.data[t]||(this.data[t]=new Uint8Array(i)),this.data[t][this.offset%i]=e,this.offset++}};e.decompressFile(r,a);let o=new Uint8Array(a.offset);for(let e=0;e<a.offset;e++)o[e]=a.data[Math.floor(e/i)][e%i];n(null,o)}catch(e){n(e)}}function Gi(e,t,n){try{let r=new WebAssembly.Memory({initial:16}),i=new WebAssembly.Module(e),a=new WebAssembly.Instance(i,{env:{memory:r,abort(){n(Error(`webAssembly abort`))}}}).exports,o=a.newU8Array(t.length);new Uint8Array(r.buffer,o+24,t.length).set(t);let s=a.decode(o),c=new Uint32Array(r.buffer,s,4),l=c[0],u=c[2],d=c[3];l?n(null,new Uint8Array(r.buffer,d+24,u).slice(0,u)):n(Error(`lzma deocder error`))}catch(e){n(e)}}var Ki=`
|
|
320
320
|
var decodeLZMA = (function() {
|
|
321
321
|
var LZMA = (${Vi.toString()})();
|
|
@@ -361,7 +361,7 @@ self.onmessage = function(event) {
|
|
|
361
361
|
}
|
|
362
362
|
postMessage({ id: packet.id, error: "type never matched." });
|
|
363
363
|
};
|
|
364
|
-
`,qi=typeof Worker<`u`&&typeof Blob<`u`,Ji=``;if(qi)try{let e=new Blob([Ki],{type:`text/javascript`});Ji=URL.createObjectURL(e)}catch(e){}var Yi=class{constructor(){if(!qi)throw Error(`LZMAWorker cannot work in this broswer.`);this.callCounter=0,this.requests={};let e=this.worker=new Worker(Ji);e.onmessage=e=>{let{id:t,result:n,error:r}=e.data,i=this.getKey(t);this.requests[i]&&(r?this.requests[i](Error(r)):this.requests[i](null,n),delete this.requests[i])},e.onerror=e=>console.error(e)}getKey(e){return`key_`+String(e)}decompress(e,t){let n=++this.callCounter;this.requests[this.getKey(n)]=t,this.worker.postMessage({type:`decompress`,id:n,data:e},[e.buffer])}terminate(){this.worker.terminate()}};Yi.support=qi;function Xi(e){return Array.prototype.reduce.call(e,(e,t,n)=>e|t<<n*8,0)}function Zi(e){let t=[],n=e.length;for(let i=0;i<n;i++){let n={data:e[i],offset:0,readByte(){return this.data[this.offset++]}},a=n.data.length,o={data:[],offset:0,writeByte(e){let t=Math.floor(this.offset/a);this.data[t]||(this.data[t]=new Uint8Array(a)),this.data[t][this.offset%a]=e,this.offset++}};Hi.decompressFile(n,o);var r=new Uint8Array(o.offset);for(let e=0;e<o.offset;e++)r[e]=o.data[Math.floor(e/a)][e%a];t.push(r)}return t}function Qi(e){let t=[],n=e.length;for(let r=0;r<n;r++)t.push(new Promise((t,n)=>{let i=new Yi;i.decompress(e[r],(e,r)=>{if(i.terminate(),e)return n(e);t(r)})}));return Promise.all(t)}function $i(e){let t=new Uint8Array(e),n=Xi(t.slice(0,4));if(n>10)return Promise.reject(Error(`LZMA got too many sub chunks.`));let r=[],i=[],a=4+n*4;for(let e=0;e<n;e++)i[e]=Xi(t.slice(4+e*4,8+e*4)),e===n-1?r[e]=t.subarray(a,a+i[e]):r[e]=t.slice(a,a+i[e]),a+=i[e];return Yi.support?Qi(r):Promise.resolve(Zi(r))}function ea(e,t={}){var n,r,i,a,o,s,l;let u=(n=t.upAxis)==null?`Z`:n,d=(r=t.light)==null?!1:r,f=(i=t.fetcher)==null?pr:i,p=(a=t.onDownloadProgress)==null?q:a,m=(o=t.textureBaseUri)==null?ji(e):o,h=t.textureBaseUri===void 0?[]:((s=t.textureArray)==null?[]:s).slice(),g=Bi((l=t.textureOptions)==null?{}:l,h.length),_=new Map;for(let e of h){let t=vr(e)?e:br(m,e);_.set(t,Ri(t,g,f))}let v={byteLength:0};return Promise.resolve().then(()=>f.ajax(e,{responseType:`arraybuffer`},void 0,void 0,p)).then(e=>$i(e.body)).then(e=>{let t={chunks:[],createAt:void 0,description:void 0};for(let n of e){let e=yi.decode(n);if(e.chunks.length){for(let n=0;n<e.chunks.length;n++)t.chunks.push(e.chunks[n]);t.createAt=e.createAt,t.description=e.description}}return t}).then(e=>zi(e,d,m,h,g,_,f)).then(t=>{_.clear();let n=new c.Group;n.name=e;for(let e of t.objects)n.add(e);return u===`Y`&&n.applyMatrix4(Zn),{type:`at3d`,modelUpAxis:`Z`,upAxis:u,uri:e,byteLength:v.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}var ta=l.Reader,na=l.util,Y=l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto`]||(l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto`]={}),ra=Y.Model=(()=>{function e(e){if(this.meshes=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.meshes=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Model;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.meshes&&i.meshes.length||(i.meshes=[]),i.meshes.push(Y.Mesh.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Model`},e})();Y.Mesh=(()=>{function e(e){if(this.chunks=[],this.matrix=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.name=``,e.prototype.chunks=na.emptyArray,e.prototype.matrix=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Mesh;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.name=e.string();break;case 2:i.chunks&&i.chunks.length||(i.chunks=[]),i.chunks.push(Y.Chunk.decode(e,e.uint32()));break;case 3:i.matrix&&i.matrix.length||(i.matrix=[]),i.matrix.push(Y.Matrix.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`name`))throw na.ProtocolError(`missing required 'name'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Mesh`},e})(),Y.Matrix=(()=>{function e(e){if(this.elements=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.elements=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Matrix;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.elements&&i.elements.length||(i.elements=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.elements.push(e.float())}else i.elements.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Matrix`},e})(),Y.Chunk=(()=>{function e(e){if(this.material=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.geometry=null,e.prototype.material=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Chunk;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 2:i.geometry=Y.Geometry.decode(e,e.uint32());break;case 3:i.material&&i.material.length||(i.material=[]),i.material.push(Y.Material.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`geometry`))throw na.ProtocolError(`missing required 'geometry'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Chunk`},e})(),Y.Geometry=(()=>{function e(e){if(this.groups=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.position=null,e.prototype.uv=null,e.prototype.uv2=null,e.prototype.normal=null,e.prototype.groups=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Geometry;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.position=Y.Position.decode(e,e.uint32());break;case 2:i.uv=Y.UV.decode(e,e.uint32());break;case 3:i.uv2=Y.UV.decode(e,e.uint32());break;case 4:i.normal=Y.Normal.decode(e,e.uint32());break;case 5:i.groups&&i.groups.length||(i.groups=[]),i.groups.push(Y.Group.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`position`))throw na.ProtocolError(`missing required 'position'`,{instance:i});if(!i.hasOwnProperty(`normal`))throw na.ProtocolError(`missing required 'normal'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Geometry`},e})(),Y.Position=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Position;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Position`},e})(),Y.UV=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.UV;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/UV`},e})(),Y.Normal=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Normal;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Normal`},e})(),Y.Group=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.start=0,e.prototype.count=0,e.prototype.materialIndex=0,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Group;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.start=e.uint32();break;case 2:i.count=e.uint32();break;case 3:i.materialIndex=e.uint32();break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`start`))throw na.ProtocolError(`missing required 'start'`,{instance:i});if(!i.hasOwnProperty(`count`))throw na.ProtocolError(`missing required 'count'`,{instance:i});if(!i.hasOwnProperty(`materialIndex`))throw na.ProtocolError(`missing required 'materialIndex'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Group`},e})(),Y.Material=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.kd=null,e.prototype.ks=null,e.prototype.ke=null,e.prototype.mapkd=``,e.prototype.mapks=``,e.prototype.mapke=``,e.prototype.norm=``,e.prototype.mapbump=``,e.prototype.bump=``,e.prototype.mapd=``,e.prototype.ns=0,e.prototype.d=0,e.prototype.tr=0,e.prototype.mapkdrepeat=``,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Material;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.kd=Y.Color.decode(e,e.uint32());break;case 2:i.ks=Y.Color.decode(e,e.uint32());break;case 3:i.ke=Y.Color.decode(e,e.uint32());break;case 4:i.mapkd=e.string();break;case 5:i.mapks=e.string();break;case 6:i.mapke=e.string();break;case 7:i.norm=e.string();break;case 8:i.mapbump=e.string();break;case 9:i.bump=e.string();break;case 10:i.mapd=e.string();break;case 11:i.ns=e.float();break;case 12:i.d=e.float();break;case 13:i.tr=e.float();break;case 14:i.mapkdrepeat=e.string();break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Material`},e})(),Y.Color=(()=>{function e(e){if(this.rgb=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.rgb=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Color;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.rgb&&i.rgb.length||(i.rgb=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.rgb.push(e.float())}else i.rgb.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Color`},e})();function ia(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(e=>{var n,r;return l.byteLength=e.body.byteLength,ua(new Uint8Array(e.body),(n=t.light)==null?!0:n,t.textureBaseUri||``,(r=t.textureOptions)==null?{}:r,o)}).then(t=>{let n=new c.Group;n.matrixAutoUpdate=!1,a===`Z`&&n.applyMatrix4(Xn),n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(let e of t.objects)n.add(e);return{type:`dome`,modelUpAxis:`Y`,upAxis:a,uri:e,byteLength:l.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}function aa(e){let t=[0,0,0];for(let n=0;n<e.attributes.normal.array.length/9;n++)t[0]=e.attributes.normal.array[n*9],t[1]=e.attributes.normal.array[n*9+1],t[2]=e.attributes.normal.array[n*9+2],e.attributes.normal.array[n*9]=e.attributes.normal.array[n*9+6],e.attributes.normal.array[n*9+1]=e.attributes.normal.array[n*9+7],e.attributes.normal.array[n*9+2]=e.attributes.normal.array[n*9+8],e.attributes.normal.array[n*9+6]=t[0],e.attributes.normal.array[n*9+7]=t[1],e.attributes.normal.array[n*9+8]=t[2];for(let n=0;n<e.attributes.position.array.length/9;n++)t[0]=e.attributes.position.array[n*9],t[1]=e.attributes.position.array[n*9+1],t[2]=e.attributes.position.array[n*9+2],e.attributes.position.array[n*9]=e.attributes.position.array[n*9+6],e.attributes.position.array[n*9+1]=e.attributes.position.array[n*9+7],e.attributes.position.array[n*9+2]=e.attributes.position.array[n*9+8],e.attributes.position.array[n*9+6]=t[0],e.attributes.position.array[n*9+7]=t[1],e.attributes.position.array[n*9+8]=t[2];for(let n=0;n<e.attributes.uv.array.length/6;n++)t[0]=e.attributes.uv.array[n*6],t[1]=e.attributes.uv.array[n*6+1],e.attributes.uv.array[n*6]=e.attributes.uv.array[n*6+4],e.attributes.uv.array[n*6+1]=e.attributes.uv.array[n*6+5],e.attributes.uv.array[n*6+4]=t[0],e.attributes.uv.array[n*6+5]=t[1];e.attributes.normal.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.uv.needsUpdate=!0}function oa({position:e,normal:t,uv:n,uv2:r,groups:i}){let a=new c.BufferGeometry;a.setAttribute(`position`,new c.BufferAttribute(new Float32Array(e.array),3)),t&&a.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(t.array),3)),n&&a.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(n.array),2)),r&&a.setAttribute(`uv2`,new c.BufferAttribute(new Float32Array(r.array),2));for(let e of i)a.addGroup(e.start,e.count,e.materialIndex);return a}function sa(e,t,n,r,i,a,o){if(o.hasOwnProperty(e))return o[e];e=e.split(`?`)[0],vr(e)||(e=br(t,e)),e=e.replace(/\/\/vrlab-image\d*.ljcdn.com\//,`//vrlab-public.ljcdn.com/`),e.indexOf(`//`)===0&&(e=`https:`+e);let s=Object.assign({key:`texture.dome`,size:64},mr(n,[`quality`,`format`,`sharpen`,`forceUseExifOrientation`,`mappings`]));return o[e]=i.loadTexture(e,{imageURL:{transform:n.transform,options:s},wrapS:c.RepeatWrapping,wrapT:c.RepeatWrapping,fetcher:a}).then(e=>{let t=e.body;return r&&t.repeat.copy(r),t.needsUpdate=!0,t.updateMatrix(),t})}function ca(e,t,n,r,i,a,o,s,l){let u=[],d=new vn(t?`phong`:`basic`);if(s.add(d),e.kd&&(d.color=new c.Color().fromArray(e.kd.rgb).convertLinearToSRGB()),e.mapkd){let t=null;if(e.mapkdrepeat){let[n,r]=e.mapkdrepeat.split(/\s+/).map(e=>Number(e));t=new c.Vector2(n,r)}u.push(sa(e.mapkd,n,r,t,i,a,o).then(e=>{e.encoding=c.sRGBEncoding,d.map=e,s.add(e),l.add(e),d.needsUpdate=!0}).catch(q))}if(e.ks&&(d.specular=new c.Color().fromArray(e.ks.rgb).convertLinearToSRGB()),e.mapks&&u.push(sa(e.mapks,n,r,null,i,a,o).then(e=>{d.specularMap=e,s.add(e),l.add(e)}).catch(q)),e.ke&&(d.emissive=new c.Color().fromArray(e.ke.rgb).convertLinearToSRGB()),e.mapke&&u.push(sa(e.mapke,n,r,null,i,a,o).then(e=>{e.encoding=c.sRGBEncoding,d.emissiveMap=e,s.add(e),l.add(e)}).catch(q)),e.norm&&u.push(sa(e.norm,n,r,null,i,a,o).then(e=>{d.normalMap=e,s.add(e),l.add(e)}).catch(q)),e.mapbump&&u.push(sa(e.mapbump,n,r,null,i,a,o).then(e=>{d.bumpMap=e,s.add(e),l.add(e)}).catch(q)),e.bump&&u.push(sa(e.bump,n,r,null,i,a,o).then(e=>{d.bumpMap=e,s.add(e),l.add(e)}).catch(q)),typeof e.ns==`number`&&(d.shininess=e.ns),typeof e.d==`number`){let t=e.d;t>0&&t<1&&(d.opacity=t)}return d.floorIndex=0,{material:d,textureReady:Promise.all(u).then(q)}}function la(e){return ra.decode(e).meshes}function ua(e,t,n,r,i){let a=[],o=[],s=new Set,l=la(e),u=new hi,d=new c.Matrix4,f=new c.Vector3,p=new c.Quaternion,m=new c.Vector3,h={},g=new Set;for(let{name:e,chunks:_,matrix:v}of l)if(!(e===`Ceiling`||e===`CeilingDrop`))for(let l of v){d.elements=l.elements;let v=new c.Group;for(let e=0;e<_.length;e++){let a=oa(_[e].geometry);a.applyMatrix4(d),d.decompose(f,p,m),m.x*m.y*m.z<0&&a.attributes.normal&&a.attributes.position&&a.attributes.uv&&aa(a),s.add(a);let c=[];for(let a of _[e].material){let{material:e,textureReady:l}=ca(a,t,n||``,r,u,i,h,s,g);o.push(l),c.push(e)}let l=new yn(a,c);l.name=`chunk_`+e,l.matrix.compose(l.position,l.quaternion,l.scale),l.matrixAutoUpdate=!1,l.frustumCulled=!1,v.add(l)}v.name=e,a.push(v)}return Promise.all(o).catch(q).then(()=>({createAt:0,description:``,objects:a,textures:Array.from(g),dispose:()=>{s.forEach(e=>{e.dispose()}),s.clear()}}))}function da(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(e=>(l.byteLength=e.body.byteLength,$i(e.body))).then(e=>{let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;return e.forEach(e=>{n.set(e,r),r+=e.length}),n}).then(e=>{var n,r;return ua(e,(n=t.light)==null?!0:n,t.textureBaseUri||``,(r=t.textureOptions)==null?{}:r,o)}).then(t=>{let n=new c.Group;n.matrixAutoUpdate=!1,a===`Z`&&n.applyMatrix4(Xn),n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(let e of t.objects)n.add(e);return{type:`domez`,modelUpAxis:`Y`,upAxis:`Z`,uri:e,byteLength:l.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}var fa=4;function pa(e,t,n){let r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=fa,e.version=r.getUint32(n,!0),n+=fa,e.byteLength=r.getUint32(n,!0),n+=fa,e.version!==1)throw Error(`3D Tile Version ${e.version} not supported`);return n}var ma;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(ma||(ma={}));var ha={[ma.DOUBLE]:Float64Array,[ma.FLOAT]:Float32Array,[ma.UNSIGNED_SHORT]:Uint16Array,[ma.UNSIGNED_INT]:Uint32Array,[ma.UNSIGNED_BYTE]:Uint8Array,[ma.BYTE]:Int8Array,[ma.SHORT]:Int16Array,[ma.INT]:Int32Array},ga={DOUBLE:ma.DOUBLE,FLOAT:ma.FLOAT,UNSIGNED_SHORT:ma.UNSIGNED_SHORT,UNSIGNED_INT:ma.UNSIGNED_INT,UNSIGNED_BYTE:ma.UNSIGNED_BYTE,BYTE:ma.BYTE,SHORT:ma.SHORT,INT:ma.INT};function _a(e){let t=ha[e];if(!t)throw Error(`Failed to convert GL type`);return t}function va(e){return _a(e).BYTES_PER_ELEMENT}function ya(e,t,n=0,r){let i=_a(e);return n%va(e)===0?new i(t,n,r==null?(t.byteLength-n)/va(e):r):new i(r?t.slice(n,n+r*va(e)):t.slice(n))}function ba(e){let t=ga[e];if(!t)throw Error(`Failed to convert GL type`);return t}var xa=class{constructor(e,t){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=t;let n=this.getGlobalProperty(`POINTS_LENGTH`,ma.UNSIGNED_INT,1);n&&n.length&&(this.featuresLength=n[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(_a(t))([r]):Array.isArray(r)?new(_a(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=ba(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,o=a[e];return o||(o=ya(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=o),o}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=ya(t,n),r[e]=i),i}},Sa=4,Ca=`b3dm tile in legacy format.`;function wa(e,t,n){let r=new TextDecoder(`utf8`),i=new Uint8Array(e,t,n);return r.decode(i)}function Ta(e,t,n){return n=Ea(e,t,n),n=Da(e,t,n),n=Oa(e,t,n),n}function Ea(e,t,n){let r=new DataView(t),i=0;e.header=e.header||{};let a=r.getUint32(n,!0);n+=Sa;let o=r.getUint32(n,!0);n+=Sa;let s=r.getUint32(n,!0);n+=Sa;let c=r.getUint32(n,!0);return n+=Sa,s>=570425344?(n-=Sa*2,i=a,s=o,c=0,a=0,o=0,console.warn(Ca)):c>=570425344&&(n-=Sa,i=s,s=a,c=o,a=0,o=0,console.warn(Ca)),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=c,e.header.batchLength=i,n}function Da(e,t,n){let{featureTableJsonByteLength:r,featureTableBinaryByteLength:i,batchLength:a}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:a||0},r&&r>0){let i=wa(t,n,r);e.featureTableJson=JSON.parse(i)}n+=r||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0;let o=new xa(e.featureTableJson,e.featureTableBinary);if(Array.isArray(o.json.RTC_CENTER)){let t=o.json.RTC_CENTER;e.rtcCenter=[t[0],t[1],t[2]]}else{let t=o.getGlobalProperty(`RTC_CENTER`,ma.FLOAT,3);t&&(e.rtcCenter=[t[0],t[1],t[2]])}return n}function Oa(e,t,n){let{batchTableJsonByteLength:r,batchTableBinaryByteLength:i}=e.header||{};if(r&&r>0){let a=wa(t,n,r);e.batchTableJson=JSON.parse(a),n+=r,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,n,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=i)}return n}function ka(e,t,n){let r=n===void 0?new Uint8Array(e).subarray(t):new Uint8Array(e).subarray(t,t+n);return new Uint8Array(r).buffer}function Aa(e,t,n){let r=e.byteLength-n;if(r===0)throw Error(`glTF byte length must be greater than 0.`);return n%4!=0&&console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),e.gltfArrayBuffer=ka(t,n,r),e.byteLength}function ja(e){if(typeof TextDecoder<`u`)return new TextDecoder().decode(e);let t=``;for(let n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}var Ma={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Na={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Pa={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},Fa={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},Ia={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},La={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv2`,TEXCOORD_2:`uv3`,TEXCOORD_3:`uv4`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},Ra={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},za={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete},Ba={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`};function Va(e){let t=[];for(let n in e)t.push(e[n]);return t}function Ha(e){let t=Array.from(e);return()=>{for(let e of t)typeof e.dispose==`function`&&e.dispose(),typeof e.close==`function`&&e.close()}}var Ua=class{constructor(e,t,n){if(this.json=e,this.json.materials){let e=new Set;for(let t of this.json.materials){if(typeof t.name!=`string`)continue;let n=0;for(;t.name;){let r=t.name+(n>0?`__${n}`:``);if(!e.has(r)){e.add(r),t.name=r;break}console.warn(`glTF: material name "${t.name}" duplicated.`),n++}}e.clear()}if(this.json.nodes){let e=new Set;for(let t of this.json.nodes){if(typeof t.name!=`string`)continue;let n=0;for(;t.name;){let r=t.name+(n>0?`__${n}`:``);if(!e.has(r)){e.add(r),t.name=r;break}console.warn(`glTF: node name "${t.name}" duplicated.`),n++}}e.clear()}this.extensions=t,this.options=n,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}dispose(){this.cache.clear(),this.disposeSet.forEach(e=>{typeof e.dispose==`function`&&e.dispose(),typeof e.close==`function`&&e.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:`unknown`}}}markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)}}parse(){let e=this.json,t=this.extensions;this.markDefs();for(let e of Va(t))e.markDefs(this);return Promise.all(Va(t).map(e=>e.prepare(this))).then(()=>{var t,n,r;return Promise.all([Promise.all(((t=e.scenes)==null?[]:t).map((e,t)=>this.loadScene(t))),Promise.all(((n=e.cameras)==null?[]:n).map((e,t)=>this.loadCamera(t))),Promise.all(((r=e.animations)==null?[]:r).map((e,t)=>this.loadAnimation(t)))])}).then(([t,n,r])=>({json:e,scene:t[e.scene||0],scenes:t,animations:r,cameras:n,textures:[],dispose:q})).then(e=>Promise.all(Va(t).map(t=>t.emitResult(e,this))).then(()=>e)).then(e=>{let t=Array.from(this.textureSet),n=Ha(this.disposeSet);return Object.assign(e,{textures:t,dispose:n}),this.textureSet.clear(),this.disposeSet.clear(),this.dispose(),e})}loadCamera(e){let t=`camera:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadCamera(e,this),r)break;if(!r){let t,n=this.json.cameras[e],i=n[n.type];i?n.type===`perspective`?t=new c.PerspectiveCamera(c.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type===`orthographic`?t=new c.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar):(console.warn(`glTF: Invalid camera type ${n.type}.`),t=new c.Camera):(console.warn(`glTF: Missing camera parameters.`),t=new c.Camera),n.name&&(t.name=n.name),r=Promise.resolve(t)}return this.cache.set(t,r),r}loadSkin(e){let t=`skin:`+e,n=this.cache.get(t);if(n)return n;let r,i=this.json.skins[e],a={joints:i.joints};return r=i.inverseBindMatrices===void 0?Promise.resolve(a):this.loadAccessor(i.inverseBindMatrices).then(e=>(e&&(a.inverseBindMatrices=e),a)),this.cache.set(t,r),r}loadAnimation(e){var t;let n=`animation:`+e,r=this.cache.get(n);if(r)return r;let i=null;for(let t of Va(this.extensions))if(i=t.loadAnimation(e,this),i)break;if(!i){let n=this.json.animations[e],r=n.name?n.name:`animation_`+e,a=[],o=[],s=[],l=[],u=[];for(let e=0,r=n.channels.length;e<r;e++){let r=n.channels[e],i=n.samplers[r.sampler],c=r.target,d=c.node===void 0?c.id:c.node,f=n.parameters===void 0?i.input:n.parameters[i.input],p=n.parameters===void 0?i.output:n.parameters[i.output],m=(t=c.extensions)==null?{}:t;if(c.path===`pointer`&&m.KHR_animation_pointer&&m.KHR_animation_pointer.pointer&&/^\/nodes\/\d+\//.test(m.KHR_animation_pointer.pointer)){let e=m.KHR_animation_pointer.pointer.slice(1).split(`/`),t=Number(e[1]);a.push(this.loadNode(t))}else d===void 0?a.push(Promise.resolve(null)):a.push(this.loadNode(d));o.push(this.loadAccessor(f)),s.push(this.loadAccessor(p)),l.push(i),u.push(c)}i=Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(u)]).then(([e,t,n,i,a])=>{var o;let s=[];for(let r=0,l=e.length;r<l;r++){let l=e[r],u=t[r],d=n[r],f=i[r],p=a[r];l&&(l.updateMatrix(),l.matrixAutoUpdate=!0);let m=d.array;if(d.normalized){let e=Wa(m.constructor),t=new Float32Array(m.length);for(let n=0,r=m.length;n<r;n++)t[n]=m[n]*e;m=t}let h=f.interpolation===void 0?c.InterpolateLinear:za[f.interpolation],g=(o=p.extensions)==null?{}:o;if(g.KHR_animation_pointer&&p.path&&p.path===`pointer`){let e=g.KHR_animation_pointer.pointer;if(e.indexOf(`/nodes/`)===0){let t=e.match(/^\/nodes\/(\d+)\/(.+)/);if(!t)continue;Number(t[1]);let n=t[2],r;switch(n){case`weights`:n=`morphTargetInfluences`,r=c.NumberKeyframeTrack;break;case`rotation`:n=`quaternion`,r=c.QuaternionKeyframeTrack;break;case`translation`:n=`position`,r=c.VectorKeyframeTrack;break;case`scale`:n=`scale`,r=c.VectorKeyframeTrack;break;case`extensions/KHR_node_visibility/visible`:n=`visible`,r=c.BooleanKeyframeTrack;break;default:break}if(!r)continue;let i=[];if(l){let e=l.name?l.name:l.uuid;n===`morphTargetInfluences`?l.traverse(e=>{e.morphTargetInfluences&&i.push(e.name?e.name:e.uuid)}):i.push(e)}for(let e=0,t=i.length;e<t;e++){let t=new r(`.nodes.${i[e]}.${n}`,u.array,r===c.BooleanKeyframeTrack?Array.from(m).map(e=>e>0):m,h);s.push(t)}}else if(e.indexOf(`/materials/`)===0){let t=e.match(/^\/materials\/(\d+)\/(.+)/);if(!t)continue;let n=Number(t[1]),r=t[2],i=this.json.materials[n].name,a;switch(r){case`pbrMetallicRoughness/baseColorFactor`:r=`color`,a=c.ColorKeyframeTrack;break;case`pbrMetallicRoughness/roughnessFactor`:r=`roughness`,a=c.NumberKeyframeTrack;break;case`pbrMetallicRoughness/metallicFactor`:r=`metalness`,a=c.NumberKeyframeTrack;break;case`emissiveFactor`:r=`emissive`,a=c.NumberKeyframeTrack;break;case`alphaCutoff`:r=`alphaTest`,a=c.NumberKeyframeTrack;break;case`occlusionTexture/strength`:r=`aoMapIntensity`,a=c.NumberKeyframeTrack;break;case`normalTexture/scale`:r=`normalScale`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale`:r=`map.repeat`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset`:r=`map.offset`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation`:r=`map.rotation`,a=c.NumberKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/scale`:r=`normalMap.repeat`,a=c.VectorKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/offset`:r=`normalMap.offset`,a=c.VectorKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/rotation`:r=`normalMap.rotation`,a=c.NumberKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/scale`:r=`emissiveMap.repeat`,a=c.VectorKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/offset`:r=`emissiveMap.offset`,a=c.VectorKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/rotation`:r=`emissiveMap.rotation`,a=c.NumberKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/scale`:r=`aoMap.repeat`,a=c.VectorKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/offset`:r=`aoMap.offset`,a=c.VectorKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/rotation`:r=`aoMap.rotation`,a=c.NumberKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale`:r=`clearcoatNormalMap.scale`,a=c.NumberKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset`:r=`clearcoatNormalMap.offset`,a=c.VectorKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation`:r=`clearcoatNormalMap.rotation`,a=c.NumberKeyframeTrack;break;default:break}if(!a)continue;let o=new a(`.materials.${i}.${r}`,u.array,m,h);if(s.push(o),r===`color`&&d.itemSize===4){let e=new Float32Array(m.length/4);for(let t=0,n=m.length/4;t<n;t+=1)e[t]=m[t*4+3];let t=new c.NumberKeyframeTrack(`.materials.${i}.opacity`,u.array,e,h);s.push(t)}}else if(e.indexOf(`/cameras/`)===0){let t=e.match(/^\/cameras\/(\d+)\/(.+)/);if(!t)continue;let n=Number(t[1]),r=t[2],i=this.json.cameras[n].name,a;switch(r){case`perspective/yfov`:r=`fov`,a=c.NumberKeyframeTrack;break;case`perspective/znear`:case`orthographic/znear`:r=`near`,a=c.NumberKeyframeTrack;break;case`perspective/zfar`:case`orthographic/zfar`:r=`far`,a=c.NumberKeyframeTrack;break;case`perspective/aspect`:r=`aspect`,a=c.NumberKeyframeTrack;break;default:break}if(!a)continue;let o=new a(`.cameras.${i}.${r}`,u.array,m,h);s.push(o)}}else{let e;switch(Ra[p.path]){case Ra.weights:e=c.NumberKeyframeTrack;break;case Ra.rotation:e=c.QuaternionKeyframeTrack;break;case Ra.position:case Ra.scale:default:e=c.VectorKeyframeTrack;break}let t=[];if(l){let e=l.name?l.name:l.uuid;Ra[p.path]===Ra.weights?l.traverse(e=>{e.morphTargetInfluences&&t.push(e.name?e.name:e.uuid)}):t.push(e)}let n=d.array;if(d.normalized){let e=Wa(n.constructor),t=new Float32Array(n.length);for(let r=0,i=n.length;r<i;r++)t[r]=n[r]*e;n=t}for(let r=0,i=t.length;r<i;r++){let i=new e(t[r]+`.`+Ra[p.path],u.array,n,h);s.push(i)}}}return new c.AnimationClip(r,void 0,s)})}return this.cache.set(n,i),i}loadBuffer(e){let t=this.json.buffers[e];if(t.type&&t.type!==`arraybuffer`)throw Error(`glTF: `+t.type+` buffer type is not supported.`);let n=`buffer:`+e,r=this.cache.get(n);if(r)return r;let i=null;for(let t of Va(this.extensions))if(i=t.loadBuffer(e,this),i)break;if(!i){let t=this.json.buffers[e];i=this.options.fetcher.ajax(this.resolveResouce(t.uri),{responseType:`arraybuffer`}).then(e=>e.body)}return this.cache.set(n,i),i}loadBufferView(e){let t=`bufferView:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadBufferView(e,this),r)break;if(!r){let t=this.json.bufferViews[e];r=this.loadBuffer(t.buffer).then(e=>{let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}return this.cache.set(t,r),r}loadAccessor(e){let t=`accessor:`+e,n=this.cache.get(t);if(n)return n;let r=null;if(!r){let t=this.json.accessors[e];if(t.bufferView===void 0&&t.sparse===void 0)r=Promise.resolve(null);else{let e=[];t.bufferView===void 0?e.push(Promise.resolve(null)):e.push(this.loadBufferView(t.bufferView)),t.sparse!==void 0&&(e.push(this.loadBufferView(t.sparse.indices.bufferView)),e.push(this.loadBufferView(t.sparse.values.bufferView))),r=Promise.all(e).then(e=>{let n=e[0],r=Ia[t.type],i=Na[t.componentType],a=i.BYTES_PER_ELEMENT,o=a*r,s=t.byteOffset||0,l=t.bufferView===void 0?void 0:this.json.bufferViews[t.bufferView].byteStride,u=t.normalized===!0,d,f;if(l&&l!==o){let e=Math.floor(s/l),o=`InterleavedBuffer:`+t.bufferView+`:`+t.componentType+`:`+e+`:`+t.count,p=this.cache.get(o);p||(d=new i(n,e*l,t.count*l/a),p=new c.InterleavedBuffer(d,l/a),this.cache.set(o,p)),f=new c.InterleavedBufferAttribute(p,r,s%l/a,u)}else d=n===null?new i(t.count*r):new i(n,s,t.count*r),f=new c.BufferAttribute(d,r,u);if(t.sparse!==void 0){let a=Ia.SCALAR,o=Na[t.sparse.indices.componentType],s=t.sparse.indices.byteOffset||0,l=t.sparse.values.byteOffset||0,u=new o(e[1],s,t.sparse.count*a),d=new i(e[2],l,t.sparse.count*r);n!==null&&(f=new c.BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let e=0,t=u.length;e<t;e++){let t=u[e];if(f.setX(t,d[e*r]),r>=2&&f.setY(t,d[e*r+1]),r>=3&&f.setZ(t,d[e*r+2]),r>=4&&f.setW(t,d[e*r+3]),r>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}}return f})}}return this.cache.set(t,r),r}createPrimitiveKey(e){for(let t of Va(this.extensions)){let n=t.createPrimitiveKey(e,this);if(n)return n}let t=``,n=Object.keys(e.attributes).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e.attributes[n[r]]+`;`;return e.indices+`:`+t+`:`+e.mode}loadGeometry(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadGeometry(e,this),t)break;return t||(t=this.addGeometryPrimitiveAttributes(new c.BufferGeometry,e)),t=t.then(e=>(this.disposeSet.add(e),e)),t}loadImage(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadImage(e,this),t)break;if(!t){let n=this.json.images[e];if(n.bufferView!==void 0){let e=this.json.bufferViews[n.bufferView];t=this.loadBuffer(e.buffer).then(t=>{let r=e.byteOffset||0,i=e.byteLength||0,a=new Uint8Array(t,r,i);return li(new Blob([a],{type:n.mimeType}))})}else if(n.uri){let e=this.resolveResouce(n.uri);t=si()?this.options.fetcher.ajax(e,{responseType:`blob`}).then(e=>{let t=e.body;return li(t)}):this.options.fetcher.loadImage(e,{},void 0,void 0,void 0,ci()).then(e=>e.body)}else throw Error(`glTF: Invalid image defs.`)}return t=t.then(e=>(this.disposeSet.add(e),e)),t}loadMesh(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadMesh(e,this),t)break;if(!t){let n=this.json.meshes[e],r=n.primitives,i=Promise.all(r.map(e=>this.loadGeometry(e))),a=Promise.all(r.map(e=>this.loadMaterial(e)));t=Promise.all([i,a]).then(([t,i])=>{var a;let o=[];for(let s=0;s<r.length;s++){let l=r[s],u=t[s],d=i[s],f=(a=l.mode)==null?Ma.TRIANGLES:a,p;if(f===Ma.TRIANGLES||f===Ma.TRIANGLE_STRIP||f===Ma.TRIANGLE_FAN)if(f===Ma.TRIANGLE_STRIP?u=this.toGeometryTrianglesDrawMode(u,c.TriangleStripDrawMode):f===Ma.TRIANGLE_FAN&&(u=this.toGeometryTrianglesDrawMode(u,c.TriangleFanDrawMode)),u.clearGroups(),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),this.disposeSet.add(u),n.isSkinnedMesh){let e=new bn(u,[d]);this.normalizeSkinWeights(e),p=e}else p=new yn(u,[d]);else if(f===Ma.LINES)p=new c.LineSegments(u,d);else if(f===Ma.LINE_STRIP)p=new c.Line(u,d);else if(f===Ma.LINE_LOOP)p=new c.LineLoop(u,d);else if(f===Ma.POINTS)p=new kn(u,d);else throw Error(`glTF: Primitive mode unsupported: `+f);if(Object.keys(u.morphAttributes).length>0){if(n.weights!==void 0)for(let e=0,t=n.weights.length;e<t;e++)p.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){let e=n.extras.targetNames;if(p.morphTargetInfluences.length===e.length){p.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++)p.morphTargetDictionary[e[t]]=t}else console.warn(`glTF: Invalid extras.targetNames length. Ignoring names.`)}}p.name=n.name||`mesh_`+e,this.assignFinalMaterial(p),o.push(p)}if(o.length===1)return o[0];let s=new c.Group;for(let e of o)s.add(e);return s})}return t}loadMaterial(e){var t;let n=(t=e.mode)==null?Ma.TRIANGLES:t,r=`material:`+this.createPrimitiveKey(e),i=this.cache.get(r);if(i)return i;let a=null;for(let t of Va(this.extensions))if(a=t.loadMaterial(e,this),a)break;if(!a){if(n===Ma.TRIANGLES||n===Ma.TRIANGLE_STRIP||n===Ma.TRIANGLE_FAN)a=this.loadMaterialAsPBMMeshMaterial(e);else if(n===Ma.LINES||n===Ma.LINE_STRIP||n===Ma.LINE_LOOP)a=this.loadMaterialAsLineBasicMaterial(e);else if(n===Ma.POINTS)a=this.loadMaterialAsPBMPointCloudMaterial(e);else throw Error(`glTF: Primitive mode unsupported: `+n);a=a.then(t=>Promise.all(Va(this.extensions).map(n=>n.extendMaterial(t,e,this))).then(()=>t))}return a}loadMaterialAsPBMPointCloudMaterial(e){let t=new On;return this.disposeSet.add(t),Promise.resolve(t)}loadMaterialAsPBMMeshMaterial(e){let t=[],n=new vn(`standard`);if(n.color=new c.Color(1,1,1),n.opacity=1,n.colorAlpha=1,e.material!==void 0){let r=this.json.materials[e.material];r.name&&(n.name=r.name);let i=r.pbrMetallicRoughness||{};if(Array.isArray(i.baseColorFactor)){let e=i.baseColorFactor;n.color=new c.Color().fromArray(e),n.colorAlpha=e[3]}i.baseColorTexture!==void 0&&t.push(this.createMaterialTexture(i.baseColorTexture).then(e=>{e.encoding=c.sRGBEncoding,n.map=e,r.alphaMode===Ba.MASK&&!(e instanceof c.CompressedTexture)&&e.minFilter!==c.LinearMipmapLinearFilter&&(e.minFilter=c.LinearMipmapLinearFilter,e.generateMipmaps=!0),this.disposeSet.add(e)})),n.metalness=i.metallicFactor===void 0?1:i.metallicFactor,n.roughness=i.roughnessFactor===void 0?1:i.roughnessFactor,i.metallicRoughnessTexture!==void 0&&t.push(this.createMaterialTexture(i.metallicRoughnessTexture).then(e=>{e.format=c.RGBFormat,n.roughnessMap=e,n.metalnessMap=e,this.disposeSet.add(e)})),r.doubleSided===!0&&(n.side=c.DoubleSide);let a=r.alphaMode||Ba.OPAQUE;if(n.alphaMode=`OPAQUE`,a===Ba.BLEND?(n.alphaMode=`BLEND`,n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,a===Ba.MASK&&(n.alphaMode=`MASK`,n.alphaTest=r.alphaCutoff===void 0?.5:r.alphaCutoff)),r.normalTexture!==void 0&&(t.push(this.createMaterialTexture(r.normalTexture).then(e=>{this.disposeSet.add(e),n.normalMap=e})),n.normalScale=new c.Vector2(1,1),r.normalTexture.scale!==void 0)){let e=r.normalTexture.scale;n.normalScale.set(e,e)}r.occlusionTexture!==void 0&&(t.push(this.createMaterialTexture(r.occlusionTexture).then(e=>{e.format=c.RGBFormat,n.aoMap=e,this.disposeSet.add(e)})),r.occlusionTexture.strength!==void 0&&(n.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&(n.emissive=new c.Color().fromArray(r.emissiveFactor)),r.emissiveTexture!==void 0&&t.push(this.createMaterialTexture(r.emissiveTexture).then(e=>{e.format=c.RGBFormat,n.emissiveMap=e,this.disposeSet.add(e)}))}return this.disposeSet.add(n),Promise.all(t).then(()=>n)}loadMaterialAsLineBasicMaterial(e){let t=[],n=new c.LineBasicMaterial;if(n.color=new c.Color(1,1,1),n.opacity=1,e.material!==void 0){let t=this.json.materials[e.material];t.name&&(n.name=t.name);let r=t.pbrMetallicRoughness||{};if(Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;n.color.fromArray(e),n.opacity=e[3]}t.doubleSided===!0&&(n.side=c.DoubleSide);let i=t.alphaMode||Ba.OPAQUE;i===Ba.BLEND?(n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,i===Ba.MASK&&(n.alphaTest=t.alphaCutoff===void 0?.5:t.alphaCutoff))}return this.disposeSet.add(n),Promise.all(t).then(()=>n)}loadTexture(e){let t=`texture:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadTexture(e,this),r)break;if(!r){let t=this.json.textures[e];r=this.loadImage(t.source).then(e=>{let n=new c.Texture(e);n.needsUpdate=!0,n.flipY=!1,t.name&&(n.name=t.name);let r=(this.json.samplers||{})[t.sampler]||{};return n.magFilter=Pa[r.magFilter]||c.LinearFilter,n.minFilter=Pa[r.minFilter]||c.LinearMipmapLinearFilter,n.wrapS=Fa[r.wrapS]||c.RepeatWrapping,n.wrapT=Fa[r.wrapT]||c.RepeatWrapping,n.onUpdate=function(){e.close()},n})}return r=r.then(e=>(this.disposeSet.add(e),e)),this.cache.set(t,r),r}normalizeSkinWeights(e){let t=e.geometry,n=t.attributes.skinWeight,r=1;if(n.array instanceof Uint8Array?r=255:n.array instanceof Uint16Array?r=65535:n.array instanceof Uint32Array&&(r=4294967295),r>1){let e=n.count,i=n.itemSize,a=n.normalized,o=new c.BufferAttribute(new Float32Array(e*i),i,a);for(let t=0;t<e;t++)o.setX(t,n.getX(t)/r),o.setY(t,n.getY(t)/r),o.setZ(t,n.getZ(t)/r),o.setW(t,n.getW(t)/r);t.attributes.skinWeight=o}n.normalized||e.normalizeSkinWeights()}assignFinalMaterial(e){let t=e.geometry,n=[].concat(e.material),r=t.attributes.tangent!==void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0,o=e instanceof c.SkinnedMesh,s=Object.keys(t.morphAttributes).length>0,l=s&&t.morphAttributes.normal!==void 0;n=n.map(e=>{if(r||i||a||o||s||l){let t=`cloned-material:`+e.uuid+`:`;r&&(t+=`vertex-tangents:`),i&&(t+=`vertex-colors:`),a&&(t+=`flat-shading:`),o&&(t+=`skinning:`),s&&(t+=`morph-targets:`),l&&(t+=`morph-normals:`);let n=this.cache.get(t);n||(n=e.clone(),r&&(n.vertexTangents=!0),i&&(n.vertexColors=!0),a&&(n.flatShading=!0),o&&(n.skinning=!0),s&&(n.morphTargets=!0),l&&(n.morphNormals=!0),r&&(n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.set(t,n)),e=n}return e}),Array.isArray(e.material)?e.material=n:e.material=n[0]}loadNodeAttachments(e){let t=[];for(let n of Va(this.extensions)){let r=n.loadNodeAttachments(e,this);r&&t.push(r)}return t}loadNode(e){let t=`node:`+e,n=this.cache.get(t);if(n)return n;let r=this.json.nodes[e],i=[];r.mesh!==void 0&&i.push(this.loadMesh(r.mesh).then(e=>{if(r.weights!==void 0){let t=r.weights;e.traverse(e=>{if(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)for(let n=0,r=t.length;n<r;n++)e.morphTargetInfluences[n]=t[n]})}return e})),r.camera!==void 0&&i.push(this.loadCamera(r.camera));let a=this.loadNodeAttachments(e);for(let e of a)i.push(e);let o=Promise.all(i).then(e=>{let t;if(t=r.isBone===!0?new c.Bone:e.length>1?new c.Group:e.length===1?e[0]:new c.Object3D,t!==e[0])for(let n=0,r=e.length;n<r;n++)t.add(e[n]);if(r.name&&(t.userData.name=r.name,t.name=c.PropertyBinding.sanitizeNodeName(r.name)),r.matrix!==void 0){let e=new c.Matrix4;e.fromArray(r.matrix),t.applyMatrix4(e)}else r.translation!==void 0&&t.position.fromArray(r.translation),r.rotation!==void 0&&t.quaternion.fromArray(r.rotation),r.scale!==void 0&&t.scale.fromArray(r.scale);return o=o.then(e=>Promise.all(Va(this.extensions).map(t=>t.extendNode(e,r,this))).then(()=>e)),t});return this.cache.set(t,o),o}loadScene(e){let t=this.json.scenes[e],n=new c.Group;t.name&&(n.name=t.name);let r=t.nodes||[],i=[];for(let e=0,t=r.length;e<t;e++)i.push(this.buildNodeHierarchy(r[e],n));return Promise.all(i).then(()=>n)}createMaterialTexture(e){return this.loadTexture(e.index).then(t=>{t instanceof c.CompressedTexture||(t.minFilter=c.LinearFilter,t.magFilter=c.LinearFilter,t.generateMipmaps=!1);for(let n of Va(this.extensions)){let r=n.extendTexture(t,e,this);r&&(t=r)}return this.textureSet.add(t),this.disposeSet.add(t),t})}addGeometryPrimitiveAttributes(e,t){let n=t.attributes,r=[];for(let t in n){let i=La[t]||t.toLowerCase();i in e.attributes||r.push(this.loadAccessor(n[t]).then(t=>{t&&e.setAttribute(i,t)}))}t.indices!==void 0&&!e.index&&r.push(this.loadAccessor(t.indices).then(t=>{t&&e.setIndex(t)}));let i=new c.Box3;if(n.POSITION!==void 0){let e=this.json.accessors[n.POSITION],t=e.min,r=e.max;if(t!==void 0&&r!==void 0){if(i.set(new c.Vector3(t[0],t[1],t[2]),new c.Vector3(r[0],r[1],r[2])),e.normalized){let t=Wa(Na[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else console.warn(`glTF: Missing min/max properties for accessor POSITION.`)}let a=t.targets;if(a!==void 0){let e=new c.Vector3,t=new c.Vector3;for(let n=0,r=a.length;n<r;n++){let r=a[n];if(r.POSITION!==void 0){let n=this.json.accessors[r.POSITION],i=n.min,a=n.max;if(i!==void 0&&a!==void 0){if(t.setX(Math.max(Math.abs(i[0]),Math.abs(a[0]))),t.setY(Math.max(Math.abs(i[1]),Math.abs(a[1]))),t.setZ(Math.max(Math.abs(i[2]),Math.abs(a[2]))),n.normalized){let e=Wa(Na[n.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`glTF: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new c.Sphere;return i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o,Promise.all(r).then(()=>{let n=!1;if(t.material!==void 0&&this.json.materials[t.material].occlusionTexture&&(n=!0),(n||this.options.copyUV2)&&e.attributes.uv&&!e.attributes.uv2&&e.setAttribute(`uv2`,e.attributes.uv),t.targets){let n=!1,r=!1;for(let e=0,i=t.targets.length;e<i;e++){let i=t.targets[e];if(i.POSITION!==void 0&&(n=!0),i.NORMAL!==void 0&&(r=!0),n&&r)break}if(!n&&!r)return e;let i=[];e.morphTargetsRelative=!0;for(let a=0,o=t.targets.length;a<o;a++){let o=t.targets[a];n?i.push(this.loadAccessor(o.POSITION).then(t=>{t&&(e.morphAttributes.position=e.morphAttributes.position||[],e.morphAttributes.position[a]=t)})):e.attributes.position&&(e.morphAttributes.position=e.morphAttributes.position||[],e.morphAttributes.position[a]=e.attributes.position),r?i.push(this.loadAccessor(o.NORMAL).then(t=>{t&&(e.morphAttributes.normal=e.morphAttributes.normal||[],e.morphAttributes.normal[a]=t)})):e.attributes.normal&&(e.morphAttributes.normal=e.morphAttributes.normal||[],e.morphAttributes.normal[a]=e.attributes.normal)}return Promise.all(i).then(()=>e)}else return e})}buildNodeHierarchy(e,t){let n=this.json.nodes[e];return this.loadNode(e).then(e=>{if(n.skin===void 0)return e;let t;return this.loadSkin(n.skin).then(e=>{t=e;let n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this.loadNode(t.joints[e]));return Promise.all(n)}).then(n=>(e.traverse(e=>{if(!(e instanceof c.SkinnedMesh))return;let r=[],i=[];for(let e=0,a=n.length;e<a;e++){let a=n[e];if(a instanceof c.Bone){r.push(a);let n=new c.Matrix4;t.inverseBindMatrices!==void 0&&n.fromArray(t.inverseBindMatrices.array,e*16),i.push(n)}else console.warn(`glTF: Joint "%s" could not be found.`,t.joints[e])}let a=new c.Skeleton(r,i);e.bind(a,e.matrixWorld)}),e))}).then(e=>{t.add(e);let r=[];if(n.children){let t=n.children;for(let n=0,i=t.length;n<i;n++){let i=t[n];r.push(this.buildNodeHierarchy(i,e))}}return Promise.all(r).then(()=>e)})}resolveResouce(e){return/^[a-z]{0,8}\:/i.test(e)?e:br(this.options.resourcePath,xr(e,this.options.search))}toGeometryTrianglesDrawMode(e,t){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}}if(n===null)return console.error(`glTF: Undefined position attribute. Processing not possible.`),e;let r=n.count-2,i=[];if(t===c.TriangleFanDrawMode)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error(`glTF: Unable to generate correct amount of triangles.`);let a=e.clone();return a.setIndex(i),this.disposeSet.add(a),a}};function Wa(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`glTF: Unsupported normalized accessor component type.`)}}var Ga=!1,Ka=null;function qa(){if(Ga)return;Ga=!0;let e=Ka||(Ka=c.PropertyBinding.findNode);c.PropertyBinding.findNode=function(t,n){if(!n)return e(t,n);if(n.startsWith(`.materials.`)){let e=n.substring(11).substring(n.indexOf(`.`)),r=e.indexOf(`.`),i=r<0?e:e.substring(0,r),a=r<0?null:e.slice(r+1),o=null;return t.traverse(e=>{if(o!==null||e.type!==`Mesh`&&e.type!==`SkinnedMesh`)return;let t=[].concat(e.material);for(let e of t)e&&(e.uuid===i||e.name===i)&&(o=e,o!==null&&a&&(o=o[a]))}),o}else if(n.startsWith(`.nodes.`)||n.startsWith(`.lights.`)||n.startsWith(`.cameras.`)){let r=n.split(`.`),i;for(let e=1;e<r.length;e++){let n=r[e];if(n.length==36)i=t.getObjectByProperty(`uuid`,n);else if(i&&i[n]){let e=Number.parseInt(n),t=n;e>=0&&(t=e),i=i[t]}else{let e=t.getObjectByName(n);e&&(i=e)}}if(!i){let i=e(t,r[2]);return i||console.warn(`KHR_animation_pointer: Property binding not found`,n,t,t.name,r),i}return i}let r=e(t,n);return r||(console.error(`THREE.PropertyBinding: Trying to update node for track: `+n+` but it wasn't found.`),r=new c.Object3D,r.name=n,r.visible=!1,t.add(r)),r=e(t,n),r}}qa();var Ja=class{markDefs(e){}prepare(e){}emitResult(e,t){}createPrimitiveKey(e,t){}extendTexture(e,t,n){return null}loadBuffer(e,t){return null}loadBufferView(e,t){return null}loadImage(e,t){return null}loadTexture(e,t){return null}loadGeometry(e,t){return null}loadMaterial(e,t){return null}extendMaterial(e,t,n){return Promise.resolve()}loadMesh(e,t){return null}extendNode(e,t,n){return Promise.resolve()}loadNodeAttachments(e,t){return null}loadCamera(e,t){return null}loadAnimation(e,t){return null}},Ya=`KHR_binary_glTF`,Xa=class e extends Ja{static getMagic(e){return ja(new Uint8Array(e.slice(0,4)))}constructor(){super(),this.header={magic:``,version:0,length:0},this.content=``,this.body=null}loadGlbBinary(t){let n=new DataView(t,0,e.HEADER_LENGTH);if(this.header={magic:e.getMagic(t),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==e.HEADER_MAGIC)throw Error(`glTF:KHR_binary_glTF: Unsupported.`);if(this.header.version<2)throw Error(`glTF:KHR_binary_glTF: Legacy binary file detected.`);let r=new DataView(t,e.HEADER_LENGTH),i=0,a=null,o=null;for(;i<r.byteLength;){let n=r.getUint32(i,!0);if(i+=4,n===0)continue;let s=r.getUint32(i,!0);if(i+=4,s===e.CHUNK_TYPES.JSON)a=ja(new Uint8Array(t,e.HEADER_LENGTH+i,n));else if(s===e.CHUNK_TYPES.BIN){let r=e.HEADER_LENGTH+i;o=t.slice(r,r+n)}i+=n}if(a===null)throw Error(`glTF:${Ya}: JSON content not found.`);this.content=a,this.body=o}loadBuffer(e,t){return t.json.buffers[e].uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null}clear(){this.body=null,this.content=``}};Xa.HEADER_MAGIC=`glTF`,Xa.HEADER_LENGTH=12,Xa.CHUNK_TYPES={JSON:1313821514,BIN:5130562};var Za=`https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/`,Qa={position:`POSITION`,normal:`NORMAL`,color:`COLOR`,uv:`TEX_COORD`},$a={position:`Float32Array`,normal:`Float32Array`,color:`Float32Array`,uv:`Float32Array`},eo=new class{constructor(){this.decoderPath=Za,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=``}setDecoderPath(e){this.decoderPath=e}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}decodeDracoFile(e,t,n,r){let i={attributeIDs:n||Qa,attributeTypes:r||$a,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t={attributeIDs:Qa,attributeTypes:$a,useUniqueIDs:!1}){for(let e in t.attributeTypes){let n=t.attributeTypes[e];n.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[e]=n.name)}let n,r=this.workerNextTaskID++,i=e.byteLength,a=this._getWorker(r,i).then(i=>(n=i,new Promise((i,a)=>{n._callbacks[r]={resolve:i,reject:a},n.postMessage({type:`decode`,id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),a}_createGeometry(e){let t=new c.BufferGeometry;e.index&&t.setIndex(new c.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n],i=r.name,a=r.array,o=r.itemSize,s=!(a instanceof Float32Array||a instanceof Float64Array);t.setAttribute(i,new c.BufferAttribute(a,o,s))}return t}_initDecoder(){if(this.decoderPending)return this.decoderPending;if(typeof WebAssembly!=`object`||this.decoderConfig.type===`js`)this.decoderPending=pr.ajax(this.decoderPath+`draco_decoder.js`,{responseType:`text`}).then(e=>e.body).then(e=>{let t=[`/* draco decoder */`,e,``,`/* worker */`,to].join(`
|
|
364
|
+
`,qi=typeof Worker<`u`&&typeof Blob<`u`,Ji=``;if(qi)try{let e=new Blob([Ki],{type:`text/javascript`});Ji=URL.createObjectURL(e)}catch(e){}var Yi=class{constructor(){if(!qi)throw Error(`LZMAWorker cannot work in this broswer.`);this.callCounter=0,this.requests={};let e=this.worker=new Worker(Ji);e.onmessage=e=>{let{id:t,result:n,error:r}=e.data,i=this.getKey(t);this.requests[i]&&(r?this.requests[i](Error(r)):this.requests[i](null,n),delete this.requests[i])},e.onerror=e=>console.error(e)}getKey(e){return`key_`+String(e)}decompress(e,t){let n=++this.callCounter;this.requests[this.getKey(n)]=t,this.worker.postMessage({type:`decompress`,id:n,data:e},[e.buffer])}terminate(){this.worker.terminate()}};Yi.support=qi;function Xi(e){return Array.prototype.reduce.call(e,(e,t,n)=>e|t<<n*8,0)}function Zi(e){let t=[],n=e.length;for(let i=0;i<n;i++){let n={data:e[i],offset:0,readByte(){return this.data[this.offset++]}},a=n.data.length,o={data:[],offset:0,writeByte(e){let t=Math.floor(this.offset/a);this.data[t]||(this.data[t]=new Uint8Array(a)),this.data[t][this.offset%a]=e,this.offset++}};Hi.decompressFile(n,o);var r=new Uint8Array(o.offset);for(let e=0;e<o.offset;e++)r[e]=o.data[Math.floor(e/a)][e%a];t.push(r)}return t}function Qi(e){let t=[],n=e.length;for(let r=0;r<n;r++)t.push(new Promise((t,n)=>{let i=new Yi;i.decompress(e[r],(e,r)=>{if(i.terminate(),e)return n(e);t(r)})}));return Promise.all(t)}function $i(e){let t=new Uint8Array(e),n=Xi(t.slice(0,4));if(n>10)return Promise.reject(Error(`LZMA got too many sub chunks.`));let r=[],i=[],a=4+n*4;for(let e=0;e<n;e++)i[e]=Xi(t.slice(4+e*4,8+e*4)),e===n-1?r[e]=t.subarray(a,a+i[e]):r[e]=t.slice(a,a+i[e]),a+=i[e];return Yi.support?Qi(r):Promise.resolve(Zi(r))}function ea(e,t={}){var n,r,i,a,o,s,l;let u=(n=t.upAxis)==null?`Z`:n,d=(r=t.light)==null?!1:r,f=(i=t.fetcher)==null?pr:i,p=(a=t.onDownloadProgress)==null?q:a,m=(o=t.textureBaseUri)==null?ji(e):o,h=t.textureBaseUri===void 0?[]:((s=t.textureArray)==null?[]:s).slice(),g=Bi((l=t.textureOptions)==null?{}:l,h.length),_=new Map;for(let e of h){let t=vr(e)?e:br(m,e);_.set(t,Ri(t,g,f))}let v={byteLength:0};return Promise.resolve().then(()=>f.ajax(e,{responseType:`arraybuffer`},void 0,void 0,p)).then(e=>$i(e.body)).then(e=>{let t={chunks:[],createAt:void 0,description:void 0};for(let n of e){let e=yi.decode(n);if(e.chunks.length){for(let n=0;n<e.chunks.length;n++)t.chunks.push(e.chunks[n]);t.createAt=e.createAt,t.description=e.description}}return t}).then(e=>zi(e,d,m,h,g,_,f)).then(t=>{_.clear();let n=new c.Group;n.name=e;for(let e of t.objects)n.add(e);return u===`Y`&&n.applyMatrix4(Zn),{type:`at3d`,modelUpAxis:`Z`,upAxis:u,uri:e,byteLength:v.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}var ta=l.Reader,na=l.util,Y=l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto`]||(l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto`]={}),ra=Y.Model=(()=>{function e(e){if(this.meshes=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.meshes=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Model;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.meshes&&i.meshes.length||(i.meshes=[]),i.meshes.push(Y.Mesh.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Model`},e})();Y.Mesh=(()=>{function e(e){if(this.chunks=[],this.matrix=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.name=``,e.prototype.chunks=na.emptyArray,e.prototype.matrix=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Mesh;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.name=e.string();break;case 2:i.chunks&&i.chunks.length||(i.chunks=[]),i.chunks.push(Y.Chunk.decode(e,e.uint32()));break;case 3:i.matrix&&i.matrix.length||(i.matrix=[]),i.matrix.push(Y.Matrix.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`name`))throw na.ProtocolError(`missing required 'name'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Mesh`},e})(),Y.Matrix=(()=>{function e(e){if(this.elements=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.elements=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Matrix;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.elements&&i.elements.length||(i.elements=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.elements.push(e.float())}else i.elements.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Matrix`},e})(),Y.Chunk=(()=>{function e(e){if(this.material=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.geometry=null,e.prototype.material=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Chunk;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 2:i.geometry=Y.Geometry.decode(e,e.uint32());break;case 3:i.material&&i.material.length||(i.material=[]),i.material.push(Y.Material.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`geometry`))throw na.ProtocolError(`missing required 'geometry'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Chunk`},e})(),Y.Geometry=(()=>{function e(e){if(this.groups=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.position=null,e.prototype.uv=null,e.prototype.uv2=null,e.prototype.normal=null,e.prototype.groups=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Geometry;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.position=Y.Position.decode(e,e.uint32());break;case 2:i.uv=Y.UV.decode(e,e.uint32());break;case 3:i.uv2=Y.UV.decode(e,e.uint32());break;case 4:i.normal=Y.Normal.decode(e,e.uint32());break;case 5:i.groups&&i.groups.length||(i.groups=[]),i.groups.push(Y.Group.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`position`))throw na.ProtocolError(`missing required 'position'`,{instance:i});if(!i.hasOwnProperty(`normal`))throw na.ProtocolError(`missing required 'normal'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Geometry`},e})(),Y.Position=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Position;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Position`},e})(),Y.UV=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.UV;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/UV`},e})(),Y.Normal=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Normal;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Normal`},e})(),Y.Group=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.start=0,e.prototype.count=0,e.prototype.materialIndex=0,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Group;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.start=e.uint32();break;case 2:i.count=e.uint32();break;case 3:i.materialIndex=e.uint32();break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`start`))throw na.ProtocolError(`missing required 'start'`,{instance:i});if(!i.hasOwnProperty(`count`))throw na.ProtocolError(`missing required 'count'`,{instance:i});if(!i.hasOwnProperty(`materialIndex`))throw na.ProtocolError(`missing required 'materialIndex'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Group`},e})(),Y.Material=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.kd=null,e.prototype.ks=null,e.prototype.ke=null,e.prototype.mapkd=``,e.prototype.mapks=``,e.prototype.mapke=``,e.prototype.norm=``,e.prototype.mapbump=``,e.prototype.bump=``,e.prototype.mapd=``,e.prototype.ns=0,e.prototype.d=0,e.prototype.tr=0,e.prototype.mapkdrepeat=``,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Material;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.kd=Y.Color.decode(e,e.uint32());break;case 2:i.ks=Y.Color.decode(e,e.uint32());break;case 3:i.ke=Y.Color.decode(e,e.uint32());break;case 4:i.mapkd=e.string();break;case 5:i.mapks=e.string();break;case 6:i.mapke=e.string();break;case 7:i.norm=e.string();break;case 8:i.mapbump=e.string();break;case 9:i.bump=e.string();break;case 10:i.mapd=e.string();break;case 11:i.ns=e.float();break;case 12:i.d=e.float();break;case 13:i.tr=e.float();break;case 14:i.mapkdrepeat=e.string();break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Material`},e})(),Y.Color=(()=>{function e(e){if(this.rgb=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.rgb=na.emptyArray,e.decode=function(e,t,n){e instanceof ta||(e=ta.create(e));let r=t===void 0?e.len:e.pos+t,i=new Y.Color;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.rgb&&i.rgb.length||(i.rgb=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.rgb.push(e.float())}else i.rgb.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Color`},e})();function ia(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(e=>{var n,r;return l.byteLength=e.body.byteLength,ua(new Uint8Array(e.body),(n=t.light)==null?!0:n,t.textureBaseUri||``,(r=t.textureOptions)==null?{}:r,o)}).then(t=>{let n=new c.Group;n.matrixAutoUpdate=!1,a===`Z`&&n.applyMatrix4(Xn),n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(let e of t.objects)n.add(e);return{type:`dome`,modelUpAxis:`Y`,upAxis:a,uri:e,byteLength:l.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}function aa(e){let t=[0,0,0];for(let n=0;n<e.attributes.normal.array.length/9;n++)t[0]=e.attributes.normal.array[n*9],t[1]=e.attributes.normal.array[n*9+1],t[2]=e.attributes.normal.array[n*9+2],e.attributes.normal.array[n*9]=e.attributes.normal.array[n*9+6],e.attributes.normal.array[n*9+1]=e.attributes.normal.array[n*9+7],e.attributes.normal.array[n*9+2]=e.attributes.normal.array[n*9+8],e.attributes.normal.array[n*9+6]=t[0],e.attributes.normal.array[n*9+7]=t[1],e.attributes.normal.array[n*9+8]=t[2];for(let n=0;n<e.attributes.position.array.length/9;n++)t[0]=e.attributes.position.array[n*9],t[1]=e.attributes.position.array[n*9+1],t[2]=e.attributes.position.array[n*9+2],e.attributes.position.array[n*9]=e.attributes.position.array[n*9+6],e.attributes.position.array[n*9+1]=e.attributes.position.array[n*9+7],e.attributes.position.array[n*9+2]=e.attributes.position.array[n*9+8],e.attributes.position.array[n*9+6]=t[0],e.attributes.position.array[n*9+7]=t[1],e.attributes.position.array[n*9+8]=t[2];for(let n=0;n<e.attributes.uv.array.length/6;n++)t[0]=e.attributes.uv.array[n*6],t[1]=e.attributes.uv.array[n*6+1],e.attributes.uv.array[n*6]=e.attributes.uv.array[n*6+4],e.attributes.uv.array[n*6+1]=e.attributes.uv.array[n*6+5],e.attributes.uv.array[n*6+4]=t[0],e.attributes.uv.array[n*6+5]=t[1];e.attributes.normal.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.uv.needsUpdate=!0}function oa({position:e,normal:t,uv:n,uv2:r,groups:i}){let a=new c.BufferGeometry;a.setAttribute(`position`,new c.BufferAttribute(new Float32Array(e.array),3)),t&&a.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(t.array),3)),n&&a.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(n.array),2)),r&&a.setAttribute(`uv2`,new c.BufferAttribute(new Float32Array(r.array),2));for(let e of i)a.addGroup(e.start,e.count,e.materialIndex);return a}function sa(e,t,n,r,i,a,o){if(o.hasOwnProperty(e))return o[e];e=e.split(`?`)[0],vr(e)||(e=br(t,e)),e=e.replace(/\/\/vrlab-image\d*.ljcdn.com\//,`//vrlab-public.ljcdn.com/`),e.indexOf(`//`)===0&&(e=`https:`+e);let s=Object.assign({key:`texture.dome`,size:64},mr(n,[`quality`,`format`,`sharpen`,`forceUseExifOrientation`,`mappings`]));return o[e]=i.loadTexture(e,{imageURL:{transform:n.transform,options:s},wrapS:c.RepeatWrapping,wrapT:c.RepeatWrapping,fetcher:a}).then(e=>{let t=e.body;return r&&t.repeat.copy(r),t.needsUpdate=!0,t.updateMatrix(),t})}function ca(e,t,n,r,i,a,o,s,l){let u=[],d=new vn(t?`phong`:`basic`);if(s.add(d),e.kd&&(d.color=new c.Color().fromArray(e.kd.rgb).convertLinearToSRGB()),e.mapkd){let t=null;if(e.mapkdrepeat){let[n,r]=e.mapkdrepeat.split(/\s+/).map(e=>Number(e));t=new c.Vector2(n,r)}u.push(sa(e.mapkd,n,r,t,i,a,o).then(e=>{e.encoding=c.sRGBEncoding,d.map=e,s.add(e),l.add(e),d.needsUpdate=!0}).catch(q))}if(e.ks&&(d.specular=new c.Color().fromArray(e.ks.rgb).convertLinearToSRGB()),e.mapks&&u.push(sa(e.mapks,n,r,null,i,a,o).then(e=>{d.specularMap=e,s.add(e),l.add(e)}).catch(q)),e.ke&&(d.emissive=new c.Color().fromArray(e.ke.rgb).convertLinearToSRGB()),e.mapke&&u.push(sa(e.mapke,n,r,null,i,a,o).then(e=>{e.encoding=c.sRGBEncoding,d.emissiveMap=e,s.add(e),l.add(e)}).catch(q)),e.norm&&u.push(sa(e.norm,n,r,null,i,a,o).then(e=>{d.normalMap=e,s.add(e),l.add(e)}).catch(q)),e.mapbump&&u.push(sa(e.mapbump,n,r,null,i,a,o).then(e=>{d.bumpMap=e,s.add(e),l.add(e)}).catch(q)),e.bump&&u.push(sa(e.bump,n,r,null,i,a,o).then(e=>{d.bumpMap=e,s.add(e),l.add(e)}).catch(q)),typeof e.ns==`number`&&(d.shininess=e.ns),typeof e.d==`number`){let t=e.d;t>0&&t<1&&(d.opacity=t)}return d.floorIndex=0,{material:d,textureReady:Promise.all(u).then(q)}}function la(e){return ra.decode(e).meshes}function ua(e,t,n,r,i){let a=[],o=[],s=new Set,l=la(e),u=new hi,d=new c.Matrix4,f=new c.Vector3,p=new c.Quaternion,m=new c.Vector3,h={},g=new Set;for(let{name:e,chunks:_,matrix:v}of l)if(!(e===`Ceiling`||e===`CeilingDrop`))for(let l of v){d.elements=l.elements;let v=new c.Group;for(let e=0;e<_.length;e++){let a=oa(_[e].geometry);a.applyMatrix4(d),d.decompose(f,p,m),m.x*m.y*m.z<0&&a.attributes.normal&&a.attributes.position&&a.attributes.uv&&aa(a),s.add(a);let c=[];for(let a of _[e].material){let{material:e,textureReady:l}=ca(a,t,n||``,r,u,i,h,s,g);o.push(l),c.push(e)}let l=new yn(a,c);l.name=`chunk_`+e,l.matrix.compose(l.position,l.quaternion,l.scale),l.matrixAutoUpdate=!1,l.frustumCulled=!1,v.add(l)}v.name=e,a.push(v)}return Promise.all(o).catch(q).then(()=>({createAt:0,description:``,objects:a,textures:Array.from(g),dispose:()=>{s.forEach(e=>{e.dispose()}),s.clear()}}))}function da(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(e=>(l.byteLength=e.body.byteLength,$i(e.body))).then(e=>{let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;return e.forEach(e=>{n.set(e,r),r+=e.length}),n}).then(e=>{var n,r;return ua(e,(n=t.light)==null?!0:n,t.textureBaseUri||``,(r=t.textureOptions)==null?{}:r,o)}).then(t=>{let n=new c.Group;n.matrixAutoUpdate=!1,a===`Z`&&n.applyMatrix4(Xn),n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(let e of t.objects)n.add(e);return{type:`domez`,modelUpAxis:`Y`,upAxis:`Z`,uri:e,byteLength:l.byteLength,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}var fa=4;function pa(e,t,n){let r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=fa,e.version=r.getUint32(n,!0),n+=fa,e.byteLength=r.getUint32(n,!0),n+=fa,e.version!==1)throw Error(`3D Tile Version ${e.version} not supported`);return n}var ma;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(ma||(ma={}));var ha={[ma.DOUBLE]:Float64Array,[ma.FLOAT]:Float32Array,[ma.UNSIGNED_SHORT]:Uint16Array,[ma.UNSIGNED_INT]:Uint32Array,[ma.UNSIGNED_BYTE]:Uint8Array,[ma.BYTE]:Int8Array,[ma.SHORT]:Int16Array,[ma.INT]:Int32Array},ga={DOUBLE:ma.DOUBLE,FLOAT:ma.FLOAT,UNSIGNED_SHORT:ma.UNSIGNED_SHORT,UNSIGNED_INT:ma.UNSIGNED_INT,UNSIGNED_BYTE:ma.UNSIGNED_BYTE,BYTE:ma.BYTE,SHORT:ma.SHORT,INT:ma.INT};function _a(e){let t=ha[e];if(!t)throw Error(`Failed to convert GL type`);return t}function va(e){return _a(e).BYTES_PER_ELEMENT}function ya(e,t,n=0,r){let i=_a(e);return n%va(e)===0?new i(t,n,r==null?(t.byteLength-n)/va(e):r):new i(r?t.slice(n,n+r*va(e)):t.slice(n))}function ba(e){let t=ga[e];if(!t)throw Error(`Failed to convert GL type`);return t}var xa=class{constructor(e,t){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=t;let n=this.getGlobalProperty(`POINTS_LENGTH`,ma.UNSIGNED_INT,1);n&&n.length&&(this.featuresLength=n[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(_a(t))([r]):Array.isArray(r)?new(_a(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=ba(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,o=a[e];return o||(o=ya(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=o),o}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=ya(t,n),r[e]=i),i}},Sa=4,Ca=`b3dm tile in legacy format.`;function wa(e,t,n){let r=new TextDecoder(`utf8`),i=new Uint8Array(e,t,n);return r.decode(i)}function Ta(e,t,n){return n=Ea(e,t,n),n=Da(e,t,n),n=Oa(e,t,n),n}function Ea(e,t,n){let r=new DataView(t),i=0;e.header=e.header||{};let a=r.getUint32(n,!0);n+=Sa;let o=r.getUint32(n,!0);n+=Sa;let s=r.getUint32(n,!0);n+=Sa;let c=r.getUint32(n,!0);return n+=Sa,s>=570425344?(n-=Sa*2,i=a,s=o,c=0,a=0,o=0,console.warn(Ca)):c>=570425344&&(n-=Sa,i=s,s=a,c=o,a=0,o=0,console.warn(Ca)),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=c,e.header.batchLength=i,n}function Da(e,t,n){let{featureTableJsonByteLength:r,featureTableBinaryByteLength:i,batchLength:a}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:a||0},r&&r>0){let i=wa(t,n,r);e.featureTableJson=JSON.parse(i)}n+=r||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0;let o=new xa(e.featureTableJson,e.featureTableBinary);if(Array.isArray(o.json.RTC_CENTER)){let t=o.json.RTC_CENTER;e.rtcCenter=[t[0],t[1],t[2]]}else{let t=o.getGlobalProperty(`RTC_CENTER`,ma.FLOAT,3);t&&(e.rtcCenter=[t[0],t[1],t[2]])}return n}function Oa(e,t,n){let{batchTableJsonByteLength:r,batchTableBinaryByteLength:i}=e.header||{};if(r&&r>0){let a=wa(t,n,r);e.batchTableJson=JSON.parse(a),n+=r,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,n,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=i)}return n}function ka(e,t,n){let r=n===void 0?new Uint8Array(e).subarray(t):new Uint8Array(e).subarray(t,t+n);return new Uint8Array(r).buffer}function Aa(e,t,n){let r=e.byteLength-n;if(r===0)throw Error(`glTF byte length must be greater than 0.`);return n%4!=0&&console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),e.gltfArrayBuffer=ka(t,n,r),e.byteLength}function ja(e){if(typeof TextDecoder<`u`)return new TextDecoder().decode(e);let t=``;for(let n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}var Ma={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Na={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Pa={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},Fa={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},Ia={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},La={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv2`,TEXCOORD_2:`uv3`,TEXCOORD_3:`uv4`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},Ra={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},za={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete},Ba={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`};function Va(e){let t=[];for(let n in e)t.push(e[n]);return t}function Ha(e){let t=Array.from(e);return()=>{for(let e of t)typeof e.dispose==`function`&&e.dispose(),typeof e.close==`function`&&e.close()}}var Ua=class{constructor(e,t,n){if(this.json=e,this.json.materials){let e=new Set;for(let t of this.json.materials){if(typeof t.name!=`string`)continue;let n=0;for(;t.name;){let r=t.name+(n>0?`__${n}`:``);if(!e.has(r)){e.add(r),t.name=r;break}console.warn(`glTF: material name "${t.name}" duplicated.`),n++}}e.clear()}if(this.json.nodes){let e=new Set;for(let t of this.json.nodes){if(typeof t.name!=`string`)continue;let n=0;for(;t.name;){let r=t.name+(n>0?`__${n}`:``);if(!e.has(r)){e.add(r),t.name=r;break}console.warn(`glTF: node name "${t.name}" duplicated.`),n++}}e.clear()}this.extensions=t,this.options=n,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}dispose(){this.cache.clear(),this.disposeSet.forEach(e=>{typeof e.dispose==`function`&&e.dispose(),typeof e.close==`function`&&e.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:`unknown`}}}markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)}}parse(){let e=this.json,t=this.extensions;this.markDefs();for(let e of Va(t))e.markDefs(this);return Promise.all(Va(t).map(e=>e.prepare(this))).then(()=>{var t,n,r;return Promise.all([Promise.all(((t=e.scenes)==null?[]:t).map((e,t)=>this.loadScene(t))),Promise.all(((n=e.cameras)==null?[]:n).map((e,t)=>this.loadCamera(t))),Promise.all(((r=e.animations)==null?[]:r).map((e,t)=>this.loadAnimation(t)))])}).then(([t,n,r])=>({json:e,scene:t[e.scene||0],scenes:t,animations:r,cameras:n,textures:[],dispose:q})).then(e=>Promise.all(Va(t).map(t=>t.emitResult(e,this))).then(()=>e)).then(e=>{let t=Array.from(this.textureSet),n=Ha(this.disposeSet);return Object.assign(e,{textures:t,dispose:n}),this.textureSet.clear(),this.disposeSet.clear(),this.dispose(),e})}loadCamera(e){let t=`camera:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadCamera(e,this),r)break;if(!r){let t,n=this.json.cameras[e],i=n[n.type];i?n.type===`perspective`?t=new c.PerspectiveCamera(c.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type===`orthographic`?t=new c.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar):(console.warn(`glTF: Invalid camera type ${n.type}.`),t=new c.Camera):(console.warn(`glTF: Missing camera parameters.`),t=new c.Camera),n.name&&(t.name=n.name),r=Promise.resolve(t)}return this.cache.set(t,r),r}loadSkin(e){let t=`skin:`+e,n=this.cache.get(t);if(n)return n;let r,i=this.json.skins[e],a={joints:i.joints};return r=i.inverseBindMatrices===void 0?Promise.resolve(a):this.loadAccessor(i.inverseBindMatrices).then(e=>(e&&(a.inverseBindMatrices=e),a)),this.cache.set(t,r),r}loadAnimation(e){var t;let n=`animation:`+e,r=this.cache.get(n);if(r)return r;let i=null;for(let t of Va(this.extensions))if(i=t.loadAnimation(e,this),i)break;if(!i){let n=this.json.animations[e],r=n.name?n.name:`animation_`+e,a=[],o=[],s=[],l=[],u=[];for(let e=0,r=n.channels.length;e<r;e++){let r=n.channels[e],i=n.samplers[r.sampler],c=r.target,d=c.node===void 0?c.id:c.node,f=n.parameters===void 0?i.input:n.parameters[i.input],p=n.parameters===void 0?i.output:n.parameters[i.output],m=(t=c.extensions)==null?{}:t;if(c.path===`pointer`&&m.KHR_animation_pointer&&m.KHR_animation_pointer.pointer&&/^\/nodes\/\d+\//.test(m.KHR_animation_pointer.pointer)){let e=m.KHR_animation_pointer.pointer.slice(1).split(`/`),t=Number(e[1]);a.push(this.loadNode(t))}else d===void 0?a.push(Promise.resolve(null)):a.push(this.loadNode(d));o.push(this.loadAccessor(f)),s.push(this.loadAccessor(p)),l.push(i),u.push(c)}i=Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(u)]).then(([e,t,n,i,a])=>{var o;let s=[];for(let r=0,l=e.length;r<l;r++){let l=e[r],u=t[r],d=n[r],f=i[r],p=a[r];l&&(l.updateMatrix(),l.matrixAutoUpdate=!0);let m=d.array;if(d.normalized){let e=Wa(m.constructor),t=new Float32Array(m.length);for(let n=0,r=m.length;n<r;n++)t[n]=m[n]*e;m=t}let h=f.interpolation===void 0?c.InterpolateLinear:za[f.interpolation],g=(o=p.extensions)==null?{}:o;if(g.KHR_animation_pointer&&p.path&&p.path===`pointer`){let e=g.KHR_animation_pointer.pointer;if(e.indexOf(`/nodes/`)===0){let t=e.match(/^\/nodes\/(\d+)\/(.+)/);if(!t)continue;Number(t[1]);let n=t[2],r;switch(n){case`weights`:n=`morphTargetInfluences`,r=c.NumberKeyframeTrack;break;case`rotation`:n=`quaternion`,r=c.QuaternionKeyframeTrack;break;case`translation`:n=`position`,r=c.VectorKeyframeTrack;break;case`scale`:n=`scale`,r=c.VectorKeyframeTrack;break;case`extensions/KHR_node_visibility/visible`:n=`visible`,r=c.BooleanKeyframeTrack;break;default:break}if(!r)continue;let i=[];if(l){let e=l.name?l.name:l.uuid;n===`morphTargetInfluences`?l.traverse(e=>{e.morphTargetInfluences&&i.push(e.name?e.name:e.uuid)}):i.push(e)}for(let e=0,t=i.length;e<t;e++){let t=new r(`.nodes.${i[e]}.${n}`,u.array,r===c.BooleanKeyframeTrack?Array.from(m).map(e=>e>0):m,h);s.push(t)}}else if(e.indexOf(`/materials/`)===0){let t=e.match(/^\/materials\/(\d+)\/(.+)/);if(!t)continue;let n=Number(t[1]),r=t[2],i=this.json.materials[n].name,a;switch(r){case`pbrMetallicRoughness/baseColorFactor`:r=`color`,a=c.ColorKeyframeTrack;break;case`pbrMetallicRoughness/roughnessFactor`:r=`roughness`,a=c.NumberKeyframeTrack;break;case`pbrMetallicRoughness/metallicFactor`:r=`metalness`,a=c.NumberKeyframeTrack;break;case`emissiveFactor`:r=`emissive`,a=c.NumberKeyframeTrack;break;case`alphaCutoff`:r=`alphaTest`,a=c.NumberKeyframeTrack;break;case`occlusionTexture/strength`:r=`aoMapIntensity`,a=c.NumberKeyframeTrack;break;case`normalTexture/scale`:r=`normalScale`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale`:r=`map.repeat`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset`:r=`map.offset`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation`:r=`map.rotation`,a=c.NumberKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/scale`:r=`normalMap.repeat`,a=c.VectorKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/offset`:r=`normalMap.offset`,a=c.VectorKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/rotation`:r=`normalMap.rotation`,a=c.NumberKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/scale`:r=`emissiveMap.repeat`,a=c.VectorKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/offset`:r=`emissiveMap.offset`,a=c.VectorKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/rotation`:r=`emissiveMap.rotation`,a=c.NumberKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/scale`:r=`aoMap.repeat`,a=c.VectorKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/offset`:r=`aoMap.offset`,a=c.VectorKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/rotation`:r=`aoMap.rotation`,a=c.NumberKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale`:r=`clearcoatNormalMap.scale`,a=c.NumberKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset`:r=`clearcoatNormalMap.offset`,a=c.VectorKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation`:r=`clearcoatNormalMap.rotation`,a=c.NumberKeyframeTrack;break;default:break}if(!a)continue;let o=new a(`.materials.${i}.${r}`,u.array,m,h);if(s.push(o),r===`color`&&d.itemSize===4){let e=new Float32Array(m.length/4);for(let t=0,n=m.length/4;t<n;t+=1)e[t]=m[t*4+3];let t=new c.NumberKeyframeTrack(`.materials.${i}.opacity`,u.array,e,h);s.push(t)}}else if(e.indexOf(`/cameras/`)===0){let t=e.match(/^\/cameras\/(\d+)\/(.+)/);if(!t)continue;let n=Number(t[1]),r=t[2],i=this.json.cameras[n].name,a;switch(r){case`perspective/yfov`:r=`fov`,a=c.NumberKeyframeTrack;break;case`perspective/znear`:case`orthographic/znear`:r=`near`,a=c.NumberKeyframeTrack;break;case`perspective/zfar`:case`orthographic/zfar`:r=`far`,a=c.NumberKeyframeTrack;break;case`perspective/aspect`:r=`aspect`,a=c.NumberKeyframeTrack;break;default:break}if(!a)continue;let o=new a(`.cameras.${i}.${r}`,u.array,m,h);s.push(o)}}else{let e;switch(Ra[p.path]){case Ra.weights:e=c.NumberKeyframeTrack;break;case Ra.rotation:e=c.QuaternionKeyframeTrack;break;case Ra.position:case Ra.scale:default:e=c.VectorKeyframeTrack;break}let t=[];if(l){let e=l.name?l.name:l.uuid;Ra[p.path]===Ra.weights?l.traverse(e=>{e.morphTargetInfluences&&t.push(e.name?e.name:e.uuid)}):t.push(e)}let n=d.array;if(d.normalized){let e=Wa(n.constructor),t=new Float32Array(n.length);for(let r=0,i=n.length;r<i;r++)t[r]=n[r]*e;n=t}for(let r=0,i=t.length;r<i;r++){let i=new e(t[r]+`.`+Ra[p.path],u.array,n,h);s.push(i)}}}return new c.AnimationClip(r,void 0,s)})}return this.cache.set(n,i),i}loadBuffer(e){let t=this.json.buffers[e];if(t.type&&t.type!==`arraybuffer`)throw Error(`glTF: `+t.type+` buffer type is not supported.`);let n=`buffer:`+e,r=this.cache.get(n);if(r)return r;let i=null;for(let t of Va(this.extensions))if(i=t.loadBuffer(e,this),i)break;if(!i){let t=this.json.buffers[e];i=this.options.fetcher.ajax(this.resolveResouce(t.uri),{responseType:`arraybuffer`}).then(e=>e.body)}return this.cache.set(n,i),i}loadBufferView(e){let t=`bufferView:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadBufferView(e,this),r)break;if(!r){let t=this.json.bufferViews[e];r=this.loadBuffer(t.buffer).then(e=>{let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}return this.cache.set(t,r),r}loadAccessor(e){let t=`accessor:`+e,n=this.cache.get(t);if(n)return n;let r=null;if(!r){let t=this.json.accessors[e];if(t.bufferView===void 0&&t.sparse===void 0)r=Promise.resolve(null);else{let e=[];t.bufferView===void 0?e.push(Promise.resolve(null)):e.push(this.loadBufferView(t.bufferView)),t.sparse!==void 0&&(e.push(this.loadBufferView(t.sparse.indices.bufferView)),e.push(this.loadBufferView(t.sparse.values.bufferView))),r=Promise.all(e).then(e=>{let n=e[0],r=Ia[t.type],i=Na[t.componentType],a=i.BYTES_PER_ELEMENT,o=a*r,s=t.byteOffset||0,l=t.bufferView===void 0?void 0:this.json.bufferViews[t.bufferView].byteStride,u=t.normalized===!0,d,f;if(l&&l!==o){let e=Math.floor(s/l),o=`InterleavedBuffer:`+t.bufferView+`:`+t.componentType+`:`+e+`:`+t.count,p=this.cache.get(o);p||(d=new i(n,e*l,t.count*l/a),p=new c.InterleavedBuffer(d,l/a),this.cache.set(o,p)),f=new c.InterleavedBufferAttribute(p,r,s%l/a,u)}else d=n===null?new i(t.count*r):new i(n,s,t.count*r),f=new c.BufferAttribute(d,r,u);if(t.sparse!==void 0){let a=Ia.SCALAR,o=Na[t.sparse.indices.componentType],s=t.sparse.indices.byteOffset||0,l=t.sparse.values.byteOffset||0,u=new o(e[1],s,t.sparse.count*a),d=new i(e[2],l,t.sparse.count*r);n!==null&&(f=new c.BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let e=0,t=u.length;e<t;e++){let t=u[e];if(f.setX(t,d[e*r]),r>=2&&f.setY(t,d[e*r+1]),r>=3&&f.setZ(t,d[e*r+2]),r>=4&&f.setW(t,d[e*r+3]),r>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}}return f})}}return this.cache.set(t,r),r}createPrimitiveKey(e){for(let t of Va(this.extensions)){let n=t.createPrimitiveKey(e,this);if(n)return n}let t=``,n=Object.keys(e.attributes).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e.attributes[n[r]]+`;`;return e.indices+`:`+t+`:`+e.mode}loadGeometry(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadGeometry(e,this),t)break;return t||(t=this.addGeometryPrimitiveAttributes(new c.BufferGeometry,e)),t=t.then(e=>(this.disposeSet.add(e),e)),t}loadImage(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadImage(e,this),t)break;if(!t){let n=this.json.images[e];if(n.bufferView!==void 0){let e=this.json.bufferViews[n.bufferView];t=this.loadBuffer(e.buffer).then(t=>{let r=e.byteOffset||0,i=e.byteLength||0;return li(new Blob([new Uint8Array(t,r,i)],{type:n.mimeType}))})}else if(n.uri){let e=this.resolveResouce(n.uri);t=si()?this.options.fetcher.ajax(e,{responseType:`blob`}).then(e=>{let t=e.body;return li(t)}):this.options.fetcher.loadImage(e,{},void 0,void 0,void 0,ci()).then(e=>e.body)}else throw Error(`glTF: Invalid image defs.`)}return t=t.then(e=>(this.disposeSet.add(e),e)),t}loadMesh(e){let t=null;for(let n of Va(this.extensions))if(t=n.loadMesh(e,this),t)break;if(!t){let n=this.json.meshes[e],r=n.primitives,i=Promise.all(r.map(e=>this.loadGeometry(e))),a=Promise.all(r.map(e=>this.loadMaterial(e)));t=Promise.all([i,a]).then(([t,i])=>{var a;let o=[];for(let s=0;s<r.length;s++){let l=r[s],u=t[s],d=i[s],f=(a=l.mode)==null?Ma.TRIANGLES:a,p;if(f===Ma.TRIANGLES||f===Ma.TRIANGLE_STRIP||f===Ma.TRIANGLE_FAN)if(f===Ma.TRIANGLE_STRIP?u=this.toGeometryTrianglesDrawMode(u,c.TriangleStripDrawMode):f===Ma.TRIANGLE_FAN&&(u=this.toGeometryTrianglesDrawMode(u,c.TriangleFanDrawMode)),u.clearGroups(),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),this.disposeSet.add(u),n.isSkinnedMesh){let e=new bn(u,[d]);this.normalizeSkinWeights(e),p=e}else p=new yn(u,[d]);else if(f===Ma.LINES)p=new c.LineSegments(u,d);else if(f===Ma.LINE_STRIP)p=new c.Line(u,d);else if(f===Ma.LINE_LOOP)p=new c.LineLoop(u,d);else if(f===Ma.POINTS)p=new kn(u,d);else throw Error(`glTF: Primitive mode unsupported: `+f);if(Object.keys(u.morphAttributes).length>0){if(n.weights!==void 0)for(let e=0,t=n.weights.length;e<t;e++)p.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){let e=n.extras.targetNames;if(p.morphTargetInfluences.length===e.length){p.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++)p.morphTargetDictionary[e[t]]=t}else console.warn(`glTF: Invalid extras.targetNames length. Ignoring names.`)}}p.name=n.name||`mesh_`+e,this.assignFinalMaterial(p),o.push(p)}if(o.length===1)return o[0];let s=new c.Group;for(let e of o)s.add(e);return s})}return t}loadMaterial(e){var t;let n=(t=e.mode)==null?Ma.TRIANGLES:t,r=`material:`+this.createPrimitiveKey(e),i=this.cache.get(r);if(i)return i;let a=null;for(let t of Va(this.extensions))if(a=t.loadMaterial(e,this),a)break;if(!a){if(n===Ma.TRIANGLES||n===Ma.TRIANGLE_STRIP||n===Ma.TRIANGLE_FAN)a=this.loadMaterialAsPBMMeshMaterial(e);else if(n===Ma.LINES||n===Ma.LINE_STRIP||n===Ma.LINE_LOOP)a=this.loadMaterialAsLineBasicMaterial(e);else if(n===Ma.POINTS)a=this.loadMaterialAsPBMPointCloudMaterial(e);else throw Error(`glTF: Primitive mode unsupported: `+n);a=a.then(t=>Promise.all(Va(this.extensions).map(n=>n.extendMaterial(t,e,this))).then(()=>t))}return a}loadMaterialAsPBMPointCloudMaterial(e){let t=new On;return this.disposeSet.add(t),Promise.resolve(t)}loadMaterialAsPBMMeshMaterial(e){let t=[],n=new vn(`standard`);if(n.color=new c.Color(1,1,1),n.opacity=1,n.colorAlpha=1,e.material!==void 0){let r=this.json.materials[e.material];r.name&&(n.name=r.name);let i=r.pbrMetallicRoughness||{};if(Array.isArray(i.baseColorFactor)){let e=i.baseColorFactor;n.color=new c.Color().fromArray(e),n.colorAlpha=e[3]}i.baseColorTexture!==void 0&&t.push(this.createMaterialTexture(i.baseColorTexture).then(e=>{e.encoding=c.sRGBEncoding,n.map=e,r.alphaMode===Ba.MASK&&!(e instanceof c.CompressedTexture)&&e.minFilter!==c.LinearMipmapLinearFilter&&(e.minFilter=c.LinearMipmapLinearFilter,e.generateMipmaps=!0),this.disposeSet.add(e)})),n.metalness=i.metallicFactor===void 0?1:i.metallicFactor,n.roughness=i.roughnessFactor===void 0?1:i.roughnessFactor,i.metallicRoughnessTexture!==void 0&&t.push(this.createMaterialTexture(i.metallicRoughnessTexture).then(e=>{e.format=c.RGBFormat,n.roughnessMap=e,n.metalnessMap=e,this.disposeSet.add(e)})),r.doubleSided===!0&&(n.side=c.DoubleSide);let a=r.alphaMode||Ba.OPAQUE;if(n.alphaMode=`OPAQUE`,a===Ba.BLEND?(n.alphaMode=`BLEND`,n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,a===Ba.MASK&&(n.alphaMode=`MASK`,n.alphaTest=r.alphaCutoff===void 0?.5:r.alphaCutoff)),r.normalTexture!==void 0&&(t.push(this.createMaterialTexture(r.normalTexture).then(e=>{this.disposeSet.add(e),n.normalMap=e})),n.normalScale=new c.Vector2(1,1),r.normalTexture.scale!==void 0)){let e=r.normalTexture.scale;n.normalScale.set(e,e)}r.occlusionTexture!==void 0&&(t.push(this.createMaterialTexture(r.occlusionTexture).then(e=>{e.format=c.RGBFormat,n.aoMap=e,this.disposeSet.add(e)})),r.occlusionTexture.strength!==void 0&&(n.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&(n.emissive=new c.Color().fromArray(r.emissiveFactor)),r.emissiveTexture!==void 0&&t.push(this.createMaterialTexture(r.emissiveTexture).then(e=>{e.format=c.RGBFormat,n.emissiveMap=e,this.disposeSet.add(e)}))}return this.disposeSet.add(n),Promise.all(t).then(()=>n)}loadMaterialAsLineBasicMaterial(e){let t=[],n=new c.LineBasicMaterial;if(n.color=new c.Color(1,1,1),n.opacity=1,e.material!==void 0){let t=this.json.materials[e.material];t.name&&(n.name=t.name);let r=t.pbrMetallicRoughness||{};if(Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;n.color.fromArray(e),n.opacity=e[3]}t.doubleSided===!0&&(n.side=c.DoubleSide);let i=t.alphaMode||Ba.OPAQUE;i===Ba.BLEND?(n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,i===Ba.MASK&&(n.alphaTest=t.alphaCutoff===void 0?.5:t.alphaCutoff))}return this.disposeSet.add(n),Promise.all(t).then(()=>n)}loadTexture(e){let t=`texture:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Va(this.extensions))if(r=t.loadTexture(e,this),r)break;if(!r){let t=this.json.textures[e];r=this.loadImage(t.source).then(e=>{let n=new c.Texture(e);n.needsUpdate=!0,n.flipY=!1,t.name&&(n.name=t.name);let r=(this.json.samplers||{})[t.sampler]||{};return n.magFilter=Pa[r.magFilter]||c.LinearFilter,n.minFilter=Pa[r.minFilter]||c.LinearMipmapLinearFilter,n.wrapS=Fa[r.wrapS]||c.RepeatWrapping,n.wrapT=Fa[r.wrapT]||c.RepeatWrapping,n.onUpdate=function(){e.close()},n})}return r=r.then(e=>(this.disposeSet.add(e),e)),this.cache.set(t,r),r}normalizeSkinWeights(e){let t=e.geometry,n=t.attributes.skinWeight,r=1;if(n.array instanceof Uint8Array?r=255:n.array instanceof Uint16Array?r=65535:n.array instanceof Uint32Array&&(r=4294967295),r>1){let e=n.count,i=n.itemSize,a=n.normalized,o=new c.BufferAttribute(new Float32Array(e*i),i,a);for(let t=0;t<e;t++)o.setX(t,n.getX(t)/r),o.setY(t,n.getY(t)/r),o.setZ(t,n.getZ(t)/r),o.setW(t,n.getW(t)/r);t.attributes.skinWeight=o}n.normalized||e.normalizeSkinWeights()}assignFinalMaterial(e){let t=e.geometry,n=[].concat(e.material),r=t.attributes.tangent!==void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0,o=e instanceof c.SkinnedMesh,s=Object.keys(t.morphAttributes).length>0,l=s&&t.morphAttributes.normal!==void 0;n=n.map(e=>{if(r||i||a||o||s||l){let t=`cloned-material:`+e.uuid+`:`;r&&(t+=`vertex-tangents:`),i&&(t+=`vertex-colors:`),a&&(t+=`flat-shading:`),o&&(t+=`skinning:`),s&&(t+=`morph-targets:`),l&&(t+=`morph-normals:`);let n=this.cache.get(t);n||(n=e.clone(),r&&(n.vertexTangents=!0),i&&(n.vertexColors=!0),a&&(n.flatShading=!0),o&&(n.skinning=!0),s&&(n.morphTargets=!0),l&&(n.morphNormals=!0),r&&(n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.set(t,n)),e=n}return e}),Array.isArray(e.material)?e.material=n:e.material=n[0]}loadNodeAttachments(e){let t=[];for(let n of Va(this.extensions)){let r=n.loadNodeAttachments(e,this);r&&t.push(r)}return t}loadNode(e){let t=`node:`+e,n=this.cache.get(t);if(n)return n;let r=this.json.nodes[e],i=[];r.mesh!==void 0&&i.push(this.loadMesh(r.mesh).then(e=>{if(r.weights!==void 0){let t=r.weights;e.traverse(e=>{if(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)for(let n=0,r=t.length;n<r;n++)e.morphTargetInfluences[n]=t[n]})}return e})),r.camera!==void 0&&i.push(this.loadCamera(r.camera));let a=this.loadNodeAttachments(e);for(let e of a)i.push(e);let o=Promise.all(i).then(e=>{let t;if(t=r.isBone===!0?new c.Bone:e.length>1?new c.Group:e.length===1?e[0]:new c.Object3D,t!==e[0])for(let n=0,r=e.length;n<r;n++)t.add(e[n]);if(r.name&&(t.userData.name=r.name,t.name=c.PropertyBinding.sanitizeNodeName(r.name)),r.matrix!==void 0){let e=new c.Matrix4;e.fromArray(r.matrix),t.applyMatrix4(e)}else r.translation!==void 0&&t.position.fromArray(r.translation),r.rotation!==void 0&&t.quaternion.fromArray(r.rotation),r.scale!==void 0&&t.scale.fromArray(r.scale);return o=o.then(e=>Promise.all(Va(this.extensions).map(t=>t.extendNode(e,r,this))).then(()=>e)),t});return this.cache.set(t,o),o}loadScene(e){let t=this.json.scenes[e],n=new c.Group;t.name&&(n.name=t.name);let r=t.nodes||[],i=[];for(let e=0,t=r.length;e<t;e++)i.push(this.buildNodeHierarchy(r[e],n));return Promise.all(i).then(()=>n)}createMaterialTexture(e){return this.loadTexture(e.index).then(t=>{t instanceof c.CompressedTexture||(t.minFilter=c.LinearFilter,t.magFilter=c.LinearFilter,t.generateMipmaps=!1);for(let n of Va(this.extensions)){let r=n.extendTexture(t,e,this);r&&(t=r)}return this.textureSet.add(t),this.disposeSet.add(t),t})}addGeometryPrimitiveAttributes(e,t){let n=t.attributes,r=[];for(let t in n){let i=La[t]||t.toLowerCase();i in e.attributes||r.push(this.loadAccessor(n[t]).then(t=>{t&&e.setAttribute(i,t)}))}t.indices!==void 0&&!e.index&&r.push(this.loadAccessor(t.indices).then(t=>{t&&e.setIndex(t)}));let i=new c.Box3;if(n.POSITION!==void 0){let e=this.json.accessors[n.POSITION],t=e.min,r=e.max;if(t!==void 0&&r!==void 0){if(i.set(new c.Vector3(t[0],t[1],t[2]),new c.Vector3(r[0],r[1],r[2])),e.normalized){let t=Wa(Na[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else console.warn(`glTF: Missing min/max properties for accessor POSITION.`)}let a=t.targets;if(a!==void 0){let e=new c.Vector3,t=new c.Vector3;for(let n=0,r=a.length;n<r;n++){let r=a[n];if(r.POSITION!==void 0){let n=this.json.accessors[r.POSITION],i=n.min,a=n.max;if(i!==void 0&&a!==void 0){if(t.setX(Math.max(Math.abs(i[0]),Math.abs(a[0]))),t.setY(Math.max(Math.abs(i[1]),Math.abs(a[1]))),t.setZ(Math.max(Math.abs(i[2]),Math.abs(a[2]))),n.normalized){let e=Wa(Na[n.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`glTF: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new c.Sphere;return i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o,Promise.all(r).then(()=>{let n=!1;if(t.material!==void 0&&this.json.materials[t.material].occlusionTexture&&(n=!0),(n||this.options.copyUV2)&&e.attributes.uv&&!e.attributes.uv2&&e.setAttribute(`uv2`,e.attributes.uv),t.targets){let n=!1,r=!1;for(let e=0,i=t.targets.length;e<i;e++){let i=t.targets[e];if(i.POSITION!==void 0&&(n=!0),i.NORMAL!==void 0&&(r=!0),n&&r)break}if(!n&&!r)return e;let i=[];e.morphTargetsRelative=!0;for(let a=0,o=t.targets.length;a<o;a++){let o=t.targets[a];n?i.push(this.loadAccessor(o.POSITION).then(t=>{t&&(e.morphAttributes.position=e.morphAttributes.position||[],e.morphAttributes.position[a]=t)})):e.attributes.position&&(e.morphAttributes.position=e.morphAttributes.position||[],e.morphAttributes.position[a]=e.attributes.position),r?i.push(this.loadAccessor(o.NORMAL).then(t=>{t&&(e.morphAttributes.normal=e.morphAttributes.normal||[],e.morphAttributes.normal[a]=t)})):e.attributes.normal&&(e.morphAttributes.normal=e.morphAttributes.normal||[],e.morphAttributes.normal[a]=e.attributes.normal)}return Promise.all(i).then(()=>e)}else return e})}buildNodeHierarchy(e,t){let n=this.json.nodes[e];return this.loadNode(e).then(e=>{if(n.skin===void 0)return e;let t;return this.loadSkin(n.skin).then(e=>{t=e;let n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this.loadNode(t.joints[e]));return Promise.all(n)}).then(n=>(e.traverse(e=>{if(!(e instanceof c.SkinnedMesh))return;let r=[],i=[];for(let e=0,a=n.length;e<a;e++){let a=n[e];if(a instanceof c.Bone){r.push(a);let n=new c.Matrix4;t.inverseBindMatrices!==void 0&&n.fromArray(t.inverseBindMatrices.array,e*16),i.push(n)}else console.warn(`glTF: Joint "%s" could not be found.`,t.joints[e])}let a=new c.Skeleton(r,i);e.bind(a,e.matrixWorld)}),e))}).then(e=>{t.add(e);let r=[];if(n.children){let t=n.children;for(let n=0,i=t.length;n<i;n++){let i=t[n];r.push(this.buildNodeHierarchy(i,e))}}return Promise.all(r).then(()=>e)})}resolveResouce(e){return/^[a-z]{0,8}\:/i.test(e)?e:br(this.options.resourcePath,xr(e,this.options.search))}toGeometryTrianglesDrawMode(e,t){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}}if(n===null)return console.error(`glTF: Undefined position attribute. Processing not possible.`),e;let r=n.count-2,i=[];if(t===c.TriangleFanDrawMode)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error(`glTF: Unable to generate correct amount of triangles.`);let a=e.clone();return a.setIndex(i),this.disposeSet.add(a),a}};function Wa(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`glTF: Unsupported normalized accessor component type.`)}}var Ga=!1,Ka=null;function qa(){if(Ga)return;Ga=!0;let e=Ka||(Ka=c.PropertyBinding.findNode);c.PropertyBinding.findNode=function(t,n){if(!n)return e(t,n);if(n.startsWith(`.materials.`)){let e=n.substring(11).substring(n.indexOf(`.`)),r=e.indexOf(`.`),i=r<0?e:e.substring(0,r),a=r<0?null:e.slice(r+1),o=null;return t.traverse(e=>{if(o!==null||e.type!==`Mesh`&&e.type!==`SkinnedMesh`)return;let t=[].concat(e.material);for(let e of t)e&&(e.uuid===i||e.name===i)&&(o=e,o!==null&&a&&(o=o[a]))}),o}else if(n.startsWith(`.nodes.`)||n.startsWith(`.lights.`)||n.startsWith(`.cameras.`)){let r=n.split(`.`),i;for(let e=1;e<r.length;e++){let n=r[e];if(n.length==36)i=t.getObjectByProperty(`uuid`,n);else if(i&&i[n]){let e=Number.parseInt(n),t=n;e>=0&&(t=e),i=i[t]}else{let e=t.getObjectByName(n);e&&(i=e)}}if(!i){let i=e(t,r[2]);return i||console.warn(`KHR_animation_pointer: Property binding not found`,n,t,t.name,r),i}return i}let r=e(t,n);return r||(console.error(`THREE.PropertyBinding: Trying to update node for track: `+n+` but it wasn't found.`),r=new c.Object3D,r.name=n,r.visible=!1,t.add(r)),r=e(t,n),r}}qa();var Ja=class{markDefs(e){}prepare(e){}emitResult(e,t){}createPrimitiveKey(e,t){}extendTexture(e,t,n){return null}loadBuffer(e,t){return null}loadBufferView(e,t){return null}loadImage(e,t){return null}loadTexture(e,t){return null}loadGeometry(e,t){return null}loadMaterial(e,t){return null}extendMaterial(e,t,n){return Promise.resolve()}loadMesh(e,t){return null}extendNode(e,t,n){return Promise.resolve()}loadNodeAttachments(e,t){return null}loadCamera(e,t){return null}loadAnimation(e,t){return null}},Ya=`KHR_binary_glTF`,Xa=class e extends Ja{static getMagic(e){return ja(new Uint8Array(e.slice(0,4)))}constructor(){super(),this.header={magic:``,version:0,length:0},this.content=``,this.body=null}loadGlbBinary(t){let n=new DataView(t,0,e.HEADER_LENGTH);if(this.header={magic:e.getMagic(t),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==e.HEADER_MAGIC)throw Error(`glTF:KHR_binary_glTF: Unsupported.`);if(this.header.version<2)throw Error(`glTF:KHR_binary_glTF: Legacy binary file detected.`);let r=new DataView(t,e.HEADER_LENGTH),i=0,a=null,o=null;for(;i<r.byteLength;){let n=r.getUint32(i,!0);if(i+=4,n===0)continue;let s=r.getUint32(i,!0);if(i+=4,s===e.CHUNK_TYPES.JSON)a=ja(new Uint8Array(t,e.HEADER_LENGTH+i,n));else if(s===e.CHUNK_TYPES.BIN){let r=e.HEADER_LENGTH+i;o=t.slice(r,r+n)}i+=n}if(a===null)throw Error(`glTF:${Ya}: JSON content not found.`);this.content=a,this.body=o}loadBuffer(e,t){return t.json.buffers[e].uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null}clear(){this.body=null,this.content=``}};Xa.HEADER_MAGIC=`glTF`,Xa.HEADER_LENGTH=12,Xa.CHUNK_TYPES={JSON:1313821514,BIN:5130562};var Za=`https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/`,Qa={position:`POSITION`,normal:`NORMAL`,color:`COLOR`,uv:`TEX_COORD`},$a={position:`Float32Array`,normal:`Float32Array`,color:`Float32Array`,uv:`Float32Array`},eo=new class{constructor(){this.decoderPath=Za,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=``}setDecoderPath(e){this.decoderPath=e}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}decodeDracoFile(e,t,n,r){let i={attributeIDs:n||Qa,attributeTypes:r||$a,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t={attributeIDs:Qa,attributeTypes:$a,useUniqueIDs:!1}){for(let e in t.attributeTypes){let n=t.attributeTypes[e];n.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[e]=n.name)}let n,r=this.workerNextTaskID++,i=e.byteLength,a=this._getWorker(r,i).then(i=>(n=i,new Promise((i,a)=>{n._callbacks[r]={resolve:i,reject:a},n.postMessage({type:`decode`,id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),a}_createGeometry(e){let t=new c.BufferGeometry;e.index&&t.setIndex(new c.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n],i=r.name,a=r.array,o=r.itemSize,s=!(a instanceof Float32Array||a instanceof Float64Array);t.setAttribute(i,new c.BufferAttribute(a,o,s))}return t}_initDecoder(){if(this.decoderPending)return this.decoderPending;if(typeof WebAssembly!=`object`||this.decoderConfig.type===`js`)this.decoderPending=pr.ajax(this.decoderPath+`draco_decoder.js`,{responseType:`text`}).then(e=>e.body).then(e=>{let t=[`/* draco decoder */`,e,``,`/* worker */`,to].join(`
|
|
365
365
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([t]))});else{let e=pr.ajax(this.decoderPath+`draco_wasm_wrapper.js`,{responseType:`text`}).then(e=>e.body),t=pr.ajax(this.decoderPath+`draco_decoder.wasm`,{responseType:`arraybuffer`}).then(e=>e.body);this.decoderPending=Promise.all([e,t]).then(([e,t])=>{this.decoderConfig.wasmBinary=t;let n=[`/* draco decoder */`,e,``,`/* worker */`,to].join(`
|
|
366
366
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([n]))})}return this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:`init`,decoderConfig:this.decoderConfig}),e.onmessage=t=>{let n=t.data;switch(n.type){case`decode`:e._callbacks[n.id].resolve(n);break;case`error`:e._callbacks[n.id].reject(n);break;default:console.error(`DRACO: Unexpected message, "`+n.type+`"`)}},this.workerPool.push(e)}else this.workerPool.sort((e,t)=>e._taskLoad>t._taskLoad?-1:1);let n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}},to=`
|
|
367
367
|
let decoderConfig;
|
|
@@ -827,8 +827,8 @@ self.onmessage = function(event) {
|
|
|
827
827
|
return ( value & ( value - 1 ) ) === 0 && value !== 0;
|
|
828
828
|
|
|
829
829
|
}
|
|
830
|
-
`,mo=`KHR_texture_basisu`,ho=class extends Ja{loadTexture(e,t){let n=t.json.textures[e];if(!n.extensions||!n.extensions[mo])return null;let r=n.extensions[mo],i=t.json.images[r.source],a=null;if(i.bufferView!==void 0)a=t.loadBufferView(i.bufferView).then(e=>co.parse(e));else if(i.uri)a=t.options.fetcher.ajax(t.resolveResouce(i.uri),{responseType:`arraybuffer`}).then(e=>co.parse(e.body));else throw Error(`glTF: Invalid image defs.`);let o=(t.json.samplers||{})[n.sampler]||{};return a=a.then(e=>(e.magFilter=c.LinearFilter,e.minFilter=c.LinearFilter,e.wrapS=Fa[o.wrapS]||c.RepeatWrapping,e.wrapT=Fa[o.wrapT]||c.RepeatWrapping,e)),a}},go=`KHR_texture_transform`,_o=class extends Ja{extendTexture(e,t,n){let r=t.extensions===void 0?void 0:t.extensions[go];return r?(r.texCoord!==void 0&&console.warn(`glTF: Custom UV sets in "`+go+`" extension not yet supported.`),r.offset===void 0&&r.rotation===void 0&&r.scale===void 0?e:(e=e.clone(),e.needsUpdate=!0,r.offset!==void 0&&e.offset.fromArray(r.offset),r.rotation!==void 0&&(e.rotation=r.rotation),r.scale!==void 0&&e.repeat.fromArray(r.scale),e)):null}},vo=class extends Ja{},yo=`KHR_materials_unlit`,bo=class extends Ja{extendMaterial(e,t,n){var r;return t.material!==void 0&&e instanceof vn&&((r=n.json.materials[t.material].extensions)==null?{}:r)[yo]&&(e.shaderType=`basic`),Promise.all([]).then(q)}},xo=`KHR_node_visibility`,So=class extends Ja{extendNode(e,t,n){var r;let i=[],a=(r=t.extensions)==null?{}:r;if(a[xo]){let t=a[xo];typeof t.visible==`boolean`&&(e.visible=t.visible)}return Promise.all(i).then(q)}},Co=class extends Ja{},wo=`KHR_materials_clearcoat`,To=class extends Ja{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof vn||e instanceof c.MeshPhysicalMaterial)){let a=(r=n.json.materials[t.material].extensions)==null?{}:r;if(a[wo]){let t=a[wo];if(t.clearcoatFactor!==void 0&&(e.clearcoat=t.clearcoatFactor),t.clearcoatTexture!==void 0&&i.push(n.createMaterialTexture(t.clearcoatTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatMap=t,n.disposeSet.add(t)})),t.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=t.clearcoatRoughnessFactor),t.clearcoatRoughnessTexture!==void 0&&i.push(n.createMaterialTexture(t.clearcoatRoughnessTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatRoughnessMap=t,n.disposeSet.add(t)})),t.clearcoatNormalTexture!==void 0&&(i.push(n.createMaterialTexture(t.clearcoatNormalTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatNormalMap=t,n.disposeSet.add(t)})),t.clearcoatNormalTexture.scale!==void 0)){let n=t.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new c.Vector2(n,n)}}}return Promise.all(i).then(q)}},Eo=`KHR_materials_sheen`,Do=class extends Ja{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof vn||e instanceof c.MeshPhysicalMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Eo]){let t=i[Eo];if(t.sheenColorFactor!==void 0){let n=t.sheenColorFactor;e.sheen=new c.Color().setRGB(n[0],n[1],n[2])}t.sheenRoughnessFactor!==void 0&&console.warn(`glTF: ${Eo} sheenRoughnessFactor unsupported`),t.sheenColorTexture!==void 0&&console.warn(`glTF: ${Eo} sheenColorTexture unsupported`),t.sheenRoughnessTexture!==void 0&&console.warn(`glTF: ${Eo} sheenRoughnessTexture unsupported`)}}return Promise.all(i).then(q)}},Oo=`KHR_materials_transmission`,ko=class extends Ja{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof vn||e instanceof c.MeshPhysicalMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Oo]){let t=i.KHR_materials_transmission;t.transmissionFactor!==void 0&&(e.transparency=t.transmissionFactor,e.transparency>0&&(e.transparent=!0)),t.transmissionTexture!==void 0&&console.warn(`glTF: ${Oo} transmissionTexture unsupported`)}}return Promise.all(i).then(q)}},Ao=`KHR_materials_emissive_strength`,jo=class extends Ja{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof vn||e instanceof c.MeshStandardMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Ao]){let t=i[Ao];t.emissiveStrength!==void 0&&(e.emissiveIntensity=t.emissiveStrength)}}return Promise.all(i).then(q)}},Mo=(function(){"use strict";var e=`b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:78Yqdbk:qzezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlinalgic9Wfglawcj;cbffhOdndndndndnaHalco4fRbbalci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOaoRblaoRbbgAco4glalciSgCE86bbawcj;cbfaifglcGfaoclfaCfgORbbaAcl4ciGgCaCciSgCE86bbalcVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbalc7faOaCfgORbbaAciGgAaAciSgAE86bbalctfaOaAfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkaOaoRbwaoRbbgAcl4glalcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgORbbaAcsGgAaAcsSgAE86bbalcVfaOaAfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekaOao8Pbb83bbaOcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhPdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkaCcefhCamcefgmad6hsamad9hmbkaPhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaPhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj;8ifcjjj98G::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb`,t=`b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;a9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;d8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgAclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb`,n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=`object`)return{supported:!1};var i=WebAssembly.validate(n)?t:e,a,o=WebAssembly.instantiate(s(i),{}).then(function(e){a=e.instance,a.exports.__wasm_call_ctors()});function s(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);t[n]=i>96?i-97:i>64?i-39:i+4}for(var a=0,n=0;n<e.length;++n)t[a++]=t[n]<60?r[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,a)}function c(e,t,n,r,i,o){var s=a.exports.sbrk,c=n+3&-4,l=s(c*r),u=s(i.length),d=new Uint8Array(a.exports.memory.buffer);d.set(i,u);var f=e(l,n,r,u,i.length);if(f==0&&o&&o(l,c,r),t.set(d.subarray(l,l+n*r)),s(l-s(0)),f!=0)throw Error(`Malformed buffer data: `+f)}var l={NONE:``,OCTAHEDRAL:`meshopt_decodeFilterOct`,QUATERNION:`meshopt_decodeFilterQuat`,EXPONENTIAL:`meshopt_decodeFilterExp`},u={ATTRIBUTES:`meshopt_decodeVertexBuffer`,TRIANGLES:`meshopt_decodeIndexBuffer`,INDICES:`meshopt_decodeIndexSequence`},d=[],f=0;function p(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function m(e){for(var t=`var instance; var ready = WebAssembly.instantiate(new Uint8Array([`+new Uint8Array(s(i))+`]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;`+c.toString()+g.toString(),n=new Blob([t],{type:`text/javascript`}),r=URL.createObjectURL(n),a=0;a<e;++a)d[a]=p(r);URL.revokeObjectURL(r)}function h(e,t,n,r,i){for(var a=d[0],o=1;o<d.length;++o)d[o].pending<a.pending&&(a=d[o]);return new Promise(function(o,s){var c=new Uint8Array(n),l=f++;a.pending+=e,a.requests[l]={resolve:o,reject:s},a.object.postMessage({id:l,count:e,size:t,source:c,mode:r,filter:i},[c.buffer])})}function g(e){o.then(function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);c(a.exports[t.mode],n,t.count,t.size,t.source,a.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:`resolve`,value:n},[n.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:`reject`,value:e})}})}return{ready:o,supported:!0,useWorkers:function(e){m(e)},decodeVertexBuffer:function(e,t,n,r,i){c(a.exports.meshopt_decodeVertexBuffer,e,t,n,r,a.exports[l[i]])},decodeIndexBuffer:function(e,t,n,r){c(a.exports.meshopt_decodeIndexBuffer,e,t,n,r)},decodeIndexSequence:function(e,t,n,r){c(a.exports.meshopt_decodeIndexSequence,e,t,n,r)},decodeGltfBuffer:function(e,t,n,r,i,o){c(a.exports[u[i]],e,t,n,r,a.exports[l[o]])},decodeGltfBufferAsync:function(e,t,n,r,i){return d.length>0?h(e,t,n,u[r],l[i]):o.then(function(){var o=new Uint8Array(e*t);return c(a.exports[u[r]],o,e,t,n,a.exports[l[i]]),o})}}})(),No=`EXT_meshopt_compression`,Po=class extends Ja{loadBufferView(e,t){let n=t.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[No]){let e=r.extensions[No],i=t.loadBuffer(e.buffer);if(!Mo.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(No)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return Promise.all([i,Mo.ready]).then(([t])=>{let n=e.byteOffset||0,r=e.byteLength||0,i=e.count,a=e.byteStride,o=new ArrayBuffer(i*a),s=new Uint8Array(t,n,r);return Mo.decodeGltfBuffer(new Uint8Array(o),i,a,s,e.mode,e.filter),o})}else return null}},Fo=`EXT_texture_webp`,Io=class extends Ja{constructor(){super(...arguments),this.supportsWep=!1}prepare(e){return kr().then(e=>{this.supportsWep=e.webp})}loadTexture(e,t){let n=t.json.textures[e];if(!n.extensions||!n.extensions[Fo]||!this.supportsWep)return null;let r=n.extensions[Fo];return t.loadImage(r.source).then(e=>{let r=new c.Texture(e);r.needsUpdate=!0,r.flipY=!1,n.name&&(r.name=n.name);let i=(t.json.samplers||{})[n.sampler]||{};return r.magFilter=Pa[i.magFilter]||c.LinearFilter,r.minFilter=Pa[i.minFilter]||c.LinearMipmapLinearFilter,r.wrapS=Fa[i.wrapS]||c.RepeatWrapping,r.wrapT=Fa[i.wrapT]||c.RepeatWrapping,r.onUpdate=function(){e.close()},r})}},Lo=`CESIUM_RTC`,Ro=class extends Ja{emitResult(e,t){if(t.json.extensions[Lo]&&t.json.extensions[Lo].center){let n=t.json.extensions[Lo].center;e.CESIUM_RTC={center:new c.Vector3().fromArray(n)}}}},zo=`REALSEE_materials_lightmap`,Bo=class extends Ja{extendMaterial(e,t,n){let r=[];if(n.json.materials&&t.material!==void 0){let i=n.json.materials[t.material].extensions[zo];i&&(i.lightMapTexture!==void 0&&r.push(n.createMaterialTexture(i.lightMapTexture).then(t=>{e.lightMap=t})),i.lightMapIntensity!==void 0&&(e.lightMapIntensity=i.lightMapIntensity))}return Promise.all(r).then(()=>{})}};function Vo(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var Ho=new Float32Array(1),Uo=new Uint32Array(Ho.buffer),Wo=typeof Float16Array<`u`,Go=Wo?new Float16Array(1):null,Ko=Wo?new Uint16Array(Go.buffer):new Uint16Array(1);function qo(e){if(Wo&&Go)return Ko[0]=e,Go[0];let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0)if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return Uo[0]=i,Ho[0]}var Jo=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`);this.reader=new Blob([e]).stream().pipeThrough(t).getReader()}read(e){return Vo(this,void 0,void 0,function*(){for(;this.totalBytes<e;){let{value:e,done:t}=yield this.reader.read();if(t)break;this.chunks.push(e),this.totalBytes+=e.length}if(this.totalBytes<e)throw Error(`Unexpected EOF: needed ${e}, got ${this.totalBytes}`);let t=new Uint8Array(this.totalBytes),n=0;for(let e of this.chunks)t.set(e,n),n+=e.length;let r=t.subarray(0,e);return this.chunks=[t.subarray(e)],this.totalBytes-=e,r})}},Yo=.28209479177387814,Xo=class{constructor({fileBytes:e}){this.version=-1,this.numSplats=0,this.shDegree=0,this.fractionalBits=0,this.flags=0,this.flagAntiAlias=!1,this.reserved=0,this.headerParsed=!1,this.parsed=!1,this.fileBytes=e instanceof ArrayBuffer?new Uint8Array(e):e,this.reader=new Jo({fileBytes:this.fileBytes})}parseHeader(){return Vo(this,void 0,void 0,function*(){if(this.headerParsed)throw Error(`SPZ file header already parsed`);let e=new DataView((yield this.reader.read(16)).buffer);if(e.getUint32(0,!0)!==1347635022)throw Error(`Invalid SPZ file`);if(this.version=e.getUint32(4,!0),this.version<1||this.version>3)throw Error(`Unsupported SPZ version: ${this.version}`);this.numSplats=e.getUint32(8,!0),this.shDegree=e.getUint8(12),this.fractionalBits=e.getUint8(13),this.flags=e.getUint8(14),this.flagAntiAlias=(this.flags&1)!=0,this.reserved=e.getUint8(15),this.headerParsed=!0,this.parsed=!1})}parseSplats(e,t,n,r,i,a){return Vo(this,void 0,void 0,function*(){if(!this.headerParsed)throw Error(`SPZ file header must be parsed first`);if(this.parsed)throw Error(`SPZ file already parsed`);if(this.parsed=!0,this.version===1){let t=yield this.reader.read(this.numSplats*3*2),n=new Uint16Array(t.buffer);for(let t=0;t<this.numSplats;t++){let r=t*3,i=qo(n[r]),a=qo(n[r+1]),o=qo(n[r+2]);e==null||e(t,i,a,o)}}else if(this.version===2||this.version===3){let t=1<<this.fractionalBits,n=yield this.reader.read(this.numSplats*3*3);for(let r=0;r<this.numSplats;r++){let i=r*9,a=((n[i+2]<<24|n[i+1]<<16|n[i]<<8)>>8)/t,o=((n[i+5]<<24|n[i+4]<<16|n[i+3]<<8)>>8)/t,s=((n[i+8]<<24|n[i+7]<<16|n[i+6]<<8)>>8)/t;e==null||e(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats);for(let n=0;n<this.numSplats;n++)t==null||t(n,e[n]/255)}{let e=yield this.reader.read(this.numSplats*3),t=Yo/.15;for(let r=0;r<this.numSplats;r++){let i=r*3,a=(e[i]/255-.5)*t+.5,o=(e[i+1]/255-.5)*t+.5,s=(e[i+2]/255-.5)*t+.5;n==null||n(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,i=Math.exp(e[n]/16-10),a=Math.exp(e[n+1]/16-10),o=Math.exp(e[n+2]/16-10);r==null||r(t,i,a,o)}}if(this.version===3){let e=1/Math.sqrt(2),t=yield this.reader.read(this.numSplats*4);for(let n=0;n<this.numSplats;n++){let r=n*4,a=[0,0,0,0],o=[t[r],t[r+1],t[r+2],t[r+3]],s=o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24),c=s>>>30,l=s,u=0;for(let t=3;t>=0;--t)if(t!==c){let n=l&511,r=l>>>9&1;l>>>=10,a[t]=n/511*e,a[t]=r===0?a[t]:-a[t],u+=a[t]*a[t]}let d=1-u;a[c]=Math.sqrt(Math.max(d,0)),i==null||i(n,a[0],a[1],a[2],a[3])}}else{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,r=e[n]/127.5-1,a=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-a*a-o*o));i==null||i(t,r,a,o,s)}}if(a&&this.shDegree>=1){let e={1:3,2:8,3:15}[this.shDegree]||0,t=yield this.reader.read(this.numSplats*e*3),n=new Float32Array(9),r=this.shDegree>=2?new Float32Array(15):void 0,i=this.shDegree>=3?new Float32Array(21):void 0,o=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[o+e]-128)/128;if(o+=9,r){for(let e=0;e<15;++e)r[e]=(t[o+e]-128)/128;o+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[o+e]-128)/128;o+=21}let s=new Float32Array(n),c=r?new Float32Array(r):void 0,l=i?new Float32Array(i):void 0;a==null||a(e,s,c,l)}}})}};function Zo(e){return Vo(this,void 0,void 0,function*(){let t=new Xo({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),i=new Uint8Array(n*4),a=new Float32Array(n*3),o=new Float32Array(n*4),s,c,l;return t.shDegree>=1&&(s=new Float32Array(n*9)),t.shDegree>=2&&(c=new Float32Array(n*15)),t.shDegree>=3&&(l=new Float32Array(n*21)),yield t.parseSplats((e,t,n,i)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=i},(e,t)=>{i[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{i[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),i[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),i[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{a[e*3]=t,a[e*3+1]=n,a[e*3+2]=r},(e,t,n,r,i)=>{o[e*4]=i,o[e*4+1]=t,o[e*4+2]=n,o[e*4+3]=r},(e,t,n,r)=>{s&&t&&s.set(t,e*9),c&&n&&c.set(n,e*15),l&&r&&l.set(r,e*21)}),new Yn({numPoints:n,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l,shDegree:t.shDegree})})}function Qo(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?pr:i,l=(a=t.onDownloadProgress)==null?q:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>Zo(new Uint8Array(e))).then(t=>(o===`Z`&&(t.applyMatrix4(Zn),t.updateMatrix(),t.updateMatrixWorld(!0),t.transformChanged=!0),{type:`spz`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:Ai(t),scene:t,textures:[],animations:[],dispose:()=>t.dispose()}))}var $o=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),es=new c.Matrix4().getInverse($o),ts={KHR_binary_glTF:Xa,KHR_draco_mesh_compression:ro,KHR_texture_basisu:ho,KHR_texture_transform:_o,KHR_mesh_quantization:vo,KHR_materials_unlit:bo,KHR_node_visibility:So,KHR_animation_pointer:Co,KHR_materials_clearcoat:To,KHR_materials_sheen:Do,KHR_materials_transmission:ko,KHR_materials_emissive_strength:jo,EXT_meshopt_compression:Po,EXT_texture_webp:Io,CESIUM_RTC:Ro,REALSEE_materials_lightmap:Bo,KHR_gaussian_splatting_compression_spz:class extends Ja{constructor(){super(...arguments),this.name=`KHR_gaussian_splatting_compression_spz`,this.parentName=`KHR_gaussian_splatting`}loadMesh(e,t){let n=t.json.meshes[e].primitives;return n.length===0?null:(n.length===1||console.warn(`KHR_gaussian_splatting_compression_spz: multiple primitives are not supported`),this.loadSpz(n[0],t))}loadSpz(e,t){return Vo(this,void 0,void 0,function*(){let n=e.extensions[this.parentName].bufferView;return t.loadBufferView(n).then(e=>Zo(new Uint8Array(e))).then(e=>(e.applyMatrix4(es),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}}};function ns(e,t){var n,r,i;let a={},o,s;if(typeof e==`string`)s=e;else if(ts.KHR_binary_glTF.getMagic(e)===ts.KHR_binary_glTF.HEADER_MAGIC){o=new ts.KHR_binary_glTF;try{o.loadGlbBinary(e)}catch(e){return Promise.reject(e)}a.KHR_binary_glTF=o,s=o.content}else s=ja(new Uint8Array(e));let c=JSON.parse(s);if(t.jsonModify&&(c=t.jsonModify(c)),c.asset===void 0||Number(c.asset.version[0])<2)return Promise.reject(Error(`glTF: Unsupported asset. glTF versions >=2.0 are supported.`));if(c.extensionsUsed){let e=c.extensionsRequired||[];for(var l=0;l<c.extensionsUsed.length;l++){let t=c.extensionsUsed[l];a[t]||(ts[t]?a[t]=new ts[t]:e.indexOf(t)>=0&&console.warn(`glTF: Unknown extension "`+t+`".`))}}return new Ua(c,a,{copyUV2:(n=t.copyUV2)==null?!1:n,resourcePath:(r=t.resourcePath)==null?``:r,search:(i=t.search)==null?``:i,fetcher:t.fetcher}).parse().then(e=>(o&&o.clear(),e))}function rs(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,l=(i=t.fetcher)==null?pr:i,u=(a=t.onDownloadProgress)==null?q:a,d={uri:e,gltfUpAxis:o};return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>pa(d,e,t)).then(t=>Ta(d,e,t)).then(t=>Aa(d,e,t))).then(()=>{var n;return ns(d.gltfArrayBuffer,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,jsonModify(e){var n,r;if(t.light===!1){let t=`KHR_materials_unlit`;if(e.extensionsUsed=(n=e.extensionsUsed)==null?[]:n,e.extensionsUsed.indexOf(t)===-1&&e.extensionsUsed.push(t),e.materials)for(let n of e.materials)n.extensions=(r=n.extensions)==null?{}:r,n.extensions[t]={}}return e},fetcher:l}).then(e=>{let t=new c.Matrix4;o===`Y`&&t.premultiply(Xn);let n;if(d.rtcCenter?n=new c.Vector3().fromArray(d.rtcCenter):e.CESIUM_RTC&&(n=new c.Vector3().copy(e.CESIUM_RTC.center)),n){let e=new c.Matrix4().setPosition(n);t.premultiply(e)}return s===`Y`&&t.premultiply(Zn),e.scene.applyMatrix4(t),d.featureTableBinary=void 0,d.batchTableBinary=void 0,d.gltfArrayBuffer=void 0,{type:`b3dm`,modelUpAxis:o,upAxis:`Z`,uri:d.uri,byteLength:d.byteLength,memoryUsage:Ai(e.scene),scene:e.scene,textures:e.textures,animations:[],rtcCenter:n,dispose:()=>e.dispose()}})})}var is="(function(){function e(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}var t;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(t||={});let n={[t.DOUBLE]:Float64Array,[t.FLOAT]:Float32Array,[t.UNSIGNED_SHORT]:Uint16Array,[t.UNSIGNED_INT]:Uint32Array,[t.UNSIGNED_BYTE]:Uint8Array,[t.BYTE]:Int8Array,[t.SHORT]:Int16Array,[t.INT]:Int32Array},r={DOUBLE:t.DOUBLE,FLOAT:t.FLOAT,UNSIGNED_SHORT:t.UNSIGNED_SHORT,UNSIGNED_INT:t.UNSIGNED_INT,UNSIGNED_BYTE:t.UNSIGNED_BYTE,BYTE:t.BYTE,SHORT:t.SHORT,INT:t.INT};function i(e){let t=n[e];if(!t)throw Error(`Failed to convert GL type`);return t}function a(e){return i(e).BYTES_PER_ELEMENT}function o(e,t,n=0,r){let o=i(e);return n%a(e)===0?new o(t,n,r??(t.byteLength-n)/a(e)):new o(r?t.slice(n,n+r*a(e)):t.slice(n))}function s(e){let t=r[e];if(!t)throw Error(`Failed to convert GL type`);return t}var c=class{constructor(e,n){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=n;let r=this.getGlobalProperty(`POINTS_LENGTH`,t.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(i(t))([r]):Array.isArray(r)?new(i(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=s(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,s=a[e];return s||(s=o(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=s),s}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=o(t,n),r[e]=i),i}};e(e=>Promise.resolve(e).then(e=>{let t=new c(e.featureTableJson,e.featureTableBinary),n=u(t),r=d(t),i=p(t),a=[];return n&&a.push(n.array.buffer),r&&a.push(r.array.buffer),i&&a.push(i.array.buffer),{output:{position:n,color:r,normal:i},transfer:a}}));let l=65535;function u(e){if(e.hasProperty(`POSITION`))return{array:e.getPropertyArray(`POSITION`,t.FLOAT,3),itemSize:3,normalized:!1};if(e.hasProperty(`POSITION_QUANTIZED`)){let n=e.getPropertyArray(`POSITION_QUANTIZED`,t.UNSIGNED_SHORT,3),r=e.getGlobalProperty(`QUANTIZED_VOLUME_SCALE`,t.FLOAT,3),i=e.getGlobalProperty(`QUANTIZED_VOLUME_OFFSET`,t.FLOAT,3);if(!r||!i)throw Error(`QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.`);let a=new Float32Array(n.length),o=n.length/3,s=r[0]/l,c=r[1]/l,u=r[2]/l,d=i[0],f=i[1],p=i[2];for(let e=0,t;e<o;e++)t=e*3,a[t]=n[t]*s+d,a[++t]=n[t]*c+f,a[++t]=n[t]*u+p;return{array:a,itemSize:3,normalized:!1}}return null}function d(e){if(e.hasProperty(`RGB`)){let n=e.getPropertyArray(`RGB`,t.UNSIGNED_BYTE,3),r=n.length/3,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t],i[++a]=n[++t],i[++a]=n[++t];return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`RGBA`))return{array:e.getPropertyArray(`RGBA`,t.UNSIGNED_BYTE,4),itemSize:4,normalized:!0};else if(e.hasProperty(`RGB565`)){let n=e.getPropertyArray(`RGB565`,t.UNSIGNED_SHORT,1),r=n.length,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=n[e],t=e*4,i[t]=(a>>11&31)<<3,i[++t]=(a>>5&63)<<2,i[++t]=(a&31)<<3;return{array:i,itemSize:4,normalized:!0}}return null}let f=2/255;function p(e){if(e.hasProperty(`NORMAL`)){let n=e.getPropertyArray(`NORMAL`,t.FLOAT,3),r=n.length/3,i=new Int8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t]*127,i[++a]=n[++t]*127,i[++a]=n[++t]*127;return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`NORMAL_OCT16P`)){let n=e.getPropertyArray(`NORMAL_OCT16P`,t.UNSIGNED_BYTE,2),r=n.length/2,i=new Int8Array(r*4);for(let e=0,t,a,o,s,c,l,u;e<r;e++)t=e*2,a=n[t]*f-1,o=n[++t]*f-1,c=a<0?-a:a,l=o<0?-o:o,s=1-(c+l),s<0&&(a=(1-l)*(a<0?-1:1),o=(1-c)*(o<0?-1:1)),u=Math.sqrt(a*a+o*o+s*s),t=e*4,i[t]=a/u*127,i[++t]=o/u*127,i[++t]=s/u*127;return{array:i,itemSize:4,normalized:!0}}return null}})();",as=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,is],{type:`text/javascript;charset=utf-8`});function os(e){let t;try{if(t=as&&(self.URL||self.webkitURL).createObjectURL(as),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(is),{name:e==null?void 0:e.name})}}var ss=new io(()=>new os,2);function cs(e,t,n){let r=new xa(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then(()=>{let e=r.getExtension(`3DTILES_draco_point_compression`);return e?ls(e,r):ss.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(t=>(e.attributes=t,n))}function ls(e,t){return Vo(this,void 0,void 0,function*(){let n=e.properties||{},r=e.byteOffset,i=e.byteLength;if(!n||!Number.isFinite(r)||!i)throw Error(`Draco properties, byteOffset, and byteLength must be defined`);let a=t.buffer.slice(r,r+i),o=e.properties;return eo.decodeGeometry(a.buffer,{attributeIDs:o,attributeTypes:{POSITION:`Float32Array`,NORMAL:`Float32Array`,RGB:`Uint8Array`,RGBA:`Uint8Array`},useUniqueIDs:!0}).then(e=>{let t=e.getAttribute(`POSITION`),n=e.getAttribute(`RGB`),r=e.getAttribute(`RGBA`),i=e.getAttribute(`NORMAL`),a;if(r)a=r;else if(n){let e=n.count,t=n.array,r=new Uint8Array(e*4);for(let n=0,i,a;n<e;n++)a=n*4,i=n*3,r[a]=t[i],r[++a]=t[++i],r[++a]=t[++i];a=new c.BufferAttribute(r,4,n.normalized)}return{position:t?{array:t.array,itemSize:t.itemSize,normalized:t.normalized}:null,color:a?{array:a.array,itemSize:a.itemSize,normalized:a.normalized}:null,normal:i?{array:i.array,itemSize:i.itemSize,normalized:i.normalized}:null}})})}function us(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={uri:e};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>pa(l,e,t)).then(t=>Ta(l,e,t)).then(t=>cs(l,e,t))).then(()=>{var e;return ds(l.attributes,{computeBoundingBox:(e=t.computeBoundingBox)==null?!0:e})}).then(e=>{let t=new c.Matrix4,n;if(l.rtcCenter&&(n=new c.Vector3().fromArray(l.rtcCenter)),n){let e=new c.Matrix4().setPosition(n);t.premultiply(e)}return a===`Y`&&t.premultiply(Zn),e.object.applyMatrix4(t),l.gltfArrayBuffer=void 0,l.featureTableBinary=void 0,l.batchTableBinary=void 0,{type:`pnts`,modelUpAxis:`Z`,upAxis:a,uri:l.uri,byteLength:l.byteLength,memoryUsage:Ai(e.object),scene:e.object,textures:[],animations:[],rtcCenter:n,dispose:()=>e.dispose()}})}function ds(e,t){let n=new Set,r=new c.BufferGeometry;n.add(r);let i=new On;n.add(i),e.position&&r.setAttribute(`position`,new c.BufferAttribute(e.position.array,e.position.itemSize,e.position.normalized)),e.color&&r.setAttribute(`color`,new c.BufferAttribute(e.color.array,e.color.itemSize,e.color.normalized)),e.normal?r.setAttribute(`normal`,new c.BufferAttribute(e.normal.array,e.normal.itemSize,e.normal.normalized)):i.flatShading=!0,t.computeBoundingBox&&r.computeBoundingBox();let a=new kn(r,i);return a.matrix.compose(a.position,a.quaternion,a.scale),a.matrixAutoUpdate=!1,a.frustumCulled=!1,Promise.resolve({object:a,dispose:()=>{n.forEach(e=>{e.dispose()}),n.clear()}})}function fs(e,t={}){var n,r,i,a,o;let s=(n=t.modelUpAxis)==null?`Y`:n,l=(r=t.upAxis)==null?`Z`:r,u=(i=t.fetcher)==null?pr:i,d=(a=t.onDownloadProgress)==null?q:a,f=(o=t.jsonModify)==null?q:o,p=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>(p=e.body.byteLength,e.body))).then(n=>{var r;return ns(n,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var n,r,i;if(t.light===!1){let t=`KHR_materials_unlit`;if(e.extensionsUsed=(n=e.extensionsUsed)==null?[]:n,e.extensionsUsed.indexOf(t)===-1&&e.extensionsUsed.push(t),e.materials)for(let n of e.materials)n.extensions=(r=n.extensions)==null?{}:r,n.extensions[t]={}}return(i=f(e))==null?e:i},fetcher:u})}).then(t=>{var n;let r=new c.Matrix4;if(s===`Y`&&r.premultiply(Xn),t.CESIUM_RTC){let e=new c.Matrix4().setPosition(t.CESIUM_RTC.center);r.premultiply(e)}return l===`Y`&&r.premultiply(Zn),t.scene.applyMatrix4(r),{type:`gltf`,modelUpAxis:s,upAxis:l,uri:e,byteLength:p,memoryUsage:Ai(t.scene),scene:t.scene,textures:t.textures,animations:t.animations,rtcCenter:(n=t.CESIUM_RTC)==null?void 0:n.center,dispose:()=>t.dispose()}})}var ps=new c.Color;function ms(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Z`:n,s=(r=t.upAxis)==null?`Z`:r,l=(i=t.fetcher)==null?pr:i,u=(a=t.onDownloadProgress)==null?q:a,d=0;return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>(d=e.body.byteLength,e.body))).then(e=>{var n,r;return hs(e,{propertyNameMapping:(n=t.propertyNameMapping)==null?{}:n,customPropertyMapping:(r=t.customPropertyMapping)==null?{}:r})}).then(({geometry:n})=>{switch(t.type){case`geometry`:{let t=n;return o===`Y`&&t.applyMatrix4(Xn),s===`Y`&&t.applyMatrix4(Zn),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:xi(t),scene:t,textures:[],animations:[],dispose:()=>{n.dispose()}}}case`line`:{let t=`color`in n.attributes,r=new c.LineBasicMaterial({vertexColors:t}),i=new c.Line(n,r);return i.computeLineDistances(),o===`Y`&&i.applyMatrix4(Xn),s===`Y`&&i.applyMatrix4(Zn),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Ai(i),scene:i,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmMesh`:{let r=new vn(t.light?`phong`:`basic`);r.vertexColors=`color`in n.attributes;let i=new c.Mesh(n,r);return o===`Y`&&i.applyMatrix4(Xn),s===`Y`&&i.applyMatrix4(Zn),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Ai(i),scene:i,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmPointCloud`:{let t=new On,r=new kn(n,t);return o===`Y`&&r.applyMatrix4(Xn),s===`Y`&&r.applyMatrix4(Zn),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Ai(r),scene:r,textures:[],animations:[],dispose:()=>{n.dispose(),t.dispose()}}}default:break}throw Error(`Invalid Type: ${t.type}`)})}function hs(e,t){let n=new Uint8Array(e),{headerText:r,headerLength:i}=Os(n),a=_s(r,i,t);return a.format===`ascii`?{header:a,geometry:Ss(new TextDecoder().decode(n),a,t)}:{header:a,geometry:Ds(e,a,t)}}function gs(e,t){let n={name:``,type:e[0]};return n.type===`list`?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],n.name in t.propertyNameMapping&&(n.name=t.propertyNameMapping[n.name]),n}function _s(e,t=0,n){let r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,i=``,a=r.exec(e);a!==null&&(i=a[1]);let o={format:``,version:``,comments:[],elements:[],headerLength:t,objInfo:``},s=i.split(/\r\n|\r|\n/),c=null;for(let e=0;e<s.length;e++){let t=s[e];if(t=t.trim(),t===``)continue;let r=t.split(/\s+/),i=r.shift();switch(t=r.join(` `),i){case`format`:o.format=r[0],o.version=r[1];break;case`comment`:o.comments.push(t);break;case`element`:c&&o.elements.push(c),c={name:r[0],count:parseInt(r[1]),properties:[]};break;case`property`:c&&c.properties.push(gs(r,n));break;case`obj_info`:o.objInfo=t;break;default:console.log(`unhandled`,i,r)}}return c&&o.elements.push(c),o}function vs(e,t){switch(t){case`char`:case`uchar`:case`short`:case`ushort`:case`int`:case`uint`:case`int8`:case`uint8`:case`int16`:case`uint16`:case`int32`:case`uint32`:return parseInt(e);case`float`:case`double`:case`float32`:case`float64`:return parseFloat(e);default:throw Error(`unspport type: `+t)}}function ys(e,t){let n={};for(let r=0;r<e.length;r++){if(t.empty())return null;if(e[r].type===`list`){let i=[],a=vs(t.next(),e[r].countType);for(let n=0;n<a;n++){if(t.empty())return null;i.push(vs(t.next(),e[r].itemType))}n[e[r].name]=i}else n[e[r].name]=vs(t.next(),e[r].type)}return n}function bs(e){let t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(let n of Object.keys(e.customPropertyMapping))t[n]=[];return t}function xs(e){let t=e.map(e=>e.name);function n(e){for(let n=0,r=e.length;n<r;n++){let r=e[n];if(t.includes(r))return r}return null}return{attrX:n([`x`,`px`,`posx`])||`x`,attrY:n([`y`,`py`,`posy`])||`y`,attrZ:n([`z`,`pz`,`posz`])||`z`,attrNX:n([`nx`,`normalx`]),attrNY:n([`ny`,`normaly`]),attrNZ:n([`nz`,`normalz`]),attrS:n([`s`,`u`,`texture_u`,`tx`]),attrT:n([`t`,`v`,`texture_v`,`ty`]),attrR:n([`red`,`diffuse_red`,`r`,`diffuse_r`]),attrG:n([`green`,`diffuse_green`,`g`,`diffuse_g`]),attrB:n([`blue`,`diffuse_blue`,`b`,`diffuse_b`])}}function Ss(e,t,n){let r=bs(n),i=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,a,o=null;a=(o=i.exec(e))===null?[]:o[1].split(/\s+/);let s=new ks(a);loop:for(let e=0;e<t.elements.length;e++){let i=t.elements[e],a=xs(i.properties);for(let e=0;e<i.count;e++){let e=ys(i.properties,s);if(!e)break loop;ws(r,i.name,e,a,n)}}return Cs(r,n)}function Cs(e,t){let n=new c.BufferGeometry;e.indices.length>0&&n.setIndex(e.indices),n.setAttribute(`position`,new c.Float32BufferAttribute(e.vertices,3)),e.normals.length>0&&n.setAttribute(`normal`,new c.Float32BufferAttribute(e.normals,3)),e.uvs.length>0&&n.setAttribute(`uv`,new c.Float32BufferAttribute(e.uvs,2)),e.colors.length>0&&n.setAttribute(`color`,new c.Float32BufferAttribute(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(n=n.toNonIndexed(),e.faceVertexUvs.length>0&&n.setAttribute(`uv`,new c.Float32BufferAttribute(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&n.setAttribute(`color`,new c.Float32BufferAttribute(e.faceVertexColors,3)));for(let r of Object.keys(t.customPropertyMapping))if(e[r].length>0){let{itemType:i,itemNames:a,normalized:o}=t.customPropertyMapping[r],s=a.length,l;switch(i){case`float32`:l=new c.Float32BufferAttribute(e[r],s,o);break;case`uint32`:l=new c.Uint32BufferAttribute(e[r],s,o);break;case`int32`:l=new c.Int32BufferAttribute(e[r],s,o);break;case`uint16`:l=new c.Uint16BufferAttribute(e[r],s,o);break;case`int16`:l=new c.Int16BufferAttribute(e[r],s,o);break;case`uint8`:l=new c.Uint8BufferAttribute(e[r],s,o);break;case`int8`:l=new c.Int8BufferAttribute(e[r],s,o);break;default:l=new c.Float32BufferAttribute(e[r],s,o);break}n.setAttribute(r,l)}return n.computeBoundingSphere(),n}function ws(e,t,n,r,i){if(t===`vertex`){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&e.vertices.push(n[r.attrX],n[r.attrY],n[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&e.normals.push(n[r.attrNX],n[r.attrNY],n[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&e.uvs.push(n[r.attrS],n[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(ps.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.colors.push(ps.r,ps.g,ps.b));for(let t of Object.keys(i.customPropertyMapping))for(let r of i.customPropertyMapping[t].itemNames)e[t].push(n[r])}else if(t===`face`){let t=n.vertex_indices||n.vertex_index,i=n.texcoord;t.length===3?(e.indices.push(t[0],t[1],t[2]),i&&i.length===6&&(e.faceVertexUvs.push(i[0],i[1]),e.faceVertexUvs.push(i[2],i[3]),e.faceVertexUvs.push(i[4],i[5]))):t.length===4&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(ps.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.faceVertexColors.push(ps.r,ps.g,ps.b),e.faceVertexColors.push(ps.r,ps.g,ps.b),e.faceVertexColors.push(ps.r,ps.g,ps.b))}}function Ts(e,t){let n={},r=0;for(let i=0;i<t.length;i++){let a=t[i],o=a.valueReader;if(a.type===`list`){let t=[],i=a.countReader.read(e+r);r+=a.countReader.size;for(let n=0;n<i;n++)t.push(o.read(e+r)),r+=o.size;n[a.name]=t}else n[a.name]=o.read(e+r),r+=o.size}return[n,r]}function Es(e,t,n){function r(e,t,n){switch(t){case`int8`:case`char`:return{read:t=>e.getInt8(t),size:1};case`uint8`:case`uchar`:return{read:t=>e.getUint8(t),size:1};case`int16`:case`short`:return{read:t=>e.getInt16(t,n),size:2};case`uint16`:case`ushort`:return{read:t=>e.getUint16(t,n),size:2};case`int32`:case`int`:return{read:t=>e.getInt32(t,n),size:4};case`uint32`:case`uint`:return{read:t=>e.getUint32(t,n),size:4};case`float32`:case`float`:return{read:t=>e.getFloat32(t,n),size:4};case`float64`:case`double`:return{read:t=>e.getFloat64(t,n),size:8};default:throw Error(`not support type: `+t)}}for(let i=0,a=e.length;i<a;i++){let a=e[i];a.type===`list`?(a.countReader=r(t,a.countType,n),a.valueReader=r(t,a.itemType,n)):a.valueReader=r(t,a.type,n)}}function Ds(e,t,n){let r=bs(n),i=t.format===`binary_little_endian`,a=new DataView(e,t.headerLength),o,s=0;for(let e=0;e<t.elements.length;e++){let c=t.elements[e],l=c.properties,u=xs(l);Es(l,a,i);for(let e=0;e<c.count;e++){o=Ts(s,l),s+=o[1];let e=o[0];ws(r,c.name,e,u,n)}}return Cs(r,n)}function Os(e){let t=0,n=!0,r=``,i=[],a=new TextDecoder().decode(e.subarray(0,5)),o=/^ply\r\n/.test(a);do{let a=String.fromCharCode(e[t++]);a!==`
|
|
831
|
-
`&&a!==`\r`?r+=a:(r===`end_header`&&(n=!1),r!==``&&(i.push(r),r=``))}while(n&&t<e.length);return o===!0&&t++,{headerText:i.join(`\r`)+`\r`,headerLength:t}}var ks=class{constructor(e){this.arr=e,this.i=0}empty(){return this.i>=this.arr.length}next(){return this.arr[this.i++]}},As=Uint8Array,js=Uint16Array,Ms=Int32Array,Ns=new As([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ps=new As([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Fs=new As([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Is=function(e,t){for(var n=new js(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Ms(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Ls=Is(Ns,2),Rs=Ls.b,zs=Ls.r;Rs[28]=258,zs[258]=28;var Bs=Is(Ps,0),Vs=Bs.b;Bs.r;for(var Hs=new js(32768),Us=0;Us<32768;++Us){var Ws=(Us&43690)>>1|(Us&21845)<<1;Ws=(Ws&52428)>>2|(Ws&13107)<<2,Ws=(Ws&61680)>>4|(Ws&3855)<<4,Hs[Us]=((Ws&65280)>>8|(Ws&255)<<8)>>1}for(var Gs=(function(e,t,n){for(var r=e.length,i=0,a=new js(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new js(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new js(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[Hs[d]>>c]=l}else for(s=new js(r),i=0;i<r;++i)e[i]&&(s[i]=Hs[o[e[i]-1]++]>>15-e[i]);return s}),Ks=new As(288),Us=0;Us<144;++Us)Ks[Us]=8;for(var Us=144;Us<256;++Us)Ks[Us]=9;for(var Us=256;Us<280;++Us)Ks[Us]=7;for(var Us=280;Us<288;++Us)Ks[Us]=8;for(var qs=new As(32),Us=0;Us<32;++Us)qs[Us]=5;Gs(Ks,9,0);var Js=Gs(Ks,9,1);Gs(qs,5,0);var Ys=Gs(qs,5,1),Xs=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Zs=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Qs=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},$s=function(e){return(e+7)/8|0},ec=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new As(e.subarray(t,n))},tc=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],nc=function(e,t,n){var r=Error(t||tc[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,nc),!n)throw r;return r},rc=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new As(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new As(i*3));var l=function(e){var t=n.length;if(e>t){var r=new As(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=Zs(e,d,1);var v=Zs(e,d+1,3);if(d+=3,!v){var y=$s(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&nc(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=Js,m=Ys,h=9,g=5;else if(v==2){var S=Zs(e,d,31)+257,C=Zs(e,d+10,15)+4,w=S+Zs(e,d+5,31)+1;d+=14;for(var T=new As(w),E=new As(19),D=0;D<C;++D)E[Fs[D]]=Zs(e,d+D*3,7);d+=C*3;for(var O=Xs(E),k=(1<<O)-1,A=Gs(E,O,1),D=0;D<w;){var j=A[Zs(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+Zs(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+Zs(e,d,7),d+=3):y==18&&(N=11+Zs(e,d,127),d+=7);N--;)T[D++]=M}}var ee=T.subarray(0,S),P=T.subarray(S);h=Xs(ee),g=Xs(P),p=Gs(ee,h,1),m=Gs(P,g,1)}else nc(1);if(d>_){c&&nc(0);break}}s&&l(f+131072);for(var te=(1<<h)-1,ne=(1<<g)-1,re=d;;re=d){var M=p[Qs(e,d)&te],ie=M>>4;if(d+=M&15,d>_){c&&nc(0);break}if(M||nc(2),ie<256)n[f++]=ie;else if(ie==256){re=d,p=null;break}else{var ae=ie-254;if(ie>264){var D=ie-257,oe=Ns[D];ae=Zs(e,d,(1<<oe)-1)+Rs[D],d+=oe}var F=m[Qs(e,d)&ne],se=F>>4;F||nc(3),d+=F&15;var P=Vs[se];if(se>3){var oe=Ps[se];P+=Qs(e,d)&(1<<oe)-1,d+=oe}if(d>_){c&&nc(0);break}s&&l(f+131072);var I=f+ae;if(f<P){var ce=a-P,le=Math.min(P,I);for(ce+f<0&&nc(3);f<le;++f)n[f]=r[ce+f]}for(;f<I;++f)n[f]=n[f-P]}}t.l=p,t.p=re,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?ec(n,0,f):n.subarray(0,f)},ic=new As(0),ac=function(e,t){return e[t]|e[t+1]<<8},oc=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},sc=function(e,t){return oc(e,t)+oc(e,t+4)*4294967296},cc=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&nc(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&nc(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function lc(e,t){return rc(e,{i:2},t&&t.out,t&&t.dictionary)}function uc(e,t){return rc(e.subarray(cc(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var dc=typeof TextDecoder<`u`&&new TextDecoder;try{dc.decode(ic,{stream:!0})}catch(e){}var fc=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:ec(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function pc(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else if(dc)return dc.decode(e);else{var i=fc(e),a=i.s,n=i.r;return n.length&&nc(8),a}}var mc=function(e,t){return t+30+ac(e,t+26)+ac(e,t+28)},hc=function(e,t,n){var r=ac(e,t+28),i=pc(e.subarray(t+46,t+46+r),!(ac(e,t+8)&2048)),a=t+46+r,o=oc(e,t+20),s=n&&o==4294967295?gc(e,a):[o,oc(e,t+24),oc(e,t+42)],c=s[0],l=s[1],u=s[2];return[ac(e,t+10),c,l,i,a+ac(e,t+30)+ac(e,t+32),u]},gc=function(e,t){for(;ac(e,t)!=1;t+=4+ac(e,t+2));return[sc(e,t+12),sc(e,t+4),sc(e,t+20)]};function _c(e,t){for(var n={},r=e.length-22;oc(e,r)!=101010256;--r)(!r||e.length-r>65558)&&nc(13);var i=ac(e,r+8);if(!i)return{};var a=oc(e,r+16),o=a==4294967295||i==65535;if(o){var s=oc(e,r-12);o=oc(e,s)==101075792,o&&(i=oc(e,s+32),a=oc(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=hc(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=mc(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=lc(e.subarray(_,_+f),{out:new As(p)}):nc(14,`unknown compression type `+d):n[m]=ec(e,_,_+f))}return n}function vc(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l=0;return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s).then(e=>(l=e.body.byteLength,e.body))).then(n=>{var r;return yc(n,{light:t.light,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,fetcher:o})}).then(t=>{let n=t.scene,r=t.unitScale/100,i=new c.Matrix4;if(i.makeScale(r,r,r),t.upAxis===`X`)throw Error(`Cannot load fbx x upAxis`);return t.upAxis===`Y`&&i.premultiply(Xn),a===`Y`&&i.premultiply(Zn),n.applyMatrix4(i),{type:`fbx`,modelUpAxis:t.upAxis,upAxis:a,uri:e,byteLength:l,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:t.animations,dispose:()=>t.dispose()}})}function yc(e,t){let n;if(Dc(e))n=new wc().parse(e);else{let t=Rc(e);if(!Oc(t))throw Error(`THREE.FBXLoader: Unknown format.`);if(kc(t)<7e3)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+kc(t));n=new Cc().parse(t)}return new bc(t).parse(n)}var bc=class{constructor(e){var t,n,r;this.light=(t=e.light)==null?!0:t,this.resourcePath=(n=e.resourcePath)==null?``:n,this.search=(r=e.search)==null?``:r,this.fetcher=e.fetcher}parse(e){var t,n,r,i,a,o;let s=this.parseConnections(e),l=Object.assign(new c.Group,{animations:[]}),u=[],d=this.parseImages(e),f=this.parseTextures(e,d,s,u),p=this.parseMaterials(e,f,s),m=this.parseDeformers(e,s),h=new xc().parse(e,m,s);this.parseScene(e,m,h,p,s,l);let g=(n=(t=e.GlobalSettings.UpAxis)==null?void 0:t.value)==null?1:n,_=(i=(r=e.GlobalSettings.FrontAxis)==null?void 0:r.value)==null?2:i,v=(o=(a=e.GlobalSettings.UnitScaleFactor)==null?void 0:a.value)==null?1:o,y;if(e.GlobalSettings.AmbientColor){let t=e.GlobalSettings.AmbientColor.value,n=t[0],r=t[1],i=t[2];if(n!==0||r!==0||i!==0){let e=new c.Color().setRGB(n,r,i);y=new c.AmbientLight(e,1)}}return Promise.all(u).then(e=>{var t;return{scene:l,textures:e,ambientLight:y,upAxis:[`X`,`Y`,`Z`][g],frontAxis:[`X`,`Y`,`Z`][_],unitScale:v,animations:(t=l.animations)==null?[]:t,dispose:()=>{e.forEach(e=>e.dispose()),p.forEach(e=>e.dispose()),h.forEach(e=>e.dispose())}}})}parseConnections(e){let t=new Map;return`Connections`in e&&e.Connections.connections.forEach(function(e){let n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});let a={ID:r,relationship:i};t.get(n).parents.push(a),t.has(r)||t.set(r,{parents:[],children:[]});let o={ID:n,relationship:i};t.get(r).children.push(o)}),t}parseImages(e){let t={},n={};if(`Video`in e.Objects){let r=e.Objects.Video;for(let e in r){let i=r[e],a=parseInt(e);if(t[a]=i.RelativeFilename||i.Filename,`Content`in i){let t=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,a=typeof i.Content==`string`&&i.Content!==``;if(t||a){let t=this.parseImage(r[e]);n[i.RelativeFilename||i.Filename]=t}}}}for(let e in t){let r=t[e];n[r]===void 0?t[e]=t[e].split(`\\`).pop():t[e]=n[r]}return t}parseImage(e){let t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(`.`)+1).toLowerCase(),i;switch(r){case`bmp`:i=`image/bmp`;break;case`jpg`:case`jpeg`:i=`image/jpeg`;break;case`png`:i=`image/png`;break;case`tif`:i=`image/tiff`;break;case`tga`:i=`image/tga`;break;default:return}if(typeof t==`string`)return`data:`+i+`;base64,`+t;{let e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:i}))}}parseTextures(e,t,n,r){let i=new Map;if(`Texture`in e.Objects){let a=e.Objects.Texture;for(let e in a){let o=this.parseTexture(a[e],t,n,r);i.set(parseInt(e),o)}}return i}parseTexture(e,t,n,r){let i=this.loadTexture(e,t,n,r);i.ID=e.id,i.name=e.attrName;let a=e.WrapModeU,o=e.WrapModeV,s=a===void 0?0:a.value,l=o===void 0?0:o.value;if(i.wrapS=s===0?c.RepeatWrapping:c.ClampToEdgeWrapping,i.wrapT=l===0?c.RepeatWrapping:c.ClampToEdgeWrapping,e.Scaling){let t=e.Scaling.value;i.repeat.x=t[0],i.repeat.y=t[1]}if(e.Translation){let t=e.Translation.value;i.offset.x=t[0],i.offset.y=t[1]}return i}loadTexture(e,t,n,r){let i=n.get(e.id).children,a=``;i!==void 0&&i.length>0&&t[i[0].ID]!==void 0&&(a=t[i[0].ID]),a=br(this.resourcePath,xr(a,this.search));let o=Object.assign(new c.Texture,{ID:0}),s;s=si()?this.fetcher.ajax(a,{responseType:`blob`}).then(e=>{let t=e.body;return li(t)}):this.fetcher.loadImage(a,{},void 0,void 0,void 0,ci()).then(e=>e.body);let l=s.then(e=>(o.image=e,o.needsUpdate=!0,o)).catch(e=>(console.warn(e),o));return r.push(l),o}parseMaterials(e,t,n){let r=new Map;if(`Material`in e.Objects){let i=e.Objects.Material;for(let a in i){let o=this.parseMaterial(e,i[a],t,n);o!==null&&r.set(parseInt(a),o)}}return r}parseMaterial(e,t,n,r){let i=t.id,a=t.attrName,o=t.ShadingModel;if(typeof o==`object`&&(o=o.value),o=o.toLowerCase(),!r.has(i))return null;let s=new vn(this.light?`phong`:`basic`);s.name=a,t.BumpFactor&&(s.bumpScale=t.BumpFactor.value),t.Diffuse?s.color=new c.Color().fromArray(t.Diffuse.value):t.DiffuseColor&&(t.DiffuseColor.type===`Color`||t.DiffuseColor.type===`ColorRGB`)&&(s.color=new c.Color().fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(s.displacementScale=t.DisplacementFactor.value),t.Emissive?s.emissive=new c.Color().fromArray(t.Emissive.value):t.EmissiveColor&&(t.EmissiveColor.type===`Color`||t.EmissiveColor.type===`ColorRGB`)&&(s.emissive=new c.Color().fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(s.emissiveIntensity=parseFloat(t.EmissiveFactor.value));let l=1-(t.TransparencyFactor?parseFloat(t.TransparencyFactor.value):0);(l===1||l===0)&&(l=t.Opacity?parseFloat(t.Opacity.value):null,l===null&&(l=1-(t.TransparentColor?parseFloat(t.TransparentColor.value[0]):0))),s.opacity=l,s.opacity<1&&(s.transparent=!0),t.ReflectionFactor&&(s.reflectivity=t.ReflectionFactor.value),t.Shininess&&(s.shininess=t.Shininess.value),t.Specular?s.specular=new c.Color().fromArray(t.Specular.value):t.SpecularColor&&t.SpecularColor.type===`Color`&&(s.specular=new c.Color().fromArray(t.SpecularColor.value));let u=this;return r.get(i).children.forEach(function(t){let i=t.relationship;switch(i){case`Bump`:s.bumpMap=u.getTexture(e,n,t.ID,r);break;case`Maya|TEX_ao_map`:s.aoMap=u.getTexture(e,n,t.ID,r);break;case`DiffuseColor`:case`Maya|TEX_color_map`:s.map=u.getTexture(e,n,t.ID,r),s.map!==void 0&&(s.map.encoding=c.sRGBEncoding);break;case`DisplacementColor`:s.displacementMap=u.getTexture(e,n,t.ID,r);break;case`EmissiveColor`:s.emissiveMap=u.getTexture(e,n,t.ID,r),s.emissiveMap!==void 0&&(s.emissiveMap.encoding=c.sRGBEncoding);break;case`NormalMap`:case`Maya|TEX_normal_map`:s.normalMap=u.getTexture(e,n,t.ID,r);break;case`ReflectionColor`:s.envMap=u.getTexture(e,n,t.ID,r),s.envMap!==void 0&&(s.envMap.mapping=c.EquirectangularReflectionMapping,s.envMap.encoding=c.sRGBEncoding);break;case`SpecularColor`:s.specularMap=u.getTexture(e,n,t.ID,r),s.specularMap!==void 0&&(s.specularMap.encoding=c.sRGBEncoding);break;case`TransparentColor`:case`TransparencyFactor`:s.alphaMap=u.getTexture(e,n,t.ID,r),s.transparent=!0;break;default:console.warn(`THREE.FBXLoader: %s map is not supported in three.js, skipping texture.`,i);break}}),s}getTexture(e,t,n,r){return e.Objects.LayeredTexture&&n in e.Objects.LayeredTexture&&(console.warn(`THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.`),n=r.get(n).children[0].ID),t.get(n)}parseDeformers(e,t){let n={},r={};if(`Deformer`in e.Objects){let i=e.Objects.Deformer;for(let e in i){let a=i[e],o=t.get(parseInt(e));if(a.attrType===`Skin`){let t=this.parseSkeleton(o,i);t.ID=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: skeleton attached to more than one geometry is not supported.`),t.geometryID=o.parents[0].ID,n[e]=t}else if(a.attrType===`BlendShape`){let n={id:e};n.rawTargets=this.parseMorphTargets(o,i,t),n.id=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: morph target attached to more than one geometry is not supported.`),r[e]=n}}}return{skeletons:n,morphTargets:r}}parseSkeleton(e,t){let n=[];return e.children.forEach(function(e){let r=t[e.ID];if(r.attrType!==`Cluster`)return;let i={ID:e.ID,indices:[],weights:[],transformLink:new c.Matrix4().fromArray(r.TransformLink.a)};r.Indexes&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}),{ID:``,geometryID:0,rawBones:n,bones:[]}}parseMorphTargets(e,t,n){let r=[];for(let i=0;i<e.children.length;i++){let a=e.children[i],o=t[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a,geoID:0};if(o.attrType!==`BlendShapeChannel`)return;s.geoID=n.get(parseInt(a.ID)).children.filter(function(e){return e.relationship===void 0})[0].ID,r.push(s)}return r}parseScene(e,t,n,r,i,a){let o=this.parseModels(e,t.skeletons,n,r,i),s=e.Objects.Model,l=this;o.forEach(function(t){let n=s[t.ID];l.setLookAtProperties(e,t,n,i,a),i.get(t.ID).parents.forEach(function(e){let n=o.get(e.ID);n!==void 0&&n.add(t)}),t.parent===null&&a.add(t)}),this.bindSkeleton(e,t.skeletons,n,o,i),a.traverse(function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);let t=Fc(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix(!0,!0)}});let u=new Sc().parse(e,i,a);a.children.length===1&&a.children[0]instanceof c.Group&&(a=a.children[0]),a.animations=u}parseModels(e,t,n,r,i){let a=new Map,o=e.Objects.Model;for(let s in o){let l=parseInt(s),u=o[s],d=i.get(l),f=this.buildSkeleton(d,t,l,u.attrName);if(!f){switch(u.attrType){case`Camera`:f=this.createCamera(e,d);break;case`Light`:f=this.createLight(e,d);break;case`Mesh`:f=this.createMesh(d,n,r);break;case`NurbsCurve`:case`LimbNode`:case`Root`:f=new c.Bone;break;default:f=new c.Group;break}f.name=u.attrName?c.PropertyBinding.sanitizeNodeName(u.attrName):``,f.userData.originalName=u.attrName,f.ID=l}this.getTransformData(f,u),a.set(l,f)}return a}buildSkeleton(e,t,n,r){let i=null;return e.parents.forEach(function(e){for(let a in t){let o=t[a];o.rawBones.forEach(function(t,a){if(t.ID===e.ID){let e=i;i=new c.Bone,i.matrixWorld.copy(t.transformLink),i.name=r?c.PropertyBinding.sanitizeNodeName(r):``,i.userData.originalName=r,i.ID=n,o.bones[a]=i,e!==null&&i.add(e)}})}}),i}createCamera(e,t){let n,r;if(t.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(r=n)}),r===void 0)n=new c.Object3D;else{let e=0;r.CameraProjectionType!==void 0&&r.CameraProjectionType.value===1&&(e=1);let t=1;r.NearPlane!==void 0&&(t=r.NearPlane.value/1e3);let i=1e3;r.FarPlane!==void 0&&(i=r.FarPlane.value/1e3);let a=window.innerWidth,o=window.innerHeight;r.AspectWidth!==void 0&&r.AspectHeight!==void 0&&(a=r.AspectWidth.value,o=r.AspectHeight.value);let s=a/o,l=45;r.FieldOfView!==void 0&&(l=r.FieldOfView.value);let u=r.FocalLength?r.FocalLength.value:null;switch(e){case 0:n=new c.PerspectiveCamera(l,s,t,i),u!==null&&n.setFocalLength(u);break;case 1:console.warn(`THREE.FBXLoader: Orthographic cameras not supported yet.`),n=new c.Object3D;break;default:console.warn(`THREE.FBXLoader: Unknown camera type `+e+`.`),n=new c.Object3D;break}}return n}createLight(e,t){let n,r;if(t.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(r=n)}),r===void 0)n=new c.Object3D;else{let e;e=r.LightType===void 0?0:r.LightType.value;let t=new c.Color(16777215);r.Color!==void 0&&(t=new c.Color().fromArray(r.Color.value));let i=r.Intensity===void 0?1:r.Intensity.value/100;r.CastLightOnObject!==void 0&&r.CastLightOnObject.value===0&&(i=0);let a=0;switch(r.FarAttenuationEnd!==void 0&&(a=r.EnableFarAttenuation!==void 0&&r.EnableFarAttenuation.value===0?0:r.FarAttenuationEnd.value),e){case 0:n=new c.PointLight(t,i,a,1);break;case 1:n=new c.DirectionalLight(t,i);break;case 2:let e=Math.PI/3;r.InnerAngle!==void 0&&(e=c.MathUtils.degToRad(r.InnerAngle.value));let o=0;r.OuterAngle!==void 0&&(o=c.MathUtils.degToRad(r.OuterAngle.value),o=Math.max(o,1)),n=new c.SpotLight(t,i,a,e,o,1);break;default:console.warn(`THREE.FBXLoader: Unknown light type `+r.LightType.value+`, defaulting to a PointLight.`),n=new c.PointLight(t,i);break}r.CastShadows!==void 0&&r.CastShadows.value===1&&(n.castShadow=!0)}return n}createMesh(e,t,n){let r,i=null,a=[];if(e.children.forEach(function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&a.push(n.get(e.ID))}),a.length===0){let e=new vn(this.light?`phong`:`basic`);e.color=new c.Color(13421772),a.push(e)}return`color`in i.attributes&&a.forEach(function(e){e.vertexColors=!0}),(!i.groups||i.groups.length===0)&&i.addGroup(0,i.index?i.index.count:i.attributes.position.count,0),i.FBX_Deformer?(a.forEach(function(e){e.skinning=!0}),r=new bn(i,a),r.normalizeSkinWeights()):r=new yn(i,a),r}createCurve(e,t){let n=e.children.reduce(function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e},null),r=new c.LineBasicMaterial({name:``,color:3342591,linewidth:1});return new c.Line(n,r)}getTransformData(e,t){let n={};t.InheritType&&(n.inheritType=parseInt(t.InheritType.value)),t.RotationOrder?n.eulerOrder=Ic(t.RotationOrder.value):n.eulerOrder=Ic(0),t.Lcl_Translation&&(n.translation=t.Lcl_Translation.value),t.PreRotation&&(n.preRotation=t.PreRotation.value),t.Lcl_Rotation&&(n.rotation=t.Lcl_Rotation.value),t.PostRotation&&(n.postRotation=t.PostRotation.value),t.Lcl_Scaling&&(n.scale=t.Lcl_Scaling.value),t.ScalingOffset&&(n.scalingOffset=t.ScalingOffset.value),t.ScalingPivot&&(n.scalingPivot=t.ScalingPivot.value),t.RotationOffset&&(n.rotationOffset=t.RotationOffset.value),t.RotationPivot&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t,n,r,i){`LookAtProperty`in n&&r.get(t.ID).children.forEach(function(n){if(n.relationship===`LookAtProperty`){let r=e.Objects.Model[n.ID];if(r.Lcl_Translation){let e=r.Lcl_Translation.value;`target`in t&&t.target instanceof c.Object3D?(t.target.position.fromArray(e),i.add(t.target)):t.lookAt(new c.Vector3().fromArray(e))}}})}bindSkeleton(e,t,n,r,i){let a=this.parsePoseNodes(e);for(let e in t){let o=t[e];i.get(parseInt(o.ID)).parents.forEach(function(e){if(n.has(e.ID)){let t=e.ID;i.get(t).parents.forEach(function(e){if(r.has(e.ID)){let t=r.get(e.ID);t instanceof c.SkinnedMesh&&t.bind(new c.Skeleton(o.bones),a[e.ID])}})}})}}parsePoseNodes(e){let t={};if(e.Objects.Pose){let n=e.Objects.Pose;for(let e in n)if(n[e].attrType===`BindPose`&&n[e].NbPoseNodes>0){let r=n[e].PoseNode;Array.isArray(r)?r.forEach(function(e){t[e.Node]=new c.Matrix4().fromArray(e.Matrix.a)}):t[r.Node]=new c.Matrix4().fromArray(r.Matrix.a)}}return t}},xc=class{constructor(){this.negativeMaterialIndices=!1}parse(e,t,n){let r=new Map;if(`Geometry`in e.Objects){let i=e.Objects.Geometry;for(let a in i){let o=n.get(parseInt(a)),s=this.parseGeometry(e,o,i[a],t);r.set(parseInt(a),s)}}return this.negativeMaterialIndices===!0&&console.warn(`THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected.`),r}parseGeometry(e,t,n,r){switch(n.attrType){case`Mesh`:return this.parseMeshGeometry(e,t,n,r);case`NurbsCurve`:return this.parseNurbsGeometry(n)}}parseMeshGeometry(e,t,n,r){let i=r.skeletons,a=[],o=t.parents.map(function(t){return e.Objects.Model[t.ID]});if(o.length===0)return;let s=t.children.reduce(function(e,t){return i[t.ID]!==void 0&&(e=i[t.ID]),e},null);t.children.forEach(function(e){r.morphTargets[e.ID]!==void 0&&a.push(r.morphTargets[e.ID])});let c=o[0],l={};c.RotationOrder&&(l.eulerOrder=Ic(c.RotationOrder.value)),c.InheritType&&(l.inheritType=parseInt(c.InheritType.value)),c.GeometricTranslation&&(l.translation=c.GeometricTranslation.value),c.GeometricRotation&&(l.rotation=c.GeometricRotation.value),c.GeometricScaling&&(l.scale=c.GeometricScaling.value);let u=Fc(l);return this.genGeometry(e,n,s,a,u)}genGeometry(e,t,n,r,i){let a=new c.BufferGeometry;t.attrName&&(a.name=t.attrName);let o=this.parseGeoNode(t,n),s=this.genBuffers(o),l=new c.Float32BufferAttribute(s.vertex,3);if(l.applyMatrix4(i),a.setAttribute(`position`,l),s.colors.length>0&&a.setAttribute(`color`,new c.Float32BufferAttribute(s.colors,3)),n&&(a.setAttribute(`skinIndex`,new c.Uint16BufferAttribute(s.weightsIndices,4)),a.setAttribute(`skinWeight`,new c.Float32BufferAttribute(s.vertexWeights,4)),a.FBX_Deformer=n),s.normal.length>0){let e=new c.Matrix3().getNormalMatrix(i),t=new c.Float32BufferAttribute(s.normal,3);t.applyNormalMatrix(e),a.setAttribute(`normal`,t)}if(s.uvs.forEach(function(e,t){let n=t===0?`uv`:`uv${t+1}`;a.setAttribute(n,new c.Float32BufferAttribute(s.uvs[t],2))}),o.material&&o.material.mappingType!==`AllSame`){let e=s.materialIndex[0],t=0;if(s.materialIndex.forEach(function(n,r){n!==e&&(a.addGroup(t,r-t,e),e=n,t=r)}),a.groups.length>0){let t=a.groups[a.groups.length-1],n=t.start+t.count;n!==s.materialIndex.length&&a.addGroup(n,s.materialIndex.length-n,e)}a.groups.length===0&&a.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(e,a,t,r,i),a}parseGeoNode(e,t){let n={};if(n.vertexPositions=e.Vertices===void 0?[]:e.Vertices.a,n.vertexIndices=e.PolygonVertexIndex===void 0?[]:e.PolygonVertexIndex.a,e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(r,i){n.weightTable[r]===void 0&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],o=[],s=[],c=[],l=[],u=[],d=this;return e.vertexIndices.forEach(function(f,p){let m=0,h=!1;f<0&&(f^=-1,h=!0);let g=[],_=[];if(a.push(f*3,f*3+1,f*3+2),e.color){let t=Mc(p,n,f,e.color);s.push(t[0],t[1],t[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(e){_.push(e.weight),g.push(e.id)}),_.length>4){i||(console.warn(`THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.`),i=!0);let e=[0,0,0,0],t=[0,0,0,0];_.forEach(function(n,r){let i=n,a=g[r];t.forEach(function(t,n,r){if(i>t){r[n]=i,i=t;let o=e[n];e[n]=a,a=o}})}),g=e,_=t}for(;_.length<4;)_.push(0),g.push(0);for(let e=0;e<4;++e)l.push(_[e]),u.push(g[e])}if(e.normal){let t=Mc(p,n,f,e.normal);o.push(t[0],t[1],t[2])}e.material&&e.material.mappingType!==`AllSame`&&(m=Mc(p,n,f,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(e,t){let r=Mc(p,n,f,e);c[t]===void 0&&(c[t]=[]),c[t].push(r[0]),c[t].push(r[1])}),r++,h&&(d.genFace(t,e,a,m,o,s,c,l,u,r),n++,r=0,a=[],o=[],s=[],c=[],l=[],u=[])}),t}getNormalNewell(e){let t=new c.Vector3(0,0,0);for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t.x+=(r.y-i.y)*(r.z+i.z),t.y+=(r.z-i.z)*(r.x+i.x),t.z+=(r.x-i.x)*(r.y+i.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){let t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new c.Vector3(0,1,0):new c.Vector3(0,0,1)).cross(t).normalize();return{normal:t,tangent:n,bitangent:t.clone().cross(n).normalize()}}flattenVertex(e,t,n){return new c.Vector2(e.dot(t),e.dot(n))}genFace(e,t,n,r,i,a,o,s,l,u){let d;if(u>3){let e=[],r=t.baseVertexPositions||t.vertexPositions;for(let t=0;t<n.length;t+=3)e.push(new c.Vector3(r[n[t]],r[n[t+1]],r[n[t+2]]));let{tangent:i,bitangent:a}=this.getNormalTangentAndBitangent(e),o=[];for(let t of e)o.push(this.flattenVertex(t,i,a));d=c.ShapeUtils.triangulateShape(o,[])}else d=[[0,1,2]];for(let[c,u,f]of d)e.vertex.push(t.vertexPositions[n[c*3]]),e.vertex.push(t.vertexPositions[n[c*3+1]]),e.vertex.push(t.vertexPositions[n[c*3+2]]),e.vertex.push(t.vertexPositions[n[u*3]]),e.vertex.push(t.vertexPositions[n[u*3+1]]),e.vertex.push(t.vertexPositions[n[u*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),t.skeleton&&(e.vertexWeights.push(s[c*4]),e.vertexWeights.push(s[c*4+1]),e.vertexWeights.push(s[c*4+2]),e.vertexWeights.push(s[c*4+3]),e.vertexWeights.push(s[u*4]),e.vertexWeights.push(s[u*4+1]),e.vertexWeights.push(s[u*4+2]),e.vertexWeights.push(s[u*4+3]),e.vertexWeights.push(s[f*4]),e.vertexWeights.push(s[f*4+1]),e.vertexWeights.push(s[f*4+2]),e.vertexWeights.push(s[f*4+3]),e.weightsIndices.push(l[c*4]),e.weightsIndices.push(l[c*4+1]),e.weightsIndices.push(l[c*4+2]),e.weightsIndices.push(l[c*4+3]),e.weightsIndices.push(l[u*4]),e.weightsIndices.push(l[u*4+1]),e.weightsIndices.push(l[u*4+2]),e.weightsIndices.push(l[u*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3])),t.color&&(e.colors.push(a[c*3]),e.colors.push(a[c*3+1]),e.colors.push(a[c*3+2]),e.colors.push(a[u*3]),e.colors.push(a[u*3+1]),e.colors.push(a[u*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2])),t.material&&t.material.mappingType!==`AllSame`&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[c*3]),e.normal.push(i[c*3+1]),e.normal.push(i[c*3+2]),e.normal.push(i[u*3]),e.normal.push(i[u*3+1]),e.normal.push(i[u*3+2]),e.normal.push(i[f*3]),e.normal.push(i[f*3+1]),e.normal.push(i[f*3+2])),t.uv&&t.uv.forEach(function(t,n){e.uvs[n]===void 0&&(e.uvs[n]=[]),e.uvs[n].push(o[n][c*2]),e.uvs[n].push(o[n][c*2+1]),e.uvs[n].push(o[n][u*2]),e.uvs[n].push(o[n][u*2+1]),e.uvs[n].push(o[n][f*2]),e.uvs[n].push(o[n][f*2+1])})}addMorphTargets(e,t,n,r,i){if(r.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];let a=this;r.forEach(function(r){r.rawTargets.forEach(function(r){let o=e.Objects.Geometry[r.geoID];o!==void 0&&a.genMorphGeometry(t,n,o,i,r.name)})})}genMorphGeometry(e,t,n,r,i){let a=t.Vertices===void 0?[]:t.Vertices.a,o=t.PolygonVertexIndex===void 0?[]:t.PolygonVertexIndex.a,s=n.Vertices===void 0?[]:n.Vertices.a,l=n.Indexes?n.Indexes.a:[],u=e.attributes.position.count*3,d=new Float32Array(u);for(let e=0;e<l.length;e++){let t=l[e]*3;d[t]=s[e*3],d[t+1]=s[e*3+1],d[t+2]=s[e*3+2]}let f={vertexIndices:o,vertexPositions:d,baseVertexPositions:a},p=this.genBuffers(f),m=new c.Float32BufferAttribute(p.vertex,3);m.name=i||n.attrName,m.applyMatrix4(r),e.morphAttributes.position.push(m)}parseNormals(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return n===`IndexToDirect`&&(e.NormalIndex?i=e.NormalIndex.a:e.NormalsIndex&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}parseUVs(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return n===`IndexToDirect`&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}}parseVertexColors(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];n===`IndexToDirect`&&(i=e.ColorIndex.a);for(let e=0,t=new c.Color;e<r.length;e+=4)t.fromArray(r,e),t.toArray(r,e);return{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}}parseMaterialIndices(e){let t=e.MappingInformationType,n=e.ReferenceInformationType;if(t===`NoMappingInformation`)return{dataSize:1,buffer:[0],indices:[0],mappingType:`AllSame`,referenceType:n};let r=e.Materials.a,i=[];for(let e=0;e<r.length;++e)i.push(e);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}parseNurbsGeometry(e){let t=parseInt(e.Order);if(isNaN(t))return console.error(`THREE.FBXLoader: Invalid Order %s given for geometry ID: %s`,e.Order,e.id),new c.BufferGeometry;let n=t-1,r=e.KnotVector.a,i=[],a=e.Points.a;for(let e=0,t=a.length;e<t;e+=4)i.push(new c.Vector4().fromArray(a,e));let o,s;if(e.Form===`Closed`)i.push(i[0]);else if(e.Form===`Periodic`){o=n,s=r.length-1-o;for(let e=0;e<n;++e)i.push(i[e])}let l=new Vc(n,r,i,o,s).getPoints(i.length*12);return new c.BufferGeometry().setFromPoints(l)}},Sc=class{parse(e,t,n){let r=[],i=this.parseClips(e,t,n);if(i!==void 0)for(let e in i){let t=i[e],a=this.addClip(t,n);r.push(a)}return r}parseClips(e,t,n){if(e.Objects.AnimationCurve===void 0)return;let r=this.parseAnimationCurveNodes(e);this.parseAnimationCurves(e,r,t);let i=this.parseAnimationLayers(e,r,t,n);return this.parseAnimStacks(e,i,t)}parseAnimationCurveNodes(e){let t=e.Objects.AnimationCurveNode,n=new Map;for(let e in t){let r=t[e];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){let e={id:r.id,attr:r.attrName,curves:{}};n.set(e.id,e)}}return n}parseAnimationCurves(e,t,n){let r=e.Objects.AnimationCurve;for(let e in r){let i={id:r[e].id,times:r[e].KeyTime.a.map(Ac),values:r[e].KeyValueFloat.a},a=n.get(i.id);if(a!==void 0){let e=a.parents[0].ID,n=a.parents[0].relationship,r=t.get(e);r&&(n.match(/X/)?r.curves.x=i:n.match(/Y/)?r.curves.y=i:n.match(/Z/)?r.curves.z=i:n.match(/DeformPercent/)&&t.has(e)&&(r.curves.morph=i))}}}parseAnimationLayers(e,t,n,r){let i=e.Objects.AnimationLayer,a=new Map;for(let o in i){let i=[],s=n.get(parseInt(o));s!==void 0&&(s.children.forEach((a,o)=>{if(t.has(a.ID)){let s=t.get(a.ID);if(s.curves.x!==void 0||s.curves.y!==void 0||s.curves.z!==void 0){if(i[o]===void 0){let t=n.get(a.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID;if(t!==void 0){let n=e.Objects.Model[t.toString()];if(n===void 0){console.warn(`THREE.FBXLoader: Encountered a unused curve.`,a);return}let s={modelName:n.attrName?c.PropertyBinding.sanitizeNodeName(n.attrName):``,ID:n.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new c.Matrix4,eulerOrder:``,preRotation:[0,0,0],postRotation:[0,0,0]};r.traverse(function(e){e.ID===n.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))}),s.transform||(s.transform=new c.Matrix4),n.PreRotation&&(s.preRotation=n.PreRotation.value),n.PostRotation&&(s.postRotation=n.PostRotation.value),i[o]=s}}i[o]&&(i[o][s.attr]=s)}else if(s.curves.morph!==void 0){if(i[o]===void 0){let t=n.get(a.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID,r=n.get(t).parents[0].ID,s=n.get(r).parents[0].ID,l=n.get(s).parents[0].ID,u=e.Objects.Model[l];i[o]={modelName:u.attrName?c.PropertyBinding.sanitizeNodeName(u.attrName):``,morphName:e.Objects.Deformer[t].attrName}}i[o][s.attr]=s}}}),a.set(parseInt(o),i))}return a}parseAnimStacks(e,t,n){let r=e.Objects.AnimationStack,i={};for(let e in r){let a=n.get(parseInt(e)).children;a.length>1&&console.warn(`THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.`);let o=t.get(a[0].ID);i[e]={name:r[e].attrName,layer:o}}return i}addClip(e,t){let n=[],r=this;return e.layer.forEach(function(e){n=n.concat(r.generateTracks(e,t))}),new c.AnimationClip(e.name,-1,n)}generateTracks(e,t){let n=[],r=new c.Vector3,i=new c.Vector3;e.transform&&e.transform.decompose(r,new c.Quaternion,i);let a=r.toArray(),o=i.toArray();if(e.T!==void 0&&Object.keys(e.T.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.T.curves,a,`position`);t!==void 0&&n.push(t)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let t=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);t!==void 0&&n.push(t)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.S.curves,o,`scale`);t!==void 0&&n.push(t)}if(e.DeformPercent!==void 0){let r=this.generateMorphTrack(e,t);r!==void 0&&n.push(r)}return n}generateVectorTrack(e,t,n,r){let i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new c.VectorKeyframeTrack(e+`.`+r,i,a)}generateRotationTrack(e,t,n,r,i){let a,o;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){let e=this.interpolateRotations(t.x,t.y,t.z,i);a=e[0],o=e[1]}let s=Ic(0),l=new c.Quaternion,u=new c.Quaternion;n!==void 0&&(n=n.map(c.MathUtils.degToRad),n.push(s),l.setFromEuler(new c.Euler().fromArray(n))),r!==void 0&&(r=r.map(c.MathUtils.degToRad),r.push(s),u.setFromEuler(new c.Euler().fromArray(r)),u.inverse());let d=new c.Quaternion,f=new c.Euler,p=[];if(!o||!a)return new c.QuaternionKeyframeTrack(e+`.quaternion`,[0],[0]);for(let e=0;e<o.length;e+=3)f.set(o[e],o[e+1],o[e+2],i),d.setFromEuler(f),d.premultiply(l),d.multiply(u),e>2&&new c.Quaternion().fromArray(p,(e-3)/3*4).dot(d)<0&&d.set(-d.x,-d.y,-d.z,-d.w),d.toArray(p,e/3*4);return new c.QuaternionKeyframeTrack(e+`.quaternion`,a,p)}generateMorphTrack(e,t){let n=e.DeformPercent.curves.morph,r=n.values.map(function(e){return e/100}),i=t.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new c.NumberKeyframeTrack(e.modelName+`.morphTargetInfluences[`+i+`]`,n.times,r)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(e,t){return e-t}),t.length>1){let e=1,n=t[0];for(let r=1;r<t.length;r++){let i=t[r];i!==n&&(t[e]=i,n=i,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){let r=n,i=[],a=-1,o=-1,s=-1;return e.forEach(function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),a!==-1){let e=t.x.values[a];i.push(e),r[0]=e}else i.push(r[0]);if(o!==-1){let e=t.y.values[o];i.push(e),r[1]=e}else i.push(r[1]);if(s!==-1){let e=t.z.values[s];i.push(e),r[2]=e}else i.push(r[2])}),i}interpolateRotations(e,t,n,r){let i=[],a=[];i.push(e.times[0]),a.push(c.MathUtils.degToRad(e.values[0])),a.push(c.MathUtils.degToRad(t.values[0])),a.push(c.MathUtils.degToRad(n.values[0]));for(let o=1;o<e.values.length;o++){let s=[e.values[o-1],t.values[o-1],n.values[o-1]];if(isNaN(s[0])||isNaN(s[1])||isNaN(s[2]))continue;let l=s.map(c.MathUtils.degToRad),u=[e.values[o],t.values[o],n.values[o]];if(isNaN(u[0])||isNaN(u[1])||isNaN(u[2]))continue;u.map(c.MathUtils.degToRad);let d=[u[0]-s[0],u[1]-s[1],u[2]-s[2]],f=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){let t=Math.max(...f)/180,n=new c.Euler(l[0],l[1],l[2],r),s=new c.Euler(l[0],l[1],l[2],r),u=new c.Quaternion().setFromEuler(n),d=new c.Quaternion().setFromEuler(s);u.dot(d)&&d.set(-d.x,-d.y,-d.z,-d.w);let p=e.times[o-1],m=e.times[o]-p,h=new c.Quaternion,g=new c.Euler;for(let e=0;e<1;e+=1/t)h.copy(u.clone().slerp(d.clone(),e)),i.push(p+e*m),g.setFromQuaternion(h,r),a.push(g.x),a.push(g.y),a.push(g.z)}else i.push(e.times[o]),a.push(c.MathUtils.degToRad(e.values[o])),a.push(c.MathUtils.degToRad(t.values[o])),a.push(c.MathUtils.degToRad(n.values[o]))}return[i,a]}},Cc=class{constructor(){this.allNodes=new Ec,this.nodeStack=[],this.currentIndent=0,this.currentPropName=``}getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),--this.currentIndent}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Ec,this.nodeStack=[],this.currentProp=[],this.currentPropName=``;let t=this,n=e.split(/[\r\n]+/);return n.forEach(function(e,r){let i=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(i||a)return;let o=e.match(`^\\t{`+t.currentIndent+`}(\\w+):(.*){`),s=e.match(`^\\t{`+t.currentIndent+`}(\\w+):[\\s\\t\\r\\n](.*)`),c=e.match(`^\\t{`+(t.currentIndent-1)+`}}`);o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++r]):c?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}),this.allNodes}parseNodeBegin(e,t){let n=t[1].trim().replace(/^"/,``).replace(/"$/,``),r=t[2].split(`,`).map(function(e){return e.trim().replace(/^"/,``).replace(/"$/,``)}),i={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,i):n in o?(n===`PoseNode`?o.PoseNode.push(i):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==``&&(o[n][a.id]=i)):typeof a.id==`number`?(o[n]={},o[n][a.id]=i):n!==`Properties70`&&(n===`PoseNode`?o[n]=[i]:o[n]=i),typeof a.id==`number`&&(i.id=a.id),a.name!==``&&(i.attrName=a.name),a.type!==``&&(i.attrType=a.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==``&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n=``,r=``;return e.length>1&&(n=e[1].replace(/^(\w+)::/,``),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,``).replace(/"$/,``).trim(),i=t[2].replace(/^"/,``).replace(/"$/,``).trim();r===`Content`&&i===`,`&&(i=n.replace(/"/g,``).replace(/,$/,``).trim());let a=this.getCurrentNode();if(a.name===`Properties70`){this.parseNodeSpecialProperty(e,r,i);return}if(r===`C`){let e=i.split(`,`).slice(1),t=parseInt(e[0]),n=parseInt(e[1]),o=i.split(`,`).slice(3);o=o.map(function(e){return e.trim().replace(/^"/,``)}),r=`connections`,i=[t,n],zc(i,o),a[r]===void 0&&(a[r]=[])}r===`Node`&&(a.id=i),r in a&&Array.isArray(a[r])?a[r].push(i):r===`a`?a.a=i:a[r]=i,this.setCurrentProp(a,r),r===`a`&&i.slice(-1)!==`,`&&(a.a=Lc(i))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==`,`&&(t.a=Lc(t.a))}parseNodeSpecialProperty(e,t,n){let r=n.split(`",`).map(function(e){return e.trim().replace(/^\"/,``).replace(/\s/,`_`)}),i=r[0],a=r[1],o=r[2],s=r[3],c=r[4];switch(a){case`int`:case`enum`:case`bool`:case`ULongLong`:case`double`:case`Number`:case`FieldOfView`:c=parseFloat(c);break;case`Color`:case`ColorRGB`:case`Vector3D`:case`Lcl_Translation`:case`Lcl_Rotation`:case`Lcl_Scaling`:c=Lc(c);break}this.getPrevNode()[i]={type:a,type2:o,flag:s,value:c},this.setCurrentProp(this.getPrevNode(),i)}},wc=class{parse(e){let t=new Tc(e);t.skip(23);let n=t.getUint32();if(n<6400)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+n);let r=new Ec;for(;!this.endOfContent(t);){let e=this.parseNode(t,n);e!==null&&r.add(e.name,e)}return r}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let a=e.getUint8(),o=e.getString(a);if(r===0)return null;let s=[];for(let t=0;t<i;t++)s.push(this.parseProperty(e));let c=s.length>0?s[0]:``,l=s.length>1?s[1]:``,u=s.length>2?s[2]:``;for(n.singleProperty=i===1&&e.getOffset()===r;r>e.getOffset();){let r=this.parseNode(e,t);r!==null&&this.parseSubNode(o,n,r)}return n.propertyList=s,typeof c==`number`&&(n.id=c),l!==``&&(n.attrName=l),u!==``&&(n.attrType=u),o!==``&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){let e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if(e===`Connections`&&n.name===`C`){let e=[];n.propertyList.forEach(function(t,n){n!==0&&e.push(t)}),t.connections===void 0&&(t.connections=[]),t.connections.push(e)}else if(n.name===`Properties70`)Object.keys(n).forEach(function(e){t[e]=n[e]});else if(e===`Properties70`&&n.name===`P`){let e=n.propertyList[0],r=n.propertyList[1],i=n.propertyList[2],a=n.propertyList[3],o;e.indexOf(`Lcl `)===0&&(e=e.replace(`Lcl `,`Lcl_`)),r.indexOf(`Lcl `)===0&&(r=r.replace(`Lcl `,`Lcl_`)),o=r===`Color`||r===`ColorRGB`||r===`Vector`||r===`Vector3D`||r.indexOf(`Lcl_`)===0?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[e]={type:r,type2:i,flag:a,value:o}}else t[n.name]===void 0?typeof n.id==`number`?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name===`PoseNode`?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){let t=e.getString(1),n;switch(t){case`C`:return e.getBoolean();case`D`:return e.getFloat64();case`F`:return e.getFloat32();case`I`:return e.getInt32();case`L`:return e.getInt64();case`R`:return n=e.getUint32(),e.getArrayBuffer(n);case`S`:return n=e.getUint32(),e.getString(n);case`Y`:return e.getInt16();case`b`:case`c`:case`d`:case`f`:case`i`:case`l`:let r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(i===0)switch(t){case`b`:case`c`:return e.getBooleanArray(r);case`d`:return e.getFloat64Array(r);case`f`:return e.getFloat32Array(r);case`i`:return e.getInt32Array(r);case`l`:return e.getInt64Array(r)}let o=new Tc(uc(new Uint8Array(e.getArrayBuffer(a))).buffer);switch(t){case`b`:case`c`:return o.getBooleanArray(r);case`d`:return o.getFloat64Array(r);case`f`:return o.getFloat32Array(r);case`i`:return o.getInt32Array(r);case`l`:return o.getInt64Array(r)}break;default:throw Error(`THREE.FBXLoader: Unknown property type `+t)}}},Tc=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t===void 0?!0:t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)==1}getBooleanArray(e){let t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){let e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){let e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){let e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){let e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){let e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){let t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);let r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}},Ec=class{constructor(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}add(e,t){this[e]=t}};function Dc(e){return e.byteLength>=21&&Rc(e,0,21)===`Kaydara FBX Binary \0`}function Oc(e){let t=[`K`,`a`,`y`,`d`,`a`,`r`,`a`,`\\`,`F`,`B`,`X`,`\\`,`B`,`i`,`n`,`a`,`r`,`y`,`\\`,`\\`],n=0;function r(t){let r=e[t-1];return e=e.slice(n+t),n++,r}for(let e=0;e<t.length;++e)if(r(1)===t[e])return!1;return!0}function kc(e){let t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw Error(`THREE.FBXLoader: Cannot find the version number for the file given.`)}function Ac(e){return e/46186158e3}var jc=[];function Mc(e,t,n,r){let i;switch(r.mappingType){case`ByPolygonVertex`:i=e;break;case`ByPolygon`:i=t;break;case`ByVertice`:i=n;break;case`AllSame`:i=r.indices[0];break;default:console.warn(`THREE.FBXLoader: unknown attribute mapping type `+r.mappingType),i=0}r.referenceType===`IndexToDirect`&&(i=r.indices[i]);let a=i*r.dataSize,o=a+r.dataSize;return Bc(jc,r.buffer,a,o)}var Nc=new c.Euler,Pc=new c.Vector3;function Fc(e){let t=new c.Matrix4,n=new c.Matrix4,r=new c.Matrix4,i=new c.Matrix4,a=new c.Matrix4,o=new c.Matrix4,s=new c.Matrix4,l=new c.Matrix4,u=new c.Matrix4,d=new c.Matrix4,f=new c.Matrix4,p=new c.Matrix4,m=e.inheritType?e.inheritType:0;e.translation&&t.setPosition(Pc.fromArray(e.translation));let h=Ic(0);if(e.preRotation){let t=e.preRotation.map(c.MathUtils.degToRad);t.push(h),n.makeRotationFromEuler(Nc.fromArray(t))}if(e.rotation){let t=e.rotation.map(c.MathUtils.degToRad);t.push(e.eulerOrder||h),r.makeRotationFromEuler(Nc.fromArray(t))}if(e.postRotation){let t=e.postRotation.map(c.MathUtils.degToRad);t.push(h),i.makeRotationFromEuler(Nc.fromArray(t)),i.copy(new c.Matrix4().getInverse(i))}e.scale&&a.scale(Pc.fromArray(e.scale)),e.scalingOffset&&s.setPosition(Pc.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(Pc.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(Pc.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(Pc.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(f.copy(e.parentMatrix),d.copy(e.parentMatrixWorld));let g=n.clone().multiply(r).multiply(i),_=new c.Matrix4;_.extractRotation(d);let v=new c.Matrix4;v.copyPosition(d);let y=new c.Matrix4().getInverse(v).multiply(d),b=new c.Matrix4().getInverse(_).multiply(y),x=a,S=new c.Matrix4;if(m===0)S.copy(_).multiply(g).multiply(b).multiply(x);else if(m===1)S.copy(_).multiply(b).multiply(g).multiply(x);else{let e=new c.Matrix4().scale(new c.Vector3().setFromMatrixScale(f)),t=new c.Matrix4().getInverse(e),n=b.clone().multiply(t);S.copy(_).multiply(g).multiply(n).multiply(x)}let C=new c.Matrix4().getInverse(u),w=new c.Matrix4().getInverse(o),T=t.clone().multiply(l).multiply(u).multiply(n).multiply(r).multiply(i).multiply(C).multiply(s).multiply(o).multiply(a).multiply(w),E=new c.Matrix4().copyPosition(T),D=d.clone().multiply(E);return p.copyPosition(D),T=p.clone().multiply(S),T.premultiply(new c.Matrix4().getInverse(d)),T}function Ic(e){e=e||0;let t=[`ZYX`,`YZX`,`XZY`,`ZXY`,`YXZ`,`XYZ`];return e===6?(console.warn(`THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.`),t[0]):t[e]}function Lc(e){return e.split(`,`).map(function(e){return parseFloat(e)})}function Rc(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),new TextDecoder().decode(new Uint8Array(e,t,n))}function zc(e,t){for(let n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}function Bc(e,t,n,r){for(let i=n,a=0;i<r;i++,a++)e[a]=t[i];return e}var Vc=class extends c.Curve{constructor(e,t,n,r,i){super();let a=t?t.length-1:0,o=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||a;for(let e=0;e<o;++e){let t=n[e];this.controlPoints[e]=new c.Vector4(t.x,t.y,t.z,t.w)}}getPoint(e,t=new c.Vector3){let n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=Wc(this.degree,this.knots,this.controlPoints,r);return i.w!==1&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}getTangent(e,t=new c.Vector3){let n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Yc(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n}toJSON(){let e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(e=>e.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(e=>new c.Vector4(e[0],e[1],e[2],e[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}};function Hc(e,t,n){let r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;let i=e,a=r,o=Math.floor((i+a)/2);for(;t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function Uc(e,t,n,r){let i=[],a=[],o=[];i[0]=1;for(let s=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[e+s]-t;let n=0;for(let e=0;e<s;++e){let t=o[e+1],r=a[s-e],c=i[e]/(t+r);i[e]=n+t*c,n=r*c}i[s]=n}return i}function Wc(e,t,n,r){let i=Hc(e,r,t),a=Uc(i,r,e,t),o=new c.Vector4(0,0,0,0);for(let t=0;t<=e;++t){let r=n[i-e+t],s=a[t],c=r.w*s;o.x+=r.x*c,o.y+=r.y*c,o.z+=r.z*c,o.w+=r.w*s}return o}function Gc(e,t,n,r,i){let a=[];for(let e=0;e<=n;++e)a[e]=0;let o=[];for(let e=0;e<=r;++e)o[e]=a.slice(0);let s=[];for(let e=0;e<=n;++e)s[e]=a.slice(0);s[0][0]=1;let c=a.slice(0),l=a.slice(0);for(let r=1;r<=n;++r){c[r]=t-i[e+1-r],l[r]=i[e+r]-t;let n=0;for(let e=0;e<r;++e){let t=l[e+1],i=c[r-e];s[r][e]=t+i;let a=s[e][r-1]/s[r][e];s[e][r]=n+t*a,n=i*a}s[r][r]=n}for(let e=0;e<=n;++e)o[0][e]=s[e][n];for(let e=0;e<=n;++e){let t=0,i=1,c=[];for(let e=0;e<=n;++e)c[e]=a.slice(0);c[0][0]=1;for(let a=1;a<=r;++a){let r=0,l=e-a,u=n-a;e>=a&&(c[i][0]=c[t][0]/s[u+1][l],r=c[i][0]*s[l][u]);let d=l>=-1?1:-l,f=e-1<=u?a-1:n-e;for(let e=d;e<=f;++e)c[i][e]=(c[t][e]-c[t][e-1])/s[u+1][l+e],r+=c[i][e]*s[l+e][u];e<=u&&(c[i][a]=-c[t][a-1]/s[u+1][e],r+=c[i][a]*s[e][u]),o[a][e]=r;let p=t;t=i,i=p}}let u=n;for(let e=1;e<=r;++e){for(let t=0;t<=n;++t)o[e][t]*=u;u*=n-e}return o}function Kc(e,t,n,r,i){let a=i<e?i:e,o=[],s=Hc(e,r,t),l=Gc(s,r,e,a,t),u=[];for(let e=0;e<n.length;++e){let t=n[e].clone(),r=t.w;t.x*=r,t.y*=r,t.z*=r,u[e]=t}for(let t=0;t<=a;++t){let n=u[s-e].clone().multiplyScalar(l[t][0]);for(let r=1;r<=e;++r)n.add(u[s-e+r].clone().multiplyScalar(l[t][r]));o[t]=n}for(let e=a+1;e<=i+1;++e)o[e]=new c.Vector4(0,0,0);return o}function qc(e,t){let n=1;for(let t=2;t<=e;++t)n*=t;let r=1;for(let e=2;e<=t;++e)r*=e;for(let n=2;n<=e-t;++n)r*=n;return n/r}function Jc(e){let t=e.length,n=[],r=[];for(let i=0;i<t;++i){let t=e[i];n[i]=new c.Vector3(t.x,t.y,t.z),r[i]=t.w}let i=[];for(let e=0;e<t;++e){let t=n[e].clone();for(let n=1;n<=e;++n)t.sub(i[e-n].clone().multiplyScalar(qc(e,n)*r[n]));i[e]=t.divideScalar(r[0])}return i}function Yc(e,t,n,r,i){return Jc(Kc(e,t,n,r,i))}var Xc=new c.Vector3;function Zc(e,t){switch(t){case`D`:return new Float64Array(e);case`F`:return new Float32Array(e);case`L`:return new Int32Array(e);case`I`:return new Int16Array(e);default:return new Uint8Array(e)}}function Qc(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(n=>{var r,i;return l.byteLength=n.body.byteLength,$c(new Uint8Array(n.body),{light:(r=t.light)==null?!0:r,color:t.color,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(i=e.split(`?`)[1])==null?``:i,fetcher:o})}).then(t=>{let n=new c.Group;return n.name=e,n.add(t.object),a===`Y`&&n.applyMatrix4(Zn),{type:`x3p`,modelUpAxis:`Z`,upAxis:a,uri:e,byteLength:l.byteLength,memoryUsage:Ai(n),scene:n,textures:[],animations:[],dispose:()=>t.dispose()}})}function $c(e,t){var n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,ee,P,te,ne,re,ie,ae,oe,F,se,I,ce,le,ue,de,fe,pe,me,he,ge,_e,ve,ye;let be=_c(e),xe=``,Se=null;for(let e of Object.keys(be))/(^|\/)main\.xml$/i.test(e)&&(Se=be[e],xe=e.slice(0,e.lastIndexOf(`/`)+1));if(!Se)throw Error(`X3p: main.xml not found.`);if(typeof DOMParser>`u`)throw Error(`X3p: DOMParser not found.`);let Ce=(n=t.color)==null?new c.Color(10066329):n,we=new DOMParser,Te=ja(Se),Ee=we.parseFromString(Te,`text/xml`),L=Ee.querySelector(`Record1 Axes`),De={x:{type:(a=(i=(r=L==null?void 0:L.querySelector(`CX AxisType`))==null?void 0:r.textContent)==null?void 0:i.toUpperCase())==null?`I`:a,dataType:(l=(s=(o=L==null?void 0:L.querySelector(`CX DataType`))==null?void 0:o.textContent)==null?void 0:s.toUpperCase())==null?`D`:l,increment:Number((d=(u=L==null?void 0:L.querySelector(`CX Increment`))==null?void 0:u.textContent)==null?`1`:d),offset:Number((p=(f=L==null?void 0:L.querySelector(`CX Offset`))==null?void 0:f.textContent)==null?`0`:p)},y:{type:(g=(h=(m=L==null?void 0:L.querySelector(`CY AxisType`))==null?void 0:m.textContent)==null?void 0:h.toUpperCase())==null?`I`:g,dataType:(y=(v=(_=L==null?void 0:L.querySelector(`CY DataType`))==null?void 0:_.textContent)==null?void 0:v.toUpperCase())==null?`D`:y,increment:Number((x=(b=L==null?void 0:L.querySelector(`CY Increment`))==null?void 0:b.textContent)==null?`1`:x),offset:Number((C=(S=L==null?void 0:L.querySelector(`CY Offset`))==null?void 0:S.textContent)==null?`0`:C)},z:{type:(E=(T=(w=L==null?void 0:L.querySelector(`CZ AxisType`))==null?void 0:w.textContent)==null?void 0:T.toUpperCase())==null?`A`:E,dataType:(k=(O=(D=L==null?void 0:L.querySelector(`CZ DataType`))==null?void 0:D.textContent)==null?void 0:O.toUpperCase())==null?`D`:k,increment:Number((j=(A=L==null?void 0:L.querySelector(`CZ Increment`))==null?void 0:A.textContent)==null?`1`:j),offset:Number((N=(M=L==null?void 0:L.querySelector(`CZ Offset`))==null?void 0:M.textContent)==null?`0`:N)}},Oe=null,ke=Ee.querySelector(`Record1 Axes Rotation`);ke&&(Oe=new c.Matrix3,Oe.set(Number((P=(ee=ke.querySelector(`r11`))==null?void 0:ee.textContent)==null?0:P),Number((ne=(te=ke.querySelector(`r12`))==null?void 0:te.textContent)==null?0:ne),Number((ie=(re=ke.querySelector(`r13`))==null?void 0:re.textContent)==null?0:ie),Number((oe=(ae=ke.querySelector(`r21`))==null?void 0:ae.textContent)==null?0:oe),Number((se=(F=ke.querySelector(`r22`))==null?void 0:F.textContent)==null?0:se),Number((ce=(I=ke.querySelector(`r23`))==null?void 0:I.textContent)==null?0:ce),Number((ue=(le=ke.querySelector(`r31`))==null?void 0:le.textContent)==null?0:ue),Number((fe=(de=ke.querySelector(`r32`))==null?void 0:de.textContent)==null?0:fe),Number((me=(pe=ke.querySelector(`r33`))==null?void 0:pe.textContent)==null?0:me)));let Ae=(he=Ee.querySelector(`Record3 DataLink PointDataLink`))==null?void 0:he.textContent;if(typeof Ae!=`string`)throw Error(`X3p: PointDataLink not found.`);Ae=br(xe,Ae);let je=be[Ae];if(!je)throw Error(`X3p: ${je} not found.`);let Me=Zc(je.buffer,De.z.dataType),Ne=Number((_e=(ge=Ee.querySelector(`Record3 MatrixDimension SizeX`))==null?void 0:ge.textContent)==null?`0`:_e),Pe=Number((ye=(ve=Ee.querySelector(`Record3 MatrixDimension SizeY`))==null?void 0:ve.textContent)==null?`0`:ye),Fe=Math.floor(Ne-1),Ie=Math.floor(Pe-1),R=Fe+1,Le=Ie+1,Re=new Float32Array(R*Le*3),ze=new Float32Array(R*Le*2),Be=new Uint32Array(Fe*Ie*6),Ve=new c.Box3;for(let e=0;e<Le;e++){let t=e*De.y.increment+De.y.offset;for(let n=0;n<R;n++){let r=e*R+n,i=n*De.x.increment+De.x.offset,a=Me[r],o=!isNaN(a),s=o?a:NaN;Xc.set(i,-t,s),Oe&&Xc.applyMatrix3(Oe),o&&Ve.expandByPoint(Xc),Re[r*3+0]=Xc.x,Re[r*3+1]=Xc.y,Re[r*3+2]=Xc.z,ze[r*2+0]=n/Fe,ze[r*2+1]=1-e/Ie}}for(let e=0;e<Ie;e++)for(let t=0;t<Fe;t++){let n=t+R*e,r=t+R*(e+1),i=t+1+R*(e+1),a=t+1+R*e,o=(e*Fe+t)*6;Be[o+0]=n,Be[o+1]=r,Be[o+2]=a,Be[o+3]=r,Be[o+4]=i,Be[o+5]=a}let He=new c.BufferGeometry;He.setAttribute(`position`,new c.BufferAttribute(Re,3)),He.setAttribute(`uv`,new c.BufferAttribute(ze,2)),He.setIndex(new c.BufferAttribute(Be,1)),(!He.groups||He.groups.length===0)&&He.addGroup(0,He.index?He.index.count:He.attributes.position.count,0),He.boundingBox=Ve;let Ue=new vn(t.light?`phong`:`basic`);return Ue.flatShading=!0,Ue.color.copy(Ce),{object:new yn(He,[Ue]),dispose:()=>{He.dispose(),Ue.dispose()}}}function el(e){let t=e.length/32;if(e.length%32!=0)throw Error(`Invalid splat file: data length ${e.length} is not a multiple of 32`);let n=new Float32Array(3*t),r=new Float32Array(4*t),i=new Float32Array(3*t),a=new Uint8Array(4*t),o=new Float32Array(e.buffer),s=new Uint8Array(e.buffer);for(let e=0;e<t;e++)n[3*e+0]=o[8*e+0],n[3*e+1]=o[8*e+1],n[3*e+2]=o[8*e+2],i[3*e+0]=o[8*e+3+0],i[3*e+1]=o[8*e+3+1],i[3*e+2]=o[8*e+3+2],a[4*e+0]=s[32*e+24+0],a[4*e+1]=s[32*e+24+1],a[4*e+2]=s[32*e+24+2],a[4*e+3]=s[32*e+24+3],r[4*e+0]=(s[32*e+28+0]-128)/128,r[4*e+1]=(s[32*e+28+1]-128)/128,r[4*e+2]=(s[32*e+28+2]-128)/128,r[4*e+3]=(s[32*e+28+3]-128)/128;return{numPoints:t,positions:n,scales:i,rotations:r,colors:a}}function tl(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?pr:i,l=(a=t.onDownloadProgress)==null?q:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>el(new Uint8Array(e))).then(t=>{let n=new Yn({positions:t.positions,scales:t.scales,rotations:t.rotations,colors:t.colors,numPoints:t.numPoints});return o===`Y`&&n.applyMatrix4(Xn),{type:`splat`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:Ai(n),scene:n,textures:[],animations:[],dispose:()=>n.dispose()}})}var nl;(function(e){e[e.Outside=-1]=`Outside`,e[e.Intersecting=0]=`Intersecting`,e[e.Inside=1]=`Inside`})(nl||(nl={}));var rl=1e-6,il=new c.Matrix4().identity(),X=new c.Vector3,al=new c.Matrix4,ol=new c.Vector3,sl=new c.Vector3,cl=new c.Vector3,ll=new c.Vector3,ul=new c.Box3,dl=new c.Sphere,fl=new c.Matrix4,pl=new c.Ray,ml=new c.Object3D,hl=new c.Frustum;function gl(e,t){let n=e.elements;return t.setFromRotationMatrix(al.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1)),t}var _l=class e{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(e=[]){this.planes=e}setFromFrustum(e){return this.planes=e.planes.map(e=>e.clone()),this}setFromCamera(e){return al.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),hl.setFromProjectionMatrix(al),this.setFromFrustum(hl),this}applyMatrix4(e){for(let t of this.planes)t.applyMatrix4(e)}copy(e){return this.planes=e.planes.map(e=>e.clone()),this}clone(){return new e().copy(this)}computeVisibility(e){let t=nl.Inside;for(let n of this.planes)switch(e.intersectPlane(n)){case nl.Outside:return nl.Outside;case nl.Intersecting:t=nl.Intersecting;break;default:}return t}computeVisibilityWithPlaneMask(t,n){if(n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;let r=e.MASK_INSIDE,i=Math.min(32,this.planes.length);for(let a=0;a<i;++a){let i=1<<a;if((n&i)===0)continue;let o=this.planes[a],s=t.intersectPlane(o);if(s===nl.Outside)return e.MASK_OUTSIDE;s===nl.Intersecting&&(r|=i)}return r}},vl=class e{constructor(){this.type=`box`,this.center=new c.Vector3,this.halfSize=new c.Vector3,this.rotation=new c.Matrix3}fromJson({box:e}){this.center.set(e[0],e[1],e[2]);let t=e[3],n=e[4],r=e[5],i=e[6],a=e[7],o=e[8],s=e[9],c=e[10],l=e[11],u=Math.max(Math.sqrt(t*t+n*n+r*r),.001),d=Math.max(Math.sqrt(i*i+a*a+o*o),.001),f=Math.max(Math.sqrt(s*s+c*c+l*l),.001);this.halfSize.set(u,d,f);let p=this.halfSize.toArray().reduce((e,t)=>e+t,0);return(isNaN(p)||p<=0)&&this.halfSize.setScalar(rl),this.rotation.fromArray([t/u,n/u,r/u,i/d,a/d,o/d,s/f,c/f,l/f]),isNaN(this.rotation.toArray().reduce((e,t)=>e+t,0))&&this.rotation.identity(),this}toJson(){return this.rotation.extractBasis(ol,sl,cl),{box:[...this.center.toArray(),...ol.multiplyScalar(this.halfSize.x).toArray(),...sl.multiplyScalar(this.halfSize.y).toArray(),...cl.multiplyScalar(this.halfSize.z).toArray()]}}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return new e().copy(this)}applyMatrix4(e){return e.equals(il)?this:(ml.position.copy(this.center),gl(this.rotation,ml.quaternion),ml.scale.copy(this.halfSize),ml.matrix.compose(ml.position,ml.quaternion,ml.scale),ml.matrix.premultiply(e),ml.matrix.decompose(ml.position,ml.quaternion,ml.scale),this.center.copy(ml.position),this.rotation.setFromMatrix4(al.makeRotationFromQuaternion(ml.quaternion)),this.halfSize.copy(ml.scale),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.rotation.elements,n=e.x-this.center.x,r=e.y-this.center.y,i=e.z-this.center.z,a=0,o;return o=n*t[0]+r*t[1]+i*t[2],o<0&&(o=-o),o-=this.halfSize.x,o>0&&(a+=o*o),o=n*t[3]+r*t[4]+i*t[5],o<0&&(o=-o),o-=this.halfSize.y,o>0&&(a+=o*o),o=n*t[6]+r*t[7]+i*t[8],o<0&&(o=-o),o-=this.halfSize.z,o>0&&(a+=o*o),a}distanceToPoint(e){return Math.sqrt(this.distanceSquaredToPoint(e))}distanceToPlane(e){let t=e.projectPoint(this.center,new c.Vector3);return this.distanceToPoint(t)}getBoundingBox(e){return e.makeEmpty(),this.rotation.extractBasis(ol,sl,cl),ol.setLength(this.halfSize.x),sl.setLength(this.halfSize.y),cl.setLength(this.halfSize.z),e.expandByPoint(X.copy(this.center).add(ol)),e.expandByPoint(X.copy(this.center).sub(ol)),e.expandByPoint(X.copy(this.center).add(sl)),e.expandByPoint(X.copy(this.center).sub(sl)),e.expandByPoint(X.copy(this.center).add(cl)),e.expandByPoint(X.copy(this.center).sub(cl)),e}toGeometry(){let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);X.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,0),X.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,3),X.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,6),X.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,9),X.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,12),X.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,15),X.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,18),X.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,21);let n=new c.BufferGeometry;return n.setIndex(new c.BufferAttribute(e,1)),n.setAttribute(`position`,new c.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n}intersectPlane(e){let t=this.center,n=e.normal,r=this.rotation.elements,i=this.halfSize,a=n.x,o=n.y,s=n.z,c=Math.abs(a*r[0]*i.x+o*r[1]*i.x+s*r[2]*i.x)+Math.abs(a*r[3]*i.y+o*r[4]*i.y+s*r[5]*i.y)+Math.abs(a*r[6]*i.z+o*r[7]*i.z+s*r[8]*i.z),l=n.dot(t)+e.constant;return l<=-c?nl.Outside:l>=c?nl.Inside:nl.Intersecting}intersectRay(e,t=0,n){if(ll.copy(this.halfSize).multiplyScalar(2),ul.setFromCenterAndSize(X.set(0,0,0),ll),ul.expandByScalar(t),this.rotation.extractBasis(ol,sl,cl),al.makeBasis(ol,sl,cl),al.setPosition(this.center),fl.getInverse(al),pl.copy(e).applyMatrix4(fl),ul.containsPoint(pl.origin))return!0;let r=pl.intersectBox(ul,X);return r?n===void 0?!0:(n+=t,r.distanceToSquared(pl.origin)<=n*n):!1}},yl=class e{constructor(){this.type=`sphere`,this.center=new c.Vector3,this.radius=-1}fromJson({sphere:e}){return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],rl),this}toJson(){return{sphere:[...this.center.toArray(),this.radius]}}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}clone(){return new e().copy(this)}getBoundingBox(e){return e.setFromCenterAndSize(this.center,ll.set(1,1,1).multiplyScalar(this.radius*2)),e}toGeometry(){let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+Math.sin(n)*this.radius,e[t*6+2]=this.center.z+0,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+Math.sin(n)*this.radius,e[t*6+5]=this.center.z+0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+0,e[t*6+2]=this.center.z+Math.sin(n)*this.radius,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+0,e[t*6+5]=this.center.z+Math.sin(n)*this.radius}let t=new c.BufferGeometry;return t.setAttribute(`position`,new c.BufferAttribute(e,3)),t.computeBoundingBox(),t.computeBoundingSphere(),t}applyMatrix4(e){return e.equals(il)?this:(this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.distanceToPoint(e);return t*t}distanceToPoint(e){let t=this.center.distanceTo(e)-this.radius;return t<=0?0:t}distanceToPlane(e){let t=Math.abs(e.distanceToPoint(this.center));return Math.max(0,t-this.radius)}intersectPlane(e){let t=this.center,n=this.radius,r=e.normal.dot(t)+e.constant;return r<-n?nl.Outside:r<n?nl.Intersecting:nl.Inside}intersectRay(e,t=0,n){if(dl.set(this.center,this.radius+t),dl.containsPoint(e.origin))return!0;let r=e.intersectSphere(dl,X);return r?n===void 0?!0:(n+=t,e.origin.distanceToSquared(r)<=n*n):!1}},bl=class e{constructor(){throw this.type=`regin`,this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,Error(`Region bounding volume not supported.`)}fromJson({region:e}){return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this}toJson(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}}copy(e){return this.west=e.west,this.south=e.south,this.east=e.east,this.north=e.north,this.minHeight=e.minHeight,this.maxHeight=e.maxHeight,this}clone(){return new e().copy(this)}getBoundingBox(e){throw Error(`not implemented`)}toGeometry(){throw Error(`not implemented`)}applyMatrix4(e){throw Error(`not implemented`)}getCenter(e){throw Error(`not implemented`)}distanceToPoint(e){throw Error(`not implemented`)}distanceSquaredToPoint(e){throw Error(`not implemented`)}distanceToPlane(e){throw Error(`not implemented`)}intersectPlane(e){throw Error(`not implemented`)}intersectRay(e,t=0,n){throw Error(`not implemented`)}};function xl(e){return e instanceof vl||e instanceof yl||e instanceof bl}function Sl(e){if(xl(e))return e;if(`box`in e)return new vl().fromJson(e);if(`sphere`in e)return new yl().fromJson(e);if(`region`in e)return new bl().fromJson(e);throw Error(`BoundingVolume ${JSON.stringify(e)} never suppored.`)}var Cl=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(e=>new c.LineBasicMaterial({color:e,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})),wl=(()=>{let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);X.set(1,1,1).toArray(t,0),X.set(-1,1,1).toArray(t,3),X.set(-1,-1,1).toArray(t,6),X.set(1,-1,1).toArray(t,9),X.set(1,1,-1).toArray(t,12),X.set(-1,1,-1).toArray(t,15),X.set(-1,-1,-1).toArray(t,18),X.set(1,-1,-1).toArray(t,21);let n=new c.BufferGeometry;return n.setIndex(new c.BufferAttribute(e,1)),n.setAttribute(`position`,new c.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n})(),Tl=(()=>{let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=Math.sin(n),e[t*6+2]=0,n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=Math.sin(n),e[t*6+5]=0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=0,e[t*6+2]=Math.sin(n),n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=0,e[t*6+5]=Math.sin(n)}let t=new c.BufferGeometry;return t.setAttribute(`position`,new c.BufferAttribute(e,3)),t.computeBoundingBox(),t.computeBoundingSphere(),t})();function El(e,t=0){if(e instanceof vl){let n=new c.LineSegments(wl,Cl[Math.min(t,Cl.length-1)]);return n.position.copy(e.center),gl(e.rotation,n.quaternion),n.scale.set(e.halfSize.x,e.halfSize.y,e.halfSize.z),n.matrix.compose(n.position,n.quaternion,n.scale),n}else if(e instanceof yl){let n=new c.LineSegments(Tl,Cl[Math.min(t,Cl.length-1)]);return n.position.copy(e.center),n.scale.set(e.radius,e.radius,e.radius),n.matrix.compose(n.position,n.quaternion,n.scale),n}return null}var Dl=new c.Vector3,Ol=new c.Plane,kl=new yl,Al=new vl,jl=class e{constructor(t,n,r,i){var a,o,s,l;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,centerScreenY:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=i==null?null:i,this.contentParent=i?i.hasRenderContent?i:i.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(a=n.refine)==null?this.parent?this.parent.refine:`REPLACE`:a,this.transform=new c.Matrix4,n.transform&&this.transform.fromArray(n.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof n.geometricError==`number`?this.geometricError=n.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(s=(o=this.parent)==null?void 0:o.geometricError)==null?0:s,n.content&&n.content.uri?(this.content={uri:n.content.uri,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:U(),loadfailRetryDelay:0,byteLength:0,memoryUsage:0},n.content.group!==void 0&&(this.content.group=n.content.group),/\.json$/.test(this.content.uri)?this.type=`TILESET`:this.type=`SCENEGRAPH`):(this.content=null,this.type=`EMPTY`),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type===`SCENEGRAPH`&&(this.levelOfContent+=1),n.boundingVolume&&(this.boundingVolume=Sl(n.boundingVolume).applyMatrix4(this.transform)),n.viewerRequestVolume&&(this.viewerRequestVolume=Sl(n.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(l=n.extras)==null?{}:l,typeof this.extras.floor!=`number`&&i&&typeof i.extras.floor==`number`&&(this.extras.floor=i.extras.floor),typeof this.extras.floor==`number`&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),n.children?this.children=n.children.map((t,n)=>new e(`${this.id}.${n}`,t,r,this)):this.children=[]}traverse(e){e(this);for(let t of this.children)t.traverse(e)}updateState(e){this.state.frameNumber=e.frameNumber;let t=this.tileset.transform;if(this.boundingVolume){let n;n=this.boundingVolume instanceof vl?Al.copy(this.boundingVolume):this.boundingVolume instanceof yl?kl.copy(this.boundingVolume):this.boundingVolume.clone(),n.applyMatrix4(t),e.camera.type===`OrthographicCamera`?(Ol.setFromNormalAndCoplanarPoint(e.camera.direction,e.camera.position),this.state.distanceToCamera=n.distanceToPlane(Ol)):this.state.distanceToCamera=n.distanceToPoint(e.camera.position);let r=n.getCenter(Dl).sub(e.camera.position);this.state.centerZDepth=e.camera.direction.dot(r),this.state.centerScreenY=e.camera.up.dot(r);let i=this.parent?this.parent.state.visibilityPlaneMask:_l.MASK_INDETERMINATE;this.state.visibilityPlaneMask=e.cullingVolume.computeVisibilityWithPlaneMask(n,i),this.state.visible=this.state.visibilityPlaneMask!==_l.MASK_OUTSIDE,e.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=_l.MASK_INDETERMINATE,this.state.visible=!0;if((this.levelOfContent<=e.minLevelOfDetail||this.geometricError>=e.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){let n;n=this.viewerRequestVolume instanceof vl?Al.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof yl?kl.copy(this.viewerRequestVolume):this.viewerRequestVolume.clone(),n.applyMatrix4(t),this.state.inRequestVolume=n.distanceSquaredToPoint(e.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(e,this.state.distanceToCamera,!1)}get selected(){return this.state.selectedFrameNumber===this.tileset.frameNumber}get hasChildren(){return this.children.length>0}get siblingIndex(){var e,t;return(t=(e=this.parent)==null?void 0:e.children.indexOf(this))==null?0:t}get hasTilesetContent(){return this.children.length>0&&this.type===`TILESET`}get hasRenderContent(){return this.type===`SCENEGRAPH`}get contentAvailable(){var e;return this.hasRenderContent&&((e=this.content)==null?void 0:e.loadState)===`READY`}get hasUnloadedContent(){var e;return((e=this.content)==null?void 0:e.loadState)===`UNLOADED`}get hasEmptyContent(){return this.type===`EMPTY`}get contentReady(){var e;return((e=this.content)==null?void 0:e.loadState)===`READY`||this.hasEmptyContent}get contentByteLength(){return this.content?this.content.byteLength:0}get contentMemoryUsage(){return this.content?this.content.memoryUsage:0}getScreenSpaceError(e,t,n){let r=this.tileset.transform.getMaxScaleOnAxis(),i=this.parent?this.parent.geometricError:this.tileset.geometricError,a=r*(n?i:this.geometricError);if(a===0)return 0;let o=e.height,s=e.sseDenominator;return e.camera.type===`OrthographicCamera`?a/(1/(e.camera.projectionMatrix.elements[5]/2)/o*.9):a/(Math.max(t,.001)*s/o)}getPriority(e){let t=this.refine===`ADD`||e.skipLevelOfDetail;if(t&&!this.state.visible||e.frameNumber-this.state.touchedFrameNumber>=1)return-1;let n=this.parent,r=n&&(!t||this.state.screenSpaceError===0)?n.state.screenSpaceError:this.state.screenSpaceError,i=this.tileset.root?this.tileset.root.state.screenSpaceError:0;return Math.max(i-r,0)}},Ml=e=>Number(e);function Nl(e,t=Ml,n=!1){let r,i=1/0;for(let n of e){let e=t(n);e<=i&&(r=n,i=e)}return isFinite(i)||(i=0),n?[r,i]:r}function Pl(e,t,n=(e,t)=>e===t){let r=e.length;if(r!==t.length)return!1;for(let i=0;i<r;i++)if(n(e[i],t[i])===!1)return!1;return!0}var Fl=new Set;function Il(e){Fl.clear();let t=[],n=e.length;for(let r=0;r<n;r++){let n=e[r];Fl.has(n)||(t.push(n),Fl.add(n))}return Fl.clear(),t}var Ll=e=>e.distance,Rl=(e,t)=>e.distance-t.distance;function zl(e,t=!0,n=!1){if(n&&e.length>1){let t=Nl(e,Ll);t?(e[0]=t,e.length=1):e.length=0}return t&&e.length>1&&e.sort(Rl),e}var Bl=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){var e,t;let n=this.indices,r=this.position;return n?n.array.length/((e=n.stride)==null?1:e):r.array.length/((t=r.stride)==null?3:t)}getPositionByIndex(e,t){var n,r,i,a;let o=this.indices,s=this.position,c=e;if(o){let t=o.array,i=(n=o.stride)==null?1:n,a=(r=o.offset)==null?0:r;c=t[e*i+a]}let l=s.array,u=(i=s.stride)==null?3:i,d=(a=s.offset)==null?0:a;return c=c*u+d,t.x=l[c],t.y=l[c+1],t.z=l[c+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},Vl=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function Hl(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function Ul(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var Wl=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},Gl=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},Kl=class{constructor(e,t){this.min=e,this.max=t}},ql=1e-6,Jl=new Wl(0,0,0),Yl=new Wl(0,0,0),Xl=new Wl(0,0,0),Zl=new Wl(0,0,0),Ql=class extends Bl{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionCount()/3,i=r>65535?new Uint32Array(r):new Uint16Array(r),a=new Float32Array(r*6),o=[],s=0,c=-1;if(n)for(let e=0;e<r;e+=1){let t=e*3,n=e*6,r,o,s,c,l,u,d;i[e]=e,this.getPositionByIndex(t,Yl),this.getPositionByIndex(t+1,Xl),this.getPositionByIndex(t+2,Zl),r=c=Yl.x,d=Xl.x,d<r&&(r=d),d>c&&(c=d),d=Zl.x,d<r&&(r=d),d>c&&(c=d),o=l=Yl.y,d=Xl.y,d<o&&(o=d),d>l&&(l=d),d=Zl.y,d<o&&(o=d),d>l&&(l=d),s=u=Yl.z,d=Xl.z,d<s&&(s=d),d>u&&(u=d),d=Zl.z,d<s&&(s=d),d>u&&(u=d),a[n]=r,a[n+1]=o,a[n+2]=s,a[n+3]=c,a[n+4]=l,a[n+5]=u}else{let e=1/0,t=1/0,o=1/0,s=-1/0,c=-1/0,l=-1/0;for(let n=0;n<r;n+=1){let r=n*3,u=n*6,d,f,p,m,h,g,_;i[n]=n,this.getPositionByIndex(r,Yl),this.getPositionByIndex(r+1,Xl),this.getPositionByIndex(r+2,Zl),d=m=Yl.x,_=Xl.x,_<d&&(d=_),_>m&&(m=_),_=Zl.x,_<d&&(d=_),_>m&&(m=_),f=h=Yl.y,_=Xl.y,_<f&&(f=_),_>h&&(h=_),_=Zl.y,_<f&&(f=_),_>h&&(h=_),p=g=Yl.z,_=Xl.z,_<p&&(p=_),_>g&&(g=_),_=Zl.z,_<p&&(p=_),_>g&&(g=_),a[u]=d,a[u+1]=f,a[u+2]=p,a[u+3]=m,a[u+4]=h,a[u+5]=g,d<e&&(e=d),m>s&&(s=m),f<t&&(t=f),h>c&&(c=h),p<o&&(o=p),g>l&&(l=g)}n=[e,t,o,s,c,l]}let l=new Vl(++c,n,0,r,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let r=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2],d.sort(f);for(let u=0;u<3;u++){let f=d[u],m=p[f]+p[f+3],h=r,g=l-1,_=-1,v;for(;h<=g;)_===-1?(v=i[h],a[v*6+f]+a[v*6+f+3]<m?h++:_=v):(v=i[g],a[v*6+f]+a[v*6+f+3]>=m?g--:(i[h]=v,i[g]=_,_=-1,h++,g--));if(h>r&&h<l){let u=new Vl(++c,eu(i,a,r,h,ql),r,h,n.deepth+1);u.deepth<t&&u.endIndex-u.startIndex>e&&(o[s++]=u);let d=new Vl(++c,eu(i,a,h,l,ql),h,l,n.deepth+1);d.deepth<t&&d.endIndex-d.startIndex>e&&(o[s++]=d),n.node0=u,n.node1=d,n.startIndex=0,n.endIndex=0;break}}}for(;s;)p(o[--s]);return this.offsetArray=i,this.rootNodePacked=Hl(l,c+1),o.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],c=[],l;for(;(l=s.pop())!==void 0;){let r=l*36/4,u=$l(e.x,i[r],i[r+3])-e.x,d=$l(e.y,i[r+1],i[r+4])-e.y,f=$l(e.z,i[r+2],i[r+5])-e.z;if(u*u+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];c.push(e)}let i=l*36/2,u=o[i+16],d=o[i+17];u&&s.push(u),d&&s.push(d)}}let u=c.length,d=new Float32Array(u*9);for(let e=0;e<u;e++){let t=c[e]*3;this.getPositionByIndex(t,Jl),d[e*9]=Jl.x,d[e*9+1]=Jl.y,d[e*9+2]=Jl.z,this.getPositionByIndex(t+1,Jl),d[e*9+3]=Jl.x,d[e*9+4]=Jl.y,d[e*9+5]=Jl.z,this.getPositionByIndex(t+2,Jl),d[e*9+6]=Jl.x,d[e*9+7]=Jl.y,d[e*9+8]=Jl.z}return d}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=new Wl(1/t.x,1/t.y,1/t.z),f=[0],p,m=1/0,h=new Kl(new Wl(0,0,0),new Wl(0,0,0)),g=new Wl(0,0,0),_=new Wl(0,0,0),v=new Wl(0,0,0);for(;(p=f.pop())!==void 0;){let s=p*36/4;h.min.x=c[s],h.min.y=c[s+1],h.min.z=c[s+2],h.max.x=c[s+3],h.max.y=c[s+4],h.max.z=c[s+5];let y=Ul(e,d,h,n);if(y===null||r&&y>m)continue;let b=e.x,x=e.y,S=e.z,C=t.x,w=t.y,T=t.z,E=l[s+6],D=l[s+7];for(let e=E;e<D;e++){let t=o[e],n=t*3;this.getPositionByIndex(n,g);let s=g.x,c=g.y,l=g.z;this.getPositionByIndex(n+1,_);let u=_.x,d=_.y,f=_.z;this.getPositionByIndex(n+2,v);let p=v.x,h=v.y,y=v.z,E=u-s,D=d-c,O=f-l,k=p-s,A=h-c,j=y-l,M=D*j-O*A,N=O*k-E*j,ee=E*A-D*k,P=C*M+w*N+T*ee,te;if(P>0)te=1;else if(P<0)te=-1,P=-P;else continue;let ne=b-s,re=x-c,ie=S-l,ae=te*(C*(re*j-ie*A)+w*(ie*k-ne*j)+T*(ne*A-re*k));if(ae<0)continue;let oe=te*(C*(D*ie-O*re)+w*(O*ne-E*ie)+T*(E*re-D*ne));if(oe<0||ae+oe>P)continue;let F=-te*(ne*M+re*N+ie*ee);if(F<0)continue;let se=F/P,I=new Gl(g,_,v,t,new Wl(b+C*se,x+w*se,S+T*se));(!i||i(I))&&(r?se<m&&(m=se,a.length>0&&(a.length=0),a.push(I)):a.push(I))}let O=p*36/2,k=u[O+16],A=u[O+17];k&&f.push(k),A&&f.push(A)}return a}};function $l(e,t,n){return e<t?t:e>n?n:e}function eu(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new Wl(0,0,0),t=new Wl(0,0,0),n=new Wl(0,0,0),r=new Wl(0,0,0);return function(i,a,o,s,c){t.subVectors(a,i),n.subVectors(o,i),r.crossVectors(t,n);let l=c.dot(r),u;if(l>0)u=1;else if(l<0)u=-1,l=-l;else return null;e.subVectors(s,i);let d=u*c.dot(n.crossVectors(e,n));if(d<0)return null;let f=u*c.dot(t.cross(e));if(f<0||d+f>l)return null;let p=-u*e.dot(r);if(p<0)return null;let m=p/l;return new Wl(0,0,0).copy(c).multiplyScalar(m).add(s)}})();var tu=1e-6,nu=[`x`,`y`,`z`],ru=new Wl(0,0,0),iu=class extends Bl{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionByIndex.bind(this),i=this.getPositionCount(),a=i>65535?new Uint32Array(i):new Uint16Array(i),o=[],s=0,c=-1;if(n)for(let e=0;e<i;e+=1)a[e]=e;else{r(0,ru);let e=ru.x,t=ru.y,o=ru.z,s=e,c=t,l=o;for(let n=0;n<i;n+=1){a[n]=n,r(n,ru);let i=ru.x,u=ru.y,d=ru.z;i<e?e=i:i>s&&(s=i),u<t?t=u:u>c&&(c=u),d<o?o=d:d>l&&(l=d)}n=[e,t,o,s,c,l]}let l=new Vl(++c,n,0,i,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let i=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2];let m=d.sort(f)[0],h=nu[m],g=(p[m]+p[m+3])/2,_=i,v=l-1,y=-1,b;for(;_<=v;)y===-1?(b=a[_],r(b,ru),ru[h]<g?_++:y=b):(b=a[v],r(b,ru),ru[h]>=g?v--:(a[_]=b,a[v]=y,y=-1,_++,v--));if(_>i){let r=p.slice();r[m+3]=g+tu;let a=new Vl(++c,r,i,_,n.deepth+1);a.deepth<t&&a.endIndex-a.startIndex>e&&(o[s++]=a),n.node0=a}if(l>_){let r=p.slice();r[m]=g-tu;let i=new Vl(++c,r,_,l,n.deepth+1);i.deepth<t&&i.endIndex-i.startIndex>e&&(o[s++]=i),n.node1=i}n.startIndex=0,n.endIndex=0}for(;s;)p(o[--s]);return this.offsetArray=a,this.rootNodePacked=Hl(l,c+1),o.length=0,this}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=n*n,f=new Wl(1/t.x,1/t.y,1/t.z),p=[0],m,h=1/0,g=new Kl(new Wl(0,0,0),new Wl(0,0,0)),_=new Wl(0,0,0);for(;(m=p.pop())!==void 0;){let s=m*36/4;g.min.x=c[s],g.min.y=c[s+1],g.min.z=c[s+2],g.max.x=c[s+3],g.max.y=c[s+4],g.max.z=c[s+5];let v=Ul(e,f,g,n);if(v===null||r&&v>h)continue;let y=l[s+6],b=l[s+7];for(let n=y;n<b;n++){let s=o[n];this.getPositionByIndex(s,_);let c=_.x,l=_.y,u=_.z,f=e.x,p=e.y,m=e.z,g=t.x,v=t.y,y=t.z,b=g*(c-f)+v*(l-p)+y*(u-m);if(b>0?(f+=g*b,p+=v*b,m+=y*b):b<0&&(b=0),g=c-f,v=l-p,y=u-m,g*g+v*v+y*y<=d){let e=new Gl(_,_,_,s,new Wl(f,p,m));(!i||i(e))&&(r?b<h&&(h=b,a.length>0&&(a.length=0),a.push(e)):a.push(e))}}let x=m*36/2,S=u[x+16],C=u[x+17];S&&p.push(S),C&&p.push(C)}return a}},au="(function(){var e=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){let e=this.indices,t=this.position;return e?e.array.length/(e.stride??1):t.array.length/(t.stride??3)}getPositionByIndex(e,t){let n=this.indices,r=this.position,i=e;if(n){let t=n.array,r=n.stride??1,a=n.offset??0;i=t[e*r+a]}let a=r.array,o=r.stride??3,s=r.offset??0;return i=i*o+s,t.x=a[i],t.y=a[i+1],t.z=a[i+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},t=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function n(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function r(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var i=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},a=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},o=class{constructor(e,t){this.min=e,this.max=t}};let s=1e-6,c=new i(0,0,0),l=new i(0,0,0),u=new i(0,0,0),d=new i(0,0,0);var f=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionCount()/3,o=a>65535?new Uint32Array(a):new Uint16Array(a),c=new Float32Array(a*6),f=[],p=0,h=-1;if(i)for(let e=0;e<a;e+=1){let t=e*3,n=e*6,r,i,a,s,f,p,m;o[e]=e,this.getPositionByIndex(t,l),this.getPositionByIndex(t+1,u),this.getPositionByIndex(t+2,d),r=s=l.x,m=u.x,m<r&&(r=m),m>s&&(s=m),m=d.x,m<r&&(r=m),m>s&&(s=m),i=f=l.y,m=u.y,m<i&&(i=m),m>f&&(f=m),m=d.y,m<i&&(i=m),m>f&&(f=m),a=p=l.z,m=u.z,m<a&&(a=m),m>p&&(p=m),m=d.z,m<a&&(a=m),m>p&&(p=m),c[n]=r,c[n+1]=i,c[n+2]=a,c[n+3]=s,c[n+4]=f,c[n+5]=p}else{let e=1/0,t=1/0,n=1/0,r=-1/0,s=-1/0,f=-1/0;for(let i=0;i<a;i+=1){let a=i*3,p=i*6,m,h,g,_,v,y,b;o[i]=i,this.getPositionByIndex(a,l),this.getPositionByIndex(a+1,u),this.getPositionByIndex(a+2,d),m=_=l.x,b=u.x,b<m&&(m=b),b>_&&(_=b),b=d.x,b<m&&(m=b),b>_&&(_=b),h=v=l.y,b=u.y,b<h&&(h=b),b>v&&(v=b),b=d.y,b<h&&(h=b),b>v&&(v=b),g=y=l.z,b=u.z,b<g&&(g=b),b>y&&(y=b),b=d.z,b<g&&(g=b),b>y&&(y=b),c[p]=m,c[p+1]=h,c[p+2]=g,c[p+3]=_,c[p+4]=v,c[p+5]=y,m<e&&(e=m),_>r&&(r=_),h<t&&(t=h),v>s&&(s=v),g<n&&(n=g),y>f&&(f=y)}i=[e,t,n,r,s,f]}let g=new t(++h,i,0,a,0);f[p++]=g;let _=[],v=[0,1,2],y=function(e,t){return _[t]-_[e]};function b(n){let i=n.startIndex,a=n.endIndex,l=n.extents;_[0]=l[3]-l[0],_[1]=l[4]-l[1],_[2]=l[5]-l[2],v.sort(y);for(let u=0;u<3;u++){let d=v[u],g=l[d]+l[d+3],_=i,y=a-1,b=-1,x;for(;_<=y;)b===-1?(x=o[_],c[x*6+d]+c[x*6+d+3]<g?_++:b=x):(x=o[y],c[x*6+d]+c[x*6+d+3]>=g?y--:(o[_]=x,o[y]=b,b=-1,_++,y--));if(_>i&&_<a){let l=new t(++h,m(o,c,i,_,s),i,_,n.deepth+1);l.deepth<r&&l.endIndex-l.startIndex>e&&(f[p++]=l);let u=new t(++h,m(o,c,_,a,s),_,a,n.deepth+1);u.deepth<r&&u.endIndex-u.startIndex>e&&(f[p++]=u),n.node0=l,n.node1=u,n.startIndex=0,n.endIndex=0;break}}}for(;p;)b(f[--p]);return this.offsetArray=o,this.rootNodePacked=n(g,h+1),f.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],l=[],u;for(;(u=s.pop())!==void 0;){let r=u*36/4,c=p(e.x,i[r],i[r+3])-e.x,d=p(e.y,i[r+1],i[r+4])-e.y,f=p(e.z,i[r+2],i[r+5])-e.z;if(c*c+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];l.push(e)}let i=u*36/2,c=o[i+16],d=o[i+17];c&&s.push(c),d&&s.push(d)}}let d=l.length,f=new Float32Array(d*9);for(let e=0;e<d;e++){let t=l[e]*3;this.getPositionByIndex(t,c),f[e*9]=c.x,f[e*9+1]=c.y,f[e*9+2]=c.z,this.getPositionByIndex(t+1,c),f[e*9+3]=c.x,f[e*9+4]=c.y,f[e*9+5]=c.z,this.getPositionByIndex(t+2,c),f[e*9+6]=c.x,f[e*9+7]=c.y,f[e*9+8]=c.z}return f}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=new i(1/t.x,1/t.y,1/t.z),g=[0],_,v=1/0,y=new o(new i(0,0,0),new i(0,0,0)),b=new i(0,0,0),x=new i(0,0,0),S=new i(0,0,0);for(;(_=g.pop())!==void 0;){let o=_*36/4;y.min.x=f[o],y.min.y=f[o+1],y.min.z=f[o+2],y.max.x=f[o+3],y.max.y=f[o+4],y.max.z=f[o+5];let d=r(e,h,y,n);if(d===null||s&&d>v)continue;let C=e.x,w=e.y,T=e.z,E=t.x,D=t.y,O=t.z,k=p[o+6],A=p[o+7];for(let e=k;e<A;e++){let t=u[e],n=t*3;this.getPositionByIndex(n,b);let r=b.x,o=b.y,d=b.z;this.getPositionByIndex(n+1,x);let f=x.x,p=x.y,m=x.z;this.getPositionByIndex(n+2,S);let h=S.x,g=S.y,_=S.z,y=f-r,k=p-o,A=m-d,j=h-r,M=g-o,N=_-d,P=k*N-A*M,F=A*j-y*N,I=y*M-k*j,L=E*P+D*F+O*I,R;if(L>0)R=1;else if(L<0)R=-1,L=-L;else continue;let z=C-r,B=w-o,V=T-d,H=R*(E*(B*N-V*M)+D*(V*j-z*N)+O*(z*M-B*j));if(H<0)continue;let U=R*(E*(k*V-A*B)+D*(A*z-y*V)+O*(y*B-k*z));if(U<0||H+U>L)continue;let W=-R*(z*P+B*F+V*I);if(W<0)continue;let G=W/L,K=new a(b,x,S,t,new i(C+E*G,w+D*G,T+O*G));(!c||c(K))&&(s?G<v&&(v=G,l.length>0&&(l.length=0),l.push(K)):l.push(K))}let j=_*36/2,M=m[j+16],N=m[j+17];M&&g.push(M),N&&g.push(N)}return l}};function p(e,t,n){return e<t?t:e>n?n:e}function m(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new i(0,0,0),t=new i(0,0,0),n=new i(0,0,0),r=new i(0,0,0);return function(a,o,s,c,l){t.subVectors(o,a),n.subVectors(s,a),r.crossVectors(t,n);let u=l.dot(r),d;if(u>0)d=1;else if(u<0)d=-1,u=-u;else return null;e.subVectors(c,a);let f=d*l.dot(n.crossVectors(e,n));if(f<0)return null;let p=d*l.dot(t.cross(e));if(p<0||f+p>u)return null;let m=-d*e.dot(r);if(m<0)return null;let h=m/u;return new i(0,0,0).copy(l).multiplyScalar(h).add(c)}})();let h=1e-6,g=[`x`,`y`,`z`],_=new i(0,0,0);var v=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionByIndex.bind(this),o=this.getPositionCount(),s=o>65535?new Uint32Array(o):new Uint16Array(o),c=[],l=0,u=-1;if(i)for(let e=0;e<o;e+=1)s[e]=e;else{a(0,_);let e=_.x,t=_.y,n=_.z,r=e,c=t,l=n;for(let i=0;i<o;i+=1){s[i]=i,a(i,_);let o=_.x,u=_.y,d=_.z;o<e?e=o:o>r&&(r=o),u<t?t=u:u>c&&(c=u),d<n?n=d:d>l&&(l=d)}i=[e,t,n,r,c,l]}let d=new t(++u,i,0,o,0);c[l++]=d;let f=[],p=[0,1,2],m=function(e,t){return f[t]-f[e]};function v(n){let i=n.startIndex,o=n.endIndex,d=n.extents;f[0]=d[3]-d[0],f[1]=d[4]-d[1],f[2]=d[5]-d[2];let v=p.sort(m)[0],y=g[v],b=(d[v]+d[v+3])/2,x=i,S=o-1,C=-1,w;for(;x<=S;)C===-1?(w=s[x],a(w,_),_[y]<b?x++:C=w):(w=s[S],a(w,_),_[y]>=b?S--:(s[x]=w,s[S]=C,C=-1,x++,S--));if(x>i){let a=d.slice();a[v+3]=b+h;let o=new t(++u,a,i,x,n.deepth+1);o.deepth<r&&o.endIndex-o.startIndex>e&&(c[l++]=o),n.node0=o}if(o>x){let i=d.slice();i[v]=b-h;let a=new t(++u,i,x,o,n.deepth+1);a.deepth<r&&a.endIndex-a.startIndex>e&&(c[l++]=a),n.node1=a}n.startIndex=0,n.endIndex=0}for(;l;)v(c[--l]);return this.offsetArray=s,this.rootNodePacked=n(d,u+1),c.length=0,this}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=n*n,g=new i(1/t.x,1/t.y,1/t.z),_=[0],v,y=1/0,b=new o(new i(0,0,0),new i(0,0,0)),x=new i(0,0,0);for(;(v=_.pop())!==void 0;){let o=v*36/4;b.min.x=f[o],b.min.y=f[o+1],b.min.z=f[o+2],b.max.x=f[o+3],b.max.y=f[o+4],b.max.z=f[o+5];let d=r(e,g,b,n);if(d===null||s&&d>y)continue;let S=p[o+6],C=p[o+7];for(let n=S;n<C;n++){let r=u[n];this.getPositionByIndex(r,x);let o=x.x,d=x.y,f=x.z,p=e.x,m=e.y,g=e.z,_=t.x,v=t.y,b=t.z,S=_*(o-p)+v*(d-m)+b*(f-g);if(S>0?(p+=_*S,m+=v*S,g+=b*S):S<0&&(S=0),_=o-p,v=d-m,b=f-g,_*_+v*v+b*b<=h){let e=new a(x,x,x,r,new i(p,m,g));(!c||c(e))&&(s?S<y&&(y=S,l.length>0&&(l.length=0),l.push(e)):l.push(e))}}let w=v*36/2,T=m[w+16],E=m[w+17];T&&_.push(T),E&&_.push(E)}return l}};function y(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}y(e=>Promise.resolve(e).then(e=>{let t=[],n=new Set;for(let r of e){let e;if(r.type===`mesh`)e=new f(r.attributes.position,r.indices);else if(r.type===`points`)e=new v(r.attributes.position,r.indices);else throw Error(`Invalid Type`);e.createTree(r.maxItemPerNode,r.maxTreeDepth,r.extents);let i={type:r.type,attributes:r.attributes,indices:r.indices,offsetArray:e.offsetArray,rootNodePacked:e.rootNodePacked};t.push(i);let a;for(let e in i.attributes){let t=i.attributes[e];t&&t.buffer instanceof ArrayBuffer&&n.add(t.buffer)}a=i.indices,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),a=i.offsetArray,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),n.add(i.rootNodePacked)}return{output:t,transfer:Array.from(n)}}))})();",ou=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,au],{type:`text/javascript;charset=utf-8`});function su(e){let t;try{if(t=ou&&(self.URL||self.webkitURL).createObjectURL(ou),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(au),{name:e==null?void 0:e.name})}}var cu=new io(()=>new su,4),lu=()=>!0,uu=new c.Ray,du=new c.Matrix3,fu=new c.Matrix4,pu=new c.Vector3,mu=new c.Vector3,hu=new c.Vector3,gu=new WeakMap;function _u(e,t,n,r){var i,a;let o=e.matrixWorld;fu.getInverse(o),uu.copy(n.ray).applyMatrix4(fu);let s=(i=n.hitFilter)==null?lu:i,l=(a=n.firstHitOnly)==null?!1:a,u=e.geometry,d=e.material,f=u.groups,p=u.index,m=t.intersectRay(uu.origin,uu.direction,0,l,t=>{var r;let i=t.index,a=i*3,l;if(Array.isArray(d)){if(f){for(let e of f)if(a>=e.start&&a-e.start<e.count){l=d[(r=e.materialIndex)==null?0:r];break}}}else l=d;if(!l)return!1;let u=t.intersectionPoint,m=new c.Vector3(u.x,u.y,u.z).applyMatrix4(o),h=n.ray.origin.distanceTo(m);if(h<n.near||h>n.far)return!1;let g=t.pointA,_=t.pointB,v=t.pointC,y=c.Triangle.getNormal(pu.set(g.x,g.y,g.z).applyMatrix4(o),mu.set(_.x,_.y,_.z).applyMatrix4(o),hu.set(v.x,v.y,v.z).applyMatrix4(o),new c.Vector3),b=n.ray.direction.dot(y);if(l.side===c.FrontSide&&b>=0||l.side===c.BackSide&&b<=0)return!1;let x={distance:h,object:e,face:new c.Face3(p?p.array[a]:a,p?p.array[a+1]:a+1,p?p.array[a+2]:a+2,y),point:m,distanceToRay:0,faceIndex:i};return gu.set(t,x),s(x)}),h=m.length;for(let e=0;e<h;e++){let t=gu.get(m[e]);t&&r.push(t)}m.length=0}function vu(e,t,n,r){var i,a,o,s;let l=e.matrixWorld;du.getNormalMatrix(l),fu.getInverse(l),uu.copy(n.ray).applyMatrix4(fu);let u=((a=(i=n.params.Points)==null?void 0:i.threshold)==null?1:a)*fu.getMaxScaleOnAxis(),d=(o=n.hitFilter)==null?lu:o,f=(s=n.firstHitOnly)==null?!1:s,p=e.geometry,m=p.index,h=p.getAttribute(`normal`),g=h instanceof c.BufferAttribute,_=t.intersectRay(uu.origin,uu.direction,u,f,t=>{let r=t.intersectionPoint,i=new c.Vector3(r.x,r.y,r.z).applyMatrix4(l),a=n.ray.origin.distanceTo(i);if(a<n.near||a>n.far)return!1;let o=t.pointA,s=pu.set(o.x,o.y,o.z).applyMatrix4(l),u=i.distanceTo(s);if(u/a>.07)return!1;let f=t.index,_=m?m.array[f]:f,v;if(g){let e=new c.Vector3().fromBufferAttribute(h,_).applyNormalMatrix(du);v=new c.Face3(_,_,_,e)}else{let e=p.getAttribute(`scale`),t=p.getAttribute(`rotation`);if(e instanceof c.BufferAttribute&&t instanceof c.BufferAttribute){let r=new c.Vector3().fromBufferAttribute(e,_).toArray(),i=new c.Vector4().fromBufferAttribute(t,_).toArray(),a=new c.Quaternion(i[1],i[2],i[3],i[0]),[{axis:o}]=[{axis:`x`,scale:r[0]},{axis:`y`,scale:r[1]},{axis:`z`,scale:r[2]}].sort((e,t)=>e.scale-t.scale),s=new c.Vector3(0,0,0);s[o]=1,s.applyQuaternion(a).applyNormalMatrix(du),n.ray.direction.dot(s)>0&&s.negate(),v=new c.Face3(_,_,_,s)}}let y={distance:a,object:e,face:v,point:i,distanceToRay:u,index:f};return gu.set(t,y),d(y)}),v=_.length;for(let e=0;e<v;e++){let t=gu.get(_[e]);t&&r.push(t)}_.length=0}var yu=`__bvh_mesh__`,bu=c.Mesh.prototype.raycast;function xu(e,t){let n=Su(this);n?_u(this,n,e,t):bu.call(this,e,t)}function Su(e){let t=e[yu];return t instanceof Ql,t}function Cu(e,t){Object.assign(e,{[yu]:t,raycast:xu})}var wu=`__bvh_points__`,Tu=c.Points.prototype.raycast;function Eu(e,t){let n=Du(this);n?vu(this,n,e,t):Tu.call(this,e,t)}function Du(e){let t=e[wu];return t instanceof iu,t}function Ou(e,t){Object.assign(e,{[wu]:t,raycast:Eu})}function ku(e,t=!0,n=100,r=10){let i=[];return e.traverse(e=>{(e instanceof c.Mesh||e instanceof c.Points)&&e.geometry instanceof c.BufferGeometry&&i.push(e)}),t?Promise.resolve().then(()=>{let e=[],t=new Set,a=null;for(let o=0;o<i.length;o++){let s=i[o],l=s.geometry;if(!(l instanceof c.BufferGeometry))continue;let u;if(s instanceof c.Mesh?u=`mesh`:s instanceof c.Points&&(u=`points`),!u)continue;let d=l.boundingBox,f=d?[d.min.x,d.min.y,d.min.z,d.max.x,d.max.y,d.max.z]:void 0,p={};for(let e in l.attributes){let n=l.attributes[e];n instanceof c.InterleavedBufferAttribute?(p[e]={array:n.data.array,stride:n.data.stride,offset:n.offset},a=n.data.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)):(p[e]={array:n.array},a=n.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer))}let m,h=l.getIndex();h&&(h instanceof c.InterleavedBufferAttribute?(m={array:h.data.array,stride:h.data.stride,offset:h.offset},a=h.data.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)):(m={array:h.array},a=h.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)));let g={type:u,attributes:p,indices:m,maxItemPerNode:n,maxTreeDepth:r,extents:f};e.push(g)}return cu.postMessage(e,Array.from(t))}).then(t=>{for(let e=0;e<i.length;e++){let n=i[e],r=n.geometry,a=t[e];if(!(r instanceof c.BufferGeometry))continue;for(let e in a.attributes){let t=a.attributes[e].array,n=r.attributes[e];n instanceof c.InterleavedBufferAttribute?n.data.array=t:n.array=t}let o=r.getIndex();if(o&&a.indices){let e=a.indices.array;o instanceof c.InterleavedBufferAttribute?o.data.array=e:o.array=e}if(n instanceof c.Mesh){let e=new Ql(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,Cu(n,e)}else if(n instanceof c.Points){let e=new iu(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,Ou(n,e)}}return e}):Promise.resolve().then(()=>{for(let e of i)if(e instanceof c.Mesh){let t=e.geometry,i=t.boundingBox,a=i?[i.min.x,i.min.y,i.min.z,i.max.x,i.max.y,i.max.z]:void 0;if(t instanceof c.BufferGeometry){let i,o,s=t.attributes.position;i=s instanceof c.InterleavedBufferAttribute?{array:s.data.array,stride:s.data.stride,offset:s.offset}:{array:s.array};let l=t.getIndex();l&&(o=l instanceof c.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new Ql(i,o);u.createTree(n,r,a),Cu(e,u)}}else if(e instanceof c.Points){let t=e.geometry,i=t.boundingBox,a=i?[i.min.x,i.min.y,i.min.z,i.max.x,i.max.y,i.max.z]:void 0;if(t instanceof c.BufferGeometry){let i,o,s=t.attributes.position;i=s instanceof c.InterleavedBufferAttribute?{array:s.data.array,stride:s.data.stride,offset:s.offset}:{array:s.array};let l=t.getIndex();l&&(o=l instanceof c.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new iu(i,o);u.createTree(n,r,a),Ou(e,u)}}return e})}function Au(e,t,n){return e+(t-e)*n}function ju(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t,s=e;return i*Math.pow(r,3)+a*Math.pow(r,2)+o*r+s}function Mu(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t;return 3*i*Math.pow(r,2)+2*a*r+o}function Nu(e,t,n,r){let i=r[1]-r[0];return e=Pu(e,r),t=Pu(t,r),t-e>i/2?Au(e+i,t,n):e-t>i/2?Au(e-i,t,n):Au(e,t,n)}function Pu(e,t){let n=t[1]-t[0];return e<t[0]?Pu(e+n,t):e>=t[1]?Pu(e-n,t):e}function Fu(e,t,n,r){return r?Nu(e,t,n,r):Au(e,t,n)}function Iu(e){let t=Number(e);return isNaN(t)||!isFinite(t)?0:t}var Z=class{constructor(e){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=U(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(let t in e){let n=e[t];typeof n==`object`?(this.value[t]=Iu(n.value),this.config[t]={circle:n.circle}):(this.value[t]=Iu(n),this.config[t]={circle:!1})}this.keyframes=[{progress:0,value:Object.assign({},this.value)},{progress:1,value:Object.assign({},this.value)}]}getProgress(e){let t=e-this.startTime;return t<0?0:t>=this.duration?1:1-ju(1,this.startVelocity,this.duration,t)}getValue(e){for(let t=1;t<this.keyframes.length;t++)if(this.keyframes[t].progress>e){let n=this.keyframes[t-1],r=this.keyframes[t],i={};for(let t in this.config){let a=(e-n.progress)/(r.progress-n.progress);i[t]=Fu(n.value[t],r.value[t],a,this.config[t].circle)}return i}return Object.assign({},this.keyframes[this.keyframes.length-1].value)}getProgressVelocity(e){let t=e-this.startTime;return t>=this.duration?0:Mu(1,this.startVelocity,this.duration,t)}update(e){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)}getKeyFrameSegment(e){let t=this.getProgress(e);for(let e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t)return[this.keyframes[e-1],this.keyframes[e]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]}getTargetKeyframe(){return this.keyframes[this.keyframes.length-1]}set(e,t,n=0,r){var i;isNaN(t)&&(t=0),isNaN(n)&&(n=0),r=r==null?U():r;let a=this.getProgress(r),o=this.getValue(a),s={};for(let t in this.config)s[t]=(i=e[t])==null?o[t]:i;let c=[{progress:0,value:o},{progress:1,value:s}];return this.setKeyframes(c,t,n,r)}setKeyframes(e,t,n=0,r){if(e.length<2)throw Error(`keyframes invalid.`);return isNaN(t)&&(t=0),isNaN(n)&&(n=0),this.callbacks&&(this.callbacks[1](Error(`motion aborted.`)),this.callbacks=void 0),new Promise((i,a)=>{r=r==null?U():r,this.progress=0,this.ended=!1,this.startTime=r,this.startVelocity=n,this.keyframes=e,this.duration=t,t===0?(this.progress=1,this.value=Object.assign({},e[e.length-1].value)):this.value=Object.assign({},e[0].value),this.callbacks=[i,a]})}dispose(){this.callbacks&&(this.callbacks[1](Error(`motion dispose.`)),this.callbacks=void 0)}},Lu=Math.PI,Ru=1.70158;Ru*1.525,Ru+1,2*Lu/3,2*Lu/4.5;var zu=function(e){return e},Bu=function(e){return e*e*e},Vu=function(e){return e*e*e*e},Hu=500,Uu=new WeakMap,Wu=new c.Vector3,Gu=new c.Matrix4,Ku=class e extends c.Object3D{constructor(e,t,n,r=q){super(),this.name=e,this.materials=[],this.pbmObjects=[],this.contentObject=t,this.animations=n,this.appearMotion=new Z({appear:0}),this.disposers=[r],this.add(t),t.traverse(e=>{if(e instanceof c.Mesh||e instanceof c.Points){let t=e.material;if(Array.isArray(t))for(let e=0;e<t.length;e++)this.materials.push(t[e]);else this.materials.push(t)}(e instanceof yn||e instanceof bn||e instanceof kn||e instanceof Yn)&&this.pbmObjects.push(e)})}generateBvhTree(){return ku(this,!0,200,20)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.hitFilter;e.hitFilter=t=>{if(t.object instanceof kn&&t.object.material.pointBack===`HIDDEN`&&t.face&&t.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;let n=0,i=-1;if((t.object instanceof yn||t.object instanceof bn||t.object instanceof kn)&&t.face){let e=Array.isArray(t.object.material)?t.object.material[t.face.materialIndex]:t.object.material;if(e){n=e.floorIndex,i=e.shownFloorIndex;for(let r of e.clippers)if(!(typeof r.floorIndex==`number`&&r.floorIndex!==n)&&(Gu.getInverse(r.clippingBoxMatrix),Wu.copy(t.point).applyMatrix4(Gu),Math.abs(Wu.x)<.5&&Math.abs(Wu.y)<.5&&Math.abs(Wu.z)<.5))return!1}}let a=i;return e.floorIndex===void 0?e.floor!==void 0&&(a=e.floor===null?-1:e.floor):a=e.floorIndex,a>=0&&n!==a?!1:(Object.assign(t,{floorIndex:n,floor:n}),r?r.call(e,t):!0)};let i=this.children.slice(),a;for(;a=i.pop();)if(a.visible){a.raycast(e,n);for(let e=0,t=a.children.length;e<t;e++)i.push(a.children[e])}return e.hitFilter=r,zl(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n,r,i,a){let o=!1;r.visible&&i.state.selectedFrameNumber===i.tileset.frameNumber?this.appearMotion.getTargetKeyframe().value.appear!==1&&this.appearMotion.set({appear:1},Hu).catch(q):this.appearMotion.getTargetKeyframe().value.appear!==0&&this.appearMotion.set({appear:0},0).catch(q),this.appearMotion.ended!==!0&&this.appearMotion.update(t.time);for(let r of this.pbmObjects)r instanceof yn||r instanceof bn?qu(r,this.appearMotion,e,t,n,i,a)===!0&&(o=!0):r instanceof kn?Ju(r,this.appearMotion,e,t,n,i,a)===!0&&(o=!0):r instanceof Yn&&Yu(r,this.appearMotion,e,t,n,i,a)===!0&&(o=!0);return o}dispose(){for(let e of this.disposers)e();this.disposers.length=0,this.pbmObjects.length=0}clone(){return new e(this.name,this.contentObject.clone(),this.animations)}};function qu(e,t,n,r,i,a,o){var s,l;let u=!1;if(Uu.get(e)!==o.version){Uu.set(e,o.version),u=!0,e.castShadow=o.castShadow,e.receiveShadow=o.receiveShadow;let t=e.material;for(let e of t)e.customShaders=o.customShaders,e.pano0=o.pano0,e.pano1=o.pano1,e.pano0Depth=o.pano0Depth,e.pano1Depth=o.pano1Depth,e.panoFilter=(l=(s=o.panoFilter)==null?void 0:s.toValue())==null?null:l,e.refinedScreen=o.refinedScreen,e.modelAlpha=o.modelAlpha,e.progress=o.progress,e.transition=o.transition,e.opacity=o.opacity,e.floorStyle=o.floorStyle,e.constantColor=o.constantColor,e.shownFloorIndex=o.shownFloorIndex,e.clippers=o.clippers,e.brightness=o.brightness,e.useHQWeight=o.useHQWeight,e.useHQDepth=o.useHQDepth,e.colorSaturation=o.colorSaturation,e.colorBrightness=o.colorBrightness,e.gradientTexture=o.gradientTexture,e.vertexMarks=o.vertexMarks,e.modelBoundingMax.copy(o.boundingBox.max),e.modelBoundingMin.copy(o.boundingBox.min),e.shaderType===`none`?(e.transparent=!0,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!1,e.depthTest=!0):(e.transparent=e.alphaMode===`BLEND`,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!0,e.depthTest=!0,o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.shownFloorIndex>-1&&e.shownFloorIndex!==e.floorIndex&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.alphaMap&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),e.modelAlpha<=0&&(e.transparent=!1),e.depthWrite=!e.transparent,o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending))}return u}function Ju(e,t,n,r,i,a,o){var s,l;let u=!1;if(o.pointAppearAnimation===!0&&a.refine===`ADD`&&a.tileset.rootMeta.pntsOrder===`RANDOM`){let n=e.geometry,r=a.tileset.currentMaxScreenSpaceError,i=a.state.screenSpaceError,o=(l=(s=a.parent)==null?void 0:s.state.screenSpaceError)==null?i:l,c=1;o!==i&&(c=(o-r)/(o-i)),c=W(c,0,1),c=Bu(c);let d=n.index?n.index.count:n.attributes.position?n.attributes.position.count:1/0,f=Math.floor(d*c*t.value.appear);n.drawRange.count!==f&&(n.setDrawRange(0,f),u=!0)}if(Uu.get(e)!==o.version){Uu.set(e,o.version),u=!0,e.castShadow=o.castShadow,e.receiveShadow=o.receiveShadow;let t=[e.material];for(let e of t)e.customShaders=o.customShaders,e.pointScale=o.pointScale,e.pointMinPixel=o.pointMinPixel,e.pointMaxPixel=o.pointMaxPixel,e.pointSize=o.pointSize,e.pointShape=o.pointShape,e.pointBack=o.pointBack,e.modelAlpha=o.modelAlpha,e.opacity=o.opacity,e.floorStyle=o.floorStyle,e.constantColor=o.constantColor,e.shownFloorIndex=o.shownFloorIndex,e.clippers=o.clippers,e.brightness=o.brightness,e.useHQWeight=o.useHQWeight,e.useHQDepth=o.useHQDepth,e.colorSaturation=o.colorSaturation,e.colorBrightness=o.colorBrightness,e.outlineGain=o.outlineGain,e.distanceGain=o.distanceGain,e.gradientTexture=o.gradientTexture,e.transparent=!1,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.colorWrite=!0,e.depthWrite=!0,e.depthTest=!0,e.modelBoundingMax.copy(o.boundingBox.max),e.modelBoundingMin.copy(o.boundingBox.min),e.shownFloorIndex>-1&&(e.transparent=e.shownFloorIndex!==e.floorIndex),e.modelAlpha<1&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.useHQWeight&&(e.depthWrite=!1,e.blending=c.CustomBlending,e.blendSrc=c.SrcAlphaFactor,e.blendSrcAlpha=c.SrcAlphaFactor,e.blendDst=c.OneFactor,e.blendDstAlpha=c.OneFactor),e.useHQDepth&&(e.colorWrite=!1)}return u}function Yu(e,t,n,r,i,a,o){let s=!1;return e.updateMatrix(),e.updateMatrixWorld(),e.usedSHDegree=o.gsSHDegree,e.lastMatrixWorld?e.transformChanged=!e.lastMatrixWorld.equals(e.matrixWorld):(e.lastMatrixWorld=new c.Matrix4,e.transformChanged=!0,s=!0),e.lastMatrixWorld.copy(e.matrixWorld),e.transformChanged&&(s=!0),s}var Xu=class{constructor(e,t,n){this.id=e,this.name=t.name,this.visible=!1,this.tileset=n,this.transform=new c.Matrix4,t.transform&&this.transform.fromArray(t.transform),this.transform.premultiply(this.tileset.root.transform),this.content={uri:t.file,byteLength:0,memoryUsage:0,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:U(),loadfailRetryDelay:0,data:void 0}}},Zu=class e extends c.Object3D{constructor(e,t,n=q){super(),this.name=e,this.contentObject=t,this.name=e,this.add(t),this.disposers=[n]}update(e,t,n,r,i,a){let o=this.contentObject.material[2];return o.uniforms.dashOffset.value=(o.uniforms.dashOffset.value-.003)%(o.uniforms.dashSize.value.x+o.uniforms.dashSize.value.y),!0}dispose(){for(let e of this.disposers)e();this.disposers.length=0}clone(){return new e(this.name,this.contentObject.clone())}},Qu=new Map;function $u(e,t,n){if(n&&n.has(t))return n.get(t);let r=t.refine===`ADD`||e.skipLevelOfDetail,i=t.parent,a=i&&(!r||t.state.screenSpaceError===0)?i.state.screenSpaceError:t.state.screenSpaceError,o=t.tileset.root?t.tileset.root.state.screenSpaceError:0,s=Math.max(o-a,0);return n&&n.set(t,s),s}var ed=class{constructor(e,t){this.tileset=e,this.options=t,this.activeRequests=0,this.requestQueue=[]}reset(){for(let e of this.requestQueue)this.options.onTileSkip&&(e.tile.content&&this.tileset.options.tileUnloader(e.tile),this.options.onTileSkip(e.tile));this.requestQueue.length=0}update(e,t,n){let r=n.time,i=this.requestQueue,a=new Set(e);for(let e=0;e<i.length;e++){let t=i[e];if(a.has(t.tile)){a.delete(t.tile);continue}t.status===`WAITING`&&(i.splice(e,1),e--,this.options.onTileSkip&&this.options.onTileSkip(t.tile))}a.size>0&&(a.forEach(e=>{i.push({tile:e,status:`WAITING`,time:r,error:null})}),a.clear());let o=n.maxRequests;for(let e=0;e<i.length&&o>0;e++){let t=i[e];if(t.status===`DONE`)t.error===null?(o--,t.tile.content&&(t.tile.content.loadState=`READY`),this.options.onTileLoad&&this.options.onTileLoad(t.tile)):this.options.onTileError&&this.options.onTileError(t.tile,t.error),i.splice(e,1),e--;else if(t.status===`PENDING`&&r-t.time<1e3)break}switch(Qu.clear(),t){case`SCREEN_SPACE_ERROR`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?$u(n,e.tile,Qu)-$u(n,t.tile,Qu):e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_LEVEL_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.level===t.tile.level?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level-t.tile.level:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;default:break}if(o=Math.max(n.maxRequests-this.activeRequests,0),!n.skipLevelOfDetail){let e=0,t=i.length;for(let r=0;r<t;r++){let t=i[r].tile;if(t.hasTilesetContent||t.contentParent===null||t.contentParent.state.selectedFrameNumber===n.frameNumber){let t=i.splice(r,1);i.splice(e++,0,...t)}}}for(let e=0;e<i.length&&o>0;e++){let t=i[e];t.status===`WAITING`&&(o--,t.status=`PENDING`,t.time=r,this.activeRequests++,this.tileset.options.tileLoader(t.tile).catch(e=>{t.error=e}).then(()=>{t.status=`DONE`,t.tile.content&&t.tile.content.loadState===`READY`&&(t.tile.content.loadState=`LOADING`),this.activeRequests--}))}}},td=class{constructor(e,t,n){this.item=e,this.previous=t,this.next=n}},nd=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(e){let t=new td(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t}remove(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--}splice(e,t){e!==t&&(this.remove(t),this.insert(e,t))}insert(e,t){let n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,this._length++}toArray(){let e=[],t=this.head;for(;t;)e.push(t),t=t.next;return e}},rd=class{constructor(e={}){this.options=e,this.cacheNodeMap=new WeakMap,this.list=new nd,this.sentinel=this.list.add(`sentinel`)}reset(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)}touchTile(e){let t=this.cacheNodeMap.get(e);t&&this.list.splice(this.sentinel,t)}loadTile(e){if(!this.cacheNodeMap.has(e)){let t=this.list.add(e);this.cacheNodeMap.set(e,t),this.options.onTileLoad&&this.options.onTileLoad(e)}}unloadTile(e){let t=this.cacheNodeMap.get(e);t&&(this.list.remove(t),this.cacheNodeMap.delete(e),this.options.onTileUnload&&this.options.onTileUnload(e))}unloadTiles(e){let t=this.list.head;for(;t!==this.sentinel&&e();){let e=t.item;t=t.next,this.unloadTile(e)}}toArray(){let e=[];for(let t of this.list.toArray())t.item!==`sentinel`&&e.push(t.item);return e}},id=class{constructor(){this.map=new Map,this.array=[],this._length=0}get length(){return this._length}get(e){return this.array[e]}set(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)}delete(e){let t=this.map.get(e);t!==void 0&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)}push(e){if(!this.map.has(e)){let t=this._length++;this.array[t]=e,this.map.set(e,t)}}pop(){let e=this.array[--this._length];return this.map.delete(e),this.array[this._length]=void 0,e}reset(){this.array=[],this.map=new Map,this._length=0}find(e){return this.map.has(e)}peek(){return this.array[this._length-1]}},ad=class{constructor(e){this.tileset=e,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new id}traverse(e,t,n=[]){this.reset()}reset(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0}updateTile(e,t){this.updateTileVisibility(e,t),e.state.shouldSelect=!1,e.state.finalResolution=!0}selectTile(e,t){this._canSelectTile&&e.contentAvailable&&e.state.selectedFrameNumber<t.frameNumber&&(e.state.selectedFrameNumber=t.frameNumber,this.tileset.selectedTiles.push(e),this.tileset.needsRefinedTiles.add(e))}loadTile(e,t){this._canSelectTile&&(e.state.requestedFrameNumber<t.frameNumber&&(e.state.requestedFrameNumber=t.frameNumber,e.content&&(e.content.loadState===`FAILED`&&t.time-e.content.loadStateUpdateTime>e.content.loadfailRetryDelay&&(e.content.loadState=`UNLOADED`,e.content.loadProgress=0,e.content.loadStateUpdateTime=t.time),e.content.loadState===`UNLOADED`&&this.tileset.requestedTiles.push(e))),this.tileset.needsRefinedTiles.add(e))}touchTile(e,t){this._canSelectTile&&(this.tileset.cache.touchTile(e),e.state.touchedFrameNumber=t.frameNumber)}canTraverse(e,t){return!e.state.inRequestVolume||e.hasRenderContent&&(e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError)||e.children.length===0?!1:e.levelOfContent<t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.hasTilesetContent?!0:e.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError}updateTileVisibility(e,t){if(e.updateState(t),!e.state.visible||!e.state.inRequestVolume)return;let n=e.children.length>0;if(e.hasTilesetContent&&n){let n=e.children[0];this.updateTileVisibility(n,t),e.state.visible=n.state.visible;return}if(this.meetsScreenSpaceErrorEarly(e,t)){e.state.visible=!1;return}if(e.refine===`REPLACE`&&n&&!this.anyChildrenVisible(e,t)){e.state.visible=!1;return}}anyChildrenVisible(e,t){let n=!1,r=e.children;for(let e of r)e.updateState(t),n=n||e.state.visible;return n}meetsScreenSpaceErrorEarly(e,t){let{parent:n}=e;return!n||n.refine!==`ADD`||n.levelOfContent<t.minLevelOfDetail||n.geometricError>t.maxGeometricError?!1:n.levelOfContent>t.maxLevelOfDetail||n.levelOfContent>=0&&n.geometricError<t.minGeometricError?!0:e.getScreenSpaceError(t,e.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError}sortTilesByDistanceToCamera(e){e.sort((e,t)=>t.state.distanceToCamera===0&&e.state.distanceToCamera===0?t.state.centerZDepth-e.state.centerZDepth:t.state.distanceToCamera-e.state.distanceToCamera)}},od=class extends ad{constructor(e){super(e),this._traversalStack=new id,this._emptyTraversalStack=new id}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t));this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop(),r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=e.refine===`REPLACE`&&e.hasRenderContent,a=!1,o=!0;for(let e of r)if(e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.find(e)&&n.delete(e),n.push(e),a===!1&&(a=!0)):(i||t.loadSiblings)&&(this.loadTile(e,t),this.touchTile(e,t)),i){let n;n=e.state.inRequestVolume?e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t):!1,o=o&&n}return a||(o=!1),o}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}executeEmptyTraversal(e,t){let n=!0,r=this._emptyTraversalStack;for(r.push(e);r.length>0&&n;){let e=r.pop(),i=!e.hasRenderContent&&this.canTraverse(e,t);if(!i&&!e.contentAvailable&&(n=!1),this.updateTile(e,t),e.state.visible||(this.loadTile(e,t),this.touchTile(e,t)),i){let t=e.children;for(let e of t)r.find(e)&&r.delete(e),r.push(e)}}return n}},sd=class extends ad{constructor(e){super(e),this.baseScreenSpaceError=1024,this.skipScreenSpaceErrorFactor=16,this.skipLevels=1,this._traversalStack=new id,this._descendantTraversalStack=new id,this._selectionTraversalStack=new id,this._selectionTraversalancestorStack=new id}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t));this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop();this.updateTileAncestorContentLinks(e,t);let r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.inBaseTraversal(e,this.baseScreenSpaceError)?(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):o?(this.loadTile(e,t),this.selectDesiredTile(e,t)):this.reachedSkippingThreshold(e)&&this.loadTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=!1;for(let e of r)e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.push(e),i===!1&&(i=!0)):t.loadSiblings&&(this.loadTile(e,t),this.touchTile(e,t));return i}selectDesiredTile(e,t){let n=e.contentAvailable?e:e.state.ancestorWithContentAvailable;n&&(n.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,t)}selectDescendants(e,t){let n=this._descendantTraversalStack;for(n.push(e);n.length>0;){let e=n.pop().children;for(let r of e)r.state.visible&&(r.contentAvailable?(this.updateTile(r,t),this.touchTile(r,t),this.selectTile(r,t)):n.push(r))}}reachedSkippingThreshold(e){let t=e.state.ancestorWithContent;return t!==null&&e.state.screenSpaceError<t.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>t.levelOfContent+this.skipLevels}updateTileAncestorContentLinks(e,t){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;let{parent:n}=e;if(!n)return;let r=!(n.hasRenderContent&&n.hasUnloadedContent)||n.state.requestedFrameNumber===t.frameNumber;e.state.ancestorWithContent=r?n:n.state.ancestorWithContent,e.state.ancestorWithContentAvailable=n.contentAvailable?n:n.state.ancestorWithContentAvailable}inBaseTraversal(e,t){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>t:e.state.screenSpaceError>t:!0}traverseAndSelect(e,t){let n=this._selectionTraversalStack,r=this._selectionTraversalancestorStack,i;for(n.push(e);n.length>0||r.length>0;){if(r.length>0){let e=r.peek();if(e.state.stackLength===n.length){r.pop(),e!==i&&(e.state.finalResolution=!1),this.selectTile(e,t);continue}}let e=n.pop();if(!e)continue;let a=this.canTraverse(e,t);if(e.state.shouldSelect)if(e.refine===`ADD`)this.selectTile(e,t);else{if(e.state.selectionDepth=r.length,e.state.selectionDepth>0&&(e.tileset.hasMixedContent=!0),i=e,!a){this.selectTile(e,t);continue}r.push(e),e.state.stackLength=n.length}if(a)for(let t of e.children)t.state.visible&&n.push(t)}}},cd=class extends ad{constructor(e){super(e),this._traversalStack=new id}canTraverse(e,t){return!(!e.state.inRequestVolume||e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError||e.children.length===0)}traverse(e,t,n){super.traverse(e,t,[]),this._traversalStack.reset(),e.updateState(t);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t));this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(n.push(e);n.length>0;){let e=n.pop(),r=e.refine===`ADD`,i=e.refine===`REPLACE`,a=this.canTraverse(e,t);a&&this.updateAndPushChildren(e,t,n),(r||i&&!a)&&(this.loadTile(e,t),this.touchTile(e,t),this.selectDesiredTile(e,t))}}updateAndPushChildren(e,t,n){let{children:r}=e;for(let e=0;e<r.length;++e){let i=r[e];i.updateState(t),i.state.visible&&n.push(i)}}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}},ld=class{constructor(e,t){var n,r,i,a,o,s,l;if(this.id=e.tilesetUrl,this.transform=new c.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||``,gltfUpAxis:(n=e.asset.gltfUpAxis)==null?`Y`:n,overview:e.asset.overview,trajectories:(i=(r=e.asset.trajectories)==null?void 0:r.list)==null?[]:i,extras:e.asset.extras},this.rootMeta=(a=e.rootMeta)==null?{}:a,this.pointLength=(o=this.rootMeta.numTotalPoints)==null?1/0:o,this.floorLength=(s=this.rootMeta.numFloors)==null?1:s,this.properties=(l=e.properties)==null?{}:l,this.options=t,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new od(this),this.skipTraverser=new sd(this),this.mostDetailTraverser=new cd(this),this.cache=new rd({onTileLoad:e=>{this.cacheMemoryUsageInBytes+=e.contentMemoryUsage},onTileUnload:e=>{this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.unloadTiles.push(e)}}),this.requestScheduler=new ed(this,{onTileSkip:e=>{},onTileLoad:e=>{var t;(t=e.content)!=null&&t.data&&(this.loadedTiles.add(e),this.cache.loadTile(e)),this.options.onTileLoad(e)},onTileError:(e,t)=>{this.options.onTileError(e,t)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new jl(`${this.id}#tile:0`,e.root,this),this.geometricError=e.geometricError,this.trajectories=[],this.asset.trajectories)for(let e=0;e<this.asset.trajectories.length;e++){let t=new Xu(`${this.id}#trajectory:${e}`,this.asset.trajectories[e],this);this.trajectories.push(t)}}adjustScreenSpaceError(e){if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=e.maxScreenSpaceError),e.memoryAdjustedScreenSpaceError){let t=0,n=0,r=0;if(this.needsRefinedTiles.forEach(e=>{e.content&&(n++,t+=e.content.memoryUsage,e.content.loadState===`READY`&&r++)}),r<2||n<2)this.currentMaxScreenSpaceError=e.maxScreenSpaceError;else{let i=1024*1024,a=t/r*n,o=e.maxMemoryUsage*i,s=o-W(o*.1,8*i,64*i),c=this.currentMaxScreenSpaceError;if(a<s){let e=.5*(1-a/s);c-=e}else a>o&&(c+=.3);c=W(c,1,e.maxScreenSpaceError),Math.abs(c-this.currentMaxScreenSpaceError)>=.1&&(this.currentMaxScreenSpaceError=c)}}else this.currentMaxScreenSpaceError=e.maxScreenSpaceError}getTraverser(e){return e.mostDetail?this.mostDetailTraverser:e.skipLevelOfDetail?this.skipTraverser:this.normalTraverser}reset(){this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();let e=[this.root],t;for(;t=e.pop();){for(let n=0,r=t.children.length;n<r;n++)e.push(t.children[n]);this.cache.unloadTile(t)}for(;this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}for(this.loadedTiles.clear();this.trajectories.length;){let e=this.trajectories.pop();e&&this.options.trajectoryUnloader(e).catch(()=>{}).then(()=>{this.options.onTrajectoryUnload&&this.options.onTrajectoryUnload(e)})}}update(e,t=[]){var n;for(this.frameNumber=e.frameNumber,this.adjustScreenSpaceError(e),this.cache.reset(),this.getTraverser(e).traverse(this.root,e,t),this.cache.unloadTiles(()=>this.cacheMemoryUsageInBytes>e.maxMemoryUsage*1024*1024),this.requestScheduler.update(this.requestedTiles,e.requestOrder,e);this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}this.selectedTrajectories.length=0;for(let t of this.trajectories)t.visible===!0&&t.content.loadState===`READY`&&(n=t.content.data)!=null&&n.object?this.selectedTrajectories.push(t):t.visible===!0&&(t.content.loadState===`FAILED`&&e.time-t.content.loadStateUpdateTime>t.content.loadfailRetryDelay&&(t.content.loadState=`UNLOADED`,t.content.loadStateUpdateTime=e.time),t.content.loadState===`UNLOADED`&&this.options.trajectoryLoader(t).then(()=>{this.options.onTrajectoryLoad(t)}).catch(e=>{this.options.onTrajectoryError(t,e)}))}};function ud(e,t){var n;if(e.content){let r=(n=e.content.uri)==null?e.content.url:n;typeof r==`string`&&!vr(r)&&(e.content.uri=Sr(br(t,r)))}if(e.transform){let t=!1;for(let n=0;n<16;n++){let r=e.transform[n];if(typeof r!=`number`||isNaN(r)||!isFinite(r)){t=!0;break}}if(e.transform[15]===0&&(t=!0),t)throw Error(`Invalid Tile Transform: `+JSON.stringify(e.transform))}if(e.children)for(let n of e.children)ud(n,t);return e}function dd(e,t){e.tilesetUrl=t;let n=/^blob\:/.test(t)?``:t.slice(0,t.lastIndexOf(`/`)+1);if(e.asset||(e.asset={}),e.rootMeta||(e.rootMeta={}),e.rootMeta.taskParameters||(e.rootMeta.taskParameters={}),e.asset.overview){let t=e.asset.overview;vr(t.imageFile)||(t.imageFile=Sr(br(n,t.imageFile))),vr(t.worldFile)||(t.worldFile=Sr(br(n,t.worldFile)))}if(e.asset.trajectories)for(let t=0;t<e.asset.trajectories.list.length;t++){let r=e.asset.trajectories.list[t];r.file=Sr(br(n,r.file))}return ud(e.root,n),e}function fd(e){return new Promise(t=>setTimeout(t,e))}var pd=new class{constructor(e){this.queue=[],this.concurrency=e,this.dequeuing=0}add(e,t=1e3){let n,r,i=new Promise((e,t)=>{n=e,r=t});return this.queue.unshift(()=>{let i=Promise.resolve().then(e);i.then(n,r);let a=fd(t);return Promise.race([i,a]).then(q,q)}),this.dequeue(),i}dequeue(){for(;this.dequeuing<this.concurrency&&this.queue.length>0;){let e=this.queue.pop();this.dequeuing++,e().catch(q).then(()=>{this.dequeuing--,this.dequeue()})}}}(1),md=256;function hd(e){return typeof e.image==`object`&&e.image.width>0&&e.image.height>0}function gd(e,t){if(!hd(e))return Promise.resolve(e);if(e.image.width<md&&e.image.width<md)return t.initTexture(e),Promise.resolve(e);let n=!1,r=()=>{n=!0,e.removeEventListener(`dispose`,r)};return e.addEventListener(`dispose`,r),pd.add(()=>new Promise(i=>{ri.shared.add(()=>{hd(e)&&n===!1&&t.initTexture(e),e.removeEventListener(`dispose`,r),i(e)},!0)}))}function _d(e,t){return Promise.all(e.map(e=>gd(e,t)))}var vd=/^[og]\s*(.+)?/,yd=/^mtllib /,bd=/^usemtl /,xd=/^usemap /,Sd=/\s+/,Cd=new c.Color,wd=class{constructor(){this.objects=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materials={},this.materialLibraries=[],this.startObject(``,!1)}startObject(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}let n=this.object&&typeof this.object.currentMaterial==`function`?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0),this.object={name:e||``,fromDeclaration:t!==!1,geometry:{vertices:[],hasNormal:!0,normals:[],hasColor:!0,colors:[],hasUV:!0,uvs:[],index:[],indexMap:{}},materials:[],smooth:!0,startMaterial:function(e,t){var n,r;let i=this._finalize(!1);i&&(i.inherited||((n=i.groupCount)==null?0:n)<=0)&&this.materials.splice((r=i.index)==null?0:r,1);let a={index:this.materials.length,name:e||``,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:``,smooth:i===void 0?this.smooth:i.smooth,groupStart:i===void 0?0:i.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1,clone(){return this}};return t.clone=this.clone.bind(t),t}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t,n;let r=this.currentMaterial();if(r&&r.groupEnd===-1&&(r.groupEnd=this.geometry.index.length,r.groupCount=r.groupEnd-((t=r.groupStart)==null?0:t),r.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)((n=this.materials[e].groupCount)==null?0:n)<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),r}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)}finalize(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)}parseVertexIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3}parseNormalIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3}parseUVIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2}addFace(e,t,n,r,i,a,o,s,c){let l=this.object.geometry,u=this.vertices.length,d=this.normals.length,f=this.uvs.length,p=this.parseVertexIndex(e,u),m=this.parseVertexIndex(t,u),h=this.parseVertexIndex(n,u),g=o===void 0?void 0:this.parseNormalIndex(o,d),_=s===void 0?void 0:this.parseNormalIndex(s,d),v=c===void 0?void 0:this.parseNormalIndex(c,d),y=r===void 0?void 0:this.parseUVIndex(r,f),b=i===void 0?void 0:this.parseUVIndex(i,f),x=a===void 0?void 0:this.parseUVIndex(a,f);(l.hasNormal===!0&&g===void 0||_===void 0||v===void 0)&&(l.hasNormal=!1),(l.hasUV===!0&&y===void 0||b===void 0||x===void 0)&&(l.hasUV=!1);let S=[p,y,g].join(`:`),C=l.indexMap[S];C===void 0&&(C=l.vertices.length/3,l.indexMap[S]=C,l.vertices.push(this.vertices[p+0],this.vertices[p+1],this.vertices[p+2]),l.hasColor&&(this.colors[p]===void 0?l.hasColor=!1:l.colors.push(this.colors[p+0],this.colors[p+1],this.colors[p+2])),l.hasNormal&&l.normals.push(this.normals[p+0],this.normals[p+1],this.normals[p+2]),l.hasUV&&l.uvs.push(this.uvs[y+0],this.uvs[y+1])),l.index.push(C);let w=[m,b,_].join(`:`),T=l.indexMap[w];T===void 0&&(T=l.vertices.length/3,l.indexMap[w]=T,l.vertices.push(this.vertices[m+0],this.vertices[m+1],this.vertices[m+2]),l.hasColor&&(this.colors[m]===void 0?l.hasColor=!1:l.colors.push(this.colors[m+0],this.colors[m+1],this.colors[m+2])),l.hasNormal&&l.normals.push(this.normals[m+0],this.normals[m+1],this.normals[m+2]),l.hasUV&&l.uvs.push(this.uvs[b+0],this.uvs[b+1])),l.index.push(T);let E=[h,x,v].join(`:`),D=l.indexMap[E];D===void 0&&(D=l.vertices.length/3,l.indexMap[E]=D,l.vertices.push(this.vertices[h+0],this.vertices[h+1],this.vertices[h+2]),l.hasColor&&(this.colors[h]===void 0?l.hasColor=!1:l.colors.push(this.colors[h+0],this.colors[h+1],this.colors[h+2])),l.hasNormal&&l.normals.push(this.normals[h+0],this.normals[h+1],this.normals[h+2]),l.hasUV&&l.uvs.push(this.uvs[x+0],this.uvs[x+1])),l.index.push(D)}};function Td(e){let t=new wd;e.indexOf(`\r
|
|
830
|
+
`,mo=`KHR_texture_basisu`,ho=class extends Ja{loadTexture(e,t){let n=t.json.textures[e];if(!n.extensions||!n.extensions[mo])return null;let r=n.extensions[mo],i=t.json.images[r.source],a=null;if(i.bufferView!==void 0)a=t.loadBufferView(i.bufferView).then(e=>co.parse(e));else if(i.uri)a=t.options.fetcher.ajax(t.resolveResouce(i.uri),{responseType:`arraybuffer`}).then(e=>co.parse(e.body));else throw Error(`glTF: Invalid image defs.`);let o=(t.json.samplers||{})[n.sampler]||{};return a=a.then(e=>(e.magFilter=c.LinearFilter,e.minFilter=c.LinearFilter,e.wrapS=Fa[o.wrapS]||c.RepeatWrapping,e.wrapT=Fa[o.wrapT]||c.RepeatWrapping,e)),a}},go=`KHR_texture_transform`,_o=class extends Ja{extendTexture(e,t,n){let r=t.extensions===void 0?void 0:t.extensions[go];return r?(r.texCoord!==void 0&&console.warn(`glTF: Custom UV sets in "`+go+`" extension not yet supported.`),r.offset===void 0&&r.rotation===void 0&&r.scale===void 0?e:(e=e.clone(),e.needsUpdate=!0,r.offset!==void 0&&e.offset.fromArray(r.offset),r.rotation!==void 0&&(e.rotation=r.rotation),r.scale!==void 0&&e.repeat.fromArray(r.scale),e)):null}},vo=class extends Ja{},yo=`KHR_materials_unlit`,bo=class extends Ja{extendMaterial(e,t,n){var r;return t.material!==void 0&&e instanceof vn&&((r=n.json.materials[t.material].extensions)==null?{}:r)[yo]&&(e.shaderType=`basic`),Promise.all([]).then(q)}},xo=`KHR_node_visibility`,So=class extends Ja{extendNode(e,t,n){var r;let i=[],a=(r=t.extensions)==null?{}:r;if(a[xo]){let t=a[xo];typeof t.visible==`boolean`&&(e.visible=t.visible)}return Promise.all(i).then(q)}},Co=class extends Ja{},wo=`KHR_materials_clearcoat`,To=class extends Ja{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof vn||e instanceof c.MeshPhysicalMaterial)){let a=(r=n.json.materials[t.material].extensions)==null?{}:r;if(a[wo]){let t=a[wo];if(t.clearcoatFactor!==void 0&&(e.clearcoat=t.clearcoatFactor),t.clearcoatTexture!==void 0&&i.push(n.createMaterialTexture(t.clearcoatTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatMap=t,n.disposeSet.add(t)})),t.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=t.clearcoatRoughnessFactor),t.clearcoatRoughnessTexture!==void 0&&i.push(n.createMaterialTexture(t.clearcoatRoughnessTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatRoughnessMap=t,n.disposeSet.add(t)})),t.clearcoatNormalTexture!==void 0&&(i.push(n.createMaterialTexture(t.clearcoatNormalTexture).then(t=>{t.format=c.RGBFormat,e.clearcoatNormalMap=t,n.disposeSet.add(t)})),t.clearcoatNormalTexture.scale!==void 0)){let n=t.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new c.Vector2(n,n)}}}return Promise.all(i).then(q)}},Eo=`KHR_materials_sheen`,Do=class extends Ja{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof vn||e instanceof c.MeshPhysicalMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Eo]){let t=i[Eo];if(t.sheenColorFactor!==void 0){let n=t.sheenColorFactor;e.sheen=new c.Color().setRGB(n[0],n[1],n[2])}t.sheenRoughnessFactor!==void 0&&console.warn(`glTF: ${Eo} sheenRoughnessFactor unsupported`),t.sheenColorTexture!==void 0&&console.warn(`glTF: ${Eo} sheenColorTexture unsupported`),t.sheenRoughnessTexture!==void 0&&console.warn(`glTF: ${Eo} sheenRoughnessTexture unsupported`)}}return Promise.all(i).then(q)}},Oo=`KHR_materials_transmission`,ko=class extends Ja{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof vn||e instanceof c.MeshPhysicalMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Oo]){let t=i.KHR_materials_transmission;t.transmissionFactor!==void 0&&(e.transparency=t.transmissionFactor,e.transparency>0&&(e.transparent=!0)),t.transmissionTexture!==void 0&&console.warn(`glTF: ${Oo} transmissionTexture unsupported`)}}return Promise.all(i).then(q)}},Ao=`KHR_materials_emissive_strength`,jo=class extends Ja{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof vn||e instanceof c.MeshStandardMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[Ao]){let t=i[Ao];t.emissiveStrength!==void 0&&(e.emissiveIntensity=t.emissiveStrength)}}return Promise.all(i).then(q)}},Mo=(function(){"use strict";var e=`b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:78Yqdbk:qzezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlinalgic9Wfglawcj;cbffhOdndndndndnaHalco4fRbbalci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOaoRblaoRbbgAco4glalciSgCE86bbawcj;cbfaifglcGfaoclfaCfgORbbaAcl4ciGgCaCciSgCE86bbalcVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbalc7faOaCfgORbbaAciGgAaAciSgAE86bbalctfaOaAfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkaOaoRbwaoRbbgAcl4glalcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgORbbaAcsGgAaAcsSgAE86bbalcVfaOaAfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekaOao8Pbb83bbaOcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhPdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkaCcefhCamcefgmad6hsamad9hmbkaPhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaPhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj;8ifcjjj98G::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb`,t=`b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;a9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;d8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgAclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb`,n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=`object`)return{supported:!1};var i=WebAssembly.validate(n)?t:e,a,o=WebAssembly.instantiate(s(i),{}).then(function(e){a=e.instance,a.exports.__wasm_call_ctors()});function s(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);t[n]=i>96?i-97:i>64?i-39:i+4}for(var a=0,n=0;n<e.length;++n)t[a++]=t[n]<60?r[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,a)}function c(e,t,n,r,i,o){var s=a.exports.sbrk,c=n+3&-4,l=s(c*r),u=s(i.length),d=new Uint8Array(a.exports.memory.buffer);d.set(i,u);var f=e(l,n,r,u,i.length);if(f==0&&o&&o(l,c,r),t.set(d.subarray(l,l+n*r)),s(l-s(0)),f!=0)throw Error(`Malformed buffer data: `+f)}var l={NONE:``,OCTAHEDRAL:`meshopt_decodeFilterOct`,QUATERNION:`meshopt_decodeFilterQuat`,EXPONENTIAL:`meshopt_decodeFilterExp`},u={ATTRIBUTES:`meshopt_decodeVertexBuffer`,TRIANGLES:`meshopt_decodeIndexBuffer`,INDICES:`meshopt_decodeIndexSequence`},d=[],f=0;function p(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function m(e){for(var t=`var instance; var ready = WebAssembly.instantiate(new Uint8Array([`+new Uint8Array(s(i))+`]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;`+c.toString()+g.toString(),n=new Blob([t],{type:`text/javascript`}),r=URL.createObjectURL(n),a=0;a<e;++a)d[a]=p(r);URL.revokeObjectURL(r)}function h(e,t,n,r,i){for(var a=d[0],o=1;o<d.length;++o)d[o].pending<a.pending&&(a=d[o]);return new Promise(function(o,s){var c=new Uint8Array(n),l=f++;a.pending+=e,a.requests[l]={resolve:o,reject:s},a.object.postMessage({id:l,count:e,size:t,source:c,mode:r,filter:i},[c.buffer])})}function g(e){o.then(function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);c(a.exports[t.mode],n,t.count,t.size,t.source,a.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:`resolve`,value:n},[n.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:`reject`,value:e})}})}return{ready:o,supported:!0,useWorkers:function(e){m(e)},decodeVertexBuffer:function(e,t,n,r,i){c(a.exports.meshopt_decodeVertexBuffer,e,t,n,r,a.exports[l[i]])},decodeIndexBuffer:function(e,t,n,r){c(a.exports.meshopt_decodeIndexBuffer,e,t,n,r)},decodeIndexSequence:function(e,t,n,r){c(a.exports.meshopt_decodeIndexSequence,e,t,n,r)},decodeGltfBuffer:function(e,t,n,r,i,o){c(a.exports[u[i]],e,t,n,r,a.exports[l[o]])},decodeGltfBufferAsync:function(e,t,n,r,i){return d.length>0?h(e,t,n,u[r],l[i]):o.then(function(){var o=new Uint8Array(e*t);return c(a.exports[u[r]],o,e,t,n,a.exports[l[i]]),o})}}})(),No=`EXT_meshopt_compression`,Po=class extends Ja{loadBufferView(e,t){let n=t.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[No]){let e=r.extensions[No],i=t.loadBuffer(e.buffer);if(!Mo.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(No)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return Promise.all([i,Mo.ready]).then(([t])=>{let n=e.byteOffset||0,r=e.byteLength||0,i=e.count,a=e.byteStride,o=new ArrayBuffer(i*a),s=new Uint8Array(t,n,r);return Mo.decodeGltfBuffer(new Uint8Array(o),i,a,s,e.mode,e.filter),o})}else return null}},Fo=`EXT_texture_webp`,Io=class extends Ja{constructor(){super(...arguments),this.supportsWep=!1}prepare(e){return kr().then(e=>{this.supportsWep=e.webp})}loadTexture(e,t){let n=t.json.textures[e];if(!n.extensions||!n.extensions[Fo]||!this.supportsWep)return null;let r=n.extensions[Fo];return t.loadImage(r.source).then(e=>{let r=new c.Texture(e);r.needsUpdate=!0,r.flipY=!1,n.name&&(r.name=n.name);let i=(t.json.samplers||{})[n.sampler]||{};return r.magFilter=Pa[i.magFilter]||c.LinearFilter,r.minFilter=Pa[i.minFilter]||c.LinearMipmapLinearFilter,r.wrapS=Fa[i.wrapS]||c.RepeatWrapping,r.wrapT=Fa[i.wrapT]||c.RepeatWrapping,r.onUpdate=function(){e.close()},r})}},Lo=`CESIUM_RTC`,Ro=class extends Ja{emitResult(e,t){if(t.json.extensions[Lo]&&t.json.extensions[Lo].center){let n=t.json.extensions[Lo].center;e.CESIUM_RTC={center:new c.Vector3().fromArray(n)}}}},zo=`REALSEE_materials_lightmap`,Bo=class extends Ja{extendMaterial(e,t,n){let r=[];if(n.json.materials&&t.material!==void 0){let i=n.json.materials[t.material].extensions[zo];i&&(i.lightMapTexture!==void 0&&r.push(n.createMaterialTexture(i.lightMapTexture).then(t=>{e.lightMap=t})),i.lightMapIntensity!==void 0&&(e.lightMapIntensity=i.lightMapIntensity))}return Promise.all(r).then(()=>{})}};function Vo(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var Ho=new Float32Array(1),Uo=new Uint32Array(Ho.buffer),Wo=typeof Float16Array<`u`,Go=Wo?new Float16Array(1):null,Ko=Wo?new Uint16Array(Go.buffer):new Uint16Array(1);function qo(e){if(Wo&&Go)return Ko[0]=e,Go[0];let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0)if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return Uo[0]=i,Ho[0]}var Jo=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`);this.reader=new Blob([e]).stream().pipeThrough(t).getReader()}read(e){return Vo(this,void 0,void 0,function*(){for(;this.totalBytes<e;){let{value:e,done:t}=yield this.reader.read();if(t)break;this.chunks.push(e),this.totalBytes+=e.length}if(this.totalBytes<e)throw Error(`Unexpected EOF: needed ${e}, got ${this.totalBytes}`);let t=new Uint8Array(this.totalBytes),n=0;for(let e of this.chunks)t.set(e,n),n+=e.length;let r=t.subarray(0,e);return this.chunks=[t.subarray(e)],this.totalBytes-=e,r})}},Yo=.28209479177387814,Xo=class{constructor({fileBytes:e}){this.version=-1,this.numSplats=0,this.shDegree=0,this.fractionalBits=0,this.flags=0,this.flagAntiAlias=!1,this.reserved=0,this.headerParsed=!1,this.parsed=!1,this.fileBytes=e instanceof ArrayBuffer?new Uint8Array(e):e,this.reader=new Jo({fileBytes:this.fileBytes})}parseHeader(){return Vo(this,void 0,void 0,function*(){if(this.headerParsed)throw Error(`SPZ file header already parsed`);let e=new DataView((yield this.reader.read(16)).buffer);if(e.getUint32(0,!0)!==1347635022)throw Error(`Invalid SPZ file`);if(this.version=e.getUint32(4,!0),this.version<1||this.version>3)throw Error(`Unsupported SPZ version: ${this.version}`);this.numSplats=e.getUint32(8,!0),this.shDegree=e.getUint8(12),this.fractionalBits=e.getUint8(13),this.flags=e.getUint8(14),this.flagAntiAlias=(this.flags&1)!=0,this.reserved=e.getUint8(15),this.headerParsed=!0,this.parsed=!1})}parseSplats(e,t,n,r,i,a){return Vo(this,void 0,void 0,function*(){if(!this.headerParsed)throw Error(`SPZ file header must be parsed first`);if(this.parsed)throw Error(`SPZ file already parsed`);if(this.parsed=!0,this.version===1){let t=yield this.reader.read(this.numSplats*3*2),n=new Uint16Array(t.buffer);for(let t=0;t<this.numSplats;t++){let r=t*3,i=qo(n[r]),a=qo(n[r+1]),o=qo(n[r+2]);e==null||e(t,i,a,o)}}else if(this.version===2||this.version===3){let t=1<<this.fractionalBits,n=yield this.reader.read(this.numSplats*3*3);for(let r=0;r<this.numSplats;r++){let i=r*9,a=((n[i+2]<<24|n[i+1]<<16|n[i]<<8)>>8)/t,o=((n[i+5]<<24|n[i+4]<<16|n[i+3]<<8)>>8)/t,s=((n[i+8]<<24|n[i+7]<<16|n[i+6]<<8)>>8)/t;e==null||e(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats);for(let n=0;n<this.numSplats;n++)t==null||t(n,e[n]/255)}{let e=yield this.reader.read(this.numSplats*3),t=Yo/.15;for(let r=0;r<this.numSplats;r++){let i=r*3,a=(e[i]/255-.5)*t+.5,o=(e[i+1]/255-.5)*t+.5,s=(e[i+2]/255-.5)*t+.5;n==null||n(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,i=Math.exp(e[n]/16-10),a=Math.exp(e[n+1]/16-10),o=Math.exp(e[n+2]/16-10);r==null||r(t,i,a,o)}}if(this.version===3){let e=1/Math.sqrt(2),t=yield this.reader.read(this.numSplats*4);for(let n=0;n<this.numSplats;n++){let r=n*4,a=[0,0,0,0],o=[t[r],t[r+1],t[r+2],t[r+3]],s=o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24),c=s>>>30,l=s,u=0;for(let t=3;t>=0;--t)if(t!==c){let n=l&511,r=l>>>9&1;l>>>=10,a[t]=n/511*e,a[t]=r===0?a[t]:-a[t],u+=a[t]*a[t]}let d=1-u;a[c]=Math.sqrt(Math.max(d,0)),i==null||i(n,a[0],a[1],a[2],a[3])}}else{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,r=e[n]/127.5-1,a=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-a*a-o*o));i==null||i(t,r,a,o,s)}}if(a&&this.shDegree>=1){let e={1:3,2:8,3:15}[this.shDegree]||0,t=yield this.reader.read(this.numSplats*e*3),n=new Float32Array(9),r=this.shDegree>=2?new Float32Array(15):void 0,i=this.shDegree>=3?new Float32Array(21):void 0,o=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[o+e]-128)/128;if(o+=9,r){for(let e=0;e<15;++e)r[e]=(t[o+e]-128)/128;o+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[o+e]-128)/128;o+=21}a==null||a(e,new Float32Array(n),r?new Float32Array(r):void 0,i?new Float32Array(i):void 0)}}})}};function Zo(e){return Vo(this,void 0,void 0,function*(){let t=new Xo({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),i=new Uint8Array(n*4),a=new Float32Array(n*3),o=new Float32Array(n*4),s,c,l;return t.shDegree>=1&&(s=new Float32Array(n*9)),t.shDegree>=2&&(c=new Float32Array(n*15)),t.shDegree>=3&&(l=new Float32Array(n*21)),yield t.parseSplats((e,t,n,i)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=i},(e,t)=>{i[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{i[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),i[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),i[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{a[e*3]=t,a[e*3+1]=n,a[e*3+2]=r},(e,t,n,r,i)=>{o[e*4]=i,o[e*4+1]=t,o[e*4+2]=n,o[e*4+3]=r},(e,t,n,r)=>{s&&t&&s.set(t,e*9),c&&n&&c.set(n,e*15),l&&r&&l.set(r,e*21)}),new Yn({numPoints:n,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l,shDegree:t.shDegree})})}function Qo(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?pr:i,l=(a=t.onDownloadProgress)==null?q:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>Zo(new Uint8Array(e))).then(t=>(o===`Z`&&(t.applyMatrix4(Zn),t.updateMatrix(),t.updateMatrixWorld(!0),t.transformChanged=!0),{type:`spz`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:Ai(t),scene:t,textures:[],animations:[],dispose:()=>t.dispose()}))}var $o=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),es=new c.Matrix4().getInverse($o),ts={KHR_binary_glTF:Xa,KHR_draco_mesh_compression:ro,KHR_texture_basisu:ho,KHR_texture_transform:_o,KHR_mesh_quantization:vo,KHR_materials_unlit:bo,KHR_node_visibility:So,KHR_animation_pointer:Co,KHR_materials_clearcoat:To,KHR_materials_sheen:Do,KHR_materials_transmission:ko,KHR_materials_emissive_strength:jo,EXT_meshopt_compression:Po,EXT_texture_webp:Io,CESIUM_RTC:Ro,REALSEE_materials_lightmap:Bo,KHR_gaussian_splatting_compression_spz:class extends Ja{constructor(){super(...arguments),this.name=`KHR_gaussian_splatting_compression_spz`,this.parentName=`KHR_gaussian_splatting`}loadMesh(e,t){let n=t.json.meshes[e].primitives;return n.length===0?null:(n.length===1||console.warn(`KHR_gaussian_splatting_compression_spz: multiple primitives are not supported`),this.loadSpz(n[0],t))}loadSpz(e,t){return Vo(this,void 0,void 0,function*(){let n=e.extensions[this.parentName].bufferView;return t.loadBufferView(n).then(e=>Zo(new Uint8Array(e))).then(e=>(e.applyMatrix4(es),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}}};function ns(e,t){var n,r,i;let a={},o,s;if(typeof e==`string`)s=e;else if(ts.KHR_binary_glTF.getMagic(e)===ts.KHR_binary_glTF.HEADER_MAGIC){o=new ts.KHR_binary_glTF;try{o.loadGlbBinary(e)}catch(e){return Promise.reject(e)}a.KHR_binary_glTF=o,s=o.content}else s=ja(new Uint8Array(e));let c=JSON.parse(s);if(t.jsonModify&&(c=t.jsonModify(c)),c.asset===void 0||Number(c.asset.version[0])<2)return Promise.reject(Error(`glTF: Unsupported asset. glTF versions >=2.0 are supported.`));if(c.extensionsUsed){let e=c.extensionsRequired||[];for(var l=0;l<c.extensionsUsed.length;l++){let t=c.extensionsUsed[l];a[t]||(ts[t]?a[t]=new ts[t]:e.indexOf(t)>=0&&console.warn(`glTF: Unknown extension "`+t+`".`))}}return new Ua(c,a,{copyUV2:(n=t.copyUV2)==null?!1:n,resourcePath:(r=t.resourcePath)==null?``:r,search:(i=t.search)==null?``:i,fetcher:t.fetcher}).parse().then(e=>(o&&o.clear(),e))}function rs(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,l=(i=t.fetcher)==null?pr:i,u=(a=t.onDownloadProgress)==null?q:a,d={uri:e,gltfUpAxis:o};return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>pa(d,e,t)).then(t=>Ta(d,e,t)).then(t=>Aa(d,e,t))).then(()=>{var n;return ns(d.gltfArrayBuffer,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,jsonModify(e){var n,r;if(t.light===!1){let t=`KHR_materials_unlit`;if(e.extensionsUsed=(n=e.extensionsUsed)==null?[]:n,e.extensionsUsed.indexOf(t)===-1&&e.extensionsUsed.push(t),e.materials)for(let n of e.materials)n.extensions=(r=n.extensions)==null?{}:r,n.extensions[t]={}}return e},fetcher:l}).then(e=>{let t=new c.Matrix4;o===`Y`&&t.premultiply(Xn);let n;if(d.rtcCenter?n=new c.Vector3().fromArray(d.rtcCenter):e.CESIUM_RTC&&(n=new c.Vector3().copy(e.CESIUM_RTC.center)),n){let e=new c.Matrix4().setPosition(n);t.premultiply(e)}return s===`Y`&&t.premultiply(Zn),e.scene.applyMatrix4(t),d.featureTableBinary=void 0,d.batchTableBinary=void 0,d.gltfArrayBuffer=void 0,{type:`b3dm`,modelUpAxis:o,upAxis:`Z`,uri:d.uri,byteLength:d.byteLength,memoryUsage:Ai(e.scene),scene:e.scene,textures:e.textures,animations:[],rtcCenter:n,dispose:()=>e.dispose()}})})}var is="(function(){function e(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}var t;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(t||={});let n={[t.DOUBLE]:Float64Array,[t.FLOAT]:Float32Array,[t.UNSIGNED_SHORT]:Uint16Array,[t.UNSIGNED_INT]:Uint32Array,[t.UNSIGNED_BYTE]:Uint8Array,[t.BYTE]:Int8Array,[t.SHORT]:Int16Array,[t.INT]:Int32Array},r={DOUBLE:t.DOUBLE,FLOAT:t.FLOAT,UNSIGNED_SHORT:t.UNSIGNED_SHORT,UNSIGNED_INT:t.UNSIGNED_INT,UNSIGNED_BYTE:t.UNSIGNED_BYTE,BYTE:t.BYTE,SHORT:t.SHORT,INT:t.INT};function i(e){let t=n[e];if(!t)throw Error(`Failed to convert GL type`);return t}function a(e){return i(e).BYTES_PER_ELEMENT}function o(e,t,n=0,r){let o=i(e);return n%a(e)===0?new o(t,n,r??(t.byteLength-n)/a(e)):new o(r?t.slice(n,n+r*a(e)):t.slice(n))}function s(e){let t=r[e];if(!t)throw Error(`Failed to convert GL type`);return t}var c=class{constructor(e,n){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=n;let r=this.getGlobalProperty(`POINTS_LENGTH`,t.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(i(t))([r]):Array.isArray(r)?new(i(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=s(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,s=a[e];return s||(s=o(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=s),s}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=o(t,n),r[e]=i),i}};e(e=>Promise.resolve(e).then(e=>{let t=new c(e.featureTableJson,e.featureTableBinary),n=u(t),r=d(t),i=p(t),a=[];return n&&a.push(n.array.buffer),r&&a.push(r.array.buffer),i&&a.push(i.array.buffer),{output:{position:n,color:r,normal:i},transfer:a}}));let l=65535;function u(e){if(e.hasProperty(`POSITION`))return{array:e.getPropertyArray(`POSITION`,t.FLOAT,3),itemSize:3,normalized:!1};if(e.hasProperty(`POSITION_QUANTIZED`)){let n=e.getPropertyArray(`POSITION_QUANTIZED`,t.UNSIGNED_SHORT,3),r=e.getGlobalProperty(`QUANTIZED_VOLUME_SCALE`,t.FLOAT,3),i=e.getGlobalProperty(`QUANTIZED_VOLUME_OFFSET`,t.FLOAT,3);if(!r||!i)throw Error(`QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.`);let a=new Float32Array(n.length),o=n.length/3,s=r[0]/l,c=r[1]/l,u=r[2]/l,d=i[0],f=i[1],p=i[2];for(let e=0,t;e<o;e++)t=e*3,a[t]=n[t]*s+d,a[++t]=n[t]*c+f,a[++t]=n[t]*u+p;return{array:a,itemSize:3,normalized:!1}}return null}function d(e){if(e.hasProperty(`RGB`)){let n=e.getPropertyArray(`RGB`,t.UNSIGNED_BYTE,3),r=n.length/3,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t],i[++a]=n[++t],i[++a]=n[++t];return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`RGBA`))return{array:e.getPropertyArray(`RGBA`,t.UNSIGNED_BYTE,4),itemSize:4,normalized:!0};else if(e.hasProperty(`RGB565`)){let n=e.getPropertyArray(`RGB565`,t.UNSIGNED_SHORT,1),r=n.length,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=n[e],t=e*4,i[t]=(a>>11&31)<<3,i[++t]=(a>>5&63)<<2,i[++t]=(a&31)<<3;return{array:i,itemSize:4,normalized:!0}}return null}let f=2/255;function p(e){if(e.hasProperty(`NORMAL`)){let n=e.getPropertyArray(`NORMAL`,t.FLOAT,3),r=n.length/3,i=new Int8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t]*127,i[++a]=n[++t]*127,i[++a]=n[++t]*127;return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`NORMAL_OCT16P`)){let n=e.getPropertyArray(`NORMAL_OCT16P`,t.UNSIGNED_BYTE,2),r=n.length/2,i=new Int8Array(r*4);for(let e=0,t,a,o,s,c,l,u;e<r;e++)t=e*2,a=n[t]*f-1,o=n[++t]*f-1,c=a<0?-a:a,l=o<0?-o:o,s=1-(c+l),s<0&&(a=(1-l)*(a<0?-1:1),o=(1-c)*(o<0?-1:1)),u=Math.sqrt(a*a+o*o+s*s),t=e*4,i[t]=a/u*127,i[++t]=o/u*127,i[++t]=s/u*127;return{array:i,itemSize:4,normalized:!0}}return null}})();",as=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,is],{type:`text/javascript;charset=utf-8`});function os(e){let t;try{if(t=as&&(self.URL||self.webkitURL).createObjectURL(as),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(is),{name:e==null?void 0:e.name})}}var ss=new io(()=>new os,2);function cs(e,t,n){let r=new xa(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then(()=>{let e=r.getExtension(`3DTILES_draco_point_compression`);return e?ls(e,r):ss.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(t=>(e.attributes=t,n))}function ls(e,t){return Vo(this,void 0,void 0,function*(){let n=e.properties||{},r=e.byteOffset,i=e.byteLength;if(!n||!Number.isFinite(r)||!i)throw Error(`Draco properties, byteOffset, and byteLength must be defined`);let a=t.buffer.slice(r,r+i),o=e.properties;return eo.decodeGeometry(a.buffer,{attributeIDs:o,attributeTypes:{POSITION:`Float32Array`,NORMAL:`Float32Array`,RGB:`Uint8Array`,RGBA:`Uint8Array`},useUniqueIDs:!0}).then(e=>{let t=e.getAttribute(`POSITION`),n=e.getAttribute(`RGB`),r=e.getAttribute(`RGBA`),i=e.getAttribute(`NORMAL`),a;if(r)a=r;else if(n){let e=n.count,t=n.array,r=new Uint8Array(e*4);for(let n=0,i,a;n<e;n++)a=n*4,i=n*3,r[a]=t[i],r[++a]=t[++i],r[++a]=t[++i];a=new c.BufferAttribute(r,4,n.normalized)}return{position:t?{array:t.array,itemSize:t.itemSize,normalized:t.normalized}:null,color:a?{array:a.array,itemSize:a.itemSize,normalized:a.normalized}:null,normal:i?{array:i.array,itemSize:i.itemSize,normalized:i.normalized}:null}})})}function us(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={uri:e};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>pa(l,e,t)).then(t=>Ta(l,e,t)).then(t=>cs(l,e,t))).then(()=>{var e;return ds(l.attributes,{computeBoundingBox:(e=t.computeBoundingBox)==null?!0:e})}).then(e=>{let t=new c.Matrix4,n;if(l.rtcCenter&&(n=new c.Vector3().fromArray(l.rtcCenter)),n){let e=new c.Matrix4().setPosition(n);t.premultiply(e)}return a===`Y`&&t.premultiply(Zn),e.object.applyMatrix4(t),l.gltfArrayBuffer=void 0,l.featureTableBinary=void 0,l.batchTableBinary=void 0,{type:`pnts`,modelUpAxis:`Z`,upAxis:a,uri:l.uri,byteLength:l.byteLength,memoryUsage:Ai(e.object),scene:e.object,textures:[],animations:[],rtcCenter:n,dispose:()=>e.dispose()}})}function ds(e,t){let n=new Set,r=new c.BufferGeometry;n.add(r);let i=new On;n.add(i),e.position&&r.setAttribute(`position`,new c.BufferAttribute(e.position.array,e.position.itemSize,e.position.normalized)),e.color&&r.setAttribute(`color`,new c.BufferAttribute(e.color.array,e.color.itemSize,e.color.normalized)),e.normal?r.setAttribute(`normal`,new c.BufferAttribute(e.normal.array,e.normal.itemSize,e.normal.normalized)):i.flatShading=!0,t.computeBoundingBox&&r.computeBoundingBox();let a=new kn(r,i);return a.matrix.compose(a.position,a.quaternion,a.scale),a.matrixAutoUpdate=!1,a.frustumCulled=!1,Promise.resolve({object:a,dispose:()=>{n.forEach(e=>{e.dispose()}),n.clear()}})}function fs(e,t={}){var n,r,i,a,o;let s=(n=t.modelUpAxis)==null?`Y`:n,l=(r=t.upAxis)==null?`Z`:r,u=(i=t.fetcher)==null?pr:i,d=(a=t.onDownloadProgress)==null?q:a,f=(o=t.jsonModify)==null?q:o,p=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>(p=e.body.byteLength,e.body))).then(n=>{var r;return ns(n,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var n,r,i;if(t.light===!1){let t=`KHR_materials_unlit`;if(e.extensionsUsed=(n=e.extensionsUsed)==null?[]:n,e.extensionsUsed.indexOf(t)===-1&&e.extensionsUsed.push(t),e.materials)for(let n of e.materials)n.extensions=(r=n.extensions)==null?{}:r,n.extensions[t]={}}return(i=f(e))==null?e:i},fetcher:u})}).then(t=>{var n;let r=new c.Matrix4;if(s===`Y`&&r.premultiply(Xn),t.CESIUM_RTC){let e=new c.Matrix4().setPosition(t.CESIUM_RTC.center);r.premultiply(e)}return l===`Y`&&r.premultiply(Zn),t.scene.applyMatrix4(r),{type:`gltf`,modelUpAxis:s,upAxis:l,uri:e,byteLength:p,memoryUsage:Ai(t.scene),scene:t.scene,textures:t.textures,animations:t.animations,rtcCenter:(n=t.CESIUM_RTC)==null?void 0:n.center,dispose:()=>t.dispose()}})}var ps=new c.Color;function ms(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Z`:n,s=(r=t.upAxis)==null?`Z`:r,l=(i=t.fetcher)==null?pr:i,u=(a=t.onDownloadProgress)==null?q:a,d=0;return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>(d=e.body.byteLength,e.body))).then(e=>{var n,r;return hs(e,{propertyNameMapping:(n=t.propertyNameMapping)==null?{}:n,customPropertyMapping:(r=t.customPropertyMapping)==null?{}:r})}).then(({geometry:n})=>{switch(t.type){case`geometry`:{let t=n;return o===`Y`&&t.applyMatrix4(Xn),s===`Y`&&t.applyMatrix4(Zn),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:xi(t),scene:t,textures:[],animations:[],dispose:()=>{n.dispose()}}}case`line`:{let t=`color`in n.attributes,r=new c.LineBasicMaterial({vertexColors:t}),i=new c.Line(n,r);return i.computeLineDistances(),o===`Y`&&i.applyMatrix4(Xn),s===`Y`&&i.applyMatrix4(Zn),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Ai(i),scene:i,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmMesh`:{let r=new vn(t.light?`phong`:`basic`);r.vertexColors=`color`in n.attributes;let i=new c.Mesh(n,r);return o===`Y`&&i.applyMatrix4(Xn),s===`Y`&&i.applyMatrix4(Zn),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Ai(i),scene:i,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmPointCloud`:{let t=new On,r=new kn(n,t);return o===`Y`&&r.applyMatrix4(Xn),s===`Y`&&r.applyMatrix4(Zn),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:Ai(r),scene:r,textures:[],animations:[],dispose:()=>{n.dispose(),t.dispose()}}}default:break}throw Error(`Invalid Type: ${t.type}`)})}function hs(e,t){let n=new Uint8Array(e),{headerText:r,headerLength:i}=Os(n),a=_s(r,i,t);return a.format===`ascii`?{header:a,geometry:Ss(new TextDecoder().decode(n),a,t)}:{header:a,geometry:Ds(e,a,t)}}function gs(e,t){let n={name:``,type:e[0]};return n.type===`list`?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],n.name in t.propertyNameMapping&&(n.name=t.propertyNameMapping[n.name]),n}function _s(e,t=0,n){let r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,i=``,a=r.exec(e);a!==null&&(i=a[1]);let o={format:``,version:``,comments:[],elements:[],headerLength:t,objInfo:``},s=i.split(/\r\n|\r|\n/),c=null;for(let e=0;e<s.length;e++){let t=s[e];if(t=t.trim(),t===``)continue;let r=t.split(/\s+/),i=r.shift();switch(t=r.join(` `),i){case`format`:o.format=r[0],o.version=r[1];break;case`comment`:o.comments.push(t);break;case`element`:c&&o.elements.push(c),c={name:r[0],count:parseInt(r[1]),properties:[]};break;case`property`:c&&c.properties.push(gs(r,n));break;case`obj_info`:o.objInfo=t;break;default:console.log(`unhandled`,i,r)}}return c&&o.elements.push(c),o}function vs(e,t){switch(t){case`char`:case`uchar`:case`short`:case`ushort`:case`int`:case`uint`:case`int8`:case`uint8`:case`int16`:case`uint16`:case`int32`:case`uint32`:return parseInt(e);case`float`:case`double`:case`float32`:case`float64`:return parseFloat(e);default:throw Error(`unspport type: `+t)}}function ys(e,t){let n={};for(let r=0;r<e.length;r++){if(t.empty())return null;if(e[r].type===`list`){let i=[],a=vs(t.next(),e[r].countType);for(let n=0;n<a;n++){if(t.empty())return null;i.push(vs(t.next(),e[r].itemType))}n[e[r].name]=i}else n[e[r].name]=vs(t.next(),e[r].type)}return n}function bs(e){let t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(let n of Object.keys(e.customPropertyMapping))t[n]=[];return t}function xs(e){let t=e.map(e=>e.name);function n(e){for(let n=0,r=e.length;n<r;n++){let r=e[n];if(t.includes(r))return r}return null}return{attrX:n([`x`,`px`,`posx`])||`x`,attrY:n([`y`,`py`,`posy`])||`y`,attrZ:n([`z`,`pz`,`posz`])||`z`,attrNX:n([`nx`,`normalx`]),attrNY:n([`ny`,`normaly`]),attrNZ:n([`nz`,`normalz`]),attrS:n([`s`,`u`,`texture_u`,`tx`]),attrT:n([`t`,`v`,`texture_v`,`ty`]),attrR:n([`red`,`diffuse_red`,`r`,`diffuse_r`]),attrG:n([`green`,`diffuse_green`,`g`,`diffuse_g`]),attrB:n([`blue`,`diffuse_blue`,`b`,`diffuse_b`])}}function Ss(e,t,n){let r=bs(n),i=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,a,o=null;a=(o=i.exec(e))===null?[]:o[1].split(/\s+/);let s=new ks(a);loop:for(let e=0;e<t.elements.length;e++){let i=t.elements[e],a=xs(i.properties);for(let e=0;e<i.count;e++){let e=ys(i.properties,s);if(!e)break loop;ws(r,i.name,e,a,n)}}return Cs(r,n)}function Cs(e,t){let n=new c.BufferGeometry;e.indices.length>0&&n.setIndex(e.indices),n.setAttribute(`position`,new c.Float32BufferAttribute(e.vertices,3)),e.normals.length>0&&n.setAttribute(`normal`,new c.Float32BufferAttribute(e.normals,3)),e.uvs.length>0&&n.setAttribute(`uv`,new c.Float32BufferAttribute(e.uvs,2)),e.colors.length>0&&n.setAttribute(`color`,new c.Float32BufferAttribute(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(n=n.toNonIndexed(),e.faceVertexUvs.length>0&&n.setAttribute(`uv`,new c.Float32BufferAttribute(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&n.setAttribute(`color`,new c.Float32BufferAttribute(e.faceVertexColors,3)));for(let r of Object.keys(t.customPropertyMapping))if(e[r].length>0){let{itemType:i,itemNames:a,normalized:o}=t.customPropertyMapping[r],s=a.length,l;switch(i){case`float32`:l=new c.Float32BufferAttribute(e[r],s,o);break;case`uint32`:l=new c.Uint32BufferAttribute(e[r],s,o);break;case`int32`:l=new c.Int32BufferAttribute(e[r],s,o);break;case`uint16`:l=new c.Uint16BufferAttribute(e[r],s,o);break;case`int16`:l=new c.Int16BufferAttribute(e[r],s,o);break;case`uint8`:l=new c.Uint8BufferAttribute(e[r],s,o);break;case`int8`:l=new c.Int8BufferAttribute(e[r],s,o);break;default:l=new c.Float32BufferAttribute(e[r],s,o);break}n.setAttribute(r,l)}return n.computeBoundingSphere(),n}function ws(e,t,n,r,i){if(t===`vertex`){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&e.vertices.push(n[r.attrX],n[r.attrY],n[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&e.normals.push(n[r.attrNX],n[r.attrNY],n[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&e.uvs.push(n[r.attrS],n[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(ps.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.colors.push(ps.r,ps.g,ps.b));for(let t of Object.keys(i.customPropertyMapping))for(let r of i.customPropertyMapping[t].itemNames)e[t].push(n[r])}else if(t===`face`){let t=n.vertex_indices||n.vertex_index,i=n.texcoord;t.length===3?(e.indices.push(t[0],t[1],t[2]),i&&i.length===6&&(e.faceVertexUvs.push(i[0],i[1]),e.faceVertexUvs.push(i[2],i[3]),e.faceVertexUvs.push(i[4],i[5]))):t.length===4&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(ps.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.faceVertexColors.push(ps.r,ps.g,ps.b),e.faceVertexColors.push(ps.r,ps.g,ps.b),e.faceVertexColors.push(ps.r,ps.g,ps.b))}}function Ts(e,t){let n={},r=0;for(let i=0;i<t.length;i++){let a=t[i],o=a.valueReader;if(a.type===`list`){let t=[],i=a.countReader.read(e+r);r+=a.countReader.size;for(let n=0;n<i;n++)t.push(o.read(e+r)),r+=o.size;n[a.name]=t}else n[a.name]=o.read(e+r),r+=o.size}return[n,r]}function Es(e,t,n){function r(e,t,n){switch(t){case`int8`:case`char`:return{read:t=>e.getInt8(t),size:1};case`uint8`:case`uchar`:return{read:t=>e.getUint8(t),size:1};case`int16`:case`short`:return{read:t=>e.getInt16(t,n),size:2};case`uint16`:case`ushort`:return{read:t=>e.getUint16(t,n),size:2};case`int32`:case`int`:return{read:t=>e.getInt32(t,n),size:4};case`uint32`:case`uint`:return{read:t=>e.getUint32(t,n),size:4};case`float32`:case`float`:return{read:t=>e.getFloat32(t,n),size:4};case`float64`:case`double`:return{read:t=>e.getFloat64(t,n),size:8};default:throw Error(`not support type: `+t)}}for(let i=0,a=e.length;i<a;i++){let a=e[i];a.type===`list`?(a.countReader=r(t,a.countType,n),a.valueReader=r(t,a.itemType,n)):a.valueReader=r(t,a.type,n)}}function Ds(e,t,n){let r=bs(n),i=t.format===`binary_little_endian`,a=new DataView(e,t.headerLength),o,s=0;for(let e=0;e<t.elements.length;e++){let c=t.elements[e],l=c.properties,u=xs(l);Es(l,a,i);for(let e=0;e<c.count;e++){o=Ts(s,l),s+=o[1];let e=o[0];ws(r,c.name,e,u,n)}}return Cs(r,n)}function Os(e){let t=0,n=!0,r=``,i=[],a=new TextDecoder().decode(e.subarray(0,5)),o=/^ply\r\n/.test(a);do{let a=String.fromCharCode(e[t++]);a!==`
|
|
831
|
+
`&&a!==`\r`?r+=a:(r===`end_header`&&(n=!1),r!==``&&(i.push(r),r=``))}while(n&&t<e.length);return o===!0&&t++,{headerText:i.join(`\r`)+`\r`,headerLength:t}}var ks=class{constructor(e){this.arr=e,this.i=0}empty(){return this.i>=this.arr.length}next(){return this.arr[this.i++]}},As=Uint8Array,js=Uint16Array,Ms=Int32Array,Ns=new As([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ps=new As([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Fs=new As([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Is=function(e,t){for(var n=new js(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Ms(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Ls=Is(Ns,2),Rs=Ls.b,zs=Ls.r;Rs[28]=258,zs[258]=28;var Bs=Is(Ps,0),Vs=Bs.b;Bs.r;for(var Hs=new js(32768),Us=0;Us<32768;++Us){var Ws=(Us&43690)>>1|(Us&21845)<<1;Ws=(Ws&52428)>>2|(Ws&13107)<<2,Ws=(Ws&61680)>>4|(Ws&3855)<<4,Hs[Us]=((Ws&65280)>>8|(Ws&255)<<8)>>1}for(var Gs=(function(e,t,n){for(var r=e.length,i=0,a=new js(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new js(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new js(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[Hs[d]>>c]=l}else for(s=new js(r),i=0;i<r;++i)e[i]&&(s[i]=Hs[o[e[i]-1]++]>>15-e[i]);return s}),Ks=new As(288),Us=0;Us<144;++Us)Ks[Us]=8;for(var Us=144;Us<256;++Us)Ks[Us]=9;for(var Us=256;Us<280;++Us)Ks[Us]=7;for(var Us=280;Us<288;++Us)Ks[Us]=8;for(var qs=new As(32),Us=0;Us<32;++Us)qs[Us]=5;var Js=Gs(Ks,9,1),Ys=Gs(qs,5,1),Xs=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Zs=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Qs=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},$s=function(e){return(e+7)/8|0},ec=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new As(e.subarray(t,n))},tc=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],nc=function(e,t,n){var r=Error(t||tc[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,nc),!n)throw r;return r},rc=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new As(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new As(i*3));var l=function(e){var t=n.length;if(e>t){var r=new As(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=Zs(e,d,1);var v=Zs(e,d+1,3);if(d+=3,!v){var y=$s(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&nc(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=Js,m=Ys,h=9,g=5;else if(v==2){var S=Zs(e,d,31)+257,C=Zs(e,d+10,15)+4,w=S+Zs(e,d+5,31)+1;d+=14;for(var T=new As(w),E=new As(19),D=0;D<C;++D)E[Fs[D]]=Zs(e,d+D*3,7);d+=C*3;for(var O=Xs(E),k=(1<<O)-1,A=Gs(E,O,1),D=0;D<w;){var j=A[Zs(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+Zs(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+Zs(e,d,7),d+=3):y==18&&(N=11+Zs(e,d,127),d+=7);N--;)T[D++]=M}}var ee=T.subarray(0,S),P=T.subarray(S);h=Xs(ee),g=Xs(P),p=Gs(ee,h,1),m=Gs(P,g,1)}else nc(1);if(d>_){c&&nc(0);break}}s&&l(f+131072);for(var te=(1<<h)-1,ne=(1<<g)-1,re=d;;re=d){var M=p[Qs(e,d)&te],ie=M>>4;if(d+=M&15,d>_){c&&nc(0);break}if(M||nc(2),ie<256)n[f++]=ie;else if(ie==256){re=d,p=null;break}else{var ae=ie-254;if(ie>264){var D=ie-257,oe=Ns[D];ae=Zs(e,d,(1<<oe)-1)+Rs[D],d+=oe}var F=m[Qs(e,d)&ne],se=F>>4;F||nc(3),d+=F&15;var P=Vs[se];if(se>3){var oe=Ps[se];P+=Qs(e,d)&(1<<oe)-1,d+=oe}if(d>_){c&&nc(0);break}s&&l(f+131072);var I=f+ae;if(f<P){var ce=a-P,le=Math.min(P,I);for(ce+f<0&&nc(3);f<le;++f)n[f]=r[ce+f]}for(;f<I;++f)n[f]=n[f-P]}}t.l=p,t.p=re,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?ec(n,0,f):n.subarray(0,f)},ic=new As(0),ac=function(e,t){return e[t]|e[t+1]<<8},oc=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},sc=function(e,t){return oc(e,t)+oc(e,t+4)*4294967296},cc=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&nc(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&nc(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function lc(e,t){return rc(e,{i:2},t&&t.out,t&&t.dictionary)}function uc(e,t){return rc(e.subarray(cc(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var dc=typeof TextDecoder<`u`&&new TextDecoder;try{dc.decode(ic,{stream:!0})}catch(e){}var fc=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:ec(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function pc(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else if(dc)return dc.decode(e);else{var i=fc(e),a=i.s,n=i.r;return n.length&&nc(8),a}}var mc=function(e,t){return t+30+ac(e,t+26)+ac(e,t+28)},hc=function(e,t,n){var r=ac(e,t+28),i=pc(e.subarray(t+46,t+46+r),!(ac(e,t+8)&2048)),a=t+46+r,o=oc(e,t+20),s=n&&o==4294967295?gc(e,a):[o,oc(e,t+24),oc(e,t+42)],c=s[0],l=s[1],u=s[2];return[ac(e,t+10),c,l,i,a+ac(e,t+30)+ac(e,t+32),u]},gc=function(e,t){for(;ac(e,t)!=1;t+=4+ac(e,t+2));return[sc(e,t+12),sc(e,t+4),sc(e,t+20)]};function _c(e,t){for(var n={},r=e.length-22;oc(e,r)!=101010256;--r)(!r||e.length-r>65558)&&nc(13);var i=ac(e,r+8);if(!i)return{};var a=oc(e,r+16),o=a==4294967295||i==65535;if(o){var s=oc(e,r-12);o=oc(e,s)==101075792,o&&(i=oc(e,s+32),a=oc(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=hc(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=mc(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=lc(e.subarray(_,_+f),{out:new As(p)}):nc(14,`unknown compression type `+d):n[m]=ec(e,_,_+f))}return n}function vc(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l=0;return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s).then(e=>(l=e.body.byteLength,e.body))).then(n=>{var r;return yc(n,{light:t.light,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,fetcher:o})}).then(t=>{let n=t.scene,r=t.unitScale/100,i=new c.Matrix4;if(i.makeScale(r,r,r),t.upAxis===`X`)throw Error(`Cannot load fbx x upAxis`);return t.upAxis===`Y`&&i.premultiply(Xn),a===`Y`&&i.premultiply(Zn),n.applyMatrix4(i),{type:`fbx`,modelUpAxis:t.upAxis,upAxis:a,uri:e,byteLength:l,memoryUsage:Ai(n),scene:n,textures:t.textures,animations:t.animations,dispose:()=>t.dispose()}})}function yc(e,t){let n;if(Dc(e))n=new wc().parse(e);else{let t=Rc(e);if(!Oc(t))throw Error(`THREE.FBXLoader: Unknown format.`);if(kc(t)<7e3)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+kc(t));n=new Cc().parse(t)}return new bc(t).parse(n)}var bc=class{constructor(e){var t,n,r;this.light=(t=e.light)==null?!0:t,this.resourcePath=(n=e.resourcePath)==null?``:n,this.search=(r=e.search)==null?``:r,this.fetcher=e.fetcher}parse(e){var t,n,r,i,a,o;let s=this.parseConnections(e),l=Object.assign(new c.Group,{animations:[]}),u=[],d=this.parseImages(e),f=this.parseTextures(e,d,s,u),p=this.parseMaterials(e,f,s),m=this.parseDeformers(e,s),h=new xc().parse(e,m,s);this.parseScene(e,m,h,p,s,l);let g=(n=(t=e.GlobalSettings.UpAxis)==null?void 0:t.value)==null?1:n,_=(i=(r=e.GlobalSettings.FrontAxis)==null?void 0:r.value)==null?2:i,v=(o=(a=e.GlobalSettings.UnitScaleFactor)==null?void 0:a.value)==null?1:o,y;if(e.GlobalSettings.AmbientColor){let t=e.GlobalSettings.AmbientColor.value,n=t[0],r=t[1],i=t[2];if(n!==0||r!==0||i!==0){let e=new c.Color().setRGB(n,r,i);y=new c.AmbientLight(e,1)}}return Promise.all(u).then(e=>{var t;return{scene:l,textures:e,ambientLight:y,upAxis:[`X`,`Y`,`Z`][g],frontAxis:[`X`,`Y`,`Z`][_],unitScale:v,animations:(t=l.animations)==null?[]:t,dispose:()=>{e.forEach(e=>e.dispose()),p.forEach(e=>e.dispose()),h.forEach(e=>e.dispose())}}})}parseConnections(e){let t=new Map;return`Connections`in e&&e.Connections.connections.forEach(function(e){let n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});let a={ID:r,relationship:i};t.get(n).parents.push(a),t.has(r)||t.set(r,{parents:[],children:[]});let o={ID:n,relationship:i};t.get(r).children.push(o)}),t}parseImages(e){let t={},n={};if(`Video`in e.Objects){let r=e.Objects.Video;for(let e in r){let i=r[e],a=parseInt(e);if(t[a]=i.RelativeFilename||i.Filename,`Content`in i){let t=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,a=typeof i.Content==`string`&&i.Content!==``;if(t||a){let t=this.parseImage(r[e]);n[i.RelativeFilename||i.Filename]=t}}}}for(let e in t){let r=t[e];n[r]===void 0?t[e]=t[e].split(`\\`).pop():t[e]=n[r]}return t}parseImage(e){let t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(`.`)+1).toLowerCase(),i;switch(r){case`bmp`:i=`image/bmp`;break;case`jpg`:case`jpeg`:i=`image/jpeg`;break;case`png`:i=`image/png`;break;case`tif`:i=`image/tiff`;break;case`tga`:i=`image/tga`;break;default:return}if(typeof t==`string`)return`data:`+i+`;base64,`+t;{let e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:i}))}}parseTextures(e,t,n,r){let i=new Map;if(`Texture`in e.Objects){let a=e.Objects.Texture;for(let e in a){let o=this.parseTexture(a[e],t,n,r);i.set(parseInt(e),o)}}return i}parseTexture(e,t,n,r){let i=this.loadTexture(e,t,n,r);i.ID=e.id,i.name=e.attrName;let a=e.WrapModeU,o=e.WrapModeV,s=a===void 0?0:a.value,l=o===void 0?0:o.value;if(i.wrapS=s===0?c.RepeatWrapping:c.ClampToEdgeWrapping,i.wrapT=l===0?c.RepeatWrapping:c.ClampToEdgeWrapping,e.Scaling){let t=e.Scaling.value;i.repeat.x=t[0],i.repeat.y=t[1]}if(e.Translation){let t=e.Translation.value;i.offset.x=t[0],i.offset.y=t[1]}return i}loadTexture(e,t,n,r){let i=n.get(e.id).children,a=``;i!==void 0&&i.length>0&&t[i[0].ID]!==void 0&&(a=t[i[0].ID]),a=br(this.resourcePath,xr(a,this.search));let o=Object.assign(new c.Texture,{ID:0}),s;s=si()?this.fetcher.ajax(a,{responseType:`blob`}).then(e=>{let t=e.body;return li(t)}):this.fetcher.loadImage(a,{},void 0,void 0,void 0,ci()).then(e=>e.body);let l=s.then(e=>(o.image=e,o.needsUpdate=!0,o)).catch(e=>(console.warn(e),o));return r.push(l),o}parseMaterials(e,t,n){let r=new Map;if(`Material`in e.Objects){let i=e.Objects.Material;for(let a in i){let o=this.parseMaterial(e,i[a],t,n);o!==null&&r.set(parseInt(a),o)}}return r}parseMaterial(e,t,n,r){let i=t.id,a=t.attrName,o=t.ShadingModel;if(typeof o==`object`&&(o=o.value),o=o.toLowerCase(),!r.has(i))return null;let s=new vn(this.light?`phong`:`basic`);s.name=a,t.BumpFactor&&(s.bumpScale=t.BumpFactor.value),t.Diffuse?s.color=new c.Color().fromArray(t.Diffuse.value):t.DiffuseColor&&(t.DiffuseColor.type===`Color`||t.DiffuseColor.type===`ColorRGB`)&&(s.color=new c.Color().fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(s.displacementScale=t.DisplacementFactor.value),t.Emissive?s.emissive=new c.Color().fromArray(t.Emissive.value):t.EmissiveColor&&(t.EmissiveColor.type===`Color`||t.EmissiveColor.type===`ColorRGB`)&&(s.emissive=new c.Color().fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(s.emissiveIntensity=parseFloat(t.EmissiveFactor.value));let l=1-(t.TransparencyFactor?parseFloat(t.TransparencyFactor.value):0);(l===1||l===0)&&(l=t.Opacity?parseFloat(t.Opacity.value):null,l===null&&(l=1-(t.TransparentColor?parseFloat(t.TransparentColor.value[0]):0))),s.opacity=l,s.opacity<1&&(s.transparent=!0),t.ReflectionFactor&&(s.reflectivity=t.ReflectionFactor.value),t.Shininess&&(s.shininess=t.Shininess.value),t.Specular?s.specular=new c.Color().fromArray(t.Specular.value):t.SpecularColor&&t.SpecularColor.type===`Color`&&(s.specular=new c.Color().fromArray(t.SpecularColor.value));let u=this;return r.get(i).children.forEach(function(t){let i=t.relationship;switch(i){case`Bump`:s.bumpMap=u.getTexture(e,n,t.ID,r);break;case`Maya|TEX_ao_map`:s.aoMap=u.getTexture(e,n,t.ID,r);break;case`DiffuseColor`:case`Maya|TEX_color_map`:s.map=u.getTexture(e,n,t.ID,r),s.map!==void 0&&(s.map.encoding=c.sRGBEncoding);break;case`DisplacementColor`:s.displacementMap=u.getTexture(e,n,t.ID,r);break;case`EmissiveColor`:s.emissiveMap=u.getTexture(e,n,t.ID,r),s.emissiveMap!==void 0&&(s.emissiveMap.encoding=c.sRGBEncoding);break;case`NormalMap`:case`Maya|TEX_normal_map`:s.normalMap=u.getTexture(e,n,t.ID,r);break;case`ReflectionColor`:s.envMap=u.getTexture(e,n,t.ID,r),s.envMap!==void 0&&(s.envMap.mapping=c.EquirectangularReflectionMapping,s.envMap.encoding=c.sRGBEncoding);break;case`SpecularColor`:s.specularMap=u.getTexture(e,n,t.ID,r),s.specularMap!==void 0&&(s.specularMap.encoding=c.sRGBEncoding);break;case`TransparentColor`:case`TransparencyFactor`:s.alphaMap=u.getTexture(e,n,t.ID,r),s.transparent=!0;break;default:console.warn(`THREE.FBXLoader: %s map is not supported in three.js, skipping texture.`,i);break}}),s}getTexture(e,t,n,r){return e.Objects.LayeredTexture&&n in e.Objects.LayeredTexture&&(console.warn(`THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.`),n=r.get(n).children[0].ID),t.get(n)}parseDeformers(e,t){let n={},r={};if(`Deformer`in e.Objects){let i=e.Objects.Deformer;for(let e in i){let a=i[e],o=t.get(parseInt(e));if(a.attrType===`Skin`){let t=this.parseSkeleton(o,i);t.ID=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: skeleton attached to more than one geometry is not supported.`),t.geometryID=o.parents[0].ID,n[e]=t}else if(a.attrType===`BlendShape`){let n={id:e};n.rawTargets=this.parseMorphTargets(o,i,t),n.id=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: morph target attached to more than one geometry is not supported.`),r[e]=n}}}return{skeletons:n,morphTargets:r}}parseSkeleton(e,t){let n=[];return e.children.forEach(function(e){let r=t[e.ID];if(r.attrType!==`Cluster`)return;let i={ID:e.ID,indices:[],weights:[],transformLink:new c.Matrix4().fromArray(r.TransformLink.a)};r.Indexes&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}),{ID:``,geometryID:0,rawBones:n,bones:[]}}parseMorphTargets(e,t,n){let r=[];for(let i=0;i<e.children.length;i++){let a=e.children[i],o=t[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a,geoID:0};if(o.attrType!==`BlendShapeChannel`)return;s.geoID=n.get(parseInt(a.ID)).children.filter(function(e){return e.relationship===void 0})[0].ID,r.push(s)}return r}parseScene(e,t,n,r,i,a){let o=this.parseModels(e,t.skeletons,n,r,i),s=e.Objects.Model,l=this;o.forEach(function(t){let n=s[t.ID];l.setLookAtProperties(e,t,n,i,a),i.get(t.ID).parents.forEach(function(e){let n=o.get(e.ID);n!==void 0&&n.add(t)}),t.parent===null&&a.add(t)}),this.bindSkeleton(e,t.skeletons,n,o,i),a.traverse(function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);let t=Fc(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix(!0,!0)}});let u=new Sc().parse(e,i,a);a.children.length===1&&a.children[0]instanceof c.Group&&(a=a.children[0]),a.animations=u}parseModels(e,t,n,r,i){let a=new Map,o=e.Objects.Model;for(let s in o){let l=parseInt(s),u=o[s],d=i.get(l),f=this.buildSkeleton(d,t,l,u.attrName);if(!f){switch(u.attrType){case`Camera`:f=this.createCamera(e,d);break;case`Light`:f=this.createLight(e,d);break;case`Mesh`:f=this.createMesh(d,n,r);break;case`NurbsCurve`:case`LimbNode`:case`Root`:f=new c.Bone;break;default:f=new c.Group;break}f.name=u.attrName?c.PropertyBinding.sanitizeNodeName(u.attrName):``,f.userData.originalName=u.attrName,f.ID=l}this.getTransformData(f,u),a.set(l,f)}return a}buildSkeleton(e,t,n,r){let i=null;return e.parents.forEach(function(e){for(let a in t){let o=t[a];o.rawBones.forEach(function(t,a){if(t.ID===e.ID){let e=i;i=new c.Bone,i.matrixWorld.copy(t.transformLink),i.name=r?c.PropertyBinding.sanitizeNodeName(r):``,i.userData.originalName=r,i.ID=n,o.bones[a]=i,e!==null&&i.add(e)}})}}),i}createCamera(e,t){let n,r;if(t.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(r=n)}),r===void 0)n=new c.Object3D;else{let e=0;r.CameraProjectionType!==void 0&&r.CameraProjectionType.value===1&&(e=1);let t=1;r.NearPlane!==void 0&&(t=r.NearPlane.value/1e3);let i=1e3;r.FarPlane!==void 0&&(i=r.FarPlane.value/1e3);let a=window.innerWidth,o=window.innerHeight;r.AspectWidth!==void 0&&r.AspectHeight!==void 0&&(a=r.AspectWidth.value,o=r.AspectHeight.value);let s=a/o,l=45;r.FieldOfView!==void 0&&(l=r.FieldOfView.value);let u=r.FocalLength?r.FocalLength.value:null;switch(e){case 0:n=new c.PerspectiveCamera(l,s,t,i),u!==null&&n.setFocalLength(u);break;case 1:console.warn(`THREE.FBXLoader: Orthographic cameras not supported yet.`),n=new c.Object3D;break;default:console.warn(`THREE.FBXLoader: Unknown camera type `+e+`.`),n=new c.Object3D;break}}return n}createLight(e,t){let n,r;if(t.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(r=n)}),r===void 0)n=new c.Object3D;else{let e;e=r.LightType===void 0?0:r.LightType.value;let t=new c.Color(16777215);r.Color!==void 0&&(t=new c.Color().fromArray(r.Color.value));let i=r.Intensity===void 0?1:r.Intensity.value/100;r.CastLightOnObject!==void 0&&r.CastLightOnObject.value===0&&(i=0);let a=0;switch(r.FarAttenuationEnd!==void 0&&(a=r.EnableFarAttenuation!==void 0&&r.EnableFarAttenuation.value===0?0:r.FarAttenuationEnd.value),e){case 0:n=new c.PointLight(t,i,a,1);break;case 1:n=new c.DirectionalLight(t,i);break;case 2:let e=Math.PI/3;r.InnerAngle!==void 0&&(e=c.MathUtils.degToRad(r.InnerAngle.value));let o=0;r.OuterAngle!==void 0&&(o=c.MathUtils.degToRad(r.OuterAngle.value),o=Math.max(o,1)),n=new c.SpotLight(t,i,a,e,o,1);break;default:console.warn(`THREE.FBXLoader: Unknown light type `+r.LightType.value+`, defaulting to a PointLight.`),n=new c.PointLight(t,i);break}r.CastShadows!==void 0&&r.CastShadows.value===1&&(n.castShadow=!0)}return n}createMesh(e,t,n){let r,i=null,a=[];if(e.children.forEach(function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&a.push(n.get(e.ID))}),a.length===0){let e=new vn(this.light?`phong`:`basic`);e.color=new c.Color(13421772),a.push(e)}return`color`in i.attributes&&a.forEach(function(e){e.vertexColors=!0}),(!i.groups||i.groups.length===0)&&i.addGroup(0,i.index?i.index.count:i.attributes.position.count,0),i.FBX_Deformer?(a.forEach(function(e){e.skinning=!0}),r=new bn(i,a),r.normalizeSkinWeights()):r=new yn(i,a),r}createCurve(e,t){let n=e.children.reduce(function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e},null),r=new c.LineBasicMaterial({name:``,color:3342591,linewidth:1});return new c.Line(n,r)}getTransformData(e,t){let n={};t.InheritType&&(n.inheritType=parseInt(t.InheritType.value)),t.RotationOrder?n.eulerOrder=Ic(t.RotationOrder.value):n.eulerOrder=Ic(0),t.Lcl_Translation&&(n.translation=t.Lcl_Translation.value),t.PreRotation&&(n.preRotation=t.PreRotation.value),t.Lcl_Rotation&&(n.rotation=t.Lcl_Rotation.value),t.PostRotation&&(n.postRotation=t.PostRotation.value),t.Lcl_Scaling&&(n.scale=t.Lcl_Scaling.value),t.ScalingOffset&&(n.scalingOffset=t.ScalingOffset.value),t.ScalingPivot&&(n.scalingPivot=t.ScalingPivot.value),t.RotationOffset&&(n.rotationOffset=t.RotationOffset.value),t.RotationPivot&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t,n,r,i){`LookAtProperty`in n&&r.get(t.ID).children.forEach(function(n){if(n.relationship===`LookAtProperty`){let r=e.Objects.Model[n.ID];if(r.Lcl_Translation){let e=r.Lcl_Translation.value;`target`in t&&t.target instanceof c.Object3D?(t.target.position.fromArray(e),i.add(t.target)):t.lookAt(new c.Vector3().fromArray(e))}}})}bindSkeleton(e,t,n,r,i){let a=this.parsePoseNodes(e);for(let e in t){let o=t[e];i.get(parseInt(o.ID)).parents.forEach(function(e){if(n.has(e.ID)){let t=e.ID;i.get(t).parents.forEach(function(e){if(r.has(e.ID)){let t=r.get(e.ID);t instanceof c.SkinnedMesh&&t.bind(new c.Skeleton(o.bones),a[e.ID])}})}})}}parsePoseNodes(e){let t={};if(e.Objects.Pose){let n=e.Objects.Pose;for(let e in n)if(n[e].attrType===`BindPose`&&n[e].NbPoseNodes>0){let r=n[e].PoseNode;Array.isArray(r)?r.forEach(function(e){t[e.Node]=new c.Matrix4().fromArray(e.Matrix.a)}):t[r.Node]=new c.Matrix4().fromArray(r.Matrix.a)}}return t}},xc=class{constructor(){this.negativeMaterialIndices=!1}parse(e,t,n){let r=new Map;if(`Geometry`in e.Objects){let i=e.Objects.Geometry;for(let a in i){let o=n.get(parseInt(a)),s=this.parseGeometry(e,o,i[a],t);r.set(parseInt(a),s)}}return this.negativeMaterialIndices===!0&&console.warn(`THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected.`),r}parseGeometry(e,t,n,r){switch(n.attrType){case`Mesh`:return this.parseMeshGeometry(e,t,n,r);case`NurbsCurve`:return this.parseNurbsGeometry(n)}}parseMeshGeometry(e,t,n,r){let i=r.skeletons,a=[],o=t.parents.map(function(t){return e.Objects.Model[t.ID]});if(o.length===0)return;let s=t.children.reduce(function(e,t){return i[t.ID]!==void 0&&(e=i[t.ID]),e},null);t.children.forEach(function(e){r.morphTargets[e.ID]!==void 0&&a.push(r.morphTargets[e.ID])});let c=o[0],l={};c.RotationOrder&&(l.eulerOrder=Ic(c.RotationOrder.value)),c.InheritType&&(l.inheritType=parseInt(c.InheritType.value)),c.GeometricTranslation&&(l.translation=c.GeometricTranslation.value),c.GeometricRotation&&(l.rotation=c.GeometricRotation.value),c.GeometricScaling&&(l.scale=c.GeometricScaling.value);let u=Fc(l);return this.genGeometry(e,n,s,a,u)}genGeometry(e,t,n,r,i){let a=new c.BufferGeometry;t.attrName&&(a.name=t.attrName);let o=this.parseGeoNode(t,n),s=this.genBuffers(o),l=new c.Float32BufferAttribute(s.vertex,3);if(l.applyMatrix4(i),a.setAttribute(`position`,l),s.colors.length>0&&a.setAttribute(`color`,new c.Float32BufferAttribute(s.colors,3)),n&&(a.setAttribute(`skinIndex`,new c.Uint16BufferAttribute(s.weightsIndices,4)),a.setAttribute(`skinWeight`,new c.Float32BufferAttribute(s.vertexWeights,4)),a.FBX_Deformer=n),s.normal.length>0){let e=new c.Matrix3().getNormalMatrix(i),t=new c.Float32BufferAttribute(s.normal,3);t.applyNormalMatrix(e),a.setAttribute(`normal`,t)}if(s.uvs.forEach(function(e,t){let n=t===0?`uv`:`uv${t+1}`;a.setAttribute(n,new c.Float32BufferAttribute(s.uvs[t],2))}),o.material&&o.material.mappingType!==`AllSame`){let e=s.materialIndex[0],t=0;if(s.materialIndex.forEach(function(n,r){n!==e&&(a.addGroup(t,r-t,e),e=n,t=r)}),a.groups.length>0){let t=a.groups[a.groups.length-1],n=t.start+t.count;n!==s.materialIndex.length&&a.addGroup(n,s.materialIndex.length-n,e)}a.groups.length===0&&a.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(e,a,t,r,i),a}parseGeoNode(e,t){let n={};if(n.vertexPositions=e.Vertices===void 0?[]:e.Vertices.a,n.vertexIndices=e.PolygonVertexIndex===void 0?[]:e.PolygonVertexIndex.a,e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(r,i){n.weightTable[r]===void 0&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],o=[],s=[],c=[],l=[],u=[],d=this;return e.vertexIndices.forEach(function(f,p){let m=0,h=!1;f<0&&(f^=-1,h=!0);let g=[],_=[];if(a.push(f*3,f*3+1,f*3+2),e.color){let t=Mc(p,n,f,e.color);s.push(t[0],t[1],t[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(e){_.push(e.weight),g.push(e.id)}),_.length>4){i||(console.warn(`THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.`),i=!0);let e=[0,0,0,0],t=[0,0,0,0];_.forEach(function(n,r){let i=n,a=g[r];t.forEach(function(t,n,r){if(i>t){r[n]=i,i=t;let o=e[n];e[n]=a,a=o}})}),g=e,_=t}for(;_.length<4;)_.push(0),g.push(0);for(let e=0;e<4;++e)l.push(_[e]),u.push(g[e])}if(e.normal){let t=Mc(p,n,f,e.normal);o.push(t[0],t[1],t[2])}e.material&&e.material.mappingType!==`AllSame`&&(m=Mc(p,n,f,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(e,t){let r=Mc(p,n,f,e);c[t]===void 0&&(c[t]=[]),c[t].push(r[0]),c[t].push(r[1])}),r++,h&&(d.genFace(t,e,a,m,o,s,c,l,u,r),n++,r=0,a=[],o=[],s=[],c=[],l=[],u=[])}),t}getNormalNewell(e){let t=new c.Vector3(0,0,0);for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t.x+=(r.y-i.y)*(r.z+i.z),t.y+=(r.z-i.z)*(r.x+i.x),t.z+=(r.x-i.x)*(r.y+i.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){let t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new c.Vector3(0,1,0):new c.Vector3(0,0,1)).cross(t).normalize();return{normal:t,tangent:n,bitangent:t.clone().cross(n).normalize()}}flattenVertex(e,t,n){return new c.Vector2(e.dot(t),e.dot(n))}genFace(e,t,n,r,i,a,o,s,l,u){let d;if(u>3){let e=[],r=t.baseVertexPositions||t.vertexPositions;for(let t=0;t<n.length;t+=3)e.push(new c.Vector3(r[n[t]],r[n[t+1]],r[n[t+2]]));let{tangent:i,bitangent:a}=this.getNormalTangentAndBitangent(e),o=[];for(let t of e)o.push(this.flattenVertex(t,i,a));d=c.ShapeUtils.triangulateShape(o,[])}else d=[[0,1,2]];for(let[c,u,f]of d)e.vertex.push(t.vertexPositions[n[c*3]]),e.vertex.push(t.vertexPositions[n[c*3+1]]),e.vertex.push(t.vertexPositions[n[c*3+2]]),e.vertex.push(t.vertexPositions[n[u*3]]),e.vertex.push(t.vertexPositions[n[u*3+1]]),e.vertex.push(t.vertexPositions[n[u*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),t.skeleton&&(e.vertexWeights.push(s[c*4]),e.vertexWeights.push(s[c*4+1]),e.vertexWeights.push(s[c*4+2]),e.vertexWeights.push(s[c*4+3]),e.vertexWeights.push(s[u*4]),e.vertexWeights.push(s[u*4+1]),e.vertexWeights.push(s[u*4+2]),e.vertexWeights.push(s[u*4+3]),e.vertexWeights.push(s[f*4]),e.vertexWeights.push(s[f*4+1]),e.vertexWeights.push(s[f*4+2]),e.vertexWeights.push(s[f*4+3]),e.weightsIndices.push(l[c*4]),e.weightsIndices.push(l[c*4+1]),e.weightsIndices.push(l[c*4+2]),e.weightsIndices.push(l[c*4+3]),e.weightsIndices.push(l[u*4]),e.weightsIndices.push(l[u*4+1]),e.weightsIndices.push(l[u*4+2]),e.weightsIndices.push(l[u*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3])),t.color&&(e.colors.push(a[c*3]),e.colors.push(a[c*3+1]),e.colors.push(a[c*3+2]),e.colors.push(a[u*3]),e.colors.push(a[u*3+1]),e.colors.push(a[u*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2])),t.material&&t.material.mappingType!==`AllSame`&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[c*3]),e.normal.push(i[c*3+1]),e.normal.push(i[c*3+2]),e.normal.push(i[u*3]),e.normal.push(i[u*3+1]),e.normal.push(i[u*3+2]),e.normal.push(i[f*3]),e.normal.push(i[f*3+1]),e.normal.push(i[f*3+2])),t.uv&&t.uv.forEach(function(t,n){e.uvs[n]===void 0&&(e.uvs[n]=[]),e.uvs[n].push(o[n][c*2]),e.uvs[n].push(o[n][c*2+1]),e.uvs[n].push(o[n][u*2]),e.uvs[n].push(o[n][u*2+1]),e.uvs[n].push(o[n][f*2]),e.uvs[n].push(o[n][f*2+1])})}addMorphTargets(e,t,n,r,i){if(r.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];let a=this;r.forEach(function(r){r.rawTargets.forEach(function(r){let o=e.Objects.Geometry[r.geoID];o!==void 0&&a.genMorphGeometry(t,n,o,i,r.name)})})}genMorphGeometry(e,t,n,r,i){let a=t.Vertices===void 0?[]:t.Vertices.a,o=t.PolygonVertexIndex===void 0?[]:t.PolygonVertexIndex.a,s=n.Vertices===void 0?[]:n.Vertices.a,l=n.Indexes?n.Indexes.a:[],u=e.attributes.position.count*3,d=new Float32Array(u);for(let e=0;e<l.length;e++){let t=l[e]*3;d[t]=s[e*3],d[t+1]=s[e*3+1],d[t+2]=s[e*3+2]}let f={vertexIndices:o,vertexPositions:d,baseVertexPositions:a},p=this.genBuffers(f),m=new c.Float32BufferAttribute(p.vertex,3);m.name=i||n.attrName,m.applyMatrix4(r),e.morphAttributes.position.push(m)}parseNormals(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return n===`IndexToDirect`&&(e.NormalIndex?i=e.NormalIndex.a:e.NormalsIndex&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}parseUVs(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return n===`IndexToDirect`&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}}parseVertexColors(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];n===`IndexToDirect`&&(i=e.ColorIndex.a);for(let e=0,t=new c.Color;e<r.length;e+=4)t.fromArray(r,e),t.toArray(r,e);return{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}}parseMaterialIndices(e){let t=e.MappingInformationType,n=e.ReferenceInformationType;if(t===`NoMappingInformation`)return{dataSize:1,buffer:[0],indices:[0],mappingType:`AllSame`,referenceType:n};let r=e.Materials.a,i=[];for(let e=0;e<r.length;++e)i.push(e);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}parseNurbsGeometry(e){let t=parseInt(e.Order);if(isNaN(t))return console.error(`THREE.FBXLoader: Invalid Order %s given for geometry ID: %s`,e.Order,e.id),new c.BufferGeometry;let n=t-1,r=e.KnotVector.a,i=[],a=e.Points.a;for(let e=0,t=a.length;e<t;e+=4)i.push(new c.Vector4().fromArray(a,e));let o,s;if(e.Form===`Closed`)i.push(i[0]);else if(e.Form===`Periodic`){o=n,s=r.length-1-o;for(let e=0;e<n;++e)i.push(i[e])}let l=new Vc(n,r,i,o,s).getPoints(i.length*12);return new c.BufferGeometry().setFromPoints(l)}},Sc=class{parse(e,t,n){let r=[],i=this.parseClips(e,t,n);if(i!==void 0)for(let e in i){let t=i[e],a=this.addClip(t,n);r.push(a)}return r}parseClips(e,t,n){if(e.Objects.AnimationCurve===void 0)return;let r=this.parseAnimationCurveNodes(e);this.parseAnimationCurves(e,r,t);let i=this.parseAnimationLayers(e,r,t,n);return this.parseAnimStacks(e,i,t)}parseAnimationCurveNodes(e){let t=e.Objects.AnimationCurveNode,n=new Map;for(let e in t){let r=t[e];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){let e={id:r.id,attr:r.attrName,curves:{}};n.set(e.id,e)}}return n}parseAnimationCurves(e,t,n){let r=e.Objects.AnimationCurve;for(let e in r){let i={id:r[e].id,times:r[e].KeyTime.a.map(Ac),values:r[e].KeyValueFloat.a},a=n.get(i.id);if(a!==void 0){let e=a.parents[0].ID,n=a.parents[0].relationship,r=t.get(e);r&&(n.match(/X/)?r.curves.x=i:n.match(/Y/)?r.curves.y=i:n.match(/Z/)?r.curves.z=i:n.match(/DeformPercent/)&&t.has(e)&&(r.curves.morph=i))}}}parseAnimationLayers(e,t,n,r){let i=e.Objects.AnimationLayer,a=new Map;for(let o in i){let i=[],s=n.get(parseInt(o));s!==void 0&&(s.children.forEach((a,o)=>{if(t.has(a.ID)){let s=t.get(a.ID);if(s.curves.x!==void 0||s.curves.y!==void 0||s.curves.z!==void 0){if(i[o]===void 0){let t=n.get(a.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID;if(t!==void 0){let n=e.Objects.Model[t.toString()];if(n===void 0){console.warn(`THREE.FBXLoader: Encountered a unused curve.`,a);return}let s={modelName:n.attrName?c.PropertyBinding.sanitizeNodeName(n.attrName):``,ID:n.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new c.Matrix4,eulerOrder:``,preRotation:[0,0,0],postRotation:[0,0,0]};r.traverse(function(e){e.ID===n.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))}),s.transform||(s.transform=new c.Matrix4),n.PreRotation&&(s.preRotation=n.PreRotation.value),n.PostRotation&&(s.postRotation=n.PostRotation.value),i[o]=s}}i[o]&&(i[o][s.attr]=s)}else if(s.curves.morph!==void 0){if(i[o]===void 0){let t=n.get(a.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID,r=n.get(t).parents[0].ID,s=n.get(r).parents[0].ID,l=n.get(s).parents[0].ID,u=e.Objects.Model[l];i[o]={modelName:u.attrName?c.PropertyBinding.sanitizeNodeName(u.attrName):``,morphName:e.Objects.Deformer[t].attrName}}i[o][s.attr]=s}}}),a.set(parseInt(o),i))}return a}parseAnimStacks(e,t,n){let r=e.Objects.AnimationStack,i={};for(let e in r){let a=n.get(parseInt(e)).children;a.length>1&&console.warn(`THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.`);let o=t.get(a[0].ID);i[e]={name:r[e].attrName,layer:o}}return i}addClip(e,t){let n=[],r=this;return e.layer.forEach(function(e){n=n.concat(r.generateTracks(e,t))}),new c.AnimationClip(e.name,-1,n)}generateTracks(e,t){let n=[],r=new c.Vector3,i=new c.Vector3;e.transform&&e.transform.decompose(r,new c.Quaternion,i);let a=r.toArray(),o=i.toArray();if(e.T!==void 0&&Object.keys(e.T.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.T.curves,a,`position`);t!==void 0&&n.push(t)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let t=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);t!==void 0&&n.push(t)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.S.curves,o,`scale`);t!==void 0&&n.push(t)}if(e.DeformPercent!==void 0){let r=this.generateMorphTrack(e,t);r!==void 0&&n.push(r)}return n}generateVectorTrack(e,t,n,r){let i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new c.VectorKeyframeTrack(e+`.`+r,i,a)}generateRotationTrack(e,t,n,r,i){let a,o;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){let e=this.interpolateRotations(t.x,t.y,t.z,i);a=e[0],o=e[1]}let s=Ic(0),l=new c.Quaternion,u=new c.Quaternion;n!==void 0&&(n=n.map(c.MathUtils.degToRad),n.push(s),l.setFromEuler(new c.Euler().fromArray(n))),r!==void 0&&(r=r.map(c.MathUtils.degToRad),r.push(s),u.setFromEuler(new c.Euler().fromArray(r)),u.inverse());let d=new c.Quaternion,f=new c.Euler,p=[];if(!o||!a)return new c.QuaternionKeyframeTrack(e+`.quaternion`,[0],[0]);for(let e=0;e<o.length;e+=3)f.set(o[e],o[e+1],o[e+2],i),d.setFromEuler(f),d.premultiply(l),d.multiply(u),e>2&&new c.Quaternion().fromArray(p,(e-3)/3*4).dot(d)<0&&d.set(-d.x,-d.y,-d.z,-d.w),d.toArray(p,e/3*4);return new c.QuaternionKeyframeTrack(e+`.quaternion`,a,p)}generateMorphTrack(e,t){let n=e.DeformPercent.curves.morph,r=n.values.map(function(e){return e/100}),i=t.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new c.NumberKeyframeTrack(e.modelName+`.morphTargetInfluences[`+i+`]`,n.times,r)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(e,t){return e-t}),t.length>1){let e=1,n=t[0];for(let r=1;r<t.length;r++){let i=t[r];i!==n&&(t[e]=i,n=i,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){let r=n,i=[],a=-1,o=-1,s=-1;return e.forEach(function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),a!==-1){let e=t.x.values[a];i.push(e),r[0]=e}else i.push(r[0]);if(o!==-1){let e=t.y.values[o];i.push(e),r[1]=e}else i.push(r[1]);if(s!==-1){let e=t.z.values[s];i.push(e),r[2]=e}else i.push(r[2])}),i}interpolateRotations(e,t,n,r){let i=[],a=[];i.push(e.times[0]),a.push(c.MathUtils.degToRad(e.values[0])),a.push(c.MathUtils.degToRad(t.values[0])),a.push(c.MathUtils.degToRad(n.values[0]));for(let o=1;o<e.values.length;o++){let s=[e.values[o-1],t.values[o-1],n.values[o-1]];if(isNaN(s[0])||isNaN(s[1])||isNaN(s[2]))continue;let l=s.map(c.MathUtils.degToRad),u=[e.values[o],t.values[o],n.values[o]];if(isNaN(u[0])||isNaN(u[1])||isNaN(u[2]))continue;u.map(c.MathUtils.degToRad);let d=[u[0]-s[0],u[1]-s[1],u[2]-s[2]],f=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){let t=Math.max(...f)/180,n=new c.Euler(l[0],l[1],l[2],r),s=new c.Euler(l[0],l[1],l[2],r),u=new c.Quaternion().setFromEuler(n),d=new c.Quaternion().setFromEuler(s);u.dot(d)&&d.set(-d.x,-d.y,-d.z,-d.w);let p=e.times[o-1],m=e.times[o]-p,h=new c.Quaternion,g=new c.Euler;for(let e=0;e<1;e+=1/t)h.copy(u.clone().slerp(d.clone(),e)),i.push(p+e*m),g.setFromQuaternion(h,r),a.push(g.x),a.push(g.y),a.push(g.z)}else i.push(e.times[o]),a.push(c.MathUtils.degToRad(e.values[o])),a.push(c.MathUtils.degToRad(t.values[o])),a.push(c.MathUtils.degToRad(n.values[o]))}return[i,a]}},Cc=class{constructor(){this.allNodes=new Ec,this.nodeStack=[],this.currentIndent=0,this.currentPropName=``}getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),--this.currentIndent}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Ec,this.nodeStack=[],this.currentProp=[],this.currentPropName=``;let t=this,n=e.split(/[\r\n]+/);return n.forEach(function(e,r){let i=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(i||a)return;let o=e.match(`^\\t{`+t.currentIndent+`}(\\w+):(.*){`),s=e.match(`^\\t{`+t.currentIndent+`}(\\w+):[\\s\\t\\r\\n](.*)`),c=e.match(`^\\t{`+(t.currentIndent-1)+`}}`);o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++r]):c?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}),this.allNodes}parseNodeBegin(e,t){let n=t[1].trim().replace(/^"/,``).replace(/"$/,``),r=t[2].split(`,`).map(function(e){return e.trim().replace(/^"/,``).replace(/"$/,``)}),i={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,i):n in o?(n===`PoseNode`?o.PoseNode.push(i):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==``&&(o[n][a.id]=i)):typeof a.id==`number`?(o[n]={},o[n][a.id]=i):n!==`Properties70`&&(n===`PoseNode`?o[n]=[i]:o[n]=i),typeof a.id==`number`&&(i.id=a.id),a.name!==``&&(i.attrName=a.name),a.type!==``&&(i.attrType=a.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==``&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n=``,r=``;return e.length>1&&(n=e[1].replace(/^(\w+)::/,``),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,``).replace(/"$/,``).trim(),i=t[2].replace(/^"/,``).replace(/"$/,``).trim();r===`Content`&&i===`,`&&(i=n.replace(/"/g,``).replace(/,$/,``).trim());let a=this.getCurrentNode();if(a.name===`Properties70`){this.parseNodeSpecialProperty(e,r,i);return}if(r===`C`){let e=i.split(`,`).slice(1),t=parseInt(e[0]),n=parseInt(e[1]),o=i.split(`,`).slice(3);o=o.map(function(e){return e.trim().replace(/^"/,``)}),r=`connections`,i=[t,n],zc(i,o),a[r]===void 0&&(a[r]=[])}r===`Node`&&(a.id=i),r in a&&Array.isArray(a[r])?a[r].push(i):r===`a`?a.a=i:a[r]=i,this.setCurrentProp(a,r),r===`a`&&i.slice(-1)!==`,`&&(a.a=Lc(i))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==`,`&&(t.a=Lc(t.a))}parseNodeSpecialProperty(e,t,n){let r=n.split(`",`).map(function(e){return e.trim().replace(/^\"/,``).replace(/\s/,`_`)}),i=r[0],a=r[1],o=r[2],s=r[3],c=r[4];switch(a){case`int`:case`enum`:case`bool`:case`ULongLong`:case`double`:case`Number`:case`FieldOfView`:c=parseFloat(c);break;case`Color`:case`ColorRGB`:case`Vector3D`:case`Lcl_Translation`:case`Lcl_Rotation`:case`Lcl_Scaling`:c=Lc(c);break}this.getPrevNode()[i]={type:a,type2:o,flag:s,value:c},this.setCurrentProp(this.getPrevNode(),i)}},wc=class{parse(e){let t=new Tc(e);t.skip(23);let n=t.getUint32();if(n<6400)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+n);let r=new Ec;for(;!this.endOfContent(t);){let e=this.parseNode(t,n);e!==null&&r.add(e.name,e)}return r}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let a=e.getUint8(),o=e.getString(a);if(r===0)return null;let s=[];for(let t=0;t<i;t++)s.push(this.parseProperty(e));let c=s.length>0?s[0]:``,l=s.length>1?s[1]:``,u=s.length>2?s[2]:``;for(n.singleProperty=i===1&&e.getOffset()===r;r>e.getOffset();){let r=this.parseNode(e,t);r!==null&&this.parseSubNode(o,n,r)}return n.propertyList=s,typeof c==`number`&&(n.id=c),l!==``&&(n.attrName=l),u!==``&&(n.attrType=u),o!==``&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){let e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if(e===`Connections`&&n.name===`C`){let e=[];n.propertyList.forEach(function(t,n){n!==0&&e.push(t)}),t.connections===void 0&&(t.connections=[]),t.connections.push(e)}else if(n.name===`Properties70`)Object.keys(n).forEach(function(e){t[e]=n[e]});else if(e===`Properties70`&&n.name===`P`){let e=n.propertyList[0],r=n.propertyList[1],i=n.propertyList[2],a=n.propertyList[3],o;e.indexOf(`Lcl `)===0&&(e=e.replace(`Lcl `,`Lcl_`)),r.indexOf(`Lcl `)===0&&(r=r.replace(`Lcl `,`Lcl_`)),o=r===`Color`||r===`ColorRGB`||r===`Vector`||r===`Vector3D`||r.indexOf(`Lcl_`)===0?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[e]={type:r,type2:i,flag:a,value:o}}else t[n.name]===void 0?typeof n.id==`number`?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name===`PoseNode`?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){let t=e.getString(1),n;switch(t){case`C`:return e.getBoolean();case`D`:return e.getFloat64();case`F`:return e.getFloat32();case`I`:return e.getInt32();case`L`:return e.getInt64();case`R`:return n=e.getUint32(),e.getArrayBuffer(n);case`S`:return n=e.getUint32(),e.getString(n);case`Y`:return e.getInt16();case`b`:case`c`:case`d`:case`f`:case`i`:case`l`:let r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(i===0)switch(t){case`b`:case`c`:return e.getBooleanArray(r);case`d`:return e.getFloat64Array(r);case`f`:return e.getFloat32Array(r);case`i`:return e.getInt32Array(r);case`l`:return e.getInt64Array(r)}let o=new Tc(uc(new Uint8Array(e.getArrayBuffer(a))).buffer);switch(t){case`b`:case`c`:return o.getBooleanArray(r);case`d`:return o.getFloat64Array(r);case`f`:return o.getFloat32Array(r);case`i`:return o.getInt32Array(r);case`l`:return o.getInt64Array(r)}break;default:throw Error(`THREE.FBXLoader: Unknown property type `+t)}}},Tc=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t===void 0?!0:t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)==1}getBooleanArray(e){let t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){let e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){let e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){let e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){let e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){let e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){let t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);let r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}},Ec=class{constructor(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}add(e,t){this[e]=t}};function Dc(e){return e.byteLength>=21&&Rc(e,0,21)===`Kaydara FBX Binary \0`}function Oc(e){let t=[`K`,`a`,`y`,`d`,`a`,`r`,`a`,`\\`,`F`,`B`,`X`,`\\`,`B`,`i`,`n`,`a`,`r`,`y`,`\\`,`\\`],n=0;function r(t){let r=e[t-1];return e=e.slice(n+t),n++,r}for(let e=0;e<t.length;++e)if(r(1)===t[e])return!1;return!0}function kc(e){let t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw Error(`THREE.FBXLoader: Cannot find the version number for the file given.`)}function Ac(e){return e/46186158e3}var jc=[];function Mc(e,t,n,r){let i;switch(r.mappingType){case`ByPolygonVertex`:i=e;break;case`ByPolygon`:i=t;break;case`ByVertice`:i=n;break;case`AllSame`:i=r.indices[0];break;default:console.warn(`THREE.FBXLoader: unknown attribute mapping type `+r.mappingType),i=0}r.referenceType===`IndexToDirect`&&(i=r.indices[i]);let a=i*r.dataSize,o=a+r.dataSize;return Bc(jc,r.buffer,a,o)}var Nc=new c.Euler,Pc=new c.Vector3;function Fc(e){let t=new c.Matrix4,n=new c.Matrix4,r=new c.Matrix4,i=new c.Matrix4,a=new c.Matrix4,o=new c.Matrix4,s=new c.Matrix4,l=new c.Matrix4,u=new c.Matrix4,d=new c.Matrix4,f=new c.Matrix4,p=new c.Matrix4,m=e.inheritType?e.inheritType:0;e.translation&&t.setPosition(Pc.fromArray(e.translation));let h=Ic(0);if(e.preRotation){let t=e.preRotation.map(c.MathUtils.degToRad);t.push(h),n.makeRotationFromEuler(Nc.fromArray(t))}if(e.rotation){let t=e.rotation.map(c.MathUtils.degToRad);t.push(e.eulerOrder||h),r.makeRotationFromEuler(Nc.fromArray(t))}if(e.postRotation){let t=e.postRotation.map(c.MathUtils.degToRad);t.push(h),i.makeRotationFromEuler(Nc.fromArray(t)),i.copy(new c.Matrix4().getInverse(i))}e.scale&&a.scale(Pc.fromArray(e.scale)),e.scalingOffset&&s.setPosition(Pc.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(Pc.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(Pc.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(Pc.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(f.copy(e.parentMatrix),d.copy(e.parentMatrixWorld));let g=n.clone().multiply(r).multiply(i),_=new c.Matrix4;_.extractRotation(d);let v=new c.Matrix4;v.copyPosition(d);let y=new c.Matrix4().getInverse(v).multiply(d),b=new c.Matrix4().getInverse(_).multiply(y),x=a,S=new c.Matrix4;if(m===0)S.copy(_).multiply(g).multiply(b).multiply(x);else if(m===1)S.copy(_).multiply(b).multiply(g).multiply(x);else{let e=new c.Matrix4().scale(new c.Vector3().setFromMatrixScale(f)),t=new c.Matrix4().getInverse(e),n=b.clone().multiply(t);S.copy(_).multiply(g).multiply(n).multiply(x)}let C=new c.Matrix4().getInverse(u),w=new c.Matrix4().getInverse(o),T=t.clone().multiply(l).multiply(u).multiply(n).multiply(r).multiply(i).multiply(C).multiply(s).multiply(o).multiply(a).multiply(w),E=new c.Matrix4().copyPosition(T),D=d.clone().multiply(E);return p.copyPosition(D),T=p.clone().multiply(S),T.premultiply(new c.Matrix4().getInverse(d)),T}function Ic(e){e=e||0;let t=[`ZYX`,`YZX`,`XZY`,`ZXY`,`YXZ`,`XYZ`];return e===6?(console.warn(`THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.`),t[0]):t[e]}function Lc(e){return e.split(`,`).map(function(e){return parseFloat(e)})}function Rc(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),new TextDecoder().decode(new Uint8Array(e,t,n))}function zc(e,t){for(let n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}function Bc(e,t,n,r){for(let i=n,a=0;i<r;i++,a++)e[a]=t[i];return e}var Vc=class extends c.Curve{constructor(e,t,n,r,i){super();let a=t?t.length-1:0,o=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||a;for(let e=0;e<o;++e){let t=n[e];this.controlPoints[e]=new c.Vector4(t.x,t.y,t.z,t.w)}}getPoint(e,t=new c.Vector3){let n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=Wc(this.degree,this.knots,this.controlPoints,r);return i.w!==1&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}getTangent(e,t=new c.Vector3){let n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Yc(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n}toJSON(){let e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(e=>e.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(e=>new c.Vector4(e[0],e[1],e[2],e[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}};function Hc(e,t,n){let r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;let i=e,a=r,o=Math.floor((i+a)/2);for(;t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function Uc(e,t,n,r){let i=[],a=[],o=[];i[0]=1;for(let s=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[e+s]-t;let n=0;for(let e=0;e<s;++e){let t=o[e+1],r=a[s-e],c=i[e]/(t+r);i[e]=n+t*c,n=r*c}i[s]=n}return i}function Wc(e,t,n,r){let i=Hc(e,r,t),a=Uc(i,r,e,t),o=new c.Vector4(0,0,0,0);for(let t=0;t<=e;++t){let r=n[i-e+t],s=a[t],c=r.w*s;o.x+=r.x*c,o.y+=r.y*c,o.z+=r.z*c,o.w+=r.w*s}return o}function Gc(e,t,n,r,i){let a=[];for(let e=0;e<=n;++e)a[e]=0;let o=[];for(let e=0;e<=r;++e)o[e]=a.slice(0);let s=[];for(let e=0;e<=n;++e)s[e]=a.slice(0);s[0][0]=1;let c=a.slice(0),l=a.slice(0);for(let r=1;r<=n;++r){c[r]=t-i[e+1-r],l[r]=i[e+r]-t;let n=0;for(let e=0;e<r;++e){let t=l[e+1],i=c[r-e];s[r][e]=t+i;let a=s[e][r-1]/s[r][e];s[e][r]=n+t*a,n=i*a}s[r][r]=n}for(let e=0;e<=n;++e)o[0][e]=s[e][n];for(let e=0;e<=n;++e){let t=0,i=1,c=[];for(let e=0;e<=n;++e)c[e]=a.slice(0);c[0][0]=1;for(let a=1;a<=r;++a){let r=0,l=e-a,u=n-a;e>=a&&(c[i][0]=c[t][0]/s[u+1][l],r=c[i][0]*s[l][u]);let d=l>=-1?1:-l,f=e-1<=u?a-1:n-e;for(let e=d;e<=f;++e)c[i][e]=(c[t][e]-c[t][e-1])/s[u+1][l+e],r+=c[i][e]*s[l+e][u];e<=u&&(c[i][a]=-c[t][a-1]/s[u+1][e],r+=c[i][a]*s[e][u]),o[a][e]=r;let p=t;t=i,i=p}}let u=n;for(let e=1;e<=r;++e){for(let t=0;t<=n;++t)o[e][t]*=u;u*=n-e}return o}function Kc(e,t,n,r,i){let a=i<e?i:e,o=[],s=Hc(e,r,t),l=Gc(s,r,e,a,t),u=[];for(let e=0;e<n.length;++e){let t=n[e].clone(),r=t.w;t.x*=r,t.y*=r,t.z*=r,u[e]=t}for(let t=0;t<=a;++t){let n=u[s-e].clone().multiplyScalar(l[t][0]);for(let r=1;r<=e;++r)n.add(u[s-e+r].clone().multiplyScalar(l[t][r]));o[t]=n}for(let e=a+1;e<=i+1;++e)o[e]=new c.Vector4(0,0,0);return o}function qc(e,t){let n=1;for(let t=2;t<=e;++t)n*=t;let r=1;for(let e=2;e<=t;++e)r*=e;for(let n=2;n<=e-t;++n)r*=n;return n/r}function Jc(e){let t=e.length,n=[],r=[];for(let i=0;i<t;++i){let t=e[i];n[i]=new c.Vector3(t.x,t.y,t.z),r[i]=t.w}let i=[];for(let e=0;e<t;++e){let t=n[e].clone();for(let n=1;n<=e;++n)t.sub(i[e-n].clone().multiplyScalar(qc(e,n)*r[n]));i[e]=t.divideScalar(r[0])}return i}function Yc(e,t,n,r,i){return Jc(Kc(e,t,n,r,i))}var Xc=new c.Vector3;function Zc(e,t){switch(t){case`D`:return new Float64Array(e);case`F`:return new Float32Array(e);case`L`:return new Int32Array(e);case`I`:return new Int16Array(e);default:return new Uint8Array(e)}}function Qc(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?pr:r,s=(i=t.onDownloadProgress)==null?q:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(n=>{var r,i;return l.byteLength=n.body.byteLength,$c(new Uint8Array(n.body),{light:(r=t.light)==null?!0:r,color:t.color,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(i=e.split(`?`)[1])==null?``:i,fetcher:o})}).then(t=>{let n=new c.Group;return n.name=e,n.add(t.object),a===`Y`&&n.applyMatrix4(Zn),{type:`x3p`,modelUpAxis:`Z`,upAxis:a,uri:e,byteLength:l.byteLength,memoryUsage:Ai(n),scene:n,textures:[],animations:[],dispose:()=>t.dispose()}})}function $c(e,t){var n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,ee,P,te,ne,re,ie,ae,oe,F,se,I,ce,le,ue,de,fe,pe,me,he,ge,_e,ve,ye;let be=_c(e),xe=``,Se=null;for(let e of Object.keys(be))/(^|\/)main\.xml$/i.test(e)&&(Se=be[e],xe=e.slice(0,e.lastIndexOf(`/`)+1));if(!Se)throw Error(`X3p: main.xml not found.`);if(typeof DOMParser>`u`)throw Error(`X3p: DOMParser not found.`);let Ce=(n=t.color)==null?new c.Color(10066329):n,we=new DOMParser,Te=ja(Se),Ee=we.parseFromString(Te,`text/xml`),L=Ee.querySelector(`Record1 Axes`),De={x:{type:(a=(i=(r=L==null?void 0:L.querySelector(`CX AxisType`))==null?void 0:r.textContent)==null?void 0:i.toUpperCase())==null?`I`:a,dataType:(l=(s=(o=L==null?void 0:L.querySelector(`CX DataType`))==null?void 0:o.textContent)==null?void 0:s.toUpperCase())==null?`D`:l,increment:Number((d=(u=L==null?void 0:L.querySelector(`CX Increment`))==null?void 0:u.textContent)==null?`1`:d),offset:Number((p=(f=L==null?void 0:L.querySelector(`CX Offset`))==null?void 0:f.textContent)==null?`0`:p)},y:{type:(g=(h=(m=L==null?void 0:L.querySelector(`CY AxisType`))==null?void 0:m.textContent)==null?void 0:h.toUpperCase())==null?`I`:g,dataType:(y=(v=(_=L==null?void 0:L.querySelector(`CY DataType`))==null?void 0:_.textContent)==null?void 0:v.toUpperCase())==null?`D`:y,increment:Number((x=(b=L==null?void 0:L.querySelector(`CY Increment`))==null?void 0:b.textContent)==null?`1`:x),offset:Number((C=(S=L==null?void 0:L.querySelector(`CY Offset`))==null?void 0:S.textContent)==null?`0`:C)},z:{type:(E=(T=(w=L==null?void 0:L.querySelector(`CZ AxisType`))==null?void 0:w.textContent)==null?void 0:T.toUpperCase())==null?`A`:E,dataType:(k=(O=(D=L==null?void 0:L.querySelector(`CZ DataType`))==null?void 0:D.textContent)==null?void 0:O.toUpperCase())==null?`D`:k,increment:Number((j=(A=L==null?void 0:L.querySelector(`CZ Increment`))==null?void 0:A.textContent)==null?`1`:j),offset:Number((N=(M=L==null?void 0:L.querySelector(`CZ Offset`))==null?void 0:M.textContent)==null?`0`:N)}},Oe=null,ke=Ee.querySelector(`Record1 Axes Rotation`);ke&&(Oe=new c.Matrix3,Oe.set(Number((P=(ee=ke.querySelector(`r11`))==null?void 0:ee.textContent)==null?0:P),Number((ne=(te=ke.querySelector(`r12`))==null?void 0:te.textContent)==null?0:ne),Number((ie=(re=ke.querySelector(`r13`))==null?void 0:re.textContent)==null?0:ie),Number((oe=(ae=ke.querySelector(`r21`))==null?void 0:ae.textContent)==null?0:oe),Number((se=(F=ke.querySelector(`r22`))==null?void 0:F.textContent)==null?0:se),Number((ce=(I=ke.querySelector(`r23`))==null?void 0:I.textContent)==null?0:ce),Number((ue=(le=ke.querySelector(`r31`))==null?void 0:le.textContent)==null?0:ue),Number((fe=(de=ke.querySelector(`r32`))==null?void 0:de.textContent)==null?0:fe),Number((me=(pe=ke.querySelector(`r33`))==null?void 0:pe.textContent)==null?0:me)));let Ae=(he=Ee.querySelector(`Record3 DataLink PointDataLink`))==null?void 0:he.textContent;if(typeof Ae!=`string`)throw Error(`X3p: PointDataLink not found.`);Ae=br(xe,Ae);let je=be[Ae];if(!je)throw Error(`X3p: ${je} not found.`);let Me=Zc(je.buffer,De.z.dataType),Ne=Number((_e=(ge=Ee.querySelector(`Record3 MatrixDimension SizeX`))==null?void 0:ge.textContent)==null?`0`:_e),Pe=Number((ye=(ve=Ee.querySelector(`Record3 MatrixDimension SizeY`))==null?void 0:ve.textContent)==null?`0`:ye),Fe=Math.floor(Ne-1),Ie=Math.floor(Pe-1),R=Fe+1,Le=Ie+1,Re=new Float32Array(R*Le*3),ze=new Float32Array(R*Le*2),Be=new Uint32Array(Fe*Ie*6),Ve=new c.Box3;for(let e=0;e<Le;e++){let t=e*De.y.increment+De.y.offset;for(let n=0;n<R;n++){let r=e*R+n,i=n*De.x.increment+De.x.offset,a=Me[r],o=!isNaN(a),s=o?a:NaN;Xc.set(i,-t,s),Oe&&Xc.applyMatrix3(Oe),o&&Ve.expandByPoint(Xc),Re[r*3+0]=Xc.x,Re[r*3+1]=Xc.y,Re[r*3+2]=Xc.z,ze[r*2+0]=n/Fe,ze[r*2+1]=1-e/Ie}}for(let e=0;e<Ie;e++)for(let t=0;t<Fe;t++){let n=t+R*e,r=t+R*(e+1),i=t+1+R*(e+1),a=t+1+R*e,o=(e*Fe+t)*6;Be[o+0]=n,Be[o+1]=r,Be[o+2]=a,Be[o+3]=r,Be[o+4]=i,Be[o+5]=a}let He=new c.BufferGeometry;He.setAttribute(`position`,new c.BufferAttribute(Re,3)),He.setAttribute(`uv`,new c.BufferAttribute(ze,2)),He.setIndex(new c.BufferAttribute(Be,1)),(!He.groups||He.groups.length===0)&&He.addGroup(0,He.index?He.index.count:He.attributes.position.count,0),He.boundingBox=Ve;let Ue=new vn(t.light?`phong`:`basic`);return Ue.flatShading=!0,Ue.color.copy(Ce),{object:new yn(He,[Ue]),dispose:()=>{He.dispose(),Ue.dispose()}}}function el(e){let t=e.length/32;if(e.length%32!=0)throw Error(`Invalid splat file: data length ${e.length} is not a multiple of 32`);let n=new Float32Array(3*t),r=new Float32Array(4*t),i=new Float32Array(3*t),a=new Uint8Array(4*t),o=new Float32Array(e.buffer),s=new Uint8Array(e.buffer);for(let e=0;e<t;e++)n[3*e+0]=o[8*e+0],n[3*e+1]=o[8*e+1],n[3*e+2]=o[8*e+2],i[3*e+0]=o[8*e+3+0],i[3*e+1]=o[8*e+3+1],i[3*e+2]=o[8*e+3+2],a[4*e+0]=s[32*e+24+0],a[4*e+1]=s[32*e+24+1],a[4*e+2]=s[32*e+24+2],a[4*e+3]=s[32*e+24+3],r[4*e+0]=(s[32*e+28+0]-128)/128,r[4*e+1]=(s[32*e+28+1]-128)/128,r[4*e+2]=(s[32*e+28+2]-128)/128,r[4*e+3]=(s[32*e+28+3]-128)/128;return{numPoints:t,positions:n,scales:i,rotations:r,colors:a}}function tl(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?pr:i,l=(a=t.onDownloadProgress)==null?q:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>el(new Uint8Array(e))).then(t=>{let n=new Yn({positions:t.positions,scales:t.scales,rotations:t.rotations,colors:t.colors,numPoints:t.numPoints});return o===`Y`&&n.applyMatrix4(Xn),{type:`splat`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:Ai(n),scene:n,textures:[],animations:[],dispose:()=>n.dispose()}})}var nl;(function(e){e[e.Outside=-1]=`Outside`,e[e.Intersecting=0]=`Intersecting`,e[e.Inside=1]=`Inside`})(nl||(nl={}));var rl=1e-6,il=new c.Matrix4().identity(),X=new c.Vector3,al=new c.Matrix4,ol=new c.Vector3,sl=new c.Vector3,cl=new c.Vector3,ll=new c.Vector3,ul=new c.Box3,dl=new c.Sphere,fl=new c.Matrix4,pl=new c.Ray,ml=new c.Object3D,hl=new c.Frustum;function gl(e,t){let n=e.elements;return t.setFromRotationMatrix(al.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1)),t}var _l=class e{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(e=[]){this.planes=e}setFromFrustum(e){return this.planes=e.planes.map(e=>e.clone()),this}setFromCamera(e){return al.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),hl.setFromProjectionMatrix(al),this.setFromFrustum(hl),this}applyMatrix4(e){for(let t of this.planes)t.applyMatrix4(e)}copy(e){return this.planes=e.planes.map(e=>e.clone()),this}clone(){return new e().copy(this)}computeVisibility(e){let t=nl.Inside;for(let n of this.planes)switch(e.intersectPlane(n)){case nl.Outside:return nl.Outside;case nl.Intersecting:t=nl.Intersecting;break;default:}return t}computeVisibilityWithPlaneMask(t,n){if(n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;let r=e.MASK_INSIDE,i=Math.min(32,this.planes.length);for(let a=0;a<i;++a){let i=1<<a;if((n&i)===0)continue;let o=this.planes[a],s=t.intersectPlane(o);if(s===nl.Outside)return e.MASK_OUTSIDE;s===nl.Intersecting&&(r|=i)}return r}},vl=class e{constructor(){this.type=`box`,this.center=new c.Vector3,this.halfSize=new c.Vector3,this.rotation=new c.Matrix3}fromJson({box:e}){this.center.set(e[0],e[1],e[2]);let t=e[3],n=e[4],r=e[5],i=e[6],a=e[7],o=e[8],s=e[9],c=e[10],l=e[11],u=Math.max(Math.sqrt(t*t+n*n+r*r),.001),d=Math.max(Math.sqrt(i*i+a*a+o*o),.001),f=Math.max(Math.sqrt(s*s+c*c+l*l),.001);this.halfSize.set(u,d,f);let p=this.halfSize.toArray().reduce((e,t)=>e+t,0);return(isNaN(p)||p<=0)&&this.halfSize.setScalar(rl),this.rotation.fromArray([t/u,n/u,r/u,i/d,a/d,o/d,s/f,c/f,l/f]),isNaN(this.rotation.toArray().reduce((e,t)=>e+t,0))&&this.rotation.identity(),this}toJson(){return this.rotation.extractBasis(ol,sl,cl),{box:[...this.center.toArray(),...ol.multiplyScalar(this.halfSize.x).toArray(),...sl.multiplyScalar(this.halfSize.y).toArray(),...cl.multiplyScalar(this.halfSize.z).toArray()]}}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return new e().copy(this)}applyMatrix4(e){return e.equals(il)?this:(ml.position.copy(this.center),gl(this.rotation,ml.quaternion),ml.scale.copy(this.halfSize),ml.matrix.compose(ml.position,ml.quaternion,ml.scale),ml.matrix.premultiply(e),ml.matrix.decompose(ml.position,ml.quaternion,ml.scale),this.center.copy(ml.position),this.rotation.setFromMatrix4(al.makeRotationFromQuaternion(ml.quaternion)),this.halfSize.copy(ml.scale),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.rotation.elements,n=e.x-this.center.x,r=e.y-this.center.y,i=e.z-this.center.z,a=0,o;return o=n*t[0]+r*t[1]+i*t[2],o<0&&(o=-o),o-=this.halfSize.x,o>0&&(a+=o*o),o=n*t[3]+r*t[4]+i*t[5],o<0&&(o=-o),o-=this.halfSize.y,o>0&&(a+=o*o),o=n*t[6]+r*t[7]+i*t[8],o<0&&(o=-o),o-=this.halfSize.z,o>0&&(a+=o*o),a}distanceToPoint(e){return Math.sqrt(this.distanceSquaredToPoint(e))}distanceToPlane(e){let t=e.projectPoint(this.center,new c.Vector3);return this.distanceToPoint(t)}getBoundingBox(e){return e.makeEmpty(),this.rotation.extractBasis(ol,sl,cl),ol.setLength(this.halfSize.x),sl.setLength(this.halfSize.y),cl.setLength(this.halfSize.z),e.expandByPoint(X.copy(this.center).add(ol)),e.expandByPoint(X.copy(this.center).sub(ol)),e.expandByPoint(X.copy(this.center).add(sl)),e.expandByPoint(X.copy(this.center).sub(sl)),e.expandByPoint(X.copy(this.center).add(cl)),e.expandByPoint(X.copy(this.center).sub(cl)),e}toGeometry(){let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);X.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,0),X.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,3),X.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,6),X.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,9),X.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,12),X.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,15),X.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,18),X.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,21);let n=new c.BufferGeometry;return n.setIndex(new c.BufferAttribute(e,1)),n.setAttribute(`position`,new c.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n}intersectPlane(e){let t=this.center,n=e.normal,r=this.rotation.elements,i=this.halfSize,a=n.x,o=n.y,s=n.z,c=Math.abs(a*r[0]*i.x+o*r[1]*i.x+s*r[2]*i.x)+Math.abs(a*r[3]*i.y+o*r[4]*i.y+s*r[5]*i.y)+Math.abs(a*r[6]*i.z+o*r[7]*i.z+s*r[8]*i.z),l=n.dot(t)+e.constant;return l<=-c?nl.Outside:l>=c?nl.Inside:nl.Intersecting}intersectRay(e,t=0,n){if(ll.copy(this.halfSize).multiplyScalar(2),ul.setFromCenterAndSize(X.set(0,0,0),ll),ul.expandByScalar(t),this.rotation.extractBasis(ol,sl,cl),al.makeBasis(ol,sl,cl),al.setPosition(this.center),fl.getInverse(al),pl.copy(e).applyMatrix4(fl),ul.containsPoint(pl.origin))return!0;let r=pl.intersectBox(ul,X);return r?n===void 0?!0:(n+=t,r.distanceToSquared(pl.origin)<=n*n):!1}},yl=class e{constructor(){this.type=`sphere`,this.center=new c.Vector3,this.radius=-1}fromJson({sphere:e}){return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],rl),this}toJson(){return{sphere:[...this.center.toArray(),this.radius]}}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}clone(){return new e().copy(this)}getBoundingBox(e){return e.setFromCenterAndSize(this.center,ll.set(1,1,1).multiplyScalar(this.radius*2)),e}toGeometry(){let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+Math.sin(n)*this.radius,e[t*6+2]=this.center.z+0,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+Math.sin(n)*this.radius,e[t*6+5]=this.center.z+0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+0,e[t*6+2]=this.center.z+Math.sin(n)*this.radius,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+0,e[t*6+5]=this.center.z+Math.sin(n)*this.radius}let t=new c.BufferGeometry;return t.setAttribute(`position`,new c.BufferAttribute(e,3)),t.computeBoundingBox(),t.computeBoundingSphere(),t}applyMatrix4(e){return e.equals(il)?this:(this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.distanceToPoint(e);return t*t}distanceToPoint(e){let t=this.center.distanceTo(e)-this.radius;return t<=0?0:t}distanceToPlane(e){let t=Math.abs(e.distanceToPoint(this.center));return Math.max(0,t-this.radius)}intersectPlane(e){let t=this.center,n=this.radius,r=e.normal.dot(t)+e.constant;return r<-n?nl.Outside:r<n?nl.Intersecting:nl.Inside}intersectRay(e,t=0,n){if(dl.set(this.center,this.radius+t),dl.containsPoint(e.origin))return!0;let r=e.intersectSphere(dl,X);return r?n===void 0?!0:(n+=t,e.origin.distanceToSquared(r)<=n*n):!1}},bl=class e{constructor(){throw this.type=`regin`,this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,Error(`Region bounding volume not supported.`)}fromJson({region:e}){return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this}toJson(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}}copy(e){return this.west=e.west,this.south=e.south,this.east=e.east,this.north=e.north,this.minHeight=e.minHeight,this.maxHeight=e.maxHeight,this}clone(){return new e().copy(this)}getBoundingBox(e){throw Error(`not implemented`)}toGeometry(){throw Error(`not implemented`)}applyMatrix4(e){throw Error(`not implemented`)}getCenter(e){throw Error(`not implemented`)}distanceToPoint(e){throw Error(`not implemented`)}distanceSquaredToPoint(e){throw Error(`not implemented`)}distanceToPlane(e){throw Error(`not implemented`)}intersectPlane(e){throw Error(`not implemented`)}intersectRay(e,t=0,n){throw Error(`not implemented`)}};function xl(e){return e instanceof vl||e instanceof yl||e instanceof bl}function Sl(e){if(xl(e))return e;if(`box`in e)return new vl().fromJson(e);if(`sphere`in e)return new yl().fromJson(e);if(`region`in e)return new bl().fromJson(e);throw Error(`BoundingVolume ${JSON.stringify(e)} never suppored.`)}var Cl=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(e=>new c.LineBasicMaterial({color:e,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})),wl=(()=>{let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);X.set(1,1,1).toArray(t,0),X.set(-1,1,1).toArray(t,3),X.set(-1,-1,1).toArray(t,6),X.set(1,-1,1).toArray(t,9),X.set(1,1,-1).toArray(t,12),X.set(-1,1,-1).toArray(t,15),X.set(-1,-1,-1).toArray(t,18),X.set(1,-1,-1).toArray(t,21);let n=new c.BufferGeometry;return n.setIndex(new c.BufferAttribute(e,1)),n.setAttribute(`position`,new c.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n})(),Tl=(()=>{let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=Math.sin(n),e[t*6+2]=0,n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=Math.sin(n),e[t*6+5]=0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=0,e[t*6+2]=Math.sin(n),n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=0,e[t*6+5]=Math.sin(n)}let t=new c.BufferGeometry;return t.setAttribute(`position`,new c.BufferAttribute(e,3)),t.computeBoundingBox(),t.computeBoundingSphere(),t})();function El(e,t=0){if(e instanceof vl){let n=new c.LineSegments(wl,Cl[Math.min(t,Cl.length-1)]);return n.position.copy(e.center),gl(e.rotation,n.quaternion),n.scale.set(e.halfSize.x,e.halfSize.y,e.halfSize.z),n.matrix.compose(n.position,n.quaternion,n.scale),n}else if(e instanceof yl){let n=new c.LineSegments(Tl,Cl[Math.min(t,Cl.length-1)]);return n.position.copy(e.center),n.scale.set(e.radius,e.radius,e.radius),n.matrix.compose(n.position,n.quaternion,n.scale),n}return null}var Dl=new c.Vector3,Ol=new c.Plane,kl=new yl,Al=new vl,jl=class e{constructor(t,n,r,i){var a,o,s,l;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,centerScreenY:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=i==null?null:i,this.contentParent=i?i.hasRenderContent?i:i.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(a=n.refine)==null?this.parent?this.parent.refine:`REPLACE`:a,this.transform=new c.Matrix4,n.transform&&this.transform.fromArray(n.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof n.geometricError==`number`?this.geometricError=n.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(s=(o=this.parent)==null?void 0:o.geometricError)==null?0:s,n.content&&n.content.uri?(this.content={uri:n.content.uri,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:U(),loadfailRetryDelay:0,byteLength:0,memoryUsage:0},n.content.group!==void 0&&(this.content.group=n.content.group),/\.json$/.test(this.content.uri)?this.type=`TILESET`:this.type=`SCENEGRAPH`):(this.content=null,this.type=`EMPTY`),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type===`SCENEGRAPH`&&(this.levelOfContent+=1),n.boundingVolume&&(this.boundingVolume=Sl(n.boundingVolume).applyMatrix4(this.transform)),n.viewerRequestVolume&&(this.viewerRequestVolume=Sl(n.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(l=n.extras)==null?{}:l,typeof this.extras.floor!=`number`&&i&&typeof i.extras.floor==`number`&&(this.extras.floor=i.extras.floor),typeof this.extras.floor==`number`&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),n.children?this.children=n.children.map((t,n)=>new e(`${this.id}.${n}`,t,r,this)):this.children=[]}traverse(e){e(this);for(let t of this.children)t.traverse(e)}updateState(e){this.state.frameNumber=e.frameNumber;let t=this.tileset.transform;if(this.boundingVolume){let n;n=this.boundingVolume instanceof vl?Al.copy(this.boundingVolume):this.boundingVolume instanceof yl?kl.copy(this.boundingVolume):this.boundingVolume.clone(),n.applyMatrix4(t),e.camera.type===`OrthographicCamera`?(Ol.setFromNormalAndCoplanarPoint(e.camera.direction,e.camera.position),this.state.distanceToCamera=n.distanceToPlane(Ol)):this.state.distanceToCamera=n.distanceToPoint(e.camera.position);let r=n.getCenter(Dl).sub(e.camera.position);this.state.centerZDepth=e.camera.direction.dot(r),this.state.centerScreenY=e.camera.up.dot(r);let i=this.parent?this.parent.state.visibilityPlaneMask:_l.MASK_INDETERMINATE;this.state.visibilityPlaneMask=e.cullingVolume.computeVisibilityWithPlaneMask(n,i),this.state.visible=this.state.visibilityPlaneMask!==_l.MASK_OUTSIDE,e.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=_l.MASK_INDETERMINATE,this.state.visible=!0;if((this.levelOfContent<=e.minLevelOfDetail||this.geometricError>=e.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){let n;n=this.viewerRequestVolume instanceof vl?Al.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof yl?kl.copy(this.viewerRequestVolume):this.viewerRequestVolume.clone(),n.applyMatrix4(t),this.state.inRequestVolume=n.distanceSquaredToPoint(e.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(e,this.state.distanceToCamera,!1)}get selected(){return this.state.selectedFrameNumber===this.tileset.frameNumber}get hasChildren(){return this.children.length>0}get siblingIndex(){var e,t;return(t=(e=this.parent)==null?void 0:e.children.indexOf(this))==null?0:t}get hasTilesetContent(){return this.children.length>0&&this.type===`TILESET`}get hasRenderContent(){return this.type===`SCENEGRAPH`}get contentAvailable(){var e;return this.hasRenderContent&&((e=this.content)==null?void 0:e.loadState)===`READY`}get hasUnloadedContent(){var e;return((e=this.content)==null?void 0:e.loadState)===`UNLOADED`}get hasEmptyContent(){return this.type===`EMPTY`}get contentReady(){var e;return((e=this.content)==null?void 0:e.loadState)===`READY`||this.hasEmptyContent}get contentByteLength(){return this.content?this.content.byteLength:0}get contentMemoryUsage(){return this.content?this.content.memoryUsage:0}getScreenSpaceError(e,t,n){let r=this.tileset.transform.getMaxScaleOnAxis(),i=this.parent?this.parent.geometricError:this.tileset.geometricError,a=r*(n?i:this.geometricError);if(a===0)return 0;let o=e.height,s=e.sseDenominator;return e.camera.type===`OrthographicCamera`?a/(1/(e.camera.projectionMatrix.elements[5]/2)/o*.9):a/(Math.max(t,.001)*s/o)}getPriority(e){let t=this.refine===`ADD`||e.skipLevelOfDetail;if(t&&!this.state.visible||e.frameNumber-this.state.touchedFrameNumber>=1)return-1;let n=this.parent,r=n&&(!t||this.state.screenSpaceError===0)?n.state.screenSpaceError:this.state.screenSpaceError,i=this.tileset.root?this.tileset.root.state.screenSpaceError:0;return Math.max(i-r,0)}},Ml=e=>Number(e);function Nl(e,t=Ml,n=!1){let r,i=1/0;for(let n of e){let e=t(n);e<=i&&(r=n,i=e)}return isFinite(i)||(i=0),n?[r,i]:r}function Pl(e,t,n=(e,t)=>e===t){let r=e.length;if(r!==t.length)return!1;for(let i=0;i<r;i++)if(n(e[i],t[i])===!1)return!1;return!0}var Fl=new Set;function Il(e){Fl.clear();let t=[],n=e.length;for(let r=0;r<n;r++){let n=e[r];Fl.has(n)||(t.push(n),Fl.add(n))}return Fl.clear(),t}var Ll=e=>e.distance,Rl=(e,t)=>e.distance-t.distance;function zl(e,t=!0,n=!1){if(n&&e.length>1){let t=Nl(e,Ll);t?(e[0]=t,e.length=1):e.length=0}return t&&e.length>1&&e.sort(Rl),e}var Bl=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){var e,t;let n=this.indices,r=this.position;return n?n.array.length/((e=n.stride)==null?1:e):r.array.length/((t=r.stride)==null?3:t)}getPositionByIndex(e,t){var n,r,i,a;let o=this.indices,s=this.position,c=e;if(o){let t=o.array,i=(n=o.stride)==null?1:n,a=(r=o.offset)==null?0:r;c=t[e*i+a]}let l=s.array,u=(i=s.stride)==null?3:i,d=(a=s.offset)==null?0:a;return c=c*u+d,t.x=l[c],t.y=l[c+1],t.z=l[c+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},Vl=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function Hl(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function Ul(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var Wl=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},Gl=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},Kl=class{constructor(e,t){this.min=e,this.max=t}},ql=1e-6,Jl=new Wl(0,0,0),Yl=new Wl(0,0,0),Xl=new Wl(0,0,0),Zl=new Wl(0,0,0),Ql=class extends Bl{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionCount()/3,i=r>65535?new Uint32Array(r):new Uint16Array(r),a=new Float32Array(r*6),o=[],s=0,c=-1;if(n)for(let e=0;e<r;e+=1){let t=e*3,n=e*6,r,o,s,c,l,u,d;i[e]=e,this.getPositionByIndex(t,Yl),this.getPositionByIndex(t+1,Xl),this.getPositionByIndex(t+2,Zl),r=c=Yl.x,d=Xl.x,d<r&&(r=d),d>c&&(c=d),d=Zl.x,d<r&&(r=d),d>c&&(c=d),o=l=Yl.y,d=Xl.y,d<o&&(o=d),d>l&&(l=d),d=Zl.y,d<o&&(o=d),d>l&&(l=d),s=u=Yl.z,d=Xl.z,d<s&&(s=d),d>u&&(u=d),d=Zl.z,d<s&&(s=d),d>u&&(u=d),a[n]=r,a[n+1]=o,a[n+2]=s,a[n+3]=c,a[n+4]=l,a[n+5]=u}else{let e=1/0,t=1/0,o=1/0,s=-1/0,c=-1/0,l=-1/0;for(let n=0;n<r;n+=1){let r=n*3,u=n*6,d,f,p,m,h,g,_;i[n]=n,this.getPositionByIndex(r,Yl),this.getPositionByIndex(r+1,Xl),this.getPositionByIndex(r+2,Zl),d=m=Yl.x,_=Xl.x,_<d&&(d=_),_>m&&(m=_),_=Zl.x,_<d&&(d=_),_>m&&(m=_),f=h=Yl.y,_=Xl.y,_<f&&(f=_),_>h&&(h=_),_=Zl.y,_<f&&(f=_),_>h&&(h=_),p=g=Yl.z,_=Xl.z,_<p&&(p=_),_>g&&(g=_),_=Zl.z,_<p&&(p=_),_>g&&(g=_),a[u]=d,a[u+1]=f,a[u+2]=p,a[u+3]=m,a[u+4]=h,a[u+5]=g,d<e&&(e=d),m>s&&(s=m),f<t&&(t=f),h>c&&(c=h),p<o&&(o=p),g>l&&(l=g)}n=[e,t,o,s,c,l]}let l=new Vl(++c,n,0,r,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let r=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2],d.sort(f);for(let u=0;u<3;u++){let f=d[u],m=p[f]+p[f+3],h=r,g=l-1,_=-1,v;for(;h<=g;)_===-1?(v=i[h],a[v*6+f]+a[v*6+f+3]<m?h++:_=v):(v=i[g],a[v*6+f]+a[v*6+f+3]>=m?g--:(i[h]=v,i[g]=_,_=-1,h++,g--));if(h>r&&h<l){let u=new Vl(++c,eu(i,a,r,h,ql),r,h,n.deepth+1);u.deepth<t&&u.endIndex-u.startIndex>e&&(o[s++]=u);let d=new Vl(++c,eu(i,a,h,l,ql),h,l,n.deepth+1);d.deepth<t&&d.endIndex-d.startIndex>e&&(o[s++]=d),n.node0=u,n.node1=d,n.startIndex=0,n.endIndex=0;break}}}for(;s;)p(o[--s]);return this.offsetArray=i,this.rootNodePacked=Hl(l,c+1),o.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],c=[],l;for(;(l=s.pop())!==void 0;){let r=l*36/4,u=$l(e.x,i[r],i[r+3])-e.x,d=$l(e.y,i[r+1],i[r+4])-e.y,f=$l(e.z,i[r+2],i[r+5])-e.z;if(u*u+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];c.push(e)}let i=l*36/2,u=o[i+16],d=o[i+17];u&&s.push(u),d&&s.push(d)}}let u=c.length,d=new Float32Array(u*9);for(let e=0;e<u;e++){let t=c[e]*3;this.getPositionByIndex(t,Jl),d[e*9]=Jl.x,d[e*9+1]=Jl.y,d[e*9+2]=Jl.z,this.getPositionByIndex(t+1,Jl),d[e*9+3]=Jl.x,d[e*9+4]=Jl.y,d[e*9+5]=Jl.z,this.getPositionByIndex(t+2,Jl),d[e*9+6]=Jl.x,d[e*9+7]=Jl.y,d[e*9+8]=Jl.z}return d}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=new Wl(1/t.x,1/t.y,1/t.z),f=[0],p,m=1/0,h=new Kl(new Wl(0,0,0),new Wl(0,0,0)),g=new Wl(0,0,0),_=new Wl(0,0,0),v=new Wl(0,0,0);for(;(p=f.pop())!==void 0;){let s=p*36/4;h.min.x=c[s],h.min.y=c[s+1],h.min.z=c[s+2],h.max.x=c[s+3],h.max.y=c[s+4],h.max.z=c[s+5];let y=Ul(e,d,h,n);if(y===null||r&&y>m)continue;let b=e.x,x=e.y,S=e.z,C=t.x,w=t.y,T=t.z,E=l[s+6],D=l[s+7];for(let e=E;e<D;e++){let t=o[e],n=t*3;this.getPositionByIndex(n,g);let s=g.x,c=g.y,l=g.z;this.getPositionByIndex(n+1,_);let u=_.x,d=_.y,f=_.z;this.getPositionByIndex(n+2,v);let p=v.x,h=v.y,y=v.z,E=u-s,D=d-c,O=f-l,k=p-s,A=h-c,j=y-l,M=D*j-O*A,N=O*k-E*j,ee=E*A-D*k,P=C*M+w*N+T*ee,te;if(P>0)te=1;else if(P<0)te=-1,P=-P;else continue;let ne=b-s,re=x-c,ie=S-l,ae=te*(C*(re*j-ie*A)+w*(ie*k-ne*j)+T*(ne*A-re*k));if(ae<0)continue;let oe=te*(C*(D*ie-O*re)+w*(O*ne-E*ie)+T*(E*re-D*ne));if(oe<0||ae+oe>P)continue;let F=-te*(ne*M+re*N+ie*ee);if(F<0)continue;let se=F/P,I=new Gl(g,_,v,t,new Wl(b+C*se,x+w*se,S+T*se));(!i||i(I))&&(r?se<m&&(m=se,a.length>0&&(a.length=0),a.push(I)):a.push(I))}let O=p*36/2,k=u[O+16],A=u[O+17];k&&f.push(k),A&&f.push(A)}return a}};function $l(e,t,n){return e<t?t:e>n?n:e}function eu(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new Wl(0,0,0),t=new Wl(0,0,0),n=new Wl(0,0,0),r=new Wl(0,0,0);return function(i,a,o,s,c){t.subVectors(a,i),n.subVectors(o,i),r.crossVectors(t,n);let l=c.dot(r),u;if(l>0)u=1;else if(l<0)u=-1,l=-l;else return null;e.subVectors(s,i);let d=u*c.dot(n.crossVectors(e,n));if(d<0)return null;let f=u*c.dot(t.cross(e));if(f<0||d+f>l)return null;let p=-u*e.dot(r);if(p<0)return null;let m=p/l;return new Wl(0,0,0).copy(c).multiplyScalar(m).add(s)}})();var tu=1e-6,nu=[`x`,`y`,`z`],ru=new Wl(0,0,0),iu=class extends Bl{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionByIndex.bind(this),i=this.getPositionCount(),a=i>65535?new Uint32Array(i):new Uint16Array(i),o=[],s=0,c=-1;if(n)for(let e=0;e<i;e+=1)a[e]=e;else{r(0,ru);let e=ru.x,t=ru.y,o=ru.z,s=e,c=t,l=o;for(let n=0;n<i;n+=1){a[n]=n,r(n,ru);let i=ru.x,u=ru.y,d=ru.z;i<e?e=i:i>s&&(s=i),u<t?t=u:u>c&&(c=u),d<o?o=d:d>l&&(l=d)}n=[e,t,o,s,c,l]}let l=new Vl(++c,n,0,i,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let i=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2];let m=d.sort(f)[0],h=nu[m],g=(p[m]+p[m+3])/2,_=i,v=l-1,y=-1,b;for(;_<=v;)y===-1?(b=a[_],r(b,ru),ru[h]<g?_++:y=b):(b=a[v],r(b,ru),ru[h]>=g?v--:(a[_]=b,a[v]=y,y=-1,_++,v--));if(_>i){let r=p.slice();r[m+3]=g+tu;let a=new Vl(++c,r,i,_,n.deepth+1);a.deepth<t&&a.endIndex-a.startIndex>e&&(o[s++]=a),n.node0=a}if(l>_){let r=p.slice();r[m]=g-tu;let i=new Vl(++c,r,_,l,n.deepth+1);i.deepth<t&&i.endIndex-i.startIndex>e&&(o[s++]=i),n.node1=i}n.startIndex=0,n.endIndex=0}for(;s;)p(o[--s]);return this.offsetArray=a,this.rootNodePacked=Hl(l,c+1),o.length=0,this}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=n*n,f=new Wl(1/t.x,1/t.y,1/t.z),p=[0],m,h=1/0,g=new Kl(new Wl(0,0,0),new Wl(0,0,0)),_=new Wl(0,0,0);for(;(m=p.pop())!==void 0;){let s=m*36/4;g.min.x=c[s],g.min.y=c[s+1],g.min.z=c[s+2],g.max.x=c[s+3],g.max.y=c[s+4],g.max.z=c[s+5];let v=Ul(e,f,g,n);if(v===null||r&&v>h)continue;let y=l[s+6],b=l[s+7];for(let n=y;n<b;n++){let s=o[n];this.getPositionByIndex(s,_);let c=_.x,l=_.y,u=_.z,f=e.x,p=e.y,m=e.z,g=t.x,v=t.y,y=t.z,b=g*(c-f)+v*(l-p)+y*(u-m);if(b>0?(f+=g*b,p+=v*b,m+=y*b):b<0&&(b=0),g=c-f,v=l-p,y=u-m,g*g+v*v+y*y<=d){let e=new Gl(_,_,_,s,new Wl(f,p,m));(!i||i(e))&&(r?b<h&&(h=b,a.length>0&&(a.length=0),a.push(e)):a.push(e))}}let x=m*36/2,S=u[x+16],C=u[x+17];S&&p.push(S),C&&p.push(C)}return a}},au="(function(){var e=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){let e=this.indices,t=this.position;return e?e.array.length/(e.stride??1):t.array.length/(t.stride??3)}getPositionByIndex(e,t){let n=this.indices,r=this.position,i=e;if(n){let t=n.array,r=n.stride??1,a=n.offset??0;i=t[e*r+a]}let a=r.array,o=r.stride??3,s=r.offset??0;return i=i*o+s,t.x=a[i],t.y=a[i+1],t.z=a[i+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},t=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function n(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function r(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var i=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},a=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},o=class{constructor(e,t){this.min=e,this.max=t}};let s=1e-6,c=new i(0,0,0),l=new i(0,0,0),u=new i(0,0,0),d=new i(0,0,0);var f=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionCount()/3,o=a>65535?new Uint32Array(a):new Uint16Array(a),c=new Float32Array(a*6),f=[],p=0,h=-1;if(i)for(let e=0;e<a;e+=1){let t=e*3,n=e*6,r,i,a,s,f,p,m;o[e]=e,this.getPositionByIndex(t,l),this.getPositionByIndex(t+1,u),this.getPositionByIndex(t+2,d),r=s=l.x,m=u.x,m<r&&(r=m),m>s&&(s=m),m=d.x,m<r&&(r=m),m>s&&(s=m),i=f=l.y,m=u.y,m<i&&(i=m),m>f&&(f=m),m=d.y,m<i&&(i=m),m>f&&(f=m),a=p=l.z,m=u.z,m<a&&(a=m),m>p&&(p=m),m=d.z,m<a&&(a=m),m>p&&(p=m),c[n]=r,c[n+1]=i,c[n+2]=a,c[n+3]=s,c[n+4]=f,c[n+5]=p}else{let e=1/0,t=1/0,n=1/0,r=-1/0,s=-1/0,f=-1/0;for(let i=0;i<a;i+=1){let a=i*3,p=i*6,m,h,g,_,v,y,b;o[i]=i,this.getPositionByIndex(a,l),this.getPositionByIndex(a+1,u),this.getPositionByIndex(a+2,d),m=_=l.x,b=u.x,b<m&&(m=b),b>_&&(_=b),b=d.x,b<m&&(m=b),b>_&&(_=b),h=v=l.y,b=u.y,b<h&&(h=b),b>v&&(v=b),b=d.y,b<h&&(h=b),b>v&&(v=b),g=y=l.z,b=u.z,b<g&&(g=b),b>y&&(y=b),b=d.z,b<g&&(g=b),b>y&&(y=b),c[p]=m,c[p+1]=h,c[p+2]=g,c[p+3]=_,c[p+4]=v,c[p+5]=y,m<e&&(e=m),_>r&&(r=_),h<t&&(t=h),v>s&&(s=v),g<n&&(n=g),y>f&&(f=y)}i=[e,t,n,r,s,f]}let g=new t(++h,i,0,a,0);f[p++]=g;let _=[],v=[0,1,2],y=function(e,t){return _[t]-_[e]};function b(n){let i=n.startIndex,a=n.endIndex,l=n.extents;_[0]=l[3]-l[0],_[1]=l[4]-l[1],_[2]=l[5]-l[2],v.sort(y);for(let u=0;u<3;u++){let d=v[u],g=l[d]+l[d+3],_=i,y=a-1,b=-1,x;for(;_<=y;)b===-1?(x=o[_],c[x*6+d]+c[x*6+d+3]<g?_++:b=x):(x=o[y],c[x*6+d]+c[x*6+d+3]>=g?y--:(o[_]=x,o[y]=b,b=-1,_++,y--));if(_>i&&_<a){let l=new t(++h,m(o,c,i,_,s),i,_,n.deepth+1);l.deepth<r&&l.endIndex-l.startIndex>e&&(f[p++]=l);let u=new t(++h,m(o,c,_,a,s),_,a,n.deepth+1);u.deepth<r&&u.endIndex-u.startIndex>e&&(f[p++]=u),n.node0=l,n.node1=u,n.startIndex=0,n.endIndex=0;break}}}for(;p;)b(f[--p]);return this.offsetArray=o,this.rootNodePacked=n(g,h+1),f.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],l=[],u;for(;(u=s.pop())!==void 0;){let r=u*36/4,c=p(e.x,i[r],i[r+3])-e.x,d=p(e.y,i[r+1],i[r+4])-e.y,f=p(e.z,i[r+2],i[r+5])-e.z;if(c*c+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];l.push(e)}let i=u*36/2,c=o[i+16],d=o[i+17];c&&s.push(c),d&&s.push(d)}}let d=l.length,f=new Float32Array(d*9);for(let e=0;e<d;e++){let t=l[e]*3;this.getPositionByIndex(t,c),f[e*9]=c.x,f[e*9+1]=c.y,f[e*9+2]=c.z,this.getPositionByIndex(t+1,c),f[e*9+3]=c.x,f[e*9+4]=c.y,f[e*9+5]=c.z,this.getPositionByIndex(t+2,c),f[e*9+6]=c.x,f[e*9+7]=c.y,f[e*9+8]=c.z}return f}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=new i(1/t.x,1/t.y,1/t.z),g=[0],_,v=1/0,y=new o(new i(0,0,0),new i(0,0,0)),b=new i(0,0,0),x=new i(0,0,0),S=new i(0,0,0);for(;(_=g.pop())!==void 0;){let o=_*36/4;y.min.x=f[o],y.min.y=f[o+1],y.min.z=f[o+2],y.max.x=f[o+3],y.max.y=f[o+4],y.max.z=f[o+5];let d=r(e,h,y,n);if(d===null||s&&d>v)continue;let C=e.x,w=e.y,T=e.z,E=t.x,D=t.y,O=t.z,k=p[o+6],A=p[o+7];for(let e=k;e<A;e++){let t=u[e],n=t*3;this.getPositionByIndex(n,b);let r=b.x,o=b.y,d=b.z;this.getPositionByIndex(n+1,x);let f=x.x,p=x.y,m=x.z;this.getPositionByIndex(n+2,S);let h=S.x,g=S.y,_=S.z,y=f-r,k=p-o,A=m-d,j=h-r,M=g-o,N=_-d,P=k*N-A*M,F=A*j-y*N,I=y*M-k*j,L=E*P+D*F+O*I,R;if(L>0)R=1;else if(L<0)R=-1,L=-L;else continue;let z=C-r,B=w-o,V=T-d,H=R*(E*(B*N-V*M)+D*(V*j-z*N)+O*(z*M-B*j));if(H<0)continue;let U=R*(E*(k*V-A*B)+D*(A*z-y*V)+O*(y*B-k*z));if(U<0||H+U>L)continue;let W=-R*(z*P+B*F+V*I);if(W<0)continue;let G=W/L,K=new a(b,x,S,t,new i(C+E*G,w+D*G,T+O*G));(!c||c(K))&&(s?G<v&&(v=G,l.length>0&&(l.length=0),l.push(K)):l.push(K))}let j=_*36/2,M=m[j+16],N=m[j+17];M&&g.push(M),N&&g.push(N)}return l}};function p(e,t,n){return e<t?t:e>n?n:e}function m(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new i(0,0,0),t=new i(0,0,0),n=new i(0,0,0),r=new i(0,0,0);return function(a,o,s,c,l){t.subVectors(o,a),n.subVectors(s,a),r.crossVectors(t,n);let u=l.dot(r),d;if(u>0)d=1;else if(u<0)d=-1,u=-u;else return null;e.subVectors(c,a);let f=d*l.dot(n.crossVectors(e,n));if(f<0)return null;let p=d*l.dot(t.cross(e));if(p<0||f+p>u)return null;let m=-d*e.dot(r);if(m<0)return null;let h=m/u;return new i(0,0,0).copy(l).multiplyScalar(h).add(c)}})();let h=1e-6,g=[`x`,`y`,`z`],_=new i(0,0,0);var v=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionByIndex.bind(this),o=this.getPositionCount(),s=o>65535?new Uint32Array(o):new Uint16Array(o),c=[],l=0,u=-1;if(i)for(let e=0;e<o;e+=1)s[e]=e;else{a(0,_);let e=_.x,t=_.y,n=_.z,r=e,c=t,l=n;for(let i=0;i<o;i+=1){s[i]=i,a(i,_);let o=_.x,u=_.y,d=_.z;o<e?e=o:o>r&&(r=o),u<t?t=u:u>c&&(c=u),d<n?n=d:d>l&&(l=d)}i=[e,t,n,r,c,l]}let d=new t(++u,i,0,o,0);c[l++]=d;let f=[],p=[0,1,2],m=function(e,t){return f[t]-f[e]};function v(n){let i=n.startIndex,o=n.endIndex,d=n.extents;f[0]=d[3]-d[0],f[1]=d[4]-d[1],f[2]=d[5]-d[2];let v=p.sort(m)[0],y=g[v],b=(d[v]+d[v+3])/2,x=i,S=o-1,C=-1,w;for(;x<=S;)C===-1?(w=s[x],a(w,_),_[y]<b?x++:C=w):(w=s[S],a(w,_),_[y]>=b?S--:(s[x]=w,s[S]=C,C=-1,x++,S--));if(x>i){let a=d.slice();a[v+3]=b+h;let o=new t(++u,a,i,x,n.deepth+1);o.deepth<r&&o.endIndex-o.startIndex>e&&(c[l++]=o),n.node0=o}if(o>x){let i=d.slice();i[v]=b-h;let a=new t(++u,i,x,o,n.deepth+1);a.deepth<r&&a.endIndex-a.startIndex>e&&(c[l++]=a),n.node1=a}n.startIndex=0,n.endIndex=0}for(;l;)v(c[--l]);return this.offsetArray=s,this.rootNodePacked=n(d,u+1),c.length=0,this}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=n*n,g=new i(1/t.x,1/t.y,1/t.z),_=[0],v,y=1/0,b=new o(new i(0,0,0),new i(0,0,0)),x=new i(0,0,0);for(;(v=_.pop())!==void 0;){let o=v*36/4;b.min.x=f[o],b.min.y=f[o+1],b.min.z=f[o+2],b.max.x=f[o+3],b.max.y=f[o+4],b.max.z=f[o+5];let d=r(e,g,b,n);if(d===null||s&&d>y)continue;let S=p[o+6],C=p[o+7];for(let n=S;n<C;n++){let r=u[n];this.getPositionByIndex(r,x);let o=x.x,d=x.y,f=x.z,p=e.x,m=e.y,g=e.z,_=t.x,v=t.y,b=t.z,S=_*(o-p)+v*(d-m)+b*(f-g);if(S>0?(p+=_*S,m+=v*S,g+=b*S):S<0&&(S=0),_=o-p,v=d-m,b=f-g,_*_+v*v+b*b<=h){let e=new a(x,x,x,r,new i(p,m,g));(!c||c(e))&&(s?S<y&&(y=S,l.length>0&&(l.length=0),l.push(e)):l.push(e))}}let w=v*36/2,T=m[w+16],E=m[w+17];T&&_.push(T),E&&_.push(E)}return l}};function y(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}y(e=>Promise.resolve(e).then(e=>{let t=[],n=new Set;for(let r of e){let e;if(r.type===`mesh`)e=new f(r.attributes.position,r.indices);else if(r.type===`points`)e=new v(r.attributes.position,r.indices);else throw Error(`Invalid Type`);e.createTree(r.maxItemPerNode,r.maxTreeDepth,r.extents);let i={type:r.type,attributes:r.attributes,indices:r.indices,offsetArray:e.offsetArray,rootNodePacked:e.rootNodePacked};t.push(i);let a;for(let e in i.attributes){let t=i.attributes[e];t&&t.buffer instanceof ArrayBuffer&&n.add(t.buffer)}a=i.indices,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),a=i.offsetArray,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),n.add(i.rootNodePacked)}return{output:t,transfer:Array.from(n)}}))})();",ou=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,au],{type:`text/javascript;charset=utf-8`});function su(e){let t;try{if(t=ou&&(self.URL||self.webkitURL).createObjectURL(ou),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(au),{name:e==null?void 0:e.name})}}var cu=new io(()=>new su,4),lu=()=>!0,uu=new c.Ray,du=new c.Matrix3,fu=new c.Matrix4,pu=new c.Vector3,mu=new c.Vector3,hu=new c.Vector3,gu=new WeakMap;function _u(e,t,n,r){var i,a;let o=e.matrixWorld;fu.getInverse(o),uu.copy(n.ray).applyMatrix4(fu);let s=(i=n.hitFilter)==null?lu:i,l=(a=n.firstHitOnly)==null?!1:a,u=e.geometry,d=e.material,f=u.groups,p=u.index,m=t.intersectRay(uu.origin,uu.direction,0,l,t=>{var r;let i=t.index,a=i*3,l;if(Array.isArray(d)){if(f){for(let e of f)if(a>=e.start&&a-e.start<e.count){l=d[(r=e.materialIndex)==null?0:r];break}}}else l=d;if(!l)return!1;let u=t.intersectionPoint,m=new c.Vector3(u.x,u.y,u.z).applyMatrix4(o),h=n.ray.origin.distanceTo(m);if(h<n.near||h>n.far)return!1;let g=t.pointA,_=t.pointB,v=t.pointC,y=c.Triangle.getNormal(pu.set(g.x,g.y,g.z).applyMatrix4(o),mu.set(_.x,_.y,_.z).applyMatrix4(o),hu.set(v.x,v.y,v.z).applyMatrix4(o),new c.Vector3),b=n.ray.direction.dot(y);if(l.side===c.FrontSide&&b>=0||l.side===c.BackSide&&b<=0)return!1;let x={distance:h,object:e,face:new c.Face3(p?p.array[a]:a,p?p.array[a+1]:a+1,p?p.array[a+2]:a+2,y),point:m,distanceToRay:0,faceIndex:i};return gu.set(t,x),s(x)}),h=m.length;for(let e=0;e<h;e++){let t=gu.get(m[e]);t&&r.push(t)}m.length=0}function vu(e,t,n,r){var i,a,o,s;let l=e.matrixWorld;du.getNormalMatrix(l),fu.getInverse(l),uu.copy(n.ray).applyMatrix4(fu);let u=((a=(i=n.params.Points)==null?void 0:i.threshold)==null?1:a)*fu.getMaxScaleOnAxis(),d=(o=n.hitFilter)==null?lu:o,f=(s=n.firstHitOnly)==null?!1:s,p=e.geometry,m=p.index,h=p.getAttribute(`normal`),g=h instanceof c.BufferAttribute,_=t.intersectRay(uu.origin,uu.direction,u,f,t=>{let r=t.intersectionPoint,i=new c.Vector3(r.x,r.y,r.z).applyMatrix4(l),a=n.ray.origin.distanceTo(i);if(a<n.near||a>n.far)return!1;let o=t.pointA,s=pu.set(o.x,o.y,o.z).applyMatrix4(l),u=i.distanceTo(s);if(u/a>.07)return!1;let f=t.index,_=m?m.array[f]:f,v;if(g){let e=new c.Vector3().fromBufferAttribute(h,_).applyNormalMatrix(du);v=new c.Face3(_,_,_,e)}else{let e=p.getAttribute(`scale`),t=p.getAttribute(`rotation`);if(e instanceof c.BufferAttribute&&t instanceof c.BufferAttribute){let r=new c.Vector3().fromBufferAttribute(e,_).toArray(),i=new c.Vector4().fromBufferAttribute(t,_).toArray(),a=new c.Quaternion(i[1],i[2],i[3],i[0]),[{axis:o}]=[{axis:`x`,scale:r[0]},{axis:`y`,scale:r[1]},{axis:`z`,scale:r[2]}].sort((e,t)=>e.scale-t.scale),s=new c.Vector3(0,0,0);s[o]=1,s.applyQuaternion(a).applyNormalMatrix(du),n.ray.direction.dot(s)>0&&s.negate(),v=new c.Face3(_,_,_,s)}}let y={distance:a,object:e,face:v,point:i,distanceToRay:u,index:f};return gu.set(t,y),d(y)}),v=_.length;for(let e=0;e<v;e++){let t=gu.get(_[e]);t&&r.push(t)}_.length=0}var yu=`__bvh_mesh__`,bu=c.Mesh.prototype.raycast;function xu(e,t){let n=Su(this);n?_u(this,n,e,t):bu.call(this,e,t)}function Su(e){let t=e[yu];return t instanceof Ql,t}function Cu(e,t){Object.assign(e,{[yu]:t,raycast:xu})}var wu=`__bvh_points__`,Tu=c.Points.prototype.raycast;function Eu(e,t){let n=Du(this);n?vu(this,n,e,t):Tu.call(this,e,t)}function Du(e){let t=e[wu];return t instanceof iu,t}function Ou(e,t){Object.assign(e,{[wu]:t,raycast:Eu})}function ku(e,t=!0,n=100,r=10){let i=[];return e.traverse(e=>{(e instanceof c.Mesh||e instanceof c.Points)&&e.geometry instanceof c.BufferGeometry&&i.push(e)}),t?Promise.resolve().then(()=>{let e=[],t=new Set,a=null;for(let o=0;o<i.length;o++){let s=i[o],l=s.geometry;if(!(l instanceof c.BufferGeometry))continue;let u;if(s instanceof c.Mesh?u=`mesh`:s instanceof c.Points&&(u=`points`),!u)continue;let d=l.boundingBox,f=d?[d.min.x,d.min.y,d.min.z,d.max.x,d.max.y,d.max.z]:void 0,p={};for(let e in l.attributes){let n=l.attributes[e];n instanceof c.InterleavedBufferAttribute?(p[e]={array:n.data.array,stride:n.data.stride,offset:n.offset},a=n.data.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)):(p[e]={array:n.array},a=n.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer))}let m,h=l.getIndex();h&&(h instanceof c.InterleavedBufferAttribute?(m={array:h.data.array,stride:h.data.stride,offset:h.offset},a=h.data.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)):(m={array:h.array},a=h.array,a&&a.buffer instanceof ArrayBuffer&&t.add(a.buffer)));let g={type:u,attributes:p,indices:m,maxItemPerNode:n,maxTreeDepth:r,extents:f};e.push(g)}return cu.postMessage(e,Array.from(t))}).then(t=>{for(let e=0;e<i.length;e++){let n=i[e],r=n.geometry,a=t[e];if(!(r instanceof c.BufferGeometry))continue;for(let e in a.attributes){let t=a.attributes[e].array,n=r.attributes[e];n instanceof c.InterleavedBufferAttribute?n.data.array=t:n.array=t}let o=r.getIndex();if(o&&a.indices){let e=a.indices.array;o instanceof c.InterleavedBufferAttribute?o.data.array=e:o.array=e}if(n instanceof c.Mesh){let e=new Ql(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,Cu(n,e)}else if(n instanceof c.Points){let e=new iu(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,Ou(n,e)}}return e}):Promise.resolve().then(()=>{for(let e of i)if(e instanceof c.Mesh){let t=e.geometry,i=t.boundingBox,a=i?[i.min.x,i.min.y,i.min.z,i.max.x,i.max.y,i.max.z]:void 0;if(t instanceof c.BufferGeometry){let i,o,s=t.attributes.position;i=s instanceof c.InterleavedBufferAttribute?{array:s.data.array,stride:s.data.stride,offset:s.offset}:{array:s.array};let l=t.getIndex();l&&(o=l instanceof c.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new Ql(i,o);u.createTree(n,r,a),Cu(e,u)}}else if(e instanceof c.Points){let t=e.geometry,i=t.boundingBox,a=i?[i.min.x,i.min.y,i.min.z,i.max.x,i.max.y,i.max.z]:void 0;if(t instanceof c.BufferGeometry){let i,o,s=t.attributes.position;i=s instanceof c.InterleavedBufferAttribute?{array:s.data.array,stride:s.data.stride,offset:s.offset}:{array:s.array};let l=t.getIndex();l&&(o=l instanceof c.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new iu(i,o);u.createTree(n,r,a),Ou(e,u)}}return e})}function Au(e,t,n){return e+(t-e)*n}function ju(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t,s=e;return i*Math.pow(r,3)+a*Math.pow(r,2)+o*r+s}function Mu(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t;return 3*i*Math.pow(r,2)+2*a*r+o}function Nu(e,t,n,r){let i=r[1]-r[0];return e=Pu(e,r),t=Pu(t,r),t-e>i/2?Au(e+i,t,n):e-t>i/2?Au(e-i,t,n):Au(e,t,n)}function Pu(e,t){let n=t[1]-t[0];return e<t[0]?Pu(e+n,t):e>=t[1]?Pu(e-n,t):e}function Fu(e,t,n,r){return r?Nu(e,t,n,r):Au(e,t,n)}function Iu(e){let t=Number(e);return isNaN(t)||!isFinite(t)?0:t}var Z=class{constructor(e){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=U(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(let t in e){let n=e[t];typeof n==`object`?(this.value[t]=Iu(n.value),this.config[t]={circle:n.circle}):(this.value[t]=Iu(n),this.config[t]={circle:!1})}this.keyframes=[{progress:0,value:Object.assign({},this.value)},{progress:1,value:Object.assign({},this.value)}]}getProgress(e){let t=e-this.startTime;return t<0?0:t>=this.duration?1:1-ju(1,this.startVelocity,this.duration,t)}getValue(e){for(let t=1;t<this.keyframes.length;t++)if(this.keyframes[t].progress>e){let n=this.keyframes[t-1],r=this.keyframes[t],i={};for(let t in this.config){let a=(e-n.progress)/(r.progress-n.progress);i[t]=Fu(n.value[t],r.value[t],a,this.config[t].circle)}return i}return Object.assign({},this.keyframes[this.keyframes.length-1].value)}getProgressVelocity(e){let t=e-this.startTime;return t>=this.duration?0:Mu(1,this.startVelocity,this.duration,t)}update(e){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)}getKeyFrameSegment(e){let t=this.getProgress(e);for(let e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t)return[this.keyframes[e-1],this.keyframes[e]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]}getTargetKeyframe(){return this.keyframes[this.keyframes.length-1]}set(e,t,n=0,r){var i;isNaN(t)&&(t=0),isNaN(n)&&(n=0),r=r==null?U():r;let a=this.getProgress(r),o=this.getValue(a),s={};for(let t in this.config)s[t]=(i=e[t])==null?o[t]:i;let c=[{progress:0,value:o},{progress:1,value:s}];return this.setKeyframes(c,t,n,r)}setKeyframes(e,t,n=0,r){if(e.length<2)throw Error(`keyframes invalid.`);return isNaN(t)&&(t=0),isNaN(n)&&(n=0),this.callbacks&&(this.callbacks[1](Error(`motion aborted.`)),this.callbacks=void 0),new Promise((i,a)=>{r=r==null?U():r,this.progress=0,this.ended=!1,this.startTime=r,this.startVelocity=n,this.keyframes=e,this.duration=t,t===0?(this.progress=1,this.value=Object.assign({},e[e.length-1].value)):this.value=Object.assign({},e[0].value),this.callbacks=[i,a]})}dispose(){this.callbacks&&(this.callbacks[1](Error(`motion dispose.`)),this.callbacks=void 0)}},Lu=Math.PI,Ru=1.70158;Ru*1.525,Ru+1,2*Lu/3,2*Lu/4.5;var zu=function(e){return e},Bu=function(e){return e*e*e},Vu=function(e){return e*e*e*e},Hu=500,Uu=new WeakMap,Wu=new c.Vector3,Gu=new c.Matrix4,Ku=class e extends c.Object3D{constructor(e,t,n,r=q){super(),this.name=e,this.materials=[],this.pbmObjects=[],this.contentObject=t,this.animations=n,this.appearMotion=new Z({appear:0}),this.disposers=[r],this.add(t),t.traverse(e=>{if(e instanceof c.Mesh||e instanceof c.Points){let t=e.material;if(Array.isArray(t))for(let e=0;e<t.length;e++)this.materials.push(t[e]);else this.materials.push(t)}(e instanceof yn||e instanceof bn||e instanceof kn||e instanceof Yn)&&this.pbmObjects.push(e)})}generateBvhTree(){return ku(this,!0,200,20)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.hitFilter;e.hitFilter=t=>{if(t.object instanceof kn&&t.object.material.pointBack===`HIDDEN`&&t.face&&t.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;let n=0,i=-1;if((t.object instanceof yn||t.object instanceof bn||t.object instanceof kn)&&t.face){let e=Array.isArray(t.object.material)?t.object.material[t.face.materialIndex]:t.object.material;if(e){n=e.floorIndex,i=e.shownFloorIndex;for(let r of e.clippers)if(!(typeof r.floorIndex==`number`&&r.floorIndex!==n)&&(Gu.getInverse(r.clippingBoxMatrix),Wu.copy(t.point).applyMatrix4(Gu),Math.abs(Wu.x)<.5&&Math.abs(Wu.y)<.5&&Math.abs(Wu.z)<.5))return!1}}let a=i;return e.floorIndex===void 0?e.floor!==void 0&&(a=e.floor===null?-1:e.floor):a=e.floorIndex,a>=0&&n!==a?!1:(Object.assign(t,{floorIndex:n,floor:n}),r?r.call(e,t):!0)};let i=this.children.slice(),a;for(;a=i.pop();)if(a.visible){a.raycast(e,n);for(let e=0,t=a.children.length;e<t;e++)i.push(a.children[e])}return e.hitFilter=r,zl(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n,r,i,a){let o=!1;r.visible&&i.state.selectedFrameNumber===i.tileset.frameNumber?this.appearMotion.getTargetKeyframe().value.appear!==1&&this.appearMotion.set({appear:1},Hu).catch(q):this.appearMotion.getTargetKeyframe().value.appear!==0&&this.appearMotion.set({appear:0},0).catch(q),this.appearMotion.ended!==!0&&this.appearMotion.update(t.time);for(let s of this.pbmObjects)s instanceof yn||s instanceof bn?qu(s,this.appearMotion,e,t,n,i,a)===!0&&(o=!0):s instanceof kn?Ju(s,this.appearMotion,e,t,n,i,a)===!0&&(o=!0):s instanceof Yn&&Yu(s,this.appearMotion,e,t,n,r,i,a)===!0&&(o=!0);return o}dispose(){for(let e of this.disposers)e();this.disposers.length=0,this.pbmObjects.length=0}clone(){return new e(this.name,this.contentObject.clone(),this.animations)}};function qu(e,t,n,r,i,a,o){var s,l;let u=!1;if(Uu.get(e)!==o.version){Uu.set(e,o.version),u=!0,e.castShadow=o.castShadow,e.receiveShadow=o.receiveShadow;let t=e.material;for(let e of t)e.customShaders=o.customShaders,e.pano0=o.pano0,e.pano1=o.pano1,e.pano0Depth=o.pano0Depth,e.pano1Depth=o.pano1Depth,e.panoFilter=(l=(s=o.panoFilter)==null?void 0:s.toValue())==null?null:l,e.refinedScreen=o.refinedScreen,e.modelAlpha=o.modelAlpha,e.progress=o.progress,e.transition=o.transition,e.opacity=o.opacity,e.floorStyle=o.floorStyle,e.constantColor=o.constantColor,e.shownFloorIndex=o.shownFloorIndex,e.clippers=o.clippers,e.brightness=o.brightness,e.useHQWeight=o.useHQWeight,e.useHQDepth=o.useHQDepth,e.colorSaturation=o.colorSaturation,e.colorBrightness=o.colorBrightness,e.gradientTexture=o.gradientTexture,e.vertexMarks=o.vertexMarks,e.modelBoundingMax.copy(o.boundingBox.max),e.modelBoundingMin.copy(o.boundingBox.min),e.shaderType===`none`?(e.transparent=!0,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!1,e.depthTest=!0):(e.transparent=e.alphaMode===`BLEND`,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!0,e.depthTest=!0,o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.shownFloorIndex>-1&&e.shownFloorIndex!==e.floorIndex&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.alphaMap&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),e.modelAlpha<=0&&(e.transparent=!1),e.depthWrite=!e.transparent,o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending))}return u}function Ju(e,t,n,r,i,a,o){var s,l;let u=!1;if(o.pointAppearAnimation===!0&&a.refine===`ADD`&&a.tileset.rootMeta.pntsOrder===`RANDOM`){let n=e.geometry,r=a.tileset.currentMaxScreenSpaceError,i=a.state.screenSpaceError,o=(l=(s=a.parent)==null?void 0:s.state.screenSpaceError)==null?i:l,c=1;o!==i&&(c=(o-r)/(o-i)),c=W(c,0,1),c=Bu(c);let d=n.index?n.index.count:n.attributes.position?n.attributes.position.count:1/0,f=Math.floor(d*c*t.value.appear);n.drawRange.count!==f&&(n.setDrawRange(0,f),u=!0)}if(Uu.get(e)!==o.version){Uu.set(e,o.version),u=!0,e.castShadow=o.castShadow,e.receiveShadow=o.receiveShadow;let t=[e.material];for(let e of t)e.customShaders=o.customShaders,e.pointScale=o.pointScale,e.pointMinPixel=o.pointMinPixel,e.pointMaxPixel=o.pointMaxPixel,e.pointSize=o.pointSize,e.pointShape=o.pointShape,e.pointBack=o.pointBack,e.modelAlpha=o.modelAlpha,e.opacity=o.opacity,e.floorStyle=o.floorStyle,e.constantColor=o.constantColor,e.shownFloorIndex=o.shownFloorIndex,e.clippers=o.clippers,e.brightness=o.brightness,e.useHQWeight=o.useHQWeight,e.useHQDepth=o.useHQDepth,e.colorSaturation=o.colorSaturation,e.colorBrightness=o.colorBrightness,e.outlineGain=o.outlineGain,e.distanceGain=o.distanceGain,e.gradientTexture=o.gradientTexture,e.transparent=!1,e.blending=c.NormalBlending,e.blendDst=c.OneMinusSrcAlphaFactor,e.blendEquation=c.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.colorWrite=!0,e.depthWrite=!0,e.depthTest=!0,e.modelBoundingMax.copy(o.boundingBox.max),e.modelBoundingMin.copy(o.boundingBox.min),e.shownFloorIndex>-1&&(e.transparent=e.shownFloorIndex!==e.floorIndex),e.modelAlpha<1&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),o.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.useHQWeight&&(e.depthWrite=!1,e.blending=c.CustomBlending,e.blendSrc=c.SrcAlphaFactor,e.blendSrcAlpha=c.SrcAlphaFactor,e.blendDst=c.OneFactor,e.blendDstAlpha=c.OneFactor),e.useHQDepth&&(e.colorWrite=!1)}return u}function Yu(e,t,n,r,i,a,o,s){let l=!1,u=a.uuid;return e.gsViewLayerKey!==u&&(e.gsViewLayerKey=u,l=!0),e.gsClippers!==s.clippers&&(e.gsClippers=s.clippers,l=!0),e.updateMatrix(),e.updateMatrixWorld(),e.usedSHDegree=s.gaussianSplattingSHDegree,e.lastMatrixWorld?e.transformChanged=!e.lastMatrixWorld.equals(e.matrixWorld):(e.lastMatrixWorld=new c.Matrix4,e.transformChanged=!0,l=!0),e.lastMatrixWorld.copy(e.matrixWorld),e.transformChanged&&(l=!0),l}var Xu=class{constructor(e,t,n){this.id=e,this.name=t.name,this.visible=!1,this.tileset=n,this.transform=new c.Matrix4,t.transform&&this.transform.fromArray(t.transform),this.transform.premultiply(this.tileset.root.transform),this.content={uri:t.file,byteLength:0,memoryUsage:0,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:U(),loadfailRetryDelay:0,data:void 0}}},Zu=class e extends c.Object3D{constructor(e,t,n=q){super(),this.name=e,this.contentObject=t,this.name=e,this.add(t),this.disposers=[n]}update(e,t,n,r,i,a){let o=this.contentObject.material[2];return o.uniforms.dashOffset.value=(o.uniforms.dashOffset.value-.003)%(o.uniforms.dashSize.value.x+o.uniforms.dashSize.value.y),!0}dispose(){for(let e of this.disposers)e();this.disposers.length=0}clone(){return new e(this.name,this.contentObject.clone())}},Qu=new Map;function $u(e,t,n){if(n&&n.has(t))return n.get(t);let r=t.refine===`ADD`||e.skipLevelOfDetail,i=t.parent,a=i&&(!r||t.state.screenSpaceError===0)?i.state.screenSpaceError:t.state.screenSpaceError,o=t.tileset.root?t.tileset.root.state.screenSpaceError:0,s=Math.max(o-a,0);return n&&n.set(t,s),s}var ed=class{constructor(e,t){this.tileset=e,this.options=t,this.activeRequests=0,this.requestQueue=[]}reset(){for(let e of this.requestQueue)this.options.onTileSkip&&(e.tile.content&&this.tileset.options.tileUnloader(e.tile),this.options.onTileSkip(e.tile));this.requestQueue.length=0}update(e,t,n){let r=n.time,i=this.requestQueue,a=new Set(e);for(let e=0;e<i.length;e++){let t=i[e];if(a.has(t.tile)){a.delete(t.tile);continue}t.status===`WAITING`&&(i.splice(e,1),e--,this.options.onTileSkip&&this.options.onTileSkip(t.tile))}a.size>0&&(a.forEach(e=>{i.push({tile:e,status:`WAITING`,time:r,error:null})}),a.clear());let o=n.maxRequests;for(let e=0;e<i.length&&o>0;e++){let t=i[e];if(t.status===`DONE`)t.error===null?(o--,t.tile.content&&(t.tile.content.loadState=`READY`),this.options.onTileLoad&&this.options.onTileLoad(t.tile)):this.options.onTileError&&this.options.onTileError(t.tile,t.error),i.splice(e,1),e--;else if(t.status===`PENDING`&&r-t.time<1e3)break}switch(Qu.clear(),t){case`SCREEN_SPACE_ERROR`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?$u(n,e.tile,Qu)-$u(n,t.tile,Qu):e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_LEVEL_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.level===t.tile.level?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level-t.tile.level:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;default:break}if(o=Math.max(n.maxRequests-this.activeRequests,0),!n.skipLevelOfDetail){let e=0,t=i.length;for(let r=0;r<t;r++){let t=i[r].tile;if(t.hasTilesetContent||t.contentParent===null||t.contentParent.state.selectedFrameNumber===n.frameNumber){let t=i.splice(r,1);i.splice(e++,0,...t)}}}for(let e=0;e<i.length&&o>0;e++){let t=i[e];t.status===`WAITING`&&(o--,t.status=`PENDING`,t.time=r,this.activeRequests++,this.tileset.options.tileLoader(t.tile).catch(e=>{t.error=e}).then(()=>{t.status=`DONE`,t.tile.content&&t.tile.content.loadState===`READY`&&(t.tile.content.loadState=`LOADING`),this.activeRequests--}))}}},td=class{constructor(e,t,n){this.item=e,this.previous=t,this.next=n}},nd=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(e){let t=new td(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t}remove(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--}splice(e,t){e!==t&&(this.remove(t),this.insert(e,t))}insert(e,t){let n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,this._length++}toArray(){let e=[],t=this.head;for(;t;)e.push(t),t=t.next;return e}},rd=class{constructor(e={}){this.options=e,this.cacheNodeMap=new WeakMap,this.list=new nd,this.sentinel=this.list.add(`sentinel`)}reset(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)}touchTile(e){let t=this.cacheNodeMap.get(e);t&&this.list.splice(this.sentinel,t)}loadTile(e){if(!this.cacheNodeMap.has(e)){let t=this.list.add(e);this.cacheNodeMap.set(e,t),this.options.onTileLoad&&this.options.onTileLoad(e)}}unloadTile(e){let t=this.cacheNodeMap.get(e);t&&(this.list.remove(t),this.cacheNodeMap.delete(e),this.options.onTileUnload&&this.options.onTileUnload(e))}unloadTiles(e){let t=this.list.head;for(;t!==this.sentinel&&e();){let e=t.item;t=t.next,this.unloadTile(e)}}toArray(){let e=[];for(let t of this.list.toArray())t.item!==`sentinel`&&e.push(t.item);return e}},id=class{constructor(){this.map=new Map,this.array=[],this._length=0}get length(){return this._length}get(e){return this.array[e]}set(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)}delete(e){let t=this.map.get(e);t!==void 0&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)}push(e){if(!this.map.has(e)){let t=this._length++;this.array[t]=e,this.map.set(e,t)}}pop(){let e=this.array[--this._length];return this.map.delete(e),this.array[this._length]=void 0,e}reset(){this.array=[],this.map=new Map,this._length=0}find(e){return this.map.has(e)}peek(){return this.array[this._length-1]}},ad=class{constructor(e){this.tileset=e,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new id}traverse(e,t,n=[]){this.reset()}reset(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0}updateTile(e,t){this.updateTileVisibility(e,t),e.state.shouldSelect=!1,e.state.finalResolution=!0}selectTile(e,t){this._canSelectTile&&e.contentAvailable&&e.state.selectedFrameNumber<t.frameNumber&&(e.state.selectedFrameNumber=t.frameNumber,this.tileset.selectedTiles.push(e),this.tileset.needsRefinedTiles.add(e))}loadTile(e,t){this._canSelectTile&&(e.state.requestedFrameNumber<t.frameNumber&&(e.state.requestedFrameNumber=t.frameNumber,e.content&&(e.content.loadState===`FAILED`&&t.time-e.content.loadStateUpdateTime>e.content.loadfailRetryDelay&&(e.content.loadState=`UNLOADED`,e.content.loadProgress=0,e.content.loadStateUpdateTime=t.time),e.content.loadState===`UNLOADED`&&this.tileset.requestedTiles.push(e))),this.tileset.needsRefinedTiles.add(e))}touchTile(e,t){this._canSelectTile&&(this.tileset.cache.touchTile(e),e.state.touchedFrameNumber=t.frameNumber)}canTraverse(e,t){return!e.state.inRequestVolume||e.hasRenderContent&&(e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError)||e.children.length===0?!1:e.levelOfContent<t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.hasTilesetContent?!0:e.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError}updateTileVisibility(e,t){if(e.updateState(t),!e.state.visible||!e.state.inRequestVolume)return;let n=e.children.length>0;if(e.hasTilesetContent&&n){let n=e.children[0];this.updateTileVisibility(n,t),e.state.visible=n.state.visible;return}if(this.meetsScreenSpaceErrorEarly(e,t)){e.state.visible=!1;return}if(e.refine===`REPLACE`&&n&&!this.anyChildrenVisible(e,t)){e.state.visible=!1;return}}anyChildrenVisible(e,t){let n=!1,r=e.children;for(let e of r)e.updateState(t),n=n||e.state.visible;return n}meetsScreenSpaceErrorEarly(e,t){let{parent:n}=e;return!n||n.refine!==`ADD`||n.levelOfContent<t.minLevelOfDetail||n.geometricError>t.maxGeometricError?!1:n.levelOfContent>t.maxLevelOfDetail||n.levelOfContent>=0&&n.geometricError<t.minGeometricError?!0:e.getScreenSpaceError(t,e.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError}sortTilesByDistanceToCamera(e){e.sort((e,t)=>t.state.distanceToCamera===0&&e.state.distanceToCamera===0?t.state.centerZDepth-e.state.centerZDepth:t.state.distanceToCamera-e.state.distanceToCamera)}},od=class extends ad{constructor(e){super(e),this._traversalStack=new id,this._emptyTraversalStack=new id}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t));this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop(),r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=e.refine===`REPLACE`&&e.hasRenderContent,a=!1,o=!0;for(let e of r)if(e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.find(e)&&n.delete(e),n.push(e),a===!1&&(a=!0)):(i||t.loadSiblings)&&(this.loadTile(e,t),this.touchTile(e,t)),i){let n;n=e.state.inRequestVolume?e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t):!1,o=o&&n}return a||(o=!1),o}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}executeEmptyTraversal(e,t){let n=!0,r=this._emptyTraversalStack;for(r.push(e);r.length>0&&n;){let e=r.pop(),i=!e.hasRenderContent&&this.canTraverse(e,t);if(!i&&!e.contentAvailable&&(n=!1),this.updateTile(e,t),e.state.visible||(this.loadTile(e,t),this.touchTile(e,t)),i){let t=e.children;for(let e of t)r.find(e)&&r.delete(e),r.push(e)}}return n}},sd=class extends ad{constructor(e){super(e),this.baseScreenSpaceError=1024,this.skipScreenSpaceErrorFactor=16,this.skipLevels=1,this._traversalStack=new id,this._descendantTraversalStack=new id,this._selectionTraversalStack=new id,this._selectionTraversalancestorStack=new id}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t));this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop();this.updateTileAncestorContentLinks(e,t);let r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.inBaseTraversal(e,this.baseScreenSpaceError)?(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):o?(this.loadTile(e,t),this.selectDesiredTile(e,t)):this.reachedSkippingThreshold(e)&&this.loadTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=!1;for(let e of r)e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.push(e),i===!1&&(i=!0)):t.loadSiblings&&(this.loadTile(e,t),this.touchTile(e,t));return i}selectDesiredTile(e,t){let n=e.contentAvailable?e:e.state.ancestorWithContentAvailable;n&&(n.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,t)}selectDescendants(e,t){let n=this._descendantTraversalStack;for(n.push(e);n.length>0;){let e=n.pop().children;for(let r of e)r.state.visible&&(r.contentAvailable?(this.updateTile(r,t),this.touchTile(r,t),this.selectTile(r,t)):n.push(r))}}reachedSkippingThreshold(e){let t=e.state.ancestorWithContent;return t!==null&&e.state.screenSpaceError<t.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>t.levelOfContent+this.skipLevels}updateTileAncestorContentLinks(e,t){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;let{parent:n}=e;if(!n)return;let r=!(n.hasRenderContent&&n.hasUnloadedContent)||n.state.requestedFrameNumber===t.frameNumber;e.state.ancestorWithContent=r?n:n.state.ancestorWithContent,e.state.ancestorWithContentAvailable=n.contentAvailable?n:n.state.ancestorWithContentAvailable}inBaseTraversal(e,t){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>t:e.state.screenSpaceError>t:!0}traverseAndSelect(e,t){let n=this._selectionTraversalStack,r=this._selectionTraversalancestorStack,i;for(n.push(e);n.length>0||r.length>0;){if(r.length>0){let e=r.peek();if(e.state.stackLength===n.length){r.pop(),e!==i&&(e.state.finalResolution=!1),this.selectTile(e,t);continue}}let e=n.pop();if(!e)continue;let a=this.canTraverse(e,t);if(e.state.shouldSelect)if(e.refine===`ADD`)this.selectTile(e,t);else{if(e.state.selectionDepth=r.length,e.state.selectionDepth>0&&(e.tileset.hasMixedContent=!0),i=e,!a){this.selectTile(e,t);continue}r.push(e),e.state.stackLength=n.length}if(a)for(let t of e.children)t.state.visible&&n.push(t)}}},cd=class extends ad{constructor(e){super(e),this._traversalStack=new id}canTraverse(e,t){return!(!e.state.inRequestVolume||e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError||e.children.length===0)}traverse(e,t,n){super.traverse(e,t,[]),this._traversalStack.reset(),e.updateState(t);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t));this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(n.push(e);n.length>0;){let e=n.pop(),r=e.refine===`ADD`,i=e.refine===`REPLACE`,a=this.canTraverse(e,t);a&&this.updateAndPushChildren(e,t,n),(r||i&&!a)&&(this.loadTile(e,t),this.touchTile(e,t),this.selectDesiredTile(e,t))}}updateAndPushChildren(e,t,n){let{children:r}=e;for(let e=0;e<r.length;++e){let i=r[e];i.updateState(t),i.state.visible&&n.push(i)}}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}},ld=class{constructor(e,t){var n,r,i,a,o,s,l;if(this.id=e.tilesetUrl,this.transform=new c.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||``,gltfUpAxis:(n=e.asset.gltfUpAxis)==null?`Y`:n,overview:e.asset.overview,trajectories:(i=(r=e.asset.trajectories)==null?void 0:r.list)==null?[]:i,extras:e.asset.extras},this.rootMeta=(a=e.rootMeta)==null?{}:a,this.pointLength=(o=this.rootMeta.numTotalPoints)==null?1/0:o,this.floorLength=(s=this.rootMeta.numFloors)==null?1:s,this.properties=(l=e.properties)==null?{}:l,this.options=t,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new od(this),this.skipTraverser=new sd(this),this.mostDetailTraverser=new cd(this),this.cache=new rd({onTileLoad:e=>{this.cacheMemoryUsageInBytes+=e.contentMemoryUsage},onTileUnload:e=>{this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.unloadTiles.push(e)}}),this.requestScheduler=new ed(this,{onTileSkip:e=>{},onTileLoad:e=>{var t;(t=e.content)!=null&&t.data&&(this.loadedTiles.add(e),this.cache.loadTile(e)),this.options.onTileLoad(e)},onTileError:(e,t)=>{this.options.onTileError(e,t)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new jl(`${this.id}#tile:0`,e.root,this),this.geometricError=e.geometricError,this.trajectories=[],this.asset.trajectories)for(let e=0;e<this.asset.trajectories.length;e++){let t=new Xu(`${this.id}#trajectory:${e}`,this.asset.trajectories[e],this);this.trajectories.push(t)}}adjustScreenSpaceError(e){if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=e.maxScreenSpaceError),e.memoryAdjustedScreenSpaceError){let t=0,n=0,r=0;if(this.needsRefinedTiles.forEach(e=>{e.content&&(n++,t+=e.content.memoryUsage,e.content.loadState===`READY`&&r++)}),r<2||n<2)this.currentMaxScreenSpaceError=e.maxScreenSpaceError;else{let i=1024*1024,a=t/r*n,o=e.maxMemoryUsage*i,s=o-W(o*.1,8*i,64*i),c=this.currentMaxScreenSpaceError;if(a<s){let e=.5*(1-a/s);c-=e}else a>o&&(c+=.3);c=W(c,1,e.maxScreenSpaceError),Math.abs(c-this.currentMaxScreenSpaceError)>=.1&&(this.currentMaxScreenSpaceError=c)}}else this.currentMaxScreenSpaceError=e.maxScreenSpaceError}getTraverser(e){return e.mostDetail?this.mostDetailTraverser:e.skipLevelOfDetail?this.skipTraverser:this.normalTraverser}reset(){this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();let e=[this.root],t;for(;t=e.pop();){for(let n=0,r=t.children.length;n<r;n++)e.push(t.children[n]);this.cache.unloadTile(t)}for(;this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}for(this.loadedTiles.clear();this.trajectories.length;){let e=this.trajectories.pop();e&&this.options.trajectoryUnloader(e).catch(()=>{}).then(()=>{this.options.onTrajectoryUnload&&this.options.onTrajectoryUnload(e)})}}update(e,t=[]){var n;for(this.frameNumber=e.frameNumber,this.adjustScreenSpaceError(e),this.cache.reset(),this.getTraverser(e).traverse(this.root,e,t),this.cache.unloadTiles(()=>this.cacheMemoryUsageInBytes>e.maxMemoryUsage*1024*1024),this.requestScheduler.update(this.requestedTiles,e.requestOrder,e);this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}this.selectedTrajectories.length=0;for(let t of this.trajectories)t.visible===!0&&t.content.loadState===`READY`&&(n=t.content.data)!=null&&n.object?this.selectedTrajectories.push(t):t.visible===!0&&(t.content.loadState===`FAILED`&&e.time-t.content.loadStateUpdateTime>t.content.loadfailRetryDelay&&(t.content.loadState=`UNLOADED`,t.content.loadStateUpdateTime=e.time),t.content.loadState===`UNLOADED`&&this.options.trajectoryLoader(t).then(()=>{this.options.onTrajectoryLoad(t)}).catch(e=>{this.options.onTrajectoryError(t,e)}))}};function ud(e,t){var n;if(e.content){let r=(n=e.content.uri)==null?e.content.url:n;typeof r==`string`&&!vr(r)&&(e.content.uri=Sr(br(t,r)))}if(e.transform){let t=!1;for(let n=0;n<16;n++){let r=e.transform[n];if(typeof r!=`number`||isNaN(r)||!isFinite(r)){t=!0;break}}if(e.transform[15]===0&&(t=!0),t)throw Error(`Invalid Tile Transform: `+JSON.stringify(e.transform))}if(e.children)for(let n of e.children)ud(n,t);return e}function dd(e,t){e.tilesetUrl=t;let n=/^blob\:/.test(t)?``:t.slice(0,t.lastIndexOf(`/`)+1);if(e.asset||(e.asset={}),e.rootMeta||(e.rootMeta={}),e.rootMeta.taskParameters||(e.rootMeta.taskParameters={}),e.asset.overview){let t=e.asset.overview;vr(t.imageFile)||(t.imageFile=Sr(br(n,t.imageFile))),vr(t.worldFile)||(t.worldFile=Sr(br(n,t.worldFile)))}if(e.asset.trajectories)for(let t=0;t<e.asset.trajectories.list.length;t++){let r=e.asset.trajectories.list[t];r.file=Sr(br(n,r.file))}return ud(e.root,n),e}function fd(e){return new Promise(t=>setTimeout(t,e))}var pd=new class{constructor(e){this.queue=[],this.concurrency=e,this.dequeuing=0}add(e,t=1e3){let n,r,i=new Promise((e,t)=>{n=e,r=t});return this.queue.unshift(()=>{let i=Promise.resolve().then(e);i.then(n,r);let a=fd(t);return Promise.race([i,a]).then(q,q)}),this.dequeue(),i}dequeue(){for(;this.dequeuing<this.concurrency&&this.queue.length>0;){let e=this.queue.pop();this.dequeuing++,e().catch(q).then(()=>{this.dequeuing--,this.dequeue()})}}}(1),md=256;function hd(e){return typeof e.image==`object`&&e.image.width>0&&e.image.height>0}function gd(e,t){if(!hd(e))return Promise.resolve(e);if(e.image.width<md&&e.image.width<md)return t.initTexture(e),Promise.resolve(e);let n=!1,r=()=>{n=!0,e.removeEventListener(`dispose`,r)};return e.addEventListener(`dispose`,r),pd.add(()=>new Promise(i=>{ri.shared.add(()=>{hd(e)&&n===!1&&t.initTexture(e),e.removeEventListener(`dispose`,r),i(e)},!0)}))}function _d(e,t){return Promise.all(e.map(e=>gd(e,t)))}var vd=/^[og]\s*(.+)?/,yd=/^mtllib /,bd=/^usemtl /,xd=/^usemap /,Sd=/\s+/,Cd=new c.Color,wd=class{constructor(){this.objects=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materials={},this.materialLibraries=[],this.startObject(``,!1)}startObject(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}let n=this.object&&typeof this.object.currentMaterial==`function`?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0),this.object={name:e||``,fromDeclaration:t!==!1,geometry:{vertices:[],hasNormal:!0,normals:[],hasColor:!0,colors:[],hasUV:!0,uvs:[],index:[],indexMap:{}},materials:[],smooth:!0,startMaterial:function(e,t){var n,r;let i=this._finalize(!1);i&&(i.inherited||((n=i.groupCount)==null?0:n)<=0)&&this.materials.splice((r=i.index)==null?0:r,1);let a={index:this.materials.length,name:e||``,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:``,smooth:i===void 0?this.smooth:i.smooth,groupStart:i===void 0?0:i.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1,clone(){return this}};return t.clone=this.clone.bind(t),t}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t,n;let r=this.currentMaterial();if(r&&r.groupEnd===-1&&(r.groupEnd=this.geometry.index.length,r.groupCount=r.groupEnd-((t=r.groupStart)==null?0:t),r.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)((n=this.materials[e].groupCount)==null?0:n)<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),r}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)}finalize(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)}parseVertexIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3}parseNormalIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3}parseUVIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2}addFace(e,t,n,r,i,a,o,s,c){let l=this.object.geometry,u=this.vertices.length,d=this.normals.length,f=this.uvs.length,p=this.parseVertexIndex(e,u),m=this.parseVertexIndex(t,u),h=this.parseVertexIndex(n,u),g=o===void 0?void 0:this.parseNormalIndex(o,d),_=s===void 0?void 0:this.parseNormalIndex(s,d),v=c===void 0?void 0:this.parseNormalIndex(c,d),y=r===void 0?void 0:this.parseUVIndex(r,f),b=i===void 0?void 0:this.parseUVIndex(i,f),x=a===void 0?void 0:this.parseUVIndex(a,f);(l.hasNormal===!0&&g===void 0||_===void 0||v===void 0)&&(l.hasNormal=!1),(l.hasUV===!0&&y===void 0||b===void 0||x===void 0)&&(l.hasUV=!1);let S=[p,y,g].join(`:`),C=l.indexMap[S];C===void 0&&(C=l.vertices.length/3,l.indexMap[S]=C,l.vertices.push(this.vertices[p+0],this.vertices[p+1],this.vertices[p+2]),l.hasColor&&(this.colors[p]===void 0?l.hasColor=!1:l.colors.push(this.colors[p+0],this.colors[p+1],this.colors[p+2])),l.hasNormal&&l.normals.push(this.normals[p+0],this.normals[p+1],this.normals[p+2]),l.hasUV&&l.uvs.push(this.uvs[y+0],this.uvs[y+1])),l.index.push(C);let w=[m,b,_].join(`:`),T=l.indexMap[w];T===void 0&&(T=l.vertices.length/3,l.indexMap[w]=T,l.vertices.push(this.vertices[m+0],this.vertices[m+1],this.vertices[m+2]),l.hasColor&&(this.colors[m]===void 0?l.hasColor=!1:l.colors.push(this.colors[m+0],this.colors[m+1],this.colors[m+2])),l.hasNormal&&l.normals.push(this.normals[m+0],this.normals[m+1],this.normals[m+2]),l.hasUV&&l.uvs.push(this.uvs[b+0],this.uvs[b+1])),l.index.push(T);let E=[h,x,v].join(`:`),D=l.indexMap[E];D===void 0&&(D=l.vertices.length/3,l.indexMap[E]=D,l.vertices.push(this.vertices[h+0],this.vertices[h+1],this.vertices[h+2]),l.hasColor&&(this.colors[h]===void 0?l.hasColor=!1:l.colors.push(this.colors[h+0],this.colors[h+1],this.colors[h+2])),l.hasNormal&&l.normals.push(this.normals[h+0],this.normals[h+1],this.normals[h+2]),l.hasUV&&l.uvs.push(this.uvs[x+0],this.uvs[x+1])),l.index.push(D)}};function Td(e){let t=new wd;e.indexOf(`\r
|
|
832
832
|
`)!==-1&&(e=e.replace(/\r\n/g,`
|
|
833
833
|
`)),e.indexOf(`\\
|
|
834
834
|
`)!==-1&&(e=e.replace(/\\\n/g,``));let n=e.split(`
|
|
@@ -2236,7 +2236,7 @@ void main() {
|
|
|
2236
2236
|
#include <premultiplied_alpha_fragment>
|
|
2237
2237
|
|
|
2238
2238
|
}
|
|
2239
|
-
`},lv=class extends c.ShaderMaterial{constructor(e){super({uniforms:c.UniformsUtils.clone(cv.uniforms),vertexShader:cv.vertexShader,fragmentShader:cv.fragmentShader,clipping:!0}),this.type=`LineMaterial`,this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get(){return this.uniforms.diffuse.value},set(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get(){return this.uniforms.linewidth.value},set(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get(){return this.uniforms.dashScale.value},set(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get(){return this.uniforms.dashSize.value},set(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get(){return this.uniforms.gapSize.value},set(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}}}),this.setValues(e)}};Object.assign(lv.prototype,{isLineMaterial:!0});var uv=class extends c.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new sv:e,this.material=t===void 0?new lv({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),i=new c.Vector3,a=new c.Vector3;for(var o=0,s=0,l=t.count;o<l;o++,s+=2)i.fromBufferAttribute(t,o),a.fromBufferAttribute(n,o),r[s]=s===0?0:r[s-1],r[s+1]=r[s]+i.distanceTo(a);let u=new c.InstancedInterleavedBuffer(r,2,1);return e.setAttribute(`instanceDistanceStart`,new c.InterleavedBufferAttribute(u,1,0)),e.setAttribute(`instanceDistanceEnd`,new c.InterleavedBufferAttribute(u,1,1)),this}raycast(e,t){e.camera===null&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.`);let n=e.ray,r=e.camera,i=r.projectionMatrix,a=this.geometry,o=this.material,s=o.resolution,l=o.linewidth,u=a.attributes.instanceStart,d=a.attributes.instanceEnd,f=new c.Vector4,p=new c.Vector4,m=new c.Vector4,h=new c.Vector3,g=new c.Matrix4,_=new c.Line3,v=new c.Vector3;n.at(1,m),m.w=1,m.applyMatrix4(r.matrixWorldInverse),m.applyMatrix4(i),m.multiplyScalar(1/m.w),m.x*=s.x/2,m.y*=s.y/2,m.z=0,h.copy(m);let y=this.matrixWorld;g.multiplyMatrices(r.matrixWorldInverse,y);for(var b=0,x=u.count;b<x;b++){f.fromBufferAttribute(u,b),p.fromBufferAttribute(d,b),f.w=1,p.w=1,f.applyMatrix4(g),p.applyMatrix4(g),f.applyMatrix4(i),p.applyMatrix4(i),f.multiplyScalar(1/f.w),p.multiplyScalar(1/p.w);var S=f.z<-1&&p.z<-1,C=f.z>1&&p.z>1;if(S||C)continue;f.x*=s.x/2,f.y*=s.y/2,p.x*=s.x/2,p.y*=s.y/2,_.start.copy(f),_.start.z=0,_.end.copy(p),_.end.z=0;let e=_.closestPointToPointParameter(h,!0);_.at(e,v);let r=c.MathUtils.lerp(f.z,p.z,e),a=r>=-1&&r<=1;var w=h.distanceTo(v)<l*.5;if(a&&w){_.start.fromBufferAttribute(u,b),_.end.fromBufferAttribute(d,b),_.start.applyMatrix4(y),_.end.applyMatrix4(y);var T=new c.Vector3,E=new c.Vector3;n.distanceSqToSegment(_.start,_.end,E,T),t.push({point:E,pointOnLine:T,distance:n.origin.distanceTo(E),object:this,faceIndex:b})}}}};Object.assign(uv.prototype,{isLineSegments2:!0});var dv=class extends uv{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(dv.prototype,{isLine2:!0});var fv=class extends sv{constructor(){super(),this.type=`LineGeometry`}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}fromLine(e){let t=e.geometry;if(t instanceof c.Geometry){let e=new c.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof c.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}copy(){return this}};Object.assign(fv.prototype,{isLineGeometry:!0});var pv=14467195,mv=8,hv=2,gv=20,_v=null,vv=class extends c.Object3D{static get version(){return`6.8.0-alpha.20`}constructor(e=new c.Vector3,t=new c.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0,this.line=new dv(new fv,new lv({color:pv,linewidth:hv,dashScale:gv,dashed:!1}));let n=new c.BufferGeometry,r=new c.PointsMaterial({color:pv,size:mv,map:_v||(_v=new c.TextureLoader().load(`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`)),sizeAttenuation:!1,transparent:!0});this.points=new c.Points(n,r),this.points.renderOrder=11,this.points.frustumCulled=!1,this.setPoints(e,t),this.add(this.line,this.points)}setPoints(e,t){let n=[].concat(e.toArray(),t.toArray());this.points.geometry.setAttribute(`position`,new c.BufferAttribute(new Float32Array(n),3)),this.line.geometry.setPositions(n),this.line.computeLineDistances(),this.needsRender=!0}getPoints(){let e=this.points.geometry.attributes.position.array;return[new c.Vector3(e[0],e[1],e[2]),new c.Vector3(e[3],e[4],e[5])]}setMaterial(e){let t=this.line.material;for(let n in e){if(!e.hasOwnProperty(n))continue;let r=e[n];n===`dashed`?(t.dashed=r,r?t.defines.USE_DASH=``:delete t.defines.USE_DASH,t.needsUpdate=!0):t[n]=e[n]}this.needsRender=!0}setResolution(e,t){let n=this.line.material.resolution;(n.x!==e||n.y!==t)&&(n.set(e,t),this.needsRender=!0)}};Object.assign(vv.prototype,{isFiveLine:!0});var yv={Handedness:Object.freeze({NONE:`none`,LEFT:`left`,RIGHT:`right`}),ComponentState:Object.freeze({DEFAULT:`default`,TOUCHED:`touched`,PRESSED:`pressed`}),ComponentProperty:Object.freeze({BUTTON:`button`,X_AXIS:`xAxis`,Y_AXIS:`yAxis`,STATE:`state`}),ComponentType:Object.freeze({TRIGGER:`trigger`,SQUEEZE:`squeeze`,TOUCHPAD:`touchpad`,THUMBSTICK:`thumbstick`,BUTTON:`button`}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:`transform`,VISIBILITY:`visibility`})};function bv(e){return Vo(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function xv(e){return Vo(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield bv(`${e}/profilesList.json`)})}function Sv(e,t){return Vo(this,arguments,void 0,function*(e,t,n=null,r=!0){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No basePath supplied`);let i=yield xv(t),a;if(e.profiles.some(e=>{let n=i[e];return n&&(a={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!n)throw Error(`No matching profile name found`);let e=i[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);a={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let o=yield bv(a.profilePath),s;if(r){let t;if(t=o.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${a.profileId}`);t.assetPath&&(s=a.profilePath.replace(`profile.json`,t.assetPath))}return{profile:o,assetPath:s}})}var Cv={xAxis:0,yAxis:0,button:0,state:yv.ComponentState.DEFAULT};function wv(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var Tv=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===yv.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Cv)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:i,normalizedYAxis:a}=wv(e,t);switch(this.componentProperty){case yv.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?i:.5;break;case yv.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case yv.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case yv.ComponentProperty.STATE:this.valueNodeProperty===yv.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Ev=class{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw Error(`Invalid arguments supplied`);this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(e=>{let n=new Tv(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:yv.ComponentState.DEFAULT,button:this.gamepadIndices.button===void 0?void 0:0,xAxis:this.gamepadIndices.xAxis===void 0?void 0:0,yAxis:this.gamepadIndices.yAxis===void 0?void 0:0}}get data(){return Object.assign({id:this.id},this.values)}updateFromGamepad(e){if(this.values.state=yv.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){let t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=yv.ComponentState.PRESSED:(t.touched||this.values.button>yv.ButtonTouchThreshold)&&(this.values.state=yv.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===yv.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>yv.AxisTouchThreshold&&(this.values.state=yv.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===yv.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>yv.AxisTouchThreshold&&(this.values.state=yv.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},Dv=class{constructor(e,t,n){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No profile supplied`);this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(e=>{let t=this.layoutDescription.components[e];this.components[e]=new Ev(e,t)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){let e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}},Ov=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,kv=`generic-trigger`,Av=class extends c.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof c.Mesh&&e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:n,maxNode:r,value:i,valueNodeProperty:a}=e;t&&(a===yv.VisualResponseProperty.VISIBILITY?t.visible=i:a===yv.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))})}))}};function jv(e,t){Object.values(e.components).forEach(e=>{let{type:n,touchPointNodeName:r,visualResponses:i}=e;if(n===yv.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(r),e.touchPointNode){let t=new c.Mesh(new c.SphereGeometry(.001),new c.MeshBasicMaterial({color:255}));e.touchPointNode.add(t)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(i).forEach(e=>{let{valueNodeName:n,minNodeName:r,maxNodeName:i,valueNodeProperty:a}=e;if(a===yv.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(r),e.maxNode=t.getObjectByName(i),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=t.getObjectByName(n),e.valueNode||console.warn(`Could not find ${n} in the model`)})})}function Mv(e,t){jv(e.motionController,t),e.envMap&&t.traverse(t=>{t instanceof c.Mesh&&t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)}),e.add(t)}var Nv=class{constructor(e=null){this.gltfLoader=e,this.path=Ov,this._assetCache={}}createControllerModel(e){let t=new Av,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||Sv(r,this.path,kv).then(({profile:e,assetPath:i})=>{t.motionController=new Dv(r,e,i);let a=this._assetCache[t.motionController.assetUrl];if(a)n=a.scene.clone(),Mv(t,n);else{if(!this.gltfLoader)throw Error(`GLTFLoader not set.`);this.gltfLoader.load(t.motionController.assetUrl,e=>{this._assetCache[t.motionController.assetUrl]=e,n=e.scene.clone(),Mv(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},Pv=Object.assign({},hr(Xg,[`maxLatitude`,`minLatitude`]));function Fv(e,t){if(!t)return e;let n=e.match(/\d+_[a-z].png/);return e.substring(0,n.index)+t+`/`+e.substring(n.index)}var Iv=300,Lv=new c.Raycaster,Rv=new c.Vector3,zv={Floorplan:Xh,Topview:Qh,Panorama:Zg,VRPanorama:H_,Model:q_,Mapview:$_,XRPanorama:class e extends Zg{static parseArgs(t){if(t instanceof e)return t;let n=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return super.parseArgs(n)}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`XRPanorama`})}constructor(e){super(e),this.xrManager=new ov(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,$(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,$(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new c.Raycaster,right:new c.Raycaster},this.xrControllerRay.left.params.Points={threshold:.1},this.xrControllerRay.left.firstHitOnly=!0,this.xrControllerRay.left.floorIndex=-1,this.xrControllerRay.right.params.Points={threshold:.1},this.xrControllerRay.right.firstHitOnly=!0,this.xrControllerRay.right.floorIndex=-1,this.gazeRay=null,this.pointerLines={left:new vv,right:new vv},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new c.Group,new c.Group];let t=this.xrManager.getController(0);this.controllerWrappers[0].add(t);let n=this.xrManager.getController(1);this.controllerWrappers[1].add(n);let r=new Nv;r.gltfLoader={load(e,t){pr.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return ns(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:pr})}).then(e=>t(e))}},(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`)&&this.scene.add(this.pointerLines.left,this.pointerLines.right,this.controllerWrappers[0],this.controllerWrappers[1]),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=nn()]={panoId:Q(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:`fade`,effectEasing:Kg,fixCameraTransform:new c.Matrix4},this.parallaxCameraMatrixs=[];let i=ri.shared.getContext();if(!i){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(i),this.on(`xr.session.start`,()=>{let e=this.xrManager.getControllerGrip(0);e.add(r.createControllerModel(e)),this.controllerWrappers[0].add(e);let t=this.xrManager.getControllerGrip(1);t.add(r.createControllerModel(t)),this.controllerWrappers[1].add(t)}),this.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},this.xrManager.machineType===`VP`&&this.initHandEvent()}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}moveToPano(e,t,n){var r,i,a;let o=(r=t.effect)==null?`fade`:r;this.userAction=n,this.stopMomentumMovement();let s=Q(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoIndex`);let u=Yr(l.images.up),d=this.imageOptions.size;d===void 0&&l&&u&&(d=Number(u)),d===void 0&&(d=2048);let f=this.imageOptions.transform,p=(e,t)=>Fv(qr(e,f,t)),m=Object.assign({key:`pano.${s}`},mr(this.imageOptions,[`format`,`size`,`quality`])),h={right:l.images.work.getURL(l.images.right),left:l.images.work.getURL(l.images.left),up:l.images.work.getURL(l.images.up),down:l.images.work.getURL(l.images.down),front:l.images.work.getURL(l.images.front),back:l.images.work.getURL(l.images.back)},g=`pano:`+pp([h,m,f]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;{let t=this.pendingTextureTask.panoId;(i=this.panoMeshes.get(t))==null||i.setProgress(0),this.emit(`pano.texture.abort`,$(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let{pano0:_,pano1:v}=this.modelScene.parameter.resolveValue(),y;if((_==null?void 0:_.map.name)===g?y=_:(v==null?void 0:v.map.name)===g&&(y=v),y){let n={panoId:s,effect:o,effectEasing:(a=t.effectEasing)==null?Kg:a,leftPanoPicture:{panoId:y.panoId,map:y.map,mapHistogram:y.mapHistogram,mapSize:y.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};this.doMoveToPano(e,n,t);return}let b=`move-to-pano-`+s;this.pending.add(b),this.pendingTextureTask={panoId:s,hash:g,onLoad:n=>{var r,i;let a=n.body;if(this.destroyed)a.dispose();else{a.name=g;let n=Array.isArray(a.image)?a.image[0]:a.image,u=(r=n==null?void 0:n.width)==null?2048:r,d=new _m().formPixels(Vh(this.renderer,a,!0,pm).data),f={panoId:s,effect:o,effectEasing:(i=t.effectEasing)==null?Kg:i,leftPanoPicture:{panoId:s,map:a,mapSize:u,mapHistogram:new c.Vector4().fromArray(d.toArray()),matrix:l.matrix.clone(),zoom:1},position:l.position.clone(),fixCameraTransform:new c.Matrix4};this.doMoveToPano(e,f,t)}},onError:n=>{let r=Object.assign(Object.assign(Object.assign({},e),{mode:this.mode}),jh(this.camera.pose));this.emit(`pano.error`,$(`pano.error`,{error:n,userAction:this.userAction,options:t,prevPano:this.currentPano,progress:0,state:r})),this.emit(`pano.cancel`,$(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,progress:0,state:r})),t.moveCancelCallback&&t.moveCancelCallback()}};let x=this.panoMeshes.get(s);x&&x.tap&&x.tap(),this.textureLoader.loadCubeTexture(h,{imageURL:{transform:p,options:m},format:c.RGBFormat,fetcher:_f(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;((n=this.pendingTextureTask)==null?void 0:n.hash)===g&&((r=this.panoMeshes.get(s))==null||r.setProgress(t)),this.emit(`pano.texture.progress`,$(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e}))},this.renderer).then(t=>{var n,r;this.pending.delete(b),((n=this.pendingTextureTask)==null?void 0:n.hash)===g?(this.pendingTextureTask.onLoad(t),this.pendingTextureTask=void 0,(r=this.panoMeshes.get(s))==null||r.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,$(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}))}).then(()=>new Promise(e=>{ri.shared.add(()=>e(),!0)})).catch(t=>{var n,r;this.pending.delete(b),((n=this.pendingTextureTask)==null?void 0:n.hash)===g&&(this.pendingTextureTask.onError(t),this.pendingTextureTask=void 0,(r=this.panoMeshes.get(s))==null||r.setProgress(0)),this.emit(`pano.texture.error`,$(`pano.texture.error`,{error:t,progress:0,meta:null,pano:e})),this.emit(`error`,t)}),this.emit(`pano.texture.load`,$(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}doMoveToPano(e,t,n={}){var r,i,a,o,s,l,u,d,f,p;let m=U(),h=nn();this.panoResources[h]=t;let g,_,v;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(n).position,a=t.position;g=Math.max(i.distanceTo(a),1),_=[{key:n.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:h,progress:1,value:{distance:0,count:1}}],v=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(n).position,o=t.position,s=n.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;g=c+Math.max(a.distanceTo(o),1),_=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:c/g,value:n.value},{key:h,progress:1,value:{count:n.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(_);v=this.locationMotion.getProgressVelocity(m)*l/u}let y=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?g:0),b={longitude:n.longitude,latitude:n.latitude,fov:n.fov},x=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(r=b.longitude)==null?this.camera.pose.longitude:r,latitude:(i=b.latitude)==null?this.camera.pose.latitude:i,fov:(a=b.fov)==null?this.camera.pose.fov:a,offset:t.position.clone(),distance:0}),S=this.currentPano;if(this.emit(`pano.moveTo`,$(`pano.moveTo`,{options:n,prevPano:S,progress:0,state:x,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(x),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute(`src`)&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute(`uuid`),this.videoTexture.image.removeAttribute(`src`),this.videoTexture.image.oncanplay=q,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(b,y).catch(q);else{let e=Vt({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=Vt({longitude:(o=b.longitude)==null?this.cameraMotion.value.longitude:o,latitude:(s=b.latitude)==null?this.cameraMotion.value.latitude:s}),r=new c.Object3D;r.lookAt(e);let i=new c.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let a=new c.Matrix4().makeRotationFromQuaternion(r.quaternion),m=new c.Matrix4().getInverse(i).premultiply(a),h=this.cameraMotion.value.fov,g=(l=b.fov)==null?this.cameraMotion.value.fov:l,v=1;t.effect===`zoomin`?v=1.5:t.effect===`zoomout`&&(v=.4);let x=g*v;for(let e=0;e<_.length-1;e++){let t=_[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(m),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(x/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(u=b.longitude)==null?this.cameraMotion.value.longitude:u,latitude:(d=b.latitude)==null?this.cameraMotion.value.latitude:d,fov:x}},{progress:1,value:{longitude:(f=b.longitude)==null?this.cameraMotion.value.longitude:f,latitude:(p=b.latitude)==null?this.cameraMotion.value.latitude:p,fov:g}}],y).catch(q)}this.locationMotion.setKeyframes(_,y,v).then(()=>{for(let e of this.modelScene.children)e instanceof If&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:0});this.emit(`pano.arrived`,$(`pano.arrived`,{options:n,prevPano:S,progress:1,state:t,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(t);let r=this.works.getObserver(this.currentPano);if(r&&r.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:r.images.video.size.clone(),matrix:r.images.video.matrix.clone(),panoMatrix:r.matrix.clone().premultiply(r.work.transform),alpha:1},t=nn(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),rg().then(i=>{i&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=q,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=q,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}},()=>{this.emit(`pano.cancel`,$(`pano.cancel`,{options:n,prevPano:S,progress:0,state:x,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}checkSelectedPano(e){var t;this.stopMomentumMovement(),this.camera.getDirection(new c.Vector3).setY(0);let n=null,r=this.works.getObserver(this.currentPano);if(!r)return null;let i=r.work.observers,a=r.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let t=i[e];return!t||Rv.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[o]=this.modelScene.intersectRaycaster(e);if(o){let[e,r]=Nl(a,e=>{let t=i[e];return t?Rv.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(o.point):1/0},!0);typeof e==`number`&&r<this.panoTapTriggerRadius&&(n=(t=i[e])==null?null:t)}if(ev(n)){let t=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);t&&(n=t)}for(let e of this.locationMotion.keyframes){let t=this.panoResourceFromLocationMotionKeyframe(e);if(!(e.progress<this.locationMotion.progress)&&n){let e=Q({panoIndex:n.panoIndex,workCode:n.work.workCode});if(t.panoId===e){n=null;break}}}if(ev(n))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!n.active){let e=Q({panoIndex:n.panoIndex,workCode:n.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let s={workCode:n.work.workCode,panoIndex:n.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:n?n.position.clone():new c.Vector3};return this.emit(`pano.select`,$(`pano.select`,{prevPano:this.currentPano,state:s,userAction:!0,options:{},progress:0,error:null})),n&&n.active?(this.emit(`pano.request`,$(`pano.request`,{userAction:!0,prevPano:this.currentPano,progress:0,state:s,options:{},error:null})),{workCode:n.work.workCode,panoIndex:n.panoIndex}):null}destroy(){super.destroy()}isReady(){return!1}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,t,...n){var r,i,a,o,s,l,u,d,f;this.userAction=!0;let p={},m={},h=this.camera.getDirection(new c.Vector3),g=this.locationMotion.keyframes[0],_=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[v,y]=this.locationMotion.getKeyFrameSegment(e),b=this.panoResourceFromLocationMotionKeyframe(v),x=this.panoResourceFromLocationMotionKeyframe(y),S=this.panoResourceFromLocationMotionKeyframe(g),C=this.panoResourceFromLocationMotionKeyframe(_),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(W(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-y.value.count+1,n=new c.Vector3().copy(b.position),a=new c.Vector3().copy(x.position);if(p.progress=t,t>=.01&&t<=.99&&(p.progress=W(x.effectEasing(t),.01,.99)),x.leftPanoPicture&&(t<1?b.leftPanoPicture&&(p.pano0=b.leftPanoPicture):p.pano0=x.leftPanoPicture,p.pano1=x.leftPanoPicture),x.effect===`montage`?p.transition=`BLACK`:x.effect===`spread`?p.transition=`SPREAD`:p.transition=`FADE`,x.effect===`zoomin`||x.effect===`zoomout`?p.progress=Math.pow(t,3):x.effect===`model`&&this.camera.pose.distance<.01&&(p.modelAlpha=1-Math.pow(W(Math.abs(t-.5)*2,0,1),4)),t<1&&x.effect!==`fly`){if(p.pano0&&b.leftPanoPicture){let e={panoId:p.pano0.panoId,map:p.pano0.map,mapHistogram:p.pano0.mapHistogram,mapSize:p.pano0.mapSize,zoom:p.pano0.zoom,matrix:b.leftPanoPicture.matrix.clone().setPosition(x.position)},t=this.panoPictureObserverMap.get(p.pano0);t&&this.panoPictureObserverMap.set(e,t),p.pano0=e}n.copy(a),w=!0}m.distance=this.locationMotion.value.distance,m.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((r=p.pano0)==null?void 0:r.map)||e===((i=p.pano1)==null?void 0:i.map))continue;e.dispose(),t.leftPanoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}let l=hp(x.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,$(`pano.moving`,{userAction:this.userAction,prevPano:hp(S.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},hp(C.panoId)),{mode:this.mode}),jh(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(m),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);let[T,E]=n,D=new c.Vector3(0,0,0),O=new c.Vector2().copy(this.camera.resolution);if(E&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let n=this.xrManager.cameraVR,r=this.xrManager.referenceSpace,i=this.xrManager.session.renderState.baseLayer,l=E.getViewerPose(r),u=(a=l==null?void 0:l.views)==null?[]:a;for(let e=0;e<u.length;e++){let t=u[e],r=n.cameras[e],a=i.getViewport(t);a&&(r.projectionMatrix.fromArray(t.projectionMatrix),r.projectionMatrixInverse.getInverse(r.projectionMatrix),r.matrix.fromArray(t.transform.matrix),r.matrix.setPosition(this.camera.position),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixWorld.copy(r.matrix),r.matrixWorldInverse.getInverse(r.matrixWorld),r.matrixAutoUpdate=!1,D.copy(r.position),r.viewport.set(a.x,a.y,a.width,a.height),O.set(a.width,a.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((o=m.distance)==null?this.camera.pose.distance:o),this.xrManager.session.inputSources){for(let e=0;e<this.xrManager.session.inputSources.length;e++)if(this.xrManager.session.inputSources[e]&&this.xrManager.session.inputSources[e].targetRayMode===`transient-pointer`){let t=E.getPose(this.xrManager.session.inputSources[e].targetRaySpace,r);if(t){let e=t.transform.orientation,n=new c.Quaternion(e.x,e.y,e.z,e.w),r=new c.Vector3(0,0,-1).applyQuaternion(n);this.gazeRay=new c.Raycaster(this.camera.position,r)}}}if(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`){let n=this.xrManager.session.inputSources;for(let e=0;e<n.length;e++){let t=this.xrManager.controllers[e],i=n[e];if(!i)continue;t&&t.update(i,E,r);let a=this.xrManager.getController(e),o=new c.Vector3(0,1.2,0),l=a.position.clone().add(D).sub(o);i.handedness===`left`?this.xrControllerRay.left.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)):i.handedness===`right`&&this.xrControllerRay.right.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)),this.controllerWrappers[e].position.copy(new c.Vector3(0,0,0).add(D).sub(o));let u=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(u.length===0){let e=this.works.getResolvedObserver(this.currentPano);u=this.xrControllerRay.right.intersectObject(this.modelScene.boundingMesh,!0).map(t=>{var n;let r=(n=e==null?void 0:e.floorIndex)==null?0:n;return Object.assign({floorIndex:r,floor:r},t)})}if(u.length>=1&&u[0].face)if(i.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=u[0].face.normal,n=t.clone(),r=u[0].point.clone();this.intersectMesh.position.copy(r);let i=r.clone().add(n);if(this.intersectMesh.lookAt(i),Math.abs(t.y)>.99){let e=this.camera.position.clone().sub(r);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,e.length>0?(this.pointerLines.right.setPoints(l,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(l,u[0].point));let a=u[0],o=$(`intersect.update`,{raycaster:(s=this.xrControllerRay.right)==null?null:s,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(l,u[0].point)}this.updateControllerHelper(n,e,t)}}else E||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);Ph(p)===!1&&this.modelScene.parameter.set(p),this.emit(`camera.update`,$(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),jh(this.camera.pose))}));let k=this.works.getResolvedObserver(this.currentPano),A=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,j=this.works.getObserver(b.panoId),M=this.works.getObserver(x.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&k){let e=[],t=k.work.observers;for(let n of k.accessibleNodes){let r=t[n];r&&e.push(r)}let n=new Map;if(e.sort((e,t)=>{let r=n.get(e);r===void 0&&(r=e.standingPosition.distanceTo(k.standingPosition),n.set(e,r));let i=n.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(k.standingPosition),n.set(t,i)),r-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let t=e[this.accessibleObserverFloorCheckCount],n=this.modelScene.models.find(e=>e.work===(t==null?void 0:t.work));if(t&&n&&n.visible){let e=.3,r=.005,i=t.standingPosition.clone().applyMatrix4(t.work.transform),a=Q({panoIndex:t.panoIndex,workCode:t.work.workCode}),o=Yg.map(t=>{Lv.ray.origin.copy(i),Lv.ray.origin.add(Rv.copy(t).setY(e)),Lv.ray.direction.set(0,-1,0),Lv.firstHitOnly=!0,Lv.floorIndex=-1;let[a]=n.intersectRaycaster(Lv);return a&&a.distance-r<=e?new c.Vector3().copy(i).setY(a.point.y+r):i});o.sort((e,t)=>t.y-e.y);let s=o[Math.floor(o.length/2)],[l]=o.filter(e=>e.distanceTo(s)<=.05);if(l){let e=new c.Vector4(i.x,i.y,i.z,l.y-i.y),t=this.adjustPanoCircleMeshPositionFix.get(a);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(a,e)}}this.accessibleObserverFloorCheckCount++}}let N=new Map;if(j)for(let e of j.accessibleNodes){let t=j.work.observers[e];if(t){let e=Q({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(M)for(let e of M.accessibleNodes){let t=M.work.observers[e];if(t){let e=Q({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{N.get(t)?N.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),N.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),N.delete(t)}),this.panoMeshes.forEach((e,t)=>{let n=this.works.getObserver(t);if(n){let r=n.position.distanceTo(n.standingPosition)>this.aerialObserverMinHeight;if(r)e.position.copy(n.position).applyMatrix4(n.work.transform),e.scale.setScalar(18);else{e.position.copy(n.standingPosition).applyMatrix4(n.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(n.panoId);t&&(Rv.set(t.x,t.y,t.z),Rv.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let i=this.camera.position.clone().setY(e.position.y),a=new c.Vector3().copy(e.position).sub(i).normalize();if(t===Q(this.currentPano)){let t=W((.5-i.distanceTo(e.position))/.5,0,1);a.multiplyScalar(1-t).add(h.clone().multiplyScalar(t))}if(a.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(a.x,a.z);e.quaternion.setFromEuler(new c.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(k){let n=k.work.observers,[,r]=Nl(k.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:k.standingPosition.distanceTo(t.standingPosition)},!0);r=W(r,2.5,1/0);let i=k.accessibleNodes.concat(k.panoIndex).map(e=>Q({panoIndex:e,workCode:k.work.workCode}));this.panoMeshes.forEach((n,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=n.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&A!==null&&Q({panoIndex:A.panoIndex,workCode:A.work.workCode})===a;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=t<.01?0:W(r/t,.1,.85)}o&&o===M&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue().modelAlpha>0&&(c=0),n.setCurrent(s),n.setOpacity(c),n.updateTime&&n.updateTime(e,t)})}{let e=(l=this.modelScene.parameter.progress)==null?1:l,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,a;if(i&&(a=this.works.getObserver(i.panoId),a||(a=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(si()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!a||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Qr(i.mapSize)+1;this.tiling.setObserver(a);let o={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:i.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:e,level:4},s=this.tiling.update(o),c={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:Vu(Math.abs(((u=this.modelScene.parameter.progress)==null?0:u)-.5)*2)},l=this.modelScene.parameter.refinedScreen;(s||c.pano!==(l==null?void 0:l.pano)||c.opacity!==(l==null?void 0:l.opacity))&&this.modelScene.parameter.set(`refinedScreen`,c)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&k&&k.position.y-k.standingPosition.y>10){let e=W(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=x.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((d=this.modelScene.parameter.pano0Depth)==null?void 0:d.panoId)!==t.panoId||((f=this.modelScene.parameter.pano1Depth)==null?void 0:f.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,Gg(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,Gg(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}render(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){let e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}updateControllerHelper(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(!e||e.length===0)return;let a={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let o=0;o<e.length;o++){let s=e[o].handedness,c=e[o].gamepad;switch(s){case`left`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`LeftAxesDown`,t)),c!=null&&c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`X`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`Y`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`LeftTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n};a.buttons.X=c.buttons&&c.buttons[4]?c.buttons[4].pressed:!1,a.buttons.Y=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.LeftTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.LeftPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1,a.left=e;break;case`right`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`RightAxesDown`,t)),c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`A`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`B`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`RightTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`RightPinch`,t)),a.right={raycaster:i,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n},a.buttons.A=c.buttons&&c.buttons[4]?c==null?void 0:c.buttons[4].pressed:!1,a.buttons.B=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.RightTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.RightPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,$(`xr.controller.update`,a))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)this.xrHandleState[t].touchStart===!1?(this.xrHandleState[t].touchStartTime=n,this.xrHandleState[t].touchStart=!0,this.emit(`xr.gesture.buttonDown`,$(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrHandleState[t].touchStartTime>Iv&&this.emit(`xr.gesture.press`,$(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,$(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrHandleState[t].touchStartTime<=Iv){let e=$(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}});!this.emit(`xr.gesture.tap`,e)&&!e.defaultPrevented&&t===`RightTrigger`&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[t].touchStart=!1,this.xrHandleState[t].touchStartTime=0}}initHandEvent(){if(!this.xrManager.session)throw Error(`初始化失败`);this.xrManager.session.addEventListener(`select`,e=>{this.gazeRay&&this.checkSelectedPano(this.gazeRay)})}}},Bv={Floorplan:Yh,Topview:Zh,Panorama:Xg,VRPanorama:V_,Model:K_,Mapview:Q_,XRPanorama:Pv},Vv=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.create,initAnimation.start,initAnimation.end,camera.update,intersect.update,pano.select,pano.moveTo,pano.moving,pano.arrived,pano.cancel,pano.error,pano.texture.load,pano.texture.progress,pano.texture.success,pano.texture.error,pano.texture.abort,xr.session.start,xr.session.end,xr.gesture.tap,xr.gesture.press,xr.gesture.buttonUp,xr.gesture.buttonDown,xr.controller.update`.split(`,`);function Hv(e){e.on(`initAnimation.start`,t=>{e.emit(`initAnimationWillStart`,t.state.panoIndex,t.state,t.userAction)}),e.on(`initAnimation.end`,t=>{e.emit(`initAnimationEnded`,t.state.panoIndex,t.state,t.userAction)}),e.on(`gesture.pan`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pan`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPanGesture`,t.state,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pan`,t.pointers,t.isFinal),e.emit(`panGesture`,t.state,t.isFinal))}),e.on(`gesture.tap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`tap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`tap`,t.pointers,t.isFinal),e.emit(`tapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.dbltap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`dbltap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsDblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`dbltap`,t.pointers,t.isFinal),e.emit(`dblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.press`,t=>{let n=!1;n=e.emit(`wantsGesture`,`press`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`press`,t.pointers,t.isFinal),e.emit(`pressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),e.on(`gesture.pinch`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pinch`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPinchGesture`,t.scale,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pinch`,t.pointers,t.isFinal),e.emit(`pinchGesture`,t.scale,t.state.fov,t.isFinal))}),e.on(`gesture.mousewheel`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseWheel`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsMouseWheel`,t.center.delta,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseWheel`,t.pointers,t.isFinal),e.emit(`mouseWheel`,t.center.delta,t.state.fov,t.isFinal))}),e.on(`gesture.mousemove`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseMove`,t.pointers,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseMove`,t.pointers,t.isFinal),n=e.emit(`wantsChangeCameraFov`,t.state.fov),n&&t.preventDefault())}),e.on(`gesture.momentum`,t=>{let n=!1;n=e.emit(`wantsInteriaPan`,t.state),n&&t.preventDefault(),t.defaultPrevented||e.emit(`interiaPan`,t.state,t.isFinal)}),e.on(`camera.update`,t=>{e.emit(`cameraFovUpdate`,t.state.fov,t.userAction),e.emit(`cameraDirectionUpdate`,t.state,t.userAction);let n=Vt(t.state);n.setLength(t.state.distance);let r=t.state.offset.clone().sub(n);e.emit(`cameraPositionUpdate`,r,t.userAction),e.emit(`cameraUpdate`,t.state,t.userAction)}),e.on(`intersect.update`,t=>{if(t.intersection){let n=!1;n=e.emit(`wantsShowIntersectionOnModel`,t.raycaster),n&&t.preventDefault(),t.defaultPrevented||e.emit(`intersectionOnModelUpdate`,t.intersection,t.object)}else e.emit(`intersectionHidden`)}),e.on(`pano.request`,t=>{let n=e.emit(`wantsMoveToPano`,t.state.panoIndex,t.options,t.userAction);n||(n=e.emit(`wantsToMoveToPano`,t.state.panoIndex,t.options,t.userAction)),n&&t.preventDefault(),t.defaultPrevented||e.emit(`panoWillLoad`,t.state.panoIndex)}),e.on(`pano.select`,t=>{e.emit(`panoSelected`,t.state.panoIndex)}),e.on(`pano.moveTo`,t=>{e.emit(`panoLoaded`,t.state.panoIndex),e.emit(`moveToPano`,t.state.panoIndex,t.userAction),e.emit(`panoWillArrive`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.moving`,t=>{e.emit(`movingToPano`,t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),e.on(`pano.arrived`,t=>{e.emit(`panoArrived`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.cancel`,t=>{e.emit(`moveToPanoCanceled`,t.state.panoIndex)}),e.on(`pano.error`,t=>{e.emit(`panoLoadError`,t.error,t.state.panoIndex)}),e.on(`pano.texture.load`,t=>{e.emit(`textureStartLoad`,t.pano.panoIndex)}),e.on(`pano.texture.success`,t=>{e.emit(`textureLoaded`,t.pano.panoIndex,t.meta)}),e.on(`pano.texture.error`,t=>{e.emit(`textureError`,t.error,t.pano.panoIndex)}),e.on(`pano.texture.abort`,t=>{e.emit(`textureAbort`,t.pano.panoIndex)}),e.on(`pano.texture.progress`,t=>{e.emit(`textureLoading`,t.progress,t.pano.panoIndex)}),e.on(`xr.session.start`,t=>{e.emit(`webXRSessionStart`)}),e.on(`xr.session.end`,t=>{e.emit(`webXRSessionEnd`)}),e.on(`xr.gesture.tap`,t=>{e.emit(`webXRControllerEvent`,`tap`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.press`,t=>{e.emit(`webXRControllerEvent`,`press`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonUp`,t=>{e.emit(`webXRControllerEvent`,`buttonUp`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonDown`,t=>{e.emit(`webXRControllerEvent`,`buttonDown`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.controller.update`,t=>{e.emit(`webXRControllerRayUpdate`,{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&e.emit(`webXRAxesUpdate`,`left`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&e.emit(`webXRAxesUpdate`,`right`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),e.on(`works.request`,t=>{e.emit(`willLoad`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.load`,t=>{e.emit(`load`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.ready`,t=>{e.emit(`loaded`,t.input,t.works[0])}),e.on(`state.change`,t=>{e.emit(`stateChange`,t.state,t.userAction)}),e.on(`currentState.change`,t=>{e.emit(`currentStateChange`,t.state,t.userAction)}),e.on(`state.set`,t=>{e.emit(`setState`,t.state)}),e.on(`state.synced`,t=>{e.emit(`stateSynced`,t.state)}),e.on(`model.request`,t=>{e.emit(`modelWillLoad`,t.work.model)}),e.on(`model.error`,t=>{e.emit(`modelLoadError`,t.error,t.model)}),e.on(`model.load`,t=>{e.emit(`modelLoaded`,t.model)}),e.on(`model.changeShownFloor`,t=>{e.emit(`modelShownFloorChange`,t.model.shownFloor,t.model.floorLength)}),e.on(`render`,t=>{e.emit(`renderFrame`,t.needsRender)}),e.on(`mode.change.request`,t=>{e.emit(`wantsChangeMode`,t.mode,t.prevMode)}),e.on(`mode.change`,t=>{e.emit(`modeChange`,t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),e.on(`helpers.visible`,t=>{e.emit(`helpersVisibleChange`,t.object.visible)}),e.on(`network.resource`,t=>{e.emit(`network`,t.source,t.requestType,t.requestState,t.detail)})}function Uv(){if(typeof window<`u`){let e=document.createElement(`video`);e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin=``;let t=()=>{document.removeEventListener(`touchstart`,t,!1),document.removeEventListener(`mousedown`,t,!1),e.muted=!1};return document.addEventListener(`touchstart`,t,!1),document.addEventListener(`mousedown`,t,!1),e}else return{}}function Wv(){let e=new c.Group;e.name=`internalLights`;{let t=new c.DirectionalLight(16777215,.1);t.name=`direction0`,t.position.copy(new c.Vector3(0,1,0)),e.add(t)}{let t=new c.DirectionalLight(16777215,.1);t.name=`direction1`,t.position.copy(new c.Vector3(-1,-1,-1)),e.add(t)}{let t=new c.DirectionalLight(16777215,.3);t.name=`direction2`,t.position.copy(new c.Vector3(1,1,1)),e.add(t)}{let t=new c.AmbientLight(16777215,.6);t.name=`ambient0`,e.add(t)}return e}function Gv(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function Kv(){var e;if(typeof document<`u`){let t=document.getElementsByTagName(`meta`);for(let n=0;n<t.length;n++){let r=t[n];if(r.getAttribute(`name`)===`viewport`){let t=Gv((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var qv=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==`,Jv=[351,63],Yv=[20,20],Xv=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Zv=new Float32Array([0,0,1,0,0,1,1,1]),Qv=new Uint8Array([0,1,2,1,3,2]),$v=new c.BufferGeometry;$v.setAttribute(`position`,new c.BufferAttribute(Xv,3)),$v.setAttribute(`uv`,new c.BufferAttribute(Zv,2)),$v.setIndex(new c.BufferAttribute(Qv,1));var ey=new c.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),ty=new c.Mesh($v,ey);ty.matrixAutoUpdate=!1;var ny=new c.Scene;ny.add(ty),ny.matrixAutoUpdate=!1;var ry=new c.OrthographicCamera(-.5,.5,.5,-.5,.1,1);ry.position.set(0,0,.5),ry.lookAt(0,0,0),ry.updateMatrixWorld(!0),ry.matrixAutoUpdate=!1;var iy=new c.Vector4,ay=new c.Vector4;function oy(e){if(ey.map){let t=e.getViewport(iy),n=e.getScissor(ay),r=e.getScissorTest(),i=e.autoClear,a=n.x+Yv[0]/3,o=n.y+Yv[1]/3,s=Jv[0]/3,c=Jv[1]/3;e.setViewport(a,o,s,c),e.setScissor(a,o,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(ny,ry),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{let e=new c.Texture,t=new Image;t.onload=()=>{e.image=t,e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,ey.needsUpdate=!0,t.onload=q},t.src=qv,ey.map=e}}var sy=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}async function t(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i)try{new URL(\`.\`,a).href}catch{}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==\`function\`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==\`function\`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(\`\\0asm\\0\\0\\0&\\\`\\\`}}\\\`}\\\`\\0\\\`\\v\\0\\\`\\0\\0\\x07aa\\0\\0\\b\\x07\\0\\0\\x07\\bA\\v\\x07b\\0c\\0\\x07d\\0e\\0f\\0\\f
|
|
2239
|
+
`},lv=class extends c.ShaderMaterial{constructor(e){super({uniforms:c.UniformsUtils.clone(cv.uniforms),vertexShader:cv.vertexShader,fragmentShader:cv.fragmentShader,clipping:!0}),this.type=`LineMaterial`,this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get(){return this.uniforms.diffuse.value},set(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get(){return this.uniforms.linewidth.value},set(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get(){return this.uniforms.dashScale.value},set(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get(){return this.uniforms.dashSize.value},set(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get(){return this.uniforms.gapSize.value},set(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}}}),this.setValues(e)}};Object.assign(lv.prototype,{isLineMaterial:!0});var uv=class extends c.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new sv:e,this.material=t===void 0?new lv({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),i=new c.Vector3,a=new c.Vector3;for(var o=0,s=0,l=t.count;o<l;o++,s+=2)i.fromBufferAttribute(t,o),a.fromBufferAttribute(n,o),r[s]=s===0?0:r[s-1],r[s+1]=r[s]+i.distanceTo(a);let u=new c.InstancedInterleavedBuffer(r,2,1);return e.setAttribute(`instanceDistanceStart`,new c.InterleavedBufferAttribute(u,1,0)),e.setAttribute(`instanceDistanceEnd`,new c.InterleavedBufferAttribute(u,1,1)),this}raycast(e,t){e.camera===null&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.`);let n=e.ray,r=e.camera,i=r.projectionMatrix,a=this.geometry,o=this.material,s=o.resolution,l=o.linewidth,u=a.attributes.instanceStart,d=a.attributes.instanceEnd,f=new c.Vector4,p=new c.Vector4,m=new c.Vector4,h=new c.Vector3,g=new c.Matrix4,_=new c.Line3,v=new c.Vector3;n.at(1,m),m.w=1,m.applyMatrix4(r.matrixWorldInverse),m.applyMatrix4(i),m.multiplyScalar(1/m.w),m.x*=s.x/2,m.y*=s.y/2,m.z=0,h.copy(m);let y=this.matrixWorld;g.multiplyMatrices(r.matrixWorldInverse,y);for(var b=0,x=u.count;b<x;b++){f.fromBufferAttribute(u,b),p.fromBufferAttribute(d,b),f.w=1,p.w=1,f.applyMatrix4(g),p.applyMatrix4(g),f.applyMatrix4(i),p.applyMatrix4(i),f.multiplyScalar(1/f.w),p.multiplyScalar(1/p.w);var S=f.z<-1&&p.z<-1,C=f.z>1&&p.z>1;if(S||C)continue;f.x*=s.x/2,f.y*=s.y/2,p.x*=s.x/2,p.y*=s.y/2,_.start.copy(f),_.start.z=0,_.end.copy(p),_.end.z=0;let e=_.closestPointToPointParameter(h,!0);_.at(e,v);let r=c.MathUtils.lerp(f.z,p.z,e),a=r>=-1&&r<=1;var w=h.distanceTo(v)<l*.5;if(a&&w){_.start.fromBufferAttribute(u,b),_.end.fromBufferAttribute(d,b),_.start.applyMatrix4(y),_.end.applyMatrix4(y);var T=new c.Vector3,E=new c.Vector3;n.distanceSqToSegment(_.start,_.end,E,T),t.push({point:E,pointOnLine:T,distance:n.origin.distanceTo(E),object:this,faceIndex:b})}}}};Object.assign(uv.prototype,{isLineSegments2:!0});var dv=class extends uv{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(dv.prototype,{isLine2:!0});var fv=class extends sv{constructor(){super(),this.type=`LineGeometry`}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}fromLine(e){let t=e.geometry;if(t instanceof c.Geometry){let e=new c.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof c.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}copy(){return this}};Object.assign(fv.prototype,{isLineGeometry:!0});var pv=14467195,mv=8,hv=2,gv=20,_v=null,vv=class extends c.Object3D{static get version(){return`6.8.0-alpha.21`}constructor(e=new c.Vector3,t=new c.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0,this.line=new dv(new fv,new lv({color:pv,linewidth:hv,dashScale:gv,dashed:!1}));let n=new c.BufferGeometry,r=new c.PointsMaterial({color:pv,size:mv,map:_v||(_v=new c.TextureLoader().load(`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`)),sizeAttenuation:!1,transparent:!0});this.points=new c.Points(n,r),this.points.renderOrder=11,this.points.frustumCulled=!1,this.setPoints(e,t),this.add(this.line,this.points)}setPoints(e,t){let n=[].concat(e.toArray(),t.toArray());this.points.geometry.setAttribute(`position`,new c.BufferAttribute(new Float32Array(n),3)),this.line.geometry.setPositions(n),this.line.computeLineDistances(),this.needsRender=!0}getPoints(){let e=this.points.geometry.attributes.position.array;return[new c.Vector3(e[0],e[1],e[2]),new c.Vector3(e[3],e[4],e[5])]}setMaterial(e){let t=this.line.material;for(let n in e){if(!e.hasOwnProperty(n))continue;let r=e[n];n===`dashed`?(t.dashed=r,r?t.defines.USE_DASH=``:delete t.defines.USE_DASH,t.needsUpdate=!0):t[n]=e[n]}this.needsRender=!0}setResolution(e,t){let n=this.line.material.resolution;(n.x!==e||n.y!==t)&&(n.set(e,t),this.needsRender=!0)}};Object.assign(vv.prototype,{isFiveLine:!0});var yv={Handedness:Object.freeze({NONE:`none`,LEFT:`left`,RIGHT:`right`}),ComponentState:Object.freeze({DEFAULT:`default`,TOUCHED:`touched`,PRESSED:`pressed`}),ComponentProperty:Object.freeze({BUTTON:`button`,X_AXIS:`xAxis`,Y_AXIS:`yAxis`,STATE:`state`}),ComponentType:Object.freeze({TRIGGER:`trigger`,SQUEEZE:`squeeze`,TOUCHPAD:`touchpad`,THUMBSTICK:`thumbstick`,BUTTON:`button`}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:`transform`,VISIBILITY:`visibility`})};function bv(e){return Vo(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function xv(e){return Vo(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield bv(`${e}/profilesList.json`)})}function Sv(e,t){return Vo(this,arguments,void 0,function*(e,t,n=null,r=!0){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No basePath supplied`);let i=yield xv(t),a;if(e.profiles.some(e=>{let n=i[e];return n&&(a={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!n)throw Error(`No matching profile name found`);let e=i[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);a={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let o=yield bv(a.profilePath),s;if(r){let t;if(t=o.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${a.profileId}`);t.assetPath&&(s=a.profilePath.replace(`profile.json`,t.assetPath))}return{profile:o,assetPath:s}})}var Cv={xAxis:0,yAxis:0,button:0,state:yv.ComponentState.DEFAULT};function wv(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var Tv=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===yv.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Cv)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:i,normalizedYAxis:a}=wv(e,t);switch(this.componentProperty){case yv.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?i:.5;break;case yv.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case yv.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case yv.ComponentProperty.STATE:this.valueNodeProperty===yv.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Ev=class{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw Error(`Invalid arguments supplied`);this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(e=>{let n=new Tv(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:yv.ComponentState.DEFAULT,button:this.gamepadIndices.button===void 0?void 0:0,xAxis:this.gamepadIndices.xAxis===void 0?void 0:0,yAxis:this.gamepadIndices.yAxis===void 0?void 0:0}}get data(){return Object.assign({id:this.id},this.values)}updateFromGamepad(e){if(this.values.state=yv.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){let t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=yv.ComponentState.PRESSED:(t.touched||this.values.button>yv.ButtonTouchThreshold)&&(this.values.state=yv.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===yv.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>yv.AxisTouchThreshold&&(this.values.state=yv.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===yv.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>yv.AxisTouchThreshold&&(this.values.state=yv.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},Dv=class{constructor(e,t,n){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No profile supplied`);this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(e=>{let t=this.layoutDescription.components[e];this.components[e]=new Ev(e,t)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){let e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}},Ov=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,kv=`generic-trigger`,Av=class extends c.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof c.Mesh&&e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:n,maxNode:r,value:i,valueNodeProperty:a}=e;t&&(a===yv.VisualResponseProperty.VISIBILITY?t.visible=i:a===yv.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))})}))}};function jv(e,t){Object.values(e.components).forEach(e=>{let{type:n,touchPointNodeName:r,visualResponses:i}=e;if(n===yv.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(r),e.touchPointNode){let t=new c.Mesh(new c.SphereGeometry(.001),new c.MeshBasicMaterial({color:255}));e.touchPointNode.add(t)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(i).forEach(e=>{let{valueNodeName:n,minNodeName:r,maxNodeName:i,valueNodeProperty:a}=e;if(a===yv.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(r),e.maxNode=t.getObjectByName(i),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=t.getObjectByName(n),e.valueNode||console.warn(`Could not find ${n} in the model`)})})}function Mv(e,t){jv(e.motionController,t),e.envMap&&t.traverse(t=>{t instanceof c.Mesh&&t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)}),e.add(t)}var Nv=class{constructor(e=null){this.gltfLoader=e,this.path=Ov,this._assetCache={}}createControllerModel(e){let t=new Av,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||Sv(r,this.path,kv).then(({profile:e,assetPath:i})=>{t.motionController=new Dv(r,e,i);let a=this._assetCache[t.motionController.assetUrl];if(a)n=a.scene.clone(),Mv(t,n);else{if(!this.gltfLoader)throw Error(`GLTFLoader not set.`);this.gltfLoader.load(t.motionController.assetUrl,e=>{this._assetCache[t.motionController.assetUrl]=e,n=e.scene.clone(),Mv(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},Pv=Object.assign({},hr(Xg,[`maxLatitude`,`minLatitude`]));function Fv(e,t){if(!t)return e;let n=e.match(/\d+_[a-z].png/);return e.substring(0,n.index)+t+`/`+e.substring(n.index)}var Iv=300,Lv=new c.Raycaster,Rv=new c.Vector3,zv={Floorplan:Xh,Topview:Qh,Panorama:Zg,VRPanorama:H_,Model:q_,Mapview:$_,XRPanorama:class e extends Zg{static parseArgs(t){if(t instanceof e)return t;let n=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return super.parseArgs(n)}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`XRPanorama`})}constructor(e){super(e),this.xrManager=new ov(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,$(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,$(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new c.Raycaster,right:new c.Raycaster},this.xrControllerRay.left.params.Points={threshold:.1},this.xrControllerRay.left.firstHitOnly=!0,this.xrControllerRay.left.floorIndex=-1,this.xrControllerRay.right.params.Points={threshold:.1},this.xrControllerRay.right.firstHitOnly=!0,this.xrControllerRay.right.floorIndex=-1,this.gazeRay=null,this.pointerLines={left:new vv,right:new vv},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new c.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new c.Group,new c.Group];let t=this.xrManager.getController(0);this.controllerWrappers[0].add(t);let n=this.xrManager.getController(1);this.controllerWrappers[1].add(n);let r=new Nv;r.gltfLoader={load(e,t){pr.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return ns(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:pr})}).then(e=>t(e))}},(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`)&&this.scene.add(this.pointerLines.left,this.pointerLines.right,this.controllerWrappers[0],this.controllerWrappers[1]),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=nn()]={panoId:Q(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:`fade`,effectEasing:Kg,fixCameraTransform:new c.Matrix4},this.parallaxCameraMatrixs=[];let i=ri.shared.getContext();if(!i){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(i),this.on(`xr.session.start`,()=>{let e=this.xrManager.getControllerGrip(0);e.add(r.createControllerModel(e)),this.controllerWrappers[0].add(e);let t=this.xrManager.getControllerGrip(1);t.add(r.createControllerModel(t)),this.controllerWrappers[1].add(t)}),this.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},this.xrManager.machineType===`VP`&&this.initHandEvent()}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}moveToPano(e,t,n){var r,i,a;let o=(r=t.effect)==null?`fade`:r;this.userAction=n,this.stopMomentumMovement();let s=Q(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoIndex`);let u=Yr(l.images.up),d=this.imageOptions.size;d===void 0&&l&&u&&(d=Number(u)),d===void 0&&(d=2048);let f=this.imageOptions.transform,p=(e,t)=>Fv(qr(e,f,t)),m=Object.assign({key:`pano.${s}`},mr(this.imageOptions,[`format`,`size`,`quality`])),h={right:l.images.work.getURL(l.images.right),left:l.images.work.getURL(l.images.left),up:l.images.work.getURL(l.images.up),down:l.images.work.getURL(l.images.down),front:l.images.work.getURL(l.images.front),back:l.images.work.getURL(l.images.back)},g=`pano:`+pp([h,m,f]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===g)return;{let t=this.pendingTextureTask.panoId;(i=this.panoMeshes.get(t))==null||i.setProgress(0),this.emit(`pano.texture.abort`,$(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let{pano0:_,pano1:v}=this.modelScene.parameter.resolveValue(),y;if((_==null?void 0:_.map.name)===g?y=_:(v==null?void 0:v.map.name)===g&&(y=v),y){let n={panoId:s,effect:o,effectEasing:(a=t.effectEasing)==null?Kg:a,leftPanoPicture:{panoId:y.panoId,map:y.map,mapHistogram:y.mapHistogram,mapSize:y.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};this.doMoveToPano(e,n,t);return}let b=`move-to-pano-`+s;this.pending.add(b),this.pendingTextureTask={panoId:s,hash:g,onLoad:n=>{var r,i;let a=n.body;if(this.destroyed)a.dispose();else{a.name=g;let n=Array.isArray(a.image)?a.image[0]:a.image,u=(r=n==null?void 0:n.width)==null?2048:r,d=new _m().formPixels(Vh(this.renderer,a,!0,pm).data),f={panoId:s,effect:o,effectEasing:(i=t.effectEasing)==null?Kg:i,leftPanoPicture:{panoId:s,map:a,mapSize:u,mapHistogram:new c.Vector4().fromArray(d.toArray()),matrix:l.matrix.clone(),zoom:1},position:l.position.clone(),fixCameraTransform:new c.Matrix4};this.doMoveToPano(e,f,t)}},onError:n=>{let r=Object.assign(Object.assign(Object.assign({},e),{mode:this.mode}),jh(this.camera.pose));this.emit(`pano.error`,$(`pano.error`,{error:n,userAction:this.userAction,options:t,prevPano:this.currentPano,progress:0,state:r})),this.emit(`pano.cancel`,$(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,progress:0,state:r})),t.moveCancelCallback&&t.moveCancelCallback()}};let x=this.panoMeshes.get(s);x&&x.tap&&x.tap(),this.textureLoader.loadCubeTexture(h,{imageURL:{transform:p,options:m},format:c.RGBFormat,fetcher:_f(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;((n=this.pendingTextureTask)==null?void 0:n.hash)===g&&((r=this.panoMeshes.get(s))==null||r.setProgress(t)),this.emit(`pano.texture.progress`,$(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e}))},this.renderer).then(t=>{var n,r;this.pending.delete(b),((n=this.pendingTextureTask)==null?void 0:n.hash)===g?(this.pendingTextureTask.onLoad(t),this.pendingTextureTask=void 0,(r=this.panoMeshes.get(s))==null||r.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,$(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}))}).then(()=>new Promise(e=>{ri.shared.add(()=>e(),!0)})).catch(t=>{var n,r;this.pending.delete(b),((n=this.pendingTextureTask)==null?void 0:n.hash)===g&&(this.pendingTextureTask.onError(t),this.pendingTextureTask=void 0,(r=this.panoMeshes.get(s))==null||r.setProgress(0)),this.emit(`pano.texture.error`,$(`pano.texture.error`,{error:t,progress:0,meta:null,pano:e})),this.emit(`error`,t)}),this.emit(`pano.texture.load`,$(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}doMoveToPano(e,t,n={}){var r,i,a,o,s,l,u,d,f,p;let m=U(),h=nn();this.panoResources[h]=t;let g,_,v;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(n).position,a=t.position;g=Math.max(i.distanceTo(a),1),_=[{key:n.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:h,progress:1,value:{distance:0,count:1}}],v=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(n).position,o=t.position,s=n.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;g=c+Math.max(a.distanceTo(o),1),_=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:c/g,value:n.value},{key:h,progress:1,value:{count:n.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(_);v=this.locationMotion.getProgressVelocity(m)*l/u}let y=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?g:0),b={longitude:n.longitude,latitude:n.latitude,fov:n.fov},x=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(r=b.longitude)==null?this.camera.pose.longitude:r,latitude:(i=b.latitude)==null?this.camera.pose.latitude:i,fov:(a=b.fov)==null?this.camera.pose.fov:a,offset:t.position.clone(),distance:0}),S=this.currentPano;if(this.emit(`pano.moveTo`,$(`pano.moveTo`,{options:n,prevPano:S,progress:0,state:x,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(x),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute(`src`)&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute(`uuid`),this.videoTexture.image.removeAttribute(`src`),this.videoTexture.image.oncanplay=q,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(b,y).catch(q);else{let e=Vt({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=Vt({longitude:(o=b.longitude)==null?this.cameraMotion.value.longitude:o,latitude:(s=b.latitude)==null?this.cameraMotion.value.latitude:s}),r=new c.Object3D;r.lookAt(e);let i=new c.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let a=new c.Matrix4().makeRotationFromQuaternion(r.quaternion),m=new c.Matrix4().getInverse(i).premultiply(a),h=this.cameraMotion.value.fov,g=(l=b.fov)==null?this.cameraMotion.value.fov:l,v=1;t.effect===`zoomin`?v=1.5:t.effect===`zoomout`&&(v=.4);let x=g*v;for(let e=0;e<_.length-1;e++){let t=_[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(m),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(x/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(u=b.longitude)==null?this.cameraMotion.value.longitude:u,latitude:(d=b.latitude)==null?this.cameraMotion.value.latitude:d,fov:x}},{progress:1,value:{longitude:(f=b.longitude)==null?this.cameraMotion.value.longitude:f,latitude:(p=b.latitude)==null?this.cameraMotion.value.latitude:p,fov:g}}],y).catch(q)}this.locationMotion.setKeyframes(_,y,v).then(()=>{for(let e of this.modelScene.children)e instanceof If&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:0});this.emit(`pano.arrived`,$(`pano.arrived`,{options:n,prevPano:S,progress:1,state:t,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(t);let r=this.works.getObserver(this.currentPano);if(r&&r.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:r.images.video.size.clone(),matrix:r.images.video.matrix.clone(),panoMatrix:r.matrix.clone().premultiply(r.work.transform),alpha:1},t=nn(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),rg().then(i=>{i&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=q,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=q,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}},()=>{this.emit(`pano.cancel`,$(`pano.cancel`,{options:n,prevPano:S,progress:0,state:x,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}checkSelectedPano(e){var t;this.stopMomentumMovement(),this.camera.getDirection(new c.Vector3).setY(0);let n=null,r=this.works.getObserver(this.currentPano);if(!r)return null;let i=r.work.observers,a=r.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let t=i[e];return!t||Rv.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[o]=this.modelScene.intersectRaycaster(e);if(o){let[e,r]=Nl(a,e=>{let t=i[e];return t?Rv.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(o.point):1/0},!0);typeof e==`number`&&r<this.panoTapTriggerRadius&&(n=(t=i[e])==null?null:t)}if(ev(n)){let t=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);t&&(n=t)}for(let e of this.locationMotion.keyframes){let t=this.panoResourceFromLocationMotionKeyframe(e);if(!(e.progress<this.locationMotion.progress)&&n){let e=Q({panoIndex:n.panoIndex,workCode:n.work.workCode});if(t.panoId===e){n=null;break}}}if(ev(n))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!n.active){let e=Q({panoIndex:n.panoIndex,workCode:n.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let s={workCode:n.work.workCode,panoIndex:n.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:n?n.position.clone():new c.Vector3};return this.emit(`pano.select`,$(`pano.select`,{prevPano:this.currentPano,state:s,userAction:!0,options:{},progress:0,error:null})),n&&n.active?(this.emit(`pano.request`,$(`pano.request`,{userAction:!0,prevPano:this.currentPano,progress:0,state:s,options:{},error:null})),{workCode:n.work.workCode,panoIndex:n.panoIndex}):null}destroy(){super.destroy()}isReady(){return!1}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,t,...n){var r,i,a,o,s,l,u,d,f;this.userAction=!0;let p={},m={},h=this.camera.getDirection(new c.Vector3),g=this.locationMotion.keyframes[0],_=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[v,y]=this.locationMotion.getKeyFrameSegment(e),b=this.panoResourceFromLocationMotionKeyframe(v),x=this.panoResourceFromLocationMotionKeyframe(y),S=this.panoResourceFromLocationMotionKeyframe(g),C=this.panoResourceFromLocationMotionKeyframe(_),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(W(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-y.value.count+1,n=new c.Vector3().copy(b.position),a=new c.Vector3().copy(x.position);if(p.progress=t,t>=.01&&t<=.99&&(p.progress=W(x.effectEasing(t),.01,.99)),x.leftPanoPicture&&(t<1?b.leftPanoPicture&&(p.pano0=b.leftPanoPicture):p.pano0=x.leftPanoPicture,p.pano1=x.leftPanoPicture),x.effect===`montage`?p.transition=`BLACK`:x.effect===`spread`?p.transition=`SPREAD`:p.transition=`FADE`,x.effect===`zoomin`||x.effect===`zoomout`?p.progress=Math.pow(t,3):x.effect===`model`&&this.camera.pose.distance<.01&&(p.modelAlpha=1-Math.pow(W(Math.abs(t-.5)*2,0,1),4)),t<1&&x.effect!==`fly`){if(p.pano0&&b.leftPanoPicture){let e={panoId:p.pano0.panoId,map:p.pano0.map,mapHistogram:p.pano0.mapHistogram,mapSize:p.pano0.mapSize,zoom:p.pano0.zoom,matrix:b.leftPanoPicture.matrix.clone().setPosition(x.position)},t=this.panoPictureObserverMap.get(p.pano0);t&&this.panoPictureObserverMap.set(e,t),p.pano0=e}n.copy(a),w=!0}m.distance=this.locationMotion.value.distance,m.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((r=p.pano0)==null?void 0:r.map)||e===((i=p.pano1)==null?void 0:i.map))continue;e.dispose(),t.leftPanoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}let l=hp(x.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,$(`pano.moving`,{userAction:this.userAction,prevPano:hp(S.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},hp(C.panoId)),{mode:this.mode}),jh(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(m),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);let[T,E]=n,D=new c.Vector3(0,0,0),O=new c.Vector2().copy(this.camera.resolution);if(E&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let n=this.xrManager.cameraVR,r=this.xrManager.referenceSpace,i=this.xrManager.session.renderState.baseLayer,l=E.getViewerPose(r),u=(a=l==null?void 0:l.views)==null?[]:a;for(let e=0;e<u.length;e++){let t=u[e],r=n.cameras[e],a=i.getViewport(t);a&&(r.projectionMatrix.fromArray(t.projectionMatrix),r.projectionMatrixInverse.getInverse(r.projectionMatrix),r.matrix.fromArray(t.transform.matrix),r.matrix.setPosition(this.camera.position),r.matrix.decompose(r.position,r.quaternion,r.scale),r.matrixWorld.copy(r.matrix),r.matrixWorldInverse.getInverse(r.matrixWorld),r.matrixAutoUpdate=!1,D.copy(r.position),r.viewport.set(a.x,a.y,a.width,a.height),O.set(a.width,a.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((o=m.distance)==null?this.camera.pose.distance:o),this.xrManager.session.inputSources){for(let e=0;e<this.xrManager.session.inputSources.length;e++)if(this.xrManager.session.inputSources[e]&&this.xrManager.session.inputSources[e].targetRayMode===`transient-pointer`){let t=E.getPose(this.xrManager.session.inputSources[e].targetRaySpace,r);if(t){let e=t.transform.orientation,n=new c.Quaternion(e.x,e.y,e.z,e.w),r=new c.Vector3(0,0,-1).applyQuaternion(n);this.gazeRay=new c.Raycaster(this.camera.position,r)}}}if(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`){let n=this.xrManager.session.inputSources;for(let e=0;e<n.length;e++){let t=this.xrManager.controllers[e],i=n[e];if(!i)continue;t&&t.update(i,E,r);let a=this.xrManager.getController(e),o=new c.Vector3(0,1.2,0),l=a.position.clone().add(D).sub(o);i.handedness===`left`?this.xrControllerRay.left.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)):i.handedness===`right`&&this.xrControllerRay.right.set(l,new c.Vector3(0,0,-1).applyEuler(a.rotation)),this.controllerWrappers[e].position.copy(new c.Vector3(0,0,0).add(D).sub(o));let u=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(u.length===0){let e=this.works.getResolvedObserver(this.currentPano);u=this.xrControllerRay.right.intersectObject(this.modelScene.boundingMesh,!0).map(t=>{var n;let r=(n=e==null?void 0:e.floorIndex)==null?0:n;return Object.assign({floorIndex:r,floor:r},t)})}if(u.length>=1&&u[0].face)if(i.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=u[0].face.normal,n=t.clone(),r=u[0].point.clone();this.intersectMesh.position.copy(r);let i=r.clone().add(n);if(this.intersectMesh.lookAt(i),Math.abs(t.y)>.99){let e=this.camera.position.clone().sub(r);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,e.length>0?(this.pointerLines.right.setPoints(l,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(l,u[0].point));let a=u[0],o=$(`intersect.update`,{raycaster:(s=this.xrControllerRay.right)==null?null:s,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(l,u[0].point)}this.updateControllerHelper(n,e,t)}}else E||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);Ph(p)===!1&&this.modelScene.parameter.set(p),this.emit(`camera.update`,$(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),jh(this.camera.pose))}));let k=this.works.getResolvedObserver(this.currentPano),A=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,j=this.works.getObserver(b.panoId),M=this.works.getObserver(x.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&k){let e=[],t=k.work.observers;for(let n of k.accessibleNodes){let r=t[n];r&&e.push(r)}let n=new Map;if(e.sort((e,t)=>{let r=n.get(e);r===void 0&&(r=e.standingPosition.distanceTo(k.standingPosition),n.set(e,r));let i=n.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(k.standingPosition),n.set(t,i)),r-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let t=e[this.accessibleObserverFloorCheckCount],n=this.modelScene.models.find(e=>e.work===(t==null?void 0:t.work));if(t&&n&&n.visible){let e=.3,r=.005,i=t.standingPosition.clone().applyMatrix4(t.work.transform),a=Q({panoIndex:t.panoIndex,workCode:t.work.workCode}),o=Yg.map(t=>{Lv.ray.origin.copy(i),Lv.ray.origin.add(Rv.copy(t).setY(e)),Lv.ray.direction.set(0,-1,0),Lv.firstHitOnly=!0,Lv.floorIndex=-1;let[a]=n.intersectRaycaster(Lv);return a&&a.distance-r<=e?new c.Vector3().copy(i).setY(a.point.y+r):i});o.sort((e,t)=>t.y-e.y);let s=o[Math.floor(o.length/2)],[l]=o.filter(e=>e.distanceTo(s)<=.05);if(l){let e=new c.Vector4(i.x,i.y,i.z,l.y-i.y),t=this.adjustPanoCircleMeshPositionFix.get(a);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(a,e)}}this.accessibleObserverFloorCheckCount++}}let N=new Map;if(j)for(let e of j.accessibleNodes){let t=j.work.observers[e];if(t){let e=Q({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(M)for(let e of M.accessibleNodes){let t=M.work.observers[e];if(t){let e=Q({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{N.get(t)?N.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),N.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),N.delete(t)}),this.panoMeshes.forEach((e,t)=>{let n=this.works.getObserver(t);if(n){let r=n.position.distanceTo(n.standingPosition)>this.aerialObserverMinHeight;if(r)e.position.copy(n.position).applyMatrix4(n.work.transform),e.scale.setScalar(18);else{e.position.copy(n.standingPosition).applyMatrix4(n.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(n.panoId);t&&(Rv.set(t.x,t.y,t.z),Rv.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let i=this.camera.position.clone().setY(e.position.y),a=new c.Vector3().copy(e.position).sub(i).normalize();if(t===Q(this.currentPano)){let t=W((.5-i.distanceTo(e.position))/.5,0,1);a.multiplyScalar(1-t).add(h.clone().multiplyScalar(t))}if(a.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(a.x,a.z);e.quaternion.setFromEuler(new c.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(k){let n=k.work.observers,[,r]=Nl(k.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:k.standingPosition.distanceTo(t.standingPosition)},!0);r=W(r,2.5,1/0);let i=k.accessibleNodes.concat(k.panoIndex).map(e=>Q({panoIndex:e,workCode:k.work.workCode}));this.panoMeshes.forEach((n,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=n.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&A!==null&&Q({panoIndex:A.panoIndex,workCode:A.work.workCode})===a;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=t<.01?0:W(r/t,.1,.85)}o&&o===M&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue().modelAlpha>0&&(c=0),n.setCurrent(s),n.setOpacity(c),n.updateTime&&n.updateTime(e,t)})}{let e=(l=this.modelScene.parameter.progress)==null?1:l,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,a;if(i&&(a=this.works.getObserver(i.panoId),a||(a=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(si()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!a||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Qr(i.mapSize)+1;this.tiling.setObserver(a);let o={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:i.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:e,level:4},s=this.tiling.update(o),c={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:Vu(Math.abs(((u=this.modelScene.parameter.progress)==null?0:u)-.5)*2)},l=this.modelScene.parameter.refinedScreen;(s||c.pano!==(l==null?void 0:l.pano)||c.opacity!==(l==null?void 0:l.opacity))&&this.modelScene.parameter.set(`refinedScreen`,c)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&k&&k.position.y-k.standingPosition.y>10){let e=W(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=x.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((d=this.modelScene.parameter.pano0Depth)==null?void 0:d.panoId)!==t.panoId||((f=this.modelScene.parameter.pano1Depth)==null?void 0:f.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.WebGLCubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,Gg(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,Gg(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}render(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){let e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}updateControllerHelper(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(!e||e.length===0)return;let a={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let o=0;o<e.length;o++){let s=e[o].handedness,c=e[o].gamepad;switch(s){case`left`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`LeftAxesDown`,t)),c!=null&&c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`X`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`Y`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`LeftTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n};a.buttons.X=c.buttons&&c.buttons[4]?c.buttons[4].pressed:!1,a.buttons.Y=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.LeftTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.LeftPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1,a.left=e;break;case`right`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`RightAxesDown`,t)),c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`A`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`B`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`RightTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`RightPinch`,t)),a.right={raycaster:i,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n},a.buttons.A=c.buttons&&c.buttons[4]?c==null?void 0:c.buttons[4].pressed:!1,a.buttons.B=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.RightTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.RightPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,$(`xr.controller.update`,a))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)this.xrHandleState[t].touchStart===!1?(this.xrHandleState[t].touchStartTime=n,this.xrHandleState[t].touchStart=!0,this.emit(`xr.gesture.buttonDown`,$(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrHandleState[t].touchStartTime>Iv&&this.emit(`xr.gesture.press`,$(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,$(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrHandleState[t].touchStartTime<=Iv){let e=$(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}});!this.emit(`xr.gesture.tap`,e)&&!e.defaultPrevented&&t===`RightTrigger`&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[t].touchStart=!1,this.xrHandleState[t].touchStartTime=0}}initHandEvent(){if(!this.xrManager.session)throw Error(`初始化失败`);this.xrManager.session.addEventListener(`select`,e=>{this.gazeRay&&this.checkSelectedPano(this.gazeRay)})}}},Bv={Floorplan:Yh,Topview:Zh,Panorama:Xg,VRPanorama:V_,Model:K_,Mapview:Q_,XRPanorama:Pv},Vv=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.create,initAnimation.start,initAnimation.end,camera.update,intersect.update,pano.select,pano.moveTo,pano.moving,pano.arrived,pano.cancel,pano.error,pano.texture.load,pano.texture.progress,pano.texture.success,pano.texture.error,pano.texture.abort,xr.session.start,xr.session.end,xr.gesture.tap,xr.gesture.press,xr.gesture.buttonUp,xr.gesture.buttonDown,xr.controller.update`.split(`,`);function Hv(e){e.on(`initAnimation.start`,t=>{e.emit(`initAnimationWillStart`,t.state.panoIndex,t.state,t.userAction)}),e.on(`initAnimation.end`,t=>{e.emit(`initAnimationEnded`,t.state.panoIndex,t.state,t.userAction)}),e.on(`gesture.pan`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pan`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPanGesture`,t.state,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pan`,t.pointers,t.isFinal),e.emit(`panGesture`,t.state,t.isFinal))}),e.on(`gesture.tap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`tap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`tap`,t.pointers,t.isFinal),e.emit(`tapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.dbltap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`dbltap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsDblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`dbltap`,t.pointers,t.isFinal),e.emit(`dblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.press`,t=>{let n=!1;n=e.emit(`wantsGesture`,`press`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`press`,t.pointers,t.isFinal),e.emit(`pressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),e.on(`gesture.pinch`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pinch`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPinchGesture`,t.scale,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pinch`,t.pointers,t.isFinal),e.emit(`pinchGesture`,t.scale,t.state.fov,t.isFinal))}),e.on(`gesture.mousewheel`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseWheel`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsMouseWheel`,t.center.delta,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseWheel`,t.pointers,t.isFinal),e.emit(`mouseWheel`,t.center.delta,t.state.fov,t.isFinal))}),e.on(`gesture.mousemove`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseMove`,t.pointers,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseMove`,t.pointers,t.isFinal),n=e.emit(`wantsChangeCameraFov`,t.state.fov),n&&t.preventDefault())}),e.on(`gesture.momentum`,t=>{let n=!1;n=e.emit(`wantsInteriaPan`,t.state),n&&t.preventDefault(),t.defaultPrevented||e.emit(`interiaPan`,t.state,t.isFinal)}),e.on(`camera.update`,t=>{e.emit(`cameraFovUpdate`,t.state.fov,t.userAction),e.emit(`cameraDirectionUpdate`,t.state,t.userAction);let n=Vt(t.state);n.setLength(t.state.distance);let r=t.state.offset.clone().sub(n);e.emit(`cameraPositionUpdate`,r,t.userAction),e.emit(`cameraUpdate`,t.state,t.userAction)}),e.on(`intersect.update`,t=>{if(t.intersection){let n=!1;n=e.emit(`wantsShowIntersectionOnModel`,t.raycaster),n&&t.preventDefault(),t.defaultPrevented||e.emit(`intersectionOnModelUpdate`,t.intersection,t.object)}else e.emit(`intersectionHidden`)}),e.on(`pano.request`,t=>{let n=e.emit(`wantsMoveToPano`,t.state.panoIndex,t.options,t.userAction);n||(n=e.emit(`wantsToMoveToPano`,t.state.panoIndex,t.options,t.userAction)),n&&t.preventDefault(),t.defaultPrevented||e.emit(`panoWillLoad`,t.state.panoIndex)}),e.on(`pano.select`,t=>{e.emit(`panoSelected`,t.state.panoIndex)}),e.on(`pano.moveTo`,t=>{e.emit(`panoLoaded`,t.state.panoIndex),e.emit(`moveToPano`,t.state.panoIndex,t.userAction),e.emit(`panoWillArrive`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.moving`,t=>{e.emit(`movingToPano`,t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),e.on(`pano.arrived`,t=>{e.emit(`panoArrived`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.cancel`,t=>{e.emit(`moveToPanoCanceled`,t.state.panoIndex)}),e.on(`pano.error`,t=>{e.emit(`panoLoadError`,t.error,t.state.panoIndex)}),e.on(`pano.texture.load`,t=>{e.emit(`textureStartLoad`,t.pano.panoIndex)}),e.on(`pano.texture.success`,t=>{e.emit(`textureLoaded`,t.pano.panoIndex,t.meta)}),e.on(`pano.texture.error`,t=>{e.emit(`textureError`,t.error,t.pano.panoIndex)}),e.on(`pano.texture.abort`,t=>{e.emit(`textureAbort`,t.pano.panoIndex)}),e.on(`pano.texture.progress`,t=>{e.emit(`textureLoading`,t.progress,t.pano.panoIndex)}),e.on(`xr.session.start`,t=>{e.emit(`webXRSessionStart`)}),e.on(`xr.session.end`,t=>{e.emit(`webXRSessionEnd`)}),e.on(`xr.gesture.tap`,t=>{e.emit(`webXRControllerEvent`,`tap`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.press`,t=>{e.emit(`webXRControllerEvent`,`press`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonUp`,t=>{e.emit(`webXRControllerEvent`,`buttonUp`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonDown`,t=>{e.emit(`webXRControllerEvent`,`buttonDown`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.controller.update`,t=>{e.emit(`webXRControllerRayUpdate`,{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&e.emit(`webXRAxesUpdate`,`left`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&e.emit(`webXRAxesUpdate`,`right`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),e.on(`works.request`,t=>{e.emit(`willLoad`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.load`,t=>{e.emit(`load`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.ready`,t=>{e.emit(`loaded`,t.input,t.works[0])}),e.on(`state.change`,t=>{e.emit(`stateChange`,t.state,t.userAction)}),e.on(`currentState.change`,t=>{e.emit(`currentStateChange`,t.state,t.userAction)}),e.on(`state.set`,t=>{e.emit(`setState`,t.state)}),e.on(`state.synced`,t=>{e.emit(`stateSynced`,t.state)}),e.on(`model.request`,t=>{e.emit(`modelWillLoad`,t.work.model)}),e.on(`model.error`,t=>{e.emit(`modelLoadError`,t.error,t.model)}),e.on(`model.load`,t=>{e.emit(`modelLoaded`,t.model)}),e.on(`model.changeShownFloor`,t=>{e.emit(`modelShownFloorChange`,t.model.shownFloor,t.model.floorLength)}),e.on(`render`,t=>{e.emit(`renderFrame`,t.needsRender)}),e.on(`mode.change.request`,t=>{e.emit(`wantsChangeMode`,t.mode,t.prevMode)}),e.on(`mode.change`,t=>{e.emit(`modeChange`,t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),e.on(`helpers.visible`,t=>{e.emit(`helpersVisibleChange`,t.object.visible)}),e.on(`network.resource`,t=>{e.emit(`network`,t.source,t.requestType,t.requestState,t.detail)})}function Uv(){if(typeof window<`u`){let e=document.createElement(`video`);e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin=``;let t=()=>{document.removeEventListener(`touchstart`,t,!1),document.removeEventListener(`mousedown`,t,!1),e.muted=!1};return document.addEventListener(`touchstart`,t,!1),document.addEventListener(`mousedown`,t,!1),e}else return{}}function Wv(){let e=new c.Group;e.name=`internalLights`;{let t=new c.DirectionalLight(16777215,.1);t.name=`direction0`,t.position.copy(new c.Vector3(0,1,0)),e.add(t)}{let t=new c.DirectionalLight(16777215,.1);t.name=`direction1`,t.position.copy(new c.Vector3(-1,-1,-1)),e.add(t)}{let t=new c.DirectionalLight(16777215,.3);t.name=`direction2`,t.position.copy(new c.Vector3(1,1,1)),e.add(t)}{let t=new c.AmbientLight(16777215,.6);t.name=`ambient0`,e.add(t)}return e}function Gv(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function Kv(){var e;if(typeof document<`u`){let t=document.getElementsByTagName(`meta`);for(let n=0;n<t.length;n++){let r=t[n];if(r.getAttribute(`name`)===`viewport`){let t=Gv((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var qv=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==`,Jv=[351,63],Yv=[20,20],Xv=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Zv=new Float32Array([0,0,1,0,0,1,1,1]),Qv=new Uint8Array([0,1,2,1,3,2]),$v=new c.BufferGeometry;$v.setAttribute(`position`,new c.BufferAttribute(Xv,3)),$v.setAttribute(`uv`,new c.BufferAttribute(Zv,2)),$v.setIndex(new c.BufferAttribute(Qv,1));var ey=new c.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),ty=new c.Mesh($v,ey);ty.matrixAutoUpdate=!1;var ny=new c.Scene;ny.add(ty),ny.matrixAutoUpdate=!1;var ry=new c.OrthographicCamera(-.5,.5,.5,-.5,.1,1);ry.position.set(0,0,.5),ry.lookAt(0,0,0),ry.updateMatrixWorld(!0),ry.matrixAutoUpdate=!1;var iy=new c.Vector4,ay=new c.Vector4;function oy(e){if(ey.map){let t=e.getViewport(iy),n=e.getScissor(ay),r=e.getScissorTest(),i=e.autoClear,a=n.x+Yv[0]/3,o=n.y+Yv[1]/3,s=Jv[0]/3,c=Jv[1]/3;e.setViewport(a,o,s,c),e.setScissor(a,o,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(ny,ry),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{let e=new c.Texture,t=new Image;t.onload=()=>{e.image=t,e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,ey.needsUpdate=!0,t.onload=q},t.src=qv,ey.map=e}}var sy=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}async function t(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i)try{new URL(\`.\`,a).href}catch{}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==\`function\`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==\`function\`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(\`\\0asm\\0\\0\\0&\\\`\\\`}}\\\`}\\\`\\0\\\`\\v\\0\\\`\\0\\0\\x07aa\\0\\0\\b\\x07\\0\\0\\x07\\bA\\v\\x07b\\0c\\0\\x07d\\0e\\0f\\0\\f
|
|
2240
2240
|
@\\x07T~@A\\b(\\0" \\0B\\x07|Bøÿÿÿ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vA\\bA06\\0A\\vA\\b \\x006\\0 \\v\\0 \\0 Atr\\vr \\0¼"Aÿÿÿq!@ AvAÿq"E\\r\\0 Að\\0M@ ArAñ\\0 kv!\\f\\v AK@Aø!A\\0!\\f\\v A
|
|
2241
2241
|
tA\\x07k!\\v AvAqr A\\rvr\\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r (\\0"k"A\\b(\\0I\\r \\0 j!\\0@@@A\\b(\\0 G@ (\\f! AÿM@ (\\b"G\\rA\\bA\\b(\\0A~ Avwq6\\0\\f\\v (!\\x07 G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rA\\b \\x006\\0 A~q6 \\0Ar6 \\x006\\0\\v 6\\f 6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(¸
|
|
2242
2242
|
F@ A¸
|
|
@@ -2288,7 +2288,7 @@ j \x006\0 \0\rA\b \vA~ wq6\0\f\v@ (F@ \x006\f\v \x006\v \
|
|
|
2288
2288
|
Aj$\0 \0\v¡\v\v }#\0A\xA0k"\v$\0 \vA0jA\0A$ü\v\0@ G@ Al"\fAjAt"j*\0! \fAjAt"j*\0! \b \fAt"j j*\0"8\0 \b j 8\0 \b j 8\0 \x07 Atj"\rA\x006\f \r 8\b \r 8 \r 8\0@ \0E@ j-\0\0E\r\v \rA\b6\f\v \r At"\fAr"j-\0\0A\bt \fj-\0\0r \fAr"j-\0\0Atr \fAr"\fj-\0\0Atr6 \v At"j*\0"8 \v At"j*\0"8 \v \fAt"j*\0"8 \v At"j*\0"8 \vAà\0j"\f \v*"C\0\0\0À \v*"C\0\0\0À C\0\0?8\0 \f \v*" \v* \v*" \v*8 \f \v*" \v* \v*" \v*8\b \f \v*" \v* \v*" \v*8\f \f \v*"C\0\0\0À \v*"C\0\0\0À C\0\0?8 \f \v*" \v* \v*" \v*8 \f \v*" \v* \v*" \v*8 \f \v*" \v* \v*" \v*8 \f \v*"C\0\0\0À \v*"C\0\0\0À C\0\0?8 j 8\0 j 8\0 j 8\0 j 8\0 \v j*\0"80 \v j*\0"8@ \v j*\0"8P
|
|
2289
2289
|
j 8\0
|
|
2290
2290
|
j 8\0
|
|
2291
|
-
j 8\0 \v \f* \v*8 \f*\0 \v*0 \f*\f \v*48\0 \v \f* \v*8 \f* \v*0 \f* \v*48 \v \f* \v*8 \f*\b \v*0 \f* \v*48\b \v \f* \v*D \f*\0 \v*< \f*\f \v*@8\f \v \f* \v*D \f* \v*< \f* \v*@8 \v \f* \v*D \f*\b \v*< \f* \v*@8 \v \f* \v*P \f*\0 \v*H \f*\f \v*L8 \v \f* \v*P \f* \v*H \f* \v*L8 \v \f* \v*P \f*\b \v*H \f* \v*L8 \v* ! \v*\b! \v*! \r \v*" \v*\0" \v*\f"\x1B \x1BC\0\0@ \v*" \v*" \x1B \v*"C\0\0@6 \r \x1B C\0\0@ C\0\0@6 \r C\0\0@ C\0\0@6 Aj!\f\v\v \vA\xA0j$\0\v\0\v\v \0A\b\v`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:ee}}function b(){function e(e,t){return te=e.exports,N(te),d(),te}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h!=null||(h=g()),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch(e){}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==`function`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var ee={a:k};function P(){f();function e(){var e;n.calledRun=!0,!o&&(p(),c==null||c(n),(e=n.onRuntimeInitialized)==null||e.call(n),m())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var te=b();return P(),t=u?n:new Promise((e,t)=>{c=e}),t}),py.apply(this,arguments)}var my=class{constructor(e){this.dataChanged=!1,this.transformsChanged=!1,this.maxShDegree=0;let t=0,n=0;this.splatIndices=new Map,this.offsets=new Map;let r=new Map;e.forEach(e=>{this.splatIndices.set(e,n),this.offsets.set(e,t),r.set(t,e),t+=e.numPoints,n++}),this.numPoints=t,this.width=2048,this.height=Math.ceil(2*this.numPoints/this.width),this.data=new Uint32Array(this.width*this.height*4),this.transformsWidth=5,this.transformsHeight=r.size,this.transforms=new Float32Array(this.transformsWidth*this.transformsHeight*4),this.transformIndicesWidth=1024,this.transformIndicesHeight=Math.ceil(this.numPoints/this.transformIndicesWidth),this.transformIndices=new Uint32Array(this.transformIndicesWidth*this.transformIndicesHeight),this.positions=new Float32Array(this.numPoints*3),this.rotations=new Float32Array(this.numPoints*4),this.scales=new Float32Array(this.numPoints*3);let i=0;e.forEach(e=>{e.maxSHDegree>i&&(i=e.maxSHDegree)}),this.maxShDegree=i,i>=1&&(this.sh1=new Float32Array(this.numPoints*9)),i>=2&&(this.sh2=new Float32Array(this.numPoints*15)),i>=3&&(this.sh3=new Float32Array(this.numPoints*21)),e.forEach(e=>{let t=this.offsets.get(e);e.sh1&&this.sh1&&this.sh1.set(e.sh1,t*9),e.sh2&&this.sh2&&this.sh2.set(e.sh2,t*15),e.sh3&&this.sh3&&this.sh3.set(e.sh3,t*21)}),this.worker=new ly,this.worker.onmessage=e=>{if(e.data.response){let t=e.data.response,n=r.get(t.offset);this.updateTransform(n);let i=this.splatIndices.get(n);for(let e=0;e<n.numPoints;e++)this.transformIndices[t.offset+e]=i;this.data.set(t.data,t.offset*8),n.reattach(t.positions,t.rotations,t.scales,t.colors,t.selection),this.positions.set(t.worldPositions,t.offset*3),this.rotations.set(t.worldRotations,t.offset*4),this.scales.set(t.worldScales,t.offset*3),n.selectedChanged=!1,this.dataChanged=!0}},fy().then(e=>{this.splatIndices.forEach((t,n)=>{this.buildImmediate(e,n)})})}updateTransform(e){let t=this.splatIndices.get(e);this.transforms.set(e.matrixWorld.elements,t*20),this.transforms[t*20+16]=e.selected?1:0,e.transformChanged=!1,e.selectedChanged=!1,this.transformsChanged=!0}buildImmediate(e,t){this.updateTransform(t);let n=e._malloc(3*t.numPoints*4),r=e._malloc(4*t.numPoints*4),i=e._malloc(3*t.numPoints*4),a=e._malloc(4*t.numPoints),o=e._malloc(t.numPoints),s=e._malloc(8*t.numPoints*4),c=e._malloc(3*t.numPoints*4),l=e._malloc(4*t.numPoints*4),u=e._malloc(3*t.numPoints*4);e.HEAPF32.set(t.positions,n/4),e.HEAPF32.set(t.rotations,r/4),e.HEAPF32.set(t.scales,i/4),e.HEAPU8.set(t.colors,a),e.HEAPU8.set(t.selection,o),e._pack(t.selected,t.numPoints,n,r,i,a,o,s,c,l,u);let d=new Uint32Array(e.HEAPU32.buffer,s,t.numPoints*8),f=new Float32Array(e.HEAPF32.buffer,c,t.numPoints*3),p=new Float32Array(e.HEAPF32.buffer,l,t.numPoints*4),m=new Float32Array(e.HEAPF32.buffer,u,t.numPoints*3),h=this.splatIndices.get(t),g=this.offsets.get(t);for(let e=0;e<t.numPoints;e++)this.transformIndices[g+e]=h;this.data.set(d,g*8),this.positions.set(f,g*3),this.rotations.set(p,g*4),this.scales.set(m,g*3),e._free(n),e._free(r),e._free(i),e._free(a),e._free(o),e._free(s),e._free(c),e._free(l),e._free(u),this.dataChanged=!0}getSplat(e){let t=null;return this.offsets.forEach((n,r)=>{if(e>=n)t=r;else return}),t}getLocalIndex(e,t){return t-this.offsets.get(e)}dispose(){this.worker.terminate()}},hy=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}async function t(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i)try{new URL(\`.\`,a).href}catch{}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==\`function\`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==\`function\`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(\`\\0asm\\0\\0\\0\\\`\\\`\\0\\\` \\0\\\`\\0\\0\\x07aa\\0\\0\\0\\0\\x07\\bA\\v\\x07b\\0c\\0d\\0e\\0f\\0\\f
|
|
2291
|
+
j 8\0 \v \f* \v*8 \f*\0 \v*0 \f*\f \v*48\0 \v \f* \v*8 \f* \v*0 \f* \v*48 \v \f* \v*8 \f*\b \v*0 \f* \v*48\b \v \f* \v*D \f*\0 \v*< \f*\f \v*@8\f \v \f* \v*D \f* \v*< \f* \v*@8 \v \f* \v*D \f*\b \v*< \f* \v*@8 \v \f* \v*P \f*\0 \v*H \f*\f \v*L8 \v \f* \v*P \f* \v*H \f* \v*L8 \v \f* \v*P \f*\b \v*H \f* \v*L8 \v* ! \v*\b! \v*! \r \v*" \v*\0" \v*\f"\x1B \x1BC\0\0@ \v*" \v*" \x1B \v*"C\0\0@6 \r \x1B C\0\0@ C\0\0@6 \r C\0\0@ C\0\0@6 Aj!\f\v\v \vA\xA0j$\0\v\0\v\v \0A\b\v`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:ee}}function b(){function e(e,t){return te=e.exports,N(te),d(),te}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h!=null||(h=g()),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch(e){}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==`function`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var ee={a:k};function P(){f();function e(){var e;n.calledRun=!0,!o&&(p(),c==null||c(n),(e=n.onRuntimeInitialized)==null||e.call(n),m())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var te=b();return P(),t=u?n:new Promise((e,t)=>{c=e}),t}),py.apply(this,arguments)}var my=null;function hy(){return my||(my=fy()),my}var gy=class{static warmupWasm(){hy()}constructor(e,t=0){this.dataChanged=!1,this.transformsChanged=!1,this.maxShDegree=0,this.initialBuildComplete=!1,this.pendingInitialBuildCount=0,this.disposed=!1,this.resolveReadyPromise=null,this.objectsInOrder=[],this.generation=t,this.readyPromise=new Promise(e=>{this.resolveReadyPromise=e});let n=0,r=0;this.splatIndices=new Map,this.offsets=new Map,this.layerKeys=[],this.layerKeyToIndex=new Map,this.objectLayerIndices=new Map;let i=new Map;e.forEach(e=>{this.splatIndices.set(e,r),this.offsets.set(e,n),i.set(n,e);let t=e.gsViewLayerKey||e.uuid,a=this.layerKeyToIndex.get(t);a===void 0&&(a=this.layerKeys.length,this.layerKeys.push(t),this.layerKeyToIndex.set(t,a)),this.objectLayerIndices.set(e,a),n+=e.numPoints,r++,this.objectsInOrder.push(e)}),this.numPoints=n,this.pendingInitialBuildCount=e.length,this.initialBuildComplete=this.pendingInitialBuildCount===0,this.width=2048,this.height=Math.ceil(2*this.numPoints/this.width),this.data=new Uint32Array(this.width*this.height*4),this.transformsWidth=5,this.transformsHeight=i.size,this.transforms=new Float32Array(this.transformsWidth*this.transformsHeight*4),this.transformIndicesWidth=1024,this.transformIndicesHeight=Math.ceil(this.numPoints/this.transformIndicesWidth),this.transformIndices=new Uint32Array(this.transformIndicesWidth*this.transformIndicesHeight),this.layerIndicesWidth=1024,this.layerIndicesHeight=Math.ceil(this.numPoints/this.layerIndicesWidth),this.layerIndices=new Uint32Array(this.layerIndicesWidth*this.layerIndicesHeight),this.positions=new Float32Array(this.numPoints*3),this.rotations=new Float32Array(this.numPoints*4),this.scales=new Float32Array(this.numPoints*3);let a=0;e.forEach(e=>{e.maxSHDegree>a&&(a=e.maxSHDegree)}),this.maxShDegree=a,a>=1&&(this.sh1=new Float32Array(this.numPoints*9)),a>=2&&(this.sh2=new Float32Array(this.numPoints*15)),a>=3&&(this.sh3=new Float32Array(this.numPoints*21)),e.forEach(e=>{let t=this.offsets.get(e);e.sh1&&this.sh1&&this.sh1.set(e.sh1,t*9),e.sh2&&this.sh2&&this.sh2.set(e.sh2,t*15),e.sh3&&this.sh3&&this.sh3.set(e.sh3,t*21)}),this.worker=new ly,this.worker.onmessage=e=>{if(!this.disposed&&e.data.response){let t=e.data.response,n=i.get(t.offset);if(!n)return;this.updateTransform(n);let r=this.splatIndices.get(n),a=this.objectLayerIndices.get(n);for(let e=0;e<n.numPoints;e++)this.transformIndices[t.offset+e]=r,this.layerIndices[t.offset+e]=a;this.data.set(t.data,t.offset*8),n.reattach(t.positions,t.rotations,t.scales,t.colors,t.selection),this.positions.set(t.worldPositions,t.offset*3),this.rotations.set(t.worldRotations,t.offset*4),this.scales.set(t.worldScales,t.offset*3),n.selectedChanged=!1,this.dataChanged=!0}},hy().then(e=>{if(this.disposed){this.completeInitialBuild();return}this.splatIndices.forEach((t,n)=>{this.disposed||this.buildImmediate(e,n)})}).catch(e=>{console.warn(`RenderData wasm load failed:`,e),this.completeInitialBuild()}),this.pendingInitialBuildCount===0&&this.completeInitialBuild()}updateTransform(e){let t=this.splatIndices.get(e);this.transforms.set(e.matrixWorld.elements,t*20),this.transforms[t*20+16]=e.selected?1:0,e.transformChanged=!1,e.selectedChanged=!1,this.transformsChanged=!0}getObjectsInOrder(){return this.objectsInOrder}canIncrementalAppend(e){if(this.disposed||e.length<=this.objectsInOrder.length)return!1;for(let t=0;t<this.objectsInOrder.length;t++)if(e[t]!==this.objectsInOrder[t])return!1;return!0}appendObjects(e){return Vo(this,void 0,void 0,function*(){if(this.disposed)return!1;if(e.length===0)return!0;let t=yield hy();if(this.disposed)return!1;let n=this.numPoints,r=this.objectsInOrder.length,i=n+e.reduce((e,t)=>e+t.numPoints,0),a=r+e.length;this.numPoints=i,this.height=Math.ceil(2*this.numPoints/this.width),this.data=this.expandUint32Array(this.data,this.width*this.height*4),this.transformsHeight=a,this.transforms=this.expandFloat32Array(this.transforms,this.transformsWidth*this.transformsHeight*4),this.transformIndicesHeight=Math.ceil(this.numPoints/this.transformIndicesWidth),this.transformIndices=this.expandUint32Array(this.transformIndices,this.transformIndicesWidth*this.transformIndicesHeight),this.layerIndicesHeight=Math.ceil(this.numPoints/this.layerIndicesWidth),this.layerIndices=this.expandUint32Array(this.layerIndices,this.layerIndicesWidth*this.layerIndicesHeight),this.positions=this.expandFloat32Array(this.positions,this.numPoints*3),this.rotations=this.expandFloat32Array(this.rotations,this.numPoints*4),this.scales=this.expandFloat32Array(this.scales,this.numPoints*3);let o=e.reduce((e,t)=>Math.max(e,t.maxSHDegree),this.maxShDegree);o>this.maxShDegree&&(this.maxShDegree=o),this.maxShDegree>=1&&(this.sh1=this.expandFloat32Array(this.sh1,this.numPoints*9)),this.maxShDegree>=2&&(this.sh2=this.expandFloat32Array(this.sh2,this.numPoints*15)),this.maxShDegree>=3&&(this.sh3=this.expandFloat32Array(this.sh3,this.numPoints*21));let s=n,c=r;return e.forEach(e=>{this.splatIndices.set(e,c),this.offsets.set(e,s),this.objectsInOrder.push(e);let t=e.gsViewLayerKey||e.uuid,n=this.layerKeyToIndex.get(t);n===void 0&&(n=this.layerKeys.length,this.layerKeys.push(t),this.layerKeyToIndex.set(t,n)),this.objectLayerIndices.set(e,n),e.sh1&&this.sh1&&this.sh1.set(e.sh1,s*9),e.sh2&&this.sh2&&this.sh2.set(e.sh2,s*15),e.sh3&&this.sh3&&this.sh3.set(e.sh3,s*21),s+=e.numPoints,c++}),e.forEach(e=>{this.buildImmediate(t,e)}),!0})}buildImmediate(e,t){if(this.disposed)return;this.updateTransform(t);let n=e._malloc(3*t.numPoints*4),r=e._malloc(4*t.numPoints*4),i=e._malloc(3*t.numPoints*4),a=e._malloc(4*t.numPoints),o=e._malloc(t.numPoints),s=e._malloc(8*t.numPoints*4),c=e._malloc(3*t.numPoints*4),l=e._malloc(4*t.numPoints*4),u=e._malloc(3*t.numPoints*4);e.HEAPF32.set(t.positions,n/4),e.HEAPF32.set(t.rotations,r/4),e.HEAPF32.set(t.scales,i/4),e.HEAPU8.set(t.colors,a),e.HEAPU8.set(t.selection,o),e._pack(t.selected,t.numPoints,n,r,i,a,o,s,c,l,u);let d=new Uint32Array(e.HEAPU32.buffer,s,t.numPoints*8),f=new Float32Array(e.HEAPF32.buffer,c,t.numPoints*3),p=new Float32Array(e.HEAPF32.buffer,l,t.numPoints*4),m=new Float32Array(e.HEAPF32.buffer,u,t.numPoints*3),h=this.splatIndices.get(t),g=this.offsets.get(t),_=this.objectLayerIndices.get(t);for(let e=0;e<t.numPoints;e++)this.transformIndices[g+e]=h,this.layerIndices[g+e]=_;this.data.set(d,g*8),this.positions.set(f,g*3),this.rotations.set(p,g*4),this.scales.set(m,g*3),e._free(n),e._free(r),e._free(i),e._free(a),e._free(o),e._free(s),e._free(c),e._free(l),e._free(u),this.dataChanged=!0,this.pendingInitialBuildCount=Math.max(0,this.pendingInitialBuildCount-1),this.pendingInitialBuildCount===0&&this.completeInitialBuild()}expandFloat32Array(e,t){if(!e)return new Float32Array(t);if(e.length>=t)return e;let n=new Float32Array(t);return n.set(e.subarray(0,e.length)),n}expandUint32Array(e,t){if(!e)return new Uint32Array(t);if(e.length>=t)return e;let n=new Uint32Array(t);return n.set(e.subarray(0,e.length)),n}getSplat(e){let t=null;return this.offsets.forEach((n,r)=>{if(e>=n)t=r;else return}),t}getLocalIndex(e,t){return t-this.offsets.get(e)}dispose(){this.disposed||(this.disposed=!0,this.worker.terminate(),this.completeInitialBuild())}completeInitialBuild(){this.initialBuildComplete||(this.initialBuildComplete=!0),this.resolveReadyPromise&&(this.resolveReadyPromise(),this.resolveReadyPromise=null)}},_y=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}async function t(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i)try{new URL(\`.\`,a).href}catch{}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==\`function\`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==\`function\`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(\`\\0asm\\0\\0\\0\\\`\\\`\\0\\\` \\0\\\`\\0\\0\\x07aa\\0\\0\\0\\0\\x07\\bA\\v\\x07b\\0c\\0d\\0e\\0f\\0\\f
|
|
2292
2292
|
¼8T~@A\\b(\\0" \\0B\\x07|Bøÿÿÿ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vA\\bA06\\0A\\vA\\b \\x006\\0 \\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r (\\0"k"A\\b(\\0I\\r \\0 j!\\0@@@A\\b(\\0 G@ (\\f! AÿM@ (\\b"G\\rA\\bA\\b(\\0A~ Avwq6\\0\\f\\v (!\\x07 G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rA\\b \\x006\\0 A~q6 \\0Ar6 \\x006\\0\\v 6\\f 6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(¸
|
|
2293
2293
|
F@ A¸
|
|
2294
2294
|
j 6\\0 \\rA\\bA\\b(\\0A~ wq6\\0\\f\\v@ \\x07(F@ \\x07 6\\f\\v \\x07 6\\v E\\r\\v \\x076 ("@ 6 6\\v ("E\\r\\0 6 6\\v O\\r\\0 ("AqE\\r\\0@@@@ AqE@A\\xA0\\b(\\0 F@A\\xA0\\b 6\\0A\\bA\\b(\\0 \\0j"\\x006\\0 \\0Ar6 A\\b(\\0G\\rA\\bA\\x006\\0A\\bA\\x006\\0\\vA\\b(\\0"\\x07 F@A\\b 6\\0A\\bA\\b(\\0 \\0j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\v Axq \\0j!\\0 (\\f! AÿM@ (\\b" F@A\\bA\\b(\\0A~ Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!\\b G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v A~q6 \\0Ar6 \\0 j \\x006\\0\\f\\vA\\0!\\v \\bE\\r\\0@ ("At"(¸
|
|
@@ -2321,5 +2321,5 @@ Aj!
|
|
|
2321
2321
|
A\\0H@@@ \\0 F\\r\\0 \\x07 \\0Atj(\\0Atj" (\\0"Aj6\\0 Atj \\x006\\0 \\0Aj!\\0\\f\\v\\v \\x07
|
|
2322
2322
|
At"j \\b Aj"j(\\0 \\x07j(\\0j6\\0
|
|
2323
2323
|
Ak!
|
|
2324
|
-
\\f\\v\\v\\v\\0\\v\\v \\0A\\b\\v\`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:P}}function b(){function e(e,t){return I=e.exports,N(I),d(),I}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h??=g(),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch{}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==\`function\`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._sort=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var P={a:k};function F(){f();function e(){n.calledRun=!0,!o&&(p(),c?.(n),n.onRuntimeInitialized?.(),m())}n.setStatus?(n.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>n.setStatus(\`\`),1),e()},1)):e()}var I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}let n;function r(){return e(this,void 0,void 0,function*(){n=yield t()})}let i,a,o,s,c,l,u,d,f,p=0,m=0,h=[],g=!0,_=!1,v=!1,y=!1,b=()=>e(void 0,void 0,void 0,function*(){if(_){v=!0;return}_=!0,v=!1,n||(yield r());let e=2**Math.ceil(Math.log2(i.vertexCount));p<e&&(p>0&&(n._free(a),n._free(s),n._free(c),n._free(l),n._free(u),n._free(d),n._free(f)),p=e,a=n._malloc(64),s=n._malloc(p*4),c=n._malloc(3*p*4),l=n._malloc(p*4),u=n._malloc(p*4),d=n._malloc(p*4),f=n._malloc(p*4)),m<i.transforms.length&&(m>0&&n._free(o),m=i.transforms.length,o=n._malloc(m*4)),_=!1,v&&(v=!1,yield b())}),x=()=>{if(_||v||!n)return;_=!0,n.HEAPF32.set(i.positions,c/4),n.HEAPF32.set(i.transforms,o/4),n.HEAPU32.set(i.transformIndices,s/4),n.HEAPF32.set(new Float32Array(h),a/4),n._sort(a,o,s,i.vertexCount,c,l,u,d,f);let e=new Uint32Array(n.HEAPU32.buffer,u,i.vertexCount),t=new Uint32Array(e.slice().buffer);self.postMessage({depthIndex:t},[t.buffer]),_=!1,g=!1},S=()=>{y||(y=!0,g&&x(),setTimeout(()=>{y=!1,S()}))};self.onmessage=e=>new Promise((t,n)=>{e.data.sortData&&(i={positions:new Float32Array(e.data.sortData.positions),transforms:new Float32Array(e.data.sortData.transforms),transformIndices:new Uint32Array(e.data.sortData.transformIndices),vertexCount:e.data.sortData.vertexCount},g=!0,b()),e.data.viewProj&&(e.data.viewProj.every(e=>h.includes(e))===!1&&(h=e.data.viewProj,g=!0),S(),t(!0))})})();`,gy=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,hy],{type:`text/javascript;charset=utf-8`});function _y(e){let t;try{if(t=gy&&(self.URL||self.webkitURL).createObjectURL(gy),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(hy),{name:e==null?void 0:e.name})}}var vy=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{Hnvor-v{-}ynV{qr\x07H{vs|z-uvtu}-nz}yr?Q-lr\x07rH{vs|z-uvtu}-nz}yr?Q-ln{s|zH{vs|z-uvtu}-nz}yr?Q-ln{s|zV{qvprH{vs|z-uvtu}-nz}yr?Q-luar\x07rH{vs|z-rp?-luar\x07r`v rH{vs|z-v{-lzn\x07`uQrtrrH{vs|z-rp?-r|yv|{Hn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH<<参考Tnvn{`}yn@qp|{-sy|n-\0E-J-\05E;=6H<<原版的固定xr{ry`v r,不要轻易调整这个数p|{-sy|n-xr{ry?Q`v r-J-=;@Hp|{-sy|n-zn\x07`prr{`}npr`}yn`v r-J-?=AE;=H<<固定的u相关系数p|{-sy|n-`UlP>-J-=;AEEC=?B>>F=?F>FFHp|{-sy|n-`UlP?l=-J->;=F?BAEAHp|{-sy|n-`UlP?l>-J-:>;=F?BAEAHp|{-sy|n-`UlP?l?-J-=;@>B@F>CHp|{-sy|n-`UlP?l@-J-:>;=F?BAEAHp|{-sy|n-`UlP?lA-J-=;BAC?DA?Hrp?-tr`UQnnbc5v{-}ynVq\x079-v{-p|z}|{r{\\ssr9-rp?-r\x07r`v r6-\n----v{-uP|z}|{r{P|{-J-=H----vs-5lzn\x07`uQrtrr-KJ->6-uP|z}|{r{P|{-8J-FH----vs-5lzn\x07`uQrtrr-KJ-?6-uP|z}|{r{P|{-8J->BH----vs-5lzn\x07`uQrtrr-KJ-@6-uP|z}|{r{P|{-8J-?>H--------v{-}nqqrqP|z}|{r{P|{-J-uP|z}|{r{P|{H----vs-5}nqqrqP|z}|{r{P|{-2-A-.J-=6-\n--------}nqqrqP|z}|{r{P|{-J-55}nqqrqP|z}|{r{P|{-<-A6-8->6-7-AH----\f--------sy|n-yv{rnP|z}|{r{V{qr\x07-J-sy|n5}ynVq\x07-7-}nqqrqP|z}|{r{P|{-8-p|z}|{r{\\ssr6H----sy|n-r\x07ryV{qr\x07-J-yv{rnP|z}|{r{V{qr\x07-<-A;=H------sy|n-q-J-r\x07ryV{qr\x07-<-r\x07r`v r;\x07H----sy|n-\b-J-sy||5q6-<-r\x07r`v r;\bH----sy|n-\x07-J-snp5q6H----r{-rp?5\x079-\b6H\f|vq-znv{-56-\n----rpA-pr{-J-r\x07rySrpu5lr\x07r9-vrp?55v{5}ynV{qr\x076-3-=\x07@ss6-II->9-v{5}ynV{qr\x076-KK->=69-=6H--------v{-n{s|zV{qr\x07-J-r\x07rySrpu5ln{s|zV{qvpr9-vrp?5v{5}ynV{qr\x076-3-=\x07@ss9-v{5}ynV{qr\x076-KK->=69-=6;\x07H----znA-n{s|z-J-znA5--------r\x07rySrpu5ln{s|z9-vrp?5=9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5>9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5?9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5@9-n{s|zV{qr\x0769-=6----6H----znA-n{s|zZ|qrycvrZnv\x07-J-vrZnv\x07-7-n{s|zH----rp@-}ynPr{r-J-v{Ova|Sy|n5pr{;\x07\b 6H----rpA-vrPr{r-J-n{s|zZ|qrycvrZnv\x07-7-rpA5}ynPr{r9->;=6H----rpA-pyv}Pr{r-J-}|wrpv|{Znv\x07-7-vrPr{rH----<<剔除超出视锥体的}yn----sy|n-pyv}-J->;?-7-pyv}Pr{r;H----vs-5pyv}Pr{r; -I-:pyv}Pr{r;-\v\v-pyv}Pr{r; -K-pyv}Pr{r;-\v\v---------pyv}Pr{r;\x07-I-:pyv}-\v\v-pyv}Pr{r;\x07-K-pyv}-\v\v---------pyv}Pr{r;\b-I-:pyv}-\v\v-pyv}Pr{r;\b-K-pyv}6-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f----rp@-{qpPr{r-J-pyv}Pr{r;\x07\b -<-pyv}Pr{r;H----rp?-s|pny-J-rp?5--------}|wrpv|{Znv\x07h=jh=j-7-r|yv|{;\x07-7-=;B9--------}|wrpv|{Znv\x07h>jh>j-7-r|yv|{;\b-7-=;B----6H--------]|vv|{-J-}|vv|{;\x07\bH----<<-读取协方差数据(使用-unys?\x07>C-打包)----rpA-p|-J-r\x07rySrpu5lr\x07r9-vrp?555v{5}ynV{qr\x076-3-=\x07@ss6-II->6-\v->9-v{5}ynV{qr\x076-KK->=69-=6H----rp?->-J-{}npxUnys?\x07>C5p|;\x076H-----rp?-?-J-{}npxUnys?\x07>C5p|;\b6H------rp?-@-J-{}npxUnys?\x07>C5p|; 6H----------sy|n-Z>>-J->;\x07-<-A;=H----sy|n-Z>?-J->;\b-<-A;=H----sy|n-Z>@-J-?;\x07-<-A;=H----sy|n-Z??-J-?;\b-<-A;=H----sy|n-Z?@-J-@;\x07-<-A;=H----sy|n-Z@@-J-@;\b-<-A;=H--------zn@-cx-J-zn@5--------Z>>9-Z>?9-Z>@9--------Z>?9-Z??9-Z?@9----------Z>@9-Z?@9-Z@@-------6H----<<-判断是否是正交模式:透视时-}|wrpv|{Znv\x07h@jh@j-J-=,正交时-J->----o||y-v\\u|tn}uvp-J-}|wrpv|{Znv\x07h@jh@j-K-=;DH----sy|n-n{vznv|{]|tr-J--}|wrpv|{Znv\x07h@jh@jH----zn@-WH----vs-5v\\u|tn}uvp6-\n--------<<-正交模式的雅可比矩阵--------W-J-n{}|r5zn@5------------s|pny;\x079-=;=9-=;=9------------=;=9-s|pny;\b9-=;=9------------=;=9-=;=9-=;=--------66H----\f-ryr-\n--------<<-透视模式的雅可比矩阵--------sy|n--J->;=-<-5vrPr{r; -7-vrPr{r; 6H--------W-J-zn@5------------s|pny;\x07-<-vrPr{r; 9-=;=9-:5s|pny;\x07-7-vrPr{r;\x076-7-9------------=;=9-s|pny;\b-<-vrPr{r; 9-:5s|pny;\b-7-vrPr{r;\b6-7-9------------=;=9-=;=9-=;=--------6H----\f----zn@-d-J-n{}|r5zn@5n{s|zZ|qrycvrZnv\x0766H----zn@-a-J-d-7-WH----<<-将-@Q-协方差矩阵变换为-?Q-协方差矩阵----zn@-p|?Qz-J-n{}|r5a6-7-cx-7-aH----p|?Qzh=jh=j-8J-xr{ry?Q`v rH----p|?Qzh>jh>j-8J-xr{ry?Q`v rH----rp@-p|?Q-J-rp@5p|?Qzh=jh=j9-p|?Qzh=jh>j9-p|?Qzh>jh>j6H----sy|n-n-J-p|?Q;\x07H----sy|n-q-J-p|?Q; H----sy|n-o-J-p|?Q;\bH----sy|n-Q-J-n-7-q-:-o-7-oH----sy|n-npr-J-n-8-qH----sy|n-npr\\r?-J-=;B-7-nprH----sy|n-rz?-J-\05zn\x075=;>9-npr\\r?-7-npr\\r?-:-Q66H----sy|n-rvtr{cnyr>-J-npr\\r?-8-rz?H----sy|n-rvtr{cnyr?-J-npr\\r?-:-rz?H----vs-5rvtr{cnyr?-IJ-=;=6-\n--------r{H----\f----rp?-rvtr{crp|>-J-{|znyv r5rp?5o9-rvtr{cnyr>-:-n66H----rp?-rvtr{crp|?-J-rp?5rvtr{crp|>;\b9-:rvtr{crp|>;\x076H----rp?-onvcrp|>-J-rvtr{crp|>--7-zv{5\0E-7-\05rvtr{cnyr>69-zn\x07`prr{`}npr`}yn`v r6H----rp?-onvcrp|?-J-rvtr{crp|?--7-zv{5\0E-7-\05rvtr{cnyr?69-zn\x07`prr{`}npr`}yn`v r6H----rp?-onvcvr}|-J-rp?5>;=-<-r|yv|{;\x079->;=-<-r|yv|{;\b6H----rp?-{qp\\ssr-J-rp?5]|vv|{;\x07-7-onvcrp|>-8-]|vv|{;\b-7-onvcrp|?6-7---------------------onvcvr}|-7-?;=H----rpA-\0nq]|-J-rpA5{qpPr{r;\x07\b-8-{qp\\ssr9-{qpPr{r; 9->;=6H----tyl]|vv|{-J-\0nq]|H----<<-读取颜色----rpA-p|y|-J-rpA5--------5p|;6-3-=\x07ss9--------5p|;-KK-E6-3-=\x07ss9--------5p|;-KK->C6-3-=\x07ss9--------5p|;-KK-?A6-3-=\x07ss----6-<-?BB;=H----<<应用球谐光照,目前只兼容=>?----vs-5lzn\x07`uQrtrr-KJ->6-\n--------rp@-pnzrn]|V{\\owrp-J-rp@5v{rr5n{s|z6-7-rpA5pnzrn]|vv|{9->;=66H--------rp@-|owrpcvrQv-J-{|znyv r5}ynPr{r-:-pnzrn]|V{\\owrp6H----------------rpA-u=>?@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079-=9-luar\x07r`v r66H----------rpA-uABCD-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079-A9-luar\x07r`v r66H----------rpA-uEF>=>>-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079-E9-luar\x07r`v r66H-----------------rp@-u>-J-u=>?@;toH-----------------------------------rp@-u?-J-rp@5u=>?@;n9-uABCD;t6H---------------------rp@-u@-J-rp@5uABCD;on9-uEF>=>>;6H-----------------------------sy|n-\x07-J-|owrpcvrQv;\x07H--------sy|n-\b-J-|owrpcvrQv;\bH--------sy|n- -J-|owrpcvrQv; H--------rp@-uP|y|-J-u>-7-5:=;AEEC=?B-7-\b6-8-u?-7-5=;AEEC=?B-7- 6-8-u@-7-5:=;AEEC=?B-7-\x076H--------p|y|;to-8J-uP|y|H----------------vs-5lzn\x07`uQrtrr-KJ-?6-\n----------------------rpA-u>?>@>A>B-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079->?9-luar\x07r`v r66H------------rpA-u>C>D>E>F-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079->C9-luar\x07r`v r66H-------------rpA-u?=?>???@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x079-?=9-luar\x07r`v r66H-------------------------rp@-uA-J-uEF>=>>;tonH------------------------------------rp@-uB-J-u>?>@>A>B;toH----------------------------------rp@-uC-J-rp@5u>?>@>A>B;n9-u>C>D>E>F;t6H---------------rp@-uD-J-rp@5u>C>D>E>F;on9-u?=?>???@;6H---------------rp@-uElqrt?-J-u?=?>???@;tonH-----------------------------------------sy|n-\x07\x07-J-\x07-7-\x07H------------sy|n-\b\b-J-\b-7-\bH------------sy|n- -J- -7- H------------sy|n-\x07\b-J-\x07-7-\bH------------sy|n-\b -J-\b-7- H------------sy|n-\x07 -J-\x07-7- H------------------------p|y|;to-8J----------------5`UlP?l=-7-\x07\b6-7-uA-8----------------5`UlP?l>-7-\b 6-7-uB-8----------------5`UlP?l?-7-5?;=-7- -:-\x07\x07-:-\b\b66-7-uC-8----------------5`UlP?l@-7-\x07 6-7-uD-8----------------5`UlP?lA-7-5\x07\x07-:-\b\b66-7-uElqrt?H--------\f----\f--------p|y|;to-J-pynz}5p|y|;to9-rp@5=;=69-rp@5>;=66H----P|y|-J-p|y|H----]|vv|{-7J-\0EH----b-J-}|vv|{;\x07\bH\f"),yy=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`}rpvv|{-uvtu}-sy|nH0v{pyqr-Ip|zz|{Kn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH|vq-znv{-56-
|
|
2325
|
-
----<<-计算从-}yn-中心到当前片段的平方距离----<<-由于-]|vv|{-已经按-\05E6-缩放,平方结果会被缩放-E-倍----<<-如果平方结果大于-E,说明在椭圆外,距离均值超过-\05E6-个标准差----sy|n-N-J-q|5]|vv|{9-]|vv|{6H----vs-5N-K-E;=6-qvpnqH--------rp@-p|y|-J-P|y|;toH--------<<-由于渲染的-}yn-按-\05E6-缩放,高斯公式中的逆协方差矩阵部分变成单位矩阵----<<-因此只剩下-5e-:-zrn{6-7-5e-:-zrn{6,而-zrn{-为零,所以是-e-7-e,即-N----sy|n-|}npv\b-J-r\x07}5:=;B-7-N6-7-P|y|;nH--------tylSntP|y|-J-rpA5p|y|;to9-|}npv\b6H\f`),by=class extends c.Mesh{constructor(){super(),this.renderData=null,this.needsRender=!1,this.sortWorker=null,this.depthIndex=new Uint32Array,this.splatIndexCapacity=0,this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.shTexture=null,this.usedSHDegree=0,this.onBeforeRender=(e,t,n)=>{var r,i;let a=n,o=this.collectObjects(t);if(o.length===0){this.geometry.instanceCount=0;return}let s=0;if(o.forEach(e=>{e.usedSHDegree>s&&(s=e.usedSHDegree)}),this.setMaxShDegree(s),this.isSceneNeedsRebuild(o)&&(this.renderData&&this.renderData.dispose(),this.shTexture&&(this.shTexture.dispose(),this.shTexture=null),this.renderData=new my(o),this.createTextures(),this.ensureSplatIndexCapacity(this.renderData.numPoints)),!this.renderData)return;if(o.forEach(e=>{e.transformChanged&&this.renderData.updateTransform(e)}),this.renderData.dataChanged||this.renderData.transformsChanged){let e=new Float32Array(this.renderData.positions.slice().buffer),t=new Float32Array(this.renderData.transforms.slice().buffer),n=new Uint32Array(this.renderData.transformIndices.slice().buffer);(r=this.sortWorker)==null||r.postMessage({sortData:{positions:e,transforms:t,transformIndices:n,vertexCount:this.renderData.numPoints}},[e.buffer,t.buffer,n.buffer])}this.renderData.dataChanged&&this.dataTexture&&(this.dataTexture.needsUpdate=!0,this.renderData.dataChanged=!1),this.renderData.transformsChanged&&this.transformsTexture&&this.transformIndicesTexture&&(this.transformsTexture.needsUpdate=!0,this.transformIndicesTexture.needsUpdate=!0,this.renderData.transformsChanged=!1);let l=Math.min(this.usedSHDegree,this.renderData.maxShDegree);this.material.uniforms.u_maxShDegree.value=l,l>0&&!this.shTexture?this.createSHTexture():l===0&&this.shTexture&&(this.shTexture.dispose(),this.shTexture=null,this.material.uniforms.u_shTexture.value=null);let u=new c.Matrix4().multiplyMatrices(a.perspectiveProjectionMatrix,a.matrixWorldInverse);(i=this.sortWorker)==null||i.postMessage({viewProj:u.elements}),this.material.uniforms.resolution.value.set(a.resolution.x,a.resolution.y)};let e=this.createGeometry(),t=this.createMaterial();this.geometry=e,this.material=t,this.frustumCulled=!1,this.renderOrder=-99999999999,this.gsSceneState={lastObjectsHash:``},this.sortWorker=new _y,this.sortWorker.onmessage=e=>{if(e.data.depthIndex){this.depthIndex=e.data.depthIndex;let t=this.depthIndex.length,n=this.ensureSplatIndexCapacity(t);n.array.set(this.depthIndex,0),n.count=this.depthIndex.length,n.updateRange.offset=0,n.updateRange.count=t,n.needsUpdate=!0,this.geometry.instanceCount=this.depthIndex.length,this.needsRender=!0}}}ensureSplatIndexCapacity(e){let t=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return t;let n=this.getExpandedCapacity(e),r=t.array,i=new Int32Array(n);i.set(r.subarray(0,Math.min(r.length,n)));let a=new c.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(c.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=n,this.geometry._maxInstanceCount=n,a}getExpandedCapacity(e){let t=Math.max(this.splatIndexCapacity,1);for(;t<e;)t*=2;return t}createGeometry(){let e=new c.InstancedBufferGeometry,t=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]);e.setAttribute(`position`,new c.BufferAttribute(t,3));let n=new Uint16Array([0,1,2,0,2,3]);e.setIndex(new c.BufferAttribute(n,1)),this.splatIndexCapacity=1;let r=new Int32Array(this.splatIndexCapacity);for(let e=0;e<r.length;e++)r[e]=e;let i=new c.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(c.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}createMaterial(){return new c.ShaderMaterial({vertexShader:vy,fragmentShader:yy,uniforms:{u_texture:{value:null},u_transforms:{value:null},u_transformIndices:{value:null},u_shTexture:{value:null},u_shTextureSize:{value:new c.Vector2},u_maxShDegree:{value:0},resolution:{value:new c.Vector2}},side:c.DoubleSide,transparent:!0,blending:c.NormalBlending,depthTest:!0,depthWrite:!1})}createTextures(){this.renderData&&(this.dataTexture=new c.DataTexture(this.renderData.data,this.renderData.width,this.renderData.height,c.RGBAIntegerFormat,c.UnsignedIntType),this.dataTexture.internalFormat=`RGBA32UI`,this.dataTexture.minFilter=c.NearestFilter,this.dataTexture.magFilter=c.NearestFilter,this.dataTexture.needsUpdate=!0,this.transformsTexture=new c.DataTexture(this.renderData.transforms,this.renderData.transformsWidth,this.renderData.transformsHeight,c.RGBAFormat,c.FloatType),this.transformsTexture.internalFormat=`RGBA32F`,this.transformsTexture.minFilter=c.NearestFilter,this.transformsTexture.magFilter=c.NearestFilter,this.transformsTexture.needsUpdate=!0,this.transformIndicesTexture=new c.DataTexture(this.renderData.transformIndices,this.renderData.transformIndicesWidth,this.renderData.transformIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType),this.transformIndicesTexture.internalFormat=`R32UI`,this.transformIndicesTexture.minFilter=c.NearestFilter,this.transformIndicesTexture.magFilter=c.NearestFilter,this.transformIndicesTexture.needsUpdate=!0,this.material.uniforms.u_texture.value=this.dataTexture,this.material.uniforms.u_transforms.value=this.transformsTexture,this.material.uniforms.u_transformIndices.value=this.transformIndicesTexture,this.usedSHDegree>0&&this.renderData.maxShDegree>0&&this.createSHTexture())}createSHTexture(){if(!this.renderData)return;this.shTexture&&(this.shTexture.dispose(),this.shTexture=null);let e=Math.min(this.usedSHDegree,this.renderData.maxShDegree),t=0;if(e>=1&&(t+=9),e>=2&&(t+=15),e>=3&&(t+=21),t===0)return;let n=t;n%4!=0&&(n=Math.ceil(n/4)*4);let r=this.renderData.numPoints*n/4,i=2048,a=Math.ceil(r/i),o=new Float32Array(i*a*4);for(let t=0;t<this.renderData.numPoints;t++){let r=n/4*t,i=0;if(this.renderData.sh1&&e>=1)for(let e=0;e<9;e++){let n=r+Math.floor(i/4),a=i%4,s=n*4+a;o[s]=this.renderData.sh1[t*9+e],i++}if(this.renderData.sh2&&e>=2)for(let e=0;e<15;e++){let n=r+Math.floor(i/4),a=i%4,s=n*4+a;o[s]=this.renderData.sh2[t*15+e],i++}if(this.renderData.sh3&&e>=3)for(let e=0;e<21;e++){let n=r+Math.floor(i/4),a=i%4,s=n*4+a;o[s]=this.renderData.sh3[t*21+e],i++}}this.shTexture=new c.DataTexture(o,i,a,c.RGBAFormat,c.FloatType),this.shTexture.internalFormat=`RGBA32F`,this.shTexture.minFilter=c.NearestFilter,this.shTexture.magFilter=c.NearestFilter,this.shTexture.needsUpdate=!0,this.material.uniforms.u_shTexture.value=this.shTexture,this.material.uniforms.u_shTextureSize.value.set(i,a),this.material.uniforms.u_maxShDegree.value=e}setMaxShDegree(e){if(e<0||e>2){console.warn(`现在只支持012三种阶数,你输入的是${e}`);return}let t=this.usedSHDegree;this.usedSHDegree=e,t!==e&&(this.shTexture&&(this.shTexture.dispose(),this.shTexture=null),this.material.uniforms.u_maxShDegree.value=e,e===0?this.material.uniforms.u_shTexture.value=null:this.renderData&&this.renderData.maxShDegree>0&&this.createSHTexture())}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof Yn&&e.visible&&t.push(e)}),t}isSceneNeedsRebuild(e){let t=e.reduce((e,t)=>e+t.uuid,``),n=t!==this.gsSceneState.lastObjectsHash;return this.gsSceneState.lastObjectsHash=t,n}dispose(){this.renderData&&this.renderData.dispose(),this.sortWorker&&this.sortWorker.terminate(),this.dataTexture&&this.dataTexture.dispose(),this.transformsTexture&&this.transformsTexture.dispose(),this.transformIndicesTexture&&this.transformIndicesTexture.dispose(),this.shTexture&&this.shTexture.dispose(),this.geometry.dispose(),this.material.dispose()}},xy=1e3,Sy=90,Cy=e=>e.replace(`//vrlab-public.ljcdn.com/`,`//vr-public.realsee-cdn.cn/`).replace(`//vrlab-image4.ljcdn.com/`,`//vr-image-4.realsee-cdn.cn/`).replace(`//vrlab-image3.ljcdn.com/`,`//vr-image-3.realsee-cdn.cn/`).replace(`//vrlab-image2.ljcdn.com/`,`//vr-image-2.realsee-cdn.cn/`).replace(`//vrlab-image1.ljcdn.com/`,`//vr-image-1.realsee-cdn.cn/`),wy=new c.Sphere,Ty=new c.Box3,Ey=new c.Vector4,Dy=new c.Vector4,Oy=new c.Color,ky=new c.Vector2,Ay=new WeakMap,jy=nm([$p(null)]),My={},Ny=class e extends cn{static get version(){return`6.8.0-alpha.20`}static get dracoPath(){return eo.decoderPath}static set dracoPath(e){eo.setDecoderPath(e)}static get ktx2Path(){return co.transcoderPath}static set ktx2Path(e){co.setTranscoderPath(e)}static get useNativeImageBitmap(){return si()}static set useNativeImageBitmap(e){oi(e)}constructor(e={}){var t,n,r,i,a,o,s,l,u,d,f;if(super(),this.pbmGSRenderMesh=null,this.fiveId=nn(),My[this.fiveId]=this,this.currentUpdateArgs={time:U(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!1,this.onlyRenderIfNeeds=(t=e.onlyRenderIfNeeds)==null?!0:t,this.imageOptions=Object.assign({},(n=e.imageOptions)==null?{}:n),this.textureOptions=Object.assign({},(r=e.textureOptions)==null?{}:r),this.poweredByRealsee=(i=e.poweredByRealsee)==null?!0:i,this.backgroundColor=new c.Color((a=e.backgroundColor)==null?1579548:a),this.backgroundAlpha=(o=e.backgroundAlpha)==null?1:o,this.extraElements=[],this.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},this.fps={testCount:0,testTime:U()},this.modeChangeDuration=(s=e.modeChangeDuration)==null?xy:s,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof Ym&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new Ym({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=Kv();this.renderer.setPixelRatio(t===1?window.devicePixelRatio:1),this.renderer.setSize(512,512),this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha)}catch(e){let t=e instanceof Error?e:Error(String(e));this.throwError(t)}this.getPixelsRenderTarget=new c.WebGLRenderTarget(1,1,{encoding:(d=(u=this.renderer)==null?void 0:u.outputEncoding)==null?c.sRGBEncoding:d,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new en(Sy),this.scene=new nh,this.xrCustomObjectsScene=new c.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.requestProxy=(f=e.requestProxy)==null?Cy:f,this.networkSubscribe=new sr,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,$(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new c.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),Ay.set(this,jy),this.modelScene=new qf({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(jy,{forceReplaceImmediately:!0});H(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new c.VideoTexture(e.videoInstance||Uv());let m=Wv();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=ri.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,$(`vr.requestExit`,{}))},g=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,g,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,g,!1)},this.loadWorkTask=this.prepare(),this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}Hv(this),this.fiveRenderer=new Jm,this.adaptiveLuminancePass=new Dm,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new Am(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGSRenderMesh=new by,this.scene.add(this.pbmGSRenderMesh)):console.warn(`未开启webgl2,3dgs功能不可用`)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}get panoId(){return Q(this.pano)}prepare(){return Promise.all([kr().catch(q)]).then(q)}dispose(){var e;if(this.destroyed===!0)return;delete My[this.fiveId],this.emit(`dispose`),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);let t=this.getElement();t&&t.parentNode&&t.parentNode.removeChild(t);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((e=n.pano0)==null?void 0:e.map)&&n.pano1.map.dispose(),n.reset(`pano0`,`pano1`),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),Ay.set(this,jy),this.renderer&&this.renderer.render(new c.Scene,new c.Camera),this.fiveRenderer.dispose(),this.renderer instanceof Ym&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}setViewport(e){Object.assign(this.viewport,e),this.needsRender=!0}get boundingMesh(){return this.modelScene.boundingMesh}get helperVisible(){return this.helperGroup.visible}set helperVisible(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit(`helpers.visible`,$(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,gr(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,gr(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,gr(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,gr(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,gr(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,gr(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode===`Panorama`||this.currentMode===`VRPanorama`)&&(r=!0,n=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),t&&n&&this.controller&&this.currentMode&&(!this.controller.updateConfiguration(this.controllerInits[this.currentMode])||r)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}appendTo(e,t={}){if(!this.renderer)return;if(!(this.renderer instanceof Ym)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i;if(!this.renderer)return;let a=this.renderer.domElement.parentNode,{width:o=(n=a==null?void 0:a.offsetWidth)==null?512:n,height:s=(r=a==null?void 0:a.offsetHeight)==null?512:r}=e;if(o=Math.max(1,o),s=Math.max(1,s),!t){let e=Kv(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(o,s)*t,n=Math.min(this.renderer.capabilities.maxTextureSize,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(o,s),this.needsRender=!0;let c=U(),l=c-this.currentUpdateArgs.time,u=this.currentUpdateArgs.args;this.updateTime(c,l,...u)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return Ay.get(this)||jy}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>Sh(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(t,n,r,i=!0){var a,o,s,l,u,d,f,p,m,h;let g={};typeof r==`number`?g.duration=r:typeof r==`object`&&Object.assign(g,r),this.works===jy&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(t))for(let e of t)e instanceof Qp?v.push(e):typeof e!=`string`&&`work`in e?v.push($p(e.work,e)):v.push($p(e));else t instanceof Qp?v.push(t):v.push($p(t));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=nm(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);n===void 0&&(n=`inherit`),n===`inherit`&&this.works===jy&&(n=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(a=x.mode)==null?S?`Panorama`:`Mapview`:a,T={};if(n===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{n={mode:b};let e=(s=(o=y[0])==null?void 0:o.observers)==null?void 0:s[this.panoIndex];e?(n.workCode=e.work.workCode,n.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(n.workCode=y.initial.work.workCode,n.panoIndex=y.initial.panoIndex):(n.mode===`Panorama`||n.mode===`VRPanorama`||n.mode===`XRPanorama`)&&(n.mode=`Mapview`),n.mode===b&&(n.longitude=this.camera.pose.longitude,n.latitude=this.camera.pose.latitude,n.fov=this.camera.pose.fov)}}if(n===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof n==`object`){if(w=(u=n.mode)==null?b:u,typeof n.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=n.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:n.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset?new c.Vector3().copy(n.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;(w===`Panorama`||w===`VRPanorama`||w===`XRPanorama`)&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,$(`works.request`,{input:t,works:y,userAction:i}));let O=(e,t,r)=>{let a=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),r);n===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:a,duration:E,effect:D,userAction:i}},this.commonParams()),this.controllerInits[e]),c=zv[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},i)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=zv[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i}))}this.controller=this.applyController(e,s);let t=$(`mode.change`,{prevMode:b,mode:e,state:c,userAction:i});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};Ay.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),Ah(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(q),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,$(`works.load`,{input:t,userAction:i,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,$(`works.ready`,{input:t,userAction:i,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var t;this.controller&&(this.controller.destroy(),this.controller=void 0);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((t=n.pano0)==null?void 0:t.map)&&n.pano1.map.dispose(),n.set({pano0:null,pano1:null,modelAlpha:1}),Ay.set(this,jy),this.modelScene.setModels(jy,{forceReplaceImmediately:!0}),this.renderer&&this.modelScene.update(this.renderer,this.camera),this.needsRender=!0,this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.camera.setFromPose({distance:0,fov:Sy,longitude:0,latitude:0,offset:new c.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(m)){let e=Error(`PanoId ${Q(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!gp(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(q):(gp(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(q));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=zv[t].initAnimationEndState(r),o=$(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=$(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=ri.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),ri.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),Eh().then(()=>_()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),s(t)})):t===e.Mode.XRPanorama?Dh().then(e=>{ri.shared.setContext(e),a=!0,_()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),s(t)}):_()})}getPixels(e,t,n,r,i,a,o){if(!this.renderer)throw Error(`renderer is not initialized.`);let s=U(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new c.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof t==`number`&&(p=t),typeof n==`number`&&(m=n),typeof r==`number`&&(h=r),g=i,_=a,b=o):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&(this.controller instanceof zv.Panorama||this.controller instanceof zv.VRPanorama||this.controller instanceof zv.XRPanorama)&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(s),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=Oy.copy(this.renderer.getClearColor()),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(s),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,P=ee*4;if(b){if(b.length!==P)throw Error(`buffer length is not equals pixels ${P}`)}else b=new Uint8Array(P);if(this.renderer.readRenderTargetPixels(C,0,0,m*g,h*g,b),_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=Oy.copy(t.getClearColor()),c=t.getClearAlpha(),l=t.getViewport(Ey),u=t.getScissor(Dy),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(ky),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;if(this.controller&&this.controller.render()&&(y=!1),y){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&oy(t)}this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&ri.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&co.detectSupport(this.renderer),this.syncingState=this.syncState(e,t),this.controller&&this.controller.updateTime(e,t,...n),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){let e=this.modelScene.loaded,t=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),e===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),ri.shared.add(()=>{this.emit(`models.load`,$(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&ri.shared.add(()=>{this.emit(`models.refined`,$(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){Ty.makeEmpty(),Ty.expandByObject(this.modelScene.boundingMesh);let t=Ty.getBoundingSphere(wy),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius);let r=W(n/500,.001,.1),i=W(n,800);this.camera.near!==r&&(this.camera.near=r),this.camera.far!==i&&(this.camera.far=i),this.camera.updateTime(e)}if(this.renderer){let e=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=e}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.pbmGSRenderMesh&&this.pbmGSRenderMesh.needsRender===!0&&(this.pbmGSRenderMesh.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused===!0)return;let r=$(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,$(`render`,{needsRender:i})),this.hasListener(`fps`)&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit(`fps`,this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof Ym&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=q){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=U();return Promise.all(r.map(e=>{let t=Q({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},mr(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Kr(i,r);return _f(this.fiveId,n.work).preload(a)})).then(()=>{let e=U()-i;return t(e),e})}project2d(e,t=!1){if(!this.renderer)return null;if(t){let t=this.camera.position,n=e.clone().sub(t),r=new c.Raycaster(t,n.clone().normalize());r.params.Points={threshold:.1};let[i]=this.modelScene.intersectRaycaster(r);if(i&&i.distance+.01<n.length())return null}let n=e.clone().project(this.camera);if(Math.abs(n.z)>1)return null;let r=this.renderer.getSize(new c.Vector2),i=r.x*this.viewport.width,a=r.y*this.viewport.height,o=r.x*this.viewport.left+(n.x+1)/2*i,s=r.y*(1-this.viewport.bottom-this.viewport.height)+(-n.y+1)/2*a;return new c.Vector2(o,s)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,t=!1,n=!0){var r,i,a,o,s,l,u,d,f,p;e=mr(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof c.Vector3)&&(e.offset=new c.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(i=(r=this.work)==null?void 0:r.workCode)==null?``:i,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(a=e.mode)==null?this.state.mode:a,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){if(h===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let t={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(t.longitude=e.longitude),typeof e.latitude==`number`&&(t.latitude=e.latitude),typeof e.fov==`number`&&(t.fov=e.fov),typeof e.distance==`number`&&(t.distance=e.distance),e.offset instanceof c.Vector3&&(t.offset=e.offset);let n=Object.assign(Object.assign({initial:{state:t,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),r=zv[h].initAnimationEndState(n);g=r.longitude,_=r.latitude,v=r.fov,y=r.offset,b=r.distance}else g=(o=e.longitude)==null?this.state.longitude:o,_=(s=e.latitude)==null?this.state.latitude:s,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,$(`state.set`,{userAction:n,state:x})),kh(this.state,x)||(this.controller&&x.mode===`VRPanorama`&&x.mode!==this.state.mode?(Oh(this.state,x),this.changeMode(`VRPanorama`)):this.controller&&x.mode===`XRPanorama`&&x.mode!==this.state.mode?(Oh(this.state,x),this.changeMode(`XRPanorama`)):(Oh(this.state,x),this.controller&&n&&(this.controller.userAction=!1),t&&this.state.mode===x.mode&&(this.syncingState=this.syncState(U(),0,t),this.syncingState&&((f=this.controller)==null||f.updateTime(U(),0),this.syncingState=!1)),this.emit(`state.change`,$(`state.change`,{userAction:n,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state)))}syncState(t,n,r=!1){let i=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){let e={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,e,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof zv.Model){if(xh(this.camera.pose.offset,this.state.offset)){let e={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,Object.assign(Object.assign({},e),{duration:r?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!gp(e,this.pano)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`){let t={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(e,t,!1),!0}}if(this.controller instanceof zv.Floorplan||this.controller instanceof zv.Topview||this.controller instanceof zv.Mapview){let e=.2,t=Math.PI/45,n=r?this.state.fov:bm(this.camera.pose.fov,this.state.fov,1),i=Math.abs(this.camera.pose.distance-this.state.distance),a=i>e*15?i/15:.2,o=r?this.state.distance:bm(this.camera.pose.distance,this.state.distance,a),s=this.camera.pose.offset.distanceTo(this.state.offset),l=s>e*15?s/15:e,u=r?new c.Vector3().copy(this.state.offset):xm(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Sm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},t);if(yh(n,this.camera.pose.fov)||xh(u,this.camera.pose.offset)||yh(o,this.camera.pose.distance)||yh(d,this.camera.pose.longitude,Math.PI*2)||yh(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:n};return Object.assign(e,{distance:o}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(q),this.controller.locationMotion.set(e,0).catch(q),!0}}else{let e=Math.PI/45,t=r?this.state.fov:bm(this.camera.pose.fov,this.state.fov,1),{longitude:n,latitude:i}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Sm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),a=this.state.distance,o=new c.Vector3().copy(this.state.offset);if(yh(a,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),xh(o,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),yh(n,this.camera.pose.longitude,Math.PI*2)||yh(i,this.camera.pose.latitude)||yh(t,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:n,latitude:i,fov:t},0).catch(q),!0}if(this.stateSynced=!0,i===!1&&this.emit(`state.synced`,$(`state.synced`,{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){let t=this.currentMode;if(!(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)||this.modelScene.loaded){let e=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(let t of e)this.controller instanceof zv.Panorama&&t.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(t):t()}}return!1}ready(e={}){return new Promise(t=>{var n;this.readyCallbacks.push(Object.assign(t,{tile:(n=e.tile)==null?!1:n}))}).then(()=>this.model.initReady).then(q)}requestFullscreen(){var e;if(!Th)return;let t=(e=this.getElement())==null?void 0:e.parentNode;t&&`requestFullscreen`in t&&typeof document<`u`&&document.fullscreenElement===null&&t.requestFullscreen()}exitFullscreen(){typeof document<`u`&&document.fullscreenElement&&`exitFullscreen`in document&&document.exitFullscreen()}throwError(e){this.hasListener(`error`)?this.emit(`error`,e):console.error(e)}bindModel(e){let t=()=>{ri.shared.add(()=>{this.emit(`model.load`,$(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,$(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,$(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,$(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,$(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,$(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new fr({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=zp(e,r);return t instanceof Error?Promise.reject(t):t})}});vf(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(t,n){if(!this.renderer)throw Error(`renderer is not initialized.`);let r=zv[t];this.currentMode=t;let i=new r(n);for(let e of Vv)i.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=zv[t].initAnimationEndState(n),r=n.initial.userAction;kh(this.state,e)||(Oh(this.state,e),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,$(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return i.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,$(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),i.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,$(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),i.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),i.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),i.on(`error`,e=>this.throwError(e)),i}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let t=new c.Object3D;t.matrix.copy(e.matrix).premultiply(e.work.transform),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixAutoUpdate=!1;let n=new c.Vector3(0,0,-1);n.applyQuaternion(this.camera.quaternion);let r=t.quaternion.clone().inverse();return n.applyQuaternion(r),{theta:Math.atan2(n.x,-n.z),phi:-Math.asin(n.y),lookAtVector:n}}}return null}addPass(e){this.fiveRenderer.composer.addPass(e)}removePass(e){let t=this.fiveRenderer.composer.passes.indexOf(e);t!==-1&&this.fiveRenderer.composer.passes.splice(t,1)}insertPass(e,t){this.fiveRenderer.composer.insertPass(e,t)}get renderMode(){return this.fiveRenderer.renderMode}set renderMode(e){this.fiveRenderer.renderMode=e}get enableHQ(){return this.fiveRenderer.renderMode===`point-cloud-high-quality`}set enableHQ(e){this.fiveRenderer.renderMode=e?`point-cloud-high-quality`:`default`,this.needsRender=!0}get enableEDL(){return this.eyeDomeLightingPass.enabled}set enableEDL(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0}get enableAdaptiveLuminance(){return this.adaptiveLuminancePass.enabled}set enableAdaptiveLuminance(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0}get enableIOSEDR(){return!1}set enableIOSEDR(e){}get enablePostProcessing(){return!0}set enablePostProcessing(e){}get modelSceneNeedsRender(){return this.modelScene.needsRender}set modelSceneNeedsRender(e){this.modelScene.needsRender=e}};if(Ny.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`){let e={THREE:c,constructor:Ny,instances:My};Object.assign(window,{__FIVE_DEBUG__:e})}var Py=class{static createButton(e){let t=document.createElement(`button`);function n(){t.style.display=``,t.style.cursor=`pointer`,t.style.left=`calc(50% - 50px)`,t.style.width=`100px`,t.textContent=`ENTER VR`,t.onmouseenter=function(){t.style.opacity=`1.0`},t.onmouseleave=function(){t.style.opacity=`0.5`},t.onclick=function(){e&&e()}}function r(){t.style.display=``,t.style.cursor=`auto`,t.style.left=`calc(50% - 75px)`,t.style.width=`150px`,t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function i(){r(),t.textContent=`VR NOT SUPPORTED`}function a(e){e.style.position=`absolute`,e.style.bottom=`20px`,e.style.padding=`12px 6px`,e.style.border=`1px solid #fff`,e.style.borderRadius=`4px`,e.style.background=`rgba(0,0,0,0.1)`,e.style.color=`#fff`,e.style.font=`normal 13px sans-serif`,e.style.textAlign=`center`,e.style.opacity=`0.5`,e.style.outline=`none`,e.style.zIndex=`999`}if(`xr`in navigator)return t.id=`VRButton`,t.style.display=`none`,a(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():i()}),t;{let e=document.createElement(`a`);return window.isSecureContext===!1?(e.href=document.location.href.replace(/^http:/,`https:`),e.innerHTML=`WEBXR NEEDS HTTPS`):(e.href=`https://immersiveweb.dev/`,e.innerHTML=`WEBXR NOT AVAILABLE`),e.style.left=`calc(50% - 90px)`,e.style.width=`180px`,e.style.textDecoration=`none`,a(e),e}}};exports.AdaptiveLuminancePass=Dm,exports.AnimationFrameLoop=ri,exports.BoundingMesh=Gf,exports.Camera=en,exports.CustomShader=un,exports.PBMCustomShader=un,exports.EffectComposer=rm,exports.EyeDomeLightingPass=Am,exports.Fetcher=fr,exports.Five=Ny,exports.FivePass=am,exports.FiveRenderer=Jm,exports.FullScreenQuad=im,exports.Histogram=_m,exports.InternalWebGLRenderer=Ym,exports.Model=If,exports.ModelScene=qf,exports.Motion=Z,exports.NetworkSubscribe=sr,exports.PBMContainer=Kn,exports.PBMGSObject=Yn,exports.PBMGroup=Ct,exports.PBMMesh=yn,exports.PBMMeshMaterial=vn,exports.PBMPanoFilter=dn,exports.PBMPointCloud=kn,exports.PBMPointCloudMaterial=On,exports.PBMSkinnedMesh=bn,exports.PBMUpdateable=ln,exports.PROXY_CONTROLLER_EVENT_NAMES=Vv,exports.PanoCircleMesh=sh,exports.PanoCircleMeshCustom=_h,exports.PanoCircleMeshSolid=fh,exports.Parameter=K,exports.Scene=nh,exports.Subscribe=cn,exports.TextureLoader=hi,exports.Tile=jl,exports.Tile3D=hf,exports.Tile3DModel=hf,exports.TileCache=rd,exports.TileNode=Ku,exports.TileRequestScheduler=ed,exports.Tileset=ld,exports.Trajectory=Xu,exports.TrajectoryNode=Zu,exports.Work=Qp,exports.WorkResolvedObserver=tm,exports.XRButton=Py,exports.controllersDefaultInitArgs=Bv,exports.coordinatesToVector=Vt,exports.createDebugBoundingMesh=El,exports.createWorks=nm,exports.defaultImageURLTransform=Kr,exports.draco=eo,exports.getViewportScale=Kv,exports.headingToLongitude=Wt,exports.imageSupport=kr,exports.isBoundingVolume=xl,exports.isPanoId=_p,exports.ktx2=co,exports.loadAt3d=ea,exports.loadB3dm=rs,exports.loadDome=ia,exports.loadDomez=da,exports.loadFbx=vc,exports.loadGltf=fs,exports.loadPbm=Mi,exports.loadPly=ms,exports.loadPnts=us,exports.loadSplat=tl,exports.loadSpz=Qo,exports.loadX3p=Qc,exports.longitudeToHeading=Ut,exports.makeBoundingVolume=Sl,exports.panoEqual=gp,exports.panoParse=hp,exports.panoStringify=Q,exports.parseWork=$p,exports.vectorToCoordinates=Ht,exports.workToJson=Qf;
|
|
2324
|
+
\\f\\v\\v\\v\\0\\v\\v \\0A\\b\\v\`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:P}}function b(){function e(e,t){return I=e.exports,N(I),d(),I}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h??=g(),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch{}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==\`function\`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._sort=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var P={a:k};function F(){f();function e(){n.calledRun=!0,!o&&(p(),c?.(n),n.onRuntimeInitialized?.(),m())}n.setStatus?(n.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>n.setStatus(\`\`),1),e()},1)):e()}var I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}let n;function r(){return e(this,void 0,void 0,function*(){n=yield t()})}let i,a,o,s,c,l,u,d,f,p=0,m=0,h=[],g=!0,_=!1,v=!1,y=!1,b=()=>e(void 0,void 0,void 0,function*(){if(_){v=!0;return}_=!0,v=!1,n||(yield r());let e=2**Math.ceil(Math.log2(i.vertexCount));p<e&&(p>0&&(n._free(a),n._free(s),n._free(c),n._free(l),n._free(u),n._free(d),n._free(f)),p=e,a=n._malloc(64),s=n._malloc(p*4),c=n._malloc(3*p*4),l=n._malloc(p*4),u=n._malloc(p*4),d=n._malloc(p*4),f=n._malloc(p*4)),m<i.transforms.length&&(m>0&&n._free(o),m=i.transforms.length,o=n._malloc(m*4)),_=!1,v&&(v=!1,yield b())}),x=()=>{if(_||v||!n)return;_=!0,n.HEAPF32.set(i.positions,c/4),n.HEAPF32.set(i.transforms,o/4),n.HEAPU32.set(i.transformIndices,s/4),n.HEAPF32.set(new Float32Array(h),a/4),n._sort(a,o,s,i.vertexCount,c,l,u,d,f);let e=new Uint32Array(n.HEAPU32.buffer,u,i.vertexCount),t=new Uint32Array(e.slice().buffer);self.postMessage({depthIndex:t,generation:i.generation},[t.buffer]),_=!1,g=!1},S=()=>{y||(y=!0,g&&x(),setTimeout(()=>{y=!1,S()}))};self.onmessage=e=>new Promise(t=>{if(e.data.warmup){r().finally(()=>t(!0));return}e.data.sortData&&(i={positions:new Float32Array(e.data.sortData.positions),transforms:new Float32Array(e.data.sortData.transforms),transformIndices:new Uint32Array(e.data.sortData.transformIndices),vertexCount:e.data.sortData.vertexCount,generation:e.data.sortData.generation??0},g=!0,b()),e.data.viewProj?(e.data.viewProj.every(e=>h.includes(e))===!1&&(h=e.data.viewProj,g=!0),S(),t(!0)):t(!0)})})();`,vy=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,_y],{type:`text/javascript;charset=utf-8`});function yy(e){let t;try{if(t=vy&&(self.URL||self.webkitURL).createObjectURL(vy),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(_y),{name:e==null?void 0:e.name})}}var by=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{Hnvor-sy|n-}ynV{qr\x07H{vs|z-uvtu}-nz}yr?Q-lr\x07rH{vs|z-uvtu}-nz}yr?Q-ln{s|zH{vs|z-uvtu}-nz}yr?Q-ln{s|zV{qvprH{vs|z-uvtu}-nz}yr?Q-lyn\brV{qvprH{vs|z-uvtu}-nz}yr?Q-luar\x07rH{vs|z-rp?-luar\x07r`v rH{vs|z-v{-lzn\x07`uQrtrrH0vs-[bZlT`lPYV]]R_`-K-=----{vs|z-rp?-lyn\brPyv}}r_n{trh[bZlT`lYNfR_`jH----{vs|z-znA-lpyv}}rZnvprV{rrh[bZlT`lPYV]]R_`jH0r{qvs{vs|z-rp?-r|yv|{Hn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH<<参考Tnvn{`}yn@qp|{-sy|n-\0E-J-\05E;=6H<<原版的固定xr{ry`v r,不要轻易调整这个数p|{-sy|n-xr{ry?Q`v r-J-=;@Hp|{-sy|n-zn\x07`prr{`}npr`}yn`v r-J-?=AE;=H<<固定的u相关系数p|{-sy|n-`UlP>-J-=;AEEC=?B>>F=?F>FFHp|{-sy|n-`UlP?l=-J->;=F?BAEAHp|{-sy|n-`UlP?l>-J-:>;=F?BAEAHp|{-sy|n-`UlP?l?-J-=;@>B@F>CHp|{-sy|n-`UlP?l@-J-:>;=F?BAEAHp|{-sy|n-`UlP?lA-J-=;BAC?DA?Hrp?-tr`UQnnbc5v{-}ynVq\x079-v{-p|z}|{r{\\ssr9-rp?-r\x07r`v r6-\n----v{-uP|z}|{r{P|{-J-=H----vs-5lzn\x07`uQrtrr-KJ->6-uP|z}|{r{P|{-8J-FH----vs-5lzn\x07`uQrtrr-KJ-?6-uP|z}|{r{P|{-8J->BH----vs-5lzn\x07`uQrtrr-KJ-@6-uP|z}|{r{P|{-8J-?>H--------v{-}nqqrqP|z}|{r{P|{-J-uP|z}|{r{P|{H----vs-5}nqqrqP|z}|{r{P|{-2-A-.J-=6-\n--------}nqqrqP|z}|{r{P|{-J-55}nqqrqP|z}|{r{P|{-<-A6-8->6-7-AH----\f--------sy|n-yv{rnP|z}|{r{V{qr\x07-J-sy|n5}ynVq\x07-7-}nqqrqP|z}|{r{P|{-8-p|z}|{r{\\ssr6H----sy|n-r\x07ryV{qr\x07-J-yv{rnP|z}|{r{V{qr\x07-<-A;=H------sy|n-q-J-r\x07ryV{qr\x07-<-r\x07r`v r;\x07H----sy|n-\b-J-sy||5q6-<-r\x07r`v r;\bH----sy|n-\x07-J-snp5q6H----r{-rp?5\x079-\b6H\f|vq-znv{-56-\n----v{-}ynV{qr\x07b-J-v{5}ynV{qr\x07-8-=;B6H----v{-}ynV{qr\x07V-J-v{5}ynV{qr\x07b6H----rpA-pr{-J-r\x07rySrpu5lr\x07r9-vrp?55}ynV{qr\x07b-3-=\x07@ss6-II->9-}ynV{qr\x07b-KK->=69-=6H--------v{-n{s|zV{qr\x07-J-r\x07rySrpu5ln{s|zV{qvpr9-vrp?5}ynV{qr\x07b-3-=\x07@ss9-}ynV{qr\x07b-KK->=69-=6;\x07H----znA-n{s|z-J-znA5--------r\x07rySrpu5ln{s|z9-vrp?5=9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5>9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5?9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5@9-n{s|zV{qr\x0769-=6----6H----znA-n{s|zZ|qrycvrZnv\x07-J-vrZnv\x07-7-n{s|zH----rp@-}ynPr{r-J-v{Ova|Sy|n5pr{;\x07\b 6H----rpA-|yqPr{r-J-n{s|z-7-rpA5}ynPr{r9->;=6H----0vs-[bZlT`lPYV]]R_`-K-=----v{-yn\brV{qr\x07-J-v{5r\x07rySrpu5lyn\brV{qvpr9-vrp?5}ynV{qr\x07b-3-=\x07@ss9-}ynV{qr\x07b-KK->=69-=6;\x076H----vs-5yn\brV{qr\x07-KJ-=-33-yn\brV{qr\x07-I-[bZlT`lYNfR_`6-\n--------rp?-pyv}_n{tr-J-lyn\brPyv}}r_n{trhyn\brV{qr\x07jH--------v{-pyv}`n-J-v{5pyv}_n{tr;\x07-8-=;B6H--------v{-pyv}P|{-J-v{5pyv}_n{tr;\b-8-=;B6H--------v{-pyv}R{q-J-pyv}`n-8-pyv}P|{H--------s|-5v{-v-J-=H-v-I-[bZlT`lPYV]]R_`H-v886-\n----------------vs-5v-I-pyv}`n-\v\v-v-KJ-pyv}R{q6-\n--------------------p|{v{rH----------------\f----------------rpA-pyv}}r]|vv|{-J-lpyv}}rZnvprV{rrhvj-7-|yqPr{rH----------------o||y-pyv}}rq-J-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH----------------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH----------------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH----------------vs-5pyv}}rq6-\n--------------------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------------------r{H----------------\f--------\f----\f----0r{qvs----rpA-vrPr{r-J-n{s|zZ|qrycvrZnv\x07-7-rpA5}ynPr{r9->;=6H----rpA-pyv}Pr{r-J-}|wrpv|{Znv\x07-7-vrPr{rH----<<剔除超出视锥体的}yn----sy|n-pyv}-J->;?-7-pyv}Pr{r;H----vs-5pyv}Pr{r; -I-:pyv}Pr{r;-\v\v-pyv}Pr{r; -K-pyv}Pr{r;-\v\v---------pyv}Pr{r;\x07-I-:pyv}-\v\v-pyv}Pr{r;\x07-K-pyv}-\v\v---------pyv}Pr{r;\b-I-:pyv}-\v\v-pyv}Pr{r;\b-K-pyv}6-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f----rp@-{qpPr{r-J-pyv}Pr{r;\x07\b -<-pyv}Pr{r;H----rp?-s|pny-J-rp?5--------}|wrpv|{Znv\x07h=jh=j-7-r|yv|{;\x07-7-=;B9--------}|wrpv|{Znv\x07h>jh>j-7-r|yv|{;\b-7-=;B----6H--------]|vv|{-J-}|vv|{;\x07\bH----<<-读取协方差数据(使用-unys?\x07>C-打包)----rpA-p|-J-r\x07rySrpu5lr\x07r9-vrp?555}ynV{qr\x07b-3-=\x07@ss6-II->6-\v->9-}ynV{qr\x07b-KK->=69-=6H----rp?->-J-{}npxUnys?\x07>C5p|;\x076H-----rp?-?-J-{}npxUnys?\x07>C5p|;\b6H------rp?-@-J-{}npxUnys?\x07>C5p|; 6H----------sy|n-Z>>-J->;\x07-<-A;=H----sy|n-Z>?-J->;\b-<-A;=H----sy|n-Z>@-J-?;\x07-<-A;=H----sy|n-Z??-J-?;\b-<-A;=H----sy|n-Z?@-J-@;\x07-<-A;=H----sy|n-Z@@-J-@;\b-<-A;=H--------zn@-cx-J-zn@5--------Z>>9-Z>?9-Z>@9--------Z>?9-Z??9-Z?@9----------Z>@9-Z?@9-Z@@-------6H----<<-判断是否是正交模式:透视时-}|wrpv|{Znv\x07h@jh@j-J-=,正交时-J->----o||y-v\\u|tn}uvp-J-}|wrpv|{Znv\x07h@jh@j-K-=;DH----sy|n-n{vznv|{]|tr-J--}|wrpv|{Znv\x07h@jh@jH----zn@-WH----vs-5v\\u|tn}uvp6-\n--------<<-正交模式的雅可比矩阵--------W-J-n{}|r5zn@5------------s|pny;\x079-=;=9-=;=9------------=;=9-s|pny;\b9-=;=9------------=;=9-=;=9-=;=--------66H----\f-ryr-\n--------<<-透视模式的雅可比矩阵--------sy|n--J->;=-<-5vrPr{r; -7-vrPr{r; 6H--------W-J-zn@5------------s|pny;\x07-<-vrPr{r; 9-=;=9-:5s|pny;\x07-7-vrPr{r;\x076-7-9------------=;=9-s|pny;\b-<-vrPr{r; 9-:5s|pny;\b-7-vrPr{r;\b6-7-9------------=;=9-=;=9-=;=--------6H----\f----zn@-d-J-n{}|r5zn@5n{s|zZ|qrycvrZnv\x0766H----zn@-a-J-d-7-WH----<<-将-@Q-协方差矩阵变换为-?Q-协方差矩阵----zn@-p|?Qz-J-n{}|r5a6-7-cx-7-aH----p|?Qzh=jh=j-8J-xr{ry?Q`v rH----p|?Qzh>jh>j-8J-xr{ry?Q`v rH----rp@-p|?Q-J-rp@5p|?Qzh=jh=j9-p|?Qzh=jh>j9-p|?Qzh>jh>j6H----sy|n-n-J-p|?Q;\x07H----sy|n-q-J-p|?Q; H----sy|n-o-J-p|?Q;\bH----sy|n-Q-J-n-7-q-:-o-7-oH----sy|n-npr-J-n-8-qH----sy|n-npr\\r?-J-=;B-7-nprH----sy|n-rz?-J-\05zn\x075=;>9-npr\\r?-7-npr\\r?-:-Q66H----sy|n-rvtr{cnyr>-J-npr\\r?-8-rz?H----sy|n-rvtr{cnyr?-J-npr\\r?-:-rz?H----vs-5rvtr{cnyr?-IJ-=;=6-\n--------r{H----\f----rp?-rvtr{crp|>-J-{|znyv r5rp?5o9-rvtr{cnyr>-:-n66H----rp?-rvtr{crp|?-J-rp?5rvtr{crp|>;\b9-:rvtr{crp|>;\x076H----rp?-onvcrp|>-J-rvtr{crp|>--7-zv{5\0E-7-\05rvtr{cnyr>69-zn\x07`prr{`}npr`}yn`v r6H----rp?-onvcrp|?-J-rvtr{crp|?--7-zv{5\0E-7-\05rvtr{cnyr?69-zn\x07`prr{`}npr`}yn`v r6H----rp?-onvcvr}|-J-rp?5>;=-<-r|yv|{;\x079->;=-<-r|yv|{;\b6H----rp?-{qp\\ssr-J-rp?5]|vv|{;\x07-7-onvcrp|>-8-]|vv|{;\b-7-onvcrp|?6-7---------------------onvcvr}|-7-?;=H----rpA-\0nq]|-J-rpA5{qpPr{r;\x07\b-8-{qp\\ssr9-{qpPr{r; 9->;=6H----tyl]|vv|{-J-\0nq]|H----<<-读取颜色----rpA-p|y|-J-rpA5--------5p|;6-3-=\x07ss9--------5p|;-KK-E6-3-=\x07ss9--------5p|;-KK->C6-3-=\x07ss9--------5p|;-KK-?A6-3-=\x07ss----6-<-?BB;=H----<<应用球谐光照,目前只兼容=>?----vs-5lzn\x07`uQrtrr-KJ->6-\n--------rp@-pnzrn]|V{\\owrp-J-rp@5v{rr5n{s|z6-7-rpA5pnzrn]|vv|{9->;=66H--------rp@-|owrpcvrQv-J-{|znyv r5}ynPr{r-:-pnzrn]|V{\\owrp6H----------------rpA-u=>?@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-=9-luar\x07r`v r66H----------rpA-uABCD-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-A9-luar\x07r`v r66H----------rpA-uEF>=>>-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-E9-luar\x07r`v r66H-----------------rp@-u>-J-u=>?@;toH-----------------------------------rp@-u?-J-rp@5u=>?@;n9-uABCD;t6H---------------------rp@-u@-J-rp@5uABCD;on9-uEF>=>>;6H-----------------------------sy|n-\x07-J-|owrpcvrQv;\x07H--------sy|n-\b-J-|owrpcvrQv;\bH--------sy|n- -J-|owrpcvrQv; H--------rp@-uP|y|-J-u>-7-5:=;AEEC=?B-7-\b6-8-u?-7-5=;AEEC=?B-7- 6-8-u@-7-5:=;AEEC=?B-7-\x076H--------p|y|;to-8J-uP|y|H----------------vs-5lzn\x07`uQrtrr-KJ-?6-\n----------------------rpA-u>?>@>A>B-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9->?9-luar\x07r`v r66H------------rpA-u>C>D>E>F-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9->C9-luar\x07r`v r66H-------------rpA-u?=?>???@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-?=9-luar\x07r`v r66H-------------------------rp@-uA-J-uEF>=>>;tonH------------------------------------rp@-uB-J-u>?>@>A>B;toH----------------------------------rp@-uC-J-rp@5u>?>@>A>B;n9-u>C>D>E>F;t6H---------------rp@-uD-J-rp@5u>C>D>E>F;on9-u?=?>???@;6H---------------rp@-uElqrt?-J-u?=?>???@;tonH-----------------------------------------sy|n-\x07\x07-J-\x07-7-\x07H------------sy|n-\b\b-J-\b-7-\bH------------sy|n- -J- -7- H------------sy|n-\x07\b-J-\x07-7-\bH------------sy|n-\b -J-\b-7- H------------sy|n-\x07 -J-\x07-7- H------------------------p|y|;to-8J----------------5`UlP?l=-7-\x07\b6-7-uA-8----------------5`UlP?l>-7-\b 6-7-uB-8----------------5`UlP?l?-7-5?;=-7- -:-\x07\x07-:-\b\b66-7-uC-8----------------5`UlP?l@-7-\x07 6-7-uD-8----------------5`UlP?lA-7-5\x07\x07-:-\b\b66-7-uElqrt?H--------\f----\f--------p|y|;to-J-pynz}5p|y|;to9-rp@5=;=69-rp@5>;=66H----P|y|-J-p|y|H----]|vv|{-7J-\0EH----b-J-}|vv|{;\x07\bH\f"),xy=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`}rpvv|{-uvtu}-sy|nH0v{pyqr-Ip|zz|{Kn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH|vq-znv{-56-
|
|
2325
|
+
----<<-计算从-}yn-中心到当前片段的平方距离----<<-由于-]|vv|{-已经按-\05E6-缩放,平方结果会被缩放-E-倍----<<-如果平方结果大于-E,说明在椭圆外,距离均值超过-\05E6-个标准差----sy|n-N-J-q|5]|vv|{9-]|vv|{6H----vs-5N-K-E;=6-qvpnqH--------rp@-p|y|-J-P|y|;toH--------<<-由于渲染的-}yn-按-\05E6-缩放,高斯公式中的逆协方差矩阵部分变成单位矩阵----<<-因此只剩下-5e-:-zrn{6-7-5e-:-zrn{6,而-zrn{-为零,所以是-e-7-e,即-N----sy|n-|}npv\b-J-r\x07}5:=;B-7-N6-7-P|y|;nH--------tylSntP|y|-J-rpA5p|y|;to9-|}npv\b6H\f`),Sy=class extends c.Mesh{constructor(){super(),this.renderData=null,this.needsRender=!1,this.sortWorker=null,this.depthIndex=new Uint32Array,this.splatIndexCapacity=0,this.activeSlot=null,this.pendingSlot=null,this.rebuildGeneration=0,this.forceClipperUniformRefresh=!1,this.incrementalUpdateInFlight=!1,this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.layerIndicesTexture=null,this.shTexture=null,this.usedSHDegree=0,this.onBeforeRender=(e,t,n)=>{let r=n,i=this.collectObjects(t);if(i.length===0){this.geometry.instanceCount=0;return}let a=0;i.forEach(e=>{e.usedSHDegree>a&&(a=e.usedSHDegree)}),this.setMaxShDegree(a),this.isSceneNeedsRebuild(i)&&(this.tryStartIncrementalUpdate(i)||(this.startPendingRebuild(i),this.gsSceneState.lastClipperHash=``));let o=i.filter(e=>e.transformChanged);o.length>0&&(this.syncTransformsForSlot(this.activeSlot,o),this.syncTransformsForSlot(this.pendingSlot,o),o.forEach(e=>{e.transformChanged=!1,e.selectedChanged=!1})),this.activeSlot&&this.updateSlotTextures(this.activeSlot),this.pendingSlot&&this.updateSlotTextures(this.pendingSlot);let s=new c.Matrix4().multiplyMatrices(r.perspectiveProjectionMatrix,r.matrixWorldInverse).elements;this.pendingSlot&&this.pendingSlot.renderData.initialBuildComplete&&this.pendingSlot.awaitingFirstSort?this.requestSort(this.pendingSlot,s):this.activeSlot&&this.requestSort(this.activeSlot,s);let l=this.getClipperHash(i);if((this.forceClipperUniformRefresh||l!==this.gsSceneState.lastClipperHash)&&(this.updateClipperUniforms(i),this.gsSceneState.lastClipperHash=l,this.forceClipperUniformRefresh=!1,this.needsRender=!0),this.activeSlot){let e=Math.min(this.usedSHDegree,this.activeSlot.renderData.maxShDegree);this.material.uniforms.u_maxShDegree.value=e,e>0&&!this.activeSlot.textures.shTexture?this.createSHTexture(this.activeSlot):e===0&&this.activeSlot.textures.shTexture&&(this.activeSlot.textures.shTexture.dispose(),this.activeSlot.textures.shTexture=null),this.material.uniforms.u_shTexture.value=this.activeSlot.textures.shTexture,this.renderData=this.activeSlot.renderData}else this.pendingSlot||(this.bindSlotTextures(null),this.material.uniforms.u_maxShDegree.value=0,this.geometry.instanceCount=0);this.material.uniforms.resolution.value.set(r.resolution.x,r.resolution.y)};let e=this.createGeometry(),t=this.createMaterial();this.geometry=e,this.material=t,this.frustumCulled=!1,this.renderOrder=-99999999999,this.gsSceneState={lastObjectsHash:``,lastClipperHash:``},this.sortWorker=new yy,this.sortWorker.postMessage({warmup:!0}),gy.warmupWasm(),this.sortWorker.onmessage=e=>{if(e.data.depthIndex){let t=e.data.generation;if(this.pendingSlot&&t===this.pendingSlot.generation){this.pendingSlot.awaitingFirstSort=!1,this.swapPendingToActive(e.data.depthIndex);return}this.activeSlot&&t===this.activeSlot.generation&&(this.activeSlot.awaitingFirstSort=!1,this.applyDepthIndex(e.data.depthIndex))}}}ensureSplatIndexCapacity(e){let t=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return t;let n=this.getExpandedCapacity(e),r=t.array,i=new Float32Array(n);i.set(r.subarray(0,Math.min(r.length,n)));let a=new c.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(c.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=n,this.geometry._maxInstanceCount=n,a}getExpandedCapacity(e){let t=Math.max(this.splatIndexCapacity,1);for(;t<e;)t*=2;return t}createGeometry(){let e=new c.InstancedBufferGeometry,t=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]);e.setAttribute(`position`,new c.BufferAttribute(t,3));let n=new Uint16Array([0,1,2,0,2,3]);e.setIndex(new c.BufferAttribute(n,1)),this.splatIndexCapacity=1;let r=new Float32Array(this.splatIndexCapacity);for(let e=0;e<r.length;e++)r[e]=e;let i=new c.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(c.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}createMaterial(){return new c.ShaderMaterial({vertexShader:by,fragmentShader:xy,defines:{NUM_GS_LAYERS:0,NUM_GS_CLIPPERS:0},uniforms:{u_texture:{value:null},u_transforms:{value:null},u_transformIndices:{value:null},u_layerIndices:{value:null},u_numGsLayers:{value:0},u_numGsClippers:{value:0},u_layerClipperRanges:{value:[]},u_clipperMatricesInverse:{value:[]},u_shTexture:{value:null},u_shTextureSize:{value:new c.Vector2},u_maxShDegree:{value:0},resolution:{value:new c.Vector2}},side:c.DoubleSide,transparent:!0,blending:c.NormalBlending,depthTest:!0,depthWrite:!1})}createDefaultLayerClipperRanges(e){return Array.from({length:e},()=>new c.Vector2(-1,0))}createDefaultClipperMatrices(e){return Array.from({length:e},()=>new c.Matrix4)}createTextures(e){let t=new c.DataTexture(e.data,e.width,e.height,c.RGBAIntegerFormat,c.UnsignedIntType);t.internalFormat=`RGBA32UI`,t.minFilter=c.NearestFilter,t.magFilter=c.NearestFilter,t.needsUpdate=!0;let n=new c.DataTexture(e.transforms,e.transformsWidth,e.transformsHeight,c.RGBAFormat,c.FloatType);n.internalFormat=`RGBA32F`,n.minFilter=c.NearestFilter,n.magFilter=c.NearestFilter,n.needsUpdate=!0;let r=new c.DataTexture(e.transformIndices,e.transformIndicesWidth,e.transformIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType);r.internalFormat=`R32UI`,r.minFilter=c.NearestFilter,r.magFilter=c.NearestFilter,r.needsUpdate=!0;let i=new c.DataTexture(e.layerIndices,e.layerIndicesWidth,e.layerIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType);return i.internalFormat=`R32UI`,i.minFilter=c.NearestFilter,i.magFilter=c.NearestFilter,i.needsUpdate=!0,{dataTexture:t,transformsTexture:n,transformIndicesTexture:r,layerIndicesTexture:i,shTexture:null}}createSHTexture(e){let{renderData:t,textures:n}=e;n.shTexture&&(n.shTexture.dispose(),n.shTexture=null);let r=Math.min(this.usedSHDegree,t.maxShDegree),i=0;if(r>=1&&(i+=9),r>=2&&(i+=15),r>=3&&(i+=21),i===0)return;let a=i;a%4!=0&&(a=Math.ceil(a/4)*4);let o=t.numPoints*a/4,s=2048,l=Math.ceil(o/s),u=new Float32Array(s*l*4);for(let e=0;e<t.numPoints;e++){let n=a/4*e,i=0;if(t.sh1&&r>=1)for(let r=0;r<9;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh1[e*9+r],i++}if(t.sh2&&r>=2)for(let r=0;r<15;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh2[e*15+r],i++}if(t.sh3&&r>=3)for(let r=0;r<21;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh3[e*21+r],i++}}n.shTexture=new c.DataTexture(u,s,l,c.RGBAFormat,c.FloatType),n.shTexture.internalFormat=`RGBA32F`,n.shTexture.minFilter=c.NearestFilter,n.shTexture.magFilter=c.NearestFilter,n.shTexture.needsUpdate=!0,this.material.uniforms.u_shTextureSize.value.set(s,l),this.material.uniforms.u_maxShDegree.value=r}setMaxShDegree(e){var t,n;if(e<0||e>2){console.warn(`现在只支持012三种阶数,你输入的是${e}`);return}let r=this.usedSHDegree;this.usedSHDegree=e,r!==e&&((t=this.activeSlot)!=null&&t.textures.shTexture&&(this.activeSlot.textures.shTexture.dispose(),this.activeSlot.textures.shTexture=null),(n=this.pendingSlot)!=null&&n.textures.shTexture&&(this.pendingSlot.textures.shTexture.dispose(),this.pendingSlot.textures.shTexture=null),this.material.uniforms.u_maxShDegree.value=e,e===0?this.material.uniforms.u_shTexture.value=null:this.activeSlot&&this.activeSlot.renderData.maxShDegree>0&&(this.createSHTexture(this.activeSlot),this.material.uniforms.u_shTexture.value=this.activeSlot.textures.shTexture))}bindSlotTextures(e){if(!e){this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.layerIndicesTexture=null,this.shTexture=null,this.material.uniforms.u_texture.value=null,this.material.uniforms.u_transforms.value=null,this.material.uniforms.u_transformIndices.value=null,this.material.uniforms.u_layerIndices.value=null,this.material.uniforms.u_shTexture.value=null;return}this.dataTexture=e.textures.dataTexture,this.transformsTexture=e.textures.transformsTexture,this.transformIndicesTexture=e.textures.transformIndicesTexture,this.layerIndicesTexture=e.textures.layerIndicesTexture,this.shTexture=e.textures.shTexture,this.material.uniforms.u_texture.value=this.dataTexture,this.material.uniforms.u_transforms.value=this.transformsTexture,this.material.uniforms.u_transformIndices.value=this.transformIndicesTexture,this.material.uniforms.u_layerIndices.value=this.layerIndicesTexture,this.material.uniforms.u_shTexture.value=this.shTexture}disposeSlot(e){e&&(e.renderData.dispose(),this.disposeTextures(e.textures))}disposeTextures(e){e.dataTexture.dispose(),e.transformsTexture.dispose(),e.transformIndicesTexture.dispose(),e.layerIndicesTexture.dispose(),e.shTexture&&(e.shTexture.dispose(),e.shTexture=null)}applyDepthIndex(e){this.depthIndex=e;let t=this.depthIndex.length,n=this.ensureSplatIndexCapacity(t);n.array.set(this.depthIndex,0),n.count=this.depthIndex.length,n.updateRange.offset=0,n.updateRange.count=t,n.needsUpdate=!0,this.geometry.instanceCount=this.depthIndex.length,this.needsRender=!0}swapPendingToActive(e){if(!this.pendingSlot)return;let t=this.activeSlot;this.activeSlot=this.pendingSlot,this.pendingSlot=null,this.renderData=this.activeSlot.renderData,this.ensureSplatIndexCapacity(this.activeSlot.renderData.numPoints),this.bindSlotTextures(this.activeSlot),this.activeSlot.sortDataUploaded=!0,this.forceClipperUniformRefresh=!0,this.applyDepthIndex(e),t&&this.disposeSlot(t)}createSlot(e){let t={generation:e.generation,renderData:e,textures:this.createTextures(e),awaitingFirstSort:!0,sortDataUploaded:!1};return this.usedSHDegree>0&&e.maxShDegree>0&&this.createSHTexture(t),t}updateSlotTextures(e){e.renderData.dataChanged&&(e.textures.dataTexture.needsUpdate=!0,e.renderData.dataChanged=!1),e.renderData.transformsChanged&&(e.textures.transformsTexture.needsUpdate=!0,e.textures.transformIndicesTexture.needsUpdate=!0,e.renderData.transformsChanged=!1)}postSortData(e){var t;let n=new Float32Array(e.renderData.positions.slice().buffer),r=new Float32Array(e.renderData.transforms.slice().buffer),i=new Uint32Array(e.renderData.transformIndices.slice().buffer);(t=this.sortWorker)==null||t.postMessage({sortData:{positions:n,transforms:r,transformIndices:i,vertexCount:e.renderData.numPoints,generation:e.generation}},[n.buffer,r.buffer,i.buffer]),e.sortDataUploaded=!0}requestSort(e,t){var n;e.renderData.initialBuildComplete&&((e.renderData.dataChanged||e.renderData.transformsChanged||!e.sortDataUploaded)&&this.postSortData(e),(n=this.sortWorker)==null||n.postMessage({viewProj:t}))}syncTransformsForSlot(e,t){e&&t.forEach(t=>{e.renderData.splatIndices.has(t)&&e.renderData.updateTransform(t)})}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof Yn&&e.visible&&t.push(e)}),t.sort((e,t)=>{let n=e.uuid+e.gsViewLayerKey,r=t.uuid+t.gsViewLayerKey;return n<r?-1:n>r?1:0}),t}isSceneNeedsRebuild(e){let t=e.map(e=>`${e.uuid}:${e.gsViewLayerKey}`).join(`|`),n=t!==this.gsSceneState.lastObjectsHash;return this.gsSceneState.lastObjectsHash=t,n}getClipperHash(e){return e.map(e=>{let t=e.gsClippers.map(e=>{var t;return`${(t=e.floorIndex)==null?-1:t}:${e.clippingBoxMatrix.elements.join(`,`)}`}).join(`;`);return`${e.gsViewLayerKey}:${t}`}).join(`|`)}updateClipperCounts(e,t){let n=Math.max(0,e|0),r=Math.max(0,t|0),i=this.material.defines;(i.NUM_GS_LAYERS!==n||i.NUM_GS_CLIPPERS!==r)&&(i.NUM_GS_LAYERS=n,i.NUM_GS_CLIPPERS=r,this.material.needsUpdate=!0),this.material.uniforms.u_numGsLayers.value=e,this.material.uniforms.u_numGsClippers.value=t}updateClipperUniforms(e){var t,n,r,i;let a=(n=(t=this.activeSlot)==null?void 0:t.renderData)==null?null:n;if(!a){this.material.uniforms.u_layerClipperRanges.value=[],this.material.uniforms.u_clipperMatricesInverse.value=[],this.updateClipperCounts(0,0);return}let o=new Map;for(let t of e)o.has(t.gsViewLayerKey)||o.set(t.gsViewLayerKey,t.gsClippers);let s=a.layerKeys.length,c=0;for(let e of a.layerKeys)c+=((r=o.get(e))==null?[]:r).length;let l=this.createDefaultLayerClipperRanges(s),u=this.createDefaultClipperMatrices(c),d=0;for(let e of a.layerKeys){let t=a.layerKeyToIndex.get(e);if(t===void 0)continue;let n=(i=o.get(e))==null?[]:i,r=d,s=0;for(let e of n)u[d].getInverse(e.clippingBoxMatrix),d++,s++;s>0&&l[t].set(r,s)}this.material.uniforms.u_layerClipperRanges.value=l,this.material.uniforms.u_clipperMatricesInverse.value=u,this.updateClipperCounts(s,d)}startPendingRebuild(e){this.pendingSlot&&(this.disposeSlot(this.pendingSlot),this.pendingSlot=null),this.rebuildGeneration+=1;let t=new gy(e,this.rebuildGeneration);this.pendingSlot=this.createSlot(t)}tryStartIncrementalUpdate(e){if(!this.activeSlot||this.pendingSlot||this.incrementalUpdateInFlight)return!1;let t=this.activeSlot.renderData.getObjectsInOrder();if(!this.activeSlot.renderData.canIncrementalAppend(e))return!1;let n=e.slice(t.length);if(n.length===0)return!1;this.incrementalUpdateInFlight=!0;let r=this.activeSlot;return r.renderData.appendObjects(n).then(e=>{if(!e||this.activeSlot!==r||r.renderData.disposed)return;let t=r.textures;r.textures=this.createTextures(r.renderData),this.usedSHDegree>0&&r.renderData.maxShDegree>0&&this.createSHTexture(r),this.bindSlotTextures(r),this.ensureSplatIndexCapacity(r.renderData.numPoints),r.sortDataUploaded=!1,r.awaitingFirstSort=!0,this.disposeTextures(t),this.forceClipperUniformRefresh=!0,this.gsSceneState.lastClipperHash=``,this.needsRender=!0}).catch(e=>{console.warn(`Incremental append failed, fallback to rebuild:`,e)}).finally(()=>{this.incrementalUpdateInFlight=!1}),!0}dispose(){this.disposeSlot(this.pendingSlot),this.pendingSlot=null,this.disposeSlot(this.activeSlot),this.activeSlot=null,this.renderData=null,this.sortWorker&&this.sortWorker.terminate(),this.bindSlotTextures(null),this.geometry.dispose(),this.material.dispose()}},Cy=class extends c.Mesh{constructor(){super(),this.onBeforeRender=(e,t,n)=>{this.collectObjects(t).length>0&&console.warn(`未开启webgl2, 3dgs仅支持在开启webgl2模式后使用`)}}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof Yn&&e.visible&&t.push(e)}),t}},wy=1e3,Ty=90,Ey=e=>e.replace(`//vrlab-public.ljcdn.com/`,`//vr-public.realsee-cdn.cn/`).replace(`//vrlab-image4.ljcdn.com/`,`//vr-image-4.realsee-cdn.cn/`).replace(`//vrlab-image3.ljcdn.com/`,`//vr-image-3.realsee-cdn.cn/`).replace(`//vrlab-image2.ljcdn.com/`,`//vr-image-2.realsee-cdn.cn/`).replace(`//vrlab-image1.ljcdn.com/`,`//vr-image-1.realsee-cdn.cn/`),Dy=new c.Sphere,Oy=new c.Box3,ky=new c.Vector4,Ay=new c.Vector4,jy=new c.Color,My=new c.Vector2,Ny=new WeakMap,Py=nm([$p(null)]),Fy={},Iy=class e extends cn{static get version(){return`6.8.0-alpha.21`}static get dracoPath(){return eo.decoderPath}static set dracoPath(e){eo.setDecoderPath(e)}static get ktx2Path(){return co.transcoderPath}static set ktx2Path(e){co.setTranscoderPath(e)}static get useNativeImageBitmap(){return si()}static set useNativeImageBitmap(e){oi(e)}constructor(e={}){var t,n,r,i,a,o,s,l,u,d,f;if(super(),this.pbmGaussianSplattingRenderMesh=null,this.fiveId=nn(),Fy[this.fiveId]=this,this.currentUpdateArgs={time:U(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!1,this.onlyRenderIfNeeds=(t=e.onlyRenderIfNeeds)==null?!0:t,this.imageOptions=Object.assign({},(n=e.imageOptions)==null?{}:n),this.textureOptions=Object.assign({},(r=e.textureOptions)==null?{}:r),this.poweredByRealsee=(i=e.poweredByRealsee)==null?!0:i,this.backgroundColor=new c.Color((a=e.backgroundColor)==null?1579548:a),this.backgroundAlpha=(o=e.backgroundAlpha)==null?1:o,this.extraElements=[],this.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},this.fps={testCount:0,testTime:U()},this.modeChangeDuration=(s=e.modeChangeDuration)==null?wy:s,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof Ym&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new Ym({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=Kv();this.renderer.setPixelRatio(t===1?window.devicePixelRatio:1),this.renderer.setSize(512,512),this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha)}catch(e){let t=e instanceof Error?e:Error(String(e));this.throwError(t)}this.getPixelsRenderTarget=new c.WebGLRenderTarget(1,1,{encoding:(d=(u=this.renderer)==null?void 0:u.outputEncoding)==null?c.sRGBEncoding:d,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new en(Ty),this.scene=new nh,this.xrCustomObjectsScene=new c.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.loadWorkTask=Promise.resolve(),this.requestProxy=(f=e.requestProxy)==null?Ey:f,this.networkSubscribe=new sr,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,$(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new c.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),Ny.set(this,Py),this.modelScene=new qf({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(Py,{forceReplaceImmediately:!0});H(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new c.VideoTexture(e.videoInstance||Uv());let m=Wv();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=ri.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,$(`vr.requestExit`,{}))},g=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,g,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,g,!1)},this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}Hv(this),this.fiveRenderer=new Jm,this.adaptiveLuminancePass=new Dm,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new Am(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGaussianSplattingRenderMesh=new Sy,this.scene.add(this.pbmGaussianSplattingRenderMesh)):this.scene.add(new Cy)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}get panoId(){return Q(this.pano)}dispose(){var e;if(this.destroyed===!0)return;delete Fy[this.fiveId],this.emit(`dispose`),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);let t=this.getElement();t&&t.parentNode&&t.parentNode.removeChild(t);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((e=n.pano0)==null?void 0:e.map)&&n.pano1.map.dispose(),n.reset(`pano0`,`pano1`),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),Ny.set(this,Py),this.renderer&&this.renderer.render(new c.Scene,new c.Camera),this.fiveRenderer.dispose(),this.renderer instanceof Ym&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}setViewport(e){Object.assign(this.viewport,e),this.needsRender=!0}get boundingMesh(){return this.modelScene.boundingMesh}get helperVisible(){return this.helperGroup.visible}set helperVisible(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit(`helpers.visible`,$(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,gr(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,gr(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,gr(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,gr(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,gr(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,gr(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode===`Panorama`||this.currentMode===`VRPanorama`)&&(r=!0,n=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),t&&n&&this.controller&&this.currentMode&&(!this.controller.updateConfiguration(this.controllerInits[this.currentMode])||r)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}appendTo(e,t={}){if(!this.renderer)return;if(!(this.renderer instanceof Ym)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i;if(!this.renderer)return;let a=this.renderer.domElement.parentNode,{width:o=(n=a==null?void 0:a.offsetWidth)==null?512:n,height:s=(r=a==null?void 0:a.offsetHeight)==null?512:r}=e;if(o=Math.max(1,o),s=Math.max(1,s),!t){let e=Kv(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(o,s)*t,n=Math.min(this.renderer.capabilities.maxTextureSize,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(o,s),this.needsRender=!0;let c=U(),l=c-this.currentUpdateArgs.time,u=this.currentUpdateArgs.args;this.updateTime(c,l,...u)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return Ny.get(this)||Py}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>Sh(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(t,n,r,i=!0){var a,o,s,l,u,d,f,p,m,h;let g={};typeof r==`number`?g.duration=r:typeof r==`object`&&Object.assign(g,r),this.works===Py&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(t))for(let e of t)e instanceof Qp?v.push(e):typeof e!=`string`&&`work`in e?v.push($p(e.work,e)):v.push($p(e));else t instanceof Qp?v.push(t):v.push($p(t));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=nm(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);n===void 0&&(n=`inherit`),n===`inherit`&&this.works===Py&&(n=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(a=x.mode)==null?S?`Panorama`:`Mapview`:a,T={};if(n===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{n={mode:b};let e=(s=(o=y[0])==null?void 0:o.observers)==null?void 0:s[this.panoIndex];e?(n.workCode=e.work.workCode,n.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(n.workCode=y.initial.work.workCode,n.panoIndex=y.initial.panoIndex):(n.mode===`Panorama`||n.mode===`VRPanorama`||n.mode===`XRPanorama`)&&(n.mode=`Mapview`),n.mode===b&&(n.longitude=this.camera.pose.longitude,n.latitude=this.camera.pose.latitude,n.fov=this.camera.pose.fov)}}if(n===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof n==`object`){if(w=(u=n.mode)==null?b:u,typeof n.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=n.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:n.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset?new c.Vector3().copy(n.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;(w===`Panorama`||w===`VRPanorama`||w===`XRPanorama`)&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,$(`works.request`,{input:t,works:y,userAction:i}));let O=(e,t,r)=>{let a=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),r);n===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:a,duration:E,effect:D,userAction:i}},this.commonParams()),this.controllerInits[e]),c=zv[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},i)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=zv[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i}))}this.controller=this.applyController(e,s);let t=$(`mode.change`,{prevMode:b,mode:e,state:c,userAction:i});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};Ny.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),Ah(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(q),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,$(`works.load`,{input:t,userAction:i,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,$(`works.ready`,{input:t,userAction:i,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var t;this.controller&&(this.controller.destroy(),this.controller=void 0);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((t=n.pano0)==null?void 0:t.map)&&n.pano1.map.dispose(),n.set({pano0:null,pano1:null,modelAlpha:1}),Ny.set(this,Py),this.modelScene.setModels(Py,{forceReplaceImmediately:!0}),this.renderer&&this.modelScene.update(this.renderer,this.camera),this.needsRender=!0,this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.camera.setFromPose({distance:0,fov:Ty,longitude:0,latitude:0,offset:new c.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(m)){let e=Error(`PanoId ${Q(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!gp(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(q):(gp(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(q));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=zv[t].initAnimationEndState(r),o=$(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=$(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=ri.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),ri.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),Eh().then(()=>_()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),s(t)})):t===e.Mode.XRPanorama?Dh().then(e=>{ri.shared.setContext(e),a=!0,_()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),s(t)}):_()})}getPixels(e,t,n,r,i,a,o){if(!this.renderer)throw Error(`renderer is not initialized.`);let s=U(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new c.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof t==`number`&&(p=t),typeof n==`number`&&(m=n),typeof r==`number`&&(h=r),g=i,_=a,b=o):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&(this.controller instanceof zv.Panorama||this.controller instanceof zv.VRPanorama||this.controller instanceof zv.XRPanorama)&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(s),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=jy.copy(this.renderer.getClearColor()),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(s),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,P=ee*4;if(b){if(b.length!==P)throw Error(`buffer length is not equals pixels ${P}`)}else b=new Uint8Array(P);if(this.renderer.readRenderTargetPixels(C,0,0,m*g,h*g,b),_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=jy.copy(t.getClearColor()),c=t.getClearAlpha(),l=t.getViewport(ky),u=t.getScissor(Ay),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(My),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;if(this.controller&&this.controller.render()&&(y=!1),y){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&oy(t)}this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&ri.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&co.detectSupport(this.renderer),this.syncingState=this.syncState(e,t),this.controller&&this.controller.updateTime(e,t,...n),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){let e=this.modelScene.loaded,t=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),e===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),ri.shared.add(()=>{this.emit(`models.load`,$(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&ri.shared.add(()=>{this.emit(`models.refined`,$(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){Oy.makeEmpty(),Oy.expandByObject(this.modelScene.boundingMesh);let t=Oy.getBoundingSphere(Dy),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius),n=W(n,800);let r=n/1e4;r=W(r,.03,.1),this.camera.near!==r&&(this.camera.near=r),this.camera.far!==n&&(this.camera.far=n),this.camera.updateTime(e)}if(this.renderer){let e=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=e}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.pbmGaussianSplattingRenderMesh&&this.pbmGaussianSplattingRenderMesh.needsRender===!0&&(this.pbmGaussianSplattingRenderMesh.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused===!0)return;let r=$(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,$(`render`,{needsRender:i})),this.hasListener(`fps`)&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit(`fps`,this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof Ym&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=q){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=U();return Promise.all(r.map(e=>{let t=Q({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},mr(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Kr(i,r);return _f(this.fiveId,n.work).preload(a)})).then(()=>{let e=U()-i;return t(e),e})}project2d(e,t=!1){if(!this.renderer)return null;if(t){let t=this.camera.position,n=e.clone().sub(t),r=new c.Raycaster(t,n.clone().normalize());r.params.Points={threshold:.1};let[i]=this.modelScene.intersectRaycaster(r);if(i&&i.distance+.01<n.length())return null}let n=e.clone().project(this.camera);if(Math.abs(n.z)>1)return null;let r=this.renderer.getSize(new c.Vector2),i=r.x*this.viewport.width,a=r.y*this.viewport.height,o=r.x*this.viewport.left+(n.x+1)/2*i,s=r.y*(1-this.viewport.bottom-this.viewport.height)+(-n.y+1)/2*a;return new c.Vector2(o,s)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,t=!1,n=!0){var r,i,a,o,s,l,u,d,f,p;e=mr(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof c.Vector3)&&(e.offset=new c.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(i=(r=this.work)==null?void 0:r.workCode)==null?``:i,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(a=e.mode)==null?this.state.mode:a,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){if(h===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let t={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(t.longitude=e.longitude),typeof e.latitude==`number`&&(t.latitude=e.latitude),typeof e.fov==`number`&&(t.fov=e.fov),typeof e.distance==`number`&&(t.distance=e.distance),e.offset instanceof c.Vector3&&(t.offset=e.offset);let n=Object.assign(Object.assign({initial:{state:t,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),r=zv[h].initAnimationEndState(n);g=r.longitude,_=r.latitude,v=r.fov,y=r.offset,b=r.distance}else g=(o=e.longitude)==null?this.state.longitude:o,_=(s=e.latitude)==null?this.state.latitude:s,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,$(`state.set`,{userAction:n,state:x})),kh(this.state,x)||(this.controller&&x.mode===`VRPanorama`&&x.mode!==this.state.mode?(Oh(this.state,x),this.changeMode(`VRPanorama`)):this.controller&&x.mode===`XRPanorama`&&x.mode!==this.state.mode?(Oh(this.state,x),this.changeMode(`XRPanorama`)):(Oh(this.state,x),this.controller&&n&&(this.controller.userAction=!1),t&&this.state.mode===x.mode&&(this.syncingState=this.syncState(U(),0,t),this.syncingState&&((f=this.controller)==null||f.updateTime(U(),0),this.syncingState=!1)),this.emit(`state.change`,$(`state.change`,{userAction:n,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state)))}syncState(t,n,r=!1){let i=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){let e={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,e,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof zv.Model){if(xh(this.camera.pose.offset,this.state.offset)){let e={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,Object.assign(Object.assign({},e),{duration:r?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!gp(e,this.pano)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`){let t={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(e,t,!1),!0}}if(this.controller instanceof zv.Floorplan||this.controller instanceof zv.Topview||this.controller instanceof zv.Mapview){let e=.2,t=Math.PI/45,n=r?this.state.fov:bm(this.camera.pose.fov,this.state.fov,1),i=Math.abs(this.camera.pose.distance-this.state.distance),a=i>e*15?i/15:.2,o=r?this.state.distance:bm(this.camera.pose.distance,this.state.distance,a),s=this.camera.pose.offset.distanceTo(this.state.offset),l=s>e*15?s/15:e,u=r?new c.Vector3().copy(this.state.offset):xm(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Sm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},t);if(yh(n,this.camera.pose.fov)||xh(u,this.camera.pose.offset)||yh(o,this.camera.pose.distance)||yh(d,this.camera.pose.longitude,Math.PI*2)||yh(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:n};return Object.assign(e,{distance:o}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(q),this.controller.locationMotion.set(e,0).catch(q),!0}}else{let e=Math.PI/45,t=r?this.state.fov:bm(this.camera.pose.fov,this.state.fov,1),{longitude:n,latitude:i}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Sm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),a=this.state.distance,o=new c.Vector3().copy(this.state.offset);if(yh(a,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),xh(o,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),yh(n,this.camera.pose.longitude,Math.PI*2)||yh(i,this.camera.pose.latitude)||yh(t,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:n,latitude:i,fov:t},0).catch(q),!0}if(this.stateSynced=!0,i===!1&&this.emit(`state.synced`,$(`state.synced`,{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){let t=this.currentMode;if(!(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)||this.modelScene.loaded){let e=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(let t of e)this.controller instanceof zv.Panorama&&t.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(t):t()}}return!1}ready(e={}){return new Promise(t=>{var n;this.readyCallbacks.push(Object.assign(t,{tile:(n=e.tile)==null?!1:n}))}).then(()=>this.model.initReady).then(q)}requestFullscreen(){var e;if(!Th)return;let t=(e=this.getElement())==null?void 0:e.parentNode;t&&`requestFullscreen`in t&&typeof document<`u`&&document.fullscreenElement===null&&t.requestFullscreen()}exitFullscreen(){typeof document<`u`&&document.fullscreenElement&&`exitFullscreen`in document&&document.exitFullscreen()}throwError(e){this.hasListener(`error`)?this.emit(`error`,e):console.error(e)}bindModel(e){let t=()=>{ri.shared.add(()=>{this.emit(`model.load`,$(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,$(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,$(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,$(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,$(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,$(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new fr({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=zp(e,r);return t instanceof Error?Promise.reject(t):t})}});vf(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(t,n){if(!this.renderer)throw Error(`renderer is not initialized.`);let r=zv[t];this.currentMode=t;let i=new r(n);for(let e of Vv)i.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=zv[t].initAnimationEndState(n),r=n.initial.userAction;kh(this.state,e)||(Oh(this.state,e),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,$(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return i.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,$(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),i.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!kh(this.state,n)&&(Oh(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,$(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),i.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),i.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),i.on(`error`,e=>this.throwError(e)),i}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let t=new c.Object3D;t.matrix.copy(e.matrix).premultiply(e.work.transform),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixAutoUpdate=!1;let n=new c.Vector3(0,0,-1);n.applyQuaternion(this.camera.quaternion);let r=t.quaternion.clone().inverse();return n.applyQuaternion(r),{theta:Math.atan2(n.x,-n.z),phi:-Math.asin(n.y),lookAtVector:n}}}return null}addPass(e){this.fiveRenderer.composer.addPass(e)}removePass(e){let t=this.fiveRenderer.composer.passes.indexOf(e);t!==-1&&this.fiveRenderer.composer.passes.splice(t,1)}insertPass(e,t){this.fiveRenderer.composer.insertPass(e,t)}get renderMode(){return this.fiveRenderer.renderMode}set renderMode(e){this.fiveRenderer.renderMode=e}get enableHQ(){return this.fiveRenderer.renderMode===`point-cloud-high-quality`}set enableHQ(e){this.fiveRenderer.renderMode=e?`point-cloud-high-quality`:`default`,this.needsRender=!0}get enableEDL(){return this.eyeDomeLightingPass.enabled}set enableEDL(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0}get enableAdaptiveLuminance(){return this.adaptiveLuminancePass.enabled}set enableAdaptiveLuminance(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0}get enableIOSEDR(){return!1}set enableIOSEDR(e){}get enablePostProcessing(){return!0}set enablePostProcessing(e){}get modelSceneNeedsRender(){return this.modelScene.needsRender}set modelSceneNeedsRender(e){this.modelScene.needsRender=e}};Iy.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`&&Object.assign(window,{__FIVE_DEBUG__:{THREE:c,constructor:Iy,instances:Fy}});var Ly=class{static createButton(e){let t=document.createElement(`button`);function n(){t.style.display=``,t.style.cursor=`pointer`,t.style.left=`calc(50% - 50px)`,t.style.width=`100px`,t.textContent=`ENTER VR`,t.onmouseenter=function(){t.style.opacity=`1.0`},t.onmouseleave=function(){t.style.opacity=`0.5`},t.onclick=function(){e&&e()}}function r(){t.style.display=``,t.style.cursor=`auto`,t.style.left=`calc(50% - 75px)`,t.style.width=`150px`,t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function i(){r(),t.textContent=`VR NOT SUPPORTED`}function a(e){e.style.position=`absolute`,e.style.bottom=`20px`,e.style.padding=`12px 6px`,e.style.border=`1px solid #fff`,e.style.borderRadius=`4px`,e.style.background=`rgba(0,0,0,0.1)`,e.style.color=`#fff`,e.style.font=`normal 13px sans-serif`,e.style.textAlign=`center`,e.style.opacity=`0.5`,e.style.outline=`none`,e.style.zIndex=`999`}if(`xr`in navigator)return t.id=`VRButton`,t.style.display=`none`,a(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():i()}),t;{let e=document.createElement(`a`);return window.isSecureContext===!1?(e.href=document.location.href.replace(/^http:/,`https:`),e.innerHTML=`WEBXR NEEDS HTTPS`):(e.href=`https://immersiveweb.dev/`,e.innerHTML=`WEBXR NOT AVAILABLE`),e.style.left=`calc(50% - 90px)`,e.style.width=`180px`,e.style.textDecoration=`none`,a(e),e}}};exports.AdaptiveLuminancePass=Dm,exports.AnimationFrameLoop=ri,exports.BoundingMesh=Gf,exports.Camera=en,exports.CustomShader=un,exports.PBMCustomShader=un,exports.EffectComposer=rm,exports.EyeDomeLightingPass=Am,exports.Fetcher=fr,exports.Five=Iy,exports.FivePass=am,exports.FiveRenderer=Jm,exports.FullScreenQuad=im,exports.Histogram=_m,exports.InternalWebGLRenderer=Ym,exports.Model=If,exports.ModelScene=qf,exports.Motion=Z,exports.NetworkSubscribe=sr,exports.PBMContainer=Kn,exports.PBMGSObject=Yn,exports.PBMGroup=Ct,exports.PBMMesh=yn,exports.PBMMeshMaterial=vn,exports.PBMPanoFilter=dn,exports.PBMPointCloud=kn,exports.PBMPointCloudMaterial=On,exports.PBMSkinnedMesh=bn,exports.PBMUpdateable=ln,exports.PROXY_CONTROLLER_EVENT_NAMES=Vv,exports.PanoCircleMesh=sh,exports.PanoCircleMeshCustom=_h,exports.PanoCircleMeshSolid=fh,exports.Parameter=K,exports.Scene=nh,exports.Subscribe=cn,exports.TextureLoader=hi,exports.Tile=jl,exports.Tile3D=hf,exports.Tile3DModel=hf,exports.TileCache=rd,exports.TileNode=Ku,exports.TileRequestScheduler=ed,exports.Tileset=ld,exports.Trajectory=Xu,exports.TrajectoryNode=Zu,exports.Work=Qp,exports.WorkResolvedObserver=tm,exports.XRButton=Ly,exports.controllersDefaultInitArgs=Bv,exports.coordinatesToVector=Vt,exports.createDebugBoundingMesh=El,exports.createWorks=nm,exports.defaultImageURLTransform=Kr,exports.draco=eo,exports.getViewportScale=Kv,exports.headingToLongitude=Wt,exports.imageSupport=kr,exports.isBoundingVolume=xl,exports.isPanoId=_p,exports.ktx2=co,exports.loadAt3d=ea,exports.loadB3dm=rs,exports.loadDome=ia,exports.loadDomez=da,exports.loadFbx=vc,exports.loadGltf=fs,exports.loadPbm=Mi,exports.loadPly=ms,exports.loadPnts=us,exports.loadSplat=tl,exports.loadSpz=Qo,exports.loadX3p=Qc,exports.longitudeToHeading=Ut,exports.makeBoundingVolume=Sl,exports.panoEqual=gp,exports.panoParse=hp,exports.panoStringify=Q,exports.parseWork=$p,exports.vectorToCoordinates=Ht,exports.workToJson=Qf;
|