@realsee/five 6.10.0-alpha.1 → 6.10.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/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/five.AdaptiveLuminancePass.html +1 -1
- package/docs/classes/five.BoundingMesh.html +1 -1
- package/docs/classes/five.Camera.html +1 -1
- package/docs/classes/five.EyeDomeLightingPass.html +1 -1
- package/docs/classes/five.Five.html +21 -21
- 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.InternalWebGLRenderer.html +1 -1
- package/docs/classes/five.Model.html +1 -1
- package/docs/classes/five.ModelScene.html +1 -1
- package/docs/classes/five.NetworkSubscribe.html +1 -1
- package/docs/classes/five.PBMContainer.html +1 -1
- package/docs/classes/five.PBMCustomShader.html +1 -1
- package/docs/classes/five.PBMGSObject.html +1 -1
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PBMMeshMaterial.html +1 -1
- package/docs/classes/five.PBMPanoFilter.html +1 -1
- package/docs/classes/five.PBMPointCloud.html +1 -1
- package/docs/classes/five.PBMPointCloudMaterial.html +1 -1
- package/docs/classes/five.PBMSkinnedMesh.html +1 -1
- package/docs/classes/five.PBMUpdateable.html +1 -1
- package/docs/classes/five.PanoCircleMesh.html +1 -1
- package/docs/classes/five.PanoCircleMeshCustom.html +1 -1
- package/docs/classes/five.PanoCircleMeshSolid.html +1 -1
- package/docs/classes/five.Parameter.html +1 -1
- package/docs/classes/five.Scene.html +1 -1
- package/docs/classes/five.Subscribe.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.Work.html +16 -16
- package/docs/classes/five.WorkResolvedObserver.html +16 -16
- package/docs/classes/gltf-loader.GLTFLoader.html +7 -12
- package/docs/classes/gltf-loader.GLTFObject.html +1 -1
- package/docs/classes/line.Line.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/sticker.Sticker.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.parseWork.html +1 -1
- package/docs/functions/five.workToJson.html +1 -1
- package/docs/functions/vue.useFiveWorks.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/five.AddableObject.html +1 -1
- package/docs/interfaces/five.AjaxOptions.html +1 -1
- package/docs/interfaces/five.BaseEvent.html +1 -1
- package/docs/interfaces/five.BaseExtendableEvent.html +1 -1
- package/docs/interfaces/five.EventCallback.html +1 -1
- package/docs/interfaces/five.GestureEvent.html +1 -1
- package/docs/interfaces/five.ImageOptions.html +1 -1
- package/docs/interfaces/five.IntersectEvent.html +1 -1
- package/docs/interfaces/five.IntersectMesh.html +1 -1
- package/docs/interfaces/five.IntersectMeshInterface.html +1 -1
- package/docs/interfaces/five.Intersection.html +1 -1
- package/docs/interfaces/five.LoosePanoWork.html +2 -2
- package/docs/interfaces/five.LooseWork.html +2 -2
- package/docs/interfaces/five.LooseWorkInitial.html +2 -2
- package/docs/interfaces/five.LooseWorkModel.html +2 -2
- package/docs/interfaces/five.LooseWorkObserver.html +2 -2
- package/docs/interfaces/five.LooseWorkPanorama.html +10 -2
- package/docs/interfaces/five.LooseWorkWithExtrinsics.html +7 -7
- package/docs/interfaces/five.ModeChangeEvent.html +1 -1
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelEvent.html +1 -1
- package/docs/interfaces/five.ModelSceneEvent.html +1 -1
- package/docs/interfaces/five.ModelTileEvent.html +1 -1
- package/docs/interfaces/five.MovePanoOptions.html +1 -1
- package/docs/interfaces/five.MoveToPositionOptions.html +38 -0
- package/docs/interfaces/five.NetworkAbortError.html +1 -1
- package/docs/interfaces/five.NetworkFirbiddenError.html +1 -1
- package/docs/interfaces/five.NetworkOptions.html +1 -1
- package/docs/interfaces/five.NetworkProxyError.html +1 -1
- package/docs/interfaces/five.NetworkResourceEvent.html +1 -1
- package/docs/interfaces/five.NetworkResponseError.html +1 -1
- package/docs/interfaces/five.NetworkTimeoutError.html +1 -1
- package/docs/interfaces/five.ObjectEvent.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.PanoCircleMeshInterface.html +1 -1
- package/docs/interfaces/five.PanoEvent.html +1 -1
- package/docs/interfaces/five.PanoPrepareEvent.html +1 -1
- package/docs/interfaces/five.PanoTextureEvent.html +1 -1
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ParameterMaterialValue.html +1 -1
- package/docs/interfaces/five.ParameterTilesetValue.html +1 -1
- package/docs/interfaces/five.ParameterValue.html +1 -1
- package/docs/interfaces/five.Pose.html +1 -1
- package/docs/interfaces/five.RenderEvent.html +1 -1
- package/docs/interfaces/five.ResolvedParameterValue.html +1 -1
- package/docs/interfaces/five.State.html +1 -1
- package/docs/interfaces/five.StateEvent.html +1 -1
- package/docs/interfaces/five.TextureOptions.html +1 -1
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ViewLayer.html +1 -1
- package/docs/interfaces/five.WorkCubeHdrGainmapImage.html +10 -0
- package/docs/interfaces/five.WorkCubeImage.html +5 -2
- package/docs/interfaces/five.WorkImage.html +8 -5
- package/docs/interfaces/five.WorkInitial.html +8 -8
- package/docs/interfaces/five.WorkModel.html +8 -8
- package/docs/interfaces/five.WorkModelLayer.html +6 -6
- package/docs/interfaces/five.WorkObserver.html +17 -17
- package/docs/interfaces/five.WorkObserverProto.html +1 -1
- package/docs/interfaces/five.WorkPanoramaJson.html +3 -2
- package/docs/interfaces/five.WorkTile.html +8 -5
- package/docs/interfaces/five.WorksEvent.html +1 -1
- package/docs/interfaces/five.XRControllerEvent.html +1 -1
- package/docs/interfaces/five.XRGestureEvent.html +1 -1
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.XRSessionEvent.html +1 -1
- package/docs/interfaces/gltf-loader.GLTF.html +17 -7
- 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/modules/five.html +1 -1
- package/docs/modules/gltf-loader.html +1 -1
- package/docs/types/five.LoadResultType.html +1 -1
- package/docs/types/five.ParseOptions.html +6 -6
- package/five/controllers/model.d.ts +2 -1
- package/five/index.d.ts +1 -0
- package/five/index.js +59 -59
- package/five/index.mjs +845 -780
- package/five/types/moveToPositionOptions.d.ts +11 -0
- package/five/work/index.d.ts +1 -1
- package/five/work/looseWorkType.d.ts +8 -0
- package/five/work/work.d.ts +10 -0
- package/five/work/workJsonType.d.ts +1 -0
- package/gltf-loader/index.d.ts +20 -35
- package/gltf-loader/index.js +3 -9
- package/gltf-loader/index.mjs +42 -1350
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/pbmGaussianSplattingObject-BDOzNal0.cjs +2 -2
- package/pbmGaussianSplattingObject-BwsrwWs6.js +2 -2
- 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 -9
- 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 +6 -6
- 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/components/observer.d.ts +2 -0
- package/work-downloader/index.js +3 -3
- package/work-downloader/index.mjs +39 -30
- package/docs/classes/gltf-loader.DDSLoader.html +0 -3
- package/docs/classes/gltf-loader.DRACOLoader.html +0 -8
- package/docs/classes/gltf-loader.GLTFParser.html +0 -6
- package/docs/classes/gltf-loader.THREEGLTFLoader.html +0 -8
- package/docs/interfaces/gltf-loader.DDS.html +0 -7
- package/docs/interfaces/gltf-loader.GLTFReference.html +0 -3
- package/docs/interfaces/gltf-loader.THREEGLTF.html +0 -8
- package/gltf-loader/thirdparty/DDSLoader.d.ts +0 -23
- package/gltf-loader/thirdparty/DRACOLoader.d.ts +0 -18
- package/gltf-loader/thirdparty/GLTFLoader.d.ts +0 -59
package/five/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 9/
|
|
5
|
-
* Version: 6.10.0-alpha.
|
|
4
|
+
* Generated: 2026/9/16
|
|
5
|
+
* Version: 6.10.0-alpha.3
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -961,11 +961,11 @@ void main() {
|
|
|
961
961
|
#include <fog_fragment>
|
|
962
962
|
#include <premultiplied_alpha_fragment>
|
|
963
963
|
}
|
|
964
|
-
`,uniforms:{diffuse:{value:new t.Color},opacity:{value:1},displacementScalar:{value:0}}};function hf(e,n,r,i){let a=new Float32Array((r+1)*(i+1)*3),o=new Float32Array((r+1)*(i+1)*3),s=new Float32Array((r+1)*(i+1)*2),c=new Uint32Array(r*i*6),l=e.computeFrenetFrames(r),u=new t.Vector3,d=new t.Vector3,f=new t.Vector2,p=new t.Vector3;for(let t=0;t<=r;t++){p=e.getPointAt(t/r,p);let c=l.normals[t],m=l.binormals[t];for(let e=0;e<=i;e++){let l=t*(i+1)+e,h=e/i*Math.PI*2,g=Math.sin(h),_=-Math.cos(h);d.x=_*c.x+g*m.x,d.y=_*c.y+g*m.y,d.z=_*c.z+g*m.z,d.normalize(),d.toArray(o,l*3),u.x=p.x+n*d.x,u.y=p.y+n*d.y,u.z=p.z+n*d.z,u.toArray(a,l*3),f.x=t/r,f.y=e/i,f.toArray(s,l*2)}}for(let e=0;e<r;e++)for(let t=0;t<i;t++){let n=(e*i+t)*6,r=(i+1)*e+t,a=(i+1)*(e+1)+t,o=(i+1)*(e+1)+(t+1),s=(i+1)*e+(t+1);c[n]=r,c[n+1]=a,c[n+2]=s,c[n+3]=a,c[n+4]=o,c[n+5]=s}let m=new t.BufferGeometry;return m.setIndex(new t.BufferAttribute(c,1)),m.setAttribute(`position`,new t.BufferAttribute(a,3)),m.setAttribute(`normal`,new t.BufferAttribute(o,3)),m.setAttribute(`uv`,new t.BufferAttribute(s,2)),m}function gf(e,n){let r=new t.Color(0).convertSRGBToLinear(),i=new t.Color(52949).convertSRGBToLinear(),a=new t.Color(3370495).convertSRGBToLinear(),o=new t.Color(16777215).convertSRGBToLinear(),s=0,c=new t.CurvePath,l=e.length;for(let n=3;n<l;n+=3){let r=new t.Vector3().fromArray(e,n-3),i=new t.Vector3().fromArray(e,n);s+=r.distanceTo(i);let a=new t.LineCurve3(r,i);c.add(a)}let u=hf(c,.03,Math.ceil(s*100),6);u.clearGroups(),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,1),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,2);let d=new t.ShaderMaterial({vertexShader:pf.vertexShader,fragmentShader:pf.fragmentShader,uniforms:t.UniformsUtils.clone(pf.uniforms),side:t.BackSide});d.uniforms.totalLength.value=s,d.uniforms.diffuse.value=r,d.uniforms.diffuse2.value=r,d.uniforms.opacity.value=.5,d.transparent=!0;let f=new t.ShaderMaterial({vertexShader:pf.vertexShader,fragmentShader:pf.fragmentShader,uniforms:t.UniformsUtils.clone(pf.uniforms),side:t.BackSide});f.uniforms.totalLength.value=s,f.uniforms.displacementScalar.value=-.01,f.uniforms.diffuse.value=i,f.uniforms.diffuse2.value=a;let p=new t.ShaderMaterial({vertexShader:pf.vertexShader,fragmentShader:pf.fragmentShader,uniforms:t.UniformsUtils.clone(pf.uniforms),side:t.DoubleSide});p.uniforms.totalLength.value=s,p.uniforms.displacementScalar.value=-.026,p.uniforms.dashSize.value=new t.Vector2(.06,.09),p.uniforms.diffuse.value=o,p.uniforms.diffuse2.value=o;let m=new t.Mesh(u,[d,f,p]),h=new t.SphereBufferGeometry(.08,24,24);h.clearGroups(),h.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),h.addGroup(0,u.index?u.index.count:u.attributes.position.count,1);let g=new t.ShaderMaterial({vertexShader:mf.vertexShader,fragmentShader:mf.fragmentShader,uniforms:t.UniformsUtils.clone(mf.uniforms),side:t.BackSide});g.uniforms.diffuse.value=r,g.uniforms.opacity.value=.5,g.transparent=!0;let _=new t.ShaderMaterial({vertexShader:mf.vertexShader,fragmentShader:mf.fragmentShader,uniforms:t.UniformsUtils.clone(mf.uniforms),side:t.FrontSide});_.uniforms.displacementScalar.value=-.01,_.uniforms.diffuse.value=i;let v=new t.Mesh(h,[g,_]);v.position.fromArray(e,0),m.add(v);let y=new t.ShaderMaterial({vertexShader:mf.vertexShader,fragmentShader:mf.fragmentShader,uniforms:t.UniformsUtils.clone(mf.uniforms),side:t.FrontSide});y.uniforms.displacementScalar.value=-.01,y.uniforms.diffuse.value=a;let b=new t.Mesh(h,[g,y]);return b.position.fromArray(e,e.length-3),m.add(b),{scene:m,dispose:()=>{u.dispose(),d.dispose(),f.dispose(),p.dispose(),h.dispose(),g.dispose(),_.dispose(),y.dispose()}}}function _f(e,t){let n=e.name,r=Ur(vr(e.content.uri,t.search),{key:`model.0`});return e.content.loadState=`LOADING`,e.content.loadStateUpdateTime=V(),tc(r,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher:t.fetcher}).then(t=>{var i,a,o,s;let c=(a=(i=t.scene.attributes)==null?void 0:i.time.array)==null?[]:a,l=(s=(o=t.scene.attributes)==null?void 0:o.position.array)==null?[]:s,u=t.byteLength,d=t.memoryUsage,f=gf(l,c);f.scene.applyMatrix4(e.transform),f.scene.updateWorldMatrix(!1,!0),f.scene.matrixAutoUpdate=!1;let p=new Ld(n,f.scene);return e.content.data={uri:r,byteLength:u,memoryUsage:d,positionArray:l,timeArray:c,object:p},e.content.byteLength=u,e.content.memoryUsage=d,e.content.loadState=`READY`,e.content.loadStateUpdateTime=V(),e}).catch(t=>(e.content.data=void 0,e.content.loadState=`FAILED`,e.content.loadStateUpdateTime=V(),t instanceof $n&&t.httpStatus===0||t instanceof er||t instanceof Qn?e.content.loadfailRetryDelay=H(e.content.loadfailRetryDelay+ff,ff,df):e.content.loadfailRetryDelay=1/0,Promise.reject(t)))}function vf(e){e.content&&(e.content.data&&e.content.data.object.dispose(),e.content.data=void 0,e.content.loadState=`UNLOADED`,e.content.loadProgress=0,e.content.loadStateUpdateTime=V(),e.content.byteLength=0,e.content.memoryUsage=0)}var yf=new t.Vector3,bf=new t.Matrix3,xf=new t.Matrix4,Sf=6378137,Cf=298.257223563;function wf(e){let t=Sf-Sf/Cf,n=(Sf*Sf-t*t)/(Sf*Sf),r=Math.sqrt(e.x*e.x+e.y*e.y),i=0,a=Math.atan2(e.z,r),o=0;for(;i++<1e3;){let t=Math.sin(a),i=Sf/Math.sqrt(1-n*t*t);o=r/Math.cos(a)-i;let s=Math.atan2(e.z/(i*(1-n)+o),r/(i+o));if(isNaN(s)||Math.abs(s-a)<1e-12)break;a=s}return e.set(a,Math.atan2(e.y,e.x),o)}function Tf(e){let{x:t,y:n,z:r}=e,i=Sf-Sf/Cf,a=(Sf*Sf-i*i)/(Sf*Sf),o=Math.sin(t),s=Math.cos(t),c=Math.sin(n),l=Math.cos(n),u=Sf/Math.sqrt(1-a*o*o),d=(u+r)*s*l,f=(u+r)*s*c,p=(i*i/(Sf*Sf)*u+r)*o;return e.set(d,f,p)}function Ef(e,t){let{x:n,y:r,z:i}=wf(yf.copy(e)),a=Math.sin(n),o=Math.sin(r),s=Math.cos(n),c=Math.cos(r);t.fromArray([-o,-a*c,s*c,0,+c,-a*o,s*o,0,0,s,a,0,0,0,0,1]);let l=bf.setFromMatrix4(t),u=yf.copy(e).applyMatrix3(l).multiplyScalar(-1);t.setPosition(u);let d=xf.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,i,1]);return t.premultiply(d),t}var Df=new t.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),Of=new t.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),kf=new t.Matrix4().copy(Df),Af=new t.Matrix4().copy(Of);function jf(e,t={}){var n,r,i;let a,o,s;if(typeof e.tileset.rootMeta.creationTime==`string`)if(typeof e.tileset.rootMeta.numTotalPoints==`number`&&e.tileset.rootMeta.numTotalPoints>0){s=4,t.powerPreference===`high`&&(s=2),a=s/1.6;let c=0;if(((n=e.tileset.rootMeta.taskParameters)==null?void 0:n.point_homogenization)===`1`&&(r=e.tileset.rootMeta.taskParameters)!=null&&r.homo_point_density){let t=Number((i=e.tileset.rootMeta.taskParameters)==null?void 0:i.homo_point_density);isFinite(t)&&!isNaN(t)&&(c=t)}c<=0&&(c=.02),o=c*1.4}else s=5,t.powerPreference===`high`&&(s=4),a=0,o=.03;else s=6,a=0,o=.03,e.name===`aerophoto`?(s=12,t.powerPreference===`high`&&(s=10)):e.tileset.asset.extras&&typeof e.tileset.asset.extras.name==`string`&&/^matterport\b/i.test(e.tileset.asset.extras.name)&&(s=5,t.powerPreference===`high`&&(s=4));return{pointScale:o,pointMinPixel:a,maxScreenSpaceError:s}}var Mf=new t.Vector3,Nf=new iu,Pf=new ru,Ff=new WeakMap,If=new WeakMap,Lf=new WeakMap,Rf={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},zf=(()=>{let e=new t.MeshBasicMaterial;return e.side=t.BackSide,e.color.setHex(16711935),e.colorWrite=!1,e.stencilWrite=!0,e.polygonOffset=!0,e.polygonOffsetFactor=2,e.polygonOffsetUnits=2,e.stencilRef=Rf.TILE_MASK,e.stencilFunc=t.AlwaysStencilFunc,e.stencilFuncMask=Rf.TILE_MASK,e.stencilZPass=t.ReplaceStencilOp,e.stencilWriteMask=Rf.TILE_MASK,e})(),Bf=(()=>{let e=new t.MeshBasicMaterial;return e.visible=!1,e})(),Vf=new t.BufferGeometry,Hf=new t.MeshBasicMaterial;function Uf(e){let n;n=e instanceof t.Mesh?new t.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(e=>e.transparent?Bf:zf):e.material&&e.material.transparent?Bf:zf):e instanceof t.Group?new t.Group:new t.Object3D,n.position.copy(e.position),n.quaternion.copy(e.quaternion),n.scale.copy(e.scale),n.matrix.compose(e.position,e.quaternion,e.scale),n.matrixAutoUpdate=!1,n.frustumCulled=e.frustumCulled,n.visible=e.visible;for(let t of e.children)n.add(Uf(t));return n}var Wf=class extends t.Object3D{constructor(e,n){var r,i;super(),this.parameter=new W,this.renderObjects=[],this.backfaceObjects=[],this.tileObjects=[],this.frameNumber=0,this.error=(r=n.error)==null?null:r,this.name=n.name,this.type=n.type,this.upAxis=n.upAxis,this.light=n.light,this.fetcher=n.fetcher,this.search=(i=n.search)==null?``:i,this.groundHeight=n.groundHeight,this.coordinateSystem=n.coordinateSystem,this.boundingBox=new t.Box3,this.autoRefine=!0,this.refined=!1,this.refineProgress=[0,0],this.loaded=!1,this.disposed=!1,this.clearStencilObject=new t.Mesh(Vf,Hf),this.clearStencilObject.frustumCulled=!1,this.clearStencilObject.onAfterRender=e=>e.clearStencil(),this.tileset=new Yd(e,{tileLoader:e=>this.loadContent(e),tileUnloader:e=>this.unloadContent(e),onTileLoad:e=>{this.onTileLoad&&this.onTileLoad(e)},onTileUnload:e=>{this.onTileUnload&&this.onTileUnload(e)},onTileError:(e,t)=>{this.onError&&this.onError(Object.assign(t,{tile:e})),console.error(`Tile error`,e.id,t)},trajectoryLoader:e=>this.loadTrajectory(e),trajectoryUnloader:e=>this.unloadTrajectory(e),onTrajectoryLoad:()=>{},onTrajectoryUnload:e=>{},onTrajectoryError:(e,t)=>{this.onError&&this.onError(Object.assign(t,{error:t})),console.error(`Trajectory error`,e,t)}}),this.tileset.root.boundingVolume&&this.tileset.root.boundingVolume.getBoundingBox(this.boundingBox),this.currentResolvedParameterValue=W.resolveValueTo({},this.parameter)}get viewerRequestVolume(){return this.tileset.root.viewerRequestVolume}set viewerRequestVolume(e){this.tileset.root.viewerRequestVolume=e}get tiles(){return this.tileset.selectedTiles}get trajectories(){return this.tileset.trajectories}getRecommendProps(e={}){return jf(this,e)}loadContent(e){return lf(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(t=>{if(e.type===`SCENEGRAPH`){if(this.disposed||!e.content)uf(e);else if(e.content.data)if(e.content.data.type===`spz`){let t=e.content.data.object.children[0].boundingBox;this.boundingBox.union(t)}else this.boundingBox.expandByObject(e.content.data.object)}})}unloadContent(e){return uf(e),Promise.resolve()}loadAllTilesets(){let e=t=>{let n=[];return this.tileset.root.traverse(e=>{var t;e.type===`TILESET`&&((t=e.content)==null?void 0:t.loadState)!==`READY`&&n.push(e)}),Promise.all(n.map(t=>this.loadContent(t).then(()=>e(t)))).then(()=>{})};return e(this.tileset.root)}loadTrajectory(e){return _f(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(e=>{this.disposed&&vf(e)})}unloadTrajectory(e){return vf(e),Promise.resolve()}intersectRaycaster(e,t){var n,r;let i=t==null?[]:t,a=[this.tileset.root],o=this.tileset.transform,s=(r=(n=e.params.Points)==null?void 0:n.threshold)==null?0:r,c=e.sortByDistance;e.sortByDistance=!1;let l,u=1/0;for(;l=a.pop();){let t;if(l.boundingVolume){let n;n=l.boundingVolume instanceof ru?Pf.copy(l.boundingVolume):l.boundingVolume instanceof iu?Nf.copy(l.boundingVolume):l.boundingVolume.clone(),n.applyMatrix4(o),t=n.intersectRay(e.ray,s,u)}else t=!0;if(t){for(let e=0,t=l.children.length;e<t;e++)a.push(l.children[e]);if(l.selected&&l.content&&l.content.data&&l.content.data.object.visible){let t=e.hitFilter;if(e.hitFilter=n=>{var r;return Object.assign(n,{model:(r=this.parent)==null?void 0:r,viewLayer:this,tile:l}),t?t.call(e,n):!0},l.content.data.object.intersectRaycaster(e,i),e.hitFilter=t,e.firstHitOnly){let e=i[0];e&&u>e.distance&&(u=e.distance)}}}}return e.sortByDistance=c,wu(i,e.sortByDistance,e.firstHitOnly),i}update(e,n,r,i){var a,o,s;this.renderer=e,this.frameNumber++;let c=!1,l=W.resolveValueTo(this.currentResolvedParameterValue,r.parameter,i.parameter,this.parameter);Ff.get(this)!==l.versionNumber&&(Ff.set(this,l.versionNumber),c=!0);let u=this.visible&&i.visible&&r.visible,d=l.maxLevelOfDetail;d=Math.max(d,0);let f=Math.min(l.minLevelOfDetail,d);(!u||!this.loaded||!r.loaded)&&(d=Math.max(f,0));let p=l.maxMemoryUsage;u||(p=Math.min(0,p));let m=l.minGeometricError,h=l.maxRequests,g=l.memoryAdjustedScreenSpaceError;u||(g=!1);let _=n.controllerMode;(_===`Panorama`||_===`VRPanorama`||_===`XRPanorama`)&&(l.modelAlpha<.1&&(m=l.panoramaMinGeometricError,g=!1),l.progress>=.01&&l.progress<=.99&&(h=0));let v=l.maxGeometricError;v=Math.max(m,v);let y={time:n.time,camera:{type:n.type,position:new t.Vector3().copy(n.position),direction:n.getDirection(new t.Vector3),up:new t.Vector3().copy(n.up).applyQuaternion(n.quaternion),projectionMatrix:n.projectionMatrix.clone(),visible:u&&n.visible,refine:n.refineModel},height:n.resolution.height,pixelRatio:n.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*n.fov/180*Math.PI),cullingVolume:new nu().setFromCamera(n),minLevelOfDetail:f,maxLevelOfDetail:d,minGeometricError:m,maxGeometricError:v,skipLevelOfDetail:l.skipLevelOfDetail,mostDetail:l.mostDetail,loadSiblings:l.loadSiblings,cameraCulling:l.cameraCulling,maxMemoryUsage:p,maxRequests:h,requestOrder:l.requestOrder,maxScreenSpaceError:l.maxScreenSpaceError,memoryAdjustedScreenSpaceError:g},b=l.cacheCameras.map(e=>(e.updateProjectionMatrix(),Object.assign(Object.assign({},y),{camera:{type:n.type,position:new t.Vector3().copy(e.position),direction:e.getWorldDirection(new t.Vector3),up:new t.Vector3().copy(e.up),projectionMatrix:e.projectionMatrix.clone(),visible:e.visible,refine:!0},cullingVolume:new nu().setFromCamera(e)})));this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),c=!0);let x=!this.autoRefine;if(x===!1&&l.progress>=.01&&l.progress<=.99){let e=new t.Vector3;l.pano0&&e.setFromMatrixPosition(l.pano0.matrix);let n=e.clone();l.pano1&&n.setFromMatrixPosition(l.pano1.matrix),e.distanceTo(n)<10&&(x=!0)}if(x||this.tileset.update(y,b),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(e=>{if(this.refineProgress[1]++,e.content){let t=e.content.loadState;if(t===`UNLOADED`||t===`LOADING`){this.refined=!1;return}}this.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;let e=!1;this.tileset.needsRefinedTiles.forEach(t=>{if(this.loaded!==!1&&t.content&&(t.state.visible&&(e=!0),l.minLevelOfDetail>=0)){if(y.skipLevelOfDetail){if(t.state.finalResolution){let e=t.state.ancestorWithContentAvailable,n=(e&&e.content?e.content:t.content).loadState;(n===`UNLOADED`||n===`LOADING`)&&(this.loaded=!1)}}else if(t.state.visible&&t.levelOfContent<=0){let e=t.content.loadState;(e===`UNLOADED`||e===`LOADING`)&&(this.loaded=!1)}}}),e&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0;for(let e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);y.skipLevelOfDetail||this.tileset.selectedTiles.sort((e,t)=>e.floor===t.floor?e.levelOfContent===t.levelOfContent?e.state.distanceToCamera===t.state.distanceToCamera?e.state.centerZDepth-t.state.centerZDepth:e.state.distanceToCamera-t.state.distanceToCamera:t.levelOfContent-e.levelOfContent:e.floor-t.floor);let S=[];for(let i of this.tileset.selectedTiles){let s=(o=(a=i.content)==null?void 0:a.data)==null?void 0:o.object;if(!s)continue;let u=s.update(e,n,r,this,i,l);if(S.push(i.id),u&&(c=!0),this.tileset.hasMixedContent&&y.skipLevelOfDetail){if(!i.state.finalResolution){let e=Uf(s);e.name=`skipBackface:`+s.name,this.backfaceObjects.push(e)}let e=i.state.selectionDepth,n=Rf.TILE_MASK|e<<Rf.SKIP_LOD_BIT_SHIFT,r=t.GreaterEqualStencilFunc,a=Rf.SKIP_LOD_MASK,o=t.ReplaceStencilOp,c=Rf.TILE_MASK|Rf.SKIP_LOD_MASK;for(let e of s.materials)e.stencilWrite=!0,e.stencilRef=n,e.stencilFunc=r,e.stencilFuncMask=a,e.stencilZPass=o,e.stencilWriteMask=c}else for(let e of s.materials)e.stencilWrite=!1,e.stencilRef=Rf.TILE_MASK,e.stencilFunc=t.AlwaysStencilFunc,e.stencilFuncMask=Rf.TILE_MASK,e.stencilZPass=t.ReplaceStencilOp,e.stencilWriteMask=Rf.TILE_MASK;this.tileObjects.push(s)}let C=S.toString();if(If.get(this)!==C&&(If.set(this,C),c=!0),y.skipLevelOfDetail&&this.backfaceObjects.length)for(let e=0;e<this.backfaceObjects.length;e++)this.renderObjects.push(this.backfaceObjects[e]);if(this.tileObjects.length)for(let e=0;e<this.tileObjects.length;e++)this.renderObjects.push(this.tileObjects[e]);y.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);let w=[];for(let t of this.tileset.selectedTrajectories){let i=(s=t.content.data)==null?void 0:s.object;if(!i)continue;let a=i.update(e,n,r,this,t,l);w.push(t.id),a&&(c=!0),this.renderObjects.push(i)}let T=w.toString();if(Lf.get(this)!==T&&(Lf.set(this,T),c=!0),this.parent){let e=this.parent.children.length+1,n=Math.max(0,this.parent.children.indexOf(this)),r=1e4,i=(n-e)*r+1;l.onlyDepth&&(i-=e*r);for(let e=0;e<this.renderObjects.length;e++){let n=this.renderObjects[e],r=e+i;n.traverse(e=>{(e instanceof t.Mesh||e instanceof t.Line||e instanceof t.Points)&&(e.renderOrder=r+(e instanceof wn&&e.isDepthProxy?-.5:0))})}}if(this.loaded)for(let e=0;e<this.renderObjects.length;e++)this.add(this.renderObjects[e]);return c}dispose(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id);for(let e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0,this.error=null,this.onError=void 0,this.renderer=void 0}get model(){return this.parent}get scene(){return this}get viewLayer(){return this}localToEnu(e){return e.applyMatrix4(Af)}enuToLocal(e){return e.applyMatrix4(kf)}enuToEcef(e){return e.applyMatrix4(this.coordinateSystem.enuToEcefMatrix)}ecefToEnu(e){return e.applyMatrix4(this.coordinateSystem.ecefToEnuMatrix)}localToEcef(e){return this.enuToEcef(this.localToEnu(e))}ecefToLocal(e){return this.enuToLocal(this.ecefToEnu(e))}localToLla(e){return wf(this.enuToEcef(this.localToEnu(e)))}llaToLocal(e){return this.enuToLocal(this.ecefToEnu(Tf(e)))}worldToEnu(e){return this.localToEnu(this.worldToLocal(e))}enuToWorld(e){return this.localToWorld(this.enuToLocal(e))}worldToEcef(e){return this.localToEcef(this.worldToLocal(e))}ecefToWorld(e){return this.localToWorld(this.ecefToLocal(e))}worldToLla(e){return this.localToLla(this.worldToLocal(e))}llaToWorld(e){return this.localToWorld(this.llaToLocal(e))}get coordinates(){Mf.setScalar(0);let{x:e,y:t}=this.localToLla(Mf);return[e,t].map(e=>(e/Math.PI*180).toFixed(6)).join(`,`)}getTransformMatrix4(e=new t.Matrix4){return e.copy(this.coordinateSystem.ecefToEnuMatrix),e.premultiply(kf),e.premultiply(this.matrixWorld),e}coordinatesToWorldPoint(e){let n=new t.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(n)}worldPointToCoordinates(e){return Mf.copy(e),this.worldToLla(Mf),{latitude:Mf.x,longitude:Mf.y,altitude:Mf.z}}resetBrightness(){this.parameter.reset(`brightness`)}get minLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`minLevelOfDetail`,...e)}set minLevelOfDetail(e){this.parameter.set(`minLevelOfDetail`,e)}get maxLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxLevelOfDetail`,...e)}set maxLevelOfDetail(e){this.parameter.set(`maxLevelOfDetail`,e)}get minGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`minGeometricError`,...e)}set minGeometricError(e){this.parameter.set(`minGeometricError`,e)}get maxGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxGeometricError`,...e)}set maxGeometricError(e){this.parameter.set(`maxGeometricError`,e)}get panoramaMinGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`panoramaMinGeometricError`,...e)}set panoramaMinGeometricError(e){this.parameter.set(`panoramaMinGeometricError`,e)}get skipLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`skipLevelOfDetail`,...e)}set skipLevelOfDetail(e){this.parameter.set(`skipLevelOfDetail`,e)}get mostDetail(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`mostDetail`,...e)}set mostDetail(e){this.parameter.set(`mostDetail`,e)}get loadSiblings(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`loadSiblings`,...e)}set loadSiblings(e){this.parameter.set(`loadSiblings`,e)}get maxMemoryUsage(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxMemoryUsage`,...e)}set maxMemoryUsage(e){this.parameter.set(`maxMemoryUsage`,e)}get maxRequests(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxRequests`,...e)}set maxRequests(e){this.parameter.set(`maxRequests`,e)}get requestOrder(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`requestOrder`,...e)}set requestOrder(e){this.parameter.set(`requestOrder`,e)}get maxScreenSpaceError(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxScreenSpaceError`,...e)}set maxScreenSpaceError(e){this.parameter.set(`maxScreenSpaceError`,e)}},Gf={};function Kf(e,t){let n=Gf[e];if(n){let e=n.get(t);if(e)return e}throw Error(`fetcher workCode:${t.workCode} never registered.`)}function qf(e,t,n){let r=Gf[e];r||(r=Gf[e]=new WeakMap),r.has(t)||r.set(t,n)}var Jf=new t.Matrix4,Yf=new t.Vector3,Xf=new t.Matrix4;function Zf(e,t,n){switch(e){case`Z`:n.identity();break;case`WGS84`:case`GCJ02`:case`BD09`:Ef(t,n);break;default:n.identity();break}return n}function Qf(e){var n;let[r,i]=e.tilesetUrl.split(`#`),a=(n=(i||r).split(`?`)[1])==null?``:n;return e.fetcher.ajax(e.tilesetUrl,{responseType:`text`}).catch(e=>({error:e,body:JSON.stringify({asset:{version:`0.0`},geometricError:0,root:{geometricError:0}})})).then(n=>{var r;let i=`error`in n?n.error:null,o=Zd(JSON.parse(n.body),e.tilesetUrl),{root:s,rootMeta:c={}}=o,l=e.upAxis;c.upAxis&&c.upAxis!==l&&(l=c.upAxis),`lodVersion`in o&&(l=`-Y`,`floorInfo`in o&&(o.properties=o.properties||{},o.properties.floorInfo=o.floorInfo.map(e=>({ground:-e.ground,height:e.height})),o.floorInfo=void 0),o.asset.tilesetVersion=String(o.lodVersion),o.lodVersion=void 0);let u=l,d=new t.Matrix4;u===`Y`?(u=`Z`,d.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1])):u===`-Y`&&(u=`Z`,d.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]));let f=s.boundingVolume?su(s.boundingVolume):void 0;f&&s.transform&&f.applyMatrix4(Xf.fromArray(s.transform));let p=null,m=new t.Matrix4,h=new t.Matrix4;return c.coordinate?(p=c.coordinate.ground_height,m.fromArray(c.coordinate.pose_ecef_to_enu),h.fromArray(c.coordinate.pose_enu_to_ecef)):(f?f.getCenter(Yf):Yf.setScalar(0),Yf.applyMatrix4(d),Zf(u,Yf,m),h.getInverse(m)),o.root={refine:(r=s.refine)==null?`REPLACE`:r,geometricError:s.geometricError,transform:Xf.copy(d).premultiply(u===`Z`?Jf:m).premultiply(kf).toArray(),boundingVolume:f?f.toJson():void 0,children:[s]},new Wf(o,{name:e.name,type:e.type,upAxis:l,light:e.light,fetcher:e.fetcher,search:a,groundHeight:p,coordinateSystem:{enuToEcefMatrix:h,ecefToEnuMatrix:m},error:i})})}function $f(e,t){var n;let r=e.layers.map(e=>({tilesetUrl:e.work.getURL(e.tileset),name:e.name,type:e.type,upAxis:e.upAxis,light:t.light,fetcher:t.fetcher}));if(e.file){let i=!1;for(let e of r)if(e.type===`mesh`){i=!0;break}if(i===!1){let i=br(e.file)||`.at3d`,a=JSON.stringify({tilesetUrl:``,asset:{version:`0.0`},geometricError:0,root:{refine:`REPLACE`,geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:e.work.getURL(e.file)},extras:{[i.slice(1)]:{upAxis:e.upAxis,textureBaseUri:typeof e.textureBase==`string`?e.work.getURL(e.textureBase):void 0,textureArray:e.textures,textureOptions:(n=t.textureOptions)==null?{}:n}}},rootMeta:{coordinate:e.coordinate}});r.push({name:`fallback`,type:`mesh`,upAxis:`Z`,tilesetUrl:URL.createObjectURL(new Blob([a],{type:`application/json`})),fetcher:t.fetcher,light:t.light})}}let i=r.map(e=>Qf(e).then(e=>e));return Promise.all(i)}function ep(e=1,n=1,r=1){let i=e/2,a=n/2,o=r/2,s=new Float32Array([-i,+a,+o,+i,+a,+o,+i,+a,-o,-i,+a,-o,-i,-a,+o,+i,-a,+o,+i,-a,-o,-i,-a,-o]),c=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),l=new t.BufferGeometry;return l.setAttribute(`position`,new t.BufferAttribute(s,3)),l.setIndex(new t.BufferAttribute(c,1)),l.addGroup(0,l.index.count,0),l.computeBoundingBox(),l.computeBoundingSphere(),l}function tp(e,n){for(var r=e[0].index!==null,i=new Set(Object.keys(e[0].attributes)),a=new Set(Object.keys(e[0].morphAttributes)),o={},s={},c=new t.BufferGeometry,l=0,u=0;u<e.length;++u){var d=e[u];if(r!==(d.index!==null))return null;for(var f in d.attributes){if(!i.has(f))return null;o[f]===void 0&&(o[f]=[]),o[f].push(d.attributes[f])}for(var f in d.morphAttributes){if(!a.has(f))return null;s[f]===void 0&&(s[f]=[]),s[f].push(d.morphAttributes[f])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(d.userData),n){var p;if(r)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return null;c.addGroup(l,p,u),l+=p}}if(r){for(var m=0,h=[],u=0;u<e.length;++u){for(var g=e[u].index,_=0;_<g.count;++_)h.push(g.getX(_)+m);m+=e[u].attributes.position.count}c.setIndex(h)}for(var f in o){var v=np(o[f]);if(!v)return null;c.setAttribute(f,v)}for(var f in s){var y=s[f][0].length;if(y===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[f]=[];for(var u=0;u<y;++u){for(var b=[],_=0;_<s[f].length;++_)b.push(s[f][_][u]);var x=np(b);if(!x)return null;c.morphAttributes[f].push(x)}}return c}function np(e){for(var n,r,i,a=0,o=0;o<e.length;++o){var s=e[o];if(s.isInterleavedBufferAttribute||(n===void 0&&(n=s.array.constructor),n!==s.array.constructor)||(r===void 0&&(r=s.itemSize),r!==s.itemSize)||(i===void 0&&(i=s.normalized),i!==s.normalized))return null;a+=s.array.length}for(var c=new n(a),l=0,o=0;o<e.length;++o)c.set(e[o].array,l),l+=e[o].array.length;return new t.BufferAttribute(c,r,i)}function rp(e,n=1e-4){n=Math.max(n,Number.EPSILON);for(var r={},i=e.getIndex(),a=e.getAttribute(`position`),o=i?i.count:a.count,s=0,c=Object.keys(e.attributes),l={},u={},d=[],f=[`getX`,`getY`,`getZ`,`getW`],p=0,m=c.length;p<m;p++){var h=c[p];l[h]=[];var g=e.morphAttributes[h];g&&(u[h]=Array(g.length).fill().map(()=>[]))}for(var _=Math.log10(1/n),v=Math.pow(10,_),p=0;p<o;p++){for(var y=i?i.getX(p):p,b=``,x=0,m=c.length;x<m;x++)for(var h=c[x],S=e.getAttribute(h),C=S.itemSize,w=0;w<C;w++)b+=`${~~(S[f[w]](y)*v)},`;if(b in r)d.push(r[b]);else{for(var x=0,m=c.length;x<m;x++)for(var h=c[x],S=e.getAttribute(h),g=e.morphAttributes[h],C=S.itemSize,T=l[h],E=u[h],w=0;w<C;w++){var D=f[w];if(T.push(S[D](y)),g)for(var O=0,k=g.length;O<k;O++)E[O].push(g[O][D](y))}r[b]=s,d.push(s),s++}}let A=e.clone();for(var p=0,m=c.length;p<m;p++){var h=c[p],j=e.getAttribute(h),M=new j.array.constructor(l[h]),S=new t.BufferAttribute(M,j.itemSize,j.normalized);if(A.setAttribute(h,S),h in u)for(var x=0;x<u[h].length;x++){var N=e.morphAttributes[h][x],M=new N.array.constructor(u[h][x]),ee=new t.BufferAttribute(M,N.itemSize,N.normalized);A.morphAttributes[h][x]=ee}}return A.setIndex(d),A}var ip=new t.Sphere,ap=new t.Matrix4,op=new t.Matrix4;function sp(e,n,r=30/180*Math.PI){let i=Math.cos(r),a=[];for(let r of e.children)r instanceof Wf&&r.tileset.selectedTiles.forEach(e=>{var r,o,s;let c=(o=(r=e.content)==null?void 0:r.data)==null?void 0:o.object;if(c&&c.visible){let e=[];if(c.traverseVisible(r=>{if(r instanceof t.Mesh){let i=sd(r);if(i){ap.copy(r.matrixWorld),op.getInverse(ap),ip.copy(n).applyMatrix4(op);let a=i.trianglesInSphere(ip.center,ip.radius),o=new t.BufferGeometry;o.setAttribute(`position`,new t.BufferAttribute(a,3)),o.applyMatrix4(r.matrixWorld),o=rp(o,.01),e.push(o)}}}),e.length===0)return;let r=[`a`,`b`,`c`],o=tp(e,!1),l=o.getAttribute(`position`).array,u=((s=o.getIndex())==null?void 0:s.array)||[],d=[],f=[];for(let e=0,n=l.length;e<n;e+=3){let n=new t.Vector3(l[e],l[e+1],l[e+2]);d.push(n)}for(let e=0,n=u.length;e<n;e+=3){let n=u[e],r=u[e+1],i=u[e+2],a=new t.Vector3().crossVectors(d[r].clone().sub(d[n]),d[i].clone().sub(d[n])).normalize();f.push({a:n,b:r,c:i,normal:a})}let p={};for(let e=0,t=f.length;e<t;e++){let t=f[e];for(let n=0;n<3;n++){let i=t[r[n]],a=t[r[(n+1)%3]],o=[Math.min(i,a),Math.max(i,a)],s=o[0]+`-`+o[1];p[s]===void 0?p[s]={index1:o[0],index2:o[1],face1:e}:p[s].face2=e}}for(let e in p){let n=p[e];if(n.face2===void 0||f[n.face1].normal.dot(f[n.face2].normal)<=i){let e=d[n.index1],r=d[n.index2];a.push(new t.Line3(e,r))}}d.length=0,f.length=0}});return a}var cp=new t.Box3,lp=new t.Box3,up=new t.Box3,dp=class extends t.Object3D{constructor(e,n,r={}){var i;super(),this.disposed=!1,this.parameter=new W,this.outdated=!1,this.autoRefine=!0,this.metaPending=!1,this.loaded=!1,this.refined=!1,this.refineProgress=[0,0],this.boundingBox=new t.Box3,this.fiveId=e,this.needsRender=!1,this.work=n,this.name=n.workCode;let a=0;for(let e of n.observers)a=Math.max(a,e.floorIndex);if(this.floorLength=a+1,n.model){this.metaPending=!0;let e=$f(n.model,{fetcher:Kf(this.fiveId,n),light:(i=r.light)==null?!1:i,textureOptions:r.textureOptions}),t=e=>this.dispatchEvent({type:`error`,error:e}),a=e=>this.dispatchEvent({type:`tileLoad`,tile:e}),o=e=>this.dispatchEvent({type:`tileUnload`,tile:e});this.initReady=e.then(e=>{var n;this.metaPending=!1;let r=null,i=null,s=null;for(let n of e){if(n.visible=!1,n.onError=t,n.onTileLoad=a,n.onTileUnload=o,n.error){t(n.error);continue}n.type===`mesh`?r===null&&(r=n):n.type===`point_cloud`?i===null&&(i=n):s===null&&(s=n)}let c=(n=r==null?i:r)==null?s:n;if(c&&(c.visible=!0),e.length)if(this.disposed)for(let t of e)t.dispose();else this.add(...e);return this}),this.loadedReady=new Promise(e=>{let t=()=>{e(this),this.removeEventListener(`load`,t),this.removeEventListener(`dispose`,t)};this.addEventListener(`load`,t),this.addEventListener(`dispose`,t)})}else this.refined=!0,this.loaded=!0,this.initReady=Promise.resolve(this),this.loadedReady=Promise.resolve(this);this.parameter.set(`boundingBox`,this.boundingBox.clone())}dispose(){this.disposed=!0;let e;for(;e=this.children[0];)typeof e.dispose==`function`&&e.dispose(),e.onError=void 0,e.onTileLoad=void 0,e.onTileUnload=void 0,this.remove(e);this.dispatchEvent({type:`dispose`})}get empty(){return this.children.length===0}get viewLayers(){return this.children}getEdgesBySphere(e,t=30/180*Math.PI){return sp(this,e,t)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.sortByDistance;e.sortByDistance=!1;for(let t=0,r=this.children.length;t<r;t++){let r=this.children[t];r.visible&&typeof r.intersectRaycaster==`function`&&r.intersectRaycaster(e,n)}return e.sortByDistance=r,wu(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n){let r=!1;this.needsRender===!0&&(this.needsRender=!1,r=!0);let i=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,r=!0);for(let i of this.children)i.autoRefine=this.autoRefine,i.update(e,t,n,this)&&(r=!0),i.refined===!1&&(this.refined=!1),i.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=i.refineProgress[0],this.refineProgress[1]+=i.refineProgress[1];cp.makeEmpty(),up.copy(this.work.observerBox),up.isEmpty()||(up.max.x+=1,up.max.z+=1,up.max.y+=1,--up.min.x,--up.min.z,cp.union(up));for(let e of this.viewLayers)e.boundingBox.isEmpty()||(lp.copy(e.boundingBox),cp.union(lp));return cp.applyMatrix4(this.matrix),cp.equals(this.boundingBox)||(this.boundingBox.copy(cp),this.parameter.set(`boundingBox`,cp.clone())),i===!1&&this.loaded===!0&&this.dispatchEvent({type:`load`}),r}localToEnu(e){return e.applyMatrix4(Af)}enuToLocal(e){return e.applyMatrix4(kf)}worldToEnu(e){return this.localToEnu(this.worldToLocal(e))}enuToWorld(e){return this.localToWorld(this.enuToLocal(e))}get shownFloor(){return this.shownFloorIndex===-1?null:this.shownFloorIndex}set shownFloor(e){this.shownFloorIndex=e===null?-1:e}show(e){this.shownFloor=e==null?null:e,this.dispatchEvent({type:`changeShownFloor`,floorIndex:e==null?null:e})}get bounding(){return this.boundingBox}setMaterial(e){this.parameter.set(e)}getMaterial(){let e=[];return this.parent&&this.parent.parameter instanceof W&&e.unshift(this.parent.parameter),this.parameter.resolveValue(...e)}get shownFloorIndex(){let e=[];return this.parent&&this.parent.parameter instanceof W&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`shownFloorIndex`,...e)}set shownFloorIndex(e){this.parameter.set(`shownFloorIndex`,e)}get brightness(){let e=[];return this.parent&&this.parent.parameter instanceof W&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`brightness`,...e)}set brightness(e){this.parameter.set(`brightness`,e)}get clippers(){let e=[];return this.parent&&this.parent.parameter instanceof W&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`clippers`,...e)}set clippers(e){this.parameter.set(`clippers`,e)}get customShaders(){let e=[];return this.parent&&this.parent.parameter instanceof W&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`customShaders`,...e)}set customShaders(e){this.parameter.set(`customShaders`,e)}resetBrightness(){this.parameter.reset(`brightness`);for(let e of this.viewLayers)e.resetBrightness()}},fp=ep(1,1,1);fp.applyMatrix4(new t.Matrix4().makeScale(-1,1,1));var pp=new WeakMap,mp=new t.Vector3(1,1,1),hp=new t.Box3,gp=new t.Vector3,_p=new t.Box3,vp=new t.Vector3,yp=new t.Vector3,bp=class extends mn{constructor(e={}){var n;let r=new pn(`none`);r.flatShading=!0,r.depthWrite=!1,r.transparent=!1,r.blending=t.CustomBlending,r.blendSrc=t.SrcAlphaFactor,r.blendDst=t.OneMinusSrcAlphaFactor,r.blendSrcAlpha=t.OneFactor,r.blendDstAlpha=t.OneMinusSrcAlphaFactor,r.floorIndex=-1,super(fp,[r]),this.name=(n=e.name)==null?``:n,this.frustumCulled=!1,this.renderOrder=-999999,this.currentResolvedParameterValue=W.resolveValueTo({})}update(e,t,n){var r,i;let a=!1,o=W.resolveValueTo(this.currentResolvedParameterValue,n.parameter);hp.copy(o.boundingBox),hp.getSize(gp);let s=Math.min(gp.x/2,500);hp.min.x-=s,hp.max.x+=s;let c=Math.min(gp.y/2,500);hp.min.z-=c,hp.max.z+=c;let l=gp.length()/2;if(hp.max.y=Math.max(hp.max.y,l),hp.union(_p.setFromCenterAndSize(t.position,mp)),hp.expandByScalar(1),hp.getCenter(vp),hp.getSize(yp),vp.equals(this.position)||(this.position.copy(vp),a=!0),yp.equals(this.scale)||(this.scale.copy(yp),a=!0),pp.get(this)!==o.versionNumber){pp.set(this,o.versionNumber),a=!0;let e=this.material;for(let t of e)t.customShaders=o.customShaders,t.pano0=o.pano0,t.pano1=o.pano1,t.panoFilter=(i=(r=o.panoFilter)==null?void 0:r.toValue())==null?null:i,t.refinedScreen=o.refinedScreen,t.modelAlpha=o.modelAlpha,t.progress=o.progress,t.transition=o.transition,t.opacity=o.opacity,t.roofStyle=o.roofStyle,t.floorStyle=o.floorStyle,t.constantColor=o.constantColor,t.shownFloorIndex=o.shownFloorIndex,t.clippers=o.clippers,t.brightness=o.brightness,t.useHQWeight=o.useHQWeight,t.useHQDepth=o.useHQDepth,t.colorSaturation=o.colorSaturation,t.colorBrightness=o.colorBrightness,t.gradientTexture=o.gradientTexture,t.transparent=!1,t.modelBoundingMax.copy(o.boundingBox.max),t.modelBoundingMin.copy(o.boundingBox.min),o.useAddBlend&&(t.opacity=0),t.opacity===0&&(t.visible=!1)}return a}dispose(){for(let e of this.material)e.dispose(),e.pano0=null,e.pano1=null}},xp=new t.Box3,Sp=class extends t.Scene{constructor(e){super(),this.needsRender=!0,this.autoRefine=!0,this.boundingBox=new t.Box3,this.loaded=!1,this.refined=!1,this.refineProgress=[0,0],this.parameter=new W,this.fiveId=e.fiveId,this.boundingMesh=new bp({name:`bounding`}),this.add(this.boundingMesh);let n=this.models=[];this.shownModels=[],this.updateModelMap=new Map,this.parameter.set(`boundingBox`,this.boundingBox.clone());let r=this;B(n,`autoUpdate`,{get(){return r.autoRefine},set(e){r.autoRefine=e}}),B(n,`bounding`,{get(){return r.boundingBox}}),B(n,`loaded`,{get(){return r.loaded}}),B(n,`refined`,{get(){return r.refined}}),B(n,`refineProgress`,{get(){return r.refineProgress}}),B(n,`cacheCameras`,{get(){return r.parameter.resolveValue(`cacheCameras`)},set(e){r.parameter.set(`cacheCameras`,e)}}),B(n,`intersectRaycaster`,{value:e=>r.intersectRaycaster(e)}),B(n,`setMaterial`,{value:e=>r.setMaterial(e)}),B(n,`getMaterial`,{value:()=>r.getMaterial()}),B(n,`resetBrightness`,{value:()=>r.resetBrightness()})}setModels(e,t){let n=e.map(e=>{let n=this.shownModels.filter(t=>t.work.workCode===e.workCode)[0];if(n||(n=this.models.filter(t=>t.work.workCode===e.workCode)[0],n))return n.work=e,n;n=new dp(this.fiveId,e,{light:t.light,textureOptions:t.textureOptions});let r=t[`3d-tiles`];return n.initReady.then(()=>{if(r)if(typeof r==`function`)for(let e of n.viewLayers){let t=r(e,n);t&&(t.viewerRequestVolume&&(e.viewerRequestVolume=su(t.viewerRequestVolume)),e.parameter.set(fr(t,[`showLayers`])),t.showLayers===!1?e.visible=!1:Array.isArray(t.showLayers)&&(e.visible=t.showLayers.includes(e.name)))}else for(let e of n.viewLayers)r.viewerRequestVolume&&(e.viewerRequestVolume=su(r.viewerRequestVolume)),e.parameter.set(fr(r,[`showLayers`])),r.showLayers===!1?e.visible=!1:Array.isArray(r.showLayers)&&(e.visible=r.showLayers.includes(e.name))}),this.dispatchEvent({type:`model.create`,model:n}),n});for(let e=0;e<this.models.length;e++){let t=this.models[e];n.indexOf(t)===-1&&this.shownModels.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.models.length=0;for(let e=0;e<n.length;e++){let t=n[e];this.models.push(t)}if(t.forceReplaceImmediately&&!yu(this.models,this.shownModels)){for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.models.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.shownModels.length=0;for(let e=0;e<this.models.length;e++)this.shownModels.push(this.models[e])}return this.loaded=!1,this.refined=!1,this.models}get empty(){return this.boundingBox.isEmpty()}intersectRaycaster(e,t){let n=t==null?[]:t,r=this.shownModels.filter(e=>e.visible);if(r.length===1)r[0].intersectRaycaster(e,n);else{let t=e.sortByDistance;e.sortByDistance=!1;for(let t of r)t.intersectRaycaster(e,n);e.sortByDistance=t,wu(n,e.sortByDistance,e.firstHitOnly)}return n}update(e,t){let n=!1;xp.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.updateModelMap.clear();for(let n=0;n<this.models.length;n++){let r=this.models[n];if(!this.updateModelMap.has(r)){let n=r.autoRefine;this.autoRefine===!1&&(r.autoRefine=!1);let i=r.update(e,t,this);r.autoRefine=n,this.updateModelMap.set(r,i)}r.loaded===!1&&(this.loaded=!1),r.refined===!1&&(this.refined=!1),this.refineProgress[0]+=r.refineProgress[0],this.refineProgress[1]+=r.refineProgress[1]}if((this.loaded===!0||this.models.length===0)&&!yu(this.models,this.shownModels)){for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.models.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.shownModels.length=0;for(let e=0;e<this.models.length;e++)this.shownModels.push(this.models[e]);n=!0}for(let n=0;n<this.shownModels.length;n++){let r=this.shownModels[n];if(!this.updateModelMap.has(r)){let n=r.autoRefine;(this.autoRefine===!1||this.models.indexOf(r)<0)&&(r.autoRefine=!1);let i=r.update(e,t,this);r.autoRefine=n,this.updateModelMap.set(r,i)}}for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];t instanceof dp&&this.remove(t)}for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.updateModelMap.get(t)===!0&&(n=!0),xp.union(t.boundingBox),this.add(t)}for(let e=0;e<this.models.length;e++){let t=this.models[e];this.shownModels.indexOf(t)===-1&&xp.union(t.boundingBox)}return xp.equals(this.boundingBox)||(this.boundingBox.copy(xp),this.parameter.set(`boundingBox`,this.boundingBox.clone()),n=!0),this.boundingMesh.update(e,t,this)&&(n=!0),this.updateModelMap.clear(),this.needsRender=n,n}get bounding(){return this.boundingBox}setMaterial(e){this.parameter.set(e)}getMaterial(){return this.parameter.resolveValue()}resetBrightness(){this.parameter.reset(`brightness`);for(let e of this.models)e.resetBrightness()}dispose(){this.remove(this.boundingMesh),this.boundingMesh.dispose();for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];t instanceof dp&&this.remove(t)}let e=xu(this.models.concat(this.shownModels));for(let t=0;t<this.shownModels.length;t++)e[t].dispose();this.models.length=0,this.shownModels.length=0,super.dispose()}};function Cp(e){let t={};return e.mode!==void 0&&(t.mode=e.mode),e.panoIndex!==void 0&&(t.pano_index=e.panoIndex),e.longitude!==void 0&&(t.longitude=e.longitude),e.latitude!==void 0&&(t.latitude=e.latitude),e.fov!==void 0&&(t.fov=e.fov),e.distance!==void 0&&(t.distance=e.distance),e.offset!==void 0&&(t.offset=e.offset.toArray()),t}function wp(e){var t;if(e)return{file_url:e.file,material_base_url:e.textureBase,material_textures:(t=e.textures)==null?void 0:t.slice(),up_axis:e.upAxis,layers:e.layers.map(e=>({tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}))}}function Tp(e){return{index:e.index,derived_id:e.derivedId,derived_id_str:e.derivedIdStr,floor_index:e.floorIndex,position:e.position.toArray(),standing_position:e.standingPosition.toArray(),quaternion:{x:e.quaternion.x,y:e.quaternion.y,z:e.quaternion.z,w:e.quaternion.w},visible_nodes:e.accessibleNodes.slice(),accessible_nodes:e.accessibleNodes.slice()}}function Ep(e){return{index:e.index,active:e.active,loadable:e.loadable,derived_id:e.derivedId,derived_id_str:e.derivedIdStr,size_list:e.images.sizeList.slice(),up:e.images.up,down:e.images.down,right:e.images.right,left:e.images.left,front:e.images.front,back:e.images.back,video:e.images.video?{matrix:e.images.video.matrix.toArray(),size:e.images.video.size.toArray(),source:e.images.video.source}:void 0}}function Dp(e){return{allow_hosts:e.allowHosts.slice(),expire_at:e.expire.getTime().toString(),project_id:e.projectId,code:e.workCode,name:e.name,base_url:e.baseURL,initial:Cp(e.initial),model:wp(e.model),observers:e.observers.map(e=>Tp(e)),panorama:{count:e.observers.length,list:e.observers.map(e=>Ep(e))}}}function Op(e){let n=(e.x*2+1)*Math.PI,r=(.5-e.y)*Math.PI,i=Math.sin(r),a=Math.cos(r),o=Math.sin(n),s=Math.cos(n),c=a*o,l=i,u=a*s,d=Math.abs(c),f=Math.abs(l),p=Math.abs(u),m,h;if(d>=f&&d>=p){let e=1/d;c>0?(m=`right`,h=new t.Vector2(-u*e,l*e)):(m=`left`,h=new t.Vector2(u*e,l*e))}else if(f>=d&&f>=p){let e=1/f;l>0?(m=`up`,h=new t.Vector2(c*e,-u*e)):(m=`down`,h=new t.Vector2(c*e,u*e))}else{let e=1/p;u>0?(m=`front`,h=new t.Vector2(c*e,l*e)):(m=`back`,h=new t.Vector2(-c*e,l*e))}return h.x=(h.x+1)/2,h.y=1-(h.y+1)/2,[m,h]}function kp(e,n){let r=n.x*2-1,i=(1-n.y)*2-1,a=0,o=0,s=0;switch(e){case`right`:a=1,o=i,s=-r;break;case`left`:a=-1,o=i,s=r;break;case`up`:a=r,o=1,s=-i;break;case`down`:a=r,o=-1,s=i;break;case`front`:a=r,o=i,s=1;break;case`back`:a=-r,o=i,s=-1;break;default:throw Error(`Invalid cubFace: ${e}`)}let c=Math.sqrt(a*a+o*o+s*s);if(c===0)return new t.Vector2(.5,.5);a/=c,o/=c,s/=c;let l=Math.atan2(a,s),u=Math.asin(Math.max(-1,Math.min(1,o))),d=(l+Math.PI)/(2*Math.PI),f=(Math.PI/2-u)/Math.PI;return d%=1,d=d<0?d+1:d,f=Math.max(0,Math.min(1,f)),new t.Vector2(d,f)}var Ap={vectorToEquirectangularUv(e,n=`top-left`){let r=new t.Quaternion().setFromRotationMatrix(this.work.transform).inverse(),i=new t.Quaternion().copy(this.quaternion).inverse(),a=new t.Quaternion(0,1,0,0).inverse(),o=new t.Vector3().copy(e).normalize().applyQuaternion(r).applyQuaternion(i).applyQuaternion(a),s=Math.atan2(o.x,-o.z),c=Math.asin(-o.y);if(n===`top-left`)return new t.Vector2(s/(Math.PI*2)+.5,c/Math.PI+.5);if(n===`bottom-left`)return new t.Vector2(s/(Math.PI*2)+.5,.5-c/Math.PI);throw Error(`Invalid uvOrigin ${n}`)},vectorToCubemapUv(e,t=`top-left`){let n=Op(this.vectorToEquirectangularUv(e,`top-left`));if(t===`top-left`)return n;if(t===`bottom-left`){let[e,t]=n;return t.y=1-t.y,n}else throw Error(`Invalid uvOrigin ${t}`)},equirectangularUvToVector(e,n=`top-left`){let r=0;if(n===`top-left`)r=1;else if(n===`bottom-left`)r=-1;else throw Error(`Invalid uvOrigin ${n}`);let i=new t.Quaternion().setFromRotationMatrix(this.work.transform),a=new t.Quaternion().copy(this.quaternion),o=new t.Quaternion(0,1,0,0),s=Math.PI*2*(e.x+.5),c=Math.PI*(e.y-.5),l=Math.abs(Math.cos(c)),u=Math.sin(s)*l,d=-Math.sin(c)*r,f=-Math.cos(s)*l;return new t.Vector3(u,d,f).applyQuaternion(o).applyQuaternion(a).applyQuaternion(i)},cubemapUvToVector(e,n,r=`top-left`){let i;if(r===`top-left`)i=n;else if(r===`bottom-left`)i=new t.Vector2().copy(n),i.y=1-i.y;else throw Error(`Invalid uvOrigin ${r}`);let a=kp(e,i);return this.equirectangularUvToVector(a)},getWorldPosition(){return new t.Vector3().copy(this.position).applyMatrix4(this.work.transform)},getWorldStandingPosition(){return new t.Vector3().copy(this.standingPosition).applyMatrix4(this.work.transform)}};function jp(e){return typeof e==`number`}function Mp(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>typeof e!=`object`||!e?e:Mp(e));{let t={};for(let n in e){let r=e[n];t[n]=typeof r!=`object`||!r?r:Mp(r)}return t}}function Np(e){return e==null?`null`:Array.isArray(e)?`array`:typeof e==`object`?`dict`:`value`}function Pp(e,t){let n=Np(e),r=Np(t);if(r===`null`)return e;if(r===`value`)return t;if(r!==n)return Mp(t);if(r===`array`)for(let n=0;n<t.length;n++)e[n]=Pp(e[n],t[n]);else if(r===`dict`)for(let n in t)e[n]=Pp(e[n],t[n]);return e}function Fp(e,t=!1){let n=typeof e;if(n===`string`)return JSON.stringify(e);if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e instanceof Array){let t=`[`,n=e.length-1,r=0;for(;r<n;r++)t+=Fp(e[r],!1)+`,`;return n>-1&&(t+=Fp(e[r],!1)),t+`]`}if(e instanceof Object){if(typeof e.toJSON==`function`)return Fp(e.toJSON(),t);let n=Object.keys(e).sort(),r=n.length,i=``,a=0;for(;a<r;){let t=n[a],r=Fp(e[t],!0);r!==void 0&&(a&&i!==``&&(i+=`,`),i+=JSON.stringify(t)+`:`+r),a++}return`{`+i+`}`}switch(n){case`function`:return JSON.stringify(e.toString());case`undefined`:return t?void 0:null;case`number`:return e;default:return isFinite(e)?e:null}}function Ip(e){return Fp(e,!1)}function Lp(e){return`hash::${dt(Ip(e))}`}var Rp=/^(.*)\[(\d+)\]$/;function Z(e){if(!isNaN(e.panoIndex)&&isFinite(e.panoIndex))return`${e.workCode}[${e.panoIndex}]`;throw Error(`Invalid Pano`)}function zp(e){let t=e.match(Rp);if(t){let[e,n,r]=t,i=Math.floor(Number(r));if(!isNaN(i)&&isFinite(i))return{workCode:n,panoIndex:i}}throw Error(`Invalid PanoId`)}function Bp(e,t){return Z(e)===Z(t)}function Vp(e){return typeof e==`string`&&Rp.test(e)}var Hp=`\\{([^\\}]+)\\}`;function Up(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Wp(e){return RegExp(`^`+e.map(e=>Up(e)).join(`(.+)`)+`$`)}var Gp=class{constructor(e){this.strings=[],this.keys=[];let t=new RegExp(Hp,`g`),n,r=0;for(;(n=t.exec(e))!==null;)this.strings.push(e.slice(r,n.index)),this.keys.push(n[1]),r=n.index+n[0].length;this.strings.push(e.slice(r))}stringify(e){let t=[this.strings[0]];for(let n=0;n<this.keys.length;n++){let r=e[this.keys[n]];t.push(String(r),this.strings[n+1])}return t.join(``)}match(e){var t;this.matchRegexp=(t=this.matchRegexp)==null?Wp(this.strings):t;let n=e.match(this.matchRegexp);if(!n)return null;let r={};for(let e=0;e<this.keys.length;e++){let t=this.keys[e],i=n[e+1];if(r[t]!==i){if(r[t]!==void 0)return null;r[t]=i}}return r}};function Kp(e){Object.freeze(e);let t=typeof e==`function`,n=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach(function(r){n.call(e,r)&&(!t||r!==`caller`&&r!==`callee`&&r!==`arguments`)&&e[r]!==null&&(typeof e[r]==`object`||typeof e[r]==`function`)&&!Object.isFrozen(e[r])&&Kp(e[r])}),e}var qp=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,Jp=Kp(JSON.parse(function(...e){return arguments[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j`))),Yp=/^([^.]+)(\.([^.]+))*$/,Xp=typeof location<`u`?location.hostname:`localhost`;function Zp(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function Qp(e,t){if(!Yp.test(e)||!Yp.test(t))return!1;if(e===`*`)return!0;let n=e.split(`.`).reverse(),r=t.split(`.`).reverse();if(n.length<=1)return e===t;for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function $p(e){if(/^blob\:/i.test(e)||/^data\:/i.test(e))return Xp;let t=e.match(qp);return t?t[2]:Xp}var em=()=>Error(`Invalid input.`),tm=()=>Error(`Invalid certificate.`),nm=()=>Error(`Invalid signature.`),rm=e=>Error(`Date(${e.toString()}) expired.`),im=e=>Error(`Host(${JSON.stringify(e)}) is not allowed.`);function am(e,t){let n={};for(let r of Object.keys(e))t.indexOf(r)===-1&&(n[r]=e[r]);return n}function om(e,t=!1){let n=typeof e;if(n===`string`)return JSON.stringify(e);if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e instanceof Array){let t=`[`,n=e.length-1,r=0;for(;r<n;r++)t+=om(e[r],!1)+`,`;return n>-1&&(t+=om(e[r],!1)),t+`]`}if(e instanceof Object){if(typeof e.toJSON==`function`)return om(e.toJSON(),t);let n=Object.keys(e).sort(),r=n.length,i=``,a=0;for(;a<r;){let t=n[a],r=om(e[t],!0);r!==void 0&&(a&&i!==``&&(i+=`,`),i+=JSON.stringify(t)+`:`+r),a++}return`{`+i+`}`}switch(n){case`function`:case`undefined`:return t?void 0:null;case`number`:return 0;default:return isFinite(e)?e:null}}function sm(e){return String(om(e,!1))}function cm(e){var t,n,r;let i={};try{i=typeof e==`string`?JSON.parse(e):e}catch(e){return em()}if(typeof i!=`object`)return em();let a=Xp,o=Date.now(),s=new Date(typeof i.expire_at==`string`&&/^\d+$/.test(i.expire_at)?Number(i.expire_at):i.expire_at),c=Array.isArray(i.allow_hosts)?i.allow_hosts:[];if(a.length===0||Zp(a)||Jp.filter(e=>Qp(e,a)).length>0){let e=String((t=i.certificate)==null?``:t);if(e)try{let t=new R;return t.readCertPEM(e),Kp({issuer:t.getSubjectString(),expire:s,allowHosts:c})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`[PARSE Error]: Invalid Certificate. `+t)}return Kp({issuer:`none`,expire:s,allowHosts:c})}let l=String((n=i.certificate)==null?``:n);if(!l)return tm();let u=new R;u.readCertPEM(l);let d=String((r=i._signature)==null?``:r);return!d||_t(sm(am(i,[`_signature`])),d,u)===!1?nm():o<s.getTime()?Jp.concat(c).filter(e=>Qp(e,a)).length===0?im(a):Kp({issuer:u.getSubjectString(),expire:s,allowHosts:c}):rm(s)}function lm(e,t){let n=$p(e);return Xp.length!==0&&!Zp(Xp)&&Jp.filter(e=>Qp(e,Xp)).length===0&&!Zp(n)&&Jp.concat(t).filter(e=>Qp(e,n)).length===0?im(n):e}var um=new Set,dm=new t.Vector3(1,1,1),fm=[`right`,`left`,`up`,`down`,`front`,`back`];function pm(e,t){if(!hr(e))return e;if(e.indexOf(t)===0)return e.slice(t.length);let n=t.replace(/^https\:/,`http:`);if(e.indexOf(n)===0)return e.slice(n.length);let r=t.replace(/^http\:/,`https:`);return e.indexOf(r)===0?e.slice(r.length):(console.warn(`${e} is not start with base_url(${t}).`),e)}function mm(e,t,n){return!hr(e)&&typeof t==`string`&&t.length>0&&(e=_r(t,String(n),e)),e}function hm(e){for(let t=10;t>=0;t--)if(512*Math.pow(2,t)<=e)return t;return null}function gm(e){e=e.slice().sort((e,t)=>e.level-t.level);let t=[];for(let n of e){if(t.length===0){t.push(n);continue}let e=t[t.length-1];if(n.level>e.level){t.push(n);continue}if(n.size>e.size){t[t.length-1]=n;continue}}return t}function _m(e,n){var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x;let S=[],C=null;for(let t of[].concat(e))if(`getURL`in t)C={allowHosts:t.allowHosts,expire:t.expire,issuer:t.issuer},S.push(Dp(t));else{let e=typeof t==`string`?JSON.parse(t):Mp(t),n=cm(e);if(n instanceof Error)return n;C===null&&(C=n),S.push(e)}if(C===null)return Error(`Empty`);B(n,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:C.issuer}),B(n,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(C.expire)}),B(n,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(C.allowHosts)});let w=S.reduce((e,t)=>Pp(e,t));B(n,`name`,{enumerable:!0,configurable:!1,writable:!1,value:String((r=w.name)==null?`Unknown`:r)}),B(n,`workCode`,{enumerable:!0,writable:!0,value:String(w.resource_code||w.basic_code||w.vr_code||w.code||w.project_id||w.work_code||w.workCode||Zt())}),B(n,`projectId`,{enumerable:!0,writable:!0,value:w.project_id}),B(n,`baseURL`,{enumerable:!0,writable:!0,value:(()=>{var e;let t=(e=w.base_url)==null?``:e;return t&&t[t.length-1]!==`/`&&(t+=`/`),t})()});let T;typeof w.model==`object`&&(T={},B(T,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(T,`file`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=w.model.file_url;if(e)return pm(e,n.baseURL)})()}),B(T,`textureBase`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=w.model.material_base_url;return e&&(e=pm(e,n.baseURL)),e})()}),B(T,`textures`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e;return Array.isArray(w.model.material_textures)&&(e=w.model.material_textures.slice(),Object.freeze(e)),e})()}),B(T,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:w.model.up_axis}),B(T,`coordinate`,{enumerable:!0,configurable:!1,writable:!1,value:Mp(w.model.coordinate)}),B(T,`layers`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e,t,r;let i=[];if(Array.isArray(w.model.layers)){for(let a of w.model.layers)if(a&&a.tileset_url){let o={};B(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(o,`name`,{enumerable:!0,configurable:!1,writable:!1,value:(e=a.name)==null?``:e}),B(o,`type`,{enumerable:!0,configurable:!1,writable:!1,value:(t=a.type)==null?`mesh`:t}),B(o,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:(r=a.up_axis)==null?`Z`:r}),B(o,`tileset`,{enumerable:!0,configurable:!1,writable:!1,value:pm(a.tileset_url,n.baseURL)}),i.push(o)}}if(typeof w.model.tiles==`object`){let e=w.model.tiles;if(e&&e.tileset_url){let t={};B(t,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:`lod`}),B(t,`type`,{enumerable:!0,configurable:!1,writable:!1,value:`mesh`}),B(t,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:`-Y`}),B(t,`tileset`,{enumerable:!0,configurable:!1,writable:!1,value:pm(e.tileset_url,n.baseURL)}),i.push(t)}}return Object.freeze(i)})()})),B(n,`model`,{enumerable:!0,configurable:!1,writable:!1,value:T});let E=[];if(Array.isArray(w.observers)&&w.panorama&&Array.isArray(w.panorama.list||w.panorama.info)){let e=w.observers,r=(i=w.panorama.list||w.panorama.info)==null?[]:i,S=(u=(c=(o=(a=w.panorama)==null?void 0:a.pano_high_cube_base_url)==null?(s=w.panorama)==null?void 0:s.pano_cube_base_url:o)==null?(l=w.panorama)==null?void 0:l.base_url:c)==null?``:u,C=Math.min(e.length,r.length),T={};for(let e of Object.keys((d=w.panorama.pattern)==null?{}:d)){let t=e,n=w.panorama.pattern[t];if(typeof n==`string`){let e=new Gp(n);T[t]=t=>e.stringify(t)}else T[t]=()=>n}let D=(e,t)=>{var n;let r=T[t];return(n=e[t])==null?r?r(e):void 0:n};for(let i=0;i<C;i++){let a=e[i],o=r[i],s=Object.create(Ap);B(s,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(s,`index`,{enumerable:!0,configurable:!1,writable:!1,value:i}),B(s,`panoIndex`,{enumerable:!0,configurable:!1,writable:!1,value:i}),B(s,`panoId`,{enumerable:!0,configurable:!1,writable:!1,value:Z({workCode:n.workCode,panoIndex:i})}),B(s,`floorIndex`,{enumerable:!0,configurable:!1,writable:!1,value:(f=a.floor_index)==null?a.floor:f}),B(s,`derivedId`,{enumerable:!0,configurable:!1,writable:!1,value:(m=(p=a.derived_id)==null?D(o,`derived_id`):p)==null?0:m}),B(s,`derivedIdStr`,{enumerable:!0,configurable:!1,writable:!1,value:(g=(h=a.derived_id_str)==null?D(o,`derived_id_str`):h)==null?String(s.derivedId):g}),B(s,`active`,{enumerable:!0,configurable:!1,writable:!1,value:a.active!==!1&&D(o,`active`)!==!1}),B(s,`loadable`,{enumerable:!0,configurable:!1,writable:!1,value:(v=(_=a.loadable)==null?D(o,`loadable`):_)==null?!1:v}),B(s,`position`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new t.Vector3().fromArray((y=a.position)==null?[0,0,0]:y))}),B(s,`standingPosition`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new t.Vector3().fromArray((x=(b=a.standing_position)==null?a.standingPosition:b)==null?[0,0,0]:x))}),B(s,`quaternion`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new t.Quaternion().fromArray(a.quaternion?[a.quaternion.x,a.quaternion.y,a.quaternion.z,a.quaternion.w]:[0,0,0,1]))}),B(s,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new t.Matrix4().compose(s.position,s.quaternion,dm))}),B(s,`accessibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{if(um.clear(),a.accessible_nodes&&Array.isArray(a.accessible_nodes))for(let e of a.accessible_nodes)e>=C||e===i||um.add(e);else if(a.accessibleNodes&&Array.isArray(a.accessibleNodes))for(let e of a.accessibleNodes)e>=C||e===i||um.add(e);else if(a.visible_nodes&&Array.isArray(a.visible_nodes))for(let e of a.visible_nodes)e>=C||e===i||um.add(e);else if(a.visibleNodes&&Array.isArray(a.visibleNodes))for(let e of a.visibleNodes)e>=C||e===i||um.add(e);if(um.size===0)for(let e=0;e<C;e++)e!==i&&um.add(e);let e=Array.from(um);return um.clear(),Object.freeze(e)})()}),B(s,`visibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:s.accessibleNodes}),B(s,`images`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};B(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n});for(let t of fm)B(e,t,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e;return pm(mm((e=D(o,t))==null?``:e,S,i),n.baseURL)})()});return B(e,`sizeList`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let t=Kr(e[fm[0]]),n=D(o,`size_list`),r=D(o,`tiles`);if(t){if(n){let e=n.slice().sort((e,t)=>e-t);return Object.freeze(e)}else if(r){let e=[t],n=r.slice().sort((e,t)=>e-t);for(let r of n){let n=512*Math.pow(2,r);n>t&&e.push(n)}return Object.freeze(e)}return Object.freeze([t])}return Object.freeze([])})()}),B(e,`tiles`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let t=Kr(e.front);if(!t)return;let r=e.sizeList.slice();if(r[0]){let e=hm(r[0]);if(e)for(let t=e-1;t>=0;t--)r.unshift(512*Math.pow(2,t))}if(r.length<=0)return;let i=[];for(let a of r){let r=hm(a);if(typeof r!=`number`)continue;let o={};if(B(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(o,`level`,{enumerable:!0,configurable:!1,writable:!1,value:r}),a>t){B(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:a}),B(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:1});for(let t of fm)B(o,t,{enumerable:!0,configurable:!1,writable:!1,value:qr(e[t],a)})}else{B(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:t}),B(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:a/t});for(let t of fm)B(o,t,{enumerable:!0,configurable:!1,writable:!1,value:e[t]})}i.push(o)}return i=gm(i),Object.freeze(i)})()}),B(e,`video`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=D(o,`video`),r;return e&&(r={},B(r,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(r,`source`,{enumerable:!0,configurable:!1,writable:!1,value:e.source}),B(r,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Matrix4().fromArray(e.matrix)}),B(r,`size`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Vector2().fromArray(e.size)})),r})()}),e})()}),E.push(s)}}B(n,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(E)});let D={};if(B(D,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),w.initial){if(n.observers.length>0){let e;jp(w.initial.panoIndex)?e=w.initial.panoIndex:jp(w.initial.pano_index)?e=w.initial.pano_index:jp(w.initial.pano)&&(e=w.initial.pano),typeof e==`number`&&(e=H(e,0,n.observers.length-1),B(D,`panoIndex`,{enumerable:!0,writable:!0,value:e}))}if(w.initial.mode===`Panorama`&&n.observers.length===0||w.initial.mode===`Floorplan`||w.initial.mode===`Topview`||w.initial.mode===`Model`||w.initial.mode===`Mapview`?B(D,`mode`,{enumerable:!0,writable:!0,value:w.initial.mode}):typeof D.panoIndex==`number`?B(D,`mode`,{enumerable:!0,writable:!0,value:`Panorama`}):B(D,`mode`,{enumerable:!0,writable:!0,value:`Mapview`}),jp(w.initial.latitude)&&B(D,`latitude`,{enumerable:!0,writable:!0,value:w.initial.latitude}),jp(w.initial.longitude)?B(D,`longitude`,{enumerable:!0,writable:!0,value:w.initial.longitude}):jp(w.initial.heading)&&B(D,`longitude`,{enumerable:!0,writable:!0,value:zt(w.initial.heading)}),jp(w.initial.fov)&&B(D,`fov`,{enumerable:!0,writable:!0,value:w.initial.fov}),jp(w.initial.distance)&&B(D,`distance`,{enumerable:!0,writable:!0,value:w.initial.distance}),Array.isArray(w.initial.offset)){let e=w.initial.offset,n=[0,0,0].map((t,n)=>{let r=Number(e[n]);return isNaN(r)||!isFinite(r)?0:r});B(D,`offset`,{enumerable:!0,writable:!0,value:new t.Vector3().fromArray(n)})}else typeof w.initial.offset==`object`&&typeof w.initial.offset.x==`number`&&typeof w.initial.offset.y==`number`&&typeof w.initial.offset.z==`number`&&B(D,`offset`,{enumerable:!0,writable:!0,value:new t.Vector3().fromArray([w.initial.offset.x,w.initial.offset.y,w.initial.offset.z])})}return B(n,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:D}),n}function vm(e,t){return B(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:`null`}),B(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),B(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([`*`])}),B(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:`Null`}),B(t,`workCode`,{enumerable:!0,value:`null-`+Zt()}),B(t,`baseURL`,{enumerable:!0,value:`/`}),B(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),B(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),B(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};return B(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),B(e,`mode`,{enumerable:!0,writable:!0,value:`Mapview`}),e})()}),t}function ym(e,n){var r,i;return B(n,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:`null`}),B(n,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),B(n,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([`*`])}),B(n,`name`,{enumerable:!0,configurable:!1,writable:!1,value:String((r=e.name)==null?`Unknown`:r)}),B(n,`workCode`,{enumerable:!0,writable:!0,value:(i=e.code)==null?Zt():i}),B(n,`baseURL`,{enumerable:!0,writable:!0,value:`/`}),B(n,`model`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),B(n,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let r={};return B(r,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(r,`index`,{enumerable:!0,configurable:!1,writable:!1,value:0}),B(r,`panoIndex`,{enumerable:!0,configurable:!1,writable:!1,value:0}),B(r,`panoId`,{enumerable:!0,configurable:!1,writable:!1,value:Z({workCode:n.workCode,panoIndex:0})}),B(r,`floorIndex`,{enumerable:!0,configurable:!1,writable:!1,value:0}),B(r,`derivedId`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),B(r,`derivedIdStr`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),B(r,`active`,{enumerable:!0,configurable:!1,writable:!1,value:!0}),B(r,`loadable`,{enumerable:!0,configurable:!1,writable:!1,value:!1}),B(r,`position`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Vector3(0,1.5,0)}),B(r,`standingPosition`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Vector3(0,0,0)}),B(r,`quaternion`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Quaternion(0,1,0,0)}),B(r,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Matrix4().compose(r.position,r.quaternion,dm)}),B(r,`accessibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),B(r,`visibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:r.accessibleNodes}),B(r,`images`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let t={};B(t,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n});for(let n of fm)B(t,n,{enumerable:!0,configurable:!1,writable:!1,value:e[n]});return B(t,`sizeList`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([e.size])}),B(t,`tiles`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=Kr(t.front);if(!e)return;let r=t.sizeList.slice();if(r[0]){let e=hm(r[0]);if(e)for(let t=e-1;t>=0;t--)r.unshift(512*Math.pow(2,t))}if(r.length<=0)return;let i=[];for(let a of r){let r=hm(a);if(typeof r!=`number`)continue;let o={};if(B(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(o,`level`,{enumerable:!0,configurable:!1,writable:!1,value:r}),a>e){B(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:a}),B(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:1});for(let e of fm)B(o,e,{enumerable:!0,configurable:!1,writable:!1,value:qr(t[e],a)})}else{B(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:e}),B(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:a/e});for(let e of fm)B(o,e,{enumerable:!0,configurable:!1,writable:!1,value:t[e]})}i.push(o)}return i=gm(i),Object.freeze(i)})()}),B(t,`video`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),t})()}),Object.freeze([r])})()}),B(n,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};return B(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(e,`mode`,{enumerable:!0,writable:!0,value:`Panorama`}),B(e,`panoIndex`,{enumerable:!0,writable:!0,value:0}),e})()}),n}var bm=new WeakSet,xm=class{constructor(e,n){this.observerBox=new t.Box3,this.observerBox=new t.Box3,this.transform=new t.Matrix4,this.shortPath=!1,this.jsonp=!1;let r;if(r=e===null?vm(e,this):typeof e==`object`&&typeof e.size==`number`&&typeof e.up==`string`&&typeof e.down==`string`&&typeof e.right==`string`&&typeof e.left==`string`&&typeof e.front==`string`&&typeof e.back==`string`?ym(e,this):_m(e,this),r instanceof Error)throw Error(`[PARSE FAILED]: `+r.message+`
|
|
964
|
+
`,uniforms:{diffuse:{value:new t.Color},opacity:{value:1},displacementScalar:{value:0}}};function hf(e,n,r,i){let a=new Float32Array((r+1)*(i+1)*3),o=new Float32Array((r+1)*(i+1)*3),s=new Float32Array((r+1)*(i+1)*2),c=new Uint32Array(r*i*6),l=e.computeFrenetFrames(r),u=new t.Vector3,d=new t.Vector3,f=new t.Vector2,p=new t.Vector3;for(let t=0;t<=r;t++){p=e.getPointAt(t/r,p);let c=l.normals[t],m=l.binormals[t];for(let e=0;e<=i;e++){let l=t*(i+1)+e,h=e/i*Math.PI*2,g=Math.sin(h),_=-Math.cos(h);d.x=_*c.x+g*m.x,d.y=_*c.y+g*m.y,d.z=_*c.z+g*m.z,d.normalize(),d.toArray(o,l*3),u.x=p.x+n*d.x,u.y=p.y+n*d.y,u.z=p.z+n*d.z,u.toArray(a,l*3),f.x=t/r,f.y=e/i,f.toArray(s,l*2)}}for(let e=0;e<r;e++)for(let t=0;t<i;t++){let n=(e*i+t)*6,r=(i+1)*e+t,a=(i+1)*(e+1)+t,o=(i+1)*(e+1)+(t+1),s=(i+1)*e+(t+1);c[n]=r,c[n+1]=a,c[n+2]=s,c[n+3]=a,c[n+4]=o,c[n+5]=s}let m=new t.BufferGeometry;return m.setIndex(new t.BufferAttribute(c,1)),m.setAttribute(`position`,new t.BufferAttribute(a,3)),m.setAttribute(`normal`,new t.BufferAttribute(o,3)),m.setAttribute(`uv`,new t.BufferAttribute(s,2)),m}function gf(e,n){let r=new t.Color(0).convertSRGBToLinear(),i=new t.Color(52949).convertSRGBToLinear(),a=new t.Color(3370495).convertSRGBToLinear(),o=new t.Color(16777215).convertSRGBToLinear(),s=0,c=new t.CurvePath,l=e.length;for(let n=3;n<l;n+=3){let r=new t.Vector3().fromArray(e,n-3),i=new t.Vector3().fromArray(e,n);s+=r.distanceTo(i);let a=new t.LineCurve3(r,i);c.add(a)}let u=hf(c,.03,Math.ceil(s*100),6);u.clearGroups(),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,1),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,2);let d=new t.ShaderMaterial({vertexShader:pf.vertexShader,fragmentShader:pf.fragmentShader,uniforms:t.UniformsUtils.clone(pf.uniforms),side:t.BackSide});d.uniforms.totalLength.value=s,d.uniforms.diffuse.value=r,d.uniforms.diffuse2.value=r,d.uniforms.opacity.value=.5,d.transparent=!0;let f=new t.ShaderMaterial({vertexShader:pf.vertexShader,fragmentShader:pf.fragmentShader,uniforms:t.UniformsUtils.clone(pf.uniforms),side:t.BackSide});f.uniforms.totalLength.value=s,f.uniforms.displacementScalar.value=-.01,f.uniforms.diffuse.value=i,f.uniforms.diffuse2.value=a;let p=new t.ShaderMaterial({vertexShader:pf.vertexShader,fragmentShader:pf.fragmentShader,uniforms:t.UniformsUtils.clone(pf.uniforms),side:t.DoubleSide});p.uniforms.totalLength.value=s,p.uniforms.displacementScalar.value=-.026,p.uniforms.dashSize.value=new t.Vector2(.06,.09),p.uniforms.diffuse.value=o,p.uniforms.diffuse2.value=o;let m=new t.Mesh(u,[d,f,p]),h=new t.SphereBufferGeometry(.08,24,24);h.clearGroups(),h.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),h.addGroup(0,u.index?u.index.count:u.attributes.position.count,1);let g=new t.ShaderMaterial({vertexShader:mf.vertexShader,fragmentShader:mf.fragmentShader,uniforms:t.UniformsUtils.clone(mf.uniforms),side:t.BackSide});g.uniforms.diffuse.value=r,g.uniforms.opacity.value=.5,g.transparent=!0;let _=new t.ShaderMaterial({vertexShader:mf.vertexShader,fragmentShader:mf.fragmentShader,uniforms:t.UniformsUtils.clone(mf.uniforms),side:t.FrontSide});_.uniforms.displacementScalar.value=-.01,_.uniforms.diffuse.value=i;let v=new t.Mesh(h,[g,_]);v.position.fromArray(e,0),m.add(v);let y=new t.ShaderMaterial({vertexShader:mf.vertexShader,fragmentShader:mf.fragmentShader,uniforms:t.UniformsUtils.clone(mf.uniforms),side:t.FrontSide});y.uniforms.displacementScalar.value=-.01,y.uniforms.diffuse.value=a;let b=new t.Mesh(h,[g,y]);return b.position.fromArray(e,e.length-3),m.add(b),{scene:m,dispose:()=>{u.dispose(),d.dispose(),f.dispose(),p.dispose(),h.dispose(),g.dispose(),_.dispose(),y.dispose()}}}function _f(e,t){let n=e.name,r=Ur(vr(e.content.uri,t.search),{key:`model.0`});return e.content.loadState=`LOADING`,e.content.loadStateUpdateTime=V(),tc(r,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher:t.fetcher}).then(t=>{var i,a,o,s;let c=(a=(i=t.scene.attributes)==null?void 0:i.time.array)==null?[]:a,l=(s=(o=t.scene.attributes)==null?void 0:o.position.array)==null?[]:s,u=t.byteLength,d=t.memoryUsage,f=gf(l,c);f.scene.applyMatrix4(e.transform),f.scene.updateWorldMatrix(!1,!0),f.scene.matrixAutoUpdate=!1;let p=new Ld(n,f.scene);return e.content.data={uri:r,byteLength:u,memoryUsage:d,positionArray:l,timeArray:c,object:p},e.content.byteLength=u,e.content.memoryUsage=d,e.content.loadState=`READY`,e.content.loadStateUpdateTime=V(),e}).catch(t=>(e.content.data=void 0,e.content.loadState=`FAILED`,e.content.loadStateUpdateTime=V(),t instanceof $n&&t.httpStatus===0||t instanceof er||t instanceof Qn?e.content.loadfailRetryDelay=H(e.content.loadfailRetryDelay+ff,ff,df):e.content.loadfailRetryDelay=1/0,Promise.reject(t)))}function vf(e){e.content&&(e.content.data&&e.content.data.object.dispose(),e.content.data=void 0,e.content.loadState=`UNLOADED`,e.content.loadProgress=0,e.content.loadStateUpdateTime=V(),e.content.byteLength=0,e.content.memoryUsage=0)}var yf=new t.Vector3,bf=new t.Matrix3,xf=new t.Matrix4,Sf=6378137,Cf=298.257223563;function wf(e){let t=Sf-Sf/Cf,n=(Sf*Sf-t*t)/(Sf*Sf),r=Math.sqrt(e.x*e.x+e.y*e.y),i=0,a=Math.atan2(e.z,r),o=0;for(;i++<1e3;){let t=Math.sin(a),i=Sf/Math.sqrt(1-n*t*t);o=r/Math.cos(a)-i;let s=Math.atan2(e.z/(i*(1-n)+o),r/(i+o));if(isNaN(s)||Math.abs(s-a)<1e-12)break;a=s}return e.set(a,Math.atan2(e.y,e.x),o)}function Tf(e){let{x:t,y:n,z:r}=e,i=Sf-Sf/Cf,a=(Sf*Sf-i*i)/(Sf*Sf),o=Math.sin(t),s=Math.cos(t),c=Math.sin(n),l=Math.cos(n),u=Sf/Math.sqrt(1-a*o*o),d=(u+r)*s*l,f=(u+r)*s*c,p=(i*i/(Sf*Sf)*u+r)*o;return e.set(d,f,p)}function Ef(e,t){let{x:n,y:r,z:i}=wf(yf.copy(e)),a=Math.sin(n),o=Math.sin(r),s=Math.cos(n),c=Math.cos(r);t.fromArray([-o,-a*c,s*c,0,+c,-a*o,s*o,0,0,s,a,0,0,0,0,1]);let l=bf.setFromMatrix4(t),u=yf.copy(e).applyMatrix3(l).multiplyScalar(-1);t.setPosition(u);let d=xf.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,i,1]);return t.premultiply(d),t}var Df=new t.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),Of=new t.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),kf=new t.Matrix4().copy(Df),Af=new t.Matrix4().copy(Of);function jf(e,t={}){var n,r,i;let a,o,s;if(typeof e.tileset.rootMeta.creationTime==`string`)if(typeof e.tileset.rootMeta.numTotalPoints==`number`&&e.tileset.rootMeta.numTotalPoints>0){s=4,t.powerPreference===`high`&&(s=2),a=s/1.6;let c=0;if(((n=e.tileset.rootMeta.taskParameters)==null?void 0:n.point_homogenization)===`1`&&(r=e.tileset.rootMeta.taskParameters)!=null&&r.homo_point_density){let t=Number((i=e.tileset.rootMeta.taskParameters)==null?void 0:i.homo_point_density);isFinite(t)&&!isNaN(t)&&(c=t)}c<=0&&(c=.02),o=c*1.4}else s=5,t.powerPreference===`high`&&(s=4),a=0,o=.03;else s=6,a=0,o=.03,e.name===`aerophoto`?(s=12,t.powerPreference===`high`&&(s=10)):e.tileset.asset.extras&&typeof e.tileset.asset.extras.name==`string`&&/^matterport\b/i.test(e.tileset.asset.extras.name)&&(s=5,t.powerPreference===`high`&&(s=4));return{pointScale:o,pointMinPixel:a,maxScreenSpaceError:s}}var Mf=new t.Vector3,Nf=new iu,Pf=new ru,Ff=new WeakMap,If=new WeakMap,Lf=new WeakMap,Rf={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},zf=(()=>{let e=new t.MeshBasicMaterial;return e.side=t.BackSide,e.color.setHex(16711935),e.colorWrite=!1,e.stencilWrite=!0,e.polygonOffset=!0,e.polygonOffsetFactor=2,e.polygonOffsetUnits=2,e.stencilRef=Rf.TILE_MASK,e.stencilFunc=t.AlwaysStencilFunc,e.stencilFuncMask=Rf.TILE_MASK,e.stencilZPass=t.ReplaceStencilOp,e.stencilWriteMask=Rf.TILE_MASK,e})(),Bf=(()=>{let e=new t.MeshBasicMaterial;return e.visible=!1,e})(),Vf=new t.BufferGeometry,Hf=new t.MeshBasicMaterial;function Uf(e){let n;n=e instanceof t.Mesh?new t.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(e=>e.transparent?Bf:zf):e.material&&e.material.transparent?Bf:zf):e instanceof t.Group?new t.Group:new t.Object3D,n.position.copy(e.position),n.quaternion.copy(e.quaternion),n.scale.copy(e.scale),n.matrix.compose(e.position,e.quaternion,e.scale),n.matrixAutoUpdate=!1,n.frustumCulled=e.frustumCulled,n.visible=e.visible;for(let t of e.children)n.add(Uf(t));return n}var Wf=class extends t.Object3D{constructor(e,n){var r,i;super(),this.parameter=new W,this.renderObjects=[],this.backfaceObjects=[],this.tileObjects=[],this.frameNumber=0,this.error=(r=n.error)==null?null:r,this.name=n.name,this.type=n.type,this.upAxis=n.upAxis,this.light=n.light,this.fetcher=n.fetcher,this.search=(i=n.search)==null?``:i,this.groundHeight=n.groundHeight,this.coordinateSystem=n.coordinateSystem,this.boundingBox=new t.Box3,this.autoRefine=!0,this.refined=!1,this.refineProgress=[0,0],this.loaded=!1,this.disposed=!1,this.clearStencilObject=new t.Mesh(Vf,Hf),this.clearStencilObject.frustumCulled=!1,this.clearStencilObject.onAfterRender=e=>e.clearStencil(),this.tileset=new Yd(e,{tileLoader:e=>this.loadContent(e),tileUnloader:e=>this.unloadContent(e),onTileLoad:e=>{this.onTileLoad&&this.onTileLoad(e)},onTileUnload:e=>{this.onTileUnload&&this.onTileUnload(e)},onTileError:(e,t)=>{this.onError&&this.onError(Object.assign(t,{tile:e})),console.error(`Tile error`,e.id,t)},trajectoryLoader:e=>this.loadTrajectory(e),trajectoryUnloader:e=>this.unloadTrajectory(e),onTrajectoryLoad:()=>{},onTrajectoryUnload:e=>{},onTrajectoryError:(e,t)=>{this.onError&&this.onError(Object.assign(t,{error:t})),console.error(`Trajectory error`,e,t)}}),this.tileset.root.boundingVolume&&this.tileset.root.boundingVolume.getBoundingBox(this.boundingBox),this.currentResolvedParameterValue=W.resolveValueTo({},this.parameter)}get viewerRequestVolume(){return this.tileset.root.viewerRequestVolume}set viewerRequestVolume(e){this.tileset.root.viewerRequestVolume=e}get tiles(){return this.tileset.selectedTiles}get trajectories(){return this.tileset.trajectories}getRecommendProps(e={}){return jf(this,e)}loadContent(e){return lf(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(t=>{if(e.type===`SCENEGRAPH`){if(this.disposed||!e.content)uf(e);else if(e.content.data)if(e.content.data.type===`spz`){let t=e.content.data.object.children[0].boundingBox;this.boundingBox.union(t)}else this.boundingBox.expandByObject(e.content.data.object)}})}unloadContent(e){return uf(e),Promise.resolve()}loadAllTilesets(){let e=t=>{let n=[];return this.tileset.root.traverse(e=>{var t;e.type===`TILESET`&&((t=e.content)==null?void 0:t.loadState)!==`READY`&&n.push(e)}),Promise.all(n.map(t=>this.loadContent(t).then(()=>e(t)))).then(()=>{})};return e(this.tileset.root)}loadTrajectory(e){return _f(e,{fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(e=>{this.disposed&&vf(e)})}unloadTrajectory(e){return vf(e),Promise.resolve()}intersectRaycaster(e,t){var n,r;let i=t==null?[]:t,a=[this.tileset.root],o=this.tileset.transform,s=(r=(n=e.params.Points)==null?void 0:n.threshold)==null?0:r,c=e.sortByDistance;e.sortByDistance=!1;let l,u=1/0;for(;l=a.pop();){let t;if(l.boundingVolume){let n;n=l.boundingVolume instanceof ru?Pf.copy(l.boundingVolume):l.boundingVolume instanceof iu?Nf.copy(l.boundingVolume):l.boundingVolume.clone(),n.applyMatrix4(o),t=n.intersectRay(e.ray,s,u)}else t=!0;if(t){for(let e=0,t=l.children.length;e<t;e++)a.push(l.children[e]);if(l.selected&&l.content&&l.content.data&&l.content.data.object.visible){let t=e.hitFilter;if(e.hitFilter=n=>{var r;return Object.assign(n,{model:(r=this.parent)==null?void 0:r,viewLayer:this,tile:l}),t?t.call(e,n):!0},l.content.data.object.intersectRaycaster(e,i),e.hitFilter=t,e.firstHitOnly){let e=i[0];e&&u>e.distance&&(u=e.distance)}}}}return e.sortByDistance=c,wu(i,e.sortByDistance,e.firstHitOnly),i}update(e,n,r,i){var a,o,s;this.renderer=e,this.frameNumber++;let c=!1,l=W.resolveValueTo(this.currentResolvedParameterValue,r.parameter,i.parameter,this.parameter);Ff.get(this)!==l.versionNumber&&(Ff.set(this,l.versionNumber),c=!0);let u=this.visible&&i.visible&&r.visible,d=l.maxLevelOfDetail;d=Math.max(d,0);let f=Math.min(l.minLevelOfDetail,d);(!u||!this.loaded||!r.loaded)&&(d=Math.max(f,0));let p=l.maxMemoryUsage;u||(p=Math.min(0,p));let m=l.minGeometricError,h=l.maxRequests,g=l.memoryAdjustedScreenSpaceError;u||(g=!1);let _=n.controllerMode;(_===`Panorama`||_===`VRPanorama`||_===`XRPanorama`)&&(l.modelAlpha<.1&&(m=l.panoramaMinGeometricError,g=!1),l.progress>=.01&&l.progress<=.99&&(h=0));let v=l.maxGeometricError;v=Math.max(m,v);let y={time:n.time,camera:{type:n.type,position:new t.Vector3().copy(n.position),direction:n.getDirection(new t.Vector3),up:new t.Vector3().copy(n.up).applyQuaternion(n.quaternion),projectionMatrix:n.projectionMatrix.clone(),visible:u&&n.visible,refine:n.refineModel},height:n.resolution.height,pixelRatio:n.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*n.fov/180*Math.PI),cullingVolume:new nu().setFromCamera(n),minLevelOfDetail:f,maxLevelOfDetail:d,minGeometricError:m,maxGeometricError:v,skipLevelOfDetail:l.skipLevelOfDetail,mostDetail:l.mostDetail,loadSiblings:l.loadSiblings,cameraCulling:l.cameraCulling,maxMemoryUsage:p,maxRequests:h,requestOrder:l.requestOrder,maxScreenSpaceError:l.maxScreenSpaceError,memoryAdjustedScreenSpaceError:g},b=l.cacheCameras.map(e=>(e.updateProjectionMatrix(),Object.assign(Object.assign({},y),{camera:{type:n.type,position:new t.Vector3().copy(e.position),direction:e.getWorldDirection(new t.Vector3),up:new t.Vector3().copy(e.up),projectionMatrix:e.projectionMatrix.clone(),visible:e.visible,refine:!0},cullingVolume:new nu().setFromCamera(e)})));this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),c=!0);let x=!this.autoRefine;if(x===!1&&l.progress>=.01&&l.progress<=.99){let e=new t.Vector3;l.pano0&&e.setFromMatrixPosition(l.pano0.matrix);let n=e.clone();l.pano1&&n.setFromMatrixPosition(l.pano1.matrix),e.distanceTo(n)<10&&(x=!0)}if(x||this.tileset.update(y,b),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(e=>{if(this.refineProgress[1]++,e.content){let t=e.content.loadState;if(t===`UNLOADED`||t===`LOADING`){this.refined=!1;return}}this.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;let e=!1;this.tileset.needsRefinedTiles.forEach(t=>{if(this.loaded!==!1&&t.content&&(t.state.visible&&(e=!0),l.minLevelOfDetail>=0)){if(y.skipLevelOfDetail){if(t.state.finalResolution){let e=t.state.ancestorWithContentAvailable,n=(e&&e.content?e.content:t.content).loadState;(n===`UNLOADED`||n===`LOADING`)&&(this.loaded=!1)}}else if(t.state.visible&&t.levelOfContent<=0){let e=t.content.loadState;(e===`UNLOADED`||e===`LOADING`)&&(this.loaded=!1)}}}),e&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0;for(let e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);y.skipLevelOfDetail||this.tileset.selectedTiles.sort((e,t)=>e.floor===t.floor?e.levelOfContent===t.levelOfContent?e.state.distanceToCamera===t.state.distanceToCamera?e.state.centerZDepth-t.state.centerZDepth:e.state.distanceToCamera-t.state.distanceToCamera:t.levelOfContent-e.levelOfContent:e.floor-t.floor);let S=[];for(let i of this.tileset.selectedTiles){let s=(o=(a=i.content)==null?void 0:a.data)==null?void 0:o.object;if(!s)continue;let u=s.update(e,n,r,this,i,l);if(S.push(i.id),u&&(c=!0),this.tileset.hasMixedContent&&y.skipLevelOfDetail){if(!i.state.finalResolution){let e=Uf(s);e.name=`skipBackface:`+s.name,this.backfaceObjects.push(e)}let e=i.state.selectionDepth,n=Rf.TILE_MASK|e<<Rf.SKIP_LOD_BIT_SHIFT,r=t.GreaterEqualStencilFunc,a=Rf.SKIP_LOD_MASK,o=t.ReplaceStencilOp,c=Rf.TILE_MASK|Rf.SKIP_LOD_MASK;for(let e of s.materials)e.stencilWrite=!0,e.stencilRef=n,e.stencilFunc=r,e.stencilFuncMask=a,e.stencilZPass=o,e.stencilWriteMask=c}else for(let e of s.materials)e.stencilWrite=!1,e.stencilRef=Rf.TILE_MASK,e.stencilFunc=t.AlwaysStencilFunc,e.stencilFuncMask=Rf.TILE_MASK,e.stencilZPass=t.ReplaceStencilOp,e.stencilWriteMask=Rf.TILE_MASK;this.tileObjects.push(s)}let C=S.toString();if(If.get(this)!==C&&(If.set(this,C),c=!0),y.skipLevelOfDetail&&this.backfaceObjects.length)for(let e=0;e<this.backfaceObjects.length;e++)this.renderObjects.push(this.backfaceObjects[e]);if(this.tileObjects.length)for(let e=0;e<this.tileObjects.length;e++)this.renderObjects.push(this.tileObjects[e]);y.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);let w=[];for(let t of this.tileset.selectedTrajectories){let i=(s=t.content.data)==null?void 0:s.object;if(!i)continue;let a=i.update(e,n,r,this,t,l);w.push(t.id),a&&(c=!0),this.renderObjects.push(i)}let T=w.toString();if(Lf.get(this)!==T&&(Lf.set(this,T),c=!0),this.parent){let e=this.parent.children.length+1,n=Math.max(0,this.parent.children.indexOf(this)),r=1e4,i=(n-e)*r+1;l.onlyDepth&&(i-=e*r);for(let e=0;e<this.renderObjects.length;e++){let n=this.renderObjects[e],r=e+i;n.traverse(e=>{(e instanceof t.Mesh||e instanceof t.Line||e instanceof t.Points)&&(e.renderOrder=r+(e instanceof wn&&e.isDepthProxy?-.5:0))})}}if(this.loaded)for(let e=0;e<this.renderObjects.length;e++)this.add(this.renderObjects[e]);return c}dispose(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id);for(let e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0,this.error=null,this.onError=void 0,this.renderer=void 0}get model(){return this.parent}get scene(){return this}get viewLayer(){return this}localToEnu(e){return e.applyMatrix4(Af)}enuToLocal(e){return e.applyMatrix4(kf)}enuToEcef(e){return e.applyMatrix4(this.coordinateSystem.enuToEcefMatrix)}ecefToEnu(e){return e.applyMatrix4(this.coordinateSystem.ecefToEnuMatrix)}localToEcef(e){return this.enuToEcef(this.localToEnu(e))}ecefToLocal(e){return this.enuToLocal(this.ecefToEnu(e))}localToLla(e){return wf(this.enuToEcef(this.localToEnu(e)))}llaToLocal(e){return this.enuToLocal(this.ecefToEnu(Tf(e)))}worldToEnu(e){return this.localToEnu(this.worldToLocal(e))}enuToWorld(e){return this.localToWorld(this.enuToLocal(e))}worldToEcef(e){return this.localToEcef(this.worldToLocal(e))}ecefToWorld(e){return this.localToWorld(this.ecefToLocal(e))}worldToLla(e){return this.localToLla(this.worldToLocal(e))}llaToWorld(e){return this.localToWorld(this.llaToLocal(e))}get coordinates(){Mf.setScalar(0);let{x:e,y:t}=this.localToLla(Mf);return[e,t].map(e=>(e/Math.PI*180).toFixed(6)).join(`,`)}getTransformMatrix4(e=new t.Matrix4){return e.copy(this.coordinateSystem.ecefToEnuMatrix),e.premultiply(kf),e.premultiply(this.matrixWorld),e}coordinatesToWorldPoint(e){let n=new t.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(n)}worldPointToCoordinates(e){return Mf.copy(e),this.worldToLla(Mf),{latitude:Mf.x,longitude:Mf.y,altitude:Mf.z}}resetBrightness(){this.parameter.reset(`brightness`)}get minLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`minLevelOfDetail`,...e)}set minLevelOfDetail(e){this.parameter.set(`minLevelOfDetail`,e)}get maxLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxLevelOfDetail`,...e)}set maxLevelOfDetail(e){this.parameter.set(`maxLevelOfDetail`,e)}get minGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`minGeometricError`,...e)}set minGeometricError(e){this.parameter.set(`minGeometricError`,e)}get maxGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxGeometricError`,...e)}set maxGeometricError(e){this.parameter.set(`maxGeometricError`,e)}get panoramaMinGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`panoramaMinGeometricError`,...e)}set panoramaMinGeometricError(e){this.parameter.set(`panoramaMinGeometricError`,e)}get skipLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`skipLevelOfDetail`,...e)}set skipLevelOfDetail(e){this.parameter.set(`skipLevelOfDetail`,e)}get mostDetail(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`mostDetail`,...e)}set mostDetail(e){this.parameter.set(`mostDetail`,e)}get loadSiblings(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`loadSiblings`,...e)}set loadSiblings(e){this.parameter.set(`loadSiblings`,e)}get maxMemoryUsage(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxMemoryUsage`,...e)}set maxMemoryUsage(e){this.parameter.set(`maxMemoryUsage`,e)}get maxRequests(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxRequests`,...e)}set maxRequests(e){this.parameter.set(`maxRequests`,e)}get requestOrder(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`requestOrder`,...e)}set requestOrder(e){this.parameter.set(`requestOrder`,e)}get maxScreenSpaceError(){let e=[];return this.parent&&this.parent.parameter instanceof W&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof W&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxScreenSpaceError`,...e)}set maxScreenSpaceError(e){this.parameter.set(`maxScreenSpaceError`,e)}},Gf={};function Kf(e,t){let n=Gf[e];if(n){let e=n.get(t);if(e)return e}throw Error(`fetcher workCode:${t.workCode} never registered.`)}function qf(e,t,n){let r=Gf[e];r||(r=Gf[e]=new WeakMap),r.has(t)||r.set(t,n)}var Jf=new t.Matrix4,Yf=new t.Vector3,Xf=new t.Matrix4;function Zf(e,t,n){switch(e){case`Z`:n.identity();break;case`WGS84`:case`GCJ02`:case`BD09`:Ef(t,n);break;default:n.identity();break}return n}function Qf(e){var n;let[r,i]=e.tilesetUrl.split(`#`),a=(n=(i||r).split(`?`)[1])==null?``:n;return e.fetcher.ajax(e.tilesetUrl,{responseType:`text`}).catch(e=>({error:e,body:JSON.stringify({asset:{version:`0.0`},geometricError:0,root:{geometricError:0}})})).then(n=>{var r;let i=`error`in n?n.error:null,o=Zd(JSON.parse(n.body),e.tilesetUrl),{root:s,rootMeta:c={}}=o,l=e.upAxis;c.upAxis&&c.upAxis!==l&&(l=c.upAxis),`lodVersion`in o&&(l=`-Y`,`floorInfo`in o&&(o.properties=o.properties||{},o.properties.floorInfo=o.floorInfo.map(e=>({ground:-e.ground,height:e.height})),o.floorInfo=void 0),o.asset.tilesetVersion=String(o.lodVersion),o.lodVersion=void 0);let u=l,d=new t.Matrix4;u===`Y`?(u=`Z`,d.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1])):u===`-Y`&&(u=`Z`,d.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]));let f=s.boundingVolume?su(s.boundingVolume):void 0;f&&s.transform&&f.applyMatrix4(Xf.fromArray(s.transform));let p=null,m=new t.Matrix4,h=new t.Matrix4;return c.coordinate?(p=c.coordinate.ground_height,m.fromArray(c.coordinate.pose_ecef_to_enu),h.fromArray(c.coordinate.pose_enu_to_ecef)):(f?f.getCenter(Yf):Yf.setScalar(0),Yf.applyMatrix4(d),Zf(u,Yf,m),h.getInverse(m)),o.root={refine:(r=s.refine)==null?`REPLACE`:r,geometricError:s.geometricError,transform:Xf.copy(d).premultiply(u===`Z`?Jf:m).premultiply(kf).toArray(),boundingVolume:f?f.toJson():void 0,children:[s]},new Wf(o,{name:e.name,type:e.type,upAxis:l,light:e.light,fetcher:e.fetcher,search:a,groundHeight:p,coordinateSystem:{enuToEcefMatrix:h,ecefToEnuMatrix:m},error:i})})}function $f(e,t){var n;let r=e.layers.map(e=>({tilesetUrl:e.work.getURL(e.tileset),name:e.name,type:e.type,upAxis:e.upAxis,light:t.light,fetcher:t.fetcher}));if(e.file){let i=!1;for(let e of r)if(e.type===`mesh`){i=!0;break}if(i===!1){let i=br(e.file)||`.at3d`,a=JSON.stringify({tilesetUrl:``,asset:{version:`0.0`},geometricError:0,root:{refine:`REPLACE`,geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:e.work.getURL(e.file)},extras:{[i.slice(1)]:{upAxis:e.upAxis,textureBaseUri:typeof e.textureBase==`string`?e.work.getURL(e.textureBase):void 0,textureArray:e.textures,textureOptions:(n=t.textureOptions)==null?{}:n}}},rootMeta:{coordinate:e.coordinate}});r.push({name:`fallback`,type:`mesh`,upAxis:`Z`,tilesetUrl:URL.createObjectURL(new Blob([a],{type:`application/json`})),fetcher:t.fetcher,light:t.light})}}let i=r.map(e=>Qf(e).then(e=>e));return Promise.all(i)}function ep(e=1,n=1,r=1){let i=e/2,a=n/2,o=r/2,s=new Float32Array([-i,+a,+o,+i,+a,+o,+i,+a,-o,-i,+a,-o,-i,-a,+o,+i,-a,+o,+i,-a,-o,-i,-a,-o]),c=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),l=new t.BufferGeometry;return l.setAttribute(`position`,new t.BufferAttribute(s,3)),l.setIndex(new t.BufferAttribute(c,1)),l.addGroup(0,l.index.count,0),l.computeBoundingBox(),l.computeBoundingSphere(),l}function tp(e,n){for(var r=e[0].index!==null,i=new Set(Object.keys(e[0].attributes)),a=new Set(Object.keys(e[0].morphAttributes)),o={},s={},c=new t.BufferGeometry,l=0,u=0;u<e.length;++u){var d=e[u];if(r!==(d.index!==null))return null;for(var f in d.attributes){if(!i.has(f))return null;o[f]===void 0&&(o[f]=[]),o[f].push(d.attributes[f])}for(var f in d.morphAttributes){if(!a.has(f))return null;s[f]===void 0&&(s[f]=[]),s[f].push(d.morphAttributes[f])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(d.userData),n){var p;if(r)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return null;c.addGroup(l,p,u),l+=p}}if(r){for(var m=0,h=[],u=0;u<e.length;++u){for(var g=e[u].index,_=0;_<g.count;++_)h.push(g.getX(_)+m);m+=e[u].attributes.position.count}c.setIndex(h)}for(var f in o){var v=np(o[f]);if(!v)return null;c.setAttribute(f,v)}for(var f in s){var y=s[f][0].length;if(y===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[f]=[];for(var u=0;u<y;++u){for(var b=[],_=0;_<s[f].length;++_)b.push(s[f][_][u]);var x=np(b);if(!x)return null;c.morphAttributes[f].push(x)}}return c}function np(e){for(var n,r,i,a=0,o=0;o<e.length;++o){var s=e[o];if(s.isInterleavedBufferAttribute||(n===void 0&&(n=s.array.constructor),n!==s.array.constructor)||(r===void 0&&(r=s.itemSize),r!==s.itemSize)||(i===void 0&&(i=s.normalized),i!==s.normalized))return null;a+=s.array.length}for(var c=new n(a),l=0,o=0;o<e.length;++o)c.set(e[o].array,l),l+=e[o].array.length;return new t.BufferAttribute(c,r,i)}function rp(e,n=1e-4){n=Math.max(n,Number.EPSILON);for(var r={},i=e.getIndex(),a=e.getAttribute(`position`),o=i?i.count:a.count,s=0,c=Object.keys(e.attributes),l={},u={},d=[],f=[`getX`,`getY`,`getZ`,`getW`],p=0,m=c.length;p<m;p++){var h=c[p];l[h]=[];var g=e.morphAttributes[h];g&&(u[h]=Array(g.length).fill().map(()=>[]))}for(var _=Math.log10(1/n),v=Math.pow(10,_),p=0;p<o;p++){for(var y=i?i.getX(p):p,b=``,x=0,m=c.length;x<m;x++)for(var h=c[x],S=e.getAttribute(h),C=S.itemSize,w=0;w<C;w++)b+=`${~~(S[f[w]](y)*v)},`;if(b in r)d.push(r[b]);else{for(var x=0,m=c.length;x<m;x++)for(var h=c[x],S=e.getAttribute(h),g=e.morphAttributes[h],C=S.itemSize,T=l[h],E=u[h],w=0;w<C;w++){var D=f[w];if(T.push(S[D](y)),g)for(var O=0,k=g.length;O<k;O++)E[O].push(g[O][D](y))}r[b]=s,d.push(s),s++}}let A=e.clone();for(var p=0,m=c.length;p<m;p++){var h=c[p],j=e.getAttribute(h),M=new j.array.constructor(l[h]),S=new t.BufferAttribute(M,j.itemSize,j.normalized);if(A.setAttribute(h,S),h in u)for(var x=0;x<u[h].length;x++){var N=e.morphAttributes[h][x],M=new N.array.constructor(u[h][x]),ee=new t.BufferAttribute(M,N.itemSize,N.normalized);A.morphAttributes[h][x]=ee}}return A.setIndex(d),A}var ip=new t.Sphere,ap=new t.Matrix4,op=new t.Matrix4;function sp(e,n,r=30/180*Math.PI){let i=Math.cos(r),a=[];for(let r of e.children)r instanceof Wf&&r.tileset.selectedTiles.forEach(e=>{var r,o,s;let c=(o=(r=e.content)==null?void 0:r.data)==null?void 0:o.object;if(c&&c.visible){let e=[];if(c.traverseVisible(r=>{if(r instanceof t.Mesh){let i=sd(r);if(i){ap.copy(r.matrixWorld),op.getInverse(ap),ip.copy(n).applyMatrix4(op);let a=i.trianglesInSphere(ip.center,ip.radius),o=new t.BufferGeometry;o.setAttribute(`position`,new t.BufferAttribute(a,3)),o.applyMatrix4(r.matrixWorld),o=rp(o,.01),e.push(o)}}}),e.length===0)return;let r=[`a`,`b`,`c`],o=tp(e,!1),l=o.getAttribute(`position`).array,u=((s=o.getIndex())==null?void 0:s.array)||[],d=[],f=[];for(let e=0,n=l.length;e<n;e+=3){let n=new t.Vector3(l[e],l[e+1],l[e+2]);d.push(n)}for(let e=0,n=u.length;e<n;e+=3){let n=u[e],r=u[e+1],i=u[e+2],a=new t.Vector3().crossVectors(d[r].clone().sub(d[n]),d[i].clone().sub(d[n])).normalize();f.push({a:n,b:r,c:i,normal:a})}let p={};for(let e=0,t=f.length;e<t;e++){let t=f[e];for(let n=0;n<3;n++){let i=t[r[n]],a=t[r[(n+1)%3]],o=[Math.min(i,a),Math.max(i,a)],s=o[0]+`-`+o[1];p[s]===void 0?p[s]={index1:o[0],index2:o[1],face1:e}:p[s].face2=e}}for(let e in p){let n=p[e];if(n.face2===void 0||f[n.face1].normal.dot(f[n.face2].normal)<=i){let e=d[n.index1],r=d[n.index2];a.push(new t.Line3(e,r))}}d.length=0,f.length=0}});return a}var cp=new t.Box3,lp=new t.Box3,up=new t.Box3,dp=class extends t.Object3D{constructor(e,n,r={}){var i;super(),this.disposed=!1,this.parameter=new W,this.outdated=!1,this.autoRefine=!0,this.metaPending=!1,this.loaded=!1,this.refined=!1,this.refineProgress=[0,0],this.boundingBox=new t.Box3,this.fiveId=e,this.needsRender=!1,this.work=n,this.name=n.workCode;let a=0;for(let e of n.observers)a=Math.max(a,e.floorIndex);if(this.floorLength=a+1,n.model){this.metaPending=!0;let e=$f(n.model,{fetcher:Kf(this.fiveId,n),light:(i=r.light)==null?!1:i,textureOptions:r.textureOptions}),t=e=>this.dispatchEvent({type:`error`,error:e}),a=e=>this.dispatchEvent({type:`tileLoad`,tile:e}),o=e=>this.dispatchEvent({type:`tileUnload`,tile:e});this.initReady=e.then(e=>{var n;this.metaPending=!1;let r=null,i=null,s=null;for(let n of e){if(n.visible=!1,n.onError=t,n.onTileLoad=a,n.onTileUnload=o,n.error){t(n.error);continue}n.type===`mesh`?r===null&&(r=n):n.type===`point_cloud`?i===null&&(i=n):s===null&&(s=n)}let c=(n=r==null?i:r)==null?s:n;if(c&&(c.visible=!0),e.length)if(this.disposed)for(let t of e)t.dispose();else this.add(...e);return this}),this.loadedReady=new Promise(e=>{let t=()=>{e(this),this.removeEventListener(`load`,t),this.removeEventListener(`dispose`,t)};this.addEventListener(`load`,t),this.addEventListener(`dispose`,t)})}else this.refined=!0,this.loaded=!0,this.initReady=Promise.resolve(this),this.loadedReady=Promise.resolve(this);this.parameter.set(`boundingBox`,this.boundingBox.clone())}dispose(){this.disposed=!0;let e;for(;e=this.children[0];)typeof e.dispose==`function`&&e.dispose(),e.onError=void 0,e.onTileLoad=void 0,e.onTileUnload=void 0,this.remove(e);this.dispatchEvent({type:`dispose`})}get empty(){return this.children.length===0}get viewLayers(){return this.children}getEdgesBySphere(e,t=30/180*Math.PI){return sp(this,e,t)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.sortByDistance;e.sortByDistance=!1;for(let t=0,r=this.children.length;t<r;t++){let r=this.children[t];r.visible&&typeof r.intersectRaycaster==`function`&&r.intersectRaycaster(e,n)}return e.sortByDistance=r,wu(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n){let r=!1;this.needsRender===!0&&(this.needsRender=!1,r=!0);let i=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,r=!0);for(let i of this.children)i.autoRefine=this.autoRefine,i.update(e,t,n,this)&&(r=!0),i.refined===!1&&(this.refined=!1),i.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=i.refineProgress[0],this.refineProgress[1]+=i.refineProgress[1];cp.makeEmpty(),up.copy(this.work.observerBox),up.isEmpty()||(up.max.x+=1,up.max.z+=1,up.max.y+=1,--up.min.x,--up.min.z,cp.union(up));for(let e of this.viewLayers)e.boundingBox.isEmpty()||(lp.copy(e.boundingBox),cp.union(lp));return cp.applyMatrix4(this.matrix),cp.equals(this.boundingBox)||(this.boundingBox.copy(cp),this.parameter.set(`boundingBox`,cp.clone())),i===!1&&this.loaded===!0&&this.dispatchEvent({type:`load`}),r}localToEnu(e){return e.applyMatrix4(Af)}enuToLocal(e){return e.applyMatrix4(kf)}worldToEnu(e){return this.localToEnu(this.worldToLocal(e))}enuToWorld(e){return this.localToWorld(this.enuToLocal(e))}get shownFloor(){return this.shownFloorIndex===-1?null:this.shownFloorIndex}set shownFloor(e){this.shownFloorIndex=e===null?-1:e}show(e){this.shownFloor=e==null?null:e,this.dispatchEvent({type:`changeShownFloor`,floorIndex:e==null?null:e})}get bounding(){return this.boundingBox}setMaterial(e){this.parameter.set(e)}getMaterial(){let e=[];return this.parent&&this.parent.parameter instanceof W&&e.unshift(this.parent.parameter),this.parameter.resolveValue(...e)}get shownFloorIndex(){let e=[];return this.parent&&this.parent.parameter instanceof W&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`shownFloorIndex`,...e)}set shownFloorIndex(e){this.parameter.set(`shownFloorIndex`,e)}get brightness(){let e=[];return this.parent&&this.parent.parameter instanceof W&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`brightness`,...e)}set brightness(e){this.parameter.set(`brightness`,e)}get clippers(){let e=[];return this.parent&&this.parent.parameter instanceof W&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`clippers`,...e)}set clippers(e){this.parameter.set(`clippers`,e)}get customShaders(){let e=[];return this.parent&&this.parent.parameter instanceof W&&e.unshift(this.parent.parameter),this.parameter.resolveValue(`customShaders`,...e)}set customShaders(e){this.parameter.set(`customShaders`,e)}resetBrightness(){this.parameter.reset(`brightness`);for(let e of this.viewLayers)e.resetBrightness()}},fp=ep(1,1,1);fp.applyMatrix4(new t.Matrix4().makeScale(-1,1,1));var pp=new WeakMap,mp=new t.Vector3(1,1,1),hp=new t.Box3,gp=new t.Vector3,_p=new t.Box3,vp=new t.Vector3,yp=new t.Vector3,bp=class extends mn{constructor(e={}){var n;let r=new pn(`none`);r.flatShading=!0,r.depthWrite=!1,r.transparent=!1,r.blending=t.CustomBlending,r.blendSrc=t.SrcAlphaFactor,r.blendDst=t.OneMinusSrcAlphaFactor,r.blendSrcAlpha=t.OneFactor,r.blendDstAlpha=t.OneMinusSrcAlphaFactor,r.floorIndex=-1,super(fp,[r]),this.name=(n=e.name)==null?``:n,this.frustumCulled=!1,this.renderOrder=-999999,this.currentResolvedParameterValue=W.resolveValueTo({})}update(e,t,n){var r,i;let a=!1,o=W.resolveValueTo(this.currentResolvedParameterValue,n.parameter);hp.copy(o.boundingBox),hp.getSize(gp);let s=Math.min(gp.x/2,500);hp.min.x-=s,hp.max.x+=s;let c=Math.min(gp.y/2,500);hp.min.z-=c,hp.max.z+=c;let l=gp.length()/2;if(hp.max.y=Math.max(hp.max.y,l),hp.union(_p.setFromCenterAndSize(t.position,mp)),hp.expandByScalar(1),hp.getCenter(vp),hp.getSize(yp),vp.equals(this.position)||(this.position.copy(vp),a=!0),yp.equals(this.scale)||(this.scale.copy(yp),a=!0),pp.get(this)!==o.versionNumber){pp.set(this,o.versionNumber),a=!0;let e=this.material;for(let t of e)t.customShaders=o.customShaders,t.pano0=o.pano0,t.pano1=o.pano1,t.panoFilter=(i=(r=o.panoFilter)==null?void 0:r.toValue())==null?null:i,t.refinedScreen=o.refinedScreen,t.modelAlpha=o.modelAlpha,t.progress=o.progress,t.transition=o.transition,t.opacity=o.opacity,t.roofStyle=o.roofStyle,t.floorStyle=o.floorStyle,t.constantColor=o.constantColor,t.shownFloorIndex=o.shownFloorIndex,t.clippers=o.clippers,t.brightness=o.brightness,t.useHQWeight=o.useHQWeight,t.useHQDepth=o.useHQDepth,t.colorSaturation=o.colorSaturation,t.colorBrightness=o.colorBrightness,t.gradientTexture=o.gradientTexture,t.transparent=!1,t.modelBoundingMax.copy(o.boundingBox.max),t.modelBoundingMin.copy(o.boundingBox.min),o.useAddBlend&&(t.opacity=0),t.opacity===0&&(t.visible=!1)}return a}dispose(){for(let e of this.material)e.dispose(),e.pano0=null,e.pano1=null}},xp=new t.Box3,Sp=class extends t.Scene{constructor(e){super(),this.needsRender=!0,this.autoRefine=!0,this.boundingBox=new t.Box3,this.loaded=!1,this.refined=!1,this.refineProgress=[0,0],this.parameter=new W,this.fiveId=e.fiveId,this.boundingMesh=new bp({name:`bounding`}),this.add(this.boundingMesh);let n=this.models=[];this.shownModels=[],this.updateModelMap=new Map,this.parameter.set(`boundingBox`,this.boundingBox.clone());let r=this;B(n,`autoUpdate`,{get(){return r.autoRefine},set(e){r.autoRefine=e}}),B(n,`bounding`,{get(){return r.boundingBox}}),B(n,`loaded`,{get(){return r.loaded}}),B(n,`refined`,{get(){return r.refined}}),B(n,`refineProgress`,{get(){return r.refineProgress}}),B(n,`cacheCameras`,{get(){return r.parameter.resolveValue(`cacheCameras`)},set(e){r.parameter.set(`cacheCameras`,e)}}),B(n,`intersectRaycaster`,{value:e=>r.intersectRaycaster(e)}),B(n,`setMaterial`,{value:e=>r.setMaterial(e)}),B(n,`getMaterial`,{value:()=>r.getMaterial()}),B(n,`resetBrightness`,{value:()=>r.resetBrightness()})}setModels(e,t){let n=e.map(e=>{let n=this.shownModels.filter(t=>t.work.workCode===e.workCode)[0];if(n||(n=this.models.filter(t=>t.work.workCode===e.workCode)[0],n))return n.work=e,n;n=new dp(this.fiveId,e,{light:t.light,textureOptions:t.textureOptions});let r=t[`3d-tiles`];return n.initReady.then(()=>{if(r)if(typeof r==`function`)for(let e of n.viewLayers){let t=r(e,n);t&&(t.viewerRequestVolume&&(e.viewerRequestVolume=su(t.viewerRequestVolume)),e.parameter.set(fr(t,[`showLayers`])),t.showLayers===!1?e.visible=!1:Array.isArray(t.showLayers)&&(e.visible=t.showLayers.includes(e.name)))}else for(let e of n.viewLayers)r.viewerRequestVolume&&(e.viewerRequestVolume=su(r.viewerRequestVolume)),e.parameter.set(fr(r,[`showLayers`])),r.showLayers===!1?e.visible=!1:Array.isArray(r.showLayers)&&(e.visible=r.showLayers.includes(e.name))}),this.dispatchEvent({type:`model.create`,model:n}),n});for(let e=0;e<this.models.length;e++){let t=this.models[e];n.indexOf(t)===-1&&this.shownModels.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.models.length=0;for(let e=0;e<n.length;e++){let t=n[e];this.models.push(t)}if(t.forceReplaceImmediately&&!yu(this.models,this.shownModels)){for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.models.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.shownModels.length=0;for(let e=0;e<this.models.length;e++)this.shownModels.push(this.models[e])}return this.loaded=!1,this.refined=!1,this.models}get empty(){return this.boundingBox.isEmpty()}intersectRaycaster(e,t){let n=t==null?[]:t,r=this.shownModels.filter(e=>e.visible);if(r.length===1)r[0].intersectRaycaster(e,n);else{let t=e.sortByDistance;e.sortByDistance=!1;for(let t of r)t.intersectRaycaster(e,n);e.sortByDistance=t,wu(n,e.sortByDistance,e.firstHitOnly)}return n}update(e,t){let n=!1;xp.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.updateModelMap.clear();for(let n=0;n<this.models.length;n++){let r=this.models[n];if(!this.updateModelMap.has(r)){let n=r.autoRefine;this.autoRefine===!1&&(r.autoRefine=!1);let i=r.update(e,t,this);r.autoRefine=n,this.updateModelMap.set(r,i)}r.loaded===!1&&(this.loaded=!1),r.refined===!1&&(this.refined=!1),this.refineProgress[0]+=r.refineProgress[0],this.refineProgress[1]+=r.refineProgress[1]}if((this.loaded===!0||this.models.length===0)&&!yu(this.models,this.shownModels)){for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.models.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.shownModels.length=0;for(let e=0;e<this.models.length;e++)this.shownModels.push(this.models[e]);n=!0}for(let n=0;n<this.shownModels.length;n++){let r=this.shownModels[n];if(!this.updateModelMap.has(r)){let n=r.autoRefine;(this.autoRefine===!1||this.models.indexOf(r)<0)&&(r.autoRefine=!1);let i=r.update(e,t,this);r.autoRefine=n,this.updateModelMap.set(r,i)}}for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];t instanceof dp&&this.remove(t)}for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.updateModelMap.get(t)===!0&&(n=!0),xp.union(t.boundingBox),this.add(t)}for(let e=0;e<this.models.length;e++){let t=this.models[e];this.shownModels.indexOf(t)===-1&&xp.union(t.boundingBox)}return xp.equals(this.boundingBox)||(this.boundingBox.copy(xp),this.parameter.set(`boundingBox`,this.boundingBox.clone()),n=!0),this.boundingMesh.update(e,t,this)&&(n=!0),this.updateModelMap.clear(),this.needsRender=n,n}get bounding(){return this.boundingBox}setMaterial(e){this.parameter.set(e)}getMaterial(){return this.parameter.resolveValue()}resetBrightness(){this.parameter.reset(`brightness`);for(let e of this.models)e.resetBrightness()}dispose(){this.remove(this.boundingMesh),this.boundingMesh.dispose();for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];t instanceof dp&&this.remove(t)}let e=xu(this.models.concat(this.shownModels));for(let t=0;t<this.shownModels.length;t++)e[t].dispose();this.models.length=0,this.shownModels.length=0,super.dispose()}};function Cp(e){let t={};return e.mode!==void 0&&(t.mode=e.mode),e.panoIndex!==void 0&&(t.pano_index=e.panoIndex),e.longitude!==void 0&&(t.longitude=e.longitude),e.latitude!==void 0&&(t.latitude=e.latitude),e.fov!==void 0&&(t.fov=e.fov),e.distance!==void 0&&(t.distance=e.distance),e.offset!==void 0&&(t.offset=e.offset.toArray()),t}function wp(e){var t;if(e)return{file_url:e.file,material_base_url:e.textureBase,material_textures:(t=e.textures)==null?void 0:t.slice(),up_axis:e.upAxis,layers:e.layers.map(e=>({tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}))}}function Tp(e){return{index:e.index,derived_id:e.derivedId,derived_id_str:e.derivedIdStr,floor_index:e.floorIndex,position:e.position.toArray(),standing_position:e.standingPosition.toArray(),quaternion:{x:e.quaternion.x,y:e.quaternion.y,z:e.quaternion.z,w:e.quaternion.w},visible_nodes:e.accessibleNodes.slice(),accessible_nodes:e.accessibleNodes.slice()}}function Ep(e){return{index:e.index,active:e.active,loadable:e.loadable,derived_id:e.derivedId,derived_id_str:e.derivedIdStr,size_list:e.images.sizeList.slice(),up:e.images.up,down:e.images.down,right:e.images.right,left:e.images.left,front:e.images.front,back:e.images.back,hdr:e.images.gainmap!==void 0,video:e.images.video?{matrix:e.images.video.matrix.toArray(),size:e.images.video.size.toArray(),source:e.images.video.source}:void 0}}function Dp(e){return{allow_hosts:e.allowHosts.slice(),expire_at:e.expire.getTime().toString(),project_id:e.projectId,code:e.workCode,name:e.name,base_url:e.baseURL,initial:Cp(e.initial),model:wp(e.model),observers:e.observers.map(e=>Tp(e)),panorama:{count:e.observers.length,list:e.observers.map(e=>Ep(e))}}}function Op(e){let n=(e.x*2+1)*Math.PI,r=(.5-e.y)*Math.PI,i=Math.sin(r),a=Math.cos(r),o=Math.sin(n),s=Math.cos(n),c=a*o,l=i,u=a*s,d=Math.abs(c),f=Math.abs(l),p=Math.abs(u),m,h;if(d>=f&&d>=p){let e=1/d;c>0?(m=`right`,h=new t.Vector2(-u*e,l*e)):(m=`left`,h=new t.Vector2(u*e,l*e))}else if(f>=d&&f>=p){let e=1/f;l>0?(m=`up`,h=new t.Vector2(c*e,-u*e)):(m=`down`,h=new t.Vector2(c*e,u*e))}else{let e=1/p;u>0?(m=`front`,h=new t.Vector2(c*e,l*e)):(m=`back`,h=new t.Vector2(-c*e,l*e))}return h.x=(h.x+1)/2,h.y=1-(h.y+1)/2,[m,h]}function kp(e,n){let r=n.x*2-1,i=(1-n.y)*2-1,a=0,o=0,s=0;switch(e){case`right`:a=1,o=i,s=-r;break;case`left`:a=-1,o=i,s=r;break;case`up`:a=r,o=1,s=-i;break;case`down`:a=r,o=-1,s=i;break;case`front`:a=r,o=i,s=1;break;case`back`:a=-r,o=i,s=-1;break;default:throw Error(`Invalid cubFace: ${e}`)}let c=Math.sqrt(a*a+o*o+s*s);if(c===0)return new t.Vector2(.5,.5);a/=c,o/=c,s/=c;let l=Math.atan2(a,s),u=Math.asin(Math.max(-1,Math.min(1,o))),d=(l+Math.PI)/(2*Math.PI),f=(Math.PI/2-u)/Math.PI;return d%=1,d=d<0?d+1:d,f=Math.max(0,Math.min(1,f)),new t.Vector2(d,f)}var Ap={vectorToEquirectangularUv(e,n=`top-left`){let r=new t.Quaternion().setFromRotationMatrix(this.work.transform).inverse(),i=new t.Quaternion().copy(this.quaternion).inverse(),a=new t.Quaternion(0,1,0,0).inverse(),o=new t.Vector3().copy(e).normalize().applyQuaternion(r).applyQuaternion(i).applyQuaternion(a),s=Math.atan2(o.x,-o.z),c=Math.asin(-o.y);if(n===`top-left`)return new t.Vector2(s/(Math.PI*2)+.5,c/Math.PI+.5);if(n===`bottom-left`)return new t.Vector2(s/(Math.PI*2)+.5,.5-c/Math.PI);throw Error(`Invalid uvOrigin ${n}`)},vectorToCubemapUv(e,t=`top-left`){let n=Op(this.vectorToEquirectangularUv(e,`top-left`));if(t===`top-left`)return n;if(t===`bottom-left`){let[e,t]=n;return t.y=1-t.y,n}else throw Error(`Invalid uvOrigin ${t}`)},equirectangularUvToVector(e,n=`top-left`){let r=0;if(n===`top-left`)r=1;else if(n===`bottom-left`)r=-1;else throw Error(`Invalid uvOrigin ${n}`);let i=new t.Quaternion().setFromRotationMatrix(this.work.transform),a=new t.Quaternion().copy(this.quaternion),o=new t.Quaternion(0,1,0,0),s=Math.PI*2*(e.x+.5),c=Math.PI*(e.y-.5),l=Math.abs(Math.cos(c)),u=Math.sin(s)*l,d=-Math.sin(c)*r,f=-Math.cos(s)*l;return new t.Vector3(u,d,f).applyQuaternion(o).applyQuaternion(a).applyQuaternion(i)},cubemapUvToVector(e,n,r=`top-left`){let i;if(r===`top-left`)i=n;else if(r===`bottom-left`)i=new t.Vector2().copy(n),i.y=1-i.y;else throw Error(`Invalid uvOrigin ${r}`);let a=kp(e,i);return this.equirectangularUvToVector(a)},getWorldPosition(){return new t.Vector3().copy(this.position).applyMatrix4(this.work.transform)},getWorldStandingPosition(){return new t.Vector3().copy(this.standingPosition).applyMatrix4(this.work.transform)}};function jp(e){return typeof e==`number`}function Mp(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>typeof e!=`object`||!e?e:Mp(e));{let t={};for(let n in e){let r=e[n];t[n]=typeof r!=`object`||!r?r:Mp(r)}return t}}function Np(e){return e==null?`null`:Array.isArray(e)?`array`:typeof e==`object`?`dict`:`value`}function Pp(e,t){let n=Np(e),r=Np(t);if(r===`null`)return e;if(r===`value`)return t;if(r!==n)return Mp(t);if(r===`array`)for(let n=0;n<t.length;n++)e[n]=Pp(e[n],t[n]);else if(r===`dict`)for(let n in t)e[n]=Pp(e[n],t[n]);return e}function Fp(e,t=!1){let n=typeof e;if(n===`string`)return JSON.stringify(e);if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e instanceof Array){let t=`[`,n=e.length-1,r=0;for(;r<n;r++)t+=Fp(e[r],!1)+`,`;return n>-1&&(t+=Fp(e[r],!1)),t+`]`}if(e instanceof Object){if(typeof e.toJSON==`function`)return Fp(e.toJSON(),t);let n=Object.keys(e).sort(),r=n.length,i=``,a=0;for(;a<r;){let t=n[a],r=Fp(e[t],!0);r!==void 0&&(a&&i!==``&&(i+=`,`),i+=JSON.stringify(t)+`:`+r),a++}return`{`+i+`}`}switch(n){case`function`:return JSON.stringify(e.toString());case`undefined`:return t?void 0:null;case`number`:return e;default:return isFinite(e)?e:null}}function Ip(e){return Fp(e,!1)}function Lp(e){return`hash::${dt(Ip(e))}`}var Rp=/^(.*)\[(\d+)\]$/;function Z(e){if(!isNaN(e.panoIndex)&&isFinite(e.panoIndex))return`${e.workCode}[${e.panoIndex}]`;throw Error(`Invalid Pano`)}function zp(e){let t=e.match(Rp);if(t){let[e,n,r]=t,i=Math.floor(Number(r));if(!isNaN(i)&&isFinite(i))return{workCode:n,panoIndex:i}}throw Error(`Invalid PanoId`)}function Bp(e,t){return Z(e)===Z(t)}function Vp(e){return typeof e==`string`&&Rp.test(e)}var Hp=`\\{([^\\}]+)\\}`;function Up(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Wp(e){return RegExp(`^`+e.map(e=>Up(e)).join(`(.+)`)+`$`)}var Gp=class{constructor(e){this.strings=[],this.keys=[];let t=new RegExp(Hp,`g`),n,r=0;for(;(n=t.exec(e))!==null;)this.strings.push(e.slice(r,n.index)),this.keys.push(n[1]),r=n.index+n[0].length;this.strings.push(e.slice(r))}stringify(e){let t=[this.strings[0]];for(let n=0;n<this.keys.length;n++){let r=e[this.keys[n]];t.push(String(r),this.strings[n+1])}return t.join(``)}match(e){var t;this.matchRegexp=(t=this.matchRegexp)==null?Wp(this.strings):t;let n=e.match(this.matchRegexp);if(!n)return null;let r={};for(let e=0;e<this.keys.length;e++){let t=this.keys[e],i=n[e+1];if(r[t]!==i){if(r[t]!==void 0)return null;r[t]=i}}return r}};function Kp(e){Object.freeze(e);let t=typeof e==`function`,n=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach(function(r){n.call(e,r)&&(!t||r!==`caller`&&r!==`callee`&&r!==`arguments`)&&e[r]!==null&&(typeof e[r]==`object`||typeof e[r]==`function`)&&!Object.isFrozen(e[r])&&Kp(e[r])}),e}var qp=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,Jp=Kp(JSON.parse(function(...e){return arguments[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j`))),Yp=/^([^.]+)(\.([^.]+))*$/,Xp=typeof location<`u`?location.hostname:`localhost`;function Zp(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function Qp(e,t){if(!Yp.test(e)||!Yp.test(t))return!1;if(e===`*`)return!0;let n=e.split(`.`).reverse(),r=t.split(`.`).reverse();if(n.length<=1)return e===t;for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function $p(e){if(/^blob\:/i.test(e)||/^data\:/i.test(e))return Xp;let t=e.match(qp);return t?t[2]:Xp}var em=()=>Error(`Invalid input.`),tm=()=>Error(`Invalid certificate.`),nm=()=>Error(`Invalid signature.`),rm=e=>Error(`Date(${e.toString()}) expired.`),im=e=>Error(`Host(${JSON.stringify(e)}) is not allowed.`);function am(e,t){let n={};for(let r of Object.keys(e))t.indexOf(r)===-1&&(n[r]=e[r]);return n}function om(e,t=!1){let n=typeof e;if(n===`string`)return JSON.stringify(e);if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e instanceof Array){let t=`[`,n=e.length-1,r=0;for(;r<n;r++)t+=om(e[r],!1)+`,`;return n>-1&&(t+=om(e[r],!1)),t+`]`}if(e instanceof Object){if(typeof e.toJSON==`function`)return om(e.toJSON(),t);let n=Object.keys(e).sort(),r=n.length,i=``,a=0;for(;a<r;){let t=n[a],r=om(e[t],!0);r!==void 0&&(a&&i!==``&&(i+=`,`),i+=JSON.stringify(t)+`:`+r),a++}return`{`+i+`}`}switch(n){case`function`:case`undefined`:return t?void 0:null;case`number`:return 0;default:return isFinite(e)?e:null}}function sm(e){return String(om(e,!1))}function cm(e){var t,n,r;let i={};try{i=typeof e==`string`?JSON.parse(e):e}catch(e){return em()}if(typeof i!=`object`)return em();let a=Xp,o=Date.now(),s=new Date(typeof i.expire_at==`string`&&/^\d+$/.test(i.expire_at)?Number(i.expire_at):i.expire_at),c=Array.isArray(i.allow_hosts)?i.allow_hosts:[];if(a.length===0||Zp(a)||Jp.filter(e=>Qp(e,a)).length>0){let e=String((t=i.certificate)==null?``:t);if(e)try{let t=new R;return t.readCertPEM(e),Kp({issuer:t.getSubjectString(),expire:s,allowHosts:c})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`[PARSE Error]: Invalid Certificate. `+t)}return Kp({issuer:`none`,expire:s,allowHosts:c})}let l=String((n=i.certificate)==null?``:n);if(!l)return tm();let u=new R;u.readCertPEM(l);let d=String((r=i._signature)==null?``:r);return!d||_t(sm(am(i,[`_signature`])),d,u)===!1?nm():o<s.getTime()?Jp.concat(c).filter(e=>Qp(e,a)).length===0?im(a):Kp({issuer:u.getSubjectString(),expire:s,allowHosts:c}):rm(s)}function lm(e,t){let n=$p(e);return Xp.length!==0&&!Zp(Xp)&&Jp.filter(e=>Qp(e,Xp)).length===0&&!Zp(n)&&Jp.concat(t).filter(e=>Qp(e,n)).length===0?im(n):e}var um=new Set,dm=new t.Vector3(1,1,1),fm=[`right`,`left`,`up`,`down`,`front`,`back`],pm=/(_[A-Za-z0-9]+)(\.[A-Za-z0-9]+)$/,mm=`_gainmap_cfg.json`;function hm(e,t){if(!hr(e))return e;if(e.indexOf(t)===0)return e.slice(t.length);let n=t.replace(/^https\:/,`http:`);if(e.indexOf(n)===0)return e.slice(n.length);let r=t.replace(/^http\:/,`https:`);return e.indexOf(r)===0?e.slice(r.length):(console.warn(`${e} is not start with base_url(${t}).`),e)}function gm(e,t,n){return!hr(e)&&typeof t==`string`&&t.length>0&&(e=_r(t,String(n),e)),e}function _m(e){for(let t=10;t>=0;t--)if(512*Math.pow(2,t)<=e)return t;return null}function vm(e){e=e.slice().sort((e,t)=>e.level-t.level);let t=[];for(let n of e){if(t.length===0){t.push(n);continue}let e=t[t.length-1];if(n.level>e.level){t.push(n);continue}if(n.size>e.size){t[t.length-1]=n;continue}}return t}function ym(e,n){var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x;let S=[],C=null;for(let t of[].concat(e))if(`getURL`in t)C={allowHosts:t.allowHosts,expire:t.expire,issuer:t.issuer},S.push(Dp(t));else{let e=typeof t==`string`?JSON.parse(t):Mp(t),n=cm(e);if(n instanceof Error)return n;C===null&&(C=n),S.push(e)}if(C===null)return Error(`Empty`);B(n,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:C.issuer}),B(n,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(C.expire)}),B(n,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(C.allowHosts)});let w=S.reduce((e,t)=>Pp(e,t));B(n,`name`,{enumerable:!0,configurable:!1,writable:!1,value:String((r=w.name)==null?`Unknown`:r)}),B(n,`workCode`,{enumerable:!0,writable:!0,value:String(w.resource_code||w.basic_code||w.vr_code||w.code||w.project_id||w.work_code||w.workCode||Zt())}),B(n,`projectId`,{enumerable:!0,writable:!0,value:w.project_id}),B(n,`baseURL`,{enumerable:!0,writable:!0,value:(()=>{var e;let t=(e=w.base_url)==null?``:e;return t&&t[t.length-1]!==`/`&&(t+=`/`),t})()});let T;typeof w.model==`object`&&(T={},B(T,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(T,`file`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=w.model.file_url;if(e)return hm(e,n.baseURL)})()}),B(T,`textureBase`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=w.model.material_base_url;return e&&(e=hm(e,n.baseURL)),e})()}),B(T,`textures`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e;return Array.isArray(w.model.material_textures)&&(e=w.model.material_textures.slice(),Object.freeze(e)),e})()}),B(T,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:w.model.up_axis}),B(T,`coordinate`,{enumerable:!0,configurable:!1,writable:!1,value:Mp(w.model.coordinate)}),B(T,`layers`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e,t,r;let i=[];if(Array.isArray(w.model.layers)){for(let a of w.model.layers)if(a&&a.tileset_url){let o={};B(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(o,`name`,{enumerable:!0,configurable:!1,writable:!1,value:(e=a.name)==null?``:e}),B(o,`type`,{enumerable:!0,configurable:!1,writable:!1,value:(t=a.type)==null?`mesh`:t}),B(o,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:(r=a.up_axis)==null?`Z`:r}),B(o,`tileset`,{enumerable:!0,configurable:!1,writable:!1,value:hm(a.tileset_url,n.baseURL)}),i.push(o)}}if(typeof w.model.tiles==`object`){let e=w.model.tiles;if(e&&e.tileset_url){let t={};B(t,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:`lod`}),B(t,`type`,{enumerable:!0,configurable:!1,writable:!1,value:`mesh`}),B(t,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:`-Y`}),B(t,`tileset`,{enumerable:!0,configurable:!1,writable:!1,value:hm(e.tileset_url,n.baseURL)}),i.push(t)}}return Object.freeze(i)})()})),B(n,`model`,{enumerable:!0,configurable:!1,writable:!1,value:T});let E=[];if(Array.isArray(w.observers)&&w.panorama&&Array.isArray(w.panorama.list||w.panorama.info)){let e=w.observers,r=(i=w.panorama.list||w.panorama.info)==null?[]:i,S=(u=(c=(o=(a=w.panorama)==null?void 0:a.pano_high_cube_base_url)==null?(s=w.panorama)==null?void 0:s.pano_cube_base_url:o)==null?(l=w.panorama)==null?void 0:l.base_url:c)==null?``:u,C=Math.min(e.length,r.length),T={};for(let e of Object.keys((d=w.panorama.pattern)==null?{}:d)){let t=e,n=w.panorama.pattern[t];if(typeof n==`string`){let e=new Gp(n);T[t]=t=>e.stringify(t)}else T[t]=()=>n}let D=(e,t)=>{var n;let r=T[t];return(n=e[t])==null?r?r(e):void 0:n},O=e=>typeof e==`string`&&e.length>0,k=(e,t,r)=>{let i={},a=e=>hm(gm(e,S,r),n.baseURL);return B(i,`cfg`,{enumerable:!0,configurable:!1,writable:!1,value:a(e)}),fm.forEach((e,n)=>{B(i,e,{enumerable:!0,configurable:!1,writable:!1,value:a(t[n])})}),i},A=(e,t)=>{let n=D(e,`gainmap_cfg`),r=fm.map(t=>D(e,`gainmap_${t}`));if(O(n)&&r.every(O))return k(n,r,t);O(n)&&console.warn(`[workParser] gainmap 六视图不完整,按无 HDR 处理。cfg: ${n}, faces: ${JSON.stringify(r)}`);let i=D(e,`hdr`);if(i===!0||String(i)===`true`){let n=fm.map(t=>D(e,t));if(n.every(O)){let e=n.map(e=>e.replace(pm,`$1_gainmap$2`)),r=n[0].replace(pm,mm);if(e.every((e,t)=>e!==n[t])&&r!==n[0])return k(r,e,t);console.warn(`[workParser] hdr 点位无法从彩图 url 推导 gainmap 地址,按无 HDR 处理。url: ${n[0]}`)}else console.warn(`[workParser] hdr 点位彩图 url 不完整,按无 HDR 处理。`)}},j=(e,t)=>{let n={};B(n,`cfg`,{enumerable:!0,configurable:!1,writable:!1,value:e.cfg});for(let r of fm)B(n,r,{enumerable:!0,configurable:!1,writable:!1,value:qr(e[r],t)});return n};for(let i=0;i<C;i++){let a=e[i],o=r[i],s=Object.create(Ap);B(s,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(s,`index`,{enumerable:!0,configurable:!1,writable:!1,value:i}),B(s,`panoIndex`,{enumerable:!0,configurable:!1,writable:!1,value:i}),B(s,`panoId`,{enumerable:!0,configurable:!1,writable:!1,value:Z({workCode:n.workCode,panoIndex:i})}),B(s,`floorIndex`,{enumerable:!0,configurable:!1,writable:!1,value:(f=a.floor_index)==null?a.floor:f}),B(s,`derivedId`,{enumerable:!0,configurable:!1,writable:!1,value:(m=(p=a.derived_id)==null?D(o,`derived_id`):p)==null?0:m}),B(s,`derivedIdStr`,{enumerable:!0,configurable:!1,writable:!1,value:(g=(h=a.derived_id_str)==null?D(o,`derived_id_str`):h)==null?String(s.derivedId):g}),B(s,`active`,{enumerable:!0,configurable:!1,writable:!1,value:a.active!==!1&&D(o,`active`)!==!1}),B(s,`loadable`,{enumerable:!0,configurable:!1,writable:!1,value:(v=(_=a.loadable)==null?D(o,`loadable`):_)==null?!1:v}),B(s,`position`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new t.Vector3().fromArray((y=a.position)==null?[0,0,0]:y))}),B(s,`standingPosition`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new t.Vector3().fromArray((x=(b=a.standing_position)==null?a.standingPosition:b)==null?[0,0,0]:x))}),B(s,`quaternion`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new t.Quaternion().fromArray(a.quaternion?[a.quaternion.x,a.quaternion.y,a.quaternion.z,a.quaternion.w]:[0,0,0,1]))}),B(s,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new t.Matrix4().compose(s.position,s.quaternion,dm))}),B(s,`accessibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{if(um.clear(),a.accessible_nodes&&Array.isArray(a.accessible_nodes))for(let e of a.accessible_nodes)e>=C||e===i||um.add(e);else if(a.accessibleNodes&&Array.isArray(a.accessibleNodes))for(let e of a.accessibleNodes)e>=C||e===i||um.add(e);else if(a.visible_nodes&&Array.isArray(a.visible_nodes))for(let e of a.visible_nodes)e>=C||e===i||um.add(e);else if(a.visibleNodes&&Array.isArray(a.visibleNodes))for(let e of a.visibleNodes)e>=C||e===i||um.add(e);if(um.size===0)for(let e=0;e<C;e++)e!==i&&um.add(e);let e=Array.from(um);return um.clear(),Object.freeze(e)})()}),B(s,`visibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:s.accessibleNodes}),B(s,`images`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};B(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n});for(let t of fm)B(e,t,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e;return hm(gm((e=D(o,t))==null?``:e,S,i),n.baseURL)})()});let r=A(o,i);return r&&B(e,`gainmap`,{enumerable:!0,configurable:!1,writable:!1,value:r}),B(e,`sizeList`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let t=Kr(e[fm[0]]),n=D(o,`size_list`),r=D(o,`tiles`);if(t){if(n){let e=n.slice().sort((e,t)=>e-t);return Object.freeze(e)}else if(r){let e=[t],n=r.slice().sort((e,t)=>e-t);for(let r of n){let n=512*Math.pow(2,r);n>t&&e.push(n)}return Object.freeze(e)}return Object.freeze([t])}return Object.freeze([])})()}),B(e,`tiles`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let t=Kr(e.front);if(!t)return;let r=e.sizeList.slice();if(r[0]){let e=_m(r[0]);if(e)for(let t=e-1;t>=0;t--)r.unshift(512*Math.pow(2,t))}if(r.length<=0)return;let i=[];for(let a of r){let r=_m(a);if(typeof r!=`number`)continue;let o={};if(B(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(o,`level`,{enumerable:!0,configurable:!1,writable:!1,value:r}),a>t){B(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:a}),B(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:1});for(let t of fm)B(o,t,{enumerable:!0,configurable:!1,writable:!1,value:qr(e[t],a)});e.gainmap&&B(o,`gainmap`,{enumerable:!0,configurable:!1,writable:!1,value:j(e.gainmap,a)})}else{B(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:t}),B(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:a/t});for(let t of fm)B(o,t,{enumerable:!0,configurable:!1,writable:!1,value:e[t]});e.gainmap&&B(o,`gainmap`,{enumerable:!0,configurable:!1,writable:!1,value:e.gainmap})}i.push(o)}return i=vm(i),Object.freeze(i)})()}),B(e,`video`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=D(o,`video`),r;return e&&(r={},B(r,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(r,`source`,{enumerable:!0,configurable:!1,writable:!1,value:e.source}),B(r,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Matrix4().fromArray(e.matrix)}),B(r,`size`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Vector2().fromArray(e.size)})),r})()}),e})()}),E.push(s)}}B(n,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(E)});let D={};if(B(D,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),w.initial){if(n.observers.length>0){let e;jp(w.initial.panoIndex)?e=w.initial.panoIndex:jp(w.initial.pano_index)?e=w.initial.pano_index:jp(w.initial.pano)&&(e=w.initial.pano),typeof e==`number`&&(e=H(e,0,n.observers.length-1),B(D,`panoIndex`,{enumerable:!0,writable:!0,value:e}))}if(w.initial.mode===`Panorama`&&n.observers.length===0||w.initial.mode===`Floorplan`||w.initial.mode===`Topview`||w.initial.mode===`Model`||w.initial.mode===`Mapview`?B(D,`mode`,{enumerable:!0,writable:!0,value:w.initial.mode}):typeof D.panoIndex==`number`?B(D,`mode`,{enumerable:!0,writable:!0,value:`Panorama`}):B(D,`mode`,{enumerable:!0,writable:!0,value:`Mapview`}),jp(w.initial.latitude)&&B(D,`latitude`,{enumerable:!0,writable:!0,value:w.initial.latitude}),jp(w.initial.longitude)?B(D,`longitude`,{enumerable:!0,writable:!0,value:w.initial.longitude}):jp(w.initial.heading)&&B(D,`longitude`,{enumerable:!0,writable:!0,value:zt(w.initial.heading)}),jp(w.initial.fov)&&B(D,`fov`,{enumerable:!0,writable:!0,value:w.initial.fov}),jp(w.initial.distance)&&B(D,`distance`,{enumerable:!0,writable:!0,value:w.initial.distance}),Array.isArray(w.initial.offset)){let e=w.initial.offset,n=[0,0,0].map((t,n)=>{let r=Number(e[n]);return isNaN(r)||!isFinite(r)?0:r});B(D,`offset`,{enumerable:!0,writable:!0,value:new t.Vector3().fromArray(n)})}else typeof w.initial.offset==`object`&&typeof w.initial.offset.x==`number`&&typeof w.initial.offset.y==`number`&&typeof w.initial.offset.z==`number`&&B(D,`offset`,{enumerable:!0,writable:!0,value:new t.Vector3().fromArray([w.initial.offset.x,w.initial.offset.y,w.initial.offset.z])})}return B(n,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:D}),n}function bm(e,t){return B(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:`null`}),B(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),B(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([`*`])}),B(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:`Null`}),B(t,`workCode`,{enumerable:!0,value:`null-`+Zt()}),B(t,`baseURL`,{enumerable:!0,value:`/`}),B(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),B(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),B(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};return B(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),B(e,`mode`,{enumerable:!0,writable:!0,value:`Mapview`}),e})()}),t}function xm(e,n){var r,i;return B(n,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:`null`}),B(n,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),B(n,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([`*`])}),B(n,`name`,{enumerable:!0,configurable:!1,writable:!1,value:String((r=e.name)==null?`Unknown`:r)}),B(n,`workCode`,{enumerable:!0,writable:!0,value:(i=e.code)==null?Zt():i}),B(n,`baseURL`,{enumerable:!0,writable:!0,value:`/`}),B(n,`model`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),B(n,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let r={};return B(r,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(r,`index`,{enumerable:!0,configurable:!1,writable:!1,value:0}),B(r,`panoIndex`,{enumerable:!0,configurable:!1,writable:!1,value:0}),B(r,`panoId`,{enumerable:!0,configurable:!1,writable:!1,value:Z({workCode:n.workCode,panoIndex:0})}),B(r,`floorIndex`,{enumerable:!0,configurable:!1,writable:!1,value:0}),B(r,`derivedId`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),B(r,`derivedIdStr`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),B(r,`active`,{enumerable:!0,configurable:!1,writable:!1,value:!0}),B(r,`loadable`,{enumerable:!0,configurable:!1,writable:!1,value:!1}),B(r,`position`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Vector3(0,1.5,0)}),B(r,`standingPosition`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Vector3(0,0,0)}),B(r,`quaternion`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Quaternion(0,1,0,0)}),B(r,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:new t.Matrix4().compose(r.position,r.quaternion,dm)}),B(r,`accessibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),B(r,`visibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:r.accessibleNodes}),B(r,`images`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let t={};B(t,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n});for(let n of fm)B(t,n,{enumerable:!0,configurable:!1,writable:!1,value:e[n]});return B(t,`sizeList`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([e.size])}),B(t,`tiles`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=Kr(t.front);if(!e)return;let r=t.sizeList.slice();if(r[0]){let e=_m(r[0]);if(e)for(let t=e-1;t>=0;t--)r.unshift(512*Math.pow(2,t))}if(r.length<=0)return;let i=[];for(let a of r){let r=_m(a);if(typeof r!=`number`)continue;let o={};if(B(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(o,`level`,{enumerable:!0,configurable:!1,writable:!1,value:r}),a>e){B(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:a}),B(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:1});for(let e of fm)B(o,e,{enumerable:!0,configurable:!1,writable:!1,value:qr(t[e],a)})}else{B(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:e}),B(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:a/e});for(let e of fm)B(o,e,{enumerable:!0,configurable:!1,writable:!1,value:t[e]})}i.push(o)}return i=vm(i),Object.freeze(i)})()}),B(t,`video`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),t})()}),Object.freeze([r])})()}),B(n,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};return B(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:n}),B(e,`mode`,{enumerable:!0,writable:!0,value:`Panorama`}),B(e,`panoIndex`,{enumerable:!0,writable:!0,value:0}),e})()}),n}var Sm=new WeakSet,Cm=class{constructor(e,n){this.observerBox=new t.Box3,this.observerBox=new t.Box3,this.transform=new t.Matrix4,this.shortPath=!1,this.jsonp=!1;let r;if(r=e===null?bm(e,this):typeof e==`object`&&typeof e.size==`number`&&typeof e.up==`string`&&typeof e.down==`string`&&typeof e.right==`string`&&typeof e.left==`string`&&typeof e.front==`string`&&typeof e.back==`string`?xm(e,this):ym(e,this),r instanceof Error)throw Error(`[PARSE FAILED]: `+r.message+`
|
|
965
965
|
Error work input:
|
|
966
|
-
`+JSON.stringify(e));
|
|
966
|
+
`+JSON.stringify(e));Sm.add(this);for(let e of this.observers)this.observerBox.expandByPoint(e.position),this.observerBox.expandByPoint(e.standingPosition);n.baseURL&&(this.baseURL=n.baseURL),n.transform&&(Array.isArray(n.transform)?this.transform.fromArray(n.transform):this.transform.copy(n.transform)),typeof n.jsonp==`boolean`&&(this.jsonp=n.jsonp),typeof n.shortPath==`boolean`&&(this.shortPath=n.shortPath),n.workCode&&(typeof n.workCode==`string`?this.workCode=n.workCode:typeof n.workCode==`function`&&(this.workCode=n.workCode(e)));{let e=this;this.options={get transform(){return e.transform}},this.raw={get works(){return[JSON.stringify(Dp(e))]}}}}getURL(e){var t;if(!hr(e)){if(this.jsonp===!0){e=e.replace(/([\?\#].*)?$/i,``);let t=dt(`${e}`).slice(0,7);e=`${e}.${t}.jsonp`}if(this.shortPath===!0){let n=e.replace(e,``).split(`.`),r=(t=n.shift())==null?``:t,i=n.join(`.`);e=dt(r)+(i?`.`+i:``)}e=_r(this.baseURL,e)}return e=gr(e),e}verifyURL(e){return typeof lm(this.getURL(e),this.allowHosts)==`string`}toJSON(){return Dp(this)}};Cm.parse=wm;function wm(e,t){typeof e==`string`&&e.trim()[0]===`{`&&(e=JSON.parse(e));try{return new Cm(e,t==null?{}:t)}catch(t){console.log(t);let n=t instanceof Error?t.message:String(t);throw Error(`[PARSE Error]: `+n+`
|
|
967
967
|
Error work input:
|
|
968
|
-
`+JSON.stringify(e))}}var
|
|
968
|
+
`+JSON.stringify(e))}}var Tm=new t.Matrix4,Em=class{constructor(e){this.isResolved=!0,this.work=e.work,this.index=e.index,this.panoIndex=e.panoIndex,this.pano={panoIndex:e.panoIndex,workCode:e.work.workCode},this.panoId=Z({panoIndex:e.panoIndex,workCode:e.work.workCode}),this.floorIndex=e.floorIndex,this.derivedId=e.derivedId,this.derivedIdStr=e.derivedIdStr,this.active=e.active,this.loadable=e.loadable,this.images=e.images,this.accessibleNodes=e.accessibleNodes,this.accessibleIds=e.accessibleNodes.map(t=>Z({panoIndex:t,workCode:e.work.workCode})),this.visibleNodes=this.accessibleNodes,this.visibleIds=this.accessibleIds,this.position=new t.Vector3().copy(e.position).applyMatrix4(e.work.transform),this.standingPosition=new t.Vector3().copy(e.standingPosition).applyMatrix4(e.work.transform),this.quaternion=new t.Quaternion().setFromRotationMatrix(Tm.makeRotationFromQuaternion(e.quaternion).premultiply(e.work.transform)),this.matrix=new t.Matrix4().copy(e.matrix).premultiply(e.work.transform)}};function Dm(e){let t=new Set;for(let n of e){if(t.has(n.workCode))throw Error(`WorkCode:${n.workCode} duplicated.`);t.add(n.workCode)}t.clear();let n=e.map(e=>{if(Sm.has(e))return e;{let t=wm(null);return t.workCode=e.workCode,t}});return Object.freeze(Object.assign(n,{get initial(){var e;return(e=n[0])==null?void 0:e.initial},getWork(e){for(let t of n)if(t.workCode===e)return t},getObserver(e){var t,r;let i=(t=n[0])==null?void 0:t.workCode,a=0;if(Vp(e)){let t=zp(e);i=t.workCode,a=t.panoIndex}else typeof e==`number`?a=e:(i=e.workCode,a=e.panoIndex);return(r=this.getWork(i))==null?void 0:r.observers[a]},getResolvedObserver(e){let t=this.getObserver(e);if(t)return new Em(t)},toJSON(){return this.map(e=>({work:Dp(e),transform:e.transform.toArray()}))}}))}var Om=class{constructor(){this.status={endabledPassNumber:0,needsColorGBuffer:!1,needsDepthGBuffer:!1,needsNormalGBuffer:!1,version:`0|false|false|false`},this.gbuffer=new Map;let e={type:t.UnsignedByteType,generateMipmaps:!1,minFilter:t.LinearFilter,magFilter:t.LinearFilter,format:t.RGBAFormat,depthBuffer:!0,stencilBuffer:!0};this.renderTarget1=new t.WebGLRenderTarget(1,1,e),this.renderTarget1.texture.name=`EffectComposer.rt1`,this.renderTarget2=new t.WebGLRenderTarget(1,1,e),this.renderTarget2.texture.name=`EffectComposer.rt2`,this.readBuffer=this.renderTarget1,this.writeBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.normalMaterial=new t.MeshNormalMaterial({flatShading:!0}),this.clock=new t.Clock}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e)}insertPass(e,t){this.passes.splice(t,0,e)}render(e){let t=!1;this.renderTarget1.texture.encoding=e.outputEncoding,this.renderTarget2.texture.encoding=e.outputEncoding;let n=this.clock.getDelta(),r=this.passes.filter(e=>e.enabled);for(let i=0;i<r.length;i++){let a=r[i],o=i===r.length-1;a.renderToScreen=this.renderToScreen&&o,a.renderToScreen&&(t=!0),a.gbuffer=this.gbuffer,a.render(e,this.writeBuffer,this.readBuffer,n,!1),a.gbuffer=null,a.needsSwap&&this.swapBuffers()}return t}setSize(e,t){this.renderTarget1.setSize(e,t),this.renderTarget2.setSize(e,t);for(let n=0;n<this.passes.length;n++)this.passes[n].setSize(e,t)}updateStatus(){let e=this.passes.filter(e=>e.enabled),t=!1,n=!1,r=!1;for(let i of e)`dependencies`in i&&Array.isArray(i.dependencies)&&(t===!1&&(t=i.dependencies.indexOf(`color`)>=0),n===!1&&(n=i.dependencies.indexOf(`depth`)>=0),r===!1&&(r=i.dependencies.indexOf(`normal`)>=0));let i=e.length;this.status.endabledPassNumber=i,this.status.needsColorGBuffer=t,this.status.needsDepthGBuffer=n,this.status.needsNormalGBuffer=r,this.status.version=`${i}|${t}|${n}|${r}`}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose()}},km=class e{constructor(n){this._scene=new t.Scene,this._mesh=new t.Mesh(e.geometry,n),this._scene.add(this._mesh)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}dispose(){this._mesh.geometry.dispose(),this._scene.dispose()}render(t){t.render(this._scene,e.camera)}};km.camera=new t.OrthographicCamera(-1,1,1,-1,0,1),km.geometry=new t.PlaneBufferGeometry(2,2,1,1);var Am=class{constructor(e){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!0,this.dependencies=e==null?[]:e}setSize(e,t){}render(e,t,n,r,i){}dispose(){}};Am.FullScreenQuad=km;var jm=new t.ShaderMaterial({uniforms:{tDiffuse:{value:null},opacity:{value:1},scaleY:{value:1}},vertexShader:`
|
|
969
969
|
varying vec2 vUv;
|
|
970
970
|
void main() {
|
|
971
971
|
vUv = uv;
|
|
@@ -980,7 +980,7 @@ void main() {
|
|
|
980
980
|
vec4 diffuse = texture2D(tDiffuse, vUv * vec2(1.0, scaleY));
|
|
981
981
|
gl_FragColor = vec4(diffuse.rgb, diffuse.a * opacity);
|
|
982
982
|
}
|
|
983
|
-
`,transparent:!0,depthTest:!1,depthWrite:!1}),
|
|
983
|
+
`,transparent:!0,depthTest:!1,depthWrite:!1}),Mm=new km(jm),Nm=new t.ShaderMaterial({uniforms:{color:{value:new t.Color},opacity:{value:1}},vertexShader:`
|
|
984
984
|
void main() {
|
|
985
985
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
986
986
|
}
|
|
@@ -990,7 +990,7 @@ uniform float opacity;
|
|
|
990
990
|
void main() {
|
|
991
991
|
gl_FragColor = vec4(color, opacity);
|
|
992
992
|
}
|
|
993
|
-
`,transparent:!0,depthTest:!1,depthWrite:!1}),
|
|
993
|
+
`,transparent:!0,depthTest:!1,depthWrite:!1}),Pm=new km(Nm);function Fm(e,n,r=!1,i=1){n instanceof t.Texture?(jm.uniforms.tDiffuse.value=n,jm.uniforms.opacity.value=i,jm.uniforms.scaleY.value=r?-1:1,Mm.render(e),jm.uniforms.tDiffuse.value=null):(Nm.uniforms.color.value.copy(n),Nm.uniforms.opacity.value=i,Pm.render(e))}var Im=256,Lm=128,Rm={width:Im,height:Lm,data:new Uint8ClampedArray(Im*Lm*4)},zm=256,Bm=new Uint32Array(zm);function Vm(e,t={peak:0,mean:0,min:0,max:0}){let n=0,r=0;for(let e=1;e<zm;e++)Bm[e]=0;for(let t=0;t<e.length;t++){let i=e[t],a=i.type===`rgb`?3:4,o=i.data.length/a;n+=o;let s=i.data;for(let e=0;e<o;e++){let t=e*a,n=s[t],i=s[t+1],o=s[t+2],c=Math.round(.299*n+.587*i+.114*o);Bm[c]++,r+=c}}let i=r/n,a=0,o=0;for(let e=1;e<zm;e++)Bm[e]>o&&(o=Bm[e],a=e);let s=0;for(let e=0;e<zm;e++)if(Bm[e]!==0){s=e;break}let c=zm-1;for(let e=c;e>=0;e--)if(Bm[e]!==0){c=e;break}return t.peak=a/(zm-1),t.mean=i/255,t.min=s/(zm-1),t.max=c/(zm-1),t}var Hm=class{constructor(e,t,n,r){this.peak=e==null?0:e,this.mean=t==null?0:t,this.min=n==null?0:n,this.max=r==null?0:r}formPixels(...e){return Vm(e.map(e=>({data:e,type:`rgba`})),this),this}toJSON(){return{peak:this.peak,mean:this.mean,min:this.min,max:this.max}}toArray(){return[this.peak,this.mean,this.min,this.max]}toString(){return this.toArray().join(` `)}},Um=Math.PI,Wm=Um*2;function Gm(e,t,n){if(e===t)return t;let r=t-e;return Math.abs(r)<=n?t:e+(r>0?1:-1)*n}function Km(e,n,r){if(e.equals(n))return new t.Vector3().copy(n);let i=new t.Vector3().subVectors(n,e);return i.lengthSq()<r*r?i.copy(n):i.setLength(r).add(e)}function qm(e,t,n){if(e.longitude===t.longitude&&e.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};let r=Ft(e.longitude),i=e.latitude,a=Ft(t.longitude),o=t.latitude;a-r>Um?r+=Wm:r-a>Um&&(r-=Wm);let s=n/Math.sqrt(Math.pow(a-r,2)+Math.pow(o-i,2));return s>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(a-r)*s,latitude:i+(o-i)*s}}var Jm=new t.ShaderMaterial({uniforms:{inputBuffer:{value:null},minValue:{value:0},maxValue:{value:1}},vertexShader:`
|
|
994
994
|
varying vec2 vUv;
|
|
995
995
|
void main() {
|
|
996
996
|
vUv = uv;
|
|
@@ -1025,13 +1025,13 @@ void main() {
|
|
|
1025
1025
|
yuv.x = clamp((yuv.x - minValue) / (maxValue - minValue), 0.0, 1.0);
|
|
1026
1026
|
gl_FragColor = vec4(yuv2rgb(yuv), rgba.a);
|
|
1027
1027
|
}
|
|
1028
|
-
`}),
|
|
1028
|
+
`}),Ym=new km(Jm);function Xm(e,t,n,r){Jm.uniforms.inputBuffer.value=t,Jm.uniforms.minValue.value=n,Jm.uniforms.maxValue.value=r,Ym.render(e),Jm.uniforms.inputBuffer.value=null}var Zm=64,Qm=class extends Am{constructor(){super(),this.histogram=new Hm,this.minValue=0,this.maxValue=1,this.maxMinValue=.2,this.minMaxValue=.8,this.valueStep=1/255,this.sampleTestScale=.8;let e=this.enabled;Object.defineProperty(this,`enabled`,{get(){return e},set(t){e=t,e===!1&&(this.clearBuffer(),this.progress=0)}})}render(e,n,r,i,a){this.luminanceSampleBuffer||(this.luminanceSampleBuffer=new ArrayBuffer(Zm*Zm*4)),this.luminanceSampleTarget||(this.luminanceSampleTarget=new t.WebGLRenderTarget(Zm,Zm,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:t.LinearFilter,minFilter:t.LinearFilter}));let o=n.width,s=n.height,c=Zm/Math.max(o,s),l=Math.floor(o*c),u=Math.floor(s*c);this.luminanceSampleTarget.setSize(l,u),e.setRenderTarget(this.luminanceSampleTarget),Fm(e,r.texture);let d=Math.floor(l*((1-this.sampleTestScale)/2)),f=Math.floor(u*((1-this.sampleTestScale)/2)),p=Math.floor(l*this.sampleTestScale),m=Math.floor(u*this.sampleTestScale),h=new Uint8ClampedArray(this.luminanceSampleBuffer,0,p*m*4);e.readRenderTargetPixels(this.luminanceSampleTarget,d,f,p,m,h),this.histogram.formPixels(h);let g=Math.min(this.histogram.min,this.maxMinValue),_=Math.max(this.histogram.max,this.minMaxValue);this.minValue=Gm(this.minValue,g,this.valueStep),this.maxValue=Gm(this.maxValue,_,this.valueStep),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(n),this.clear&&e.clear()),Xm(e,r.texture,this.minValue,this.maxValue)}clearBuffer(){this.luminanceSampleTarget&&(this.luminanceSampleTarget.dispose(),this.luminanceSampleTarget=void 0),this.luminanceSampleBuffer&&(this.luminanceSampleBuffer=void 0),this.minValue=0,this.maxValue=1}dispose(){this.clearBuffer()}},$m=`
|
|
1029
1029
|
varying vec2 vUv;
|
|
1030
1030
|
void main() {
|
|
1031
1031
|
vUv = uv;
|
|
1032
1032
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1033
1033
|
}
|
|
1034
|
-
`,
|
|
1034
|
+
`,eh=`
|
|
1035
1035
|
uniform float strength;
|
|
1036
1036
|
uniform float radius;
|
|
1037
1037
|
|
|
@@ -1081,13 +1081,13 @@ void main() {
|
|
|
1081
1081
|
|
|
1082
1082
|
gl_FragColor = vec4(color.rgb * shade, color.a);
|
|
1083
1083
|
}
|
|
1084
|
-
|
|
1084
|
+
`,th=class extends Am{constructor(e){super(),this.strength=1,this.radius=1,this.neighbours=4,this.camera=e,this.dependencies=[`depth`],this.material=new t.ShaderMaterial({uniforms:{strength:{value:this.strength},radius:{value:this.radius},resolution:{value:new t.Vector2().copy(this.camera.resolution)},cameraNear:{value:this.camera.near},cameraFar:{value:this.camera.far},cameraPerspToOrtho:{value:this.camera.perspToOrtho.x},depthMap:{value:null},colorMap:{value:null}},vertexShader:$m,fragmentShader:eh}),this.material.onBeforeCompile=e=>{e.fragmentShader=e.fragmentShader.replace(/NUM_NEIGHBOUR/g,String(this.neighbours))},this.fsQuad=new km(this.material)}render(e,t,n,r,i){let a=this.gbuffer.get(`depth`);this.material.uniforms.resolution.value.copy(this.camera.resolution),this.material.uniforms.cameraNear.value=this.camera.near,this.material.uniforms.cameraFar.value=this.camera.far,this.material.uniforms.cameraPerspToOrtho.value=this.camera.perspToOrtho.x,this.material.uniforms.depthMap.value=a,this.material.uniforms.colorMap.value=n.texture,this.material.uniforms.strength.value=this.strength,this.material.uniforms.radius.value=this.radius,this.material.defines.NUM_NEIGHBOUR!==this.neighbours&&(this.material.needsUpdate=!0),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e),this.material.uniforms.depthMap.value=null,this.material.uniforms.colorMap.value=null}dispose(){this.material.dispose(),this.fsQuad.dispose()}},nh=`
|
|
1085
1085
|
varying vec2 vUv;
|
|
1086
1086
|
void main() {
|
|
1087
1087
|
vUv = uv;
|
|
1088
1088
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1089
1089
|
}
|
|
1090
|
-
`,
|
|
1090
|
+
`,rh=`
|
|
1091
1091
|
uniform sampler2D colorMap;
|
|
1092
1092
|
uniform float radius;
|
|
1093
1093
|
uniform float sigma;
|
|
@@ -1116,7 +1116,7 @@ void main() {
|
|
|
1116
1116
|
|
|
1117
1117
|
gl_FragColor = colorSum / weightSum;
|
|
1118
1118
|
}
|
|
1119
|
-
`,
|
|
1119
|
+
`,ih=class extends Am{constructor(e){super(),this.camera=e,this.material=new t.ShaderMaterial({uniforms:{resolution:new t.Uniform(this.camera.resolution.clone()),radius:new t.Uniform(4),sigma:new t.Uniform(4),colorMap:new t.Uniform(null)},vertexShader:nh,fragmentShader:rh}),this.fsQuad=new km(this.material)}render(e,t,n,r,i){this.material.uniforms.resolution.value.copy(this.camera.resolution),this.material.uniforms.colorMap.value=n.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e),this.material.uniforms.colorMap.value=null}setRadius(e){this.material.uniforms.radius.value=e}dispose(){this.material.dispose(),this.fsQuad.dispose()}};function ah(){return((1+Math.random())*65536|0).toString(16).substring(1)}function oh(){return(ah()+ah()+`-`+ah()+`-4`+ah().substr(0,3)+`-`+ah()+`-`+ah()+ah()+ah()).toLowerCase()}var sh=-99999,ch=`
|
|
1120
1120
|
attribute vec3 instanceStart;
|
|
1121
1121
|
attribute vec3 instanceEnd;
|
|
1122
1122
|
attribute vec4 instanceColor;
|
|
@@ -1235,7 +1235,7 @@ void main() {
|
|
|
1235
1235
|
gl_Position = vec4(ndc * clipPos.w, clipPos.z, clipPos.w);
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
|
-
`,
|
|
1238
|
+
`,lh=`
|
|
1239
1239
|
uniform vec2 resolution;
|
|
1240
1240
|
|
|
1241
1241
|
varying vec4 vColor;
|
|
@@ -1313,13 +1313,13 @@ void main() {
|
|
|
1313
1313
|
|
|
1314
1314
|
gl_FragColor = vec4(vColor.rgb, alpha);
|
|
1315
1315
|
}
|
|
1316
|
-
`,
|
|
1316
|
+
`,uh=`
|
|
1317
1317
|
varying vec2 vUv;
|
|
1318
1318
|
void main() {
|
|
1319
1319
|
vUv = uv;
|
|
1320
1320
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1321
1321
|
}
|
|
1322
|
-
`,
|
|
1322
|
+
`,dh=`
|
|
1323
1323
|
uniform sampler2D tDiffuse;
|
|
1324
1324
|
uniform sampler2D tLine;
|
|
1325
1325
|
varying vec2 vUv;
|
|
@@ -1329,7 +1329,7 @@ void main() {
|
|
|
1329
1329
|
vec3 color = base.rgb + line.rgb * line.a;
|
|
1330
1330
|
gl_FragColor = vec4(color, base.a);
|
|
1331
1331
|
}
|
|
1332
|
-
`,
|
|
1332
|
+
`,fh=class extends Am{constructor(e){super(),this.mesh=null,this.material=null,this.uTime=0,this.lines=[],this.uTime=0,this.camera=e,this.lineScene=new t.Scene,this.orthoCamera=new t.OrthographicCamera(-1,1,1,-1,0,1),this.lineRenderTarget=new t.WebGLRenderTarget(this.camera.resolution.x,this.camera.resolution.y,{minFilter:t.LinearFilter,magFilter:t.LinearFilter,format:t.RGBAFormat,encoding:t.sRGBEncoding}),this.blendMaterial=new t.ShaderMaterial({uniforms:{tDiffuse:{value:null},tLine:{value:this.lineRenderTarget.texture}},vertexShader:uh,fragmentShader:dh,transparent:!1,depthTest:!1,depthWrite:!1}),this.blendQuad=new km(this.blendMaterial);let n=this.enabled;Object.defineProperty(this,`enabled`,{get(){return n},set(e){n=e,n===!1&&(this.uTime=0)}})}toInternal(e){return e.map(e=>new t.Vector3(e.x,e.y,sh))}toInternalLine(e){return Object.assign(Object.assign({},e),{points:this.toInternal(e.points)})}setLines(e){this.lines=e.map(e=>{var t;return Object.assign(Object.assign({},this.toInternalLine(e)),{id:e.id||oh(),startTime:(t=e.startTime)==null?this.uTime*1e3:t})}),this._rebuildMesh()}addLine(...e){let t=e.map(e=>{var t;return Object.assign(Object.assign({},this.toInternalLine(e)),{id:e.id||oh(),startTime:(t=e.startTime)==null?this.uTime*1e3:t})});return this.lines.push(...t),this._rebuildMesh(),t.map(e=>e.id)}removeLine(...e){let t=0;for(let n of e){let e=this.lines.findIndex(e=>e.id===n);if(e===-1){console.warn(`FlowingLight2DPass: Line with id "${n}" not found`);continue}this.lines.splice(e,1),t++}return t>0&&this._rebuildMesh(),t}setLine(e){let{id:t,points:n}=e,r=Yo(e,[`id`,`points`]),i=this.lines.findIndex(e=>e.id===t);if(i===-1){console.warn(`FlowingLight2DPass: Line with id "${t}" not found`);return}let a=this.lines[i],o=Object.assign({},r);n&&(o.points=this.toInternal(n));let s=Object.assign(Object.assign({},a),o),c=o.points&&o.points.length!==a.points.length;this.lines[i]=s,c?this._rebuildMesh():this._updateLineAttributes(i,s,a)}_updateLineAttributes(e,t,n){var r,i,a;if(!this.mesh||!this.material)return;let o=this.mesh.geometry,s=0;for(let t=0;t<e;t++)s+=Math.max(0,this.lines[t].points.length-1);let c=t.points.length-1;if(c<=0)return;let l=o.getAttribute(`instanceStart`),u=o.getAttribute(`instanceEnd`),d=o.getAttribute(`instanceColor`),f=o.getAttribute(`instanceData`),p=o.getAttribute(`instanceMeta`),m=0;for(let o=0;o<c;o++){let c=s+o,h=t.points[o],g=t.points[o+1],_=h.distanceTo(g);t.points!==n.points&&(l.setXYZ(c,h.x,h.y,h.z),u.setXYZ(c,g.x,g.y,g.z)),(t.color!==n.color||t.opacity!==n.opacity)&&d.setXYZW(c,t.color.r,t.color.g,t.color.b,(r=t.opacity)==null?1:r),(t.points!==n.points||t.lineWidth!==n.lineWidth)&&f.setXYZW(c,e,o,m,(i=t.lineWidth)==null?1:i),(t.totalLength!==n.totalLength||t.duration!==n.duration||t.tailLengthRatio!==n.tailLengthRatio)&&p.setXYZ(c,t.totalLength,(t.duration||1e3)/1e3,(a=t.tailLengthRatio)==null?.2:a),m+=_}t.points!==n.points&&(l.needsUpdate=!0,u.needsUpdate=!0,f.needsUpdate=!0),(t.color!==n.color||t.opacity!==n.opacity)&&(d.needsUpdate=!0),t.lineWidth!==n.lineWidth&&(f.needsUpdate=!0),(t.totalLength!==n.totalLength||t.duration!==n.duration||t.tailLengthRatio!==n.tailLengthRatio)&&(p.needsUpdate=!0)}_rebuildMesh(){if(this.dispose(),this.lines.length===0)return;let e=0;if(this.lines.forEach(t=>{e+=Math.max(0,t.points.length-1)}),e===0)return;let n=new t.PlaneBufferGeometry(1,20,1,1);n.rotateZ(Math.PI/2);let r=new Float32Array(e*3),i=new Float32Array(e*3),a=new Float32Array(e*4),o=new Float32Array(e*4),s=new Float32Array(e*3),c=new Float32Array(e),l=0;this.lines.forEach((e,t)=>{var n,u,d,f;let p=e.points.length-1;if(p<=0)return;let m=0;for(let h=0;h<p;h++){let p=e.points[h],g=e.points[h+1],_=p.distanceTo(g),v=l*3,y=l*4;r[v+0]=p.x,r[v+1]=p.y,r[v+2]=p.z,i[v+0]=g.x,i[v+1]=g.y,i[v+2]=g.z,a[y+0]=e.color.r,a[y+1]=e.color.g,a[y+2]=e.color.b,a[y+3]=(n=e.opacity)==null?1:n,o[y+0]=t,o[y+1]=h,o[y+2]=m,o[y+3]=(u=e.lineWidth)==null?1:u,s[v+0]=e.totalLength,s[v+1]=(e.duration||1e3)/1e3,s[v+2]=(d=e.tailLengthRatio)==null?.2:d,c[l]=((f=e.startTime)==null?0:f)/1e3,m+=_,l++}}),n.setAttribute(`instanceStart`,new t.InstancedBufferAttribute(r,3)),n.setAttribute(`instanceEnd`,new t.InstancedBufferAttribute(i,3)),n.setAttribute(`instanceColor`,new t.InstancedBufferAttribute(a,4)),n.setAttribute(`instanceData`,new t.InstancedBufferAttribute(o,4)),n.setAttribute(`instanceMeta`,new t.InstancedBufferAttribute(s,3)),n.setAttribute(`instanceStartTime`,new t.InstancedBufferAttribute(c,1)),this.material=new t.ShaderMaterial({uniforms:{uTime:{value:this.uTime},resolution:{value:new t.Vector2(this.camera.resolution.x,this.camera.resolution.y)},fiveProjectionMatrix:{value:this.camera.projectionMatrix},fiveViewMatrix:{value:this.camera.matrixWorldInverse}},vertexShader:ch,fragmentShader:lh,transparent:!0,depthWrite:!1,side:t.DoubleSide}),this.mesh=new t.InstancedMesh(n,this.material,e),this.mesh.frustumCulled=!1,this.lineScene.add(this.mesh)}render(e,t,n,r,i){let a=!!(this.mesh&&this.material);a&&(this.uTime+=r);let o=n.width,s=n.height;(this.lineRenderTarget.width!==o||this.lineRenderTarget.height!==s)&&this.lineRenderTarget.setSize(o,s);let c=e.getRenderTarget(),l=e.getClearColor(),u=e.getClearAlpha();e.setRenderTarget(this.lineRenderTarget),e.setClearColor(0,0),e.clear(),a&&(this.material.uniforms.uTime.value=this.uTime,this.material.uniforms.resolution.value.set(o,s),this.material.uniforms.fiveProjectionMatrix.value=this.camera.projectionMatrix,this.material.uniforms.fiveViewMatrix.value=this.camera.matrixWorldInverse,e.render(this.lineScene,this.orthoCamera)),e.setRenderTarget(c),e.setClearColor(l,u),this.blendMaterial.uniforms.tDiffuse.value=n.texture,this.blendMaterial.uniforms.tLine.value=this.lineRenderTarget.texture;let d=this.renderToScreen?null:t;e.setRenderTarget(d),this.blendQuad.render(e)}dispose(){this.mesh&&(this.mesh.geometry.dispose(),this.lineScene.remove(this.mesh),this.mesh=null),this.material&&(this.material.dispose(),this.material=null),this.lineRenderTarget&&this.lineRenderTarget.dispose(),this.blendMaterial&&this.blendMaterial.dispose(),this.blendQuad&&this.blendQuad.dispose()}},ph=`
|
|
1333
1333
|
attribute vec3 instanceStart; // 线段起点
|
|
1334
1334
|
attribute vec3 instanceEnd; // 线段终点
|
|
1335
1335
|
attribute vec4 instanceColor; // 线段颜色 (rgb + opacity)
|
|
@@ -1446,7 +1446,7 @@ void main() {
|
|
|
1446
1446
|
|
|
1447
1447
|
gl_Position = vec4(ndc * clipPos.w, clipPos.z, clipPos.w);
|
|
1448
1448
|
}
|
|
1449
|
-
`,
|
|
1449
|
+
`,mh=`
|
|
1450
1450
|
uniform vec2 resolution;
|
|
1451
1451
|
|
|
1452
1452
|
varying vec4 vColor;
|
|
@@ -1540,14 +1540,14 @@ void main() {
|
|
|
1540
1540
|
|
|
1541
1541
|
gl_FragColor = vec4(vColor.rgb, alpha);
|
|
1542
1542
|
}
|
|
1543
|
-
`,
|
|
1543
|
+
`,hh=`
|
|
1544
1544
|
varying vec2 vUv;
|
|
1545
1545
|
|
|
1546
1546
|
void main() {
|
|
1547
1547
|
vUv = uv;
|
|
1548
1548
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1549
1549
|
}
|
|
1550
|
-
`,
|
|
1550
|
+
`,gh=`
|
|
1551
1551
|
uniform sampler2D tDiffuse;
|
|
1552
1552
|
uniform sampler2D tLine;
|
|
1553
1553
|
|
|
@@ -1562,7 +1562,7 @@ void main() {
|
|
|
1562
1562
|
|
|
1563
1563
|
gl_FragColor = vec4(color, base.a);
|
|
1564
1564
|
}
|
|
1565
|
-
`,
|
|
1565
|
+
`,_h=class extends Am{constructor(e){super(),this.mesh=null,this.material=null,this.uTime=0,this.lines=[],this.uTime=0,this.camera=e,this.lineScene=new t.Scene,this.orthoCamera=new t.OrthographicCamera(-1,1,1,-1,0,1),this.lineRenderTarget=new t.WebGLRenderTarget(this.camera.resolution.x,this.camera.resolution.y,{minFilter:t.LinearFilter,magFilter:t.LinearFilter,format:t.RGBAFormat,encoding:t.sRGBEncoding}),this.blendMaterial=new t.ShaderMaterial({uniforms:{tDiffuse:{value:null},tLine:{value:this.lineRenderTarget.texture}},vertexShader:hh,fragmentShader:gh,transparent:!1,depthTest:!1,depthWrite:!1}),this.blendQuad=new km(this.blendMaterial);let n=this.enabled;Object.defineProperty(this,`enabled`,{get(){return n},set(e){n=e,n===!1&&(this.uTime=0)}})}setLines(e){this.lines=e.map(e=>{var t;return Object.assign(Object.assign({},e),{id:e.id||oh(),startTime:(t=e.startTime)==null?this.uTime*1e3:t})}),this._rebuildMesh()}addLine(...e){let t=e.map(e=>{var t;return Object.assign(Object.assign({},e),{id:e.id||oh(),startTime:(t=e.startTime)==null?this.uTime*1e3:t})});return this.lines.push(...t),this._rebuildMesh(),t.map(e=>e.id)}removeLine(...e){let t=0;for(let n of e){let e=this.lines.findIndex(e=>e.id===n);if(e===-1){console.warn(`FlowingLight3DPass: Line with id "${n}" not found`);continue}this.lines.splice(e,1),t++}return t>0&&this._rebuildMesh(),t}setLine(e){let{id:t}=e,n=Yo(e,[`id`]),r=this.lines.findIndex(e=>e.id===t);if(r===-1){console.warn(`FlowingLight3DPass: Line with id "${t}" not found`);return}let i=this.lines[r],a=Object.assign(Object.assign({},i),n),o=n.points&&n.points.length!==i.points.length;this.lines[r]=a,o?this._rebuildMesh():this._updateLineAttributes(r,a,i)}_updateLineAttributes(e,t,n){var r,i,a;if(!this.mesh||!this.material)return;let o=this.mesh.geometry,s=0;for(let t=0;t<e;t++)s+=Math.max(0,this.lines[t].points.length-1);let c=t.points.length-1;if(c<=0)return;let l=o.getAttribute(`instanceStart`),u=o.getAttribute(`instanceEnd`),d=o.getAttribute(`instanceColor`),f=o.getAttribute(`instanceData`),p=o.getAttribute(`instanceMeta`),m=0;for(let o=0;o<c;o++){let c=s+o,h=t.points[o],g=t.points[o+1],_=h.distanceTo(g);t.points!==n.points&&(l.setXYZ(c,h.x,h.y,h.z),u.setXYZ(c,g.x,g.y,g.z)),(t.color!==n.color||t.opacity!==n.opacity)&&d.setXYZW(c,t.color.r,t.color.g,t.color.b,(r=t.opacity)==null?1:r),(t.points!==n.points||t.lineWidth!==n.lineWidth)&&f.setXYZW(c,e,o,m,(i=t.lineWidth)==null?1:i),(t.totalLength!==n.totalLength||t.duration!==n.duration||t.tailLengthRatio!==n.tailLengthRatio)&&p.setXYZ(c,t.totalLength,(t.duration||1e3)/1e3,(a=t.tailLengthRatio)==null?.2:a),m+=_}t.points!==n.points&&(l.needsUpdate=!0,u.needsUpdate=!0,f.needsUpdate=!0),(t.color!==n.color||t.opacity!==n.opacity)&&(d.needsUpdate=!0),t.lineWidth!==n.lineWidth&&(f.needsUpdate=!0),(t.totalLength!==n.totalLength||t.duration!==n.duration||t.tailLengthRatio!==n.tailLengthRatio)&&(p.needsUpdate=!0)}_rebuildMesh(){if(this.dispose(),this.lines.length===0)return;let e=0;if(this.lines.forEach(t=>{e+=Math.max(0,t.points.length-1)}),e===0)return;let n=new t.PlaneBufferGeometry(1,20,1,1);n.rotateZ(Math.PI/2);let r=new Float32Array(e*3),i=new Float32Array(e*3),a=new Float32Array(e*4),o=new Float32Array(e*4),s=new Float32Array(e*3),c=new Float32Array(e),l=0;this.lines.forEach((e,t)=>{var n,u,d,f;let p=e.points.length-1;if(p<=0)return;let m=0;for(let h=0;h<p;h++){let p=e.points[h],g=e.points[h+1],_=p.distanceTo(g),v=l*3,y=l*4;r[v+0]=p.x,r[v+1]=p.y,r[v+2]=p.z,i[v+0]=g.x,i[v+1]=g.y,i[v+2]=g.z,a[y+0]=e.color.r,a[y+1]=e.color.g,a[y+2]=e.color.b,a[y+3]=(n=e.opacity)==null?1:n,o[y+0]=t,o[y+1]=h,o[y+2]=m,o[y+3]=(u=e.lineWidth)==null?1:u,s[v+0]=e.totalLength,s[v+1]=(e.duration||1e3)/1e3,s[v+2]=(d=e.tailLengthRatio)==null?.2:d,c[l]=((f=e.startTime)==null?0:f)/1e3,m+=_,l++}}),n.setAttribute(`instanceStart`,new t.InstancedBufferAttribute(r,3)),n.setAttribute(`instanceEnd`,new t.InstancedBufferAttribute(i,3)),n.setAttribute(`instanceColor`,new t.InstancedBufferAttribute(a,4)),n.setAttribute(`instanceData`,new t.InstancedBufferAttribute(o,4)),n.setAttribute(`instanceMeta`,new t.InstancedBufferAttribute(s,3)),n.setAttribute(`instanceStartTime`,new t.InstancedBufferAttribute(c,1)),this.material=new t.ShaderMaterial({uniforms:{uTime:{value:this.uTime},resolution:{value:new t.Vector2(this.camera.resolution.x,this.camera.resolution.y)},fiveProjectionMatrix:{value:this.camera.projectionMatrix},fiveViewMatrix:{value:this.camera.matrixWorldInverse}},vertexShader:ph,fragmentShader:mh,transparent:!0,depthWrite:!1,side:t.DoubleSide}),this.mesh=new t.InstancedMesh(n,this.material,e),this.mesh.frustumCulled=!1,this.lineScene.add(this.mesh)}render(e,t,n,r,i){let a=!!(this.mesh&&this.material);a&&(this.uTime+=r);let o=n.width,s=n.height;(this.lineRenderTarget.width!==o||this.lineRenderTarget.height!==s)&&this.lineRenderTarget.setSize(o,s);let c=e.getRenderTarget(),l=e.getClearColor(),u=e.getClearAlpha();e.setRenderTarget(this.lineRenderTarget),e.setClearColor(0,0),e.clear(),a&&(this.material.uniforms.uTime.value=this.uTime,this.material.uniforms.resolution.value.set(o,s),this.material.uniforms.fiveProjectionMatrix.value=this.camera.projectionMatrix,this.material.uniforms.fiveViewMatrix.value=this.camera.matrixWorldInverse,e.render(this.lineScene,this.orthoCamera)),e.setRenderTarget(c),e.setClearColor(l,u),this.blendMaterial.uniforms.tDiffuse.value=n.texture,this.blendMaterial.uniforms.tLine.value=this.lineRenderTarget.texture;let d=this.renderToScreen?null:t;e.setRenderTarget(d),this.blendQuad.render(e)}dispose(){this.mesh&&(this.mesh.geometry.dispose(),this.lineScene.remove(this.mesh),this.mesh=null),this.material&&(this.material.dispose(),this.material=null),this.lineRenderTarget&&this.lineRenderTarget.dispose(),this.blendMaterial&&this.blendMaterial.dispose(),this.blendQuad&&this.blendQuad.dispose()}},vh=200,yh=300,bh=.5,xh=.1,Sh=.04,Ch=`
|
|
1566
1566
|
attribute vec3 aVelocity; // 初速度(世界单位/秒)
|
|
1567
1567
|
attribute vec3 aAccel; // 加速度(世界单位/秒²)
|
|
1568
1568
|
attribute vec4 aColor; // rgb + opacity
|
|
@@ -1617,7 +1617,7 @@ void main() {
|
|
|
1617
1617
|
vAlpha = pow(1.0 - lifeT, 0.7) * twinkle;
|
|
1618
1618
|
vColor = aColor;
|
|
1619
1619
|
}
|
|
1620
|
-
`,
|
|
1620
|
+
`,wh=`
|
|
1621
1621
|
varying vec4 vColor;
|
|
1622
1622
|
varying float vAlpha;
|
|
1623
1623
|
|
|
@@ -1637,14 +1637,14 @@ void main() {
|
|
|
1637
1637
|
// 输出 srcAlpha = intensity,使最终累加值为 color * intensity
|
|
1638
1638
|
gl_FragColor = vec4(vColor.rgb, intensity);
|
|
1639
1639
|
}
|
|
1640
|
-
`,
|
|
1640
|
+
`,Th=`
|
|
1641
1641
|
varying vec2 vUv;
|
|
1642
1642
|
|
|
1643
1643
|
void main() {
|
|
1644
1644
|
vUv = uv;
|
|
1645
1645
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1646
1646
|
}
|
|
1647
|
-
`,
|
|
1647
|
+
`,Eh=`
|
|
1648
1648
|
uniform sampler2D tDiffuse;
|
|
1649
1649
|
uniform sampler2D tParticle;
|
|
1650
1650
|
|
|
@@ -1659,7 +1659,7 @@ void main() {
|
|
|
1659
1659
|
|
|
1660
1660
|
gl_FragColor = vec4(color, base.a);
|
|
1661
1661
|
}
|
|
1662
|
-
`,
|
|
1662
|
+
`,Dh=class extends Am{constructor(e){super(),this.points=null,this.material=null,this.uTime=0,this.lines=[],this.blocks=[],this.geometry=null,this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrBirthTime=null,this.arrMaxLife=null,this.arrSeed=null,this.arrSize=null,this._tmpTail=new t.Vector3,this.uTime=0,this.camera=e,this.particleScene=new t.Scene,this.orthoCamera=new t.OrthographicCamera(-1,1,1,-1,0,1),this.particleRenderTarget=new t.WebGLRenderTarget(this.camera.resolution.x,this.camera.resolution.y,{minFilter:t.LinearFilter,magFilter:t.LinearFilter,format:t.RGBAFormat,encoding:t.sRGBEncoding}),this.blendMaterial=new t.ShaderMaterial({uniforms:{tDiffuse:{value:null},tParticle:{value:this.particleRenderTarget.texture}},vertexShader:Th,fragmentShader:Eh,transparent:!1,depthTest:!1,depthWrite:!1}),this.blendQuad=new km(this.blendMaterial);let n=this.enabled;Object.defineProperty(this,`enabled`,{get(){return n},set(e){n=e,n===!1&&(this.uTime=0)}})}setLines(e){this.lines=e.map(e=>{var t;return Object.assign(Object.assign({},e),{id:e.id||Zt(),startTime:(t=e.startTime)==null?this.uTime*1e3:t})}),this._rebuild()}addLine(...e){let t=e.map(e=>{var t;return Object.assign(Object.assign({},e),{id:e.id||Zt(),startTime:(t=e.startTime)==null?this.uTime*1e3:t})});return this.lines.push(...t),this._rebuild(),t.map(e=>e.id)}removeLine(...e){let t=0;for(let n of e){let e=this.lines.findIndex(e=>e.id===n);if(e===-1){console.warn(`FlowingFireworks3DPass: Line with id "${n}" not found`);continue}this.lines.splice(e,1),t++}return t>0&&this._rebuild(),t}setLine(e){let{id:t}=e,n=Yo(e,[`id`]),r=this.lines.find(e=>e.id===t);if(!r){console.warn(`FlowingFireworks3DPass: Line with id "${t}" not found`);return}let i=n.particleCount!==void 0&&n.particleCount!==r.particleCount;Object.assign(r,n),i&&this._rebuild()}_rebuild(){var e;if(this._disposeParticles(),this.lines.length===0)return;this.blocks=[];let n=0;for(let t of this.lines){let r=Math.max(1,Math.floor((e=t.particleCount)==null?vh:e));this.blocks.push({line:t,offset:n,count:r,cursor:0,accum:0}),n+=r}if(n===0)return;this.arrPosition=new Float32Array(n*3),this.arrVelocity=new Float32Array(n*3),this.arrAccel=new Float32Array(n*3),this.arrColor=new Float32Array(n*4),this.arrBirthTime=new Float32Array(n),this.arrMaxLife=new Float32Array(n),this.arrSeed=new Float32Array(n),this.arrSize=new Float32Array(n);let r=new t.BufferGeometry;r.setAttribute(`position`,new t.BufferAttribute(this.arrPosition,3)),r.setAttribute(`aVelocity`,new t.BufferAttribute(this.arrVelocity,3)),r.setAttribute(`aAccel`,new t.BufferAttribute(this.arrAccel,3)),r.setAttribute(`aColor`,new t.BufferAttribute(this.arrColor,4)),r.setAttribute(`aBirthTime`,new t.BufferAttribute(this.arrBirthTime,1)),r.setAttribute(`aMaxLife`,new t.BufferAttribute(this.arrMaxLife,1)),r.setAttribute(`aSeed`,new t.BufferAttribute(this.arrSeed,1)),r.setAttribute(`aSize`,new t.BufferAttribute(this.arrSize,1)),this.geometry=r,this.material=new t.ShaderMaterial({uniforms:{uTime:{value:this.uTime},uResolution:{value:new t.Vector2(this.camera.resolution.x,this.camera.resolution.y)},fiveProjectionMatrix:{value:this.camera.projectionMatrix},fiveViewMatrix:{value:this.camera.matrixWorldInverse}},vertexShader:Ch,fragmentShader:wh,transparent:!0,depthTest:!1,depthWrite:!1,blending:t.AdditiveBlending}),this.points=new t.Points(r,this.material),this.points.frustumCulled=!1,this.particleScene.add(this.points)}_samplePointAtLength(e,t,n){if(e.length===0){n.set(0,0,0);return}if(e.length===1||t<=0){n.copy(e[0]);return}let r=0;for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1],s=a.distanceTo(o);if(!(s<=1e-9)){if(r+s>=t){let e=(t-r)/s;n.lerpVectors(a,o,e);return}r+=s}}n.copy(e[e.length-1])}_emitParticle(e,t){var n,r,i,a;let o=e.line,s=e.offset+e.cursor;e.cursor=(e.cursor+1)%e.count;let c=s*3,l=s*4,u=(n=o.spread)==null?xh:n,d=(r=o.particleSize)==null?u*.12:r,f=(i=o.particleLife)==null?bh:i,p=Math.random(),m=Math.random(),h=2*Math.PI*p,g=Math.acos(2*m-1),_=Math.sin(g),v=_*Math.cos(h),y=_*Math.sin(h),b=Math.cos(g),x=u/f*(.6+Math.random()*.8);this.arrPosition[c+0]=t.x,this.arrPosition[c+1]=t.y,this.arrPosition[c+2]=t.z,this.arrVelocity[c+0]=v*x,this.arrVelocity[c+1]=y*x,this.arrVelocity[c+2]=b*x,o.gravity?(this.arrAccel[c+0]=o.gravity.x,this.arrAccel[c+1]=o.gravity.y,this.arrAccel[c+2]=o.gravity.z):(this.arrAccel[c+0]=0,this.arrAccel[c+1]=-u*.9,this.arrAccel[c+2]=0);let S=.8+Math.random()*.4;this.arrColor[l+0]=o.color.r*S,this.arrColor[l+1]=o.color.g*S,this.arrColor[l+2]=o.color.b*S,this.arrColor[l+3]=(a=o.opacity)==null?1:a,this.arrBirthTime[s]=this.uTime,this.arrMaxLife[s]=f*(.7+Math.random()*.6),this.arrSeed[s]=Math.random(),this.arrSize[s]=d*(.6+Math.random()*.8)}_emit(e){var t,n,r,i;let a=!1;for(let o of this.blocks){let s=o.line,c=(s.duration||1e3)/1e3,l=this.uTime-((t=s.startTime)==null?0:t)/1e3;if(l<0||c<=0)continue;let u=s.totalLength,d=(n=s.tailLengthRatio)==null?.2:n,f=(l/c%1+1)%1*u,p=u*Math.min(Math.max(l/c,0),d),m=f-p;m<0&&(m+=u);let h=(r=s.leadRatio)==null?Sh:r,g=Math.min(u*h,p),_=m+g;_>=u&&(_-=u),this._samplePointAtLength(s.points,_,this._tmpTail);let v=(i=s.emissionRate)==null?yh:i;o.accum+=v*e;let y=Math.floor(o.accum);o.accum-=y,y=Math.min(y,o.count);for(let e=0;e<y;e++)this._emitParticle(o,this._tmpTail),a=!0}a&&this.geometry&&(this.geometry.getAttribute(`position`).needsUpdate=!0,this.geometry.getAttribute(`aVelocity`).needsUpdate=!0,this.geometry.getAttribute(`aAccel`).needsUpdate=!0,this.geometry.getAttribute(`aColor`).needsUpdate=!0,this.geometry.getAttribute(`aBirthTime`).needsUpdate=!0,this.geometry.getAttribute(`aMaxLife`).needsUpdate=!0,this.geometry.getAttribute(`aSeed`).needsUpdate=!0,this.geometry.getAttribute(`aSize`).needsUpdate=!0)}render(e,t,n,r,i){let a=!!(this.points&&this.material);a&&(this.uTime+=r,this._emit(r));let o=n.width,s=n.height;(this.particleRenderTarget.width!==o||this.particleRenderTarget.height!==s)&&this.particleRenderTarget.setSize(o,s);let c=e.getRenderTarget(),l=e.getClearColor(),u=e.getClearAlpha();e.setRenderTarget(this.particleRenderTarget),e.setClearColor(0,0),e.clear(),a&&(this.material.uniforms.uTime.value=this.uTime,this.material.uniforms.uResolution.value.set(o,s),this.material.uniforms.fiveProjectionMatrix.value=this.camera.projectionMatrix,this.material.uniforms.fiveViewMatrix.value=this.camera.matrixWorldInverse,e.render(this.particleScene,this.orthoCamera)),e.setRenderTarget(c),e.setClearColor(l,u),this.blendMaterial.uniforms.tDiffuse.value=n.texture,this.blendMaterial.uniforms.tParticle.value=this.particleRenderTarget.texture;let d=this.renderToScreen?null:t;e.setRenderTarget(d),this.blendQuad.render(e)}dispose(){this._disposeParticles(),this.particleRenderTarget&&this.particleRenderTarget.dispose(),this.blendMaterial&&this.blendMaterial.dispose(),this.blendQuad&&this.blendQuad.dispose()}_disposeParticles(){this.points&&(this.particleScene.remove(this.points),this.points=null),this.geometry&&(this.geometry.dispose(),this.geometry=null),this.material&&(this.material.dispose(),this.material=null),this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrBirthTime=null,this.arrMaxLife=null,this.arrSeed=null,this.arrSize=null,this.blocks=[]}},Oh=class{constructor(){this.name=`SceneRenderer`}clearBuffers(){}render(e,t,n,r,i,a){return i?(e.setRenderTarget(a),e.render(t,r),!0):!1}},kh=new t.Vector4,Ah=new t.ShaderMaterial({uniforms:{tDiffuse:{value:null},weight:{value:1}},vertexShader:`
|
|
1663
1663
|
varying vec2 vUv;
|
|
1664
1664
|
void main() {
|
|
1665
1665
|
vUv = uv;
|
|
@@ -1672,7 +1672,7 @@ varying vec2 vUv;
|
|
|
1672
1672
|
void main() {
|
|
1673
1673
|
gl_FragColor = texture2D(tDiffuse, vUv) * weight;
|
|
1674
1674
|
}
|
|
1675
|
-
`,premultipliedAlpha:!0,blending:t.AdditiveBlending,transparent:!0,depthTest:!1,depthWrite:!1}),
|
|
1675
|
+
`,premultipliedAlpha:!0,blending:t.AdditiveBlending,transparent:!0,depthTest:!1,depthWrite:!1}),jh=new km(Ah);function Mh(e,t,n){Ah.uniforms.weight.value=n,Ah.uniforms.tDiffuse.value=t,jh.render(e),Ah.uniforms.tDiffuse.value=null}var Nh=class extends Oh{constructor(){super(...arguments),this.name=`SSAASceneRnderer`,this.sampleLevel=2,this.unbiased=!0,this.sampleRenderTarget=null}clearBuffers(){super.clearBuffers(),this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null)}render(e,n,r,i,a,o){if(this.sampleLevel<0)return super.render(e,n,r,i,!0,o);if(!a)return!1;let s=e.getPixelRatio(),c=e.getViewport(kh),l=c.width*s,u=c.height*s;this.sampleRenderTarget||(this.sampleRenderTarget=new t.WebGLRenderTarget(1,1,{minFilter:t.LinearFilter,magFilter:t.LinearFilter,format:t.RGBAFormat,stencilBuffer:!0,depthBuffer:!0}),this.sampleRenderTarget.texture.name=`${this.name}.sample`),this.sampleRenderTarget.texture.encoding=e.outputEncoding,this.sampleRenderTarget.setSize(l,u),o!=null&&o.depthTexture&&(e.setRenderTarget(o),e.render(n,i));let d=Ph[Math.max(0,Math.min(this.sampleLevel,5))],f=e.autoClear;e.autoClear=!1;let p=e.getClearColor().getHex(),m=e.getClearAlpha(),h=1/d.length,g={fullWidth:l,fullHeight:u,offsetX:0,offsetY:0,width:l,height:u},_=Object.assign({},i.view);_.enabled&&Object.assign(g,_);for(let t=0;t<d.length;t++){let r=d[t];i.setViewOffset&&i.setViewOffset(g.fullWidth,g.fullHeight,g.offsetX+r[0]*.0625,g.offsetY+r[1]*.0625,g.width,g.height);let a=h;if(this.unbiased){let e=-.5+(t+.5)/d.length;a+=.03125*e}e.setRenderTarget(this.sampleRenderTarget),e.setClearColor(p,m),e.clear(),e.render(n,i),e.setRenderTarget(o),t===0&&(e.setClearColor(0,0),e.clearColor(),e.clearStencil()),Mh(e,this.sampleRenderTarget.texture,a)}return i.setViewOffset&&_.enabled?i.setViewOffset(_.fullWidth,_.fullHeight,_.offsetX,_.offsetY,_.width,_.height):i.clearViewOffset&&i.clearViewOffset(),i.needsRender=!1,e.autoClear=f,e.setClearColor(p,m),!0}},Ph=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]],Fh=new t.ShaderMaterial({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
1676
1676
|
varying vec2 vUv;
|
|
1677
1677
|
void main() {
|
|
1678
1678
|
vUv = uv;
|
|
@@ -1685,7 +1685,7 @@ void main() {
|
|
|
1685
1685
|
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
1686
1686
|
gl_FragDepthEXT = texture2D(tDiffuse, vUv).x;
|
|
1687
1687
|
}
|
|
1688
|
-
`,blending:t.NoBlending,depthWrite:!0,depthTest:!0}),
|
|
1688
|
+
`,blending:t.NoBlending,depthWrite:!0,depthTest:!0}),Ih=new km(Fh);function Lh(e,t){Fh.uniforms.tDiffuse.value=t,e.getContext()instanceof WebGLRenderingContext&&(Fh.extensions.fragDepth=!0),Ih.render(e),Fh.uniforms.tDiffuse.value=null}var Rh=new t.Vector4,zh=new t.ShaderMaterial({uniforms:{depthMap:{value:null},weightMap:{value:null}},vertexShader:`
|
|
1689
1689
|
varying vec2 vUv;
|
|
1690
1690
|
void main() {
|
|
1691
1691
|
vUv = uv;
|
|
@@ -1704,7 +1704,7 @@ void main() {
|
|
|
1704
1704
|
color = color / color.a;
|
|
1705
1705
|
gl_FragColor = vec4(color.xyz, 1.0);
|
|
1706
1706
|
}
|
|
1707
|
-
`,depthTest:!1,depthWrite:!1,transparent:!0}),
|
|
1707
|
+
`,depthTest:!1,depthWrite:!1,transparent:!0}),Bh=new km(zh);function Vh(e,t,n){zh.uniforms.weightMap.value=t,zh.uniforms.depthMap.value=n,Bh.render(e),zh.uniforms.weightMap.value=null,zh.uniforms.depthMap.value=null}var Hh=class extends Oh{constructor(){super(...arguments),this.name=`PointCloudHighQualitySceneRnderer`,this.tempRenderTarget=null}clearBuffers(){super.clearBuffers(),this.tempRenderTarget&&(this.tempRenderTarget.dispose(),this.tempRenderTarget=null)}render(e,n,r,i,a,o){if(!a)return!1;let s=e.getPixelRatio(),c=e.getViewport(Rh),l=c.width*s,u=c.height*s;this.tempRenderTarget||(this.tempRenderTarget=new t.WebGLRenderTarget(1,1,{magFilter:t.LinearFilter,minFilter:t.LinearFilter,type:t.FloatType,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),this.tempRenderTarget.texture.name=`${this.name}.temp`);let d=this.tempRenderTarget.depthTexture;if(!d||d.image.width!==l||d.image.height!==u){let e=new t.DepthTexture(l,u);e.generateMipmaps=!1,e.format=t.DepthStencilFormat,e.type=t.UnsignedInt248Type,e.needsUpdate=!0,this.tempRenderTarget.depthTexture=e,d&&d.dispose(),this.tempRenderTarget.dispose()}this.tempRenderTarget.texture.encoding=e.outputEncoding,this.tempRenderTarget.setSize(l,u);let f=e.getClearColor().clone(),p=e.getClearAlpha();return e.autoClearColor=!0,e.autoClearDepth=!0,e.setClearColor(new t.Color(0,0,0)),e.setClearAlpha(0),r.parameter.set(`useHQDepth`,!0),r.parameter.set(`useHQWeight`,!1),r.update(e,i),e.setRenderTarget(this.tempRenderTarget),e.render(n,i),r.parameter.set(`useHQDepth`,!1),r.parameter.set(`useHQWeight`,!0),r.update(e,i),e.autoClearDepth=!1,e.autoClearColor=!0,e.render(n,i),r.parameter.set(`useHQDepth`,!1),r.parameter.set(`useHQWeight`,!1),r.update(e,i),r.needsRender=!1,e.setClearColor(f,p),e.autoClearDepth=!0,e.autoClearColor=!0,e.setRenderTarget(o),Lh(e,this.tempRenderTarget.depthTexture),e.autoClearDepth=!1,Vh(e,this.tempRenderTarget.texture,this.tempRenderTarget.depthTexture),e.autoClearDepth=!0,!0}},Uh=new t.Vector4,Wh=new t.MeshNormalMaterial({flatShading:!0}),Gh=class{constructor(){this.composer=new Om,this.composerVersion=``,this.colorRenderTarget=new t.WebGLRenderTarget(1,1,{magFilter:t.LinearFilter,minFilter:t.LinearFilter,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),this.normalRenderTarget=new t.WebGLRenderTarget(1,1,{magFilter:t.LinearFilter,minFilter:t.LinearFilter,generateMipmaps:!1,depthBuffer:!0,stencilBuffer:!0}),this.renderMode=`default`,this.sceneRenders={default:new Oh,ssaa:new Nh,"point-cloud-high-quality":new Hh}}renderSceneToBuffers(e,t,n,r,i,a){let{gbuffer:o,status:s}=this.composer,{needsColorGBuffer:c,needsDepthGBuffer:l,needsNormalGBuffer:u}=s,d=!1;o.clear(),this.colorRenderTarget.texture.encoding=e.outputEncoding,this.normalRenderTarget.texture.encoding=e.outputEncoding;for(let e in this.sceneRenders){let t=e;t!==this.renderMode&&this.sceneRenders[t].clearBuffers()}if(this.sceneRenders[this.renderMode]){let o=a?null:this.colorRenderTarget;d=this.sceneRenders[this.renderMode].render(e,t,n,r,i,o)}if(c&&o.set(`color`,this.colorRenderTarget.texture),l&&o.set(`depth`,this.colorRenderTarget.depthTexture),u){e.setRenderTarget(this.normalRenderTarget);let n=t.overrideMaterial;t.overrideMaterial=Wh,e.setRenderTarget(this.normalRenderTarget),e.render(t,r),t.overrideMaterial=n,o.set(`normal`,this.normalRenderTarget.texture)}return d}render(e,n,r,i,a){let o=!1;this.composer.updateStatus();let s=e.getRenderTarget();e.setRenderTarget(null);let{endabledPassNumber:c,needsDepthGBuffer:l,needsNormalGBuffer:u,version:d}=this.composer.status;if(c===0)this.colorRenderTarget.depthTexture&&(this.colorRenderTarget.depthTexture.dispose(),this.colorRenderTarget.depthTexture=null,this.colorRenderTarget.dispose()),this.colorRenderTarget.setSize(1,1),this.normalRenderTarget.setSize(1,1),this.composer.setSize(1,1),this.composerVersion=``,o=this.renderSceneToBuffers(e,n,r,i,a,!0);else{let s=e.getPixelRatio(),c=e.getViewport(Uh),f=c.width*s,p=c.height*s;if(this.composer.setSize(f,p),a===!1&&d!==this.composerVersion&&(this.composerVersion=d,a=!0),a){if(l){let e=this.colorRenderTarget.depthTexture;if(!e||e.image.width!==f||e.image.height!==p){let n=new t.DepthTexture(f,p);n.generateMipmaps=!1,n.format=t.DepthStencilFormat,n.type=t.UnsignedInt248Type,n.needsUpdate=!0,this.colorRenderTarget.depthTexture=n,e&&e.dispose(),this.colorRenderTarget.dispose()}}else this.colorRenderTarget.depthTexture&&(this.colorRenderTarget.depthTexture.dispose(),this.colorRenderTarget.depthTexture=null,this.colorRenderTarget.dispose());this.colorRenderTarget.setSize(f,p),u?this.normalRenderTarget.setSize(f,p):this.normalRenderTarget.setSize(1,1)}this.renderSceneToBuffers(e,n,r,i,a,!1),e.setRenderTarget(this.composer.readBuffer),Fm(e,this.colorRenderTarget.texture),o=this.composer.render(e)}return e.setRenderTarget(s),o}dispose(){this.composer.dispose();for(let e in this.sceneRenders){let t=e;this.sceneRenders[t].clearBuffers()}}},Kh=class extends t.WebGLRenderer{constructor({preserveDrawingBuffer:e=!0,premultipliedAlpha:n=!0,stencil:r=!0,antialias:i=!1,webgl2:a,logarithmicDepthBuffer:o,precision:s,powerPreference:c}){let l={antialias:i,alpha:!0,depth:!0,preserveDrawingBuffer:e,stencil:r,premultipliedAlpha:n,powerPreference:c},u={logarithmicDepthBuffer:o,precision:s};if(a){let e=document.createElement(`canvas`),t=e.getContext(`webgl2`,l);t?super(Object.assign(Object.assign(Object.assign({},l),u),{antialias:!0,canvas:e,context:t})):(console.error(`error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl.`),super(Object.assign(Object.assign({},l),u)))}else super(Object.assign(Object.assign({},l),u));this.outputEncoding=t.sRGBEncoding,this.autoClear=!0}},qh=class{constructor(e=!0,t=!1){this.elapsedTime=0,this.autoStart=e,this.autoUpdate=t,this.running=e;let n=V();t?B(this,`currentTime`,{get(){return V()}}):this.currentTime=n,this.startTime=n,this.oldTime=n}update(e){this.autoUpdate||(this.currentTime=e)}start(){this.startTime=this.currentTime,this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;return this.autoStart&&!this.running?(this.start(),0):(this.running&&(e=(this.currentTime-this.oldTime)/1e3,this.oldTime=this.currentTime,this.elapsedTime+=e),e)}},Jh=new t.Matrix4,Yh=new t.Frustum,Xh=new t.Vector2,Zh=new WeakMap;function Qh(e){let t=!1;return e.needsRender===!0?(e.needsRender=!1,t=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(t=!0),t}var $h=class extends t.Scene{constructor(){super(...arguments),this.needsRender=!1}add(...e){return super.add(...e)}remove(...e){return super.remove(...e)}update(e,n){let r=!1,i;return n instanceof Yt?(i=n.time,Xh.copy(n.resolution)):(i=V(),e.getSize(Xh)),Jh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),Yh.setFromProjectionMatrix(Jh),this.traverseVisible(e=>{if(e.setResolution&&e.setResolution(Xh.x,Xh.y),e.setTime&&e.setTime(i),e.mixer instanceof t.AnimationMixer){let t=e.mixer,n=Zh.get(t);n||(n=new qh,Zh.set(t,n)),n.update(i),t.update(n.getDelta())}(e instanceof t.Mesh||e instanceof t.Line||e instanceof t.Points)&&(e instanceof t.ImmediateRenderObject||!e.frustumCulled||Yh.intersectsObject(e))&&(Qh(e)&&(r=!0),e.traverseAncestors(e=>{Qh(e)&&(r=!0)}))}),this.needsRender=r,r}},eg=e=>e*(2-e),tg=(()=>{let e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),n=new Float32Array([1,0,0,0,1,1,0,1]),r=new Uint8Array([0,2,1,2,3,1]),i=new t.BufferGeometry;return i.setAttribute(`position`,new t.BufferAttribute(e,3)),i.setAttribute(`uv`,new t.BufferAttribute(n,2)),i.setIndex(new t.BufferAttribute(r,1)),i})(),ng=`
|
|
1708
1708
|
varying vec2 vUv;
|
|
1709
1709
|
#include <common>
|
|
1710
1710
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -1713,7 +1713,7 @@ void main() {
|
|
|
1713
1713
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1714
1714
|
#include <logdepthbuf_vertex>
|
|
1715
1715
|
}
|
|
1716
|
-
`,
|
|
1716
|
+
`,rg=`
|
|
1717
1717
|
uniform vec3 baseColor;
|
|
1718
1718
|
uniform float circleScale;
|
|
1719
1719
|
uniform float ringScale;
|
|
@@ -1816,7 +1816,7 @@ void main() {
|
|
|
1816
1816
|
|
|
1817
1817
|
gl_FragColor = vec4(gl_FragColor.rgb * baseColor, gl_FragColor.a * opacity * opacity);
|
|
1818
1818
|
}
|
|
1819
|
-
`,
|
|
1819
|
+
`,ig=class extends t.Object3D{constructor(e={}){var n,r;super();let i=(n=e.color)==null?16777215:n,a=(r=e.scale)==null?1:r;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({progress:0}),this.ringMotion=new X({scale:1,opacity:1}),this.tapMotion=new X({scale:1,opacity:1}),this.loadingOpacityMotion=new X({opacity:0}),this.progressMotion=new X({progress:0}),this.progressOpacityMotion=new X({opacity:0}),this.opacityMotion=new X({opacity:0}),this.disableMotion=new X({progress:0}),this.panoMesh=new t.Mesh(tg,new t.ShaderMaterial({blending:t.CustomBlending,blendSrc:t.SrcAlphaFactor,blendDst:t.OneMinusSrcAlphaFactor,blendSrcAlpha:t.OneFactor,blendDstAlpha:t.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0,vertexShader:ng,fragmentShader:rg,uniforms:{baseColor:{value:new t.Color(i)},circleScale:{value:1},ringScale:{value:1},ringOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0}}})),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(a,1,a),this.add(this.panoMesh),this.currentStartTime=V(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=H(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(G),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(G).then(()=>{this.progressMotion.set({progress:0},0).catch(G)}):this.progressMotion.set({progress:H(e*1.2,0,1)},100).catch(G)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=H(e,0,1),this.opacityMotion.set({opacity:e},200).catch(G))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:+!!e},2e3).catch(G),this.current=e,this.current===!0&&(this.currentStartTime=V()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:+!!e},500).catch(G))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:+!!e},500).catch(G))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(G),this.progressMotion.set({progress:0},0).catch(G),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:+(this.progress>0)},300).catch(G),this.progressMotion.set({progress:this.progress},120).catch(G)}).catch(G)):Promise.resolve()}updateTime(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);let t=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=t,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);let t=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=t,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);let t=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=t,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=1+Math.sin(Math.PI*t)/25*this.currentMotion.value.progress;this.panoMesh.material.uniforms.circleScale.value=e,this.needsRender=!0}}{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand0.value=eg(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand1.value=eg(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(this.currentMotion.value.progress>.2&&this.progress===0&&this.loading===!1&&(e-this.currentStartTime-1e3)/2e3%5<2?this.ringMotion.getTargetKeyframe().value.scale!==.8&&this.ringMotion.set({scale:.8,opacity:0},600).catch(G):this.ringMotion.getTargetKeyframe().value.scale!==1&&this.ringMotion.set({scale:1,opacity:1},600).catch(G),!this.ringMotion.ended){let{scale:t,opacity:n}=this.ringMotion.value;this.ringMotion.update(e),this.panoMesh.material.uniforms.ringScale.value=t,this.panoMesh.material.uniforms.ringOpacity.value=n,this.needsRender=!0}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=t,this.needsRender=!0}}dispose(){this.ringMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}},ag=e=>e*(2-e),og=(()=>{let e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),n=new Float32Array([1,0,0,0,1,1,0,1]),r=new Uint8Array([0,2,1,2,3,1]),i=new t.BufferGeometry;return i.setAttribute(`position`,new t.BufferAttribute(e,3)),i.setAttribute(`uv`,new t.BufferAttribute(n,2)),i.setIndex(new t.BufferAttribute(r,1)),i})(),sg=`
|
|
1820
1820
|
varying vec2 vUv;
|
|
1821
1821
|
#include <common>
|
|
1822
1822
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -1825,7 +1825,7 @@ void main() {
|
|
|
1825
1825
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1826
1826
|
#include <logdepthbuf_vertex>
|
|
1827
1827
|
}
|
|
1828
|
-
`,
|
|
1828
|
+
`,cg=`
|
|
1829
1829
|
uniform vec3 baseColor;
|
|
1830
1830
|
uniform float circleScale;
|
|
1831
1831
|
uniform float circleOpacity;
|
|
@@ -1928,7 +1928,7 @@ void main() {
|
|
|
1928
1928
|
|
|
1929
1929
|
gl_FragColor = vec4(gl_FragColor.rgb * baseColor, gl_FragColor.a * opacity * opacity);
|
|
1930
1930
|
}
|
|
1931
|
-
`,
|
|
1931
|
+
`,lg=class extends t.Object3D{constructor(e={}){var n,r;super();let i=(n=e.color)==null?16777215:n,a=(r=e.scale)==null?1:r;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({progress:0}),this.tapMotion=new X({scale:1,opacity:1}),this.loadingOpacityMotion=new X({opacity:0}),this.progressMotion=new X({progress:0}),this.progressOpacityMotion=new X({opacity:0}),this.opacityMotion=new X({opacity:0}),this.disableMotion=new X({progress:0}),this.panoMesh=new t.Mesh(og,new t.ShaderMaterial({blending:t.CustomBlending,blendSrc:t.SrcAlphaFactor,blendDst:t.OneMinusSrcAlphaFactor,blendSrcAlpha:t.OneFactor,blendDstAlpha:t.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0,vertexShader:sg,fragmentShader:cg,uniforms:{baseColor:{value:new t.Color(i)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0}}})),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(a,1,a),this.add(this.panoMesh),this.currentStartTime=V(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=H(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(G),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(G).then(()=>{this.progressMotion.set({progress:0},0).catch(G)}):this.progressMotion.set({progress:H(e*1.2,0,1)},100).catch(G)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=H(e,0,1),this.opacityMotion.set({opacity:e},200).catch(G))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:+!!e},2e3).catch(G),this.current=e,this.current===!0&&(this.currentStartTime=V()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:+!!e},500).catch(G))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:+!!e},500).catch(G))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(G),this.progressMotion.set({progress:0},0).catch(G),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:+(this.progress>0)},300).catch(G),this.progressMotion.set({progress:this.progress},120).catch(G)}).catch(G)):Promise.resolve()}updateTime(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);let t=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=t,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);let t=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=t,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);let t=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=t,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=1+Math.sin(Math.PI*t)/25*this.currentMotion.value.progress;this.panoMesh.material.uniforms.circleScale.value=e,this.needsRender=!0}}{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand0.value=ag(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand1.value=ag(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=t,this.needsRender=!0}}dispose(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}},ug=e=>e*(2-e),dg=(()=>{let e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),n=new Float32Array([1,0,0,0,1,1,0,1]),r=new Uint8Array([0,2,1,2,3,1]),i=new t.BufferGeometry;return i.setAttribute(`position`,new t.BufferAttribute(e,3)),i.setAttribute(`uv`,new t.BufferAttribute(n,2)),i.setIndex(new t.BufferAttribute(r,1)),i})(),fg=`
|
|
1932
1932
|
varying vec2 vUv;
|
|
1933
1933
|
#include <common>
|
|
1934
1934
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -1937,7 +1937,7 @@ void main() {
|
|
|
1937
1937
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1938
1938
|
#include <logdepthbuf_vertex>
|
|
1939
1939
|
}
|
|
1940
|
-
`,
|
|
1940
|
+
`,pg=`
|
|
1941
1941
|
#if defined(USE_MAP)
|
|
1942
1942
|
uniform sampler2D map;
|
|
1943
1943
|
uniform float mapAlpha;
|
|
@@ -2071,7 +2071,7 @@ void main() {
|
|
|
2071
2071
|
|
|
2072
2072
|
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);
|
|
2073
2073
|
}
|
|
2074
|
-
`,
|
|
2074
|
+
`,mg=class extends t.Object3D{constructor(e={}){var n,r,i,a,o,s,c;super();let l=(n=e.color)==null?16777215:n,u=(r=e.scale)==null?1:r,d=e.map,f=(i=e.mapAlpha)==null?1:i,p=(a=e.mapUseColor)==null?!1:a,m=(o=e.mapUseReverse)==null?!1:o,h=(s=e.borderWidth)==null?.1:s,g=(c=e.borderColor)==null?16777215:c;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({progress:0}),this.tapMotion=new X({scale:1,opacity:1}),this.loadingOpacityMotion=new X({opacity:0}),this.progressMotion=new X({progress:0}),this.progressOpacityMotion=new X({opacity:0}),this.opacityMotion=new X({opacity:0}),this.disableMotion=new X({progress:0}),this.panoMesh=new t.Mesh(dg,new t.ShaderMaterial({blending:t.CustomBlending,blendSrc:t.SrcAlphaFactor,blendDst:t.OneMinusSrcAlphaFactor,blendSrcAlpha:t.OneFactor,blendDstAlpha:t.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0,vertexShader:fg,fragmentShader:pg,defines:{USE_COLOR:p,USE_MAP:d!==void 0,USE_BORDER:h>0,USE_REVERSE:m},uniforms:{baseColor:{value:new t.Color(l)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0},map:{value:d},mapAlpha:{value:f},borderWidth:{value:h},borderColor:{value:new t.Color(g)}}})),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(u,1,u),this.add(this.panoMesh),this.currentStartTime=V(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=H(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(G),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(G).then(()=>{this.progressMotion.set({progress:0},0).catch(G)}):this.progressMotion.set({progress:H(e*1.2,0,1)},100).catch(G)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=H(e,0,1),this.opacityMotion.set({opacity:e},200).catch(G))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:+!!e},2e3).catch(G),this.current=e,this.current===!0&&(this.currentStartTime=V()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:+!!e},500).catch(G))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:+!!e},500).catch(G))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(G),this.progressMotion.set({progress:0},0).catch(G),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:+(this.progress>0)},300).catch(G),this.progressMotion.set({progress:this.progress},120).catch(G)}).catch(G)):Promise.resolve()}updateTime(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);let t=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=t,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);let t=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=t,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);let t=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=t,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand0.value=ug(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand1.value=ug(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=t,this.needsRender=!0}}dispose(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}};function hg(e,t,n){let r=Math.abs(e-t);return r<.001||n!==void 0&&Math.abs(n-r)<.001}function gg(e,t,n){return!hg(e,t,n)}function _g(e,t){return e.distanceTo(t)<.001}function vg(e,t){return!_g(e,t)}function yg(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}var bg,xg=typeof navigator<`u`?((bg=navigator==null?void 0:navigator.userAgent)==null?``:bg).toLowerCase():`node`;(()=>{try{let e=document.createElement(`canvas`);return!!(window.WebGLRenderingContext&&(e.getContext(`webgl`)||e.getContext(`experimental-webgl`)))}catch(e){return!1}})(),typeof history<`u`&&`pushState`in history&&`replaceState`in history&&`state`in history;var Sg=/android/i.test(xg)||/webos/i.test(xg)||/ipad|iphone|ipod/i.test(xg)||/iemobile/i.test(xg)||/opera mini/i.test(xg)||/blackberry/i.test(xg)||/windows phone/i.test(xg);function Q(e,t){let n=!1,r={type:e,timeStamp:V(),get defaultPrevented(){return n},preventDefault(){n=!0}};for(let e of Object.keys(t))e in r||(r[e]=t[e]);return r}var Cg=new WeakMap;function wg(e,t){let n=Q(e,Object.assign(Object.assign({},t),{waitUntil(e){let t=Cg.get(n);t&&t.push(e)}}));return Cg.set(n,[]),n}function Tg(e){var t;return Promise.all((t=Cg.get(e))==null?[]:t).then(G)}function Eg(){return typeof location>`u`||location.protocol!==`https:`?Promise.reject(Error(`Request DeviceOrientation Permission denied.`)):typeof DeviceOrientationEvent<`u`&&typeof DeviceOrientationEvent.requestPermission==`function`?DeviceOrientationEvent.requestPermission().then(e=>{if(e==`granted`)return Promise.resolve();{let e=Error(`Request DeviceOrientation Permission denied.`);return Promise.reject(e)}}):Promise.resolve()}function Dg(){if(`xr`in navigator)return navigator.xr.isSessionSupported(`immersive-vr`).then(e=>e?Promise.resolve():Promise.reject()).then(()=>navigator.xr.requestSession(`immersive-vr`,{optionalFeatures:[`local-floor`]}).then(e=>Promise.resolve(e)));{let e=Error(`Request XR Permission denied.`);return Promise.reject(e)}}function Og(e,t){e.mode=t.mode,e.workCode=t.workCode,e.panoIndex=t.panoIndex,e.longitude=t.longitude,e.latitude=t.latitude,e.fov=t.fov,e.offset.copy(t.offset),e.distance=t.distance}function kg(e,t){return e.workCode===t.workCode&&e.mode===t.mode&&e.panoIndex===t.panoIndex&&hg(e.longitude,t.longitude,Math.PI*2)&&hg(e.latitude,t.latitude)&&hg(e.fov,t.fov)&&_g(e.offset,t.offset)&&hg(e.distance,t.distance)}function Ag(e,t){e.longitude=t.longitude,e.latitude=t.latitude,e.fov=t.fov,e.distance=t.distance,e.offset.copy(t.offset)}function $(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}function jg(e){switch(e){case`Floorplan`:return!0;case`Mapview`:return!0;default:return!1}}function Mg(e){switch(e){case`Panorama`:return!0;case`VRPanorama`:return!0;case`XRPanorama`:return!0;case`Model`:return!0;default:return!1}}function Ng(e){for(let t in e)return!1;return!0}var Pg=class extends t.ShaderMaterial{constructor(e){super(e),this.uniforms===void 0&&(this.uniforms={}),this.defines===void 0&&(this.defines={})}getUniform(e){return this.uniforms[e].value}setUniform(e,t){Dt(this.uniforms[e],t)}};t.RawShaderMaterial;var Fg=new km(new Pg({vertexShader:`
|
|
2075
2075
|
varying vec2 vUv;
|
|
2076
2076
|
void main() {
|
|
2077
2077
|
vUv = uv;
|
|
@@ -2098,9 +2098,9 @@ void main() {
|
|
|
2098
2098
|
|
|
2099
2099
|
gl_FragColor = textureCube(cubemap, target);
|
|
2100
2100
|
}
|
|
2101
|
-
`,uniforms:{cubemap:{value:null},scaleY:{value:1}},defines:{},transparent:!0,depthTest:!1,depthWrite:!1}));function
|
|
2101
|
+
`,uniforms:{cubemap:{value:null},scaleY:{value:1}},defines:{},transparent:!0,depthTest:!1,depthWrite:!1}));function Ig(e,t,n){Fg.material.setUniform(`cubemap`,t),Fg.material.setUniform(`scaleY`,n?-1:1),Fg.render(e),Fg.material.setUniform(`cubemap`,null)}var Lg=new t.Color,Rg=[],zg=0,Bg=1;function Vg(e,n,r,i){let a=new t.WebGLRenderTarget(i.width,i.height,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:t.LinearFilter,minFilter:t.LinearFilter}),o=e.getRenderTarget();Lg.copy(e.getClearColor());let s=e.getClearAlpha(),c=e.autoClear,l=e.autoClearColor,u=e.autoClearDepth,d=e.autoClearStencil,f=e.clippingPlanes;return e.autoClear=!0,e.autoClearColor=!0,e.autoClearDepth=!0,e.autoClearStencil=!0,e.clippingPlanes=Rg,e.setRenderTarget(a),e.setClearColor(zg,Bg),Ig(e,n,r),e.setRenderTarget(o),e.setClearColor(Lg,s),e.autoClear=c,e.autoClearColor=l,e.autoClearDepth=u,e.autoClearStencil=d,e.clippingPlanes=f,e.readRenderTargetPixels(a,0,0,i.width,i.height,i.data),a.dispose(),i}var Hg=(function(e,t,n,r){"use strict";var i=[``,`webkit`,`Moz`,`MS`,`ms`,`o`],a=t.createElement?t.createElement(`div`):r,o=`function`,s=Math.round,c=Math.abs,l=Date.now;function u(e,t,n){return setTimeout(v(e,n),t)}function d(e,t,n){return Array.isArray(e)?(f(e,n[t],n),!0):!1}function f(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==r)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function p(t,n,r){var i=`DEPRECATED METHOD: `+n+`
|
|
2102
2102
|
`+r+` AT
|
|
2103
|
-
`;return function(){var n=Error(`get-stack-trace`),r=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,``).replace(/^\s+at\s+/gm,``).replace(/^Object.<anonymous>\s*\(/gm,`{anonymous}()@`):`Unknown Stack Trace`,a=e.console&&(e.console.warn||e.console.log);return a&&a.call(e.console,i,r),t.apply(this,arguments)}}var m=typeof Object.assign==`function`?Object.assign:function(e){if(e===r||e===null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==r&&i!==null)for(var a in i)i.hasOwnProperty(a)&&(t[a]=i[a])}return t},h=p(function(e,t,n){for(var i=Object.keys(t),a=0;a<i.length;)(!n||n&&e[i[a]]===r)&&(e[i[a]]=t[i[a]]),a++;return e},`extend`,"Use `assign`."),g=p(function(e,t){return h(e,t,!0)},`merge`,"Use `assign`.");function _(e,t,n){var r=t.prototype,i=e.prototype=Object.create(r);i.constructor=e,i._super=r,n&&m(i,n)}function v(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return typeof e==o?e.apply(t&&t[0]||r,t):e}function b(e,t){return e===r?t:e}function x(e,t,n){f(T(t),function(t){e.addEventListener(t,n,!1)})}function S(e,t,n){f(T(t),function(t){e.removeEventListener(t,n,!1)})}function C(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function w(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function E(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function D(e){return Array.prototype.slice.call(e,0)}function O(e,t,n){for(var r=[],i=[],a=0;a<e.length;){var o=t?e[a][t]:e[a];E(i,o)<0&&r.push(e[a]),i[a]=o,a++}return n&&(r=t?r.sort(function(e,n){return e[t]>n[t]}):r.sort()),r}function k(e,t){for(var n,a,o=t[0].toUpperCase()+t.slice(1),s=0;s<i.length;){if(n=i[s],a=n?n+o:t,a in e)return a;s++}return r}var A=1;function j(){return A++}function M(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var N=/mobile|tablet|ip(ad|hone|od)|android/i,ee=`ontouchstart`in e,te=k(e,`PointerEvent`)!==r,ne=ee&&N.test(navigator.userAgent),re=`touch`,ie=`pen`,ae=`mouse`,oe=`kinect`,se=25,ce=1,le=2,P=4,ue=8,de=1,fe=2,pe=4,me=8,he=16,ge=fe|pe,_e=me|he,ve=ge|_e,ye=[`x`,`y`],be=[`clientX`,`clientY`];function xe(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){y(e.options.enable,[e])&&n.handler(t)},this.init()}xe.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(M(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(M(this.element),this.evWin,this.domHandler)}};function Se(e){var t;return t=e.options.inputClass||(te?Ve:ne?Ye:ee?$e:Ie),new t(e,Ce)}function Ce(e,t,n){var r=n.pointers.length,i=n.changedPointers.length,a=t&ce&&r-i===0,o=t&(P|ue)&&r-i===0;n.isFirst=!!a,n.isFinal=!!o,a&&(e.session={}),n.eventType=t,we(e,n),e.emit(`hammer.input`,n),e.recognize(n),e.session.prevInput=n}function we(e,t){var n=e.session,r=t.pointers,i=r.length;n.firstInput||(n.firstInput=De(t)),i>1&&!n.firstMultiple?n.firstMultiple=De(t):i===1&&(n.firstMultiple=!1);var a=n.firstInput,o=n.firstMultiple,s=o?o.center:a.center,u=t.center=Oe(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=je(s,u),t.distance=Ae(s,u),Te(n,t),t.offsetDirection=ke(t.deltaX,t.deltaY);var d=F(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,t.scale=o?Me(o.pointers,r):1,t.rotation=o?I(o.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,Ee(n,t);var f=e.element;C(t.srcEvent.target,f)&&(f=t.srcEvent.target),t.target=f}function Te(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},a=e.prevInput||{};(t.eventType===ce||a.eventType===P)&&(i=e.prevDelta={x:a.deltaX||0,y:a.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function Ee(e,t){var n=e.lastInterval||t,i=t.timeStamp-n.timeStamp,a,o,s,l;if(t.eventType!=ue&&(i>se||n.velocity===r)){var u=t.deltaX-n.deltaX,d=t.deltaY-n.deltaY,f=F(i,u,d);o=f.x,s=f.y,a=c(f.x)>c(f.y)?f.x:f.y,l=ke(u,d),e.lastInterval=t}else a=n.velocity,o=n.velocityX,s=n.velocityY,l=n.direction;t.velocity=a,t.velocityX=o,t.velocityY=s,t.direction=l}function De(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:s(e.pointers[n].clientX),clientY:s(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:Oe(t),deltaX:e.deltaX,deltaY:e.deltaY}}function Oe(e){var t=e.length;if(t===1)return{x:s(e[0].clientX),y:s(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:s(n/t),y:s(r/t)}}function F(e,t,n){return{x:t/e||0,y:n/e||0}}function ke(e,t){return e===t?de:c(e)>=c(t)?e<0?fe:pe:t<0?me:he}function Ae(e,t,n){n||(n=ye);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function je(e,t,n){n||(n=ye);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.atan2(i,r)*180/Math.PI}function I(e,t){return je(t[1],t[0],be)+je(e[1],e[0],be)}function Me(e,t){return Ae(t[0],t[1],be)/Ae(e[0],e[1],be)}var Ne={mousedown:ce,mousemove:le,mouseup:P},Pe=`mousedown`,Fe=`mousemove mouseup`;function Ie(){this.evEl=Pe,this.evWin=Fe,this.pressed=!1,xe.apply(this,arguments)}_(Ie,xe,{handler:function(e){var t=Ne[e.type];t&ce&&(e.button===0||e.button===2)&&(this.pressed=!0),t&le&&e.which!==1&&(t=P),this.pressed&&(t&P&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:ae,srcEvent:e}))}});var Le={pointerdown:ce,pointermove:le,pointerup:P,pointercancel:ue,pointerout:ue},Re={2:re,3:ie,4:ae,5:oe},ze=`pointerdown`,Be=`pointermove pointerup pointercancel`;e.MSPointerEvent&&!e.PointerEvent&&(ze=`MSPointerDown`,Be=`MSPointerMove MSPointerUp MSPointerCancel`);function Ve(){this.evEl=ze,this.evWin=Be,xe.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}_(Ve,xe,{handler:function(e){var t=this.store,n=!1,r=!1,i=Le[e.type.toLowerCase().replace(`ms`,``)],a=Re[e.pointerType]||e.pointerType,o=a==re,s=E(t,e.pointerId,`pointerId`);i&ce&&(e.button===0||e.button===2||o)?s<0&&(t.push(e),s=t.length-1):i&(P|ue)?n=!0:!o&&e.buttons===0&&(n=!0,r=!0,i=Le.pointerup),!(s<0)&&(r||(t[s]=e),this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:t[s]}),n&&t.splice(s,1))}});var He={touchstart:ce,touchmove:le,touchend:P,touchcancel:ue},Ue=`touchstart`,We=`touchstart touchmove touchend touchcancel`;function Ge(){this.evTarget=Ue,this.evWin=We,this.started=!1,xe.apply(this,arguments)}_(Ge,xe,{handler:function(e){var t=He[e.type];if(t===ce&&(this.started=!0),this.started){var n=Ke.call(this,e,t);t&(P|ue)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:re,srcEvent:e})}}});function Ke(e,t){var n=D(e.touches),r=D(e.changedTouches);return t&(P|ue)&&(n=O(n.concat(r),`identifier`,!0)),[n,r]}var qe={touchstart:ce,touchmove:le,touchend:P,touchcancel:ue},Je=`touchstart touchmove touchend touchcancel`;function Ye(){this.evTarget=Je,this.targetIds={},xe.apply(this,arguments)}_(Ye,xe,{handler:function(e){var t=qe[e.type],n=Xe.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:re,srcEvent:e})}});function Xe(e,t){var n=D(e.touches),r=this.targetIds;if(t&(ce|le)&&n.length===1)return r[n[0].identifier]=!0,[n,n];var i,a,o=D(e.changedTouches),s=[],c=this.target;if(a=n.filter(function(e){return C(e.target,c)}),t===ce)for(i=0;i<a.length;)r[a[i].identifier]=!0,i++;for(i=0;i<o.length;)r[o[i].identifier]&&s.push(o[i]),t&(P|ue)&&delete r[o[i].identifier],i++;if(s.length)return[O(a.concat(s),`identifier`,!0),s]}var Ze=2500,Qe=25;function $e(){xe.apply(this,arguments);var e=v(this.handler,this);this.touch=new Ye(this.manager,e),this.mouse=new Ie(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}_($e,xe,{handler:function(e,t,n){var r=n.pointerType==re,i=n.pointerType==ae;if(!(i&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)et.call(this,t,n);else if(i&&nt.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function et(e,t){e&ce?(this.primaryTouch=t.changedPointers[0].identifier,tt.call(this,t)):e&(P|ue)&&tt.call(this,t)}function tt(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var r=this.lastTouches;setTimeout(function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)},Ze)}}function nt(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],a=Math.abs(t-i.x),o=Math.abs(n-i.y);if(a<=Qe&&o<=Qe)return!0}return!1}var rt=a?k(a.style,`touchAction`):r,it=rt!==r,at=`compute`,ot=`auto`,st=`manipulation`,ct=`none`,lt=`pan-x`,L=`pan-y`,ut=ft();function R(e,t){this.manager=e,this.set(t)}R.prototype={set:function(e){e==at&&(e=this.compute()),it&&this.manager.element.style&&ut[e]&&(this.manager.element.style[rt]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return f(this.manager.recognizers,function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),dt(e.join(` `))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented){t.preventDefault();return}var r=this.actions,i=w(r,ct)&&!ut[ct],a=w(r,L)&&!ut[L],o=w(r,lt)&&!ut[lt];if(i){var s=e.pointers.length===1,c=e.distance<2,l=e.deltaTime<250;if(s&&c&&l)return}if(!(o&&a)&&(i||a&&n&ge||o&&n&_e))return this.preventSrc(t)},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};function dt(e){if(w(e,ct))return ct;var t=w(e,lt),n=w(e,L);return t&&n?ct:t||n?t?lt:L:w(e,st)?st:ot}function ft(){if(!it)return!1;var t={},n=e.CSS&&e.CSS.supports;return[`auto`,`manipulation`,`pan-y`,`pan-x`,`pan-x pan-y`,`none`].forEach(function(r){t[r]=n?e.CSS.supports(`touch-action`,r):!0}),t}var pt=1,mt=2,ht=4,gt=8,_t=gt,vt=16,yt=32;function bt(e){this.options=m({},this.defaults,e||{}),this.id=j(),this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=pt,this.simultaneous={},this.requireFail=[]}bt.prototype={defaults:{},set:function(e){return m(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(d(e,`recognizeWith`,this))return this;var t=this.simultaneous;return e=Ct(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,`dropRecognizeWith`,this)?this:(e=Ct(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(d(e,`requireFailure`,this))return this;var t=this.requireFail;return e=Ct(e,this),E(t,e)===-1&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,`dropRequireFailure`,this))return this;e=Ct(e,this);var t=E(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<gt&&r(t.options.event+xt(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=gt&&r(t.options.event+xt(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=yt},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(yt|pt)))return!1;e++}return!0},recognize:function(e){var t=m({},e);if(!y(this.options.enable,[this,t])){this.reset(),this.state=yt;return}this.state&(_t|vt|yt)&&(this.state=pt),this.state=this.process(t),this.state&(mt|ht|gt|vt)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}};function xt(e){return e&vt?`cancel`:e>?`end`:e&ht?`move`:e&mt?`start`:``}function St(e){return e==he?`down`:e==me?`up`:e==fe?`left`:e==pe?`right`:``}function Ct(e,t){var n=t.manager;return n?n.get(e):e}function wt(){bt.apply(this,arguments)}_(wt,bt,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return t===0||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,r=t&(mt|ht),i=this.attrTest(e);return r&&(n&ue||!i)?t|vt:r||i?n&P?t|gt:t&mt?t|ht:mt:yt}});function Tt(){wt.apply(this,arguments),this.pX=null,this.pY=null}_(Tt,wt,{defaults:{event:`pan`,threshold:10,pointers:1,direction:ve},getTouchAction:function(){var e=this.options.direction,t=[];return e&ge&&t.push(L),e&_e&&t.push(lt),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,a=e.deltaX,o=e.deltaY;return i&t.direction||(t.direction&ge?(i=a===0?de:a<0?fe:pe,n=a!=this.pX,r=Math.abs(e.deltaX)):(i=o===0?de:o<0?me:he,n=o!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return wt.prototype.attrTest.call(this,e)&&(this.state&mt||!(this.state&mt)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=St(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}});function Et(){wt.apply(this,arguments)}_(Et,wt,{defaults:{event:`pinch`,threshold:0,pointers:2},getTouchAction:function(){return[ct]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&mt)},emit:function(e){if(e.scale!==1){var t=e.scale<1?`in`:`out`;e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}});function z(){bt.apply(this,arguments),this._timer=null,this._input=null}_(z,bt,{defaults:{event:`press`,pointers:1,time:251,threshold:9},getTouchAction:function(){return[ot]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime>t.time;if(this._input=e,!r||!n||e.eventType&(P|ue)&&!i)this.reset();else if(e.eventType&ce)this.reset(),this._timer=u(function(){this.state=_t,this.tryEmit()},t.time,this);else if(e.eventType&P)return _t;return yt},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===_t&&(e&&e.eventType&P?this.manager.emit(this.options.event+`up`,e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function Dt(){wt.apply(this,arguments)}_(Dt,wt,{defaults:{event:`rotate`,threshold:0,pointers:2},getTouchAction:function(){return[ct]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&mt)}});function Ot(){wt.apply(this,arguments)}_(Ot,wt,{defaults:{event:`swipe`,threshold:10,velocity:.3,direction:ge|_e,pointers:1},getTouchAction:function(){return Tt.prototype.getTouchAction.call(this)},attrTest:function(e){var t=this.options.direction,n;return t&(ge|_e)?n=e.overallVelocity:t&ge?n=e.overallVelocityX:t&_e&&(n=e.overallVelocityY),this._super.attrTest.call(this,e)&&t&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(n)>this.options.velocity&&e.eventType&P},emit:function(e){var t=St(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}});function kt(){bt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}_(kt,bt,{defaults:{event:`tap`,pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[st]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime<t.time;if(this.reset(),e.eventType&ce&&this.count===0)return this.failTimeout();if(r&&i&&n){if(e.eventType!=P)return this.failTimeout();var a=this.pTime?e.timeStamp-this.pTime<t.interval:!0,o=!this.pCenter||Ae(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!o||!a?this.count=1:this.count+=1,this._input=e,this.count%t.taps===0)return this.hasRequireFailures()?(this._timer=u(function(){this.state=_t,this.tryEmit()},t.interval,this),mt):_t}return yt},failTimeout:function(){return this._timer=u(function(){this.state=yt},this.options.interval,this),yt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==_t&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function B(e,t){return t=t||{},t.recognizers=b(t.recognizers,B.defaults.preset),new Mt(e,t)}B.VERSION=`2.0.7`,B.defaults={domEvents:!1,touchAction:at,enable:!0,inputTarget:null,inputClass:null,preset:[[Dt,{enable:!1}],[Et,{enable:!1},[`rotate`]],[Ot,{direction:ge}],[Tt,{direction:ge},[`swipe`]],[kt],[kt,{event:`doubletap`,taps:2},[`tap`]],[z]],cssProps:{userSelect:`none`,touchSelect:`none`,touchCallout:`none`,contentZooming:`none`,userDrag:`none`,tapHighlightColor:`rgba(0,0,0,0)`}};var At=1,jt=2;function Mt(e,t){this.options=m({},B.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=Se(this),this.touchAction=new R(this,this.options.touchAction),Nt(this,!0),f(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}Mt.prototype={set:function(e){return m(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?jt:At},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var n,r=this.recognizers,i=t.curRecognizer;(!i||i&&i.state&_t)&&(i=t.curRecognizer=null);for(var a=0;a<r.length;)n=r[a],t.stopped!==jt&&(!i||n==i||n.canRecognizeWith(i))?n.recognize(e):n.reset(),!i&&n.state&(mt|ht|gt)&&(i=t.curRecognizer=n),a++}},get:function(e){if(e instanceof bt)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(d(e,`add`,this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(d(e,`remove`,this))return this;if(e=this.get(e),e){var t=this.recognizers,n=E(t,e);n!==-1&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==r&&t!==r){var n=this.handlers;return f(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==r){var n=this.handlers;return f(T(e),function(e){t?n[e]&&n[e].splice(E(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&Pt(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(!(!n||!n.length)){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},destroy:function(){this.element&&Nt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Nt(e,t){var n=e.element;if(n.style){var r;f(e.options.cssProps,function(i,a){r=k(n.style,a),t?(e.oldCssProps[r]=n.style[r],n.style[r]=i):n.style[r]=e.oldCssProps[r]||``}),t||(e.oldCssProps={})}}function Pt(e,n){var r=t.createEvent(`Event`);r.initEvent(e,!0,!0),r.gesture=n,n.target.dispatchEvent(r)}return m(B,{INPUT_START:ce,INPUT_MOVE:le,INPUT_END:P,INPUT_CANCEL:ue,STATE_POSSIBLE:pt,STATE_BEGAN:mt,STATE_CHANGED:ht,STATE_ENDED:gt,STATE_RECOGNIZED:_t,STATE_CANCELLED:vt,STATE_FAILED:yt,DIRECTION_NONE:de,DIRECTION_LEFT:fe,DIRECTION_RIGHT:pe,DIRECTION_UP:me,DIRECTION_DOWN:he,DIRECTION_HORIZONTAL:ge,DIRECTION_VERTICAL:_e,DIRECTION_ALL:ve,Manager:Mt,Input:xe,TouchAction:R,TouchInput:Ye,MouseInput:Ie,PointerEventInput:Ve,TouchMouseInput:$e,SingleTouchInput:Ge,Recognizer:bt,AttrRecognizer:wt,Tap:kt,Pan:Tt,Swipe:Ot,Pinch:Et,Rotate:Dt,Press:z,on:x,off:S,each:f,merge:g,extend:h,assign:m,inherit:_,bindFn:v,prefixed:k}),B})(typeof window<`u`?window:{},typeof document<`u`?document:{},`Hammer`),Vg=class e extends nn{static parseArgs(t){return t instanceof e?t:Object.assign({},t)}static initAnimationEndState(e){var t,n,r,i,a,o,s,c;let l=this.parseArgs(e),{state:u,currentState:d}=l.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=l.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex};return Object.assign(Object.assign({},f),{mode:``,longitude:(i=u.longitude)==null?d.longitude:i,latitude:(a=u.latitude)==null?d.latitude:a,fov:(o=u.fov)==null?d.fov:o,offset:(s=u.offset)==null?d.offset:s,distance:(c=u.distance)==null?d.distance:c})}constructor(t){var n,r,i;super();let a=e.parseArgs(t);this.mode=``,this.pending=new Set,this.userAction=a.initial.userAction,this.destroyed=!1,this.fiveId=a.fiveId,this.scene=a.scene,this.modelScene=a.modelScene,this.xrCustomObjectsScene=a.xrCustomObjectsScene,this.helper=a.helper,this.camera=a.camera,this.renderer=a.renderer,this.viewport=a.viewport,this.element=a.element,this.enableWheel=a.enableWheel,this.works=a.works,this.imageOptions=a.imageOptions,this.videoTexture=a.videoTexture,this.extraElements=a.extraElements,this.initial=a.initial,this.currentPano=typeof this.initial.state.panoIndex==`number`?{workCode:(i=(n=this.initial.state.workCode)==null?(r=a.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:this.initial.state.panoIndex}:{workCode:this.initial.currentState.workCode,panoIndex:this.initial.currentState.panoIndex},this.needsRender=!0,this.cameraMotion=new X({longitude:{value:this.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}),this.inMomentumMovement=null,this.eventUnbinds=[a.element].concat(a.extraElements||[]).map(e=>this.bindEvents(e)),this.initAnimationIsReady=!1,this.pending.add(`init-animation`),this.initAnimationReady=new Promise(e=>{ei.shared.add(()=>{this.initAnimation().then(()=>{this.initAnimationIsReady=!0,this.pending.delete(`init-animation`),e()})},!0,0)})}updateConfiguration(e){return!0}destroy(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(let e of this.eventUnbinds)e();this.panState=void 0,(e=this.pressState)==null||e.stop(),this.pressState=void 0}isReady(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0}bindExtraElement(e){for(let t of this.eventUnbinds)if(t.element===e)return;this.eventUnbinds.push(this.bindEvents(e))}unbindExtraElement(e){let t=[];for(let n of this.eventUnbinds)n.element===e?n():t.push(n);this.eventUnbinds=t}updateModel(e){this.needsRender=!0}updateWork(e,t,n,r){return this.works=e,this.userAction=r,!1}updateTime(e,t,...n){if(this.destroyed)return;let r={};this.cameraMotion.ended&&(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),jg(r)&&this.setCamera(r)}render(){return!1}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={};return e.longitude!==void 0&&(r.longitude=e.longitude),e.latitude!==void 0&&(r.latitude=e.latitude),e.fov!==void 0&&(r.fov=e.fov),this.cameraMotion.set(r,t).catch(G)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.cameraMotion.setKeyframes(r,t)})}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(V())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})}initAnimation(){let{state:t,currentState:n,duration:r,userAction:i}=this.initial,a=e.initAnimationEndState(this);return this.userAction=i,this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:a,userAction:this.userAction})),this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:a,userAction:this.userAction})),Promise.resolve()}setCamera(e={}){var t,n,r,i,a;let o=(t=e.longitude)==null?this.camera.pose.longitude:t,s=(n=e.latitude)==null?this.camera.pose.latitude:n,c=(r=e.fov)==null?this.camera.pose.fov:r,l=(i=e.distance)==null?this.camera.pose.distance:i,u=(a=e.offset)==null?this.camera.pose.offset:a,d=mg(o,this.camera.pose.longitude,Math.PI*2)||mg(s,this.camera.pose.latitude),f=mg(c,this.camera.pose.fov),p=mg(l,this.camera.pose.distance),m=gg(u,this.camera.pose.offset);(f||d||m||p)&&(this.camera.setFromPose({longitude:o,latitude:s,fov:c,distance:l,offset:u}),this.emit(`camera.update`,Q(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:s,fov:c,offset:u,distance:l})})),this.needsRender=!0)}stopMomentumMovement(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){let e=Q(`gesture.momentum`,Object.assign(Object.assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit(`gesture.fire`,e),this.emit(`gesture.momentum`,e)}this.inMomentumMovement=null}onPanGesture(e){this.stopMomentumMovement(),this.emit(`gesture.pan`,e)}onTapGesture(e){this.stopMomentumMovement(),this.emit(`gesture.tap`,e)}onDblTapGesture(e){this.stopMomentumMovement(),this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(e.type=`gesture.tap`,this.onTapGesture(e))}onPressGesture(e){this.stopMomentumMovement(),this.emit(`gesture.press`,e)}onPinchGesture(e){this.stopMomentumMovement(),this.emit(`gesture.pinch`,e)}onMouseWheel(e){this.stopMomentumMovement(),this.emit(`gesture.mousewheel`,e)}onMouseMove(e){this.stopMomentumMovement(),this.emit(`gesture.mousemove`,e)}relativeClientPosition(e){let{top:n,left:r,width:i,height:a}=this.element.getBoundingClientRect();return r+=i*this.viewport.left,n+=a*(1-this.viewport.bottom-this.viewport.height),i*=this.viewport.width,a*=this.viewport.height,new t.Vector2((e.x-r)/i*2-1,-(e.y-n)/a*2+1)}createRaycasterFromCamera(e,n){let r=new t.Raycaster;return r.params.Points={threshold:.1},r.firstHitOnly=!0,r.near=n.near,r.far=n.far,r.setFromCamera(e,this.camera),r}bindEvents(e){let n=e=>{let t=this.relativeClientPosition(e);return!(Math.abs(t.x)>1||Math.abs(t.y)>1)},r=e=>({button:`button`in e?e.button:0,buttons:`buttons`in e?e.buttons:0,shiftKey:`shiftKey`in e?e.shiftKey:!1,ctrlKey:`ctrlKey`in e?e.ctrlKey:!1,altKey:`altKey`in e?e.altKey:!1,metaKey:`metaKey`in e?e.metaKey:!1}),i=new Bg.Manager(e),a=e=>e.session.firstInput||null,o=new Bg.Pan({threshold:10,pointers:0}),s=new Bg.Tap({interval:410}),c=new Bg.Pinch({threshold:0,pointers:2});i.add([o,s,c]),i.on(`panstart pan`,e=>{let t=r(e.srcEvent),o=a(i);if(o&&!n(o.center))return;let s=Q(`gesture.pan`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})}),isFirst:e.isFirst||e.type==`panstart`,isFinal:e.isFinal,scale:e.scale,center:(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onPanGesture(s),v()}),i.on(`tap`,e=>{let t=r(e.srcEvent);if(e.pointerType===`mouse`&&t.button!==0)return;let o=a(i);if(o&&!n(o.center))return;let s=Q(`gesture.tap`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})}),isFirst:!0,isFinal:!0,scale:e.scale,center:(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onTapGesture(s),v()}),i.on(`pinchstart pinch pinchend`,e=>{let o=r(e.srcEvent),s=a(i);if(s&&!n(s.center))return;let c=Q(`gesture.pinch`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{var n;let r=this.relativeClientPosition(e),i=new t.Raycaster;return i.params.Points={threshold:.1},i.setFromCamera(r,this.camera),Object.assign(Object.assign({x:e.x,y:e.y,delta:(n=e.delta)==null?0:n},o),{coords:r,raycaster:i})}),isFirst:e.type===`pinchstart`,isFinal:e.type===`pinchend`,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},o),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,c),this.onPinchGesture(c),v()}),i.on(`dbltap`,e=>{let t=r(e.srcEvent);if(e.pointerType===`mouse`&&t.button!==0)return;let o=a(i);if(o&&!n(o.center))return;let s=Q(`gesture.dbltap`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})}),isFirst:!0,isFinal:!0,scale:e.scale,center:(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onDblTapGesture(s),v()});let l=null,u=null,d=(e,t,n)=>{let i={x:n.clientX,y:n.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),r(n)),{delta:0}),c=e===`pinchend`?t:t-n.deltaY/280;return Q(`gesture.pinch`,{target:n.target,pointerType:`mouse`,srcEvent:n,pointers:[Object.assign({},s)],isFirst:e===`pinchstart`,isFinal:e===`pinchend`,scale:H(c,.1,10),center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))})},f=e=>{var t;if(n({x:e.clientX,y:e.clientY})){if(e.preventDefault(),e.ctrlKey){let n=(t=l==null?void 0:l.prevEvent.scale)==null?1:t,r=d(l?`pinch`:`pinchstart`,n,e);this.emit(`gesture.fire`,r),l===null?l={firstEvent:r,prevEvent:r}:l.prevEvent=r,this.emit(`gesture.fire`,r),this.onPinchGesture(r),u!==null&&window.clearTimeout(u),u=window.setTimeout(()=>{var t;u=null;let n=d(`pinchend`,(t=l==null?void 0:l.prevEvent.scale)==null?1:t,e);this.emit(`gesture.fire`,n),l=null,this.onPinchGesture(n)},200)}else{let t=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=this.mouseWheelState!==void 0,i={x:e.clientX,y:e.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),r(e)),{delta:t}),c=Q(`gesture.mousewheel`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},s)],isFirst:n,isFinal:!1,scale:0,center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,c),this.onMouseWheel(c),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:setTimeout(()=>{this.mouseWheelState=void 0;let t=Q(`gesture.mousewheel`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign(Object.assign({},s),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:Object.assign(Object.assign({},s),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,t),this.onMouseWheel(t)},100)}}v()}},p=e=>{if(bg)return;if(!n({x:e.clientX,y:e.clientY})){m();return}let t=!1;this.mouseMoveState||(t=!0);let i={x:e.clientX,y:e.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),r(e)),{delta:0}),c=Q(`gesture.mousemove`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},s)],isFirst:t,isFinal:!1,scale:0,center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,c),this.mouseMoveState={timeStamp:V(),event:c},this.onMouseMove(c),this.pressState&&Math.abs(e.clientX-this.pressState.event.center.y)>10&&Math.abs(e.clientY-this.pressState.event.center.y)>10&&v()},m=()=>{if(this.mouseMoveState){let e=Q(this.mouseMoveState.event.type,Object.assign(Object.assign({},this.mouseMoveState.event),{isFinal:!0}));this.emit(`gesture.fire`,e),this.mouseMoveState=void 0,this.onMouseMove(e)}v()},h=e=>{if(!n(e.center)){v();return}let t=!1;this.pressState||(t=!0,this.pressState={event:e,timeStamp:V(),stop:G});let r=V()-this.pressState.timeStamp,i=Q(this.pressState.event.type,Object.assign(Object.assign({},this.pressState.event),{isFirst:t,isFinal:!1,center:Object.assign(Object.assign({},this.pressState.event.center),{delta:r}),pointers:this.pressState.event.pointers.map(e=>Object.assign(Object.assign({},e),{delta:r}))}));this.emit(`gesture.fire`,i),this.onPressGesture(i),this.pressState&&(this.pressState.stop=ei.shared.add(t=>{h(e)},!0,1))},g=e=>{if(v(),e.touches.length>1||e.changedTouches.length<=0)return;let t={x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY},n=this.relativeClientPosition(t),i=this.createRaycasterFromCamera(n,this.camera),a=Object.assign(Object.assign(Object.assign(Object.assign({},t),{coords:n,raycaster:i}),r(e)),{delta:0}),o=Q(`gesture.press`,{target:e.target,pointerType:`touch`,srcEvent:e,pointers:[Object.assign({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,o),h(o)},_=e=>{v();let t={x:e.clientX,y:e.clientY},n=this.relativeClientPosition(t),i=this.createRaycasterFromCamera(n,this.camera),a=Object.assign(Object.assign(Object.assign(Object.assign({},t),{coords:n,raycaster:i}),r(e)),{delta:0}),o=Q(`gesture.press`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,o),h(o)},v=()=>{var e;if(this.pressState){let t=V()-this.pressState.timeStamp,n=Q(this.pressState.event.type,Object.assign(Object.assign({},this.pressState.event),{center:Object.assign(Object.assign({},this.pressState.event.center),{delta:t}),isFirst:!1,isFinal:!0,pointers:this.pressState.event.pointers.map(e=>Object.assign(Object.assign({},e),{delta:t}))}));this.emit(`gesture.fire`,n),this.onPressGesture(n),(e=this.pressState)==null||e.stop(),this.pressState=void 0}},y=null,b=e=>{var t,n,i;let a=!1,o=!1;switch(e.type){case`gesturestart`:a=!0;break;case`gestureend`:o=!0;break;default:break}let s={x:(t=e.clientX)==null?0:t,y:(n=e.clientY)==null?0:n},c=this.relativeClientPosition(s),l=this.createRaycasterFromCamera(c,this.camera),u=Object.assign(Object.assign(Object.assign(Object.assign({},s),{coords:c,raycaster:l}),r(e)),{delta:0});return Q(`gesture.pinch`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},u)],isFirst:a,isFinal:o,scale:(i=e.scale)==null?1:i,center:Object.assign({},u),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))})},x=e=>{if(e.preventDefault(),bg)return;let t=b(e);this.emit(`gesture.fire`,t),y={firstEvent:t};let r=y.firstEvent;r&&!n(r.center)||this.onPinchGesture(t)},S=e=>{if(e.preventDefault(),bg||!y)return;let t=y.firstEvent;if(t&&!n(t.center))return;let r=b(e);this.emit(`gesture.fire`,r),this.onPinchGesture(r)},C=e=>{if(e.preventDefault(),bg||!y)return;let t=y.firstEvent;if(y=null,t&&!n(t.center))return;let r=b(e);this.emit(`gesture.fire`,r),this.onPinchGesture(r)},w=t=>{if(t&&typeof t.preventDefault==`function`&&t.currentTarget===e&&t.preventDefault(),typeof getSelection==`function`){let e=getSelection();e&&e.focusNode&&(e.removeAllRanges&&e.removeAllRanges(),e.empty&&e.empty())}};return this.enableWheel&&e.addEventListener(`wheel`,f,{passive:!1}),e.addEventListener(`mousemove`,p,!1),e.addEventListener(`mouseout`,m,!1),e.addEventListener(`touchstart`,g,{passive:!0}),e.addEventListener(`touchend`,v,!1),e.addEventListener(`touchcancel`,v,!1),e.addEventListener(`mousedown`,_,!1),e.addEventListener(`mouseup`,v,!1),e.addEventListener(`gesturestart`,x,{passive:!1}),e.addEventListener(`gesturechange`,S,{passive:!1}),e.addEventListener(`gestureend`,C,{passive:!1}),e.addEventListener(`touchstart`,w,{passive:!1}),e.addEventListener(`contextmenu`,w,!1),Object.assign(()=>{i.destroy(),e.removeEventListener(`wheel`,f,!1),e.removeEventListener(`mousemove`,p,!1),e.removeEventListener(`mouseout`,m,!1),e.removeEventListener(`touchstart`,g,!1),e.removeEventListener(`touchend`,v,!1),e.removeEventListener(`touchcancel`,v,!1),e.removeEventListener(`mousedown`,_,!1),e.removeEventListener(`mouseup`,v,!1),e.removeEventListener(`gesturestart`,x,!1),e.removeEventListener(`gesturechange`,S,!1),e.removeEventListener(`gestureend`,C,!1),e.removeEventListener(`touchstart`,w,!1),e.removeEventListener(`contextmenu`,w,!1)},{element:e})}},Hg=new t.CircleBufferGeometry(.1,16),Ug=new t.ShaderMaterial({vertexShader:`
|
|
2103
|
+
`;return function(){var n=Error(`get-stack-trace`),r=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,``).replace(/^\s+at\s+/gm,``).replace(/^Object.<anonymous>\s*\(/gm,`{anonymous}()@`):`Unknown Stack Trace`,a=e.console&&(e.console.warn||e.console.log);return a&&a.call(e.console,i,r),t.apply(this,arguments)}}var m=typeof Object.assign==`function`?Object.assign:function(e){if(e===r||e===null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==r&&i!==null)for(var a in i)i.hasOwnProperty(a)&&(t[a]=i[a])}return t},h=p(function(e,t,n){for(var i=Object.keys(t),a=0;a<i.length;)(!n||n&&e[i[a]]===r)&&(e[i[a]]=t[i[a]]),a++;return e},`extend`,"Use `assign`."),g=p(function(e,t){return h(e,t,!0)},`merge`,"Use `assign`.");function _(e,t,n){var r=t.prototype,i=e.prototype=Object.create(r);i.constructor=e,i._super=r,n&&m(i,n)}function v(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return typeof e==o?e.apply(t&&t[0]||r,t):e}function b(e,t){return e===r?t:e}function x(e,t,n){f(T(t),function(t){e.addEventListener(t,n,!1)})}function S(e,t,n){f(T(t),function(t){e.removeEventListener(t,n,!1)})}function C(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function w(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function E(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function D(e){return Array.prototype.slice.call(e,0)}function O(e,t,n){for(var r=[],i=[],a=0;a<e.length;){var o=t?e[a][t]:e[a];E(i,o)<0&&r.push(e[a]),i[a]=o,a++}return n&&(r=t?r.sort(function(e,n){return e[t]>n[t]}):r.sort()),r}function k(e,t){for(var n,a,o=t[0].toUpperCase()+t.slice(1),s=0;s<i.length;){if(n=i[s],a=n?n+o:t,a in e)return a;s++}return r}var A=1;function j(){return A++}function M(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var N=/mobile|tablet|ip(ad|hone|od)|android/i,ee=`ontouchstart`in e,te=k(e,`PointerEvent`)!==r,ne=ee&&N.test(navigator.userAgent),re=`touch`,ie=`pen`,ae=`mouse`,oe=`kinect`,se=25,ce=1,le=2,P=4,ue=8,de=1,fe=2,pe=4,me=8,he=16,ge=fe|pe,_e=me|he,ve=ge|_e,ye=[`x`,`y`],be=[`clientX`,`clientY`];function xe(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){y(e.options.enable,[e])&&n.handler(t)},this.init()}xe.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(M(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(M(this.element),this.evWin,this.domHandler)}};function Se(e){var t;return t=e.options.inputClass||(te?Ve:ne?Ye:ee?$e:Ie),new t(e,Ce)}function Ce(e,t,n){var r=n.pointers.length,i=n.changedPointers.length,a=t&ce&&r-i===0,o=t&(P|ue)&&r-i===0;n.isFirst=!!a,n.isFinal=!!o,a&&(e.session={}),n.eventType=t,we(e,n),e.emit(`hammer.input`,n),e.recognize(n),e.session.prevInput=n}function we(e,t){var n=e.session,r=t.pointers,i=r.length;n.firstInput||(n.firstInput=De(t)),i>1&&!n.firstMultiple?n.firstMultiple=De(t):i===1&&(n.firstMultiple=!1);var a=n.firstInput,o=n.firstMultiple,s=o?o.center:a.center,u=t.center=Oe(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=je(s,u),t.distance=Ae(s,u),Te(n,t),t.offsetDirection=ke(t.deltaX,t.deltaY);var d=F(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,t.scale=o?Me(o.pointers,r):1,t.rotation=o?I(o.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,Ee(n,t);var f=e.element;C(t.srcEvent.target,f)&&(f=t.srcEvent.target),t.target=f}function Te(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},a=e.prevInput||{};(t.eventType===ce||a.eventType===P)&&(i=e.prevDelta={x:a.deltaX||0,y:a.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function Ee(e,t){var n=e.lastInterval||t,i=t.timeStamp-n.timeStamp,a,o,s,l;if(t.eventType!=ue&&(i>se||n.velocity===r)){var u=t.deltaX-n.deltaX,d=t.deltaY-n.deltaY,f=F(i,u,d);o=f.x,s=f.y,a=c(f.x)>c(f.y)?f.x:f.y,l=ke(u,d),e.lastInterval=t}else a=n.velocity,o=n.velocityX,s=n.velocityY,l=n.direction;t.velocity=a,t.velocityX=o,t.velocityY=s,t.direction=l}function De(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:s(e.pointers[n].clientX),clientY:s(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:Oe(t),deltaX:e.deltaX,deltaY:e.deltaY}}function Oe(e){var t=e.length;if(t===1)return{x:s(e[0].clientX),y:s(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:s(n/t),y:s(r/t)}}function F(e,t,n){return{x:t/e||0,y:n/e||0}}function ke(e,t){return e===t?de:c(e)>=c(t)?e<0?fe:pe:t<0?me:he}function Ae(e,t,n){n||(n=ye);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function je(e,t,n){n||(n=ye);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.atan2(i,r)*180/Math.PI}function I(e,t){return je(t[1],t[0],be)+je(e[1],e[0],be)}function Me(e,t){return Ae(t[0],t[1],be)/Ae(e[0],e[1],be)}var Ne={mousedown:ce,mousemove:le,mouseup:P},Pe=`mousedown`,Fe=`mousemove mouseup`;function Ie(){this.evEl=Pe,this.evWin=Fe,this.pressed=!1,xe.apply(this,arguments)}_(Ie,xe,{handler:function(e){var t=Ne[e.type];t&ce&&(e.button===0||e.button===2)&&(this.pressed=!0),t&le&&e.which!==1&&(t=P),this.pressed&&(t&P&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:ae,srcEvent:e}))}});var Le={pointerdown:ce,pointermove:le,pointerup:P,pointercancel:ue,pointerout:ue},Re={2:re,3:ie,4:ae,5:oe},ze=`pointerdown`,Be=`pointermove pointerup pointercancel`;e.MSPointerEvent&&!e.PointerEvent&&(ze=`MSPointerDown`,Be=`MSPointerMove MSPointerUp MSPointerCancel`);function Ve(){this.evEl=ze,this.evWin=Be,xe.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}_(Ve,xe,{handler:function(e){var t=this.store,n=!1,r=!1,i=Le[e.type.toLowerCase().replace(`ms`,``)],a=Re[e.pointerType]||e.pointerType,o=a==re,s=E(t,e.pointerId,`pointerId`);i&ce&&(e.button===0||e.button===2||o)?s<0&&(t.push(e),s=t.length-1):i&(P|ue)?n=!0:!o&&e.buttons===0&&(n=!0,r=!0,i=Le.pointerup),!(s<0)&&(r||(t[s]=e),this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:t[s]}),n&&t.splice(s,1))}});var He={touchstart:ce,touchmove:le,touchend:P,touchcancel:ue},Ue=`touchstart`,We=`touchstart touchmove touchend touchcancel`;function Ge(){this.evTarget=Ue,this.evWin=We,this.started=!1,xe.apply(this,arguments)}_(Ge,xe,{handler:function(e){var t=He[e.type];if(t===ce&&(this.started=!0),this.started){var n=Ke.call(this,e,t);t&(P|ue)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:re,srcEvent:e})}}});function Ke(e,t){var n=D(e.touches),r=D(e.changedTouches);return t&(P|ue)&&(n=O(n.concat(r),`identifier`,!0)),[n,r]}var qe={touchstart:ce,touchmove:le,touchend:P,touchcancel:ue},Je=`touchstart touchmove touchend touchcancel`;function Ye(){this.evTarget=Je,this.targetIds={},xe.apply(this,arguments)}_(Ye,xe,{handler:function(e){var t=qe[e.type],n=Xe.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:re,srcEvent:e})}});function Xe(e,t){var n=D(e.touches),r=this.targetIds;if(t&(ce|le)&&n.length===1)return r[n[0].identifier]=!0,[n,n];var i,a,o=D(e.changedTouches),s=[],c=this.target;if(a=n.filter(function(e){return C(e.target,c)}),t===ce)for(i=0;i<a.length;)r[a[i].identifier]=!0,i++;for(i=0;i<o.length;)r[o[i].identifier]&&s.push(o[i]),t&(P|ue)&&delete r[o[i].identifier],i++;if(s.length)return[O(a.concat(s),`identifier`,!0),s]}var Ze=2500,Qe=25;function $e(){xe.apply(this,arguments);var e=v(this.handler,this);this.touch=new Ye(this.manager,e),this.mouse=new Ie(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}_($e,xe,{handler:function(e,t,n){var r=n.pointerType==re,i=n.pointerType==ae;if(!(i&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)et.call(this,t,n);else if(i&&nt.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function et(e,t){e&ce?(this.primaryTouch=t.changedPointers[0].identifier,tt.call(this,t)):e&(P|ue)&&tt.call(this,t)}function tt(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var r=this.lastTouches;setTimeout(function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)},Ze)}}function nt(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],a=Math.abs(t-i.x),o=Math.abs(n-i.y);if(a<=Qe&&o<=Qe)return!0}return!1}var rt=a?k(a.style,`touchAction`):r,it=rt!==r,at=`compute`,ot=`auto`,st=`manipulation`,ct=`none`,lt=`pan-x`,L=`pan-y`,ut=ft();function R(e,t){this.manager=e,this.set(t)}R.prototype={set:function(e){e==at&&(e=this.compute()),it&&this.manager.element.style&&ut[e]&&(this.manager.element.style[rt]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return f(this.manager.recognizers,function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),dt(e.join(` `))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented){t.preventDefault();return}var r=this.actions,i=w(r,ct)&&!ut[ct],a=w(r,L)&&!ut[L],o=w(r,lt)&&!ut[lt];if(i){var s=e.pointers.length===1,c=e.distance<2,l=e.deltaTime<250;if(s&&c&&l)return}if(!(o&&a)&&(i||a&&n&ge||o&&n&_e))return this.preventSrc(t)},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};function dt(e){if(w(e,ct))return ct;var t=w(e,lt),n=w(e,L);return t&&n?ct:t||n?t?lt:L:w(e,st)?st:ot}function ft(){if(!it)return!1;var t={},n=e.CSS&&e.CSS.supports;return[`auto`,`manipulation`,`pan-y`,`pan-x`,`pan-x pan-y`,`none`].forEach(function(r){t[r]=n?e.CSS.supports(`touch-action`,r):!0}),t}var pt=1,mt=2,ht=4,gt=8,_t=gt,vt=16,yt=32;function bt(e){this.options=m({},this.defaults,e||{}),this.id=j(),this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=pt,this.simultaneous={},this.requireFail=[]}bt.prototype={defaults:{},set:function(e){return m(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(d(e,`recognizeWith`,this))return this;var t=this.simultaneous;return e=Ct(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,`dropRecognizeWith`,this)?this:(e=Ct(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(d(e,`requireFailure`,this))return this;var t=this.requireFail;return e=Ct(e,this),E(t,e)===-1&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,`dropRequireFailure`,this))return this;e=Ct(e,this);var t=E(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<gt&&r(t.options.event+xt(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=gt&&r(t.options.event+xt(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=yt},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(yt|pt)))return!1;e++}return!0},recognize:function(e){var t=m({},e);if(!y(this.options.enable,[this,t])){this.reset(),this.state=yt;return}this.state&(_t|vt|yt)&&(this.state=pt),this.state=this.process(t),this.state&(mt|ht|gt|vt)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}};function xt(e){return e&vt?`cancel`:e>?`end`:e&ht?`move`:e&mt?`start`:``}function St(e){return e==he?`down`:e==me?`up`:e==fe?`left`:e==pe?`right`:``}function Ct(e,t){var n=t.manager;return n?n.get(e):e}function wt(){bt.apply(this,arguments)}_(wt,bt,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return t===0||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,r=t&(mt|ht),i=this.attrTest(e);return r&&(n&ue||!i)?t|vt:r||i?n&P?t|gt:t&mt?t|ht:mt:yt}});function Tt(){wt.apply(this,arguments),this.pX=null,this.pY=null}_(Tt,wt,{defaults:{event:`pan`,threshold:10,pointers:1,direction:ve},getTouchAction:function(){var e=this.options.direction,t=[];return e&ge&&t.push(L),e&_e&&t.push(lt),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,a=e.deltaX,o=e.deltaY;return i&t.direction||(t.direction&ge?(i=a===0?de:a<0?fe:pe,n=a!=this.pX,r=Math.abs(e.deltaX)):(i=o===0?de:o<0?me:he,n=o!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return wt.prototype.attrTest.call(this,e)&&(this.state&mt||!(this.state&mt)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=St(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}});function Et(){wt.apply(this,arguments)}_(Et,wt,{defaults:{event:`pinch`,threshold:0,pointers:2},getTouchAction:function(){return[ct]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&mt)},emit:function(e){if(e.scale!==1){var t=e.scale<1?`in`:`out`;e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}});function z(){bt.apply(this,arguments),this._timer=null,this._input=null}_(z,bt,{defaults:{event:`press`,pointers:1,time:251,threshold:9},getTouchAction:function(){return[ot]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime>t.time;if(this._input=e,!r||!n||e.eventType&(P|ue)&&!i)this.reset();else if(e.eventType&ce)this.reset(),this._timer=u(function(){this.state=_t,this.tryEmit()},t.time,this);else if(e.eventType&P)return _t;return yt},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===_t&&(e&&e.eventType&P?this.manager.emit(this.options.event+`up`,e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function Dt(){wt.apply(this,arguments)}_(Dt,wt,{defaults:{event:`rotate`,threshold:0,pointers:2},getTouchAction:function(){return[ct]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&mt)}});function Ot(){wt.apply(this,arguments)}_(Ot,wt,{defaults:{event:`swipe`,threshold:10,velocity:.3,direction:ge|_e,pointers:1},getTouchAction:function(){return Tt.prototype.getTouchAction.call(this)},attrTest:function(e){var t=this.options.direction,n;return t&(ge|_e)?n=e.overallVelocity:t&ge?n=e.overallVelocityX:t&_e&&(n=e.overallVelocityY),this._super.attrTest.call(this,e)&&t&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(n)>this.options.velocity&&e.eventType&P},emit:function(e){var t=St(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}});function kt(){bt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}_(kt,bt,{defaults:{event:`tap`,pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[st]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,i=e.deltaTime<t.time;if(this.reset(),e.eventType&ce&&this.count===0)return this.failTimeout();if(r&&i&&n){if(e.eventType!=P)return this.failTimeout();var a=this.pTime?e.timeStamp-this.pTime<t.interval:!0,o=!this.pCenter||Ae(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!o||!a?this.count=1:this.count+=1,this._input=e,this.count%t.taps===0)return this.hasRequireFailures()?(this._timer=u(function(){this.state=_t,this.tryEmit()},t.interval,this),mt):_t}return yt},failTimeout:function(){return this._timer=u(function(){this.state=yt},this.options.interval,this),yt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==_t&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function B(e,t){return t=t||{},t.recognizers=b(t.recognizers,B.defaults.preset),new Mt(e,t)}B.VERSION=`2.0.7`,B.defaults={domEvents:!1,touchAction:at,enable:!0,inputTarget:null,inputClass:null,preset:[[Dt,{enable:!1}],[Et,{enable:!1},[`rotate`]],[Ot,{direction:ge}],[Tt,{direction:ge},[`swipe`]],[kt],[kt,{event:`doubletap`,taps:2},[`tap`]],[z]],cssProps:{userSelect:`none`,touchSelect:`none`,touchCallout:`none`,contentZooming:`none`,userDrag:`none`,tapHighlightColor:`rgba(0,0,0,0)`}};var At=1,jt=2;function Mt(e,t){this.options=m({},B.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=Se(this),this.touchAction=new R(this,this.options.touchAction),Nt(this,!0),f(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}Mt.prototype={set:function(e){return m(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?jt:At},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var n,r=this.recognizers,i=t.curRecognizer;(!i||i&&i.state&_t)&&(i=t.curRecognizer=null);for(var a=0;a<r.length;)n=r[a],t.stopped!==jt&&(!i||n==i||n.canRecognizeWith(i))?n.recognize(e):n.reset(),!i&&n.state&(mt|ht|gt)&&(i=t.curRecognizer=n),a++}},get:function(e){if(e instanceof bt)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(d(e,`add`,this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(d(e,`remove`,this))return this;if(e=this.get(e),e){var t=this.recognizers,n=E(t,e);n!==-1&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==r&&t!==r){var n=this.handlers;return f(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==r){var n=this.handlers;return f(T(e),function(e){t?n[e]&&n[e].splice(E(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&Pt(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(!(!n||!n.length)){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},destroy:function(){this.element&&Nt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Nt(e,t){var n=e.element;if(n.style){var r;f(e.options.cssProps,function(i,a){r=k(n.style,a),t?(e.oldCssProps[r]=n.style[r],n.style[r]=i):n.style[r]=e.oldCssProps[r]||``}),t||(e.oldCssProps={})}}function Pt(e,n){var r=t.createEvent(`Event`);r.initEvent(e,!0,!0),r.gesture=n,n.target.dispatchEvent(r)}return m(B,{INPUT_START:ce,INPUT_MOVE:le,INPUT_END:P,INPUT_CANCEL:ue,STATE_POSSIBLE:pt,STATE_BEGAN:mt,STATE_CHANGED:ht,STATE_ENDED:gt,STATE_RECOGNIZED:_t,STATE_CANCELLED:vt,STATE_FAILED:yt,DIRECTION_NONE:de,DIRECTION_LEFT:fe,DIRECTION_RIGHT:pe,DIRECTION_UP:me,DIRECTION_DOWN:he,DIRECTION_HORIZONTAL:ge,DIRECTION_VERTICAL:_e,DIRECTION_ALL:ve,Manager:Mt,Input:xe,TouchAction:R,TouchInput:Ye,MouseInput:Ie,PointerEventInput:Ve,TouchMouseInput:$e,SingleTouchInput:Ge,Recognizer:bt,AttrRecognizer:wt,Tap:kt,Pan:Tt,Swipe:Ot,Pinch:Et,Rotate:Dt,Press:z,on:x,off:S,each:f,merge:g,extend:h,assign:m,inherit:_,bindFn:v,prefixed:k}),B})(typeof window<`u`?window:{},typeof document<`u`?document:{},`Hammer`),Ug=class e extends nn{static parseArgs(t){return t instanceof e?t:Object.assign({},t)}static initAnimationEndState(e){var t,n,r,i,a,o,s,c;let l=this.parseArgs(e),{state:u,currentState:d}=l.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=l.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex};return Object.assign(Object.assign({},f),{mode:``,longitude:(i=u.longitude)==null?d.longitude:i,latitude:(a=u.latitude)==null?d.latitude:a,fov:(o=u.fov)==null?d.fov:o,offset:(s=u.offset)==null?d.offset:s,distance:(c=u.distance)==null?d.distance:c})}constructor(t){var n,r,i;super();let a=e.parseArgs(t);this.mode=``,this.pending=new Set,this.userAction=a.initial.userAction,this.destroyed=!1,this.fiveId=a.fiveId,this.scene=a.scene,this.modelScene=a.modelScene,this.xrCustomObjectsScene=a.xrCustomObjectsScene,this.helper=a.helper,this.camera=a.camera,this.renderer=a.renderer,this.viewport=a.viewport,this.element=a.element,this.enableWheel=a.enableWheel,this.works=a.works,this.imageOptions=a.imageOptions,this.videoTexture=a.videoTexture,this.extraElements=a.extraElements,this.initial=a.initial,this.currentPano=typeof this.initial.state.panoIndex==`number`?{workCode:(i=(n=this.initial.state.workCode)==null?(r=a.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:this.initial.state.panoIndex}:{workCode:this.initial.currentState.workCode,panoIndex:this.initial.currentState.panoIndex},this.needsRender=!0,this.cameraMotion=new X({longitude:{value:this.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}),this.inMomentumMovement=null,this.eventUnbinds=[a.element].concat(a.extraElements||[]).map(e=>this.bindEvents(e)),this.initAnimationIsReady=!1,this.pending.add(`init-animation`),this.initAnimationReady=new Promise(e=>{ei.shared.add(()=>{this.initAnimation().then(()=>{this.initAnimationIsReady=!0,this.pending.delete(`init-animation`),e()})},!0,0)})}updateConfiguration(e){return!0}destroy(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(let e of this.eventUnbinds)e();this.panState=void 0,(e=this.pressState)==null||e.stop(),this.pressState=void 0}isReady(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0}bindExtraElement(e){for(let t of this.eventUnbinds)if(t.element===e)return;this.eventUnbinds.push(this.bindEvents(e))}unbindExtraElement(e){let t=[];for(let n of this.eventUnbinds)n.element===e?n():t.push(n);this.eventUnbinds=t}updateModel(e){this.needsRender=!0}updateWork(e,t,n,r){return this.works=e,this.userAction=r,!1}updateTime(e,t,...n){if(this.destroyed)return;let r={};this.cameraMotion.ended&&(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),Ng(r)&&this.setCamera(r)}render(){return!1}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={};return e.longitude!==void 0&&(r.longitude=e.longitude),e.latitude!==void 0&&(r.latitude=e.latitude),e.fov!==void 0&&(r.fov=e.fov),this.cameraMotion.set(r,t).catch(G)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.cameraMotion.setKeyframes(r,t)})}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(V())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})}initAnimation(){let{state:t,currentState:n,duration:r,userAction:i}=this.initial,a=e.initAnimationEndState(this);return this.userAction=i,this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:a,userAction:this.userAction})),this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:a,userAction:this.userAction})),Promise.resolve()}setCamera(e={}){var t,n,r,i,a;let o=(t=e.longitude)==null?this.camera.pose.longitude:t,s=(n=e.latitude)==null?this.camera.pose.latitude:n,c=(r=e.fov)==null?this.camera.pose.fov:r,l=(i=e.distance)==null?this.camera.pose.distance:i,u=(a=e.offset)==null?this.camera.pose.offset:a,d=gg(o,this.camera.pose.longitude,Math.PI*2)||gg(s,this.camera.pose.latitude),f=gg(c,this.camera.pose.fov),p=gg(l,this.camera.pose.distance),m=vg(u,this.camera.pose.offset);(f||d||m||p)&&(this.camera.setFromPose({longitude:o,latitude:s,fov:c,distance:l,offset:u}),this.emit(`camera.update`,Q(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:s,fov:c,offset:u,distance:l})})),this.needsRender=!0)}stopMomentumMovement(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){let e=Q(`gesture.momentum`,Object.assign(Object.assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit(`gesture.fire`,e),this.emit(`gesture.momentum`,e)}this.inMomentumMovement=null}onPanGesture(e){this.stopMomentumMovement(),this.emit(`gesture.pan`,e)}onTapGesture(e){this.stopMomentumMovement(),this.emit(`gesture.tap`,e)}onDblTapGesture(e){this.stopMomentumMovement(),this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(e.type=`gesture.tap`,this.onTapGesture(e))}onPressGesture(e){this.stopMomentumMovement(),this.emit(`gesture.press`,e)}onPinchGesture(e){this.stopMomentumMovement(),this.emit(`gesture.pinch`,e)}onMouseWheel(e){this.stopMomentumMovement(),this.emit(`gesture.mousewheel`,e)}onMouseMove(e){this.stopMomentumMovement(),this.emit(`gesture.mousemove`,e)}relativeClientPosition(e){let{top:n,left:r,width:i,height:a}=this.element.getBoundingClientRect();return r+=i*this.viewport.left,n+=a*(1-this.viewport.bottom-this.viewport.height),i*=this.viewport.width,a*=this.viewport.height,new t.Vector2((e.x-r)/i*2-1,-(e.y-n)/a*2+1)}createRaycasterFromCamera(e,n){let r=new t.Raycaster;return r.params.Points={threshold:.1},r.firstHitOnly=!0,r.near=n.near,r.far=n.far,r.setFromCamera(e,this.camera),r}bindEvents(e){let n=e=>{let t=this.relativeClientPosition(e);return!(Math.abs(t.x)>1||Math.abs(t.y)>1)},r=e=>({button:`button`in e?e.button:0,buttons:`buttons`in e?e.buttons:0,shiftKey:`shiftKey`in e?e.shiftKey:!1,ctrlKey:`ctrlKey`in e?e.ctrlKey:!1,altKey:`altKey`in e?e.altKey:!1,metaKey:`metaKey`in e?e.metaKey:!1}),i=new Hg.Manager(e),a=e=>e.session.firstInput||null,o=new Hg.Pan({threshold:10,pointers:0}),s=new Hg.Tap({interval:410}),c=new Hg.Pinch({threshold:0,pointers:2});i.add([o,s,c]),i.on(`panstart pan`,e=>{let t=r(e.srcEvent),o=a(i);if(o&&!n(o.center))return;let s=Q(`gesture.pan`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})}),isFirst:e.isFirst||e.type==`panstart`,isFinal:e.isFinal,scale:e.scale,center:(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onPanGesture(s),v()}),i.on(`tap`,e=>{let t=r(e.srcEvent);if(e.pointerType===`mouse`&&t.button!==0)return;let o=a(i);if(o&&!n(o.center))return;let s=Q(`gesture.tap`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})}),isFirst:!0,isFinal:!0,scale:e.scale,center:(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onTapGesture(s),v()}),i.on(`pinchstart pinch pinchend`,e=>{let o=r(e.srcEvent),s=a(i);if(s&&!n(s.center))return;let c=Q(`gesture.pinch`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{var n;let r=this.relativeClientPosition(e),i=new t.Raycaster;return i.params.Points={threshold:.1},i.setFromCamera(r,this.camera),Object.assign(Object.assign({x:e.x,y:e.y,delta:(n=e.delta)==null?0:n},o),{coords:r,raycaster:i})}),isFirst:e.type===`pinchstart`,isFinal:e.type===`pinchend`,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},o),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,c),this.onPinchGesture(c),v()}),i.on(`dbltap`,e=>{let t=r(e.srcEvent);if(e.pointerType===`mouse`&&t.button!==0)return;let o=a(i);if(o&&!n(o.center))return;let s=Q(`gesture.dbltap`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})}),isFirst:!0,isFinal:!0,scale:e.scale,center:(e=>{let n=this.relativeClientPosition(e),r=this.createRaycasterFromCamera(n,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},t),{coords:n,raycaster:r})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,s),this.onDblTapGesture(s),v()});let l=null,u=null,d=(e,t,n)=>{let i={x:n.clientX,y:n.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),r(n)),{delta:0}),c=e===`pinchend`?t:t-n.deltaY/280;return Q(`gesture.pinch`,{target:n.target,pointerType:`mouse`,srcEvent:n,pointers:[Object.assign({},s)],isFirst:e===`pinchstart`,isFinal:e===`pinchend`,scale:H(c,.1,10),center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))})},f=e=>{var t;if(n({x:e.clientX,y:e.clientY})){if(e.preventDefault(),e.ctrlKey){let n=(t=l==null?void 0:l.prevEvent.scale)==null?1:t,r=d(l?`pinch`:`pinchstart`,n,e);this.emit(`gesture.fire`,r),l===null?l={firstEvent:r,prevEvent:r}:l.prevEvent=r,this.emit(`gesture.fire`,r),this.onPinchGesture(r),u!==null&&window.clearTimeout(u),u=window.setTimeout(()=>{var t;u=null;let n=d(`pinchend`,(t=l==null?void 0:l.prevEvent.scale)==null?1:t,e);this.emit(`gesture.fire`,n),l=null,this.onPinchGesture(n)},200)}else{let t=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,n=this.mouseWheelState!==void 0,i={x:e.clientX,y:e.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),r(e)),{delta:t}),c=Q(`gesture.mousewheel`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},s)],isFirst:n,isFinal:!1,scale:0,center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,c),this.onMouseWheel(c),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:setTimeout(()=>{this.mouseWheelState=void 0;let t=Q(`gesture.mousewheel`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign(Object.assign({},s),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:Object.assign(Object.assign({},s),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,t),this.onMouseWheel(t)},100)}}v()}},p=e=>{if(Sg)return;if(!n({x:e.clientX,y:e.clientY})){m();return}let t=!1;this.mouseMoveState||(t=!0);let i={x:e.clientX,y:e.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),r(e)),{delta:0}),c=Q(`gesture.mousemove`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},s)],isFirst:t,isFinal:!1,scale:0,center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,c),this.mouseMoveState={timeStamp:V(),event:c},this.onMouseMove(c),this.pressState&&Math.abs(e.clientX-this.pressState.event.center.y)>10&&Math.abs(e.clientY-this.pressState.event.center.y)>10&&v()},m=()=>{if(this.mouseMoveState){let e=Q(this.mouseMoveState.event.type,Object.assign(Object.assign({},this.mouseMoveState.event),{isFinal:!0}));this.emit(`gesture.fire`,e),this.mouseMoveState=void 0,this.onMouseMove(e)}v()},h=e=>{if(!n(e.center)){v();return}let t=!1;this.pressState||(t=!0,this.pressState={event:e,timeStamp:V(),stop:G});let r=V()-this.pressState.timeStamp,i=Q(this.pressState.event.type,Object.assign(Object.assign({},this.pressState.event),{isFirst:t,isFinal:!1,center:Object.assign(Object.assign({},this.pressState.event.center),{delta:r}),pointers:this.pressState.event.pointers.map(e=>Object.assign(Object.assign({},e),{delta:r}))}));this.emit(`gesture.fire`,i),this.onPressGesture(i),this.pressState&&(this.pressState.stop=ei.shared.add(t=>{h(e)},!0,1))},g=e=>{if(v(),e.touches.length>1||e.changedTouches.length<=0)return;let t={x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY},n=this.relativeClientPosition(t),i=this.createRaycasterFromCamera(n,this.camera),a=Object.assign(Object.assign(Object.assign(Object.assign({},t),{coords:n,raycaster:i}),r(e)),{delta:0}),o=Q(`gesture.press`,{target:e.target,pointerType:`touch`,srcEvent:e,pointers:[Object.assign({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,o),h(o)},_=e=>{v();let t={x:e.clientX,y:e.clientY},n=this.relativeClientPosition(t),i=this.createRaycasterFromCamera(n,this.camera),a=Object.assign(Object.assign(Object.assign(Object.assign({},t),{coords:n,raycaster:i}),r(e)),{delta:0}),o=Q(`gesture.press`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))});this.emit(`gesture.fire`,o),h(o)},v=()=>{var e;if(this.pressState){let t=V()-this.pressState.timeStamp,n=Q(this.pressState.event.type,Object.assign(Object.assign({},this.pressState.event),{center:Object.assign(Object.assign({},this.pressState.event.center),{delta:t}),isFirst:!1,isFinal:!0,pointers:this.pressState.event.pointers.map(e=>Object.assign(Object.assign({},e),{delta:t}))}));this.emit(`gesture.fire`,n),this.onPressGesture(n),(e=this.pressState)==null||e.stop(),this.pressState=void 0}},y=null,b=e=>{var t,n,i;let a=!1,o=!1;switch(e.type){case`gesturestart`:a=!0;break;case`gestureend`:o=!0;break;default:break}let s={x:(t=e.clientX)==null?0:t,y:(n=e.clientY)==null?0:n},c=this.relativeClientPosition(s),l=this.createRaycasterFromCamera(c,this.camera),u=Object.assign(Object.assign(Object.assign(Object.assign({},s),{coords:c,raycaster:l}),r(e)),{delta:0});return Q(`gesture.pinch`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},u)],isFirst:a,isFinal:o,scale:(i=e.scale)==null?1:i,center:Object.assign({},u),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),$(this.camera.pose))})},x=e=>{if(e.preventDefault(),Sg)return;let t=b(e);this.emit(`gesture.fire`,t),y={firstEvent:t};let r=y.firstEvent;r&&!n(r.center)||this.onPinchGesture(t)},S=e=>{if(e.preventDefault(),Sg||!y)return;let t=y.firstEvent;if(t&&!n(t.center))return;let r=b(e);this.emit(`gesture.fire`,r),this.onPinchGesture(r)},C=e=>{if(e.preventDefault(),Sg||!y)return;let t=y.firstEvent;if(y=null,t&&!n(t.center))return;let r=b(e);this.emit(`gesture.fire`,r),this.onPinchGesture(r)},w=t=>{if(t&&typeof t.preventDefault==`function`&&t.currentTarget===e&&t.preventDefault(),typeof getSelection==`function`){let e=getSelection();e&&e.focusNode&&(e.removeAllRanges&&e.removeAllRanges(),e.empty&&e.empty())}};return this.enableWheel&&e.addEventListener(`wheel`,f,{passive:!1}),e.addEventListener(`mousemove`,p,!1),e.addEventListener(`mouseout`,m,!1),e.addEventListener(`touchstart`,g,{passive:!0}),e.addEventListener(`touchend`,v,!1),e.addEventListener(`touchcancel`,v,!1),e.addEventListener(`mousedown`,_,!1),e.addEventListener(`mouseup`,v,!1),e.addEventListener(`gesturestart`,x,{passive:!1}),e.addEventListener(`gesturechange`,S,{passive:!1}),e.addEventListener(`gestureend`,C,{passive:!1}),e.addEventListener(`touchstart`,w,{passive:!1}),e.addEventListener(`contextmenu`,w,!1),Object.assign(()=>{i.destroy(),e.removeEventListener(`wheel`,f,!1),e.removeEventListener(`mousemove`,p,!1),e.removeEventListener(`mouseout`,m,!1),e.removeEventListener(`touchstart`,g,!1),e.removeEventListener(`touchend`,v,!1),e.removeEventListener(`touchcancel`,v,!1),e.removeEventListener(`mousedown`,_,!1),e.removeEventListener(`mouseup`,v,!1),e.removeEventListener(`gesturestart`,x,!1),e.removeEventListener(`gesturechange`,S,!1),e.removeEventListener(`gestureend`,C,!1),e.removeEventListener(`touchstart`,w,!1),e.removeEventListener(`contextmenu`,w,!1)},{element:e})}},Wg=new t.CircleBufferGeometry(.1,16),Gg=new t.ShaderMaterial({vertexShader:`
|
|
2104
2104
|
varying vec2 vUv;
|
|
2105
2105
|
#include <common>
|
|
2106
2106
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -2133,7 +2133,7 @@ void main() {
|
|
|
2133
2133
|
|
|
2134
2134
|
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * outside * inside);
|
|
2135
2135
|
}
|
|
2136
|
-
`,side:t.DoubleSide,blending:t.CustomBlending,blendSrc:t.SrcAlphaFactor,blendDst:t.OneMinusSrcAlphaFactor,blendSrcAlpha:t.OneFactor,blendDstAlpha:t.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0}),Wg=class extends t.Object3D{constructor(){super(),this.ringMesh=new t.Mesh(Hg,Ug),this.ringMesh.position.z=.01,this.ringMesh.renderOrder=9999999999,this.add(this.ringMesh)}dispose(){this.remove(this.ringMesh)}};function Gg(e){if(e instanceof Error)return e;let t=typeof e;return Error(t&&t===`object`?JSON.stringify(e):e)}var Kg=new t.Box3,qg=new t.Vector3,Jg={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultFov:80,maxFov:120,minFov:20,maxLatitude:Math.PI/2,minLatitude:-Math.PI/2,intersectMeshCreator:()=>new Wg},Yg=class e extends Vg{static distanceFromModel(e,t,n){let r=e.boundingBox,i=r.isEmpty()?10:Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),1/2);i=isNaN(i)||!isFinite(i)?1:i;let a=i/2/Math.tan(Math.PI*t/360);return n<1&&(a/=n),isNaN(a)||!isFinite(a)?i:a}static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{defaultLongitude:(n=t.defaultLongitude)==null?Jg.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?Jg.defaultLatitude:r,defaultFov:(i=t.defaultFov)==null?Jg.defaultFov:i,maxFov:(a=t.maxFov)==null?Jg.maxFov:a,minFov:(o=t.minFov)==null?Jg.minFov:o,maxLatitude:(s=t.maxLatitude)==null?Jg.maxLatitude:s,minLatitude:(c=t.minLatitude)==null?Jg.minLatitude:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?Jg.intersectMeshCreator:l})}static initAnimationEndState(n){var r,i,a,o,s,c,l;let u=this.parseArgs(n),{state:d,currentState:f}=n.initial,p=typeof d.panoIndex==`number`?{workCode:(a=(r=d.workCode)==null?(i=u.works[0])==null?void 0:i.workCode:r)==null?``:a,panoIndex:d.panoIndex}:{workCode:f.workCode,panoIndex:f.panoIndex},m=(o=d.fov)==null?u.defaultFov:o,h=(s=d.longitude)==null?kg(f.mode)?f.longitude:u.defaultLongitude:s,g=H(typeof u.minLatitude==`function`?u.minLatitude(m):u.minLatitude,-Math.PI/2,Math.PI/2),_=H(typeof u.maxLatitude==`function`?u.maxLatitude(m):u.maxLatitude,-Math.PI/2,Math.PI/2),v=H((c=d.latitude)==null?f.mode===`Floorplan`?f.latitude:u.defaultLatitude:c,g,_),y=d.offset?d.offset.clone():n.modelScene.boundingBox.getCenter(new t.Vector3),b=(l=d.distance)==null?e.distanceFromModel(u.modelScene,u.defaultFov,u.camera.aspect):l;return Object.assign(Object.assign({},p),{mode:`Floorplan`,longitude:h,latitude:v,fov:m,offset:y,distance:b})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Floorplan`,this.defaultLongitude=n.defaultLongitude,this.defaultLatitude=n.defaultLatitude,this.defaultFov=n.defaultFov,this.maxFov=n.maxFov,this.minFov=n.minFov,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.pendingTextureId=null,this.textureLoader=new fi,this.intersectMeshCreator=n.intersectMeshCreator,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return!0}destroy(){super.destroy(),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(e,t,n,r){var i;return this.works=e,this.updateCamera(t,(i=n.duration)==null?0:i,r),!0}updateModel(n){super.updateModel(n);let r=n.boundingBox.getCenter(new t.Vector3),i=e.distanceFromModel(n,this.defaultFov,this.camera.aspect);this.updateCamera({offset:r,distance:i},0,!0)}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(G),this.cameraMotion.set(i,t).catch(G)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(G),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,n,...r){if(this.destroyed)return;let i={},a={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),i.progress=1,i.pano0=i.pano1=t}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended||(this.locationMotion.update(e),a.distance=this.locationMotion.value.distance,a.offset=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),a.longitude=this.cameraMotion.value.longitude,a.latitude=this.cameraMotion.value.latitude,a.fov=this.cameraMotion.value.fov),jg(i)||this.modelScene.parameter.set(i),jg(a)||this.setCamera(a),this.intersectMesh&&this.intersectMesh.parent){let e=H(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)}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(V())[1],n=this.locationMotion.getKeyFrameSegment(V())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new t.Vector3(n.value.x,n.value.y,n.value.z),distance:n.value.distance})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s=dr(o,[`longitude`,`latitude`,`fov`]),c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(G),this.perspToOrthoMotion.set({perspToOrtho:0},i).catch(G),this.cameraMotion.set(s,i).catch(G),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}updateRenderSize(e){this.needsRender=!0}getForwardObserverOrNot(e){let[t]=this.modelScene.intersectRaycaster(e);if(!t)return null;let n=[];for(let t of this.works){let r=this.modelScene.models.find(e=>e.work===t);if(!(!r||r.visible===!1)&&!(t.observers.length<=0)&&(Kg.copy(t.observerBox).expandByScalar(10).applyMatrix4(t.transform),Kg.containsPoint(e.ray.origin)||e.ray.intersectsBox(Kg)))for(let e of t.observers)n.push(e)}let[r,i]=vu(n,e=>qg.copy(e.standingPosition).applyMatrix4(e.work.transform).distanceTo(t.point),!0);return r&&i<Math.max(r.standingPosition.distanceTo(this.camera.position)/5,10)?r:null}coordinatesForOffset(e){let n=this.renderer.getSize(new t.Vector2);return{longitude:-2*e.x/(n.x*this.viewport.width),latitude:2*e.y/(n.y*this.viewport.height)}}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.998,a.longitude+=i.longitude,a.latitude+=i.latitude;let o=Ft(this.cameraMotion.value.longitude+a.longitude),s=this.cameraMotion.value.fov,c=H(typeof this.minLatitude==`function`?this.minLatitude(s):this.minLatitude,-Math.PI/2,Math.PI/2),l=H(typeof this.maxLatitude==`function`?this.maxLatitude(s):this.maxLatitude,-Math.PI/2,Math.PI/2),u=H(this.cameraMotion.value.latitude+a.latitude,c,l),d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:u,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),f=!(i.longitude>1e-4||i.longitude<-1e-4||i.latitude>1e-4||i.latitude<-1e-4),p=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:f,state:d}));if(this.emit(`gesture.fire`,p),this.inMomentumMovement.event=p,this.emit(`gesture.momentum`,p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:o,latitude:u},0).catch(G),f?this.inMomentumMovement=null:ei.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n){this.emit(`gesture.pan`,e);return}let r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.relativeClientPosition(e.center),a=1,o=this.camera.pose.latitude;Math.abs(o)>Math.PI/6&&(a=o<0?i.y<0?-1:1:i.y>0?-1:1),r.x*=a;let s=this.coordinatesForOffset(r),c=Ft(this.cameraMotion.value.longitude+s.longitude),l=this.camera.pose.fov,u=H(typeof this.minLatitude==`function`?this.minLatitude(l):this.minLatitude,-Math.PI/2,Math.PI/2),d=H(typeof this.maxLatitude==`function`?this.maxLatitude(l):this.maxLatitude,-Math.PI/2,Math.PI/2),f=H(this.cameraMotion.value.latitude+s.latitude,u,d);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(f=this.cameraMotion.value.latitude);let p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:l,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=p,this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}if(!(e.isFinal&&t.defaultPrevented)&&(this.cameraMotion.set({longitude:p.longitude,latitude:p.latitude},0).catch(G),e.isFinal)){let t=e.velocityX*a,n=e.velocityY;this.inMomentumMovement={uuid:Zt()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:t,y:n}),0)}}onPinchGesture(e){var t;if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.panState=void 0,this.pinchState=void 0),n===void 0)return;let r=H(n/e.scale,this.minFov,this.maxFov),i=H(typeof this.minLatitude==`function`?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),a=H(typeof this.maxLatitude==`function`?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),o=H(this.cameraMotion.value.latitude,i,a);e.state.fov=r,e.state.latitude=o,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r,latitude:o},0).catch(G),this.onPanGesture(e))}onMouseMove(e){var n,r;if(!this.intersectMesh.parent||this.panState)return;if(this.emit(`gesture.mousemove`,e),e.defaultPrevented){this.hideIntersectMesh();return}let i=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}let[a]=this.modelScene.intersectRaycaster(i),o=Q(`intersect.update`,{raycaster:i,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}if(a){let e=(r=(n=a.face)==null?void 0:n.normal)==null?new t.Vector3().copy(i.ray.direction).multiplyScalar(-1):r,o=e.clone(),s=a.point.clone();this.intersectMesh.position.copy(s);let c=s.clone().add(o);if(this.intersectMesh.lookAt(c),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(s);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onMouseWheel(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let{minFov:t,maxFov:n}=this,r=H(this.camera.fov-e.center.delta,t,n),i=H(typeof this.minLatitude==`function`?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),a=H(typeof this.maxLatitude==`function`?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),o=H(this.cameraMotion.value.latitude,i,a);e.state.fov=r,e.state.latitude=o,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&this.cameraMotion.set({fov:r,latitude:o},0).catch(G)}onTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let n=e.center.raycaster,r=this.getForwardObserverOrNot(n);if(!r)this.emit(`gesture.tap`,e);else{let n={longitude:this.camera.pose.longitude,latitude:0},i=Object.assign(Object.assign({},e.state),{mode:`Panorama`,workCode:r.work.workCode,panoIndex:r.panoIndex,longitude:n.longitude,latitude:n.latitude,offset:r?r.position.clone():new t.Vector3,distance:0});if(e.state=i,this.emit(`gesture.tap`,e),!e.defaultPrevented&&(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},state:i,userAction:e.userAction,options:n,progress:0,error:null})),r&&r.active)){let e=this.pendingTextureId=Zt(),a={panoIndex:r.panoIndex,workCode:r.work.workCode},o=Z(a),s={right:r.images.work.getURL(r.images.right),left:r.images.work.getURL(r.images.left),up:r.images.work.getURL(r.images.up),down:r.images.work.getURL(r.images.down),front:r.images.work.getURL(r.images.front),back:r.images.work.getURL(r.images.back)},c=this.imageOptions.transform,l=Object.assign({key:`pano.${o}`},dr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),u=`pano:`+Lp([s,l,c]),d=this.modelScene.parameter,f=Sg(`pano.prepare`,{options:n,prevMode:this.mode,prevPano:this.currentPano,pano:a});if(this.emit(`pano.prepare`,f),f.defaultPrevented){this.pendingTextureId=null;return}f.options!==n&&Object.assign(n,f.options);let p;d.pano0&&d.pano0.map.name===u?p=d.pano0:d.pano1&&d.pano1.map.name===u&&(p=d.pano1),p?Promise.resolve().then(()=>Cg(f)).catch(e=>Gg(e)).then(e=>{var t;e instanceof Error?(this.pendingTextureId=null,e.message&&this.emit(`error`,e)):(d.pano0&&d.pano0.map!==p.map&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==p.map&&d.pano1.map!==((t=d.pano0)==null?void 0:t.map)&&d.pano1.map.dispose(),d.set({pano0:p,pano1:p}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},progress:0,state:i,options:n,error:null})))}):Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:a}))}).then(()=>this.textureLoader.loadCubeTexture(s,{imageURL:{transform:c,options:l},format:t.RGBFormat,viaAjax:!0,fetcher:Kf(this.fiveId,r.work)},void 0,void 0,void 0,this.renderer)).catch(e=>{let t=Gg(e);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:t,progress:0,meta:null,pano:a})),t}),Promise.resolve().then(()=>Cg(f)).catch(e=>Gg(e))]).then(([a,s])=>{var c,l;if(!(a instanceof Error)&&!(s instanceof Error)){let{body:s}=a;if(this.destroyed||this.pendingTextureId!==e){s.dispose();return}this.pendingTextureId=null,s.name=u;let f=Array.isArray(s.image)?s.image[0]:s.image,p=(c=f==null?void 0:f.width)==null?2048:c,m=r.images.histogram;m||(m=new Bm().formPixels(zg(this.renderer,s,!0,Im).data),r.images.histogram=m);let h={panoId:o,map:s,mapSize:p,mapHistogram:new t.Vector4().fromArray(m.toArray()),matrix:r.matrix.clone().premultiply(r.work.transform),zoom:1};d.pano0&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==((l=d.pano0)==null?void 0:l.map)&&d.pano1.map.dispose(),d.set({pano0:h,pano1:h}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},progress:0,state:i,options:n,error:null}))}else{let t=null;if(a instanceof Error?t||(t=a):a.body.dispose(),s instanceof Error&&(t||(t=s)),this.destroyed||this.pendingTextureId!==e)return;this.pendingTextureId=null,t instanceof Error&&t.message&&this.emit(`error`,t)}})}}}onDblTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.cameraMotion.value.fov,n=this.minFov-t<t-this.defaultFov?this.minFov:this.defaultFov;e.state.fov=n,this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:n},360).catch(G),this.hideIntersectMesh())}hideIntersectMesh(){this.intersectMesh.visible=!1,this.needsRender=!0}},Xg=Object.assign(Object.assign({},fr(Jg,[`defaultLongitude`,`defaultLatitude`,`maxLatitude`,`minLatitude`])),{defaultLongitude:0,defaultLatitude:Math.PI/2}),Zg=class e extends Yg{static parseArgs(t){var n,r;if(t instanceof e)return t;let i=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2,defaultLongitude:(n=t.defaultLongitude)==null?Xg.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?Xg.defaultLatitude:r});return super.parseArgs(i)}static initAnimationEndState(e){var t,n;let r=this.parseArgs(e),i=super.initAnimationEndState(Object.assign(Object.assign({},r),{initial:Object.assign(Object.assign({},r.initial),{state:Object.assign(Object.assign({},r.initial.state),{longitude:(t=r.initial.state.longitude)==null?r.defaultLongitude:t,latitude:(n=r.initial.state.latitude)==null?r.defaultLatitude:n})})}));return Object.assign(Object.assign({},i),{mode:`Topview`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Topview`}updateConfiguration(e){return super.updateConfiguration(Object.assign({},e))}updateModel(e){this.needsRender=!0;let n=this.modelScene.boundingBox.getCenter(new t.Vector3);this.locationMotion.set({x:n.x,y:n.y,z:n.z,distance:Yg.distanceFromModel(this.modelScene,this.defaultFov,this.camera.aspect)},0).catch(G),this.hideIntersectMesh()}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(G),this.cameraMotion.set(i,t).catch(G)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.y,z:t.value.offset.z}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(G),this.cameraMotion.setKeyframes(e,t)})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={longitude:o.longitude,latitude:o.latitude,fov:o.fov},c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(G),this.perspToOrthoMotion.set({perspToOrtho:1},i).catch(G),this.cameraMotion.set(s,i).catch(G),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}requestMomentumMovement(){this.inMomentumMovement=null}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let n=this.panState,r=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:r,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},n===void 0||n.pointerLength!==r){this.emit(`gesture.pan`,e);return}let i={x:e.center.x-n.x,y:e.center.y-n.y},a=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),o=this.locationMotion.value.distance;o*=Math.tan(this.cameraMotion.value.fov/2*Math.PI/180);let s=this.renderer.getSize(new t.Vector2),c=2*i.x*o/s.y,l=2*i.y*o/s.y,u=new t.Vector3;u.setFromMatrixColumn(this.camera.matrix,0),u.multiplyScalar(-c),a.add(u),u.setFromMatrixColumn(this.camera.matrix,1),u.multiplyScalar(l),a.add(u);let d=this.modelScene.boundingBox.getCenter(new t.Vector3),f=this.modelScene.boundingBox.getSize(new t.Vector3),p=Math.max(f.x,f.y,f.z)/2;if(a.clamp(d.clone().sub(new t.Vector3().setScalar(p)),d.clone().add(new t.Vector3().setScalar(p))),e.state=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:a,distance:this.locationMotion.value.distance}),this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}e.isFinal&&n.defaultPrevented||this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(G)}onPinchGesture(e){var t;if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.pinchState=void 0),n===void 0)return;let r=H(n/e.scale,this.minFov,this.maxFov);e.state.fov=r,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r},0).catch(G),e.type=`gesture.pan`,this.onPanGesture(e))}onMouseWheel(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let t=H(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov);e.state.fov=t,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&this.cameraMotion.set({fov:t},0).catch(G)}},Qg={defaultLatitude:0,defaultFov:90,maxFov:120,minFov:20,maxLatitude:e=>Math.PI/2-e/2/180*Math.PI,minLatitude:e=>-Math.PI/2+e/2/180*Math.PI,moveSpeed:3.6,intersectMeshCreator:()=>new Wg,aerialObserverMinHeight:5},$g=class e extends Vg{static parseArgs(t){var n,r,i,a,o,s,c,l,u;if(t instanceof e)return t;let d=super.parseArgs(t);return Object.assign(Object.assign({},d),{defaultLatitude:(n=t.defaultLatitude)==null?Qg.defaultLatitude:n,defaultFov:(r=t.defaultFov)==null?Qg.defaultFov:r,maxFov:(i=t.maxFov)==null?Qg.maxFov:i,minFov:(a=t.minFov)==null?Qg.minFov:a,maxLatitude:(o=t.maxLatitude)==null?Qg.maxLatitude:o,minLatitude:(s=t.minLatitude)==null?Qg.minLatitude:s,moveSpeed:(c=t.moveSpeed)==null?Qg.moveSpeed:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?Qg.intersectMeshCreator:l,aerialObserverMinHeight:(u=t.aerialObserverMinHeight)==null?Qg.aerialObserverMinHeight:u})}static initAnimationEndState(e){var n,r,i,a,o,s;let c=this.parseArgs(e),l=c.works,{state:u,currentState:d}=e.initial,f=typeof u.panoIndex==`number`?{workCode:(i=(n=u.workCode)==null?(r=c.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex},p=l.getObserver(f),m=H((a=u.fov)==null?Ag(d.mode)?d.fov:c.defaultFov:a,c.minFov,c.maxFov),h=(o=u.longitude)==null?d.longitude:o,g=H(typeof c.minLatitude==`function`?c.minLatitude(m):c.minLatitude,-Math.PI/2,Math.PI/2),_=H(typeof c.maxLatitude==`function`?c.maxLatitude(m):c.maxLatitude,-Math.PI/2,Math.PI/2),v=H((s=u.latitude)==null?Ag(d.mode)?d.latitude:c.defaultLatitude:s,g,_),y=new t.Vector3;return p&&y.copy(p.position).applyMatrix4(p.work.transform),{workCode:f.workCode,panoIndex:f.panoIndex,mode:`PanoramaLike`,longitude:h,latitude:v,fov:m,offset:y,distance:0}}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`PanoramaLike`,this.defaultLatitude=n.defaultLatitude,this.defaultFov=n.defaultFov,this.maxFov=n.maxFov,this.minFov=n.minFov,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.moveSpeed=n.moveSpeed,this.intersectMeshCreator=n.intersectMeshCreator,this.aerialObserverMinHeight=n.aerialObserverMinHeight,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.moveSpeed!==void 0&&this.moveSpeed!==e.moveSpeed&&(this.moveSpeed=e.moveSpeed),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return e.aerialObserverMinHeight!==void 0&&this.aerialObserverMinHeight!==e.aerialObserverMinHeight&&(this.aerialObserverMinHeight=e.aerialObserverMinHeight),!0}destroy(){super.destroy(),this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),this.panState=void 0}isReady(){return this.panState||this.pinchState?!1:super.isReady()}calculateMovingDuration(e,t){switch(typeof e){case`function`:return e(t,this.moveSpeed);case`number`:return e;case`string`:return Number(e);default:return H(t,2,5)/this.moveSpeed*1e3}}hideIntersectMesh(){this.intersectMesh.visible=!1,this.needsRender=!0}coordinatesForOffset(e){let n=this.cameraMotion.value.fov,r=this.camera.aspect,i=this.renderer.getSize(new t.Vector2);return{longitude:2*e.x/(i.x*this.viewport.width)*n/95*r,latitude:-2*e.y/(i.y*this.viewport.height)*n/95}}cameraBounce(){let{longitude:e,latitude:t,fov:n}=this.cameraMotion.value,r=[{progress:0,value:{longitude:e,latitude:t,fov:n}},{progress:.5,value:{longitude:e,latitude:t,fov:n*.98}},{progress:1,value:{longitude:e,latitude:t,fov:n}}];this.cameraMotion.setKeyframes(r,500).catch(G)}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.99,a.longitude+=i.longitude,a.latitude+=i.latitude;let o=this.cameraMotion.value.fov,s=Ft(this.cameraMotion.value.longitude+a.longitude),c=H(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),l=H(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),u=H(this.cameraMotion.value.latitude+a.latitude,c,l),d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:s,latitude:u,fov:o,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),f=!(i.longitude>1e-4||i.longitude<-1e-4||i.latitude>1e-4||i.latitude<-1e-4),p=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:f,state:d}));if(this.emit(`gesture.fire`,p),this.inMomentumMovement.event=p,this.emit(`gesture.momentum`,p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:s,latitude:u},0).catch(G),f?this.inMomentumMovement=null:ei.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n){this.emit(`gesture.pan`,e);return}let r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.coordinatesForOffset(r),a=Ft(this.cameraMotion.value.longitude+i.longitude),o=this.cameraMotion.value.fov,s=H(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),c=H(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),l=H(this.cameraMotion.value.latitude+i.latitude,s,c);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(l=this.cameraMotion.value.latitude);let u=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:a,latitude:l,fov:o,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=u,this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}if(e.isFinal&&t.defaultPrevented)return;let d={longitude:u.longitude,latitude:u.latitude,fov:u.fov};if(this.cameraMotion.set(d,0).catch(G),e.isFinal){let t=e.velocityX,n=e.velocityY*.6;Math.abs(n)>.5&&Math.abs(t)<.5&&(t=0),this.inMomentumMovement={uuid:Zt()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:t,y:n}),0)}}onPinchGesture(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov,r=e.scale;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.pinchState=void 0),n===void 0)return;let i=H(n/r,this.minFov,this.maxFov),a=H(typeof this.minLatitude==`function`?this.minLatitude(i):this.minLatitude,-Math.PI/2,Math.PI/2),o=H(typeof this.maxLatitude==`function`?this.maxLatitude(i):this.maxLatitude,-Math.PI/2,Math.PI/2),s=H(this.cameraMotion.value.latitude,a,o);e.state.fov=i,e.state.latitude=s,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:i,latitude:s},0).catch(G),e.type=`gesture.pan`,this.onPanGesture(e))}onMouseWheel(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=H(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov),n=H(typeof this.minLatitude==`function`?this.minLatitude(t):this.minLatitude,-Math.PI/2,Math.PI/2),r=H(typeof this.maxLatitude==`function`?this.maxLatitude(t):this.maxLatitude,-Math.PI/2,Math.PI/2),i=H(this.cameraMotion.value.latitude,n,r);e.state.fov=t,e.state.latitude=i,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:t,latitude:i},0).catch(G),this.onMouseMove(e))}onMouseMove(e){var n,r;if(!this.intersectMesh.parent||this.panState||(this.emit(`gesture.mousemove`,e),e.defaultPrevented))return;let i=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent){this.hideIntersectMesh();return}i.floorIndex=-1;let[a]=this.modelScene.intersectRaycaster(i),o=Q(`intersect.update`,{raycaster:i,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}if(a){let e=(r=(n=a.face)==null?void 0:n.normal)==null?new t.Vector3().copy(i.ray.direction).multiplyScalar(-1):r,o=e.clone(),s=a.point.clone();this.intersectMesh.position.copy(s);let c=s.clone().add(o);if(this.intersectMesh.lookAt(c),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(s);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onDblTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.cameraMotion.value.fov,n=2,r=this.works.getObserver(this.currentPano);if(r){let e=r.images.tiles;e&&e.length&&(n=Math.max(...e.map(e=>e.level)))}let i=Math.max(40-n*5,this.minFov,5),a=i-t<t-this.defaultFov?i:this.defaultFov;e.state.fov=a,this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:a},360).catch(G),this.hideIntersectMesh())}},e_=`data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4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AAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw`,t_;function n_(){return t_||(t_=new Promise(e=>{let t,n=document.createElement(`video`);n.muted=!0,n.src=e_,n.addEventListener(`timeupdate`,function r(){n.removeEventListener(`timeupdate`,r,!1),clearTimeout(t);let i=document.createElement(`canvas`);i.width=i.height=1;let a=i.getContext(`2d`);if(!a){e(!1);return}a.drawImage(n,0,0,1,1);let{data:o}=a.getImageData(0,0,1,1);o[3]>10?e(!0):e(!1)},!1),n.addEventListener(`canplay`,function e(){n.removeEventListener(`canplay`,e,!1),n.play()},!1),t=window.setTimeout(()=>e(!1),1e3)}))}var r_=[`right`,`left`,`up`,`down`,`front`,`back`];function i_(e,n,r,i){let a=new t.Box3;switch(e){case`up`:a.min.y=.5,a.max.y=.5,a.min.x=n-.5,a.max.x=n-.5+i,a.min.z=-r+.5-i,a.max.z=-r+.5;break;case`down`:a.min.y=-.5,a.max.y=-.5,a.min.x=n-.5,a.max.x=n-.5+i,a.min.z=r-.5,a.max.z=r-.5+i;break;case`left`:a.min.x=-.5,a.max.x=-.5,a.min.z=-n+.5-i,a.max.z=-n+.5,a.min.y=-r+.5-i,a.max.y=-r+.5;break;case`right`:a.min.x=.5,a.max.x=.5,a.min.z=n-.5,a.max.z=n-.5+i,a.min.y=-r+.5-i,a.max.y=-r+.5;break;case`front`:a.min.z=-.5,a.max.z=-.5,a.min.x=n-.5,a.max.x=n-.5+i,a.min.y=-r+.5-i,a.max.y=-r+.5;break;case`back`:a.min.z=.5,a.max.z=.5,a.min.x=-n+.5-i,a.max.x=-n+.5,a.min.y=-r+.5-i,a.max.y=-r+.5;break;default:break}return a.applyMatrix4(new t.Matrix4().makeRotationY(Math.PI))}var a_=(e,n)=>{if(e.level>=n)return;let r=e.level+1,i=e.size/2,a=[new t.Vector2(e.position.x,e.position.y),new t.Vector2(e.position.x+i,e.position.y),new t.Vector2(e.position.x,e.position.y+i),new t.Vector2(e.position.x+i,e.position.y+i)];for(let t of a){let a={face:e.face,level:r,size:i,position:t,box:i_(e.face,t.x,t.y,i),parent:e,children:[]};e.children.push(a),a_(a,n)}};function o_(e,n){let r={level:0,face:e,position:new t.Vector2(0,0),size:1,box:i_(e,0,0,1),parent:null,children:[]};return a_(r,n),r}function s_(e){return{children:r_.map(t=>o_(t,e)),maxLevel:e}}function c_(e,t){for(let n of e.children)t(n)!==!1&&c_(n,t)}var l_,u_=new t.Vector3,d_=new t.Quaternion,f_=new t.Matrix4,p_=new t.Matrix4,m_=new t.Matrix4,h_=new t.Matrix4,g_=new t.Matrix4,__=new t.Quaternion,v_=new t.Matrix4,y_=new t.Color(0,0,0),b_=0,x_=new t.Color,S_=[],C_=(l_=Math.SQRT1_2)==null?Math.sqrt(2):l_,w_={up:new t.Quaternion(C_,0,0,C_),down:new t.Quaternion(-C_,0,0,C_),left:new t.Quaternion(0,C_,0,C_),right:new t.Quaternion(0,-C_,0,C_),front:new t.Quaternion(0,0,0,1),back:new t.Quaternion(0,1,0,0)},T_=(()=>{let e=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint32Array([0,1,2,1,3,2]),i=new t.BufferGeometry;return i.setAttribute(`position`,new t.BufferAttribute(e,3)),i.setAttribute(`uv`,new t.BufferAttribute(n,2)),i.setIndex(new t.BufferAttribute(r,1)),i.computeBoundingBox(),i})(),E_=`
|
|
2136
|
+
`,side:t.DoubleSide,blending:t.CustomBlending,blendSrc:t.SrcAlphaFactor,blendDst:t.OneMinusSrcAlphaFactor,blendSrcAlpha:t.OneFactor,blendDstAlpha:t.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0}),Kg=class extends t.Object3D{constructor(){super(),this.ringMesh=new t.Mesh(Wg,Gg),this.ringMesh.position.z=.01,this.ringMesh.renderOrder=9999999999,this.add(this.ringMesh)}dispose(){this.remove(this.ringMesh)}};function qg(e){if(e instanceof Error)return e;let t=typeof e;return Error(t&&t===`object`?JSON.stringify(e):e)}var Jg=new t.Box3,Yg=new t.Vector3,Xg={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultFov:80,maxFov:120,minFov:20,maxLatitude:Math.PI/2,minLatitude:-Math.PI/2,intersectMeshCreator:()=>new Kg},Zg=class e extends Ug{static distanceFromModel(e,t,n){let r=e.boundingBox,i=r.isEmpty()?10:Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),1/2);i=isNaN(i)||!isFinite(i)?1:i;let a=i/2/Math.tan(Math.PI*t/360);return n<1&&(a/=n),isNaN(a)||!isFinite(a)?i:a}static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{defaultLongitude:(n=t.defaultLongitude)==null?Xg.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?Xg.defaultLatitude:r,defaultFov:(i=t.defaultFov)==null?Xg.defaultFov:i,maxFov:(a=t.maxFov)==null?Xg.maxFov:a,minFov:(o=t.minFov)==null?Xg.minFov:o,maxLatitude:(s=t.maxLatitude)==null?Xg.maxLatitude:s,minLatitude:(c=t.minLatitude)==null?Xg.minLatitude:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?Xg.intersectMeshCreator:l})}static initAnimationEndState(n){var r,i,a,o,s,c,l;let u=this.parseArgs(n),{state:d,currentState:f}=n.initial,p=typeof d.panoIndex==`number`?{workCode:(a=(r=d.workCode)==null?(i=u.works[0])==null?void 0:i.workCode:r)==null?``:a,panoIndex:d.panoIndex}:{workCode:f.workCode,panoIndex:f.panoIndex},m=(o=d.fov)==null?u.defaultFov:o,h=(s=d.longitude)==null?jg(f.mode)?f.longitude:u.defaultLongitude:s,g=H(typeof u.minLatitude==`function`?u.minLatitude(m):u.minLatitude,-Math.PI/2,Math.PI/2),_=H(typeof u.maxLatitude==`function`?u.maxLatitude(m):u.maxLatitude,-Math.PI/2,Math.PI/2),v=H((c=d.latitude)==null?f.mode===`Floorplan`?f.latitude:u.defaultLatitude:c,g,_),y=d.offset?d.offset.clone():n.modelScene.boundingBox.getCenter(new t.Vector3),b=(l=d.distance)==null?e.distanceFromModel(u.modelScene,u.defaultFov,u.camera.aspect):l;return Object.assign(Object.assign({},p),{mode:`Floorplan`,longitude:h,latitude:v,fov:m,offset:y,distance:b})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Floorplan`,this.defaultLongitude=n.defaultLongitude,this.defaultLatitude=n.defaultLatitude,this.defaultFov=n.defaultFov,this.maxFov=n.maxFov,this.minFov=n.minFov,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.pendingTextureId=null,this.textureLoader=new fi,this.intersectMeshCreator=n.intersectMeshCreator,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return!0}destroy(){super.destroy(),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(e,t,n,r){var i;return this.works=e,this.updateCamera(t,(i=n.duration)==null?0:i,r),!0}updateModel(n){super.updateModel(n);let r=n.boundingBox.getCenter(new t.Vector3),i=e.distanceFromModel(n,this.defaultFov,this.camera.aspect);this.updateCamera({offset:r,distance:i},0,!0)}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(G),this.cameraMotion.set(i,t).catch(G)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(G),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,n,...r){if(this.destroyed)return;let i={},a={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),i.progress=1,i.pano0=i.pano1=t}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended||(this.locationMotion.update(e),a.distance=this.locationMotion.value.distance,a.offset=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),a.longitude=this.cameraMotion.value.longitude,a.latitude=this.cameraMotion.value.latitude,a.fov=this.cameraMotion.value.fov),Ng(i)||this.modelScene.parameter.set(i),Ng(a)||this.setCamera(a),this.intersectMesh&&this.intersectMesh.parent){let e=H(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)}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(V())[1],n=this.locationMotion.getKeyFrameSegment(V())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new t.Vector3(n.value.x,n.value.y,n.value.z),distance:n.value.distance})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s=dr(o,[`longitude`,`latitude`,`fov`]),c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(G),this.perspToOrthoMotion.set({perspToOrtho:0},i).catch(G),this.cameraMotion.set(s,i).catch(G),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}updateRenderSize(e){this.needsRender=!0}getForwardObserverOrNot(e){let[t]=this.modelScene.intersectRaycaster(e);if(!t)return null;let n=[];for(let t of this.works){let r=this.modelScene.models.find(e=>e.work===t);if(!(!r||r.visible===!1)&&!(t.observers.length<=0)&&(Jg.copy(t.observerBox).expandByScalar(10).applyMatrix4(t.transform),Jg.containsPoint(e.ray.origin)||e.ray.intersectsBox(Jg)))for(let e of t.observers)n.push(e)}let[r,i]=vu(n,e=>Yg.copy(e.standingPosition).applyMatrix4(e.work.transform).distanceTo(t.point),!0);return r&&i<Math.max(r.standingPosition.distanceTo(this.camera.position)/5,10)?r:null}coordinatesForOffset(e){let n=this.renderer.getSize(new t.Vector2);return{longitude:-2*e.x/(n.x*this.viewport.width),latitude:2*e.y/(n.y*this.viewport.height)}}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.998,a.longitude+=i.longitude,a.latitude+=i.latitude;let o=Ft(this.cameraMotion.value.longitude+a.longitude),s=this.cameraMotion.value.fov,c=H(typeof this.minLatitude==`function`?this.minLatitude(s):this.minLatitude,-Math.PI/2,Math.PI/2),l=H(typeof this.maxLatitude==`function`?this.maxLatitude(s):this.maxLatitude,-Math.PI/2,Math.PI/2),u=H(this.cameraMotion.value.latitude+a.latitude,c,l),d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:u,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),f=!(i.longitude>1e-4||i.longitude<-1e-4||i.latitude>1e-4||i.latitude<-1e-4),p=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:f,state:d}));if(this.emit(`gesture.fire`,p),this.inMomentumMovement.event=p,this.emit(`gesture.momentum`,p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:o,latitude:u},0).catch(G),f?this.inMomentumMovement=null:ei.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n){this.emit(`gesture.pan`,e);return}let r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.relativeClientPosition(e.center),a=1,o=this.camera.pose.latitude;Math.abs(o)>Math.PI/6&&(a=o<0?i.y<0?-1:1:i.y>0?-1:1),r.x*=a;let s=this.coordinatesForOffset(r),c=Ft(this.cameraMotion.value.longitude+s.longitude),l=this.camera.pose.fov,u=H(typeof this.minLatitude==`function`?this.minLatitude(l):this.minLatitude,-Math.PI/2,Math.PI/2),d=H(typeof this.maxLatitude==`function`?this.maxLatitude(l):this.maxLatitude,-Math.PI/2,Math.PI/2),f=H(this.cameraMotion.value.latitude+s.latitude,u,d);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(f=this.cameraMotion.value.latitude);let p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:l,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=p,this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}if(!(e.isFinal&&t.defaultPrevented)&&(this.cameraMotion.set({longitude:p.longitude,latitude:p.latitude},0).catch(G),e.isFinal)){let t=e.velocityX*a,n=e.velocityY;this.inMomentumMovement={uuid:Zt()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:t,y:n}),0)}}onPinchGesture(e){var t;if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.panState=void 0,this.pinchState=void 0),n===void 0)return;let r=H(n/e.scale,this.minFov,this.maxFov),i=H(typeof this.minLatitude==`function`?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),a=H(typeof this.maxLatitude==`function`?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),o=H(this.cameraMotion.value.latitude,i,a);e.state.fov=r,e.state.latitude=o,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r,latitude:o},0).catch(G),this.onPanGesture(e))}onMouseMove(e){var n,r;if(!this.intersectMesh.parent||this.panState)return;if(this.emit(`gesture.mousemove`,e),e.defaultPrevented){this.hideIntersectMesh();return}let i=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}let[a]=this.modelScene.intersectRaycaster(i),o=Q(`intersect.update`,{raycaster:i,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}if(a){let e=(r=(n=a.face)==null?void 0:n.normal)==null?new t.Vector3().copy(i.ray.direction).multiplyScalar(-1):r,o=e.clone(),s=a.point.clone();this.intersectMesh.position.copy(s);let c=s.clone().add(o);if(this.intersectMesh.lookAt(c),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(s);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onMouseWheel(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let{minFov:t,maxFov:n}=this,r=H(this.camera.fov-e.center.delta,t,n),i=H(typeof this.minLatitude==`function`?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),a=H(typeof this.maxLatitude==`function`?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),o=H(this.cameraMotion.value.latitude,i,a);e.state.fov=r,e.state.latitude=o,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&this.cameraMotion.set({fov:r,latitude:o},0).catch(G)}onTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let n=e.center.raycaster,r=this.getForwardObserverOrNot(n);if(!r)this.emit(`gesture.tap`,e);else{let n={longitude:this.camera.pose.longitude,latitude:0},i=Object.assign(Object.assign({},e.state),{mode:`Panorama`,workCode:r.work.workCode,panoIndex:r.panoIndex,longitude:n.longitude,latitude:n.latitude,offset:r?r.position.clone():new t.Vector3,distance:0});if(e.state=i,this.emit(`gesture.tap`,e),!e.defaultPrevented&&(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},state:i,userAction:e.userAction,options:n,progress:0,error:null})),r&&r.active)){let e=this.pendingTextureId=Zt(),a={panoIndex:r.panoIndex,workCode:r.work.workCode},o=Z(a),s={right:r.images.work.getURL(r.images.right),left:r.images.work.getURL(r.images.left),up:r.images.work.getURL(r.images.up),down:r.images.work.getURL(r.images.down),front:r.images.work.getURL(r.images.front),back:r.images.work.getURL(r.images.back)},c=this.imageOptions.transform,l=Object.assign({key:`pano.${o}`},dr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),u=`pano:`+Lp([s,l,c]),d=this.modelScene.parameter,f=wg(`pano.prepare`,{options:n,prevMode:this.mode,prevPano:this.currentPano,pano:a});if(this.emit(`pano.prepare`,f),f.defaultPrevented){this.pendingTextureId=null;return}f.options!==n&&Object.assign(n,f.options);let p;d.pano0&&d.pano0.map.name===u?p=d.pano0:d.pano1&&d.pano1.map.name===u&&(p=d.pano1),p?Promise.resolve().then(()=>Tg(f)).catch(e=>qg(e)).then(e=>{var t;e instanceof Error?(this.pendingTextureId=null,e.message&&this.emit(`error`,e)):(d.pano0&&d.pano0.map!==p.map&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==p.map&&d.pano1.map!==((t=d.pano0)==null?void 0:t.map)&&d.pano1.map.dispose(),d.set({pano0:p,pano1:p}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},progress:0,state:i,options:n,error:null})))}):Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:a}))}).then(()=>this.textureLoader.loadCubeTexture(s,{imageURL:{transform:c,options:l},format:t.RGBFormat,viaAjax:!0,fetcher:Kf(this.fiveId,r.work)},void 0,void 0,void 0,this.renderer)).catch(e=>{let t=qg(e);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:t,progress:0,meta:null,pano:a})),t}),Promise.resolve().then(()=>Tg(f)).catch(e=>qg(e))]).then(([a,s])=>{var c,l;if(!(a instanceof Error)&&!(s instanceof Error)){let{body:s}=a;if(this.destroyed||this.pendingTextureId!==e){s.dispose();return}this.pendingTextureId=null,s.name=u;let f=Array.isArray(s.image)?s.image[0]:s.image,p=(c=f==null?void 0:f.width)==null?2048:c,m=r.images.histogram;m||(m=new Hm().formPixels(Vg(this.renderer,s,!0,Rm).data),r.images.histogram=m);let h={panoId:o,map:s,mapSize:p,mapHistogram:new t.Vector4().fromArray(m.toArray()),matrix:r.matrix.clone().premultiply(r.work.transform),zoom:1};d.pano0&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==((l=d.pano0)==null?void 0:l.map)&&d.pano1.map.dispose(),d.set({pano0:h,pano1:h}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},progress:0,state:i,options:n,error:null}))}else{let t=null;if(a instanceof Error?t||(t=a):a.body.dispose(),s instanceof Error&&(t||(t=s)),this.destroyed||this.pendingTextureId!==e)return;this.pendingTextureId=null,t instanceof Error&&t.message&&this.emit(`error`,t)}})}}}onDblTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.cameraMotion.value.fov,n=this.minFov-t<t-this.defaultFov?this.minFov:this.defaultFov;e.state.fov=n,this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:n},360).catch(G),this.hideIntersectMesh())}hideIntersectMesh(){this.intersectMesh.visible=!1,this.needsRender=!0}},Qg=Object.assign(Object.assign({},fr(Xg,[`defaultLongitude`,`defaultLatitude`,`maxLatitude`,`minLatitude`])),{defaultLongitude:0,defaultLatitude:Math.PI/2}),$g=class e extends Zg{static parseArgs(t){var n,r;if(t instanceof e)return t;let i=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2,defaultLongitude:(n=t.defaultLongitude)==null?Qg.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?Qg.defaultLatitude:r});return super.parseArgs(i)}static initAnimationEndState(e){var t,n;let r=this.parseArgs(e),i=super.initAnimationEndState(Object.assign(Object.assign({},r),{initial:Object.assign(Object.assign({},r.initial),{state:Object.assign(Object.assign({},r.initial.state),{longitude:(t=r.initial.state.longitude)==null?r.defaultLongitude:t,latitude:(n=r.initial.state.latitude)==null?r.defaultLatitude:n})})}));return Object.assign(Object.assign({},i),{mode:`Topview`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Topview`}updateConfiguration(e){return super.updateConfiguration(Object.assign({},e))}updateModel(e){this.needsRender=!0;let n=this.modelScene.boundingBox.getCenter(new t.Vector3);this.locationMotion.set({x:n.x,y:n.y,z:n.z,distance:Zg.distanceFromModel(this.modelScene,this.defaultFov,this.camera.aspect)},0).catch(G),this.hideIntersectMesh()}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(G),this.cameraMotion.set(i,t).catch(G)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.y,z:t.value.offset.z}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(G),this.cameraMotion.setKeyframes(e,t)})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={longitude:o.longitude,latitude:o.latitude,fov:o.fov},c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(G),this.perspToOrthoMotion.set({perspToOrtho:1},i).catch(G),this.cameraMotion.set(s,i).catch(G),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}requestMomentumMovement(){this.inMomentumMovement=null}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let n=this.panState,r=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:r,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},n===void 0||n.pointerLength!==r){this.emit(`gesture.pan`,e);return}let i={x:e.center.x-n.x,y:e.center.y-n.y},a=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),o=this.locationMotion.value.distance;o*=Math.tan(this.cameraMotion.value.fov/2*Math.PI/180);let s=this.renderer.getSize(new t.Vector2),c=2*i.x*o/s.y,l=2*i.y*o/s.y,u=new t.Vector3;u.setFromMatrixColumn(this.camera.matrix,0),u.multiplyScalar(-c),a.add(u),u.setFromMatrixColumn(this.camera.matrix,1),u.multiplyScalar(l),a.add(u);let d=this.modelScene.boundingBox.getCenter(new t.Vector3),f=this.modelScene.boundingBox.getSize(new t.Vector3),p=Math.max(f.x,f.y,f.z)/2;if(a.clamp(d.clone().sub(new t.Vector3().setScalar(p)),d.clone().add(new t.Vector3().setScalar(p))),e.state=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:a,distance:this.locationMotion.value.distance}),this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}e.isFinal&&n.defaultPrevented||this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(G)}onPinchGesture(e){var t;if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.pinchState=void 0),n===void 0)return;let r=H(n/e.scale,this.minFov,this.maxFov);e.state.fov=r,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r},0).catch(G),e.type=`gesture.pan`,this.onPanGesture(e))}onMouseWheel(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let t=H(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov);e.state.fov=t,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&this.cameraMotion.set({fov:t},0).catch(G)}},e_={defaultLatitude:0,defaultFov:90,maxFov:120,minFov:20,maxLatitude:e=>Math.PI/2-e/2/180*Math.PI,minLatitude:e=>-Math.PI/2+e/2/180*Math.PI,moveSpeed:3.6,intersectMeshCreator:()=>new Kg,aerialObserverMinHeight:5},t_=class e extends Ug{static parseArgs(t){var n,r,i,a,o,s,c,l,u;if(t instanceof e)return t;let d=super.parseArgs(t);return Object.assign(Object.assign({},d),{defaultLatitude:(n=t.defaultLatitude)==null?e_.defaultLatitude:n,defaultFov:(r=t.defaultFov)==null?e_.defaultFov:r,maxFov:(i=t.maxFov)==null?e_.maxFov:i,minFov:(a=t.minFov)==null?e_.minFov:a,maxLatitude:(o=t.maxLatitude)==null?e_.maxLatitude:o,minLatitude:(s=t.minLatitude)==null?e_.minLatitude:s,moveSpeed:(c=t.moveSpeed)==null?e_.moveSpeed:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?e_.intersectMeshCreator:l,aerialObserverMinHeight:(u=t.aerialObserverMinHeight)==null?e_.aerialObserverMinHeight:u})}static initAnimationEndState(e){var n,r,i,a,o,s;let c=this.parseArgs(e),l=c.works,{state:u,currentState:d}=e.initial,f=typeof u.panoIndex==`number`?{workCode:(i=(n=u.workCode)==null?(r=c.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex},p=l.getObserver(f),m=H((a=u.fov)==null?Mg(d.mode)?d.fov:c.defaultFov:a,c.minFov,c.maxFov),h=(o=u.longitude)==null?d.longitude:o,g=H(typeof c.minLatitude==`function`?c.minLatitude(m):c.minLatitude,-Math.PI/2,Math.PI/2),_=H(typeof c.maxLatitude==`function`?c.maxLatitude(m):c.maxLatitude,-Math.PI/2,Math.PI/2),v=H((s=u.latitude)==null?Mg(d.mode)?d.latitude:c.defaultLatitude:s,g,_),y=new t.Vector3;return p&&y.copy(p.position).applyMatrix4(p.work.transform),{workCode:f.workCode,panoIndex:f.panoIndex,mode:`PanoramaLike`,longitude:h,latitude:v,fov:m,offset:y,distance:0}}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`PanoramaLike`,this.defaultLatitude=n.defaultLatitude,this.defaultFov=n.defaultFov,this.maxFov=n.maxFov,this.minFov=n.minFov,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.moveSpeed=n.moveSpeed,this.intersectMeshCreator=n.intersectMeshCreator,this.aerialObserverMinHeight=n.aerialObserverMinHeight,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.moveSpeed!==void 0&&this.moveSpeed!==e.moveSpeed&&(this.moveSpeed=e.moveSpeed),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return e.aerialObserverMinHeight!==void 0&&this.aerialObserverMinHeight!==e.aerialObserverMinHeight&&(this.aerialObserverMinHeight=e.aerialObserverMinHeight),!0}destroy(){super.destroy(),this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),this.panState=void 0}isReady(){return this.panState||this.pinchState?!1:super.isReady()}calculateMovingDuration(e,t){switch(typeof e){case`function`:return e(t,this.moveSpeed);case`number`:return e;case`string`:return Number(e);default:return H(t,2,5)/this.moveSpeed*1e3}}hideIntersectMesh(){this.intersectMesh.visible=!1,this.needsRender=!0}coordinatesForOffset(e){let n=this.cameraMotion.value.fov,r=this.camera.aspect,i=this.renderer.getSize(new t.Vector2);return{longitude:2*e.x/(i.x*this.viewport.width)*n/95*r,latitude:-2*e.y/(i.y*this.viewport.height)*n/95}}cameraBounce(){let{longitude:e,latitude:t,fov:n}=this.cameraMotion.value,r=[{progress:0,value:{longitude:e,latitude:t,fov:n}},{progress:.5,value:{longitude:e,latitude:t,fov:n*.98}},{progress:1,value:{longitude:e,latitude:t,fov:n}}];this.cameraMotion.setKeyframes(r,500).catch(G)}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.99,a.longitude+=i.longitude,a.latitude+=i.latitude;let o=this.cameraMotion.value.fov,s=Ft(this.cameraMotion.value.longitude+a.longitude),c=H(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),l=H(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),u=H(this.cameraMotion.value.latitude+a.latitude,c,l),d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:s,latitude:u,fov:o,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),f=!(i.longitude>1e-4||i.longitude<-1e-4||i.latitude>1e-4||i.latitude<-1e-4),p=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:f,state:d}));if(this.emit(`gesture.fire`,p),this.inMomentumMovement.event=p,this.emit(`gesture.momentum`,p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:s,latitude:u},0).catch(G),f?this.inMomentumMovement=null:ei.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,defaultPrevented:e.defaultPrevented,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n){this.emit(`gesture.pan`,e);return}let r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.coordinatesForOffset(r),a=Ft(this.cameraMotion.value.longitude+i.longitude),o=this.cameraMotion.value.fov,s=H(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),c=H(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),l=H(this.cameraMotion.value.latitude+i.latitude,s,c);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(l=this.cameraMotion.value.latitude);let u=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:a,latitude:l,fov:o,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=u,this.emit(`gesture.pan`,e),e.defaultPrevented){this.panState&&(this.panState.defaultPrevented=e.defaultPrevented);return}if(e.isFinal&&t.defaultPrevented)return;let d={longitude:u.longitude,latitude:u.latitude,fov:u.fov};if(this.cameraMotion.set(d,0).catch(G),e.isFinal){let t=e.velocityX,n=e.velocityY*.6;Math.abs(n)>.5&&Math.abs(t)<.5&&(t=0),this.inMomentumMovement={uuid:Zt()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:t,y:n}),0)}}onPinchGesture(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov,r=e.scale;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.pinchState=void 0),n===void 0)return;let i=H(n/r,this.minFov,this.maxFov),a=H(typeof this.minLatitude==`function`?this.minLatitude(i):this.minLatitude,-Math.PI/2,Math.PI/2),o=H(typeof this.maxLatitude==`function`?this.maxLatitude(i):this.maxLatitude,-Math.PI/2,Math.PI/2),s=H(this.cameraMotion.value.latitude,a,o);e.state.fov=i,e.state.latitude=s,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:i,latitude:s},0).catch(G),e.type=`gesture.pan`,this.onPanGesture(e))}onMouseWheel(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=H(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov),n=H(typeof this.minLatitude==`function`?this.minLatitude(t):this.minLatitude,-Math.PI/2,Math.PI/2),r=H(typeof this.maxLatitude==`function`?this.maxLatitude(t):this.maxLatitude,-Math.PI/2,Math.PI/2),i=H(this.cameraMotion.value.latitude,n,r);e.state.fov=t,e.state.latitude=i,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:t,latitude:i},0).catch(G),this.onMouseMove(e))}onMouseMove(e){var n,r;if(!this.intersectMesh.parent||this.panState||(this.emit(`gesture.mousemove`,e),e.defaultPrevented))return;let i=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent){this.hideIntersectMesh();return}i.floorIndex=-1;let[a]=this.modelScene.intersectRaycaster(i),o=Q(`intersect.update`,{raycaster:i,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}if(a){let e=(r=(n=a.face)==null?void 0:n.normal)==null?new t.Vector3().copy(i.ray.direction).multiplyScalar(-1):r,o=e.clone(),s=a.point.clone();this.intersectMesh.position.copy(s);let c=s.clone().add(o);if(this.intersectMesh.lookAt(c),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(s);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onDblTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.cameraMotion.value.fov,n=2,r=this.works.getObserver(this.currentPano);if(r){let e=r.images.tiles;e&&e.length&&(n=Math.max(...e.map(e=>e.level)))}let i=Math.max(40-n*5,this.minFov,5),a=i-t<t-this.defaultFov?i:this.defaultFov;e.state.fov=a,this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:a},360).catch(G),this.hideIntersectMesh())}},n_=`data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTI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AAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw`,r_;function i_(){return r_||(r_=new Promise(e=>{let t,n=document.createElement(`video`);n.muted=!0,n.src=n_,n.addEventListener(`timeupdate`,function r(){n.removeEventListener(`timeupdate`,r,!1),clearTimeout(t);let i=document.createElement(`canvas`);i.width=i.height=1;let a=i.getContext(`2d`);if(!a){e(!1);return}a.drawImage(n,0,0,1,1);let{data:o}=a.getImageData(0,0,1,1);o[3]>10?e(!0):e(!1)},!1),n.addEventListener(`canplay`,function e(){n.removeEventListener(`canplay`,e,!1),n.play()},!1),t=window.setTimeout(()=>e(!1),1e3)}))}var a_=[`right`,`left`,`up`,`down`,`front`,`back`];function o_(e,n,r,i){let a=new t.Box3;switch(e){case`up`:a.min.y=.5,a.max.y=.5,a.min.x=n-.5,a.max.x=n-.5+i,a.min.z=-r+.5-i,a.max.z=-r+.5;break;case`down`:a.min.y=-.5,a.max.y=-.5,a.min.x=n-.5,a.max.x=n-.5+i,a.min.z=r-.5,a.max.z=r-.5+i;break;case`left`:a.min.x=-.5,a.max.x=-.5,a.min.z=-n+.5-i,a.max.z=-n+.5,a.min.y=-r+.5-i,a.max.y=-r+.5;break;case`right`:a.min.x=.5,a.max.x=.5,a.min.z=n-.5,a.max.z=n-.5+i,a.min.y=-r+.5-i,a.max.y=-r+.5;break;case`front`:a.min.z=-.5,a.max.z=-.5,a.min.x=n-.5,a.max.x=n-.5+i,a.min.y=-r+.5-i,a.max.y=-r+.5;break;case`back`:a.min.z=.5,a.max.z=.5,a.min.x=-n+.5-i,a.max.x=-n+.5,a.min.y=-r+.5-i,a.max.y=-r+.5;break;default:break}return a.applyMatrix4(new t.Matrix4().makeRotationY(Math.PI))}var s_=(e,n)=>{if(e.level>=n)return;let r=e.level+1,i=e.size/2,a=[new t.Vector2(e.position.x,e.position.y),new t.Vector2(e.position.x+i,e.position.y),new t.Vector2(e.position.x,e.position.y+i),new t.Vector2(e.position.x+i,e.position.y+i)];for(let t of a){let a={face:e.face,level:r,size:i,position:t,box:o_(e.face,t.x,t.y,i),parent:e,children:[]};e.children.push(a),s_(a,n)}};function c_(e,n){let r={level:0,face:e,position:new t.Vector2(0,0),size:1,box:o_(e,0,0,1),parent:null,children:[]};return s_(r,n),r}function l_(e){return{children:a_.map(t=>c_(t,e)),maxLevel:e}}function u_(e,t){for(let n of e.children)t(n)!==!1&&u_(n,t)}var d_,f_=new t.Vector3,p_=new t.Quaternion,m_=new t.Matrix4,h_=new t.Matrix4,g_=new t.Matrix4,__=new t.Matrix4,v_=new t.Matrix4,y_=new t.Quaternion,b_=new t.Matrix4,x_=new t.Color(0,0,0),S_=0,C_=new t.Color,w_=[],T_=(d_=Math.SQRT1_2)==null?Math.sqrt(2):d_,E_={up:new t.Quaternion(T_,0,0,T_),down:new t.Quaternion(-T_,0,0,T_),left:new t.Quaternion(0,T_,0,T_),right:new t.Quaternion(0,-T_,0,T_),front:new t.Quaternion(0,0,0,1),back:new t.Quaternion(0,1,0,0)},D_=(()=>{let e=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),n=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint32Array([0,1,2,1,3,2]),i=new t.BufferGeometry;return i.setAttribute(`position`,new t.BufferAttribute(e,3)),i.setAttribute(`uv`,new t.BufferAttribute(n,2)),i.setIndex(new t.BufferAttribute(r,1)),i.computeBoundingBox(),i})(),O_=`
|
|
2137
2137
|
varying vec2 vUV;
|
|
2138
2138
|
void main() {
|
|
2139
2139
|
vUV = uv;
|
|
@@ -2142,7 +2142,7 @@ void main() {
|
|
|
2142
2142
|
#endif
|
|
2143
2143
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
2144
2144
|
}
|
|
2145
|
-
`,
|
|
2145
|
+
`,k_=`
|
|
2146
2146
|
uniform sampler2D map;
|
|
2147
2147
|
uniform float opacity;
|
|
2148
2148
|
varying vec2 vUV;
|
|
@@ -2150,14 +2150,14 @@ void main() {
|
|
|
2150
2150
|
gl_FragColor = texture2D(map, vUV);
|
|
2151
2151
|
gl_FragColor.a = gl_FragColor.a * opacity;
|
|
2152
2152
|
}
|
|
2153
|
-
`,
|
|
2153
|
+
`,A_=class extends t.ShaderMaterial{constructor(){super({defines:{USE_FLIP_Y:!0},uniforms:{map:{value:null},opacity:{value:1},level:{value:-1}},vertexShader:O_,fragmentShader:k_,depthTest:!0,depthWrite:!0}),B(this,`flipY`,{get(){return this.defines.USE_FLIP_Y},set(e){this.defines.USE_FLIP_Y!==e&&(this.defines.USE_FLIP_Y=e,this.needsUpdate=!0)}}),B(this,`map`,{get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}}),B(this,`opacity`,{get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}}),B(this,`level`,{get(){return this.uniforms.level.value},set(e){this.uniforms.level.value=e}})}},j_=class extends t.Mesh{constructor(e,n){super(D_,new A_),this.disposed=!1,e.box.getCenter(this.position),this.quaternion.multiplyQuaternions(new t.Quaternion().setFromAxisAngle(new t.Vector3(0,1,0),-Math.PI),E_[e.face]),this.scale.setScalar(e.size),this.node=e,this.name=`tiling:tile`,this.material.level=e.level,this.material.visible=!1,this.material.polygonOffset=!0,this.material.polygonOffsetFactor=-e.level,this.material.polygonOffsetUnits=-e.level,this.activeTime=-1,this.frustumCulled=!1,this.renderOrder=e.level,this.appearDuration=0,this.appearMotion=new X({appear:0}),n.then(e=>{this.disposed?e.dispose():(this.material.map=e,this.material.flipY=!!e.flipY,this.material.visible=!0,this.appearMotion.set({appear:1},this.appearDuration*1e3).catch(G))}).catch(G)}updateTime(e){let t=!1;if(this.disposed)return t;this.appearMotion.ended===!1&&this.appearMotion.update(e),this.activeTime=e;let n=Td(this.appearMotion.value.appear);return this.material.opacity!==n&&(this.material.opacity=n,t=!0),this.material.transparent=!0,t}dispose(){this.disposed=!0,this.material.map&&this.material.map.dispose(),this.material.dispose()}},M_=ep(20,20,20);M_.applyMatrix4(new t.Matrix4().makeScale(-1,1,1));var N_=`
|
|
2154
2154
|
varying vec4 vFinalPosition;
|
|
2155
2155
|
|
|
2156
2156
|
void main() {
|
|
2157
2157
|
vFinalPosition = vec4(position, 1.0);
|
|
2158
2158
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
2159
2159
|
}
|
|
2160
|
-
`,
|
|
2160
|
+
`,P_=`
|
|
2161
2161
|
#define FLIP_CUBE_MAP -1.0
|
|
2162
2162
|
uniform samplerCube map;
|
|
2163
2163
|
varying vec4 vFinalPosition;
|
|
@@ -2165,7 +2165,7 @@ void main() {
|
|
|
2165
2165
|
vec3 panoToVertex = normalize(vFinalPosition.xyz);
|
|
2166
2166
|
gl_FragColor = textureCube(map, vec3(FLIP_CUBE_MAP * panoToVertex.x, panoToVertex.yz));
|
|
2167
2167
|
}
|
|
2168
|
-
`,
|
|
2168
|
+
`,F_=class extends t.ShaderMaterial{constructor(){super({defines:{},uniforms:{map:{value:null}},vertexShader:N_,fragmentShader:P_,transparent:!1}),B(this,`map`,{get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}})}},I_=class extends t.Mesh{constructor(){super(M_,new F_),this.disposed=!1,this.frustumCulled=!1,this.renderOrder=9999}update(e,t){if(this.disposed){this.material.map=null,this.material.visible=!1;return}this.material.map=t,this.material.visible=t!==null}dispose(){this.disposed=!0,this.material.dispose()}},L_=class{constructor(e){this.forceRenderWhenNextUpdate=!0,this.fiveId=e.fiveId,this.disposed=!1,this.level=0,this.pedding=0,this.maxRequest=1,this.appearDuration=.5,this.maxCacheTile=48,this.imageOptions={},this.boundingMesh=new I_,this.boundingMesh.frustumCulled=!1,this.textureLoader=new fi,this.observer=null,this.tileTree=l_(0),this.tileMeshes=new Map,this.frustum=new t.Frustum,this.scene=new t.Scene,this.camera=new t.PerspectiveCamera(90,1,.1,100),this.scene.add(this.boundingMesh),this.renderTarget=new t.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1,generateMipmaps:!1,magFilter:t.LinearFilter,minFilter:t.LinearFilter,wrapS:t.ClampToEdgeWrapping,wrapT:t.ClampToEdgeWrapping})}dispose(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.scene.dispose(),this.disposed=!0}cleanup(){this.tileMeshes.forEach(e=>{e.dispose(),this.scene.remove(e)}),this.tileMeshes.clear(),this.forceRenderWhenNextUpdate=!0}setObserver(e){var t,n,r,i;if(this.disposed||this.observer===e)return;this.cleanup(),this.observer=e;let a=(i=(r=(n=(t=this.observer)==null?void 0:t.images.tiles)==null?void 0:n.slice().sort((e,t)=>t.level-e.level)[0])==null?void 0:r.level)==null?0:i;this.tileTree=l_(a)}update(e){let n=this.forceRenderWhenNextUpdate;if(this.disposed)return n;let{time:r,resolution:i,pixelRatio:a,renderer:o,cameraMatrix:s,cameraProjectionMatrix:c,panoMap:l,panoMatrix:u,panoZoom:d,minLevel:f,level:p}=e;if(this.boundingMesh.update(r,l),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),n=!0),!1;this.level=H(p,0,this.tileTree.maxLevel);let m=Math.floor(i.width*a),h=Math.floor(i.height*a),g=Math.max(m,h),_=o.capabilities.maxTextureSize;g>_&&(m=Math.floor(m/g*_),h=Math.floor(h/g*_)),(this.renderTarget.width!==m||this.renderTarget.height!==h)&&this.renderTarget.setSize(m,h),this.scene.matrix.equals(u)||(this.scene.matrix.copy(u),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,n=!0);let v=p_.setFromRotationMatrix(s),y=m_.compose(this.scene.position,v,this.scene.scale);this.camera.matrix.equals(y)||(this.camera.matrix.copy(y),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(v),this.camera.scale.copy(this.scene.scale),n=!0);let b=h_.copy(c);b.elements[0]*=d,b.elements[5]*=d,this.camera.projectionMatrix.equals(b)||(this.camera.projectionMatrix.copy(b),this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix),n=!0),y_.copy(this.scene.quaternion).inverse(),b_.makeRotationFromQuaternion(y_),g_.copy(this.camera.matrix),g_.setPosition(0,0,0),g_.premultiply(b_),__.getInverse(g_),v_.multiplyMatrices(this.camera.projectionMatrix,__),this.frustum.setFromProjectionMatrix(v_);let x=this.frustum.planes[5].normal,S=[];p>=f&&u_(this.tileTree,e=>{if(!(e.level<f)){if(e.level>p||!this.frustum.intersectsBox(e.box))return!1;S.push(e)}});let C=new WeakMap;S.sort((e,t)=>{if(e.level!==t.level)return e.level-t.level;let n=C.get(e);n===void 0&&(n=e.box.getCenter(f_).angleTo(x),C.set(e,n));let r=C.get(t);return r===void 0&&(r=t.box.getCenter(f_).angleTo(x),C.set(t,r)),n-r});let w=new WeakSet,T=this.observer.images.tiles;if(T)for(let e of S){let i=T.find(t=>t.level===e.level);if(!i)continue;w.add(e);let a=this.tileMeshes.get(e);if(a){a.appearDuration=this.appearDuration,a.updateTime(r)&&(n=!0);continue}if(this.pedding>=this.maxRequest)continue;let s=Math.pow(2,e.level)*e.position.y,c=Math.pow(2,e.level)*e.position.x,l=`${Z({panoIndex:this.observer.panoIndex,workCode:this.observer.work.workCode})}.${e.face}.${e.level}.${s}.${c}`,u=i.work.getURL(i[e.face]),d=i.size,f=this.imageOptions.transform,p=Object.assign(Object.assign({},dr(this.imageOptions,[`format`,`sharpen`,`forceUseExifOrientation`,`mappings`])),{key:`pano_tile.${l}`,size:i.scale>=1?void 0:d*e.size*i.scale,cut:e.size===1?void 0:[d*e.position.x,d*e.position.y,d*e.size,d*e.size]});e.level===1&&i.scale>=.5&&(p.format===`jpg`||/\.jpg$/.test(u))&&(p.size=void 0,p.quality||(p.quality=70)),e.size===1&&console.warn(`tile: ${p.key} should not appear.`),this.pedding++;let m=this.textureLoader.loadTexture(u,{imageURL:{transform:f,options:p},minFilter:t.LinearFilter,magFilter:t.LinearFilter,generateMipmaps:!1,fetcher:Kf(this.fiveId,this.observer.work)}).then(e=>e.body);m.then(e=>nf(e,o)).then(e=>(this.pedding--,e),e=>(this.pedding--,Promise.reject(e))),a=new j_(e,m),a.name=`tiling:tile-${l}`,a.visible=!1,a.appearDuration=this.appearDuration,this.tileMeshes.set(e,a),this.scene.add(a),a.updateTime(r),n=!0}let E=[],D=[];this.tileMeshes.forEach((e,t)=>{w.has(t)?E.push(e):D.push(e);let r=t.level>=f&&t.level<=p;e.visible!==r&&(e.visible=r,n=!0)});let O=D.sort((e,t)=>t.activeTime-e.activeTime).slice(Math.max(0,this.maxCacheTile-E.length));for(let e of O)this.tileMeshes.delete(e.node),this.scene.remove(e),e.dispose(),n=!0;if(n){let e=o.getRenderTarget();C_.copy(o.getClearColor());let t=o.getClearAlpha(),n=o.autoClear,r=o.autoClearColor,i=o.autoClearDepth,a=o.autoClearStencil,s=o.clippingPlanes;o.autoClear=!0,o.autoClearColor=!0,o.autoClearDepth=!0,o.autoClearStencil=!0,o.clippingPlanes=w_,o.setRenderTarget(this.renderTarget),o.setClearColor(x_,S_),o.render(this.scene,this.camera),o.setRenderTarget(e),o.setClearColor(C_,t),o.autoClear=n,o.autoClearColor=r,o.autoClearDepth=i,o.autoClearStencil=a,o.clippingPlanes=s}return this.forceRenderWhenNextUpdate=!1,n}},R_=new t.Matrix4().makeRotationAxis(new t.Vector3(0,1,0),Math.PI),z_=ep(2,2,2);z_.applyMatrix4(new t.Matrix4().makeScale(-1,1,1));var B_=`
|
|
2169
2169
|
|
|
2170
2170
|
#if defined(USE_PANO_VIDEO)
|
|
2171
2171
|
varying vec3 worldPosition;
|
|
@@ -2178,7 +2178,7 @@ void main() {
|
|
|
2178
2178
|
#endif
|
|
2179
2179
|
gl_Position = projectionMatrix * modelViewMatrix * transformed;
|
|
2180
2180
|
}
|
|
2181
|
-
`,
|
|
2181
|
+
`,V_=`
|
|
2182
2182
|
#define FLIP_CUBE_MAP -1.0
|
|
2183
2183
|
|
|
2184
2184
|
uniform vec2 size;
|
|
@@ -2213,7 +2213,7 @@ void main() {
|
|
|
2213
2213
|
|
|
2214
2214
|
#endif
|
|
2215
2215
|
}
|
|
2216
|
-
`,
|
|
2216
|
+
`,H_=class{constructor(){this.material=new t.ShaderMaterial({vertexShader:B_,fragmentShader:V_,uniforms:{size:new t.Uniform(new t.Vector2),matrix:new t.Uniform(new t.Matrix4),fixMatrix:new t.Uniform(R_),panoMatrix:new t.Uniform(new t.Matrix4),alpha:new t.Uniform(1),map:new t.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:t.CustomBlending,blendSrc:t.SrcAlphaFactor,blendDst:t.OneMinusSrcAlphaFactor,blendSrcAlpha:t.OneFactor,blendDstAlpha:t.OneMinusSrcAlphaFactor}),this.object=new t.Mesh(z_,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.name=`pano-video`,this.alphaMotion=new X({alpha:0})}setMaterial(e){e?(this.material.uniforms.size.value.copy(e.size),this.material.uniforms.matrix.value.copy(e.matrix),this.material.uniforms.panoMatrix.value.copy(e.panoMatrix),this.material.uniforms.map.value=e.map,this.alphaMotion.set({alpha:e.alpha},500).catch(G)):(this.material.uniforms.size.value.setScalar(0),this.material.uniforms.matrix.value.identity(),this.material.uniforms.panoMatrix.value.identity(),this.material.uniforms.map.value=null,this.material.uniforms.alpha.value=0,this.alphaMotion.set({alpha:0},0).catch(G));let t=e!==null;t!==this.material.defines.USE_PANO_VIDEO&&(this.material.defines.USE_PANO_VIDEO=t,this.material.needsUpdate=!0,this.object.visible=e!==null)}updateTime(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)}dispose(){this.material.dispose()}},U_=new t.Color(0,0,0),W_=new t.Color,G_=new t.ShaderMaterial({vertexShader:`
|
|
2217
2217
|
#include <common>
|
|
2218
2218
|
#include <uv_pars_vertex>
|
|
2219
2219
|
#include <morphtarget_pars_vertex>
|
|
@@ -2280,7 +2280,7 @@ void main() {
|
|
|
2280
2280
|
float cameraDepth = length(cameraVertex);
|
|
2281
2281
|
gl_FragColor = packDepthToRGBA(clamp(cameraDepth / maxDepth, 0.0, 1.0));
|
|
2282
2282
|
}
|
|
2283
|
-
`,uniforms:{maxDepth:new t.Uniform(0)}});function W_(e,t,n,r=1e3){U_.uniforms.maxDepth.value=r,H_.copy(e.getClearColor());let i=e.getClearAlpha(),a=t.overrideMaterial;t.overrideMaterial=U_,e.setClearColor(V_,0),n.update(e,t),e.setClearColor(H_,i),t.overrideMaterial=a}var G_=`fly`,K_=wd,q_=new t.Raycaster,J_=new t.Vector3,Y_=[new t.Vector3(0,0,0).multiplyScalar(.1),new t.Vector3(1,0,0).multiplyScalar(.1),new t.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new t.Vector3(-.5,0,Math.sqrt(3)/2).multiplyScalar(.1)],X_=Object.assign(Object.assign({},Qg),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:(e,t)=>e.position.distanceTo(e.standingPosition)>t.aerialObserverMinHeight?new sg:new ng,adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:((e,t)=>{var n;let r=e=>e/180*Math.PI,i=(n=Math.log2)==null?(e=>Math.log(e)*Math.LOG2E):n,a=t.height/2/Math.tan(r(e/2))*Math.tan(r(45))*2,o=Math.max(i(a/512),0);return o<2.3&&o>.1&&(o=1),o=o%1>.75?Math.ceil(o):Math.floor(o),o}),tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),Z_=class e extends $g{static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{maxAccessibleDistance:(n=t.maxAccessibleDistance)==null?X_.maxAccessibleDistance:n,panoTapTriggerRadius:(r=t.panoTapTriggerRadius)==null?X_.panoTapTriggerRadius:r,panoCircleMeshCreator:(i=t.panoCircleMeshCreator)==null?X_.panoCircleMeshCreator:i,adjustPanoCircleMeshPositionBasedOnModel:(a=t.adjustPanoCircleMeshPositionBasedOnModel)==null?X_.adjustPanoCircleMeshPositionBasedOnModel:a,tileLevelForFov:(o=t.tileLevelForFov)==null?X_.tileLevelForFov:o,tileAppearDuration:(s=t.tileAppearDuration)==null?X_.tileAppearDuration:s,tileMaxRequest:(c=t.tileMaxRequest)==null?X_.tileMaxRequest:c,flyEffectUseDepthBuffer:(l=t.flyEffectUseDepthBuffer)==null?X_.flyEffectUseDepthBuffer:l})}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`Panorama`})}constructor(n){let r=e.parseArgs(n);super(r),this.mode=`Panorama`,this.initAnimationed=!1,this.maxAccessibleDistance=r.maxAccessibleDistance,this.panoTapTriggerRadius=r.panoTapTriggerRadius,this.panoCircleMeshCreator=r.panoCircleMeshCreator,this.adjustPanoCircleMeshPositionBasedOnModel=r.adjustPanoCircleMeshPositionBasedOnModel,this.tileLevelForFov=r.tileLevelForFov,this.tileAppearDuration=r.tileAppearDuration,this.tileMaxRequest=r.tileMaxRequest,this.flyEffectUseDepthBuffer=r.flyEffectUseDepthBuffer,this.adjustPanoCircleMeshPositionFix=new Map;let i=this.modelScene.parameter.resolveValue(`pano0`),a=this.modelScene.parameter.resolveValue(`pano1`);i&&(a==null?void 0:a.map)!==i.map&&(this.modelScene.parameter.set({pano0:a}),i.map.dispose());let o=new Set;i&&o.add(i),a&&o.add(a),this.panoMeshes=new Map,this.locationMotion=new X({count:0,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=Zt()]={panoId:Z(this.currentPano),panoPicture:this.modelScene.parameter.resolveValue(`pano1`),position:this.camera.pose.offset.clone(),effect:G_,effectEasing:K_,fixCameraTransform:new t.Matrix4},this.panoPictureObserverMap=new WeakMap,this.textureLoader=new fi,this.tiling=new F_({fiveId:this.fiveId}),this.panoVideo=new B_,this.scene.add(this.panoVideo.object),this.accessibleObserverFloorCheckCount=0}get tileLevel(){return this.tiling.level}updateConfiguration(e){return super.updateConfiguration(e)===!1?!1:(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,this.panoMeshes&&(this.panoMeshes.forEach(e=>{this.helper.remove(e),e.dispose()}),this.panoMeshes.clear())),e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)}destroy(){super.destroy(),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),this.pendingPanoTask=void 0,this.panoMeshes&&(this.panoMeshes.forEach(e=>{this.helper.remove(e),e.dispose()}),this.panoMeshes.clear());let e=this.videoTexture.image;e.pause(),e.oncanplay=G,e.ontimeupdate=G,this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();let t=this.modelScene.parameter.resolveValue(`pano0`),n=this.modelScene.parameter.resolveValue(`pano1`);for(let e of Object.keys(this.panoResources)){let r=this.panoResources[e];if(r.panoPicture){let e=r.panoPicture.map;e&&e!==(t==null?void 0:t.map)&&e!==(n==null?void 0:n.map)&&(e.dispose(),r.panoPicture=null)}delete this.panoResources[e]}}isReady(){return this.locationMotion.ended===!0?super.isReady():!1}isTileReady(){let e=this.tiling.pedding<=0;return this.initAnimationed&&e}updateWork(t,n,r,i){this.userAction=i,this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));return(a.workCode!==this.currentPano.workCode||a.panoIndex!==this.currentPano.panoIndex||a.longitude!==this.cameraMotion.value.longitude||a.latitude!==this.cameraMotion.value.latitude||a.fov!==this.cameraMotion.value.fov)&&(this.initAnimationed=!1,this.moveToPano({workCode:a.workCode,panoIndex:a.panoIndex},{effect:r.effect,duration:r.duration,longitude:a.longitude,latitude:a.latitude,fov:a.fov,moveEndCallback:()=>{this.initAnimationed=!0},moveCancelCallback:()=>{this.initAnimationed=!0}},i)),!0}updateModel(e){this.modelScene=e,this.hideIntersectMesh()}updateTime(e,n,...r){var i,a,o,s,c,l;if(this.destroyed)return;let u={},d={},f=this.camera.getDirection(new t.Vector3),p=this.locationMotion.keyframes[0],m=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[h,g]=this.locationMotion.getKeyFrameSegment(e),_=this.panoResourceFromLocationMotionKeyframe(h),v=this.panoResourceFromLocationMotionKeyframe(g),y=this.panoResourceFromLocationMotionKeyframe(p),b=this.panoResourceFromLocationMotionKeyframe(m),x=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),d.longitude=this.cameraMotion.value.longitude,d.latitude=this.cameraMotion.value.latitude,d.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),u.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let n=this.locationMotion.value.count-g.value.count+1,r=new t.Vector3().copy(_.position),o=new t.Vector3().copy(v.position);if(u.progress=v.effectEasing(n),n>=.01&&n<=.99&&(u.progress=H(v.effectEasing(n),.01,.99)),v.panoPicture&&(n<1?_.panoPicture&&(u.pano0=_.panoPicture):u.pano0=v.panoPicture,u.pano1=v.panoPicture),v.effect===`montage`?u.transition=`BLACK`:v.effect===`spread`?u.transition=`SPREAD`:u.transition=`FADE`,v.effect===`zoomin`||v.effect===`zoomout`?u.progress=Math.pow(n,3):v.effect===`model`&&this.camera.pose.distance<.01&&(u.modelAlpha=1-Math.pow(H(Math.abs(n-.5)*2,0,1),4)),n<1&&v.effect!==`fly`&&v.effect!==`model`){if(u.pano0&&_.panoPicture){let e={panoId:u.pano0.panoId,map:u.pano0.map,mapHistogram:u.pano0.mapHistogram,mapSize:u.pano0.mapSize,zoom:u.pano0.zoom,matrix:_.panoPicture.matrix.clone().premultiply(_.fixCameraTransform).setPosition(v.position)},t=this.panoPictureObserverMap.get(u.pano0);t&&this.panoPictureObserverMap.set(e,t),u.pano0=e}r.copy(o),x=!0}d.distance=this.locationMotion.value.distance,d.offset=new t.Vector3(r.x+(o.x-r.x)*n,r.y+(o.y-r.y)*n,r.z+(o.z-r.z)*n);let s=[],c=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(s.push(t),n>this.locationMotion.progress&&c.push(t))}for(let e of Object.keys(this.panoResources)){if(c.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.panoPicture){let e=t.panoPicture.map;if(e){if(e===((i=u.pano0)==null?void 0:i.map)||e===((a=u.pano1)==null?void 0:a.map))continue;e.dispose(),t.panoPicture=null}}s.indexOf(e)>=0||delete this.panoResources[e]}let l=zp(v.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:zp(y.panoId),pano:zp(b.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},zp(b.panoId)),{mode:this.mode}),$(this.camera.pose)),d),options:{},progress:this.locationMotion.progress,error:null}))}jg(u)===!1&&this.modelScene.parameter.set(u),jg(d)===!1&&this.setCamera(d);let S=this.works.getObserver(this.currentPano),C=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,w=this.works.getObserver(_.panoId),T=this.works.getObserver(v.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&S){let e=[],n=S.work.observers;for(let t of S.accessibleNodes){let r=n[t];r&&e.push(r)}let r=new Map;if(e.sort((e,t)=>{let n=r.get(e);n===void 0&&(n=e.standingPosition.distanceTo(S.standingPosition),r.set(e,n));let i=r.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(S.standingPosition),r.set(t,i)),n-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let n=e[this.accessibleObserverFloorCheckCount],r=this.modelScene.models.find(e=>e.work===(n==null?void 0:n.work));if(n&&r&&r.visible){let e=.3,i=.005,a=n.standingPosition.clone().applyMatrix4(n.work.transform),o=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),s=Y_.map(n=>{q_.ray.origin.copy(a),q_.ray.origin.add(J_.copy(n).setY(e)),q_.ray.direction.set(0,-1,0),q_.firstHitOnly=!0,q_.floorIndex=-1;let[o]=r.intersectRaycaster(q_);return o&&o.distance-i<=e?new t.Vector3().copy(a).setY(o.point.y+i):a});s.sort((e,t)=>t.y-e.y);let c=s[Math.floor(s.length/2)],[l]=s.filter(e=>e.distanceTo(c)<=.05);if(l){let e=new t.Vector4(a.x,a.y,a.z,l.y-a.y),n=this.adjustPanoCircleMeshPositionFix.get(o);n&&!e.equals(n)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(o,e)}}this.accessibleObserverFloorCheckCount++}}let E=new Map;if(w)for(let e of w.accessibleNodes){let t=w.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});E.set(e,t)}}if(T)for(let e of T.accessibleNodes){let t=T.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});E.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{E.get(t)?E.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),E.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),E.delete(t)}),this.panoMeshes.forEach((e,n)=>{let r=this.works.getObserver(n);if(r){let i=r.position.distanceTo(r.standingPosition)>this.aerialObserverMinHeight;if(i)e.position.copy(r.position).applyMatrix4(r.work.transform),e.scale.setScalar(18);else{e.position.copy(r.standingPosition).applyMatrix4(r.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(r.panoId);t&&(J_.set(t.x,t.y,t.z),J_.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let a=this.camera.position.clone().setY(e.position.y),o=new t.Vector3().copy(e.position).sub(a).normalize();if(n===Z(this.currentPano)){let t=H((.5-a.distanceTo(e.position))/.5,0,1);o.multiplyScalar(1-t).add(f.clone().multiplyScalar(t))}if(o.length()>0){let n=i?-Math.PI/2:0,r=Math.atan2(o.x,o.z);e.quaternion.setFromEuler(new t.Euler(n,r,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||x)this.panoMeshes.forEach(t=>{t.setOpacity(0),t.setCurrent(!1),t.updateTime&&t.updateTime(e,n),t.visible=!1});else if(S){let t=S.work.observers,[,r]=vu(S.accessibleNodes,e=>{let n=t[e];return!n||!n.active?1/0:S.standingPosition.distanceTo(n.standingPosition)},!0);r=H(r,3,1/0);let i=S.accessibleNodes.concat(S.panoIndex).map(e=>Z({panoIndex:e,workCode:S.work.workCode}));this.panoMeshes.forEach((t,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=t.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!t.loading&&t.progress===0&&C!==null&&Z({panoIndex:C.panoIndex,workCode:C.work.workCode})===a;let n=t.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=n<.01?0:H(r/n,.1,.85)}o&&o===T&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&t.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(c=0),t.setCurrent(s),t.setOpacity(c),t.updateTime&&t.updateTime(e,n)})}{let e=(o=this.modelScene.parameter.progress)==null?1:o,n=Math.round(e),r=this.modelScene.parameter.pano0,i=this.modelScene.parameter.pano1,a=n===0?r:i,c;if(a&&(c=this.works.getObserver(a.panoId),c||(c=this.panoPictureObserverMap.get(a))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(ii()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!c||!a||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new t.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Yr(a.mapSize),o=e+1,l=new t.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),u=Math.floor(this.tileLevelForFov(this.camera.fov,l)),d=u>e?u:0;this.tiling.setObserver(c);let f={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:a.map,panoMatrix:a.matrix,panoZoom:a.zoom,minLevel:o,level:d},p=this.tiling.update(f),m={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:n,opacity:(r==null?void 0:r.panoId)===(i==null?void 0:i.panoId)?1:Ed(Math.abs(((s=this.modelScene.parameter.progress)==null?0:s)-.5)*2)},h=this.modelScene.parameter.refinedScreen;(p||m.pano!==(h==null?void 0:h.pano)||m.opacity!==(h==null?void 0:h.opacity))&&this.modelScene.parameter.set(`refinedScreen`,m)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),S&&S.images.video&&(this.needsRender=!0),this.intersectMesh&&this.intersectMesh.parent&&S&&S.position.y-S.standingPosition.y>10){let e=H(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=v.effect,{pano0:n,pano1:r}=this.modelScene.parameter;if(n&&r&&n!==r&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((c=this.modelScene.parameter.pano0Depth)==null?void 0:c.panoId)!==n.panoId||((l=this.modelScene.parameter.pano1Depth)==null?void 0:l.panoId)!==r.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1});let e=new t.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(n.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,W_(this.renderer,this.modelScene,e,500);let i=new t.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);i.matrix.copy(r.matrix),i.matrixWorld.copy(i.matrix),i.matrixAutoUpdate=!1,W_(this.renderer,this.modelScene,i,500),this.modelScene.parameter.set({pano0Depth:{panoId:n.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:r.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))}}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(V())[1],t=this.locationMotion.getKeyFrameSegment(V())[1],n=this.panoResourceFromLocationMotionKeyframe(t),r=this.works.getObserver(n.panoId);return{workCode:r?r.work.workCode:this.currentPano.workCode,panoIndex:r?r.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:r?r.position.clone().applyMatrix4(r.work.transform):this.camera.position.clone(),distance:this.locationMotion.value.distance}}moveToPano(e,n,r){var i,a,o;this.userAction=r,this.stopMomentumMovement();let s=Z(e),c=this.works.getObserver(e);if(!c)throw Error(`Invalid PanoId ${JSON.stringify(e)}`);let l=Kr(c.images.up),u=this.imageOptions.size;u===void 0&&c&&l&&(u=Number(l)),u===void 0&&(u=2048);let d=this.imageOptions.transform,f=Object.assign({key:`pano.${s}`},dr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),p={right:c.images.work.getURL(c.images.right),left:c.images.work.getURL(c.images.left),up:c.images.work.getURL(c.images.up),down:c.images.work.getURL(c.images.down),front:c.images.work.getURL(c.images.front),back:c.images.work.getURL(c.images.back)},m=`pano:`+Lp([p,f,d]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===m)return;{let e=this.pendingPanoTask.panoId;(i=this.panoMeshes.get(e))==null||i.setProgress(0),this.emit(`pano.texture.abort`,Q(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode}}))}}let h=`move-to-pano-`+s;this.pending.add(h);let g=Sg(`pano.prepare`,{options:n,prevMode:this.mode,prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,g),g.defaultPrevented){this.pending.delete(h);return}g.options!==n&&Object.assign(n,g.options);let _=this.modelScene.parameter,v;_.pano0&&_.pano0.map.name===m?v=_.pano0:_.pano1&&_.pano1.map.name===m&&(v=_.pano1);let y=(a=n.effect)==null?G_:a,b=(o=n.effectEasing)==null?K_:o;if(v){let r={panoId:s,effect:y,effectEasing:b,panoPicture:{panoId:v.panoId,map:v.map,mapHistogram:v.mapHistogram,mapSize:v.mapSize,matrix:c.matrix.clone().premultiply(c.work.transform),zoom:1},position:c.position.clone().applyMatrix4(c.work.transform),fixCameraTransform:new t.Matrix4};r.panoPicture&&this.panoPictureObserverMap.set(r.panoPicture,c),this.pendingPanoTask=void 0,Promise.resolve().then(()=>Cg(g)).catch(e=>Gg(e)).then(t=>{var i,a;if(!(t instanceof Error))this.pending.delete(h),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0),this.doMoveToPano(e,r,n);else{let e=null;t instanceof Error&&(e||(e=t));let r=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),n.moveCancelCallback&&n.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(h),this.pendingPanoTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)}});return}let x=this.panoMeshes.get(s);x&&x.tap&&x.tap(),this.pendingPanoTask={panoId:s,hash:m,onLoad:r=>{var i;let a=r.body;if(this.destroyed)a.dispose();else{a.name=m;let r=Array.isArray(a.image)?a.image[0]:a.image,o=(i=r==null?void 0:r.width)==null?2048:i,l=c.images.histogram;l||(l=new Bm().formPixels(zg(this.renderer,a,!0,Im).data),c.images.histogram=l);let u={panoId:s,effect:y,effectEasing:b,panoPicture:{panoId:s,map:a,mapSize:o,mapHistogram:new t.Vector4().fromArray(l.toArray()),matrix:c.matrix.clone().premultiply(c.work.transform),zoom:1},position:c.position.clone().applyMatrix4(c.work.transform),fixCameraTransform:new t.Matrix4};u.panoPicture&&this.panoPictureObserverMap.set(u.panoPicture,c),this.doMoveToPano(e,u,n)}},onError:e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),n.moveCancelCallback&&n.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),e instanceof Error&&e.message&&this.emit(`error`,e)}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(p,{imageURL:{transform:d,options:f},format:t.RGBFormat,viaAjax:!0,fetcher:Kf(this.fiveId,c.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,Q(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===m&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=Gg(t);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>Cg(g)).catch(e=>Gg(e))]).then(([t,n])=>{var r,i,a,o;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(h),((r=this.pendingPanoTask)==null?void 0:r.hash)===m?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,Q(`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(h),((a=this.pendingPanoTask)==null?void 0:a.hash)===m&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(s))==null||o.setProgress(0))}})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{duration:n,effect:r,userAction:i}=this.initial;this.userAction=i;let a=e.initAnimationEndState(this),o={workCode:a.workCode,panoIndex:a.panoIndex},s=!1;this.moveToPano(o,{longitude:a.longitude,latitude:a.latitude,fov:a.fov,effect:r,duration:n,moveStartCallback:e=>{s=!0,this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction}))},moveEndCallback:e=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),this.initAnimationed=!0,t()},moveCancelCallback:()=>{let e=Object.assign(Object.assign(Object.assign({},o),{mode:this.mode}),$(this.camera.pose));s===!1&&this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction})),this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),this.initAnimationed=!0,t()}},i)})}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}locationMotionKeyframesLength(e){let t=0;for(let n=1;n<e.length;n++){let r=this.panoResourceFromLocationMotionKeyframe(e[n-1]).position,i=this.panoResourceFromLocationMotionKeyframe(e[n]).position,a=r.distanceTo(i)*(e[n].value.count-e[n-1].value.count);t+=a}return t}doMoveToPano(e,n,r={}){var i,a,o,s,c,l,u,d,f,p,m;let h=V(),g=Zt();this.panoResources[g]=n;let _,v,y;if(this.locationMotion.ended){let[e,t]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,a=((i=this.panoResourceFromLocationMotionKeyframe(t))==null?this.camera:i).position,o=n.position;_=Math.max(a.distanceTo(o),1),v=[{key:t.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:g,progress:1,value:{distance:0,count:1}}],y=0}else{let[e,t]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(t).position,o=n.position,s=t.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;_=c+Math.max(a.distanceTo(o),1),v=[{key:e.key,progress:0,value:Object.assign({},r)},{key:t.key,progress:c/_,value:t.value},{key:g,progress:1,value:{count:t.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(v);y=l===0||l===0?0:this.locationMotion.getProgressVelocity(h)*l/u}let b=n.effect===`instant`?0:this.calculateMovingDuration(r.duration,n.effect===`fly`||n.effect===`model`?_:0),x={longitude:r.longitude,latitude:r.latitude,fov:r.fov},S=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(a=x.longitude)==null?this.camera.pose.longitude:a,latitude:(o=x.latitude)==null?this.camera.pose.latitude:o,fov:(s=x.fov)==null?this.camera.pose.fov:s,offset:n.position.clone(),distance:this.camera.pose.distance}),C=this.currentPano;if(this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:r,prevPano:C,pano:{panoIndex:S.panoIndex,workCode:S.workCode},progress:0,state:S,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(S),this.perspToOrthoMotion.set({perspToOrtho:0},b).catch(G),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],b).catch(G),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=G,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),n.effect===`fly`||n.effect===`model`)this.cameraMotion.set(x,b).catch(G);else{let e=It({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),r=It({longitude:(c=x.longitude)==null?this.cameraMotion.value.longitude:c,latitude:(l=x.latitude)==null?this.cameraMotion.value.latitude:l}),i=new t.Object3D;i.lookAt(e);let a=new t.Matrix4().makeRotationFromQuaternion(i.quaternion);i.lookAt(r);let o=new t.Matrix4().makeRotationFromQuaternion(i.quaternion),s=new t.Matrix4().getInverse(a).premultiply(o),h=this.cameraMotion.value.fov,g=(u=x.fov)==null?this.cameraMotion.value.fov:u,_=1;n.effect===`zoomin`?_=1.5:n.effect===`zoomout`&&(_=.4);let y=H(g*_,1,170);for(let e=0;e<v.length-1;e++){let t=v[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(s),e.panoPicture&&(e.panoPicture.zoom=Math.tan(y/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(d=x.longitude)==null?this.cameraMotion.value.longitude:d,latitude:(f=x.latitude)==null?this.cameraMotion.value.latitude:f,fov:y}},{progress:1,value:{longitude:(p=x.longitude)==null?this.cameraMotion.value.longitude:p,latitude:(m=x.latitude)==null?this.cameraMotion.value.latitude:m,fov:g}}],b).catch(G)}this.locationMotion.setKeyframes(v,b,y).then(()=>{for(let e of this.modelScene.children)e instanceof dp&&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:this.camera.pose.distance});this.emit(`pano.arrived`,Q(`pano.arrived`,{options:r,prevPano:C,pano:{panoIndex:t.panoIndex,workCode:t.workCode},progress:1,state:t,userAction:this.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(t);let n=this.works.getObserver(e);if(n&&n.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:n.images.video.size.clone(),matrix:n.images.video.matrix.clone(),panoMatrix:n.matrix.clone().premultiply(n.work.transform),alpha:1},t=Zt(),r=this.videoTexture.image;r.setAttribute(`uuid`,t),r.oncanplay=G,r.ontimeupdate=G,n_().then(i=>{i&&n.images.video&&r.getAttribute(`uuid`)===t&&(r.oncanplay=()=>{r.oncanplay=G,r.play()},r.ontimeupdate=()=>{r.currentTime>.5&&(r.ontimeupdate=G,this.panoVideo.setMaterial(e))},r.src=n.images.video.source)}).catch((()=>{r.removeAttribute(`uuid`)}))}else{let e=this.videoTexture.image;e.removeAttribute(`uuid`),e.oncanplay=G,e.ontimeupdate=G}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{options:r,prevPano:C,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),r.moveCancelCallback&&r.moveCancelCallback()})}getForwardObserverOrNot(e,n){let r=this.works.getObserver(this.currentPano);if(!r)return null;let i=n==null?new t.Raycaster(e.position.clone(),e.getWorldDirection(new t.Vector3)):n;i.params.Points={threshold:.1},i.firstHitOnly=!0,i.floorIndex=-1;let a=r.standingPosition.clone().applyMatrix4(r.work.transform);if(r.position.clone().applyMatrix4(r.work.transform).distanceTo(i.ray.origin)>1){let e=new t.Raycaster(i.ray.origin,new t.Vector3(0,-1,0));e.firstHitOnly=i.firstHitOnly,e.floorIndex=i.floorIndex;let[n]=this.modelScene.intersectRaycaster(e);n&&n.distance<=2?a.copy(n.point):a.copy(i.ray.origin).add(new t.Vector3(0,-1.5,0))}let[o]=this.modelScene.intersectRaycaster(i),s=(o?o.point:i.ray.origin.clone().add(i.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(a).normalize();if(s.length()===0)return null;let c=r.work.observers,l=r.accessibleNodes.filter(t=>{if(t===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let n=c[t];if(!n)return!1;let i=n.standingPosition.clone().applyMatrix4(n.work.transform).project(e);return Math.abs(i.z)>1||Math.abs(i.x)>1||Math.abs(i.y)>1?!1:n.loadable||n.active}),u=new Map,d=l.slice().sort((e,t)=>{let n=c[e],r=u.get(n);r===void 0&&(r=J_.copy(n.standingPosition).applyMatrix4(n.work.transform).distanceTo(a),u.set(n,r));let i=c[t],o=u.get(i);return o===void 0&&(o=J_.copy(i.standingPosition).applyMatrix4(i.work.transform).distanceTo(a),u.set(i,o)),r-o});u.clear();for(let e of[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3])for(let t of d){let n=c[t];if(n){let t=J_.copy(n.standingPosition).applyMatrix4(n.work.transform).sub(a);if(t&&t.length()!==0&&s.angleTo(t)<e)return n}}let f=null;if(n){let t=n.ray.intersectBox(this.modelScene.boundingBox,J_);t&&(t.project(e),Math.abs(t.z)<=1&&(f=t.clone()))}else f=new t.Vector3(0,0,0);if(f){let t=r.accessibleNodes.filter(t=>{if(t===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let n=c[t];if(!n)return!1;let i=n.position.clone().applyMatrix4(n.work.transform).project(e);return Math.abs(i.z)>1||Math.abs(i.x)>1||Math.abs(i.y)>1?!1:n.loadable||n.active}),n=new Map,i=t.slice().sort((t,r)=>{let i=c[t],a=n.get(i);a===void 0&&(a=J_.copy(i.position).applyMatrix4(i.work.transform).distanceTo(e.position),n.set(i,a));let o=c[r],s=n.get(o);return s===void 0&&(s=J_.copy(o.position).applyMatrix4(o.work.transform).distanceTo(e.position),n.set(o,s)),a-s});n.clear();for(let t of i){let n=c[t];if(n){let t=J_.copy(n.position).applyMatrix4(n.work.transform);if(t.project(e),Math.abs(t.z)>1)continue;if(Math.pow(f.x-t.x,2)+Math.pow(f.y-t.y,2)<Math.pow(.4,2))return n}}}return null}onTapGesture(e){var n;if(this.userAction=e.userAction,this.stopMomentumMovement(),!this.initAnimationed)return;let r=e.center.raycaster;r.floorIndex=-1;let i=this.camera.getDirection(new t.Vector3).setY(0),a=null,o=this.works.getObserver(this.currentPano);if(!o)return;let s=o.work.observers,c=o.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&o.work.workCode===this.currentPano.workCode)return!1;let t=s[e];return!t||J_.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[l]=this.modelScene.intersectRaycaster(r);if(l){let[e,t]=vu(c,e=>{let t=s[e];return t?J_.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(l.point):1/0},!0);typeof e==`number`&&t<this.panoTapTriggerRadius&&(a=(n=s[e])==null?null:n)}if(a||(a=this.getForwardObserverOrNot(this.camera,r)),a&&a.panoId===Z(this.currentPano)&&(a=null),a&&!this.locationMotion.ended){for(let e of this.locationMotion.keyframes)if(this.panoResourceFromLocationMotionKeyframe(e).panoId===a.panoId){a=null;break}}if(!a)this.emit(`gesture.tap`,e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{let t={},n=Math.PI/6,r=Math.PI/12,s=a.position.clone().applyMatrix4(a.work.transform).setY(0).sub(o.position.clone().applyMatrix4(a.work.transform).setY(0)).normalize(),c=[],l=[],u=[],d=a.work.observers;for(let e of a.accessibleNodes){if(a.panoIndex===e||e===this.currentPano.panoIndex&&a.work.workCode===this.currentPano.workCode)continue;let t=d[e];if(!t)continue;let r=t.position.clone().applyMatrix4(t.work.transform).sub(a.position.clone().applyMatrix4(a.work.transform)).setY(0).normalize();s.angleTo(r)<n&&u.push(r)}let[f]=(u.length>0?u:[...c,...l]).slice().sort((e,t)=>e.angleTo(s)-t.angleTo(s));if(f&&f.angleTo(i)>r&&(t.longitude=Math.atan2(-f.x,-f.z)),this.cameraMotion.value.latitude<-Math.PI/4){let n=e.state.fov;t.latitude=H(0,H(typeof this.minLatitude==`function`?this.minLatitude(n):this.minLatitude,-Math.PI/2,Math.PI/2),H(typeof this.maxLatitude==`function`?this.maxLatitude(n):this.maxLatitude,-Math.PI/2,Math.PI/2))}let p=Object.assign({},e.state);if(p.workCode=a.work.workCode,p.panoIndex=a.panoIndex,t.longitude!==void 0&&(p.longitude=t.longitude),t.latitude!==void 0&&(p.latitude=t.latitude),t.fov!==void 0&&(p.fov=t.fov),p.distance=0,p.offset=a.position.clone(),e.state=p,this.emit(`gesture.tap`,e),!e.defaultPrevented){if(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:p.panoIndex,workCode:p.workCode},state:p,userAction:e.userAction,options:t,progress:0,error:null})),a&&!a.active){let e=Z({panoIndex:a.panoIndex,workCode:a.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}a&&a.active&&this.emit(`pano.request`,Q(`pano.request`,{userAction:e.userAction,prevPano:this.currentPano,pano:{panoIndex:p.panoIndex,workCode:p.workCode},progress:0,state:p,options:t,error:null}))}}}},Q_=Math.PI/180,$_=180/Math.PI,ev=.001,tv=1,nv=(()=>{let e=typeof navigator<`u`&&/iPad|iPhone|iPod/.test(navigator.platform);return()=>e})(),rv=(()=>{let e=typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return()=>e})(),iv=(()=>{let e=typeof navigator<`u`&&navigator.userAgent.indexOf(`Firefox`)!==-1&&navigator.userAgent.indexOf(`Android`)!==-1;return()=>e})(),av=(()=>{let e=typeof navigator<`u`?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=e?parseInt(e[1],10):null;return()=>t})(),ov=(()=>{let e=!1;if(av()===65){let t=typeof navigator<`u`?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){let[n,r,i,a]=t[1].split(`.`);e=parseInt(i,10)===3325&&parseInt(a,10)<148}}return()=>e})(),sv=(()=>{let e=nv()&&rv()&&typeof navigator<`u`&&navigator.userAgent.indexOf(`13_4`)!==-1;return()=>e})(),cv=(()=>{let e=typeof navigator<`u`&&navigator.userAgent.indexOf(`R7 Build`)!==-1;return()=>e})();function lv(){let e=typeof window<`u`&&(window.orientation==90||window.orientation==-90);return cv()?!e:e}function uv(e){return!(isNaN(e)||e<=ev||e>tv)}function dv(e){return e.w>1?0:2*Math.acos(e.w)}var fv=(()=>{let e={};return(t,n)=>{e[t]===void 0&&(console.warn(`cardboard: `+n),e[t]=!0)}})();function pv(e){let t,n=e.indexOf(`://`);t=n===-1?0:n+3;let r=e.indexOf(`/`,t);return r===-1&&(r=e.length),e.substring(0,r)}function mv(){if(typeof window>`u`||typeof document>`u`)return!1;let e=window.self!==window.top,t=pv(document.referrer),n=pv(window.location.href);return e&&t!==n}var hv=(()=>{function e(e,t,n){let r=t?t[0]:0,i=t?t[1]:0,a=t?t[2]:0,o=t?t[3]:1,s=r+r,c=i+i,l=a+a,u=r*s,d=r*c,f=r*l,p=i*c,m=i*l,h=a*l,g=o*s,_=o*c,v=o*l;return e[0]=1-(p+h),e[1]=d+v,e[2]=f-_,e[3]=0,e[4]=d-v,e[5]=1-(u+h),e[6]=m+g,e[7]=0,e[8]=f+_,e[9]=m-g,e[10]=1-(u+p),e[11]=0,e[12]=n?n[0]:0,e[13]=n?n[1]:0,e[14]=n?n[2]:0,e[15]=1,e}function t(e,t,n){let r=n[0],i=n[1],a=n[2],o,s,c,l,u,d,f,p,m,h,g,_;return t===e?(e[12]=t[0]*r+t[4]*i+t[8]*a+t[12],e[13]=t[1]*r+t[5]*i+t[9]*a+t[13],e[14]=t[2]*r+t[6]*i+t[10]*a+t[14],e[15]=t[3]*r+t[7]*i+t[11]*a+t[15]):(o=t[0],s=t[1],c=t[2],l=t[3],u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],e[0]=o,e[1]=s,e[2]=c,e[3]=l,e[4]=u,e[5]=d,e[6]=f,e[7]=p,e[8]=m,e[9]=h,e[10]=g,e[11]=_,e[12]=o*r+u*i+m*a+t[12],e[13]=s*r+d*i+h*a+t[13],e[14]=c*r+f*i+g*a+t[14],e[15]=l*r+p*i+_*a+t[15]),e}function n(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(A=1/A,e[0]=(s*k-c*O+l*D)*A,e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null}return(r,i,a)=>{e(r,i),a&&t(r,r,a),n(r,r)}})(),gv=class{constructor(e=new t.Vector3,n=0){this.sample=e,this.timestampS=n}set(e,t){this.sample=e,this.timestampS=t}copy(e){this.set(e.sample,e.timestampS)}},_v=class{constructor(e,n){this.kFilter=e,this.isDebug=n,this.currentAccelMeasurement=new gv,this.currentGyroMeasurement=new gv,this.previousGyroMeasurement=new gv,nv()?this.filterQ=new t.Quaternion(-1,0,0,1):this.filterQ=new t.Quaternion(1,0,0,1),this.previousFilterQ=new t.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new t.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new t.Vector3,this.measuredGravity=new t.Vector3,this.gyroIntegralQ=new t.Quaternion}addAccelMeasurement(e,t){this.currentAccelMeasurement.set(e,t)}addGyroMeasurement(e,t){this.currentGyroMeasurement.set(e,t),uv(t-this.previousGyroMeasurement.timestampS)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)}getOrientation(){return this.filterQ}run_(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}let e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,n=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(n),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(n);let r=new t.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();let i=new t.Quaternion;i.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),i.inverse(),this.isDebug&&console.log(`Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)`,$_*dv(i),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));let a=new t.Quaternion;a.copy(this.filterQ),a.multiply(i),this.filterQ.slerp(a,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)}accelToQuaternion_(e){let n=new t.Vector3;n.copy(e),n.normalize();let r=new t.Quaternion;return r.setFromUnitVectors(new t.Vector3(0,0,-1),n),r.inverse(),r}gyroToQuaternionDelta_(e,n){let r=new t.Quaternion,i=new t.Vector3;return i.copy(e),i.normalize(),r.setFromAxisAngle(i,e.length()*n),r}},vv=class{constructor(e,n){this.predictionTimeS=e,this.isDebug=n,this.previousQ=new t.Quaternion,this.previousTimestampS=null,this.deltaQ=new t.Quaternion,this.outQ=new t.Quaternion}getPrediction(e,n,r){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=r,e;let i=new t.Vector3;i.copy(n),i.normalize();let a=n.length();if(a<Q_*20)return this.isDebug&&console.log(`Moving slowly, at %s deg/s: no prediction`,($_*a).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;let o=a*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(i,o),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=r,this.outQ}},yv=class{constructor(e){this.coefficients=e}distortInverse(e){let t=0,n=1,r=e-this.distort(t);for(;Math.abs(n-t)>1e-4;){let i=e-this.distort(n),a=n-i*((n-t)/(i-r));t=n,n=a,r=i}return n}distort(e){let t=e*e,n=0;for(let e=0;e<this.coefficients.length;e++)n=t*(n+this.coefficients[e]);return(n+1)*e}},bv=class{constructor(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}},xv=class{constructor(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}},Sv=class{constructor(e,n,r,i){this.viewer={id:`CardboardV1`,label:`Cardboard I/O 2014`,fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new t.Vector3,this.gyroscope=new t.Vector3,this.filter=new _v(e,i),this.posePredictor=new vv(n,i),this.isFirefoxAndroid=iv(),this.isIOS=nv();let a=av();this.isDeviceMotionInRadians=!this.isIOS&&a!==null&&a<66,this.isWithoutDeviceMotion=ov()||sv(),this.filterToWorldQ=new t.Quaternion,nv()?this.filterToWorldQ.setFromAxisAngle(new t.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new t.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new t.Quaternion,this.worldToScreenQ=new t.Quaternion,this.originalPoseAdjustQ=new t.Quaternion;let o=typeof window<`u`?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new t.Vector3(0,0,1),o),this.setScreenTransform_(),lv()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new t.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}getPosition(){return null}getOrientation(){let e;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(function(){let e=new t.Quaternion().setFromAxisAngle(new t.Vector3(0,0,-1),0),n=new t.Quaternion;return typeof window<`u`&&window.orientation===-90?n.setFromAxisAngle(new t.Vector3(0,1,0),Math.PI/-2):n.setFromAxisAngle(new t.Vector3(0,1,0),Math.PI/2),e.multiply(n)})(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||(function(){let e=new t.Quaternion;return e.setFromAxisAngle(new t.Vector3(1,0,0),-Math.PI/2),e})(),e=this._deviceOrientationQ;let n=new t.Quaternion;return n.copy(e),n.multiply(this.deviceOrientationFilterToWorldQ),n.multiply(this.resetQ),n.multiply(this.worldToScreenQ),n.multiplyQuaternions(this.deviceOrientationFixQ,n),this.yawOnly&&(n.x=0,n.z=0,n.normalize()),this.orientationOut_[0]=n.x,this.orientationOut_[1]=n.y,this.orientationOut_[2]=n.z,this.orientationOut_[3]=n.w,this.orientationOut_}else{let t=this.filter.getOrientation();e=this.posePredictor.getPrediction(t,this.gyroscope,this.previousTimestampS)}let n=new t.Quaternion;return n.copy(this.filterToWorldQ),n.multiply(this.resetQ),n.multiply(e),n.multiply(this.worldToScreenQ),this.yawOnly&&(n.x=0,n.z=0,n.normalize()),this.orientationOut_[0]=n.x,this.orientationOut_[1]=n.y,this.orientationOut_[2]=n.z,this.orientationOut_[3]=n.w,this.orientationOut_}getPose(){let e=new bv;return e.orientation=this.getOrientation(),e}resetPose(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),lv()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)}getFrameData(e){let t=this.getOrientation(),n=this.getEyeOffset(),r=this.getEyeProjectionMatrix();return e.pose.angularAcceleration=null,e.pose.angularVelocity=null,e.pose.linearAcceleration=null,e.pose.linearVelocity=null,e.pose.orientation=t,e.pose.position=null,e.timestamp=this.previousTimestampS,e.leftProjectionMatrix.set(r.left),e.rightProjectionMatrix.set(r.right),hv(e.leftViewMatrix,t,n.left),hv(e.rightViewMatrix,t,n.right),e}start(){if(typeof window>`u`)return()=>{};let e=this.onDeviceMotion_.bind(this),t=this.onOrientationChange_.bind(this),n=this.onMessage_.bind(this),r=this.onDeviceOrientation_.bind(this);return nv()&&mv()&&window.addEventListener(`message`,n),window.addEventListener(`orientationchange`,t),this.isWithoutDeviceMotion?window.addEventListener(`deviceorientation`,r):window.addEventListener(`devicemotion`,e),()=>{window.removeEventListener(`devicemotion`,e),window.removeEventListener(`deviceorientation`,t),window.removeEventListener(`orientationchange`,t),window.removeEventListener(`message`,n)}}getEyeOffset(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}}getEyeProjectionMatrix(){let e=this.getEyeFieldOfView(),t=this.depthNear,n=this.depthFar,r={left:[],right:[]};{let i=e.left.upDegrees*Q_,a=e.left.downDegrees*Q_,o=e.left.leftDegrees*Q_,s=e.left.rightDegrees*Q_,c=2/(o+s),l=2/(i+a);r.left[0]=c,r.left[1]=0,r.left[2]=0,r.left[3]=0,r.left[4]=0,r.left[5]=l,r.left[6]=0,r.left[7]=0,r.left[8]=-((o-s)*c*.5),r.left[9]=(i-a)*l*.5,r.left[10]=n/(t-n),r.left[11]=-1,r.left[12]=0,r.left[13]=0,r.left[14]=n*t/(t-n),r.left[15]=0}{let i=e.right.upDegrees*Q_,a=e.right.downDegrees*Q_,o=e.right.leftDegrees*Q_,s=e.right.rightDegrees*Q_,c=2/(o+s),l=2/(i+a);r.right[0]=c,r.right[1]=0,r.right[2]=0,r.right[3]=0,r.right[4]=0,r.right[5]=l,r.right[6]=0,r.right[7]=0,r.right[8]=-((o-s)*c*.5),r.right[9]=(i-a)*l*.5,r.right[10]=n/(t-n),r.right[11]=-1,r.right[12]=0,r.right[13]=0,r.right[14]=n*t/(t-n),r.right[15]=0}return r}getEyeFieldOfView(){let e=this.viewer,t=this.device,n=new yv(e.distortionCoefficients),r=e.screenLensDistance,i=(t.widthMeters-e.interLensDistance)/2,a=e.interLensDistance/2,o=e.baselineLensDistance-t.bevelMeters,s=t.heightMeters-o,c=$_*Math.atan(n.distort(i/r)),l=$_*Math.atan(n.distort(a/r)),u=$_*Math.atan(n.distort(o/r)),d=$_*Math.atan(n.distort(s/r)),f=new xv,p=new xv;return f.leftDegrees=Math.min(c,e.fov),f.rightDegrees=Math.min(l,e.fov),f.downDegrees=Math.min(u,e.fov),f.upDegrees=Math.min(d,e.fov),p.leftDegrees=f.rightDegrees,p.rightDegrees=f.leftDegrees,p.upDegrees=f.upDegrees,p.downDegrees=f.downDegrees,{left:f,right:p}}onDeviceOrientation_(e){this._deviceOrientationQ=this._deviceOrientationQ||new t.Quaternion;let{alpha:n,beta:r,gamma:i}=e;n=(n||0)*Math.PI/180,r=(r||0)*Math.PI/180,i=(i||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new t.Euler(n,r,-i,`YXZ`))}onDeviceMotion_(e){this.updateDeviceMotion_(e)}updateDeviceMotion_(e){let t=e.accelerationIncludingGravity,n=e.rotationRate,r=e.timeStamp/1e3,i=r-this.previousTimestampS;if(i<0){fv(`fusion-pose-sensor:invalid:non-monotonic`,`Invalid timestamps detected: non-monotonic timestamp from devicemotion`),this.previousTimestampS=r;return}else if(i<=ev||i>tv){fv(`fusion-pose-sensor:invalid:outside-threshold`,`Invalid timestamps detected: Timestamp from devicemotion outside expected range.`),this.previousTimestampS=r;return}t&&(this.accelerometer.set(-t.x,-t.y,-t.z),n&&(cv()?this.gyroscope.set(-n.beta,n.alpha,n.gamma):this.gyroscope.set(n.alpha,n.beta,n.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,r)),this.filter.addAccelMeasurement(this.accelerometer,r)),this.previousTimestampS=r}onOrientationChange_(){this.setScreenTransform_()}onMessage_(e){let t=e.data;!t||!t.type||t.type.toLowerCase()===`devicemotion`&&this.updateDeviceMotion_(t.deviceMotionEvent)}setScreenTransform_(){switch(this.worldToScreenQ.set(0,0,0,1),typeof window<`u`?window.orientation:0){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new t.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new t.Vector3(0,0,1),Math.PI/2);break;case 180:break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()}},Cv=[0,0,.5,1],wv=[.5,0,.5,1],Tv=class{constructor(e){this.renderer=e,this.sensor=new Sv(.98,.04,!1,!1),this.scale=1,this.cameraL=new t.PerspectiveCamera,this.cameraR=new t.PerspectiveCamera;let n=this.sensor.start();this.dispose=()=>{let e=this.renderer.getSize(new t.Vector2);this.renderer.setScissor(0,0,e.width,e.height),this.renderer.setViewport(0,0,e.width,e.height),this.renderer.setScissorTest(!1),n()}}render(e,n){let r=this.renderer.getSize(new t.Vector2);if(r.width>r.height){var i=e.autoUpdate;i&&(e.updateMatrixWorld(),e.autoUpdate=!1);let a={x:Math.round(r.width*Cv[0]),y:Math.round(r.height*Cv[1]),width:Math.round(r.width*Cv[2]),height:Math.round(r.height*Cv[3])},o={x:Math.round(r.width*wv[0]),y:Math.round(r.height*wv[1]),width:Math.round(r.width*wv[2]),height:Math.round(r.height*wv[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),n.parent===null&&n.updateMatrixWorld(),n.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),n.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);let s=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new t.Vector3().fromArray(s.left),this.scale),this.cameraR.translateOnAxis(new t.Vector3().fromArray(s.right),this.scale);let c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(a.x,a.y,a.width,a.height),this.renderer.setScissor(a.x,a.y,a.width,a.height),this.renderer.render(e,this.cameraL),this.renderer.setViewport(o.x,o.y,o.width,o.height),this.renderer.setScissor(o.x,o.y,o.width,o.height),this.renderer.render(e,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),i&&(e.autoUpdate=!0)}else this.renderer.render(e,n)}dispose(){}},Ev=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaAAAC/VBMVEUAAAD///99fX37+/v5+fn29vbx8fHv7+/Nzc3o6Ojq6urh4eHU1NTR0dGDg4Pl5eWSkpLHx8fj4+Pe3t7X19fAwMDZ2dnCwsKrq6uioqLb29uNjY2enp67u7t5eXmAgIC2traWlpa5ubnKysqmpqZycnKHh4eurq6ysrKKioqDg4Pd3d12dnb9/f1vb2/s7OxlZWXz8/OoqKiZmZlpaWmbm5teXl7W1tbJycnExMRiYmJsbGywsLCPj49aWlq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8fgmVckgFXML9YEEFLUKMvlqAp0eWyDEAL65dLqyWo6RekTZ2XNCsD6rgpTK/4p3WcrrPH1ghWJGhONC3JoGAkRHH1JKjpNEcCxOV2I8MWyiUJqNVajSVodgiWcVMVLVeSS1ATCZoc88qjVKlSc3kSLJ5c5V6rTZQAcVkGbBeuOkgCgq2CBM3MoFwGr1tvim2aMpZZqyBBc3N1UF2GX90j9SQJKCBB83OfYAcNVjFcSrvzo95WOShB83Ody5V24fqzO0nAUSzB/89Nph38VqmuOa3gticJOP9fApuHTDt4nFJ7AXdPC0lg8/gq8y5XapSrgpUgbQ0JpF5u97hS1fOC26nlJJA8Yd41Sg3fU4dtRQkKeXSN3jo4Qqm0397OmyZOGatoDrScBIWM3DFn5kXi1ZyqRSUoZtKOa1vWKArztqgEnhIHty4f9/btuEstKwGkxf+XuCT5CbTFnFRuxktuAAAAAElFTkSuQmCC`,Ov,kv={zh:{TITLE:`眼镜模式`,HIT:`请将手机横屏放入 VR 眼镜中`},en:{TITLE:`GLASSES MODE`,HIT:`Please put the mobile phone horizontally into the VR glasses.`},ja:{TITLE:`メガネモード`,HIT:`携帯電話をVRメガネに水平に入れてください。`}},Av=typeof navigator<`u`?(Ov=kv[navigator.language.split(`-`)[0]])==null?kv.zh:Ov:kv.zh,jv=`
|
|
2283
|
+
`,uniforms:{maxDepth:new t.Uniform(0)}});function K_(e,t,n,r=1e3){G_.uniforms.maxDepth.value=r,W_.copy(e.getClearColor());let i=e.getClearAlpha(),a=t.overrideMaterial;t.overrideMaterial=G_,e.setClearColor(U_,0),n.update(e,t),e.setClearColor(W_,i),t.overrideMaterial=a}var q_=`fly`,J_=wd,Y_=new t.Raycaster,X_=new t.Vector3,Z_=[new t.Vector3(0,0,0).multiplyScalar(.1),new t.Vector3(1,0,0).multiplyScalar(.1),new t.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new t.Vector3(-.5,0,Math.sqrt(3)/2).multiplyScalar(.1)],Q_=Object.assign(Object.assign({},e_),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:(e,t)=>e.position.distanceTo(e.standingPosition)>t.aerialObserverMinHeight?new lg:new ig,adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:((e,t)=>{var n;let r=e=>e/180*Math.PI,i=(n=Math.log2)==null?(e=>Math.log(e)*Math.LOG2E):n,a=t.height/2/Math.tan(r(e/2))*Math.tan(r(45))*2,o=Math.max(i(a/512),0);return o<2.3&&o>.1&&(o=1),o=o%1>.75?Math.ceil(o):Math.floor(o),o}),tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),$_=class e extends t_{static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{maxAccessibleDistance:(n=t.maxAccessibleDistance)==null?Q_.maxAccessibleDistance:n,panoTapTriggerRadius:(r=t.panoTapTriggerRadius)==null?Q_.panoTapTriggerRadius:r,panoCircleMeshCreator:(i=t.panoCircleMeshCreator)==null?Q_.panoCircleMeshCreator:i,adjustPanoCircleMeshPositionBasedOnModel:(a=t.adjustPanoCircleMeshPositionBasedOnModel)==null?Q_.adjustPanoCircleMeshPositionBasedOnModel:a,tileLevelForFov:(o=t.tileLevelForFov)==null?Q_.tileLevelForFov:o,tileAppearDuration:(s=t.tileAppearDuration)==null?Q_.tileAppearDuration:s,tileMaxRequest:(c=t.tileMaxRequest)==null?Q_.tileMaxRequest:c,flyEffectUseDepthBuffer:(l=t.flyEffectUseDepthBuffer)==null?Q_.flyEffectUseDepthBuffer:l})}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`Panorama`})}constructor(n){let r=e.parseArgs(n);super(r),this.mode=`Panorama`,this.initAnimationed=!1,this.maxAccessibleDistance=r.maxAccessibleDistance,this.panoTapTriggerRadius=r.panoTapTriggerRadius,this.panoCircleMeshCreator=r.panoCircleMeshCreator,this.adjustPanoCircleMeshPositionBasedOnModel=r.adjustPanoCircleMeshPositionBasedOnModel,this.tileLevelForFov=r.tileLevelForFov,this.tileAppearDuration=r.tileAppearDuration,this.tileMaxRequest=r.tileMaxRequest,this.flyEffectUseDepthBuffer=r.flyEffectUseDepthBuffer,this.adjustPanoCircleMeshPositionFix=new Map;let i=this.modelScene.parameter.resolveValue(`pano0`),a=this.modelScene.parameter.resolveValue(`pano1`);i&&(a==null?void 0:a.map)!==i.map&&(this.modelScene.parameter.set({pano0:a}),i.map.dispose());let o=new Set;i&&o.add(i),a&&o.add(a),this.panoMeshes=new Map,this.locationMotion=new X({count:0,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=Zt()]={panoId:Z(this.currentPano),panoPicture:this.modelScene.parameter.resolveValue(`pano1`),position:this.camera.pose.offset.clone(),effect:q_,effectEasing:J_,fixCameraTransform:new t.Matrix4},this.panoPictureObserverMap=new WeakMap,this.textureLoader=new fi,this.tiling=new L_({fiveId:this.fiveId}),this.panoVideo=new H_,this.scene.add(this.panoVideo.object),this.accessibleObserverFloorCheckCount=0}get tileLevel(){return this.tiling.level}updateConfiguration(e){return super.updateConfiguration(e)===!1?!1:(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,this.panoMeshes&&(this.panoMeshes.forEach(e=>{this.helper.remove(e),e.dispose()}),this.panoMeshes.clear())),e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)}destroy(){super.destroy(),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),this.pendingPanoTask=void 0,this.panoMeshes&&(this.panoMeshes.forEach(e=>{this.helper.remove(e),e.dispose()}),this.panoMeshes.clear());let e=this.videoTexture.image;e.pause(),e.oncanplay=G,e.ontimeupdate=G,this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();let t=this.modelScene.parameter.resolveValue(`pano0`),n=this.modelScene.parameter.resolveValue(`pano1`);for(let e of Object.keys(this.panoResources)){let r=this.panoResources[e];if(r.panoPicture){let e=r.panoPicture.map;e&&e!==(t==null?void 0:t.map)&&e!==(n==null?void 0:n.map)&&(e.dispose(),r.panoPicture=null)}delete this.panoResources[e]}}isReady(){return this.locationMotion.ended===!0?super.isReady():!1}isTileReady(){let e=this.tiling.pedding<=0;return this.initAnimationed&&e}updateWork(t,n,r,i){this.userAction=i,this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));return(a.workCode!==this.currentPano.workCode||a.panoIndex!==this.currentPano.panoIndex||a.longitude!==this.cameraMotion.value.longitude||a.latitude!==this.cameraMotion.value.latitude||a.fov!==this.cameraMotion.value.fov)&&(this.initAnimationed=!1,this.moveToPano({workCode:a.workCode,panoIndex:a.panoIndex},{effect:r.effect,duration:r.duration,longitude:a.longitude,latitude:a.latitude,fov:a.fov,moveEndCallback:()=>{this.initAnimationed=!0},moveCancelCallback:()=>{this.initAnimationed=!0}},i)),!0}updateModel(e){this.modelScene=e,this.hideIntersectMesh()}updateTime(e,n,...r){var i,a,o,s,c,l;if(this.destroyed)return;let u={},d={},f=this.camera.getDirection(new t.Vector3),p=this.locationMotion.keyframes[0],m=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[h,g]=this.locationMotion.getKeyFrameSegment(e),_=this.panoResourceFromLocationMotionKeyframe(h),v=this.panoResourceFromLocationMotionKeyframe(g),y=this.panoResourceFromLocationMotionKeyframe(p),b=this.panoResourceFromLocationMotionKeyframe(m),x=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),d.longitude=this.cameraMotion.value.longitude,d.latitude=this.cameraMotion.value.latitude,d.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),u.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let n=this.locationMotion.value.count-g.value.count+1,r=new t.Vector3().copy(_.position),o=new t.Vector3().copy(v.position);if(u.progress=v.effectEasing(n),n>=.01&&n<=.99&&(u.progress=H(v.effectEasing(n),.01,.99)),v.panoPicture&&(n<1?_.panoPicture&&(u.pano0=_.panoPicture):u.pano0=v.panoPicture,u.pano1=v.panoPicture),v.effect===`montage`?u.transition=`BLACK`:v.effect===`spread`?u.transition=`SPREAD`:u.transition=`FADE`,v.effect===`zoomin`||v.effect===`zoomout`?u.progress=Math.pow(n,3):v.effect===`model`&&this.camera.pose.distance<.01&&(u.modelAlpha=1-Math.pow(H(Math.abs(n-.5)*2,0,1),4)),n<1&&v.effect!==`fly`&&v.effect!==`model`){if(u.pano0&&_.panoPicture){let e={panoId:u.pano0.panoId,map:u.pano0.map,mapHistogram:u.pano0.mapHistogram,mapSize:u.pano0.mapSize,zoom:u.pano0.zoom,matrix:_.panoPicture.matrix.clone().premultiply(_.fixCameraTransform).setPosition(v.position)},t=this.panoPictureObserverMap.get(u.pano0);t&&this.panoPictureObserverMap.set(e,t),u.pano0=e}r.copy(o),x=!0}d.distance=this.locationMotion.value.distance,d.offset=new t.Vector3(r.x+(o.x-r.x)*n,r.y+(o.y-r.y)*n,r.z+(o.z-r.z)*n);let s=[],c=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(s.push(t),n>this.locationMotion.progress&&c.push(t))}for(let e of Object.keys(this.panoResources)){if(c.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.panoPicture){let e=t.panoPicture.map;if(e){if(e===((i=u.pano0)==null?void 0:i.map)||e===((a=u.pano1)==null?void 0:a.map))continue;e.dispose(),t.panoPicture=null}}s.indexOf(e)>=0||delete this.panoResources[e]}let l=zp(v.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:zp(y.panoId),pano:zp(b.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},zp(b.panoId)),{mode:this.mode}),$(this.camera.pose)),d),options:{},progress:this.locationMotion.progress,error:null}))}Ng(u)===!1&&this.modelScene.parameter.set(u),Ng(d)===!1&&this.setCamera(d);let S=this.works.getObserver(this.currentPano),C=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,w=this.works.getObserver(_.panoId),T=this.works.getObserver(v.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&S){let e=[],n=S.work.observers;for(let t of S.accessibleNodes){let r=n[t];r&&e.push(r)}let r=new Map;if(e.sort((e,t)=>{let n=r.get(e);n===void 0&&(n=e.standingPosition.distanceTo(S.standingPosition),r.set(e,n));let i=r.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(S.standingPosition),r.set(t,i)),n-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let n=e[this.accessibleObserverFloorCheckCount],r=this.modelScene.models.find(e=>e.work===(n==null?void 0:n.work));if(n&&r&&r.visible){let e=.3,i=.005,a=n.standingPosition.clone().applyMatrix4(n.work.transform),o=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),s=Z_.map(n=>{Y_.ray.origin.copy(a),Y_.ray.origin.add(X_.copy(n).setY(e)),Y_.ray.direction.set(0,-1,0),Y_.firstHitOnly=!0,Y_.floorIndex=-1;let[o]=r.intersectRaycaster(Y_);return o&&o.distance-i<=e?new t.Vector3().copy(a).setY(o.point.y+i):a});s.sort((e,t)=>t.y-e.y);let c=s[Math.floor(s.length/2)],[l]=s.filter(e=>e.distanceTo(c)<=.05);if(l){let e=new t.Vector4(a.x,a.y,a.z,l.y-a.y),n=this.adjustPanoCircleMeshPositionFix.get(o);n&&!e.equals(n)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(o,e)}}this.accessibleObserverFloorCheckCount++}}let E=new Map;if(w)for(let e of w.accessibleNodes){let t=w.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});E.set(e,t)}}if(T)for(let e of T.accessibleNodes){let t=T.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});E.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{E.get(t)?E.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),E.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),E.delete(t)}),this.panoMeshes.forEach((e,n)=>{let r=this.works.getObserver(n);if(r){let i=r.position.distanceTo(r.standingPosition)>this.aerialObserverMinHeight;if(i)e.position.copy(r.position).applyMatrix4(r.work.transform),e.scale.setScalar(18);else{e.position.copy(r.standingPosition).applyMatrix4(r.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(r.panoId);t&&(X_.set(t.x,t.y,t.z),X_.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let a=this.camera.position.clone().setY(e.position.y),o=new t.Vector3().copy(e.position).sub(a).normalize();if(n===Z(this.currentPano)){let t=H((.5-a.distanceTo(e.position))/.5,0,1);o.multiplyScalar(1-t).add(f.clone().multiplyScalar(t))}if(o.length()>0){let n=i?-Math.PI/2:0,r=Math.atan2(o.x,o.z);e.quaternion.setFromEuler(new t.Euler(n,r,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||x)this.panoMeshes.forEach(t=>{t.setOpacity(0),t.setCurrent(!1),t.updateTime&&t.updateTime(e,n),t.visible=!1});else if(S){let t=S.work.observers,[,r]=vu(S.accessibleNodes,e=>{let n=t[e];return!n||!n.active?1/0:S.standingPosition.distanceTo(n.standingPosition)},!0);r=H(r,3,1/0);let i=S.accessibleNodes.concat(S.panoIndex).map(e=>Z({panoIndex:e,workCode:S.work.workCode}));this.panoMeshes.forEach((t,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=t.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!t.loading&&t.progress===0&&C!==null&&Z({panoIndex:C.panoIndex,workCode:C.work.workCode})===a;let n=t.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=n<.01?0:H(r/n,.1,.85)}o&&o===T&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&t.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(c=0),t.setCurrent(s),t.setOpacity(c),t.updateTime&&t.updateTime(e,n)})}{let e=(o=this.modelScene.parameter.progress)==null?1:o,n=Math.round(e),r=this.modelScene.parameter.pano0,i=this.modelScene.parameter.pano1,a=n===0?r:i,c;if(a&&(c=this.works.getObserver(a.panoId),c||(c=this.panoPictureObserverMap.get(a))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(ii()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!c||!a||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new t.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Yr(a.mapSize),o=e+1,l=new t.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),u=Math.floor(this.tileLevelForFov(this.camera.fov,l)),d=u>e?u:0;this.tiling.setObserver(c);let f={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:a.map,panoMatrix:a.matrix,panoZoom:a.zoom,minLevel:o,level:d},p=this.tiling.update(f),m={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:n,opacity:(r==null?void 0:r.panoId)===(i==null?void 0:i.panoId)?1:Ed(Math.abs(((s=this.modelScene.parameter.progress)==null?0:s)-.5)*2)},h=this.modelScene.parameter.refinedScreen;(p||m.pano!==(h==null?void 0:h.pano)||m.opacity!==(h==null?void 0:h.opacity))&&this.modelScene.parameter.set(`refinedScreen`,m)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),S&&S.images.video&&(this.needsRender=!0),this.intersectMesh&&this.intersectMesh.parent&&S&&S.position.y-S.standingPosition.y>10){let e=H(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=v.effect,{pano0:n,pano1:r}=this.modelScene.parameter;if(n&&r&&n!==r&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((c=this.modelScene.parameter.pano0Depth)==null?void 0:c.panoId)!==n.panoId||((l=this.modelScene.parameter.pano1Depth)==null?void 0:l.panoId)!==r.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1});let e=new t.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(n.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,K_(this.renderer,this.modelScene,e,500);let i=new t.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);i.matrix.copy(r.matrix),i.matrixWorld.copy(i.matrix),i.matrixAutoUpdate=!1,K_(this.renderer,this.modelScene,i,500),this.modelScene.parameter.set({pano0Depth:{panoId:n.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:r.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))}}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(V())[1],t=this.locationMotion.getKeyFrameSegment(V())[1],n=this.panoResourceFromLocationMotionKeyframe(t),r=this.works.getObserver(n.panoId);return{workCode:r?r.work.workCode:this.currentPano.workCode,panoIndex:r?r.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:r?r.position.clone().applyMatrix4(r.work.transform):this.camera.position.clone(),distance:this.locationMotion.value.distance}}moveToPano(e,n,r){var i,a,o;this.userAction=r,this.stopMomentumMovement();let s=Z(e),c=this.works.getObserver(e);if(!c)throw Error(`Invalid PanoId ${JSON.stringify(e)}`);let l=Kr(c.images.up),u=this.imageOptions.size;u===void 0&&c&&l&&(u=Number(l)),u===void 0&&(u=2048);let d=this.imageOptions.transform,f=Object.assign({key:`pano.${s}`},dr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),p={right:c.images.work.getURL(c.images.right),left:c.images.work.getURL(c.images.left),up:c.images.work.getURL(c.images.up),down:c.images.work.getURL(c.images.down),front:c.images.work.getURL(c.images.front),back:c.images.work.getURL(c.images.back)},m=`pano:`+Lp([p,f,d]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===m)return;{let e=this.pendingPanoTask.panoId;(i=this.panoMeshes.get(e))==null||i.setProgress(0),this.emit(`pano.texture.abort`,Q(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode}}))}}let h=`move-to-pano-`+s;this.pending.add(h);let g=wg(`pano.prepare`,{options:n,prevMode:this.mode,prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,g),g.defaultPrevented){this.pending.delete(h);return}g.options!==n&&Object.assign(n,g.options);let _=this.modelScene.parameter,v;_.pano0&&_.pano0.map.name===m?v=_.pano0:_.pano1&&_.pano1.map.name===m&&(v=_.pano1);let y=(a=n.effect)==null?q_:a,b=(o=n.effectEasing)==null?J_:o;if(v){let r={panoId:s,effect:y,effectEasing:b,panoPicture:{panoId:v.panoId,map:v.map,mapHistogram:v.mapHistogram,mapSize:v.mapSize,matrix:c.matrix.clone().premultiply(c.work.transform),zoom:1},position:c.position.clone().applyMatrix4(c.work.transform),fixCameraTransform:new t.Matrix4};r.panoPicture&&this.panoPictureObserverMap.set(r.panoPicture,c),this.pendingPanoTask=void 0,Promise.resolve().then(()=>Tg(g)).catch(e=>qg(e)).then(t=>{var i,a;if(!(t instanceof Error))this.pending.delete(h),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0),this.doMoveToPano(e,r,n);else{let e=null;t instanceof Error&&(e||(e=t));let r=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),n.moveCancelCallback&&n.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(h),this.pendingPanoTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)}});return}let x=this.panoMeshes.get(s);x&&x.tap&&x.tap(),this.pendingPanoTask={panoId:s,hash:m,onLoad:r=>{var i;let a=r.body;if(this.destroyed)a.dispose();else{a.name=m;let r=Array.isArray(a.image)?a.image[0]:a.image,o=(i=r==null?void 0:r.width)==null?2048:i,l=c.images.histogram;l||(l=new Hm().formPixels(Vg(this.renderer,a,!0,Rm).data),c.images.histogram=l);let u={panoId:s,effect:y,effectEasing:b,panoPicture:{panoId:s,map:a,mapSize:o,mapHistogram:new t.Vector4().fromArray(l.toArray()),matrix:c.matrix.clone().premultiply(c.work.transform),zoom:1},position:c.position.clone().applyMatrix4(c.work.transform),fixCameraTransform:new t.Matrix4};u.panoPicture&&this.panoPictureObserverMap.set(u.panoPicture,c),this.doMoveToPano(e,u,n)}},onError:e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),n.moveCancelCallback&&n.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),e instanceof Error&&e.message&&this.emit(`error`,e)}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(p,{imageURL:{transform:d,options:f},format:t.RGBFormat,viaAjax:!0,fetcher:Kf(this.fiveId,c.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,Q(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===m&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=qg(t);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>Tg(g)).catch(e=>qg(e))]).then(([t,n])=>{var r,i,a,o;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(h),((r=this.pendingPanoTask)==null?void 0:r.hash)===m?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,Q(`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(h),((a=this.pendingPanoTask)==null?void 0:a.hash)===m&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(s))==null||o.setProgress(0))}})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{duration:n,effect:r,userAction:i}=this.initial;this.userAction=i;let a=e.initAnimationEndState(this),o={workCode:a.workCode,panoIndex:a.panoIndex},s=!1;this.moveToPano(o,{longitude:a.longitude,latitude:a.latitude,fov:a.fov,effect:r,duration:n,moveStartCallback:e=>{s=!0,this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction}))},moveEndCallback:e=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),this.initAnimationed=!0,t()},moveCancelCallback:()=>{let e=Object.assign(Object.assign(Object.assign({},o),{mode:this.mode}),$(this.camera.pose));s===!1&&this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction})),this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),this.initAnimationed=!0,t()}},i)})}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}locationMotionKeyframesLength(e){let t=0;for(let n=1;n<e.length;n++){let r=this.panoResourceFromLocationMotionKeyframe(e[n-1]).position,i=this.panoResourceFromLocationMotionKeyframe(e[n]).position,a=r.distanceTo(i)*(e[n].value.count-e[n-1].value.count);t+=a}return t}doMoveToPano(e,n,r={}){var i,a,o,s,c,l,u,d,f,p,m;let h=V(),g=Zt();this.panoResources[g]=n;let _,v,y;if(this.locationMotion.ended){let[e,t]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,a=((i=this.panoResourceFromLocationMotionKeyframe(t))==null?this.camera:i).position,o=n.position;_=Math.max(a.distanceTo(o),1),v=[{key:t.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:g,progress:1,value:{distance:0,count:1}}],y=0}else{let[e,t]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(t).position,o=n.position,s=t.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;_=c+Math.max(a.distanceTo(o),1),v=[{key:e.key,progress:0,value:Object.assign({},r)},{key:t.key,progress:c/_,value:t.value},{key:g,progress:1,value:{count:t.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(v);y=l===0||l===0?0:this.locationMotion.getProgressVelocity(h)*l/u}let b=n.effect===`instant`?0:this.calculateMovingDuration(r.duration,n.effect===`fly`||n.effect===`model`?_:0),x={longitude:r.longitude,latitude:r.latitude,fov:r.fov},S=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(a=x.longitude)==null?this.camera.pose.longitude:a,latitude:(o=x.latitude)==null?this.camera.pose.latitude:o,fov:(s=x.fov)==null?this.camera.pose.fov:s,offset:n.position.clone(),distance:this.camera.pose.distance}),C=this.currentPano;if(this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:r,prevPano:C,pano:{panoIndex:S.panoIndex,workCode:S.workCode},progress:0,state:S,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(S),this.perspToOrthoMotion.set({perspToOrtho:0},b).catch(G),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],b).catch(G),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=G,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),n.effect===`fly`||n.effect===`model`)this.cameraMotion.set(x,b).catch(G);else{let e=It({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),r=It({longitude:(c=x.longitude)==null?this.cameraMotion.value.longitude:c,latitude:(l=x.latitude)==null?this.cameraMotion.value.latitude:l}),i=new t.Object3D;i.lookAt(e);let a=new t.Matrix4().makeRotationFromQuaternion(i.quaternion);i.lookAt(r);let o=new t.Matrix4().makeRotationFromQuaternion(i.quaternion),s=new t.Matrix4().getInverse(a).premultiply(o),h=this.cameraMotion.value.fov,g=(u=x.fov)==null?this.cameraMotion.value.fov:u,_=1;n.effect===`zoomin`?_=1.5:n.effect===`zoomout`&&(_=.4);let y=H(g*_,1,170);for(let e=0;e<v.length-1;e++){let t=v[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(s),e.panoPicture&&(e.panoPicture.zoom=Math.tan(y/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(d=x.longitude)==null?this.cameraMotion.value.longitude:d,latitude:(f=x.latitude)==null?this.cameraMotion.value.latitude:f,fov:y}},{progress:1,value:{longitude:(p=x.longitude)==null?this.cameraMotion.value.longitude:p,latitude:(m=x.latitude)==null?this.cameraMotion.value.latitude:m,fov:g}}],b).catch(G)}this.locationMotion.setKeyframes(v,b,y).then(()=>{for(let e of this.modelScene.children)e instanceof dp&&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:this.camera.pose.distance});this.emit(`pano.arrived`,Q(`pano.arrived`,{options:r,prevPano:C,pano:{panoIndex:t.panoIndex,workCode:t.workCode},progress:1,state:t,userAction:this.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(t);let n=this.works.getObserver(e);if(n&&n.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:n.images.video.size.clone(),matrix:n.images.video.matrix.clone(),panoMatrix:n.matrix.clone().premultiply(n.work.transform),alpha:1},t=Zt(),r=this.videoTexture.image;r.setAttribute(`uuid`,t),r.oncanplay=G,r.ontimeupdate=G,i_().then(i=>{i&&n.images.video&&r.getAttribute(`uuid`)===t&&(r.oncanplay=()=>{r.oncanplay=G,r.play()},r.ontimeupdate=()=>{r.currentTime>.5&&(r.ontimeupdate=G,this.panoVideo.setMaterial(e))},r.src=n.images.video.source)}).catch((()=>{r.removeAttribute(`uuid`)}))}else{let e=this.videoTexture.image;e.removeAttribute(`uuid`),e.oncanplay=G,e.ontimeupdate=G}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{options:r,prevPano:C,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),r.moveCancelCallback&&r.moveCancelCallback()})}getForwardObserverOrNot(e,n){let r=this.works.getObserver(this.currentPano);if(!r)return null;let i=n==null?new t.Raycaster(e.position.clone(),e.getWorldDirection(new t.Vector3)):n;i.params.Points={threshold:.1},i.firstHitOnly=!0,i.floorIndex=-1;let a=r.standingPosition.clone().applyMatrix4(r.work.transform);if(r.position.clone().applyMatrix4(r.work.transform).distanceTo(i.ray.origin)>1){let e=new t.Raycaster(i.ray.origin,new t.Vector3(0,-1,0));e.firstHitOnly=i.firstHitOnly,e.floorIndex=i.floorIndex;let[n]=this.modelScene.intersectRaycaster(e);n&&n.distance<=2?a.copy(n.point):a.copy(i.ray.origin).add(new t.Vector3(0,-1.5,0))}let[o]=this.modelScene.intersectRaycaster(i),s=(o?o.point:i.ray.origin.clone().add(i.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(a).normalize();if(s.length()===0)return null;let c=r.work.observers,l=r.accessibleNodes.filter(t=>{if(t===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let n=c[t];if(!n)return!1;let i=n.standingPosition.clone().applyMatrix4(n.work.transform).project(e);return Math.abs(i.z)>1||Math.abs(i.x)>1||Math.abs(i.y)>1?!1:n.loadable||n.active}),u=new Map,d=l.slice().sort((e,t)=>{let n=c[e],r=u.get(n);r===void 0&&(r=X_.copy(n.standingPosition).applyMatrix4(n.work.transform).distanceTo(a),u.set(n,r));let i=c[t],o=u.get(i);return o===void 0&&(o=X_.copy(i.standingPosition).applyMatrix4(i.work.transform).distanceTo(a),u.set(i,o)),r-o});u.clear();for(let e of[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3])for(let t of d){let n=c[t];if(n){let t=X_.copy(n.standingPosition).applyMatrix4(n.work.transform).sub(a);if(t&&t.length()!==0&&s.angleTo(t)<e)return n}}let f=null;if(n){let t=n.ray.intersectBox(this.modelScene.boundingBox,X_);t&&(t.project(e),Math.abs(t.z)<=1&&(f=t.clone()))}else f=new t.Vector3(0,0,0);if(f){let t=r.accessibleNodes.filter(t=>{if(t===this.currentPano.panoIndex&&r.work.workCode===this.currentPano.workCode)return!1;let n=c[t];if(!n)return!1;let i=n.position.clone().applyMatrix4(n.work.transform).project(e);return Math.abs(i.z)>1||Math.abs(i.x)>1||Math.abs(i.y)>1?!1:n.loadable||n.active}),n=new Map,i=t.slice().sort((t,r)=>{let i=c[t],a=n.get(i);a===void 0&&(a=X_.copy(i.position).applyMatrix4(i.work.transform).distanceTo(e.position),n.set(i,a));let o=c[r],s=n.get(o);return s===void 0&&(s=X_.copy(o.position).applyMatrix4(o.work.transform).distanceTo(e.position),n.set(o,s)),a-s});n.clear();for(let t of i){let n=c[t];if(n){let t=X_.copy(n.position).applyMatrix4(n.work.transform);if(t.project(e),Math.abs(t.z)>1)continue;if(Math.pow(f.x-t.x,2)+Math.pow(f.y-t.y,2)<Math.pow(.4,2))return n}}}return null}onTapGesture(e){var n;if(this.userAction=e.userAction,this.stopMomentumMovement(),!this.initAnimationed)return;let r=e.center.raycaster;r.floorIndex=-1;let i=this.camera.getDirection(new t.Vector3).setY(0),a=null,o=this.works.getObserver(this.currentPano);if(!o)return;let s=o.work.observers,c=o.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&o.work.workCode===this.currentPano.workCode)return!1;let t=s[e];return!t||X_.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[l]=this.modelScene.intersectRaycaster(r);if(l){let[e,t]=vu(c,e=>{let t=s[e];return t?X_.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(l.point):1/0},!0);typeof e==`number`&&t<this.panoTapTriggerRadius&&(a=(n=s[e])==null?null:n)}if(a||(a=this.getForwardObserverOrNot(this.camera,r)),a&&a.panoId===Z(this.currentPano)&&(a=null),a&&!this.locationMotion.ended){for(let e of this.locationMotion.keyframes)if(this.panoResourceFromLocationMotionKeyframe(e).panoId===a.panoId){a=null;break}}if(!a)this.emit(`gesture.tap`,e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{let t={},n=Math.PI/6,r=Math.PI/12,s=a.position.clone().applyMatrix4(a.work.transform).setY(0).sub(o.position.clone().applyMatrix4(a.work.transform).setY(0)).normalize(),c=[],l=[],u=[],d=a.work.observers;for(let e of a.accessibleNodes){if(a.panoIndex===e||e===this.currentPano.panoIndex&&a.work.workCode===this.currentPano.workCode)continue;let t=d[e];if(!t)continue;let r=t.position.clone().applyMatrix4(t.work.transform).sub(a.position.clone().applyMatrix4(a.work.transform)).setY(0).normalize();s.angleTo(r)<n&&u.push(r)}let[f]=(u.length>0?u:[...c,...l]).slice().sort((e,t)=>e.angleTo(s)-t.angleTo(s));if(f&&f.angleTo(i)>r&&(t.longitude=Math.atan2(-f.x,-f.z)),this.cameraMotion.value.latitude<-Math.PI/4){let n=e.state.fov;t.latitude=H(0,H(typeof this.minLatitude==`function`?this.minLatitude(n):this.minLatitude,-Math.PI/2,Math.PI/2),H(typeof this.maxLatitude==`function`?this.maxLatitude(n):this.maxLatitude,-Math.PI/2,Math.PI/2))}let p=Object.assign({},e.state);if(p.workCode=a.work.workCode,p.panoIndex=a.panoIndex,t.longitude!==void 0&&(p.longitude=t.longitude),t.latitude!==void 0&&(p.latitude=t.latitude),t.fov!==void 0&&(p.fov=t.fov),p.distance=0,p.offset=a.position.clone(),e.state=p,this.emit(`gesture.tap`,e),!e.defaultPrevented){if(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:p.panoIndex,workCode:p.workCode},state:p,userAction:e.userAction,options:t,progress:0,error:null})),a&&!a.active){let e=Z({panoIndex:a.panoIndex,workCode:a.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}a&&a.active&&this.emit(`pano.request`,Q(`pano.request`,{userAction:e.userAction,prevPano:this.currentPano,pano:{panoIndex:p.panoIndex,workCode:p.workCode},progress:0,state:p,options:t,error:null}))}}}},ev=Math.PI/180,tv=180/Math.PI,nv=.001,rv=1,iv=(()=>{let e=typeof navigator<`u`&&/iPad|iPhone|iPod/.test(navigator.platform);return()=>e})(),av=(()=>{let e=typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return()=>e})(),ov=(()=>{let e=typeof navigator<`u`&&navigator.userAgent.indexOf(`Firefox`)!==-1&&navigator.userAgent.indexOf(`Android`)!==-1;return()=>e})(),sv=(()=>{let e=typeof navigator<`u`?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,t=e?parseInt(e[1],10):null;return()=>t})(),cv=(()=>{let e=!1;if(sv()===65){let t=typeof navigator<`u`?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){let[n,r,i,a]=t[1].split(`.`);e=parseInt(i,10)===3325&&parseInt(a,10)<148}}return()=>e})(),lv=(()=>{let e=iv()&&av()&&typeof navigator<`u`&&navigator.userAgent.indexOf(`13_4`)!==-1;return()=>e})(),uv=(()=>{let e=typeof navigator<`u`&&navigator.userAgent.indexOf(`R7 Build`)!==-1;return()=>e})();function dv(){let e=typeof window<`u`&&(window.orientation==90||window.orientation==-90);return uv()?!e:e}function fv(e){return!(isNaN(e)||e<=nv||e>rv)}function pv(e){return e.w>1?0:2*Math.acos(e.w)}var mv=(()=>{let e={};return(t,n)=>{e[t]===void 0&&(console.warn(`cardboard: `+n),e[t]=!0)}})();function hv(e){let t,n=e.indexOf(`://`);t=n===-1?0:n+3;let r=e.indexOf(`/`,t);return r===-1&&(r=e.length),e.substring(0,r)}function gv(){if(typeof window>`u`||typeof document>`u`)return!1;let e=window.self!==window.top,t=hv(document.referrer),n=hv(window.location.href);return e&&t!==n}var _v=(()=>{function e(e,t,n){let r=t?t[0]:0,i=t?t[1]:0,a=t?t[2]:0,o=t?t[3]:1,s=r+r,c=i+i,l=a+a,u=r*s,d=r*c,f=r*l,p=i*c,m=i*l,h=a*l,g=o*s,_=o*c,v=o*l;return e[0]=1-(p+h),e[1]=d+v,e[2]=f-_,e[3]=0,e[4]=d-v,e[5]=1-(u+h),e[6]=m+g,e[7]=0,e[8]=f+_,e[9]=m-g,e[10]=1-(u+p),e[11]=0,e[12]=n?n[0]:0,e[13]=n?n[1]:0,e[14]=n?n[2]:0,e[15]=1,e}function t(e,t,n){let r=n[0],i=n[1],a=n[2],o,s,c,l,u,d,f,p,m,h,g,_;return t===e?(e[12]=t[0]*r+t[4]*i+t[8]*a+t[12],e[13]=t[1]*r+t[5]*i+t[9]*a+t[13],e[14]=t[2]*r+t[6]*i+t[10]*a+t[14],e[15]=t[3]*r+t[7]*i+t[11]*a+t[15]):(o=t[0],s=t[1],c=t[2],l=t[3],u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],e[0]=o,e[1]=s,e[2]=c,e[3]=l,e[4]=u,e[5]=d,e[6]=f,e[7]=p,e[8]=m,e[9]=h,e[10]=g,e[11]=_,e[12]=o*r+u*i+m*a+t[12],e[13]=s*r+d*i+h*a+t[13],e[14]=c*r+f*i+g*a+t[14],e[15]=l*r+p*i+_*a+t[15]),e}function n(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(A=1/A,e[0]=(s*k-c*O+l*D)*A,e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null}return(r,i,a)=>{e(r,i),a&&t(r,r,a),n(r,r)}})(),vv=class{constructor(e=new t.Vector3,n=0){this.sample=e,this.timestampS=n}set(e,t){this.sample=e,this.timestampS=t}copy(e){this.set(e.sample,e.timestampS)}},yv=class{constructor(e,n){this.kFilter=e,this.isDebug=n,this.currentAccelMeasurement=new vv,this.currentGyroMeasurement=new vv,this.previousGyroMeasurement=new vv,iv()?this.filterQ=new t.Quaternion(-1,0,0,1):this.filterQ=new t.Quaternion(1,0,0,1),this.previousFilterQ=new t.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new t.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new t.Vector3,this.measuredGravity=new t.Vector3,this.gyroIntegralQ=new t.Quaternion}addAccelMeasurement(e,t){this.currentAccelMeasurement.set(e,t)}addGyroMeasurement(e,t){this.currentGyroMeasurement.set(e,t),fv(t-this.previousGyroMeasurement.timestampS)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)}getOrientation(){return this.filterQ}run_(){if(!this.isOrientationInitialized){this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),this.isOrientationInitialized=!0;return}let e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,n=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(n),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(n);let r=new t.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();let i=new t.Quaternion;i.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),i.inverse(),this.isDebug&&console.log(`Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)`,tv*pv(i),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));let a=new t.Quaternion;a.copy(this.filterQ),a.multiply(i),this.filterQ.slerp(a,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)}accelToQuaternion_(e){let n=new t.Vector3;n.copy(e),n.normalize();let r=new t.Quaternion;return r.setFromUnitVectors(new t.Vector3(0,0,-1),n),r.inverse(),r}gyroToQuaternionDelta_(e,n){let r=new t.Quaternion,i=new t.Vector3;return i.copy(e),i.normalize(),r.setFromAxisAngle(i,e.length()*n),r}},bv=class{constructor(e,n){this.predictionTimeS=e,this.isDebug=n,this.previousQ=new t.Quaternion,this.previousTimestampS=null,this.deltaQ=new t.Quaternion,this.outQ=new t.Quaternion}getPrediction(e,n,r){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=r,e;let i=new t.Vector3;i.copy(n),i.normalize();let a=n.length();if(a<ev*20)return this.isDebug&&console.log(`Moving slowly, at %s deg/s: no prediction`,(tv*a).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;let o=a*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(i,o),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=r,this.outQ}},xv=class{constructor(e){this.coefficients=e}distortInverse(e){let t=0,n=1,r=e-this.distort(t);for(;Math.abs(n-t)>1e-4;){let i=e-this.distort(n),a=n-i*((n-t)/(i-r));t=n,n=a,r=i}return n}distort(e){let t=e*e,n=0;for(let e=0;e<this.coefficients.length;e++)n=t*(n+this.coefficients[e]);return(n+1)*e}},Sv=class{constructor(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}},Cv=class{constructor(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}},wv=class{constructor(e,n,r,i){this.viewer={id:`CardboardV1`,label:`Cardboard I/O 2014`,fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]},this.device={widthMeters:.11,heightMeters:.062,bevelMeters:.004},this.depthNear=.01,this.depthFar=1e4,this.yawOnly=r,this.accelerometer=new t.Vector3,this.gyroscope=new t.Vector3,this.filter=new yv(e,i),this.posePredictor=new bv(n,i),this.isFirefoxAndroid=ov(),this.isIOS=iv();let a=sv();this.isDeviceMotionInRadians=!this.isIOS&&a!==null&&a<66,this.isWithoutDeviceMotion=cv()||lv(),this.filterToWorldQ=new t.Quaternion,iv()?this.filterToWorldQ.setFromAxisAngle(new t.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new t.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new t.Quaternion,this.worldToScreenQ=new t.Quaternion,this.originalPoseAdjustQ=new t.Quaternion;let o=typeof window<`u`?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new t.Vector3(0,0,1),o),this.setScreenTransform_(),dv()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new t.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}getPosition(){return null}getOrientation(){let e;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(function(){let e=new t.Quaternion().setFromAxisAngle(new t.Vector3(0,0,-1),0),n=new t.Quaternion;return typeof window<`u`&&window.orientation===-90?n.setFromAxisAngle(new t.Vector3(0,1,0),Math.PI/-2):n.setFromAxisAngle(new t.Vector3(0,1,0),Math.PI/2),e.multiply(n)})(),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||(function(){let e=new t.Quaternion;return e.setFromAxisAngle(new t.Vector3(1,0,0),-Math.PI/2),e})(),e=this._deviceOrientationQ;let n=new t.Quaternion;return n.copy(e),n.multiply(this.deviceOrientationFilterToWorldQ),n.multiply(this.resetQ),n.multiply(this.worldToScreenQ),n.multiplyQuaternions(this.deviceOrientationFixQ,n),this.yawOnly&&(n.x=0,n.z=0,n.normalize()),this.orientationOut_[0]=n.x,this.orientationOut_[1]=n.y,this.orientationOut_[2]=n.z,this.orientationOut_[3]=n.w,this.orientationOut_}else{let t=this.filter.getOrientation();e=this.posePredictor.getPrediction(t,this.gyroscope,this.previousTimestampS)}let n=new t.Quaternion;return n.copy(this.filterToWorldQ),n.multiply(this.resetQ),n.multiply(e),n.multiply(this.worldToScreenQ),this.yawOnly&&(n.x=0,n.z=0,n.normalize()),this.orientationOut_[0]=n.x,this.orientationOut_[1]=n.y,this.orientationOut_[2]=n.z,this.orientationOut_[3]=n.w,this.orientationOut_}getPose(){let e=new Sv;return e.orientation=this.getOrientation(),e}resetPose(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),dv()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)}getFrameData(e){let t=this.getOrientation(),n=this.getEyeOffset(),r=this.getEyeProjectionMatrix();return e.pose.angularAcceleration=null,e.pose.angularVelocity=null,e.pose.linearAcceleration=null,e.pose.linearVelocity=null,e.pose.orientation=t,e.pose.position=null,e.timestamp=this.previousTimestampS,e.leftProjectionMatrix.set(r.left),e.rightProjectionMatrix.set(r.right),_v(e.leftViewMatrix,t,n.left),_v(e.rightViewMatrix,t,n.right),e}start(){if(typeof window>`u`)return()=>{};let e=this.onDeviceMotion_.bind(this),t=this.onOrientationChange_.bind(this),n=this.onMessage_.bind(this),r=this.onDeviceOrientation_.bind(this);return iv()&&gv()&&window.addEventListener(`message`,n),window.addEventListener(`orientationchange`,t),this.isWithoutDeviceMotion?window.addEventListener(`deviceorientation`,r):window.addEventListener(`devicemotion`,e),()=>{window.removeEventListener(`devicemotion`,e),window.removeEventListener(`deviceorientation`,t),window.removeEventListener(`orientationchange`,t),window.removeEventListener(`message`,n)}}getEyeOffset(){return{left:[-this.viewer.interLensDistance*.5,0,0],right:[this.viewer.interLensDistance*.5,0,0]}}getEyeProjectionMatrix(){let e=this.getEyeFieldOfView(),t=this.depthNear,n=this.depthFar,r={left:[],right:[]};{let i=e.left.upDegrees*ev,a=e.left.downDegrees*ev,o=e.left.leftDegrees*ev,s=e.left.rightDegrees*ev,c=2/(o+s),l=2/(i+a);r.left[0]=c,r.left[1]=0,r.left[2]=0,r.left[3]=0,r.left[4]=0,r.left[5]=l,r.left[6]=0,r.left[7]=0,r.left[8]=-((o-s)*c*.5),r.left[9]=(i-a)*l*.5,r.left[10]=n/(t-n),r.left[11]=-1,r.left[12]=0,r.left[13]=0,r.left[14]=n*t/(t-n),r.left[15]=0}{let i=e.right.upDegrees*ev,a=e.right.downDegrees*ev,o=e.right.leftDegrees*ev,s=e.right.rightDegrees*ev,c=2/(o+s),l=2/(i+a);r.right[0]=c,r.right[1]=0,r.right[2]=0,r.right[3]=0,r.right[4]=0,r.right[5]=l,r.right[6]=0,r.right[7]=0,r.right[8]=-((o-s)*c*.5),r.right[9]=(i-a)*l*.5,r.right[10]=n/(t-n),r.right[11]=-1,r.right[12]=0,r.right[13]=0,r.right[14]=n*t/(t-n),r.right[15]=0}return r}getEyeFieldOfView(){let e=this.viewer,t=this.device,n=new xv(e.distortionCoefficients),r=e.screenLensDistance,i=(t.widthMeters-e.interLensDistance)/2,a=e.interLensDistance/2,o=e.baselineLensDistance-t.bevelMeters,s=t.heightMeters-o,c=tv*Math.atan(n.distort(i/r)),l=tv*Math.atan(n.distort(a/r)),u=tv*Math.atan(n.distort(o/r)),d=tv*Math.atan(n.distort(s/r)),f=new Cv,p=new Cv;return f.leftDegrees=Math.min(c,e.fov),f.rightDegrees=Math.min(l,e.fov),f.downDegrees=Math.min(u,e.fov),f.upDegrees=Math.min(d,e.fov),p.leftDegrees=f.rightDegrees,p.rightDegrees=f.leftDegrees,p.upDegrees=f.upDegrees,p.downDegrees=f.downDegrees,{left:f,right:p}}onDeviceOrientation_(e){this._deviceOrientationQ=this._deviceOrientationQ||new t.Quaternion;let{alpha:n,beta:r,gamma:i}=e;n=(n||0)*Math.PI/180,r=(r||0)*Math.PI/180,i=(i||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new t.Euler(n,r,-i,`YXZ`))}onDeviceMotion_(e){this.updateDeviceMotion_(e)}updateDeviceMotion_(e){let t=e.accelerationIncludingGravity,n=e.rotationRate,r=e.timeStamp/1e3,i=r-this.previousTimestampS;if(i<0){mv(`fusion-pose-sensor:invalid:non-monotonic`,`Invalid timestamps detected: non-monotonic timestamp from devicemotion`),this.previousTimestampS=r;return}else if(i<=nv||i>rv){mv(`fusion-pose-sensor:invalid:outside-threshold`,`Invalid timestamps detected: Timestamp from devicemotion outside expected range.`),this.previousTimestampS=r;return}t&&(this.accelerometer.set(-t.x,-t.y,-t.z),n&&(uv()?this.gyroscope.set(-n.beta,n.alpha,n.gamma):this.gyroscope.set(n.alpha,n.beta,n.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,r)),this.filter.addAccelMeasurement(this.accelerometer,r)),this.previousTimestampS=r}onOrientationChange_(){this.setScreenTransform_()}onMessage_(e){let t=e.data;!t||!t.type||t.type.toLowerCase()===`devicemotion`&&this.updateDeviceMotion_(t.deviceMotionEvent)}setScreenTransform_(){switch(this.worldToScreenQ.set(0,0,0,1),typeof window<`u`?window.orientation:0){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new t.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new t.Vector3(0,0,1),Math.PI/2);break;case 180:break}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()}},Tv=[0,0,.5,1],Ev=[.5,0,.5,1],Dv=class{constructor(e){this.renderer=e,this.sensor=new wv(.98,.04,!1,!1),this.scale=1,this.cameraL=new t.PerspectiveCamera,this.cameraR=new t.PerspectiveCamera;let n=this.sensor.start();this.dispose=()=>{let e=this.renderer.getSize(new t.Vector2);this.renderer.setScissor(0,0,e.width,e.height),this.renderer.setViewport(0,0,e.width,e.height),this.renderer.setScissorTest(!1),n()}}render(e,n){let r=this.renderer.getSize(new t.Vector2);if(r.width>r.height){var i=e.autoUpdate;i&&(e.updateMatrixWorld(),e.autoUpdate=!1);let a={x:Math.round(r.width*Tv[0]),y:Math.round(r.height*Tv[1]),width:Math.round(r.width*Tv[2]),height:Math.round(r.height*Tv[3])},o={x:Math.round(r.width*Ev[0]),y:Math.round(r.height*Ev[1]),width:Math.round(r.width*Ev[2]),height:Math.round(r.height*Ev[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),n.parent===null&&n.updateMatrixWorld(),n.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),n.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);let s=this.sensor.getEyeOffset();this.cameraL.translateOnAxis(new t.Vector3().fromArray(s.left),this.scale),this.cameraR.translateOnAxis(new t.Vector3().fromArray(s.right),this.scale);let c=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=c.left.slice(),this.cameraR.projectionMatrix.elements=c.right.slice(),this.renderer.setViewport(a.x,a.y,a.width,a.height),this.renderer.setScissor(a.x,a.y,a.width,a.height),this.renderer.render(e,this.cameraL),this.renderer.setViewport(o.x,o.y,o.width,o.height),this.renderer.setScissor(o.x,o.y,o.width,o.height),this.renderer.render(e,this.cameraR),this.renderer.setViewport(0,0,r.width,r.height),this.renderer.setScissor(0,0,r.width,r.height),this.renderer.setScissorTest(!1),i&&(e.autoUpdate=!0)}else this.renderer.render(e,n)}dispose(){}},Ov=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaAAAC/VBMVEUAAAD///99fX37+/v5+fn29vbx8fHv7+/Nzc3o6Ojq6urh4eHU1NTR0dGDg4Pl5eWSkpLHx8fj4+Pe3t7X19fAwMDZ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5294RAc40RVoftY47cd2LKtMOFwkajzuAeVOlIhfJeKahLyiWJRhLr3Ai2BVzQYKG4lLYXfg8HCSI33a2nTH5OaVWmzYHJGhsdLmDuN2exAonBTzZIuzEUS+ec0ZMBQn+Ea5KlXNI4C/UAO/k6hKwBptJgn8fgmVckgFXML9YEEFLUKMvlqAp0eWyDEAL65dLqyWo6RekTZ2XNCsD6rgpTK/4p3WcrrPH1ghWJGhONC3JoGAkRHH1JKjpNEcCxOV2I8MWyiUJqNVajSVodgiWcVMVLVeSS1ATCZoc88qjVKlSc3kSLJ5c5V6rTZQAcVkGbBeuOkgCgq2CBM3MoFwGr1tvim2aMpZZqyBBc3N1UF2GX90j9SQJKCBB83OfYAcNVjFcSrvzo95WOShB83Ody5V24fqzO0nAUSzB/89Nph38VqmuOa3gticJOP9fApuHTDt4nFJ7AXdPC0lg8/gq8y5XapSrgpUgbQ0JpF5u97hS1fOC26nlJJA8Yd41Sg3fU4dtRQkKeXSN3jo4Qqm0397OmyZOGatoDrScBIWM3DFn5kXi1ZyqRSUoZtKOa1vWKArztqgEnhIHty4f9/btuEstKwGkxf+XuCT5CbTFnFRuxktuAAAAAElFTkSuQmCC`,Av,jv={zh:{TITLE:`眼镜模式`,HIT:`请将手机横屏放入 VR 眼镜中`},en:{TITLE:`GLASSES MODE`,HIT:`Please put the mobile phone horizontally into the VR glasses.`},ja:{TITLE:`メガネモード`,HIT:`携帯電話をVRメガネに水平に入れてください。`}},Mv=typeof navigator<`u`?(Av=jv[navigator.language.split(`-`)[0]])==null?jv.zh:Av:jv.zh,Nv=`
|
|
2284
2284
|
<style>
|
|
2285
2285
|
.$id {
|
|
2286
2286
|
all: initial;
|
|
@@ -2363,7 +2363,7 @@ void main() {
|
|
|
2363
2363
|
.$id-modal-content-guide-cardboard-image {
|
|
2364
2364
|
width: 100px;
|
|
2365
2365
|
height: 82px;
|
|
2366
|
-
background-image: url(${
|
|
2366
|
+
background-image: url(${Ov});
|
|
2367
2367
|
background-size: 100%;
|
|
2368
2368
|
background-repeat: no-repeat;
|
|
2369
2369
|
}
|
|
@@ -2405,7 +2405,7 @@ void main() {
|
|
|
2405
2405
|
.$id-modal-content-guide-phone-image {
|
|
2406
2406
|
width: 58px;
|
|
2407
2407
|
height: 56px;
|
|
2408
|
-
background-image: url(${
|
|
2408
|
+
background-image: url(${kv});
|
|
2409
2409
|
background-size: 100%;
|
|
2410
2410
|
background-repeat: no-repeat;
|
|
2411
2411
|
}
|
|
@@ -2482,8 +2482,8 @@ Z
|
|
|
2482
2482
|
</div>
|
|
2483
2483
|
</div>
|
|
2484
2484
|
<div class="$id-modal-content">
|
|
2485
|
-
<div class="$id-modal-content-title">${
|
|
2486
|
-
<div class="$id-modal-content-hit">${
|
|
2485
|
+
<div class="$id-modal-content-title">${Mv.TITLE}</div>
|
|
2486
|
+
<div class="$id-modal-content-hit">${Mv.HIT}</div>
|
|
2487
2487
|
<div class="$id-modal-content-guide">
|
|
2488
2488
|
<div class="$id-modal-content-guide-phone">
|
|
2489
2489
|
<div class="$id-modal-content-guide-phone-move-x">
|
|
@@ -2541,7 +2541,7 @@ Z
|
|
|
2541
2541
|
</svg>
|
|
2542
2542
|
</div>
|
|
2543
2543
|
</div>
|
|
2544
|
-
`;function
|
|
2544
|
+
`;function Pv(e){let t=1,n=document.getElementsByTagName(`meta`);for(let e=0;e<n.length;e++){let r=n[e];if(r.getAttribute(`name`)===`viewport`){let e=(r.getAttribute(`content`)||``).match(/initial\-scale\=([\d|\.]+)/);e&&(t=Number(e[1])),isNaN(t)&&(t=1)}}let r=e=>Math.floor(e*t)+`px`;return Nv.replace(/\n/g,` `).replace(/\ +/g,` `).replace(/\$id/g,e).replace(/(\d+)px/g,(e,t)=>r(Number(t)))}function Fv(){let e=`five_vr_helper_`+Zt(),t=Pv(e),n=document.createElement(`div`);return n.className=e,n.innerHTML=t,n}var Iv=new t.CircleBufferGeometry(.12,16),Lv=`
|
|
2545
2545
|
varying vec2 vUv;
|
|
2546
2546
|
#include <common>
|
|
2547
2547
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -2550,7 +2550,7 @@ void main() {
|
|
|
2550
2550
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
2551
2551
|
#include <logdepthbuf_vertex>
|
|
2552
2552
|
}
|
|
2553
|
-
`,
|
|
2553
|
+
`,Rv=`
|
|
2554
2554
|
uniform float circleScale;
|
|
2555
2555
|
uniform float circleFade;
|
|
2556
2556
|
uniform float circleOpacity;
|
|
@@ -2607,7 +2607,7 @@ void main() {
|
|
|
2607
2607
|
|
|
2608
2608
|
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);
|
|
2609
2609
|
}
|
|
2610
|
-
`,
|
|
2610
|
+
`,zv=`
|
|
2611
2611
|
varying vec2 vUv;
|
|
2612
2612
|
#include <common>
|
|
2613
2613
|
#include <logdepthbuf_pars_vertex>
|
|
@@ -2616,7 +2616,7 @@ void main() {
|
|
|
2616
2616
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
2617
2617
|
#include <logdepthbuf_vertex>
|
|
2618
2618
|
}
|
|
2619
|
-
`,
|
|
2619
|
+
`,Bv=`
|
|
2620
2620
|
varying vec2 vUv;
|
|
2621
2621
|
uniform float opacity;
|
|
2622
2622
|
#include <common>
|
|
@@ -2641,7 +2641,7 @@ void main() {
|
|
|
2641
2641
|
|
|
2642
2642
|
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);
|
|
2643
2643
|
}
|
|
2644
|
-
`,zv=class extends t.Object3D{constructor(){super(),this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),this.opacityMotion=new X({opacity:0}),this.loadingMotion=new X({opacity:0}),this.disableMotion=new X({opacity:0});let e={blending:t.CustomBlending,blendSrc:t.SrcAlphaFactor,blendDst:t.OneMinusSrcAlphaFactor,blendSrcAlpha:t.OneFactor,blendDstAlpha:t.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};this.hitTestMesh=new t.Mesh(Pv,new t.MeshBasicMaterial(Object.assign(Object.assign({},e),{color:0,opacity:0}))),this.hitTestMesh.scale.set(1.5,1.5,1.5),this.ringMesh=new t.Mesh(Pv,new t.ShaderMaterial(Object.assign(Object.assign({},e),{vertexShader:Lv,fragmentShader:Rv,uniforms:{opacity:{value:0}}}))),this.panoMesh=new t.Mesh(Pv,new t.ShaderMaterial(Object.assign(Object.assign({},e),{vertexShader:Fv,fragmentShader:Iv,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),this.add(this.hitTestMesh),this.add(this.ringMesh),this.add(this.panoMesh),this.renderOrder=1e4,this.needsRender=!0}setProgress(e){this.progress=e,this.setLoading(e>0)}setOpacity(e){this.opacity!==e&&(this.opacity=e=H(e,0,1),this.opacityMotion.set({opacity:e},30).catch(G))}setCurrent(e){if(this.current!==e){if(e)this.currentMotion.setKeyframes([{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}],1500).catch(G);else{let e=[{progress:0,value:Object.assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(e,200).catch(G)}this.current=e}}setLoading(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(G):this.loadingMotion.set({opacity:0},0).catch(G),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:+!!e},300).catch(G),this.needsRender=!0)}tap(){return Promise.resolve()}updateTime(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);let n=this.opacityMotion.value.opacity;this.visible=n!==0;let{ringScale:r,ringOpacity:i,circleFade:a,circleOpacity:o,circleScale:s}=this.currentMotion.value;this.ringMesh.scale.set(r,1,r),this.ringMesh.material.uniforms.opacity.value=i*n,this.panoMesh.material.uniforms.opacity.value=n,this.panoMesh.material.uniforms.circleOpacity.value=o,this.panoMesh.material.uniforms.circleScale.value=s,this.panoMesh.material.uniforms.circleFade.value=a,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0}dispose(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()}},Bv=1500,Vv=Object.assign({},fr(X_,[`maxLatitude`,`minLatitude`])),Hv=class e extends Z_{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:`VRPanorama`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`VRPanorama`,this.cardboard=new Tv(this.renderer);let r=Nv();this.helperElement=r;let i=new Bg(r);this.element.parentNode&&(this.element.parentNode.insertBefore(r,this.element),this.updateHelperElementSize(),i.on(`tap`,()=>this.emit(`vr.requestExit`,Q(`vr.requestExit`,{})))),this.destroyHelper=()=>{i.destroy(),r.parentNode&&r.parentNode.removeChild(r),this.helperElement=void 0}}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}destroy(){super.destroy(),this.cardboard.dispose(),this.destroyHelper()}isReady(){return!1}updateRenderSize(){this.needsRender=!0}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,n,...r){var i,a,o,s,c,l;if(this.destroyed)return;this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0;let u={},d={},f=this.locationMotion.keyframes[0],p=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[m,h]=this.locationMotion.getKeyFrameSegment(e),g=this.panoResourceFromLocationMotionKeyframe(m),_=this.panoResourceFromLocationMotionKeyframe(h),v=this.panoResourceFromLocationMotionKeyframe(f),y=this.panoResourceFromLocationMotionKeyframe(p),b=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),u.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let n=this.locationMotion.value.count-h.value.count+1,r=new t.Vector3().copy(g.position),o=new t.Vector3().copy(_.position);if(u.progress=n,n>=.01&&n<=.99&&(u.progress=H(_.effectEasing(n),.01,.99)),_.panoPicture&&(n<1?g.panoPicture&&(u.pano0=g.panoPicture):u.pano0=_.panoPicture,u.pano1=_.panoPicture),_.effect===`montage`?u.transition=`BLACK`:_.effect===`spread`?u.transition=`SPREAD`:u.transition=`FADE`,_.effect===`zoomin`||_.effect===`zoomout`?u.progress=Math.pow(n,3):_.effect===`model`&&this.camera.pose.distance<.01&&(u.modelAlpha=1-Math.pow(H(Math.abs(n-.5)*2,0,1),4)),n<1&&_.effect!==`fly`){if(u.pano0&&g.panoPicture){let e={panoId:u.pano0.panoId,map:u.pano0.map,mapHistogram:u.pano0.mapHistogram,mapSize:u.pano0.mapSize,zoom:u.pano0.zoom,matrix:g.panoPicture.matrix.clone().setPosition(_.position)},t=this.panoPictureObserverMap.get(u.pano0);t&&this.panoPictureObserverMap.set(e,t),u.pano0=e}r.copy(o),b=!0}d.distance=this.locationMotion.value.distance,d.offset=new t.Vector3(r.x+(o.x-r.x)*n,r.y+(o.y-r.y)*n,r.z+(o.z-r.z)*n);let s=[],c=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(s.push(t),n>this.locationMotion.progress&&c.push(t))}for(let e of Object.keys(this.panoResources)){if(c.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.panoPicture){let e=t.panoPicture.map;if(e){if(e===((i=u.pano0)==null?void 0:i.map)||e===((a=u.pano1)==null?void 0:a.map))continue;e.dispose(),t.panoPicture=null}}s.indexOf(e)>=0||delete this.panoResources[e]}this.currentPano=zp(_.panoId),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:zp(v.panoId),pano:zp(y.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},zp(y.panoId)),{mode:this.mode}),$(this.camera.pose)),d),options:{},progress:this.locationMotion.progress,error:null}))}jg(u)===!1&&this.modelScene.parameter.set(u),d.offset&&this.camera.position.copy(d.offset);let x=this.camera.pose.longitude,S=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(x!==this.camera.pose.longitude||S!==this.camera.pose.latitude)&&(this.cameraMotion.set(dr(this.camera.pose,[`longitude`,`latitude`]),0).catch(G),this.emit(`camera.update`,Q(`camera.update`,{userAction:!0,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose))}))),this.works.getObserver(this.currentPano);let C=this.works.getObserver(g.panoId),w=this.works.getObserver(_.panoId),T=new Map;if(C)for(let e of C.accessibleNodes){let t=C.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});T.set(e,t)}}if(w)for(let e of w.accessibleNodes){let t=w.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});T.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{let n=T.get(t);n?(e.position.copy(n.position).applyMatrix4(n.work.transform),T.delete(t)):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),T.forEach((e,t)=>{let n=new zv;n.position.copy(e.position).applyMatrix4(e.work.transform),e.position.distanceTo(e.standingPosition)>this.aerialObserverMinHeight?n.scale.setScalar(15):n.scale.setScalar(1),this.panoMeshes.set(t,n),this.helper.add(n),T.delete(t)}),this.camera.pose.distance>.1||b?this.panoMeshes.forEach((t,r)=>{t.setOpacity(0),t.updateTime&&t.updateTime(e,n),t.visible=!1}):this.panoMeshes.forEach((e,t)=>{let n=zp(t),r=this.works.getObserver(n);if(!r)return;if(!r.loadable&&!r.active){e.setOpacity(0);return}let i=e.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);i<.05?e.setOpacity(0):e.setOpacity(H(1.5/i,0,1)),Bp(this.currentPano,n)&&e.setOpacity(0),e.lookAt(this.camera.position)}),this.locationMotion.ended){let t=this.intersect(e);this.panoMeshes.forEach((r,i)=>{r.setCurrent(r===t),r.updateTime&&r.updateTime(e,n)})}{let e=(o=this.modelScene.parameter.progress)==null?1:o,n=Math.round(e),r=this.modelScene.parameter.pano0,i=this.modelScene.parameter.pano1,a=n===0?r:i,c;if(a&&(c=this.works.getObserver(a.panoId),c||(c=this.panoPictureObserverMap.get(a))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(ii()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!c||!a||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new t.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Yr(a.mapSize),o=e+1,l=new t.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),u=Math.floor(this.tileLevelForFov(this.camera.fov,l)),d=u>e?u:0;this.tiling.setObserver(c);let f={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:a.map,panoMatrix:a.matrix,panoZoom:a.zoom,minLevel:o,level:d},p=this.tiling.update(f),m={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:n,opacity:(r==null?void 0:r.panoId)===(i==null?void 0:i.panoId)?1:Ed(Math.abs(((s=this.modelScene.parameter.progress)==null?0:s)-.5)*2)},h=this.modelScene.parameter.refinedScreen;(p||m.pano!==(h==null?void 0:h.pano)||m.opacity!==(h==null?void 0:h.opacity))&&this.modelScene.parameter.set(`refinedScreen`,m)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{let e=_.effect,{pano0:n,pano1:r}=this.modelScene.parameter;if(n&&r&&n!==r&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((c=this.modelScene.parameter.pano0Depth)==null?void 0:c.panoId)!==n.panoId||((l=this.modelScene.parameter.pano1Depth)==null?void 0:l.panoId)!==r.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1});let e=new t.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(n.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,W_(this.renderer,this.modelScene,e,500);let i=new t.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);i.matrix.copy(r.matrix),i.matrixWorld.copy(i.matrix),i.matrixAutoUpdate=!1,W_(this.renderer,this.modelScene,i,500),this.modelScene.parameter.set({pano0Depth:{panoId:n.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:r.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(){return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.cardboard.render(this.scene,this.camera),!0}setCamera(e={}){}destroyHelper(){}updateHelperElementSize(){if(!this.helperElement)return;let e=new t.Vector2(this.element.offsetWidth,this.element.offsetHeight),n=e.x*this.viewport.left,r=e.y*(1-this.viewport.bottom-this.viewport.height),i=e.x*this.viewport.width,a=e.y*this.viewport.height;this.helperElement.style.marginLeft!==n+`px`&&(this.helperElement.style.marginLeft=n+`px`),this.helperElement.style.marginTop!==r+`px`&&(this.helperElement.style.marginTop=r+`px`),this.helperElement.style.width!==i+`px`&&(this.helperElement.style.width=i+`px`),this.helperElement.style.height!==a+`px`&&(this.helperElement.style.height=a+`px`)}intersect(e){var n,r;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,this.activePanoMesh=void 0,this.activeTime=void 0;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>Bv){let e=this.activePanoMesh,t=null;return this.panoMeshes.forEach((n,r)=>{n===e&&(t=r)}),t!==null&&this.moveToPano(zp(t),{},!0),this.activePanoMesh=void 0,this.activeTime=void 0,e}let i=this.camera.getDirection(new t.Vector3),a=new t.Raycaster(this.camera.position,i);a.params.Points={threshold:.1},a.firstHitOnly=!0,a.floorIndex=-1;let o,s=[],c=this.works.getObserver(this.currentPano),l=c?c.accessibleNodes.map(e=>Z({panoIndex:e,workCode:c.work.workCode})):[];for(let e of l){let t=this.panoMeshes.get(e);if(t){let[e]=a.intersectObject((n=t.hitTestMesh)==null?t:n,!0);if(e){let n=(r=c==null?void 0:c.floorIndex)==null?0:r;s.push({panoMesh:t,intersection:Object.assign({floorIndex:n,floor:n},e)})}}}let[u]=s.sort((e,t)=>e.intersection.distance-t.intersection.distance);u?(o=u.intersection,this.activePanoMesh!==u.panoMesh&&(this.activePanoMesh=u.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(u.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),o||(o=this.modelScene.intersectRaycaster(a)[0]);let d=Q(`intersect.update`,{raycaster:a,intersection:o==null?null:o,object:this.intersectMesh});if(this.emit(`intersect.update`,d),d.defaultPrevented){this.hideIntersectMesh();return}if(o&&o.face){let e=o.face.normal,n=new t.Quaternion;n.setFromUnitVectors(new t.Vector3(0,0,1),e),this.intersectMesh.quaternion.copy(n);let r=o.point.clone();this.intersectMesh.position.copy(r),u?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return u==null?void 0:u.panoMesh}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}},Uv=new t.Vector3(0,1.6,0),Wv=new t.Box3,Gv=new t.Vector3,Kv=Object.assign({},Qg),qv=class e extends $g{static parseArgs(t){return t instanceof e?t:super.parseArgs(t)}static initAnimationEndState(e){var n,r,i,a,o,s;let c=this.parseArgs(e),l=c.works,{state:u,currentState:d}=e.initial,f=typeof u.panoIndex==`number`?{workCode:(i=(n=u.workCode)==null?(r=c.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex},p=l.getObserver(f),m=H((a=u.fov)==null?!p||Ag(d.mode)?d.fov:c.defaultFov:a,c.minFov,c.maxFov),h=(o=u.longitude)==null?d.longitude:o,g=H(typeof c.minLatitude==`function`?c.minLatitude(m):c.minLatitude,-Math.PI/2,Math.PI/2),_=H(typeof c.maxLatitude==`function`?c.maxLatitude(m):c.maxLatitude,-Math.PI/2,Math.PI/2),v=H((s=u.latitude)==null?!p||Ag(d.mode)?d.latitude:c.defaultLatitude:s,g,_),y=new t.Vector3;if(c.initial.state.offset)y.copy(c.initial.state.offset);else if(p)y.copy(p.position).applyMatrix4(p.work.transform);else{let e=It(d).setLength(d.distance);y.copy(c.initial.currentState.offset).sub(e)}return{workCode:f.workCode,panoIndex:f.panoIndex,mode:`Model`,longitude:h,latitude:v,fov:m,offset:y,distance:0}}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Model`,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x})}updateConfiguration(e){return super.updateConfiguration(e)}destroy(){super.destroy(),this.locationMotion.dispose()}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(t,n,r,i){this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));return(a.workCode!==this.currentPano.workCode||a.panoIndex!==this.currentPano.panoIndex||a.longitude!==this.cameraMotion.value.longitude||a.latitude!==this.cameraMotion.value.latitude||a.fov!==this.cameraMotion.value.fov)&&this.moveToPosition(a.offset,{duration:0,longitude:a.longitude,latitude:a.latitude,fov:a.fov},i),!0}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return r.distance=0,e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(G),this.cameraMotion.set(i,t).catch(G)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:0,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(G),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,n,...r){if(this.destroyed)return;let i={},a={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),i.progress=1,i.pano0=i.pano1=t}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),a.distance=this.locationMotion.value.distance,a.offset=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);let n=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),r=[];for(let e of this.works){let t=this.modelScene.models.find(t=>t.work===e);if(!(!t||t.visible===!1)&&!(e.observers.length<=0)&&(Wv.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),Wv.containsPoint(n)))for(let t of e.observers)r.push(t)}let i=vu(r,e=>Gv.copy(e.position).applyMatrix4(e.work.transform).distanceTo(n));this.currentPano=i?{workCode:i.work.workCode,panoIndex:i.panoIndex}:{workCode:``,panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),a.longitude=this.cameraMotion.value.longitude,a.latitude=this.cameraMotion.value.latitude,a.fov=this.cameraMotion.value.fov),jg(i)||this.modelScene.parameter.set(i),jg(a)||this.setCamera(a);let o=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&o&&o.position.y-o.standingPosition.y>10){let e=H(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)}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={modelAlpha:1},c={perspToOrtho:0},l={longitude:o.longitude,latitude:o.latitude,fov:o.fov,duration:i,moveStartCallback:e=>{this.perspToOrthoMotion.set(c,i).catch(G),this.modelAlphaMotion.set(s,i).catch(G),this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction}))},moveEndCallback:e=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),t()},moveCancelCallback:()=>{let e=this.currentPano,n=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:this.camera.pose.distance});this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:n,userAction:this.userAction})),t()}};this.moveToPosition(o.offset,l,a)})}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(V())[1],n=this.locationMotion.getKeyFrameSegment(V())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new t.Vector3(n.value.x,n.value.y,n.value.z),distance:n.value.distance})}moveToPano(e,n={},r){let i=this.works.getObserver(e);if(i){let e=new t.Vector3().copy(i.position).applyMatrix4(i.work.transform);this.moveToPosition(e,n,r)}}moveToPosition(e,n={},r){var i,a,o;this.userAction=r,this.stopMomentumMovement();let s=V(),c=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=c.distanceTo(e),u=this.locationMotion.getProgressVelocity(s),d=0;for(let e=1;e<this.locationMotion.keyframes.length;e++){let{x:t,y:n,z:r}=this.locationMotion.keyframes[e-1].value,{x:i,y:a,z:o}=this.locationMotion.keyframes[e].value;d+=Math.sqrt(Math.pow(i-t,2)+Math.pow(a-n,2)+Math.pow(o-r,2))}let f=l===0?0:u*d/l,p=this.calculateMovingDuration(n.duration,l),m={x:e.x,y:e.y,z:e.z,distance:0},h={longitude:n.longitude,latitude:n.latitude,fov:n.fov},g=[];for(let e of this.works){let t=this.modelScene.models.find(t=>t.work===e);if(!(!t||t.visible===!1)&&!(e.observers.length<=0)&&(Wv.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),Wv.containsPoint(c)))for(let t of e.observers)g.push(t)}let _=vu(g,e=>Gv.copy(e.position).applyMatrix4(e.work.transform).distanceTo(c)),v=_?{workCode:_.work.workCode,panoIndex:_.panoIndex}:{workCode:``,panoIndex:0},y=Object.assign(Object.assign({},v),{mode:this.mode,longitude:(i=h.longitude)==null?this.camera.pose.longitude:i,latitude:(a=h.latitude)==null?this.camera.pose.latitude:a,fov:(o=h.fov)==null?this.camera.pose.fov:o,offset:e.clone(),distance:0}),b=this.currentPano;this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:n,prevPano:b,pano:{panoIndex:y.panoIndex,workCode:y.workCode},progress:0,state:y,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(y),this.cameraMotion.set(h,p).catch(G),this.locationMotion.set(m,p,f).then(()=>{for(let e of this.modelScene.children)e instanceof dp&&e.show();let e=Object.assign(Object.assign(Object.assign({},v),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.arrived`,Q(`pano.arrived`,{options:n,prevPano:b,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(e)},()=>{n.moveCancelCallback&&n.moveCancelCallback(),this.emit(`pano.cancel`,Q(`pano.cancel`,{options:n,prevPano:b,pano:{panoIndex:y.panoIndex,workCode:y.workCode},progress:0,state:y,userAction:this.userAction,error:null}))})}onTapGesture(e){let n=e.center.raycaster;this.stopMomentumMovement();let[r]=this.modelScene.intersectRaycaster(n);if(r&&r.face){let e=r.face.normal,n=r.point;if(new t.Vector3(0,1,0).angleTo(e)>Math.PI/3){let i=new t.Raycaster;i.firstHitOnly=!0;let a=e.clone().setLength(.3).add(n);i.set(a,new t.Vector3(0,-1,0)),r=this.modelScene.intersectRaycaster(i)[0]}}if(r){let n=new t.Vector3().copy(r.point).add(Uv),i=[];for(let e of this.works){let t=this.modelScene.models.find(t=>t.work===e);if(!(!t||t.visible===!1)&&!(e.observers.length<=0)&&(Wv.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),Wv.containsPoint(n)))for(let t of e.observers)i.push(t)}let[a,o]=vu(i,e=>Gv.copy(e.position).applyMatrix4(e.work.transform).distanceTo(n),!0);a&&o<5&&(n.y=Gv.copy(a.position).applyMatrix4(a.work.transform).y),e.state.offset.copy(n),e.state.distance=0,this.emit(`gesture.tap`,e),e.defaultPrevented||this.moveToPosition(n,{},!0)}else this.emit(`gesture.tap`,e),e.defaultPrevented||this.cameraBounce()}},Jv=new t.Box3,Yv=new t.Vector3,Xv=.5,Zv=Math.PI/7,Qv={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:Math.PI/2,minLatitude:0,cameraType:`auto`,cameraFence:null,intersectMeshCreator:()=>new Wg},$v=class e extends Vg{static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{defaultLongitude:(n=t.defaultLongitude)==null?Qv.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?Qv.defaultLatitude:r,defaultDistance:(i=t.defaultDistance)==null?Qv.defaultDistance:i,maxLatitude:(a=t.maxLatitude)==null?Qv.maxLatitude:a,minLatitude:(o=t.minLatitude)==null?Qv.minLatitude:o,cameraType:(s=t.cameraType)==null?Qv.cameraType:s,cameraFence:(c=t.cameraFence)==null?Qv.cameraFence:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?Qv.intersectMeshCreator:l})}static distanceFromModel(e,t,n){let r=e.boundingBox,i=r.isEmpty()?10:Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),1/2);i=isNaN(i)||!isFinite(i)?1:i;let a=i/2/Math.tan(Math.PI*t/360);return n<1&&(a/=n),isNaN(a)||!isFinite(a)?i:a}static initAnimationEndState(n){var r,i,a,o,s,c,l;let u=this.parseArgs(n),d=u.works,f=u.modelScene,{state:p,currentState:m}=n.initial,h=typeof p.panoIndex==`number`?{workCode:(a=(r=p.workCode)==null?(i=u.works[0])==null?void 0:i.workCode:r)==null?``:a,panoIndex:p.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},g=(o=p.fov)==null?60:o,_=H(typeof u.minLatitude==`function`?u.minLatitude(g):u.minLatitude,-Math.PI/2,Math.PI/2),v=H(typeof u.maxLatitude==`function`?u.maxLatitude(g):u.maxLatitude,-Math.PI/2,Math.PI/2),y=H((s=p.latitude)==null?kg(m.mode)?m.latitude:u.defaultLatitude:s,_,v),b=e.distanceFromModel(u.modelScene,g,u.camera.aspect),x=new t.Vector3,S=(c=p.distance)==null?Math.min(u.defaultDistance,b):c,C=(l=p.longitude)==null?kg(m.mode)?m.longitude:u.defaultLongitude:l;if(p.offset)x.copy(p.offset);else{let e=d.getObserver(h);u.defaultDistance<b&&e?(x.copy(e.position).applyMatrix4(e.work.transform),p.longitude===void 0&&(C=m.longitude)):(f.boundingBox.getCenter(x),S=b)}return Object.assign(Object.assign({},h),{mode:`Mapview`,longitude:C,latitude:y,fov:g,offset:x,distance:S})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Mapview`,this.defaultLongitude=n.defaultLongitude,this.defaultLatitude=n.defaultLatitude,this.defaultDistance=n.defaultDistance,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.cameraType=n.cameraType,this.cameraFence=n.cameraFence,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.pendingTextureId=null,this.textureLoader=new fi,this.intersectMeshCreator=n.intersectMeshCreator,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof t.Box3&&e.cameraFence instanceof t.Box3||this.cameraFence instanceof t.Sphere&&e.cameraFence instanceof t.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return!0}destroy(){super.destroy(),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(t,n,r,i){this.userAction=i,this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));this.currentPano={workCode:a.workCode,panoIndex:a.panoIndex};let o={longitude:a.longitude,latitude:a.latitude,fov:a.fov},s={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance};return(o.longitude!==this.cameraMotion.value.longitude||o.latitude!==this.cameraMotion.value.latitude||o.fov!==this.cameraMotion.value.fov)&&this.cameraMotion.set(o,r.duration).catch(G),(s.x!==this.locationMotion.value.x||s.y!==this.locationMotion.value.y||s.z!==this.locationMotion.value.z||s.distance!==this.locationMotion.value.distance)&&this.locationMotion.set(s,r.duration).catch(G),!0}updateModel(e){super.updateModel(e),this.hideIntersectMesh()}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(G),this.cameraMotion.set(i,t).catch(G)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(G),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,n){if(this.destroyed)return;let r={},i={};if(this.locationMotion.ended||(this.locationMotion.update(e),i.distance=this.locationMotion.value.distance,i.offset=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),r.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),r.progress=1,r.pano0=r.pano1=t}let a=0;if(this.cameraType===`auto`?a=+(Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02):this.cameraType===`perspective`?a=0:this.cameraType===`orthographic`&&(a=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==a&&this.perspToOrthoMotion.set({perspToOrtho:a},500).catch(G),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),jg(r)||this.modelScene.parameter.set(r),jg(i)||this.setCamera(i),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){let e=It(this.camera.pose,new t.Vector3),n=new t.Vector3().copy(this.camera.pose.offset).sub(e.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(n)>.01){let e=this.cameraFence.clampPoint(n,new t.Vector3),r=this.camera.pose.offset.clone().add(e).sub(n),i=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:r,distance:this.camera.pose.distance});this.fixFinalState(i),this.locationMotion.set({x:i.offset.x,y:i.offset.y,z:i.offset.z,distance:i.distance},300).catch(G)}}if(this.intersectMesh&&this.intersectMesh.parent){let e=H(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)}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(V())[1],n=this.locationMotion.getKeyFrameSegment(V())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:n.value.distance,offset:new t.Vector3(n.value.x,n.value.y,n.value.z)})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={longitude:o.longitude,latitude:o.latitude,fov:o.fov},c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.perspToOrthoMotion.set({perspToOrtho:0},i).catch(G),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(G),this.cameraMotion.set(s,i).catch(G),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}getForwardObserverOrNot(e){let[t]=this.modelScene.intersectRaycaster(e);if(!t)return null;let n=[];for(let t of this.works){let r=this.modelScene.models.find(e=>e.work===t);if(!(!r||r.visible===!1)&&!(t.observers.length<=0)&&(Jv.copy(t.observerBox).expandByScalar(10).applyMatrix4(t.transform),Jv.containsPoint(e.ray.origin)||e.ray.intersectsBox(Jv)))for(let e of t.observers)n.push(e)}let[r,i]=vu(n,e=>Yv.copy(e.standingPosition).applyMatrix4(e.work.transform).distanceTo(t.point),!0);return r&&i<Math.max(r.standingPosition.distanceTo(this.camera.position)/5,10)?r:null}coordinatesForOffset(e){let n=this.renderer.getSize(new t.Vector2);return{longitude:-2*e.x/(n.x*this.viewport.width),latitude:2*e.y/(n.y*this.viewport.height)}}requestMomentumMovement(e,n,r,i){if(this.inMomentumMovement===null)return;i=Math.max(i,1);let a=Object.assign({},r),o={longitude:0,latitude:0,x:0,y:0,z:0};for(let e=0;e<i;e++)a.longitude*=.996,a.latitude*=.996*.998,a.x*=.99,a.y*=.99,a.z*=.99,o.longitude+=a.longitude,o.latitude+=a.latitude,o.x+=a.x,o.y+=a.y,o.z+=a.z;let s=this.cameraMotion.value.fov,c=Ft(this.cameraMotion.value.longitude+o.longitude),l=H(typeof this.minLatitude==`function`?this.minLatitude(s):this.minLatitude,-Math.PI/2,Math.PI/2),u=H(typeof this.maxLatitude==`function`?this.maxLatitude(s):this.maxLatitude,-Math.PI/2,Math.PI/2),d=H(this.cameraMotion.value.latitude+o.latitude,l,u),f=new t.Vector3(this.locationMotion.value.x+o.x,this.locationMotion.value.y+o.y,this.locationMotion.value.z+o.z),p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:d,offset:f,fov:s,distance:this.locationMotion.value.distance}),m=e.state.offset.clone().sub(It(e.state).setLength(p.distance)),h=!(Math.abs(a.longitude)>1e-4||Math.abs(a.latitude)>1e-4||Math.abs(a.x)>1e-4||Math.abs(a.y)>1e-4||Math.abs(a.z)>1e-4);(this.cameraFence?this.cameraFence.containsPoint(m):!0)===!1&&(h=!0);let g=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:n,isFinal:h,state:p}));if(this.emit(`gesture.fire`,g),this.inMomentumMovement.event=g,this.emit(`gesture.momentum`,g),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:c,latitude:d},0).catch(G),this.locationMotion.set({x:p.offset.x,y:p.offset.y,z:p.offset.z,distance:p.distance},0).catch(G),h?this.inMomentumMovement=null:ei.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,a,n)},!0))}fixFinalState(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho===1)return;let n=It(e,new t.Vector3),r=new t.Vector3().copy(e.offset).sub(n.clone().setLength(e.distance)),i=new t.Raycaster(r,n);i.params.Points={threshold:.1},i.firstHitOnly=!0,i.hitFilter=e=>e.distance>Xv+i.near,i.near=this.camera.near,i.far=this.camera.far;let a;if(a=this.modelScene.intersectRaycaster(i)[0],a&&a.distance<this.camera.near&&(a=void 0),!a){let e=new t.Plane(new t.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),n=i.ray.intersectPlane(e,new t.Vector3);if(n){let e=n.distanceTo(i.ray.origin);e<1e3&&e>=i.near&&(a={distance:e,floorIndex:0,floor:0,point:n,object:this.scene,face:null})}}if(!a){let t=Math.max(e.distance,3);a={distance:t,floorIndex:0,floor:0,point:r.clone().add(n.clone().setLength(t)),object:this.scene,face:null}}a.distance>=this.camera.near&&mg(e.distance,a.distance)&&(e.distance=a.distance,e.offset=a.point)}onPanGesture(n){this.userAction=n.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let r=n.pointers.length,i=this.panState,a=0,o=!1;n.pointerType===`mouse`&&(a=n.center.buttons,o=n.center.shiftKey),i&&a===0&&i.buttons!==0&&(a=i.buttons);let s=i==null?void 0:i.target;if(!s){let r=this.relativeClientPosition(n.center),i=this.createRaycasterFromCamera(r,this.camera);s=new t.Vector3().copy(i.ray.direction).multiplyScalar(3).add(i.ray.origin);let[a]=this.modelScene.intersectRaycaster(i);if(!a&&i.ray.direction.y<-.3){let e=new t.Plane(new t.Vector3(0,1,0),0),n=i.ray.intersectPlane(e,new t.Vector3);if(n){let e=n.distanceTo(i.ray.origin);e<1e4&&e>=i.near&&(a={distance:e,floorIndex:0,floor:0,point:n,object:this.scene})}}if(a)s.copy(a.point);else{let e=new t.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),n=new t.Plane().setFromNormalAndCoplanarPoint(e,this.camera.pose.offset);i.ray.intersectPlane(n,s)}let o=e.distanceFromModel(this.modelScene,this.camera.pose.fov,this.camera.aspect)*2;s.distanceTo(i.ray.origin)>o&&s.copy(i.ray.direction).setLength(o).add(i.ray.origin)}if(n.isFinal?this.panState=void 0:this.panState={target:s,buttons:a,pointerLength:r,defaultPrevented:n.defaultPrevented,x:n.center.x,y:n.center.y},i===void 0||i.pointerLength!==r){this.emit(`gesture.pan`,n);return}if(r>1||a===2||o){let r={x:n.center.x-i.x,y:n.center.y-i.y},a=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),o=It(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(a),s=new t.Vector3().copy(o).sub(i.target).length();s*=Math.tan(this.camera.pose.fov/2*Math.PI/180);let c=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect)*2;s=Math.min(s,c);let l=this.renderer.getSize(new t.Vector2),u=2*r.x*s/l.y,d=2*r.y*s/l.y,f=new t.Vector3;f.setFromMatrixColumn(this.camera.matrix,0),f.multiplyScalar(-u),a.add(f),this.camera.pose.latitude<Zv?f.setFromMatrixColumn(this.camera.matrix,1):(f.setFromMatrixColumn(this.camera.matrix,0),f.crossVectors(this.camera.up,f)),f.multiplyScalar(d),a.add(f);let p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:a,distance:this.camera.pose.distance});if(n.state=p,this.emit(`gesture.pan`,n),n.defaultPrevented){this.panState&&(this.panState.defaultPrevented=n.defaultPrevented);return}if(n.isFinal&&i.defaultPrevented)return;if(this.locationMotion.set({x:p.offset.x,y:p.offset.y,z:p.offset.z},0).catch(G),n.isFinal&&(this.fixFinalState(p),Object.assign(n,{__fixFinalState:!0}),this.locationMotion.set({distance:p.distance,x:p.offset.x,y:p.offset.y,z:p.offset.z},0).catch(G)),n.isFinal){let e=this.renderer.getSize(new t.Vector2),r=2*n.velocityX*s/e.y,i=2*n.velocityY*s/e.y,a=new t.Vector3,o=new t.Vector3;a.setFromMatrixColumn(this.camera.matrix,0),a.multiplyScalar(-r),o.add(a),this.camera.pose.latitude<Zv?a.setFromMatrixColumn(this.camera.matrix,1):(a.setFromMatrixColumn(this.camera.matrix,0),a.crossVectors(this.camera.up,a)),a.multiplyScalar(i),o.add(a),this.inMomentumMovement={uuid:Zt()},this.requestMomentumMovement(n,!0,{longitude:0,latitude:0,x:o.x,y:o.y,z:o.z},0)}}else{let e={x:n.center.x-i.x,y:n.center.y-i.y},t=this.coordinatesForOffset(e),r=Ft(this.cameraMotion.value.longitude+t.longitude),a=this.camera.pose.fov,o=H(typeof this.minLatitude==`function`?this.minLatitude(a):this.minLatitude,-Math.PI/2,Math.PI/2),s=H(typeof this.maxLatitude==`function`?this.maxLatitude(a):this.maxLatitude,-Math.PI/2,Math.PI/2),c=H(this.cameraMotion.value.latitude+t.latitude,o,s);this.camera.aspect<1&&Math.abs(n.overallVelocityX)>.2&&Math.atan2(Math.abs(n.overallVelocityY),Math.abs(n.overallVelocityX))<Math.PI/6.923&&(c=this.cameraMotion.value.latitude);let l=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:r,latitude:c,fov:a,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(n.isFinal&&Object.assign(n,{__fixFinalState:!0}),n.state=l,this.emit(`gesture.pan`,n),n.defaultPrevented||n.isFinal&&i.defaultPrevented)return;if(n.isFinal?this.locationMotion.set({distance:l.distance,x:l.offset.x,y:l.offset.y,z:l.offset.z},0).catch(G):this.cameraMotion.set({longitude:l.longitude,latitude:l.latitude},0).catch(G),n.isFinal){let e=n.velocityX,t=n.velocityY;this.inMomentumMovement={uuid:Zt()},this.requestMomentumMovement(n,!0,Object.assign(Object.assign({},this.coordinatesForOffset({x:e,y:t})),{x:0,y:0,z:0}),0)}}}onPinchGesture(n){var r;if(!this.initAnimationIsReady)return;this.userAction=n.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let i=(r=this.pinchState)==null?void 0:r.distance;if(n.isFirst){this.pinchState={x:n.center.x,y:n.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(i===void 0)return;let a=this.modelScene.boundingBox.getCenter(new t.Vector3),o=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),s=H(i/n.scale,Xv,1/0),c=n.state.offset.clone().sub(It(n.state).setLength(s)),l=this.modelScene.boundingBox.containsPoint(c),u;if(!l&&this.pinchState&&this.pinchState.scale>n.scale&&a.distanceTo(c)>o?u=n.state.distance:(u=s,this.pinchState&&(this.pinchState.scale=n.scale)),n.state.distance=u,this.emit(`gesture.pinch`,n),!n.defaultPrevented&&(this.locationMotion.set({distance:n.state.distance},0).catch(G),n.pointerType!==`mouse`&&(n.type=`gesture.pan`,this.onPanGesture(n)),n.isFinal)){if(!(`__fixFinalState`in n)){let e=n.state;this.fixFinalState(n.state);let t={x:e.offset.x,y:e.offset.y,z:e.offset.z,distance:e.distance};this.locationMotion.set(t,0).catch(G)}this.panState=void 0,this.pinchState=void 0}}onMouseMove(e){var n,r;if(!this.intersectMesh.parent||this.panState||this.pinchState||this.mouseWheelState||(this.emit(`gesture.mousemove`,e),e.defaultPrevented))return;let i=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}let[a]=this.modelScene.intersectRaycaster(i),o=Q(`intersect.update`,{raycaster:i,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}if(a){let e=(r=(n=a.face)==null?void 0:n.normal)==null?new t.Vector3().copy(i.ray.direction).multiplyScalar(-1):r,o=e.clone(),s=a.point.clone();this.intersectMesh.position.copy(s);let c=s.clone().add(o);if(this.intersectMesh.lookAt(c),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(s);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onMouseWheel(n){if(this.initAnimationIsReady)if(this.userAction=n.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),n.isFinal){let e=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov,offset:new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),distance:this.locationMotion.value.distance});if(this.fixFinalState(e),this.emit(`gesture.mousewheel`,n),n.defaultPrevented)return;let r={x:e.offset.x,y:e.offset.y,z:e.offset.z,distance:e.distance};this.locationMotion.set(r,0).catch(G)}else{let r=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),i=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=It(this.cameraMotion.value,new t.Vector3).negate(),o=new t.Ray(i,a).intersectBox(this.modelScene.boundingBox,new t.Vector3);o&&(r+=o.distanceTo(i));let s=Math.max(this.locationMotion.value.distance-this.camera.near,0),c=n.center.delta/10*Math.max(s/5,.1);if(s<=r||c>0)if(this.locationMotion.value.distance-c>=Xv){let e=this.locationMotion.value.distance-c;n.state.distance=e}else{let e=It(this.cameraMotion.value);e.setLength(c),n.state.offset.add(e)}if(this.emit(`gesture.mousewheel`,n),n.defaultPrevented)return;this.locationMotion.set({distance:n.state.distance,x:n.state.offset.x,y:n.state.offset.y,z:n.state.offset.z},0).catch(G)}}onTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let n=e.center.raycaster,r=this.getForwardObserverOrNot(n);if(!r)this.emit(`gesture.tap`,e);else{let n={longitude:this.camera.pose.longitude,latitude:0},i=Object.assign(Object.assign({},e.state),{mode:`Panorama`,workCode:r.work.workCode,panoIndex:r.panoIndex,longitude:n.longitude,latitude:n.latitude,offset:r?r.position.clone():new t.Vector3,distance:0});if(e.state=i,this.emit(`gesture.tap`,e),!e.defaultPrevented&&(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},state:i,userAction:e.userAction,options:n,progress:0,error:null})),r&&r.active)){let e=this.pendingTextureId=Zt(),a={panoIndex:r.panoIndex,workCode:r.work.workCode},o=Z(a),s={right:r.images.work.getURL(r.images.right),left:r.images.work.getURL(r.images.left),up:r.images.work.getURL(r.images.up),down:r.images.work.getURL(r.images.down),front:r.images.work.getURL(r.images.front),back:r.images.work.getURL(r.images.back)},c=this.imageOptions.transform,l=Object.assign({key:`pano.${o}`},dr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),u=`pano:`+Lp([s,l,c]),d=this.modelScene.parameter,f=Sg(`pano.prepare`,{options:n,prevMode:this.mode,prevPano:this.currentPano,pano:a});if(this.emit(`pano.prepare`,f),f.defaultPrevented){this.pendingTextureId=null;return}f.options!==n&&Object.assign(n,f.options);let p;d.pano0&&d.pano0.map.name===u?p=d.pano0:d.pano1&&d.pano1.map.name===u&&(p=d.pano1),p?Promise.resolve().then(()=>Cg(f)).catch(e=>Gg(e)).then(e=>{var t;e instanceof Error?(this.pendingTextureId=null,e.message&&this.emit(`error`,e)):(d.pano0&&d.pano0.map!==p.map&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==p.map&&d.pano1.map!==((t=d.pano0)==null?void 0:t.map)&&d.pano1.map.dispose(),d.set({pano0:p,pano1:p}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},progress:0,state:i,options:n,error:null})))}):Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:a}))}).then(()=>this.textureLoader.loadCubeTexture(s,{imageURL:{transform:c,options:l},format:t.RGBFormat,viaAjax:!0,fetcher:Kf(this.fiveId,r.work)},void 0,void 0,void 0,this.renderer)).catch(e=>{let t=Gg(e);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:t,progress:0,meta:null,pano:a})),t}),Promise.resolve().then(()=>Cg(f)).catch(e=>Gg(e))]).then(([a,s])=>{var c,l;if(!(a instanceof Error)&&!(s instanceof Error)){let{body:s}=a;if(this.destroyed||this.pendingTextureId!==e){s.dispose();return}this.pendingTextureId=null,s.name=u;let f=Array.isArray(s.image)?s.image[0]:s.image,p=(c=f==null?void 0:f.width)==null?2048:c,m=r.images.histogram;m||(m=new Bm().formPixels(zg(this.renderer,s,!0,Im).data),r.images.histogram=m);let h={panoId:o,map:s,mapSize:p,mapHistogram:new t.Vector4().fromArray(m.toArray()),matrix:r.matrix.clone().premultiply(r.work.transform),zoom:1};d.pano0&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==((l=d.pano0)==null?void 0:l.map)&&d.pano1.map.dispose(),d.set({pano0:h,pano1:h}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},progress:0,state:i,options:n,error:null}))}else{let t=null;if(a instanceof Error?t||(t=a):a.body.dispose(),s instanceof Error&&(t||(t=s)),this.destroyed||this.pendingTextureId!==e)return;this.pendingTextureId=null,t instanceof Error&&t.message&&this.emit(`error`,t)}})}}}onDblTapGesture(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=e.state,n=e.center.raycaster,r=n.ray.origin.clone().add(n.ray.direction.clone().setLength(3)),i=1,[a]=this.modelScene.intersectRaycaster(n);if(a&&(r=a.point.clone(),i=a.distance>4/2?1:3),e.state.distance=i,e.state.offset=r,this.emit(`gesture.dbltap`,e),e.defaultPrevented)return;let o={x:t.offset.x,y:t.offset.y,z:t.offset.z,distance:t.distance};this.locationMotion.set(o,360).catch(G),this.hideIntersectMesh()}hideIntersectMesh(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)}};function ey(e){return e==null}var ty={type:`move`},ny=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}getHandSpace(){return this._hand===null&&(this._hand=new t.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new t.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new t.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new t.Vector3),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new t.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new t.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new t.Vector3),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}getAxes(){return this._axes}update(e,n,r){let i=null,a=null,o=null,s=this._targetRay,c=this._grip,l=this._hand;if(e&&e.gamepad&&e.gamepad.axes&&(this._axes=[e.gamepad.axes[2],e.gamepad.axes[3]]),e&&n.session.visibilityState!==`visible-blurred`)if(s!==null&&(i=n.getPose(e.targetRaySpace,r),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(ty))),l&&e.hand){o=!0;for(let i of e.hand.values()){let e=n.getJointPose(i,r);if(l.joints[i.jointName]===void 0){let e=new t.Group;e.matrixAutoUpdate=!1,e.visible=!1,l.joints[i.jointName]=e,l.add(e)}let a=l.joints[i.jointName];e!==null&&(a.matrix.fromArray(e.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.jointRadius=e.radius),a.visible=e!==null}let i=l.joints[`index-finger-tip`],a=l.joints[`thumb-tip`],s=i.position.distanceTo(a.position),c=.02,u=.005;l.inputState.pinching&&s>c+u?(l.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=c-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(a=n.getPose(e.gripSpace,r),a!==null&&(c.matrix.fromArray(a.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),a.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(a.linearVelocity)):c.hasLinearVelocity=!1,a.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(a.angularVelocity)):c.hasAngularVelocity=!1));return s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),l!==null&&(l.visible=o!==null),this}},ry=1,iy=()=>{try{let e=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return e&&t}catch(e){return console.error(`Error determining if the device is an Apple Vision Pro: `,e),!1}},ay=()=>{try{return/Oculus/i.test(navigator.userAgent)}catch(e){return console.error(`Error determining if the device is an Oculus: `,e),!1}},oy=class{constructor(e,n,r){var i,a,o,s,c;this.isPanorama=(i=r==null?void 0:r.isPanorama)==null?!0:i,navigator.userAgent.toLowerCase();let l;l=iy()?`VP`:ay()?`Oculus`:`Pico`,this.machineType=(a=r==null?void 0:r.machineType)==null?l:a,this.renderer=e,this.gl=n,this.enabled=!1,this.session=null,this.referenceSpaceType=(o=r==null?void 0:r.referenceSpaceType)==null?`local-floor`:o,this.referenceSpace=null,this.onSessionStartCallback=(s=r==null?void 0:r.onSessionStart)==null?G:s,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)==null?G:c,this.controllers=[new ny,new ny],this.inputSourcesMap=new Map,this.cameraVR=new t.ArrayCamera,this.cameraL=new t.PerspectiveCamera,this.cameraR=new t.PerspectiveCamera,this.cameraVR.cameras.push(this.cameraL,this.cameraR),this.cameraL.viewport=new t.Vector4,this.cameraR.viewport=new t.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new t.Vector3,this.cameraRPos=new t.Vector3}getController(e){let t=this.controllers[e];return t||console.warn(`no controller find`),t.getTargetRaySpace()}getRightController(){if(!this.session||!this.session.inputSources)return null;let e;if(this.session.inputSources.forEach((t,n)=>{t.handedness===`right`&&(e=n)}),e===void 0)return console.warn(`no inputSource for right hand`),null;let t=this.controllers[e];return t?t.getTargetRaySpace():(console.warn(`right controller not find`),null)}getLeftController(){if(!this.session||!this.session.inputSources)return null;let e;if(this.session.inputSources.forEach((t,n)=>{t.handedness===`left`&&(e=n)}),e===void 0)return console.warn(`no inputSource for left hand`),null;let t=this.controllers[e];return t?t.getTargetRaySpace():(console.warn(`left controller not find`),null)}getControllerGrip(e){let t=this.controllers[e];return t||console.warn(`no controller find`),t.getGripSpace()}getCameras(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}}updateCamera(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}setProjectionFromUnion(e,t,n){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(n.matrixWorld);var r=this.cameraLPos.distanceTo(this.cameraRPos),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),b=c*s/_*g,x=l*s/_*g;e.projectionMatrix.makePerspective(v,y,b,x,g,_)}getCamera(e){this.cameraVR.near=this.cameraR.near=this.cameraL.near=e.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=e.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);let t=e.parent,n=this.cameraVR.cameras;this.updateCamera(this.cameraVR,t);for(let e=0;e<n.length;e++)this.updateCamera(n[e],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);let r=e.children;for(let e=0,t=r.length;e<t;e++)r[e].updateMatrixWorld(!0);return n.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR}updateInputSources(e){if(!this.session){console.warn(`session is lose!`);return}let t=this.session.inputSources;for(let e=0;e<this.controllers.length;e++)this.inputSourcesMap.set(t[e],this.controllers[e]);for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=this.inputSourcesMap.get(n);r&&(r.dispatchEvent({type:`disconnected`,data:n}),this.inputSourcesMap.delete(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=this.inputSourcesMap.get(n);r&&r.dispatchEvent({type:`connected`,data:n})}}onSessionEvent(e){let t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}onSessionEnd(){this.inputSourcesMap.forEach(function(e,t){e.disconnect(t)}),this.inputSourcesMap.clear(),this.isPresenting=!1,this.session=null,ei.shared.setContext(null),this.onSessionEndCallback()}onRequestReferenceSpace(e){this.referenceSpace=e,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)}setSession(e){if(this.session=e,this.session){this.session.addEventListener(`select`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`selectstart`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`selectend`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeeze`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeezestart`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeezeend`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`end`,e=>{this.onSessionEnd()});let e=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(()=>{let t={antialias:e==null?void 0:e.antialias,alpha:e==null?void 0:e.alpha,depth:e==null?void 0:e.depth,stencil:e==null?void 0:e.stencil,framebufferScaleFactor:ry};if(!this.session){console.error(`session is lose while set session!`);return}switch(this.machineType){case`Pico`:case`VP`:this.session.updateRenderState({baseLayer:new XRWebGLLayer(this.session,this.gl,t)});break;case`Oculus`:this.session.updateRenderState({baseLayer:new XRWebGLLayer(this.session,this.gl,t)});break;default:this.machineType;break}this.session.requestReferenceSpace(this.referenceSpaceType).then(e=>{this.onRequestReferenceSpace(e)}),this.session.addEventListener(`inputsourceschange`,e=>{this.updateInputSources(e)})})}}},sy=class extends t.InstancedBufferGeometry{constructor(){super(),this.type=`LineSegmentsGeometry`,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute(`position`,new t.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute(`uv`,new t.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;n=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let r=new t.InstancedInterleavedBuffer(n,6,1);return this.setAttribute(`instanceStart`,new t.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceEnd`,new t.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;n=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let r=new t.InstancedInterleavedBuffer(n,6,1);return this.setAttribute(`instanceColorStart`,new t.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceColorEnd`,new t.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new t.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var n=e.geometry;if(n instanceof t.Geometry){let e=new t.BufferGeometry().fromGeometry(n);this.setPositions(e.attributes.position.array)}else n instanceof t.BufferGeometry&&this.setPositions(n.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new t.Box3);let e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){let r=new t.Box3;this.boundingBox.setFromBufferAttribute(e),r.setFromBufferAttribute(n),this.boundingBox.union(r)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new t.Sphere),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){let r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0,a=new t.Vector3;for(let t=0,o=e.count;t<o;t++)a.fromBufferAttribute(e,t),i=Math.max(i,r.distanceToSquared(a)),a.fromBufferAttribute(n,t),i=Math.max(i,r.distanceToSquared(a));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error(`THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.`,this)}}toJSON(){}};Object.assign(sy.prototype,{isLineSegmentsGeometry:!0});var cy={uniforms:t.UniformsUtils.merge([t.UniformsLib.common,t.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new t.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
|
|
2644
|
+
`,Vv=class extends t.Object3D{constructor(){super(),this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new X({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),this.opacityMotion=new X({opacity:0}),this.loadingMotion=new X({opacity:0}),this.disableMotion=new X({opacity:0});let e={blending:t.CustomBlending,blendSrc:t.SrcAlphaFactor,blendDst:t.OneMinusSrcAlphaFactor,blendSrcAlpha:t.OneFactor,blendDstAlpha:t.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};this.hitTestMesh=new t.Mesh(Iv,new t.MeshBasicMaterial(Object.assign(Object.assign({},e),{color:0,opacity:0}))),this.hitTestMesh.scale.set(1.5,1.5,1.5),this.ringMesh=new t.Mesh(Iv,new t.ShaderMaterial(Object.assign(Object.assign({},e),{vertexShader:zv,fragmentShader:Bv,uniforms:{opacity:{value:0}}}))),this.panoMesh=new t.Mesh(Iv,new t.ShaderMaterial(Object.assign(Object.assign({},e),{vertexShader:Lv,fragmentShader:Rv,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),this.add(this.hitTestMesh),this.add(this.ringMesh),this.add(this.panoMesh),this.renderOrder=1e4,this.needsRender=!0}setProgress(e){this.progress=e,this.setLoading(e>0)}setOpacity(e){this.opacity!==e&&(this.opacity=e=H(e,0,1),this.opacityMotion.set({opacity:e},30).catch(G))}setCurrent(e){if(this.current!==e){if(e)this.currentMotion.setKeyframes([{progress:0,value:{ringScale:2,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.05,value:{ringScale:1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.15,value:{ringScale:1.2,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.25,value:{ringScale:1.1,ringOpacity:1,circleFade:0,circleOpacity:.85,circleScale:1}},{progress:.8,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1}},{progress:.9,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:.92,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.65,circleScale:.8}},{progress:1,value:{ringScale:1.1,ringOpacity:1,circleFade:1,circleOpacity:.85,circleScale:1.1}}],1500).catch(G);else{let e=[{progress:0,value:Object.assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(e,200).catch(G)}this.current=e}}setLoading(e){this.loading!==e&&(e?this.loadingMotion.setKeyframes([{progress:0,value:{opacity:0}},{progress:.3,value:{opacity:0}},{progress:1,value:{opacity:.8}}],500).catch(G):this.loadingMotion.set({opacity:0},0).catch(G),this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.needsRender=!0)}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({opacity:+!!e},300).catch(G),this.needsRender=!0)}tap(){return Promise.resolve()}updateTime(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);let n=this.opacityMotion.value.opacity;this.visible=n!==0;let{ringScale:r,ringOpacity:i,circleFade:a,circleOpacity:o,circleScale:s}=this.currentMotion.value;this.ringMesh.scale.set(r,1,r),this.ringMesh.material.uniforms.opacity.value=i*n,this.panoMesh.material.uniforms.opacity.value=n,this.panoMesh.material.uniforms.circleOpacity.value=o,this.panoMesh.material.uniforms.circleScale.value=s,this.panoMesh.material.uniforms.circleFade.value=a,this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingMotion.value.opacity,this.panoMesh.material.uniforms.disable.value=this.disableMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0}dispose(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()}},Hv=1500,Uv=Object.assign({},fr(Q_,[`maxLatitude`,`minLatitude`])),Wv=class e extends $_{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:`VRPanorama`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`VRPanorama`,this.cardboard=new Dv(this.renderer);let r=Fv();this.helperElement=r;let i=new Hg(r);this.element.parentNode&&(this.element.parentNode.insertBefore(r,this.element),this.updateHelperElementSize(),i.on(`tap`,()=>this.emit(`vr.requestExit`,Q(`vr.requestExit`,{})))),this.destroyHelper=()=>{i.destroy(),r.parentNode&&r.parentNode.removeChild(r),this.helperElement=void 0}}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}destroy(){super.destroy(),this.cardboard.dispose(),this.destroyHelper()}isReady(){return!1}updateRenderSize(){this.needsRender=!0}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,n,...r){var i,a,o,s,c,l;if(this.destroyed)return;this.updateHelperElementSize(),this.userAction=!0,this.needsRender=!0;let u={},d={},f=this.locationMotion.keyframes[0],p=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[m,h]=this.locationMotion.getKeyFrameSegment(e),g=this.panoResourceFromLocationMotionKeyframe(m),_=this.panoResourceFromLocationMotionKeyframe(h),v=this.panoResourceFromLocationMotionKeyframe(f),y=this.panoResourceFromLocationMotionKeyframe(p),b=!1;if(this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),u.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let n=this.locationMotion.value.count-h.value.count+1,r=new t.Vector3().copy(g.position),o=new t.Vector3().copy(_.position);if(u.progress=n,n>=.01&&n<=.99&&(u.progress=H(_.effectEasing(n),.01,.99)),_.panoPicture&&(n<1?g.panoPicture&&(u.pano0=g.panoPicture):u.pano0=_.panoPicture,u.pano1=_.panoPicture),_.effect===`montage`?u.transition=`BLACK`:_.effect===`spread`?u.transition=`SPREAD`:u.transition=`FADE`,_.effect===`zoomin`||_.effect===`zoomout`?u.progress=Math.pow(n,3):_.effect===`model`&&this.camera.pose.distance<.01&&(u.modelAlpha=1-Math.pow(H(Math.abs(n-.5)*2,0,1),4)),n<1&&_.effect!==`fly`){if(u.pano0&&g.panoPicture){let e={panoId:u.pano0.panoId,map:u.pano0.map,mapHistogram:u.pano0.mapHistogram,mapSize:u.pano0.mapSize,zoom:u.pano0.zoom,matrix:g.panoPicture.matrix.clone().setPosition(_.position)},t=this.panoPictureObserverMap.get(u.pano0);t&&this.panoPictureObserverMap.set(e,t),u.pano0=e}r.copy(o),b=!0}d.distance=this.locationMotion.value.distance,d.offset=new t.Vector3(r.x+(o.x-r.x)*n,r.y+(o.y-r.y)*n,r.z+(o.z-r.z)*n);let s=[],c=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(s.push(t),n>this.locationMotion.progress&&c.push(t))}for(let e of Object.keys(this.panoResources)){if(c.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.panoPicture){let e=t.panoPicture.map;if(e){if(e===((i=u.pano0)==null?void 0:i.map)||e===((a=u.pano1)==null?void 0:a.map))continue;e.dispose(),t.panoPicture=null}}s.indexOf(e)>=0||delete this.panoResources[e]}this.currentPano=zp(_.panoId),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:zp(v.panoId),pano:zp(y.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},zp(y.panoId)),{mode:this.mode}),$(this.camera.pose)),d),options:{},progress:this.locationMotion.progress,error:null}))}Ng(u)===!1&&this.modelScene.parameter.set(u),d.offset&&this.camera.position.copy(d.offset);let x=this.camera.pose.longitude,S=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.computePose(),(x!==this.camera.pose.longitude||S!==this.camera.pose.latitude)&&(this.cameraMotion.set(dr(this.camera.pose,[`longitude`,`latitude`]),0).catch(G),this.emit(`camera.update`,Q(`camera.update`,{userAction:!0,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose))}))),this.works.getObserver(this.currentPano);let C=this.works.getObserver(g.panoId),w=this.works.getObserver(_.panoId),T=new Map;if(C)for(let e of C.accessibleNodes){let t=C.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});T.set(e,t)}}if(w)for(let e of w.accessibleNodes){let t=w.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});T.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{let n=T.get(t);n?(e.position.copy(n.position).applyMatrix4(n.work.transform),T.delete(t)):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),T.forEach((e,t)=>{let n=new Vv;n.position.copy(e.position).applyMatrix4(e.work.transform),e.position.distanceTo(e.standingPosition)>this.aerialObserverMinHeight?n.scale.setScalar(15):n.scale.setScalar(1),this.panoMeshes.set(t,n),this.helper.add(n),T.delete(t)}),this.camera.pose.distance>.1||b?this.panoMeshes.forEach((t,r)=>{t.setOpacity(0),t.updateTime&&t.updateTime(e,n),t.visible=!1}):this.panoMeshes.forEach((e,t)=>{let n=zp(t),r=this.works.getObserver(n);if(!r)return;if(!r.loadable&&!r.active){e.setOpacity(0);return}let i=e.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);i<.05?e.setOpacity(0):e.setOpacity(H(1.5/i,0,1)),Bp(this.currentPano,n)&&e.setOpacity(0),e.lookAt(this.camera.position)}),this.locationMotion.ended){let t=this.intersect(e);this.panoMeshes.forEach((r,i)=>{r.setCurrent(r===t),r.updateTime&&r.updateTime(e,n)})}{let e=(o=this.modelScene.parameter.progress)==null?1:o,n=Math.round(e),r=this.modelScene.parameter.pano0,i=this.modelScene.parameter.pano1,a=n===0?r:i,c;if(a&&(c=this.works.getObserver(a.panoId),c||(c=this.panoPictureObserverMap.get(a))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(ii()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!c||!a||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,panoMatrix:new t.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Yr(a.mapSize),o=e+1,l=new t.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),u=Math.floor(this.tileLevelForFov(this.camera.fov,l)),d=u>e?u:0;this.tiling.setObserver(c);let f={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:a.map,panoMatrix:a.matrix,panoZoom:a.zoom,minLevel:o,level:d},p=this.tiling.update(f),m={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:n,opacity:(r==null?void 0:r.panoId)===(i==null?void 0:i.panoId)?1:Ed(Math.abs(((s=this.modelScene.parameter.progress)==null?0:s)-.5)*2)},h=this.modelScene.parameter.refinedScreen;(p||m.pano!==(h==null?void 0:h.pano)||m.opacity!==(h==null?void 0:h.opacity))&&this.modelScene.parameter.set(`refinedScreen`,m)}}this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e);{let e=_.effect,{pano0:n,pano1:r}=this.modelScene.parameter;if(n&&r&&n!==r&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((c=this.modelScene.parameter.pano0Depth)==null?void 0:c.panoId)!==n.panoId||((l=this.modelScene.parameter.pano1Depth)==null?void 0:l.panoId)!==r.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1});let e=new t.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(n.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,K_(this.renderer,this.modelScene,e,500);let i=new t.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);i.matrix.copy(r.matrix),i.matrixWorld.copy(i.matrix),i.matrixAutoUpdate=!1,K_(this.renderer,this.modelScene,i,500),this.modelScene.parameter.set({pano0Depth:{panoId:n.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:r.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(){return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.cardboard.render(this.scene,this.camera),!0}setCamera(e={}){}destroyHelper(){}updateHelperElementSize(){if(!this.helperElement)return;let e=new t.Vector2(this.element.offsetWidth,this.element.offsetHeight),n=e.x*this.viewport.left,r=e.y*(1-this.viewport.bottom-this.viewport.height),i=e.x*this.viewport.width,a=e.y*this.viewport.height;this.helperElement.style.marginLeft!==n+`px`&&(this.helperElement.style.marginLeft=n+`px`),this.helperElement.style.marginTop!==r+`px`&&(this.helperElement.style.marginTop=r+`px`),this.helperElement.style.width!==i+`px`&&(this.helperElement.style.width=i+`px`),this.helperElement.style.height!==a+`px`&&(this.helperElement.style.height=a+`px`)}intersect(e){var n,r;if(this.locationMotion.ended===!1){this.intersectMesh.visible=!1,this.activePanoMesh=void 0,this.activeTime=void 0;return}if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>Hv){let e=this.activePanoMesh,t=null;return this.panoMeshes.forEach((n,r)=>{n===e&&(t=r)}),t!==null&&this.moveToPano(zp(t),{},!0),this.activePanoMesh=void 0,this.activeTime=void 0,e}let i=this.camera.getDirection(new t.Vector3),a=new t.Raycaster(this.camera.position,i);a.params.Points={threshold:.1},a.firstHitOnly=!0,a.floorIndex=-1;let o,s=[],c=this.works.getObserver(this.currentPano),l=c?c.accessibleNodes.map(e=>Z({panoIndex:e,workCode:c.work.workCode})):[];for(let e of l){let t=this.panoMeshes.get(e);if(t){let[e]=a.intersectObject((n=t.hitTestMesh)==null?t:n,!0);if(e){let n=(r=c==null?void 0:c.floorIndex)==null?0:r;s.push({panoMesh:t,intersection:Object.assign({floorIndex:n,floor:n},e)})}}}let[u]=s.sort((e,t)=>e.intersection.distance-t.intersection.distance);u?(o=u.intersection,this.activePanoMesh!==u.panoMesh&&(this.activePanoMesh=u.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(u.panoMesh.position),this.intersectMesh.lookAt(this.camera.position)):(this.activePanoMesh=void 0,this.activeTime=void 0),o||(o=this.modelScene.intersectRaycaster(a)[0]);let d=Q(`intersect.update`,{raycaster:a,intersection:o==null?null:o,object:this.intersectMesh});if(this.emit(`intersect.update`,d),d.defaultPrevented){this.hideIntersectMesh();return}if(o&&o.face){let e=o.face.normal,n=new t.Quaternion;n.setFromUnitVectors(new t.Vector3(0,0,1),e),this.intersectMesh.quaternion.copy(n);let r=o.point.clone();this.intersectMesh.position.copy(r),u?this.intersectMesh.visible=!1:this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return u==null?void 0:u.panoMesh}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}},Gv=new t.Vector3(0,1.6,0),Kv=new t.Box3,qv=new t.Vector3,Jv=Object.assign({},e_),Yv=class e extends t_{static parseArgs(t){return t instanceof e?t:super.parseArgs(t)}static initAnimationEndState(e){var n,r,i,a,o,s,c;let l=this.parseArgs(e),u=l.works,{state:d,currentState:f}=e.initial,p=typeof d.panoIndex==`number`?{workCode:(i=(n=d.workCode)==null?(r=l.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:d.panoIndex}:{workCode:f.workCode,panoIndex:f.panoIndex},m=u.getObserver(p),h=H((a=d.fov)==null?!m||Mg(f.mode)?f.fov:l.defaultFov:a,l.minFov,l.maxFov),g=(o=d.longitude)==null?f.longitude:o,_=H(typeof l.minLatitude==`function`?l.minLatitude(h):l.minLatitude,-Math.PI/2,Math.PI/2),v=H(typeof l.maxLatitude==`function`?l.maxLatitude(h):l.maxLatitude,-Math.PI/2,Math.PI/2),y=H((s=d.latitude)==null?!m||Mg(f.mode)?f.latitude:l.defaultLatitude:s,_,v),b=new t.Vector3;if(l.initial.state.offset)b.copy(l.initial.state.offset);else if(m)b.copy(m.position).applyMatrix4(m.work.transform);else{let e=It(f).setLength(f.distance);b.copy(l.initial.currentState.offset).sub(e)}return{workCode:p.workCode,panoIndex:p.panoIndex,mode:`Model`,longitude:g,latitude:y,fov:h,offset:b,distance:(c=d.distance)==null?0:c}}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Model`,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x})}updateConfiguration(e){return super.updateConfiguration(e)}destroy(){super.destroy(),this.locationMotion.dispose()}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(t,n,r,i){this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));return(a.workCode!==this.currentPano.workCode||a.panoIndex!==this.currentPano.panoIndex||a.longitude!==this.cameraMotion.value.longitude||a.latitude!==this.cameraMotion.value.latitude||a.fov!==this.cameraMotion.value.fov||a.distance!==this.locationMotion.value.distance)&&this.moveToPosition(a.offset,{duration:0,longitude:a.longitude,latitude:a.latitude,fov:a.fov,distance:a.distance},i),!0}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(G),this.cameraMotion.set(i,t).catch(G)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(G),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,n,...r){if(this.destroyed)return;let i={},a={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),i.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),i.progress=1,i.pano0=i.pano1=t}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),a.distance=this.locationMotion.value.distance,a.offset=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);let n=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),r=[];for(let e of this.works){let t=this.modelScene.models.find(t=>t.work===e);if(!(!t||t.visible===!1)&&!(e.observers.length<=0)&&(Kv.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),Kv.containsPoint(n)))for(let t of e.observers)r.push(t)}let i=vu(r,e=>qv.copy(e.position).applyMatrix4(e.work.transform).distanceTo(n));this.currentPano=i?{workCode:i.work.workCode,panoIndex:i.panoIndex}:{workCode:``,panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(e),a.longitude=this.cameraMotion.value.longitude,a.latitude=this.cameraMotion.value.latitude,a.fov=this.cameraMotion.value.fov),Ng(i)||this.modelScene.parameter.set(i),Ng(a)||this.setCamera(a);let o=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&o&&o.position.y-o.standingPosition.y>10){let e=H(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)}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={modelAlpha:1},c={perspToOrtho:0},l={longitude:o.longitude,latitude:o.latitude,fov:o.fov,distance:o.distance,duration:i,moveStartCallback:e=>{this.perspToOrthoMotion.set(c,i).catch(G),this.modelAlphaMotion.set(s,i).catch(G),this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:e,userAction:this.userAction}))},moveEndCallback:e=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:e,userAction:this.userAction})),t()},moveCancelCallback:()=>{let e=this.currentPano,n=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:this.camera.pose.distance});this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:n,userAction:this.userAction})),t()}};this.moveToPosition(o.offset,l,a)})}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(V())[1],n=this.locationMotion.getKeyFrameSegment(V())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new t.Vector3(n.value.x,n.value.y,n.value.z),distance:n.value.distance})}moveToPano(e,n={},r){let i=this.works.getObserver(e);if(i){let e=new t.Vector3().copy(i.position).applyMatrix4(i.work.transform);this.moveToPosition(e,n,r)}}moveToPosition(e,n={},r){var i,a,o,s;this.userAction=r,this.stopMomentumMovement();let c=V(),l=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),u=l.distanceTo(e),d=this.locationMotion.getProgressVelocity(c),f=0;for(let e=1;e<this.locationMotion.keyframes.length;e++){let{x:t,y:n,z:r}=this.locationMotion.keyframes[e-1].value,{x:i,y:a,z:o}=this.locationMotion.keyframes[e].value;f+=Math.sqrt(Math.pow(i-t,2)+Math.pow(a-n,2)+Math.pow(o-r,2))}let p=u===0?0:d*f/u,m=this.calculateMovingDuration(n.duration,u),h={x:e.x,y:e.y,z:e.z,distance:(i=n.distance)==null?this.locationMotion.value.distance:i},g={longitude:n.longitude,latitude:n.latitude,fov:n.fov},_=[];for(let e of this.works){let t=this.modelScene.models.find(t=>t.work===e);if(!(!t||t.visible===!1)&&!(e.observers.length<=0)&&(Kv.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),Kv.containsPoint(l)))for(let t of e.observers)_.push(t)}let v=vu(_,e=>qv.copy(e.position).applyMatrix4(e.work.transform).distanceTo(l)),y=v?{workCode:v.work.workCode,panoIndex:v.panoIndex}:{workCode:``,panoIndex:0},b=Object.assign(Object.assign({},y),{mode:this.mode,longitude:(a=g.longitude)==null?this.camera.pose.longitude:a,latitude:(o=g.latitude)==null?this.camera.pose.latitude:o,fov:(s=g.fov)==null?this.camera.pose.fov:s,offset:e.clone(),distance:h.distance}),x=this.currentPano;this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:n,prevPano:x,pano:{panoIndex:b.panoIndex,workCode:b.workCode},progress:0,state:b,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(b),this.cameraMotion.set(g,m).catch(G),this.locationMotion.set(h,m,p).then(()=>{for(let e of this.modelScene.children)e instanceof dp&&e.show();let e=Object.assign(Object.assign(Object.assign({},y),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.arrived`,Q(`pano.arrived`,{options:n,prevPano:x,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(e)},()=>{n.moveCancelCallback&&n.moveCancelCallback(),this.emit(`pano.cancel`,Q(`pano.cancel`,{options:n,prevPano:x,pano:{panoIndex:b.panoIndex,workCode:b.workCode},progress:0,state:b,userAction:this.userAction,error:null}))})}onTapGesture(e){let n=e.center.raycaster;this.stopMomentumMovement();let[r]=this.modelScene.intersectRaycaster(n);if(r&&r.face){let e=r.face.normal,n=r.point;if(new t.Vector3(0,1,0).angleTo(e)>Math.PI/3){let i=new t.Raycaster;i.firstHitOnly=!0;let a=e.clone().setLength(.3).add(n);i.set(a,new t.Vector3(0,-1,0)),r=this.modelScene.intersectRaycaster(i)[0]}}if(r){let n=new t.Vector3().copy(r.point).add(Gv),i=[];for(let e of this.works){let t=this.modelScene.models.find(t=>t.work===e);if(!(!t||t.visible===!1)&&!(e.observers.length<=0)&&(Kv.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),Kv.containsPoint(n)))for(let t of e.observers)i.push(t)}let[a,o]=vu(i,e=>qv.copy(e.position).applyMatrix4(e.work.transform).distanceTo(n),!0);a&&o<5&&(n.y=qv.copy(a.position).applyMatrix4(a.work.transform).y),e.state.offset.copy(n),e.state.distance=0,this.emit(`gesture.tap`,e),e.defaultPrevented||this.moveToPosition(n,{},!0)}else this.emit(`gesture.tap`,e),e.defaultPrevented||this.cameraBounce()}},Xv=new t.Box3,Zv=new t.Vector3,Qv=.5,$v=Math.PI/7,ey={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:Math.PI/2,minLatitude:0,cameraType:`auto`,cameraFence:null,intersectMeshCreator:()=>new Kg},ty=class e extends Ug{static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{defaultLongitude:(n=t.defaultLongitude)==null?ey.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?ey.defaultLatitude:r,defaultDistance:(i=t.defaultDistance)==null?ey.defaultDistance:i,maxLatitude:(a=t.maxLatitude)==null?ey.maxLatitude:a,minLatitude:(o=t.minLatitude)==null?ey.minLatitude:o,cameraType:(s=t.cameraType)==null?ey.cameraType:s,cameraFence:(c=t.cameraFence)==null?ey.cameraFence:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?ey.intersectMeshCreator:l})}static distanceFromModel(e,t,n){let r=e.boundingBox,i=r.isEmpty()?10:Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),1/2);i=isNaN(i)||!isFinite(i)?1:i;let a=i/2/Math.tan(Math.PI*t/360);return n<1&&(a/=n),isNaN(a)||!isFinite(a)?i:a}static initAnimationEndState(n){var r,i,a,o,s,c,l;let u=this.parseArgs(n),d=u.works,f=u.modelScene,{state:p,currentState:m}=n.initial,h=typeof p.panoIndex==`number`?{workCode:(a=(r=p.workCode)==null?(i=u.works[0])==null?void 0:i.workCode:r)==null?``:a,panoIndex:p.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},g=(o=p.fov)==null?60:o,_=H(typeof u.minLatitude==`function`?u.minLatitude(g):u.minLatitude,-Math.PI/2,Math.PI/2),v=H(typeof u.maxLatitude==`function`?u.maxLatitude(g):u.maxLatitude,-Math.PI/2,Math.PI/2),y=H((s=p.latitude)==null?jg(m.mode)?m.latitude:u.defaultLatitude:s,_,v),b=e.distanceFromModel(u.modelScene,g,u.camera.aspect),x=new t.Vector3,S=(c=p.distance)==null?Math.min(u.defaultDistance,b):c,C=(l=p.longitude)==null?jg(m.mode)?m.longitude:u.defaultLongitude:l;if(p.offset)x.copy(p.offset);else{let e=d.getObserver(h);u.defaultDistance<b&&e?(x.copy(e.position).applyMatrix4(e.work.transform),p.longitude===void 0&&(C=m.longitude)):(f.boundingBox.getCenter(x),S=b)}return Object.assign(Object.assign({},h),{mode:`Mapview`,longitude:C,latitude:y,fov:g,offset:x,distance:S})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Mapview`,this.defaultLongitude=n.defaultLongitude,this.defaultLatitude=n.defaultLatitude,this.defaultDistance=n.defaultDistance,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.cameraType=n.cameraType,this.cameraFence=n.cameraFence,this.locationMotion=new X({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new X({modelAlpha:this.modelScene.parameter.resolveValue(`modelAlpha`)}),this.perspToOrthoMotion=new X({perspToOrtho:this.camera.perspToOrtho.x}),this.pendingTextureId=null,this.textureLoader=new fi,this.intersectMeshCreator=n.intersectMeshCreator,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof t.Box3&&e.cameraFence instanceof t.Box3||this.cameraFence instanceof t.Sphere&&e.cameraFence instanceof t.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return!0}destroy(){super.destroy(),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(t,n,r,i){this.userAction=i,this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));this.currentPano={workCode:a.workCode,panoIndex:a.panoIndex};let o={longitude:a.longitude,latitude:a.latitude,fov:a.fov},s={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance};return(o.longitude!==this.cameraMotion.value.longitude||o.latitude!==this.cameraMotion.value.latitude||o.fov!==this.cameraMotion.value.fov)&&this.cameraMotion.set(o,r.duration).catch(G),(s.x!==this.locationMotion.value.x||s.y!==this.locationMotion.value.y||s.z!==this.locationMotion.value.z||s.distance!==this.locationMotion.value.distance)&&this.locationMotion.set(s,r.duration).catch(G),!0}updateModel(e){super.updateModel(e),this.hideIntersectMesh()}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(G),this.cameraMotion.set(i,t).catch(G)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(G),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,n){if(this.destroyed)return;let r={},i={};if(this.locationMotion.ended||(this.locationMotion.update(e),i.distance=this.locationMotion.value.distance,i.offset=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),r.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),r.progress=1,r.pano0=r.pano1=t}let a=0;if(this.cameraType===`auto`?a=+(Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02):this.cameraType===`perspective`?a=0:this.cameraType===`orthographic`&&(a=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==a&&this.perspToOrthoMotion.set({perspToOrtho:a},500).catch(G),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),Ng(r)||this.modelScene.parameter.set(r),Ng(i)||this.setCamera(i),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){let e=It(this.camera.pose,new t.Vector3),n=new t.Vector3().copy(this.camera.pose.offset).sub(e.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(n)>.01){let e=this.cameraFence.clampPoint(n,new t.Vector3),r=this.camera.pose.offset.clone().add(e).sub(n),i=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:r,distance:this.camera.pose.distance});this.fixFinalState(i),this.locationMotion.set({x:i.offset.x,y:i.offset.y,z:i.offset.z,distance:i.distance},300).catch(G)}}if(this.intersectMesh&&this.intersectMesh.parent){let e=H(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)}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(V())[1],n=this.locationMotion.getKeyFrameSegment(V())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:n.value.distance,offset:new t.Vector3(n.value.x,n.value.y,n.value.z)})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={longitude:o.longitude,latitude:o.latitude,fov:o.fov},c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,Q(`initAnimation.start`,{state:o,userAction:this.userAction})),this.perspToOrthoMotion.set({perspToOrtho:0},i).catch(G),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(G),this.cameraMotion.set(s,i).catch(G),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`initAnimation.end`,Q(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}getForwardObserverOrNot(e){let[t]=this.modelScene.intersectRaycaster(e);if(!t)return null;let n=[];for(let t of this.works){let r=this.modelScene.models.find(e=>e.work===t);if(!(!r||r.visible===!1)&&!(t.observers.length<=0)&&(Xv.copy(t.observerBox).expandByScalar(10).applyMatrix4(t.transform),Xv.containsPoint(e.ray.origin)||e.ray.intersectsBox(Xv)))for(let e of t.observers)n.push(e)}let[r,i]=vu(n,e=>Zv.copy(e.standingPosition).applyMatrix4(e.work.transform).distanceTo(t.point),!0);return r&&i<Math.max(r.standingPosition.distanceTo(this.camera.position)/5,10)?r:null}coordinatesForOffset(e){let n=this.renderer.getSize(new t.Vector2);return{longitude:-2*e.x/(n.x*this.viewport.width),latitude:2*e.y/(n.y*this.viewport.height)}}requestMomentumMovement(e,n,r,i){if(this.inMomentumMovement===null)return;i=Math.max(i,1);let a=Object.assign({},r),o={longitude:0,latitude:0,x:0,y:0,z:0};for(let e=0;e<i;e++)a.longitude*=.996,a.latitude*=.996*.998,a.x*=.99,a.y*=.99,a.z*=.99,o.longitude+=a.longitude,o.latitude+=a.latitude,o.x+=a.x,o.y+=a.y,o.z+=a.z;let s=this.cameraMotion.value.fov,c=Ft(this.cameraMotion.value.longitude+o.longitude),l=H(typeof this.minLatitude==`function`?this.minLatitude(s):this.minLatitude,-Math.PI/2,Math.PI/2),u=H(typeof this.maxLatitude==`function`?this.maxLatitude(s):this.maxLatitude,-Math.PI/2,Math.PI/2),d=H(this.cameraMotion.value.latitude+o.latitude,l,u),f=new t.Vector3(this.locationMotion.value.x+o.x,this.locationMotion.value.y+o.y,this.locationMotion.value.z+o.z),p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:d,offset:f,fov:s,distance:this.locationMotion.value.distance}),m=e.state.offset.clone().sub(It(e.state).setLength(p.distance)),h=!(Math.abs(a.longitude)>1e-4||Math.abs(a.latitude)>1e-4||Math.abs(a.x)>1e-4||Math.abs(a.y)>1e-4||Math.abs(a.z)>1e-4);(this.cameraFence?this.cameraFence.containsPoint(m):!0)===!1&&(h=!0);let g=Q(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:n,isFinal:h,state:p}));if(this.emit(`gesture.fire`,g),this.inMomentumMovement.event=g,this.emit(`gesture.momentum`,g),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:c,latitude:d},0).catch(G),this.locationMotion.set({x:p.offset.x,y:p.offset.y,z:p.offset.z,distance:p.distance},0).catch(G),h?this.inMomentumMovement=null:ei.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,a,n)},!0))}fixFinalState(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho===1)return;let n=It(e,new t.Vector3),r=new t.Vector3().copy(e.offset).sub(n.clone().setLength(e.distance)),i=new t.Raycaster(r,n);i.params.Points={threshold:.1},i.firstHitOnly=!0,i.hitFilter=e=>e.distance>Qv+i.near,i.near=this.camera.near,i.far=this.camera.far;let a;if(a=this.modelScene.intersectRaycaster(i)[0],a&&a.distance<this.camera.near&&(a=void 0),!a){let e=new t.Plane(new t.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),n=i.ray.intersectPlane(e,new t.Vector3);if(n){let e=n.distanceTo(i.ray.origin);e<1e3&&e>=i.near&&(a={distance:e,floorIndex:0,floor:0,point:n,object:this.scene,face:null})}}if(!a){let t=Math.max(e.distance,3);a={distance:t,floorIndex:0,floor:0,point:r.clone().add(n.clone().setLength(t)),object:this.scene,face:null}}a.distance>=this.camera.near&&gg(e.distance,a.distance)&&(e.distance=a.distance,e.offset=a.point)}onPanGesture(n){this.userAction=n.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let r=n.pointers.length,i=this.panState,a=0,o=!1;n.pointerType===`mouse`&&(a=n.center.buttons,o=n.center.shiftKey),i&&a===0&&i.buttons!==0&&(a=i.buttons);let s=i==null?void 0:i.target;if(!s){let r=this.relativeClientPosition(n.center),i=this.createRaycasterFromCamera(r,this.camera);s=new t.Vector3().copy(i.ray.direction).multiplyScalar(3).add(i.ray.origin);let[a]=this.modelScene.intersectRaycaster(i);if(!a&&i.ray.direction.y<-.3){let e=new t.Plane(new t.Vector3(0,1,0),0),n=i.ray.intersectPlane(e,new t.Vector3);if(n){let e=n.distanceTo(i.ray.origin);e<1e4&&e>=i.near&&(a={distance:e,floorIndex:0,floor:0,point:n,object:this.scene})}}if(a)s.copy(a.point);else{let e=new t.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),n=new t.Plane().setFromNormalAndCoplanarPoint(e,this.camera.pose.offset);i.ray.intersectPlane(n,s)}let o=e.distanceFromModel(this.modelScene,this.camera.pose.fov,this.camera.aspect)*2;s.distanceTo(i.ray.origin)>o&&s.copy(i.ray.direction).setLength(o).add(i.ray.origin)}if(n.isFinal?this.panState=void 0:this.panState={target:s,buttons:a,pointerLength:r,defaultPrevented:n.defaultPrevented,x:n.center.x,y:n.center.y},i===void 0||i.pointerLength!==r){this.emit(`gesture.pan`,n);return}if(r>1||a===2||o){let r={x:n.center.x-i.x,y:n.center.y-i.y},a=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),o=It(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(a),s=new t.Vector3().copy(o).sub(i.target).length();s*=Math.tan(this.camera.pose.fov/2*Math.PI/180);let c=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect)*2;s=Math.min(s,c);let l=this.renderer.getSize(new t.Vector2),u=2*r.x*s/l.y,d=2*r.y*s/l.y,f=new t.Vector3;f.setFromMatrixColumn(this.camera.matrix,0),f.multiplyScalar(-u),a.add(f),this.camera.pose.latitude<$v?f.setFromMatrixColumn(this.camera.matrix,1):(f.setFromMatrixColumn(this.camera.matrix,0),f.crossVectors(this.camera.up,f)),f.multiplyScalar(d),a.add(f);let p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:a,distance:this.camera.pose.distance});if(n.state=p,this.emit(`gesture.pan`,n),n.defaultPrevented){this.panState&&(this.panState.defaultPrevented=n.defaultPrevented);return}if(n.isFinal&&i.defaultPrevented)return;if(this.locationMotion.set({x:p.offset.x,y:p.offset.y,z:p.offset.z},0).catch(G),n.isFinal&&(this.fixFinalState(p),Object.assign(n,{__fixFinalState:!0}),this.locationMotion.set({distance:p.distance,x:p.offset.x,y:p.offset.y,z:p.offset.z},0).catch(G)),n.isFinal){let e=this.renderer.getSize(new t.Vector2),r=2*n.velocityX*s/e.y,i=2*n.velocityY*s/e.y,a=new t.Vector3,o=new t.Vector3;a.setFromMatrixColumn(this.camera.matrix,0),a.multiplyScalar(-r),o.add(a),this.camera.pose.latitude<$v?a.setFromMatrixColumn(this.camera.matrix,1):(a.setFromMatrixColumn(this.camera.matrix,0),a.crossVectors(this.camera.up,a)),a.multiplyScalar(i),o.add(a),this.inMomentumMovement={uuid:Zt()},this.requestMomentumMovement(n,!0,{longitude:0,latitude:0,x:o.x,y:o.y,z:o.z},0)}}else{let e={x:n.center.x-i.x,y:n.center.y-i.y},t=this.coordinatesForOffset(e),r=Ft(this.cameraMotion.value.longitude+t.longitude),a=this.camera.pose.fov,o=H(typeof this.minLatitude==`function`?this.minLatitude(a):this.minLatitude,-Math.PI/2,Math.PI/2),s=H(typeof this.maxLatitude==`function`?this.maxLatitude(a):this.maxLatitude,-Math.PI/2,Math.PI/2),c=H(this.cameraMotion.value.latitude+t.latitude,o,s);this.camera.aspect<1&&Math.abs(n.overallVelocityX)>.2&&Math.atan2(Math.abs(n.overallVelocityY),Math.abs(n.overallVelocityX))<Math.PI/6.923&&(c=this.cameraMotion.value.latitude);let l=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:r,latitude:c,fov:a,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(n.isFinal&&Object.assign(n,{__fixFinalState:!0}),n.state=l,this.emit(`gesture.pan`,n),n.defaultPrevented||n.isFinal&&i.defaultPrevented)return;if(n.isFinal?this.locationMotion.set({distance:l.distance,x:l.offset.x,y:l.offset.y,z:l.offset.z},0).catch(G):this.cameraMotion.set({longitude:l.longitude,latitude:l.latitude},0).catch(G),n.isFinal){let e=n.velocityX,t=n.velocityY;this.inMomentumMovement={uuid:Zt()},this.requestMomentumMovement(n,!0,Object.assign(Object.assign({},this.coordinatesForOffset({x:e,y:t})),{x:0,y:0,z:0}),0)}}}onPinchGesture(n){var r;if(!this.initAnimationIsReady)return;this.userAction=n.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let i=(r=this.pinchState)==null?void 0:r.distance;if(n.isFirst){this.pinchState={x:n.center.x,y:n.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(i===void 0)return;let a=this.modelScene.boundingBox.getCenter(new t.Vector3),o=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),s=H(i/n.scale,Qv,1/0),c=n.state.offset.clone().sub(It(n.state).setLength(s)),l=this.modelScene.boundingBox.containsPoint(c),u;if(!l&&this.pinchState&&this.pinchState.scale>n.scale&&a.distanceTo(c)>o?u=n.state.distance:(u=s,this.pinchState&&(this.pinchState.scale=n.scale)),n.state.distance=u,this.emit(`gesture.pinch`,n),!n.defaultPrevented&&(this.locationMotion.set({distance:n.state.distance},0).catch(G),n.pointerType!==`mouse`&&(n.type=`gesture.pan`,this.onPanGesture(n)),n.isFinal)){if(!(`__fixFinalState`in n)){let e=n.state;this.fixFinalState(n.state);let t={x:e.offset.x,y:e.offset.y,z:e.offset.z,distance:e.distance};this.locationMotion.set(t,0).catch(G)}this.panState=void 0,this.pinchState=void 0}}onMouseMove(e){var n,r;if(!this.intersectMesh.parent||this.panState||this.pinchState||this.mouseWheelState||(this.emit(`gesture.mousemove`,e),e.defaultPrevented))return;let i=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}let[a]=this.modelScene.intersectRaycaster(i),o=Q(`intersect.update`,{raycaster:i,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}if(a){let e=(r=(n=a.face)==null?void 0:n.normal)==null?new t.Vector3().copy(i.ray.direction).multiplyScalar(-1):r,o=e.clone(),s=a.point.clone();this.intersectMesh.position.copy(s);let c=s.clone().add(o);if(this.intersectMesh.lookAt(c),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(s);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onMouseWheel(n){if(this.initAnimationIsReady)if(this.userAction=n.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),n.isFinal){let e=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov,offset:new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),distance:this.locationMotion.value.distance});if(this.fixFinalState(e),this.emit(`gesture.mousewheel`,n),n.defaultPrevented)return;let r={x:e.offset.x,y:e.offset.y,z:e.offset.z,distance:e.distance};this.locationMotion.set(r,0).catch(G)}else{let r=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),i=new t.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=It(this.cameraMotion.value,new t.Vector3).negate(),o=new t.Ray(i,a).intersectBox(this.modelScene.boundingBox,new t.Vector3);o&&(r+=o.distanceTo(i));let s=Math.max(this.locationMotion.value.distance-this.camera.near,0),c=n.center.delta/10*Math.max(s/5,.1);if(s<=r||c>0)if(this.locationMotion.value.distance-c>=Qv){let e=this.locationMotion.value.distance-c;n.state.distance=e}else{let e=It(this.cameraMotion.value);e.setLength(c),n.state.offset.add(e)}if(this.emit(`gesture.mousewheel`,n),n.defaultPrevented)return;this.locationMotion.set({distance:n.state.distance,x:n.state.offset.x,y:n.state.offset.y,z:n.state.offset.z},0).catch(G)}}onTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let n=e.center.raycaster,r=this.getForwardObserverOrNot(n);if(!r)this.emit(`gesture.tap`,e);else{let n={longitude:this.camera.pose.longitude,latitude:0},i=Object.assign(Object.assign({},e.state),{mode:`Panorama`,workCode:r.work.workCode,panoIndex:r.panoIndex,longitude:n.longitude,latitude:n.latitude,offset:r?r.position.clone():new t.Vector3,distance:0});if(e.state=i,this.emit(`gesture.tap`,e),!e.defaultPrevented&&(this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},state:i,userAction:e.userAction,options:n,progress:0,error:null})),r&&r.active)){let e=this.pendingTextureId=Zt(),a={panoIndex:r.panoIndex,workCode:r.work.workCode},o=Z(a),s={right:r.images.work.getURL(r.images.right),left:r.images.work.getURL(r.images.left),up:r.images.work.getURL(r.images.up),down:r.images.work.getURL(r.images.down),front:r.images.work.getURL(r.images.front),back:r.images.work.getURL(r.images.back)},c=this.imageOptions.transform,l=Object.assign({key:`pano.${o}`},dr(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),u=`pano:`+Lp([s,l,c]),d=this.modelScene.parameter,f=wg(`pano.prepare`,{options:n,prevMode:this.mode,prevPano:this.currentPano,pano:a});if(this.emit(`pano.prepare`,f),f.defaultPrevented){this.pendingTextureId=null;return}f.options!==n&&Object.assign(n,f.options);let p;d.pano0&&d.pano0.map.name===u?p=d.pano0:d.pano1&&d.pano1.map.name===u&&(p=d.pano1),p?Promise.resolve().then(()=>Tg(f)).catch(e=>qg(e)).then(e=>{var t;e instanceof Error?(this.pendingTextureId=null,e.message&&this.emit(`error`,e)):(d.pano0&&d.pano0.map!==p.map&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==p.map&&d.pano1.map!==((t=d.pano0)==null?void 0:t.map)&&d.pano1.map.dispose(),d.set({pano0:p,pano1:p}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},progress:0,state:i,options:n,error:null})))}):Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:a}))}).then(()=>this.textureLoader.loadCubeTexture(s,{imageURL:{transform:c,options:l},format:t.RGBFormat,viaAjax:!0,fetcher:Kf(this.fiveId,r.work)},void 0,void 0,void 0,this.renderer)).catch(e=>{let t=qg(e);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:t,progress:0,meta:null,pano:a})),t}),Promise.resolve().then(()=>Tg(f)).catch(e=>qg(e))]).then(([a,s])=>{var c,l;if(!(a instanceof Error)&&!(s instanceof Error)){let{body:s}=a;if(this.destroyed||this.pendingTextureId!==e){s.dispose();return}this.pendingTextureId=null,s.name=u;let f=Array.isArray(s.image)?s.image[0]:s.image,p=(c=f==null?void 0:f.width)==null?2048:c,m=r.images.histogram;m||(m=new Hm().formPixels(Vg(this.renderer,s,!0,Rm).data),r.images.histogram=m);let h={panoId:o,map:s,mapSize:p,mapHistogram:new t.Vector4().fromArray(m.toArray()),matrix:r.matrix.clone().premultiply(r.work.transform),zoom:1};d.pano0&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==((l=d.pano0)==null?void 0:l.map)&&d.pano1.map.dispose(),d.set({pano0:h,pano1:h}),this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:i.panoIndex,workCode:i.workCode},progress:0,state:i,options:n,error:null}))}else{let t=null;if(a instanceof Error?t||(t=a):a.body.dispose(),s instanceof Error&&(t||(t=s)),this.destroyed||this.pendingTextureId!==e)return;this.pendingTextureId=null,t instanceof Error&&t.message&&this.emit(`error`,t)}})}}}onDblTapGesture(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=e.state,n=e.center.raycaster,r=n.ray.origin.clone().add(n.ray.direction.clone().setLength(3)),i=1,[a]=this.modelScene.intersectRaycaster(n);if(a&&(r=a.point.clone(),i=a.distance>4/2?1:3),e.state.distance=i,e.state.offset=r,this.emit(`gesture.dbltap`,e),e.defaultPrevented)return;let o={x:t.offset.x,y:t.offset.y,z:t.offset.z,distance:t.distance};this.locationMotion.set(o,360).catch(G),this.hideIntersectMesh()}hideIntersectMesh(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)}};function ny(e){return e==null}var ry={type:`move`},iy=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}getHandSpace(){return this._hand===null&&(this._hand=new t.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new t.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new t.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new t.Vector3),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new t.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new t.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new t.Vector3),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}getAxes(){return this._axes}update(e,n,r){let i=null,a=null,o=null,s=this._targetRay,c=this._grip,l=this._hand;if(e&&e.gamepad&&e.gamepad.axes&&(this._axes=[e.gamepad.axes[2],e.gamepad.axes[3]]),e&&n.session.visibilityState!==`visible-blurred`)if(s!==null&&(i=n.getPose(e.targetRaySpace,r),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(ry))),l&&e.hand){o=!0;for(let i of e.hand.values()){let e=n.getJointPose(i,r);if(l.joints[i.jointName]===void 0){let e=new t.Group;e.matrixAutoUpdate=!1,e.visible=!1,l.joints[i.jointName]=e,l.add(e)}let a=l.joints[i.jointName];e!==null&&(a.matrix.fromArray(e.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.jointRadius=e.radius),a.visible=e!==null}let i=l.joints[`index-finger-tip`],a=l.joints[`thumb-tip`],s=i.position.distanceTo(a.position),c=.02,u=.005;l.inputState.pinching&&s>c+u?(l.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=c-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(a=n.getPose(e.gripSpace,r),a!==null&&(c.matrix.fromArray(a.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),a.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(a.linearVelocity)):c.hasLinearVelocity=!1,a.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(a.angularVelocity)):c.hasAngularVelocity=!1));return s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),l!==null&&(l.visible=o!==null),this}},ay=1,oy=()=>{try{let e=/Macintosh/i.test(navigator.userAgent),t=navigator.maxTouchPoints===5;return e&&t}catch(e){return console.error(`Error determining if the device is an Apple Vision Pro: `,e),!1}},sy=()=>{try{return/Oculus/i.test(navigator.userAgent)}catch(e){return console.error(`Error determining if the device is an Oculus: `,e),!1}},cy=class{constructor(e,n,r){var i,a,o,s,c;this.isPanorama=(i=r==null?void 0:r.isPanorama)==null?!0:i,navigator.userAgent.toLowerCase();let l;l=oy()?`VP`:sy()?`Oculus`:`Pico`,this.machineType=(a=r==null?void 0:r.machineType)==null?l:a,this.renderer=e,this.gl=n,this.enabled=!1,this.session=null,this.referenceSpaceType=(o=r==null?void 0:r.referenceSpaceType)==null?`local-floor`:o,this.referenceSpace=null,this.onSessionStartCallback=(s=r==null?void 0:r.onSessionStart)==null?G:s,this.onSessionEndCallback=(c=r==null?void 0:r.onSessionEnd)==null?G:c,this.controllers=[new iy,new iy],this.inputSourcesMap=new Map,this.cameraVR=new t.ArrayCamera,this.cameraL=new t.PerspectiveCamera,this.cameraR=new t.PerspectiveCamera,this.cameraVR.cameras.push(this.cameraL,this.cameraR),this.cameraL.viewport=new t.Vector4,this.cameraR.viewport=new t.Vector4,this.cameraL.layers.enable(1),this.cameraR.layers.enable(2),this.cameraVR.layers.enable(1),this.cameraVR.layers.enable(2),this.isPresenting=!1,this.currentDepthNear=null,this.currentDepthFar=null,this.cameraLPos=new t.Vector3,this.cameraRPos=new t.Vector3}getController(e){let t=this.controllers[e];return t||console.warn(`no controller find`),t.getTargetRaySpace()}getRightController(){if(!this.session||!this.session.inputSources)return null;let e;if(this.session.inputSources.forEach((t,n)=>{t.handedness===`right`&&(e=n)}),e===void 0)return console.warn(`no inputSource for right hand`),null;let t=this.controllers[e];return t?t.getTargetRaySpace():(console.warn(`right controller not find`),null)}getLeftController(){if(!this.session||!this.session.inputSources)return null;let e;if(this.session.inputSources.forEach((t,n)=>{t.handedness===`left`&&(e=n)}),e===void 0)return console.warn(`no inputSource for left hand`),null;let t=this.controllers[e];return t?t.getTargetRaySpace():(console.warn(`left controller not find`),null)}getControllerGrip(e){let t=this.controllers[e];return t||console.warn(`no controller find`),t.getGripSpace()}getCameras(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}}updateCamera(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}setProjectionFromUnion(e,t,n){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(n.matrixWorld);var r=this.cameraLPos.distanceTo(this.cameraRPos),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),b=c*s/_*g,x=l*s/_*g;e.projectionMatrix.makePerspective(v,y,b,x,g,_)}getCamera(e){this.cameraVR.near=this.cameraR.near=this.cameraL.near=e.near,this.cameraVR.far=this.cameraR.far=this.cameraL.far=e.far,this.session&&(this.currentDepthNear!==this.cameraVR.near||this.currentDepthFar!==this.cameraVR.far)&&(this.session.updateRenderState({depthNear:this.cameraVR.near,depthFar:this.cameraVR.far}),this.currentDepthNear=this.cameraVR.near,this.currentDepthFar=this.cameraVR.far);let t=e.parent,n=this.cameraVR.cameras;this.updateCamera(this.cameraVR,t);for(let e=0;e<n.length;e++)this.updateCamera(n[e],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);let r=e.children;for(let e=0,t=r.length;e<t;e++)r[e].updateMatrixWorld(!0);return n.length===2?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR}updateInputSources(e){if(!this.session){console.warn(`session is lose!`);return}let t=this.session.inputSources;for(let e=0;e<this.controllers.length;e++)this.inputSourcesMap.set(t[e],this.controllers[e]);for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=this.inputSourcesMap.get(n);r&&(r.dispatchEvent({type:`disconnected`,data:n}),this.inputSourcesMap.delete(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=this.inputSourcesMap.get(n);r&&r.dispatchEvent({type:`connected`,data:n})}}onSessionEvent(e){let t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}onSessionEnd(){this.inputSourcesMap.forEach(function(e,t){e.disconnect(t)}),this.inputSourcesMap.clear(),this.isPresenting=!1,this.session=null,ei.shared.setContext(null),this.onSessionEndCallback()}onRequestReferenceSpace(e){this.referenceSpace=e,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)}setSession(e){if(this.session=e,this.session){this.session.addEventListener(`select`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`selectstart`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`selectend`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeeze`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeezestart`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`squeezeend`,e=>{this.onSessionEvent(e)}),this.session.addEventListener(`end`,e=>{this.onSessionEnd()});let e=this.gl.getContextAttributes();this.gl.makeXRCompatible().then(()=>{let t={antialias:e==null?void 0:e.antialias,alpha:e==null?void 0:e.alpha,depth:e==null?void 0:e.depth,stencil:e==null?void 0:e.stencil,framebufferScaleFactor:ay};if(!this.session){console.error(`session is lose while set session!`);return}switch(this.machineType){case`Pico`:case`VP`:this.session.updateRenderState({baseLayer:new XRWebGLLayer(this.session,this.gl,t)});break;case`Oculus`:this.session.updateRenderState({baseLayer:new XRWebGLLayer(this.session,this.gl,t)});break;default:this.machineType;break}this.session.requestReferenceSpace(this.referenceSpaceType).then(e=>{this.onRequestReferenceSpace(e)}),this.session.addEventListener(`inputsourceschange`,e=>{this.updateInputSources(e)})})}}},ly=class extends t.InstancedBufferGeometry{constructor(){super(),this.type=`LineSegmentsGeometry`,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute(`position`,new t.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute(`uv`,new t.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;n=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let r=new t.InstancedInterleavedBuffer(n,6,1);return this.setAttribute(`instanceStart`,new t.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceEnd`,new t.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;n=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;let r=new t.InstancedInterleavedBuffer(n,6,1);return this.setAttribute(`instanceColorStart`,new t.InterleavedBufferAttribute(r,3,0)),this.setAttribute(`instanceColorEnd`,new t.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new t.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var n=e.geometry;if(n instanceof t.Geometry){let e=new t.BufferGeometry().fromGeometry(n);this.setPositions(e.attributes.position.array)}else n instanceof t.BufferGeometry&&this.setPositions(n.attributes.position.array);return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new t.Box3);let e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){let r=new t.Box3;this.boundingBox.setFromBufferAttribute(e),r.setFromBufferAttribute(n),this.boundingBox.union(r)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new t.Sphere),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){let r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0,a=new t.Vector3;for(let t=0,o=e.count;t<o;t++)a.fromBufferAttribute(e,t),i=Math.max(i,r.distanceToSquared(a)),a.fromBufferAttribute(n,t),i=Math.max(i,r.distanceToSquared(a));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error(`THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.`,this)}}toJSON(){}};Object.assign(ly.prototype,{isLineSegmentsGeometry:!0});var uy={uniforms:t.UniformsUtils.merge([t.UniformsLib.common,t.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new t.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:`
|
|
2645
2645
|
#include <common>
|
|
2646
2646
|
#include <color_pars_vertex>
|
|
2647
2647
|
#include <fog_pars_vertex>
|
|
@@ -2840,12 +2840,12 @@ void main() {
|
|
|
2840
2840
|
#include <premultiplied_alpha_fragment>
|
|
2841
2841
|
|
|
2842
2842
|
}
|
|
2843
|
-
`},ly=class extends t.ShaderMaterial{constructor(e){super({uniforms:t.UniformsUtils.clone(cy.uniforms),vertexShader:cy.vertexShader,fragmentShader:cy.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(ly.prototype,{isLineMaterial:!0});var uy=class extends t.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new sy:e,this.material=t===void 0?new ly({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,n=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*n.count),a=new t.Vector3,o=new t.Vector3;for(var s=0,c=0,l=n.count;s<l;s++,c+=2)a.fromBufferAttribute(n,s),o.fromBufferAttribute(r,s),i[c]=c===0?0:i[c-1],i[c+1]=i[c]+a.distanceTo(o);let u=new t.InstancedInterleavedBuffer(i,2,1);return e.setAttribute(`instanceDistanceStart`,new t.InterleavedBufferAttribute(u,1,0)),e.setAttribute(`instanceDistanceEnd`,new t.InterleavedBufferAttribute(u,1,1)),this}raycast(e,n){e.camera===null&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.`);let r=e.ray,i=e.camera,a=i.projectionMatrix,o=this.geometry,s=this.material,c=s.resolution,l=s.linewidth,u=o.attributes.instanceStart,d=o.attributes.instanceEnd,f=new t.Vector4,p=new t.Vector4,m=new t.Vector4,h=new t.Vector3,g=new t.Matrix4,_=new t.Line3,v=new t.Vector3;r.at(1,m),m.w=1,m.applyMatrix4(i.matrixWorldInverse),m.applyMatrix4(a),m.multiplyScalar(1/m.w),m.x*=c.x/2,m.y*=c.y/2,m.z=0,h.copy(m);let y=this.matrixWorld;g.multiplyMatrices(i.matrixWorldInverse,y);for(var b=0,x=u.count;b<x;b++){f.fromBufferAttribute(u,b),p.fromBufferAttribute(d,b),f.w=1,p.w=1,f.applyMatrix4(g),p.applyMatrix4(g),f.applyMatrix4(a),p.applyMatrix4(a),f.multiplyScalar(1/f.w),p.multiplyScalar(1/p.w);var S=f.z<-1&&p.z<-1,C=f.z>1&&p.z>1;if(S||C)continue;f.x*=c.x/2,f.y*=c.y/2,p.x*=c.x/2,p.y*=c.y/2,_.start.copy(f),_.start.z=0,_.end.copy(p),_.end.z=0;let e=_.closestPointToPointParameter(h,!0);_.at(e,v);let i=t.MathUtils.lerp(f.z,p.z,e),o=i>=-1&&i<=1;var w=h.distanceTo(v)<l*.5;if(o&&w){_.start.fromBufferAttribute(u,b),_.end.fromBufferAttribute(d,b),_.start.applyMatrix4(y),_.end.applyMatrix4(y);var T=new t.Vector3,E=new t.Vector3;r.distanceSqToSegment(_.start,_.end,E,T),n.push({point:E,pointOnLine:T,distance:r.origin.distanceTo(E),object:this,faceIndex:b})}}}};Object.assign(uy.prototype,{isLineSegments2:!0});var dy=class extends uy{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(dy.prototype,{isLine2:!0});var fy=class extends sy{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 n=e.geometry;if(n instanceof t.Geometry){let e=new t.BufferGeometry().fromGeometry(n);this.setPositions(e.attributes.position.array)}else n instanceof t.BufferGeometry&&this.setPositions(n.attributes.position.array);return this}copy(){return this}};Object.assign(fy.prototype,{isLineGeometry:!0});var py=14467195,my=8,hy=2,gy=20,_y=null,vy=class extends t.Object3D{static get version(){return`6.10.0-alpha.1`}constructor(e=new t.Vector3,n=new t.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0;let r=new fy,i=new ly({color:py,linewidth:hy,dashScale:gy,dashed:!1});this.line=new dy(r,i);let a=new t.BufferGeometry,o=new t.PointsMaterial({color:py,size:my,map:_y||(_y=new t.TextureLoader().load(`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVR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PDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`)),sizeAttenuation:!1,transparent:!0});this.points=new t.Points(a,o),this.points.renderOrder=11,this.points.frustumCulled=!1,this.setPoints(e,n),this.add(this.line,this.points)}setPoints(e,n){let r=[].concat(e.toArray(),n.toArray());this.points.geometry.setAttribute(`position`,new t.BufferAttribute(new Float32Array(r),3)),this.line.geometry.setPositions(r),this.line.computeLineDistances(),this.needsRender=!0}getPoints(){let e=this.points.geometry.attributes.position.array;return[new t.Vector3(e[0],e[1],e[2]),new t.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(vy.prototype,{isFiveLine:!0});var yy={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 by(e){return Xo(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function xy(e){return Xo(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield by(`${e}/profilesList.json`)})}function Sy(e,t){return Xo(this,arguments,void 0,function*(e,t,n=null,r=!0){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No basePath supplied`);let i=yield xy(t),a;if(e.profiles.some(e=>{let n=i[e];return n&&(a={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!n)throw Error(`No matching profile name found`);let e=i[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);a={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let o=yield by(a.profilePath),s;if(r){let t;if(t=o.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${a.profileId}`);t.assetPath&&(s=a.profilePath.replace(`profile.json`,t.assetPath))}return{profile:o,assetPath:s}})}var Cy={xAxis:0,yAxis:0,button:0,state:yy.ComponentState.DEFAULT};function wy(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var Ty=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===yy.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Cy)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:i,normalizedYAxis:a}=wy(e,t);switch(this.componentProperty){case yy.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?i:.5;break;case yy.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case yy.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case yy.ComponentProperty.STATE:this.valueNodeProperty===yy.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=+!!this.states.includes(r);break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Ey=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 Ty(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:yy.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=yy.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=yy.ComponentState.PRESSED:(t.touched||this.values.button>yy.ButtonTouchThreshold)&&(this.values.state=yy.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===yy.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>yy.AxisTouchThreshold&&(this.values.state=yy.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===yy.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>yy.AxisTouchThreshold&&(this.values.state=yy.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},Dy=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 Ey(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)})}},Oy=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,ky=`generic-trigger`,Ay=class extends t.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof t.Mesh&&e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:n,maxNode:r,value:i,valueNodeProperty:a}=e;t&&(a===yy.VisualResponseProperty.VISIBILITY?t.visible=i:a===yy.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))})}))}};function jy(e,n){Object.values(e.components).forEach(e=>{let{type:r,touchPointNodeName:i,visualResponses:a}=e;if(r===yy.ComponentType.TOUCHPAD)if(e.touchPointNode=n.getObjectByName(i),e.touchPointNode){let n=new t.Mesh(new t.SphereGeometry(.001),new t.MeshBasicMaterial({color:255}));e.touchPointNode.add(n)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(a).forEach(e=>{let{valueNodeName:t,minNodeName:r,maxNodeName:i,valueNodeProperty:a}=e;if(a===yy.VisualResponseProperty.TRANSFORM){if(e.minNode=n.getObjectByName(r),e.maxNode=n.getObjectByName(i),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=n.getObjectByName(t),e.valueNode||console.warn(`Could not find ${t} in the model`)})})}function My(e,n){jy(e.motionController,n),e.envMap&&n.traverse(n=>{n instanceof t.Mesh&&n.isMesh&&(n.material.envMap=e.envMap,n.material.needsUpdate=!0)}),e.add(n)}var Ny=class{constructor(e=null){this.gltfLoader=e,this.path=Oy,this._assetCache={}}createControllerModel(e){let t=new Ay,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||Sy(r,this.path,ky).then(({profile:e,assetPath:i})=>{t.motionController=new Dy(r,e,i);let a=this._assetCache[t.motionController.assetUrl];if(a)n=a.scene.clone(),My(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(),My(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},Py=`fade`,Fy=Object.assign({},fr(X_,[`maxLatitude`,`minLatitude`]));function Iy(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 Ly=300,Ry=new t.Raycaster,zy=new t.Vector3,By={Floorplan:Yg,Topview:Zg,Panorama:Z_,VRPanorama:Hv,Model:qv,Mapview:$v,XRPanorama:class e extends Z_{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 oy(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,Q(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,Q(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new t.Raycaster,right:new t.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 vy,right:new vy},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new t.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new t.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new t.Group,new t.Group];let n=this.xrManager.getController(0);this.controllerWrappers[0].add(n);let r=this.xrManager.getController(1);this.controllerWrappers[1].add(r);let i=new Ny;i.gltfLoader={load(e,t){ur.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return Us(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:ur})}).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=Zt()]={panoId:Z(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:Py,effectEasing:K_,fixCameraTransform:new t.Matrix4},this.parallaxCameraMatrixs=[];let a=ei.shared.getContext();if(!a){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(a),this.on(`xr.session.start`,()=>{let e=this.xrManager.getControllerGrip(0);e.add(i.createControllerModel(e)),this.controllerWrappers[0].add(e);let t=this.xrManager.getControllerGrip(1);t.add(i.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,n,r){var i,a,o;this.userAction=r,this.stopMomentumMovement();let s=Z(e),c=this.works.getObserver(e);if(!c)throw Error(`Invalid PanoIndex`);let l=Kr(c.images.up),u=this.imageOptions.size;u===void 0&&c&&l&&(u=Number(l)),u===void 0&&(u=2048);let d=this.imageOptions.transform,f=(e,t)=>Iy(Wr(e,d,t)),p=Object.assign({key:`pano.${s}`},dr(this.imageOptions,[`format`,`size`,`quality`])),m={right:c.images.work.getURL(c.images.right),left:c.images.work.getURL(c.images.left),up:c.images.work.getURL(c.images.up),down:c.images.work.getURL(c.images.down),front:c.images.work.getURL(c.images.front),back:c.images.work.getURL(c.images.back)},h=`pano:`+Lp([m,p,d]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===h)return;{let t=this.pendingPanoTask.panoId;(i=this.panoMeshes.get(t))==null||i.setProgress(0),this.emit(`pano.texture.abort`,Q(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let g=`move-to-pano-`+s;this.pending.add(g);let _=Sg(`pano.prepare`,{options:n,prevMode:this.mode,prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,_),_.defaultPrevented){this.pending.delete(g);return}_.options!==n&&Object.assign(n,_.options);let v=this.modelScene.parameter,y;v.pano0&&v.pano0.map.name===h?y=v.pano0:v.pano1&&v.pano1.map.name===h&&(y=v.pano1);let b=(a=n.effect)==null?Py:a,x=(o=n.effectEasing)==null?K_:o;if(y){let r={panoId:s,effect:b,effectEasing:x,leftPanoPicture:{panoId:y.panoId,map:y.map,mapHistogram:y.mapHistogram,mapSize:y.mapSize,matrix:c.matrix.clone().premultiply(c.work.transform),zoom:1},position:c.position.clone().applyMatrix4(c.work.transform),fixCameraTransform:new t.Matrix4};r.leftPanoPicture&&this.panoPictureObserverMap.set(r.leftPanoPicture,c),this.pendingPanoTask=void 0,Promise.resolve().then(()=>Cg(_)).catch(e=>{let t=Gg(e);return this.emit(`error`,t),t}).then(t=>{var i,a;if(!(t instanceof Error))this.pending.delete(g),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0),this.doMoveToPano(e,r,n);else{let e=null;t instanceof Error&&(e||(e=t));let r=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),n.moveCancelCallback&&n.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(g),this.pendingPanoTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)}});return}let S=this.panoMeshes.get(s);S&&S.tap&&S.tap(),this.pendingPanoTask={panoId:s,hash:h,onLoad:r=>{var i;let a=r.body;if(this.destroyed)a.dispose();else{a.name=h;let r=Array.isArray(a.image)?a.image[0]:a.image,o=(i=r==null?void 0:r.width)==null?2048:i,l=new Bm().formPixels(zg(this.renderer,a,!0,Im).data),u={panoId:s,effect:b,effectEasing:x,leftPanoPicture:{panoId:s,map:a,mapSize:o,mapHistogram:new t.Vector4().fromArray(l.toArray()),matrix:c.matrix.clone(),zoom:1},position:c.position.clone(),fixCameraTransform:new t.Matrix4};u.leftPanoPicture&&this.panoPictureObserverMap.set(u.leftPanoPicture,c),this.doMoveToPano(e,u,n)}},onError:e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),e instanceof Error&&e.message&&this.emit(`error`,e),n.moveCancelCallback&&n.moveCancelCallback()}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(m,{imageURL:{transform:f,options:p},format:t.RGBFormat,viaAjax:!0,fetcher:Kf(this.fiveId,c.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,Q(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===h&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=Gg(t);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>Cg(_)).catch(e=>Gg(e))]).then(([t,n])=>{var r,i,a,o;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(g),((r=this.pendingPanoTask)==null?void 0:r.hash)===h?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,Q(`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(g),((a=this.pendingPanoTask)==null?void 0:a.hash)===h&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(s))==null||o.setProgress(0))}})}doMoveToPano(e,n,r={}){var i,a,o,s,c,l,u,d,f,p;let m=V(),h=Zt();this.panoResources[h]=n;let g,_,v;if(this.locationMotion.ended){let[e,t]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(t).position,a=n.position;g=Math.max(i.distanceTo(a),1),_=[{key:t.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:h,progress:1,value:{distance:0,count:1}}],v=0}else{let[e,t]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(t).position,o=n.position,s=t.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;g=c+Math.max(a.distanceTo(o),1),_=[{key:e.key,progress:0,value:Object.assign({},r)},{key:t.key,progress:c/g,value:t.value},{key:h,progress:1,value:{count:t.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(_);v=this.locationMotion.getProgressVelocity(m)*l/u}let y=n.effect===`instant`?0:this.calculateMovingDuration(r.duration,n.effect===`fly`||n.effect===`model`?g:0),b={longitude:r.longitude,latitude:r.latitude,fov:r.fov},x=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(i=b.longitude)==null?this.camera.pose.longitude:i,latitude:(a=b.latitude)==null?this.camera.pose.latitude:a,fov:(o=b.fov)==null?this.camera.pose.fov:o,offset:n.position.clone(),distance:0}),S=this.currentPano;if(this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:r,prevPano:S,pano:{panoIndex:x.panoIndex,workCode:x.workCode},progress:0,state:x,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(x),this.perspToOrthoMotion.set({perspToOrtho:0},y).catch(G),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],y).catch(G),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=G,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),n.effect===`fly`||n.effect===`model`)this.cameraMotion.set(b,y).catch(G);else{let e=It({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),r=It({longitude:(s=b.longitude)==null?this.cameraMotion.value.longitude:s,latitude:(c=b.latitude)==null?this.cameraMotion.value.latitude:c}),i=new t.Object3D;i.lookAt(e);let a=new t.Matrix4().makeRotationFromQuaternion(i.quaternion);i.lookAt(r);let o=new t.Matrix4().makeRotationFromQuaternion(i.quaternion),m=new t.Matrix4().getInverse(a).premultiply(o),h=this.cameraMotion.value.fov,g=(l=b.fov)==null?this.cameraMotion.value.fov:l,v=1;n.effect===`zoomin`?v=1.5:n.effect===`zoomout`&&(v=.4);let x=g*v;for(let e=0;e<_.length-1;e++){let t=_[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(m),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(x/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(u=b.longitude)==null?this.cameraMotion.value.longitude:u,latitude:(d=b.latitude)==null?this.cameraMotion.value.latitude:d,fov:x}},{progress:1,value:{longitude:(f=b.longitude)==null?this.cameraMotion.value.longitude:f,latitude:(p=b.latitude)==null?this.cameraMotion.value.latitude:p,fov:g}}],y).catch(G)}this.locationMotion.setKeyframes(_,y,v).then(()=>{for(let e of this.modelScene.children)e instanceof dp&&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`,Q(`pano.arrived`,{options:r,prevPano:S,pano:{panoIndex:t.panoIndex,workCode:t.workCode},progress:1,state:t,userAction:this.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(t);let n=this.works.getObserver(this.currentPano);if(n&&n.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:n.images.video.size.clone(),matrix:n.images.video.matrix.clone(),panoMatrix:n.matrix.clone().premultiply(n.work.transform),alpha:1},t=Zt(),r=this.videoTexture.image;r.setAttribute(`uuid`,t),n_().then(i=>{i&&n.images.video&&r.getAttribute(`uuid`)===t&&(r.oncanplay=()=>{r.oncanplay=G,r.play()},r.ontimeupdate=()=>{r.currentTime>.5&&(r.ontimeupdate=G,this.panoVideo.setMaterial(e))},r.src=n.images.video.source)}).catch((()=>{r.removeAttribute(`uuid`)}))}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{options:r,prevPano:S,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),r.moveCancelCallback&&r.moveCancelCallback()})}checkSelectedPano(e){var n;this.stopMomentumMovement(),this.camera.getDirection(new t.Vector3).setY(0);let r=null,i=this.works.getObserver(this.currentPano);if(!i)return null;let a=i.work.observers,o=i.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&i.work.workCode===this.currentPano.workCode)return!1;let t=a[e];return!t||zy.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[s]=this.modelScene.intersectRaycaster(e);if(s){let[e,t]=vu(o,e=>{let t=a[e];return t?zy.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(s.point):1/0},!0);typeof e==`number`&&t<this.panoTapTriggerRadius&&(r=(n=a[e])==null?null:n)}if(ey(r)){let t=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);t&&(r=t)}for(let e of this.locationMotion.keyframes){let t=this.panoResourceFromLocationMotionKeyframe(e);if(!(e.progress<this.locationMotion.progress)&&r){let e=Z({panoIndex:r.panoIndex,workCode:r.work.workCode});if(t.panoId===e){r=null;break}}}if(ey(r))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!r.active){let e=Z({panoIndex:r.panoIndex,workCode:r.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let c={workCode:r.work.workCode,panoIndex:r.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:r?r.position.clone():new t.Vector3};return this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.workCode},state:c,userAction:!0,options:{},progress:0,error:null})),r&&r.active?(this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.workCode},progress:0,state:c,options:{},error:null})),{workCode:r.work.workCode,panoIndex:r.panoIndex}):null}destroy(){super.destroy()}isReady(){return!1}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,n,...r){var i,a,o,s,c,l,u,d,f;this.userAction=!0;let p={},m={},h=this.camera.getDirection(new t.Vector3),g=this.locationMotion.keyframes[0],_=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[v,y]=this.locationMotion.getKeyFrameSegment(e),b=this.panoResourceFromLocationMotionKeyframe(v),x=this.panoResourceFromLocationMotionKeyframe(y),S=this.panoResourceFromLocationMotionKeyframe(g),C=this.panoResourceFromLocationMotionKeyframe(_),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let n=this.locationMotion.value.count-y.value.count+1,r=new t.Vector3().copy(b.position),o=new t.Vector3().copy(x.position);if(p.progress=n,n>=.01&&n<=.99&&(p.progress=H(x.effectEasing(n),.01,.99)),x.leftPanoPicture&&(n<1?b.leftPanoPicture&&(p.pano0=b.leftPanoPicture):p.pano0=x.leftPanoPicture,p.pano1=x.leftPanoPicture),x.effect===`montage`?p.transition=`BLACK`:x.effect===`spread`?p.transition=`SPREAD`:p.transition=`FADE`,x.effect===`zoomin`||x.effect===`zoomout`?p.progress=Math.pow(n,3):x.effect===`model`&&this.camera.pose.distance<.01&&(p.modelAlpha=1-Math.pow(H(Math.abs(n-.5)*2,0,1),4)),n<1&&x.effect!==`fly`){if(p.pano0&&b.leftPanoPicture){let e={panoId:p.pano0.panoId,map:p.pano0.map,mapHistogram:p.pano0.mapHistogram,mapSize:p.pano0.mapSize,zoom:p.pano0.zoom,matrix:b.leftPanoPicture.matrix.clone().setPosition(x.position)},t=this.panoPictureObserverMap.get(p.pano0);t&&this.panoPictureObserverMap.set(e,t),p.pano0=e}r.copy(o),w=!0}m.distance=this.locationMotion.value.distance,m.offset=new t.Vector3(r.x+(o.x-r.x)*n,r.y+(o.y-r.y)*n,r.z+(o.z-r.z)*n);let s=[],c=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(s.push(t),n>this.locationMotion.progress&&c.push(t))}for(let e of Object.keys(this.panoResources)){if(c.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((i=p.pano0)==null?void 0:i.map)||e===((a=p.pano1)==null?void 0:a.map))continue;e.dispose(),t.leftPanoPicture=null}}s.indexOf(e)>=0||delete this.panoResources[e]}let l=zp(x.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:zp(S.panoId),pano:zp(C.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},zp(C.panoId)),{mode:this.mode}),$(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(m),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);let[T,E]=r,D=new t.Vector3(0,0,0),O=new t.Vector2().copy(this.camera.resolution);if(E&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let r=this.xrManager.cameraVR,i=this.xrManager.referenceSpace,a=this.xrManager.session.renderState.baseLayer,l=E.getViewerPose(i),u=(o=l==null?void 0:l.views)==null?[]:o;for(let e=0;e<u.length;e++){let t=u[e],n=r.cameras[e],i=a.getViewport(t);i&&(n.projectionMatrix.fromArray(t.projectionMatrix),n.projectionMatrixInverse.getInverse(n.projectionMatrix),n.matrix.fromArray(t.transform.matrix),n.matrix.setPosition(this.camera.position),n.matrix.decompose(n.position,n.quaternion,n.scale),n.matrixWorld.copy(n.matrix),n.matrixWorldInverse.getInverse(n.matrixWorld),n.matrixAutoUpdate=!1,D.copy(n.position),n.viewport.set(i.x,i.y,i.width,i.height),O.set(i.width,i.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((s=m.distance)==null?this.camera.pose.distance:s),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 n=E.getPose(this.xrManager.session.inputSources[e].targetRaySpace,i);if(n){let e=n.transform.orientation,r=new t.Quaternion(e.x,e.y,e.z,e.w),i=new t.Vector3(0,0,-1).applyQuaternion(r),a=new t.Raycaster(this.camera.position,i);this.gazeRay=a}}}if(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`){let r=this.xrManager.session.inputSources;for(let e=0;e<r.length;e++){let n=this.xrManager.controllers[e],a=r[e];if(!a)continue;n&&n.update(a,E,i);let o=this.xrManager.getController(e),s=new t.Vector3(0,1.2,0),l=o.position.clone().add(D).sub(s);a.handedness===`left`?this.xrControllerRay.left.set(l,new t.Vector3(0,0,-1).applyEuler(o.rotation)):a.handedness===`right`&&this.xrControllerRay.right.set(l,new t.Vector3(0,0,-1).applyEuler(o.rotation)),this.controllerWrappers[e].position.copy(new t.Vector3(0,0,0).add(D).sub(s));let u=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(u.length===0){let e=this.works.getResolvedObserver(this.currentPano);u=this.xrControllerRay.right.intersectObject(this.modelScene.boundingMesh,!0).map(t=>{var n;let r=(n=e==null?void 0:e.floorIndex)==null?0:n;return Object.assign({floorIndex:r,floor:r},t)})}if(u.length>=1&&u[0].face)if(a.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=u[0].face.normal,n=t.clone(),r=u[0].point.clone();this.intersectMesh.position.copy(r);let i=r.clone().add(n);if(this.intersectMesh.lookAt(i),Math.abs(t.y)>.99){let e=this.camera.position.clone().sub(r);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,e.length>0?(this.pointerLines.right.setPoints(l,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(l,u[0].point));let a=u[0],o=Q(`intersect.update`,{raycaster:(c=this.xrControllerRay.right)==null?null:c,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(l,u[0].point)}this.updateControllerHelper(r,e,n)}}else E||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);jg(p)===!1&&this.modelScene.parameter.set(p),this.emit(`camera.update`,Q(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose))}));let k=this.works.getResolvedObserver(this.currentPano),A=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,j=this.works.getObserver(b.panoId),M=this.works.getObserver(x.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&k){let e=[],n=k.work.observers;for(let t of k.accessibleNodes){let r=n[t];r&&e.push(r)}let r=new Map;if(e.sort((e,t)=>{let n=r.get(e);n===void 0&&(n=e.standingPosition.distanceTo(k.standingPosition),r.set(e,n));let i=r.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(k.standingPosition),r.set(t,i)),n-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let n=e[this.accessibleObserverFloorCheckCount],r=this.modelScene.models.find(e=>e.work===(n==null?void 0:n.work));if(n&&r&&r.visible){let e=.3,i=.005,a=n.standingPosition.clone().applyMatrix4(n.work.transform),o=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),s=Y_.map(n=>{Ry.ray.origin.copy(a),Ry.ray.origin.add(zy.copy(n).setY(e)),Ry.ray.direction.set(0,-1,0),Ry.firstHitOnly=!0,Ry.floorIndex=-1;let[o]=r.intersectRaycaster(Ry);return o&&o.distance-i<=e?new t.Vector3().copy(a).setY(o.point.y+i):a});s.sort((e,t)=>t.y-e.y);let c=s[Math.floor(s.length/2)],[l]=s.filter(e=>e.distanceTo(c)<=.05);if(l){let e=new t.Vector4(a.x,a.y,a.z,l.y-a.y),n=this.adjustPanoCircleMeshPositionFix.get(o);n&&!e.equals(n)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(o,e)}}this.accessibleObserverFloorCheckCount++}}let N=new Map;if(j)for(let e of j.accessibleNodes){let t=j.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(M)for(let e of M.accessibleNodes){let t=M.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{N.get(t)?N.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),N.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),N.delete(t)}),this.panoMeshes.forEach((e,n)=>{let r=this.works.getObserver(n);if(r){let i=r.position.distanceTo(r.standingPosition)>this.aerialObserverMinHeight;if(i)e.position.copy(r.position).applyMatrix4(r.work.transform),e.scale.setScalar(18);else{e.position.copy(r.standingPosition).applyMatrix4(r.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(r.panoId);t&&(zy.set(t.x,t.y,t.z),zy.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let a=this.camera.position.clone().setY(e.position.y),o=new t.Vector3().copy(e.position).sub(a).normalize();if(n===Z(this.currentPano)){let t=H((.5-a.distanceTo(e.position))/.5,0,1);o.multiplyScalar(1-t).add(h.clone().multiplyScalar(t))}if(o.length()>0){let n=i?-Math.PI/2:0,r=Math.atan2(o.x,o.z);e.quaternion.setFromEuler(new t.Euler(n,r,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(t=>{t.setOpacity(0),t.setCurrent(!1),t.updateTime&&t.updateTime(e,n),t.visible=!1});else if(k){let t=k.work.observers,[,r]=vu(k.accessibleNodes,e=>{let n=t[e];return!n||!n.active?1/0:k.standingPosition.distanceTo(n.standingPosition)},!0);r=H(r,2.5,1/0);let i=k.accessibleNodes.concat(k.panoIndex).map(e=>Z({panoIndex:e,workCode:k.work.workCode}));this.panoMeshes.forEach((t,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=t.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!t.loading&&t.progress===0&&A!==null&&Z({panoIndex:A.panoIndex,workCode:A.work.workCode})===a;let n=t.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=n<.01?0:H(r/n,.1,.85)}o&&o===M&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&t.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(c=0),t.setCurrent(s),t.setOpacity(c),t.updateTime&&t.updateTime(e,n)})}{let e=(l=this.modelScene.parameter.progress)==null?1:l,n=Math.round(e),r=this.modelScene.parameter.pano0,i=this.modelScene.parameter.pano1,a=n===0?r:i,o;if(a&&(o=this.works.getObserver(a.panoId),o||(o=this.panoPictureObserverMap.get(a))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(ii()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!o||!a||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new t.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Yr(a.mapSize)+1;this.tiling.setObserver(o);let t={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:a.map,panoMatrix:a.matrix,panoZoom:a.zoom,minLevel:e,level:4},s=this.tiling.update(t),c={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:n,opacity:(r==null?void 0:r.panoId)===(i==null?void 0:i.panoId)?1:Ed(Math.abs(((u=this.modelScene.parameter.progress)==null?0:u)-.5)*2)},l=this.modelScene.parameter.refinedScreen;(s||c.pano!==(l==null?void 0:l.pano)||c.opacity!==(l==null?void 0:l.opacity))&&this.modelScene.parameter.set(`refinedScreen`,c)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&k&&k.position.y-k.standingPosition.y>10){let e=H(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=x.effect,{pano0:n,pano1:r}=this.modelScene.parameter;if(n&&r&&n!==r&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((d=this.modelScene.parameter.pano0Depth)==null?void 0:d.panoId)!==n.panoId||((f=this.modelScene.parameter.pano1Depth)==null?void 0:f.panoId)!==r.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1});let e=new t.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(n.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,W_(this.renderer,this.modelScene,e,500);let i=new t.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);i.matrix.copy(r.matrix),i.matrixWorld.copy(i.matrix),i.matrixAutoUpdate=!1,W_(this.renderer,this.modelScene,i,500),this.modelScene.parameter.set({pano0Depth:{panoId:n.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:r.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}render(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){let e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}updateControllerHelper(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(!e||e.length===0)return;let a={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let o=0;o<e.length;o++){let s=e[o].handedness,c=e[o].gamepad;switch(s){case`left`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`LeftAxesDown`,t)),c!=null&&c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`X`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`Y`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`LeftTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n};a.buttons.X=c.buttons&&c.buttons[4]?c.buttons[4].pressed:!1,a.buttons.Y=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.LeftTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.LeftPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1,a.left=e;break;case`right`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`RightAxesDown`,t)),c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`A`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`B`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`RightTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`RightPinch`,t)),a.right={raycaster:i,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n},a.buttons.A=c.buttons&&c.buttons[4]?c==null?void 0:c.buttons[4].pressed:!1,a.buttons.B=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.RightTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.RightPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,Q(`xr.controller.update`,a))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)this.xrHandleState[t].touchStart===!1?(this.xrHandleState[t].touchStartTime=n,this.xrHandleState[t].touchStart=!0,this.emit(`xr.gesture.buttonDown`,Q(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrHandleState[t].touchStartTime>Ly&&this.emit(`xr.gesture.press`,Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,Q(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrHandleState[t].touchStartTime<=Ly){let e=Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}});!this.emit(`xr.gesture.tap`,e)&&!e.defaultPrevented&&t===`RightTrigger`&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[t].touchStart=!1,this.xrHandleState[t].touchStartTime=0}}initHandEvent(){if(!this.xrManager.session)throw Error(`初始化失败`);this.xrManager.session.addEventListener(`select`,e=>{this.gazeRay&&this.checkSelectedPano(this.gazeRay)})}}},Vy={Floorplan:Jg,Topview:Xg,Panorama:X_,VRPanorama:Vv,Model:Kv,Mapview:Qv,XRPanorama:Fy},Hy=`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 Uy(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=It(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 Wy(){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 Gy(){let e=new t.Group;e.name=`internalLights`;{let n=new t.DirectionalLight(16777215,.1);n.name=`direction0`,n.position.copy(new t.Vector3(0,1,0)),e.add(n)}{let n=new t.DirectionalLight(16777215,.1);n.name=`direction1`,n.position.copy(new t.Vector3(-1,-1,-1)),e.add(n)}{let n=new t.DirectionalLight(16777215,.3);n.name=`direction2`,n.position.copy(new t.Vector3(1,1,1)),e.add(n)}{let n=new t.AmbientLight(16777215,.6);n.name=`ambient0`,e.add(n)}return e}function Ky(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function qy(){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=Ky((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n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uHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==`,Yy=[351,63],Xy=[20,20],Zy=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Qy=new Float32Array([0,0,1,0,0,1,1,1]),$y=new Uint8Array([0,1,2,1,3,2]),eb=new t.BufferGeometry;eb.setAttribute(`position`,new t.BufferAttribute(Zy,3)),eb.setAttribute(`uv`,new t.BufferAttribute(Qy,2)),eb.setIndex(new t.BufferAttribute($y,1));var tb=new t.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),nb=new t.Mesh(eb,tb);nb.matrixAutoUpdate=!1;var rb=new t.Scene;rb.add(nb),rb.matrixAutoUpdate=!1;var ib=new t.OrthographicCamera(-.5,.5,.5,-.5,.1,1);ib.position.set(0,0,.5),ib.lookAt(0,0,0),ib.updateMatrixWorld(!0),ib.matrixAutoUpdate=!1;var ab=new t.Vector4,ob=new t.Vector4;function sb(e){if(tb.map){let t=e.getViewport(ab),n=e.getScissor(ob),r=e.getScissorTest(),i=e.autoClear,a=n.x+Xy[0]/3,o=n.y+Xy[1]/3,s=Yy[0]/3,c=Yy[1]/3;e.setViewport(a,o,s,c),e.setScissor(a,o,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(rb,ib),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{let e=new t.Texture,n=new Image;n.onload=()=>{e.image=n,e.wrapS=t.ClampToEdgeWrapping,e.wrapT=t.ClampToEdgeWrapping,e.minFilter=t.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,tb.needsUpdate=!0,n.onload=G},n.src=Jy,tb.map=e}}var cb=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,n,r){let i=new t.DataTexture(e,n,r,t.RedIntegerFormat,t.UnsignedIntType);return i.internalFormat=`R32UI`,i.minFilter=t.NearestFilter,i.magFilter=t.NearestFilter,i.generateMipmaps=!1,i.needsUpdate=!0,i}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()}},lb=2,ub=8,db=class{constructor(e){let n=e.numPoints,r=e.packedData;if(!r||r.length<n*ub)throw Error(`[TileTexture] object 缺少足量 packedData`);let i=n*lb,a=Math.max(1,Math.min(2048,i)),o=Math.max(1,Math.ceil(i/a)),s=new Uint32Array(a*o*4);s.set(r.subarray(0,n*ub),0);let c=new t.DataTexture(s,a,o,t.RGBAIntegerFormat,t.UnsignedIntType);c.internalFormat=`RGBA32UI`,c.minFilter=t.NearestFilter,c.magFilter=t.NearestFilter,c.generateMipmaps=!1,c.needsUpdate=!0,this.texture=c,this.count=n,this.width=a,this.height=o}dispose(){this.texture.dispose()}},fb=2,pb=class e{constructor(n=2048){this.target=null,this.targetHeight=0,this.regionMap=new Map,this.regionList=[],this.width=n,this.material=new t.RawShaderMaterial({vertexShader:e.VERTEX,fragmentShader:e.FRAGMENT,uniforms:{u_tileTex:{value:null},u_tileWidth:{value:1},u_bigWidth:{value:n},u_startTexel:{value:0},u_count:{value:0},u_transformIndex:{value:0},u_layerIndex:{value:0}},depthTest:!1,depthWrite:!1}),this.scene=new t.Scene,this.mesh=new t.Mesh(new t.PlaneGeometry(2,2),this.material),this.mesh.frustumCulled=!1,this.scene.add(this.mesh),this.camera=new t.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 i={object:e,tile:t,start:0,count:t.count,transformIndex:n,layerIndex:r};this.regionMap.set(e,i),this.regionList.push(i)}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:i,layerIndex:a}=t(n);e?(e.transformIndex=i,e.layerIndex=a):(e={object:n,tile:new db(n),start:0,count:n.numPoints,transformIndex:i,layerIndex:a},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 n=0;for(let e of this.regionList)e.start=n,n+=e.count;let r=Math.max(1,Math.ceil(n*fb/this.width));(!this.target||r>this.targetHeight)&&(this.target&&this.target.dispose(),this.targetHeight=r,this.target=new t.WebGLRenderTarget(this.width,r,{format:t.RGBAIntegerFormat,type:t.UnsignedIntType,minFilter:t.NearestFilter,magFilter:t.NearestFilter,depthBuffer:!1,stencilBuffer:!1}),this.target.texture.internalFormat=`RGBA32UI`,this.target.texture.generateMipmaps=!1);let i=e.getRenderTarget(),a=e.autoClear,o=e.getScissorTest(),s=e.getScissor(new t.Vector4),c=e.getPixelRatio()||1;e.autoClear=!1,e.setRenderTarget(this.target),e.setScissorTest(!0);for(let t of this.regionList){let n=t.start*fb,r=(t.start+t.count)*fb,i=Math.floor(n/this.width),a=Math.ceil(r/this.width),o=Math.max(0,Math.floor(i/c)-1),s=Math.ceil(a/c)+1,l=Math.ceil(this.width/c)+1;e.setScissor(0,o,l,s-o);let u=this.material.uniforms;u.u_tileTex.value=t.tile.texture,u.u_tileWidth.value=t.tile.width,u.u_bigWidth.value=this.width,u.u_startTexel.value=n,u.u_count.value=t.count,u.u_transformIndex.value=t.transformIndex,u.u_layerIndex.value=t.layerIndex,this.material.uniformsNeedUpdate=!0,e.render(this.scene,this.camera)}e.setScissorTest(o),e.setScissor(s),e.setRenderTarget(i),e.autoClear=a}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 i=new Float32Array(r.buffer,r.byteOffset,r.length),a=e.transformIndex;for(let r=0;r<e.count;r++){let o=e.start+r;t[o*3+0]=i[r*8+0],t[o*3+1]=i[r*8+1],t[o*3+2]=i[r*8+2],n[o]=a}}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),i=e.getRenderTarget();e.setRenderTarget(this.target);let a=e.getContext();return a.readPixels(0,0,t,n,a.RGBA_INTEGER,a.UNSIGNED_INT,r),e.setRenderTarget(i),r}dispose(){this.clear(),this.target&&(this.target.dispose(),this.target=null),this.mesh.geometry.dispose(),this.material.dispose()}};pb.VERTEX=`#version 300 es
|
|
2843
|
+
`},dy=class extends t.ShaderMaterial{constructor(e){super({uniforms:t.UniformsUtils.clone(uy.uniforms),vertexShader:uy.vertexShader,fragmentShader:uy.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(dy.prototype,{isLineMaterial:!0});var fy=class extends t.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new ly:e,this.material=t===void 0?new dy({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,n=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*n.count),a=new t.Vector3,o=new t.Vector3;for(var s=0,c=0,l=n.count;s<l;s++,c+=2)a.fromBufferAttribute(n,s),o.fromBufferAttribute(r,s),i[c]=c===0?0:i[c-1],i[c+1]=i[c]+a.distanceTo(o);let u=new t.InstancedInterleavedBuffer(i,2,1);return e.setAttribute(`instanceDistanceStart`,new t.InterleavedBufferAttribute(u,1,0)),e.setAttribute(`instanceDistanceEnd`,new t.InterleavedBufferAttribute(u,1,1)),this}raycast(e,n){e.camera===null&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.`);let r=e.ray,i=e.camera,a=i.projectionMatrix,o=this.geometry,s=this.material,c=s.resolution,l=s.linewidth,u=o.attributes.instanceStart,d=o.attributes.instanceEnd,f=new t.Vector4,p=new t.Vector4,m=new t.Vector4,h=new t.Vector3,g=new t.Matrix4,_=new t.Line3,v=new t.Vector3;r.at(1,m),m.w=1,m.applyMatrix4(i.matrixWorldInverse),m.applyMatrix4(a),m.multiplyScalar(1/m.w),m.x*=c.x/2,m.y*=c.y/2,m.z=0,h.copy(m);let y=this.matrixWorld;g.multiplyMatrices(i.matrixWorldInverse,y);for(var b=0,x=u.count;b<x;b++){f.fromBufferAttribute(u,b),p.fromBufferAttribute(d,b),f.w=1,p.w=1,f.applyMatrix4(g),p.applyMatrix4(g),f.applyMatrix4(a),p.applyMatrix4(a),f.multiplyScalar(1/f.w),p.multiplyScalar(1/p.w);var S=f.z<-1&&p.z<-1,C=f.z>1&&p.z>1;if(S||C)continue;f.x*=c.x/2,f.y*=c.y/2,p.x*=c.x/2,p.y*=c.y/2,_.start.copy(f),_.start.z=0,_.end.copy(p),_.end.z=0;let e=_.closestPointToPointParameter(h,!0);_.at(e,v);let i=t.MathUtils.lerp(f.z,p.z,e),o=i>=-1&&i<=1;var w=h.distanceTo(v)<l*.5;if(o&&w){_.start.fromBufferAttribute(u,b),_.end.fromBufferAttribute(d,b),_.start.applyMatrix4(y),_.end.applyMatrix4(y);var T=new t.Vector3,E=new t.Vector3;r.distanceSqToSegment(_.start,_.end,E,T),n.push({point:E,pointOnLine:T,distance:r.origin.distanceTo(E),object:this,faceIndex:b})}}}};Object.assign(fy.prototype,{isLineSegments2:!0});var py=class extends fy{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(py.prototype,{isLine2:!0});var my=class extends ly{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 n=e.geometry;if(n instanceof t.Geometry){let e=new t.BufferGeometry().fromGeometry(n);this.setPositions(e.attributes.position.array)}else n instanceof t.BufferGeometry&&this.setPositions(n.attributes.position.array);return this}copy(){return this}};Object.assign(my.prototype,{isLineGeometry:!0});var hy=14467195,gy=8,_y=2,vy=20,yy=null,by=class extends t.Object3D{static get version(){return`6.10.0-alpha.3`}constructor(e=new t.Vector3,n=new t.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0;let r=new my,i=new dy({color:hy,linewidth:_y,dashScale:vy,dashed:!1});this.line=new py(r,i);let a=new t.BufferGeometry,o=new t.PointsMaterial({color:hy,size:gy,map:yy||(yy=new t.TextureLoader().load(`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAz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ApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`)),sizeAttenuation:!1,transparent:!0});this.points=new t.Points(a,o),this.points.renderOrder=11,this.points.frustumCulled=!1,this.setPoints(e,n),this.add(this.line,this.points)}setPoints(e,n){let r=[].concat(e.toArray(),n.toArray());this.points.geometry.setAttribute(`position`,new t.BufferAttribute(new Float32Array(r),3)),this.line.geometry.setPositions(r),this.line.computeLineDistances(),this.needsRender=!0}getPoints(){let e=this.points.geometry.attributes.position.array;return[new t.Vector3(e[0],e[1],e[2]),new t.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(by.prototype,{isFiveLine:!0});var xy={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 Sy(e){return Xo(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function Cy(e){return Xo(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield Sy(`${e}/profilesList.json`)})}function wy(e,t){return Xo(this,arguments,void 0,function*(e,t,n=null,r=!0){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No basePath supplied`);let i=yield Cy(t),a;if(e.profiles.some(e=>{let n=i[e];return n&&(a={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!n)throw Error(`No matching profile name found`);let e=i[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);a={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let o=yield Sy(a.profilePath),s;if(r){let t;if(t=o.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${a.profileId}`);t.assetPath&&(s=a.profilePath.replace(`profile.json`,t.assetPath))}return{profile:o,assetPath:s}})}var Ty={xAxis:0,yAxis:0,button:0,state:xy.ComponentState.DEFAULT};function Ey(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var Dy=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===xy.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Ty)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:i,normalizedYAxis:a}=Ey(e,t);switch(this.componentProperty){case xy.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?i:.5;break;case xy.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case xy.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case xy.ComponentProperty.STATE:this.valueNodeProperty===xy.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=+!!this.states.includes(r);break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Oy=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 Dy(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:xy.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=xy.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=xy.ComponentState.PRESSED:(t.touched||this.values.button>xy.ButtonTouchThreshold)&&(this.values.state=xy.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===xy.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>xy.AxisTouchThreshold&&(this.values.state=xy.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===xy.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>xy.AxisTouchThreshold&&(this.values.state=xy.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},ky=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 Oy(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)})}},Ay=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,jy=`generic-trigger`,My=class extends t.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof t.Mesh&&e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:n,maxNode:r,value:i,valueNodeProperty:a}=e;t&&(a===xy.VisualResponseProperty.VISIBILITY?t.visible=i:a===xy.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))})}))}};function Ny(e,n){Object.values(e.components).forEach(e=>{let{type:r,touchPointNodeName:i,visualResponses:a}=e;if(r===xy.ComponentType.TOUCHPAD)if(e.touchPointNode=n.getObjectByName(i),e.touchPointNode){let n=new t.Mesh(new t.SphereGeometry(.001),new t.MeshBasicMaterial({color:255}));e.touchPointNode.add(n)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(a).forEach(e=>{let{valueNodeName:t,minNodeName:r,maxNodeName:i,valueNodeProperty:a}=e;if(a===xy.VisualResponseProperty.TRANSFORM){if(e.minNode=n.getObjectByName(r),e.maxNode=n.getObjectByName(i),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=n.getObjectByName(t),e.valueNode||console.warn(`Could not find ${t} in the model`)})})}function Py(e,n){Ny(e.motionController,n),e.envMap&&n.traverse(n=>{n instanceof t.Mesh&&n.isMesh&&(n.material.envMap=e.envMap,n.material.needsUpdate=!0)}),e.add(n)}var Fy=class{constructor(e=null){this.gltfLoader=e,this.path=Ay,this._assetCache={}}createControllerModel(e){let t=new My,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||wy(r,this.path,jy).then(({profile:e,assetPath:i})=>{t.motionController=new ky(r,e,i);let a=this._assetCache[t.motionController.assetUrl];if(a)n=a.scene.clone(),Py(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(),Py(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},Iy=`fade`,Ly=Object.assign({},fr(Q_,[`maxLatitude`,`minLatitude`]));function Ry(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 zy=300,By=new t.Raycaster,Vy=new t.Vector3,Hy={Floorplan:Zg,Topview:$g,Panorama:$_,VRPanorama:Wv,Model:Yv,Mapview:ty,XRPanorama:class e extends $_{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 cy(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,Q(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,Q(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new t.Raycaster,right:new t.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 by,right:new by},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new t.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new t.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new t.Group,new t.Group];let n=this.xrManager.getController(0);this.controllerWrappers[0].add(n);let r=this.xrManager.getController(1);this.controllerWrappers[1].add(r);let i=new Fy;i.gltfLoader={load(e,t){ur.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return Us(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:ur})}).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=Zt()]={panoId:Z(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:Iy,effectEasing:J_,fixCameraTransform:new t.Matrix4},this.parallaxCameraMatrixs=[];let a=ei.shared.getContext();if(!a){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(a),this.on(`xr.session.start`,()=>{let e=this.xrManager.getControllerGrip(0);e.add(i.createControllerModel(e)),this.controllerWrappers[0].add(e);let t=this.xrManager.getControllerGrip(1);t.add(i.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,n,r){var i,a,o;this.userAction=r,this.stopMomentumMovement();let s=Z(e),c=this.works.getObserver(e);if(!c)throw Error(`Invalid PanoIndex`);let l=Kr(c.images.up),u=this.imageOptions.size;u===void 0&&c&&l&&(u=Number(l)),u===void 0&&(u=2048);let d=this.imageOptions.transform,f=(e,t)=>Ry(Wr(e,d,t)),p=Object.assign({key:`pano.${s}`},dr(this.imageOptions,[`format`,`size`,`quality`])),m={right:c.images.work.getURL(c.images.right),left:c.images.work.getURL(c.images.left),up:c.images.work.getURL(c.images.up),down:c.images.work.getURL(c.images.down),front:c.images.work.getURL(c.images.front),back:c.images.work.getURL(c.images.back)},h=`pano:`+Lp([m,p,d]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===h)return;{let t=this.pendingPanoTask.panoId;(i=this.panoMeshes.get(t))==null||i.setProgress(0),this.emit(`pano.texture.abort`,Q(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let g=`move-to-pano-`+s;this.pending.add(g);let _=wg(`pano.prepare`,{options:n,prevMode:this.mode,prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,_),_.defaultPrevented){this.pending.delete(g);return}_.options!==n&&Object.assign(n,_.options);let v=this.modelScene.parameter,y;v.pano0&&v.pano0.map.name===h?y=v.pano0:v.pano1&&v.pano1.map.name===h&&(y=v.pano1);let b=(a=n.effect)==null?Iy:a,x=(o=n.effectEasing)==null?J_:o;if(y){let r={panoId:s,effect:b,effectEasing:x,leftPanoPicture:{panoId:y.panoId,map:y.map,mapHistogram:y.mapHistogram,mapSize:y.mapSize,matrix:c.matrix.clone().premultiply(c.work.transform),zoom:1},position:c.position.clone().applyMatrix4(c.work.transform),fixCameraTransform:new t.Matrix4};r.leftPanoPicture&&this.panoPictureObserverMap.set(r.leftPanoPicture,c),this.pendingPanoTask=void 0,Promise.resolve().then(()=>Tg(_)).catch(e=>{let t=qg(e);return this.emit(`error`,t),t}).then(t=>{var i,a;if(!(t instanceof Error))this.pending.delete(g),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0),this.doMoveToPano(e,r,n);else{let e=null;t instanceof Error&&(e||(e=t));let r=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),n.moveCancelCallback&&n.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(g),this.pendingPanoTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)}});return}let S=this.panoMeshes.get(s);S&&S.tap&&S.tap(),this.pendingPanoTask={panoId:s,hash:h,onLoad:r=>{var i;let a=r.body;if(this.destroyed)a.dispose();else{a.name=h;let r=Array.isArray(a.image)?a.image[0]:a.image,o=(i=r==null?void 0:r.width)==null?2048:i,l=new Hm().formPixels(Vg(this.renderer,a,!0,Rm).data),u={panoId:s,effect:b,effectEasing:x,leftPanoPicture:{panoId:s,map:a,mapSize:o,mapHistogram:new t.Vector4().fromArray(l.toArray()),matrix:c.matrix.clone(),zoom:1},position:c.position.clone(),fixCameraTransform:new t.Matrix4};u.leftPanoPicture&&this.panoPictureObserverMap.set(u.leftPanoPicture,c),this.doMoveToPano(e,u,n)}},onError:e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),e instanceof Error&&e.message&&this.emit(`error`,e),n.moveCancelCallback&&n.moveCancelCallback()}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(m,{imageURL:{transform:f,options:p},format:t.RGBFormat,viaAjax:!0,fetcher:Kf(this.fiveId,c.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,Q(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===h&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=qg(t);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>Tg(_)).catch(e=>qg(e))]).then(([t,n])=>{var r,i,a,o;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(g),((r=this.pendingPanoTask)==null?void 0:r.hash)===h?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,Q(`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(g),((a=this.pendingPanoTask)==null?void 0:a.hash)===h&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(s))==null||o.setProgress(0))}})}doMoveToPano(e,n,r={}){var i,a,o,s,c,l,u,d,f,p;let m=V(),h=Zt();this.panoResources[h]=n;let g,_,v;if(this.locationMotion.ended){let[e,t]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(t).position,a=n.position;g=Math.max(i.distanceTo(a),1),_=[{key:t.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:h,progress:1,value:{distance:0,count:1}}],v=0}else{let[e,t]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(t).position,o=n.position,s=t.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;g=c+Math.max(a.distanceTo(o),1),_=[{key:e.key,progress:0,value:Object.assign({},r)},{key:t.key,progress:c/g,value:t.value},{key:h,progress:1,value:{count:t.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(_);v=this.locationMotion.getProgressVelocity(m)*l/u}let y=n.effect===`instant`?0:this.calculateMovingDuration(r.duration,n.effect===`fly`||n.effect===`model`?g:0),b={longitude:r.longitude,latitude:r.latitude,fov:r.fov},x=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(i=b.longitude)==null?this.camera.pose.longitude:i,latitude:(a=b.latitude)==null?this.camera.pose.latitude:a,fov:(o=b.fov)==null?this.camera.pose.fov:o,offset:n.position.clone(),distance:0}),S=this.currentPano;if(this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:r,prevPano:S,pano:{panoIndex:x.panoIndex,workCode:x.workCode},progress:0,state:x,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(x),this.perspToOrthoMotion.set({perspToOrtho:0},y).catch(G),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],y).catch(G),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=G,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),n.effect===`fly`||n.effect===`model`)this.cameraMotion.set(b,y).catch(G);else{let e=It({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),r=It({longitude:(s=b.longitude)==null?this.cameraMotion.value.longitude:s,latitude:(c=b.latitude)==null?this.cameraMotion.value.latitude:c}),i=new t.Object3D;i.lookAt(e);let a=new t.Matrix4().makeRotationFromQuaternion(i.quaternion);i.lookAt(r);let o=new t.Matrix4().makeRotationFromQuaternion(i.quaternion),m=new t.Matrix4().getInverse(a).premultiply(o),h=this.cameraMotion.value.fov,g=(l=b.fov)==null?this.cameraMotion.value.fov:l,v=1;n.effect===`zoomin`?v=1.5:n.effect===`zoomout`&&(v=.4);let x=g*v;for(let e=0;e<_.length-1;e++){let t=_[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(m),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(x/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(u=b.longitude)==null?this.cameraMotion.value.longitude:u,latitude:(d=b.latitude)==null?this.cameraMotion.value.latitude:d,fov:x}},{progress:1,value:{longitude:(f=b.longitude)==null?this.cameraMotion.value.longitude:f,latitude:(p=b.latitude)==null?this.cameraMotion.value.latitude:p,fov:g}}],y).catch(G)}this.locationMotion.setKeyframes(_,y,v).then(()=>{for(let e of this.modelScene.children)e instanceof dp&&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`,Q(`pano.arrived`,{options:r,prevPano:S,pano:{panoIndex:t.panoIndex,workCode:t.workCode},progress:1,state:t,userAction:this.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(t);let n=this.works.getObserver(this.currentPano);if(n&&n.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:n.images.video.size.clone(),matrix:n.images.video.matrix.clone(),panoMatrix:n.matrix.clone().premultiply(n.work.transform),alpha:1},t=Zt(),r=this.videoTexture.image;r.setAttribute(`uuid`,t),i_().then(i=>{i&&n.images.video&&r.getAttribute(`uuid`)===t&&(r.oncanplay=()=>{r.oncanplay=G,r.play()},r.ontimeupdate=()=>{r.currentTime>.5&&(r.ontimeupdate=G,this.panoVideo.setMaterial(e))},r.src=n.images.video.source)}).catch((()=>{r.removeAttribute(`uuid`)}))}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{options:r,prevPano:S,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),r.moveCancelCallback&&r.moveCancelCallback()})}checkSelectedPano(e){var n;this.stopMomentumMovement(),this.camera.getDirection(new t.Vector3).setY(0);let r=null,i=this.works.getObserver(this.currentPano);if(!i)return null;let a=i.work.observers,o=i.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&i.work.workCode===this.currentPano.workCode)return!1;let t=a[e];return!t||Vy.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[s]=this.modelScene.intersectRaycaster(e);if(s){let[e,t]=vu(o,e=>{let t=a[e];return t?Vy.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(s.point):1/0},!0);typeof e==`number`&&t<this.panoTapTriggerRadius&&(r=(n=a[e])==null?null:n)}if(ny(r)){let t=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);t&&(r=t)}for(let e of this.locationMotion.keyframes){let t=this.panoResourceFromLocationMotionKeyframe(e);if(!(e.progress<this.locationMotion.progress)&&r){let e=Z({panoIndex:r.panoIndex,workCode:r.work.workCode});if(t.panoId===e){r=null;break}}}if(ny(r))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!r.active){let e=Z({panoIndex:r.panoIndex,workCode:r.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let c={workCode:r.work.workCode,panoIndex:r.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:r?r.position.clone():new t.Vector3};return this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.workCode},state:c,userAction:!0,options:{},progress:0,error:null})),r&&r.active?(this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.workCode},progress:0,state:c,options:{},error:null})),{workCode:r.work.workCode,panoIndex:r.panoIndex}):null}destroy(){super.destroy()}isReady(){return!1}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,n,...r){var i,a,o,s,c,l,u,d,f;this.userAction=!0;let p={},m={},h=this.camera.getDirection(new t.Vector3),g=this.locationMotion.keyframes[0],_=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[v,y]=this.locationMotion.getKeyFrameSegment(e),b=this.panoResourceFromLocationMotionKeyframe(v),x=this.panoResourceFromLocationMotionKeyframe(y),S=this.panoResourceFromLocationMotionKeyframe(g),C=this.panoResourceFromLocationMotionKeyframe(_),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let n=this.locationMotion.value.count-y.value.count+1,r=new t.Vector3().copy(b.position),o=new t.Vector3().copy(x.position);if(p.progress=n,n>=.01&&n<=.99&&(p.progress=H(x.effectEasing(n),.01,.99)),x.leftPanoPicture&&(n<1?b.leftPanoPicture&&(p.pano0=b.leftPanoPicture):p.pano0=x.leftPanoPicture,p.pano1=x.leftPanoPicture),x.effect===`montage`?p.transition=`BLACK`:x.effect===`spread`?p.transition=`SPREAD`:p.transition=`FADE`,x.effect===`zoomin`||x.effect===`zoomout`?p.progress=Math.pow(n,3):x.effect===`model`&&this.camera.pose.distance<.01&&(p.modelAlpha=1-Math.pow(H(Math.abs(n-.5)*2,0,1),4)),n<1&&x.effect!==`fly`){if(p.pano0&&b.leftPanoPicture){let e={panoId:p.pano0.panoId,map:p.pano0.map,mapHistogram:p.pano0.mapHistogram,mapSize:p.pano0.mapSize,zoom:p.pano0.zoom,matrix:b.leftPanoPicture.matrix.clone().setPosition(x.position)},t=this.panoPictureObserverMap.get(p.pano0);t&&this.panoPictureObserverMap.set(e,t),p.pano0=e}r.copy(o),w=!0}m.distance=this.locationMotion.value.distance,m.offset=new t.Vector3(r.x+(o.x-r.x)*n,r.y+(o.y-r.y)*n,r.z+(o.z-r.z)*n);let s=[],c=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(s.push(t),n>this.locationMotion.progress&&c.push(t))}for(let e of Object.keys(this.panoResources)){if(c.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((i=p.pano0)==null?void 0:i.map)||e===((a=p.pano1)==null?void 0:a.map))continue;e.dispose(),t.leftPanoPicture=null}}s.indexOf(e)>=0||delete this.panoResources[e]}let l=zp(x.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:zp(S.panoId),pano:zp(C.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},zp(C.panoId)),{mode:this.mode}),$(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(m),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);let[T,E]=r,D=new t.Vector3(0,0,0),O=new t.Vector2().copy(this.camera.resolution);if(E&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let r=this.xrManager.cameraVR,i=this.xrManager.referenceSpace,a=this.xrManager.session.renderState.baseLayer,l=E.getViewerPose(i),u=(o=l==null?void 0:l.views)==null?[]:o;for(let e=0;e<u.length;e++){let t=u[e],n=r.cameras[e],i=a.getViewport(t);i&&(n.projectionMatrix.fromArray(t.projectionMatrix),n.projectionMatrixInverse.getInverse(n.projectionMatrix),n.matrix.fromArray(t.transform.matrix),n.matrix.setPosition(this.camera.position),n.matrix.decompose(n.position,n.quaternion,n.scale),n.matrixWorld.copy(n.matrix),n.matrixWorldInverse.getInverse(n.matrixWorld),n.matrixAutoUpdate=!1,D.copy(n.position),n.viewport.set(i.x,i.y,i.width,i.height),O.set(i.width,i.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((s=m.distance)==null?this.camera.pose.distance:s),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 n=E.getPose(this.xrManager.session.inputSources[e].targetRaySpace,i);if(n){let e=n.transform.orientation,r=new t.Quaternion(e.x,e.y,e.z,e.w),i=new t.Vector3(0,0,-1).applyQuaternion(r),a=new t.Raycaster(this.camera.position,i);this.gazeRay=a}}}if(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`){let r=this.xrManager.session.inputSources;for(let e=0;e<r.length;e++){let n=this.xrManager.controllers[e],a=r[e];if(!a)continue;n&&n.update(a,E,i);let o=this.xrManager.getController(e),s=new t.Vector3(0,1.2,0),l=o.position.clone().add(D).sub(s);a.handedness===`left`?this.xrControllerRay.left.set(l,new t.Vector3(0,0,-1).applyEuler(o.rotation)):a.handedness===`right`&&this.xrControllerRay.right.set(l,new t.Vector3(0,0,-1).applyEuler(o.rotation)),this.controllerWrappers[e].position.copy(new t.Vector3(0,0,0).add(D).sub(s));let u=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(u.length===0){let e=this.works.getResolvedObserver(this.currentPano);u=this.xrControllerRay.right.intersectObject(this.modelScene.boundingMesh,!0).map(t=>{var n;let r=(n=e==null?void 0:e.floorIndex)==null?0:n;return Object.assign({floorIndex:r,floor:r},t)})}if(u.length>=1&&u[0].face)if(a.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=u[0].face.normal,n=t.clone(),r=u[0].point.clone();this.intersectMesh.position.copy(r);let i=r.clone().add(n);if(this.intersectMesh.lookAt(i),Math.abs(t.y)>.99){let e=this.camera.position.clone().sub(r);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,e.length>0?(this.pointerLines.right.setPoints(l,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(l,u[0].point));let a=u[0],o=Q(`intersect.update`,{raycaster:(c=this.xrControllerRay.right)==null?null:c,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(l,u[0].point)}this.updateControllerHelper(r,e,n)}}else E||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);Ng(p)===!1&&this.modelScene.parameter.set(p),this.emit(`camera.update`,Q(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose))}));let k=this.works.getResolvedObserver(this.currentPano),A=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,j=this.works.getObserver(b.panoId),M=this.works.getObserver(x.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&k){let e=[],n=k.work.observers;for(let t of k.accessibleNodes){let r=n[t];r&&e.push(r)}let r=new Map;if(e.sort((e,t)=>{let n=r.get(e);n===void 0&&(n=e.standingPosition.distanceTo(k.standingPosition),r.set(e,n));let i=r.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(k.standingPosition),r.set(t,i)),n-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let n=e[this.accessibleObserverFloorCheckCount],r=this.modelScene.models.find(e=>e.work===(n==null?void 0:n.work));if(n&&r&&r.visible){let e=.3,i=.005,a=n.standingPosition.clone().applyMatrix4(n.work.transform),o=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),s=Z_.map(n=>{By.ray.origin.copy(a),By.ray.origin.add(Vy.copy(n).setY(e)),By.ray.direction.set(0,-1,0),By.firstHitOnly=!0,By.floorIndex=-1;let[o]=r.intersectRaycaster(By);return o&&o.distance-i<=e?new t.Vector3().copy(a).setY(o.point.y+i):a});s.sort((e,t)=>t.y-e.y);let c=s[Math.floor(s.length/2)],[l]=s.filter(e=>e.distanceTo(c)<=.05);if(l){let e=new t.Vector4(a.x,a.y,a.z,l.y-a.y),n=this.adjustPanoCircleMeshPositionFix.get(o);n&&!e.equals(n)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(o,e)}}this.accessibleObserverFloorCheckCount++}}let N=new Map;if(j)for(let e of j.accessibleNodes){let t=j.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(M)for(let e of M.accessibleNodes){let t=M.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{N.get(t)?N.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),N.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),N.delete(t)}),this.panoMeshes.forEach((e,n)=>{let r=this.works.getObserver(n);if(r){let i=r.position.distanceTo(r.standingPosition)>this.aerialObserverMinHeight;if(i)e.position.copy(r.position).applyMatrix4(r.work.transform),e.scale.setScalar(18);else{e.position.copy(r.standingPosition).applyMatrix4(r.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(r.panoId);t&&(Vy.set(t.x,t.y,t.z),Vy.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let a=this.camera.position.clone().setY(e.position.y),o=new t.Vector3().copy(e.position).sub(a).normalize();if(n===Z(this.currentPano)){let t=H((.5-a.distanceTo(e.position))/.5,0,1);o.multiplyScalar(1-t).add(h.clone().multiplyScalar(t))}if(o.length()>0){let n=i?-Math.PI/2:0,r=Math.atan2(o.x,o.z);e.quaternion.setFromEuler(new t.Euler(n,r,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(t=>{t.setOpacity(0),t.setCurrent(!1),t.updateTime&&t.updateTime(e,n),t.visible=!1});else if(k){let t=k.work.observers,[,r]=vu(k.accessibleNodes,e=>{let n=t[e];return!n||!n.active?1/0:k.standingPosition.distanceTo(n.standingPosition)},!0);r=H(r,2.5,1/0);let i=k.accessibleNodes.concat(k.panoIndex).map(e=>Z({panoIndex:e,workCode:k.work.workCode}));this.panoMeshes.forEach((t,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=t.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!t.loading&&t.progress===0&&A!==null&&Z({panoIndex:A.panoIndex,workCode:A.work.workCode})===a;let n=t.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=n<.01?0:H(r/n,.1,.85)}o&&o===M&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&t.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(c=0),t.setCurrent(s),t.setOpacity(c),t.updateTime&&t.updateTime(e,n)})}{let e=(l=this.modelScene.parameter.progress)==null?1:l,n=Math.round(e),r=this.modelScene.parameter.pano0,i=this.modelScene.parameter.pano1,a=n===0?r:i,o;if(a&&(o=this.works.getObserver(a.panoId),o||(o=this.panoPictureObserverMap.get(a))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(ii()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!o||!a||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new t.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Yr(a.mapSize)+1;this.tiling.setObserver(o);let t={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:a.map,panoMatrix:a.matrix,panoZoom:a.zoom,minLevel:e,level:4},s=this.tiling.update(t),c={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:n,opacity:(r==null?void 0:r.panoId)===(i==null?void 0:i.panoId)?1:Ed(Math.abs(((u=this.modelScene.parameter.progress)==null?0:u)-.5)*2)},l=this.modelScene.parameter.refinedScreen;(s||c.pano!==(l==null?void 0:l.pano)||c.opacity!==(l==null?void 0:l.opacity))&&this.modelScene.parameter.set(`refinedScreen`,c)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&k&&k.position.y-k.standingPosition.y>10){let e=H(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=x.effect,{pano0:n,pano1:r}=this.modelScene.parameter;if(n&&r&&n!==r&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((d=this.modelScene.parameter.pano0Depth)==null?void 0:d.panoId)!==n.panoId||((f=this.modelScene.parameter.pano1Depth)==null?void 0:f.panoId)!==r.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1});let e=new t.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(n.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,K_(this.renderer,this.modelScene,e,500);let i=new t.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);i.matrix.copy(r.matrix),i.matrixWorld.copy(i.matrix),i.matrixAutoUpdate=!1,K_(this.renderer,this.modelScene,i,500),this.modelScene.parameter.set({pano0Depth:{panoId:n.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:r.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}render(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){let e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}updateControllerHelper(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(!e||e.length===0)return;let a={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let o=0;o<e.length;o++){let s=e[o].handedness,c=e[o].gamepad;switch(s){case`left`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`LeftAxesDown`,t)),c!=null&&c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`X`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`Y`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`LeftTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n};a.buttons.X=c.buttons&&c.buttons[4]?c.buttons[4].pressed:!1,a.buttons.Y=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.LeftTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.LeftPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1,a.left=e;break;case`right`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`RightAxesDown`,t)),c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`A`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`B`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`RightTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`RightPinch`,t)),a.right={raycaster:i,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n},a.buttons.A=c.buttons&&c.buttons[4]?c==null?void 0:c.buttons[4].pressed:!1,a.buttons.B=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.RightTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.RightPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,Q(`xr.controller.update`,a))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)this.xrHandleState[t].touchStart===!1?(this.xrHandleState[t].touchStartTime=n,this.xrHandleState[t].touchStart=!0,this.emit(`xr.gesture.buttonDown`,Q(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrHandleState[t].touchStartTime>zy&&this.emit(`xr.gesture.press`,Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,Q(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrHandleState[t].touchStartTime<=zy){let e=Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}});!this.emit(`xr.gesture.tap`,e)&&!e.defaultPrevented&&t===`RightTrigger`&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[t].touchStart=!1,this.xrHandleState[t].touchStartTime=0}}initHandEvent(){if(!this.xrManager.session)throw Error(`初始化失败`);this.xrManager.session.addEventListener(`select`,e=>{this.gazeRay&&this.checkSelectedPano(this.gazeRay)})}}},Uy={Floorplan:Xg,Topview:Qg,Panorama:Q_,VRPanorama:Uv,Model:Jv,Mapview:ey,XRPanorama:Ly},Wy=`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 Gy(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=It(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 Ky(){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 qy(){let e=new t.Group;e.name=`internalLights`;{let n=new t.DirectionalLight(16777215,.1);n.name=`direction0`,n.position.copy(new t.Vector3(0,1,0)),e.add(n)}{let n=new t.DirectionalLight(16777215,.1);n.name=`direction1`,n.position.copy(new t.Vector3(-1,-1,-1)),e.add(n)}{let n=new t.DirectionalLight(16777215,.3);n.name=`direction2`,n.position.copy(new t.Vector3(1,1,1)),e.add(n)}{let n=new t.AmbientLight(16777215,.6);n.name=`ambient0`,e.add(n)}return e}function Jy(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function Yy(){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=Jy((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var Xy=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAAD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5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==`,Zy=[351,63],Qy=[20,20],$y=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),eb=new Float32Array([0,0,1,0,0,1,1,1]),tb=new Uint8Array([0,1,2,1,3,2]),nb=new t.BufferGeometry;nb.setAttribute(`position`,new t.BufferAttribute($y,3)),nb.setAttribute(`uv`,new t.BufferAttribute(eb,2)),nb.setIndex(new t.BufferAttribute(tb,1));var rb=new t.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),ib=new t.Mesh(nb,rb);ib.matrixAutoUpdate=!1;var ab=new t.Scene;ab.add(ib),ab.matrixAutoUpdate=!1;var ob=new t.OrthographicCamera(-.5,.5,.5,-.5,.1,1);ob.position.set(0,0,.5),ob.lookAt(0,0,0),ob.updateMatrixWorld(!0),ob.matrixAutoUpdate=!1;var sb=new t.Vector4,cb=new t.Vector4;function lb(e){if(rb.map){let t=e.getViewport(sb),n=e.getScissor(cb),r=e.getScissorTest(),i=e.autoClear,a=n.x+Qy[0]/3,o=n.y+Qy[1]/3,s=Zy[0]/3,c=Zy[1]/3;e.setViewport(a,o,s,c),e.setScissor(a,o,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(ab,ob),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{let e=new t.Texture,n=new Image;n.onload=()=>{e.image=n,e.wrapS=t.ClampToEdgeWrapping,e.wrapT=t.ClampToEdgeWrapping,e.minFilter=t.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,rb.needsUpdate=!0,n.onload=G},n.src=Xy,rb.map=e}}var ub=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,n,r){let i=new t.DataTexture(e,n,r,t.RedIntegerFormat,t.UnsignedIntType);return i.internalFormat=`R32UI`,i.minFilter=t.NearestFilter,i.magFilter=t.NearestFilter,i.generateMipmaps=!1,i.needsUpdate=!0,i}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()}},db=2,fb=8,pb=class{constructor(e){let n=e.numPoints,r=e.packedData;if(!r||r.length<n*fb)throw Error(`[TileTexture] object 缺少足量 packedData`);let i=n*db,a=Math.max(1,Math.min(2048,i)),o=Math.max(1,Math.ceil(i/a)),s=new Uint32Array(a*o*4);s.set(r.subarray(0,n*fb),0);let c=new t.DataTexture(s,a,o,t.RGBAIntegerFormat,t.UnsignedIntType);c.internalFormat=`RGBA32UI`,c.minFilter=t.NearestFilter,c.magFilter=t.NearestFilter,c.generateMipmaps=!1,c.needsUpdate=!0,this.texture=c,this.count=n,this.width=a,this.height=o}dispose(){this.texture.dispose()}},mb=2,hb=class e{constructor(n=2048){this.target=null,this.targetHeight=0,this.regionMap=new Map,this.regionList=[],this.width=n,this.material=new t.RawShaderMaterial({vertexShader:e.VERTEX,fragmentShader:e.FRAGMENT,uniforms:{u_tileTex:{value:null},u_tileWidth:{value:1},u_bigWidth:{value:n},u_startTexel:{value:0},u_count:{value:0},u_transformIndex:{value:0},u_layerIndex:{value:0}},depthTest:!1,depthWrite:!1}),this.scene=new t.Scene,this.mesh=new t.Mesh(new t.PlaneGeometry(2,2),this.material),this.mesh.frustumCulled=!1,this.scene.add(this.mesh),this.camera=new t.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 i={object:e,tile:t,start:0,count:t.count,transformIndex:n,layerIndex:r};this.regionMap.set(e,i),this.regionList.push(i)}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:i,layerIndex:a}=t(n);e?(e.transformIndex=i,e.layerIndex=a):(e={object:n,tile:new pb(n),start:0,count:n.numPoints,transformIndex:i,layerIndex:a},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 n=0;for(let e of this.regionList)e.start=n,n+=e.count;let r=Math.max(1,Math.ceil(n*mb/this.width));(!this.target||r>this.targetHeight)&&(this.target&&this.target.dispose(),this.targetHeight=r,this.target=new t.WebGLRenderTarget(this.width,r,{format:t.RGBAIntegerFormat,type:t.UnsignedIntType,minFilter:t.NearestFilter,magFilter:t.NearestFilter,depthBuffer:!1,stencilBuffer:!1}),this.target.texture.internalFormat=`RGBA32UI`,this.target.texture.generateMipmaps=!1);let i=e.getRenderTarget(),a=e.autoClear,o=e.getScissorTest(),s=e.getScissor(new t.Vector4),c=e.getPixelRatio()||1;e.autoClear=!1,e.setRenderTarget(this.target),e.setScissorTest(!0);for(let t of this.regionList){let n=t.start*mb,r=(t.start+t.count)*mb,i=Math.floor(n/this.width),a=Math.ceil(r/this.width),o=Math.max(0,Math.floor(i/c)-1),s=Math.ceil(a/c)+1,l=Math.ceil(this.width/c)+1;e.setScissor(0,o,l,s-o);let u=this.material.uniforms;u.u_tileTex.value=t.tile.texture,u.u_tileWidth.value=t.tile.width,u.u_bigWidth.value=this.width,u.u_startTexel.value=n,u.u_count.value=t.count,u.u_transformIndex.value=t.transformIndex,u.u_layerIndex.value=t.layerIndex,this.material.uniformsNeedUpdate=!0,e.render(this.scene,this.camera)}e.setScissorTest(o),e.setScissor(s),e.setRenderTarget(i),e.autoClear=a}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 i=new Float32Array(r.buffer,r.byteOffset,r.length),a=e.transformIndex;for(let r=0;r<e.count;r++){let o=e.start+r;t[o*3+0]=i[r*8+0],t[o*3+1]=i[r*8+1],t[o*3+2]=i[r*8+2],n[o]=a}}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),i=e.getRenderTarget();e.setRenderTarget(this.target);let a=e.getContext();return a.readPixels(0,0,t,n,a.RGBA_INTEGER,a.UNSIGNED_INT,r),e.setRenderTarget(i),r}dispose(){this.clear(),this.target&&(this.target.dispose(),this.target=null),this.mesh.geometry.dispose(),this.material.dispose()}};hb.VERTEX=`#version 300 es
|
|
2844
2844
|
in vec3 position;
|
|
2845
2845
|
void main() {
|
|
2846
2846
|
gl_Position = vec4(position.xy, 0.0, 1.0);
|
|
2847
2847
|
}
|
|
2848
|
-
`,
|
|
2848
|
+
`,hb.FRAGMENT=`#version 300 es
|
|
2849
2849
|
precision highp float;
|
|
2850
2850
|
precision highp int;
|
|
2851
2851
|
precision highp usampler2D;
|
|
@@ -2871,7 +2871,7 @@ void main() {
|
|
|
2871
2871
|
}
|
|
2872
2872
|
outColor = v;
|
|
2873
2873
|
}
|
|
2874
|
-
`;var
|
|
2874
|
+
`;var gb=5,_b=gb*4,vb=class{constructor(){this.texture=null,this.width=gb,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)*_b;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*_b),this.data[t*_b+16]=+!!n.selected}this.rebuildTexture()}updateOne(e){let t=this.indexMap.get(e);t!==void 0&&(this.data.set(e.matrixWorld.elements,t*_b),this.data[t*_b+16]=+!!e.selected,this.texture&&(this.texture.needsUpdate=!0))}rebuildTexture(){let e=Math.max(1,this.count);this.texture&&this.texture.dispose();let n=new t.DataTexture(this.data,this.width,e,t.RGBAFormat,t.FloatType);n.internalFormat=`RGBA32F`,n.minFilter=t.NearestFilter,n.magFilter=t.NearestFilter,n.generateMipmaps=!1,n.needsUpdate=!0,this.texture=n}dispose(){this.texture&&(this.texture.dispose(),this.texture=null)}},yb=1,bb=yb*4,xb=class{constructor(){this.texture=null,this.width=yb,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)*bb;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*bb;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 n=new t.DataTexture(this.data,this.width,e,t.RGBAFormat,t.FloatType);n.internalFormat=`RGBA32F`,n.minFilter=t.NearestFilter,n.magFilter=t.NearestFilter,n.generateMipmaps=!1,n.needsUpdate=!0,this.texture=n}dispose(){this.texture&&(this.texture.dispose(),this.texture=null),this.indexMap.clear(),this.count=0}},Sb=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}},Cb=2048,wb=4,Tb=class{constructor(){this.texture=null,this.textureSize=new t.Vector2,this.dataMaxDegree=0,this.appliedDegree=0}sync(e,n){let r=0,i=0;for(let t of e)t.maxSHDegree>r&&(r=t.maxSHDegree),i+=t.numPoints;this.dataMaxDegree=r;let a=Math.min(n,r);if(this.appliedDegree=a,a<=0||i===0)return this.appliedDegree=0,!1;let o=0;a>=1&&(o+=9),a>=2&&(o+=15),a>=3&&(o+=21);let s=o;s%wb!==0&&(s=Math.ceil(s/wb)*wb);let c=s/wb,l=i*c,u=Cb,d=Math.ceil(l/u),f=new Float32Array(u*d*wb),p=0;for(let t of e){let e=t.sh1,n=t.sh2,r=t.sh3;for(let i=0;i<t.numPoints;i++){let t=(p+i)*c,o=0;if(e&&a>=1)for(let n=0;n<9;n++){let r=t+Math.floor(o/wb),a=o%wb;f[r*wb+a]=e[i*9+n],o++}if(n&&a>=2)for(let e=0;e<15;e++){let r=t+Math.floor(o/wb),a=o%wb;f[r*wb+a]=n[i*15+e],o++}if(r&&a>=3)for(let e=0;e<21;e++){let n=t+Math.floor(o/wb),a=o%wb;f[n*wb+a]=r[i*21+e],o++}}p+=t.numPoints}this.texture&&this.texture.dispose();let m=new t.DataTexture(f,u,d,t.RGBAFormat,t.FloatType);return m.internalFormat=`RGBA32F`,m.minFilter=t.NearestFilter,m.magFilter=t.NearestFilter,m.generateMipmaps=!1,m.needsUpdate=!0,this.texture=m,this.textureSize.set(u,d),!0}dispose(){this.texture&&(this.texture.dispose(),this.texture=null)}},Eb=4294967295,Db=class e{constructor(n=64){this.maxSeg=n,this.segStart=Array(n).fill(0),this.segEnd=Array(n).fill(0),this.segDelta=Array(n).fill(0),this.segRemoved=Array(n).fill(0),this.material=new t.RawShaderMaterial({vertexShader:e.VERTEX,fragmentShader:e.buildFragment(n),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 t.Scene,this.mesh=new t.Mesh(new t.PlaneGeometry(2,2),this.material),this.mesh.frustumCulled=!1,this.scene.add(this.mesh),this.camera=new t.Camera}static createOrderTarget(e,n){let r=new t.WebGLRenderTarget(e,n,{format:t.RedIntegerFormat,type:t.UnsignedIntType,minFilter:t.NearestFilter,magFilter:t.NearestFilter,depthBuffer:!1,stencilBuffer:!1});return r.texture.internalFormat=`R32UI`,r.texture.generateMipmaps=!1,r}run(e,t,n,r,i){let a=Math.min(i.length,this.maxSeg);i.length>this.maxSeg&&console.warn(`[ReorderPass] segments ${i.length} 超过 maxSeg ${this.maxSeg},将被截断。`);for(let e=0;e<a;e++){let t=i[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=a,this.material.uniformsNeedUpdate=!0;let o=e.getRenderTarget(),s=e.autoClear;e.autoClear=!1,e.setRenderTarget(r),e.render(this.scene,this.camera),e.setRenderTarget(o),e.autoClear=s}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;
|
|
@@ -2901,12 +2901,12 @@ void main() {
|
|
|
2901
2901
|
}
|
|
2902
2902
|
outColor = uvec4(result, 0u, 0u, 0u);
|
|
2903
2903
|
}
|
|
2904
|
-
`}};
|
|
2904
|
+
`}};Db.SENTINEL=Eb,Db.VERTEX=`#version 300 es
|
|
2905
2905
|
in vec3 position;
|
|
2906
2906
|
void main() {
|
|
2907
2907
|
gl_Position = vec4(position.xy, 0.0, 1.0);
|
|
2908
2908
|
}
|
|
2909
|
-
`;var
|
|
2909
|
+
`;var Ob=`(function(){function e(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 t(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 n(e){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=e.apply(n,r);function s(e){t(o,i,a,s,c,\`next\`,e)}function c(e){t(o,i,a,s,c,\`throw\`,e)}s(void 0)})}}function r(){return i.apply(this,arguments)}function i(){return i=n(function*(e={}){var t,r=e,i=!1,a=!0,o=self.location.href;if(i||a){try{new URL(\`.\`,o).href}catch(e){}(function(){var e=n(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 s=!1;function c(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 l,u,d=!1;function f(){var e=N.buffer;new Int8Array(e),new Int16Array(e),r.HEAPU8=u=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),r.HEAPU32=new Uint32Array(e),r.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function p(){if(r.preRun)for(typeof r.preRun==\`function\`&&(r.preRun=[r.preRun]);r.preRun.length;)E(r.preRun.shift());S(T)}function m(){d=!0,L.c()}function h(){if(r.postRun)for(typeof r.postRun==\`function\`&&(r.postRun=[r.postRun]);r.postRun.length;)w(r.postRun.shift());S(C)}var g;function _(){return c(\`\\0asm\\0\\0\\0\\\`\\\`\\0\\\`
|
|
2910
2910
|
\\0\\\`\\0\\0\\x07aa\\0\\0\\0\\0\\x07\\bA\\v\\x07b\\0c\\0d\\0e\\0f\\0\\f
|
|
2911
2911
|
ü8T~@A\\b(\\0" \\0B\\x07|Bøÿÿÿ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vA\\bA06\\0A\\vA\\b \\x006\\0 \\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r (\\0"k"A\\b(\\0I\\r \\0 j!\\0@@@A\\b(\\0 G@ (\\f! AÿM@ (\\b"G\\rA\\bA\\b(\\0A~ Avwq6\\0\\f\\v (!\\x07 G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rA\\b \\x006\\0 A~q6 \\0Ar6 \\x006\\0\\v 6\\f 6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(¸
|
|
2912
2912
|
F@ A¸
|
|
@@ -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)}))})();`,Db=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Eb],{type:`text/javascript;charset=utf-8`});function Ob(e){let t;try{if(t=Db&&(self.URL||self.webkitURL).createObjectURL(Db),!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(Eb),{name:e==null?void 0:e.name})}}var kb=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{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"),Ab=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`}rpvv|{-uvtu}-sy|nH0v{pyqr-Ip|zz|{Kn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH|vq-znv{-56-
|
|
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`),jb=new t.Vector3,Mb=new t.Vector3,Nb=new t.Quaternion,Pb=new t.Quaternion,Fb=new t.Vector3,Ib=class extends t.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,n,r)=>{let i=r,a=this.collectObjects(n);if(a.length===0){this.geometry.instanceCount=0;return}let o=0,s=!1;for(let e of a)e.usedSHDegree>o&&(o=e.usedSHDegree),e.initAnimationEnabled&&(s=!0);let c=o!==this.usedSHDegree;this.usedSHDegree=o,this.updateInitAnimationDefine(s),this.isSceneChanged(a)?this.rebuild(e,a):c&&this.updateSH(a);for(let e of a)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 l=new t.Matrix4().multiplyMatrices(i.perspectiveProjectionMatrix,i.matrixWorldInverse);this.requestSort(i,l.elements),(this.orderDirty||this.layoutDirty)&&(this.runReorder(e),this.orderDirty=!1,this.layoutDirty=!1);let u=a.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(`|`);u!==this.lastClipperHash&&(this.updateClipperUniforms(a),this.lastClipperHash=u,this.needsRender=!0),this.material.uniforms.resolution.value.set(i.resolution.x,i.resolution.y)},this.geometry=this.createGeometry(),this.material=this.createMaterial(),this.orderTexture=new cb,this.assembler=new pb,this.reorderPass=new Tb,this.transformStore=new gb,this.objectParamsStore=new yb,this.layerRegistry=new bb,this.shStore=new Cb,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 Ob,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 t.InstancedBufferGeometry,n=new Float32Array([-2,-2,0,2,-2,0,2,2,0,-2,2,0]);e.setAttribute(`position`,new t.BufferAttribute(n,3)),e.setIndex(new t.BufferAttribute(new Uint16Array([0,1,2,0,2,3]),1)),this.splatIndexCapacity=1;let r=new Float32Array(this.splatIndexCapacity),i=new t.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(t.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}ensureSplatIndexCapacity(e){let n=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return n;let r=Math.max(this.splatIndexCapacity,1);for(;r<e;)r*=2;let i=new Float32Array(r);i.set(n.array.subarray(0,Math.min(n.array.length,r)));let a=new t.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(t.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=r,this.geometry._maxInstanceCount=r,a}createMaterial(){return new t.ShaderMaterial({vertexShader:kb,fragmentShader:Ab,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 t.Vector2},u_maxShDegree:{value:0},resolution:{value:new t.Vector2},u_aggregationProgress:{value:0},u_aggregationBoundsMin:{value:new t.Vector3(0,0,0)},u_aggregationBoundsMax:{value:new t.Vector3(0,0,0)},u_aggregationPointDuration:{value:.6},u_objectParams:{value:null}},side:t.DoubleSide,transparent:!0,blending:t.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 i=this.snapshotByGen.get(t);if(i){this.orderBaseSnapshot=i;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),i=e===void 0,a=i?0:e-t.start,o=r[r.length-1];o&&o.removed===i&&(i||o.delta===a)&&o.oldEnd===t.start?o.oldEnd=t.start+t.count:r.push({oldStart:t.start,oldEnd:t.start+t.count,delta:a,removed:i})}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,i=Math.max(1,Math.ceil(this.orderCount/r));this.orderTarget?(this.orderTarget.width!==r||this.orderTarget.height<i)&&this.orderTarget.setSize(r,Math.max(this.orderTarget.height,i)):this.orderTarget=Tb.createOrderTarget(r,i),this.reorderPass.run(e,this.orderTexture.texture,r,this.orderTarget,n);let a=0;for(let e of t)a+=e.count;this.material.uniforms.u_orderTexture.value=this.orderTarget.texture,this.material.uniforms.u_orderWidth.value=r,this.material.uniforms.u_numPoints.value=a}postSortData(){var e;let t=++this.sortGeneration;this.snapshotByGen.set(t,this.snapshotLayout());let{positions:n,transformIndices:r,count:i}=this.assembler.extractSortInputs(),a=this.transformStore.transforms.slice(0,this.transformStore.objectCount*20);(e=this.sortWorker)==null||e.postMessage({sortData:{positions:n,transforms:a,transformIndices:r,vertexCount:i,generation:t}},[n.buffer,a.buffer,r.buffer]),this.sortDataUploaded=!0,this.transformsDirty=!1}shouldSort(e){if(this.transformsDirty||!this.sortDataUploaded||!this.prevSortCameraMatrix)return!0;this.prevSortCameraMatrix.decompose(jb,Nb,Fb),e.matrixWorld.decompose(Mb,Pb,Fb);let t=jb.distanceTo(Mb),n=Math.abs(Nb.dot(Pb));return t>this.sortCameraDistance||n<this.sortCameraCoorient}requestSort(e,n){var r;!this.assembler||this.assembler.totalPoints===0||this.shouldSort(e)&&(performance.now()-this.sortLastTime<this.sortMinIntervalMs||((this.transformsDirty||!this.sortDataUploaded)&&this.postSortData(),(r=this.sortWorker)==null||r.postMessage({viewProj:n}),this.prevSortCameraMatrix||(this.prevSortCameraMatrix=new t.Matrix4),this.prevSortCameraMatrix.copy(e.matrixWorld),this.sortLastTime=performance.now()))}collectObjects(t){let n=[];return t.traverse(t=>{t instanceof e.t&&t.visible&&n.push(t)}),n.sort((e,t)=>{let n=e.uuid+e.gsViewLayerKey,r=t.uuid+t.gsViewLayerKey;return n<r?-1:+(n>r)}),n}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 n,r;let i=this.layerRegistry;if(!i||i.layerCount===0){this.material.uniforms.u_layerClipperRanges.value=[],this.material.uniforms.u_clipperMatricesInverse.value=[],this.updateClipperCounts(0,0);return}let a=new Map;for(let t of e)a.has(t.gsViewLayerKey)||a.set(t.gsViewLayerKey,t.gsClippers);let o=i.layerKeys.length,s=0;for(let e of i.layerKeys)s+=((n=a.get(e))==null?[]:n).length;let c=Array.from({length:o},()=>new t.Vector2(-1,0)),l=Array.from({length:s},()=>new t.Matrix4),u=0;for(let e of i.layerKeys){let t=i.layerKeyToIndex.get(e);if(t===void 0)continue;let n=(r=a.get(e))==null?[]:r,o=u;for(let e of n)l[u].getInverse(e.clippingBoxMatrix),u++;n.length>0&&c[t].set(o,n.length)}this.material.uniforms.u_layerClipperRanges.value=c,this.material.uniforms.u_clipperMatricesInverse.value=l,this.updateClipperCounts(o,u)}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()}},Lb=class extends t.Mesh{constructor(){super(),this.onBeforeRender=(e,t,n)=>{this.collectObjects(t).length>0&&console.warn(`未开启webgl2, 3dgs仅支持在开启webgl2模式后使用`)}}collectObjects(t){let n=[];return t.traverse(t=>{t instanceof e.t&&t.visible&&n.push(t)}),n}},Rb=1e3,zb=90,Bb=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/`),Vb=new t.Sphere,Hb=new t.Box3,Ub=new t.Vector4,Wb=new t.Vector4,Gb=new t.Color,Kb=new t.Vector2,qb=new WeakMap,Jb=Tm([Sm(null)]),Yb={},Xb=class e extends nn{static get version(){return`6.10.0-alpha.1`}static get dracoPath(){return co.decoderPath}static set dracoPath(e){co.setDecoderPath(e)}static get ktx2Path(){return _o.transcoderPath}static set ktx2Path(e){_o.setTranscoderPath(e)}static get useNativeImageBitmap(){return ii()}static set useNativeImageBitmap(e){ri(e)}constructor(e={}){var n,r,i,a,o,s,c,l,u,d,f;if(super(),this.pbmGaussianSplattingRenderMesh=null,this.fiveId=Zt(),Yb[this.fiveId]=this,this.currentUpdateArgs={time:V(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!1,this.onlyRenderIfNeeds=(n=e.onlyRenderIfNeeds)==null?!0:n,this.imageOptions=Object.assign({},(r=e.imageOptions)==null?{}:r),this.textureOptions=Object.assign({},(i=e.textureOptions)==null?{}:i),this.poweredByRealsee=(a=e.poweredByRealsee)==null?!0:a,this.backgroundColor=new t.Color((o=e.backgroundColor)==null?1579548:o),this.backgroundAlpha=(s=e.backgroundAlpha)==null?1:s,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:V()},this.modeChangeDuration=(c=e.modeChangeDuration)==null?Rb:c,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof Wh&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new Wh({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=qy();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 t.WebGLRenderTarget(1,1,{encoding:(d=(u=this.renderer)==null?void 0:u.outputEncoding)==null?t.sRGBEncoding:d,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new Yt(zb),this.scene=new Zh,this.xrCustomObjectsScene=new t.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.loadWorkTask=Promise.resolve(),this.requestProxy=(f=e.requestProxy)==null?Bb:f,this.networkSubscribe=new ir,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,Q(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new t.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),qb.set(this,Jb),this.modelScene=new Sp({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(Jb,{forceReplaceImmediately:!0});B(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new t.VideoTexture(e.videoInstance||Wy());let m=Gy();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=ei.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,Q(`vr.requestExit`,{}))},g=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,g,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,g,!1)},this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}Uy(this),this.fiveRenderer=new Uh,this.adaptiveLuminancePass=new Xm,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new $m(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGaussianSplattingRenderMesh=new Ib,this.scene.add(this.pbmGaussianSplattingRenderMesh)):this.scene.add(new Lb)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}get panoId(){return Z(this.pano)}dispose(){var e;if(this.destroyed===!0)return;delete Yb[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 n=this.getElement();n&&n.parentNode&&n.parentNode.removeChild(n);let r=this.modelScene.parameter;r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==((e=r.pano0)==null?void 0:e.map)&&r.pano1.map.dispose(),r.reset(`pano0`,`pano1`),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),qb.set(this,Jb),this.renderer&&this.renderer.render(new t.Scene,new t.Camera),this.fiveRenderer.dispose(),this.renderer instanceof Wh&&(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`,Q(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,pr(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,pr(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,pr(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,pr(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,pr(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,pr(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.xrPanorama&&(Object.assign(this.controllerInits.XRPanorama,pr(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 Wh)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i;if(!this.renderer)return;let a=this.renderer.domElement.parentNode,{width:o=(n=a==null?void 0:a.offsetWidth)==null?512:n,height:s=(r=a==null?void 0:a.offsetHeight)==null?512:r}=e;if(o=Math.max(1,o),s=Math.max(1,s),!t){let e=qy(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(o,s)*t,n=Math.min(this.renderer.capabilities.maxTextureSize,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(o,s),this.needsRender=!0;let c=V(),l=c-this.currentUpdateArgs.time,u=this.currentUpdateArgs.args;this.updateTime(c,l,...u)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return qb.get(this)||Jb}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>_g(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(n,r,i,a=!0){var o,s,c,l,u,d,f,p,m,h;let g={};typeof i==`number`?g.duration=i:typeof i==`object`&&Object.assign(g,i),this.works===Jb&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(n))for(let e of n)e instanceof xm?v.push(e):typeof e!=`string`&&`work`in e?v.push(Sm(e.work,e)):v.push(Sm(e));else n instanceof xm?v.push(n):v.push(Sm(n));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=Tm(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);r===void 0&&(r=`inherit`),r===`inherit`&&this.works===Jb&&(r=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(o=x.mode)==null?S?`Panorama`:`Mapview`:o,T={};if(r===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{r={mode:b};let e=(c=(s=y[0])==null?void 0:s.observers)==null?void 0:c[this.panoIndex];e?(r.workCode=e.work.workCode,r.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(r.workCode=y.initial.work.workCode,r.panoIndex=y.initial.panoIndex):(r.mode===`Panorama`||r.mode===`VRPanorama`||r.mode===`XRPanorama`)&&(r.mode=`Mapview`),r.mode===b&&(r.longitude=this.camera.pose.longitude,r.latitude=this.camera.pose.latitude,r.fov=this.camera.pose.fov)}}if(r===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof r==`object`){if(w=(u=r.mode)==null?b:u,typeof r.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=r.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:r.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset?new t.Vector3().copy(r.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;(w===`Panorama`||w===`VRPanorama`||w===`XRPanorama`)&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,Q(`works.request`,{input:n,works:y,userAction:a}));let O=(e,t,n)=>{let i=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),n);r===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:i,duration:E,effect:D,userAction:a}},this.commonParams()),this.controllerInits[e]),c=By[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},a)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=By[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a}))}this.controller=this.applyController(e,s);let t=Q(`mode.change`,{prevMode:b,mode:e,state:c,userAction:a});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};qb.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),Og(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(G),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,Q(`works.load`,{input:n,userAction:a,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,Q(`works.ready`,{input:n,userAction:a,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var n;this.controller&&(this.controller.destroy(),this.controller=void 0);let r=this.modelScene.parameter;r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==((n=r.pano0)==null?void 0:n.map)&&r.pano1.map.dispose(),r.set({pano0:null,pano1:null,modelAlpha:1}),qb.set(this,Jb),this.modelScene.setModels(Jb,{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:zb,longitude:0,latitude:0,offset:new t.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(m)){let e=Error(`PanoId ${Z(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!Bp(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(G):(Bp(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(G));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=By[t].initAnimationEndState(r),o=Q(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=Q(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=ei.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),ei.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),wg().then(()=>_()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),s(t)})):t===e.Mode.XRPanorama?Tg().then(e=>{ei.shared.setContext(e),a=!0,_()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),s(t)}):_()})}getPixels(e,n,r,i,a,o,s){if(!this.renderer)throw Error(`renderer is not initialized.`);let c=V(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new t.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof n==`number`&&(p=n),typeof r==`number`&&(m=r),typeof i==`number`&&(h=i),g=a,_=o,b=s):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&(this.controller instanceof By.Panorama||this.controller instanceof By.VRPanorama||this.controller instanceof By.XRPanorama)&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(c),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=Gb.copy(this.renderer.getClearColor()),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(c),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,te=ee*4;if(b){if(b.length!==te)throw Error(`buffer length is not equals pixels ${te}`)}else b=new Uint8Array(te);if(this.renderer.readRenderTargetPixels(C,0,0,m*g,h*g,b),_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=Gb.copy(t.getClearColor()),c=t.getClearAlpha(),l=t.getViewport(Ub),u=t.getScissor(Wb),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(Kb),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;if(this.controller&&this.controller.render()&&(y=!1),y){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&sb(t)}this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&ei.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&_o.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),ei.shared.add(()=>{this.emit(`models.load`,Q(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&ei.shared.add(()=>{this.emit(`models.refined`,Q(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){Hb.makeEmpty(),Hb.expandByObject(this.modelScene.boundingMesh);let t=Hb.getBoundingSphere(Vb),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius),n=H(n,800);let r=n/1e4;r=H(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=Q(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,Q(`render`,{needsRender:i})),this.hasListener(`fps`)&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit(`fps`,this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof Wh&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=G){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=V();return Promise.all(r.map(e=>{let t=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},dr(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Ur(i,r);return Kf(this.fiveId,n.work).preload(a)})).then(()=>{let e=V()-i;return t(e),e})}project2d(e,n=!1){if(!this.renderer)return null;if(n){let n=this.camera.position,r=e.clone().sub(n),i=new t.Raycaster(n,r.clone().normalize());i.params.Points={threshold:.1};let[a]=this.modelScene.intersectRaycaster(i);if(a&&a.distance+.01<r.length())return null}let r=e.clone().project(this.camera);if(Math.abs(r.z)>1)return null;let i=this.renderer.getSize(new t.Vector2),a=i.x*this.viewport.width,o=i.y*this.viewport.height,s=i.x*this.viewport.left+(r.x+1)/2*a,c=i.y*(1-this.viewport.bottom-this.viewport.height)+(-r.y+1)/2*o;return new t.Vector2(s,c)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,n=!1,r=!0){var i,a,o,s,c,l,u,d,f,p;e=dr(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof t.Vector3)&&(e.offset=new t.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(a=(i=this.work)==null?void 0:i.workCode)==null?``:a,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(o=e.mode)==null?this.state.mode:o,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){if(h===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let n={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(n.longitude=e.longitude),typeof e.latitude==`number`&&(n.latitude=e.latitude),typeof e.fov==`number`&&(n.fov=e.fov),typeof e.distance==`number`&&(n.distance=e.distance),e.offset instanceof t.Vector3&&(n.offset=e.offset);let r=Object.assign(Object.assign({initial:{state:n,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),i=By[h].initAnimationEndState(r);g=i.longitude,_=i.latitude,v=i.fov,y=i.offset,b=i.distance}else g=(s=e.longitude)==null?this.state.longitude:s,_=(c=e.latitude)==null?this.state.latitude:c,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,Q(`state.set`,{userAction:r,state:x})),Dg(this.state,x)||(this.controller&&x.mode===`VRPanorama`&&x.mode!==this.state.mode?(Eg(this.state,x),this.changeMode(`VRPanorama`)):this.controller&&x.mode===`XRPanorama`&&x.mode!==this.state.mode?(Eg(this.state,x),this.changeMode(`XRPanorama`)):(Eg(this.state,x),this.controller&&r&&(this.controller.userAction=!1),n&&this.state.mode===x.mode&&(this.syncingState=this.syncState(V(),0,n),this.syncingState&&((f=this.controller)==null||f.updateTime(V(),0),this.syncingState=!1)),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state)))}syncState(n,r,i=!1){let a=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 By.Model){if(gg(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:i?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!Bp(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 By.Floorplan||this.controller instanceof By.Topview||this.controller instanceof By.Mapview){let e=.2,n=Math.PI/45,r=i?this.state.fov:Um(this.camera.pose.fov,this.state.fov,1),a=Math.abs(this.camera.pose.distance-this.state.distance),o=a>e*15?a/15:.2,s=i?this.state.distance:Um(this.camera.pose.distance,this.state.distance,o),c=this.camera.pose.offset.distanceTo(this.state.offset),l=c>e*15?c/15:e,u=i?new t.Vector3().copy(this.state.offset):Wm(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=i?{longitude:this.state.longitude,latitude:this.state.latitude}:Gm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},n);if(mg(r,this.camera.pose.fov)||gg(u,this.camera.pose.offset)||mg(s,this.camera.pose.distance)||mg(d,this.camera.pose.longitude,Math.PI*2)||mg(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:r};return Object.assign(e,{distance:s}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(G),this.controller.locationMotion.set(e,0).catch(G),!0}}else{let e=Math.PI/45,n=i?this.state.fov:Um(this.camera.pose.fov,this.state.fov,1),{longitude:r,latitude:a}=i?{longitude:this.state.longitude,latitude:this.state.latitude}:Gm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),o=this.state.distance,s=new t.Vector3().copy(this.state.offset);if(mg(o,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),gg(s,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),mg(r,this.camera.pose.longitude,Math.PI*2)||mg(a,this.camera.pose.latitude)||mg(n,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:r,latitude:a,fov:n},0).catch(G),!0}if(this.stateSynced=!0,a===!1&&this.emit(`state.synced`,Q(`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 By.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(G)}requestFullscreen(){var e;if(!bg)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=()=>{ei.shared.add(()=>{this.emit(`model.load`,Q(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,Q(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,Q(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,Q(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,Q(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,Q(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new lr({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=lm(e,r);return t instanceof Error?Promise.reject(t):t})}});qf(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(t,n){if(!this.renderer)throw Error(`renderer is not initialized.`);let r=By[t];this.currentMode=t;let i=new r(n);for(let e of Hy)i.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=By[t].initAnimationEndState(n),r=n.initial.userAction;Dg(this.state,e)||(Eg(this.state,e),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,Q(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return i.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!Dg(this.state,n)&&(Eg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,Q(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),i.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!Dg(this.state,n)&&(Eg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Dg(this.state,n)&&(Eg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Dg(this.state,n)&&(Eg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Dg(this.state,n)&&(Eg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!Dg(this.state,n)&&(Eg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.error`,e=>{var t;let{state:n}=e;this.state.mode===n.mode&&!Dg(this.state,n)&&(Eg(this.state,n),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,Q(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),i.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),i.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),i.on(`error`,e=>this.throwError(e)),i}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let n=new t.Object3D;n.matrix.copy(e.matrix).premultiply(e.work.transform),n.matrix.decompose(n.position,n.quaternion,n.scale),n.matrixAutoUpdate=!1;let r=new t.Vector3(0,0,-1);r.applyQuaternion(this.camera.quaternion);let i=n.quaternion.clone().inverse();return r.applyQuaternion(i),{theta:Math.atan2(r.x,-r.z),phi:-Math.asin(r.y),lookAtVector:r}}}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}};Xb.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`&&Object.assign(window,{__FIVE_DEBUG__:{THREE:t,constructor:Xb,instances:Yb}});var Zb=class{static createButton(e){let t=document.createElement(`button`);function n(){t.style.display=``,t.style.cursor=`pointer`,t.style.left=`calc(50% - 50px)`,t.style.width=`100px`,t.textContent=`ENTER VR`,t.onmouseenter=function(){t.style.opacity=`1.0`},t.onmouseleave=function(){t.style.opacity=`0.5`},t.onclick=function(){e&&e()}}function r(){t.style.display=``,t.style.cursor=`auto`,t.style.left=`calc(50% - 75px)`,t.style.width=`150px`,t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function i(){r(),t.textContent=`VR NOT SUPPORTED`}function a(e){e.style.position=`absolute`,e.style.bottom=`20px`,e.style.padding=`12px 6px`,e.style.border=`1px solid #fff`,e.style.borderRadius=`4px`,e.style.background=`rgba(0,0,0,0.1)`,e.style.color=`#fff`,e.style.font=`normal 13px sans-serif`,e.style.textAlign=`center`,e.style.opacity=`0.5`,e.style.outline=`none`,e.style.zIndex=`999`}if(`xr`in navigator)return t.id=`VRButton`,t.style.display=`none`,a(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():i()}),t;{let e=document.createElement(`a`);return window.isSecureContext===!1?(e.href=document.location.href.replace(/^http:/,`https:`),e.innerHTML=`WEBXR NEEDS HTTPS`):(e.href=`https://immersiveweb.dev/`,e.innerHTML=`WEBXR NOT AVAILABLE`),e.style.left=`calc(50% - 90px)`,e.style.width=`180px`,e.style.textDecoration=`none`,a(e),e}}};exports.AdaptiveLuminancePass=Xm,exports.AnimationFrameLoop=ei,exports.BoundingMesh=bp,exports.Camera=Yt,exports.CustomShader=an,exports.PBMCustomShader=an,exports.EffectComposer=Em,exports.EyeDomeLightingPass=$m,exports.Fetcher=lr,exports.Five=Xb,exports.FivePass=Om,exports.FiveRenderer=Uh,exports.FlowingFireworks3DPass=Th,exports.FlowingLight2DPass=uh,exports.FlowingLight3DPass=hh,exports.FullScreenQuad=Dm,exports.GaussianBlurPass=nh,exports.Histogram=Bm,exports.InternalWebGLRenderer=Wh,exports.Model=dp,exports.ModelScene=Sp,exports.Motion=X,exports.NetworkSubscribe=ir,exports.PBMContainer=Wn,exports.PBMGSObject=e.t,exports.PBMGroup=vt,exports.PBMMesh=mn,exports.PBMMeshMaterial=pn,exports.PBMPanoFilter=on,exports.PBMPointCloud=wn,exports.PBMPointCloudMaterial=Cn,exports.PBMSkinnedMesh=hn,exports.PBMUpdateable=rn,exports.PROXY_CONTROLLER_EVENT_NAMES=Hy,exports.PanoCircleMesh=ng,exports.PanoCircleMeshCustom=fg,exports.PanoCircleMeshSolid=sg,exports.Parameter=W,exports.Scene=Zh,exports.Subscribe=nn,exports.TextureLoader=fi,exports.Tile=gu,exports.Tile3D=Wf,exports.Tile3DModel=Wf,exports.TileCache=Ud,exports.TileNode=jd,exports.TileRequestScheduler=Bd,exports.Tileset=Yd,exports.Trajectory=Id,exports.TrajectoryNode=Ld,exports.Work=xm,exports.WorkResolvedObserver=wm,exports.XRButton=Zb,exports.controllersDefaultInitArgs=Vy,exports.coordinatesToVector=It,exports.createDebugBoundingMesh=du,exports.createWorks=Tm,exports.defaultImageURLTransform=Ur,exports.draco=co,exports.getViewportScale=qy,exports.headingToLongitude=zt,exports.imageSupport=Er,exports.isBoundingVolume=ou,exports.isPanoId=Vp,exports.ktx2=_o,exports.loadAt3d=ca,exports.loadB3dm=Ws,exports.loadDome=fa,exports.loadDomez=ya,exports.loadFbx=al,exports.loadGltf=$s,exports.loadObj=Ji,exports.loadPbm=ki,exports.loadPly=tc,exports.loadPnts=Zs,exports.loadSpz=Is,exports.loadX3p=zl,exports.longitudeToHeading=Rt,exports.makeBoundingVolume=su,exports.panoEqual=Bp,exports.panoParse=zp,exports.panoStringify=Z,exports.parseWork=Sm,exports.vectorToCoordinates=Lt,exports.workToJson=Dp;
|
|
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)}))})();`,kb=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Ob],{type:`text/javascript;charset=utf-8`});function Ab(e){let t;try{if(t=kb&&(self.URL||self.webkitURL).createObjectURL(kb),!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(Ob),{name:e==null?void 0:e.name})}}var jb=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{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"),Mb=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`}rpvv|{-uvtu}-sy|nH0v{pyqr-Ip|zz|{Kn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH|vq-znv{-56-
|
|
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`),Nb=new t.Vector3,Pb=new t.Vector3,Fb=new t.Quaternion,Ib=new t.Quaternion,Lb=new t.Vector3,Rb=class extends t.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,n,r)=>{let i=r,a=this.collectObjects(n);if(a.length===0){this.geometry.instanceCount=0;return}let o=0,s=!1;for(let e of a)e.usedSHDegree>o&&(o=e.usedSHDegree),e.initAnimationEnabled&&(s=!0);let c=o!==this.usedSHDegree;this.usedSHDegree=o,this.updateInitAnimationDefine(s),this.isSceneChanged(a)?this.rebuild(e,a):c&&this.updateSH(a);for(let e of a)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 l=new t.Matrix4().multiplyMatrices(i.perspectiveProjectionMatrix,i.matrixWorldInverse);this.requestSort(i,l.elements),(this.orderDirty||this.layoutDirty)&&(this.runReorder(e),this.orderDirty=!1,this.layoutDirty=!1);let u=a.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(`|`);u!==this.lastClipperHash&&(this.updateClipperUniforms(a),this.lastClipperHash=u,this.needsRender=!0),this.material.uniforms.resolution.value.set(i.resolution.x,i.resolution.y)},this.geometry=this.createGeometry(),this.material=this.createMaterial(),this.orderTexture=new ub,this.assembler=new hb,this.reorderPass=new Db,this.transformStore=new vb,this.objectParamsStore=new xb,this.layerRegistry=new Sb,this.shStore=new Tb,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 Ab,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 t.InstancedBufferGeometry,n=new Float32Array([-2,-2,0,2,-2,0,2,2,0,-2,2,0]);e.setAttribute(`position`,new t.BufferAttribute(n,3)),e.setIndex(new t.BufferAttribute(new Uint16Array([0,1,2,0,2,3]),1)),this.splatIndexCapacity=1;let r=new Float32Array(this.splatIndexCapacity),i=new t.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(t.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}ensureSplatIndexCapacity(e){let n=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return n;let r=Math.max(this.splatIndexCapacity,1);for(;r<e;)r*=2;let i=new Float32Array(r);i.set(n.array.subarray(0,Math.min(n.array.length,r)));let a=new t.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(t.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=r,this.geometry._maxInstanceCount=r,a}createMaterial(){return new t.ShaderMaterial({vertexShader:jb,fragmentShader:Mb,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 t.Vector2},u_maxShDegree:{value:0},resolution:{value:new t.Vector2},u_aggregationProgress:{value:0},u_aggregationBoundsMin:{value:new t.Vector3(0,0,0)},u_aggregationBoundsMax:{value:new t.Vector3(0,0,0)},u_aggregationPointDuration:{value:.6},u_objectParams:{value:null}},side:t.DoubleSide,transparent:!0,blending:t.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 i=this.snapshotByGen.get(t);if(i){this.orderBaseSnapshot=i;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),i=e===void 0,a=i?0:e-t.start,o=r[r.length-1];o&&o.removed===i&&(i||o.delta===a)&&o.oldEnd===t.start?o.oldEnd=t.start+t.count:r.push({oldStart:t.start,oldEnd:t.start+t.count,delta:a,removed:i})}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,i=Math.max(1,Math.ceil(this.orderCount/r));this.orderTarget?(this.orderTarget.width!==r||this.orderTarget.height<i)&&this.orderTarget.setSize(r,Math.max(this.orderTarget.height,i)):this.orderTarget=Db.createOrderTarget(r,i),this.reorderPass.run(e,this.orderTexture.texture,r,this.orderTarget,n);let a=0;for(let e of t)a+=e.count;this.material.uniforms.u_orderTexture.value=this.orderTarget.texture,this.material.uniforms.u_orderWidth.value=r,this.material.uniforms.u_numPoints.value=a}postSortData(){var e;let t=++this.sortGeneration;this.snapshotByGen.set(t,this.snapshotLayout());let{positions:n,transformIndices:r,count:i}=this.assembler.extractSortInputs(),a=this.transformStore.transforms.slice(0,this.transformStore.objectCount*20);(e=this.sortWorker)==null||e.postMessage({sortData:{positions:n,transforms:a,transformIndices:r,vertexCount:i,generation:t}},[n.buffer,a.buffer,r.buffer]),this.sortDataUploaded=!0,this.transformsDirty=!1}shouldSort(e){if(this.transformsDirty||!this.sortDataUploaded||!this.prevSortCameraMatrix)return!0;this.prevSortCameraMatrix.decompose(Nb,Fb,Lb),e.matrixWorld.decompose(Pb,Ib,Lb);let t=Nb.distanceTo(Pb),n=Math.abs(Fb.dot(Ib));return t>this.sortCameraDistance||n<this.sortCameraCoorient}requestSort(e,n){var r;!this.assembler||this.assembler.totalPoints===0||this.shouldSort(e)&&(performance.now()-this.sortLastTime<this.sortMinIntervalMs||((this.transformsDirty||!this.sortDataUploaded)&&this.postSortData(),(r=this.sortWorker)==null||r.postMessage({viewProj:n}),this.prevSortCameraMatrix||(this.prevSortCameraMatrix=new t.Matrix4),this.prevSortCameraMatrix.copy(e.matrixWorld),this.sortLastTime=performance.now()))}collectObjects(t){let n=[];return t.traverse(t=>{t instanceof e.t&&t.visible&&n.push(t)}),n.sort((e,t)=>{let n=e.uuid+e.gsViewLayerKey,r=t.uuid+t.gsViewLayerKey;return n<r?-1:+(n>r)}),n}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 n,r;let i=this.layerRegistry;if(!i||i.layerCount===0){this.material.uniforms.u_layerClipperRanges.value=[],this.material.uniforms.u_clipperMatricesInverse.value=[],this.updateClipperCounts(0,0);return}let a=new Map;for(let t of e)a.has(t.gsViewLayerKey)||a.set(t.gsViewLayerKey,t.gsClippers);let o=i.layerKeys.length,s=0;for(let e of i.layerKeys)s+=((n=a.get(e))==null?[]:n).length;let c=Array.from({length:o},()=>new t.Vector2(-1,0)),l=Array.from({length:s},()=>new t.Matrix4),u=0;for(let e of i.layerKeys){let t=i.layerKeyToIndex.get(e);if(t===void 0)continue;let n=(r=a.get(e))==null?[]:r,o=u;for(let e of n)l[u].getInverse(e.clippingBoxMatrix),u++;n.length>0&&c[t].set(o,n.length)}this.material.uniforms.u_layerClipperRanges.value=c,this.material.uniforms.u_clipperMatricesInverse.value=l,this.updateClipperCounts(o,u)}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()}},zb=class extends t.Mesh{constructor(){super(),this.onBeforeRender=(e,t,n)=>{this.collectObjects(t).length>0&&console.warn(`未开启webgl2, 3dgs仅支持在开启webgl2模式后使用`)}}collectObjects(t){let n=[];return t.traverse(t=>{t instanceof e.t&&t.visible&&n.push(t)}),n}},Bb=1e3,Vb=90,Hb=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/`),Ub=new t.Sphere,Wb=new t.Box3,Gb=new t.Vector4,Kb=new t.Vector4,qb=new t.Color,Jb=new t.Vector2,Yb=new WeakMap,Xb=Dm([wm(null)]),Zb={},Qb=class e extends nn{static get version(){return`6.10.0-alpha.3`}static get dracoPath(){return co.decoderPath}static set dracoPath(e){co.setDecoderPath(e)}static get ktx2Path(){return _o.transcoderPath}static set ktx2Path(e){_o.setTranscoderPath(e)}static get useNativeImageBitmap(){return ii()}static set useNativeImageBitmap(e){ri(e)}constructor(e={}){var n,r,i,a,o,s,c,l,u,d,f;if(super(),this.pbmGaussianSplattingRenderMesh=null,this.fiveId=Zt(),Zb[this.fiveId]=this,this.currentUpdateArgs={time:V(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!1,this.onlyRenderIfNeeds=(n=e.onlyRenderIfNeeds)==null?!0:n,this.imageOptions=Object.assign({},(r=e.imageOptions)==null?{}:r),this.textureOptions=Object.assign({},(i=e.textureOptions)==null?{}:i),this.poweredByRealsee=(a=e.poweredByRealsee)==null?!0:a,this.backgroundColor=new t.Color((o=e.backgroundColor)==null?1579548:o),this.backgroundAlpha=(s=e.backgroundAlpha)==null?1:s,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:V()},this.modeChangeDuration=(c=e.modeChangeDuration)==null?Bb:c,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof Kh&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new Kh({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=Yy();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 t.WebGLRenderTarget(1,1,{encoding:(d=(u=this.renderer)==null?void 0:u.outputEncoding)==null?t.sRGBEncoding:d,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new Yt(Vb),this.scene=new $h,this.xrCustomObjectsScene=new t.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.loadWorkTask=Promise.resolve(),this.requestProxy=(f=e.requestProxy)==null?Hb:f,this.networkSubscribe=new ir,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,Q(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new t.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),Yb.set(this,Xb),this.modelScene=new Sp({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(Xb,{forceReplaceImmediately:!0});B(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new t.VideoTexture(e.videoInstance||Ky());let m=qy();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=ei.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,Q(`vr.requestExit`,{}))},g=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,g,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,g,!1)},this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}Gy(this),this.fiveRenderer=new Gh,this.adaptiveLuminancePass=new Qm,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new th(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGaussianSplattingRenderMesh=new Rb,this.scene.add(this.pbmGaussianSplattingRenderMesh)):this.scene.add(new zb)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}get panoId(){return Z(this.pano)}dispose(){var e;if(this.destroyed===!0)return;delete Zb[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 n=this.getElement();n&&n.parentNode&&n.parentNode.removeChild(n);let r=this.modelScene.parameter;r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==((e=r.pano0)==null?void 0:e.map)&&r.pano1.map.dispose(),r.reset(`pano0`,`pano1`),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),Yb.set(this,Xb),this.renderer&&this.renderer.render(new t.Scene,new t.Camera),this.fiveRenderer.dispose(),this.renderer instanceof Kh&&(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`,Q(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,pr(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,pr(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,pr(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,pr(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,pr(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,pr(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.xrPanorama&&(Object.assign(this.controllerInits.XRPanorama,pr(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 Kh)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i;if(!this.renderer)return;let a=this.renderer.domElement.parentNode,{width:o=(n=a==null?void 0:a.offsetWidth)==null?512:n,height:s=(r=a==null?void 0:a.offsetHeight)==null?512:r}=e;if(o=Math.max(1,o),s=Math.max(1,s),!t){let e=Yy(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(o,s)*t,n=Math.min(this.renderer.capabilities.maxTextureSize,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(o,s),this.needsRender=!0;let c=V(),l=c-this.currentUpdateArgs.time,u=this.currentUpdateArgs.args;this.updateTime(c,l,...u)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return Yb.get(this)||Xb}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>yg(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(n,r,i,a=!0){var o,s,c,l,u,d,f,p,m,h;let g={};typeof i==`number`?g.duration=i:typeof i==`object`&&Object.assign(g,i),this.works===Xb&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(n))for(let e of n)e instanceof Cm?v.push(e):typeof e!=`string`&&`work`in e?v.push(wm(e.work,e)):v.push(wm(e));else n instanceof Cm?v.push(n):v.push(wm(n));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=Dm(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);r===void 0&&(r=`inherit`),r===`inherit`&&this.works===Xb&&(r=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(o=x.mode)==null?S?`Panorama`:`Mapview`:o,T={};if(r===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{r={mode:b};let e=(c=(s=y[0])==null?void 0:s.observers)==null?void 0:c[this.panoIndex];e?(r.workCode=e.work.workCode,r.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(r.workCode=y.initial.work.workCode,r.panoIndex=y.initial.panoIndex):(r.mode===`Panorama`||r.mode===`VRPanorama`||r.mode===`XRPanorama`)&&(r.mode=`Mapview`),r.mode===b&&(r.longitude=this.camera.pose.longitude,r.latitude=this.camera.pose.latitude,r.fov=this.camera.pose.fov)}}if(r===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof r==`object`){if(w=(u=r.mode)==null?b:u,typeof r.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=r.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:r.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset?new t.Vector3().copy(r.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;(w===`Panorama`||w===`VRPanorama`||w===`XRPanorama`)&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,Q(`works.request`,{input:n,works:y,userAction:a}));let O=(e,t,n)=>{let i=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),n);r===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:i,duration:E,effect:D,userAction:a}},this.commonParams()),this.controllerInits[e]),c=Hy[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},a)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=Hy[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a}))}this.controller=this.applyController(e,s);let t=Q(`mode.change`,{prevMode:b,mode:e,state:c,userAction:a});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};Yb.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),Ag(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(G),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,Q(`works.load`,{input:n,userAction:a,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,Q(`works.ready`,{input:n,userAction:a,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var n;this.controller&&(this.controller.destroy(),this.controller=void 0);let r=this.modelScene.parameter;r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==((n=r.pano0)==null?void 0:n.map)&&r.pano1.map.dispose(),r.set({pano0:null,pano1:null,modelAlpha:1}),Yb.set(this,Xb),this.modelScene.setModels(Xb,{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:Vb,longitude:0,latitude:0,offset:new t.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(m)){let e=Error(`PanoId ${Z(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!Bp(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(G):(Bp(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(G));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=Hy[t].initAnimationEndState(r),o=Q(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=Q(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=ei.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),ei.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),Eg().then(()=>_()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),s(t)})):t===e.Mode.XRPanorama?Dg().then(e=>{ei.shared.setContext(e),a=!0,_()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),s(t)}):_()})}getPixels(e,n,r,i,a,o,s){if(!this.renderer)throw Error(`renderer is not initialized.`);let c=V(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new t.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof n==`number`&&(p=n),typeof r==`number`&&(m=r),typeof i==`number`&&(h=i),g=a,_=o,b=s):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&(this.controller instanceof Hy.Panorama||this.controller instanceof Hy.VRPanorama||this.controller instanceof Hy.XRPanorama)&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(c),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=qb.copy(this.renderer.getClearColor()),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(c),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,te=ee*4;if(b){if(b.length!==te)throw Error(`buffer length is not equals pixels ${te}`)}else b=new Uint8Array(te);if(this.renderer.readRenderTargetPixels(C,0,0,m*g,h*g,b),_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=qb.copy(t.getClearColor()),c=t.getClearAlpha(),l=t.getViewport(Gb),u=t.getScissor(Kb),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(Jb),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;if(this.controller&&this.controller.render()&&(y=!1),y){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&lb(t)}this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&ei.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&_o.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),ei.shared.add(()=>{this.emit(`models.load`,Q(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&ei.shared.add(()=>{this.emit(`models.refined`,Q(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){Wb.makeEmpty(),Wb.expandByObject(this.modelScene.boundingMesh);let t=Wb.getBoundingSphere(Ub),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius),n=H(n,800);let r=n/1e4;r=H(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=Q(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,Q(`render`,{needsRender:i})),this.hasListener(`fps`)&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit(`fps`,this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof Kh&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=G){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=V();return Promise.all(r.map(e=>{let t=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},dr(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Ur(i,r);return Kf(this.fiveId,n.work).preload(a)})).then(()=>{let e=V()-i;return t(e),e})}project2d(e,n=!1){if(!this.renderer)return null;if(n){let n=this.camera.position,r=e.clone().sub(n),i=new t.Raycaster(n,r.clone().normalize());i.params.Points={threshold:.1};let[a]=this.modelScene.intersectRaycaster(i);if(a&&a.distance+.01<r.length())return null}let r=e.clone().project(this.camera);if(Math.abs(r.z)>1)return null;let i=this.renderer.getSize(new t.Vector2),a=i.x*this.viewport.width,o=i.y*this.viewport.height,s=i.x*this.viewport.left+(r.x+1)/2*a,c=i.y*(1-this.viewport.bottom-this.viewport.height)+(-r.y+1)/2*o;return new t.Vector2(s,c)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,n=!1,r=!0){var i,a,o,s,c,l,u,d,f,p;e=dr(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof t.Vector3)&&(e.offset=new t.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(a=(i=this.work)==null?void 0:i.workCode)==null?``:a,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(o=e.mode)==null?this.state.mode:o,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){if(h===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let n={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(n.longitude=e.longitude),typeof e.latitude==`number`&&(n.latitude=e.latitude),typeof e.fov==`number`&&(n.fov=e.fov),typeof e.distance==`number`&&(n.distance=e.distance),e.offset instanceof t.Vector3&&(n.offset=e.offset);let r=Object.assign(Object.assign({initial:{state:n,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),i=Hy[h].initAnimationEndState(r);g=i.longitude,_=i.latitude,v=i.fov,y=i.offset,b=i.distance}else g=(s=e.longitude)==null?this.state.longitude:s,_=(c=e.latitude)==null?this.state.latitude:c,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,Q(`state.set`,{userAction:r,state:x})),kg(this.state,x)||(this.controller&&x.mode===`VRPanorama`&&x.mode!==this.state.mode?(Og(this.state,x),this.changeMode(`VRPanorama`)):this.controller&&x.mode===`XRPanorama`&&x.mode!==this.state.mode?(Og(this.state,x),this.changeMode(`XRPanorama`)):(Og(this.state,x),this.controller&&r&&(this.controller.userAction=!1),n&&this.state.mode===x.mode&&(this.syncingState=this.syncState(V(),0,n),this.syncingState&&((f=this.controller)==null||f.updateTime(V(),0),this.syncingState=!1)),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state)))}syncState(n,r,i=!1){let a=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 Hy.Model){if(vg(this.camera.pose.offset,this.state.offset)||gg(this.camera.pose.distance,this.state.distance)){let e={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPosition(this.state.offset,Object.assign(Object.assign({},e),{duration:i?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!Bp(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 Hy.Floorplan||this.controller instanceof Hy.Topview||this.controller instanceof Hy.Mapview){let e=.2,n=Math.PI/45,r=i?this.state.fov:Gm(this.camera.pose.fov,this.state.fov,1),a=Math.abs(this.camera.pose.distance-this.state.distance),o=a>e*15?a/15:.2,s=i?this.state.distance:Gm(this.camera.pose.distance,this.state.distance,o),c=this.camera.pose.offset.distanceTo(this.state.offset),l=c>e*15?c/15:e,u=i?new t.Vector3().copy(this.state.offset):Km(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=i?{longitude:this.state.longitude,latitude:this.state.latitude}:qm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},n);if(gg(r,this.camera.pose.fov)||vg(u,this.camera.pose.offset)||gg(s,this.camera.pose.distance)||gg(d,this.camera.pose.longitude,Math.PI*2)||gg(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:r};return Object.assign(e,{distance:s}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(G),this.controller.locationMotion.set(e,0).catch(G),!0}}else{let e=Math.PI/45,n=i?this.state.fov:Gm(this.camera.pose.fov,this.state.fov,1),{longitude:r,latitude:a}=i?{longitude:this.state.longitude,latitude:this.state.latitude}:qm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),o=this.state.distance,s=new t.Vector3().copy(this.state.offset);if(gg(o,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),vg(s,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),gg(r,this.camera.pose.longitude,Math.PI*2)||gg(a,this.camera.pose.latitude)||gg(n,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:r,latitude:a,fov:n},0).catch(G),!0}if(this.stateSynced=!0,a===!1&&this.emit(`state.synced`,Q(`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 Hy.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(G)}requestFullscreen(){var e;if(!Sg)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=()=>{ei.shared.add(()=>{this.emit(`model.load`,Q(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,Q(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,Q(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,Q(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,Q(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,Q(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new lr({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=lm(e,r);return t instanceof Error?Promise.reject(t):t})}});qf(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(t,n){if(!this.renderer)throw Error(`renderer is not initialized.`);let r=Hy[t];this.currentMode=t;let i=new r(n);for(let e of Wy)i.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=Hy[t].initAnimationEndState(n),r=n.initial.userAction;kg(this.state,e)||(Og(this.state,e),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,Q(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return i.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!kg(this.state,n)&&(Og(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,Q(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),i.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!kg(this.state,n)&&(Og(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kg(this.state,n)&&(Og(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kg(this.state,n)&&(Og(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!kg(this.state,n)&&(Og(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!kg(this.state,n)&&(Og(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.error`,e=>{var t;let{state:n}=e;this.state.mode===n.mode&&!kg(this.state,n)&&(Og(this.state,n),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,Q(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),i.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),i.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),i.on(`error`,e=>this.throwError(e)),i}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let n=new t.Object3D;n.matrix.copy(e.matrix).premultiply(e.work.transform),n.matrix.decompose(n.position,n.quaternion,n.scale),n.matrixAutoUpdate=!1;let r=new t.Vector3(0,0,-1);r.applyQuaternion(this.camera.quaternion);let i=n.quaternion.clone().inverse();return r.applyQuaternion(i),{theta:Math.atan2(r.x,-r.z),phi:-Math.asin(r.y),lookAtVector:r}}}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}};Qb.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`&&Object.assign(window,{__FIVE_DEBUG__:{THREE:t,constructor:Qb,instances:Zb}});var $b=class{static createButton(e){let t=document.createElement(`button`);function n(){t.style.display=``,t.style.cursor=`pointer`,t.style.left=`calc(50% - 50px)`,t.style.width=`100px`,t.textContent=`ENTER VR`,t.onmouseenter=function(){t.style.opacity=`1.0`},t.onmouseleave=function(){t.style.opacity=`0.5`},t.onclick=function(){e&&e()}}function r(){t.style.display=``,t.style.cursor=`auto`,t.style.left=`calc(50% - 75px)`,t.style.width=`150px`,t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function i(){r(),t.textContent=`VR NOT SUPPORTED`}function a(e){e.style.position=`absolute`,e.style.bottom=`20px`,e.style.padding=`12px 6px`,e.style.border=`1px solid #fff`,e.style.borderRadius=`4px`,e.style.background=`rgba(0,0,0,0.1)`,e.style.color=`#fff`,e.style.font=`normal 13px sans-serif`,e.style.textAlign=`center`,e.style.opacity=`0.5`,e.style.outline=`none`,e.style.zIndex=`999`}if(`xr`in navigator)return t.id=`VRButton`,t.style.display=`none`,a(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():i()}),t;{let e=document.createElement(`a`);return window.isSecureContext===!1?(e.href=document.location.href.replace(/^http:/,`https:`),e.innerHTML=`WEBXR NEEDS HTTPS`):(e.href=`https://immersiveweb.dev/`,e.innerHTML=`WEBXR NOT AVAILABLE`),e.style.left=`calc(50% - 90px)`,e.style.width=`180px`,e.style.textDecoration=`none`,a(e),e}}};exports.AdaptiveLuminancePass=Qm,exports.AnimationFrameLoop=ei,exports.BoundingMesh=bp,exports.Camera=Yt,exports.CustomShader=an,exports.PBMCustomShader=an,exports.EffectComposer=Om,exports.EyeDomeLightingPass=th,exports.Fetcher=lr,exports.Five=Qb,exports.FivePass=Am,exports.FiveRenderer=Gh,exports.FlowingFireworks3DPass=Dh,exports.FlowingLight2DPass=fh,exports.FlowingLight3DPass=_h,exports.FullScreenQuad=km,exports.GaussianBlurPass=ih,exports.Histogram=Hm,exports.InternalWebGLRenderer=Kh,exports.Model=dp,exports.ModelScene=Sp,exports.Motion=X,exports.NetworkSubscribe=ir,exports.PBMContainer=Wn,exports.PBMGSObject=e.t,exports.PBMGroup=vt,exports.PBMMesh=mn,exports.PBMMeshMaterial=pn,exports.PBMPanoFilter=on,exports.PBMPointCloud=wn,exports.PBMPointCloudMaterial=Cn,exports.PBMSkinnedMesh=hn,exports.PBMUpdateable=rn,exports.PROXY_CONTROLLER_EVENT_NAMES=Wy,exports.PanoCircleMesh=ig,exports.PanoCircleMeshCustom=mg,exports.PanoCircleMeshSolid=lg,exports.Parameter=W,exports.Scene=$h,exports.Subscribe=nn,exports.TextureLoader=fi,exports.Tile=gu,exports.Tile3D=Wf,exports.Tile3DModel=Wf,exports.TileCache=Ud,exports.TileNode=jd,exports.TileRequestScheduler=Bd,exports.Tileset=Yd,exports.Trajectory=Id,exports.TrajectoryNode=Ld,exports.Work=Cm,exports.WorkResolvedObserver=Em,exports.XRButton=$b,exports.controllersDefaultInitArgs=Uy,exports.coordinatesToVector=It,exports.createDebugBoundingMesh=du,exports.createWorks=Dm,exports.defaultImageURLTransform=Ur,exports.draco=co,exports.getViewportScale=Yy,exports.headingToLongitude=zt,exports.imageSupport=Er,exports.isBoundingVolume=ou,exports.isPanoId=Vp,exports.ktx2=_o,exports.loadAt3d=ca,exports.loadB3dm=Ws,exports.loadDome=fa,exports.loadDomez=ya,exports.loadFbx=al,exports.loadGltf=$s,exports.loadObj=Ji,exports.loadPbm=ki,exports.loadPly=tc,exports.loadPnts=Zs,exports.loadSpz=Is,exports.loadX3p=zl,exports.longitudeToHeading=Rt,exports.makeBoundingVolume=su,exports.panoEqual=Bp,exports.panoParse=zp,exports.panoStringify=Z,exports.parseWork=wm,exports.vectorToCoordinates=Lt,exports.workToJson=Dp;
|