@realsee/five 6.9.0-alpha.2 → 6.9.0-alpha.3
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/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/five.AdaptiveLuminancePass.html +1 -1
- package/docs/classes/five.EyeDomeLightingPass.html +1 -1
- package/docs/classes/five.FivePass.html +1 -1
- package/docs/classes/five.FlowingFireworks3DPass.html +1 -1
- package/docs/classes/five.FlowingLight2DPass.html +1 -1
- package/docs/classes/five.FlowingLight3DPass.html +1 -1
- package/docs/classes/five.GaussianBlurPass.html +1 -1
- package/docs/classes/five.Model.html +1 -1
- package/docs/classes/five.ModelScene.html +1 -1
- package/docs/classes/five.PBMCustomShader.html +1 -1
- package/docs/classes/five.PBMGSObject.html +26 -6
- package/docs/classes/five.PBMMeshMaterial.html +1 -1
- package/docs/classes/five.PBMPanoFilter.html +1 -1
- package/docs/classes/five.PBMPointCloudMaterial.html +1 -1
- package/docs/classes/five.PBMUpdateable.html +1 -1
- package/docs/classes/five.Parameter.html +1 -1
- package/docs/classes/five.Tile3D.html +1 -1
- package/docs/classes/five.TileNode.html +1 -1
- package/docs/classes/five.TrajectoryNode.html +1 -1
- package/docs/classes/five.WorkResolvedObserver.html +1 -1
- package/docs/classes/gltf-loader.DDSLoader.html +1 -1
- package/docs/classes/gltf-loader.DRACOLoader.html +1 -1
- package/docs/classes/gltf-loader.GLTFObject.html +1 -1
- package/docs/classes/gltf-loader.THREEGLTFLoader.html +1 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/plugins.CSS2DObject.html +1 -1
- package/docs/classes/plugins.CSS3DObject.html +1 -1
- package/docs/classes/plugins.CSS3DSprite.html +1 -1
- package/docs/classes/plugins.InstancedPrefabBufferGeometry.html +1 -1
- package/docs/classes/plugins.Object3DHelperController.html +1 -1
- package/docs/classes/plugins.PointBufferGeometry.html +1 -1
- package/docs/classes/plugins.PrefabBufferGeometry.html +1 -1
- package/docs/classes/plugins.RoundedBoxGeometry.html +1 -1
- package/docs/classes/vfx.Airflow.html +1 -1
- package/docs/classes/vfx.Flame.html +1 -1
- package/docs/classes/vfx.Particle.html +1 -1
- package/docs/classes/vfx.ParticleGPU.html +1 -1
- package/docs/classes/vfx.SpotLight.html +1 -1
- package/docs/functions/five.loadSpz.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/five.LooseWorkWithExtrinsics.html +1 -1
- package/docs/interfaces/five.PBMMaterial.html +1 -1
- package/docs/interfaces/five.PBMMeshMaterialParameters.html +1 -1
- package/docs/interfaces/five.PBMPointCloudMaterialParameters.html +1 -1
- package/docs/interfaces/five.ParameterMaterialValue.html +1 -1
- package/docs/interfaces/five.ParameterTilesetValue.html +1 -1
- package/docs/interfaces/five.ParameterValue.html +1 -1
- package/docs/interfaces/five.ResolvedParameterValue.html +1 -1
- package/docs/interfaces/five.SplatData.html +4 -2
- package/docs/interfaces/five.ViewLayer.html +1 -1
- package/docs/interfaces/five.WorkCubeImage.html +1 -1
- package/docs/interfaces/five.WorkImage.html +1 -1
- package/docs/interfaces/five.WorkObserver.html +1 -1
- package/docs/interfaces/five.WorkObserverProto.html +1 -1
- package/docs/interfaces/five.WorkTile.html +1 -1
- package/docs/interfaces/plugins.BackgroundPluginController.html +1 -1
- package/docs/interfaces/plugins.BackgroundPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.CSS2DPluginController.html +1 -1
- package/docs/interfaces/plugins.CSS2DPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.CSS2DPluginType.State.html +1 -1
- package/docs/interfaces/plugins.CSS3DPluginController.html +1 -1
- package/docs/interfaces/plugins.CSS3DPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.CSS3DPluginType.State.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginController.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginType.State.html +1 -1
- package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationController.html +1 -1
- package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationPluginType.State.html +1 -1
- package/docs/interfaces/plugins.ItemMaskController.html +1 -1
- package/docs/interfaces/plugins.ItemMaskPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.ItemMaskPluginType.State.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.BaseController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.BaseHelper.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.BoundingBoxController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.MoveController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.MoveHelperAbstract.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.RotateController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.RotateHelperAbstract.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginController.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginType.State.html +1 -1
- package/docs/interfaces/plugins.PanoAnimeController.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.State.html +1 -1
- package/docs/interfaces/plugins.PluginTemplateType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PluginTemplateType.State.html +1 -1
- package/docs/interfaces/plugins.TrajectoryController.html +1 -1
- package/docs/interfaces/react.FiveInjectionTypes.html +1 -1
- package/docs/interfaces/react.UseFivePluginOptions.html +1 -1
- package/docs/interfaces/react.UseFivePluginOptionsWithCreate.html +1 -1
- package/docs/types/five.ParseOptions.html +1 -1
- package/five/gaussian-splatting/objectParamsStore.d.ts +35 -0
- package/five/index.js +10 -10
- package/five/index.mjs +105 -64
- package/five/model/loaders/spz.d.ts +9 -0
- package/five/model/objects/pbmGaussianSplattingObject.d.ts +34 -0
- package/five/model/objects/pbmGaussianSplattingRenderMesh.d.ts +6 -0
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/{pbmGaussianSplattingObject-C6i7CUTu.cjs → pbmGaussianSplattingObject-BDOzNal0.cjs} +3 -3
- package/{pbmGaussianSplattingObject-CaE6q4r-.js → pbmGaussianSplattingObject-BwsrwWs6.js} +27 -10
- package/plugins/index.js +2 -2
- package/plugins/index.mjs +2 -2
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/shader-lib/index.js +2 -2
- package/shader-lib/index.mjs +2 -2
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +3 -3
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +2 -2
- package/umd/five-react.js +2 -2
- package/umd/five-shader-lib.js +2 -2
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five-vue.js +2 -2
- package/umd/five.js +8 -8
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
- package/work-downloader/index.js +2 -2
- package/work-downloader/index.mjs +2 -2
package/umd/five.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version: 6.9.0-alpha.
|
|
4
|
+
* Generated: 8/5/2026
|
|
5
|
+
* Version: 6.9.0-alpha.3
|
|
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,s.map(e=>e.fragment.mainEnd).filter(e=>!!e).join(`
|
|
316
316
|
`)),e.fragmentShader=e.fragmentShader.replace(/MAIN_MODEL_COLOR/g,s.map(e=>e.fragment.mainModelColor).filter(e=>!!e).join(`
|
|
317
317
|
`)),e.fragmentShader=e.fragmentShader.replace(/MAIN_PANO_COLOR/g,s.map(e=>e.fragment.mainPanoColor).filter(e=>!!e).join(`
|
|
318
|
-
`));let c=String(this.clippers.length);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,c),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,c);for(let t of s)t.onBeforeCompile&&t.onBeforeCompile(e,r)};let r=``;this.onBeforeRender=(e,o,s,c,l,u)=>{let d=this.shaderType;s instanceof Camera?(n.pixelRatio.value=s.pixelRatio,n.resolution.value.copy(s.resolution)):(n.pixelRatio.value=e.getPixelRatio(),e.getViewport(scratchViewport$4),n.resolution.value.set(scratchViewport$4.width,scratchViewport$4.height));let f=this.transparent===!1&&this.blending===three.NormalBlending;t.USE_OPAQUE!==f&&(t.USE_OPAQUE=f,this.needsUpdate=!0);let p=this.customShaders.filter(e=>e.type.includes(d)).map(e=>`${e.id}:${e.version}`).join(`|`);r!==p&&(r=p,this.needsUpdate=!0)},Object.defineProperty(this,`uniform`,{configurable:!1,enumerable:!1,writable:!1,value:n}),defineProperty(this,`isPBMPointCloudMaterial`,{configurable:!1,writable:!1,value:!0}),defineProperty(this,`isShaderMaterial`,{configurable:!1,writable:!1,value:!0}),defineProperty(this,`opacity`,{get(){return n.opacity.value},set(e){n.opacity.value=e}}),defineProperty(this,`vertexMarks`,{get(){return!!t.USE_VERTEX_MARK},set(e){t.USE_VERTEX_MARK!==e&&(t.USE_VERTEX_MARK=e,this.needsUpdate=!0)}}),defineProperty(this,`pointScale`,{get(){return n.pointScale.value},set(e){n.pointScale.value=e}}),defineProperty(this,`pointMinPixel`,{get(){return n.pointMinPixel.value},set(e){n.pointMinPixel.value=e}}),defineProperty(this,`pointMaxPixel`,{get(){return n.pointMinPixel.value},set(e){n.pointMaxPixel.value=e}}),defineProperty(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)}}),defineProperty(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)}}),defineProperty(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)}}),defineProperty(this,`modelAlpha`,{get(){return n.modelAlpha.value},set(e){n.modelAlpha.value=e}}),defineProperty(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)}}),defineProperty(this,`constantColor`,{get(){return n.constantColor.value},set(e){n.constantColor.value=e}}),defineProperty(this,`floorIndex`,{get(){return n.floorIndex.value},set(e){n.floorIndex.value=e}}),defineProperty(this,`shownFloorIndex`,{get(){return n.shownFloorIndex.value},set(e){n.shownFloorIndex.value=e}}),defineProperty(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)}}),defineProperty(this,`gradientTexture`,{get(){return n.gradientTexture.value},set(e){n.gradientTexture.value=e}}),defineProperty(this,`brightness`,{get(){return n.brightness.value},set(e){n.brightness.value=e}});let o=[];defineProperty(this,`clippers`,{get(){return o},set(e){o!==e&&(o=e,n.clippers.value=o.map(e=>{let t=typeof e.floorIndex==`number`?e.floorIndex:-1;return{matrixInverse:new three.Matrix4().getInverse(e.clippingBoxMatrix),floorIndex:t}}),this.needsUpdate=!0)}}),defineProperty(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)}}),defineProperty(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)}}),defineProperty(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)}}),defineProperty(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)}}),defineProperty(this,`useHQWeight`,{get(){return t.USE_HQ_WEIGHT},set(e){e!==t.USE_HQ_WEIGHT&&(t.USE_HQ_WEIGHT=e,this.needsUpdate=!0)}}),defineProperty(this,`useHQDepth`,{get(){return t.USE_HQ_DEPTH},set(e){e!==t.USE_HQ_DEPTH&&(t.USE_HQ_DEPTH=e,this.needsUpdate=!0)}}),defineProperty(this,`depthOffset`,{get(){return n.depthOffset.value},set(e){n.depthOffset.value=e}}),defineProperty(this,`modelBoundingMin`,{get(){return n.modelBoundingMin.value},set(e){n.modelBoundingMin.value=e}}),defineProperty(this,`modelBoundingMax`,{get(){return n.modelBoundingMax.value},set(e){n.modelBoundingMax.value=e}}),typeof e==`object`&&this.setValues(e),toFastProperties(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.depthOffset=e.depthOffset,this.modelBoundingMin.copy(e.modelBoundingMin),this.modelBoundingMax.copy(e.modelBoundingMax),this}clone(){let e=this.constructor;return new e().copy(this)}refreshUniforms(){}},PBMPointCloud=class extends three.Points{constructor(e,t){super(e,t),this.onBeforeRender=(e,t,n,r,o,s)=>{o instanceof PBMPointCloudMaterial&&o.onBeforeRender&&o.onBeforeRender(e,t,n,r,this,s)}}},gradient_png_data_url_default=`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 getValueKeys(e){return Object.keys(e)}function valueEqual(e,t){return e==t}function arrayValueEqual(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 vector3Equal(e,t){return e instanceof three.Vector3&&t instanceof three.Vector3?e.equals(t):e===t}function box3Equal(e,t){return e instanceof three.Box3&&t instanceof three.Box3?e.equals(t):e===t}var parameterValueEqualFn={customShaders:arrayValueEqual,castShadow:valueEqual,receiveShadow:valueEqual,vertexMarks:valueEqual,pano0:valueEqual,pano1:valueEqual,pano0Depth:valueEqual,pano1Depth:valueEqual,panoFilter:valueEqual,refinedScreen:valueEqual,modelAlpha:valueEqual,progress:valueEqual,transition:valueEqual,opacity:valueEqual,floorStyle:valueEqual,colorStyle:valueEqual,constantColor:vector3Equal,shownFloorIndex:valueEqual,clippers:arrayValueEqual,brightness:valueEqual,useHQWeight:valueEqual,useHQDepth:valueEqual,pointShape:valueEqual,pointSize:valueEqual,pointBack:valueEqual,pointScale:valueEqual,pointMinPixel:valueEqual,pointMaxPixel:valueEqual,pointAppearAnimation:valueEqual,colorSaturation:valueEqual,colorBrightness:valueEqual,useAddBlend:valueEqual,onlyDepth:valueEqual,depthOffset:valueEqual,outlineGain:valueEqual,distanceGain:valueEqual,gradientTexture:valueEqual,boundingBox:box3Equal,gaussianSplattingSHDegree:valueEqual,enableGaussianSplattingInitAnimation:valueEqual,minLevelOfDetail:valueEqual,maxLevelOfDetail:valueEqual,minGeometricError:valueEqual,maxGeometricError:valueEqual,panoramaMinGeometricError:valueEqual,skipLevelOfDetail:valueEqual,mostDetail:valueEqual,loadSiblings:valueEqual,cameraCulling:valueEqual,maxMemoryUsage:valueEqual,maxRequests:valueEqual,requestOrder:valueEqual,maxScreenSpaceError:valueEqual,memoryAdjustedScreenSpaceError:valueEqual,cacheCameras:arrayValueEqual},defaultGradientTexture=(()=>{let e;return e=typeof document<`u`?new three.TextureLoader().load(gradient_png_data_url_default):new three.Texture,e.minFilter=three.NearestFilter,e.magFilter=three.NearestFilter,e.wrapS=three.RepeatWrapping,e.wrapT=three.RepeatWrapping,e})(),defineConstantColor=Object.freeze(new three.Vector3(.6,.6,.6)),defineClippers=Object.freeze([]),defineBoundingBox=Object.freeze(new three.Box3),defineCustomShaders=Object.freeze([]),defineCacheCameras=Object.freeze([]),undefinedValue={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,onlyDepth:void 0,depthOffset:void 0,boundingBox:void 0,gaussianSplattingSHDegree:void 0,enableGaussianSplattingInitAnimation: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},defaultValue={versionNumber:0,customShaders:defineCustomShaders,castShadow:!1,receiveShadow:!1,vertexMarks:!0,pano0:null,pano1:null,pano0Depth:null,pano1Depth:null,panoFilter:null,refinedScreen:null,floorStyle:`OPACITY`,colorStyle:`RGB`,constantColor:defineConstantColor,shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,transition:`FADE`,clippers:defineClippers,brightness:1,useHQWeight:!1,useHQDepth:!1,pointSize:`ATTENUATION`,pointBack:`HIDDEN`,pointShape:`CIRCLE`,pointScale:.02,pointMaxPixel:40,pointMinPixel:0,pointAppearAnimation:!0,gradientTexture:defaultGradientTexture,colorSaturation:0,colorBrightness:0,outlineGain:0,distanceGain:0,useAddBlend:!1,onlyDepth:!1,depthOffset:0,boundingBox:defineBoundingBox,gaussianSplattingSHDegree:0,enableGaussianSplattingInitAnimation:!1,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:defineCacheCameras},parameterVersionSequence=defaultValue.versionNumber,parameterKeys=getValueKeys(undefinedValue);function createUndefindValue(e={}){return Object.assign(e,undefinedValue)}function createDefaultValue(e={}){return Object.assign(e,defaultValue)}function assignValue(e,t,n){let r=parameterValueEqualFn[t];if(!r)return!1;Array.isArray(n)&&(n=n.slice());let o=e[t];return r(o,n)?!1:(e[t]=n,!0)}var Parameter=class e{static createDefault(){return createDefaultValue()}static resolveValueTo(t,...n){let r=createDefaultValue(t);for(let t of n){let n=t instanceof e?t.versionNumber:++parameterVersionSequence;r.versionNumber=r.versionNumber*31+n|0;for(let e of parameterKeys)t[e]!==void 0&&assignValue(r,e,t[e])}return r}static resolveValue(...t){if(typeof t[0]==`string`){let e=t.shift(),n=t,r=defaultValue[e];for(let t of n)t[e]!==void 0&&(r=t[e]);return r}else{let n=t;return e.resolveValueTo({},...n)}}constructor(e){this.id=createUuid$1(),this.versionNumber=++parameterVersionSequence,this.unbind=new Map,this.value=createUndefindValue(),e&&this.copy(e);for(let e of parameterKeys)Object.defineProperty(this,e,{get(){return this.value[e]}});toFastProperties(this)}resolveValue(...t){return e.resolveValue(...t,this)}assignValue(e,t){let n=this.unbind.get(e);n&&(this.unbind.delete(e),n());let r=assignValue(this.value,e,t),o=this.value[e];if(o instanceof PBMUpdateable){let t=o.on(`update`,()=>{this.versionNumber=++parameterVersionSequence});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 parameterKeys)t[e]!==void 0&&this.assignValue(e,t[e])&&(n=!0)}return n&&(this.versionNumber=++parameterVersionSequence),this}reset(...e){let t=!1;for(let n of e)this.assignValue(n,void 0)&&(t=!0);return t&&(this.versionNumber=++parameterVersionSequence),this}resetAll(){return this.reset(...parameterKeys)}copy(e){let t=!0;for(let n of parameterKeys)this.assignValue(n,e[n])&&(t=!0);return t&&(this.versionNumber=++parameterVersionSequence),this}},PBMContainer=class extends three.Group{constructor(){super(...arguments),this.parameter=new Parameter,this.needsRender=!0}get materialParameters(){return this.parameter.resolveValue()}get pbmMaterialParametersVersion(){return String(this.parameter.resolveValue().versionNumber)}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 PBMMesh||t instanceof PBMSkinnedMesh?updatePBMMesh$1(t,e):t instanceof PBMPointCloud&&updatePBMPointCloud$1(t,e)})}};function updatePBMMesh$1(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=three.NormalBlending,e.blendDst=three.OneMinusSrcAlphaFactor,e.blendEquation=three.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!1,e.depthTest=!0):(e.transparent=e.alphaMode===`BLEND`,e.blending=three.NormalBlending,e.blendDst=three.OneMinusSrcAlphaFactor,e.blendEquation=three.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=three.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=three.AdditiveBlending))}function updatePBMPointCloud$1(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=three.NormalBlending,e.blendDst=three.OneMinusSrcAlphaFactor,e.blendEquation=three.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=three.AdditiveBlending),e.useHQWeight&&(e.depthWrite=!1,e.blending=three.CustomBlending,e.blendSrc=three.SrcAlphaFactor,e.blendSrcAlpha=three.SrcAlphaFactor,e.blendDst=three.OneFactor,e.blendDstAlpha=three.OneFactor)}var pbmGaussianSplattingObject_exports=__exportAll({PBMGaussianSplattingObject:()=>PBMGaussianSplattingObject});function unpackHalf(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023;if(n===0){if(r===0)return t?-0:0;let e=r/1024*Math.pow(2,-14);return t?-e:e}else if(n===31)return r===0?t?-1/0:1/0:NaN;let o=Math.pow(2,n-15)*(1+r/1024);return t?-o:o}var PBMGaussianSplattingObject,init_pbmGaussianSplattingObject=__esmMin((()=>{PBMGaussianSplattingObject=class extends three.Points{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,n;let r=new three.BufferGeometry;if(super(r),this.transformChanged=!1,this.selectedChanged=!1,this.maxSHDegree=0,this.usedSHDegree=0,this.initAnimationEnabled=!1,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,this.packedData=(n=e==null?void 0:e.packedData)==null?new Uint32Array:n,e!=null&&e.sh1&&r.setAttribute(`sh1`,new three.BufferAttribute(e.sh1,9)),e!=null&&e.sh2&&r.setAttribute(`sh2`,new three.BufferAttribute(e.sh2,15)),e!=null&&e.sh3&&r.setAttribute(`sh3`,new three.BufferAttribute(e.sh3,21)),this._boundingBox=new three.Box3(new three.Vector3(1/0,1/0,1/0),new three.Vector3(-1/0,-1/0,-1/0)),this.packedData.length>=this.numPoints*8){let e=new Float32Array(this.packedData.buffer,this.packedData.byteOffset,this.packedData.length);for(let t=0;t<this.numPoints;t++){let n=e[t*8+0],r=e[t*8+1],o=e[t*8+2];n<this._boundingBox.min.x&&(this._boundingBox.min.x=n),r<this._boundingBox.min.y&&(this._boundingBox.min.y=r),o<this._boundingBox.min.z&&(this._boundingBox.min.z=o),n>this._boundingBox.max.x&&(this._boundingBox.max.x=n),r>this._boundingBox.max.y&&(this._boundingBox.max.y=r),o>this._boundingBox.max.z&&(this._boundingBox.max.z=o)}}this.matrixAutoUpdate=!1,this.lastMatrixWorld=null}get selected(){return this._selected}set selected(e){this._selected!==e&&(this._selected=e,this.selectedChanged=!0)}get boundingBox(){let e=new three.Vector3;this._boundingBox.getCenter(e),e.add(this.position);let t=new three.Vector3;this._boundingBox.getSize(t),t.multiply(this.scale);let n=new three.Vector3;return n.copy(t).multiplyScalar(.5),new three.Box3(e.clone().sub(n),e.clone().add(n))}dispose(){if(this.geometry.dispose(),Array.isArray(this.material))for(let e of this.material)e.dispose();else this.material.dispose()}decodeCov3D(e){if(this.packedData.length<(e+1)*8)return null;let t=this.packedData[e*8+4],n=this.packedData[e*8+5],r=this.packedData[e*8+6],o=new Float32Array(6);return o[0]=unpackHalf(t&65535),o[1]=unpackHalf(t>>>16&65535),o[2]=unpackHalf(n&65535),o[3]=unpackHalf(n>>>16&65535),o[4]=unpackHalf(r&65535),o[5]=unpackHalf(r>>>16&65535),o}}}));init_pbmGaussianSplattingObject();var ROTATE_X_MATRIX$2=new three.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),ROTATE_X_MATRIX_INVERSE$2=new three.Matrix4().getInverse(ROTATE_X_MATRIX$2);function noop(...e){}var JSONP_REGEXPS=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],locationHref=typeof location<`u`?location.href:``,locationIsHttps=/^https\:/.test(locationHref),NetworkProxyError=class extends Error{constructor(e,t,n){super(`[NETWORK]: request proxy error(type: ${t}, reason: ${n}): ${e}`)}},NetworkResponseError=class extends Error{constructor(e,t,n){super(`[NETWORK]: response error(type: ${t}, status: ${n}): ${e}`),this.httpStatus=n}},NetworkTimeoutError=class extends Error{constructor(e,t,n){super(`[NETWORK]: request timeout(type: ${t}, timeout: ${n}ms): ${e}`)}};function parseHeaders(e){if(!e)return{};let t={},n=e.trim().split(`
|
|
318
|
+
`));let c=String(this.clippers.length);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,c),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,c);for(let t of s)t.onBeforeCompile&&t.onBeforeCompile(e,r)};let r=``;this.onBeforeRender=(e,o,s,c,l,u)=>{let d=this.shaderType;s instanceof Camera?(n.pixelRatio.value=s.pixelRatio,n.resolution.value.copy(s.resolution)):(n.pixelRatio.value=e.getPixelRatio(),e.getViewport(scratchViewport$4),n.resolution.value.set(scratchViewport$4.width,scratchViewport$4.height));let f=this.transparent===!1&&this.blending===three.NormalBlending;t.USE_OPAQUE!==f&&(t.USE_OPAQUE=f,this.needsUpdate=!0);let p=this.customShaders.filter(e=>e.type.includes(d)).map(e=>`${e.id}:${e.version}`).join(`|`);r!==p&&(r=p,this.needsUpdate=!0)},Object.defineProperty(this,`uniform`,{configurable:!1,enumerable:!1,writable:!1,value:n}),defineProperty(this,`isPBMPointCloudMaterial`,{configurable:!1,writable:!1,value:!0}),defineProperty(this,`isShaderMaterial`,{configurable:!1,writable:!1,value:!0}),defineProperty(this,`opacity`,{get(){return n.opacity.value},set(e){n.opacity.value=e}}),defineProperty(this,`vertexMarks`,{get(){return!!t.USE_VERTEX_MARK},set(e){t.USE_VERTEX_MARK!==e&&(t.USE_VERTEX_MARK=e,this.needsUpdate=!0)}}),defineProperty(this,`pointScale`,{get(){return n.pointScale.value},set(e){n.pointScale.value=e}}),defineProperty(this,`pointMinPixel`,{get(){return n.pointMinPixel.value},set(e){n.pointMinPixel.value=e}}),defineProperty(this,`pointMaxPixel`,{get(){return n.pointMinPixel.value},set(e){n.pointMaxPixel.value=e}}),defineProperty(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)}}),defineProperty(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)}}),defineProperty(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)}}),defineProperty(this,`modelAlpha`,{get(){return n.modelAlpha.value},set(e){n.modelAlpha.value=e}}),defineProperty(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)}}),defineProperty(this,`constantColor`,{get(){return n.constantColor.value},set(e){n.constantColor.value=e}}),defineProperty(this,`floorIndex`,{get(){return n.floorIndex.value},set(e){n.floorIndex.value=e}}),defineProperty(this,`shownFloorIndex`,{get(){return n.shownFloorIndex.value},set(e){n.shownFloorIndex.value=e}}),defineProperty(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)}}),defineProperty(this,`gradientTexture`,{get(){return n.gradientTexture.value},set(e){n.gradientTexture.value=e}}),defineProperty(this,`brightness`,{get(){return n.brightness.value},set(e){n.brightness.value=e}});let o=[];defineProperty(this,`clippers`,{get(){return o},set(e){o!==e&&(o=e,n.clippers.value=o.map(e=>{let t=typeof e.floorIndex==`number`?e.floorIndex:-1;return{matrixInverse:new three.Matrix4().getInverse(e.clippingBoxMatrix),floorIndex:t}}),this.needsUpdate=!0)}}),defineProperty(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)}}),defineProperty(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)}}),defineProperty(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)}}),defineProperty(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)}}),defineProperty(this,`useHQWeight`,{get(){return t.USE_HQ_WEIGHT},set(e){e!==t.USE_HQ_WEIGHT&&(t.USE_HQ_WEIGHT=e,this.needsUpdate=!0)}}),defineProperty(this,`useHQDepth`,{get(){return t.USE_HQ_DEPTH},set(e){e!==t.USE_HQ_DEPTH&&(t.USE_HQ_DEPTH=e,this.needsUpdate=!0)}}),defineProperty(this,`depthOffset`,{get(){return n.depthOffset.value},set(e){n.depthOffset.value=e}}),defineProperty(this,`modelBoundingMin`,{get(){return n.modelBoundingMin.value},set(e){n.modelBoundingMin.value=e}}),defineProperty(this,`modelBoundingMax`,{get(){return n.modelBoundingMax.value},set(e){n.modelBoundingMax.value=e}}),typeof e==`object`&&this.setValues(e),toFastProperties(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.depthOffset=e.depthOffset,this.modelBoundingMin.copy(e.modelBoundingMin),this.modelBoundingMax.copy(e.modelBoundingMax),this}clone(){let e=this.constructor;return new e().copy(this)}refreshUniforms(){}},PBMPointCloud=class extends three.Points{constructor(e,t){super(e,t),this.onBeforeRender=(e,t,n,r,o,s)=>{o instanceof PBMPointCloudMaterial&&o.onBeforeRender&&o.onBeforeRender(e,t,n,r,this,s)}}},gradient_png_data_url_default=`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 getValueKeys(e){return Object.keys(e)}function valueEqual(e,t){return e==t}function arrayValueEqual(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 vector3Equal(e,t){return e instanceof three.Vector3&&t instanceof three.Vector3?e.equals(t):e===t}function box3Equal(e,t){return e instanceof three.Box3&&t instanceof three.Box3?e.equals(t):e===t}var parameterValueEqualFn={customShaders:arrayValueEqual,castShadow:valueEqual,receiveShadow:valueEqual,vertexMarks:valueEqual,pano0:valueEqual,pano1:valueEqual,pano0Depth:valueEqual,pano1Depth:valueEqual,panoFilter:valueEqual,refinedScreen:valueEqual,modelAlpha:valueEqual,progress:valueEqual,transition:valueEqual,opacity:valueEqual,floorStyle:valueEqual,colorStyle:valueEqual,constantColor:vector3Equal,shownFloorIndex:valueEqual,clippers:arrayValueEqual,brightness:valueEqual,useHQWeight:valueEqual,useHQDepth:valueEqual,pointShape:valueEqual,pointSize:valueEqual,pointBack:valueEqual,pointScale:valueEqual,pointMinPixel:valueEqual,pointMaxPixel:valueEqual,pointAppearAnimation:valueEqual,colorSaturation:valueEqual,colorBrightness:valueEqual,useAddBlend:valueEqual,onlyDepth:valueEqual,depthOffset:valueEqual,outlineGain:valueEqual,distanceGain:valueEqual,gradientTexture:valueEqual,boundingBox:box3Equal,gaussianSplattingSHDegree:valueEqual,enableGaussianSplattingInitAnimation:valueEqual,minLevelOfDetail:valueEqual,maxLevelOfDetail:valueEqual,minGeometricError:valueEqual,maxGeometricError:valueEqual,panoramaMinGeometricError:valueEqual,skipLevelOfDetail:valueEqual,mostDetail:valueEqual,loadSiblings:valueEqual,cameraCulling:valueEqual,maxMemoryUsage:valueEqual,maxRequests:valueEqual,requestOrder:valueEqual,maxScreenSpaceError:valueEqual,memoryAdjustedScreenSpaceError:valueEqual,cacheCameras:arrayValueEqual},defaultGradientTexture=(()=>{let e;return e=typeof document<`u`?new three.TextureLoader().load(gradient_png_data_url_default):new three.Texture,e.minFilter=three.NearestFilter,e.magFilter=three.NearestFilter,e.wrapS=three.RepeatWrapping,e.wrapT=three.RepeatWrapping,e})(),defineConstantColor=Object.freeze(new three.Vector3(.6,.6,.6)),defineClippers=Object.freeze([]),defineBoundingBox=Object.freeze(new three.Box3),defineCustomShaders=Object.freeze([]),defineCacheCameras=Object.freeze([]),undefinedValue={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,onlyDepth:void 0,depthOffset:void 0,boundingBox:void 0,gaussianSplattingSHDegree:void 0,enableGaussianSplattingInitAnimation: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},defaultValue={versionNumber:0,customShaders:defineCustomShaders,castShadow:!1,receiveShadow:!1,vertexMarks:!0,pano0:null,pano1:null,pano0Depth:null,pano1Depth:null,panoFilter:null,refinedScreen:null,floorStyle:`OPACITY`,colorStyle:`RGB`,constantColor:defineConstantColor,shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,transition:`FADE`,clippers:defineClippers,brightness:1,useHQWeight:!1,useHQDepth:!1,pointSize:`ATTENUATION`,pointBack:`HIDDEN`,pointShape:`CIRCLE`,pointScale:.02,pointMaxPixel:40,pointMinPixel:0,pointAppearAnimation:!0,gradientTexture:defaultGradientTexture,colorSaturation:0,colorBrightness:0,outlineGain:0,distanceGain:0,useAddBlend:!1,onlyDepth:!1,depthOffset:0,boundingBox:defineBoundingBox,gaussianSplattingSHDegree:0,enableGaussianSplattingInitAnimation:!1,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:defineCacheCameras},parameterVersionSequence=defaultValue.versionNumber,parameterKeys=getValueKeys(undefinedValue);function createUndefindValue(e={}){return Object.assign(e,undefinedValue)}function createDefaultValue(e={}){return Object.assign(e,defaultValue)}function assignValue(e,t,n){let r=parameterValueEqualFn[t];if(!r)return!1;Array.isArray(n)&&(n=n.slice());let o=e[t];return r(o,n)?!1:(e[t]=n,!0)}var Parameter=class e{static createDefault(){return createDefaultValue()}static resolveValueTo(t,...n){let r=createDefaultValue(t);for(let t of n){let n=t instanceof e?t.versionNumber:++parameterVersionSequence;r.versionNumber=r.versionNumber*31+n|0;for(let e of parameterKeys)t[e]!==void 0&&assignValue(r,e,t[e])}return r}static resolveValue(...t){if(typeof t[0]==`string`){let e=t.shift(),n=t,r=defaultValue[e];for(let t of n)t[e]!==void 0&&(r=t[e]);return r}else{let n=t;return e.resolveValueTo({},...n)}}constructor(e){this.id=createUuid$1(),this.versionNumber=++parameterVersionSequence,this.unbind=new Map,this.value=createUndefindValue(),e&&this.copy(e);for(let e of parameterKeys)Object.defineProperty(this,e,{get(){return this.value[e]}});toFastProperties(this)}resolveValue(...t){return e.resolveValue(...t,this)}assignValue(e,t){let n=this.unbind.get(e);n&&(this.unbind.delete(e),n());let r=assignValue(this.value,e,t),o=this.value[e];if(o instanceof PBMUpdateable){let t=o.on(`update`,()=>{this.versionNumber=++parameterVersionSequence});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 parameterKeys)t[e]!==void 0&&this.assignValue(e,t[e])&&(n=!0)}return n&&(this.versionNumber=++parameterVersionSequence),this}reset(...e){let t=!1;for(let n of e)this.assignValue(n,void 0)&&(t=!0);return t&&(this.versionNumber=++parameterVersionSequence),this}resetAll(){return this.reset(...parameterKeys)}copy(e){let t=!0;for(let n of parameterKeys)this.assignValue(n,e[n])&&(t=!0);return t&&(this.versionNumber=++parameterVersionSequence),this}},PBMContainer=class extends three.Group{constructor(){super(...arguments),this.parameter=new Parameter,this.needsRender=!0}get materialParameters(){return this.parameter.resolveValue()}get pbmMaterialParametersVersion(){return String(this.parameter.resolveValue().versionNumber)}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 PBMMesh||t instanceof PBMSkinnedMesh?updatePBMMesh$1(t,e):t instanceof PBMPointCloud&&updatePBMPointCloud$1(t,e)})}};function updatePBMMesh$1(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=three.NormalBlending,e.blendDst=three.OneMinusSrcAlphaFactor,e.blendEquation=three.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthWrite=!1,e.depthTest=!0):(e.transparent=e.alphaMode===`BLEND`,e.blending=three.NormalBlending,e.blendDst=three.OneMinusSrcAlphaFactor,e.blendEquation=three.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=three.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=three.AdditiveBlending))}function updatePBMPointCloud$1(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=three.NormalBlending,e.blendDst=three.OneMinusSrcAlphaFactor,e.blendEquation=three.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=three.AdditiveBlending),e.useHQWeight&&(e.depthWrite=!1,e.blending=three.CustomBlending,e.blendSrc=three.SrcAlphaFactor,e.blendSrcAlpha=three.SrcAlphaFactor,e.blendDst=three.OneFactor,e.blendDstAlpha=three.OneFactor)}var pbmGaussianSplattingObject_exports=__exportAll({PBMGaussianSplattingObject:()=>PBMGaussianSplattingObject});function unpackHalf(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023;if(n===0){if(r===0)return t?-0:0;let e=r/1024*Math.pow(2,-14);return t?-e:e}else if(n===31)return r===0?t?-1/0:1/0:NaN;let o=Math.pow(2,n-15)*(1+r/1024);return t?-o:o}var DEFAULT_PRE_BLUR_AMOUNT,DEFAULT_BLUR_AMOUNT,PBMGaussianSplattingObject,init_pbmGaussianSplattingObject=__esmMin((()=>{DEFAULT_PRE_BLUR_AMOUNT=.075,DEFAULT_BLUR_AMOUNT=.3,PBMGaussianSplattingObject=class extends three.Points{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}get preBlurAmount(){return this._preBlurAmount===null?this.antiAliased?0:DEFAULT_PRE_BLUR_AMOUNT:this._preBlurAmount}set preBlurAmount(e){let t=Math.max(0,e);this._preBlurAmount!==t&&(this._preBlurAmount=t,this.renderParamsChanged=!0)}get blurAmount(){return this._blurAmount===null?this.antiAliased?DEFAULT_BLUR_AMOUNT:0:this._blurAmount}set blurAmount(e){let t=Math.max(0,e);this._blurAmount!==t&&(this._blurAmount=t,this.renderParamsChanged=!0)}resetBlurAmounts(){this._preBlurAmount===null&&this._blurAmount===null||(this._preBlurAmount=null,this._blurAmount=null,this.renderParamsChanged=!0)}constructor(e){var t,n,r;let o=new three.BufferGeometry;if(super(o),this.transformChanged=!1,this.selectedChanged=!1,this.renderParamsChanged=!1,this.maxSHDegree=0,this.usedSHDegree=0,this.initAnimationEnabled=!1,this.gsViewLayerKey=``,this.gsClippers=[],this._preBlurAmount=null,this._blurAmount=null,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,this.packedData=(n=e==null?void 0:e.packedData)==null?new Uint32Array:n,this.antiAliased=(r=e==null?void 0:e.antiAliased)==null?!1:r,e!=null&&e.sh1&&o.setAttribute(`sh1`,new three.BufferAttribute(e.sh1,9)),e!=null&&e.sh2&&o.setAttribute(`sh2`,new three.BufferAttribute(e.sh2,15)),e!=null&&e.sh3&&o.setAttribute(`sh3`,new three.BufferAttribute(e.sh3,21)),this._boundingBox=new three.Box3(new three.Vector3(1/0,1/0,1/0),new three.Vector3(-1/0,-1/0,-1/0)),this.packedData.length>=this.numPoints*8){let e=new Float32Array(this.packedData.buffer,this.packedData.byteOffset,this.packedData.length);for(let t=0;t<this.numPoints;t++){let n=e[t*8+0],r=e[t*8+1],o=e[t*8+2];n<this._boundingBox.min.x&&(this._boundingBox.min.x=n),r<this._boundingBox.min.y&&(this._boundingBox.min.y=r),o<this._boundingBox.min.z&&(this._boundingBox.min.z=o),n>this._boundingBox.max.x&&(this._boundingBox.max.x=n),r>this._boundingBox.max.y&&(this._boundingBox.max.y=r),o>this._boundingBox.max.z&&(this._boundingBox.max.z=o)}}this.matrixAutoUpdate=!1,this.lastMatrixWorld=null}get selected(){return this._selected}set selected(e){this._selected!==e&&(this._selected=e,this.selectedChanged=!0)}get boundingBox(){let e=new three.Vector3;this._boundingBox.getCenter(e),e.add(this.position);let t=new three.Vector3;this._boundingBox.getSize(t),t.multiply(this.scale);let n=new three.Vector3;return n.copy(t).multiplyScalar(.5),new three.Box3(e.clone().sub(n),e.clone().add(n))}dispose(){if(this.geometry.dispose(),Array.isArray(this.material))for(let e of this.material)e.dispose();else this.material.dispose()}decodeCov3D(e){if(this.packedData.length<(e+1)*8)return null;let t=this.packedData[e*8+4],n=this.packedData[e*8+5],r=this.packedData[e*8+6],o=new Float32Array(6);return o[0]=unpackHalf(t&65535),o[1]=unpackHalf(t>>>16&65535),o[2]=unpackHalf(n&65535),o[3]=unpackHalf(n>>>16&65535),o[4]=unpackHalf(r&65535),o[5]=unpackHalf(r>>>16&65535),o}}}));init_pbmGaussianSplattingObject();var ROTATE_X_MATRIX$2=new three.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),ROTATE_X_MATRIX_INVERSE$2=new three.Matrix4().getInverse(ROTATE_X_MATRIX$2);function noop(...e){}var JSONP_REGEXPS=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],locationHref=typeof location<`u`?location.href:``,locationIsHttps=/^https\:/.test(locationHref),NetworkProxyError=class extends Error{constructor(e,t,n){super(`[NETWORK]: request proxy error(type: ${t}, reason: ${n}): ${e}`)}},NetworkResponseError=class extends Error{constructor(e,t,n){super(`[NETWORK]: response error(type: ${t}, status: ${n}): ${e}`),this.httpStatus=n}},NetworkTimeoutError=class extends Error{constructor(e,t,n){super(`[NETWORK]: request timeout(type: ${t}, timeout: ${n}ms): ${e}`)}};function parseHeaders(e){if(!e)return{};let t={},n=e.trim().split(`
|
|
319
319
|
`);for(let e=0;e<n.length;e++){let r=n[e],o=r.indexOf(`:`),s=r.slice(0,o).trim().toLowerCase(),c=r.slice(o+1).trim();c&&(t[s]?t[s]+=`, `+c:t[s]=c)}return t}function matchJsonpFunctionName(e){for(let t of JSONP_REGEXPS){let n=e.match(t);if(n)return`jsonp_`+n[1]}return null}function isJsonp(e){return matchJsonpFunctionName(e)!==null}var NetworkSubscribe=class extends Subscribe{};function ajax(e,t={},n=noop,r=noop,o=noop){let s=now(),c=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>locationIsHttps&&/^http\:/.test(e)?(console.warn(`The page at '${locationHref}' 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;matchJsonpFunctionName(e);let o=new NetworkProxyError(c,`XMLHttpRequest`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`XMLHttpRequest`,`forbidden`,o.message),Promise.reject(o)}).then(e=>new Promise((l,u)=>{let d=matchJsonpFunctionName(e);if(d){let o=window,f=null,p=!1,m=document.createElement(`script`);o[d]=h=>{var g,_;let v=now(),y=v-s;if(delete o[d],m.parentNode&&m.parentNode.removeChild(m),f!==null&&(window.clearTimeout(f),f=null),p===!0)return;if(h.indexOf(`data:`)!==0){let n=new NetworkResponseError(e,`XMLHttpRequest`,500);r(n),u(n),(g=t.networkSubscribe)==null||g.emit(`network`,e,`XMLHttpRequest`,`error`,n.message);return}let b=h.split(`,`),S=(b[0].match(/:(.*?);/)||[])[1],C=b[1];if(t.responseType===`arraybuffer`||t.responseType===`blob`){let e=atob(b[1]),n=e.length,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=e.charCodeAt(t);C=t.responseType===`arraybuffer`?r.buffer:new Blob([r],{type:S})}let w={body:C,meta:{origin:c,source:e,requestTime:s,responseTime:v,costs:y,headers:{}}};n(w),l(w),(_=t.networkSubscribe)==null||_.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(w.meta)),p=!0},m.src=e,document.body.appendChild(m),typeof t.timeout==`number`&&(f=window.setTimeout(()=>{var n;if(f=null,p!==!0){p=!0;let o=new NetworkTimeoutError(e,`XMLHttpRequest`,t.timeout||NaN);r(o),u(o),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,o.message)}},t.timeout))}else{let d=!1,f=new XMLHttpRequest,p=()=>{f&&(f.removeEventListener(`timeout`,m,!1),f.removeEventListener(`progress`,h,!1),f.removeEventListener(`load`,g,!1),f.removeEventListener(`error`,_,!1)),f=null,p=noop},m=function(){var n;if(d===!0)return;d=!0,p();let o=new NetworkTimeoutError(e,`XMLHttpRequest`,t.timeout||NaN);r(o),u(o),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,o.message)},h=function(e){d!==!0&&e.lengthComputable&&(e.total<=0||o(e.loaded/e.total,e.loaded,e.total))},g=function(r){var o;if(d===!0)return;let u=this.status;if(u===0||u>=200&&u<400){d=!0,p();let u=now(),f=u-s,m=parseHeaders(this.getAllResponseHeaders()),h=r.total,g={body:this.response,meta:{origin:c,source:e,requestTime:s,responseTime:u,costs:f,headers:m,size:h}};n(g),l(g),(o=t.networkSubscribe)==null||o.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(g.meta))}else _.call(this)},_=function(){var n;if(d===!0)return;d=!0,p();let o=new NetworkResponseError(e,`XMLHttpRequest`,this.status);r(o),u(o),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`error`,o.message)};f.addEventListener(`timeout`,m,!1),f.addEventListener(`progress`,h,!1),f.addEventListener(`load`,g,!1),f.addEventListener(`error`,_,!1),t.responseType&&(f.responseType=t.responseType),typeof t.timeout==`number`&&(f.timeout=t.timeout),f.open(`GET`,e,!0),f.send(null)}}))}var preloadCache={};function preload(e,t={}){let n=now(),r=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>locationIsHttps&&/^http\:/.test(e)?(console.warn(`The page at '${locationHref}' 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 o;let s=new NetworkProxyError(r,`Link`,n&&n.message?String(n.message):String(n));return(o=t.networkSubscribe)==null||o.emit(`network`,e,`Link`,`forbidden`,s.message),Promise.reject(s)}).then(e=>e in preloadCache?preloadCache[e]:preloadCache[e]=new Promise((o,s)=>{let c=document.head||document.getElementsByTagName(`head`)[0],l=document.createElement(`link`),u=!1,d=null;l.onload=s=>{var c;if(d!==null&&(clearTimeout(d),d=null),u===!0)return;u=!0,o(),l.onerror=noop,l.onload=noop;let f=now(),p={origin:r,source:e,requestTime:n,responseTime:f,costs:f-n,headers:{}};(c=t.networkSubscribe)==null||c.emit(`network`,e,`Link`,`preload`,JSON.stringify(p))},l.onerror=n=>{var r;if(d!==null&&(clearTimeout(d),d=null),u===!0)return;u=!0,delete preloadCache[e],c&&l.parentNode===c&&c.removeChild(l);let o=new NetworkResponseError(e,`Link`,0);s(o),l.onerror=noop,l.onload=noop,(r=t.networkSubscribe)==null||r.emit(`network`,e,`Link`,`error`,o.message)},typeof t.timeout==`number`&&(d=window.setTimeout(()=>{var s;if(d=null,u===!0)return;u=!0,o(),l.onerror=noop,l.onload=noop;let c=now(),f={origin:r,source:e,requestTime:n,responseTime:c,costs:c-n,headers:{}};(s=t.networkSubscribe)==null||s.emit(`network`,e,`Link`,`timeout`,JSON.stringify(f))},t.timeout)),l.rel=l.relList&&l.relList.supports(`prefetch`)?`prefetch`:`preload`,l.as=`fetch`,l.crossOrigin=``,l.fetchPriority=`high`,l.href=e,c&&c.appendChild(l)}))}function loadImage(e,t={},n=noop,r=noop,o=noop,s){let c=now(),l=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>locationIsHttps&&/^http\:/.test(e)?(console.warn(`The page at '${locationHref}' 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 o=new NetworkProxyError(l,`Image`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`forbidden`,o.message),Promise.reject(o)}).then(e=>isJsonp(e)?ajax(e,{responseType:`blob`,networkSubscribe:t.networkSubscribe}).then(e=>URL.createObjectURL(e.body)):e).then(e=>new Promise((u,d)=>{let f=s==null?new Image:s,p=!1,m=null;typeof t.timeout==`number`&&(m=window.setTimeout(()=>{var n;if(f.onload=noop,f.onerror=noop,m=null,p===!0)return;p=!0;let o=new NetworkTimeoutError(e,`Image`,t.timeout);r(o),d(o),(n=t.networkSubscribe)==null||n.emit(`network`,e,`Image`,`timeout`,o.message)},t.timeout)),f.onload=()=>{var r;if(f.onload=noop,f.onerror=noop,m!==null&&(clearTimeout(m),m=null),p===!0)return;let s=now(),d={headers:{},origin:l,source:e,requestTime:c,responseTime:s,costs:s-c};p=!0;let h={body:f,meta:d};o(1),n(h),u(h),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`ok`,JSON.stringify(h.meta))},f.onerror=()=>{var n;if(f.onload=noop,f.onerror=noop,m!==null&&(clearTimeout(m),m=null),p===!0)return;p=!0;let o=new NetworkResponseError(e,`Image`,0);r(o),d(o),(n=t.networkSubscribe)==null||n.emit(`network`,e,`Image`,`ok`,o.message)},o(0),f.src=e}))}var Fetcher=class{constructor(e={}){this.options=e}ajax(e,t={},n=noop,r=noop,o=noop){var s;let c=this.options;return ajax(e,{responseType:t.responseType,timeout:(s=t.timeout)==null?c.timeout:s,get requestProxy(){var e;return(e=t.requestProxy)==null?c.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?c.networkSubscribe:e}},n,r,o)}loadImage(e,t={},n=noop,r=noop,o=noop,s){var c;let l=this.options;return loadImage(e,{timeout:(c=t.timeout)==null?l.timeout:c,get requestProxy(){var e;return(e=t.requestProxy)==null?l.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?l.networkSubscribe:e}},n,r,o,s)}preload(e,t={}){var n;let r=this.options;return preload(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}})}},internalFetcher=new Fetcher;function pick(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function omit(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 omitUndefinedFields(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}return t}var hrefAElement=typeof document<`u`?document.createElement(`a`):{href:``};function isAbsoluteURL(e){return e.indexOf(`/`)===0||/^[0-9a-z]+\:/i.test(e)}function getFullURL(e){if(typeof URL<`u`&&typeof location<`u`)return new URL(e,location.href).href;{hrefAElement.href=e;let t=hrefAElement.href;return hrefAElement.href=``,t}}function pathJoin(...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,o=n===e.length-1,s=e[n];r||(s=s.replace(/^\.\//,``).replace(/^\/+/,``)),o||(s=s.replace(/\/+$/,``)),t.push(s)}return t.join(`/`)}function appendSearch(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 normalizeURL(e){var t;let n=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(e);if(!n)return e;let r=n[1]||``,o=e.slice(r.length+2),s=o.indexOf(`#`);s>=0&&(e.slice(s),o=e.slice(0,s));let c=o.indexOf(`?`);c>=0&&(e.slice(c),o=e.slice(0,c));let l=o.split(`/`),u=l.shift(),d=(t=l.pop())==null?``:t,f=[];for(let e of l)if(!(e===``||e===`.`)){if(e===`..`){f.pop();continue}f.push(e)}return r+`//`+u+`/`+f.join(`/`)+`/`+d}function getExtname(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 webp=`data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAIAAUAmJaQAA3AA/vz0AAA=`,avif=`data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAGhbWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAsaWxvYwAAAABEAAACAAEAAAABAAAB3gAAABkAAgAAAAEAAAHJAAAAFQAAAEJpaW5mAAAAAAACAAAAGmluZmUCAAAAAAEAAGF2MDFDb2xvcgAAAAAaaW5mZQIAAAAAAgAAYXYwMUFscGhhAAAAABppcmVmAAAAAAAAAA5hdXhsAAIAAQABAAAA12lwcnAAAACxaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIAAoAAAAAUaXNwZQAAAAAAAAACAAAAAgAAAA5waXhpAAAAAAEIAAAADGF2MUOBABwAAAAAOGF1eEMAAAAAdXJuOm1wZWc6bXBlZ0I6Y2ljcDpzeXN0ZW1zOmF1eGlsaWFyeTphbHBoYQAAAAAeaXBtYQAAAAAAAAACAAEEAQKDBAACBAUGhwgAAAA2bWRhdBIACgQYADLVMgsWQBhhIAQqrNj/+BIACgUYADLEoDIOFkADDDDCQAACDaqCCb4=`,heif=`data:image/heif;base64,AAAAGGZ0eXBoZWljAAAAAG1pZjFoZWljAAABL21ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAHBpY3QAAAAAAAAAAAAAAAAAAAAADnBpdG0AAAAAAAEAAAAjaWluZgAAAAAAAQAAABVpbmZlAgAAAAABAABodmMxAAAAAK9pcHJwAAAAkmlwY28AAAB2aHZjQwEBYAAAAAAAAAAAAADwAPz9+PgAACcDoAABAB5AAQwG//8BYAAAAwAAAwAAAwAAAwAAAwAAreTLgSChAAEAI0IBBwFgAAADAAADAAADAAADAAADAAChInJJlreTLySZNdggogABAAdEAcA98DMkAAAAFGlzcGUAAAAAAAAAAgAAAAIAAAAVaXBtYQAAAAAAAAABAAECgQIAAAAiaWxvYwAAAABEQAABAAEAAAAAAU8AAQAAAAAAAAAOAAAAFm1kYXQAAAAKJgGvLvkQwuWM4A==`;function checkImage(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 imageSupportCache=null;function imageSupport(){return imageSupportCache||(imageSupportCache=Promise.all([checkImage(webp),checkImage(avif),checkImage(heif)]).then(e=>({webp:e[0],avif:e[1],heif:e[2]})))}var _a$4,supportAvif=!1,supportWebp=!1,supportHeif=!1;imageSupport().then(e=>{supportAvif=e.avif,supportWebp=e.webp,supportHeif=e.heif});var IMAGE_FORMATS=[`jpg`,`jpeg`,`png`,`heif`,`heic`,`webp`,`avif`];function isImageExt(e){return IMAGE_FORMATS.indexOf(e)>=0}var DEFAULT_IMAGE_URL_MAPPINGS={"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`]}},URL_DOMAIN_REGEX=/^https?\:\/\/?([^\/]+)/;function getDomain(e){let t=e.match(URL_DOMAIN_REGEX);return t===null?null:t[1]}function replaceDomain(e,t,n){var r,o;let s=(o=(r=t[n])==null?t[t.length-1]:r)==null?e:o;return e.replace(URL_DOMAIN_REGEX,(e,t)=>e.slice(0,e.length-t.length)+s)}function route(e,t,n){let[r,...o]=t.split(`.`);if(r===`texture`)return replaceDomain(e,n.texture,0);if(r===`pano`){let[t,r]=o;switch(r){case`front`:case`left`:case`up`:return replaceDomain(e,n.pano,0);case`down`:case`right`:case`back`:return replaceDomain(e,n.pano,1);default:break}}else if(r===`pano_tile`){let[t,r,s,c,l]=o,u=Math.pow(2,Number(s))*Number(c)+Number(l);if(!isNaN(u))return replaceDomain(e,n.tile,u%2)}else if(r===`model`){let[t]=o,r=Number(t);if(!isNaN(r))return replaceDomain(e,n.model,r%2)}return replaceDomain(e,n.default,0)}var tencentCloudImageProcesser=(e,t)=>{let n=e.split(`?`)[0],r=n.split(`.`).pop();if(r===`jpeg`&&(r=`jpg`),r===`heif`&&(r=`heic`),r&&!isImageExt(r))return e;let o=[],{format:s,cut:c,quality:l,size:u,sharpen:d,forceUseExifOrientation:f}=t;if(s===`jpeg`&&(s=`jpg`),s===`heif`&&(s=`heic`),(!supportAvif&&(s==null?r:s)===`avif`||!supportWebp&&(s==null?r:s)===`webp`||!supportHeif&&(s==null?r:s)===`heic`)&&(s=`jpg`),s!==void 0&&s!==r&&o.push(`format/${s}`),c!==void 0&&o.push(`cut/${c[2]}x${c[3]}x${c[0]}x${c[1]}`),l!==void 0){let e=s==null?r:s;e&&[`jpg`,`webp`,`heic`,`avif`].indexOf(e)>=0&&o.push(`quality/${l}`)}if(u!==void 0){let t=e.match(/\/cube_(\d+)\//);(t?Number(t[1]):NaN)!==Number(u)&&o.push(`thumbnail/${u}x`)}d!==void 0&&o.push(`sharpen/${d}`),f===!0&&o.push(`auto-orient`);let p=``;return o.length&&(p=`?imageMogr2/`+o.join(`/`)),n+p},aliyunOOSImageProcesser=(e,t)=>{let n=e.split(`?`)[0],r=n.split(`.`).pop();if(r===`jpeg`&&(r=`jpg`),r===`heif`&&(r=`heic`),r&&!isImageExt(r))return e;let o=[],{format:s,cut:c,quality:l,size:u,sharpen:d}=t;if(s===`jpeg`&&(s=`jpg`),s===`heif`&&(s=`heic`),(!supportAvif&&(s==null?r:s)===`avif`||!supportWebp&&(s==null?r:s)===`webp`||!supportHeif&&(s==null?r:s)===`heic`)&&(s=`jpg`),s!==void 0&&s!==r&&o.push(`format,${s}`),c!==void 0){let[e,t,n,r]=c;o.push(`crop,x_${e},y_${t},w_${n},h_${r},g_nw`)}if(l!==void 0&&l!==100){let e=s==null?r:s;e&&[`jpg`,`webp`,`heic`,`avif`].indexOf(e)>=0&&o.push(`quality,Q_${l}`)}u&&u!==2048&&o.push(`resize,w_${u}`),d!==void 0&&o.push(`sharpen,${d}`);let f=``;return o.length&&(f=`?x-oss-process=image/`+o.join(`/`)),n+f},MAX_SAFE_INTEGER=9007199254740991;function formatNumber(e){let t=Math.round(e);return Math.abs(t-e)<.001?t:Math.floor(e)}function formatOptions(e){return e=Object.assign({},e),e.size!==void 0&&(e.size=formatNumber(clamp$1(e.size,0,MAX_SAFE_INTEGER))),e.quality!==void 0&&(e.quality=formatNumber(clamp$1(e.quality,0,100))),e.cut!==void 0&&(e.cut=[formatNumber(clamp$1(e.cut[0],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(e.cut[1],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(e.cut[2],0,MAX_SAFE_INTEGER)),formatNumber(clamp$1(e.cut[3],0,MAX_SAFE_INTEGER))]),e.sharpen!==void 0&&(e.sharpen=formatNumber(clamp$1(e.sharpen,0,MAX_SAFE_INTEGER))),e}function imageURL(e,t){let n=Object.assign(Object.assign({},DEFAULT_IMAGE_URL_MAPPINGS),t.mappings),r=getDomain(e);if(r===null)return e;t=formatOptions(t);let o=n[r];return o?(e=route(e,t.key,o),/\.basis(\?|$)/.test(e)&&(e=e.replace(/\.basis(\?|$)/,`.jpg$1`)),o.type===`tencentCloud`?tencentCloudImageProcesser(e,t):o.type===`aliyun`?aliyunOOSImageProcesser(e,t):e):e}function applyImageURLOptions(e,t=imageURL,n){let r=t(e,n);if(r===e&&n.cut)throw Error(`ImageURL: cut option not applied.`);return r}var IMAGE_SIZE_REG=/\/cube_(\d+)\//;function getImageSizeFromURL(e){let t=e.match(IMAGE_SIZE_REG);return t?Number(t[1]):null}function replaceImageSize(e,t){return e.replace(IMAGE_SIZE_REG,`/cube_${t}/`)}var log2=(_a$4=Math.log2)==null?(e=>Math.log(e)*Math.LOG2E):_a$4;function getImageSizeLevel(e){return Math.floor(Math.max(log2(e/512),0))}var windowSTOContext=(()=>{let e=now();return{requestAnimationFrame(t){let n=now(),r=clamp$1(16+(n-e),16,33),o=setTimeout(function(){t(dateNowToDomHighResTimeStamp(n+r))},r);return e=n+r,o},cancelAnimationFrame:e=>clearTimeout(e)}})(),windowRAFContext=typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`?{requestAnimationFrame:e=>requestAnimationFrame(e),cancelAnimationFrame:e=>cancelAnimationFrame(e)}:windowSTOContext,DEFAULT_ORDER=5,deviceFrameTime=16,AnimationFrameLoop=class e{static get shared(){return this.sharedInstance||(this.sharedInstance=new e),this.sharedInstance}static getFrameTime(){return deviceFrameTime}constructor(){this.loopType=`raf`,this.frames=[],this.isAnimating=!1,this.context=null;let e=now();this.loop=(...t)=>{if(this.isAnimating===!1)return;let n=now(),r=Math.max(n-e,0);e=n,deviceFrameTime=r;let o=this.frames.slice();for(let e=0;e<o.length;e++){let s=o[e];if(s.delay>0){--s.delay;continue}try{s.callback(n,r,...t)}catch(e){console.error(e)}s.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=windowRAFContext:this.loopType===`sto`&&(t=windowSTOContext),t)return t.requestAnimationFrame(e)}cancelAnimationFrame(e){let t;this.context?t=this.context:this.loopType===`raf`?t=windowRAFContext:this.loopType===`sto`&&(t=windowSTOContext),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=DEFAULT_ORDER){let o={callback:e,once:t,delay:n,order:r,calls:0},s=this.frames.length;for(;--s>=0;)if(this.frames[s].order<=r){this.frames.splice(s+1,0,o);break}return s<0&&this.frames.unshift(o),()=>this.remove(o)}clear(){this.frames.length=0}},browserSupportsImageBitmapApi=typeof createImageBitmap<`u`&&typeof ImageBitmap<`u`,_useNativeImageBitmap=!1;function useNativeImageBitmap(e){_useNativeImageBitmap=e}function canUseNativeImageBitmap(){return _useNativeImageBitmap===!1?!1:browserSupportsImageBitmapApi}function createImageBitmapLikeImage(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=noop,this.removeAttribute(`src`),t=void 0}})}function createImageBitmapLike(e){if(canUseNativeImageBitmap())return createImageBitmap(e);{let t=URL.createObjectURL(e),n=function(){this.src===t&&URL.revokeObjectURL(t)};return new Promise((e,r)=>{let o=createImageBitmapLikeImage({onClose:n});o.onload=()=>{o.src===t&&URL.revokeObjectURL(t),o.onload=o.onerror=noop,AnimationFrameLoop.shared.add(()=>{e(o)},!0)},o.onerror=()=>{let e=o.src;o.onload=o.onerror=noop,o.close(),r(Error(`image load error: ${e}`))},o.decoding=`async`,o.src=t})}}var canvasPool=[];function createCanvas(e,t){let n=canvasPool.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=noop,canvasPool.push(r)}});return r}function imageBitmapToTexture(e,t){if(t&&(e.width>t.width||e.height>t.height)){let n=createCanvas(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 o=new three.Texture(n);o.needsUpdate=!0,o.flipY=!0;let s=o.dispose;return o.dispose=function(){n.close(),s.call(o),o.dispose=s},o}else{let t=new three.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 imageBitmapsToCubeTexture(e){let t=new three.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 FACE_ORDER$2=[`right`,`left`,`up`,`down`,`front`,`back`],TextureLoader=class{loadTexture(e,t,n=noop,r=noop,o=noop,s){var c,l,u,d,f,p,m;let h={};if(t.flipY!==void 0&&(h.flipY=t.flipY),t.format!==void 0)h.format=t.format;else{let t=getExtname(e);(t===`.jpg`||t===`.jpeg`)&&(h.format=three.RGBFormat)}t.encoding!==void 0&&(h.encoding=t.encoding),h.generateMipmaps=(c=t.generateMipmaps)==null?!1:c,h.minFilter=(l=t.minFilter)==null?three.LinearFilter:l,h.magFilter=(u=t.magFilter)==null?three.LinearFilter:u,t.wrapS&&(h.wrapS=t.wrapS),t.wrapT&&(h.wrapT=t.wrapT);let g=(f=(d=t.imageURL)==null?void 0:d.options)==null?{key:`unknown`}:f;if(e=applyImageURLOptions(e,(p=t.imageURL)==null?void 0:p.transform,g),(m=t.viaAjax)==null?canUseNativeImageBitmap:m){let s=null;return t.fetcher.ajax(e,{timeout:t.timeout,responseType:`blob`},void 0,void 0,o).then(e=>createImageBitmapLike(e.body)).then(e=>imageBitmapToTexture(e,t.maxSize)).then(e=>(Object.assign(e,h),e)).then(e=>{let t={meta:null,body:e};return n(t),t}).catch(e=>(r(e),Promise.reject(e)))}else{let s=null,c;return Promise.resolve().then(()=>createImageBitmapLikeImage()).then(n=>(c=n,t.fetcher.loadImage(e,{timeout:t.timeout},void 0,void 0,o,n))).then(e=>(s=e.meta,imageBitmapToTexture(e.body,t.maxSize))).then(e=>(Object.assign(e,h),e)).then(e=>{let t={meta:s,body:e};return n(t),t}).catch(e=>(c&&c.close(),r(e),Promise.reject(e)))}}loadCubeTexture(e,t,n=noop,r=noop,o=noop,s){var c,l,u,d,f,p,m;let h={};if(t.format!==void 0)h.format=t.format;else{let t=!0;for(let n of FACE_ORDER$2){let r=getExtname(e[n]);if(r!==`.jpg`&&r!==`.jpeg`){t=!1;break}}t&&(h.format=three.RGBFormat)}h.generateMipmaps=(c=t.generateMipmaps)==null?!1:c,h.minFilter=(l=t.minFilter)==null?three.LinearFilter:l,h.magFilter=(u=t.magFilter)==null?three.LinearFilter:u,t.wrapS&&(h.wrapS=t.wrapS),t.wrapT&&(h.wrapT=t.wrapT);let g=[e[FACE_ORDER$2[0]],e[FACE_ORDER$2[1]],e[FACE_ORDER$2[2]],e[FACE_ORDER$2[3]],e[FACE_ORDER$2[4]],e[FACE_ORDER$2[5]]],_=[],v=[0,0,0,0,0,0],y=[];for(let e=0;e<6;e++){let n=(f=(d=t.imageURL)==null?void 0:d.options)==null?{key:`unknown`}:f,r=applyImageURLOptions(g[e],(p=t.imageURL)==null?void 0:p.transform,Object.assign(Object.assign({},n),{key:n.key+`.`+FACE_ORDER$2[e]})),s=t=>{v[e]=t,o(v.reduce((e,t)=>e+t,0)/6)};if((m=t.viaAjax)!=null&&m){let n=t.fetcher.ajax(r,{timeout:t.timeout,responseType:`blob`},void 0,void 0,s).then(t=>(y[e]=t.meta,createImageBitmapLike(t.body)));_.push(n)}else{let n,o=Promise.resolve().then(()=>createImageBitmapLikeImage()).then(e=>(n=e,t.fetcher.loadImage(r,{timeout:t.timeout},void 0,void 0,s,e))).then(t=>(y[e]=t.meta,t.body)).catch(e=>(n&&n.close(),Promise.reject(e)));_.push(o)}}return Promise.all(_).then(e=>imageBitmapsToCubeTexture(e)).then(e=>(Object.assign(e,Object.assign({encoding:three.sRGBEncoding},h)),e)).then(e=>{let t={body:e,meta:y};return n(t),t}).catch(e=>{for(let e of _)e.then(e=>e.close()).catch(noop);return r(e),Promise.reject(e)})}},require_aspromise=__commonJSMin(((e,t)=>{t.exports=n;function n(e,t){for(var n=Array(arguments.length-1),r=0,o=2,s=!0;o<arguments.length;)n[r++]=arguments[o++];return new Promise(function(o,c){n[r]=function(e){if(s)if(s=!1,e)c(e);else{for(var t=Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];o.apply(null,t)}};try{e.apply(t||null,n)}catch(e){s&&(s=!1,c(e))}})}})),require_base64=__commonJSMin((e=>{var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&e.charAt(t)===`=`;)++n;return Math.ceil(e.length*3)/4-n};for(var n=Array(64),r=Array(123),o=0;o<64;)r[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(e,t,r){for(var o=null,s=[],c=0,l=0,u;t<r;){var d=e[t++];switch(l){case 0:s[c++]=n[d>>2],u=(d&3)<<4,l=1;break;case 1:s[c++]=n[u|d>>4],u=(d&15)<<2,l=2;break;case 2:s[c++]=n[u|d>>6],s[c++]=n[d&63],l=0;break}c>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),c=0)}return l&&(s[c++]=n[u],s[c++]=61,l===1&&(s[c++]=61)),o?(c&&o.push(String.fromCharCode.apply(String,s.slice(0,c))),o.join(``)):String.fromCharCode.apply(String,s.slice(0,c))};var s=`invalid encoding`;t.decode=function(e,t,n){for(var o=n,c=0,l,u=0;u<e.length;){var d=e.charCodeAt(u++);if(d===61&&c>1)break;if((d=r[d])===void 0)throw Error(s);switch(c){case 0:l=d,c=1;break;case 1:t[n++]=l<<2|(d&48)>>4,l=d,c=2;break;case 2:t[n++]=(l&15)<<4|(d&60)>>2,l=d,c=3;break;case 3:t[n++]=(l&3)<<6|d,c=0;break}}if(c===1)throw Error(s);return n-o},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}})),require_eventemitter=__commonJSMin(((e,t)=>{t.exports=n;function n(){this._listeners={}}n.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},n.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},n.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this}})),require_float=__commonJSMin(((e,t)=>{t.exports=n(n);function n(e){return typeof Float32Array<`u`?(function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=n[3]===128;function o(e,r,o){t[0]=e,r[o]=n[0],r[o+1]=n[1],r[o+2]=n[2],r[o+3]=n[3]}function s(e,r,o){t[0]=e,r[o]=n[3],r[o+1]=n[2],r[o+2]=n[1],r[o+3]=n[0]}e.writeFloatLE=r?o:s,e.writeFloatBE=r?s:o;function c(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function l(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.readFloatLE=r?c:l,e.readFloatBE=r?l:c})():(function(){function t(e,t,n,r){var o=+(t<0);if(o&&(t=-t),t===0)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);else{var s=Math.floor(Math.log(t)/Math.LN2),c=Math.round(t*Math.pow(2,-s)*8388608)&8388607;e((o<<31|s+127<<23|c)>>>0,n,r)}}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,o);function n(e,t,n){var r=e(t,n),o=(r>>31)*2+1,s=r>>>23&255,c=r&8388607;return s===255?c?NaN:o*(1/0):s===0?o*1401298464324817e-60*c:o*Math.pow(2,s-150)*(c+8388608)}e.readFloatLE=n.bind(null,s),e.readFloatBE=n.bind(null,c)})(),typeof Float64Array<`u`?(function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=n[7]===128;function o(e,r,o){t[0]=e,r[o]=n[0],r[o+1]=n[1],r[o+2]=n[2],r[o+3]=n[3],r[o+4]=n[4],r[o+5]=n[5],r[o+6]=n[6],r[o+7]=n[7]}function s(e,r,o){t[0]=e,r[o]=n[7],r[o+1]=n[6],r[o+2]=n[5],r[o+3]=n[4],r[o+4]=n[3],r[o+5]=n[2],r[o+6]=n[1],r[o+7]=n[0]}e.writeDoubleLE=r?o:s,e.writeDoubleBE=r?s:o;function c(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function l(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.readDoubleLE=r?c:l,e.readDoubleBE=r?l:c})():(function(){function t(e,t,n,r,o,s){var c=+(r<0);if(c&&(r=-r),r===0)e(0,o,s+t),e(1/r>0?0:2147483648,o,s+n);else if(isNaN(r))e(0,o,s+t),e(2146959360,o,s+n);else if(r>17976931348623157e292)e(0,o,s+t),e((c<<31|2146435072)>>>0,o,s+n);else{var l;if(r<22250738585072014e-324)l=r/5e-324,e(l>>>0,o,s+t),e((c<<31|l/4294967296)>>>0,o,s+n);else{var u=Math.floor(Math.log(r)/Math.LN2);u===1024&&(u=1023),l=r*Math.pow(2,-u),e(l*4503599627370496>>>0,o,s+t),e((c<<31|u+1023<<20|l*1048576&1048575)>>>0,o,s+n)}}}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,o,4,0);function n(e,t,n,r,o){var s=e(r,o+t),c=e(r,o+n),l=(c>>31)*2+1,u=c>>>20&2047,d=4294967296*(c&1048575)+s;return u===2047?d?NaN:l*(1/0):u===0?l*5e-324*d:l*Math.pow(2,u-1075)*(d+4503599627370496)}e.readDoubleLE=n.bind(null,s,0,4),e.readDoubleBE=n.bind(null,c,4,0)})(),e}function r(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function o(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=e&255}function s(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function c(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}})),require_inquire=__commonJSMin(((exports,module)=>{module.exports=inquire;function inquire(moduleName){try{var mod=eval(`quire`.replace(/^/,`re`))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}})),require_utf8=__commonJSMin((e=>{var t=e;t.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)n=e.charCodeAt(r),n<128?t+=1:n<2048?t+=2:(n&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320?(++r,t+=4):t+=3;return t},t.read=function(e,t,n){if(n-t<1)return``;for(var r=null,o=[],s=0,c;t<n;)c=e[t++],c<128?o[s++]=c:c>191&&c<224?o[s++]=(c&31)<<6|e[t++]&63:c>239&&c<365?(c=((c&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[s++]=55296+(c>>10),o[s++]=56320+(c&1023)):o[s++]=(c&15)<<12|(e[t++]&63)<<6|e[t++]&63,s>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,o)),s=0);return r?(s&&r.push(String.fromCharCode.apply(String,o.slice(0,s))),r.join(``)):String.fromCharCode.apply(String,o.slice(0,s))},t.write=function(e,t,n){for(var r=n,o,s,c=0;c<e.length;++c)o=e.charCodeAt(c),o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=o&63|128):(o&64512)==55296&&((s=e.charCodeAt(c+1))&64512)==56320?(o=65536+((o&1023)<<10)+(s&1023),++c,t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=o&63|128):(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=o&63|128);return n-r}})),require_pool=__commonJSMin(((e,t)=>{t.exports=n;function n(e,t,n){var r=n||8192,o=r>>>1,s=null,c=r;return function(n){if(n<1||n>o)return e(n);c+n>r&&(s=e(r),c=0);var l=t.call(s,c,c+=n);return c&7&&(c=(c|7)+1),l}}})),require_longbits=__commonJSMin(((e,t)=>{t.exports=r;var n=require_minimal$1();function r(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=r.zero=new r(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=r.zeroHash=`\0\0\0\0\0\0\0\0`;r.fromNumber=function(e){if(e===0)return o;var t=e<0;t&&(e=-e);var n=e>>>0,s=(e-n)/4294967296>>>0;return t&&(s=~s>>>0,n=~n>>>0,++n>4294967295&&(n=0,++s>4294967295&&(s=0))),new r(n,s)},r.from=function(e){if(typeof e==`number`)return r.fromNumber(e);if(n.isString(e))if(n.Long)e=n.Long.fromString(e);else return r.fromNumber(parseInt(e,10));return e.low||e.high?new r(e.low>>>0,e.high>>>0):o},r.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296},r.prototype.toLong=function(e){return n.Long?new n.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var c=String.prototype.charCodeAt;r.fromHash=function(e){return e===s?o:new r((c.call(e,0)|c.call(e,1)<<8|c.call(e,2)<<16|c.call(e,3)<<24)>>>0,(c.call(e,4)|c.call(e,5)<<8|c.call(e,6)<<16|c.call(e,7)<<24)>>>0)},r.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},r.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},r.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},r.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}})),require_minimal$1=__commonJSMin((e=>{var t=e;t.asPromise=require_aspromise(),t.base64=require_base64(),t.EventEmitter=require_eventemitter(),t.float=require_float(),t.inquire=require_inquire(),t.utf8=require_utf8(),t.pool=require_pool(),t.LongBits=require_longbits(),t.isNode=!!(typeof global<`u`&&global&&global.process&&global.process.versions&&global.process.versions.node),t.global=t.isNode&&global||typeof window<`u`&&window||typeof self<`u`&&self||e,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return typeof e==`string`||e instanceof String},t.isObject=function(e){return e&&typeof e==`object`},t.isset=t.isSet=function(e,t){var n=e[t];return n!=null&&e.hasOwnProperty(t)?typeof n!=`object`||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1},t.Buffer=(function(){try{var e=t.inquire(`buffer`).Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}})(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return typeof e==`number`?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):typeof Uint8Array>`u`?e:new Uint8Array(e)},t.Array=typeof Uint8Array<`u`?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire(`long`),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,n){var r=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(r.lo,r.hi,n):r.toNumber(!!n)};function n(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;++o)(e[r[o]]===void 0||!n)&&(e[r[o]]=t[r[o]]);return e}t.merge=n,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function r(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,`message`,{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,`stack`,{value:Error().stack||``}),r&&n(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+`: `+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}t.newError=r,t.ProtocolError=r(`ProtocolError`),t.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(t[e[n]]===1&&this[e[n]]!==void 0&&this[e[n]]!==null)return e[n]}},t.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;if(!e){t._Buffer_from=t._Buffer_allocUnsafe=null;return}t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},t._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}}})),require_writer=__commonJSMin(((e,t)=>{t.exports=f;var n=require_minimal$1(),r,o=n.LongBits,s=n.base64,c=n.utf8;function l(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function u(){}function d(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function f(){this.len=0,this.head=new l(u,0,0),this.tail=this.head,this.states=null}var p=function(){return n.Buffer?function(){return(f.create=function(){return new r})()}:function(){return new f}};f.create=p(),f.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(f.alloc=n.pool(f.alloc,n.Array.prototype.subarray)),f.prototype._push=function(e,t,n){return this.tail=this.tail.next=new l(e,t,n),this.len+=t,this};function m(e,t,n){t[n]=e&255}function h(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function g(e,t){this.len=e,this.next=void 0,this.val=t}g.prototype=Object.create(l.prototype),g.prototype.fn=h,f.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new g((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},f.prototype.int32=function(e){return e<0?this._push(_,10,o.fromNumber(e)):this.uint32(e)},f.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function _(e,t,n){for(;e.hi;)t[n++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=e.lo&127|128,e.lo>>>=7;t[n++]=e.lo}f.prototype.uint64=function(e){var t=o.from(e);return this._push(_,t.length(),t)},f.prototype.int64=f.prototype.uint64,f.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(_,t.length(),t)},f.prototype.bool=function(e){return this._push(m,1,+!!e)};function v(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}f.prototype.fixed32=function(e){return this._push(v,4,e>>>0)},f.prototype.sfixed32=f.prototype.fixed32,f.prototype.fixed64=function(e){var t=o.from(e);return this._push(v,4,t.lo)._push(v,4,t.hi)},f.prototype.sfixed64=f.prototype.fixed64,f.prototype.float=function(e){return this._push(n.float.writeFloatLE,4,e)},f.prototype.double=function(e){return this._push(n.float.writeDoubleLE,8,e)};var y=n.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};f.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(m,1,0);if(n.isString(e)){var r=f.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(y,t,e)},f.prototype.string=function(e){var t=c.length(e);return t?this.uint32(t)._push(c.write,t,e):this._push(m,1,0)},f.prototype.fork=function(){return this.states=new d(this),this.head=this.tail=new l(u,0,0),this.len=0,this},f.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(u,0,0),this.len=0),this},f.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},f.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},f._configure=function(e){r=e,f.create=p(),r._configure()}})),require_writer_buffer=__commonJSMin(((e,t)=>{t.exports=o;var n=require_writer();(o.prototype=Object.create(n.prototype)).constructor=o;var r=require_minimal$1();function o(){n.call(this)}o._configure=function(){o.alloc=r._Buffer_allocUnsafe,o.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&r.Buffer.prototype.set.name===`set`?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},o.prototype.bytes=function(e){r.isString(e)&&(e=r._Buffer_from(e,`base64`));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this};function s(e,t,n){e.length<40?r.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}o.prototype.string=function(e){var t=r.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()})),require_reader=__commonJSMin(((e,t)=>{t.exports=l;var n=require_minimal$1(),r,o=n.LongBits,s=n.utf8;function c(e,t){return RangeError(`index out of range: `+e.pos+` + `+(t||1)+` > `+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var u=typeof Uint8Array<`u`?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error(`illegal buffer`)}:function(e){if(Array.isArray(e))return new l(e);throw Error(`illegal buffer`)},d=function(){return n.Buffer?function(e){return(l.create=function(e){return n.Buffer.isBuffer(e)?new r(e):u(e)})(e)}:u};l.create=d(),l.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,l.prototype.uint32=(function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,c(this,10);return e}})(),l.prototype.int32=function(){return this.uint32()|0},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function f(){var e=new o(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw c(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw c(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error(`invalid varint encoding`)}l.prototype.bool=function(){return this.uint32()!==0};function p(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}l.prototype.fixed32=function(){if(this.pos+4>this.len)throw c(this,4);return p(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw c(this,4);return p(this.buf,this.pos+=4)|0};function m(){if(this.pos+8>this.len)throw c(this,8);return new o(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}l.prototype.float=function(){if(this.pos+4>this.len)throw c(this,4);var e=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw c(this,4);var e=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw c(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,r);if(t===r){var o=n.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,r)},l.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},l.prototype.skip=function(e){if(typeof e==`number`){if(this.pos+e>this.len)throw c(this,e);this.pos+=e}else do if(this.pos>=this.len)throw c(this);while(this.buf[this.pos++]&128);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!=4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type `+e+` at offset `+this.pos)}return this},l._configure=function(e){r=e,l.create=d(),r._configure();var t=n.Long?`toLong`:`toNumber`;n.merge(l.prototype,{int64:function(){return f.call(this)[t](!1)},uint64:function(){return f.call(this)[t](!0)},sint64:function(){return f.call(this).zzDecode()[t](!1)},fixed64:function(){return m.call(this)[t](!0)},sfixed64:function(){return m.call(this)[t](!1)}})}})),require_reader_buffer=__commonJSMin(((e,t)=>{t.exports=o;var n=require_reader();(o.prototype=Object.create(n.prototype)).constructor=o;var r=require_minimal$1();function o(e){n.call(this,e)}o._configure=function(){r.Buffer&&(o.prototype._slice=r.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString(`utf-8`,this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()})),require_service=__commonJSMin(((e,t)=>{t.exports=r;var n=require_minimal$1();(r.prototype=Object.create(n.EventEmitter.prototype)).constructor=r;function r(e,t,r){if(typeof e!=`function`)throw TypeError(`rpcImpl must be a function`);n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!r}r.prototype.rpcCall=function e(t,r,o,s,c){if(!s)throw TypeError(`request must be specified`);var l=this;if(!c)return n.asPromise(e,l,t,r,o,s);if(!l.rpcImpl){setTimeout(function(){c(Error(`already ended`))},0);return}try{return l.rpcImpl(t,r[l.requestDelimited?`encodeDelimited`:`encode`](s).finish(),function(e,n){if(e)return l.emit(`error`,e,t),c(e);if(n===null){l.end(!0);return}if(!(n instanceof o))try{n=o[l.responseDelimited?`decodeDelimited`:`decode`](n)}catch(e){return l.emit(`error`,e,t),c(e)}return l.emit(`data`,n,t),c(null,n)})}catch(e){l.emit(`error`,e,t),setTimeout(function(){c(e)},0);return}},r.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit(`end`).off()),this}})),require_rpc=__commonJSMin((e=>{var t=e;t.Service=require_service()})),require_roots=__commonJSMin(((e,t)=>{t.exports={}})),require_index_minimal=__commonJSMin((e=>{var t=e;t.build=`minimal`,t.Writer=require_writer(),t.BufferWriter=require_writer_buffer(),t.Reader=require_reader(),t.BufferReader=require_reader_buffer(),t.util=require_minimal$1(),t.rpc=require_rpc(),t.roots=require_roots(),t.configure=n;function n(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}n()})),require_minimal=__commonJSMin(((e,t)=>{t.exports=require_index_minimal()})),import_minimal=__toESM(require_minimal(),1),$Reader$1=import_minimal.Reader,$util$1=import_minimal.util,$root$1=import_minimal.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto`]||(import_minimal.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto`]={}),Model$2=$root$1.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=$util$1.emptyArray,e.prototype.createAt=$util$1.Long?$util$1.Long.fromBits(0,0,!0):0,e.prototype.description=``,e.decode=function(e,t,n){e instanceof $Reader$1||(e=$Reader$1.create(e));let r=t===void 0?e.len:e.pos+t,o=new $root$1.Model;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:o.chunks&&o.chunks.length||(o.chunks=[]),o.chunks.push($root$1.Chunk.decode(e,e.uint32()));break;case 2:o.createAt=e.uint64();break;case 3:o.description=e.string();break;default:e.skipType(t&7);break}}return o},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Model`},e})(),Chunk$1=$root$1.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 $Reader$1||(e=$Reader$1.create(e));let r=t===void 0?e.len:e.pos+t,o=new $root$1.Chunk;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:o.vertices=$root$1.Vertices.decode(e,e.uint32());break;case 2:o.faces=$root$1.Faces.decode(e,e.uint32());break;case 3:o.name=e.string();break;case 4:o.texture=e.string();break;default:e.skipType(t&7);break}}if(!o.hasOwnProperty(`vertices`))throw $util$1.ProtocolError(`missing required 'vertices'`,{instance:o});if(!o.hasOwnProperty(`faces`))throw $util$1.ProtocolError(`missing required 'faces'`,{instance:o});if(!o.hasOwnProperty(`name`))throw $util$1.ProtocolError(`missing required 'name'`,{instance:o});return o},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Chunk`},e})(),Vertices=$root$1.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=$util$1.emptyArray,e.prototype.uvs=$util$1.emptyArray,e.prototype.marks=$util$1.emptyArray,e.decode=function(e,t,n){e instanceof $Reader$1||(e=$Reader$1.create(e));let r=t===void 0?e.len:e.pos+t,o=new $root$1.Vertices;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(o.xyz&&o.xyz.length||(o.xyz=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)o.xyz.push(e.float())}else o.xyz.push(e.float());break;case 2:if(o.uvs&&o.uvs.length||(o.uvs=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)o.uvs.push(e.float())}else o.uvs.push(e.float());break;case 3:if(o.marks&&o.marks.length||(o.marks=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)o.marks.push(e.int32())}else o.marks.push(e.int32());break;default:e.skipType(t&7);break}}return o},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Vertices`},e})(),Faces=$root$1.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=$util$1.emptyArray,e.prototype.normals=$util$1.emptyArray,e.decode=function(e,t,n){e instanceof $Reader$1||(e=$Reader$1.create(e));let r=t===void 0?e.len:e.pos+t,o=new $root$1.Faces;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(o.indices&&o.indices.length||(o.indices=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)o.indices.push(e.uint32())}else o.indices.push(e.uint32());break;case 2:if(o.normals&&o.normals.length||(o.normals=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)o.normals.push(e.float())}else o.normals.push(e.float());break;default:e.skipType(t&7);break}}return o},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Faces`},e})(),VertexMark=$root$1.VertexMark=(()=>{let e={},t=Object.create(e);return t[e[0]=`VERTEX_MARK_UNSPECIFIED`]=0,t[e[1]=`VERTEX_MARK_ROOF`]=1,t})();function fixNumber(e){return isNaN(e)||!isFinite(e)?0:e}function getGeometryMemoryUsed(e){let t=0;if(e instanceof three.BufferGeometry){for(let n in e.attributes){let r=e.getAttribute(n),o=4;`BYTES_PER_ELEMENT`in r.array&&typeof r.array.BYTES_PER_ELEMENT==`number`&&(o=r.array.BYTES_PER_ELEMENT),t+=fixNumber(r.count*r.itemSize*o)}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+=fixNumber(n.count*n.itemSize*e)}}else e instanceof three.Geometry&&(t+=fixNumber(e.faces.length*3*3*4),t+=fixNumber(e.faceVertexUvs.length*3*2*4));return t}function getPBMGSObjectMemoryUsed(e){let t=[e.packedData,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 makeComputeBlockRectSizeFunction(e,t,n){return function(r,o,s){return((r+e-1)/e|0)*((o+t-1)/t|0)*n*s}}function makeComputePaddedRectSizeFunction(e,t,n){return function(r,o,s){return(Math.max(r,e)*Math.max(o,t)/n|0)*s}}var compressedTextureFunctions=new Map([[three.RGB_S3TC_DXT1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[three.RGBA_S3TC_DXT1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[three.RGBA_S3TC_DXT3_Format,makeComputeBlockRectSizeFunction(4,4,16)],[three.RGBA_S3TC_DXT5_Format,makeComputeBlockRectSizeFunction(4,4,16)],[three.RGB_ETC1_Format,makeComputeBlockRectSizeFunction(4,4,8)],[three.RGB_PVRTC_4BPPV1_Format,makeComputePaddedRectSizeFunction(8,8,2)],[three.RGBA_PVRTC_4BPPV1_Format,makeComputePaddedRectSizeFunction(8,8,2)],[three.RGB_PVRTC_2BPPV1_Format,makeComputePaddedRectSizeFunction(16,8,4)],[three.RGBA_PVRTC_2BPPV1_Format,makeComputePaddedRectSizeFunction(16,8,4)],[three.RGB_ETC2_Format,makeComputeBlockRectSizeFunction(4,4,8)],[three.RGBA_ETC2_EAC_Format,makeComputeBlockRectSizeFunction(4,4,16)],[three.RGBA_ASTC_4x4_Format,makeComputeBlockRectSizeFunction(4,4,16)],[three.SRGB8_ALPHA8_ASTC_4x4_Format,makeComputeBlockRectSizeFunction(4,4,16)],[three.RGBA_ASTC_5x4_Format,makeComputeBlockRectSizeFunction(5,4,16)],[three.SRGB8_ALPHA8_ASTC_5x4_Format,makeComputeBlockRectSizeFunction(5,4,16)],[three.RGBA_ASTC_5x5_Format,makeComputeBlockRectSizeFunction(5,5,16)],[three.SRGB8_ALPHA8_ASTC_5x5_Format,makeComputeBlockRectSizeFunction(5,5,16)],[three.RGBA_ASTC_6x5_Format,makeComputeBlockRectSizeFunction(6,5,16)],[three.SRGB8_ALPHA8_ASTC_6x5_Format,makeComputeBlockRectSizeFunction(6,5,16)],[three.RGBA_ASTC_6x6_Format,makeComputeBlockRectSizeFunction(6,6,16)],[three.SRGB8_ALPHA8_ASTC_6x6_Format,makeComputeBlockRectSizeFunction(6,6,16)],[three.RGBA_ASTC_8x5_Format,makeComputeBlockRectSizeFunction(8,5,16)],[three.SRGB8_ALPHA8_ASTC_8x5_Format,makeComputeBlockRectSizeFunction(8,5,16)],[three.RGBA_ASTC_8x6_Format,makeComputeBlockRectSizeFunction(8,6,16)],[three.SRGB8_ALPHA8_ASTC_8x6_Format,makeComputeBlockRectSizeFunction(8,6,16)],[three.RGBA_ASTC_8x8_Format,makeComputeBlockRectSizeFunction(8,8,16)],[three.SRGB8_ALPHA8_ASTC_8x8_Format,makeComputeBlockRectSizeFunction(8,8,16)],[three.RGBA_ASTC_10x5_Format,makeComputeBlockRectSizeFunction(10,5,16)],[three.SRGB8_ALPHA8_ASTC_10x5_Format,makeComputeBlockRectSizeFunction(10,5,16)],[three.RGBA_ASTC_10x6_Format,makeComputeBlockRectSizeFunction(10,6,16)],[three.SRGB8_ALPHA8_ASTC_10x6_Format,makeComputeBlockRectSizeFunction(10,6,16)],[three.RGBA_ASTC_10x8_Format,makeComputeBlockRectSizeFunction(10,8,16)],[three.SRGB8_ALPHA8_ASTC_10x8_Format,makeComputeBlockRectSizeFunction(10,8,16)],[three.RGBA_ASTC_10x10_Format,makeComputeBlockRectSizeFunction(10,10,16)],[three.SRGB8_ALPHA8_ASTC_10x10_Format,makeComputeBlockRectSizeFunction(10,10,16)],[three.RGBA_ASTC_12x10_Format,makeComputeBlockRectSizeFunction(12,10,16)],[three.SRGB8_ALPHA8_ASTC_12x10_Format,makeComputeBlockRectSizeFunction(12,10,16)],[three.RGBA_ASTC_12x12_Format,makeComputeBlockRectSizeFunction(12,12,16)],[three.SRGB8_ALPHA8_ASTC_12x12_Format,makeComputeBlockRectSizeFunction(12,12,16)],[three.RGBA_BPTC_Format,makeComputeBlockRectSizeFunction(4,4,16)]]);function getTextureMemoryUsed(e){let t=0,n=1;(e.generateMipmaps===!0||e.mipmaps&&e.mipmaps.length>1)&&(n=1.33);let r=e instanceof three.CompressedTexture?compressedTextureFunctions.get(e.format):void 0,o=[].concat(e.image);for(let e of o)if(e)if(e instanceof three.Texture)t+=getTextureMemoryUsed(e);else{let{width:o=1,height:s=1,depth:c=1}=e;r?t+=fixNumber(r(o,s,c)*n):t+=fixNumber(o*s*c*4*n)}return t}var textureSet=new Set,textureNames=`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 getMaterialMemoryUsed(e){let t=0;if(textureSet.clear(),e instanceof three.ShaderMaterial)for(let n in e.uniforms){let r=e.uniforms[n],o=r&&r.value&&r.value instanceof three.Texture?r.value:void 0;o instanceof three.Texture&&(textureSet.has(o)||(t=getTextureMemoryUsed(o),textureSet.add(o)))}else for(let n of textureNames){let r=e[n];r instanceof three.Texture&&(textureSet.has(r)||(t=getTextureMemoryUsed(r),textureSet.add(r)))}return textureSet.clear(),t}var sceneSet=new Set;function getMemoryUsage(e){let t=0;return sceneSet.clear(),e.traverse(e=>{if(e instanceof PBMGaussianSplattingObject&&(t+=getPBMGSObjectMemoryUsed(e)),e instanceof three.Mesh||e instanceof three.Line||e instanceof three.Points){let n=e.geometry;(n instanceof three.BufferGeometry||n instanceof three.Geometry)&&(sceneSet.has(n)||(t+=getGeometryMemoryUsed(n),sceneSet.add(n)));let r=[].concat(e.material);for(let e of r)e instanceof three.Material&&(sceneSet.has(e)||(t+=getMaterialMemoryUsed(e),sceneSet.add(e)))}}),sceneSet.clear(),t}function guessTextureBaseUriFromFileUrl(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t+1).replace(/\/(model)(\/|$)/,(e,t,n)=>`/materials`+n):``}function loadPbm(e,t={}){var n,r,o,s,c,l,u;let d=(n=t.upAxis)==null?`Z`:n,f=(r=t.light)==null?!1:r,p=(o=t.fetcher)==null?internalFetcher:o,m=(s=t.onDownloadProgress)==null?noop:s,h=(c=t.textureBaseUri)==null?guessTextureBaseUriFromFileUrl(e):c,g=t.textureBaseUri===void 0?[]:((l=t.textureArray)==null?[]:l).slice(),_=autoRestImageOptionsByTextureLength((u=t.textureOptions)==null?{}:u,g.length),v=new Map;for(let e of g){let t=isAbsoluteURL(e)?e:pathJoin(h,e);v.set(t,loadTexture$1(t,_,p))}let y={byteLength:0};return Promise.resolve().then(()=>p.ajax(e,{responseType:`arraybuffer`},void 0,void 0,m)).then(e=>{y.byteLength=e.body.byteLength;let t=new Uint8Array(e.body);return Model$2.decode(t)}).then(e=>parse$4(e,f,h,g,_,v,p)).then(t=>{v.clear();let n=new three.Group;n.name=e;for(let e of t.objects)n.add(e);return d===`Y`&&n.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),{type:`pbm`,modelUpAxis:`Z`,upAxis:d,uri:e,byteLength:y.byteLength,memoryUsage:getMemoryUsage(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}function parseFloorName(e){let t=e.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function parseChunkName(e){let t=e.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function parseSubName(e){let t=e.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}function chunkOrder(e){let t=parseFloorName(e.name),n=parseChunkName(e.name),r=parseSubName(e.name);return t*1e6+n*1e3+r}function parsePBMModel(e){var t,n,r;let o=typeof e.createAt==`number`?e.createAt:0,s=(t=e.description)==null?``:t,c=[],l=!0,u=!0;for(let t of e.chunks)if(!t.vertices.marks||t.vertices.marks.length===0){u=!1;break}for(let t of e.chunks)if(!t.faces.normals||t.faces.normals.length===0){l=!1;break}let d=e.chunks.sort((e,t)=>chunkOrder(e)-chunkOrder(t)),f=[];for(let e of d){let t=parseFloorName(e.name);f[t]||(f[t]=[]),f[t].push(e)}for(let e=0;e<f.length;e++){let t=f[e];if(t)if(l){let r=0;for(let e=0;e<t.length;e++){let n=t[e];r+=n.faces.indices.length}let l=new Float32Array(r*3),d=new Float32Array(r*2),f=new Float32Array(r*3),p=u?new Float32Array(r):void 0,m=[],h=[1/0,1/0,1/0,-1/0,-1/0,-1/0],g=0;for(let e=0;e<t.length;e++){let r=[1/0,1/0,1/0,-1/0,-1/0,-1/0],o=t[e],s=o.vertices.xyz,c=o.vertices.uvs,u=o.faces.indices,_=o.faces.normals,v=o.vertices.marks,y=u.length;for(let e=0;e<y;e++){let t=u[e],n=l[g*3+e*3]=s[t*3],o=l[g*3+e*3+1]=s[t*3+1],m=l[g*3+e*3+2]=s[t*3+2];p&&(p[g+e]=v[t]),d[g*2+e*2]=c[t*2],d[g*2+e*2+1]=c[t*2+1];let h=Math.floor(e/3)*3;f[g*3+e*3]=_[h],f[g*3+e*3+1]=_[h+1],f[g*3+e*3+2]=_[h+2],n<r[0]&&(r[0]=n),o<r[1]&&(r[1]=o),m<r[2]&&(r[2]=m),n>r[3]&&(r[3]=n),o>r[4]&&(r[4]=o),m>r[5]&&(r[5]=m)}r[0]<h[0]&&(h[0]=r[0]),r[1]<h[1]&&(h[1]=r[1]),r[2]<h[2]&&(h[2]=r[2]),r[3]>h[3]&&(h[3]=r[3]),r[4]>h[4]&&(h[4]=r[4]),r[5]>h[5]&&(h[5]=r[5]),m.push({materialIndex:e,name:o.name,chunkName:parseChunkName(o.name),start:g,count:o.faces.indices.length,texture:(n=o.texture)==null?void 0:n}),g+=y}let _={createAt:o,description:s,vertices:l,uvs:d,normals:f,masks:p,indices:null,floorIndex:e,groups:m,extents:h};c.push(_)}else{let n=0,l=0;for(let e=0;e<t.length;e++){let r=t[e];l+=r.vertices.xyz.length/3,n+=r.faces.indices.length}let d=new Float32Array(l*3),f=new Float32Array(l*2),p,m=new Float32Array(l),h=new Uint32Array(n),g=u?new Float32Array(n):void 0,_=[],v=[1/0,1/0,1/0,-1/0,-1/0,-1/0],y=0,b=0;for(let n=0;n<t.length;n++){let o=[1/0,1/0,1/0,-1/0,-1/0,-1/0],s=t[n],c=s.vertices.xyz,l=s.vertices.marks,u=s.vertices.uvs,p=s.faces.indices,S=c.length/3,C=p.length;for(let t=0;t<S;t++){let n=d[b*3+t*3]=c[t*3],r=d[b*3+t*3+1]=c[t*3+1],s=d[b*3+t*3+2]=c[t*3+2];g&&(g[b+t]=l[t]),f[b*2+t*2]=u[t*2],f[b*2+t*2+1]=u[t*2+1],m[b+t]=e,n<o[0]&&(o[0]=n),r<o[1]&&(o[1]=r),s<o[2]&&(o[2]=s),n>o[3]&&(o[3]=n),r>o[4]&&(o[4]=r),s>o[5]&&(o[5]=s)}o[0]<v[0]&&(v[0]=o[0]),o[1]<v[1]&&(v[1]=o[1]),o[2]<v[2]&&(v[2]=o[2]),o[3]>v[3]&&(v[3]=o[3]),o[4]>v[4]&&(v[4]=o[4]),o[5]>v[5]&&(v[5]=o[5]);for(let e=0;e<C;e++)h[y+e]=b+p[e];_.push({materialIndex:n,name:s.name,chunkName:parseChunkName(s.name),start:y,count:s.faces.indices.length,texture:(r=s.texture)==null?void 0:r}),b+=S,y+=C}let S={createAt:o,description:s,vertices:d,uvs:f,normals:void 0,masks:g,indices:h,floorIndex:e,groups:_,extents:v};c.push(S)}}return c}function loadTexture$1(e,t,n){let r=Object.assign({key:`texture.pbm`},pick(t,[`format`,`quality`,`size`,`sharpen`,`forceUseExifOrientation`,`mappings`]));return new TextureLoader().loadTexture(e,{imageURL:{transform:t.transform,options:r},encoding:three.sRGBEncoding,wrapS:three.ClampToEdgeWrapping,wrapT:three.ClampToEdgeWrapping,minFilter:three.LinearFilter,maxSize:typeof r.size==`number`?new three.Vector2(r.size,r.size):void 0,fetcher:n}).then(e=>{let t=e.body;return t.needsUpdate=!0,t})}function parse$4(e,t,n,r,o,s,c){let l=parsePBMModel(e),u=0,d=``,f=[],p={},m=new Set,h=0;for(let{createAt:e,description:o,vertices:s,masks:c,uvs:g,normals:_,indices:v,floorIndex:y,groups:b,extents:S}of l){let l=new three.Box3;l.min.x=S[0],l.min.y=S[1],l.min.z=S[2],l.max.x=S[3],l.max.y=S[4],l.max.z=S[5];let C=new three.BufferGeometry;C.setAttribute(`position`,new three.BufferAttribute(s,3)),C.setAttribute(`uv`,new three.BufferAttribute(g,2)),_&&C.setAttribute(`normal`,new three.BufferAttribute(_,3)),c&&C.setAttribute(`_feature_id_rsmask`,new three.BufferAttribute(c,1)),v&&C.setIndex(new three.BufferAttribute(v,1)),C.boundingBox=l,C.boundingSphere=l.getBoundingSphere(new three.Sphere);for(let e of b)C.addGroup(e.start,e.count,e.materialIndex);m.add(C);let w=[];for(let e of b){let o;if(e.texture){if(o=e.texture,r.length>0&&r.indexOf(e.texture)===-1){for(let t of r)if((isAbsoluteURL(t)?t:pathJoin(n,t)).slice(e.texture.length*-1)===e.texture){o=t;break}console.warn(`At3d/Pbm texture not matched. Use ends-guessing mode. ${e.texture} -> ${o}`)}isAbsoluteURL(o)||(o=pathJoin(n,o))}let s=new PBMMeshMaterial(t?`phong`:`basic`);s.floorIndex=y,C.attributes.normal===void 0&&(s.flatShading=!0),C.attributes._feature_id_rsmask&&(s.defines.USE_VERTEX_MARK=!0),w.push(s),o?(h++,p[o]?p[o].push(s):p[o]=[s]):s.color=new three.Color(16777215),m.add(s)}let T=new PBMMesh(C,w);T.name=`model_floor_`+y,T.userData.createAt=e,T.userData.description=o,T.matrix.compose(T.position,T.quaternion,T.scale),T.matrixAutoUpdate=!1,T.frustumCulled=!1,u=e,d=o,f.push(T)}o=autoRestImageOptionsByTextureLength(o,h);let g=[];for(let e of Object.keys(p)){let t;s&&(t=s.get(e)),t||(t=loadTexture$1(e,o,c),s&&s.set(e,t)),g.push(t.then(t=>{for(let n of p[e])n.map&&(m.delete(n.map),n.map.dispose()),n.map=t,m.add(t);return t}).catch(()=>{for(let t of p[e])t.map&&(m.delete(t.map),t.map.dispose()),t.map=null,t.color=new three.Color(16777215);return null}))}return Promise.all(g).then(e=>{let t=e.filter(e=>e instanceof three.Texture);return{createAt:u,description:d,objects:f,textures:t,dispose:()=>{m.forEach(e=>{e.dispose()}),m.clear()}}})}function autoRestImageOptionsByTextureLength(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}var _object_pattern=/^[og]\s*(.+)?/,_material_library_pattern=/^mtllib /,_material_use_pattern=/^usemtl /,_map_use_pattern=/^usemap /,_face_vertex_data_separator_pattern=/\s+/,_color=new three.Color,ObjState=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 o=this._finalize(!1);o&&(o.inherited||((n=o.groupCount)==null?0:n)<=0)&&this.materials.splice((r=o.index)==null?0:r,1);let s={index:this.materials.length,name:e||``,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:``,smooth:o===void 0?this.smooth:o.smooth,groupStart:o===void 0?0:o.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(s),s},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,o,s,c,l,u){let d=this.object.geometry,f=this.vertices.length,p=this.normals.length,m=this.uvs.length,h=this.parseVertexIndex(e,f),g=this.parseVertexIndex(t,f),_=this.parseVertexIndex(n,f),v=c===void 0?void 0:this.parseNormalIndex(c,p),y=l===void 0?void 0:this.parseNormalIndex(l,p),b=u===void 0?void 0:this.parseNormalIndex(u,p),S=r===void 0?void 0:this.parseUVIndex(r,m),C=o===void 0?void 0:this.parseUVIndex(o,m),w=s===void 0?void 0:this.parseUVIndex(s,m);(d.hasNormal===!0&&v===void 0||y===void 0||b===void 0)&&(d.hasNormal=!1),(d.hasUV===!0&&S===void 0||C===void 0||w===void 0)&&(d.hasUV=!1);let T=[h,S,v].join(`:`),E=d.indexMap[T];E===void 0&&(E=d.vertices.length/3,d.indexMap[T]=E,d.vertices.push(this.vertices[h+0],this.vertices[h+1],this.vertices[h+2]),d.hasColor&&(this.colors[h]===void 0?d.hasColor=!1:d.colors.push(this.colors[h+0],this.colors[h+1],this.colors[h+2])),d.hasNormal&&d.normals.push(this.normals[h+0],this.normals[h+1],this.normals[h+2]),d.hasUV&&d.uvs.push(this.uvs[S+0],this.uvs[S+1])),d.index.push(E);let D=[g,C,y].join(`:`),O=d.indexMap[D];O===void 0&&(O=d.vertices.length/3,d.indexMap[D]=O,d.vertices.push(this.vertices[g+0],this.vertices[g+1],this.vertices[g+2]),d.hasColor&&(this.colors[g]===void 0?d.hasColor=!1:d.colors.push(this.colors[g+0],this.colors[g+1],this.colors[g+2])),d.hasNormal&&d.normals.push(this.normals[g+0],this.normals[g+1],this.normals[g+2]),d.hasUV&&d.uvs.push(this.uvs[C+0],this.uvs[C+1])),d.index.push(O);let k=[_,w,b].join(`:`),A=d.indexMap[k];A===void 0&&(A=d.vertices.length/3,d.indexMap[k]=A,d.vertices.push(this.vertices[_+0],this.vertices[_+1],this.vertices[_+2]),d.hasColor&&(this.colors[_]===void 0?d.hasColor=!1:d.colors.push(this.colors[_+0],this.colors[_+1],this.colors[_+2])),d.hasNormal&&d.normals.push(this.normals[_+0],this.normals[_+1],this.normals[_+2]),d.hasUV&&d.uvs.push(this.uvs[w+0],this.uvs[w+1])),d.index.push(A)}};function parseObj(e){let t=new ObjState;e.indexOf(`\r
|
|
320
320
|
`)!==-1&&(e=e.replace(/\r\n/g,`
|
|
321
321
|
`)),e.indexOf(`\\
|
|
@@ -858,7 +858,7 @@ j \x006\0 \0\rA\b \vA~ wq6\0\f\v@ (F@ \x006\f\v \x006\v \
|
|
|
858
858
|
Aj$\0 \0\v}\vA\0!\0@ \0 FE@ \0A\fl"Aj"j*\0!\f A\bj"j*\0!\v \bj j*\0"\r8\0 \b j \v8\0 \b j \f8\0 \0At"j j"#*\x008\0 \0At"Ar"$At" j j" *\x008\0 Ar"%At"!j !j"!*\x008\0 Ar"&At""j "j""*\x008\0
|
|
859
859
|
j j"'*\x008\0
|
|
860
860
|
j j"*\x008\0
|
|
861
|
-
j j*\0"8\0 \x07 \0Atj" \v8\b \f8 \r8\0 j-\0\0 $j-\0\0A\btr %j-\0\0Atr &j-\0\0Atr6\f *\0! '*\0! "*\0"\f \f !*\0"\v \v #*\0" *\0"\r \r"C\0\0\0\0^@ \f "!\f \r !\r ! \v !\v\v \r \f" \v "" " C\0\0? \v \v" \f \f"" " \r \v" \f "" " C\0\0@ \v \f"\x1B \r ""\f \f"\f "\v \v"\v C\0\0? \r \r" "\r \r"\r C\0\0@6 C\0\0? " " " " \x1B " "C\0\0@ \f \f \v \v \r \rC\0\0@6 A\x006 \f \v \r C\0\0@ C\0\0@6 \0Aj!\0\f\v\v\v\0\v\v \0A\b\v`)}function y(e){return e}function b(e,t){var n,r=y(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function S(){return{a:L}}function C(){var e;function t(e,t){return z=e.exports,I(z),p(),z}var r=S();return n.instantiateWasm?new Promise((e,o)=>{n.instantiateWasm(r,(n,r)=>{e(t(n,r))})}):(_!=null||(_=v()),t(b(_,r)[0]))}for(var w=e=>{for(;e.length>0;)e.shift()(n)},T=[],E=e=>T.push(e),D=[],O=e=>D.push(e),k=()=>2147483648,A=(e,t)=>Math.ceil(e/t)*t,j=e=>{var t=(e-F.buffer.byteLength+65535)/65536|0;try{return F.grow(t),p(),1}catch(e){}},M=e=>{var t=d.length;e>>>=0;var n=k();if(e>n)return!1;for(var r=1;r<=4;r*=2){var o=t*(1+.2/r);if(o=Math.min(o,e+100663296),j(Math.min(n,A(Math.max(e,o),65536))))return!0}return!1},N=new Uint8Array(123),P=25;P>=0;--P)N[48+P]=52+P,N[65+P]=P,N[97+P]=26+P;if(N[43]=62,N[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 F;function I(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,F=e.b,e.__indirect_function_table}var L={a:M};function R(){m();function e(){var e;n.calledRun=!0,!c&&(h(),u==null||u(n),(e=n.onRuntimeInitialized)==null||e.call(n),g())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var z=C();return R(),t=f?n:new Promise((e,t)=>{u=e}),t}),_createDataModule.apply(this,arguments)}var jsContent$3='(function(){var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(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())})}function n(...e){}function r(e){return typeof Symbol>`u`?`$Symbol<${e}>$`:Symbol(e)}r(`$$FIVE_EVENT$$`);let i=Date.now();typeof performance<`u`&&(typeof performance.timeOrigin==`number`?i=performance.timeOrigin:performance.timing!==void 0&&(i=performance.timing.navigationStart));let a=typeof performance<`u`?(()=>i+performance.now()):(()=>Date.now()),o=[/\\.([0-9a-z]+)\\.jsonp([\\?\\#].*)?$/i,/jsonp_([0-9a-z]+)([\\?\\#].*)?$/i],s=typeof location<`u`?location.href:``,c=/^https\\:/.test(s);var l=class extends Error{constructor(e,t,n){super(`[NETWORK]: request proxy error(type: ${t}, reason: ${n}): ${e}`)}},u=class extends Error{constructor(e,t,n){super(`[NETWORK]: response error(type: ${t}, status: ${n}): ${e}`),this.httpStatus=n}},d=class extends Error{constructor(e,t,n){super(`[NETWORK]: request timeout(type: ${t}, timeout: ${n}ms): ${e}`)}};function f(e){if(!e)return{};let t={},n=e.trim().split(`\n`);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 p(e){for(let t of o){let n=e.match(t);if(n)return`jsonp_`+n[1]}return null}function m(e){return p(e)!==null}function h(e,t={},r=n,i=n,o=n){let m=a(),h=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' 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;p(e);let i=new l(h,`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=p(e);if(l){let n=window,o=null,f=!1,p=document.createElement(`script`);n[l]=d=>{var g,_;let v=a(),y=v-m;if(delete n[l],p.parentNode&&p.parentNode.removeChild(p),o!==null&&(window.clearTimeout(o),o=null),f===!0)return;if(d.indexOf(`data:`)!==0){let n=new u(e,`XMLHttpRequest`,500);i(n),c(n),(g=t.networkSubscribe)==null||g.emit(`network`,e,`XMLHttpRequest`,`error`,n.message);return}let b=d.split(`,`),x=(b[0].match(/:(.*?);/)||[])[1],S=b[1];if(t.responseType===`arraybuffer`||t.responseType===`blob`){let e=atob(b[1]),n=e.length,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=e.charCodeAt(t);S=t.responseType===`arraybuffer`?r.buffer:new Blob([r],{type:x})}let C={body:S,meta:{origin:h,source:e,requestTime:m,responseTime:v,costs:y,headers:{}}};r(C),s(C),(_=t.networkSubscribe)==null||_.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(C.meta)),f=!0},p.src=e,document.body.appendChild(p),typeof t.timeout==`number`&&(o=window.setTimeout(()=>{var n;if(o=null,f!==!0){f=!0;let r=new d(e,`XMLHttpRequest`,t.timeout||NaN);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,r.message)}},t.timeout))}else{let l=!1,p=new XMLHttpRequest,g=()=>{p&&(p.removeEventListener(`timeout`,_,!1),p.removeEventListener(`progress`,v,!1),p.removeEventListener(`load`,y,!1),p.removeEventListener(`error`,b,!1)),p=null,g=n},_=function(){var n;if(l===!0)return;l=!0,g();let r=new d(e,`XMLHttpRequest`,t.timeout||NaN);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,r.message)},v=function(e){l!==!0&&e.lengthComputable&&(e.total<=0||o(e.loaded/e.total,e.loaded,e.total))},y=function(n){var i;if(l===!0)return;let o=this.status;if(o===0||o>=200&&o<400){l=!0,g();let o=a(),c=o-m,u=f(this.getAllResponseHeaders()),d=n.total,p={body:this.response,meta:{origin:h,source:e,requestTime:m,responseTime:o,costs:c,headers:u,size:d}};r(p),s(p),(i=t.networkSubscribe)==null||i.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(p.meta))}else b.call(this)},b=function(){var n;if(l===!0)return;l=!0,g();let r=new u(e,`XMLHttpRequest`,this.status);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`error`,r.message)};p.addEventListener(`timeout`,_,!1),p.addEventListener(`progress`,v,!1),p.addEventListener(`load`,y,!1),p.addEventListener(`error`,b,!1),t.responseType&&(p.responseType=t.responseType),typeof t.timeout==`number`&&(p.timeout=t.timeout),p.open(`GET`,e,!0),p.send(null)}}))}let g={};function _(e,t={}){let r=a(),i=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' 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 a=new l(i,`Link`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`Link`,`forbidden`,a.message),Promise.reject(a)}).then(e=>e in g?g[e]:g[e]=new Promise((o,s)=>{let c=document.head||document.getElementsByTagName(`head`)[0],l=document.createElement(`link`),d=!1,f=null;l.onload=s=>{var c;if(f!==null&&(clearTimeout(f),f=null),d===!0)return;d=!0,o(),l.onerror=n,l.onload=n;let u=a(),p={origin:i,source:e,requestTime:r,responseTime:u,costs:u-r,headers:{}};(c=t.networkSubscribe)==null||c.emit(`network`,e,`Link`,`preload`,JSON.stringify(p))},l.onerror=r=>{var i;if(f!==null&&(clearTimeout(f),f=null),d===!0)return;d=!0,delete g[e],c&&l.parentNode===c&&c.removeChild(l);let a=new u(e,`Link`,0);s(a),l.onerror=n,l.onload=n,(i=t.networkSubscribe)==null||i.emit(`network`,e,`Link`,`error`,a.message)},typeof t.timeout==`number`&&(f=window.setTimeout(()=>{var s;if(f=null,d===!0)return;d=!0,o(),l.onerror=n,l.onload=n;let c=a(),u={origin:i,source:e,requestTime:r,responseTime:c,costs:c-r,headers:{}};(s=t.networkSubscribe)==null||s.emit(`network`,e,`Link`,`timeout`,JSON.stringify(u))},t.timeout)),l.rel=l.relList&&l.relList.supports(`prefetch`)?`prefetch`:`preload`,l.as=`fetch`,l.crossOrigin=``,l.fetchPriority=`high`,l.href=e,c&&c.appendChild(l)}))}function v(e,t={},r=n,i=n,o=n,f){let p=a(),g=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' 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 l(g,`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=>m(e)?h(e,{responseType:`blob`,networkSubscribe:t.networkSubscribe}).then(e=>URL.createObjectURL(e.body)):e).then(e=>new Promise((s,c)=>{let l=f==null?new Image:f,m=!1,h=null;typeof t.timeout==`number`&&(h=window.setTimeout(()=>{var r;if(l.onload=n,l.onerror=n,h=null,m===!0)return;m=!0;let a=new d(e,`Image`,t.timeout);i(a),c(a),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`timeout`,a.message)},t.timeout)),l.onload=()=>{var i;if(l.onload=n,l.onerror=n,h!==null&&(clearTimeout(h),h=null),m===!0)return;let c=a(),u={headers:{},origin:g,source:e,requestTime:p,responseTime:c,costs:c-p};m=!0;let d={body:l,meta:u};o(1),r(d),s(d),(i=t.networkSubscribe)==null||i.emit(`network`,e,`Image`,`ok`,JSON.stringify(d.meta))},l.onerror=()=>{var r;if(l.onload=n,l.onerror=n,h!==null&&(clearTimeout(h),h=null),m===!0)return;m=!0;let a=new u(e,`Image`,0);i(a),c(a),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`ok`,a.message)},o(0),l.src=e}))}new class{constructor(e={}){this.options=e}ajax(e,t={},r=n,i=n,a=n){var o;let s=this.options;return h(e,{responseType:t.responseType,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}},r,i,a)}loadImage(e,t={},r=n,i=n,a=n,o){var s;let c=this.options;return v(e,{timeout:(s=t.timeout)==null?c.timeout:s,get requestProxy(){var e;return(e=t.requestProxy)==null?c.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?c.networkSubscribe:e}},r,i,a,o)}preload(e,t={}){var n;let r=this.options;return _(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}})}};function y(){}function b(e,t){this.x=e||0,this.y=t||0}function x(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error(`THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.`)}function S(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(this,`id`,{value:gc++}),this.uuid=X.generateUUID(),this.name=``,this.image=e===void 0?S.DEFAULT_IMAGE:e,this.mipmaps=[],this.mapping=t===void 0?S.DEFAULT_MAPPING:t,this.wrapS=n===void 0?Vo:n,this.wrapT=r===void 0?Vo:r,this.magFilter=i===void 0?Ko:i,this.minFilter=a===void 0?Jo:a,this.anisotropy=c===void 0?1:c,this.format=o===void 0?es:o,this.internalFormat=null,this.type=s===void 0?Yo:s,this.offset=new b(0,0),this.repeat=new b(1,1),this.center=new b(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new x,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l===void 0?$s:l,this.version=0,this.onUpdate=null}function C(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=r===void 0?1:r}function w(e,t,n){this.width=e,this.height=t,this.scissor=new C(0,0,e,t),this.scissorTest=!1,this.viewport=new C(0,0,e,t),n=n||{},this.texture=new S(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=n.generateMipmaps===void 0?!1:n.generateMipmaps,this.texture.minFilter=n.minFilter===void 0?Ko:n.minFilter,this.depthBuffer=n.depthBuffer===void 0?!0:n.depthBuffer,this.stencilBuffer=n.stencilBuffer===void 0?!0:n.stencilBuffer,this.depthTexture=n.depthTexture===void 0?null:n.depthTexture}function T(e,t,n){w.call(this,e,t,n),this.samples=4}function E(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=r===void 0?1:r}function D(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function O(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error(`THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.`)}function k(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||k.DefaultOrder}function A(){this.mask=1}function j(){Object.defineProperty(this,`id`,{value:Oc++}),this.uuid=X.generateUUID(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=j.DefaultUp.clone();var e=new D,t=new k,n=new E,r=new D(1,1,1);function i(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(i),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new O},normalMatrix:{value:new x}}),this.matrix=new O,this.matrixWorld=new O,this.matrixAutoUpdate=j.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new A,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function M(){j.call(this),this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}function N(e,t){this.min=e===void 0?new D(1/0,1/0,1/0):e,this.max=t===void 0?new D(-1/0,-1/0,-1/0):t}function P(e,t,n,r,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){$c.fromArray(e,a);var s=i.x*Math.abs($c.x)+i.y*Math.abs($c.y)+i.z*Math.abs($c.z),c=t.dot($c),l=n.dot($c),u=r.dot($c);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}function F(e,t){this.center=e===void 0?new D:e,this.radius=t===void 0?-1:t}function I(e,t){this.origin=e===void 0?new D:e,this.direction=t===void 0?new D(0,0,-1):t}function L(e,t){this.normal=e===void 0?new D(1,0,0):e,this.constant=t===void 0?0:t}function R(e,t,n){this.a=e===void 0?new D:e,this.b=t===void 0?new D:t,this.c=n===void 0?new D:n}function z(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}function ee(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function te(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function ne(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}function B(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new D,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new z,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=a===void 0?0:a}function V(){Object.defineProperty(this,`id`,{value:wl++}),this.uuid=X.generateUUID(),this.name=``,this.type=`Material`,this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=lc,this.stencilZFail=lc,this.stencilZPass=lc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function re(e){V.call(this),this.type=`MeshBasicMaterial`,this.color=new z(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.setValues(e)}function H(e,t,n){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n===!0,this.usage=uc,this.updateRange={offset:0,count:-1},this.version=0}function U(e,t,n){H.call(this,new Int8Array(e),t,n)}function ie(e,t,n){H.call(this,new Uint8Array(e),t,n)}function W(e,t,n){H.call(this,new Uint8ClampedArray(e),t,n)}function ae(e,t,n){H.call(this,new Int16Array(e),t,n)}function G(e,t,n){H.call(this,new Uint16Array(e),t,n)}function oe(e,t,n){H.call(this,new Int32Array(e),t,n)}function se(e,t,n){H.call(this,new Uint32Array(e),t,n)}function K(e,t,n){H.call(this,new Float32Array(e),t,n)}function ce(e,t,n){H.call(this,new Float64Array(e),t,n)}function le(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function ue(e){if(e.length===0)return-1/0;let t=e[0];for(let n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}function q(){Object.defineProperty(this,`id`,{value:El+=2}),this.uuid=X.generateUUID(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function de(e,t){j.call(this),this.type=`Mesh`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new re:t,this.updateMorphTargets()}function fe(e,t,n,r,i,a,o,s){if((t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==2,s))===null)return null;Yl.copy(s),Yl.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(Yl);return c<n.near||c>n.far?null:{distance:c,point:Yl.clone(),object:e}}function pe(e,t,n,r,i,a,o,s,c,l,u,d){Il.fromBufferAttribute(i,l),Ll.fromBufferAttribute(i,u),Rl.fromBufferAttribute(i,d);var f=e.morphTargetInfluences;if(t.morphTargets&&a&&f){Hl.set(0,0,0),Ul.set(0,0,0),Wl.set(0,0,0);for(var p=0,m=a.length;p<m;p++){var h=f[p],g=a[p];h!==0&&(zl.fromBufferAttribute(g,l),Bl.fromBufferAttribute(g,u),Vl.fromBufferAttribute(g,d),o?(Hl.addScaledVector(zl,h),Ul.addScaledVector(Bl,h),Wl.addScaledVector(Vl,h)):(Hl.addScaledVector(zl.sub(Il),h),Ul.addScaledVector(Bl.sub(Ll),h),Wl.addScaledVector(Vl.sub(Rl),h)))}Il.add(Hl),Ll.add(Ul),Rl.add(Wl)}e.isSkinnedMesh&&(e.boneTransform(l,Il),e.boneTransform(u,Ll),e.boneTransform(d,Rl));var _=fe(e,t,n,r,Il,Ll,Rl,Jl);if(_){s&&(Gl.fromBufferAttribute(s,l),Kl.fromBufferAttribute(s,u),ql.fromBufferAttribute(s,d),_.uv=R.getUV(Jl,Il,Ll,Rl,Gl,Kl,ql,new b)),c&&(Gl.fromBufferAttribute(c,l),Kl.fromBufferAttribute(c,u),ql.fromBufferAttribute(c,d),_.uv2=R.getUV(Jl,Il,Ll,Rl,Gl,Kl,ql,new b));var v=new B(l,u,d);R.getNormal(Il,Ll,Rl,v.normal),_.face=v}return _}function J(){Object.defineProperty(this,`id`,{value:Xl+=2}),this.uuid=X.generateUUID(),this.name=``,this.type=`Geometry`,this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function me(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function he(e){for(var t={},n=0;n<e.length;n++){var r=me(e[n]);for(var i in r)t[i]=r[i]}return t}function ge(e){V.call(this),this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.vertexShader=ru,this.fragmentShader=iu,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,e!==void 0&&(e.attributes!==void 0&&console.error(`THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.`),this.setValues(e))}function _e(){j.call(this),this.type=`Camera`,this.matrixWorldInverse=new O,this.projectionMatrix=new O,this.projectionMatrixInverse=new O}function ve(e,t,n,r){_e.call(this),this.type=`PerspectiveCamera`,this.fov=e===void 0?50:e,this.zoom=1,this.near=n===void 0?.1:n,this.far=r===void 0?2e3:r,this.focus=10,this.aspect=t===void 0?1:t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function ye(e,t,n){if(j.call(this),this.type=`CubeCamera`,n.isWebGLCubeRenderTarget!==!0){console.error(`THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.`);return}this.renderTarget=n;var r=new ve(au,ou,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new D(1,0,0)),this.add(r);var i=new ve(au,ou,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new D(-1,0,0)),this.add(i);var a=new ve(au,ou,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new D(0,1,0)),this.add(a);var o=new ve(au,ou,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new D(0,-1,0)),this.add(o);var s=new ve(au,ou,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new D(0,0,1)),this.add(s);var c=new ve(au,ou,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new D(0,0,-1)),this.add(c),this.update=function(e,t){this.parent===null&&this.updateMatrixWorld();var l=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.xr.enabled=l},this.clear=function(e,t,r,i){for(var a=e.getRenderTarget(),o=0;o<6;o++)e.setRenderTarget(n,o),e.clear(t,r,i);e.setRenderTarget(a)}}function be(e,t,n){Number.isInteger(t)&&(console.warn(`THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )`),t=n),w.call(this,e,e,t)}function xe(e,t,n,r,i,a,o,s,c,l,u,d){S.call(this,null,a,o,s,c,l,r,i,u,d),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=c===void 0?Uo:c,this.minFilter=l===void 0?Uo:l,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}function Se(e,t,n,r,i,a){this.planes=[e===void 0?new L:e,t===void 0?new L:t,n===void 0?new L:n,r===void 0?new L:r,i===void 0?new L:i,a===void 0?new L:a]}function Ce(){var e=null,t=!1,n=null;function r(i,a){t!==!1&&(n(i,a),e.requestAnimationFrame(r))}return{start:function(){t!==!0&&n!==null&&(e.requestAnimationFrame(r),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function we(e,t){var n=t.isWebGL2,r=new WeakMap;function i(t,n){var r=t.array,i=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,r,i),t.onUploadCallback();var o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn(`THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.`):r instanceof Uint16Array?o=5123:r instanceof Int16Array?o=5122:r instanceof Uint32Array?o=5125:r instanceof Int32Array?o=5124:r instanceof Int8Array?o=5120:r instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}function a(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),o.count===-1?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}function o(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)}function s(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))}function c(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var n=r.get(e);n===void 0?r.set(e,i(e,t)):n.version<e.version&&(a(n.buffer,e,t),n.version=e.version)}return{get:o,remove:s,update:c}}function Te(e,t,n,r){J.call(this),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Ee(e,t,n,r)),this.mergeVertices()}function Ee(e,t,n,r){q.call(this),this.type=`PlaneBufferGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},e=e||1,t=t||1;var i=e/2,a=t/2,o=Math.floor(n)||1,s=Math.floor(r)||1,c=o+1,l=s+1,u=e/o,d=t/s,f,p,m=[],h=[],g=[],_=[];for(p=0;p<l;p++){var v=p*d-a;for(f=0;f<c;f++){var y=f*u-i;h.push(y,-v,0),g.push(0,0,1),_.push(f/o),_.push(1-p/s)}}for(p=0;p<s;p++)for(f=0;f<o;f++){var b=f+c*p,x=f+c*(p+1),S=f+1+c*(p+1),C=f+1+c*p;m.push(b,x,C),m.push(x,S,C)}this.setIndex(m),this.setAttribute(`position`,new K(h,3)),this.setAttribute(`normal`,new K(g,3)),this.setAttribute(`uv`,new K(_,2))}function De(e,t,n,r){var i=new z(0),a=0,o,s,c=null,l=0,u=null;function d(t,r,d,p){var m=r.background,h=e.xr,g=h.getSession&&h.getSession();if(g&&g.environmentBlendMode===`additive`&&(m=null),m===null?f(i,a):m&&m.isColor&&(f(m,1),p=!0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLCubeRenderTarget||m.mapping===306)){s===void 0&&(s=new de(new tu(1,1,1),new ge({type:`BackgroundCubeMaterial`,uniforms:me(lu.cube.uniforms),vertexShader:lu.cube.vertexShader,fragmentShader:lu.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute(`normal`),s.geometry.deleteAttribute(`uv`),s.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,`envMap`,{get:function(){return this.uniforms.envMap.value}}),n.update(s));var _=m.isWebGLCubeRenderTarget?m.texture:m;s.material.uniforms.envMap.value=_,s.material.uniforms.flipEnvMap.value=_.isCubeTexture?-1:1,(c!==m||l!==_.version||u!==e.toneMapping)&&(s.material.needsUpdate=!0,c=m,l=_.version,u=e.toneMapping),t.unshift(s,s.geometry,s.material,0,0,null)}else m&&m.isTexture&&(o===void 0&&(o=new de(new Ee(2,2),new ge({type:`BackgroundMaterial`,uniforms:me(lu.background.uniforms),vertexShader:lu.background.vertexShader,fragmentShader:lu.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute(`normal`),Object.defineProperty(o.material,`map`,{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=m,m.matrixAutoUpdate===!0&&m.updateMatrix(),o.material.uniforms.uvTransform.value.copy(m.matrix),(c!==m||l!==m.version||u!==e.toneMapping)&&(o.material.needsUpdate=!0,c=m,l=m.version,u=e.toneMapping),t.unshift(o,o.geometry,o.material,0,0,null))}function f(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,r)}return{getClearColor:function(){return i},setClearColor:function(e,t){i.set(e),a=t===void 0?1:t,f(i,a)},getClearAlpha:function(){return a},setClearAlpha:function(e){a=e,f(i,a)},render:d}}function Oe(e,t,n,r){var i=r.isWebGL2,a;function o(e){a=e}function s(t,r){e.drawArrays(a,t,r),n.update(r,a)}function c(r,o,s,c){if(c!==0){var l,u;if(i)l=e,u=`drawArraysInstanced`;else if(l=t.get(`ANGLE_instanced_arrays`),u=`drawArraysInstancedANGLE`,l===null){console.error(`THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.`);return}l[u](a,o,s,c),n.update(s,a,c)}}this.setMode=o,this.render=s,this.renderInstances=c}function ke(e,t,n){var r;function i(){if(r!==void 0)return r;var n=t.get(`EXT_texture_filter_anisotropic`);return r=n===null?0:e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT),r}function a(t){if(t===`highp`){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?`mediump`:`lowp`}var o=typeof WebGL2RenderingContext<`u`&&e instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<`u`&&e instanceof WebGL2ComputeRenderingContext,s=n.precision===void 0?`highp`:n.precision,c=a(s);c!==s&&(console.warn(`THREE.WebGLRenderer:`,s,`not supported, using`,c,`instead.`),s=c);var l=n.logarithmicDepthBuffer===!0,u=e.getParameter(34930),d=e.getParameter(35660),f=e.getParameter(3379),p=e.getParameter(34076),m=e.getParameter(34921),h=e.getParameter(36347),g=e.getParameter(36348),_=e.getParameter(36349),v=d>0,y=o||!!t.get(`OES_texture_float`),b=v&&y,x=o?e.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:i,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:d,maxTextureSize:f,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:h,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:b,maxSamples:x}}function Ae(){var e=this,t=null,n=0,r=!1,i=!1,a=new L,o=new x,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,a){var o=e.length!==0||i||n!==0||r;return r=i,t=l(e,a,0),n=e.length,o},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1,c()},this.setState=function(e,a,o,u,d,f){if(!r||e===null||e.length===0||i&&!o)i?l(null):c();else{var p=i?0:n,m=p*4,h=d.clippingState||null;s.value=h,h=l(e,u,m,f);for(var g=0;g!==m;++g)h[g]=t[g];d.clippingState=h,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=p}};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(t,n,r,i){var c=t===null?0:t.length,l=null;if(c!==0){if(l=s.value,i!==!0||l===null){var u=r+c*4,d=n.matrixWorldInverse;o.getNormalMatrix(d),(l===null||l.length<u)&&(l=new Float32Array(u));for(var f=0,p=r;f!==c;++f,p+=4)a.copy(t[f]).applyMatrix4(d,o),a.normal.toArray(l,p),l[p+3]=a.constant}s.value=l,s.needsUpdate=!0}return e.numPlanes=c,e.numIntersection=0,l}}function je(e){var t={};return{get:function(n){if(t[n]!==void 0)return t[n];var r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return r===null&&console.warn(`THREE.WebGLRenderer: `+n+` extension not supported.`),t[n]=r,r}}}function Me(e,t,n){var r=new WeakMap,i=new WeakMap;function a(e){var o=e.target,s=r.get(o);for(var c in s.index!==null&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);o.removeEventListener(`dispose`,a),r.delete(o);var l=i.get(s);l&&(t.remove(l),i.delete(s)),n.memory.geometries--}function o(e,t){var i=r.get(t);return i||(t.addEventListener(`dispose`,a),t.isBufferGeometry?i=t:t.isGeometry&&(t._bufferGeometry===void 0&&(t._bufferGeometry=new q().setFromObject(e)),i=t._bufferGeometry),r.set(t,i),n.memory.geometries++,i)}function s(e){var n=e.index,r=e.attributes;for(var i in n!==null&&t.update(n,34963),r)t.update(r[i],34962);var a=e.morphAttributes;for(var i in a)for(var o=a[i],s=0,c=o.length;s<c;s++)t.update(o[s],34962)}function c(e){var n=[],r=e.index,a=e.attributes.position,o=0;if(r!==null){var s=r.array;o=r.version;for(var c=0,l=s.length;c<l;c+=3){var u=s[c+0],d=s[c+1],f=s[c+2];n.push(u,d,d,f,f,u)}}else{var s=a.array;o=a.version;for(var c=0,l=s.length/3-1;c<l;c+=3){var u=c+0,d=c+1,f=c+2;n.push(u,d,d,f,f,u)}}var p=new(ue(n)>65535?se:G)(n,1);p.version=o,t.update(p,34963);var m=i.get(e);m&&t.remove(m),i.set(e,p)}function l(e){var t=i.get(e);if(t){var n=e.index;n!==null&&t.version<n.version&&c(e)}else c(e);return i.get(e)}return{get:o,update:s,getWireframeAttribute:l}}function Ne(e,t,n,r){var i=r.isWebGL2,a;function o(e){a=e}var s,c;function l(e){s=e.type,c=e.bytesPerElement}function u(t,r){e.drawElements(a,r,s,t*c),n.update(r,a)}function d(r,o,l,u){if(u!==0){var d,f;if(i)d=e,f=`drawElementsInstanced`;else if(d=t.get(`ANGLE_instanced_arrays`),f=`drawElementsInstancedANGLE`,d===null){console.error(`THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.`);return}d[f](a,l,s,o*c,u),n.update(l,a,u)}}this.setMode=o,this.setIndex=l,this.render=u,this.renderInstances=d}function Pe(e){var t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(e,t,r){switch(r=r||1,n.calls++,t){case 4:n.triangles+=e/3*r;break;case 1:n.lines+=e/2*r;break;case 3:n.lines+=r*(e-1);break;case 2:n.lines+=r*e;break;case 0:n.points+=r*e;break;default:console.error(`THREE.WebGLInfo: Unknown draw mode:`,t);break}}function i(){n.frame++,n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:i,update:r}}function Fe(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Ie(e){var t={},n=new Float32Array(8);function r(r,i,a,o){var s=r.morphTargetInfluences,c=s===void 0?0:s.length,l=t[i.id];if(l===void 0){l=[];for(var u=0;u<c;u++)l[u]=[u,0];t[i.id]=l}for(var d=a.morphTargets&&i.morphAttributes.position,f=a.morphNormals&&i.morphAttributes.normal,u=0;u<c;u++){var p=l[u];p[1]!==0&&(d&&i.deleteAttribute(`morphTarget`+u),f&&i.deleteAttribute(`morphNormal`+u))}for(var u=0;u<c;u++){var p=l[u];p[0]=u,p[1]=s[u]}l.sort(Fe);for(var m=0,u=0;u<8;u++){var p=l[u];if(p){var h=p[0],g=p[1];if(g){d&&i.setAttribute(`morphTarget`+u,d[h]),f&&i.setAttribute(`morphNormal`+u,f[h]),n[u]=g,m+=g;continue}}n[u]=0}var _=i.morphTargetsRelative?1:1-m;o.getUniforms().setValue(e,`morphTargetBaseInfluence`,_),o.getUniforms().setValue(e,`morphTargetInfluences`,n)}return{update:r}}function Le(e,t,n,r){var i=new WeakMap;function a(e){var a=r.render.frame,o=e.geometry,s=t.get(e,o);return i.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),i.set(s,a)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s}function o(){i=new WeakMap}return{update:a,dispose:o}}function Re(e,t,n,r,i,a,o,s,c,l){e=e===void 0?[]:e,t=t===void 0?301:t,o=o===void 0?$o:o,S.call(this,e,t,n,r,i,a,o,s,c,l),this.flipY=!1}function ze(e,t,n,r){S.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=Uo,this.minFilter=Uo,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Be(e,t,n,r){S.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=Uo,this.minFilter=Uo,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Ve(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=mu[i];if(a===void 0&&(a=new Float32Array(i),mu[i]=a),t!==0){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function He(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Ue(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function We(e,t){var n=hu[t];n===void 0&&(n=new Int32Array(t),hu[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Ge(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ke(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(He(n,t))return;e.uniform2fv(this.addr,t),Ue(n,t)}}function qe(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(He(n,t))return;e.uniform3fv(this.addr,t),Ue(n,t)}}function Je(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(He(n,t))return;e.uniform4fv(this.addr,t),Ue(n,t)}}function Ye(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;vu.set(r),e.uniformMatrix2fv(this.addr,!1,vu),Ue(n,r)}}function Xe(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;_u.set(r),e.uniformMatrix3fv(this.addr,!1,_u),Ue(n,r)}}function Ze(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;gu.set(r),e.uniformMatrix4fv(this.addr,!1,gu),Ue(n,r)}}function Qe(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||uu,i)}function $e(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||du,i)}function et(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||fu,i)}function tt(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||pu,i)}function nt(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function rt(e,t){var n=this.cache;He(n,t)||(e.uniform2iv(this.addr,t),Ue(n,t))}function it(e,t){var n=this.cache;He(n,t)||(e.uniform3iv(this.addr,t),Ue(n,t))}function at(e,t){var n=this.cache;He(n,t)||(e.uniform4iv(this.addr,t),Ue(n,t))}function ot(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function st(e){switch(e){case 5126:return Ge;case 35664:return Ke;case 35665:return qe;case 35666:return Je;case 35674:return Ye;case 35675:return Xe;case 35676:return Ze;case 5124:case 35670:return nt;case 35667:case 35671:return rt;case 35668:case 35672:return it;case 35669:case 35673:return at;case 5125:return ot;case 35678:case 36198:case 36298:case 36306:case 35682:return Qe;case 35679:case 36299:case 36307:return et;case 35680:case 36300:case 36308:case 36293:return tt;case 36289:case 36303:case 36311:case 36292:return $e}}function ct(e,t){e.uniform1fv(this.addr,t)}function lt(e,t){e.uniform1iv(this.addr,t)}function ut(e,t){e.uniform2iv(this.addr,t)}function dt(e,t){e.uniform3iv(this.addr,t)}function ft(e,t){e.uniform4iv(this.addr,t)}function pt(e,t){var n=Ve(t,this.size,2);e.uniform2fv(this.addr,n)}function mt(e,t){var n=Ve(t,this.size,3);e.uniform3fv(this.addr,n)}function ht(e,t){var n=Ve(t,this.size,4);e.uniform4fv(this.addr,n)}function gt(e,t){var n=Ve(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function _t(e,t){var n=Ve(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function vt(e,t){var n=Ve(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function yt(e,t,n){var r=t.length,i=We(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(t[a]||uu,i[a])}function bt(e,t,n){var r=t.length,i=We(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(t[a]||pu,i[a])}function xt(e){switch(e){case 5126:return ct;case 35664:return pt;case 35665:return mt;case 35666:return ht;case 35674:return gt;case 35675:return _t;case 35676:return vt;case 5124:case 35670:return lt;case 35667:case 35671:return ut;case 35668:case 35672:return dt;case 35669:case 35673:return ft;case 35678:case 36198:case 36298:case 36306:case 35682:return yt;case 35680:case 36300:case 36308:case 36293:return bt}}function St(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=st(t.type)}function Ct(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=xt(t.type)}function wt(e){this.id=e,this.seq=[],this.map={}}function Tt(e,t){e.seq.push(t),e.map[t.id]=t}function Et(e,t,n){var r=e.name,i=r.length;for(yu.lastIndex=0;;){var a=yu.exec(r),o=yu.lastIndex,s=a[1],c=a[2]===`]`,l=a[3];if(c&&(s|=0),l===void 0||l===`[`&&o+2===i){Tt(n,l===void 0?new St(s,e,t):new Ct(s,e,t));break}else{var u=n.map[s];u===void 0&&(u=new wt(s),Tt(n,u)),n=u}}}function Dt(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r);Et(i,e.getUniformLocation(t,i.name),this)}}function Ot(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}function kt(e){for(var t=e.split(`\n`),n=0;n<t.length;n++)t[n]=n+1+`: `+t[n];return t.join(`\n`)}function At(e){switch(e){case $s:return[`Linear`,`( value )`];case ec:return[`sRGB`,`( value )`];case nc:return[`RGBE`,`( value )`];case ic:return[`RGBM`,`( value, 7.0 )`];case ac:return[`RGBM`,`( value, 16.0 )`];case oc:return[`RGBD`,`( value, 256.0 )`];case tc:return[`Gamma`,`( value, float( GAMMA_FACTOR ) )`];case rc:return[`LogLuv`,`( value )`];default:throw Error(`unsupported encoding: `+e)}}function jt(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;var a=e.getShaderSource(t);return`THREE.WebGLShader: gl.getShaderInfoLog() `+n+`\n`+i+kt(a)}function Mt(e,t){var n=At(t);return`vec4 `+e+`( vec4 value ) { return `+n[0]+`ToLinear`+n[1]+`; }`}function Nt(e,t){var n=At(t);return`vec4 `+e+`( vec4 value ) { return LinearTo`+n[0]+n[1]+`; }`}function Pt(e,t){var n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Uncharted2`;break;case 4:n=`OptimizedCineon`;break;case 5:n=`ACESFilmic`;break;default:throw Error(`unsupported toneMapping: `+t)}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}function Ft(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||e.shaderID===`physical`?`#extension GL_OES_standard_derivatives : enable`:``,(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?`#extension GL_EXT_frag_depth : enable`:``,e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?`#extension GL_EXT_draw_buffers : require`:``,(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?`#extension GL_EXT_shader_texture_lod : enable`:``].filter(Rt).join(`\n`)}function It(e){var t=[];for(var n in e){var r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(`\n`)}function Lt(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i).name;n[a]=e.getAttribLocation(t,a)}return n}function Rt(e){return e!==``}function zt(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Bt(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function Vt(e){return e.replace(xu,Ht)}function Ht(e,t){var n=Q[t];if(n===void 0)throw Error(`Can not resolve #include <`+t+`>`);return Vt(n)}function Ut(e){return e.replace(Cu,Gt).replace(Su,Wt)}function Wt(e,t,n,r){return console.warn(`WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.`),Gt(e,t,n,r)}function Gt(e,t,n,r){for(var i=``,a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\\[ i \\]/g,`[ `+a+` ]`).replace(/UNROLLED_LOOP_INDEX/g,a);return i}function Kt(e){var t=`precision `+e.precision+` float;\nprecision `+e.precision+` int;`;return e.precision===`highp`?t+=`\n#define HIGH_PRECISION`:e.precision===`mediump`?t+=`\n#define MEDIUM_PRECISION`:e.precision===`lowp`&&(t+=`\n#define LOW_PRECISION`),t}function qt(e){var t=`SHADOWMAP_TYPE_BASIC`;return e.shadowMapType===1?t=`SHADOWMAP_TYPE_PCF`:e.shadowMapType===2?t=`SHADOWMAP_TYPE_PCF_SOFT`:e.shadowMapType===3&&(t=`SHADOWMAP_TYPE_VSM`),t}function Jt(e){var t=`ENVMAP_TYPE_CUBE`;if(e.envMap)switch(e.envMapMode){case 301:case 302:t=`ENVMAP_TYPE_CUBE`;break;case 306:case 307:t=`ENVMAP_TYPE_CUBE_UV`;break;case 303:case 304:t=`ENVMAP_TYPE_EQUIREC`;break;case 305:t=`ENVMAP_TYPE_SPHERE`;break}return t}function Yt(e){var t=`ENVMAP_MODE_REFLECTION`;if(e.envMap)switch(e.envMapMode){case 302:case 304:t=`ENVMAP_MODE_REFRACTION`;break}return t}function Xt(e){var t=`ENVMAP_BLENDING_NONE`;if(e.envMap)switch(e.combine){case 0:t=`ENVMAP_BLENDING_MULTIPLY`;break;case 1:t=`ENVMAP_BLENDING_MIX`;break;case 2:t=`ENVMAP_BLENDING_ADD`;break}return t}function Zt(e,t,n){var r=e.getContext(),i=n.defines,a=n.vertexShader,o=n.fragmentShader,s=qt(n),c=Jt(n),l=Yt(n),u=Xt(n),d=e.gammaFactor>0?e.gammaFactor:1,f=n.isWebGL2?``:Ft(n),p=It(i),m=r.createProgram(),h,g;if(n.isRawShaderMaterial?(h=[p].filter(Rt).join(`\n`),h.length>0&&(h+=`\n`),g=[f,p].filter(Rt).join(`\n`),g.length>0&&(g+=`\n`)):(h=[Kt(n),`#define SHADER_NAME `+n.shaderName,p,n.instancing?`#define USE_INSTANCING`:``,n.supportsVertexTextures?`#define VERTEX_TEXTURES`:``,`#define GAMMA_FACTOR `+d,`#define MAX_BONES `+n.maxBones,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMap&&n.objectSpaceNormalMap?`#define OBJECTSPACE_NORMALMAP`:``,n.normalMap&&n.tangentSpaceNormalMap?`#define TANGENTSPACE_NORMALMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.displacementMap&&n.supportsVertexTextures?`#define USE_DISPLACEMENTMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.vertexTangents?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexUvs?`#define USE_UV`:``,n.uvsVertexOnly?`#define UVS_VERTEX_ONLY`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.useVertexTexture?`#define BONE_TEXTURE`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+s:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?`#define USE_LOGDEPTHBUF_EXT`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#ifdef USE_COLOR`,` attribute vec3 color;`,`#endif`,`#ifdef USE_MORPHTARGETS`,` attribute vec3 morphTarget0;`,` attribute vec3 morphTarget1;`,` attribute vec3 morphTarget2;`,` attribute vec3 morphTarget3;`,` #ifdef USE_MORPHNORMALS`,` attribute vec3 morphNormal0;`,` attribute vec3 morphNormal1;`,` attribute vec3 morphNormal2;`,` attribute vec3 morphNormal3;`,` #else`,` attribute vec3 morphTarget4;`,` attribute vec3 morphTarget5;`,` attribute vec3 morphTarget6;`,` attribute vec3 morphTarget7;`,` #endif`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,`\n`].filter(Rt).join(`\n`),g=[f,Kt(n),`#define SHADER_NAME `+n.shaderName,p,n.alphaTest?`#define ALPHATEST `+n.alphaTest+(n.alphaTest%1?``:`.0`):``,`#define GAMMA_FACTOR `+d,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+c:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMap&&n.objectSpaceNormalMap?`#define OBJECTSPACE_NORMALMAP`:``,n.normalMap&&n.tangentSpaceNormalMap?`#define TANGENTSPACE_NORMALMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.sheen?`#define USE_SHEEN`:``,n.vertexTangents?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexUvs?`#define USE_UV`:``,n.uvsVertexOnly?`#define UVS_VERTEX_ONLY`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+s:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.physicallyCorrectLights?`#define PHYSICALLY_CORRECT_LIGHTS`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?`#define USE_LOGDEPTHBUF_EXT`:``,(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?`#define TEXTURE_LOD_EXT`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:Q.tonemapping_pars_fragment,n.toneMapping===0?``:Pt(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?Q.encodings_pars_fragment:``,n.mapEncoding?Mt(`mapTexelToLinear`,n.mapEncoding):``,n.matcapEncoding?Mt(`matcapTexelToLinear`,n.matcapEncoding):``,n.envMapEncoding?Mt(`envMapTexelToLinear`,n.envMapEncoding):``,n.emissiveMapEncoding?Mt(`emissiveMapTexelToLinear`,n.emissiveMapEncoding):``,n.lightMapEncoding?Mt(`lightMapTexelToLinear`,n.lightMapEncoding):``,n.outputEncoding?Nt(`linearToOutputTexel`,n.outputEncoding):``,n.depthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,`\n`].filter(Rt).join(`\n`)),a=Vt(a),a=zt(a,n),a=Bt(a,n),o=Vt(o),o=zt(o,n),o=Bt(o,n),a=Ut(a),o=Ut(o),n.isWebGL2&&!n.isRawShaderMaterial){var _=!1,v=/^\\s*#version\\s+300\\s+es\\s*\\n/;n.isShaderMaterial&&a.match(v)!==null&&o.match(v)!==null&&(_=!0,a=a.replace(v,``),o=o.replace(v,``)),h=[`#version 300 es\n`,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(`\n`)+`\n`+h,g=[`#version 300 es\n`,`#define varying in`,_?``:`out highp vec4 pc_fragColor;`,_?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(`\n`)+`\n`+g}var y=h+a,b=g+o,x=Ot(r,35633,y),S=Ot(r,35632,b);if(r.attachShader(m,x),r.attachShader(m,S),n.index0AttributeName===void 0?n.morphTargets===!0&&r.bindAttribLocation(m,0,`position`):r.bindAttribLocation(m,0,n.index0AttributeName),r.linkProgram(m),e.debug.checkShaderErrors){var C=r.getProgramInfoLog(m).trim(),w=r.getShaderInfoLog(x).trim(),T=r.getShaderInfoLog(S).trim(),E=!0,D=!0;if(r.getProgramParameter(m,35714)===!1){E=!1;var O=jt(r,x,`vertex`),k=jt(r,S,`fragment`);console.error(`THREE.WebGLProgram: shader error: `,r.getError(),`35715`,r.getProgramParameter(m,35715),`gl.getProgramInfoLog`,C,O,k)}else C===``?(w===``||T===``)&&(D=!1):console.warn(`THREE.WebGLProgram: gl.getProgramInfoLog()`,C);D&&(this.diagnostics={runnable:E,programLog:C,vertexShader:{log:w,prefix:h},fragmentShader:{log:T,prefix:g}})}r.deleteShader(x),r.deleteShader(S);var A;this.getUniforms=function(){return A===void 0&&(A=new Dt(r,m)),A};var j;return this.getAttributes=function(){return j===void 0&&(j=Lt(r,m)),j},this.destroy=function(){r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=bu++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=S,this}function Qt(e,t,n){var r=[],i=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,c=n.maxVertexUniforms,l=n.vertexTextures,u={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`},d=`precision.isWebGL2.supportsVertexTextures.outputEncoding.instancing.map.mapEncoding.matcap.matcapEncoding.envMap.envMapMode.envMapEncoding.envMapCubeUV.lightMap.lightMapEncoding.aoMap.emissiveMap.emissiveMapEncoding.bumpMap.normalMap.objectSpaceNormalMap.tangentSpaceNormalMap.clearcoatMap.clearcoatRoughnessMap.clearcoatNormalMap.displacementMap.specularMap.roughnessMap.metalnessMap.gradientMap.alphaMap.combine.vertexColors.vertexTangents.vertexUvs.uvsVertexOnly.fog.useFog.fogExp2.flatShading.sizeAttenuation.logarithmicDepthBuffer.skinning.maxBones.useVertexTexture.morphTargets.morphNormals.maxMorphTargets.maxMorphNormals.premultipliedAlpha.numDirLights.numPointLights.numSpotLights.numHemiLights.numRectAreaLights.numDirLightShadows.numPointLightShadows.numSpotLightShadows.shadowMapEnabled.shadowMapType.toneMapping.physicallyCorrectLights.alphaTest.doubleSided.flipSided.numClippingPlanes.numClipIntersection.depthPacking.dithering.sheen`.split(`.`);function f(e,t){var n;if(t){var r=lu[t];n={name:e.type,uniforms:nu.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}function p(e){var t=e.skeleton.bones;if(o)return 1024;var n=Math.floor((c-20)/4),r=Math.min(n,t.length);return r<t.length?(console.warn(`THREE.WebGLRenderer: Skeleton has `+t.length+` bones. This GPU supports `+r+`.`),0):r}function m(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn(`THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.`),t=e.texture.encoding):t=$s,t}this.getParameters=function(r,c,d,h,g,_,v){var y=h.fog,b=r.isMeshStandardMaterial?h.environment:null,x=r.envMap||b,S=u[r.type],C=v.isSkinnedMesh?p(v):0;r.precision!==null&&(s=n.getMaxPrecision(r.precision),s!==r.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,r.precision,`not supported, using`,s,`instead.`));var w=f(r,S);r.onBeforeCompile(w,e);var T=e.getRenderTarget();return{isWebGL2:i,shaderID:S,shaderName:w.name,uniforms:w.uniforms,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,defines:r.defines,isRawShaderMaterial:r.isRawShaderMaterial,isShaderMaterial:r.isShaderMaterial,precision:s,instancing:v.isInstancedMesh===!0,supportsVertexTextures:l,outputEncoding:T===null?e.outputEncoding:m(T.texture),map:!!r.map,mapEncoding:m(r.map),matcap:!!r.matcap,matcapEncoding:m(r.matcap),envMap:!!x,envMapMode:x&&x.mapping,envMapEncoding:m(x),envMapCubeUV:!!x&&(x.mapping===306||x.mapping===307),lightMap:!!r.lightMap,lightMapEncoding:m(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:m(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:r.normalMapType===1,tangentSpaceNormalMap:r.normalMapType===0,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!r.map||!!r.bumpMap||!!r.normalMap||!!r.specularMap||!!r.alphaMap||!!r.emissiveMap||!!r.roughnessMap||!!r.metalnessMap||!!r.clearcoatMap||!!r.clearcoatRoughnessMap||!!r.clearcoatNormalMap||!!r.displacementMap,uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap)&&!!r.displacementMap,fog:!!y,useFog:r.fog,fogExp2:y&&y.isFogExp2,flatShading:r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:a,skinning:r.skinning&&C>0,maxBones:C,useVertexTexture:o,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:c.directional.length,numPointLights:c.point.length,numSpotLights:c.spot.length,numRectAreaLights:c.rectArea.length,numHemiLights:c.hemi.length,numDirLightShadows:c.directionalShadowMap.length,numPointLightShadows:c.pointShadowMap.length,numSpotLightShadows:c.spotShadowMap.length,numClippingPlanes:g,numClipIntersection:_,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:r.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===2,flipSided:r.side===1,depthPacking:r.depthPacking===void 0?!1:r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:i||t.get(`EXT_frag_depth`)!==null,rendererExtensionDrawBuffers:i||t.get(`WEBGL_draw_buffers`)!==null,rendererExtensionShaderTextureLod:i||t.get(`EXT_shader_texture_lod`)!==null,onBeforeCompile:r.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),t.defines!==void 0)for(var r in t.defines)n.push(r),n.push(t.defines[r]);if(t.isRawShaderMaterial===void 0){for(var i=0;i<d.length;i++)n.push(t[d[i]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var i,a=0,o=r.length;a<o;a++){var s=r[a];if(s.cacheKey===n){i=s,++i.usedTimes;break}}return i===void 0&&(i=new Zt(e,n,t),r.push(i)),i},this.releaseProgram=function(e){if(--e.usedTimes===0){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r}function $t(){var e=new WeakMap;function t(t){var n=e.get(t);return n===void 0&&(n={},e.set(t,n)),n}function n(t){e.delete(t)}function r(t,n,r){e.get(t)[n]=r}function i(){e=new WeakMap}return{get:t,remove:n,update:r,dispose:i}}function en(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.program===t.program?e.material.id===t.material.id?e.z===t.z?e.id-t.id:e.z-t.z:e.material.id-t.material.id:e.program.id-t.program.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function tn(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function nn(){var e=[],t=0,n=[],r=[],i={id:-1};function a(){t=0,n.length=0,r.length=0}function o(n,r,a,o,s,c){var l=e[t];return l===void 0?(l={id:n.id,object:n,geometry:r,material:a,program:a.program||i,groupOrder:o,renderOrder:n.renderOrder,z:s,group:c},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=a,l.program=a.program||i,l.groupOrder=o,l.renderOrder=n.renderOrder,l.z=s,l.group=c),t++,l}function s(e,t,i,a,s,c){var l=o(e,t,i,a,s,c);(i.transparent===!0?r:n).push(l)}function c(e,t,i,a,s,c){var l=o(e,t,i,a,s,c);(i.transparent===!0?r:n).unshift(l)}function l(e,t){n.length>1&&n.sort(e||en),r.length>1&&r.sort(t||tn)}function u(){for(var n=t,r=e.length;n<r;n++){var i=e[n];if(i.id===null)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}}return{opaque:n,transparent:r,init:a,push:s,unshift:c,finish:u,sort:l}}function rn(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener(`dispose`,t),e.delete(r)}function n(n,r){var i=e.get(n),a;return i===void 0?(a=new nn,e.set(n,new WeakMap),e.get(n).set(r,a),n.addEventListener(`dispose`,t)):(a=i.get(r),a===void 0&&(a=new nn,i.set(r,a))),a}function r(){e=new WeakMap}return{get:n,dispose:r}}function an(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case`DirectionalLight`:n={direction:new D,color:new z};break;case`SpotLight`:n={position:new D,direction:new D,color:new z,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new D,color:new z,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new D,skyColor:new z,groundColor:new z};break;case`RectAreaLight`:n={color:new z,position:new D,halfWidth:new D,halfHeight:new D};break}return e[t.id]=n,n}}}function on(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case`DirectionalLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b};break;case`SpotLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b};break;case`PointLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}function sn(e,t){return!!t.castShadow-+!!e.castShadow}function cn(){for(var e=new an,t=on(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)n.probe.push(new D);var i=new D,a=new O,o=new O;function s(r,s,c){for(var l=0,u=0,d=0,f=0;f<9;f++)n.probe[f].set(0,0,0);var p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=c.matrixWorldInverse;r.sort(sn);for(var f=0,S=r.length;f<S;f++){var C=r[f],w=C.color,T=C.intensity,E=C.distance,D=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)l+=w.r*T,u+=w.g*T,d+=w.b*T;else if(C.isLightProbe)for(var O=0;O<9;O++)n.probe[O].addScaledVector(C.sh.coefficients[O],T);else if(C.isDirectionalLight){var k=e.get(C);if(k.color.copy(C.color).multiplyScalar(C.intensity),k.direction.setFromMatrixPosition(C.matrixWorld),i.setFromMatrixPosition(C.target.matrixWorld),k.direction.sub(i),k.direction.transformDirection(x),C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,n.directionalShadow[p]=j,n.directionalShadowMap[p]=D,n.directionalShadowMatrix[p]=C.shadow.matrix,v++}n.directional[p]=k,p++}else if(C.isSpotLight){var k=e.get(C);if(k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),k.color.copy(w).multiplyScalar(T),k.distance=E,k.direction.setFromMatrixPosition(C.matrixWorld),i.setFromMatrixPosition(C.target.matrixWorld),k.direction.sub(i),k.direction.transformDirection(x),k.coneCos=Math.cos(C.angle),k.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),k.decay=C.decay,C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,n.spotShadow[h]=j,n.spotShadowMap[h]=D,n.spotShadowMatrix[h]=C.shadow.matrix,b++}n.spot[h]=k,h++}else if(C.isRectAreaLight){var k=e.get(C);k.color.copy(w).multiplyScalar(T),k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),o.identity(),a.copy(C.matrixWorld),a.premultiply(x),o.extractRotation(a),k.halfWidth.set(C.width*.5,0,0),k.halfHeight.set(0,C.height*.5,0),k.halfWidth.applyMatrix4(o),k.halfHeight.applyMatrix4(o),n.rectArea[g]=k,g++}else if(C.isPointLight){var k=e.get(C);if(k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),k.color.copy(C.color).multiplyScalar(C.intensity),k.distance=C.distance,k.decay=C.decay,C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,j.shadowCameraNear=A.camera.near,j.shadowCameraFar=A.camera.far,n.pointShadow[m]=j,n.pointShadowMap[m]=D,n.pointShadowMatrix[m]=C.shadow.matrix,y++}n.point[m]=k,m++}else if(C.isHemisphereLight){var k=e.get(C);k.direction.setFromMatrixPosition(C.matrixWorld),k.direction.transformDirection(x),k.direction.normalize(),k.skyColor.copy(C.color).multiplyScalar(T),k.groundColor.copy(C.groundColor).multiplyScalar(T),n.hemi[_]=k,_++}}n.ambient[0]=l,n.ambient[1]=u,n.ambient[2]=d;var M=n.hash;(M.directionalLength!==p||M.pointLength!==m||M.spotLength!==h||M.rectAreaLength!==g||M.hemiLength!==_||M.numDirectionalShadows!==v||M.numPointShadows!==y||M.numSpotShadows!==b)&&(n.directional.length=p,n.spot.length=h,n.rectArea.length=g,n.point.length=m,n.hemi.length=_,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=y,n.pointShadowMap.length=y,n.spotShadow.length=b,n.spotShadowMap.length=b,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=y,n.spotShadowMatrix.length=b,M.directionalLength=p,M.pointLength=m,M.spotLength=h,M.rectAreaLength=g,M.hemiLength=_,M.numDirectionalShadows=v,M.numPointShadows=y,M.numSpotShadows=b,n.version=wu++)}return{setup:s,state:n}}function ln(){var e=new cn,t=[],n=[];function r(){t.length=0,n.length=0}function i(e){t.push(e)}function a(e){n.push(e)}function o(r){e.setup(t,n,r)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:o,pushLight:i,pushShadow:a}}function un(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener(`dispose`,t),e.delete(r)}function n(n,r){var i;return e.has(n)===!1?(i=new ln,e.set(n,new WeakMap),e.get(n).set(r,i),n.addEventListener(`dispose`,t)):e.get(n).has(r)===!1?(i=new ln,e.get(n).set(r,i)):i=e.get(n).get(r),i}function r(){e=new WeakMap}return{get:n,dispose:r}}function dn(e){V.call(this),this.type=`MeshDepthMaterial`,this.depthPacking=sc,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function fn(e){V.call(this),this.type=`MeshDistanceMaterial`,this.referencePosition=new D,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}function pn(e,t,n){var r=new Se,i=new b,a=new b,o=new C,s=[],c=[],l={},u={0:1,1:0,2:2},d=new ge({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new b},radius:{value:4}},vertexShader:Eu,fragmentShader:Tu}),f=d.clone();f.defines.HORIZONAL_PASS=1;var p=new q;p.setAttribute(`position`,new H(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new de(p,d),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,c){if(h.enabled!==!1&&!(h.autoUpdate===!1&&h.needsUpdate===!1)&&t.length!==0){var l=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);for(var p=0,m=t.length;p<m;p++){var _=t[p],v=_.shadow;if(v===void 0){console.warn(`THREE.WebGLShadowMap:`,_,`has no shadow.`);continue}i.copy(v.mapSize);var y=v.getFrameExtents();if(i.multiply(y),a.copy(v.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(a.x=Math.floor(n/y.x),i.x=a.x*y.x,v.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/y.y),i.y=a.y*y.y,v.mapSize.y=a.y)),v.map===null&&!v.isPointLightShadow&&this.type===3){var b={minFilter:Ko,magFilter:Ko,format:es};v.map=new w(i.x,i.y,b),v.map.texture.name=_.name+`.shadowMap`,v.mapPass=new w(i.x,i.y,b),v.camera.updateProjectionMatrix()}if(v.map===null){var b={minFilter:Uo,magFilter:Uo,format:es};v.map=new w(i.x,i.y,b),v.map.texture.name=_.name+`.shadowMap`,v.camera.updateProjectionMatrix()}e.setRenderTarget(v.map),e.clear();for(var S=v.getViewportCount(),C=0;C<S;C++){var T=v.getViewport(C);o.set(a.x*T.x,a.y*T.y,a.x*T.z,a.y*T.w),f.viewport(o),v.updateMatrices(_,C),r=v.getFrustum(),x(s,c,v.camera,_,this.type)}!v.isPointLightShadow&&this.type===3&&g(v,c)}h.needsUpdate=!1,e.setRenderTarget(l,u,d)}};function g(n,r){var i=t.update(m);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,d,m,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,f,m,null)}function _(e,t,n){var r=e<<0|t<<1|n<<2,i=s[r];return i===void 0&&(i=new dn({depthPacking:cc,morphTargets:e,skinning:t}),s[r]=i),i}function v(e,t,n){var r=e<<0|t<<1|n<<2,i=c[r];return i===void 0&&(i=new fn({morphTargets:e,skinning:t}),c[r]=i),i}function y(t,n,r,i,a,o,s){var c=null,d=_,f=t.customDepthMaterial;if(i.isPointLight===!0&&(d=v,f=t.customDistanceMaterial),f===void 0){var p=!1;r.morphTargets===!0&&(p=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var m=!1;t.isSkinnedMesh===!0&&(r.skinning===!0?m=!0:console.warn(`THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:`,t));var h=t.isInstancedMesh===!0;c=d(p,m,h)}else c=f;if(e.localClippingEnabled&&r.clipShadows===!0&&r.clippingPlanes.length!==0){var g=c.uuid,y=r.uuid,b=l[g];b===void 0&&(b={},l[g]=b);var x=b[y];x===void 0&&(x=c.clone(),b[y]=x),c=x}return c.visible=r.visible,c.wireframe=r.wireframe,s===3?c.side=r.shadowSide===null?r.side:r.shadowSide:c.side=r.shadowSide===null?u[r.side]:r.shadowSide,c.clipShadows=r.clipShadows,c.clippingPlanes=r.clippingPlanes,c.clipIntersection=r.clipIntersection,c.wireframeLinewidth=r.wireframeLinewidth,c.linewidth=r.linewidth,i.isPointLight===!0&&c.isMeshDistanceMaterial===!0&&(c.referencePosition.setFromMatrixPosition(i.matrixWorld),c.nearDistance=a,c.farDistance=o),c}function x(n,i,a,o,s){if(n.visible!==!1){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var c=t.update(n),l=n.material;if(Array.isArray(l))for(var u=c.groups,d=0,f=u.length;d<f;d++){var p=u[d],m=l[p.materialIndex];if(m&&m.visible){var h=y(n,c,m,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,h,n,p)}}else if(l.visible){var h=y(n,c,l,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,h,n,null)}}for(var g=n.children,_=0,v=g.length;_<v;_++)x(g[_],i,a,o,s)}}}function mn(e,t,n){var r=n.isWebGL2;function i(){var t=!1,n=new C,r=null,i=new C(0,0,0,0);return{setMask:function(n){r!==n&&!t&&(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){s===!0&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),i.equals(n)===!1&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}}function a(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?H(2929):U(2929)},setMask:function(r){n!==r&&!t&&(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}}function o(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){t||(e?H(2960):U(2960))},setMask:function(r){n!==r&&!t&&(e.stencilMask(r),n=r)},setFunc:function(t,n,o){(r!==t||i!==n||a!==o)&&(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){(o!==t||s!==n||c!==r)&&(e.stencilOp(t,n,r),o=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}}var s=new i,c=new a,l=new o,u=e.getParameter(34921),d=new Uint8Array(u),f=new Uint8Array(u),p=new Uint8Array(u),m={},h=null,g=null,_=null,v=null,y=null,b=null,x=null,S=null,w=null,T=!1,E=null,D=null,O=null,k=null,A=null,j=e.getParameter(35661),M=!1,N=0,P=e.getParameter(7938);P.indexOf(`WebGL`)===-1?P.indexOf(`OpenGL ES`)!==-1&&(N=parseFloat(/^OpenGL\\ ES\\ ([0-9])/.exec(P)[1]),M=N>=2):(N=parseFloat(/^WebGL\\ ([0-9])/.exec(P)[1]),M=N>=1);var F=null,I={},L=new C,R=new C;function z(t,n,r){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<r;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var ee={};ee[3553]=z(3553,3553,1),ee[34067]=z(34067,34069,6),s.setClear(0,0,0,1),c.setClear(1),l.setClear(0),H(2929),c.setFunc(3),K(!1),ce(1),H(2884),oe(0);function te(){for(var e=0,t=d.length;e<t;e++)d[e]=0}function ne(e){B(e,0)}function B(n,i){d[n]=1,f[n]===0&&(e.enableVertexAttribArray(n),f[n]=1),p[n]!==i&&((r?e:t.get(`ANGLE_instanced_arrays`))[r?`vertexAttribDivisor`:`vertexAttribDivisorANGLE`](n,i),p[n]=i)}function V(){for(var t=0,n=f.length;t!==n;++t)f[t]!==d[t]&&(e.disableVertexAttribArray(t),f[t]=0)}function re(t,n,i,a,o,s){r===!0&&(i===5124||i===5125)?e.vertexAttribIPointer(t,n,i,a,o,s):e.vertexAttribPointer(t,n,i,a,o,s)}function H(t){m[t]!==!0&&(e.enable(t),m[t]=!0)}function U(t){m[t]!==!1&&(e.disable(t),m[t]=!1)}function ie(t){return h===t?!1:(e.useProgram(t),h=t,!0)}var W={100:32774,101:32778,102:32779};if(r)W[103]=32775,W[104]=32776;else{var ae=t.get(`EXT_blend_minmax`);ae!==null&&(W[103]=ae.MIN_EXT,W[104]=ae.MAX_EXT)}var G={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function oe(t,n,r,i,a,o,s,c){if(t===0){g&&(U(3042),g=!1);return}if(g||(H(3042),g=!0),t!==5){if(t!==_||c!==T){if((v!==100||x!==100)&&(e.blendEquation(32774),v=100,x=100),c)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error(`THREE.WebGLState: Invalid blending: `,t);break}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error(`THREE.WebGLState: Invalid blending: `,t);break}y=null,b=null,S=null,w=null,_=t,T=c}return}a=a||n,o=o||r,s=s||i,(n!==v||a!==x)&&(e.blendEquationSeparate(W[n],W[a]),v=n,x=a),(r!==y||i!==b||o!==S||s!==w)&&(e.blendFuncSeparate(G[r],G[i],G[o],G[s]),y=r,b=i,S=o,w=s),_=t,T=null}function se(e,t){e.side===2?U(2884):H(2884);var n=e.side===1;t&&(n=!n),K(n),e.blending===1&&e.transparent===!1?oe(0):oe(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),c.setFunc(e.depthFunc),c.setTest(e.depthTest),c.setMask(e.depthWrite),s.setMask(e.colorWrite);var r=e.stencilWrite;l.setTest(r),r&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),ue(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function K(t){E!==t&&(t?e.frontFace(2304):e.frontFace(2305),E=t)}function ce(t){t===0?U(2884):(H(2884),t!==D&&(t===1?e.cullFace(1029):t===2?e.cullFace(1028):e.cullFace(1032))),D=t}function le(t){t!==O&&(M&&e.lineWidth(t),O=t)}function ue(t,n,r){t?(H(32823),(k!==n||A!==r)&&(e.polygonOffset(n,r),k=n,A=r)):U(32823)}function q(e){e?H(3089):U(3089)}function de(t){t===void 0&&(t=33984+j-1),F!==t&&(e.activeTexture(t),F=t)}function fe(t,n){F===null&&de();var r=I[F];r===void 0&&(r={type:void 0,texture:void 0},I[F]=r),(r.type!==t||r.texture!==n)&&(e.bindTexture(t,n||ee[t]),r.type=t,r.texture=n)}function pe(){var t=I[F];t!==void 0&&t.type!==void 0&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)}function J(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function me(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function he(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function ge(t){L.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),L.copy(t))}function _e(t){R.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),R.copy(t))}function ve(){for(var t=0;t<f.length;t++)f[t]===1&&(e.disableVertexAttribArray(t),f[t]=0);m={},F=null,I={},h=null,_=null,E=null,D=null,s.reset(),c.reset(),l.reset()}return{buffers:{color:s,depth:c,stencil:l},initAttributes:te,enableAttribute:ne,enableAttributeAndDivisor:B,disableUnusedAttributes:V,vertexAttribPointer:re,enable:H,disable:U,useProgram:ie,setBlending:oe,setMaterial:se,setFlipSided:K,setCullFace:ce,setLineWidth:le,setPolygonOffset:ue,setScissorTest:q,activeTexture:de,bindTexture:fe,unbindTexture:pe,compressedTexImage2D:J,texImage2D:me,texImage3D:he,scissor:ge,viewport:_e,reset:ve}}function hn(e,t,n,r,i,a,o){var s=i.isWebGL2,c=i.maxTextures,l=i.maxCubemapSize,u=i.maxTextureSize,d=i.maxSamples,f=new WeakMap,p,m=!1;try{m=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch(e){}function h(e,t){return m?new OffscreenCanvas(e,t):document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`)}function g(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||t===!0)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){var a=t?X.floorPowerOfTwo:Math.floor,o=a(i*e.width),s=a(i*e.height);p===void 0&&(p=h(o,s));var c=n?h(o,s):p;return c.width=o,c.height=s,c.getContext(`2d`).drawImage(e,0,0,o,s),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+e.width+`x`+e.height+`) to (`+o+`x`+s+`).`),c}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+e.width+`x`+e.height+`).`),e;return e}function _(e){return X.isPowerOfTwo(e.width)&&X.isPowerOfTwo(e.height)}function v(e){return s?!1:e.wrapS!==1001||e.wrapT!==1001||e.minFilter!==1003&&e.minFilter!==1006}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==1003&&e.minFilter!==1006}function b(t,n,i,a){e.generateMipmap(t);var o=r.get(n);o.__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function x(n,r,i){if(s===!1)return r;if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'`+n+`\'`)}var a=r;return r===6403&&(i===5126&&(a=33326),i===5131&&(a=33325),i===5121&&(a=33321)),r===6407&&(i===5126&&(a=34837),i===5131&&(a=34843),i===5121&&(a=32849)),r===6408&&(i===5126&&(a=34836),i===5131&&(a=34842),i===5121&&(a=32856)),(a===33325||a===33326||a===34842||a===34836)&&t.get(`EXT_color_buffer_float`),a}function S(e){return e===1003||e===1004||e===1005?9728:9729}function C(e){var t=e.target;t.removeEventListener(`dispose`,C),T(t),t.isVideoTexture&&f.delete(t),o.memory.textures--}function w(e){var t=e.target;t.removeEventListener(`dispose`,w),E(t),o.memory.textures--}function T(t){var n=r.get(t);n.__webglInit!==void 0&&(e.deleteTexture(n.__webglTexture),r.remove(t))}function E(t){var n=r.get(t),i=r.get(t.texture);if(t){if(i.__webglTexture!==void 0&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(t.texture),r.remove(t)}}var D=0;function O(){D=0}function k(){var e=D;return e>=c&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+c),D+=1,e}function A(e,t){var i=r.get(e);if(e.isVideoTexture&&ie(e),e.version>0&&i.__version!==e.version){var a=e.image;if(a===void 0)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is undefined`);else if(a.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{z(i,e,t);return}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function j(e,t){var i=r.get(e);if(e.version>0&&i.__version!==e.version){z(i,e,t);return}n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture)}function M(e,t){var i=r.get(e);if(e.version>0&&i.__version!==e.version){z(i,e,t);return}n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture)}function N(t,i){if(t.image.length===6){var o=r.get(t);if(t.version>0&&o.__version!==t.version){R(o,t),n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var c=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),u=t.image[0]&&t.image[0].isDataTexture,d=[],f=0;f<6;f++)!c&&!u?d[f]=g(t.image[f],!1,!0,l):d[f]=u?t.image[f].image:t.image[f];var p=d[0],m=_(p)||s,h=a.convert(t.format),v=a.convert(t.type),S=x(t.internalFormat,h,v);L(34067,t,m);var C;if(c){for(var f=0;f<6;f++){C=d[f].mipmaps;for(var w=0;w<C.length;w++){var T=C[w];t.format!==1023&&t.format!==1022?h===null?console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()`):n.compressedTexImage2D(34069+f,w,S,T.width,T.height,0,T.data):n.texImage2D(34069+f,w,S,T.width,T.height,0,h,v,T.data)}}o.__maxMipLevel=C.length-1}else{C=t.mipmaps;for(var f=0;f<6;f++)if(u){n.texImage2D(34069+f,0,S,d[f].width,d[f].height,0,h,v,d[f].data);for(var w=0;w<C.length;w++){var T=C[w],E=T.image[f].image;n.texImage2D(34069+f,w+1,S,E.width,E.height,0,h,v,E.data)}}else{n.texImage2D(34069+f,0,S,h,v,d[f]);for(var w=0;w<C.length;w++){var T=C[w];n.texImage2D(34069+f,w+1,S,h,v,T.image[f])}}o.__maxMipLevel=C.length}y(t,m)&&b(34067,t,p.width,p.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture)}}function P(e,t){n.activeTexture(33984+t),n.bindTexture(34067,r.get(e).__webglTexture)}var F={[Bo]:10497,[Vo]:33071,[Ho]:33648},I={[Uo]:9728,[Wo]:9984,[Go]:9986,[Ko]:9729,[qo]:9985,[Jo]:9987};function L(n,a,o){o?(e.texParameteri(n,10242,F[a.wrapS]),e.texParameteri(n,10243,F[a.wrapT]),(n===32879||n===35866)&&e.texParameteri(n,32882,F[a.wrapR]),e.texParameteri(n,10240,I[a.magFilter]),e.texParameteri(n,10241,I[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),(n===32879||n===35866)&&e.texParameteri(n,32882,33071),(a.wrapS!==1001||a.wrapT!==1001)&&console.warn(`THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.`),e.texParameteri(n,10240,S(a.magFilter)),e.texParameteri(n,10241,S(a.minFilter)),a.minFilter!==1003&&a.minFilter!==1006&&console.warn(`THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.`));var c=t.get(`EXT_texture_filter_anisotropic`);if(c){if(a.type===1015&&t.get(`OES_texture_float_linear`)===null||a.type===1016&&(s||t.get(`OES_texture_half_float_linear`))===null)return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function R(t,n){t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,C),t.__webglTexture=e.createTexture(),o.memory.textures++)}function z(t,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),R(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);var c=v(r)&&_(r.image)===!1,l=g(r.image,c,!1,u),d=_(l)||s,f=a.convert(r.format),p=a.convert(r.type),m=x(r.internalFormat,f,p);L(o,r,d);var h,S=r.mipmaps;if(r.isDepthTexture)m=6402,s?m=r.type===1015?36012:r.type===1014?33190:r.type===1020?35056:33189:r.type===1015&&console.error(`WebGLRenderer: Floating point depth texture requires WebGL2.`),r.format===1026&&m===6402&&r.type!==1012&&r.type!==1014&&(console.warn(`THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.`),r.type=Xo,p=a.convert(r.type)),r.format===1027&&m===6402&&(m=34041,r.type!==1020&&(console.warn(`THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.`),r.type=Qo,p=a.convert(r.type))),n.texImage2D(3553,0,m,l.width,l.height,0,f,p,null);else if(r.isDataTexture)if(S.length>0&&d){for(var C=0,w=S.length;C<w;C++)h=S[C],n.texImage2D(3553,C,m,h.width,h.height,0,f,p,h.data);r.generateMipmaps=!1,t.__maxMipLevel=S.length-1}else n.texImage2D(3553,0,m,l.width,l.height,0,f,p,l.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(var C=0,w=S.length;C<w;C++)h=S[C],r.format!==1023&&r.format!==1022?f===null?console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`):n.compressedTexImage2D(3553,C,m,h.width,h.height,0,h.data):n.texImage2D(3553,C,m,h.width,h.height,0,f,p,h.data);t.__maxMipLevel=S.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,m,l.width,l.height,l.depth,0,f,p,l.data),t.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,m,l.width,l.height,l.depth,0,f,p,l.data),t.__maxMipLevel=0;else if(S.length>0&&d){for(var C=0,w=S.length;C<w;C++)h=S[C],n.texImage2D(3553,C,m,f,p,h);r.generateMipmaps=!1,t.__maxMipLevel=S.length-1}else n.texImage2D(3553,0,m,f,p,l),t.__maxMipLevel=0;y(r,d)&&b(o,r,l.width,l.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function ee(t,i,o,s){var c=a.convert(i.texture.format),l=a.convert(i.texture.type),u=x(i.texture.internalFormat,c,l);n.texImage2D(s,0,u,i.width,i.height,0,c,l,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function te(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===1015?i=36012:o.type===1014&&(i=33190));var s=U(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(r){var s=U(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var c=a.convert(n.texture.format),l=a.convert(n.texture.type),i=x(n.texture.internalFormat,c,l);if(r){var s=U(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height)}e.bindRenderbuffer(36161,null)}function ne(t,n){if(n&&n.isWebGLCubeRenderTarget)throw Error(`Depth Texture with cube render targets is not supported`);if(e.bindFramebuffer(36160,t),!(n.depthTexture&&n.depthTexture.isDepthTexture))throw Error(`renderTarget.depthTexture must be an instance of THREE.DepthTexture`);(!r.get(n.depthTexture).__webglTexture||n.depthTexture.image.width!==n.width||n.depthTexture.image.height!==n.height)&&(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),A(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===1026)e.framebufferTexture2D(36160,36096,3553,i,0);else if(n.depthTexture.format===1027)e.framebufferTexture2D(36160,33306,3553,i,0);else throw Error(`Unknown depthTexture format`)}function B(t){var n=r.get(t),i=t.isWebGLCubeRenderTarget===!0;if(t.depthTexture){if(i)throw Error(`target.depthTexture not supported in Cube render targets`);ne(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),te(n.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),te(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function V(t){var i=r.get(t),c=r.get(t.texture);t.addEventListener(`dispose`,w),c.__webglTexture=e.createTexture(),o.memory.textures++;var l=t.isWebGLCubeRenderTarget===!0,u=t.isWebGLMultisampleRenderTarget===!0,d=_(t)||s;if(s&&t.texture.format===1022&&(t.texture.type===1015||t.texture.type===1016)&&(t.texture.format=es,console.warn(`THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.`)),l){i.__webglFramebuffer=[];for(var f=0;f<6;f++)i.__webglFramebuffer[f]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),u)if(s){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);var p=a.convert(t.texture.format),m=a.convert(t.texture.type),h=x(t.texture.internalFormat,p,m),g=U(t);e.renderbufferStorageMultisample(36161,g,h,t.width,t.height),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(i.__webglDepthRenderbuffer=e.createRenderbuffer(),te(i.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn(`THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.`);if(l){n.bindTexture(34067,c.__webglTexture),L(34067,t.texture,d);for(var f=0;f<6;f++)ee(i.__webglFramebuffer[f],t,36064,34069+f);y(t.texture,d)&&b(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,c.__webglTexture),L(3553,t.texture,d),ee(i.__webglFramebuffer,t,36064,3553),y(t.texture,d)&&b(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&B(t)}function re(e){var t=e.texture;if(y(t,_(e)||s)){var i=e.isWebGLCubeRenderTarget?34067:3553,a=r.get(t).__webglTexture;n.bindTexture(i,a),b(i,t,e.width,e.height),n.bindTexture(i,null)}}function H(t){if(t.isWebGLMultisampleRenderTarget)if(s){var n=r.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var i=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn(`THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.`)}function U(e){return s&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}function ie(e){var t=o.render.frame;f.get(e)!==t&&(f.set(e,t),e.update())}var W=!1,ae=!1;function G(e,t){e&&e.isWebGLRenderTarget&&(W===!1&&(console.warn(`THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.`),W=!0),e=e.texture),A(e,t)}function oe(e,t){e&&e.isWebGLCubeRenderTarget&&(ae===!1&&(console.warn(`THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.`),ae=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&e.image.length===6?N(e,t):P(e,t)}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=A,this.setTexture2DArray=j,this.setTexture3D=M,this.setTextureCube=N,this.setTextureCubeDynamic=P,this.setupRenderTarget=V,this.updateRenderTargetMipmap=re,this.updateMultisampleRenderTarget=H,this.safeSetTexture2D=G,this.safeSetTextureCube=oe}function gn(e,t,n){var r=n.isWebGL2;function i(e){var n;if(e===1009)return 5121;if(e===1017)return 32819;if(e===1018)return 32820;if(e===1019)return 33635;if(e===1010)return 5120;if(e===1011)return 5122;if(e===1012)return 5123;if(e===1013)return 5124;if(e===1014)return 5125;if(e===1015)return 5126;if(e===1016)return r?5131:(n=t.get(`OES_texture_half_float`),n===null?null:n.HALF_FLOAT_OES);if(e===1021)return 6406;if(e===1022)return 6407;if(e===1023)return 6408;if(e===1024)return 6409;if(e===1025)return 6410;if(e===1026)return 6402;if(e===1027)return 34041;if(e===1028)return 6403;if(e===1029)return 36244;if(e===1030)return 33319;if(e===1031)return 33320;if(e===1032)return 36248;if(e===1033)return 36249;if(e===33776||e===33777||e===33778||e===33779)if(n=t.get(`WEBGL_compressed_texture_s3tc`),n!==null){if(e===33776)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===33777)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===33778)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===33779)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===35840||e===35841||e===35842||e===35843)if(n=t.get(`WEBGL_compressed_texture_pvrtc`),n!==null){if(e===35840)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===35841)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===35842)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===35843)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===36196)return n=t.get(`WEBGL_compressed_texture_etc1`),n===null?null:n.COMPRESSED_RGB_ETC1_WEBGL;if((e===37492||e===37496)&&(n=t.get(`WEBGL_compressed_texture_etc`),n!==null)){if(e===37492)return n.COMPRESSED_RGB8_ETC2;if(e===37496)return n.COMPRESSED_RGBA8_ETC2_EAC}if(e===37808||e===37809||e===37810||e===37811||e===37812||e===37813||e===37814||e===37815||e===37816||e===37817||e===37818||e===37819||e===37820||e===37821||e===37840||e===37841||e===37842||e===37843||e===37844||e===37845||e===37846||e===37847||e===37848||e===37849||e===37850||e===37851||e===37852||e===37853)return n=t.get(`WEBGL_compressed_texture_astc`),n===null?null:e;if(e===36492)return n=t.get(`EXT_texture_compression_bptc`),n===null?null:e;if(e===1020)return r?34042:(n=t.get(`WEBGL_depth_texture`),n===null?null:n.UNSIGNED_INT_24_8_WEBGL)}return{convert:i}}function _n(e){ve.call(this),this.cameras=e||[]}function vn(){j.call(this),this.type=`Group`}function yn(){this._targetRay=null,this._grip=null}function bn(e,t){var n=this,r=null,i=1,a=null,o=`local-floor`,s=null,c=[],l=new Map,u=new ve;u.layers.enable(1),u.viewport=new C;var d=new ve;d.layers.enable(2),d.viewport=new C;var f=[u,d],p=new _n;p.layers.enable(1),p.layers.enable(2);var m=null,h=null;this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=c[e];return t===void 0&&(t=new yn,c[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=c[e];return t===void 0&&(t=new yn,c[e]=t),t.getGripSpace()};function g(e){var t=l.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function _(){l.forEach(function(e,t){e.disconnect(t)}),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),O.stop(),n.isPresenting=!1,n.dispatchEvent({type:`sessionend`})}function v(e){a=e,O.setContext(r),O.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&console.warn(`THREE.WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&console.warn(`THREE.WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return a},this.getSession=function(){return r},this.setSession=function(e){if(r=e,r!==null){r.addEventListener(`select`,g),r.addEventListener(`selectstart`,g),r.addEventListener(`selectend`,g),r.addEventListener(`squeeze`,g),r.addEventListener(`squeezestart`,g),r.addEventListener(`squeezeend`,g),r.addEventListener(`end`,_);var n=t.getContextAttributes();n.xrCompatible!==!0&&t.makeXRCompatible();var a={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:i},s=new XRWebGLLayer(r,t,a);r.updateRenderState({baseLayer:s}),r.requestReferenceSpace(o).then(v),r.addEventListener(`inputsourceschange`,y)}};function y(e){for(var t=r.inputSources,n=0;n<c.length;n++)l.set(t[n],c[n]);for(var n=0;n<e.removed.length;n++){var i=e.removed[n],a=l.get(i);a&&(a.dispatchEvent({type:`disconnected`,data:i}),l.delete(i))}for(var n=0;n<e.added.length;n++){var i=e.added[n],a=l.get(i);a&&a.dispatchEvent({type:`connected`,data:i})}}var b=new D,x=new D;function S(e,t,n){b.setFromMatrixPosition(t.matrixWorld),x.setFromMatrixPosition(n.matrixWorld);var r=b.distanceTo(x),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+m,_=s+m,v=f-h,y=p+(r-h),S=c*s/_*g,C=l*s/_*g;e.projectionMatrix.makePerspective(v,y,S,C,g,_)}function w(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){p.near=d.near=u.near=e.near,p.far=d.far=u.far=e.far,(m!==p.near||h!==p.far)&&(r.updateRenderState({depthNear:p.near,depthFar:p.far}),m=p.near,h=p.far);var t=e.parent,n=p.cameras;w(p,t);for(var i=0;i<n.length;i++)w(n[i],t);e.matrixWorld.copy(p.matrixWorld);for(var a=e.children,i=0,o=a.length;i<o;i++)a[i].updateMatrixWorld(!0);return n.length===2?S(p,u,d):p.projectionMatrix.copy(u.projectionMatrix),p};var T=null;function E(t,n){if(s=n.getViewerPose(a),s!==null){var i=s.views,o=r.renderState.baseLayer;e.setFramebuffer(o.framebuffer);var l=!1;i.length!==p.cameras.length&&(p.cameras.length=0,l=!0);for(var u=0;u<i.length;u++){var d=i[u],m=o.getViewport(d),h=f[u];h.matrix.fromArray(d.transform.matrix),h.projectionMatrix.fromArray(d.projectionMatrix),h.viewport.set(m.x,m.y,m.width,m.height),u===0&&p.matrix.copy(h.matrix),l===!0&&p.cameras.push(h)}}for(var g=r.inputSources,u=0;u<c.length;u++){var _=c[u],v=g[u];_.update(v,n,a)}T&&T(t,n)}var O=new Ce;O.setAnimationLoop(E),this.setAnimationLoop=function(e){T=e},this.dispose=function(){}}function xn(e){function t(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}function n(e,t,n,_,v){t.isMeshBasicMaterial?r(e,t):t.isMeshLambertMaterial?(r(e,t),c(e,t)):t.isMeshToonMaterial?(r(e,t),u(e,t)):t.isMeshPhongMaterial?(r(e,t),l(e,t)):t.isMeshStandardMaterial?(r(e,t,n),t.isMeshPhysicalMaterial?f(e,t,n):d(e,t,n)):t.isMeshMatcapMaterial?(r(e,t),p(e,t)):t.isMeshDepthMaterial?(r(e,t),m(e,t)):t.isMeshDistanceMaterial?(r(e,t),h(e,t)):t.isMeshNormalMaterial?(r(e,t),g(e,t)):t.isLineBasicMaterial?(i(e,t),t.isLineDashedMaterial&&a(e,t)):t.isPointsMaterial?o(e,t,_,v):t.isSpriteMaterial?s(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function r(t,n,r){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var i=n.envMap||r;i&&(t.envMap.value=i,t.flipEnvMap.value=i.isCubeTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,t.maxMipLevel.value=e.get(i).__maxMipLevel),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity);var a;n.map?a=n.map:n.specularMap?a=n.specularMap:n.displacementMap?a=n.displacementMap:n.normalMap?a=n.normalMap:n.bumpMap?a=n.bumpMap:n.roughnessMap?a=n.roughnessMap:n.metalnessMap?a=n.metalnessMap:n.alphaMap?a=n.alphaMap:n.emissiveMap&&(a=n.emissiveMap),a!==void 0&&(a.isWebGLRenderTarget&&(a=a.texture),a.matrixAutoUpdate===!0&&a.updateMatrix(),t.uvTransform.value.copy(a.matrix));var o;n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),o!==void 0&&(o.isWebGLRenderTarget&&(o=o.texture),o.matrixAutoUpdate===!0&&o.updateMatrix(),t.uv2Transform.value.copy(o.matrix))}function i(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}function a(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function o(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=r*.5,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap);var i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap),i!==void 0&&(i.matrixAutoUpdate===!0&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}function s(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),n!==void 0&&(n.matrixAutoUpdate===!0&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function c(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function l(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function d(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}function f(e,t,n){d(e,t,n),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen),t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===1&&e.clearcoatNormalScale.value.negate()),e.transparency.value=t.transparency}function p(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function m(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function h(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}function g(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}return{refreshFogUniforms:t,refreshMaterialUniforms:n}}function Sn(e){e=e||{};var t=e.canvas===void 0?document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`):e.canvas,n=e.context===void 0?null:e.context,r=e.alpha===void 0?!1:e.alpha,i=e.depth===void 0?!0:e.depth,a=e.stencil===void 0?!0:e.stencil,o=e.antialias===void 0?!1:e.antialias,s=e.premultipliedAlpha===void 0?!0:e.premultipliedAlpha,c=e.preserveDrawingBuffer===void 0?!1:e.preserveDrawingBuffer,l=e.powerPreference===void 0?`default`:e.powerPreference,u=e.failIfMajorPerformanceCaveat===void 0?!1:e.failIfMajorPerformanceCaveat,d=null,f=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=$s,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var p=this,m=!1,h=null,g=0,_=0,v=null,y=null,x=-1,S={geometry:null,program:null,wireframe:!1},w=null,T=null,E=new C,k=new C,A=null,j=t.width,N=t.height,P=1,F=null,I=null,L=new C(0,0,j,N),R=new C(0,0,j,N),z=!1,ee=new Se,te=new Ae,ne=!1,B=!1,V=new O,re=new D;function H(){return v===null?P:1}var U;try{var ie={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(t.addEventListener(`webglcontextlost`,Te,!1),t.addEventListener(`webglcontextrestored`,Ee,!1),U=n||t.getContext(`webgl`,ie)||t.getContext(`experimental-webgl`,ie),U===null)throw t.getContext(`webgl`)===null?Error(`Error creating WebGL context.`):Error(`Error creating WebGL context with your selected attributes.`);U.getShaderPrecisionFormat===void 0&&(U.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}var W,ae,G,oe,se,K,ce,le,ue,q,de,fe,pe,J,me,he,ge,_e;function ve(){W=new je(U),ae=new ke(U,W,e),ae.isWebGL2===!1&&(W.get(`WEBGL_depth_texture`),W.get(`OES_texture_float`),W.get(`OES_texture_half_float`),W.get(`OES_texture_half_float_linear`),W.get(`OES_standard_derivatives`),W.get(`OES_element_index_uint`),W.get(`ANGLE_instanced_arrays`)),W.get(`OES_texture_float_linear`),_e=new gn(U,W,ae),G=new mn(U,W,ae),G.scissor(k.copy(R).multiplyScalar(P).floor()),G.viewport(E.copy(L).multiplyScalar(P).floor()),oe=new Pe(U),se=new $t,K=new hn(U,W,G,se,ae,_e,oe),ce=new we(U,ae),le=new Me(U,ce,oe),ue=new Le(U,le,ce,oe),me=new Ie(U),q=new Qt(p,W,ae),de=new xn(se),fe=new rn,pe=new un,J=new De(p,G,ue,s),he=new Oe(U,W,oe,ae),ge=new Ne(U,W,oe,ae),oe.programs=q.programs,p.capabilities=ae,p.extensions=W,p.properties=se,p.renderLists=fe,p.state=G,p.info=oe}ve();var ye=new bn(p,U);this.xr=ye;var be=new pn(p,ue,ae.maxTextureSize);this.shadowMap=be,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){var e=W.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){var e=W.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(e){e!==void 0&&(P=e,this.setSize(j,N,!1))},this.getSize=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getsize() now requires a Vector2 as an argument`),e=new b),e.set(j,N)},this.setSize=function(e,n,r){if(ye.isPresenting){console.warn(`THREE.WebGLRenderer: Can\'t change size while VR device is presenting.`);return}j=e,N=n,t.width=Math.floor(e*P),t.height=Math.floor(n*P),r!==!1&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument`),e=new b),e.set(j*P,N*P).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,N=n,P=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument`),e=new C),e.copy(E)},this.getViewport=function(e){return e.copy(L)},this.setViewport=function(e,t,n,r){e.isVector4?L.set(e.x,e.y,e.z,e.w):L.set(e,t,n,r),G.viewport(E.copy(L).multiplyScalar(P).floor())},this.getScissor=function(e){return e.copy(R)},this.setScissor=function(e,t,n,r){e.isVector4?R.set(e.x,e.y,e.z,e.w):R.set(e,t,n,r),G.scissor(k.copy(R).multiplyScalar(P).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(e){G.setScissorTest(z=e)},this.setOpaqueSort=function(e){F=e},this.setTransparentSort=function(e){I=e},this.getClearColor=function(){return J.getClearColor()},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(e,t,n){var r=0;(e===void 0||e)&&(r|=16384),(t===void 0||t)&&(r|=256),(n===void 0||n)&&(r|=1024),U.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Te,!1),t.removeEventListener(`webglcontextrestored`,Ee,!1),fe.dispose(),pe.dispose(),se.dispose(),ue.dispose(),ye.dispose(),Ge.stop()};function Te(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),m=!0}function Ee(){console.log(`THREE.WebGLRenderer: Context Restored.`),m=!1,ve()}function Fe(e){var t=e.target;t.removeEventListener(`dispose`,Fe),Re(t)}function Re(e){ze(e),se.remove(e)}function ze(e){var t=se.get(e).program;e.program=void 0,t!==void 0&&q.releaseProgram(t)}function Be(e,t){e.render(function(e){p.renderBufferImmediate(e,t)})}this.renderBufferImmediate=function(e,t){G.initAttributes();var n=se.get(e);e.hasPositions&&!n.position&&(n.position=U.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=U.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=U.createBuffer()),e.hasColors&&!n.color&&(n.color=U.createBuffer());var r=t.getAttributes();e.hasPositions&&(U.bindBuffer(34962,n.position),U.bufferData(34962,e.positionArray,35048),G.enableAttribute(r.position),U.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(U.bindBuffer(34962,n.normal),U.bufferData(34962,e.normalArray,35048),G.enableAttribute(r.normal),U.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(U.bindBuffer(34962,n.uv),U.bufferData(34962,e.uvArray,35048),G.enableAttribute(r.uv),U.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(U.bindBuffer(34962,n.color),U.bufferData(34962,e.colorArray,35048),G.enableAttribute(r.color),U.vertexAttribPointer(r.color,3,5126,!1,0,0)),G.disableUnusedAttributes(),U.drawArrays(4,0,e.count),e.count=0};var Ve=new M;this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=Ve);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=Xe(e,t,r,i);G.setMaterial(r,o);var c=!1;(S.geometry!==n.id||S.program!==s.id||S.wireframe!==(r.wireframe===!0))&&(S.geometry=n.id,S.program=s.id,S.wireframe=r.wireframe===!0,c=!0),(r.morphTargets||r.morphNormals)&&(me.update(i,n,r,s),c=!0),i.isInstancedMesh===!0&&(c=!0);var l=n.index,u=n.attributes.position;if(l===null){if(u===void 0||u.count===0)return}else if(l.count===0)return;var d=1;r.wireframe===!0&&(l=le.getWireframeAttribute(n),d=2);var f,p=he;l!==null&&(f=ce.get(l),p=ge,p.setIndex(f)),c&&(He(i,n,r,s),l!==null&&U.bindBuffer(34963,f.buffer));var m=l===null?u.count:l.count,h=n.drawRange.start*d,g=n.drawRange.count*d,_=a===null?0:a.start*d,v=a===null?1/0:a.count*d,y=Math.max(h,_),b=Math.min(m,h+g,_+v)-1,x=Math.max(0,b-y+1);if(x!==0){if(i.isMesh)r.wireframe===!0?(G.setLineWidth(r.wireframeLinewidth*H()),p.setMode(1)):p.setMode(4);else if(i.isLine){var C=r.linewidth;C===void 0&&(C=1),G.setLineWidth(C*H()),i.isLineSegments?p.setMode(1):i.isLineLoop?p.setMode(2):p.setMode(3)}else i.isPoints?p.setMode(0):i.isSprite&&p.setMode(4);if(i.isInstancedMesh)p.renderInstances(n,y,x,i.count);else if(n.isInstancedBufferGeometry){var w=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(n,y,x,w)}else p.render(y,x)}};function He(e,t,n,r){if(!(ae.isWebGL2===!1&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&W.get(`ANGLE_instanced_arrays`)===null)){G.initAttributes();var i=t.attributes,a=r.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var l=i[s];if(l!==void 0){var u=l.normalized,d=l.itemSize,f=ce.get(l);if(f===void 0)continue;var p=f.buffer,m=f.type,h=f.bytesPerElement;if(l.isInterleavedBufferAttribute){var g=l.data,_=g.stride,v=l.offset;g&&g.isInstancedInterleavedBuffer?(G.enableAttributeAndDivisor(c,g.meshPerAttribute),t._maxInstanceCount===void 0&&(t._maxInstanceCount=g.meshPerAttribute*g.count)):G.enableAttribute(c),U.bindBuffer(34962,p),G.vertexAttribPointer(c,d,m,u,_*h,v*h)}else l.isInstancedBufferAttribute?(G.enableAttributeAndDivisor(c,l.meshPerAttribute),t._maxInstanceCount===void 0&&(t._maxInstanceCount=l.meshPerAttribute*l.count)):G.enableAttribute(c),U.bindBuffer(34962,p),G.vertexAttribPointer(c,d,m,u,0,0)}else if(s===`instanceMatrix`){var f=ce.get(e.instanceMatrix);if(f===void 0)continue;var p=f.buffer,m=f.type;G.enableAttributeAndDivisor(c+0,1),G.enableAttributeAndDivisor(c+1,1),G.enableAttributeAndDivisor(c+2,1),G.enableAttributeAndDivisor(c+3,1),U.bindBuffer(34962,p),U.vertexAttribPointer(c+0,4,m,!1,64,0),U.vertexAttribPointer(c+1,4,m,!1,64,16),U.vertexAttribPointer(c+2,4,m,!1,64,32),U.vertexAttribPointer(c+3,4,m,!1,64,48)}else if(o!==void 0){var y=o[s];if(y!==void 0)switch(y.length){case 2:U.vertexAttrib2fv(c,y);break;case 3:U.vertexAttrib3fv(c,y);break;case 4:U.vertexAttrib4fv(c,y);break;default:U.vertexAttrib1fv(c,y)}}}}G.disableUnusedAttributes()}}this.compile=function(e,t){f=pe.get(e,t),f.init(),e.traverse(function(e){e.isLight&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),f.setupLights(t);let n={};e.traverse(function(t){let r=t.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){let a=r[i];a.uuid in n||(Ye(a,e,t),n[a.uuid]=!0)}else r.uuid in n||(Ye(r,e,t),n[r.uuid]=!0)})};var Ue=null;function We(e){ye.isPresenting||Ue&&Ue(e)}var Ge=new Ce;Ge.setAnimationLoop(We),typeof window<`u`&&Ge.setContext(window),this.setAnimationLoop=function(e){Ue=e,ye.setAnimationLoop(e),Ge.start()},this.render=function(e,t){var n,r;if(arguments[2]!==void 0&&(console.warn(`THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.`),n=arguments[2]),arguments[3]!==void 0&&(console.warn(`THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.`),r=arguments[3]),!(t&&t.isCamera)){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(!m){S.geometry=null,S.program=null,S.wireframe=!1,x=-1,w=null,e.autoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.updateMatrixWorld(),ye.enabled&&ye.isPresenting&&(t=ye.getCamera(t)),e.onBeforeRender(p,e,t,n||v),f=pe.get(e,t),f.init(),V.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(V),B=this.localClippingEnabled,ne=te.init(this.clippingPlanes,B,t),d=fe.get(e,t),d.init(),Ke(e,t,0,p.sortObjects),d.finish(),p.sortObjects===!0&&d.sort(F,I),ne&&te.beginShadows();var i=f.state.shadowsArray;be.render(i,e,t),f.setupLights(t),ne&&te.endShadows(),this.info.autoReset&&this.info.reset(),n!==void 0&&this.setRenderTarget(n),J.render(d,e,t,r);var a=d.opaque,o=d.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&qe(a,e,t,s),o.length&&qe(o,e,t,s)}else a.length&&qe(a,e,t),o.length&&qe(o,e,t);e.onAfterRender(p,e,t),v!==null&&(K.updateRenderTargetMipmap(v),K.updateMultisampleRenderTarget(v)),G.buffers.depth.setTest(!0),G.buffers.depth.setMask(!0),G.buffers.color.setMask(!0),G.setPolygonOffset(!1),d=null,f=null}};function Ke(e,t,n,r){if(e.visible!==!1){if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)f.pushLight(e),e.castShadow&&f.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V);var i=ue.update(e),a=e.material;a.visible&&d.push(e,i,a,n,re.z,null)}}else if(e.isImmediateRenderObject)r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V),d.push(e,null,e.material,n,re.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==oe.render.frame&&(e.skeleton.update(),e.skeleton.frame=oe.render.frame),!e.frustumCulled||ee.intersectsObject(e))){r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V);var i=ue.update(e),a=e.material;if(Array.isArray(a))for(var o=i.groups,s=0,c=o.length;s<c;s++){var l=o[s],u=a[l.materialIndex];u&&u.visible&&d.push(e,i,u,n,re.z,l)}else a.visible&&d.push(e,i,a,n,re.z,null)}}for(var p=e.children,s=0,c=p.length;s<c;s++)Ke(p[s],t,n,r)}}function qe(e,t,n,r){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,c=o.geometry,l=r===void 0?o.material:r,u=o.group;if(n.isArrayCamera){T=n;for(var d=n.cameras,p=0,m=d.length;p<m;p++){var h=d[p];s.layers.test(h.layers)&&(G.viewport(E.copy(h.viewport)),f.setupLights(h),Je(s,t,h,c,l,u))}}else T=null,Je(s,t,n,c,l,u)}}function Je(e,t,n,r,i,a){if(e.onBeforeRender(p,t,n,r,i,a),f=pe.get(t,T||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=Xe(n,t,i,e);G.setMaterial(i),S.geometry=null,S.program=null,S.wireframe=!1,Be(e,o)}else p.renderBufferDirect(n,t,r,i,e,a);e.onAfterRender(p,t,n,r,i,a),f=pe.get(t,T||n)}function Ye(e,t,n){var r=se.get(e),i=f.state.lights,a=f.state.shadowsArray,o=i.state.version,s=q.getParameters(e,i.state,a,t,te.numPlanes,te.numIntersection,n),c=q.getProgramCacheKey(s),l=r.program,u=!0;if(l===void 0)e.addEventListener(`dispose`,Fe);else if(l.cacheKey!==c)ze(e);else if(r.lightsStateVersion!==o)r.lightsStateVersion=o,u=!1;else if(s.shaderID!==void 0)return;else u=!1;u&&(l=q.acquireProgram(s,c),r.program=l,r.uniforms=s.uniforms,r.outputEncoding=s.outputEncoding,e.program=l);var d=l.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var m=0;m<p.maxMorphTargets;m++)d[`morphTarget`+m]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var m=0;m<p.maxMorphNormals;m++)d[`morphNormal`+m]>=0&&e.numSupportedMorphNormals++}var h=r.uniforms;(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(r.numClippingPlanes=te.numPlanes,r.numIntersection=te.numIntersection,h.clippingPlanes=te.uniform),r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.needsLights=Qe(e),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotShadowMatrix.value=i.state.spotShadowMatrix,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);var g=r.program.getUniforms();r.uniformsList=Dt.seqWithValue(g.seq,h)}function Xe(e,t,n,r){K.resetTextureUnits();var i=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=v===null?p.outputEncoding:v.texture.encoding,s=se.get(n),c=f.state.lights;if(ne&&(B||e!==w)){var l=e===w&&n.id===x;te.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,l)}n.version===s.__version?s.program===void 0||n.fog&&s.fog!==i?Ye(n,t,r):s.environment===a?(s.needsLights&&s.lightsStateVersion!==c.state.version||s.numClippingPlanes!==void 0&&(s.numClippingPlanes!==te.numPlanes||s.numIntersection!==te.numIntersection)||s.outputEncoding!==o)&&Ye(n,t,r):Ye(n,t,r):(Ye(n,t,r),s.__version=n.version);var u=!1,d=!1,m=!1,h=s.program,g=h.getUniforms(),_=s.uniforms;if(G.useProgram(h.program)&&(u=!0,d=!0,m=!0),n.id!==x&&(x=n.id,d=!0),u||w!==e){if(g.setValue(U,`projectionMatrix`,e.projectionMatrix),ae.logarithmicDepthBuffer&&g.setValue(U,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),w!==e&&(w=e,d=!0,m=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var y=g.map.cameraPosition;y!==void 0&&y.setValue(U,re.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(U,`isOrthographic`,e.isOrthographicCamera===!0),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&g.setValue(U,`viewMatrix`,e.matrixWorldInverse)}if(n.skinning){g.setOptional(U,r,`bindMatrix`),g.setOptional(U,r,`bindMatrixInverse`);var b=r.skeleton;if(b){var S=b.bones;if(ae.floatVertexTextures){if(b.boneTexture===void 0){var C=Math.sqrt(S.length*4);C=X.ceilPowerOfTwo(C),C=Math.max(C,4);var T=new Float32Array(C*C*4);T.set(b.boneMatrices);var E=new xe(T,C,C,es,Zo);b.boneMatrices=T,b.boneTexture=E,b.boneTextureSize=C}g.setValue(U,`boneTexture`,b.boneTexture,K),g.setValue(U,`boneTextureSize`,b.boneTextureSize)}else g.setOptional(U,b,`boneMatrices`)}}return(d||s.receiveShadow!==r.receiveShadow)&&(s.receiveShadow=r.receiveShadow,g.setValue(U,`receiveShadow`,r.receiveShadow)),d&&(g.setValue(U,`toneMappingExposure`,p.toneMappingExposure),g.setValue(U,`toneMappingWhitePoint`,p.toneMappingWhitePoint),s.needsLights&&Ze(_,m),i&&n.fog&&de.refreshFogUniforms(_,i),de.refreshMaterialUniforms(_,n,a,P,N),_.ltc_1!==void 0&&(_.ltc_1.value=Z.LTC_1),_.ltc_2!==void 0&&(_.ltc_2.value=Z.LTC_2),Dt.upload(U,s.uniformsList,_,K)),n.isShaderMaterial&&n.uniformsNeedUpdate===!0&&(Dt.upload(U,s.uniformsList,_,K),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(U,`center`,r.center),g.setValue(U,`modelViewMatrix`,r.modelViewMatrix),g.setValue(U,`normalMatrix`,r.normalMatrix),g.setValue(U,`modelMatrix`,r.matrixWorld),h}function Ze(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function Qe(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.setFramebuffer=function(e){h!==e&&v===null&&U.bindFramebuffer(36160,e),h=e},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return v},this.setRenderTarget=function(e,t,n){v=e,g=t,_=n,e&&se.get(e).__webglFramebuffer===void 0&&K.setupRenderTarget(e);var r=h,i=!1;if(e){var a=se.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=a[t||0],i=!0):r=e.isWebGLMultisampleRenderTarget?se.get(e).__webglMultisampledFramebuffer:a,E.copy(e.viewport),k.copy(e.scissor),A=e.scissorTest}else E.copy(L).multiplyScalar(P).floor(),k.copy(R).multiplyScalar(P).floor(),A=z;if(y!==r&&(U.bindFramebuffer(36160,r),y=r),G.viewport(E),G.scissor(k),G.setScissorTest(A),i){var o=se.get(e.texture);U.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}var s=se.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(s=s[o]),s){var c=!1;s!==y&&(U.bindFramebuffer(36160,s),c=!0);try{var l=e.texture,u=l.format,d=l.type;if(u!==1023&&_e.convert(u)!==U.getParameter(35739)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(d!==1009&&_e.convert(d)!==U.getParameter(35738)&&!(d===1015&&(ae.isWebGL2||W.get(`OES_texture_float`)||W.get(`WEBGL_color_buffer_float`)))&&!(d===1016&&(ae.isWebGL2?W.get(`EXT_color_buffer_float`):W.get(`EXT_color_buffer_half_float`)))){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}U.checkFramebufferStatus(36160)===36053?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&U.readPixels(t,n,r,i,_e.convert(u),_e.convert(d),a):console.error(`THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.`)}finally{c&&U.bindFramebuffer(36160,y)}}},this.copyFramebufferToTexture=function(e,t,n){n===void 0&&(n=0);var r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r),o=_e.convert(t.format);K.setTexture2D(t,0),U.copyTexImage2D(3553,n,o,e.x,e.y,i,a,0),G.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r){r===void 0&&(r=0);var i=t.image.width,a=t.image.height,o=_e.convert(n.format),s=_e.convert(n.type);K.setTexture2D(n,0),t.isDataTexture?U.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?U.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):U.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),r===0&&n.generateMipmaps&&U.generateMipmap(3553),G.unbindTexture()},this.initTexture=function(e){K.setTexture2D(e,0),G.unbindTexture()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}function Cn(e,t){this.name=``,this.color=new z(e),this.density=t===void 0?25e-5:t}function wn(e,t,n){this.name=``,this.color=new z(e),this.near=t===void 0?1:t,this.far=n===void 0?1e3:n}function Tn(e,t){this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=uc,this.updateRange={offset:0,count:-1},this.version=0}function En(e,t,n,r){this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r===!0}function Dn(e){V.call(this),this.type=`SpriteMaterial`,this.color=new z(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}function On(e){if(j.call(this),this.type=`Sprite`,Ou===void 0){Ou=new q;var t=new Tn(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Ou.setIndex([0,1,2,0,2,3]),Ou.setAttribute(`position`,new En(t,3,0,!1)),Ou.setAttribute(`uv`,new En(t,2,3,!1))}this.geometry=Ou,this.material=e===void 0?new Dn:e,this.center=new b(.5,.5)}function kn(e,t,n,r,i,a){Mu.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?Nu.copy(Mu):(Nu.x=a*Mu.x-i*Mu.y,Nu.y=i*Mu.x+a*Mu.y),e.copy(t),e.x+=Nu.x,e.y+=Nu.y,e.applyMatrix4(Pu)}function An(){j.call(this),this._currentLevel=0,this.type=`LOD`,Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function jn(e,t){e&&e.isGeometry&&console.error(`THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`),de.call(this,e,t),this.type=`SkinnedMesh`,this.bindMode=`attached`,this.bindMatrix=new O,this.bindMatrixInverse=new O}function Mn(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(this.bones.length*16),this.frame=-1,t===void 0)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn(`THREE.Skeleton boneInverses is the wrong length.`),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new O)}}function Nn(){j.call(this),this.type=`Bone`}function Pn(e,t,n){de.call(this,e,t),this.instanceMatrix=new H(new Float32Array(n*16),16),this.count=n,this.frustumCulled=!1}function Fn(e){V.call(this),this.type=`LineBasicMaterial`,this.color=new z(16777215),this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.morphTargets=!1,this.setValues(e)}function In(e,t,n){n===1&&console.error(`THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.`),j.call(this),this.type=`Line`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new Fn:t,this.updateMorphTargets()}function Ln(e,t){In.call(this,e,t),this.type=`LineSegments`}function Rn(e,t){In.call(this,e,t),this.type=`LineLoop`}function zn(e){V.call(this),this.type=`PointsMaterial`,this.color=new z(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}function Bn(e,t){j.call(this),this.type=`Points`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new zn:t,this.updateMorphTargets()}function Vn(e,t,n,r,i,a,o){var s=rd.distanceSqToPoint(e);if(s<n){var c=new D;rd.closestPointToPoint(e,c),c.applyMatrix4(r);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:o})}}function Hn(e,t,n,r,i,a,o,s,c){S.call(this,e,t,n,r,i,a,o,s,c),this.format=o===void 0?$o:o,this.minFilter=a===void 0?Ko:a,this.magFilter=i===void 0?Ko:i,this.generateMipmaps=!1}function Un(e,t,n,r,i,a,o,s,c,l,u,d){S.call(this,null,a,o,s,c,l,r,i,u,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Wn(e,t,n,r,i,a,o,s,c){S.call(this,e,t,n,r,i,a,o,s,c),this.needsUpdate=!0}function Gn(e,t,n,r,i,a,o,s,c,l){if(l=l===void 0?ns:l,l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);n===void 0&&l===1026&&(n=Xo),n===void 0&&l===1027&&(n=Qo),S.call(this,null,r,i,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=o===void 0?Uo:o,this.minFilter=s===void 0?Uo:s,this.flipY=!1,this.generateMipmaps=!1}function Kn(e){q.call(this),this.type=`WireframeGeometry`;var t=[],n,r,i,a,o,s=[0,0],c={},l,u,d,f,p=[`a`,`b`,`c`],m;if(e&&e.isGeometry){var h=e.faces;for(n=0,i=h.length;n<i;n++){var g=h[n];for(r=0;r<3;r++)u=g[p[r]],d=g[p[(r+1)%3]],s[0]=Math.min(u,d),s[1]=Math.max(u,d),f=s[0]+`,`+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]})}for(f in c)l=c[f],m=e.vertices[l.index1],t.push(m.x,m.y,m.z),m=e.vertices[l.index2],t.push(m.x,m.y,m.z)}else if(e&&e.isBufferGeometry){var _,v,y,b,x,S,C,w;if(m=new D,e.index!==null){for(_=e.attributes.position,v=e.index,y=e.groups,y.length===0&&(y=[{start:0,count:v.count,materialIndex:0}]),a=0,o=y.length;a<o;++a)for(b=y[a],x=b.start,S=b.count,n=x,i=x+S;n<i;n+=3)for(r=0;r<3;r++)u=v.getX(n+r),d=v.getX(n+(r+1)%3),s[0]=Math.min(u,d),s[1]=Math.max(u,d),f=s[0]+`,`+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]});for(f in c)l=c[f],m.fromBufferAttribute(_,l.index1),t.push(m.x,m.y,m.z),m.fromBufferAttribute(_,l.index2),t.push(m.x,m.y,m.z)}else for(_=e.attributes.position,n=0,i=_.count/3;n<i;n++)for(r=0;r<3;r++)C=3*n+r,m.fromBufferAttribute(_,C),t.push(m.x,m.y,m.z),w=3*n+(r+1)%3,m.fromBufferAttribute(_,w),t.push(m.x,m.y,m.z)}this.setAttribute(`position`,new K(t,3))}function qn(e,t,n){J.call(this),this.type=`ParametricGeometry`,this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new Jn(e,t,n)),this.mergeVertices()}function Jn(e,t,n){q.call(this),this.type=`ParametricBufferGeometry`,this.parameters={func:e,slices:t,stacks:n};var r=[],i=[],a=[],o=[],s=1e-5,c=new D,l=new D,u=new D,d=new D,f=new D,p,m;e.length<3&&console.error(`THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.`);var h=t+1;for(p=0;p<=n;p++){var g=p/n;for(m=0;m<=t;m++){var _=m/t;e(_,g,l),i.push(l.x,l.y,l.z),_-s>=0?(e(_-s,g,u),d.subVectors(l,u)):(e(_+s,g,u),d.subVectors(u,l)),g-s>=0?(e(_,g-s,u),f.subVectors(l,u)):(e(_,g+s,u),f.subVectors(u,l)),c.crossVectors(d,f).normalize(),a.push(c.x,c.y,c.z),o.push(_,g)}}for(p=0;p<n;p++)for(m=0;m<t;m++){var v=p*h+m,y=p*h+m+1,b=(p+1)*h+m+1,x=(p+1)*h+m;r.push(v,y,x),r.push(y,b,x)}this.setIndex(r),this.setAttribute(`position`,new K(i,3)),this.setAttribute(`normal`,new K(a,3)),this.setAttribute(`uv`,new K(o,2))}function Yn(e,t,n,r){J.call(this),this.type=`PolyhedronGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new Xn(e,t,n,r)),this.mergeVertices()}function Xn(e,t,n,r){q.call(this),this.type=`PolyhedronBufferGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1,r=r||0;var i=[],a=[];o(r),c(n),l(),this.setAttribute(`position`,new K(i,3)),this.setAttribute(`normal`,new K(i.slice(),3)),this.setAttribute(`uv`,new K(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(e){for(var n=new D,r=new D,i=new D,a=0;a<t.length;a+=3)f(t[a+0],n),f(t[a+1],r),f(t[a+2],i),s(n,r,i,e)}function s(e,t,n,r){var i=Math.pow(2,r),a=[],o,s;for(o=0;o<=i;o++){a[o]=[];var c=e.clone().lerp(n,o/i),l=t.clone().lerp(n,o/i),u=i-o;for(s=0;s<=u;s++)s===0&&o===i?a[o][s]=c:a[o][s]=c.clone().lerp(l,s/u)}for(o=0;o<i;o++)for(s=0;s<2*(i-o)-1;s++){var f=Math.floor(s/2);s%2==0?(d(a[o][f+1]),d(a[o+1][f]),d(a[o][f])):(d(a[o][f+1]),d(a[o+1][f+1]),d(a[o+1][f]))}}function c(e){for(var t=new D,n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}function l(){for(var e=new D,t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];var n=h(e)/2/Math.PI+.5,r=g(e)/Math.PI+.5;a.push(n,1-r)}p(),u()}function u(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],r=a[e+4];Math.max(t,n,r)>.9&&Math.min(t,n,r)<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}function d(e){i.push(e.x,e.y,e.z)}function f(t,n){var r=t*3;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function p(){for(var e=new D,t=new D,n=new D,r=new D,o=new b,s=new b,c=new b,l=0,u=0;l<i.length;l+=9,u+=6){e.set(i[l+0],i[l+1],i[l+2]),t.set(i[l+3],i[l+4],i[l+5]),n.set(i[l+6],i[l+7],i[l+8]),o.set(a[u+0],a[u+1]),s.set(a[u+2],a[u+3]),c.set(a[u+4],a[u+5]),r.copy(e).add(t).add(n).divideScalar(3);var d=h(r);m(o,u+0,e,d),m(s,u+2,t,d),m(c,u+4,n,d)}}function m(e,t,n,r){r<0&&e.x===1&&(a[t]=e.x-1),n.x===0&&n.z===0&&(a[t]=r/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function g(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}}function Zn(e,t){J.call(this),this.type=`TetrahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Qn(e,t)),this.mergeVertices()}function Qn(e,t){Xn.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type=`TetrahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function $n(e,t){J.call(this),this.type=`OctahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new er(e,t)),this.mergeVertices()}function er(e,t){Xn.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type=`OctahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function tr(e,t){J.call(this),this.type=`IcosahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new nr(e,t)),this.mergeVertices()}function nr(e,t){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Xn.call(this,r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type=`IcosahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function rr(e,t){J.call(this),this.type=`DodecahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ir(e,t)),this.mergeVertices()}function ir(e,t){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];Xn.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type=`DodecahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function ar(e,t,n,r,i,a){J.call(this),this.type=`TubeGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},a!==void 0&&console.warn(`THREE.TubeGeometry: taper has been removed.`);var o=new or(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function or(e,t,n,r,i){q.call(this),this.type=`TubeBufferGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},t=t||64,n=n||1,r=r||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o=new D,s=new D,c=new b,l=new D,u,d,f=[],p=[],m=[],h=[];g(),this.setIndex(h),this.setAttribute(`position`,new K(f,3)),this.setAttribute(`normal`,new K(p,3)),this.setAttribute(`uv`,new K(m,2));function g(){for(u=0;u<t;u++)_(u);_(i===!1?t:0),y(),v()}function _(i){l=e.getPointAt(i/t,l);var c=a.normals[i],u=a.binormals[i];for(d=0;d<=r;d++){var m=d/r*Math.PI*2,h=Math.sin(m),g=-Math.cos(m);s.x=g*c.x+h*u.x,s.y=g*c.y+h*u.y,s.z=g*c.z+h*u.z,s.normalize(),p.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,f.push(o.x,o.y,o.z)}}function v(){for(d=1;d<=t;d++)for(u=1;u<=r;u++){var e=(r+1)*(d-1)+(u-1),n=(r+1)*d+(u-1),i=(r+1)*d+u,a=(r+1)*(d-1)+u;h.push(e,n,a),h.push(n,i,a)}}function y(){for(u=0;u<=t;u++)for(d=0;d<=r;d++)c.x=u/t,c.y=d/r,m.push(c.x,c.y)}}function sr(e,t,n,r,i,a,o){J.call(this),this.type=`TorusKnotGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},o!==void 0&&console.warn(`THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.`),this.fromBufferGeometry(new cr(e,t,n,r,i,a)),this.mergeVertices()}function cr(e,t,n,r,i,a){q.call(this),this.type=`TorusKnotBufferGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o=[],s=[],c=[],l=[],u,d,f=new D,p=new D,m=new D,h=new D,g=new D,_=new D,v=new D;for(u=0;u<=n;++u){var y=u/n*i*Math.PI*2;for(O(y,i,a,e,m),O(y+.01,i,a,e,h),_.subVectors(h,m),v.addVectors(h,m),g.crossVectors(_,v),v.crossVectors(g,_),g.normalize(),v.normalize(),d=0;d<=r;++d){var b=d/r*Math.PI*2,x=-t*Math.cos(b),S=t*Math.sin(b);f.x=m.x+(x*v.x+S*g.x),f.y=m.y+(x*v.y+S*g.y),f.z=m.z+(x*v.z+S*g.z),s.push(f.x,f.y,f.z),p.subVectors(f,m).normalize(),c.push(p.x,p.y,p.z),l.push(u/n),l.push(d/r)}}for(d=1;d<=n;d++)for(u=1;u<=r;u++){var C=(r+1)*(d-1)+(u-1),w=(r+1)*d+(u-1),T=(r+1)*d+u,E=(r+1)*(d-1)+u;o.push(C,w,E),o.push(w,T,E)}this.setIndex(o),this.setAttribute(`position`,new K(s,3)),this.setAttribute(`normal`,new K(c,3)),this.setAttribute(`uv`,new K(l,2));function O(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}}function lr(e,t,n,r,i){J.call(this),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new ur(e,t,n,r,i)),this.mergeVertices()}function ur(e,t,n,r,i){q.call(this),this.type=`TorusBufferGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||Math.PI*2;var a=[],o=[],s=[],c=[],l=new D,u=new D,d=new D,f,p;for(f=0;f<=n;f++)for(p=0;p<=r;p++){var m=p/r*i,h=f/n*Math.PI*2;u.x=(e+t*Math.cos(h))*Math.cos(m),u.y=(e+t*Math.cos(h))*Math.sin(m),u.z=t*Math.sin(h),o.push(u.x,u.y,u.z),l.x=e*Math.cos(m),l.y=e*Math.sin(m),d.subVectors(u,l).normalize(),s.push(d.x,d.y,d.z),c.push(p/r),c.push(f/n)}for(f=1;f<=n;f++)for(p=1;p<=r;p++){var g=(r+1)*f+p-1,_=(r+1)*(f-1)+p-1,v=(r+1)*(f-1)+p,y=(r+1)*f+p;a.push(g,_,y),a.push(_,v,y)}this.setIndex(a),this.setAttribute(`position`,new K(o,3)),this.setAttribute(`normal`,new K(s,3)),this.setAttribute(`uv`,new K(c,2))}function dr(e,t,n,r,i){var a,o;if(i===Vr(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Rr(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Rr(a,e[a],e[a+1],o);return o&&Ar(o,o.next)&&(zr(o),o=o.next),o}function fr(e,t){if(!e)return e;t||(t=e);var n=e,r;do if(r=!1,!n.steiner&&(Ar(n,n.next)||kr(n.prev,n,n.next)===0)){if(zr(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function pr(e,t,n,r,i,a,o){if(e){!o&&a&&Cr(e,r,i,a);for(var s=e,c,l;e.prev!==e.next;){if(c=e.prev,l=e.next,a?hr(e,r,i,a):mr(e)){t.push(c.i/n),t.push(e.i/n),t.push(l.i/n),zr(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=gr(fr(e),t,n),pr(e,t,n,r,i,a,2)):o===2&&_r(e,t,n,r,i,a):pr(fr(e),t,n,r,i,a,1);break}}}}function mr(e){var t=e.prev,n=e,r=e.next;if(kr(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(Dr(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&kr(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function hr(e,t,n,r){var i=e.prev,a=e,o=e.next;if(kr(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,d=Tr(s,c,t,n,r),f=Tr(l,u,t,n,r),p=e.prevZ,m=e.nextZ;p&&p.z>=d&&m&&m.z<=f;){if(p!==e.prev&&p!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&kr(p.prev,p,p.next)>=0||(p=p.prevZ,m!==e.prev&&m!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&kr(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&kr(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=f;){if(m!==e.prev&&m!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&kr(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function gr(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Ar(i,a)&&jr(i,r,r.next,a)&&Fr(i,a)&&Fr(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),zr(r),zr(r.next),r=e=a),r=r.next}while(r!==e);return fr(r)}function _r(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Or(o,s)){var c=Lr(o,s);o=fr(o,o.next),c=fr(c,c.next),pr(o,t,n,r,i,a),pr(c,t,n,r,i,a);return}s=s.next}o=o.next}while(o!==e)}function vr(e,t,n,r){var i=[],a,o,s,c,l;for(a=0,o=t.length;a<o;a++)s=t[a]*r,c=a<o-1?t[a+1]*r:e.length,l=dr(e,s,c,r,!1),l===l.next&&(l.steiner=!0),i.push(Er(l));for(i.sort(yr),a=0;a<i.length;a++)br(i[a],n),n=fr(n,n.next);return n}function yr(e,t){return e.x-t.x}function br(e,t){if(t=xr(e,t),t){var n=Lr(t,e);fr(t,t.next),fr(n,n.next)}}function xr(e,t){var n=t,r=e.x,i=e.y,a=-1/0,o;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!o)return null;if(r===a)return o;var c=o,l=o.x,u=o.y,d=1/0,f;n=o;do r>=n.x&&n.x>=l&&r!==n.x&&Dr(i<u?r:a,i,l,u,i<u?a:r,i,n.x,n.y)&&(f=Math.abs(i-n.y)/(r-n.x),Fr(n,e)&&(f<d||f===d&&(n.x>o.x||n.x===o.x&&Sr(o,n)))&&(o=n,d=f)),n=n.next;while(n!==c);return o}function Sr(e,t){return kr(e.prev,e,t.prev)<0&&kr(t.next,e,e.next)<0}function Cr(e,t,n,r){var i=e;do i.z===null&&(i.z=Tr(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,wr(i)}function wr(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ,r);t++);for(c=l;s>0||c>0&&r;)s!==0&&(c===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return e}function Tr(e,t,n,r,i){return e=32767*(e-n)*i,t=32767*(t-r)*i,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Er(e){var t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Dr(e,t,n,r,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function Or(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Pr(e,t)&&(Fr(e,t)&&Fr(t,e)&&Ir(e,t)&&(kr(e.prev,e,t.prev)||kr(e,t.prev,t))||Ar(e,t)&&kr(e.prev,e,e.next)>0&&kr(t.prev,t,t.next)>0)}function kr(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ar(e,t){return e.x===t.x&&e.y===t.y}function jr(e,t,n,r){var i=Nr(kr(e,t,n)),a=Nr(kr(e,t,r)),o=Nr(kr(n,r,e)),s=Nr(kr(n,r,t));return!!(i!==a&&o!==s||i===0&&Mr(e,n,t)||a===0&&Mr(e,r,t)||o===0&&Mr(n,e,r)||s===0&&Mr(n,t,r))}function Mr(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Nr(e){return e>0?1:e<0?-1:0}function Pr(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&jr(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Fr(e,t){return kr(e.prev,e,e.next)<0?kr(e,t,e.next)>=0&&kr(e,e.prev,t)>=0:kr(e,t,e.prev)<0||kr(e,e.next,t)<0}function Ir(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Lr(e,t){var n=new Br(e.i,e.x,e.y),r=new Br(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Rr(e,t,n,r){var i=new Br(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function zr(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Br(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Vr(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function Hr(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Ur(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Wr(e,t){J.call(this),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Gr(e,t)),this.mergeVertices()}function Gr(e,t){q.call(this),this.type=`ExtrudeBufferGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,r=[],i=[],a=0,o=e.length;a<o;a++){var s=e[a];c(s)}this.setAttribute(`position`,new K(r,3)),this.setAttribute(`uv`,new K(i,2)),this.computeVertexNormals();function c(e){var a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?100:t.depth,l=t.bevelEnabled===void 0?!0:t.bevelEnabled,u=t.bevelThickness===void 0?6:t.bevelThickness,d=t.bevelSize===void 0?u-2:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?cd:t.UVGenerator;t.amount!==void 0&&(console.warn(`THREE.ExtrudeBufferGeometry: amount has been renamed to depth.`),c=t.amount);var g,_=!1,v,y,x,S;m&&(g=m.getSpacedPoints(s),_=!0,l=!1,v=m.computeFrenetFrames(s,!1),y=new D,x=new D,S=new D),l||(p=0,u=0,d=0,f=0);var C,w,T,E=e.extractPoints(o),O=E.shape,k=E.holes;if(!sd.isClockWise(O))for(O=O.reverse(),w=0,T=k.length;w<T;w++)C=k[w],sd.isClockWise(C)&&(k[w]=C.reverse());var A=sd.triangulateShape(O,k),j=O;for(w=0,T=k.length;w<T;w++)C=k[w],O=O.concat(C);function M(e,t,n){return t||console.error(`THREE.ExtrudeGeometry: vec does not exist`),t.clone().multiplyScalar(n).add(e)}var N,P,F,I,L,R=O.length,z,ee=A.length;function te(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>Number.EPSILON){var f=Math.sqrt(u),p=Math.sqrt(c*c+l*l),m=t.x-s/f,h=t.y+o/f,g=n.x-l/p,_=n.y+c/p,v=((g-m)*l-(_-h)*c)/(o*l-s*c);r=m+o*v-e.x,i=h+s*v-e.y;var y=r*r+i*i;if(y<=2)return new b(r,i);a=Math.sqrt(y/2)}else{var x=!1;o>Number.EPSILON?c>Number.EPSILON&&(x=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(x=!0):Math.sign(s)===Math.sign(l)&&(x=!0),x?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new b(r/a,i/a)}for(var ne=[],B=0,V=j.length,re=V-1,H=B+1;B<V;B++,re++,H++)re===V&&(re=0),H===V&&(H=0),ne[B]=te(j[B],j[re],j[H]);var U=[],ie,W=ne.concat();for(w=0,T=k.length;w<T;w++){for(C=k[w],ie=[],B=0,V=C.length,re=V-1,H=B+1;B<V;B++,re++,H++)re===V&&(re=0),H===V&&(H=0),ie[B]=te(C[B],C[re],C[H]);U.push(ie),W=W.concat(ie)}for(N=0;N<p;N++){for(F=N/p,I=u*Math.cos(F*Math.PI/2),P=d*Math.sin(F*Math.PI/2)+f,B=0,V=j.length;B<V;B++)L=M(j[B],ne[B],P),K(L.x,L.y,-I);for(w=0,T=k.length;w<T;w++)for(C=k[w],ie=U[w],B=0,V=C.length;B<V;B++)L=M(C[B],ie[B],P),K(L.x,L.y,-I)}for(P=d+f,B=0;B<R;B++)L=l?M(O[B],W[B],P):O[B],_?(x.copy(v.normals[0]).multiplyScalar(L.x),y.copy(v.binormals[0]).multiplyScalar(L.y),S.copy(g[0]).add(x).add(y),K(S.x,S.y,S.z)):K(L.x,L.y,0);var ae;for(ae=1;ae<=s;ae++)for(B=0;B<R;B++)L=l?M(O[B],W[B],P):O[B],_?(x.copy(v.normals[ae]).multiplyScalar(L.x),y.copy(v.binormals[ae]).multiplyScalar(L.y),S.copy(g[ae]).add(x).add(y),K(S.x,S.y,S.z)):K(L.x,L.y,c/s*ae);for(N=p-1;N>=0;N--){for(F=N/p,I=u*Math.cos(F*Math.PI/2),P=d*Math.sin(F*Math.PI/2)+f,B=0,V=j.length;B<V;B++)L=M(j[B],ne[B],P),K(L.x,L.y,c+I);for(w=0,T=k.length;w<T;w++)for(C=k[w],ie=U[w],B=0,V=C.length;B<V;B++)L=M(C[B],ie[B],P),_?K(L.x,L.y+g[s-1].y,g[s-1].x+I):K(L.x,L.y,c+I)}G(),oe();function G(){var e=r.length/3;if(l){var t=0,i=R*t;for(B=0;B<ee;B++)z=A[B],ce(z[2]+i,z[1]+i,z[0]+i);for(t=s+p*2,i=R*t,B=0;B<ee;B++)z=A[B],ce(z[0]+i,z[1]+i,z[2]+i)}else{for(B=0;B<ee;B++)z=A[B],ce(z[2],z[1],z[0]);for(B=0;B<ee;B++)z=A[B],ce(z[0]+R*s,z[1]+R*s,z[2]+R*s)}n.addGroup(e,r.length/3-e,0)}function oe(){var e=r.length/3,t=0;for(se(j,t),t+=j.length,w=0,T=k.length;w<T;w++)C=k[w],se(C,t),t+=C.length;n.addGroup(e,r.length/3-e,1)}function se(e,t){var n,r;for(B=e.length;--B>=0;){n=B,r=B-1,r<0&&(r=e.length-1);var i=0,a=s+p*2;for(i=0;i<a;i++){var o=R*i,c=R*(i+1);le(t+n+o,t+r+o,t+r+c,t+n+c)}}}function K(e,t,n){a.push(e),a.push(t),a.push(n)}function ce(e,t,i){ue(e),ue(t),ue(i);var a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);q(o[0]),q(o[1]),q(o[2])}function le(e,t,i,a){ue(e),ue(t),ue(a),ue(t),ue(i),ue(a);var o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);q(s[0]),q(s[1]),q(s[3]),q(s[1]),q(s[2]),q(s[3])}function ue(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function q(e){i.push(e.x),i.push(e.y)}}}function Kr(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function qr(e,t){J.call(this),this.type=`TextGeometry`,this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Jr(e,t)),this.mergeVertices()}function Jr(e,t){t=t||{};var n=t.font;if(!(n&&n.isFont))return console.error(`THREE.TextGeometry: font parameter is not an instance of THREE.Font.`),new J;var r=n.generateShapes(e,t.size);t.depth=t.height===void 0?50:t.height,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),Gr.call(this,r,t),this.type=`TextBufferGeometry`}function Yr(e,t,n,r,i,a,o){J.call(this),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Xr(e,t,n,r,i,a,o)),this.mergeVertices()}function Xr(e,t,n,r,i,a,o){q.call(this),this.type=`SphereBufferGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=r===void 0?0:r,i=i===void 0?Math.PI*2:i,a=a===void 0?0:a,o=o===void 0?Math.PI:o;var s=Math.min(a+o,Math.PI),c,l,u=0,d=[],f=new D,p=new D,m=[],h=[],g=[],_=[];for(l=0;l<=n;l++){var v=[],y=l/n,b=0;for(l==0&&a==0?b=.5/t:l==n&&s==Math.PI&&(b=-.5/t),c=0;c<=t;c++){var x=c/t;f.x=-e*Math.cos(r+x*i)*Math.sin(a+y*o),f.y=e*Math.cos(a+y*o),f.z=e*Math.sin(r+x*i)*Math.sin(a+y*o),h.push(f.x,f.y,f.z),p.copy(f).normalize(),g.push(p.x,p.y,p.z),_.push(x+b,1-y),v.push(u++)}d.push(v)}for(l=0;l<n;l++)for(c=0;c<t;c++){var S=d[l][c+1],C=d[l][c],w=d[l+1][c],T=d[l+1][c+1];(l!==0||a>0)&&m.push(S,C,T),(l!==n-1||s<Math.PI)&&m.push(C,w,T)}this.setIndex(m),this.setAttribute(`position`,new K(h,3)),this.setAttribute(`normal`,new K(g,3)),this.setAttribute(`uv`,new K(_,2))}function Zr(e,t,n,r,i,a){J.call(this),this.type=`RingGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new Qr(e,t,n,r,i,a)),this.mergeVertices()}function Qr(e,t,n,r,i,a){q.call(this),this.type=`RingBufferGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=i===void 0?0:i,a=a===void 0?Math.PI*2:a,n=n===void 0?8:Math.max(3,n),r=r===void 0?1:Math.max(1,r);var o=[],s=[],c=[],l=[],u,d=e,f=(t-e)/r,p=new D,m=new b,h,g;for(h=0;h<=r;h++){for(g=0;g<=n;g++)u=i+g/n*a,p.x=d*Math.cos(u),p.y=d*Math.sin(u),s.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/t+1)/2,m.y=(p.y/t+1)/2,l.push(m.x,m.y);d+=f}for(h=0;h<r;h++){var _=h*(n+1);for(g=0;g<n;g++){u=g+_;var v=u,y=u+n+1,x=u+n+2,S=u+1;o.push(v,y,S),o.push(y,x,S)}}this.setIndex(o),this.setAttribute(`position`,new K(s,3)),this.setAttribute(`normal`,new K(c,3)),this.setAttribute(`uv`,new K(l,2))}function $r(e,t,n,r){J.call(this),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new ei(e,t,n,r)),this.mergeVertices()}function ei(e,t,n,r){q.call(this),this.type=`LatheBufferGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||Math.PI*2,r=X.clamp(r,0,Math.PI*2);var i=[],a=[],o=[],s,c=1/t,l=new D,u=new b,d,f;for(d=0;d<=t;d++){var p=n+d*c*r,m=Math.sin(p),h=Math.cos(p);for(f=0;f<=e.length-1;f++)l.x=e[f].x*m,l.y=e[f].y,l.z=e[f].x*h,a.push(l.x,l.y,l.z),u.x=d/t,u.y=f/(e.length-1),o.push(u.x,u.y)}for(d=0;d<t;d++)for(f=0;f<e.length-1;f++){s=f+d*e.length;var g=s,_=s+e.length,v=s+e.length+1,y=s+1;i.push(g,_,y),i.push(_,v,y)}if(this.setIndex(i),this.setAttribute(`position`,new K(a,3)),this.setAttribute(`uv`,new K(o,2)),this.computeVertexNormals(),r===Math.PI*2){var x=this.attributes.normal.array,S=new D,C=new D,w=new D;for(s=t*e.length*3,d=0,f=0;d<e.length;d++,f+=3)S.x=x[f+0],S.y=x[f+1],S.z=x[f+2],C.x=x[s+f+0],C.y=x[s+f+1],C.z=x[s+f+2],w.addVectors(S,C).normalize(),x[f+0]=x[s+f+0]=w.x,x[f+1]=x[s+f+1]=w.y,x[f+2]=x[s+f+2]=w.z}}function ti(e,t){J.call(this),this.type=`ShapeGeometry`,typeof t==`object`&&(console.warn(`THREE.ShapeGeometry: Options parameter has been removed.`),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new ni(e,t)),this.mergeVertices()}function ni(e,t){q.call(this),this.type=`ShapeBufferGeometry`,this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;this.setIndex(n),this.setAttribute(`position`,new K(r,3)),this.setAttribute(`normal`,new K(i,3)),this.setAttribute(`uv`,new K(a,2));function l(e){var o,c,l,u=r.length/3,d=e.extractPoints(t),f=d.shape,p=d.holes;for(sd.isClockWise(f)===!1&&(f=f.reverse()),o=0,c=p.length;o<c;o++)l=p[o],sd.isClockWise(l)===!0&&(p[o]=l.reverse());var m=sd.triangulateShape(f,p);for(o=0,c=p.length;o<c;o++)l=p[o],f=f.concat(l);for(o=0,c=f.length;o<c;o++){var h=f[o];r.push(h.x,h.y,0),i.push(0,0,1),a.push(h.x,h.y)}for(o=0,c=m.length;o<c;o++){var g=m[o],_=g[0]+u,v=g[1]+u,y=g[2]+u;n.push(_,v,y),s+=3}}}function ri(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function ii(e,t){q.call(this),this.type=`EdgesGeometry`,this.parameters={thresholdAngle:t},t=t===void 0?1:t;var n=[],r=Math.cos(X.DEG2RAD*t),i=[0,0],a={},o,s,c,l=[`a`,`b`,`c`],u;e.isBufferGeometry?(u=new J,u.fromBufferGeometry(e)):u=e.clone(),u.mergeVertices(),u.computeFaceNormals();for(var d=u.vertices,f=u.faces,p=0,m=f.length;p<m;p++)for(var h=f[p],g=0;g<3;g++)o=h[l[g]],s=h[l[(g+1)%3]],i[0]=Math.min(o,s),i[1]=Math.max(o,s),c=i[0]+`,`+i[1],a[c]===void 0?a[c]={index1:i[0],index2:i[1],face1:p,face2:void 0}:a[c].face2=p;for(c in a){var _=a[c];if(_.face2===void 0||f[_.face1].normal.dot(f[_.face2].normal)<=r){var v=d[_.index1];n.push(v.x,v.y,v.z),v=d[_.index2],n.push(v.x,v.y,v.z)}}this.setAttribute(`position`,new K(n,3))}function ai(e,t,n,r,i,a,o,s){J.call(this),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new oi(e,t,n,r,i,a,o,s)),this.mergeVertices()}function oi(e,t,n,r,i,a,o,s){q.call(this),this.type=`CylinderBufferGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=e===void 0?1:e,t=t===void 0?1:t,n=n||1,r=Math.floor(r)||8,i=Math.floor(i)||1,a=a===void 0?!1:a,o=o===void 0?0:o,s=s===void 0?Math.PI*2:s;var l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new K(u,3)),this.setAttribute(`normal`,new K(d,3)),this.setAttribute(`uv`,new K(f,2));function _(){var a,_,v=new D,y=new D,b=0,x=(t-e)/n;for(_=0;_<=i;_++){var S=[],C=_/i,w=C*(t-e)+e;for(a=0;a<=r;a++){var T=a/r,E=T*s+o,O=Math.sin(E),k=Math.cos(E);y.x=w*O,y.y=-C*n+h,y.z=w*k,u.push(y.x,y.y,y.z),v.set(O,x,k).normalize(),d.push(v.x,v.y,v.z),f.push(T,1-C),S.push(p++)}m.push(S)}for(a=0;a<r;a++)for(_=0;_<i;_++){var A=m[_][a],j=m[_+1][a],M=m[_+1][a+1],N=m[_][a+1];l.push(A,j,N),l.push(j,M,N),b+=6}c.addGroup(g,b,0),g+=b}function v(n){var i,a,m,_=new b,v=new D,y=0,x=n===!0?e:t,S=n===!0?1:-1;for(a=p,i=1;i<=r;i++)u.push(0,h*S,0),d.push(0,S,0),f.push(.5,.5),p++;for(m=p,i=0;i<=r;i++){var C=i/r*s+o,w=Math.cos(C),T=Math.sin(C);v.x=x*T,v.y=h*S,v.z=x*w,u.push(v.x,v.y,v.z),d.push(0,S,0),_.x=w*.5+.5,_.y=T*.5*S+.5,f.push(_.x,_.y),p++}for(i=0;i<r;i++){var E=a+i,O=m+i;n===!0?l.push(O,O+1,E):l.push(O+1,O,E),y+=3}c.addGroup(g,y,n===!0?1:2),g+=y}}function si(e,t,n,r,i,a,o){ai.call(this,0,e,t,n,r,i,a,o),this.type=`ConeGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function ci(e,t,n,r,i,a,o){oi.call(this,0,e,t,n,r,i,a,o),this.type=`ConeBufferGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function li(e,t,n,r){J.call(this),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new ui(e,t,n,r)),this.mergeVertices()}function ui(e,t,n,r){q.call(this),this.type=`CircleBufferGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=t===void 0?8:Math.max(3,t),n=n===void 0?0:n,r=r===void 0?Math.PI*2:r;var i=[],a=[],o=[],s=[],c,l,u=new D,d=new b;for(a.push(0,0,0),o.push(0,0,1),s.push(.5,.5),l=0,c=3;l<=t;l++,c+=3){var f=n+l/t*r;u.x=e*Math.cos(f),u.y=e*Math.sin(f),a.push(u.x,u.y,u.z),o.push(0,0,1),d.x=(a[c]/e+1)/2,d.y=(a[c+1]/e+1)/2,s.push(d.x,d.y)}for(c=1;c<=t;c++)i.push(c,c+1,0);this.setIndex(i),this.setAttribute(`position`,new K(a,3)),this.setAttribute(`normal`,new K(o,3)),this.setAttribute(`uv`,new K(s,2))}function di(e){V.call(this),this.type=`ShadowMaterial`,this.color=new z(0),this.transparent=!0,this.setValues(e)}function fi(e){ge.call(this,e),this.type=`RawShaderMaterial`}function pi(e){V.call(this),this.defines={STANDARD:``},this.type=`MeshStandardMaterial`,this.color=new z(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function mi(e){pi.call(this),this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new b(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function hi(e){V.call(this),this.type=`MeshPhongMaterial`,this.color=new z(16777215),this.specular=new z(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function gi(e){V.call(this),this.defines={TOON:``},this.type=`MeshToonMaterial`,this.color=new z(16777215),this.specular=new z(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function _i(e){V.call(this),this.type=`MeshNormalMaterial`,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function vi(e){V.call(this),this.type=`MeshLambertMaterial`,this.color=new z(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function yi(e){V.call(this),this.defines={MATCAP:``},this.type=`MeshMatcapMaterial`,this.color=new z(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function bi(e){Fn.call(this),this.type=`LineDashedMaterial`,this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function xi(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n}function Si(e,t,n,r){xi.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ci(e,t,n,r){xi.call(this,e,t,n,r)}function wi(e,t,n,r){xi.call(this,e,t,n,r)}function Ti(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=dd.convertArray(t,this.TimeBufferType),this.values=dd.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function Ei(e,t,n){Ti.call(this,e,t,n)}function Di(e,t,n,r){Ti.call(this,e,t,n,r)}function Oi(e,t,n,r){Ti.call(this,e,t,n,r)}function ki(e,t,n,r){xi.call(this,e,t,n,r)}function Ai(e,t,n,r){Ti.call(this,e,t,n,r)}function ji(e,t,n,r){Ti.call(this,e,t,n,r)}function Mi(e,t,n,r){Ti.call(this,e,t,n,r)}function Ni(e,t,n,r){this.name=e,this.tracks=n,this.duration=t===void 0?-1:t,this.blendMode=r===void 0?Zs:r,this.uuid=X.generateUUID(),this.duration<0&&this.resetDuration()}function Pi(e){switch(e.toLowerCase()){case`scalar`:case`double`:case`float`:case`number`:case`integer`:return Oi;case`vector`:case`vector2`:case`vector3`:case`vector4`:return Mi;case`color`:return Di;case`quaternion`:return Ai;case`bool`:case`boolean`:return Ei;case`string`:return ji}throw Error(`THREE.KeyframeTrack: Unsupported typeName: `+e)}function Fi(e){if(e.type===void 0)throw Error(`THREE.KeyframeTrack: track type undefined, can not parse`);var t=Pi(e.type);if(e.times===void 0){var n=[],r=[];dd.flattenJSON(e.keys,n,r,`value`),e.times=n,e.values=r}return t.parse===void 0?new t(e.name,e.times,e.values,e.interpolation):t.parse(e)}function Ii(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var r=c[t],i=c[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}}function Li(e){this.manager=e===void 0?pd:e,this.crossOrigin=`anonymous`,this.path=``,this.resourcePath=``,this.requestHeader={}}function Ri(e){Li.call(this,e)}function zi(e){Li.call(this,e)}function Bi(e){Li.call(this,e)}function Vi(e){Li.call(this,e)}function Hi(e){Li.call(this,e)}function Ui(e){Li.call(this,e)}function Wi(e){Li.call(this,e)}function Y(){this.type=`Curve`,this.arcLengthDivisions=200}function Gi(e,t,n,r,i,a,o,s){Y.call(this),this.type=`EllipseCurve`,this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Ki(e,t,n,r,i,a){Gi.call(this,e,t,n,n,r,i,a),this.type=`ArcCurve`}function qi(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){var c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){var a=i*i,o=a*i;return e+t*i+n*a+r*o}}}function Ji(e,t,n,r){Y.call(this),this.type=`CatmullRomCurve3`,this.points=e||[],this.closed=t||!1,this.curveType=n||`centripetal`,this.tension=r||.5}function Yi(e,t,n,r,i){var a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Xi(e,t){var n=1-e;return n*n*t}function Zi(e,t){return 2*(1-e)*e*t}function Qi(e,t){return e*e*t}function $i(e,t,n,r){return Xi(e,t)+Zi(e,n)+Qi(e,r)}function ea(e,t){var n=1-e;return n*n*n*t}function ta(e,t){var n=1-e;return 3*n*n*e*t}function na(e,t){return 3*(1-e)*e*e*t}function ra(e,t){return e*e*e*t}function ia(e,t,n,r,i){return ea(e,t)+ta(e,n)+na(e,r)+ra(e,i)}function aa(e,t,n,r){Y.call(this),this.type=`CubicBezierCurve`,this.v0=e||new b,this.v1=t||new b,this.v2=n||new b,this.v3=r||new b}function oa(e,t,n,r){Y.call(this),this.type=`CubicBezierCurve3`,this.v0=e||new D,this.v1=t||new D,this.v2=n||new D,this.v3=r||new D}function sa(e,t){Y.call(this),this.type=`LineCurve`,this.v1=e||new b,this.v2=t||new b}function ca(e,t){Y.call(this),this.type=`LineCurve3`,this.v1=e||new D,this.v2=t||new D}function la(e,t,n){Y.call(this),this.type=`QuadraticBezierCurve`,this.v0=e||new b,this.v1=t||new b,this.v2=n||new b}function ua(e,t,n){Y.call(this),this.type=`QuadraticBezierCurve3`,this.v0=e||new D,this.v1=t||new D,this.v2=n||new D}function da(e){Y.call(this),this.type=`SplineCurve`,this.points=e||[]}function fa(){Y.call(this),this.type=`CurvePath`,this.curves=[],this.autoClose=!1}function pa(e){fa.call(this),this.type=`Path`,this.currentPoint=new b,e&&this.setFromPoints(e)}function ma(e){pa.call(this,e),this.uuid=X.generateUUID(),this.type=`Shape`,this.holes=[]}function ha(e,t){j.call(this),this.type=`Light`,this.color=new z(e),this.intensity=t===void 0?1:t,this.receiveShadow=void 0}function ga(e,t,n){ha.call(this,e,n),this.type=`HemisphereLight`,this.castShadow=void 0,this.position.copy(j.DefaultUp),this.updateMatrix(),this.groundColor=new z(t)}function _a(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new b(512,512),this.map=null,this.mapPass=null,this.matrix=new O,this._frustum=new Se,this._frameExtents=new b(1,1),this._viewportCount=1,this._viewports=[new C(0,0,1,1)]}function va(){_a.call(this,new ve(50,1,.5,500))}function ya(e,t,n,r,i,a){ha.call(this,e,t),this.type=`SpotLight`,this.position.copy(j.DefaultUp),this.updateMatrix(),this.target=new j,Object.defineProperty(this,`power`,{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=n===void 0?0:n,this.angle=r===void 0?Math.PI/3:r,this.penumbra=i===void 0?0:i,this.decay=a===void 0?1:a,this.shadow=new va}function ba(){_a.call(this,new ve(90,1,.5,500)),this._frameExtents=new b(4,2),this._viewportCount=6,this._viewports=[new C(2,1,1,1),new C(0,1,1,1),new C(3,1,1,1),new C(1,1,1,1),new C(3,0,1,1),new C(1,0,1,1)],this._cubeDirections=[new D(1,0,0),new D(-1,0,0),new D(0,0,1),new D(0,0,-1),new D(0,1,0),new D(0,-1,0)],this._cubeUps=[new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,0,1),new D(0,0,-1)]}function xa(e,t,n,r){ha.call(this,e,t),this.type=`PointLight`,Object.defineProperty(this,`power`,{get:function(){return this.intensity*4*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=n===void 0?0:n,this.decay=r===void 0?1:r,this.shadow=new ba}function Sa(e,t,n,r,i,a){_e.call(this),this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e===void 0?-1:e,this.right=t===void 0?1:t,this.top=n===void 0?1:n,this.bottom=r===void 0?-1:r,this.near=i===void 0?.1:i,this.far=a===void 0?2e3:a,this.updateProjectionMatrix()}function Ca(){_a.call(this,new Sa(-5,5,5,-5,.5,500))}function wa(e,t){ha.call(this,e,t),this.type=`DirectionalLight`,this.position.copy(j.DefaultUp),this.updateMatrix(),this.target=new j,this.shadow=new Ca}function Ta(e,t){ha.call(this,e,t),this.type=`AmbientLight`,this.castShadow=void 0}function Ea(e,t,n,r){ha.call(this,e,t),this.type=`RectAreaLight`,this.width=n===void 0?10:n,this.height=r===void 0?10:r}function Da(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new D)}function Oa(e,t){ha.call(this,void 0,t),this.type=`LightProbe`,this.sh=e===void 0?new Da:e}function ka(e){Li.call(this,e),this.textures={}}function Aa(){q.call(this),this.type=`InstancedBufferGeometry`,this.instanceCount=1/0}function ja(e,t,n,r){typeof n==`number`&&(r=n,n=!1,console.error(`THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.`)),H.call(this,e,t,n),this.meshPerAttribute=r||1}function Ma(e){Li.call(this,e)}function Na(e){Li.call(this,e)}function Pa(e){typeof createImageBitmap>`u`&&console.warn(`THREE.ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&console.warn(`THREE.ImageBitmapLoader: fetch() not supported.`),Li.call(this,e),this.options=void 0}function Fa(){this.type=`ShapePath`,this.color=new z,this.subPaths=[],this.currentPath=null}function Ia(e){this.type=`Font`,this.data=e}function La(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(``),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l<r.length;l++){var u=r[l];if(u===`\n`)s=0,c-=a;else{var d=Ra(u,i,s,c,n);s+=d.offsetX,o.push(d.path)}}return o}function Ra(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs[`?`];if(!a){console.error(`THREE.Font: character "`+e+`" does not exists in font family `+i.familyName+`.`);return}var o=new Fa,s,c,l,u,d,f,p,m;if(a.o)for(var h=a._cachedOutline||(a._cachedOutline=a.o.split(` `)),g=0,_=h.length;g<_;)switch(h[g++]){case`m`:s=h[g++]*t+n,c=h[g++]*t+r,o.moveTo(s,c);break;case`l`:s=h[g++]*t+n,c=h[g++]*t+r,o.lineTo(s,c);break;case`q`:l=h[g++]*t+n,u=h[g++]*t+r,d=h[g++]*t+n,f=h[g++]*t+r,o.quadraticCurveTo(d,f,l,u);break;case`b`:l=h[g++]*t+n,u=h[g++]*t+r,d=h[g++]*t+n,f=h[g++]*t+r,p=h[g++]*t+n,m=h[g++]*t+r,o.bezierCurveTo(d,f,p,m,l,u);break}return{offsetX:a.ha*t,path:o}}function za(e){Li.call(this,e)}function Ba(e){Li.call(this,e)}function Va(e,t,n){Oa.call(this,void 0,n);var r=new z().set(e),i=new z().set(t),a=new D(r.r,r.g,r.b),o=new D(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function Ha(e,t){Oa.call(this,void 0,t);var n=new z().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Ua(){this.type=`StereoCamera`,this.aspect=1,this.eyeSep=.064,this.cameraL=new ve,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ve,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function Wa(e){this.autoStart=e===void 0?!0:e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Ga(){j.call(this),this.type=`AudioListener`,this.context=Ed.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Wa}function Ka(e){j.call(this),this.type=`Audio`,this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType=`empty`,this._startedAt=0,this._progress=0,this.filters=[]}function qa(e){Ka.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel=`HRTF`,this.panner.connect(this.gain)}function Ja(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t===void 0?2048:t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Ya(e,t,n){this.binding=e,this.valueSize=n;var r,i,a;switch(t){case`quaternion`:r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case`string`:case`bool`:r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(n*5);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}function Xa(e,t,n){var r=n||Za.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function Za(e,t,n){this.path=t,this.parsedPath=n||Za.parseTrackName(t),this.node=Za.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Qa(){this.uuid=X.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function $a(e,t,n,r){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=r||t.blendMode;for(var i=t.tracks,a=i.length,o=Array(a),s={endingStart:Js,endingEnd:Js},c=0;c!==a;++c){var l=i[c].createInterpolant(null);o[c]=l,l.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Us,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function eo(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function to(e){typeof e==`string`&&(console.warn(`THREE.Uniform: Type parameter is no longer needed.`),e=arguments[1]),this.value=e}function no(e,t,n){Tn.call(this,e,t),this.meshPerAttribute=n||1}function ro(e,t,n,r){this.ray=new I(e,t),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new A,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn(`THREE.Raycaster: params.PointCloud has been renamed to params.Points.`),this.Points}}})}function io(e,t){return e.distance-t.distance}function ao(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),r===!0)for(var i=e.children,a=0,o=i.length;a<o;a++)ao(i[a],t,n,!0)}function oo(e,t,n){return this.radius=e===void 0?1:e,this.phi=t===void 0?0:t,this.theta=n===void 0?0:n,this}function so(e,t,n){return this.radius=e===void 0?1:e,this.theta=t===void 0?0:t,this.y=n===void 0?0:n,this}function co(e,t){this.min=e===void 0?new b(1/0,1/0):e,this.max=t===void 0?new b(-1/0,-1/0):t}function lo(e,t){this.start=e===void 0?new D:e,this.end=t===void 0?new D:t}function uo(e){j.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}function fo(e,t){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new q,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,a=1,o=32;i<o;i++,a++){var s=i/o*Math.PI*2,c=a/o*Math.PI*2;r.push(Math.cos(s),Math.sin(s),1,Math.cos(c),Math.sin(c),1)}n.setAttribute(`position`,new K(r,3));var l=new Fn({fog:!1,toneMapped:!1});this.cone=new Ln(n,l),this.add(this.cone),this.update()}function po(e){var t=[];e&&e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,po(e.children[n]));return t}function mo(e){for(var t=po(e),n=new q,r=[],i=[],a=new z(0,0,1),o=new z(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.setAttribute(`position`,new K(r,3)),n.setAttribute(`color`,new K(i,3));var l=new Fn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Ln.call(this,n,l),this.type=`SkeletonHelper`,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function ho(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new Xr(t,4,2),i=new re({wireframe:!0,fog:!1,toneMapped:!1});de.call(this,r,i),this.type=`PointLightHelper`,this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function go(e,t,n){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new er(t);r.rotateY(Math.PI*.5),this.material=new re({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);var i=r.getAttribute(`position`),a=new Float32Array(i.count*3);r.setAttribute(`color`,new H(a,3)),this.add(new de(r,this.material)),this.update()}function _o(e,t,n,r){e=e||10,t=t||10,n=new z(n===void 0?4473924:n),r=new z(r===void 0?8947848:r);for(var i=t/2,a=e/t,o=e/2,s=[],c=[],l=0,u=0,d=-o;l<=t;l++,d+=a){s.push(-o,0,d,o,0,d),s.push(d,0,-o,d,0,o);var f=l===i?n:r;f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3}var p=new q;p.setAttribute(`position`,new K(s,3)),p.setAttribute(`color`,new K(c,3));var m=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,p,m),this.type=`GridHelper`}function vo(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new z(i===void 0?4473924:i),a=new z(a===void 0?8947848:a);var o=[],s=[],c,l,u,d,f,p,m;for(d=0;d<=t;d++)u=d/t*(Math.PI*2),c=Math.sin(u)*e,l=Math.cos(u)*e,o.push(0,0,0),o.push(c,0,l),m=d&1?i:a,s.push(m.r,m.g,m.b),s.push(m.r,m.g,m.b);for(d=0;d<=n;d++)for(m=d&1?i:a,p=e-e/n*d,f=0;f<r;f++)u=f/r*(Math.PI*2),c=Math.sin(u)*p,l=Math.cos(u)*p,o.push(c,0,l),s.push(m.r,m.g,m.b),u=(f+1)/r*(Math.PI*2),c=Math.sin(u)*p,l=Math.cos(u)*p,o.push(c,0,l),s.push(m.r,m.g,m.b);var h=new q;h.setAttribute(`position`,new K(o,3)),h.setAttribute(`color`,new K(s,3));var g=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,h,g),this.type=`PolarGridHelper`}function yo(e,t,n){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);var r=new q;r.setAttribute(`position`,new K([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new Fn({fog:!1,toneMapped:!1});this.lightPlane=new In(r,i),this.add(this.lightPlane),r=new q,r.setAttribute(`position`,new K([0,0,0,0,0,1],3)),this.targetLine=new In(r,i),this.add(this.targetLine),this.update()}function bo(e){var t=new q,n=new Fn({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],a={},o=new z(16755200),s=new z(16711680),c=new z(43775),l=new z(16777215),u=new z(3355443);d(`n1`,`n2`,o),d(`n2`,`n4`,o),d(`n4`,`n3`,o),d(`n3`,`n1`,o),d(`f1`,`f2`,o),d(`f2`,`f4`,o),d(`f4`,`f3`,o),d(`f3`,`f1`,o),d(`n1`,`f1`,o),d(`n2`,`f2`,o),d(`n3`,`f3`,o),d(`n4`,`f4`,o),d(`p`,`n1`,s),d(`p`,`n2`,s),d(`p`,`n3`,s),d(`p`,`n4`,s),d(`u1`,`u2`,c),d(`u2`,`u3`,c),d(`u3`,`u1`,c),d(`c`,`t`,l),d(`p`,`c`,u),d(`cn1`,`cn2`,u),d(`cn3`,`cn4`,u),d(`cf1`,`cf2`,u),d(`cf3`,`cf4`,u);function d(e,t,n){f(e,n),f(t,n)}function f(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),a[e]===void 0&&(a[e]=[]),a[e].push(r.length/3-1)}t.setAttribute(`position`,new K(r,3)),t.setAttribute(`color`,new K(i,3)),Ln.call(this,t,n),this.type=`CameraHelper`,this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function xo(e,t,n,r,i,a,o){sf.set(i,a,o).unproject(r);var s=t[e];if(s!==void 0)for(var c=n.getAttribute(`position`),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],sf.x,sf.y,sf.z)}function So(e,t){this.object=e,t===void 0&&(t=16776960);var n=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]),r=new Float32Array(24),i=new q;i.setIndex(new H(n,1)),i.setAttribute(`position`,new H(r,3)),Ln.call(this,i,new Fn({color:t,toneMapped:!1})),this.type=`BoxHelper`,this.matrixAutoUpdate=!1,this.update()}function Co(e,t){this.type=`Box3Helper`,this.box=e,t=t||16776960;var n=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]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],i=new q;i.setIndex(new H(n,1)),i.setAttribute(`position`,new K(r,3)),Ln.call(this,i,new Fn({color:t,toneMapped:!1})),this.type=`Box3Helper`,this.geometry.computeBoundingSphere()}function wo(e,t,n){this.plane=e,this.size=t===void 0?1:t;var r=n===void 0?16776960:n,i=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],a=new q;a.setAttribute(`position`,new K(i,3)),a.computeBoundingSphere(),In.call(this,a,new Fn({color:r,toneMapped:!1})),this.type=`PlaneHelper`;var o=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],s=new q;s.setAttribute(`position`,new K(o,3)),s.computeBoundingSphere(),this.add(new de(s,new re({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}function To(e,t,n,r,i,a){j.call(this),this.type=`ArrowHelper`,e===void 0&&(e=new D(0,0,1)),t===void 0&&(t=new D(0,0,0)),n===void 0&&(n=1),r===void 0&&(r=16776960),i===void 0&&(i=.2*n),a===void 0&&(a=.2*i),df===void 0&&(df=new q,df.setAttribute(`position`,new K([0,0,0,0,1,0],3)),ff=new oi(0,.5,1,5,1),ff.translate(0,-.5,0)),this.position.copy(t),this.line=new In(df,new Fn({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new de(ff,new re({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}function Eo(e){e=e||1;var t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new q;r.setAttribute(`position`,new K(t,3)),r.setAttribute(`color`,new K(n,3));var i=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,r,i),this.type=`AxesHelper`}function Do(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=Mo(vf),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}function Oo(e){return e===void 0||e.type!==1009?!1:e.encoding===3e3||e.encoding===3001||e.encoding===3007}function ko(){for(var e=[],t=[],n=[],r=mf,i=0;i<_f;i++){var a=Math.pow(2,r);t.push(a);var o=1/a;i>mf-pf?o=gf[i-mf+pf-1]:i==0&&(o=0),n.push(o);for(var s=1/(a-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],d=6,f=6,p=3,m=2,h=1,g=new Float32Array(p*f*d),_=new Float32Array(m*f*d),v=new Float32Array(h*f*d),y=0;y<d;y++){var b=y%3*2/3-1,x=y>2?0:-1,S=[b,x,0,b+2/3,x,0,b+2/3,x+1,0,b,x,0,b+2/3,x+1,0,b,x+1,0];g.set(S,p*f*y),_.set(u,m*f*y);var C=[y,y,y,y,y,y];v.set(C,h*f*y)}var w=new q;w.setAttribute(`position`,new H(g,p)),w.setAttribute(`uv`,new H(_,m)),w.setAttribute(`faceIndex`,new H(v,h)),e.push(w),r>pf&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function Ao(e){var t=new w(3*hf,3*hf,e);return t.texture.mapping=306,t.texture.name=`PMREM.cubeUv`,t.scissorTest=!0,t}function jo(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Mo(e){var t=new Float32Array(e),n=new D(0,1,0),r=new fi({defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${Io()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvec3 getSample(float theta, vec3 axis) {\n float cosTheta = cos(theta);\n // Rodrigues\' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross(axis, vOutputDirection) * sin(theta)\n + axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n return bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n vec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n if (all(equal(axis, vec3(0.0))))\n axis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n axis = normalize(axis);\n gl_FragColor = vec4(0.0);\n gl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n for (int i = 1; i < n; i++) {\n if (i >= samples)\n break;\n float theta = dTheta * float(i);\n gl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n gl_FragColor.rgb += weights[i] * getSample(theta, axis);\n }\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return r.type=`SphericalGaussianBlur`,r}function No(){var e=new fi({uniforms:{envMap:{value:null},texelSize:{value:new b(1,1)},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${Io()}\n\n#include <common>\n\nvoid main() {\n gl_FragColor = vec4(0.0);\n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv( outputDirection );\n vec2 f = fract(uv / texelSize - 0.5);\n uv -= f * texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize.x;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize.y;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize.x;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n gl_FragColor.rgb = mix(tm, bm, f.y);\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return e.type=`EquirectangularToCubeUV`,e}function Po(){var e=new fi({uniforms:{envMap:{value:null},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${Io()}\n\nvoid main() {\n gl_FragColor = vec4(0.0);\n gl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return e.type=`CubemapToCubeUV`,e}function Fo(){return`\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection(vec2 uv, float face) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3(uv, 1.0);\n if (face == 0.0) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if (face == 1.0) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if (face == 2.0) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if (face == 3.0) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if (face == 4.0) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if (face == 5.0) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = getDirection(uv, faceIndex);\n gl_Position = vec4( position, 1.0 );\n}\n `}function Io(){return`\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n if(inputEncoding == 0){\n return value;\n }else if(inputEncoding == 1){\n return sRGBToLinear(value);\n }else if(inputEncoding == 2){\n return RGBEToLinear(value);\n }else if(inputEncoding == 3){\n return RGBMToLinear(value, 7.0);\n }else if(inputEncoding == 4){\n return RGBMToLinear(value, 16.0);\n }else if(inputEncoding == 5){\n return RGBDToLinear(value, 256.0);\n }else{\n return GammaToLinear(value, 2.2);\n }\n}\n\nvec4 linearToOutputTexel(vec4 value){\n if(outputEncoding == 0){\n return value;\n }else if(outputEncoding == 1){\n return LinearTosRGB(value);\n }else if(outputEncoding == 2){\n return LinearToRGBE(value);\n }else if(outputEncoding == 3){\n return LinearToRGBM(value, 7.0);\n }else if(outputEncoding == 4){\n return LinearToRGBM(value, 16.0);\n }else if(outputEncoding == 5){\n return LinearToRGBD(value, 256.0);\n }else{\n return LinearToGamma(value, 2.2);\n }\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n return inputTexelToLinear(color);\n}\n `}function Lo(e){console.warn(`THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`,this.closed=!0}function Ro(e){console.warn(`THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`}function zo(e){console.warn(`THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`}var Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,fc,pc,X,mc,hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc,$c,el,tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,ml,hl,gl,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,Z,Q,lu,uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu,Fu,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu,Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed,Dd,Od,kd,Ad,jd,Md,Nd,Pd,Fd,Id,Ld,Rd,zd,Bd,Vd,Hd,Ud,Wd,Gd,Kd,qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf,rf,af,of,sf,cf,lf,uf,df,ff,pf,mf,hf,gf,_f,vf,yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of=e((()=>{for(Number.EPSILON===void 0&&(Number.EPSILON=Math.pow(2,-52)),Number.isInteger===void 0&&(Number.isInteger=function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e}),Math.sign===void 0&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),(`name`in Function.prototype)||Object.defineProperty(Function.prototype,`name`,{get:function(){return this.toString().match(/^\\s*function\\s*([^\\(\\s]*)/)[1]}}),Object.assign===void 0&&(Object.assign=function(e){if(e==null)throw TypeError(`Cannot convert undefined or null to object`);let t=Object(e);for(let e=1;e<arguments.length;e++){let n=arguments[e];if(n!=null)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t}),Bo=1e3,Vo=1001,Ho=1002,Uo=1003,Wo=1004,Go=1005,Ko=1006,qo=1007,Jo=1008,Yo=1009,Xo=1012,Zo=1015,Qo=1020,$o=1022,es=1023,ts=es,ns=1026,rs=33776,is=33777,as=33778,os=33779,ss=35840,cs=35841,ls=35842,us=35843,ds=36196,fs=37492,ps=37496,ms=37808,hs=37809,gs=37810,_s=37811,vs=37812,ys=37813,bs=37814,xs=37815,Ss=37816,Cs=37817,ws=37818,Ts=37819,Es=37820,Ds=37821,Os=36492,ks=37840,As=37841,js=37842,Ms=37843,Ns=37844,Ps=37845,Fs=37846,Is=37847,Ls=37848,Rs=37849,zs=37850,Bs=37851,Vs=37852,Hs=37853,Us=2201,Ws=2202,Gs=2300,Ks=2301,qs=2302,Js=2400,Ys=2401,Xs=2402,Zs=2500,Qs=2501,$s=3e3,ec=3001,tc=3007,nc=3002,rc=3003,ic=3004,ac=3005,oc=3006,sc=3200,cc=3201,lc=7680,uc=35044,dc=35048,Object.assign(y.prototype,{addEventListener:function(e,t){this._listeners===void 0&&(this._listeners={});var n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)},hasEventListener:function(e,t){if(this._listeners===void 0)return!1;var n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1},removeEventListener:function(e,t){if(this._listeners!==void 0){var n=this._listeners[e];if(n!==void 0){var r=n.indexOf(t);r!==-1&&n.splice(r,1)}}},dispatchEvent:function(e){if(this._listeners!==void 0){var t=this._listeners[e.type];if(t!==void 0){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e)}}}}),fc=[],pc=0;pc<256;pc++)fc[pc]=(pc<16?`0`:``)+pc.toString(16);X={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(fc[e&255]+fc[e>>8&255]+fc[e>>16&255]+fc[e>>24&255]+`-`+fc[t&255]+fc[t>>8&255]+`-`+fc[t>>16&15|64]+fc[t>>24&255]+`-`+fc[n&63|128]+fc[n>>8&255]+`-`+fc[n>>16&255]+fc[n>>24&255]+fc[r&255]+fc[r>>8&255]+fc[r>>16&255]+fc[r>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*X.DEG2RAD},radToDeg:function(e){return e*X.RAD2DEG},isPowerOfTwo:function(e){return(e&e-1)==0&&e!==0},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:console.warn(`THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}},Object.defineProperties(b.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(b.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this):(console.warn(`THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this):(console.warn(`THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector2: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(x.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return new this.constructor().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s},getInverse:function(e,t){t!==void 0&&console.warn(`THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.`);var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],d=n[7],f=n[8],p=f*c-l*d,m=l*u-f*s,h=d*s-c*u,g=i*p+a*m+o*h;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);var _=1/g;return r[0]=p*_,r[1]=(o*d-f*a)*_,r[2]=(l*a-o*c)*_,r[3]=m*_,r[4]=(f*i-o*u)*_,r[5]=(o*s-l*i)*_,r[6]=h*_,r[7]=(a*u-d*i)*_,r[8]=(c*i-a*s)*_,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*c,r[6]=t*o+n*l,r[1]=-n*i+t*s,r[4]=-n*a+t*c,r[7]=-n*o+t*l,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}}),hc={getDataURL:function(e){var t;if(typeof HTMLCanvasElement>`u`)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{mc===void 0&&(mc=document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`)),mc.width=e.width,mc.height=e.height;var n=mc.getContext(`2d`);e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=mc}return t.width>2048||t.height>2048?t.toDataURL(`image/jpeg`,.6):t.toDataURL(`image/png`)}},gc=0,S.DEFAULT_IMAGE=void 0,S.DEFAULT_MAPPING=300,S.prototype=Object.assign(Object.create(y.prototype),{constructor:S,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];var n={metadata:{version:4.5,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){var r=this.image;if(r.uuid===void 0&&(r.uuid=X.generateUUID()),!t&&e.images[r.uuid]===void 0){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(hc.getDataURL(r[a]))}else i=hc.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:`dispose`})},transformUv:function(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Bo:e.x-=Math.floor(e.x);break;case Vo:e.x=e.x<0?0:1;break;case Ho:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Bo:e.y-=Math.floor(e.y);break;case Vo:e.y=e.y<0?0:1;break;case Ho:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(S.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.defineProperties(C.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(C.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this):(console.warn(`THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this):(console.warn(`THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var _=(c+1)/2,v=(f+1)/2,y=(g+1)/2,b=(l+d)/4,x=(u+m)/4,S=(p+h)/4;return _>v&&_>y?_<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(_),r=b/n,i=x/n):v>y?v<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),n=b/r,i=S/r):y<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(y),n=x/i,r=S/i),this.set(n,r,i,t),this}var C=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(C)<.001&&(C=1),this.x=(h-p)/C,this.y=(u-m)/C,this.z=(d-l)/C,this.w=Math.acos((c+f+g-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector4: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),w.prototype=Object.assign(Object.create(y.prototype),{constructor:w,isWebGLRenderTarget:!0,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),T.prototype=Object.assign(Object.create(w.prototype),{constructor:T,isWebGLMultisampleRenderTarget:!0,copy:function(e){return w.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(E,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){var h=1-o,g=s*d+c*f+l*p+u*m,_=g>=0?1:-1,v=1-g*g;if(v>Number.EPSILON){var y=Math.sqrt(v),b=Math.atan2(y,g*_);h=Math.sin(h*b)/y,o=Math.sin(o*b)/y}var x=o*_;if(s=s*h+d*x,c=c*h+f*x,l=l*h+p*x,u=u*h+m*x,h===1-o){var S=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=S,c*=S,l*=S,u*=S}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u},multiplyQuaternionsFlat:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}}),Object.defineProperties(E.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(E.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!(e&&e.isEuler))throw Error(`THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.`);var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t!==!1&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u,f;return d>0?(f=.5/Math.sqrt(d+1),this._w=.25/f,this._x=(l-s)*f,this._y=(i-c)*f,this._z=(a-r)*f):n>o&&n>u?(f=2*Math.sqrt(1+n-o-u),this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+c)/f):o>u?(f=2*Math.sqrt(1+o-n-u),this._w=(i-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+l)/f):(f=2*Math.sqrt(1+u-n-o),this._w=(a-r)/f,this._x=(i+c)/f,this._y=(s+l)/f,this._z=.25*f),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=1e-6,r=e.dot(t)+1;return r<n?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(X.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(n===0)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this},multiply:function(e,t){return t===void 0?this.multiplyQuaternions(this,e):(console.warn(`THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.`),this.multiplyQuaternions(e,t))},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this},slerp:function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*r+t*this._y,this._z=c*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),d=Math.sin((1-t)*u)/l,f=Math.sin(t*u)/l;return this._w=a*d+this._w*f,this._x=n*d+this._x*f,this._y=r*d+this._y*f,this._z=i*d+this._z*f,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return t===void 0&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),_c=new D,vc=new E,Object.assign(D.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this):(console.warn(`THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this):(console.warn(`THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return t===void 0?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this):(console.warn(`THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.`),this.multiplyVectors(e,t))},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error(`THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.`),this.applyQuaternion(vc.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(vc.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*n,l=s*n+o*t-i*r,u=s*r+i*n-a*t,d=-i*t-a*n-o*r;return this.x=c*s+d*-i+l*-o-u*-a,this.y=l*s+d*-a+u*-i-c*-o,this.z=u*s+d*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},cross:function(e,t){return t===void 0?this.crossVectors(this,e):(console.warn(`THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.`),this.crossVectors(e,t))},crossVectors:function(e,t){var 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},projectOnVector:function(e){var t=e.lengthSq();if(t===0)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return _c.copy(this).projectOnVector(e),this.sub(_c)},reflect:function(e){return this.sub(_c.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(X.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,t*4)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,t*3)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector3: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}),yc=new D,bc=new O,xc=new D(0,0,0),Sc=new D(1,1,1),Cc=new D,wc=new D,Tc=new D,Object.assign(O.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return new O().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,r=1/yc.setFromMatrixColumn(e,0).length(),i=1/yc.setFromMatrixColumn(e,1).length(),a=1/yc.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error(`THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.`);var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){var d=a*l,f=a*u,p=o*l,m=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=f+p*c,t[5]=d-m*c,t[9]=-o*s,t[2]=m-d*c,t[6]=p+f*c,t[10]=a*s}else if(e.order===`YXZ`){var h=s*l,g=s*u,_=c*l,v=c*u;t[0]=h+v*o,t[4]=_*o-g,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=g*o-_,t[6]=v+h*o,t[10]=a*s}else if(e.order===`ZXY`){var h=s*l,g=s*u,_=c*l,v=c*u;t[0]=h-v*o,t[4]=-a*u,t[8]=_+g*o,t[1]=g+_*o,t[5]=a*l,t[9]=v-h*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){var d=a*l,f=a*u,p=o*l,m=o*u;t[0]=s*l,t[4]=p*c-f,t[8]=d*c+m,t[1]=s*u,t[5]=m*c+d,t[9]=f*c-p,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){var y=a*s,b=a*c,x=o*s,S=o*c;t[0]=s*l,t[4]=S-y*u,t[8]=x*u+b,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*u+x,t[10]=y-S*u}else if(e.order===`XZY`){var y=a*s,b=a*c,x=o*s,S=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=y*u+S,t[5]=a*l,t[9]=b*u-x,t[2]=x*u-b,t[6]=o*l,t[10]=S*u+y}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(xc,e,Sc)},lookAt:function(e,t,n){var r=this.elements;return Tc.subVectors(e,t),Tc.lengthSq()===0&&(Tc.z=1),Tc.normalize(),Cc.crossVectors(n,Tc),Cc.lengthSq()===0&&(Math.abs(n.z)===1?Tc.x+=1e-4:Tc.z+=1e-4,Tc.normalize(),Cc.crossVectors(n,Tc)),Cc.normalize(),wc.crossVectors(Tc,Cc),r[0]=Cc.x,r[4]=wc.x,r[8]=Tc.x,r[1]=Cc.y,r[5]=wc.y,r[9]=Tc.y,r[2]=Cc.z,r[6]=wc.z,r[10]=Tc.z,this},multiply:function(e,t){return t===void 0?this.multiplyMatrices(this,e):(console.warn(`THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.`),this.multiplyMatrices(e,t))},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)},transpose:function(){var e=this.elements,t=e[1];return e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this},getInverse:function(e,t){t!==void 0&&console.warn(`THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.`);var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15],b=p*v*d-_*m*d+_*u*h-l*v*h-p*u*y+l*m*y,x=g*m*d-f*v*d-g*u*h+c*v*h+f*u*y-c*m*y,S=f*_*d-g*p*d+g*l*h-c*_*h-f*l*y+c*p*y,C=g*p*u-f*_*u-g*l*m+c*_*m+f*l*v-c*p*v,w=i*b+a*x+o*S+s*C;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/w;return n[0]=b*T,n[1]=(_*m*s-p*v*s-_*o*h+a*v*h+p*o*y-a*m*y)*T,n[2]=(l*v*s-_*u*s+_*o*d-a*v*d-l*o*y+a*u*y)*T,n[3]=(p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h)*T,n[4]=x*T,n[5]=(f*v*s-g*m*s+g*o*h-i*v*h-f*o*y+i*m*y)*T,n[6]=(g*u*s-c*v*s-g*o*d+i*v*d+c*o*y-i*u*y)*T,n[7]=(c*m*s-f*u*s+f*o*d-i*m*d-c*o*h+i*u*h)*T,n[8]=S*T,n[9]=(g*p*s-f*_*s-g*a*h+i*_*h+f*a*y-i*p*y)*T,n[10]=(c*_*s-g*l*s+g*a*d-i*_*d-c*a*y+i*l*y)*T,n[11]=(f*l*s-c*p*s-f*a*d+i*p*d+c*a*h-i*l*h)*T,n[12]=C*T,n[13]=(f*_*o-g*p*o+g*a*m-i*_*m-f*a*v+i*p*v)*T,n[14]=(g*l*o-c*_*o-g*a*u+i*_*u+c*a*v-i*l*v)*T,n[15]=(c*p*o-f*l*o+f*a*u-i*p*u-c*a*m+i*l*m)*T,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:function(e,t,n){var r=this.elements,i=yc.set(r[0],r[1],r[2]).length(),a=yc.set(r[4],r[5],r[6]).length(),o=yc.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],bc.copy(this);var s=1/i,c=1/a,l=1/o;return bc.elements[0]*=s,bc.elements[1]*=s,bc.elements[2]*=s,bc.elements[4]*=c,bc.elements[5]*=c,bc.elements[6]*=c,bc.elements[8]*=l,bc.elements[9]*=l,bc.elements[10]*=l,t.setFromRotationMatrix(bc),n.x=i,n.y=a,n.z=o,this},makePerspective:function(e,t,n,r,i,a){a===void 0&&console.warn(`THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.`);var o=this.elements,s=2*i/(t-e),c=2*i/(n-r),l=(t+e)/(t-e),u=(n+r)/(n-r),d=-(a+i)/(a-i),f=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=f,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),c=1/(n-r),l=1/(a-i),u=(t+e)*s,d=(n+r)*c,f=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-f,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}),Ec=new O,Dc=new E,k.RotationOrders=[`XYZ`,`YZX`,`ZXY`,`XZY`,`YXZ`,`ZYX`],k.DefaultOrder=`XYZ`,Object.defineProperties(k.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(k.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=X.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],d=i[2],f=i[6],p=i[10];switch(t=t||this._order,t){case`XYZ`:this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(f,l),this._z=0);break;case`YXZ`:this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-d,a),this._z=0);break;case`ZXY`:this._x=Math.asin(r(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a));break;case`ZYX`:this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l));break;case`YZX`:this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(s,p));break;case`XZY`:this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn(`THREE.Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n!==!1&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return Ec.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ec,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return Dc.setFromEuler(this),this.setFromQuaternion(Dc,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new D(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(A.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return(this.mask&e.mask)!==0}}),Oc=0,kc=new D,Ac=new E,jc=new O,Mc=new D,Nc=new D,Pc=new D,Fc=new E,Ic=new D(1,0,0),Lc=new D(0,1,0),Rc=new D(0,0,1),zc={type:`added`},Bc={type:`removed`},j.DefaultUp=new D(0,1,0),j.DefaultMatrixAutoUpdate=!0,j.prototype=Object.assign(Object.create(y.prototype),{constructor:j,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return Ac.setFromAxisAngle(e,t),this.quaternion.multiply(Ac),this},rotateOnWorldAxis:function(e,t){return Ac.setFromAxisAngle(e,t),this.quaternion.premultiply(Ac),this},rotateX:function(e){return this.rotateOnAxis(Ic,e)},rotateY:function(e){return this.rotateOnAxis(Lc,e)},rotateZ:function(e){return this.rotateOnAxis(Rc,e)},translateOnAxis:function(e,t){return kc.copy(e).applyQuaternion(this.quaternion),this.position.add(kc.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(Ic,e)},translateY:function(e){return this.translateOnAxis(Lc,e)},translateZ:function(e){return this.translateOnAxis(Rc,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(jc.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?Mc.copy(e):Mc.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Nc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?jc.lookAt(Nc,Mc,this.up):jc.lookAt(Mc,Nc,this.up),this.quaternion.setFromRotationMatrix(jc),r&&(jc.extractRotation(r.matrixWorld),Ac.setFromRotationMatrix(jc),this.quaternion.premultiply(Ac.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error(`THREE.Object3D.add: object can\'t be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(zc)):console.error(`THREE.Object3D.add: object not an instance of THREE.Object3D.`,e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Bc)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),jc.getInverse(this.matrixWorld),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),jc.multiply(e.parent.matrixWorld)),e.applyMatrix4(jc),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty(`id`,e)},getObjectByName:function(e){return this.getObjectByProperty(`name`,e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(i!==void 0)return i}},getWorldPosition:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldPosition() target is now required`),e=new D),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldQuaternion() target is now required`),e=new E),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Nc,e,Pc),e},getWorldScale:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldScale() target is now required`),e=new D),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Nc,Fc,e),e},getWorldDirection:function(e){e===void 0&&(console.warn(`THREE.Object3D: .getWorldDirection() target is now required`),e=new D),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:`Object`,generator:`Object3D.toJSON`});var r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!==`{}`&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON());function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(this.material!==void 0)if(Array.isArray(this.material)){for(var u=[],s=0,c=this.material.length;s<c;s++)u.push(i(e.materials,this.material[s]));r.material=u}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(e).object)}if(t){var d=h(e.geometries),f=h(e.materials),p=h(e.textures),m=h(e.images),o=h(e.shapes);d.length>0&&(n.geometries=d),f.length>0&&(n.materials=f),p.length>0&&(n.textures=p),m.length>0&&(n.images=m),o.length>0&&(n.shapes=o)}return n.object=r,n;function h(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}},clone:function(e){return new this.constructor().copy(this,e)},copy:function(e,t){if(t===void 0&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}}),M.prototype=Object.assign(Object.create(j.prototype),{constructor:M,isScene:!0,copy:function(e,t){return j.prototype.copy.call(this,e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return this.background!==null&&(t.object.background=this.background.toJSON(e)),this.environment!==null&&(t.object.environment=this.environment.toJSON(e)),this.fog!==null&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Vc=[new D,new D,new D,new D,new D,new D,new D,new D],Hc=new D,Uc=new N,Wc=new D,Gc=new D,Kc=new D,qc=new D,Jc=new D,Yc=new D,Xc=new D,Zc=new D,Qc=new D,$c=new D,Object.assign(N.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],u=e[s+1],d=e[s+2];l<t&&(t=l),u<n&&(n=u),d<r&&(r=d),l>i&&(i=l),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),u=e.getY(s),d=e.getZ(s);l<t&&(t=l),u<n&&(n=u),d<r&&(r=d),l>i&&(i=l),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Hc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Box3: .getCenter() target is now required`),e=new D),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn(`THREE.Box3: .getSize() target is now required`),e=new D),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),Uc.copy(t.boundingBox),Uc.applyMatrix4(e.matrixWorld),this.union(Uc));for(var n=e.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return t===void 0&&(console.warn(`THREE.Box3: .getParameter() target is now required`),t=new D),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,Hc),Hc.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Xc),Zc.subVectors(this.max,Xc),Wc.subVectors(e.a,Xc),Gc.subVectors(e.b,Xc),Kc.subVectors(e.c,Xc),qc.subVectors(Gc,Wc),Jc.subVectors(Kc,Gc),Yc.subVectors(Wc,Kc);var t=[0,-qc.z,qc.y,0,-Jc.z,Jc.y,0,-Yc.z,Yc.y,qc.z,0,-qc.x,Jc.z,0,-Jc.x,Yc.z,0,-Yc.x,-qc.y,qc.x,0,-Jc.y,Jc.x,0,-Yc.y,Yc.x,0];return!P(t,Wc,Gc,Kc,Zc)||(t=[1,0,0,0,1,0,0,0,1],!P(t,Wc,Gc,Kc,Zc))?!1:(Qc.crossVectors(qc,Jc),t=[Qc.x,Qc.y,Qc.z],P(t,Wc,Gc,Kc,Zc))},clampPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Box3: .clampPoint() target is now required`),t=new D),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Hc.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return e===void 0&&console.error(`THREE.Box3: .getBoundingSphere() target is now required`),this.getCenter(e.center),e.radius=this.getSize(Hc).length()*.5,e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(Vc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vc),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),el=new N,Object.assign(F.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;t===void 0?el.setFromPoints(e).getCenter(n):n.copy(t);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return t===void 0&&(console.warn(`THREE.Sphere: .clampPoint() target is now required`),t=new D),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return e===void 0&&(console.warn(`THREE.Sphere: .getBoundingBox() target is now required`),e=new N),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),tl=new D,nl=new D,rl=new D,il=new D,al=new D,ol=new D,sl=new D,Object.assign(I.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return t===void 0&&(console.warn(`THREE.Ray: .at() target is now required`),t=new D),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,tl)),this},closestPointToPoint:function(e,t){t===void 0&&(console.warn(`THREE.Ray: .closestPointToPoint() target is now required`),t=new D),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=tl.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(tl.copy(this.direction).multiplyScalar(t).add(this.origin),tl.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,r){nl.copy(e).add(t).multiplyScalar(.5),rl.copy(t).sub(e).normalize(),il.copy(this.origin).sub(nl);var i=e.distanceTo(t)*.5,a=-this.direction.dot(rl),o=il.dot(this.direction),s=-il.dot(rl),c=il.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){var m=1/l;u*=m,d*=m,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(rl).multiplyScalar(d).add(nl),f},intersectSphere:function(e,t){tl.subVectors(e.center,this.origin);var n=tl.dot(this.direction),r=tl.dot(tl)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return n===null?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||n!==n)&&(n=i),(a<r||r!==r)&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)},intersectsBox:function(e){return this.intersectBox(e,tl)!==null},intersectTriangle:function(e,t,n,r,i){al.subVectors(t,e),ol.subVectors(n,e),sl.crossVectors(al,ol);var a=this.direction.dot(sl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;il.subVectors(this.origin,e);var s=o*this.direction.dot(ol.crossVectors(il,ol));if(s<0)return null;var c=o*this.direction.dot(al.cross(il));if(c<0||s+c>a)return null;var l=-o*il.dot(sl);return l<0?null:this.at(l/a,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),cl=new D,ll=new D,ul=new x,Object.assign(L.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var r=cl.subVectors(n,t).cross(ll.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Plane: .projectPoint() target is now required`),t=new D),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){t===void 0&&(console.warn(`THREE.Plane: .intersectLine() target is now required`),t=new D);var n=e.delta(cl),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;if(!(i<0||i>1))return t.copy(n).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return e===void 0&&(console.warn(`THREE.Plane: .coplanarPoint() target is now required`),e=new D),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||ul.getNormalMatrix(e),r=this.coplanarPoint(cl).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),dl=new D,fl=new D,pl=new D,ml=new D,hl=new D,gl=new D,_l=new D,vl=new D,yl=new D,bl=new D,Object.assign(R,{getNormal:function(e,t,n,r){r===void 0&&(console.warn(`THREE.Triangle: .getNormal() target is now required`),r=new D),r.subVectors(n,t),dl.subVectors(e,t),r.cross(dl);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},getBarycoord:function(e,t,n,r,i){dl.subVectors(r,t),fl.subVectors(n,t),pl.subVectors(e,t);var a=dl.dot(dl),o=dl.dot(fl),s=dl.dot(pl),c=fl.dot(fl),l=fl.dot(pl),u=a*c-o*o;if(i===void 0&&(console.warn(`THREE.Triangle: .getBarycoord() target is now required`),i=new D),u===0)return i.set(-2,-1,-1);var d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)},containsPoint:function(e,t,n,r){return R.getBarycoord(e,t,n,r,ml),ml.x>=0&&ml.y>=0&&ml.x+ml.y<=1},getUV:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ml),s.set(0,0),s.addScaledVector(i,ml.x),s.addScaledVector(a,ml.y),s.addScaledVector(o,ml.z),s},isFrontFacing:function(e,t,n,r){return dl.subVectors(n,t),fl.subVectors(e,t),dl.cross(fl).dot(r)<0}}),Object.assign(R.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return dl.subVectors(this.c,this.b),fl.subVectors(this.a,this.b),dl.cross(fl).length()*.5},getMidpoint:function(e){return e===void 0&&(console.warn(`THREE.Triangle: .getMidpoint() target is now required`),e=new D),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return R.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return e===void 0&&(console.warn(`THREE.Triangle: .getPlane() target is now required`),e=new L),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return R.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,r,i){return R.getUV(e,this.a,this.b,this.c,t,n,r,i)},containsPoint:function(e){return R.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return R.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){t===void 0&&(console.warn(`THREE.Triangle: .closestPointToPoint() target is now required`),t=new D);var n=this.a,r=this.b,i=this.c,a,o;hl.subVectors(r,n),gl.subVectors(i,n),vl.subVectors(e,n);var s=hl.dot(vl),c=gl.dot(vl);if(s<=0&&c<=0)return t.copy(n);yl.subVectors(e,r);var l=hl.dot(yl),u=gl.dot(yl);if(l>=0&&u<=l)return t.copy(r);var d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(hl,a);bl.subVectors(e,i);var f=hl.dot(bl),p=gl.dot(bl);if(p>=0&&f<=p)return t.copy(i);var m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(gl,o);var h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return _l.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(_l,o);var g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(hl,a).addScaledVector(gl,o)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),xl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Sl={h:0,s:0,l:0},Cl={h:0,s:0,l:0},Object.assign(z.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):typeof e==`number`?this.setHex(e):typeof e==`string`&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=X.euclideanModulo(e,1),t=X.clamp(t,0,1),n=X.clamp(n,0,1),t===0)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=ee(i,r,e+1/3),this.g=ee(i,r,e),this.b=ee(i,r,e-1/3)}return this},setStyle:function(e){function t(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}var n;if(n=/^((?:rgb|hsl)a?)\\(\\s*([^\\)]*)\\)/.exec(e)){var r,i=n[1],a=n[2];switch(i){case`rgb`:case`rgba`:if(r=/^(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case`hsl`:case`hsla`:if(r=/^([0-9]*\\.?[0-9]+)\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,c)}break}}else if(n=/^\\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],u=l.length;if(u===3)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(u===6)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=xl[e];return t===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(t),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return t===void 0&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){t===void 0&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=te(e.r),this.g=te(e.g),this.b=te(e.b),this},copyLinearToSRGB:function(e){return this.r=ne(e.r),this.g=ne(e.g),this.b=ne(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return(`000000`+this.getHex().toString(16)).slice(-6)},getHSL:function(e){e===void 0&&(console.warn(`THREE.Color: .getHSL() target is now required`),e={h:0,s:0,l:0});var t=this.r,n=this.g,r=this.b,i=Math.max(t,n,r),a=Math.min(t,n,r),o,s,c=(a+i)/2;if(a===i)o=0,s=0;else{var l=i-a;switch(s=c<=.5?l/(i+a):l/(2-i-a),i){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;case r:o=(t-n)/l+4;break}o/=6}return e.h=o,e.s=s,e.l=c,e},getStyle:function(){return`rgb(`+(this.r*255|0)+`,`+(this.g*255|0)+`,`+(this.b*255|0)+`)`},offsetHSL:function(e,t,n){return this.getHSL(Sl),Sl.h+=e,Sl.s+=t,Sl.l+=n,this.setHSL(Sl.h,Sl.s,Sl.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(Sl),e.getHSL(Cl);var n=X.lerp(Sl.h,Cl.h,t),r=X.lerp(Sl.s,Cl.s,t),i=X.lerp(Sl.l,Cl.l,t);return this.setHSL(n,r,i),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return t===void 0&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),z.NAMES=xl,Object.assign(B.prototype,{clone:function(){return new this.constructor().copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}),wl=0,V.prototype=Object.assign(Object.create(y.prototype),{constructor:V,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(e!==void 0)for(var t in e){var n=e[t];if(n===void 0){console.warn(`THREE.Material: \'`+t+`\' parameter is undefined.`);continue}if(t===`shading`){console.warn(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`),this.flatShading=n===1;continue}var r=this[t];if(r===void 0){console.warn(`THREE.`+this.type+`: \'`+t+`\' is not a property of this material.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}},toJSON:function(e){var t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,this.combine!==void 0&&(n.combine=this.combine),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.flatShading===!0&&(n.flatShading=this.flatShading),this.side!==0&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(n.morphTargets=!0),this.morphNormals===!0&&(n.morphNormals=!0),this.skinning===!0&&(n.skinning=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!==`{}`&&(n.userData=this.userData);function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return new this.constructor().copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(t!==null){var r=t.length;n=Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Object.defineProperty(V.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),re.prototype=Object.create(V.prototype),re.prototype.constructor=re,re.prototype.isMeshBasicMaterial=!0,re.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},Tl=new D,Object.defineProperty(H.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.assign(H.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyColorsArray(): color is undefined`,r),a=new z),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector2sArray(): vector is undefined`,r),a=new b),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector3sArray(): vector is undefined`,r),a=new D),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector4sArray(): vector is undefined`,r),a=new C),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyMatrix3(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyMatrix4(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyNormalMatrix(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.transformDirection(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),U.prototype=Object.create(H.prototype),U.prototype.constructor=U,ie.prototype=Object.create(H.prototype),ie.prototype.constructor=ie,W.prototype=Object.create(H.prototype),W.prototype.constructor=W,ae.prototype=Object.create(H.prototype),ae.prototype.constructor=ae,G.prototype=Object.create(H.prototype),G.prototype.constructor=G,oe.prototype=Object.create(H.prototype),oe.prototype.constructor=oe,se.prototype=Object.create(H.prototype),se.prototype.constructor=se,K.prototype=Object.create(H.prototype),K.prototype.constructor=K,ce.prototype=Object.create(H.prototype),ce.prototype.constructor=ce,Object.assign(le.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,t!==void 0&&(t.count=a*3-t.start,n.push(t)),t={start:a*3,materialIndex:r})}t!==void 0&&(t.count=a*3-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t=e.faces,n=e.vertices,r=e.faceVertexUvs,i=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,o=e.morphTargets,s=o.length,c;if(s>0){c=[];for(var l=0;l<s;l++)c[l]={name:o[l].name,data:[]};this.morphTargets.position=c}var u=e.morphNormals,d=u.length,f;if(d>0){f=[];for(var l=0;l<d;l++)f[l]={name:u[l].name,data:[]};this.morphTargets.normal=f}var p=e.skinIndices,m=e.skinWeights,h=p.length===n.length,g=m.length===n.length;n.length>0&&t.length===0&&console.error(`THREE.DirectGeometry: Faceless geometries are not supported.`);for(var l=0;l<t.length;l++){var _=t[l];this.vertices.push(n[_.a],n[_.b],n[_.c]);var v=_.vertexNormals;if(v.length===3)this.normals.push(v[0],v[1],v[2]);else{var y=_.normal;this.normals.push(y,y,y)}var x=_.vertexColors;if(x.length===3)this.colors.push(x[0],x[1],x[2]);else{var S=_.color;this.colors.push(S,S,S)}if(i===!0){var C=r[0][l];C===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv `,l),this.uvs.push(new b,new b,new b)):this.uvs.push(C[0],C[1],C[2])}if(a===!0){var C=r[1][l];C===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 `,l),this.uvs2.push(new b,new b,new b)):this.uvs2.push(C[0],C[1],C[2])}for(var w=0;w<s;w++){var T=o[w].vertices;c[w].data.push(T[_.a],T[_.b],T[_.c])}for(var w=0;w<d;w++){var E=u[w].vertexNormals[l];f[w].data.push(E.a,E.b,E.c)}h&&this.skinIndices.push(p[_.a],p[_.b],p[_.c]),g&&this.skinWeights.push(m[_.a],m[_.b],m[_.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}}),El=1,Dl=new O,Ol=new j,kl=new D,Al=new N,jl=new N,Ml=new D,q.prototype=Object.assign(Object.create(y.prototype),{constructor:q,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(ue(e)>65535?se:G)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:n===void 0?0:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(n!==void 0){var r=new x().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},rotateX:function(e){return Dl.makeRotationX(e),this.applyMatrix4(Dl),this},rotateY:function(e){return Dl.makeRotationY(e),this.applyMatrix4(Dl),this},rotateZ:function(e){return Dl.makeRotationZ(e),this.applyMatrix4(Dl),this},translate:function(e,t,n){return Dl.makeTranslation(e,t,n),this.applyMatrix4(Dl),this},scale:function(e,t,n){return Dl.makeScale(e,t,n),this.applyMatrix4(Dl),this},lookAt:function(e){return Ol.lookAt(e),Ol.updateMatrix(),this.applyMatrix4(Ol.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(kl).negate(),this.translate(kl.x,kl.y,kl.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new K(t.vertices.length*3,3),r=new K(t.colors.length*3,3);if(this.setAttribute(`position`,n.copyVector3sArray(t.vertices)),this.setAttribute(`color`,r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new K(t.lineDistances.length,1);this.setAttribute(`lineDistance`,i.copyArray(t.lineDistances))}t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute(`position`,new K(t,3)),this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var n=t.__directGeometry;if(t.elementsNeedUpdate===!0&&(n=void 0,t.elementsNeedUpdate=!1),n===void 0)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}var r;return t.verticesNeedUpdate===!0&&(r=this.attributes.position,r!==void 0&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),t.normalsNeedUpdate===!0&&(r=this.attributes.normal,r!==void 0&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),t.colorsNeedUpdate===!0&&(r=this.attributes.color,r!==void 0&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(r=this.attributes.uv,r!==void 0&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,r!==void 0&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=new le().fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(e.vertices.length*3);if(this.setAttribute(`position`,new H(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(e.normals.length*3);this.setAttribute(`normal`,new H(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(e.colors.length*3);this.setAttribute(`color`,new H(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(e.uvs.length*2);this.setAttribute(`uv`,new H(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(e.uvs2.length*2);this.setAttribute(`uv2`,new H(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l<u;l++){var d=c[l],f=new K(d.data.length*3,3);f.name=d.name,s.push(f.copyVector3sArray(d.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var p=new K(e.skinIndices.length*4,4);this.setAttribute(`skinIndex`,p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new K(e.skinWeights.length*4,4);this.setAttribute(`skinWeight`,m.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new N);var e=this.attributes.position,t=this.morphAttributes.position;if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];Al.setFromBufferAttribute(i),this.morphTargetsRelative?(Ml.addVectors(this.boundingBox.min,Al.min),this.boundingBox.expandByPoint(Ml),Ml.addVectors(this.boundingBox.max,Al.max),this.boundingBox.expandByPoint(Ml)):(this.boundingBox.expandByPoint(Al.min),this.boundingBox.expandByPoint(Al.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error(`THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new F);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(Al.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];jl.setFromBufferAttribute(a),this.morphTargetsRelative?(Ml.addVectors(Al.min,jl.min),Al.expandByPoint(Ml),Ml.addVectors(Al.max,jl.max),Al.expandByPoint(Ml)):(Al.expandByPoint(jl.min),Al.expandByPoint(jl.max))}Al.getCenter(n);for(var o=0,r=0,i=e.count;r<i;r++)Ml.fromBufferAttribute(e,r),o=Math.max(o,n.distanceToSquared(Ml));if(t)for(var r=0,i=t.length;r<i;r++)for(var a=t[r],s=this.morphTargetsRelative,c=0,l=a.count;c<l;c++)Ml.fromBufferAttribute(a,c),s&&(kl.fromBufferAttribute(e,c),Ml.add(kl)),o=Math.max(o,n.distanceToSquared(Ml));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error(`THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(t.normal===void 0)this.setAttribute(`normal`,new H(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o=t.normal.array,s,c,l,u=new D,d=new D,f=new D,p=new D,m=new D;if(e)for(var h=e.array,i=0,a=e.count;i<a;i+=3)s=h[i+0]*3,c=h[i+1]*3,l=h[i+2]*3,u.fromArray(n,s),d.fromArray(n,c),f.fromArray(n,l),p.subVectors(f,d),m.subVectors(u,d),p.cross(m),o[s]+=p.x,o[s+1]+=p.y,o[s+2]+=p.z,o[c]+=p.x,o[c+1]+=p.y,o[c+2]+=p.z,o[l]+=p.x,o[l+1]+=p.y,o[l+2]+=p.z;else for(var i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),d.fromArray(n,i+3),f.fromArray(n,i+6),p.subVectors(f,d),m.subVectors(u,d),p.cross(m),o[i]=p.x,o[i+1]=p.y,o[i+2]=p.z,o[i+3]=p.x,o[i+4]=p.y,o[i+5]=p.z,o[i+6]=p.x,o[i+7]=p.y,o[i+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(!(e&&e.isBufferGeometry)){console.error(`THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.`,e);return}t===void 0&&(t=0,console.warn(`THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.`));var n=this.attributes;for(var r in n)if(e.attributes[r]!==void 0)for(var i=n[r].array,a=e.attributes[r],o=a.array,s=a.itemSize*t,c=Math.min(o.length,i.length-s),l=0,u=s;l<c;l++,u++)i[u]=o[l];return this},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Ml.x=e.getX(t),Ml.y=e.getY(t),Ml.z=e.getZ(t),Ml.normalize(),e.setXYZ(t,Ml.x,Ml.y,Ml.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,c=0,l=t.length;c<l;c++){o=t[c]*r;for(var u=0;u<r;u++)a[s++]=n[o++]}return new H(a,r,i)}if(this.index===null)return console.warn(`THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed.`),this;var t=new q,n=this.index.array,r=this.attributes;for(var i in r){var a=r[i],o=e(a,n);t.setAttribute(i,o)}var s=this.morphAttributes;for(i in s){for(var c=[],l=s[i],u=0,d=l.length;u<d;u++){var a=l[u],o=e(a,n);c.push(o)}t.morphAttributes[i]=c}t.morphTargetsRelative=this.morphTargetsRelative;for(var f=this.groups,u=0,p=f.length;u<p;u++){var m=f[u];t.addGroup(m.start,m.count,m.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;r!==null&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=i[n],o=a.toJSON();a.name!==``&&(o.name=a.name),e.data.attributes[n]=o}var s={},c=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],u=[],d=0,f=l.length;d<f;d++){var a=l[d],o=a.toJSON();a.name!==``&&(o.name=a.name),u.push(o)}u.length>0&&(s[n]=u,c=!0)}c&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var m=this.boundingSphere;return m!==null&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e},clone:function(){return new q().copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;i!==null&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,r=l.length;n<r;n++)c.push(l[n].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var u=e.groups;for(n=0,r=u.length;n<r;n++){var d=u[n];this.addGroup(d.start,d.count,d.materialIndex)}var f=e.boundingBox;f!==null&&(this.boundingBox=f.clone());var p=e.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Nl=new O,Pl=new I,Fl=new F,Il=new D,Ll=new D,Rl=new D,zl=new D,Bl=new D,Vl=new D,Hl=new D,Ul=new D,Wl=new D,Gl=new b,Kl=new b,ql=new b,Jl=new D,Yl=new D,de.prototype=Object.assign(Object.create(j.prototype),{constructor:de,isMesh:!0,copy:function(e){return j.prototype.copy.call(this,e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}},raycast:function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Fl.copy(n.boundingSphere),Fl.applyMatrix4(i),e.ray.intersectsSphere(Fl)!==!1&&(Nl.getInverse(i),Pl.copy(e.ray).applyMatrix4(Nl),!(n.boundingBox!==null&&Pl.intersectsBox(n.boundingBox)===!1)))){var a;if(n.isBufferGeometry){var o,s,c,l=n.index,u=n.attributes.position,d=n.morphAttributes.position,f=n.morphTargetsRelative,p=n.attributes.uv,m=n.attributes.uv2,h=n.groups,g=n.drawRange,_,v,y,x,S,C,w,T;if(l!==null)if(Array.isArray(r))for(_=0,y=h.length;_<y;_++)for(S=h[_],C=r[S.materialIndex],w=Math.max(S.start,g.start),T=Math.min(S.start+S.count,g.start+g.count),v=w,x=T;v<x;v+=3)o=l.getX(v),s=l.getX(v+1),c=l.getX(v+2),a=pe(this,C,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=S.materialIndex,t.push(a));else for(w=Math.max(0,g.start),T=Math.min(l.count,g.start+g.count),_=w,y=T;_<y;_+=3)o=l.getX(_),s=l.getX(_+1),c=l.getX(_+2),a=pe(this,r,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(_/3),t.push(a));else if(u!==void 0)if(Array.isArray(r))for(_=0,y=h.length;_<y;_++)for(S=h[_],C=r[S.materialIndex],w=Math.max(S.start,g.start),T=Math.min(S.start+S.count,g.start+g.count),v=w,x=T;v<x;v+=3)o=v,s=v+1,c=v+2,a=pe(this,C,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=S.materialIndex,t.push(a));else for(w=Math.max(0,g.start),T=Math.min(u.count,g.start+g.count),_=w,y=T;_<y;_+=3)o=_,s=_+1,c=_+2,a=pe(this,r,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(_/3),t.push(a))}else if(n.isGeometry){var E,D,O,k=Array.isArray(r),A=n.vertices,j=n.faces,M,N=n.faceVertexUvs[0];N.length>0&&(M=N);for(var P=0,F=j.length;P<F;P++){var I=j[P],L=k?r[I.materialIndex]:r;if(L!==void 0&&(E=A[I.a],D=A[I.b],O=A[I.c],a=fe(this,L,e,Pl,E,D,O,Jl),a)){if(M&&M[P]){var z=M[P];Gl.copy(z[0]),Kl.copy(z[1]),ql.copy(z[2]),a.uv=R.getUV(Jl,E,D,O,Gl,Kl,ql,new b)}a.face=I,a.faceIndex=P,t.push(a)}}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Xl=0,Zl=new O,Ql=new j,$l=new D,J.prototype=Object.assign(Object.create(y.prototype),{constructor:J,isGeometry:!0,applyMatrix4:function(e){for(var t=new x().getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++)this.vertices[n].applyMatrix4(e);for(var n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return Zl.makeRotationX(e),this.applyMatrix4(Zl),this},rotateY:function(e){return Zl.makeRotationY(e),this.applyMatrix4(Zl),this},rotateZ:function(e){return Zl.makeRotationZ(e),this.applyMatrix4(Zl),this},translate:function(e,t,n){return Zl.makeTranslation(e,t,n),this.applyMatrix4(Zl),this},scale:function(e,t,n){return Zl.makeScale(e,t,n),this.applyMatrix4(Zl),this},lookAt:function(e){return Ql.lookAt(e),Ql.updateMatrix(),this.applyMatrix4(Ql.matrix),this},fromBufferGeometry:function(e){var t=this,n=e.index===null?void 0:e.index.array,r=e.attributes;if(r.position===void 0)return console.error(`THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.`),this;var i=r.position.array,a=r.normal===void 0?void 0:r.normal.array,o=r.color===void 0?void 0:r.color.array,s=r.uv===void 0?void 0:r.uv.array,c=r.uv2===void 0?void 0:r.uv2.array;c!==void 0&&(this.faceVertexUvs[1]=[]);for(var l=0;l<i.length;l+=3)t.vertices.push(new D().fromArray(i,l)),o!==void 0&&t.colors.push(new z().fromArray(o,l));function u(e,n,r,i){var l=o===void 0?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[r].clone()],u=new B(e,n,r,a===void 0?[]:[new D().fromArray(a,e*3),new D().fromArray(a,n*3),new D().fromArray(a,r*3)],l,i);t.faces.push(u),s!==void 0&&t.faceVertexUvs[0].push([new b().fromArray(s,e*2),new b().fromArray(s,n*2),new b().fromArray(s,r*2)]),c!==void 0&&t.faceVertexUvs[1].push([new b().fromArray(c,e*2),new b().fromArray(c,n*2),new b().fromArray(c,r*2)])}var d=e.groups;if(d.length>0)for(var l=0;l<d.length;l++)for(var f=d[l],p=f.start,m=f.count,h=p,g=p+m;h<g;h+=3)n===void 0?u(h,h+1,h+2,f.materialIndex):u(n[h],n[h+1],n[h+2],f.materialIndex);else if(n!==void 0)for(var l=0;l<n.length;l+=3)u(n[l],n[l+1],n[l+2]);else for(var l=0;l<i.length/3;l+=3)u(l,l+1,l+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter($l).negate(),this.translate($l.x,$l.y,$l.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=t===0?1:1/t,r=new O;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(r),this},computeFaceNormals:function(){for(var e=new D,t=new D,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){e===void 0&&(e=!0);var t,n,r,i,a,o=Array(this.vertices.length);for(t=0,n=this.vertices.length;t<n;t++)o[t]=new D;if(e){var s,c,l,u=new D,d=new D;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),d.subVectors(s,c),u.cross(d),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)a=this.faces[r],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++){a=this.faces[r];var f=a.vertexNormals;f.length===3?(f[0].copy(o[a.a]),f[1].copy(o[a.b]),f[2].copy(o[a.c])):(f[0]=o[a.a].clone(),f[1]=o[a.b].clone(),f[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){n=this.faces[e];var r=n.vertexNormals;r.length===3?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for(i=this.faces[n],i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new J;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals,c,l;for(n=0,r=this.faces.length;n<r;n++)c=new D,l={a:new D,b:new D,c:new D},o.push(c),s.push(l)}var u=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var c,l;for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],c=u.faceNormals[n],l=u.vertexNormals[n],c.copy(i.normal),l.a.copy(i.vertexNormals[0]),l.b.copy(i.vertexNormals[1]),l.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new N),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new F),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!(e&&e.isGeometry)){console.error(`THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.`,e);return}var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.colors,u=e.colors;n===void 0&&(n=0),t!==void 0&&(r=new x().getNormalMatrix(t));for(var d=0,f=o.length;d<f;d++){var p=o[d].clone();t!==void 0&&p.applyMatrix4(t),a.push(p)}for(var d=0,f=u.length;d<f;d++)l.push(u[d].clone());for(d=0,f=c.length;d<f;d++){var m=c[d],h,g,_,v=m.vertexNormals,y=m.vertexColors;h=new B(m.a+i,m.b+i,m.c+i),h.normal.copy(m.normal),r!==void 0&&h.normal.applyMatrix3(r).normalize();for(var b=0,S=v.length;b<S;b++)g=v[b].clone(),r!==void 0&&g.applyMatrix3(r).normalize(),h.vertexNormals.push(g);h.color.copy(m.color);for(var b=0,S=y.length;b<S;b++)_=y[b],h.vertexColors.push(_.clone());h.materialIndex=m.materialIndex+n,s.push(h)}for(var d=0,f=e.faceVertexUvs.length;d<f;d++){var C=e.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(var b=0,S=C.length;b<S;b++){for(var w=C[b],T=[],E=0,D=w.length;E<D;E++)T.push(w[E].clone());this.faceVertexUvs[d].push(T)}}},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error(`THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.`,e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(){var e={},t=[],n=[],r,i,a=Math.pow(10,4),o,s,c,l,u,d;for(o=0,s=this.vertices.length;o<s;o++)r=this.vertices[o],i=Math.round(r.x*a)+`_`+Math.round(r.y*a)+`_`+Math.round(r.z*a),e[i]===void 0?(e[i]=o,t.push(this.vertices[o]),n[o]=t.length-1):n[o]=n[e[i]];var f=[];for(o=0,s=this.faces.length;o<s;o++){c=this.faces[o],c.a=n[c.a],c.b=n[c.b],c.c=n[c.c],l=[c.a,c.b,c.c];for(var p=0;p<3;p++)if(l[p]===l[(p+1)%3]){f.push(o);break}}for(o=f.length-1;o>=0;o--){var m=f[o];for(this.faces.splice(m,1),u=0,d=this.faceVertexUvs.length;u<d;u++)this.faceVertexUvs[u].splice(m,1)}var h=this.vertices.length-t.length;return this.vertices=t,h},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new D(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;function r(e,t){return e.materialIndex-t.materialIndex}e.sort(r);var i=this.faceVertexUvs[0],a=this.faceVertexUvs[1],o,s;i&&i.length===t&&(o=[]),a&&a.length===t&&(s=[]);for(var n=0;n<t;n++){var c=e[n]._id;o&&o.push(i[c]),s&&s.push(a[c])}o&&(this.faceVertexUvs[0]=o),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){var e={metadata:{version:4.5,type:`Geometry`,generator:`Geometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}for(var o=[],s=[],c={},l=[],u={},d=[],f={},i=0;i<this.faces.length;i++){var p=this.faces[i],m=!0,h=!1,g=this.faceVertexUvs[0][i]!==void 0,_=p.normal.length()>0,v=p.vertexNormals.length>0,y=p.color.r!==1||p.color.g!==1||p.color.b!==1,b=p.vertexColors.length>0,x=0;if(x=T(x,0,0),x=T(x,1,m),x=T(x,2,h),x=T(x,3,g),x=T(x,4,_),x=T(x,5,v),x=T(x,6,y),x=T(x,7,b),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),g){var S=this.faceVertexUvs[0][i];o.push(O(S[0]),O(S[1]),O(S[2]))}if(_&&o.push(E(p.normal)),v){var C=p.vertexNormals;o.push(E(C[0]),E(C[1]),E(C[2]))}if(y&&o.push(D(p.color)),b){var w=p.vertexColors;o.push(D(w[0]),D(w[1]),D(w[2]))}}function T(e,t,n){return n?e|1<<t:e&~(1<<t)}function E(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return c[t]===void 0?(c[t]=s.length/3,s.push(e.x,e.y,e.z),c[t]):c[t]}function D(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return u[t]===void 0?(u[t]=l.length,l.push(e.getHex()),u[t]):u[t]}function O(e){var t=e.x.toString()+e.y.toString();return f[t]===void 0?(f[t]=d.length/2,d.push(e.x,e.y),f[t]):f[t]}return e.data={},e.data.vertices=r,e.data.normals=s,l.length>0&&(e.data.colors=l),d.length>0&&(e.data.uvs=[d]),e.data.faces=o,e},clone:function(){return new J().copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]),r=0,i=u.length;r<i;r++){var d=u[r],f=[];for(a=0,o=d.length;a<o;a++){var p=d[a];f.push(p.clone())}this.faceVertexUvs[t].push(f)}}var m=e.morphTargets;for(t=0,n=m.length;t<n;t++){var h={};if(h.name=m[t].name,m[t].vertices!==void 0)for(h.vertices=[],r=0,i=m[t].vertices.length;r<i;r++)h.vertices.push(m[t].vertices[r].clone());if(m[t].normals!==void 0)for(h.normals=[],r=0,i=m[t].normals.length;r<i;r++)h.normals.push(m[t].normals[r].clone());this.morphTargets.push(h)}var g=e.morphNormals;for(t=0,n=g.length;t<n;t++){var _={};if(g[t].vertexNormals!==void 0)for(_.vertexNormals=[],r=0,i=g[t].vertexNormals.length;r<i;r++){var v=g[t].vertexNormals[r],y={};y.a=v.a.clone(),y.b=v.b.clone(),y.c=v.c.clone(),_.vertexNormals.push(y)}if(g[t].faceNormals!==void 0)for(_.faceNormals=[],r=0,i=g[t].faceNormals.length;r<i;r++)_.faceNormals.push(g[t].faceNormals[r].clone());this.morphNormals.push(_)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var x=e.skinIndices;for(t=0,n=x.length;t<n;t++)this.skinIndices.push(x[t].clone());var S=e.lineDistances;for(t=0,n=S.length;t<n;t++)this.lineDistances.push(S[t]);var C=e.boundingBox;C!==null&&(this.boundingBox=C.clone());var w=e.boundingSphere;return w!==null&&(this.boundingSphere=w.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),eu=class extends J{constructor(e,t,n,r,i,a){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new tu(e,t,n,r,i,a)),this.mergeVertices()}},tu=class extends q{constructor(e,t,n,r,i,a){super(),this.type=`BoxBufferGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;e=e||1,t=t||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new K(c,3)),this.setAttribute(`normal`,new K(l,3)),this.setAttribute(`uv`,new K(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,O=new D;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)O[e]=(s*v-b)*r,O[t]=o*i,O[n]=S,c.push(O.x,O.y,O.z),O[e]=0,O[t]=0,O[n]=m>0?1:-1,l.push(O.x,O.y,O.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}},nu={clone:me,merge:he},ru=`void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}`,iu=`void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}`,ge.prototype=Object.create(V.prototype),ge.prototype.constructor=ge,ge.prototype.isShaderMaterial=!0,ge.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=me(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},ge.prototype.toJSON=function(e){var t=V.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:`t`,value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:`c`,value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:`v2`,value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:`v3`,value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:`v4`,value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:`m3`,value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:`m4`,value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)this.extensions[a]===!0&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},_e.prototype=Object.assign(Object.create(j.prototype),{constructor:_e,isCamera:!0,copy:function(e,t){return j.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){e===void 0&&(console.warn(`THREE.Camera: .getWorldDirection() target is now required`),e=new D),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){j.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){j.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return new this.constructor().copy(this)}}),ve.prototype=Object.assign(Object.create(_e.prototype),{constructor:ve,isPerspectiveCamera:!0,copy:function(e,t){return _e.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=X.RAD2DEG*2*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(X.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/e},getEffectiveFOV:function(){return X.RAD2DEG*2*Math.atan(Math.tan(X.DEG2RAD*.5*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(X.DEG2RAD*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;c!==0&&(i+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),au=90,ou=1,ye.prototype=Object.create(j.prototype),ye.prototype.constructor=ye,be.prototype=Object.create(w.prototype),be.prototype.constructor=be,be.prototype.isWebGLCubeRenderTarget=!0,be.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new M,r={uniforms:{tEquirect:{value:null}},vertexShader:[`varying vec3 vWorldDirection;`,`vec3 transformDirection( in vec3 dir, in mat4 matrix ) {`,` return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );`,`}`,`void main() {`,` vWorldDirection = transformDirection( position, modelMatrix );`,` #include <begin_vertex>`,` #include <project_vertex>`,`}`].join(`\n`),fragmentShader:[`uniform sampler2D tEquirect;`,`varying vec3 vWorldDirection;`,`#include <common>`,`void main() {`,` vec3 direction = normalize( vWorldDirection );`,` vec2 sampleUV = equirectUv( direction );`,` gl_FragColor = texture2D( tEquirect, sampleUV );`,`}`].join(`\n`)},i=new ge({type:`CubemapFromEquirect`,uniforms:me(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;var a=new de(new tu(5,5,5),i);return n.add(a),new ye(1,10,this).update(e,n),a.geometry.dispose(),a.material.dispose(),this},xe.prototype=Object.create(S.prototype),xe.prototype.constructor=xe,xe.prototype.isDataTexture=!0,su=new F,cu=new D,Object.assign(Se.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],d=n[8],f=n[9],p=n[10],m=n[11],h=n[12],g=n[13],_=n[14],v=n[15];return t[0].setComponents(o-r,u-s,m-d,v-h).normalize(),t[1].setComponents(o+r,u+s,m+d,v+h).normalize(),t[2].setComponents(o+i,u+c,m+f,v+g).normalize(),t[3].setComponents(o-i,u-c,m-f,v-g).normalize(),t[4].setComponents(o-a,u-l,m-p,v-_).normalize(),t[5].setComponents(o+a,u+l,m+p,v+_).normalize(),this},intersectsObject:function(e){var t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),su.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(su)},intersectsSprite:function(e){return su.center.set(0,0,0),su.radius=.7071067811865476,su.applyMatrix4(e.matrixWorld),this.intersectsSphere(su)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++)if(t[i].distanceToPoint(n)<r)return!1;return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(cu.x=r.normal.x>0?e.max.x:e.min.x,cu.y=r.normal.y>0?e.max.y:e.min.y,cu.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(cu)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}}),Z={common:{diffuse:{value:new z(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new x},uv2Transform:{value:new x},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new b(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new z(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new z(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new x}},sprite:{diffuse:{value:new z(15658734)},opacity:{value:1},center:{value:new b(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new x}}},Te.prototype=Object.create(J.prototype),Te.prototype.constructor=Te,Ee.prototype=Object.create(q.prototype),Ee.prototype.constructor=Ee,Q={alphamap_fragment:`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif`,alphamap_pars_fragment:`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,alphatest_fragment:`#ifdef ALPHATEST\n if ( diffuseColor.a < ALPHATEST ) discard;\n#endif`,aomap_fragment:`#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n #endif\n#endif`,aomap_pars_fragment:`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,begin_vertex:`vec3 transformed = vec3( position );`,beginnormal_vertex:`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,bsdfs:`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n return vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n#else\n if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n return Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n return 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( incidentLight.direction + viewDir );\n float dotNL = saturate( dot( normal, incidentLight.direction ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n return specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n vec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n vec3 FssEss = F * brdf.x + brdf.y;\n float Ess = brdf.x + brdf.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n float invAlpha = 1.0 / roughness;\n float cos2h = NoH * NoH;\n float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n vec3 N = geometry.normal;\n vec3 V = geometry.viewDir;\n vec3 H = normalize( V + L );\n float dotNH = saturate( dot( N, H ) );\n return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif`,bumpmap_pars_fragment:`#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 );\n fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,color_fragment:`#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif`,color_pars_fragment:`#ifdef USE_COLOR\n varying vec3 vColor;\n#endif`,color_pars_vertex:`#ifdef USE_COLOR\n varying vec3 vColor;\n#endif`,color_vertex:`#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif`,common:`#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n#ifdef CLEARCOAT\n vec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n return dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {\n uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {\n uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {\n uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {\n uv = vec2(direction.x, direction.y) / abs(direction.z); }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif`,encodings_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,encodings_pars_fragment:`\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.r, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.r, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract( Le );\n vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n return vec4( max( vRGB, 0.0 ), 1.0 );\n}`,envmap_fragment:`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n \n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n reflectVec = normalize( reflectVec );\n vec2 sampleUV = equirectUv( reflectVec );\n vec4 envColor = texture2D( envMap, sampleUV );\n #elif defined( ENVMAP_TYPE_SPHERE )\n reflectVec = normalize( reflectVec );\n vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifndef ENVMAP_TYPE_CUBE_UV\n envColor = envMapTexelToLinear( envColor );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform int maxMipLevel;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif`,envmap_physical_pars_fragment:`#if defined( USE_ENVMAP )\n #ifdef ENVMAP_MODE_REFRACTION\n uniform float refractionRatio;\n #endif\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n #else\n vec4 envMapColor = vec4( 0.0 );\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float sigma = PI * roughness * roughness / ( 1.0 + roughness );\n float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n #else\n vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV = equirectUv( reflectVec );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n#endif`,envmap_vertex:`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) { \n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif`,fog_vertex:`#ifdef USE_FOG\n fogDepth = -mvPosition.z;\n#endif`,fog_pars_vertex:`#ifdef USE_FOG\n varying float fogDepth;\n#endif`,fog_fragment:`#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif`,fog_pars_fragment:`#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float fogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return texture2D( gradientMap, coord ).rgb;\n #else\n return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n #endif\n}`,lightmap_fragment:`#ifdef USE_LIGHTMAP\n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif`,lights_lambert_vertex:`vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n vLightBack = vec3( 0.0 );\n vIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n vIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n #ifdef DOUBLE_SIDED\n vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n #endif\n }\n #pragma unroll_loop_end\n#endif`,lights_pars_begin:`uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n struct PointLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n directLight.visible = ( directLight.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n float angleCos = dot( directLight.direction, spotLight.direction );\n if ( angleCos > spotLight.coneCos ) {\n float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif`,lights_toon_fragment:`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,lights_toon_pars_fragment:`varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material ) (0)`,lights_phong_fragment:`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material ) (0)`,lights_physical_fragment:`PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheen;\n#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n#ifdef CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n vec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n #ifdef CLEARCOAT\n float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = ccDotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n ccIrradiance *= PI;\n #endif\n float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n #else\n float clearcoatDHR = 0.0;\n #endif\n #ifdef USE_SHEEN\n reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n material.specularRoughness,\n directLight.direction,\n geometry,\n material.sheenColor\n );\n #else\n reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n #endif\n reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef CLEARCOAT\n float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n float ccDotNL = ccDotNV;\n float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n #else\n float clearcoatDHR = 0.0;\n #endif\n float clearcoatInv = 1.0 - clearcoatDHR;\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}`,lights_fragment_begin:`\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n geometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointDirectLightIrradiance( pointLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotDirectLightIrradiance( spotLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n irradiance += getLightProbeIrradiance( lightProbe, geometry );\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n #ifdef CLEARCOAT\n clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n #endif\n#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif`,map_fragment:`#ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv );\n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n#endif`,map_pars_fragment:`#ifdef USE_MAP\n uniform sampler2D map;\n#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n vec4 mapTexel = texture2D( map, uv );\n diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif`,map_particle_pars_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,metalnessmap_fragment:`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.b;\n#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n#endif`,normal_fragment_begin:`#ifdef FLAT_SHADED\n vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n #ifdef USE_TANGENT\n vec3 tangent = normalize( vTangent );\n vec3 bitangent = normalize( vBitangent );\n #ifdef DOUBLE_SIDED\n tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n mat3 vTBN = mat3( tangent, bitangent, normal );\n #endif\n #endif\n#endif\nvec3 geometryNormal = normal;`,normal_fragment_maps:`#ifdef OBJECTSPACE_NORMALMAP\n normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n #ifdef USE_TANGENT\n normal = normalize( vTBN * mapN );\n #else\n normal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n #endif\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n float scale = sign( st1.t * st0.s - st0.t * st1.s );\n vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n vec3 N = normalize( surf_norm );\n mat3 tsn = mat3( S, T, N );\n mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n return normalize( tsn * mapN );\n }\n#endif`,clearcoat_normal_fragment_begin:`#ifdef CLEARCOAT\n vec3 clearcoatNormal = geometryNormal;\n#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n #ifdef USE_TANGENT\n clearcoatNormal = normalize( vTBN * clearcoatMapN );\n #else\n clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n #endif\n#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif`,packing:`vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,dithering_pars_fragment:`#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif`,roughnessmap_fragment:`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.g;\n#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif`,shadowmap_pars_fragment:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n bool frustumTest = all( frustumTestVec );\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif`,shadowmap_pars_vertex:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif`,shadowmap_vertex:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif`,shadowmask_pars_fragment:`float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}`,skinbase_vertex:`#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n #else\n uniform mat4 boneMatrices[ MAX_BONES ];\n mat4 getBoneMatrix( const in float i ) {\n mat4 bone = boneMatrices[ int(i) ];\n return bone;\n }\n #endif\n#endif`,skinning_vertex:`#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif`,skinnormal_vertex:`#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif`,specularmap_fragment:`float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,tonemapping_pars_fragment:`#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}`,uv_pars_fragment:`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n varying vec2 vUv;\n#endif`,uv_pars_vertex:`#ifdef USE_UV\n #ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n #else\n varying vec2 vUv;\n #endif\n uniform mat3 uvTransform;\n#endif`,uv_vertex:`#ifdef USE_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif`,uv2_pars_fragment:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif`,uv2_pars_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n uniform mat3 uv2Transform;\n#endif`,uv2_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif`,background_frag:`uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n gl_FragColor = mapTexelToLinear( texColor );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,background_vert:`varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}`,cube_frag:`#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n vec3 vReflect = vWorldDirection;\n #include <envmap_fragment>\n gl_FragColor = envColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,cube_vert:`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}`,depth_frag:`#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}`,depth_vert:`#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}`,distanceRGBA_frag:`#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}`,distanceRGBA_vert:`#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}`,equirect_frag:`uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n vec4 texColor = texture2D( tEquirect, sampleUV );\n gl_FragColor = mapTexelToLinear( texColor );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,equirect_vert:`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}`,linedashed_frag:`uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,linedashed_vert:`uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <color_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`,meshbasic_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n \n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshbasic_vert:`#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}`,meshlambert_frag:`uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <emissivemap_fragment>\n #ifdef DOUBLE_SIDED\n reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n #else\n reflectedLight.indirectDiffuse += vIndirectFront;\n #endif\n #include <lightmap_fragment>\n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshlambert_vert:`#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_lambert_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshmatcap_frag:`#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n matcapColor = matcapTexelToLinear( matcapColor );\n #else\n vec4 matcapColor = vec4( 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshmatcap_vert:`#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}`,meshtoon_frag:`#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshtoon_vert:`#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshphong_frag:`#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshphong_vert:`#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshphysical_frag:`#define STANDARD\n#ifdef PHYSICAL\n #define REFLECTIVITY\n #define CLEARCOAT\n #define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n uniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n uniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #ifdef TRANSPARENCY\n diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n #endif\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshphysical_vert:`#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,normal_frag:`#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}`,normal_vert:`#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n#endif\n}`,points_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,points_vert:`uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}`,shadow_frag:`uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}`,shadow_vert:`#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <begin_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,sprite_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}`,sprite_vert:`uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`},lu={basic:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:Q.meshbasic_vert,fragmentShader:Q.meshbasic_frag},lambert:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.fog,Z.lights,{emissive:{value:new z(0)}}]),vertexShader:Q.meshlambert_vert,fragmentShader:Q.meshlambert_frag},phong:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new z(0)},specular:{value:new z(1118481)},shininess:{value:30}}]),vertexShader:Q.meshphong_vert,fragmentShader:Q.meshphong_frag},standard:{uniforms:he([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new z(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},toon:{uniforms:he([Z.common,Z.specularmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new z(0)},specular:{value:new z(1118481)},shininess:{value:30}}]),vertexShader:Q.meshtoon_vert,fragmentShader:Q.meshtoon_frag},matcap:{uniforms:he([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:Q.meshmatcap_vert,fragmentShader:Q.meshmatcap_frag},points:{uniforms:he([Z.points,Z.fog]),vertexShader:Q.points_vert,fragmentShader:Q.points_frag},dashed:{uniforms:he([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Q.linedashed_vert,fragmentShader:Q.linedashed_frag},depth:{uniforms:he([Z.common,Z.displacementmap]),vertexShader:Q.depth_vert,fragmentShader:Q.depth_frag},normal:{uniforms:he([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),vertexShader:Q.normal_vert,fragmentShader:Q.normal_frag},sprite:{uniforms:he([Z.sprite,Z.fog]),vertexShader:Q.sprite_vert,fragmentShader:Q.sprite_frag},background:{uniforms:{uvTransform:{value:new x},t2D:{value:null}},vertexShader:Q.background_vert,fragmentShader:Q.background_frag},cube:{uniforms:he([Z.envmap,{opacity:{value:1}}]),vertexShader:Q.cube_vert,fragmentShader:Q.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Q.equirect_vert,fragmentShader:Q.equirect_frag},distanceRGBA:{uniforms:he([Z.common,Z.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Q.distanceRGBA_vert,fragmentShader:Q.distanceRGBA_frag},shadow:{uniforms:he([Z.lights,Z.fog,{color:{value:new z(0)},opacity:{value:1}}]),vertexShader:Q.shadow_vert,fragmentShader:Q.shadow_frag}},lu.physical={uniforms:he([lu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new b(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new z(0)},transparency:{value:0}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},Re.prototype=Object.create(S.prototype),Re.prototype.constructor=Re,Re.prototype.isCubeTexture=!0,Object.defineProperty(Re.prototype,`images`,{get:function(){return this.image},set:function(e){this.image=e}}),ze.prototype=Object.create(S.prototype),ze.prototype.constructor=ze,ze.prototype.isDataTexture2DArray=!0,Be.prototype=Object.create(S.prototype),Be.prototype.constructor=Be,Be.prototype.isDataTexture3D=!0,uu=new S,du=new ze,fu=new Be,pu=new Re,mu=[],hu=[],gu=new Float32Array(16),_u=new Float32Array(9),vu=new Float32Array(4),Ct.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Ue(t,e)},wt.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}},yu=/([\\w\\d_]+)(\\])?(\\[|\\.)?/g,Dt.prototype.setValue=function(e,t,n,r){var i=this.map[t];i!==void 0&&i.setValue(e,n,r)},Dt.prototype.setOptional=function(e,t,n){var r=t[n];r!==void 0&&this.setValue(e,n,r)},Dt.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];s.needsUpdate!==!1&&o.setValue(e,s.value,r)}},Dt.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n},bu=0,xu=/^[ \\t]*#include +<([\\w\\d./]+)>/gm,Su=/#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g,Cu=/#pragma unroll_loop_start[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}[\\s]+?#pragma unroll_loop_end/g,wu=0,dn.prototype=Object.create(V.prototype),dn.prototype.constructor=dn,dn.prototype.isMeshDepthMaterial=!0,dn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},fn.prototype=Object.create(V.prototype),fn.prototype.constructor=fn,fn.prototype.isMeshDistanceMaterial=!0,fn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},Tu=`uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}`,Eu=`void main() {\n gl_Position = vec4( position, 1.0 );\n}`,_n.prototype=Object.assign(Object.create(ve.prototype),{constructor:_n,isArrayCamera:!0}),vn.prototype=Object.assign(Object.create(j.prototype),{constructor:vn,isGroup:!0}),Object.assign(yn.prototype,{constructor:yn,getTargetRaySpace:function(){return this._targetRay===null&&(this._targetRay=new vn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return this._grip===null&&(this._grip=new vn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this},update:function(e,t,n){var r=null,i=null,a=this._targetRay,o=this._grip;return e&&(a!==null&&(r=t.getPose(e.targetRaySpace,n),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))),o!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)))),a!==null&&(a.visible=r!==null),o!==null&&(o.visible=i!==null),this}}),Object.assign(bn.prototype,y.prototype),Object.assign(Cn.prototype,{isFogExp2:!0,clone:function(){return new Cn(this.color,this.density)},toJSON:function(){return{type:`FogExp2`,color:this.color.getHex(),density:this.density}}}),Object.assign(wn.prototype,{isFog:!0,clone:function(){return new wn(this.color,this.near,this.far)},toJSON:function(){return{type:`Fog`,color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Tn.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.assign(Tn.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},clone:function(){return new this.constructor().copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}}),Du=new D,Object.defineProperties(En.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(En.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)Du.x=this.getX(t),Du.y=this.getY(t),Du.z=this.getZ(t),Du.applyMatrix4(e),this.setXYZ(t,Du.x,Du.y,Du.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this},clone:function(){console.log(`THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.`);for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return new H(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log(`THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.`);for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}),Dn.prototype=Object.create(V.prototype),Dn.prototype.constructor=Dn,Dn.prototype.isSpriteMaterial=!0,Dn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this},ku=new D,Au=new D,ju=new D,Mu=new b,Nu=new b,Pu=new O,Fu=new D,Iu=new D,Lu=new D,Ru=new b,zu=new b,Bu=new b,On.prototype=Object.assign(Object.create(j.prototype),{constructor:On,isSprite:!0,raycast:function(e,t){e.camera===null&&console.error(`THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),Au.setFromMatrixScale(this.matrixWorld),Pu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ju.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Au.multiplyScalar(-ju.z);var n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));var a=this.center;kn(Fu.set(-.5,-.5,0),ju,a,Au,r,i),kn(Iu.set(.5,-.5,0),ju,a,Au,r,i),kn(Lu.set(.5,.5,0),ju,a,Au,r,i),Ru.set(0,0),zu.set(1,0),Bu.set(1,1);var o=e.ray.intersectTriangle(Fu,Iu,Lu,!1,ku);if(!(o===null&&(kn(Iu.set(-.5,.5,0),ju,a,Au,r,i),zu.set(0,1),o=e.ray.intersectTriangle(Fu,Lu,Iu,!1,ku),o===null))){var s=e.ray.origin.distanceTo(ku);s<e.near||s>e.far||t.push({distance:s,point:ku.clone(),uv:R.getUV(ku,Fu,Iu,Lu,Ru,zu,Bu,new b),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return j.prototype.copy.call(this,e),e.center!==void 0&&this.center.copy(e.center),this}}),Vu=new D,Hu=new D,An.prototype=Object.assign(Object.create(j.prototype),{constructor:An,isLOD:!0,copy:function(e){j.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){t===void 0&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){Vu.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Vu);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){Vu.setFromMatrixPosition(e.matrixWorld),Hu.setFromMatrixPosition(this.matrixWorld);var n=Vu.distanceTo(Hu)/e.zoom;t[0].object.visible=!0;for(var r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),jn.prototype=Object.assign(Object.create(de.prototype),{constructor:jn,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new C,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i===1/0?e.set(1,0,0,0):e.multiplyScalar(i),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){de.prototype.updateMatrixWorld.call(this,e),this.bindMode===`attached`?this.bindMatrixInverse.getInverse(this.matrixWorld):this.bindMode===`detached`?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn(`THREE.SkinnedMesh: Unrecognized bindMode: `+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:function(){var e=new D,t=new C,n=new C,r=new D,i=new O;return function(a,o){var s=this.skeleton,c=this.geometry;t.fromBufferAttribute(c.attributes.skinIndex,a),n.fromBufferAttribute(c.attributes.skinWeight,a),e.fromBufferAttribute(c.attributes.position,a).applyMatrix4(this.bindMatrix),o.set(0,0,0);for(var l=0;l<4;l++){var u=n.getComponent(l);if(u!==0){var d=t.getComponent(l);i.multiplyMatrices(s.bones[d].matrixWorld,s.boneInverses[d]),o.addScaledVector(r.copy(e).applyMatrix4(i),u)}}return o.applyMatrix4(this.bindMatrixInverse)}}()}),Uu=new O,Wu=new O,Object.assign(Mn.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new O;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:Wu;Uu.multiplyMatrices(o,t[i]),Uu.toArray(n,i*16)}r!==void 0&&(r.needsUpdate=!0)},clone:function(){return new Mn(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),Nn.prototype=Object.assign(Object.create(j.prototype),{constructor:Nn,isBone:!0}),Gu=new O,Ku=new O,qu=[],Ju=new de,Pn.prototype=Object.assign(Object.create(de.prototype),{constructor:Pn,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,e*16)},raycast:function(e,t){var n=this.matrixWorld,r=this.count;if(Ju.geometry=this.geometry,Ju.material=this.material,Ju.material!==void 0)for(var i=0;i<r;i++){this.getMatrixAt(i,Gu),Ku.multiplyMatrices(n,Gu),Ju.matrixWorld=Ku,Ju.raycast(e,qu);for(var a=0,o=qu.length;a<o;a++){var s=qu[a];s.instanceId=i,s.object=this,t.push(s)}qu.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,e*16)},updateMorphTargets:function(){}}),Fn.prototype=Object.create(V.prototype),Fn.prototype.constructor=Fn,Fn.prototype.isLineBasicMaterial=!0,Fn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this},Yu=new D,Xu=new D,Zu=new O,Qu=new I,$u=new F,In.prototype=Object.assign(Object.create(j.prototype),{constructor:In,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)Yu.fromBufferAttribute(t,r-1),Xu.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Yu.distanceTo(Xu);e.setAttribute(`lineDistance`,new K(n,1))}else console.warn(`THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);else if(e.isGeometry){var a=e.vertices,n=e.lineDistances;n[0]=0;for(var r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this},raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),$u.copy(n.boundingSphere),$u.applyMatrix4(r),$u.radius+=i,e.ray.intersectsSphere($u)!==!1){Zu.getInverse(r),Qu.copy(e.ray).applyMatrix4(Zu);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new D,c=new D,l=new D,u=new D,d=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var f=n.index,p=n.attributes.position.array;if(f!==null)for(var m=f.array,h=0,g=m.length-1;h<g;h+=d){var _=m[h],v=m[h+1];s.fromArray(p,_*3),c.fromArray(p,v*3);var y=Qu.distanceSqToSegment(s,c,u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}else for(var h=0,g=p.length/3-1;h<g;h+=d){s.fromArray(p,3*h),c.fromArray(p,3*h+3);var y=Qu.distanceSqToSegment(s,c,u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}}else if(n.isGeometry)for(var x=n.vertices,S=x.length,h=0;h<S-1;h+=d){var y=Qu.distanceSqToSegment(x[h],x[h+1],u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ed=new D,td=new D,Ln.prototype=Object.assign(Object.create(In.prototype),{constructor:Ln,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)ed.fromBufferAttribute(t,r),td.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ed.distanceTo(td);e.setAttribute(`lineDistance`,new K(n,1))}else console.warn(`THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);else if(e.isGeometry)for(var a=e.vertices,n=e.lineDistances,r=0,i=a.length;r<i;r+=2)ed.copy(a[r]),td.copy(a[r+1]),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ed.distanceTo(td);return this}}),Rn.prototype=Object.assign(Object.create(In.prototype),{constructor:Rn,isLineLoop:!0}),zn.prototype=Object.create(V.prototype),zn.prototype.constructor=zn,zn.prototype.isPointsMaterial=!0,zn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this},nd=new O,rd=new I,id=new F,ad=new D,Bn.prototype=Object.assign(Object.create(j.prototype),{constructor:Bn,isPoints:!0,raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),id.copy(n.boundingSphere),id.applyMatrix4(r),id.radius+=i,e.ray.intersectsSphere(id)!==!1){nd.getInverse(r),rd.copy(e.ray).applyMatrix4(nd);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes.position.array;if(s!==null)for(var l=s.array,u=0,d=l.length;u<d;u++){var f=l[u];ad.fromArray(c,f*3),Vn(ad,f,o,r,e,t,this)}else for(var u=0,p=c.length/3;u<p;u++)ad.fromArray(c,u*3),Vn(ad,u,o,r,e,t,this)}else for(var m=n.vertices,u=0,p=m.length;u<p;u++)Vn(m[u],u,o,r,e,t,this)}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Hn.prototype=Object.assign(Object.create(S.prototype),{constructor:Hn,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Un.prototype=Object.create(S.prototype),Un.prototype.constructor=Un,Un.prototype.isCompressedTexture=!0,Wn.prototype=Object.create(S.prototype),Wn.prototype.constructor=Wn,Wn.prototype.isCanvasTexture=!0,Gn.prototype=Object.create(S.prototype),Gn.prototype.constructor=Gn,Gn.prototype.isDepthTexture=!0,Kn.prototype=Object.create(q.prototype),Kn.prototype.constructor=Kn,qn.prototype=Object.create(J.prototype),qn.prototype.constructor=qn,Jn.prototype=Object.create(q.prototype),Jn.prototype.constructor=Jn,Yn.prototype=Object.create(J.prototype),Yn.prototype.constructor=Yn,Xn.prototype=Object.create(q.prototype),Xn.prototype.constructor=Xn,Zn.prototype=Object.create(J.prototype),Zn.prototype.constructor=Zn,Qn.prototype=Object.create(Xn.prototype),Qn.prototype.constructor=Qn,$n.prototype=Object.create(J.prototype),$n.prototype.constructor=$n,er.prototype=Object.create(Xn.prototype),er.prototype.constructor=er,tr.prototype=Object.create(J.prototype),tr.prototype.constructor=tr,nr.prototype=Object.create(Xn.prototype),nr.prototype.constructor=nr,rr.prototype=Object.create(J.prototype),rr.prototype.constructor=rr,ir.prototype=Object.create(Xn.prototype),ir.prototype.constructor=ir,ar.prototype=Object.create(J.prototype),ar.prototype.constructor=ar,or.prototype=Object.create(q.prototype),or.prototype.constructor=or,or.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},sr.prototype=Object.create(J.prototype),sr.prototype.constructor=sr,cr.prototype=Object.create(q.prototype),cr.prototype.constructor=cr,lr.prototype=Object.create(J.prototype),lr.prototype.constructor=lr,ur.prototype=Object.create(q.prototype),ur.prototype.constructor=ur,od={triangulate:function(e,t,n){n=n||2;var r=t&&t.length,i=r?t[0]*n:e.length,a=dr(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;var s,c,l,u,d,f,p;if(r&&(a=vr(e,t,a,n)),e.length>80*n){s=l=e[0],c=u=e[1];for(var m=n;m<i;m+=n)d=e[m],f=e[m+1],d<s&&(s=d),f<c&&(c=f),d>l&&(l=d),f>u&&(u=f);p=Math.max(l-s,u-c),p=p===0?0:1/p}return pr(a,o,n,s,c,p),o}},sd={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5},isClockWise:function(e){return sd.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];Hr(e),Ur(n,e);var a=e.length;t.forEach(Hr);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Ur(n,t[o]);for(var s=od.triangulate(n,r),o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}},Wr.prototype=Object.create(J.prototype),Wr.prototype.constructor=Wr,Wr.prototype.toJSON=function(){var e=J.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return Kr(t,n,e)},Gr.prototype=Object.create(q.prototype),Gr.prototype.constructor=Gr,Gr.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return Kr(t,n,e)},cd={generateTopUV:function(e,t,n,r,i){var a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new b(a,o),new b(s,c),new b(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<.01?[new b(o,1-c),new b(l,1-d),new b(f,1-m),new b(h,1-_)]:[new b(s,1-c),new b(u,1-d),new b(p,1-m),new b(g,1-_)]}},qr.prototype=Object.create(J.prototype),qr.prototype.constructor=qr,Jr.prototype=Object.create(Gr.prototype),Jr.prototype.constructor=Jr,Yr.prototype=Object.create(J.prototype),Yr.prototype.constructor=Yr,Xr.prototype=Object.create(q.prototype),Xr.prototype.constructor=Xr,Zr.prototype=Object.create(J.prototype),Zr.prototype.constructor=Zr,Qr.prototype=Object.create(q.prototype),Qr.prototype.constructor=Qr,$r.prototype=Object.create(J.prototype),$r.prototype.constructor=$r,ei.prototype=Object.create(q.prototype),ei.prototype.constructor=ei,ti.prototype=Object.create(J.prototype),ti.prototype.constructor=ti,ti.prototype.toJSON=function(){var e=J.prototype.toJSON.call(this),t=this.parameters.shapes;return ri(t,e)},ni.prototype=Object.create(q.prototype),ni.prototype.constructor=ni,ni.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this),t=this.parameters.shapes;return ri(t,e)},ii.prototype=Object.create(q.prototype),ii.prototype.constructor=ii,ai.prototype=Object.create(J.prototype),ai.prototype.constructor=ai,oi.prototype=Object.create(q.prototype),oi.prototype.constructor=oi,si.prototype=Object.create(ai.prototype),si.prototype.constructor=si,ci.prototype=Object.create(oi.prototype),ci.prototype.constructor=ci,li.prototype=Object.create(J.prototype),li.prototype.constructor=li,ui.prototype=Object.create(q.prototype),ui.prototype.constructor=ui,ld=Object.freeze({__proto__:null,WireframeGeometry:Kn,ParametricGeometry:qn,ParametricBufferGeometry:Jn,TetrahedronGeometry:Zn,TetrahedronBufferGeometry:Qn,OctahedronGeometry:$n,OctahedronBufferGeometry:er,IcosahedronGeometry:tr,IcosahedronBufferGeometry:nr,DodecahedronGeometry:rr,DodecahedronBufferGeometry:ir,PolyhedronGeometry:Yn,PolyhedronBufferGeometry:Xn,TubeGeometry:ar,TubeBufferGeometry:or,TorusKnotGeometry:sr,TorusKnotBufferGeometry:cr,TorusGeometry:lr,TorusBufferGeometry:ur,TextGeometry:qr,TextBufferGeometry:Jr,SphereGeometry:Yr,SphereBufferGeometry:Xr,RingGeometry:Zr,RingBufferGeometry:Qr,PlaneGeometry:Te,PlaneBufferGeometry:Ee,LatheGeometry:$r,LatheBufferGeometry:ei,ShapeGeometry:ti,ShapeBufferGeometry:ni,ExtrudeGeometry:Wr,ExtrudeBufferGeometry:Gr,EdgesGeometry:ii,ConeGeometry:si,ConeBufferGeometry:ci,CylinderGeometry:ai,CylinderBufferGeometry:oi,CircleGeometry:li,CircleBufferGeometry:ui,BoxGeometry:eu,BoxBufferGeometry:tu}),di.prototype=Object.create(V.prototype),di.prototype.constructor=di,di.prototype.isShadowMaterial=!0,di.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this},fi.prototype=Object.create(ge.prototype),fi.prototype.constructor=fi,fi.prototype.isRawShaderMaterial=!0,pi.prototype=Object.create(V.prototype),pi.prototype.constructor=pi,pi.prototype.isMeshStandardMaterial=!0,pi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},mi.prototype=Object.create(pi.prototype),mi.prototype.constructor=mi,mi.prototype.isMeshPhysicalMaterial=!0,mi.prototype.copy=function(e){return pi.prototype.copy.call(this,e),this.defines={STANDARD:``,PHYSICAL:``},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new z).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},hi.prototype=Object.create(V.prototype),hi.prototype.constructor=hi,hi.prototype.isMeshPhongMaterial=!0,hi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},gi.prototype=Object.create(V.prototype),gi.prototype.constructor=gi,gi.prototype.isMeshToonMaterial=!0,gi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},_i.prototype=Object.create(V.prototype),_i.prototype.constructor=_i,_i.prototype.isMeshNormalMaterial=!0,_i.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},vi.prototype=Object.create(V.prototype),vi.prototype.constructor=vi,vi.prototype.isMeshLambertMaterial=!0,vi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},yi.prototype=Object.create(V.prototype),yi.prototype.constructor=yi,yi.prototype.isMeshMatcapMaterial=!0,yi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.defines={MATCAP:``},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},bi.prototype=Object.create(Fn.prototype),bi.prototype.constructor=bi,bi.prototype.isLineDashedMaterial=!0,bi.prototype.copy=function(e){return Fn.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},ud=Object.freeze({__proto__:null,ShadowMaterial:di,SpriteMaterial:Dn,RawShaderMaterial:fi,ShaderMaterial:ge,PointsMaterial:zn,MeshPhysicalMaterial:mi,MeshStandardMaterial:pi,MeshPhongMaterial:hi,MeshToonMaterial:gi,MeshNormalMaterial:_i,MeshLambertMaterial:vi,MeshDepthMaterial:dn,MeshDistanceMaterial:fn,MeshBasicMaterial:re,MeshMatcapMaterial:yi,LineDashedMaterial:bi,LineBasicMaterial:Fn,Material:V}),dd={arraySlice:function(e,t,n){return dd.isTypedArray(e)?new e.constructor(e.subarray(t,n===void 0?e.length:n)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,n){return e[t]-e[n]}for(var n=e.length,r=Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(t),r},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,c=0;c!==t;++c)i[o++]=e[s+c];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];a!==void 0&&a[r]===void 0;)a=e[i++];if(a!==void 0){var o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push.apply(n,o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}},subclip:function(e,t,n,r,i){i=i||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],d=[],f=0;f<c.times.length;++f){var p=c.times[f]*i;if(!(p<n||p>=r)){u.push(c.times[f]);for(var m=0;m<l;++m)d.push(c.values[f*l+m])}}u.length!==0&&(c.times=dd.convertArray(u,c.times.constructor),c.values=dd.convertArray(d,c.values.constructor),o.push(c))}a.tracks=o;for(var h=1/0,s=0;s<a.tracks.length;++s)h>a.tracks[s].times[0]&&(h=a.tracks[s].times[0]);for(var s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*h);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,r){t===void 0&&(t=0),n===void 0&&(n=e),(r===void 0||r<=0)&&(r=30);for(var i=e.tracks.length,a=t/r,o=0;o<i;++o){var s=n.tracks[o],c=s.ValueTypeName;if(!(c===`bool`||c===`string`)){var l=e.tracks.find(function(e){return e.name===s.name&&e.ValueTypeName===c});if(l!==void 0){var u=s.getValueSize(),d=s.times.length-1,f;if(a<=s.times[0])f=dd.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[d]){var p=d*u;f=dd.arraySlice(s.values,p)}else{var m=s.createInterpolant();m.evaluate(a),f=m.resultBuffer}c===`quaternion`&&new E(f[0],f[1],f[2],f[3]).normalize().conjugate().toArray(f);for(var h=l.times.length,g=0;g<h;++g){var _=g*u;if(c===`quaternion`)E.multiplyQuaternionsFlat(l.values,_,f,0,l.values,_);else for(var v=0;v<u;++v)l.values[_+v]-=f[v]}}}}return e.blendMode=Qs,e}},Object.assign(xi.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{var a;linear_scan:{forward_scan:if(!(e<r)){for(var o=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){var s=t[1];e<s&&(n=2,i=s);for(var o=n-2;;){if(i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(r===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw Error(`call to abstract method`)},intervalChanged_:function(){}}),Object.assign(xi.prototype,{beforeStart_:xi.prototype.copySampleValue_,afterEnd_:xi.prototype.copySampleValue_}),Si.prototype=Object.assign(Object.create(xi.prototype),{constructor:Si,DefaultSettings_:{endingStart:Js,endingEnd:Js},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ys:i=e,o=2*t-n;break;case Xs:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case Ys:a=e,s=2*n-t;break;case Xs:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m,b=0;b!==o;++b)i[b]=g*a[l+b]+_*a[c+b]+v*a[s+b]+y*a[u+b];return i}}),Ci.prototype=Object.assign(Object.create(xi.prototype),{constructor:Ci,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l,d=0;d!==o;++d)i[d]=a[c+d]*u+a[s+d]*l;return i}}),wi.prototype=Object.assign(Object.create(xi.prototype),{constructor:wi,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(Ti,{toJSON:function(e){var t=e.constructor,n;if(t.toJSON!==void 0)n=t.toJSON(e);else{n={name:e.name,times:dd.convertArray(e.times,Array),values:dd.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}}),Object.assign(Ti.prototype,{constructor:Ti,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Ks,InterpolantFactoryMethodDiscrete:function(e){return new wi(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Ci(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Si(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Gs:t=this.InterpolantFactoryMethodDiscrete;break;case Ks:t=this.InterpolantFactoryMethodLinear;break;case qs:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){var n=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(n);return console.warn(`THREE.KeyframeTrack:`,n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Gs;case this.InterpolantFactoryMethodLinear:return Ks;case this.InterpolantFactoryMethodSmooth:return qs}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(e!==0)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(e!==1)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);var o=this.getValueSize();this.times=dd.arraySlice(n,i,a),this.values=dd.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);var n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if(typeof s==`number`&&isNaN(s)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,o,s),e=!1;break}if(a!==null&&a>s){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,o,s,a),e=!1;break}a=s}if(r!==void 0&&dd.isTypedArray(r))for(var o=0,c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,o,l),e=!1;break}}return e},optimize:function(){for(var e=dd.arraySlice(this.times),t=dd.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===qs,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(o!==1||c!==c[0]))if(r)s=!0;else for(var l=o*n,u=l-n,d=l+n,f=0;f!==n;++f){var p=t[l+f];if(p!==t[u+f]||p!==t[d+f]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];for(var m=o*n,h=i*n,f=0;f!==n;++f)t[h+f]=t[m+f]}++i}}if(a>0){e[i]=e[a];for(var m=a*n,h=i*n,f=0;f!==n;++f)t[h+f]=t[m+f];++i}return i===e.length?(this.times=e,this.values=t):(this.times=dd.arraySlice(e,0,i),this.values=dd.arraySlice(t,0,i*n)),this},clone:function(){var e=dd.arraySlice(this.times,0),t=dd.arraySlice(this.values,0),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}),Ei.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Ei,ValueTypeName:`bool`,ValueBufferType:Array,DefaultInterpolation:Gs,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Di.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Di,ValueTypeName:`color`}),Oi.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Oi,ValueTypeName:`number`}),ki.prototype=Object.assign(Object.create(xi.prototype),{constructor:ki,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(r-t),l=s+o;s!==l;s+=4)E.slerpFlat(i,0,a,s-o,a,s,c);return i}}),Ai.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Ai,ValueTypeName:`quaternion`,DefaultInterpolation:Ks,InterpolantFactoryMethodLinear:function(e){return new ki(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),ji.prototype=Object.assign(Object.create(Ti.prototype),{constructor:ji,ValueTypeName:`string`,ValueBufferType:Array,DefaultInterpolation:Gs,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Mi.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Mi,ValueTypeName:`vector`}),Object.assign(Ni,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Fi(n[i]).scale(r));return new Ni(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(Ti.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=dd.getKeyframeOrder(s);s=dd.sortedArray(s,1,l),c=dd.sortedArray(c,1,l),!r&&s[0]===0&&(s.push(i),c.push(c[0])),a.push(new Oi(`.morphTargetInfluences[`+t[o].name+`]`,s,c).scale(1/n))}return new Ni(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\\w-]*?)([\\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(i);if(c&&c.length>1){var l=c[1],u=r[l];u||(r[l]=u=[]),u.push(s)}}var d=[];for(var l in r)d.push(Ni.CreateFromMorphTargetSequence(l,r[l],t,n));return d},parseAnimation:function(e,t){if(!e)return console.error(`THREE.AnimationClip: No animation in JSONLoader data.`),null;for(var n=function(e,t,n,r,i){if(n.length!==0){var a=[],o=[];dd.flattenJSON(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.length||-1,o=e.fps||30,s=e.blendMode,c=e.hierarchy||[],l=0;l<c.length;l++){var u=c[l].keys;if(!(!u||u.length===0))if(u[0].morphTargets){for(var d={},f=0;f<u.length;f++)if(u[f].morphTargets)for(var p=0;p<u[f].morphTargets.length;p++)d[u[f].morphTargets[p]]=-1;for(var m in d){for(var h=[],g=[],p=0;p!==u[f].morphTargets.length;++p){var _=u[f];h.push(_.time),g.push(+(_.morphTarget===m))}r.push(new Oi(`.morphTargetInfluence[`+m+`]`,h,g))}a=d.length*(o||1)}else{var v=`.bones[`+t[l].name+`]`;n(Mi,v+`.position`,u,`pos`,r),n(Ai,v+`.quaternion`,u,`rot`,r),n(Mi,v+`.scale`,u,`scl`,r)}}return r.length===0?null:new Ni(i,a,r,s)}}),Object.assign(Ni.prototype,{resetDuration:function(){for(var e=this.tracks,t=0,n=0,r=e.length;n!==r;++n){var i=this.tracks[n];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Ni(this.name,this.duration,e,this.blendMode)}}),fd={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){if(this.enabled!==!1)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},pd=new Ii,Object.assign(Li.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise(function(r,i){n.load(e,r,t,i)})},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),md={},Ri.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ri,load:function(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;if(md[e]!==void 0){md[e].push({onLoad:t,onProgress:n,onError:r});return}var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],l=o[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var u,d=(this.responseType||``).toLowerCase();switch(d){case`arraybuffer`:case`blob`:for(var f=new Uint8Array(l.length),p=0;p<l.length;p++)f[p]=l.charCodeAt(p);u=d===`blob`?new Blob([f.buffer],{type:s}):f.buffer;break;case`document`:u=new DOMParser().parseFromString(l,s);break;case`json`:u=JSON.parse(l);break;default:u=l;break}setTimeout(function(){t&&t(u),i.manager.itemEnd(e)},0)}catch(t){setTimeout(function(){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)},0)}}else{md[e]=[],md[e].push({onLoad:t,onProgress:n,onError:r});var m=new XMLHttpRequest;for(var h in m.open(`GET`,e,!0),m.addEventListener(`load`,function(t){var n=this.response,r=md[e];if(delete md[e],this.status===200||this.status===0){this.status===0&&console.warn(`THREE.FileLoader: HTTP Status 0 received.`),fd.add(e,n);for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onLoad&&s.onLoad(n)}i.manager.itemEnd(e)}else{for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onError&&s.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}},!1),m.addEventListener(`progress`,function(t){for(var n=md[e],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(t)}},!1),m.addEventListener(`error`,function(t){var n=md[e];delete md[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),m.addEventListener(`abort`,function(t){var n=md[e];delete md[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),this.responseType!==void 0&&(m.responseType=this.responseType),this.withCredentials!==void 0&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(this.mimeType===void 0?`text/plain`:this.mimeType),this.requestHeader)m.setRequestHeader(h,this.requestHeader[h]);m.send(null)}return i.manager.itemStart(e),m},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),zi.prototype=Object.assign(Object.create(Li.prototype),{constructor:zi,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var r=Ni.parse(e[n]);t.push(r)}return t}}),Bi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Bi,load:function(e,t,n,r){var i=this,a=[],o=new Un;o.image=a;var s=new Ri(this.manager);s.setPath(this.path),s.setResponseType(`arraybuffer`);function c(c){s.load(e[c],function(e){var n=i.parse(e,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,l===6&&(n.mipmapCount===1&&(o.minFilter=Ko),o.format=n.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(Array.isArray(e))for(var l=0,u=0,d=e.length;u<d;++u)c(u);else s.load(e,function(e){var n=i.parse(e,!0);if(n.isCubemap)for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;n.mipmapCount===1&&(o.minFilter=Ko),o.format=n.format,o.needsUpdate=!0,t&&t(o)},n,r);return o}}),Vi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Vi,load:function(e,t,n,r){var i=this,a=new xe,o=new Ri(this.manager);return o.setResponseType(`arraybuffer`),o.setPath(this.path),o.load(e,function(e){var n=i.parse(e);n&&(n.image===void 0?n.data!==void 0&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data):a.image=n.image,a.wrapS=n.wrapS===void 0?Vo:n.wrapS,a.wrapT=n.wrapT===void 0?Vo:n.wrapT,a.magFilter=n.magFilter===void 0?Ko:n.magFilter,a.minFilter=n.minFilter===void 0?Ko:n.minFilter,a.anisotropy=n.anisotropy===void 0?1:n.anisotropy,n.format!==void 0&&(a.format=n.format),n.type!==void 0&&(a.type=n.type),n.mipmaps!==void 0&&(a.mipmaps=n.mipmaps,a.minFilter=Jo),n.mipmapCount===1&&(a.minFilter=Ko),a.needsUpdate=!0,t&&t(a,n))},n,r),a}}),Hi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Hi,load:function(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;var o=document.createElementNS(`http://www.w3.org/1999/xhtml`,`img`);function s(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1),fd.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.substr(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}),Ui.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ui,load:function(e,t,n,r){var i=new Re,a=new Hi(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],function(e){i.images[n]=e,o++,o===6&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}for(var c=0;c<e.length;++c)s(c);return i}}),Wi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Wi,load:function(e,t,n,r){var i=new S,a=new Hi(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(n){i.image=n,i.format=e.search(/\\.jpe?g($|\\?)/i)>0||e.search(/^data\\:image\\/jpeg/)===0?$o:es,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}}),Object.assign(Y.prototype,{getPoint:function(){return console.warn(`THREE.Curve: .getPoint() not implemented.`),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e===void 0&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t=[],n,r=this.getPoint(0),i,a=0;for(t.push(0),i=1;i<=e;i++)n=this.getPoint(i/e),a+=n.distanceTo(r),t.push(a),r=n;return this.cacheArcLengths=t,t},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){for(var n=this.getLengths(),r=0,i=n.length,a=t||e*n[i-1],o=0,s=i-1,c;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);var l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)},getTangent:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new b:new D);return s.copy(o).sub(a).normalize(),s},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n=new D,r=[],i=[],a=[],o=new D,s=new O,c,l,u;for(c=0;c<=e;c++)l=c/e,r[c]=this.getTangentAt(l,new D),r[c].normalize();i[0]=new D,a[0]=new D;var d=Number.MAX_VALUE,f=Math.abs(r[0].x),p=Math.abs(r[0].y),m=Math.abs(r[0].z);for(f<=d&&(d=f,n.set(1,0,0)),p<=d&&(d=p,n.set(0,1,0)),m<=d&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]),c=1;c<=e;c++)i[c]=i[c-1].clone(),a[c]=a[c-1].clone(),o.crossVectors(r[c-1],r[c]),o.length()>Number.EPSILON&&(o.normalize(),u=Math.acos(X.clamp(r[c-1].dot(r[c]),-1,1)),i[c].applyMatrix4(s.makeRotationAxis(o,u))),a[c].crossVectors(r[c],i[c]);if(t===!0)for(u=Math.acos(X.clamp(i[0].dot(i[e]),-1,1)),u/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(u=-u),c=1;c<=e;c++)i[c].applyMatrix4(s.makeRotationAxis(r[c],u*c)),a[c].crossVectors(r[c],i[c]);return{tangents:r,normals:i,binormals:a}},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Gi.prototype=Object.create(Y.prototype),Gi.prototype.constructor=Gi,Gi.prototype.isEllipseCurve=!0,Gi.prototype.getPoint=function(e,t){for(var n=t||new b,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=s-this.aX,f=c-this.aY;s=d*l-f*u+this.aX,c=d*u+f*l+this.aY}return n.set(s,c)},Gi.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Gi.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},Gi.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Ki.prototype=Object.create(Gi.prototype),Ki.prototype.constructor=Ki,Ki.prototype.isArcCurve=!0,hd=new D,gd=new qi,_d=new qi,vd=new qi,Ji.prototype=Object.create(Y.prototype),Ji.prototype.constructor=Ji,Ji.prototype.isCatmullRomCurve3=!0,Ji.prototype.getPoint=function(e,t){var n=t||new D,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);var c,l,u,d;if(this.closed||o>0?c=r[(o-1)%i]:(hd.subVectors(r[0],r[1]).add(r[0]),c=hd),l=r[o%i],u=r[(o+1)%i],this.closed||o+2<i?d=r[(o+2)%i]:(hd.subVectors(r[i-1],r[i-2]).add(r[i-1]),d=hd),this.curveType===`centripetal`||this.curveType===`chordal`){var f=this.curveType===`chordal`?.5:.25,p=Math.pow(c.distanceToSquared(l),f),m=Math.pow(l.distanceToSquared(u),f),h=Math.pow(u.distanceToSquared(d),f);m<1e-4&&(m=1),p<1e-4&&(p=m),h<1e-4&&(h=m),gd.initNonuniformCatmullRom(c.x,l.x,u.x,d.x,p,m,h),_d.initNonuniformCatmullRom(c.y,l.y,u.y,d.y,p,m,h),vd.initNonuniformCatmullRom(c.z,l.z,u.z,d.z,p,m,h)}else this.curveType===`catmullrom`&&(gd.initCatmullRom(c.x,l.x,u.x,d.x,this.tension),_d.initCatmullRom(c.y,l.y,u.y,d.y,this.tension),vd.initCatmullRom(c.z,l.z,u.z,d.z,this.tension));return n.set(gd.calc(s),_d.calc(s),vd.calc(s)),n},Ji.prototype.copy=function(e){Y.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Ji.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Ji.prototype.fromJSON=function(e){Y.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new D().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},aa.prototype=Object.create(Y.prototype),aa.prototype.constructor=aa,aa.prototype.isCubicBezierCurve=!0,aa.prototype.getPoint=function(e,t){var n=t||new b,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ia(e,r.x,i.x,a.x,o.x),ia(e,r.y,i.y,a.y,o.y)),n},aa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},aa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},aa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},oa.prototype=Object.create(Y.prototype),oa.prototype.constructor=oa,oa.prototype.isCubicBezierCurve3=!0,oa.prototype.getPoint=function(e,t){var n=t||new D,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ia(e,r.x,i.x,a.x,o.x),ia(e,r.y,i.y,a.y,o.y),ia(e,r.z,i.z,a.z,o.z)),n},oa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},oa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},oa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},sa.prototype=Object.create(Y.prototype),sa.prototype.constructor=sa,sa.prototype.isLineCurve=!0,sa.prototype.getPoint=function(e,t){var n=t||new b;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},sa.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},sa.prototype.getTangent=function(e,t){var n=t||new b,n=n.copy(this.v2).sub(this.v1).normalize();return n},sa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},sa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},sa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ca.prototype=Object.create(Y.prototype),ca.prototype.constructor=ca,ca.prototype.isLineCurve3=!0,ca.prototype.getPoint=function(e,t){var n=t||new D;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},ca.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},ca.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ca.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ca.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},la.prototype=Object.create(Y.prototype),la.prototype.constructor=la,la.prototype.isQuadraticBezierCurve=!0,la.prototype.getPoint=function(e,t){var n=t||new b,r=this.v0,i=this.v1,a=this.v2;return n.set($i(e,r.x,i.x,a.x),$i(e,r.y,i.y,a.y)),n},la.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},la.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},la.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ua.prototype=Object.create(Y.prototype),ua.prototype.constructor=ua,ua.prototype.isQuadraticBezierCurve3=!0,ua.prototype.getPoint=function(e,t){var n=t||new D,r=this.v0,i=this.v1,a=this.v2;return n.set($i(e,r.x,i.x,a.x),$i(e,r.y,i.y,a.y),$i(e,r.z,i.z,a.z)),n},ua.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ua.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ua.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},da.prototype=Object.create(Y.prototype),da.prototype.constructor=da,da.prototype.isSplineCurve=!0,da.prototype.getPoint=function(e,t){var n=t||new b,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Yi(o,s.x,c.x,l.x,u.x),Yi(o,s.y,c.y,l.y,u.y)),n},da.prototype.copy=function(e){Y.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this},da.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e},da.prototype.fromJSON=function(e){Y.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new b().fromArray(r))}return this},yd=Object.freeze({__proto__:null,ArcCurve:Ki,CatmullRomCurve3:Ji,CubicBezierCurve:aa,CubicBezierCurve3:oa,EllipseCurve:Gi,LineCurve:sa,LineCurve3:ca,QuadraticBezierCurve:la,QuadraticBezierCurve3:ua,SplineCurve:da}),fa.prototype=Object.assign(Object.create(Y.prototype),{constructor:fa,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new sa(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=o===0?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){e===void 0&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t=[],n,r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?e*2:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];n&&n.equals(l)||(t.push(l),n=l)}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t},copy:function(e){Y.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Y.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Y.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(new yd[r.type]().fromJSON(r))}return this}}),pa.prototype=Object.assign(Object.create(fa.prototype),{constructor:pa,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new sa(this.currentPoint.clone(),new b(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){var i=new la(this.currentPoint.clone(),new b(e,t),new b(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,a){var o=new aa(this.currentPoint.clone(),new b(e,t),new b(n,r),new b(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(e){var t=new da([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this},absarc:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this},ellipse:function(e,t,n,r,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this},absellipse:function(e,t,n,r,i,a,o,s){var c=new Gi(e,t,n,r,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return fa.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=fa.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return fa.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),ma.prototype=Object.assign(Object.create(pa.prototype),{constructor:ma,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){pa.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=pa.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){pa.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(new pa().fromJSON(r))}return this}}),ha.prototype=Object.assign(Object.create(j.prototype),{constructor:ha,isLight:!0,copy:function(e){return j.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}),ga.prototype=Object.assign(Object.create(ha.prototype),{constructor:ga,isHemisphereLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(_a.prototype,{_projScreenMatrix:new O,_lightPositionWorld:new D,_lookTarget:new D,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e={};return this.bias!==0&&(e.bias=this.bias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),va.prototype=Object.assign(Object.create(_a.prototype),{constructor:va,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=X.RAD2DEG*2*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),_a.prototype.updateMatrices.call(this,e)}}),ya.prototype=Object.assign(Object.create(ha.prototype),{constructor:ya,isSpotLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),ba.prototype=Object.assign(Object.create(_a.prototype),{constructor:ba,isPointLightShadow:!0,updateMatrices:function(e,t){t===void 0&&(t=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),xa.prototype=Object.assign(Object.create(ha.prototype),{constructor:xa,isPointLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Sa.prototype=Object.assign(Object.create(_e.prototype),{constructor:Sa,isOrthographicCamera:!0,copy:function(e,t){return _e.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,o-=l*this.view.offsetY,s=o-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}),Ca.prototype=Object.assign(Object.create(_a.prototype),{constructor:Ca,isDirectionalLightShadow:!0,updateMatrices:function(e){_a.prototype.updateMatrices.call(this,e)}}),wa.prototype=Object.assign(Object.create(ha.prototype),{constructor:wa,isDirectionalLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Ta.prototype=Object.assign(Object.create(ha.prototype),{constructor:Ta,isAmbientLight:!0}),Ea.prototype=Object.assign(Object.create(ha.prototype),{constructor:Ea,isRectAreaLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=ha.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(Da.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t},getIrradianceAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*i),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*r),t.addScaledVector(a[5],2*.429043*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],2*.429043*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return new this.constructor().copy(this)},fromArray:function(e,t){t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}}),Object.assign(Da,{getBasisAt:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}),Oa.prototype=Object.assign(Object.create(ha.prototype),{constructor:Oa,isLightProbe:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=ha.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),ka.prototype=Object.assign(Object.create(Li.prototype),{constructor:ka,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){var t=this.textures;function n(e){return t[e]===void 0&&console.warn(`THREE.MaterialLoader: Undefined texture`,e),t[e]}var r=new ud[e.type];if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=new z().setHex(e.sheen)),e.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular.setHex(e.specular),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==1&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.skinning!==void 0&&(r.skinning=e.skinning),e.morphTargets!==void 0&&(r.morphTargets=e.morphTargets),e.morphNormals!==void 0&&(r.morphNormals=e.morphNormals),e.dithering!==void 0&&(r.dithering=e.dithering),e.vertexTangents!==void 0&&(r.vertexTangents=e.vertexTangents),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors==`number`?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case`t`:r.uniforms[i].value=n(a.value);break;case`c`:r.uniforms[i].value=new z().setHex(a.value);break;case`v2`:r.uniforms[i].value=new b().fromArray(a.value);break;case`v3`:r.uniforms[i].value=new D().fromArray(a.value);break;case`v4`:r.uniforms[i].value=new C().fromArray(a.value);break;case`m3`:r.uniforms[i].value=new x().fromArray(a.value);case`m4`:r.uniforms[i].value=new O().fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(e.shading!==void 0&&(r.flatShading=e.shading===1),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=n(e.map)),e.matcap!==void 0&&(r.matcap=n(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){var s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new b().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=n(e.specularMap)),e.envMap!==void 0&&(r.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new b().fromArray(e.clearcoatNormalScale)),r},setTextures:function(e){return this.textures=e,this}}),bd={decodeText:function(e){if(typeof TextDecoder<`u`)return new TextDecoder().decode(e);for(var t=``,n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){var t=e.lastIndexOf(`/`);return t===-1?`./`:e.substr(0,t+1)}},Aa.prototype=Object.assign(Object.create(q.prototype),{constructor:Aa,isInstancedBufferGeometry:!0,copy:function(e){return q.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e=q.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),ja.prototype=Object.assign(Object.create(H.prototype),{constructor:ja,isInstancedBufferAttribute:!0,copy:function(e){return H.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=H.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),Ma.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ma,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){var t=e.isInstancedBufferGeometry?new Aa:new q,n=e.data.index;if(n!==void 0){var r=new xd[n.type](n.array);t.setIndex(new H(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a],r=new xd[o.type](o.array),s=new(o.isInstancedBufferAttribute?ja:H)(r,o.itemSize,o.normalized);o.name!==void 0&&(s.name=o.name),t.setAttribute(a,s)}var c=e.data.morphAttributes;if(c)for(var a in c){for(var l=c[a],u=[],d=0,f=l.length;d<f;d++){var o=l[d],r=new xd[o.type](o.array),s=new H(r,o.itemSize,o.normalized);o.name!==void 0&&(s.name=o.name),u.push(s)}t.morphAttributes[a]=u}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(p!==void 0)for(var d=0,m=p.length;d!==m;++d){var h=p[d];t.addGroup(h.start,h.count,h.materialIndex)}var g=e.data.boundingSphere;if(g!==void 0){var _=new D;g.center!==void 0&&_.fromArray(g.center),t.boundingSphere=new F(_,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}}),xd={Int8Array,Uint8Array,Uint8ClampedArray:typeof Uint8ClampedArray<`u`?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},Na.prototype=Object.assign(Object.create(Li.prototype),{constructor:Na,load:function(e,t,n,r){var i=this,a=this.path===``?bd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new Ri(i.manager);o.setPath(this.path),o.load(e,function(n){var a=null;try{a=JSON.parse(n)}catch(t){r!==void 0&&r(t),console.error(`THREE:ObjectLoader: Can\'t parse `+e+`.`,t.message);return}var o=a.metadata;if(o===void 0||o.type===void 0||o.type.toLowerCase()===`geometry`){console.error(`THREE.ObjectLoader: Can\'t load `+e);return}i.parse(a,t)},n,r)},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,function(){t!==void 0&&t(s)}),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),(e.images===void 0||e.images.length===0)&&t!==void 0&&t(s),s},parseShape:function(e){var t={};if(e!==void 0)for(var n=0,r=e.length;n<r;n++){var i=new ma().fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(e!==void 0)for(var r=new Ma,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case`PlaneGeometry`:case`PlaneBufferGeometry`:o=new ld[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case`BoxGeometry`:case`BoxBufferGeometry`:case`CubeGeometry`:o=new ld[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case`CircleGeometry`:case`CircleBufferGeometry`:o=new ld[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case`CylinderGeometry`:case`CylinderBufferGeometry`:o=new ld[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case`ConeGeometry`:case`ConeBufferGeometry`:o=new ld[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case`SphereGeometry`:case`SphereBufferGeometry`:o=new ld[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case`DodecahedronGeometry`:case`DodecahedronBufferGeometry`:case`IcosahedronGeometry`:case`IcosahedronBufferGeometry`:case`OctahedronGeometry`:case`OctahedronBufferGeometry`:case`TetrahedronGeometry`:case`TetrahedronBufferGeometry`:o=new ld[s.type](s.radius,s.detail);break;case`RingGeometry`:case`RingBufferGeometry`:o=new ld[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case`TorusGeometry`:case`TorusBufferGeometry`:o=new ld[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case`TorusKnotGeometry`:case`TorusKnotBufferGeometry`:o=new ld[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case`TubeGeometry`:case`TubeBufferGeometry`:o=new ld[s.type](new yd[s.path.type]().fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case`LatheGeometry`:case`LatheBufferGeometry`:o=new ld[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case`PolyhedronGeometry`:case`PolyhedronBufferGeometry`:o=new ld[s.type](s.vertices,s.indices,s.radius,s.details);break;case`ShapeGeometry`:case`ShapeBufferGeometry`:for(var c=[],l=0,u=s.shapes.length;l<u;l++){var d=t[s.shapes[l]];c.push(d)}o=new ld[s.type](c,s.curveSegments);break;case`ExtrudeGeometry`:case`ExtrudeBufferGeometry`:for(var c=[],l=0,u=s.shapes.length;l<u;l++){var d=t[s.shapes[l]];c.push(d)}var f=s.options.extrudePath;f!==void 0&&(s.options.extrudePath=new yd[f.type]().fromJSON(f)),o=new ld[s.type](c,s.options);break;case`BufferGeometry`:case`InstancedBufferGeometry`:o=r.parse(s);break;case`Geometry`:console.error(`THREE.ObjectLoader: Loading "Geometry" is not supported anymore.`);break;default:console.warn(`THREE.ObjectLoader: Unsupported geometry type "`+s.type+`"`);continue}o.uuid=s.uuid,s.name!==void 0&&(o.name=s.name),o.isBufferGeometry===!0&&s.userData!==void 0&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},r={};if(e!==void 0){var i=new ka;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if(s.type===`MultiMaterial`){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];n[u.uuid]===void 0&&(n[u.uuid]=i.parse(u)),c.push(n[u.uuid])}r[s.uuid]=c}else n[s.uuid]===void 0&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=Ni.parse(r);r.uuid!==void 0&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(e){return n.manager.itemStart(e),a.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}if(e!==void 0&&e.length>0){var a=new Hi(new Ii(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.url;if(Array.isArray(l)){r[c.uuid]=[];for(var u=0,d=l.length;u<d;u++){var f=l[u],p=/^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(f)?f:n.resourcePath+f;r[c.uuid].push(i(p))}}else{var p=/^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url;r[c.uuid]=i(p)}}}return r},parseTextures:function(e,t){function n(e,t){return typeof e==`number`?e:(console.warn(`THREE.ObjectLoader.parseTexture: Constant should be in numeric form.`,e),t[e])}var r={};if(e!==void 0)for(var i=0,a=e.length;i<a;i++){var o=e[i];o.image===void 0&&console.warn(`THREE.ObjectLoader: No "image" specified for`,o.uuid),t[o.image]===void 0&&console.warn(`THREE.ObjectLoader: Undefined image`,o.image);var s=Array.isArray(t[o.image])?new Re(t[o.image]):new S(t[o.image]);s.needsUpdate=!0,s.uuid=o.uuid,o.name!==void 0&&(s.name=o.name),o.mapping!==void 0&&(s.mapping=n(o.mapping,Sd)),o.offset!==void 0&&s.offset.fromArray(o.offset),o.repeat!==void 0&&s.repeat.fromArray(o.repeat),o.center!==void 0&&s.center.fromArray(o.center),o.rotation!==void 0&&(s.rotation=o.rotation),o.wrap!==void 0&&(s.wrapS=n(o.wrap[0],Cd),s.wrapT=n(o.wrap[1],Cd)),o.format!==void 0&&(s.format=o.format),o.type!==void 0&&(s.type=o.type),o.encoding!==void 0&&(s.encoding=o.encoding),o.minFilter!==void 0&&(s.minFilter=n(o.minFilter,wd)),o.magFilter!==void 0&&(s.magFilter=n(o.magFilter,wd)),o.anisotropy!==void 0&&(s.anisotropy=o.anisotropy),o.flipY!==void 0&&(s.flipY=o.flipY),o.premultiplyAlpha!==void 0&&(s.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r},parseObject:function(e,t,n){var r;function i(e){return t[e]===void 0&&console.warn(`THREE.ObjectLoader: Undefined geometry`,e),t[e]}function a(e){if(e!==void 0){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var a=e[r];n[a]===void 0&&console.warn(`THREE.ObjectLoader: Undefined material`,a),t.push(n[a])}return t}return n[e]===void 0&&console.warn(`THREE.ObjectLoader: Undefined material`,e),n[e]}}switch(e.type){case`Scene`:r=new M,e.background!==void 0&&Number.isInteger(e.background)&&(r.background=new z(e.background)),e.fog!==void 0&&(e.fog.type===`Fog`?r.fog=new wn(e.fog.color,e.fog.near,e.fog.far):e.fog.type===`FogExp2`&&(r.fog=new Cn(e.fog.color,e.fog.density)));break;case`PerspectiveCamera`:r=new ve(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(r.focus=e.focus),e.zoom!==void 0&&(r.zoom=e.zoom),e.filmGauge!==void 0&&(r.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(r.filmOffset=e.filmOffset),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case`OrthographicCamera`:r=new Sa(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(r.zoom=e.zoom),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case`AmbientLight`:r=new Ta(e.color,e.intensity);break;case`DirectionalLight`:r=new wa(e.color,e.intensity);break;case`PointLight`:r=new xa(e.color,e.intensity,e.distance,e.decay);break;case`RectAreaLight`:r=new Ea(e.color,e.intensity,e.width,e.height);break;case`SpotLight`:r=new ya(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case`HemisphereLight`:r=new ga(e.color,e.groundColor,e.intensity);break;case`LightProbe`:r=new Oa().fromJSON(e);break;case`SkinnedMesh`:console.warn(`THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.`);case`Mesh`:var o=i(e.geometry),s=a(e.material);r=new de(o,s);break;case`InstancedMesh`:var o=i(e.geometry),s=a(e.material),c=e.count,l=e.instanceMatrix;r=new Pn(o,s,c),r.instanceMatrix=new H(new Float32Array(l.array),16);break;case`LOD`:r=new An;break;case`Line`:r=new In(i(e.geometry),a(e.material),e.mode);break;case`LineLoop`:r=new Rn(i(e.geometry),a(e.material));break;case`LineSegments`:r=new Ln(i(e.geometry),a(e.material));break;case`PointCloud`:case`Points`:r=new Bn(i(e.geometry),a(e.material));break;case`Sprite`:r=new On(a(e.material));break;case`Group`:r=new vn;break;default:r=new j}if(r.uuid=e.uuid,e.name!==void 0&&(r.name=e.name),e.matrix===void 0?(e.position!==void 0&&r.position.fromArray(e.position),e.rotation!==void 0&&r.rotation.fromArray(e.rotation),e.quaternion!==void 0&&r.quaternion.fromArray(e.quaternion),e.scale!==void 0&&r.scale.fromArray(e.scale)):(r.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(r.matrixAutoUpdate=e.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)),e.castShadow!==void 0&&(r.castShadow=e.castShadow),e.receiveShadow!==void 0&&(r.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(r.shadow.bias=e.shadow.bias),e.shadow.radius!==void 0&&(r.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&r.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(r.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(r.visible=e.visible),e.frustumCulled!==void 0&&(r.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(r.renderOrder=e.renderOrder),e.userData!==void 0&&(r.userData=e.userData),e.layers!==void 0&&(r.layers.mask=e.layers),e.children!==void 0)for(var u=e.children,d=0;d<u.length;d++)r.add(this.parseObject(u[d],t,n));if(e.type===`LOD`){e.autoUpdate!==void 0&&(r.autoUpdate=e.autoUpdate);for(var f=e.levels,p=0;p<f.length;p++){var m=f[p],h=r.getObjectByProperty(`uuid`,m.object);h!==void 0&&r.addLevel(h,m.distance)}}return r}}),Sd={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Cd={RepeatWrapping:Bo,ClampToEdgeWrapping:Vo,MirroredRepeatWrapping:Ho},wd={NearestFilter:Uo,NearestMipmapNearestFilter:Wo,NearestMipmapLinearFilter:Go,LinearFilter:Ko,LinearMipmapNearestFilter:qo,LinearMipmapLinearFilter:Jo},Pa.prototype=Object.assign(Object.create(Li.prototype),{constructor:Pa,setOptions:function(e){return this.options=e,this},load:function(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;fetch(e).then(function(e){return e.blob()}).then(function(e){return i.options===void 0?createImageBitmap(e):createImageBitmap(e,i.options)}).then(function(n){fd.add(e,n),t&&t(n),i.manager.itemEnd(e)}).catch(function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}}),Object.assign(Fa.prototype,{moveTo:function(e,t){return this.currentPath=new pa,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this},bezierCurveTo:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new ma;a.curves=i.curves,t.push(a)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[i],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=l*(e.x-o.x)-c*(e.y-o.y);if(u===0)return!0;if(u<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var i=sd.isClockWise,a=this.subPaths;if(a.length===0)return[];if(t===!0)return n(a);var o,s,c,l=[];if(a.length===1)return s=a[0],c=new ma,c.curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=e?!u:u;var d=[],f=[],p=[],m=0,h;f[m]=void 0,p[m]=[];for(var g=0,_=a.length;g<_;g++)s=a[g],h=s.getPoints(),o=i(h),o=e?!o:o,o?(!u&&f[m]&&m++,f[m]={s:new ma,p:h},f[m].s.curves=s.curves,u&&m++,p[m]=[]):p[m].push({h:s,p:h[0]});if(!f[0])return n(a);if(f.length>1){for(var v=!1,y=[],b=0,x=f.length;b<x;b++)d[b]=[];for(var b=0,x=f.length;b<x;b++)for(var S=p[b],C=0;C<S.length;C++){for(var w=S[C],T=!0,E=0;E<f.length;E++)r(w.p,f[E].p)&&(b!==E&&y.push({froms:b,tos:E,hole:C}),T?(T=!1,d[E].push(w)):v=!0);T&&d[b].push(w)}y.length>0&&(v||(p=d))}for(var D,g=0,O=f.length;g<O;g++){c=f[g].s,l.push(c),D=p[g];for(var k=0,A=D.length;k<A;k++)c.holes.push(D[k].h)}return l}}),Object.assign(Ia.prototype,{isFont:!0,generateShapes:function(e,t){t===void 0&&(t=100);for(var n=[],r=La(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),za.prototype=Object.assign(Object.create(Li.prototype),{constructor:za,load:function(e,t,n,r){var i=this,a=new Ri(this.manager);a.setPath(this.path),a.load(e,function(e){var n;try{n=JSON.parse(e)}catch(t){console.warn(`THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.`),n=JSON.parse(e.substring(65,e.length-2))}var r=i.parse(n);t&&t(r)},n,r)},parse:function(e){return new Ia(e)}}),Ed={getContext:function(){return Td===void 0&&(Td=new(window.AudioContext||window.webkitAudioContext)),Td},setContext:function(e){Td=e}},Ba.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ba,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setResponseType(`arraybuffer`),a.setPath(i.path),a.load(e,function(n){try{var a=n.slice(0);Ed.getContext().decodeAudioData(a,function(e){t(e)})}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}}),Va.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Va,isHemisphereLightProbe:!0,copy:function(e){return Oa.prototype.copy.call(this,e),this},toJSON:function(e){return Oa.prototype.toJSON.call(this,e)}}),Ha.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Ha,isAmbientLightProbe:!0,copy:function(e){return Oa.prototype.copy.call(this,e),this},toJSON:function(e){return Oa.prototype.toJSON.call(this,e)}}),Dd=new O,Od=new O,Object.assign(Ua.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n=e.projectionMatrix.clone(),r=t.eyeSep/2,i=r*t.near/t.focus,a=t.near*Math.tan(X.DEG2RAD*t.fov*.5)/t.zoom,o,s;Od.elements[12]=-r,Dd.elements[12]=r,o=-a*t.aspect+i,s=a*t.aspect+i,n.elements[0]=2*t.near/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraL.projectionMatrix.copy(n),o=-a*t.aspect-i,s=a*t.aspect-i,n.elements[0]=2*t.near/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Od),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Dd)}}),Object.assign(Wa.prototype,{start:function(){this.startTime=(typeof performance>`u`?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=(typeof performance>`u`?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}),kd=new D,Ad=new E,jd=new D,Md=new D,Ga.prototype=Object.assign(Object.create(j.prototype),{constructor:Ga,getInput:function(){return this.gain},removeFilter:function(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return this.filter===null?this.gain.disconnect(this.context.destination):(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){j.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(kd,Ad,jd),Md.set(0,0,-1).applyQuaternion(Ad),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(kd.x,r),t.positionY.linearRampToValueAtTime(kd.y,r),t.positionZ.linearRampToValueAtTime(kd.z,r),t.forwardX.linearRampToValueAtTime(Md.x,r),t.forwardY.linearRampToValueAtTime(Md.y,r),t.forwardZ.linearRampToValueAtTime(Md.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(kd.x,kd.y,kd.z),t.setOrientation(Md.x,Md.y,Md.z,n.x,n.y,n.z)}}),Ka.prototype=Object.assign(Object.create(j.prototype),{constructor:Ka,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`audioNode`,this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaNode`,this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaStreamNode`,this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType=`buffer`,this.autoplay&&this.play(),this},play:function(e){if(e===void 0&&(e=0),this.isPlaying===!0){console.warn(`THREE.Audio: Audio is already playing.`);return}if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()},pause:function(){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress%=this.duration||this.buffer.duration),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this},stop:function(){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),this.isPlaying===!0?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn(`THREE.Audio: this Audio has no playback control.`),!1):this.loop},setLoop:function(e){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}),Nd=new D,Pd=new E,Fd=new D,Id=new D,qa.prototype=Object.assign(Object.create(Ka.prototype),{constructor:qa,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(j.prototype.updateMatrixWorld.call(this,e),!(this.hasPlaybackControl===!0&&this.isPlaying===!1)){this.matrixWorld.decompose(Nd,Pd,Fd),Id.set(0,0,1).applyQuaternion(Pd);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Nd.x,n),t.positionY.linearRampToValueAtTime(Nd.y,n),t.positionZ.linearRampToValueAtTime(Nd.z,n),t.orientationX.linearRampToValueAtTime(Id.x,n),t.orientationY.linearRampToValueAtTime(Id.y,n),t.orientationZ.linearRampToValueAtTime(Id.z,n)}else t.setPosition(Nd.x,Nd.y,Nd.z),t.setOrientation(Id.x,Id.y,Id.z)}}}),Object.assign(Ja.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(Ya.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(a===0){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{a+=t;var s=t/a;this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=this.valueSize*3;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*4+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){E.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){var a=this._workIndex*i;E.multiplyQuaternionsFlat(e,a,e,t,e,n),E.slerpFlat(e,t,e,t,e,a,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}},_lerpAdditive:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}),Ld=`\\\\[\\\\]\\\\.:\\\\/`,Rd=RegExp(`[`+Ld+`]`,`g`),zd=`[^`+Ld+`]`,Bd=`[^`+Ld.replace(`\\\\.`,``)+`]`,Vd=`((?:WC+[\\\\/:])*)`.replace(`WC`,zd),Hd=`(WCOD+)?`.replace(`WCOD`,Bd),Ud=`(?:\\\\.(WC+)(?:\\\\[(.+)\\\\])?)?`.replace(`WC`,zd),Wd=`\\\\.(WC+)(?:\\\\[(.+)\\\\])?`.replace(`WC`,zd),Gd=RegExp(`^`+Vd+Hd+Ud+Wd+`$`),Kd=[`material`,`materials`,`bones`],Object.assign(Xa.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(Za,{Composite:Xa,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Za.Composite(e,t,n):new Za(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\\s/g,`_`).replace(Rd,``)},parseTrackName:function(e){var t=Gd.exec(e);if(!t)throw Error(`PropertyBinding: Cannot parse trackName: `+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){var i=n.nodeName.substring(r+1);Kd.indexOf(i)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n},findNode:function(e,t){if(!t||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){var r=function(e){for(var n=0;n<e.length;n++){var i=e[n];if(i.name===t||i.uuid===t)return i;var a=r(i.children);if(a)return a}return null},i=r(e.children);if(i)return i}return null}}),Object.assign(Za.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=Za.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error(`THREE.PropertyBinding: Trying to update node for track: `+this.path+` but it wasn\'t found.`);return}if(n){var a=t.objectIndex;switch(n){case`materials`:if(!e.material){console.error(`THREE.PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!e.material.materials){console.error(`THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}e=e.material.materials;break;case`bones`:if(!e.skeleton){console.error(`THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(e[n]===void 0){console.error(`THREE.PropertyBinding: Can not bind to objectName of node undefined.`,this);return}e=e[n]}if(a!==void 0){if(e[a]===void 0){console.error(`THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,e);return}e=e[a]}}var s=e[r];if(s===void 0){var c=t.nodeName;console.error(`THREE.PropertyBinding: Trying to update property for track: `+c+`.`+r+` but it wasn\'t found.`,e);return}var l=this.Versioning.None;this.targetObject=e,e.needsUpdate===void 0?e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate):l=this.Versioning.NeedsUpdate;var u=this.BindingType.Direct;if(i!==void 0){if(r===`morphTargetInfluences`){if(!e.geometry){console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}e.morphTargetDictionary[i]!==void 0&&(i=e.morphTargetDictionary[i])}else{console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.`,this);return}}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else s.fromArray!==void 0&&s.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Za.prototype,{_getValue_unbound:Za.prototype.getValue,_setValue_unbound:Za.prototype.setValue}),Object.assign(Qa.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var d=arguments[l],f=d.uuid,p=r[f];if(p===void 0){p=t++,r[f]=p,e.push(d);for(var m=0,h=s;m!==h;++m)o[m].push(new Za(d,i[m],a[m]))}else if(p<n){c=e[p];var g=--n,_=e[g];r[_.uuid]=p,e[p]=_,r[f]=g,e[g]=d;for(var m=0,h=s;m!==h;++m){var v=o[m],y=v[g],b=v[p];v[p]=y,b===void 0&&(b=new Za(d,i[m],a[m])),v[g]=b}}else e[p]!==c&&console.error(`THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.`)}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(l!==void 0&&l>=t){var u=t++,d=e[u];n[d.uuid]=l,e[l]=d,n[c]=u,e[u]=s;for(var f=0,p=i;f!==p;++f){var m=r[f],h=m[u],g=m[l];m[l]=h,m[u]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=r[c];if(l!==void 0)if(delete r[c],l<n){var u=--n,d=e[u],f=--t,p=e[f];r[d.uuid]=l,e[l]=d,r[p.uuid]=u,e[u]=p,e.pop();for(var m=0,h=a;m!==h;++m){var g=i[m],_=g[u],v=g[f];g[l]=_,g[u]=v,g.pop()}}else{var f=--t,p=e[f];r[p.uuid]=l,e[l]=p,e.pop();for(var m=0,h=a;m!==h;++m){var g=i[m];g[l]=g[f],g.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(r!==void 0)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=Array(c);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(var d=l,f=s.length;d!==f;++d){var p=s[d];u[d]=new Za(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}),Object.assign($a.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}var i=this._startTime;if(i!==null){var a=(e-i)*n;if(a<0||n===0)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Qs:for(var u=0,d=c.length;u!==d;++u)c[u].evaluate(o),l[u].accumulateAdditive(s);break;case Zs:default:for(var u=0,d=c.length;u!==d;++u)c[u].evaluate(o),l[u].accumulate(r,s)}}},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,r=this.loop,i=this._loopCount,a=r===Ws;if(e===0)return i===-1?t:a&&(i&1)==1?n-t:t;if(r===2200){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));handle_stop:{if(t>=n)t=n;else if(t<0)t=0;else{this.time=t;break handle_stop}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e>0?1:-1});else{if(s===1){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:`loop`,action:this,loopDelta:o})}}else this.time=t;if(a&&(i&1)==1)return n-t}return t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=Ys,r.endingEnd=Ys):(e?r.endingStart=this.zeroSlopeAtStart?Ys:Js:r.endingStart=Xs,t?r.endingEnd=this.zeroSlopeAtEnd?Ys:Js:r.endingEnd=Xs)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),eo.prototype=Object.assign(Object.create(y.prototype),{constructor:eo,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];l===void 0&&(l={},c[s]=l);for(var u=0;u!==i;++u){var d=r[u],f=d.name,p=l[f];if(p!==void 0)a[u]=p;else{if(p=a[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,s,f));continue}var m=t&&t._propertyBindings[u].binding.parsedPath;p=new Ya(Za.create(n,f,m),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,f),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return t!==null&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null;var u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],s.length===0&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.referenceCount===0&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;i===void 0&&(i={},r[t]=i),i[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[i],Object.keys(o).length===0&&delete a[r]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new Ci(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var r=t||this._root,i=r.uuid,a=typeof e==`string`?Ni.findByName(r,e):e,o=a===null?e:a.uuid,s=this._actionsByClip[o],c=null;if(n===void 0&&(n=a===null?Zs:a.blendMode),s!==void 0){var l=s.actionByRoot[i];if(l!==void 0&&l.blendMode===n)return l;c=s.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;var u=new $a(this,a,t,n);return this._bindAction(u,c),this._addInactiveAction(u,o,i),u},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i=typeof e==`string`?Ni.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return o===void 0?null:o.actionByRoot[r]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o)t[o]._update(r,e,i,a);for(var s=this._bindings,c=this._nActiveBindings,o=0;o!==c;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(i!==void 0){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];i!==void 0&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(a!==void 0)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),to.prototype.clone=function(){return new to(this.value.clone===void 0?this.value:this.value.clone())},no.prototype=Object.assign(Object.create(Tn.prototype),{constructor:no,isInstancedInterleavedBuffer:!0,copy:function(e){return Tn.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(ro.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error(`THREE.Raycaster: Unsupported camera type.`)},intersectObject:function(e,t,n){var r=n||[];return ao(e,this,r,t),r.sort(io),r},intersectObjects:function(e,t,n){var r=n||[];if(Array.isArray(e)===!1)return console.warn(`THREE.Raycaster.intersectObjects: objects is not an Array.`),r;for(var i=0,a=e.length;i<a;i++)ao(e[i],this,r,t);return r.sort(io),r}}),Object.assign(oo.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(X.clamp(t/this.radius,-1,1))),this}}),Object.assign(so.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}}),qd=new b,Object.assign(co.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=qd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Box2: .getCenter() target is now required`),e=new b),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn(`THREE.Box2: .getSize() target is now required`),e=new b),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return t===void 0&&(console.warn(`THREE.Box2: .getParameter() target is now required`),t=new b),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Box2: .clampPoint() target is now required`),t=new b),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return qd.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Jd=new D,Yd=new D,Object.assign(lo.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Line3: .getCenter() target is now required`),e=new D),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return e===void 0&&(console.warn(`THREE.Line3: .delta() target is now required`),e=new D),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return t===void 0&&(console.warn(`THREE.Line3: .at() target is now required`),t=new D),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Jd.subVectors(e,this.start),Yd.subVectors(this.end,this.start);var n=Yd.dot(Yd),r=Yd.dot(Jd)/n;return t&&(r=X.clamp(r,0,1)),r},closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return n===void 0&&(console.warn(`THREE.Line3: .closestPointToPoint() target is now required`),n=new D),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),uo.prototype=Object.create(j.prototype),uo.prototype.constructor=uo,uo.prototype.isImmediateRenderObject=!0,Xd=new D,fo.prototype=Object.create(j.prototype),fo.prototype.constructor=fo,fo.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},fo.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Xd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Xd),this.color===void 0?this.cone.material.color.copy(this.light.color):this.cone.material.color.set(this.color)},Zd=new D,Qd=new O,$d=new O,mo.prototype=Object.create(Ln.prototype),mo.prototype.constructor=mo,mo.prototype.isSkeletonHelper=!0,mo.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,r=n.getAttribute(`position`);$d.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(Qd.multiplyMatrices($d,o.matrixWorld),Zd.setFromMatrixPosition(Qd),r.setXYZ(a,Zd.x,Zd.y,Zd.z),Qd.multiplyMatrices($d,o.parent.matrixWorld),Zd.setFromMatrixPosition(Qd),r.setXYZ(a+1,Zd.x,Zd.y,Zd.z),a+=2)}n.getAttribute(`position`).needsUpdate=!0,j.prototype.updateMatrixWorld.call(this,e)},ho.prototype=Object.create(de.prototype),ho.prototype.constructor=ho,ho.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},ho.prototype.update=function(){this.color===void 0?this.material.color.copy(this.light.color):this.material.color.set(this.color)},ef=new D,tf=new z,nf=new z,go.prototype=Object.create(j.prototype),go.prototype.constructor=go,go.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},go.prototype.update=function(){var e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{var t=e.geometry.getAttribute(`color`);tf.copy(this.light.color),nf.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?tf:nf;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(ef.setFromMatrixPosition(this.light.matrixWorld).negate())},_o.prototype=Object.assign(Object.create(Ln.prototype),{constructor:_o,copy:function(e){return Ln.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return new this.constructor().copy(this)}}),vo.prototype=Object.create(Ln.prototype),vo.prototype.constructor=vo,rf=new D,af=new D,of=new D,yo.prototype=Object.create(j.prototype),yo.prototype.constructor=yo,yo.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},yo.prototype.update=function(){rf.setFromMatrixPosition(this.light.matrixWorld),af.setFromMatrixPosition(this.light.target.matrixWorld),of.subVectors(af,rf),this.lightPlane.lookAt(af),this.color===void 0?(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)):(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)),this.targetLine.lookAt(af),this.targetLine.scale.z=of.length()},sf=new D,cf=new _e,bo.prototype=Object.create(Ln.prototype),bo.prototype.constructor=bo,bo.prototype.update=function(){var e=this.geometry,t=this.pointMap,n=1,r=1;cf.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),xo(`c`,t,e,cf,0,0,-1),xo(`t`,t,e,cf,0,0,1),xo(`n1`,t,e,cf,-n,-r,-1),xo(`n2`,t,e,cf,n,-r,-1),xo(`n3`,t,e,cf,-n,r,-1),xo(`n4`,t,e,cf,n,r,-1),xo(`f1`,t,e,cf,-n,-r,1),xo(`f2`,t,e,cf,n,-r,1),xo(`f3`,t,e,cf,-n,r,1),xo(`f4`,t,e,cf,n,r,1),xo(`u1`,t,e,cf,n*.7,r*1.1,-1),xo(`u2`,t,e,cf,-n*.7,r*1.1,-1),xo(`u3`,t,e,cf,0,r*2,-1),xo(`cf1`,t,e,cf,-n,0,1),xo(`cf2`,t,e,cf,n,0,1),xo(`cf3`,t,e,cf,0,-r,1),xo(`cf4`,t,e,cf,0,r,1),xo(`cn1`,t,e,cf,-n,0,-1),xo(`cn2`,t,e,cf,n,0,-1),xo(`cn3`,t,e,cf,0,-r,-1),xo(`cn4`,t,e,cf,0,r,-1),e.getAttribute(`position`).needsUpdate=!0},lf=new N,So.prototype=Object.create(Ln.prototype),So.prototype.constructor=So,So.prototype.update=function(e){if(e!==void 0&&console.warn(`THREE.BoxHelper: .update() has no longer arguments.`),this.object!==void 0&&lf.setFromObject(this.object),!lf.isEmpty()){var t=lf.min,n=lf.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}},So.prototype.setFromObject=function(e){return this.object=e,this.update(),this},So.prototype.copy=function(e){return Ln.prototype.copy.call(this,e),this.object=e.object,this},So.prototype.clone=function(){return new this.constructor().copy(this)},Co.prototype=Object.create(Ln.prototype),Co.prototype.constructor=Co,Co.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),j.prototype.updateMatrixWorld.call(this,e))},wo.prototype=Object.create(In.prototype),wo.prototype.constructor=wo,wo.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=+(t<0),this.lookAt(this.plane.normal),j.prototype.updateMatrixWorld.call(this,e)},uf=new D,To.prototype=Object.create(j.prototype),To.prototype.constructor=To,To.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{uf.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(uf,t)}},To.prototype.setLength=function(e,t,n){t===void 0&&(t=.2*e),n===void 0&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},To.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},To.prototype.copy=function(e){return j.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},To.prototype.clone=function(){return new this.constructor().copy(this)},Eo.prototype=Object.create(Ln.prototype),Eo.prototype.constructor=Eo,pf=4,mf=8,hf=Math.pow(2,mf),gf=[.125,.215,.35,.446,.526,.582],_f=mf-pf+1+gf.length,vf=20,yf={[$s]:0,[ec]:1,[nc]:2,[ic]:3,[ac]:4,[oc]:5,[tc]:6},bf=new Sa,{_lodPlanes:xf,_sizeLods:Sf,_sigmas:Cf}=ko(),wf=null,Tf=(1+Math.sqrt(5))/2,Ef=1/Tf,Df=[new D(1,1,1),new D(-1,1,1),new D(1,1,-1),new D(-1,1,-1),new D(0,Tf,Ef),new D(0,Tf,-Ef),new D(Ef,0,Tf),new D(-Ef,0,Tf),new D(Tf,Ef,0),new D(-Tf,Ef,0)],Do.prototype={constructor:Do,fromScene:function(e,t=0,n=.1,r=100){wf=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i},fromEquirectangular:function(e){return e.magFilter=Uo,e.minFilter=Uo,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){wf=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t},compileCubemapShader:function(){this._cubemapShader===null&&(this._cubemapShader=Po(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){this._equirectShader===null&&(this._equirectShader=No(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(var e=0;e<xf.length;e++)xf[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(wf),e.scissorTest=!1,e.setSize(e.width,e.height)},_allocateTargets:function(e){var t={magFilter:Uo,minFilter:Uo,generateMipmaps:!1,type:Yo,format:ts,encoding:Oo(e)?e.encoding:nc,depthBuffer:!1,stencilBuffer:!1},n=Ao(t);return n.depthBuffer=!e,this._pingPongRenderTarget=Ao(t),n},_compileMaterial:function(e){var t=new de(xf[0],e);this._renderer.compile(t,bf)},_sceneToCubeUV:function(e,t,n,r){var i=new ve(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,c=s.outputEncoding,l=s.toneMapping,u=s.toneMappingExposure,d=s.getClearColor(),f=s.getClearAlpha();s.toneMapping=1,s.toneMappingExposure=1,s.outputEncoding=$s;var p=e.background;if(p&&p.isColor){p.convertSRGBToLinear();var m=Math.max(p.r,p.g,p.b),h=Math.min(Math.max(Math.ceil(Math.log2(m)),-128),127);p=p.multiplyScalar(Math.pow(2,-h));var g=(h+128)/255;s.setClearColor(p,g),e.background=null}for(var _=0;_<6;_++){var v=_%3;v==0?(i.up.set(0,a[_],0),i.lookAt(o[_],0,0)):v==1?(i.up.set(0,0,a[_]),i.lookAt(0,o[_],0)):(i.up.set(0,a[_],0),i.lookAt(0,0,o[_])),jo(r,v*hf,_>2?hf:0,hf,hf),s.setRenderTarget(r),s.render(e,i)}s.toneMapping=l,s.toneMappingExposure=u,s.outputEncoding=c,s.setClearColor(d,f)},_textureToCubeUV:function(e,t){var n=this._renderer;e.isCubeTexture?this._cubemapShader==null&&(this._cubemapShader=Po()):this._equirectShader==null&&(this._equirectShader=No());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new de(xf[0],r),a=r.uniforms;a.envMap.value=e,e.isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=yf[e.encoding],a.outputEncoding.value=yf[t.texture.encoding],jo(t,0,0,3*hf,2*hf),n.setRenderTarget(t),n.render(i,bf)},_applyPMREM:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<_f;r++){var i=Math.sqrt(Cf[r]*Cf[r]-Cf[r-1]*Cf[r-1]),a=Df[(r-1)%Df.length];this._blur(e,r-1,r,i,a)}t.autoClear=n},_blur:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,`latitudinal`,i),this._halfBlur(a,e,n,n,r,`longitudinal`,i)},_halfBlur:function(e,t,n,r,i,a,o){var s=this._renderer,c=this._blurMaterial;a!==`latitudinal`&&a!==`longitudinal`&&console.error(`blur direction must be either latitudinal or longitudinal!`);var l=3,u=new de(xf[r],c),d=c.uniforms,f=Sf[n]-1,p=isFinite(i)?Math.PI/(2*f):2*Math.PI/(2*vf-1),m=i/p,h=isFinite(i)?1+Math.floor(l*m):vf;h>vf&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${h} samples when the maximum is set to ${vf}`);for(var g=[],_=0,v=0;v<vf;++v){var y=v/m,b=Math.exp(-y*y/2);g.push(b),v==0?_+=b:v<h&&(_+=2*b)}for(var v=0;v<g.length;v++)g[v]=g[v]/_;d.envMap.value=e.texture,d.samples.value=h,d.weights.value=g,d.latitudinal.value=a===`latitudinal`,o&&(d.poleAxis.value=o),d.dTheta.value=p,d.mipInt.value=mf-n,d.inputEncoding.value=yf[e.texture.encoding],d.outputEncoding.value=yf[e.texture.encoding];var x=Sf[r],y=3*Math.max(0,hf-2*x);jo(t,y,(r===0?0:2*hf)+2*x*(r>mf-pf?r-mf+pf:0),3*x,2*x),s.setRenderTarget(t),s.render(u,bf)}},Y.create=function(e,t){return console.log(`THREE.Curve.create() has been deprecated`),e.prototype=Object.create(Y.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(fa.prototype,{createPointsGeometry:function(e){console.warn(`THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn(`THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn(`THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);for(var t=new J,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new D(i.x,i.y,i.z||0))}return t}}),Object.assign(pa.prototype,{fromPoints:function(e){return console.warn(`THREE.Path: .fromPoints() has been renamed to .setFromPoints().`),this.setFromPoints(e)}}),Lo.prototype=Object.create(Ji.prototype),Ro.prototype=Object.create(Ji.prototype),zo.prototype=Object.create(Ji.prototype),Object.assign(zo.prototype,{initFromArray:function(){console.error(`THREE.Spline: .initFromArray() has been removed.`)},getControlPointsArray:function(){console.error(`THREE.Spline: .getControlPointsArray() has been removed.`)},reparametrizeByArcLength:function(){console.error(`THREE.Spline: .reparametrizeByArcLength() has been removed.`)}}),_o.prototype.setColors=function(){console.error(`THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.`)},mo.prototype.update=function(){console.error(`THREE.SkeletonHelper: update() no longer needs to be called.`)},Object.assign(Li.prototype,{extractUrlBase:function(e){return console.warn(`THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.`),bd.extractUrlBase(e)}}),Li.Handlers={add:function(){console.error(`THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.`)},get:function(){console.error(`THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.`)}},Object.assign(Na.prototype,{setTexturePath:function(e){return console.warn(`THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().`),this.setResourcePath(e)}}),Object.assign(co.prototype,{center:function(e){return console.warn(`THREE.Box2: .center() has been renamed to .getCenter().`),this.getCenter(e)},empty:function(){return console.warn(`THREE.Box2: .empty() has been renamed to .isEmpty().`),this.isEmpty()},isIntersectionBox:function(e){return console.warn(`THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},size:function(e){return console.warn(`THREE.Box2: .size() has been renamed to .getSize().`),this.getSize(e)}}),Object.assign(N.prototype,{center:function(e){return console.warn(`THREE.Box3: .center() has been renamed to .getCenter().`),this.getCenter(e)},empty:function(){return console.warn(`THREE.Box3: .empty() has been renamed to .isEmpty().`),this.isEmpty()},isIntersectionBox:function(e){return console.warn(`THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn(`THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().`),this.intersectsSphere(e)},size:function(e){return console.warn(`THREE.Box3: .size() has been renamed to .getSize().`),this.getSize(e)}}),Object.assign(F.prototype,{empty:function(){return console.warn(`THREE.Sphere: .empty() has been renamed to .isEmpty().`),this.isEmpty()}}),Se.prototype.setFromMatrix=function(e){return console.warn(`THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().`),this.setFromProjectionMatrix(e)},lo.prototype.center=function(e){return console.warn(`THREE.Line3: .center() has been renamed to .getCenter().`),this.getCenter(e)},Object.assign(X,{random16:function(){return console.warn(`THREE.Math: .random16() has been deprecated. Use Math.random() instead.`),Math.random()},nearestPowerOfTwo:function(e){return console.warn(`THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().`),X.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn(`THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().`),X.ceilPowerOfTwo(e)}}),Object.assign(x.prototype,{flattenToArrayOffset:function(e,t){return console.warn(`THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.`),this.toArray(e,t)},multiplyVector3:function(e){return console.warn(`THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.`),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error(`THREE.Matrix3: .multiplyVector3Array() has been removed.`)},applyToBufferAttribute:function(e){return console.warn(`THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.`),e.applyMatrix3(this)},applyToVector3Array:function(){console.error(`THREE.Matrix3: .applyToVector3Array() has been removed.`)}}),Object.assign(O.prototype,{extractPosition:function(e){return console.warn(`THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().`),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn(`THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.`),this.toArray(e,t)},getPosition:function(){return console.warn(`THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.`),new D().setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn(`THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().`),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn(`THREE.Matrix4: .multiplyToArray() has been removed.`)},multiplyVector3:function(e){return console.warn(`THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn(`THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error(`THREE.Matrix4: .multiplyVector3Array() has been removed.`)},rotateAxis:function(e){console.warn(`THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.`),e.transformDirection(this)},crossVector:function(e){return console.warn(`THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},translate:function(){console.error(`THREE.Matrix4: .translate() has been removed.`)},rotateX:function(){console.error(`THREE.Matrix4: .rotateX() has been removed.`)},rotateY:function(){console.error(`THREE.Matrix4: .rotateY() has been removed.`)},rotateZ:function(){console.error(`THREE.Matrix4: .rotateZ() has been removed.`)},rotateByAxis:function(){console.error(`THREE.Matrix4: .rotateByAxis() has been removed.`)},applyToBufferAttribute:function(e){return console.warn(`THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},applyToVector3Array:function(){console.error(`THREE.Matrix4: .applyToVector3Array() has been removed.`)},makeFrustum:function(e,t,n,r,i,a){return console.warn(`THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.`),this.makePerspective(e,t,r,n,i,a)}}),L.prototype.isIntersectionLine=function(e){return console.warn(`THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().`),this.intersectsLine(e)},E.prototype.multiplyVector3=function(e){return console.warn(`THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.`),e.applyQuaternion(this)},Object.assign(I.prototype,{isIntersectionBox:function(e){return console.warn(`THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn(`THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().`),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn(`THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().`),this.intersectsSphere(e)}}),Object.assign(R.prototype,{area:function(){return console.warn(`THREE.Triangle: .area() has been renamed to .getArea().`),this.getArea()},barycoordFromPoint:function(e,t){return console.warn(`THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().`),this.getBarycoord(e,t)},midpoint:function(e){return console.warn(`THREE.Triangle: .midpoint() has been renamed to .getMidpoint().`),this.getMidpoint(e)},normal:function(e){return console.warn(`THREE.Triangle: .normal() has been renamed to .getNormal().`),this.getNormal(e)},plane:function(e){return console.warn(`THREE.Triangle: .plane() has been renamed to .getPlane().`),this.getPlane(e)}}),Object.assign(R,{barycoordFromPoint:function(e,t,n,r,i){return console.warn(`THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().`),R.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn(`THREE.Triangle: .normal() has been renamed to .getNormal().`),R.getNormal(e,t,n,r)}}),Object.assign(ma.prototype,{extractAllPoints:function(e){return console.warn(`THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.`),this.extractPoints(e)},extrude:function(e){return console.warn(`THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.`),new Wr(this,e)},makeGeometry:function(e){return console.warn(`THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.`),new ti(this,e)}}),Object.assign(b.prototype,{fromAttribute:function(e,t,n){return console.warn(`THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn(`THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().`),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn(`THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(D.prototype,{setEulerFromRotationMatrix:function(){console.error(`THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.`)},setEulerFromQuaternion:function(){console.error(`THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.`)},getPositionFromMatrix:function(e){return console.warn(`THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().`),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn(`THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().`),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn(`THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().`),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn(`THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.`),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn(`THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn(`THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().`),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn(`THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(C.prototype,{fromAttribute:function(e,t,n){return console.warn(`THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn(`THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(J.prototype,{computeTangents:function(){console.error(`THREE.Geometry: .computeTangents() has been removed.`)},computeLineDistances:function(){console.error(`THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.`)},applyMatrix:function(e){return console.warn(`THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.assign(j.prototype,{getChildByName:function(e){return console.warn(`THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().`),this.getObjectByName(e)},renderDepth:function(){console.warn(`THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.`)},translate:function(e,t){return console.warn(`THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.`),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error(`THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.`)},applyMatrix:function(e){return console.warn(`THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.defineProperties(j.prototype,{eulerOrder:{get:function(){return console.warn(`THREE.Object3D: .eulerOrder is now .rotation.order.`),this.rotation.order},set:function(e){console.warn(`THREE.Object3D: .eulerOrder is now .rotation.order.`),this.rotation.order=e}},useQuaternion:{get:function(){console.warn(`THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.`)},set:function(){console.warn(`THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.`)}}}),Object.assign(de.prototype,{setDrawMode:function(){console.error(`THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.`)}}),Object.defineProperties(de.prototype,{drawMode:{get:function(){return console.error(`THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.`),0},set:function(){console.error(`THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.`)}}}),Object.defineProperties(An.prototype,{objects:{get:function(){return console.warn(`THREE.LOD: .objects has been renamed to .levels.`),this.levels}}}),Object.defineProperty(Mn.prototype,`useVertexTexture`,{get:function(){console.warn(`THREE.Skeleton: useVertexTexture has been removed.`)},set:function(){console.warn(`THREE.Skeleton: useVertexTexture has been removed.`)}}),jn.prototype.initBones=function(){console.error(`THREE.SkinnedMesh: initBones() has been removed.`)},Object.defineProperty(Y.prototype,`__arcLengthDivisions`,{get:function(){return console.warn(`THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.`),this.arcLengthDivisions},set:function(e){console.warn(`THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.`),this.arcLengthDivisions=e}}),ve.prototype.setLens=function(e,t){console.warn(`THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.`),t!==void 0&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(ha.prototype,{onlyShadow:{set:function(){console.warn(`THREE.Light: .onlyShadow has been removed.`)}},shadowCameraFov:{set:function(e){console.warn(`THREE.Light: .shadowCameraFov is now .shadow.camera.fov.`),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn(`THREE.Light: .shadowCameraLeft is now .shadow.camera.left.`),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn(`THREE.Light: .shadowCameraRight is now .shadow.camera.right.`),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn(`THREE.Light: .shadowCameraTop is now .shadow.camera.top.`),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn(`THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.`),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn(`THREE.Light: .shadowCameraNear is now .shadow.camera.near.`),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn(`THREE.Light: .shadowCameraFar is now .shadow.camera.far.`),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn(`THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.`)}},shadowBias:{set:function(e){console.warn(`THREE.Light: .shadowBias is now .shadow.bias.`),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn(`THREE.Light: .shadowDarkness has been removed.`)}},shadowMapWidth:{set:function(e){console.warn(`THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.`),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn(`THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.`),this.shadow.mapSize.height=e}}}),Object.defineProperties(H.prototype,{length:{get:function(){return console.warn(`THREE.BufferAttribute: .length has been deprecated. Use .count instead.`),this.array.length}},dynamic:{get:function(){return console.warn(`THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.`),this.usage===dc},set:function(){console.warn(`THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.`),this.setUsage(dc)}}}),Object.assign(H.prototype,{setDynamic:function(e){return console.warn(`THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.`),this.setUsage(e===!0?dc:uc),this},copyIndicesArray:function(){console.error(`THREE.BufferAttribute: .copyIndicesArray() has been removed.`)},setArray:function(){console.error(`THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers`)}}),Object.assign(q.prototype,{addIndex:function(e){console.warn(`THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().`),this.setIndex(e)},addAttribute:function(e,t){return console.warn(`THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().`),!(t&&t.isBufferAttribute)&&!(t&&t.isInterleavedBufferAttribute)?(console.warn(`THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).`),this.setAttribute(e,new H(arguments[1],arguments[2]))):e===`index`?(console.warn(`THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.`),this.setIndex(t),this):this.setAttribute(e,t)},addDrawCall:function(e,t,n){n!==void 0&&console.warn(`THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.`),console.warn(`THREE.BufferGeometry: .addDrawCall() is now .addGroup().`),this.addGroup(e,t)},clearDrawCalls:function(){console.warn(`THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().`),this.clearGroups()},computeTangents:function(){console.warn(`THREE.BufferGeometry: .computeTangents() has been removed.`)},computeOffsets:function(){console.warn(`THREE.BufferGeometry: .computeOffsets() has been removed.`)},removeAttribute:function(e){return console.warn(`THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().`),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn(`THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.defineProperties(q.prototype,{drawcalls:{get:function(){return console.error(`THREE.BufferGeometry: .drawcalls has been renamed to .groups.`),this.groups}},offsets:{get:function(){return console.warn(`THREE.BufferGeometry: .offsets has been renamed to .groups.`),this.groups}}}),Object.defineProperties(Aa.prototype,{maxInstancedCount:{get:function(){return console.warn(`THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.`),this.instanceCount},set:function(e){console.warn(`THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.`),this.instanceCount=e}}}),Object.defineProperties(ro.prototype,{linePrecision:{get:function(){return console.warn(`THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.`),this.params.Line.threshold},set:function(e){console.warn(`THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.`),this.params.Line.threshold=e}}}),Object.defineProperties(Tn.prototype,{dynamic:{get:function(){return console.warn(`THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.`),this.usage===dc},set:function(e){console.warn(`THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.`),this.setUsage(e)}}}),Object.assign(Tn.prototype,{setDynamic:function(e){return console.warn(`THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.`),this.setUsage(e===!0?dc:uc),this},setArray:function(){console.error(`THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers`)}}),Object.assign(Gr.prototype,{getArrays:function(){console.error(`THREE.ExtrudeBufferGeometry: .getArrays() has been removed.`)},addShapeList:function(){console.error(`THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.`)},addShape:function(){console.error(`THREE.ExtrudeBufferGeometry: .addShape() has been removed.`)}}),Object.defineProperties(to.prototype,{dynamic:{set:function(){console.warn(`THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.`)}},onUpdate:{value:function(){return console.warn(`THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.`),this}}}),Object.defineProperties(V.prototype,{wrapAround:{get:function(){console.warn(`THREE.Material: .wrapAround has been removed.`)},set:function(){console.warn(`THREE.Material: .wrapAround has been removed.`)}},overdraw:{get:function(){console.warn(`THREE.Material: .overdraw has been removed.`)},set:function(){console.warn(`THREE.Material: .overdraw has been removed.`)}},wrapRGB:{get:function(){return console.warn(`THREE.Material: .wrapRGB has been removed.`),new z}},shading:{get:function(){console.error(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`)},set:function(e){console.warn(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`),this.flatShading=e===1}},stencilMask:{get:function(){return console.warn(`THREE.`+this.type+`: .stencilMask has been removed. Use .stencilFuncMask instead.`),this.stencilFuncMask},set:function(e){console.warn(`THREE.`+this.type+`: .stencilMask has been removed. Use .stencilFuncMask instead.`),this.stencilFuncMask=e}}}),Object.defineProperties(hi.prototype,{metal:{get:function(){return console.warn(`THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.`),!1},set:function(){console.warn(`THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead`)}}}),Object.defineProperties(ge.prototype,{derivatives:{get:function(){return console.warn(`THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.`),this.extensions.derivatives},set:function(e){console.warn(`THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.`),this.extensions.derivatives=e}}}),Object.assign(Sn.prototype,{clearTarget:function(e,t,n,r){console.warn(`THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.`),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn(`THREE.WebGLRenderer: .animate() is now .setAnimationLoop().`),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn(`THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().`),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn(`THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().`),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn(`THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.`),this.capabilities.precision},resetGLState:function(){return console.warn(`THREE.WebGLRenderer: .resetGLState() is now .state.reset().`),this.state.reset()},supportsFloatTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).`),this.extensions.get(`OES_texture_float`)},supportsHalfFloatTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).`),this.extensions.get(`OES_texture_half_float`)},supportsStandardDerivatives:function(){return console.warn(`THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).`),this.extensions.get(`OES_standard_derivatives`)},supportsCompressedTextureS3TC:function(){return console.warn(`THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).`),this.extensions.get(`WEBGL_compressed_texture_s3tc`)},supportsCompressedTexturePVRTC:function(){return console.warn(`THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).`),this.extensions.get(`WEBGL_compressed_texture_pvrtc`)},supportsBlendMinMax:function(){return console.warn(`THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).`),this.extensions.get(`EXT_blend_minmax`)},supportsVertexTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.`),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn(`THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).`),this.extensions.get(`ANGLE_instanced_arrays`)},enableScissorTest:function(e){console.warn(`THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().`),this.setScissorTest(e)},initMaterial:function(){console.warn(`THREE.WebGLRenderer: .initMaterial() has been removed.`)},addPrePlugin:function(){console.warn(`THREE.WebGLRenderer: .addPrePlugin() has been removed.`)},addPostPlugin:function(){console.warn(`THREE.WebGLRenderer: .addPostPlugin() has been removed.`)},updateShadowMap:function(){console.warn(`THREE.WebGLRenderer: .updateShadowMap() has been removed.`)},setFaceCulling:function(){console.warn(`THREE.WebGLRenderer: .setFaceCulling() has been removed.`)},allocTextureUnit:function(){console.warn(`THREE.WebGLRenderer: .allocTextureUnit() has been removed.`)},setTexture:function(){console.warn(`THREE.WebGLRenderer: .setTexture() has been removed.`)},setTexture2D:function(){console.warn(`THREE.WebGLRenderer: .setTexture2D() has been removed.`)},setTextureCube:function(){console.warn(`THREE.WebGLRenderer: .setTextureCube() has been removed.`)},getActiveMipMapLevel:function(){return console.warn(`THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().`),this.getActiveMipmapLevel()}}),Object.defineProperties(Sn.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn(`THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.`),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn(`THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.`),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.`)}},context:{get:function(){return console.warn(`THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.`),this.getContext()}},vr:{get:function(){return console.warn(`THREE.WebGLRenderer: .vr has been renamed to .xr`),this.xr}},gammaInput:{get:function(){return console.warn(`THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.`),!1},set:function(){console.warn(`THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.`)}},gammaOutput:{get:function(){return console.warn(`THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.`),!1},set:function(e){console.warn(`THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.`),this.outputEncoding=e===!0?ec:$s}}}),Object.defineProperties(pn.prototype,{cullFace:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.`)}},renderReverseSided:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.`)}},renderSingleSided:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.`)}}}),Object.defineProperties(w.prototype,{wrapS:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.`),this.texture.wrapS},set:function(e){console.warn(`THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.`),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.`),this.texture.wrapT},set:function(e){console.warn(`THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.`),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.`),this.texture.magFilter},set:function(e){console.warn(`THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.`),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.`),this.texture.minFilter},set:function(e){console.warn(`THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.`),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.`),this.texture.anisotropy},set:function(e){console.warn(`THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.`),this.texture.anisotropy=e}},offset:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .offset is now .texture.offset.`),this.texture.offset},set:function(e){console.warn(`THREE.WebGLRenderTarget: .offset is now .texture.offset.`),this.texture.offset=e}},repeat:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .repeat is now .texture.repeat.`),this.texture.repeat},set:function(e){console.warn(`THREE.WebGLRenderTarget: .repeat is now .texture.repeat.`),this.texture.repeat=e}},format:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .format is now .texture.format.`),this.texture.format},set:function(e){console.warn(`THREE.WebGLRenderTarget: .format is now .texture.format.`),this.texture.format=e}},type:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .type is now .texture.type.`),this.texture.type},set:function(e){console.warn(`THREE.WebGLRenderTarget: .type is now .texture.type.`),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.`),this.texture.generateMipmaps},set:function(e){console.warn(`THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.`),this.texture.generateMipmaps=e}}}),Object.defineProperties(Ka.prototype,{load:{value:function(e){console.warn(`THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.`);var t=this;return new Ba().load(e,function(e){t.setBuffer(e)}),this}},startTime:{set:function(){console.warn(`THREE.Audio: .startTime is now .play( delay ).`)}}}),Ja.prototype.getData=function(){return console.warn(`THREE.AudioAnalyser: .getData() is now .getFrequencyData().`),this.getFrequencyData()},ye.prototype.updateCubeMap=function(e,t){return console.warn(`THREE.CubeCamera: .updateCubeMap() is now .update().`),this.update(e,t)},hc.crossOrigin=void 0,hc.loadTexture=function(e,t,n,r){console.warn(`THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.`);var i=new Wi;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},hc.loadTextureCube=function(e,t,n,r){console.warn(`THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.`);var i=new Ui;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},hc.loadCompressedTexture=function(){console.error(`THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.`)},hc.loadCompressedTextureCube=function(){console.error(`THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.`)},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`117`}}))})),kf=e((()=>{Of()}));Of(),kf();function $(e,t,n){return function(r,i,a){return((r+e-1)/e|0)*((i+t-1)/t|0)*n*a}}function Af(e,t,n){return function(r,i,a){return(Math.max(r,e)*Math.max(i,t)/n|0)*a}}new Map([[rs,$(4,4,8)],[is,$(4,4,8)],[as,$(4,4,16)],[os,$(4,4,16)],[ds,$(4,4,8)],[ss,Af(8,8,2)],[ls,Af(8,8,2)],[cs,Af(16,8,4)],[us,Af(16,8,4)],[fs,$(4,4,8)],[ps,$(4,4,16)],[ms,$(4,4,16)],[ks,$(4,4,16)],[hs,$(5,4,16)],[As,$(5,4,16)],[gs,$(5,5,16)],[js,$(5,5,16)],[_s,$(6,5,16)],[Ms,$(6,5,16)],[vs,$(6,6,16)],[Ns,$(6,6,16)],[ys,$(8,5,16)],[Ps,$(8,5,16)],[bs,$(8,6,16)],[Fs,$(8,6,16)],[xs,$(8,8,16)],[Is,$(8,8,16)],[Ss,$(10,5,16)],[Ls,$(10,5,16)],[Cs,$(10,6,16)],[Rs,$(10,6,16)],[ws,$(10,8,16)],[zs,$(10,8,16)],[Ts,$(10,10,16)],[Bs,$(10,10,16)],[Es,$(12,10,16)],[Vs,$(12,10,16)],[Ds,$(12,12,16)],[Hs,$(12,12,16)],[Os,$(4,4,16)]]),Of();let jf=new O().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);new O().getInverse(jf);function Mf(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function Nf(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Mf(a,r,i,o,s,`next`,e)}function s(e){Mf(a,r,i,o,s,`throw`,e)}o(void 0)})}}function Pf(){return Ff.apply(this,arguments)}function Ff(){return Ff=Nf(function*(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i){try{new URL(`.`,a).href}catch(e){}(function(){var e=Nf(function*(e){var t=yield fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)});return function(t){return e.apply(this,arguments)}})()}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\n;\\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\ntA\\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"(¸\n F@ A¸\nj 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"(¸\n F@ A¸\nj 6\\0 \\rA\\bA\\b(\\0A~ wq6\\0\\f\\v@ \\b(F@ \\b 6\\f\\v \\b 6\\v E\\r\\v \\b6 ("@ 6 6\\v ("E\\r\\0 6 6\\v \\0Ar6 \\0 j \\x006\\0 \\x07G\\r\\0A\\b \\x006\\0\\v \\0AÿM@ \\0AøqA°\\bj!A\\b(\\0"A \\0Avt"\\0qE@A\\b \\0 r6\\0 \\f\\v (\\b\\v!\\0 6\\b \\0 6\\f 6\\f \\x006\\b\\vA! \\0Aÿÿÿ\\x07M@ \\0A& \\0A\\bvg"kvAq AtrA>s!\\v 6 B\\x007 AtA¸\nj!@A\\b(\\0"A t"qE@A\\b r6\\0 6\\0A!A\\b\\f\\v \\0A AvkA\\0 AG\\x1Bt! (\\0!@ "(Axq \\0F\\r Av! At! Aqj"("\\r\\0\\v 6A! !A\\b\\v!\\0 "\\f\\v (\\b" 6\\f 6\\bA!\\0A\\b!A\\0\\v! j 6\\0 6\\f \\0 j 6\\0A¨\\bA¨\\b(\\0Ak"\\0A \\0\\x1B6\\0\\v\\v¸\'\\v#\\0Ak"\n$\\0@@@@@@@@@@ \\0AôM@A\\b(\\0"A \\0A\\vjAøq \\0A\\vI\\x1B"Av"\\0v"Aq@@ AsAq \\0j"At"A°\\bj"\\0 (¸\\b"(\\b"F@A\\b A~ wq6\\0\\f\\v \\x006\\f \\0 6\\b\\v A\\bj!\\0 Ar6 j" (Ar6\\f\\v\\v A\\b(\\0"\\bM\\r @@A \\0t"A\\0 kr \\0tqh"At"A°\\bj" (¸\\b"\\0(\\b"F@A\\b A~ wq"6\\0\\f\\v 6\\f 6\\b\\v \\0 Ar6 \\0 j"\\x07 k"Ar6 \\0 j 6\\0 \\b@ \\bAxqA°\\bj!A\\b(\\0! A \\bAvt"qE@A\\b r6\\0 \\f\\v (\\b\\v! 6\\b 6\\f 6\\f 6\\b\\v \\0A\\bj!\\0A\\b \\x076\\0A\\b 6\\0\\f\\v\\vA\\b(\\0"\\vE\\r \\vhAt(¸\n"(Axq k! !@@ ("\\0E@ ("\\0E\\r\\v \\0(Axq k" I"\\x1B! \\0 \\x1B! \\0!\\f\\v\\v (! (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\n\\v (" Aj ("E\\r Aj\\v!@ !\\x07 "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v \\x07A\\x006\\0\\f \\vA! \\0A¿K\\r\\0 \\0A\\vj"Axq!A\\b(\\0"\\x07E\\r\\0A!\\bA\\0 k! \\0Aôÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtkA>j!\\b\\v@@@ \\bAt(¸\n"E@A\\0!\\0\\f\\vA\\0!\\0 A \\bAvkA\\0 \\bAG\\x1Bt!@@ (Axq k" O\\r\\0 ! "\\r\\0A\\0! !\\0\\f\\v \\0 (" AvAqj("F\\x1B \\0 \\x1B!\\0 At! \\r\\0\\v\\v \\0 rE@A\\0!A \\bt"\\0A\\0 \\0kr \\x07q"\\0E\\r \\0hAt(¸\n!\\0\\v \\0E\\r\\v@ \\0(Axq k" I! \\x1B! \\0 \\x1B! \\0(" \\0(\\v"\\0\\r\\0\\v\\v E\\r\\0 A\\b(\\0 kO\\r\\0 (!\\b (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\\b\\v (" Aj ("E\\r Aj\\v!@ ! "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v A\\x006\\0\\f\\x07\\v A\\b(\\0"M@A\\b(\\0!\\0@ k"AO@ \\0 j" Ar6 \\0 j 6\\0 \\0 Ar6\\f\\v \\0 Ar6 \\0 j" (Ar6A\\0!A\\0!\\vA\\b 6\\0A\\b 6\\0 \\0A\\bj!\\0\\f \\v A\\b(\\0"I@A\\b k"6\\0A\\xA0\\bA\\xA0\\b(\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f \\vA\\0!\\0 A/j"Aà\\v(\\0@Aè\\v(\\0\\f\\vAì\\vB7\\0Aä\\vB\\xA07\\0Aà\\v \nA\\fjApqAتժs6\\0Aô\\vA\\x006\\0AÄ\\vA\\x006\\0A \\v"j"A\\0 k"\\x07q" M\\r\\bAÀ\\v(\\0"@A¸\\v(\\0"\\b j" \\bM Ir\\r \\v@AÄ\\v-\\0\\0AqE@@@@@A\\xA0\\b(\\0"@AÈ\\v!\\0@ \\0(\\0"\\b M@ \\b \\0(jI\\r\\v \\0(\\b"\\0\\r\\0\\v\\vA\\0"AF\\r !Aä\\v(\\0"\\0Ak" q@ k jA\\0 \\0kqj!\\v M\\rAÀ\\v(\\0"\\0@A¸\\v(\\0" j"\\x07 M \\0 \\x07Ir\\r\\v "\\0 G\\r\\f\\v k \\x07q"" \\0(\\0 \\0(jF\\r !\\0\\v \\0AF\\r A0j M@ \\0!\\f\\vAè\\v(\\0" kjA\\0 kq"AF\\r j! \\0!\\f\\v AG\\r\\vAÄ\\vAÄ\\v(\\0Ar6\\0\\v "AFA\\0"\\0AFr \\0 Mr\\r \\0 k" A(jM\\r\\vA¸\\vA¸\\v(\\0 j"\\x006\\0A¼\\v(\\0 \\0I@A¼\\v \\x006\\0\\v@A\\xA0\\b(\\0"@AÈ\\v!\\0@ \\0(\\0" \\0("jF\\r \\0(\\b"\\0\\r\\0\\v\\f\\vA\\b(\\0"\\0A\\0 \\0 M\\x1BE@A\\b 6\\0\\vA\\0!\\0AÌ\\v 6\\0AÈ\\v 6\\0A¨\\bA6\\0A¬\\bAà\\v(\\x006\\0AÔ\\vA\\x006\\0@ \\0At" A°\\bj"6¸\\b 6¼\\b \\0Aj"\\0A G\\r\\0\\vA\\b A(k"\\0Ax kA\\x07q"k"6\\0A\\xA0\\b j"6\\0 Ar6 \\0 jA(6A¤\\bAð\\v(\\x006\\0\\f\\v M Kr\\r \\0(\\fA\\bq\\r \\0 j6A\\xA0\\b Ax kA\\x07q"\\0j"6\\0A\\bA\\b(\\0 j" \\0k"\\x006\\0 \\0Ar6 jA(6A¤\\bAð\\v(\\x006\\0\\f\\vA\\0!\\0\\f\\vA\\0!\\0\\f\\vA\\b(\\0 K@A\\b 6\\0\\v j!AÈ\\v!\\0@@ \\0(\\0"G@ \\0(\\b"\\0\\r\\f\\v\\v \\0-\\0\\fA\\bqE\\r\\vAÈ\\v!\\0@@ \\0(\\0" M@ \\0(j"I\\r\\v \\0(\\b!\\0\\f\\v\\vA\\b A(k"\\0Ax kA\\x07q"k"\\x076\\0A\\xA0\\b j"6\\0 \\x07Ar6 \\0 jA(6A¤\\bAð\\v(\\x006\\0 A\' kA\\x07qjA/k"\\0 \\0 AjI\\x1B"A\\x1B6 AÐ\\v)\\x007 AÈ\\v)\\x007\\bAÐ\\v A\\bj6\\0AÌ\\v 6\\0AÈ\\v 6\\0AÔ\\vA\\x006\\0 Aj!\\0@ \\0A\\x076 \\0A\\bj \\0Aj!\\0 I\\r\\0\\v F\\r\\0 (A~q6 k"Ar6 6\\0 AÿM@ AøqA°\\bj!\\0A\\b(\\0"A Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\fA\\f!A\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtA¸\nj!@@A\\b(\\0"A \\0t"qE@A\\b r6\\0 6\\0\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"("\\r\\0\\v 6\\v 6A\\b! "!\\0A\\f\\f\\v (\\b"\\0 6\\f 6\\b \\x006\\bA\\0!\\0A!A\\f\\v j 6\\0 j \\x006\\0\\vA\\b(\\0"\\0 M\\r\\0A\\b \\0 k"6\\0A\\xA0\\bA\\xA0\\b(\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f\\vA\\bA06\\0A\\0!\\0\\f\\v \\0 6\\0 \\0 \\0( j6 Ax kA\\x07qj"\\b Ar6 Ax kA\\x07qj" \\bj"k!\\x07@A\\xA0\\b(\\0 F@A\\xA0\\b 6\\0A\\bA\\b(\\0 \\x07j"\\x006\\0 \\0Ar6\\f\\vA\\b(\\0 F@A\\b 6\\0A\\bA\\b(\\0 \\x07j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\f\\v ("\\0AqAF@ \\0Axq! (\\f!@ \\0AÿM@ (\\b" F@A\\bA\\b(\\0A~ \\0Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!@ G@ (\\b"\\0 6\\f \\x006\\b\\f\\v@ ("\\0 Aj ("\\0E\\r Aj\\v!@ ! \\0"Aj! \\0("\\0\\r\\0 Aj! ("\\0\\r\\0\\v A\\x006\\0\\f\\vA\\0!\\v E\\r\\0@ ("\\0At"(¸\n F@ A¸\nj 6\\0 \\rA\\bA\\b(\\0A~ \\0wq6\\0\\f\\v@ (F@ 6\\f\\v 6\\v E\\r\\v 6 ("\\0@ \\x006 \\0 6\\v ("\\0E\\r\\0 \\x006 \\0 6\\v \\x07 j!\\x07 j"(!\\0\\v \\0A~q6 \\x07Ar6 \\x07j \\x076\\0 \\x07AÿM@ \\x07AøqA°\\bj!\\0A\\b(\\0"A \\x07Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA! \\x07Aÿÿÿ\\x07M@ \\x07A& \\x07A\\bvg"\\0kvAq \\0AtrA>s!\\v 6 B\\x007 AtA¸\nj!\\0@@A\\b(\\0"A t"qE@A\\b r6\\0 \\0 6\\0\\f\\v \\x07A AvkA\\0 AG\\x1Bt! \\0(\\0!@ "\\0(Axq \\x07F\\r Av! At! \\0 Aqj"("\\r\\0\\v 6\\v \\x006 6\\f 6\\b\\f\\v \\0(\\b" 6\\f \\0 6\\b A\\x006 \\x006\\f 6\\b\\v \\bA\\bj!\\0\\f\\v@ \\bE\\r\\0@ ("At"(¸\n F@ A¸\nj \\x006\\0 \\0\\rA\\b \\x07A~ wq"\\x076\\0\\f\\v@ \\b(F@ \\b \\x006\\f\\v \\b \\x006\\v \\0E\\r\\v \\0 \\b6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 AÿM@ AøqA°\\bj!\\0A\\b(\\0"A Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtA¸\nj!@@ \\x07A \\0t"qE@A\\b \\x07r6\\0 6\\0 6\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"\\x07("\\r\\0\\v \\x07 6 6\\v 6\\f 6\\b\\f\\v (\\b"\\0 6\\f 6\\b A\\x006 6\\f \\x006\\b\\v A\\bj!\\0\\f\\v@ E\\r\\0@ ("At"(¸\n F@ A¸\nj \\x006\\0 \\0\\rA\\b \\vA~ wq6\\0\\f\\v@ (F@ \\x006\\f\\v \\x006\\v \\0E\\r\\v \\0 6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 \\b@ \\bAxqA°\\bj!\\0A\\b(\\0!A \\bAvt"\\x07 qE@A\\b \\x07r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\vA\\b 6\\0A\\b 6\\0\\v A\\bj!\\0\\v \nAj$\\0 \\0\\v}\\vA\\0!\\0@ \\0 FE@ \\0A\\fl"Aj"j*\\0!\\f A\\bj"j*\\0!\\v \\bj j*\\0"\\r8\\0 \\b j \\v8\\0 \\b j \\f8\\0 \\0At"j j"#*\\x008\\0 \\0At"Ar"$At" j j" *\\x008\\0 Ar"%At"!j !j"!*\\x008\\0 Ar"&At""j "j""*\\x008\\0 \nj j"\'*\\x008\\0 \n j j"*\\x008\\0 \n j j*\\0"8\\0 \\x07 \\0Atj" \\v8\\b \\f8 \\r8\\0 j-\\0\\0 $j-\\0\\0A\\btr %j-\\0\\0Atr &j-\\0\\0Atr6\\f *\\0! \'*\\0! "*\\0"\\f \\f !*\\0"\\v \\v #*\\0" *\\0"\\r \\r"C\\0\\0\\0\\0^@ \\f "!\\f \\r !\\r ! \\v !\\v\\v \\r \\f" \\v "" " C\\0\\0? \\v \\v" \\f \\f"" " \\r \\v" \\f "" " C\\0\\0@ \\v \\f"\\x1B \\r ""\\f \\f"\\f "\\v \\v"\\v C\\0\\0? \\r \\r" "\\r \\r"\\r C\\0\\0@6 C\\0\\0? " " " " \\x1B " "C\\0\\0@ \\f \\f \\v \\v \\r \\rC\\0\\0@6 A\\x006 \\f \\v \\r C\\0\\0@ C\\0\\0@6 \\0Aj!\\0\\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!=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 P={a:k};function F(){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 I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}),Ff.apply(this,arguments)}let If=new Float32Array(1),Lf=new Uint32Array(If.buffer),Rf=typeof Float16Array<`u`,zf=Rf?new Float16Array(1):null,Bf=Rf?new Uint16Array(zf.buffer):new Uint16Array(1);function Vf(e){if(Rf&&zf)return Bf[0]=e,zf[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 Lf[0]=i,If[0]}var Hf=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t);this.reader=n.getReader()}read(e){return t(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})}},Uf=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 Hf({fileBytes:this.fileBytes})}parseHeader(){return t(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,n,r,i,a,o){return t(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;e==null||e(t,Vf(n[r]),Vf(n[r+1]),Vf(n[r+2]))}}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 t=0;t<this.numSplats;t++)n==null||n(t,e[t]/255)}{let e=yield this.reader.read(this.numSplats*3),t=.28209479177387814/.15;for(let n=0;n<this.numSplats;n++){let i=n*3;r==null||r(n,(e[i]/255-.5)*t+.5,(e[i+1]/255-.5)*t+.5,(e[i+2]/255-.5)*t+.5)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3;i==null||i(t,Math.exp(e[n]/16-10),Math.exp(e[n+1]/16-10),Math.exp(e[n+2]/16-10))}}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,i=[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,i[t]=n/511*e,i[t]=r===0?i[t]:-i[t],u+=i[t]*i[t]}i[c]=Math.sqrt(Math.max(1-u,0)),a==null||a(n,i[0],i[1],i[2],i[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,i=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-i*i-o*o));a==null||a(t,r,i,o,s)}}if(o&&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,a=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[a+e]-128)/128;if(a+=9,r){for(let e=0;e<15;++e)r[e]=(t[a+e]-128)/128;a+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[a+e]-128)/128;a+=21}o==null||o(e,new Float32Array(n),r?new Float32Array(r):void 0,i?new Float32Array(i):void 0)}}})}};function Wf(e){return t(this,void 0,void 0,function*(){let t=new Uf({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)}),{numPoints:n,shDegree:t.shDegree,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l}})}let Gf,Kf=!1;function qf(){return t(this,void 0,void 0,function*(){if(!Gf){for(;Kf;)yield new Promise(e=>setTimeout(e,0));Gf||(Kf=!0,Gf=yield Pf(),Kf=!1)}})}let Jf=0,Yf=0,Xf=0,Zf=0,Qf=0,$f=0,ep=0,tp=0,np=0,rp=0;function ip(e){let t=Math.pow(2,Math.ceil(Math.log2(Math.max(1,e))));t<=Jf||(Jf>0&&(Gf._free(Yf),Gf._free(Xf),Gf._free(Zf),Gf._free(Qf),Gf._free($f),Gf._free(ep),Gf._free(tp),Gf._free(np),Gf._free(rp)),Jf=t,Yf=Gf._malloc(3*t*4),Xf=Gf._malloc(4*t*4),Zf=Gf._malloc(3*t*4),Qf=Gf._malloc(4*t),$f=Gf._malloc(t),ep=Gf._malloc(8*t*4),tp=Gf._malloc(3*t*4),np=Gf._malloc(4*t*4),rp=Gf._malloc(3*t*4))}function ap(e,t,n,r,i){ip(e);let a=new Uint8Array(e);Gf.HEAPF32.set(t,Yf/4),Gf.HEAPF32.set(n,Xf/4),Gf.HEAPF32.set(r,Zf/4),Gf.HEAPU8.set(i,Qf),Gf.HEAPU8.set(a,$f),Gf._pack(!1,e,Yf,Xf,Zf,Qf,$f,ep,tp,np,rp);let o=new Uint32Array(Gf.HEAPU32.buffer,ep,e*8);return new Uint32Array(o.slice().buffer)}typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope&&(self.onmessage=e=>t(void 0,void 0,void 0,function*(){var t;let{requestId:n,fileBytes:r}=e.data;if(!(r===void 0||n===void 0))try{let e=yield Wf(new Uint8Array(r));yield qf();let t=ap(e.numPoints,e.positions,e.rotations,e.scales,e.colors),i=Object.assign(Object.assign({},e),{packedData:t}),a=[t.buffer,e.positions.buffer,e.colors.buffer,e.scales.buffer,e.rotations.buffer];e.sh1&&a.push(e.sh1.buffer),e.sh2&&a.push(e.sh2.buffer),e.sh3&&a.push(e.sh3.buffer),self.postMessage({requestId:n,decoded:i},a)}catch(e){self.postMessage({requestId:n,error:(t=e==null?void 0:e.message)==null?String(e):t})}}))})();',blob$3=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,jsContent$3],{type:`text/javascript;charset=utf-8`});function WorkerWrapper$3(e){let t;try{if(t=blob$3&&(self.URL||self.webkitURL).createObjectURL(blob$3),!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(jsContent$3),{name:e==null?void 0:e.name})}}var f32buffer=new Float32Array(1),u32buffer=new Uint32Array(f32buffer.buffer),supportsFloat16Array=typeof Float16Array<`u`,f16buffer=supportsFloat16Array?new Float16Array(1):null,u16buffer=supportsFloat16Array?new Uint16Array(f16buffer.buffer):new Uint16Array(1);function fromHalf(e){if(supportsFloat16Array&&f16buffer)return u16buffer[0]=e,f16buffer[0];let t=e>>15&1,n=e>>10&31,r=e&1023,o;if(n===0)if(r===0)o=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let s=n+127,c=e<<13;o=t<<31|s<<23|c}else if(n===31)o=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,s=r<<13;o=t<<31|e<<23|s}return u32buffer[0]=o,f32buffer[0]}var GunzipReader=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t);this.reader=n.getReader()}read(e){return __awaiter(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})}},SH_C0=.28209479177387814,SpzReader=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 GunzipReader({fileBytes:this.fileBytes})}parseHeader(){return __awaiter(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,o,s){return __awaiter(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;e==null||e(t,fromHalf(n[r]),fromHalf(n[r+1]),fromHalf(n[r+2]))}}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 o=r*9,s=((n[o+2]<<24|n[o+1]<<16|n[o]<<8)>>8)/t,c=((n[o+5]<<24|n[o+4]<<16|n[o+3]<<8)>>8)/t,l=((n[o+8]<<24|n[o+7]<<16|n[o+6]<<8)>>8)/t;e==null||e(r,s,c,l)}}{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=SH_C0/.15;for(let r=0;r<this.numSplats;r++){let o=r*3;n==null||n(r,(e[o]/255-.5)*t+.5,(e[o+1]/255-.5)*t+.5,(e[o+2]/255-.5)*t+.5)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3;r==null||r(t,Math.exp(e[n]/16-10),Math.exp(e[n+1]/16-10),Math.exp(e[n+2]/16-10))}}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,s=[0,0,0,0],c=[t[r],t[r+1],t[r+2],t[r+3]],l=c[0]+(c[1]<<8)+(c[2]<<16)+(c[3]<<24),u=511,d=l>>>30,f=l,p=0;for(let t=3;t>=0;--t)if(t!==d){let n=f&511,r=f>>>9&1;f>>>=10,s[t]=n/511*e,s[t]=r===0?s[t]:-s[t],p+=s[t]*s[t]}s[d]=Math.sqrt(Math.max(1-p,0)),o==null||o(n,s[0],s[1],s[2],s[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,s=e[n+1]/127.5-1,c=e[n+2]/127.5-1,l=Math.sqrt(Math.max(0,1-r*r-s*s-c*c));o==null||o(t,r,s,c,l)}}if(s&&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,o=this.shDegree>=3?new Float32Array(21):void 0,c=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[c+e]-128)/128;if(c+=9,r){for(let e=0;e<15;++e)r[e]=(t[c+e]-128)/128;c+=15}if(o){for(let e=0;e<21;++e)o[e]=(t[c+e]-128)/128;c+=21}s==null||s(e,new Float32Array(n),r?new Float32Array(r):void 0,o?new Float32Array(o):void 0)}}})}};function decodeSpz(e){return __awaiter(this,void 0,void 0,function*(){let t=new SpzReader({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),o=new Uint8Array(n*4),s=new Float32Array(n*3),c=new Float32Array(n*4),l,u,d;return t.shDegree>=1&&(l=new Float32Array(n*9)),t.shDegree>=2&&(u=new Float32Array(n*15)),t.shDegree>=3&&(d=new Float32Array(n*21)),yield t.parseSplats((e,t,n,o)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=o},(e,t)=>{o[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{o[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),o[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),o[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{s[e*3]=t,s[e*3+1]=n,s[e*3+2]=r},(e,t,n,r,o)=>{c[e*4]=o,c[e*4+1]=t,c[e*4+2]=n,c[e*4+3]=r},(e,t,n,r)=>{l&&t&&l.set(t,e*9),u&&n&&u.set(n,e*15),d&&r&&d.set(r,e*21)}),{numPoints:n,shDegree:t.shDegree,positions:r,colors:o,scales:s,rotations:c,sh1:l,sh2:u,sh3:d}})}var wasmModule,wasmLoading=!1;function ensureWasm(){return __awaiter(this,void 0,void 0,function*(){if(!wasmModule){for(;wasmLoading;)yield new Promise(e=>setTimeout(e,0));wasmModule||(wasmLoading=!0,wasmModule=yield createDataModule(),wasmLoading=!1)}})}var allocatedCount=0,positionsPtr=0,rotationsPtr=0,scalesPtr=0,colorsPtr=0,selectionPtr=0,dataPtr=0,worldPositionsPtr=0,worldRotationsPtr=0,worldScalesPtr=0;function ensureWasmBuffers(e){let t=Math.pow(2,Math.ceil(Math.log2(Math.max(1,e))));t<=allocatedCount||(allocatedCount>0&&(wasmModule._free(positionsPtr),wasmModule._free(rotationsPtr),wasmModule._free(scalesPtr),wasmModule._free(colorsPtr),wasmModule._free(selectionPtr),wasmModule._free(dataPtr),wasmModule._free(worldPositionsPtr),wasmModule._free(worldRotationsPtr),wasmModule._free(worldScalesPtr)),allocatedCount=t,positionsPtr=wasmModule._malloc(3*t*4),rotationsPtr=wasmModule._malloc(4*t*4),scalesPtr=wasmModule._malloc(3*t*4),colorsPtr=wasmModule._malloc(4*t),selectionPtr=wasmModule._malloc(t),dataPtr=wasmModule._malloc(8*t*4),worldPositionsPtr=wasmModule._malloc(3*t*4),worldRotationsPtr=wasmModule._malloc(4*t*4),worldScalesPtr=wasmModule._malloc(3*t*4))}function packDecoded(e,t,n,r,o){ensureWasmBuffers(e);let s=new Uint8Array(e);wasmModule.HEAPF32.set(t,positionsPtr/4),wasmModule.HEAPF32.set(n,rotationsPtr/4),wasmModule.HEAPF32.set(r,scalesPtr/4),wasmModule.HEAPU8.set(o,colorsPtr),wasmModule.HEAPU8.set(s,selectionPtr),wasmModule._pack(!1,e,positionsPtr,rotationsPtr,scalesPtr,colorsPtr,selectionPtr,dataPtr,worldPositionsPtr,worldRotationsPtr,worldScalesPtr);let c=new Uint32Array(wasmModule.HEAPU32.buffer,dataPtr,e*8);return new Uint32Array(c.slice().buffer)}typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope&&(self.onmessage=e=>__awaiter(void 0,void 0,void 0,function*(){var t;let{requestId:n,fileBytes:r}=e.data;if(!(r===void 0||n===void 0))try{let e=yield decodeSpz(new Uint8Array(r));yield ensureWasm();let t=packDecoded(e.numPoints,e.positions,e.rotations,e.scales,e.colors),o=Object.assign(Object.assign({},e),{packedData:t}),s=[t.buffer,e.positions.buffer,e.colors.buffer,e.scales.buffer,e.rotations.buffer];e.sh1&&s.push(e.sh1.buffer),e.sh2&&s.push(e.sh2.buffer),e.sh3&&s.push(e.sh3.buffer),self.postMessage({requestId:n,decoded:o},s)}catch(e){self.postMessage({requestId:n,error:(t=e==null?void 0:e.message)==null?String(e):t})}}));var sharedWorker=null,nextRequestId=1,pendingRequests=new Map;function getWorker(){return sharedWorker||(sharedWorker=new WorkerWrapper$3,sharedWorker.onmessage=e=>{var t;let{requestId:n,decoded:r,error:o}=(t=e.data)==null?{}:t,s=pendingRequests.get(n);s&&(pendingRequests.delete(n),o?s.reject(Error(o)):s.resolve(r))}),sharedWorker}function decodeSpzInWorker(e){let t=getWorker(),n=nextRequestId++,r=e.slice().buffer;return new Promise((e,o)=>{pendingRequests.set(n,{resolve:e,reject:o}),t.postMessage({requestId:n,fileBytes:r},[r])})}function parseSpz(e){return __awaiter(this,void 0,void 0,function*(){let t=yield decodeSpzInWorker(e instanceof ArrayBuffer?new Uint8Array(e):e),{PBMGaussianSplattingObject:n}=yield Promise.resolve().then(()=>(init_pbmGaussianSplattingObject(),pbmGaussianSplattingObject_exports));return new n({numPoints:t.numPoints,packedData:t.packedData,sh1:t.sh1,sh2:t.sh2,sh3:t.sh3,shDegree:t.shDegree})})}function loadSpz(e,t={}){var n,r,o,s;let c=(n=t.modelUpAxis)==null?`Y`:n,l=(r=t.upAxis)==null?`Z`:r,u=(o=t.fetcher)==null?internalFetcher:o,d=(s=t.onDownloadProgress)==null?noop:s,f=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d)).then(e=>(f=e.body.byteLength,e.body)).then(e=>parseSpz(new Uint8Array(e))).then(t=>(c===`Z`&&(t.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),t.updateMatrix(),t.updateMatrixWorld(!0),t.transformChanged=!0),{type:`spz`,modelUpAxis:c,upAxis:l,uri:e,byteLength:f,memoryUsage:getMemoryUsage(t),scene:t,textures:[],animations:[],dispose:()=>t.dispose()}))}var ROTATE_X_MATRIX$1=new three.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),ROTATE_X_MATRIX_INVERSE$1=new three.Matrix4().getInverse(ROTATE_X_MATRIX$1),KHR_gaussian_splatting_compression_spz=class extends BaseExtension{load(e,t){return __awaiter(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return __awaiter(this,void 0,void 0,function*(){return Promise.resolve().then(()=>parseSpz(e)).then(e=>(e.applyMatrix4(ROTATE_X_MATRIX_INVERSE$1),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}},ROTATE_X_MATRIX=new three.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),ROTATE_X_MATRIX_INVERSE=new three.Matrix4().getInverse(ROTATE_X_MATRIX),KHR_gaussian_splatting_compression_spz_2=class extends BaseExtension{constructor(){super()}load(e,t){return __awaiter(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return __awaiter(this,void 0,void 0,function*(){return Promise.resolve().then(()=>parseSpz(e)).then(e=>(e.applyMatrix4(ROTATE_X_MATRIX_INVERSE),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}},EXTENSIONS={KHR_binary_glTF,KHR_draco_mesh_compression,KHR_texture_basisu,KHR_texture_transform,KHR_mesh_quantization,KHR_materials_unlit,KHR_node_visibility,KHR_animation_pointer,KHR_materials_clearcoat,KHR_materials_sheen,KHR_materials_transmission,KHR_materials_emissive_strength,EXT_meshopt_compression,EXT_texture_webp,CESIUM_RTC,REALSEE_materials_lightmap,KHR_gaussian_splatting,KHR_gaussian_splatting_compression_spz,KHR_gaussian_splatting_compression_spz_2};function parseGltf(e,t){var n,r,o;let s={},c,l;if(typeof e==`string`)l=e;else if(EXTENSIONS.KHR_binary_glTF.getMagic(e)===EXTENSIONS.KHR_binary_glTF.HEADER_MAGIC){c=new EXTENSIONS.KHR_binary_glTF;try{c.loadGlbBinary(e)}catch(e){return Promise.reject(e)}s.KHR_binary_glTF=c,l=c.content}else l=decodeText(new Uint8Array(e));let u=JSON.parse(l);if(t.jsonModify&&(u=t.jsonModify(u)),u.asset===void 0||Number(u.asset.version[0])<2)return Promise.reject(Error(`glTF: Unsupported asset. glTF versions >=2.0 are supported.`));if(u.extensionsUsed){let e=u.extensionsRequired||[];for(var d=0;d<u.extensionsUsed.length;d++){let t=u.extensionsUsed[d];s[t]||(EXTENSIONS[t]?s[t]=new EXTENSIONS[t]:e.indexOf(t)>=0&&console.warn(`glTF: Unknown extension "`+t+`".`))}}return new Parser(u,s,{copyUV2:(n=t.copyUV2)==null?!1:n,resourcePath:(r=t.resourcePath)==null?``:r,search:(o=t.search)==null?``:o,fetcher:t.fetcher}).parse().then(e=>(c&&c.clear(),e))}function loadB3dm(e,t={}){var n,r,o,s;let c=(n=t.modelUpAxis)==null?`Y`:n,l=(r=t.upAxis)==null?`Z`:r,u=(o=t.fetcher)==null?internalFetcher:o,d=(s=t.onDownloadProgress)==null?noop:s,f={uri:e,gltfUpAxis:c};return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>parseHeader$1(f,e,t)).then(t=>parseTable(f,e,t)).then(t=>parseGlTFArrayBuffer(f,e,t))).then(()=>{var n;return parseGltf(f.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:u}).then(e=>{let t=new three.Matrix4;c===`Y`&&t.premultiply(ROTATE_X_MATRIX$2);let n;if(f.rtcCenter?n=new three.Vector3().fromArray(f.rtcCenter):e.CESIUM_RTC&&(n=new three.Vector3().copy(e.CESIUM_RTC.center)),n){let e=new three.Matrix4().setPosition(n);t.premultiply(e)}return l===`Y`&&t.premultiply(ROTATE_X_MATRIX_INVERSE$2),e.scene.applyMatrix4(t),f.featureTableBinary=void 0,f.batchTableBinary=void 0,f.gltfArrayBuffer=void 0,{type:`b3dm`,modelUpAxis:c,upAxis:`Z`,uri:f.uri,byteLength:f.byteLength,memoryUsage:getMemoryUsage(e.scene),scene:e.scene,textures:e.textures,animations:[],rtcCenter:n,dispose:()=>e.dispose()}})})}var jsContent$2="(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||(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==null?(t.byteLength-n)/a(e):r):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}})();",blob$2=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,jsContent$2],{type:`text/javascript;charset=utf-8`});function WorkerWrapper$2(e){let t;try{if(t=blob$2&&(self.URL||self.webkitURL).createObjectURL(blob$2),!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(jsContent$2),{name:e==null?void 0:e.name})}}var attributeWorkerPool=new WorkerPool(()=>new WorkerWrapper$2,2);function parsePointCloud(e,t,n){let r=new FeatureTable(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then(()=>{let e=r.getExtension(`3DTILES_draco_point_compression`);return e?parseDraco(e,r):attributeWorkerPool.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(t=>(e.attributes=t,n))}function parseDraco(e,t){return __awaiter(this,void 0,void 0,function*(){let n=e.properties||{},r=e.byteOffset,o=e.byteLength;if(!n||!Number.isFinite(r)||!o)throw Error(`Draco properties, byteOffset, and byteLength must be defined`);let s=t.buffer.slice(r,r+o),c=e.properties;return draco.decodeGeometry(s.buffer,{attributeIDs:c,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`),o=e.getAttribute(`NORMAL`),s;if(r)s=r;else if(n){let e=n.count,t=n.array,r=new Uint8Array(e*4);for(let n=0,o,s;n<e;n++)s=n*4,o=n*3,r[s]=t[o],r[++s]=t[++o],r[++s]=t[++o];s=new three.BufferAttribute(r,4,n.normalized)}return{position:t?{array:t.array,itemSize:t.itemSize,normalized:t.normalized}:null,color:s?{array:s.array,itemSize:s.itemSize,normalized:s.normalized}:null,normal:o?{array:o.array,itemSize:o.itemSize,normalized:o.normalized}:null}})})}function loadPnts(e,t={}){var n,r,o;let s=(n=t.upAxis)==null?`Z`:n,c=(r=t.fetcher)==null?internalFetcher:r,l=(o=t.onDownloadProgress)==null?noop:o,u={uri:e};return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>parseHeader$1(u,e,t)).then(t=>parseTable(u,e,t)).then(t=>parsePointCloud(u,e,t))).then(()=>{var e;return createPoints(u.attributes,{computeBoundingBox:(e=t.computeBoundingBox)==null?!0:e})}).then(e=>{let t=new three.Matrix4,n;if(u.rtcCenter&&(n=new three.Vector3().fromArray(u.rtcCenter)),n){let e=new three.Matrix4().setPosition(n);t.premultiply(e)}return s===`Y`&&t.premultiply(ROTATE_X_MATRIX_INVERSE$2),e.object.applyMatrix4(t),u.gltfArrayBuffer=void 0,u.featureTableBinary=void 0,u.batchTableBinary=void 0,{type:`pnts`,modelUpAxis:`Z`,upAxis:s,uri:u.uri,byteLength:u.byteLength,memoryUsage:getMemoryUsage(e.object),scene:e.object,textures:[],animations:[],rtcCenter:n,dispose:()=>e.dispose()}})}function createPoints(e,t){let n=new Set,r=new three.BufferGeometry;n.add(r);let o=new PBMPointCloudMaterial;n.add(o),e.position&&r.setAttribute(`position`,new three.BufferAttribute(e.position.array,e.position.itemSize,e.position.normalized)),e.color&&r.setAttribute(`color`,new three.BufferAttribute(e.color.array,e.color.itemSize,e.color.normalized)),e.normal?r.setAttribute(`normal`,new three.BufferAttribute(e.normal.array,e.normal.itemSize,e.normal.normalized)):o.flatShading=!0,t.computeBoundingBox&&r.computeBoundingBox();let s=new PBMPointCloud(r,o);return s.matrix.compose(s.position,s.quaternion,s.scale),s.matrixAutoUpdate=!1,s.frustumCulled=!1,Promise.resolve({object:s,dispose:()=>{n.forEach(e=>{e.dispose()}),n.clear()}})}function loadGltf(e,t={}){var n,r,o,s,c;let l=(n=t.modelUpAxis)==null?`Y`:n,u=(r=t.upAxis)==null?`Z`:r,d=(o=t.fetcher)==null?internalFetcher:o,f=(s=t.onDownloadProgress)==null?noop:s,p=(c=t.jsonModify)==null?noop:c,m=0;return Promise.resolve().then(()=>d.ajax(e,{responseType:`arraybuffer`},void 0,void 0,f).then(e=>(m=e.body.byteLength,e.body))).then(n=>{var r;return parseGltf(n,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var n,r,o;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(o=p(e))==null?e:o},fetcher:d})}).then(t=>{var n;let r=new three.Matrix4;if(l===`Y`&&r.premultiply(ROTATE_X_MATRIX$2),t.CESIUM_RTC){let e=new three.Matrix4().setPosition(t.CESIUM_RTC.center);r.premultiply(e)}return u===`Y`&&r.premultiply(ROTATE_X_MATRIX_INVERSE$2),t.scene.applyMatrix4(r),{type:`gltf`,modelUpAxis:l,upAxis:u,uri:e,byteLength:m,memoryUsage:getMemoryUsage(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 scratchColor=new three.Color;function loadPly(e,t={}){var n,r,o,s;let c=(n=t.modelUpAxis)==null?`Z`:n,l=(r=t.upAxis)==null?`Z`:r,u=(o=t.fetcher)==null?internalFetcher:o,d=(s=t.onDownloadProgress)==null?noop:s,f=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>(f=e.body.byteLength,e.body))).then(e=>{var n,r;return parsePly(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 c===`Y`&&t.applyMatrix4(ROTATE_X_MATRIX$2),l===`Y`&&t.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),{type:`ply`,modelUpAxis:c,upAxis:l,uri:e,byteLength:f,memoryUsage:getGeometryMemoryUsed(t),scene:t,textures:[],animations:[],dispose:()=>{n.dispose()}}}case`line`:{let t=`color`in n.attributes,r=new three.LineBasicMaterial({vertexColors:t}),o=new three.Line(n,r);return o.computeLineDistances(),c===`Y`&&o.applyMatrix4(ROTATE_X_MATRIX$2),l===`Y`&&o.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),{type:`ply`,modelUpAxis:c,upAxis:l,uri:e,byteLength:f,memoryUsage:getMemoryUsage(o),scene:o,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmMesh`:{let r=new PBMMeshMaterial(t.light?`phong`:`basic`);r.vertexColors=`color`in n.attributes;let o=new three.Mesh(n,r);return c===`Y`&&o.applyMatrix4(ROTATE_X_MATRIX$2),l===`Y`&&o.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),{type:`ply`,modelUpAxis:c,upAxis:l,uri:e,byteLength:f,memoryUsage:getMemoryUsage(o),scene:o,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmPointCloud`:{let t=new PBMPointCloudMaterial,r=new PBMPointCloud(n,t);return c===`Y`&&r.applyMatrix4(ROTATE_X_MATRIX$2),l===`Y`&&r.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),{type:`ply`,modelUpAxis:c,upAxis:l,uri:e,byteLength:f,memoryUsage:getMemoryUsage(r),scene:r,textures:[],animations:[],dispose:()=>{n.dispose(),t.dispose()}}}default:break}throw Error(`Invalid Type: ${t.type}`)})}function parsePly(e,t){let n=new Uint8Array(e),{headerText:r,headerLength:o}=extractHeaderText(n),s=parseHeader(r,o,t);return s.format===`ascii`?{header:s,geometry:parseASCII(new TextDecoder().decode(n),s,t)}:{header:s,geometry:parseBinary(e,s,t)}}function makePlyElementProperty(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 parseHeader(e,t=0,n){let r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,o=``,s=r.exec(e);s!==null&&(o=s[1]);let c={format:``,version:``,comments:[],elements:[],headerLength:t,objInfo:``},l=o.split(/\r\n|\r|\n/),u=null;for(let e=0;e<l.length;e++){let t=l[e];if(t=t.trim(),t===``)continue;let r=t.split(/\s+/),o=r.shift();switch(t=r.join(` `),o){case`format`:c.format=r[0],c.version=r[1];break;case`comment`:c.comments.push(t);break;case`element`:u&&c.elements.push(u),u={name:r[0],count:parseInt(r[1]),properties:[]};break;case`property`:u&&u.properties.push(makePlyElementProperty(r,n));break;case`obj_info`:c.objInfo=t;break;default:console.log(`unhandled`,o,r)}}return u&&c.elements.push(u),c}function parseASCIINumber(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 parseASCIIElement(e,t){let n={};for(let r=0;r<e.length;r++){if(t.empty())return null;if(e[r].type===`list`){let o=[],s=parseASCIINumber(t.next(),e[r].countType);for(let n=0;n<s;n++){if(t.empty())return null;o.push(parseASCIINumber(t.next(),e[r].itemType))}n[e[r].name]=o}else n[e[r].name]=parseASCIINumber(t.next(),e[r].type)}return n}function createBuffer(e){let t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(let n of Object.keys(e.customPropertyMapping))t[n]=[];return t}function mapElementAttributes(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 parseASCII(e,t,n){let r=createBuffer(n),o=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,s,c=null;s=(c=o.exec(e))===null?[]:c[1].split(/\s+/);let l=new ArrayStream(s);loop:for(let e=0;e<t.elements.length;e++){let o=t.elements[e],s=mapElementAttributes(o.properties);for(let e=0;e<o.count;e++){let e=parseASCIIElement(o.properties,l);if(!e)break loop;handleElement(r,o.name,e,s,n)}}return postProcess(r,n)}function postProcess(e,t){let n=new three.BufferGeometry;e.indices.length>0&&n.setIndex(e.indices),n.setAttribute(`position`,new three.Float32BufferAttribute(e.vertices,3)),e.normals.length>0&&n.setAttribute(`normal`,new three.Float32BufferAttribute(e.normals,3)),e.uvs.length>0&&n.setAttribute(`uv`,new three.Float32BufferAttribute(e.uvs,2)),e.colors.length>0&&n.setAttribute(`color`,new three.Float32BufferAttribute(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(n=n.toNonIndexed(),e.faceVertexUvs.length>0&&n.setAttribute(`uv`,new three.Float32BufferAttribute(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&n.setAttribute(`color`,new three.Float32BufferAttribute(e.faceVertexColors,3)));for(let r of Object.keys(t.customPropertyMapping))if(e[r].length>0){let{itemType:o,itemNames:s,normalized:c}=t.customPropertyMapping[r],l=s.length,u;switch(o){case`float32`:u=new three.Float32BufferAttribute(e[r],l,c);break;case`uint32`:u=new three.Uint32BufferAttribute(e[r],l,c);break;case`int32`:u=new three.Int32BufferAttribute(e[r],l,c);break;case`uint16`:u=new three.Uint16BufferAttribute(e[r],l,c);break;case`int16`:u=new three.Int16BufferAttribute(e[r],l,c);break;case`uint8`:u=new three.Uint8BufferAttribute(e[r],l,c);break;case`int8`:u=new three.Int8BufferAttribute(e[r],l,c);break;default:u=new three.Float32BufferAttribute(e[r],l,c);break}n.setAttribute(r,u)}return n.computeBoundingSphere(),n}function handleElement(e,t,n,r,o){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&&(scratchColor.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.colors.push(scratchColor.r,scratchColor.g,scratchColor.b));for(let t of Object.keys(o.customPropertyMapping))for(let r of o.customPropertyMapping[t].itemNames)e[t].push(n[r])}else if(t===`face`){let t=n.vertex_indices||n.vertex_index,o=n.texcoord;t.length===3?(e.indices.push(t[0],t[1],t[2]),o&&o.length===6&&(e.faceVertexUvs.push(o[0],o[1]),e.faceVertexUvs.push(o[2],o[3]),e.faceVertexUvs.push(o[4],o[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&&(scratchColor.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),e.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),e.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b))}}function binaryReadElement(e,t){let n={},r=0;for(let o=0;o<t.length;o++){let s=t[o],c=s.valueReader;if(s.type===`list`){let t=[],o=s.countReader.read(e+r);r+=s.countReader.size;for(let n=0;n<o;n++)t.push(c.read(e+r)),r+=c.size;n[s.name]=t}else n[s.name]=c.read(e+r),r+=c.size}return[n,r]}function setPropertyBinaryReaders(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 o=0,s=e.length;o<s;o++){let s=e[o];s.type===`list`?(s.countReader=r(t,s.countType,n),s.valueReader=r(t,s.itemType,n)):s.valueReader=r(t,s.type,n)}}function parseBinary(e,t,n){let r=createBuffer(n),o=t.format===`binary_little_endian`,s=new DataView(e,t.headerLength),c,l=0;for(let e=0;e<t.elements.length;e++){let u=t.elements[e],d=u.properties,f=mapElementAttributes(d);setPropertyBinaryReaders(d,s,o);for(let e=0;e<u.count;e++){c=binaryReadElement(l,d),l+=c[1];let e=c[0];handleElement(r,u.name,e,f,n)}}return postProcess(r,n)}function extractHeaderText(e){let t=0,n=!0,r=``,o=[],s=new TextDecoder().decode(e.subarray(0,5)),c=/^ply\r\n/.test(s);do{let s=String.fromCharCode(e[t++]);s!==`
|
|
861
|
+
j j*\0"8\0 \x07 \0Atj" \v8\b \f8 \r8\0 j-\0\0 $j-\0\0A\btr %j-\0\0Atr &j-\0\0Atr6\f *\0! '*\0! "*\0"\f \f !*\0"\v \v #*\0" *\0"\r \r"C\0\0\0\0^@ \f "!\f \r !\r ! \v !\v\v \r \f" \v "" " C\0\0? \v \v" \f \f"" " \r \v" \f "" " C\0\0@ \v \f"\x1B \r ""\f \f"\f "\v \v"\v C\0\0? \r \r" "\r \r"\r C\0\0@6 C\0\0? " " " " \x1B " "C\0\0@ \f \f \v \v \r \rC\0\0@6 A\x006 \f \v \r C\0\0@ C\0\0@6 \0Aj!\0\f\v\v\v\0\v\v \0A\b\v`)}function y(e){return e}function b(e,t){var n,r=y(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function S(){return{a:L}}function C(){var e;function t(e,t){return z=e.exports,I(z),p(),z}var r=S();return n.instantiateWasm?new Promise((e,o)=>{n.instantiateWasm(r,(n,r)=>{e(t(n,r))})}):(_!=null||(_=v()),t(b(_,r)[0]))}for(var w=e=>{for(;e.length>0;)e.shift()(n)},T=[],E=e=>T.push(e),D=[],O=e=>D.push(e),k=()=>2147483648,A=(e,t)=>Math.ceil(e/t)*t,j=e=>{var t=(e-F.buffer.byteLength+65535)/65536|0;try{return F.grow(t),p(),1}catch(e){}},M=e=>{var t=d.length;e>>>=0;var n=k();if(e>n)return!1;for(var r=1;r<=4;r*=2){var o=t*(1+.2/r);if(o=Math.min(o,e+100663296),j(Math.min(n,A(Math.max(e,o),65536))))return!0}return!1},N=new Uint8Array(123),P=25;P>=0;--P)N[48+P]=52+P,N[65+P]=P,N[97+P]=26+P;if(N[43]=62,N[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 F;function I(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,F=e.b,e.__indirect_function_table}var L={a:M};function R(){m();function e(){var e;n.calledRun=!0,!c&&(h(),u==null||u(n),(e=n.onRuntimeInitialized)==null||e.call(n),g())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var z=C();return R(),t=f?n:new Promise((e,t)=>{u=e}),t}),_createDataModule.apply(this,arguments)}var jsContent$3='(function(){var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(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())})}function n(...e){}function r(e){return typeof Symbol>`u`?`$Symbol<${e}>$`:Symbol(e)}r(`$$FIVE_EVENT$$`);let i=Date.now();typeof performance<`u`&&(typeof performance.timeOrigin==`number`?i=performance.timeOrigin:performance.timing!==void 0&&(i=performance.timing.navigationStart));let a=typeof performance<`u`?(()=>i+performance.now()):(()=>Date.now()),o=[/\\.([0-9a-z]+)\\.jsonp([\\?\\#].*)?$/i,/jsonp_([0-9a-z]+)([\\?\\#].*)?$/i],s=typeof location<`u`?location.href:``,c=/^https\\:/.test(s);var l=class extends Error{constructor(e,t,n){super(`[NETWORK]: request proxy error(type: ${t}, reason: ${n}): ${e}`)}},u=class extends Error{constructor(e,t,n){super(`[NETWORK]: response error(type: ${t}, status: ${n}): ${e}`),this.httpStatus=n}},d=class extends Error{constructor(e,t,n){super(`[NETWORK]: request timeout(type: ${t}, timeout: ${n}ms): ${e}`)}};function f(e){if(!e)return{};let t={},n=e.trim().split(`\n`);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 p(e){for(let t of o){let n=e.match(t);if(n)return`jsonp_`+n[1]}return null}function m(e){return p(e)!==null}function h(e,t={},r=n,i=n,o=n){let m=a(),h=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' 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;p(e);let i=new l(h,`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=p(e);if(l){let n=window,o=null,f=!1,p=document.createElement(`script`);n[l]=d=>{var g,_;let v=a(),y=v-m;if(delete n[l],p.parentNode&&p.parentNode.removeChild(p),o!==null&&(window.clearTimeout(o),o=null),f===!0)return;if(d.indexOf(`data:`)!==0){let n=new u(e,`XMLHttpRequest`,500);i(n),c(n),(g=t.networkSubscribe)==null||g.emit(`network`,e,`XMLHttpRequest`,`error`,n.message);return}let b=d.split(`,`),x=(b[0].match(/:(.*?);/)||[])[1],S=b[1];if(t.responseType===`arraybuffer`||t.responseType===`blob`){let e=atob(b[1]),n=e.length,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=e.charCodeAt(t);S=t.responseType===`arraybuffer`?r.buffer:new Blob([r],{type:x})}let C={body:S,meta:{origin:h,source:e,requestTime:m,responseTime:v,costs:y,headers:{}}};r(C),s(C),(_=t.networkSubscribe)==null||_.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(C.meta)),f=!0},p.src=e,document.body.appendChild(p),typeof t.timeout==`number`&&(o=window.setTimeout(()=>{var n;if(o=null,f!==!0){f=!0;let r=new d(e,`XMLHttpRequest`,t.timeout||NaN);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,r.message)}},t.timeout))}else{let l=!1,p=new XMLHttpRequest,g=()=>{p&&(p.removeEventListener(`timeout`,_,!1),p.removeEventListener(`progress`,v,!1),p.removeEventListener(`load`,y,!1),p.removeEventListener(`error`,b,!1)),p=null,g=n},_=function(){var n;if(l===!0)return;l=!0,g();let r=new d(e,`XMLHttpRequest`,t.timeout||NaN);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,r.message)},v=function(e){l!==!0&&e.lengthComputable&&(e.total<=0||o(e.loaded/e.total,e.loaded,e.total))},y=function(n){var i;if(l===!0)return;let o=this.status;if(o===0||o>=200&&o<400){l=!0,g();let o=a(),c=o-m,u=f(this.getAllResponseHeaders()),d=n.total,p={body:this.response,meta:{origin:h,source:e,requestTime:m,responseTime:o,costs:c,headers:u,size:d}};r(p),s(p),(i=t.networkSubscribe)==null||i.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(p.meta))}else b.call(this)},b=function(){var n;if(l===!0)return;l=!0,g();let r=new u(e,`XMLHttpRequest`,this.status);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`error`,r.message)};p.addEventListener(`timeout`,_,!1),p.addEventListener(`progress`,v,!1),p.addEventListener(`load`,y,!1),p.addEventListener(`error`,b,!1),t.responseType&&(p.responseType=t.responseType),typeof t.timeout==`number`&&(p.timeout=t.timeout),p.open(`GET`,e,!0),p.send(null)}}))}let g={};function _(e,t={}){let r=a(),i=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' 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 a=new l(i,`Link`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`Link`,`forbidden`,a.message),Promise.reject(a)}).then(e=>e in g?g[e]:g[e]=new Promise((o,s)=>{let c=document.head||document.getElementsByTagName(`head`)[0],l=document.createElement(`link`),d=!1,f=null;l.onload=s=>{var c;if(f!==null&&(clearTimeout(f),f=null),d===!0)return;d=!0,o(),l.onerror=n,l.onload=n;let u=a(),p={origin:i,source:e,requestTime:r,responseTime:u,costs:u-r,headers:{}};(c=t.networkSubscribe)==null||c.emit(`network`,e,`Link`,`preload`,JSON.stringify(p))},l.onerror=r=>{var i;if(f!==null&&(clearTimeout(f),f=null),d===!0)return;d=!0,delete g[e],c&&l.parentNode===c&&c.removeChild(l);let a=new u(e,`Link`,0);s(a),l.onerror=n,l.onload=n,(i=t.networkSubscribe)==null||i.emit(`network`,e,`Link`,`error`,a.message)},typeof t.timeout==`number`&&(f=window.setTimeout(()=>{var s;if(f=null,d===!0)return;d=!0,o(),l.onerror=n,l.onload=n;let c=a(),u={origin:i,source:e,requestTime:r,responseTime:c,costs:c-r,headers:{}};(s=t.networkSubscribe)==null||s.emit(`network`,e,`Link`,`timeout`,JSON.stringify(u))},t.timeout)),l.rel=l.relList&&l.relList.supports(`prefetch`)?`prefetch`:`preload`,l.as=`fetch`,l.crossOrigin=``,l.fetchPriority=`high`,l.href=e,c&&c.appendChild(l)}))}function v(e,t={},r=n,i=n,o=n,f){let p=a(),g=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' 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 l(g,`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=>m(e)?h(e,{responseType:`blob`,networkSubscribe:t.networkSubscribe}).then(e=>URL.createObjectURL(e.body)):e).then(e=>new Promise((s,c)=>{let l=f==null?new Image:f,m=!1,h=null;typeof t.timeout==`number`&&(h=window.setTimeout(()=>{var r;if(l.onload=n,l.onerror=n,h=null,m===!0)return;m=!0;let a=new d(e,`Image`,t.timeout);i(a),c(a),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`timeout`,a.message)},t.timeout)),l.onload=()=>{var i;if(l.onload=n,l.onerror=n,h!==null&&(clearTimeout(h),h=null),m===!0)return;let c=a(),u={headers:{},origin:g,source:e,requestTime:p,responseTime:c,costs:c-p};m=!0;let d={body:l,meta:u};o(1),r(d),s(d),(i=t.networkSubscribe)==null||i.emit(`network`,e,`Image`,`ok`,JSON.stringify(d.meta))},l.onerror=()=>{var r;if(l.onload=n,l.onerror=n,h!==null&&(clearTimeout(h),h=null),m===!0)return;m=!0;let a=new u(e,`Image`,0);i(a),c(a),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`ok`,a.message)},o(0),l.src=e}))}new class{constructor(e={}){this.options=e}ajax(e,t={},r=n,i=n,a=n){var o;let s=this.options;return h(e,{responseType:t.responseType,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}},r,i,a)}loadImage(e,t={},r=n,i=n,a=n,o){var s;let c=this.options;return v(e,{timeout:(s=t.timeout)==null?c.timeout:s,get requestProxy(){var e;return(e=t.requestProxy)==null?c.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?c.networkSubscribe:e}},r,i,a,o)}preload(e,t={}){var n;let r=this.options;return _(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}})}};function y(){}function b(e,t){this.x=e||0,this.y=t||0}function x(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error(`THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.`)}function S(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(this,`id`,{value:gc++}),this.uuid=X.generateUUID(),this.name=``,this.image=e===void 0?S.DEFAULT_IMAGE:e,this.mipmaps=[],this.mapping=t===void 0?S.DEFAULT_MAPPING:t,this.wrapS=n===void 0?Vo:n,this.wrapT=r===void 0?Vo:r,this.magFilter=i===void 0?Ko:i,this.minFilter=a===void 0?Jo:a,this.anisotropy=c===void 0?1:c,this.format=o===void 0?es:o,this.internalFormat=null,this.type=s===void 0?Yo:s,this.offset=new b(0,0),this.repeat=new b(1,1),this.center=new b(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new x,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l===void 0?$s:l,this.version=0,this.onUpdate=null}function C(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=r===void 0?1:r}function w(e,t,n){this.width=e,this.height=t,this.scissor=new C(0,0,e,t),this.scissorTest=!1,this.viewport=new C(0,0,e,t),n=n||{},this.texture=new S(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=n.generateMipmaps===void 0?!1:n.generateMipmaps,this.texture.minFilter=n.minFilter===void 0?Ko:n.minFilter,this.depthBuffer=n.depthBuffer===void 0?!0:n.depthBuffer,this.stencilBuffer=n.stencilBuffer===void 0?!0:n.stencilBuffer,this.depthTexture=n.depthTexture===void 0?null:n.depthTexture}function T(e,t,n){w.call(this,e,t,n),this.samples=4}function E(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=r===void 0?1:r}function D(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function O(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error(`THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.`)}function k(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||k.DefaultOrder}function A(){this.mask=1}function j(){Object.defineProperty(this,`id`,{value:Oc++}),this.uuid=X.generateUUID(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=j.DefaultUp.clone();var e=new D,t=new k,n=new E,r=new D(1,1,1);function i(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(i),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new O},normalMatrix:{value:new x}}),this.matrix=new O,this.matrixWorld=new O,this.matrixAutoUpdate=j.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new A,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function M(){j.call(this),this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}function N(e,t){this.min=e===void 0?new D(1/0,1/0,1/0):e,this.max=t===void 0?new D(-1/0,-1/0,-1/0):t}function P(e,t,n,r,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){$c.fromArray(e,a);var s=i.x*Math.abs($c.x)+i.y*Math.abs($c.y)+i.z*Math.abs($c.z),c=t.dot($c),l=n.dot($c),u=r.dot($c);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}function F(e,t){this.center=e===void 0?new D:e,this.radius=t===void 0?-1:t}function I(e,t){this.origin=e===void 0?new D:e,this.direction=t===void 0?new D(0,0,-1):t}function L(e,t){this.normal=e===void 0?new D(1,0,0):e,this.constant=t===void 0?0:t}function R(e,t,n){this.a=e===void 0?new D:e,this.b=t===void 0?new D:t,this.c=n===void 0?new D:n}function z(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}function ee(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function te(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function ne(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}function B(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new D,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new z,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=a===void 0?0:a}function V(){Object.defineProperty(this,`id`,{value:wl++}),this.uuid=X.generateUUID(),this.name=``,this.type=`Material`,this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=lc,this.stencilZFail=lc,this.stencilZPass=lc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function re(e){V.call(this),this.type=`MeshBasicMaterial`,this.color=new z(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.setValues(e)}function H(e,t,n){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n===!0,this.usage=uc,this.updateRange={offset:0,count:-1},this.version=0}function U(e,t,n){H.call(this,new Int8Array(e),t,n)}function ie(e,t,n){H.call(this,new Uint8Array(e),t,n)}function W(e,t,n){H.call(this,new Uint8ClampedArray(e),t,n)}function ae(e,t,n){H.call(this,new Int16Array(e),t,n)}function G(e,t,n){H.call(this,new Uint16Array(e),t,n)}function oe(e,t,n){H.call(this,new Int32Array(e),t,n)}function se(e,t,n){H.call(this,new Uint32Array(e),t,n)}function K(e,t,n){H.call(this,new Float32Array(e),t,n)}function ce(e,t,n){H.call(this,new Float64Array(e),t,n)}function le(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function ue(e){if(e.length===0)return-1/0;let t=e[0];for(let n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}function q(){Object.defineProperty(this,`id`,{value:El+=2}),this.uuid=X.generateUUID(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function de(e,t){j.call(this),this.type=`Mesh`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new re:t,this.updateMorphTargets()}function fe(e,t,n,r,i,a,o,s){if((t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==2,s))===null)return null;Yl.copy(s),Yl.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(Yl);return c<n.near||c>n.far?null:{distance:c,point:Yl.clone(),object:e}}function pe(e,t,n,r,i,a,o,s,c,l,u,d){Il.fromBufferAttribute(i,l),Ll.fromBufferAttribute(i,u),Rl.fromBufferAttribute(i,d);var f=e.morphTargetInfluences;if(t.morphTargets&&a&&f){Hl.set(0,0,0),Ul.set(0,0,0),Wl.set(0,0,0);for(var p=0,m=a.length;p<m;p++){var h=f[p],g=a[p];h!==0&&(zl.fromBufferAttribute(g,l),Bl.fromBufferAttribute(g,u),Vl.fromBufferAttribute(g,d),o?(Hl.addScaledVector(zl,h),Ul.addScaledVector(Bl,h),Wl.addScaledVector(Vl,h)):(Hl.addScaledVector(zl.sub(Il),h),Ul.addScaledVector(Bl.sub(Ll),h),Wl.addScaledVector(Vl.sub(Rl),h)))}Il.add(Hl),Ll.add(Ul),Rl.add(Wl)}e.isSkinnedMesh&&(e.boneTransform(l,Il),e.boneTransform(u,Ll),e.boneTransform(d,Rl));var _=fe(e,t,n,r,Il,Ll,Rl,Jl);if(_){s&&(Gl.fromBufferAttribute(s,l),Kl.fromBufferAttribute(s,u),ql.fromBufferAttribute(s,d),_.uv=R.getUV(Jl,Il,Ll,Rl,Gl,Kl,ql,new b)),c&&(Gl.fromBufferAttribute(c,l),Kl.fromBufferAttribute(c,u),ql.fromBufferAttribute(c,d),_.uv2=R.getUV(Jl,Il,Ll,Rl,Gl,Kl,ql,new b));var v=new B(l,u,d);R.getNormal(Il,Ll,Rl,v.normal),_.face=v}return _}function J(){Object.defineProperty(this,`id`,{value:Xl+=2}),this.uuid=X.generateUUID(),this.name=``,this.type=`Geometry`,this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function me(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function he(e){for(var t={},n=0;n<e.length;n++){var r=me(e[n]);for(var i in r)t[i]=r[i]}return t}function ge(e){V.call(this),this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.vertexShader=ru,this.fragmentShader=iu,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,e!==void 0&&(e.attributes!==void 0&&console.error(`THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.`),this.setValues(e))}function _e(){j.call(this),this.type=`Camera`,this.matrixWorldInverse=new O,this.projectionMatrix=new O,this.projectionMatrixInverse=new O}function ve(e,t,n,r){_e.call(this),this.type=`PerspectiveCamera`,this.fov=e===void 0?50:e,this.zoom=1,this.near=n===void 0?.1:n,this.far=r===void 0?2e3:r,this.focus=10,this.aspect=t===void 0?1:t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function ye(e,t,n){if(j.call(this),this.type=`CubeCamera`,n.isWebGLCubeRenderTarget!==!0){console.error(`THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.`);return}this.renderTarget=n;var r=new ve(au,ou,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new D(1,0,0)),this.add(r);var i=new ve(au,ou,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new D(-1,0,0)),this.add(i);var a=new ve(au,ou,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new D(0,1,0)),this.add(a);var o=new ve(au,ou,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new D(0,-1,0)),this.add(o);var s=new ve(au,ou,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new D(0,0,1)),this.add(s);var c=new ve(au,ou,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new D(0,0,-1)),this.add(c),this.update=function(e,t){this.parent===null&&this.updateMatrixWorld();var l=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.xr.enabled=l},this.clear=function(e,t,r,i){for(var a=e.getRenderTarget(),o=0;o<6;o++)e.setRenderTarget(n,o),e.clear(t,r,i);e.setRenderTarget(a)}}function be(e,t,n){Number.isInteger(t)&&(console.warn(`THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )`),t=n),w.call(this,e,e,t)}function xe(e,t,n,r,i,a,o,s,c,l,u,d){S.call(this,null,a,o,s,c,l,r,i,u,d),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=c===void 0?Uo:c,this.minFilter=l===void 0?Uo:l,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}function Se(e,t,n,r,i,a){this.planes=[e===void 0?new L:e,t===void 0?new L:t,n===void 0?new L:n,r===void 0?new L:r,i===void 0?new L:i,a===void 0?new L:a]}function Ce(){var e=null,t=!1,n=null;function r(i,a){t!==!1&&(n(i,a),e.requestAnimationFrame(r))}return{start:function(){t!==!0&&n!==null&&(e.requestAnimationFrame(r),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function we(e,t){var n=t.isWebGL2,r=new WeakMap;function i(t,n){var r=t.array,i=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,r,i),t.onUploadCallback();var o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn(`THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.`):r instanceof Uint16Array?o=5123:r instanceof Int16Array?o=5122:r instanceof Uint32Array?o=5125:r instanceof Int32Array?o=5124:r instanceof Int8Array?o=5120:r instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}function a(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),o.count===-1?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}function o(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)}function s(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))}function c(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var n=r.get(e);n===void 0?r.set(e,i(e,t)):n.version<e.version&&(a(n.buffer,e,t),n.version=e.version)}return{get:o,remove:s,update:c}}function Te(e,t,n,r){J.call(this),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Ee(e,t,n,r)),this.mergeVertices()}function Ee(e,t,n,r){q.call(this),this.type=`PlaneBufferGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},e=e||1,t=t||1;var i=e/2,a=t/2,o=Math.floor(n)||1,s=Math.floor(r)||1,c=o+1,l=s+1,u=e/o,d=t/s,f,p,m=[],h=[],g=[],_=[];for(p=0;p<l;p++){var v=p*d-a;for(f=0;f<c;f++){var y=f*u-i;h.push(y,-v,0),g.push(0,0,1),_.push(f/o),_.push(1-p/s)}}for(p=0;p<s;p++)for(f=0;f<o;f++){var b=f+c*p,x=f+c*(p+1),S=f+1+c*(p+1),C=f+1+c*p;m.push(b,x,C),m.push(x,S,C)}this.setIndex(m),this.setAttribute(`position`,new K(h,3)),this.setAttribute(`normal`,new K(g,3)),this.setAttribute(`uv`,new K(_,2))}function De(e,t,n,r){var i=new z(0),a=0,o,s,c=null,l=0,u=null;function d(t,r,d,p){var m=r.background,h=e.xr,g=h.getSession&&h.getSession();if(g&&g.environmentBlendMode===`additive`&&(m=null),m===null?f(i,a):m&&m.isColor&&(f(m,1),p=!0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLCubeRenderTarget||m.mapping===306)){s===void 0&&(s=new de(new tu(1,1,1),new ge({type:`BackgroundCubeMaterial`,uniforms:me(lu.cube.uniforms),vertexShader:lu.cube.vertexShader,fragmentShader:lu.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute(`normal`),s.geometry.deleteAttribute(`uv`),s.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,`envMap`,{get:function(){return this.uniforms.envMap.value}}),n.update(s));var _=m.isWebGLCubeRenderTarget?m.texture:m;s.material.uniforms.envMap.value=_,s.material.uniforms.flipEnvMap.value=_.isCubeTexture?-1:1,(c!==m||l!==_.version||u!==e.toneMapping)&&(s.material.needsUpdate=!0,c=m,l=_.version,u=e.toneMapping),t.unshift(s,s.geometry,s.material,0,0,null)}else m&&m.isTexture&&(o===void 0&&(o=new de(new Ee(2,2),new ge({type:`BackgroundMaterial`,uniforms:me(lu.background.uniforms),vertexShader:lu.background.vertexShader,fragmentShader:lu.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute(`normal`),Object.defineProperty(o.material,`map`,{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=m,m.matrixAutoUpdate===!0&&m.updateMatrix(),o.material.uniforms.uvTransform.value.copy(m.matrix),(c!==m||l!==m.version||u!==e.toneMapping)&&(o.material.needsUpdate=!0,c=m,l=m.version,u=e.toneMapping),t.unshift(o,o.geometry,o.material,0,0,null))}function f(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,r)}return{getClearColor:function(){return i},setClearColor:function(e,t){i.set(e),a=t===void 0?1:t,f(i,a)},getClearAlpha:function(){return a},setClearAlpha:function(e){a=e,f(i,a)},render:d}}function Oe(e,t,n,r){var i=r.isWebGL2,a;function o(e){a=e}function s(t,r){e.drawArrays(a,t,r),n.update(r,a)}function c(r,o,s,c){if(c!==0){var l,u;if(i)l=e,u=`drawArraysInstanced`;else if(l=t.get(`ANGLE_instanced_arrays`),u=`drawArraysInstancedANGLE`,l===null){console.error(`THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.`);return}l[u](a,o,s,c),n.update(s,a,c)}}this.setMode=o,this.render=s,this.renderInstances=c}function ke(e,t,n){var r;function i(){if(r!==void 0)return r;var n=t.get(`EXT_texture_filter_anisotropic`);return r=n===null?0:e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT),r}function a(t){if(t===`highp`){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?`mediump`:`lowp`}var o=typeof WebGL2RenderingContext<`u`&&e instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<`u`&&e instanceof WebGL2ComputeRenderingContext,s=n.precision===void 0?`highp`:n.precision,c=a(s);c!==s&&(console.warn(`THREE.WebGLRenderer:`,s,`not supported, using`,c,`instead.`),s=c);var l=n.logarithmicDepthBuffer===!0,u=e.getParameter(34930),d=e.getParameter(35660),f=e.getParameter(3379),p=e.getParameter(34076),m=e.getParameter(34921),h=e.getParameter(36347),g=e.getParameter(36348),_=e.getParameter(36349),v=d>0,y=o||!!t.get(`OES_texture_float`),b=v&&y,x=o?e.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:i,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:d,maxTextureSize:f,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:h,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:b,maxSamples:x}}function Ae(){var e=this,t=null,n=0,r=!1,i=!1,a=new L,o=new x,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,a){var o=e.length!==0||i||n!==0||r;return r=i,t=l(e,a,0),n=e.length,o},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1,c()},this.setState=function(e,a,o,u,d,f){if(!r||e===null||e.length===0||i&&!o)i?l(null):c();else{var p=i?0:n,m=p*4,h=d.clippingState||null;s.value=h,h=l(e,u,m,f);for(var g=0;g!==m;++g)h[g]=t[g];d.clippingState=h,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=p}};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(t,n,r,i){var c=t===null?0:t.length,l=null;if(c!==0){if(l=s.value,i!==!0||l===null){var u=r+c*4,d=n.matrixWorldInverse;o.getNormalMatrix(d),(l===null||l.length<u)&&(l=new Float32Array(u));for(var f=0,p=r;f!==c;++f,p+=4)a.copy(t[f]).applyMatrix4(d,o),a.normal.toArray(l,p),l[p+3]=a.constant}s.value=l,s.needsUpdate=!0}return e.numPlanes=c,e.numIntersection=0,l}}function je(e){var t={};return{get:function(n){if(t[n]!==void 0)return t[n];var r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return r===null&&console.warn(`THREE.WebGLRenderer: `+n+` extension not supported.`),t[n]=r,r}}}function Me(e,t,n){var r=new WeakMap,i=new WeakMap;function a(e){var o=e.target,s=r.get(o);for(var c in s.index!==null&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);o.removeEventListener(`dispose`,a),r.delete(o);var l=i.get(s);l&&(t.remove(l),i.delete(s)),n.memory.geometries--}function o(e,t){var i=r.get(t);return i||(t.addEventListener(`dispose`,a),t.isBufferGeometry?i=t:t.isGeometry&&(t._bufferGeometry===void 0&&(t._bufferGeometry=new q().setFromObject(e)),i=t._bufferGeometry),r.set(t,i),n.memory.geometries++,i)}function s(e){var n=e.index,r=e.attributes;for(var i in n!==null&&t.update(n,34963),r)t.update(r[i],34962);var a=e.morphAttributes;for(var i in a)for(var o=a[i],s=0,c=o.length;s<c;s++)t.update(o[s],34962)}function c(e){var n=[],r=e.index,a=e.attributes.position,o=0;if(r!==null){var s=r.array;o=r.version;for(var c=0,l=s.length;c<l;c+=3){var u=s[c+0],d=s[c+1],f=s[c+2];n.push(u,d,d,f,f,u)}}else{var s=a.array;o=a.version;for(var c=0,l=s.length/3-1;c<l;c+=3){var u=c+0,d=c+1,f=c+2;n.push(u,d,d,f,f,u)}}var p=new(ue(n)>65535?se:G)(n,1);p.version=o,t.update(p,34963);var m=i.get(e);m&&t.remove(m),i.set(e,p)}function l(e){var t=i.get(e);if(t){var n=e.index;n!==null&&t.version<n.version&&c(e)}else c(e);return i.get(e)}return{get:o,update:s,getWireframeAttribute:l}}function Ne(e,t,n,r){var i=r.isWebGL2,a;function o(e){a=e}var s,c;function l(e){s=e.type,c=e.bytesPerElement}function u(t,r){e.drawElements(a,r,s,t*c),n.update(r,a)}function d(r,o,l,u){if(u!==0){var d,f;if(i)d=e,f=`drawElementsInstanced`;else if(d=t.get(`ANGLE_instanced_arrays`),f=`drawElementsInstancedANGLE`,d===null){console.error(`THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.`);return}d[f](a,l,s,o*c,u),n.update(l,a,u)}}this.setMode=o,this.setIndex=l,this.render=u,this.renderInstances=d}function Pe(e){var t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(e,t,r){switch(r=r||1,n.calls++,t){case 4:n.triangles+=e/3*r;break;case 1:n.lines+=e/2*r;break;case 3:n.lines+=r*(e-1);break;case 2:n.lines+=r*e;break;case 0:n.points+=r*e;break;default:console.error(`THREE.WebGLInfo: Unknown draw mode:`,t);break}}function i(){n.frame++,n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:i,update:r}}function Fe(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Ie(e){var t={},n=new Float32Array(8);function r(r,i,a,o){var s=r.morphTargetInfluences,c=s===void 0?0:s.length,l=t[i.id];if(l===void 0){l=[];for(var u=0;u<c;u++)l[u]=[u,0];t[i.id]=l}for(var d=a.morphTargets&&i.morphAttributes.position,f=a.morphNormals&&i.morphAttributes.normal,u=0;u<c;u++){var p=l[u];p[1]!==0&&(d&&i.deleteAttribute(`morphTarget`+u),f&&i.deleteAttribute(`morphNormal`+u))}for(var u=0;u<c;u++){var p=l[u];p[0]=u,p[1]=s[u]}l.sort(Fe);for(var m=0,u=0;u<8;u++){var p=l[u];if(p){var h=p[0],g=p[1];if(g){d&&i.setAttribute(`morphTarget`+u,d[h]),f&&i.setAttribute(`morphNormal`+u,f[h]),n[u]=g,m+=g;continue}}n[u]=0}var _=i.morphTargetsRelative?1:1-m;o.getUniforms().setValue(e,`morphTargetBaseInfluence`,_),o.getUniforms().setValue(e,`morphTargetInfluences`,n)}return{update:r}}function Le(e,t,n,r){var i=new WeakMap;function a(e){var a=r.render.frame,o=e.geometry,s=t.get(e,o);return i.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),i.set(s,a)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s}function o(){i=new WeakMap}return{update:a,dispose:o}}function Re(e,t,n,r,i,a,o,s,c,l){e=e===void 0?[]:e,t=t===void 0?301:t,o=o===void 0?$o:o,S.call(this,e,t,n,r,i,a,o,s,c,l),this.flipY=!1}function ze(e,t,n,r){S.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=Uo,this.minFilter=Uo,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Be(e,t,n,r){S.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=Uo,this.minFilter=Uo,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Ve(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=mu[i];if(a===void 0&&(a=new Float32Array(i),mu[i]=a),t!==0){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function He(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Ue(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function We(e,t){var n=hu[t];n===void 0&&(n=new Int32Array(t),hu[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Ge(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ke(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(He(n,t))return;e.uniform2fv(this.addr,t),Ue(n,t)}}function qe(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(He(n,t))return;e.uniform3fv(this.addr,t),Ue(n,t)}}function Je(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(He(n,t))return;e.uniform4fv(this.addr,t),Ue(n,t)}}function Ye(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;vu.set(r),e.uniformMatrix2fv(this.addr,!1,vu),Ue(n,r)}}function Xe(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;_u.set(r),e.uniformMatrix3fv(this.addr,!1,_u),Ue(n,r)}}function Ze(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;gu.set(r),e.uniformMatrix4fv(this.addr,!1,gu),Ue(n,r)}}function Qe(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||uu,i)}function $e(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||du,i)}function et(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||fu,i)}function tt(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||pu,i)}function nt(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function rt(e,t){var n=this.cache;He(n,t)||(e.uniform2iv(this.addr,t),Ue(n,t))}function it(e,t){var n=this.cache;He(n,t)||(e.uniform3iv(this.addr,t),Ue(n,t))}function at(e,t){var n=this.cache;He(n,t)||(e.uniform4iv(this.addr,t),Ue(n,t))}function ot(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function st(e){switch(e){case 5126:return Ge;case 35664:return Ke;case 35665:return qe;case 35666:return Je;case 35674:return Ye;case 35675:return Xe;case 35676:return Ze;case 5124:case 35670:return nt;case 35667:case 35671:return rt;case 35668:case 35672:return it;case 35669:case 35673:return at;case 5125:return ot;case 35678:case 36198:case 36298:case 36306:case 35682:return Qe;case 35679:case 36299:case 36307:return et;case 35680:case 36300:case 36308:case 36293:return tt;case 36289:case 36303:case 36311:case 36292:return $e}}function ct(e,t){e.uniform1fv(this.addr,t)}function lt(e,t){e.uniform1iv(this.addr,t)}function ut(e,t){e.uniform2iv(this.addr,t)}function dt(e,t){e.uniform3iv(this.addr,t)}function ft(e,t){e.uniform4iv(this.addr,t)}function pt(e,t){var n=Ve(t,this.size,2);e.uniform2fv(this.addr,n)}function mt(e,t){var n=Ve(t,this.size,3);e.uniform3fv(this.addr,n)}function ht(e,t){var n=Ve(t,this.size,4);e.uniform4fv(this.addr,n)}function gt(e,t){var n=Ve(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function _t(e,t){var n=Ve(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function vt(e,t){var n=Ve(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function yt(e,t,n){var r=t.length,i=We(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(t[a]||uu,i[a])}function bt(e,t,n){var r=t.length,i=We(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(t[a]||pu,i[a])}function xt(e){switch(e){case 5126:return ct;case 35664:return pt;case 35665:return mt;case 35666:return ht;case 35674:return gt;case 35675:return _t;case 35676:return vt;case 5124:case 35670:return lt;case 35667:case 35671:return ut;case 35668:case 35672:return dt;case 35669:case 35673:return ft;case 35678:case 36198:case 36298:case 36306:case 35682:return yt;case 35680:case 36300:case 36308:case 36293:return bt}}function St(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=st(t.type)}function Ct(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=xt(t.type)}function wt(e){this.id=e,this.seq=[],this.map={}}function Tt(e,t){e.seq.push(t),e.map[t.id]=t}function Et(e,t,n){var r=e.name,i=r.length;for(yu.lastIndex=0;;){var a=yu.exec(r),o=yu.lastIndex,s=a[1],c=a[2]===`]`,l=a[3];if(c&&(s|=0),l===void 0||l===`[`&&o+2===i){Tt(n,l===void 0?new St(s,e,t):new Ct(s,e,t));break}else{var u=n.map[s];u===void 0&&(u=new wt(s),Tt(n,u)),n=u}}}function Dt(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r);Et(i,e.getUniformLocation(t,i.name),this)}}function Ot(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}function kt(e){for(var t=e.split(`\n`),n=0;n<t.length;n++)t[n]=n+1+`: `+t[n];return t.join(`\n`)}function At(e){switch(e){case $s:return[`Linear`,`( value )`];case ec:return[`sRGB`,`( value )`];case nc:return[`RGBE`,`( value )`];case ic:return[`RGBM`,`( value, 7.0 )`];case ac:return[`RGBM`,`( value, 16.0 )`];case oc:return[`RGBD`,`( value, 256.0 )`];case tc:return[`Gamma`,`( value, float( GAMMA_FACTOR ) )`];case rc:return[`LogLuv`,`( value )`];default:throw Error(`unsupported encoding: `+e)}}function jt(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;var a=e.getShaderSource(t);return`THREE.WebGLShader: gl.getShaderInfoLog() `+n+`\n`+i+kt(a)}function Mt(e,t){var n=At(t);return`vec4 `+e+`( vec4 value ) { return `+n[0]+`ToLinear`+n[1]+`; }`}function Nt(e,t){var n=At(t);return`vec4 `+e+`( vec4 value ) { return LinearTo`+n[0]+n[1]+`; }`}function Pt(e,t){var n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Uncharted2`;break;case 4:n=`OptimizedCineon`;break;case 5:n=`ACESFilmic`;break;default:throw Error(`unsupported toneMapping: `+t)}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}function Ft(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||e.shaderID===`physical`?`#extension GL_OES_standard_derivatives : enable`:``,(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?`#extension GL_EXT_frag_depth : enable`:``,e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?`#extension GL_EXT_draw_buffers : require`:``,(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?`#extension GL_EXT_shader_texture_lod : enable`:``].filter(Rt).join(`\n`)}function It(e){var t=[];for(var n in e){var r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(`\n`)}function Lt(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i).name;n[a]=e.getAttribLocation(t,a)}return n}function Rt(e){return e!==``}function zt(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Bt(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function Vt(e){return e.replace(xu,Ht)}function Ht(e,t){var n=Q[t];if(n===void 0)throw Error(`Can not resolve #include <`+t+`>`);return Vt(n)}function Ut(e){return e.replace(Cu,Gt).replace(Su,Wt)}function Wt(e,t,n,r){return console.warn(`WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.`),Gt(e,t,n,r)}function Gt(e,t,n,r){for(var i=``,a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\\[ i \\]/g,`[ `+a+` ]`).replace(/UNROLLED_LOOP_INDEX/g,a);return i}function Kt(e){var t=`precision `+e.precision+` float;\nprecision `+e.precision+` int;`;return e.precision===`highp`?t+=`\n#define HIGH_PRECISION`:e.precision===`mediump`?t+=`\n#define MEDIUM_PRECISION`:e.precision===`lowp`&&(t+=`\n#define LOW_PRECISION`),t}function qt(e){var t=`SHADOWMAP_TYPE_BASIC`;return e.shadowMapType===1?t=`SHADOWMAP_TYPE_PCF`:e.shadowMapType===2?t=`SHADOWMAP_TYPE_PCF_SOFT`:e.shadowMapType===3&&(t=`SHADOWMAP_TYPE_VSM`),t}function Jt(e){var t=`ENVMAP_TYPE_CUBE`;if(e.envMap)switch(e.envMapMode){case 301:case 302:t=`ENVMAP_TYPE_CUBE`;break;case 306:case 307:t=`ENVMAP_TYPE_CUBE_UV`;break;case 303:case 304:t=`ENVMAP_TYPE_EQUIREC`;break;case 305:t=`ENVMAP_TYPE_SPHERE`;break}return t}function Yt(e){var t=`ENVMAP_MODE_REFLECTION`;if(e.envMap)switch(e.envMapMode){case 302:case 304:t=`ENVMAP_MODE_REFRACTION`;break}return t}function Xt(e){var t=`ENVMAP_BLENDING_NONE`;if(e.envMap)switch(e.combine){case 0:t=`ENVMAP_BLENDING_MULTIPLY`;break;case 1:t=`ENVMAP_BLENDING_MIX`;break;case 2:t=`ENVMAP_BLENDING_ADD`;break}return t}function Zt(e,t,n){var r=e.getContext(),i=n.defines,a=n.vertexShader,o=n.fragmentShader,s=qt(n),c=Jt(n),l=Yt(n),u=Xt(n),d=e.gammaFactor>0?e.gammaFactor:1,f=n.isWebGL2?``:Ft(n),p=It(i),m=r.createProgram(),h,g;if(n.isRawShaderMaterial?(h=[p].filter(Rt).join(`\n`),h.length>0&&(h+=`\n`),g=[f,p].filter(Rt).join(`\n`),g.length>0&&(g+=`\n`)):(h=[Kt(n),`#define SHADER_NAME `+n.shaderName,p,n.instancing?`#define USE_INSTANCING`:``,n.supportsVertexTextures?`#define VERTEX_TEXTURES`:``,`#define GAMMA_FACTOR `+d,`#define MAX_BONES `+n.maxBones,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMap&&n.objectSpaceNormalMap?`#define OBJECTSPACE_NORMALMAP`:``,n.normalMap&&n.tangentSpaceNormalMap?`#define TANGENTSPACE_NORMALMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.displacementMap&&n.supportsVertexTextures?`#define USE_DISPLACEMENTMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.vertexTangents?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexUvs?`#define USE_UV`:``,n.uvsVertexOnly?`#define UVS_VERTEX_ONLY`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.useVertexTexture?`#define BONE_TEXTURE`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+s:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?`#define USE_LOGDEPTHBUF_EXT`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#ifdef USE_COLOR`,` attribute vec3 color;`,`#endif`,`#ifdef USE_MORPHTARGETS`,` attribute vec3 morphTarget0;`,` attribute vec3 morphTarget1;`,` attribute vec3 morphTarget2;`,` attribute vec3 morphTarget3;`,` #ifdef USE_MORPHNORMALS`,` attribute vec3 morphNormal0;`,` attribute vec3 morphNormal1;`,` attribute vec3 morphNormal2;`,` attribute vec3 morphNormal3;`,` #else`,` attribute vec3 morphTarget4;`,` attribute vec3 morphTarget5;`,` attribute vec3 morphTarget6;`,` attribute vec3 morphTarget7;`,` #endif`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,`\n`].filter(Rt).join(`\n`),g=[f,Kt(n),`#define SHADER_NAME `+n.shaderName,p,n.alphaTest?`#define ALPHATEST `+n.alphaTest+(n.alphaTest%1?``:`.0`):``,`#define GAMMA_FACTOR `+d,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+c:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMap&&n.objectSpaceNormalMap?`#define OBJECTSPACE_NORMALMAP`:``,n.normalMap&&n.tangentSpaceNormalMap?`#define TANGENTSPACE_NORMALMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.sheen?`#define USE_SHEEN`:``,n.vertexTangents?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexUvs?`#define USE_UV`:``,n.uvsVertexOnly?`#define UVS_VERTEX_ONLY`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+s:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.physicallyCorrectLights?`#define PHYSICALLY_CORRECT_LIGHTS`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?`#define USE_LOGDEPTHBUF_EXT`:``,(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?`#define TEXTURE_LOD_EXT`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:Q.tonemapping_pars_fragment,n.toneMapping===0?``:Pt(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?Q.encodings_pars_fragment:``,n.mapEncoding?Mt(`mapTexelToLinear`,n.mapEncoding):``,n.matcapEncoding?Mt(`matcapTexelToLinear`,n.matcapEncoding):``,n.envMapEncoding?Mt(`envMapTexelToLinear`,n.envMapEncoding):``,n.emissiveMapEncoding?Mt(`emissiveMapTexelToLinear`,n.emissiveMapEncoding):``,n.lightMapEncoding?Mt(`lightMapTexelToLinear`,n.lightMapEncoding):``,n.outputEncoding?Nt(`linearToOutputTexel`,n.outputEncoding):``,n.depthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,`\n`].filter(Rt).join(`\n`)),a=Vt(a),a=zt(a,n),a=Bt(a,n),o=Vt(o),o=zt(o,n),o=Bt(o,n),a=Ut(a),o=Ut(o),n.isWebGL2&&!n.isRawShaderMaterial){var _=!1,v=/^\\s*#version\\s+300\\s+es\\s*\\n/;n.isShaderMaterial&&a.match(v)!==null&&o.match(v)!==null&&(_=!0,a=a.replace(v,``),o=o.replace(v,``)),h=[`#version 300 es\n`,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(`\n`)+`\n`+h,g=[`#version 300 es\n`,`#define varying in`,_?``:`out highp vec4 pc_fragColor;`,_?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(`\n`)+`\n`+g}var y=h+a,b=g+o,x=Ot(r,35633,y),S=Ot(r,35632,b);if(r.attachShader(m,x),r.attachShader(m,S),n.index0AttributeName===void 0?n.morphTargets===!0&&r.bindAttribLocation(m,0,`position`):r.bindAttribLocation(m,0,n.index0AttributeName),r.linkProgram(m),e.debug.checkShaderErrors){var C=r.getProgramInfoLog(m).trim(),w=r.getShaderInfoLog(x).trim(),T=r.getShaderInfoLog(S).trim(),E=!0,D=!0;if(r.getProgramParameter(m,35714)===!1){E=!1;var O=jt(r,x,`vertex`),k=jt(r,S,`fragment`);console.error(`THREE.WebGLProgram: shader error: `,r.getError(),`35715`,r.getProgramParameter(m,35715),`gl.getProgramInfoLog`,C,O,k)}else C===``?(w===``||T===``)&&(D=!1):console.warn(`THREE.WebGLProgram: gl.getProgramInfoLog()`,C);D&&(this.diagnostics={runnable:E,programLog:C,vertexShader:{log:w,prefix:h},fragmentShader:{log:T,prefix:g}})}r.deleteShader(x),r.deleteShader(S);var A;this.getUniforms=function(){return A===void 0&&(A=new Dt(r,m)),A};var j;return this.getAttributes=function(){return j===void 0&&(j=Lt(r,m)),j},this.destroy=function(){r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=bu++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=S,this}function Qt(e,t,n){var r=[],i=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,c=n.maxVertexUniforms,l=n.vertexTextures,u={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`},d=`precision.isWebGL2.supportsVertexTextures.outputEncoding.instancing.map.mapEncoding.matcap.matcapEncoding.envMap.envMapMode.envMapEncoding.envMapCubeUV.lightMap.lightMapEncoding.aoMap.emissiveMap.emissiveMapEncoding.bumpMap.normalMap.objectSpaceNormalMap.tangentSpaceNormalMap.clearcoatMap.clearcoatRoughnessMap.clearcoatNormalMap.displacementMap.specularMap.roughnessMap.metalnessMap.gradientMap.alphaMap.combine.vertexColors.vertexTangents.vertexUvs.uvsVertexOnly.fog.useFog.fogExp2.flatShading.sizeAttenuation.logarithmicDepthBuffer.skinning.maxBones.useVertexTexture.morphTargets.morphNormals.maxMorphTargets.maxMorphNormals.premultipliedAlpha.numDirLights.numPointLights.numSpotLights.numHemiLights.numRectAreaLights.numDirLightShadows.numPointLightShadows.numSpotLightShadows.shadowMapEnabled.shadowMapType.toneMapping.physicallyCorrectLights.alphaTest.doubleSided.flipSided.numClippingPlanes.numClipIntersection.depthPacking.dithering.sheen`.split(`.`);function f(e,t){var n;if(t){var r=lu[t];n={name:e.type,uniforms:nu.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}function p(e){var t=e.skeleton.bones;if(o)return 1024;var n=Math.floor((c-20)/4),r=Math.min(n,t.length);return r<t.length?(console.warn(`THREE.WebGLRenderer: Skeleton has `+t.length+` bones. This GPU supports `+r+`.`),0):r}function m(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn(`THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.`),t=e.texture.encoding):t=$s,t}this.getParameters=function(r,c,d,h,g,_,v){var y=h.fog,b=r.isMeshStandardMaterial?h.environment:null,x=r.envMap||b,S=u[r.type],C=v.isSkinnedMesh?p(v):0;r.precision!==null&&(s=n.getMaxPrecision(r.precision),s!==r.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,r.precision,`not supported, using`,s,`instead.`));var w=f(r,S);r.onBeforeCompile(w,e);var T=e.getRenderTarget();return{isWebGL2:i,shaderID:S,shaderName:w.name,uniforms:w.uniforms,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,defines:r.defines,isRawShaderMaterial:r.isRawShaderMaterial,isShaderMaterial:r.isShaderMaterial,precision:s,instancing:v.isInstancedMesh===!0,supportsVertexTextures:l,outputEncoding:T===null?e.outputEncoding:m(T.texture),map:!!r.map,mapEncoding:m(r.map),matcap:!!r.matcap,matcapEncoding:m(r.matcap),envMap:!!x,envMapMode:x&&x.mapping,envMapEncoding:m(x),envMapCubeUV:!!x&&(x.mapping===306||x.mapping===307),lightMap:!!r.lightMap,lightMapEncoding:m(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:m(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:r.normalMapType===1,tangentSpaceNormalMap:r.normalMapType===0,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!r.map||!!r.bumpMap||!!r.normalMap||!!r.specularMap||!!r.alphaMap||!!r.emissiveMap||!!r.roughnessMap||!!r.metalnessMap||!!r.clearcoatMap||!!r.clearcoatRoughnessMap||!!r.clearcoatNormalMap||!!r.displacementMap,uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap)&&!!r.displacementMap,fog:!!y,useFog:r.fog,fogExp2:y&&y.isFogExp2,flatShading:r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:a,skinning:r.skinning&&C>0,maxBones:C,useVertexTexture:o,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:c.directional.length,numPointLights:c.point.length,numSpotLights:c.spot.length,numRectAreaLights:c.rectArea.length,numHemiLights:c.hemi.length,numDirLightShadows:c.directionalShadowMap.length,numPointLightShadows:c.pointShadowMap.length,numSpotLightShadows:c.spotShadowMap.length,numClippingPlanes:g,numClipIntersection:_,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:r.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===2,flipSided:r.side===1,depthPacking:r.depthPacking===void 0?!1:r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:i||t.get(`EXT_frag_depth`)!==null,rendererExtensionDrawBuffers:i||t.get(`WEBGL_draw_buffers`)!==null,rendererExtensionShaderTextureLod:i||t.get(`EXT_shader_texture_lod`)!==null,onBeforeCompile:r.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),t.defines!==void 0)for(var r in t.defines)n.push(r),n.push(t.defines[r]);if(t.isRawShaderMaterial===void 0){for(var i=0;i<d.length;i++)n.push(t[d[i]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var i,a=0,o=r.length;a<o;a++){var s=r[a];if(s.cacheKey===n){i=s,++i.usedTimes;break}}return i===void 0&&(i=new Zt(e,n,t),r.push(i)),i},this.releaseProgram=function(e){if(--e.usedTimes===0){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r}function $t(){var e=new WeakMap;function t(t){var n=e.get(t);return n===void 0&&(n={},e.set(t,n)),n}function n(t){e.delete(t)}function r(t,n,r){e.get(t)[n]=r}function i(){e=new WeakMap}return{get:t,remove:n,update:r,dispose:i}}function en(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.program===t.program?e.material.id===t.material.id?e.z===t.z?e.id-t.id:e.z-t.z:e.material.id-t.material.id:e.program.id-t.program.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function tn(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function nn(){var e=[],t=0,n=[],r=[],i={id:-1};function a(){t=0,n.length=0,r.length=0}function o(n,r,a,o,s,c){var l=e[t];return l===void 0?(l={id:n.id,object:n,geometry:r,material:a,program:a.program||i,groupOrder:o,renderOrder:n.renderOrder,z:s,group:c},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=a,l.program=a.program||i,l.groupOrder=o,l.renderOrder=n.renderOrder,l.z=s,l.group=c),t++,l}function s(e,t,i,a,s,c){var l=o(e,t,i,a,s,c);(i.transparent===!0?r:n).push(l)}function c(e,t,i,a,s,c){var l=o(e,t,i,a,s,c);(i.transparent===!0?r:n).unshift(l)}function l(e,t){n.length>1&&n.sort(e||en),r.length>1&&r.sort(t||tn)}function u(){for(var n=t,r=e.length;n<r;n++){var i=e[n];if(i.id===null)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}}return{opaque:n,transparent:r,init:a,push:s,unshift:c,finish:u,sort:l}}function rn(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener(`dispose`,t),e.delete(r)}function n(n,r){var i=e.get(n),a;return i===void 0?(a=new nn,e.set(n,new WeakMap),e.get(n).set(r,a),n.addEventListener(`dispose`,t)):(a=i.get(r),a===void 0&&(a=new nn,i.set(r,a))),a}function r(){e=new WeakMap}return{get:n,dispose:r}}function an(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case`DirectionalLight`:n={direction:new D,color:new z};break;case`SpotLight`:n={position:new D,direction:new D,color:new z,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new D,color:new z,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new D,skyColor:new z,groundColor:new z};break;case`RectAreaLight`:n={color:new z,position:new D,halfWidth:new D,halfHeight:new D};break}return e[t.id]=n,n}}}function on(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case`DirectionalLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b};break;case`SpotLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b};break;case`PointLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}function sn(e,t){return!!t.castShadow-+!!e.castShadow}function cn(){for(var e=new an,t=on(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)n.probe.push(new D);var i=new D,a=new O,o=new O;function s(r,s,c){for(var l=0,u=0,d=0,f=0;f<9;f++)n.probe[f].set(0,0,0);var p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=c.matrixWorldInverse;r.sort(sn);for(var f=0,S=r.length;f<S;f++){var C=r[f],w=C.color,T=C.intensity,E=C.distance,D=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)l+=w.r*T,u+=w.g*T,d+=w.b*T;else if(C.isLightProbe)for(var O=0;O<9;O++)n.probe[O].addScaledVector(C.sh.coefficients[O],T);else if(C.isDirectionalLight){var k=e.get(C);if(k.color.copy(C.color).multiplyScalar(C.intensity),k.direction.setFromMatrixPosition(C.matrixWorld),i.setFromMatrixPosition(C.target.matrixWorld),k.direction.sub(i),k.direction.transformDirection(x),C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,n.directionalShadow[p]=j,n.directionalShadowMap[p]=D,n.directionalShadowMatrix[p]=C.shadow.matrix,v++}n.directional[p]=k,p++}else if(C.isSpotLight){var k=e.get(C);if(k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),k.color.copy(w).multiplyScalar(T),k.distance=E,k.direction.setFromMatrixPosition(C.matrixWorld),i.setFromMatrixPosition(C.target.matrixWorld),k.direction.sub(i),k.direction.transformDirection(x),k.coneCos=Math.cos(C.angle),k.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),k.decay=C.decay,C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,n.spotShadow[h]=j,n.spotShadowMap[h]=D,n.spotShadowMatrix[h]=C.shadow.matrix,b++}n.spot[h]=k,h++}else if(C.isRectAreaLight){var k=e.get(C);k.color.copy(w).multiplyScalar(T),k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),o.identity(),a.copy(C.matrixWorld),a.premultiply(x),o.extractRotation(a),k.halfWidth.set(C.width*.5,0,0),k.halfHeight.set(0,C.height*.5,0),k.halfWidth.applyMatrix4(o),k.halfHeight.applyMatrix4(o),n.rectArea[g]=k,g++}else if(C.isPointLight){var k=e.get(C);if(k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),k.color.copy(C.color).multiplyScalar(C.intensity),k.distance=C.distance,k.decay=C.decay,C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,j.shadowCameraNear=A.camera.near,j.shadowCameraFar=A.camera.far,n.pointShadow[m]=j,n.pointShadowMap[m]=D,n.pointShadowMatrix[m]=C.shadow.matrix,y++}n.point[m]=k,m++}else if(C.isHemisphereLight){var k=e.get(C);k.direction.setFromMatrixPosition(C.matrixWorld),k.direction.transformDirection(x),k.direction.normalize(),k.skyColor.copy(C.color).multiplyScalar(T),k.groundColor.copy(C.groundColor).multiplyScalar(T),n.hemi[_]=k,_++}}n.ambient[0]=l,n.ambient[1]=u,n.ambient[2]=d;var M=n.hash;(M.directionalLength!==p||M.pointLength!==m||M.spotLength!==h||M.rectAreaLength!==g||M.hemiLength!==_||M.numDirectionalShadows!==v||M.numPointShadows!==y||M.numSpotShadows!==b)&&(n.directional.length=p,n.spot.length=h,n.rectArea.length=g,n.point.length=m,n.hemi.length=_,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=y,n.pointShadowMap.length=y,n.spotShadow.length=b,n.spotShadowMap.length=b,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=y,n.spotShadowMatrix.length=b,M.directionalLength=p,M.pointLength=m,M.spotLength=h,M.rectAreaLength=g,M.hemiLength=_,M.numDirectionalShadows=v,M.numPointShadows=y,M.numSpotShadows=b,n.version=wu++)}return{setup:s,state:n}}function ln(){var e=new cn,t=[],n=[];function r(){t.length=0,n.length=0}function i(e){t.push(e)}function a(e){n.push(e)}function o(r){e.setup(t,n,r)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:o,pushLight:i,pushShadow:a}}function un(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener(`dispose`,t),e.delete(r)}function n(n,r){var i;return e.has(n)===!1?(i=new ln,e.set(n,new WeakMap),e.get(n).set(r,i),n.addEventListener(`dispose`,t)):e.get(n).has(r)===!1?(i=new ln,e.get(n).set(r,i)):i=e.get(n).get(r),i}function r(){e=new WeakMap}return{get:n,dispose:r}}function dn(e){V.call(this),this.type=`MeshDepthMaterial`,this.depthPacking=sc,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function fn(e){V.call(this),this.type=`MeshDistanceMaterial`,this.referencePosition=new D,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}function pn(e,t,n){var r=new Se,i=new b,a=new b,o=new C,s=[],c=[],l={},u={0:1,1:0,2:2},d=new ge({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new b},radius:{value:4}},vertexShader:Eu,fragmentShader:Tu}),f=d.clone();f.defines.HORIZONAL_PASS=1;var p=new q;p.setAttribute(`position`,new H(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new de(p,d),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,c){if(h.enabled!==!1&&!(h.autoUpdate===!1&&h.needsUpdate===!1)&&t.length!==0){var l=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);for(var p=0,m=t.length;p<m;p++){var _=t[p],v=_.shadow;if(v===void 0){console.warn(`THREE.WebGLShadowMap:`,_,`has no shadow.`);continue}i.copy(v.mapSize);var y=v.getFrameExtents();if(i.multiply(y),a.copy(v.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(a.x=Math.floor(n/y.x),i.x=a.x*y.x,v.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/y.y),i.y=a.y*y.y,v.mapSize.y=a.y)),v.map===null&&!v.isPointLightShadow&&this.type===3){var b={minFilter:Ko,magFilter:Ko,format:es};v.map=new w(i.x,i.y,b),v.map.texture.name=_.name+`.shadowMap`,v.mapPass=new w(i.x,i.y,b),v.camera.updateProjectionMatrix()}if(v.map===null){var b={minFilter:Uo,magFilter:Uo,format:es};v.map=new w(i.x,i.y,b),v.map.texture.name=_.name+`.shadowMap`,v.camera.updateProjectionMatrix()}e.setRenderTarget(v.map),e.clear();for(var S=v.getViewportCount(),C=0;C<S;C++){var T=v.getViewport(C);o.set(a.x*T.x,a.y*T.y,a.x*T.z,a.y*T.w),f.viewport(o),v.updateMatrices(_,C),r=v.getFrustum(),x(s,c,v.camera,_,this.type)}!v.isPointLightShadow&&this.type===3&&g(v,c)}h.needsUpdate=!1,e.setRenderTarget(l,u,d)}};function g(n,r){var i=t.update(m);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,d,m,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,f,m,null)}function _(e,t,n){var r=e<<0|t<<1|n<<2,i=s[r];return i===void 0&&(i=new dn({depthPacking:cc,morphTargets:e,skinning:t}),s[r]=i),i}function v(e,t,n){var r=e<<0|t<<1|n<<2,i=c[r];return i===void 0&&(i=new fn({morphTargets:e,skinning:t}),c[r]=i),i}function y(t,n,r,i,a,o,s){var c=null,d=_,f=t.customDepthMaterial;if(i.isPointLight===!0&&(d=v,f=t.customDistanceMaterial),f===void 0){var p=!1;r.morphTargets===!0&&(p=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var m=!1;t.isSkinnedMesh===!0&&(r.skinning===!0?m=!0:console.warn(`THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:`,t));var h=t.isInstancedMesh===!0;c=d(p,m,h)}else c=f;if(e.localClippingEnabled&&r.clipShadows===!0&&r.clippingPlanes.length!==0){var g=c.uuid,y=r.uuid,b=l[g];b===void 0&&(b={},l[g]=b);var x=b[y];x===void 0&&(x=c.clone(),b[y]=x),c=x}return c.visible=r.visible,c.wireframe=r.wireframe,s===3?c.side=r.shadowSide===null?r.side:r.shadowSide:c.side=r.shadowSide===null?u[r.side]:r.shadowSide,c.clipShadows=r.clipShadows,c.clippingPlanes=r.clippingPlanes,c.clipIntersection=r.clipIntersection,c.wireframeLinewidth=r.wireframeLinewidth,c.linewidth=r.linewidth,i.isPointLight===!0&&c.isMeshDistanceMaterial===!0&&(c.referencePosition.setFromMatrixPosition(i.matrixWorld),c.nearDistance=a,c.farDistance=o),c}function x(n,i,a,o,s){if(n.visible!==!1){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var c=t.update(n),l=n.material;if(Array.isArray(l))for(var u=c.groups,d=0,f=u.length;d<f;d++){var p=u[d],m=l[p.materialIndex];if(m&&m.visible){var h=y(n,c,m,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,h,n,p)}}else if(l.visible){var h=y(n,c,l,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,h,n,null)}}for(var g=n.children,_=0,v=g.length;_<v;_++)x(g[_],i,a,o,s)}}}function mn(e,t,n){var r=n.isWebGL2;function i(){var t=!1,n=new C,r=null,i=new C(0,0,0,0);return{setMask:function(n){r!==n&&!t&&(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){s===!0&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),i.equals(n)===!1&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}}function a(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?H(2929):U(2929)},setMask:function(r){n!==r&&!t&&(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}}function o(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){t||(e?H(2960):U(2960))},setMask:function(r){n!==r&&!t&&(e.stencilMask(r),n=r)},setFunc:function(t,n,o){(r!==t||i!==n||a!==o)&&(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){(o!==t||s!==n||c!==r)&&(e.stencilOp(t,n,r),o=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}}var s=new i,c=new a,l=new o,u=e.getParameter(34921),d=new Uint8Array(u),f=new Uint8Array(u),p=new Uint8Array(u),m={},h=null,g=null,_=null,v=null,y=null,b=null,x=null,S=null,w=null,T=!1,E=null,D=null,O=null,k=null,A=null,j=e.getParameter(35661),M=!1,N=0,P=e.getParameter(7938);P.indexOf(`WebGL`)===-1?P.indexOf(`OpenGL ES`)!==-1&&(N=parseFloat(/^OpenGL\\ ES\\ ([0-9])/.exec(P)[1]),M=N>=2):(N=parseFloat(/^WebGL\\ ([0-9])/.exec(P)[1]),M=N>=1);var F=null,I={},L=new C,R=new C;function z(t,n,r){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<r;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var ee={};ee[3553]=z(3553,3553,1),ee[34067]=z(34067,34069,6),s.setClear(0,0,0,1),c.setClear(1),l.setClear(0),H(2929),c.setFunc(3),K(!1),ce(1),H(2884),oe(0);function te(){for(var e=0,t=d.length;e<t;e++)d[e]=0}function ne(e){B(e,0)}function B(n,i){d[n]=1,f[n]===0&&(e.enableVertexAttribArray(n),f[n]=1),p[n]!==i&&((r?e:t.get(`ANGLE_instanced_arrays`))[r?`vertexAttribDivisor`:`vertexAttribDivisorANGLE`](n,i),p[n]=i)}function V(){for(var t=0,n=f.length;t!==n;++t)f[t]!==d[t]&&(e.disableVertexAttribArray(t),f[t]=0)}function re(t,n,i,a,o,s){r===!0&&(i===5124||i===5125)?e.vertexAttribIPointer(t,n,i,a,o,s):e.vertexAttribPointer(t,n,i,a,o,s)}function H(t){m[t]!==!0&&(e.enable(t),m[t]=!0)}function U(t){m[t]!==!1&&(e.disable(t),m[t]=!1)}function ie(t){return h===t?!1:(e.useProgram(t),h=t,!0)}var W={100:32774,101:32778,102:32779};if(r)W[103]=32775,W[104]=32776;else{var ae=t.get(`EXT_blend_minmax`);ae!==null&&(W[103]=ae.MIN_EXT,W[104]=ae.MAX_EXT)}var G={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function oe(t,n,r,i,a,o,s,c){if(t===0){g&&(U(3042),g=!1);return}if(g||(H(3042),g=!0),t!==5){if(t!==_||c!==T){if((v!==100||x!==100)&&(e.blendEquation(32774),v=100,x=100),c)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error(`THREE.WebGLState: Invalid blending: `,t);break}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error(`THREE.WebGLState: Invalid blending: `,t);break}y=null,b=null,S=null,w=null,_=t,T=c}return}a=a||n,o=o||r,s=s||i,(n!==v||a!==x)&&(e.blendEquationSeparate(W[n],W[a]),v=n,x=a),(r!==y||i!==b||o!==S||s!==w)&&(e.blendFuncSeparate(G[r],G[i],G[o],G[s]),y=r,b=i,S=o,w=s),_=t,T=null}function se(e,t){e.side===2?U(2884):H(2884);var n=e.side===1;t&&(n=!n),K(n),e.blending===1&&e.transparent===!1?oe(0):oe(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),c.setFunc(e.depthFunc),c.setTest(e.depthTest),c.setMask(e.depthWrite),s.setMask(e.colorWrite);var r=e.stencilWrite;l.setTest(r),r&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),ue(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function K(t){E!==t&&(t?e.frontFace(2304):e.frontFace(2305),E=t)}function ce(t){t===0?U(2884):(H(2884),t!==D&&(t===1?e.cullFace(1029):t===2?e.cullFace(1028):e.cullFace(1032))),D=t}function le(t){t!==O&&(M&&e.lineWidth(t),O=t)}function ue(t,n,r){t?(H(32823),(k!==n||A!==r)&&(e.polygonOffset(n,r),k=n,A=r)):U(32823)}function q(e){e?H(3089):U(3089)}function de(t){t===void 0&&(t=33984+j-1),F!==t&&(e.activeTexture(t),F=t)}function fe(t,n){F===null&&de();var r=I[F];r===void 0&&(r={type:void 0,texture:void 0},I[F]=r),(r.type!==t||r.texture!==n)&&(e.bindTexture(t,n||ee[t]),r.type=t,r.texture=n)}function pe(){var t=I[F];t!==void 0&&t.type!==void 0&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)}function J(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function me(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function he(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function ge(t){L.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),L.copy(t))}function _e(t){R.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),R.copy(t))}function ve(){for(var t=0;t<f.length;t++)f[t]===1&&(e.disableVertexAttribArray(t),f[t]=0);m={},F=null,I={},h=null,_=null,E=null,D=null,s.reset(),c.reset(),l.reset()}return{buffers:{color:s,depth:c,stencil:l},initAttributes:te,enableAttribute:ne,enableAttributeAndDivisor:B,disableUnusedAttributes:V,vertexAttribPointer:re,enable:H,disable:U,useProgram:ie,setBlending:oe,setMaterial:se,setFlipSided:K,setCullFace:ce,setLineWidth:le,setPolygonOffset:ue,setScissorTest:q,activeTexture:de,bindTexture:fe,unbindTexture:pe,compressedTexImage2D:J,texImage2D:me,texImage3D:he,scissor:ge,viewport:_e,reset:ve}}function hn(e,t,n,r,i,a,o){var s=i.isWebGL2,c=i.maxTextures,l=i.maxCubemapSize,u=i.maxTextureSize,d=i.maxSamples,f=new WeakMap,p,m=!1;try{m=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch(e){}function h(e,t){return m?new OffscreenCanvas(e,t):document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`)}function g(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||t===!0)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){var a=t?X.floorPowerOfTwo:Math.floor,o=a(i*e.width),s=a(i*e.height);p===void 0&&(p=h(o,s));var c=n?h(o,s):p;return c.width=o,c.height=s,c.getContext(`2d`).drawImage(e,0,0,o,s),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+e.width+`x`+e.height+`) to (`+o+`x`+s+`).`),c}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+e.width+`x`+e.height+`).`),e;return e}function _(e){return X.isPowerOfTwo(e.width)&&X.isPowerOfTwo(e.height)}function v(e){return s?!1:e.wrapS!==1001||e.wrapT!==1001||e.minFilter!==1003&&e.minFilter!==1006}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==1003&&e.minFilter!==1006}function b(t,n,i,a){e.generateMipmap(t);var o=r.get(n);o.__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function x(n,r,i){if(s===!1)return r;if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'`+n+`\'`)}var a=r;return r===6403&&(i===5126&&(a=33326),i===5131&&(a=33325),i===5121&&(a=33321)),r===6407&&(i===5126&&(a=34837),i===5131&&(a=34843),i===5121&&(a=32849)),r===6408&&(i===5126&&(a=34836),i===5131&&(a=34842),i===5121&&(a=32856)),(a===33325||a===33326||a===34842||a===34836)&&t.get(`EXT_color_buffer_float`),a}function S(e){return e===1003||e===1004||e===1005?9728:9729}function C(e){var t=e.target;t.removeEventListener(`dispose`,C),T(t),t.isVideoTexture&&f.delete(t),o.memory.textures--}function w(e){var t=e.target;t.removeEventListener(`dispose`,w),E(t),o.memory.textures--}function T(t){var n=r.get(t);n.__webglInit!==void 0&&(e.deleteTexture(n.__webglTexture),r.remove(t))}function E(t){var n=r.get(t),i=r.get(t.texture);if(t){if(i.__webglTexture!==void 0&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(t.texture),r.remove(t)}}var D=0;function O(){D=0}function k(){var e=D;return e>=c&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+c),D+=1,e}function A(e,t){var i=r.get(e);if(e.isVideoTexture&&ie(e),e.version>0&&i.__version!==e.version){var a=e.image;if(a===void 0)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is undefined`);else if(a.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{z(i,e,t);return}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function j(e,t){var i=r.get(e);if(e.version>0&&i.__version!==e.version){z(i,e,t);return}n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture)}function M(e,t){var i=r.get(e);if(e.version>0&&i.__version!==e.version){z(i,e,t);return}n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture)}function N(t,i){if(t.image.length===6){var o=r.get(t);if(t.version>0&&o.__version!==t.version){R(o,t),n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var c=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),u=t.image[0]&&t.image[0].isDataTexture,d=[],f=0;f<6;f++)!c&&!u?d[f]=g(t.image[f],!1,!0,l):d[f]=u?t.image[f].image:t.image[f];var p=d[0],m=_(p)||s,h=a.convert(t.format),v=a.convert(t.type),S=x(t.internalFormat,h,v);L(34067,t,m);var C;if(c){for(var f=0;f<6;f++){C=d[f].mipmaps;for(var w=0;w<C.length;w++){var T=C[w];t.format!==1023&&t.format!==1022?h===null?console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()`):n.compressedTexImage2D(34069+f,w,S,T.width,T.height,0,T.data):n.texImage2D(34069+f,w,S,T.width,T.height,0,h,v,T.data)}}o.__maxMipLevel=C.length-1}else{C=t.mipmaps;for(var f=0;f<6;f++)if(u){n.texImage2D(34069+f,0,S,d[f].width,d[f].height,0,h,v,d[f].data);for(var w=0;w<C.length;w++){var T=C[w],E=T.image[f].image;n.texImage2D(34069+f,w+1,S,E.width,E.height,0,h,v,E.data)}}else{n.texImage2D(34069+f,0,S,h,v,d[f]);for(var w=0;w<C.length;w++){var T=C[w];n.texImage2D(34069+f,w+1,S,h,v,T.image[f])}}o.__maxMipLevel=C.length}y(t,m)&&b(34067,t,p.width,p.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture)}}function P(e,t){n.activeTexture(33984+t),n.bindTexture(34067,r.get(e).__webglTexture)}var F={[Bo]:10497,[Vo]:33071,[Ho]:33648},I={[Uo]:9728,[Wo]:9984,[Go]:9986,[Ko]:9729,[qo]:9985,[Jo]:9987};function L(n,a,o){o?(e.texParameteri(n,10242,F[a.wrapS]),e.texParameteri(n,10243,F[a.wrapT]),(n===32879||n===35866)&&e.texParameteri(n,32882,F[a.wrapR]),e.texParameteri(n,10240,I[a.magFilter]),e.texParameteri(n,10241,I[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),(n===32879||n===35866)&&e.texParameteri(n,32882,33071),(a.wrapS!==1001||a.wrapT!==1001)&&console.warn(`THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.`),e.texParameteri(n,10240,S(a.magFilter)),e.texParameteri(n,10241,S(a.minFilter)),a.minFilter!==1003&&a.minFilter!==1006&&console.warn(`THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.`));var c=t.get(`EXT_texture_filter_anisotropic`);if(c){if(a.type===1015&&t.get(`OES_texture_float_linear`)===null||a.type===1016&&(s||t.get(`OES_texture_half_float_linear`))===null)return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function R(t,n){t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,C),t.__webglTexture=e.createTexture(),o.memory.textures++)}function z(t,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),R(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);var c=v(r)&&_(r.image)===!1,l=g(r.image,c,!1,u),d=_(l)||s,f=a.convert(r.format),p=a.convert(r.type),m=x(r.internalFormat,f,p);L(o,r,d);var h,S=r.mipmaps;if(r.isDepthTexture)m=6402,s?m=r.type===1015?36012:r.type===1014?33190:r.type===1020?35056:33189:r.type===1015&&console.error(`WebGLRenderer: Floating point depth texture requires WebGL2.`),r.format===1026&&m===6402&&r.type!==1012&&r.type!==1014&&(console.warn(`THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.`),r.type=Xo,p=a.convert(r.type)),r.format===1027&&m===6402&&(m=34041,r.type!==1020&&(console.warn(`THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.`),r.type=Qo,p=a.convert(r.type))),n.texImage2D(3553,0,m,l.width,l.height,0,f,p,null);else if(r.isDataTexture)if(S.length>0&&d){for(var C=0,w=S.length;C<w;C++)h=S[C],n.texImage2D(3553,C,m,h.width,h.height,0,f,p,h.data);r.generateMipmaps=!1,t.__maxMipLevel=S.length-1}else n.texImage2D(3553,0,m,l.width,l.height,0,f,p,l.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(var C=0,w=S.length;C<w;C++)h=S[C],r.format!==1023&&r.format!==1022?f===null?console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`):n.compressedTexImage2D(3553,C,m,h.width,h.height,0,h.data):n.texImage2D(3553,C,m,h.width,h.height,0,f,p,h.data);t.__maxMipLevel=S.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,m,l.width,l.height,l.depth,0,f,p,l.data),t.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,m,l.width,l.height,l.depth,0,f,p,l.data),t.__maxMipLevel=0;else if(S.length>0&&d){for(var C=0,w=S.length;C<w;C++)h=S[C],n.texImage2D(3553,C,m,f,p,h);r.generateMipmaps=!1,t.__maxMipLevel=S.length-1}else n.texImage2D(3553,0,m,f,p,l),t.__maxMipLevel=0;y(r,d)&&b(o,r,l.width,l.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function ee(t,i,o,s){var c=a.convert(i.texture.format),l=a.convert(i.texture.type),u=x(i.texture.internalFormat,c,l);n.texImage2D(s,0,u,i.width,i.height,0,c,l,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function te(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===1015?i=36012:o.type===1014&&(i=33190));var s=U(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(r){var s=U(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var c=a.convert(n.texture.format),l=a.convert(n.texture.type),i=x(n.texture.internalFormat,c,l);if(r){var s=U(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height)}e.bindRenderbuffer(36161,null)}function ne(t,n){if(n&&n.isWebGLCubeRenderTarget)throw Error(`Depth Texture with cube render targets is not supported`);if(e.bindFramebuffer(36160,t),!(n.depthTexture&&n.depthTexture.isDepthTexture))throw Error(`renderTarget.depthTexture must be an instance of THREE.DepthTexture`);(!r.get(n.depthTexture).__webglTexture||n.depthTexture.image.width!==n.width||n.depthTexture.image.height!==n.height)&&(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),A(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===1026)e.framebufferTexture2D(36160,36096,3553,i,0);else if(n.depthTexture.format===1027)e.framebufferTexture2D(36160,33306,3553,i,0);else throw Error(`Unknown depthTexture format`)}function B(t){var n=r.get(t),i=t.isWebGLCubeRenderTarget===!0;if(t.depthTexture){if(i)throw Error(`target.depthTexture not supported in Cube render targets`);ne(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),te(n.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),te(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function V(t){var i=r.get(t),c=r.get(t.texture);t.addEventListener(`dispose`,w),c.__webglTexture=e.createTexture(),o.memory.textures++;var l=t.isWebGLCubeRenderTarget===!0,u=t.isWebGLMultisampleRenderTarget===!0,d=_(t)||s;if(s&&t.texture.format===1022&&(t.texture.type===1015||t.texture.type===1016)&&(t.texture.format=es,console.warn(`THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.`)),l){i.__webglFramebuffer=[];for(var f=0;f<6;f++)i.__webglFramebuffer[f]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),u)if(s){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);var p=a.convert(t.texture.format),m=a.convert(t.texture.type),h=x(t.texture.internalFormat,p,m),g=U(t);e.renderbufferStorageMultisample(36161,g,h,t.width,t.height),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(i.__webglDepthRenderbuffer=e.createRenderbuffer(),te(i.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn(`THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.`);if(l){n.bindTexture(34067,c.__webglTexture),L(34067,t.texture,d);for(var f=0;f<6;f++)ee(i.__webglFramebuffer[f],t,36064,34069+f);y(t.texture,d)&&b(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,c.__webglTexture),L(3553,t.texture,d),ee(i.__webglFramebuffer,t,36064,3553),y(t.texture,d)&&b(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&B(t)}function re(e){var t=e.texture;if(y(t,_(e)||s)){var i=e.isWebGLCubeRenderTarget?34067:3553,a=r.get(t).__webglTexture;n.bindTexture(i,a),b(i,t,e.width,e.height),n.bindTexture(i,null)}}function H(t){if(t.isWebGLMultisampleRenderTarget)if(s){var n=r.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var i=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn(`THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.`)}function U(e){return s&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}function ie(e){var t=o.render.frame;f.get(e)!==t&&(f.set(e,t),e.update())}var W=!1,ae=!1;function G(e,t){e&&e.isWebGLRenderTarget&&(W===!1&&(console.warn(`THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.`),W=!0),e=e.texture),A(e,t)}function oe(e,t){e&&e.isWebGLCubeRenderTarget&&(ae===!1&&(console.warn(`THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.`),ae=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&e.image.length===6?N(e,t):P(e,t)}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=A,this.setTexture2DArray=j,this.setTexture3D=M,this.setTextureCube=N,this.setTextureCubeDynamic=P,this.setupRenderTarget=V,this.updateRenderTargetMipmap=re,this.updateMultisampleRenderTarget=H,this.safeSetTexture2D=G,this.safeSetTextureCube=oe}function gn(e,t,n){var r=n.isWebGL2;function i(e){var n;if(e===1009)return 5121;if(e===1017)return 32819;if(e===1018)return 32820;if(e===1019)return 33635;if(e===1010)return 5120;if(e===1011)return 5122;if(e===1012)return 5123;if(e===1013)return 5124;if(e===1014)return 5125;if(e===1015)return 5126;if(e===1016)return r?5131:(n=t.get(`OES_texture_half_float`),n===null?null:n.HALF_FLOAT_OES);if(e===1021)return 6406;if(e===1022)return 6407;if(e===1023)return 6408;if(e===1024)return 6409;if(e===1025)return 6410;if(e===1026)return 6402;if(e===1027)return 34041;if(e===1028)return 6403;if(e===1029)return 36244;if(e===1030)return 33319;if(e===1031)return 33320;if(e===1032)return 36248;if(e===1033)return 36249;if(e===33776||e===33777||e===33778||e===33779)if(n=t.get(`WEBGL_compressed_texture_s3tc`),n!==null){if(e===33776)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===33777)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===33778)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===33779)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===35840||e===35841||e===35842||e===35843)if(n=t.get(`WEBGL_compressed_texture_pvrtc`),n!==null){if(e===35840)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===35841)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===35842)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===35843)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===36196)return n=t.get(`WEBGL_compressed_texture_etc1`),n===null?null:n.COMPRESSED_RGB_ETC1_WEBGL;if((e===37492||e===37496)&&(n=t.get(`WEBGL_compressed_texture_etc`),n!==null)){if(e===37492)return n.COMPRESSED_RGB8_ETC2;if(e===37496)return n.COMPRESSED_RGBA8_ETC2_EAC}if(e===37808||e===37809||e===37810||e===37811||e===37812||e===37813||e===37814||e===37815||e===37816||e===37817||e===37818||e===37819||e===37820||e===37821||e===37840||e===37841||e===37842||e===37843||e===37844||e===37845||e===37846||e===37847||e===37848||e===37849||e===37850||e===37851||e===37852||e===37853)return n=t.get(`WEBGL_compressed_texture_astc`),n===null?null:e;if(e===36492)return n=t.get(`EXT_texture_compression_bptc`),n===null?null:e;if(e===1020)return r?34042:(n=t.get(`WEBGL_depth_texture`),n===null?null:n.UNSIGNED_INT_24_8_WEBGL)}return{convert:i}}function _n(e){ve.call(this),this.cameras=e||[]}function vn(){j.call(this),this.type=`Group`}function yn(){this._targetRay=null,this._grip=null}function bn(e,t){var n=this,r=null,i=1,a=null,o=`local-floor`,s=null,c=[],l=new Map,u=new ve;u.layers.enable(1),u.viewport=new C;var d=new ve;d.layers.enable(2),d.viewport=new C;var f=[u,d],p=new _n;p.layers.enable(1),p.layers.enable(2);var m=null,h=null;this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=c[e];return t===void 0&&(t=new yn,c[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=c[e];return t===void 0&&(t=new yn,c[e]=t),t.getGripSpace()};function g(e){var t=l.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function _(){l.forEach(function(e,t){e.disconnect(t)}),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),O.stop(),n.isPresenting=!1,n.dispatchEvent({type:`sessionend`})}function v(e){a=e,O.setContext(r),O.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&console.warn(`THREE.WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&console.warn(`THREE.WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return a},this.getSession=function(){return r},this.setSession=function(e){if(r=e,r!==null){r.addEventListener(`select`,g),r.addEventListener(`selectstart`,g),r.addEventListener(`selectend`,g),r.addEventListener(`squeeze`,g),r.addEventListener(`squeezestart`,g),r.addEventListener(`squeezeend`,g),r.addEventListener(`end`,_);var n=t.getContextAttributes();n.xrCompatible!==!0&&t.makeXRCompatible();var a={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:i},s=new XRWebGLLayer(r,t,a);r.updateRenderState({baseLayer:s}),r.requestReferenceSpace(o).then(v),r.addEventListener(`inputsourceschange`,y)}};function y(e){for(var t=r.inputSources,n=0;n<c.length;n++)l.set(t[n],c[n]);for(var n=0;n<e.removed.length;n++){var i=e.removed[n],a=l.get(i);a&&(a.dispatchEvent({type:`disconnected`,data:i}),l.delete(i))}for(var n=0;n<e.added.length;n++){var i=e.added[n],a=l.get(i);a&&a.dispatchEvent({type:`connected`,data:i})}}var b=new D,x=new D;function S(e,t,n){b.setFromMatrixPosition(t.matrixWorld),x.setFromMatrixPosition(n.matrixWorld);var r=b.distanceTo(x),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+m,_=s+m,v=f-h,y=p+(r-h),S=c*s/_*g,C=l*s/_*g;e.projectionMatrix.makePerspective(v,y,S,C,g,_)}function w(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){p.near=d.near=u.near=e.near,p.far=d.far=u.far=e.far,(m!==p.near||h!==p.far)&&(r.updateRenderState({depthNear:p.near,depthFar:p.far}),m=p.near,h=p.far);var t=e.parent,n=p.cameras;w(p,t);for(var i=0;i<n.length;i++)w(n[i],t);e.matrixWorld.copy(p.matrixWorld);for(var a=e.children,i=0,o=a.length;i<o;i++)a[i].updateMatrixWorld(!0);return n.length===2?S(p,u,d):p.projectionMatrix.copy(u.projectionMatrix),p};var T=null;function E(t,n){if(s=n.getViewerPose(a),s!==null){var i=s.views,o=r.renderState.baseLayer;e.setFramebuffer(o.framebuffer);var l=!1;i.length!==p.cameras.length&&(p.cameras.length=0,l=!0);for(var u=0;u<i.length;u++){var d=i[u],m=o.getViewport(d),h=f[u];h.matrix.fromArray(d.transform.matrix),h.projectionMatrix.fromArray(d.projectionMatrix),h.viewport.set(m.x,m.y,m.width,m.height),u===0&&p.matrix.copy(h.matrix),l===!0&&p.cameras.push(h)}}for(var g=r.inputSources,u=0;u<c.length;u++){var _=c[u],v=g[u];_.update(v,n,a)}T&&T(t,n)}var O=new Ce;O.setAnimationLoop(E),this.setAnimationLoop=function(e){T=e},this.dispose=function(){}}function xn(e){function t(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}function n(e,t,n,_,v){t.isMeshBasicMaterial?r(e,t):t.isMeshLambertMaterial?(r(e,t),c(e,t)):t.isMeshToonMaterial?(r(e,t),u(e,t)):t.isMeshPhongMaterial?(r(e,t),l(e,t)):t.isMeshStandardMaterial?(r(e,t,n),t.isMeshPhysicalMaterial?f(e,t,n):d(e,t,n)):t.isMeshMatcapMaterial?(r(e,t),p(e,t)):t.isMeshDepthMaterial?(r(e,t),m(e,t)):t.isMeshDistanceMaterial?(r(e,t),h(e,t)):t.isMeshNormalMaterial?(r(e,t),g(e,t)):t.isLineBasicMaterial?(i(e,t),t.isLineDashedMaterial&&a(e,t)):t.isPointsMaterial?o(e,t,_,v):t.isSpriteMaterial?s(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function r(t,n,r){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var i=n.envMap||r;i&&(t.envMap.value=i,t.flipEnvMap.value=i.isCubeTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,t.maxMipLevel.value=e.get(i).__maxMipLevel),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity);var a;n.map?a=n.map:n.specularMap?a=n.specularMap:n.displacementMap?a=n.displacementMap:n.normalMap?a=n.normalMap:n.bumpMap?a=n.bumpMap:n.roughnessMap?a=n.roughnessMap:n.metalnessMap?a=n.metalnessMap:n.alphaMap?a=n.alphaMap:n.emissiveMap&&(a=n.emissiveMap),a!==void 0&&(a.isWebGLRenderTarget&&(a=a.texture),a.matrixAutoUpdate===!0&&a.updateMatrix(),t.uvTransform.value.copy(a.matrix));var o;n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),o!==void 0&&(o.isWebGLRenderTarget&&(o=o.texture),o.matrixAutoUpdate===!0&&o.updateMatrix(),t.uv2Transform.value.copy(o.matrix))}function i(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}function a(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function o(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=r*.5,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap);var i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap),i!==void 0&&(i.matrixAutoUpdate===!0&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}function s(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),n!==void 0&&(n.matrixAutoUpdate===!0&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function c(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function l(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function d(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}function f(e,t,n){d(e,t,n),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen),t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===1&&e.clearcoatNormalScale.value.negate()),e.transparency.value=t.transparency}function p(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function m(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function h(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}function g(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}return{refreshFogUniforms:t,refreshMaterialUniforms:n}}function Sn(e){e=e||{};var t=e.canvas===void 0?document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`):e.canvas,n=e.context===void 0?null:e.context,r=e.alpha===void 0?!1:e.alpha,i=e.depth===void 0?!0:e.depth,a=e.stencil===void 0?!0:e.stencil,o=e.antialias===void 0?!1:e.antialias,s=e.premultipliedAlpha===void 0?!0:e.premultipliedAlpha,c=e.preserveDrawingBuffer===void 0?!1:e.preserveDrawingBuffer,l=e.powerPreference===void 0?`default`:e.powerPreference,u=e.failIfMajorPerformanceCaveat===void 0?!1:e.failIfMajorPerformanceCaveat,d=null,f=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=$s,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var p=this,m=!1,h=null,g=0,_=0,v=null,y=null,x=-1,S={geometry:null,program:null,wireframe:!1},w=null,T=null,E=new C,k=new C,A=null,j=t.width,N=t.height,P=1,F=null,I=null,L=new C(0,0,j,N),R=new C(0,0,j,N),z=!1,ee=new Se,te=new Ae,ne=!1,B=!1,V=new O,re=new D;function H(){return v===null?P:1}var U;try{var ie={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(t.addEventListener(`webglcontextlost`,Te,!1),t.addEventListener(`webglcontextrestored`,Ee,!1),U=n||t.getContext(`webgl`,ie)||t.getContext(`experimental-webgl`,ie),U===null)throw t.getContext(`webgl`)===null?Error(`Error creating WebGL context.`):Error(`Error creating WebGL context with your selected attributes.`);U.getShaderPrecisionFormat===void 0&&(U.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}var W,ae,G,oe,se,K,ce,le,ue,q,de,fe,pe,J,me,he,ge,_e;function ve(){W=new je(U),ae=new ke(U,W,e),ae.isWebGL2===!1&&(W.get(`WEBGL_depth_texture`),W.get(`OES_texture_float`),W.get(`OES_texture_half_float`),W.get(`OES_texture_half_float_linear`),W.get(`OES_standard_derivatives`),W.get(`OES_element_index_uint`),W.get(`ANGLE_instanced_arrays`)),W.get(`OES_texture_float_linear`),_e=new gn(U,W,ae),G=new mn(U,W,ae),G.scissor(k.copy(R).multiplyScalar(P).floor()),G.viewport(E.copy(L).multiplyScalar(P).floor()),oe=new Pe(U),se=new $t,K=new hn(U,W,G,se,ae,_e,oe),ce=new we(U,ae),le=new Me(U,ce,oe),ue=new Le(U,le,ce,oe),me=new Ie(U),q=new Qt(p,W,ae),de=new xn(se),fe=new rn,pe=new un,J=new De(p,G,ue,s),he=new Oe(U,W,oe,ae),ge=new Ne(U,W,oe,ae),oe.programs=q.programs,p.capabilities=ae,p.extensions=W,p.properties=se,p.renderLists=fe,p.state=G,p.info=oe}ve();var ye=new bn(p,U);this.xr=ye;var be=new pn(p,ue,ae.maxTextureSize);this.shadowMap=be,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){var e=W.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){var e=W.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(e){e!==void 0&&(P=e,this.setSize(j,N,!1))},this.getSize=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getsize() now requires a Vector2 as an argument`),e=new b),e.set(j,N)},this.setSize=function(e,n,r){if(ye.isPresenting){console.warn(`THREE.WebGLRenderer: Can\'t change size while VR device is presenting.`);return}j=e,N=n,t.width=Math.floor(e*P),t.height=Math.floor(n*P),r!==!1&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument`),e=new b),e.set(j*P,N*P).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,N=n,P=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument`),e=new C),e.copy(E)},this.getViewport=function(e){return e.copy(L)},this.setViewport=function(e,t,n,r){e.isVector4?L.set(e.x,e.y,e.z,e.w):L.set(e,t,n,r),G.viewport(E.copy(L).multiplyScalar(P).floor())},this.getScissor=function(e){return e.copy(R)},this.setScissor=function(e,t,n,r){e.isVector4?R.set(e.x,e.y,e.z,e.w):R.set(e,t,n,r),G.scissor(k.copy(R).multiplyScalar(P).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(e){G.setScissorTest(z=e)},this.setOpaqueSort=function(e){F=e},this.setTransparentSort=function(e){I=e},this.getClearColor=function(){return J.getClearColor()},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(e,t,n){var r=0;(e===void 0||e)&&(r|=16384),(t===void 0||t)&&(r|=256),(n===void 0||n)&&(r|=1024),U.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Te,!1),t.removeEventListener(`webglcontextrestored`,Ee,!1),fe.dispose(),pe.dispose(),se.dispose(),ue.dispose(),ye.dispose(),Ge.stop()};function Te(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),m=!0}function Ee(){console.log(`THREE.WebGLRenderer: Context Restored.`),m=!1,ve()}function Fe(e){var t=e.target;t.removeEventListener(`dispose`,Fe),Re(t)}function Re(e){ze(e),se.remove(e)}function ze(e){var t=se.get(e).program;e.program=void 0,t!==void 0&&q.releaseProgram(t)}function Be(e,t){e.render(function(e){p.renderBufferImmediate(e,t)})}this.renderBufferImmediate=function(e,t){G.initAttributes();var n=se.get(e);e.hasPositions&&!n.position&&(n.position=U.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=U.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=U.createBuffer()),e.hasColors&&!n.color&&(n.color=U.createBuffer());var r=t.getAttributes();e.hasPositions&&(U.bindBuffer(34962,n.position),U.bufferData(34962,e.positionArray,35048),G.enableAttribute(r.position),U.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(U.bindBuffer(34962,n.normal),U.bufferData(34962,e.normalArray,35048),G.enableAttribute(r.normal),U.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(U.bindBuffer(34962,n.uv),U.bufferData(34962,e.uvArray,35048),G.enableAttribute(r.uv),U.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(U.bindBuffer(34962,n.color),U.bufferData(34962,e.colorArray,35048),G.enableAttribute(r.color),U.vertexAttribPointer(r.color,3,5126,!1,0,0)),G.disableUnusedAttributes(),U.drawArrays(4,0,e.count),e.count=0};var Ve=new M;this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=Ve);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=Xe(e,t,r,i);G.setMaterial(r,o);var c=!1;(S.geometry!==n.id||S.program!==s.id||S.wireframe!==(r.wireframe===!0))&&(S.geometry=n.id,S.program=s.id,S.wireframe=r.wireframe===!0,c=!0),(r.morphTargets||r.morphNormals)&&(me.update(i,n,r,s),c=!0),i.isInstancedMesh===!0&&(c=!0);var l=n.index,u=n.attributes.position;if(l===null){if(u===void 0||u.count===0)return}else if(l.count===0)return;var d=1;r.wireframe===!0&&(l=le.getWireframeAttribute(n),d=2);var f,p=he;l!==null&&(f=ce.get(l),p=ge,p.setIndex(f)),c&&(He(i,n,r,s),l!==null&&U.bindBuffer(34963,f.buffer));var m=l===null?u.count:l.count,h=n.drawRange.start*d,g=n.drawRange.count*d,_=a===null?0:a.start*d,v=a===null?1/0:a.count*d,y=Math.max(h,_),b=Math.min(m,h+g,_+v)-1,x=Math.max(0,b-y+1);if(x!==0){if(i.isMesh)r.wireframe===!0?(G.setLineWidth(r.wireframeLinewidth*H()),p.setMode(1)):p.setMode(4);else if(i.isLine){var C=r.linewidth;C===void 0&&(C=1),G.setLineWidth(C*H()),i.isLineSegments?p.setMode(1):i.isLineLoop?p.setMode(2):p.setMode(3)}else i.isPoints?p.setMode(0):i.isSprite&&p.setMode(4);if(i.isInstancedMesh)p.renderInstances(n,y,x,i.count);else if(n.isInstancedBufferGeometry){var w=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(n,y,x,w)}else p.render(y,x)}};function He(e,t,n,r){if(!(ae.isWebGL2===!1&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&W.get(`ANGLE_instanced_arrays`)===null)){G.initAttributes();var i=t.attributes,a=r.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var l=i[s];if(l!==void 0){var u=l.normalized,d=l.itemSize,f=ce.get(l);if(f===void 0)continue;var p=f.buffer,m=f.type,h=f.bytesPerElement;if(l.isInterleavedBufferAttribute){var g=l.data,_=g.stride,v=l.offset;g&&g.isInstancedInterleavedBuffer?(G.enableAttributeAndDivisor(c,g.meshPerAttribute),t._maxInstanceCount===void 0&&(t._maxInstanceCount=g.meshPerAttribute*g.count)):G.enableAttribute(c),U.bindBuffer(34962,p),G.vertexAttribPointer(c,d,m,u,_*h,v*h)}else l.isInstancedBufferAttribute?(G.enableAttributeAndDivisor(c,l.meshPerAttribute),t._maxInstanceCount===void 0&&(t._maxInstanceCount=l.meshPerAttribute*l.count)):G.enableAttribute(c),U.bindBuffer(34962,p),G.vertexAttribPointer(c,d,m,u,0,0)}else if(s===`instanceMatrix`){var f=ce.get(e.instanceMatrix);if(f===void 0)continue;var p=f.buffer,m=f.type;G.enableAttributeAndDivisor(c+0,1),G.enableAttributeAndDivisor(c+1,1),G.enableAttributeAndDivisor(c+2,1),G.enableAttributeAndDivisor(c+3,1),U.bindBuffer(34962,p),U.vertexAttribPointer(c+0,4,m,!1,64,0),U.vertexAttribPointer(c+1,4,m,!1,64,16),U.vertexAttribPointer(c+2,4,m,!1,64,32),U.vertexAttribPointer(c+3,4,m,!1,64,48)}else if(o!==void 0){var y=o[s];if(y!==void 0)switch(y.length){case 2:U.vertexAttrib2fv(c,y);break;case 3:U.vertexAttrib3fv(c,y);break;case 4:U.vertexAttrib4fv(c,y);break;default:U.vertexAttrib1fv(c,y)}}}}G.disableUnusedAttributes()}}this.compile=function(e,t){f=pe.get(e,t),f.init(),e.traverse(function(e){e.isLight&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),f.setupLights(t);let n={};e.traverse(function(t){let r=t.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){let a=r[i];a.uuid in n||(Ye(a,e,t),n[a.uuid]=!0)}else r.uuid in n||(Ye(r,e,t),n[r.uuid]=!0)})};var Ue=null;function We(e){ye.isPresenting||Ue&&Ue(e)}var Ge=new Ce;Ge.setAnimationLoop(We),typeof window<`u`&&Ge.setContext(window),this.setAnimationLoop=function(e){Ue=e,ye.setAnimationLoop(e),Ge.start()},this.render=function(e,t){var n,r;if(arguments[2]!==void 0&&(console.warn(`THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.`),n=arguments[2]),arguments[3]!==void 0&&(console.warn(`THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.`),r=arguments[3]),!(t&&t.isCamera)){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(!m){S.geometry=null,S.program=null,S.wireframe=!1,x=-1,w=null,e.autoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.updateMatrixWorld(),ye.enabled&&ye.isPresenting&&(t=ye.getCamera(t)),e.onBeforeRender(p,e,t,n||v),f=pe.get(e,t),f.init(),V.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(V),B=this.localClippingEnabled,ne=te.init(this.clippingPlanes,B,t),d=fe.get(e,t),d.init(),Ke(e,t,0,p.sortObjects),d.finish(),p.sortObjects===!0&&d.sort(F,I),ne&&te.beginShadows();var i=f.state.shadowsArray;be.render(i,e,t),f.setupLights(t),ne&&te.endShadows(),this.info.autoReset&&this.info.reset(),n!==void 0&&this.setRenderTarget(n),J.render(d,e,t,r);var a=d.opaque,o=d.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&qe(a,e,t,s),o.length&&qe(o,e,t,s)}else a.length&&qe(a,e,t),o.length&&qe(o,e,t);e.onAfterRender(p,e,t),v!==null&&(K.updateRenderTargetMipmap(v),K.updateMultisampleRenderTarget(v)),G.buffers.depth.setTest(!0),G.buffers.depth.setMask(!0),G.buffers.color.setMask(!0),G.setPolygonOffset(!1),d=null,f=null}};function Ke(e,t,n,r){if(e.visible!==!1){if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)f.pushLight(e),e.castShadow&&f.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V);var i=ue.update(e),a=e.material;a.visible&&d.push(e,i,a,n,re.z,null)}}else if(e.isImmediateRenderObject)r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V),d.push(e,null,e.material,n,re.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==oe.render.frame&&(e.skeleton.update(),e.skeleton.frame=oe.render.frame),!e.frustumCulled||ee.intersectsObject(e))){r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V);var i=ue.update(e),a=e.material;if(Array.isArray(a))for(var o=i.groups,s=0,c=o.length;s<c;s++){var l=o[s],u=a[l.materialIndex];u&&u.visible&&d.push(e,i,u,n,re.z,l)}else a.visible&&d.push(e,i,a,n,re.z,null)}}for(var p=e.children,s=0,c=p.length;s<c;s++)Ke(p[s],t,n,r)}}function qe(e,t,n,r){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,c=o.geometry,l=r===void 0?o.material:r,u=o.group;if(n.isArrayCamera){T=n;for(var d=n.cameras,p=0,m=d.length;p<m;p++){var h=d[p];s.layers.test(h.layers)&&(G.viewport(E.copy(h.viewport)),f.setupLights(h),Je(s,t,h,c,l,u))}}else T=null,Je(s,t,n,c,l,u)}}function Je(e,t,n,r,i,a){if(e.onBeforeRender(p,t,n,r,i,a),f=pe.get(t,T||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=Xe(n,t,i,e);G.setMaterial(i),S.geometry=null,S.program=null,S.wireframe=!1,Be(e,o)}else p.renderBufferDirect(n,t,r,i,e,a);e.onAfterRender(p,t,n,r,i,a),f=pe.get(t,T||n)}function Ye(e,t,n){var r=se.get(e),i=f.state.lights,a=f.state.shadowsArray,o=i.state.version,s=q.getParameters(e,i.state,a,t,te.numPlanes,te.numIntersection,n),c=q.getProgramCacheKey(s),l=r.program,u=!0;if(l===void 0)e.addEventListener(`dispose`,Fe);else if(l.cacheKey!==c)ze(e);else if(r.lightsStateVersion!==o)r.lightsStateVersion=o,u=!1;else if(s.shaderID!==void 0)return;else u=!1;u&&(l=q.acquireProgram(s,c),r.program=l,r.uniforms=s.uniforms,r.outputEncoding=s.outputEncoding,e.program=l);var d=l.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var m=0;m<p.maxMorphTargets;m++)d[`morphTarget`+m]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var m=0;m<p.maxMorphNormals;m++)d[`morphNormal`+m]>=0&&e.numSupportedMorphNormals++}var h=r.uniforms;(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(r.numClippingPlanes=te.numPlanes,r.numIntersection=te.numIntersection,h.clippingPlanes=te.uniform),r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.needsLights=Qe(e),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotShadowMatrix.value=i.state.spotShadowMatrix,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);var g=r.program.getUniforms();r.uniformsList=Dt.seqWithValue(g.seq,h)}function Xe(e,t,n,r){K.resetTextureUnits();var i=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=v===null?p.outputEncoding:v.texture.encoding,s=se.get(n),c=f.state.lights;if(ne&&(B||e!==w)){var l=e===w&&n.id===x;te.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,l)}n.version===s.__version?s.program===void 0||n.fog&&s.fog!==i?Ye(n,t,r):s.environment===a?(s.needsLights&&s.lightsStateVersion!==c.state.version||s.numClippingPlanes!==void 0&&(s.numClippingPlanes!==te.numPlanes||s.numIntersection!==te.numIntersection)||s.outputEncoding!==o)&&Ye(n,t,r):Ye(n,t,r):(Ye(n,t,r),s.__version=n.version);var u=!1,d=!1,m=!1,h=s.program,g=h.getUniforms(),_=s.uniforms;if(G.useProgram(h.program)&&(u=!0,d=!0,m=!0),n.id!==x&&(x=n.id,d=!0),u||w!==e){if(g.setValue(U,`projectionMatrix`,e.projectionMatrix),ae.logarithmicDepthBuffer&&g.setValue(U,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),w!==e&&(w=e,d=!0,m=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var y=g.map.cameraPosition;y!==void 0&&y.setValue(U,re.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(U,`isOrthographic`,e.isOrthographicCamera===!0),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&g.setValue(U,`viewMatrix`,e.matrixWorldInverse)}if(n.skinning){g.setOptional(U,r,`bindMatrix`),g.setOptional(U,r,`bindMatrixInverse`);var b=r.skeleton;if(b){var S=b.bones;if(ae.floatVertexTextures){if(b.boneTexture===void 0){var C=Math.sqrt(S.length*4);C=X.ceilPowerOfTwo(C),C=Math.max(C,4);var T=new Float32Array(C*C*4);T.set(b.boneMatrices);var E=new xe(T,C,C,es,Zo);b.boneMatrices=T,b.boneTexture=E,b.boneTextureSize=C}g.setValue(U,`boneTexture`,b.boneTexture,K),g.setValue(U,`boneTextureSize`,b.boneTextureSize)}else g.setOptional(U,b,`boneMatrices`)}}return(d||s.receiveShadow!==r.receiveShadow)&&(s.receiveShadow=r.receiveShadow,g.setValue(U,`receiveShadow`,r.receiveShadow)),d&&(g.setValue(U,`toneMappingExposure`,p.toneMappingExposure),g.setValue(U,`toneMappingWhitePoint`,p.toneMappingWhitePoint),s.needsLights&&Ze(_,m),i&&n.fog&&de.refreshFogUniforms(_,i),de.refreshMaterialUniforms(_,n,a,P,N),_.ltc_1!==void 0&&(_.ltc_1.value=Z.LTC_1),_.ltc_2!==void 0&&(_.ltc_2.value=Z.LTC_2),Dt.upload(U,s.uniformsList,_,K)),n.isShaderMaterial&&n.uniformsNeedUpdate===!0&&(Dt.upload(U,s.uniformsList,_,K),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(U,`center`,r.center),g.setValue(U,`modelViewMatrix`,r.modelViewMatrix),g.setValue(U,`normalMatrix`,r.normalMatrix),g.setValue(U,`modelMatrix`,r.matrixWorld),h}function Ze(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function Qe(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.setFramebuffer=function(e){h!==e&&v===null&&U.bindFramebuffer(36160,e),h=e},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return v},this.setRenderTarget=function(e,t,n){v=e,g=t,_=n,e&&se.get(e).__webglFramebuffer===void 0&&K.setupRenderTarget(e);var r=h,i=!1;if(e){var a=se.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=a[t||0],i=!0):r=e.isWebGLMultisampleRenderTarget?se.get(e).__webglMultisampledFramebuffer:a,E.copy(e.viewport),k.copy(e.scissor),A=e.scissorTest}else E.copy(L).multiplyScalar(P).floor(),k.copy(R).multiplyScalar(P).floor(),A=z;if(y!==r&&(U.bindFramebuffer(36160,r),y=r),G.viewport(E),G.scissor(k),G.setScissorTest(A),i){var o=se.get(e.texture);U.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}var s=se.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(s=s[o]),s){var c=!1;s!==y&&(U.bindFramebuffer(36160,s),c=!0);try{var l=e.texture,u=l.format,d=l.type;if(u!==1023&&_e.convert(u)!==U.getParameter(35739)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(d!==1009&&_e.convert(d)!==U.getParameter(35738)&&!(d===1015&&(ae.isWebGL2||W.get(`OES_texture_float`)||W.get(`WEBGL_color_buffer_float`)))&&!(d===1016&&(ae.isWebGL2?W.get(`EXT_color_buffer_float`):W.get(`EXT_color_buffer_half_float`)))){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}U.checkFramebufferStatus(36160)===36053?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&U.readPixels(t,n,r,i,_e.convert(u),_e.convert(d),a):console.error(`THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.`)}finally{c&&U.bindFramebuffer(36160,y)}}},this.copyFramebufferToTexture=function(e,t,n){n===void 0&&(n=0);var r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r),o=_e.convert(t.format);K.setTexture2D(t,0),U.copyTexImage2D(3553,n,o,e.x,e.y,i,a,0),G.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r){r===void 0&&(r=0);var i=t.image.width,a=t.image.height,o=_e.convert(n.format),s=_e.convert(n.type);K.setTexture2D(n,0),t.isDataTexture?U.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?U.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):U.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),r===0&&n.generateMipmaps&&U.generateMipmap(3553),G.unbindTexture()},this.initTexture=function(e){K.setTexture2D(e,0),G.unbindTexture()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}function Cn(e,t){this.name=``,this.color=new z(e),this.density=t===void 0?25e-5:t}function wn(e,t,n){this.name=``,this.color=new z(e),this.near=t===void 0?1:t,this.far=n===void 0?1e3:n}function Tn(e,t){this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=uc,this.updateRange={offset:0,count:-1},this.version=0}function En(e,t,n,r){this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r===!0}function Dn(e){V.call(this),this.type=`SpriteMaterial`,this.color=new z(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}function On(e){if(j.call(this),this.type=`Sprite`,Ou===void 0){Ou=new q;var t=new Tn(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Ou.setIndex([0,1,2,0,2,3]),Ou.setAttribute(`position`,new En(t,3,0,!1)),Ou.setAttribute(`uv`,new En(t,2,3,!1))}this.geometry=Ou,this.material=e===void 0?new Dn:e,this.center=new b(.5,.5)}function kn(e,t,n,r,i,a){Mu.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?Nu.copy(Mu):(Nu.x=a*Mu.x-i*Mu.y,Nu.y=i*Mu.x+a*Mu.y),e.copy(t),e.x+=Nu.x,e.y+=Nu.y,e.applyMatrix4(Pu)}function An(){j.call(this),this._currentLevel=0,this.type=`LOD`,Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function jn(e,t){e&&e.isGeometry&&console.error(`THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`),de.call(this,e,t),this.type=`SkinnedMesh`,this.bindMode=`attached`,this.bindMatrix=new O,this.bindMatrixInverse=new O}function Mn(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(this.bones.length*16),this.frame=-1,t===void 0)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn(`THREE.Skeleton boneInverses is the wrong length.`),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new O)}}function Nn(){j.call(this),this.type=`Bone`}function Pn(e,t,n){de.call(this,e,t),this.instanceMatrix=new H(new Float32Array(n*16),16),this.count=n,this.frustumCulled=!1}function Fn(e){V.call(this),this.type=`LineBasicMaterial`,this.color=new z(16777215),this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.morphTargets=!1,this.setValues(e)}function In(e,t,n){n===1&&console.error(`THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.`),j.call(this),this.type=`Line`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new Fn:t,this.updateMorphTargets()}function Ln(e,t){In.call(this,e,t),this.type=`LineSegments`}function Rn(e,t){In.call(this,e,t),this.type=`LineLoop`}function zn(e){V.call(this),this.type=`PointsMaterial`,this.color=new z(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}function Bn(e,t){j.call(this),this.type=`Points`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new zn:t,this.updateMorphTargets()}function Vn(e,t,n,r,i,a,o){var s=rd.distanceSqToPoint(e);if(s<n){var c=new D;rd.closestPointToPoint(e,c),c.applyMatrix4(r);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:o})}}function Hn(e,t,n,r,i,a,o,s,c){S.call(this,e,t,n,r,i,a,o,s,c),this.format=o===void 0?$o:o,this.minFilter=a===void 0?Ko:a,this.magFilter=i===void 0?Ko:i,this.generateMipmaps=!1}function Un(e,t,n,r,i,a,o,s,c,l,u,d){S.call(this,null,a,o,s,c,l,r,i,u,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Wn(e,t,n,r,i,a,o,s,c){S.call(this,e,t,n,r,i,a,o,s,c),this.needsUpdate=!0}function Gn(e,t,n,r,i,a,o,s,c,l){if(l=l===void 0?ns:l,l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);n===void 0&&l===1026&&(n=Xo),n===void 0&&l===1027&&(n=Qo),S.call(this,null,r,i,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=o===void 0?Uo:o,this.minFilter=s===void 0?Uo:s,this.flipY=!1,this.generateMipmaps=!1}function Kn(e){q.call(this),this.type=`WireframeGeometry`;var t=[],n,r,i,a,o,s=[0,0],c={},l,u,d,f,p=[`a`,`b`,`c`],m;if(e&&e.isGeometry){var h=e.faces;for(n=0,i=h.length;n<i;n++){var g=h[n];for(r=0;r<3;r++)u=g[p[r]],d=g[p[(r+1)%3]],s[0]=Math.min(u,d),s[1]=Math.max(u,d),f=s[0]+`,`+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]})}for(f in c)l=c[f],m=e.vertices[l.index1],t.push(m.x,m.y,m.z),m=e.vertices[l.index2],t.push(m.x,m.y,m.z)}else if(e&&e.isBufferGeometry){var _,v,y,b,x,S,C,w;if(m=new D,e.index!==null){for(_=e.attributes.position,v=e.index,y=e.groups,y.length===0&&(y=[{start:0,count:v.count,materialIndex:0}]),a=0,o=y.length;a<o;++a)for(b=y[a],x=b.start,S=b.count,n=x,i=x+S;n<i;n+=3)for(r=0;r<3;r++)u=v.getX(n+r),d=v.getX(n+(r+1)%3),s[0]=Math.min(u,d),s[1]=Math.max(u,d),f=s[0]+`,`+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]});for(f in c)l=c[f],m.fromBufferAttribute(_,l.index1),t.push(m.x,m.y,m.z),m.fromBufferAttribute(_,l.index2),t.push(m.x,m.y,m.z)}else for(_=e.attributes.position,n=0,i=_.count/3;n<i;n++)for(r=0;r<3;r++)C=3*n+r,m.fromBufferAttribute(_,C),t.push(m.x,m.y,m.z),w=3*n+(r+1)%3,m.fromBufferAttribute(_,w),t.push(m.x,m.y,m.z)}this.setAttribute(`position`,new K(t,3))}function qn(e,t,n){J.call(this),this.type=`ParametricGeometry`,this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new Jn(e,t,n)),this.mergeVertices()}function Jn(e,t,n){q.call(this),this.type=`ParametricBufferGeometry`,this.parameters={func:e,slices:t,stacks:n};var r=[],i=[],a=[],o=[],s=1e-5,c=new D,l=new D,u=new D,d=new D,f=new D,p,m;e.length<3&&console.error(`THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.`);var h=t+1;for(p=0;p<=n;p++){var g=p/n;for(m=0;m<=t;m++){var _=m/t;e(_,g,l),i.push(l.x,l.y,l.z),_-s>=0?(e(_-s,g,u),d.subVectors(l,u)):(e(_+s,g,u),d.subVectors(u,l)),g-s>=0?(e(_,g-s,u),f.subVectors(l,u)):(e(_,g+s,u),f.subVectors(u,l)),c.crossVectors(d,f).normalize(),a.push(c.x,c.y,c.z),o.push(_,g)}}for(p=0;p<n;p++)for(m=0;m<t;m++){var v=p*h+m,y=p*h+m+1,b=(p+1)*h+m+1,x=(p+1)*h+m;r.push(v,y,x),r.push(y,b,x)}this.setIndex(r),this.setAttribute(`position`,new K(i,3)),this.setAttribute(`normal`,new K(a,3)),this.setAttribute(`uv`,new K(o,2))}function Yn(e,t,n,r){J.call(this),this.type=`PolyhedronGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new Xn(e,t,n,r)),this.mergeVertices()}function Xn(e,t,n,r){q.call(this),this.type=`PolyhedronBufferGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1,r=r||0;var i=[],a=[];o(r),c(n),l(),this.setAttribute(`position`,new K(i,3)),this.setAttribute(`normal`,new K(i.slice(),3)),this.setAttribute(`uv`,new K(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(e){for(var n=new D,r=new D,i=new D,a=0;a<t.length;a+=3)f(t[a+0],n),f(t[a+1],r),f(t[a+2],i),s(n,r,i,e)}function s(e,t,n,r){var i=Math.pow(2,r),a=[],o,s;for(o=0;o<=i;o++){a[o]=[];var c=e.clone().lerp(n,o/i),l=t.clone().lerp(n,o/i),u=i-o;for(s=0;s<=u;s++)s===0&&o===i?a[o][s]=c:a[o][s]=c.clone().lerp(l,s/u)}for(o=0;o<i;o++)for(s=0;s<2*(i-o)-1;s++){var f=Math.floor(s/2);s%2==0?(d(a[o][f+1]),d(a[o+1][f]),d(a[o][f])):(d(a[o][f+1]),d(a[o+1][f+1]),d(a[o+1][f]))}}function c(e){for(var t=new D,n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}function l(){for(var e=new D,t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];var n=h(e)/2/Math.PI+.5,r=g(e)/Math.PI+.5;a.push(n,1-r)}p(),u()}function u(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],r=a[e+4];Math.max(t,n,r)>.9&&Math.min(t,n,r)<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}function d(e){i.push(e.x,e.y,e.z)}function f(t,n){var r=t*3;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function p(){for(var e=new D,t=new D,n=new D,r=new D,o=new b,s=new b,c=new b,l=0,u=0;l<i.length;l+=9,u+=6){e.set(i[l+0],i[l+1],i[l+2]),t.set(i[l+3],i[l+4],i[l+5]),n.set(i[l+6],i[l+7],i[l+8]),o.set(a[u+0],a[u+1]),s.set(a[u+2],a[u+3]),c.set(a[u+4],a[u+5]),r.copy(e).add(t).add(n).divideScalar(3);var d=h(r);m(o,u+0,e,d),m(s,u+2,t,d),m(c,u+4,n,d)}}function m(e,t,n,r){r<0&&e.x===1&&(a[t]=e.x-1),n.x===0&&n.z===0&&(a[t]=r/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function g(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}}function Zn(e,t){J.call(this),this.type=`TetrahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Qn(e,t)),this.mergeVertices()}function Qn(e,t){Xn.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type=`TetrahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function $n(e,t){J.call(this),this.type=`OctahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new er(e,t)),this.mergeVertices()}function er(e,t){Xn.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type=`OctahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function tr(e,t){J.call(this),this.type=`IcosahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new nr(e,t)),this.mergeVertices()}function nr(e,t){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Xn.call(this,r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type=`IcosahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function rr(e,t){J.call(this),this.type=`DodecahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ir(e,t)),this.mergeVertices()}function ir(e,t){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];Xn.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type=`DodecahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function ar(e,t,n,r,i,a){J.call(this),this.type=`TubeGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},a!==void 0&&console.warn(`THREE.TubeGeometry: taper has been removed.`);var o=new or(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function or(e,t,n,r,i){q.call(this),this.type=`TubeBufferGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},t=t||64,n=n||1,r=r||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o=new D,s=new D,c=new b,l=new D,u,d,f=[],p=[],m=[],h=[];g(),this.setIndex(h),this.setAttribute(`position`,new K(f,3)),this.setAttribute(`normal`,new K(p,3)),this.setAttribute(`uv`,new K(m,2));function g(){for(u=0;u<t;u++)_(u);_(i===!1?t:0),y(),v()}function _(i){l=e.getPointAt(i/t,l);var c=a.normals[i],u=a.binormals[i];for(d=0;d<=r;d++){var m=d/r*Math.PI*2,h=Math.sin(m),g=-Math.cos(m);s.x=g*c.x+h*u.x,s.y=g*c.y+h*u.y,s.z=g*c.z+h*u.z,s.normalize(),p.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,f.push(o.x,o.y,o.z)}}function v(){for(d=1;d<=t;d++)for(u=1;u<=r;u++){var e=(r+1)*(d-1)+(u-1),n=(r+1)*d+(u-1),i=(r+1)*d+u,a=(r+1)*(d-1)+u;h.push(e,n,a),h.push(n,i,a)}}function y(){for(u=0;u<=t;u++)for(d=0;d<=r;d++)c.x=u/t,c.y=d/r,m.push(c.x,c.y)}}function sr(e,t,n,r,i,a,o){J.call(this),this.type=`TorusKnotGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},o!==void 0&&console.warn(`THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.`),this.fromBufferGeometry(new cr(e,t,n,r,i,a)),this.mergeVertices()}function cr(e,t,n,r,i,a){q.call(this),this.type=`TorusKnotBufferGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o=[],s=[],c=[],l=[],u,d,f=new D,p=new D,m=new D,h=new D,g=new D,_=new D,v=new D;for(u=0;u<=n;++u){var y=u/n*i*Math.PI*2;for(O(y,i,a,e,m),O(y+.01,i,a,e,h),_.subVectors(h,m),v.addVectors(h,m),g.crossVectors(_,v),v.crossVectors(g,_),g.normalize(),v.normalize(),d=0;d<=r;++d){var b=d/r*Math.PI*2,x=-t*Math.cos(b),S=t*Math.sin(b);f.x=m.x+(x*v.x+S*g.x),f.y=m.y+(x*v.y+S*g.y),f.z=m.z+(x*v.z+S*g.z),s.push(f.x,f.y,f.z),p.subVectors(f,m).normalize(),c.push(p.x,p.y,p.z),l.push(u/n),l.push(d/r)}}for(d=1;d<=n;d++)for(u=1;u<=r;u++){var C=(r+1)*(d-1)+(u-1),w=(r+1)*d+(u-1),T=(r+1)*d+u,E=(r+1)*(d-1)+u;o.push(C,w,E),o.push(w,T,E)}this.setIndex(o),this.setAttribute(`position`,new K(s,3)),this.setAttribute(`normal`,new K(c,3)),this.setAttribute(`uv`,new K(l,2));function O(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}}function lr(e,t,n,r,i){J.call(this),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new ur(e,t,n,r,i)),this.mergeVertices()}function ur(e,t,n,r,i){q.call(this),this.type=`TorusBufferGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||Math.PI*2;var a=[],o=[],s=[],c=[],l=new D,u=new D,d=new D,f,p;for(f=0;f<=n;f++)for(p=0;p<=r;p++){var m=p/r*i,h=f/n*Math.PI*2;u.x=(e+t*Math.cos(h))*Math.cos(m),u.y=(e+t*Math.cos(h))*Math.sin(m),u.z=t*Math.sin(h),o.push(u.x,u.y,u.z),l.x=e*Math.cos(m),l.y=e*Math.sin(m),d.subVectors(u,l).normalize(),s.push(d.x,d.y,d.z),c.push(p/r),c.push(f/n)}for(f=1;f<=n;f++)for(p=1;p<=r;p++){var g=(r+1)*f+p-1,_=(r+1)*(f-1)+p-1,v=(r+1)*(f-1)+p,y=(r+1)*f+p;a.push(g,_,y),a.push(_,v,y)}this.setIndex(a),this.setAttribute(`position`,new K(o,3)),this.setAttribute(`normal`,new K(s,3)),this.setAttribute(`uv`,new K(c,2))}function dr(e,t,n,r,i){var a,o;if(i===Vr(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Rr(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Rr(a,e[a],e[a+1],o);return o&&Ar(o,o.next)&&(zr(o),o=o.next),o}function fr(e,t){if(!e)return e;t||(t=e);var n=e,r;do if(r=!1,!n.steiner&&(Ar(n,n.next)||kr(n.prev,n,n.next)===0)){if(zr(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function pr(e,t,n,r,i,a,o){if(e){!o&&a&&Cr(e,r,i,a);for(var s=e,c,l;e.prev!==e.next;){if(c=e.prev,l=e.next,a?hr(e,r,i,a):mr(e)){t.push(c.i/n),t.push(e.i/n),t.push(l.i/n),zr(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=gr(fr(e),t,n),pr(e,t,n,r,i,a,2)):o===2&&_r(e,t,n,r,i,a):pr(fr(e),t,n,r,i,a,1);break}}}}function mr(e){var t=e.prev,n=e,r=e.next;if(kr(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(Dr(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&kr(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function hr(e,t,n,r){var i=e.prev,a=e,o=e.next;if(kr(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,d=Tr(s,c,t,n,r),f=Tr(l,u,t,n,r),p=e.prevZ,m=e.nextZ;p&&p.z>=d&&m&&m.z<=f;){if(p!==e.prev&&p!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&kr(p.prev,p,p.next)>=0||(p=p.prevZ,m!==e.prev&&m!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&kr(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&kr(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=f;){if(m!==e.prev&&m!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&kr(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function gr(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Ar(i,a)&&jr(i,r,r.next,a)&&Fr(i,a)&&Fr(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),zr(r),zr(r.next),r=e=a),r=r.next}while(r!==e);return fr(r)}function _r(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Or(o,s)){var c=Lr(o,s);o=fr(o,o.next),c=fr(c,c.next),pr(o,t,n,r,i,a),pr(c,t,n,r,i,a);return}s=s.next}o=o.next}while(o!==e)}function vr(e,t,n,r){var i=[],a,o,s,c,l;for(a=0,o=t.length;a<o;a++)s=t[a]*r,c=a<o-1?t[a+1]*r:e.length,l=dr(e,s,c,r,!1),l===l.next&&(l.steiner=!0),i.push(Er(l));for(i.sort(yr),a=0;a<i.length;a++)br(i[a],n),n=fr(n,n.next);return n}function yr(e,t){return e.x-t.x}function br(e,t){if(t=xr(e,t),t){var n=Lr(t,e);fr(t,t.next),fr(n,n.next)}}function xr(e,t){var n=t,r=e.x,i=e.y,a=-1/0,o;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!o)return null;if(r===a)return o;var c=o,l=o.x,u=o.y,d=1/0,f;n=o;do r>=n.x&&n.x>=l&&r!==n.x&&Dr(i<u?r:a,i,l,u,i<u?a:r,i,n.x,n.y)&&(f=Math.abs(i-n.y)/(r-n.x),Fr(n,e)&&(f<d||f===d&&(n.x>o.x||n.x===o.x&&Sr(o,n)))&&(o=n,d=f)),n=n.next;while(n!==c);return o}function Sr(e,t){return kr(e.prev,e,t.prev)<0&&kr(t.next,e,e.next)<0}function Cr(e,t,n,r){var i=e;do i.z===null&&(i.z=Tr(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,wr(i)}function wr(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ,r);t++);for(c=l;s>0||c>0&&r;)s!==0&&(c===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return e}function Tr(e,t,n,r,i){return e=32767*(e-n)*i,t=32767*(t-r)*i,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Er(e){var t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Dr(e,t,n,r,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function Or(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Pr(e,t)&&(Fr(e,t)&&Fr(t,e)&&Ir(e,t)&&(kr(e.prev,e,t.prev)||kr(e,t.prev,t))||Ar(e,t)&&kr(e.prev,e,e.next)>0&&kr(t.prev,t,t.next)>0)}function kr(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ar(e,t){return e.x===t.x&&e.y===t.y}function jr(e,t,n,r){var i=Nr(kr(e,t,n)),a=Nr(kr(e,t,r)),o=Nr(kr(n,r,e)),s=Nr(kr(n,r,t));return!!(i!==a&&o!==s||i===0&&Mr(e,n,t)||a===0&&Mr(e,r,t)||o===0&&Mr(n,e,r)||s===0&&Mr(n,t,r))}function Mr(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Nr(e){return e>0?1:e<0?-1:0}function Pr(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&jr(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Fr(e,t){return kr(e.prev,e,e.next)<0?kr(e,t,e.next)>=0&&kr(e,e.prev,t)>=0:kr(e,t,e.prev)<0||kr(e,e.next,t)<0}function Ir(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Lr(e,t){var n=new Br(e.i,e.x,e.y),r=new Br(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Rr(e,t,n,r){var i=new Br(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function zr(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Br(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Vr(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function Hr(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Ur(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Wr(e,t){J.call(this),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Gr(e,t)),this.mergeVertices()}function Gr(e,t){q.call(this),this.type=`ExtrudeBufferGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,r=[],i=[],a=0,o=e.length;a<o;a++){var s=e[a];c(s)}this.setAttribute(`position`,new K(r,3)),this.setAttribute(`uv`,new K(i,2)),this.computeVertexNormals();function c(e){var a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?100:t.depth,l=t.bevelEnabled===void 0?!0:t.bevelEnabled,u=t.bevelThickness===void 0?6:t.bevelThickness,d=t.bevelSize===void 0?u-2:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?cd:t.UVGenerator;t.amount!==void 0&&(console.warn(`THREE.ExtrudeBufferGeometry: amount has been renamed to depth.`),c=t.amount);var g,_=!1,v,y,x,S;m&&(g=m.getSpacedPoints(s),_=!0,l=!1,v=m.computeFrenetFrames(s,!1),y=new D,x=new D,S=new D),l||(p=0,u=0,d=0,f=0);var C,w,T,E=e.extractPoints(o),O=E.shape,k=E.holes;if(!sd.isClockWise(O))for(O=O.reverse(),w=0,T=k.length;w<T;w++)C=k[w],sd.isClockWise(C)&&(k[w]=C.reverse());var A=sd.triangulateShape(O,k),j=O;for(w=0,T=k.length;w<T;w++)C=k[w],O=O.concat(C);function M(e,t,n){return t||console.error(`THREE.ExtrudeGeometry: vec does not exist`),t.clone().multiplyScalar(n).add(e)}var N,P,F,I,L,R=O.length,z,ee=A.length;function te(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>Number.EPSILON){var f=Math.sqrt(u),p=Math.sqrt(c*c+l*l),m=t.x-s/f,h=t.y+o/f,g=n.x-l/p,_=n.y+c/p,v=((g-m)*l-(_-h)*c)/(o*l-s*c);r=m+o*v-e.x,i=h+s*v-e.y;var y=r*r+i*i;if(y<=2)return new b(r,i);a=Math.sqrt(y/2)}else{var x=!1;o>Number.EPSILON?c>Number.EPSILON&&(x=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(x=!0):Math.sign(s)===Math.sign(l)&&(x=!0),x?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new b(r/a,i/a)}for(var ne=[],B=0,V=j.length,re=V-1,H=B+1;B<V;B++,re++,H++)re===V&&(re=0),H===V&&(H=0),ne[B]=te(j[B],j[re],j[H]);var U=[],ie,W=ne.concat();for(w=0,T=k.length;w<T;w++){for(C=k[w],ie=[],B=0,V=C.length,re=V-1,H=B+1;B<V;B++,re++,H++)re===V&&(re=0),H===V&&(H=0),ie[B]=te(C[B],C[re],C[H]);U.push(ie),W=W.concat(ie)}for(N=0;N<p;N++){for(F=N/p,I=u*Math.cos(F*Math.PI/2),P=d*Math.sin(F*Math.PI/2)+f,B=0,V=j.length;B<V;B++)L=M(j[B],ne[B],P),K(L.x,L.y,-I);for(w=0,T=k.length;w<T;w++)for(C=k[w],ie=U[w],B=0,V=C.length;B<V;B++)L=M(C[B],ie[B],P),K(L.x,L.y,-I)}for(P=d+f,B=0;B<R;B++)L=l?M(O[B],W[B],P):O[B],_?(x.copy(v.normals[0]).multiplyScalar(L.x),y.copy(v.binormals[0]).multiplyScalar(L.y),S.copy(g[0]).add(x).add(y),K(S.x,S.y,S.z)):K(L.x,L.y,0);var ae;for(ae=1;ae<=s;ae++)for(B=0;B<R;B++)L=l?M(O[B],W[B],P):O[B],_?(x.copy(v.normals[ae]).multiplyScalar(L.x),y.copy(v.binormals[ae]).multiplyScalar(L.y),S.copy(g[ae]).add(x).add(y),K(S.x,S.y,S.z)):K(L.x,L.y,c/s*ae);for(N=p-1;N>=0;N--){for(F=N/p,I=u*Math.cos(F*Math.PI/2),P=d*Math.sin(F*Math.PI/2)+f,B=0,V=j.length;B<V;B++)L=M(j[B],ne[B],P),K(L.x,L.y,c+I);for(w=0,T=k.length;w<T;w++)for(C=k[w],ie=U[w],B=0,V=C.length;B<V;B++)L=M(C[B],ie[B],P),_?K(L.x,L.y+g[s-1].y,g[s-1].x+I):K(L.x,L.y,c+I)}G(),oe();function G(){var e=r.length/3;if(l){var t=0,i=R*t;for(B=0;B<ee;B++)z=A[B],ce(z[2]+i,z[1]+i,z[0]+i);for(t=s+p*2,i=R*t,B=0;B<ee;B++)z=A[B],ce(z[0]+i,z[1]+i,z[2]+i)}else{for(B=0;B<ee;B++)z=A[B],ce(z[2],z[1],z[0]);for(B=0;B<ee;B++)z=A[B],ce(z[0]+R*s,z[1]+R*s,z[2]+R*s)}n.addGroup(e,r.length/3-e,0)}function oe(){var e=r.length/3,t=0;for(se(j,t),t+=j.length,w=0,T=k.length;w<T;w++)C=k[w],se(C,t),t+=C.length;n.addGroup(e,r.length/3-e,1)}function se(e,t){var n,r;for(B=e.length;--B>=0;){n=B,r=B-1,r<0&&(r=e.length-1);var i=0,a=s+p*2;for(i=0;i<a;i++){var o=R*i,c=R*(i+1);le(t+n+o,t+r+o,t+r+c,t+n+c)}}}function K(e,t,n){a.push(e),a.push(t),a.push(n)}function ce(e,t,i){ue(e),ue(t),ue(i);var a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);q(o[0]),q(o[1]),q(o[2])}function le(e,t,i,a){ue(e),ue(t),ue(a),ue(t),ue(i),ue(a);var o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);q(s[0]),q(s[1]),q(s[3]),q(s[1]),q(s[2]),q(s[3])}function ue(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function q(e){i.push(e.x),i.push(e.y)}}}function Kr(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function qr(e,t){J.call(this),this.type=`TextGeometry`,this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Jr(e,t)),this.mergeVertices()}function Jr(e,t){t=t||{};var n=t.font;if(!(n&&n.isFont))return console.error(`THREE.TextGeometry: font parameter is not an instance of THREE.Font.`),new J;var r=n.generateShapes(e,t.size);t.depth=t.height===void 0?50:t.height,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),Gr.call(this,r,t),this.type=`TextBufferGeometry`}function Yr(e,t,n,r,i,a,o){J.call(this),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Xr(e,t,n,r,i,a,o)),this.mergeVertices()}function Xr(e,t,n,r,i,a,o){q.call(this),this.type=`SphereBufferGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=r===void 0?0:r,i=i===void 0?Math.PI*2:i,a=a===void 0?0:a,o=o===void 0?Math.PI:o;var s=Math.min(a+o,Math.PI),c,l,u=0,d=[],f=new D,p=new D,m=[],h=[],g=[],_=[];for(l=0;l<=n;l++){var v=[],y=l/n,b=0;for(l==0&&a==0?b=.5/t:l==n&&s==Math.PI&&(b=-.5/t),c=0;c<=t;c++){var x=c/t;f.x=-e*Math.cos(r+x*i)*Math.sin(a+y*o),f.y=e*Math.cos(a+y*o),f.z=e*Math.sin(r+x*i)*Math.sin(a+y*o),h.push(f.x,f.y,f.z),p.copy(f).normalize(),g.push(p.x,p.y,p.z),_.push(x+b,1-y),v.push(u++)}d.push(v)}for(l=0;l<n;l++)for(c=0;c<t;c++){var S=d[l][c+1],C=d[l][c],w=d[l+1][c],T=d[l+1][c+1];(l!==0||a>0)&&m.push(S,C,T),(l!==n-1||s<Math.PI)&&m.push(C,w,T)}this.setIndex(m),this.setAttribute(`position`,new K(h,3)),this.setAttribute(`normal`,new K(g,3)),this.setAttribute(`uv`,new K(_,2))}function Zr(e,t,n,r,i,a){J.call(this),this.type=`RingGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new Qr(e,t,n,r,i,a)),this.mergeVertices()}function Qr(e,t,n,r,i,a){q.call(this),this.type=`RingBufferGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=i===void 0?0:i,a=a===void 0?Math.PI*2:a,n=n===void 0?8:Math.max(3,n),r=r===void 0?1:Math.max(1,r);var o=[],s=[],c=[],l=[],u,d=e,f=(t-e)/r,p=new D,m=new b,h,g;for(h=0;h<=r;h++){for(g=0;g<=n;g++)u=i+g/n*a,p.x=d*Math.cos(u),p.y=d*Math.sin(u),s.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/t+1)/2,m.y=(p.y/t+1)/2,l.push(m.x,m.y);d+=f}for(h=0;h<r;h++){var _=h*(n+1);for(g=0;g<n;g++){u=g+_;var v=u,y=u+n+1,x=u+n+2,S=u+1;o.push(v,y,S),o.push(y,x,S)}}this.setIndex(o),this.setAttribute(`position`,new K(s,3)),this.setAttribute(`normal`,new K(c,3)),this.setAttribute(`uv`,new K(l,2))}function $r(e,t,n,r){J.call(this),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new ei(e,t,n,r)),this.mergeVertices()}function ei(e,t,n,r){q.call(this),this.type=`LatheBufferGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||Math.PI*2,r=X.clamp(r,0,Math.PI*2);var i=[],a=[],o=[],s,c=1/t,l=new D,u=new b,d,f;for(d=0;d<=t;d++){var p=n+d*c*r,m=Math.sin(p),h=Math.cos(p);for(f=0;f<=e.length-1;f++)l.x=e[f].x*m,l.y=e[f].y,l.z=e[f].x*h,a.push(l.x,l.y,l.z),u.x=d/t,u.y=f/(e.length-1),o.push(u.x,u.y)}for(d=0;d<t;d++)for(f=0;f<e.length-1;f++){s=f+d*e.length;var g=s,_=s+e.length,v=s+e.length+1,y=s+1;i.push(g,_,y),i.push(_,v,y)}if(this.setIndex(i),this.setAttribute(`position`,new K(a,3)),this.setAttribute(`uv`,new K(o,2)),this.computeVertexNormals(),r===Math.PI*2){var x=this.attributes.normal.array,S=new D,C=new D,w=new D;for(s=t*e.length*3,d=0,f=0;d<e.length;d++,f+=3)S.x=x[f+0],S.y=x[f+1],S.z=x[f+2],C.x=x[s+f+0],C.y=x[s+f+1],C.z=x[s+f+2],w.addVectors(S,C).normalize(),x[f+0]=x[s+f+0]=w.x,x[f+1]=x[s+f+1]=w.y,x[f+2]=x[s+f+2]=w.z}}function ti(e,t){J.call(this),this.type=`ShapeGeometry`,typeof t==`object`&&(console.warn(`THREE.ShapeGeometry: Options parameter has been removed.`),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new ni(e,t)),this.mergeVertices()}function ni(e,t){q.call(this),this.type=`ShapeBufferGeometry`,this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;this.setIndex(n),this.setAttribute(`position`,new K(r,3)),this.setAttribute(`normal`,new K(i,3)),this.setAttribute(`uv`,new K(a,2));function l(e){var o,c,l,u=r.length/3,d=e.extractPoints(t),f=d.shape,p=d.holes;for(sd.isClockWise(f)===!1&&(f=f.reverse()),o=0,c=p.length;o<c;o++)l=p[o],sd.isClockWise(l)===!0&&(p[o]=l.reverse());var m=sd.triangulateShape(f,p);for(o=0,c=p.length;o<c;o++)l=p[o],f=f.concat(l);for(o=0,c=f.length;o<c;o++){var h=f[o];r.push(h.x,h.y,0),i.push(0,0,1),a.push(h.x,h.y)}for(o=0,c=m.length;o<c;o++){var g=m[o],_=g[0]+u,v=g[1]+u,y=g[2]+u;n.push(_,v,y),s+=3}}}function ri(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function ii(e,t){q.call(this),this.type=`EdgesGeometry`,this.parameters={thresholdAngle:t},t=t===void 0?1:t;var n=[],r=Math.cos(X.DEG2RAD*t),i=[0,0],a={},o,s,c,l=[`a`,`b`,`c`],u;e.isBufferGeometry?(u=new J,u.fromBufferGeometry(e)):u=e.clone(),u.mergeVertices(),u.computeFaceNormals();for(var d=u.vertices,f=u.faces,p=0,m=f.length;p<m;p++)for(var h=f[p],g=0;g<3;g++)o=h[l[g]],s=h[l[(g+1)%3]],i[0]=Math.min(o,s),i[1]=Math.max(o,s),c=i[0]+`,`+i[1],a[c]===void 0?a[c]={index1:i[0],index2:i[1],face1:p,face2:void 0}:a[c].face2=p;for(c in a){var _=a[c];if(_.face2===void 0||f[_.face1].normal.dot(f[_.face2].normal)<=r){var v=d[_.index1];n.push(v.x,v.y,v.z),v=d[_.index2],n.push(v.x,v.y,v.z)}}this.setAttribute(`position`,new K(n,3))}function ai(e,t,n,r,i,a,o,s){J.call(this),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new oi(e,t,n,r,i,a,o,s)),this.mergeVertices()}function oi(e,t,n,r,i,a,o,s){q.call(this),this.type=`CylinderBufferGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=e===void 0?1:e,t=t===void 0?1:t,n=n||1,r=Math.floor(r)||8,i=Math.floor(i)||1,a=a===void 0?!1:a,o=o===void 0?0:o,s=s===void 0?Math.PI*2:s;var l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new K(u,3)),this.setAttribute(`normal`,new K(d,3)),this.setAttribute(`uv`,new K(f,2));function _(){var a,_,v=new D,y=new D,b=0,x=(t-e)/n;for(_=0;_<=i;_++){var S=[],C=_/i,w=C*(t-e)+e;for(a=0;a<=r;a++){var T=a/r,E=T*s+o,O=Math.sin(E),k=Math.cos(E);y.x=w*O,y.y=-C*n+h,y.z=w*k,u.push(y.x,y.y,y.z),v.set(O,x,k).normalize(),d.push(v.x,v.y,v.z),f.push(T,1-C),S.push(p++)}m.push(S)}for(a=0;a<r;a++)for(_=0;_<i;_++){var A=m[_][a],j=m[_+1][a],M=m[_+1][a+1],N=m[_][a+1];l.push(A,j,N),l.push(j,M,N),b+=6}c.addGroup(g,b,0),g+=b}function v(n){var i,a,m,_=new b,v=new D,y=0,x=n===!0?e:t,S=n===!0?1:-1;for(a=p,i=1;i<=r;i++)u.push(0,h*S,0),d.push(0,S,0),f.push(.5,.5),p++;for(m=p,i=0;i<=r;i++){var C=i/r*s+o,w=Math.cos(C),T=Math.sin(C);v.x=x*T,v.y=h*S,v.z=x*w,u.push(v.x,v.y,v.z),d.push(0,S,0),_.x=w*.5+.5,_.y=T*.5*S+.5,f.push(_.x,_.y),p++}for(i=0;i<r;i++){var E=a+i,O=m+i;n===!0?l.push(O,O+1,E):l.push(O+1,O,E),y+=3}c.addGroup(g,y,n===!0?1:2),g+=y}}function si(e,t,n,r,i,a,o){ai.call(this,0,e,t,n,r,i,a,o),this.type=`ConeGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function ci(e,t,n,r,i,a,o){oi.call(this,0,e,t,n,r,i,a,o),this.type=`ConeBufferGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function li(e,t,n,r){J.call(this),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new ui(e,t,n,r)),this.mergeVertices()}function ui(e,t,n,r){q.call(this),this.type=`CircleBufferGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=t===void 0?8:Math.max(3,t),n=n===void 0?0:n,r=r===void 0?Math.PI*2:r;var i=[],a=[],o=[],s=[],c,l,u=new D,d=new b;for(a.push(0,0,0),o.push(0,0,1),s.push(.5,.5),l=0,c=3;l<=t;l++,c+=3){var f=n+l/t*r;u.x=e*Math.cos(f),u.y=e*Math.sin(f),a.push(u.x,u.y,u.z),o.push(0,0,1),d.x=(a[c]/e+1)/2,d.y=(a[c+1]/e+1)/2,s.push(d.x,d.y)}for(c=1;c<=t;c++)i.push(c,c+1,0);this.setIndex(i),this.setAttribute(`position`,new K(a,3)),this.setAttribute(`normal`,new K(o,3)),this.setAttribute(`uv`,new K(s,2))}function di(e){V.call(this),this.type=`ShadowMaterial`,this.color=new z(0),this.transparent=!0,this.setValues(e)}function fi(e){ge.call(this,e),this.type=`RawShaderMaterial`}function pi(e){V.call(this),this.defines={STANDARD:``},this.type=`MeshStandardMaterial`,this.color=new z(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function mi(e){pi.call(this),this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new b(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function hi(e){V.call(this),this.type=`MeshPhongMaterial`,this.color=new z(16777215),this.specular=new z(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function gi(e){V.call(this),this.defines={TOON:``},this.type=`MeshToonMaterial`,this.color=new z(16777215),this.specular=new z(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function _i(e){V.call(this),this.type=`MeshNormalMaterial`,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function vi(e){V.call(this),this.type=`MeshLambertMaterial`,this.color=new z(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function yi(e){V.call(this),this.defines={MATCAP:``},this.type=`MeshMatcapMaterial`,this.color=new z(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function bi(e){Fn.call(this),this.type=`LineDashedMaterial`,this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function xi(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n}function Si(e,t,n,r){xi.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ci(e,t,n,r){xi.call(this,e,t,n,r)}function wi(e,t,n,r){xi.call(this,e,t,n,r)}function Ti(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=dd.convertArray(t,this.TimeBufferType),this.values=dd.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function Ei(e,t,n){Ti.call(this,e,t,n)}function Di(e,t,n,r){Ti.call(this,e,t,n,r)}function Oi(e,t,n,r){Ti.call(this,e,t,n,r)}function ki(e,t,n,r){xi.call(this,e,t,n,r)}function Ai(e,t,n,r){Ti.call(this,e,t,n,r)}function ji(e,t,n,r){Ti.call(this,e,t,n,r)}function Mi(e,t,n,r){Ti.call(this,e,t,n,r)}function Ni(e,t,n,r){this.name=e,this.tracks=n,this.duration=t===void 0?-1:t,this.blendMode=r===void 0?Zs:r,this.uuid=X.generateUUID(),this.duration<0&&this.resetDuration()}function Pi(e){switch(e.toLowerCase()){case`scalar`:case`double`:case`float`:case`number`:case`integer`:return Oi;case`vector`:case`vector2`:case`vector3`:case`vector4`:return Mi;case`color`:return Di;case`quaternion`:return Ai;case`bool`:case`boolean`:return Ei;case`string`:return ji}throw Error(`THREE.KeyframeTrack: Unsupported typeName: `+e)}function Fi(e){if(e.type===void 0)throw Error(`THREE.KeyframeTrack: track type undefined, can not parse`);var t=Pi(e.type);if(e.times===void 0){var n=[],r=[];dd.flattenJSON(e.keys,n,r,`value`),e.times=n,e.values=r}return t.parse===void 0?new t(e.name,e.times,e.values,e.interpolation):t.parse(e)}function Ii(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var r=c[t],i=c[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}}function Li(e){this.manager=e===void 0?pd:e,this.crossOrigin=`anonymous`,this.path=``,this.resourcePath=``,this.requestHeader={}}function Ri(e){Li.call(this,e)}function zi(e){Li.call(this,e)}function Bi(e){Li.call(this,e)}function Vi(e){Li.call(this,e)}function Hi(e){Li.call(this,e)}function Ui(e){Li.call(this,e)}function Wi(e){Li.call(this,e)}function Y(){this.type=`Curve`,this.arcLengthDivisions=200}function Gi(e,t,n,r,i,a,o,s){Y.call(this),this.type=`EllipseCurve`,this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Ki(e,t,n,r,i,a){Gi.call(this,e,t,n,n,r,i,a),this.type=`ArcCurve`}function qi(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){var c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){var a=i*i,o=a*i;return e+t*i+n*a+r*o}}}function Ji(e,t,n,r){Y.call(this),this.type=`CatmullRomCurve3`,this.points=e||[],this.closed=t||!1,this.curveType=n||`centripetal`,this.tension=r||.5}function Yi(e,t,n,r,i){var a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Xi(e,t){var n=1-e;return n*n*t}function Zi(e,t){return 2*(1-e)*e*t}function Qi(e,t){return e*e*t}function $i(e,t,n,r){return Xi(e,t)+Zi(e,n)+Qi(e,r)}function ea(e,t){var n=1-e;return n*n*n*t}function ta(e,t){var n=1-e;return 3*n*n*e*t}function na(e,t){return 3*(1-e)*e*e*t}function ra(e,t){return e*e*e*t}function ia(e,t,n,r,i){return ea(e,t)+ta(e,n)+na(e,r)+ra(e,i)}function aa(e,t,n,r){Y.call(this),this.type=`CubicBezierCurve`,this.v0=e||new b,this.v1=t||new b,this.v2=n||new b,this.v3=r||new b}function oa(e,t,n,r){Y.call(this),this.type=`CubicBezierCurve3`,this.v0=e||new D,this.v1=t||new D,this.v2=n||new D,this.v3=r||new D}function sa(e,t){Y.call(this),this.type=`LineCurve`,this.v1=e||new b,this.v2=t||new b}function ca(e,t){Y.call(this),this.type=`LineCurve3`,this.v1=e||new D,this.v2=t||new D}function la(e,t,n){Y.call(this),this.type=`QuadraticBezierCurve`,this.v0=e||new b,this.v1=t||new b,this.v2=n||new b}function ua(e,t,n){Y.call(this),this.type=`QuadraticBezierCurve3`,this.v0=e||new D,this.v1=t||new D,this.v2=n||new D}function da(e){Y.call(this),this.type=`SplineCurve`,this.points=e||[]}function fa(){Y.call(this),this.type=`CurvePath`,this.curves=[],this.autoClose=!1}function pa(e){fa.call(this),this.type=`Path`,this.currentPoint=new b,e&&this.setFromPoints(e)}function ma(e){pa.call(this,e),this.uuid=X.generateUUID(),this.type=`Shape`,this.holes=[]}function ha(e,t){j.call(this),this.type=`Light`,this.color=new z(e),this.intensity=t===void 0?1:t,this.receiveShadow=void 0}function ga(e,t,n){ha.call(this,e,n),this.type=`HemisphereLight`,this.castShadow=void 0,this.position.copy(j.DefaultUp),this.updateMatrix(),this.groundColor=new z(t)}function _a(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new b(512,512),this.map=null,this.mapPass=null,this.matrix=new O,this._frustum=new Se,this._frameExtents=new b(1,1),this._viewportCount=1,this._viewports=[new C(0,0,1,1)]}function va(){_a.call(this,new ve(50,1,.5,500))}function ya(e,t,n,r,i,a){ha.call(this,e,t),this.type=`SpotLight`,this.position.copy(j.DefaultUp),this.updateMatrix(),this.target=new j,Object.defineProperty(this,`power`,{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=n===void 0?0:n,this.angle=r===void 0?Math.PI/3:r,this.penumbra=i===void 0?0:i,this.decay=a===void 0?1:a,this.shadow=new va}function ba(){_a.call(this,new ve(90,1,.5,500)),this._frameExtents=new b(4,2),this._viewportCount=6,this._viewports=[new C(2,1,1,1),new C(0,1,1,1),new C(3,1,1,1),new C(1,1,1,1),new C(3,0,1,1),new C(1,0,1,1)],this._cubeDirections=[new D(1,0,0),new D(-1,0,0),new D(0,0,1),new D(0,0,-1),new D(0,1,0),new D(0,-1,0)],this._cubeUps=[new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,0,1),new D(0,0,-1)]}function xa(e,t,n,r){ha.call(this,e,t),this.type=`PointLight`,Object.defineProperty(this,`power`,{get:function(){return this.intensity*4*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=n===void 0?0:n,this.decay=r===void 0?1:r,this.shadow=new ba}function Sa(e,t,n,r,i,a){_e.call(this),this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e===void 0?-1:e,this.right=t===void 0?1:t,this.top=n===void 0?1:n,this.bottom=r===void 0?-1:r,this.near=i===void 0?.1:i,this.far=a===void 0?2e3:a,this.updateProjectionMatrix()}function Ca(){_a.call(this,new Sa(-5,5,5,-5,.5,500))}function wa(e,t){ha.call(this,e,t),this.type=`DirectionalLight`,this.position.copy(j.DefaultUp),this.updateMatrix(),this.target=new j,this.shadow=new Ca}function Ta(e,t){ha.call(this,e,t),this.type=`AmbientLight`,this.castShadow=void 0}function Ea(e,t,n,r){ha.call(this,e,t),this.type=`RectAreaLight`,this.width=n===void 0?10:n,this.height=r===void 0?10:r}function Da(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new D)}function Oa(e,t){ha.call(this,void 0,t),this.type=`LightProbe`,this.sh=e===void 0?new Da:e}function ka(e){Li.call(this,e),this.textures={}}function Aa(){q.call(this),this.type=`InstancedBufferGeometry`,this.instanceCount=1/0}function ja(e,t,n,r){typeof n==`number`&&(r=n,n=!1,console.error(`THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.`)),H.call(this,e,t,n),this.meshPerAttribute=r||1}function Ma(e){Li.call(this,e)}function Na(e){Li.call(this,e)}function Pa(e){typeof createImageBitmap>`u`&&console.warn(`THREE.ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&console.warn(`THREE.ImageBitmapLoader: fetch() not supported.`),Li.call(this,e),this.options=void 0}function Fa(){this.type=`ShapePath`,this.color=new z,this.subPaths=[],this.currentPath=null}function Ia(e){this.type=`Font`,this.data=e}function La(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(``),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l<r.length;l++){var u=r[l];if(u===`\n`)s=0,c-=a;else{var d=Ra(u,i,s,c,n);s+=d.offsetX,o.push(d.path)}}return o}function Ra(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs[`?`];if(!a){console.error(`THREE.Font: character "`+e+`" does not exists in font family `+i.familyName+`.`);return}var o=new Fa,s,c,l,u,d,f,p,m;if(a.o)for(var h=a._cachedOutline||(a._cachedOutline=a.o.split(` `)),g=0,_=h.length;g<_;)switch(h[g++]){case`m`:s=h[g++]*t+n,c=h[g++]*t+r,o.moveTo(s,c);break;case`l`:s=h[g++]*t+n,c=h[g++]*t+r,o.lineTo(s,c);break;case`q`:l=h[g++]*t+n,u=h[g++]*t+r,d=h[g++]*t+n,f=h[g++]*t+r,o.quadraticCurveTo(d,f,l,u);break;case`b`:l=h[g++]*t+n,u=h[g++]*t+r,d=h[g++]*t+n,f=h[g++]*t+r,p=h[g++]*t+n,m=h[g++]*t+r,o.bezierCurveTo(d,f,p,m,l,u);break}return{offsetX:a.ha*t,path:o}}function za(e){Li.call(this,e)}function Ba(e){Li.call(this,e)}function Va(e,t,n){Oa.call(this,void 0,n);var r=new z().set(e),i=new z().set(t),a=new D(r.r,r.g,r.b),o=new D(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function Ha(e,t){Oa.call(this,void 0,t);var n=new z().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Ua(){this.type=`StereoCamera`,this.aspect=1,this.eyeSep=.064,this.cameraL=new ve,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ve,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function Wa(e){this.autoStart=e===void 0?!0:e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Ga(){j.call(this),this.type=`AudioListener`,this.context=Ed.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Wa}function Ka(e){j.call(this),this.type=`Audio`,this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType=`empty`,this._startedAt=0,this._progress=0,this.filters=[]}function qa(e){Ka.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel=`HRTF`,this.panner.connect(this.gain)}function Ja(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t===void 0?2048:t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Ya(e,t,n){this.binding=e,this.valueSize=n;var r,i,a;switch(t){case`quaternion`:r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case`string`:case`bool`:r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(n*5);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}function Xa(e,t,n){var r=n||Za.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function Za(e,t,n){this.path=t,this.parsedPath=n||Za.parseTrackName(t),this.node=Za.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Qa(){this.uuid=X.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function $a(e,t,n,r){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=r||t.blendMode;for(var i=t.tracks,a=i.length,o=Array(a),s={endingStart:Js,endingEnd:Js},c=0;c!==a;++c){var l=i[c].createInterpolant(null);o[c]=l,l.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Us,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function eo(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function to(e){typeof e==`string`&&(console.warn(`THREE.Uniform: Type parameter is no longer needed.`),e=arguments[1]),this.value=e}function no(e,t,n){Tn.call(this,e,t),this.meshPerAttribute=n||1}function ro(e,t,n,r){this.ray=new I(e,t),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new A,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn(`THREE.Raycaster: params.PointCloud has been renamed to params.Points.`),this.Points}}})}function io(e,t){return e.distance-t.distance}function ao(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),r===!0)for(var i=e.children,a=0,o=i.length;a<o;a++)ao(i[a],t,n,!0)}function oo(e,t,n){return this.radius=e===void 0?1:e,this.phi=t===void 0?0:t,this.theta=n===void 0?0:n,this}function so(e,t,n){return this.radius=e===void 0?1:e,this.theta=t===void 0?0:t,this.y=n===void 0?0:n,this}function co(e,t){this.min=e===void 0?new b(1/0,1/0):e,this.max=t===void 0?new b(-1/0,-1/0):t}function lo(e,t){this.start=e===void 0?new D:e,this.end=t===void 0?new D:t}function uo(e){j.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}function fo(e,t){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new q,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,a=1,o=32;i<o;i++,a++){var s=i/o*Math.PI*2,c=a/o*Math.PI*2;r.push(Math.cos(s),Math.sin(s),1,Math.cos(c),Math.sin(c),1)}n.setAttribute(`position`,new K(r,3));var l=new Fn({fog:!1,toneMapped:!1});this.cone=new Ln(n,l),this.add(this.cone),this.update()}function po(e){var t=[];e&&e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,po(e.children[n]));return t}function mo(e){for(var t=po(e),n=new q,r=[],i=[],a=new z(0,0,1),o=new z(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.setAttribute(`position`,new K(r,3)),n.setAttribute(`color`,new K(i,3));var l=new Fn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Ln.call(this,n,l),this.type=`SkeletonHelper`,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function ho(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new Xr(t,4,2),i=new re({wireframe:!0,fog:!1,toneMapped:!1});de.call(this,r,i),this.type=`PointLightHelper`,this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function go(e,t,n){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new er(t);r.rotateY(Math.PI*.5),this.material=new re({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);var i=r.getAttribute(`position`),a=new Float32Array(i.count*3);r.setAttribute(`color`,new H(a,3)),this.add(new de(r,this.material)),this.update()}function _o(e,t,n,r){e=e||10,t=t||10,n=new z(n===void 0?4473924:n),r=new z(r===void 0?8947848:r);for(var i=t/2,a=e/t,o=e/2,s=[],c=[],l=0,u=0,d=-o;l<=t;l++,d+=a){s.push(-o,0,d,o,0,d),s.push(d,0,-o,d,0,o);var f=l===i?n:r;f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3}var p=new q;p.setAttribute(`position`,new K(s,3)),p.setAttribute(`color`,new K(c,3));var m=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,p,m),this.type=`GridHelper`}function vo(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new z(i===void 0?4473924:i),a=new z(a===void 0?8947848:a);var o=[],s=[],c,l,u,d,f,p,m;for(d=0;d<=t;d++)u=d/t*(Math.PI*2),c=Math.sin(u)*e,l=Math.cos(u)*e,o.push(0,0,0),o.push(c,0,l),m=d&1?i:a,s.push(m.r,m.g,m.b),s.push(m.r,m.g,m.b);for(d=0;d<=n;d++)for(m=d&1?i:a,p=e-e/n*d,f=0;f<r;f++)u=f/r*(Math.PI*2),c=Math.sin(u)*p,l=Math.cos(u)*p,o.push(c,0,l),s.push(m.r,m.g,m.b),u=(f+1)/r*(Math.PI*2),c=Math.sin(u)*p,l=Math.cos(u)*p,o.push(c,0,l),s.push(m.r,m.g,m.b);var h=new q;h.setAttribute(`position`,new K(o,3)),h.setAttribute(`color`,new K(s,3));var g=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,h,g),this.type=`PolarGridHelper`}function yo(e,t,n){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);var r=new q;r.setAttribute(`position`,new K([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new Fn({fog:!1,toneMapped:!1});this.lightPlane=new In(r,i),this.add(this.lightPlane),r=new q,r.setAttribute(`position`,new K([0,0,0,0,0,1],3)),this.targetLine=new In(r,i),this.add(this.targetLine),this.update()}function bo(e){var t=new q,n=new Fn({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],a={},o=new z(16755200),s=new z(16711680),c=new z(43775),l=new z(16777215),u=new z(3355443);d(`n1`,`n2`,o),d(`n2`,`n4`,o),d(`n4`,`n3`,o),d(`n3`,`n1`,o),d(`f1`,`f2`,o),d(`f2`,`f4`,o),d(`f4`,`f3`,o),d(`f3`,`f1`,o),d(`n1`,`f1`,o),d(`n2`,`f2`,o),d(`n3`,`f3`,o),d(`n4`,`f4`,o),d(`p`,`n1`,s),d(`p`,`n2`,s),d(`p`,`n3`,s),d(`p`,`n4`,s),d(`u1`,`u2`,c),d(`u2`,`u3`,c),d(`u3`,`u1`,c),d(`c`,`t`,l),d(`p`,`c`,u),d(`cn1`,`cn2`,u),d(`cn3`,`cn4`,u),d(`cf1`,`cf2`,u),d(`cf3`,`cf4`,u);function d(e,t,n){f(e,n),f(t,n)}function f(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),a[e]===void 0&&(a[e]=[]),a[e].push(r.length/3-1)}t.setAttribute(`position`,new K(r,3)),t.setAttribute(`color`,new K(i,3)),Ln.call(this,t,n),this.type=`CameraHelper`,this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function xo(e,t,n,r,i,a,o){sf.set(i,a,o).unproject(r);var s=t[e];if(s!==void 0)for(var c=n.getAttribute(`position`),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],sf.x,sf.y,sf.z)}function So(e,t){this.object=e,t===void 0&&(t=16776960);var n=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]),r=new Float32Array(24),i=new q;i.setIndex(new H(n,1)),i.setAttribute(`position`,new H(r,3)),Ln.call(this,i,new Fn({color:t,toneMapped:!1})),this.type=`BoxHelper`,this.matrixAutoUpdate=!1,this.update()}function Co(e,t){this.type=`Box3Helper`,this.box=e,t=t||16776960;var n=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]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],i=new q;i.setIndex(new H(n,1)),i.setAttribute(`position`,new K(r,3)),Ln.call(this,i,new Fn({color:t,toneMapped:!1})),this.type=`Box3Helper`,this.geometry.computeBoundingSphere()}function wo(e,t,n){this.plane=e,this.size=t===void 0?1:t;var r=n===void 0?16776960:n,i=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],a=new q;a.setAttribute(`position`,new K(i,3)),a.computeBoundingSphere(),In.call(this,a,new Fn({color:r,toneMapped:!1})),this.type=`PlaneHelper`;var o=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],s=new q;s.setAttribute(`position`,new K(o,3)),s.computeBoundingSphere(),this.add(new de(s,new re({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}function To(e,t,n,r,i,a){j.call(this),this.type=`ArrowHelper`,e===void 0&&(e=new D(0,0,1)),t===void 0&&(t=new D(0,0,0)),n===void 0&&(n=1),r===void 0&&(r=16776960),i===void 0&&(i=.2*n),a===void 0&&(a=.2*i),df===void 0&&(df=new q,df.setAttribute(`position`,new K([0,0,0,0,1,0],3)),ff=new oi(0,.5,1,5,1),ff.translate(0,-.5,0)),this.position.copy(t),this.line=new In(df,new Fn({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new de(ff,new re({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}function Eo(e){e=e||1;var t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new q;r.setAttribute(`position`,new K(t,3)),r.setAttribute(`color`,new K(n,3));var i=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,r,i),this.type=`AxesHelper`}function Do(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=Mo(vf),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}function Oo(e){return e===void 0||e.type!==1009?!1:e.encoding===3e3||e.encoding===3001||e.encoding===3007}function ko(){for(var e=[],t=[],n=[],r=mf,i=0;i<_f;i++){var a=Math.pow(2,r);t.push(a);var o=1/a;i>mf-pf?o=gf[i-mf+pf-1]:i==0&&(o=0),n.push(o);for(var s=1/(a-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],d=6,f=6,p=3,m=2,h=1,g=new Float32Array(p*f*d),_=new Float32Array(m*f*d),v=new Float32Array(h*f*d),y=0;y<d;y++){var b=y%3*2/3-1,x=y>2?0:-1,S=[b,x,0,b+2/3,x,0,b+2/3,x+1,0,b,x,0,b+2/3,x+1,0,b,x+1,0];g.set(S,p*f*y),_.set(u,m*f*y);var C=[y,y,y,y,y,y];v.set(C,h*f*y)}var w=new q;w.setAttribute(`position`,new H(g,p)),w.setAttribute(`uv`,new H(_,m)),w.setAttribute(`faceIndex`,new H(v,h)),e.push(w),r>pf&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function Ao(e){var t=new w(3*hf,3*hf,e);return t.texture.mapping=306,t.texture.name=`PMREM.cubeUv`,t.scissorTest=!0,t}function jo(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Mo(e){var t=new Float32Array(e),n=new D(0,1,0),r=new fi({defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${Io()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvec3 getSample(float theta, vec3 axis) {\n float cosTheta = cos(theta);\n // Rodrigues\' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross(axis, vOutputDirection) * sin(theta)\n + axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n return bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n vec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n if (all(equal(axis, vec3(0.0))))\n axis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n axis = normalize(axis);\n gl_FragColor = vec4(0.0);\n gl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n for (int i = 1; i < n; i++) {\n if (i >= samples)\n break;\n float theta = dTheta * float(i);\n gl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n gl_FragColor.rgb += weights[i] * getSample(theta, axis);\n }\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return r.type=`SphericalGaussianBlur`,r}function No(){var e=new fi({uniforms:{envMap:{value:null},texelSize:{value:new b(1,1)},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${Io()}\n\n#include <common>\n\nvoid main() {\n gl_FragColor = vec4(0.0);\n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv( outputDirection );\n vec2 f = fract(uv / texelSize - 0.5);\n uv -= f * texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize.x;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize.y;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize.x;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n gl_FragColor.rgb = mix(tm, bm, f.y);\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return e.type=`EquirectangularToCubeUV`,e}function Po(){var e=new fi({uniforms:{envMap:{value:null},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${Io()}\n\nvoid main() {\n gl_FragColor = vec4(0.0);\n gl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return e.type=`CubemapToCubeUV`,e}function Fo(){return`\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection(vec2 uv, float face) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3(uv, 1.0);\n if (face == 0.0) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if (face == 1.0) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if (face == 2.0) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if (face == 3.0) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if (face == 4.0) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if (face == 5.0) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = getDirection(uv, faceIndex);\n gl_Position = vec4( position, 1.0 );\n}\n `}function Io(){return`\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n if(inputEncoding == 0){\n return value;\n }else if(inputEncoding == 1){\n return sRGBToLinear(value);\n }else if(inputEncoding == 2){\n return RGBEToLinear(value);\n }else if(inputEncoding == 3){\n return RGBMToLinear(value, 7.0);\n }else if(inputEncoding == 4){\n return RGBMToLinear(value, 16.0);\n }else if(inputEncoding == 5){\n return RGBDToLinear(value, 256.0);\n }else{\n return GammaToLinear(value, 2.2);\n }\n}\n\nvec4 linearToOutputTexel(vec4 value){\n if(outputEncoding == 0){\n return value;\n }else if(outputEncoding == 1){\n return LinearTosRGB(value);\n }else if(outputEncoding == 2){\n return LinearToRGBE(value);\n }else if(outputEncoding == 3){\n return LinearToRGBM(value, 7.0);\n }else if(outputEncoding == 4){\n return LinearToRGBM(value, 16.0);\n }else if(outputEncoding == 5){\n return LinearToRGBD(value, 256.0);\n }else{\n return LinearToGamma(value, 2.2);\n }\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n return inputTexelToLinear(color);\n}\n `}function Lo(e){console.warn(`THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`,this.closed=!0}function Ro(e){console.warn(`THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`}function zo(e){console.warn(`THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`}var Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,fc,pc,X,mc,hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc,$c,el,tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,ml,hl,gl,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,Z,Q,lu,uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu,Fu,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu,Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed,Dd,Od,kd,Ad,jd,Md,Nd,Pd,Fd,Id,Ld,Rd,zd,Bd,Vd,Hd,Ud,Wd,Gd,Kd,qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf,rf,af,of,sf,cf,lf,uf,df,ff,pf,mf,hf,gf,_f,vf,yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of=e((()=>{for(Number.EPSILON===void 0&&(Number.EPSILON=Math.pow(2,-52)),Number.isInteger===void 0&&(Number.isInteger=function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e}),Math.sign===void 0&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),(`name`in Function.prototype)||Object.defineProperty(Function.prototype,`name`,{get:function(){return this.toString().match(/^\\s*function\\s*([^\\(\\s]*)/)[1]}}),Object.assign===void 0&&(Object.assign=function(e){if(e==null)throw TypeError(`Cannot convert undefined or null to object`);let t=Object(e);for(let e=1;e<arguments.length;e++){let n=arguments[e];if(n!=null)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t}),Bo=1e3,Vo=1001,Ho=1002,Uo=1003,Wo=1004,Go=1005,Ko=1006,qo=1007,Jo=1008,Yo=1009,Xo=1012,Zo=1015,Qo=1020,$o=1022,es=1023,ts=es,ns=1026,rs=33776,is=33777,as=33778,os=33779,ss=35840,cs=35841,ls=35842,us=35843,ds=36196,fs=37492,ps=37496,ms=37808,hs=37809,gs=37810,_s=37811,vs=37812,ys=37813,bs=37814,xs=37815,Ss=37816,Cs=37817,ws=37818,Ts=37819,Es=37820,Ds=37821,Os=36492,ks=37840,As=37841,js=37842,Ms=37843,Ns=37844,Ps=37845,Fs=37846,Is=37847,Ls=37848,Rs=37849,zs=37850,Bs=37851,Vs=37852,Hs=37853,Us=2201,Ws=2202,Gs=2300,Ks=2301,qs=2302,Js=2400,Ys=2401,Xs=2402,Zs=2500,Qs=2501,$s=3e3,ec=3001,tc=3007,nc=3002,rc=3003,ic=3004,ac=3005,oc=3006,sc=3200,cc=3201,lc=7680,uc=35044,dc=35048,Object.assign(y.prototype,{addEventListener:function(e,t){this._listeners===void 0&&(this._listeners={});var n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)},hasEventListener:function(e,t){if(this._listeners===void 0)return!1;var n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1},removeEventListener:function(e,t){if(this._listeners!==void 0){var n=this._listeners[e];if(n!==void 0){var r=n.indexOf(t);r!==-1&&n.splice(r,1)}}},dispatchEvent:function(e){if(this._listeners!==void 0){var t=this._listeners[e.type];if(t!==void 0){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e)}}}}),fc=[],pc=0;pc<256;pc++)fc[pc]=(pc<16?`0`:``)+pc.toString(16);X={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(fc[e&255]+fc[e>>8&255]+fc[e>>16&255]+fc[e>>24&255]+`-`+fc[t&255]+fc[t>>8&255]+`-`+fc[t>>16&15|64]+fc[t>>24&255]+`-`+fc[n&63|128]+fc[n>>8&255]+`-`+fc[n>>16&255]+fc[n>>24&255]+fc[r&255]+fc[r>>8&255]+fc[r>>16&255]+fc[r>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*X.DEG2RAD},radToDeg:function(e){return e*X.RAD2DEG},isPowerOfTwo:function(e){return(e&e-1)==0&&e!==0},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:console.warn(`THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}},Object.defineProperties(b.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(b.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this):(console.warn(`THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this):(console.warn(`THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector2: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(x.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return new this.constructor().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s},getInverse:function(e,t){t!==void 0&&console.warn(`THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.`);var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],d=n[7],f=n[8],p=f*c-l*d,m=l*u-f*s,h=d*s-c*u,g=i*p+a*m+o*h;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);var _=1/g;return r[0]=p*_,r[1]=(o*d-f*a)*_,r[2]=(l*a-o*c)*_,r[3]=m*_,r[4]=(f*i-o*u)*_,r[5]=(o*s-l*i)*_,r[6]=h*_,r[7]=(a*u-d*i)*_,r[8]=(c*i-a*s)*_,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*c,r[6]=t*o+n*l,r[1]=-n*i+t*s,r[4]=-n*a+t*c,r[7]=-n*o+t*l,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}}),hc={getDataURL:function(e){var t;if(typeof HTMLCanvasElement>`u`)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{mc===void 0&&(mc=document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`)),mc.width=e.width,mc.height=e.height;var n=mc.getContext(`2d`);e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=mc}return t.width>2048||t.height>2048?t.toDataURL(`image/jpeg`,.6):t.toDataURL(`image/png`)}},gc=0,S.DEFAULT_IMAGE=void 0,S.DEFAULT_MAPPING=300,S.prototype=Object.assign(Object.create(y.prototype),{constructor:S,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];var n={metadata:{version:4.5,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){var r=this.image;if(r.uuid===void 0&&(r.uuid=X.generateUUID()),!t&&e.images[r.uuid]===void 0){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(hc.getDataURL(r[a]))}else i=hc.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:`dispose`})},transformUv:function(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Bo:e.x-=Math.floor(e.x);break;case Vo:e.x=e.x<0?0:1;break;case Ho:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Bo:e.y-=Math.floor(e.y);break;case Vo:e.y=e.y<0?0:1;break;case Ho:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(S.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.defineProperties(C.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(C.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this):(console.warn(`THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this):(console.warn(`THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var _=(c+1)/2,v=(f+1)/2,y=(g+1)/2,b=(l+d)/4,x=(u+m)/4,S=(p+h)/4;return _>v&&_>y?_<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(_),r=b/n,i=x/n):v>y?v<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),n=b/r,i=S/r):y<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(y),n=x/i,r=S/i),this.set(n,r,i,t),this}var C=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(C)<.001&&(C=1),this.x=(h-p)/C,this.y=(u-m)/C,this.z=(d-l)/C,this.w=Math.acos((c+f+g-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector4: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),w.prototype=Object.assign(Object.create(y.prototype),{constructor:w,isWebGLRenderTarget:!0,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),T.prototype=Object.assign(Object.create(w.prototype),{constructor:T,isWebGLMultisampleRenderTarget:!0,copy:function(e){return w.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(E,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){var h=1-o,g=s*d+c*f+l*p+u*m,_=g>=0?1:-1,v=1-g*g;if(v>Number.EPSILON){var y=Math.sqrt(v),b=Math.atan2(y,g*_);h=Math.sin(h*b)/y,o=Math.sin(o*b)/y}var x=o*_;if(s=s*h+d*x,c=c*h+f*x,l=l*h+p*x,u=u*h+m*x,h===1-o){var S=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=S,c*=S,l*=S,u*=S}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u},multiplyQuaternionsFlat:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}}),Object.defineProperties(E.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(E.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!(e&&e.isEuler))throw Error(`THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.`);var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t!==!1&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u,f;return d>0?(f=.5/Math.sqrt(d+1),this._w=.25/f,this._x=(l-s)*f,this._y=(i-c)*f,this._z=(a-r)*f):n>o&&n>u?(f=2*Math.sqrt(1+n-o-u),this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+c)/f):o>u?(f=2*Math.sqrt(1+o-n-u),this._w=(i-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+l)/f):(f=2*Math.sqrt(1+u-n-o),this._w=(a-r)/f,this._x=(i+c)/f,this._y=(s+l)/f,this._z=.25*f),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=1e-6,r=e.dot(t)+1;return r<n?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(X.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(n===0)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this},multiply:function(e,t){return t===void 0?this.multiplyQuaternions(this,e):(console.warn(`THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.`),this.multiplyQuaternions(e,t))},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this},slerp:function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*r+t*this._y,this._z=c*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),d=Math.sin((1-t)*u)/l,f=Math.sin(t*u)/l;return this._w=a*d+this._w*f,this._x=n*d+this._x*f,this._y=r*d+this._y*f,this._z=i*d+this._z*f,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return t===void 0&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),_c=new D,vc=new E,Object.assign(D.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this):(console.warn(`THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this):(console.warn(`THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return t===void 0?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this):(console.warn(`THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.`),this.multiplyVectors(e,t))},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error(`THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.`),this.applyQuaternion(vc.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(vc.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*n,l=s*n+o*t-i*r,u=s*r+i*n-a*t,d=-i*t-a*n-o*r;return this.x=c*s+d*-i+l*-o-u*-a,this.y=l*s+d*-a+u*-i-c*-o,this.z=u*s+d*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},cross:function(e,t){return t===void 0?this.crossVectors(this,e):(console.warn(`THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.`),this.crossVectors(e,t))},crossVectors:function(e,t){var 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},projectOnVector:function(e){var t=e.lengthSq();if(t===0)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return _c.copy(this).projectOnVector(e),this.sub(_c)},reflect:function(e){return this.sub(_c.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(X.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,t*4)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,t*3)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector3: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}),yc=new D,bc=new O,xc=new D(0,0,0),Sc=new D(1,1,1),Cc=new D,wc=new D,Tc=new D,Object.assign(O.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return new O().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,r=1/yc.setFromMatrixColumn(e,0).length(),i=1/yc.setFromMatrixColumn(e,1).length(),a=1/yc.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error(`THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.`);var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){var d=a*l,f=a*u,p=o*l,m=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=f+p*c,t[5]=d-m*c,t[9]=-o*s,t[2]=m-d*c,t[6]=p+f*c,t[10]=a*s}else if(e.order===`YXZ`){var h=s*l,g=s*u,_=c*l,v=c*u;t[0]=h+v*o,t[4]=_*o-g,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=g*o-_,t[6]=v+h*o,t[10]=a*s}else if(e.order===`ZXY`){var h=s*l,g=s*u,_=c*l,v=c*u;t[0]=h-v*o,t[4]=-a*u,t[8]=_+g*o,t[1]=g+_*o,t[5]=a*l,t[9]=v-h*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){var d=a*l,f=a*u,p=o*l,m=o*u;t[0]=s*l,t[4]=p*c-f,t[8]=d*c+m,t[1]=s*u,t[5]=m*c+d,t[9]=f*c-p,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){var y=a*s,b=a*c,x=o*s,S=o*c;t[0]=s*l,t[4]=S-y*u,t[8]=x*u+b,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*u+x,t[10]=y-S*u}else if(e.order===`XZY`){var y=a*s,b=a*c,x=o*s,S=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=y*u+S,t[5]=a*l,t[9]=b*u-x,t[2]=x*u-b,t[6]=o*l,t[10]=S*u+y}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(xc,e,Sc)},lookAt:function(e,t,n){var r=this.elements;return Tc.subVectors(e,t),Tc.lengthSq()===0&&(Tc.z=1),Tc.normalize(),Cc.crossVectors(n,Tc),Cc.lengthSq()===0&&(Math.abs(n.z)===1?Tc.x+=1e-4:Tc.z+=1e-4,Tc.normalize(),Cc.crossVectors(n,Tc)),Cc.normalize(),wc.crossVectors(Tc,Cc),r[0]=Cc.x,r[4]=wc.x,r[8]=Tc.x,r[1]=Cc.y,r[5]=wc.y,r[9]=Tc.y,r[2]=Cc.z,r[6]=wc.z,r[10]=Tc.z,this},multiply:function(e,t){return t===void 0?this.multiplyMatrices(this,e):(console.warn(`THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.`),this.multiplyMatrices(e,t))},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)},transpose:function(){var e=this.elements,t=e[1];return e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this},getInverse:function(e,t){t!==void 0&&console.warn(`THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.`);var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15],b=p*v*d-_*m*d+_*u*h-l*v*h-p*u*y+l*m*y,x=g*m*d-f*v*d-g*u*h+c*v*h+f*u*y-c*m*y,S=f*_*d-g*p*d+g*l*h-c*_*h-f*l*y+c*p*y,C=g*p*u-f*_*u-g*l*m+c*_*m+f*l*v-c*p*v,w=i*b+a*x+o*S+s*C;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/w;return n[0]=b*T,n[1]=(_*m*s-p*v*s-_*o*h+a*v*h+p*o*y-a*m*y)*T,n[2]=(l*v*s-_*u*s+_*o*d-a*v*d-l*o*y+a*u*y)*T,n[3]=(p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h)*T,n[4]=x*T,n[5]=(f*v*s-g*m*s+g*o*h-i*v*h-f*o*y+i*m*y)*T,n[6]=(g*u*s-c*v*s-g*o*d+i*v*d+c*o*y-i*u*y)*T,n[7]=(c*m*s-f*u*s+f*o*d-i*m*d-c*o*h+i*u*h)*T,n[8]=S*T,n[9]=(g*p*s-f*_*s-g*a*h+i*_*h+f*a*y-i*p*y)*T,n[10]=(c*_*s-g*l*s+g*a*d-i*_*d-c*a*y+i*l*y)*T,n[11]=(f*l*s-c*p*s-f*a*d+i*p*d+c*a*h-i*l*h)*T,n[12]=C*T,n[13]=(f*_*o-g*p*o+g*a*m-i*_*m-f*a*v+i*p*v)*T,n[14]=(g*l*o-c*_*o-g*a*u+i*_*u+c*a*v-i*l*v)*T,n[15]=(c*p*o-f*l*o+f*a*u-i*p*u-c*a*m+i*l*m)*T,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:function(e,t,n){var r=this.elements,i=yc.set(r[0],r[1],r[2]).length(),a=yc.set(r[4],r[5],r[6]).length(),o=yc.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],bc.copy(this);var s=1/i,c=1/a,l=1/o;return bc.elements[0]*=s,bc.elements[1]*=s,bc.elements[2]*=s,bc.elements[4]*=c,bc.elements[5]*=c,bc.elements[6]*=c,bc.elements[8]*=l,bc.elements[9]*=l,bc.elements[10]*=l,t.setFromRotationMatrix(bc),n.x=i,n.y=a,n.z=o,this},makePerspective:function(e,t,n,r,i,a){a===void 0&&console.warn(`THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.`);var o=this.elements,s=2*i/(t-e),c=2*i/(n-r),l=(t+e)/(t-e),u=(n+r)/(n-r),d=-(a+i)/(a-i),f=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=f,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),c=1/(n-r),l=1/(a-i),u=(t+e)*s,d=(n+r)*c,f=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-f,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}),Ec=new O,Dc=new E,k.RotationOrders=[`XYZ`,`YZX`,`ZXY`,`XZY`,`YXZ`,`ZYX`],k.DefaultOrder=`XYZ`,Object.defineProperties(k.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(k.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=X.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],d=i[2],f=i[6],p=i[10];switch(t=t||this._order,t){case`XYZ`:this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(f,l),this._z=0);break;case`YXZ`:this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-d,a),this._z=0);break;case`ZXY`:this._x=Math.asin(r(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a));break;case`ZYX`:this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l));break;case`YZX`:this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(s,p));break;case`XZY`:this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn(`THREE.Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n!==!1&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return Ec.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ec,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return Dc.setFromEuler(this),this.setFromQuaternion(Dc,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new D(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(A.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return(this.mask&e.mask)!==0}}),Oc=0,kc=new D,Ac=new E,jc=new O,Mc=new D,Nc=new D,Pc=new D,Fc=new E,Ic=new D(1,0,0),Lc=new D(0,1,0),Rc=new D(0,0,1),zc={type:`added`},Bc={type:`removed`},j.DefaultUp=new D(0,1,0),j.DefaultMatrixAutoUpdate=!0,j.prototype=Object.assign(Object.create(y.prototype),{constructor:j,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return Ac.setFromAxisAngle(e,t),this.quaternion.multiply(Ac),this},rotateOnWorldAxis:function(e,t){return Ac.setFromAxisAngle(e,t),this.quaternion.premultiply(Ac),this},rotateX:function(e){return this.rotateOnAxis(Ic,e)},rotateY:function(e){return this.rotateOnAxis(Lc,e)},rotateZ:function(e){return this.rotateOnAxis(Rc,e)},translateOnAxis:function(e,t){return kc.copy(e).applyQuaternion(this.quaternion),this.position.add(kc.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(Ic,e)},translateY:function(e){return this.translateOnAxis(Lc,e)},translateZ:function(e){return this.translateOnAxis(Rc,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(jc.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?Mc.copy(e):Mc.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Nc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?jc.lookAt(Nc,Mc,this.up):jc.lookAt(Mc,Nc,this.up),this.quaternion.setFromRotationMatrix(jc),r&&(jc.extractRotation(r.matrixWorld),Ac.setFromRotationMatrix(jc),this.quaternion.premultiply(Ac.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error(`THREE.Object3D.add: object can\'t be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(zc)):console.error(`THREE.Object3D.add: object not an instance of THREE.Object3D.`,e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Bc)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),jc.getInverse(this.matrixWorld),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),jc.multiply(e.parent.matrixWorld)),e.applyMatrix4(jc),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty(`id`,e)},getObjectByName:function(e){return this.getObjectByProperty(`name`,e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(i!==void 0)return i}},getWorldPosition:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldPosition() target is now required`),e=new D),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldQuaternion() target is now required`),e=new E),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Nc,e,Pc),e},getWorldScale:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldScale() target is now required`),e=new D),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Nc,Fc,e),e},getWorldDirection:function(e){e===void 0&&(console.warn(`THREE.Object3D: .getWorldDirection() target is now required`),e=new D),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:`Object`,generator:`Object3D.toJSON`});var r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!==`{}`&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON());function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(this.material!==void 0)if(Array.isArray(this.material)){for(var u=[],s=0,c=this.material.length;s<c;s++)u.push(i(e.materials,this.material[s]));r.material=u}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(e).object)}if(t){var d=h(e.geometries),f=h(e.materials),p=h(e.textures),m=h(e.images),o=h(e.shapes);d.length>0&&(n.geometries=d),f.length>0&&(n.materials=f),p.length>0&&(n.textures=p),m.length>0&&(n.images=m),o.length>0&&(n.shapes=o)}return n.object=r,n;function h(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}},clone:function(e){return new this.constructor().copy(this,e)},copy:function(e,t){if(t===void 0&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}}),M.prototype=Object.assign(Object.create(j.prototype),{constructor:M,isScene:!0,copy:function(e,t){return j.prototype.copy.call(this,e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return this.background!==null&&(t.object.background=this.background.toJSON(e)),this.environment!==null&&(t.object.environment=this.environment.toJSON(e)),this.fog!==null&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Vc=[new D,new D,new D,new D,new D,new D,new D,new D],Hc=new D,Uc=new N,Wc=new D,Gc=new D,Kc=new D,qc=new D,Jc=new D,Yc=new D,Xc=new D,Zc=new D,Qc=new D,$c=new D,Object.assign(N.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],u=e[s+1],d=e[s+2];l<t&&(t=l),u<n&&(n=u),d<r&&(r=d),l>i&&(i=l),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),u=e.getY(s),d=e.getZ(s);l<t&&(t=l),u<n&&(n=u),d<r&&(r=d),l>i&&(i=l),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Hc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Box3: .getCenter() target is now required`),e=new D),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn(`THREE.Box3: .getSize() target is now required`),e=new D),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),Uc.copy(t.boundingBox),Uc.applyMatrix4(e.matrixWorld),this.union(Uc));for(var n=e.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return t===void 0&&(console.warn(`THREE.Box3: .getParameter() target is now required`),t=new D),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,Hc),Hc.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Xc),Zc.subVectors(this.max,Xc),Wc.subVectors(e.a,Xc),Gc.subVectors(e.b,Xc),Kc.subVectors(e.c,Xc),qc.subVectors(Gc,Wc),Jc.subVectors(Kc,Gc),Yc.subVectors(Wc,Kc);var t=[0,-qc.z,qc.y,0,-Jc.z,Jc.y,0,-Yc.z,Yc.y,qc.z,0,-qc.x,Jc.z,0,-Jc.x,Yc.z,0,-Yc.x,-qc.y,qc.x,0,-Jc.y,Jc.x,0,-Yc.y,Yc.x,0];return!P(t,Wc,Gc,Kc,Zc)||(t=[1,0,0,0,1,0,0,0,1],!P(t,Wc,Gc,Kc,Zc))?!1:(Qc.crossVectors(qc,Jc),t=[Qc.x,Qc.y,Qc.z],P(t,Wc,Gc,Kc,Zc))},clampPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Box3: .clampPoint() target is now required`),t=new D),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Hc.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return e===void 0&&console.error(`THREE.Box3: .getBoundingSphere() target is now required`),this.getCenter(e.center),e.radius=this.getSize(Hc).length()*.5,e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(Vc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vc),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),el=new N,Object.assign(F.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;t===void 0?el.setFromPoints(e).getCenter(n):n.copy(t);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return t===void 0&&(console.warn(`THREE.Sphere: .clampPoint() target is now required`),t=new D),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return e===void 0&&(console.warn(`THREE.Sphere: .getBoundingBox() target is now required`),e=new N),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),tl=new D,nl=new D,rl=new D,il=new D,al=new D,ol=new D,sl=new D,Object.assign(I.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return t===void 0&&(console.warn(`THREE.Ray: .at() target is now required`),t=new D),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,tl)),this},closestPointToPoint:function(e,t){t===void 0&&(console.warn(`THREE.Ray: .closestPointToPoint() target is now required`),t=new D),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=tl.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(tl.copy(this.direction).multiplyScalar(t).add(this.origin),tl.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,r){nl.copy(e).add(t).multiplyScalar(.5),rl.copy(t).sub(e).normalize(),il.copy(this.origin).sub(nl);var i=e.distanceTo(t)*.5,a=-this.direction.dot(rl),o=il.dot(this.direction),s=-il.dot(rl),c=il.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){var m=1/l;u*=m,d*=m,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(rl).multiplyScalar(d).add(nl),f},intersectSphere:function(e,t){tl.subVectors(e.center,this.origin);var n=tl.dot(this.direction),r=tl.dot(tl)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return n===null?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||n!==n)&&(n=i),(a<r||r!==r)&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)},intersectsBox:function(e){return this.intersectBox(e,tl)!==null},intersectTriangle:function(e,t,n,r,i){al.subVectors(t,e),ol.subVectors(n,e),sl.crossVectors(al,ol);var a=this.direction.dot(sl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;il.subVectors(this.origin,e);var s=o*this.direction.dot(ol.crossVectors(il,ol));if(s<0)return null;var c=o*this.direction.dot(al.cross(il));if(c<0||s+c>a)return null;var l=-o*il.dot(sl);return l<0?null:this.at(l/a,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),cl=new D,ll=new D,ul=new x,Object.assign(L.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var r=cl.subVectors(n,t).cross(ll.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Plane: .projectPoint() target is now required`),t=new D),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){t===void 0&&(console.warn(`THREE.Plane: .intersectLine() target is now required`),t=new D);var n=e.delta(cl),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;if(!(i<0||i>1))return t.copy(n).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return e===void 0&&(console.warn(`THREE.Plane: .coplanarPoint() target is now required`),e=new D),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||ul.getNormalMatrix(e),r=this.coplanarPoint(cl).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),dl=new D,fl=new D,pl=new D,ml=new D,hl=new D,gl=new D,_l=new D,vl=new D,yl=new D,bl=new D,Object.assign(R,{getNormal:function(e,t,n,r){r===void 0&&(console.warn(`THREE.Triangle: .getNormal() target is now required`),r=new D),r.subVectors(n,t),dl.subVectors(e,t),r.cross(dl);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},getBarycoord:function(e,t,n,r,i){dl.subVectors(r,t),fl.subVectors(n,t),pl.subVectors(e,t);var a=dl.dot(dl),o=dl.dot(fl),s=dl.dot(pl),c=fl.dot(fl),l=fl.dot(pl),u=a*c-o*o;if(i===void 0&&(console.warn(`THREE.Triangle: .getBarycoord() target is now required`),i=new D),u===0)return i.set(-2,-1,-1);var d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)},containsPoint:function(e,t,n,r){return R.getBarycoord(e,t,n,r,ml),ml.x>=0&&ml.y>=0&&ml.x+ml.y<=1},getUV:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ml),s.set(0,0),s.addScaledVector(i,ml.x),s.addScaledVector(a,ml.y),s.addScaledVector(o,ml.z),s},isFrontFacing:function(e,t,n,r){return dl.subVectors(n,t),fl.subVectors(e,t),dl.cross(fl).dot(r)<0}}),Object.assign(R.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return dl.subVectors(this.c,this.b),fl.subVectors(this.a,this.b),dl.cross(fl).length()*.5},getMidpoint:function(e){return e===void 0&&(console.warn(`THREE.Triangle: .getMidpoint() target is now required`),e=new D),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return R.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return e===void 0&&(console.warn(`THREE.Triangle: .getPlane() target is now required`),e=new L),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return R.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,r,i){return R.getUV(e,this.a,this.b,this.c,t,n,r,i)},containsPoint:function(e){return R.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return R.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){t===void 0&&(console.warn(`THREE.Triangle: .closestPointToPoint() target is now required`),t=new D);var n=this.a,r=this.b,i=this.c,a,o;hl.subVectors(r,n),gl.subVectors(i,n),vl.subVectors(e,n);var s=hl.dot(vl),c=gl.dot(vl);if(s<=0&&c<=0)return t.copy(n);yl.subVectors(e,r);var l=hl.dot(yl),u=gl.dot(yl);if(l>=0&&u<=l)return t.copy(r);var d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(hl,a);bl.subVectors(e,i);var f=hl.dot(bl),p=gl.dot(bl);if(p>=0&&f<=p)return t.copy(i);var m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(gl,o);var h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return _l.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(_l,o);var g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(hl,a).addScaledVector(gl,o)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),xl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Sl={h:0,s:0,l:0},Cl={h:0,s:0,l:0},Object.assign(z.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):typeof e==`number`?this.setHex(e):typeof e==`string`&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=X.euclideanModulo(e,1),t=X.clamp(t,0,1),n=X.clamp(n,0,1),t===0)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=ee(i,r,e+1/3),this.g=ee(i,r,e),this.b=ee(i,r,e-1/3)}return this},setStyle:function(e){function t(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}var n;if(n=/^((?:rgb|hsl)a?)\\(\\s*([^\\)]*)\\)/.exec(e)){var r,i=n[1],a=n[2];switch(i){case`rgb`:case`rgba`:if(r=/^(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case`hsl`:case`hsla`:if(r=/^([0-9]*\\.?[0-9]+)\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,c)}break}}else if(n=/^\\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],u=l.length;if(u===3)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(u===6)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=xl[e];return t===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(t),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return t===void 0&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){t===void 0&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=te(e.r),this.g=te(e.g),this.b=te(e.b),this},copyLinearToSRGB:function(e){return this.r=ne(e.r),this.g=ne(e.g),this.b=ne(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return(`000000`+this.getHex().toString(16)).slice(-6)},getHSL:function(e){e===void 0&&(console.warn(`THREE.Color: .getHSL() target is now required`),e={h:0,s:0,l:0});var t=this.r,n=this.g,r=this.b,i=Math.max(t,n,r),a=Math.min(t,n,r),o,s,c=(a+i)/2;if(a===i)o=0,s=0;else{var l=i-a;switch(s=c<=.5?l/(i+a):l/(2-i-a),i){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;case r:o=(t-n)/l+4;break}o/=6}return e.h=o,e.s=s,e.l=c,e},getStyle:function(){return`rgb(`+(this.r*255|0)+`,`+(this.g*255|0)+`,`+(this.b*255|0)+`)`},offsetHSL:function(e,t,n){return this.getHSL(Sl),Sl.h+=e,Sl.s+=t,Sl.l+=n,this.setHSL(Sl.h,Sl.s,Sl.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(Sl),e.getHSL(Cl);var n=X.lerp(Sl.h,Cl.h,t),r=X.lerp(Sl.s,Cl.s,t),i=X.lerp(Sl.l,Cl.l,t);return this.setHSL(n,r,i),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return t===void 0&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),z.NAMES=xl,Object.assign(B.prototype,{clone:function(){return new this.constructor().copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}),wl=0,V.prototype=Object.assign(Object.create(y.prototype),{constructor:V,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(e!==void 0)for(var t in e){var n=e[t];if(n===void 0){console.warn(`THREE.Material: \'`+t+`\' parameter is undefined.`);continue}if(t===`shading`){console.warn(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`),this.flatShading=n===1;continue}var r=this[t];if(r===void 0){console.warn(`THREE.`+this.type+`: \'`+t+`\' is not a property of this material.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}},toJSON:function(e){var t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,this.combine!==void 0&&(n.combine=this.combine),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.flatShading===!0&&(n.flatShading=this.flatShading),this.side!==0&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(n.morphTargets=!0),this.morphNormals===!0&&(n.morphNormals=!0),this.skinning===!0&&(n.skinning=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!==`{}`&&(n.userData=this.userData);function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return new this.constructor().copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(t!==null){var r=t.length;n=Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Object.defineProperty(V.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),re.prototype=Object.create(V.prototype),re.prototype.constructor=re,re.prototype.isMeshBasicMaterial=!0,re.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},Tl=new D,Object.defineProperty(H.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.assign(H.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyColorsArray(): color is undefined`,r),a=new z),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector2sArray(): vector is undefined`,r),a=new b),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector3sArray(): vector is undefined`,r),a=new D),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector4sArray(): vector is undefined`,r),a=new C),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyMatrix3(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyMatrix4(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyNormalMatrix(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.transformDirection(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),U.prototype=Object.create(H.prototype),U.prototype.constructor=U,ie.prototype=Object.create(H.prototype),ie.prototype.constructor=ie,W.prototype=Object.create(H.prototype),W.prototype.constructor=W,ae.prototype=Object.create(H.prototype),ae.prototype.constructor=ae,G.prototype=Object.create(H.prototype),G.prototype.constructor=G,oe.prototype=Object.create(H.prototype),oe.prototype.constructor=oe,se.prototype=Object.create(H.prototype),se.prototype.constructor=se,K.prototype=Object.create(H.prototype),K.prototype.constructor=K,ce.prototype=Object.create(H.prototype),ce.prototype.constructor=ce,Object.assign(le.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,t!==void 0&&(t.count=a*3-t.start,n.push(t)),t={start:a*3,materialIndex:r})}t!==void 0&&(t.count=a*3-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t=e.faces,n=e.vertices,r=e.faceVertexUvs,i=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,o=e.morphTargets,s=o.length,c;if(s>0){c=[];for(var l=0;l<s;l++)c[l]={name:o[l].name,data:[]};this.morphTargets.position=c}var u=e.morphNormals,d=u.length,f;if(d>0){f=[];for(var l=0;l<d;l++)f[l]={name:u[l].name,data:[]};this.morphTargets.normal=f}var p=e.skinIndices,m=e.skinWeights,h=p.length===n.length,g=m.length===n.length;n.length>0&&t.length===0&&console.error(`THREE.DirectGeometry: Faceless geometries are not supported.`);for(var l=0;l<t.length;l++){var _=t[l];this.vertices.push(n[_.a],n[_.b],n[_.c]);var v=_.vertexNormals;if(v.length===3)this.normals.push(v[0],v[1],v[2]);else{var y=_.normal;this.normals.push(y,y,y)}var x=_.vertexColors;if(x.length===3)this.colors.push(x[0],x[1],x[2]);else{var S=_.color;this.colors.push(S,S,S)}if(i===!0){var C=r[0][l];C===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv `,l),this.uvs.push(new b,new b,new b)):this.uvs.push(C[0],C[1],C[2])}if(a===!0){var C=r[1][l];C===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 `,l),this.uvs2.push(new b,new b,new b)):this.uvs2.push(C[0],C[1],C[2])}for(var w=0;w<s;w++){var T=o[w].vertices;c[w].data.push(T[_.a],T[_.b],T[_.c])}for(var w=0;w<d;w++){var E=u[w].vertexNormals[l];f[w].data.push(E.a,E.b,E.c)}h&&this.skinIndices.push(p[_.a],p[_.b],p[_.c]),g&&this.skinWeights.push(m[_.a],m[_.b],m[_.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}}),El=1,Dl=new O,Ol=new j,kl=new D,Al=new N,jl=new N,Ml=new D,q.prototype=Object.assign(Object.create(y.prototype),{constructor:q,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(ue(e)>65535?se:G)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:n===void 0?0:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(n!==void 0){var r=new x().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},rotateX:function(e){return Dl.makeRotationX(e),this.applyMatrix4(Dl),this},rotateY:function(e){return Dl.makeRotationY(e),this.applyMatrix4(Dl),this},rotateZ:function(e){return Dl.makeRotationZ(e),this.applyMatrix4(Dl),this},translate:function(e,t,n){return Dl.makeTranslation(e,t,n),this.applyMatrix4(Dl),this},scale:function(e,t,n){return Dl.makeScale(e,t,n),this.applyMatrix4(Dl),this},lookAt:function(e){return Ol.lookAt(e),Ol.updateMatrix(),this.applyMatrix4(Ol.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(kl).negate(),this.translate(kl.x,kl.y,kl.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new K(t.vertices.length*3,3),r=new K(t.colors.length*3,3);if(this.setAttribute(`position`,n.copyVector3sArray(t.vertices)),this.setAttribute(`color`,r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new K(t.lineDistances.length,1);this.setAttribute(`lineDistance`,i.copyArray(t.lineDistances))}t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute(`position`,new K(t,3)),this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var n=t.__directGeometry;if(t.elementsNeedUpdate===!0&&(n=void 0,t.elementsNeedUpdate=!1),n===void 0)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}var r;return t.verticesNeedUpdate===!0&&(r=this.attributes.position,r!==void 0&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),t.normalsNeedUpdate===!0&&(r=this.attributes.normal,r!==void 0&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),t.colorsNeedUpdate===!0&&(r=this.attributes.color,r!==void 0&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(r=this.attributes.uv,r!==void 0&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,r!==void 0&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=new le().fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(e.vertices.length*3);if(this.setAttribute(`position`,new H(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(e.normals.length*3);this.setAttribute(`normal`,new H(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(e.colors.length*3);this.setAttribute(`color`,new H(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(e.uvs.length*2);this.setAttribute(`uv`,new H(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(e.uvs2.length*2);this.setAttribute(`uv2`,new H(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l<u;l++){var d=c[l],f=new K(d.data.length*3,3);f.name=d.name,s.push(f.copyVector3sArray(d.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var p=new K(e.skinIndices.length*4,4);this.setAttribute(`skinIndex`,p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new K(e.skinWeights.length*4,4);this.setAttribute(`skinWeight`,m.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new N);var e=this.attributes.position,t=this.morphAttributes.position;if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];Al.setFromBufferAttribute(i),this.morphTargetsRelative?(Ml.addVectors(this.boundingBox.min,Al.min),this.boundingBox.expandByPoint(Ml),Ml.addVectors(this.boundingBox.max,Al.max),this.boundingBox.expandByPoint(Ml)):(this.boundingBox.expandByPoint(Al.min),this.boundingBox.expandByPoint(Al.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error(`THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new F);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(Al.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];jl.setFromBufferAttribute(a),this.morphTargetsRelative?(Ml.addVectors(Al.min,jl.min),Al.expandByPoint(Ml),Ml.addVectors(Al.max,jl.max),Al.expandByPoint(Ml)):(Al.expandByPoint(jl.min),Al.expandByPoint(jl.max))}Al.getCenter(n);for(var o=0,r=0,i=e.count;r<i;r++)Ml.fromBufferAttribute(e,r),o=Math.max(o,n.distanceToSquared(Ml));if(t)for(var r=0,i=t.length;r<i;r++)for(var a=t[r],s=this.morphTargetsRelative,c=0,l=a.count;c<l;c++)Ml.fromBufferAttribute(a,c),s&&(kl.fromBufferAttribute(e,c),Ml.add(kl)),o=Math.max(o,n.distanceToSquared(Ml));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error(`THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(t.normal===void 0)this.setAttribute(`normal`,new H(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o=t.normal.array,s,c,l,u=new D,d=new D,f=new D,p=new D,m=new D;if(e)for(var h=e.array,i=0,a=e.count;i<a;i+=3)s=h[i+0]*3,c=h[i+1]*3,l=h[i+2]*3,u.fromArray(n,s),d.fromArray(n,c),f.fromArray(n,l),p.subVectors(f,d),m.subVectors(u,d),p.cross(m),o[s]+=p.x,o[s+1]+=p.y,o[s+2]+=p.z,o[c]+=p.x,o[c+1]+=p.y,o[c+2]+=p.z,o[l]+=p.x,o[l+1]+=p.y,o[l+2]+=p.z;else for(var i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),d.fromArray(n,i+3),f.fromArray(n,i+6),p.subVectors(f,d),m.subVectors(u,d),p.cross(m),o[i]=p.x,o[i+1]=p.y,o[i+2]=p.z,o[i+3]=p.x,o[i+4]=p.y,o[i+5]=p.z,o[i+6]=p.x,o[i+7]=p.y,o[i+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(!(e&&e.isBufferGeometry)){console.error(`THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.`,e);return}t===void 0&&(t=0,console.warn(`THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.`));var n=this.attributes;for(var r in n)if(e.attributes[r]!==void 0)for(var i=n[r].array,a=e.attributes[r],o=a.array,s=a.itemSize*t,c=Math.min(o.length,i.length-s),l=0,u=s;l<c;l++,u++)i[u]=o[l];return this},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Ml.x=e.getX(t),Ml.y=e.getY(t),Ml.z=e.getZ(t),Ml.normalize(),e.setXYZ(t,Ml.x,Ml.y,Ml.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,c=0,l=t.length;c<l;c++){o=t[c]*r;for(var u=0;u<r;u++)a[s++]=n[o++]}return new H(a,r,i)}if(this.index===null)return console.warn(`THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed.`),this;var t=new q,n=this.index.array,r=this.attributes;for(var i in r){var a=r[i],o=e(a,n);t.setAttribute(i,o)}var s=this.morphAttributes;for(i in s){for(var c=[],l=s[i],u=0,d=l.length;u<d;u++){var a=l[u],o=e(a,n);c.push(o)}t.morphAttributes[i]=c}t.morphTargetsRelative=this.morphTargetsRelative;for(var f=this.groups,u=0,p=f.length;u<p;u++){var m=f[u];t.addGroup(m.start,m.count,m.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;r!==null&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=i[n],o=a.toJSON();a.name!==``&&(o.name=a.name),e.data.attributes[n]=o}var s={},c=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],u=[],d=0,f=l.length;d<f;d++){var a=l[d],o=a.toJSON();a.name!==``&&(o.name=a.name),u.push(o)}u.length>0&&(s[n]=u,c=!0)}c&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var m=this.boundingSphere;return m!==null&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e},clone:function(){return new q().copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;i!==null&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,r=l.length;n<r;n++)c.push(l[n].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var u=e.groups;for(n=0,r=u.length;n<r;n++){var d=u[n];this.addGroup(d.start,d.count,d.materialIndex)}var f=e.boundingBox;f!==null&&(this.boundingBox=f.clone());var p=e.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Nl=new O,Pl=new I,Fl=new F,Il=new D,Ll=new D,Rl=new D,zl=new D,Bl=new D,Vl=new D,Hl=new D,Ul=new D,Wl=new D,Gl=new b,Kl=new b,ql=new b,Jl=new D,Yl=new D,de.prototype=Object.assign(Object.create(j.prototype),{constructor:de,isMesh:!0,copy:function(e){return j.prototype.copy.call(this,e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}},raycast:function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Fl.copy(n.boundingSphere),Fl.applyMatrix4(i),e.ray.intersectsSphere(Fl)!==!1&&(Nl.getInverse(i),Pl.copy(e.ray).applyMatrix4(Nl),!(n.boundingBox!==null&&Pl.intersectsBox(n.boundingBox)===!1)))){var a;if(n.isBufferGeometry){var o,s,c,l=n.index,u=n.attributes.position,d=n.morphAttributes.position,f=n.morphTargetsRelative,p=n.attributes.uv,m=n.attributes.uv2,h=n.groups,g=n.drawRange,_,v,y,x,S,C,w,T;if(l!==null)if(Array.isArray(r))for(_=0,y=h.length;_<y;_++)for(S=h[_],C=r[S.materialIndex],w=Math.max(S.start,g.start),T=Math.min(S.start+S.count,g.start+g.count),v=w,x=T;v<x;v+=3)o=l.getX(v),s=l.getX(v+1),c=l.getX(v+2),a=pe(this,C,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=S.materialIndex,t.push(a));else for(w=Math.max(0,g.start),T=Math.min(l.count,g.start+g.count),_=w,y=T;_<y;_+=3)o=l.getX(_),s=l.getX(_+1),c=l.getX(_+2),a=pe(this,r,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(_/3),t.push(a));else if(u!==void 0)if(Array.isArray(r))for(_=0,y=h.length;_<y;_++)for(S=h[_],C=r[S.materialIndex],w=Math.max(S.start,g.start),T=Math.min(S.start+S.count,g.start+g.count),v=w,x=T;v<x;v+=3)o=v,s=v+1,c=v+2,a=pe(this,C,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=S.materialIndex,t.push(a));else for(w=Math.max(0,g.start),T=Math.min(u.count,g.start+g.count),_=w,y=T;_<y;_+=3)o=_,s=_+1,c=_+2,a=pe(this,r,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(_/3),t.push(a))}else if(n.isGeometry){var E,D,O,k=Array.isArray(r),A=n.vertices,j=n.faces,M,N=n.faceVertexUvs[0];N.length>0&&(M=N);for(var P=0,F=j.length;P<F;P++){var I=j[P],L=k?r[I.materialIndex]:r;if(L!==void 0&&(E=A[I.a],D=A[I.b],O=A[I.c],a=fe(this,L,e,Pl,E,D,O,Jl),a)){if(M&&M[P]){var z=M[P];Gl.copy(z[0]),Kl.copy(z[1]),ql.copy(z[2]),a.uv=R.getUV(Jl,E,D,O,Gl,Kl,ql,new b)}a.face=I,a.faceIndex=P,t.push(a)}}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Xl=0,Zl=new O,Ql=new j,$l=new D,J.prototype=Object.assign(Object.create(y.prototype),{constructor:J,isGeometry:!0,applyMatrix4:function(e){for(var t=new x().getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++)this.vertices[n].applyMatrix4(e);for(var n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return Zl.makeRotationX(e),this.applyMatrix4(Zl),this},rotateY:function(e){return Zl.makeRotationY(e),this.applyMatrix4(Zl),this},rotateZ:function(e){return Zl.makeRotationZ(e),this.applyMatrix4(Zl),this},translate:function(e,t,n){return Zl.makeTranslation(e,t,n),this.applyMatrix4(Zl),this},scale:function(e,t,n){return Zl.makeScale(e,t,n),this.applyMatrix4(Zl),this},lookAt:function(e){return Ql.lookAt(e),Ql.updateMatrix(),this.applyMatrix4(Ql.matrix),this},fromBufferGeometry:function(e){var t=this,n=e.index===null?void 0:e.index.array,r=e.attributes;if(r.position===void 0)return console.error(`THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.`),this;var i=r.position.array,a=r.normal===void 0?void 0:r.normal.array,o=r.color===void 0?void 0:r.color.array,s=r.uv===void 0?void 0:r.uv.array,c=r.uv2===void 0?void 0:r.uv2.array;c!==void 0&&(this.faceVertexUvs[1]=[]);for(var l=0;l<i.length;l+=3)t.vertices.push(new D().fromArray(i,l)),o!==void 0&&t.colors.push(new z().fromArray(o,l));function u(e,n,r,i){var l=o===void 0?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[r].clone()],u=new B(e,n,r,a===void 0?[]:[new D().fromArray(a,e*3),new D().fromArray(a,n*3),new D().fromArray(a,r*3)],l,i);t.faces.push(u),s!==void 0&&t.faceVertexUvs[0].push([new b().fromArray(s,e*2),new b().fromArray(s,n*2),new b().fromArray(s,r*2)]),c!==void 0&&t.faceVertexUvs[1].push([new b().fromArray(c,e*2),new b().fromArray(c,n*2),new b().fromArray(c,r*2)])}var d=e.groups;if(d.length>0)for(var l=0;l<d.length;l++)for(var f=d[l],p=f.start,m=f.count,h=p,g=p+m;h<g;h+=3)n===void 0?u(h,h+1,h+2,f.materialIndex):u(n[h],n[h+1],n[h+2],f.materialIndex);else if(n!==void 0)for(var l=0;l<n.length;l+=3)u(n[l],n[l+1],n[l+2]);else for(var l=0;l<i.length/3;l+=3)u(l,l+1,l+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter($l).negate(),this.translate($l.x,$l.y,$l.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=t===0?1:1/t,r=new O;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(r),this},computeFaceNormals:function(){for(var e=new D,t=new D,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){e===void 0&&(e=!0);var t,n,r,i,a,o=Array(this.vertices.length);for(t=0,n=this.vertices.length;t<n;t++)o[t]=new D;if(e){var s,c,l,u=new D,d=new D;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),d.subVectors(s,c),u.cross(d),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)a=this.faces[r],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++){a=this.faces[r];var f=a.vertexNormals;f.length===3?(f[0].copy(o[a.a]),f[1].copy(o[a.b]),f[2].copy(o[a.c])):(f[0]=o[a.a].clone(),f[1]=o[a.b].clone(),f[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){n=this.faces[e];var r=n.vertexNormals;r.length===3?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for(i=this.faces[n],i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new J;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals,c,l;for(n=0,r=this.faces.length;n<r;n++)c=new D,l={a:new D,b:new D,c:new D},o.push(c),s.push(l)}var u=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var c,l;for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],c=u.faceNormals[n],l=u.vertexNormals[n],c.copy(i.normal),l.a.copy(i.vertexNormals[0]),l.b.copy(i.vertexNormals[1]),l.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new N),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new F),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!(e&&e.isGeometry)){console.error(`THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.`,e);return}var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.colors,u=e.colors;n===void 0&&(n=0),t!==void 0&&(r=new x().getNormalMatrix(t));for(var d=0,f=o.length;d<f;d++){var p=o[d].clone();t!==void 0&&p.applyMatrix4(t),a.push(p)}for(var d=0,f=u.length;d<f;d++)l.push(u[d].clone());for(d=0,f=c.length;d<f;d++){var m=c[d],h,g,_,v=m.vertexNormals,y=m.vertexColors;h=new B(m.a+i,m.b+i,m.c+i),h.normal.copy(m.normal),r!==void 0&&h.normal.applyMatrix3(r).normalize();for(var b=0,S=v.length;b<S;b++)g=v[b].clone(),r!==void 0&&g.applyMatrix3(r).normalize(),h.vertexNormals.push(g);h.color.copy(m.color);for(var b=0,S=y.length;b<S;b++)_=y[b],h.vertexColors.push(_.clone());h.materialIndex=m.materialIndex+n,s.push(h)}for(var d=0,f=e.faceVertexUvs.length;d<f;d++){var C=e.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(var b=0,S=C.length;b<S;b++){for(var w=C[b],T=[],E=0,D=w.length;E<D;E++)T.push(w[E].clone());this.faceVertexUvs[d].push(T)}}},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error(`THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.`,e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(){var e={},t=[],n=[],r,i,a=Math.pow(10,4),o,s,c,l,u,d;for(o=0,s=this.vertices.length;o<s;o++)r=this.vertices[o],i=Math.round(r.x*a)+`_`+Math.round(r.y*a)+`_`+Math.round(r.z*a),e[i]===void 0?(e[i]=o,t.push(this.vertices[o]),n[o]=t.length-1):n[o]=n[e[i]];var f=[];for(o=0,s=this.faces.length;o<s;o++){c=this.faces[o],c.a=n[c.a],c.b=n[c.b],c.c=n[c.c],l=[c.a,c.b,c.c];for(var p=0;p<3;p++)if(l[p]===l[(p+1)%3]){f.push(o);break}}for(o=f.length-1;o>=0;o--){var m=f[o];for(this.faces.splice(m,1),u=0,d=this.faceVertexUvs.length;u<d;u++)this.faceVertexUvs[u].splice(m,1)}var h=this.vertices.length-t.length;return this.vertices=t,h},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new D(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;function r(e,t){return e.materialIndex-t.materialIndex}e.sort(r);var i=this.faceVertexUvs[0],a=this.faceVertexUvs[1],o,s;i&&i.length===t&&(o=[]),a&&a.length===t&&(s=[]);for(var n=0;n<t;n++){var c=e[n]._id;o&&o.push(i[c]),s&&s.push(a[c])}o&&(this.faceVertexUvs[0]=o),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){var e={metadata:{version:4.5,type:`Geometry`,generator:`Geometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}for(var o=[],s=[],c={},l=[],u={},d=[],f={},i=0;i<this.faces.length;i++){var p=this.faces[i],m=!0,h=!1,g=this.faceVertexUvs[0][i]!==void 0,_=p.normal.length()>0,v=p.vertexNormals.length>0,y=p.color.r!==1||p.color.g!==1||p.color.b!==1,b=p.vertexColors.length>0,x=0;if(x=T(x,0,0),x=T(x,1,m),x=T(x,2,h),x=T(x,3,g),x=T(x,4,_),x=T(x,5,v),x=T(x,6,y),x=T(x,7,b),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),g){var S=this.faceVertexUvs[0][i];o.push(O(S[0]),O(S[1]),O(S[2]))}if(_&&o.push(E(p.normal)),v){var C=p.vertexNormals;o.push(E(C[0]),E(C[1]),E(C[2]))}if(y&&o.push(D(p.color)),b){var w=p.vertexColors;o.push(D(w[0]),D(w[1]),D(w[2]))}}function T(e,t,n){return n?e|1<<t:e&~(1<<t)}function E(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return c[t]===void 0?(c[t]=s.length/3,s.push(e.x,e.y,e.z),c[t]):c[t]}function D(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return u[t]===void 0?(u[t]=l.length,l.push(e.getHex()),u[t]):u[t]}function O(e){var t=e.x.toString()+e.y.toString();return f[t]===void 0?(f[t]=d.length/2,d.push(e.x,e.y),f[t]):f[t]}return e.data={},e.data.vertices=r,e.data.normals=s,l.length>0&&(e.data.colors=l),d.length>0&&(e.data.uvs=[d]),e.data.faces=o,e},clone:function(){return new J().copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]),r=0,i=u.length;r<i;r++){var d=u[r],f=[];for(a=0,o=d.length;a<o;a++){var p=d[a];f.push(p.clone())}this.faceVertexUvs[t].push(f)}}var m=e.morphTargets;for(t=0,n=m.length;t<n;t++){var h={};if(h.name=m[t].name,m[t].vertices!==void 0)for(h.vertices=[],r=0,i=m[t].vertices.length;r<i;r++)h.vertices.push(m[t].vertices[r].clone());if(m[t].normals!==void 0)for(h.normals=[],r=0,i=m[t].normals.length;r<i;r++)h.normals.push(m[t].normals[r].clone());this.morphTargets.push(h)}var g=e.morphNormals;for(t=0,n=g.length;t<n;t++){var _={};if(g[t].vertexNormals!==void 0)for(_.vertexNormals=[],r=0,i=g[t].vertexNormals.length;r<i;r++){var v=g[t].vertexNormals[r],y={};y.a=v.a.clone(),y.b=v.b.clone(),y.c=v.c.clone(),_.vertexNormals.push(y)}if(g[t].faceNormals!==void 0)for(_.faceNormals=[],r=0,i=g[t].faceNormals.length;r<i;r++)_.faceNormals.push(g[t].faceNormals[r].clone());this.morphNormals.push(_)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var x=e.skinIndices;for(t=0,n=x.length;t<n;t++)this.skinIndices.push(x[t].clone());var S=e.lineDistances;for(t=0,n=S.length;t<n;t++)this.lineDistances.push(S[t]);var C=e.boundingBox;C!==null&&(this.boundingBox=C.clone());var w=e.boundingSphere;return w!==null&&(this.boundingSphere=w.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),eu=class extends J{constructor(e,t,n,r,i,a){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new tu(e,t,n,r,i,a)),this.mergeVertices()}},tu=class extends q{constructor(e,t,n,r,i,a){super(),this.type=`BoxBufferGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;e=e||1,t=t||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new K(c,3)),this.setAttribute(`normal`,new K(l,3)),this.setAttribute(`uv`,new K(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,O=new D;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)O[e]=(s*v-b)*r,O[t]=o*i,O[n]=S,c.push(O.x,O.y,O.z),O[e]=0,O[t]=0,O[n]=m>0?1:-1,l.push(O.x,O.y,O.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}},nu={clone:me,merge:he},ru=`void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}`,iu=`void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}`,ge.prototype=Object.create(V.prototype),ge.prototype.constructor=ge,ge.prototype.isShaderMaterial=!0,ge.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=me(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},ge.prototype.toJSON=function(e){var t=V.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:`t`,value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:`c`,value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:`v2`,value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:`v3`,value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:`v4`,value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:`m3`,value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:`m4`,value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)this.extensions[a]===!0&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},_e.prototype=Object.assign(Object.create(j.prototype),{constructor:_e,isCamera:!0,copy:function(e,t){return j.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){e===void 0&&(console.warn(`THREE.Camera: .getWorldDirection() target is now required`),e=new D),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){j.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){j.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return new this.constructor().copy(this)}}),ve.prototype=Object.assign(Object.create(_e.prototype),{constructor:ve,isPerspectiveCamera:!0,copy:function(e,t){return _e.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=X.RAD2DEG*2*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(X.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/e},getEffectiveFOV:function(){return X.RAD2DEG*2*Math.atan(Math.tan(X.DEG2RAD*.5*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(X.DEG2RAD*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;c!==0&&(i+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),au=90,ou=1,ye.prototype=Object.create(j.prototype),ye.prototype.constructor=ye,be.prototype=Object.create(w.prototype),be.prototype.constructor=be,be.prototype.isWebGLCubeRenderTarget=!0,be.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new M,r={uniforms:{tEquirect:{value:null}},vertexShader:[`varying vec3 vWorldDirection;`,`vec3 transformDirection( in vec3 dir, in mat4 matrix ) {`,` return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );`,`}`,`void main() {`,` vWorldDirection = transformDirection( position, modelMatrix );`,` #include <begin_vertex>`,` #include <project_vertex>`,`}`].join(`\n`),fragmentShader:[`uniform sampler2D tEquirect;`,`varying vec3 vWorldDirection;`,`#include <common>`,`void main() {`,` vec3 direction = normalize( vWorldDirection );`,` vec2 sampleUV = equirectUv( direction );`,` gl_FragColor = texture2D( tEquirect, sampleUV );`,`}`].join(`\n`)},i=new ge({type:`CubemapFromEquirect`,uniforms:me(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;var a=new de(new tu(5,5,5),i);return n.add(a),new ye(1,10,this).update(e,n),a.geometry.dispose(),a.material.dispose(),this},xe.prototype=Object.create(S.prototype),xe.prototype.constructor=xe,xe.prototype.isDataTexture=!0,su=new F,cu=new D,Object.assign(Se.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],d=n[8],f=n[9],p=n[10],m=n[11],h=n[12],g=n[13],_=n[14],v=n[15];return t[0].setComponents(o-r,u-s,m-d,v-h).normalize(),t[1].setComponents(o+r,u+s,m+d,v+h).normalize(),t[2].setComponents(o+i,u+c,m+f,v+g).normalize(),t[3].setComponents(o-i,u-c,m-f,v-g).normalize(),t[4].setComponents(o-a,u-l,m-p,v-_).normalize(),t[5].setComponents(o+a,u+l,m+p,v+_).normalize(),this},intersectsObject:function(e){var t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),su.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(su)},intersectsSprite:function(e){return su.center.set(0,0,0),su.radius=.7071067811865476,su.applyMatrix4(e.matrixWorld),this.intersectsSphere(su)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++)if(t[i].distanceToPoint(n)<r)return!1;return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(cu.x=r.normal.x>0?e.max.x:e.min.x,cu.y=r.normal.y>0?e.max.y:e.min.y,cu.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(cu)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}}),Z={common:{diffuse:{value:new z(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new x},uv2Transform:{value:new x},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new b(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new z(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new z(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new x}},sprite:{diffuse:{value:new z(15658734)},opacity:{value:1},center:{value:new b(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new x}}},Te.prototype=Object.create(J.prototype),Te.prototype.constructor=Te,Ee.prototype=Object.create(q.prototype),Ee.prototype.constructor=Ee,Q={alphamap_fragment:`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif`,alphamap_pars_fragment:`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,alphatest_fragment:`#ifdef ALPHATEST\n if ( diffuseColor.a < ALPHATEST ) discard;\n#endif`,aomap_fragment:`#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n #endif\n#endif`,aomap_pars_fragment:`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,begin_vertex:`vec3 transformed = vec3( position );`,beginnormal_vertex:`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,bsdfs:`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n return vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n#else\n if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n return Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n return 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( incidentLight.direction + viewDir );\n float dotNL = saturate( dot( normal, incidentLight.direction ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n return specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n vec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n vec3 FssEss = F * brdf.x + brdf.y;\n float Ess = brdf.x + brdf.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n float invAlpha = 1.0 / roughness;\n float cos2h = NoH * NoH;\n float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n vec3 N = geometry.normal;\n vec3 V = geometry.viewDir;\n vec3 H = normalize( V + L );\n float dotNH = saturate( dot( N, H ) );\n return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif`,bumpmap_pars_fragment:`#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 );\n fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,color_fragment:`#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif`,color_pars_fragment:`#ifdef USE_COLOR\n varying vec3 vColor;\n#endif`,color_pars_vertex:`#ifdef USE_COLOR\n varying vec3 vColor;\n#endif`,color_vertex:`#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif`,common:`#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n#ifdef CLEARCOAT\n vec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n return dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {\n uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {\n uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {\n uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {\n uv = vec2(direction.x, direction.y) / abs(direction.z); }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif`,encodings_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,encodings_pars_fragment:`\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.r, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.r, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract( Le );\n vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n return vec4( max( vRGB, 0.0 ), 1.0 );\n}`,envmap_fragment:`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n \n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n reflectVec = normalize( reflectVec );\n vec2 sampleUV = equirectUv( reflectVec );\n vec4 envColor = texture2D( envMap, sampleUV );\n #elif defined( ENVMAP_TYPE_SPHERE )\n reflectVec = normalize( reflectVec );\n vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifndef ENVMAP_TYPE_CUBE_UV\n envColor = envMapTexelToLinear( envColor );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform int maxMipLevel;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif`,envmap_physical_pars_fragment:`#if defined( USE_ENVMAP )\n #ifdef ENVMAP_MODE_REFRACTION\n uniform float refractionRatio;\n #endif\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n #else\n vec4 envMapColor = vec4( 0.0 );\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float sigma = PI * roughness * roughness / ( 1.0 + roughness );\n float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n #else\n vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV = equirectUv( reflectVec );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n#endif`,envmap_vertex:`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) { \n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif`,fog_vertex:`#ifdef USE_FOG\n fogDepth = -mvPosition.z;\n#endif`,fog_pars_vertex:`#ifdef USE_FOG\n varying float fogDepth;\n#endif`,fog_fragment:`#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif`,fog_pars_fragment:`#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float fogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return texture2D( gradientMap, coord ).rgb;\n #else\n return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n #endif\n}`,lightmap_fragment:`#ifdef USE_LIGHTMAP\n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif`,lights_lambert_vertex:`vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n vLightBack = vec3( 0.0 );\n vIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n vIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n #ifdef DOUBLE_SIDED\n vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n #endif\n }\n #pragma unroll_loop_end\n#endif`,lights_pars_begin:`uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n struct PointLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n directLight.visible = ( directLight.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n float angleCos = dot( directLight.direction, spotLight.direction );\n if ( angleCos > spotLight.coneCos ) {\n float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif`,lights_toon_fragment:`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,lights_toon_pars_fragment:`varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material ) (0)`,lights_phong_fragment:`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material ) (0)`,lights_physical_fragment:`PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheen;\n#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n#ifdef CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n vec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n #ifdef CLEARCOAT\n float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = ccDotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n ccIrradiance *= PI;\n #endif\n float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n #else\n float clearcoatDHR = 0.0;\n #endif\n #ifdef USE_SHEEN\n reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n material.specularRoughness,\n directLight.direction,\n geometry,\n material.sheenColor\n );\n #else\n reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n #endif\n reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef CLEARCOAT\n float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n float ccDotNL = ccDotNV;\n float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n #else\n float clearcoatDHR = 0.0;\n #endif\n float clearcoatInv = 1.0 - clearcoatDHR;\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}`,lights_fragment_begin:`\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n geometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointDirectLightIrradiance( pointLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotDirectLightIrradiance( spotLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n irradiance += getLightProbeIrradiance( lightProbe, geometry );\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n #ifdef CLEARCOAT\n clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n #endif\n#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif`,map_fragment:`#ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv );\n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n#endif`,map_pars_fragment:`#ifdef USE_MAP\n uniform sampler2D map;\n#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n vec4 mapTexel = texture2D( map, uv );\n diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif`,map_particle_pars_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,metalnessmap_fragment:`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.b;\n#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n#endif`,normal_fragment_begin:`#ifdef FLAT_SHADED\n vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n #ifdef USE_TANGENT\n vec3 tangent = normalize( vTangent );\n vec3 bitangent = normalize( vBitangent );\n #ifdef DOUBLE_SIDED\n tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n mat3 vTBN = mat3( tangent, bitangent, normal );\n #endif\n #endif\n#endif\nvec3 geometryNormal = normal;`,normal_fragment_maps:`#ifdef OBJECTSPACE_NORMALMAP\n normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n #ifdef USE_TANGENT\n normal = normalize( vTBN * mapN );\n #else\n normal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n #endif\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n float scale = sign( st1.t * st0.s - st0.t * st1.s );\n vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n vec3 N = normalize( surf_norm );\n mat3 tsn = mat3( S, T, N );\n mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n return normalize( tsn * mapN );\n }\n#endif`,clearcoat_normal_fragment_begin:`#ifdef CLEARCOAT\n vec3 clearcoatNormal = geometryNormal;\n#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n #ifdef USE_TANGENT\n clearcoatNormal = normalize( vTBN * clearcoatMapN );\n #else\n clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n #endif\n#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif`,packing:`vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,dithering_pars_fragment:`#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif`,roughnessmap_fragment:`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.g;\n#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif`,shadowmap_pars_fragment:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n bool frustumTest = all( frustumTestVec );\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif`,shadowmap_pars_vertex:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif`,shadowmap_vertex:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif`,shadowmask_pars_fragment:`float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}`,skinbase_vertex:`#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n #else\n uniform mat4 boneMatrices[ MAX_BONES ];\n mat4 getBoneMatrix( const in float i ) {\n mat4 bone = boneMatrices[ int(i) ];\n return bone;\n }\n #endif\n#endif`,skinning_vertex:`#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif`,skinnormal_vertex:`#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif`,specularmap_fragment:`float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,tonemapping_pars_fragment:`#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}`,uv_pars_fragment:`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n varying vec2 vUv;\n#endif`,uv_pars_vertex:`#ifdef USE_UV\n #ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n #else\n varying vec2 vUv;\n #endif\n uniform mat3 uvTransform;\n#endif`,uv_vertex:`#ifdef USE_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif`,uv2_pars_fragment:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif`,uv2_pars_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n uniform mat3 uv2Transform;\n#endif`,uv2_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif`,background_frag:`uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n gl_FragColor = mapTexelToLinear( texColor );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,background_vert:`varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}`,cube_frag:`#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n vec3 vReflect = vWorldDirection;\n #include <envmap_fragment>\n gl_FragColor = envColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,cube_vert:`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}`,depth_frag:`#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}`,depth_vert:`#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}`,distanceRGBA_frag:`#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}`,distanceRGBA_vert:`#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}`,equirect_frag:`uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n vec4 texColor = texture2D( tEquirect, sampleUV );\n gl_FragColor = mapTexelToLinear( texColor );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,equirect_vert:`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}`,linedashed_frag:`uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,linedashed_vert:`uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <color_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`,meshbasic_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n \n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshbasic_vert:`#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}`,meshlambert_frag:`uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <emissivemap_fragment>\n #ifdef DOUBLE_SIDED\n reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n #else\n reflectedLight.indirectDiffuse += vIndirectFront;\n #endif\n #include <lightmap_fragment>\n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshlambert_vert:`#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_lambert_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshmatcap_frag:`#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n matcapColor = matcapTexelToLinear( matcapColor );\n #else\n vec4 matcapColor = vec4( 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshmatcap_vert:`#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}`,meshtoon_frag:`#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshtoon_vert:`#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshphong_frag:`#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshphong_vert:`#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshphysical_frag:`#define STANDARD\n#ifdef PHYSICAL\n #define REFLECTIVITY\n #define CLEARCOAT\n #define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n uniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n uniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #ifdef TRANSPARENCY\n diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n #endif\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshphysical_vert:`#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,normal_frag:`#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}`,normal_vert:`#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n#endif\n}`,points_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,points_vert:`uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}`,shadow_frag:`uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}`,shadow_vert:`#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <begin_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,sprite_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}`,sprite_vert:`uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`},lu={basic:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:Q.meshbasic_vert,fragmentShader:Q.meshbasic_frag},lambert:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.fog,Z.lights,{emissive:{value:new z(0)}}]),vertexShader:Q.meshlambert_vert,fragmentShader:Q.meshlambert_frag},phong:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new z(0)},specular:{value:new z(1118481)},shininess:{value:30}}]),vertexShader:Q.meshphong_vert,fragmentShader:Q.meshphong_frag},standard:{uniforms:he([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new z(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},toon:{uniforms:he([Z.common,Z.specularmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new z(0)},specular:{value:new z(1118481)},shininess:{value:30}}]),vertexShader:Q.meshtoon_vert,fragmentShader:Q.meshtoon_frag},matcap:{uniforms:he([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:Q.meshmatcap_vert,fragmentShader:Q.meshmatcap_frag},points:{uniforms:he([Z.points,Z.fog]),vertexShader:Q.points_vert,fragmentShader:Q.points_frag},dashed:{uniforms:he([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Q.linedashed_vert,fragmentShader:Q.linedashed_frag},depth:{uniforms:he([Z.common,Z.displacementmap]),vertexShader:Q.depth_vert,fragmentShader:Q.depth_frag},normal:{uniforms:he([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),vertexShader:Q.normal_vert,fragmentShader:Q.normal_frag},sprite:{uniforms:he([Z.sprite,Z.fog]),vertexShader:Q.sprite_vert,fragmentShader:Q.sprite_frag},background:{uniforms:{uvTransform:{value:new x},t2D:{value:null}},vertexShader:Q.background_vert,fragmentShader:Q.background_frag},cube:{uniforms:he([Z.envmap,{opacity:{value:1}}]),vertexShader:Q.cube_vert,fragmentShader:Q.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Q.equirect_vert,fragmentShader:Q.equirect_frag},distanceRGBA:{uniforms:he([Z.common,Z.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Q.distanceRGBA_vert,fragmentShader:Q.distanceRGBA_frag},shadow:{uniforms:he([Z.lights,Z.fog,{color:{value:new z(0)},opacity:{value:1}}]),vertexShader:Q.shadow_vert,fragmentShader:Q.shadow_frag}},lu.physical={uniforms:he([lu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new b(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new z(0)},transparency:{value:0}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},Re.prototype=Object.create(S.prototype),Re.prototype.constructor=Re,Re.prototype.isCubeTexture=!0,Object.defineProperty(Re.prototype,`images`,{get:function(){return this.image},set:function(e){this.image=e}}),ze.prototype=Object.create(S.prototype),ze.prototype.constructor=ze,ze.prototype.isDataTexture2DArray=!0,Be.prototype=Object.create(S.prototype),Be.prototype.constructor=Be,Be.prototype.isDataTexture3D=!0,uu=new S,du=new ze,fu=new Be,pu=new Re,mu=[],hu=[],gu=new Float32Array(16),_u=new Float32Array(9),vu=new Float32Array(4),Ct.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Ue(t,e)},wt.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}},yu=/([\\w\\d_]+)(\\])?(\\[|\\.)?/g,Dt.prototype.setValue=function(e,t,n,r){var i=this.map[t];i!==void 0&&i.setValue(e,n,r)},Dt.prototype.setOptional=function(e,t,n){var r=t[n];r!==void 0&&this.setValue(e,n,r)},Dt.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];s.needsUpdate!==!1&&o.setValue(e,s.value,r)}},Dt.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n},bu=0,xu=/^[ \\t]*#include +<([\\w\\d./]+)>/gm,Su=/#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g,Cu=/#pragma unroll_loop_start[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}[\\s]+?#pragma unroll_loop_end/g,wu=0,dn.prototype=Object.create(V.prototype),dn.prototype.constructor=dn,dn.prototype.isMeshDepthMaterial=!0,dn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},fn.prototype=Object.create(V.prototype),fn.prototype.constructor=fn,fn.prototype.isMeshDistanceMaterial=!0,fn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},Tu=`uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}`,Eu=`void main() {\n gl_Position = vec4( position, 1.0 );\n}`,_n.prototype=Object.assign(Object.create(ve.prototype),{constructor:_n,isArrayCamera:!0}),vn.prototype=Object.assign(Object.create(j.prototype),{constructor:vn,isGroup:!0}),Object.assign(yn.prototype,{constructor:yn,getTargetRaySpace:function(){return this._targetRay===null&&(this._targetRay=new vn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return this._grip===null&&(this._grip=new vn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this},update:function(e,t,n){var r=null,i=null,a=this._targetRay,o=this._grip;return e&&(a!==null&&(r=t.getPose(e.targetRaySpace,n),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))),o!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)))),a!==null&&(a.visible=r!==null),o!==null&&(o.visible=i!==null),this}}),Object.assign(bn.prototype,y.prototype),Object.assign(Cn.prototype,{isFogExp2:!0,clone:function(){return new Cn(this.color,this.density)},toJSON:function(){return{type:`FogExp2`,color:this.color.getHex(),density:this.density}}}),Object.assign(wn.prototype,{isFog:!0,clone:function(){return new wn(this.color,this.near,this.far)},toJSON:function(){return{type:`Fog`,color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Tn.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.assign(Tn.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},clone:function(){return new this.constructor().copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}}),Du=new D,Object.defineProperties(En.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(En.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)Du.x=this.getX(t),Du.y=this.getY(t),Du.z=this.getZ(t),Du.applyMatrix4(e),this.setXYZ(t,Du.x,Du.y,Du.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this},clone:function(){console.log(`THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.`);for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return new H(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log(`THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.`);for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}),Dn.prototype=Object.create(V.prototype),Dn.prototype.constructor=Dn,Dn.prototype.isSpriteMaterial=!0,Dn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this},ku=new D,Au=new D,ju=new D,Mu=new b,Nu=new b,Pu=new O,Fu=new D,Iu=new D,Lu=new D,Ru=new b,zu=new b,Bu=new b,On.prototype=Object.assign(Object.create(j.prototype),{constructor:On,isSprite:!0,raycast:function(e,t){e.camera===null&&console.error(`THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),Au.setFromMatrixScale(this.matrixWorld),Pu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ju.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Au.multiplyScalar(-ju.z);var n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));var a=this.center;kn(Fu.set(-.5,-.5,0),ju,a,Au,r,i),kn(Iu.set(.5,-.5,0),ju,a,Au,r,i),kn(Lu.set(.5,.5,0),ju,a,Au,r,i),Ru.set(0,0),zu.set(1,0),Bu.set(1,1);var o=e.ray.intersectTriangle(Fu,Iu,Lu,!1,ku);if(!(o===null&&(kn(Iu.set(-.5,.5,0),ju,a,Au,r,i),zu.set(0,1),o=e.ray.intersectTriangle(Fu,Lu,Iu,!1,ku),o===null))){var s=e.ray.origin.distanceTo(ku);s<e.near||s>e.far||t.push({distance:s,point:ku.clone(),uv:R.getUV(ku,Fu,Iu,Lu,Ru,zu,Bu,new b),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return j.prototype.copy.call(this,e),e.center!==void 0&&this.center.copy(e.center),this}}),Vu=new D,Hu=new D,An.prototype=Object.assign(Object.create(j.prototype),{constructor:An,isLOD:!0,copy:function(e){j.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){t===void 0&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){Vu.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Vu);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){Vu.setFromMatrixPosition(e.matrixWorld),Hu.setFromMatrixPosition(this.matrixWorld);var n=Vu.distanceTo(Hu)/e.zoom;t[0].object.visible=!0;for(var r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),jn.prototype=Object.assign(Object.create(de.prototype),{constructor:jn,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new C,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i===1/0?e.set(1,0,0,0):e.multiplyScalar(i),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){de.prototype.updateMatrixWorld.call(this,e),this.bindMode===`attached`?this.bindMatrixInverse.getInverse(this.matrixWorld):this.bindMode===`detached`?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn(`THREE.SkinnedMesh: Unrecognized bindMode: `+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:function(){var e=new D,t=new C,n=new C,r=new D,i=new O;return function(a,o){var s=this.skeleton,c=this.geometry;t.fromBufferAttribute(c.attributes.skinIndex,a),n.fromBufferAttribute(c.attributes.skinWeight,a),e.fromBufferAttribute(c.attributes.position,a).applyMatrix4(this.bindMatrix),o.set(0,0,0);for(var l=0;l<4;l++){var u=n.getComponent(l);if(u!==0){var d=t.getComponent(l);i.multiplyMatrices(s.bones[d].matrixWorld,s.boneInverses[d]),o.addScaledVector(r.copy(e).applyMatrix4(i),u)}}return o.applyMatrix4(this.bindMatrixInverse)}}()}),Uu=new O,Wu=new O,Object.assign(Mn.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new O;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:Wu;Uu.multiplyMatrices(o,t[i]),Uu.toArray(n,i*16)}r!==void 0&&(r.needsUpdate=!0)},clone:function(){return new Mn(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),Nn.prototype=Object.assign(Object.create(j.prototype),{constructor:Nn,isBone:!0}),Gu=new O,Ku=new O,qu=[],Ju=new de,Pn.prototype=Object.assign(Object.create(de.prototype),{constructor:Pn,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,e*16)},raycast:function(e,t){var n=this.matrixWorld,r=this.count;if(Ju.geometry=this.geometry,Ju.material=this.material,Ju.material!==void 0)for(var i=0;i<r;i++){this.getMatrixAt(i,Gu),Ku.multiplyMatrices(n,Gu),Ju.matrixWorld=Ku,Ju.raycast(e,qu);for(var a=0,o=qu.length;a<o;a++){var s=qu[a];s.instanceId=i,s.object=this,t.push(s)}qu.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,e*16)},updateMorphTargets:function(){}}),Fn.prototype=Object.create(V.prototype),Fn.prototype.constructor=Fn,Fn.prototype.isLineBasicMaterial=!0,Fn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this},Yu=new D,Xu=new D,Zu=new O,Qu=new I,$u=new F,In.prototype=Object.assign(Object.create(j.prototype),{constructor:In,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)Yu.fromBufferAttribute(t,r-1),Xu.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Yu.distanceTo(Xu);e.setAttribute(`lineDistance`,new K(n,1))}else console.warn(`THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);else if(e.isGeometry){var a=e.vertices,n=e.lineDistances;n[0]=0;for(var r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this},raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),$u.copy(n.boundingSphere),$u.applyMatrix4(r),$u.radius+=i,e.ray.intersectsSphere($u)!==!1){Zu.getInverse(r),Qu.copy(e.ray).applyMatrix4(Zu);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new D,c=new D,l=new D,u=new D,d=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var f=n.index,p=n.attributes.position.array;if(f!==null)for(var m=f.array,h=0,g=m.length-1;h<g;h+=d){var _=m[h],v=m[h+1];s.fromArray(p,_*3),c.fromArray(p,v*3);var y=Qu.distanceSqToSegment(s,c,u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}else for(var h=0,g=p.length/3-1;h<g;h+=d){s.fromArray(p,3*h),c.fromArray(p,3*h+3);var y=Qu.distanceSqToSegment(s,c,u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}}else if(n.isGeometry)for(var x=n.vertices,S=x.length,h=0;h<S-1;h+=d){var y=Qu.distanceSqToSegment(x[h],x[h+1],u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ed=new D,td=new D,Ln.prototype=Object.assign(Object.create(In.prototype),{constructor:Ln,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)ed.fromBufferAttribute(t,r),td.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ed.distanceTo(td);e.setAttribute(`lineDistance`,new K(n,1))}else console.warn(`THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);else if(e.isGeometry)for(var a=e.vertices,n=e.lineDistances,r=0,i=a.length;r<i;r+=2)ed.copy(a[r]),td.copy(a[r+1]),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ed.distanceTo(td);return this}}),Rn.prototype=Object.assign(Object.create(In.prototype),{constructor:Rn,isLineLoop:!0}),zn.prototype=Object.create(V.prototype),zn.prototype.constructor=zn,zn.prototype.isPointsMaterial=!0,zn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this},nd=new O,rd=new I,id=new F,ad=new D,Bn.prototype=Object.assign(Object.create(j.prototype),{constructor:Bn,isPoints:!0,raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),id.copy(n.boundingSphere),id.applyMatrix4(r),id.radius+=i,e.ray.intersectsSphere(id)!==!1){nd.getInverse(r),rd.copy(e.ray).applyMatrix4(nd);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes.position.array;if(s!==null)for(var l=s.array,u=0,d=l.length;u<d;u++){var f=l[u];ad.fromArray(c,f*3),Vn(ad,f,o,r,e,t,this)}else for(var u=0,p=c.length/3;u<p;u++)ad.fromArray(c,u*3),Vn(ad,u,o,r,e,t,this)}else for(var m=n.vertices,u=0,p=m.length;u<p;u++)Vn(m[u],u,o,r,e,t,this)}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Hn.prototype=Object.assign(Object.create(S.prototype),{constructor:Hn,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Un.prototype=Object.create(S.prototype),Un.prototype.constructor=Un,Un.prototype.isCompressedTexture=!0,Wn.prototype=Object.create(S.prototype),Wn.prototype.constructor=Wn,Wn.prototype.isCanvasTexture=!0,Gn.prototype=Object.create(S.prototype),Gn.prototype.constructor=Gn,Gn.prototype.isDepthTexture=!0,Kn.prototype=Object.create(q.prototype),Kn.prototype.constructor=Kn,qn.prototype=Object.create(J.prototype),qn.prototype.constructor=qn,Jn.prototype=Object.create(q.prototype),Jn.prototype.constructor=Jn,Yn.prototype=Object.create(J.prototype),Yn.prototype.constructor=Yn,Xn.prototype=Object.create(q.prototype),Xn.prototype.constructor=Xn,Zn.prototype=Object.create(J.prototype),Zn.prototype.constructor=Zn,Qn.prototype=Object.create(Xn.prototype),Qn.prototype.constructor=Qn,$n.prototype=Object.create(J.prototype),$n.prototype.constructor=$n,er.prototype=Object.create(Xn.prototype),er.prototype.constructor=er,tr.prototype=Object.create(J.prototype),tr.prototype.constructor=tr,nr.prototype=Object.create(Xn.prototype),nr.prototype.constructor=nr,rr.prototype=Object.create(J.prototype),rr.prototype.constructor=rr,ir.prototype=Object.create(Xn.prototype),ir.prototype.constructor=ir,ar.prototype=Object.create(J.prototype),ar.prototype.constructor=ar,or.prototype=Object.create(q.prototype),or.prototype.constructor=or,or.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},sr.prototype=Object.create(J.prototype),sr.prototype.constructor=sr,cr.prototype=Object.create(q.prototype),cr.prototype.constructor=cr,lr.prototype=Object.create(J.prototype),lr.prototype.constructor=lr,ur.prototype=Object.create(q.prototype),ur.prototype.constructor=ur,od={triangulate:function(e,t,n){n=n||2;var r=t&&t.length,i=r?t[0]*n:e.length,a=dr(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;var s,c,l,u,d,f,p;if(r&&(a=vr(e,t,a,n)),e.length>80*n){s=l=e[0],c=u=e[1];for(var m=n;m<i;m+=n)d=e[m],f=e[m+1],d<s&&(s=d),f<c&&(c=f),d>l&&(l=d),f>u&&(u=f);p=Math.max(l-s,u-c),p=p===0?0:1/p}return pr(a,o,n,s,c,p),o}},sd={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5},isClockWise:function(e){return sd.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];Hr(e),Ur(n,e);var a=e.length;t.forEach(Hr);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Ur(n,t[o]);for(var s=od.triangulate(n,r),o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}},Wr.prototype=Object.create(J.prototype),Wr.prototype.constructor=Wr,Wr.prototype.toJSON=function(){var e=J.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return Kr(t,n,e)},Gr.prototype=Object.create(q.prototype),Gr.prototype.constructor=Gr,Gr.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return Kr(t,n,e)},cd={generateTopUV:function(e,t,n,r,i){var a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new b(a,o),new b(s,c),new b(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<.01?[new b(o,1-c),new b(l,1-d),new b(f,1-m),new b(h,1-_)]:[new b(s,1-c),new b(u,1-d),new b(p,1-m),new b(g,1-_)]}},qr.prototype=Object.create(J.prototype),qr.prototype.constructor=qr,Jr.prototype=Object.create(Gr.prototype),Jr.prototype.constructor=Jr,Yr.prototype=Object.create(J.prototype),Yr.prototype.constructor=Yr,Xr.prototype=Object.create(q.prototype),Xr.prototype.constructor=Xr,Zr.prototype=Object.create(J.prototype),Zr.prototype.constructor=Zr,Qr.prototype=Object.create(q.prototype),Qr.prototype.constructor=Qr,$r.prototype=Object.create(J.prototype),$r.prototype.constructor=$r,ei.prototype=Object.create(q.prototype),ei.prototype.constructor=ei,ti.prototype=Object.create(J.prototype),ti.prototype.constructor=ti,ti.prototype.toJSON=function(){var e=J.prototype.toJSON.call(this),t=this.parameters.shapes;return ri(t,e)},ni.prototype=Object.create(q.prototype),ni.prototype.constructor=ni,ni.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this),t=this.parameters.shapes;return ri(t,e)},ii.prototype=Object.create(q.prototype),ii.prototype.constructor=ii,ai.prototype=Object.create(J.prototype),ai.prototype.constructor=ai,oi.prototype=Object.create(q.prototype),oi.prototype.constructor=oi,si.prototype=Object.create(ai.prototype),si.prototype.constructor=si,ci.prototype=Object.create(oi.prototype),ci.prototype.constructor=ci,li.prototype=Object.create(J.prototype),li.prototype.constructor=li,ui.prototype=Object.create(q.prototype),ui.prototype.constructor=ui,ld=Object.freeze({__proto__:null,WireframeGeometry:Kn,ParametricGeometry:qn,ParametricBufferGeometry:Jn,TetrahedronGeometry:Zn,TetrahedronBufferGeometry:Qn,OctahedronGeometry:$n,OctahedronBufferGeometry:er,IcosahedronGeometry:tr,IcosahedronBufferGeometry:nr,DodecahedronGeometry:rr,DodecahedronBufferGeometry:ir,PolyhedronGeometry:Yn,PolyhedronBufferGeometry:Xn,TubeGeometry:ar,TubeBufferGeometry:or,TorusKnotGeometry:sr,TorusKnotBufferGeometry:cr,TorusGeometry:lr,TorusBufferGeometry:ur,TextGeometry:qr,TextBufferGeometry:Jr,SphereGeometry:Yr,SphereBufferGeometry:Xr,RingGeometry:Zr,RingBufferGeometry:Qr,PlaneGeometry:Te,PlaneBufferGeometry:Ee,LatheGeometry:$r,LatheBufferGeometry:ei,ShapeGeometry:ti,ShapeBufferGeometry:ni,ExtrudeGeometry:Wr,ExtrudeBufferGeometry:Gr,EdgesGeometry:ii,ConeGeometry:si,ConeBufferGeometry:ci,CylinderGeometry:ai,CylinderBufferGeometry:oi,CircleGeometry:li,CircleBufferGeometry:ui,BoxGeometry:eu,BoxBufferGeometry:tu}),di.prototype=Object.create(V.prototype),di.prototype.constructor=di,di.prototype.isShadowMaterial=!0,di.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this},fi.prototype=Object.create(ge.prototype),fi.prototype.constructor=fi,fi.prototype.isRawShaderMaterial=!0,pi.prototype=Object.create(V.prototype),pi.prototype.constructor=pi,pi.prototype.isMeshStandardMaterial=!0,pi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},mi.prototype=Object.create(pi.prototype),mi.prototype.constructor=mi,mi.prototype.isMeshPhysicalMaterial=!0,mi.prototype.copy=function(e){return pi.prototype.copy.call(this,e),this.defines={STANDARD:``,PHYSICAL:``},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new z).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},hi.prototype=Object.create(V.prototype),hi.prototype.constructor=hi,hi.prototype.isMeshPhongMaterial=!0,hi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},gi.prototype=Object.create(V.prototype),gi.prototype.constructor=gi,gi.prototype.isMeshToonMaterial=!0,gi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},_i.prototype=Object.create(V.prototype),_i.prototype.constructor=_i,_i.prototype.isMeshNormalMaterial=!0,_i.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},vi.prototype=Object.create(V.prototype),vi.prototype.constructor=vi,vi.prototype.isMeshLambertMaterial=!0,vi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},yi.prototype=Object.create(V.prototype),yi.prototype.constructor=yi,yi.prototype.isMeshMatcapMaterial=!0,yi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.defines={MATCAP:``},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},bi.prototype=Object.create(Fn.prototype),bi.prototype.constructor=bi,bi.prototype.isLineDashedMaterial=!0,bi.prototype.copy=function(e){return Fn.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},ud=Object.freeze({__proto__:null,ShadowMaterial:di,SpriteMaterial:Dn,RawShaderMaterial:fi,ShaderMaterial:ge,PointsMaterial:zn,MeshPhysicalMaterial:mi,MeshStandardMaterial:pi,MeshPhongMaterial:hi,MeshToonMaterial:gi,MeshNormalMaterial:_i,MeshLambertMaterial:vi,MeshDepthMaterial:dn,MeshDistanceMaterial:fn,MeshBasicMaterial:re,MeshMatcapMaterial:yi,LineDashedMaterial:bi,LineBasicMaterial:Fn,Material:V}),dd={arraySlice:function(e,t,n){return dd.isTypedArray(e)?new e.constructor(e.subarray(t,n===void 0?e.length:n)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,n){return e[t]-e[n]}for(var n=e.length,r=Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(t),r},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,c=0;c!==t;++c)i[o++]=e[s+c];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];a!==void 0&&a[r]===void 0;)a=e[i++];if(a!==void 0){var o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push.apply(n,o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}},subclip:function(e,t,n,r,i){i=i||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],d=[],f=0;f<c.times.length;++f){var p=c.times[f]*i;if(!(p<n||p>=r)){u.push(c.times[f]);for(var m=0;m<l;++m)d.push(c.values[f*l+m])}}u.length!==0&&(c.times=dd.convertArray(u,c.times.constructor),c.values=dd.convertArray(d,c.values.constructor),o.push(c))}a.tracks=o;for(var h=1/0,s=0;s<a.tracks.length;++s)h>a.tracks[s].times[0]&&(h=a.tracks[s].times[0]);for(var s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*h);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,r){t===void 0&&(t=0),n===void 0&&(n=e),(r===void 0||r<=0)&&(r=30);for(var i=e.tracks.length,a=t/r,o=0;o<i;++o){var s=n.tracks[o],c=s.ValueTypeName;if(!(c===`bool`||c===`string`)){var l=e.tracks.find(function(e){return e.name===s.name&&e.ValueTypeName===c});if(l!==void 0){var u=s.getValueSize(),d=s.times.length-1,f;if(a<=s.times[0])f=dd.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[d]){var p=d*u;f=dd.arraySlice(s.values,p)}else{var m=s.createInterpolant();m.evaluate(a),f=m.resultBuffer}c===`quaternion`&&new E(f[0],f[1],f[2],f[3]).normalize().conjugate().toArray(f);for(var h=l.times.length,g=0;g<h;++g){var _=g*u;if(c===`quaternion`)E.multiplyQuaternionsFlat(l.values,_,f,0,l.values,_);else for(var v=0;v<u;++v)l.values[_+v]-=f[v]}}}}return e.blendMode=Qs,e}},Object.assign(xi.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{var a;linear_scan:{forward_scan:if(!(e<r)){for(var o=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){var s=t[1];e<s&&(n=2,i=s);for(var o=n-2;;){if(i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(r===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw Error(`call to abstract method`)},intervalChanged_:function(){}}),Object.assign(xi.prototype,{beforeStart_:xi.prototype.copySampleValue_,afterEnd_:xi.prototype.copySampleValue_}),Si.prototype=Object.assign(Object.create(xi.prototype),{constructor:Si,DefaultSettings_:{endingStart:Js,endingEnd:Js},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ys:i=e,o=2*t-n;break;case Xs:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case Ys:a=e,s=2*n-t;break;case Xs:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m,b=0;b!==o;++b)i[b]=g*a[l+b]+_*a[c+b]+v*a[s+b]+y*a[u+b];return i}}),Ci.prototype=Object.assign(Object.create(xi.prototype),{constructor:Ci,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l,d=0;d!==o;++d)i[d]=a[c+d]*u+a[s+d]*l;return i}}),wi.prototype=Object.assign(Object.create(xi.prototype),{constructor:wi,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(Ti,{toJSON:function(e){var t=e.constructor,n;if(t.toJSON!==void 0)n=t.toJSON(e);else{n={name:e.name,times:dd.convertArray(e.times,Array),values:dd.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}}),Object.assign(Ti.prototype,{constructor:Ti,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Ks,InterpolantFactoryMethodDiscrete:function(e){return new wi(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Ci(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Si(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Gs:t=this.InterpolantFactoryMethodDiscrete;break;case Ks:t=this.InterpolantFactoryMethodLinear;break;case qs:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){var n=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(n);return console.warn(`THREE.KeyframeTrack:`,n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Gs;case this.InterpolantFactoryMethodLinear:return Ks;case this.InterpolantFactoryMethodSmooth:return qs}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(e!==0)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(e!==1)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);var o=this.getValueSize();this.times=dd.arraySlice(n,i,a),this.values=dd.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);var n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if(typeof s==`number`&&isNaN(s)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,o,s),e=!1;break}if(a!==null&&a>s){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,o,s,a),e=!1;break}a=s}if(r!==void 0&&dd.isTypedArray(r))for(var o=0,c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,o,l),e=!1;break}}return e},optimize:function(){for(var e=dd.arraySlice(this.times),t=dd.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===qs,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(o!==1||c!==c[0]))if(r)s=!0;else for(var l=o*n,u=l-n,d=l+n,f=0;f!==n;++f){var p=t[l+f];if(p!==t[u+f]||p!==t[d+f]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];for(var m=o*n,h=i*n,f=0;f!==n;++f)t[h+f]=t[m+f]}++i}}if(a>0){e[i]=e[a];for(var m=a*n,h=i*n,f=0;f!==n;++f)t[h+f]=t[m+f];++i}return i===e.length?(this.times=e,this.values=t):(this.times=dd.arraySlice(e,0,i),this.values=dd.arraySlice(t,0,i*n)),this},clone:function(){var e=dd.arraySlice(this.times,0),t=dd.arraySlice(this.values,0),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}),Ei.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Ei,ValueTypeName:`bool`,ValueBufferType:Array,DefaultInterpolation:Gs,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Di.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Di,ValueTypeName:`color`}),Oi.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Oi,ValueTypeName:`number`}),ki.prototype=Object.assign(Object.create(xi.prototype),{constructor:ki,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(r-t),l=s+o;s!==l;s+=4)E.slerpFlat(i,0,a,s-o,a,s,c);return i}}),Ai.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Ai,ValueTypeName:`quaternion`,DefaultInterpolation:Ks,InterpolantFactoryMethodLinear:function(e){return new ki(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),ji.prototype=Object.assign(Object.create(Ti.prototype),{constructor:ji,ValueTypeName:`string`,ValueBufferType:Array,DefaultInterpolation:Gs,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Mi.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Mi,ValueTypeName:`vector`}),Object.assign(Ni,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Fi(n[i]).scale(r));return new Ni(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(Ti.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=dd.getKeyframeOrder(s);s=dd.sortedArray(s,1,l),c=dd.sortedArray(c,1,l),!r&&s[0]===0&&(s.push(i),c.push(c[0])),a.push(new Oi(`.morphTargetInfluences[`+t[o].name+`]`,s,c).scale(1/n))}return new Ni(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\\w-]*?)([\\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(i);if(c&&c.length>1){var l=c[1],u=r[l];u||(r[l]=u=[]),u.push(s)}}var d=[];for(var l in r)d.push(Ni.CreateFromMorphTargetSequence(l,r[l],t,n));return d},parseAnimation:function(e,t){if(!e)return console.error(`THREE.AnimationClip: No animation in JSONLoader data.`),null;for(var n=function(e,t,n,r,i){if(n.length!==0){var a=[],o=[];dd.flattenJSON(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.length||-1,o=e.fps||30,s=e.blendMode,c=e.hierarchy||[],l=0;l<c.length;l++){var u=c[l].keys;if(!(!u||u.length===0))if(u[0].morphTargets){for(var d={},f=0;f<u.length;f++)if(u[f].morphTargets)for(var p=0;p<u[f].morphTargets.length;p++)d[u[f].morphTargets[p]]=-1;for(var m in d){for(var h=[],g=[],p=0;p!==u[f].morphTargets.length;++p){var _=u[f];h.push(_.time),g.push(+(_.morphTarget===m))}r.push(new Oi(`.morphTargetInfluence[`+m+`]`,h,g))}a=d.length*(o||1)}else{var v=`.bones[`+t[l].name+`]`;n(Mi,v+`.position`,u,`pos`,r),n(Ai,v+`.quaternion`,u,`rot`,r),n(Mi,v+`.scale`,u,`scl`,r)}}return r.length===0?null:new Ni(i,a,r,s)}}),Object.assign(Ni.prototype,{resetDuration:function(){for(var e=this.tracks,t=0,n=0,r=e.length;n!==r;++n){var i=this.tracks[n];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Ni(this.name,this.duration,e,this.blendMode)}}),fd={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){if(this.enabled!==!1)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},pd=new Ii,Object.assign(Li.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise(function(r,i){n.load(e,r,t,i)})},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),md={},Ri.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ri,load:function(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;if(md[e]!==void 0){md[e].push({onLoad:t,onProgress:n,onError:r});return}var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],l=o[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var u,d=(this.responseType||``).toLowerCase();switch(d){case`arraybuffer`:case`blob`:for(var f=new Uint8Array(l.length),p=0;p<l.length;p++)f[p]=l.charCodeAt(p);u=d===`blob`?new Blob([f.buffer],{type:s}):f.buffer;break;case`document`:u=new DOMParser().parseFromString(l,s);break;case`json`:u=JSON.parse(l);break;default:u=l;break}setTimeout(function(){t&&t(u),i.manager.itemEnd(e)},0)}catch(t){setTimeout(function(){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)},0)}}else{md[e]=[],md[e].push({onLoad:t,onProgress:n,onError:r});var m=new XMLHttpRequest;for(var h in m.open(`GET`,e,!0),m.addEventListener(`load`,function(t){var n=this.response,r=md[e];if(delete md[e],this.status===200||this.status===0){this.status===0&&console.warn(`THREE.FileLoader: HTTP Status 0 received.`),fd.add(e,n);for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onLoad&&s.onLoad(n)}i.manager.itemEnd(e)}else{for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onError&&s.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}},!1),m.addEventListener(`progress`,function(t){for(var n=md[e],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(t)}},!1),m.addEventListener(`error`,function(t){var n=md[e];delete md[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),m.addEventListener(`abort`,function(t){var n=md[e];delete md[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),this.responseType!==void 0&&(m.responseType=this.responseType),this.withCredentials!==void 0&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(this.mimeType===void 0?`text/plain`:this.mimeType),this.requestHeader)m.setRequestHeader(h,this.requestHeader[h]);m.send(null)}return i.manager.itemStart(e),m},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),zi.prototype=Object.assign(Object.create(Li.prototype),{constructor:zi,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var r=Ni.parse(e[n]);t.push(r)}return t}}),Bi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Bi,load:function(e,t,n,r){var i=this,a=[],o=new Un;o.image=a;var s=new Ri(this.manager);s.setPath(this.path),s.setResponseType(`arraybuffer`);function c(c){s.load(e[c],function(e){var n=i.parse(e,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,l===6&&(n.mipmapCount===1&&(o.minFilter=Ko),o.format=n.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(Array.isArray(e))for(var l=0,u=0,d=e.length;u<d;++u)c(u);else s.load(e,function(e){var n=i.parse(e,!0);if(n.isCubemap)for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;n.mipmapCount===1&&(o.minFilter=Ko),o.format=n.format,o.needsUpdate=!0,t&&t(o)},n,r);return o}}),Vi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Vi,load:function(e,t,n,r){var i=this,a=new xe,o=new Ri(this.manager);return o.setResponseType(`arraybuffer`),o.setPath(this.path),o.load(e,function(e){var n=i.parse(e);n&&(n.image===void 0?n.data!==void 0&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data):a.image=n.image,a.wrapS=n.wrapS===void 0?Vo:n.wrapS,a.wrapT=n.wrapT===void 0?Vo:n.wrapT,a.magFilter=n.magFilter===void 0?Ko:n.magFilter,a.minFilter=n.minFilter===void 0?Ko:n.minFilter,a.anisotropy=n.anisotropy===void 0?1:n.anisotropy,n.format!==void 0&&(a.format=n.format),n.type!==void 0&&(a.type=n.type),n.mipmaps!==void 0&&(a.mipmaps=n.mipmaps,a.minFilter=Jo),n.mipmapCount===1&&(a.minFilter=Ko),a.needsUpdate=!0,t&&t(a,n))},n,r),a}}),Hi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Hi,load:function(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;var o=document.createElementNS(`http://www.w3.org/1999/xhtml`,`img`);function s(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1),fd.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.substr(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}),Ui.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ui,load:function(e,t,n,r){var i=new Re,a=new Hi(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],function(e){i.images[n]=e,o++,o===6&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}for(var c=0;c<e.length;++c)s(c);return i}}),Wi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Wi,load:function(e,t,n,r){var i=new S,a=new Hi(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(n){i.image=n,i.format=e.search(/\\.jpe?g($|\\?)/i)>0||e.search(/^data\\:image\\/jpeg/)===0?$o:es,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}}),Object.assign(Y.prototype,{getPoint:function(){return console.warn(`THREE.Curve: .getPoint() not implemented.`),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e===void 0&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t=[],n,r=this.getPoint(0),i,a=0;for(t.push(0),i=1;i<=e;i++)n=this.getPoint(i/e),a+=n.distanceTo(r),t.push(a),r=n;return this.cacheArcLengths=t,t},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){for(var n=this.getLengths(),r=0,i=n.length,a=t||e*n[i-1],o=0,s=i-1,c;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);var l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)},getTangent:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new b:new D);return s.copy(o).sub(a).normalize(),s},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n=new D,r=[],i=[],a=[],o=new D,s=new O,c,l,u;for(c=0;c<=e;c++)l=c/e,r[c]=this.getTangentAt(l,new D),r[c].normalize();i[0]=new D,a[0]=new D;var d=Number.MAX_VALUE,f=Math.abs(r[0].x),p=Math.abs(r[0].y),m=Math.abs(r[0].z);for(f<=d&&(d=f,n.set(1,0,0)),p<=d&&(d=p,n.set(0,1,0)),m<=d&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]),c=1;c<=e;c++)i[c]=i[c-1].clone(),a[c]=a[c-1].clone(),o.crossVectors(r[c-1],r[c]),o.length()>Number.EPSILON&&(o.normalize(),u=Math.acos(X.clamp(r[c-1].dot(r[c]),-1,1)),i[c].applyMatrix4(s.makeRotationAxis(o,u))),a[c].crossVectors(r[c],i[c]);if(t===!0)for(u=Math.acos(X.clamp(i[0].dot(i[e]),-1,1)),u/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(u=-u),c=1;c<=e;c++)i[c].applyMatrix4(s.makeRotationAxis(r[c],u*c)),a[c].crossVectors(r[c],i[c]);return{tangents:r,normals:i,binormals:a}},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Gi.prototype=Object.create(Y.prototype),Gi.prototype.constructor=Gi,Gi.prototype.isEllipseCurve=!0,Gi.prototype.getPoint=function(e,t){for(var n=t||new b,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=s-this.aX,f=c-this.aY;s=d*l-f*u+this.aX,c=d*u+f*l+this.aY}return n.set(s,c)},Gi.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Gi.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},Gi.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Ki.prototype=Object.create(Gi.prototype),Ki.prototype.constructor=Ki,Ki.prototype.isArcCurve=!0,hd=new D,gd=new qi,_d=new qi,vd=new qi,Ji.prototype=Object.create(Y.prototype),Ji.prototype.constructor=Ji,Ji.prototype.isCatmullRomCurve3=!0,Ji.prototype.getPoint=function(e,t){var n=t||new D,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);var c,l,u,d;if(this.closed||o>0?c=r[(o-1)%i]:(hd.subVectors(r[0],r[1]).add(r[0]),c=hd),l=r[o%i],u=r[(o+1)%i],this.closed||o+2<i?d=r[(o+2)%i]:(hd.subVectors(r[i-1],r[i-2]).add(r[i-1]),d=hd),this.curveType===`centripetal`||this.curveType===`chordal`){var f=this.curveType===`chordal`?.5:.25,p=Math.pow(c.distanceToSquared(l),f),m=Math.pow(l.distanceToSquared(u),f),h=Math.pow(u.distanceToSquared(d),f);m<1e-4&&(m=1),p<1e-4&&(p=m),h<1e-4&&(h=m),gd.initNonuniformCatmullRom(c.x,l.x,u.x,d.x,p,m,h),_d.initNonuniformCatmullRom(c.y,l.y,u.y,d.y,p,m,h),vd.initNonuniformCatmullRom(c.z,l.z,u.z,d.z,p,m,h)}else this.curveType===`catmullrom`&&(gd.initCatmullRom(c.x,l.x,u.x,d.x,this.tension),_d.initCatmullRom(c.y,l.y,u.y,d.y,this.tension),vd.initCatmullRom(c.z,l.z,u.z,d.z,this.tension));return n.set(gd.calc(s),_d.calc(s),vd.calc(s)),n},Ji.prototype.copy=function(e){Y.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Ji.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Ji.prototype.fromJSON=function(e){Y.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new D().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},aa.prototype=Object.create(Y.prototype),aa.prototype.constructor=aa,aa.prototype.isCubicBezierCurve=!0,aa.prototype.getPoint=function(e,t){var n=t||new b,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ia(e,r.x,i.x,a.x,o.x),ia(e,r.y,i.y,a.y,o.y)),n},aa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},aa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},aa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},oa.prototype=Object.create(Y.prototype),oa.prototype.constructor=oa,oa.prototype.isCubicBezierCurve3=!0,oa.prototype.getPoint=function(e,t){var n=t||new D,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ia(e,r.x,i.x,a.x,o.x),ia(e,r.y,i.y,a.y,o.y),ia(e,r.z,i.z,a.z,o.z)),n},oa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},oa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},oa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},sa.prototype=Object.create(Y.prototype),sa.prototype.constructor=sa,sa.prototype.isLineCurve=!0,sa.prototype.getPoint=function(e,t){var n=t||new b;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},sa.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},sa.prototype.getTangent=function(e,t){var n=t||new b,n=n.copy(this.v2).sub(this.v1).normalize();return n},sa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},sa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},sa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ca.prototype=Object.create(Y.prototype),ca.prototype.constructor=ca,ca.prototype.isLineCurve3=!0,ca.prototype.getPoint=function(e,t){var n=t||new D;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},ca.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},ca.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ca.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ca.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},la.prototype=Object.create(Y.prototype),la.prototype.constructor=la,la.prototype.isQuadraticBezierCurve=!0,la.prototype.getPoint=function(e,t){var n=t||new b,r=this.v0,i=this.v1,a=this.v2;return n.set($i(e,r.x,i.x,a.x),$i(e,r.y,i.y,a.y)),n},la.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},la.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},la.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ua.prototype=Object.create(Y.prototype),ua.prototype.constructor=ua,ua.prototype.isQuadraticBezierCurve3=!0,ua.prototype.getPoint=function(e,t){var n=t||new D,r=this.v0,i=this.v1,a=this.v2;return n.set($i(e,r.x,i.x,a.x),$i(e,r.y,i.y,a.y),$i(e,r.z,i.z,a.z)),n},ua.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ua.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ua.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},da.prototype=Object.create(Y.prototype),da.prototype.constructor=da,da.prototype.isSplineCurve=!0,da.prototype.getPoint=function(e,t){var n=t||new b,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Yi(o,s.x,c.x,l.x,u.x),Yi(o,s.y,c.y,l.y,u.y)),n},da.prototype.copy=function(e){Y.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this},da.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e},da.prototype.fromJSON=function(e){Y.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new b().fromArray(r))}return this},yd=Object.freeze({__proto__:null,ArcCurve:Ki,CatmullRomCurve3:Ji,CubicBezierCurve:aa,CubicBezierCurve3:oa,EllipseCurve:Gi,LineCurve:sa,LineCurve3:ca,QuadraticBezierCurve:la,QuadraticBezierCurve3:ua,SplineCurve:da}),fa.prototype=Object.assign(Object.create(Y.prototype),{constructor:fa,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new sa(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=o===0?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){e===void 0&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t=[],n,r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?e*2:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];n&&n.equals(l)||(t.push(l),n=l)}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t},copy:function(e){Y.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Y.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Y.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(new yd[r.type]().fromJSON(r))}return this}}),pa.prototype=Object.assign(Object.create(fa.prototype),{constructor:pa,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new sa(this.currentPoint.clone(),new b(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){var i=new la(this.currentPoint.clone(),new b(e,t),new b(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,a){var o=new aa(this.currentPoint.clone(),new b(e,t),new b(n,r),new b(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(e){var t=new da([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this},absarc:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this},ellipse:function(e,t,n,r,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this},absellipse:function(e,t,n,r,i,a,o,s){var c=new Gi(e,t,n,r,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return fa.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=fa.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return fa.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),ma.prototype=Object.assign(Object.create(pa.prototype),{constructor:ma,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){pa.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=pa.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){pa.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(new pa().fromJSON(r))}return this}}),ha.prototype=Object.assign(Object.create(j.prototype),{constructor:ha,isLight:!0,copy:function(e){return j.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}),ga.prototype=Object.assign(Object.create(ha.prototype),{constructor:ga,isHemisphereLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(_a.prototype,{_projScreenMatrix:new O,_lightPositionWorld:new D,_lookTarget:new D,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e={};return this.bias!==0&&(e.bias=this.bias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),va.prototype=Object.assign(Object.create(_a.prototype),{constructor:va,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=X.RAD2DEG*2*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),_a.prototype.updateMatrices.call(this,e)}}),ya.prototype=Object.assign(Object.create(ha.prototype),{constructor:ya,isSpotLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),ba.prototype=Object.assign(Object.create(_a.prototype),{constructor:ba,isPointLightShadow:!0,updateMatrices:function(e,t){t===void 0&&(t=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),xa.prototype=Object.assign(Object.create(ha.prototype),{constructor:xa,isPointLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Sa.prototype=Object.assign(Object.create(_e.prototype),{constructor:Sa,isOrthographicCamera:!0,copy:function(e,t){return _e.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,o-=l*this.view.offsetY,s=o-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}),Ca.prototype=Object.assign(Object.create(_a.prototype),{constructor:Ca,isDirectionalLightShadow:!0,updateMatrices:function(e){_a.prototype.updateMatrices.call(this,e)}}),wa.prototype=Object.assign(Object.create(ha.prototype),{constructor:wa,isDirectionalLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Ta.prototype=Object.assign(Object.create(ha.prototype),{constructor:Ta,isAmbientLight:!0}),Ea.prototype=Object.assign(Object.create(ha.prototype),{constructor:Ea,isRectAreaLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=ha.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(Da.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t},getIrradianceAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*i),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*r),t.addScaledVector(a[5],2*.429043*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],2*.429043*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return new this.constructor().copy(this)},fromArray:function(e,t){t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}}),Object.assign(Da,{getBasisAt:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}),Oa.prototype=Object.assign(Object.create(ha.prototype),{constructor:Oa,isLightProbe:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=ha.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),ka.prototype=Object.assign(Object.create(Li.prototype),{constructor:ka,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){var t=this.textures;function n(e){return t[e]===void 0&&console.warn(`THREE.MaterialLoader: Undefined texture`,e),t[e]}var r=new ud[e.type];if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=new z().setHex(e.sheen)),e.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular.setHex(e.specular),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==1&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.skinning!==void 0&&(r.skinning=e.skinning),e.morphTargets!==void 0&&(r.morphTargets=e.morphTargets),e.morphNormals!==void 0&&(r.morphNormals=e.morphNormals),e.dithering!==void 0&&(r.dithering=e.dithering),e.vertexTangents!==void 0&&(r.vertexTangents=e.vertexTangents),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors==`number`?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case`t`:r.uniforms[i].value=n(a.value);break;case`c`:r.uniforms[i].value=new z().setHex(a.value);break;case`v2`:r.uniforms[i].value=new b().fromArray(a.value);break;case`v3`:r.uniforms[i].value=new D().fromArray(a.value);break;case`v4`:r.uniforms[i].value=new C().fromArray(a.value);break;case`m3`:r.uniforms[i].value=new x().fromArray(a.value);case`m4`:r.uniforms[i].value=new O().fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(e.shading!==void 0&&(r.flatShading=e.shading===1),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=n(e.map)),e.matcap!==void 0&&(r.matcap=n(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){var s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new b().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=n(e.specularMap)),e.envMap!==void 0&&(r.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new b().fromArray(e.clearcoatNormalScale)),r},setTextures:function(e){return this.textures=e,this}}),bd={decodeText:function(e){if(typeof TextDecoder<`u`)return new TextDecoder().decode(e);for(var t=``,n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){var t=e.lastIndexOf(`/`);return t===-1?`./`:e.substr(0,t+1)}},Aa.prototype=Object.assign(Object.create(q.prototype),{constructor:Aa,isInstancedBufferGeometry:!0,copy:function(e){return q.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e=q.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),ja.prototype=Object.assign(Object.create(H.prototype),{constructor:ja,isInstancedBufferAttribute:!0,copy:function(e){return H.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=H.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),Ma.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ma,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){var t=e.isInstancedBufferGeometry?new Aa:new q,n=e.data.index;if(n!==void 0){var r=new xd[n.type](n.array);t.setIndex(new H(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a],r=new xd[o.type](o.array),s=new(o.isInstancedBufferAttribute?ja:H)(r,o.itemSize,o.normalized);o.name!==void 0&&(s.name=o.name),t.setAttribute(a,s)}var c=e.data.morphAttributes;if(c)for(var a in c){for(var l=c[a],u=[],d=0,f=l.length;d<f;d++){var o=l[d],r=new xd[o.type](o.array),s=new H(r,o.itemSize,o.normalized);o.name!==void 0&&(s.name=o.name),u.push(s)}t.morphAttributes[a]=u}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(p!==void 0)for(var d=0,m=p.length;d!==m;++d){var h=p[d];t.addGroup(h.start,h.count,h.materialIndex)}var g=e.data.boundingSphere;if(g!==void 0){var _=new D;g.center!==void 0&&_.fromArray(g.center),t.boundingSphere=new F(_,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}}),xd={Int8Array,Uint8Array,Uint8ClampedArray:typeof Uint8ClampedArray<`u`?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},Na.prototype=Object.assign(Object.create(Li.prototype),{constructor:Na,load:function(e,t,n,r){var i=this,a=this.path===``?bd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new Ri(i.manager);o.setPath(this.path),o.load(e,function(n){var a=null;try{a=JSON.parse(n)}catch(t){r!==void 0&&r(t),console.error(`THREE:ObjectLoader: Can\'t parse `+e+`.`,t.message);return}var o=a.metadata;if(o===void 0||o.type===void 0||o.type.toLowerCase()===`geometry`){console.error(`THREE.ObjectLoader: Can\'t load `+e);return}i.parse(a,t)},n,r)},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,function(){t!==void 0&&t(s)}),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),(e.images===void 0||e.images.length===0)&&t!==void 0&&t(s),s},parseShape:function(e){var t={};if(e!==void 0)for(var n=0,r=e.length;n<r;n++){var i=new ma().fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(e!==void 0)for(var r=new Ma,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case`PlaneGeometry`:case`PlaneBufferGeometry`:o=new ld[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case`BoxGeometry`:case`BoxBufferGeometry`:case`CubeGeometry`:o=new ld[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case`CircleGeometry`:case`CircleBufferGeometry`:o=new ld[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case`CylinderGeometry`:case`CylinderBufferGeometry`:o=new ld[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case`ConeGeometry`:case`ConeBufferGeometry`:o=new ld[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case`SphereGeometry`:case`SphereBufferGeometry`:o=new ld[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case`DodecahedronGeometry`:case`DodecahedronBufferGeometry`:case`IcosahedronGeometry`:case`IcosahedronBufferGeometry`:case`OctahedronGeometry`:case`OctahedronBufferGeometry`:case`TetrahedronGeometry`:case`TetrahedronBufferGeometry`:o=new ld[s.type](s.radius,s.detail);break;case`RingGeometry`:case`RingBufferGeometry`:o=new ld[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case`TorusGeometry`:case`TorusBufferGeometry`:o=new ld[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case`TorusKnotGeometry`:case`TorusKnotBufferGeometry`:o=new ld[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case`TubeGeometry`:case`TubeBufferGeometry`:o=new ld[s.type](new yd[s.path.type]().fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case`LatheGeometry`:case`LatheBufferGeometry`:o=new ld[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case`PolyhedronGeometry`:case`PolyhedronBufferGeometry`:o=new ld[s.type](s.vertices,s.indices,s.radius,s.details);break;case`ShapeGeometry`:case`ShapeBufferGeometry`:for(var c=[],l=0,u=s.shapes.length;l<u;l++){var d=t[s.shapes[l]];c.push(d)}o=new ld[s.type](c,s.curveSegments);break;case`ExtrudeGeometry`:case`ExtrudeBufferGeometry`:for(var c=[],l=0,u=s.shapes.length;l<u;l++){var d=t[s.shapes[l]];c.push(d)}var f=s.options.extrudePath;f!==void 0&&(s.options.extrudePath=new yd[f.type]().fromJSON(f)),o=new ld[s.type](c,s.options);break;case`BufferGeometry`:case`InstancedBufferGeometry`:o=r.parse(s);break;case`Geometry`:console.error(`THREE.ObjectLoader: Loading "Geometry" is not supported anymore.`);break;default:console.warn(`THREE.ObjectLoader: Unsupported geometry type "`+s.type+`"`);continue}o.uuid=s.uuid,s.name!==void 0&&(o.name=s.name),o.isBufferGeometry===!0&&s.userData!==void 0&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},r={};if(e!==void 0){var i=new ka;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if(s.type===`MultiMaterial`){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];n[u.uuid]===void 0&&(n[u.uuid]=i.parse(u)),c.push(n[u.uuid])}r[s.uuid]=c}else n[s.uuid]===void 0&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=Ni.parse(r);r.uuid!==void 0&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(e){return n.manager.itemStart(e),a.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}if(e!==void 0&&e.length>0){var a=new Hi(new Ii(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.url;if(Array.isArray(l)){r[c.uuid]=[];for(var u=0,d=l.length;u<d;u++){var f=l[u],p=/^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(f)?f:n.resourcePath+f;r[c.uuid].push(i(p))}}else{var p=/^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url;r[c.uuid]=i(p)}}}return r},parseTextures:function(e,t){function n(e,t){return typeof e==`number`?e:(console.warn(`THREE.ObjectLoader.parseTexture: Constant should be in numeric form.`,e),t[e])}var r={};if(e!==void 0)for(var i=0,a=e.length;i<a;i++){var o=e[i];o.image===void 0&&console.warn(`THREE.ObjectLoader: No "image" specified for`,o.uuid),t[o.image]===void 0&&console.warn(`THREE.ObjectLoader: Undefined image`,o.image);var s=Array.isArray(t[o.image])?new Re(t[o.image]):new S(t[o.image]);s.needsUpdate=!0,s.uuid=o.uuid,o.name!==void 0&&(s.name=o.name),o.mapping!==void 0&&(s.mapping=n(o.mapping,Sd)),o.offset!==void 0&&s.offset.fromArray(o.offset),o.repeat!==void 0&&s.repeat.fromArray(o.repeat),o.center!==void 0&&s.center.fromArray(o.center),o.rotation!==void 0&&(s.rotation=o.rotation),o.wrap!==void 0&&(s.wrapS=n(o.wrap[0],Cd),s.wrapT=n(o.wrap[1],Cd)),o.format!==void 0&&(s.format=o.format),o.type!==void 0&&(s.type=o.type),o.encoding!==void 0&&(s.encoding=o.encoding),o.minFilter!==void 0&&(s.minFilter=n(o.minFilter,wd)),o.magFilter!==void 0&&(s.magFilter=n(o.magFilter,wd)),o.anisotropy!==void 0&&(s.anisotropy=o.anisotropy),o.flipY!==void 0&&(s.flipY=o.flipY),o.premultiplyAlpha!==void 0&&(s.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r},parseObject:function(e,t,n){var r;function i(e){return t[e]===void 0&&console.warn(`THREE.ObjectLoader: Undefined geometry`,e),t[e]}function a(e){if(e!==void 0){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var a=e[r];n[a]===void 0&&console.warn(`THREE.ObjectLoader: Undefined material`,a),t.push(n[a])}return t}return n[e]===void 0&&console.warn(`THREE.ObjectLoader: Undefined material`,e),n[e]}}switch(e.type){case`Scene`:r=new M,e.background!==void 0&&Number.isInteger(e.background)&&(r.background=new z(e.background)),e.fog!==void 0&&(e.fog.type===`Fog`?r.fog=new wn(e.fog.color,e.fog.near,e.fog.far):e.fog.type===`FogExp2`&&(r.fog=new Cn(e.fog.color,e.fog.density)));break;case`PerspectiveCamera`:r=new ve(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(r.focus=e.focus),e.zoom!==void 0&&(r.zoom=e.zoom),e.filmGauge!==void 0&&(r.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(r.filmOffset=e.filmOffset),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case`OrthographicCamera`:r=new Sa(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(r.zoom=e.zoom),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case`AmbientLight`:r=new Ta(e.color,e.intensity);break;case`DirectionalLight`:r=new wa(e.color,e.intensity);break;case`PointLight`:r=new xa(e.color,e.intensity,e.distance,e.decay);break;case`RectAreaLight`:r=new Ea(e.color,e.intensity,e.width,e.height);break;case`SpotLight`:r=new ya(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case`HemisphereLight`:r=new ga(e.color,e.groundColor,e.intensity);break;case`LightProbe`:r=new Oa().fromJSON(e);break;case`SkinnedMesh`:console.warn(`THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.`);case`Mesh`:var o=i(e.geometry),s=a(e.material);r=new de(o,s);break;case`InstancedMesh`:var o=i(e.geometry),s=a(e.material),c=e.count,l=e.instanceMatrix;r=new Pn(o,s,c),r.instanceMatrix=new H(new Float32Array(l.array),16);break;case`LOD`:r=new An;break;case`Line`:r=new In(i(e.geometry),a(e.material),e.mode);break;case`LineLoop`:r=new Rn(i(e.geometry),a(e.material));break;case`LineSegments`:r=new Ln(i(e.geometry),a(e.material));break;case`PointCloud`:case`Points`:r=new Bn(i(e.geometry),a(e.material));break;case`Sprite`:r=new On(a(e.material));break;case`Group`:r=new vn;break;default:r=new j}if(r.uuid=e.uuid,e.name!==void 0&&(r.name=e.name),e.matrix===void 0?(e.position!==void 0&&r.position.fromArray(e.position),e.rotation!==void 0&&r.rotation.fromArray(e.rotation),e.quaternion!==void 0&&r.quaternion.fromArray(e.quaternion),e.scale!==void 0&&r.scale.fromArray(e.scale)):(r.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(r.matrixAutoUpdate=e.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)),e.castShadow!==void 0&&(r.castShadow=e.castShadow),e.receiveShadow!==void 0&&(r.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(r.shadow.bias=e.shadow.bias),e.shadow.radius!==void 0&&(r.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&r.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(r.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(r.visible=e.visible),e.frustumCulled!==void 0&&(r.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(r.renderOrder=e.renderOrder),e.userData!==void 0&&(r.userData=e.userData),e.layers!==void 0&&(r.layers.mask=e.layers),e.children!==void 0)for(var u=e.children,d=0;d<u.length;d++)r.add(this.parseObject(u[d],t,n));if(e.type===`LOD`){e.autoUpdate!==void 0&&(r.autoUpdate=e.autoUpdate);for(var f=e.levels,p=0;p<f.length;p++){var m=f[p],h=r.getObjectByProperty(`uuid`,m.object);h!==void 0&&r.addLevel(h,m.distance)}}return r}}),Sd={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Cd={RepeatWrapping:Bo,ClampToEdgeWrapping:Vo,MirroredRepeatWrapping:Ho},wd={NearestFilter:Uo,NearestMipmapNearestFilter:Wo,NearestMipmapLinearFilter:Go,LinearFilter:Ko,LinearMipmapNearestFilter:qo,LinearMipmapLinearFilter:Jo},Pa.prototype=Object.assign(Object.create(Li.prototype),{constructor:Pa,setOptions:function(e){return this.options=e,this},load:function(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;fetch(e).then(function(e){return e.blob()}).then(function(e){return i.options===void 0?createImageBitmap(e):createImageBitmap(e,i.options)}).then(function(n){fd.add(e,n),t&&t(n),i.manager.itemEnd(e)}).catch(function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}}),Object.assign(Fa.prototype,{moveTo:function(e,t){return this.currentPath=new pa,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this},bezierCurveTo:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new ma;a.curves=i.curves,t.push(a)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[i],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=l*(e.x-o.x)-c*(e.y-o.y);if(u===0)return!0;if(u<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var i=sd.isClockWise,a=this.subPaths;if(a.length===0)return[];if(t===!0)return n(a);var o,s,c,l=[];if(a.length===1)return s=a[0],c=new ma,c.curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=e?!u:u;var d=[],f=[],p=[],m=0,h;f[m]=void 0,p[m]=[];for(var g=0,_=a.length;g<_;g++)s=a[g],h=s.getPoints(),o=i(h),o=e?!o:o,o?(!u&&f[m]&&m++,f[m]={s:new ma,p:h},f[m].s.curves=s.curves,u&&m++,p[m]=[]):p[m].push({h:s,p:h[0]});if(!f[0])return n(a);if(f.length>1){for(var v=!1,y=[],b=0,x=f.length;b<x;b++)d[b]=[];for(var b=0,x=f.length;b<x;b++)for(var S=p[b],C=0;C<S.length;C++){for(var w=S[C],T=!0,E=0;E<f.length;E++)r(w.p,f[E].p)&&(b!==E&&y.push({froms:b,tos:E,hole:C}),T?(T=!1,d[E].push(w)):v=!0);T&&d[b].push(w)}y.length>0&&(v||(p=d))}for(var D,g=0,O=f.length;g<O;g++){c=f[g].s,l.push(c),D=p[g];for(var k=0,A=D.length;k<A;k++)c.holes.push(D[k].h)}return l}}),Object.assign(Ia.prototype,{isFont:!0,generateShapes:function(e,t){t===void 0&&(t=100);for(var n=[],r=La(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),za.prototype=Object.assign(Object.create(Li.prototype),{constructor:za,load:function(e,t,n,r){var i=this,a=new Ri(this.manager);a.setPath(this.path),a.load(e,function(e){var n;try{n=JSON.parse(e)}catch(t){console.warn(`THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.`),n=JSON.parse(e.substring(65,e.length-2))}var r=i.parse(n);t&&t(r)},n,r)},parse:function(e){return new Ia(e)}}),Ed={getContext:function(){return Td===void 0&&(Td=new(window.AudioContext||window.webkitAudioContext)),Td},setContext:function(e){Td=e}},Ba.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ba,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setResponseType(`arraybuffer`),a.setPath(i.path),a.load(e,function(n){try{var a=n.slice(0);Ed.getContext().decodeAudioData(a,function(e){t(e)})}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}}),Va.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Va,isHemisphereLightProbe:!0,copy:function(e){return Oa.prototype.copy.call(this,e),this},toJSON:function(e){return Oa.prototype.toJSON.call(this,e)}}),Ha.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Ha,isAmbientLightProbe:!0,copy:function(e){return Oa.prototype.copy.call(this,e),this},toJSON:function(e){return Oa.prototype.toJSON.call(this,e)}}),Dd=new O,Od=new O,Object.assign(Ua.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n=e.projectionMatrix.clone(),r=t.eyeSep/2,i=r*t.near/t.focus,a=t.near*Math.tan(X.DEG2RAD*t.fov*.5)/t.zoom,o,s;Od.elements[12]=-r,Dd.elements[12]=r,o=-a*t.aspect+i,s=a*t.aspect+i,n.elements[0]=2*t.near/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraL.projectionMatrix.copy(n),o=-a*t.aspect-i,s=a*t.aspect-i,n.elements[0]=2*t.near/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Od),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Dd)}}),Object.assign(Wa.prototype,{start:function(){this.startTime=(typeof performance>`u`?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=(typeof performance>`u`?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}),kd=new D,Ad=new E,jd=new D,Md=new D,Ga.prototype=Object.assign(Object.create(j.prototype),{constructor:Ga,getInput:function(){return this.gain},removeFilter:function(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return this.filter===null?this.gain.disconnect(this.context.destination):(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){j.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(kd,Ad,jd),Md.set(0,0,-1).applyQuaternion(Ad),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(kd.x,r),t.positionY.linearRampToValueAtTime(kd.y,r),t.positionZ.linearRampToValueAtTime(kd.z,r),t.forwardX.linearRampToValueAtTime(Md.x,r),t.forwardY.linearRampToValueAtTime(Md.y,r),t.forwardZ.linearRampToValueAtTime(Md.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(kd.x,kd.y,kd.z),t.setOrientation(Md.x,Md.y,Md.z,n.x,n.y,n.z)}}),Ka.prototype=Object.assign(Object.create(j.prototype),{constructor:Ka,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`audioNode`,this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaNode`,this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaStreamNode`,this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType=`buffer`,this.autoplay&&this.play(),this},play:function(e){if(e===void 0&&(e=0),this.isPlaying===!0){console.warn(`THREE.Audio: Audio is already playing.`);return}if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()},pause:function(){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress%=this.duration||this.buffer.duration),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this},stop:function(){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),this.isPlaying===!0?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn(`THREE.Audio: this Audio has no playback control.`),!1):this.loop},setLoop:function(e){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}),Nd=new D,Pd=new E,Fd=new D,Id=new D,qa.prototype=Object.assign(Object.create(Ka.prototype),{constructor:qa,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(j.prototype.updateMatrixWorld.call(this,e),!(this.hasPlaybackControl===!0&&this.isPlaying===!1)){this.matrixWorld.decompose(Nd,Pd,Fd),Id.set(0,0,1).applyQuaternion(Pd);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Nd.x,n),t.positionY.linearRampToValueAtTime(Nd.y,n),t.positionZ.linearRampToValueAtTime(Nd.z,n),t.orientationX.linearRampToValueAtTime(Id.x,n),t.orientationY.linearRampToValueAtTime(Id.y,n),t.orientationZ.linearRampToValueAtTime(Id.z,n)}else t.setPosition(Nd.x,Nd.y,Nd.z),t.setOrientation(Id.x,Id.y,Id.z)}}}),Object.assign(Ja.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(Ya.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(a===0){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{a+=t;var s=t/a;this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=this.valueSize*3;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*4+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){E.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){var a=this._workIndex*i;E.multiplyQuaternionsFlat(e,a,e,t,e,n),E.slerpFlat(e,t,e,t,e,a,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}},_lerpAdditive:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}),Ld=`\\\\[\\\\]\\\\.:\\\\/`,Rd=RegExp(`[`+Ld+`]`,`g`),zd=`[^`+Ld+`]`,Bd=`[^`+Ld.replace(`\\\\.`,``)+`]`,Vd=`((?:WC+[\\\\/:])*)`.replace(`WC`,zd),Hd=`(WCOD+)?`.replace(`WCOD`,Bd),Ud=`(?:\\\\.(WC+)(?:\\\\[(.+)\\\\])?)?`.replace(`WC`,zd),Wd=`\\\\.(WC+)(?:\\\\[(.+)\\\\])?`.replace(`WC`,zd),Gd=RegExp(`^`+Vd+Hd+Ud+Wd+`$`),Kd=[`material`,`materials`,`bones`],Object.assign(Xa.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(Za,{Composite:Xa,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Za.Composite(e,t,n):new Za(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\\s/g,`_`).replace(Rd,``)},parseTrackName:function(e){var t=Gd.exec(e);if(!t)throw Error(`PropertyBinding: Cannot parse trackName: `+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){var i=n.nodeName.substring(r+1);Kd.indexOf(i)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n},findNode:function(e,t){if(!t||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){var r=function(e){for(var n=0;n<e.length;n++){var i=e[n];if(i.name===t||i.uuid===t)return i;var a=r(i.children);if(a)return a}return null},i=r(e.children);if(i)return i}return null}}),Object.assign(Za.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=Za.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error(`THREE.PropertyBinding: Trying to update node for track: `+this.path+` but it wasn\'t found.`);return}if(n){var a=t.objectIndex;switch(n){case`materials`:if(!e.material){console.error(`THREE.PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!e.material.materials){console.error(`THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}e=e.material.materials;break;case`bones`:if(!e.skeleton){console.error(`THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(e[n]===void 0){console.error(`THREE.PropertyBinding: Can not bind to objectName of node undefined.`,this);return}e=e[n]}if(a!==void 0){if(e[a]===void 0){console.error(`THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,e);return}e=e[a]}}var s=e[r];if(s===void 0){var c=t.nodeName;console.error(`THREE.PropertyBinding: Trying to update property for track: `+c+`.`+r+` but it wasn\'t found.`,e);return}var l=this.Versioning.None;this.targetObject=e,e.needsUpdate===void 0?e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate):l=this.Versioning.NeedsUpdate;var u=this.BindingType.Direct;if(i!==void 0){if(r===`morphTargetInfluences`){if(!e.geometry){console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}e.morphTargetDictionary[i]!==void 0&&(i=e.morphTargetDictionary[i])}else{console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.`,this);return}}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else s.fromArray!==void 0&&s.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Za.prototype,{_getValue_unbound:Za.prototype.getValue,_setValue_unbound:Za.prototype.setValue}),Object.assign(Qa.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var d=arguments[l],f=d.uuid,p=r[f];if(p===void 0){p=t++,r[f]=p,e.push(d);for(var m=0,h=s;m!==h;++m)o[m].push(new Za(d,i[m],a[m]))}else if(p<n){c=e[p];var g=--n,_=e[g];r[_.uuid]=p,e[p]=_,r[f]=g,e[g]=d;for(var m=0,h=s;m!==h;++m){var v=o[m],y=v[g],b=v[p];v[p]=y,b===void 0&&(b=new Za(d,i[m],a[m])),v[g]=b}}else e[p]!==c&&console.error(`THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.`)}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(l!==void 0&&l>=t){var u=t++,d=e[u];n[d.uuid]=l,e[l]=d,n[c]=u,e[u]=s;for(var f=0,p=i;f!==p;++f){var m=r[f],h=m[u],g=m[l];m[l]=h,m[u]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=r[c];if(l!==void 0)if(delete r[c],l<n){var u=--n,d=e[u],f=--t,p=e[f];r[d.uuid]=l,e[l]=d,r[p.uuid]=u,e[u]=p,e.pop();for(var m=0,h=a;m!==h;++m){var g=i[m],_=g[u],v=g[f];g[l]=_,g[u]=v,g.pop()}}else{var f=--t,p=e[f];r[p.uuid]=l,e[l]=p,e.pop();for(var m=0,h=a;m!==h;++m){var g=i[m];g[l]=g[f],g.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(r!==void 0)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=Array(c);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(var d=l,f=s.length;d!==f;++d){var p=s[d];u[d]=new Za(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}),Object.assign($a.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}var i=this._startTime;if(i!==null){var a=(e-i)*n;if(a<0||n===0)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Qs:for(var u=0,d=c.length;u!==d;++u)c[u].evaluate(o),l[u].accumulateAdditive(s);break;case Zs:default:for(var u=0,d=c.length;u!==d;++u)c[u].evaluate(o),l[u].accumulate(r,s)}}},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,r=this.loop,i=this._loopCount,a=r===Ws;if(e===0)return i===-1?t:a&&(i&1)==1?n-t:t;if(r===2200){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));handle_stop:{if(t>=n)t=n;else if(t<0)t=0;else{this.time=t;break handle_stop}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e>0?1:-1});else{if(s===1){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:`loop`,action:this,loopDelta:o})}}else this.time=t;if(a&&(i&1)==1)return n-t}return t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=Ys,r.endingEnd=Ys):(e?r.endingStart=this.zeroSlopeAtStart?Ys:Js:r.endingStart=Xs,t?r.endingEnd=this.zeroSlopeAtEnd?Ys:Js:r.endingEnd=Xs)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),eo.prototype=Object.assign(Object.create(y.prototype),{constructor:eo,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];l===void 0&&(l={},c[s]=l);for(var u=0;u!==i;++u){var d=r[u],f=d.name,p=l[f];if(p!==void 0)a[u]=p;else{if(p=a[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,s,f));continue}var m=t&&t._propertyBindings[u].binding.parsedPath;p=new Ya(Za.create(n,f,m),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,f),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return t!==null&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null;var u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],s.length===0&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.referenceCount===0&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;i===void 0&&(i={},r[t]=i),i[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[i],Object.keys(o).length===0&&delete a[r]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new Ci(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var r=t||this._root,i=r.uuid,a=typeof e==`string`?Ni.findByName(r,e):e,o=a===null?e:a.uuid,s=this._actionsByClip[o],c=null;if(n===void 0&&(n=a===null?Zs:a.blendMode),s!==void 0){var l=s.actionByRoot[i];if(l!==void 0&&l.blendMode===n)return l;c=s.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;var u=new $a(this,a,t,n);return this._bindAction(u,c),this._addInactiveAction(u,o,i),u},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i=typeof e==`string`?Ni.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return o===void 0?null:o.actionByRoot[r]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o)t[o]._update(r,e,i,a);for(var s=this._bindings,c=this._nActiveBindings,o=0;o!==c;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(i!==void 0){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];i!==void 0&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(a!==void 0)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),to.prototype.clone=function(){return new to(this.value.clone===void 0?this.value:this.value.clone())},no.prototype=Object.assign(Object.create(Tn.prototype),{constructor:no,isInstancedInterleavedBuffer:!0,copy:function(e){return Tn.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(ro.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error(`THREE.Raycaster: Unsupported camera type.`)},intersectObject:function(e,t,n){var r=n||[];return ao(e,this,r,t),r.sort(io),r},intersectObjects:function(e,t,n){var r=n||[];if(Array.isArray(e)===!1)return console.warn(`THREE.Raycaster.intersectObjects: objects is not an Array.`),r;for(var i=0,a=e.length;i<a;i++)ao(e[i],this,r,t);return r.sort(io),r}}),Object.assign(oo.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(X.clamp(t/this.radius,-1,1))),this}}),Object.assign(so.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}}),qd=new b,Object.assign(co.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=qd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Box2: .getCenter() target is now required`),e=new b),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn(`THREE.Box2: .getSize() target is now required`),e=new b),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return t===void 0&&(console.warn(`THREE.Box2: .getParameter() target is now required`),t=new b),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Box2: .clampPoint() target is now required`),t=new b),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return qd.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Jd=new D,Yd=new D,Object.assign(lo.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Line3: .getCenter() target is now required`),e=new D),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return e===void 0&&(console.warn(`THREE.Line3: .delta() target is now required`),e=new D),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return t===void 0&&(console.warn(`THREE.Line3: .at() target is now required`),t=new D),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Jd.subVectors(e,this.start),Yd.subVectors(this.end,this.start);var n=Yd.dot(Yd),r=Yd.dot(Jd)/n;return t&&(r=X.clamp(r,0,1)),r},closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return n===void 0&&(console.warn(`THREE.Line3: .closestPointToPoint() target is now required`),n=new D),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),uo.prototype=Object.create(j.prototype),uo.prototype.constructor=uo,uo.prototype.isImmediateRenderObject=!0,Xd=new D,fo.prototype=Object.create(j.prototype),fo.prototype.constructor=fo,fo.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},fo.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Xd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Xd),this.color===void 0?this.cone.material.color.copy(this.light.color):this.cone.material.color.set(this.color)},Zd=new D,Qd=new O,$d=new O,mo.prototype=Object.create(Ln.prototype),mo.prototype.constructor=mo,mo.prototype.isSkeletonHelper=!0,mo.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,r=n.getAttribute(`position`);$d.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(Qd.multiplyMatrices($d,o.matrixWorld),Zd.setFromMatrixPosition(Qd),r.setXYZ(a,Zd.x,Zd.y,Zd.z),Qd.multiplyMatrices($d,o.parent.matrixWorld),Zd.setFromMatrixPosition(Qd),r.setXYZ(a+1,Zd.x,Zd.y,Zd.z),a+=2)}n.getAttribute(`position`).needsUpdate=!0,j.prototype.updateMatrixWorld.call(this,e)},ho.prototype=Object.create(de.prototype),ho.prototype.constructor=ho,ho.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},ho.prototype.update=function(){this.color===void 0?this.material.color.copy(this.light.color):this.material.color.set(this.color)},ef=new D,tf=new z,nf=new z,go.prototype=Object.create(j.prototype),go.prototype.constructor=go,go.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},go.prototype.update=function(){var e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{var t=e.geometry.getAttribute(`color`);tf.copy(this.light.color),nf.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?tf:nf;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(ef.setFromMatrixPosition(this.light.matrixWorld).negate())},_o.prototype=Object.assign(Object.create(Ln.prototype),{constructor:_o,copy:function(e){return Ln.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return new this.constructor().copy(this)}}),vo.prototype=Object.create(Ln.prototype),vo.prototype.constructor=vo,rf=new D,af=new D,of=new D,yo.prototype=Object.create(j.prototype),yo.prototype.constructor=yo,yo.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},yo.prototype.update=function(){rf.setFromMatrixPosition(this.light.matrixWorld),af.setFromMatrixPosition(this.light.target.matrixWorld),of.subVectors(af,rf),this.lightPlane.lookAt(af),this.color===void 0?(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)):(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)),this.targetLine.lookAt(af),this.targetLine.scale.z=of.length()},sf=new D,cf=new _e,bo.prototype=Object.create(Ln.prototype),bo.prototype.constructor=bo,bo.prototype.update=function(){var e=this.geometry,t=this.pointMap,n=1,r=1;cf.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),xo(`c`,t,e,cf,0,0,-1),xo(`t`,t,e,cf,0,0,1),xo(`n1`,t,e,cf,-n,-r,-1),xo(`n2`,t,e,cf,n,-r,-1),xo(`n3`,t,e,cf,-n,r,-1),xo(`n4`,t,e,cf,n,r,-1),xo(`f1`,t,e,cf,-n,-r,1),xo(`f2`,t,e,cf,n,-r,1),xo(`f3`,t,e,cf,-n,r,1),xo(`f4`,t,e,cf,n,r,1),xo(`u1`,t,e,cf,n*.7,r*1.1,-1),xo(`u2`,t,e,cf,-n*.7,r*1.1,-1),xo(`u3`,t,e,cf,0,r*2,-1),xo(`cf1`,t,e,cf,-n,0,1),xo(`cf2`,t,e,cf,n,0,1),xo(`cf3`,t,e,cf,0,-r,1),xo(`cf4`,t,e,cf,0,r,1),xo(`cn1`,t,e,cf,-n,0,-1),xo(`cn2`,t,e,cf,n,0,-1),xo(`cn3`,t,e,cf,0,-r,-1),xo(`cn4`,t,e,cf,0,r,-1),e.getAttribute(`position`).needsUpdate=!0},lf=new N,So.prototype=Object.create(Ln.prototype),So.prototype.constructor=So,So.prototype.update=function(e){if(e!==void 0&&console.warn(`THREE.BoxHelper: .update() has no longer arguments.`),this.object!==void 0&&lf.setFromObject(this.object),!lf.isEmpty()){var t=lf.min,n=lf.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}},So.prototype.setFromObject=function(e){return this.object=e,this.update(),this},So.prototype.copy=function(e){return Ln.prototype.copy.call(this,e),this.object=e.object,this},So.prototype.clone=function(){return new this.constructor().copy(this)},Co.prototype=Object.create(Ln.prototype),Co.prototype.constructor=Co,Co.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),j.prototype.updateMatrixWorld.call(this,e))},wo.prototype=Object.create(In.prototype),wo.prototype.constructor=wo,wo.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=+(t<0),this.lookAt(this.plane.normal),j.prototype.updateMatrixWorld.call(this,e)},uf=new D,To.prototype=Object.create(j.prototype),To.prototype.constructor=To,To.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{uf.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(uf,t)}},To.prototype.setLength=function(e,t,n){t===void 0&&(t=.2*e),n===void 0&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},To.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},To.prototype.copy=function(e){return j.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},To.prototype.clone=function(){return new this.constructor().copy(this)},Eo.prototype=Object.create(Ln.prototype),Eo.prototype.constructor=Eo,pf=4,mf=8,hf=Math.pow(2,mf),gf=[.125,.215,.35,.446,.526,.582],_f=mf-pf+1+gf.length,vf=20,yf={[$s]:0,[ec]:1,[nc]:2,[ic]:3,[ac]:4,[oc]:5,[tc]:6},bf=new Sa,{_lodPlanes:xf,_sizeLods:Sf,_sigmas:Cf}=ko(),wf=null,Tf=(1+Math.sqrt(5))/2,Ef=1/Tf,Df=[new D(1,1,1),new D(-1,1,1),new D(1,1,-1),new D(-1,1,-1),new D(0,Tf,Ef),new D(0,Tf,-Ef),new D(Ef,0,Tf),new D(-Ef,0,Tf),new D(Tf,Ef,0),new D(-Tf,Ef,0)],Do.prototype={constructor:Do,fromScene:function(e,t=0,n=.1,r=100){wf=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i},fromEquirectangular:function(e){return e.magFilter=Uo,e.minFilter=Uo,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){wf=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t},compileCubemapShader:function(){this._cubemapShader===null&&(this._cubemapShader=Po(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){this._equirectShader===null&&(this._equirectShader=No(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(var e=0;e<xf.length;e++)xf[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(wf),e.scissorTest=!1,e.setSize(e.width,e.height)},_allocateTargets:function(e){var t={magFilter:Uo,minFilter:Uo,generateMipmaps:!1,type:Yo,format:ts,encoding:Oo(e)?e.encoding:nc,depthBuffer:!1,stencilBuffer:!1},n=Ao(t);return n.depthBuffer=!e,this._pingPongRenderTarget=Ao(t),n},_compileMaterial:function(e){var t=new de(xf[0],e);this._renderer.compile(t,bf)},_sceneToCubeUV:function(e,t,n,r){var i=new ve(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,c=s.outputEncoding,l=s.toneMapping,u=s.toneMappingExposure,d=s.getClearColor(),f=s.getClearAlpha();s.toneMapping=1,s.toneMappingExposure=1,s.outputEncoding=$s;var p=e.background;if(p&&p.isColor){p.convertSRGBToLinear();var m=Math.max(p.r,p.g,p.b),h=Math.min(Math.max(Math.ceil(Math.log2(m)),-128),127);p=p.multiplyScalar(Math.pow(2,-h));var g=(h+128)/255;s.setClearColor(p,g),e.background=null}for(var _=0;_<6;_++){var v=_%3;v==0?(i.up.set(0,a[_],0),i.lookAt(o[_],0,0)):v==1?(i.up.set(0,0,a[_]),i.lookAt(0,o[_],0)):(i.up.set(0,a[_],0),i.lookAt(0,0,o[_])),jo(r,v*hf,_>2?hf:0,hf,hf),s.setRenderTarget(r),s.render(e,i)}s.toneMapping=l,s.toneMappingExposure=u,s.outputEncoding=c,s.setClearColor(d,f)},_textureToCubeUV:function(e,t){var n=this._renderer;e.isCubeTexture?this._cubemapShader==null&&(this._cubemapShader=Po()):this._equirectShader==null&&(this._equirectShader=No());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new de(xf[0],r),a=r.uniforms;a.envMap.value=e,e.isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=yf[e.encoding],a.outputEncoding.value=yf[t.texture.encoding],jo(t,0,0,3*hf,2*hf),n.setRenderTarget(t),n.render(i,bf)},_applyPMREM:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<_f;r++){var i=Math.sqrt(Cf[r]*Cf[r]-Cf[r-1]*Cf[r-1]),a=Df[(r-1)%Df.length];this._blur(e,r-1,r,i,a)}t.autoClear=n},_blur:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,`latitudinal`,i),this._halfBlur(a,e,n,n,r,`longitudinal`,i)},_halfBlur:function(e,t,n,r,i,a,o){var s=this._renderer,c=this._blurMaterial;a!==`latitudinal`&&a!==`longitudinal`&&console.error(`blur direction must be either latitudinal or longitudinal!`);var l=3,u=new de(xf[r],c),d=c.uniforms,f=Sf[n]-1,p=isFinite(i)?Math.PI/(2*f):2*Math.PI/(2*vf-1),m=i/p,h=isFinite(i)?1+Math.floor(l*m):vf;h>vf&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${h} samples when the maximum is set to ${vf}`);for(var g=[],_=0,v=0;v<vf;++v){var y=v/m,b=Math.exp(-y*y/2);g.push(b),v==0?_+=b:v<h&&(_+=2*b)}for(var v=0;v<g.length;v++)g[v]=g[v]/_;d.envMap.value=e.texture,d.samples.value=h,d.weights.value=g,d.latitudinal.value=a===`latitudinal`,o&&(d.poleAxis.value=o),d.dTheta.value=p,d.mipInt.value=mf-n,d.inputEncoding.value=yf[e.texture.encoding],d.outputEncoding.value=yf[e.texture.encoding];var x=Sf[r],y=3*Math.max(0,hf-2*x);jo(t,y,(r===0?0:2*hf)+2*x*(r>mf-pf?r-mf+pf:0),3*x,2*x),s.setRenderTarget(t),s.render(u,bf)}},Y.create=function(e,t){return console.log(`THREE.Curve.create() has been deprecated`),e.prototype=Object.create(Y.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(fa.prototype,{createPointsGeometry:function(e){console.warn(`THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn(`THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn(`THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);for(var t=new J,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new D(i.x,i.y,i.z||0))}return t}}),Object.assign(pa.prototype,{fromPoints:function(e){return console.warn(`THREE.Path: .fromPoints() has been renamed to .setFromPoints().`),this.setFromPoints(e)}}),Lo.prototype=Object.create(Ji.prototype),Ro.prototype=Object.create(Ji.prototype),zo.prototype=Object.create(Ji.prototype),Object.assign(zo.prototype,{initFromArray:function(){console.error(`THREE.Spline: .initFromArray() has been removed.`)},getControlPointsArray:function(){console.error(`THREE.Spline: .getControlPointsArray() has been removed.`)},reparametrizeByArcLength:function(){console.error(`THREE.Spline: .reparametrizeByArcLength() has been removed.`)}}),_o.prototype.setColors=function(){console.error(`THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.`)},mo.prototype.update=function(){console.error(`THREE.SkeletonHelper: update() no longer needs to be called.`)},Object.assign(Li.prototype,{extractUrlBase:function(e){return console.warn(`THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.`),bd.extractUrlBase(e)}}),Li.Handlers={add:function(){console.error(`THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.`)},get:function(){console.error(`THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.`)}},Object.assign(Na.prototype,{setTexturePath:function(e){return console.warn(`THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().`),this.setResourcePath(e)}}),Object.assign(co.prototype,{center:function(e){return console.warn(`THREE.Box2: .center() has been renamed to .getCenter().`),this.getCenter(e)},empty:function(){return console.warn(`THREE.Box2: .empty() has been renamed to .isEmpty().`),this.isEmpty()},isIntersectionBox:function(e){return console.warn(`THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},size:function(e){return console.warn(`THREE.Box2: .size() has been renamed to .getSize().`),this.getSize(e)}}),Object.assign(N.prototype,{center:function(e){return console.warn(`THREE.Box3: .center() has been renamed to .getCenter().`),this.getCenter(e)},empty:function(){return console.warn(`THREE.Box3: .empty() has been renamed to .isEmpty().`),this.isEmpty()},isIntersectionBox:function(e){return console.warn(`THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn(`THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().`),this.intersectsSphere(e)},size:function(e){return console.warn(`THREE.Box3: .size() has been renamed to .getSize().`),this.getSize(e)}}),Object.assign(F.prototype,{empty:function(){return console.warn(`THREE.Sphere: .empty() has been renamed to .isEmpty().`),this.isEmpty()}}),Se.prototype.setFromMatrix=function(e){return console.warn(`THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().`),this.setFromProjectionMatrix(e)},lo.prototype.center=function(e){return console.warn(`THREE.Line3: .center() has been renamed to .getCenter().`),this.getCenter(e)},Object.assign(X,{random16:function(){return console.warn(`THREE.Math: .random16() has been deprecated. Use Math.random() instead.`),Math.random()},nearestPowerOfTwo:function(e){return console.warn(`THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().`),X.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn(`THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().`),X.ceilPowerOfTwo(e)}}),Object.assign(x.prototype,{flattenToArrayOffset:function(e,t){return console.warn(`THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.`),this.toArray(e,t)},multiplyVector3:function(e){return console.warn(`THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.`),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error(`THREE.Matrix3: .multiplyVector3Array() has been removed.`)},applyToBufferAttribute:function(e){return console.warn(`THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.`),e.applyMatrix3(this)},applyToVector3Array:function(){console.error(`THREE.Matrix3: .applyToVector3Array() has been removed.`)}}),Object.assign(O.prototype,{extractPosition:function(e){return console.warn(`THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().`),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn(`THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.`),this.toArray(e,t)},getPosition:function(){return console.warn(`THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.`),new D().setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn(`THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().`),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn(`THREE.Matrix4: .multiplyToArray() has been removed.`)},multiplyVector3:function(e){return console.warn(`THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn(`THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error(`THREE.Matrix4: .multiplyVector3Array() has been removed.`)},rotateAxis:function(e){console.warn(`THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.`),e.transformDirection(this)},crossVector:function(e){return console.warn(`THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},translate:function(){console.error(`THREE.Matrix4: .translate() has been removed.`)},rotateX:function(){console.error(`THREE.Matrix4: .rotateX() has been removed.`)},rotateY:function(){console.error(`THREE.Matrix4: .rotateY() has been removed.`)},rotateZ:function(){console.error(`THREE.Matrix4: .rotateZ() has been removed.`)},rotateByAxis:function(){console.error(`THREE.Matrix4: .rotateByAxis() has been removed.`)},applyToBufferAttribute:function(e){return console.warn(`THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},applyToVector3Array:function(){console.error(`THREE.Matrix4: .applyToVector3Array() has been removed.`)},makeFrustum:function(e,t,n,r,i,a){return console.warn(`THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.`),this.makePerspective(e,t,r,n,i,a)}}),L.prototype.isIntersectionLine=function(e){return console.warn(`THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().`),this.intersectsLine(e)},E.prototype.multiplyVector3=function(e){return console.warn(`THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.`),e.applyQuaternion(this)},Object.assign(I.prototype,{isIntersectionBox:function(e){return console.warn(`THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn(`THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().`),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn(`THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().`),this.intersectsSphere(e)}}),Object.assign(R.prototype,{area:function(){return console.warn(`THREE.Triangle: .area() has been renamed to .getArea().`),this.getArea()},barycoordFromPoint:function(e,t){return console.warn(`THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().`),this.getBarycoord(e,t)},midpoint:function(e){return console.warn(`THREE.Triangle: .midpoint() has been renamed to .getMidpoint().`),this.getMidpoint(e)},normal:function(e){return console.warn(`THREE.Triangle: .normal() has been renamed to .getNormal().`),this.getNormal(e)},plane:function(e){return console.warn(`THREE.Triangle: .plane() has been renamed to .getPlane().`),this.getPlane(e)}}),Object.assign(R,{barycoordFromPoint:function(e,t,n,r,i){return console.warn(`THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().`),R.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn(`THREE.Triangle: .normal() has been renamed to .getNormal().`),R.getNormal(e,t,n,r)}}),Object.assign(ma.prototype,{extractAllPoints:function(e){return console.warn(`THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.`),this.extractPoints(e)},extrude:function(e){return console.warn(`THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.`),new Wr(this,e)},makeGeometry:function(e){return console.warn(`THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.`),new ti(this,e)}}),Object.assign(b.prototype,{fromAttribute:function(e,t,n){return console.warn(`THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn(`THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().`),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn(`THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(D.prototype,{setEulerFromRotationMatrix:function(){console.error(`THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.`)},setEulerFromQuaternion:function(){console.error(`THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.`)},getPositionFromMatrix:function(e){return console.warn(`THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().`),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn(`THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().`),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn(`THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().`),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn(`THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.`),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn(`THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn(`THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().`),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn(`THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(C.prototype,{fromAttribute:function(e,t,n){return console.warn(`THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn(`THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(J.prototype,{computeTangents:function(){console.error(`THREE.Geometry: .computeTangents() has been removed.`)},computeLineDistances:function(){console.error(`THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.`)},applyMatrix:function(e){return console.warn(`THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.assign(j.prototype,{getChildByName:function(e){return console.warn(`THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().`),this.getObjectByName(e)},renderDepth:function(){console.warn(`THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.`)},translate:function(e,t){return console.warn(`THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.`),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error(`THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.`)},applyMatrix:function(e){return console.warn(`THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.defineProperties(j.prototype,{eulerOrder:{get:function(){return console.warn(`THREE.Object3D: .eulerOrder is now .rotation.order.`),this.rotation.order},set:function(e){console.warn(`THREE.Object3D: .eulerOrder is now .rotation.order.`),this.rotation.order=e}},useQuaternion:{get:function(){console.warn(`THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.`)},set:function(){console.warn(`THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.`)}}}),Object.assign(de.prototype,{setDrawMode:function(){console.error(`THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.`)}}),Object.defineProperties(de.prototype,{drawMode:{get:function(){return console.error(`THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.`),0},set:function(){console.error(`THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.`)}}}),Object.defineProperties(An.prototype,{objects:{get:function(){return console.warn(`THREE.LOD: .objects has been renamed to .levels.`),this.levels}}}),Object.defineProperty(Mn.prototype,`useVertexTexture`,{get:function(){console.warn(`THREE.Skeleton: useVertexTexture has been removed.`)},set:function(){console.warn(`THREE.Skeleton: useVertexTexture has been removed.`)}}),jn.prototype.initBones=function(){console.error(`THREE.SkinnedMesh: initBones() has been removed.`)},Object.defineProperty(Y.prototype,`__arcLengthDivisions`,{get:function(){return console.warn(`THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.`),this.arcLengthDivisions},set:function(e){console.warn(`THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.`),this.arcLengthDivisions=e}}),ve.prototype.setLens=function(e,t){console.warn(`THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.`),t!==void 0&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(ha.prototype,{onlyShadow:{set:function(){console.warn(`THREE.Light: .onlyShadow has been removed.`)}},shadowCameraFov:{set:function(e){console.warn(`THREE.Light: .shadowCameraFov is now .shadow.camera.fov.`),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn(`THREE.Light: .shadowCameraLeft is now .shadow.camera.left.`),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn(`THREE.Light: .shadowCameraRight is now .shadow.camera.right.`),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn(`THREE.Light: .shadowCameraTop is now .shadow.camera.top.`),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn(`THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.`),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn(`THREE.Light: .shadowCameraNear is now .shadow.camera.near.`),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn(`THREE.Light: .shadowCameraFar is now .shadow.camera.far.`),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn(`THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.`)}},shadowBias:{set:function(e){console.warn(`THREE.Light: .shadowBias is now .shadow.bias.`),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn(`THREE.Light: .shadowDarkness has been removed.`)}},shadowMapWidth:{set:function(e){console.warn(`THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.`),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn(`THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.`),this.shadow.mapSize.height=e}}}),Object.defineProperties(H.prototype,{length:{get:function(){return console.warn(`THREE.BufferAttribute: .length has been deprecated. Use .count instead.`),this.array.length}},dynamic:{get:function(){return console.warn(`THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.`),this.usage===dc},set:function(){console.warn(`THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.`),this.setUsage(dc)}}}),Object.assign(H.prototype,{setDynamic:function(e){return console.warn(`THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.`),this.setUsage(e===!0?dc:uc),this},copyIndicesArray:function(){console.error(`THREE.BufferAttribute: .copyIndicesArray() has been removed.`)},setArray:function(){console.error(`THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers`)}}),Object.assign(q.prototype,{addIndex:function(e){console.warn(`THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().`),this.setIndex(e)},addAttribute:function(e,t){return console.warn(`THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().`),!(t&&t.isBufferAttribute)&&!(t&&t.isInterleavedBufferAttribute)?(console.warn(`THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).`),this.setAttribute(e,new H(arguments[1],arguments[2]))):e===`index`?(console.warn(`THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.`),this.setIndex(t),this):this.setAttribute(e,t)},addDrawCall:function(e,t,n){n!==void 0&&console.warn(`THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.`),console.warn(`THREE.BufferGeometry: .addDrawCall() is now .addGroup().`),this.addGroup(e,t)},clearDrawCalls:function(){console.warn(`THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().`),this.clearGroups()},computeTangents:function(){console.warn(`THREE.BufferGeometry: .computeTangents() has been removed.`)},computeOffsets:function(){console.warn(`THREE.BufferGeometry: .computeOffsets() has been removed.`)},removeAttribute:function(e){return console.warn(`THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().`),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn(`THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.defineProperties(q.prototype,{drawcalls:{get:function(){return console.error(`THREE.BufferGeometry: .drawcalls has been renamed to .groups.`),this.groups}},offsets:{get:function(){return console.warn(`THREE.BufferGeometry: .offsets has been renamed to .groups.`),this.groups}}}),Object.defineProperties(Aa.prototype,{maxInstancedCount:{get:function(){return console.warn(`THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.`),this.instanceCount},set:function(e){console.warn(`THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.`),this.instanceCount=e}}}),Object.defineProperties(ro.prototype,{linePrecision:{get:function(){return console.warn(`THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.`),this.params.Line.threshold},set:function(e){console.warn(`THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.`),this.params.Line.threshold=e}}}),Object.defineProperties(Tn.prototype,{dynamic:{get:function(){return console.warn(`THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.`),this.usage===dc},set:function(e){console.warn(`THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.`),this.setUsage(e)}}}),Object.assign(Tn.prototype,{setDynamic:function(e){return console.warn(`THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.`),this.setUsage(e===!0?dc:uc),this},setArray:function(){console.error(`THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers`)}}),Object.assign(Gr.prototype,{getArrays:function(){console.error(`THREE.ExtrudeBufferGeometry: .getArrays() has been removed.`)},addShapeList:function(){console.error(`THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.`)},addShape:function(){console.error(`THREE.ExtrudeBufferGeometry: .addShape() has been removed.`)}}),Object.defineProperties(to.prototype,{dynamic:{set:function(){console.warn(`THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.`)}},onUpdate:{value:function(){return console.warn(`THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.`),this}}}),Object.defineProperties(V.prototype,{wrapAround:{get:function(){console.warn(`THREE.Material: .wrapAround has been removed.`)},set:function(){console.warn(`THREE.Material: .wrapAround has been removed.`)}},overdraw:{get:function(){console.warn(`THREE.Material: .overdraw has been removed.`)},set:function(){console.warn(`THREE.Material: .overdraw has been removed.`)}},wrapRGB:{get:function(){return console.warn(`THREE.Material: .wrapRGB has been removed.`),new z}},shading:{get:function(){console.error(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`)},set:function(e){console.warn(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`),this.flatShading=e===1}},stencilMask:{get:function(){return console.warn(`THREE.`+this.type+`: .stencilMask has been removed. Use .stencilFuncMask instead.`),this.stencilFuncMask},set:function(e){console.warn(`THREE.`+this.type+`: .stencilMask has been removed. Use .stencilFuncMask instead.`),this.stencilFuncMask=e}}}),Object.defineProperties(hi.prototype,{metal:{get:function(){return console.warn(`THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.`),!1},set:function(){console.warn(`THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead`)}}}),Object.defineProperties(ge.prototype,{derivatives:{get:function(){return console.warn(`THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.`),this.extensions.derivatives},set:function(e){console.warn(`THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.`),this.extensions.derivatives=e}}}),Object.assign(Sn.prototype,{clearTarget:function(e,t,n,r){console.warn(`THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.`),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn(`THREE.WebGLRenderer: .animate() is now .setAnimationLoop().`),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn(`THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().`),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn(`THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().`),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn(`THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.`),this.capabilities.precision},resetGLState:function(){return console.warn(`THREE.WebGLRenderer: .resetGLState() is now .state.reset().`),this.state.reset()},supportsFloatTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).`),this.extensions.get(`OES_texture_float`)},supportsHalfFloatTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).`),this.extensions.get(`OES_texture_half_float`)},supportsStandardDerivatives:function(){return console.warn(`THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).`),this.extensions.get(`OES_standard_derivatives`)},supportsCompressedTextureS3TC:function(){return console.warn(`THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).`),this.extensions.get(`WEBGL_compressed_texture_s3tc`)},supportsCompressedTexturePVRTC:function(){return console.warn(`THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).`),this.extensions.get(`WEBGL_compressed_texture_pvrtc`)},supportsBlendMinMax:function(){return console.warn(`THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).`),this.extensions.get(`EXT_blend_minmax`)},supportsVertexTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.`),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn(`THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).`),this.extensions.get(`ANGLE_instanced_arrays`)},enableScissorTest:function(e){console.warn(`THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().`),this.setScissorTest(e)},initMaterial:function(){console.warn(`THREE.WebGLRenderer: .initMaterial() has been removed.`)},addPrePlugin:function(){console.warn(`THREE.WebGLRenderer: .addPrePlugin() has been removed.`)},addPostPlugin:function(){console.warn(`THREE.WebGLRenderer: .addPostPlugin() has been removed.`)},updateShadowMap:function(){console.warn(`THREE.WebGLRenderer: .updateShadowMap() has been removed.`)},setFaceCulling:function(){console.warn(`THREE.WebGLRenderer: .setFaceCulling() has been removed.`)},allocTextureUnit:function(){console.warn(`THREE.WebGLRenderer: .allocTextureUnit() has been removed.`)},setTexture:function(){console.warn(`THREE.WebGLRenderer: .setTexture() has been removed.`)},setTexture2D:function(){console.warn(`THREE.WebGLRenderer: .setTexture2D() has been removed.`)},setTextureCube:function(){console.warn(`THREE.WebGLRenderer: .setTextureCube() has been removed.`)},getActiveMipMapLevel:function(){return console.warn(`THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().`),this.getActiveMipmapLevel()}}),Object.defineProperties(Sn.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn(`THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.`),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn(`THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.`),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.`)}},context:{get:function(){return console.warn(`THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.`),this.getContext()}},vr:{get:function(){return console.warn(`THREE.WebGLRenderer: .vr has been renamed to .xr`),this.xr}},gammaInput:{get:function(){return console.warn(`THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.`),!1},set:function(){console.warn(`THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.`)}},gammaOutput:{get:function(){return console.warn(`THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.`),!1},set:function(e){console.warn(`THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.`),this.outputEncoding=e===!0?ec:$s}}}),Object.defineProperties(pn.prototype,{cullFace:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.`)}},renderReverseSided:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.`)}},renderSingleSided:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.`)}}}),Object.defineProperties(w.prototype,{wrapS:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.`),this.texture.wrapS},set:function(e){console.warn(`THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.`),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.`),this.texture.wrapT},set:function(e){console.warn(`THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.`),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.`),this.texture.magFilter},set:function(e){console.warn(`THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.`),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.`),this.texture.minFilter},set:function(e){console.warn(`THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.`),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.`),this.texture.anisotropy},set:function(e){console.warn(`THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.`),this.texture.anisotropy=e}},offset:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .offset is now .texture.offset.`),this.texture.offset},set:function(e){console.warn(`THREE.WebGLRenderTarget: .offset is now .texture.offset.`),this.texture.offset=e}},repeat:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .repeat is now .texture.repeat.`),this.texture.repeat},set:function(e){console.warn(`THREE.WebGLRenderTarget: .repeat is now .texture.repeat.`),this.texture.repeat=e}},format:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .format is now .texture.format.`),this.texture.format},set:function(e){console.warn(`THREE.WebGLRenderTarget: .format is now .texture.format.`),this.texture.format=e}},type:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .type is now .texture.type.`),this.texture.type},set:function(e){console.warn(`THREE.WebGLRenderTarget: .type is now .texture.type.`),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.`),this.texture.generateMipmaps},set:function(e){console.warn(`THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.`),this.texture.generateMipmaps=e}}}),Object.defineProperties(Ka.prototype,{load:{value:function(e){console.warn(`THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.`);var t=this;return new Ba().load(e,function(e){t.setBuffer(e)}),this}},startTime:{set:function(){console.warn(`THREE.Audio: .startTime is now .play( delay ).`)}}}),Ja.prototype.getData=function(){return console.warn(`THREE.AudioAnalyser: .getData() is now .getFrequencyData().`),this.getFrequencyData()},ye.prototype.updateCubeMap=function(e,t){return console.warn(`THREE.CubeCamera: .updateCubeMap() is now .update().`),this.update(e,t)},hc.crossOrigin=void 0,hc.loadTexture=function(e,t,n,r){console.warn(`THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.`);var i=new Wi;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},hc.loadTextureCube=function(e,t,n,r){console.warn(`THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.`);var i=new Ui;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},hc.loadCompressedTexture=function(){console.error(`THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.`)},hc.loadCompressedTextureCube=function(){console.error(`THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.`)},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`117`}}))})),kf=e((()=>{Of()}));Of(),kf();function $(e,t,n){return function(r,i,a){return((r+e-1)/e|0)*((i+t-1)/t|0)*n*a}}function Af(e,t,n){return function(r,i,a){return(Math.max(r,e)*Math.max(i,t)/n|0)*a}}new Map([[rs,$(4,4,8)],[is,$(4,4,8)],[as,$(4,4,16)],[os,$(4,4,16)],[ds,$(4,4,8)],[ss,Af(8,8,2)],[ls,Af(8,8,2)],[cs,Af(16,8,4)],[us,Af(16,8,4)],[fs,$(4,4,8)],[ps,$(4,4,16)],[ms,$(4,4,16)],[ks,$(4,4,16)],[hs,$(5,4,16)],[As,$(5,4,16)],[gs,$(5,5,16)],[js,$(5,5,16)],[_s,$(6,5,16)],[Ms,$(6,5,16)],[vs,$(6,6,16)],[Ns,$(6,6,16)],[ys,$(8,5,16)],[Ps,$(8,5,16)],[bs,$(8,6,16)],[Fs,$(8,6,16)],[xs,$(8,8,16)],[Is,$(8,8,16)],[Ss,$(10,5,16)],[Ls,$(10,5,16)],[Cs,$(10,6,16)],[Rs,$(10,6,16)],[ws,$(10,8,16)],[zs,$(10,8,16)],[Ts,$(10,10,16)],[Bs,$(10,10,16)],[Es,$(12,10,16)],[Vs,$(12,10,16)],[Ds,$(12,12,16)],[Hs,$(12,12,16)],[Os,$(4,4,16)]]),Of();let jf=new O().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);new O().getInverse(jf);function Mf(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function Nf(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Mf(a,r,i,o,s,`next`,e)}function s(e){Mf(a,r,i,o,s,`throw`,e)}o(void 0)})}}function Pf(){return Ff.apply(this,arguments)}function Ff(){return Ff=Nf(function*(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i){try{new URL(`.`,a).href}catch(e){}(function(){var e=Nf(function*(e){var t=yield fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)});return function(t){return e.apply(this,arguments)}})()}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\n;\\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\ntA\\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"(¸\n F@ A¸\nj 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"(¸\n F@ A¸\nj 6\\0 \\rA\\bA\\b(\\0A~ wq6\\0\\f\\v@ \\b(F@ \\b 6\\f\\v \\b 6\\v E\\r\\v \\b6 ("@ 6 6\\v ("E\\r\\0 6 6\\v \\0Ar6 \\0 j \\x006\\0 \\x07G\\r\\0A\\b \\x006\\0\\v \\0AÿM@ \\0AøqA°\\bj!A\\b(\\0"A \\0Avt"\\0qE@A\\b \\0 r6\\0 \\f\\v (\\b\\v!\\0 6\\b \\0 6\\f 6\\f \\x006\\b\\vA! \\0Aÿÿÿ\\x07M@ \\0A& \\0A\\bvg"kvAq AtrA>s!\\v 6 B\\x007 AtA¸\nj!@A\\b(\\0"A t"qE@A\\b r6\\0 6\\0A!A\\b\\f\\v \\0A AvkA\\0 AG\\x1Bt! (\\0!@ "(Axq \\0F\\r Av! At! Aqj"("\\r\\0\\v 6A! !A\\b\\v!\\0 "\\f\\v (\\b" 6\\f 6\\bA!\\0A\\b!A\\0\\v! j 6\\0 6\\f \\0 j 6\\0A¨\\bA¨\\b(\\0Ak"\\0A \\0\\x1B6\\0\\v\\v¸\'\\v#\\0Ak"\n$\\0@@@@@@@@@@ \\0AôM@A\\b(\\0"A \\0A\\vjAøq \\0A\\vI\\x1B"Av"\\0v"Aq@@ AsAq \\0j"At"A°\\bj"\\0 (¸\\b"(\\b"F@A\\b A~ wq6\\0\\f\\v \\x006\\f \\0 6\\b\\v A\\bj!\\0 Ar6 j" (Ar6\\f\\v\\v A\\b(\\0"\\bM\\r @@A \\0t"A\\0 kr \\0tqh"At"A°\\bj" (¸\\b"\\0(\\b"F@A\\b A~ wq"6\\0\\f\\v 6\\f 6\\b\\v \\0 Ar6 \\0 j"\\x07 k"Ar6 \\0 j 6\\0 \\b@ \\bAxqA°\\bj!A\\b(\\0! A \\bAvt"qE@A\\b r6\\0 \\f\\v (\\b\\v! 6\\b 6\\f 6\\f 6\\b\\v \\0A\\bj!\\0A\\b \\x076\\0A\\b 6\\0\\f\\v\\vA\\b(\\0"\\vE\\r \\vhAt(¸\n"(Axq k! !@@ ("\\0E@ ("\\0E\\r\\v \\0(Axq k" I"\\x1B! \\0 \\x1B! \\0!\\f\\v\\v (! (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\n\\v (" Aj ("E\\r Aj\\v!@ !\\x07 "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v \\x07A\\x006\\0\\f \\vA! \\0A¿K\\r\\0 \\0A\\vj"Axq!A\\b(\\0"\\x07E\\r\\0A!\\bA\\0 k! \\0Aôÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtkA>j!\\b\\v@@@ \\bAt(¸\n"E@A\\0!\\0\\f\\vA\\0!\\0 A \\bAvkA\\0 \\bAG\\x1Bt!@@ (Axq k" O\\r\\0 ! "\\r\\0A\\0! !\\0\\f\\v \\0 (" AvAqj("F\\x1B \\0 \\x1B!\\0 At! \\r\\0\\v\\v \\0 rE@A\\0!A \\bt"\\0A\\0 \\0kr \\x07q"\\0E\\r \\0hAt(¸\n!\\0\\v \\0E\\r\\v@ \\0(Axq k" I! \\x1B! \\0 \\x1B! \\0(" \\0(\\v"\\0\\r\\0\\v\\v E\\r\\0 A\\b(\\0 kO\\r\\0 (!\\b (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\\b\\v (" Aj ("E\\r Aj\\v!@ ! "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v A\\x006\\0\\f\\x07\\v A\\b(\\0"M@A\\b(\\0!\\0@ k"AO@ \\0 j" Ar6 \\0 j 6\\0 \\0 Ar6\\f\\v \\0 Ar6 \\0 j" (Ar6A\\0!A\\0!\\vA\\b 6\\0A\\b 6\\0 \\0A\\bj!\\0\\f \\v A\\b(\\0"I@A\\b k"6\\0A\\xA0\\bA\\xA0\\b(\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f \\vA\\0!\\0 A/j"Aà\\v(\\0@Aè\\v(\\0\\f\\vAì\\vB7\\0Aä\\vB\\xA07\\0Aà\\v \nA\\fjApqAتժs6\\0Aô\\vA\\x006\\0AÄ\\vA\\x006\\0A \\v"j"A\\0 k"\\x07q" M\\r\\bAÀ\\v(\\0"@A¸\\v(\\0"\\b j" \\bM Ir\\r \\v@AÄ\\v-\\0\\0AqE@@@@@A\\xA0\\b(\\0"@AÈ\\v!\\0@ \\0(\\0"\\b M@ \\b \\0(jI\\r\\v \\0(\\b"\\0\\r\\0\\v\\vA\\0"AF\\r !Aä\\v(\\0"\\0Ak" q@ k jA\\0 \\0kqj!\\v M\\rAÀ\\v(\\0"\\0@A¸\\v(\\0" j"\\x07 M \\0 \\x07Ir\\r\\v "\\0 G\\r\\f\\v k \\x07q"" \\0(\\0 \\0(jF\\r !\\0\\v \\0AF\\r A0j M@ \\0!\\f\\vAè\\v(\\0" kjA\\0 kq"AF\\r j! \\0!\\f\\v AG\\r\\vAÄ\\vAÄ\\v(\\0Ar6\\0\\v "AFA\\0"\\0AFr \\0 Mr\\r \\0 k" A(jM\\r\\vA¸\\vA¸\\v(\\0 j"\\x006\\0A¼\\v(\\0 \\0I@A¼\\v \\x006\\0\\v@A\\xA0\\b(\\0"@AÈ\\v!\\0@ \\0(\\0" \\0("jF\\r \\0(\\b"\\0\\r\\0\\v\\f\\vA\\b(\\0"\\0A\\0 \\0 M\\x1BE@A\\b 6\\0\\vA\\0!\\0AÌ\\v 6\\0AÈ\\v 6\\0A¨\\bA6\\0A¬\\bAà\\v(\\x006\\0AÔ\\vA\\x006\\0@ \\0At" A°\\bj"6¸\\b 6¼\\b \\0Aj"\\0A G\\r\\0\\vA\\b A(k"\\0Ax kA\\x07q"k"6\\0A\\xA0\\b j"6\\0 Ar6 \\0 jA(6A¤\\bAð\\v(\\x006\\0\\f\\v M Kr\\r \\0(\\fA\\bq\\r \\0 j6A\\xA0\\b Ax kA\\x07q"\\0j"6\\0A\\bA\\b(\\0 j" \\0k"\\x006\\0 \\0Ar6 jA(6A¤\\bAð\\v(\\x006\\0\\f\\vA\\0!\\0\\f\\vA\\0!\\0\\f\\vA\\b(\\0 K@A\\b 6\\0\\v j!AÈ\\v!\\0@@ \\0(\\0"G@ \\0(\\b"\\0\\r\\f\\v\\v \\0-\\0\\fA\\bqE\\r\\vAÈ\\v!\\0@@ \\0(\\0" M@ \\0(j"I\\r\\v \\0(\\b!\\0\\f\\v\\vA\\b A(k"\\0Ax kA\\x07q"k"\\x076\\0A\\xA0\\b j"6\\0 \\x07Ar6 \\0 jA(6A¤\\bAð\\v(\\x006\\0 A\' kA\\x07qjA/k"\\0 \\0 AjI\\x1B"A\\x1B6 AÐ\\v)\\x007 AÈ\\v)\\x007\\bAÐ\\v A\\bj6\\0AÌ\\v 6\\0AÈ\\v 6\\0AÔ\\vA\\x006\\0 Aj!\\0@ \\0A\\x076 \\0A\\bj \\0Aj!\\0 I\\r\\0\\v F\\r\\0 (A~q6 k"Ar6 6\\0 AÿM@ AøqA°\\bj!\\0A\\b(\\0"A Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\fA\\f!A\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtA¸\nj!@@A\\b(\\0"A \\0t"qE@A\\b r6\\0 6\\0\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"("\\r\\0\\v 6\\v 6A\\b! "!\\0A\\f\\f\\v (\\b"\\0 6\\f 6\\b \\x006\\bA\\0!\\0A!A\\f\\v j 6\\0 j \\x006\\0\\vA\\b(\\0"\\0 M\\r\\0A\\b \\0 k"6\\0A\\xA0\\bA\\xA0\\b(\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f\\vA\\bA06\\0A\\0!\\0\\f\\v \\0 6\\0 \\0 \\0( j6 Ax kA\\x07qj"\\b Ar6 Ax kA\\x07qj" \\bj"k!\\x07@A\\xA0\\b(\\0 F@A\\xA0\\b 6\\0A\\bA\\b(\\0 \\x07j"\\x006\\0 \\0Ar6\\f\\vA\\b(\\0 F@A\\b 6\\0A\\bA\\b(\\0 \\x07j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\f\\v ("\\0AqAF@ \\0Axq! (\\f!@ \\0AÿM@ (\\b" F@A\\bA\\b(\\0A~ \\0Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!@ G@ (\\b"\\0 6\\f \\x006\\b\\f\\v@ ("\\0 Aj ("\\0E\\r Aj\\v!@ ! \\0"Aj! \\0("\\0\\r\\0 Aj! ("\\0\\r\\0\\v A\\x006\\0\\f\\vA\\0!\\v E\\r\\0@ ("\\0At"(¸\n F@ A¸\nj 6\\0 \\rA\\bA\\b(\\0A~ \\0wq6\\0\\f\\v@ (F@ 6\\f\\v 6\\v E\\r\\v 6 ("\\0@ \\x006 \\0 6\\v ("\\0E\\r\\0 \\x006 \\0 6\\v \\x07 j!\\x07 j"(!\\0\\v \\0A~q6 \\x07Ar6 \\x07j \\x076\\0 \\x07AÿM@ \\x07AøqA°\\bj!\\0A\\b(\\0"A \\x07Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA! \\x07Aÿÿÿ\\x07M@ \\x07A& \\x07A\\bvg"\\0kvAq \\0AtrA>s!\\v 6 B\\x007 AtA¸\nj!\\0@@A\\b(\\0"A t"qE@A\\b r6\\0 \\0 6\\0\\f\\v \\x07A AvkA\\0 AG\\x1Bt! \\0(\\0!@ "\\0(Axq \\x07F\\r Av! At! \\0 Aqj"("\\r\\0\\v 6\\v \\x006 6\\f 6\\b\\f\\v \\0(\\b" 6\\f \\0 6\\b A\\x006 \\x006\\f 6\\b\\v \\bA\\bj!\\0\\f\\v@ \\bE\\r\\0@ ("At"(¸\n F@ A¸\nj \\x006\\0 \\0\\rA\\b \\x07A~ wq"\\x076\\0\\f\\v@ \\b(F@ \\b \\x006\\f\\v \\b \\x006\\v \\0E\\r\\v \\0 \\b6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 AÿM@ AøqA°\\bj!\\0A\\b(\\0"A Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtA¸\nj!@@ \\x07A \\0t"qE@A\\b \\x07r6\\0 6\\0 6\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"\\x07("\\r\\0\\v \\x07 6 6\\v 6\\f 6\\b\\f\\v (\\b"\\0 6\\f 6\\b A\\x006 6\\f \\x006\\b\\v A\\bj!\\0\\f\\v@ E\\r\\0@ ("At"(¸\n F@ A¸\nj \\x006\\0 \\0\\rA\\b \\vA~ wq6\\0\\f\\v@ (F@ \\x006\\f\\v \\x006\\v \\0E\\r\\v \\0 6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 \\b@ \\bAxqA°\\bj!\\0A\\b(\\0!A \\bAvt"\\x07 qE@A\\b \\x07r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\vA\\b 6\\0A\\b 6\\0\\v A\\bj!\\0\\v \nAj$\\0 \\0\\v}\\vA\\0!\\0@ \\0 FE@ \\0A\\fl"Aj"j*\\0!\\f A\\bj"j*\\0!\\v \\bj j*\\0"\\r8\\0 \\b j \\v8\\0 \\b j \\f8\\0 \\0At"j j"#*\\x008\\0 \\0At"Ar"$At" j j" *\\x008\\0 Ar"%At"!j !j"!*\\x008\\0 Ar"&At""j "j""*\\x008\\0 \nj j"\'*\\x008\\0 \n j j"*\\x008\\0 \n j j*\\0"8\\0 \\x07 \\0Atj" \\v8\\b \\f8 \\r8\\0 j-\\0\\0 $j-\\0\\0A\\btr %j-\\0\\0Atr &j-\\0\\0Atr6\\f *\\0! \'*\\0! "*\\0"\\f \\f !*\\0"\\v \\v #*\\0" *\\0"\\r \\r"C\\0\\0\\0\\0^@ \\f "!\\f \\r !\\r ! \\v !\\v\\v \\r \\f" \\v "" " C\\0\\0? \\v \\v" \\f \\f"" " \\r \\v" \\f "" " C\\0\\0@ \\v \\f"\\x1B \\r ""\\f \\f"\\f "\\v \\v"\\v C\\0\\0? \\r \\r" "\\r \\r"\\r C\\0\\0@6 C\\0\\0? " " " " \\x1B " "C\\0\\0@ \\f \\f \\v \\v \\r \\rC\\0\\0@6 A\\x006 \\f \\v \\r C\\0\\0@ C\\0\\0@6 \\0Aj!\\0\\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!=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 P={a:k};function F(){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 I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}),Ff.apply(this,arguments)}let If=new Float32Array(1),Lf=new Uint32Array(If.buffer),Rf=typeof Float16Array<`u`,zf=Rf?new Float16Array(1):null,Bf=Rf?new Uint16Array(zf.buffer):new Uint16Array(1);function Vf(e){if(Rf&&zf)return Bf[0]=e,zf[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 Lf[0]=i,If[0]}var Hf=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t);this.reader=n.getReader()}read(e){return t(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})}},Uf=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 Hf({fileBytes:this.fileBytes})}parseHeader(){return t(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,n,r,i,a,o){return t(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;e==null||e(t,Vf(n[r]),Vf(n[r+1]),Vf(n[r+2]))}}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 t=0;t<this.numSplats;t++)n==null||n(t,e[t]/255)}{let e=yield this.reader.read(this.numSplats*3),t=.28209479177387814/.15;for(let n=0;n<this.numSplats;n++){let i=n*3;r==null||r(n,(e[i]/255-.5)*t+.5,(e[i+1]/255-.5)*t+.5,(e[i+2]/255-.5)*t+.5)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3;i==null||i(t,Math.exp(e[n]/16-10),Math.exp(e[n+1]/16-10),Math.exp(e[n+2]/16-10))}}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,i=[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,i[t]=n/511*e,i[t]=r===0?i[t]:-i[t],u+=i[t]*i[t]}i[c]=Math.sqrt(Math.max(1-u,0)),a==null||a(n,i[0],i[1],i[2],i[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,i=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-i*i-o*o));a==null||a(t,r,i,o,s)}}if(o&&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,a=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[a+e]-128)/128;if(a+=9,r){for(let e=0;e<15;++e)r[e]=(t[a+e]-128)/128;a+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[a+e]-128)/128;a+=21}o==null||o(e,new Float32Array(n),r?new Float32Array(r):void 0,i?new Float32Array(i):void 0)}}})}};function Wf(e){return t(this,void 0,void 0,function*(){let t=new Uf({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)}),{numPoints:n,shDegree:t.shDegree,flagAntiAlias:t.flagAntiAlias,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l}})}let Gf,Kf=!1;function qf(){return t(this,void 0,void 0,function*(){if(!Gf){for(;Kf;)yield new Promise(e=>setTimeout(e,0));Gf||(Kf=!0,Gf=yield Pf(),Kf=!1)}})}let Jf=0,Yf=0,Xf=0,Zf=0,Qf=0,$f=0,ep=0,tp=0,np=0,rp=0;function ip(e){let t=Math.pow(2,Math.ceil(Math.log2(Math.max(1,e))));t<=Jf||(Jf>0&&(Gf._free(Yf),Gf._free(Xf),Gf._free(Zf),Gf._free(Qf),Gf._free($f),Gf._free(ep),Gf._free(tp),Gf._free(np),Gf._free(rp)),Jf=t,Yf=Gf._malloc(3*t*4),Xf=Gf._malloc(4*t*4),Zf=Gf._malloc(3*t*4),Qf=Gf._malloc(4*t),$f=Gf._malloc(t),ep=Gf._malloc(8*t*4),tp=Gf._malloc(3*t*4),np=Gf._malloc(4*t*4),rp=Gf._malloc(3*t*4))}function ap(e,t,n,r,i){ip(e);let a=new Uint8Array(e);Gf.HEAPF32.set(t,Yf/4),Gf.HEAPF32.set(n,Xf/4),Gf.HEAPF32.set(r,Zf/4),Gf.HEAPU8.set(i,Qf),Gf.HEAPU8.set(a,$f),Gf._pack(!1,e,Yf,Xf,Zf,Qf,$f,ep,tp,np,rp);let o=new Uint32Array(Gf.HEAPU32.buffer,ep,e*8);return new Uint32Array(o.slice().buffer)}typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope&&(self.onmessage=e=>t(void 0,void 0,void 0,function*(){var t;let{requestId:n,fileBytes:r}=e.data;if(!(r===void 0||n===void 0))try{let e=yield Wf(new Uint8Array(r));yield qf();let t=ap(e.numPoints,e.positions,e.rotations,e.scales,e.colors),i=Object.assign(Object.assign({},e),{packedData:t}),a=[t.buffer,e.positions.buffer,e.colors.buffer,e.scales.buffer,e.rotations.buffer];e.sh1&&a.push(e.sh1.buffer),e.sh2&&a.push(e.sh2.buffer),e.sh3&&a.push(e.sh3.buffer),self.postMessage({requestId:n,decoded:i},a)}catch(e){self.postMessage({requestId:n,error:(t=e==null?void 0:e.message)==null?String(e):t})}}))})();',blob$3=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,jsContent$3],{type:`text/javascript;charset=utf-8`});function WorkerWrapper$3(e){let t;try{if(t=blob$3&&(self.URL||self.webkitURL).createObjectURL(blob$3),!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(jsContent$3),{name:e==null?void 0:e.name})}}var f32buffer=new Float32Array(1),u32buffer=new Uint32Array(f32buffer.buffer),supportsFloat16Array=typeof Float16Array<`u`,f16buffer=supportsFloat16Array?new Float16Array(1):null,u16buffer=supportsFloat16Array?new Uint16Array(f16buffer.buffer):new Uint16Array(1);function fromHalf(e){if(supportsFloat16Array&&f16buffer)return u16buffer[0]=e,f16buffer[0];let t=e>>15&1,n=e>>10&31,r=e&1023,o;if(n===0)if(r===0)o=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let s=n+127,c=e<<13;o=t<<31|s<<23|c}else if(n===31)o=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,s=r<<13;o=t<<31|e<<23|s}return u32buffer[0]=o,f32buffer[0]}var GunzipReader=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t);this.reader=n.getReader()}read(e){return __awaiter(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})}},SH_C0=.28209479177387814,SpzReader=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 GunzipReader({fileBytes:this.fileBytes})}parseHeader(){return __awaiter(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,o,s){return __awaiter(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;e==null||e(t,fromHalf(n[r]),fromHalf(n[r+1]),fromHalf(n[r+2]))}}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 o=r*9,s=((n[o+2]<<24|n[o+1]<<16|n[o]<<8)>>8)/t,c=((n[o+5]<<24|n[o+4]<<16|n[o+3]<<8)>>8)/t,l=((n[o+8]<<24|n[o+7]<<16|n[o+6]<<8)>>8)/t;e==null||e(r,s,c,l)}}{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=SH_C0/.15;for(let r=0;r<this.numSplats;r++){let o=r*3;n==null||n(r,(e[o]/255-.5)*t+.5,(e[o+1]/255-.5)*t+.5,(e[o+2]/255-.5)*t+.5)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3;r==null||r(t,Math.exp(e[n]/16-10),Math.exp(e[n+1]/16-10),Math.exp(e[n+2]/16-10))}}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,s=[0,0,0,0],c=[t[r],t[r+1],t[r+2],t[r+3]],l=c[0]+(c[1]<<8)+(c[2]<<16)+(c[3]<<24),u=511,d=l>>>30,f=l,p=0;for(let t=3;t>=0;--t)if(t!==d){let n=f&511,r=f>>>9&1;f>>>=10,s[t]=n/511*e,s[t]=r===0?s[t]:-s[t],p+=s[t]*s[t]}s[d]=Math.sqrt(Math.max(1-p,0)),o==null||o(n,s[0],s[1],s[2],s[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,s=e[n+1]/127.5-1,c=e[n+2]/127.5-1,l=Math.sqrt(Math.max(0,1-r*r-s*s-c*c));o==null||o(t,r,s,c,l)}}if(s&&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,o=this.shDegree>=3?new Float32Array(21):void 0,c=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[c+e]-128)/128;if(c+=9,r){for(let e=0;e<15;++e)r[e]=(t[c+e]-128)/128;c+=15}if(o){for(let e=0;e<21;++e)o[e]=(t[c+e]-128)/128;c+=21}s==null||s(e,new Float32Array(n),r?new Float32Array(r):void 0,o?new Float32Array(o):void 0)}}})}};function decodeSpz(e){return __awaiter(this,void 0,void 0,function*(){let t=new SpzReader({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),o=new Uint8Array(n*4),s=new Float32Array(n*3),c=new Float32Array(n*4),l,u,d;return t.shDegree>=1&&(l=new Float32Array(n*9)),t.shDegree>=2&&(u=new Float32Array(n*15)),t.shDegree>=3&&(d=new Float32Array(n*21)),yield t.parseSplats((e,t,n,o)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=o},(e,t)=>{o[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{o[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),o[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),o[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{s[e*3]=t,s[e*3+1]=n,s[e*3+2]=r},(e,t,n,r,o)=>{c[e*4]=o,c[e*4+1]=t,c[e*4+2]=n,c[e*4+3]=r},(e,t,n,r)=>{l&&t&&l.set(t,e*9),u&&n&&u.set(n,e*15),d&&r&&d.set(r,e*21)}),{numPoints:n,shDegree:t.shDegree,flagAntiAlias:t.flagAntiAlias,positions:r,colors:o,scales:s,rotations:c,sh1:l,sh2:u,sh3:d}})}var wasmModule,wasmLoading=!1;function ensureWasm(){return __awaiter(this,void 0,void 0,function*(){if(!wasmModule){for(;wasmLoading;)yield new Promise(e=>setTimeout(e,0));wasmModule||(wasmLoading=!0,wasmModule=yield createDataModule(),wasmLoading=!1)}})}var allocatedCount=0,positionsPtr=0,rotationsPtr=0,scalesPtr=0,colorsPtr=0,selectionPtr=0,dataPtr=0,worldPositionsPtr=0,worldRotationsPtr=0,worldScalesPtr=0;function ensureWasmBuffers(e){let t=Math.pow(2,Math.ceil(Math.log2(Math.max(1,e))));t<=allocatedCount||(allocatedCount>0&&(wasmModule._free(positionsPtr),wasmModule._free(rotationsPtr),wasmModule._free(scalesPtr),wasmModule._free(colorsPtr),wasmModule._free(selectionPtr),wasmModule._free(dataPtr),wasmModule._free(worldPositionsPtr),wasmModule._free(worldRotationsPtr),wasmModule._free(worldScalesPtr)),allocatedCount=t,positionsPtr=wasmModule._malloc(3*t*4),rotationsPtr=wasmModule._malloc(4*t*4),scalesPtr=wasmModule._malloc(3*t*4),colorsPtr=wasmModule._malloc(4*t),selectionPtr=wasmModule._malloc(t),dataPtr=wasmModule._malloc(8*t*4),worldPositionsPtr=wasmModule._malloc(3*t*4),worldRotationsPtr=wasmModule._malloc(4*t*4),worldScalesPtr=wasmModule._malloc(3*t*4))}function packDecoded(e,t,n,r,o){ensureWasmBuffers(e);let s=new Uint8Array(e);wasmModule.HEAPF32.set(t,positionsPtr/4),wasmModule.HEAPF32.set(n,rotationsPtr/4),wasmModule.HEAPF32.set(r,scalesPtr/4),wasmModule.HEAPU8.set(o,colorsPtr),wasmModule.HEAPU8.set(s,selectionPtr),wasmModule._pack(!1,e,positionsPtr,rotationsPtr,scalesPtr,colorsPtr,selectionPtr,dataPtr,worldPositionsPtr,worldRotationsPtr,worldScalesPtr);let c=new Uint32Array(wasmModule.HEAPU32.buffer,dataPtr,e*8);return new Uint32Array(c.slice().buffer)}typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope&&(self.onmessage=e=>__awaiter(void 0,void 0,void 0,function*(){var t;let{requestId:n,fileBytes:r}=e.data;if(!(r===void 0||n===void 0))try{let e=yield decodeSpz(new Uint8Array(r));yield ensureWasm();let t=packDecoded(e.numPoints,e.positions,e.rotations,e.scales,e.colors),o=Object.assign(Object.assign({},e),{packedData:t}),s=[t.buffer,e.positions.buffer,e.colors.buffer,e.scales.buffer,e.rotations.buffer];e.sh1&&s.push(e.sh1.buffer),e.sh2&&s.push(e.sh2.buffer),e.sh3&&s.push(e.sh3.buffer),self.postMessage({requestId:n,decoded:o},s)}catch(e){self.postMessage({requestId:n,error:(t=e==null?void 0:e.message)==null?String(e):t})}}));var sharedWorker=null,nextRequestId=1,pendingRequests=new Map;function getWorker(){return sharedWorker||(sharedWorker=new WorkerWrapper$3,sharedWorker.onmessage=e=>{var t;let{requestId:n,decoded:r,error:o}=(t=e.data)==null?{}:t,s=pendingRequests.get(n);s&&(pendingRequests.delete(n),o?s.reject(Error(o)):s.resolve(r))}),sharedWorker}function decodeSpzInWorker(e){let t=getWorker(),n=nextRequestId++,r=e.slice().buffer;return new Promise((e,o)=>{pendingRequests.set(n,{resolve:e,reject:o}),t.postMessage({requestId:n,fileBytes:r},[r])})}function parseSpz(e){return __awaiter(this,void 0,void 0,function*(){let t=yield decodeSpzInWorker(e instanceof ArrayBuffer?new Uint8Array(e):e),{PBMGaussianSplattingObject:n}=yield Promise.resolve().then(()=>(init_pbmGaussianSplattingObject(),pbmGaussianSplattingObject_exports));return new n({numPoints:t.numPoints,packedData:t.packedData,sh1:t.sh1,sh2:t.sh2,sh3:t.sh3,shDegree:t.shDegree,antiAliased:t.flagAntiAlias})})}function loadSpz(e,t={}){var n,r,o,s;let c=(n=t.modelUpAxis)==null?`Y`:n,l=(r=t.upAxis)==null?`Z`:r,u=(o=t.fetcher)==null?internalFetcher:o,d=(s=t.onDownloadProgress)==null?noop:s,f=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d)).then(e=>(f=e.body.byteLength,e.body)).then(e=>parseSpz(new Uint8Array(e))).then(t=>(c===`Z`&&(t.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),t.updateMatrix(),t.updateMatrixWorld(!0),t.transformChanged=!0),{type:`spz`,modelUpAxis:c,upAxis:l,uri:e,byteLength:f,memoryUsage:getMemoryUsage(t),scene:t,textures:[],animations:[],dispose:()=>t.dispose()}))}var ROTATE_X_MATRIX$1=new three.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),ROTATE_X_MATRIX_INVERSE$1=new three.Matrix4().getInverse(ROTATE_X_MATRIX$1),KHR_gaussian_splatting_compression_spz=class extends BaseExtension{load(e,t){return __awaiter(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return __awaiter(this,void 0,void 0,function*(){return Promise.resolve().then(()=>parseSpz(e)).then(e=>(e.applyMatrix4(ROTATE_X_MATRIX_INVERSE$1),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}},ROTATE_X_MATRIX=new three.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),ROTATE_X_MATRIX_INVERSE=new three.Matrix4().getInverse(ROTATE_X_MATRIX),KHR_gaussian_splatting_compression_spz_2=class extends BaseExtension{constructor(){super()}load(e,t){return __awaiter(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return __awaiter(this,void 0,void 0,function*(){return Promise.resolve().then(()=>parseSpz(e)).then(e=>(e.applyMatrix4(ROTATE_X_MATRIX_INVERSE),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}},EXTENSIONS={KHR_binary_glTF,KHR_draco_mesh_compression,KHR_texture_basisu,KHR_texture_transform,KHR_mesh_quantization,KHR_materials_unlit,KHR_node_visibility,KHR_animation_pointer,KHR_materials_clearcoat,KHR_materials_sheen,KHR_materials_transmission,KHR_materials_emissive_strength,EXT_meshopt_compression,EXT_texture_webp,CESIUM_RTC,REALSEE_materials_lightmap,KHR_gaussian_splatting,KHR_gaussian_splatting_compression_spz,KHR_gaussian_splatting_compression_spz_2};function parseGltf(e,t){var n,r,o;let s={},c,l;if(typeof e==`string`)l=e;else if(EXTENSIONS.KHR_binary_glTF.getMagic(e)===EXTENSIONS.KHR_binary_glTF.HEADER_MAGIC){c=new EXTENSIONS.KHR_binary_glTF;try{c.loadGlbBinary(e)}catch(e){return Promise.reject(e)}s.KHR_binary_glTF=c,l=c.content}else l=decodeText(new Uint8Array(e));let u=JSON.parse(l);if(t.jsonModify&&(u=t.jsonModify(u)),u.asset===void 0||Number(u.asset.version[0])<2)return Promise.reject(Error(`glTF: Unsupported asset. glTF versions >=2.0 are supported.`));if(u.extensionsUsed){let e=u.extensionsRequired||[];for(var d=0;d<u.extensionsUsed.length;d++){let t=u.extensionsUsed[d];s[t]||(EXTENSIONS[t]?s[t]=new EXTENSIONS[t]:e.indexOf(t)>=0&&console.warn(`glTF: Unknown extension "`+t+`".`))}}return new Parser(u,s,{copyUV2:(n=t.copyUV2)==null?!1:n,resourcePath:(r=t.resourcePath)==null?``:r,search:(o=t.search)==null?``:o,fetcher:t.fetcher}).parse().then(e=>(c&&c.clear(),e))}function loadB3dm(e,t={}){var n,r,o,s;let c=(n=t.modelUpAxis)==null?`Y`:n,l=(r=t.upAxis)==null?`Z`:r,u=(o=t.fetcher)==null?internalFetcher:o,d=(s=t.onDownloadProgress)==null?noop:s,f={uri:e,gltfUpAxis:c};return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>parseHeader$1(f,e,t)).then(t=>parseTable(f,e,t)).then(t=>parseGlTFArrayBuffer(f,e,t))).then(()=>{var n;return parseGltf(f.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:u}).then(e=>{let t=new three.Matrix4;c===`Y`&&t.premultiply(ROTATE_X_MATRIX$2);let n;if(f.rtcCenter?n=new three.Vector3().fromArray(f.rtcCenter):e.CESIUM_RTC&&(n=new three.Vector3().copy(e.CESIUM_RTC.center)),n){let e=new three.Matrix4().setPosition(n);t.premultiply(e)}return l===`Y`&&t.premultiply(ROTATE_X_MATRIX_INVERSE$2),e.scene.applyMatrix4(t),f.featureTableBinary=void 0,f.batchTableBinary=void 0,f.gltfArrayBuffer=void 0,{type:`b3dm`,modelUpAxis:c,upAxis:`Z`,uri:f.uri,byteLength:f.byteLength,memoryUsage:getMemoryUsage(e.scene),scene:e.scene,textures:e.textures,animations:[],rtcCenter:n,dispose:()=>e.dispose()}})})}var jsContent$2="(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||(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==null?(t.byteLength-n)/a(e):r):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}})();",blob$2=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,jsContent$2],{type:`text/javascript;charset=utf-8`});function WorkerWrapper$2(e){let t;try{if(t=blob$2&&(self.URL||self.webkitURL).createObjectURL(blob$2),!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(jsContent$2),{name:e==null?void 0:e.name})}}var attributeWorkerPool=new WorkerPool(()=>new WorkerWrapper$2,2);function parsePointCloud(e,t,n){let r=new FeatureTable(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then(()=>{let e=r.getExtension(`3DTILES_draco_point_compression`);return e?parseDraco(e,r):attributeWorkerPool.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(t=>(e.attributes=t,n))}function parseDraco(e,t){return __awaiter(this,void 0,void 0,function*(){let n=e.properties||{},r=e.byteOffset,o=e.byteLength;if(!n||!Number.isFinite(r)||!o)throw Error(`Draco properties, byteOffset, and byteLength must be defined`);let s=t.buffer.slice(r,r+o),c=e.properties;return draco.decodeGeometry(s.buffer,{attributeIDs:c,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`),o=e.getAttribute(`NORMAL`),s;if(r)s=r;else if(n){let e=n.count,t=n.array,r=new Uint8Array(e*4);for(let n=0,o,s;n<e;n++)s=n*4,o=n*3,r[s]=t[o],r[++s]=t[++o],r[++s]=t[++o];s=new three.BufferAttribute(r,4,n.normalized)}return{position:t?{array:t.array,itemSize:t.itemSize,normalized:t.normalized}:null,color:s?{array:s.array,itemSize:s.itemSize,normalized:s.normalized}:null,normal:o?{array:o.array,itemSize:o.itemSize,normalized:o.normalized}:null}})})}function loadPnts(e,t={}){var n,r,o;let s=(n=t.upAxis)==null?`Z`:n,c=(r=t.fetcher)==null?internalFetcher:r,l=(o=t.onDownloadProgress)==null?noop:o,u={uri:e};return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>parseHeader$1(u,e,t)).then(t=>parseTable(u,e,t)).then(t=>parsePointCloud(u,e,t))).then(()=>{var e;return createPoints(u.attributes,{computeBoundingBox:(e=t.computeBoundingBox)==null?!0:e})}).then(e=>{let t=new three.Matrix4,n;if(u.rtcCenter&&(n=new three.Vector3().fromArray(u.rtcCenter)),n){let e=new three.Matrix4().setPosition(n);t.premultiply(e)}return s===`Y`&&t.premultiply(ROTATE_X_MATRIX_INVERSE$2),e.object.applyMatrix4(t),u.gltfArrayBuffer=void 0,u.featureTableBinary=void 0,u.batchTableBinary=void 0,{type:`pnts`,modelUpAxis:`Z`,upAxis:s,uri:u.uri,byteLength:u.byteLength,memoryUsage:getMemoryUsage(e.object),scene:e.object,textures:[],animations:[],rtcCenter:n,dispose:()=>e.dispose()}})}function createPoints(e,t){let n=new Set,r=new three.BufferGeometry;n.add(r);let o=new PBMPointCloudMaterial;n.add(o),e.position&&r.setAttribute(`position`,new three.BufferAttribute(e.position.array,e.position.itemSize,e.position.normalized)),e.color&&r.setAttribute(`color`,new three.BufferAttribute(e.color.array,e.color.itemSize,e.color.normalized)),e.normal?r.setAttribute(`normal`,new three.BufferAttribute(e.normal.array,e.normal.itemSize,e.normal.normalized)):o.flatShading=!0,t.computeBoundingBox&&r.computeBoundingBox();let s=new PBMPointCloud(r,o);return s.matrix.compose(s.position,s.quaternion,s.scale),s.matrixAutoUpdate=!1,s.frustumCulled=!1,Promise.resolve({object:s,dispose:()=>{n.forEach(e=>{e.dispose()}),n.clear()}})}function loadGltf(e,t={}){var n,r,o,s,c;let l=(n=t.modelUpAxis)==null?`Y`:n,u=(r=t.upAxis)==null?`Z`:r,d=(o=t.fetcher)==null?internalFetcher:o,f=(s=t.onDownloadProgress)==null?noop:s,p=(c=t.jsonModify)==null?noop:c,m=0;return Promise.resolve().then(()=>d.ajax(e,{responseType:`arraybuffer`},void 0,void 0,f).then(e=>(m=e.body.byteLength,e.body))).then(n=>{var r;return parseGltf(n,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var n,r,o;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(o=p(e))==null?e:o},fetcher:d})}).then(t=>{var n;let r=new three.Matrix4;if(l===`Y`&&r.premultiply(ROTATE_X_MATRIX$2),t.CESIUM_RTC){let e=new three.Matrix4().setPosition(t.CESIUM_RTC.center);r.premultiply(e)}return u===`Y`&&r.premultiply(ROTATE_X_MATRIX_INVERSE$2),t.scene.applyMatrix4(r),{type:`gltf`,modelUpAxis:l,upAxis:u,uri:e,byteLength:m,memoryUsage:getMemoryUsage(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 scratchColor=new three.Color;function loadPly(e,t={}){var n,r,o,s;let c=(n=t.modelUpAxis)==null?`Z`:n,l=(r=t.upAxis)==null?`Z`:r,u=(o=t.fetcher)==null?internalFetcher:o,d=(s=t.onDownloadProgress)==null?noop:s,f=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>(f=e.body.byteLength,e.body))).then(e=>{var n,r;return parsePly(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 c===`Y`&&t.applyMatrix4(ROTATE_X_MATRIX$2),l===`Y`&&t.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),{type:`ply`,modelUpAxis:c,upAxis:l,uri:e,byteLength:f,memoryUsage:getGeometryMemoryUsed(t),scene:t,textures:[],animations:[],dispose:()=>{n.dispose()}}}case`line`:{let t=`color`in n.attributes,r=new three.LineBasicMaterial({vertexColors:t}),o=new three.Line(n,r);return o.computeLineDistances(),c===`Y`&&o.applyMatrix4(ROTATE_X_MATRIX$2),l===`Y`&&o.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),{type:`ply`,modelUpAxis:c,upAxis:l,uri:e,byteLength:f,memoryUsage:getMemoryUsage(o),scene:o,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmMesh`:{let r=new PBMMeshMaterial(t.light?`phong`:`basic`);r.vertexColors=`color`in n.attributes;let o=new three.Mesh(n,r);return c===`Y`&&o.applyMatrix4(ROTATE_X_MATRIX$2),l===`Y`&&o.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),{type:`ply`,modelUpAxis:c,upAxis:l,uri:e,byteLength:f,memoryUsage:getMemoryUsage(o),scene:o,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmPointCloud`:{let t=new PBMPointCloudMaterial,r=new PBMPointCloud(n,t);return c===`Y`&&r.applyMatrix4(ROTATE_X_MATRIX$2),l===`Y`&&r.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),{type:`ply`,modelUpAxis:c,upAxis:l,uri:e,byteLength:f,memoryUsage:getMemoryUsage(r),scene:r,textures:[],animations:[],dispose:()=>{n.dispose(),t.dispose()}}}default:break}throw Error(`Invalid Type: ${t.type}`)})}function parsePly(e,t){let n=new Uint8Array(e),{headerText:r,headerLength:o}=extractHeaderText(n),s=parseHeader(r,o,t);return s.format===`ascii`?{header:s,geometry:parseASCII(new TextDecoder().decode(n),s,t)}:{header:s,geometry:parseBinary(e,s,t)}}function makePlyElementProperty(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 parseHeader(e,t=0,n){let r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,o=``,s=r.exec(e);s!==null&&(o=s[1]);let c={format:``,version:``,comments:[],elements:[],headerLength:t,objInfo:``},l=o.split(/\r\n|\r|\n/),u=null;for(let e=0;e<l.length;e++){let t=l[e];if(t=t.trim(),t===``)continue;let r=t.split(/\s+/),o=r.shift();switch(t=r.join(` `),o){case`format`:c.format=r[0],c.version=r[1];break;case`comment`:c.comments.push(t);break;case`element`:u&&c.elements.push(u),u={name:r[0],count:parseInt(r[1]),properties:[]};break;case`property`:u&&u.properties.push(makePlyElementProperty(r,n));break;case`obj_info`:c.objInfo=t;break;default:console.log(`unhandled`,o,r)}}return u&&c.elements.push(u),c}function parseASCIINumber(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 parseASCIIElement(e,t){let n={};for(let r=0;r<e.length;r++){if(t.empty())return null;if(e[r].type===`list`){let o=[],s=parseASCIINumber(t.next(),e[r].countType);for(let n=0;n<s;n++){if(t.empty())return null;o.push(parseASCIINumber(t.next(),e[r].itemType))}n[e[r].name]=o}else n[e[r].name]=parseASCIINumber(t.next(),e[r].type)}return n}function createBuffer(e){let t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(let n of Object.keys(e.customPropertyMapping))t[n]=[];return t}function mapElementAttributes(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 parseASCII(e,t,n){let r=createBuffer(n),o=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,s,c=null;s=(c=o.exec(e))===null?[]:c[1].split(/\s+/);let l=new ArrayStream(s);loop:for(let e=0;e<t.elements.length;e++){let o=t.elements[e],s=mapElementAttributes(o.properties);for(let e=0;e<o.count;e++){let e=parseASCIIElement(o.properties,l);if(!e)break loop;handleElement(r,o.name,e,s,n)}}return postProcess(r,n)}function postProcess(e,t){let n=new three.BufferGeometry;e.indices.length>0&&n.setIndex(e.indices),n.setAttribute(`position`,new three.Float32BufferAttribute(e.vertices,3)),e.normals.length>0&&n.setAttribute(`normal`,new three.Float32BufferAttribute(e.normals,3)),e.uvs.length>0&&n.setAttribute(`uv`,new three.Float32BufferAttribute(e.uvs,2)),e.colors.length>0&&n.setAttribute(`color`,new three.Float32BufferAttribute(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(n=n.toNonIndexed(),e.faceVertexUvs.length>0&&n.setAttribute(`uv`,new three.Float32BufferAttribute(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&n.setAttribute(`color`,new three.Float32BufferAttribute(e.faceVertexColors,3)));for(let r of Object.keys(t.customPropertyMapping))if(e[r].length>0){let{itemType:o,itemNames:s,normalized:c}=t.customPropertyMapping[r],l=s.length,u;switch(o){case`float32`:u=new three.Float32BufferAttribute(e[r],l,c);break;case`uint32`:u=new three.Uint32BufferAttribute(e[r],l,c);break;case`int32`:u=new three.Int32BufferAttribute(e[r],l,c);break;case`uint16`:u=new three.Uint16BufferAttribute(e[r],l,c);break;case`int16`:u=new three.Int16BufferAttribute(e[r],l,c);break;case`uint8`:u=new three.Uint8BufferAttribute(e[r],l,c);break;case`int8`:u=new three.Int8BufferAttribute(e[r],l,c);break;default:u=new three.Float32BufferAttribute(e[r],l,c);break}n.setAttribute(r,u)}return n.computeBoundingSphere(),n}function handleElement(e,t,n,r,o){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&&(scratchColor.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.colors.push(scratchColor.r,scratchColor.g,scratchColor.b));for(let t of Object.keys(o.customPropertyMapping))for(let r of o.customPropertyMapping[t].itemNames)e[t].push(n[r])}else if(t===`face`){let t=n.vertex_indices||n.vertex_index,o=n.texcoord;t.length===3?(e.indices.push(t[0],t[1],t[2]),o&&o.length===6&&(e.faceVertexUvs.push(o[0],o[1]),e.faceVertexUvs.push(o[2],o[3]),e.faceVertexUvs.push(o[4],o[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&&(scratchColor.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),e.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b),e.faceVertexColors.push(scratchColor.r,scratchColor.g,scratchColor.b))}}function binaryReadElement(e,t){let n={},r=0;for(let o=0;o<t.length;o++){let s=t[o],c=s.valueReader;if(s.type===`list`){let t=[],o=s.countReader.read(e+r);r+=s.countReader.size;for(let n=0;n<o;n++)t.push(c.read(e+r)),r+=c.size;n[s.name]=t}else n[s.name]=c.read(e+r),r+=c.size}return[n,r]}function setPropertyBinaryReaders(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 o=0,s=e.length;o<s;o++){let s=e[o];s.type===`list`?(s.countReader=r(t,s.countType,n),s.valueReader=r(t,s.itemType,n)):s.valueReader=r(t,s.type,n)}}function parseBinary(e,t,n){let r=createBuffer(n),o=t.format===`binary_little_endian`,s=new DataView(e,t.headerLength),c,l=0;for(let e=0;e<t.elements.length;e++){let u=t.elements[e],d=u.properties,f=mapElementAttributes(d);setPropertyBinaryReaders(d,s,o);for(let e=0;e<u.count;e++){c=binaryReadElement(l,d),l+=c[1];let e=c[0];handleElement(r,u.name,e,f,n)}}return postProcess(r,n)}function extractHeaderText(e){let t=0,n=!0,r=``,o=[],s=new TextDecoder().decode(e.subarray(0,5)),c=/^ply\r\n/.test(s);do{let s=String.fromCharCode(e[t++]);s!==`
|
|
862
862
|
`&&s!==`\r`?r+=s:(r===`end_header`&&(n=!1),r!==``&&(o.push(r),r=``))}while(n&&t<e.length);return c===!0&&t++,{headerText:o.join(`\r`)+`\r`,headerLength:t}}var ArrayStream=class{constructor(e){this.arr=e,this.i=0}empty(){return this.i>=this.arr.length}next(){return this.arr[this.i++]}},u8=Uint8Array,u16=Uint16Array,i32=Int32Array,fleb=new u8([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]),fdeb=new u8([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]),clim=new u8([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(e,t){for(var n=new u16(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new i32(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return{b:n,r:o}},_a$3=freb(fleb,2),fl=_a$3.b,revfl=_a$3.r;fl[28]=258,revfl[258]=28;for(var _b=freb(fdeb,0),fd=_b.b,revfd=_b.r,rev=new u16(32768),i=0;i<32768;++i){var x=(i&43690)>>1|(i&21845)<<1;x=(x&52428)>>2|(x&13107)<<2,x=(x&61680)>>4|(x&3855)<<4,rev[i]=((x&65280)>>8|(x&255)<<8)>>1}for(var hMap=(function(e,t,n){for(var r=e.length,o=0,s=new u16(t);o<r;++o)e[o]&&++s[e[o]-1];var c=new u16(t);for(o=1;o<t;++o)c[o]=c[o-1]+s[o-1]<<1;var l;if(n){l=new u16(1<<t);var u=15-t;for(o=0;o<r;++o)if(e[o])for(var d=o<<4|e[o],f=t-e[o],p=c[e[o]-1]++<<f,m=p|(1<<f)-1;p<=m;++p)l[rev[p]>>u]=d}else for(l=new u16(r),o=0;o<r;++o)e[o]&&(l[o]=rev[c[e[o]-1]++]>>15-e[o]);return l}),flt=new u8(288),i=0;i<144;++i)flt[i]=8;for(var i=144;i<256;++i)flt[i]=9;for(var i=256;i<280;++i)flt[i]=7;for(var i=280;i<288;++i)flt[i]=8;for(var fdt=new u8(32),i=0;i<32;++i)fdt[i]=5;var flm=hMap(flt,9,0),flrm=hMap(flt,9,1),fdm=hMap(fdt,5,0),fdrm=hMap(fdt,5,1),max=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},bits=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},bits16=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},shft=function(e){return(e+7)/8|0},slc=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new u8(e.subarray(t,n))},ec=[`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`],err=function(e,t,n){var r=Error(t||ec[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,err),!n)throw r;return r},inflt=function(e,t,n,r){var o=e.length,s=r?r.length:0;if(!o||t.f&&!t.l)return n||new u8(0);var c=!n,l=c||t.i!=2,u=t.i;c&&(n=new u8(o*3));var d=function(e){var t=n.length;if(e>t){var r=new u8(Math.max(t*2,e));r.set(n),n=r}},f=t.f||0,p=t.p||0,m=t.b||0,h=t.l,g=t.d,_=t.m,v=t.n,y=o*8;do{if(!h){f=bits(e,p,1);var b=bits(e,p+1,3);if(p+=3,!b){var S=shft(p)+4,C=e[S-4]|e[S-3]<<8,w=S+C;if(w>o){u&&err(0);break}l&&d(m+C),n.set(e.subarray(S,w),m),t.b=m+=C,t.p=p=w*8,t.f=f;continue}else if(b==1)h=flrm,g=fdrm,_=9,v=5;else if(b==2){var T=bits(e,p,31)+257,E=bits(e,p+10,15)+4,D=T+bits(e,p+5,31)+1;p+=14;for(var O=new u8(D),k=new u8(19),A=0;A<E;++A)k[clim[A]]=bits(e,p+A*3,7);p+=E*3;for(var j=max(k),M=(1<<j)-1,N=hMap(k,j,1),A=0;A<D;){var P=N[bits(e,p,M)];p+=P&15;var S=P>>4;if(S<16)O[A++]=S;else{var F=0,I=0;for(S==16?(I=3+bits(e,p,3),p+=2,F=O[A-1]):S==17?(I=3+bits(e,p,7),p+=3):S==18&&(I=11+bits(e,p,127),p+=7);I--;)O[A++]=F}}var L=O.subarray(0,T),R=O.subarray(T);_=max(L),v=max(R),h=hMap(L,_,1),g=hMap(R,v,1)}else err(1);if(p>y){u&&err(0);break}}l&&d(m+131072);for(var z=(1<<_)-1,B=(1<<v)-1,V=p;;V=p){var F=h[bits16(e,p)&z],H=F>>4;if(p+=F&15,p>y){u&&err(0);break}if(F||err(2),H<256)n[m++]=H;else if(H==256){V=p,h=null;break}else{var ee=H-254;if(H>264){var A=H-257,te=fleb[A];ee=bits(e,p,(1<<te)-1)+fl[A],p+=te}var U=g[bits16(e,p)&B],W=U>>4;U||err(3),p+=U&15;var R=fd[W];if(W>3){var te=fdeb[W];R+=bits16(e,p)&(1<<te)-1,p+=te}if(p>y){u&&err(0);break}l&&d(m+131072);var G=m+ee;if(m<R){var K=s-R,ne=Math.min(R,G);for(K+m<0&&err(3);m<ne;++m)n[m]=r[K+m]}for(;m<G;++m)n[m]=n[m-R]}}t.l=h,t.p=V,t.b=m,t.f=f,h&&(f=1,t.m=_,t.d=g,t.n=v)}while(!f);return m!=n.length&&c?slc(n,0,m):n.subarray(0,m)},et=new u8(0),b2=function(e,t){return e[t]|e[t+1]<<8},b4=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},b8=function(e,t){return b4(e,t)+b4(e,t+4)*4294967296},zls=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&err(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&err(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function inflateSync(e,t){return inflt(e,{i:2},t&&t.out,t&&t.dictionary)}function unzlibSync(e,t){return inflt(e.subarray(zls(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var td=typeof TextDecoder<`u`&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0})}catch(e){}var dutf8=function(e){for(var t=``,n=0;;){var r=e[n++],o=(r>127)+(r>223)+(r>239);if(n+o>e.length)return{s:t,r:slc(e,n-1)};o?o==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)):o&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 strFromU8(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(td)return td.decode(e);else{var o=dutf8(e),s=o.s,n=o.r;return n.length&&err(8),s}}var slzh=function(e,t){return t+30+b2(e,t+26)+b2(e,t+28)},zh=function(e,t,n){var r=b2(e,t+28),o=strFromU8(e.subarray(t+46,t+46+r),!(b2(e,t+8)&2048)),s=t+46+r,c=b4(e,t+20),l=n&&c==4294967295?z64e(e,s):[c,b4(e,t+24),b4(e,t+42)],u=l[0],d=l[1],f=l[2];return[b2(e,t+10),u,d,o,s+b2(e,t+30)+b2(e,t+32),f]},z64e=function(e,t){for(;b2(e,t)!=1;t+=4+b2(e,t+2));return[b8(e,t+12),b8(e,t+4),b8(e,t+20)]};function unzipSync(e,t){for(var n={},r=e.length-22;b4(e,r)!=101010256;--r)(!r||e.length-r>65558)&&err(13);var o=b2(e,r+8);if(!o)return{};var s=b4(e,r+16),c=s==4294967295||o==65535;if(c){var l=b4(e,r-12);c=b4(e,l)==101075792,c&&(o=b4(e,l+32),s=b4(e,l+48))}for(var u=t&&t.filter,d=0;d<o;++d){var f=zh(e,s,c),p=f[0],m=f[1],h=f[2],g=f[3],_=f[4],v=f[5],y=slzh(e,v);s=_,(!u||u({name:g,size:m,originalSize:h,compression:p}))&&(p?p==8?n[g]=inflateSync(e.subarray(y,y+m),{out:new u8(h)}):err(14,`unknown compression type `+p):n[g]=slc(e,y,y+m))}return n}function loadFbx(e,t={}){var n,r,o;let s=(n=t.upAxis)==null?`Z`:n,c=(r=t.fetcher)==null?internalFetcher:r,l=(o=t.onDownloadProgress)==null?noop:o,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(n=>{var r;return parse$2(n,{light:t.light,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,fetcher:c})}).then(t=>{let n=t.scene,r=t.unitScale/100,o=new three.Matrix4;if(o.makeScale(r,r,r),t.upAxis===`X`)throw Error(`Cannot load fbx x upAxis`);return t.upAxis===`Y`&&o.premultiply(ROTATE_X_MATRIX$2),s===`Y`&&o.premultiply(ROTATE_X_MATRIX_INVERSE$2),n.applyMatrix4(o),{type:`fbx`,modelUpAxis:t.upAxis,upAxis:s,uri:e,byteLength:u,memoryUsage:getMemoryUsage(n),scene:n,textures:t.textures,animations:t.animations,dispose:()=>t.dispose()}})}function parse$2(e,t){let n;if(isFbxFormatBinary(e))n=new BinaryParser().parse(e);else{let t=convertArrayBufferToString(e);if(!isFbxFormatASCII(t))throw Error(`THREE.FBXLoader: Unknown format.`);if(getFbxVersion(t)<7e3)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+getFbxVersion(t));n=new TextParser().parse(t)}return new FBXTreeParser(t).parse(n)}var FBXTreeParser=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,o,s,c;let l=this.parseConnections(e),u=Object.assign(new three.Group,{animations:[]}),d=[],f=this.parseImages(e),p=this.parseTextures(e,f,l,d),m=this.parseMaterials(e,p,l),h=this.parseDeformers(e,l),g=new GeometryParser().parse(e,h,l);this.parseScene(e,h,g,m,l,u);let _=(n=(t=e.GlobalSettings.UpAxis)==null?void 0:t.value)==null?1:n,v=(o=(r=e.GlobalSettings.FrontAxis)==null?void 0:r.value)==null?2:o,y=(c=(s=e.GlobalSettings.UnitScaleFactor)==null?void 0:s.value)==null?1:c,b;if(e.GlobalSettings.AmbientColor){let t=e.GlobalSettings.AmbientColor.value,n=t[0],r=t[1],o=t[2];if(n!==0||r!==0||o!==0){let e=new three.Color().setRGB(n,r,o);b=new three.AmbientLight(e,1)}}return Promise.all(d).then(e=>{var t;return{scene:u,textures:e,ambientLight:b,upAxis:[`X`,`Y`,`Z`][_],frontAxis:[`X`,`Y`,`Z`][v],unitScale:y,animations:(t=u.animations)==null?[]:t,dispose:()=>{e.forEach(e=>e.dispose()),m.forEach(e=>e.dispose()),g.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],o=e[2];t.has(n)||t.set(n,{parents:[],children:[]});let s={ID:r,relationship:o};t.get(n).parents.push(s),t.has(r)||t.set(r,{parents:[],children:[]});let c={ID:n,relationship:o};t.get(r).children.push(c)}),t}parseImages(e){let t={},n={};if(`Video`in e.Objects){let r=e.Objects.Video;for(let e in r){let o=r[e],s=parseInt(e);if(t[s]=o.RelativeFilename||o.Filename,`Content`in o){let t=o.Content instanceof ArrayBuffer&&o.Content.byteLength>0,s=typeof o.Content==`string`&&o.Content!==``;if(t||s){let t=this.parseImage(r[e]);n[o.RelativeFilename||o.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(),o;switch(r){case`bmp`:o=`image/bmp`;break;case`jpg`:case`jpeg`:o=`image/jpeg`;break;case`png`:o=`image/png`;break;case`tif`:o=`image/tiff`;break;case`tga`:o=`image/tga`;break;default:return}if(typeof t==`string`)return`data:`+o+`;base64,`+t;{let e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:o}))}}parseTextures(e,t,n,r){let o=new Map;if(`Texture`in e.Objects){let s=e.Objects.Texture;for(let e in s){let c=this.parseTexture(s[e],t,n,r);o.set(parseInt(e),c)}}return o}parseTexture(e,t,n,r){let o=this.loadTexture(e,t,n,r);o.ID=e.id,o.name=e.attrName;let s=e.WrapModeU,c=e.WrapModeV,l=s===void 0?0:s.value,u=c===void 0?0:c.value;if(o.wrapS=l===0?three.RepeatWrapping:three.ClampToEdgeWrapping,o.wrapT=u===0?three.RepeatWrapping:three.ClampToEdgeWrapping,e.Scaling){let t=e.Scaling.value;o.repeat.x=t[0],o.repeat.y=t[1]}if(e.Translation){let t=e.Translation.value;o.offset.x=t[0],o.offset.y=t[1]}return o}loadTexture(e,t,n,r){let o=n.get(e.id).children,s=``;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(s=t[o[0].ID]),s=pathJoin(this.resourcePath,appendSearch(s,this.search));let c=Object.assign(new three.Texture,{ID:0}),l;l=canUseNativeImageBitmap()?this.fetcher.ajax(s,{responseType:`blob`}).then(e=>{let t=e.body;return createImageBitmapLike(t)}):this.fetcher.loadImage(s,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then(e=>e.body);let u=l.then(e=>(c.image=e,c.needsUpdate=!0,c)).catch(e=>(console.warn(e),c));return r.push(u),c}parseMaterials(e,t,n){let r=new Map;if(`Material`in e.Objects){let o=e.Objects.Material;for(let s in o){let c=this.parseMaterial(e,o[s],t,n);c!==null&&r.set(parseInt(s),c)}}return r}parseMaterial(e,t,n,r){let o=t.id,s=t.attrName,c=t.ShadingModel;if(typeof c==`object`&&(c=c.value),c=c.toLowerCase(),!r.has(o))return null;let l=new PBMMeshMaterial(this.light?`phong`:`basic`);l.name=s,t.BumpFactor&&(l.bumpScale=t.BumpFactor.value),t.Diffuse?l.color=new three.Color().fromArray(t.Diffuse.value):t.DiffuseColor&&(t.DiffuseColor.type===`Color`||t.DiffuseColor.type===`ColorRGB`)&&(l.color=new three.Color().fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(l.displacementScale=t.DisplacementFactor.value),t.Emissive?l.emissive=new three.Color().fromArray(t.Emissive.value):t.EmissiveColor&&(t.EmissiveColor.type===`Color`||t.EmissiveColor.type===`ColorRGB`)&&(l.emissive=new three.Color().fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(l.emissiveIntensity=parseFloat(t.EmissiveFactor.value));let u=1-(t.TransparencyFactor?parseFloat(t.TransparencyFactor.value):0);(u===1||u===0)&&(u=t.Opacity?parseFloat(t.Opacity.value):null,u===null&&(u=1-(t.TransparentColor?parseFloat(t.TransparentColor.value[0]):0))),l.opacity=u,l.opacity<1&&(l.transparent=!0),t.ReflectionFactor&&(l.reflectivity=t.ReflectionFactor.value),t.Shininess&&(l.shininess=t.Shininess.value),t.Specular?l.specular=new three.Color().fromArray(t.Specular.value):t.SpecularColor&&t.SpecularColor.type===`Color`&&(l.specular=new three.Color().fromArray(t.SpecularColor.value));let d=this;return r.get(o).children.forEach(function(t){let o=t.relationship;switch(o){case`Bump`:l.bumpMap=d.getTexture(e,n,t.ID,r);break;case`Maya|TEX_ao_map`:l.aoMap=d.getTexture(e,n,t.ID,r);break;case`DiffuseColor`:case`Maya|TEX_color_map`:l.map=d.getTexture(e,n,t.ID,r),l.map!==void 0&&(l.map.encoding=three.sRGBEncoding);break;case`DisplacementColor`:l.displacementMap=d.getTexture(e,n,t.ID,r);break;case`EmissiveColor`:l.emissiveMap=d.getTexture(e,n,t.ID,r),l.emissiveMap!==void 0&&(l.emissiveMap.encoding=three.sRGBEncoding);break;case`NormalMap`:case`Maya|TEX_normal_map`:l.normalMap=d.getTexture(e,n,t.ID,r);break;case`ReflectionColor`:l.envMap=d.getTexture(e,n,t.ID,r),l.envMap!==void 0&&(l.envMap.mapping=three.EquirectangularReflectionMapping,l.envMap.encoding=three.sRGBEncoding);break;case`SpecularColor`:l.specularMap=d.getTexture(e,n,t.ID,r),l.specularMap!==void 0&&(l.specularMap.encoding=three.sRGBEncoding);break;case`TransparentColor`:case`TransparencyFactor`:l.alphaMap=d.getTexture(e,n,t.ID,r),l.transparent=!0;break;default:console.warn(`THREE.FBXLoader: %s map is not supported in three.js, skipping texture.`,o);break}}),l}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 o=e.Objects.Deformer;for(let e in o){let s=o[e],c=t.get(parseInt(e));if(s.attrType===`Skin`){let t=this.parseSkeleton(c,o);t.ID=e,c.parents.length>1&&console.warn(`THREE.FBXLoader: skeleton attached to more than one geometry is not supported.`),t.geometryID=c.parents[0].ID,n[e]=t}else if(s.attrType===`BlendShape`){let n={id:e};n.rawTargets=this.parseMorphTargets(c,o,t),n.id=e,c.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 o={ID:e.ID,indices:[],weights:[],transformLink:new three.Matrix4().fromArray(r.TransformLink.a)};r.Indexes&&(o.indices=r.Indexes.a,o.weights=r.Weights.a),n.push(o)}),{ID:``,geometryID:0,rawBones:n,bones:[]}}parseMorphTargets(e,t,n){let r=[];for(let o=0;o<e.children.length;o++){let s=e.children[o],c=t[s.ID],l={name:c.attrName,initialWeight:c.DeformPercent,id:c.id,fullWeights:c.FullWeights.a,geoID:0};if(c.attrType!==`BlendShapeChannel`)return;l.geoID=n.get(parseInt(s.ID)).children.filter(function(e){return e.relationship===void 0})[0].ID,r.push(l)}return r}parseScene(e,t,n,r,o,s){let c=this.parseModels(e,t.skeletons,n,r,o),l=e.Objects.Model,u=this;c.forEach(function(t){let n=l[t.ID];u.setLookAtProperties(e,t,n,o,s),o.get(t.ID).parents.forEach(function(e){let n=c.get(e.ID);n!==void 0&&n.add(t)}),t.parent===null&&s.add(t)}),this.bindSkeleton(e,t.skeletons,n,c,o),s.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=generateTransform(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix(!0,!0)}});let d=new AnimationParser().parse(e,o,s);s.children.length===1&&s.children[0]instanceof three.Group&&(s=s.children[0]),s.animations=d}parseModels(e,t,n,r,o){let s=new Map,c=e.Objects.Model;for(let l in c){let u=parseInt(l),d=c[l],f=o.get(u),p=this.buildSkeleton(f,t,u,d.attrName);if(!p){switch(d.attrType){case`Camera`:p=this.createCamera(e,f);break;case`Light`:p=this.createLight(e,f);break;case`Mesh`:p=this.createMesh(f,n,r);break;case`NurbsCurve`:case`LimbNode`:case`Root`:p=new three.Bone;break;default:p=new three.Group;break}p.name=d.attrName?three.PropertyBinding.sanitizeNodeName(d.attrName):``,p.userData.originalName=d.attrName,p.ID=u}this.getTransformData(p,d),s.set(u,p)}return s}buildSkeleton(e,t,n,r){let o=null;return e.parents.forEach(function(e){for(let s in t){let c=t[s];c.rawBones.forEach(function(t,s){if(t.ID===e.ID){let e=o;o=new three.Bone,o.matrixWorld.copy(t.transformLink),o.name=r?three.PropertyBinding.sanitizeNodeName(r):``,o.userData.originalName=r,o.ID=n,c.bones[s]=o,e!==null&&o.add(e)}})}}),o}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 three.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 o=1e3;r.FarPlane!==void 0&&(o=r.FarPlane.value/1e3);let s=window.innerWidth,c=window.innerHeight;r.AspectWidth!==void 0&&r.AspectHeight!==void 0&&(s=r.AspectWidth.value,c=r.AspectHeight.value);let l=s/c,u=45;r.FieldOfView!==void 0&&(u=r.FieldOfView.value);let d=r.FocalLength?r.FocalLength.value:null;switch(e){case 0:n=new three.PerspectiveCamera(u,l,t,o),d!==null&&n.setFocalLength(d);break;case 1:console.warn(`THREE.FBXLoader: Orthographic cameras not supported yet.`),n=new three.Object3D;break;default:console.warn(`THREE.FBXLoader: Unknown camera type `+e+`.`),n=new three.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 three.Object3D;else{let e;e=r.LightType===void 0?0:r.LightType.value;let t=new three.Color(16777215);r.Color!==void 0&&(t=new three.Color().fromArray(r.Color.value));let o=r.Intensity===void 0?1:r.Intensity.value/100;r.CastLightOnObject!==void 0&&r.CastLightOnObject.value===0&&(o=0);let s=0;r.FarAttenuationEnd!==void 0&&(s=r.EnableFarAttenuation!==void 0&&r.EnableFarAttenuation.value===0?0:r.FarAttenuationEnd.value);let c=1;switch(e){case 0:n=new three.PointLight(t,o,s,1);break;case 1:n=new three.DirectionalLight(t,o);break;case 2:let e=Math.PI/3;r.InnerAngle!==void 0&&(e=three.MathUtils.degToRad(r.InnerAngle.value));let c=0;r.OuterAngle!==void 0&&(c=three.MathUtils.degToRad(r.OuterAngle.value),c=Math.max(c,1)),n=new three.SpotLight(t,o,s,e,c,1);break;default:console.warn(`THREE.FBXLoader: Unknown light type `+r.LightType.value+`, defaulting to a PointLight.`),n=new three.PointLight(t,o);break}r.CastShadows!==void 0&&r.CastShadows.value===1&&(n.castShadow=!0)}return n}createMesh(e,t,n){let r,o=null,s=[];if(e.children.forEach(function(e){t.has(e.ID)&&(o=t.get(e.ID)),n.has(e.ID)&&s.push(n.get(e.ID))}),s.length===0){let e=new PBMMeshMaterial(this.light?`phong`:`basic`);e.color=new three.Color(13421772),s.push(e)}return`color`in o.attributes&&s.forEach(function(e){e.vertexColors=!0}),(!o.groups||o.groups.length===0)&&o.addGroup(0,o.index?o.index.count:o.attributes.position.count,0),o.FBX_Deformer?(s.forEach(function(e){e.skinning=!0}),r=new PBMSkinnedMesh(o,s),r.normalizeSkinWeights()):r=new PBMMesh(o,s),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 three.LineBasicMaterial({name:``,color:3342591,linewidth:1});return new three.Line(n,r)}getTransformData(e,t){let n={};t.InheritType&&(n.inheritType=parseInt(t.InheritType.value)),t.RotationOrder?n.eulerOrder=getEulerOrder(t.RotationOrder.value):n.eulerOrder=getEulerOrder(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,o){`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 three.Object3D?(t.target.position.fromArray(e),o.add(t.target)):t.lookAt(new three.Vector3().fromArray(e))}}})}bindSkeleton(e,t,n,r,o){let s=this.parsePoseNodes(e);for(let e in t){let c=t[e];o.get(parseInt(c.ID)).parents.forEach(function(e){if(n.has(e.ID)){let t=e.ID;o.get(t).parents.forEach(function(e){if(r.has(e.ID)){let t=r.get(e.ID);t instanceof three.SkinnedMesh&&t.bind(new three.Skeleton(c.bones),s[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 three.Matrix4().fromArray(e.Matrix.a)}):t[r.Node]=new three.Matrix4().fromArray(r.Matrix.a)}}return t}},GeometryParser=class{constructor(){this.negativeMaterialIndices=!1}parse(e,t,n){let r=new Map;if(`Geometry`in e.Objects){let o=e.Objects.Geometry;for(let s in o){let c=n.get(parseInt(s)),l=this.parseGeometry(e,c,o[s],t);r.set(parseInt(s),l)}}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 o=r.skeletons,s=[],c=t.parents.map(function(t){return e.Objects.Model[t.ID]});if(c.length===0)return;let l=t.children.reduce(function(e,t){return o[t.ID]!==void 0&&(e=o[t.ID]),e},null);t.children.forEach(function(e){r.morphTargets[e.ID]!==void 0&&s.push(r.morphTargets[e.ID])});let u=c[0],d={};u.RotationOrder&&(d.eulerOrder=getEulerOrder(u.RotationOrder.value)),u.InheritType&&(d.inheritType=parseInt(u.InheritType.value)),u.GeometricTranslation&&(d.translation=u.GeometricTranslation.value),u.GeometricRotation&&(d.rotation=u.GeometricRotation.value),u.GeometricScaling&&(d.scale=u.GeometricScaling.value);let f=generateTransform(d);return this.genGeometry(e,n,l,s,f)}genGeometry(e,t,n,r,o){let s=new three.BufferGeometry;t.attrName&&(s.name=t.attrName);let c=this.parseGeoNode(t,n),l=this.genBuffers(c),u=new three.Float32BufferAttribute(l.vertex,3);if(u.applyMatrix4(o),s.setAttribute(`position`,u),l.colors.length>0&&s.setAttribute(`color`,new three.Float32BufferAttribute(l.colors,3)),n&&(s.setAttribute(`skinIndex`,new three.Uint16BufferAttribute(l.weightsIndices,4)),s.setAttribute(`skinWeight`,new three.Float32BufferAttribute(l.vertexWeights,4)),s.FBX_Deformer=n),l.normal.length>0){let e=new three.Matrix3().getNormalMatrix(o),t=new three.Float32BufferAttribute(l.normal,3);t.applyNormalMatrix(e),s.setAttribute(`normal`,t)}if(l.uvs.forEach(function(e,t){let n=t===0?`uv`:`uv${t+1}`;s.setAttribute(n,new three.Float32BufferAttribute(l.uvs[t],2))}),c.material&&c.material.mappingType!==`AllSame`){let e=l.materialIndex[0],t=0;if(l.materialIndex.forEach(function(n,r){n!==e&&(s.addGroup(t,r-t,e),e=n,t=r)}),s.groups.length>0){let t=s.groups[s.groups.length-1],n=t.start+t.count;n!==l.materialIndex.length&&s.addGroup(n,l.materialIndex.length-n,e)}s.groups.length===0&&s.addGroup(0,l.materialIndex.length,l.materialIndex[0])}return this.addMorphTargets(e,s,t,r,o),s}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,o){n.weightTable[r]===void 0&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[o]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,o=!1,s=[],c=[],l=[],u=[],d=[],f=[],p=this;return e.vertexIndices.forEach(function(m,h){let g=0,_=!1;m<0&&(m^=-1,_=!0);let v=[],y=[];if(s.push(m*3,m*3+1,m*3+2),e.color){let t=getData(h,n,m,e.color);l.push(t[0],t[1],t[2])}if(e.skeleton){if(e.weightTable[m]!==void 0&&e.weightTable[m].forEach(function(e){y.push(e.weight),v.push(e.id)}),y.length>4){o||(console.warn(`THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.`),o=!0);let e=[0,0,0,0],t=[0,0,0,0];y.forEach(function(n,r){let o=n,s=v[r];t.forEach(function(t,n,r){if(o>t){r[n]=o,o=t;let c=e[n];e[n]=s,s=c}})}),v=e,y=t}for(;y.length<4;)y.push(0),v.push(0);for(let e=0;e<4;++e)d.push(y[e]),f.push(v[e])}if(e.normal){let t=getData(h,n,m,e.normal);c.push(t[0],t[1],t[2])}e.material&&e.material.mappingType!==`AllSame`&&(g=getData(h,n,m,e.material)[0],g<0&&(p.negativeMaterialIndices=!0,g=0)),e.uv&&e.uv.forEach(function(e,t){let r=getData(h,n,m,e);u[t]===void 0&&(u[t]=[]),u[t].push(r[0]),u[t].push(r[1])}),r++,_&&(p.genFace(t,e,s,g,c,l,u,d,f,r),n++,r=0,s=[],c=[],l=[],u=[],d=[],f=[])}),t}getNormalNewell(e){let t=new three.Vector3(0,0,0);for(let n=0;n<e.length;n++){let r=e[n],o=e[(n+1)%e.length];t.x+=(r.y-o.y)*(r.z+o.z),t.y+=(r.z-o.z)*(r.x+o.x),t.z+=(r.x-o.x)*(r.y+o.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){let t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new three.Vector3(0,1,0):new three.Vector3(0,0,1)).cross(t).normalize();return{normal:t,tangent:n,bitangent:t.clone().cross(n).normalize()}}flattenVertex(e,t,n){return new three.Vector2(e.dot(t),e.dot(n))}genFace(e,t,n,r,o,s,c,l,u,d){let f;if(d>3){let e=[],r=t.baseVertexPositions||t.vertexPositions;for(let t=0;t<n.length;t+=3)e.push(new three.Vector3(r[n[t]],r[n[t+1]],r[n[t+2]]));let{tangent:o,bitangent:s}=this.getNormalTangentAndBitangent(e),c=[];for(let t of e)c.push(this.flattenVertex(t,o,s));f=three.ShapeUtils.triangulateShape(c,[])}else f=[[0,1,2]];for(let[d,p,m]of f)e.vertex.push(t.vertexPositions[n[d*3]]),e.vertex.push(t.vertexPositions[n[d*3+1]]),e.vertex.push(t.vertexPositions[n[d*3+2]]),e.vertex.push(t.vertexPositions[n[p*3]]),e.vertex.push(t.vertexPositions[n[p*3+1]]),e.vertex.push(t.vertexPositions[n[p*3+2]]),e.vertex.push(t.vertexPositions[n[m*3]]),e.vertex.push(t.vertexPositions[n[m*3+1]]),e.vertex.push(t.vertexPositions[n[m*3+2]]),t.skeleton&&(e.vertexWeights.push(l[d*4]),e.vertexWeights.push(l[d*4+1]),e.vertexWeights.push(l[d*4+2]),e.vertexWeights.push(l[d*4+3]),e.vertexWeights.push(l[p*4]),e.vertexWeights.push(l[p*4+1]),e.vertexWeights.push(l[p*4+2]),e.vertexWeights.push(l[p*4+3]),e.vertexWeights.push(l[m*4]),e.vertexWeights.push(l[m*4+1]),e.vertexWeights.push(l[m*4+2]),e.vertexWeights.push(l[m*4+3]),e.weightsIndices.push(u[d*4]),e.weightsIndices.push(u[d*4+1]),e.weightsIndices.push(u[d*4+2]),e.weightsIndices.push(u[d*4+3]),e.weightsIndices.push(u[p*4]),e.weightsIndices.push(u[p*4+1]),e.weightsIndices.push(u[p*4+2]),e.weightsIndices.push(u[p*4+3]),e.weightsIndices.push(u[m*4]),e.weightsIndices.push(u[m*4+1]),e.weightsIndices.push(u[m*4+2]),e.weightsIndices.push(u[m*4+3])),t.color&&(e.colors.push(s[d*3]),e.colors.push(s[d*3+1]),e.colors.push(s[d*3+2]),e.colors.push(s[p*3]),e.colors.push(s[p*3+1]),e.colors.push(s[p*3+2]),e.colors.push(s[m*3]),e.colors.push(s[m*3+1]),e.colors.push(s[m*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(o[d*3]),e.normal.push(o[d*3+1]),e.normal.push(o[d*3+2]),e.normal.push(o[p*3]),e.normal.push(o[p*3+1]),e.normal.push(o[p*3+2]),e.normal.push(o[m*3]),e.normal.push(o[m*3+1]),e.normal.push(o[m*3+2])),t.uv&&t.uv.forEach(function(t,n){e.uvs[n]===void 0&&(e.uvs[n]=[]),e.uvs[n].push(c[n][d*2]),e.uvs[n].push(c[n][d*2+1]),e.uvs[n].push(c[n][p*2]),e.uvs[n].push(c[n][p*2+1]),e.uvs[n].push(c[n][m*2]),e.uvs[n].push(c[n][m*2+1])})}addMorphTargets(e,t,n,r,o){if(r.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];let s=this;r.forEach(function(r){r.rawTargets.forEach(function(r){let c=e.Objects.Geometry[r.geoID];c!==void 0&&s.genMorphGeometry(t,n,c,o,r.name)})})}genMorphGeometry(e,t,n,r,o){let s=t.Vertices===void 0?[]:t.Vertices.a,c=t.PolygonVertexIndex===void 0?[]:t.PolygonVertexIndex.a,l=n.Vertices===void 0?[]:n.Vertices.a,u=n.Indexes?n.Indexes.a:[],d=e.attributes.position.count*3,f=new Float32Array(d);for(let e=0;e<u.length;e++){let t=u[e]*3;f[t]=l[e*3],f[t+1]=l[e*3+1],f[t+2]=l[e*3+2]}let p={vertexIndices:c,vertexPositions:f,baseVertexPositions:s},m=this.genBuffers(p),h=new three.Float32BufferAttribute(m.vertex,3);h.name=o||n.attrName,h.applyMatrix4(r),e.morphAttributes.position.push(h)}parseNormals(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,o=[];return n===`IndexToDirect`&&(e.NormalIndex?o=e.NormalIndex.a:e.NormalsIndex&&(o=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:o,mappingType:t,referenceType:n}}parseUVs(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,o=[];return n===`IndexToDirect`&&(o=e.UVIndex.a),{dataSize:2,buffer:r,indices:o,mappingType:t,referenceType:n}}parseVertexColors(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,o=[];n===`IndexToDirect`&&(o=e.ColorIndex.a);for(let e=0,t=new three.Color;e<r.length;e+=4)t.fromArray(r,e),t.toArray(r,e);return{dataSize:4,buffer:r,indices:o,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,o=[];for(let e=0;e<r.length;++e)o.push(e);return{dataSize:1,buffer:r,indices:o,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 three.BufferGeometry;let n=t-1,r=e.KnotVector.a,o=[],s=e.Points.a;for(let e=0,t=s.length;e<t;e+=4)o.push(new three.Vector4().fromArray(s,e));let c,l;if(e.Form===`Closed`)o.push(o[0]);else if(e.Form===`Periodic`){c=n,l=r.length-1-c;for(let e=0;e<n;++e)o.push(o[e])}let u=new NURBSCurve(n,r,o,c,l).getPoints(o.length*12);return new three.BufferGeometry().setFromPoints(u)}},AnimationParser=class{parse(e,t,n){let r=[],o=this.parseClips(e,t,n);if(o!==void 0)for(let e in o){let t=o[e],s=this.addClip(t,n);r.push(s)}return r}parseClips(e,t,n){if(e.Objects.AnimationCurve===void 0)return;let r=this.parseAnimationCurveNodes(e);this.parseAnimationCurves(e,r,t);let o=this.parseAnimationLayers(e,r,t,n);return this.parseAnimStacks(e,o,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 o={id:r[e].id,times:r[e].KeyTime.a.map(convertFBXTimeToSeconds),values:r[e].KeyValueFloat.a},s=n.get(o.id);if(s!==void 0){let e=s.parents[0].ID,n=s.parents[0].relationship,r=t.get(e);r&&(n.match(/X/)?r.curves.x=o:n.match(/Y/)?r.curves.y=o:n.match(/Z/)?r.curves.z=o:n.match(/DeformPercent/)&&t.has(e)&&(r.curves.morph=o))}}}parseAnimationLayers(e,t,n,r){let o=e.Objects.AnimationLayer,s=new Map;for(let c in o){let o=[],l=n.get(parseInt(c));l!==void 0&&(l.children.forEach((s,c)=>{if(t.has(s.ID)){let l=t.get(s.ID);if(l.curves.x!==void 0||l.curves.y!==void 0||l.curves.z!==void 0){if(o[c]===void 0){let t=n.get(s.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.`,s);return}let l={modelName:n.attrName?three.PropertyBinding.sanitizeNodeName(n.attrName):``,ID:n.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new three.Matrix4,eulerOrder:``,preRotation:[0,0,0],postRotation:[0,0,0]};r.traverse(function(e){e.ID===n.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))}),l.transform||(l.transform=new three.Matrix4),n.PreRotation&&(l.preRotation=n.PreRotation.value),n.PostRotation&&(l.postRotation=n.PostRotation.value),o[c]=l}}o[c]&&(o[c][l.attr]=l)}else if(l.curves.morph!==void 0){if(o[c]===void 0){let t=n.get(s.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID,r=n.get(t).parents[0].ID,l=n.get(r).parents[0].ID,u=n.get(l).parents[0].ID,d=e.Objects.Model[u];o[c]={modelName:d.attrName?three.PropertyBinding.sanitizeNodeName(d.attrName):``,morphName:e.Objects.Deformer[t].attrName}}o[c][l.attr]=l}}}),s.set(parseInt(c),o))}return s}parseAnimStacks(e,t,n){let r=e.Objects.AnimationStack,o={};for(let e in r){let s=n.get(parseInt(e)).children;s.length>1&&console.warn(`THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.`);let c=t.get(s[0].ID);o[e]={name:r[e].attrName,layer:c}}return o}addClip(e,t){let n=[],r=this;return e.layer.forEach(function(e){n=n.concat(r.generateTracks(e,t))}),new three.AnimationClip(e.name,-1,n)}generateTracks(e,t){let n=[],r=new three.Vector3,o=new three.Vector3;e.transform&&e.transform.decompose(r,new three.Quaternion,o);let s=r.toArray(),c=o.toArray();if(e.T!==void 0&&Object.keys(e.T.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.T.curves,s,`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,c,`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 o=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(o,t,n);return new three.VectorKeyframeTrack(e+`.`+r,o,s)}generateRotationTrack(e,t,n,r,o){let s,c;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){let e=this.interpolateRotations(t.x,t.y,t.z,o);s=e[0],c=e[1]}let l=getEulerOrder(0),u=new three.Quaternion,d=new three.Quaternion;n!==void 0&&(n=n.map(three.MathUtils.degToRad),n.push(l),u.setFromEuler(new three.Euler().fromArray(n))),r!==void 0&&(r=r.map(three.MathUtils.degToRad),r.push(l),d.setFromEuler(new three.Euler().fromArray(r)),d.inverse());let f=new three.Quaternion,p=new three.Euler,m=[];if(!c||!s)return new three.QuaternionKeyframeTrack(e+`.quaternion`,[0],[0]);for(let e=0;e<c.length;e+=3)p.set(c[e],c[e+1],c[e+2],o),f.setFromEuler(p),f.premultiply(u),f.multiply(d),e>2&&new three.Quaternion().fromArray(m,(e-3)/3*4).dot(f)<0&&f.set(-f.x,-f.y,-f.z,-f.w),f.toArray(m,e/3*4);return new three.QuaternionKeyframeTrack(e+`.quaternion`,s,m)}generateMorphTrack(e,t){let n=e.DeformPercent.curves.morph,r=n.values.map(function(e){return e/100}),o=t.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new three.NumberKeyframeTrack(e.modelName+`.morphTargetInfluences[`+o+`]`,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 o=t[r];o!==n&&(t[e]=o,n=o,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){let r=n,o=[],s=-1,c=-1,l=-1;return e.forEach(function(e){if(t.x&&(s=t.x.times.indexOf(e)),t.y&&(c=t.y.times.indexOf(e)),t.z&&(l=t.z.times.indexOf(e)),s!==-1){let e=t.x.values[s];o.push(e),r[0]=e}else o.push(r[0]);if(c!==-1){let e=t.y.values[c];o.push(e),r[1]=e}else o.push(r[1]);if(l!==-1){let e=t.z.values[l];o.push(e),r[2]=e}else o.push(r[2])}),o}interpolateRotations(e,t,n,r){let o=[],s=[];o.push(e.times[0]),s.push(three.MathUtils.degToRad(e.values[0])),s.push(three.MathUtils.degToRad(t.values[0])),s.push(three.MathUtils.degToRad(n.values[0]));for(let c=1;c<e.values.length;c++){let l=[e.values[c-1],t.values[c-1],n.values[c-1]];if(isNaN(l[0])||isNaN(l[1])||isNaN(l[2]))continue;let u=l.map(three.MathUtils.degToRad),d=[e.values[c],t.values[c],n.values[c]];if(isNaN(d[0])||isNaN(d[1])||isNaN(d[2]))continue;d.map(three.MathUtils.degToRad);let f=[d[0]-l[0],d[1]-l[1],d[2]-l[2]],p=[Math.abs(f[0]),Math.abs(f[1]),Math.abs(f[2])];if(p[0]>=180||p[1]>=180||p[2]>=180){let t=Math.max(...p)/180,n=new three.Euler(u[0],u[1],u[2],r),l=new three.Euler(u[0],u[1],u[2],r),d=new three.Quaternion().setFromEuler(n),f=new three.Quaternion().setFromEuler(l);d.dot(f)&&f.set(-f.x,-f.y,-f.z,-f.w);let m=e.times[c-1],h=e.times[c]-m,g=new three.Quaternion,_=new three.Euler;for(let e=0;e<1;e+=1/t)g.copy(d.clone().slerp(f.clone(),e)),o.push(m+e*h),_.setFromQuaternion(g,r),s.push(_.x),s.push(_.y),s.push(_.z)}else o.push(e.times[c]),s.push(three.MathUtils.degToRad(e.values[c])),s.push(three.MathUtils.degToRad(t.values[c])),s.push(three.MathUtils.degToRad(n.values[c]))}return[o,s]}},TextParser=class{constructor(){this.allNodes=new FBXTree,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 FBXTree,this.nodeStack=[],this.currentProp=[],this.currentPropName=``;let t=this,n=e.split(/[\r\n]+/);return n.forEach(function(e,r){let o=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);if(o||s)return;let c=e.match(`^\\t{`+t.currentIndent+`}(\\w+):(.*){`),l=e.match(`^\\t{`+t.currentIndent+`}(\\w+):[\\s\\t\\r\\n](.*)`),u=e.match(`^\\t{`+(t.currentIndent-1)+`}}`);c?t.parseNodeBegin(e,c):l?t.parseNodeProperty(e,l,n[++r]):u?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(/"$/,``)}),o={name:n},s=this.parseNodeAttr(r),c=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,o):n in c?(n===`PoseNode`?c.PoseNode.push(o):c[n].id!==void 0&&(c[n]={},c[n][c[n].id]=c[n]),s.id!==``&&(c[n][s.id]=o)):typeof s.id==`number`?(c[n]={},c[n][s.id]=o):n!==`Properties70`&&(n===`PoseNode`?c[n]=[o]:c[n]=o),typeof s.id==`number`&&(o.id=s.id),s.name!==``&&(o.attrName=s.name),s.type!==``&&(o.attrType=s.type),this.pushStack(o)}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(),o=t[2].replace(/^"/,``).replace(/"$/,``).trim();r===`Content`&&o===`,`&&(o=n.replace(/"/g,``).replace(/,$/,``).trim());let s=this.getCurrentNode();if(s.name===`Properties70`){this.parseNodeSpecialProperty(e,r,o);return}if(r===`C`){let e=o.split(`,`).slice(1),t=parseInt(e[0]),n=parseInt(e[1]),c=o.split(`,`).slice(3);c=c.map(function(e){return e.trim().replace(/^"/,``)}),r=`connections`,o=[t,n],append(o,c),s[r]===void 0&&(s[r]=[])}r===`Node`&&(s.id=o),r in s&&Array.isArray(s[r])?s[r].push(o):r===`a`?s.a=o:s[r]=o,this.setCurrentProp(s,r),r===`a`&&o.slice(-1)!==`,`&&(s.a=parseNumberArray(o))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==`,`&&(t.a=parseNumberArray(t.a))}parseNodeSpecialProperty(e,t,n){let r=n.split(`",`).map(function(e){return e.trim().replace(/^\"/,``).replace(/\s/,`_`)}),o=r[0],s=r[1],c=r[2],l=r[3],u=r[4];switch(s){case`int`:case`enum`:case`bool`:case`ULongLong`:case`double`:case`Number`:case`FieldOfView`:u=parseFloat(u);break;case`Color`:case`ColorRGB`:case`Vector3D`:case`Lcl_Translation`:case`Lcl_Rotation`:case`Lcl_Scaling`:u=parseNumberArray(u);break}this.getPrevNode()[o]={type:s,type2:c,flag:l,value:u},this.setCurrentProp(this.getPrevNode(),o)}},BinaryParser=class{parse(e){let t=new BinaryReader(e);t.skip(23);let n=t.getUint32();if(n<6400)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+n);let r=new FBXTree;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(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let s=e.getUint8(),c=e.getString(s);if(r===0)return null;let l=[];for(let t=0;t<o;t++)l.push(this.parseProperty(e));let u=l.length>0?l[0]:``,d=l.length>1?l[1]:``,f=l.length>2?l[2]:``;for(n.singleProperty=o===1&&e.getOffset()===r;r>e.getOffset();){let r=this.parseNode(e,t);r!==null&&this.parseSubNode(c,n,r)}return n.propertyList=l,typeof u==`number`&&(n.id=u),d!==``&&(n.attrName=d),f!==``&&(n.attrType=f),c!==``&&(n.name=c),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],o=n.propertyList[2],s=n.propertyList[3],c;e.indexOf(`Lcl `)===0&&(e=e.replace(`Lcl `,`Lcl_`)),r.indexOf(`Lcl `)===0&&(r=r.replace(`Lcl `,`Lcl_`)),c=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:o,flag:s,value:c}}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(),o=e.getUint32(),s=e.getUint32();if(o===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 c=new BinaryReader(unzlibSync(new Uint8Array(e.getArrayBuffer(s))).buffer);switch(t){case`b`:case`c`:return c.getBooleanArray(r);case`d`:return c.getFloat64Array(r);case`f`:return c.getFloat32Array(r);case`i`:return c.getInt32Array(r);case`l`:return c.getInt64Array(r)}break;default:throw Error(`THREE.FBXLoader: Unknown property type `+t)}}},BinaryReader=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)}},FBXTree=class{constructor(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}add(e,t){this[e]=t}};function isFbxFormatBinary(e){return e.byteLength>=21&&convertArrayBufferToString(e,0,21)===`Kaydara FBX Binary \0`}function isFbxFormatASCII(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 getFbxVersion(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 convertFBXTimeToSeconds(e){return e/46186158e3}var dataArray=[];function getData(e,t,n,r){let o;switch(r.mappingType){case`ByPolygonVertex`:o=e;break;case`ByPolygon`:o=t;break;case`ByVertice`:o=n;break;case`AllSame`:o=r.indices[0];break;default:console.warn(`THREE.FBXLoader: unknown attribute mapping type `+r.mappingType),o=0}r.referenceType===`IndexToDirect`&&(o=r.indices[o]);let s=o*r.dataSize,c=s+r.dataSize;return slice(dataArray,r.buffer,s,c)}var tempEuler=new three.Euler,tempVec=new three.Vector3;function generateTransform(e){let t=new three.Matrix4,n=new three.Matrix4,r=new three.Matrix4,o=new three.Matrix4,s=new three.Matrix4,c=new three.Matrix4,l=new three.Matrix4,u=new three.Matrix4,d=new three.Matrix4,f=new three.Matrix4,p=new three.Matrix4,m=new three.Matrix4,h=e.inheritType?e.inheritType:0;e.translation&&t.setPosition(tempVec.fromArray(e.translation));let g=getEulerOrder(0);if(e.preRotation){let t=e.preRotation.map(three.MathUtils.degToRad);t.push(g),n.makeRotationFromEuler(tempEuler.fromArray(t))}if(e.rotation){let t=e.rotation.map(three.MathUtils.degToRad);t.push(e.eulerOrder||g),r.makeRotationFromEuler(tempEuler.fromArray(t))}if(e.postRotation){let t=e.postRotation.map(three.MathUtils.degToRad);t.push(g),o.makeRotationFromEuler(tempEuler.fromArray(t)),o.copy(new three.Matrix4().getInverse(o))}e.scale&&s.scale(tempVec.fromArray(e.scale)),e.scalingOffset&&l.setPosition(tempVec.fromArray(e.scalingOffset)),e.scalingPivot&&c.setPosition(tempVec.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(tempVec.fromArray(e.rotationOffset)),e.rotationPivot&&d.setPosition(tempVec.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(p.copy(e.parentMatrix),f.copy(e.parentMatrixWorld));let _=n.clone().multiply(r).multiply(o),v=new three.Matrix4;v.extractRotation(f);let y=new three.Matrix4;y.copyPosition(f);let b=new three.Matrix4().getInverse(y).multiply(f),S=new three.Matrix4().getInverse(v).multiply(b),C=s,w=new three.Matrix4;if(h===0)w.copy(v).multiply(_).multiply(S).multiply(C);else if(h===1)w.copy(v).multiply(S).multiply(_).multiply(C);else{let e=new three.Matrix4().scale(new three.Vector3().setFromMatrixScale(p)),t=new three.Matrix4().getInverse(e),n=S.clone().multiply(t);w.copy(v).multiply(_).multiply(n).multiply(C)}let T=new three.Matrix4().getInverse(d),E=new three.Matrix4().getInverse(c),D=t.clone().multiply(u).multiply(d).multiply(n).multiply(r).multiply(o).multiply(T).multiply(l).multiply(c).multiply(s).multiply(E),O=new three.Matrix4().copyPosition(D),k=f.clone().multiply(O);return m.copyPosition(k),D=m.clone().multiply(w),D.premultiply(new three.Matrix4().getInverse(f)),D}function getEulerOrder(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 parseNumberArray(e){return e.split(`,`).map(function(e){return parseFloat(e)})}function convertArrayBufferToString(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),new TextDecoder().decode(new Uint8Array(e,t,n))}function append(e,t){for(let n=0,r=e.length,o=t.length;n<o;n++,r++)e[r]=t[n]}function slice(e,t,n,r){for(let o=n,s=0;o<r;o++,s++)e[s]=t[o];return e}var NURBSCurve=class extends three.Curve{constructor(e,t,n,r,o){super();let s=t?t.length-1:0,c=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=o||s;for(let e=0;e<c;++e){let t=n[e];this.controlPoints[e]=new three.Vector4(t.x,t.y,t.z,t.w)}}getPoint(e,t=new three.Vector3){let n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),o=calcBSplinePoint(this.degree,this.knots,this.controlPoints,r);return o.w!==1&&o.divideScalar(o.w),n.set(o.x,o.y,o.z)}getTangent(e,t=new three.Vector3){let n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),o=calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,r,1);return n.copy(o[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 three.Vector4(e[0],e[1],e[2],e[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}};function findSpan(e,t,n){let r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;let o=e,s=r,c=Math.floor((o+s)/2);for(;t<n[c]||t>=n[c+1];)t<n[c]?s=c:o=c,c=Math.floor((o+s)/2);return c}function calcBasisFunctions(e,t,n,r){let o=[],s=[],c=[];o[0]=1;for(let l=1;l<=n;++l){s[l]=t-r[e+1-l],c[l]=r[e+l]-t;let n=0;for(let e=0;e<l;++e){let t=c[e+1],r=s[l-e],u=o[e]/(t+r);o[e]=n+t*u,n=r*u}o[l]=n}return o}function calcBSplinePoint(e,t,n,r){let o=findSpan(e,r,t),s=calcBasisFunctions(o,r,e,t),c=new three.Vector4(0,0,0,0);for(let t=0;t<=e;++t){let r=n[o-e+t],l=s[t],u=r.w*l;c.x+=r.x*u,c.y+=r.y*u,c.z+=r.z*u,c.w+=r.w*l}return c}function calcBasisFunctionDerivatives(e,t,n,r,o){let s=[];for(let e=0;e<=n;++e)s[e]=0;let c=[];for(let e=0;e<=r;++e)c[e]=s.slice(0);let l=[];for(let e=0;e<=n;++e)l[e]=s.slice(0);l[0][0]=1;let u=s.slice(0),d=s.slice(0);for(let r=1;r<=n;++r){u[r]=t-o[e+1-r],d[r]=o[e+r]-t;let n=0;for(let e=0;e<r;++e){let t=d[e+1],o=u[r-e];l[r][e]=t+o;let s=l[e][r-1]/l[r][e];l[e][r]=n+t*s,n=o*s}l[r][r]=n}for(let e=0;e<=n;++e)c[0][e]=l[e][n];for(let e=0;e<=n;++e){let t=0,o=1,u=[];for(let e=0;e<=n;++e)u[e]=s.slice(0);u[0][0]=1;for(let s=1;s<=r;++s){let r=0,d=e-s,f=n-s;e>=s&&(u[o][0]=u[t][0]/l[f+1][d],r=u[o][0]*l[d][f]);let p=d>=-1?1:-d,m=e-1<=f?s-1:n-e;for(let e=p;e<=m;++e)u[o][e]=(u[t][e]-u[t][e-1])/l[f+1][d+e],r+=u[o][e]*l[d+e][f];e<=f&&(u[o][s]=-u[t][s-1]/l[f+1][e],r+=u[o][s]*l[e][f]),c[s][e]=r;let h=t;t=o,o=h}}let f=n;for(let e=1;e<=r;++e){for(let t=0;t<=n;++t)c[e][t]*=f;f*=n-e}return c}function calcBSplineDerivatives(e,t,n,r,o){let s=o<e?o:e,c=[],l=findSpan(e,r,t),u=calcBasisFunctionDerivatives(l,r,e,s,t),d=[];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,d[e]=t}for(let t=0;t<=s;++t){let n=d[l-e].clone().multiplyScalar(u[t][0]);for(let r=1;r<=e;++r)n.add(d[l-e+r].clone().multiplyScalar(u[t][r]));c[t]=n}for(let e=s+1;e<=o+1;++e)c[e]=new three.Vector4(0,0,0);return c}function calcKoverI(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 calcRationalCurveDerivatives(e){let t=e.length,n=[],r=[];for(let o=0;o<t;++o){let t=e[o];n[o]=new three.Vector3(t.x,t.y,t.z),r[o]=t.w}let o=[];for(let e=0;e<t;++e){let t=n[e].clone();for(let n=1;n<=e;++n)t.sub(o[e-n].clone().multiplyScalar(calcKoverI(e,n)*r[n]));o[e]=t.divideScalar(r[0])}return o}function calcNURBSDerivatives(e,t,n,r,o){return calcRationalCurveDerivatives(calcBSplineDerivatives(e,t,n,r,o))}var _vector=new three.Vector3;function getPointArray(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 loadX3p(e,t={}){var n,r,o;let s=(n=t.upAxis)==null?`Z`:n,c=(r=t.fetcher)==null?internalFetcher:r,l=(o=t.onDownloadProgress)==null?noop:o,u={byteLength:0};return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(n=>{var r,o;return u.byteLength=n.body.byteLength,parse$1(new Uint8Array(n.body),{light:(r=t.light)==null?!0:r,color:t.color,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(o=e.split(`?`)[1])==null?``:o,fetcher:c})}).then(t=>{let n=new three.Group;return n.name=e,n.add(t.object),s===`Y`&&n.applyMatrix4(ROTATE_X_MATRIX_INVERSE$2),{type:`x3p`,modelUpAxis:`Z`,upAxis:s,uri:e,byteLength:u.byteLength,memoryUsage:getMemoryUsage(n),scene:n,textures:[],animations:[],dispose:()=>t.dispose()}})}function parse$1(e,t){var n,r,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,S,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,ee,te,U,W,G,K,ne,re,ie,ae,oe,q,se,ce,le,ue;let J=unzipSync(e),de=``,fe=null;for(let e of Object.keys(J))/(^|\/)main\.xml$/i.test(e)&&(fe=J[e],de=e.slice(0,e.lastIndexOf(`/`)+1));if(!fe)throw Error(`X3p: main.xml not found.`);if(typeof DOMParser>`u`)throw Error(`X3p: DOMParser not found.`);let pe=(n=t.color)==null?new three.Color(10066329):n,me=new DOMParser,he=decodeText(fe),ge=me.parseFromString(he,`text/xml`),Y=ge.querySelector(`Record1 Axes`),_e={x:{type:(s=(o=(r=Y==null?void 0:Y.querySelector(`CX AxisType`))==null?void 0:r.textContent)==null?void 0:o.toUpperCase())==null?`I`:s,dataType:(u=(l=(c=Y==null?void 0:Y.querySelector(`CX DataType`))==null?void 0:c.textContent)==null?void 0:l.toUpperCase())==null?`D`:u,increment:Number((f=(d=Y==null?void 0:Y.querySelector(`CX Increment`))==null?void 0:d.textContent)==null?`1`:f),offset:Number((m=(p=Y==null?void 0:Y.querySelector(`CX Offset`))==null?void 0:p.textContent)==null?`0`:m)},y:{type:(_=(g=(h=Y==null?void 0:Y.querySelector(`CY AxisType`))==null?void 0:h.textContent)==null?void 0:g.toUpperCase())==null?`I`:_,dataType:(b=(y=(v=Y==null?void 0:Y.querySelector(`CY DataType`))==null?void 0:v.textContent)==null?void 0:y.toUpperCase())==null?`D`:b,increment:Number((C=(S=Y==null?void 0:Y.querySelector(`CY Increment`))==null?void 0:S.textContent)==null?`1`:C),offset:Number((T=(w=Y==null?void 0:Y.querySelector(`CY Offset`))==null?void 0:w.textContent)==null?`0`:T)},z:{type:(O=(D=(E=Y==null?void 0:Y.querySelector(`CZ AxisType`))==null?void 0:E.textContent)==null?void 0:D.toUpperCase())==null?`A`:O,dataType:(j=(A=(k=Y==null?void 0:Y.querySelector(`CZ DataType`))==null?void 0:k.textContent)==null?void 0:A.toUpperCase())==null?`D`:j,increment:Number((N=(M=Y==null?void 0:Y.querySelector(`CZ Increment`))==null?void 0:M.textContent)==null?`1`:N),offset:Number((F=(P=Y==null?void 0:Y.querySelector(`CZ Offset`))==null?void 0:P.textContent)==null?`0`:F)}},ve=null,X=ge.querySelector(`Record1 Axes Rotation`);X&&(ve=new three.Matrix3,ve.set(Number((L=(I=X.querySelector(`r11`))==null?void 0:I.textContent)==null?0:L),Number((z=(R=X.querySelector(`r12`))==null?void 0:R.textContent)==null?0:z),Number((V=(B=X.querySelector(`r13`))==null?void 0:B.textContent)==null?0:V),Number((ee=(H=X.querySelector(`r21`))==null?void 0:H.textContent)==null?0:ee),Number((U=(te=X.querySelector(`r22`))==null?void 0:te.textContent)==null?0:U),Number((G=(W=X.querySelector(`r23`))==null?void 0:W.textContent)==null?0:G),Number((ne=(K=X.querySelector(`r31`))==null?void 0:K.textContent)==null?0:ne),Number((ie=(re=X.querySelector(`r32`))==null?void 0:re.textContent)==null?0:ie),Number((oe=(ae=X.querySelector(`r33`))==null?void 0:ae.textContent)==null?0:oe)));let ye=(q=ge.querySelector(`Record3 DataLink PointDataLink`))==null?void 0:q.textContent;if(typeof ye!=`string`)throw Error(`X3p: PointDataLink not found.`);ye=pathJoin(de,ye);let be=J[ye];if(!be)throw Error(`X3p: ${be} not found.`);let xe=getPointArray(be.buffer,_e.z.dataType),Se=Number((ce=(se=ge.querySelector(`Record3 MatrixDimension SizeX`))==null?void 0:se.textContent)==null?`0`:ce),Ce=Number((ue=(le=ge.querySelector(`Record3 MatrixDimension SizeY`))==null?void 0:le.textContent)==null?`0`:ue),we=Math.floor(Se-1),Te=Math.floor(Ce-1),Ee=we+1,De=Te+1,Oe=new Float32Array(Ee*De*3),ke=new Float32Array(Ee*De*2),Ae=new Uint32Array(we*Te*6),je=new three.Box3;for(let e=0;e<De;e++){let t=e*_e.y.increment+_e.y.offset;for(let n=0;n<Ee;n++){let r=e*Ee+n,o=n*_e.x.increment+_e.x.offset,s=xe[r],c=!isNaN(s),l=c?s:NaN;_vector.set(o,-t,l),ve&&_vector.applyMatrix3(ve),c&&je.expandByPoint(_vector),Oe[r*3+0]=_vector.x,Oe[r*3+1]=_vector.y,Oe[r*3+2]=_vector.z,ke[r*2+0]=n/we,ke[r*2+1]=1-e/Te}}for(let e=0;e<Te;e++)for(let t=0;t<we;t++){let n=t+Ee*e,r=t+Ee*(e+1),o=t+1+Ee*(e+1),s=t+1+Ee*e,c=(e*we+t)*6;Ae[c+0]=n,Ae[c+1]=r,Ae[c+2]=s,Ae[c+3]=r,Ae[c+4]=o,Ae[c+5]=s}let Z=new three.BufferGeometry;Z.setAttribute(`position`,new three.BufferAttribute(Oe,3)),Z.setAttribute(`uv`,new three.BufferAttribute(ke,2)),Z.setIndex(new three.BufferAttribute(Ae,1)),(!Z.groups||Z.groups.length===0)&&Z.addGroup(0,Z.index?Z.index.count:Z.attributes.position.count,0),Z.boundingBox=je;let Me=new PBMMeshMaterial(t.light?`phong`:`basic`);return Me.flatShading=!0,Me.color.copy(pe),{object:new PBMMesh(Z,[Me]),dispose:()=>{Z.dispose(),Me.dispose()}}}var VolumePlaneIntersect;(function(e){e[e.Outside=-1]=`Outside`,e[e.Intersecting=0]=`Intersecting`,e[e.Inside=1]=`Inside`})(VolumePlaneIntersect||(VolumePlaneIntersect={}));var EPSILON$2=1e-6,identityMatrix4$1=new three.Matrix4().identity(),scratchVector=new three.Vector3,scratchMatrix4$5=new three.Matrix4,scratchXAxis=new three.Vector3,scratchYAxis=new three.Vector3,scratchZAxis=new three.Vector3,scratchSize=new three.Vector3,scratchBox3$1=new three.Box3,scratchSphere$2=new three.Sphere,scratchMatrix4Inverse$1=new three.Matrix4,scratchRay$1=new three.Ray,scratchObject3D=new three.Object3D,scratchFrustum=new three.Frustum;function quaternionFromMatrix3(e,t){let n=e.elements;return t.setFromRotationMatrix(scratchMatrix4$5.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 CullingVolume=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 scratchMatrix4$5.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$5),this.setFromFrustum(scratchFrustum),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=VolumePlaneIntersect.Inside;for(let n of this.planes)switch(e.intersectPlane(n)){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:t=VolumePlaneIntersect.Intersecting;break;default:}return t}computeVisibilityWithPlaneMask(t,n){if(n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;let r=e.MASK_INSIDE,o=Math.min(32,this.planes.length);for(let s=0;s<o;++s){let o=1<<s;if((n&o)===0)continue;let c=this.planes[s],l=t.intersectPlane(c);if(l===VolumePlaneIntersect.Outside)return e.MASK_OUTSIDE;l===VolumePlaneIntersect.Intersecting&&(r|=o)}return r}},BoxBoundingVolume=class e{constructor(){this.type=`box`,this.center=new three.Vector3,this.halfSize=new three.Vector3,this.rotation=new three.Matrix3}fromJson({box:e}){this.center.set(e[0],e[1],e[2]);let t=e[3],n=e[4],r=e[5],o=e[6],s=e[7],c=e[8],l=e[9],u=e[10],d=e[11],f=Math.max(Math.sqrt(t*t+n*n+r*r),.001),p=Math.max(Math.sqrt(o*o+s*s+c*c),.001),m=Math.max(Math.sqrt(l*l+u*u+d*d),.001);this.halfSize.set(f,p,m);let h=this.halfSize.toArray().reduce((e,t)=>e+t,0);return(isNaN(h)||h<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([t/f,n/f,r/f,o/p,s/p,c/p,l/m,u/m,d/m]),isNaN(this.rotation.toArray().reduce((e,t)=>e+t,0))&&this.rotation.identity(),this}toJson(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:[...this.center.toArray(),...scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),...scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),...scratchZAxis.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(identityMatrix4$1)?this:(scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(e),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$5.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.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,o=e.z-this.center.z,s=0,c;return c=n*t[0]+r*t[1]+o*t[2],c<0&&(c=-c),c-=this.halfSize.x,c>0&&(s+=c*c),c=n*t[3]+r*t[4]+o*t[5],c<0&&(c=-c),c-=this.halfSize.y,c>0&&(s+=c*c),c=n*t[6]+r*t[7]+o*t[8],c<0&&(c=-c),c-=this.halfSize.z,c>0&&(s+=c*c),s}distanceToPoint(e){return Math.sqrt(this.distanceSquaredToPoint(e))}distanceToPlane(e){let t=e.projectPoint(this.center,new three.Vector3);return this.distanceToPoint(t)}getBoundingBox(e){return e.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),e.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),e.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),e.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),e.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),e.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),e.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),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);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,21);let n=new three.BufferGeometry;return n.setIndex(new three.BufferAttribute(e,1)),n.setAttribute(`position`,new three.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n}intersectPlane(e){let t=this.center,n=e.normal,r=this.rotation.elements,o=this.halfSize,s=n.x,c=n.y,l=n.z,u=Math.abs(s*r[0]*o.x+c*r[1]*o.x+l*r[2]*o.x)+Math.abs(s*r[3]*o.y+c*r[4]*o.y+l*r[5]*o.y)+Math.abs(s*r[6]*o.z+c*r[7]*o.z+l*r[8]*o.z),d=n.dot(t)+e.constant;return d<=-u?VolumePlaneIntersect.Outside:d>=u?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting}intersectRay(e,t=0,n){if(scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3$1.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),scratchBox3$1.expandByScalar(t),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$5.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$5),scratchRay$1.copy(e).applyMatrix4(scratchMatrix4Inverse$1),scratchBox3$1.containsPoint(scratchRay$1.origin))return!0;let r=scratchRay$1.intersectBox(scratchBox3$1,scratchVector);return r?n===void 0?!0:(n+=t,r.distanceToSquared(scratchRay$1.origin)<=n*n):!1}},SphereBoundingVolume=class e{constructor(){this.type=`sphere`,this.center=new three.Vector3,this.radius=-1}fromJson({sphere:e}){return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],EPSILON$2),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,scratchSize.set(1,1,1).multiplyScalar(this.radius*2)),e}toGeometry(){let e=32,t=new Float32Array(384);for(let e=0;e<=32;e++){let n=0;n=e/32*Math.PI*2,t[e*6+0]=this.center.x+Math.cos(n)*this.radius,t[e*6+1]=this.center.y+Math.sin(n)*this.radius,t[e*6+2]=this.center.z+0,n=(e+1)/32*Math.PI*2,t[e*6+3]=this.center.x+Math.cos(n)*this.radius,t[e*6+4]=this.center.y+Math.sin(n)*this.radius,t[e*6+5]=this.center.z+0}for(let e=32;e<=64;e++){let n=0;n=e/32*Math.PI*2,t[e*6+0]=this.center.x+Math.cos(n)*this.radius,t[e*6+1]=this.center.y+0,t[e*6+2]=this.center.z+Math.sin(n)*this.radius,n=(e+1)/32*Math.PI*2,t[e*6+3]=this.center.x+Math.cos(n)*this.radius,t[e*6+4]=this.center.y+0,t[e*6+5]=this.center.z+Math.sin(n)*this.radius}let n=new three.BufferGeometry;return n.setAttribute(`position`,new three.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n}applyMatrix4(e){return e.equals(identityMatrix4$1)?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?VolumePlaneIntersect.Outside:r<n?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside}intersectRay(e,t=0,n){if(scratchSphere$2.set(this.center,this.radius+t),scratchSphere$2.containsPoint(e.origin))return!0;let r=e.intersectSphere(scratchSphere$2,scratchVector);return r?n===void 0?!0:(n+=t,e.origin.distanceToSquared(r)<=n*n):!1}},RegionBoundingVolume=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 isBoundingVolume(e){return e instanceof BoxBoundingVolume||e instanceof SphereBoundingVolume||e instanceof RegionBoundingVolume}function makeBoundingVolume(e){if(isBoundingVolume(e))return e;if(`box`in e)return new BoxBoundingVolume().fromJson(e);if(`sphere`in e)return new SphereBoundingVolume().fromJson(e);if(`region`in e)return new RegionBoundingVolume().fromJson(e);throw Error(`BoundingVolume ${JSON.stringify(e)} never suppored.`)}var debugMaterials=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(e=>new three.LineBasicMaterial({color:e,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})),debugBoxGeometry=(()=>{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);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);let n=new three.BufferGeometry;return n.setIndex(new three.BufferAttribute(e,1)),n.setAttribute(`position`,new three.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n})(),debugSphereGeometry=(()=>{let e=32,t=new Float32Array(384);for(let e=0;e<=32;e++){let n=0;n=e/32*Math.PI*2,t[e*6+0]=Math.cos(n),t[e*6+1]=Math.sin(n),t[e*6+2]=0,n=(e+1)/32*Math.PI*2,t[e*6+3]=Math.cos(n),t[e*6+4]=Math.sin(n),t[e*6+5]=0}for(let e=32;e<=64;e++){let n=0;n=e/32*Math.PI*2,t[e*6+0]=Math.cos(n),t[e*6+1]=0,t[e*6+2]=Math.sin(n),n=(e+1)/32*Math.PI*2,t[e*6+3]=Math.cos(n),t[e*6+4]=0,t[e*6+5]=Math.sin(n)}let n=new three.BufferGeometry;return n.setAttribute(`position`,new three.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n})();function createDebugBoundingMesh(e,t=0){if(e instanceof BoxBoundingVolume){let n=new three.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)]);return n.position.copy(e.center),quaternionFromMatrix3(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 SphereBoundingVolume){let n=new three.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.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 scratchVector3$10=new three.Vector3,scratchPlane=new three.Plane,scratchSphereBoundingVolume$1=new SphereBoundingVolume,scratchBoxBoundingVolume$1=new BoxBoundingVolume,Tile=class e{constructor(t,n,r,o){var s,c,l,u;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=o==null?null:o,this.contentParent=o?o.hasRenderContent?o:o.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(s=n.refine)==null?this.parent?this.parent.refine:`REPLACE`:s,this.transform=new three.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=(l=(c=this.parent)==null?void 0:c.geometricError)==null?0:l,n.content&&n.content.uri?(this.content={uri:n.content.uri,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:now(),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=makeBoundingVolume(n.boundingVolume).applyMatrix4(this.transform)),n.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(n.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(u=n.extras)==null?{}:u,typeof this.extras.floor!=`number`&&o&&typeof o.extras.floor==`number`&&(this.extras.floor=o.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 BoxBoundingVolume?scratchBoxBoundingVolume$1.copy(this.boundingVolume):this.boundingVolume instanceof SphereBoundingVolume?scratchSphereBoundingVolume$1.copy(this.boundingVolume):this.boundingVolume.clone(),n.applyMatrix4(t),e.camera.type===`OrthographicCamera`?(scratchPlane.setFromNormalAndCoplanarPoint(e.camera.direction,e.camera.position),this.state.distanceToCamera=n.distanceToPlane(scratchPlane)):this.state.distanceToCamera=n.distanceToPoint(e.camera.position);let r=n.getCenter(scratchVector3$10).sub(e.camera.position);this.state.centerZDepth=e.camera.direction.dot(r),this.state.centerScreenY=e.camera.up.dot(r);let o=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=e.cullingVolume.computeVisibilityWithPlaneMask(n,o),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE,e.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=CullingVolume.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 BoxBoundingVolume?scratchBoxBoundingVolume$1.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof SphereBoundingVolume?scratchSphereBoundingVolume$1.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(),o=this.parent?this.parent.geometricError:this.tileset.geometricError,s=r*(n?o:this.geometricError);if(s===0)return 0;let c=e.height,l=e.sseDenominator;return e.camera.type===`OrthographicCamera`?s/(1/(e.camera.projectionMatrix.elements[5]/2)/c*.9):s/(Math.max(t,.001)*l/c)}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,o=this.tileset.root?this.tileset.root.state.screenSpaceError:0;return Math.max(o-r,0)}},defaultIterator=e=>Number(e);function arrayMin(e,t=defaultIterator,n=!1){let r,o=1/0;for(let n of e){let e=t(n);e<=o&&(r=n,o=e)}return isFinite(o)||(o=0),n?[r,o]:r}function arrayEqual(e,t,n=(e,t)=>e===t){let r=e.length;if(r!==t.length)return!1;for(let o=0;o<r;o++)if(n(e[o],t[o])===!1)return!1;return!0}var arrayUniqueSet=new Set;function arrayUnique(e){arrayUniqueSet.clear();let t=[],n=e.length;for(let r=0;r<n;r++){let n=e[r];arrayUniqueSet.has(n)||(t.push(n),arrayUniqueSet.add(n))}return arrayUniqueSet.clear(),t}var arrayMinCallback=e=>e.distance,intersectDistanceSortCallback=(e,t)=>e.distance-t.distance;function sortIntersects(e,t=!0,n=!1){if(n&&e.length>1){let t=arrayMin(e,arrayMinCallback);t?(e[0]=t,e.length=1):e.length=0}return t&&e.length>1&&e.sort(intersectDistanceSortCallback),e}var BVHObject=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,o,s;let c=this.indices,l=this.position,u=e;if(c){let t=c.array,o=(n=c.stride)==null?1:n,s=(r=c.offset)==null?0:r;u=t[e*o+s]}let d=l.array,f=(o=l.stride)==null?3:o,p=(s=l.offset)==null?0:s;return u=u*f+p,t.x=d[u],t.y=d[u+1],t.z=d[u+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,o){throw Error(`not implemented`)}},BVHNode=class{constructor(e,t,n,r,o){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=o}},BYTES_PER_NODE=36;function packBVHNode(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),o=new Uint32Array(n),s=new Uint16Array(n),c=[e],l,u;for(;l=c.pop();)u=l.id*36/4,r[u]=l.extents[0],r[u+1]=l.extents[1],r[u+2]=l.extents[2],r[u+3]=l.extents[3],r[u+4]=l.extents[4],r[u+5]=l.extents[5],o[u+6]=l.startIndex,o[u+7]=l.endIndex,u=l.id*36/2,l.node0&&(s[u+16]=l.node0.id,c.push(l.node0)),l.node1&&(s[u+17]=l.node1.id,c.push(l.node1));return n}function intersectNodeBox(e,t,n,r=0){let o=n.min.x-r,s=n.min.y-r,c=n.min.z-r,l=n.max.x+r,u=n.max.y+r,d=n.max.z+r,f=0,p=0,m=0,h=0,g=0,_=0;return t.x>=0?(f=(o-e.x)*t.x,p=(l-e.x)*t.x):(f=(l-e.x)*t.x,p=(o-e.x)*t.x),t.y>=0?(m=(s-e.y)*t.y,h=(u-e.y)*t.y):(m=(u-e.y)*t.y,h=(s-e.y)*t.y),f>h||m>p||((m>f||f!==f)&&(f=m),(h<p||p!==p)&&(p=h),t.z>=0?(g=(c-e.z)*t.z,_=(d-e.z)*t.z):(g=(d-e.z)*t.z,_=(c-e.z)*t.z),f>_||g>p)||((g>f||f!==f)&&(f=g),(_<p||p!==p)&&(p=_),p<0)?null:f>=0?f:0}var BVHVector3=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,o=e.z,s=t.x,c=t.y,l=t.z;return this.x=r*l-o*c,this.y=o*s-n*l,this.z=n*c-r*s,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)}},BVHIntersect=class{constructor(e,t,n,r,o){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=o}},BVHBox3=class{constructor(e,t){this.min=e,this.max=t}},EPSILON$1=1e-6,scratchVector3$9=new BVHVector3(0,0,0),scratchVector3A=new BVHVector3(0,0,0),scratchVector3B=new BVHVector3(0,0,0),scratchVector3C=new BVHVector3(0,0,0),BVHMesh=class extends BVHObject{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionCount()/3,o=r>65535?new Uint32Array(r):new Uint16Array(r),s=new Float32Array(r*6),c=[],l=0,u=-1;if(n)for(let e=0;e<r;e+=1){let t=e*3,n=e*6,r,c,l,u,d,f,p;o[e]=e,this.getPositionByIndex(t,scratchVector3A),this.getPositionByIndex(t+1,scratchVector3B),this.getPositionByIndex(t+2,scratchVector3C),r=u=scratchVector3A.x,p=scratchVector3B.x,p<r&&(r=p),p>u&&(u=p),p=scratchVector3C.x,p<r&&(r=p),p>u&&(u=p),c=d=scratchVector3A.y,p=scratchVector3B.y,p<c&&(c=p),p>d&&(d=p),p=scratchVector3C.y,p<c&&(c=p),p>d&&(d=p),l=f=scratchVector3A.z,p=scratchVector3B.z,p<l&&(l=p),p>f&&(f=p),p=scratchVector3C.z,p<l&&(l=p),p>f&&(f=p),s[n]=r,s[n+1]=c,s[n+2]=l,s[n+3]=u,s[n+4]=d,s[n+5]=f}else{let e=1/0,t=1/0,c=1/0,l=-1/0,u=-1/0,d=-1/0;for(let n=0;n<r;n+=1){let r=n*3,f=n*6,p,m,h,g,_,v,y;o[n]=n,this.getPositionByIndex(r,scratchVector3A),this.getPositionByIndex(r+1,scratchVector3B),this.getPositionByIndex(r+2,scratchVector3C),p=g=scratchVector3A.x,y=scratchVector3B.x,y<p&&(p=y),y>g&&(g=y),y=scratchVector3C.x,y<p&&(p=y),y>g&&(g=y),m=_=scratchVector3A.y,y=scratchVector3B.y,y<m&&(m=y),y>_&&(_=y),y=scratchVector3C.y,y<m&&(m=y),y>_&&(_=y),h=v=scratchVector3A.z,y=scratchVector3B.z,y<h&&(h=y),y>v&&(v=y),y=scratchVector3C.z,y<h&&(h=y),y>v&&(v=y),s[f]=p,s[f+1]=m,s[f+2]=h,s[f+3]=g,s[f+4]=_,s[f+5]=v,p<e&&(e=p),g>l&&(l=g),m<t&&(t=m),_>u&&(u=_),h<c&&(c=h),v>d&&(d=v)}n=[e,t,c,l,u,d]}let d=new BVHNode(++u,n,0,r,0);c[l++]=d;let f=[],p=[0,1,2],m=function(e,t){return f[t]-f[e]};function h(n){let r=n.startIndex,d=n.endIndex,h=n.extents;f[0]=h[3]-h[0],f[1]=h[4]-h[1],f[2]=h[5]-h[2],p.sort(m);for(let f=0;f<3;f++){let m=p[f],g=h[m]+h[m+3],_=r,v=d-1,y=-1,b;for(;_<=v;)y===-1?(b=o[_],s[b*6+m]+s[b*6+m+3]<g?_++:y=b):(b=o[v],s[b*6+m]+s[b*6+m+3]>=g?v--:(o[_]=b,o[v]=y,y=-1,_++,v--));if(_>r&&_<d){let f=new BVHNode(++u,calcExtents(o,s,r,_,EPSILON$1),r,_,n.deepth+1);f.deepth<t&&f.endIndex-f.startIndex>e&&(c[l++]=f);let p=new BVHNode(++u,calcExtents(o,s,_,d,EPSILON$1),_,d,n.deepth+1);p.deepth<t&&p.endIndex-p.startIndex>e&&(c[l++]=p),n.node0=f,n.node1=p,n.startIndex=0,n.endIndex=0;break}}}for(;l;)h(c[--l]);return this.offsetArray=o,this.rootNodePacked=packBVHNode(d,u+1),c.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,o=new Float32Array(r),s=new Uint32Array(r),c=new Uint16Array(r),l=[0],u=[],d;for(;(d=l.pop())!==void 0;){let r=d*36/4,f=clamp(e.x,o[r],o[r+3])-e.x,p=clamp(e.y,o[r+1],o[r+4])-e.y,m=clamp(e.z,o[r+2],o[r+5])-e.z;if(f*f+p*p+m*m<=t*t){let e=s[r+6],t=s[r+7];for(let r=e;r<t;r++){let e=n[r];u.push(e)}let o=d*36/2,f=c[o+16],p=c[o+17];f&&l.push(f),p&&l.push(p)}}let f=u.length,p=new Float32Array(f*9);for(let e=0;e<f;e++){let t=u[e]*3;this.getPositionByIndex(t,scratchVector3$9),p[e*9]=scratchVector3$9.x,p[e*9+1]=scratchVector3$9.y,p[e*9+2]=scratchVector3$9.z,this.getPositionByIndex(t+1,scratchVector3$9),p[e*9+3]=scratchVector3$9.x,p[e*9+4]=scratchVector3$9.y,p[e*9+5]=scratchVector3$9.z,this.getPositionByIndex(t+2,scratchVector3$9),p[e*9+6]=scratchVector3$9.x,p[e*9+7]=scratchVector3$9.y,p[e*9+8]=scratchVector3$9.z}return p}intersectRay(e,t,n=0,r=!1,o){let s=[],c=this.offsetArray,l=this.rootNodePacked,u=new Float32Array(l),d=new Uint32Array(l),f=new Uint16Array(l),p=new BVHVector3(1/t.x,1/t.y,1/t.z),m=[0],h,g=1/0,_=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),v=new BVHVector3(0,0,0),y=new BVHVector3(0,0,0),b=new BVHVector3(0,0,0);for(;(h=m.pop())!==void 0;){let l=h*36/4;_.min.x=u[l],_.min.y=u[l+1],_.min.z=u[l+2],_.max.x=u[l+3],_.max.y=u[l+4],_.max.z=u[l+5];let S=intersectNodeBox(e,p,_,n);if(S===null||r&&S>g)continue;let C=e.x,w=e.y,T=e.z,E=t.x,D=t.y,O=t.z,k=d[l+6],A=d[l+7];for(let e=k;e<A;e++){let t=c[e],n=t*3;this.getPositionByIndex(n,v);let l=v.x,u=v.y,d=v.z;this.getPositionByIndex(n+1,y);let f=y.x,p=y.y,m=y.z;this.getPositionByIndex(n+2,b);let h=b.x,_=b.y,S=b.z,k=f-l,A=p-u,j=m-d,M=h-l,N=_-u,P=S-d,F=A*P-j*N,I=j*M-k*P,L=k*N-A*M,R=E*F+D*I+O*L,z;if(R>0)z=1;else if(R<0)z=-1,R=-R;else continue;let B=C-l,V=w-u,H=T-d,ee=z*(E*(V*P-H*N)+D*(H*M-B*P)+O*(B*N-V*M));if(ee<0)continue;let te=z*(E*(A*H-j*V)+D*(j*B-k*H)+O*(k*V-A*B));if(te<0||ee+te>R)continue;let U=-z*(B*F+V*I+H*L);if(U<0)continue;let W=U/R,G=new BVHIntersect(v,y,b,t,new BVHVector3(C+E*W,w+D*W,T+O*W));(!o||o(G))&&(r?W<g&&(g=W,s.length>0&&(s.length=0),s.push(G)):s.push(G))}let j=h*36/2,M=f[j+16],N=f[j+17];M&&m.push(M),N&&m.push(N)}return s}};function clamp(e,t,n){return e<t?t:e>n?n:e}function calcExtents(e,t,n,r,o){if(n>=r)return[0,0,0,0,0,0];let s=1/0,c=1/0,l=1/0,u=-1/0,d=-1/0,f=-1/0;for(let o=n;o<r;o++){let n=e[o]*6,r=t[n];r<s&&(s=r),r=t[n+1],r<c&&(c=r),r=t[n+2],r<l&&(l=r),r=t[n+3],r>u&&(u=r),r=t[n+4],r>d&&(d=r),r=t[n+5],r>f&&(f=r)}return[s-o,c-o,l-o,u+o,d+o,f+o]}(function(){let e=new BVHVector3(0,0,0),t=new BVHVector3(0,0,0),n=new BVHVector3(0,0,0),r=new BVHVector3(0,0,0);return function(o,s,c,l,u){t.subVectors(s,o),n.subVectors(c,o),r.crossVectors(t,n);let d=u.dot(r),f;if(d>0)f=1;else if(d<0)f=-1,d=-d;else return null;e.subVectors(l,o);let p=f*u.dot(n.crossVectors(e,n));if(p<0)return null;let m=f*u.dot(t.cross(e));if(m<0||p+m>d)return null;let h=-f*e.dot(r);if(h<0)return null;let g=h/d;return new BVHVector3(0,0,0).copy(u).multiplyScalar(g).add(l)}})();var EPSILON=1e-6,ORDER_AXISES=[`x`,`y`,`z`],scratchVector3$8=new BVHVector3(0,0,0),BVHPoints=class extends BVHObject{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionByIndex.bind(this),o=this.getPositionCount(),s=o>65535?new Uint32Array(o):new Uint16Array(o),c=[],l=0,u=-1;if(n)for(let e=0;e<o;e+=1)s[e]=e;else{r(0,scratchVector3$8);let e=scratchVector3$8.x,t=scratchVector3$8.y,c=scratchVector3$8.z,l=e,u=t,d=c;for(let n=0;n<o;n+=1){s[n]=n,r(n,scratchVector3$8);let o=scratchVector3$8.x,f=scratchVector3$8.y,p=scratchVector3$8.z;o<e?e=o:o>l&&(l=o),f<t?t=f:f>u&&(u=f),p<c?c=p:p>d&&(d=p)}n=[e,t,c,l,u,d]}let d=new BVHNode(++u,n,0,o,0);c[l++]=d;let f=[],p=[0,1,2],m=function(e,t){return f[t]-f[e]};function h(n){let o=n.startIndex,d=n.endIndex,h=n.extents;f[0]=h[3]-h[0],f[1]=h[4]-h[1],f[2]=h[5]-h[2];let g=p.sort(m)[0],_=ORDER_AXISES[g],v=(h[g]+h[g+3])/2,y=o,b=d-1,S=-1,C;for(;y<=b;)S===-1?(C=s[y],r(C,scratchVector3$8),scratchVector3$8[_]<v?y++:S=C):(C=s[b],r(C,scratchVector3$8),scratchVector3$8[_]>=v?b--:(s[y]=C,s[b]=S,S=-1,y++,b--));if(y>o){let r=h.slice();r[g+3]=v+EPSILON;let s=new BVHNode(++u,r,o,y,n.deepth+1);s.deepth<t&&s.endIndex-s.startIndex>e&&(c[l++]=s),n.node0=s}if(d>y){let r=h.slice();r[g]=v-EPSILON;let o=new BVHNode(++u,r,y,d,n.deepth+1);o.deepth<t&&o.endIndex-o.startIndex>e&&(c[l++]=o),n.node1=o}n.startIndex=0,n.endIndex=0}for(;l;)h(c[--l]);return this.offsetArray=s,this.rootNodePacked=packBVHNode(d,u+1),c.length=0,this}intersectRay(e,t,n=0,r=!1,o){let s=[],c=this.offsetArray,l=this.rootNodePacked,u=new Float32Array(l),d=new Uint32Array(l),f=new Uint16Array(l),p=n*n,m=new BVHVector3(1/t.x,1/t.y,1/t.z),h=[0],g,_=1/0,v=new BVHBox3(new BVHVector3(0,0,0),new BVHVector3(0,0,0)),y=new BVHVector3(0,0,0);for(;(g=h.pop())!==void 0;){let l=g*36/4;v.min.x=u[l],v.min.y=u[l+1],v.min.z=u[l+2],v.max.x=u[l+3],v.max.y=u[l+4],v.max.z=u[l+5];let b=intersectNodeBox(e,m,v,n);if(b===null||r&&b>_)continue;let S=d[l+6],C=d[l+7];for(let n=S;n<C;n++){let l=c[n];this.getPositionByIndex(l,y);let u=y.x,d=y.y,f=y.z,m=e.x,h=e.y,g=e.z,v=t.x,b=t.y,S=t.z,C=v*(u-m)+b*(d-h)+S*(f-g);if(C>0?(m+=v*C,h+=b*C,g+=S*C):C<0&&(C=0),v=u-m,b=d-h,S=f-g,v*v+b*b+S*S<=p){let e=new BVHIntersect(y,y,y,l,new BVHVector3(m,h,g));(!o||o(e))&&(r?C<_&&(_=C,s.length>0&&(s.length=0),s.push(e)):s.push(e))}}let w=g*36/2,T=f[w+16],E=f[w+17];T&&h.push(T),E&&h.push(E)}return s}},jsContent$1="(function(){var e=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`)}},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)}}))})();",blob$1=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,jsContent$1],{type:`text/javascript;charset=utf-8`});function WorkerWrapper$1(e){let t;try{if(t=blob$1&&(self.URL||self.webkitURL).createObjectURL(blob$1),!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(jsContent$1),{name:e==null?void 0:e.name})}}init_pbmGaussianSplattingObject();var bvhWorkerPool=new WorkerPool(()=>new WorkerWrapper$1,4),defaultHitFilter=()=>!0,scratchRay=new three.Ray,scratchNormalMatrix=new three.Matrix3,scratchInverseMatrix=new three.Matrix4,scratchIntersectionFaceA=new three.Vector3,scratchIntersectionFaceB=new three.Vector3,scratchIntersectionFaceC=new three.Vector3,intersectsMap=new WeakMap;function raycastMesh(e,t,n,r){var o,s;let c=e.matrixWorld;scratchInverseMatrix.getInverse(c),scratchRay.copy(n.ray).applyMatrix4(scratchInverseMatrix);let l=(o=n.hitFilter)==null?defaultHitFilter:o,u=(s=n.firstHitOnly)==null?!1:s,d=e.geometry,f=e.material,p=d.groups,m=d.index,h=t.intersectRay(scratchRay.origin,scratchRay.direction,0,u,t=>{var r;let o=t.index,s=o*3,u;if(Array.isArray(f)){if(p){for(let e of p)if(s>=e.start&&s-e.start<e.count){u=f[(r=e.materialIndex)==null?0:r];break}}}else u=f;if(!u)return!1;let d=t.intersectionPoint,h=new three.Vector3(d.x,d.y,d.z).applyMatrix4(c),g=n.ray.origin.distanceTo(h);if(g<n.near||g>n.far)return!1;let _=t.pointA,v=t.pointB,y=t.pointC,b=three.Triangle.getNormal(scratchIntersectionFaceA.set(_.x,_.y,_.z).applyMatrix4(c),scratchIntersectionFaceB.set(v.x,v.y,v.z).applyMatrix4(c),scratchIntersectionFaceC.set(y.x,y.y,y.z).applyMatrix4(c),new three.Vector3),S=n.ray.direction.dot(b);if(u.side===three.FrontSide&&S>=0||u.side===three.BackSide&&S<=0)return!1;let C={distance:g,object:e,face:new three.Face3(m?m.array[s]:s,m?m.array[s+1]:s+1,m?m.array[s+2]:s+2,b),point:h,distanceToRay:0,faceIndex:o};return intersectsMap.set(t,C),l(C)}),g=h.length;for(let e=0;e<g;e++){let t=intersectsMap.get(h[e]);t&&r.push(t)}h.length=0}function raycastPoints(e,t,n,r){var o,s,c,l;let u=e.matrixWorld;scratchNormalMatrix.getNormalMatrix(u),scratchInverseMatrix.getInverse(u),scratchRay.copy(n.ray).applyMatrix4(scratchInverseMatrix);let d=((s=(o=n.params.Points)==null?void 0:o.threshold)==null?1:s)*scratchInverseMatrix.getMaxScaleOnAxis(),f=(c=n.hitFilter)==null?defaultHitFilter:c,p=(l=n.firstHitOnly)==null?!1:l,m=e.geometry,h=m.index,g=m.getAttribute(`normal`),_=g instanceof three.BufferAttribute,v=t.intersectRay(scratchRay.origin,scratchRay.direction,d,p,t=>{let r=t.intersectionPoint,o=new three.Vector3(r.x,r.y,r.z).applyMatrix4(u),s=n.ray.origin.distanceTo(o);if(s<n.near||s>n.far)return!1;let c=t.pointA,l=scratchIntersectionFaceA.set(c.x,c.y,c.z).applyMatrix4(u),d=o.distanceTo(l);if(d/s>.07)return!1;let p=t.index,m=h?h.array[p]:p,v;if(_){let e=new three.Vector3().fromBufferAttribute(g,m).applyNormalMatrix(scratchNormalMatrix);v=new three.Face3(m,m,m,e)}else if(e instanceof PBMGaussianSplattingObject){let t=e.decodeCov3D(m);if(t){let[e,r,o,s,c,l]=t,u=`z`;u=e<=s&&e<=l?`x`:s<=e&&s<=l?`y`:`z`;let d=new three.Vector3(0,0,0);d[u]=1,d.applyNormalMatrix(scratchNormalMatrix),n.ray.direction.dot(d)>0&&d.negate(),v=new three.Face3(m,m,m,d)}}let y={distance:s,object:e,face:v,point:o,distanceToRay:d,index:p};return intersectsMap.set(t,y),f(y)}),y=v.length;for(let e=0;e<y;e++){let t=intersectsMap.get(v[e]);t&&r.push(t)}v.length=0}var BVH_MESH_PROP=`__bvh_mesh__`,originMeshRaycast=three.Mesh.prototype.raycast;function overrideMeshRaycast(e,t){let n=getBvhTreeForMesh(this);n?raycastMesh(this,n,e,t):originMeshRaycast.call(this,e,t)}function getBvhTreeForMesh(e){let t=e[BVH_MESH_PROP];return t instanceof BVHMesh,t}function bindBvhTreeForMesh(e,t){Object.assign(e,{[BVH_MESH_PROP]:t,raycast:overrideMeshRaycast})}var BVH_POINTS_PROP=`__bvh_points__`,originPointsRaycast=three.Points.prototype.raycast;function overridePointsRaycast(e,t){let n=getBvhTreeForPoints(this);n?raycastPoints(this,n,e,t):originPointsRaycast.call(this,e,t)}function getBvhTreeForPoints(e){let t=e[BVH_POINTS_PROP];return t instanceof BVHPoints,t}function bindBvhTreeForPoints(e,t){Object.assign(e,{[BVH_POINTS_PROP]:t,raycast:overridePointsRaycast})}function generateBvhTree(e,t=!0,n=100,r=10){let o=[];return e.traverse(e=>{(e instanceof three.Mesh||e instanceof three.Points)&&e.geometry instanceof three.BufferGeometry&&o.push(e)}),t?Promise.resolve().then(()=>{for(let e=o.length-1;e>=0;e--){let t=o[e];if(t instanceof PBMGaussianSplattingObject){let s=t.packedData;if(s&&s.length>=t.numPoints*8){let e=new BVHPoints({array:new Float32Array(s.buffer,s.byteOffset,s.length),stride:8,offset:0});e.createTree(n,r),bindBvhTreeForPoints(t,e)}o.splice(e,1)}}let e=[],t=new Set,s=null;for(let c=0;c<o.length;c++){let l=o[c],u=l.geometry;if(!(u instanceof three.BufferGeometry))continue;let d;if(l instanceof three.Mesh?d=`mesh`:l instanceof three.Points&&(d=`points`),!d)continue;let f=u.boundingBox,p=f?[f.min.x,f.min.y,f.min.z,f.max.x,f.max.y,f.max.z]:void 0,m={};for(let e in u.attributes){let n=u.attributes[e];n instanceof three.InterleavedBufferAttribute?(m[e]={array:n.data.array,stride:n.data.stride,offset:n.offset},s=n.data.array,s&&s.buffer instanceof ArrayBuffer&&t.add(s.buffer)):(m[e]={array:n.array},s=n.array,s&&s.buffer instanceof ArrayBuffer&&t.add(s.buffer))}let h,g=u.getIndex();g&&(g instanceof three.InterleavedBufferAttribute?(h={array:g.data.array,stride:g.data.stride,offset:g.offset},s=g.data.array,s&&s.buffer instanceof ArrayBuffer&&t.add(s.buffer)):(h={array:g.array},s=g.array,s&&s.buffer instanceof ArrayBuffer&&t.add(s.buffer)));let _={type:d,attributes:m,indices:h,maxItemPerNode:n,maxTreeDepth:r,extents:p};e.push(_)}return bvhWorkerPool.postMessage(e,Array.from(t))}).then(t=>{for(let e=0;e<o.length;e++){let n=o[e],r=n.geometry,s=t[e];if(!(r instanceof three.BufferGeometry))continue;for(let e in s.attributes){let t=s.attributes[e].array,n=r.attributes[e];n instanceof three.InterleavedBufferAttribute?n.data.array=t:n.array=t}let c=r.getIndex();if(c&&s.indices){let e=s.indices.array;c instanceof three.InterleavedBufferAttribute?c.data.array=e:c.array=e}if(n instanceof three.Mesh){let e=new BVHMesh(s.attributes.position,s.indices);e.offsetArray=s.offsetArray,e.rootNodePacked=s.rootNodePacked,bindBvhTreeForMesh(n,e)}else if(n instanceof three.Points){let e=new BVHPoints(s.attributes.position,s.indices);e.offsetArray=s.offsetArray,e.rootNodePacked=s.rootNodePacked,bindBvhTreeForPoints(n,e)}}return e}):Promise.resolve().then(()=>{for(let e of o)if(e instanceof three.Mesh){let t=e.geometry,o=t.boundingBox,s=o?[o.min.x,o.min.y,o.min.z,o.max.x,o.max.y,o.max.z]:void 0;if(t instanceof three.BufferGeometry){let o,c,l=t.attributes.position;o=l instanceof three.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array};let u=t.getIndex();u&&(c=u instanceof three.InterleavedBufferAttribute?{array:u.data.array,stride:u.data.stride,offset:u.offset}:{array:u.array});let d=new BVHMesh(o,c);d.createTree(n,r,s),bindBvhTreeForMesh(e,d)}}else if(e instanceof three.Points)if(e instanceof PBMGaussianSplattingObject){let t=e.packedData;if(t&&t.length>=e.numPoints*8){let o=new BVHPoints({array:new Float32Array(t.buffer,t.byteOffset,t.length),stride:8,offset:0});o.createTree(n,r),bindBvhTreeForPoints(e,o)}}else{let t=e.geometry,o=t.boundingBox,s=o?[o.min.x,o.min.y,o.min.z,o.max.x,o.max.y,o.max.z]:void 0;if(t instanceof three.BufferGeometry){let o,c,l=t.attributes.position;o=l instanceof three.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array};let u=t.getIndex();u&&(c=u instanceof three.InterleavedBufferAttribute?{array:u.data.array,stride:u.data.stride,offset:u.offset}:{array:u.array});let d=new BVHPoints(o,c);d.createTree(n,r,s),bindBvhTreeForPoints(e,d)}}return e})}function mixNumber(e,t,n){return e+(t-e)*n}function value(e,t,n,r){let o=(t*n+2*e)/Math.pow(n,3),s=-(2*t*n+3*e)/Math.pow(n,2),c=t,l=e;return o*Math.pow(r,3)+s*Math.pow(r,2)+c*r+l}function velocity(e,t,n,r){let o=(t*n+2*e)/Math.pow(n,3),s=-(2*t*n+3*e)/Math.pow(n,2),c=t;return 3*o*Math.pow(r,2)+2*s*r+c}function mixCircle(e,t,n,r){let o=r[1]-r[0];return e=circleValue(e,r),t=circleValue(t,r),t-e>o/2?mixNumber(e+o,t,n):e-t>o/2?mixNumber(e-o,t,n):mixNumber(e,t,n)}function circleValue(e,t){let n=t[1]-t[0];return e<t[0]?circleValue(e+n,t):e>=t[1]?circleValue(e-n,t):e}function mixValue(e,t,n,r){return r?mixCircle(e,t,n,r):mixNumber(e,t,n)}function toNumber(e){let t=Number(e);return isNaN(t)||!isFinite(t)?0:t}var Motion=class{constructor(e){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=now(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(let t in e){let n=e[t];typeof n==`object`?(this.value[t]=toNumber(n.value),this.config[t]={circle:n.circle}):(this.value[t]=toNumber(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-value(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],o={};for(let t in this.config){let s=(e-n.progress)/(r.progress-n.progress);o[t]=mixValue(n.value[t],r.value[t],s,this.config[t].circle)}return o}return Object.assign({},this.keyframes[this.keyframes.length-1].value)}getProgressVelocity(e){let t=e-this.startTime;return t>=this.duration?0:velocity(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 o;isNaN(t)&&(t=0),isNaN(n)&&(n=0),r=r==null?now():r;let s=this.getProgress(r),c=this.getValue(s),l={};for(let t in this.config)l[t]=(o=e[t])==null?c[t]:o;let u=[{progress:0,value:c},{progress:1,value:l}];return this.setKeyframes(u,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((o,s)=>{r=r==null?now():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=[o,s]})}dispose(){this.callbacks&&(this.callbacks[1](Error(`motion dispose.`)),this.callbacks=void 0)}},PI$1=Math.PI,c1=1.70158,c2=c1*1.525,c3=c1+1,c4=2*PI$1/3,c5=2*PI$1/4.5,linear=function(e){return e},easeInCubic=function(e){return e*e*e},easeInQuart=function(e){return e*e*e*e};init_pbmGaussianSplattingObject();var APPEAR_ANIMATION_DURATION=500,parameterValueVersionMap$1=new WeakMap,scratchIntersectPoint=new three.Vector3,scratchClippingBoxMatrixInverse=new three.Matrix4,TileNode=class e extends three.Object3D{constructor(e,t,n,r=noop){super(),this.name=e,this.materials=[],this.pbmObjects=[],this.contentObject=t,this.animations=n,this.appearMotion=new Motion({appear:0}),this.disposers=[r],this.add(t),t.traverse(e=>{if(e instanceof three.Mesh||e instanceof three.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 PBMMesh||e instanceof PBMSkinnedMesh||e instanceof PBMPointCloud||e instanceof PBMGaussianSplattingObject)&&this.pbmObjects.push(e)})}generateBvhTree(){return generateBvhTree(this,!0,200,20)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.hitFilter;e.hitFilter=t=>{if(t.object instanceof PBMPointCloud&&t.object.material.pointBack===`HIDDEN`&&t.face&&t.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;let n=0,o=-1;if((t.object instanceof PBMMesh||t.object instanceof PBMSkinnedMesh||t.object instanceof PBMPointCloud)&&t.face){let e=Array.isArray(t.object.material)?t.object.material[t.face.materialIndex]:t.object.material;if(e){n=e.floorIndex,o=e.shownFloorIndex;for(let r of e.clippers)if(!(typeof r.floorIndex==`number`&&r.floorIndex!==n)&&(scratchClippingBoxMatrixInverse.getInverse(r.clippingBoxMatrix),scratchIntersectPoint.copy(t.point).applyMatrix4(scratchClippingBoxMatrixInverse),Math.abs(scratchIntersectPoint.x)<.5&&Math.abs(scratchIntersectPoint.y)<.5&&Math.abs(scratchIntersectPoint.z)<.5))return!1}}let s=o;return e.floorIndex===void 0?e.floor!==void 0&&(s=e.floor===null?-1:e.floor):s=e.floorIndex,s>=0&&n!==s?!1:(Object.assign(t,{floorIndex:n,floor:n}),r?r.call(e,t):!0)};let o=this.children.slice(),s;for(;s=o.pop();)if(s.visible){s.raycast(e,n);for(let e=0,t=s.children.length;e<t;e++)o.push(s.children[e])}return e.hitFilter=r,sortIntersects(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n,r,o,s){let c=!1;if(r.visible&&o.state.selectedFrameNumber===o.tileset.frameNumber){let e=1;this.appearMotion.getTargetKeyframe().value.appear!==1&&this.appearMotion.set({appear:1},APPEAR_ANIMATION_DURATION).catch(noop)}else{let e=0;this.appearMotion.getTargetKeyframe().value.appear!==0&&this.appearMotion.set({appear:0},0).catch(noop)}this.appearMotion.ended!==!0&&this.appearMotion.update(t.time);for(let l of this.pbmObjects)l instanceof PBMMesh||l instanceof PBMSkinnedMesh?updatePBMMesh(l,this.appearMotion,e,t,n,o,s)===!0&&(c=!0):l instanceof PBMPointCloud?updatePBMPointCloud(l,this.appearMotion,e,t,n,o,s)===!0&&(c=!0):l instanceof PBMGaussianSplattingObject&&updatePBMGSObject(l,this.appearMotion,e,t,n,r,o,s)===!0&&(c=!0);return c}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 updatePBMMesh(e,t,n,r,o,s,c){var l,u;let d=!1;if(parameterValueVersionMap$1.get(e)!==c.versionNumber){parameterValueVersionMap$1.set(e,c.versionNumber),d=!0,e.castShadow=c.castShadow,e.receiveShadow=c.receiveShadow;let t=e.material;for(let e of t)e.customShaders=c.customShaders,e.pano0=c.pano0,e.pano1=c.pano1,e.pano0Depth=c.pano0Depth,e.pano1Depth=c.pano1Depth,e.panoFilter=(u=(l=c.panoFilter)==null?void 0:l.toValue())==null?null:u,e.refinedScreen=c.refinedScreen,e.modelAlpha=c.modelAlpha,e.progress=c.progress,e.transition=c.transition,e.opacity=c.opacity,e.floorStyle=c.floorStyle,e.constantColor=c.constantColor,e.shownFloorIndex=c.shownFloorIndex,e.clippers=c.clippers,e.brightness=c.brightness,e.useHQWeight=c.useHQWeight,e.useHQDepth=c.useHQDepth,e.colorSaturation=c.colorSaturation,e.colorBrightness=c.colorBrightness,e.gradientTexture=c.gradientTexture,e.vertexMarks=c.vertexMarks,e.depthOffset=c.depthOffset,e.modelBoundingMax.copy(c.boundingBox.max),e.modelBoundingMin.copy(c.boundingBox.min),e.shaderType===`none`?(e.transparent=!0,e.blending=three.NormalBlending,e.blendDst=three.OneMinusSrcAlphaFactor,e.blendEquation=three.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.colorWrite=!0,e.depthWrite=!1,e.depthTest=!0):(e.transparent=e.alphaMode===`BLEND`,e.blending=three.NormalBlending,e.blendDst=three.OneMinusSrcAlphaFactor,e.blendEquation=three.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.colorWrite=!0,e.depthWrite=!0,e.depthTest=!0,c.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=three.AdditiveBlending),c.onlyDepth&&(e.colorWrite=!1,e.depthWrite=!0,e.depthTest=!0),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,c.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=three.AdditiveBlending))}return d}function updatePBMPointCloud(e,t,n,r,o,s,c){var l,u;let d=!1;if(c.pointAppearAnimation===!0&&s.refine===`ADD`&&s.tileset.rootMeta.pntsOrder===`RANDOM`){let n=e.geometry,r=s.tileset.currentMaxScreenSpaceError,o=s.state.screenSpaceError,c=(u=(l=s.parent)==null?void 0:l.state.screenSpaceError)==null?o:u,f=1;c!==o&&(f=(c-r)/(c-o)),f=clamp$1(f,0,1),f=easeInCubic(f);let p=n.index?n.index.count:n.attributes.position?n.attributes.position.count:1/0,m=Math.floor(p*f*t.value.appear);n.drawRange.count!==m&&(n.setDrawRange(0,m),d=!0)}if(parameterValueVersionMap$1.get(e)!==c.versionNumber){parameterValueVersionMap$1.set(e,c.versionNumber),d=!0,e.castShadow=c.castShadow,e.receiveShadow=c.receiveShadow;let t=[e.material];for(let e of t)e.customShaders=c.customShaders,e.pointScale=c.pointScale,e.pointMinPixel=c.pointMinPixel,e.pointMaxPixel=c.pointMaxPixel,e.pointSize=c.pointSize,e.pointShape=c.pointShape,e.pointBack=c.pointBack,e.modelAlpha=c.modelAlpha,e.opacity=c.opacity,e.floorStyle=c.floorStyle,e.constantColor=c.constantColor,e.shownFloorIndex=c.shownFloorIndex,e.clippers=c.clippers,e.brightness=c.brightness,e.useHQWeight=c.useHQWeight,e.useHQDepth=c.useHQDepth,e.colorSaturation=c.colorSaturation,e.colorBrightness=c.colorBrightness,e.outlineGain=c.outlineGain,e.distanceGain=c.distanceGain,e.gradientTexture=c.gradientTexture,e.depthOffset=c.depthOffset,e.transparent=!1,e.blending=three.NormalBlending,e.blendDst=three.OneMinusSrcAlphaFactor,e.blendEquation=three.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.colorWrite=!0,e.depthWrite=!0,e.depthTest=!0,e.modelBoundingMax.copy(c.boundingBox.max),e.modelBoundingMin.copy(c.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),c.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=three.AdditiveBlending),c.onlyDepth&&(e.colorWrite=!1,e.depthWrite=!0,e.depthTest=!0),e.useHQWeight&&(e.depthWrite=!1,e.blending=three.CustomBlending,e.blendSrc=three.SrcAlphaFactor,e.blendSrcAlpha=three.SrcAlphaFactor,e.blendDst=three.OneFactor,e.blendDstAlpha=three.OneFactor),e.useHQDepth&&(e.colorWrite=!1)}return d}function updatePBMGSObject(e,t,n,r,o,s,c,l){let u=!1,d=s.uuid;return e.gsViewLayerKey!==d&&(e.gsViewLayerKey=d,u=!0),e.gsClippers!==l.clippers&&(e.gsClippers=l.clippers,u=!0),e.updateMatrix(),e.updateMatrixWorld(),e.usedSHDegree=l.gaussianSplattingSHDegree,e.initAnimationEnabled=l.enableGaussianSplattingInitAnimation,e.lastMatrixWorld?e.transformChanged=!e.lastMatrixWorld.equals(e.matrixWorld):(e.lastMatrixWorld=new three.Matrix4,e.transformChanged=!0,u=!0),e.lastMatrixWorld.copy(e.matrixWorld),e.transformChanged&&(u=!0),u}var Trajectory=class{constructor(e,t,n){this.id=e,this.name=t.name,this.visible=!1,this.tileset=n,this.transform=new three.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:now(),loadfailRetryDelay:0,data:void 0}}},TrajectoryNode=class e extends three.Object3D{constructor(e,t,n=noop){super(),this.name=e,this.contentObject=t,this.name=e,this.add(t),this.disposers=[n]}update(e,t,n,r,o,s){let c=this.contentObject.material[2];return c.uniforms.dashOffset.value=(c.uniforms.dashOffset.value-.003)%(c.uniforms.dashSize.value.x+c.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())}},priorityCache=new Map;function getPriority(e,t,n){if(n&&n.has(t))return n.get(t);let r=t.refine===`ADD`||e.skipLevelOfDetail,o=t.parent,s=o&&(!r||t.state.screenSpaceError===0)?o.state.screenSpaceError:t.state.screenSpaceError,c=t.tileset.root?t.tileset.root.state.screenSpaceError:0,l=Math.max(c-s,0);return n&&n.set(t,l),l}var TileRequestScheduler=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,o=this.requestQueue,s=new Set(e);for(let e=0;e<o.length;e++){let t=o[e];if(s.has(t.tile)){s.delete(t.tile);continue}t.status===`WAITING`&&(o.splice(e,1),e--,this.options.onTileSkip&&this.options.onTileSkip(t.tile))}s.size>0&&(s.forEach(e=>{o.push({tile:e,status:`WAITING`,time:r,error:null})}),s.clear());let c=n.maxRequests;for(let e=0;e<o.length&&c>0;e++){let t=o[e];if(t.status===`DONE`)t.error===null?(c--,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),o.splice(e,1),e--;else if(t.status===`PENDING`&&r-t.time<1e3)break}switch(priorityCache.clear(),t){case`SCREEN_SPACE_ERROR`:o.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?getPriority(n,e.tile,priorityCache)-getPriority(n,t.tile,priorityCache):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`:o.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`:o.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(c=Math.max(n.maxRequests-this.activeRequests,0),!n.skipLevelOfDetail){let e=0,t=o.length;for(let r=0;r<t;r++){let t=o[r].tile;if(t.hasTilesetContent||t.contentParent===null||t.contentParent.state.selectedFrameNumber===n.frameNumber){let t=o.splice(r,1);o.splice(e++,0,...t)}}}for(let e=0;e<o.length&&c>0;e++){let t=o[e];t.status===`WAITING`&&(c--,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--}))}}},CacheNode=class{constructor(e,t,n){this.item=e,this.previous=t,this.next=n}},CacheNodeList=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(e){let t=new CacheNode(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}},TileCache=class{constructor(e={}){this.options=e,this.cacheNodeMap=new WeakMap,this.list=new CacheNodeList,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}},ManagedArray=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]}},TilesetBaseTraverser=class{constructor(e){this.tileset=e,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new ManagedArray}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)}},TilesetNormalTraverser=class extends TilesetBaseTraverser{constructor(e){super(e),this._traversalStack=new ManagedArray,this._emptyTraversalStack=new ManagedArray}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,o=!r||r.state.shouldRefine,s=!1;this.canTraverse(e,t)&&(s=this.updateAndPushChildren(e,t,n)&&o);let c=!s&&o;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.loadTile(e,t),c&&this.selectDesiredTile(e,t)):(this.loadTile(e,t),c&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=s}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let o=e.refine===`REPLACE`&&e.hasRenderContent,s=!1,c=!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),s===!1&&(s=!0)):(o||t.loadSiblings)&&(this.loadTile(e,t),this.touchTile(e,t)),o){let n;n=e.state.inRequestVolume?e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t):!1,c=c&&n}return s||(c=!1),c}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(),o=!e.hasRenderContent&&this.canTraverse(e,t);if(!o&&!e.contentAvailable&&(n=!1),this.updateTile(e,t),e.state.visible||(this.loadTile(e,t),this.touchTile(e,t)),o){let t=e.children;for(let e of t)r.find(e)&&r.delete(e),r.push(e)}}return n}},TilesetSkipTraverser=class extends TilesetBaseTraverser{constructor(e){super(e),this.baseScreenSpaceError=1024,this.skipScreenSpaceErrorFactor=16,this.skipLevels=1,this._traversalStack=new ManagedArray,this._descendantTraversalStack=new ManagedArray,this._selectionTraversalStack=new ManagedArray,this._selectionTraversalancestorStack=new ManagedArray}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,o=!r||r.state.shouldRefine,s=!1;this.canTraverse(e,t)&&(s=this.updateAndPushChildren(e,t,n)&&o);let c=!s&&o;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),c&&this.selectDesiredTile(e,t)):c?(this.loadTile(e,t),this.selectDesiredTile(e,t)):this.reachedSkippingThreshold(e)&&this.loadTile(e,t)):(this.loadTile(e,t),c&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=s}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let o=!1;for(let e of r)e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.push(e),o===!1&&(o=!0)):t.loadSiblings&&(this.loadTile(e,t),this.touchTile(e,t));return o}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,o;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!==o&&(e.state.finalResolution=!1),this.selectTile(e,t);continue}}let e=n.pop();if(!e)continue;let s=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),o=e,!s){this.selectTile(e,t);continue}r.push(e),e.state.stackLength=n.length}if(s)for(let t of e.children)t.state.visible&&n.push(t)}}},TilesetMostDetailTraverser=class extends TilesetBaseTraverser{constructor(e){super(e),this._traversalStack=new ManagedArray}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`,o=e.refine===`REPLACE`,s=this.canTraverse(e,t);s&&this.updateAndPushChildren(e,t,n),(r||o&&!s)&&(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 o=r[e];o.updateState(t),o.state.visible&&n.push(o)}}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}},Tileset=class{constructor(e,t){var n,r,o,s,c,l,u;if(this.id=e.tilesetUrl,this.transform=new three.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.maxAverageTileMemory=0,this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||``,gltfUpAxis:(n=e.asset.gltfUpAxis)==null?`Y`:n,overview:e.asset.overview,trajectories:(o=(r=e.asset.trajectories)==null?void 0:r.list)==null?[]:o,extras:e.asset.extras},this.rootMeta=(s=e.rootMeta)==null?{}:s,this.pointLength=(c=this.rootMeta.numTotalPoints)==null?1/0:c,this.floorLength=(l=this.rootMeta.numFloors)==null?1:l,this.properties=(u=e.properties)==null?{}:u,this.options=t,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new TilesetNormalTraverser(this),this.skipTraverser=new TilesetSkipTraverser(this),this.mostDetailTraverser=new TilesetMostDetailTraverser(this),this.cache=new TileCache({onTileLoad:e=>{this.cacheMemoryUsageInBytes+=e.contentMemoryUsage},onTileUnload:e=>{this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.unloadTiles.push(e)}}),this.requestScheduler=new TileRequestScheduler(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 Tile(`${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 Trajectory(`${this.id}#trajectory:${e}`,this.asset.trajectories[e],this);this.trajectories.push(t)}}adjustScreenSpaceError(e){if(e.frameNumber%20==0)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 o=1024*1024,s=t/r*n,c=e.maxMemoryUsage*o,l=c-clamp$1(c*.2,32*o,128*o),u=this.currentMaxScreenSpaceError;if(s<l){let e=.3*Math.max(1-s/l,0);u-=e}else s>c&&(u+=.15);u=clamp$1(u,.5,e.maxScreenSpaceError),Math.abs(u-this.currentMaxScreenSpaceError)>=.1&&(this.currentMaxScreenSpaceError=u)}}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 normalizeTileHeader(e,t){var n;if(e.content){let r=(n=e.content.uri)==null?e.content.url:n;typeof r==`string`&&!isAbsoluteURL(r)&&(e.content.uri=normalizeURL(pathJoin(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)normalizeTileHeader(n,t);return e}function normalizeTilesetHeader(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;isAbsoluteURL(t.imageFile)||(t.imageFile=normalizeURL(pathJoin(n,t.imageFile))),isAbsoluteURL(t.worldFile)||(t.worldFile=normalizeURL(pathJoin(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=normalizeURL(pathJoin(n,r.file))}return normalizeTileHeader(e.root,n),e}function delay(e){return new Promise(t=>setTimeout(t,e))}var AsyncTaskQueue=class{constructor(e){this.queue=[],this.concurrency=e,this.dequeuing=0}add(e,t=1e3){let n,r,o=new Promise((e,t)=>{n=e,r=t});return this.queue.unshift(()=>{let o=Promise.resolve().then(e);o.then(n,r);let s=delay(t);return Promise.race([o,s]).then(noop,noop)}),this.dequeue(),o}dequeue(){for(;this.dequeuing<this.concurrency&&this.queue.length>0;){let e=this.queue.pop();this.dequeuing++,e().catch(noop).then(()=>{this.dequeuing--,this.dequeue()})}}},initTextureQueue=new AsyncTaskQueue(1),skipImageSize=256;function canInit(e){return typeof e.image==`object`&&e.image.width>0&&e.image.height>0}function initTexture(e,t){if(!canInit(e))return Promise.resolve(e);if(e.image.width<skipImageSize&&e.image.width<skipImageSize)return t.initTexture(e),Promise.resolve(e);let n=!1,r=()=>{n=!0,e.removeEventListener(`dispose`,r)};return e.addEventListener(`dispose`,r),initTextureQueue.add(()=>new Promise(o=>{AnimationFrameLoop.shared.add(()=>{canInit(e)&&n===!1&&t.initTexture(e),e.removeEventListener(`dispose`,r),o(e)},!0)}))}function initTextures(e,t){return Promise.all(e.map(e=>initTexture(e,t)))}var scratchMatrix4$4=new three.Matrix4,MAX_RETRY_DELAY$1=5e3,RETRY_DELAY_STEP$1=1e3;function attachTileAttributes(e,t){e.name=t.id;let n=t.tileset.properties.floorInfo;e.traverse(e=>{if(`floor`in t.extras){if(e instanceof three.Mesh||e instanceof three.Points){let n=Array.isArray(e.material)?e.material:e.material?[e.material]:[];for(let e of n)(e instanceof PBMMeshMaterial||e instanceof PBMPointCloudMaterial)&&(e.floorIndex=t.extras.floor)}}else if(!(e instanceof PBMPointCloud)&&(e instanceof PBMMesh||e instanceof PBMSkinnedMesh)&&n){let r=new three.Box3().expandByObject(e).getCenter(new three.Vector3),o=0;for(let e=0;e<n.length;e++){let{ground:t,height:s}=n[e];if(r.y<t+s){o=e;break}}t.floor=o,t.tileset.floorLength=Math.max(t.tileset.floorLength,t.floor+1),e.material.forEach(e=>e.floorIndex=o)}})}function loadTileContent(e,t){if(!e.content)return Promise.resolve(e);let n=e.content,r=appendSearch(n.uri,t.search);if(e.type===`TILESET`){let o=imageURL(r,{key:`model.${e.siblingIndex}`});return n.loadState=`LOADING`,n.loadStateUpdateTime=now(),t.fetcher.ajax(o,{responseType:`text`},void 0,void 0,(e,t,r)=>{(n.loadState=`LOADING`)&&(n.loadProgress=e)}).then(e=>e.body).then(e=>{let t=r.slice(0,r.lastIndexOf(`/`)+1);return normalizeTilesetHeader(JSON.parse(e),t)}).then(t=>{n.loadState=`READY`,n.loadStateUpdateTime=now(),n.loadfailRetryDelay=0,e.children.length===0&&(e.children=[new Tile(`${e.id}.0`,t.root,e.tileset,e)])}).then(()=>e).catch(e=>(n.loadState=`FAILED`,n.loadStateUpdateTime=now(),n.loadfailRetryDelay=Math.min(n.loadfailRetryDelay+1e3,5e3),Promise.reject(e)))}if(e.type===`SCENEGRAPH`){n.loadState=`LOADING`,n.loadStateUpdateTime=now();let o=(e,t,r)=>{(n.loadState=`LOADING`)&&(n.loadProgress=e,r&&(n.byteLength=r))};return Promise.resolve().then(()=>{var n,s,c,l,u,d,f,p,m,h,g,_;let v=``,[y,b]=r.split(`#`),S=(b||y).split(`?`)[0].match(/\.([0-9a-zA-Z]+)$/);if(S&&(v=S[1]),v===`b3dm`)return loadB3dm(imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:e.tileset.asset.gltfUpAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,attachTileAttributes(t.scene,e),t));if(v===`pnts`)return loadPnts(imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,computeBoundingBox:!1,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>{if(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,e.boundingVolume){let n=e.boundingVolume;t.scene.traverse(e=>{if(e instanceof PBMPointCloud){scratchMatrix4$4.getInverse(e.matrixWorld);let t=new three.Box3;n.getBoundingBox(t),t.applyMatrix4(scratchMatrix4$4),e.geometry.boundingBox=t}})}return attachTileAttributes(t.scene,e),t});if(v===`glb`||v===`gltf`)return loadGltf(imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:e.tileset.asset.gltfUpAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,attachTileAttributes(t.scene,e),t));if(v===`at3d`)return loadAt3d(e.extras.at3d?r:imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(n=e.extras.at3d)==null?void 0:n.textureBaseUri,textureArray:(s=e.extras.at3d)==null?void 0:s.textureArray,textureOptions:(c=e.extras.at3d)==null?void 0:c.textureOptions,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(v===`pbm`)return loadPbm(e.extras.pbm?r:imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(l=e.extras.pbm)==null?void 0:l.textureBaseUri,textureArray:(u=e.extras.pbm)==null?void 0:u.textureArray,textureOptions:(d=e.extras.pbm)==null?void 0:d.textureOptions,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(v===`dome`)return loadDome(e.extras.dome?r:imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(f=e.extras.dome)==null?void 0:f.textureBaseUri,textureOptions:(p=e.extras.dome)==null?void 0:p.textureOptions,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(v===`domez`)return loadDomez(e.extras.domez?r:imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(m=e.extras.domez)==null?void 0:m.textureBaseUri,textureOptions:(h=e.extras.domez)==null?void 0:h.textureOptions,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(v===`ply`)return loadPly(e.extras.ply?r:imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:(g=e.extras.ply)==null?void 0:g.upAxis,type:`pbmPointCloud`,light:t.light,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(v===`obj`)return loadObj(e.extras.obj?r:imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:(_=e.extras.obj)==null?void 0:_.upAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(v===`fbx`)return loadFbx(e.extras.fbx?r:imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(v===`x3p`)return loadX3p(e.extras.x3p?r:imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(v===`spz`)return loadSpz(imageURL(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:`Z`,fetcher:t.fetcher,onDownloadProgress:o}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t.scene.transformChanged=!0,t));throw Error(`Invalid Tile content: ${r}`)}).then(r=>{let o={type:r.type,uri:r.uri,byteLength:r.byteLength,memoryUsage:r.memoryUsage,object:new TileNode(e.id,r.scene,r.animations,r.dispose)};return Promise.resolve().then(()=>{o.object.traverse(e=>{e.matrix.compose(e.position,e.quaternion,e.scale),e.matrixAutoUpdate=!1})}).then(()=>Promise.all([o.object.generateBvhTree(),t.renderer?initTextures(r.textures,t.renderer):null])).then(()=>(n.loadState=`READY`,n.loadStateUpdateTime=now(),n.loadfailRetryDelay=0,n.byteLength=o.byteLength,n.memoryUsage=o.memoryUsage,n.data=o,e)).catch(t=>(unloadTileContent(e),Promise.reject(t)))}).catch(e=>(n.loadState=`FAILED`,n.loadStateUpdateTime=now(),e instanceof NetworkResponseError&&e.httpStatus===0||e instanceof NetworkTimeoutError||e instanceof NetworkProxyError?n.loadfailRetryDelay=clamp$1(n.loadfailRetryDelay+RETRY_DELAY_STEP$1,RETRY_DELAY_STEP$1,MAX_RETRY_DELAY$1):n.loadfailRetryDelay=1/0,Promise.reject(e)))}throw Error(`Invalid Tile type: ${e.type}`)}function unloadTileContent(e){e.content&&(e.content.data&&e.content.data.object.dispose(),e.content.data=void 0,e.content.loadState=`UNLOADED`,e.content.loadStateUpdateTime=now(),e.content.byteLength=0,e.content.memoryUsage=0)}var MAX_RETRY_DELAY=5e3,RETRY_DELAY_STEP=1e3,TRAJECTOR_PIPE_SHADER={vertexShader:`
|
|
863
863
|
varying vec2 vUv;
|
|
864
864
|
uniform float displacementScalar;
|
|
@@ -2840,7 +2840,7 @@ void main() {
|
|
|
2840
2840
|
#include <premultiplied_alpha_fragment>
|
|
2841
2841
|
|
|
2842
2842
|
}
|
|
2843
|
-
`},LineMaterial=class extends three.ShaderMaterial{constructor(e){super({uniforms:three.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.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(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=class extends three.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new LineSegmentsGeometry:e,this.material=t===void 0?new LineMaterial({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),o=new three.Vector3,s=new three.Vector3;for(var c=0,l=0,u=t.count;c<u;c++,l+=2)o.fromBufferAttribute(t,c),s.fromBufferAttribute(n,c),r[l]=l===0?0:r[l-1],r[l+1]=r[l]+o.distanceTo(s);let d=new three.InstancedInterleavedBuffer(r,2,1);return e.setAttribute(`instanceDistanceStart`,new three.InterleavedBufferAttribute(d,1,0)),e.setAttribute(`instanceDistanceEnd`,new three.InterleavedBufferAttribute(d,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,o=r.projectionMatrix,s=this.geometry,c=this.material,l=c.resolution,u=c.linewidth,d=s.attributes.instanceStart,f=s.attributes.instanceEnd,p=new three.Vector4,m=new three.Vector4,h=new three.Vector4,g=new three.Vector3,_=new three.Matrix4,v=new three.Line3,y=new three.Vector3;n.at(1,h),h.w=1,h.applyMatrix4(r.matrixWorldInverse),h.applyMatrix4(o),h.multiplyScalar(1/h.w),h.x*=l.x/2,h.y*=l.y/2,h.z=0,g.copy(h);let b=this.matrixWorld;_.multiplyMatrices(r.matrixWorldInverse,b);for(var S=0,C=d.count;S<C;S++){p.fromBufferAttribute(d,S),m.fromBufferAttribute(f,S),p.w=1,m.w=1,p.applyMatrix4(_),m.applyMatrix4(_),p.applyMatrix4(o),m.applyMatrix4(o),p.multiplyScalar(1/p.w),m.multiplyScalar(1/m.w);var w=p.z<-1&&m.z<-1,T=p.z>1&&m.z>1;if(w||T)continue;p.x*=l.x/2,p.y*=l.y/2,m.x*=l.x/2,m.y*=l.y/2,v.start.copy(p),v.start.z=0,v.end.copy(m),v.end.z=0;let e=v.closestPointToPointParameter(g,!0);v.at(e,y);let r=three.MathUtils.lerp(p.z,m.z,e),s=r>=-1&&r<=1;var E=g.distanceTo(y)<u*.5;if(s&&E){v.start.fromBufferAttribute(d,S),v.end.fromBufferAttribute(f,S),v.start.applyMatrix4(b),v.end.applyMatrix4(b);var D=new three.Vector3,O=new three.Vector3;n.distanceSqToSegment(v.start,v.end,O,D),t.push({point:O,pointOnLine:D,distance:n.origin.distanceTo(O),object:this,faceIndex:S})}}}};Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=class extends LineSegments2{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=class extends LineSegmentsGeometry{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 three.Geometry){let e=new three.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof three.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}copy(){return this}};Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL=`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==`,DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=class extends three.Object3D{static get version(){return`6.9.0-alpha.2`}constructor(e=new three.Vector3,t=new three.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0;let n=new LineGeometry,r=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});this.line=new Line2(n,r);let o=new three.BufferGeometry,s=new three.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new three.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 three.Points(o,s),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 three.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 three.Vector3(e[0],e[1],e[2]),new three.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(FiveLine.prototype,{isFiveLine:!0});var Constants={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 fetchJsonFile(e){return __awaiter(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function fetchProfilesList(e){return __awaiter(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield fetchJsonFile(`${e}/profilesList.json`)})}function fetchProfile(e,t){return __awaiter(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 o=yield fetchProfilesList(t),s;if(e.profiles.some(e=>{let n=o[e];return n&&(s={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!s}),!s){if(!n)throw Error(`No matching profile name found`);let e=o[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);s={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let c=yield fetchJsonFile(s.profilePath),l;if(r){let t;if(t=c.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${s.profileId}`);t.assetPath&&(l=s.profilePath.replace(`profile.json`,t.assetPath))}return{profile:c,assetPath:l}})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let o=Math.atan2(t,e);n=Math.cos(o),r=Math.sin(o)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var VisualResponse=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:o,normalizedYAxis:s}=normalizeAxes(e,t);switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?o:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?s:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=+!!this.states.includes(r);break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Component=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 VisualResponse(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:Constants.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=Constants.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=Constants.ComponentState.PRESSED:(t.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.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===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.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===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},MotionController=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 Component(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)})}},DEFAULT_PROFILES_PATH=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,DEFAULT_PROFILE=`generic-trigger`,XRControllerModel=class extends three.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof three.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:o,valueNodeProperty:s}=e;t&&(s===Constants.VisualResponseProperty.VISIBILITY?t.visible=o:s===Constants.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,o),t.position.lerpVectors(n.position,r.position,o)))})}))}};function findNodes(e,t){Object.values(e.components).forEach(e=>{let{type:n,touchPointNodeName:r,visualResponses:o}=e;if(n===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(r),e.touchPointNode){let t=new three.Mesh(new three.SphereGeometry(.001),new three.MeshBasicMaterial({color:255}));e.touchPointNode.add(t)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(o).forEach(e=>{let{valueNodeName:n,minNodeName:r,maxNodeName:o,valueNodeProperty:s}=e;if(s===Constants.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(r),e.maxNode=t.getObjectByName(o),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${o} in the model`);return}}e.valueNode=t.getObjectByName(n),e.valueNode||console.warn(`Could not find ${n} in the model`)})})}function addAssetSceneToControllerModel(e,t){findNodes(e.motionController,t),e.envMap&&t.traverse(t=>{t instanceof three.Mesh&&t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)}),e.add(t)}var XRControllerModelFactory=class{constructor(e=null){this.gltfLoader=e,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}createControllerModel(e){let t=new XRControllerModel,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||fetchProfile(r,this.path,DEFAULT_PROFILE).then(({profile:e,assetPath:o})=>{t.motionController=new MotionController(r,e,o);let s=this._assetCache[t.motionController.assetUrl];if(s)n=s.scene.clone(),addAssetSceneToControllerModel(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(),addAssetSceneToControllerModel(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},defaultEffect=`fade`,defaultXRPanoramaControllerInitArgs=Object.assign({},omit(defaultPanoramaControllerCustomInitArgs,[`maxLatitude`,`minLatitude`]));function mapPanoResource(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 CONTROLLER_EVNET_DELTA_TIME=300,scratchRaycaster=new three.Raycaster,scratchVector3=new three.Vector3,XRPanoramaController=class e extends PanoramaController{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 XRManager(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,createEvent(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,createEvent(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new three.Raycaster,right:new three.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 FiveLine,right:new FiveLine},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new three.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new three.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new three.Group,new three.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 XRControllerModelFactory;r.gltfLoader={load(e,t){internalFetcher.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return parseGltf(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:internalFetcher})}).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=createUuid$1()]={panoId:panoStringify(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:defaultEffect,effectEasing:defaultEffectEase,fixCameraTransform:new three.Matrix4},this.parallaxCameraMatrixs=[];let o=AnimationFrameLoop.shared.getContext();if(!o){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(o),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,o,s;this.userAction=n,this.stopMomentumMovement();let c=panoStringify(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoIndex`);let u=getImageSizeFromURL(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)=>mapPanoResource(applyImageURLOptions(e,f,t)),m=Object.assign({key:`pano.${c}`},pick(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:`+jsonHash([h,m,f]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===g)return;{let t=this.pendingPanoTask.panoId;(r=this.panoMeshes.get(t))==null||r.setProgress(0),this.emit(`pano.texture.abort`,createEvent(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let _=`move-to-pano-`+c;this.pending.add(_);let v=createExtendableEvent(`pano.prepare`,{options:t,prevMode:this.mode,prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,v),v.defaultPrevented){this.pending.delete(_);return}v.options!==t&&Object.assign(t,v.options);let y=this.modelScene.parameter,b;y.pano0&&y.pano0.map.name===g?b=y.pano0:y.pano1&&y.pano1.map.name===g&&(b=y.pano1);let S=(o=t.effect)==null?defaultEffect:o,C=(s=t.effectEasing)==null?defaultEffectEase:s;if(b){let n={panoId:c,effect:S,effectEasing:C,leftPanoPicture:{panoId:b.panoId,map:b.map,mapHistogram:b.mapHistogram,mapSize:b.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new three.Matrix4};n.leftPanoPicture&&this.panoPictureObserverMap.set(n.leftPanoPicture,l),this.pendingPanoTask=void 0,Promise.resolve().then(()=>waitForExtendableEvent(v)).catch(e=>{let t=toError(e);return this.emit(`error`,t),t}).then(r=>{var o,s;if(!(r instanceof Error))this.pending.delete(_),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(c))==null||o.setProgress(0),this.doMoveToPano(e,n,t);else{let e=null;r instanceof Error&&(e||(e=r));let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose));this.emit(`pano.cancel`,createEvent(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.error`,createEvent(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(_),this.pendingPanoTask=void 0,(s=this.panoMeshes.get(c))==null||s.setProgress(0)}});return}let w=this.panoMeshes.get(c);w&&w.tap&&w.tap(),this.pendingPanoTask={panoId:c,hash:g,onLoad:n=>{var r;let o=n.body;if(this.destroyed)o.dispose();else{o.name=g;let n=Array.isArray(o.image)?o.image[0]:o.image,s=(r=n==null?void 0:n.width)==null?2048:r,u=new Histogram().formPixels(getRgbaDataFromCubeTexture(this.renderer,o,!0,sharedHistogramRgbaData).data),d={panoId:c,effect:S,effectEasing:C,leftPanoPicture:{panoId:c,map:o,mapSize:s,mapHistogram:new three.Vector4().fromArray(u.toArray()),matrix:l.matrix.clone(),zoom:1},position:l.position.clone(),fixCameraTransform:new three.Matrix4};d.leftPanoPicture&&this.panoPictureObserverMap.set(d.leftPanoPicture,l),this.doMoveToPano(e,d,t)}},onError:e=>{let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose));this.emit(`pano.cancel`,createEvent(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),this.emit(`pano.error`,createEvent(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e),t.moveCancelCallback&&t.moveCancelCallback()}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,createEvent(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(h,{imageURL:{transform:p,options:m},format:three.RGBFormat,viaAjax:!0,fetcher:getFetcher(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,createEvent(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===g&&((r=this.panoMeshes.get(c))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=toError(t);return this.emit(`pano.texture.error`,createEvent(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>waitForExtendableEvent(v)).catch(e=>toError(e))]).then(([t,n])=>{var r,o,s,l;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(_),((r=this.pendingPanoTask)==null?void 0:r.hash)===g?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(c))==null||o.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,createEvent(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}));else{let e=null;t instanceof Error?e||(e=t):t.body.dispose(),n instanceof Error&&(e||(e=n)),this.pending.delete(_),((s=this.pendingPanoTask)==null?void 0:s.hash)===g&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(l=this.panoMeshes.get(c))==null||l.setProgress(0))}})}doMoveToPano(e,t,n={}){var r,o,s,c,l,u,d,f,p,m;let h=now(),g=createUuid$1();this.panoResources[g]=t;let _=1,v,y,b;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,o=this.panoResourceFromLocationMotionKeyframe(n).position,s=t.position;v=Math.max(o.distanceTo(s),1),y=[{key:n.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:g,progress:1,value:{distance:0,count:1}}],b=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,o=this.panoResourceFromLocationMotionKeyframe(e).position,s=this.panoResourceFromLocationMotionKeyframe(n).position,c=t.position,l=n.value.count-r.count,u=Math.max(o.distanceTo(s),1)*l;v=u+Math.max(s.distanceTo(c),1),y=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:u/v,value:n.value},{key:g,progress:1,value:{count:n.value.count+1,distance:0}}];let d=this.locationMotionKeyframesLength(this.locationMotion.keyframes),f=this.locationMotionKeyframesLength(y);b=this.locationMotion.getProgressVelocity(h)*d/f}let S=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?v:0),C={longitude:n.longitude,latitude:n.latitude,fov:n.fov},w=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(r=C.longitude)==null?this.camera.pose.longitude:r,latitude:(o=C.latitude)==null?this.camera.pose.latitude:o,fov:(s=C.fov)==null?this.camera.pose.fov:s,offset:t.position.clone(),distance:0}),T=this.currentPano;if(this.emit(`pano.moveTo`,createEvent(`pano.moveTo`,{options:n,prevPano:T,pano:{panoIndex:w.panoIndex,workCode:w.workCode},progress:0,state:w,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(w),this.perspToOrthoMotion.set({perspToOrtho:0},S).catch(noop),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],S).catch(noop),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=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(C,S).catch(noop);else{let e=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=coordinatesToVector({longitude:(c=C.longitude)==null?this.cameraMotion.value.longitude:c,latitude:(l=C.latitude)==null?this.cameraMotion.value.latitude:l}),r=new three.Object3D;r.lookAt(e);let o=new three.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let s=new three.Matrix4().makeRotationFromQuaternion(r.quaternion),h=new three.Matrix4().getInverse(o).premultiply(s),g=this.cameraMotion.value.fov,_=(u=C.fov)==null?this.cameraMotion.value.fov:u,v=1;t.effect===`zoomin`?v=1.5:t.effect===`zoomout`&&(v=.4);let b=_*v;for(let e=0;e<y.length-1;e++){let t=y[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(h),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(b/2/180*Math.PI)/Math.tan(g/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:(d=C.longitude)==null?this.cameraMotion.value.longitude:d,latitude:(f=C.latitude)==null?this.cameraMotion.value.latitude:f,fov:b}},{progress:1,value:{longitude:(p=C.longitude)==null?this.cameraMotion.value.longitude:p,latitude:(m=C.latitude)==null?this.cameraMotion.value.latitude:m,fov:_}}],S).catch(noop)}this.locationMotion.setKeyframes(y,S,b).then(()=>{for(let e of this.modelScene.children)e instanceof Model&&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`,createEvent(`pano.arrived`,{options:n,prevPano:T,pano:{panoIndex:t.panoIndex,workCode:t.workCode},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=createUuid$1(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),canplayVideo().then(o=>{o&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=noop,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=noop,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose));this.emit(`pano.cancel`,createEvent(`pano.cancel`,{options:n,prevPano:T,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}checkSelectedPano(e){var t;this.stopMomentumMovement(),this.camera.getDirection(new three.Vector3).setY(0);let n=null,r=this.works.getObserver(this.currentPano);if(!r)return null;let o=r.work.observers,s=r.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let t=o[e];return!t||scratchVector3.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[c]=this.modelScene.intersectRaycaster(e);if(c){let[e,r]=arrayMin(s,e=>{let t=o[e];return t?scratchVector3.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(c.point):1/0},!0);typeof e==`number`&&r<this.panoTapTriggerRadius&&(n=(t=o[e])==null?null:t)}if(isNil(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=panoStringify({panoIndex:n.panoIndex,workCode:n.work.workCode});if(t.panoId===e){n=null;break}}}if(isNil(n))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!n.active){let e=panoStringify({panoIndex:n.panoIndex,workCode:n.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let l={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 three.Vector3};return this.emit(`pano.select`,createEvent(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.workCode},state:l,userAction:!0,options:{},progress:0,error:null})),n&&n.active?(this.emit(`pano.request`,createEvent(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.workCode},progress:0,state:l,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,o,s,c,l,u,d,f,p;this.userAction=!0;let m={},h={},g=this.camera.getDirection(new three.Vector3),_=this.locationMotion.keyframes[0],v=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[y,b]=this.locationMotion.getKeyFrameSegment(e),S=this.panoResourceFromLocationMotionKeyframe(y),C=this.panoResourceFromLocationMotionKeyframe(b),w=this.panoResourceFromLocationMotionKeyframe(_),T=this.panoResourceFromLocationMotionKeyframe(v),E=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),h.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),m.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-b.value.count+1,n=new three.Vector3().copy(S.position),s=new three.Vector3().copy(C.position);if(m.progress=t,t>=.01&&t<=.99&&(m.progress=clamp$1(C.effectEasing(t),.01,.99)),C.leftPanoPicture&&(t<1?S.leftPanoPicture&&(m.pano0=S.leftPanoPicture):m.pano0=C.leftPanoPicture,m.pano1=C.leftPanoPicture),C.effect===`montage`?m.transition=`BLACK`:C.effect===`spread`?m.transition=`SPREAD`:m.transition=`FADE`,C.effect===`zoomin`||C.effect===`zoomout`?m.progress=Math.pow(t,3):C.effect===`model`&&this.camera.pose.distance<.01&&(m.modelAlpha=1-Math.pow(clamp$1(Math.abs(t-.5)*2,0,1),4)),t<1&&C.effect!==`fly`){if(m.pano0&&S.leftPanoPicture){let e={panoId:m.pano0.panoId,map:m.pano0.map,mapHistogram:m.pano0.mapHistogram,mapSize:m.pano0.mapSize,zoom:m.pano0.zoom,matrix:S.leftPanoPicture.matrix.clone().setPosition(C.position)},t=this.panoPictureObserverMap.get(m.pano0);t&&this.panoPictureObserverMap.set(e,t),m.pano0=e}n.copy(s),E=!0}h.distance=this.locationMotion.value.distance,h.offset=new three.Vector3(n.x+(s.x-n.x)*t,n.y+(s.y-n.y)*t,n.z+(s.z-n.z)*t);let c=[],l=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(c.push(t),n>this.locationMotion.progress&&l.push(t))}for(let e of Object.keys(this.panoResources)){if(l.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((r=m.pano0)==null?void 0:r.map)||e===((o=m.pano1)==null?void 0:o.map))continue;e.dispose(),t.leftPanoPicture=null}}c.indexOf(e)>=0||delete this.panoResources[e]}let u=panoParse(C.panoId);u!==this.currentPano&&(this.currentPano=u,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,createEvent(`pano.moving`,{userAction:this.userAction,prevPano:panoParse(w.panoId),pano:panoParse(T.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},panoParse(T.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(h),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[D,O]=n,k=new three.Vector3(0,0,0),A=new three.Vector2().copy(this.camera.resolution);if(O&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let n=this.xrManager.cameraVR,r=this.xrManager.referenceSpace,o=this.xrManager.session.renderState.baseLayer,u=O.getViewerPose(r),d=(s=u==null?void 0:u.views)==null?[]:s;for(let e=0;e<d.length;e++){let t=d[e],r=n.cameras[e],s=o.getViewport(t);s&&(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,k.copy(r.position),r.viewport.set(s.x,s.y,s.width,s.height),A.set(s.width,s.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((c=h.distance)==null?this.camera.pose.distance:c),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=O.getPose(this.xrManager.session.inputSources[e].targetRaySpace,r);if(t){let e=t.transform.orientation,n=new three.Quaternion(e.x,e.y,e.z,e.w),r=new three.Vector3(0,0,-1).applyQuaternion(n),o=new three.Raycaster(this.camera.position,r);this.gazeRay=o}}}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],o=n[e];if(!o)continue;t&&t.update(o,O,r);let s=this.xrManager.getController(e),c=new three.Vector3(0,1.2,0),u=s.position.clone().add(k).sub(c);o.handedness===`left`?this.xrControllerRay.left.set(u,new three.Vector3(0,0,-1).applyEuler(s.rotation)):o.handedness===`right`&&this.xrControllerRay.right.set(u,new three.Vector3(0,0,-1).applyEuler(s.rotation)),this.controllerWrappers[e].position.copy(new three.Vector3(0,0,0).add(k).sub(c));let d=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(d.length===0){let e=this.works.getResolvedObserver(this.currentPano);d=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(d.length>=1&&d[0].face)if(o.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=d[0].face.normal,n=t.clone(),r=d[0].point.clone();this.intersectMesh.position.copy(r);let o=r.clone().add(n);if(this.intersectMesh.lookAt(o),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(u,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(u,d[0].point));let s=d[0],c=createEvent(`intersect.update`,{raycaster:(l=this.xrControllerRay.right)==null?null:l,intersection:s==null?null:s,object:this.intersectMesh});if(this.emit(`intersect.update`,c),c.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(u,d[0].point)}this.updateControllerHelper(n,e,t)}}else O||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);isEmptyObject(m)===!1&&this.modelScene.parameter.set(m),this.emit(`camera.update`,createEvent(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));let j=this.works.getResolvedObserver(this.currentPano),M=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,N=this.works.getObserver(S.panoId),P=this.works.getObserver(C.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&j){let e=[],t=j.work.observers;for(let n of j.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(j.standingPosition),n.set(e,r));let o=n.get(e);return o===void 0&&(o=t.standingPosition.distanceTo(j.standingPosition),n.set(t,o)),r-o}),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=.05,o=.005,s=t.standingPosition.clone().applyMatrix4(t.work.transform),c=panoStringify({panoIndex:t.panoIndex,workCode:t.work.workCode}),l=adjustPanoCircleMeshVectors.map(t=>{scratchRaycaster.ray.origin.copy(s),scratchRaycaster.ray.origin.add(scratchVector3.copy(t).setY(e)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;let[r]=n.intersectRaycaster(scratchRaycaster);return r&&r.distance-o<=e?new three.Vector3().copy(s).setY(r.point.y+o):s});l.sort((e,t)=>t.y-e.y);let u=l[Math.floor(l.length/2)],[d]=l.filter(e=>e.distanceTo(u)<=.05);if(d){let e=new three.Vector4(s.x,s.y,s.z,d.y-s.y),t=this.adjustPanoCircleMeshPositionFix.get(c);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(c,e)}}this.accessibleObserverFloorCheckCount++}}let F=new Map;if(N)for(let e of N.accessibleNodes){let t=N.work.observers[e];if(t){let e=panoStringify({panoIndex:t.panoIndex,workCode:t.work.workCode});F.set(e,t)}}if(P)for(let e of P.accessibleNodes){let t=P.work.observers[e];if(t){let e=panoStringify({panoIndex:t.panoIndex,workCode:t.work.workCode});F.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{F.get(t)?F.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),F.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),F.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&&(scratchVector3.set(t.x,t.y,t.z),scratchVector3.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let o=this.camera.position.clone().setY(e.position.y),s=new three.Vector3().copy(e.position).sub(o).normalize();if(t===panoStringify(this.currentPano)){let t=clamp$1((.5-o.distanceTo(e.position))/.5,0,1);s.multiplyScalar(1-t).add(g.clone().multiplyScalar(t))}if(s.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(s.x,s.z);e.quaternion.setFromEuler(new three.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||E)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(j){let n=j.work.observers,[,r]=arrayMin(j.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:j.standingPosition.distanceTo(t.standingPosition)},!0);r=clamp$1(r,2.5,1/0);let o=j.accessibleNodes.concat(j.panoIndex).map(e=>panoStringify({panoIndex:e,workCode:j.work.workCode}));this.panoMeshes.forEach((n,s)=>{let c=this.works.getObserver(s),l=!1,u=1;if(o.indexOf(s)===-1)l=!1,u=0;else if(!c)l=!1,u=0;else if(!c.loadable&&!c.active)l=!1,u=0;else{let e=n.position.clone().project(this.camera);l=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&M!==null&&panoStringify({panoIndex:M.panoIndex,workCode:M.work.workCode})===s;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);u=t<.01?0:clamp$1(r/t,.1,.85)}c&&c===P&&c.position.distanceTo(c.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(u=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(u=0),n.setCurrent(l),n.setOpacity(u),n.updateTime&&n.updateTime(e,t)})}{let e=(u=this.modelScene.parameter.progress)==null?1:u,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,o=t===0?n:r,s;if(o&&(s=this.works.getObserver(o.panoId),s||(s=this.panoPictureObserverMap.get(o))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!s||!o||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:A,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new three.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=getImageSizeLevel(o.mapSize)+1,c=4;this.tiling.setObserver(s);let l={renderer:this.renderer,resolution:A,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:o.map,panoMatrix:o.matrix,panoZoom:o.zoom,minLevel:e,level:4},u=this.tiling.update(l),f={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:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)==null?0:d)-.5)*2)},p=this.modelScene.parameter.refinedScreen;(u||f.pano!==(p==null?void 0:p.pano)||f.opacity!==(p==null?void 0:p.opacity))&&this.modelScene.parameter.set(`refinedScreen`,f)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&j&&j.position.y-j.standingPosition.y>10){let e=clamp$1(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=C.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)==null?void 0:f.panoId)!==t.panoId||((p=this.modelScene.parameter.pano1Depth)==null?void 0:p.panoId)!==n.panoId){let e=500,r=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new three.WebGLCubeRenderTarget(512,{minFilter:three.NearestFilter,magFilter:three.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new three.WebGLCubeRenderTarget(512,{minFilter:three.NearestFilter,magFilter:three.NearestFilter,generateMipmaps:!1});let o=new three.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);o.matrix.copy(t.matrix),o.matrixWorld.copy(o.matrix),o.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,o,500);let s=new three.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);s.matrix.copy(n.matrix),s.matrixWorld.copy(s.matrix),s.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,s,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,o=this.xrControllerRay.right;if(!e||e.length===0)return;let s={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let c=0;c<e.length;c++){let l=e[c].handedness,u=e[c].gamepad;switch(l){case`left`:u.axes&&(this.emitHandleEvent(u.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(u.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(u.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(u.axes[3]===1,`LeftAxesDown`,t)),u!=null&&u.buttons&&(u.buttons[4]&&this.emitHandleEvent(u.buttons[4].pressed,`X`,t),u.buttons[5]&&this.emitHandleEvent(u.buttons[5].pressed,`Y`,t),u.buttons[0]&&this.emitHandleEvent(u.buttons[0].pressed,`LeftTrigger`,t),u.buttons[1]&&this.emitHandleEvent(u.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:u.axes&&u.axes[3]<0?Math.abs(u.axes[3]):0,down:u.axes&&u.axes[3]<0?0:Math.abs(u.axes[3]),left:u.axes&&u.axes[2]<0?Math.abs(u.axes[2]):0,right:u.axes&&u.axes[2]<0?0:Math.abs(u.axes[2])},deltaTime:n};s.buttons.X=u.buttons&&u.buttons[4]?u.buttons[4].pressed:!1,s.buttons.Y=u.buttons&&u.buttons[5]?u==null?void 0:u.buttons[5].pressed:!1,s.buttons.LeftTrigger=u.buttons&&u.buttons[0]?u==null?void 0:u.buttons[0].pressed:!1,s.buttons.LeftPinch=u.buttons&&u.buttons[1]?u==null?void 0:u.buttons[1].pressed:!1,s.left=e;break;case`right`:u.axes&&(this.emitHandleEvent(u.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(u.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(u.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(u.axes[3]===1,`RightAxesDown`,t)),u.buttons&&(u.buttons[4]&&this.emitHandleEvent(u.buttons[4].pressed,`A`,t),u.buttons[5]&&this.emitHandleEvent(u.buttons[5].pressed,`B`,t),u.buttons[0]&&this.emitHandleEvent(u.buttons[0].pressed,`RightTrigger`,t),u.buttons[1]&&this.emitHandleEvent(u.buttons[1].pressed,`RightPinch`,t)),s.right={raycaster:o,axes:{up:u.axes&&u.axes[3]<0?Math.abs(u.axes[3]):0,down:u.axes&&u.axes[3]<0?0:Math.abs(u.axes[3]),left:u.axes&&u.axes[2]<0?Math.abs(u.axes[2]):0,right:u.axes&&u.axes[2]<0?0:Math.abs(u.axes[2])},deltaTime:n},s.buttons.A=u.buttons&&u.buttons[4]?u==null?void 0:u.buttons[4].pressed:!1,s.buttons.B=u.buttons&&u.buttons[5]?u==null?void 0:u.buttons[5].pressed:!1,s.buttons.RightTrigger=u.buttons&&u.buttons[0]?u==null?void 0:u.buttons[0].pressed:!1,s.buttons.RightPinch=u.buttons&&u.buttons[1]?u==null?void 0:u.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,createEvent(`xr.controller.update`,s))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,o=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`,createEvent(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:o}}}))):n-this.xrHandleState[t].touchStartTime>CONTROLLER_EVNET_DELTA_TIME&&this.emit(`xr.gesture.press`,createEvent(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:o}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,createEvent(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:o}}})),n-this.xrHandleState[t].touchStartTime<=CONTROLLER_EVNET_DELTA_TIME){let e=createEvent(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:o}}});!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)})}},Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},controllersDefaultInitArgs={Floorplan:defaultFloorplanControllerCustomInitArgs,Topview:defaultTopviewControllerCustomInitArgs,Panorama:defaultPanoramaControllerCustomInitArgs,VRPanorama:defaultVRPanoramaControllerCustomInitArgs,Model:defaultModelControllerCustomInitArgs,Mapview:defaultMapviewControllerCustomInitArgs,XRPanorama:defaultXRPanoramaControllerInitArgs},PROXY_CONTROLLER_EVENT_NAMES=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.fire,initAnimation.start,initAnimation.end,camera.update,intersect.update,pano.select,pano.moveTo,pano.moving,pano.arrived,pano.cancel,pano.error,pano.prepare,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 initLegacyEvent(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=coordinatesToVector(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 generateDefaultVideoElement(){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 initLights(){let e=new three.Group;e.name=`internalLights`;{let t=new three.DirectionalLight(16777215,.1);t.name=`direction0`,t.position.copy(new three.Vector3(0,1,0)),e.add(t)}{let t=new three.DirectionalLight(16777215,.1);t.name=`direction1`,t.position.copy(new three.Vector3(-1,-1,-1)),e.add(t)}{let t=new three.DirectionalLight(16777215,.3);t.name=`direction2`,t.position.copy(new three.Vector3(1,1,1)),e.add(t)}{let t=new three.AmbientLight(16777215,.6);t.name=`ambient0`,e.add(t)}return e}function parseKeyValue(e){var t,n;let r={},o=e.split(/(\;|\,)/);for(let e of o){let o=e.split(`=`),s=(t=o[0])==null?void 0:t.trim(),c=(n=o[1])==null?void 0:n.trim();s&&c&&(r[s]=c)}return r}function getViewportScale(){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=parseKeyValue((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var realsee_png_data_url_default=`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==`,imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new three.BufferGeometry;geometry.setAttribute(`position`,new three.BufferAttribute(vertices,3)),geometry.setAttribute(`uv`,new three.BufferAttribute(uvs,2)),geometry.setIndex(new three.BufferAttribute(index,1));var material=new three.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new three.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new three.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new three.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new three.Vector4,prevScissor=new three.Vector4;function renderPoweredByRealsee(e){if(material.map){let t=e.getViewport(prevViewport),n=e.getScissor(prevScissor),r=e.getScissorTest(),o=e.autoClear,s=n.x+imageOffset[0]/3,c=n.y+imageOffset[1]/3,l=imageSize[0]/3,u=imageSize[1]/3;e.setViewport(s,c,l,u),e.setScissor(s,c,l,u),e.setScissorTest(!0),e.autoClear=!1,e.render(scene,camera),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=o}else{let e=new three.Texture,t=new Image;t.onload=()=>{e.image=t,e.wrapS=three.ClampToEdgeWrapping,e.wrapT=three.ClampToEdgeWrapping,e.minFilter=three.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,material.needsUpdate=!0,t.onload=noop},t.src=realsee_png_data_url_default,material.map=e}}var OrderTexture=class{constructor(e=2048){this._count=0,this.width=e,this.height=1,this.data=new Uint32Array(this.width*this.height),this.texture=this.createTexture(this.data,this.width,this.height)}get count(){return this._count}createTexture(e,t,n){let r=new three.DataTexture(e,t,n,three.RedIntegerFormat,three.UnsignedIntType);return r.internalFormat=`R32UI`,r.minFilter=three.NearestFilter,r.magFilter=three.NearestFilter,r.generateMipmaps=!1,r.needsUpdate=!0,r}update(e){let t=e.length,n=Math.max(1,Math.ceil(t/this.width));n>this.height&&(this.height=n,this.data=new Uint32Array(this.width*this.height),this.texture.dispose(),this.texture=this.createTexture(this.data,this.width,this.height)),this.data.set(e,0),this._count=t,this.texture.needsUpdate=!0}dispose(){this.texture.dispose()}},TEXELS_PER_SPLAT$1=2,UINT32_PER_SPLAT=8,TileTexture=class{constructor(e){let t=e.numPoints,n=e.packedData;if(!n||n.length<t*UINT32_PER_SPLAT)throw Error(`[TileTexture] object 缺少足量 packedData`);let r=t*TEXELS_PER_SPLAT$1,o=Math.max(1,Math.min(2048,r)),s=Math.max(1,Math.ceil(r/o)),c=new Uint32Array(o*s*4);c.set(n.subarray(0,t*UINT32_PER_SPLAT),0);let l=new three.DataTexture(c,o,s,three.RGBAIntegerFormat,three.UnsignedIntType);l.internalFormat=`RGBA32UI`,l.minFilter=three.NearestFilter,l.magFilter=three.NearestFilter,l.generateMipmaps=!1,l.needsUpdate=!0,this.texture=l,this.count=t,this.width=o,this.height=s}dispose(){this.texture.dispose()}},TEXELS_PER_SPLAT=2,SplatAssembler=class e{constructor(t=2048){this.target=null,this.targetHeight=0,this.regionMap=new Map,this.regionList=[],this.width=t,this.material=new three.RawShaderMaterial({vertexShader:e.VERTEX,fragmentShader:e.FRAGMENT,uniforms:{u_tileTex:{value:null},u_tileWidth:{value:1},u_bigWidth:{value:t},u_startTexel:{value:0},u_count:{value:0},u_transformIndex:{value:0},u_layerIndex:{value:0}},depthTest:!1,depthWrite:!1}),this.scene=new three.Scene,this.mesh=new three.Mesh(new three.PlaneGeometry(2,2),this.material),this.mesh.frustumCulled=!1,this.scene.add(this.mesh),this.camera=new three.Camera}get texture(){return this.target?this.target.texture:null}get totalPoints(){let e=0;for(let t of this.regionList)e+=t.count;return e}get regions(){return this.regionList}has(e){return this.regionMap.has(e)}add(e,t,n,r){if(this.regionMap.has(e))return;let o={object:e,tile:t,start:0,count:t.count,transformIndex:n,layerIndex:r};this.regionMap.set(e,o),this.regionList.push(o)}sync(e,t){let n=new Set(e);for(let e of Array.from(this.regionMap.keys()))n.has(e)||(this.regionMap.get(e).tile.dispose(),this.regionMap.delete(e));let r=[];for(let n of e){let e=this.regionMap.get(n),{transformIndex:o,layerIndex:s}=t(n);e?(e.transformIndex=o,e.layerIndex=s):(e={object:n,tile:new TileTexture(n),start:0,count:n.numPoints,transformIndex:o,layerIndex:s},this.regionMap.set(n,e)),r.push(e)}this.regionList=r}remove(e){let t=this.regionMap.get(e);if(!t)return;t.tile.dispose(),this.regionMap.delete(e);let n=this.regionList.indexOf(t);n>=0&&this.regionList.splice(n,1)}clear(){for(let e of this.regionList)e.tile.dispose();this.regionMap.clear(),this.regionList=[]}assemble(e){let t=0;for(let e of this.regionList)e.start=t,t+=e.count;let n=Math.max(1,Math.ceil(t*TEXELS_PER_SPLAT/this.width));(!this.target||n>this.targetHeight)&&(this.target&&this.target.dispose(),this.targetHeight=n,this.target=new three.WebGLRenderTarget(this.width,n,{format:three.RGBAIntegerFormat,type:three.UnsignedIntType,minFilter:three.NearestFilter,magFilter:three.NearestFilter,depthBuffer:!1,stencilBuffer:!1}),this.target.texture.internalFormat=`RGBA32UI`,this.target.texture.generateMipmaps=!1);let r=e.getRenderTarget(),o=e.autoClear,s=e.getScissorTest(),c=e.getScissor(new three.Vector4),l=e.getPixelRatio()||1;e.autoClear=!1,e.setRenderTarget(this.target),e.setScissorTest(!0);for(let t of this.regionList){let n=t.start*TEXELS_PER_SPLAT,r=(t.start+t.count)*TEXELS_PER_SPLAT,o=Math.floor(n/this.width),s=Math.ceil(r/this.width),c=Math.max(0,Math.floor(o/l)-1),u=Math.ceil(s/l)+1,d=Math.ceil(this.width/l)+1;e.setScissor(0,c,d,u-c);let f=this.material.uniforms;f.u_tileTex.value=t.tile.texture,f.u_tileWidth.value=t.tile.width,f.u_bigWidth.value=this.width,f.u_startTexel.value=n,f.u_count.value=t.count,f.u_transformIndex.value=t.transformIndex,f.u_layerIndex.value=t.layerIndex,this.material.uniformsNeedUpdate=!0,e.render(this.scene,this.camera)}e.setScissorTest(s),e.setScissor(c),e.setRenderTarget(r),e.autoClear=o}snapshot(){return this.regionList.map(e=>Object.assign({},e))}extractSortInputs(){let e=this.totalPoints,t=new Float32Array(e*3),n=new Uint32Array(e);for(let e of this.regionList){let r=e.object.packedData;if(!r)continue;let o=new Float32Array(r.buffer,r.byteOffset,r.length),s=e.transformIndex;for(let r=0;r<e.count;r++){let c=e.start+r;t[c*3+0]=o[r*8+0],t[c*3+1]=o[r*8+1],t[c*3+2]=o[r*8+2],n[c]=s}}return{positions:t,transformIndices:n,count:e}}readback(e){if(!this.target)return new Uint32Array;let t=this.width,n=this.targetHeight,r=new Uint32Array(t*n*4),o=e.getRenderTarget();e.setRenderTarget(this.target);let s=e.getContext();return s.readPixels(0,0,t,n,s.RGBA_INTEGER,s.UNSIGNED_INT,r),e.setRenderTarget(o),r}dispose(){this.clear(),this.target&&(this.target.dispose(),this.target=null),this.mesh.geometry.dispose(),this.material.dispose()}};SplatAssembler.VERTEX=`#version 300 es
|
|
2843
|
+
`},LineMaterial=class extends three.ShaderMaterial{constructor(e){super({uniforms:three.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.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(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=class extends three.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new LineSegmentsGeometry:e,this.material=t===void 0?new LineMaterial({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),o=new three.Vector3,s=new three.Vector3;for(var c=0,l=0,u=t.count;c<u;c++,l+=2)o.fromBufferAttribute(t,c),s.fromBufferAttribute(n,c),r[l]=l===0?0:r[l-1],r[l+1]=r[l]+o.distanceTo(s);let d=new three.InstancedInterleavedBuffer(r,2,1);return e.setAttribute(`instanceDistanceStart`,new three.InterleavedBufferAttribute(d,1,0)),e.setAttribute(`instanceDistanceEnd`,new three.InterleavedBufferAttribute(d,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,o=r.projectionMatrix,s=this.geometry,c=this.material,l=c.resolution,u=c.linewidth,d=s.attributes.instanceStart,f=s.attributes.instanceEnd,p=new three.Vector4,m=new three.Vector4,h=new three.Vector4,g=new three.Vector3,_=new three.Matrix4,v=new three.Line3,y=new three.Vector3;n.at(1,h),h.w=1,h.applyMatrix4(r.matrixWorldInverse),h.applyMatrix4(o),h.multiplyScalar(1/h.w),h.x*=l.x/2,h.y*=l.y/2,h.z=0,g.copy(h);let b=this.matrixWorld;_.multiplyMatrices(r.matrixWorldInverse,b);for(var S=0,C=d.count;S<C;S++){p.fromBufferAttribute(d,S),m.fromBufferAttribute(f,S),p.w=1,m.w=1,p.applyMatrix4(_),m.applyMatrix4(_),p.applyMatrix4(o),m.applyMatrix4(o),p.multiplyScalar(1/p.w),m.multiplyScalar(1/m.w);var w=p.z<-1&&m.z<-1,T=p.z>1&&m.z>1;if(w||T)continue;p.x*=l.x/2,p.y*=l.y/2,m.x*=l.x/2,m.y*=l.y/2,v.start.copy(p),v.start.z=0,v.end.copy(m),v.end.z=0;let e=v.closestPointToPointParameter(g,!0);v.at(e,y);let r=three.MathUtils.lerp(p.z,m.z,e),s=r>=-1&&r<=1;var E=g.distanceTo(y)<u*.5;if(s&&E){v.start.fromBufferAttribute(d,S),v.end.fromBufferAttribute(f,S),v.start.applyMatrix4(b),v.end.applyMatrix4(b);var D=new three.Vector3,O=new three.Vector3;n.distanceSqToSegment(v.start,v.end,O,D),t.push({point:O,pointOnLine:D,distance:n.origin.distanceTo(O),object:this,faceIndex:S})}}}};Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=class extends LineSegments2{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=class extends LineSegmentsGeometry{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 three.Geometry){let e=new three.BufferGeometry().fromGeometry(t);this.setPositions(e.attributes.position.array)}else t instanceof three.BufferGeometry&&this.setPositions(t.attributes.position.array);return this}copy(){return this}};Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL=`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==`,DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=class extends three.Object3D{static get version(){return`6.9.0-alpha.3`}constructor(e=new three.Vector3,t=new three.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0;let n=new LineGeometry,r=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});this.line=new Line2(n,r);let o=new three.BufferGeometry,s=new three.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=new three.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 three.Points(o,s),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 three.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 three.Vector3(e[0],e[1],e[2]),new three.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(FiveLine.prototype,{isFiveLine:!0});var Constants={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 fetchJsonFile(e){return __awaiter(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function fetchProfilesList(e){return __awaiter(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield fetchJsonFile(`${e}/profilesList.json`)})}function fetchProfile(e,t){return __awaiter(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 o=yield fetchProfilesList(t),s;if(e.profiles.some(e=>{let n=o[e];return n&&(s={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!s}),!s){if(!n)throw Error(`No matching profile name found`);let e=o[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);s={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let c=yield fetchJsonFile(s.profilePath),l;if(r){let t;if(t=c.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${s.profileId}`);t.assetPath&&(l=s.profilePath.replace(`profile.json`,t.assetPath))}return{profile:c,assetPath:l}})}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let o=Math.atan2(t,e);n=Math.cos(o),r=Math.sin(o)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var VisualResponse=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:o,normalizedYAxis:s}=normalizeAxes(e,t);switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?o:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?s:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=+!!this.states.includes(r);break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Component=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 VisualResponse(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:Constants.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=Constants.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=Constants.ComponentState.PRESSED:(t.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.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===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.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===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},MotionController=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 Component(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)})}},DEFAULT_PROFILES_PATH=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,DEFAULT_PROFILE=`generic-trigger`,XRControllerModel=class extends three.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof three.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:o,valueNodeProperty:s}=e;t&&(s===Constants.VisualResponseProperty.VISIBILITY?t.visible=o:s===Constants.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,o),t.position.lerpVectors(n.position,r.position,o)))})}))}};function findNodes(e,t){Object.values(e.components).forEach(e=>{let{type:n,touchPointNodeName:r,visualResponses:o}=e;if(n===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(r),e.touchPointNode){let t=new three.Mesh(new three.SphereGeometry(.001),new three.MeshBasicMaterial({color:255}));e.touchPointNode.add(t)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(o).forEach(e=>{let{valueNodeName:n,minNodeName:r,maxNodeName:o,valueNodeProperty:s}=e;if(s===Constants.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(r),e.maxNode=t.getObjectByName(o),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${o} in the model`);return}}e.valueNode=t.getObjectByName(n),e.valueNode||console.warn(`Could not find ${n} in the model`)})})}function addAssetSceneToControllerModel(e,t){findNodes(e.motionController,t),e.envMap&&t.traverse(t=>{t instanceof three.Mesh&&t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)}),e.add(t)}var XRControllerModelFactory=class{constructor(e=null){this.gltfLoader=e,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}createControllerModel(e){let t=new XRControllerModel,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||fetchProfile(r,this.path,DEFAULT_PROFILE).then(({profile:e,assetPath:o})=>{t.motionController=new MotionController(r,e,o);let s=this._assetCache[t.motionController.assetUrl];if(s)n=s.scene.clone(),addAssetSceneToControllerModel(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(),addAssetSceneToControllerModel(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},defaultEffect=`fade`,defaultXRPanoramaControllerInitArgs=Object.assign({},omit(defaultPanoramaControllerCustomInitArgs,[`maxLatitude`,`minLatitude`]));function mapPanoResource(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 CONTROLLER_EVNET_DELTA_TIME=300,scratchRaycaster=new three.Raycaster,scratchVector3=new three.Vector3,XRPanoramaController=class e extends PanoramaController{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 XRManager(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,createEvent(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,createEvent(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new three.Raycaster,right:new three.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 FiveLine,right:new FiveLine},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new three.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new three.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new three.Group,new three.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 XRControllerModelFactory;r.gltfLoader={load(e,t){internalFetcher.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return parseGltf(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:internalFetcher})}).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=createUuid$1()]={panoId:panoStringify(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:defaultEffect,effectEasing:defaultEffectEase,fixCameraTransform:new three.Matrix4},this.parallaxCameraMatrixs=[];let o=AnimationFrameLoop.shared.getContext();if(!o){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(o),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,o,s;this.userAction=n,this.stopMomentumMovement();let c=panoStringify(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoIndex`);let u=getImageSizeFromURL(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)=>mapPanoResource(applyImageURLOptions(e,f,t)),m=Object.assign({key:`pano.${c}`},pick(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:`+jsonHash([h,m,f]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===g)return;{let t=this.pendingPanoTask.panoId;(r=this.panoMeshes.get(t))==null||r.setProgress(0),this.emit(`pano.texture.abort`,createEvent(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let _=`move-to-pano-`+c;this.pending.add(_);let v=createExtendableEvent(`pano.prepare`,{options:t,prevMode:this.mode,prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,v),v.defaultPrevented){this.pending.delete(_);return}v.options!==t&&Object.assign(t,v.options);let y=this.modelScene.parameter,b;y.pano0&&y.pano0.map.name===g?b=y.pano0:y.pano1&&y.pano1.map.name===g&&(b=y.pano1);let S=(o=t.effect)==null?defaultEffect:o,C=(s=t.effectEasing)==null?defaultEffectEase:s;if(b){let n={panoId:c,effect:S,effectEasing:C,leftPanoPicture:{panoId:b.panoId,map:b.map,mapHistogram:b.mapHistogram,mapSize:b.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new three.Matrix4};n.leftPanoPicture&&this.panoPictureObserverMap.set(n.leftPanoPicture,l),this.pendingPanoTask=void 0,Promise.resolve().then(()=>waitForExtendableEvent(v)).catch(e=>{let t=toError(e);return this.emit(`error`,t),t}).then(r=>{var o,s;if(!(r instanceof Error))this.pending.delete(_),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(c))==null||o.setProgress(0),this.doMoveToPano(e,n,t);else{let e=null;r instanceof Error&&(e||(e=r));let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose));this.emit(`pano.cancel`,createEvent(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.error`,createEvent(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(_),this.pendingPanoTask=void 0,(s=this.panoMeshes.get(c))==null||s.setProgress(0)}});return}let w=this.panoMeshes.get(c);w&&w.tap&&w.tap(),this.pendingPanoTask={panoId:c,hash:g,onLoad:n=>{var r;let o=n.body;if(this.destroyed)o.dispose();else{o.name=g;let n=Array.isArray(o.image)?o.image[0]:o.image,s=(r=n==null?void 0:n.width)==null?2048:r,u=new Histogram().formPixels(getRgbaDataFromCubeTexture(this.renderer,o,!0,sharedHistogramRgbaData).data),d={panoId:c,effect:S,effectEasing:C,leftPanoPicture:{panoId:c,map:o,mapSize:s,mapHistogram:new three.Vector4().fromArray(u.toArray()),matrix:l.matrix.clone(),zoom:1},position:l.position.clone(),fixCameraTransform:new three.Matrix4};d.leftPanoPicture&&this.panoPictureObserverMap.set(d.leftPanoPicture,l),this.doMoveToPano(e,d,t)}},onError:e=>{let n=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose));this.emit(`pano.cancel`,createEvent(`pano.cancel`,{error:null,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),this.emit(`pano.error`,createEvent(`pano.error`,{error:e,userAction:this.userAction,options:t,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode},progress:0,state:n})),e instanceof Error&&e.message&&this.emit(`error`,e),t.moveCancelCallback&&t.moveCancelCallback()}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,createEvent(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(h,{imageURL:{transform:p,options:m},format:three.RGBFormat,viaAjax:!0,fetcher:getFetcher(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,createEvent(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===g&&((r=this.panoMeshes.get(c))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=toError(t);return this.emit(`pano.texture.error`,createEvent(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>waitForExtendableEvent(v)).catch(e=>toError(e))]).then(([t,n])=>{var r,o,s,l;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(_),((r=this.pendingPanoTask)==null?void 0:r.hash)===g?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(c))==null||o.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,createEvent(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}));else{let e=null;t instanceof Error?e||(e=t):t.body.dispose(),n instanceof Error&&(e||(e=n)),this.pending.delete(_),((s=this.pendingPanoTask)==null?void 0:s.hash)===g&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(l=this.panoMeshes.get(c))==null||l.setProgress(0))}})}doMoveToPano(e,t,n={}){var r,o,s,c,l,u,d,f,p,m;let h=now(),g=createUuid$1();this.panoResources[g]=t;let _=1,v,y,b;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,o=this.panoResourceFromLocationMotionKeyframe(n).position,s=t.position;v=Math.max(o.distanceTo(s),1),y=[{key:n.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:g,progress:1,value:{distance:0,count:1}}],b=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,o=this.panoResourceFromLocationMotionKeyframe(e).position,s=this.panoResourceFromLocationMotionKeyframe(n).position,c=t.position,l=n.value.count-r.count,u=Math.max(o.distanceTo(s),1)*l;v=u+Math.max(s.distanceTo(c),1),y=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:u/v,value:n.value},{key:g,progress:1,value:{count:n.value.count+1,distance:0}}];let d=this.locationMotionKeyframesLength(this.locationMotion.keyframes),f=this.locationMotionKeyframesLength(y);b=this.locationMotion.getProgressVelocity(h)*d/f}let S=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?v:0),C={longitude:n.longitude,latitude:n.latitude,fov:n.fov},w=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(r=C.longitude)==null?this.camera.pose.longitude:r,latitude:(o=C.latitude)==null?this.camera.pose.latitude:o,fov:(s=C.fov)==null?this.camera.pose.fov:s,offset:t.position.clone(),distance:0}),T=this.currentPano;if(this.emit(`pano.moveTo`,createEvent(`pano.moveTo`,{options:n,prevPano:T,pano:{panoIndex:w.panoIndex,workCode:w.workCode},progress:0,state:w,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(w),this.perspToOrthoMotion.set({perspToOrtho:0},S).catch(noop),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],S).catch(noop),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=noop,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(C,S).catch(noop);else{let e=coordinatesToVector({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=coordinatesToVector({longitude:(c=C.longitude)==null?this.cameraMotion.value.longitude:c,latitude:(l=C.latitude)==null?this.cameraMotion.value.latitude:l}),r=new three.Object3D;r.lookAt(e);let o=new three.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let s=new three.Matrix4().makeRotationFromQuaternion(r.quaternion),h=new three.Matrix4().getInverse(o).premultiply(s),g=this.cameraMotion.value.fov,_=(u=C.fov)==null?this.cameraMotion.value.fov:u,v=1;t.effect===`zoomin`?v=1.5:t.effect===`zoomout`&&(v=.4);let b=_*v;for(let e=0;e<y.length-1;e++){let t=y[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(h),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(b/2/180*Math.PI)/Math.tan(g/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:(d=C.longitude)==null?this.cameraMotion.value.longitude:d,latitude:(f=C.latitude)==null?this.cameraMotion.value.latitude:f,fov:b}},{progress:1,value:{longitude:(p=C.longitude)==null?this.cameraMotion.value.longitude:p,latitude:(m=C.latitude)==null?this.cameraMotion.value.latitude:m,fov:_}}],S).catch(noop)}this.locationMotion.setKeyframes(y,S,b).then(()=>{for(let e of this.modelScene.children)e instanceof Model&&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`,createEvent(`pano.arrived`,{options:n,prevPano:T,pano:{panoIndex:t.panoIndex,workCode:t.workCode},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=createUuid$1(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),canplayVideo().then(o=>{o&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=noop,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=noop,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose));this.emit(`pano.cancel`,createEvent(`pano.cancel`,{options:n,prevPano:T,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}checkSelectedPano(e){var t;this.stopMomentumMovement(),this.camera.getDirection(new three.Vector3).setY(0);let n=null,r=this.works.getObserver(this.currentPano);if(!r)return null;let o=r.work.observers,s=r.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let t=o[e];return!t||scratchVector3.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[c]=this.modelScene.intersectRaycaster(e);if(c){let[e,r]=arrayMin(s,e=>{let t=o[e];return t?scratchVector3.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(c.point):1/0},!0);typeof e==`number`&&r<this.panoTapTriggerRadius&&(n=(t=o[e])==null?null:t)}if(isNil(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=panoStringify({panoIndex:n.panoIndex,workCode:n.work.workCode});if(t.panoId===e){n=null;break}}}if(isNil(n))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!n.active){let e=panoStringify({panoIndex:n.panoIndex,workCode:n.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let l={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 three.Vector3};return this.emit(`pano.select`,createEvent(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.workCode},state:l,userAction:!0,options:{},progress:0,error:null})),n&&n.active?(this.emit(`pano.request`,createEvent(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:l.panoIndex,workCode:l.workCode},progress:0,state:l,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,o,s,c,l,u,d,f,p;this.userAction=!0;let m={},h={},g=this.camera.getDirection(new three.Vector3),_=this.locationMotion.keyframes[0],v=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[y,b]=this.locationMotion.getKeyFrameSegment(e),S=this.panoResourceFromLocationMotionKeyframe(y),C=this.panoResourceFromLocationMotionKeyframe(b),w=this.panoResourceFromLocationMotionKeyframe(_),T=this.panoResourceFromLocationMotionKeyframe(v),E=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),h.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),m.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp$1(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-b.value.count+1,n=new three.Vector3().copy(S.position),s=new three.Vector3().copy(C.position);if(m.progress=t,t>=.01&&t<=.99&&(m.progress=clamp$1(C.effectEasing(t),.01,.99)),C.leftPanoPicture&&(t<1?S.leftPanoPicture&&(m.pano0=S.leftPanoPicture):m.pano0=C.leftPanoPicture,m.pano1=C.leftPanoPicture),C.effect===`montage`?m.transition=`BLACK`:C.effect===`spread`?m.transition=`SPREAD`:m.transition=`FADE`,C.effect===`zoomin`||C.effect===`zoomout`?m.progress=Math.pow(t,3):C.effect===`model`&&this.camera.pose.distance<.01&&(m.modelAlpha=1-Math.pow(clamp$1(Math.abs(t-.5)*2,0,1),4)),t<1&&C.effect!==`fly`){if(m.pano0&&S.leftPanoPicture){let e={panoId:m.pano0.panoId,map:m.pano0.map,mapHistogram:m.pano0.mapHistogram,mapSize:m.pano0.mapSize,zoom:m.pano0.zoom,matrix:S.leftPanoPicture.matrix.clone().setPosition(C.position)},t=this.panoPictureObserverMap.get(m.pano0);t&&this.panoPictureObserverMap.set(e,t),m.pano0=e}n.copy(s),E=!0}h.distance=this.locationMotion.value.distance,h.offset=new three.Vector3(n.x+(s.x-n.x)*t,n.y+(s.y-n.y)*t,n.z+(s.z-n.z)*t);let c=[],l=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(c.push(t),n>this.locationMotion.progress&&l.push(t))}for(let e of Object.keys(this.panoResources)){if(l.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((r=m.pano0)==null?void 0:r.map)||e===((o=m.pano1)==null?void 0:o.map))continue;e.dispose(),t.leftPanoPicture=null}}c.indexOf(e)>=0||delete this.panoResources[e]}let u=panoParse(C.panoId);u!==this.currentPano&&(this.currentPano=u,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,createEvent(`pano.moving`,{userAction:this.userAction,prevPano:panoParse(w.panoId),pano:panoParse(T.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},panoParse(T.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),h),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(h),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[D,O]=n,k=new three.Vector3(0,0,0),A=new three.Vector2().copy(this.camera.resolution);if(O&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let n=this.xrManager.cameraVR,r=this.xrManager.referenceSpace,o=this.xrManager.session.renderState.baseLayer,u=O.getViewerPose(r),d=(s=u==null?void 0:u.views)==null?[]:s;for(let e=0;e<d.length;e++){let t=d[e],r=n.cameras[e],s=o.getViewport(t);s&&(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,k.copy(r.position),r.viewport.set(s.x,s.y,s.width,s.height),A.set(s.width,s.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((c=h.distance)==null?this.camera.pose.distance:c),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=O.getPose(this.xrManager.session.inputSources[e].targetRaySpace,r);if(t){let e=t.transform.orientation,n=new three.Quaternion(e.x,e.y,e.z,e.w),r=new three.Vector3(0,0,-1).applyQuaternion(n),o=new three.Raycaster(this.camera.position,r);this.gazeRay=o}}}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],o=n[e];if(!o)continue;t&&t.update(o,O,r);let s=this.xrManager.getController(e),c=new three.Vector3(0,1.2,0),u=s.position.clone().add(k).sub(c);o.handedness===`left`?this.xrControllerRay.left.set(u,new three.Vector3(0,0,-1).applyEuler(s.rotation)):o.handedness===`right`&&this.xrControllerRay.right.set(u,new three.Vector3(0,0,-1).applyEuler(s.rotation)),this.controllerWrappers[e].position.copy(new three.Vector3(0,0,0).add(k).sub(c));let d=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(d.length===0){let e=this.works.getResolvedObserver(this.currentPano);d=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(d.length>=1&&d[0].face)if(o.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=d[0].face.normal,n=t.clone(),r=d[0].point.clone();this.intersectMesh.position.copy(r);let o=r.clone().add(n);if(this.intersectMesh.lookAt(o),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(u,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(u,d[0].point));let s=d[0],c=createEvent(`intersect.update`,{raycaster:(l=this.xrControllerRay.right)==null?null:l,intersection:s==null?null:s,object:this.intersectMesh});if(this.emit(`intersect.update`,c),c.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(u,d[0].point)}this.updateControllerHelper(n,e,t)}}else O||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);isEmptyObject(m)===!1&&this.modelScene.parameter.set(m),this.emit(`camera.update`,createEvent(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))}));let j=this.works.getResolvedObserver(this.currentPano),M=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,N=this.works.getObserver(S.panoId),P=this.works.getObserver(C.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&j){let e=[],t=j.work.observers;for(let n of j.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(j.standingPosition),n.set(e,r));let o=n.get(e);return o===void 0&&(o=t.standingPosition.distanceTo(j.standingPosition),n.set(t,o)),r-o}),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=.05,o=.005,s=t.standingPosition.clone().applyMatrix4(t.work.transform),c=panoStringify({panoIndex:t.panoIndex,workCode:t.work.workCode}),l=adjustPanoCircleMeshVectors.map(t=>{scratchRaycaster.ray.origin.copy(s),scratchRaycaster.ray.origin.add(scratchVector3.copy(t).setY(e)),scratchRaycaster.ray.direction.set(0,-1,0),scratchRaycaster.firstHitOnly=!0,scratchRaycaster.floorIndex=-1;let[r]=n.intersectRaycaster(scratchRaycaster);return r&&r.distance-o<=e?new three.Vector3().copy(s).setY(r.point.y+o):s});l.sort((e,t)=>t.y-e.y);let u=l[Math.floor(l.length/2)],[d]=l.filter(e=>e.distanceTo(u)<=.05);if(d){let e=new three.Vector4(s.x,s.y,s.z,d.y-s.y),t=this.adjustPanoCircleMeshPositionFix.get(c);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(c,e)}}this.accessibleObserverFloorCheckCount++}}let F=new Map;if(N)for(let e of N.accessibleNodes){let t=N.work.observers[e];if(t){let e=panoStringify({panoIndex:t.panoIndex,workCode:t.work.workCode});F.set(e,t)}}if(P)for(let e of P.accessibleNodes){let t=P.work.observers[e];if(t){let e=panoStringify({panoIndex:t.panoIndex,workCode:t.work.workCode});F.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{F.get(t)?F.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),F.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),F.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&&(scratchVector3.set(t.x,t.y,t.z),scratchVector3.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let o=this.camera.position.clone().setY(e.position.y),s=new three.Vector3().copy(e.position).sub(o).normalize();if(t===panoStringify(this.currentPano)){let t=clamp$1((.5-o.distanceTo(e.position))/.5,0,1);s.multiplyScalar(1-t).add(g.clone().multiplyScalar(t))}if(s.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(s.x,s.z);e.quaternion.setFromEuler(new three.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||E)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(j){let n=j.work.observers,[,r]=arrayMin(j.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:j.standingPosition.distanceTo(t.standingPosition)},!0);r=clamp$1(r,2.5,1/0);let o=j.accessibleNodes.concat(j.panoIndex).map(e=>panoStringify({panoIndex:e,workCode:j.work.workCode}));this.panoMeshes.forEach((n,s)=>{let c=this.works.getObserver(s),l=!1,u=1;if(o.indexOf(s)===-1)l=!1,u=0;else if(!c)l=!1,u=0;else if(!c.loadable&&!c.active)l=!1,u=0;else{let e=n.position.clone().project(this.camera);l=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&M!==null&&panoStringify({panoIndex:M.panoIndex,workCode:M.work.workCode})===s;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);u=t<.01?0:clamp$1(r/t,.1,.85)}c&&c===P&&c.position.distanceTo(c.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(u=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(u=0),n.setCurrent(l),n.setOpacity(u),n.updateTime&&n.updateTime(e,t)})}{let e=(u=this.modelScene.parameter.progress)==null?1:u,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,o=t===0?n:r,s;if(o&&(s=this.works.getObserver(o.panoId),s||(s=this.panoPictureObserverMap.get(o))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(canUseNativeImageBitmap()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!s||!o||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:A,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new three.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=getImageSizeLevel(o.mapSize)+1,c=4;this.tiling.setObserver(s);let l={renderer:this.renderer,resolution:A,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:o.map,panoMatrix:o.matrix,panoZoom:o.zoom,minLevel:e,level:4},u=this.tiling.update(l),f={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:easeInQuart(Math.abs(((d=this.modelScene.parameter.progress)==null?0:d)-.5)*2)},p=this.modelScene.parameter.refinedScreen;(u||f.pano!==(p==null?void 0:p.pano)||f.opacity!==(p==null?void 0:p.opacity))&&this.modelScene.parameter.set(`refinedScreen`,f)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&j&&j.position.y-j.standingPosition.y>10){let e=clamp$1(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=C.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((f=this.modelScene.parameter.pano0Depth)==null?void 0:f.panoId)!==t.panoId||((p=this.modelScene.parameter.pano1Depth)==null?void 0:p.panoId)!==n.panoId){let e=500,r=512;this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new three.WebGLCubeRenderTarget(512,{minFilter:three.NearestFilter,magFilter:three.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new three.WebGLCubeRenderTarget(512,{minFilter:three.NearestFilter,magFilter:three.NearestFilter,generateMipmaps:!1});let o=new three.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);o.matrix.copy(t.matrix),o.matrixWorld.copy(o.matrix),o.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,o,500);let s=new three.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);s.matrix.copy(n.matrix),s.matrixWorld.copy(s.matrix),s.matrixAutoUpdate=!1,renderDepthCube(this.renderer,this.modelScene,s,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,o=this.xrControllerRay.right;if(!e||e.length===0)return;let s={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let c=0;c<e.length;c++){let l=e[c].handedness,u=e[c].gamepad;switch(l){case`left`:u.axes&&(this.emitHandleEvent(u.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(u.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(u.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(u.axes[3]===1,`LeftAxesDown`,t)),u!=null&&u.buttons&&(u.buttons[4]&&this.emitHandleEvent(u.buttons[4].pressed,`X`,t),u.buttons[5]&&this.emitHandleEvent(u.buttons[5].pressed,`Y`,t),u.buttons[0]&&this.emitHandleEvent(u.buttons[0].pressed,`LeftTrigger`,t),u.buttons[1]&&this.emitHandleEvent(u.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:u.axes&&u.axes[3]<0?Math.abs(u.axes[3]):0,down:u.axes&&u.axes[3]<0?0:Math.abs(u.axes[3]),left:u.axes&&u.axes[2]<0?Math.abs(u.axes[2]):0,right:u.axes&&u.axes[2]<0?0:Math.abs(u.axes[2])},deltaTime:n};s.buttons.X=u.buttons&&u.buttons[4]?u.buttons[4].pressed:!1,s.buttons.Y=u.buttons&&u.buttons[5]?u==null?void 0:u.buttons[5].pressed:!1,s.buttons.LeftTrigger=u.buttons&&u.buttons[0]?u==null?void 0:u.buttons[0].pressed:!1,s.buttons.LeftPinch=u.buttons&&u.buttons[1]?u==null?void 0:u.buttons[1].pressed:!1,s.left=e;break;case`right`:u.axes&&(this.emitHandleEvent(u.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(u.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(u.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(u.axes[3]===1,`RightAxesDown`,t)),u.buttons&&(u.buttons[4]&&this.emitHandleEvent(u.buttons[4].pressed,`A`,t),u.buttons[5]&&this.emitHandleEvent(u.buttons[5].pressed,`B`,t),u.buttons[0]&&this.emitHandleEvent(u.buttons[0].pressed,`RightTrigger`,t),u.buttons[1]&&this.emitHandleEvent(u.buttons[1].pressed,`RightPinch`,t)),s.right={raycaster:o,axes:{up:u.axes&&u.axes[3]<0?Math.abs(u.axes[3]):0,down:u.axes&&u.axes[3]<0?0:Math.abs(u.axes[3]),left:u.axes&&u.axes[2]<0?Math.abs(u.axes[2]):0,right:u.axes&&u.axes[2]<0?0:Math.abs(u.axes[2])},deltaTime:n},s.buttons.A=u.buttons&&u.buttons[4]?u==null?void 0:u.buttons[4].pressed:!1,s.buttons.B=u.buttons&&u.buttons[5]?u==null?void 0:u.buttons[5].pressed:!1,s.buttons.RightTrigger=u.buttons&&u.buttons[0]?u==null?void 0:u.buttons[0].pressed:!1,s.buttons.RightPinch=u.buttons&&u.buttons[1]?u==null?void 0:u.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,createEvent(`xr.controller.update`,s))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,o=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`,createEvent(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:o}}}))):n-this.xrHandleState[t].touchStartTime>CONTROLLER_EVNET_DELTA_TIME&&this.emit(`xr.gesture.press`,createEvent(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:o}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,createEvent(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:o}}})),n-this.xrHandleState[t].touchStartTime<=CONTROLLER_EVNET_DELTA_TIME){let e=createEvent(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:o}}});!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)})}},Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,Mapview:MapviewController,XRPanorama:XRPanoramaController},controllersDefaultInitArgs={Floorplan:defaultFloorplanControllerCustomInitArgs,Topview:defaultTopviewControllerCustomInitArgs,Panorama:defaultPanoramaControllerCustomInitArgs,VRPanorama:defaultVRPanoramaControllerCustomInitArgs,Model:defaultModelControllerCustomInitArgs,Mapview:defaultMapviewControllerCustomInitArgs,XRPanorama:defaultXRPanoramaControllerInitArgs},PROXY_CONTROLLER_EVENT_NAMES=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.fire,initAnimation.start,initAnimation.end,camera.update,intersect.update,pano.select,pano.moveTo,pano.moving,pano.arrived,pano.cancel,pano.error,pano.prepare,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 initLegacyEvent(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=coordinatesToVector(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 generateDefaultVideoElement(){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 initLights(){let e=new three.Group;e.name=`internalLights`;{let t=new three.DirectionalLight(16777215,.1);t.name=`direction0`,t.position.copy(new three.Vector3(0,1,0)),e.add(t)}{let t=new three.DirectionalLight(16777215,.1);t.name=`direction1`,t.position.copy(new three.Vector3(-1,-1,-1)),e.add(t)}{let t=new three.DirectionalLight(16777215,.3);t.name=`direction2`,t.position.copy(new three.Vector3(1,1,1)),e.add(t)}{let t=new three.AmbientLight(16777215,.6);t.name=`ambient0`,e.add(t)}return e}function parseKeyValue(e){var t,n;let r={},o=e.split(/(\;|\,)/);for(let e of o){let o=e.split(`=`),s=(t=o[0])==null?void 0:t.trim(),c=(n=o[1])==null?void 0:n.trim();s&&c&&(r[s]=c)}return r}function getViewportScale(){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=parseKeyValue((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var realsee_png_data_url_default=`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==`,imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new three.BufferGeometry;geometry.setAttribute(`position`,new three.BufferAttribute(vertices,3)),geometry.setAttribute(`uv`,new three.BufferAttribute(uvs,2)),geometry.setIndex(new three.BufferAttribute(index,1));var material=new three.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new three.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new three.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new three.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new three.Vector4,prevScissor=new three.Vector4;function renderPoweredByRealsee(e){if(material.map){let t=e.getViewport(prevViewport),n=e.getScissor(prevScissor),r=e.getScissorTest(),o=e.autoClear,s=n.x+imageOffset[0]/3,c=n.y+imageOffset[1]/3,l=imageSize[0]/3,u=imageSize[1]/3;e.setViewport(s,c,l,u),e.setScissor(s,c,l,u),e.setScissorTest(!0),e.autoClear=!1,e.render(scene,camera),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=o}else{let e=new three.Texture,t=new Image;t.onload=()=>{e.image=t,e.wrapS=three.ClampToEdgeWrapping,e.wrapT=three.ClampToEdgeWrapping,e.minFilter=three.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,material.needsUpdate=!0,t.onload=noop},t.src=realsee_png_data_url_default,material.map=e}}var OrderTexture=class{constructor(e=2048){this._count=0,this.width=e,this.height=1,this.data=new Uint32Array(this.width*this.height),this.texture=this.createTexture(this.data,this.width,this.height)}get count(){return this._count}createTexture(e,t,n){let r=new three.DataTexture(e,t,n,three.RedIntegerFormat,three.UnsignedIntType);return r.internalFormat=`R32UI`,r.minFilter=three.NearestFilter,r.magFilter=three.NearestFilter,r.generateMipmaps=!1,r.needsUpdate=!0,r}update(e){let t=e.length,n=Math.max(1,Math.ceil(t/this.width));n>this.height&&(this.height=n,this.data=new Uint32Array(this.width*this.height),this.texture.dispose(),this.texture=this.createTexture(this.data,this.width,this.height)),this.data.set(e,0),this._count=t,this.texture.needsUpdate=!0}dispose(){this.texture.dispose()}},TEXELS_PER_SPLAT$1=2,UINT32_PER_SPLAT=8,TileTexture=class{constructor(e){let t=e.numPoints,n=e.packedData;if(!n||n.length<t*UINT32_PER_SPLAT)throw Error(`[TileTexture] object 缺少足量 packedData`);let r=t*TEXELS_PER_SPLAT$1,o=Math.max(1,Math.min(2048,r)),s=Math.max(1,Math.ceil(r/o)),c=new Uint32Array(o*s*4);c.set(n.subarray(0,t*UINT32_PER_SPLAT),0);let l=new three.DataTexture(c,o,s,three.RGBAIntegerFormat,three.UnsignedIntType);l.internalFormat=`RGBA32UI`,l.minFilter=three.NearestFilter,l.magFilter=three.NearestFilter,l.generateMipmaps=!1,l.needsUpdate=!0,this.texture=l,this.count=t,this.width=o,this.height=s}dispose(){this.texture.dispose()}},TEXELS_PER_SPLAT=2,SplatAssembler=class e{constructor(t=2048){this.target=null,this.targetHeight=0,this.regionMap=new Map,this.regionList=[],this.width=t,this.material=new three.RawShaderMaterial({vertexShader:e.VERTEX,fragmentShader:e.FRAGMENT,uniforms:{u_tileTex:{value:null},u_tileWidth:{value:1},u_bigWidth:{value:t},u_startTexel:{value:0},u_count:{value:0},u_transformIndex:{value:0},u_layerIndex:{value:0}},depthTest:!1,depthWrite:!1}),this.scene=new three.Scene,this.mesh=new three.Mesh(new three.PlaneGeometry(2,2),this.material),this.mesh.frustumCulled=!1,this.scene.add(this.mesh),this.camera=new three.Camera}get texture(){return this.target?this.target.texture:null}get totalPoints(){let e=0;for(let t of this.regionList)e+=t.count;return e}get regions(){return this.regionList}has(e){return this.regionMap.has(e)}add(e,t,n,r){if(this.regionMap.has(e))return;let o={object:e,tile:t,start:0,count:t.count,transformIndex:n,layerIndex:r};this.regionMap.set(e,o),this.regionList.push(o)}sync(e,t){let n=new Set(e);for(let e of Array.from(this.regionMap.keys()))n.has(e)||(this.regionMap.get(e).tile.dispose(),this.regionMap.delete(e));let r=[];for(let n of e){let e=this.regionMap.get(n),{transformIndex:o,layerIndex:s}=t(n);e?(e.transformIndex=o,e.layerIndex=s):(e={object:n,tile:new TileTexture(n),start:0,count:n.numPoints,transformIndex:o,layerIndex:s},this.regionMap.set(n,e)),r.push(e)}this.regionList=r}remove(e){let t=this.regionMap.get(e);if(!t)return;t.tile.dispose(),this.regionMap.delete(e);let n=this.regionList.indexOf(t);n>=0&&this.regionList.splice(n,1)}clear(){for(let e of this.regionList)e.tile.dispose();this.regionMap.clear(),this.regionList=[]}assemble(e){let t=0;for(let e of this.regionList)e.start=t,t+=e.count;let n=Math.max(1,Math.ceil(t*TEXELS_PER_SPLAT/this.width));(!this.target||n>this.targetHeight)&&(this.target&&this.target.dispose(),this.targetHeight=n,this.target=new three.WebGLRenderTarget(this.width,n,{format:three.RGBAIntegerFormat,type:three.UnsignedIntType,minFilter:three.NearestFilter,magFilter:three.NearestFilter,depthBuffer:!1,stencilBuffer:!1}),this.target.texture.internalFormat=`RGBA32UI`,this.target.texture.generateMipmaps=!1);let r=e.getRenderTarget(),o=e.autoClear,s=e.getScissorTest(),c=e.getScissor(new three.Vector4),l=e.getPixelRatio()||1;e.autoClear=!1,e.setRenderTarget(this.target),e.setScissorTest(!0);for(let t of this.regionList){let n=t.start*TEXELS_PER_SPLAT,r=(t.start+t.count)*TEXELS_PER_SPLAT,o=Math.floor(n/this.width),s=Math.ceil(r/this.width),c=Math.max(0,Math.floor(o/l)-1),u=Math.ceil(s/l)+1,d=Math.ceil(this.width/l)+1;e.setScissor(0,c,d,u-c);let f=this.material.uniforms;f.u_tileTex.value=t.tile.texture,f.u_tileWidth.value=t.tile.width,f.u_bigWidth.value=this.width,f.u_startTexel.value=n,f.u_count.value=t.count,f.u_transformIndex.value=t.transformIndex,f.u_layerIndex.value=t.layerIndex,this.material.uniformsNeedUpdate=!0,e.render(this.scene,this.camera)}e.setScissorTest(s),e.setScissor(c),e.setRenderTarget(r),e.autoClear=o}snapshot(){return this.regionList.map(e=>Object.assign({},e))}extractSortInputs(){let e=this.totalPoints,t=new Float32Array(e*3),n=new Uint32Array(e);for(let e of this.regionList){let r=e.object.packedData;if(!r)continue;let o=new Float32Array(r.buffer,r.byteOffset,r.length),s=e.transformIndex;for(let r=0;r<e.count;r++){let c=e.start+r;t[c*3+0]=o[r*8+0],t[c*3+1]=o[r*8+1],t[c*3+2]=o[r*8+2],n[c]=s}}return{positions:t,transformIndices:n,count:e}}readback(e){if(!this.target)return new Uint32Array;let t=this.width,n=this.targetHeight,r=new Uint32Array(t*n*4),o=e.getRenderTarget();e.setRenderTarget(this.target);let s=e.getContext();return s.readPixels(0,0,t,n,s.RGBA_INTEGER,s.UNSIGNED_INT,r),e.setRenderTarget(o),r}dispose(){this.clear(),this.target&&(this.target.dispose(),this.target=null),this.mesh.geometry.dispose(),this.material.dispose()}};SplatAssembler.VERTEX=`#version 300 es
|
|
2844
2844
|
in vec3 position;
|
|
2845
2845
|
void main() {
|
|
2846
2846
|
gl_Position = vec4(position.xy, 0.0, 1.0);
|
|
@@ -2871,7 +2871,7 @@ void main() {
|
|
|
2871
2871
|
}
|
|
2872
2872
|
outColor = v;
|
|
2873
2873
|
}
|
|
2874
|
-
`;var TEXELS_PER_OBJECT=5,FLOATS_PER_OBJECT=TEXELS_PER_OBJECT*4,TransformStore=class{constructor(){this.texture=null,this.width=TEXELS_PER_OBJECT,this.data=new Float32Array,this.indexMap=new Map,this.count=0}indexOf(e){return this.indexMap.get(e)}get objectCount(){return this.count}get transforms(){return this.data}sync(e){this.indexMap.clear(),this.count=e.length;let t=Math.max(1,this.count)*FLOATS_PER_OBJECT;this.data.length<t&&(this.data=new Float32Array(t));for(let t=0;t<e.length;t++){let n=e[t];this.indexMap.set(n,t),this.data.set(n.matrixWorld.elements,t*FLOATS_PER_OBJECT),this.data[t*FLOATS_PER_OBJECT+16]=+!!n.selected}this.rebuildTexture()}updateOne(e){let t=this.indexMap.get(e);t!==void 0&&(this.data.set(e.matrixWorld.elements,t*FLOATS_PER_OBJECT),this.data[t*FLOATS_PER_OBJECT+16]=+!!e.selected,this.texture&&(this.texture.needsUpdate=!0))}rebuildTexture(){let e=Math.max(1,this.count);this.texture&&this.texture.dispose();let t=new three.DataTexture(this.data,this.width,e,three.RGBAFormat,three.FloatType);t.internalFormat=`RGBA32F`,t.minFilter=three.NearestFilter,t.magFilter=three.NearestFilter,t.generateMipmaps=!1,t.needsUpdate=!0,this.texture=t}dispose(){this.texture&&(this.texture.dispose(),this.texture=null)}},LayerRegistry=class{constructor(){this.layerKeys=[],this.layerKeyToIndex=new Map,this.objectLayerIndex=new Map}sync(e){this.layerKeys=[],this.layerKeyToIndex.clear(),this.objectLayerIndex.clear();for(let t of e){let e=t.gsViewLayerKey||t.uuid,n=this.layerKeyToIndex.get(e);n===void 0&&(n=this.layerKeys.length,this.layerKeys.push(e),this.layerKeyToIndex.set(e,n)),this.objectLayerIndex.set(t,n)}}layerIndexOf(e){var t;return(t=this.objectLayerIndex.get(e))==null?0:t}get layerCount(){return this.layerKeys.length}},SH_WIDTH=2048,ELEMENTS_PER_TEXEL=4,SHStore=class{constructor(){this.texture=null,this.textureSize=new three.Vector2,this.dataMaxDegree=0,this.appliedDegree=0}sync(e,t){let n=0,r=0;for(let t of e)t.maxSHDegree>n&&(n=t.maxSHDegree),r+=t.numPoints;this.dataMaxDegree=n;let o=Math.min(t,n);if(this.appliedDegree=o,o<=0||r===0)return this.appliedDegree=0,!1;let s=0;o>=1&&(s+=9),o>=2&&(s+=15),o>=3&&(s+=21);let c=s;c%ELEMENTS_PER_TEXEL!==0&&(c=Math.ceil(c/ELEMENTS_PER_TEXEL)*ELEMENTS_PER_TEXEL);let l=c/ELEMENTS_PER_TEXEL,u=r*l,d=SH_WIDTH,f=Math.ceil(u/d),p=new Float32Array(d*f*ELEMENTS_PER_TEXEL),m=0;for(let t of e){let e=t.sh1,n=t.sh2,r=t.sh3;for(let s=0;s<t.numPoints;s++){let t=(m+s)*l,c=0;if(e&&o>=1)for(let n=0;n<9;n++){let r=t+Math.floor(c/ELEMENTS_PER_TEXEL),o=c%ELEMENTS_PER_TEXEL;p[r*ELEMENTS_PER_TEXEL+o]=e[s*9+n],c++}if(n&&o>=2)for(let e=0;e<15;e++){let r=t+Math.floor(c/ELEMENTS_PER_TEXEL),o=c%ELEMENTS_PER_TEXEL;p[r*ELEMENTS_PER_TEXEL+o]=n[s*15+e],c++}if(r&&o>=3)for(let e=0;e<21;e++){let n=t+Math.floor(c/ELEMENTS_PER_TEXEL),o=c%ELEMENTS_PER_TEXEL;p[n*ELEMENTS_PER_TEXEL+o]=r[s*21+e],c++}}m+=t.numPoints}this.texture&&this.texture.dispose();let h=new three.DataTexture(p,d,f,three.RGBAFormat,three.FloatType);return h.internalFormat=`RGBA32F`,h.minFilter=three.NearestFilter,h.magFilter=three.NearestFilter,h.generateMipmaps=!1,h.needsUpdate=!0,this.texture=h,this.textureSize.set(d,f),!0}dispose(){this.texture&&(this.texture.dispose(),this.texture=null)}},SENTINEL=4294967295,ReorderPass=class e{constructor(t=64){this.maxSeg=t,this.segStart=Array(t).fill(0),this.segEnd=Array(t).fill(0),this.segDelta=Array(t).fill(0),this.segRemoved=Array(t).fill(0),this.material=new three.RawShaderMaterial({vertexShader:e.VERTEX,fragmentShader:e.buildFragment(t),uniforms:{u_srcOrder:{value:null},u_orderWidth:{value:1},u_segCount:{value:0},u_segStart:{value:this.segStart},u_segEnd:{value:this.segEnd},u_segDelta:{value:this.segDelta},u_segRemoved:{value:this.segRemoved}},depthTest:!1,depthWrite:!1}),this.scene=new three.Scene,this.mesh=new three.Mesh(new three.PlaneGeometry(2,2),this.material),this.mesh.frustumCulled=!1,this.scene.add(this.mesh),this.camera=new three.Camera}static createOrderTarget(e,t){let n=new three.WebGLRenderTarget(e,t,{format:three.RedIntegerFormat,type:three.UnsignedIntType,minFilter:three.NearestFilter,magFilter:three.NearestFilter,depthBuffer:!1,stencilBuffer:!1});return n.texture.internalFormat=`R32UI`,n.texture.generateMipmaps=!1,n}run(e,t,n,r,o){let s=Math.min(o.length,this.maxSeg);o.length>this.maxSeg&&console.warn(`[ReorderPass] segments ${o.length} 超过 maxSeg ${this.maxSeg},将被截断。`);for(let e=0;e<s;e++){let t=o[e];this.segStart[e]=t.oldStart,this.segEnd[e]=t.oldEnd,this.segDelta[e]=t.delta,this.segRemoved[e]=+!!t.removed}this.material.uniforms.u_srcOrder.value=t,this.material.uniforms.u_orderWidth.value=n,this.material.uniforms.u_segCount.value=s,this.material.uniformsNeedUpdate=!0;let c=e.getRenderTarget(),l=e.autoClear;e.autoClear=!1,e.setRenderTarget(r),e.render(this.scene,this.camera),e.setRenderTarget(c),e.autoClear=l}dispose(){this.mesh.geometry.dispose(),this.material.dispose()}static buildFragment(e){return`#version 300 es
|
|
2874
|
+
`;var TEXELS_PER_OBJECT$1=5,FLOATS_PER_OBJECT$1=TEXELS_PER_OBJECT$1*4,TransformStore=class{constructor(){this.texture=null,this.width=TEXELS_PER_OBJECT$1,this.data=new Float32Array,this.indexMap=new Map,this.count=0}indexOf(e){return this.indexMap.get(e)}get objectCount(){return this.count}get transforms(){return this.data}sync(e){this.indexMap.clear(),this.count=e.length;let t=Math.max(1,this.count)*FLOATS_PER_OBJECT$1;this.data.length<t&&(this.data=new Float32Array(t));for(let t=0;t<e.length;t++){let n=e[t];this.indexMap.set(n,t),this.data.set(n.matrixWorld.elements,t*FLOATS_PER_OBJECT$1),this.data[t*FLOATS_PER_OBJECT$1+16]=+!!n.selected}this.rebuildTexture()}updateOne(e){let t=this.indexMap.get(e);t!==void 0&&(this.data.set(e.matrixWorld.elements,t*FLOATS_PER_OBJECT$1),this.data[t*FLOATS_PER_OBJECT$1+16]=+!!e.selected,this.texture&&(this.texture.needsUpdate=!0))}rebuildTexture(){let e=Math.max(1,this.count);this.texture&&this.texture.dispose();let t=new three.DataTexture(this.data,this.width,e,three.RGBAFormat,three.FloatType);t.internalFormat=`RGBA32F`,t.minFilter=three.NearestFilter,t.magFilter=three.NearestFilter,t.generateMipmaps=!1,t.needsUpdate=!0,this.texture=t}dispose(){this.texture&&(this.texture.dispose(),this.texture=null)}},TEXELS_PER_OBJECT=1,FLOATS_PER_OBJECT=TEXELS_PER_OBJECT*4,ObjectParamsStore=class{constructor(){this.texture=null,this.width=TEXELS_PER_OBJECT,this.data=new Float32Array,this.indexMap=new Map,this.count=0}get objectCount(){return this.count}sync(e,t){this.indexMap.clear(),this.count=e.length;let n=Math.max(1,this.count)*FLOATS_PER_OBJECT;this.data.length<n&&(this.data=new Float32Array(n));for(let n of e){let e=t(n);e===void 0||e<0||e>=this.count||(this.indexMap.set(n,e),this.write(n,e))}this.rebuildTexture()}updateOne(e){let t=this.indexMap.get(e);t!==void 0&&(this.write(e,t),this.texture&&(this.texture.needsUpdate=!0))}write(e,t){let n=t*FLOATS_PER_OBJECT;this.data[n+0]=e.preBlurAmount,this.data[n+1]=e.blurAmount,this.data[n+2]=0,this.data[n+3]=0}rebuildTexture(){let e=Math.max(1,this.count);this.texture&&this.texture.dispose();let t=new three.DataTexture(this.data,this.width,e,three.RGBAFormat,three.FloatType);t.internalFormat=`RGBA32F`,t.minFilter=three.NearestFilter,t.magFilter=three.NearestFilter,t.generateMipmaps=!1,t.needsUpdate=!0,this.texture=t}dispose(){this.texture&&(this.texture.dispose(),this.texture=null),this.indexMap.clear(),this.count=0}},LayerRegistry=class{constructor(){this.layerKeys=[],this.layerKeyToIndex=new Map,this.objectLayerIndex=new Map}sync(e){this.layerKeys=[],this.layerKeyToIndex.clear(),this.objectLayerIndex.clear();for(let t of e){let e=t.gsViewLayerKey||t.uuid,n=this.layerKeyToIndex.get(e);n===void 0&&(n=this.layerKeys.length,this.layerKeys.push(e),this.layerKeyToIndex.set(e,n)),this.objectLayerIndex.set(t,n)}}layerIndexOf(e){var t;return(t=this.objectLayerIndex.get(e))==null?0:t}get layerCount(){return this.layerKeys.length}},SH_WIDTH=2048,ELEMENTS_PER_TEXEL=4,SHStore=class{constructor(){this.texture=null,this.textureSize=new three.Vector2,this.dataMaxDegree=0,this.appliedDegree=0}sync(e,t){let n=0,r=0;for(let t of e)t.maxSHDegree>n&&(n=t.maxSHDegree),r+=t.numPoints;this.dataMaxDegree=n;let o=Math.min(t,n);if(this.appliedDegree=o,o<=0||r===0)return this.appliedDegree=0,!1;let s=0;o>=1&&(s+=9),o>=2&&(s+=15),o>=3&&(s+=21);let c=s;c%ELEMENTS_PER_TEXEL!==0&&(c=Math.ceil(c/ELEMENTS_PER_TEXEL)*ELEMENTS_PER_TEXEL);let l=c/ELEMENTS_PER_TEXEL,u=r*l,d=SH_WIDTH,f=Math.ceil(u/d),p=new Float32Array(d*f*ELEMENTS_PER_TEXEL),m=0;for(let t of e){let e=t.sh1,n=t.sh2,r=t.sh3;for(let s=0;s<t.numPoints;s++){let t=(m+s)*l,c=0;if(e&&o>=1)for(let n=0;n<9;n++){let r=t+Math.floor(c/ELEMENTS_PER_TEXEL),o=c%ELEMENTS_PER_TEXEL;p[r*ELEMENTS_PER_TEXEL+o]=e[s*9+n],c++}if(n&&o>=2)for(let e=0;e<15;e++){let r=t+Math.floor(c/ELEMENTS_PER_TEXEL),o=c%ELEMENTS_PER_TEXEL;p[r*ELEMENTS_PER_TEXEL+o]=n[s*15+e],c++}if(r&&o>=3)for(let e=0;e<21;e++){let n=t+Math.floor(c/ELEMENTS_PER_TEXEL),o=c%ELEMENTS_PER_TEXEL;p[n*ELEMENTS_PER_TEXEL+o]=r[s*21+e],c++}}m+=t.numPoints}this.texture&&this.texture.dispose();let h=new three.DataTexture(p,d,f,three.RGBAFormat,three.FloatType);return h.internalFormat=`RGBA32F`,h.minFilter=three.NearestFilter,h.magFilter=three.NearestFilter,h.generateMipmaps=!1,h.needsUpdate=!0,this.texture=h,this.textureSize.set(d,f),!0}dispose(){this.texture&&(this.texture.dispose(),this.texture=null)}},SENTINEL=4294967295,ReorderPass=class e{constructor(t=64){this.maxSeg=t,this.segStart=Array(t).fill(0),this.segEnd=Array(t).fill(0),this.segDelta=Array(t).fill(0),this.segRemoved=Array(t).fill(0),this.material=new three.RawShaderMaterial({vertexShader:e.VERTEX,fragmentShader:e.buildFragment(t),uniforms:{u_srcOrder:{value:null},u_orderWidth:{value:1},u_segCount:{value:0},u_segStart:{value:this.segStart},u_segEnd:{value:this.segEnd},u_segDelta:{value:this.segDelta},u_segRemoved:{value:this.segRemoved}},depthTest:!1,depthWrite:!1}),this.scene=new three.Scene,this.mesh=new three.Mesh(new three.PlaneGeometry(2,2),this.material),this.mesh.frustumCulled=!1,this.scene.add(this.mesh),this.camera=new three.Camera}static createOrderTarget(e,t){let n=new three.WebGLRenderTarget(e,t,{format:three.RedIntegerFormat,type:three.UnsignedIntType,minFilter:three.NearestFilter,magFilter:three.NearestFilter,depthBuffer:!1,stencilBuffer:!1});return n.texture.internalFormat=`R32UI`,n.texture.generateMipmaps=!1,n}run(e,t,n,r,o){let s=Math.min(o.length,this.maxSeg);o.length>this.maxSeg&&console.warn(`[ReorderPass] segments ${o.length} 超过 maxSeg ${this.maxSeg},将被截断。`);for(let e=0;e<s;e++){let t=o[e];this.segStart[e]=t.oldStart,this.segEnd[e]=t.oldEnd,this.segDelta[e]=t.delta,this.segRemoved[e]=+!!t.removed}this.material.uniforms.u_srcOrder.value=t,this.material.uniforms.u_orderWidth.value=n,this.material.uniforms.u_segCount.value=s,this.material.uniformsNeedUpdate=!0;let c=e.getRenderTarget(),l=e.autoClear;e.autoClear=!1,e.setRenderTarget(r),e.render(this.scene,this.camera),e.setRenderTarget(c),e.autoClear=l}dispose(){this.mesh.geometry.dispose(),this.material.dispose()}static buildFragment(e){return`#version 300 es
|
|
2875
2875
|
precision highp float;
|
|
2876
2876
|
precision highp int;
|
|
2877
2877
|
precision highp usampler2D;
|
|
@@ -2949,5 +2949,5 @@ Aj$\\0 \\0\\v
|
|
|
2949
2949
|
*\\b
|
|
2950
2950
|
*\\0
|
|
2951
2951
|
* ! \\v!
|
|
2952
|
-
\\v j ¼"\\v \\vAsAÿÿÿÿ\\x07q \\vA\\0H\\x1B"\\v6\\0 \\b \\vAÿÿqAtj" (\\0Aj6\\0 \\vAvAüÿqj"\\v \\v(\\0Aj6\\0 \\fAj!\\f\\f\\v\\v\\v\\0\\v\\v \\0A\\b\\v\`)}function v(e){return e}function y(e,t){var n,r=v(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function b(){return{a:F}}function x(){function e(e,t){return L=e.exports,P(L),f(),L}var t=b();return r.instantiateWasm?new Promise((n,i)=>{r.instantiateWasm(t,(t,r)=>{n(e(t,r))})}):(g!=null||(g=_()),e(y(g,t)[0]))}for(var S=e=>{for(;e.length>0;)e.shift()(r)},C=[],w=e=>C.push(e),T=[],E=e=>T.push(e),D=()=>2147483648,O=(e,t)=>Math.ceil(e/t)*t,k=e=>{var t=(e-N.buffer.byteLength+65535)/65536|0;try{return N.grow(t),f(),1}catch(e){}},A=e=>{var t=u.length;e>>>=0;var n=D();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),k(Math.min(n,O(Math.max(e,i),65536))))return!0}return!1},j=new Uint8Array(123),M=25;M>=0;--M)j[48+M]=52+M,j[65+M]=M,j[97+M]=26+M;if(j[43]=62,j[47]=63,r.noExitRuntime&&r.noExitRuntime,r.print&&r.print,r.printErr&&r.printErr,r.wasmBinary&&r.wasmBinary,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.preInit)for(typeof r.preInit==\`function\`&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.shift()();var N;function P(e){r._sort=e.d,r._malloc=e.e,r._free=e.f,N=e.b,e.__indirect_function_table}var F={a:A};function I(){p();function e(){var e;r.calledRun=!0,!s&&(m(),l==null||l(r),(e=r.onRuntimeInitialized)==null||e.call(r),h())}r.setStatus?(r.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>r.setStatus(\`\`),1),e()},1)):e()}var L=x();return I(),t=d?r:new Promise((e,t)=>{l=e}),t}),i.apply(this,arguments)}let a;function o(){return e(this,void 0,void 0,function*(){a=yield r()})}let s,c,l,u,d,f,p,m,h,g,_=0,v=0,y=!1,b=[],x=!0,S=!0,C=!1,w=!1,T=!1;function E(e,t){if(t.length!==16)return!0;for(let n=0;n<16;n++)if(Math.abs(e[n]-t[n])>1e-7)return!0;return!1}let D=[],O=65536,k=()=>e(void 0,void 0,void 0,function*(){if(C){w=!0;return}C=!0,w=!1,a||(yield o());let e=Math.pow(2,Math.ceil(Math.log2(s.vertexCount)));_<e&&(_>0&&(a._free(c),a._free(u),a._free(d),a._free(f),a._free(p),a._free(m)),_=e,c=a._malloc(64),u=a._malloc(_*4),d=a._malloc(3*_*4),f=a._malloc(_*4),p=a._malloc(_*4),m=a._malloc(_*4)),y||(h=a._malloc(O*4),g=a._malloc(O*4),y=!0),v<s.transforms.length&&(v>0&&a._free(l),v=s.transforms.length,l=a._malloc(v*4)),C=!1,w&&(w=!1,yield k())}),A=()=>{if(C||w||!a)return;C=!0,S&&(a.HEAPF32.set(s.positions,d/4),a.HEAPF32.set(s.transforms,l/4),a.HEAPU32.set(s.transformIndices,u/4),S=!1),a.HEAPF32.set(new Float32Array(b),c/4),a._sort(c,l,u,s.vertexCount,d,f,p,m,h,g);let e=s.vertexCount,t=new Uint32Array(a.HEAPU32.buffer,p,e),n=e*4,r=D.pop();(!r||r.byteLength<n)&&(r=new ArrayBuffer(n));let i=new Uint32Array(r,0,e);i.set(t),self.postMessage({depthIndex:i,generation:s.generation},[r]),C=!1,x=!1},j=()=>{T||(T=!0,x&&A(),setTimeout(()=>{T=!1,j()}))};self.onmessage=t=>new Promise(n=>e(void 0,void 0,void 0,function*(){var e;if(t.data.warmup){yield o(),n(!0);return}if(t.data.returnBuffer){D.length<3&&D.push(t.data.returnBuffer),n(!0);return}let r=!1,i=!!t.data.sortData;if(t.data.sortData&&(s={positions:t.data.sortData.positions,transforms:t.data.sortData.transforms,transformIndices:t.data.sortData.transformIndices,vertexCount:t.data.sortData.vertexCount,generation:(e=t.data.sortData.generation)==null?0:e},x=!0,S=!0,yield k(),r=!0),t.data.viewProj){let e=t.data.viewProj;(E(e,b)||i)&&(b=e,x=!0,r=!0)}r&&x&&j(),n(!0)}))})();`,blob=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,jsContent],{type:`text/javascript;charset=utf-8`});function WorkerWrapper(e){let t;try{if(t=blob&&(self.URL||self.webkitURL).createObjectURL(blob),!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(jsContent),{name:e==null?void 0:e.name})}}var vertex_default=function(...e){let t=113,n=126,r=0,o=``;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{H0vsqrs-b`Rl\\_QR_laReab_R{vs|z-uvtu}-nz}yr?Q-l|qrar\x07rH{vs|z-v{-l|qrdvquH{vs|z-v{-l{z]|v{H0ryrnvor-sy|n-}ynV{qr\x07H0r{qvs{vs|z-uvtu}-nz}yr?Q-lr\x07rH{vs|z-uvtu}-nz}yr?Q-ln{s|zH{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|{H0vs-R[NOYRlT`lV[ValN[VZNaV\\[{vs|z-sy|n-lnttrtnv|{]|trH{vs|z-sy|n-lnttrtnv|{]|v{Qnv|{H{vs|z-rp@-lnttrtnv|{O|{qZv{H{vs|z-rp@-lnttrtnv|{O|{qZn\x07H0r{qvsn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bHp|{-sy|n-xr{ry?Q`v r-J-=;@Hp|{-sy|n-zn\x07`prr{`}npr`}yn`v r-J-?=AE;=Hp|{-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-\n0vsqrs-b`Rl\\_QR_laReab_R----<<-|qr-走纹理:用实例号从-|qrar\x07r-取本实例要画的全局点索引----vrp?-|qrP||q-J-vrp?5tylV{n{prVQ-2-l|qrdvqu9-tylV{n{prVQ-<-l|qrdvqu6H----v{-}ynV{qr\x07b-J-r\x07rySrpu5l|qrar\x07r9-|qrP||q9-=6;H----<<-r|qr-标记为-`R[aV[RY5KJ-{z]|v{6-的实例被剔除----vs-5}ynV{qr\x07b-KJ-v{5l{z]|v{66-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f0ryr----v{-}ynV{qr\x07b-J-v{5}ynV{qr\x07-8-=;B6H0r{qvs----v{-}ynV{qr\x07V-J-v{5}ynV{qr\x07b6H----<<-每-}yn-?-r\x07ry-5_TON@?bV6G----<<-r\x07ry-=G-h}|els@?ov9-}|fls@?ov9-}|gls@?ov9-_TONl}npxrqj----<<-r\x07ry->G-hp|==\vp|=>5unys?69-p|=?\vp|>>5unys?69-p|>?\vp|??5unys?69-n{s|zV{qr\x07II>C\vyn\brV{qr\x07j----v{-onrar\x07ry-J-}ynV{qr\x07b-7-?H----v{-r\x07dvqu-J-v{5r\x07r`v r5lr\x07r9-=6;\x076H----vrp?-p||q=-J-vrp?5onrar\x07ry-2-r\x07dvqu9-onrar\x07ry-<-r\x07dvqu6H----vrp?-p||q>-J-vrp?55onrar\x07ry-8->6-2-r\x07dvqu9-5onrar\x07ry-8->6-<-r\x07dvqu6H----rpA-=-J-r\x07rySrpu5lr\x07r9-p||q=9-=6H----rpA->-J-r\x07rySrpu5lr\x07r9-p||q>9-=6H----<<-全精度位置-5|owrp-}npr6----rp@-}ynPr{r-J-rp@5--------v{Ova|Sy|n5=;69--------v{Ova|Sy|n5=;t69--------v{Ova|Sy|n5=;o6----6H----<<-颜色----rpA-p|y|-J-rpA5--------sy|n5=;n-3-=\x07SS69--------sy|n55=;n-KK-E6-3-=\x07SS69--------sy|n55=;n-KK->C6-3-=\x07SS69--------sy|n55=;n-KK-?A6-3-=\x07SS6----6-<-?BB;=H----<<-预计算的-@Q-协方差(|owrp-}npr),对称矩阵-C-分量-5unys:}rpvv|{6----rp?-p|ln-J-{}npxUnys?\x07>C5>;6H--<<-5p|==9-p|=>6----rp?-p|lo-J-{}npxUnys?\x07>C5>;t6H--<<-5p|=?9-p|>>6----rp?-p|lp-J-{}npxUnys?\x07>C5>;o6H--<<-5p|>?9-p|??6----zn@-cx-J-zn@5--------p|ln;\x079-p|ln;\b9-p|lo;\x079--------p|ln;\b9-p|lo;\b9-p|lp;\x079--------p|lo;\x079-p|lp;\x079-p|lp;\b----6H----<<-n{s|zV{qr\x07-和-yn\brV{qr\x07-从->;n-解包----v{-n{s|zV{qr\x07-J->;n-KK->CH----v{-yn\brV{qr\x07-J->;n-3-=\x07SSSSH----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----rpA-|yqPr{r-J-n{s|z-7-rpA5}ynPr{r9->;=6H0vs-R[NOYRlT`lV[ValN[VZNaV\\[----sy|n-y|pny]|tr-J-lnttrtnv|{]|trH----sy|n-pnyr]|tr-J-=;=H----o||y-v{O|{qS|Nttrtnv|{-J-snyrH----vs-5lnttrtnv|{]|tr-I->;=6-\n--------o||y-v{O|{q-J-|yqPr{r;\x07-KJ-lnttrtnv|{O|{qZv{;\x07---------------------33-|yqPr{r;\x07-IJ-lnttrtnv|{O|{qZn\x07;\x07---------------------33-|yqPr{r; -KJ-lnttrtnv|{O|{qZv{; ---------------------33-|yqPr{r; -IJ-lnttrtnv|{O|{qZn\x07; H--------vs-5v{O|{q6-\n------------v{O|{qS|Nttrtnv|{-J-rH------------sy|n-urvtu_n{tr-J-lnttrtnv|{O|{qZn\x07;\b-:-lnttrtnv|{O|{qZv{;\bH------------sy|n-{|znyv rqUrvtu-J-urvtu_n{tr-K-=;==>----------------L-pynz}55|yqPr{r;\b-:-lnttrtnv|{O|{qZv{;\b6-<-urvtu_n{tr9-=;=9->;=6----------------G-=;BH------------sy|n-}|v{Q-J-pynz}5lnttrtnv|{]|v{Qnv|{9-=;=>9->;=6H------------sy|n-navzr-J-5>;=-:-{|znyv rqUrvtu6-7-5>;=-:-}|v{Q6H------------y|pny]|tr-J-pynz}55lnttrtnv|{]|tr-:-navzr6-<-}|v{Q9-=;=9->;=6H------------sy|n-|ssr]|tr-J-z||ur}5=;=9->;=9-y|pny]|tr6H------------pnyr]|tr-J-y|pny]|tr-7-y|pny]|tr-7-y|pny]|trH------------rp@-nttrtnv|{Pr{r-J-5lnttrtnv|{O|{qZv{-8-lnttrtnv|{O|{qZn\x076-<-?;=H------------rp@-qv-J-|yqPr{r;\x07\b -:-nttrtnv|{Pr{rH------------sy|n-qv-J-yr{tu5qv6H------------sy|n-n{q`rrq-J-q|5}ynPr{r9-rp@5>?;FEFE9-DE;?@@9-AB;>CA66H------------sy|n-n{qQv-J-snp5v{5n{q`rrq6-7-A@DBE;BAB@6H------------sy|n-n{tyr-J-n{q`rrq-7->=;=H------------rp@-pnrQv-J-{|znyv r5rp@5----------------p|5n{tyr69----------------zv\x075:=;D9-=;>9-snp5v{5n{q`rrq-7->;D6-7-A@DBE;BAB@669----------------v{5n{tyr6------------66H------------sy|n-r\x07}y|v|{Snp|-J-5>;=-:-|ssr]|tr6-7-5>;=-8->;=-7-n{qQv6H------------rp@-|ssr-J-pnrQv-7-qv-7-r\x07}y|v|{Snp|H------------|yqPr{r;\x07\b -8J-|ssrH------------}ynPr{r-J-5v{rr5n{s|z6-7-|yqPr{r6;\x07\b H--------\f----\f0r{qvs----0vs-[bZlT`lPYV]]R_`-K-=----vs-5yn\brV{qr\x07-I-v{5[bZlT`lYNfR_`66-\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----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----]|vv|{-J-}|vv|{;\x07\bH----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----o||y-v\\u|tn}uvp-J-}|wrpv|{Znv\x07h@jh@j-K-=;DH----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-协方差投影-5nyvt{rq-vu-t}yn-_r{qr]|tnz6----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----sy|n-zvq-J-5p|?Qzh=jh=j-8-p|?Qzh>jh>j6-<-?;=H----sy|n-nqv-J-yr{tu5rp?55p|?Qzh=jh=j-:-p|?Qzh>jh>j6-<-?;=9-p|?Qzh=jh>j66H----sy|n-ynzoqn>-J-zvq-8-nqvH----sy|n-ynzoqn?-J-zvq-:-nqvH----vs-5ynzoqn?-I-=;=6-\n--------r{H----\f----rp?-qvnt|{nycrp|-J-{|znyv r5rp?5p|?Qzh=jh>j9-ynzoqn>-:-p|?Qzh=jh=j66H----<<-协方差已在-}npx-阶段-×A(与-t}yn-对齐),故用-\05?7ynzoqn6-而非-\05E7ynzoqn6----rp?-znw|N\x07v-J-zv{5\05?;=-7-ynzoqn>69-zn\x07`prr{`}npr`}yn`v r6-7-qvnt|{nycrp|H----rp?-zv{|N\x07v-J-zv{5\05?;=-7-ynzoqn?69-zn\x07`prr{`}npr`}yn`v r6-7-rp?5qvnt|{nycrp|;\b9-:qvnt|{nycrp|;\x076H----<<-\0nq-顶点为-h:?9?j,等价于-t}yn-的-}|vv|{-7-n\x07v-<-vr}|----rp?-onvcvr}|-J-rp?5>;=-<-r|yv|{;\x079->;=-<-r|yv|{;\b6H----rp?-{qp\\ssr-J-5]|vv|{;\x07-7-znw|N\x07v-8-]|vv|{;\b-7-zv{|N\x07v6-7-onvcvr}|H0vs-R[NOYRlT`lV[ValN[VZNaV\\[----sy|n-sv{ny`pnyr]|tr-J-v{O|{qS|Nttrtnv|{-L-pnyr]|tr-G-5lnttrtnv|{]|tr-7-lnttrtnv|{]|tr-7-lnttrtnv|{]|tr6H----{qp\\ssr-7J-zv\x075=;>9->;=9-sv{ny`pnyr]|tr6H0r{qvs----rpA-\0nq]|-J-rpA5{qpPr{r;\x07\b-8-{qp\\ssr9-{qpPr{r; 9->;=6H----tyl]|vv|{-J-\0nq]|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|{-直接传-h:?9?j-的-\0nq-坐标给-sntzr{(与-t}yn-一致)----b-J-}|vv|{;\x07\bH\f"),fragment_default=function(...e){let t=113,n=126,r=0,o=``;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-
|
|
2953
|
-
----<<-与-t}yn-_r{qr]|tnz-一致:]|vv|{-为-h:?9?j-的-\0nq-坐标----sy|n-N-J-:q|5]|vv|{9-]|vv|{6H----vs-5N-I-:A;=6-qvpnqH----rp@-p|y|-J-P|y|;toH----sy|n-|}npv\b-J-r\x07}5N6-7-P|y|;nH----tylSntP|y|-J-rpA5p|y|;to9-|}npv\b6H\f`);init_pbmGaussianSplattingObject();var _sortPos0=new three.Vector3,_sortPos1=new three.Vector3,_sortQuat0=new three.Quaternion,_sortQuat1=new three.Quaternion,_sortScl=new three.Vector3,PBMGaussianSplattingRenderMesh=class extends three.Mesh{constructor(){super(),this.needsRender=!1,this.sortWorker=null,this.splatIndexCapacity=0,this.sortDataUploaded=!1,this.usedSHDegree=0,this.transformStore=null,this.transformsDirty=!1,this.layerRegistry=null,this.shStore=null,this.orderTexture=null,this.assembler=null,this.reorderPass=null,this.orderTarget=null,this.orderBaseSnapshot=[],this.sortGeneration=0,this.snapshotByGen=new Map,this.orderCount=0,this.orderDirty=!1,this.layoutDirty=!1,this.lastObjectsHash=``,this.lastClipperHash=``,this.prevSortCameraMatrix=null,this.sortCameraDistance=1,this.sortCameraCoorient=.99,this.sortMinIntervalMs=0,this.sortLastTime=-1/0,this.onBeforeRender=(e,t,n)=>{let r=n,o=this.collectObjects(t);if(o.length===0){this.geometry.instanceCount=0;return}let s=0,c=!1;for(let e of o)e.usedSHDegree>s&&(s=e.usedSHDegree),e.initAnimationEnabled&&(c=!0);let l=s!==this.usedSHDegree;this.usedSHDegree=s,this.updateInitAnimationDefine(c),this.isSceneChanged(o)?this.rebuild(e,o):l&&this.updateSH(o);for(let e of o)e.transformChanged&&this.transformStore.indexOf(e)!==void 0&&(this.transformStore.updateOne(e),this.transformsDirty=!0,e.transformChanged=!1,e.selectedChanged=!1);let u=new three.Matrix4().multiplyMatrices(r.perspectiveProjectionMatrix,r.matrixWorldInverse);this.requestSort(r,u.elements),(this.orderDirty||this.layoutDirty)&&(this.runReorder(e),this.orderDirty=!1,this.layoutDirty=!1);let d=o.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(`|`);d!==this.lastClipperHash&&(this.updateClipperUniforms(o),this.lastClipperHash=d,this.needsRender=!0),this.material.uniforms.resolution.value.set(r.resolution.x,r.resolution.y)},this.geometry=this.createGeometry(),this.material=this.createMaterial(),this.orderTexture=new OrderTexture,this.assembler=new SplatAssembler,this.reorderPass=new ReorderPass,this.transformStore=new TransformStore,this.layerRegistry=new LayerRegistry,this.shStore=new SHStore,this.material.uniforms.u_orderTexture.value=this.orderTexture.texture,this.material.uniforms.u_orderWidth.value=this.orderTexture.width,this.frustumCulled=!1,this.renderOrder=-99999999999,this.sortWorker=new WorkerWrapper,this.sortWorker.postMessage({warmup:!0}),this.sortWorker.onmessage=e=>{var t;if(e.data.depthIndex){let n=e.data.depthIndex;this.applyDepthIndex(n,e.data.generation);let r=n.buffer;r.byteLength>0&&((t=this.sortWorker)==null||t.postMessage({returnBuffer:r},[r]))}}}createGeometry(){let e=new three.InstancedBufferGeometry,t=new Float32Array([-2,-2,0,2,-2,0,2,2,0,-2,2,0]);e.setAttribute(`position`,new three.BufferAttribute(t,3)),e.setIndex(new three.BufferAttribute(new Uint16Array([0,1,2,0,2,3]),1)),this.splatIndexCapacity=1;let n=new Float32Array(this.splatIndexCapacity),r=new three.InstancedBufferAttribute(n,1,!1,1);return r.setUsage(three.DynamicDrawUsage),e.setAttribute(`splatIndex`,r),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}ensureSplatIndexCapacity(e){let t=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return t;let n=Math.max(this.splatIndexCapacity,1);for(;n<e;)n*=2;let r=new Float32Array(n);r.set(t.array.subarray(0,Math.min(t.array.length,n)));let o=new three.InstancedBufferAttribute(r,1,!1,1);return o.setUsage(three.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,o),this.splatIndexCapacity=n,this.geometry._maxInstanceCount=n,o}createMaterial(){return new three.ShaderMaterial({vertexShader:vertex_default,fragmentShader:fragment_default,defines:{NUM_GS_LAYERS:0,NUM_GS_CLIPPERS:0,ENABLE_GS_INIT_ANIMATION:0,USE_ORDER_TEXTURE:1},uniforms:{u_texture:{value:null},u_transforms:{value:null},u_orderTexture:{value:null},u_orderWidth:{value:2048},u_numPoints:{value:0},u_numGsLayers:{value:0},u_numGsClippers:{value:0},u_layerClipperRanges:{value:[]},u_clipperMatricesInverse:{value:[]},u_shTexture:{value:null},u_shTextureSize:{value:new three.Vector2},u_maxShDegree:{value:0},resolution:{value:new three.Vector2},u_aggregationProgress:{value:0},u_aggregationBoundsMin:{value:new three.Vector3(0,0,0)},u_aggregationBoundsMax:{value:new three.Vector3(0,0,0)},u_aggregationPointDuration:{value:.6}},side:three.DoubleSide,transparent:!0,blending:three.NormalBlending,depthTest:!0,depthWrite:!1})}rebuildTransformsTexture(e){this.transformStore.sync(e),this.material.uniforms.u_transforms.value=this.transformStore.texture,this.transformsDirty=!0}rebuildAssembled(e,t){this.assembler.sync(t,e=>({transformIndex:this.transformStore.indexOf(e),layerIndex:this.layerRegistry.layerIndexOf(e)})),this.assembler.assemble(e),this.material.uniforms.u_texture.value=this.assembler.texture}updateSH(e){this.shStore.sync(e,this.usedSHDegree),this.material.uniforms.u_shTexture.value=this.shStore.texture,this.material.uniforms.u_shTextureSize.value.copy(this.shStore.textureSize),this.material.uniforms.u_maxShDegree.value=this.shStore.appliedDegree}applyDepthIndex(e,t){let n=e.length,r=this.ensureSplatIndexCapacity(n);r.array.set(e,0),r.count=n,r.updateRange.offset=0,r.updateRange.count=n,r.needsUpdate=!0,this.orderTexture&&this.orderTexture.update(e);let o=this.snapshotByGen.get(t);if(o){this.orderBaseSnapshot=o;for(let e of this.snapshotByGen.keys())e<t&&this.snapshotByGen.delete(e)}this.orderCount=n,this.orderDirty=!0,this.geometry.instanceCount=n,this.needsRender=!0}snapshotLayout(){return this.assembler?this.assembler.regions.map(e=>({object:e.object,start:e.start,count:e.count})):[]}buildSegments(e,t){let n=new Map;for(let e of t)n.set(e.object,e.start);let r=[];for(let t of e){let e=n.get(t.object),o=e===void 0,s=o?0:e-t.start,c=r[r.length-1];c&&c.removed===o&&(o||c.delta===s)&&c.oldEnd===t.start?c.oldEnd=t.start+t.count:r.push({oldStart:t.start,oldEnd:t.start+t.count,delta:s,removed:o})}return r}runReorder(e){if(!this.reorderPass||!this.orderTexture||this.orderCount===0)return;let t=this.snapshotLayout(),n=this.buildSegments(this.orderBaseSnapshot,t),r=this.orderTexture.width,o=Math.max(1,Math.ceil(this.orderCount/r));this.orderTarget?(this.orderTarget.width!==r||this.orderTarget.height<o)&&this.orderTarget.setSize(r,Math.max(this.orderTarget.height,o)):this.orderTarget=ReorderPass.createOrderTarget(r,o),this.reorderPass.run(e,this.orderTexture.texture,r,this.orderTarget,n);let s=0;for(let e of t)s+=e.count;this.material.uniforms.u_orderTexture.value=this.orderTarget.texture,this.material.uniforms.u_orderWidth.value=r,this.material.uniforms.u_numPoints.value=s}postSortData(){var e;let t=++this.sortGeneration;this.snapshotByGen.set(t,this.snapshotLayout());let{positions:n,transformIndices:r,count:o}=this.assembler.extractSortInputs(),s=this.transformStore.transforms.slice(0,this.transformStore.objectCount*20);(e=this.sortWorker)==null||e.postMessage({sortData:{positions:n,transforms:s,transformIndices:r,vertexCount:o,generation:t}},[n.buffer,s.buffer,r.buffer]),this.sortDataUploaded=!0,this.transformsDirty=!1}shouldSort(e){if(this.transformsDirty||!this.sortDataUploaded||!this.prevSortCameraMatrix)return!0;this.prevSortCameraMatrix.decompose(_sortPos0,_sortQuat0,_sortScl),e.matrixWorld.decompose(_sortPos1,_sortQuat1,_sortScl);let t=_sortPos0.distanceTo(_sortPos1),n=Math.abs(_sortQuat0.dot(_sortQuat1));return t>this.sortCameraDistance||n<this.sortCameraCoorient}requestSort(e,t){var n;!this.assembler||this.assembler.totalPoints===0||this.shouldSort(e)&&(performance.now()-this.sortLastTime<this.sortMinIntervalMs||((this.transformsDirty||!this.sortDataUploaded)&&this.postSortData(),(n=this.sortWorker)==null||n.postMessage({viewProj:t}),this.prevSortCameraMatrix||(this.prevSortCameraMatrix=new three.Matrix4),this.prevSortCameraMatrix.copy(e.matrixWorld),this.sortLastTime=performance.now()))}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof PBMGaussianSplattingObject&&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)}),t}isSceneChanged(e){let t=e.map(e=>`${e.uuid}:${e.gsViewLayerKey}`).join(`|`);return t===this.lastObjectsHash?!1:(this.lastObjectsHash=t,!0)}rebuild(e,t){this.sortDataUploaded=!1,this.layerRegistry.sync(t),this.rebuildTransformsTexture(t),this.rebuildAssembled(e,t),this.material.uniforms.u_numPoints.value=this.assembler.totalPoints,this.ensureSplatIndexCapacity(this.assembler.totalPoints),this.updateSH(t),this.lastClipperHash=``,this.layoutDirty=!0,this.needsRender=!0}updateClipperUniforms(e){var t,n;let r=this.layerRegistry;if(!r||r.layerCount===0){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=r.layerKeys.length,c=0;for(let e of r.layerKeys)c+=((t=o.get(e))==null?[]:t).length;let l=Array.from({length:s},()=>new three.Vector2(-1,0)),u=Array.from({length:c},()=>new three.Matrix4),d=0;for(let e of r.layerKeys){let t=r.layerKeyToIndex.get(e);if(t===void 0)continue;let s=(n=o.get(e))==null?[]:n,c=d;for(let e of s)u[d].getInverse(e.clippingBoxMatrix),d++;s.length>0&&l[t].set(c,s.length)}this.material.uniforms.u_layerClipperRanges.value=l,this.material.uniforms.u_clipperMatricesInverse.value=u,this.updateClipperCounts(s,d)}updateClipperCounts(e,t){let n=this.material.defines;(n.NUM_GS_LAYERS!==e||n.NUM_GS_CLIPPERS!==t)&&(n.NUM_GS_LAYERS=e,n.NUM_GS_CLIPPERS=t,this.material.needsUpdate=!0),this.material.uniforms.u_numGsLayers.value=e,this.material.uniforms.u_numGsClippers.value=t}updateInitAnimationDefine(e){let t=this.material.defines,n=+!!e;t.ENABLE_GS_INIT_ANIMATION!==n&&(t.ENABLE_GS_INIT_ANIMATION=n,this.material.needsUpdate=!0,this.needsRender=!0)}dispose(){this.sortWorker&&(this.sortWorker.terminate(),this.sortWorker=null),this.assembler&&(this.assembler.dispose(),this.assembler=null),this.reorderPass&&(this.reorderPass.dispose(),this.reorderPass=null),this.orderTarget&&(this.orderTarget.dispose(),this.orderTarget=null),this.transformStore&&(this.transformStore.dispose(),this.transformStore=null),this.shStore&&(this.shStore.dispose(),this.shStore=null),this.layerRegistry=null,this.orderTexture&&(this.orderTexture.dispose(),this.orderTexture=null),this.geometry.dispose(),this.material.dispose()}};init_pbmGaussianSplattingObject();var PBMGaussianSplattingTestMesh=class extends three.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 PBMGaussianSplattingObject&&e.visible&&t.push(e)}),t}},DEFAULT_MODE_CHANGE_DURATION=1e3,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=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/`),scratchSphere=new three.Sphere,scratchBox3=new three.Box3,scratchViewport=new three.Vector4,scratchScissor=new three.Vector4,scratchClearColor=new three.Color,scratchRenderSize=new three.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five_Instances={},Five=class e extends Subscribe{static get version(){return`6.9.0-alpha.2`}static get dracoPath(){return draco.decoderPath}static set dracoPath(e){draco.setDecoderPath(e)}static get ktx2Path(){return ktx2.transcoderPath}static set ktx2Path(e){ktx2.setTranscoderPath(e)}static get useNativeImageBitmap(){return canUseNativeImageBitmap()}static set useNativeImageBitmap(e){useNativeImageBitmap(e)}constructor(e={}){var t,n,r,o,s,c,l,u,d,f,p;if(super(),this.pbmGaussianSplattingRenderMesh=null,this.fiveId=createUuid$1(),Five_Instances[this.fiveId]=this,this.currentUpdateArgs={time:now(),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=(o=e.poweredByRealsee)==null?!0:o,this.backgroundColor=new three.Color((s=e.backgroundColor)==null?1579548:s),this.backgroundAlpha=(c=e.backgroundAlpha)==null?1:c,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:now()},this.modeChangeDuration=(l=e.modeChangeDuration)==null?DEFAULT_MODE_CHANGE_DURATION:l,this.enableWheel=(u=e.enableWheel)==null?!0:u,typeof window<`u`)if(`renderer`in e)e.renderer instanceof InternalWebGLRenderer&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=getViewportScale();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 three.WebGLRenderTarget(1,1,{encoding:(f=(d=this.renderer)==null?void 0:d.outputEncoding)==null?three.sRGBEncoding:f,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new Camera(DEFAULT_CAMERA_FOV),this.scene=new Scene,this.xrCustomObjectsScene=new three.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.loadWorkTask=Promise.resolve(),this.requestProxy=(p=e.requestProxy)==null?DEFAULT_REQUEST_PROXY:p,this.networkSubscribe=new NetworkSubscribe,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var o;this.emit(`network.resource`,createEvent(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(o=this.analysis)==null||o.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new three.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),worksMap.set(this,emptyWorks),this.modelScene=new ModelScene({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[m]=this.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0});defineProperty(m,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new three.VideoTexture(e.videoInstance||generateDefaultVideoElement());let h=initLights();this.scene.add(h),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=AnimationFrameLoop.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let g=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,createEvent(`vr.requestExit`,{}))},_=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,g,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,_,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,g,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,_,!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)}}}initLegacyEvent(this),this.fiveRenderer=new FiveRenderer,this.adaptiveLuminancePass=new AdaptiveLuminancePass,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new EyeDomeLightingPass(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGaussianSplattingRenderMesh=new PBMGaussianSplattingRenderMesh,this.scene.add(this.pbmGaussianSplattingRenderMesh)):this.scene.add(new PBMGaussianSplattingTestMesh)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}get panoId(){return panoStringify(this.pano)}dispose(){var e;if(this.destroyed===!0)return;delete Five_Instances[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(),worksMap.set(this,emptyWorks),this.renderer&&this.renderer.render(new three.Scene,new three.Camera),this.fiveRenderer.dispose(),this.renderer instanceof InternalWebGLRenderer&&(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`,createEvent(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,omitUndefinedFields(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,omitUndefinedFields(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,omitUndefinedFields(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,omitUndefinedFields(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,omitUndefinedFields(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,omitUndefinedFields(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.xrPanorama&&(Object.assign(this.controllerInits.XRPanorama,omitUndefinedFields(e.xrPanorama)),this.currentMode===`XRPanorama`&&(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 InternalWebGLRenderer)){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,o;if(!this.renderer)return;let s=this.renderer.domElement.parentNode,{width:c=(n=s==null?void 0:s.offsetWidth)==null?512:n,height:l=(r=s==null?void 0:s.offsetHeight)==null?512:r}=e;if(c=Math.max(1,c),l=Math.max(1,l),!t){let e=getViewportScale(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(o=e===1?n:1)==null?1:o,t>1){let e=Math.max(c,l)*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(c,l),this.needsRender=!0;let u=now(),d=u-this.currentUpdateArgs.time,f=this.currentUpdateArgs.args;this.updateTime(u,d,...f)}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 worksMap.get(this)||emptyWorks}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 o=this.loadWorkTask.then(()=>isPromise(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=o.catch(e=>{this.throwError(e)}),o}load_(t,n,r,o=!0){var s,c,l,u,d,f,p,m,h,g;let _={};typeof r==`number`?_.duration=r:typeof r==`object`&&Object.assign(_,r),this.works===emptyWorks&&(_.duration===void 0&&(_.duration=0),_.effect===void 0&&(_.effect=`instant`));let v={};Object.assign(v,_.model),!v[`3d-tiles`]&&_[`3d-tiles`]&&(v[`3d-tiles`]=_[`3d-tiles`]),!v.textureOptions&&_.textureOptions&&(v.textureOptions=_.textureOptions),!v.textureOptions&&this.textureOptions&&(v.textureOptions=this.textureOptions);let y=[];if(Array.isArray(t))for(let e of t)e instanceof Work?y.push(e):typeof e!=`string`&&`work`in e?y.push(parseWork(e.work,e)):y.push(parseWork(e));else t instanceof Work?y.push(t):y.push(parseWork(t));_.mode===`add`&&(y=[].concat(this.works,y));let b;try{b=createWorks(y)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of b)this.bindWorkFetcher(e);n===void 0&&(n=`inherit`),n===`inherit`&&this.works===emptyWorks&&(n=`initial`);let S=this.currentMode,C=b.initial,w=C.work.observers[0],T=w?{workCode:w.work.workCode,panoIndex:w.panoIndex}:{workCode:C.work.workCode,panoIndex:0},E=(s=C.mode)==null?w?`Panorama`:`Mapview`:s,D={};if(n===`inherit`){let e=this.getCurrentState(),[t]=b.filter(t=>t.workCode===e.workCode);if(t)T={workCode:e.workCode,panoIndex:e.panoIndex},E=e.mode,D={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{n={mode:S};let e=(l=(c=b[0])==null?void 0:c.observers)==null?void 0:l[this.panoIndex];e?(n.workCode=e.work.workCode,n.panoIndex=e.panoIndex):typeof b.initial.panoIndex==`number`?(n.workCode=b.initial.work.workCode,n.panoIndex=b.initial.panoIndex):(n.mode===`Panorama`||n.mode===`VRPanorama`||n.mode===`XRPanorama`)&&(n.mode=`Mapview`),n.mode===S&&(n.longitude=this.camera.pose.longitude,n.latitude=this.camera.pose.latitude,n.fov=this.camera.pose.fov)}}if(n===`initial`&&(typeof C.panoIndex==`number`&&(T={workCode:C.work.workCode,panoIndex:C.panoIndex}),C.mode&&(E=C.mode),D={longitude:C.longitude,latitude:C.latitude,fov:C.fov,distance:C.distance,offset:(u=C.offset)==null?void 0:u.clone()}),typeof n==`object`){if(E=(d=n.mode)==null?S:d,typeof n.panoIndex==`number`){let e=b.getObserver({workCode:(p=(f=n.workCode)==null?C.work.workCode:f)==null?``:p,panoIndex:n.panoIndex});e&&(T={workCode:e.work.workCode,panoIndex:e.panoIndex})}D={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset?new three.Vector3().copy(n.offset):void 0}}let O=(m=_.duration)==null?this.modeChangeDuration:m;(E===`Floorplan`||E===`Topview`||E===`Mapview`)&&S===E&&(O=0);let k=`fly`;(E===`Panorama`||E===`VRPanorama`||E===`XRPanorama`)&&S===E&&(k=(h=_.effect)==null?`fade`:h),this.emit(`works.request`,createEvent(`works.request`,{input:t,works:b,userAction:o}));let A=(e,t,r)=>{let s=this.getCurrentState(),c=Object.assign(Object.assign({mode:e},t),r);n===`inherit`&&(c=this.getCurrentState()),this.pano=t;let l=Object.assign(Object.assign({initial:{state:c,currentState:s,duration:O,effect:k,userAction:o}},this.commonParams()),this.controllerInits[e]),u=Controllers[c.mode].initAnimationEndState(l);if(this.controller&&S===e)this.controller.updateWork(b,u,{effect:k,duration:O},o)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,l));else{if(this.controller)this.controller.destroy();else{let t=Controllers[e].initAnimationEndState(l);this.camera.setFromPose(t),this.emit(`camera.update`,createEvent(`camera.update`,{state:this.getCurrentState(),userAction:o}))}this.controller=this.applyController(e,l);let t=createEvent(`mode.change`,{prevMode:S,mode:e,state:u,userAction:o});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};worksMap.set(this,b);let j=Promise.resolve();if(E===e.Mode.Floorplan||E===e.Mode.Topview||E===e.Mode.Mapview||E===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(D),assignPose(this.state,this.camera.pose));let e=this.modelScene.setModels(b,v);j=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,A(E,T,D),this.emit(`camera.update`,createEvent(`camera.update`,{state:this.getCurrentState(),userAction:o}))})}else{A(E,T,D);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===b&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,createEvent(`camera.update`,{state:this.getCurrentState(),userAction:o})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(b,v);j=Promise.all(r.map(e=>e.initReady)).then(noop),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((g=_.duration)==null?this.modeChangeDuration:g)+1e3)}return this.emit(`works.load`,createEvent(`works.load`,{input:t,userAction:o,works:b})),j.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,createEvent(`works.ready`,{input:t,userAction:o,works:b})),(e=this.analysis)==null||e.work(b)})}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}),worksMap.set(this,emptyWorks),this.modelScene.setModels(emptyWorks,{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:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new three.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,o=!0,s=!1){return new Promise((c,l)=>{var u,d,f,p;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let m=0;this.controller&&(m=typeof r==`number`?r:(u=r==null?void 0:r.duration)==null?this.modeChangeDuration:u);let h=`fly`;this.controller&&typeof r==`object`&&r.effect&&(h=r.effect);let g=typeof n.panoIndex==`number`?{workCode:(p=(d=n.workCode)==null?(f=this.work)==null?void 0:f.workCode:d)==null?``:p,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),l(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(g)){let e=Error(`PanoId ${panoStringify(g)} not existed.`);this.throwError(e),l(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(m=0);let _=this.controller,v=this.currentMode,y=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&s===!1&&v===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!panoEqual(this.pano,g)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(g,Object.assign({duration:m},n),o):this.controller.updateCamera(n,m,o).catch(noop):(panoEqual(this.pano,g)||(this.pano=g),this.controller.updateCamera(n,m,o).catch(noop));else{let e=Object.assign(Object.assign({},n),g),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:m,effect:h,userAction:o}},this.commonParams()),this.controllerInits[t]),s=Controllers[t].initAnimationEndState(r),c=createEvent(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:s,userAction:o});if(this.emit(`mode.change.request`,c),!c.defaultPrevented){_&&_.destroy(),this.controller=this.applyController(t,r);let e=createEvent(`mode.change`,{prevMode:this.currentMode,mode:t,state:s,userAction:o});this.emit(`mode.change`,e)}}c()},b=AnimationFrameLoop.shared.getContext();b&&(typeof XRSession<`u`&&b instanceof XRSession&&b.end(),AnimationFrameLoop.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),requestDeviceOrientationPermission().then(()=>y()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),l(t)})):t===e.Mode.XRPanorama?requestXRSessionPermission().then(e=>{AnimationFrameLoop.shared.setContext(e),s=!0,y()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),l(t)}):y()})}getPixels(e,t,n,r,o,s,c){if(!this.renderer)throw Error(`renderer is not initialized.`);let l=now(),u=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),f=this.getSize(new three.Vector2),p=0,m=0,h=1,g=1,_,v,y,b,S;typeof e==`number`?(p=e,typeof t==`number`&&(m=t),typeof n==`number`&&(h=n),typeof r==`number`&&(g=r),_=o,v=s,S=c):(p=e.x,m=e.y,h=e.width,g=e.height,_=e.pixelRatio,v=e.flipY,y=e.helperVisible,b=e.skipPanorama,S=e.buffer),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g),_=Math.floor(_==null?u:_),v=v==null?!1:v;let C=this.helperVisible,w=this.modelScene.parameter.modelAlpha;this.helperVisible=y==null?this.helperVisible:y,b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&b===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let T=this.getPixelsRenderTarget;T.setSize(h*_,g*_),this.renderer.setRenderTarget(T),this.camera.pixelRatio=_,this.camera.resolution.set(h,g),this.camera.setViewOffset(f.width,f.height,p,f.height-m-g,h,g),this.camera.aspect=f.width/f.height,this.camera.updateTime(l),this.scene.update(this.renderer,this.camera);let E=this.renderer.autoClear,D=this.renderer.autoClearColor,O=this.renderer.autoClearDepth,k=this.renderer.autoClearStencil,A=scratchClearColor.copy(this.renderer.getClearColor()),j=this.renderer.getClearAlpha(),M=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let N=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:N,this.renderer.render(this.scene,this.camera),this.scene.background=N,this.renderer.autoClear=E,this.renderer.autoClearColor=D,this.renderer.autoClearDepth=O,this.renderer.autoClearStencil=k,this.renderer.setClearColor(A,j),this.renderer.setScissorTest(M),this.helperVisible=C,w===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,w),this.renderer.setRenderTarget(d),this.camera.clearViewOffset(),this.camera.pixelRatio=u,this.camera.resolution.copy(f),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(l),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let P=h*_,F=g*_,I=P*F,L=I*4;if(S){if(S.length!==L)throw Error(`buffer length is not equals pixels ${L}`)}else S=new Uint8Array(L);if(this.renderer.readRenderTargetPixels(T,0,0,h*_,g*_,S),v){let e=I/2;for(let t=0,n=0,r=0,o=0;n<e;n++)for(o=(F-Math.floor(n/P)-1)*P+n%P,r=0;r<4;r++)t=S[n*4+r],S[n*4+r]=S[o*4+r],S[o*4+r]=t}return S}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,o=t.autoClearColor,s=t.autoClearDepth,c=t.autoClearStencil,l=scratchClearColor.copy(t.getClearColor()),u=t.getClearAlpha(),d=t.getViewport(scratchViewport),f=t.getScissor(scratchScissor),p=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let m=t.getSize(scratchRenderSize),h=Math.floor(m.x*this.viewport.left),g=Math.floor(m.y*this.viewport.bottom),_=Math.floor(m.x*this.viewport.width),v=Math.floor(m.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(h,g,_,v),t.setScissor(h,g,_,v);let y=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(y);let b=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:b;let S=!0;if(this.controller&&this.controller.render()&&(S=!1),S){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&renderPoweredByRealsee(t)}this.scene.background=b,t.autoClear=r,t.autoClearColor=o,t.autoClearDepth=s,t.autoClearStencil=c,t.setClearColor(l,u),t.setViewport(d),t.setScissor(f),t.setScissorTest(p),t.setRenderTarget(n),e&&AnimationFrameLoop.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&ktx2.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),AnimationFrameLoop.shared.add(()=>{this.emit(`models.load`,createEvent(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(()=>{this.emit(`models.refined`,createEvent(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.modelScene.boundingMesh);let t=scratchBox3.getBoundingSphere(scratchSphere),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius),n=clamp$1(n,800);let r=n/1e4;r=clamp$1(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=createEvent(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let o=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,createEvent(`render`,{needsRender:o})),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 InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:o,renderer:s}=this;if(!o)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!s)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let c=this.works.getObserver(t);if(!c)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let l={workCode:c.work.workCode,panoIndex:c.panoIndex};return`moveToPano`in o&&typeof o.moveToPano==`function`?o.moveToPano(l,n,r):c&&(this.pano=l,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=noop){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`],o=now();return Promise.all(r.map(e=>{let t=panoStringify({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},pick(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),o=n.work.getURL(n.images[e]),s=this.imageOptions.transform?this.imageOptions.transform(o,r):imageURL(o,r);return getFetcher(this.fiveId,n.work).preload(s)})).then(()=>{let e=now()-o;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 three.Raycaster(t,n.clone().normalize());r.params.Points={threshold:.1};let[o]=this.modelScene.intersectRaycaster(r);if(o&&o.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 three.Vector2),o=r.x*this.viewport.width,s=r.y*this.viewport.height,c=r.x*this.viewport.left+(n.x+1)/2*o,l=r.y*(1-this.viewport.bottom-this.viewport.height)+(-n.y+1)/2*s;return new three.Vector2(c,l)}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,o,s,c,l,u,d,f,p,m;e=pick(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof three.Vector3)&&(e.offset=new three.Vector3(e.offset.x,e.offset.y,e.offset.z));let h;if(typeof e.panoIndex==`number`)if(e.workCode)h={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(o=(r=this.work)==null?void 0:r.workCode)==null?``:o,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),h={workCode:t,panoIndex:e.panoIndex}}let g=(s=e.mode)==null?this.state.mode:s,_,v,y,b,S;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==g){if(g===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let t={workCode:h==null?void 0:h.workCode,panoIndex:h==null?void 0:h.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 three.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[g]),r=Controllers[g].initAnimationEndState(n);_=r.longitude,v=r.latitude,y=r.fov,b=r.offset,S=r.distance}else _=(c=e.longitude)==null?this.state.longitude:c,v=(l=e.latitude)==null?this.state.latitude:l,y=(u=e.fov)==null?this.state.fov:u,b=(d=e.offset)==null?this.state.offset:d,S=(f=e.distance)==null?this.state.distance:f;let C={workCode:(h==null?this.pano:h).workCode,panoIndex:(h==null?this.pano:h).panoIndex,mode:g,longitude:_,latitude:v,fov:y,offset:b,distance:S};this.emit(`state.set`,createEvent(`state.set`,{userAction:n,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode===`VRPanorama`&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode(`VRPanorama`)):this.controller&&C.mode===`XRPanorama`&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode(`XRPanorama`)):(assignState(this.state,C),this.controller&&n&&(this.controller.userAction=!1),t&&this.state.mode===C.mode&&(this.syncingState=this.syncState(now(),0,t),this.syncingState&&((p=this.controller)==null||p.updateTime(now(),0),this.syncingState=!1)),this.emit(`state.change`,createEvent(`state.change`,{userAction:n,state:this.state})),(m=this.analysis)==null||m.state(this.works,this.state)))}syncState(t,n,r=!1){let o=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 Controllers.Model){if(notSimilarVector3(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(!panoEqual(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 Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){let e=1,t=.2,n=.2,o=Math.PI/45,s=r?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,1),c=Math.abs(this.camera.pose.distance-this.state.distance),l=c>n*15?c/15:.2,u=r?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,l),d=this.camera.pose.offset.distanceTo(this.state.offset),f=d>n*15?d/15:n,p=r?new three.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,f),{longitude:m,latitude:h}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},o);if(notSimilarValue(s,this.camera.pose.fov)||notSimilarVector3(p,this.camera.pose.offset)||notSimilarValue(u,this.camera.pose.distance)||notSimilarValue(m,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(h,this.camera.pose.latitude)){let e={x:p.x,y:p.y,z:p.z},t={fov:s};return Object.assign(e,{distance:u}),Object.assign(t,{longitude:m,latitude:h}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(noop),this.controller.locationMotion.set(e,0).catch(noop),!0}}else{let e=1,t=Math.PI/45,n=r?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,1),{longitude:o,latitude:s}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},t),c=this.state.distance,l=new three.Vector3().copy(this.state.offset);if(notSimilarValue(c,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(l,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(o,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(s,this.camera.pose.latitude)||notSimilarValue(n,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:o,latitude:s,fov:n},0).catch(noop),!0}if(this.stateSynced=!0,o===!1&&this.emit(`state.synced`,createEvent(`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 Controllers.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(noop)}requestFullscreen(){var e;if(!isMobile)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=()=>{AnimationFrameLoop.shared.add(()=>{this.emit(`model.load`,createEvent(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,createEvent(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,createEvent(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},o=t=>{this.emit(`models.tileLoad`,createEvent(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},s=t=>{this.emit(`models.tileUnload`,createEvent(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},c=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,o),e.removeEventListener(`tileUnload`,s),e.removeEventListener(`dispose`,c)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,o),e.addEventListener(`tileUnload`,s),e.addEventListener(`dispose`,c),this.emit(`model.request`,createEvent(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,o=new Fetcher({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=verifyURL(e,r);return t instanceof Error?Promise.reject(t):t})}});registerFetcher(this.fiveId,e,o)}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=Controllers[t];this.currentMode=t;let o=new r(n);for(let e of PROXY_CONTROLLER_EVENT_NAMES)o.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=Controllers[t].initAnimationEndState(n),r=n.initial.userAction;stateEqual(this.state,e)||(assignState(this.state,e),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,createEvent(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return o.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,createEvent(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),o.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),o.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&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),o.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&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),o.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&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),o.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),o.on(`pano.error`,e=>{var t;let{state:n}=e;this.state.mode===n.mode&&!stateEqual(this.state,n)&&(assignState(this.state,n),(t=this.analysis)==null||t.state(this.works,this.state))}),o.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,createEvent(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),o.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),o.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),o.on(`error`,e=>this.throwError(e)),o}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:o}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:o}}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 three.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 three.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}};Five.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`&&Object.assign(window,{__FIVE_DEBUG__:{THREE:three,constructor:Five,instances:Five_Instances}});var XRButton=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 o(){r(),t.textContent=`VR NOT SUPPORTED`}function s(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`,s(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():o()}),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`,s(e),e}}};exports.AdaptiveLuminancePass=AdaptiveLuminancePass,exports.AnimationFrameLoop=AnimationFrameLoop,exports.BoundingMesh=BoundingMesh,exports.Camera=Camera,exports.CustomShader=PBMCustomShader,exports.PBMCustomShader=PBMCustomShader,exports.EffectComposer=EffectComposer,exports.EyeDomeLightingPass=EyeDomeLightingPass,exports.Fetcher=Fetcher,exports.Five=Five,exports.FivePass=FivePass,exports.FiveRenderer=FiveRenderer,exports.FlowingFireworks3DPass=FlowingFireworks3DPass,exports.FlowingLight2DPass=FlowingLight2DPass,exports.FlowingLight3DPass=FlowingLight3DPass,exports.FullScreenQuad=FullScreenQuad,exports.GaussianBlurPass=GaussianBlurPass,exports.Histogram=Histogram,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.Model=Model,exports.ModelScene=ModelScene,exports.Motion=Motion,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMGSObject=PBMGaussianSplattingObject,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PBMPanoFilter=PBMPanoFilter,exports.PBMPointCloud=PBMPointCloud,exports.PBMPointCloudMaterial=PBMPointCloudMaterial,exports.PBMSkinnedMesh=PBMSkinnedMesh,exports.PBMUpdateable=PBMUpdateable,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.Parameter=Parameter,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3D=Tile3D,exports.Tile3DModel=Tile3D,exports.TileCache=TileCache,exports.TileNode=TileNode,exports.TileRequestScheduler=TileRequestScheduler,exports.Tileset=Tileset,exports.Trajectory=Trajectory,exports.TrajectoryNode=TrajectoryNode,exports.Work=Work,exports.WorkResolvedObserver=WorkResolvedObserver,exports.XRButton=XRButton,exports.controllersDefaultInitArgs=controllersDefaultInitArgs,exports.coordinatesToVector=coordinatesToVector,exports.createDebugBoundingMesh=createDebugBoundingMesh,exports.createWorks=createWorks,exports.defaultImageURLTransform=imageURL,exports.draco=draco,exports.getViewportScale=getViewportScale,exports.headingToLongitude=headingToLongitude,exports.imageSupport=imageSupport,exports.isBoundingVolume=isBoundingVolume,exports.isPanoId=isPanoId,exports.ktx2=ktx2,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadFbx=loadFbx,exports.loadGltf=loadGltf,exports.loadObj=loadObj,exports.loadPbm=loadPbm,exports.loadPly=loadPly,exports.loadPnts=loadPnts,exports.loadSpz=loadSpz,exports.loadX3p=loadX3p,exports.longitudeToHeading=longitudeToHeading,exports.makeBoundingVolume=makeBoundingVolume,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,exports.vectorToCoordinates=vectorToCoordinates,exports.workToJson=workToJson});
|
|
2952
|
+
\\v j ¼"\\v \\vAsAÿÿÿÿ\\x07q \\vA\\0H\\x1B"\\v6\\0 \\b \\vAÿÿqAtj" (\\0Aj6\\0 \\vAvAüÿqj"\\v \\v(\\0Aj6\\0 \\fAj!\\f\\f\\v\\v\\v\\0\\v\\v \\0A\\b\\v\`)}function v(e){return e}function y(e,t){var n,r=v(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function b(){return{a:F}}function x(){function e(e,t){return L=e.exports,P(L),f(),L}var t=b();return r.instantiateWasm?new Promise((n,i)=>{r.instantiateWasm(t,(t,r)=>{n(e(t,r))})}):(g!=null||(g=_()),e(y(g,t)[0]))}for(var S=e=>{for(;e.length>0;)e.shift()(r)},C=[],w=e=>C.push(e),T=[],E=e=>T.push(e),D=()=>2147483648,O=(e,t)=>Math.ceil(e/t)*t,k=e=>{var t=(e-N.buffer.byteLength+65535)/65536|0;try{return N.grow(t),f(),1}catch(e){}},A=e=>{var t=u.length;e>>>=0;var n=D();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),k(Math.min(n,O(Math.max(e,i),65536))))return!0}return!1},j=new Uint8Array(123),M=25;M>=0;--M)j[48+M]=52+M,j[65+M]=M,j[97+M]=26+M;if(j[43]=62,j[47]=63,r.noExitRuntime&&r.noExitRuntime,r.print&&r.print,r.printErr&&r.printErr,r.wasmBinary&&r.wasmBinary,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.preInit)for(typeof r.preInit==\`function\`&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.shift()();var N;function P(e){r._sort=e.d,r._malloc=e.e,r._free=e.f,N=e.b,e.__indirect_function_table}var F={a:A};function I(){p();function e(){var e;r.calledRun=!0,!s&&(m(),l==null||l(r),(e=r.onRuntimeInitialized)==null||e.call(r),h())}r.setStatus?(r.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>r.setStatus(\`\`),1),e()},1)):e()}var L=x();return I(),t=d?r:new Promise((e,t)=>{l=e}),t}),i.apply(this,arguments)}let a;function o(){return e(this,void 0,void 0,function*(){a=yield r()})}let s,c,l,u,d,f,p,m,h,g,_=0,v=0,y=!1,b=[],x=!0,S=!0,C=!1,w=!1,T=!1;function E(e,t){if(t.length!==16)return!0;for(let n=0;n<16;n++)if(Math.abs(e[n]-t[n])>1e-7)return!0;return!1}let D=[],O=65536,k=()=>e(void 0,void 0,void 0,function*(){if(C){w=!0;return}C=!0,w=!1,a||(yield o());let e=Math.pow(2,Math.ceil(Math.log2(s.vertexCount)));_<e&&(_>0&&(a._free(c),a._free(u),a._free(d),a._free(f),a._free(p),a._free(m)),_=e,c=a._malloc(64),u=a._malloc(_*4),d=a._malloc(3*_*4),f=a._malloc(_*4),p=a._malloc(_*4),m=a._malloc(_*4)),y||(h=a._malloc(O*4),g=a._malloc(O*4),y=!0),v<s.transforms.length&&(v>0&&a._free(l),v=s.transforms.length,l=a._malloc(v*4)),C=!1,w&&(w=!1,yield k())}),A=()=>{if(C||w||!a)return;C=!0,S&&(a.HEAPF32.set(s.positions,d/4),a.HEAPF32.set(s.transforms,l/4),a.HEAPU32.set(s.transformIndices,u/4),S=!1),a.HEAPF32.set(new Float32Array(b),c/4),a._sort(c,l,u,s.vertexCount,d,f,p,m,h,g);let e=s.vertexCount,t=new Uint32Array(a.HEAPU32.buffer,p,e),n=e*4,r=D.pop();(!r||r.byteLength<n)&&(r=new ArrayBuffer(n));let i=new Uint32Array(r,0,e);i.set(t),self.postMessage({depthIndex:i,generation:s.generation},[r]),C=!1,x=!1},j=()=>{T||(T=!0,x&&A(),setTimeout(()=>{T=!1,j()}))};self.onmessage=t=>new Promise(n=>e(void 0,void 0,void 0,function*(){var e;if(t.data.warmup){yield o(),n(!0);return}if(t.data.returnBuffer){D.length<3&&D.push(t.data.returnBuffer),n(!0);return}let r=!1,i=!!t.data.sortData;if(t.data.sortData&&(s={positions:t.data.sortData.positions,transforms:t.data.sortData.transforms,transformIndices:t.data.sortData.transformIndices,vertexCount:t.data.sortData.vertexCount,generation:(e=t.data.sortData.generation)==null?0:e},x=!0,S=!0,yield k(),r=!0),t.data.viewProj){let e=t.data.viewProj;(E(e,b)||i)&&(b=e,x=!0,r=!0)}r&&x&&j(),n(!0)}))})();`,blob=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,jsContent],{type:`text/javascript;charset=utf-8`});function WorkerWrapper(e){let t;try{if(t=blob&&(self.URL||self.webkitURL).createObjectURL(blob),!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(jsContent),{name:e==null?void 0:e.name})}}var vertex_default=function(...e){let t=113,n=126,r=0,o=``;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{H0vsqrs-b`Rl\\_QR_laReab_R{vs|z-uvtu}-nz}yr?Q-l|qrar\x07rH{vs|z-v{-l|qrdvquH{vs|z-v{-l{z]|v{H0ryrnvor-sy|n-}ynV{qr\x07H0r{qvs{vs|z-uvtu}-nz}yr?Q-lr\x07rH{vs|z-uvtu}-nz}yr?Q-ln{s|zH{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|{H<<-每对象渲染参数,按-n{s|zV{qr\x07-索引(与-ln{s|z-同一套索引)<<-r\x07ry-=G-h}rOyNz|{9-oyNz|{9-rrrq9-rrrqj,单位为方差-}\x07²{vs|z-uvtu}-nz}yr?Q-l|owrp]nnzH0vs-R[NOYRlT`lV[ValN[VZNaV\\[{vs|z-sy|n-lnttrtnv|{]|trH{vs|z-sy|n-lnttrtnv|{]|v{Qnv|{H{vs|z-rp@-lnttrtnv|{O|{qZv{H{vs|z-rp@-lnttrtnv|{O|{qZn\x07H0r{qvsn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bHp|{-sy|n-zn\x07`prr{`}npr`}yn`v r-J-?=AE;=H<<-}npx-阶段(qnn;p}})把-@Q-协方差整体-×A-存入-unys,因此-unqr-里的-p|?Qz<<-也是真实屏幕空间协方差的-A-倍。屏幕空间低通核以-}\x07²(方差)为单位给出,<<-加到对角线前需换算到同一量纲,即-×A。<<-这样-}rOyNz|{-<-oyNz|{-的数值语义与-`}nx-<-t}yn-完全一致(=;@-}\x07²-≈-=;BB}\x07-σ)。p|{-sy|n-P\\cl]NPXl`PNYR-J-A;=Hp|{-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-\n0vsqrs-b`Rl\\_QR_laReab_R----<<-|qr-走纹理:用实例号从-|qrar\x07r-取本实例要画的全局点索引----vrp?-|qrP||q-J-vrp?5tylV{n{prVQ-2-l|qrdvqu9-tylV{n{prVQ-<-l|qrdvqu6H----v{-}ynV{qr\x07b-J-r\x07rySrpu5l|qrar\x07r9-|qrP||q9-=6;H----<<-r|qr-标记为-`R[aV[RY5KJ-{z]|v{6-的实例被剔除----vs-5}ynV{qr\x07b-KJ-v{5l{z]|v{66-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f0ryr----v{-}ynV{qr\x07b-J-v{5}ynV{qr\x07-8-=;B6H0r{qvs----v{-}ynV{qr\x07V-J-v{5}ynV{qr\x07b6H----<<-每-}yn-?-r\x07ry-5_TON@?bV6G----<<-r\x07ry-=G-h}|els@?ov9-}|fls@?ov9-}|gls@?ov9-_TONl}npxrqj----<<-r\x07ry->G-hp|==\vp|=>5unys?69-p|=?\vp|>>5unys?69-p|>?\vp|??5unys?69-n{s|zV{qr\x07II>C\vyn\brV{qr\x07j----v{-onrar\x07ry-J-}ynV{qr\x07b-7-?H----v{-r\x07dvqu-J-v{5r\x07r`v r5lr\x07r9-=6;\x076H----vrp?-p||q=-J-vrp?5onrar\x07ry-2-r\x07dvqu9-onrar\x07ry-<-r\x07dvqu6H----vrp?-p||q>-J-vrp?55onrar\x07ry-8->6-2-r\x07dvqu9-5onrar\x07ry-8->6-<-r\x07dvqu6H----rpA-=-J-r\x07rySrpu5lr\x07r9-p||q=9-=6H----rpA->-J-r\x07rySrpu5lr\x07r9-p||q>9-=6H----<<-全精度位置-5|owrp-}npr6----rp@-}ynPr{r-J-rp@5--------v{Ova|Sy|n5=;69--------v{Ova|Sy|n5=;t69--------v{Ova|Sy|n5=;o6----6H----<<-颜色----rpA-p|y|-J-rpA5--------sy|n5=;n-3-=\x07SS69--------sy|n55=;n-KK-E6-3-=\x07SS69--------sy|n55=;n-KK->C6-3-=\x07SS69--------sy|n55=;n-KK-?A6-3-=\x07SS6----6-<-?BB;=H----<<-预计算的-@Q-协方差(|owrp-}npr),对称矩阵-C-分量-5unys:}rpvv|{6----rp?-p|ln-J-{}npxUnys?\x07>C5>;6H--<<-5p|==9-p|=>6----rp?-p|lo-J-{}npxUnys?\x07>C5>;t6H--<<-5p|=?9-p|>>6----rp?-p|lp-J-{}npxUnys?\x07>C5>;o6H--<<-5p|>?9-p|??6----zn@-cx-J-zn@5--------p|ln;\x079-p|ln;\b9-p|lo;\x079--------p|ln;\b9-p|lo;\b9-p|lp;\x079--------p|lo;\x079-p|lp;\x079-p|lp;\b----6H----<<-n{s|zV{qr\x07-和-yn\brV{qr\x07-从->;n-解包----v{-n{s|zV{qr\x07-J->;n-KK->CH----v{-yn\brV{qr\x07-J->;n-3-=\x07SSSSH----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----rpA-|yqPr{r-J-n{s|z-7-rpA5}ynPr{r9->;=6H0vs-R[NOYRlT`lV[ValN[VZNaV\\[----sy|n-y|pny]|tr-J-lnttrtnv|{]|trH----sy|n-pnyr]|tr-J-=;=H----o||y-v{O|{qS|Nttrtnv|{-J-snyrH----vs-5lnttrtnv|{]|tr-I->;=6-\n--------o||y-v{O|{q-J-|yqPr{r;\x07-KJ-lnttrtnv|{O|{qZv{;\x07---------------------33-|yqPr{r;\x07-IJ-lnttrtnv|{O|{qZn\x07;\x07---------------------33-|yqPr{r; -KJ-lnttrtnv|{O|{qZv{; ---------------------33-|yqPr{r; -IJ-lnttrtnv|{O|{qZn\x07; H--------vs-5v{O|{q6-\n------------v{O|{qS|Nttrtnv|{-J-rH------------sy|n-urvtu_n{tr-J-lnttrtnv|{O|{qZn\x07;\b-:-lnttrtnv|{O|{qZv{;\bH------------sy|n-{|znyv rqUrvtu-J-urvtu_n{tr-K-=;==>----------------L-pynz}55|yqPr{r;\b-:-lnttrtnv|{O|{qZv{;\b6-<-urvtu_n{tr9-=;=9->;=6----------------G-=;BH------------sy|n-}|v{Q-J-pynz}5lnttrtnv|{]|v{Qnv|{9-=;=>9->;=6H------------sy|n-navzr-J-5>;=-:-{|znyv rqUrvtu6-7-5>;=-:-}|v{Q6H------------y|pny]|tr-J-pynz}55lnttrtnv|{]|tr-:-navzr6-<-}|v{Q9-=;=9->;=6H------------sy|n-|ssr]|tr-J-z||ur}5=;=9->;=9-y|pny]|tr6H------------pnyr]|tr-J-y|pny]|tr-7-y|pny]|tr-7-y|pny]|trH------------rp@-nttrtnv|{Pr{r-J-5lnttrtnv|{O|{qZv{-8-lnttrtnv|{O|{qZn\x076-<-?;=H------------rp@-qv-J-|yqPr{r;\x07\b -:-nttrtnv|{Pr{rH------------sy|n-qv-J-yr{tu5qv6H------------sy|n-n{q`rrq-J-q|5}ynPr{r9-rp@5>?;FEFE9-DE;?@@9-AB;>CA66H------------sy|n-n{qQv-J-snp5v{5n{q`rrq6-7-A@DBE;BAB@6H------------sy|n-n{tyr-J-n{q`rrq-7->=;=H------------rp@-pnrQv-J-{|znyv r5rp@5----------------p|5n{tyr69----------------zv\x075:=;D9-=;>9-snp5v{5n{q`rrq-7->;D6-7-A@DBE;BAB@669----------------v{5n{tyr6------------66H------------sy|n-r\x07}y|v|{Snp|-J-5>;=-:-|ssr]|tr6-7-5>;=-8->;=-7-n{qQv6H------------rp@-|ssr-J-pnrQv-7-qv-7-r\x07}y|v|{Snp|H------------|yqPr{r;\x07\b -8J-|ssrH------------}ynPr{r-J-5v{rr5n{s|z6-7-|yqPr{r6;\x07\b H--------\f----\f0r{qvs----0vs-[bZlT`lPYV]]R_`-K-=----vs-5yn\brV{qr\x07-I-v{5[bZlT`lYNfR_`66-\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----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----]|vv|{-J-}|vv|{;\x07\bH----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----o||y-v\\u|tn}uvp-J-}|wrpv|{Znv\x07h@jh@j-K-=;DH----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-协方差投影-5nyvt{rq-vu-t}yn-_r{qr]|tnz6----zn@-p|?Qz-J-n{}|r5a6-7-cx-7-aH----<<-───-屏幕空间抗锯齿:qvynv|{-<-Zv}:`}ynv{t-?Q-zv}-───----<<-每对象参数(放在视锥<裁剪早退之后再取,避免被剔除的-}yn-白付一次采样)----<<-;\x07-J-}rOyNz|{9-;\b-J-oyNz|{,单位为方差-}\x07²----rp?-oy]nnz-J-r\x07rySrpu5l|owrp]nnz9-vrp?5=9-n{s|zV{qr\x0769-=6;\x07\bH----sy|n-}rOyNz|{-J-oy]nnz;\x07H----sy|n-oyNz|{-J-oy]nnz;\bH----<<-Σ?Q-是对称矩阵,只需-@-个分量----sy|n-p==-J-p|?Qzh=jh=jH----sy|n-p=>-J-p|?Qzh=jh>jH----sy|n-p>>-J-p|?Qzh>jh>jH----<<-①-qvynv|{(}rOyNz|{):只膨胀协方差,不动-|}npv\b。----<<----用于未经抗锯齿训练的数据,避免亚像素-}yn-因采样不到而闪烁<消失。----<<----代价是远景-}yn-会偏亮偏胖(能量没有随面积增大而摊薄)。----sy|n-}rOy-J-}rOyNz|{-7-P\\cl]NPXl`PNYRH----p==-8J-}rOyH----p>>-8J-}rOyH----<<-②-Zv}:`}ynv{t-?Q-zv}(oyNz|{):膨胀协方差-8-|}npv\b-补偿。----<<----与一个方差为-ε-的各向同性高斯做卷积:Σ4-J-Σ-8-εV,----<<----并按-ρ-J-\05qr5Σ6-<-qr5Σ466-衰减-|}npv\b,使-}yn-的积分能量守恒----<<----——面积变大、浓度变淡,于是既不闪烁也不变亮。这是-RdN-低通滤波的近似,----<<----等价于-t}yn-的-nrv rlz|qrJ/n{vnyvnrq/。----<<----<<----注意-qr-对整体缩放的齐次性:qr5x·Σ6-J-x²·qr5Σ6,----<<----只要-ε-与-Σ-同样被-×P\\cl]NPXl`PNYR,比值中的-x²-会约掉,----<<----因此-ρ-与-}npx-缩放无关,恒等于真实-}\x07²-量纲下的补偿系数。----vs-5oyNz|{-K-=;=6-\n--------sy|n-qr\\vt-J-p==-7-p>>-:-p=>-7-p=>H--------sy|n-oy-J-oyNz|{-7-P\\cl]NPXl`PNYRH--------p==-8J-oyH--------p>>-8J-oyH--------sy|n-qr-J-p==-7-p>>-:-p=>-7-p=>H--------<<-qr-单调增(εK=-时-qr5Σ8εV6-K-qr5Σ6),故-ρ-∈-5=9->j--------p|y|;n-7J-\05pynz}5qr\\vt-<-zn\x075qr9->r:F69-=;=9->;=66H----\f----sy|n-zvq-J-5p==-8-p>>6-<-?;=H----sy|n-nqv-J-yr{tu5rp?55p==-:-p>>6-<-?;=9-p=>66H----sy|n-ynzoqn>-J-zvq-8-nqvH----sy|n-ynzoqn?-J-zvq-:-nqvH----vs-5ynzoqn?-I-=;=6-\n--------r{H----\f----rp?-qvnt|{nycrp|-J-{|znyv r5rp?5p=>9-ynzoqn>-:-p==66H----<<-协方差已在-}npx-阶段-×A(与-t}yn-对齐),故用-\05?7ynzoqn6-而非-\05E7ynzoqn6----rp?-znw|N\x07v-J-zv{5\05?;=-7-ynzoqn>69-zn\x07`prr{`}npr`}yn`v r6-7-qvnt|{nycrp|H----rp?-zv{|N\x07v-J-zv{5\05?;=-7-ynzoqn?69-zn\x07`prr{`}npr`}yn`v r6-7-rp?5qvnt|{nycrp|;\b9-:qvnt|{nycrp|;\x076H----<<-\0nq-顶点为-h:?9?j,等价于-t}yn-的-}|vv|{-7-n\x07v-<-vr}|----rp?-onvcvr}|-J-rp?5>;=-<-r|yv|{;\x079->;=-<-r|yv|{;\b6H----rp?-{qp\\ssr-J-5]|vv|{;\x07-7-znw|N\x07v-8-]|vv|{;\b-7-zv{|N\x07v6-7-onvcvr}|H0vs-R[NOYRlT`lV[ValN[VZNaV\\[----sy|n-sv{ny`pnyr]|tr-J-v{O|{qS|Nttrtnv|{-L-pnyr]|tr-G-5lnttrtnv|{]|tr-7-lnttrtnv|{]|tr-7-lnttrtnv|{]|tr6H----{qp\\ssr-7J-zv\x075=;>9->;=9-sv{ny`pnyr]|tr6H0r{qvs----rpA-\0nq]|-J-rpA5{qpPr{r;\x07\b-8-{qp\\ssr9-{qpPr{r; 9->;=6H----tyl]|vv|{-J-\0nq]|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|{-直接传-h:?9?j-的-\0nq-坐标给-sntzr{(与-t}yn-一致)----b-J-}|vv|{;\x07\bH\f"),fragment_default=function(...e){let t=113,n=126,r=0,o=``;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-
|
|
2953
|
+
----<<-与-t}yn-_r{qr]|tnz-一致:]|vv|{-为-h:?9?j-的-\0nq-坐标----sy|n-N-J-:q|5]|vv|{9-]|vv|{6H----vs-5N-I-:A;=6-qvpnqH----rp@-p|y|-J-P|y|;toH----sy|n-|}npv\b-J-r\x07}5N6-7-P|y|;nH----tylSntP|y|-J-rpA5p|y|;to9-|}npv\b6H\f`);init_pbmGaussianSplattingObject();var _sortPos0=new three.Vector3,_sortPos1=new three.Vector3,_sortQuat0=new three.Quaternion,_sortQuat1=new three.Quaternion,_sortScl=new three.Vector3,PBMGaussianSplattingRenderMesh=class extends three.Mesh{constructor(){super(),this.needsRender=!1,this.sortWorker=null,this.splatIndexCapacity=0,this.sortDataUploaded=!1,this.usedSHDegree=0,this.transformStore=null,this.objectParamsStore=null,this.transformsDirty=!1,this.layerRegistry=null,this.shStore=null,this.orderTexture=null,this.assembler=null,this.reorderPass=null,this.orderTarget=null,this.orderBaseSnapshot=[],this.sortGeneration=0,this.snapshotByGen=new Map,this.orderCount=0,this.orderDirty=!1,this.layoutDirty=!1,this.lastObjectsHash=``,this.lastClipperHash=``,this.prevSortCameraMatrix=null,this.sortCameraDistance=1,this.sortCameraCoorient=.99,this.sortMinIntervalMs=0,this.sortLastTime=-1/0,this.onBeforeRender=(e,t,n)=>{let r=n,o=this.collectObjects(t);if(o.length===0){this.geometry.instanceCount=0;return}let s=0,c=!1;for(let e of o)e.usedSHDegree>s&&(s=e.usedSHDegree),e.initAnimationEnabled&&(c=!0);let l=s!==this.usedSHDegree;this.usedSHDegree=s,this.updateInitAnimationDefine(c),this.isSceneChanged(o)?this.rebuild(e,o):l&&this.updateSH(o);for(let e of o)e.transformChanged&&this.transformStore.indexOf(e)!==void 0&&(this.transformStore.updateOne(e),this.transformsDirty=!0,e.transformChanged=!1,e.selectedChanged=!1),e.renderParamsChanged&&(this.objectParamsStore.updateOne(e),e.renderParamsChanged=!1,this.needsRender=!0);let u=new three.Matrix4().multiplyMatrices(r.perspectiveProjectionMatrix,r.matrixWorldInverse);this.requestSort(r,u.elements),(this.orderDirty||this.layoutDirty)&&(this.runReorder(e),this.orderDirty=!1,this.layoutDirty=!1);let d=o.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(`|`);d!==this.lastClipperHash&&(this.updateClipperUniforms(o),this.lastClipperHash=d,this.needsRender=!0),this.material.uniforms.resolution.value.set(r.resolution.x,r.resolution.y)},this.geometry=this.createGeometry(),this.material=this.createMaterial(),this.orderTexture=new OrderTexture,this.assembler=new SplatAssembler,this.reorderPass=new ReorderPass,this.transformStore=new TransformStore,this.objectParamsStore=new ObjectParamsStore,this.layerRegistry=new LayerRegistry,this.shStore=new SHStore,this.material.uniforms.u_orderTexture.value=this.orderTexture.texture,this.material.uniforms.u_orderWidth.value=this.orderTexture.width,this.frustumCulled=!1,this.renderOrder=-99999999999,this.sortWorker=new WorkerWrapper,this.sortWorker.postMessage({warmup:!0}),this.sortWorker.onmessage=e=>{var t;if(e.data.depthIndex){let n=e.data.depthIndex;this.applyDepthIndex(n,e.data.generation);let r=n.buffer;r.byteLength>0&&((t=this.sortWorker)==null||t.postMessage({returnBuffer:r},[r]))}}}createGeometry(){let e=new three.InstancedBufferGeometry,t=new Float32Array([-2,-2,0,2,-2,0,2,2,0,-2,2,0]);e.setAttribute(`position`,new three.BufferAttribute(t,3)),e.setIndex(new three.BufferAttribute(new Uint16Array([0,1,2,0,2,3]),1)),this.splatIndexCapacity=1;let n=new Float32Array(this.splatIndexCapacity),r=new three.InstancedBufferAttribute(n,1,!1,1);return r.setUsage(three.DynamicDrawUsage),e.setAttribute(`splatIndex`,r),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}ensureSplatIndexCapacity(e){let t=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return t;let n=Math.max(this.splatIndexCapacity,1);for(;n<e;)n*=2;let r=new Float32Array(n);r.set(t.array.subarray(0,Math.min(t.array.length,n)));let o=new three.InstancedBufferAttribute(r,1,!1,1);return o.setUsage(three.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,o),this.splatIndexCapacity=n,this.geometry._maxInstanceCount=n,o}createMaterial(){return new three.ShaderMaterial({vertexShader:vertex_default,fragmentShader:fragment_default,defines:{NUM_GS_LAYERS:0,NUM_GS_CLIPPERS:0,ENABLE_GS_INIT_ANIMATION:0,USE_ORDER_TEXTURE:1},uniforms:{u_texture:{value:null},u_transforms:{value:null},u_orderTexture:{value:null},u_orderWidth:{value:2048},u_numPoints:{value:0},u_numGsLayers:{value:0},u_numGsClippers:{value:0},u_layerClipperRanges:{value:[]},u_clipperMatricesInverse:{value:[]},u_shTexture:{value:null},u_shTextureSize:{value:new three.Vector2},u_maxShDegree:{value:0},resolution:{value:new three.Vector2},u_aggregationProgress:{value:0},u_aggregationBoundsMin:{value:new three.Vector3(0,0,0)},u_aggregationBoundsMax:{value:new three.Vector3(0,0,0)},u_aggregationPointDuration:{value:.6},u_objectParams:{value:null}},side:three.DoubleSide,transparent:!0,blending:three.NormalBlending,depthTest:!0,depthWrite:!1})}rebuildTransformsTexture(e){this.transformStore.sync(e),this.material.uniforms.u_transforms.value=this.transformStore.texture,this.transformsDirty=!0}rebuildObjectParamsTexture(e){this.objectParamsStore.sync(e,e=>this.transformStore.indexOf(e)),this.material.uniforms.u_objectParams.value=this.objectParamsStore.texture;for(let t of e)t.renderParamsChanged=!1}rebuildAssembled(e,t){this.assembler.sync(t,e=>({transformIndex:this.transformStore.indexOf(e),layerIndex:this.layerRegistry.layerIndexOf(e)})),this.assembler.assemble(e),this.material.uniforms.u_texture.value=this.assembler.texture}updateSH(e){this.shStore.sync(e,this.usedSHDegree),this.material.uniforms.u_shTexture.value=this.shStore.texture,this.material.uniforms.u_shTextureSize.value.copy(this.shStore.textureSize),this.material.uniforms.u_maxShDegree.value=this.shStore.appliedDegree}applyDepthIndex(e,t){let n=e.length,r=this.ensureSplatIndexCapacity(n);r.array.set(e,0),r.count=n,r.updateRange.offset=0,r.updateRange.count=n,r.needsUpdate=!0,this.orderTexture&&this.orderTexture.update(e);let o=this.snapshotByGen.get(t);if(o){this.orderBaseSnapshot=o;for(let e of this.snapshotByGen.keys())e<t&&this.snapshotByGen.delete(e)}this.orderCount=n,this.orderDirty=!0,this.geometry.instanceCount=n,this.needsRender=!0}snapshotLayout(){return this.assembler?this.assembler.regions.map(e=>({object:e.object,start:e.start,count:e.count})):[]}buildSegments(e,t){let n=new Map;for(let e of t)n.set(e.object,e.start);let r=[];for(let t of e){let e=n.get(t.object),o=e===void 0,s=o?0:e-t.start,c=r[r.length-1];c&&c.removed===o&&(o||c.delta===s)&&c.oldEnd===t.start?c.oldEnd=t.start+t.count:r.push({oldStart:t.start,oldEnd:t.start+t.count,delta:s,removed:o})}return r}runReorder(e){if(!this.reorderPass||!this.orderTexture||this.orderCount===0)return;let t=this.snapshotLayout(),n=this.buildSegments(this.orderBaseSnapshot,t),r=this.orderTexture.width,o=Math.max(1,Math.ceil(this.orderCount/r));this.orderTarget?(this.orderTarget.width!==r||this.orderTarget.height<o)&&this.orderTarget.setSize(r,Math.max(this.orderTarget.height,o)):this.orderTarget=ReorderPass.createOrderTarget(r,o),this.reorderPass.run(e,this.orderTexture.texture,r,this.orderTarget,n);let s=0;for(let e of t)s+=e.count;this.material.uniforms.u_orderTexture.value=this.orderTarget.texture,this.material.uniforms.u_orderWidth.value=r,this.material.uniforms.u_numPoints.value=s}postSortData(){var e;let t=++this.sortGeneration;this.snapshotByGen.set(t,this.snapshotLayout());let{positions:n,transformIndices:r,count:o}=this.assembler.extractSortInputs(),s=this.transformStore.transforms.slice(0,this.transformStore.objectCount*20);(e=this.sortWorker)==null||e.postMessage({sortData:{positions:n,transforms:s,transformIndices:r,vertexCount:o,generation:t}},[n.buffer,s.buffer,r.buffer]),this.sortDataUploaded=!0,this.transformsDirty=!1}shouldSort(e){if(this.transformsDirty||!this.sortDataUploaded||!this.prevSortCameraMatrix)return!0;this.prevSortCameraMatrix.decompose(_sortPos0,_sortQuat0,_sortScl),e.matrixWorld.decompose(_sortPos1,_sortQuat1,_sortScl);let t=_sortPos0.distanceTo(_sortPos1),n=Math.abs(_sortQuat0.dot(_sortQuat1));return t>this.sortCameraDistance||n<this.sortCameraCoorient}requestSort(e,t){var n;!this.assembler||this.assembler.totalPoints===0||this.shouldSort(e)&&(performance.now()-this.sortLastTime<this.sortMinIntervalMs||((this.transformsDirty||!this.sortDataUploaded)&&this.postSortData(),(n=this.sortWorker)==null||n.postMessage({viewProj:t}),this.prevSortCameraMatrix||(this.prevSortCameraMatrix=new three.Matrix4),this.prevSortCameraMatrix.copy(e.matrixWorld),this.sortLastTime=performance.now()))}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof PBMGaussianSplattingObject&&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)}),t}isSceneChanged(e){let t=e.map(e=>`${e.uuid}:${e.gsViewLayerKey}`).join(`|`);return t===this.lastObjectsHash?!1:(this.lastObjectsHash=t,!0)}rebuild(e,t){this.sortDataUploaded=!1,this.layerRegistry.sync(t),this.rebuildTransformsTexture(t),this.rebuildObjectParamsTexture(t),this.rebuildAssembled(e,t),this.material.uniforms.u_numPoints.value=this.assembler.totalPoints,this.ensureSplatIndexCapacity(this.assembler.totalPoints),this.updateSH(t),this.lastClipperHash=``,this.layoutDirty=!0,this.needsRender=!0}updateClipperUniforms(e){var t,n;let r=this.layerRegistry;if(!r||r.layerCount===0){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=r.layerKeys.length,c=0;for(let e of r.layerKeys)c+=((t=o.get(e))==null?[]:t).length;let l=Array.from({length:s},()=>new three.Vector2(-1,0)),u=Array.from({length:c},()=>new three.Matrix4),d=0;for(let e of r.layerKeys){let t=r.layerKeyToIndex.get(e);if(t===void 0)continue;let s=(n=o.get(e))==null?[]:n,c=d;for(let e of s)u[d].getInverse(e.clippingBoxMatrix),d++;s.length>0&&l[t].set(c,s.length)}this.material.uniforms.u_layerClipperRanges.value=l,this.material.uniforms.u_clipperMatricesInverse.value=u,this.updateClipperCounts(s,d)}updateClipperCounts(e,t){let n=this.material.defines;(n.NUM_GS_LAYERS!==e||n.NUM_GS_CLIPPERS!==t)&&(n.NUM_GS_LAYERS=e,n.NUM_GS_CLIPPERS=t,this.material.needsUpdate=!0),this.material.uniforms.u_numGsLayers.value=e,this.material.uniforms.u_numGsClippers.value=t}updateInitAnimationDefine(e){let t=this.material.defines,n=+!!e;t.ENABLE_GS_INIT_ANIMATION!==n&&(t.ENABLE_GS_INIT_ANIMATION=n,this.material.needsUpdate=!0,this.needsRender=!0)}dispose(){this.sortWorker&&(this.sortWorker.terminate(),this.sortWorker=null),this.assembler&&(this.assembler.dispose(),this.assembler=null),this.reorderPass&&(this.reorderPass.dispose(),this.reorderPass=null),this.orderTarget&&(this.orderTarget.dispose(),this.orderTarget=null),this.transformStore&&(this.transformStore.dispose(),this.transformStore=null),this.objectParamsStore&&(this.objectParamsStore.dispose(),this.objectParamsStore=null),this.shStore&&(this.shStore.dispose(),this.shStore=null),this.layerRegistry=null,this.orderTexture&&(this.orderTexture.dispose(),this.orderTexture=null),this.geometry.dispose(),this.material.dispose()}};init_pbmGaussianSplattingObject();var PBMGaussianSplattingTestMesh=class extends three.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 PBMGaussianSplattingObject&&e.visible&&t.push(e)}),t}},DEFAULT_MODE_CHANGE_DURATION=1e3,DEFAULT_CAMERA_FOV=90,DEFAULT_REQUEST_PROXY=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/`),scratchSphere=new three.Sphere,scratchBox3=new three.Box3,scratchViewport=new three.Vector4,scratchScissor=new three.Vector4,scratchClearColor=new three.Color,scratchRenderSize=new three.Vector2,worksMap=new WeakMap,emptyWorks=createWorks([parseWork(null)]),Five_Instances={},Five=class e extends Subscribe{static get version(){return`6.9.0-alpha.3`}static get dracoPath(){return draco.decoderPath}static set dracoPath(e){draco.setDecoderPath(e)}static get ktx2Path(){return ktx2.transcoderPath}static set ktx2Path(e){ktx2.setTranscoderPath(e)}static get useNativeImageBitmap(){return canUseNativeImageBitmap()}static set useNativeImageBitmap(e){useNativeImageBitmap(e)}constructor(e={}){var t,n,r,o,s,c,l,u,d,f,p;if(super(),this.pbmGaussianSplattingRenderMesh=null,this.fiveId=createUuid$1(),Five_Instances[this.fiveId]=this,this.currentUpdateArgs={time:now(),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=(o=e.poweredByRealsee)==null?!0:o,this.backgroundColor=new three.Color((s=e.backgroundColor)==null?1579548:s),this.backgroundAlpha=(c=e.backgroundAlpha)==null?1:c,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:now()},this.modeChangeDuration=(l=e.modeChangeDuration)==null?DEFAULT_MODE_CHANGE_DURATION:l,this.enableWheel=(u=e.enableWheel)==null?!0:u,typeof window<`u`)if(`renderer`in e)e.renderer instanceof InternalWebGLRenderer&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=getViewportScale();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 three.WebGLRenderTarget(1,1,{encoding:(f=(d=this.renderer)==null?void 0:d.outputEncoding)==null?three.sRGBEncoding:f,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new Camera(DEFAULT_CAMERA_FOV),this.scene=new Scene,this.xrCustomObjectsScene=new three.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.loadWorkTask=Promise.resolve(),this.requestProxy=(p=e.requestProxy)==null?DEFAULT_REQUEST_PROXY:p,this.networkSubscribe=new NetworkSubscribe,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var o;this.emit(`network.resource`,createEvent(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(o=this.analysis)==null||o.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new three.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),worksMap.set(this,emptyWorks),this.modelScene=new ModelScene({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[m]=this.modelScene.setModels(emptyWorks,{forceReplaceImmediately:!0});defineProperty(m,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new three.VideoTexture(e.videoInstance||generateDefaultVideoElement());let h=initLights();this.scene.add(h),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=AnimationFrameLoop.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let g=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,createEvent(`vr.requestExit`,{}))},_=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,g,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,_,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,g,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,_,!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)}}}initLegacyEvent(this),this.fiveRenderer=new FiveRenderer,this.adaptiveLuminancePass=new AdaptiveLuminancePass,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new EyeDomeLightingPass(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGaussianSplattingRenderMesh=new PBMGaussianSplattingRenderMesh,this.scene.add(this.pbmGaussianSplattingRenderMesh)):this.scene.add(new PBMGaussianSplattingTestMesh)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}get panoId(){return panoStringify(this.pano)}dispose(){var e;if(this.destroyed===!0)return;delete Five_Instances[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(),worksMap.set(this,emptyWorks),this.renderer&&this.renderer.render(new three.Scene,new three.Camera),this.fiveRenderer.dispose(),this.renderer instanceof InternalWebGLRenderer&&(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`,createEvent(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,omitUndefinedFields(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,omitUndefinedFields(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,omitUndefinedFields(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,omitUndefinedFields(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,omitUndefinedFields(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,omitUndefinedFields(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.xrPanorama&&(Object.assign(this.controllerInits.XRPanorama,omitUndefinedFields(e.xrPanorama)),this.currentMode===`XRPanorama`&&(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 InternalWebGLRenderer)){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,o;if(!this.renderer)return;let s=this.renderer.domElement.parentNode,{width:c=(n=s==null?void 0:s.offsetWidth)==null?512:n,height:l=(r=s==null?void 0:s.offsetHeight)==null?512:r}=e;if(c=Math.max(1,c),l=Math.max(1,l),!t){let e=getViewportScale(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(o=e===1?n:1)==null?1:o,t>1){let e=Math.max(c,l)*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(c,l),this.needsRender=!0;let u=now(),d=u-this.currentUpdateArgs.time,f=this.currentUpdateArgs.args;this.updateTime(u,d,...f)}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 worksMap.get(this)||emptyWorks}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 o=this.loadWorkTask.then(()=>isPromise(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=o.catch(e=>{this.throwError(e)}),o}load_(t,n,r,o=!0){var s,c,l,u,d,f,p,m,h,g;let _={};typeof r==`number`?_.duration=r:typeof r==`object`&&Object.assign(_,r),this.works===emptyWorks&&(_.duration===void 0&&(_.duration=0),_.effect===void 0&&(_.effect=`instant`));let v={};Object.assign(v,_.model),!v[`3d-tiles`]&&_[`3d-tiles`]&&(v[`3d-tiles`]=_[`3d-tiles`]),!v.textureOptions&&_.textureOptions&&(v.textureOptions=_.textureOptions),!v.textureOptions&&this.textureOptions&&(v.textureOptions=this.textureOptions);let y=[];if(Array.isArray(t))for(let e of t)e instanceof Work?y.push(e):typeof e!=`string`&&`work`in e?y.push(parseWork(e.work,e)):y.push(parseWork(e));else t instanceof Work?y.push(t):y.push(parseWork(t));_.mode===`add`&&(y=[].concat(this.works,y));let b;try{b=createWorks(y)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of b)this.bindWorkFetcher(e);n===void 0&&(n=`inherit`),n===`inherit`&&this.works===emptyWorks&&(n=`initial`);let S=this.currentMode,C=b.initial,w=C.work.observers[0],T=w?{workCode:w.work.workCode,panoIndex:w.panoIndex}:{workCode:C.work.workCode,panoIndex:0},E=(s=C.mode)==null?w?`Panorama`:`Mapview`:s,D={};if(n===`inherit`){let e=this.getCurrentState(),[t]=b.filter(t=>t.workCode===e.workCode);if(t)T={workCode:e.workCode,panoIndex:e.panoIndex},E=e.mode,D={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{n={mode:S};let e=(l=(c=b[0])==null?void 0:c.observers)==null?void 0:l[this.panoIndex];e?(n.workCode=e.work.workCode,n.panoIndex=e.panoIndex):typeof b.initial.panoIndex==`number`?(n.workCode=b.initial.work.workCode,n.panoIndex=b.initial.panoIndex):(n.mode===`Panorama`||n.mode===`VRPanorama`||n.mode===`XRPanorama`)&&(n.mode=`Mapview`),n.mode===S&&(n.longitude=this.camera.pose.longitude,n.latitude=this.camera.pose.latitude,n.fov=this.camera.pose.fov)}}if(n===`initial`&&(typeof C.panoIndex==`number`&&(T={workCode:C.work.workCode,panoIndex:C.panoIndex}),C.mode&&(E=C.mode),D={longitude:C.longitude,latitude:C.latitude,fov:C.fov,distance:C.distance,offset:(u=C.offset)==null?void 0:u.clone()}),typeof n==`object`){if(E=(d=n.mode)==null?S:d,typeof n.panoIndex==`number`){let e=b.getObserver({workCode:(p=(f=n.workCode)==null?C.work.workCode:f)==null?``:p,panoIndex:n.panoIndex});e&&(T={workCode:e.work.workCode,panoIndex:e.panoIndex})}D={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset?new three.Vector3().copy(n.offset):void 0}}let O=(m=_.duration)==null?this.modeChangeDuration:m;(E===`Floorplan`||E===`Topview`||E===`Mapview`)&&S===E&&(O=0);let k=`fly`;(E===`Panorama`||E===`VRPanorama`||E===`XRPanorama`)&&S===E&&(k=(h=_.effect)==null?`fade`:h),this.emit(`works.request`,createEvent(`works.request`,{input:t,works:b,userAction:o}));let A=(e,t,r)=>{let s=this.getCurrentState(),c=Object.assign(Object.assign({mode:e},t),r);n===`inherit`&&(c=this.getCurrentState()),this.pano=t;let l=Object.assign(Object.assign({initial:{state:c,currentState:s,duration:O,effect:k,userAction:o}},this.commonParams()),this.controllerInits[e]),u=Controllers[c.mode].initAnimationEndState(l);if(this.controller&&S===e)this.controller.updateWork(b,u,{effect:k,duration:O},o)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,l));else{if(this.controller)this.controller.destroy();else{let t=Controllers[e].initAnimationEndState(l);this.camera.setFromPose(t),this.emit(`camera.update`,createEvent(`camera.update`,{state:this.getCurrentState(),userAction:o}))}this.controller=this.applyController(e,l);let t=createEvent(`mode.change`,{prevMode:S,mode:e,state:u,userAction:o});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};worksMap.set(this,b);let j=Promise.resolve();if(E===e.Mode.Floorplan||E===e.Mode.Topview||E===e.Mode.Mapview||E===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(D),assignPose(this.state,this.camera.pose));let e=this.modelScene.setModels(b,v);j=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,A(E,T,D),this.emit(`camera.update`,createEvent(`camera.update`,{state:this.getCurrentState(),userAction:o}))})}else{A(E,T,D);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===b&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,createEvent(`camera.update`,{state:this.getCurrentState(),userAction:o})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(b,v);j=Promise.all(r.map(e=>e.initReady)).then(noop),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((g=_.duration)==null?this.modeChangeDuration:g)+1e3)}return this.emit(`works.load`,createEvent(`works.load`,{input:t,userAction:o,works:b})),j.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,createEvent(`works.ready`,{input:t,userAction:o,works:b})),(e=this.analysis)==null||e.work(b)})}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}),worksMap.set(this,emptyWorks),this.modelScene.setModels(emptyWorks,{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:DEFAULT_CAMERA_FOV,longitude:0,latitude:0,offset:new three.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,o=!0,s=!1){return new Promise((c,l)=>{var u,d,f,p;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let m=0;this.controller&&(m=typeof r==`number`?r:(u=r==null?void 0:r.duration)==null?this.modeChangeDuration:u);let h=`fly`;this.controller&&typeof r==`object`&&r.effect&&(h=r.effect);let g=typeof n.panoIndex==`number`?{workCode:(p=(d=n.workCode)==null?(f=this.work)==null?void 0:f.workCode:d)==null?``:p,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),l(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(g)){let e=Error(`PanoId ${panoStringify(g)} not existed.`);this.throwError(e),l(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(m=0);let _=this.controller,v=this.currentMode,y=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&s===!1&&v===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!panoEqual(this.pano,g)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(g,Object.assign({duration:m},n),o):this.controller.updateCamera(n,m,o).catch(noop):(panoEqual(this.pano,g)||(this.pano=g),this.controller.updateCamera(n,m,o).catch(noop));else{let e=Object.assign(Object.assign({},n),g),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:m,effect:h,userAction:o}},this.commonParams()),this.controllerInits[t]),s=Controllers[t].initAnimationEndState(r),c=createEvent(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:s,userAction:o});if(this.emit(`mode.change.request`,c),!c.defaultPrevented){_&&_.destroy(),this.controller=this.applyController(t,r);let e=createEvent(`mode.change`,{prevMode:this.currentMode,mode:t,state:s,userAction:o});this.emit(`mode.change`,e)}}c()},b=AnimationFrameLoop.shared.getContext();b&&(typeof XRSession<`u`&&b instanceof XRSession&&b.end(),AnimationFrameLoop.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),requestDeviceOrientationPermission().then(()=>y()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),l(t)})):t===e.Mode.XRPanorama?requestXRSessionPermission().then(e=>{AnimationFrameLoop.shared.setContext(e),s=!0,y()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),l(t)}):y()})}getPixels(e,t,n,r,o,s,c){if(!this.renderer)throw Error(`renderer is not initialized.`);let l=now(),u=this.renderer.getPixelRatio(),d=this.renderer.getRenderTarget(),f=this.getSize(new three.Vector2),p=0,m=0,h=1,g=1,_,v,y,b,S;typeof e==`number`?(p=e,typeof t==`number`&&(m=t),typeof n==`number`&&(h=n),typeof r==`number`&&(g=r),_=o,v=s,S=c):(p=e.x,m=e.y,h=e.width,g=e.height,_=e.pixelRatio,v=e.flipY,y=e.helperVisible,b=e.skipPanorama,S=e.buffer),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g),_=Math.floor(_==null?u:_),v=v==null?!1:v;let C=this.helperVisible,w=this.modelScene.parameter.modelAlpha;this.helperVisible=y==null?this.helperVisible:y,b&&(this.controller instanceof Controllers.Panorama||this.controller instanceof Controllers.VRPanorama||this.controller instanceof Controllers.XRPanorama)&&b===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let T=this.getPixelsRenderTarget;T.setSize(h*_,g*_),this.renderer.setRenderTarget(T),this.camera.pixelRatio=_,this.camera.resolution.set(h,g),this.camera.setViewOffset(f.width,f.height,p,f.height-m-g,h,g),this.camera.aspect=f.width/f.height,this.camera.updateTime(l),this.scene.update(this.renderer,this.camera);let E=this.renderer.autoClear,D=this.renderer.autoClearColor,O=this.renderer.autoClearDepth,k=this.renderer.autoClearStencil,A=scratchClearColor.copy(this.renderer.getClearColor()),j=this.renderer.getClearAlpha(),M=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let N=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:N,this.renderer.render(this.scene,this.camera),this.scene.background=N,this.renderer.autoClear=E,this.renderer.autoClearColor=D,this.renderer.autoClearDepth=O,this.renderer.autoClearStencil=k,this.renderer.setClearColor(A,j),this.renderer.setScissorTest(M),this.helperVisible=C,w===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,w),this.renderer.setRenderTarget(d),this.camera.clearViewOffset(),this.camera.pixelRatio=u,this.camera.resolution.copy(f),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(l),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let P=h*_,F=g*_,I=P*F,L=I*4;if(S){if(S.length!==L)throw Error(`buffer length is not equals pixels ${L}`)}else S=new Uint8Array(L);if(this.renderer.readRenderTargetPixels(T,0,0,h*_,g*_,S),v){let e=I/2;for(let t=0,n=0,r=0,o=0;n<e;n++)for(o=(F-Math.floor(n/P)-1)*P+n%P,r=0;r<4;r++)t=S[n*4+r],S[n*4+r]=S[o*4+r],S[o*4+r]=t}return S}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,o=t.autoClearColor,s=t.autoClearDepth,c=t.autoClearStencil,l=scratchClearColor.copy(t.getClearColor()),u=t.getClearAlpha(),d=t.getViewport(scratchViewport),f=t.getScissor(scratchScissor),p=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let m=t.getSize(scratchRenderSize),h=Math.floor(m.x*this.viewport.left),g=Math.floor(m.y*this.viewport.bottom),_=Math.floor(m.x*this.viewport.width),v=Math.floor(m.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(h,g,_,v),t.setScissor(h,g,_,v);let y=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(y);let b=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:b;let S=!0;if(this.controller&&this.controller.render()&&(S=!1),S){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&renderPoweredByRealsee(t)}this.scene.background=b,t.autoClear=r,t.autoClearColor=o,t.autoClearDepth=s,t.autoClearStencil=c,t.setClearColor(l,u),t.setViewport(d),t.setScissor(f),t.setScissorTest(p),t.setRenderTarget(n),e&&AnimationFrameLoop.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&ktx2.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),AnimationFrameLoop.shared.add(()=>{this.emit(`models.load`,createEvent(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&AnimationFrameLoop.shared.add(()=>{this.emit(`models.refined`,createEvent(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){scratchBox3.makeEmpty(),scratchBox3.expandByObject(this.modelScene.boundingMesh);let t=scratchBox3.getBoundingSphere(scratchSphere),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius),n=clamp$1(n,800);let r=n/1e4;r=clamp$1(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=createEvent(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let o=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,createEvent(`render`,{needsRender:o})),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 InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:o,renderer:s}=this;if(!o)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!s)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let c=this.works.getObserver(t);if(!c)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let l={workCode:c.work.workCode,panoIndex:c.panoIndex};return`moveToPano`in o&&typeof o.moveToPano==`function`?o.moveToPano(l,n,r):c&&(this.pano=l,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=noop){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`],o=now();return Promise.all(r.map(e=>{let t=panoStringify({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},pick(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),o=n.work.getURL(n.images[e]),s=this.imageOptions.transform?this.imageOptions.transform(o,r):imageURL(o,r);return getFetcher(this.fiveId,n.work).preload(s)})).then(()=>{let e=now()-o;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 three.Raycaster(t,n.clone().normalize());r.params.Points={threshold:.1};let[o]=this.modelScene.intersectRaycaster(r);if(o&&o.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 three.Vector2),o=r.x*this.viewport.width,s=r.y*this.viewport.height,c=r.x*this.viewport.left+(n.x+1)/2*o,l=r.y*(1-this.viewport.bottom-this.viewport.height)+(-n.y+1)/2*s;return new three.Vector2(c,l)}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,o,s,c,l,u,d,f,p,m;e=pick(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof three.Vector3)&&(e.offset=new three.Vector3(e.offset.x,e.offset.y,e.offset.z));let h;if(typeof e.panoIndex==`number`)if(e.workCode)h={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(o=(r=this.work)==null?void 0:r.workCode)==null?``:o,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),h={workCode:t,panoIndex:e.panoIndex}}let g=(s=e.mode)==null?this.state.mode:s,_,v,y,b,S;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==g){if(g===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let t={workCode:h==null?void 0:h.workCode,panoIndex:h==null?void 0:h.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 three.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[g]),r=Controllers[g].initAnimationEndState(n);_=r.longitude,v=r.latitude,y=r.fov,b=r.offset,S=r.distance}else _=(c=e.longitude)==null?this.state.longitude:c,v=(l=e.latitude)==null?this.state.latitude:l,y=(u=e.fov)==null?this.state.fov:u,b=(d=e.offset)==null?this.state.offset:d,S=(f=e.distance)==null?this.state.distance:f;let C={workCode:(h==null?this.pano:h).workCode,panoIndex:(h==null?this.pano:h).panoIndex,mode:g,longitude:_,latitude:v,fov:y,offset:b,distance:S};this.emit(`state.set`,createEvent(`state.set`,{userAction:n,state:C})),stateEqual(this.state,C)||(this.controller&&C.mode===`VRPanorama`&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode(`VRPanorama`)):this.controller&&C.mode===`XRPanorama`&&C.mode!==this.state.mode?(assignState(this.state,C),this.changeMode(`XRPanorama`)):(assignState(this.state,C),this.controller&&n&&(this.controller.userAction=!1),t&&this.state.mode===C.mode&&(this.syncingState=this.syncState(now(),0,t),this.syncingState&&((p=this.controller)==null||p.updateTime(now(),0),this.syncingState=!1)),this.emit(`state.change`,createEvent(`state.change`,{userAction:n,state:this.state})),(m=this.analysis)==null||m.state(this.works,this.state)))}syncState(t,n,r=!1){let o=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 Controllers.Model){if(notSimilarVector3(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(!panoEqual(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 Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){let e=1,t=.2,n=.2,o=Math.PI/45,s=r?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,1),c=Math.abs(this.camera.pose.distance-this.state.distance),l=c>n*15?c/15:.2,u=r?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,l),d=this.camera.pose.offset.distanceTo(this.state.offset),f=d>n*15?d/15:n,p=r?new three.Vector3().copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,f),{longitude:m,latitude:h}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},o);if(notSimilarValue(s,this.camera.pose.fov)||notSimilarVector3(p,this.camera.pose.offset)||notSimilarValue(u,this.camera.pose.distance)||notSimilarValue(m,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(h,this.camera.pose.latitude)){let e={x:p.x,y:p.y,z:p.z},t={fov:s};return Object.assign(e,{distance:u}),Object.assign(t,{longitude:m,latitude:h}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(noop),this.controller.locationMotion.set(e,0).catch(noop),!0}}else{let e=1,t=Math.PI/45,n=r?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,1),{longitude:o,latitude:s}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},t),c=this.state.distance,l=new three.Vector3().copy(this.state.offset);if(notSimilarValue(c,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),notSimilarVector3(l,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),notSimilarValue(o,this.camera.pose.longitude,Math.PI*2)||notSimilarValue(s,this.camera.pose.latitude)||notSimilarValue(n,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:o,latitude:s,fov:n},0).catch(noop),!0}if(this.stateSynced=!0,o===!1&&this.emit(`state.synced`,createEvent(`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 Controllers.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(noop)}requestFullscreen(){var e;if(!isMobile)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=()=>{AnimationFrameLoop.shared.add(()=>{this.emit(`model.load`,createEvent(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,createEvent(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,createEvent(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},o=t=>{this.emit(`models.tileLoad`,createEvent(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},s=t=>{this.emit(`models.tileUnload`,createEvent(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},c=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,o),e.removeEventListener(`tileUnload`,s),e.removeEventListener(`dispose`,c)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,o),e.addEventListener(`tileUnload`,s),e.addEventListener(`dispose`,c),this.emit(`model.request`,createEvent(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,o=new Fetcher({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=verifyURL(e,r);return t instanceof Error?Promise.reject(t):t})}});registerFetcher(this.fiveId,e,o)}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=Controllers[t];this.currentMode=t;let o=new r(n);for(let e of PROXY_CONTROLLER_EVENT_NAMES)o.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=Controllers[t].initAnimationEndState(n),r=n.initial.userAction;stateEqual(this.state,e)||(assignState(this.state,e),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,createEvent(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return o.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,createEvent(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),o.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),o.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&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),o.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&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),o.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&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),o.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!stateEqual(this.state,n)&&(assignState(this.state,n),this.emit(`state.change`,createEvent(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),o.on(`pano.error`,e=>{var t;let{state:n}=e;this.state.mode===n.mode&&!stateEqual(this.state,n)&&(assignState(this.state,n),(t=this.analysis)==null||t.state(this.works,this.state))}),o.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,createEvent(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),o.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),o.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),o.on(`error`,e=>this.throwError(e)),o}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:o}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:o}}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 three.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 three.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}};Five.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`&&Object.assign(window,{__FIVE_DEBUG__:{THREE:three,constructor:Five,instances:Five_Instances}});var XRButton=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 o(){r(),t.textContent=`VR NOT SUPPORTED`}function s(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`,s(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():o()}),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`,s(e),e}}};exports.AdaptiveLuminancePass=AdaptiveLuminancePass,exports.AnimationFrameLoop=AnimationFrameLoop,exports.BoundingMesh=BoundingMesh,exports.Camera=Camera,exports.CustomShader=PBMCustomShader,exports.PBMCustomShader=PBMCustomShader,exports.EffectComposer=EffectComposer,exports.EyeDomeLightingPass=EyeDomeLightingPass,exports.Fetcher=Fetcher,exports.Five=Five,exports.FivePass=FivePass,exports.FiveRenderer=FiveRenderer,exports.FlowingFireworks3DPass=FlowingFireworks3DPass,exports.FlowingLight2DPass=FlowingLight2DPass,exports.FlowingLight3DPass=FlowingLight3DPass,exports.FullScreenQuad=FullScreenQuad,exports.GaussianBlurPass=GaussianBlurPass,exports.Histogram=Histogram,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.Model=Model,exports.ModelScene=ModelScene,exports.Motion=Motion,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMGSObject=PBMGaussianSplattingObject,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PBMPanoFilter=PBMPanoFilter,exports.PBMPointCloud=PBMPointCloud,exports.PBMPointCloudMaterial=PBMPointCloudMaterial,exports.PBMSkinnedMesh=PBMSkinnedMesh,exports.PBMUpdateable=PBMUpdateable,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.Parameter=Parameter,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3D=Tile3D,exports.Tile3DModel=Tile3D,exports.TileCache=TileCache,exports.TileNode=TileNode,exports.TileRequestScheduler=TileRequestScheduler,exports.Tileset=Tileset,exports.Trajectory=Trajectory,exports.TrajectoryNode=TrajectoryNode,exports.Work=Work,exports.WorkResolvedObserver=WorkResolvedObserver,exports.XRButton=XRButton,exports.controllersDefaultInitArgs=controllersDefaultInitArgs,exports.coordinatesToVector=coordinatesToVector,exports.createDebugBoundingMesh=createDebugBoundingMesh,exports.createWorks=createWorks,exports.defaultImageURLTransform=imageURL,exports.draco=draco,exports.getViewportScale=getViewportScale,exports.headingToLongitude=headingToLongitude,exports.imageSupport=imageSupport,exports.isBoundingVolume=isBoundingVolume,exports.isPanoId=isPanoId,exports.ktx2=ktx2,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadFbx=loadFbx,exports.loadGltf=loadGltf,exports.loadObj=loadObj,exports.loadPbm=loadPbm,exports.loadPly=loadPly,exports.loadPnts=loadPnts,exports.loadSpz=loadSpz,exports.loadX3p=loadX3p,exports.longitudeToHeading=longitudeToHeading,exports.makeBoundingVolume=makeBoundingVolume,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,exports.vectorToCoordinates=vectorToCoordinates,exports.workToJson=workToJson});
|