@realsee/five 6.0.0-alpha.7 → 6.0.0-alpha.71
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/TERMS.txt +0 -2
- package/docs/assets/highlight.css +20 -20
- package/docs/assets/main.js +59 -52
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +805 -825
- package/docs/classes/five.AnimationFrameLoop.html +16 -15
- package/docs/classes/five.BoxBoundingVolume.html +18 -1
- package/docs/classes/five.Camera.html +37 -11
- package/docs/classes/five.CullingVolume.html +10 -1
- package/docs/classes/five.Fetcher.html +5 -0
- package/docs/classes/five.Five.html +237 -287
- package/docs/classes/five.InternalWebGLRenderer.html +2 -1
- package/docs/classes/five.IntersectMesh.html +4 -1
- package/docs/classes/five.Model.html +62 -55
- package/docs/classes/five.NetworkAbortError.html +2 -0
- package/docs/classes/five.NetworkFirbiddenError.html +2 -0
- package/docs/classes/five.NetworkResponseError.html +3 -0
- package/docs/classes/five.NetworkSubscribe.html +42 -56
- package/docs/classes/five.NetworkTimeoutError.html +2 -0
- package/docs/classes/five.PBMContainer.html +12 -13
- package/docs/classes/five.PBMGroup.html +3 -3
- package/docs/classes/five.PBMMesh.html +4 -5
- package/docs/classes/five.PBMMeshMaterial.html +50 -45
- package/docs/classes/five.PanoCircleMesh.html +30 -7
- package/docs/classes/five.PanoCircleMeshCustom.html +30 -7
- package/docs/classes/five.PanoCircleMeshSolid.html +30 -7
- package/docs/classes/five.RegionBoundingVolume.html +21 -1
- package/docs/classes/five.RequestScheduler.html +13 -12
- package/docs/classes/five.Scene.html +5 -3
- package/docs/classes/five.SphereBoundingVolume.html +17 -1
- package/docs/classes/five.Subscribe.html +43 -62
- package/docs/classes/five.TextureLoader.html +5 -1
- package/docs/classes/five.Tile.html +30 -1
- package/docs/classes/five.Tile3DModel.html +28 -1
- package/docs/classes/five.TileCubeTextureTarget.html +9 -1
- package/docs/classes/five.TileNode.html +4 -1
- package/docs/classes/five.Tileset.html +31 -5
- package/docs/classes/five.TilesetCache.html +8 -1
- package/docs/classes/five.TilesetTraverser.html +19 -1
- package/docs/classes/five.Work.html +28 -28
- package/docs/classes/five.XRButton.html +3 -1
- package/docs/classes/gltf_loader.DDSLoader.html +3 -1
- package/docs/classes/gltf_loader.DRACOLoader.html +8 -1
- package/docs/classes/gltf_loader.GLTFLoader.html +18 -17
- package/docs/classes/gltf_loader.GLTFObject.html +8 -6
- package/docs/classes/gltf_loader.GLTFParser.html +6 -1
- package/docs/classes/gltf_loader.THREEGLTFLoader.html +8 -1
- package/docs/classes/line.Line.html +10 -1
- package/docs/classes/line.LineGeometry.html +14 -1
- package/docs/classes/line.LineMaterial.html +8 -1
- package/docs/classes/line.LineSegmentsGeometry.html +12 -1
- package/docs/classes/line.THREE_Line2.html +4 -1
- package/docs/classes/line.THREE_LineSegments2.html +4 -1
- package/docs/classes/react.Store.html +23 -29
- package/docs/classes/sticker.Sticker.html +25 -32
- package/docs/classes/vfx.Airflow.html +8 -1
- package/docs/classes/vfx.Flame.html +10 -1
- package/docs/classes/vfx.Particle.html +79 -82
- package/docs/classes/vfx.SpotLight.html +7 -1
- package/docs/enums/five.VolumePlaneIntersect.html +4 -1
- package/docs/functions/five.defaultImageURLTransform.html +5 -0
- package/docs/functions/five.getViewportScale.html +1 -0
- package/docs/functions/five.imageSupport.html +1 -0
- package/docs/functions/five.isPanoId.html +1 -0
- package/docs/functions/five.loadAt3d.html +1 -0
- package/docs/functions/five.loadB3dm.html +1 -0
- package/docs/functions/five.loadDome.html +1 -0
- package/docs/functions/five.loadDomez.html +1 -0
- package/docs/functions/five.loadPbm.html +1 -0
- package/docs/functions/five.loadPnts.html +1 -0
- package/docs/functions/five.panoEqual.html +1 -0
- package/docs/functions/five.panoParse.html +1 -0
- package/docs/functions/five.panoStringify.html +1 -0
- package/docs/functions/five.parseWork.html +7 -0
- package/docs/functions/react.FiveCanvas-1.html +6 -0
- package/docs/functions/react.createFiveFeature.html +1 -0
- package/docs/functions/react.createFiveProvider.html +9 -0
- package/docs/functions/react.createStore.html +15 -0
- package/docs/functions/react.unsafe__useFiveInstance.html +5 -0
- package/docs/functions/react.useFiveAction.html +19 -0
- package/docs/functions/react.useFiveCameraDirection.html +3 -0
- package/docs/functions/react.useFiveCameraRaycaster.html +3 -0
- package/docs/functions/react.useFiveCurrentObserver.html +5 -0
- package/docs/functions/react.useFiveCurrentState.html +5 -0
- package/docs/functions/react.useFiveEventCallback.html +5 -0
- package/docs/functions/react.useFiveFloor.html +5 -0
- package/docs/functions/react.useFiveHelper.html +5 -0
- package/docs/functions/react.useFiveModelIntersectRaycaster.html +7 -0
- package/docs/functions/react.useFiveModelReadyState.html +4 -0
- package/docs/functions/react.useFiveProject2d.html +7 -0
- package/docs/functions/react.useFiveScene.html +2 -0
- package/docs/functions/react.useFiveSceneEffect.html +5 -0
- package/docs/functions/react.useFiveState.html +1 -0
- package/docs/functions/react.useFiveWork.html +8 -0
- package/docs/functions/react.withFive.html +1 -0
- package/docs/functions/vue.unsafe__useFiveInject.html +5 -0
- package/docs/functions/vue.useFiveAction.html +25 -0
- package/docs/functions/vue.useFiveCameraDirection.html +3 -0
- package/docs/functions/vue.useFiveCameraRaycaster.html +3 -0
- package/docs/functions/vue.useFiveCurrentObserver.html +5 -0
- package/docs/functions/vue.useFiveCurrentState.html +5 -0
- package/docs/functions/vue.useFiveEventCallback.html +5 -0
- package/docs/functions/vue.useFiveFloor.html +5 -0
- package/docs/functions/vue.useFiveHelper.html +5 -0
- package/docs/functions/vue.useFiveModel.html +2 -0
- package/docs/functions/vue.useFiveModelBounding.html +2 -0
- package/docs/functions/vue.useFiveModelIntersectRaycaster.html +7 -0
- package/docs/functions/vue.useFiveModelReadyState.html +4 -0
- package/docs/functions/vue.useFiveProject2d.html +7 -0
- package/docs/functions/vue.useFiveScene.html +2 -0
- package/docs/functions/vue.useFiveState.html +5 -0
- package/docs/functions/vue.useFiveWorks.html +8 -0
- package/docs/index.html +35 -79
- package/docs/interfaces/five.AddableObject.html +9 -9
- package/docs/interfaces/five.AjaxOptions.html +11 -0
- package/docs/interfaces/five.AnimationFrame.html +5 -1
- package/docs/interfaces/five.BaseEvent.html +5 -1
- package/docs/interfaces/five.BoundingVolume.html +14 -1
- package/docs/interfaces/five.CameraPose.html +6 -1
- package/docs/interfaces/five.ClipperParameter.html +3 -1
- package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +25 -25
- package/docs/interfaces/five.EventCallback.html +355 -452
- package/docs/interfaces/five.FiveInitArgs.html +84 -86
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +17 -15
- package/docs/interfaces/five.GestureEvent.html +19 -1
- package/docs/interfaces/five.ImageOptions.html +16 -18
- package/docs/interfaces/five.ImageURLMappings.html +1 -1
- package/docs/interfaces/five.ImageURLOptions.html +15 -15
- package/docs/interfaces/five.IntersectEvent.html +8 -1
- package/docs/interfaces/five.IntersectMeshInterface.html +3 -3
- package/docs/interfaces/five.Intersection.html +3 -7
- package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +13 -11
- package/docs/interfaces/five.ModeChangeEvent.html +9 -1
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +18 -18
- package/docs/interfaces/five.ModelEvent.html +8 -1
- package/docs/interfaces/five.ModelLodOptions.html +2 -1
- package/docs/interfaces/five.ModelsEvent.html +6 -1
- package/docs/interfaces/five.MotionKeyframe.html +4 -1
- package/docs/interfaces/five.MovePanoOptions.html +29 -30
- package/docs/interfaces/five.NetworkOptions.html +9 -9
- package/docs/interfaces/five.NetworkResourceEvent.html +9 -1
- package/docs/interfaces/five.ObjectEvent.html +6 -1
- package/docs/interfaces/five.PBMPanoPicture.html +7 -7
- package/docs/interfaces/five.PBMParameters.html +42 -43
- package/docs/interfaces/five.PanoCircleMeshCustomOptions.html +9 -1
- package/docs/interfaces/five.PanoCircleMeshInterface.html +21 -10
- package/docs/interfaces/five.PanoCircleMeshOptions.html +3 -1
- package/docs/interfaces/five.PanoCircleMeshSolidOptions.html +3 -1
- package/docs/interfaces/five.PanoEvent.html +11 -1
- package/docs/interfaces/five.PanoTextureEvent.html +9 -1
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +32 -32
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +18 -18
- package/docs/interfaces/five.Pose.html +15 -32
- package/docs/interfaces/five.RenderEvent.html +7 -1
- package/docs/interfaces/five.Scissor.html +11 -12
- package/docs/interfaces/five.State.html +20 -21
- package/docs/interfaces/five.StateEvent.html +7 -1
- package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.off.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.on.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.once.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.waitUnitl.html +1 -1
- package/docs/interfaces/five.TextureOptions.html +18 -20
- package/docs/interfaces/five.Tile3DModelLoaderOptions.html +6 -3
- package/docs/interfaces/five.TileCubeNode.html +7 -1
- package/docs/interfaces/five.TileCubeTree.html +2 -1
- package/docs/interfaces/five.TileHeader.html +9 -1
- package/docs/interfaces/five.TilesetHeader.html +5 -1
- package/docs/interfaces/five.TilesetOptions.html +5 -1
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +9 -9
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +28 -28
- package/docs/interfaces/five.WebXRAxesParams.html +4 -0
- package/docs/interfaces/five.WebXRControllerParams.html +2 -1
- package/docs/interfaces/five.WorkCubeImage.html +13 -13
- package/docs/interfaces/five.WorkImage.html +20 -21
- package/docs/interfaces/five.WorkInitial.html +17 -17
- package/docs/interfaces/five.WorkModel.html +12 -13
- package/docs/interfaces/five.WorkObserver.html +40 -39
- package/docs/interfaces/five.WorkOptions.html +17 -15
- package/docs/interfaces/five.WorkResolvedObserver.html +41 -37
- package/docs/interfaces/five.WorkTile.html +9 -1
- package/docs/interfaces/five.WorkVideo.html +8 -9
- package/docs/interfaces/five.WorksEvent.html +9 -1
- package/docs/interfaces/five.XRControllerEvent.html +8 -0
- package/docs/interfaces/five.XRGestureEvent.html +11 -1
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +29 -28
- package/docs/interfaces/five.XRSessionEvent.html +7 -1
- package/docs/interfaces/gltf_loader.DDS.html +7 -1
- package/docs/interfaces/gltf_loader.GLTF.html +10 -4
- package/docs/interfaces/gltf_loader.GLTFReference.html +3 -1
- package/docs/interfaces/gltf_loader.THREEGLTF.html +8 -1
- package/docs/interfaces/react.FiveActionReactCallbacks.html +27 -37
- package/docs/interfaces/react.FiveInjectionTypes.html +113 -138
- package/docs/interfaces/react.PropTypeOfFiveFeatures.html +2 -1
- package/docs/interfaces/sticker.IntersectionLike.html +7 -8
- package/docs/interfaces/vfx.ParticleArgs.html +67 -68
- package/docs/interfaces/vfx.ParticleTweenKeyframe.html +3 -1
- package/docs/interfaces/vue.FiveActionVueCallbacks.html +31 -42
- package/docs/modules/five.SubscribeMixinType.html +7 -1
- package/docs/modules/five.html +171 -631
- package/docs/modules/gltf_loader.html +11 -1
- package/docs/modules/line.html +8 -1
- package/docs/modules/react.FiveCanvas.html +8 -0
- package/docs/modules/react.html +37 -130
- package/docs/modules/sticker.html +3 -1
- package/docs/modules/vfx.html +8 -1
- package/docs/modules/vue.html +24 -115
- package/docs/types/five.AjaxResponseType.html +1 -0
- package/docs/types/five.AjaxResponseTypeMapping.html +1 -0
- package/docs/types/five.BoundingVolumeJson.html +1 -0
- package/docs/types/five.BoxBoundingVolumeJson.html +1 -0
- package/docs/types/five.ControllerCustomInitTypes.html +1 -0
- package/docs/types/five.ControllerEventTypes.html +32 -0
- package/docs/types/five.CoordinatesSystemTransformer.html +1 -0
- package/docs/types/five.EventTypes.html +26 -0
- package/docs/types/five.FivePlugin.html +71 -0
- package/docs/types/five.FivePluginInit.html +3 -0
- package/docs/types/five.FivePluginInstance.html +3 -0
- package/docs/types/five.GestureTypes.html +1 -0
- package/docs/types/five.LegacyEventType.html +203 -0
- package/docs/types/five.LooseWork.html +1 -0
- package/docs/types/five.LooseWorkInitial.html +1 -0
- package/docs/types/five.LooseWorkModel.html +1 -0
- package/docs/types/five.LooseWorkObserver.html +1 -0
- package/docs/types/five.LooseWorkPanorama.html +1 -0
- package/docs/types/five.LooseWorkVideo.html +1 -0
- package/docs/types/five.LooseWorkWithExtrinsics.html +8 -0
- package/docs/types/five.Mirror.html +1 -0
- package/docs/types/five.Mode.html +11 -0
- package/docs/types/five.ModelMaterialValues.html +1 -0
- package/docs/types/five.Models.html +12 -0
- package/docs/types/five.MotionValue.html +1 -0
- package/docs/types/five.NetWorkMeta.html +1 -0
- package/docs/types/five.NetworkError.html +1 -0
- package/docs/types/five.NetworkErrorCallback.html +1 -0
- package/docs/types/five.NetworkProgressCallback.html +1 -0
- package/docs/types/five.NetworkResponse.html +1 -0
- package/docs/types/five.NetworkState.html +1 -0
- package/docs/types/five.NetworkSuccessCallback.html +1 -0
- package/docs/types/five.NetworkType.html +1 -0
- package/docs/types/five.Pano.html +1 -0
- package/docs/types/five.PanoId.html +1 -0
- package/docs/types/five.ParseWorkOptions.html +13 -0
- package/docs/types/five.ParsedResultType.html +1 -0
- package/docs/types/five.PostProcessingType.html +1 -0
- package/docs/types/five.RegionBoundingVolumeJson.html +1 -0
- package/docs/types/five.RequestResult.html +1 -0
- package/docs/types/five.SphereBoundingVolumeJson.html +1 -0
- package/docs/types/five.SubscribeEventMap.html +1 -0
- package/docs/types/five.TileContentData.html +1 -0
- package/docs/types/five.TilesetFrameState.html +1 -0
- package/docs/types/five.WebXRControllerKey.html +1 -0
- package/docs/types/five.WebXRControllerType.html +1 -0
- package/docs/types/five.Works.html +1 -0
- package/docs/types/line.LineMaterialParameters.html +1 -0
- package/docs/types/react.FiveInjectionActionFeature.html +1 -0
- package/docs/types/react.FiveInjectionDataFeature.html +1 -0
- package/docs/types/react.FiveInjectionFeature.html +1 -0
- package/docs/types/react.FiveProviderPropTypes.html +1 -0
- package/docs/types/react.FiveProviderType.html +1 -0
- package/docs/types/react.StoreActionMapHanlder.html +1 -0
- package/docs/types/react.StoreActionMapType.html +1 -0
- package/docs/types/react.StoreProviderType.html +1 -0
- package/docs/types/react.StoreValueMapType.html +1 -0
- package/docs/types/vfx.ParticleType.html +1 -0
- package/docs/types/vue.FiveModelIntersectRaycaster.html +1 -0
- package/docs/types/vue.FiveProviderComponent.html +1 -0
- package/docs/types/vue.Project2d.html +1 -0
- package/docs/variables/five.PROXY_CONTROLLER_EVENT_NAMES.html +1 -0
- package/docs/variables/five.defaultPbmParameters.html +1 -0
- package/docs/variables/react.INJECTION_PROPNAME.html +1 -0
- package/docs/variables/vue.FiveCanvas.html +8 -0
- package/docs/variables/vue.FiveProvider.html +8 -0
- package/five/index.d.ts +381 -240
- package/five/index.js +203 -208
- package/five/index.mjs +36481 -0
- package/gltf-loader/index.js +198 -203
- package/gltf-loader/index.mjs +2696 -0
- package/line/index.js +198 -203
- package/line/index.mjs +790 -0
- package/package.json +43 -7
- package/react/index.js +198 -203
- package/react/index.mjs +1365 -0
- package/scripts/five-plugin-init.js +1 -1
- package/scripts/five-quick-start-init.js +1 -1
- package/scripts/five-react-component-init.js +1 -1
- package/sticker/index.js +198 -203
- package/sticker/index.mjs +464 -0
- package/templates/plugin/devtools/webpack.example.js +1 -1
- package/templates/react-component/devtools/webpack.example.js +1 -1
- package/umd/five-gltf-loader.js +255 -1
- package/umd/five-line.js +255 -1
- package/umd/five-react.js +255 -1
- package/umd/five-sticker.js +255 -1
- package/umd/five-vfx.js +255 -1
- package/umd/five-vue.js +255 -1
- package/umd/five.js +357 -2
- package/vfx/index.js +198 -203
- package/vfx/index.mjs +972 -0
- package/vue/index.d.ts +1 -1
- package/vue/index.js +198 -203
- package/vue/index.mjs +715 -0
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/five.BVH.html +0 -10
- package/docs/classes/five.BVHIntersect.html +0 -1
- package/docs/classes/five.BVHNode.html +0 -7
- package/docs/classes/five.BVHVector3.html +0 -1
- package/docs/classes/five.Clipper.html +0 -1
- package/docs/classes/five.PBMMaterialReferenceCache.html +0 -1
- package/docs/enums/five.PBMPointColorType.html +0 -1
- package/docs/enums/five.PBMPointShapeType.html +0 -1
- package/docs/enums/five.PBMPointSizeType.html +0 -1
- package/docs/modules.html +0 -1
- package/umd/five-gltf-loader.js.LICENSE.txt +0 -14
- package/umd/five-line.js.LICENSE.txt +0 -14
- package/umd/five-react.js.LICENSE.txt +0 -14
- package/umd/five-sticker.js.LICENSE.txt +0 -14
- package/umd/five.js.LICENSE.txt +0 -100
package/umd/five.js
CHANGED
|
@@ -1,2 +1,357 @@
|
|
|
1
|
-
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FiveSDK=t():e.FiveSDK=t()}(self,(()=>(()=>{var __webpack_modules__={438:e=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const t=Number(THREE.REVISION);if(t<115||t>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');e.exports=window.THREE},383:e=>{"use strict";e.exports=function(e,t){for(var r=new Array(arguments.length-1),n=0,i=2,o=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,a){r[n]=function(e){if(o)if(o=!1,e)a(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(e){o&&(o=!1,a(e))}}))}},417:(e,t)=>{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),i=new Array(123),o=0;o<64;)i[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(e,t,r){for(var i,o=null,a=[],s=0,l=0;t<r;){var u=e[t++];switch(l){case 0:a[s++]=n[u>>2],i=(3&u)<<4,l=1;break;case 1:a[s++]=n[i|u>>4],i=(15&u)<<2,l=2;break;case 2:a[s++]=n[i|u>>6],a[s++]=n[63&u],l=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return l&&(a[s++]=n[i],a[s++]=61,1===l&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var a="invalid encoding";r.decode=function(e,t,r){for(var n,o=r,s=0,l=0;l<e.length;){var u=e.charCodeAt(l++);if(61===u&&s>1)break;if(void 0===(u=i[u]))throw Error(a);switch(s){case 0:n=u,s=1;break;case 1:t[r++]=n<<2|(48&u)>>4,n=u,s=2;break;case 2:t[r++]=(15&n)<<4|(60&u)>>2,n=u,s=3;break;case 3:t[r++]=(3&n)<<6|u,s=0}}if(1===s)throw Error(a);return r-o},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},516:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},787:e=>{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function a(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function s(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:o,e.writeFloatBE=n?o:i,e.readFloatLE=n?a:s,e.readFloatBE=n?s:a}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function a(e,t,r){var n=e(t,r),i=2*(n>>31)+1,o=n>>>23&255,a=8388607&n;return 255===o?a?NaN:i*(1/0):0===o?1401298464324817e-60*i*a:i*Math.pow(2,o-150)*(a+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=a.bind(null,i),e.readFloatBE=a.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function a(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function s(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:o,e.writeDoubleBE=n?o:i,e.readDoubleLE=n?a:s,e.readDoubleBE=n?s:a}():function(){function t(e,t,r,n,i,o){var a=n<0?1:0;if(a&&(n=-n),0===n)e(0,i,o+t),e(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))e(0,i,o+t),e(2146959360,i,o+r);else if(n>17976931348623157e292)e(0,i,o+t),e((a<<31|2146435072)>>>0,i,o+r);else{var s;if(n<22250738585072014e-324)e((s=n/5e-324)>>>0,i,o+t),e((a<<31|s/4294967296)>>>0,i,o+r);else{var l=Math.floor(Math.log(n)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(s=n*Math.pow(2,-l))>>>0,i,o+t),e((a<<31|l+1023<<20|1048576*s&1048575)>>>0,i,o+r)}}}function a(e,t,r,n,i){var o=e(n,i+t),a=e(n,i+r),s=2*(a>>31)+1,l=a>>>20&2047,u=4294967296*(1048575&a)+o;return 2047===l?u?NaN:s*(1/0):0===l?5e-324*s*u:s*Math.pow(2,l-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=a.bind(null,i,0,4),e.readDoubleBE=a.bind(null,o,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},795:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},476:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,o=null,a=n;return function(r){if(r<1||r>i)return e(r);a+r>n&&(o=e(n),a=0);var s=t.call(o,a,a+=r);return 7&a&&(a=1+(7|a)),s}}},893:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},r.read=function(e,t,r){if(r-t<1)return"";for(var n,i=null,o=[],a=0;t<r;)(n=e[t++])<128?o[a++]=n:n>191&&n<224?o[a++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[a++]=55296+(n>>10),o[a++]=56320+(1023&n)):o[a++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),a=0);return i?(a&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))},r.write=function(e,t,r){for(var n,i,o=r,a=0;a<e.length;++a)(n=e.charCodeAt(a))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(i=e.charCodeAt(a+1)))?(n=65536+((1023&n)<<10)+(1023&i),++a,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}},967:(e,t,r)=>{"use strict";e.exports=r(365)},365:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(147),n.BufferWriter=r(55),n.Reader=r(74),n.BufferReader=r(69),n.util=r(835),n.rpc=r(876),n.roots=r(7),n.configure=i,i()},74:(e,t,r)=>{"use strict";e.exports=l;var n,i=r(835),o=i.LongBits,a=i.utf8;function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var u,c="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")},h=function(){return i.Buffer?function(e){return(l.create=function(e){return i.Buffer.isBuffer(e)?new n(e):c(e)})(e)}:c};function p(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw s(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw s(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw s(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}l.create=h(),l.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,l.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return u}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return d(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|d(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw s(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},l.prototype.string=function(){var e=this.bytes();return a.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){n=e,l.create=h(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(l.prototype,{int64:function(){return p.call(this)[t](!1)},uint64:function(){return p.call(this)[t](!0)},sint64:function(){return p.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},69:(e,t,r)=>{"use strict";e.exports=o;var n=r(74);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(835);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},7:e=>{"use strict";e.exports={}},876:(e,t,r)=>{"use strict";t.Service=r(380)},380:(e,t,r)=>{"use strict";e.exports=i;var n=r(835);function i(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,o,a){if(!o)throw TypeError("request must be specified");var s=this;if(!a)return n.asPromise(e,s,t,r,i,o);if(s.rpcImpl)try{return s.rpcImpl(t,r[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return s.emit("error",e,t),a(e);if(null!==r){if(!(r instanceof i))try{r=i[s.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return s.emit("error",e,t),a(e)}return s.emit("data",r,t),a(null,r)}s.end(!0)}))}catch(e){return s.emit("error",e,t),void setTimeout((function(){a(e)}),0)}else setTimeout((function(){a(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},600:(e,t,r)=>{"use strict";e.exports=i;var n=r(835);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var a=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;i.fromHash=function(e){return e===a?o:new i((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},835:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=r(383),n.base64=r(417),n.EventEmitter=r(516),n.float=r(787),n.inquire=r(795),n.utf8=r(893),n.pool=r(476),n.LongBits=r(600),n.isNode=Boolean(void 0!==r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},147:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(835),o=i.LongBits,a=i.base64,s=i.utf8;function l(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function u(){}function c(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new l(u,0,0),this.tail=this.head,this.states=null}var p=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function d(e,t,r){t[r]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function v(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function m(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=p(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new l(e,t,r),this.len+=t,this},f.prototype=Object.create(l.prototype),f.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(v,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(v,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(v,t.length(),t)},h.prototype.bool=function(e){return this._push(d,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var A=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(d,1,0);if(i.isString(e)){var r=h.alloc(t=a.length(e));a.decode(e,r,0),e=r}return this.uint32(t)._push(A,t,e)},h.prototype.string=function(e){var t=s.length(e);return t?this.uint32(t)._push(s.write,t,e):this._push(d,1,0)},h.prototype.fork=function(){return this.states=new c(this),this.head=this.tail=new l(u,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(u,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=p(),n._configure()}},55:(e,t,r)=>{"use strict";e.exports=o;var n=r(147);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(835);function o(){n.call(this)}function a(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(a,t,e),this},o._configure()}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{AnimationFrameLoop:()=>Oe,BVH:()=>Dr,BVHIntersect:()=>Ir,BVHNode:()=>Sr,BVHVector3:()=>Cr,Camera:()=>Gt,Clipper:()=>je,Five:()=>ou,InternalWebGLRenderer:()=>Vt,IntersectMesh:()=>Fo,Model:()=>Yi,NetworkSubscribe:()=>Ce,PBMContainer:()=>st,PBMGroup:()=>et,PBMMaterialReferenceCache:()=>rt,PBMMesh:()=>tt,PBMMeshMaterial:()=>Nt,PBMPointColorType:()=>$e,PBMPointShapeType:()=>Ze,PBMPointSizeType:()=>Je,PROXY_CONTROLLER_EVENT_NAMES:()=>Fl,PanoCircleMesh:()=>Io,PanoCircleMeshCustom:()=>ko,PanoCircleMeshSolid:()=>Bo,RequestScheduler:()=>gr,Scene:()=>Ut,Subscribe:()=>ae,TextureLoader:()=>kt,Tile:()=>Ar,Tile3DModel:()=>Bi,TileCubeTextureTarget:()=>Ot,TileNode:()=>Kr,Tileset:()=>Er,TilesetCache:()=>xr,TilesetTraverser:()=>Mr,Work:()=>uo,XRButton:()=>su,defaultImageURLTransform:()=>Ne,getViewportScale:()=>Nl,imageSupport:()=>He,isPanoId:()=>Xe,panoEqual:()=>Ye,panoParse:()=>We,panoStringify:()=>Ke,parseWork:()=>yo});var e=__webpack_require__(438),t=Number(e.REVISION);if(t<115||t>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');var r,n={},i=i||function(e,t){var r={},n=r.lib={},i=n.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var r=new e;return t&&r.mixIn(t),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=n.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var a=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(o=0;o<i;o+=4)t[n+o>>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],n=0;n<t;n+=4)r.push(4294967296*e.random()|0);return new o.init(r,t)}}),a=r.enc={},s=a.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},l=a.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},c=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),l=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,u=e.min(4*l,i);if(l){for(var c=0;c<l;c+=a)this._doProcessBlock(n,c);var h=n.splice(0,l);r.sigBytes-=u}return new o.init(h,u)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),h=(n.Hasher=c.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}}),r.algo={});return r}(Math);function o(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new o(null)}!function(e){for(var t=i,r=(o=t.lib).WordArray,n=o.Hasher,o=t.algo,a=[],s=[],l=function(e){return 4294967296*(e-(0|e))|0},u=2,c=0;64>c;){var h;e:{h=u;for(var p=e.sqrt(h),d=2;d<=p;d++)if(!(h%d)){h=!1;break e}h=!0}h&&(8>c&&(a[c]=l(e.pow(u,.5))),s[c]=l(e.pow(u,1/3)),c++),u++}var f=[];o=o.SHA256=n.extend({_doReset:function(){this._hash=new r.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],l=r[4],u=r[5],c=r[6],h=r[7],p=0;64>p;p++){if(16>p)f[p]=0|e[t+p];else{var d=f[p-15],v=f[p-2];f[p]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+f[p-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+f[p-16]}d=h+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&u^~l&c)+s[p]+f[p],v=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&i^n&o^i&o),h=c,c=u,u=l,l=a+d|0,a=o,o=i,i=n,n=d+v|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+l|0,r[5]=r[5]+u|0,r[6]=r[6]+c|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA256=n._createHelper(o),t.HmacSHA256=n._createHmacHelper(o)}(Math),i.lib.Cipher||function(e){var t=(f=i).lib,r=t.Base,n=t.WordArray,o=t.BufferedBlockAlgorithm,a=f.enc.Base64,s=f.algo.EvpKDF,l=t.Cipher=o.extend({cfg:r.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,r,n){return("string"==typeof r?v:d).encrypt(e,t,r,n)},decrypt:function(t,r,n){return("string"==typeof r?v:d).decrypt(e,t,r,n)}}}});t.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=f.mode={},c=function(e,t,r){var n=this._iv;n?this._iv=void 0:n=this._prevBlock;for(var i=0;i<r;i++)e[t+i]^=n[i]},h=(t.BlockCipherMode=r.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();h.Encryptor=h.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize;c.call(this,e,t,n),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),h.Decryptor=h.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=e.slice(t,t+n);r.decryptBlock(e,t),c.call(this,e,t,n),this._prevBlock=i}}),u=u.CBC=h,h=(f.pad={}).Pkcs7={pad:function(e,t){for(var r,i=(r=(r=4*t)-e.sigBytes%r)<<24|r<<16|r<<8|r,o=[],a=0;a<r;a+=4)o.push(i);r=n.create(o,r),e.concat(r)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=l.extend({cfg:l.cfg.extend({mode:u,padding:h}),reset:function(){l.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=t.createEncryptor;else r=t.createDecryptor,this._minBufferSize=1;this._mode=r.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var p=t.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),d=(u=(f.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?n.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){var t=(e=a.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var r=n.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:r})}},t.SerializableCipher=r.extend({cfg:r.extend({format:u}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n);return t=i.finalize(t),i=i.cfg,p.create({ciphertext:t,key:r,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),f=(f.kdf={}).OpenSSL={execute:function(e,t,r,i){return i||(i=n.random(8)),e=s.create({keySize:t+r}).compute(e,i),r=n.create(e.words.slice(t),4*r),e.sigBytes=4*t,p.create({key:e,iv:r,salt:i})}},v=t.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:f}),encrypt:function(e,t,r,n){return r=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize),n.iv=r.iv,(e=d.encrypt.call(this,e,t,r.key,n)).mixIn(r),e},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),r=n.kdf.execute(r,e.keySize,e.ivSize,t.salt),n.iv=r.iv,d.decrypt.call(this,e,t,r.key,n)}})}(),function(){for(var e=i,t=e.lib.BlockCipher,r=e.algo,n=[],o=[],a=[],s=[],l=[],u=[],c=[],h=[],p=[],d=[],f=[],v=0;256>v;v++)f[v]=128>v?v<<1:v<<1^283;var m=0,A=0;for(v=0;256>v;v++){var g=(g=A^A<<1^A<<2^A<<3^A<<4)>>>8^255&g^99;n[m]=g,o[g]=m;var y=f[m],b=f[y],x=f[b],w=257*f[g]^16843008*g;a[m]=w<<24|w>>>8,s[m]=w<<16|w>>>16,l[m]=w<<8|w>>>24,u[m]=w,w=16843009*x^65537*b^257*y^16843008*m,c[g]=w<<24|w>>>8,h[g]=w<<16|w>>>16,p[g]=w<<8|w>>>24,d[g]=w,m?(m=y^f[f[f[x^y]]],A^=f[f[A]]):m=A=1}var M=[0,1,2,4,8,16,32,64,128,27,54];r=r.AES=t.extend({_doReset:function(){for(var e=(r=this._key).words,t=r.sigBytes/4,r=4*((this._nRounds=t+6)+1),i=this._keySchedule=[],o=0;o<r;o++)if(o<t)i[o]=e[o];else{var a=i[o-1];o%t?6<t&&4==o%t&&(a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a]):(a=n[(a=a<<8|a>>>24)>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a],a^=M[o/t|0]<<24),i[o]=i[o-t]^a}for(e=this._invKeySchedule=[],t=0;t<r;t++)o=r-t,a=t%4?i[o]:i[o-4],e[t]=4>t||4>=o?a:c[n[a>>>24]]^h[n[a>>>16&255]]^p[n[a>>>8&255]]^d[n[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,l,u,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,h,p,d,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,a,s){for(var l=this._nRounds,u=e[t]^r[0],c=e[t+1]^r[1],h=e[t+2]^r[2],p=e[t+3]^r[3],d=4,f=1;f<l;f++){var v=n[u>>>24]^i[c>>>16&255]^o[h>>>8&255]^a[255&p]^r[d++],m=n[c>>>24]^i[h>>>16&255]^o[p>>>8&255]^a[255&u]^r[d++],A=n[h>>>24]^i[p>>>16&255]^o[u>>>8&255]^a[255&c]^r[d++];p=n[p>>>24]^i[u>>>16&255]^o[c>>>8&255]^a[255&h]^r[d++],u=v,c=m,h=A}v=(s[u>>>24]<<24|s[c>>>16&255]<<16|s[h>>>8&255]<<8|s[255&p])^r[d++],m=(s[c>>>24]<<24|s[h>>>16&255]<<16|s[p>>>8&255]<<8|s[255&u])^r[d++],A=(s[h>>>24]<<24|s[p>>>16&255]<<16|s[u>>>8&255]<<8|s[255&c])^r[d++],p=(s[p>>>24]<<24|s[u>>>16&255]<<16|s[c>>>8&255]<<8|s[255&h])^r[d++],e[t]=v,e[t+1]=m,e[t+2]=A,e[t+3]=p},keySize:8}),e.AES=t._createHelper(r)}(),"undefined"!=typeof navigator&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(var a=32767&t,s=t>>15;--o>=0;){var l=32767&this[e],u=this[e++]>>15,c=s*l+u*a;i=((l=a*l+((32767&c)<<15)+r[n]+(1073741823&i))>>>30)+(c>>>15)+s*u+(i>>>30),r[n++]=1073741823&l}return i},r=30):"undefined"!=typeof navigator&&"Netscape"!=navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var a=t*this[e++]+r[n]+i;i=Math.floor(a/67108864),r[n++]=67108863&a}return i},r=26):(o.prototype.am=function(e,t,r,n,i,o){for(var a=16383&t,s=t>>14;--o>=0;){var l=16383&this[e],u=this[e++]>>14,c=s*l+u*a;i=((l=a*l+((16383&c)<<14)+r[n]+i)>>28)+(c>>14)+s*u,r[n++]=268435455&l}return i},r=28),o.prototype.DB=r,o.prototype.DM=(1<<r)-1,o.prototype.DV=1<<r,o.prototype.FV=Math.pow(2,52),o.prototype.F1=52-r,o.prototype.F2=2*r-52;var s,l,u="0123456789abcdefghijklmnopqrstuvwxyz",c=new Array;for(s="0".charCodeAt(0),l=0;l<=9;++l)c[s++]=l;for(s="a".charCodeAt(0),l=10;l<36;++l)c[s++]=l;for(s="A".charCodeAt(0),l=10;l<36;++l)c[s++]=l;function h(e){return u.charAt(e)}function p(e,t){var r=c[e.charCodeAt(t)];return null==r?-1:r}function d(e){var t=a();return t.fromInt(e),t}function f(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function v(e){this.m=e}function m(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}v.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},v.prototype.revert=function(e){return e},v.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},v.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},v.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},m.prototype.convert=function(e){var t=a();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(o.ZERO)>0&&this.m.subTo(t,t),t},m.prototype.revert=function(e){var t=a();return e.copyTo(t),this.reduce(t),t},m.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},m.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},m.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},o.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},o.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},o.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,a=0;--n>=0;){var s=8==r?255&e[n]:p(e,n);s<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==a?this[this.t++]=s:a+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&o.ZERO.subTo(this,this)},o.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},o.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},o.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s},o.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,a=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t[r+a+1]=this[r]>>i|s,s=(this[r]&o)<<n;for(r=a-1;r>=0;--r)t[r]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},o.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t[0]=this[r]>>n;for(var a=r+1;a<this.t;++a)t[a-r-1]|=(this[a]&o)<<i,t[a-r]=this[a]>>n;n>0&&(t[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}},o.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()},o.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t[i]=0;for(i=0;i<n.t;++i)t[i+r.t]=r.am(0,n[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&o.ZERO.subTo(t,t)},o.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},o.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=a());var s=a(),l=this.s,u=e.s,c=this.DB-f(n[n.t-1]);c>0?(n.lShiftTo(c,s),i.lShiftTo(c,r)):(n.copyTo(s),i.copyTo(r));var h=s.t,p=s[h-1];if(0!=p){var d=p*(1<<this.F1)+(h>1?s[h-2]>>this.F2:0),v=this.FV/d,m=(1<<this.F1)/d,A=1<<this.F2,g=r.t,y=g-h,b=null==t?a():t;for(s.dlShiftTo(y,b),r.compareTo(b)>=0&&(r[r.t++]=1,r.subTo(b,r)),o.ONE.dlShiftTo(h,b),b.subTo(s,s);s.t<h;)s[s.t++]=0;for(;--y>=0;){var x=r[--g]==p?this.DM:Math.floor(r[g]*v+(r[g-1]+A)*m);if((r[g]+=s.am(0,x,r,y,0,h))<x)for(s.dlShiftTo(y,b),r.subTo(b,r);r[g]<--x;)r.subTo(b,r)}null!=t&&(r.drShiftTo(h,t),l!=u&&o.ZERO.subTo(t,t)),r.t=h,r.clamp(),c>0&&r.rShiftTo(c,r),l<0&&o.ZERO.subTo(r,r)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},o.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},o.prototype.exp=function(e,t){if(e>4294967295||e<1)return o.ONE;var r=a(),n=a(),i=t.convert(this),s=f(e)-1;for(i.copyTo(r);--s>=0;)if(t.sqrTo(r,n),(e&1<<s)>0)t.mulTo(n,i,r);else{var l=r;r=n,n=l}return t.revert(r)},o.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,o="",a=this.t,s=this.DB-a*this.DB%t;if(a-- >0)for(s<this.DB&&(r=this[a]>>s)>0&&(i=!0,o=h(r));a>=0;)s<t?(r=(this[a]&(1<<s)-1)<<t-s,r|=this[--a]>>(s+=this.DB-t)):(r=this[a]>>(s-=t)&n,s<=0&&(s+=this.DB,--a)),r>0&&(i=!0),i&&(o+=h(r));return i?o:"0"},o.prototype.negate=function(){var e=a();return o.ZERO.subTo(this,e),e},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+f(this[this.t-1]^this.s&this.DM)},o.prototype.mod=function(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t},o.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new v(t):new m(t),this.exp(e,r)},o.ZERO=d(0),o.ONE=d(1),o.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},o.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=d(r),i=a(),o=a(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(e)+s},o.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1};var A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g="=";function y(e){var t,r,n,i="",o=0;for(t=0;t<e.length&&e.charAt(t)!=g;++t)(n=A.indexOf(e.charAt(t)))<0||(0==o?(i+=h(n>>2),r=3&n,o=1):1==o?(i+=h(r<<2|n>>4),r=15&n,o=2):2==o?(i+=h(r),i+=h(n>>2),r=3&n,o=3):(i+=h(r<<2|n>>4),i+=h(15&n),o=0));return 1==o&&(i+=h(r<<2)),i}function b(e,t){return new o(e,t)}function x(e,t,r){for(var n="",i=0;n.length<t;)n+=r(String.fromCharCode.apply(String,e.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function w(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function M(e,t,r){for(var n="",i=0;n.length<t;)n+=r(e+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])),i+=1;return n}function E(e){return y(function(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),(e=e.replace(/-/g,"+")).replace(/_/g,"/")}(e))}function C(e){return decodeURIComponent(function(e){return e.replace(/(..)/g,"%$1")}(e))}function S(e){for(var t="",r=0;r<e.length-1;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t}function I(e){for(var t="",r=0;r<e.length;r++)t+=("0"+e.charCodeAt(r).toString(16)).slice(-2);return t}function P(e,t){var r=function(e){var t=function(e){return function(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=A.charAt(r>>6)+A.charAt(63&r);if(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=A.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=A.charAt(r>>2)+A.charAt((3&r)<<4)),g)for(;(3&n.length)>0;)n+=g;return n}(e)}(e).replace(/(.{64})/g,"$1\r\n");return t.replace(/\r\n$/,"")}(e);return"-----BEGIN "+t+"-----\r\n"+r+"\r\n-----END "+t+"-----\r\n"}function T(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return function(e){return y(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function B(e){var t="malformed hex value";if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8!=e.length)return 32==e.length?function(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var t=(e=e.toLowerCase()).match(/.{1,4}/g),r=0;r<8;r++)t[r]=t[r].replace(/^0+/,""),""==t[r]&&(t[r]="0");var n=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===n)return e.slice(1,-1);var i="";for(r=0;r<n.length;r++)n[r].length>i.length&&(i=n[r]);return(e=e.replace(i,"::")).slice(1,-1)}(e):e;try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}function R(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function O(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}w.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},w.prototype.setPublic=function(e,t){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof e)this.n=e,this.e=t;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA public key";this.n=b(e,16),this.e=parseInt(t,16)}},w.prototype.encrypt=function(e){var t=function(e,t){if(t<e.length+11)throw"Message too long for RSA";for(var r=new Array,n=e.length-1;n>=0&&t>0;){var i=e.charCodeAt(n--);i<128?r[--t]=i:i>127&&i<2048?(r[--t]=63&i|128,r[--t]=i>>6|192):(r[--t]=63&i|128,r[--t]=i>>6&63|128,r[--t]=i>>12|224)}r[--t]=0;for(var a=new SecureRandom,s=new Array;t>2;){for(s[0]=0;0==s[0];)a.nextBytes(s);r[--t]=s[0]}return r[--t]=2,r[--t]=0,new o(r)}(e,this.n.bitLength()+7>>3);if(null==t)return null;var r=this.doPublic(t);if(null==r)return null;var n=r.toString(16);return 0==(1&n.length)?n:"0"+n},w.prototype.encryptOAEP=function(e,t,r){var i=function(e,t,r,i){var a=n.crypto.MessageDigest,s=n.crypto.Util,l=null;if(r||(r="sha1"),"string"==typeof r&&(l=a.getCanonicalAlgName(r),i=a.getHashLength(l),r=function(e){return S(s.hashHex(I(e),l))}),e.length+2*i+2>t)throw"Message too long for RSA";var u,c="";for(u=0;u<t-e.length-2*i-2;u+=1)c+="\0";var h=r("")+c+""+e,p=new Array(i);(new SecureRandom).nextBytes(p);var d=x(p,h.length,r),f=[];for(u=0;u<h.length;u+=1)f[u]=h.charCodeAt(u)^d.charCodeAt(u);var v=x(f,p.length,r),m=[0];for(u=0;u<p.length;u+=1)m[u+1]=p[u]^v.charCodeAt(u);return new o(m.concat(f))}(e,this.n.bitLength()+7>>3,t,r);if(null==i)return null;var a=this.doPublic(i);if(null==a)return null;var s=a.toString(16);return 0==(1&s.length)?s:"0"+s},w.prototype.type="RSA",w.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),r=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(r)<0;)t=t.add(this.p);return t.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)},w.prototype.setPrivate=function(e,t,r){if(this.isPrivate=!0,"string"!=typeof e)this.n=e,this.e=t,this.d=r;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key";this.n=b(e,16),this.e=parseInt(t,16),this.d=b(r,16)}},w.prototype.setPrivateEx=function(e,t,r,n,i,o,a,s){if(this.isPrivate=!0,this.isPublic=!1,null==e)throw"RSASetPrivateEx N == null";if(null==t)throw"RSASetPrivateEx E == null";if(0==e.length)throw"RSASetPrivateEx N.length == 0";if(0==t.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=b(e,16),this.e=parseInt(t,16),this.d=b(r,16),this.p=b(n,16),this.q=b(i,16),this.dmp1=b(o,16),this.dmq1=b(a,16),this.coeff=b(s,16)},w.prototype.decrypt=function(e){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var t=b(e,16),r=this.doPrivate(t);return null==r?null:function(e,t){for(var r=e.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=t-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var i="";++n<r.length;){var o=255&r[n];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}(r,this.n.bitLength()+7>>3)},w.prototype.decryptOAEP=function(e,t,r){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var i=b(e,16),o=this.doPrivate(i);return null==o?null:function(e,t,r,i){var o=n.crypto.MessageDigest,a=n.crypto.Util,s=null;for(r||(r="sha1"),"string"==typeof r&&(s=o.getCanonicalAlgName(r),i=o.getHashLength(s),r=function(e){return S(a.hashHex(I(e),s))}),e=e.toByteArray(),l=0;l<e.length;l+=1)e[l]&=255;for(;e.length<t;)e.unshift(0);if((e=String.fromCharCode.apply(String,e)).length<2*i+2)throw"Cipher too short";var l,u=e.substr(1,i),c=e.substr(i+1),h=M(c,i,r),p=[];for(l=0;l<u.length;l+=1)p[l]=u.charCodeAt(l)^h.charCodeAt(l);var d=M(String.fromCharCode.apply(String,p),e.length-i,r),f=[];for(l=0;l<c.length;l+=1)f[l]=c.charCodeAt(l)^d.charCodeAt(l);if((f=String.fromCharCode.apply(String,f)).substr(0,i)!==r(""))throw"Hash mismatch";var v=(f=f.substr(i)).indexOf("");if((-1!=v?f.substr(0,v).lastIndexOf("\0"):-1)+1!=v)throw"Malformed data";return f.substr(v+1)}(o,this.n.bitLength()+7>>3,t,r)},void 0!==n.lang&&n.lang||(n.lang={}),n.lang.String=function(){},n.lang.String.isHex=function(e){return R(e)},n.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var k=function(e,t,r){return null==r&&(r="0"),e.length>=t?e:new Array(t-e.length+1).join(r)+e};void 0!==n.crypto&&n.crypto||(n.crypto={}),n.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:i.algo.MD5,sha1:i.algo.SHA1,sha224:i.algo.SHA224,sha256:i.algo.SHA256,sha384:i.algo.SHA384,sha512:i.algo.SHA512,ripemd160:i.algo.RIPEMD160},this.hashString=function(e,t){return new n.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new n.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")}},n.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=n.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=n.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=n.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=i.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(i.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=n.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},n.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},n.crypto.MessageDigest.getHashLength=function(e){var t=n.crypto.MessageDigest,r=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[r])throw"not supported algorithm: "+e;return t.HASHLENGTH[r]},n.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},n.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var r="",n=t/4-e.length,i=0;i<n;i++)r+="0";return r+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new n.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+e)}this.init=function(e,t){var r=null;try{r=void 0===t?_.getKey(e):_.getKey(e,t)}catch(e){throw"init failed:"+e}if(!0===r.isPrivate)this.prvKey=r,this.state="SIGN";else{if(!0!==r.isPublic)throw"init failed.:"+r;this.pubKey=r,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.verify=function(e){if(this.sHashHex=this.md.digest(),this.pubKey instanceof w&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof w&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=n.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=_.getKey(e.prvkeypem),this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},n.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}};var D,L,F,Q,N,V,U,z,_=(D=function(e,t,r){return L(i.AES,e,t,r)},L=function(e,t,r,n){var o=i.enc.Hex.parse(t),a=i.enc.Hex.parse(r),s=i.enc.Hex.parse(n),l={};l.key=a,l.iv=s,l.ciphertext=o;var u=e.decrypt(l,a,{iv:s});return i.enc.Hex.stringify(u)},F=function(e,t,r){return Q(i.AES,e,t,r)},Q=function(e,t,r,n){var o=i.enc.Hex.parse(t),a=i.enc.Hex.parse(r),s=i.enc.Hex.parse(n),l=e.encrypt(o,a,{iv:s}),u=i.enc.Hex.parse(l.toString());return i.enc.Base64.stringify(u)},N={"AES-256-CBC":{proc:D,eproc:F,keylen:32,ivlen:16},"AES-192-CBC":{proc:D,eproc:F,keylen:24,ivlen:16},"AES-128-CBC":{proc:D,eproc:F,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,t,r){return L(i.TripleDES,e,t,r)},eproc:function(e,t,r){return Q(i.TripleDES,e,t,r)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,t,r){return L(i.DES,e,t,r)},eproc:function(e,t,r){return Q(i.DES,e,t,r)},keylen:8,ivlen:8}},V=function(e){var t={},r=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));r&&(t.cipher=r[1],t.ivsalt=r[2]);var n=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));n&&(t.type=n[1]);var i=-1,o=0;-1!=e.indexOf("\r\n\r\n")&&(i=e.indexOf("\r\n\r\n"),o=2),-1!=e.indexOf("\n\n")&&(i=e.indexOf("\n\n"),o=1);var a=e.indexOf("-----END");if(-1!=i&&-1!=a){var s=e.substring(i+2*o,a-o);s=s.replace(/\s+/g,""),t.data=s}return t},U=function(e,t,r){for(var n=r.substring(0,16),o=i.enc.Hex.parse(n),a=i.enc.Utf8.parse(t),s=N[e].keylen+N[e].ivlen,l="",u=null;;){var c=i.algo.MD5.create();if(null!=u&&c.update(u),c.update(a),c.update(o),u=c.finalize(),(l+=i.enc.Hex.stringify(u)).length>=2*s)break}var h={};return h.keyhex=l.substr(0,2*N[e].keylen),h.ivhex=l.substr(2*N[e].keylen,2*N[e].ivlen),h},z=function(e,t,r,n){var o=i.enc.Base64.parse(e),a=i.enc.Hex.stringify(o);return(0,N[t].proc)(a,r,n)},{version:"1.0.0",parsePKCS5PEM:function(e){return V(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,r){return U(e,t,r)},decryptKeyB64:function(e,t,r,n){return z(e,t,r,n)},getDecryptedKeyHex:function(e,t){var r=V(e),n=(r.type,r.cipher),i=r.ivsalt,o=r.data,a=U(n,t,i).keyhex;return z(o,n,a,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,r,n,o){var a="";if(void 0!==n&&null!=n||(n="AES-256-CBC"),void 0===N[n])throw"KEYUTIL unsupported algorithm: "+n;if(void 0===o||null==o){var s=function(e){var t=i.lib.WordArray.random(e);return i.enc.Hex.stringify(t)}(N[n].ivlen);o=s.toUpperCase()}var l=function(e,t,r,n){return(0,N[t].eproc)(e,r,n)}(t,n,U(n,r,o).keyhex,o);return a="-----BEGIN "+e+" PRIVATE KEY-----\r\n",a+="Proc-Type: 4,ENCRYPTED\r\n",a+="DEK-Info: "+n+","+o+"\r\n",a+="\r\n",(a+=l.replace(/(.{64})/g,"$1\r\n"))+"\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=q,r=t.getChildIdx,n=t.getV,i={},o=r(e,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;i.ciphertext=n(e,o[1]);var a=r(e,o[0]);if(2!=a.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+a.length;if("2a864886f70d01050d"!=n(e,a[0]))throw"this only supports pkcs5PBES2";var s=r(e,a[1]);if(2!=a.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+s.length;var l=r(e,s[1]);if(2!=l.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+l.length;if("2a864886f70d0307"!=n(e,l[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=n(e,l[1]);var u=r(e,s[0]);if(2!=u.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+u.length;if("2a864886f70d01050c"!=n(e,u[0]))throw"this only supports pkcs5PBKDF2";var c=r(e,u[1]);if(c.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+c.length;i.pbkdf2Salt=n(e,c[0]);var h=n(e,c[1]);try{i.pbkdf2Iter=parseInt(h,16)}catch(e){throw"malformed format pbkdf2Iter: "+h}return i},getPBKDF2KeyHexFromParam:function(e,t){var r=i.enc.Hex.parse(e.pbkdf2Salt),n=e.pbkdf2Iter,o=i.PBKDF2(t,r,{keySize:6,iterations:n});return i.enc.Hex.stringify(o)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var r=T(e,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),o=_.getPBKDF2KeyHexFromParam(n,t),a={};a.ciphertext=i.enc.Hex.parse(n.ciphertext);var s=i.enc.Hex.parse(o),l=i.enc.Hex.parse(n.encryptionSchemeIV),u=i.TripleDES.decrypt(a,s,{iv:l});return i.enc.Hex.stringify(u)},getKeyFromEncryptedPKCS8PEM:function(e,t){var r=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(r)},parsePlainPrivatePKCS8Hex:function(e){var t=q,r=t.getChildIdx,n=t.getV,i={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=r(e,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var a=r(e,o[1]);if(2!=a.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(a[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=n(e,a[0]),"06"==e.substr(a[1],2)&&(i.algparam=n(e,a[1])),"04"!=e.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=t.getVidx(e,o[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=T(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,r=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==r.algoid)t=new w;else if(n.crypto.DSA&&"2a8648ce380401"==r.algoid)t=new n.crypto.DSA;else{if(!n.crypto.ECDSA||"2a8648ce3d0201"!=r.algoid)throw"unsupported private key algorithm";t=new n.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,r=q.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===r)t=new w;else if(n.crypto.DSA&&"2a8648ce380401"===r)t=new n.crypto.DSA;else{if(!n.crypto.ECDSA||"2a8648ce3d0201"!==r)throw"unsupported PKCS#8 public key hex";t=new n.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=q,r=t.getChildIdx,n=t.getV,i={};if("30"!=e.substr(0,2))throw"malformed RSA key(code:001)";var o=r(e,0);if(2!=o.length)throw"malformed RSA key(code:002)";if("02"!=e.substr(o[0],2))throw"malformed RSA key(code:003)";if(i.n=n(e,o[0]),"02"!=e.substr(o[1],2))throw"malformed RSA key(code:004)";return i.e=n(e,o[1]),i},parsePublicPKCS8Hex:function(e){var t=q,r=t.getChildIdx,n=t.getV,i={algparam:null},o=r(e,0);if(2!=o.length)throw"outer DERSequence shall have 2 elements: "+o.length;var a=o[0];if("30"!=e.substr(a,2))throw"malformed PKCS8 public key(code:001)";var s=r(e,a);if(2!=s.length)throw"malformed PKCS8 public key(code:002)";if("06"!=e.substr(s[0],2))throw"malformed PKCS8 public key(code:003)";if(i.algoid=n(e,s[0]),"06"==e.substr(s[1],2)?i.algparam=n(e,s[1]):"30"==e.substr(s[1],2)&&(i.algparam={},i.algparam.p=t.getVbyList(e,s[1],[0],"02"),i.algparam.q=t.getVbyList(e,s[1],[1],"02"),i.algparam.g=t.getVbyList(e,s[1],[2],"02")),"03"!=e.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return i.key=n(e,o[1]).substr(2),i}});_.getKey=function(e,t,r){var i,a=(y=q).getChildIdx,s=(y.getV,y.getVbyList),l=n.crypto,u=l.ECDSA,c=l.DSA,h=w,p=T,d=_;if(void 0!==h&&e instanceof h)return e;if(void 0!==u&&e instanceof u)return e;if(void 0!==c&&e instanceof c)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new u({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new u({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(k=new h).setPublic(e.n,e.e),k;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(k=new h).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),k;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(k=new h).setPrivate(e.n,e.e,e.d),k;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(k=new c).setPublic(e.p,e.q,e.g,e.y),k;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(k=new c).setPrivate(e.p,e.q,e.g,e.y,e.x),k;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(k=new h).setPublic(E(e.n),E(e.e)),k;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(k=new h).setPrivateEx(E(e.n),E(e.e),E(e.d),E(e.p),E(e.q),E(e.dp),E(e.dq),E(e.qi)),k;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(k=new h).setPrivate(E(e.n),E(e.e),E(e.d)),k;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var f=(O=new u({curve:e.crv})).ecparams.keylen/4,v="04"+("0000000000"+E(e.x)).slice(-f)+("0000000000"+E(e.y)).slice(-f);return O.setPublicKeyHex(v),O}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){f=(O=new u({curve:e.crv})).ecparams.keylen/4,v="04"+("0000000000"+E(e.x)).slice(-f)+("0000000000"+E(e.y)).slice(-f);var m=("0000000000"+E(e.d)).slice(-f);return O.setPublicKeyHex(v),O.setPrivateKeyHex(m),O}if("pkcs5prv"===r){var A,g=e,y=q;if(9===(A=a(g,0)).length)(k=new h).readPKCS5PrvKeyHex(g);else if(6===A.length)(k=new c).readPKCS5PrvKeyHex(g);else{if(!(A.length>2&&"04"===g.substr(A[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(k=new u).readPKCS5PrvKeyHex(g)}return k}if("pkcs8prv"===r)return d.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===r)return d._getKeyFromPublicPKCS8Hex(e);if("x509pub"===r)return j.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return j.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var b=T(e,"PUBLIC KEY");return d._getKeyFromPublicPKCS8Hex(b)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var x=p(e,"RSA PRIVATE KEY");return d.getKey(x,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var M=s(i=p(e,"DSA PRIVATE KEY"),0,[1],"02"),C=s(i,0,[2],"02"),S=s(i,0,[3],"02"),I=s(i,0,[4],"02"),P=s(i,0,[5],"02");return(k=new c).setPrivate(new o(M,16),new o(C,16),new o(S,16),new o(I,16),new o(P,16)),k}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED"))return x=p(e,"EC PRIVATE KEY"),d.getKey(x,null,"pkcs5prv");if(-1!=e.indexOf("-END PRIVATE KEY-"))return d.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var B=d.getDecryptedKeyHex(e,t),R=new w;return R.readPKCS5PrvKeyHex(B),R}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var O,k=s(i=d.getDecryptedKeyHex(e,t),0,[1],"04"),D=s(i,0,[2,0],"06"),L=s(i,0,[3,0],"03").substr(2);if(void 0===n.crypto.OID.oidhex2name[D])throw"undefined OID(hex) in KJUR.crypto.OID: "+D;return(O=new u({curve:n.crypto.OID.oidhex2name[D]})).setPublicKeyHex(L),O.setPrivateKeyHex(k),O.isPublic=!1,O}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED"))return M=s(i=d.getDecryptedKeyHex(e,t),0,[1],"02"),C=s(i,0,[2],"02"),S=s(i,0,[3],"02"),I=s(i,0,[4],"02"),P=s(i,0,[5],"02"),(k=new c).setPrivate(new o(M,16),new o(C,16),new o(S,16),new o(I,16),new o(P,16)),k;if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return d.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},void 0!==n.asn1&&n.asn1||(n.asn1={}),n.asn1.ASN1Util={},n.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",r=parseInt(e.substr(0,2),16),n=(t=Math.floor(r/40)+"."+r%40,""),i=2;i<e.length;i+=2){var a=("00000000"+parseInt(e.substr(i,2),16).toString(2)).slice(-8);n+=a.substr(1,7),"0"==a.substr(0,1)&&(t=t+"."+new o(n,2).toString(10),n="")}return t};var q=new function(){};function H(e){for(var t in n.crypto.Util.DIGESTINFOHEAD){var r=n.crypto.Util.DIGESTINFOHEAD[t],i=r.length;if(e.substring(0,i)==r)return[t,e.substring(i)]}return[]}function j(e){var t,r=q,i=r.getChildIdx,o=r.getV,a=r.getTLV,s=r.getVbyList,l=r.getVbyListEx,u=r.getTLVbyList,c=r.getTLVbyListEx,h=r.getIdxbyList,p=r.getIdxbyListEx,d=r.getVidx,f=r.getInt,v=r.oidname,m=r.hextooidstr,A=T;try{t=n.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var e=u(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=u(e,0,[0]),r=f(t,0);if(r<0||2<r)throw new Error("malformed version field");return this.version=r+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return l(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var r in t)if(e===t[r])return r;return v(l(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=s(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),decodeURIComponent(e)},this.getNotAfter=function(){var e=s(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),decodeURIComponent(e)},this.getPublicKeyHex=function(){return r.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return h(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return h(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return _.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),r=this.getSignatureValueHex(),i=u(this.hex,0,[0],"30"),o=new n.crypto.Signature({alg:t});return o.init(e),o.updateHex(i),o.verify(r)},this.parseExt=function(e){var t,n,a;if(void 0===e){if(a=this.hex,3!==this.version)return-1;t=h(a,0,[0,7,0],"30"),n=i(a,t)}else{a=T(e);var l=h(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=o(a,l))return void(this.aExtInfo=new Array);t=h(a,0,[0,3,0,1,0],"30"),n=i(a,t),this.hex=a}this.aExtInfo=new Array;for(var u=0;u<n.length;u++){var c={critical:!1},p=0;3===i(a,n[u]).length&&(c.critical=!0,p=1),c.oid=r.hextooidstr(s(a,n[u],[0],"06"));var f=h(a,n[u],[1+p]);c.vidx=d(a,f),this.aExtInfo.push(c)}},this.getExtInfo=function(e){var t=this.aExtInfo,r=e;if(e.match(/^[0-9.]+$/)||(r=n.asn1.x509.OID.name2oid(e)),""!==r)for(var i=0;i<t.length;i++)if(t[i].oid===r)return t[i]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("basicConstraints");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"basicConstraints"};if(t&&(n.critical=!0),"3000"===e)return n;if("30030101ff"===e)return n.cA=!0,n;if("30060101ff02"===e.substr(0,12)){var i=o(e,10),s=parseInt(i,16);return n.cA=!0,n.pathLen=s,n}throw new Error("hExtV parse error: "+e)},this.getExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("keyUsage");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"keyUsage"};return t&&(n.critical=!0),n.names=this.getExtKeyUsageString(e).split(","),n},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=a(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var r="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(r=r.slice(-8)),10==e.length&&(r=r.slice(-16)),""==(r=r.replace(/0+$/,""))&&(r="0"),r},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),r=new Array,n=0;n<t.length;n++)"1"==t.substr(n,1)&&r.push(j.KEYUSAGE_NAME[n]);return r.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("subjectKeyIdentifier");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"subjectKeyIdentifier"};t&&(n.critical=!0);var i=o(e,0);return n.kid={hex:i},n},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("authorityKeyIdentifier");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"authorityKeyIdentifier"};t&&(n.critical=!0);for(var s=i(e,0),l=0;l<s.length;l++){var u=e.substr(s[l],2);if("80"===u&&(n.kid={hex:o(e,s[l])}),"a1"===u){var c=a(e,s[l]),h=this.getGeneralNames(c);n.issuer=h[0].dn}"82"===u&&(n.sn={hex:o(e,s[l])})}return n},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("extKeyUsage");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"extKeyUsage",array:[]};t&&(n.critical=!0);for(var s=i(e,0),l=0;l<s.length;l++)n.array.push(v(o(e,s[l])));return n},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,r=a(this.hex,e.vidx);if(""===r)return t;for(var n=i(r,0),s=0;s<n.length;s++)t.push(v(o(r,n[s])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("subjectAltName");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"subjectAltName",array:[]};return t&&(n.critical=!0),n.array=this.getGeneralNames(e),n},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("issuerAltName");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"issuerAltName",array:[]};return t&&(n.critical=!0),n.array=this.getGeneralNames(e),n},this.getGeneralNames=function(e){for(var t=i(e,0),r=[],n=0;n<t.length;n++){var o=this.getGeneralName(a(e,t[n]));void 0!==o&&r.push(o)}return r},this.getGeneralName=function(e){var t=e.substr(0,2),r=o(e,0),n=S(r);return"81"==t?{rfc822:n}:"82"==t?{dns:n}:"86"==t?{uri:n}:"87"==t?{ip:B(r)}:"a4"==t?{dn:this.getX500Name(r)}:void 0},this.getExtSubjectAltName2=function(){var e,t,r,n=this.getExtInfo("subjectAltName");if(void 0===n)return n;for(var s=new Array,l=a(this.hex,n.vidx),u=i(l,0),c=0;c<u.length;c++)r=l.substr(u[c],2),e=o(l,u[c]),"81"===r&&(t=C(e),s.push(["MAIL",t])),"82"===r&&(t=C(e),s.push(["DNS",t])),"84"===r&&(t=j.hex2dn(e,0),s.push(["DN",t])),"86"===r&&(t=C(e),s.push(["URI",t])),"87"===r&&(t=B(e),s.push(["IP",t]));return s},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("cRLDistributionPoints");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"cRLDistributionPoints",array:[]};t&&(n.critical=!0);for(var o=i(e,0),s=0;s<o.length;s++){var l=a(e,o[s]);n.array.push(this.getDistributionPoint(l))}return n},this.getDistributionPoint=function(e){for(var t={},r=i(e,0),n=0;n<r.length;n++){var o=e.substr(r[n],2),s=a(e,r[n]);"a0"==o&&(t.dpname=this.getDistributionPointName(s))}return t},this.getDistributionPointName=function(e){for(var t={},r=i(e,0),n=0;n<r.length;n++){var o=e.substr(r[n],2),s=a(e,r[n]);"a0"==o&&(t.full=this.getGeneralNames(s))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtInfo("cRLDistributionPoints");if(void 0===e)return e;for(var t=new Array,r=i(this.hex,e.vidx),n=0;n<r.length;n++)try{var o=C(s(this.hex,r[n],[0,0,0],"86"));t.push(o)}catch(e){}return t},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},r=i(this.hex,e.vidx),n=0;n<r.length;n++){var o=s(this.hex,r[n],[0],"06"),a=s(this.hex,r[n],[1],"86");"2b06010505073001"===o&&t.ocsp.push(C(a)),"2b06010505073002"===o&&t.caissuer.push(C(a))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("authorityInfoAccess");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"authorityInfoAccess",array:[]};t&&(n.critical=!0);for(var o=i(e,0),u=0;u<o.length;u++){var c=l(e,o[u],[0],"06"),h=C(s(e,o[u],[1],"86"));if("2b06010505073001"==c)n.array.push({ocsp:h});else{if("2b06010505073002"!=c)throw new Error("unknown method: "+c);n.array.push({caissuer:h})}}return n},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("certificatePolicies");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"certificatePolicies",array:[]};t&&(n.critical=!0);for(var o=i(e,0),s=0;s<o.length;s++){var l=a(e,o[s]),u=this.getPolicyInformation(l);n.array.push(u)}return n},this.getPolicyInformation=function(e){var t={},r=s(e,0,[0],"06");t.policyoid=v(r);var n=p(e,0,[1],"30");if(-1!=n){t.array=[];for(var o=i(e,n),l=0;l<o.length;l++){var u=a(e,o[l]),c=this.getPolicyQualifierInfo(u);t.array.push(c)}}return t},this.getPolicyQualifierInfo=function(e){var t={},r=s(e,0,[0],"06");if("2b06010505070201"===r){var n=l(e,0,[1],"16");t.cps=S(n)}else if("2b06010505070202"===r){var i=u(e,0,[1],"30");t.unotice=this.getUserNotice(i)}return t},this.getUserNotice=function(e){for(var t={},r=i(e,0),n=0;n<r.length;n++){var o=a(e,r[n]);"30"!=o.substr(0,2)&&(t.exptext=this.getDisplayText(o))}return t},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=S(o(e,0)),t},this.getExtCRLNumber=function(e,t){var r={extname:"cRLNumber"};if(t&&(r.critical=!0),"02"==e.substr(0,2))return r.num={hex:o(e,0)},r;throw new Error("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var r={extname:"cRLReason"};if(t&&(r.critical=!0),"0a"==e.substr(0,2))return r.code=parseInt(o(e,0),16),r;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var r={extname:"ocspNonce"};t&&(r.critical=!0);var n=o(e,0);return r.hex=n,r},this.getExtOcspNoCheck=function(e,t){var r={extname:"ocspNoCheck"};return t&&(r.critical=!0),r},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var r=this.getExtInfo("adobeTimeStamp");if(void 0===r)return;e=a(this.hex,r.vidx),t=r.critical}var n={extname:"adobeTimeStamp"};t&&(n.critical=!0);var o=i(e,0);if(o.length>1){var s=a(e,o[1]),l=this.getGeneralName(s);null!=l.uri&&(n.uri=l.uri)}if(o.length>2){var u=a(e,o[2]);"0101ff"==u&&(n.reqauth=!0),"010100"==u&&(n.reqauth=!1)}return n},this.getX500NameRule=function(e){for(var t=null,r=[],i=0;i<e.length;i++)for(var o=e[i],a=0;a<o.length;a++)r.push(o[a]);for(i=0;i<r.length;i++){var s=r[i],l=s.ds,u=s.value,c=s.type;if("prn"!=l&&"utf8"!=l&&"ia5"!=l)return"mixed";if("ia5"==l){if("CN"!=c)return"mixed";if(n.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==l)continue;return"mixed"}if(null==t)t=l;else if(t!==l)return"mixed"}return null==t?"prn":t},this.getX500Name=function(e){var t=this.getX500NameArray(e);return{array:t,str:this.dnarraytostr(t)}},this.getX500NameArray=function(e){for(var t=[],r=i(e,0),n=0;n<r.length;n++)t.push(this.getRDN(a(e,r[n])));return t},this.getRDN=function(e){for(var t=[],r=i(e,0),n=0;n<r.length;n++)t.push(this.getAttrTypeAndValue(a(e,r[n])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},r=i(e,0),o=s(e,r[0],[],"06"),a=s(e,r[1],[]),l=n.asn1.ASN1Util.oidHexToInt(o);return t.type=n.asn1.x509.OID.oid2atype(l),t.ds=this.HEX2STAG[e.substr(r[1],2)],"bmp"!=t.ds?t.value=C(a):t.value=function(e){var t=e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),r=parseInt(e.substr(2),16);if(0==t&r<128)return String.fromCharCode(r);if(t<8){var n=128|63&r;return C((192|(7&t)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&t)<<2|(192&r)>>6;var i=128|63&r;return C((224|(240&t)>>4).toString(16)+n.toString(16)+i.toString(16))}));return t.join("")}(a),t},this.readCertPEM=function(e){this.readCertHex(A(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{h(this.hex,0,[0,7],"a3"),this.parseExt()}catch(e){}},this.getParam=function(){var e={};return e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(),e.sbjpubkey=P(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&-1!=p(this.hex,0,[0,"[3]"])&&(e=c(this.hex,0,[0,"[3]",0],"30"));for(var t=[],r=i(e,0),n=0;n<r.length;n++){var o=a(e,r[n]),s=this.getExtParam(o);null!=s&&t.push(s)}return t},this.getExtParam=function(e){var t=i(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var r=m(s(e,0,[0],"06")),n=!1;3==t&&"0101ff"==u(e,0,[1])&&(n=!0);var o=u(e,0,[t-1,0]),a=void 0;if("2.5.29.14"==r?a=this.getExtSubjectKeyIdentifier(o,n):"2.5.29.15"==r?a=this.getExtKeyUsage(o,n):"2.5.29.17"==r?a=this.getExtSubjectAltName(o,n):"2.5.29.18"==r?a=this.getExtIssuerAltName(o,n):"2.5.29.19"==r?a=this.getExtBasicConstraints(o,n):"2.5.29.31"==r?a=this.getExtCRLDistributionPoints(o,n):"2.5.29.32"==r?a=this.getExtCertificatePolicies(o,n):"2.5.29.35"==r?a=this.getExtAuthorityKeyIdentifier(o,n):"2.5.29.37"==r?a=this.getExtExtKeyUsage(o,n):"1.3.6.1.5.5.7.1.1"==r?a=this.getExtAuthorityInfoAccess(o,n):"2.5.29.20"==r?a=this.getExtCRLNumber(o,n):"2.5.29.21"==r?a=this.getExtCRLReason(o,n):"1.3.6.1.5.5.7.48.1.2"==r?a=this.getExtOcspNonce(o,n):"1.3.6.1.5.5.7.48.1.5"==r?a=this.getExtOcspNoCheck(o,n):"1.2.840.113583.1.1.9.1"==r&&(a=this.getExtAdobeTimeStamp(o,n)),null!=a)return a;var l={extname:r,extn:o};return n&&(l.critical=!0),l},this.findExt=function(e,t){for(var r=0;r<e.length;r++)if(e[r].extname==t)return e[r];return null},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var e,t,r,i,o=function(e){for(var t="",r=e.array,n=0;n<r.length;n++){var i=r[n];if(t+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var o=0;o<i.array.length;o++){var a=i.array[o];void 0!==a.cps&&(t+=" cps: "+a.cps+"\n")}}return t},a=function(e){for(var t="",r=e.array,n=0;n<r.length;n++){var i=r[n];try{void 0!==i.dpname.full[0].uri&&(t+=" "+i.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==i.dname.full[0].dn.hex&&(t+=" "+j.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},s=function(e){for(var t="",r=e.array,n=0;n<r.length;n++){var i=r[n];void 0!==i.caissuer&&(t+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(t+=" ocsp: "+i.ocsp+"\n")}return t};if(e="Basic Fields\n",e+=" serial number: "+this.getSerialNumberHex()+"\n",e+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+=" issuer: "+this.getIssuerString()+"\n",e+=" notBefore: "+this.getNotBefore()+"\n",e+=" notAfter: "+this.getNotAfter()+"\n",e+=" subject: "+this.getSubjectString()+"\n",e+=" subject public key info: \n",e+=" key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+=" n="+O(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+O(t.e.toString(16))+"\n"),null!=(r=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var l=0;l<r.length;l++){var u=r[l],c=n.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var h="";if(!0===u.critical&&(h="CRITICAL"),e+=" "+c+" "+h+":\n","basicConstraints"===c){var p=this.getExtBasicConstraints();void 0===p.cA?e+=" {}\n":(e+=" cA=true",void 0!==p.pathLen&&(e+=", pathLen="+p.pathLen),e+="\n")}else if("keyUsage"===c)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===c)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===c){var d=this.getExtAuthorityKeyIdentifier();void 0!==d.kid&&(e+=" kid="+d.kid.hex+"\n")}else"extKeyUsage"===c?e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n":"subjectAltName"===c?e+=" "+(i=this.getExtSubjectAltName(),JSON.stringify(i.array).replace(/[\[\]\{\}\"]/g,"")+"\n"):"cRLDistributionPoints"===c?e+=a(this.getExtCRLDistributionPoints()):"authorityInfoAccess"===c?e+=s(this.getExtAuthorityInfoAccess()):"certificatePolicies"===c&&(e+=o(this.getExtCertificatePolicies()))}}return(e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n")+"signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):n.lang.String.isHex(e)&&this.readCertHex(e))}function G(e){return i.SHA256(e).toString()}q.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var r=parseInt(e.substr(t+3,1));return 0==r?-1:0<r&&r<10?r+1:-2},q.getL=function(e,t){var r=q.getLblen(e,t);return r<1?"":e.substr(t+2,2*r)},q.getVblen=function(e,t){var r;return""==(r=q.getL(e,t))?-1:("8"===r.substr(0,1)?new o(r.substr(2),16):new o(r,16)).intValue()},q.getVidx=function(e,t){var r=q.getLblen(e,t);return r<0?r:t+2*(r+1)},q.getV=function(e,t){var r=q.getVidx(e,t),n=q.getVblen(e,t);return e.substr(r,2*n)},q.getTLV=function(e,t){return e.substr(t,2)+q.getL(e,t)+q.getV(e,t)},q.getTLVblen=function(e,t){return 2+2*q.getLblen(e,t)+2*q.getVblen(e,t)},q.getNextSiblingIdx=function(e,t){return q.getVidx(e,t)+2*q.getVblen(e,t)},q.getChildIdx=function(e,t){var r,n,i,o=q,a=[];r=o.getVidx(e,t),n=2*o.getVblen(e,t),"03"==e.substr(t,2)&&(r+=2,n-=2),i=0;for(var s=r;i<=n;){var l=o.getTLVblen(e,s);if((i+=l)<=n&&a.push(s),s+=l,i>=n)break}return a},q.getNthChildIdx=function(e,t,r){return q.getChildIdx(e,t)[r]},q.getIdxbyList=function(e,t,r,n){var i,o,a=q;return 0==r.length?void 0!==n&&e.substr(t,2)!==n?-1:t:(i=r.shift())>=(o=a.getChildIdx(e,t)).length?-1:a.getIdxbyList(e,o[i],r,n)},q.getIdxbyListEx=function(e,t,r,n){var i,o,a=q;if(0==r.length)return void 0!==n&&e.substr(t,2)!==n?-1:t;i=r.shift(),o=a.getChildIdx(e,t);for(var s=0,l=0;l<o.length;l++){var u=e.substr(o[l],2);if("number"==typeof i&&!a.isContextTag(u)&&s==i||"string"==typeof i&&a.isContextTag(u,i))return a.getIdxbyListEx(e,o[l],r,n);a.isContextTag(u)||s++}return-1},q.getTLVbyList=function(e,t,r,n){var i=q,o=i.getIdxbyList(e,t,r,n);return-1==o||o>=e.length?null:i.getTLV(e,o)},q.getTLVbyListEx=function(e,t,r,n){var i=q,o=i.getIdxbyListEx(e,t,r,n);return-1==o?null:i.getTLV(e,o)},q.getVbyList=function(e,t,r,n,i){var o,a,s=q;return-1==(o=s.getIdxbyList(e,t,r,n))||o>=e.length?null:(a=s.getV(e,o),!0===i&&(a=a.substr(2)),a)},q.getVbyListEx=function(e,t,r,n,i){var o,a,s=q;return-1==(o=s.getIdxbyListEx(e,t,r,n))?null:(a=s.getV(e,o),"03"==e.substr(o,2)&&!1!==i&&(a=a.substr(2)),a)},q.getInt=function(e,t,r){null==r&&(r=-1);try{var n=e.substr(t,2);if("02"!=n&&"03"!=n)return r;var i=q.getV(e,t);return"02"==n?parseInt(i,16):function(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var r=parseInt(t,16),n=e.substr(2),i=parseInt(n,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-r),parseInt(i,2)}catch(e){return-1}}(i)}catch(e){return r}},q.getOID=function(e,t,r){null==r&&(r=null);try{return"06"!=e.substr(t,2)?r:function(e){if(!R(e))return null;try{var t=[],r=e.substr(0,2),n=parseInt(r,16);t[0]=new String(Math.floor(n/40)),t[1]=new String(n%40);for(var i=e.substr(2),o=[],a=0;a<i.length/2;a++)o.push(parseInt(i.substr(2*a,2),16));var s=[],l="";for(a=0;a<o.length;a++)128&o[a]?l+=k((127&o[a]).toString(2),7):(l+=k((127&o[a]).toString(2),7),s.push(new String(parseInt(l,2))),l="");var u=t.join(".");return s.length>0&&(u=u+"."+s.join(".")),u}catch(e){return null}}(q.getV(e,t))}catch(e){return r}},q.getOIDName=function(e,t,r){null==r&&(r=null);try{var i=q.getOID(e,t,r);if(i==r)return r;var o=n.asn1.x509.OID.oid2name(i);return""==o?i:o}catch(e){return r}},q.getString=function(e,t,r){null==r&&(r=null);try{return S(q.getV(e,t))}catch(e){return r}},q.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},r=[],n=e.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var o=e.substr(2),a=[],s=0;s<o.length/2;s++)a.push(parseInt(o.substr(2*s,2),16));var l=[],u="";for(s=0;s<a.length;s++)128&a[s]?u+=t((127&a[s]).toString(2),7):(u+=t((127&a[s]).toString(2),7),l.push(new String(parseInt(u,2))),u="");var c=r.join(".");return l.length>0&&(c=c+"."+l.join(".")),c},q.isContextTag=function(e,t){var r,n;e=e.toLowerCase();try{r=parseInt(e,16)}catch(e){return-1}if(void 0===t)return 128==(192&r);try{return null!=t.match(/^\[[0-9]+\]$/)&&!((n=parseInt(t.substr(1,t.length-1),10))>31)&&128==(192&r)&&(31&r)==n}catch(e){return!1}},q.isASN1HEX=function(e){var t=q;if(e.length%2==1)return!1;var r=t.getVblen(e,0),n=e.substr(0,2),i=t.getL(e,0);return e.length-n.length-i.length==2*r},q.checkStrictDER=function(e,t,r,i,o){var a=q;if(void 0===r){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!n.lang.String.isHex(e))throw new Error("not hex string");r=e.length,o=(i=e.length/2)<128?1:Math.ceil(i.toString(16))+1}if(a.getL(e,t).length>2*o)throw new Error("L of TLV too long: idx="+t);var s=a.getVblen(e,t);if(s>i)throw new Error("value of L too long than hex: idx="+t);var l=a.getTLV(e,t),u=l.length-2-a.getL(e,t).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===t&&e.length!=l.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+l.length);var c=e.substr(t,2);if("02"===c){var h=a.getVidx(e,t);if("00"==e.substr(h,2)&&e.charCodeAt(h+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var p=a.getVblen(e,t),d=0,f=a.getChildIdx(e,t),v=0;v<f.length;v++)d+=a.getTLV(e,f[v]).length,a.checkStrictDER(e,f[v],r,i,o);if(2*p!=d)throw new Error("sum of children's TLV length and L unmatch: "+2*p+"!="+d)}},q.oidname=function(e){var t=n.asn1;n.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var r=t.x509.OID.oid2name(e);return""===r&&(r=e),r},void 0!==n.asn1&&n.asn1||(n.asn1={}),void 0!==n.asn1.x509&&n.asn1.x509||(n.asn1.x509={}),n.asn1.x509.AlgorithmIdentifier={},n.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},n.asn1.x509.OID=new function(e){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var t=this.name2oidList[e],r=new n.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=r,r},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var t;if(e.match(/^\d+\.\d+\.[0-9.]+$/))t=e;else if(void 0!==this.atype2oidList[e])t=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw"AttributeType name undefined: "+e;t=this.name2oidList[e]}var r=new n.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=r,r}},n.asn1.x509.OID.oid2name=function(e){var t=n.asn1.x509.OID.name2oidList;for(var r in t)if(t[r]==e)return r;return""},n.asn1.x509.OID.oid2atype=function(e){var t=n.asn1.x509.OID.atype2oidList;for(var r in t)if(t[r]==e)return r;return e},n.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=n.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},w.getPosArrayOfChildrenFromHex=function(e){return q.getChildIdx(e,0)},w.getHexValueArrayOfChildrenFromHex=function(e){var t,r=q.getV,n=r(e,(t=w.getPosArrayOfChildrenFromHex(e))[0]),i=r(e,t[1]),o=r(e,t[2]),a=r(e,t[3]),s=r(e,t[4]),l=r(e,t[5]),u=r(e,t[6]),c=r(e,t[7]),h=r(e,t[8]);return(t=new Array).push(n,i,o,a,s,l,u,c,h),t},w.prototype.readPrivateKeyFromPEMString=function(e){var t=T(e),r=w.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},w.prototype.readPKCS5PrvKeyHex=function(e){var t=w.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},w.prototype.readPKCS8PrvKeyHex=function(e){var t,r,n,i,o,a,s,l,u=q,c=u.getVbyListEx;if(!1===u.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=c(e,0,[2,0,1],"02"),r=c(e,0,[2,0,2],"02"),n=c(e,0,[2,0,3],"02"),i=c(e,0,[2,0,4],"02"),o=c(e,0,[2,0,5],"02"),a=c(e,0,[2,0,6],"02"),s=c(e,0,[2,0,7],"02"),l=c(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,r,n,i,o,a,s,l)},w.prototype.readPKCS5PubKeyHex=function(e){var t=q,r=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var n=t.getChildIdx(e,0);if(2!==n.length||"02"!==e.substr(n[0],2)||"02"!==e.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=r(e,n[0]),o=r(e,n[1]);this.setPublic(i,o)},w.prototype.readPKCS8PubKeyHex=function(e){var t=q;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var r=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(r)},w.prototype.readCertPubKeyHex=function(e,t){var r,n;(r=new j).readCertHex(e),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},w.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var r=b(t,16),i=this.n.bitLength();if(r.bitLength()>i)return!1;var o=this.doPublic(r).toString(16);if(o.length+3!=i/4)return!1;var a=H(o.replace(/^1f+00/,""));if(0==a.length)return!1;var s,l=a[0];return a[1]==(s=e,n.crypto.Util.hashString(s,l))},w.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=b(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=H(this.doPublic(r).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==e)},w.prototype.verifyPSS=function(e,t,r,i){var o=function(e){return n.crypto.Util.hashHex(e,r)}(I(e));return void 0===i&&(i=-1),this.verifyWithMessageHashPSS(o,t,r,i)},w.prototype.verifyWithMessageHashPSS=function(e,t,r,i){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var a,s=new o(t,16),l=function(e){return n.crypto.Util.hashHex(e,r)},u=S(e),c=u.length,h=this.n.bitLength()-1,p=Math.ceil(h/8);if(-1===i||void 0===i)i=c;else if(-2===i)i=p-c-2;else if(i<-2)throw new Error("invalid salt length");if(p<c+i+2)throw new Error("data too long");var d=this.doPublic(s).toByteArray();for(a=0;a<d.length;a+=1)d[a]&=255;for(;d.length<p;)d.unshift(0);if(188!==d[p-1])throw new Error("encoded message does not end in 0xbc");var f=(d=String.fromCharCode.apply(String,d)).substr(0,p-c-1),v=d.substr(f.length,c),m=65280>>8*p-h&255;if(0!=(f.charCodeAt(0)&m))throw new Error("bits beyond keysize not zero");var A=pss_mgf1_str(v,f.length,l),g=[];for(a=0;a<f.length;a+=1)g[a]=f.charCodeAt(a)^A.charCodeAt(a);g[0]&=~m;var y=p-c-i-2;for(a=0;a<y;a+=1)if(0!==g[a])throw new Error("leftmost octets not zero");if(1!==g[y])throw new Error("0x01 marker not found");return v===S(l(I("\0\0\0\0\0\0\0\0"+u+String.fromCharCode.apply(String,g.slice(-i)))))},w.SALT_LEN_HLEN=-1,w.SALT_LEN_MAX=-2,w.SALT_LEN_RECOVER=-2,j.hex2dn=function(e,t){void 0===t&&(t=0);var r=new j;return q.getTLV(e,t),r.getX500Name(e).str},j.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var r=new Array,n=q.getChildIdx(e,t),i=0;i<n.length;i++)r.push(j.hex2attrTypeValue(e,n[i]));return r=r.map((function(e){return e.replace("+","\\+")})),r.join("+")},j.hex2attrTypeValue=function(e,t){var r=q,i=r.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var o=r.getChildIdx(e,t);2!==o.length||e.substr(o[0],2);var a=i(e,o[0]),s=n.asn1.ASN1Util.oidHexToInt(a);return n.asn1.x509.OID.oid2atype(s)+"="+S(i(e,o[1]))},j.getPublicKeyFromCertHex=function(e){var t=new j;return t.readCertHex(e),t.getPublicKey()},j.getPublicKeyFromCertPEM=function(e){var t=new j;return t.readCertPEM(e),t.getPublicKey()},j.getPublicKeyInfoPropOfCertPEM=function(e){var t,r,n=q.getVbyList,i={algparam:null};return(t=new j).readCertPEM(e),r=t.getPublicKeyHex(),i.keyhex=n(r,0,[1],"03").substr(2),i.algoid=n(r,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=n(r,0,[0,1],"06")),i},j.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var K,W=[(K=new j,K.readCertPEM(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}(":::::ORTV[-PR_aVSVPNaR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.getSubjectHex()===e)return i}}(r,t);return!!n&&!1!==e.verifySignature(n.getPublicKey())&&Y(n,t)}function X(e){return e.getIssuerHex()!==e.getSubjectHex()&&Y(e,W)}!function(e){var t=new j;"string"==typeof e?t.readCertPEM(e):t.readCertHex(e.hex);X(t);W.push(t)}(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}(":::::ORTV[-PR_aVSVPNaR:::::ZVVTU\tPPONrtNVONtVWNW=_SVw\tVE=ZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\bZQNAZaN\\aZ\t[QSnS=\b[aNBZQZ\\aZ\t[QSnZVTaZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tRbZOVTN>bRPtYoTyuoz}}f`Bwo?=RQN\\Ot[cONZO>Wyfd\tgdbRaN]Ot[cONZZPRuupz_@feWyZ`bVfWX|gVup[N^xOSugnec|fdyndB{^T}fdB\0ndRf?FZVVPVwN[Otx\0uxvTF=ON^RSNN\\PNtENZVVPPtXPNtRN?=?]q[VD|{\\oyo`oOu}F\tSAe`tn[t\tu\b8^a]qx\bE_^ZN?[QC\0yuOpybY8r\\RPAS=8rUq\0E8>xean^e\bf]Y`XO}{C[Ur^?\0x[SRXvVQ\\CFr}QnAPRQFO=Yw\0_TePCOFV@|N>ROXcDrT<>bW<ssO?NOT{^s]uU\0gS\bBffsfE\0AfDyQEZR`]XBo|Qw}yYdwwTvOFcBndUz^\\{]\tb=^yQYSTQ`]\0?tR{WRUun\\\0bVe_E|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D\t=obzw?E]Ou]n@>bVzqAQT?@_zo@}CxWVTUsAYdNd?{APQr8{P]]AZ>aR\0[D<z?Tr@`u@X|YDwd_<p<>zWE>]\0=X`\b@uucp|^_Qb@uZouTX^o\0\\{PCq{ug8^f[YQAWad8FNqxFQE?ZOo\t}RnO\bsQc\txyccn=nxvs>bDBf\b\bW\\TuTnvAO^U\0QXC>xx8FxRFf<tJ:::::R[Q-PR_aVSVPNaR:::::"));var J=function(e,t){return J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},J(e,t)};function Z(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}J(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var $=function(){return $=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},$.apply(this,arguments)};function ee(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function te(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function re(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}Object.create,Object.create;var ne,ie=(ne="$$FIVE_EVENT$$","undefined"==typeof Symbol?"$Symbol<".concat(ne,">$"):Symbol(ne));function oe(e){return e[ie]||(e[ie]={}),e[ie]}var ae=function(){function e(){}return e.prototype.hasListener=function(e){var t=oe(this);return t&&t[e]&&t[e].callbacks.length>0},e.prototype.on=function(e,t,r){var n=this,i=oe(this);return i[e]||(i[e]={called:[!1],callbacks:[]}),i[e].callbacks.push([t,r||!1]),function(){return n.off(e,t)}},e.prototype.once=function(e,t){return this.on(e,t,!0)},e.prototype.off=function(e,t){if(void 0!==e){var r=oe(this);if(r[e]||(r[e]={called:[!1],callbacks:[]}),void 0!==t){for(var n=0;n<r[e].callbacks.length&&r[e].callbacks[n][0]!==t;n++);n<r[e].callbacks.length&&r[e].callbacks.splice(n,1)}else r[e].callbacks.length=0}else this[ie]||delete this[ie]},e.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=!1,i=oe(this);i[e]||(i[e]={called:[!1],callbacks:[]}),i[e].called=[!0,t];for(var o=0,a=i[e].callbacks.slice();o<a.length;o++){var s=a[o],l=s[0],u=s[1],c=void 0!==u&&u,h=l.apply(void 0,t);c&&this.off(e,l),!1===h&&(n=!0)}return n},e.prototype.waitUnitl=function(e){var t=this,r=oe(this);r[e]||(r[e]={called:[!1],callbacks:[]});var n=r[e].called,i=n[0],o=n[1];return i?Promise.resolve(o):new Promise((function(r){t.once(e,(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r(e),!0}))}))},e}();function se(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]}var le="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),ue="undefined"!=typeof performance?function(){return le+performance.now()}:function(){return Date.now()};function ce(e){Object.freeze(e);var t="function"==typeof e,r=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach((function(n){!r.call(e,n)||t&&("caller"===n||"callee"===n||"arguments"===n)||null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||Object.isFrozen(e[n])||ce(e[n])})),e}var he=/^([^.]+)(\.([^.]+))*$/;function pe(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function de(e,t){return he.test(e)&&he.test(t)&&function(e,t){if("*"===e)return!0;var r=e.split(".").reverse(),n=t.split(".").reverse();if(r.length<=1)return e===t;for(var i=0;i<r.length;i++)if(r[i]!==n[i])return!1;return!0}(e,t)}var fe,ve=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],me=ce(JSON.parse(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return 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/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"))),Ae=function(e){function t(t,r,n){return e.call(this,"[NETWORK]: request proxy error(type: ".concat(r,", reason: ").concat(n,"): ").concat(t))||this}return Z(t,e),t}(Error),ge=function(e){function t(t,r,n){var i=e.call(this,"[NETWORK]: response error(type: ".concat(r,", status: ").concat(n,"): ").concat(t))||this;return i.httpStatus=n,i}return Z(t,e),t}(Error),ye=(Z((function(e,t){return fe.call(this,"[NETWORK]: request abort(type: ".concat(t,"): ").concat(e))||this}),fe=Error),function(e){function t(t,r,n){return e.call(this,"[NETWORK]: request timeout(type: ".concat(r,", timeout: ").concat(n,"ms): ").concat(t))||this}return Z(t,e),t}(Error)),be=function(e){function t(t,r,n){return e.call(this,"[NETWORK]: request forbidden(type: ".concat(r,", reason: ").concat(n,"): ").concat(t))||this}return Z(t,e),t}(Error);function xe(e){for(var t=0,r=ve;t<r.length;t++){var n=r[t],i=e.match(n);if(i)return"jsonp_"+i[1]}return null}function we(e){return null!==xe(e)}function Me(e){var t=e.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}function Ee(e){if(/^blob\:/i.test(e))return"blob:";if(/^data\:/i.test(e))return"data:";var t=e.match(/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i);return t?t[2]:location.hostname}var Ce=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Z(t,e),t}(ae);function Se(e,t,r,n,i){void 0===t&&(t={}),void 0===r&&(r=se),void 0===n&&(n=se),void 0===i&&(i=se);var o=ue(),a=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(r){var n,i=xe(e)?"Script":"XMLHttpRequest",o=new Ae(a,i,r&&r.message?String(r.message):String(r));return null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,i,"proxy-error",o.message),Promise.reject(o)})).then((function(e){return new Promise((function(s,l){var u,c=t.allowHosts?me.concat(t.allowHosts):me.slice(),h=Ee(e),p=xe(e);if(0!==location.hostname.length&&!pe(location.hostname)&&0===me.filter((function(e){return de(e,location.hostname)})).length&&!pe(h)&&0===c.filter((function(e){return de(e,h)})).length){var d=p?"Script":"XMLHttpRequest",f=new be(e,d,"request host(".concat(h,") is not allowed"));return n(f),l(f),void(null===(u=t.networkSubscribe)||void 0===u||u.emit("network",e,d,"forbidden",f.message))}if(p){var v=window,m=null,A=!1,g=document.createElement("script");v[p]=function(i){var u,c,h=ue(),d=h-o;if(delete v[p],g.parentNode&&g.parentNode.removeChild(g),null!==m&&(window.clearTimeout(m),m=null),!0!==A){if(0!==i.indexOf("data:")){var f=new ge(e,"Script",500);return n(f),l(f),void(null===(u=t.networkSubscribe)||void 0===u||u.emit("network",e,"Script","error",f.message))}var y=i.split(","),b=(y[0].match(/:(.*?);/)||[])[1],x=y[1];if("arraybuffer"===t.responseType||"blob"===t.responseType){for(var w=atob(y[1]),M=w.length,E=new Uint8Array(M),C=0;C<M;C++)E[C]=w.charCodeAt(C);x="arraybuffer"===t.responseType?E.buffer:new Blob([E],{type:b})}var S={body:x,meta:{origin:a,source:e,requestTime:o,responseTime:h,costs:d,headers:{}}};r(S),s(S),null===(c=t.networkSubscribe)||void 0===c||c.emit("network",e,"Script","ok",JSON.stringify(S.meta)),A=!0}},g.src=e,document.body.appendChild(g),"number"==typeof t.timeout&&(m=window.setTimeout((function(){var r;if(m=null,!0!==A){A=!0;var i=new ye(e,"Script",t.timeout||NaN);n(i),l(i),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Script","timeout",i.message)}}),t.timeout))}else{var y=!1,b=new XMLHttpRequest,x=function(){b&&(b.removeEventListener("timeout",w,!1),b.removeEventListener("progress",M,!1),b.removeEventListener("load",E,!1),b.removeEventListener("error",C,!1)),b=null,x=se},w=function(){var r;if(!0!==y){y=!0,x();var i=new ye(e,"XMLHttpRequest",t.timeout||NaN);n(i),l(i),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"XMLHttpRequest","timeout",i.message)}},M=function(e){!0!==y&&e.lengthComputable&&(e.total<=0||i(e.loaded/e.total))},E=function(n){var i;if(!0!==y){var l=this.status;if(0===l||l>=200&&l<400){y=!0,x();var u=ue(),c=u-o,h=function(e){if(!e)return{};for(var t={},r=e.trim().split("\n"),n=0;n<r.length;n++){var i=r[n],o=i.indexOf(":"),a=i.slice(0,o).trim().toLowerCase(),s=i.slice(o+1).trim();s&&(t[a]?t[a]+=", "+s:t[a]=s)}return t}(this.getAllResponseHeaders()),p=n.total,d={body:this.response,meta:{origin:a,source:e,requestTime:o,responseTime:u,costs:c,headers:h,size:p}};r(d),s(d),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","ok",JSON.stringify(d.meta))}else C.call(this)}},C=function(){var r;if(!0!==y){y=!0,x();var i=new ge(e,"XMLHttpRequest",this.status);n(i),l(i),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"XMLHttpRequest","error",i.message)}};b.addEventListener("timeout",w,!1),b.addEventListener("progress",M,!1),b.addEventListener("load",E,!1),b.addEventListener("error",C,!1),t.responseType&&(b.responseType=t.responseType),"number"==typeof t.timeout&&(b.timeout=t.timeout),b.open("GET",e,!0),b.send(null)}}))}))}var Ie={};function Pe(e,t){void 0===t&&(t={});var r=ue(),n=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(r){var i,o=new Ae(n,"Link",r&&r.message?String(r.message):String(r));return null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Link","proxy-error",o.message),Promise.reject(o)})).then((function(e){return e in Ie?Ie[e]:Ie[e]=new Promise((function(i,o){var a,s=t.allowHosts?me.concat(t.allowHosts):me.slice(),l=Ee(e);if(0!==location.hostname.length&&!pe(location.hostname)&&0===me.filter((function(e){return de(e,location.hostname)})).length&&!pe(l)&&0===s.filter((function(e){return de(e,l)})).length){var u=new be(e,"Link","request host(".concat(l,") is not allowed"));return o(u),void(null===(a=t.networkSubscribe)||void 0===a||a.emit("network",e,"Link","forbidden",u.message))}var c=document.createElement("link");c.href=e,c.rel=c.relList&&c.relList.supports("prefetch")?"prefetch":"preload",c.as="fetch",c.crossOrigin="";var h=document.head||document.getElementsByTagName("head")[0];h&&h.appendChild(c);var p=!1;c.onload=function(){var o;if(!0!==p){p=!0,i();var a=ue(),s={origin:n,source:e,requestTime:r,responseTime:a,costs:a-r,headers:{}};null===(o=t.networkSubscribe)||void 0===o||o.emit("network",e,"Link","preload",JSON.stringify(s))}},c.onerror=function(r){var n;if(!0!==p){p=!0;var i=new ge(e,"Link",0);o(i),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Link","error",i.message)}}}))}))}function Te(e,t,r,n,i,o){void 0===t&&(t={}),void 0===r&&(r=se),void 0===n&&(n=se),void 0===i&&(i=se);var a=ue(),s=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(r){var n,i=new Ae(s,"Image",r&&r.message?String(r.message):String(r));return null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Image","proxy-error",i.message),Promise.reject(i)})).then((function(e){return new Promise((function(l,u){var c,h=t.allowHosts?me.concat(t.allowHosts):me.slice(),p=Ee(e);if(0!==location.hostname.length&&!pe(location.hostname)&&0===me.filter((function(e){return de(e,location.hostname)})).length&&!pe(p)&&0===h.filter((function(e){return de(e,p)})).length){var d=new be(e,"Image","request host(".concat(p,") is not allowed"));return n(d),u(d),void(null===(c=t.networkSubscribe)||void 0===c||c.emit("network",e,"Image","forbidden",d.message))}var f=null!=o?o:new Image,v=!1,m=null;"number"==typeof t.timeout&&(m=window.setTimeout((function(){var r;if(f.onload=se,f.onerror=se,m=null,!0!==v){v=!0;var i=new ye(e,"Image",t.timeout);n(i),u(i),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Image","timeout",i.message)}}),t.timeout)),f.onload=function(){var n;if(f.onload=se,f.onerror=se,null!==m&&(clearTimeout(m),m=null),!0!==v){var o=ue();v=!0;var u={body:f,meta:{headers:{},origin:s,source:e,requestTime:a,responseTime:o,costs:o-a}};i(1),r(u),l(u),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Image","ok",JSON.stringify(u.meta))}},f.onerror=function(){var r;if(f.onload=se,f.onerror=se,null!==m&&(clearTimeout(m),m=null),!0!==v){v=!0;var i=new ge(e,"Image",0);n(i),u(i),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Image","ok",i.message)}},i(0),f.src=e}))}))}var Be=function(){if("undefined"!=typeof window){var e=window;return e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame||function(e){return setTimeout(e,16)}}return function(e){return setTimeout(e,16)}}(),Re=16,Oe=function(){function e(){this.frames=[],this.stoped=!1,this.time=ue(),this.context=null,this.loop=this.loop.bind(this),this.loop()}return Object.defineProperty(e,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new e),this.sharedInstance},enumerable:!1,configurable:!0}),e.getFrameTime=function(){return Re},e.prototype.loop=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!this.stoped){var r=ue(),n=r-this.time;this.time=r;var i=[];Re=n;for(var o=0,a=this.frames;o<a.length;o++){var s=a[o];if(s.delay>0)s.delay=s.delay-1;else{try{s.callback.apply(s,re([r,n],e,!1))}catch(e){console.error(e)}s.once&&i.push(s)}}i.length>0&&(this.frames=this.frames.filter((function(e){return-1===i.indexOf(e)}))),this.requestAnimationFrame(this.loop)}},e.prototype.setContext=function(e){this.cancelAnimationFrame(this.requestId),this.context=e,this.requestId=this.requestAnimationFrame(this.loop)},e.prototype.getContext=function(){return this.context},e.prototype.requestAnimationFrame=function(e){return this.context?this.context.requestAnimationFrame(e):Be(e)},e.prototype.cancelAnimationFrame=function(e){this.context?this.context.cancelAnimationFrame(e):function(e){var t;if("undefined"!=typeof window){var r=window;t=r.cancelAnimationFrame||r.mozCancelAnimationFrame||r.webkitCancelAnimationFrame||r.msCancelAnimationFrame||function(e){return window.clearTimeout(e)}}else t=function(e){return window.clearTimeout(e)};t(e)}(this.loop),this.requestId=null},e.prototype.remove=function(e){var t=this.frames.indexOf(e);t>=0&&this.frames.splice(t,1)},e.prototype.add=function(e,t,r,n){var i=this;void 0===t&&(t=!1),void 0===r&&(r=0),void 0===n&&(n=5);var o={callback:e,once:t,delay:r,order:n};return this.frames.push(o),this.frames.sort((function(e,t){return e.order-t.order})),function(){return i.remove(o)}},e.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},e}(),ke={"vrlab-public.ljcdn.com":{type:"tencentCloud",pano:["vrlab-image1.ljcdn.com","vrlab-image2.ljcdn.com"],texture:["vrlab-image3.ljcdn.com"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["vr-image-1.realsee-cdn.cn","vr-image-2.realsee-cdn.cn"],texture:["vr-image-3.realsee-cdn.cn"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"vr-public.rscdn.cn":{type:"tencentCloud",pano:["vr-image-1.rscdn.cn","vr-image-2.rscdn.cn"],texture:["vr-image-3.rscdn.cn"],tile:["vr-tile-1.rscdn.cn","vr-tile-2.rscdn.cn"],model:["vr-model-1.rscdn.cn","vr-model-2.rscdn.cn"],default:["vr-image-4.rscdn.cn"]},"mars-public.realsee-cdn.cn":{type:"aliyun",pano:["mars-image-1.realsee-cdn.cn","mars-image-2.realsee-cdn.cn"],texture:["mars-image-3.realsee-cdn.cn"],tile:["mars-tile-1.realsee-cdn.cn","mars-tile-2.realsee-cdn.cn"],model:["mars-model-1.realsee-cdn.cn","mars-model-2.realsee-cdn.cn"],default:["mars-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{type:"tencentCloud",pano:["global-image-1.realsee-cdn.com","global-image-2.realsee-cdn.com"],texture:["global-image-3.realsee-cdn.com"],tile:["global-tile-1.realsee-cdn.com","global-tile-2.realsee-cdn.com"],model:["global-model-1.realsee-cdn.com","global-model-2.realsee-cdn.com"],default:["global-image-4.realsee-cdn.com"]},"earth-ga-public.realsee-cdn.cn":{type:"tencentCloud",pano:["earth-ga-image-1.realsee-cdn.cn","earth-ga-image-2.realsee-cdn.cn"],texture:["earth-ga-image-3.realsee-cdn.cn"],tile:["earth-ga-tile-1.realsee-cdn.cn","earth-ga-tile-2.realsee-cdn.cn"],model:["earth-ga-model-1.realsee-cdn.cn","earth-ga-model-2.realsee-cdn.cn"],default:["earth-ga-image-4.realsee-cdn.cn"]},"test-vr-public.realsee-cdn.com":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],texture:["test-vr-image.realsee-cdn.com"],tile:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],model:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],texture:["test-vr-image.realsee-cdn.cn"],tile:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],model:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],default:["test-vr-image.realsee-cdn.cn"]}},De=/^https?\:\/\/?([^\/]+)/;function Le(e,t){return e.replace(De,(function(e,r){return e.slice(0,e.length-r.length)+t}))}var Fe=function(e,t){var r,n=e.split("?")[0],i=n.split(".").pop();if("jpeg"===i&&(i="jpg"),"png"!==i&&"jpg"!==i)return e;var o="";if(void 0!==t.format&&t.format!==i&&(o+="/format/".concat(t.format)),void 0!==t.cut&&(o+="/cut/".concat(t.cut[2],"x").concat(t.cut[3],"x").concat(t.cut[0],"x").concat(t.cut[1])),void 0!==t.quality){var a=null!==(r=t.format)&&void 0!==r?r:i;a&&["jpg","webp","tpg","heif","avif"].indexOf(a)>=0&&(o+="/quality/".concat(t.quality))}if(void 0!==t.size){var s=e.match(/\/cube_(\d+)\//);(s?Number(s[1]):NaN)!==Number(t.size)&&(o+="/thumbnail/".concat(t.size,"x"))}return void 0!==t.sharpen&&(o+="/sharpen/".concat(t.sharpen)),o.length&&(o="?imageMogr2"+o),n+o},Qe=function(e,t){var r,n=e.split("?")[0],i=n.split(".").pop();if("jpeg"===i&&(i="jpg"),"png"!==i&&"jpg"!==i)return e;var o="",a=[],s=t.format,l=t.quality,u=t.size;if(void 0!==s&&s!==i&&a.push("format,".concat("heif"===s?"heic":s)),void 0!==t.cut){var c=t.cut,h=c[0],p=c[1],d=c[2],f=c[3];a.push("crop,x_".concat(h,",y_").concat(p,",w_").concat(d,",h_").concat(f,",g_nw"))}if(void 0!==l&&100!==l){var v=null!==(r=t.format)&&void 0!==r?r:i;v&&["jpg","webp"].indexOf(v)>=0&&a.push("quality,Q_".concat(l))}return u&&2048!==u&&a.push("resize,w_".concat(u)),void 0!==t.sharpen&&a.push("sharpen,".concat(t.sharpen)),a.length&&(o="?x-oss-process=image/"+a.join("/")),n+o};function Ne(e,t){var r=$($({},ke),t.mappings),n=function(e){var t=e.match(De);return null===t?null:t[1]}(e);if(null===n)return e;var i=r[n];return i?(e=function(e,t,r){var n=t.split("."),i=n[0],o=n.slice(1);if("texture"===i)return Le(e,r.texture[0]);if("pano"===i||"pano_luminance"===i)switch(o[0],o[1]){case"front":case"left":case"up":return Le(e,r.pano[0]);case"down":case"right":case"back":return Le(e,r.pano[1])}else if("pano_tile"===i||"pano_tile_luminance"===i){o[0],o[1];var a=o[2],s=o[3],l=o[4],u=Math.pow(2,Number(a))*Number(s)+Number(l);if(!isNaN(u))return Le(e,r.tile[u%2])}else if("model"===i){var c=o[0];if(u=Number(c),!isNaN(u))return Le(e,r.model[u%2])}return Le(e,r.default[0])}(e,t.key,i),/\.basis(\?|$)/.test(e)&&(e=e.replace(/\.basis(\?|$)/,".jpg$1")),"tencentCloud"===i.type?Fe(e,t):"aliyun"===i.type?Qe(e,t):e):e}function Ve(e,t,r){void 0===t&&(t=Ne);var n=t(e,r);if(n===e&&r.cut)throw new Error("ImageURL: cut option not applied.");return n}const Ue="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=",ze="data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA";function _e(e){return new Promise((function(t){var r=new Image,n=setTimeout((function(){r.onload=r.onerror=function(){},clearTimeout(n),t(!1)}));r.onload=r.onerror=function(){r.onload=r.onerror=function(){},clearTimeout(n),t(2===r.height)},r.src=e}))}var qe=null;function He(){return qe||(qe=Promise.all([_e(Ue),_e(ze)]).then((function(e){var t=e[0];return{webp:e[1],avif:t}})).catch((function(){return{webp:!1,avif:!1}})))}var je=function(){function t(){this.numPlanes=0,this.clipperPlanes=null,this.clipperFloors=null}return Object.defineProperty(t,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new t),this.sharedInstance},enumerable:!1,configurable:!0}),t.prototype.update=function(t,r){var n;if(this.clipperFloors=[],t instanceof Array){this.clipperPlanes=new Float32Array(24*t.length);for(var i=function(i){var a=[new e.Plane(new e.Vector3(.5,0,0),-1),new e.Plane(new e.Vector3(-.5,0,0),-1),new e.Plane(new e.Vector3(0,.5,0),-1),new e.Plane(new e.Vector3(0,-.5,0),-1),new e.Plane(new e.Vector3(0,0,.5),-1),new e.Plane(new e.Vector3(0,0,-.5),-1)];a.forEach((function(e){e.applyMatrix4(t[i].clippingBoxMatrix)}));for(var s=o.projectPlanes(a,r),l=0;l<24;l++)o.clipperPlanes[24*i+l]=s[l];var u=null!==(n=t[i].floorIndex)&&void 0!==n?n:-1;o.clipperFloors[i]=u},o=this,a=0;a<t.length;a++)i(a)}},t.prototype.projectPlanes=function(t,r){var n=null!==t?t.length:0,i=4*n,o=r.matrixWorldInverse,a=new e.Matrix3;a.getNormalMatrix(o);for(var s=new Float32Array(i),l=new e.Plane,u=0,c=0;u!==n;++u,c+=4)l.copy(t[u]).applyMatrix4(o,a),l.normal.toArray(s,c),s[c+3]=l.constant;return s},t}(),Ge=/^(.*)\[(\d+)\]$/;function Ke(e){if(!isNaN(e.panoIndex)&&isFinite(e.panoIndex))return"".concat(e.workCode,"[").concat(e.panoIndex,"]");throw new Error("Invalid Pano")}function We(e){var t=e.match(Ge);if(t){t[0];var r=t[1],n=t[2],i=Math.floor(Number(n));if(!isNaN(i)&&isFinite(i))return{workCode:r,panoIndex:i}}throw new Error("Invalid PanoId")}function Ye(e,t){return Ke(e)===Ke(t)}function Xe(e){return"string"==typeof e&&Ge.test(e)}var Je,Ze,$e,et=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.needsRender=!0,t}return Z(t,e),t}(e.Group),tt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.needsRender=!0,t}return Z(t,e),t}(e.Mesh),rt=function(){function e(){this.cache={}}return e.prototype.clear=function(){for(var e=0,t=Object.keys(this.cache);e<t.length;e++){var r=t[e],n=this.cache[r];0===n.count?n.dispose():n.count=0}},e.prototype.get=function(e,t){return this.cache[e]||(this.cache[e]=$({count:0},t())),this.cache[e].count++,this.cache[e].value},e}();!function(e){e.FIXED="fixed",e.ADAPTIVE="adaptive"}(Je||(Je={})),function(e){e.SQUARE="square",e.CIRCLE="circle"}(Ze||(Ze={})),function(e){e.RGB="rgb",e.ALTITUDE="altitude"}($e||($e={}));var nt=(new e.TextureLoader).load("http://vrlab-public.ljcdn.com/release/static/image/release/showcenter/simulation/colorMap2.png");nt.minFilter=e.NearestFilter,nt.magFilter=e.NearestFilter,nt.wrapS=e.RepeatWrapping,nt.wrapT=e.RepeatWrapping;var it={pano0:null,pano1:null,floorIndex:-1,modelAlpha:1,opacity:1,progress:0,useBlackTransition:!1,clippers:null,constantColor:null,useEDL:!1,useHQWeight:!1,useHQDepth:!1,pointSizeAdaptiveScale:25,pointSize:1,pointColorType:$e.RGB,pointSizeType:Je.ADAPTIVE,pointShape:Ze.CIRCLE,pointMinSize:1,pointMaxSize:20,gradientTexture:nt},ot=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.needsRender=!0,t}return Z(t,e),t}(e.Points),at=new Set,st=function(e){function t(){var t=e.call(this)||this;return t.needsRender=!0,t.pbmMaterialParametersVersion=0,t.cache=new rt,t.materialParameters=$({},it),t}return Z(t,e),t.prototype.getMaterial=function(){return $({},this.materialParameters)},t.prototype.setMaterial=function(e){Object.assign(this.materialParameters,e),this.pbmMaterialParametersVersion++,this.needsRender=!0},t.prototype.update=function(e,t){var r=this;this.cache.clear(),at.clear(),this.traverse((function(n){if(n instanceof tt&&n.material.forEach((function(n){at.has(n)||(at.add(n),n.pbmMaterialParametersVersion!==r.pbmMaterialParametersVersion&&(n.pbmMaterialParametersVersion=r.pbmMaterialParametersVersion,Object.assign(n,r.materialParameters)),n.update(e,t,r.cache))})),n instanceof ot){if(at.has(n.material))return;at.add(n.material),n.material.pbmMaterialParametersVersion!==r.pbmMaterialParametersVersion&&(n.material.pbmMaterialParametersVersion=r.pbmMaterialParametersVersion,Object.assign(n.material,r.materialParameters)),n.material.update(e,t,r.cache)}}))},t.prototype.dispose=function(){at.clear();var e=[];this.traverse((function(t){if(t instanceof tt&&(t.geometry.dispose(),t.material.forEach((function(t){if(!at.has(t)){at.add(t);var r=t.uniforms;Object.keys(r).map((function(t){if(/^pano\d\_/.test(t))r[t].value=null;else{var n=r[t].value;n&&"function"==typeof n.dispose&&-1===e.indexOf(n)&&(r[t].value=null,e.push(n))}})),t.dispose()}}))),t instanceof ot){if(t.geometry.dispose(),at.has(t.material))return;at.add(t.material),t.material.dispose()}})),e.forEach((function(e){return e.dispose()}))},t}(e.Group),lt=["right","left","up","down","front","back"];function ut(t,r,n,i){var o=new e.Box3;switch(t){case"up":o.min.y=.5,o.max.y=.5,o.min.x=+r-.5,o.max.x=+r-.5+i,o.min.z=.5-n-i,o.max.z=.5-n;break;case"down":o.min.y=-.5,o.max.y=-.5,o.min.x=+r-.5,o.max.x=+r-.5+i,o.min.z=+n-.5,o.max.z=+n-.5+i;break;case"left":o.min.x=-.5,o.max.x=-.5,o.min.z=.5-r-i,o.max.z=.5-r,o.min.y=.5-n-i,o.max.y=.5-n;break;case"right":o.min.x=.5,o.max.x=.5,o.min.z=+r-.5,o.max.z=+r-.5+i,o.min.y=.5-n-i,o.max.y=.5-n;break;case"front":o.min.z=-.5,o.max.z=-.5,o.min.x=+r-.5,o.max.x=+r-.5+i,o.min.y=.5-n-i,o.max.y=.5-n;break;case"back":o.min.z=.5,o.max.z=.5,o.min.x=.5-r-i,o.max.x=.5-r,o.min.y=.5-n-i,o.max.y=.5-n}return o.applyMatrix4((new e.Matrix4).makeRotationY(Math.PI))}var ct=function(t,r){if(!(t.level>=r))for(var n=t.level+1,i=t.size/2,o=0,a=[new e.Vector2(t.position.x,t.position.y),new e.Vector2(t.position.x+i,t.position.y),new e.Vector2(t.position.x,t.position.y+i),new e.Vector2(t.position.x+i,t.position.y+i)];o<a.length;o++){var s=a[o],l={face:t.face,level:n,size:i,position:s,box:ut(t.face,s.x,s.y,i),children:[]};t.children.push(l),ct(l,r)}};function ht(t){var r=lt.map((function(r){return function(t,r){var n={level:0,face:t,position:new e.Vector2(0,0),size:1,box:ut(t,0,0,1),children:[]};return ct(n,r),n}(r,t)}));return{children:r}}function pt(e,t){for(var r=0,n=e.children;r<n.length;r++){var i=n[r];!1!==t(i)&&pt(i,t)}}var dt=new e.BoxBufferGeometry(1,1,1,1,1);dt.deleteAttribute("uv"),dt.deleteAttribute("normal"),dt.groups=[],dt.scale(-1,1,1);var ft=new e.ShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\nvarying vec3 worldPosition;\nvoid main() {\n vec4 transform = vec4(position, 1.0);\n worldPosition = (modelMatrix * transform).xyz;\n gl_Position = projectionMatrix * modelViewMatrix * transform;\n}\n",fragmentShader:"\nuniform samplerCube map;\nvarying vec3 worldPosition;\nvoid main() {\n gl_FragColor = textureCube(map, worldPosition);\n}\n",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:e.NoBlending,lights:!1,toneMapped:!1,fog:!1}),vt=new e.Scene;vt.matrixAutoUpdate=!1;var mt,At=new e.Mesh(dt,ft);function gt(t,r,n){ft.uniforms.map.value=t;var i=n.autoClear;n.autoClear=!1;var o=new e.CubeCamera(.1,2,r);o.matrixAutoUpdate=!1,o.update(n,vt),n.autoClear=i,ft.uniforms.map.value=null}At.matrixAutoUpdate=!1,vt.add(At);var yt=null!==(mt=Math.SQRT1_2)&&void 0!==mt?mt:Math.sqrt(2),bt={up:new e.Quaternion(yt,0,0,yt),down:new e.Quaternion(-yt,0,0,yt),left:new e.Quaternion(0,yt,0,yt),right:new e.Quaternion(0,-yt,0,yt),front:new e.Quaternion(0,0,0,1),back:new e.Quaternion(0,1,0,0)},xt=function(){var t=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),r=new Float32Array([0,0,1,0,0,1,1,1]),n=new Uint8Array([0,1,2,1,3,2]),i=new e.BufferGeometry;return i.setAttribute("position",new e.BufferAttribute(t,3)),i.setAttribute("uv",new e.BufferAttribute(r,2)),i.setIndex(new e.BufferAttribute(n,1)),i}(),wt=[];function Mt(e){e.uniforms.map.value=null,wt.push(e)}var Et=[],Ct=0;Oe.shared.add((function(){if(Ct=6,Et.length)for(var e=0,t=Et.splice(0,Ct);e<t.length;e++){var r=t[e];Ct--,r()}}));var St="undefined"!=typeof createImageBitmap;function It(){var e=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){e.onerror=e.onload=e.close=se,e.removeAttribute("src"),/^blob\:/.test(e.src)&&URL.revokeObjectURL(e.src)}});return e}function Pt(e){return new Promise((function(t){Et.push((function(){t(function(e){return St?createImageBitmap(e):new Promise((function(t,r){var n=It();n.onload=function(){n.onload=n.onerror=se,setTimeout((function(){t(n)}),0)},n.onerror=function(){var e=n.src;n.onload=n.onerror=se,n.close(),r(new Error("image load error: ".concat(e)))},n.src=URL.createObjectURL(e)}))}(e))}))}))}var Tt=[];function Bt(t,r){if(r&&(t.width>r.width||t.height>r.height)){var n=function(e,t){var r=Tt.shift();if(r)return r.width=e,r.height=t,r;var n=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){n.close=se,Tt.push(n)}});return n}(Math.min(t.width,r.width),Math.min(t.height,r.height)),i=n.getContext("2d");i.clearRect(0,0,n.width,n.height),i.drawImage(t,0,0,n.width,n.height),t.close();var o=new e.Texture(n);o.needsUpdate=!0,o.flipY=!0;var a=o.dispose;return o.dispose=function(){n.close(),a.call(o),o.dispose=a},o}var s=new e.Texture(t);s.needsUpdate=!0,t instanceof ImageBitmap?s.flipY=!1:s.flipY=!0;var l=s.dispose;return s.dispose=function(){t.close(),l.call(s),s.dispose=l},s}var Rt=["right","left","up","down","front","back"],Ot=function(){function t(e,t,r,n,i){this.tileTree=t,this.tileSources=r,this.options=n,this.renderer=i,this.name="",this.needsRender=!1,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.textures=[],this.baseCubeTexture=e}return Object.defineProperty(t.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var r,n,i,o,a;if(null===t)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=null!==(r=this.options.format)&&void 0!==r?r:e.RGBAFormat,t.texture.minFilter=null!==(n=this.options.minFilter)&&void 0!==n?n:e.LinearFilter,t.texture.magFilter=null!==(i=this.options.magFilter)&&void 0!==i?i:e.LinearFilter,t.texture.wrapS=null!==(o=this.options.wrapS)&&void 0!==o?o:e.ClampToEdgeWrapping,t.texture.wrapT=null!==(a=this.options.wrapT)&&void 0!==a?a:e.ClampToEdgeWrapping,this.baseCubeTexture&&(gt(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&>(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),t.prototype.requestTile=function(t){var r,n,i,o,a,s,l=this,u=this.tileSources.filter((function(e){return e.level===t.level}))[0];if(u){var c=u.size,h=Math.pow(2,t.level)*t.position.y,p=Math.pow(2,t.level)*t.position.x,d="".concat((null!==(i=null===(n=null===(r=this.options.imageURL)||void 0===r?void 0:r.options)||void 0===n?void 0:n.key)&&void 0!==i?i:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(h,".").concat(p),f=$($({},null!==(a=null===(o=this.options.imageURL)||void 0===o?void 0:o.options)&&void 0!==a?a:{key:"unknown"}),{key:d,size:c*t.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[c*t.position.x,c*t.position.y,c*t.size,c*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(u[t.face],{imageURL:{transform:null===(s=this.options.imageURL)||void 0===s?void 0:s.transform,options:$({},f)},format:e.RGBAFormat,viaAjax:St,allowHosts:this.options.allowHosts,networkSubscribe:this.options.networkSubscribe,requestProxy:this.options.requestProxy}).then((function(r){l.disposed?r.body.dispose():(l.textures.push({face:t.face,level:t.level,position:t.position,size:new e.Vector2(t.size,t.size),texture:r.body,flipY:!r.body.flipY}),l.loadedCubeNodes.add(t))})).catch(se).then((function(){l.disposed||l.loadingCubeNodes.delete(t)}))}else this.loadedCubeNodes.add(t)},t.prototype.update=function(t,r){var n=this;if(!this.disposed){var i=[];pt(this.tileTree,(function(e){return!n.loadingCubeNodes.has(e)&&!(e.level>r)&&!!t.intersectsBox(e.box)&&(n.loadedCubeNodes.has(e)?void 0:(i.push(e),!1))}));for(var o=0,a=i;o<a.length;o++){var s=a[o];this.requestTile(s)}if(this.cubeRenderTarget&&this.textures.length){var l=this.textures.splice(0,4);!function(t,r,n){var i=new e.Scene;i.matrixAutoUpdate=!1;var o=new e.Group;o.scale.set(1,1,-1),i.add(o);for(var a=[],s=0,l=t;s<l.length;s++){var u=l[s],c=wt.pop()||new e.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:"\nvarying vec2 vUv;\nuniform float flipY;\nvoid main() {\n vUv = vec2(uv.x, mix(uv.y, (1.0 - uv.y), flipY));\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform sampler2D map;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n}\n",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:e.NoBlending,lights:!1,toneMapped:!1,fog:!1});a.push(c),c.uniforms.map.value=u.texture,c.uniforms.flipY.value=u.flipY?1:0;var h=new e.Group,p=new e.Mesh(xt,c);p.position.set(u.position.x+u.size.x/2-.5,1-(u.position.y+u.size.y/2)-.5,-.5),p.scale.set(u.size.x,u.size.y,1),h.quaternion.copy(bt[u.face]),h.add(p),o.add(h)}var d=n.autoClear;n.autoClear=!1;var f=new e.CubeCamera(.1,2,r);f.matrixAutoUpdate=!1,f.update(n,i),n.autoClear=d;for(var v=0,m=a;v<m.length;v++)Mt(c=m[v])}(l,this.cubeRenderTarget,this.renderer),this.needsRender=!0;for(var u=0,c=l;u<c.length;u++)c[u].texture.dispose()}}},Object.defineProperty(t.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var e=0,t=this.textures;e<t.length;e++)t[e].texture.dispose();this.textures.length=0}},t}(),kt=function(){function t(){}return t.prototype.loadTexture=function(e,t,r,n,i,o){var a,s,l,u;void 0===t&&(t={}),void 0===r&&(r=se),void 0===n&&(n=se),void 0===i&&(i=se);var c={};void 0!==t.flipY&&(c.flipY=t.flipY),void 0!==t.format&&(c.format=t.format),void 0!==t.minFilter&&(c.minFilter=t.minFilter),void 0!==t.magFilter&&(c.magFilter=t.magFilter);var h=null!==(s=null===(a=t.imageURL)||void 0===a?void 0:a.options)&&void 0!==s?s:{key:"unknown"},p=Me(e=Ve(e,null===(l=t.imageURL)||void 0===l?void 0:l.transform,h)),d={timeout:t.timeout,allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe},f=null!==(u=t.viaAjax)&&void 0!==u&&u,v=we(e),m=/^https?:/.test(p);if(v?f=!0:m||(f=!1),f)return Se(e,$($({},d),{responseType:"blob"}),void 0,void 0,i).then((function(e){return Pt(e.body)})).then((function(e){return Bt(e,t.maxSize)})).then((function(e){return Object.assign(e,c),e})).then((function(e){var t={meta:null,body:e};return r(t),t})).catch((function(e){return n(e),Promise.reject(e)}));var A,g=null;return Promise.resolve().then((function(){return It()})).then((function(t){return A=t,Te(e,d,void 0,void 0,i,t)})).then((function(e){return g=e.meta,Bt(e.body,t.maxSize)})).then((function(e){return Object.assign(e,c),e})).then((function(e){var t={meta:g,body:e};return r(t),t})).catch((function(e){return A&&A.close(),n(e),Promise.reject(e)}))},t.prototype.loadCubeTexture=function(t,r,n,i,o,a){var s,l,u,c;void 0===r&&(r={}),void 0===n&&(n=se),void 0===i&&(i=se),void 0===o&&(o=se);var h={};void 0!==r.format&&(h.format=r.format),void 0!==r.minFilter&&(h.minFilter=r.minFilter),void 0!==r.magFilter&&(h.magFilter=r.magFilter);for(var p=[t[Rt[0]],t[Rt[1]],t[Rt[2]],t[Rt[3]],t[Rt[4]],t[Rt[5]]],d={timeout:r.timeout,allowHosts:r.allowHosts,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe},f=[],v=[0,0,0,0,0,0],m=[],A=function(e){var t=null!==(l=null===(s=r.imageURL)||void 0===s?void 0:s.options)&&void 0!==l?l:{key:"unknown"},n=Ve(p[e],null===(u=r.imageURL)||void 0===u?void 0:u.transform,$($({},t),{key:t.key+"."+Rt[e]})),i=Me(n),a=function(t){v[e]=t,o(v.reduce((function(e,t){return e+t}),0)/6)},h=null!==(c=r.viaAjax)&&void 0!==c&&c,A=/^https?:$/.test(i);if(we(n)?h=!0:A||(h=!1),h){var g=Se(n,$($({},d),{responseType:"blob"}),void 0,void 0,a).then((function(t){return m[e]=t.meta,Pt(t.body)}));f.push(g)}else{var y;g=Promise.resolve().then((function(){return It()})).then((function(e){return y=e,Te(n,d,void 0,void 0,a,e)})).then((function(t){return m[e]=t.meta,t.body})).catch((function(e){return y&&y.close(),Promise.reject(e)})),f.push(g)}},g=0;g<6;g++)A(g);return Promise.all(f).then((function(t){return function(t){var r=new e.CubeTexture(t);r.needsUpdate=!0,r.flipY=!1;var n=r.dispose;return r.dispose=function(){for(var e=0,i=t;e<i.length;e++)i[e].close();n.call(r),r.dispose=n},r}(t)})).then((function(t){return Object.assign(t,$({encoding:e.sRGBEncoding},r)),t})).then((function(e){var t={body:e,meta:m};return n(t),t})).catch((function(e){for(var t=0,r=f;t<r.length;t++)r[t].then((function(e){return e.close()})).catch(se);return i(e),Promise.reject(e)}))},t.prototype.loadTiledCubeTexture=function(t,r,n,i,o,a,s){var l=this;return void 0===n&&(n={}),void 0===i&&(i=se),void 0===o&&(o=se),void 0===a&&(a=se),new Promise((function(u,c){var h,p;l.loadCubeTexture(t,{imageURL:{transform:null===(h=n.imageURL)||void 0===h?void 0:h.transform,options:null===(p=n.imageURL)||void 0===p?void 0:p.options},format:e.RGBAFormat,viaAjax:n.viaAjax},(function(e){var t,o,a=e.meta,c=e.body,h=null!==(t=n.tileImageSize)&&void 0!==t?t:512,p=null!==(o=n.tileMaxLevel)&&void 0!==o?o:2,d=Math.max(1024*p,512),f=ht(p),v={meta:a,body:new Ot(c,f,r,{textureSize:d,tileImageSize:h,textureLoader:l,imageURL:n.imageURL,networkSubscribe:n.networkSubscribe,allowHosts:n.allowHosts,timeout:n.timeout},s)};i(v),u(v)}),(function(e){o(e),c(e)}),a,s).catch(se)}))},t}();const Dt=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("nvor-sy|n-sy||Hnvor-sy|n-znxHn\bv{t-sy|n-Sy||Hn\bv{t-sy|n-ZnxHn\bv{t-rp@-[|znyHn\bv{t-rp@-cvr]|vv|{Hn\bv{t-rpA-|yq]|vv|{Hn\bv{t-sy|n-Y|tQr}uH0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrrK0v{pyqr-I?l}nlrrK0v{pyqr-Ip|y|l}nlrrK0v{pyqr-Iunq|zn}l}nlrrK|vq-znv{56-\n--0v{pyqr-IlrrK--0v{pyqr-I?lrrK--0v{pyqr-Ip|y|lrrK--0v{pyqr-Iortv{{|znylrrK--0v{pyqr-Iqrsny{|znylrrK--rpA-n{s|zrq-J-rpA5}|vv|{9->;=6H--rpA-z]|vv|{-J-z|qrycvrZnv-7-n{s|zrqH--[|zny-J-{|znyv\tr5n{s|zrq[|zny6H--Sy||-J-sy||H--Znx-J-znxH--cvr]|vv|{-J-:z]|vv|{;\b\tH--|yq]|vv|{-J-z|qryZnv-7-n{s|zrqH--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-n{s|zrqH--0v{pyqr-Iunq|zn}lrrK--Y|tQr}u-J-y|t?5:z]|vv|{;\t6H\f"),Lt=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=60qrsv{r-aNb-C;?E@>EB?{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-rp@-qvssrH{vs|z-rp@-rzvvrH{vs|z-rp@-}rpynH{vs|z-sy|n-uv{v{rH{vs|z-sy|n-r}|rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH{vs|z-sy|n-sy||V{qrH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6--{vs|z-rp?-}n{|cvqr|lv\trH--{vs|z-znA-}n{|cvqr|lznvH--{vs|z-sy|n-}n{|cvqr|lny}unH--{vs|z-nz}yr?Q-}n{|cvqr|lzn}H0r{qvs0vs-qrsv{rq5b`RlPYV]SY\\\\_6--{vs|z-rp@-sy||V{s|H0r{qvs0vs-qrsv{rq5[bZlPYV]]V[TlO\\e6--{vs|z-sy|n-pyv}}rSy||h[bZlPYV]]V[TlO\\ejH--{vs|z-nz}yr?Q-pyv}}r]yn{rarrH0r{qvsn\bv{t-sy|n-Sy||Hn\bv{t-sy|n-ZnxHn\bv{t-rpA-|yq]|vv|{Hn\bv{t-sy|n-Y|tQr}uH0v{pyqr-Ip|zz|{K0v{pyqr-I}npxv{tK0v{pyqr-Ip|y|l}nlsntzr{K0v{pyqr-Il}nlsntzr{K0v{pyqr-I?l}nlsntzr{K0v{pyqr-Izn}l}nlsntzr{K0v{pyqr-Iny}unzn}l}nlsntzr{K0v{pyqr-In|zn}l}nlsntzr{K0v{pyqr-Iyvtuzn}l}nlsntzr{K0v{pyqr-Irzvvrzn}l}nlsntzr{K0v{pyqr-Ir{zn}l}nlsntzr{K0v{pyqr-Itnqvr{zn}l}nlsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-IoqsK0v{pyqr-Iyvtul}nlortv{K0v{pyqr-Iyvtul}u|{tl}nlsntzr{K0v{pyqr-Iunq|zn}l}nlsntzr{Krp?-|P||q5rp@-rp|6-\n--sy|n--J-yr{tu5rp|6H--sy|n-urn-J-np|5rp|;\b-<-6H--sy|n-}uv-J-nn{5rp|;9-rp|;\t6H--r{-rp?5=;B-8-}uv-<-aNb9-urn-<-]V6H\f|vq-znv{56-\n--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9->;=6H----r{H--0r{qvs--vs-5q|5cvr]|vv|{9-[|zny6-I-=;=6-\n----qvpnqH--\f--<<前置裁切计算--0vs-qrsv{rq5[bZlPYV]]V[TlO\\e6----rpA-}yn{rH----s|5-v{-v-J-=H-v-I-[bZlPYV]]V[TlO\\eH-v886\n------o||y-pyv}}rq-J-rH------v{-pr{Sy||-J-v{5pyv}}rSy||hvj6H------<<内部展开s|循环,让v{q|能用------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C-8->6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C-8-?6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C-8-@6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C-8-A6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C-8-B6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------o||y-v{antrSy||-J-no5Sy||-:-sy|n5pr{Sy||66-I->;=H------pyv}}rq-J-5pr{Sy||-JJ-:>-\v\v-v{antrSy||6-33-pyv}}rqH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f--0r{qvs--<<楼层切割计算--sy|n-sy||\\}npv\b-J->;=H--vs-5sy||V{qr-KJ-=;=-33-no5Sy||-:-sy|n5sy||V{qr66-KJ->;=6-\n----sy||\\}npv\b-J-=;>H--\f--rpA-qvssrP|y|-J-rpA5qvssr;to9-|}npv\b6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5rp@5=;=69-rp@5=;=69-rp@5=;=69-rp@5=;=66H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--<<-调整曝光值--vnqvn{pr-J-vnqvn{pr-7-r}|rH--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--0v{pyqr-In|zn}lsntzr{K--<<-减少方向光对模型的影响--rp@-|t|v{tYvtu-J-5rsyrprqYvtu;qvrpQvssr-7-=;?6-8----rsyrprqYvtu;v{qvrpQvssr-8----rsyrprqYvtu;v{qvrp`}rpyn-8----|nyRzvvr_nqvn{prH--<<-修复黑色面片的问题--vs-5|t|v{tYvtu;-K-=;=-\v\v-|t|v{tYvtu;t-K-=;=-\v\v-|t|v{tYvtu;o-K-=;=6-\n----tylSntP|y|-J-rpA5|t|v{tYvtu9-qvssrP|y|;n6H--\f-ryr-\n----tylSntP|y|-J-rpA5OYNPXlP\\Y\\_;\b\t9-qvssrP|y|;n6H--\f--rp@-}n{|=a|crr-J-5|yq]|vv|{;\b\t-:-}n{|=lznvh@j;\b\t6-7-zn@5}n{|=lznv6H--rp@-}n{|>a|crr-J-5|yq]|vv|{;\b\t-:-}n{|>lznvh@j;\b\t6-7-zn@5}n{|>lznv6H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-rrPor5}n{|=lzn}9-}n{|=a|crr6H--rpA-}n{|>P|y|-J-rrPor5}n{|>lzn}9-}n{|>a|crr6H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-rrPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr6;H----}n{|>P|y|;n-J->;=-:-rrPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr6;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv5}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv5}n{|P|y|9-}n{|>P|y|9-zn5=;=9-oynpx]|tr-:-?;=66H--0ryr----}n{|P|y|-J-zv5}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6----rp@-pnzrna|crr-J-|yq]|vv|{;\b\t-:-pnzrn]|vv|{H----rpA-zn}P||q-J-rpA5pnzrna|crr9->;=6-7-}n{|cvqr|lznvH----rp?--J-rp?5------=;B-8-zn}P||q;-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;9------=;B-:-zn}P||q;\b-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;\b----6H----rpA-vqr|P|y|-J-rr?Q5}n{|cvqr|lzn}9-6H----sy|n-znpu-J-5>;=-:-r}5=;=9-zn}P||q;\t66-7-5>;=-:-r}5=;B9-no5;-:-=;B666-7-5>;=-:-r}5=;B9-no5;\b-:-=;B666H----sy|n-ny}un-J-pynz}5=;=9->;=9-B;=-7-5>;=-:-pynz}5qvn{pr59-rp?5=;B9-=;B66-<-=;BB-9-=;=9->;=666H----}n{|P|y|-J-zv5}n{|P|y|9-vqr|P|y|9-znpu-7-ny}un-7-}n{|cvqr|lny}un6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\l\\]NPVaf6----tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H----tylSntP|y|;n-J-|}npv\bH--0ryr----tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b-7-sy||\\}npv\b6H----tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f");var Ft=new e.WebGLCubeRenderTarget(1).texture;Ft.name="EMPTY_TEXTURE";var Qt=Object.assign({modelAlpha:new e.Uniform(0),progress:new e.Uniform(0),pano0_map:new e.Uniform(Ft),pano0_luminanceMap:new e.Uniform(null),pano0_matrix:new e.Uniform(new e.Matrix4),pano1_map:new e.Uniform(Ft),pano1_luminanceMap:new e.Uniform(null),pano1_matrix:new e.Uniform(new e.Matrix4),floorIndex:new e.Uniform(-1),clipperPlanesTexture:new e.Uniform(null),clipperFloors:new e.Uniform([]),constantColor:new e.Uniform(null)},{exposure:new e.Uniform(1),emissive:new e.Uniform(new e.Color(0)),emissiveMap:new e.Uniform(null),specular:new e.Uniform(new e.Color(1118481)),specularMap:new e.Uniform(null),normalMap:new e.Uniform(null),bumpMap:new e.Uniform(null),shininess:new e.Uniform(30)},e.UniformsUtils.clone(e.UniformsLib.common),e.UniformsUtils.clone(e.UniformsLib.lights)),Nt=function(t){function r(r){void 0===r&&(r={});var n,i,o,a,s,l,u,c,h,p,d,f,v,m,A,g,y,b=this;(b=t.call(this,{vertexShader:Dt,fragmentShader:Lt,uniforms:e.UniformsUtils.clone(Qt),defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_POINT_NORMAL:!1,USE_POINT_CIRCLE:!1,USE_POINT_ADAPTIVE_SIZE:!1,USE_POINT_COLOR_ALTITUDE:!1},lights:!0})||this).pbmMaterialParametersVersion=0;var x=null,w=null;return Object.defineProperties(b,{pano0:{get:function(){return x},set:function(e){if(x!==e){x=e,null===e?(this.uniforms.pano0_map.value=Ft,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=e.map instanceof Ot?e.map.texture:e.map,this.uniforms.pano0_luminanceMap.value=e.luminanceMap instanceof Ot?e.luminanceMap.texture:e.luminanceMap,this.uniforms.pano0_matrix.value.copy(e.matrix));var t=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==t&&(this.defines.USE_LUMINANCE=t,this.needsUpdate=!0)}}},pano1:{get:function(){return w},set:function(e){if(w!==e){w=e,null===e?(this.uniforms.pano1_map.value=Ft,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=e.map instanceof Ot?e.map.texture:e.map,this.uniforms.pano1_luminanceMap.value=e.luminanceMap instanceof Ot?e.luminanceMap.texture:e.luminanceMap,this.uniforms.pano1_matrix.value.copy(e.matrix));var t=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==t&&(this.defines.USE_LUMINANCE=t,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(e){this.uniforms.modelAlpha.value=e}},progress:{get:function(){return this.uniforms.progress.value},set:function(e){this.uniforms.progress.value=e}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(e){this.defines.USE_BLACK_TRANSITION!==e&&(this.defines.USE_BLACK_TRANSITION=e,this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(e){this.uniforms.constantColor.value=e;var t=null!==e;this.defines.USE_CONSTANT_COLOR!==t&&(this.defines.USE_CONSTANT_COLOR=t,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},floorIndex:{get:function(){return this.uniforms.floorIndex.value},set:function(e){this.uniforms.floorIndex.value=e}},clippers:{get:function(){return y},set:function(e){y=e}},clipperFloors:{get:function(){return this.uniforms.clipperFloors.value},set:function(e){this.uniforms.clipperFloors.value=e}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(e){e!==this.defines.USE_EDL&&(this.defines.USE_EDL=e,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(e){e!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=e,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(e){e!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=e,this.needsUpdate=!0)}}}),b.pano0=null!==(n=r.pano0)&&void 0!==n?n:null,b.pano1=null!==(i=r.pano1)&&void 0!==i?i:null,b.modelAlpha=null!==(o=r.modelAlpha)&&void 0!==o?o:1,b.progress=null!==(a=r.progress)&&void 0!==a?a:0,b.useBlackTransition=null!==(s=r.useBlackTransition)&&void 0!==s&&s,b.constantColor=null!==(l=r.constantColor)&&void 0!==l?l:null,b.opacity=null!==(u=r.opacity)&&void 0!==u?u:1,b.floorIndex=null!==(c=r.floorIndex)&&void 0!==c?c:-1,b.clippers=null,b.useEDL=!1,b.useHQWeight=!1,b.useHQDepth=!1,b.pointSizeAdaptiveScale=null!==(h=r.pointSizeAdaptiveScale)&&void 0!==h?h:25,b.pointSize=null!==(p=r.pointSize)&&void 0!==p?p:1,b.pointColorType=null!==(d=r.pointColorType)&&void 0!==d?d:$e.ALTITUDE,b.pointSizeType=null!==(f=r.pointSizeType)&&void 0!==f?f:Je.ADAPTIVE,b.pointShape=null!==(v=r.pointShape)&&void 0!==v?v:Ze.CIRCLE,b.pointMinSize=null!==(m=r.pointMinSize)&&void 0!==m?m:2,b.pointMaxSize=null!==(A=r.pointMaxSize)&&void 0!==A?A:5,b.gradientTexture=null!==(g=r.gradientTexture)&&void 0!==g?g:null,b}return Z(r,t),r.prototype.update=function(t,r,n){this.transparent=this.floorIndex>-1||this.opacity<1,this.blending=this.transparent?e.NormalBlending:e.NoBlending;var i=this.clippers,o="clippers:".concat(JSON.stringify(i?{clippers:i,cameraMatrix:r.matrixWorld}:null)),a=n.get(o,(function(){var t=null,n=null;i&&i.length&&(je.shared.update(i,r),t=je.shared.clipperPlanes,n=je.shared.clipperFloors);var o=i?i.length:0,a=t?new e.DataTexture(t,length,1,e.RGBAFormat,e.FloatType):null;return{value:{boxCount:o,clipperPlanesTexture:a,clipperFloors:n},dispose:function(){a&&a.dispose()}}})),s=a.boxCount,l=a.clipperPlanesTexture,u=a.clipperFloors,c=s>0&&s;l&&!1!==c?(this.uniforms.clipperPlanesTexture.value=l,this.uniforms.clipperFloors.value=u):(this.uniforms.clipperPlanesTexture.value=null,this.uniforms.clipperFloors.value=null),this.defines.NUM_CLIPPING_BOX!==c&&(this.defines.NUM_CLIPPING_BOX=c,this.needsUpdate=!0)},r}(e.ShaderMaterial),Vt=function(t){function r(r){var n=r.preserveDrawingBuffer,i=void 0===n||n,o=r.backgroundColor,a=void 0===o?1579548:o,s=r.backgroundAlpha,l=void 0===s?1:s,u=r.pixelRatio,c=void 0===u?1:u,h=r.antialias,p=void 0!==h&&h,d=r.webgl2,f=this;if(void 0!==d&&d){var v=document.createElement("canvas"),m=v.getContext("webgl2");if(null===m)throw new Error("error occurred when getting webgl2 canvas context");f=t.call(this,{antialias:p,preserveDrawingBuffer:i,alpha:l<1,canvas:v,context:m})||this}else f=t.call(this,{antialias:p,preserveDrawingBuffer:i,alpha:l<1})||this;return f.setPixelRatio(c),f.setClearColor(a,l),f.outputEncoding=e.sRGBEncoding,f.autoClear=!0,f}return Z(r,t),r}(e.WebGLRenderer),Ut=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Z(t,e),t.prototype.add=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.prototype.add.apply(this,t)},t.prototype.remove=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.prototype.remove.apply(this,t)},t}(e.Scene);function zt(t,r){var n=Math.abs(Math.cos(t.latitude)),i=-Math.sin(t.longitude)*n,o=-Math.sin(t.latitude),a=-Math.cos(t.longitude)*n;return r?r.set(i,o,a):new e.Vector3(i,o,a)}var _t=2*Math.PI,qt=Math.PI/2;function Ht(e){return e>0&&e<=_t?e:(e%_t+_t)%_t}var jt,Gt=function(t){function r(r,n,i,o,a,s){void 0===n&&(n=1),void 0===i&&(i=.01),void 0===o&&(o=1e3),void 0===a&&(a=new e.Vector2),void 0===s&&(s=1);var l=t.call(this)||this;l.fov=r,l.aspect=n,l.near=i,l.far=o,l.perspToOrtho=a,l.orthoDistance=s,l.needsRender=!0,l.pose={longitude:0,latitude:0,fov:r,distance:0,offset:new e.Vector3},l.computePose(),l.perspectiveCamera=new e.PerspectiveCamera(l.fov,l.aspect,.001,l.far);var u=Math.max(l.orthoDistance,.01)*Math.tan(.5*l.fov/180*Math.PI),c=-.5*l.aspect*2*u;return l.orthographicCamera=new e.OrthographicCamera(c,-c,u,-u,.001,l.far),l.computeProjectionMatrix(),l.lastValues={position:l.position.clone(),quaternion:l.quaternion.clone(),scale:l.scale.clone(),fov:l.fov,aspect:l.aspect,near:l.near,far:l.far,perspToOrtho:l.perspToOrtho.clone(),orthoDistance:l.orthoDistance},l.type=l.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera",l}return Z(r,t),Object.defineProperty(r.prototype,"zoom",{get:function(){return"OrthographicCamera"===this.type?this.orthographicCamera.zoom:"PerspectiveCamera"===this.type?this.perspectiveCamera.zoom:1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return"OrthographicCamera"===this.type?this.orthographicCamera.top:0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return"OrthographicCamera"===this.type?this.orthographicCamera.bottom:0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"left",{get:function(){return"OrthographicCamera"===this.type?this.orthographicCamera.left:0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return"OrthographicCamera"===this.type?this.orthographicCamera.right:0},enumerable:!1,configurable:!0}),r.prototype.getDirection=function(e){return zt(this.pose,e)},r.prototype.computePose=function(t){void 0===t&&(t=0);var r=this.getDirection(new e.Vector3);this.pose.longitude=Ht(-Math.atan2(r.x,-r.z)),this.pose.latitude=-Math.asin(r.y/1),this.pose.fov=this.fov,this.pose.distance=t;var n=(new e.Vector3).add(this.position).add(r.clone().setLength(this.pose.distance));return this.pose.offset.copy(n),this},r.prototype.setFromPose=function(e){var t,r,n,i,o,a=Ht(null!==(t=e.longitude)&&void 0!==t?t:this.pose.longitude),s=Math.max(1e-4-qt,Math.min(qt-1e-4,null!==(r=e.latitude)&&void 0!==r?r:this.pose.latitude)),l=null!==(n=e.fov)&&void 0!==n?n:this.pose.fov,u=null!==(i=e.distance)&&void 0!==i?i:this.pose.distance,c=null!==(o=e.offset)&&void 0!==o?o:this.pose.offset,h=zt({longitude:a,latitude:s}).normalize();return this.position.set(0,0,0),this.lookAt(h),this.position.add(c).sub(h.clone().setLength(u)),this.fov!==l&&(this.fov=l,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=a,this.pose.latitude=s,this.pose.fov=l,this.pose.distance=u,this.pose.offset.copy(c),this.needsRender=!0,this},r.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},r.prototype.computeProjectionMatrix=function(){!function(e,t,r,n){r=Math.pow(r,2);for(var i=0;i<16;i++)n.elements[i]=e.elements[i]+(t.elements[i]-e.elements[i])*r}(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},r.prototype.setViewOffset=function(e,t,r,n,i,o){this.perspectiveCamera.setViewOffset(e,t,r,n,i,o),this.orthographicCamera.setViewOffset(e,t,r,n,i,o),this.computeProjectionMatrix()},r.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},r.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(r.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),r.prototype.updateTime=function(e,t){var r=!1;if(this.lastValues.fov===this.fov&&this.lastValues.near===this.near&&this.lastValues.far===this.far&&this.lastValues.aspect===this.aspect||(this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),r=!0),!this.lastValues.position.equals(this.position)||!this.lastValues.quaternion.equals(this.quaternion)||!this.lastValues.scale.equals(this.scale)||this.lastValues.orthoDistance!==this.orthoDistance||this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect){var n=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),i=-.5*this.aspect*2*n;this.orthographicCamera.left=i,this.orthographicCamera.right=-i,this.orthographicCamera.top=n,this.orthographicCamera.bottom=-n,this.orthographicCamera.updateProjectionMatrix(),r=!0}this.lastValues.perspToOrtho.equals(this.perspToOrtho)||(r=!0),r&&this.computeProjectionMatrix(),this.lastValues.position.copy(this.position),this.lastValues.quaternion.copy(this.quaternion),this.lastValues.scale.copy(this.scale),this.lastValues.fov=this.fov,this.lastValues.aspect=this.aspect,this.lastValues.near=this.near,this.lastValues.far=this.far,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.lastValues.orthoDistance=this.orthoDistance,this.type=this.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera"},Object.defineProperty(r.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),r.prototype.copy=function(e,r){return t.prototype.copy.call(this,e,r),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.orthoDistance=e.orthoDistance,this.updateTime(ue(),0),this},r}(e.Camera);!function(e){e[e.Outside=-1]="Outside",e[e.Intersecting=0]="Intersecting",e[e.Inside=1]="Inside"}(jt||(jt={}));var Kt=new e.Vector3,Wt=new e.Matrix4,Yt=new e.Matrix3,Xt=new e.Vector3,Jt=new e.Vector3,Zt=new e.Vector3,$t=new e.Vector3,er=new e.Vector3,tr=new e.Box3,rr=new e.Matrix4,nr=new e.Ray,ir=function(){function e(e){void 0===e&&(e=[]),this.planes=e}return Object.defineProperty(e,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(e,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),e.prototype.setFromFrustum=function(e){return this.planes=e.planes.map((function(e){return e.clone()})),this},e.prototype.computeVisibility=function(e){for(var t=jt.Inside,r=0,n=this.planes;r<n.length;r++){var i=n[r];switch(e.intersectPlane(i)){case jt.Outside:return jt.Outside;case jt.Intersecting:t=jt.Intersecting}}return t},e.prototype.computeVisibilityWithPlaneMask=function(t,r){if(r===e.MASK_OUTSIDE||r===e.MASK_INSIDE)return r;for(var n=e.MASK_INSIDE,i=Math.min(32,this.planes.length),o=0;o<i;++o){var a=1<<o;if(0!=(r&a)){var s=this.planes[o],l=t.intersectPlane(s);if(l===jt.Outside)return e.MASK_OUTSIDE;l===jt.Intersecting&&(n|=a)}}return n},e}(),or=function(){function t(){this.type="box",this.center=new e.Vector3,this.halfSize=new e.Vector3,this.rotation=new e.Matrix3}return t.prototype.fromJson=function(e){var t=e.box;this.center.set(t[0],t[1],t[2]);var r=t[3],n=t[4],i=t[5],o=t[6],a=t[7],s=t[8],l=t[9],u=t[10],c=t[11],h=Math.sqrt(r*r+n*n+i*i),p=Math.sqrt(o*o+a*a+s*s),d=Math.sqrt(l*l+u*u+c*c);return this.halfSize.set(h,p,d),this.rotation.fromArray([r/h,n/h,i/h,o/p,a/p,s/p,l/d,u/d,c/d]),this},t.prototype.toJson=function(){return this.rotation.extractBasis(Jt,Zt,$t),{box:re(re(re(re([],this.center.toArray(),!0),Jt.multiplyScalar(this.halfSize.x).toArray(),!0),Zt.multiplyScalar(this.halfSize.y).toArray(),!0),$t.multiplyScalar(this.halfSize.z).toArray(),!0)}},t.prototype.copy=function(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this},t.prototype.clone=function(){return(new t).copy(this)},t.prototype.applyMatrix4=function(e){var t=e.elements,r=Kt.set(t[0],t[1],t[2]).length(),n=Kt.set(t[4],t[5],t[6]).length(),i=Kt.set(t[8],t[9],t[10]).length();e.determinant()<0&&(r=-r),Yt.setFromMatrix4(e);var o=1/r,a=1/n,s=1/i;return Yt.elements[0]*=o,Yt.elements[1]*=o,Yt.elements[2]*=o,Yt.elements[3]*=a,Yt.elements[4]*=a,Yt.elements[5]*=a,Yt.elements[6]*=s,Yt.elements[7]*=s,Yt.elements[8]*=s,this.rotation.premultiply(Yt),this.halfSize.x*=r,this.halfSize.y*=n,this.halfSize.z*=i,this.center.applyMatrix4(e),this},t.prototype.getCenter=function(e){return e.copy(this.center)},t.prototype.distanceSquaredTo=function(e){Xt.copy(e).sub(this.center),this.rotation.extractBasis(Jt,Zt,$t);var t=0,r=0;return(r=Math.abs(Xt.dot(Jt.normalize()))-this.halfSize.x)>0&&(t+=r*r),(r=Math.abs(Xt.dot(Zt.normalize()))-this.halfSize.y)>0&&(t+=r*r),(r=Math.abs(Xt.dot($t.normalize()))-this.halfSize.z)>0&&(t+=r*r),t},t.prototype.distanceTo=function(e){return Math.sqrt(this.distanceSquaredTo(e))},t.prototype.getBoundingBox=function(e){return e.makeEmpty(),this.rotation.extractBasis(Jt,Zt,$t),Jt.setLength(this.halfSize.x),Zt.setLength(this.halfSize.y),$t.setLength(this.halfSize.z),e.expandByPoint(Kt.copy(this.center).add(Jt)),e.expandByPoint(Kt.copy(this.center).sub(Jt)),e.expandByPoint(Kt.copy(this.center).add(Zt)),e.expandByPoint(Kt.copy(this.center).sub(Zt)),e.expandByPoint(Kt.copy(this.center).add($t)),e.expandByPoint(Kt.copy(this.center).sub($t)),e},t.prototype.toGeometry=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24);Kt.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(r,0),Kt.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(r,3),Kt.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(r,6),Kt.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(r,9),Kt.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(r,12),Kt.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(r,15),Kt.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(r,18),Kt.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(r,21);var n=new e.BufferGeometry;return n.setIndex(new e.BufferAttribute(t,1)),n.setAttribute("position",new e.BufferAttribute(r,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n},t.prototype.intersectPlane=function(e){var t=this.center,r=e.normal,n=this.rotation.elements,i=this.halfSize,o=r.x,a=r.y,s=r.z,l=Math.abs(o*n[0]*i.x+a*n[1]*i.x+s*n[2]*i.x)+Math.abs(o*n[3]*i.y+a*n[4]*i.y+s*n[5]*i.y)+Math.abs(o*n[6]*i.z+a*n[7]*i.z+s*n[8]*i.z),u=r.dot(t)+e.constant;return u<=-l?jt.Outside:u>=l?jt.Inside:jt.Intersecting},t.prototype.intersectRay=function(e){return er.copy(this.halfSize).multiplyScalar(2),tr.setFromCenterAndSize(Kt.set(0,0,0),er),this.rotation.extractBasis(Jt,Zt,$t),Wt.makeBasis(Jt,Zt,$t),Wt.setPosition(this.center),rr.getInverse(Wt),nr.copy(e).applyMatrix4(rr),nr.intersectsBox(tr)},t}(),ar=function(){function t(){this.type="sphere",this.center=new e.Vector3,this.radius=-1}return t.prototype.fromJson=function(e){var t=e.sphere;return this.center.set(t[0],t[1],t[2]),this.radius=t[3],this},t.prototype.toJson=function(){return{sphere:re(re([],this.center.toArray(),!0),[this.radius],!1)}},t.prototype.copy=function(e){return this.center.copy(e.center),this.radius=e.radius,this},t.prototype.clone=function(){return(new t).copy(this)},t.prototype.getBoundingBox=function(e){return e.setFromCenterAndSize(this.center,er.set(1,1,1).multiplyScalar(2*this.radius)),e},t.prototype.toGeometry=function(){for(var t=32,r=new Float32Array(384),n=0;n<=t;n++){var i=0;i=n/t*Math.PI*2,r[6*n+0]=this.center.x+Math.cos(i)*this.radius,r[6*n+1]=this.center.y+Math.sin(i)*this.radius,r[6*n+2]=this.center.z+0,i=(n+1)/t*Math.PI*2,r[6*n+3]=this.center.x+Math.cos(i)*this.radius,r[6*n+4]=this.center.y+Math.sin(i)*this.radius,r[6*n+5]=this.center.z+0}for(n=t;n<=64;n++)i=0,i=n/t*Math.PI*2,r[6*n+0]=this.center.x+Math.cos(i)*this.radius,r[6*n+1]=this.center.y+0,r[6*n+2]=this.center.z+Math.sin(i)*this.radius,i=(n+1)/t*Math.PI*2,r[6*n+3]=this.center.x+Math.cos(i)*this.radius,r[6*n+4]=this.center.y+0,r[6*n+5]=this.center.z+Math.sin(i)*this.radius;var o=new e.BufferGeometry;return o.setAttribute("position",new e.BufferAttribute(r,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o},t.prototype.applyMatrix4=function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},t.prototype.getCenter=function(e){return e.copy(this.center)},t.prototype.distanceSquaredTo=function(e){var t=this.distanceTo(e);return t*t},t.prototype.distanceTo=function(e){var t=this.center.distanceTo(e)-this.radius;return t<=0?0:t},t.prototype.intersectPlane=function(e){var t=this.center,r=this.radius,n=e.normal.dot(t)+e.constant;return n<-r?jt.Outside:n<r?jt.Intersecting:jt.Inside},t.prototype.intersectRay=function(e){Kt.subVectors(this.center,e.origin);var t=Kt.dot(e.direction),r=Kt.dot(Kt)-t*t,n=this.radius*this.radius;return!(r>n)&&!(t+Math.sqrt(n-r)<0)},t}(),sr=function(){function e(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return e.prototype.fromJson=function(e){var t=e.region;return this.west=t[0],this.south=t[1],this.east=t[2],this.north=t[3],this.minHeight=t[4],this.maxHeight=t[5],this},e.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},e.prototype.copy=function(e){return this.west=e.west,this.south=e.south,this.east=e.east,this.north=e.north,this.minHeight=e.minHeight,this.maxHeight=e.maxHeight,this},e.prototype.clone=function(){return(new e).copy(this)},e.prototype.getBoundingBox=function(e){throw new Error("not implemented")},e.prototype.toGeometry=function(){throw new Error("not implemented")},e.prototype.applyMatrix4=function(e){throw new Error("not implemented")},e.prototype.getCenter=function(e){throw new Error("not implemented")},e.prototype.distanceTo=function(e){throw new Error("not implemented")},e.prototype.distanceSquaredTo=function(e){throw new Error("not implemented")},e.prototype.intersectPlane=function(e){throw new Error("not implemented")},e.prototype.intersectRay=function(e){throw new Error("not implemented")},e}();function lr(e){if("box"in e)return(new or).fromJson(e);if("sphere"in e)return(new ar).fromJson(e);if("region"in e)return(new sr).fromJson(e);throw new Error("BoundingVolume ".concat(JSON.stringify(e)," never suppored."))}var ur,cr,hr,pr,dr=[2621517,3801199,4915345,5963950,7274706,8782079,9575167,10434047,11623423,12482559,13274879,13870335,14464511,15125247,15852031,16446719].map((function(t){return new e.LineBasicMaterial({color:t,depthWrite:!1,transparent:!0})})),fr=function(){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24);Kt.set(1,1,1).toArray(r,0),Kt.set(-1,1,1).toArray(r,3),Kt.set(-1,-1,1).toArray(r,6),Kt.set(1,-1,1).toArray(r,9),Kt.set(1,1,-1).toArray(r,12),Kt.set(-1,1,-1).toArray(r,15),Kt.set(-1,-1,-1).toArray(r,18),Kt.set(1,-1,-1).toArray(r,21);var n=new e.BufferGeometry;return n.setIndex(new e.BufferAttribute(t,1)),n.setAttribute("position",new e.BufferAttribute(r,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n}(),vr=function(){for(var t=32,r=new Float32Array(384),n=0;n<=t;n++){var i=0;i=n/t*Math.PI*2,r[6*n+0]=Math.cos(i),r[6*n+1]=Math.sin(i),r[6*n+2]=0,i=(n+1)/t*Math.PI*2,r[6*n+3]=Math.cos(i),r[6*n+4]=Math.sin(i),r[6*n+5]=0}for(n=t;n<=64;n++)i=0,i=n/t*Math.PI*2,r[6*n+0]=Math.cos(i),r[6*n+1]=0,r[6*n+2]=Math.sin(i),i=(n+1)/t*Math.PI*2,r[6*n+3]=Math.cos(i),r[6*n+4]=0,r[6*n+5]=Math.sin(i);var o=new e.BufferGeometry;return o.setAttribute("position",new e.BufferAttribute(r,3)),o.computeBoundingBox(),o.computeBoundingSphere(),o}(),mr=new e.Vector3,Ar=function(){function t(r,n,i,o){var a,s,l,u=this;this.parent=null,this.id=r,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,selectionDepth:0,centerZDepth:0,shouldRefine:!1,distanceToCamera:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1},this.parent=null!=o?o:null,this.tileset=i,this.refine=null!==(a=n.refine)&&void 0!==a?a:this.parent?this.parent.refine:"REPLACE",this.transform=new e.Matrix4,n.transform&&this.transform.fromArray(n.transform),this.parent&&this.transform.premultiply(this.parent.transform),"number"==typeof n.geometricError?this.geometricError=n.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=null!==(l=null===(s=this.parent)||void 0===s?void 0:s.geometricError)&&void 0!==l?l:0,n.content&&n.content.uri?(this.content={uri:n.content.uri,loadState:"UNLOADED",byteLength:0},void 0!==n.content.group&&(this.content.group=n.content.group),n.content.boundingVolume&&(this.content.boundingVolume=lr(n.content.boundingVolume).applyMatrix4(this.transform)),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),n.boundingVolume&&(this.boundingVolume=lr(n.boundingVolume).applyMatrix4(this.transform)),n.viewerRequestVolume&&(this.viewerRequestVolume=lr(n.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=n.extras||{},n.children?this.children=n.children.map((function(e,r){return new t("".concat(u.id,".").concat(r),e,i,u)})):this.children=[]}return t.prototype.updateState=function(e){if(this.state.frameNumber!==e.frameNumber){if(this.state.frameNumber=e.frameNumber,this.boundingVolume){var t=this.boundingVolume.clone().applyMatrix4(this.tileset.transfrom);this.state.distanceToCamera=t.distanceTo(e.camera.position),this.state.centerZDepth=e.camera.direction.dot(t.getCenter(mr).sub(e.camera.position));var r=this.parent?this.parent.state.visibilityPlaneMask:ir.MASK_INDETERMINATE;this.state.visibilityPlaneMask=e.cullingVolume.computeVisibilityWithPlaneMask(t,r),this.state.visible=this.state.visibilityPlaneMask!==ir.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=ir.MASK_INDETERMINATE,this.state.visible=!0;if(this.viewerRequestVolume){var n=this.viewerRequestVolume.clone().applyMatrix4(this.tileset.transfrom);this.state.inRequestVolume=n.distanceSquaredTo(e.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(e,this.state.distanceToCamera,!1)}},Object.defineProperty(t.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"siblingIndex",{get:function(){var e,t;return null!==(t=null===(e=this.parent)||void 0===e?void 0:e.children.indexOf(this))&&void 0!==t?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&"TILESET"===this.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasRenderContent",{get:function(){return"MESH"===this.type||"SCENEGRAPH"===this.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentAvailable",{get:function(){var e;return this.hasRenderContent&&"READY"===(null===(e=this.content)||void 0===e?void 0:e.loadState)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasUnloadedContent",{get:function(){var e;return"UNLOADED"===(null===(e=this.content)||void 0===e?void 0:e.loadState)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasEmptyContent",{get:function(){return"EMPTY"===this.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentReady",{get:function(){var e;return"READY"===(null===(e=this.content)||void 0===e?void 0:e.loadState)||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),t.prototype.loadContent=function(){var e,t=this;if(this.hasEmptyContent||!(null===(e=this.content)||void 0===e?void 0:e.uri))return Promise.resolve(!1);var r=this.content;return r.data?Promise.resolve(!0):(r.loadState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,(function(){return t.getPriority()})).then((function(e){return e?t.tileset.options.contentLoader(t).then((function(t){return e.done(),r.loadState=t?"READY":"UNLOADED",t})).catch((function(t){return r.loadState="FAILED",e.done(),Promise.reject(t)})):(r.loadState="UNLOADED",Promise.resolve(!1))})))},t.prototype.unloadContent=function(){return this.content&&(this.content.loadState="UNLOADED",this.content.byteLength=0),!0},t.prototype.getScreenSpaceError=function(e,t,r){var n=this.tileset.transfrom.getMaxScaleOnAxis(),i=this.parent?this.parent.geometricError:this.tileset.geometricError,o=n*(r?i:this.geometricError);if(0===o)return 0;var a=Math.max(t,.001);return o*e.height*this.tileset.viewDistanceScale/(a*e.sseDenominator)},t.prototype.getPriority=function(){var e=this.tileset.traverser,t="ADD"===this.refine||this.tileset.traverser.skipLevelOfDetail;if(t&&!this.state.visible)return-1;if(this.tileset.frameNumber-this.state.touchedFrameNumber>=1)return-1;if("UNLOADED"===this.content.loadState)return-1;var r=this.parent,n=!r||t&&0!==this.state.screenSpaceError?this.state.screenSpaceError:r.state.screenSpaceError,i=e.root?e.root.state.screenSpaceError:0;return Math.max(i-n,0)},t}(),gr=function(){function e(){this.maxRequests=e.DEFAULT_MAX_REQUESTS,this.activeRequests=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return e.prototype.scheduleRequest=function(e,t){var r=this.requestMap.get(e);if(r)return r;var n={identiy:e,priority:0,getPriority:t,resolve:function(){}},i=new Promise((function(e){return n.resolve=e}));return this.requestQueue.push(n),this.requestMap.set(e,i),this.issueNewRequests(),i},e.prototype.reset=function(){for(var e=0,t=this.requestQueue;e<t.length;e++)t[e].resolve(null);this.requestQueue.length=0,this.requestMap.clear(),this.activeRequests=0},e.prototype.issueRequest=function(e){var t=this,r=e.identiy,n=e.resolve,i=!1;this.activeRequests++,n({done:function(){i||(i=!0,t.requestMap.delete(r),t.activeRequests--,t.issueNewRequests())}})},e.prototype.issueNewRequests=function(){var e=this;this.deferred||(this.deferred=setTimeout((function(){return e.issueNewRequestsAsync()}),0))},e.prototype.issueNewRequestsAsync=function(){this.deferred=null;var e=Math.max(this.maxRequests-this.activeRequests,0);if(0!==e){this.updateAllRequests();for(var t=0;t<e;t++){var r=this.requestQueue.shift();if(!r)break;this.issueRequest(r)}}},e.prototype.updateAllRequests=function(){for(var e=this.requestQueue,t=0;t<e.length;t++){var r=e[t];!1===this.updateRequest(r)&&(e.splice(t,1),this.requestMap.delete(r.identiy),t--)}e.sort((function(e,t){return e.priority-t.priority}))},e.prototype.updateRequest=function(e){return e.priority=e.getPriority(e.identiy),!(e.priority<0&&(e.resolve(null),1))},e.DEFAULT_MAX_REQUESTS=6,e}(),yr=function(e,t,r){this.item=e,this.previous=t,this.next=r},br=function(){function e(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),e.prototype.add=function(e){var t=new yr(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t},e.prototype.remove=function(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--},e.prototype.splice=function(e,t){e!==t&&(this.remove(t),this.insert(e,t))},e.prototype.insert=function(e,t){var r=e.next;e.next=t,this.tail===e?this.tail=t:r.previous=t,t.next=r,t.previous=e,this._length++},e.prototype.toArray=function(){for(var e=[],t=this.head;t;)e.push(t),t=t.next;return e},e}(),xr=function(){function e(){this.cacheNodeMap=new Map,this.list=new br,this.sentinel=this.list.add("sentinel")}return e.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},e.prototype.touch=function(e){var t=this.cacheNodeMap.get(e);t&&this.list.splice(this.sentinel,t)},e.prototype.add=function(e,t){if(!this.cacheNodeMap.has(e)){var r=this.list.add(e);this.cacheNodeMap.set(e,r),t&&t(e)}},e.prototype.unloadTile=function(e,t){var r=this.cacheNodeMap.get(e);r&&(this.list.remove(r),this.cacheNodeMap.delete(e),t&&t(e))},e.prototype.unloadTiles=function(e,t){for(var r=this.list.head;r!==this.sentinel&&e();){var n=r.item;r=r.next,this.unloadTile(n,t)}},e.prototype.toArray=function(){for(var e=[],t=0,r=this.list.toArray();t<r.length;t++){var n=r[t];"sentinel"!==n.item&&e.push(n.item)}return e},e}(),wr=function(){function e(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),e.prototype.get=function(e){return this.array[e]},e.prototype.set=function(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)},e.prototype.delete=function(e){var t=this.map.get(e);void 0!==t&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)},e.prototype.push=function(e){if(!this.map.has(e)){var t=this._length++;this.array[t]=e,this.map.set(e,t)}},e.prototype.pop=function(){var e=this.array[--this._length];return this.map.delete(e),e},e.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},e.prototype.find=function(e){return this.map.has(e)},e}(),Mr=function(){function e(t){this.loadSiblings=e.DEFAULT_LOAD_SIBLINGS,this.skipLevelOfDetail=e.DEFAULT_SKIP_LEVEL_OF_DETAIL,this.maxScreenSpaceError=e.DEFAULT_MAX_SCREEN_SPACE_ERROR,this.onTraversalEnd=t,this._traversalStack=new wr,this._emptyTraversalStack=new wr,this.root=null,this.selectedTiles=new Map,this.requestedTiles=new Map,this.needsRefinedTiles=new Map,this.emptyTiles=new Map}return e.prototype.traverse=function(e,t){this.root=e,this.reset(),this.updateTile(e,t),this.executeTraversal(e,t)},e.prototype.reset=function(){this.needsRefinedTiles.clear(),this.requestedTiles.clear(),this.selectedTiles.clear(),this.emptyTiles.clear(),this._traversalStack.reset(),this._emptyTraversalStack.reset()},e.prototype.executeTraversal=function(e,t){var r=this._traversalStack;if(e.state.selectionDepth=0,t.maxLevelOfDetail>=0)for(e.state.visible&&e.state.inRequestVolume&&r.push(e);r.length>0;){var n=r.pop(),i=!1;if(this.canTraverse(n,t,!1,!1)){this.updateChildTiles(n,t);var o=n.hasRenderContent?n.state.selectionDepth+1:n.state.selectionDepth;i=this.updateAndPushChildren(n,t,r,o)}var a=n.parent,s=!a||a.state.shouldRefine,l=!i;n.hasRenderContent?"ADD"===n.refine?(this.loadTile(n,t.frameNumber),this.selectTile(n,t)):"REPLACE"===n.refine&&(this.loadTile(n,t.frameNumber),l&&this.selectTile(n,t)):(this.emptyTiles.set(n.id,n),this.loadTile(n,t.frameNumber),l&&this.selectTile(n,t)),this.touchTile(n,t),n.state.shouldRefine=i&&s}this.onTraversalEnd(t)},e.prototype.updateChildTiles=function(e,t){for(var r=0,n=e.children;r<n.length;r++){var i=n[r];this.updateTile(i,t)}return!0},e.prototype.updateAndPushChildren=function(e,t,r,n){for(var i=e.children,o="REPLACE"===e.refine&&e.hasRenderContent&&!this.skipLevelOfDetail,a=!1,s=!0,l=0,u=i;l<u.length;l++){var c=u[l];if(c.state.selectionDepth=n,c.state.visible&&c.state.inRequestVolume?(r.find(c)&&r.delete(c),r.push(c),a=!0):(o||this.loadSiblings)&&(this.loadTile(c,t.frameNumber),this.touchTile(c,t)),o){var h;h=!!c.state.inRequestVolume&&(c.hasRenderContent?c.contentAvailable:this.executeEmptyTraversal(c,t)),s=s&&h}}return a||(s=!1),s},e.prototype.updateTile=function(e,t){this.updateTileVisibility(e,t)},e.prototype.selectTile=function(e,t){this.shouldSelectTile(e)&&(e.state.selectedFrameNumber=t.frameNumber,this.selectedTiles.set(e.id,e)),this.needsRefinedTiles.set(e.id,e)},e.prototype.loadTile=function(e,t){this.shouldLoadTile(e)&&(e.state.requestedFrameNumber=t,this.requestedTiles.set(e.id,e)),this.needsRefinedTiles.set(e.id,e)},e.prototype.touchTile=function(e,t){e.tileset.cache.touch(e),e.state.touchedFrameNumber=t.frameNumber},e.prototype.canTraverse=function(e,t,r,n){return!!e.hasChildren&&(!!e.hasTilesetContent||!(!n&&!e.state.visible)&&!(e.hasRenderContent&&e.state.selectionDepth>=t.maxLevelOfDetail)&&this.shouldRefine(e,t,r))},e.prototype.shouldLoadTile=function(e){return e.hasUnloadedContent},e.prototype.shouldSelectTile=function(e){return e.contentAvailable&&!this.skipLevelOfDetail},e.prototype.shouldRefine=function(e,t,r){if(e.hasEmptyContent)return!0;var n=e.state.screenSpaceError;return r&&(n=e.getScreenSpaceError(t,e.state.distanceToCamera,!0)),n>this.maxScreenSpaceError},e.prototype.updateTileVisibility=function(e,t){if(e.updateState(t),e.state.visible&&e.state.inRequestVolume){var r=e.children.length>0;if(e.hasTilesetContent&&r){var n=e.children[0];return this.updateTileVisibility(n,t),void(e.state.visible=n.state.visible)}this.meetsScreenSpaceErrorEarly(e,t)&&(e.state.visible=!1)}},e.prototype.meetsScreenSpaceErrorEarly=function(e,t){var r=e.parent;return!(!r||"ADD"!==r.refine||this.shouldRefine(e,t,!0))},e.prototype.compareDistanceToCamera=function(e,t){return t.state.distanceToCamera-e.state.distanceToCamera},e.prototype.executeEmptyTraversal=function(e,t){var r=!0,n=this._emptyTraversalStack;for(n.push(e);n.length>0&&r;){var i=n.pop();if(this.updateTile(i,t),i.state.visible||this.loadTile(i,t.frameNumber),this.touchTile(i,t),!i.hasRenderContent&&this.canTraverse(i,t,!1,!0))for(var o=0,a=i.children;o<a.length;o++){var s=a[o];n.find(s)&&n.delete(s),n.push(s)}else i.contentAvailable||(r=!1)}return r},e.DEFAULT_SKIP_LEVEL_OF_DETAIL=!1,e.DEFAULT_LOAD_SIBLINGS=!1,e.DEFAULT_MAX_SCREEN_SPACE_ERROR=1,e}(),Er=function(){function t(r,n,i){var o,a,s=this;this.id=r,this.transfrom=new e.Matrix4,this.asset={version:n.asset.version,tilesetVersion:n.asset.tilesetVersion||"",gltfUpAxis:null!==(o=n.asset.gltfUpAxis)&&void 0!==o?o:"Z"},this.properties=null!==(a=n.properties)&&void 0!==a?a:{},this.options=i,this.traverser=new Mr((function(e){return s.onTraversalEnd(e)})),this.cache=new xr,this.requestScheduler=new gr,this.frameNumber=0,this.pendingCount=0,this.tiles=new Map,this.memoryUsageInBytes=0,this.root=new Ar("".concat(this.id,".0"),n.root,this),this.geometricError=n.geometricError,this.maxMemoryUsage=t.DEFAULT_MAX_MEMORY_USAGE,this.viewDistanceScale=t.DEFAULT_VIEW_DISTANCE_SCALE}return Object.defineProperty(t.prototype,"maxRequests",{get:function(){return this.requestScheduler.maxRequests},set:function(e){this.requestScheduler.maxRequests=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){return this.traverser.maxScreenSpaceError},set:function(e){this.traverser.maxScreenSpaceError=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectedTiles",{get:function(){return this.traverser.selectedTiles},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"needsRefinedTiles",{get:function(){return this.traverser.needsRefinedTiles},enumerable:!1,configurable:!0}),t.prototype.reset=function(){for(var e=this,t=[this.root];t.length>0;){for(var r=t.pop(),n=0,i=r.children;n<i.length;n++){var o=i[n];t.push(o)}this.cache.unloadTile(r,(function(t){return e.unloadTile(t)}))}this.cache.reset(),this.traverser.reset(),this.requestScheduler.reset(),this.tiles.clear()},t.prototype.isLoaded=function(){return 0===this.pendingCount&&0!==this.frameNumber},t.prototype.onTraversalEnd=function(e){var t=this;this.selectedTiles.forEach((function(e){t.tiles.set(e.id,e)})),this.traverser.requestedTiles.forEach((function(e){e.hasUnloadedContent&&t.loadTile(e)})),this.cache.unloadTiles((function(){return t.memoryUsageInBytes>1024*t.maxMemoryUsage*1024}),(function(e){t.unloadTile(e),t.tiles.delete(e.id)}))},t.prototype.loadTile=function(e){var t=this;this.pendingCount++,e.loadContent().catch((function(r){return t.options.onTileError(e,r),!1})).then((function(r){var n;t.pendingCount--,r&&((null===(n=e.content)||void 0===n?void 0:n.data)&&t.cache.add(e,(function(){t.memoryUsageInBytes+=e.contentByteLength})),t.options.onTileLoad(e))}))},t.prototype.unloadTile=function(e){this.memoryUsageInBytes-=e.contentByteLength,this.options.onTileUnload(e),e.unloadContent()},t.DEFAULT_VIEW_DISTANCE_SCALE=1,t.DEFAULT_MAX_MEMORY_USAGE=16,t.DEFAULT_MAX_SCREEN_SPACE_ERROR=Mr.DEFAULT_MAX_SCREEN_SPACE_ERROR,t.DEFAULT_MAX_REQUESTS=gr.DEFAULT_MAX_REQUESTS,t}(),Cr=function(){function e(e,t,r){this.x=e,this.y=t,this.z=r}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},e.prototype.set=function(e,t,r){return this.x=e,this.y=t,this.z=r,this},e.prototype.fromArray=function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},e.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},e.prototype.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},e.prototype.cross=function(e){var t=this.x,r=this.y,n=this.z;return this.x=r*e.z-n*e.y,this.y=n*e.x-t*e.z,this.z=t*e.y-r*e.x,this},e.prototype.crossVectors=function(e,t){var r=e.x,n=e.y,i=e.z,o=t.x,a=t.y,s=t.z;return this.x=n*s-i*a,this.y=i*o-r*s,this.z=r*a-n*o,this},e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e}(),Sr=function(e,t,r){this.extents=e,this.startIndex=t,this.endIndex=r},Ir=function(e,t){this.triangle=e,this.intersectionPoint=t},Pr=(ur=new Cr(0,0,0),cr=new Cr(0,0,0),hr=new Cr(0,0,0),pr=new Cr(0,0,0),function(e,t,r,n,i,o){cr.subVectors(t,e),hr.subVectors(r,e),pr.crossVectors(cr,hr);var a,s=i.dot(pr);if(s>0){if(o)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}ur.subVectors(n,e);var l=a*i.dot(hr.crossVectors(ur,hr));if(l<0)return null;var u=a*i.dot(cr.cross(ur));if(u<0)return null;if(l+u>s)return null;var c=-a*ur.dot(pr);if(c<0)return null;var h=c/s;return new Cr(0,0,0).copy(i).multiplyScalar(h).add(n)}),Tr=function(e,t){this.min=e,this.max=t};function Br(e,t,r){var n=new Tr(0,0);t.x>=0?(n.min=(r.extents[0]-e.x)*t.x,n.max=(r.extents[3]-e.x)*t.x):(n.min=(r.extents[3]-e.x)*t.x,n.max=(r.extents[0]-e.x)*t.x);var i=new Tr(0,0);if(t.y>=0?(i.min=(r.extents[1]-e.y)*t.y,i.max=(r.extents[4]-e.y)*t.y):(i.min=(r.extents[4]-e.y)*t.y,i.max=(r.extents[1]-e.y)*t.y),n.min>i.max||i.min>n.max)return!1;i.min>n.min&&(n.min=i.min),i.max<n.max&&(n.max=i.max);var o=new Tr(0,0);return t.z>=0?(o.min=(r.extents[2]-e.z)*t.z,o.max=(r.extents[5]-e.z)*t.z):(o.min=(r.extents[5]-e.z)*t.z,o.max=(r.extents[2]-e.z)*t.z),!(n.min>o.max||o.min>n.max||(o.min>n.min&&(n.min=o.min),o.max<n.max&&(n.max=o.max),n.max<0))}function Rr(e,t,r,n,i){if(r>=n)return[0,0,0,0,0,0];for(var o=1/0,a=1/0,s=1/0,l=-1/0,u=-1/0,c=-1/0,h=r,p=void 0,d=void 0;h<n;h++)(d=t[p=6*e[h]])<o&&(o=d),(d=t[p+1])<a&&(a=d),(d=t[p+2])<s&&(s=d),(d=t[p+3])>l&&(l=d),(d=t[p+4])>u&&(u=d),(d=t[p+5])>c&&(c=d);return[o-i,a-i,s-i,l+i,u+i,c+i]}function Or(e,t,r){return e<t?t:e>r?r:e}var kr=1e-6,Dr=function(){function e(){}return e.prototype.create=function(e){return this.trianglesArray=e,this},e.prototype.splitNode=function(e){if(!this.trianglesArray)throw new Error("bvh-tree never perpared. call `create` to initialize.");for(var t=this.trianglesArray,r=t.length/9,n=new Uint32Array(r),i=new Float32Array(6*r),o=[],a=0,s=1/0,l=1/0,u=1/0,c=-1/0,h=-1/0,p=-1/0,d=0,f=0,v=0,m=void 0,A=void 0,g=void 0,y=void 0,b=void 0,x=void 0,w=void 0;d<r;d++,f+=6,v+=9)n[d]=d,m=y=t[v],(w=t[v+3])<m&&(m=w),w>y&&(y=w),(w=t[v+6])<m&&(m=w),w>y&&(y=w),A=b=t[v+1],(w=t[v+4])<A&&(A=w),w>b&&(b=w),(w=t[v+7])<A&&(A=w),w>b&&(b=w),g=x=t[v+2],(w=t[v+5])<g&&(g=w),w>x&&(x=w),(w=t[v+8])<g&&(g=w),w>x&&(x=w),m<s&&(s=m),y>c&&(c=y),A<l&&(l=A),b>h&&(h=b),g<u&&(u=g),x>p&&(p=x),i[f]=m,i[f+1]=A,i[f+2]=g,i[f+3]=y,i[f+4]=b,i[f+5]=x;var M=new Sr([s,l,u,c,h,p],0,r);function E(t){for(var r=t.startIndex,s=t.endIndex,l=t.extents,u=[l[3]-l[0],l[4]-l[1],l[5]-l[2]],c=[0,1,2].sort((function(e,t){return u[t]-u[e]})),h=0;h<3;h++){for(var p=c[h],d=l[p]+l[p+3],f=r,v=s-1,m=-1,A=void 0;f<=v;)-1===m?(A=n[f],i[6*A+p]+i[6*A+p+3]<d?f++:m=A):(A=n[v],i[6*A+p]+i[6*A+p+3]>=d||(n[f]=A,n[v]=m,m=-1,f++),v--);if(f>r&&f<s){var g=new Sr(Rr(n,i,r,f,kr),r,f);g.endIndex-g.startIndex>e&&(o[a++]=g);var y=new Sr(Rr(n,i,f,s,kr),f,s);y.endIndex-y.startIndex>e&&(o[a++]=y),t.node0=g,t.node1=y,t.startIndex=0,t.endIndex=0;break}}}for(o[a++]=M;a;)E(o[--a]);return this.offsetArray=n,this.rootNode=M,o.length=0,this},e.prototype.intersectRay=function(e,t,r){if(!this.trianglesArray)throw new Error("bvh-tree never perpared. call `create` to initialize.");if(!this.rootNode||!this.offsetArray)throw new Error("bvh-tree never perpared. call `splitNode` to perpare.");for(var n,i=this.trianglesArray,o=this.offsetArray,a=this.rootNode,s=[],l=[],u=new Cr(1/t.x,1/t.y,1/t.z),c=[a];n=c.pop();)if(Br(e,u,n)){n.node0&&c.push(n.node0),n.node1&&c.push(n.node1);for(var h=n.startIndex;h<n.endIndex;h++)s.push(o[h])}for(var p=new Cr(0,0,0),d=new Cr(0,0,0),f=new Cr(0,0,0),v=new Cr(e.x,e.y,e.z),m=new Cr(t.x,t.y,t.z),A=void(h=0),g=s.length;h<g;h++){A=9*s[h],p.x=i[A],p.y=i[A+1],p.z=i[A+2],d.x=i[A+3],d.y=i[A+3+1],d.z=i[A+3+2],f.x=i[A+6],f.y=i[A+6+1],f.z=i[A+6+2];var y=Pr(p,d,f,v,m,r);y&&l.push(new Ir([p.clone(),d.clone(),f.clone()],y))}return l},e.prototype.trianglesInSphere=function(e,t){if(!this.trianglesArray)throw new Error("bvh-tree never perpared. call `create` to initialize.");if(!this.rootNode||!this.offsetArray)throw new Error("bvh-tree never perpared. call `splitNode` to perpare.");for(var r,n=this.trianglesArray,i=this.offsetArray,o=[this.rootNode],a=[];r=o.pop();){var s=Or(e.x,r.extents[0],r.extents[3])-e.x,l=Or(e.y,r.extents[1],r.extents[4])-e.y,u=Or(e.z,r.extents[2],r.extents[5])-e.z;if(s*s+l*l+u*u<=t*t){r.node0&&o.push(r.node0),r.node1&&o.push(r.node1);for(var c=r.startIndex;c<r.endIndex;c++)a.push(i[c])}}var h=a.length,p=new Float32Array(9*h);for(c=0;c<h;c++){var d=9*a[c];p[9*c]=n[d],p[9*c+1]=n[d+1],p[9*c+2]=n[d+2],p[9*c+3]=n[d+3],p[9*c+4]=n[d+4],p[9*c+5]=n[d+5],p[9*c+6]=n[d+6],p[9*c+7]=n[d+7],p[9*c+8]=n[d+8]}return p},e.prototype.dispose=function(){delete this.offsetArray,delete this.rootNode},e}();const Lr=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{H0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvs{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-sy||V{qrH0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6n\bv{t-rp@-[|znyH0r{qvs0vs-qrsv{rq5b`RlPYV]SY\\\\_6--{vs|z-rp@-sy||V{s|H0r{qvs0vs-qrsv{rq5[bZlPYV]]V[TlO\\e6--{vs|z-sy|n-pyv}}rSy||h[bZlPYV]]V[TlO\\ejH--{vs|z-nz}yr?Q-pyv}}r]yn{rarrH0r{qvsn\bv{t-rp@-]|vv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-Sy||Hn\bv{t-rp@-cvr]|vv|{Hn\bv{t-sy|n-Y|tQr}uHrp@-Yv{rna|_TO5-rp@-nyr-6-\nr{-rp@5-zv5-}|5-nyr;to9-rp@5-=;A>CCC-6-6-7->;=BB-:-rp@5-=;=BB-69-nyr;to-7->?;F?9-rp@5-yraun{R\0ny5-nyr;to9-rp@5-=;==@>@=E-6-6-6-66H\f|vq-znv{56-\n--0vs-qrsv{rq5[bZlPYV]]V[TlO\\e6----rpA-}yn{rH----s|5-v{-v-J-=H-v-I-[bZlPYV]]V[TlO\\eH-v886\n------o||y-pyv}}rq-J-rH------v{-pr{Sy||-J-v{5pyv}}rSy||hvj6H------<<内部展开s|循环,让v{q|能用------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C-8->6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C-8-?6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C-8-@6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C-8-A6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?55sy|n5v-7-C-8-B6-8-=;B6-<-sy|n5[bZlPYV]]V[TlO\\e-<-C69-=;B6-6H------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------o||y-v{antrSy||-J-no5Sy||-:-sy|n5pr{Sy||66-I->;=H------pyv}}rq-J-5pr{Sy||-JJ-:>-\v\v-v{antrSy||6-33-pyv}}rqH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f--0r{qvs--<<楼层切割计算--sy|n-sy||\\}npv\b-J->;=H--vs-5sy||V{qr-KJ-=;=-33-no5Sy||-:-sy|n5sy||V{qr66-KJ->;=6-\n----sy||\\}npv\b-J-=;>H--\f--rp@-pnzrnQvrpv|{-J-{|znyv\tr5pnzrn]|vv|{-:-]|vv|{6H--rp@-p|y|-J-P|y|H--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n------qvpnqH----\f--0r{qvs--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----sy|n--J-?;=-7-tyl]|v{P||q;-:->;=H----sy|n--J-?;=-7-tyl]|v{P||q;\b-:->;=H----sy|n-pp-J-7-8-7H----vs-5pp-K->;=6-\n------qvpnqH----\f--0r{qvs--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9->;=6H--0ryr----tylSntP|y|-J-rpA5Yv{rna|_TO5P|y|69-z|qryNy}un-7-|}npv\b-7-sy||\\}npv\b6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--0vs-qrsv{rq5b`RlU^ldRVTUa6sy|n-qvn{pr-J-?;=-7-yr{tu5tyl]|v{P||q;\b-:-=;B6Hsy|n-rvtu-J-zn5=;=9->;=-:-qvn{pr6Hrvtu-J-}|5rvtu9->;B6HtylSntP|y|;n-J-rvtuHtylSntP|y|;\b\t-J-tylSntP|y|;\b\t-7-rvtuH----tylSntP|y|;\b\t-J-rp@5>;=9=;=9=;=6H0r{qvs--\f"),Fr=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{Hnvor-rp@-p|y|Hnvor-sy|n-sy||H{vs|z-sy|n-}|v{`v\trH{vs|z-sy|n-}|v{Zn`v\trH{vs|z-sy|n-}|v{Zv{`v\trH{vs|z-sy|n-}|v{`v\trNqn}vr`pnyrH{vs|z-sy|n-ty|ony`pnyrH{vs|z-sy|n-tr|zrvpR|H{vs|z-sy|n-|}npv\bH{vs|z-sy|n-prr{UrvtuH{vs|z-sy|n-s|H0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?Q-tnqvr{arrH0r{qvsn\bv{t-rp@-]|vv|{Hn\bv{t-rp@-P|y|H0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6--n\bv{t-rp@-[|znyH0r{qvs0vs-qrsv{rq5b`RlRQY6--n\bv{t-sy|n-Y|tQr}uH0r{qvsn\bv{t-sy|n-Sy||Hn\bv{t-rp@-cvr]|vv|{H0qrsv{r-]V-@;>A>BF?CB@BEFDF@o||y-v]r}rpvrZnv5-znA-z-6-\n--r{-zh-?-jh-@-j-JJ-:->;=H\frp@-_TOa|Yv{rn5-rp@-nyr-6-\n--r{-rp@5-zv5-}|5-nyr;to-7-=;FADECD?FEC-8-rp@5-=;=B?>@?D=>A-69-rp@5-?;A-6-69-nyr;to-7-=;=DD@FF@E=E9-rp@5-yraun{R\0ny5-nyr;to9-rp@5-=;=A=AB-6-6-6-66H\frp@-trP|y|O\bUrvtu5nz}yr?Q-tnqvr{arr9-rpA-|yq]|vv|{6-\n--rp@-p|y|-J-rr?Q5tnqvr{arr9-rp?5|yq]|vv|{;\b-<->=;=9-=;B66;toH--r{-p|y|H\f|vq-znv{56-\n--rpA-z]|vv|{-J-z|qrycvrZnv-7-rpA5}|vv|{9->;=6H--tyl]|vv|{-J-}|wrpv|{Znv-7-z]|vv|{H--<<传递nvor的p|y|到s里使用--<<动态调整}|v{`v\tr--sy|n-rny]|v{`v\tr-J-}|v{`v\trH--0vs-qrsv{rq5b`Rl]\\V[al`VgRlNQN]aVcR6----sy|n-v]r}rpvr-J-sy|n5v]r}rpvrZnv5}|wrpv|{Znv66H----rny]|v{`v\tr-7J-zv5>;=9-}|v{`v\trNqn}vr`pnyr-7-}|v{`v\tr-<-:-z]|vv|{;\t9-v]r}rpvr6H----<<-rny]|v{`v\tr-7J-pynz}55tr|zrvpR|-7-ty|ony`pnyr69->;=9->=;=6H--0r{qvs--<<全局大小约束-rny]|v{`v\tr-J-pynz}5rny]|v{`v\tr9-}|v{Zv{`v\tr9-}|v{Zn`v\tr6H--tyl]|v{`v\tr-J-rny]|v{`v\trH--0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6----P|y|-J-trP|y|O\bUrvtu5tnqvr{arr9-z|qryZnv-7-rpA5-}|vv|{9->;=-66H--0ryr----P|y|-J-_TOa|Yv{rn5p|y|6H--0r{qvs--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----[|zny-J-{|znyv\tr5zn@5z|qryZnv6-7-{|zny6H--0r{qvs--]|vv|{-J-5z|qryZnv-7-rpA5-}|vv|{9->;=-66;\b\tH--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{;\t6H--0r{qvs--Sy||-J-sy||H--cvr]|vv|{-J-:z]|vv|{;\b\tH--0vs-qrsv{rq5b`RlU^lQR]aU6----sy|n-}|wSnp|-J-:=;B-7-prr{Urvtu-<-5n{5s|-<-?;=6-7-z]|vv|{;\t6H----sy|n-_nqv-J-rny]|v{`v\tr-<-}|wSnp|H----sy|n-|vtv{nyQr}u-J-tyl]|vv|{;H----sy|n-nqwrqQr}u-J-|vtv{nyQr}u-8-=;>H----sy|n-nqw-J-nqwrqQr}u-<-|vtv{nyQr}uH----z]|vv|{;\b\t-J-z]|vv|{;\b\t-7-nqwH----tyl]|vv|{-J-}|wrpv|{Znv-7-z]|vv|{H0r{qvs\f");var Qr=Object.assign({pointSize:new e.Uniform(1),opacity:new e.Uniform(1),pointMaxSize:new e.Uniform(2),pointMinSize:new e.Uniform(5),pointSizeAdaptiveScale:new e.Uniform(25),gradientTexture:new e.Uniform(null),modelAlpha:new e.Uniform(0),floorIndex:new e.Uniform(-1),clipperPlanesTexture:new e.Uniform(null),clipperFloors:new e.Uniform([]),constantColor:new e.Uniform(null),geometricError:null,globalScale:1,fov:.8028514559173915,screenHeight:995},e.UniformsUtils.clone(e.UniformsLib.common)),Nr=function(t){function r(r){void 0===r&&(r={});var n,i,o,a,s,l,u,c,h,p,d,f,v,m,A,g,y,b,x,w,M=this;return M=t.call(this,{vertexShader:Fr,fragmentShader:Lr,uniforms:e.UniformsUtils.clone(Qr),defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_POINT_NORMAL:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ADAPTIVE:!1}})||this,Object.defineProperties(M,{constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(e){this.uniforms.constantColor.value=e;var t=null!==e;this.defines.USE_CONSTANT_COLOR!==t&&(this.defines.USE_CONSTANT_COLOR=t,this.needsUpdate=!0)}},pointSize:{get:function(){return this.uniforms.pointSize.value},set:function(e){this.uniforms.pointSize.value=e}},pointMaxSize:{get:function(){return this.uniforms.pointMaxSize.value},set:function(e){this.uniforms.pointMaxSize.value=e}},pointMinSize:{get:function(){return this.uniforms.pointMinSize.value},set:function(e){this.uniforms.pointMinSize.value=e}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(e){this.uniforms.modelAlpha.value=e}},floorIndex:{get:function(){return this.uniforms.floorIndex.value},set:function(e){this.uniforms.floorIndex.value=e}},clippers:{get:function(){return w},set:function(e){w=e}},clipperFloors:{get:function(){return this.uniforms.clipperFloors.value},set:function(e){this.uniforms.clipperFloors.value=e}},geometricError:{get:function(){return this.uniforms.geometricError.value},set:function(e){this.uniforms.geometricError.value=e}},globalScale:{get:function(){return this.uniforms.globalScale.value},set:function(e){this.uniforms.globalScale.value=e}},pointColorType:{get:function(){return!0===this.defines.USE_POINT_COLOR_ALTITUDE?$e.ALTITUDE:$e.RGB},set:function(e){var t=e===$e.ALTITUDE;this.defines.USE_POINT_COLOR_ALTITUDE!==t&&(this.defines.USE_POINT_COLOR_ALTITUDE=t,this.needsUpdate=!0)}},pointSizeType:{get:function(){return!0===this.defines.USE_POINT_SIZE_ADAPTIVE?Je.ADAPTIVE:Je.FIXED},set:function(e){var t=e===Je.ADAPTIVE;this.defines.USE_POINT_SIZE_ADAPTIVE!==t&&(this.defines.USE_POINT_SIZE_ADAPTIVE=t,this.needsUpdate=!0)}},pointShape:{get:function(){return!0===this.defines.USE_POINT_SHAPE_CIRCLE?Ze.CIRCLE:Ze.SQUARE},set:function(e){var t=e===Ze.CIRCLE;this.defines.USE_POINT_SHAPE_CIRCLE!==t&&(this.defines.USE_POINT_SHAPE_CIRCLE=t,this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(e){e!==this.defines.USE_EDL&&(this.defines.USE_EDL=e,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(e){e!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=e,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(e){e!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=e,this.needsUpdate=!0)}},pointSizeAdaptiveScale:{get:function(){return this.uniforms.pointSizeAdaptiveScale.value},set:function(e){this.uniforms.pointSizeAdaptiveScale.value=e}},gradientTexture:{get:function(){return this.uniforms.gradientTexture.value},set:function(e){this.uniforms.gradientTexture.value=e}}}),M.pbmMaterialParametersVersion=0,M.pano0=null!==(n=r.pano0)&&void 0!==n?n:null,M.pano1=null!==(i=r.pano1)&&void 0!==i?i:null,M.modelAlpha=null!==(o=r.modelAlpha)&&void 0!==o?o:1,M.progress=null!==(a=r.progress)&&void 0!==a?a:0,M.useBlackTransition=null!==(s=r.useBlackTransition)&&void 0!==s&&s,M.constantColor=null!==(l=r.constantColor)&&void 0!==l?l:null,M.opacity=null!==(u=r.opacity)&&void 0!==u?u:1,M.floorIndex=null!==(c=r.floorIndex)&&void 0!==c?c:-1,M.clippers=null,M.clipperPlanesArray=null,M.clipperFloors=null,M.useEDL=null!==(h=r.useEDL)&&void 0!==h&&h,M.useHQWeight=null!==(p=r.useHQWeight)&&void 0!==p&&p,M.useHQDepth=null!==(d=r.useHQDepth)&&void 0!==d&&d,M.pointColorType=null!==(f=r.pointColorType)&&void 0!==f?f:$e.RGB,M.pointSizeType=null!==(v=r.pointSizeType)&&void 0!==v?v:Je.ADAPTIVE,M.pointShape=null!==(m=r.pointShape)&&void 0!==m?m:Ze.CIRCLE,M.pointSize=null!==(A=r.pointSize)&&void 0!==A?A:1,M.pointMaxSize=null!==(g=r.pointMaxSize)&&void 0!==g?g:20,M.pointMinSize=null!==(y=r.pointMinSize)&&void 0!==y?y:1,M.pointSizeAdaptiveScale=null!==(b=r.pointSizeAdaptiveScale)&&void 0!==b?b:25,M.gradientTexture=null!==(x=r.gradientTexture)&&void 0!==x?x:null,M.globalScale=1,M.geometricError=null,M.transparent=!1,M}return Z(r,t),r.prototype.dispose=function(){t.prototype.dispose.call(this)},r.prototype.update=function(t,r,n){this.transparent=this.floorIndex>-1||this.opacity<1,this.blending=this.transparent?e.NormalBlending:e.NoBlending,this.useEDL&&(this.transparent=!1),this.useHQDepth&&(this.depthTest=!0,this.depthWrite=!0),this.useHQWeight?(this.depthTest=!0,this.depthWrite=!1,this.blending=e.CustomBlending,this.blendSrc=e.SrcAlphaFactor,this.blendDst=e.OneFactor):(this.depthTest=!0,this.depthWrite=!0);var i=this.clippers,o="clippers:".concat(JSON.stringify(i?{clippers:i,cameraMatrix:r.matrixWorld}:null)),a=n.get(o,(function(){var t=null,n=null;i&&i.length&&(je.shared.update(i,r),t=je.shared.clipperPlanes,n=je.shared.clipperFloors);var o=i?i.length:0,a=t?new e.DataTexture(t,length,1,e.RGBAFormat,e.FloatType):null;return{value:{boxCount:o,clipperPlanesTexture:a,clipperFloors:n},dispose:function(){a&&a.dispose()}}})),s=a.boxCount,l=a.clipperPlanesTexture,u=a.clipperFloors,c=s>0&&s;l&&!1!==c?(this.uniforms.clipperPlanesTexture.value=l,this.uniforms.clipperFloors.value=u):(this.uniforms.clipperPlanesTexture.value=null,this.uniforms.clipperFloors.value=null),this.defines.NUM_CLIPPING_BOX!==c&&(this.defines.NUM_CLIPPING_BOX=c,this.needsUpdate=!0)},r}(e.ShaderMaterial),Vr=new e.Ray,Ur=new e.Vector3,zr=new e.Matrix3,_r=new e.Matrix4,qr=new e.Vector3,Hr=new e.Vector3,jr=new e.Vector3,Gr=new e.Triangle,Kr=function(t){function r(e,r){var n=t.call(this)||this;return n.objType=r,n.renderOrder=-4,n.add(e),n}return Z(r,t),r.prototype.buildBvhTree=function(){if("mesh"===this.objType&&!this.bvhTree){var t=this.parent;this.parent=null,this.updateWorldMatrix(!1,!0);var r=[];this.traverse((function(t){var n,i;if(t instanceof e.Mesh){var o=t.geometry;if(o instanceof e.BufferGeometry){var a=null===(n=o.attributes)||void 0===n?void 0:n.position.array;if(a){var s=null===(i=o.index)||void 0===i?void 0:i.array,l=t.matrixWorld;r.push({position:a,matrix:l,index:s})}}}}));for(var n=0,i=0,o=r;i<o.length;i++){var a,s=o[i],l=s.index,u=s.position;a=l?l.length:u.length/3,n+=3*Math.floor(a/3)}for(var c=new Float32Array(3*n),h=0,p=0,d=r;p<d.length;p++){var f=d[p],v=(l=f.index,u=f.position,f.matrix);if(l){for(var m=3*Math.floor(l.length/3),A=0,g=void 0,y=void 0;A<m;A++)g=3*(h+A),y=3*l[A],Ur.set(u[y],u[y+1],u[y+2]),Ur.applyMatrix4(v),c[g]=Ur.x,c[g+1]=Ur.y,c[g+2]=Ur.z;h+=m}else{for(m=3*Math.floor(u.length/3/3),A=0,g=void 0,y=void 0;A<m;A++)g=3*(h+A),y=3*A,Ur.set(u[y],u[y+1],u[y+2]),Ur.applyMatrix4(v),c[g]=Ur.x,c[g+1]=Ur.y,c[g+2]=Ur.z;h+=m}}this.bvhTree=(new Dr).create(c).splitNode(200),this.parent=t,this.matrixWorldNeedsUpdate=!0}},r.prototype.intersectRaycaster=function(t){var r=this;if("points"===this.objType){t.params||(t.params={}),t.params.Points={threshold:.1};var n=t.intersectObjects(this.children,!0).filter((function(r){if(r.distanceToRay>.1)return!1;if(r.object instanceof e.Points&&r.object.geometry instanceof e.BufferGeometry){var n=r.object.geometry.attributes.normal;if(n){var i=r.index,o=new e.Vector3(n.getX(i),n.getY(i),n.getZ(i));if(o.applyMatrix3(zr.setFromMatrix4(r.object.matrixWorld)).normalize(),r.face=new e.Face3(i,i,i,o),t.ray.direction.dot(o)>0)return!1}}return!0}));return n.map((function(e){return{distance:e.distance,point:e.point,face:e.face?{normal:e.face.normal}:null}}))}if(this.bvhTree){this.updateWorldMatrix(!0,!1),_r.getInverse(this.matrixWorld),Vr.copy(t.ray).applyMatrix4(_r);var i=this.bvhTree.intersectRay(Vr.origin,Vr.direction,!0).map((function(n){var i=n.intersectionPoint,o=n.triangle,a=(new e.Vector3).set(i.x,i.y,i.z).applyMatrix4(r.matrixWorld),s=qr.set(o[0].x,o[0].y,o[0].z).applyMatrix4(r.matrixWorld),l=Hr.set(o[1].x,o[1].y,o[1].z).applyMatrix4(r.matrixWorld),u=jr.set(o[2].x,o[2].y,o[2].z).applyMatrix4(r.matrixWorld);return{point:a,face:{normal:Gr.set(s,l,u).getNormal(new e.Vector3)},distance:t.ray.origin.distanceTo(a)}}));return i.filter((function(e){return e.distance>=t.near&&e.distance<=t.far})).sort((function(e,t){return e.distance-t.distance}))}return(n=t.intersectObjects(this.children,!0)).map((function(e){return{distance:e.distance,point:e.point,face:e.face?{normal:e.face.normal}:null}}))},r.prototype.dispose=function(){this.bvhTree=void 0,this.traverse((function(t){if(t instanceof e.Mesh||t instanceof e.Points)if(t.geometry.dispose(),Array.isArray(t.material))for(var r=0,n=t.material;r<n.length;r++)Wr(n[r]);else Wr(t.material)}))},r}(e.Group);function Wr(t){if(t instanceof Nr)!function(e){for(var t=[],r=e.uniforms,n=0,i=Object.keys(r);n<i.length;n++){var o=i[n];if(/^pano\d\_/.test(o))return void(r[o].value=null);if("gradientTexture"===o)return;if("clipperPlanesTexture"===o)return;var a=r[o].value;a&&"function"==typeof a.dispose&&-1===t.indexOf(a)&&(r[o].value=null,t.push(a))}e.dispose();for(var s=0,l=t;s<l.length;s++)l[s].dispose()}(t);else if(t instanceof Nt)!function(e){for(var t=[],r=e.uniforms,n=0,i=Object.keys(r);n<i.length;n++){var o=i[n];if(/^pano\d\_/.test(o))return void(r[o].value=null);if("gradientTexture"===o)return;if("clipperPlanesTexture"===o)return;var a=r[o].value;a&&"function"==typeof a.dispose&&-1===t.indexOf(a)&&(r[o].value=null,t.push(a))}e.dispose();for(var s=0,l=t;s<l.length;s++)l[s].dispose()}(t);else if(t instanceof e.RawShaderMaterial||t instanceof e.ShaderMaterial){for(var r=[],n=t.uniforms,i=0,o=Object.keys(n);i<o.length;i++)(c=n[h=o[i]].value)&&"function"==typeof c.dispose&&-1===r.indexOf(c)&&(n[h].value=null,r.push(c));t.dispose();for(var a=0,s=r;a<s.length;a++)s[a].dispose()}else{r=[];for(var l=0,u=Object.keys(t);l<u.length;l++){var c,h=u[l];/map$/i.test(h)&&(c=t[h])&&"function"==typeof c.dispose&&-1===r.indexOf(c)&&(t[h].value=null,r.push(c))}t.dispose();for(var p=0,d=r;p<d.length;p++)d[p].dispose()}}function Yr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=[];e=e.map((function(e){return(null!=e?e:"").trim()})).filter((function(e){return e.length>0&&!/^\/+$/.test(e)}));for(var n=0;n<e.length;n++){var i=0===n,o=n===e.length-1,a=e[n];i||(a=a.replace(/^\.\//,"").replace(/^\/+/,"")),o||(a=a.replace(/\/+$/,"")),r.push(a)}return r.join("/")}function Xr(e){return 0===e.indexOf("//")||/^[0-9a-z]+\:/i.test(e)}function Jr(e,t){if(e.content&&e.content.uri&&(Xr(e.content.uri)||(e.content.uri=Yr(t,e.content.uri))),e.children)for(var r=0,n=e.children;r<n.length;r++)Jr(n[r],t);return e}function Zr(e,t){return Jr(e.root,t),e}var $r,en,tn=4;function rn(e,t,r){var n=new DataView(t);if(e.magic=n.getUint32(r,!0),r+=tn,e.version=n.getUint32(r,!0),r+=tn,e.byteLength=n.getUint32(r,!0),r+=tn,1!==e.version)throw new Error("3D Tile Version ".concat(e.version," not supported"));return r}!function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE"}(en||(en={}));var nn=(($r={})[en.DOUBLE]=Float64Array,$r[en.FLOAT]=Float32Array,$r[en.UNSIGNED_SHORT]=Uint16Array,$r[en.UNSIGNED_INT]=Uint32Array,$r[en.UNSIGNED_BYTE]=Uint8Array,$r[en.BYTE]=Int8Array,$r[en.SHORT]=Int16Array,$r[en.INT]=Int32Array,$r),on={DOUBLE:en.DOUBLE,FLOAT:en.FLOAT,UNSIGNED_SHORT:en.UNSIGNED_SHORT,UNSIGNED_INT:en.UNSIGNED_INT,UNSIGNED_BYTE:en.UNSIGNED_BYTE,BYTE:en.BYTE,SHORT:en.SHORT,INT:en.INT};function an(e){var t=nn[e];if(!t)throw new Error("Failed to convert GL type");return t}function sn(e){return an(e).BYTES_PER_ELEMENT}function ln(e,t,r,n){void 0===r&&(r=0);var i=an(e);return r%sn(e)!=0?new i(n?t.slice(r,r+n*sn(e)):t.slice(r)):new i(t,r,null!=n?n:(t.byteLength-r)/sn(e))}var un=function(){function e(e,t){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=t;var r=this.getGlobalProperty("POINTS_LENGTH",en.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}return e.prototype.getExtension=function(e){return this.json.extensions&&this.json.extensions[e]},e.prototype.hasProperty=function(e){return Boolean(this.json[e])},e.prototype.getGlobalProperty=function(e,t,r){var n=this.json[e];return"number"==typeof n?new(an(t))([n]):Array.isArray(n)?new(an(t))(n):n&&Number.isFinite(n.byteOffset)?this.getTypedArrayFromBinary(e,t,r,1,n.byteOffset):null},e.prototype.getPropertyArray=function(e,t,r){var n=this.json[e];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(t=function(e){var t=on[e];if(!t)throw new Error("Failed to convert GL type");return t}(n.componentType)),this.getTypedArrayFromBinary(e,t,r,this.featuresLength,n.byteOffset)):this.getTypedArrayFromArray(e,t,n)},e.prototype.getProperty=function(e,t,r,n,i){if(!this.json[e])return null;var o=this.getPropertyArray(e,t,r);if(1===r)return i[0]=o[n],i;for(var a=0;a<r;++a)i[a]=o[r*n+a];return i},e.prototype.getTypedArrayFromBinary=function(e,t,r,n,i){var o=this.cachedTypedArrays,a=o[e];return a||(a=ln(t,this.buffer.buffer,this.buffer.byteOffset+i,n*r),o[e]=a),a},e.prototype.getTypedArrayFromArray=function(e,t,r){var n=this.cachedTypedArrays,i=n[e];return i||(i=ln(t,r),n[e]=i),i},e}(),cn=4,hn="b3dm tile in legacy format.";function pn(e,t,r){var n=new TextDecoder("utf8"),i=new Uint8Array(e,t,r);return n.decode(i)}function dn(t,r,n){return n=function(e,t,r){var n=new DataView(t),i=0;e.header=e.header||{};var o=n.getUint32(r,!0);r+=cn;var a=n.getUint32(r,!0);r+=cn;var s=n.getUint32(r,!0);r+=cn;var l=n.getUint32(r,!0);return r+=cn,s>=570425344?(r-=2*cn,i=o,s=a,l=0,o=0,a=0,console.warn(hn)):l>=570425344&&(r-=cn,i=s,s=o,l=a,o=0,a=0,console.warn(hn)),e.header.featureTableJsonByteLength=o,e.header.featureTableBinaryByteLength=a,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=l,e.header.batchLength=i,r}(t,r,n),n=function(t,r,n){var i=t.header||{},o=i.featureTableJsonByteLength,a=i.featureTableBinaryByteLength,s=i.batchLength;if(t.featureTableJson={BATCH_LENGTH:s||0},o&&o>0){var l=pn(r,n,o);t.featureTableJson=JSON.parse(l)}n+=o||0,t.featureTableBinary=new Uint8Array(r,n,a),n+=a||0,t.rtcCenter=new e.Vector3;var u=new un(t.featureTableJson,t.featureTableBinary);if(Array.isArray(u.json.RTC_CENTER))t.rtcCenter.fromArray(u.json.RTC_CENTER);else{var c=u.getGlobalProperty("RTC_CENTER",en.FLOAT,3);c&&t.rtcCenter.fromArray(c)}return n}(t,r,n),n=function(e,t,r){var n=e.header||{},i=n.batchTableJsonByteLength,o=n.batchTableBinaryByteLength;if(i&&i>0){var a=pn(t,r,i);e.batchTableJson=JSON.parse(a),r+=i,o&&o>0&&(e.batchTableBinary=new Uint8Array(t,r,o),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=o)}return r}(t,r,n),n}var fn=function(t){e.Loader.call(this,t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};fn.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:fn,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(t,r,n,i){var o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),"use-credentials"===this.crossOrigin&&o.setWithCredentials(!0),o.load(t,(e=>{var t={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,t).then(r).catch(i)}),n,i)},decodeDracoFile:function(e,t,r,n){var i={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,i).then(t)},decodeGeometry:function(e,t){for(var r in t.attributeTypes){var n=t.attributeTypes[r];void 0!==n.BYTES_PER_ELEMENT&&(t.attributeTypes[r]=n.name)}var i,o=JSON.stringify(t);if(fn.taskCache.has(e)){var a=fn.taskCache.get(e);if(a.key===o)return a.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,l=e.byteLength,u=this._getWorker(s,l).then((r=>(i=r,new Promise(((r,n)=>{i._callbacks[s]={resolve:r,reject:n},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return u.catch((()=>!0)).then((()=>{i&&s&&this._releaseTask(i,s)})),fn.taskCache.set(e,{key:o,promise:u}),u},_createGeometry:function(t){var r=new e.BufferGeometry;t.index&&r.setIndex(new e.BufferAttribute(t.index.array,1));for(var n=0;n<t.attributes.length;n++){var i=t.attributes[n],o=i.name,a=i.array,s=i.itemSize;r.setAttribute(o,new e.BufferAttribute(a,s))}return r},_loadLibrary:function(t,r){var n=new e.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(r),new Promise(((e,r)=>{n.load(t,e,void 0,r)}))},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{var r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var n=fn.DRACOWorker.toString(),i=["/* draco decoder */",r,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))})),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then((()=>{var r;return this.workerPool.length<this.workerLimit?((r=new Worker(this.workerSourceURL))._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},this.workerPool.push(r)):this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1})),(r=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,r._taskLoad+=t,r}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),fn.DRACOWorker=function(){var e,t;function r(e,t,r,n,i,o){var a,s,l=o.num_components(),u=r.num_points()*l;switch(i){case Float32Array:a=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(r,o,a),s=new Float32Array(u);break;case Int8Array:a=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(r,o,a),s=new Int8Array(u);break;case Int16Array:a=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(r,o,a),s=new Int16Array(u);break;case Int32Array:a=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(r,o,a),s=new Int32Array(u);break;case Uint8Array:a=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(r,o,a),s=new Uint8Array(u);break;case Uint16Array:a=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(r,o,a),s=new Uint16Array(u);break;case Uint32Array:a=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(r,o,a),s=new Uint32Array(u);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var c=0;c<u;c++)s[c]=a.GetValue(c);return e.destroy(a),{name:n,array:s,itemSize:l}}onmessage=function(n){var i=n.data;switch(i.type){case"init":e=i.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var o=i.buffer,a=i.taskConfig;t.then((e=>{var t=e.draco,n=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(o),o.byteLength);try{var l=function(e,t,n,i){var o,a,s=i.attributeIDs,l=i.attributeTypes,u=t.GetEncodedGeometryType(n);if(u===e.TRIANGULAR_MESH)o=new e.Mesh,a=t.DecodeBufferToMesh(n,o);else{if(u!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,a=t.DecodeBufferToPointCloud(n,o)}if(!a.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+a.error_msg());var c={index:null,attributes:[]};for(var h in s){var p,d,f=self[l[h]];if(i.useUniqueIDs)d=s[h],p=t.GetAttributeByUniqueId(o,d);else{if(-1===(d=t.GetAttributeId(o,e[s[h]])))continue;p=t.GetAttribute(o,d)}c.attributes.push(r(e,t,o,h,f,p))}if(u===e.TRIANGULAR_MESH){for(var v=o.num_faces(),m=new Uint32Array(3*v),A=new e.DracoInt32Array,g=0;g<v;++g){t.GetFaceFromMesh(o,g,A);for(var y=0;y<3;++y)m[3*g+y]=A.GetValue(y)}c.index={array:m,itemSize:1},e.destroy(A)}return e.destroy(o),c}(t,n,s,a),u=l.attributes.map((e=>e.array.buffer));l.index&&u.push(l.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:l},u)}catch(e){console.error(e),self.postMessage({type:"error",id:i.id,error:e.message})}finally{t.destroy(s),t.destroy(n)}}))}}},fn.taskCache=new WeakMap,fn.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},fn.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},fn.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},fn.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var vn=new fn;vn.setDecoderPath("https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/");var mn=function(){function t(t){e.Loader.call(this,t),this.dracoLoader=null,this.ddsLoader=null}function r(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}t.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:t,load:function(t,r,n,i){var o,a=this;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:e.LoaderUtils.extractUrlBase(t),a.manager.itemStart(t);var s=function(e){i?i(e):console.error(e),a.manager.itemError(t),a.manager.itemEnd(t)},l=new e.FileLoader(a.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),"use-credentials"===a.crossOrigin&&l.setWithCredentials(!0),l.load(t,(function(e){try{a.parse(e,o,(function(e){r(e),a.manager.itemEnd(t)}),s)}catch(e){s(e)}}),n,s)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(t,r,u,c){var f,A={};if("string"==typeof t)f=t;else if(e.LoaderUtils.decodeText(new Uint8Array(t,0,4))===l){try{A[n.KHR_BINARY_GLTF]=new h(t)}catch(e){return void(c&&c(e))}f=A[n.KHR_BINARY_GLTF].content}else f=e.LoaderUtils.decodeText(new Uint8Array(t));var g=JSON.parse(f);if(void 0===g.asset||g.asset.version[0]<2)c&&c(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(g.extensionsUsed)for(var y=0;y<g.extensionsUsed.length;++y){var b=g.extensionsUsed[y],x=g.extensionsRequired||[];switch(b){case n.KHR_LIGHTS_PUNCTUAL:A[b]=new o(g);break;case n.KHR_MATERIALS_CLEARCOAT:A[b]=new s;break;case n.KHR_MATERIALS_UNLIT:A[b]=new a;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:A[b]=new v;break;case n.KHR_DRACO_MESH_COMPRESSION:A[b]=new p(g,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:A[b]=new i(this.ddsLoader);break;case n.KHR_TEXTURE_TRANSFORM:A[b]=new d;break;case n.KHR_MESH_QUANTIZATION:A[b]=new m;break;default:x.indexOf(b)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+b+'".')}}var w=new R(g,A,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});w.fileLoader.setRequestHeader(this.requestHeader),w.parse(u,c)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function i(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function o(e){this.name=n.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function a(){this.name=n.KHR_MATERIALS_UNLIT}function s(){this.name=n.KHR_MATERIALS_CLEARCOAT}o.prototype.loadLight=function(t){var r,n=this.lightDefs[t],i=new e.Color(16777215);void 0!==n.color&&i.fromArray(n.color);var o=void 0!==n.range?n.range:0;switch(n.type){case"directional":(r=new e.DirectionalLight(i)).target.position.set(0,0,-1),r.add(r.target);break;case"point":(r=new e.PointLight(i)).distance=o;break;case"spot":(r=new e.SpotLight(i)).distance=o,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,r.angle=n.spot.outerConeAngle,r.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,r.target.position.set(0,0,-1),r.add(r.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return r.position.set(0,0,0),r.decay=2,void 0!==n.intensity&&(r.intensity=n.intensity),r.name=n.name||"light_"+t,Promise.resolve(r)},a.prototype.getMaterialType=function(){return e.MeshBasicMaterial},a.prototype.extendParams=function(t,r,n){var i=[];t.color=new e.Color(1,1,1),t.opacity=1;var o=r.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){var a=o.baseColorFactor;t.color.fromArray(a),t.opacity=a[3]}void 0!==o.baseColorTexture&&i.push(n.assignTexture(t,"map",o.baseColorTexture))}return Promise.all(i)},s.prototype.getMaterialType=function(){return e.MeshPhysicalMaterial},s.prototype.extendParams=function(t,r,n){var i=[],o=r.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new e.Vector2(a,a)}return Promise.all(i)};var l="glTF",u=12,c={JSON:1313821514,BIN:5130562};function h(t){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,u);if(this.header={magic:e.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==l)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=new DataView(t,u),o=0;o<i.byteLength;){var a=i.getUint32(o,!0);o+=4;var s=i.getUint32(o,!0);if(o+=4,s===c.JSON){var h=new Uint8Array(t,u+o,a);this.content=e.LoaderUtils.decodeText(h)}else if(s===c.BIN){var p=u+o;this.body=t.slice(p,p+a)}o+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function p(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function d(){this.name=n.KHR_TEXTURE_TRANSFORM}function f(t){e.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var r=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),i=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),o=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),a=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),s={specular:{value:(new e.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(e){for(var t in s)e.uniforms[t]=s[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",r),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",i),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",o),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",a)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(e){s.specular.value=e}},specularMap:{get:function(){return s.specularMap.value},set:function(e){s.specularMap.value=e}},glossiness:{get:function(){return s.glossiness.value},set:function(e){s.glossiness.value=e}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(e){s.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function v(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return f},extendParams:function(t,r,n){var i=r.extensions[this.name];t.color=new e.Color(1,1,1),t.opacity=1;var o=[];if(Array.isArray(i.diffuseFactor)){var a=i.diffuseFactor;t.color.fromArray(a),t.opacity=a[3]}if(void 0!==i.diffuseTexture&&o.push(n.assignTexture(t,"map",i.diffuseTexture)),t.emissive=new e.Color(0,0,0),t.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,t.specular=new e.Color(1,1,1),Array.isArray(i.specularFactor)&&t.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){var s=i.specularGlossinessTexture;o.push(n.assignTexture(t,"glossinessMap",s)),o.push(n.assignTexture(t,"specularMap",s))}return Promise.all(o)},createMaterial:function(t){var r=new f(t);return r.fog=!0,r.color=t.color,r.map=void 0===t.map?null:t.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=void 0===t.aoMap?null:t.aoMap,r.aoMapIntensity=1,r.emissive=t.emissive,r.emissiveIntensity=1,r.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,r.bumpMap=void 0===t.bumpMap?null:t.bumpMap,r.bumpScale=1,r.normalMap=void 0===t.normalMap?null:t.normalMap,r.normalMapType=e.TangentSpaceNormalMap,t.normalScale&&(r.normalScale=t.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=void 0===t.specularMap?null:t.specularMap,r.specular=t.specular,r.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,r.glossiness=t.glossiness,r.alphaMap=null,r.envMap=void 0===t.envMap?null:t.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function m(){this.name=n.KHR_MESH_QUANTIZATION}function A(t,r,n,i){e.Interpolant.call(this,t,r,n,i)}p.prototype.decodePrimitive=function(e,t){var r=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},s={},l={};for(var u in o){var c=w[u]||u.toLowerCase();a[c]=o[u]}for(u in e.attributes)if(c=w[u]||u.toLowerCase(),void 0!==o[u]){var h=r.accessors[e.attributes[u]],p=g[h.componentType];l[c]=p,s[c]=!0===h.normalized}return t.getDependency("bufferView",i).then((function(e){return new Promise((function(t){n.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r],i=s[r];void 0!==i&&(n.normalized=i)}t(e)}),a,l)}))}))},d.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},f.prototype=Object.create(e.MeshStandardMaterial.prototype),f.prototype.constructor=f,f.prototype.copy=function(t){return e.MeshStandardMaterial.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},A.prototype=Object.create(e.Interpolant.prototype),A.prototype.constructor=A,A.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n*3+n,o=0;o!==n;o++)t[o]=r[i+o];return t},A.prototype.beforeStart_=A.prototype.copySampleValue_,A.prototype.afterEnd_=A.prototype.copySampleValue_,A.prototype.interpolate_=function(e,t,r,n){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,l=3*a,u=n-t,c=(r-t)/u,h=c*c,p=h*c,d=e*l,f=d-l,v=-2*p+3*h,m=p-h,A=1-v,g=m-h+c,y=0;y!==a;y++){var b=o[f+y+a],x=o[f+y+s]*u,w=o[d+y+a],M=o[d+y]*u;i[y]=A*b+g*x+v*w+m*M}return i};var g={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},y={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},b={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},x={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},w={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},M={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},E={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},C={"image/png":e.RGBAFormat,"image/jpeg":e.RGBFormat};function S(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function I(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function P(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function T(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,n=t.weights.length;r<n;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length)for(e.morphTargetDictionary={},r=0,n=i.length;r<n;r++)e.morphTargetDictionary[i[r]]=r;else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function B(e){for(var t="",r=Object.keys(e).sort(),n=0,i=r.length;n<i;n++)t+=r[n]+":"+e[r[n]]+";";return t}function R(t,n,i){this.json=t||{},this.extensions=n||{},this.options=i||{},this.cache=new r,this.associations=new Map,this.primitiveCache={},this.textureLoader=new e.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new e.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function O(t,r,n){var i=r.attributes,o=[];function a(e,r){return n.getDependency("accessor",e).then((function(e){t.setAttribute(r,e)}))}for(var s in i){var l=w[s]||s.toLowerCase();l in t.attributes||o.push(a(i[s],l))}if(void 0!==r.indices&&!t.index){var u=n.getDependency("accessor",r.indices).then((function(e){t.setIndex(e)}));o.push(u)}return P(t,r),function(t,r,n){var i=r.attributes,o=new e.Box3;if(void 0!==i.POSITION){var a=(d=n.json.accessors[i.POSITION]).min,s=d.max;if(void 0!==a&&void 0!==s){o.set(new e.Vector3(a[0],a[1],a[2]),new e.Vector3(s[0],s[1],s[2]));var l=r.targets;if(void 0!==l){for(var u=new e.Vector3,c=new e.Vector3,h=0,p=l.length;h<p;h++){var d,f=l[h];void 0!==f.POSITION&&(a=(d=n.json.accessors[f.POSITION]).min,s=d.max,void 0!==a&&void 0!==s?(c.setX(Math.max(Math.abs(a[0]),Math.abs(s[0]))),c.setY(Math.max(Math.abs(a[1]),Math.abs(s[1]))),c.setZ(Math.max(Math.abs(a[2]),Math.abs(s[2]))),u.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}o.expandByVector(u)}t.boundingBox=o;var v=new e.Sphere;o.getCenter(v.center),v.radius=o.min.distanceTo(o.max)/2,t.boundingSphere=v}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,r,n),Promise.all(o).then((function(){return void 0!==r.targets?function(e,t,r){for(var n=!1,i=!1,o=0,a=t.length;o<a&&(void 0!==(u=t[o]).POSITION&&(n=!0),void 0!==u.NORMAL&&(i=!0),!n||!i);o++);if(!n&&!i)return Promise.resolve(e);var s=[],l=[];for(o=0,a=t.length;o<a;o++){var u=t[o];if(n){var c=void 0!==u.POSITION?r.getDependency("accessor",u.POSITION):e.attributes.position;s.push(c)}i&&(c=void 0!==u.NORMAL?r.getDependency("accessor",u.NORMAL):e.attributes.normal,l.push(c))}return Promise.all([Promise.all(s),Promise.all(l)]).then((function(t){var r=t[0],o=t[1];return n&&(e.morphAttributes.position=r),i&&(e.morphAttributes.normal=o),e.morphTargetsRelative=!0,e}))}(t,r.targets,n):t}))}function k(t,r){var n=t.getIndex();if(null===n){var i=[],o=t.getAttribute("position");if(void 0===o)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var a=0;a<o.count;a++)i.push(a);t.setIndex(i),n=t.getIndex()}var s=n.count-2,l=[];if(r===e.TriangleFanDrawMode)for(a=1;a<=s;a++)l.push(n.getX(0)),l.push(n.getX(a)),l.push(n.getX(a+1));else for(a=0;a<s;a++)a%2==0?(l.push(n.getX(a)),l.push(n.getX(a+1)),l.push(n.getX(a+2))):(l.push(n.getX(a+2)),l.push(n.getX(a+1)),l.push(n.getX(a)));l.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var u=t.clone();return u.setIndex(l),u}return R.prototype.parse=function(e,t){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var o={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};I(i,o,n),P(o,n),e(o)})).catch(t)},R.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n={},i={},o=0,a=t.length;o<a;o++)for(var s=t[o].joints,l=0,u=s.length;l<u;l++)e[s[l]].isBone=!0;for(var c=0,h=e.length;c<h;c++){var p=e[c];void 0!==p.mesh&&(void 0===n[p.mesh]&&(n[p.mesh]=i[p.mesh]=0),n[p.mesh]++,void 0!==p.skin&&(r[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=n,this.json.meshUses=i},R.prototype.getDependency=function(e,t){var r=e+":"+t,i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this.loadNode(t);break;case"mesh":i=this.loadMesh(t);break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this.loadBufferView(t);break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this.loadMaterial(t);break;case"texture":i=this.loadTexture(t);break;case"skin":i=this.loadSkin(t);break;case"animation":i=this.loadAnimation(t);break;case"camera":i=this.loadCamera(t);break;case"light":i=this.extensions[n.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,i)}return i},R.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var r=this,n=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(n.map((function(t,n){return r.getDependency(e,n)}))),this.cache.add(e,t)}return t},R.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,n){r.load(S(t.uri,i.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},R.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))},R.prototype.loadAccessor=function(t){var r=this,n=this.json,i=this.json.accessors[t];if(void 0===i.bufferView&&void 0===i.sparse)return Promise.resolve(null);var o=[];return void 0!==i.bufferView?o.push(this.getDependency("bufferView",i.bufferView)):o.push(null),void 0!==i.sparse&&(o.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(o).then((function(t){var o,a,s=t[0],l=x[i.type],u=g[i.componentType],c=u.BYTES_PER_ELEMENT,h=c*l,p=i.byteOffset||0,d=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,f=!0===i.normalized;if(d&&d!==h){var v=Math.floor(p/d),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+v+":"+i.count,A=r.cache.get(m);A||(o=new u(s,v*d,i.count*d/c),A=new e.InterleavedBuffer(o,d/c),r.cache.add(m,A)),a=new e.InterleavedBufferAttribute(A,l,p%d/c,f)}else o=null===s?new u(i.count*l):new u(s,p,i.count*l),a=new e.BufferAttribute(o,l,f);if(void 0!==i.sparse){var y=x.SCALAR,b=g[i.sparse.indices.componentType],w=i.sparse.indices.byteOffset||0,M=i.sparse.values.byteOffset||0,E=new b(t[1],w,i.sparse.count*y),C=new u(t[2],M,i.sparse.count*l);null!==s&&(a=new e.BufferAttribute(a.array.slice(),a.itemSize,a.normalized));for(var S=0,I=E.length;S<I;S++){var P=E[S];if(a.setX(P,C[S*l]),l>=2&&a.setY(P,C[S*l+1]),l>=3&&a.setZ(P,C[S*l+2]),l>=4&&a.setW(P,C[S*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a}))},R.prototype.loadTexture=function(t){var r,i=this,o=this.json,a=this.options,s=this.textureLoader,l=self.URL||self.webkitURL,u=o.textures[t],c=u.extensions||{},h=(r=c[n.MSFT_TEXTURE_DDS]?o.images[c[n.MSFT_TEXTURE_DDS].source]:o.images[u.source]).uri,p=!1;return void 0!==r.bufferView&&(h=i.getDependency("bufferView",r.bufferView).then((function(e){p=!0;var t=new Blob([e],{type:r.mimeType});return h=l.createObjectURL(t)}))),Promise.resolve(h).then((function(e){var t=a.manager.getHandler(e);return t||(t=c[n.MSFT_TEXTURE_DDS]?i.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:s),new Promise((function(r,n){t.load(S(e,a.path),r,void 0,n)}))})).then((function(n){!0===p&&l.revokeObjectURL(h),n.flipY=!1,u.name&&(n.name=u.name),r.mimeType in C&&(n.format=C[r.mimeType]);var a=(o.samplers||{})[u.sampler]||{};return n.magFilter=y[a.magFilter]||e.LinearFilter,n.minFilter=y[a.minFilter]||e.LinearMipmapLinearFilter,n.wrapS=b[a.wrapS]||e.RepeatWrapping,n.wrapT=b[a.wrapT]||e.RepeatWrapping,i.associations.set(n,{type:"textures",index:t}),n}))},R.prototype.assignTexture=function(t,r,i){var o=this;return this.getDependency("texture",i.index).then((function(a){if(!a.isCompressedTexture)switch(r){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=e.RGBFormat}if(void 0===i.texCoord||0==i.texCoord||"aoMap"===r&&1==i.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+i.texCoord+" for texture "+r+" not yet supported."),o.extensions[n.KHR_TEXTURE_TRANSFORM]){var s=void 0!==i.extensions?i.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var l=this.associations.get(a);a=o.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(a,s),this.associations.set(a,l)}}t[r]=a}))},R.prototype.assignFinalMaterial=function(t){var r=t.geometry,n=t.material,i=void 0!==r.attributes.tangent,o=void 0!==r.attributes.color,a=void 0===r.attributes.normal,s=!0===t.isSkinnedMesh,l=Object.keys(r.morphAttributes).length>0,u=l&&void 0!==r.morphAttributes.normal;if(t.isPoints){var c="PointsMaterial:"+n.uuid,h=this.cache.get(c);h||(h=new e.PointsMaterial,e.Material.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(c,h)),n=h}else if(t.isLine){c="LineBasicMaterial:"+n.uuid;var p=this.cache.get(c);p||(p=new e.LineBasicMaterial,e.Material.prototype.copy.call(p,n),p.color.copy(n.color),this.cache.add(c,p)),n=p}if(i||o||a||s||l){c="ClonedMaterial:"+n.uuid+":",n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),s&&(c+="skinning:"),i&&(c+="vertex-tangents:"),o&&(c+="vertex-colors:"),a&&(c+="flat-shading:"),l&&(c+="morph-targets:"),u&&(c+="morph-normals:");var d=this.cache.get(c);d||(d=n.clone(),s&&(d.skinning=!0),i&&(d.vertexTangents=!0),o&&(d.vertexColors=!0),a&&(d.flatShading=!0),l&&(d.morphTargets=!0),u&&(d.morphNormals=!0),this.cache.add(c,d),this.associations.set(d,this.associations.get(n))),n=d}n.aoMap&&void 0===r.attributes.uv2&&void 0!==r.attributes.uv&&r.setAttribute("uv2",r.attributes.uv),n.normalScale&&!i&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!i&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),t.material=n},R.prototype.loadMaterial=function(t){var r,i=this,o=this.json,a=this.extensions,s=o.materials[t],l={},u=s.extensions||{},c=[];if(u[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=a[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=h.getMaterialType(),c.push(h.extendParams(l,s,i))}else if(u[n.KHR_MATERIALS_UNLIT]){var p=a[n.KHR_MATERIALS_UNLIT];r=p.getMaterialType(),c.push(p.extendParams(l,s,i))}else{r=e.MeshStandardMaterial;var d=s.pbrMetallicRoughness||{};if(l.color=new e.Color(1,1,1),l.opacity=1,Array.isArray(d.baseColorFactor)){var v=d.baseColorFactor;l.color.fromArray(v),l.opacity=v[3]}void 0!==d.baseColorTexture&&c.push(i.assignTexture(l,"map",d.baseColorTexture)),l.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,l.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(c.push(i.assignTexture(l,"metalnessMap",d.metallicRoughnessTexture)),c.push(i.assignTexture(l,"roughnessMap",d.metallicRoughnessTexture)))}!0===s.doubleSided&&(l.side=e.DoubleSide);var m=s.alphaMode||"OPAQUE";if("BLEND"===m?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===m&&(l.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&r!==e.MeshBasicMaterial&&(c.push(i.assignTexture(l,"normalMap",s.normalTexture)),l.normalScale=new e.Vector2(1,1),void 0!==s.normalTexture.scale&&l.normalScale.set(s.normalTexture.scale,s.normalTexture.scale)),void 0!==s.occlusionTexture&&r!==e.MeshBasicMaterial&&(c.push(i.assignTexture(l,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(l.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&r!==e.MeshBasicMaterial&&(l.emissive=(new e.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&r!==e.MeshBasicMaterial&&c.push(i.assignTexture(l,"emissiveMap",s.emissiveTexture)),u[n.KHR_MATERIALS_CLEARCOAT]){var A=a[n.KHR_MATERIALS_CLEARCOAT];r=A.getMaterialType(),c.push(A.extendParams(l,{extensions:u},i))}return Promise.all(c).then((function(){var o;return o=r===f?a[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new r(l),s.name&&(o.name=s.name),o.map&&(o.map.encoding=e.sRGBEncoding),o.emissiveMap&&(o.emissiveMap.encoding=e.sRGBEncoding),P(o,s),i.associations.set(o,{type:"materials",index:t}),s.extensions&&I(a,o,s),o}))},R.prototype.loadGeometries=function(t){var r=this,i=this.extensions,o=this.primitiveCache;function a(e){return i[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return O(t,e,r)}))}for(var s,l,u=[],c=0,h=t.length;c<h;c++){var p,d=t[c],f=(void 0,(l=(s=d).extensions&&s.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+B(l.attributes):s.indices+":"+B(s.attributes)+":"+s.mode),v=o[f];v?u.push(v.promise):(p=d.extensions&&d.extensions[n.KHR_DRACO_MESH_COMPRESSION]?a(d):O(new e.BufferGeometry,d,r),o[f]={primitive:d,promise:p},u.push(p))}return Promise.all(u)},R.prototype.loadMesh=function(t){for(var r,n=this,i=this.json.meshes[t],o=i.primitives,a=[],s=0,l=o.length;s<l;s++){var u=void 0===o[s].material?(void 0===(r=this.cache).DefaultMaterial&&(r.DefaultMaterial=new e.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:e.FrontSide})),r.DefaultMaterial):this.getDependency("material",o[s].material);a.push(u)}return a.push(n.loadGeometries(o)),Promise.all(a).then((function(r){for(var a=r.slice(0,r.length-1),s=r[r.length-1],l=[],u=0,c=s.length;u<c;u++){var h,p=s[u],d=o[u],f=a[u];if(4===d.mode||5===d.mode||6===d.mode||void 0===d.mode)!0!==(h=!0===i.isSkinnedMesh?new e.SkinnedMesh(p,f):new e.Mesh(p,f)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),5===d.mode?h.geometry=k(h.geometry,e.TriangleStripDrawMode):6===d.mode&&(h.geometry=k(h.geometry,e.TriangleFanDrawMode));else if(1===d.mode)h=new e.LineSegments(p,f);else if(3===d.mode)h=new e.Line(p,f);else if(2===d.mode)h=new e.LineLoop(p,f);else{if(0!==d.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);h=new e.Points(p,f)}Object.keys(h.geometry.morphAttributes).length>0&&T(h,i),h.name=i.name||"mesh_"+t,s.length>1&&(h.name+="_"+u),P(h,i),n.assignFinalMaterial(h),l.push(h)}if(1===l.length)return l[0];var v=new e.Group;for(u=0,c=l.length;u<c;u++)v.add(l[u]);return v}))},R.prototype.loadCamera=function(t){var r,n=this.json.cameras[t],i=n[n.type];if(i)return"perspective"===n.type?r=new e.PerspectiveCamera(e.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(r=new e.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(r.name=n.name),P(r,n),Promise.resolve(r);console.warn("THREE.GLTFLoader: Missing camera parameters.")},R.prototype.loadSkin=function(e){var t=this.json.skins[e],r={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return r.inverseBindMatrices=e,r}))},R.prototype.loadAnimation=function(t){for(var r=this.json.animations[t],n=[],i=[],o=[],a=[],s=[],l=0,u=r.channels.length;l<u;l++){var c=r.channels[l],h=r.samplers[c.sampler],p=c.target,d=void 0!==p.node?p.node:p.id,f=void 0!==r.parameters?r.parameters[h.input]:h.input,v=void 0!==r.parameters?r.parameters[h.output]:h.output;n.push(this.getDependency("node",d)),i.push(this.getDependency("accessor",f)),o.push(this.getDependency("accessor",v)),a.push(h),s.push(p)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(o),Promise.all(a),Promise.all(s)]).then((function(n){for(var i=n[0],o=n[1],a=n[2],s=n[3],l=n[4],u=[],c=0,h=i.length;c<h;c++){var p=i[c],d=o[c],f=a[c],v=s[c],m=l[c];if(void 0!==p){var g;switch(p.updateMatrix(),p.matrixAutoUpdate=!0,M[m.path]){case M.weights:g=e.NumberKeyframeTrack;break;case M.rotation:g=e.QuaternionKeyframeTrack;break;default:g=e.VectorKeyframeTrack}var y=p.name?p.name:p.uuid,b=void 0!==v.interpolation?E[v.interpolation]:e.InterpolateLinear,x=[];M[m.path]===M.weights?p.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&x.push(e.name?e.name:e.uuid)})):x.push(y);var w=f.array;if(f.normalized){var C;if(w.constructor===Int8Array)C=1/127;else if(w.constructor===Uint8Array)C=1/255;else if(w.constructor==Int16Array)C=1/32767;else{if(w.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");C=1/65535}for(var S=new Float32Array(w.length),I=0,P=w.length;I<P;I++)S[I]=w[I]*C;w=S}for(I=0,P=x.length;I<P;I++){var T=new g(x[I]+"."+M[m.path],d.array,w,b);"CUBICSPLINE"===v.interpolation&&(T.createInterpolant=function(e){return new A(this.times,this.values,this.getValueSize()/3,e)},T.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(T)}}}var B=r.name?r.name:"animation_"+t;return new e.AnimationClip(B,void 0,u)}))},R.prototype.loadNode=function(t){var r,i=this.json,o=this.extensions,a=this,s=i.meshReferences,l=i.meshUses,u=i.nodes[t];return(r=[],void 0!==u.mesh&&r.push(a.getDependency("mesh",u.mesh).then((function(e){var t;if(s[u.mesh]>1){var r=l[u.mesh]++;(t=e.clone()).name+="_instance_"+r}else t=e;return void 0!==u.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=u.weights.length;t<r;t++)e.morphTargetInfluences[t]=u.weights[t]})),t}))),void 0!==u.camera&&r.push(a.getDependency("camera",u.camera)),u.extensions&&u.extensions[n.KHR_LIGHTS_PUNCTUAL]&&void 0!==u.extensions[n.KHR_LIGHTS_PUNCTUAL].light&&r.push(a.getDependency("light",u.extensions[n.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(r)).then((function(r){var n;if((n=!0===u.isBone?new e.Bone:r.length>1?new e.Group:1===r.length?r[0]:new e.Object3D)!==r[0])for(var i=0,s=r.length;i<s;i++)n.add(r[i]);if(u.name&&(n.userData.name=u.name,n.name=e.PropertyBinding.sanitizeNodeName(u.name)),P(n,u),u.extensions&&I(o,n,u),void 0!==u.matrix){var l=new e.Matrix4;l.fromArray(u.matrix),n.applyMatrix4(l)}else void 0!==u.translation&&n.position.fromArray(u.translation),void 0!==u.rotation&&n.quaternion.fromArray(u.rotation),void 0!==u.scale&&n.scale.fromArray(u.scale);return a.associations.set(n,{type:"nodes",index:t}),n}))},R.prototype.loadScene=function(){function t(r,n,i,o){var a=i.nodes[r];return o.getDependency("node",r).then((function(t){return void 0===a.skin?t:o.getDependency("skin",a.skin).then((function(e){for(var t=[],n=0,i=(r=e).joints.length;n<i;n++)t.push(o.getDependency("node",r.joints[n]));return Promise.all(t)})).then((function(n){return t.traverse((function(t){if(t.isMesh){for(var i=[],o=[],a=0,s=n.length;a<s;a++){var l=n[a];if(l){i.push(l);var u=new e.Matrix4;void 0!==r.inverseBindMatrices&&u.fromArray(r.inverseBindMatrices.array,16*a),o.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',r.joints[a])}t.bind(new e.Skeleton(i,o),t.matrixWorld)}})),t}));var r})).then((function(e){n.add(e);var r=[];if(a.children)for(var s=a.children,l=0,u=s.length;l<u;l++){var c=s[l];r.push(t(c,e,i,o))}return Promise.all(r)}))}return function(r){var n=this.json,i=this.extensions,o=this.json.scenes[r],a=new e.Group;o.name&&(a.name=o.name),P(a,o),o.extensions&&I(i,a,o);for(var s=o.nodes||[],l=[],u=0,c=s.length;u<c;u++)l.push(t(s[u],a,n,this));return Promise.all(l).then((function(){return a}))}}(),t}(),An=function(t){e.CompressedTextureLoader.call(this,t)};An.prototype=Object.assign(Object.create(e.CompressedTextureLoader.prototype),{constructor:An,parse:function(t,r){var n={mipmaps:[],width:0,height:0,format:null,mipmapCount:1};function i(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function o(e,t,r,n){for(var i=r*n*4,o=new Uint8Array(e,t,i),a=new Uint8Array(i),s=0,l=0,u=0;u<n;u++)for(var c=0;c<r;c++){var h=o[l],p=o[++l],d=o[++l],f=o[++l];l++,a[s]=d,a[++s]=p,a[++s]=h,a[++s]=f,s++}return a}var a,s=i("DXT1"),l=i("DXT3"),u=i("DXT5"),c=i("ETC1"),h=new Int32Array(t,0,31);if(542327876!==h[0])return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),n;if(4&!h[20])return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),n;var p,d=h[21],f=!1;switch(d){case s:a=8,n.format=e.RGB_S3TC_DXT1_Format;break;case l:a=16,n.format=e.RGBA_S3TC_DXT3_Format;break;case u:a=16,n.format=e.RGBA_S3TC_DXT5_Format;break;case c:a=8,n.format=e.RGB_ETC1_Format;break;default:if(!(32===h[22]&&16711680&h[23]&&65280&h[24]&&255&h[25]&&4278190080&h[26]))return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",(p=d,String.fromCharCode(255&p,p>>8&255,p>>16&255,p>>24&255))),n;f=!0,a=64,n.format=e.RGBAFormat}n.mipmapCount=1,131072&h[2]&&!1!==r&&(n.mipmapCount=Math.max(1,h[7]));var v=h[28];if(n.isCubemap=!!(512&v),n.isCubemap&&(!(1024&v)||!(2048&v)||!(4096&v)||!(8192&v)||!(16384&v)||!(32768&v)))return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),n;n.width=h[4],n.height=h[3];for(var m=h[1]+4,A=n.isCubemap?6:1,g=0;g<A;g++)for(var y=n.width,b=n.height,x=0;x<n.mipmapCount;x++){if(f)var w=(M=o(t,m,y,b)).length;else{w=Math.max(4,y)/4*Math.max(4,b)/4*a;var M=new Uint8Array(t,m,w)}var E={data:M,width:y,height:b};n.mipmaps.push(E),m+=w,y=Math.max(y>>1,1),b=Math.max(b>>1,1)}return n}});var gn=(new e.Matrix4).fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function yn(t,r){var n={uri:t,gltfUpAxis:r.upAxis};return Promise.resolve().then((function(){return Se(t,{responseType:"arraybuffer",allowHosts:r.allowHosts,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe}).then((function(e){return e.body}))})).then((function(e){return Promise.resolve(0).then((function(t){return rn(n,e,t)})).then((function(t){return dn(n,e,t)})).then((function(t){return function(e,t,r){var n=e.byteLength-r;if(0===n)throw new Error("glTF byte length must be greater than 0.");return r%4!=0&&console.warn("".concat(e.type,": embedded glb is not aligned to a 4-byte boundary.")),e.gltfArrayBuffer=function(e,t,r){var n=void 0!==r?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}(t,r,n),e.byteLength}(n,e,t)}))})).then((function(){var t=new e.Matrix4;"Z"!==r.upAxis&&t.premultiply(gn);var i=(new e.Matrix4).setPosition(n.rtcCenter);return t.premultiply(i),function(t,r){function n(t){if(t.isMesh)return function(t){var r=new tt;r.geometry=t.geometry,r.geometry.computeVertexNormals(),r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere(),r.geometry.addGroup(0,t.geometry.index.count,0);var n=new Nt;return n.uniforms.map.value=t.material.map,n.uniforms.map.value&&(n.uniforms.map.value.magFilter=e.LinearFilter,n.uniforms.map.value.minFilter=e.LinearFilter,n.uniforms.map.value.generateMipmaps=!1),n.uniforms.exposure.value=3.3,n.opacity=1,t.material.dispose(),t.geometry=null,t.material=null,r.material=[n],r.position.copy(t.position),r.quaternion.copy(t.quaternion),r.scale.copy(t.scale),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1,r.renderOrder=-1e3,r.frustumCulled=!1,r}(t);for(var r=function(e){var t=new et;return t.renderOrder=-4,t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrixAutoUpdate=!1,t.matrix.compose(t.position,t.quaternion,t.scale),t}(t),i=0;i<t.children.length;i++){var o=n(t.children[i]);r.add(o)}return r}return new Promise((function(e,i){var o=r.fileUrl.slice(0,r.fileUrl.lastIndexOf("/")+1),a=new mn,s=new An(a.manager);a.setDRACOLoader(vn),a.setDDSLoader(s),a.parse(t,o,(function(t){var i=t.scene,o=new et;o.renderOrder=-4;var a=n(i);o.add(a),o.name=r.fileUrl,e(o)}),(function(e){i(new Error("error parsing gltf ".concat(r.fileUrl,": ").concat(e.message)))}))}))}(n.gltfArrayBuffer,{fileUrl:n.uri}).then((function(e){return e.applyMatrix4(t),{type:"b3dm",uri:n.uri,byteLength:n.byteLength,object:e}}))}))}var bn=new e.Vector3,xn=new e.Vector3,wn=new e.Vector3,Mn=new e.Vector3;function En(e,t,r){var n=new un(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then((function(){var e=n.getExtension("3DTILES_draco_point_compression");return e?function(e,t){return r=this,n=void 0,o=function(){var r,n,i,o,a,s;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}(this,(function(l){if(r=e.properties||{},n=e.byteOffset,i=e.byteLength,!r||!Number.isFinite(n)||!i)throw new Error("Draco properties, byteOffset, and byteLength must be defined");return o=t.buffer.slice(n,n+i),a=e.properties,s={POSITION:"Float32Array",NORMAL:"Float32Array",RGB:"Uint8Array",RGBA:"Uint8Array"},[2,vn.decodeGeometry(o.buffer,{attributeIDs:a,attributeTypes:s,useUniqueIDs:!0}).then((function(e){var t=e.getAttribute("POSITION"),r=e.getAttribute("RGB")||e.getAttribute("RGBA"),n=e.getAttribute("NORMAL");return{position:t?Cn(en.FLOAT,t.array,t.itemSize):null,color:r?Cn(en.UNSIGNED_BYTE,r.array,r.itemSize):null,normal:n?Cn(en.FLOAT,n.array,n.itemSize):null}}))]}))},new((i=void 0)||(i=Promise))((function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function s(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(a,s)}l((o=o.apply(r,n||[])).next())}));var r,n,i,o}(e,n):{position:Sn(n),color:In(n),normal:Tn(n)}})).then((function(t){return e.attributes=t,r}))}function Cn(e,t,r){return{type:e,array:t,size:r}}function Sn(e){if(e.hasProperty("POSITION")){var t=e.getPropertyArray("POSITION",en.FLOAT,3);return Cn(en.FLOAT,t,3)}if(e.hasProperty("POSITION_QUANTIZED")){var r=e.getPropertyArray("POSITION_QUANTIZED",en.UNSIGNED_SHORT,3),n=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",en.FLOAT,3),i=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",en.FLOAT,3);if(!n||!i)throw new Error("QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.");var o=new Float32Array(r.length),a=r.length/3;xn.fromArray(n),wn.fromArray(i);for(var s=0;s<a;s++)bn.fromArray(r,3*s).divideScalar(65535).multiply(xn).add(wn).toArray(o,3*s);return Cn(en.FLOAT,o,3)}return null}function In(e){if(e.hasProperty("RGBA")){var t=e.getPropertyArray("RGBA",en.UNSIGNED_BYTE,4);return Cn(en.UNSIGNED_BYTE,t,4)}if(e.hasProperty("RGB"))return t=e.getPropertyArray("RGB",en.UNSIGNED_BYTE,3),Cn(en.UNSIGNED_BYTE,t,3);if(e.hasProperty("RGB565")){for(var r=(t=e.getPropertyArray("RGB565",en.UNSIGNED_SHORT,1)).length,n=new Uint8Array(3*r),i=0;i<r;i++){var o=Pn(t[i]);n[3*i]=o[0],n[3*i+1]=o[1],n[3*i+2]=o[2]}return Cn(en.UNSIGNED_BYTE,n,3)}return null}function Pn(e,t){void 0===t&&(t=[0,0,0]);var r=e>>11&31,n=e>>5&63,i=31&e;return t[0]=r<<3,t[1]=n<<2,t[2]=i<<3,t}function Tn(e){if(e.hasProperty("NORMAL")){var t=e.getPropertyArray("NORMAL",en.FLOAT,3);return Cn(en.FLOAT,t,3)}if(e.hasProperty("NORMAL_OCT16P")){for(var r=(t=e.getPropertyArray("NORMAL_OCT16P",en.UNSIGNED_BYTE,2)).length/2,n=new Float32Array(3*r),i=0;i<r;i++)Bn(t[2*i],t[2*i+1],255,Mn),Mn.toArray(n,3*i);return Cn(en.FLOAT,n,3)}return null}function Bn(e,t,r,n){if(e<0||e>r||t<0||t>r)throw new Error("x and y must be unsigned normalized integers between 0 and ".concat(r));if(n.x=On(e,0,r),n.y=On(t,0,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){var i=n.x;n.x=(1-Math.abs(n.y))*Rn(i),n.y=(1-Math.abs(i))*Rn(n.y)}return n.normalize()}function Rn(e){return e<0?-1:1}function On(e,t,r){return e<t&&(e=t),e>r&&(e=r),e/r*2-1}var kn=new Nr;kn.dispose=function(){};var Dn=new Nr;function Ln(){var e={OutWindow:function(){this._windowSize=0}};return e.OutWindow.prototype.create=function(e){this._buffer&&this._windowSize===e||(this._buffer=[]),this._windowSize=e,this._pos=0,this._streamPos=0},e.OutWindow.prototype.flush=function(){var e=this._pos-this._streamPos;if(0!==e){for(;e--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},e.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},e.OutWindow.prototype.setStream=function(e){this.releaseStream(),this._stream=e},e.OutWindow.prototype.init=function(e){e||(this._streamPos=0,this._pos=0)},e.OutWindow.prototype.copyBlock=function(e,t){var r=this._pos-e-1;for(r<0&&(r+=this._windowSize);t--;)r>=this._windowSize&&(r=0),this._buffer[this._pos++]=this._buffer[r++],this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.putByte=function(e){this._buffer[this._pos++]=e,this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.getByte=function(e){var t=this._pos-e-1;return t<0&&(t+=this._windowSize),this._buffer[t]},e.RangeDecoder=function(){},e.RangeDecoder.prototype.setStream=function(e){this._stream=e},e.RangeDecoder.prototype.releaseStream=function(){this._stream=null},e.RangeDecoder.prototype.init=function(){var e=5;for(this._code=0,this._range=-1;e--;)this._code=this._code<<8|this._stream.readByte()},e.RangeDecoder.prototype.decodeDirectBits=function(e){for(var t,r=0,n=e;n--;)this._range>>>=1,t=this._code-this._range>>>31,this._code-=this._range&t-1,r=r<<1|1-t,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return r},e.RangeDecoder.prototype.decodeBit=function(e,t){var r=e[t],n=(this._range>>>11)*r;return(2147483648^this._code)<(2147483648^n)?(this._range=n,e[t]+=2048-r>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=n,this._code-=n,e[t]-=r>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},e.initBitModels=function(e,t){for(;t--;)e[t]=1024},e.BitTreeDecoder=function(e){this._models=[],this._numBitLevels=e},e.BitTreeDecoder.prototype.init=function(){e.initBitModels(this._models,1<<this._numBitLevels)},e.BitTreeDecoder.prototype.decode=function(e){for(var t=1,r=this._numBitLevels;r--;)t=t<<1|e.decodeBit(this._models,t);return t-(1<<this._numBitLevels)},e.BitTreeDecoder.prototype.reverseDecode=function(e){for(var t,r=1,n=0,i=0;i<this._numBitLevels;++i)r=r<<1|(t=e.decodeBit(this._models,r)),n|=t<<i;return n},e.reverseDecode2=function(e,t,r,n){for(var i,o=1,a=0,s=0;s<n;++s)o=o<<1|(i=r.decodeBit(e,t+o)),a|=i<<s;return a},e.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new e.BitTreeDecoder(8),this._numPosStates=0},e.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new e.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new e.BitTreeDecoder(3)},e.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(e.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},e.LenDecoder.prototype.decode=function(e,t){return 0===e.decodeBit(this._choice,0)?this._lowCoder[t].decode(e):0===e.decodeBit(this._choice,1)?8+this._midCoder[t].decode(e):16+this._highCoder.decode(e)},e.Decoder2=function(){this._decoders=[]},e.Decoder2.prototype.init=function(){e.initBitModels(this._decoders,768)},e.Decoder2.prototype.decodeNormal=function(e){var t=1;do{t=t<<1|e.decodeBit(this._decoders,t)}while(t<256);return 255&t},e.Decoder2.prototype.decodeWithMatchByte=function(e,t){var r,n,i=1;do{if(r=t>>7&1,t<<=1,i=i<<1|(n=e.decodeBit(this._decoders,(1+r<<8)+i)),r!==n){for(;i<256;)i=i<<1|e.decodeBit(this._decoders,i);break}}while(i<256);return 255&i},e.LiteralDecoder=function(){},e.LiteralDecoder.prototype.create=function(t,r){var n;if(!this._coders||this._numPrevBits!==r||this._numPosBits!==t)for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=r,this._coders=[],n=1<<this._numPrevBits+this._numPosBits;n--;)this._coders[n]=new e.Decoder2},e.LiteralDecoder.prototype.init=function(){for(var e=1<<this._numPrevBits+this._numPosBits;e--;)this._coders[e].init()},e.LiteralDecoder.prototype.getDecoder=function(e,t){return this._coders[((e&this._posMask)<<this._numPrevBits)+((255&t)>>>8-this._numPrevBits)]},e.Decoder=function(){this._outWindow=new e.OutWindow,this._rangeDecoder=new e.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new e.BitTreeDecoder(4),this._lenDecoder=new e.LenDecoder,this._repLenDecoder=new e.LenDecoder,this._literalDecoder=new e.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new e.BitTreeDecoder(6),this._posSlotDecoder[1]=new e.BitTreeDecoder(6),this._posSlotDecoder[2]=new e.BitTreeDecoder(6),this._posSlotDecoder[3]=new e.BitTreeDecoder(6)},e.Decoder.prototype.setDictionarySize=function(e){return!(e<0||(this._dictionarySize!==e&&(this._dictionarySize=e,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),0))},e.Decoder.prototype.setLcLpPb=function(e,t,r){var n=1<<r;return!(e>8||t>4||r>4||(this._literalDecoder.create(t,e),this._lenDecoder.create(n),this._repLenDecoder.create(n),this._posStateMask=n-1,0))},e.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),e.initBitModels(this._isMatchDecoders,192),e.initBitModels(this._isRep0LongDecoders,192),e.initBitModels(this._isRepDecoders,12),e.initBitModels(this._isRepG0Decoders,12),e.initBitModels(this._isRepG1Decoders,12),e.initBitModels(this._isRepG2Decoders,12),e.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},e.Decoder.prototype.decode=function(t,r,n){var i,o,a,s,l,u,c=0,h=0,p=0,d=0,f=0,v=0,m=0;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(r),this.init();n<0||v<n;)if(i=v&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(c<<4)+i))o=this._literalDecoder.getDecoder(v++,m),m=c>=7?o.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(h)):o.decodeNormal(this._rangeDecoder),this._outWindow.putByte(m),c=c<4?0:c-(c<10?3:6);else{if(1===this._rangeDecoder.decodeBit(this._isRepDecoders,c))a=0,0===this._rangeDecoder.decodeBit(this._isRepG0Decoders,c)?0===this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(c<<4)+i)&&(c=c<7?9:11,a=1):(0===this._rangeDecoder.decodeBit(this._isRepG1Decoders,c)?s=p:(0===this._rangeDecoder.decodeBit(this._isRepG2Decoders,c)?s=d:(s=f,f=d),d=p),p=h,h=s),0===a&&(a=2+this._repLenDecoder.decode(this._rangeDecoder,i),c=c<7?8:11);else if(f=d,d=p,p=h,a=2+this._lenDecoder.decode(this._rangeDecoder,i),c=c<7?7:10,(l=this._posSlotDecoder[a<=5?a-2:3].decode(this._rangeDecoder))>=4){if(h=(2|1&l)<<(u=(l>>1)-1),l<14)h+=e.reverseDecode2(this._posDecoders,h-l-1,this._rangeDecoder,u);else if(h+=this._rangeDecoder.decodeDirectBits(u-4)<<4,(h+=this._posAlignDecoder.reverseDecode(this._rangeDecoder))<0){if(-1===h)break;return!1}}else h=l;if(h>=v||h>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(h,a),v+=a,m=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},e.Decoder.prototype.setDecoderProperties=function(e){var t,r,n,i,o;return!(e.size<5)&&(r=(t=e.readByte())%9,n=(t=~~(t/9))%5,i=~~(t/5),!!this.setLcLpPb(r,n,i)&&(o=e.readByte(),o|=e.readByte()<<8,o|=e.readByte()<<16,o+=16777216*e.readByte(),this.setDictionarySize(o)))},e.decompress=function(t,r,n,i){var o=new e.Decoder;if(!o.setDecoderProperties(t))throw"Incorrect stream properties";if(!o.decode(r,n,i))throw"Error in data stream";return!0},e.decompressFile=function(t,r){var n,i=new e.Decoder;if(!i.setDecoderProperties(t))throw"Incorrect stream properties";if(n=t.readByte(),n|=t.readByte()<<8,n|=t.readByte()<<16,n+=16777216*t.readByte(),t.readByte(),t.readByte(),t.readByte(),t.readByte(),!i.decode(t,r,n))throw"Error in data stream";return!0},e}Dn.defines.USE_POINT_NORMAL=!0,Dn.dispose=function(){};var Fn=Ln(),Qn="\nvar decodeLZMA = (function() {\n var LZMA = (".concat(Ln.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,r){try{var n={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},i=n.data.length,o={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/i);this.data[t]||(this.data[t]=new Uint8Array(i)),this.data[t][this.offset%i]=e,this.offset++}};e.decompressFile(n,o);for(var a=new Uint8Array(o.offset),s=0;s<o.offset;s++)a[s]=o.data[Math.floor(s/i)][s%i];r(null,a)}catch(e){r(e)}}.toString(),")(LZMA, data, callback);\n }\n})();\n\nvar decodeLZMAWithWASM = (function() {\n var LZMA_WASM = (").concat(function(){return function(e){for(var t=new Uint8Array(256),r=0;r<64;r++)t["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(r)]=r;var n,i,o,a,s,l=11460,u=0;"="===e[15279]&&(l--,"="===e[15278]&&l--);var c=new ArrayBuffer(l),h=new Uint8Array(c);for(n=0;n<15280;n+=4)i=t[e.charCodeAt(n)],o=t[e.charCodeAt(n+1)],a=t[e.charCodeAt(n+2)],s=t[e.charCodeAt(n+3)],h[u++]=i<<2|o>>4,h[u++]=(15&o)<<4|a>>2,h[u++]=(3&a)<<6|63&s;return c}("AGFzbQEAAAABSg1gAABgAX8Bf2ACf38Bf2AEf39/fwBgA39/fwBgAX8AYAJ/fwBgA39/fwF/YAR/f39/AX9gAn9/AGABfwF/YAABf2AEf39/fwF/AhsCA2VudgVhYm9ydAADA2VudgZtZW1vcnkCAAEDJiUBAQkKAgoKCwsLCwsAAgoBAgQKAQYFCAoFBQQEBwgCBwwCAQAABAQBcAABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwc9BgZtZW1vcnkCAAV0YWJsZQEABXJlc2V0AA0KbmV3VThBcnJheQAQCnVucGFja1NpemUAFAZkZWNvZGUAIwgBJAkHAQBBAAsBJQqAViVoAQN/IABBgICAgARLBEAACyMBIgEgAEEBIABBAUsbakEHakF4cSICPwAiA0EQdEsEQCADIAIgAWtB//8DakGAgHxxQRB2IgAgAyAAShtAAEEASARAIABAAEEASARAAAsLCyACJAEgAQsbAQF/QQFBICAAQQdqZ2t0EAEiASAANgIAIAELkQMBAX8gAUUEQA8LIABBADoAACAAIAFqQQFrQQA6AAAgAUECTQRADwsgAEEBakEAOgAAIABBAmpBADoAACAAIAFqIgJBAmtBADoAACACQQNrQQA6AAAgAUEGTQRADwsgAEEDakEAOgAAIAAgAWpBBGtBADoAACABQQhNBEAPC0EAIABrQQNxIgIgAGoiAEEANgIAIAEgAmtBfHEiASAAakEEa0EANgIAIAFBCE0EQA8LIABBBGpBADYCACAAQQhqQQA2AgAgACABaiICQQxrQQA2AgAgAkEIa0EANgIAIAFBGE0EQA8LIABBDGpBADYCACAAQRBqQQA2AgAgAEEUakEANgIAIABBGGpBADYCACAAIAFqIgJBHGtBADYCACACQRhrQQA2AgAgAkEUa0EANgIAIAJBEGtBADYCACAAQQRxQRhqIgIgAGohACABIAJrIQEDQCABQSBPBEAgAEIANwMAIABBCGpCADcDACAAQRBqQgA3AwAgAEEYakIANwMAIAFBIGshASAAQSBqIQAMAQsLC1EBA38gAEH+////AEsEQEEAQSBBLUEnEAAACyAAQQJ0IgMQAiECQQgQASIBQQA2AgAgAUEANgIEIAEgAjYCACABIAA2AgQgAkEIaiADEAMgAQtmAQF/IAFB/P///wFLBEBBAEHAAEEXQSIQAAALIAFBAXQiARACIgJBCGogARADIABFBEBBDBABIQALIABBADYCACAAQQA2AgQgAEEANgIIIAAgAjYCACAAQQA2AgQgACABNgIIIAALCgBBDBABIAAQBQsuAQF/QQgQASIBQQA2AgAgAUEANgIEIAEgADYCBCABQQEgASgCBHQQBjYCACABC6EBAQR/QRAQASIBQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgxBEBAEIQIDQCAAQRBIBEBBAxAHIQMgAigCACAAQQJ0aiADNgIIIABBAWohAAwBCwsgASACNgIEQRAQBCECQQAhAANAIABBEEgEQEEDEAchAyACKAIAIABBAnRqIAM2AgggAEEBaiEADAELCyABIAI2AgggAUEIEAc2AgwgAQs0AQF/QRQQASIAQQA2AgAgAEEAOgAEIABBADYCCCAAQQA2AgwgAEEANgIQIABBDTYCCCAAC0IBAX9BGRABIgBBADYCACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEANgIUIABBADoAGCAAQQA2AhAgAAu1AgEEf0HQABABIgBBADoAACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEAOgAUIABBADYCGCAAQQA2AhwgAEEANgIgIABBADYCJCAAQQA2AiggAEEANgIsIABBADYCMCAAQQA2AjQgAEEANgI4IABBADYCPCAAQQA2AkAgAEEANgJEIABBADYCSCAAQQA2AkxBBBAEIQIDQCABQQRIBEBBBhAHIQMgAigCACABQQJ0aiADNgIIIAFBAWohAQwBCwsgACACNgIkIABBBBAHNgIoIABB8wAQBjYCLCAAQcABEAY2AjAg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IAQgAzYCDCAEC7YEAQZ/IAAgATYCBEENEA8hAgNAAkAgA0ENTg0AIAIgAyABIAMQEUH/AXEQEiADQQFqIQMMAQsLIAAoAgAhBCACIQZBBBAPIgIoAgQgAigCAGogBigCBCAGKAIAai0ACCIDOgAIIANB/wFxQeEBTwRAQQBBgAFBoQFBDBAAAAsgAigCBCACKAIAQQFqaiADQf8BcUEJcCIHOgAIIAIoAgQgAigCAGogA0H/AXFBCW4iAzoACCADQQVwIQUgAigCBCACKAIAQQJqaiADQQVuIgM6AAggAigCBCACKAIAQQNqaiAFOgAIIAQgBzYCDCAEIAM2AhAgBCAFOgAUIARBADYCHEEAIQIDQAJAIAJBBE8NACAEIAQoAhwgBigCBCAGKAIAIAJBAWpqai0ACCACQQN0dHI2AhwgAkEBaiECDAELCyAEIAQoAhw2AhggBCgCGEGAIEkEQCAEQYAgNgIYC0EAIQJBACEFQQAhAwNAAkAgA0EITg0AIAYgA0EFahARQf8BcSIEQf8BRwRAQQEhBQsgBCADQQN0dCACciECIANBAWohAwwBCwsgACgCACAFRToAACAAKAIAKAIEIAE2AgAgACgCABAWAkAgACgCACAFIAIQICIBQQFGDQAgAUEDRwRAIAFBAkYEQCAFBEAgACgCACgCCCgCECACRw0DCwUMAgsLIAAoAgAoAgQtAAQaQQFBACAAKAIAKAIIKAIQIAAoAgAoAggoAgQQIQ8LQQBBAUEAQQAQIQsIACMDIAAQIgsWAEG4ASQAIwAkAUGAgIAIJAIQDCQDCwMAAQsLtwEEAEEICxcKAAAAdQBzAGUAIABzAHQAcgBpAGMAdABBIAsdDQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHMAQcAACzkbAAAAfgBsAGkAYgAvAGkAbgB0AGUAcgBuAGEAbAAvAHQAeQBwAGUAZABhAHIAcgBhAHkALgB0AHMAQYABCzMYAAAAcwByAGMALwBsAHoAbQBhAC8AbAB6AG0AYQAtAGQAZQBjAG8AZABlAHIALgB0AHM=")}.toString(),")();\n return function(data, callback) {\n return (").concat(function(e,t,r){try{var n=new WebAssembly.Memory({initial:16}),i=new WebAssembly.Module(e),o=new WebAssembly.Instance(i,{env:{memory:n,abort:function(){r(new Error("webAssembly abort"))}}}).exports,a=o.newU8Array(t.length);new Uint8Array(n.buffer,a+24,t.length).set(t);var s=o.decode(a),l=new Uint32Array(n.buffer,s,4),u=l[0],c=l[2],h=l[3];u?r(null,new Uint8Array(n.buffer,h+24,c).slice(0,c)):r(new Error("lzma deocder error"))}catch(e){r(e)}}.toString(),')(LZMA_WASM, data, callback);\n }\n})();\n\nself.onmessage = function(event) {\n var packet = event.data;\n if (!packet.id) {\n postMessage({ id: packet.id, error: "No incoming id." });\n return;\n }\n if (!packet.data) {\n postMessage({ id: packet.id, error: "No input data." });\n return;\n }\n if (packet.type == "decompress") {\n if (packet.data.constructor !== Uint8Array) {\n postMessage({ id: packet.id, error: "Input data is not Uint8Array." });\n }\n const callback = function(error, result) {\n if (error) {\n postMessage({ id: packet.id, error: error.toString() });\n } else {\n postMessage({ id: packet.id, result: result, error: null }, [ result.buffer ]);\n }\n }\n if (typeof WebAssembly !== "undefined" && WebAssembly.instantiate) {\n decodeLZMAWithWASM(packet.data, callback);\n } else {\n decodeLZMA(packet.data, callback);\n }\n return;\n }\n postMessage({ id: packet.id, error: "type never matched." });\n};\n'),Nn="undefined"!=typeof Worker&&"undefined"!=typeof Blob,Vn="";if(Nn)try{var Un=new Blob([Qn],{type:"text/javascript"});Vn=URL.createObjectURL(Un)}catch(e){}var zn=function(){function e(){var e=this;if(!Nn)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var t=this.worker=new Worker(Vn);t.onmessage=function(t){var r=t.data,n=r.id,i=r.result,o=r.error,a=e.getKey(n);e.requests[a]&&(o?e.requests[a](new Error(o)):e.requests[a](null,i),delete e.requests[a])},t.onerror=function(e){return console.error(e)}}return e.prototype.getKey=function(e){return"key_"+String(e)},e.prototype.decompress=function(e,t){var r=++this.callCounter;this.requests[this.getKey(r)]=t,this.worker.postMessage({type:"decompress",id:r,data:e},[e.buffer])},e.prototype.terminate=function(){this.worker.terminate()},e.support=Nn,e}();function _n(e){return Array.prototype.reduce.call(e,(function(e,t,r){return e|t<<8*r}),0)}function qn(e){var t=new Uint8Array(e),r=_n(t.slice(0,4));if(r>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var n=[],i=[],o=4+4*r,a=0;a<r;a++)i[a]=_n(t.slice(4+4*a,8+4*a)),n[a]=a===r-1?t.subarray(o,o+i[a]):t.slice(o,o+i[a]),o+=i[a];return zn.support?function(e){for(var t=[],r=e.length,n=function(r){t.push(new Promise((function(t,n){var i=new zn;i.decompress(e[r],(function(e,r){if(i.terminate(),e)return n(e);t(r)}))})))},i=0;i<r;i++)n(i);return Promise.all(t)}(n):Promise.resolve(function(e){for(var t,r=[],n=e.length,i=function(n){var i={data:e[n],offset:0,readByte:function(){return this.data[this.offset++]}},o=i.data.length,a={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/o);this.data[t]||(this.data[t]=new Uint8Array(o)),this.data[t][this.offset%o]=e,this.offset++}};Fn.decompressFile(i,a),t=new Uint8Array(a.offset);for(var s=0;s<a.offset;s++)t[s]=a.data[Math.floor(s/o)][s%o];r.push(t)},o=0;o<n;o++)i(o);return r}(n))}var Hn=null,jn=!1,Gn=[];function Kn(e){if(void 0===e&&(e=!1),e||!jn)if(Hn)jn=!1;else{jn=!0;var t=Gn.shift();if(t){try{t()}catch(e){}Oe.shared.add((function(){return Kn(!0)}),!0,2,-100)}else jn=!1}}function Wn(e){return new Promise((function(t,r){Gn.push((function(){try{t(e())}catch(e){r(e)}})),Oe.shared.add((function(){return Kn()}),!0,2,-100)}))}function Yn(e,t){for(var r={},n=0,i=t;n<i.length;n++){var o=i[n];o in e&&(r[o]=e[o])}return r}function Xn(e,t){void 0===t&&(t=!1);var r=typeof e;if("string"===r)return JSON.stringify(e);if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(e instanceof Array){for(var n="[",i=e.length-1,o=0;o<i;o++)n+=Xn(e[o],!1)+",";return i>-1&&(n+=Xn(e[o],!1)),n+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return Xn(e.toJSON(),t);var a=Object.keys(e).sort(),s=a.length;for(n="",o=0;o<s;){var l=a[o],u=Xn(e[l],!0);void 0!==u&&(o&&""!==n&&(n+=","),n+=JSON.stringify(l)+":"+u),o++}return"{"+n+"}"}switch(r){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 Jn(e){return"hash::".concat(Xn(e,!1))}var Zn=new e.WebGLRenderTarget(1,1),$n=new e.OrthographicCamera(-1,1,1,-1,0,1);$n.matrixAutoUpdate=!1;var ei=new e.BufferGeometry;ei.setAttribute("position",new e.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3));var ti=new e.Mesh(ei);ti.matrixAutoUpdate=!1;var ri=new e.Scene;ri.add(ti),ri.matrixAutoUpdate=!1;var ni=new e.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform sampler2D map;\n void main() {\n gl_FragColor = texture2D(map, vec2(0, 0));\n }\n ",depthTest:!1,depthWrite:!1,stencilWrite:!1,colorWrite:!1,blending:e.NoBlending,lights:!1,toneMapped:!1}),ii=new e.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform samplerCube map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0, 0));\n }\n ",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:e.NoBlending,lights:!1,toneMapped:!1}),oi=Promise.resolve(),ai=__webpack_require__(967);const si=ai.Reader,li=ai.util,ui=ai.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]||(ai.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]={}),ci=ui.Model=(()=>{function e(e){if(this.chunks=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.chunks=li.emptyArray,e.prototype.createAt=li.Long?li.Long.fromBits(0,0,!0):0,e.prototype.description="",e.decode=function(e,t){e instanceof si||(e=si.create(e));let r=void 0===t?e.len:e.pos+t,n=new ui.Model;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(ui.Chunk.decode(e,e.uint32()));break;case 2:n.createAt=e.uint64();break;case 3:n.description=e.string();break;default:e.skipType(7&t)}}return n},e})();ui.Chunk=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.vertices=null,e.prototype.faces=null,e.prototype.name="",e.prototype.texture="",e.decode=function(e,t){e instanceof si||(e=si.create(e));let r=void 0===t?e.len:e.pos+t,n=new ui.Chunk;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.vertices=ui.Vertices.decode(e,e.uint32());break;case 2:n.faces=ui.Faces.decode(e,e.uint32());break;case 3:n.name=e.string();break;case 4:n.texture=e.string();break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("vertices"))throw li.ProtocolError("missing required 'vertices'",{instance:n});if(!n.hasOwnProperty("faces"))throw li.ProtocolError("missing required 'faces'",{instance:n});if(!n.hasOwnProperty("name"))throw li.ProtocolError("missing required 'name'",{instance:n});return n},e})(),ui.Vertices=(()=>{function e(e){if(this.xyz=[],this.uvs=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.xyz=li.emptyArray,e.prototype.uvs=li.emptyArray,e.decode=function(e,t){e instanceof si||(e=si.create(e));let r=void 0===t?e.len:e.pos+t,n=new ui.Vertices;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:if(n.xyz&&n.xyz.length||(n.xyz=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.xyz.push(e.float())}else n.xyz.push(e.float());break;case 2:if(n.uvs&&n.uvs.length||(n.uvs=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.uvs.push(e.float())}else n.uvs.push(e.float());break;default:e.skipType(7&t)}}return n},e})(),ui.Faces=(()=>{function e(e){if(this.indices=[],this.normals=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.indices=li.emptyArray,e.prototype.normals=li.emptyArray,e.decode=function(e,t){e instanceof si||(e=si.create(e));let r=void 0===t?e.len:e.pos+t,n=new ui.Faces;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:if(n.indices&&n.indices.length||(n.indices=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.indices.push(e.uint32())}else n.indices.push(e.uint32());break;case 2:if(n.normals&&n.normals.length||(n.normals=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.normals.push(e.float())}else n.normals.push(e.float());break;default:e.skipType(7&t)}}return n},e})();var hi=(new e.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1).elements;function pi(e){var t=e.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function di(e){var t=e.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function fi(e){var t=pi(e.name),r=di(e.name),n=function(e){var t=e.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}(e.name);return 1e6*t+1e3*r+n}function vi(t,r,n,i,o,a){var s=$({key:"texture.pbm"},Yn(r,["format","quality","size","sharpen","mappings"])),l=(new kt).loadTexture(t,{imageURL:{transform:r.transform,options:s},wrapS:e.ClampToEdgeWrapping,wrapT:e.ClampToEdgeWrapping,minFilter:e.LinearFilter,maxSize:"number"==typeof s.size?new e.Vector2(s.size,s.size):void 0,allowHosts:n,requestProxy:i,networkSubscribe:o}).then((function(t){var r=t.body;return r.needsUpdate=!0,function(t,r){if(!r)return Promise.resolve(t);var n=r.getRenderTarget();r.setRenderTarget(Zn),t instanceof e.CubeTexture?(ti.material=ii,ii.uniforms.map.value=t,r.render(ri,$n),ii.uniforms.map.value=null):(ti.material=ni,ni.uniforms.map.value=t,r.render(ri,$n),ii.uniforms.map.value=null),r.setRenderTarget(n);var i=oi.then((function(){return new Promise((function(e){Oe.shared.add((function(){e(t)}),!0)}))}));return oi=i.catch((function(){})),i}(r,a)}));return Object.assign(l,{url:t,textureOptions:r})}function mi(t,r,n,i,o,a,s,l,u){void 0===o&&(o={});for(var c=function(e){for(var t,r,n,i="number"==typeof e.createAt?e.createAt:null===e.createAt||void 0===e.createAt?0:e.createAt.toNumber(),o=null!==(t=e.description)&&void 0!==t?t:"",a=[],s=!0,l=0,u=e.chunks;l<u.length;l++)if(!(Z=u[l]).faces.normals||0===Z.faces.normals.length){s=!1;break}for(var c=e.chunks.sort((function(e,t){return fi(e)-fi(t)})),h=[],p=0,d=c;p<d.length;p++){var f=pi((Z=d[p]).name);h[f]||(h[f]=[]),h[f].push(Z)}for(var v=0;v<h.length;v++){var m=h[v];if(m)if(s){for(var A=0,g=0;g<m.length;g++)A+=(Z=m[g]).faces.indices.length;for(var y=new Float32Array(3*A),b=new Float32Array(2*A),x=new Float32Array(3*A),w=new Float32Array(A),M=[],E=[1/0,1/0,1/0,-1/0,-1/0,-1/0],C=0,S=0;S<m.length;S++){var I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],P=(Z=m[S]).vertices.xyz,T=Z.vertices.uvs,B=Z.faces.indices,R=Z.faces.normals,O=B.length;for(g=0;g<O;g++){var k=B[g],D=P[3*k],L=P[3*k+1],F=P[3*k+2],Q=1/(hi[3]*D+hi[7]*L+hi[11]*F+hi[15]),N=(hi[0]*D+hi[4]*L+hi[8]*F+hi[12])*Q,V=(hi[1]*D+hi[5]*L+hi[9]*F+hi[13])*Q,U=(hi[2]*D+hi[6]*L+hi[10]*F+hi[14])*Q;y[3*C+3*g]=N,y[3*C+3*g+1]=V,y[3*C+3*g+2]=U,b[2*C+2*g]=T[2*k],b[2*C+2*g+1]=T[2*k+1];var z=3*Math.floor(g/3),_=R[z],q=R[z+1],H=R[z+2],j=1/(hi[3]*_+hi[7]*q+hi[11]*H+hi[15]),G=(hi[0]*_+hi[4]*q+hi[8]*H+hi[12])*j,K=(hi[1]*_+hi[5]*q+hi[9]*H+hi[13])*j,W=(hi[2]*_+hi[6]*q+hi[10]*H+hi[14])*j;x[3*C+3*g]=G,x[3*C+3*g+1]=K,x[3*C+3*g+2]=W,w[C+g]=v,N<I[0]&&(I[0]=N),V<I[1]&&(I[1]=V),U<I[2]&&(I[2]=U),N>I[3]&&(I[3]=N),V>I[4]&&(I[4]=V),U>I[5]&&(I[5]=U)}I[0]<E[0]&&(E[0]=I[0]),I[1]<E[1]&&(E[1]=I[1]),I[2]<E[2]&&(E[2]=I[2]),I[3]>E[3]&&(E[3]=I[3]),I[4]>E[4]&&(E[4]=I[4]),I[5]>E[5]&&(E[5]=I[5]),M.push({materialIndex:S,name:Z.name,chunkName:di(Z.name),start:C,count:Z.faces.indices.length,texture:null!==(r=Z.texture)&&void 0!==r?r:void 0}),C+=O}a.push({createAt:i,description:o,vertices:y,uvs:b,normals:x,floors:w,indices:null,floorIndex:v,groups:M,extents:E})}else{A=0;var Y=0;for(g=0;g<m.length;g++)Y+=(Z=m[g]).vertices.xyz.length/3,A+=Z.faces.indices.length;y=new Float32Array(3*Y),b=new Float32Array(2*Y),x=new Float32Array(3*Y),w=new Float32Array(Y);var X=new Uint32Array(A),J=(M=[],E=[1/0,1/0,1/0,-1/0,-1/0,-1/0],0);for(C=0,S=0;S<m.length;S++){I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],P=(Z=m[S]).vertices.xyz,T=Z.vertices.uvs,B=Z.faces.indices;var Z,$=P.length/3;for(O=B.length,g=0;g<$;g++)D=P[3*g],L=P[3*g+1],F=P[3*g+2],Q=1/(hi[3]*D+hi[7]*L+hi[11]*F+hi[15]),N=(hi[0]*D+hi[4]*L+hi[8]*F+hi[12])*Q,V=(hi[1]*D+hi[5]*L+hi[9]*F+hi[13])*Q,U=(hi[2]*D+hi[6]*L+hi[10]*F+hi[14])*Q,y[3*C+3*g]=N,y[3*C+3*g+1]=V,y[3*C+3*g+2]=U,b[2*C+2*g]=T[2*g],b[2*C+2*g+1]=T[2*g+1],w[C+g]=v,N<I[0]&&(I[0]=N),V<I[1]&&(I[1]=V),U<I[2]&&(I[2]=U),N>I[3]&&(I[3]=N),V>I[4]&&(I[4]=V),U>I[5]&&(I[5]=U);for(I[0]<E[0]&&(E[0]=I[0]),I[1]<E[1]&&(E[1]=I[1]),I[2]<E[2]&&(E[2]=I[2]),I[3]>E[3]&&(E[3]=I[3]),I[4]>E[4]&&(E[4]=I[4]),I[5]>E[5]&&(E[5]=I[5]),g=0;g<O;g++)X[J+g]=C+B[g];M.push({materialIndex:S,name:Z.name,chunkName:di(Z.name),start:J,count:Z.faces.indices.length,texture:null!==(n=Z.texture)&&void 0!==n?n:void 0}),C+=$,J+=O}for(g=0;g<A;g+=3){var ee,te,re,ne,ie,oe,ae,se,le,ue,ce,he,pe,de,fe,ve;_=void 0,q=void 0,H=void 0,ee=3*X[g],te=3*X[g+1],re=3*X[g+2],ne=y[ee],ie=y[ee+1],oe=y[ee+2],ae=y[te],se=y[te+1],le=y[te+2],ue=y[re],_=(he=y[re+1]-se)*(ve=oe-le)-(pe=y[re+2]-le)*(fe=ie-se),q=pe*(de=ne-ae)-(ce=ue-ae)*ve,H=ce*fe-he*de,x[ee]+=_,x[ee+1]+=q,x[ee+2]+=H,x[te]+=_,x[te+1]+=q,x[te+2]+=H,x[re]+=_,x[re+1]+=q,x[re+2]+=H}a.push({createAt:i,description:o,vertices:y,uvs:b,normals:x,floors:w,indices:X,floorIndex:v,groups:M,extents:E})}}return a}(t),h=0,p="",d=[],f={},v=0,m=c;v<m.length;v++){var A=m[v],g=A.createAt,y=A.description,b=A.vertices,x=A.uvs,w=A.normals,M=A.floors,E=A.indices,C=A.floorIndex,S=A.groups,I=A.extents,P=new e.Box3;P.min.x=I[0],P.min.y=I[1],P.min.z=I[2],P.max.x=I[3],P.max.y=I[4],P.max.z=I[5];var T=new e.BufferGeometry;T.setAttribute("position",new e.BufferAttribute(b,3)),T.setAttribute("uv",new e.BufferAttribute(x,2)),T.setAttribute("normal",new e.BufferAttribute(w,3)),T.setAttribute("floor",new e.BufferAttribute(M,1)),E&&T.setIndex(new e.BufferAttribute(E,1)),T.boundingBox=P,T.boundingSphere=P.getBoundingSphere(new e.Sphere);for(var B=0,R=S;B<R.length;B++){var O=R[B];T.addGroup(O.start,O.count,O.materialIndex)}for(var k=[],D=0,L=S;D<L.length;D++){O=L[D];var F=n[O.chunkName]||(O.texture?Yr(r||"",O.texture):void 0),Q=new Nt;k.push(Q),F?f[F]?f[F].push(Q):f[F]=[Q]:(Q.defines.USE_MAP=!1,Q.uniforms.diffuse.value=new e.Color(16777215))}var N=new tt(T,k);N.name="model_floor_"+C,N.userData.createAt=g,N.userData.description=y,N.matrix.compose(N.position,N.quaternion,N.scale),N.matrixAutoUpdate=!1,N.frustumCulled=!1,N.renderOrder=-1e3+C,h=g,p=y,d.push(N)}var V="",U=function(t){t=Ai(t,n.length);var r=[],i=Jn(t);if(V===i)return Promise.resolve();V=i;for(var c=function(n){var c=null;n in o&&(Jn(o[n].textureOptions)===Jn(t)?c=o[n]:o[n].then((function(e){return e.dispose()}))),c||(c=vi(n,t,a,s,l,u)),r.push(c.then((function(e){if(V===i)for(var t=0,r=f[n];t<r.length;t++){var o=r[t];o.uniforms.map.value&&o.uniforms.map.value.dispose(),o.uniforms.map.value=e,o.uniforms.exposure.value=3.3}else e.dispose()})).catch((function(){if(V===i)for(var t=0,r=f[n];t<r.length;t++){var o=r[t];o.uniforms.map.value&&o.uniforms.map.value.dispose(),o.uniforms.map.value=null,o.defines.USE_MAP=!1,o.uniforms.diffuse.value=new e.Color(16777215)}})))},h=0,p=Object.keys(f);h<p.length;h++)c(d=p[h]);for(var d in o)delete o[d];return Promise.all(r).then((function(){}))};return{createAt:h,description:p,objects:d,texturePromise:U(i),updateTexture:U}}function Ai(e,t){return!1!==(e=Object.assign({},e)).autoResize&&(t>96?e.size=Math.min(e.size||1/0,100):t>48?e.size=Math.min(e.size||1/0,200):t>24?e.size=Math.min(e.size||1/0,400):t>22?e.size=Math.min(e.size||1/0,800):t>5&&(e.size=Math.min(e.size||1/0,1024))),e}const gi=ai.Reader,yi=ai.util,bi=ai.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]||(ai.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]={}),xi=bi.Model=(()=>{function e(e){if(this.meshes=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.meshes=yi.emptyArray,e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.Model;for(;e.pos<r;){let t=e.uint32();t>>>3==1?(n.meshes&&n.meshes.length||(n.meshes=[]),n.meshes.push(bi.Mesh.decode(e,e.uint32()))):e.skipType(7&t)}return n},e})();function wi(e){for(var t=[0,0,0],r=0;r<e.attributes.normal.array.length/9;r++)t[0]=e.attributes.normal.array[9*r],t[1]=e.attributes.normal.array[9*r+1],t[2]=e.attributes.normal.array[9*r+2],e.attributes.normal.array[9*r]=e.attributes.normal.array[9*r+6],e.attributes.normal.array[9*r+1]=e.attributes.normal.array[9*r+7],e.attributes.normal.array[9*r+2]=e.attributes.normal.array[9*r+8],e.attributes.normal.array[9*r+6]=t[0],e.attributes.normal.array[9*r+7]=t[1],e.attributes.normal.array[9*r+8]=t[2];for(r=0;r<e.attributes.position.array.length/9;r++)t[0]=e.attributes.position.array[9*r],t[1]=e.attributes.position.array[9*r+1],t[2]=e.attributes.position.array[9*r+2],e.attributes.position.array[9*r]=e.attributes.position.array[9*r+6],e.attributes.position.array[9*r+1]=e.attributes.position.array[9*r+7],e.attributes.position.array[9*r+2]=e.attributes.position.array[9*r+8],e.attributes.position.array[9*r+6]=t[0],e.attributes.position.array[9*r+7]=t[1],e.attributes.position.array[9*r+8]=t[2];for(r=0;r<e.attributes.uv.array.length/6;r++)t[0]=e.attributes.uv.array[6*r],t[1]=e.attributes.uv.array[6*r+1],e.attributes.uv.array[6*r]=e.attributes.uv.array[6*r+4],e.attributes.uv.array[6*r+1]=e.attributes.uv.array[6*r+5],e.attributes.uv.array[6*r+4]=t[0],e.attributes.uv.array[6*r+5]=t[1];e.attributes.normal.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.uv.needsUpdate=!0}function Mi(t){var r=t.position,n=t.normal,i=t.uv,o=t.uv2,a=t.groups,s=new e.BufferGeometry;s.setAttribute("position",new e.BufferAttribute(new Float32Array(r.array),3)),n&&s.setAttribute("normal",new e.BufferAttribute(new Float32Array(n.array),3)),i&&s.setAttribute("uv",new e.BufferAttribute(new Float32Array(i.array),2)),o&&s.setAttribute("uv2",new e.BufferAttribute(new Float32Array(o.array),2));for(var l=0,u=a;l<u.length;l++){var c=u[l];s.addGroup(c.start,c.count,c.materialIndex)}return s}function Ei(t,r,n,i,o,a,s){if(s.hasOwnProperty(t))return s[t];Xr(t=t.split("?")[0])||(t=Yr(r,t)),0===(t=t.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/")).indexOf("//")&&(t="https:"+t);var l=$({key:"texture.dome",size:64},Yn(n,["quality","format","sharpen","mappings"]));return s[t]=o.loadTexture(t,{imageURL:{transform:n.transform,options:l},wrapS:e.RepeatWrapping,wrapT:e.RepeatWrapping,allowHosts:a.allowHosts,networkSubscribe:a.networkSubscribe,requestProxy:a.requestProxy}).then((function(e){var t=e.body;return i&&t.repeat.copy(i),t.needsUpdate=!0,t.updateMatrix(),t}))}function Ci(t,r,n,i,o,a){var s=[],l=new Nt,u=l.uniforms;u.exposure.value=4.3;var c=l.defines;if(c.USE_MAP=!1,c.USE_UV=!1,t.kd&&(u.diffuse.value=(new e.Color).fromArray(t.kd.rgb)),t.mapkd){var h=null;if(t.mapkdrepeat){var p=t.mapkdrepeat.split(/\s+/).map((function(e){return Number(e)})),d=p[0],f=p[1];h=new e.Vector2(d,f)}s.push(Ei(t.mapkd,r,n,h,i,o,a).then((function(e){c.USE_MAP=!0,c.USE_UV=!0,u.map.value=e,u.uvTransform.value=e.matrix,l.needsUpdate=!0})).catch(se))}if(t.ks&&(u.specular.value=(new e.Color).fromArray(t.ks.rgb)),t.mapks&&s.push(Ei(t.mapks,r,n,null,i,o,a).then((function(e){u.specularMap.value=e})).catch(se)),t.ke&&(u.emissive.value=(new e.Color).fromArray(t.ke.rgb)),t.mapke&&s.push(Ei(t.mapke,r,n,null,i,o,a).then((function(e){u.emissiveMap.value=e})).catch(se)),t.norm&&s.push(Ei(t.norm,r,n,null,i,o,a).then((function(e){u.normalMap.value=e})).catch(se)),t.mapbump&&s.push(Ei(t.mapbump,r,n,null,i,o,a).then((function(e){u.bumpMap.value=e})).catch(se)),t.bump&&s.push(Ei(t.bump,r,n,null,i,o,a).then((function(e){u.bumpMap.value=e})).catch(se)),"number"==typeof t.ns&&(u.shininess.value=t.ns),"number"==typeof t.d){var v=t.d;v>0&&v<1&&(l.opacity=v)}return{material:l,textureReady:Promise.all(s).then(se)}}function Si(t,r,n,i,o,a){for(var s,l=[],u=[],c=(s=t,xi.decode(s).meshes),h=new kt,p={allowHosts:i,requestProxy:o,networkSubscribe:a},d=new e.Matrix4,f=new e.Vector3,v=new e.Quaternion,m=new e.Vector3,A={},g=0,y=c;g<y.length;g++){var b=y[g],x=b.name,w=b.chunks,M=b.matrix;if("Ceiling"!==x&&"CeilingDrop"!==x)for(var E=0,C=M;E<C.length;E++){var S=C[E];d.elements=S.elements;var I=new et;I.renderOrder=-4;for(var P=0;P<w.length;P++){var T=Mi(w[P].geometry);T.applyMatrix4(d),d.decompose(f,v,m),m.x*m.y*m.z<0&&T.attributes.normal&&T.attributes.position&&T.attributes.uv&&wi(T);for(var B=[],R=0,O=w[P].material;R<O.length;R++){var k=Ci(O[R],r||"",n,h,p,A),D=k.material,L=k.textureReady;u.push(L),B.push(D)}var F=new tt(T,B);F.name="chunk_"+P,F.matrix.compose(F.position,F.quaternion,F.scale),F.matrixAutoUpdate=!1,F.frustumCulled=!1,F.renderOrder=-1e3,I.add(F)}I.name=x,l.push(I)}}return{createAt:0,description:"",objects:l,texturePromise:Promise.all(u).catch(se),updateTexture:function(e){return Promise.resolve()}}}bi.Mesh=(()=>{function e(e){if(this.chunks=[],this.matrix=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.name="",e.prototype.chunks=yi.emptyArray,e.prototype.matrix=yi.emptyArray,e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.Mesh;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.name=e.string();break;case 2:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(bi.Chunk.decode(e,e.uint32()));break;case 3:n.matrix&&n.matrix.length||(n.matrix=[]),n.matrix.push(bi.Matrix.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("name"))throw yi.ProtocolError("missing required 'name'",{instance:n});return n},e})(),bi.Matrix=(()=>{function e(e){if(this.elements=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.elements=yi.emptyArray,e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.Matrix;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)if(n.elements&&n.elements.length||(n.elements=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.elements.push(e.float())}else n.elements.push(e.float());else e.skipType(7&t)}return n},e})(),bi.Chunk=(()=>{function e(e){if(this.material=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.geometry=null,e.prototype.material=yi.emptyArray,e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.Chunk;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 2:n.geometry=bi.Geometry.decode(e,e.uint32());break;case 3:n.material&&n.material.length||(n.material=[]),n.material.push(bi.Material.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("geometry"))throw yi.ProtocolError("missing required 'geometry'",{instance:n});return n},e})(),bi.Geometry=(()=>{function e(e){if(this.groups=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.position=null,e.prototype.uv=null,e.prototype.uv2=null,e.prototype.normal=null,e.prototype.groups=yi.emptyArray,e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.Geometry;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.position=bi.Position.decode(e,e.uint32());break;case 2:n.uv=bi.UV.decode(e,e.uint32());break;case 3:n.uv2=bi.UV.decode(e,e.uint32());break;case 4:n.normal=bi.Normal.decode(e,e.uint32());break;case 5:n.groups&&n.groups.length||(n.groups=[]),n.groups.push(bi.Group.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("position"))throw yi.ProtocolError("missing required 'position'",{instance:n});if(!n.hasOwnProperty("normal"))throw yi.ProtocolError("missing required 'normal'",{instance:n});return n},e})(),bi.Position=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.array=yi.emptyArray,e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.Position;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());else e.skipType(7&t)}return n},e})(),bi.UV=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.array=yi.emptyArray,e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.UV;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());else e.skipType(7&t)}return n},e})(),bi.Normal=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.array=yi.emptyArray,e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.Normal;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.array.push(e.float())}else n.array.push(e.float());else e.skipType(7&t)}return n},e})(),bi.Group=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.start=0,e.prototype.count=0,e.prototype.materialIndex=0,e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.Group;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.start=e.uint32();break;case 2:n.count=e.uint32();break;case 3:n.materialIndex=e.uint32();break;default:e.skipType(7&t)}}if(!n.hasOwnProperty("start"))throw yi.ProtocolError("missing required 'start'",{instance:n});if(!n.hasOwnProperty("count"))throw yi.ProtocolError("missing required 'count'",{instance:n});if(!n.hasOwnProperty("materialIndex"))throw yi.ProtocolError("missing required 'materialIndex'",{instance:n});return n},e})(),bi.Material=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.kd=null,e.prototype.ks=null,e.prototype.ke=null,e.prototype.mapkd="",e.prototype.mapks="",e.prototype.mapke="",e.prototype.norm="",e.prototype.mapbump="",e.prototype.bump="",e.prototype.mapd="",e.prototype.ns=0,e.prototype.d=0,e.prototype.tr=0,e.prototype.mapkdrepeat="",e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.Material;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.kd=bi.Color.decode(e,e.uint32());break;case 2:n.ks=bi.Color.decode(e,e.uint32());break;case 3:n.ke=bi.Color.decode(e,e.uint32());break;case 4:n.mapkd=e.string();break;case 5:n.mapks=e.string();break;case 6:n.mapke=e.string();break;case 7:n.norm=e.string();break;case 8:n.mapbump=e.string();break;case 9:n.bump=e.string();break;case 10:n.mapd=e.string();break;case 11:n.ns=e.float();break;case 12:n.d=e.float();break;case 13:n.tr=e.float();break;case 14:n.mapkdrepeat=e.string();break;default:e.skipType(7&t)}}return n},e})(),bi.Color=(()=>{function e(e){if(this.rgb=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.rgb=yi.emptyArray,e.decode=function(e,t){e instanceof gi||(e=gi.create(e));let r=void 0===t?e.len:e.pos+t,n=new bi.Color;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)if(n.rgb&&n.rgb.length||(n.rgb=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.rgb.push(e.float())}else n.rgb.push(e.float());else e.skipType(7&t)}return n},e})();var Ii=new e.Vector3,Pi=new e.Matrix4,Ti=new e.Frustum,Bi=function(t){function r(n,i,o){var a,s=this;(s=t.call(this)||this).workCode=n,s.unloadTileQueue=[],s.boundingBox=new e.Box3,s.maxLevelOfDetail=r.DEFAULT_MAX_LEVEL_OF_DETAIL,s.needsRefined=!0,s.refined=!1,s.loaded=!1,s.disposed=!1,s.needsRender=!0,s.lastRefineTime=-1,s.matrixAutoUpdate=!1,s.renderOrder=-4,s.nodes=new Map,s.nodeGroup=new e.Group,s.nodeGroup.matrixAutoUpdate=!1,s.nodeGroup.renderOrder=-4,s.add(s.nodeGroup),s.debugBoundings=new Map,s.debugBoundingGroup=new e.Group,s.debugBoundingGroup.visible=!1,s.debugBoundingGroup.matrixAutoUpdate=!1,s.debugBoundingGroup.renderOrder=-4,s.add(s.debugBoundingGroup);var l=Zr(i,null!==(a=o.resourcePath)&&void 0!==a?a:"");return s.tileset=new Er(s.workCode,l,{contentLoader:function(e){return s.loadContent(e,{allowHosts:o.allowHosts,requestProxy:o.requestProxy,networkSubscribe:o.networkSubscribe})},onTileLoad:function(){},onTileUnload:function(e){s.unloadTileQueue.push(e)},onTileError:function(e,t){o.onError&&o.onError(Object.assign(t,{error:t})),console.error("Tile error",e.id,t)}}),s.tileset.root.boundingVolume&&s.tileset.root.boundingVolume.getBoundingBox(s.boundingBox),s}return Z(r,t),Object.defineProperty(r.prototype,"debug",{get:function(){return this.debugBoundingGroup.visible},set:function(e){this.debugBoundingGroup.visible!==e&&(this.debugBoundingGroup.visible=e,this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"maxMemoryUsage",{get:function(){return this.tileset.maxMemoryUsage},set:function(e){this.tileset.maxMemoryUsage=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"viewDistanceScale",{get:function(){return this.tileset.viewDistanceScale},set:function(e){this.tileset.viewDistanceScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"maxRequests",{get:function(){return this.tileset.maxRequests},set:function(e){this.tileset.maxRequests=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"maxScreenSpaceError",{get:function(){return this.tileset.maxScreenSpaceError},set:function(e){this.tileset.maxScreenSpaceError=e},enumerable:!1,configurable:!0}),r.prototype.loadContent=function(t,r){var n=this;if(!t.content)return Promise.resolve(!1);var i=t.content,o=Ne(i.uri,{key:"model-".concat(t.siblingIndex)});return"TILESET"===t.type?Se(o,{responseType:"text",allowHosts:r.allowHosts,networkSubscribe:r.networkSubscribe,requestProxy:r.requestProxy}).then((function(e){return e.body})).then((function(e){var t=o.slice(0,o.lastIndexOf("/")+1);return Zr(JSON.parse(e),t)})).then((function(e){return t.geometricError=e.geometricError,0===t.children.length&&(t.children=[new Ar("".concat(t.id,".0"),e.root,t.tileset,t)]),!0})):"SCENEGRAPH"===t.type?Promise.resolve().then((function(){var n,i,a,s,l,u,c,h,p,d;return/\.b3dm$/.test(o)?yn(o,{upAxis:t.tileset.asset.gltfUpAxis,allowHosts:r.allowHosts,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe}):/\.pnts$/.test(o)?function(t,r){var n={uri:t};return Promise.resolve().then((function(){return Se(t,{responseType:"arraybuffer",allowHosts:r.allowHosts,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe}).then((function(e){return e.body}))})).then((function(e){return Promise.resolve(0).then((function(t){return rn(n,e,t)})).then((function(t){return dn(n,e,t)})).then((function(e){return En(n,0,e)}))})).then((function(){return function(t){var r=new e.BufferGeometry,n=kn;t.position&&r.setAttribute("position",new e.BufferAttribute(t.position.array,t.position.size,!1)),t.color&&r.setAttribute("color",new e.BufferAttribute(t.color.array,t.color.size,!0)),t.normal&&(r.setAttribute("normal",new e.BufferAttribute(t.normal.array,t.normal.size,!1)),(n=Dn).defines.USE_POINT_NORMAL=!0),r.computeBoundingBox(),r.computeBoundingSphere();var i=new ot(r,n);return i.matrix.compose(i.position,i.quaternion,i.scale),i.matrixAutoUpdate=!1,i.frustumCulled=!1,i.renderOrder=-1e3,Promise.resolve(i)}(n.attributes).then((function(t){var r=new e.Matrix4,i=(new e.Matrix4).setPosition(n.rtcCenter);return r.premultiply(i),t.applyMatrix4(r),{type:"pnts",uri:n.uri,byteLength:n.byteLength,object:t}}))}))}(o,{allowHosts:r.allowHosts,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe}):/\.at3d$/.test(o)?function(e,t){var r,n,i,o=Ai(null!==(r=t.textureOptions)&&void 0!==r?r:{},null!==(i=null===(n=t.textureArray)||void 0===n?void 0:n.length)&&void 0!==i?i:0),a={};if(t.textureArray)for(var s=0,l=t.textureArray;s<l.length;s++){var u=l[s];a[u]=vi(u,o,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return Se(e,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return qn(e.body)})).then((function(e){return Wn((function(){for(var t,r={chunks:[],createAt:void 0,description:void 0},n=0,i=e;n<i.length;n++){var o=i[n],a=ci.decode(o);a.chunks.length&&((t=r.chunks).push.apply(t,a.chunks),r.createAt=a.createAt,r.description=a.description)}return r}))})).then((function(e){return Wn((function(){var r,n,i;return mi(e,null!==(r=t.textureBaseUri)&&void 0!==r?r:"",(null!==(n=t.textureArray)&&void 0!==n?n:[]).slice(),null!==(i=t.textureOptions)&&void 0!==i?i:{},a,t.allowHosts,t.requestProxy,t.networkSubscribe)}))})).then((function(t){var r=new et;r.renderOrder=-4,r.name=e;for(var n=0,i=t.objects;n<i.length;n++){var o=i[n];r.add(o)}return t.texturePromise.then((function(){return{type:"at3d",uri:e,byteLength:0,object:r}}))}))}(o,{allowHosts:r.allowHosts,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe,textureBaseUri:null===(n=t.extras.at3d)||void 0===n?void 0:n.textureBaseUri,textureArray:null===(i=t.extras.at3d)||void 0===i?void 0:i.textureArray,textureOptions:null===(a=t.extras.at3d)||void 0===a?void 0:a.textureOptions}):/\.pbm$/.test(o)?function(e,t){var r,n,i,o={byteLength:0},a=Ai(null!==(r=t.textureOptions)&&void 0!==r?r:{},null!==(i=null===(n=t.textureArray)||void 0===n?void 0:n.length)&&void 0!==i?i:0),s={};if(t.textureArray)for(var l=0,u=t.textureArray;l<u.length;l++){var c=u[l];s[c]=vi(c,a,t.allowHosts,t.requestProxy,t.networkSubscribe)}return Promise.resolve().then((function(){return Se(e,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return o.byteLength=e.body.byteLength,Wn((function(){var t=new Uint8Array(e.body);return ci.decode(t)}))})).then((function(e){return Wn((function(){var r,n;return mi(e,null!==(r=t.textureBaseUri)&&void 0!==r?r:"",(null!==(n=t.textureArray)&&void 0!==n?n:[]).slice(),a,s,t.allowHosts,t.requestProxy,t.networkSubscribe)}))})).then((function(t){var r=new et;r.renderOrder=-4,r.matrixAutoUpdate=!1,r.matrix.compose(r.position,r.quaternion,r.scale),r.name=e;for(var n=0,i=t.objects;n<i.length;n++){var a=i[n];r.add(a)}return t.texturePromise.then((function(){return{type:"pbm",uri:e,byteLength:o.byteLength,object:r}}))}))}(o,{allowHosts:r.allowHosts,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe,textureBaseUri:null===(s=t.extras.pbm)||void 0===s?void 0:s.textureBaseUri,textureArray:null===(l=t.extras.pbm)||void 0===l?void 0:l.textureArray,textureOptions:null===(u=t.extras.pbm)||void 0===u?void 0:u.textureOptions}):/\.dome$/.test(o)?function(e,t){var r={byteLength:0};return Promise.resolve().then((function(){return Se(e,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return r.byteLength=e.body.byteLength,Si(new Uint8Array(e.body),t.textureBaseUri||"",t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)})).then((function(t){var n=new et;n.renderOrder=-4,n.matrixAutoUpdate=!1,n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(var i=0,o=t.objects;i<o.length;i++){var a=o[i];n.add(a)}return t.texturePromise.then((function(){return{type:"at3d",uri:e,byteLength:r.byteLength,object:n}}))}))}(o,{allowHosts:r.allowHosts,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe,textureBaseUri:null===(c=t.extras.dome)||void 0===c?void 0:c.textureBaseUri,textureOptions:null===(h=t.extras.dome)||void 0===h?void 0:h.textureOptions}):/\.domez$/.test(o)?function(e,t){var r={byteLength:0};return Promise.resolve().then((function(){return Se(e,{responseType:"arraybuffer",allowHosts:t.allowHosts,requestProxy:t.requestProxy,networkSubscribe:t.networkSubscribe})})).then((function(e){return r.byteLength=e.body.byteLength,qn(e.body)})).then((function(e){var t=e.reduce((function(e,t){return e+t.length}),0),r=new Uint8Array(t),n=0;return e.forEach((function(e){r.set(e,n),n+=e.length})),r})).then((function(e){return Si(e,t.textureBaseUri||"",t.textureOptions,t.allowHosts,t.requestProxy,t.networkSubscribe)})).then((function(t){var n=new et;n.renderOrder=-4,n.name=e;for(var i=0,o=t.objects;i<o.length;i++){var a=o[i];n.add(a)}return t.texturePromise.then((function(){return{type:"at3d",uri:e,byteLength:r.byteLength,object:n}}))}))}(o,{allowHosts:r.allowHosts,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe,textureBaseUri:null===(p=t.extras.domez)||void 0===p?void 0:p.textureBaseUri,textureOptions:null===(d=t.extras.domez)||void 0===d?void 0:d.textureOptions}):void 0})).then((function(r){if(!r)return!1;var o={type:r.type,uri:r.uri,byteLength:r.byteLength,object:new Kr(r.object,"pnts"===r.type?"points":"mesh")};if("pnts"===r.type&&(r.object.material.uniforms.geometricError.value=t.geometricError),n.disposed)return o.object.dispose(),i.data=void 0,i.byteLength=0,!1;if("pnts"!==o.type&&o.object.buildBvhTree(),i.data=o,i.byteLength=o.byteLength,o.object.applyMatrix4(t.transform),o.object.updateWorldMatrix(!1,!0),o.object.matrixAutoUpdate=!1,function(t,r){var n=r.tileset.properties.floorInfo;t.traverse((function(t){if(t instanceof tt){if(t.geometry.getAttribute("floor"))return;var r=t.geometry.getAttribute("position"),i=r.count,o=new Float32Array(i);if(n){for(var a=0,s=0;s<i;s++){Ii.set(r.array[3*s+0],r.array[3*s+1],r.array[3*s+2]),Ii.applyMatrix4(t.matrixWorld);var l=Ii.y;o[s]=0;for(var u=0;u<n.length;u++){var c=n[u];if(l<c.ground+c.height){o[s]=u;break}}a+=o[s]}t.renderOrder+=a/i}else for(s=0;s<i;s++)o[s]=0;t.geometry.setAttribute("floor",new e.BufferAttribute(o,1))}}))}(r.object,t),o.object.visible=!1,n.boundingBox.expandByObject(o.object),n.nodes.set(t.id,o.object),n.nodeGroup.add(o.object),t.boundingVolume){var a=function(t,r){var n;if(t instanceof or)return(n=new e.LineSegments(fr,dr[Math.min(r,dr.length-1)])).position.copy(t.center),n.quaternion.setFromRotationMatrix(Wt.set(t.rotation.elements[0],t.rotation.elements[3],t.rotation.elements[6],0,t.rotation.elements[1],t.rotation.elements[4],t.rotation.elements[7],0,t.rotation.elements[2],t.rotation.elements[5],t.rotation.elements[8],0,0,0,0,1)),n.scale.set(t.halfSize.x,t.halfSize.y,t.halfSize.z),n.matrix.compose(n.position,n.quaternion,n.scale),n;if(t instanceof ar)return(n=new e.LineSegments(vr,dr[Math.min(r,dr.length-1)])).position.copy(t.center),n.scale.set(t.radius,t.radius,t.radius),n.matrix.compose(n.position,n.quaternion,n.scale),n;throw new Error("never")}(t.boundingVolume,t.state.selectionDepth);a.matrixWorldNeedsUpdate=!0,a.matrixAutoUpdate=!1,a.frustumCulled=!1,a.visible=!0,n.debugBoundings.set(t.id,a),n.debugBoundingGroup.add(a)}return!0})):Promise.resolve(!1)},r.prototype.intersectRaycaster=function(e){var t=this,r=[];return this.tileset.selectedTiles.forEach((function(n){var i;if(null===(i=n.content)||void 0===i?void 0:i.data){if(n.boundingVolume&&!1===n.boundingVolume.clone().applyMatrix4(t.tileset.transfrom).intersectRay(e.ray))return;var o=n.content.data.object.intersectRaycaster(e);o.length&&r.push.apply(r,o)}})),r.sort((function(e,t){return e.distance-t.distance})),r},r.prototype.update=function(t,r){var n,i,o=this;if(this.tileset.transfrom.equals(this.matrixWorld)||this.tileset.transfrom.copy(this.matrixWorld),this.nodes.forEach((function(e){e.traverse((function(e){if(e instanceof ot){var t=o.tileset.transfrom.getMaxScaleOnAxis();e.material.uniforms.globalScale.value=t}}))})),this.needsRefined&&this.workCode){var a=ue();if(a-this.lastRefineTime>15){this.lastRefineTime=a,this.tileset.frameNumber++;var s=r.fov/180*Math.PI,l=r.aspect<=1?s:2*Math.atan(Math.tan(.5*s)/r.aspect),u=2*Math.tan(.5*l);Pi.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),Ti.setFromProjectionMatrix(Pi);var c=(new ir).setFromFrustum(Ti),h={camera:{position:(new e.Vector3).copy(r.position),direction:r.getDirection(new e.Vector3),up:(new e.Vector3).copy(r.up)},maxLevelOfDetail:this.visible?this.maxLevelOfDetail:-1,height:t.getSize(new e.Vector2).height,frameNumber:this.tileset.frameNumber,sseDenominator:u,cullingVolume:c};this.tileset.cache.reset(),this.tileset.traverser.traverse(this.tileset.root,h),this.refined=!0,this.tileset.needsRefinedTiles.forEach((function(e){if(!1!==o.refined&&e.content&&e.state.visible){var t=e.content.loadState;"UNLOADED"!==t&&"LOADING"!==t||(o.refined=!1)}})),!1===this.loaded&&(this.loaded=!0,this.tileset.needsRefinedTiles.forEach((function(e){if(!1!==o.loaded&&e.content&&e.state.visible&&0===e.state.selectionDepth){var t=e.content.loadState;"UNLOADED"!==t&&"LOADING"!==t||(o.loaded=!1)}})))}}for(this.tileset.tiles.forEach((function(e){var t=e.selected,r=e.id;(n=o.nodes.get(r))&&n.visible!==t&&(n.visible=t,o.needsRender=!0),(n=o.debugBoundings.get(r))&&n.visible!==t&&(n.visible=t,o.needsRender=!0)}));i=this.unloadTileQueue.pop();){var p=i.id,d=i.content;d&&d.data&&(d.data.object.dispose(),d.data=void 0,d.byteLength=0),(n=this.nodes.get(p))&&(this.nodeGroup.remove(n),this.nodes.delete(p),this.needsRender=!0),(n=this.debugBoundings.get(p))&&(this.debugBoundingGroup.remove(n),this.debugBoundings.delete(p),this.needsRender=!0)}},r.prototype.dispose=function(){var e,t,r=this;for(this.disposed=!0,this.tileset.reset();e=this.unloadTileQueue.pop();){var n=e.id,i=e.content;i&&i.data&&(i.data.object.dispose(),i.data=void 0,i.byteLength=0),(t=this.nodes.get(n))&&(this.nodeGroup.remove(t),this.nodes.delete(n),this.needsRender=!0),(t=this.debugBoundings.get(n))&&(this.debugBoundingGroup.remove(t),this.debugBoundings.delete(n),this.needsRender=!0)}this.nodes.forEach((function(e,t,n){r.nodeGroup.remove(e),e.dispose(),n.delete(t)}))},r.DEFAULT_MAX_LEVEL_OF_DETAIL=1/0,r.DEFAULT_MAX_MEMORY_USAGE=16,r.DEFAULT_MAX_SCREEN_SPACE_ERROR=Er.DEFAULT_MAX_SCREEN_SPACE_ERROR,r.DEFAULT_MAX_REQUESTS=Er.DEFAULT_MAX_REQUESTS,r}(e.Object3D),Ri=function(t,r){void 0===r&&(r=1e-4),r=Math.max(r,Number.EPSILON);for(var n={},i=t.getIndex(),o=t.getAttribute("position"),a=i?i.count:o.count,s=0,l=Object.keys(t.attributes),u={},c={},h=[],p=["getX","getY","getZ","getW"],d=0,f=l.length;d<f;d++)u[b=l[d]]=[],(E=t.morphAttributes[b])&&(c[b]=new Array(E.length).fill().map((function(){return[]})));var v=Math.log10(1/r),m=Math.pow(10,v);for(d=0;d<a;d++){var A=i?i.getX(d):d,g="",y=0;for(f=l.length;y<f;y++)for(var b=l[y],x=(M=t.getAttribute(b)).itemSize,w=0;w<x;w++)g+="".concat(~~(M[p[w]](A)*m),",");if(g in n)h.push(n[g]);else{for(y=0,f=l.length;y<f;y++){b=l[y];var M=t.getAttribute(b),E=t.morphAttributes[b],C=(x=M.itemSize,u[b]),S=c[b];for(w=0;w<x;w++){var I=p[w];if(C.push(M[I](A)),E)for(var P=0,T=E.length;P<T;P++)S[P].push(E[P][I](A))}}n[g]=s,h.push(s),s++}}var B=t.clone();for(d=0,f=l.length;d<f;d++){b=l[d];var R=t.getAttribute(b),O=new R.array.constructor(u[b]);if(M=new e.BufferAttribute(O,R.itemSize,R.normalized),B.setAttribute(b,M),b in c)for(y=0;y<c[b].length;y++){var k=t.morphAttributes[b][y],D=(O=new k.array.constructor(c[b][y]),new e.BufferAttribute(O,k.itemSize,k.normalized));B.morphAttributes[b][y]=D}}return B.setIndex(h),B};function Oi(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function ki(){return(Oi()+Oi()+"-"+Oi()+"-4"+Oi().substr(0,3)+"-"+Oi()+"-"+Oi()+Oi()+Oi()).toLowerCase()}var Di=new e.Vector3,Li=new e.Matrix3,Fi=6378137;function Qi(t){for(var r=6356752.314245179,n=(Fi*Fi-r*r)/(Fi*Fi),i=Math.sqrt(t.x*t.x+t.y*t.y),o=0,a=Math.atan2(t.z,i),s=0;o++<1e3;){var l=Math.sin(a),u=Fi/Math.sqrt(1-n*l*l);s=i/Math.cos(a)-u;var c=Math.atan2(t.z/(u*(1-n)+s),i/(u+s));if(Math.abs(c-a)<1e-12)break;a=c}var h=new e.Vector3;return h.x=Math.atan2(t.y,t.x),h.y=a,h.z=s,[h.x,h.y]}function Ni(e){switch(e){case"Panorama":case"VRPanorama":case"XRPanorama":case"Model":case"DepthPanorama":return!0;default:return!1}}var Vi=new e.Vector3,Ui=new e.Sphere,zi=new e.Matrix4,_i=new e.Matrix4,qi=new e.Box3,Hi=new Set,ji=(new e.Matrix4).fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),Gi=(new e.Matrix4).fromArray([1,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,1]),Ki=new e.Box3(new e.Vector3(-.5,-.5,-.5),new e.Vector3(.5,.5,.5));function Wi(e){var t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(e);if(t){var r=String(t[1]).trim().split(".").slice(1).reverse()[0];if(r)return r}return""}var Yi=function(t){function r(r){void 0===r&&(r={});var n,i,o,a=this;return(a=t.call(this)||this).name="model",a._floorIndex=it.floorIndex,a._clippers=it.clippers,a.onError=null!==(n=r.onError)&&void 0!==n?n:se,a.onShownFloorChange=null!==(i=r.onShownFloorChange)&&void 0!==i?i:se,a.onLoad=null!==(o=r.onLoad)&&void 0!==o?o:se,a.work=null,a.viewLayers=[],a.bounding=new e.Box3(new e.Vector3,new e.Vector3),a.floorLength=0,a.textureOptions={},a.refined=!1,a.loaded=!1,a.matrixAutoUpdate=!1,a.renderOrder=-4,a.needsRender=!0,a.cache=new rt,a.materialVersion=ki(),a._materialVersionMap=new WeakMap,a._materialValues=Yn(it,["pano0","pano1","modelAlpha","progress","useBlackTransition","opacity","constantColor","useEDL","useHQWeight","useHQDepth","pointShape","pointColorType","pointSizeType","pointSize","pointMinSize","pointMaxSize","pointSizeAdaptiveScale","gradientTexture"]),a.disposed=!1,a}return Z(r,t),Object.defineProperty(r.prototype,"empty",{get:function(){return 0===this.viewLayers.length},enumerable:!1,configurable:!0}),r.prototype.getMaterial=function(){return $({},this._materialValues)},r.prototype.setMaterial=function(e){Object.assign(this._materialValues,e),this.materialVersion=ki(),this.needsRender=!0},Object.defineProperty(r.prototype,"shownFloor",{get:function(){return-1===this._floorIndex?null:this._floorIndex},set:function(e){var t=null===e?-1:e;this._floorIndex!==t&&(this._floorIndex=t,this.needsRender=!0,this.onShownFloorChange(e))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"shownfloor",{get:function(){return this.shownFloor},set:function(e){this.shownFloor=e},enumerable:!1,configurable:!0}),r.prototype.show=function(e){this.shownFloor=null==e?-1:e},Object.defineProperty(r.prototype,"clippers",{get:function(){return this._clippers},set:function(e){this.needsRender=!0,this._clippers=e},enumerable:!1,configurable:!0}),r.prototype.getEdgesBySphere=function(t,r){void 0===r&&(r=30/180*Math.PI);for(var n=Math.cos(r),i=[],o=0,a=this.children;o<a.length;o++){var s=a[o];s instanceof Bi&&s.tileset.selectedTiles.forEach((function(r){var o,a,s;if(!(r.boundingVolume&&r.boundingVolume.distanceTo(t.center)>t.radius)){var l=null===(a=null===(o=r.content)||void 0===o?void 0:o.data)||void 0===a?void 0:a.object;if(l&&l.visible&&l.bvhTree){zi.copy(l.matrixWorld),_i.getInverse(zi),Ui.copy(t).applyMatrix4(_i);var u={},c=["a","b","c"],h=l.bvhTree.trianglesInSphere(Ui.center,Ui.radius),p=new e.BufferGeometry;p.setAttribute("position",new e.BufferAttribute(h,3));var d=Ri(p),f=d.getAttribute("position").array,v=(null===(s=d.getIndex())||void 0===s?void 0:s.array)||[];p.dispose(),d.dispose();for(var m=[],A=[],g=0,y=f.length;g<y;g+=3){var b=new e.Vector3(f[g],f[g+1],f[g+2]).applyMatrix4(zi);m.push(b)}for(g=0,y=v.length;g<y;g+=3){var x=v[g],w=v[g+1],M=v[g+2],E=(new e.Vector3).crossVectors(m[w].clone().sub(m[x]),m[M].clone().sub(m[x])).normalize();A.push({a:x,b:w,c:M,normal:E})}for(g=0,y=A.length;g<y;g++)for(var C=A[g],S=0;S<3;S++){var I=C[c[S]],P=C[c[(S+1)%3]],T=[Math.min(I,P),Math.max(I,P)];void 0===u[B=T[0]+"-"+T[1]]?u[B]={index1:T[0],index2:T[1],face1:g}:u[B].face2=g}for(var B in u){var R=u[B];if(void 0===R.face2||A[R.face1].normal.dot(A[R.face2].normal)<=n){var O=m[R.index1],k=m[R.index2];i.push(new e.Line3(O,k))}}m.length=0,A.length=0}}}))}return i},r.prototype.intersectRaycaster=function(e){for(var t=[],r=0,n=this.children;r<n.length;r++){var i=n[r];if(i instanceof Bi&&i.visible){var o=i.intersectRaycaster(e);o.length&&t.push.apply(t,o)}}return t.sort((function(e,t){return e.distance-t.distance})),t},r.prototype.load=function(t,r){var n,i,o=this;if(void 0===r&&(r={}),!t.model)return Promise.resolve();this.work=t;for(var a=t.workCode,s=t.model,l=t.options,u=0,c=0,h=t.observers;c<h.length;c++){var p=h[c];u=Math.max(u,p.floorIndex)}this.floorLength=u+1;for(var d=!1,f=[],v=function(n){var i=n.tileset,s=n.upAxis,u=n.name,c=n.type,h="";"mesh"===c&&(d=!0);var p=Se(i,{allowHosts:t.allowHosts,networkSubscribe:r.networkSubscribe,requestProxy:r.requestProxy,responseType:"text"}).then((function(n){var o=JSON.parse(n.body),p=o.root;"lodVersion"in o&&(s="-Y","floorInfo"in o&&(o.properties=o.properties||{},o.properties.floorInfo=o.floorInfo.map((function(e){return{ground:-e.ground,height:e.height}})),delete o.floorInfo),o.asset.tilesetVersion=String(o.lodVersion),delete o.lodVersion);var d=new e.Matrix4,f=p.boundingVolume?lr(p.boundingVolume):void 0;switch(s){case"Z":d.copy(ji);break;case"-Y":d.copy(Gi);break;case"WGS84":f&&(f.getCenter(Vi),function(e,t){var r=Qi(e),n=r[0],i=r[1],o=Math.sin(i),a=Math.sin(n),s=Math.cos(i),l=Math.cos(n),u=t.fromArray([-a,-o*l,s*l,0,+l,-o*a,s*a,0,0,s,o,0,0,0,0,1]),c=Li.setFromMatrix4(u),h=Di.copy(e).applyMatrix3(c).multiplyScalar(-1);u.setPosition(h)}(Vi,d),d.premultiply(ji),h=Qi(Vi).reverse().map((function(e){return(e/Math.PI*180).toFixed(6)})).join(","))}f&&p.transform&&f.applyMatrix4(zi.fromArray(p.transform)),o.root={refine:"REPLACE",geometricError:o.geometricError,transform:d.toArray(),boundingVolume:f?f.toJson():void 0,viewerRequestVolume:l.viewerRequestVolume?l.viewerRequestVolume.toJson():void 0,children:[p]};var v=i?i.slice(0,i.lastIndexOf("/")+1):"",m=new Bi(a,o,{resourcePath:v,allowHosts:t.allowHosts,networkSubscribe:r.networkSubscribe,requestProxy:r.requestProxy});return m.matrix.copy(l.transform),m.matrix.decompose(m.position,m.quaternion,m.scale),m.matrixWorldNeedsUpdate=!0,{name:u,type:c,upAxis:s,coordinates:h,scene:m}}));f.push(p.catch((function(e){return o.onError(e),{name:u,type:c,upAxis:s,coordinates:"",scene:null}})))},m=0,A=s.layers;m<A.length;m++)v(A[m]);if(!d&&s.file){var g=s.file,y=s.textureBase,b=s.textures,x={asset:{gltfUpAxis:"Z",version:"0.0"},geometricError:0,root:{content:{uri:g},refine:"REPLACE",geometricError:0,viewerRequestVolume:l.viewerRequestVolume?l.viewerRequestVolume.toJson():void 0,extras:(n={},n[Wi(g)||"at3d"]={textureBaseUri:y,textureArray:b,textureOptions:null!==(i=r.textureOptions)&&void 0!==i?i:{}},n)}},w=g.slice(0,g.lastIndexOf("/")+1),M=new Bi(a,x,{resourcePath:w,allowHosts:t.allowHosts,networkSubscribe:r.networkSubscribe,requestProxy:r.requestProxy});M.matrix.copy(l.transform),M.matrix.decompose(M.position,M.quaternion,M.scale),M.matrixWorldNeedsUpdate=!0;var E=Promise.resolve({scene:M,coordinates:"",name:"fallback",type:"lod",upAxis:"Y"});f.push(E)}return Promise.all(f).then((function(e){for(var t=[],r=[],n=[],i=0,a=e;i<a.length;i++){var s=a[i];if(s.scene){if(o.disposed){s.scene.dispose();continue}switch(o.viewLayers.push({scene:s.scene,coordinates:s.coordinates,name:s.name,type:s.type,upAxis:s.upAxis}),o.add(s.scene),s.scene.visible=!1,s.type){case"lod":t.push(s.scene);break;case"point_cloud":r.push(s.scene);break;default:n.push(s.scene)}}}t.length?t[0].visible=!0:r.length?r[0].visible=!0:n.length&&(n[0].visible=!0)}))},r.prototype.update=function(t,r,n){var i,o,a,s,l,u=this;if(this.children.length){var c=this.loaded;this.refined=null!==this.work,this.loaded=null!==this.work,this.bounding.makeEmpty();for(var h=0,p=this.children;h<p.length;h++){var d=p[h];d instanceof Bi&&(this.work&&(d.maxLevelOfDetail=0===this._materialValues.modelAlpha?0:null!==(i=this.work.options.modelMaxLevelOfDetail)&&void 0!==i?i:Bi.DEFAULT_MAX_LEVEL_OF_DETAIL,d.maxScreenSpaceError=null!==(o=this.work.options.modelMaxScreenSpaceError)&&void 0!==o?o:Bi.DEFAULT_MAX_SCREEN_SPACE_ERROR,d.maxRequests=null!==(a=this.work.options.modelMaxRequests)&&void 0!==a?a:Bi.DEFAULT_MAX_REQUESTS,d.maxMemoryUsage=null!==(s=this.work.options.modelMaxMemoryUsage)&&void 0!==s?s:Bi.DEFAULT_MAX_MEMORY_USAGE,d.debug=null!==(l=this.work.options.debug)&&void 0!==l&&l,Ni(n)?d.needsRefined=0===this._materialValues.modelAlpha||1===this._materialValues.modelAlpha:d.needsRefined=!0,this.work.options.transform.equals(d.matrix)||(d.matrix.copy(this.work.options.transform),d.matrix.decompose(d.position,d.quaternion,d.scale),d.matrixWorldNeedsUpdate=!0)),d.update(t,r),d.boundingBox.isEmpty()||(qi.copy(d.boundingBox).applyMatrix4(d.matrix),this.bounding.union(qi)),!0===d.needsRender&&(d.needsRender=!1,this.needsRender=!0),!1===d.refined&&(this.refined=!1),!1===d.loaded&&(this.loaded=!1))}this.bounding.isEmpty()&&this.bounding.copy(Ki),!1===c&&!0===this.loaded&&this.onLoad()}else this.refined=!1,this.loaded=!1,this.bounding.set(new e.Vector3,new e.Vector3);this.cache.clear(),Hi.clear();var f=this,v=f.materialVersion,m=f._materialValues,A=f._materialVersionMap,g=f._floorIndex,y=f._clippers,b=f.cache;this.traverse((function(e){if(e instanceof tt&&e.material.forEach((function(e){Hi.has(e)||(Hi.add(e),A.get(e)!==v&&(A.set(e,v),Object.assign(e,m),u.needsRender=!0)),e.floorIndex=g,e.clippers=y,e.update(t,r,b)})),e instanceof ot){var n=e.material;Hi.has(n)||(Hi.add(n),A.get(n)!==v&&(A.set(n,v),Object.assign(n,m),u.needsRender=!0)),n.floorIndex=g,n.clippers=y,n.update(t,r,b)}}))},r.prototype.dispose=function(){var e;for(this.disposed=!0;e=this.children[0];)e instanceof Bi&&e.dispose(),this.remove(e)},r}(e.Object3D);function Xi(){var t=new e.Box3,r=Yn(it,["pano0","pano1","modelAlpha","progress","useBlackTransition","opacity","constantColor","useEDL","useHQWeight","useHQDepth","pointShape","pointColorType","pointSizeType","pointSize","pointMinSize","pointMaxSize","pointSizeAdaptiveScale","gradientTexture"]),n=Object.assign([],{bounding:t,needsRender:!1,refined:!1,loaded:!1,materialVersion:ki(),intersectRaycaster:function(e){for(var t=[],r=0,i=n;r<i.length;r++){var o=i[r];if(o.visible){var a=o.intersectRaycaster(e);a.length&&t.push.apply(t,a)}}return t.sort((function(e,t){return e.distance-t.distance})),t},setMaterial:function(e){Object.assign(r,e),n.materialVersion=ki()},getMaterial:function(){return $({},r)},update:function(e,i,o){n.refined=n.length>0,n.loaded=n.length>0,t.makeEmpty();for(var a=0,s=n;a<s.length;a++){var l=s[a];l.materialVersion!==n.materialVersion&&(l.setMaterial(r),l.materialVersion=n.materialVersion),l.update(e,i,o),!0===l.needsRender&&(n.needsRender=!0,l.needsRender=!1),!1===l.refined&&(n.refined=!1),!1===l.loaded&&(n.loaded=!1),t.union(l.bounding)}t.isEmpty()&&t.copy(Ki)}});return n}function Ji(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,n,i;if(Array.isArray(e)){if((r=e.length)!=t.length)return!1;for(n=r;0!=n--;)if(!Ji(e[n],t[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((r=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,i[n]))return!1;for(n=r;0!=n--;){var o=i[n];if(!Ji(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function Zi(e){return"number"==typeof e}var $i=function(){return new Error("Invalid input.")},eo=function(){return new Error("Invalid certificate.")},to=function(){return new Error("Invalid signature.")},ro=function(e){return new Error("date(".concat(e.toString(),") expired."))},no=function(e){return new Error("host(".concat(JSON.stringify(e),") is not allowed."))};function io(e,t){void 0===t&&(t=!1);var r=typeof e;if("string"===r)return JSON.stringify(e);if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(e instanceof Array){for(var n="[",i=e.length-1,o=0;o<i;o++)n+=io(e[o],!1)+",";return i>-1&&(n+=io(e[o],!1)),n+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return io(e.toJSON(),t);var a=Object.keys(e).sort(),s=a.length;for(n="",o=0;o<s;){var l=a[o],u=io(e[l],!0);void 0!==u&&(o&&""!==n&&(n+=","),n+=JSON.stringify(l)+":"+u),o++}return"{"+n+"}"}switch(r){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(e)?e:null}}function oo(e){return String(io(e,!1))}function ao(e){var t,r,n;if(Array.isArray(e)){var i,o,a=void 0;if(e.length<=0)return $i();for(var s=function(t){var r=ao(e[t]);if(r instanceof Error)return{value:r};if(a){if(a!==r.issuer)return{value:eo()}}else a=r.issuer;i?r.expire.getTime()<i.getTime()&&(i=r.expire):i=r.expire,o=o?o.filter((function(e){return-1!==r.allowHosts.indexOf(e)})):r.allowHosts},l=0;l<e.length;l++){var u=s(l);if("object"==typeof u)return u.value}return ce({issuer:a,expire:i,allowHosts:o})}var c=JSON.parse(e),h="undefined"!=typeof location?location.hostname:"",p=Date.now();if("object"!=typeof c)return $i();var d=new Date("string"==typeof c.expire_at&&/^\d+$/.test(c.expire_at)?Number(c.expire_at):c.expire_at),f=Array.isArray(c.allow_hosts)?c.allow_hosts:[];if(0===h.length||pe(h)||me.filter((function(e){return de(e,h)})).length>0){var v=String(null!==(t=c.certificate)&&void 0!==t?t:"");if(v){var m=new j;return m.readCertPEM(v),ce({issuer:m.getSubjectString(),expire:d,allowHosts:f})}return ce({issuer:"none",expire:d,allowHosts:f})}var A=String(null!==(r=c.certificate)&&void 0!==r?r:"");if(!A)return eo();var g=new j;g.readCertPEM(A);var b=String(null!==(n=c._signature)&&void 0!==n?n:"");if(!b)return to();var x=oo(function(e,t){for(var r={},n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];-1===t.indexOf(o)&&(r[o]=e[o])}return r}(c,["_signature"]));return!1===function(e,t,r){var n=new j;if("string"==typeof r?n.readCertPEM(r):n.readCertHex(r.hex),!1===X(n))return!1;var i=new w;return i.readCertPubKeyHex(n.hex,6),!!i.verify(e,y(t))}(x,b,g)?to():p<d.getTime()?0===f.filter((function(e){return de(e,h)})).length?no(h):ce({issuer:g.getSubjectString(),expire:d,allowHosts:f}):ro(d)}var so=new e.Matrix4,lo=new WeakMap,uo=function(){function t(t,r){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={work:this},this.observers=[],this.issuer="none",this.raw={works:[""],options:""},this.options={transform:new e.Matrix4};var n=go(t,r,this);if(n instanceof Error)throw new Error("[PARSE FAILED]: "+n.message+"\nError work input:\n"+JSON.stringify(t))}return t.prototype.toJSON=function(){return this.raw},t.parse=yo,t}();function co(e){return null==e?"null":Array.isArray(e)?"array":"object"==typeof e?"dict":"value"}function ho(e,t){var r=co(e),n=co(t);if("null"===n)return e;if("value"===n)return t;if(n!==r)return JSON.parse(JSON.stringify(t));if("array"===n)for(var i=0;i<t.length;i++)e[i]=ho(e[i],t[i]);else if("dict"===n)for(var o in t)e[o]=ho(e[o],t[o]);return e}function po(e,t){return 0===e.indexOf(t)}function fo(e,t,r,n){var i,o=t;if(!0===n.jsonp){o=t.replace(/([\?\#].*)?$/i,"");var a=G("".concat(o)).slice(0,7);o="".concat(o,".").concat(a,".jsonp")}if(!0===n.shortPath){var s=o.replace(e,"").split("."),l=null!==(i=s.shift())&&void 0!==i?i:"",u=s.join(".");o=Yr(e,G(l))+(u?"."+u:"")}var c=o.replace(e,"");return n.baseURL&&(o=Yr(n.baseURL,c)),o}function vo(e,t,r,n,i){var o=r;return Xr(r)||(t&&(t=Yr(t,String(n))),o=Yr(t,o)),Xr(o)||(o=Yr(e,o)),po(o,e)||console.warn("".concat(o," is not start with base_url(").concat(e,").")),fo(e,o,0,i)}function mo(e,t,r){var n=t;return Xr(n)||(n=Yr(e,t)),po(n,e)||console.warn("".concat(n," is not start with base_url(").concat(e,").")),fo(e,n,0,r)}function Ao(e,t,r,n){var i=t;return Xr(i)||(i=Yr(r,i)),Xr(i)||(i=Yr(e,i)),po(i,e)||console.warn("".concat(i," is not start with base_url(").concat(e,").")),fo(e,i,0,n)}function go(t,r,n){for(var i,o,a,s,l,u,c,h,p,d,f,v,m,A,g,y,b,x,w=JSON.stringify(r),M=[],E=0,C=[].concat(t);E<C.length;E++){var S=C[E];S instanceof uo?M.push.apply(M,S.raw.works):"string"==typeof S?M.push(S):M.push(JSON.stringify(S))}var I=ao(M);if(I instanceof Error)return I;r=JSON.parse(w);var P,T={transform:new e.Matrix4};if(void 0!==r.debug&&(T.debug=r.debug),r.transform&&(Array.isArray(r.transform)?T.transform.fromArray(r.transform):T.transform.copy(r.transform)),r.viewerRequestVolume&&("clone"in r.viewerRequestVolume?T.viewerRequestVolume=r.viewerRequestVolume.clone():T.viewerRequestVolume=lr(r.viewerRequestVolume)),void 0!==r.modelMaxLevelOfDetail&&r.modelMaxLevelOfDetail>=0&&(T.modelMaxLevelOfDetail=r.modelMaxLevelOfDetail),void 0!==r.modelMaxRequests&&r.modelMaxRequests>=0&&(T.modelMaxRequests=r.modelMaxRequests),void 0!==r.modelMaxMemoryUsage&&r.modelMaxMemoryUsage>=0&&(T.modelMaxMemoryUsage=r.modelMaxMemoryUsage),void 0!==r.modelMaxScreenSpaceError&&r.modelMaxScreenSpaceError>=0&&(T.modelMaxScreenSpaceError=r.modelMaxScreenSpaceError),Object.defineProperty(n,"options",{configurable:!1,get:function(){return T}}),t=M.map((function(e){return JSON.parse(e)})).reduce((function(e,t){return ho(e,t)})),Object.defineProperty(n,"raw",{configurable:!1,get:function(){return{works:M,options:w}}}),r.workCode&&("string"==typeof r.workCode?P=r.workCode:"function"==typeof r.workCode&&(P=r.workCode(t))),void 0===P&&(P=String(t.resource_code||t.basic_code||t.vr_code||t.code||t.project_id||t.work_code||t.workCode)),void 0===P)return new Error("WorkCode never matched.");Object.defineProperty(n,"workCode",{configurable:!1,get:function(){return P}});var B=String(t.name);if(Object.defineProperty(n,"name",{configurable:!1,get:function(){return B}}),I instanceof Error)return I;Object.defineProperty(n,"issuer",{configurable:!1,get:function(){return I.issuer}}),Object.defineProperty(n,"expire",{configurable:!1,get:function(){return I.expire}}),Object.defineProperty(n,"allowHosts",{configurable:!1,get:function(){return I.allowHosts}});var R=null!==(i=t.base_url)&&void 0!==i?i:"";if(R&&"/"!==R[R.length-1]&&(R+="/"),I instanceof Error)return I;if(t.model){var O,k,D,L={work:n,layers:[]};t.model.file?O=mo(R,t.model.file,r):t.model.file_url&&(O=mo(R,t.model.file_url,r)),Object.defineProperty(L,"file",{configurable:!1,get:function(){return O}}),t.model.textureBase?k=Ao(R,"",t.model.textureBase,r):t.model.material_base_url?k=Ao(R,"",t.model.material_base_url,r):L.file&&(k=L.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Object.defineProperty(L,"textureBase",{configurable:!1,get:function(){return k}}),Array.isArray(t.model.textures)?(D=t.model.textures.map((function(e){var n,i;return Ao(R,e,null!==(i=null!==(n=t.model.textureBase)&&void 0!==n?n:t.model.material_base_url)&&void 0!==i?i:"",r)})),Object.freeze(D)):Array.isArray(t.model.material_textures)&&(D=t.model.material_textures.map((function(e){var n,i;return Ao(R,e,null!==(i=null!==(n=t.model.textureBase)&&void 0!==n?n:t.model.material_base_url)&&void 0!==i?i:"",r)})),Object.freeze(D)),Object.defineProperty(L,"textures",{configurable:!1,get:function(){return D}});var F=[];if(Array.isArray(t.model.tiles))for(var Q=0,N=t.model.tiles;Q<N.length;Q++){var V=N[Q];V&&(V.tileset||V.tileset_url)&&F.push(Object.freeze({type:null!==(o=V.type)&&void 0!==o?o:"mesh",name:null!==(a=V.name)&&void 0!==a?a:"",upAxis:null!==(l=null!==(s=V.upAxis)&&void 0!==s?s:V.up_axis)&&void 0!==l?l:"-Y",tileset:V.tileset||V.tileset_url}))}else t.model.tiles&&(t.model.tiles.tileset||t.model.tiles.tileset_url)&&F.push(Object.freeze({type:null!==(u=t.model.tiles.type)&&void 0!==u?u:"mesh",name:null!==(c=t.model.tiles.name)&&void 0!==c?c:"lod",upAxis:null!==(p=null!==(h=t.model.tiles.upAxis)&&void 0!==h?h:t.model.tiles.up_axis)&&void 0!==p?p:"-Y",tileset:t.model.tiles.tileset||t.model.tiles.tileset_url}));if(Array.isArray(t.model.layers))for(var U=0,z=t.model.layers;U<z.length;U++){var _=z[U];_&&(_.tileset||_.tileset_url)&&F.push(Object.freeze({type:null!==(d=_.type)&&void 0!==d?d:"mesh",name:null!==(f=_.name)&&void 0!==f?f:"",upAxis:null!==(v=_.upAxis)&&void 0!==v?v:_.up_axis,tileset:_.tileset||_.tileset_url}))}Object.freeze(F),Object.defineProperty(L,"layers",{configurable:!1,get:function(){return F}}),Object.defineProperty(n,"model",{configurable:!1,get:function(){if(L.file||L.layers.length)return L}})}if(I instanceof Error)return I;var q=[];if(t.observers&&Array.isArray(t.observers)){var H=[];t.panorama&&(Array.isArray(t.panorama)?H=t.panorama:Array.isArray(t.panorama.list)?H=t.panorama.list:Array.isArray(t.panorama.info)&&(H=t.panorama.info));for(var j=function(i){var o={},a=t.observers[i];if(!a)return"break";var s=H[i];if(!s)return"break";a=Object.assign({},a,s,{active:!1!==a.active&&!1!==s.active}),Object.defineProperty(o,"work",{configurable:!1,get:function(){return n}}),Object.defineProperty(o,"index",{configurable:!1,get:function(){return i}}),Object.defineProperty(o,"panoIndex",{configurable:!1,get:function(){return i}});var l=Ke({workCode:n.workCode,panoIndex:i});Object.defineProperty(o,"panoId",{configurable:!1,get:function(){return l}});var u=Object.freeze({workCode:n.workCode,panoIndex:i});Object.defineProperty(o,"pano",{configurable:!1,get:function(){return u}});var c=!1!==a.active;Object.defineProperty(o,"active",{configurable:!1,get:function(){return c}});var h=!0===a.loadable;Object.defineProperty(o,"loadable",{configurable:!1,get:function(){return h}});var p=a.derived_id;Object.defineProperty(o,"derivedId",{configurable:!1,get:function(){return p}});var d=null!==(x=null!==(y=null!==(A=null===(m=t.panorama)||void 0===m?void 0:m.pano_high_cube_base_url)&&void 0!==A?A:null===(g=t.panorama)||void 0===g?void 0:g.pano_cube_base_url)&&void 0!==y?y:null===(b=t.panorama)||void 0===b?void 0:b.base_url)&&void 0!==x?x:"",f={up:vo(R,d,a.images?a.images.up:a.up,i,r),down:vo(R,d,a.images?a.images.down:a.down,i,r),right:vo(R,d,a.images?a.images.right:a.right,i,r),left:vo(R,d,a.images?a.images.left:a.left,i,r),front:vo(R,d,a.images?a.images.front:a.front,i,r),back:vo(R,d,a.images?a.images.back:a.back,i,r)},v=a.images?a.images.depth:a.depth;v&&(f.depth=vo(R,d,v,i,r));var w=a.images?a.images.luminance:a.luminance;w&&(f.luminance=Object.freeze({up:vo(R,d,w.up,i,r),down:vo(R,d,w.down,i,r),right:vo(R,d,w.right,i,r),left:vo(R,d,w.left,i,r),front:vo(R,d,w.front,i,r),back:vo(R,d,w.back,i,r)}));var M=a.images?a.images.tiles:a.tiles;if(M){for(var E=[],C=function(e){var t,r=e.match(/\/cube_(\d+)\//);if(r){var n=Number(r[1]);if(0==((t=n)&t-1)&&0!==t)return n}return!1},S=function(e,t){return e.replace(/\/cube_(\d+)\//,(function(){return"/cube_".concat(t,"/")}))},I=0,P=M;I<P.length;I++){var T=P[I];if("number"==typeof T){var B=T,O=C(f.front);if(!1===O)continue;if((V=Math.max(O,512*Math.pow(2,B)))>2048){var k=S(f.up,V),D=S(f.down,V),L=S(f.right,V),F=S(f.left,V),Q=S(f.front,V),N=S(f.back,V);E.push(Object.freeze({level:B,size:V,up:k,down:D,right:L,left:F,front:Q,back:N}))}else k=f.up,D=f.down,L=f.right,F=f.left,Q=f.front,N=f.back,E.push(Object.freeze({level:B,size:V,up:k,down:D,right:L,left:F,front:Q,back:N}))}else{var V;if("number"!=typeof(B=T.level))continue;if("number"!=typeof(V=T.size))continue;k=vo(R,d,T.up,i,r),D=vo(R,d,T.down,i,r),L=vo(R,d,T.right,i,r),F=vo(R,d,T.left,i,r),Q=vo(R,d,T.front,i,r),N=vo(R,d,T.back,i,r),E.push(Object.freeze({level:B,size:V,up:k,down:D,right:L,left:F,front:Q,back:N}))}}E.sort((function(e,t){return e.level-t.level})),Object.freeze(E),Object.defineProperty(f,"tiles",{configurable:!1,get:function(){return E}})}Object.freeze(f),Object.defineProperty(o,"images",{configurable:!1,get:function(){return f}});var U=new e.Vector3;if(a.position instanceof e.Vector3)U.copy(a.position);else{if(!Array.isArray(a.position))return"break";U.fromArray(a.position)}Object.freeze(U),Object.defineProperty(o,"position",{configurable:!1,get:function(){return U}});var z=new e.Vector3;if(a.standingPosition instanceof e.Vector3)z.copy(a.standingPosition);else if(Array.isArray(a.standingPosition))z.fromArray(a.standingPosition);else if(a.standing_position instanceof e.Vector3)z.copy(a.standing_position);else{if(!Array.isArray(a.standing_position))return"break";z.fromArray(a.standing_position)}Object.freeze(z),Object.defineProperty(o,"standingPosition",{configurable:!1,get:function(){return z}});var _=new e.Quaternion;if(a.quaternion instanceof e.Quaternion)_.copy(a.quaternion);else if(Array.isArray(a.quaternion))_.fromArray(a.quaternion);else{if(!a.quaternion)return"break";var j=a.quaternion,G=j.x,K=j.y,W=j.z,Y=j.w;_.set(G,K,W,Y)}Object.freeze(_),Object.defineProperty(o,"quaternion",{configurable:!1,get:function(){return _}});var X,J=0;Zi(a.floorIndex)?J=a.floorIndex:Zi(a.floor_index)&&(J=a.floor_index),Object.defineProperty(o,"floorIndex",{configurable:!1,get:function(){return J}}),a.video&&(X={},"string"==typeof a.video.source&&(X.source=a.video.source),a.video.matrix instanceof e.Matrix4?X.matrix=a.video.matrix.clone():Array.isArray(a.video.matrix)&&(X.matrix=(new e.Matrix4).fromArray(a.video.matrix)),a.video.size instanceof e.Vector2?X.size=a.video.size.clone():Array.isArray(a.video.size)&&(X.size=(new e.Vector2).fromArray(a.video.size)),X.source&&X.matrix&&X.size&&(o.video=X)),Object.freeze(X),Object.defineProperty(o,"video",{configurable:!1,get:function(){return X}}),Array.isArray(a.accessibleNodes)?(o.accessibleNodes=a.accessibleNodes.slice(),o.accessibleIds=a.accessibleNodes.map((function(e){return Ke({workCode:n.workCode,panoIndex:e})}))):Array.isArray(a.accessible_nodes)&&(o.accessibleNodes=a.accessible_nodes.slice(),o.accessibleIds=a.accessible_nodes.map((function(e){return Ke({workCode:n.workCode,panoIndex:e})}))),Array.isArray(a.visibleNodes)?(o.visibleNodes=a.visibleNodes.slice(),o.visibleIds=a.visibleNodes.map((function(e){return Ke({workCode:n.workCode,panoIndex:e})}))):Array.isArray(a.visible_nodes)&&(o.visibleNodes=a.visible_nodes.slice(),o.visibleIds=a.visible_nodes.map((function(e){return Ke({workCode:n.workCode,panoIndex:e})}))),q[i]=o},G=0;G<t.observers.length&&"break"!==j(G);G++);}for(var K=function(e){if(e.accessibleIds){var t=e.accessibleIds.filter((function(e){return!!q.find((function(t){return t.panoId===e}))}));Object.freeze(t),Object.defineProperty(e,"accessibleIds",{configurable:!1,get:function(){return t}})}else{for(var r=[],n=0;n<q.length;n++)q[n]!==e&&(Math.abs(q[n].position.y-e.position.y)>3||q[n].position.distanceTo(e.position)>10||r.push(q[n].panoId));Object.freeze(r),Object.defineProperty(e,"accessibleIds",{configurable:!1,get:function(){return r}})}if(e.accessibleNodes){var i=e.accessibleNodes.filter((function(e){return!!q.find((function(t){return t.panoIndex===e}))}));Object.freeze(i),Object.defineProperty(e,"accessibleNodes",{configurable:!1,get:function(){return i}})}else{var o=[];for(n=0;n<q.length;n++)q[n]!==e&&(Math.abs(q[n].position.y-e.position.y)>3||q[n].position.distanceTo(e.position)>10||o.push(q[n].panoIndex));Object.freeze(o),Object.defineProperty(e,"accessibleNodes",{configurable:!1,get:function(){return o}})}if(e.visibleIds){var a=e.visibleIds.filter((function(e){return!!q.find((function(t){return t.panoId===e}))}));Object.freeze(a),Object.defineProperty(e,"visibleIds",{configurable:!1,get:function(){return a}})}else{var s=e.accessibleIds.slice();Object.freeze(s),Object.defineProperty(e,"visibleIds",{configurable:!1,get:function(){return s}})}if(e.visibleNodes){var l=e.visibleNodes.filter((function(e){return!!q.find((function(t){return t.panoIndex===e}))}));Object.freeze(l),Object.defineProperty(e,"visibleNodes",{configurable:!1,get:function(){return l}})}else{var u=e.accessibleNodes.slice();Object.freeze(u),Object.defineProperty(e,"visibleIds",{configurable:!1,get:function(){return u}})}},W=0,Y=q;W<Y.length;W++)K(Y[W]);if(Object.freeze(q),Object.defineProperty(n,"observers",{configurable:!1,get:function(){return q}}),I instanceof Error)return I;if(t.initial){if(("Panorama"===t.initial.mode&&0===n.observers.length||"Floorplan"===t.initial.mode||"Topview"===t.initial.mode||"Model"===t.initial.mode||"Mapview"===t.initial.mode||"DepthPanorama"===t.initial.mode)&&(n.initial.mode=t.initial.mode),Zi(t.initial.latitude)&&(n.initial.latitude=t.initial.latitude),Zi(t.initial.longitude)?n.initial.longitude=t.initial.longitude:Zi(t.initial.heading)&&(n.initial.longitude=-(360*(t.initial.heading-.25)+90)/180*Math.PI),Zi(t.initial.fov)&&(n.initial.fov=t.initial.fov),n.observers.length>0){var X=void 0;Zi(t.initial.panoIndex)?X=t.initial.panoIndex:Zi(t.initial.pano_index)?X=t.initial.pano_index:Zi(t.initial.pano)&&(X=t.initial.pano),"number"==typeof X&&(X=Or(X,0,n.observers.length-1),n.initial.panoIndex=X)}if(Zi(t.initial.distance)&&(n.initial.distance=t.initial.distance),Array.isArray(t.initial.offset)){var J=[0,0,0].map((function(e,r){var n=Number(t.initial.offset[r]);return isNaN(n)||!isFinite(n)?0:n}));n.initial.offset=(new e.Vector3).fromArray(J)}n.initial.mode||"number"!=typeof n.initial.panoIndex||(n.initial.mode="Panorama")}return I instanceof Error?I:(lo.set(n,{works:M,options:w}),n)}function yo(e,t){"string"==typeof e&&"{"===e.trim()[0]&&(e=JSON.parse(e));var r=lo.get(e);if(r){if(t&&!Ji(JSON.parse(r.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return e}try{return new uo(e,null!=t?t:{})}catch(t){throw new Error("[PARSE FAILED]: "+t.message+"\nError work input:\n"+JSON.stringify(e))}}function bo(t){for(var r={},n=[],i={},o=0,a=t;o<a.length;o++){var s=a[o],l=r[s.workCode];l||(l=r[s.workCode]=(new e.Matrix4).copy(s.options.transform));for(var u=0,c=s.observers;u<c.length;u++){var h=c[u],p={isResolved:!0,active:h.active,accessibleIds:h.accessibleIds,visibleIds:h.visibleIds,accessibleNodes:h.accessibleNodes,visibleNodes:h.visibleNodes,floorIndex:h.floorIndex,images:h.images,index:h.index,panoIndex:h.panoIndex,loadable:h.loadable,panoId:h.panoId,pano:h.pano,work:h.work,derivedId:h.derivedId,video:h.video,position:(new e.Vector3).copy(h.position).applyMatrix4(l),standingPosition:(new e.Vector3).copy(h.standingPosition).applyMatrix4(l),quaternion:(new e.Quaternion).setFromRotationMatrix(so.makeRotationFromQuaternion(h.quaternion).premultiply(l))};Object.freeze(p),n.push(p),i[p.panoId]=p}}Object.freeze(n);for(var d=t.slice(),f={},v=0,m=d;v<m.length;v++)s=m[v],f[s.workCode]=s;return Object.freeze(Object.assign(d,{get initial(){return d.length>0?d[0].initial:{work:{}}},get resolvedObservers(){return n},getWork:function(e){return f[e]},getResolvedObserver:function(e){var r,n;return Xe(e)?i[e]:"number"==typeof e?i[Ke({workCode:null!==(n=null===(r=t[0])||void 0===r?void 0:r.workCode)&&void 0!==n?n:"",panoIndex:e})]:i[Ke(e)]},update:function(){for(var t={},i=0,o=d;i<o.length;i++){var a=o[i],s=a.options.transform,l=r[a.workCode];l?l.equals(s)||(l.copy(s),t[a.workCode]=!0):(r[a.workCode]=(new e.Matrix4).copy(s),t[a.workCode]=!0)}for(var u=0,c=n;u<c.length;u++){var h=c[u];if(!0===t[h.work.workCode]){var p=h.work.observers[h.index],f=h.work.options.transform;h.position.copy(p.position).applyMatrix4(f),h.standingPosition.copy(p.standingPosition).applyMatrix4(f),h.quaternion.setFromRotationMatrix(so.makeRotationFromQuaternion(p.quaternion).premultiply(f))}}}}))}function xo(e,t,r){return e+(t-e)*r}function wo(e,t){var r=t[1]-t[0];return e<t[0]?wo(e+r,t):e>=t[1]?wo(e-r,t):e}function Mo(e,t,r,n){return n?function(e,t,r,n){var i=n[1]-n[0];return e=wo(e,n),xo((t=wo(t,n))-e>i/2?e+i:e-t>i/2?e-i:e,t,r)}(e,t,r,n):xo(e,t,r)}var Eo=function(){function e(e){for(var t in this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=ue(),this.startVelocity=0,this.duration=0,this.keyframes=[],e){var r=e[t];"number"==typeof r?(this.value[t]=r,this.config[t]={circle:!1}):(this.value[t]=r.value,this.config[t]={circle:r.circle})}this.keyframes=[{progress:0,value:$({},this.value)},{progress:1,value:$({},this.value)}]}return e.prototype.getProgress=function(e){var t=e-this.startTime;return t<0?0:t>=this.duration?1:1-function(e,t,r,n){var i=(t*r+2)/Math.pow(r,3),o=-(2*t*r+3)/Math.pow(r,2),a=t;return i*Math.pow(n,3)+o*Math.pow(n,2)+a*n+1}(0,this.startVelocity,this.duration,t)},e.prototype.getValue=function(e){for(var t=1;t<this.keyframes.length;t++)if(this.keyframes[t].progress>e){var r=this.keyframes[t-1],n=this.keyframes[t],i={};for(var o in this.config){var a=(e-r.progress)/(n.progress-r.progress);i[o]=Mo(r.value[o],n.value[o],a,this.config[o].circle)}return i}return $({},this.keyframes[this.keyframes.length-1].value)},e.prototype.getProgressVelocity=function(e){var t=e-this.startTime;return t>=this.duration?0:function(e,t,r,n){var i=(t*r+2)/Math.pow(r,3),o=-(2*t*r+3)/Math.pow(r,2),a=t;return 3*i*Math.pow(n,2)+2*o*n+a}(0,this.startVelocity,this.duration,t)},e.prototype.update=function(e){return!!this.ended||(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},e.prototype.getKeyFrameSegment=function(e){for(var t=this.getProgress(e),r=1;r<this.keyframes.length;r++)if(this.keyframes[r].progress>t)return[this.keyframes[r-1],this.keyframes[r]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},e.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},e.prototype.set=function(e,t,r,n){var i;void 0===r&&(r=0),isNaN(t)&&(t=0),isNaN(r)&&(r=0),n=null!=n?n:ue();var o=this.getProgress(n),a=this.getValue(o),s={};for(var l in this.config)s[l]=null!==(i=e[l])&&void 0!==i?i:a[l];var u=[{progress:0,value:a},{progress:1,value:s}];return this.setKeyframes(u,t,r,n)},e.prototype.setKeyframes=function(e,t,r,n){var i=this;if(void 0===r&&(r=0),e.length<2)throw new Error("keyframes invalid.");return isNaN(t)&&(t=0),isNaN(r)&&(r=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise((function(o,a){n=null!=n?n:ue(),i.progress=0,i.ended=!1,i.startTime=n,i.startVelocity=r,i.keyframes=e,i.duration=t,0===t?(i.progress=1,i.value=$({},e[e.length-1].value)):i.value=$({},e[0].value),i.callbacks=[o,a]}))},e.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},e}(),Co=function(e){return e*(2-e)},So=function(){var t=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),r=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),i=new e.BufferGeometry;return i.setAttribute("position",new e.BufferAttribute(t,3)),i.setAttribute("uv",new e.BufferAttribute(r,2)),i.setIndex(new e.BufferAttribute(n,1)),i}(),Io=function(t){function r(r){void 0===r&&(r={});var n,i,o=this;o=t.call(this)||this;var a=null!==(n=r.color)&&void 0!==n?n:16777215,s=null!==(i=r.scale)&&void 0!==i?i:1;return o.progress=0,o.opacity=0,o.loading=!1,o.current=!1,o.disabled=!1,o.currentMotion=new Eo({progress:0}),o.ringMotion=new Eo({scale:1,opacity:1}),o.tapMotion=new Eo({scale:1,opacity:1}),o.loadingOpacityMotion=new Eo({opacity:0}),o.progressMotion=new Eo({progress:0}),o.progressOpacityMotion=new Eo({opacity:0}),o.opacityMotion=new Eo({opacity:0}),o.disableMotion=new Eo({progress:0}),o.panoMesh=new e.Mesh(So,new e.ShaderMaterial({blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1,vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform vec3 baseColor;\nuniform float circleScale;\nuniform float ringScale;\nuniform float ringOpacity;\nuniform float loadingAngle;\nuniform float loadingOpacity;\nuniform float progress;\nuniform float progressOpacity;\nuniform float expand0;\nuniform float expand1;\nuniform float expandOpacity;\nuniform float opacity;\nuniform float tapScale;\nuniform float tapOpacity;\nuniform float disable;\nvarying vec2 vUv;\n\n#define PI 3.141592653589793\n#define TAU 6.283185307179586\n#define SMOOTH_DIST 0.017\n#define CENTER vec2(0.5, 0.5)\n\nfloat inside(float innerDist) {\n float dist = length(CENTER - vUv);\n return smoothstep(innerDist, innerDist + SMOOTH_DIST, dist);\n}\nfloat outside(float outerDist) {\n float dist = length(CENTER - vUv);\n return 1.0 - smoothstep(outerDist - SMOOTH_DIST, outerDist, dist);\n}\n\nvec4 create_circle() {\n float dist = length(CENTER - vUv);\n float gradient = clamp(0.8 + abs(dot(normalize(vec2(1.0, -1.0)), vUv - CENTER)) * 1.5, 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * tapOpacity * inside(0.15 * circleScale * tapScale) * outside(0.234 * circleScale * tapScale));\n}\n\nvec4 create_disable() {\n float dist = length(CENTER - vUv);\n return vec4(1.0, 1.0, 1.0, 0.5 * tapOpacity * outside(0.32 * circleScale * tapScale));\n}\n\nvec4 create_ring() {\n float gradient = clamp(0.5 + abs(dot(normalize(vec2(1.0, 1.0)), vUv - CENTER)), 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * tapOpacity * ringOpacity * inside(0.27 * ringScale * tapScale) * outside(0.32 * ringScale * tapScale));\n}\n\nvec4 create_loading() {\n float angle = PI - atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n angle = mod(angle + loadingAngle, TAU);\n float gradient = (1.0 - smoothstep(0.0, TAU, angle)) * 0.4 + 0.1;\n return vec4(1.0, 1.0, 1.0, gradient * tapOpacity * loadingOpacity * inside(0.208 * circleScale * tapScale) * outside(0.3 * circleScale * tapScale));\n}\n\nvec4 create_progress() {\n float angle = PI + atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n float bar = (1.0 - step(progress * TAU, angle)) * 0.5;\n return vec4(1.0, 1.0, 1.0, bar * tapOpacity * progressOpacity * inside(0.208 * circleScale * tapScale) * outside(0.3 * circleScale * tapScale));\n}\n\nvec4 create_expand0() {\n float width = 0.2;\n float radius = 0.2 + (0.43 - 0.2) * expand0;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand0 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * expandOpacity * outside(radius));\n}\n\nvec4 create_expand1() {\n float width = 0.2;\n float radius = 0.2 + (0.43 - 0.2) * expand1;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand1 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * expandOpacity * outside(radius));\n}\n\nvoid main() {\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0);\n\n vec4 expand1Color = create_expand1();\n gl_FragColor = mix(gl_FragColor, expand1Color, expand1Color.a);\n\n vec4 expand0Color = create_expand0();\n gl_FragColor = mix(gl_FragColor, expand0Color, expand0Color.a);\n\n vec4 progressColor = create_progress();\n gl_FragColor = mix(gl_FragColor, progressColor, progressColor.a);\n\n vec4 loadingColor = create_loading();\n gl_FragColor = mix(gl_FragColor, loadingColor, loadingColor.a);\n\n vec4 circleColor = create_circle();\n gl_FragColor = mix(gl_FragColor, circleColor, circleColor.a);\n\n vec4 ringColor = create_ring();\n gl_FragColor = mix(gl_FragColor, ringColor, ringColor.a);\n\n gl_FragColor = mix(gl_FragColor, create_disable(), disable);\n\n gl_FragColor = vec4(gl_FragColor.rgb * baseColor, gl_FragColor.a * opacity * opacity);\n}\n",uniforms:{baseColor:{value:new e.Color(a)},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}}})),o.renderOrder=-2,o.panoMesh.renderOrder=-2,o.panoMesh.position.y=.004,o.panoMesh.scale.set(s,1,s),o.add(o.panoMesh),o.currentStartTime=ue(),o.needsRender=!0,o}return Z(r,t),r.prototype.setProgress=function(e){var t=this;this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=Or(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},500).catch(se),0===e?this.progressOpacityMotion.set({opacity:0},500).catch(se).then((function(){t.progressMotion.set({progress:0},0).catch(se)})):this.progressMotion.set({progress:Or(1.2*e,0,1)},100).catch(se)),this.progress=e)},r.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Or(e,0,1),this.opacityMotion.set({opacity:e},200).catch(se))},r.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(se),this.current=e,!0===this.current&&(this.currentStartTime=ue()))},r.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(se))},r.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(se))},r.prototype.tap=function(){var e=this;return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(se),this.progressMotion.set({progress:0},0).catch(se),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((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(se),e.progressMotion.set({progress:e.progress},120).catch(se)})).catch(se)):Promise.resolve()},r.prototype.updateTime=function(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);var r=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=r,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var n=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=n,this.needsRender=!0}if(this.opacityMotion.ended||(this.opacityMotion.update(e),n=this.opacityMotion.value.opacity,this.panoMesh.material.uniforms.opacity.value=n,this.needsRender=!0),this.visible=0!==this.opacityMotion.value.opacity,(!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%(2*Math.PI),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;var i=(e-this.currentStartTime-1500)/2e3;if(i%5<2){var o=1+Math.sin(Math.PI*i)/25*this.currentMotion.value.progress;this.panoMesh.material.uniforms.circleScale.value=o,this.needsRender=!0}var a=(e-this.currentStartTime-1500)/2e3;if(a%5<2){var s=a%1;this.panoMesh.material.uniforms.expand0.value=Co(s)*this.currentMotion.value.progress,this.needsRender=!0}var l=(e-this.currentStartTime-1e3)/2e3;l%5<2&&(s=l%1,this.panoMesh.material.uniforms.expand1.value=Co(s)*this.currentMotion.value.progress,this.needsRender=!0)}if(this.currentMotion.value.progress>.2&&0===this.progress&&!1===this.loading&&(e-this.currentStartTime-1e3)/2e3%5<2?.8!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:.8,opacity:0},600).catch(se):1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},600).catch(se),!this.ringMotion.ended){var u=this.ringMotion.value;o=u.scale,n=u.opacity,this.ringMotion.update(e),this.panoMesh.material.uniforms.ringScale.value=o,this.panoMesh.material.uniforms.ringOpacity.value=n,this.needsRender=!0}this.disableMotion.ended||(r=this.disableMotion.value.progress,this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=r,this.needsRender=!0)},r.prototype.dispose=function(){this.ringMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()},r}(e.Object3D),Po=function(e){return e*(2-e)},To=function(){var t=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),r=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),i=new e.BufferGeometry;return i.setAttribute("position",new e.BufferAttribute(t,3)),i.setAttribute("uv",new e.BufferAttribute(r,2)),i.setIndex(new e.BufferAttribute(n,1)),i}(),Bo=function(t){function r(r){void 0===r&&(r={});var n,i,o=this;o=t.call(this)||this;var a=null!==(n=r.color)&&void 0!==n?n:16777215,s=null!==(i=r.scale)&&void 0!==i?i:1;return o.progress=0,o.opacity=0,o.loading=!1,o.current=!1,o.disabled=!1,o.currentMotion=new Eo({progress:0}),o.tapMotion=new Eo({scale:1,opacity:1}),o.loadingOpacityMotion=new Eo({opacity:0}),o.progressMotion=new Eo({progress:0}),o.progressOpacityMotion=new Eo({opacity:0}),o.opacityMotion=new Eo({opacity:0}),o.disableMotion=new Eo({progress:0}),o.panoMesh=new e.Mesh(To,new e.ShaderMaterial({blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1,vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform vec3 baseColor;\nuniform float circleScale;\nuniform float circleOpacity;\nuniform float loadingAngle;\nuniform float loadingOpacity;\nuniform float progress;\nuniform float progressOpacity;\nuniform float expand0;\nuniform float expand1;\nuniform float expandOpacity;\nuniform float opacity;\nuniform float tapScale;\nuniform float tapOpacity;\nuniform float disable;\nvarying vec2 vUv;\n\n#define PI 3.141592653589793\n#define TAU 6.283185307179586\n#define SMOOTH_DIST 0.017\n#define CENTER vec2(0.5, 0.5)\n\nfloat inside(float innerDist) {\n float dist = length(CENTER - vUv);\n return smoothstep(innerDist, innerDist + SMOOTH_DIST, dist);\n}\nfloat outside(float outerDist) {\n float dist = length(CENTER - vUv);\n return 1.0 - smoothstep(outerDist - SMOOTH_DIST, outerDist, dist);\n}\n\nvec4 create_circle() {\n float dist = length(CENTER - vUv);\n return vec4(1.0, 1.0, 1.0, 0.8 * circleOpacity * tapOpacity * inside(0.2 * circleScale * tapScale) * outside(0.3 * circleScale * tapScale));\n}\n\nvec4 create_disable() {\n float dist = length(CENTER - vUv);\n return vec4(1.0, 1.0, 1.0, 0.5 * tapOpacity * outside(0.32 * circleScale * tapScale));\n}\n\nvec4 create_loading() {\n float angle = PI - atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n angle = mod(angle + loadingAngle, TAU);\n float gradient = (1.0 - smoothstep(0.0, TAU, angle)) * 0.9 + 0.1;\n return vec4(1.0, 1.0, 1.0, gradient * tapOpacity * loadingOpacity * inside(0.2 * circleScale * tapScale) * outside(0.3 * circleScale * tapScale));\n}\n\nvec4 create_progress() {\n float angle = PI + atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n float bar = (1.0 - step(progress * TAU, angle)) * 0.7;\n return vec4(1.0, 1.0, 1.0, bar * tapOpacity * progressOpacity * inside(0.2 * circleScale * tapScale) * outside(0.3 * circleScale * tapScale));\n}\n\nvec4 create_expand0() {\n float width = 0.2;\n float radius = 0.25 + (0.5 - 0.25) * expand0;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand0 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * expandOpacity * outside(radius));\n}\n\nvec4 create_expand1() {\n float width = 0.2;\n float radius = 0.25 + (0.48 - 0.25) * expand1;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand1 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * expandOpacity * outside(radius));\n}\n\nvoid main() {\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0);\n\n vec4 expand1Color = create_expand1();\n gl_FragColor = mix(gl_FragColor, expand1Color, expand1Color.a);\n\n vec4 expand0Color = create_expand0();\n gl_FragColor = mix(gl_FragColor, expand0Color, expand0Color.a);\n\n vec4 circleColor = create_circle();\n gl_FragColor = mix(gl_FragColor, circleColor, circleColor.a);\n\n vec4 progressColor = create_progress();\n gl_FragColor = mix(gl_FragColor, progressColor, progressColor.a);\n\n vec4 loadingColor = create_loading();\n gl_FragColor = mix(gl_FragColor, loadingColor, loadingColor.a);\n\n gl_FragColor = mix(gl_FragColor, create_disable(), disable);\n\n gl_FragColor = vec4(gl_FragColor.rgb * baseColor, gl_FragColor.a * opacity * opacity);\n}\n",uniforms:{baseColor:{value:new e.Color(a)},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}}})),o.renderOrder=-2,o.panoMesh.renderOrder=-2,o.panoMesh.position.y=.004,o.panoMesh.scale.set(s,1,s),o.add(o.panoMesh),o.currentStartTime=ue(),o.needsRender=!0,o}return Z(r,t),r.prototype.setProgress=function(e){var t=this;this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=Or(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},500).catch(se),0===e?this.progressOpacityMotion.set({opacity:0},500).catch(se).then((function(){t.progressMotion.set({progress:0},0).catch(se)})):this.progressMotion.set({progress:Or(1.2*e,0,1)},100).catch(se)),this.progress=e)},r.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Or(e,0,1),this.opacityMotion.set({opacity:e},200).catch(se))},r.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(se),this.current=e,!0===this.current&&(this.currentStartTime=ue()))},r.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(se))},r.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(se))},r.prototype.tap=function(){var e=this;return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(se),this.progressMotion.set({progress:0},0).catch(se),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((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(se),e.progressMotion.set({progress:e.progress},120).catch(se)})).catch(se)):Promise.resolve()},r.prototype.updateTime=function(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);var r=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=r,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var n=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=n,this.needsRender=!0}if(this.opacityMotion.ended||(this.opacityMotion.update(e),n=this.opacityMotion.value.opacity,this.panoMesh.material.uniforms.opacity.value=n,this.needsRender=!0),this.visible=0!==this.opacityMotion.value.opacity,(!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%(2*Math.PI),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;var i=(e-this.currentStartTime-1500)/2e3;if(i%5<2){var o=1+Math.sin(Math.PI*i)/25*this.currentMotion.value.progress;this.panoMesh.material.uniforms.circleScale.value=o,this.needsRender=!0}var a=(e-this.currentStartTime-1500)/2e3;if(a%5<2){var s=a%1;this.panoMesh.material.uniforms.expand0.value=Po(s)*this.currentMotion.value.progress,this.needsRender=!0}var l=(e-this.currentStartTime-1e3)/2e3;l%5<2&&(s=l%1,this.panoMesh.material.uniforms.expand1.value=Po(s)*this.currentMotion.value.progress,this.needsRender=!0)}this.disableMotion.ended||(r=this.disableMotion.value.progress,this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=r,this.needsRender=!0)},r.prototype.dispose=function(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()},r}(e.Object3D),Ro=function(e){return e*(2-e)},Oo=function(){var t=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),r=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),i=new e.BufferGeometry;return i.setAttribute("position",new e.BufferAttribute(t,3)),i.setAttribute("uv",new e.BufferAttribute(r,2)),i.setIndex(new e.BufferAttribute(n,1)),i}(),ko=function(t){function r(r){void 0===r&&(r={});var n,i,o,a,s,l,u,c=this;c=t.call(this)||this;var h=null!==(n=r.color)&&void 0!==n?n:16777215,p=null!==(i=r.scale)&&void 0!==i?i:1,d=r.map,f=null!==(o=r.mapAlpha)&&void 0!==o?o:1,v=null!==(a=r.mapUseColor)&&void 0!==a&&a,m=null!==(s=r.mapUseReverse)&&void 0!==s&&s,A=null!==(l=r.borderWidth)&&void 0!==l?l:.1,g=null!==(u=r.borderColor)&&void 0!==u?u:16777215;return c.progress=0,c.opacity=0,c.loading=!1,c.current=!1,c.disabled=!1,c.currentMotion=new Eo({progress:0}),c.tapMotion=new Eo({scale:1,opacity:1}),c.loadingOpacityMotion=new Eo({opacity:0}),c.progressMotion=new Eo({progress:0}),c.progressOpacityMotion=new Eo({opacity:0}),c.opacityMotion=new Eo({opacity:0}),c.disableMotion=new Eo({progress:0}),c.panoMesh=new e.Mesh(Oo,new e.ShaderMaterial({blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1,vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n#if defined(USE_MAP)\nuniform sampler2D map;\nuniform float mapAlpha;\n#endif\n#if defined(USE_BORDER)\nuniform float borderWidth;\nuniform vec3 borderColor;\n#endif\nuniform vec3 baseColor;\nuniform float circleScale;\nuniform float circleOpacity;\nuniform float loadingAngle;\nuniform float loadingOpacity;\nuniform float progress;\nuniform float progressOpacity;\nuniform float expand0;\nuniform float expand1;\nuniform float expandOpacity;\nuniform float opacity;\nuniform float tapScale;\nuniform float tapOpacity;\nuniform float disable;\nvarying vec2 vUv;\n\n#define PI 3.141592653589793\n#define TAU 6.283185307179586\n#define SMOOTH_DIST 0.017\n#define CENTER vec2(0.5, 0.5)\n\nfloat inside(float innerDist) {\n float dist = length(CENTER - vUv);\n return smoothstep(innerDist, innerDist + SMOOTH_DIST, dist);\n}\nfloat outside(float outerDist) {\n float dist = length(CENTER - vUv);\n return 1.0 - smoothstep(outerDist - SMOOTH_DIST, outerDist, dist);\n}\n\nvec4 create_circle() {\n float dist = length(CENTER - vUv);\n float radius = 0.3 * circleScale * tapScale;\n #if defined(USE_MAP)\n float delta = radius / 0.5;\n vec2 deltaUv = (vUv - CENTER) / delta + CENTER;\n vec4 image = texture2D(map, deltaUv);\n image.a = image.a * mapAlpha;\n #if defined(USE_COLOR)\n image = vec4(baseColor, 1.0) * image;\n #endif\n #endif\n #if defined(USE_REVERSE)\n image = vec4(baseColor, 1.0 - image.a);\n #else\n #if defined(USE_BORDER)\n float borderDist = clamp(borderWidth, 0.0, 1.0);\n float clipAlpha = inside(radius - borderDist * radius);\n float gradient = clamp(borderWidth * 2.0 + abs(dot(normalize(vec2(1.0, -1.0)), vUv - CENTER)), 0.0, 1.0);\n vec4 borderColor = vec4(borderColor, clipAlpha * gradient);\n image = mix(borderColor, image, image.a);\n #endif\n #endif\n return vec4(image.rgb, image.a * circleOpacity * tapOpacity * outside(radius));\n}\n\nvec4 create_disable() {\n float dist = length(CENTER - vUv);\n return vec4(baseColor, 0.5 * tapOpacity * outside(0.32 * circleScale * tapScale));\n}\n\nvec4 create_loading() {\n float angle = PI - atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n angle = mod(angle + loadingAngle, TAU);\n float gradient = (1.0 - smoothstep(0.0, TAU, angle)) * 0.9 + 0.1;\n float radius = 0.3 * circleScale * tapScale;\n float inner = inside(radius - 0.2 * radius);\n #if defined(USE_BORDER)\n float borderDist = clamp(borderWidth, 0.0, 1.0);\n inner = inside(radius - borderDist * radius);\n #endif\n return vec4(baseColor, gradient * tapOpacity * loadingOpacity * inner * outside(radius));\n}\n\nvec4 create_progress() {\n float angle = PI + atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n float bar = (1.0 - step(progress * TAU, angle)) * 0.7;\n float radius = 0.3 * circleScale * tapScale;\n float inner = inside(radius - 0.2 * radius);\n #if defined(USE_BORDER)\n float borderDist = clamp(borderWidth, 0.0, 1.0);\n inner = inside(radius - borderDist * radius);\n #endif\n return vec4(baseColor, bar * tapOpacity * progressOpacity * inner * outside(radius));\n}\n\nvec4 create_expand0() {\n float width = 0.2;\n float radius = 0.25 + (0.5 - 0.25) * expand0;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand0 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(baseColor, gradient * expandOpacity * outside(radius));\n}\n\nvec4 create_expand1() {\n float width = 0.2;\n float radius = 0.25 + (0.48 - 0.25) * expand1;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand1 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(baseColor, gradient * expandOpacity * outside(radius));\n}\n\nvoid main() {\n gl_FragColor = vec4(baseColor, 0);\n\n vec4 expand1Color = create_expand1();\n gl_FragColor = mix(gl_FragColor, expand1Color, expand1Color.a);\n\n vec4 expand0Color = create_expand0();\n gl_FragColor = mix(gl_FragColor, expand0Color, expand0Color.a);\n\n vec4 circleColor = create_circle();\n gl_FragColor = mix(gl_FragColor, circleColor, circleColor.a);\n\n vec4 progressColor = create_progress();\n gl_FragColor = mix(gl_FragColor, progressColor, progressColor.a);\n\n vec4 loadingColor = create_loading();\n gl_FragColor = mix(gl_FragColor, loadingColor, loadingColor.a);\n\n gl_FragColor = mix(gl_FragColor, create_disable(), disable);\n\n gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);\n}\n",defines:{USE_COLOR:v,USE_MAP:void 0!==d,USE_BORDER:A>0,USE_REVERSE:m},uniforms:{baseColor:{value:new e.Color(h)},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:A},borderColor:{value:new e.Color(g)}}})),c.renderOrder=-2,c.panoMesh.renderOrder=-2,c.panoMesh.position.y=.004,c.panoMesh.scale.set(p,1,p),c.add(c.panoMesh),c.currentStartTime=ue(),c.needsRender=!0,c}return Z(r,t),r.prototype.setProgress=function(e){var t=this;this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=Or(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},500).catch(se),0===e?this.progressOpacityMotion.set({opacity:0},500).catch(se).then((function(){t.progressMotion.set({progress:0},0).catch(se)})):this.progressMotion.set({progress:Or(1.2*e,0,1)},100).catch(se)),this.progress=e)},r.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Or(e,0,1),this.opacityMotion.set({opacity:e},200).catch(se))},r.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(se),this.current=e,!0===this.current&&(this.currentStartTime=ue()))},r.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(se))},r.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(se))},r.prototype.tap=function(){var e=this;return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(se),this.progressMotion.set({progress:0},0).catch(se),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((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(se),e.progressMotion.set({progress:e.progress},120).catch(se)})).catch(se)):Promise.resolve()},r.prototype.updateTime=function(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);var r=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=r,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var n=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=n,this.needsRender=!0}if(this.opacityMotion.ended||(this.opacityMotion.update(e),n=this.opacityMotion.value.opacity,this.panoMesh.material.uniforms.opacity.value=n,this.needsRender=!0),this.visible=0!==this.opacityMotion.value.opacity,(!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%(2*Math.PI),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;var i=(e-this.currentStartTime-1500)/2e3;if(i%5<2){var o=i%1;this.panoMesh.material.uniforms.expand0.value=Ro(o)*this.currentMotion.value.progress,this.needsRender=!0}var a=(e-this.currentStartTime-1e3)/2e3;a%5<2&&(o=a%1,this.panoMesh.material.uniforms.expand1.value=Ro(o)*this.currentMotion.value.progress,this.needsRender=!0)}this.disableMotion.ended||(r=this.disableMotion.value.progress,this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=r,this.needsRender=!0)},r.prototype.dispose=function(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()},r}(e.Object3D),Do=new e.CircleBufferGeometry(.1,16),Lo=new e.ShaderMaterial({vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nvarying vec2 vUv;\n\nfloat smoothDist = 0.01;\nvoid main() {\n vec2 center = vec2(0.5, 0.5);\n float dist = length(center - vUv);\n float outerDist = 0.49;\n float innerDist = 0.29;\n\n float outside = 1.0 - smoothstep(outerDist - smoothDist, outerDist, dist);\n float inside = smoothstep(innerDist, innerDist + smoothDist, dist);\n\n vec4 bg = vec4(0.576, 0.635, 1.0, 0.3);\n float gradientAlpha = clamp(abs(dist - (outerDist + innerDist) / 2.0) / (outerDist - innerDist) * 1.5 + 0.1, 0.0, 1.0);\n vec4 gradient = vec4(1.0, 1.0, 1.0, gradientAlpha);\n\n gl_FragColor = mix(bg, gradient, gradient.a);\n\n gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * outside * inside);\n}\n",transparent:!0}),Fo=function(t){function r(){var r=t.call(this)||this;return r.ringMesh=new e.Mesh(Do,Lo),r.ringMesh.renderOrder=-2,r.add(r.ringMesh),r}return Z(r,t),r.prototype.dispose=function(){this.remove(this.ringMesh)},r}(e.Object3D);function Qo(e,t,r){var n=Math.abs(e-t);return n<.001||void 0!==r&&Math.abs(r-n)<.001}function No(e,t,r){return!Qo(e,t,r)}function Vo(e,t){return e.distanceTo(t)<.001}function Uo(e,t){return!Vo(e,t)}var zo=new e.Vector3(0,0,0),_o=function(t){function r(r,n){void 0===n&&(n=zo);var i=t.call(this)||this,o=new e.BoxBufferGeometry(r.max.x-r.min.x+2*n.x,r.max.y-r.min.y+2*n.y,r.max.z-r.min.z+2*n.z,1,1);o.groups.length=0,o.groups.push({start:0,count:36,materialIndex:0}),o.applyMatrix4((new e.Matrix4).makeScale(-1,1,1)),o.computeVertexNormals();var a=new Nt;a.defines.USE_MAP=!1,a.defines.USE_UV=!1,a.defines.USE_PANO_OPACITY=!0,a.uniforms.diffuse.value=new e.Color(10066329),a.depthWrite=!1;var s=new tt(o,[a]);return s.position.copy(r.getCenter(new e.Vector3)),s.frustumCulled=!1,i.add(s),i.boundingBox=new e.Box3,i.boundingBox.setFromObject(i),i.renderOrder=s.renderOrder=-1001,i}return Z(r,t),r}(st),qo=2*Math.PI;function Ho(e){return e>=0&&e<qo?e:(e%qo+qo)%qo}var jo=Math.PI,Go=2*jo;function Ko(e,t,r){if(e===t)return t;var n=t-e;return Math.abs(n)<=r?t:e+(n>0?1:-1)*r}function Wo(e,t,r){if(e.longitude===t.longitude&&e.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};var n=Ho(e.longitude),i=e.latitude,o=Ho(t.longitude),a=t.latitude;o-n>jo?n+=Go:n-o>jo&&(n-=Go);var s=r/Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));return s>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:n+(o-n)*s,latitude:i+(a-i)*s}}(function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}})(),"undefined"!=typeof history&&"pushState"in history&&"replaceState"in history&&history;var Yo=function(){var e="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"node";return/android/i.test(e)||/webos/i.test(e)||/ipad|iphone|ipod/i.test(e)||/iemobile/i.test(e)||/opera mini/i.test(e)||/blackberry/i.test(e)||/windows phone/i.test(e)};function Xo(e,t){for(var r=!1,n={type:e,timeStamp:ue(),get defaultPrevented(){return r},preventDefault:function(){r=!0}},i=0,o=Object.keys(t);i<o.length;i++){var a=o[i];a in n||(n[a]=t[a])}return n}function Jo(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 Zo(e,t){return e.workCode===t.workCode&&e.mode===t.mode&&e.panoIndex===t.panoIndex&&Qo(e.longitude,t.longitude,2*Math.PI)&&Qo(e.latitude,t.latitude)&&Qo(e.fov,t.fov)&&Vo(e.offset,t.offset)&&Qo(e.distance,t.distance)}var $o=function(e){return Number(e)};function ea(e,t,r){var n;void 0===t&&(t=$o),void 0===r&&(r=!1);for(var i,o=1/0,a=0,s=e;a<s.length;a++){var l=s[a],u=t(l);u<=o&&(i=(n=[l,u])[0],o=n[1])}return isFinite(o)||(o=0),r?[i,o]:i}function ta(e){for(var t in e)return!1;return!0}function ra(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}var na=function(e,t,r,n){var i,o=["","webkit","Moz","MS","ms","o"],a=t.createElement?t.createElement("div"):n,s="function",l=Math.round,u=Math.abs,c=Date.now;function h(e,t,r){return setTimeout(g(e,r),t)}function p(e,t,r){return!!Array.isArray(e)&&(d(e,r[t],r),!0)}function d(e,t,r){var i;if(e)if(e.forEach)e.forEach(t,r);else if(e.length!==n)for(i=0;i<e.length;)t.call(r,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(r,e[i],i,e)}function f(t,r,n){var i="DEPRECATED METHOD: "+r+"\n"+n+" AT \n";return function(){var r=new Error("get-stack-trace"),n=r&&r.stack?r.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,i,n),t.apply(this,arguments)}}i="function"!=typeof Object.assign?function(e){if(e===n||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;r<arguments.length;r++){var i=arguments[r];if(i!==n&&null!==i)for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])}return t}:Object.assign;var v=f((function(e,t,r){for(var i=Object.keys(t),o=0;o<i.length;)(!r||r&&e[i[o]]===n)&&(e[i[o]]=t[i[o]]),o++;return e}),"extend","Use `assign`."),m=f((function(e,t){return v(e,t,!0)}),"merge","Use `assign`.");function A(e,t,r){var n,o=t.prototype;(n=e.prototype=Object.create(o)).constructor=e,n._super=o,r&&i(n,r)}function g(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return typeof e==s?e.apply(t&&t[0]||n,t):e}function b(e,t){return e===n?t:e}function x(e,t,r){d(C(t),(function(t){e.addEventListener(t,r,!1)}))}function w(e,t,r){d(C(t),(function(t){e.removeEventListener(t,r,!1)}))}function M(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function E(e,t){return e.indexOf(t)>-1}function C(e){return e.trim().split(/\s+/g)}function S(e,t,r){if(e.indexOf&&!r)return e.indexOf(t);for(var n=0;n<e.length;){if(r&&e[n][r]==t||!r&&e[n]===t)return n;n++}return-1}function I(e){return Array.prototype.slice.call(e,0)}function P(e,t,r){for(var n=[],i=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];S(i,a)<0&&n.push(e[o]),i[o]=a,o++}return r&&(n=t?n.sort((function(e,r){return e[t]>r[t]})):n.sort()),n}function T(e,t){for(var r,i,a=t[0].toUpperCase()+t.slice(1),s=0;s<o.length;){if((i=(r=o[s])?r+a:t)in e)return i;s++}return n}var B=1;function R(t){var r=t.ownerDocument||t;return r.defaultView||r.parentWindow||e}var O="ontouchstart"in e,k=T(e,"PointerEvent")!==n,D=O&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),L="touch",F="mouse",Q=25,N=1,V=2,U=4,z=8,_=1,q=2,H=4,j=8,G=16,K=q|H,W=j|G,Y=K|W,X=["x","y"],J=["clientX","clientY"];function Z(e,t){var r=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])&&r.handler(t)},this.init()}function $(e,t,r){var i=r.pointers.length,o=r.changedPointers.length,a=t&N&&i-o==0,s=t&(U|z)&&i-o==0;r.isFirst=!!a,r.isFinal=!!s,a&&(e.session={}),r.eventType=t,function(e,t){var r=e.session,i=t.pointers,o=i.length;r.firstInput||(r.firstInput=ee(t)),o>1&&!r.firstMultiple?r.firstMultiple=ee(t):1===o&&(r.firstMultiple=!1);var a=r.firstInput,s=r.firstMultiple,l=s?s.center:a.center,h=t.center=te(i);t.timeStamp=c(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=oe(l,h),t.distance=ie(l,h),function(e,t){var r=t.center,n=e.offsetDelta||{},i=e.prevDelta||{},o=e.prevInput||{};t.eventType!==N&&o.eventType!==U||(i=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},n=e.offsetDelta={x:r.x,y:r.y}),t.deltaX=i.x+(r.x-n.x),t.deltaY=i.y+(r.y-n.y)}(r,t),t.offsetDirection=ne(t.deltaX,t.deltaY);var p=re(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=p.x,t.overallVelocityY=p.y,t.overallVelocity=u(p.x)>u(p.y)?p.x:p.y,t.scale=s?function(e,t){return ie(t[0],t[1],J)/ie(e[0],e[1],J)}(s.pointers,i):1,t.rotation=s?function(e,t){return oe(t[1],t[0],J)+oe(e[1],e[0],J)}(s.pointers,i):0,t.maxPointers=r.prevInput?t.pointers.length>r.prevInput.maxPointers?t.pointers.length:r.prevInput.maxPointers:t.pointers.length,function(e,t){var r,i,o,a,s=e.lastInterval||t,l=t.timeStamp-s.timeStamp;if(t.eventType!=z&&(l>Q||s.velocity===n)){var c=t.deltaX-s.deltaX,h=t.deltaY-s.deltaY,p=re(l,c,h);i=p.x,o=p.y,r=u(p.x)>u(p.y)?p.x:p.y,a=ne(c,h),e.lastInterval=t}else r=s.velocity,i=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=r,t.velocityX=i,t.velocityY=o,t.direction=a}(r,t);var d=e.element;M(t.srcEvent.target,d)&&(d=t.srcEvent.target),t.target=d}(e,r),e.emit("hammer.input",r),e.recognize(r),e.session.prevInput=r}function ee(e){for(var t=[],r=0;r<e.pointers.length;)t[r]={clientX:l(e.pointers[r].clientX),clientY:l(e.pointers[r].clientY)},r++;return{timeStamp:c(),pointers:t,center:te(t),deltaX:e.deltaX,deltaY:e.deltaY}}function te(e){var t=e.length;if(1===t)return{x:l(e[0].clientX),y:l(e[0].clientY)};for(var r=0,n=0,i=0;i<t;)r+=e[i].clientX,n+=e[i].clientY,i++;return{x:l(r/t),y:l(n/t)}}function re(e,t,r){return{x:t/e||0,y:r/e||0}}function ne(e,t){return e===t?_:u(e)>=u(t)?e<0?q:H:t<0?j:G}function ie(e,t,r){r||(r=X);var n=t[r[0]]-e[r[0]],i=t[r[1]]-e[r[1]];return Math.sqrt(n*n+i*i)}function oe(e,t,r){r||(r=X);var n=t[r[0]]-e[r[0]],i=t[r[1]]-e[r[1]];return 180*Math.atan2(i,n)/Math.PI}Z.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(R(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(R(this.element),this.evWin,this.domHandler)}};var ae={mousedown:N,mousemove:V,mouseup:U},se="mousedown",le="mousemove mouseup";function ue(){this.evEl=se,this.evWin=le,this.pressed=!1,Z.apply(this,arguments)}A(ue,Z,{handler:function(e){var t=ae[e.type];t&N&&(0===e.button||2===e.button)&&(this.pressed=!0),t&V&&1!==e.which&&(t=U),this.pressed&&(t&U&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:F,srcEvent:e}))}});var ce={pointerdown:N,pointermove:V,pointerup:U,pointercancel:z,pointerout:z},he={2:L,3:"pen",4:F,5:"kinect"},pe="pointerdown",de="pointermove pointerup pointercancel";function fe(){this.evEl=pe,this.evWin=de,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(pe="MSPointerDown",de="MSPointerMove MSPointerUp MSPointerCancel"),A(fe,Z,{handler:function(e){var t=this.store,r=!1,n=!1,i=e.type.toLowerCase().replace("ms",""),o=ce[i],a=he[e.pointerType]||e.pointerType,s=a==L,l=S(t,e.pointerId,"pointerId");o&N&&(0===e.button||2===e.button||s)?l<0&&(t.push(e),l=t.length-1):o&(U|z)?r=!0:s||0!==e.buttons||(r=!0,n=!0,o=ce.pointerup),l<0||(n||(t[l]=e),this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:t[l]}),r&&t.splice(l,1))}});var ve={touchstart:N,touchmove:V,touchend:U,touchcancel:z};function me(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Z.apply(this,arguments)}function Ae(e,t){var r=I(e.touches),n=I(e.changedTouches);return t&(U|z)&&(r=P(r.concat(n),"identifier",!0)),[r,n]}A(me,Z,{handler:function(e){var t=ve[e.type];if(t===N&&(this.started=!0),this.started){var r=Ae.call(this,e,t);t&(U|z)&&r[0].length-r[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:r[0],changedPointers:r[1],pointerType:L,srcEvent:e})}}});var ge={touchstart:N,touchmove:V,touchend:U,touchcancel:z},ye="touchstart touchmove touchend touchcancel";function be(){this.evTarget=ye,this.targetIds={},Z.apply(this,arguments)}function xe(e,t){var r=I(e.touches),n=this.targetIds;if(t&(N|V)&&1===r.length)return n[r[0].identifier]=!0,[r,r];var i,o,a=I(e.changedTouches),s=[],l=this.target;if(o=r.filter((function(e){return M(e.target,l)})),t===N)for(i=0;i<o.length;)n[o[i].identifier]=!0,i++;for(i=0;i<a.length;)n[a[i].identifier]&&s.push(a[i]),t&(U|z)&&delete n[a[i].identifier],i++;return s.length?[P(o.concat(s),"identifier",!0),s]:void 0}A(be,Z,{handler:function(e){var t=ge[e.type],r=xe.call(this,e,t);r&&this.callback(this.manager,t,{pointers:r[0],changedPointers:r[1],pointerType:L,srcEvent:e})}});var we=2500;function Me(){Z.apply(this,arguments);var e=g(this.handler,this);this.touch=new be(this.manager,e),this.mouse=new ue(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function Ee(e,t){e&N?(this.primaryTouch=t.changedPointers[0].identifier,Ce.call(this,t)):e&(U|z)&&Ce.call(this,t)}function Ce(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var r={x:t.clientX,y:t.clientY};this.lastTouches.push(r);var n=this.lastTouches;setTimeout((function(){var e=n.indexOf(r);e>-1&&n.splice(e,1)}),we)}}function Se(e){for(var t=e.srcEvent.clientX,r=e.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var i=this.lastTouches[n],o=Math.abs(t-i.x),a=Math.abs(r-i.y);if(o<=25&&a<=25)return!0}return!1}A(Me,Z,{handler:function(e,t,r){var n=r.pointerType==L,i=r.pointerType==F;if(!(i&&r.sourceCapabilities&&r.sourceCapabilities.firesTouchEvents)){if(n)Ee.call(this,t,r);else if(i&&Se.call(this,r))return;this.callback(e,t,r)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Ie=a?T(a.style,"touchAction"):n,Pe=Ie!==n,Te="compute",Be="auto",Re="manipulation",Oe="none",ke="pan-x",De="pan-y",Le=function(){if(!Pe)return!1;var t={},r=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(n){t[n]=!r||e.CSS.supports("touch-action",n)})),t}();function Fe(e,t){this.manager=e,this.set(t)}Fe.prototype={set:function(e){e==Te&&(e=this.compute()),Pe&&this.manager.element.style&&Le[e]&&(this.manager.element.style[Ie]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return d(this.manager.recognizers,(function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(E(e,Oe))return Oe;var t=E(e,ke),r=E(e,De);return t&&r?Oe:t||r?t?ke:De:E(e,Re)?Re:Be}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,r=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var n=this.actions,i=E(n,Oe)&&!Le[Oe],o=E(n,De)&&!Le[De],a=E(n,ke)&&!Le[ke];if(i){var s=1===e.pointers.length,l=e.distance<2,u=e.deltaTime<250;if(s&&l&&u)return}if(!a||!o)return i||o&&r&K||a&&r&W?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Qe=1,Ne=2,Ve=4,Ue=8,ze=Ue,_e=16,qe=32;function He(e){this.options=i({},this.defaults,e||{}),this.id=B++,this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=Qe,this.simultaneous={},this.requireFail=[]}function je(e){return e&_e?"cancel":e&Ue?"end":e&Ve?"move":e&Ne?"start":""}function Ge(e){return e==G?"down":e==j?"up":e==q?"left":e==H?"right":""}function Ke(e,t){var r=t.manager;return r?r.get(e):e}function We(){He.apply(this,arguments)}function Ye(){We.apply(this,arguments),this.pX=null,this.pY=null}function Xe(){We.apply(this,arguments)}function Je(){He.apply(this,arguments),this._timer=null,this._input=null}function Ze(){We.apply(this,arguments)}function $e(){We.apply(this,arguments)}function et(){He.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function tt(e,t){return(t=t||{}).recognizers=b(t.recognizers,tt.defaults.preset),new rt(e,t)}function rt(e,t){this.options=i({},tt.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new(this.options.inputClass||(k?fe:D?be:O?Me:ue))(this,$),this.touchAction=new Fe(this,this.options.touchAction),nt(this,!0),d(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)}function nt(e,t){var r,n=e.element;n.style&&(d(e.options.cssProps,(function(i,o){r=T(n.style,o),t?(e.oldCssProps[r]=n.style[r],n.style[r]=i):n.style[r]=e.oldCssProps[r]||""})),t||(e.oldCssProps={}))}return He.prototype={defaults:{},set:function(e){return i(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(p(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Ke(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return p(e,"dropRecognizeWith",this)||(e=Ke(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(p(e,"requireFailure",this))return this;var t=this.requireFail;return-1===S(t,e=Ke(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(p(e,"dropRequireFailure",this))return this;e=Ke(e,this);var t=S(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,r=this.state;function n(r){t.manager.emit(r,e)}r<Ue&&n(t.options.event+je(r)),n(t.options.event),e.additionalEvent&&n(e.additionalEvent),r>=Ue&&n(t.options.event+je(r))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=qe},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(qe|Qe)))return!1;e++}return!0},recognize:function(e){var t=i({},e);if(!y(this.options.enable,[this,t]))return this.reset(),void(this.state=qe);this.state&(ze|_e|qe)&&(this.state=Qe),this.state=this.process(t),this.state&(Ne|Ve|Ue|_e)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},A(We,He,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,r=e.eventType,n=t&(Ne|Ve),i=this.attrTest(e);return n&&(r&z||!i)?t|_e:n||i?r&U?t|Ue:t&Ne?t|Ve:Ne:qe}}),A(Ye,We,{defaults:{event:"pan",threshold:10,pointers:1,direction:Y},getTouchAction:function(){var e=this.options.direction,t=[];return e&K&&t.push(De),e&W&&t.push(ke),t},directionTest:function(e){var t=this.options,r=!0,n=e.distance,i=e.direction,o=e.deltaX,a=e.deltaY;return i&t.direction||(t.direction&K?(i=0===o?_:o<0?q:H,r=o!=this.pX,n=Math.abs(e.deltaX)):(i=0===a?_:a<0?j:G,r=a!=this.pY,n=Math.abs(e.deltaY))),e.direction=i,r&&n>t.threshold&&i&t.direction},attrTest:function(e){return We.prototype.attrTest.call(this,e)&&(this.state&Ne||!(this.state&Ne)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Ge(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),A(Xe,We,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Oe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&Ne)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),A(Je,He,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Be]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,n=e.distance<t.threshold,i=e.deltaTime>t.time;if(this._input=e,!n||!r||e.eventType&(U|z)&&!i)this.reset();else if(e.eventType&N)this.reset(),this._timer=h((function(){this.state=ze,this.tryEmit()}),t.time,this);else if(e.eventType&U)return ze;return qe},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===ze&&(e&&e.eventType&U?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}}),A(Ze,We,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Oe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&Ne)}}),A($e,We,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:K|W,pointers:1},getTouchAction:function(){return Ye.prototype.getTouchAction.call(this)},attrTest:function(e){var t,r=this.options.direction;return r&(K|W)?t=e.overallVelocity:r&K?t=e.overallVelocityX:r&W&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&r&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&u(t)>this.options.velocity&&e.eventType&U},emit:function(e){var t=Ge(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),A(et,He,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Re]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,n=e.distance<t.threshold,i=e.deltaTime<t.time;if(this.reset(),e.eventType&N&&0===this.count)return this.failTimeout();if(n&&i&&r){if(e.eventType!=U)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||ie(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e,0==this.count%t.taps)return this.hasRequireFailures()?(this._timer=h((function(){this.state=ze,this.tryEmit()}),t.interval,this),Ne):ze}return qe},failTimeout:function(){return this._timer=h((function(){this.state=qe}),this.options.interval,this),qe},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ze&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),tt.VERSION="2.0.7",tt.defaults={domEvents:!1,touchAction:Te,enable:!0,inputTarget:null,inputClass:null,preset:[[Ze,{enable:!1}],[Xe,{enable:!1},["rotate"]],[$e,{direction:K}],[Ye,{direction:K},["swipe"]],[et],[et,{event:"doubletap",taps:2},["tap"]],[Je]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},rt.prototype={set:function(e){return i(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?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var r;this.touchAction.preventDefaults(e);var n=this.recognizers,i=t.curRecognizer;(!i||i&&i.state&ze)&&(i=t.curRecognizer=null);for(var o=0;o<n.length;)r=n[o],2===t.stopped||i&&r!=i&&!r.canRecognizeWith(i)?r.reset():r.recognize(e),!i&&r.state&(Ne|Ve|Ue)&&(i=t.curRecognizer=r),o++}},get:function(e){if(e instanceof He)return e;for(var t=this.recognizers,r=0;r<t.length;r++)if(t[r].options.event==e)return t[r];return null},add:function(e){if(p(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(p(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,r=S(t,e);-1!==r&&(t.splice(r,1),this.touchAction.update())}return this},on:function(e,t){if(e!==n&&t!==n){var r=this.handlers;return d(C(e),(function(e){r[e]=r[e]||[],r[e].push(t)})),this}},off:function(e,t){if(e!==n){var r=this.handlers;return d(C(e),(function(e){t?r[e]&&r[e].splice(S(r[e],t),1):delete r[e]})),this}},emit:function(e,r){this.options.domEvents&&function(e,r){var n=t.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=r,r.target.dispatchEvent(n)}(e,r);var n=this.handlers[e]&&this.handlers[e].slice();if(n&&n.length){r.type=e,r.preventDefault=function(){r.srcEvent.preventDefault()};for(var i=0;i<n.length;)n[i](r),i++}},destroy:function(){this.element&&nt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},i(tt,{INPUT_START:N,INPUT_MOVE:V,INPUT_END:U,INPUT_CANCEL:z,STATE_POSSIBLE:Qe,STATE_BEGAN:Ne,STATE_CHANGED:Ve,STATE_ENDED:Ue,STATE_RECOGNIZED:ze,STATE_CANCELLED:_e,STATE_FAILED:qe,DIRECTION_NONE:_,DIRECTION_LEFT:q,DIRECTION_RIGHT:H,DIRECTION_UP:j,DIRECTION_DOWN:G,DIRECTION_HORIZONTAL:K,DIRECTION_VERTICAL:W,DIRECTION_ALL:Y,Manager:rt,Input:Z,TouchAction:Fe,TouchInput:be,MouseInput:ue,PointerEventInput:fe,TouchMouseInput:Me,SingleTouchInput:me,Recognizer:He,AttrRecognizer:We,Tap:et,Pan:Ye,Swipe:$e,Pinch:Xe,Rotate:Ze,Press:Je,on:x,off:w,each:d,merge:m,extend:v,assign:i,inherit:A,bindFn:g,prefixed:T}),tt}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{});const ia=na;function oa(t,r,n){var i=r.getBoundingClientRect(),o=i.top,a=i.left,s=i.width,l=i.height;return n&&(a+=s*n.left,o+=l*(1-n.bottom-n.height),s*=n.width,l*=n.height),new e.Vector2((t.x-a)/s*2-1,-(t.y-o)/l*2+1)}var aa,sa=function(t){function r(e){var n,i,o,a,s,l=this;l=t.call(this)||this;var u=r.parseArgs(e);return l.mode="",l.pending=new Set,l.userAction=u.initial.userAction,l.destroyed=!1,l.ident=u.ident,l.scene=u.scene,l.helper=u.helper,l.boundingMesh=u.boundingMesh,l.camera=u.camera,l.renderer=u.renderer,l.scissor=u.scissor,l.element=u.element,l.models=u.models,l.enableIOSEDR=null!==(n=u.enableIOSEDR)&&void 0!==n&&n,l.enableEDL=null===(i=u.enableEDL)||void 0===i||i,l.works=u.works,l.imageOptions=u.imageOptions,l.videoTexture=u.videoTexture,l.networkSubscribe=u.networkSubscribe,l.requestProxy=u.requestProxy,l.extraElements=u.extraElements,l.initial=u.initial,l.currentPano="number"==typeof l.initial.state.panoIndex?{workCode:null!==(s=null!==(o=l.initial.state.workCode)&&void 0!==o?o:null===(a=u.works[0])||void 0===a?void 0:a.workCode)&&void 0!==s?s:"",panoIndex:l.initial.state.panoIndex}:{workCode:l.initial.currentState.workCode,panoIndex:l.initial.currentState.panoIndex},l.needsRender=!0,l.cameraMotion=new Eo({longitude:{value:l.camera.pose.longitude,circle:[0,2*Math.PI]},latitude:l.camera.pose.latitude,fov:l.camera.pose.fov}),l.inMomentumMovement=null,l.eventUnbinds=[u.element].concat(u.extraElements||[]).map((function(e){return l.bindEvents(e)})),l.pending.add("init-animation"),Oe.shared.add((function(){l.initAnimation().then((function(){l.pending.delete("init-animation")}))}),!0),l}return Z(r,t),r.parseArgs=function(e){return e instanceof r?e:$({},e)},r.initAnimationEndState=function(e){var t,r,n,i,o,a,s,l,u=this.parseArgs(e),c=u.initial,h=c.state,p=c.currentState,d="number"==typeof h.panoIndex?{workCode:null!==(n=null!==(t=h.workCode)&&void 0!==t?t:null===(r=u.works[0])||void 0===r?void 0:r.workCode)&&void 0!==n?n:"",panoIndex:h.panoIndex}:{workCode:p.workCode,panoIndex:p.panoIndex};return $($({},d),{mode:"",longitude:null!==(i=h.longitude)&&void 0!==i?i:p.longitude,latitude:null!==(o=h.latitude)&&void 0!==o?o:p.latitude,fov:null!==(a=h.fov)&&void 0!==a?a:p.fov,offset:null!==(s=h.offset)&&void 0!==s?s:p.offset,distance:null!==(l=h.distance)&&void 0!==l?l:p.distance})},r.prototype.destroy=function(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var t=0,r=this.eventUnbinds;t<r.length;t++)(0,r[t])();this.copyEffect&&(this.copyEffect.dispose(),delete this.copyEffect),delete this.panState,null===(e=this.pressState)||void 0===e||e.stop(),delete this.pressState},r.prototype.isReady=function(){return null===this.inMomentumMovement&&0===this.pending.size&&!0===this.cameraMotion.ended},r.prototype.bindExtraElement=function(e){for(var t=0,r=this.eventUnbinds;t<r.length;t++)if(r[t].element===e)return;this.eventUnbinds.push(this.bindEvents(e))},r.prototype.unbindExtraElement=function(e){for(var t=[],r=0,n=this.eventUnbinds;r<n.length;r++){var i=n[r];i.element===e?i():t.push(i)}this.eventUnbinds=t},r.prototype.updateRenderSize=function(){this.needsRender=!0},r.prototype.updateModel=function(e){this.needsRender=!0},r.prototype.updateWork=function(e,t,r,n){return this.works=e,this.userAction=n,!1},r.prototype.updateTime=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!this.destroyed){var i={};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),ta(i)&&this.setCamera(i)}},r.prototype.render=function(){this.renderer.render(this.scene,this.camera)},r.prototype.postProcessing=function(e,t){this.destroyed},r.prototype.updateCamera=function(e,t,r){return this.userAction=r,this.cameraMotion.set(e,t).catch(se)},r.prototype.updateCameraWithKeyframes=function(e,t,r){return this.userAction=r,this.cameraMotion.setKeyframes(e,t)},r.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(ue())[1];return $($({},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})},r.prototype.initAnimation=function(){var e=this.initial,t=(e.state,e.currentState,e.duration,e.userAction),n=r.initAnimationEndState(this);return this.userAction=t,this.emit("initAnimation.start",Xo("initAnimation.start",{state:n,userAction:this.userAction})),this.emit("initAnimation.end",Xo("initAnimation.end",{state:n,userAction:this.userAction})),Promise.resolve()},r.prototype.setCamera=function(e){var t,r,n,i,o;void 0===e&&(e={});var a=null!==(t=e.longitude)&&void 0!==t?t:this.camera.pose.longitude,s=null!==(r=e.latitude)&&void 0!==r?r:this.camera.pose.latitude,l=null!==(n=e.fov)&&void 0!==n?n:this.camera.pose.fov,u=null!==(i=e.distance)&&void 0!==i?i:this.camera.pose.distance,c=null!==(o=e.offset)&&void 0!==o?o:this.camera.pose.offset,h=(this.camera.position.clone(),No(a,this.camera.pose.longitude,2*Math.PI)||No(s,this.camera.pose.latitude)),p=No(l,this.camera.pose.fov),d=No(u,this.camera.pose.distance),f=Uo(c,this.camera.pose.offset);(p||h||f||d)&&(this.emit("camera.update",Xo("camera.update",{userAction:this.userAction,state:$($({},this.currentPano),{mode:this.mode,longitude:a,latitude:s,fov:l,offset:c,distance:u})})),this.camera.setFromPose({longitude:a,latitude:s,fov:l,distance:u,offset:c}),this.needsRender=!0)},r.prototype.stopMomentumMovement=function(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){var e=Xo("gesture.momentum",$($({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit("gesture.momentum",e)}this.inMomentumMovement=null},r.prototype.onPanGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pan",e)},r.prototype.onTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.tap",e)},r.prototype.onPressGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.press",e)},r.prototype.onPinchGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pinch",e)},r.prototype.onMouseWheel=function(e){this.stopMomentumMovement(),this.emit("gesture.mousewheel",e)},r.prototype.onMouseMove=function(e){this.stopMomentumMovement(),this.emit("gesture.mousemove",e)},r.prototype.relativeClientPosition=function(e){return oa(e,this.element,this.scissor)},r.prototype.bindEvents=function(t){var r=this,n=function(e){var t=oa(e,r.element,r.scissor);return!(Math.abs(t.x)>1||Math.abs(t.y)>1)},i=new ia.Manager(t),o=function(e){return e.session.firstInput||null};i.add(new ia.Pan({threshold:10,pointers:0})),i.add(new ia.Tap({interval:410})),i.add(new ia.Pinch({threshold:0,pointers:2})),i.on("panstart pan",(function(t){var a=o(i);if(!a||n(a.center)){var s,l,u,c=Xo("gesture.pan",{target:t.target,pointerType:t.pointerType,srcEvent:t.srcEvent,pointers:t.pointers.map((function(t){var n=r.relativeClientPosition(t),i=new e.Raycaster;return i.setFromCamera(n,r.camera),{x:t.x,y:t.y,delta:0,buttons:0,coords:n,raycaster:i}})),isFirst:t.isFirst,isFinal:t.isFinal,scale:t.scale,center:(s=t.center,l=r.relativeClientPosition(s),u=new e.Raycaster,u.setFromCamera(l,r.camera),{x:s.x,y:s.y,delta:0,buttons:0,coords:l,raycaster:u}),velocityX:t.velocityX,velocityY:t.velocityY,overallVelocityX:t.overallVelocityX,overallVelocityY:t.overallVelocityY,userAction:!0,state:$($({mode:r.mode},r.currentPano),ra(r.camera.pose))});r.onPanGesture(c),v()}})),i.on("tap",(function(t){if("mouse"!==t.pointerType||0===t.srcEvent.button){var a=o(i);if(!a||n(a.center)){var s,l,u,c=Xo("gesture.tap",{target:t.target,pointerType:t.pointerType,srcEvent:t.srcEvent,pointers:t.pointers.map((function(t){var n=r.relativeClientPosition(t),i=new e.Raycaster;return i.setFromCamera(n,r.camera),{x:t.x,y:t.y,delta:0,buttons:0,coords:n,raycaster:i}})),isFirst:!0,isFinal:!0,scale:t.scale,center:(s=t.center,l=r.relativeClientPosition(s),u=new e.Raycaster,u.setFromCamera(l,r.camera),{x:s.x,y:s.y,delta:0,buttons:0,coords:l,raycaster:u}),velocityX:t.velocityX,velocityY:t.velocityY,overallVelocityX:t.overallVelocityX,overallVelocityY:t.overallVelocityY,userAction:!0,state:$($({mode:r.mode},r.currentPano),ra(r.camera.pose))});r.onTapGesture(c),v()}}})),i.on("pinchstart pinch pinchend",(function(t){var a=o(i);if(!a||n(a.center)){var s,l,u,c=Xo("gesture.pinch",{target:t.target,pointerType:t.pointerType,srcEvent:t.srcEvent,pointers:t.pointers.map((function(t){var n,i=r.relativeClientPosition(t),o=new e.Raycaster;return o.setFromCamera(i,r.camera),{x:t.x,y:t.y,delta:null!==(n=t.delta)&&void 0!==n?n:0,buttons:0,coords:i,raycaster:o}})),isFirst:"pinchstart"===t.type,isFinal:"pinchend"===t.type,scale:t.scale,center:(s=t.center,l=r.relativeClientPosition(s),u=new e.Raycaster,u.setFromCamera(l,r.camera),{x:s.x,y:s.y,delta:0,buttons:0,coords:l,raycaster:u}),velocityX:t.velocityX,velocityY:t.velocityY,overallVelocityX:t.overallVelocityX,overallVelocityY:t.overallVelocityY,userAction:!0,state:$($({mode:r.mode},r.currentPano),ra(r.camera.pose))});r.onPinchGesture(c),v()}}));var a=null,s=null,l=function(t,n,i){var o={x:i.clientX,y:i.clientY},a=r.relativeClientPosition(o),s=new e.Raycaster;s.setFromCamera(a,r.camera);var l=$($({},o),{coords:a,raycaster:s,buttons:i.buttons,delta:0}),u="pinchend"===t?n:n-i.deltaY/280;return Xo("gesture.pinch",{target:i.target,pointerType:"mouse",srcEvent:i,pointers:[$({},l)],isFirst:"pinchstart"===t,isFinal:"pinchend"===t,scale:Or(u,.1,10),center:$({},l),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:$($({mode:r.mode},r.currentPano),ra(r.camera.pose))})},u=function(t){var i,o={x:t.clientX,y:t.clientY};if(n(o)){if(t.preventDefault(),t.ctrlKey){var u=null!==(i=null==a?void 0:a.prevEvent.scale)&&void 0!==i?i:1,c=l(a?"pinch":"pinchstart",u,t);null===a?a={firstEvent:c,prevEvent:c}:a.prevEvent=c,r.onPinchGesture(c),null!==s&&window.clearTimeout(s),s=window.setTimeout((function(){var e;s=null;var n=null!==(e=null==a?void 0:a.prevEvent.scale)&&void 0!==e?e:1,i=l("pinchend",n,t);a=null,r.onPinchGesture(i)}),200)}else{var h=(Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX)/-60,p=void 0!==r.mouseWheelState,d={x:t.clientX,y:t.clientY},f=r.relativeClientPosition(d),m=new e.Raycaster;m.setFromCamera(f,r.camera);var A=$($({},d),{coords:f,raycaster:m,buttons:t.buttons,delta:h});c=Xo("gesture.mousewheel",{target:t.target,pointerType:"mouse",srcEvent:t,pointers:[$({},A)],isFirst:p,isFinal:!1,scale:0,center:$({},A),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:$($({mode:r.mode},r.currentPano),ra(r.camera.pose))}),r.onMouseWheel(c),r.mouseWheelState&&clearTimeout(r.mouseWheelState.timer),r.mouseWheelState={timer:setTimeout((function(){delete r.mouseWheelState;var e=Xo("gesture.mousewheel",{target:t.target,pointerType:"mouse",srcEvent:t,pointers:[$($({},A),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:$($({},A),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:$($({mode:r.mode},r.currentPano),ra(r.camera.pose))});r.onMouseWheel(e)}),100)}}v()}},c=function(t){if(!Yo())if(n({x:t.clientX,y:t.clientY})){var i=!1;r.mouseMoveState||(i=!0);var o={x:t.clientX,y:t.clientY},a=r.relativeClientPosition(o),s=new e.Raycaster;s.setFromCamera(a,r.camera);var l=$($({},o),{coords:a,raycaster:s,buttons:t.buttons,delta:0}),u=Xo("gesture.mousemove",{target:t.target,pointerType:"mouse",srcEvent:t,pointers:[$({},l)],isFirst:i,isFinal:!1,scale:0,center:$({},l),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:$($({mode:r.mode},r.currentPano),ra(r.camera.pose))});r.mouseMoveState||(r.mouseMoveState={timeStamp:ue(),event:u}),r.onMouseMove(u),r.pressState&&Math.abs(t.clientX-r.pressState.event.center.y)>10&&Math.abs(t.clientY-r.pressState.event.center.y)>10&&v()}else h()},h=function(){if(r.mouseMoveState){var e=Xo(r.mouseMoveState.event.type,$($({},r.mouseMoveState.event),{isFinal:!0}));r.onMouseMove(e)}v()},p=function(e){if(n(e.center)){var t=!1;r.pressState||(t=!0,r.pressState={event:e,timeStamp:ue(),stop:se});var i=ue()-r.pressState.timeStamp,o=Xo(r.pressState.event.type,$($({},r.pressState.event),{isFirst:t,isFinal:!1,center:$($({},r.pressState.event.center),{delta:i}),pointers:r.pressState.event.pointers.map((function(e){return $($({},e),{delta:i})}))}));r.onPressGesture(o),r.pressState&&(r.pressState.stop=Oe.shared.add((function(t){p(e)}),!0,1))}else v()},d=function(t){if(v(),!(t.touches.length>1||t.changedTouches.length<=0)){var n={x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY},i=r.relativeClientPosition(n),o=new e.Raycaster;o.setFromCamera(i,r.camera);var a=$($({},n),{coords:i,raycaster:o,buttons:0,delta:0}),s=Xo("gesture.press",{target:t.target,pointerType:"touch",srcEvent:t,pointers:[$({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:$($({mode:r.mode},r.currentPano),ra(r.camera.pose))});p(s)}},f=function(t){v();var n={x:t.clientX,y:t.clientY},i=r.relativeClientPosition(n),o=new e.Raycaster;o.setFromCamera(i,r.camera);var a=$($({},n),{coords:i,raycaster:o,buttons:t.buttons,delta:0}),s=Xo("gesture.press",{target:t.target,pointerType:"mouse",srcEvent:t,pointers:[$({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:$($({mode:r.mode},r.currentPano),ra(r.camera.pose))});p(s)},v=function(){var e;if(r.pressState){var t=ue()-r.pressState.timeStamp,n=Xo(r.pressState.event.type,$($({},r.pressState.event),{center:$($({},r.pressState.event.center),{delta:t}),isFirst:!1,isFinal:!0,pointers:r.pressState.event.pointers.map((function(e){return $($({},e),{delta:t})}))}));r.onPressGesture(n),null===(e=r.pressState)||void 0===e||e.stop(),delete r.pressState}},m=null,A=function(t){var n,i=!1,o=!1;switch(t.type){case"gesturestart":i=!0;break;case"gestureend":o=!0}var a={x:t.clientX,y:t.clientY},s=r.relativeClientPosition(a),l=new e.Raycaster;l.setFromCamera(s,r.camera);var u=$($({},a),{coords:s,raycaster:l,buttons:0,delta:0});return Xo("gesture.pinch",{target:t.target,pointerType:"mouse",srcEvent:t,pointers:[$({},u)],isFirst:i,isFinal:o,scale:null!==(n=t.scale)&&void 0!==n?n:1,center:$({},u),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:$($({mode:r.mode},r.currentPano),ra(r.camera.pose))})},g=function(e){if(e.preventDefault(),!Yo()){var t=A(e),i=(m={firstEvent:t}).firstEvent;i&&!n(i.center)||r.onPinchGesture(t)}},y=function(e){if(e.preventDefault(),!Yo()&&m){var t=A(e),i=m.firstEvent;i&&!n(i.center)||r.onPinchGesture(t)}},b=function(e){if(e.preventDefault(),!Yo()&&m){var t=A(e),i=m.firstEvent;m=null,i&&!n(i.center)||r.onPinchGesture(t)}},x=function(e){if(e&&"function"==typeof e.preventDefault&&e.currentTarget===t&&e.preventDefault(),"function"==typeof getSelection){var r=getSelection();r&&r.focusNode&&(r.removeAllRanges&&r.removeAllRanges(),r.empty&&r.empty())}};return t.addEventListener("wheel",u,{passive:!1}),t.addEventListener("mousemove",c,!1),t.addEventListener("mouseout",h,!1),t.addEventListener("touchstart",d,{passive:!0}),t.addEventListener("touchend",v,!1),t.addEventListener("touchcancel",v,!1),t.addEventListener("mousedown",f,!1),t.addEventListener("mouseup",v,!1),t.addEventListener("gesturestart",g,{passive:!1}),t.addEventListener("gesturechange",y,{passive:!1}),t.addEventListener("gestureend",b,{passive:!1}),t.addEventListener("touchstart",x,{passive:!1}),t.addEventListener("contextmenu",x,!1),Object.assign((function(){i.destroy(),t.removeEventListener("wheel",u,!1),t.removeEventListener("mousemove",c,!1),t.removeEventListener("mouseout",h,!1),t.removeEventListener("touchstart",d,!1),t.removeEventListener("touchend",v,!1),t.removeEventListener("touchcancel",v,!1),t.removeEventListener("mousedown",f,!1),t.removeEventListener("mouseup",v,!1),t.removeEventListener("gesturestart",g,!1),t.removeEventListener("gesturechange",y,!1),t.removeEventListener("gestureend",b,!1),t.removeEventListener("touchstart",x,!1),t.removeEventListener("contextmenu",x,!1)}),{element:t})},r.prototype.preloadPano=function(e,t){var r=this;void 0===t&&(t=se);var n=this.works.getResolvedObserver(e);if(!n)return Promise.resolve();var i=this.works[0].allowHosts;return Promise.all(["right","left","up","down","front","back"].map((function(t){var o=$({key:"pano.".concat(Ke(e),".").concat(t)},Yn(r.imageOptions,["size","format","quality","mappings"])),a=n.images[t];return Pe(r.imageOptions.transform?r.imageOptions.transform(a,o):Ne(a,o),{allowHosts:i,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe})}))).then((function(){return t(e),e}))},r}(ae),la=function(t){function r(e){var n,i=this,o=r.parseArgs(e);return(i=t.call(this,o)||this).mode="Floorplan",i.defaultLatitude=o.defaultLatitude,i.defaultFov=o.defaultFov,i.maxFov=o.maxFov,i.minFov=o.minFov,i.maxLatitude=o.maxLatitude,i.minLatitude=o.minLatitude,i.locationMotion=new Eo({x:i.camera.pose.offset.x,y:i.camera.pose.offset.y,z:i.camera.pose.offset.z,distance:i.camera.pose.distance,modelAlpha:null!==(n=i.models.getMaterial().modelAlpha)&&void 0!==n?n:0,perspToOrtho:i.camera.perspToOrtho.x,orthoDistance:i.camera.orthoDistance}),i.currentTapId=null,i.intersectMeshCreator=o.intersectMeshCreator,i.intersectMesh=i.intersectMeshCreator(),i.intersectMesh.name="intersect",i.intersectMesh.visible=!1,i.helper.add(i.intersectMesh),i}return Z(r,t),r.distanceFromModel=function(e,t,r){var n=e.bounding,i=Math.pow(Math.pow(n.max.x-n.min.x+1,2)+Math.pow(n.max.y-n.min.y+1,2)+Math.pow(n.max.z-n.min.z+1,2),.5),o=i/2/Math.tan(Math.PI*t/360);return r<1&&(o/=r),isNaN(o)?i:o},r.parseArgs=function(e){var n,i,o,a,s,l,u;if(e instanceof r)return e;var c=t.parseArgs.call(this,e);return $($({},c),{defaultLatitude:null!==(n=e.defaultLatitude)&&void 0!==n?n:Math.PI/4,defaultFov:null!==(i=e.defaultFov)&&void 0!==i?i:80,maxFov:null!==(o=e.maxFov)&&void 0!==o?o:120,minFov:null!==(a=e.minFov)&&void 0!==a?a:20,maxLatitude:null!==(s=e.maxLatitude)&&void 0!==s?s:+Math.PI/2,minLatitude:null!==(l=e.minLatitude)&&void 0!==l?l:-Math.PI/2,intersectMeshCreator:null!==(u=e.intersectMeshCreator)&&void 0!==u?u:function(){return new Fo}})},r.initAnimationEndState=function(t){var n,i,o,a,s,l,u=this.parseArgs(t),c=t.initial,h=c.state,p=c.currentState,d="number"==typeof h.panoIndex?{workCode:null!==(o=null!==(n=h.workCode)&&void 0!==n?n:null===(i=u.works[0])||void 0===i?void 0:i.workCode)&&void 0!==o?o:"",panoIndex:h.panoIndex}:{workCode:p.workCode,panoIndex:p.panoIndex};return $($({},d),{mode:"Floorplan",longitude:null!==(a=h.longitude)&&void 0!==a?a:p.longitude,latitude:Or(null!==(s=h.latitude)&&void 0!==s?s:"Floorplan"===p.mode?p.latitude:u.defaultLatitude,u.minLatitude,u.maxLatitude),fov:null!==(l=h.fov)&&void 0!==l?l:u.defaultFov,offset:t.models.bounding.getCenter(new e.Vector3),distance:r.distanceFromModel(u.models,u.defaultFov,u.camera.aspect)})},r.prototype.destroy=function(){t.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},r.prototype.isReady=function(){return!1!==this.locationMotion.ended&&t.prototype.isReady.call(this)},r.prototype.updateWork=function(e,t,r,n){return this.works=e,this.updateCamera(t,null!=r?r:0,n),!0},r.prototype.updateModel=function(n){t.prototype.updateModel.call(this,n);var i=n.bounding.getCenter(new e.Vector3),o=r.distanceFromModel(n,this.defaultFov,this.camera.aspect);this.locationMotion.set({x:i.x,y:i.y,z:i.z,distance:o},0).catch(se)},r.prototype.updateTime=function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(!this.destroyed){var o={},a={};this.locationMotion.ended||(this.locationMotion.update(t),o.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Or(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,a.distance=this.locationMotion.value.distance,a.offset=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(t),a.longitude=this.cameraMotion.value.longitude,a.latitude=this.cameraMotion.value.latitude,a.fov=this.cameraMotion.value.fov),ta(o)||this.models.setMaterial(o),ta(a)||this.setCamera(a)}},r.prototype.getTargetState=function(){var t=this.cameraMotion.getKeyFrameSegment(ue())[1],r=this.locationMotion.getKeyFrameSegment(ue())[1];return $($({},this.currentPano),{mode:this.mode,longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:new e.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},r.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(t){var n=e.initial,i=(n.state,n.currentState,n.duration),o=n.userAction;e.userAction=o;var a=r.initAnimationEndState(e),s=Yn(a,["longitude","latitude","fov"]),l={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance,modelAlpha:1,perspToOrtho:0,orthoDistance:a.distance};e.emit("initAnimation.start",Xo("initAnimation.start",{state:a,userAction:e.userAction})),e.cameraMotion.set(s,i).catch(se),e.locationMotion.set(l,i).then((function(){e.emit("initAnimation.end",Xo("initAnimation.end",{state:a,userAction:e.userAction}))}),(function(t){var r=$($($({},e.currentPano),{mode:e.mode}),ra(e.camera.pose));e.emit("initAnimation.end",Xo("initAnimation.end",{state:r,userAction:e.userAction}))})).then((function(){t()}))}))},r.prototype.updateRenderSize=function(){this.locationMotion.set({distance:r.distanceFromModel(this.models,this.defaultFov,this.camera.aspect)},0).catch(se)},r.prototype.getForwardObserverOrNot=function(e){var t=this.models.intersectRaycaster(e)[0];if(!t)return null;var r=ea(this.works.resolvedObservers,(function(e){return e.standingPosition.distanceTo(t.point)}),!0),n=r[0],i=r[1];return n&&i<10?n:null},r.prototype.coordinatesForOffset=function(t){var r=this.renderer.getSize(new e.Vector2);return{longitude:2*t.x/(r.x*this.scissor.width),latitude:2*t.y/(r.y*this.scissor.height)}},r.prototype.requestMomentumMovement=function(e,t,r,n){var i=this;if(null!==this.inMomentumMovement){for(var o=$({},r),a={longitude:0,latitude:0},s=0;s<n;s++)o.longitude*=.996,o.latitude*=.994008,a.longitude+=o.longitude,a.latitude+=o.latitude;var l=Ho(this.cameraMotion.value.longitude+a.longitude),u=Or(this.cameraMotion.value.latitude+a.latitude,this.minLatitude,this.maxLatitude),c=$($({},this.currentPano),{mode:this.mode,longitude:l,latitude:u,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),h=!(o.longitude>1e-4||o.longitude<-1e-4||o.latitude>1e-4||o.latitude<-1e-4),p=Xo("gesture.momentum",$($({},e),{isFirst:t,isFinal:h,state:c}));this.inMomentumMovement.event=p,this.emit("gesture.momentum",p),e.defaultPrevented?this.inMomentumMovement=null:this.inMomentumMovement&&(this.cameraMotion.set({longitude:l,latitude:u},0).catch(se),h?this.inMomentumMovement=null:Oe.shared.add((function(t,r){i.requestMomentumMovement(e,!1,o,0|r)}),!0,1))}},r.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var t=this.panState,r=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:r,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===r){var n={x:e.center.x-t.x,y:e.center.y-t.y},i=this.relativeClientPosition(e.center),o=this.camera.pose.latitude<Math.PI/6||i.y<0?-1:1;n.x*=o;var a=this.coordinatesForOffset(n),s=Ho(this.cameraMotion.value.longitude+a.longitude),l=Or(this.cameraMotion.value.latitude+a.latitude,this.minLatitude,this.maxLatitude);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);var u=$($({},this.currentPano),{mode:this.mode,longitude:s,latitude:l,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=u,this.emit("gesture.pan",e),!e.defaultPrevented&&(this.cameraMotion.set({longitude:u.longitude,latitude:u.latitude},0).catch(se),e.isFinal)){var c=e.velocityX*o,h=e.velocityY;this.inMomentumMovement={uuid:ki()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:c,y:h}),0)}}},r.prototype.onPinchGesture=function(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();var r=null===(t=this.pinchState)||void 0===t?void 0:t.fov;if("pinchstart"!==e.type){if("pinchend"===e.type&&(delete this.panState,delete this.pinchState),void 0!==r){var n=Or(r/e.scale,this.minFov,this.maxFov);e.state.fov=n,this.emit("gesture.pinch",e),e.defaultPrevented||(this.cameraMotion.set({fov:n},0).catch(se),this.onPanGesture(e))}}else this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov}},r.prototype.onMouseMove=function(t){var r,n;if(this.intersectMesh.parent&&!this.panState)if(this.emit("gesture.mousemove",t),t.defaultPrevented)this.hideIntersectMesh();else{var i=t.center.raycaster;if(t.isFinal&&this.intersectMesh.parent&&!0===this.intersectMesh.visible)this.hideIntersectMesh();else{var o=this.models.intersectRaycaster(i)[0],a=Xo("intersect.update",{raycaster:i,intersection:null!=o?o:null,object:this.intersectMesh});if(this.emit("intersect.update",a),a.defaultPrevented)this.hideIntersectMesh();else if(o){var s=null!==(n=null===(r=o.face)||void 0===r?void 0:r.normal)&&void 0!==n?n:(new e.Vector3).copy(i.ray.direction).multiplyScalar(-1),l=s.clone().multiplyScalar(.05),u=o.point.clone().add(l);this.intersectMesh.position.copy(u);var c=u.clone().add(l);if(this.intersectMesh.lookAt(c),Math.abs(s.y)>.99){var h=this.camera.position.clone().sub(u);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}}},r.prototype.onMouseWheel=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var t=this.minFov,r=this.maxFov,n=Or(this.camera.fov-e.center.delta,t,r);e.state.fov=n,this.emit("gesture.mousewheel",e),e.defaultPrevented||this.cameraMotion.set({fov:n},0).catch(se)},r.prototype.onTapGesture=function(t){var r=this;this.userAction=!0,this.stopMomentumMovement();var n=t.center.raycaster,i=this.getForwardObserverOrNot(n);if(i){var o={longitude:this.camera.pose.longitude,latitude:0},a=$($({},t.state),{mode:"Panorama",workCode:i.pano.workCode,panoIndex:i.pano.panoIndex,longitude:o.longitude,latitude:o.latitude,offset:i?i.position.clone():new e.Vector3,distance:0});if(t.state=a,this.emit("gesture.tap",t),!t.defaultPrevented&&(this.emit("pano.select",Xo("pano.select",{prevPano:this.currentPano,state:a,userAction:t.userAction,options:o,progress:0,error:null})),i&&i.active)){var s=this.currentTapId=ki();this.preloadPano(i.pano).then((function(e){r.currentTapId===s&&r.emit("pano.request",Xo("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:a,options:o,error:null}))}))}}else this.emit("gesture.tap",t)},r.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},r}(sa),ua=0,ca=Math.PI/2,ha=0,pa=0,da=Math.PI/2,fa=0,va=Math.PI,ma=0,Aa=1.5*Math.PI,ga=0,ya=function(t){function r(e){var n=this,i=r.parseArgs(e);return(n=t.call(this,i)||this).mode="Topview",n}return Z(r,t),r.parseArgs=function(e){if(e instanceof r)return e;var n=$($({},e.initial),{state:$($({},e.initial.state),{longitude:0,latitude:Math.PI/2})}),i=$($({},e),{initial:n,maxLatitude:Math.PI/2,minLatitude:Math.PI/2,defaultLongitude:0,defaultLatitude:Math.PI/2});return t.parseArgs.call(this,i)},r.initAnimationEndState=function(e){var r=this.parseArgs(e),n=t.initAnimationEndState.call(this,r);return $($({},n),{mode:"Topview"})},r.prototype.updateModel=function(t){this.needsRender=!0;var r=this.models.bounding.getCenter(new e.Vector3);this.locationMotion.set({x:r.x,y:r.y,z:r.z,distance:la.distanceFromModel(this.models,this.defaultFov,this.camera.aspect)},0).catch(se)},r.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(t){var n=e.initial,i=(n.state,n.currentState,n.duration),o=n.userAction;e.userAction=o;var a=r.initAnimationEndState(e),s={longitude:a.longitude,latitude:a.latitude,fov:a.fov},l={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance,modelAlpha:1,perspToOrtho:1,orthoDistance:a.distance};e.emit("initAnimation.start",Xo("initAnimation.start",{state:a,userAction:e.userAction})),e.cameraMotion.set(s,i).catch(se),e.locationMotion.set(l,i).then((function(){e.emit("initAnimation.end",Xo("initAnimation.end",{state:a,userAction:e.userAction}))}),(function(t){var r=$($($({},e.currentPano),{mode:e.mode}),ra(e.camera.pose));e.emit("initAnimation.end",Xo("initAnimation.end",{state:r,userAction:e.userAction}))})).then((function(){t()}))}))},r.prototype.getZoomOffsetFromFov=function(t,r,n){var i=this.camera.getDirection(new e.Vector3),o=Math.tan(n/2*Math.PI/180),a=Math.tan(r.fov/2*Math.PI/180),s=(a-o)/a,l=new e.Raycaster;l.setFromCamera(t,r);var u=l.ray.direction,c=u.angleTo(i),h=la.distanceFromModel(this.models,this.defaultFov,this.camera.aspect),p=h*Math.tan(c),d=u.clone().setLength(h*Math.cos(c)).projectOnPlane(i),f=d.length(),v=s/f*d.x*p,m=s/f*d.z*p,A=s/f*d.y*p;return new e.Vector3(v,A,m)},r.prototype.requestMomentumMovement=function(){this.inMomentumMovement=null},r.prototype.onPanGesture=function(t){this.userAction=t.userAction,this.stopMomentumMovement();var r=this.panState,n=t.pointers.length;if(t.isFinal?delete this.panState:this.panState={pointerLength:n,x:t.center.x,y:t.center.y},void 0!==r&&r.pointerLength===n){var i=t.center.x-r.x,o=t.center.y-r.y,a=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),s=this.models.bounding,l=s.getCenter(new e.Vector3),u=(s.max.x-s.min.x)/this.defaultFov*this.cameraMotion.value.fov,c=(s.max.y-s.min.y)/this.defaultFov*this.cameraMotion.value.fov,h=(s.max.z-s.min.z)/this.defaultFov*this.cameraMotion.value.fov,p={left:new e.Vector3,up:new e.Vector3,cameraDirection:"y"};this.cameraMotion.value.longitude===ua&&this.cameraMotion.value.latitude===ca?(p.left.set(1,0,0),p.up.set(0,0,-1),p.cameraDirection="y"):this.cameraMotion.value.longitude===ha&&this.cameraMotion.value.latitude===pa?(p.left.set(1,0,0),p.up.set(0,1,0),p.cameraDirection="z"):this.cameraMotion.value.longitude===va&&this.cameraMotion.value.latitude===ma?(p.left.set(1,0,0),p.up.set(0,-1,0),p.cameraDirection="z"):this.cameraMotion.value.longitude===Aa&&this.cameraMotion.value.latitude===ga?(p.left.set(0,0,-1),p.up.set(0,-1,0),p.cameraDirection="x"):this.cameraMotion.value.longitude===da&&this.cameraMotion.value.latitude===fa&&(p.left.set(0,0,-1),p.up.set(0,1,0),p.cameraDirection="x");var d=(this.camera.position[p.cameraDirection]-s.min[p.cameraDirection])*Math.tan(this.camera.fov/2*Math.PI/180),f=this.renderer.getSize(new e.Vector2);a.add(function(t,r){var n=(new e.Vector3).copy(r);return n.multiplyScalar(-t),n}(2*i*d/f.y,p.left)),a.add(function(t,r){var n=(new e.Vector3).copy(r);return n.multiplyScalar(t),n}(2*o*d/f.y,p.up)),a.x=Or(a.x,l.x-u,l.x+u),a.y=Or(a.y,l.y-c,l.y+c),a.z=Or(a.z,l.z-h,l.z+h);var v=$($({},this.currentPano),{mode:this.mode,longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:a,distance:this.locationMotion.value.distance});t.state=v,this.emit("gesture.pan",t),t.defaultPrevented||this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(se)}},r.prototype.onPinchGesture=function(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();var r=null===(t=this.pinchState)||void 0===t?void 0:t.fov;if("pinchstart"!==e.type){if("pinchend"===e.type&&delete this.pinchState,void 0!==r){var n=Or(r/e.scale,this.minFov,this.maxFov),i=this.relativeClientPosition({x:e.center.x,y:e.center.y}),o=this.getZoomOffsetFromFov(i,this.camera,n);this.cameraMotion.value.longitude===ua&&this.cameraMotion.value.latitude===ca?o.y=0:this.cameraMotion.value.longitude===ha&&this.cameraMotion.value.latitude===pa||this.cameraMotion.value.longitude===va&&this.cameraMotion.value.latitude===ma?o.z=0:(this.cameraMotion.value.longitude===Aa&&this.cameraMotion.value.latitude===ga||this.cameraMotion.value.longitude===da&&this.cameraMotion.value.latitude===fa)&&(o.x=0);var a=this.camera.pose.offset.clone().add(o);e.state.offset.copy(a),e.state.fov=n,this.emit("gesture.pinch",e),e.defaultPrevented||(this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(se),this.cameraMotion.set({fov:n},0).catch(se),e.type="gesture.pan",this.onPanGesture(e))}}else this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov}},r.prototype.onMouseWheel=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var t=Or(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov),r=e.center.coords,n=this.getZoomOffsetFromFov(r,this.camera,t);this.cameraMotion.value.longitude===ua&&this.cameraMotion.value.latitude===ca?n.y=0:this.cameraMotion.value.longitude===ha&&this.cameraMotion.value.latitude===pa||this.cameraMotion.value.longitude===va&&this.cameraMotion.value.latitude===ma?n.z=0:(this.cameraMotion.value.longitude===Aa&&this.cameraMotion.value.latitude===ga||this.cameraMotion.value.longitude===da&&this.cameraMotion.value.latitude===fa)&&(n.x=0);var i=this.camera.pose.offset.clone().add(n);e.state.offset.copy(i),e.state.fov=t,this.emit("gesture.mousewheel",e),e.defaultPrevented||(this.locationMotion.set({x:i.x,y:i.y,z:i.z},0).catch(se),this.cameraMotion.set({fov:t},0).catch(se))},r}(la),ba=function(t){function r(e){var n=this,i=r.parseArgs(e);return(n=t.call(this,i)||this).mode="PanoramaLike",n.defaultLatitude=i.defaultLatitude,n.defaultFov=i.defaultFov,n.maxFov=i.maxFov,n.minFov=i.minFov,n.maxLatitude=i.maxLatitude,n.minLatitude=i.minLatitude,n.moveSpeed=i.moveSpeed,n.intersectMeshCreator=i.intersectMeshCreator,n.intersectMesh=n.intersectMeshCreator(),n.intersectMesh.name="intersect",n.intersectMesh.visible=!1,n.helper.add(n.intersectMesh),n}return Z(r,t),r.parseArgs=function(e){var n,i,o,a,s,l,u,c;if(e instanceof r)return e;var h=t.parseArgs.call(this,e);return $($({},h),{defaultLatitude:null!==(n=e.defaultLatitude)&&void 0!==n?n:0,defaultFov:null!==(i=e.defaultFov)&&void 0!==i?i:90,maxFov:null!==(o=e.maxFov)&&void 0!==o?o:120,minFov:null!==(a=e.minFov)&&void 0!==a?a:40,maxLatitude:null!==(s=e.maxLatitude)&&void 0!==s?s:+Math.PI/2,minLatitude:null!==(l=e.minLatitude)&&void 0!==l?l:-Math.PI/2,moveSpeed:null!==(u=e.moveSpeed)&&void 0!==u?u:3.4,intersectMeshCreator:null!==(c=e.intersectMeshCreator)&&void 0!==c?c:function(){return new Fo}})},r.initAnimationEndState=function(t){var r,n,i,o,a,s,l=this.parseArgs(t),u=l.works,c=t.initial,h=c.state,p=c.currentState,d="number"==typeof h.panoIndex?{workCode:null!==(i=null!==(r=h.workCode)&&void 0!==r?r:null===(n=l.works[0])||void 0===n?void 0:n.workCode)&&void 0!==i?i:"",panoIndex:h.panoIndex}:{workCode:p.workCode,panoIndex:p.panoIndex},f=u.getResolvedObserver(d),v=null!==(o=h.longitude)&&void 0!==o?o:p.longitude,m=Or(null!==(a=h.latitude)&&void 0!==a?a:Ni(p.mode)?p.latitude:l.defaultLatitude,l.minLatitude,l.maxLatitude),A=Or(null!==(s=h.fov)&&void 0!==s?s:Ni(p.mode)?p.fov:l.defaultFov,l.minFov,l.maxFov),g=f?f.position.clone():new e.Vector3;return{workCode:d.workCode,panoIndex:d.panoIndex,mode:"PanoramaLike",longitude:v,latitude:m,fov:A,offset:g,distance:0}},r.prototype.destroy=function(){t.prototype.destroy.call(this),this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),delete this.panState},r.prototype.isReady=function(){return!this.panState&&!this.pinchState&&t.prototype.isReady.call(this)},r.prototype.calculateMovingDuration=function(e,t){switch(typeof e){case"function":return e(t,this.moveSpeed);case"number":return e;case"string":return Number(e);default:return Or(t,2,5)/this.moveSpeed*1e3}},r.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},r.prototype.coordinatesForOffset=function(t){var r=this.cameraMotion.value.fov,n=this.camera.aspect,i=this.renderer.getSize(new e.Vector2);return{longitude:2*t.x/(i.x*this.scissor.width)*r/95*n,latitude:-2*t.y/(i.y*this.scissor.height)*r/95}},r.prototype.cameraBounce=function(){var e=this.cameraMotion.value,t=e.longitude,r=e.latitude,n=e.fov,i=[{progress:0,value:{longitude:t,latitude:r,fov:n}},{progress:.5,value:{longitude:t,latitude:r,fov:.98*n}},{progress:1,value:{longitude:t,latitude:r,fov:n}}];this.cameraMotion.setKeyframes(i,500).catch(se)},r.prototype.requestMomentumMovement=function(e,t,r,n){var i=this;if(null!==this.inMomentumMovement){for(var o=$({},r),a={longitude:0,latitude:0},s=0;s<n;s++)o.longitude*=.996,o.latitude*=.98604,a.longitude+=o.longitude,a.latitude+=o.latitude;var l=Ho(this.cameraMotion.value.longitude+a.longitude),u=Or(this.cameraMotion.value.latitude+a.latitude,this.minLatitude,this.maxLatitude),c=$($({},this.currentPano),{mode:this.mode,longitude:l,latitude:u,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),h=!(o.longitude>1e-4||o.longitude<-1e-4||o.latitude>1e-4||o.latitude<-1e-4),p=Xo("gesture.momentum",$($({},e),{isFirst:t,isFinal:h,state:c}));this.inMomentumMovement.event=p,this.emit("gesture.momentum",p),e.defaultPrevented?this.inMomentumMovement=null:this.inMomentumMovement&&(this.cameraMotion.set({longitude:l,latitude:u},0).catch(se),h?this.inMomentumMovement=null:Oe.shared.add((function(t,r){i.requestMomentumMovement(e,!1,o,0|r)}),!0,1))}},r.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var t=this.panState,r=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:r,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===r){var n={x:e.center.x-t.x,y:e.center.y-t.y},i=this.coordinatesForOffset(n),o=Ho(this.cameraMotion.value.longitude+i.longitude),a=Or(this.cameraMotion.value.latitude+i.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(a=this.cameraMotion.value.latitude);var s=$($({},this.currentPano),{mode:this.mode,longitude:o,latitude:a,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=s,this.emit("gesture.pan",e),!e.defaultPrevented){var l={longitude:s.longitude,latitude:s.latitude,fov:s.fov};if(this.cameraMotion.set(l,0).catch(se),e.isFinal){var u=e.velocityX,c=.6*e.velocityY;Math.abs(c)>.5&&Math.abs(u)<.5&&(u=0),this.inMomentumMovement={uuid:ki()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:u,y:c}),0)}}}},r.prototype.onPinchGesture=function(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();var r=null===(t=this.pinchState)||void 0===t?void 0:t.fov,n=e.scale;if(e.isFirst)this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};else if(e.isFinal&&delete this.pinchState,void 0!==r){var i=Or(r/n,this.minFov,this.maxFov);e.state.fov=i,this.emit("gesture.pinch",e),e.defaultPrevented||(this.cameraMotion.set({fov:i},0).catch(se),e.type="gesture.pan",this.onPanGesture(e))}},r.prototype.onMouseWheel=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var t=Or(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(se)},r.prototype.onMouseMove=function(t){var r,n;if(this.intersectMesh.parent&&!this.panState&&(this.emit("gesture.mousemove",t),!t.defaultPrevented)){var i=t.center.raycaster;if(t.isFinal&&this.intersectMesh.parent&&!0===this.intersectMesh.visible)this.hideIntersectMesh();else{var o=this.models.intersectRaycaster(i)[0],a=Xo("intersect.update",{raycaster:i,intersection:null!=o?o:null,object:this.intersectMesh});if(this.emit("intersect.update",a),a.defaultPrevented)this.hideIntersectMesh();else if(o){var s=null!==(n=null===(r=o.face)||void 0===r?void 0:r.normal)&&void 0!==n?n:(new e.Vector3).copy(i.ray.direction).multiplyScalar(-1),l=s.clone().multiplyScalar(.05),u=o.point.clone().add(l);this.intersectMesh.position.copy(u);var c=u.clone().add(l);if(this.intersectMesh.lookAt(c),Math.abs(s.y)>.99){var h=this.camera.position.clone().sub(u);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}}},r}(sa);function xa(){return aa||(aa=new Promise((function(e){var t,r=document.createElement("video");r.muted=!0,r.src="data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0we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AAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw",r.addEventListener("timeupdate",(function n(){r.removeEventListener("timeupdate",n,!1),clearTimeout(t);var i=document.createElement("canvas");i.width=i.height=1;var o=i.getContext("2d");o?(o.drawImage(r,0,0,1,1),o.getImageData(0,0,1,1).data[3]>10?e(!0):e(!1)):e(!1)}),!1),r.addEventListener("canplay",(function e(){r.removeEventListener("canplay",e,!1),r.play()}),!1),t=window.setTimeout((function(){return e(!1)}),1e3)})))}var wa=new e.OrthographicCamera(-1,1,1,-1,0,1),Ma=new e.BufferGeometry;Ma.setAttribute("position",new e.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),Ma.setAttribute("uv",new e.Float32BufferAttribute([0,2,0,0,2,0],2));var Ea=new e.Mesh(Ma),Ca=new e.Scene;Ca.add(Ea);var Sa,Ia=function(){function t(t,r){var n;this.renderer=t,this.material=new e.ShaderMaterial({vertexShader:null!==(n=r.vertex)&&void 0!==n?n:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:r.fragment,uniforms:Object.assign({inputBuffer:new e.Uniform(null)},r.uniforms),defines:Object.assign({},r.defines),blending:e.NoBlending,depthWrite:!1,depthTest:!1})}return t.prototype.render=function(e,t){var r=this.renderer.getRenderTarget(),n=Ea.material;this.material.uniforms.inputBuffer.value=e.texture,Ea.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(Ca,wa),this.renderer.setRenderTarget(r),Ea.material=n},t.prototype.dispose=function(){this.material.dispose()},t}(),Pa=function(){function t(t){this.renderer=t,this.material=new e.ShaderMaterial({vertexShader:"\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform vec3 inputValue;\nvoid main() {\n gl_FragColor = vec4(inputValue, 1.0);\n}\n",uniforms:Object.assign({inputValue:new e.Uniform(new e.Vector3)}),blending:e.NoBlending,depthWrite:!1,depthTest:!1})}return t.prototype.render=function(e,t){var r=this.renderer.getRenderTarget(),n=Ea.material;this.material.uniforms.inputValue.value.copy(e),Ea.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(Ca,wa),this.renderer.setRenderTarget(r),Ea.material=n},t.prototype.dispose=function(){this.material.dispose()},t}(),Ta=function(t){function r(r,n){return void 0===n&&(n=.5),t.call(this,r,{uniforms:{inputBuffer:new e.Uniform(null),scale:new e.Uniform(n)},fragment:"\n#include <common>\nuniform sampler2D inputBuffer;\nuniform float scale;\nvarying vec2 vUv;\n\nvoid main() {\n float u = (vUv.x - 0.5) * scale + 0.5;\n float v = (vUv.y - 0.5) * scale + 0.5;\n vec3 rgb = texture2D(inputBuffer, vec2(u, v)).rgb;\n float luminance = clamp(linearToRelativeLuminance(rgb), 0.1, 0.9);\n gl_FragColor = vec4(luminance);\n}\n"})||this}return Z(r,t),r}(Ia),Ba=function(e){function t(t){return e.call(this,t,{fragment:"\nuniform sampler2D inputBuffer;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(inputBuffer, vUv);\n}\n"})||this}return Z(t,e),t}(Ia),Ra=function(){function e(e,t,r,n){this.enable=!0,this.renderer=e,this.scene=t,this.camera=r,this.models=n,this.copyPass=new Ba(this.renderer)}return e.prototype.render=function(e,t){},e.prototype.dispose=function(){this.copyPass.dispose()},e}(),Oa=function(t){function r(r,n){void 0===n&&(n=.002);var i=t.call(this,r,{uniforms:{targetBuffer:new e.Uniform(null),inputBuffer:new e.Uniform(null),step:new e.Uniform(n)},fragment:"\n uniform sampler2D targetBuffer;\n uniform sampler2D inputBuffer;\n uniform float step;\n varying vec2 vUv;\n void main() {\n\n #ifdef GL_EXT_shader_texture_lod\n #if __VERSION__ < 300\n float target = texture2DLodEXT(targetBuffer, vUv, 5.0).r;\n #else\n float target = textureLod(targetBuffer, vUv, 5.0).r;\n #endif\n #else\n float target = texture2D(targetBuffer, vUv).r;\n #endif\n float current = texture2D(inputBuffer, vUv).r;\n\n float result;\n if (abs(target - current) < step) {\n result = target;\n } else if (target - current > 0.0) {\n result = current + step;\n } else {\n result = current - step;\n }\n gl_FragColor = vec4(result, result, result, 1.0);\n }\n "})||this;return i.material.extensions.shaderTextureLOD=!0,i}return Z(r,t),Object.defineProperty(r.prototype,"targetBuffer",{get:function(){return this.material.uniforms.targetBuffer.value},set:function(e){this.material.uniforms.targetBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"step",{get:function(){return this.material.uniforms.step.value},set:function(e){this.material.uniforms.step.value=e},enumerable:!1,configurable:!0}),r}(Ia),ka=function(t){function r(r){var n=t.call(this,r,{uniforms:{inputBuffer:new e.Uniform(null),luminanceAdaptiveBuffer:new e.Uniform(null),progress:new e.Uniform(0)},fragment:"\n #include <common>\n uniform sampler2D inputBuffer;\n uniform sampler2D luminanceAdaptiveBuffer;\n uniform float progress;\n varying vec2 vUv;\n\n void main() {\n float middleGrey = 1.5;\n float whitePoint = 13.0;\n float exposure = 1.4;\n vec4 inputColor = texture2D(inputBuffer, vUv);\n vec3 rgb = inputColor.rgb * exposure;\n float alpha = inputColor.a;\n float luminance = linearToRelativeLuminance(rgb);\n float lumAvg = texture2D(luminanceAdaptiveBuffer, vec2(0.5)).r;\n float lumScaled = (luminance * middleGrey) / max(lumAvg, 1e-6);\n float lumCompressed = lumScaled * (1.0 + lumScaled / (whitePoint * whitePoint));\n lumCompressed /= (1.0 + lumScaled);\n rgb = clamp(lumCompressed * rgb, 0.0, 1.0);\n gl_FragColor = mix(inputColor, vec4(rgb, alpha), progress * 0.9);\n }\n "})||this;return n.material.transparent=!0,n}return Z(r,t),Object.defineProperty(r.prototype,"luminanceAdaptiveBuffer",{get:function(){return this.material.uniforms.luminanceAdaptiveBuffer.value},set:function(e){this.material.uniforms.luminanceAdaptiveBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),r}(Ia),Da=function(t){function r(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.enableTime=ue(),o.renderer=e,o.valuePass=new Pa(o.renderer),o.luminancePass=new Ta(o.renderer,Math.sqrt(1/3)),o.nextStepPass=new Oa(o.renderer,.01),o.luminanceAdaptivePass=new ka(o.renderer),o}return Z(r,t),r.prototype.render=function(t){if(!this.enable)return this.enableTime=null,void this.copyPass.render(t[0],t[1]);null===this.enableTime&&(this.enableTime=ue()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new e.WebGLRenderTarget(128,128,{minFilter:e.LinearMipmapLinearFilter,magFilter:e.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:e.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(t[0],this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new e.WebGLRenderTarget(1,1,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,type:e.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new e.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new e.WebGLRenderTarget(1,1,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,type:e.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new e.Vector3(.5,.5,.5),this.luminanceNextBuffer),this.luminanceAdaptivePass.luminanceAdaptiveBuffer=this.luminanceNextBuffer.texture),this.copyPass.render(this.luminanceNextBuffer,this.luminancePrevBuffer),this.nextStepPass.render(this.luminancePrevBuffer,this.luminanceNextBuffer),this.luminanceAdaptivePass.progress=Math.min((ue()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(t[0])},r.prototype.dispose=function(){var e,t,r;null===(e=this.luminanceTargetBuffer)||void 0===e||e.dispose(),null===(t=this.luminancePrevBuffer)||void 0===t||t.dispose(),null===(r=this.luminanceNextBuffer)||void 0===r||r.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},r}(Ra),La=null!==(Sa=Math.SQRT1_2)&&void 0!==Sa?Sa:Math.sqrt(2),Fa={up:new e.Quaternion(La,0,0,La),down:new e.Quaternion(-La,0,0,La),left:new e.Quaternion(0,La,0,La),right:new e.Quaternion(0,-La,0,La),front:new e.Quaternion(0,0,0,1),back:new e.Quaternion(0,1,0,0)},Qa=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Na=new Float32Array([0,0,1,0,0,1,1,1]),Va=new Uint8Array([0,1,2,1,3,2]),Ua=new e.BufferGeometry;Ua.setAttribute("position",new e.BufferAttribute(Qa,3)),Ua.setAttribute("uv",new e.BufferAttribute(Na,2)),Ua.setIndex(new e.BufferAttribute(Va,1));var za=function(t){function r(){var r=t.call(this,{uniforms:{map:{value:null},luminanceMap:{value:null},flipY:{value:0}},vertexShader:"\nuniform float flipY;\nvarying vec2 vUv;\nvoid main() {\n vUv = vec2(uv.x, mix(uv.y, (1.0 - uv.y), flipY));\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n#if defined(USE_LUMINANCE)\nuniform sampler2D luminanceMap;\n#endif\nuniform sampler2D map;\nvarying vec2 vUv;\n\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n #if defined(USE_LUMINANCE)\n gl_FragColor.a = 1.0 - texture2D(luminanceMap, vUv).r;\n #endif\n}\n"})||this;return r.depthTest=!1,r.depthWrite=!1,r.blending=e.NoBlending,r.map=r.uniforms.map.value,r.luminanceMap=r.uniforms.luminanceMap.value,r.flipY=r.uniforms.flipY.value,Object.defineProperties(r,{map:{get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},luminanceMap:{get:function(){return this.uniforms.luminanceMap.value},set:function(e){this.uniforms.luminanceMap.value=e,this.defines.USE_LUMINANCE=null!==e,this.needsUpdate=!0}},flipY:{get:function(){return 1===this.uniforms.flipY.value},set:function(e){this.uniforms.flipY.value=e?1:0}}}),r}return Z(r,t),r}(e.ShaderMaterial),_a=function(t){function r(r,n){var i=t.call(this,Ua,new za)||this;return r.box.getCenter(i.position),i.quaternion.multiplyQuaternions((new e.Quaternion).setFromAxisAngle(new e.Vector3(0,1,0),-Math.PI),Fa[r.face]),i.scale.setScalar(r.size),i.node=r,i.name="tiling:tile",i.material.visible=!1,i.activeTime=-1,i.disposed=!1,i.needsRender=!1,i.frustumCulled=!1,n.then((function(e){var t=e[0],r=e[1];i.disposed?(t.dispose(),null==r||r.dispose()):(i.material.map=t,i.material.luminanceMap=r,i.material.flipY=!t.flipY,i.material.needsUpdate=!0,i.material.visible=!0,i.needsRender=!0)})).catch(se),i}return Z(r,t),r.prototype.updateTime=function(e){},r.prototype.dispose=function(){var e;this.disposed=!0,this.material.map&&(this.material.map.dispose(),null===(e=this.material.luminanceMap)||void 0===e||e.dispose()),this.material.dispose()},r}(e.Mesh),qa=function(e){function t(){var t=e.call(this)||this;return t.needsRender=!1,t.name="tiling",t}return Z(t,e),t}(e.Group),Ha=function(){function t(e,t,r){this.disposed=!1,this.textureLoader=new kt,this.minLevel=t,this.level=0,this.panoId="[0]",this.pedding=0,this.tileTree=ht(this.minLevel),this.tileMeshes=new Map,this.resource=[],this.luminance=null,this.imageOptions=r,this.networkOptions=e,this.object=new qa,this.object.renderOrder=-3}return t.prototype.setAllowHosts=function(e){this.networkOptions.allowHosts=e},t.prototype.setRequestProxy=function(e){this.networkOptions.requestProxy=e},t.prototype.setNetworkSubscribe=function(e){this.networkOptions.networkSubscribe=e},t.prototype.cleanup=function(){var e=this;this.tileMeshes.forEach((function(t){t.dispose(),e.object.remove(t),e.object.needsRender=!0})),this.tileMeshes.clear()},t.prototype.setRotation=function(e){this.disposed||this.object.quaternion.equals(e)||(this.object.quaternion.copy(e),this.object.needsRender=!0)},t.prototype.setPosition=function(e){this.disposed||this.object.position.equals(e)||(this.object.position.copy(e),this.object.needsRender=!0)},t.prototype.setResource=function(e,t){var r,n;if(!this.disposed&&(this.resource!==e||this.luminance!==t)){this.cleanup(),this.resource=e;var i=null!==(n=null===(r=e.slice().sort((function(e,t){return t.level-e.level}))[0])||void 0===r?void 0:r.level)&&void 0!==n?n:0;this.tileTree=ht(i),this.luminance=t,this.object.needsRender=!0}},t.prototype.update=function(t,r,n){var i=this;if(!this.disposed){this.level=r;var o=t.planes[5].normal,a=[];r>=this.minLevel&&pt(this.tileTree,(function(e){if(!(e.level<i.minLevel))return!(e.level>r)&&!!t.intersectsBox(e.box)&&void a.push(e)}));var s=new e.Vector3;a.sort((function(e,t){return e.level!==t.level?e.level-t.level:e.box.getCenter(s).angleTo(o)-t.box.getCenter(s).angleTo(o)}));for(var l=new Set,u=function(e){var t=c.resource.filter((function(t){return t.level===e.level}))[0];if(!t)return"continue";if(l.add(e),c.tileMeshes.has(e))return c.tileMeshes.get(e).activeTime=n,"continue";var r=t.size,o=c.imageOptions.transform,a=Math.pow(2,e.level)*e.position.y,s=Math.pow(2,e.level)*e.position.x,u="".concat(c.panoId,".").concat(e.face,".").concat(e.level,".").concat(a,".").concat(s),h=$($({key:"pano_tile.".concat(u)},Yn(c.imageOptions,["format","size","quality","sharpen","mappings"])),{size:r*e.size==512?void 0:512,cut:[r*e.position.x,r*e.position.y,r*e.size,r*e.size]}),p=c.textureLoader.loadTexture(t[e.face],{imageURL:{transform:o,options:h},allowHosts:c.networkOptions.allowHosts,networkSubscribe:c.networkOptions.networkSubscribe,requestProxy:c.networkOptions.requestProxy,viaAjax:St}).then((function(e){return e.body})),d=null;if(c.luminance){var f=c.luminance[e.face],v=f.match(/\/cube_(\d+)\//),m=!!v&&Number(v[1]);if(!1!==m){var A=$($({},h),{size:m*e.size==256?void 0:256,cut:[m*e.position.x,m*e.position.y,m*e.size,m*e.size],key:"pano_tile_luminance.".concat(u)});d=c.textureLoader.loadTexture(f,{imageURL:{transform:c.imageOptions.transform,options:A},allowHosts:c.networkOptions.allowHosts,networkSubscribe:c.networkOptions.networkSubscribe,requestProxy:c.networkOptions.requestProxy,viaAjax:St}).then((function(e){return e.body})).catch((function(){return null}))}}c.pedding++;var g=Promise.all([p,d]).then((function(e){return i.pedding--,e}),(function(e){return i.pedding--,Promise.reject(e)})),y=new _a(e,g);y.name="tiling:tile-".concat(u),y.activeTime=n,y.renderOrder=e.level,c.tileMeshes.set(e,y),c.object.needsRender=!0,c.object.add(y)},c=this,h=0,p=a;h<p.length;h++)u(A=p[h]);var d=[];this.tileMeshes.forEach((function(e,t){l.has(t)||d.push(t),e.visible=t.level<=r}));for(var f=d.sort((function(e,t){var r,n,o,a;return(null!==(n=null===(r=i.tileMeshes.get(t))||void 0===r?void 0:r.activeTime)&&void 0!==n?n:0)-(null!==(a=null===(o=i.tileMeshes.get(e))||void 0===o?void 0:o.activeTime)&&void 0!==a?a:0)})).slice(Math.max(0,32-l.size)),v=0,m=f;v<m.length;v++){var A=m[v],g=this.tileMeshes.get(A);g&&(g.dispose(),this.object.remove(g),this.object.needsRender=!0),this.tileMeshes.delete(A)}}},t.prototype.dispose=function(){this.cleanup(),this.resource=[],this.disposed=!0},t}(),ja=new Float32Array([-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1]),Ga=new Uint8Array([0,2,1,2,3,1,4,6,5,6,7,5,8,10,9,10,11,9,12,14,13,14,15,13,16,18,17,18,19,17,20,22,21,22,23,21]),Ka=new e.BufferGeometry;Ka.setAttribute("position",new e.BufferAttribute(ja,3)),Ka.setIndex(new e.BufferAttribute(Ga,1));var Wa,Ya,Xa=function(){function t(){this.material=new e.ShaderMaterial({vertexShader:"\n#if defined(USE_PANO_VIDEO)\nvarying vec3 worldPosition;\n#endif\nvoid main() {\n vec4 transformed = vec4(position, 1.0);\n #if defined(USE_PANO_VIDEO)\n worldPosition = (modelMatrix * transformed).xyz;\n #endif\n gl_Position = projectionMatrix * modelViewMatrix * transformed;\n}\n",fragmentShader:"\nuniform vec2 size;\nuniform mat4 matrix;\nuniform float alpha;\nuniform sampler2D map;\n#if defined(USE_PANO_VIDEO)\nvarying vec3 worldPosition;\n#endif\n#include <common>\nvoid main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n #if defined(USE_PANO_VIDEO)\n vec3 cameraToVertex = worldPosition - cameraPosition;\n vec4 mapCoods = vec4(cameraToVertex, 1.0) * matrix;\n vec2 uv = vec2(\n 0.5 + mapCoods.x / mapCoods.z / size.x,\n 0.5 - mapCoods.y / mapCoods.z / size.y\n );\n vec4 videoColor = texture2D(map, uv);\n float match = (1.0 - step(0.0, mapCoods.z)) * (1.0 - step(0.5, abs(uv.x - 0.5))) * (1.0 - step(0.5, abs(uv.y - 0.5)));\n float blendAlpha = clamp(0.0, 1.0, 5.0 * (1.0 - clamp(distance(uv, vec2(0.5, 0.5)) / 0.55 , 0.0, 1.0)));\n gl_FragColor = vec4(videoColor.rgb, match * blendAlpha * alpha);\n #endif\n}\n",uniforms:{size:new e.Uniform(null),matrix:new e.Uniform(null),alpha:new e.Uniform(null),map:new e.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor}),this.object=new e.Mesh(Ka,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.name="pano-video",this.alphaMotion=new Eo({alpha:0})}return t.prototype.setMaterial=function(e){e?(this.material.uniforms.size.value=e.size,this.material.uniforms.matrix.value=e.matrix,this.material.uniforms.map.value=e.map,this.alphaMotion.set({alpha:e.alpha},500).catch(se),this.material.uniforms.alpha.value=e.alpha):(this.material.uniforms.size.value=null,this.material.uniforms.matrix.value=null,this.material.uniforms.map.value=null,this.alphaMotion.set({alpha:0},0).catch(se));var t=null!==e;t!==this.material.defines.USE_PANO_VIDEO&&(this.material.defines.USE_PANO_VIDEO=t,this.material.needsUpdate=!0,this.object.visible=null!==e)},t.prototype.updateTime=function(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},t.prototype.dispose=function(){this.material.dispose()},t}(),Ja=(new e.Matrix4).makeRotationAxis(new e.Vector3(0,1,0),Math.PI),Za=new e.Vector3(-1,1,1),$a=function(){function t(e){void 0===e&&(e=0),this.width=e,this.pool=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.pool.length},enumerable:!1,configurable:!0}),t.prototype.create=function(){return new e.WebGLCubeRenderTarget(this.width,{stencilBuffer:!1,depthBuffer:!1})},t.prototype.pop=function(){return this.pool.pop()||this.create()},t.prototype.push=function(e){-1===this.pool.indexOf(e)&&this.pool.push(e)},t.prototype.clear=function(){for(var e=0,t=this.pool;e<t.length;e++)t[e].dispose();this.pool.length=0},t}(),es=function(t){function r(e){var n,i,o,a,s=this,l=r.parseArgs(e);(s=t.call(this,l)||this).TILED_CUBE_TEXTURE_LEVEL=2,s.mode="Panorama",s.tileLevel=0,s.initAnimationed=!1,s.maxAccessibleDistance=l.maxAccessibleDistance,s.panoTapTriggerRadius=l.panoTapTriggerRadius,s.panoCircleMeshCreator=l.panoCircleMeshCreator,s.tileLevelForFov=l.tileLevelForFov,s.luminanceAdaptiveEffectEnable=l.luminanceAdaptiveEffectEnable,s.colorCubeRenderTargetPool=new $a,s.luminanceCubeRenderTargetPool=new $a;var u=s.models.getMaterial()||{},c=u.pano0,h=u.pano1;c&&(null==h?void 0:h.map)!==c.map&&(s.models.setMaterial({pano0:h}),c.map.dispose(),c.map instanceof Ot&&c.map.cubeRenderTarget&&s.colorCubeRenderTargetPool.push(c.map.cubeRenderTarget),c.luminanceMap&&(c.luminanceMap.dispose(),c.luminanceMap instanceof Ot&&c.luminanceMap.cubeRenderTarget&&s.luminanceCubeRenderTargetPool.push(c.luminanceMap.cubeRenderTarget)));for(var p=s.colorCubeRenderTargetPool.size;p<2;p++){var d=Math.max(1024*s.TILED_CUBE_TEXTURE_LEVEL,512),f=s.colorCubeRenderTargetPool.create();f.setSize(d,d),gt(null,f,s.renderer),s.colorCubeRenderTargetPool.push(f)}s.panoMeshes={},s.updatePanoMeshes(),s.locationMotion=new Eo({count:0,distance:s.camera.pose.distance,modelAlpha:null!==(i=null===(n=s.models.getMaterial())||void 0===n?void 0:n.modelAlpha)&&void 0!==i?i:0,perspToOrtho:s.camera.perspToOrtho.x,orthoDistance:s.camera.orthoDistance}),s.panoResources={},s.panoResources[s.locationMotion.keyframes[0].key=s.locationMotion.keyframes[1].key=ki()]={panoId:Ke(s.currentPano),panoPicture:null!==(a=null===(o=s.models.getMaterial())||void 0===o?void 0:o.pano1)&&void 0!==a?a:null,position:s.camera.pose.offset.clone(),effect:"fly"};var v={allowHosts:s.works[0].allowHosts,requestProxy:s.requestProxy,networkSubscribe:s.networkSubscribe};return s.textureLoader=new kt,s.tiling=new Ha(v,s.TILED_CUBE_TEXTURE_LEVEL+1,s.imageOptions),s.scene.add(s.tiling.object),s.panoVideo=new Xa,s.scene.add(s.panoVideo.object),s}return Z(r,t),r.parseArgs=function(e){var n,i,o,a,s;if(e instanceof r)return e;var l=t.parseArgs.call(this,e);return $($({},l),{maxAccessibleDistance:null!==(n=e.maxAccessibleDistance)&&void 0!==n?n:5,panoTapTriggerRadius:null!==(i=e.panoTapTriggerRadius)&&void 0!==i?i:.5,panoCircleMeshCreator:null!==(o=e.panoCircleMeshCreator)&&void 0!==o?o:function(e){return new Io},tileLevelForFov:null!==(a=e.tileLevelForFov)&&void 0!==a?a:function(e,t){var r=2*Math.atan(Math.tan(e/180*Math.PI/2)*(t.width/t.height))/Math.PI*180,n=Math.max(t.width/r,t.height/e);return n>60?4:n>30?3:n>18?2:n>12?1:0},luminanceAdaptiveEffectEnable:null===(s=e.luminanceAdaptiveEffectEnable)||void 0===s||s})},r.initAnimationEndState=function(e){var r=this.parseArgs(e),n=t.initAnimationEndState.call(this,r);return $($({},n),{mode:"Panorama"})},r.prototype.destroy=function(){var e,r;if(t.prototype.destroy.call(this),this.scene.remove(this.tiling.object),this.tiling.dispose(),this.locationMotion.dispose(),this.colorCubeRenderTargetPool.clear(),this.luminanceCubeRenderTargetPool.clear(),delete this.pendingTextureTask,this.panoMeshes)for(var n=0,i=Object.keys(this.panoMeshes);n<i.length;n++){var o=i[n],a=this.panoMeshes[o];this.helper.remove(a),a.dispose(),delete this.panoMeshes[o]}var s=this.videoTexture.image;s.pause(),s.oncanplay=function(){},s.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var l=null!==(e=this.models.getMaterial())&&void 0!==e?e:{},u=l.pano0,c=l.pano1,h=0,p=Object.keys(this.panoResources);h<p.length;h++){var d=p[h],f=this.panoResources[d];if(f.panoPicture){var v=f.panoPicture.map;v&&v!==(null==u?void 0:u.map)&&v!==(null==c?void 0:c.map)&&(v.dispose(),null===(r=f.panoPicture.luminanceMap)||void 0===r||r.dispose(),f.panoPicture=null)}delete this.panoResources[d]}this.luminanceAdaptiveEffect&&(this.luminanceAdaptiveEffect.dispose(),delete this.luminanceAdaptiveEffect)},r.prototype.isReady=function(){return!0===this.locationMotion.ended&&t.prototype.isReady.call(this)},r.prototype.isTileReady=function(){var e,t,r,n=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),i=(null===(e=n.panoPicture)||void 0===e?void 0:e.map)instanceof Ot&&null!==(r=null===(t=n.panoPicture)||void 0===t?void 0:t.map.tilePending)&&void 0!==r?r:0,o=this.tiling.pedding;return this.initAnimationed&&i<=0&&o<=0},r.prototype.updateWork=function(e,t,n,i){var o=this;this.userAction=i,this.works=e;var a=r.initAnimationEndState($($({},this),{initial:{currentState:$($({},this.currentPano),this.camera.pose),duration:n,state:t,userAction:i}})),s={workCode:a.workCode,panoIndex:a.panoIndex};return this.tiling.setAllowHosts(this.works[0].allowHosts),this.tiling.cleanup(),this.initAnimationed=!1,this.hideIntersectMesh(),this.updatePanoMeshes(),this.moveToPano(s,{effect:"fade",duration:n,longitude:t.longitude,latitude:t.latitude,fov:t.fov,moveEndCallback:function(){o.initAnimationed=!0},moveCancelCallback:function(){o.initAnimationed=!0}},i),!0},r.prototype.updateModel=function(e){this.models=e,this.updatePanoMeshes()},r.prototype.updateTime=function(t,r){for(var n,i,o,a,s,l,u,c,h,p,d=this,f=[],v=2;v<arguments.length;v++)f[v-2]=arguments[v];if(!this.destroyed){var m={},A={},g=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),y=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),b=!1;if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(t),A.longitude=this.cameraMotion.value.longitude,A.latitude=this.cameraMotion.value.latitude,A.fov=this.cameraMotion.value.fov),!1===this.locationMotion.ended){this.locationMotion.update(t);var x=this.locationMotion.getKeyFrameSegment(t),w=x[0],M=x[1],E=this.panoResourceFromLocationMotionKeyframe(w),C=this.panoResourceFromLocationMotionKeyframe(M),S=(new e.Vector3).copy(E.position),I=(new e.Vector3).copy(C.position),P=this.locationMotion.value.count-M.value.count+1;m.progress=P,m.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Or(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,C.panoPicture&&(P<1?E.panoPicture&&(m.pano0=E.panoPicture):m.pano0=C.panoPicture,m.pano1=C.panoPicture),b=m.useBlackTransition="instant"===C.effect||"montage"===C.effect,"fade"!==C.effect&&"montage"!==C.effect||(m.pano0&&E.panoPicture&&(m.pano0={map:m.pano0.map,luminanceMap:m.pano0.luminanceMap,matrix:E.panoPicture.matrix.clone().setPosition(C.position)}),S.copy(I)),A.distance=this.locationMotion.value.distance,A.offset=new e.Vector3(S.x+(I.x-S.x)*P,S.y+(I.y-S.y)*P,S.z+(I.z-S.z)*P);for(var T=[],B=[],R=0,O=this.locationMotion.keyframes;R<O.length;R++){var k=O[R],D=k.key,L=k.progress;void 0!==D&&(T.push(D),L>=this.locationMotion.progress&&B.push(D))}for(var F=0,Q=Object.keys(this.panoResources);F<Q.length;F++){var N=Q[F];if(!(B.indexOf(N)>=0)){var V=this.panoResources[N];if(V.panoPicture){var U=V.panoPicture.map,z=V.panoPicture.luminanceMap;if(U){if(U===(null===(n=m.pano0)||void 0===n?void 0:n.map))continue;if(U===(null===(i=m.pano1)||void 0===i?void 0:i.map))continue;U instanceof Ot&&U.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(U.cubeRenderTarget),U.dispose(),z&&(z instanceof Ot&&z.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(z.cubeRenderTarget),z.dispose()),V.panoPicture=null}}T.indexOf(N)>=0||delete this.panoResources[N]}}this.currentPano=We(C.panoId),this.emit("pano.moving",Xo("pano.moving",{userAction:this.userAction,prevPano:We(g.panoId),state:$($($($({},We(y.panoId)),{mode:this.mode}),ra(this.camera.pose)),A),options:{},progress:this.locationMotion.progress,error:null}))}!1===ta(m)&&((null===(o=m.pano0)||void 0===o?void 0:o.map)&&m.pano0.map instanceof Ot&&!m.pano0.map.cubeRenderTarget&&(m.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(a=m.pano0)||void 0===a?void 0:a.luminanceMap)&&m.pano0.luminanceMap instanceof Ot&&!m.pano0.luminanceMap.cubeRenderTarget&&(m.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),(null===(s=m.pano1)||void 0===s?void 0:s.map)&&m.pano1.map instanceof Ot&&!m.pano1.map.cubeRenderTarget&&(m.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(l=m.pano1)||void 0===l?void 0:l.luminanceMap)&&m.pano1.luminanceMap instanceof Ot&&!m.pano1.luminanceMap.cubeRenderTarget&&(m.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(m)),!1===ta(A)&&this.setCamera(A);var _=this.works.getResolvedObserver(this.currentPano),q=this.locationMotion.ended?this.getForwardObserverOrNot():null;if(this.camera.pose.distance>.1||b){if(_)for(var H=0,j=Object.keys(this.panoMeshes);H<j.length;H++){var G=j[H];(Z=this.panoMeshes[G]).setOpacity(0),Z.setCurrent(!1),Z.updateTime&&Z.updateTime(t,r)}}else if(_){var K=ea(_.visibleIds,(function(e){var t=d.works.getResolvedObserver(e);return t?_.standingPosition.distanceTo(t.standingPosition):1/0}),!0)[1];K=Or(K,2.5,1/0);for(var W=_.visibleIds.concat(Ke(this.currentPano)),Y=this.camera.getDirection(new e.Vector3),X=0,J=Object.keys(this.panoMeshes);X<J.length;X++){G=J[X];var Z=this.panoMeshes[G],ee=this.works.getResolvedObserver(G);if(-1===W.indexOf(G))Z.setCurrent(!1),Z.setOpacity(0);else if(ee)if(ee.loadable||ee.active){var te=Z.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Z.setCurrent(!Z.loading&&0===Z.progress&&null!==q&&q.panoId===G),Z.setOpacity(te<.01?0:Or(K/te*1.2,.4,.85));var re=this.camera.position.clone().setY(Z.position.y),ne=(new e.Vector3).copy(Z.position).sub(re).normalize();if(G===Ke(this.currentPano)){var ie=Or((.5-re.distanceTo(Z.position))/.5,0,1);ne.multiplyScalar(1-ie).add(Y.clone().multiplyScalar(ie))}ne.length()>0&&Z.quaternion.setFromEuler(new e.Euler(0,Math.atan2(ne.x,ne.z),0))}else Z.setCurrent(!1),Z.setOpacity(0);else Z.setCurrent(!1),Z.setOpacity(0);Z.updateTime&&Z.updateTime(t,r)}}var oe=this.tileLevel=function(){if(!1===d.tileLevelForFov)return 0;var t=d.renderer.getDrawingBufferSize(new e.Vector2);t.width*=d.scissor.width,t.height*=d.scissor.height;var r=y.panoId,n=d.works.getResolvedObserver(r),i=d.imageOptions.size;if(void 0===i&&n){var o=n.images.up.match(/\/cube_(\d+)\//);o&&(i=Number(o[1]))}void 0===i&&(i=2048);var a=0;i>=1024&&(a=1),i>=2048&&(a=2),i>=4096&&(a=3),i>=8192&&(a=4);var s=d.tileLevelForFov(d.camera.fov,t);return s>a?s:0}(),ae=function(){var t=d.camera.quaternion.clone(),r=d.works.getResolvedObserver(y.panoId),n=null!=r?r:_;n&&t.premultiply(n.quaternion.clone().inverse());var i=(new e.Matrix4).makeRotationFromQuaternion(t),o=(new e.Matrix4).getInverse(i);return(new e.Frustum).setFromProjectionMatrix((new e.Matrix4).multiplyMatrices(d.camera.projectionMatrix,o))}();y.panoId===Ke(this.currentPano)&&((null===(u=y.panoPicture)||void 0===u?void 0:u.map)instanceof Ot&&(y.panoPicture.map.update(ae,oe),!0===y.panoPicture.map.needsRender&&(y.panoPicture.map.needsRender=!1,this.needsRender=!0)),(null===(c=y.panoPicture)||void 0===c?void 0:c.luminanceMap)instanceof Ot&&(y.panoPicture.luminanceMap.update(ae,oe),!0===y.panoPicture.luminanceMap.needsRender&&(y.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0)));var se=this.tiling.object.visible;if(this.initAnimationed){var le=y.panoId,ue=this.works.getResolvedObserver(le);ue&&Vo(this.camera.position,ue.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==le&&this.tiling.cleanup(),this.tiling.panoId=le,this.tiling.setResource(null!==(p=null===(h=ue.images)||void 0===h?void 0:h.tiles)&&void 0!==p?p:[],this.enableIOSEDR&&ue.images.luminance?ue.images.luminance:null),this.tiling.setAllowHosts(ue.work.allowHosts),this.tiling.setNetworkSubscribe(this.networkSubscribe),this.tiling.setRequestProxy(this.requestProxy),this.tiling.setRotation(ue.quaternion),this.tiling.setPosition(ue.position),oe>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(ae,oe,t):this.tiling.update(ae,0,t)):this.tiling.object.visible=!1}else this.tiling.object.visible=!1;se!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(t)}},r.prototype.render=function(){var e=this.works.getResolvedObserver(this.currentPano);e&&e.video&&(this.needsRender=!0),t.prototype.render.call(this)},r.prototype.postProcessing=function(e,t){if(!this.destroyed)return"luminance"===t?(this.luminanceAdaptiveEffect||(this.luminanceAdaptiveEffect=new Da(this.renderer,this.scene,this.camera,this.models),this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable),this.luminanceAdaptiveEffect.render(e)):void 0},r.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(ue())[1],t=this.locationMotion.getKeyFrameSegment(ue())[1],r=this.panoResourceFromLocationMotionKeyframe(t),n=this.works.getResolvedObserver(r.panoId);return{workCode:n?n.work.workCode:this.currentPano.workCode,panoIndex:n?n.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:n?n.position.clone():this.camera.position.clone(),distance:this.locationMotion.value.distance}},r.prototype.moveToPano=function(t,r,n){var i,o,a,s,l=this;this.userAction=n,this.stopMomentumMovement();var u=this.works.getResolvedObserver(t);if(!u)throw new Error("Invalid PanoId ".concat(JSON.stringify(t)));var c=this.imageOptions.size;if(void 0===c&&u){var h=u.images.up.match(/\/cube_(\d+)\//);h&&(c=Number(h[1]))}void 0===c&&(c=2048);var p=this.imageOptions.transform,d=$({key:"pano.".concat(u.panoId)},Yn(this.imageOptions,["format","size","quality","sharpen","mappings"])),f=u.images,v=null!==(o=null===(i=u.images.tiles)||void 0===i?void 0:i.filter((function(e){return e.size>c})))&&void 0!==o?o:null,m=p,A={key:"pano_luminance.".concat(u.panoId),size:d.size?d.size/2:1024},g=this.enableIOSEDR&&u.images.luminance?u.images.luminance:null,y=function(){if(!u.images.tiles)return null;if(!g)return null;var e=g.up.match(/\/cube_(\d+)\//),t=!!e&&Number(e[1]);return!1===t?null:null==v?void 0:v.map((function(e){return{level:e.level,size:t,back:g.back,front:g.front,left:g.left,right:g.right,up:g.up,down:g.down}}))}(),b="pano:"+Jn([f,d,p]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===b)return;var x=this.pendingTextureTask.panoId;null===(a=this.panoMeshes[x])||void 0===a||a.setProgress(0),this.emit("pano.texture.abort",Xo("pano.texture.abort",{error:null,progress:0,meta:null,pano:u.pano})),this.pendingTextureTask.onError(new Error("texture aborted"))}var w="move-to-pano-"+u.panoId;this.pending.add(w);var M,E=this.models.getMaterial()||{},C=E.pano0,S=E.pano1;if(C&&C.map.name===b&&null!==C.luminanceMap===this.enableIOSEDR?M=C:(null==S?void 0:S.map.name)===b&&null!==S.luminanceMap===this.enableIOSEDR&&(M=S),M){var I={panoId:u.panoId,effect:null!==(s=r.effect)&&void 0!==s?s:"fly",panoPicture:{map:M.map,luminanceMap:M.luminanceMap,matrix:(new e.Matrix4).compose(u.position,u.quaternion,Za)},position:u.position.clone()};Oe.shared.add((function(){l.pending.delete(w),l.doMoveToPano(u.pano,I,r)}),!0,1)}else{this.pendingTextureTask={panoId:u.panoId,hash:b,onLoad:function(t,n){var i,o;if(l.pending.delete(w),l.destroyed)t.body.dispose();else{t.body.name=b;var a={panoId:u.panoId,effect:null!==(i=r.effect)&&void 0!==i?i:"fly",panoPicture:{map:t.body,luminanceMap:null!==(o=null==n?void 0:n.body)&&void 0!==o?o:null,matrix:(new e.Matrix4).compose(u.position,u.quaternion,Za)},position:u.position.clone()};l.doMoveToPano(u.pano,a,r)}},onError:function(e){l.pending.delete(w);var t=$($($({},u.pano),{mode:l.mode}),ra(l.camera.pose));l.emit("pano.error",Xo("pano.error",{error:e,userAction:l.userAction,options:r,prevPano:l.currentPano,progress:0,state:t})),l.emit("pano.cancel",Xo("pano.cancel",{error:null,userAction:l.userAction,options:r,prevPano:l.currentPano,progress:0,state:t})),r.moveCancelCallback&&r.moveCancelCallback()}};var P=this.panoMeshes[u.panoId];P&&P.tap&&P.tap(),Promise.all([this.tileLevelForFov&&v&&v.length?this.textureLoader.loadTiledCubeTexture(f,v,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:p,options:d},format:e.RGBAFormat,viaAjax:!0},void 0,void 0,(function(e){var t,r;l.emit("pano.texture.progress",Xo("pano.texture.progress",{error:null,progress:e,meta:null,pano:u.pano})),(null===(t=l.pendingTextureTask)||void 0===t?void 0:t.hash)===b&&(null===(r=l.panoMeshes[u.panoId])||void 0===r||r.setProgress(e))}),this.renderer):this.textureLoader.loadCubeTexture(f,{imageURL:{transform:p,options:d},format:e.RGBAFormat,viaAjax:!0},void 0,void 0,(function(e){var t,r;l.emit("pano.texture.progress",Xo("pano.texture.progress",{error:null,progress:e,meta:null,pano:u.pano})),(null===(t=l.pendingTextureTask)||void 0===t?void 0:t.hash)===b&&(null===(r=l.panoMeshes[u.panoId])||void 0===r||r.setProgress(e))}),this.renderer),g?this.tileLevelForFov&&y&&y.length?this.textureLoader.loadTiledCubeTexture(g,y,{tileImageSize:256,tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:m,options:A}},void 0,void 0,void 0,this.renderer).catch((function(){return null})):this.textureLoader.loadCubeTexture(g,{imageURL:{transform:m,options:A}},void 0,void 0,void 0,this.renderer).catch((function(){return null})):Promise.resolve(null)]).then((function(e){var t,r,n=e[0],i=e[1];(null===(t=l.pendingTextureTask)||void 0===t?void 0:t.hash)===b?(l.pendingTextureTask.onLoad(n,i),null===(r=l.panoMeshes[u.panoId])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("pano.texture.success",Xo("pano.texture.success",{error:null,progress:1,meta:n.meta,pano:u.pano}))):(n.body.dispose(),null==i||i.body.dispose())})).catch((function(e){var t,r;(null===(t=l.pendingTextureTask)||void 0===t?void 0:t.hash)===b&&(l.pendingTextureTask.onError(e),null===(r=l.panoMeshes[u.panoId])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("pano.texture.error",Xo("pano.texture.error",{error:e,progress:0,meta:null,pano:u.pano})),l.emit("error",e))})),this.emit("pano.texture.load",Xo("pano.texture.load",{error:null,progress:0,meta:null,pano:u.pano}))}},r.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(t){var n=e.initial,i=(n.state,n.currentState,n.duration),o=n.userAction;e.userAction=o;var a=r.initAnimationEndState(e),s={workCode:a.workCode,panoIndex:a.panoIndex},l=!1;e.moveToPano(s,{longitude:a.longitude,latitude:a.latitude,fov:a.fov,duration:i,moveStartCallback:function(t){l=!0,e.emit("initAnimation.start",Xo("initAnimation.start",{state:t,userAction:e.userAction}))},moveEndCallback:function(r){e.emit("initAnimation.end",Xo("initAnimation.end",{state:r,userAction:e.userAction})),e.initAnimationed=!0,t()},moveCancelCallback:function(){var r=$($($({},s),{mode:e.mode}),ra(e.camera.pose));!1===l&&e.emit("initAnimation.start",Xo("initAnimation.start",{state:r,userAction:e.userAction})),e.emit("initAnimation.end",Xo("initAnimation.end",{state:r,userAction:e.userAction})),e.initAnimationed=!0,t()}},o)}))},r.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},r.prototype.locationMotionKeyframesLength=function(e){for(var t=0,r=1;r<e.length;r++){var n=this.panoResourceFromLocationMotionKeyframe(e[r-1]).position,i=this.panoResourceFromLocationMotionKeyframe(e[r]).position;t+=n.distanceTo(i)*(e[r].value.count-e[r-1].value.count)}return t},r.prototype.updatePanoMeshes=function(){for(var e=this,t={},r=0,n=Object.keys(this.panoMeshes);r<n.length;r++){var i=n[r],o=this.panoMeshes[i];t[i]=o,delete this.panoMeshes[i]}for(var a=1,s={},l=function(t){var r=ea(t.accessibleIds,(function(r){var n=e.works.getResolvedObserver(r);return n?Or(n.standingPosition.distanceTo(t.standingPosition),1,1/0):1/0}),!0)[1];void 0===s[t.panoId]&&(s[t.panoId]=r)},u=0,c=this.works.resolvedObservers;u<c.length;u++)l(f=c[u]);var h=Object.keys(s).map((function(e){return s[e]}));h.length&&(a=Or(h.reduce((function(e,t){return e+t}),0)/h.length*.6,1,3));for(var p=0,d=this.works.resolvedObservers;p<d.length;p++){var f;o=void 0,t[(f=d[p]).panoId]?(!0===(o=t[f.panoId]).loading&&!1===f.loadable&&o.setLoading(!1),delete t[f.panoId]):((o=this.panoCircleMeshCreator(f.pano)).name="PanoCircleMesh_"+f.panoId,this.helper.add(o)),o.scale.set(a,1,a),o.position.copy(f.standingPosition),this.panoMeshes[f.panoId]=o}for(var v=0,m=Object.keys(t);v<m.length;v++){var A=m[v];this.helper.remove(t[A]),t[A].dispose(),delete t[A]}},r.prototype.doMoveToPano=function(t,r,n){var i,o,a,s,l=this;void 0===n&&(n={});var u,c,h,p=ue(),d=ki();if(this.tiling.cleanup(),this.panoResources[d]=r,this.locationMotion.ended){var f=this.locationMotion.getKeyFrameSegment(p),v=(f[0],f[1]),m=this.locationMotion.value,A=(null!==(i=this.panoResourceFromLocationMotionKeyframe(v))&&void 0!==i?i:this.camera).position,g=r.position;u=Math.max(A.distanceTo(g),1),c=[{key:v.key,progress:0,value:$($({},m),{count:0})},{key:d,progress:1,value:{distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0,count:1}}],h=0}else{var y=this.locationMotion.getKeyFrameSegment(p),b=y[0],x=(v=y[1],m=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(b).position),w=(A=this.panoResourceFromLocationMotionKeyframe(v).position,g=r.position,v.value.count-m.count),M=Math.max(x.distanceTo(A),1)*w;u=M+Math.max(A.distanceTo(g),1),c=[{key:b.key,progress:0,value:$({},m)},{key:v.key,progress:M/u,value:v.value},{key:d,progress:1,value:{count:v.value.count+1,distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0}}];var E=this.locationMotionKeyframesLength(this.locationMotion.keyframes),C=this.locationMotionKeyframesLength(c);h=0===E||0===E?0:this.locationMotion.getProgressVelocity(p)*E/C}var S=this.calculateMovingDuration(n.duration,"fade"===n.effect||"montage"===n.effect?0:u),I={longitude:n.longitude,latitude:n.latitude,fov:n.fov},P=$($({},t),{mode:this.mode,longitude:null!==(o=I.longitude)&&void 0!==o?o:this.camera.pose.longitude,latitude:null!==(a=I.latitude)&&void 0!==a?a:this.camera.pose.latitude,fov:null!==(s=I.fov)&&void 0!==s?s:this.camera.pose.fov,offset:r.position.clone(),distance:this.camera.pose.distance}),T=this.currentPano;this.emit("pano.moveTo",Xo("pano.moveTo",{options:n,prevPano:T,progress:0,state:P,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(P),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=se,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(I,S).catch(se),this.locationMotion.setKeyframes(c,S,h).then((function(){var r,i,o=$($({},t),{mode:l.mode,longitude:l.camera.pose.longitude,latitude:l.camera.pose.latitude,fov:l.camera.pose.fov,offset:l.camera.pose.offset.clone(),distance:l.camera.pose.distance});l.emit("pano.arrived",Xo("pano.arrived",{options:n,prevPano:T,progress:1,state:o,userAction:l.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(o);var a=l.works.getResolvedObserver(t);if(a&&a.video&&l.videoTexture&&l.videoTexture.image instanceof HTMLVideoElement){var s=Ja.clone().multiply(null!==(i=null===(r=l.models.getMaterial().pano1)||void 0===r?void 0:r.matrix)&&void 0!==i?i:new e.Matrix4).multiply(a.video.matrix),u={map:l.videoTexture,size:a.video.size,matrix:s,alpha:1},c=ki(),h=l.videoTexture.image;h.setAttribute("uuid",c),xa().then((function(e){e&&a.video&&h.getAttribute("uuid")===c&&(h.oncanplay=function(){h.oncanplay=se,h.play()},h.ontimeupdate=function(){h.currentTime>.5&&(h.ontimeupdate=se,l.panoVideo.setMaterial(u))},h.src=a.video.source)})).catch((function(){h.removeAttribute("uuid")}))}}),(function(){l.emit("pano.cancel",Xo("pano.cancel",{options:n,prevPano:T,progress:0,state:P,userAction:l.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()}))},r.prototype.getForwardObserverOrNot=function(t){var r=this,n=this.works.getResolvedObserver(this.currentPano);if(!n)return null;var i=null!=t?t:new e.Raycaster(this.camera.position.clone(),this.camera.getDirection(new e.Vector3)),o=n.standingPosition.clone();if(n.position.distanceTo(i.ray.origin)>1){var a=this.models.intersectRaycaster(new e.Raycaster(i.ray.origin,new e.Vector3(0,-1,0)))[0];a&&a.distance<=2?o.copy(a.point):o.copy(i.ray.origin).add(new e.Vector3(0,-1.5,0))}var s=this.models.intersectRaycaster(i)[0],l=(s?s.point:i.ray.origin.clone().add(i.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(o).normalize();if(0===l.length())return null;for(var u=n.accessibleIds.filter((function(e){if(e===Ke(r.currentPano))return!1;var t=r.works.getResolvedObserver(e);if(!t)return!1;var n=t.standingPosition.clone().project(r.camera);return!(Math.abs(n.z)>1)&&!(Math.abs(n.x)>1)&&!(Math.abs(n.y)>1)&&(t.loadable||t.active)})),c=u.slice().sort((function(e,t){return r.works.getResolvedObserver(e).standingPosition.clone().distanceTo(o)-r.works.getResolvedObserver(t).standingPosition.clone().distanceTo(o)})),h=0,p=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];h<p.length;h++)for(var d=p[h],f=0,v=c;f<v.length;f++){var m=v[f],A=this.works.getResolvedObserver(m);if(A){var g=A.standingPosition.clone().sub(o);if(g&&0!==g.length()&&l.angleTo(g)<d)return A}}return null},r.prototype.onTapGesture=function(t){var r,n=this;if(this.userAction=t.userAction,this.stopMomentumMovement(),this.initAnimationed){if(!this.locationMotion.ended&&this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]).panoId!==Ke(this.currentPano))return;var i=t.center.raycaster,o=this.camera.getDirection(new e.Vector3).setY(0),a=null,s=this.works.getResolvedObserver(this.currentPano);if(s){var l=s.accessibleIds.filter((function(e){if(e===Ke(n.currentPano))return!1;var t=n.works.getResolvedObserver(e);return!!t&&!(t.position.distanceTo(n.camera.position)>n.maxAccessibleDistance)&&(t.loadable||t.active)})),u=this.models.intersectRaycaster(i)[0];if(u){var c=ea(l,(function(e){var t=n.works.getResolvedObserver(e);return t?t.standingPosition.clone().distanceTo(u.point):1/0}),!0),h=c[0],p=c[1];h&&p<this.panoTapTriggerRadius&&(a=null!==(r=this.works.getResolvedObserver(h))&&void 0!==r?r:null)}a||(a=this.getForwardObserverOrNot(i));for(var d=0,f=this.locationMotion.keyframes;d<f.length;d++){var v=f[d],m=this.panoResourceFromLocationMotionKeyframe(v);if(!(v.progress<this.locationMotion.progress)&&a&&m.panoId===a.panoId){a=null;break}}if(a){for(var A={},g=Math.PI/6,y=Math.PI/12,b=a.position.clone().setY(0).sub(s.position.clone().setY(0)).normalize(),x=[],w=0,M=a.accessibleIds;w<M.length;w++){var E=We(h=M[w]);if(!Ye(E,this.currentPano)&&!Ye(E,a.pano)){var C=this.works.getResolvedObserver(h);if(C){var S=C.position.clone().sub(a.position).setY(0);b.angleTo(S)<g&&x.push(S)}}}var I=(x.length>0?x:re(re([],[],!0),[],!0)).slice().sort((function(e,t){return e.angleTo(b)-t.angleTo(b)}))[0];I&&I.angleTo(o)>y&&(A.longitude=Math.atan2(-I.x,-I.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(A.latitude=Or(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(A.fov=this.defaultFov);var P=$({},t.state);if(P.workCode=a.pano.workCode,P.panoIndex=a.pano.panoIndex,void 0!==A.longitude&&(P.longitude=A.longitude),void 0!==A.latitude&&(P.latitude=A.latitude),void 0!==A.fov&&(P.fov=A.fov),P.distance=0,P.offset=a.position.clone(),t.state=P,this.emit("gesture.tap",t),!t.defaultPrevented){if(this.emit("pano.select",Xo("pano.select",{prevPano:this.currentPano,state:P,userAction:t.userAction,options:A,progress:0,error:null})),a&&!a.active){var T=a.panoId;this.panoMeshes[T]&&(this.panoMeshes[T].setDisabled(!1),this.panoMeshes[T].setLoading(!0))}a&&a.active&&this.emit("pano.request",Xo("pano.request",{userAction:t.userAction,prevPano:this.currentPano,progress:0,state:P,options:A,error:null}))}}else this.emit("gesture.tap",t),t.defaultPrevented||!0===this.locationMotion.ended&&this.cameraBounce()}}},r}(ba),ts=Math.PI/180,rs=180/Math.PI,ns=function(){var e="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.platform);return function(){return e}}(),is=function(){var e="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return function(){return e}}(),os=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android");return function(){return e}}(),as=(Wa="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,Ya=Wa?parseInt(Wa[1],10):null,function(){return Ya}),ss=function(){var e=!1;if(65===as()){var t="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var r=t[1].split("."),n=(r[0],r[1],r[2]),i=r[3];e=3325===parseInt(n,10)&&parseInt(i,10)<148}}return function(){return e}}(),ls=function(){var e=ns()&&is()&&"undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("13_4");return function(){return e}}(),us=function(){var e="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("R7 Build");return function(){return e}}();function cs(){var e="undefined"!=typeof window&&(90==window.orientation||-90==window.orientation);return us()?!e:e}var hs,ps=(hs={},function(e,t){void 0===hs[e]&&(console.warn("cardboard: "+t),hs[e]=!0)});function ds(e){var t,r=e.indexOf("://");t=-1!==r?r+3:0;var n=e.indexOf("/",t);return-1===n&&(n=e.length),e.substring(0,n)}var fs,vs=function(e,t,r){var n,i,o,a,s,l,u,c,h,p,d,f,v,m,A,g,y,b;n=e,p=(o=(i=t)?i[0]:0)*(u=o+o),d=o*(c=(a=i?i[1]:0)+a),f=o*(h=(s=i?i[2]:0)+s),v=a*c,m=a*h,A=s*h,g=(l=i?i[3]:1)*u,y=l*c,b=l*h,n[0]=1-(v+A),n[1]=d+b,n[2]=f-y,n[3]=0,n[4]=d-b,n[5]=1-(p+A),n[6]=m+g,n[7]=0,n[8]=f+y,n[9]=m-g,n[10]=1-(p+v),n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,r&&function(e,t,r){var n,i,o,a,s,l,u,c,h,p,d,f,v=r[0],m=r[1],A=r[2];t===e?(e[12]=t[0]*v+t[4]*m+t[8]*A+t[12],e[13]=t[1]*v+t[5]*m+t[9]*A+t[13],e[14]=t[2]*v+t[6]*m+t[10]*A+t[14],e[15]=t[3]*v+t[7]*m+t[11]*A+t[15]):(n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=t[9],d=t[10],f=t[11],e[0]=n,e[1]=i,e[2]=o,e[3]=a,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=p,e[10]=d,e[11]=f,e[12]=n*v+s*m+h*A+t[12],e[13]=i*v+l*m+p*A+t[13],e[14]=o*v+u*m+d*A+t[14],e[15]=a*v+c*m+f*A+t[15])}(e,e,r),function(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],p=t[10],d=t[11],f=t[12],v=t[13],m=t[14],A=t[15],g=r*s-n*a,y=r*l-i*a,b=r*u-o*a,x=n*l-i*s,w=n*u-o*s,M=i*u-o*l,E=c*v-h*f,C=c*m-p*f,S=c*A-d*f,I=h*m-p*v,P=h*A-d*v,T=p*A-d*m,B=g*T-y*P+b*I+x*S-w*C+M*E;B&&(B=1/B,e[0]=(s*T-l*P+u*I)*B,e[1]=(i*P-n*T-o*I)*B,e[2]=(v*M-m*w+A*x)*B,e[3]=(p*w-h*M-d*x)*B,e[4]=(l*S-a*T-u*C)*B,e[5]=(r*T-i*S+o*C)*B,e[6]=(m*b-f*M-A*y)*B,e[7]=(c*M-p*b+d*y)*B,e[8]=(a*P-s*S+u*E)*B,e[9]=(n*S-r*P-o*E)*B,e[10]=(f*w-v*b+A*g)*B,e[11]=(h*b-c*w-d*g)*B,e[12]=(s*C-a*I-l*E)*B,e[13]=(r*I-n*C+i*E)*B,e[14]=(v*y-f*x-m*g)*B,e[15]=(c*x-h*y+p*g)*B)}(e,e)},ms=function(){function t(t,r){void 0===t&&(t=new e.Vector3),void 0===r&&(r=0),this.sample=t,this.timestampS=r}return t.prototype.set=function(e,t){this.sample=e,this.timestampS=t},t.prototype.copy=function(e){this.set(e.sample,e.timestampS)},t}(),As=function(){function t(t,r){this.kFilter=t,this.isDebug=r,this.currentAccelMeasurement=new ms,this.currentGyroMeasurement=new ms,this.previousGyroMeasurement=new ms,ns()?this.filterQ=new e.Quaternion(-1,0,0,1):this.filterQ=new e.Quaternion(1,0,0,1),this.previousFilterQ=new e.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new e.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new e.Vector3,this.measuredGravity=new e.Vector3,this.gyroIntegralQ=new e.Quaternion}return t.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},t.prototype.addGyroMeasurement=function(e,t){var r;this.currentGyroMeasurement.set(e,t),r=t-this.previousGyroMeasurement.timestampS,isNaN(r)||r<=.001||r>1||this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},t.prototype.getOrientation=function(){return this.filterQ},t.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,r=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(r),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(r);var n=new e.Quaternion;n.copy(this.filterQ),n.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(n),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var i,o=new e.Quaternion;o.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),o.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",rs*((i=o).w>1?0:2*Math.acos(i.w)),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));var a=new e.Quaternion;a.copy(this.filterQ),a.multiply(o),this.filterQ.slerp(a,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},t.prototype.accelToQuaternion_=function(t){var r=new e.Vector3;r.copy(t),r.normalize();var n=new e.Quaternion;return n.setFromUnitVectors(new e.Vector3(0,0,-1),r),n.inverse(),n},t.prototype.gyroToQuaternionDelta_=function(t,r){var n=new e.Quaternion,i=new e.Vector3;return i.copy(t),i.normalize(),n.setFromAxisAngle(i,t.length()*r),n},t}(),gs=function(){function t(t,r){this.predictionTimeS=t,this.isDebug=r,this.previousQ=new e.Quaternion,this.previousTimestampS=null,this.deltaQ=new e.Quaternion,this.outQ=new e.Quaternion}return t.prototype.getPrediction=function(t,r,n){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=n,t;var i=new e.Vector3;i.copy(r),i.normalize();var o=r.length();if(o<20*ts)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(rs*o).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;var a=o*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(i,a),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=n,this.outQ},t}(),ys=function(){function e(e){this.coefficients=e}return e.prototype.distortInverse=function(e){for(var t=0,r=1,n=e-this.distort(t);Math.abs(r-t)>1e-4;){var i=e-this.distort(r),o=r-i*((r-t)/(i-n));t=r,r=o,n=i}return r},e.prototype.distort=function(e){for(var t=e*e,r=0,n=0;n<this.coefficients.length;n++)r=t*(r+this.coefficients[n]);return(r+1)*e},e}(),bs=function(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null},xs=function(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0},ws=function(){function t(t,r,n,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=n,this.accelerometer=new e.Vector3,this.gyroscope=new e.Vector3,this.filter=new As(t,i),this.posePredictor=new gs(r,i),this.isFirefoxAndroid=os(),this.isIOS=ns();var o=as();this.isDeviceMotionInRadians=!this.isIOS&&null!==o&&o<66,this.isWithoutDeviceMotion=ss()||ls(),this.filterToWorldQ=new e.Quaternion,ns()?this.filterToWorldQ.setFromAxisAngle(new e.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new e.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new e.Quaternion,this.worldToScreenQ=new e.Quaternion,this.originalPoseAdjustQ=new e.Quaternion;var a="undefined"!=typeof window?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new e.Vector3(0,0,1),a),this.setScreenTransform_(),cs()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new e.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return t.prototype.getPosition=function(){return null},t.prototype.getOrientation=function(){var t;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(i=(new e.Quaternion).setFromAxisAngle(new e.Vector3(0,0,-1),0),o=new e.Quaternion,"undefined"!=typeof window&&-90===window.orientation?o.setFromAxisAngle(new e.Vector3(0,1,0),Math.PI/-2):o.setFromAxisAngle(new e.Vector3(0,1,0),Math.PI/2),i.multiply(o)),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((n=new e.Quaternion).setFromAxisAngle(new e.Vector3(1,0,0),-Math.PI/2),n),t=this._deviceOrientationQ;var r=new e.Quaternion;return r.copy(t),r.multiply(this.deviceOrientationFilterToWorldQ),r.multiply(this.resetQ),r.multiply(this.worldToScreenQ),r.multiplyQuaternions(this.deviceOrientationFixQ,r),this.yawOnly&&(r.x=0,r.z=0,r.normalize()),this.orientationOut_[0]=r.x,this.orientationOut_[1]=r.y,this.orientationOut_[2]=r.z,this.orientationOut_[3]=r.w,this.orientationOut_}var n,i,o,a=this.filter.getOrientation();t=this.posePredictor.getPrediction(a,this.gyroscope,this.previousTimestampS);var s=new e.Quaternion;return s.copy(this.filterToWorldQ),s.multiply(this.resetQ),s.multiply(t),s.multiply(this.worldToScreenQ),this.yawOnly&&(s.x=0,s.z=0,s.normalize()),this.orientationOut_[0]=s.x,this.orientationOut_[1]=s.y,this.orientationOut_[2]=s.z,this.orientationOut_[3]=s.w,this.orientationOut_},t.prototype.getPose=function(){var e=new bs;return e.orientation=this.getOrientation(),e},t.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),cs()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},t.prototype.getFrameData=function(e){var t=this.getOrientation(),r=this.getEyeOffset(),n=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(n.left),e.rightProjectionMatrix.set(n.right),vs(e.leftViewMatrix,t,r.left),vs(e.rightViewMatrix,t,r.right),e},t.prototype.start=function(){if("undefined"==typeof window)return function(){};var e=this.onDeviceMotion_.bind(this),t=this.onOrientationChange_.bind(this),r=this.onMessage_.bind(this),n=this.onDeviceOrientation_.bind(this);return ns()&&function(){if("undefined"==typeof window)return!1;if("undefined"==typeof document)return!1;var e=window.self!==window.top,t=ds(document.referrer),r=ds(window.location.href);return e&&t!==r}()&&window.addEventListener("message",r),window.addEventListener("orientationchange",t),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",n):window.addEventListener("devicemotion",e),function(){window.removeEventListener("devicemotion",e),window.removeEventListener("deviceorientation",t),window.removeEventListener("orientationchange",t),window.removeEventListener("message",r)}},t.prototype.getEyeOffset=function(){return{left:[.5*-this.viewer.interLensDistance,0,0],right:[.5*this.viewer.interLensDistance,0,0]}},t.prototype.getEyeProjectionMatrix=function(){var e,t,r=this.getEyeFieldOfView(),n=this.depthNear,i=this.depthFar,o={left:[],right:[]},a=r.left.upDegrees*ts,s=r.left.downDegrees*ts,l=2/((e=r.left.leftDegrees*ts)+(t=r.left.rightDegrees*ts)),u=2/(a+s);return o.left[0]=l,o.left[1]=0,o.left[2]=0,o.left[3]=0,o.left[4]=0,o.left[5]=u,o.left[6]=0,o.left[7]=0,o.left[8]=-(e-t)*l*.5,o.left[9]=(a-s)*u*.5,o.left[10]=i/(n-i),o.left[11]=-1,o.left[12]=0,o.left[13]=0,o.left[14]=i*n/(n-i),o.left[15]=0,a=r.right.upDegrees*ts,s=r.right.downDegrees*ts,l=2/((e=r.right.leftDegrees*ts)+(t=r.right.rightDegrees*ts)),u=2/(a+s),o.right[0]=l,o.right[1]=0,o.right[2]=0,o.right[3]=0,o.right[4]=0,o.right[5]=u,o.right[6]=0,o.right[7]=0,o.right[8]=-(e-t)*l*.5,o.right[9]=(a-s)*u*.5,o.right[10]=i/(n-i),o.right[11]=-1,o.right[12]=0,o.right[13]=0,o.right[14]=i*n/(n-i),o.right[15]=0,o},t.prototype.getEyeFieldOfView=function(){var e=this.viewer,t=this.device,r=new ys(e.distortionCoefficients),n=e.screenLensDistance,i=(t.widthMeters-e.interLensDistance)/2,o=e.interLensDistance/2,a=e.baselineLensDistance-t.bevelMeters,s=t.heightMeters-a,l=rs*Math.atan(r.distort(i/n)),u=rs*Math.atan(r.distort(o/n)),c=rs*Math.atan(r.distort(a/n)),h=rs*Math.atan(r.distort(s/n)),p=new xs,d=new xs;return p.leftDegrees=Math.min(l,e.fov),p.rightDegrees=Math.min(u,e.fov),p.downDegrees=Math.min(c,e.fov),p.upDegrees=Math.min(h,e.fov),d.leftDegrees=p.rightDegrees,d.rightDegrees=p.leftDegrees,d.upDegrees=p.upDegrees,d.downDegrees=p.downDegrees,{left:p,right:d}},t.prototype.onDeviceOrientation_=function(t){this._deviceOrientationQ=this._deviceOrientationQ||new e.Quaternion;var r=t.alpha,n=t.beta,i=t.gamma;r=(r||0)*Math.PI/180,n=(n||0)*Math.PI/180,i=(i||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new e.Euler(r,n,-i,"YXZ"))},t.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},t.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,r=e.rotationRate,n=e.timeStamp/1e3,i=n-this.previousTimestampS;return i<0?(ps("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=n)):i<=.001||i>1?(ps("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=n)):(t&&(this.accelerometer.set(-t.x,-t.y,-t.z),r&&(us()?this.gyroscope.set(-r.beta,r.alpha,r.gamma):this.gyroscope.set(r.alpha,r.beta,r.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,n)),this.filter.addAccelMeasurement(this.accelerometer,n)),void(this.previousTimestampS=n))},t.prototype.onOrientationChange_=function(){this.setScreenTransform_()},t.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&"devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent)},t.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),"undefined"!=typeof window?window.orientation:0){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new e.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new e.Vector3(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},t}(),Ms=[0,0,.5,1],Es=[.5,0,.5,1],Cs=function(){function t(t){var r=this;this.renderer=t,this.sensor=new ws(.98,.04,!1,!1),this.scale=1,this.cameraL=new e.PerspectiveCamera,this.cameraR=new e.PerspectiveCamera;var n=this.sensor.start();this.dispose=function(){var t=r.renderer.getSize(new e.Vector2);r.renderer.setScissor(0,0,t.width,t.height),r.renderer.setViewport(0,0,t.width,t.height),r.renderer.setScissorTest(!1),n()}}return t.prototype.render=function(t,r){var n=this.renderer.getSize(new e.Vector2);if(n.width>n.height){var i=t.autoUpdate;i&&(t.updateMatrixWorld(),t.autoUpdate=!1);var o={x:Math.round(n.width*Ms[0]),y:Math.round(n.height*Ms[1]),width:Math.round(n.width*Ms[2]),height:Math.round(n.height*Ms[3])},a={x:Math.round(n.width*Es[0]),y:Math.round(n.height*Es[1]),width:Math.round(n.width*Es[2]),height:Math.round(n.height*Es[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),null===r.parent&&r.updateMatrixWorld(),r.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),r.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var s=this.sensor.getEyeOffset();this.cameraL.translateOnAxis((new e.Vector3).fromArray(s.left),this.scale),this.cameraR.translateOnAxis((new e.Vector3).fromArray(s.right),this.scale);var l=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=l.left.slice(),this.cameraR.projectionMatrix.elements=l.right.slice(),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(t,this.cameraL),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(t,this.cameraR),this.renderer.setViewport(0,0,n.width,n.height),this.renderer.setScissor(0,0,n.width,n.height),this.renderer.setScissorTest(!1),i&&(t.autoUpdate=!0)}else this.renderer.render(t,r)},t.prototype.dispose=function(){},t}(),Ss={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},Is="undefined"!=typeof navigator&&null!==(fs=Ss[navigator.language.split("-")[0]])&&void 0!==fs?fs:Ss.zh,Ps="\n<style>\n.$id {\n all: initial;\n position: absolute;\n overflow: hidden;\n display: none;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n.$id-modal {\n width: 100%;\n height: 332px;\n position: absolute;\n bottom: -2px;\n left: 0;\n right: 0;\n overflow: hidden;\n pointer-events: none;\n will-change: transform;\n animation: $id-modal-fade-in 0.3s ease 1;\n}\n.$id-modal-bg {\n background: rgba(0, 0, 0, 0.75);\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n}\n.$id-modal-bg-line {\n height: 1px;\n background-image: linear-gradient(\n 85deg,\n rgba(162, 177, 255, 0.3) 1%,\n rgba(120, 126, 255, 0.8) 30%,\n rgba(147, 218, 255, 0.8) 66%,\n rgba(250, 255, 184, 0.3) 92%\n );\n}\n.$id-modal-bg-wave svg {\n width: 375px;\n height: 61px;\n display: block;\n}\n.$id-modal-content {\n color: #ffffff;\n padding: 0 14px;\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n overflow: hidden;\n}\n.$id-modal-content-title {\n font-size: 17px;\n font-family: sans-serif;\n line-height: 18px;\n padding: 20px 0;\n font-weight: bold;\n}\n.$id-modal-content-hit {\n font-size: 14px;\n font-family: sans-serif;\n line-height: 24px;\n opacity: 0.85;\n}\n.$id-modal-content-guide {\n position: relative;\n width: 168px;\n height: 139px;\n margin: 36px auto 0;\n}\n.$id-modal-content-guide-cardboard {\n position: absolute;\n width: 100px;\n height: 82px;\n left: 68px;\n top: 57px;\n}\n.$id-modal-content-guide-cardboard-image {\n width: 100px;\n height: 82px;\n background-image: url(".concat("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaAAAC/VBMVEUAAAD///99fX37+/v5+fn29vbx8fHv7+/Nzc3o6Ojq6urh4eHU1NTR0dGDg4Pl5eWSkpLHx8fj4+Pe3t7X19fAwMDZ2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RW4AcCkJArJN7d7SLtlx9VW8pXbdfN/6frfJPYUq58cqWivBpIlTrFRcJOObOe4SKx1Vsj20Cwjam01JODjiUpcbaE9jL4W9Hkla7tNgTI9XgxmtChiMie0F5G/930+vX6wOOsKvinKDlaFdrL4XOcipIACOpcxco820J7BfhsLH1F+jyUQxE2hvYqdEezo8lk8hQIavQFwiwN7ZV5Awa0+Mnh1nen/Z44BkLv9DljYHVorwbfgwGtf4iL2u+03weXYKJKi5pXE0J7FU5Bw8zz+N6Q0F4OD4EwvhWRJoX2UoZhUY9PZ2PYrNBewuAODLzDUMPjMQ8Kd6GIaMZaclxG8FfcIWsxGLkxGOzazl7AYKLn09idtd2qmP7ZiZsK24fHR20MLafPB6O2UTWAP1yGz7GpTmekAAAAAElFTkSuQmCC",");\n background-size: 100%;\n background-repeat: no-repeat;\n}\n.$id-modal-content-guide-phone {\n position: absolute;\n width: 58px;\n height: 56px;\n left: 0;\n top: 0;\n}\n.$id-modal-content-guide-phone-move-x {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n will-change: transform;\n animation: $id-guide-move-x 4s 0.5s infinite;\n}\n.$id-modal-content-guide-phone-move-y {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n will-change: transform;\n animation: $id-guide-move-y 4s cubic-bezier(0.42, 0, 0.23, 0.98) 0.5s infinite;\n}\n.$id-modal-content-guide-phone-blink {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n will-change: opacity;\n animation: $id-guide-blink 4s 0.5s infinite;\n}\n.$id-modal-content-guide-phone-image {\n width: 58px;\n height: 56px;\n background-image: url(").concat("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK4AAAClCAMAAADyFTYfAAAC+lBMVEUAAABISEhKSkpGRkZERERCQkJOTk45OTlBQUFQUFBSUlJUVFQ7OztYWFg/Pz8/Pz9aWlpkZGQ3NzdcXFxeXl5MTExHR0dhYWFJSUk9PT1WV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f+XuCT5CbTFnFRuxktuAAAAAElFTkSuQmCC",');\n background-size: 100%;\n background-repeat: no-repeat;\n}\n.$id-modal-close {\n position: absolute;\n top: 20px;\n right: 14px;\n width: 14px;\n height: 14px;\n}\n.$id-modal-close svg {\n width: 14px;\n height: 14px;\n display: block;\n}\n\n@keyframes $id-modal-fade-in {\n 0% { transform: translate3d(0, 100%, 0); opacity: 0.5; }\n 100% { transform: translate3d(0, 0, 0); opacity: 1; }\n}\n@keyframes $id-guide-blink {\n 0% { opacity: 0; }\n 7% { opacity: 0; }\n 12% { opacity: 1; }\n 29% { opacity: 1; }\n 34% { opacity: 0.3; }\n 39% { opacity: 1; }\n 44% { opacity: 0.3; }\n 49% { opacity: 1; }\n 80% { opacity: 1; }\n 100% { opacity: 0; }\n}\n@keyframes $id-guide-move-x {\n 0% { transform: translate3d(0, 0, 0); }\n 57% { transform: translate3d(0, 0, 0); }\n 80% { transform: translate3d(70px, 0, 0); }\n 100% { transform: translate3d(70px, 0, 0); }\n}\n@keyframes $id-guide-move-y {\n 0% { transform: translate3d(0, 0, 0); }\n 57% { transform: translate3d(0, 0, 0); }\n 80% { transform: translate3d(0, 58px, 0); }\n 100% { transform: translate3d(0, 58px, 0); }\n}\n@media screen and (orientation: portrait) {\n .$id {\n display: block;\n }\n}\n</style>\n<div class="$id-modal">\n <div class="$id-modal-bg">\n <div class="$id-modal-bg-line"></div>\n <div class="$id-modal-bg-wave">\n <svg width="375" height="61" viewBox="0 0 375 61" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <linearGradient x1="0" y1="0%" x2="0" y2="100%" id="$id-2y6_dj_hgp">\n <stop stop-color="#8598FF" stop-opacity="0.15" offset="0%"></stop>\n <stop stop-color="#000" stop-opacity="0" offset="100%"></stop>\n </linearGradient>\n </defs>\n <path transform="translate(187.5, 30.5) scale(-1, 1) translate(-187.5, -30.5)" fill="url(#$id-2y6_dj_hgp)" d="\nM0,1\nC83.001,1.706 140.146,4.164 171.435,8.374\nC218.369,14.688 253.467,26.308 273.002,33\nC292.536,39.691323.501,51 343.709,56\nC357.182,59.333 367.612,61 375,61\nL375,0\nL0,0\nL0,1\nZ\n"></path>\n </svg>\n </div>\n </div>\n <div class="$id-modal-content">\n <div class="$id-modal-content-title">').concat(Is.TITLE,'</div>\n <div class="$id-modal-content-hit">').concat(Is.HIT,'</div>\n <div class="$id-modal-content-guide">\n <div class="$id-modal-content-guide-phone">\n <div class="$id-modal-content-guide-phone-move-x">\n <div class="$id-modal-content-guide-phone-move-y">\n <div class="$id-modal-content-guide-phone-blink">\n <div class="$id-modal-content-guide-phone-image"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="$id-modal-content-guide-cardboard">\n <div class="$id-modal-content-guide-cardboard-image"></div>\n </div>\n </div>\n </div>\n <div class="$id-modal-close">\n <svg width="14" height="14" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="70%" id="$id-ho0itsc4p9">\n <stop stop-color="#FFF" stop-opacity="0.75" offset="0%"></stop>\n <stop stop-color="#FFF" stop-opacity="0.22" offset="100%"></stop>\n </radialGradient>\n </defs>\n <path transform="translate(-3, -3)" fill="url(#$id-ho0itsc4p9)" fill-rule="nonzero" d="\nM16.791,3.198\nC17.044,3.438 17.067,3.814 16.860,4.080\nL16.791,4.156\nL12.144,9.331\nC11.803,9.711 11.803,10.288 12.144,10.668\nL16.791,15.843\nC17.044,16.084 17.067,16.460 16.860,16.725\nL16.791,16.801\nC16.538,17.042 16.142,17.063 15.864,16.867\nL15.784,16.801\nL10.000,11.250\nL4.215,16.801\nL4.135,16.867\nC3.857,17.063 3.461,17.042 3.208,16.801\nL3.208,16.801\nL3.139,16.725\nC2.932,16.460 2.955,16.084 3.208,15.843\nL3.208,15.843\nL7.855,10.668\nC8.196,10.288 8.196,9.711 7.855,9.331\nL7.855,9.331\nL3.208,4.156\nL3.139,4.080\nC2.932,3.814 2.955,3.438 3.208,3.198\nC3.486,2.933 3.937,2.933 4.215,3.198\nL4.215,3.198 L9.999,8.749\nL15.784,3.198\nC16.062,2.933 16.513,2.933 16.791,3.198\nZ\n"></path>\n </svg>\n </div>\n</div>\n');var Ts=new e.CircleBufferGeometry(.12,16),Bs=function(t){function r(){var r=t.call(this)||this;r.progress=0,r.opacity=0,r.loading=!1,r.current=!1,r.disabled=!1,r.currentMotion=new Eo({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),r.opacityMotion=new Eo({opacity:0}),r.loadingMotion=new Eo({opacity:0}),r.disableMotion=new Eo({opacity:0});var n={blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendSrcAlpha:e.OneFactor,blendDstAlpha:e.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return r.hitTestMesh=new e.Mesh(Ts,new e.MeshBasicMaterial($($({},n),{color:0,opacity:0}))),r.hitTestMesh.scale.set(1.5,1.5,1.5),r.ringMesh=new e.Mesh(Ts,new e.ShaderMaterial($($({},n),{vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nvarying vec2 vUv;\nuniform float opacity;\n\nfloat smoothDist = 0.01;\nvoid main() {\n vec2 center = vec2(0.5, 0.5);\n float dist = length(center - vUv);\n float outerDist = 0.49;\n float innerDist = 0.29;\n\n float outside = 1.0 - smoothstep(outerDist - smoothDist, outerDist, dist);\n float inside = smoothstep(innerDist, innerDist + smoothDist, dist);\n\n vec4 bg = vec4(0.576, 0.635, 1.0, 0.3);\n float gradientAlpha = clamp(abs(dist - (outerDist + innerDist) / 2.0) / (outerDist - innerDist) * 1.5 + 0.1, 0.0, 1.0);\n vec4 gradient = vec4(1.0, 1.0, 1.0, gradientAlpha);\n\n gl_FragColor = mix(bg, gradient, gradient.a);\n\n gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);\n}\n",uniforms:{opacity:{value:0}}}))),r.panoMesh=new e.Mesh(Ts,new e.ShaderMaterial($($({},n),{vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform float circleScale;\nuniform float circleFade;\nuniform float circleOpacity;\nuniform float loadingAngle;\nuniform float loadingOpacity;\nuniform float opacity;\nuniform float disable;\nvarying vec2 vUv;\n\n#define PI 3.141592653589793\n#define TAU 6.283185307179586\n#define SMOOTH_DIST 0.017\n#define CENTER vec2(0.5, 0.5)\n\nfloat inside(float innerDist) {\n float dist = length(CENTER - vUv);\n return smoothstep(innerDist, innerDist + SMOOTH_DIST, dist);\n}\nfloat outside(float outerDist) {\n float dist = length(CENTER - vUv);\n return 1.0 - smoothstep(outerDist - SMOOTH_DIST, outerDist, dist);\n}\n\nvec4 create_circle() {\n float dist = length(CENTER - vUv);\n float gradient = clamp(0.98 + abs(dot(normalize(vec2(1.0, -1.0)), vUv - CENTER)) * 2.0, 0.0, 1.0);\n vec3 color = mix(vec3(0.576, 0.635, 1.0), vec3(1.0, 1.0, 1.0), circleFade * 0.5);\n return vec4(color, 1.0 * gradient * circleOpacity * outside(0.3 * circleScale));\n}\n\nvec4 create_disable() {\n float dist = length(CENTER - vUv);\n return vec4(1.0, 1.0, 1.0, 0.5 * outside(0.32 * circleScale));\n}\n\nvec4 create_loading() {\n float angle = PI - atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n angle = mod(angle + loadingAngle, TAU);\n float gradient = (1.0 - smoothstep(0.0, TAU, angle)) * 0.9 + 0.1;\n return vec4(1.0, 1.0, 1.0, gradient * loadingOpacity * inside(0.2 * circleScale) * outside(0.25 * circleScale));\n}\n\nvoid main() {\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0);\n\n vec4 circleColor = create_circle();\n gl_FragColor = mix(gl_FragColor, circleColor, circleColor.a);\n\n vec4 loadingColor = create_loading();\n gl_FragColor = mix(gl_FragColor, loadingColor, loadingColor.a);\n\n gl_FragColor = mix(gl_FragColor, create_disable(), disable);\n\n gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);\n}\n",uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),r.add(r.hitTestMesh),r.add(r.ringMesh),r.add(r.panoMesh),r.renderOrder=1e4,r.needsRender=!0,r}return Z(r,t),r.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},r.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=Or(e,0,1),this.opacityMotion.set({opacity:e},30).catch(se))},r.prototype.setCurrent=function(e){if(this.current!==e){if(e){var t=[{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}}];this.currentMotion.setKeyframes(t,1500).catch(se)}else t=[{progress:0,value:$({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}],this.currentMotion.setKeyframes(t,200).catch(se);this.current=e}},r.prototype.setLoading=function(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(se):this.loadingMotion.set({opacity:0},0).catch(se),this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.needsRender=!0)},r.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(se),this.needsRender=!0)},r.prototype.tap=function(){return Promise.resolve()},r.prototype.updateTime=function(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var r=this.opacityMotion.value.opacity;this.visible=0!==r;var n=this.currentMotion.value,i=n.ringScale,o=n.ringOpacity,a=n.circleFade,s=n.circleOpacity,l=n.circleScale;this.ringMesh.scale.set(i,1,i),this.ringMesh.material.uniforms.opacity.value=o*r,this.panoMesh.material.uniforms.opacity.value=r,this.panoMesh.material.uniforms.circleOpacity.value=s,this.panoMesh.material.uniforms.circleScale.value=l,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%(2*Math.PI),this.needsRender=!0},r.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},r}(e.Object3D),Rs=function(t){function r(e){var n=this,i=r.parseArgs(e);(n=t.call(this,i)||this).mode="VRPanorama",n.cardboard=new Cs(n.renderer);var o,a,s,l=(a=function(e){for(var t=1,r=document.getElementsByTagName("meta"),n=0;n<r.length;n++){var i=r[n];if("viewport"===i.getAttribute("name")){var o=(i.getAttribute("content")||"").match(/initial\-scale\=([\d|\.]+)/);o&&(t=Number(o[1])),isNaN(t)&&(t=1)}}return Ps.replace(/\n/g," ").replace(/\ +/g," ").replace(/\$id/g,e).replace(/(\d+)px/g,(function(e,r){return function(e){return Math.floor(e*t)+"px"}(Number(r))}))}(o="five_vr_helper_"+ki()),(s=document.createElement("div")).className=o,s.innerHTML=a,s);n.helperElement=l;var u=new ia(l);return n.element.parentNode&&(n.element.parentNode.insertBefore(l,n.element),n.setHelperElementSize(),u.on("tap",(function(){return n.emit("vr.requestExit",Xo("vr.requestExit",{}))}))),n.destroyHelper=function(){u.destroy(),l.parentNode&&l.parentNode.removeChild(l),delete n.helperElement},n}return Z(r,t),r.parseArgs=function(e){if(e instanceof r)return e;var n=$($({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return t.parseArgs.call(this,n)},r.initAnimationEndState=function(e){var r=this.parseArgs(e),n=t.initAnimationEndState.call(this,r);return $($({},n),{mode:"VRPanorama"})},r.prototype.destroy=function(){t.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var e=0,r=Object.keys(this.panoMeshes);e<r.length;e++){var n=r[e],i=this.panoMeshes[n];this.helper.remove(i),i.dispose(),delete this.panoMeshes[n]}},r.prototype.isReady=function(){return!1},r.prototype.updateRenderSize=function(){this.needsRender=!0,this.setHelperElementSize()},r.prototype.updatePanoMeshesVisible=function(){for(var e=this.works.getResolvedObserver(this.currentPano),t=(e?e.visibleIds:[]).concat(Ke(this.currentPano)),r=0,n=this.works.resolvedObservers;r<n.length;r++){var i=n[r],o=this.panoMeshes[i.panoId];o&&(t.indexOf(i.panoId)>=0?o.parent!==this.helper&&this.helper.add(o):o.parent===this.helper&&(this.helper.remove(o),o.setOpacity(0)))}},r.prototype.updatePanoMeshes=function(){for(var e=0,t=Object.keys(this.panoMeshes);e<t.length;e++){var r=t[e],n=this.panoMeshes[r];this.helper.remove(n),n.dispose(),delete this.panoMeshes[r]}for(var i=0,o=this.works.resolvedObservers;i<o.length;i++){var a=o[i],s=a.panoId,l=new Bs;l.name="panoSphere_".concat(s),l.position.copy(a.position),l.needsRender=!0,this.panoMeshes[s]=l}this.updatePanoMeshesVisible()},r.prototype.updateTime=function(t,r){for(var n,i,o,a,s,l,u=[],c=2;c<arguments.length;c++)u[c-2]=arguments[c];if(!this.destroyed){var h=this.currentPano;this.needsRender=!0;var p={},d={};if(!1===this.locationMotion.ended){this.locationMotion.update(t);var f=this.locationMotion.getKeyFrameSegment(t),v=f[0],m=f[1],A=this.panoResourceFromLocationMotionKeyframe(v),g=this.panoResourceFromLocationMotionKeyframe(m),y=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),b=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),x=A.position,w=g.position,M=this.locationMotion.value.count-m.value.count+1;p.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Or(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,p.useBlackTransition="instant"===g.effect,g.panoPicture&&(M<1?A.panoPicture&&(p.pano0=A.panoPicture):p.pano0=g.panoPicture,p.pano1=g.panoPicture),"fade"===g.effect&&(p.pano0&&A.panoPicture&&(p.pano0={map:p.pano0.map,luminanceMap:p.pano0.luminanceMap,matrix:A.panoPicture.matrix.clone().setPosition(g.position)}),x.copy(w)),p.progress=M,d.distance=this.locationMotion.value.distance,d.offset=new e.Vector3(x.x+(w.x-x.x)*M,x.y+(w.y-x.y)*M,x.z+(w.z-x.z)*M);for(var E=[],C=[],S=0,I=this.locationMotion.keyframes;S<I.length;S++){var P=I[S],T=P.key,B=P.progress;void 0!==T&&(E.push(T),B>=this.locationMotion.progress&&C.push(T))}for(var R=0,O=Object.keys(this.panoResources);R<O.length;R++){var k=O[R];if(!(C.indexOf(k)>=0)){var D=this.panoResources[k];if(D.panoPicture){var L=D.panoPicture.map;if(L){if(L===(null===(n=p.pano0)||void 0===n?void 0:n.map))continue;if(L===(null===(i=p.pano1)||void 0===i?void 0:i.map))continue;L.dispose(),D.panoPicture=null}}E.indexOf(k)>=0||delete this.panoResources[k]}}this.currentPano=We(g.panoId),this.emit("pano.moving",Xo("pano.moving",{userAction:this.userAction,prevPano:We(y.panoId),state:$($($($({},We(b.panoId)),{mode:this.mode}),ra(this.camera.pose)),d),options:{},progress:this.locationMotion.progress,error:null}))}!1===ta(p)&&((null===(o=p.pano0)||void 0===o?void 0:o.map)&&p.pano0.map instanceof Ot&&!p.pano0.map.cubeRenderTarget&&(p.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(a=p.pano0)||void 0===a?void 0:a.luminanceMap)&&p.pano0.luminanceMap instanceof Ot&&!p.pano0.luminanceMap.cubeRenderTarget&&(p.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),(null===(s=p.pano1)||void 0===s?void 0:s.map)&&p.pano1.map instanceof Ot&&!p.pano1.map.cubeRenderTarget&&(p.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(l=p.pano1)||void 0===l?void 0:l.luminanceMap)&&p.pano1.luminanceMap instanceof Ot&&!p.pano1.luminanceMap.cubeRenderTarget&&(p.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(p)),d.offset&&this.camera.position.copy(d.offset),Ye(this.currentPano,h)&&this.updatePanoMeshesVisible();var F=this.camera.pose.longitude,Q=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.updateMatrixWorld(),this.camera.computePose();var N=this.works.getResolvedObserver(this.currentPano);if(N)for(var V=0,U=N.visibleIds.concat(Ke(this.currentPano));V<U.length;V++){var z=U[V],_=We(z);if(W=this.works.getResolvedObserver(_)){var q=this.panoMeshes[z];if(W.loadable||W.active){var H=q.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);H<.05?q.setOpacity(0):q.setOpacity(Or(1.5/H,0,1)),Ye(this.currentPano,_)&&q.setOpacity(0),q.lookAt(this.camera.position)}else q.setOpacity(0)}}for(var j=this.intersect(t),G=0,K=this.works.resolvedObservers;G<K.length;G++){var W=K[G];(q=this.panoMeshes[W.panoId])&&(q.setCurrent(q===j),q.updateTime&&q.updateTime(t,r))}F===this.camera.pose.longitude&&Q===this.camera.pose.latitude||(this.cameraMotion.set(Yn(this.camera.pose,["longitude","latitude"]),0).catch(se),this.emit("camera.update",Xo("camera.update",{userAction:!0,state:$($($({},this.currentPano),{mode:this.mode}),ra(this.camera.pose))})))}},r.prototype.render=function(){this.cardboard.render(this.scene,this.camera)},r.prototype.setCamera=function(e){void 0===e&&(e={})},r.prototype.destroyHelper=function(){},r.prototype.setHelperElementSize=function(){if(this.helperElement){var t=new e.Vector2(this.element.offsetWidth,this.element.offsetHeight),r=t.x*this.scissor.left,n=t.y*(1-this.scissor.bottom-this.scissor.height),i=t.x*this.scissor.width,o=t.y*this.scissor.height;this.helperElement.style.marginLeft=r+"px",this.helperElement.style.marginTop=n+"px",this.helperElement.style.width=i+"px",this.helperElement.style.height=o+"px"}},r.prototype.intersect=function(t){var r;if(!1===this.locationMotion.ended)return this.intersectMesh.visible=!1,delete this.activePanoMesh,void delete this.activeTime;if(this.activePanoMesh&&this.activeTime&&t-this.activeTime>1500){for(var n=this.activePanoMesh,i=null,o=0,a=Object.keys(this.panoMeshes);o<a.length;o++){var s=a[o];if(this.panoMeshes[s]===n){i=s;break}}return null!==i&&this.moveToPano(We(i),{},!0),delete this.activePanoMesh,delete this.activeTime,n}for(var l=this.camera.getDirection(new e.Vector3),u=new e.Raycaster(this.camera.position,l),c=void 0,h=[],p=this.works.getResolvedObserver(this.currentPano),d=0,f=p?p.visibleIds:[];d<f.length;d++){i=f[d];var v=this.panoMeshes[i],m=u.intersectObject(null!==(r=v.hitTestMesh)&&void 0!==r?r:v,!0)[0];m&&h.push({panoMesh:v,intersection:m})}var A=h.sort((function(e,t){return e.intersection.distance-t.intersection.distance}))[0];A?(c=A.intersection,this.activePanoMesh!==A.panoMesh&&(this.activePanoMesh=A.panoMesh,this.activeTime=t),this.intersectMesh.position.copy(A.panoMesh.position),this.intersectMesh.lookAt(this.camera.position),this.intersectMesh.visible=!1):(this.activePanoMesh=void 0,this.activeTime=void 0),c||(c=this.models.intersectRaycaster(u)[0]);var g=Xo("intersect.update",{raycaster:u,intersection:null!=c?c:null,object:this.intersectMesh});if(this.emit("intersect.update",g),!g.defaultPrevented){if(c&&c.face){var y=c.face.normal,b=new e.Quaternion;b.setFromUnitVectors(new e.Vector3(0,0,1),y),this.intersectMesh.quaternion.copy(b);var x=y.clone().multiplyScalar(.05),w=c.point.clone().add(x);this.intersectMesh.position.copy(w),this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return null==A?void 0:A.panoMesh}this.hideIntersectMesh()},r.prototype.onPanGesture=function(){},r.prototype.onTapGesture=function(){},r.prototype.onPinchGesture=function(){},r.prototype.onMouseMove=function(){},r.prototype.onMouseOut=function(){},r}(es),Os=new e.Vector3(0,1.6,0),ks=function(t){function r(e){var n,i=this,o=r.parseArgs(e);return(i=t.call(this,o)||this).mode="Model",i.locationMotion=new Eo({x:i.camera.pose.offset.x,y:i.camera.pose.offset.y,z:i.camera.pose.offset.z,distance:i.camera.pose.distance,modelAlpha:null!==(n=i.models.getMaterial().modelAlpha)&&void 0!==n?n:0,perspToOrtho:i.camera.perspToOrtho.x,orthoDistance:i.camera.orthoDistance}),i}return Z(r,t),r.parseArgs=function(e){return e instanceof r?e:t.parseArgs.call(this,e)},r.initAnimationEndState=function(e){var r=this.parseArgs(e),n=t.initAnimationEndState.call(this,r);return $($({},n),{mode:"Model"})},r.prototype.destroy=function(){t.prototype.destroy.call(this),this.locationMotion.dispose()},r.prototype.isReady=function(){return!1!==this.locationMotion.ended},r.prototype.updateWork=function(e,t,n,i){this.works=e;var o=r.initAnimationEndState($($({},this),{initial:{currentState:$($({},this.currentPano),this.camera.pose),duration:n,state:t,userAction:i}}));this.hideIntersectMesh();var a={duration:0,longitude:o.longitude,latitude:o.latitude,fov:o.fov};return this.moveToPano(this.currentPano,a,i),!0},r.prototype.updateTime=function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(!this.destroyed){var o={},a={};if(!this.locationMotion.ended){this.locationMotion.update(t),o.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Or(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,a.distance=this.locationMotion.value.distance,a.offset=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var s=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=ea(this.works.resolvedObservers,(function(e){return e.position.distanceTo(s)}));this.currentPano=l?{workCode:l.work.workCode,panoIndex:l.panoIndex}:{workCode:"",panoIndex:0}}this.cameraMotion.ended||(this.cameraMotion.update(t),a.longitude=this.cameraMotion.value.longitude,a.latitude=this.cameraMotion.value.latitude,a.fov=this.cameraMotion.value.fov),ta(o)||this.models.setMaterial(o),ta(a)||this.setCamera(a)}},r.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(t){var n=e.initial,i=(n.state,n.currentState,n.duration),o=n.userAction;e.userAction=o;var a=r.initAnimationEndState(e),s={workCode:a.workCode,panoIndex:a.panoIndex};e.moveToPano(s,{longitude:a.longitude,latitude:a.latitude,fov:a.fov,duration:i,moveStartCallback:function(t){e.emit("initAnimation.start",Xo("initAnimation.start",{state:t,userAction:e.userAction}))},moveEndCallback:function(r){e.emit("initAnimation.end",Xo("initAnimation.end",{state:r,userAction:e.userAction})),t()},moveCancelCallback:function(){var r=e.currentPano,n=$($({},r),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",Xo("initAnimation.end",{state:n,userAction:e.userAction})),t()}},o)}))},r.prototype.getTargetState=function(){var t=this.cameraMotion.getKeyFrameSegment(ue())[1],r=this.locationMotion.getKeyFrameSegment(ue())[1];return $($({},this.currentPano),{mode:this.mode,longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,offset:new e.Vector3(r.value.x,r.value.y,r.value.z),distance:r.value.distance})},r.prototype.moveToPano=function(e,t,r){void 0===t&&(t={});var n=this.works.getResolvedObserver(e);n&&this.moveToPosition(n.position,t,r)},r.prototype.moveToPosition=function(t,r,n){var i,o,a,s=this;void 0===r&&(r={}),this.userAction=n,this.stopMomentumMovement();for(var l=ue(),u=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),c=u.distanceTo(t),h=this.locationMotion.getProgressVelocity(l),p=0,d=1;d<this.locationMotion.keyframes.length;d++){var f=this.locationMotion.keyframes[d-1].value,v=f.x,m=f.y,A=f.z,g=this.locationMotion.keyframes[d].value,y=g.x,b=g.y,x=g.z;p+=Math.sqrt(Math.pow(y-v,2)+Math.pow(b-m,2)+Math.pow(x-A,2))}var w=0===c?0:h*p/c,M=this.calculateMovingDuration(r.duration,c),E={x:t.x,y:t.y,z:t.z,distance:0,modelAlpha:1,perspToOrtho:0,orthoDistance:1},C={longitude:r.longitude,latitude:r.latitude,fov:r.fov},S=ea(this.works.resolvedObservers,(function(e){return e.position.distanceTo(u)})),I=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:"",panoIndex:0},P=$($({},I),{mode:this.mode,longitude:null!==(i=C.longitude)&&void 0!==i?i:this.camera.pose.longitude,latitude:null!==(o=C.latitude)&&void 0!==o?o:this.camera.pose.latitude,fov:null!==(a=C.fov)&&void 0!==a?a:this.camera.pose.fov,offset:t.clone(),distance:0}),T=this.currentPano;this.emit("pano.moveTo",Xo("pano.moveTo",{options:r,prevPano:T,progress:0,state:P,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(P),this.cameraMotion.set(C,M).catch(se),this.locationMotion.set(E,M,w).then((function(){var e=$($($({},I),{mode:s.mode}),ra(s.camera.pose));s.emit("pano.arrived",Xo("pano.arrived",{options:r,prevPano:T,progress:0,state:e,userAction:s.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(e)}),(function(){r.moveCancelCallback&&r.moveCancelCallback(),s.emit("pano.cancel",Xo("pano.cancel",{options:r,prevPano:T,progress:0,state:P,userAction:s.userAction,error:null}))}))},r.prototype.onTapGesture=function(t){var r=t.center.raycaster;this.stopMomentumMovement();var n=this.models.intersectRaycaster(r)[0];if(n&&n.face){var i=n.face.normal,o=n.point;if(new e.Vector3(0,1,0).angleTo(i)>Math.PI/3){var a=i.clone().setLength(.3).add(o);r.set(a,new e.Vector3(0,-1,0)),n=this.models.intersectRaycaster(r)[0]}}if(n){var s=(new e.Vector3).copy(n.point).add(Os),l=ea(this.works.resolvedObservers,(function(e){return e.position.distanceTo(s)}),!0),u=l[0],c=l[1];u&&c<5&&(s.y=u.position.y),t.state.offset.copy(s),t.state.distance=0,this.emit("gesture.tap",t),t.defaultPrevented||this.moveToPosition(s,{},!0)}else this.emit("gesture.tap",t),t.defaultPrevented||this.cameraBounce()},r}(ba);const Ds=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("{vs|z-rp@-}n{|]|vv|{H{vs|z-znA-}n{|ZnvH{vs|z-nz}yr?Q-}n{|Qv}ynprzr{Zn}H<<{vs|z-sy|n-pnyrHn\bv{t-rp@-}n{|d|yq]|vv|{H<<-n\bv{t-sy|n-vU|yrHp|{-sy|n-]V-J-@;>A>BF?CHp|{-sy|n-aNb-J-C;?E@>EB?Hp|{-sy|n-pnyr-J->@;>Hrp?-|P||q5rp@-rp|6-\n--sy|n--J-yr{tu5rp|6H--sy|n-urn-J-np|5:rp|;\b-<-6H--sy|n-}uv-J-nn{5rp|;9-rp|;\t6H--r{-rp?5=;B-8-}uv-<-aNb9-urn-<-]V6H\f|vq-znv{56-\n--rpA-|yq]|vv|{-J-z|qryZnv-7-rpA5}|vv|{9->;=6H--}n{|d|yq]|vv|{-J-5rpA5|yq]|vv|{;\b\t9->;=6-7-}n{|Znv6;\b\tH--rp?-p||q-J-|P||q5}n{|d|yq]|vv|{6H--sy|n-qvn{pr-J-pnyrH--vs-5p||q;\b-I-=;>B6-\n----rp?-n{s|zrqP||q-J-rp?5p||q;9-=;=6H----rpA-}n{|Qv}ynprzr{-J-rr?Q5}n{|Qv}ynprzr{Zn}9-n{s|zrqP||q6H----qvn{pr-J-pnyr-7-}n{|Qv}ynprzr{;H----qvn{pr-J-qvn{pr-7-p|5]V-7-5=;>B-:-p||q;\b66H----qvn{pr-J-pnyrH--\f-ryr-vs-5p||q;\b-KJ-=;>B-33-p||q;\b-IJ-=;EB6-\n----rp?-n{s|zrqP||q-J-rp?5p||q;9-5p||q;\b-:-=;>B6-<-=;D6H----rpA-}n{|Qv}ynprzr{-J-rr?Q5}n{|Qv}ynprzr{Zn}9-n{s|zrqP||q6H----vs5-}n{|Qv}ynprzr{;-JJ-=;=6\n------qvn{pr-J-pnyrH----\fryr\n------qvn{pr-J-pnyr-7-}n{|Qv}ynprzr{;H----\f--\f-ryr-\n----rp?-n{s|zrqP||q-J-rp?5p||q;9->;=6H----rpA-}n{|Qv}ynprzr{-J-rr?Q5}n{|Qv}ynprzr{Zn}9-n{s|zrqP||q6H----qvn{pr-J-pnyr-7-}n{|Qv}ynprzr{;H----qvn{pr-J-qvn{pr-7-p|5]V-7-5p||q;\b-:-=;EB66H----qvn{pr-J-pnyrH--\f--rpA-ry]|vv|{-J-rpA5}|vv|{-8-}n{|]|vv|{-8-{|znyv\tr5|yq]|vv|{;\b\t6-7-qvn{pr9->;=6H--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-ry]|vv|{H\f"),Ls=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("{vs|z-sy|n-|}npv\bH{vs|z-nz}yrPor-}n{|Zn}H{vs|z-nz}yr?Q-}n{|Qv}ynprzr{Zn}Hn\bv{t-rp@-}n{|d|yq]|vv|{H|vq-znv{56-\n--rpA-}n{|P|y|-J-rrPor5}n{|Zn}9-}n{|d|yq]|vv|{;\b\t6H--tylSntP|y|-J-rpA5}n{|P|y|;to9-|}npv\b6H\f");var Fs=Object.assign({opacity:new e.Uniform(1),scale:new e.Uniform(13.1),panoMap:new e.Uniform(null),panoDisplacementMap:new e.Uniform(null),panoPosition:new e.Uniform(new e.Vector3),panoMatrix:new e.Uniform(new e.Matrix4)},{emissive:new e.Uniform(new e.Color(0)),emissiveMap:new e.Uniform(null),specular:new e.Uniform(new e.Color(1118481)),specularMap:new e.Uniform(null),normalMap:new e.Uniform(null),bumpMap:new e.Uniform(null),shininess:new e.Uniform(30)},e.UniformsLib.common,e.UniformsLib.lights),Qs=new e.SphereBufferGeometry(.01,128,128),Ns=function(){function t(){this.textureLoader=new kt}return t.prototype.load=function(t,r,n,i,o,a,s){var l=[0,0],u=function(e,t){l[t]=e,a(.8*l[0]+.2*l[1])},c=[this.textureLoader.loadTexture(t,{imageURL:n.imageURL,viaAjax:!0,allowHosts:n.allowHosts,networkSubscribe:n.networkSubscribe,requestProxy:n.requestProxy},void 0,void 0,(function(e){return u(e,1)}),s),this.textureLoader.loadCubeTexture(r,{imageURL:n.imageURL,viaAjax:!0,allowHosts:n.allowHosts,networkSubscribe:n.networkSubscribe,requestProxy:n.requestProxy},void 0,void 0,(function(e){return u(e,0)}),s)];return Promise.all(c).then((function(t){var r=t[0],o=t[1],a=function(t,r,n,i){var o=new e.ShaderMaterial({side:e.BackSide,vertexShader:Ds,fragmentShader:Ls,transparent:!0,uniforms:e.UniformsUtils.clone(Fs)}),a=r;return a.needsUpdate=!0,a.minFilter=e.LinearFilter,a.magFilter=e.LinearFilter,t.needsUpdate=!0,t.minFilter=e.LinearFilter,t.magFilter=e.LinearFilter,o.uniforms.opacity.value=0,o.uniforms.panoMap.value=a,o.uniforms.panoDisplacementMap.value=t,o.uniforms.panoPosition.value=n,o.uniforms.panoMatrix.value=i,Object.assign(new e.Mesh(Qs,o),{frustumCulled:!1,dispose:function(){this.material instanceof e.ShaderMaterial&&(this.material.uniforms.panoDisplacementMap.value.dispose(),this.material.uniforms.panoDisplacementMap.value=null,this.material.dispose())}})}(r.body,o.body,n.position,n.matrix),s={body:a,meta:re([r.meta],o.meta,!0)};return i(s),s})).catch((function(e){for(var t=0,r=c;t<r.length;t++)r[t].then((function(e){return e.body.dispose()})).catch(se);return o(e),Promise.reject(e)}))},t}(),Vs=new e.Vector3(-1,1,1),Us=function(t){function r(n){var i,o,a,s=this,l=r.parseArgs(n);s=t.call(this,l)||this;var u=l.initial;return u.state,u.currentState,s.maxAccessibleDistance=l.maxAccessibleDistance,s.panoTapTriggerRadius=l.panoTapTriggerRadius,s.panoCircleMeshCreator=l.panoCircleMeshCreator,s.panoModelGroup=new e.Group,s.panoModelGroup.name="panoModels",s.scene.add(s.panoModelGroup),s.panoMeshes={},s.updatePanoMeshes(),s.helper.remove(s.intersectMesh),s.locationMotion=new Eo({count:0,distance:s.camera.pose.distance,modelAlpha:null!==(i=s.models.getMaterial().modelAlpha)&&void 0!==i?i:0,perspToOrtho:s.camera.perspToOrtho.x,orthoDistance:s.camera.orthoDistance}),s.panoResources={},s.panoResources[s.locationMotion.keyframes[0].key=s.locationMotion.keyframes[1].key=ki()]={panoId:Ke(s.currentPano),matrix:null!==(a=null===(o=s.models.getMaterial().pano1)||void 0===o?void 0:o.matrix)&&void 0!==a?a:new e.Matrix4,position:s.camera.pose.offset.clone(),effect:"fly"},s.depthTextureLoader=new Ns,s}return Z(r,t),r.parseArgs=function(e){var n,i,o;if(e instanceof r)return e;var a=t.parseArgs.call(this,e);return $($({},a),{maxAccessibleDistance:null!==(n=e.maxAccessibleDistance)&&void 0!==n?n:5,panoTapTriggerRadius:null!==(i=e.panoTapTriggerRadius)&&void 0!==i?i:1,panoCircleMeshCreator:null!==(o=e.panoCircleMeshCreator)&&void 0!==o?o:function(e){return new Io}})},r.initAnimationEndState=function(e){var r=this.parseArgs(e),n=t.initAnimationEndState.call(this,r);return $($({},n),{mode:"DepthPanorama"})},r.prototype.destroy=function(){var e;if(t.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.pendingTextureTask,this.panoModelGroup){for(var r=0,n=this.panoModelGroup.children;r<n.length;r++){var i=n[r];"function"==typeof i.dispose&&i.dispose()}this.scene.remove(this.panoModelGroup)}if(this.panoMeshes)for(var o=0,a=Object.keys(this.panoMeshes);o<a.length;o++){var s=a[o],l=this.panoMeshes[s];this.helper.remove(l),l.dispose(),delete this.panoMeshes[s]}for(var u=null!==(e=this.models.getMaterial())&&void 0!==e?e:{},c=u.pano0,h=u.pano1,p=0,d=Object.keys(this.panoResources);p<d.length;p++){var f=d[p],v=this.panoResources[f];v.panoModel&&v.panoModel.material.uniforms.panoMap.value!==(null==c?void 0:c.map)&&v.panoModel.material.uniforms.panoMap.value!==(null==h?void 0:h.map)&&(this.panoModelGroup.remove(v.panoModel),v.panoModel.material.uniforms.panoMap.value.dispose(),v.panoModel.dispose(),delete v.panoModel),delete this.panoResources[f]}},r.prototype.isReady=function(){return!1===this.locationMotion.ended&&t.prototype.isReady.call(this)},r.prototype.updateWork=function(e,t,n,i){this.userAction=i,this.works=e;var o=r.initAnimationEndState($($({},this),{initial:{currentState:$($({},this.currentPano),this.camera.pose),duration:n,state:t,userAction:i}})),a={workCode:o.workCode,panoIndex:o.panoIndex};return this.hideIntersectMesh(),this.updatePanoMeshes(),this.moveToPano(a,{effect:"fade",duration:n,longitude:t.longitude,latitude:t.latitude,fov:t.fov},i),!0},r.prototype.updateTime=function(t,r){for(var n,i,o=this,a=[],s=2;s<arguments.length;s++)a[s-2]=arguments[s];if(!this.destroyed){var l={},u={},c=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),h=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),p=!1;if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(t),u.longitude=this.cameraMotion.value.longitude,u.latitude=this.cameraMotion.value.latitude,u.fov=this.cameraMotion.value.fov),!1===this.locationMotion.ended){this.locationMotion.update(t);var d=this.locationMotion.getKeyFrameSegment(t),f=d[0],v=d[1],m=this.panoResourceFromLocationMotionKeyframe(f),A=this.panoResourceFromLocationMotionKeyframe(v),g=(new e.Vector3).copy(m.position),y=(new e.Vector3).copy(A.position),b=this.locationMotion.value.count-v.value.count+1;l.progress=b,l.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Or(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance;for(var x=0,w=this.panoModelGroup.children;x<w.length;x++){var M=w[x];M.visible=M===m.panoModel||M===A.panoModel}m.panoModel&&(m.panoModel.material.uniforms.opacity.value=1-b,m.panoModel.material.depthTest=0!==b),A.panoModel&&(A.panoModel.material.uniforms.opacity.value=b,A.panoModel.material.depthTest=1!==b),A.panoModel&&(b<1?m.panoModel&&(l.pano0={map:m.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:m.matrix}):l.pano0={map:A.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:A.matrix},l.pano1={map:A.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:A.matrix}),p=l.useBlackTransition="instant"===A.effect||"montage"===A.effect,"fade"!==A.effect&&"montage"!==A.effect||(l.pano0&&(l.pano0={map:l.pano0.map,luminanceMap:null,matrix:m.matrix.clone().setPosition(A.position)}),g.copy(y)),u.distance=this.locationMotion.value.distance,u.offset=new e.Vector3(g.x+(y.x-g.x)*b,g.y+(y.y-g.y)*b,g.z+(y.z-g.z)*b);for(var E=[],C=[],S=0,I=this.locationMotion.keyframes;S<I.length;S++){var P=I[S],T=P.key,B=P.progress;void 0!==T&&(E.push(T),B>=this.locationMotion.progress&&C.push(T))}for(var R=0,O=Object.keys(this.panoResources);R<O.length;R++){var k=O[R];if(!(C.indexOf(k)>=0)){var D=this.panoResources[k];if(D.panoModel){if(D.panoModel.material.uniforms.panoMap.value===(null===(n=l.pano0)||void 0===n?void 0:n.map))continue;if(D.panoModel.material.uniforms.panoMap.value===(null===(i=l.pano1)||void 0===i?void 0:i.map))continue;this.panoModelGroup.remove(D.panoModel),D.panoModel.material.uniforms.panoMap.value.dispose(),D.panoModel.dispose(),delete D.panoModel}E.indexOf(k)>=0||delete this.panoResources[k]}}this.currentPano=We(A.panoId),this.emit("pano.moving",Xo("pano.moving",{userAction:this.userAction,prevPano:We(c.panoId),state:$($($($({},We(h.panoId)),{mode:this.mode}),ra(this.camera.pose)),u),options:{},progress:this.locationMotion.progress,error:null}))}!1===ta(l)&&this.models.setMaterial(l),!1===ta(u)&&this.setCamera(u);var L=this.works.getResolvedObserver(this.currentPano),F=this.locationMotion.ended?this.getForwardObserverOrNot():null;if(this.camera.pose.distance>.1||p){if(L)for(var Q=0,N=Object.keys(this.panoMeshes);Q<N.length;Q++){var V=N[Q];(G=this.panoMeshes[V]).setOpacity(0),G.setCurrent(!1),G.updateTime&&G.updateTime(t,r)}}else if(L){var U=ea(L.visibleIds,(function(e){var t=o.works.getResolvedObserver(e);return t?L.standingPosition.distanceTo(t.standingPosition):1/0}),!0),z=U[1];z=Or(z,2.5,1/0);for(var _=L.visibleIds.concat(Ke(this.currentPano)),q=this.camera.getDirection(new e.Vector3),H=0,j=Object.keys(this.panoMeshes);H<j.length;H++){V=j[H];var G=this.panoMeshes[V],K=this.works.getResolvedObserver(V);if(-1===_.indexOf(V))G.setCurrent(!1),G.setOpacity(0);else if(K)if(K.loadable||K.active){var W=G.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);G.setCurrent(!G.loading&&0===G.progress&&null!==F&&F.panoId===V),G.setOpacity(W<.01?0:Or(z/W*1.2,.4,.85));var Y=this.camera.position.clone().setY(G.position.y),X=(new e.Vector3).copy(G.position).sub(Y).normalize();if(V===Ke(this.currentPano)){var J=Or((.5-Y.distanceTo(G.position))/.5,0,1);X.multiplyScalar(1-J).add(q.clone().multiplyScalar(J))}X.length()>0&&G.quaternion.setFromEuler(new e.Euler(0,Math.atan2(X.x,X.z),0))}else G.setCurrent(!1),G.setOpacity(0);else G.setCurrent(!1),G.setOpacity(0);G.updateTime&&G.updateTime(t,r)}}}},r.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(ue())[1],t=this.locationMotion.getKeyFrameSegment(ue())[1],r=this.panoResourceFromLocationMotionKeyframe(t),n=this.works.getResolvedObserver(r.panoId);return{mode:this.mode,workCode:n?n.work.workCode:this.currentPano.workCode,panoIndex:n?n.pano.panoIndex:this.currentPano.panoIndex,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:n?n.position.clone():this.camera.position.clone(),distance:0}},r.prototype.moveToPano=function(t,r,n){var i,o=this;void 0===r&&(r={});var a=this.works.getResolvedObserver(t);if(!a)throw new Error("panoId ".concat(JSON.stringify(t)," is not found."));this.userAction=n;var s=a.images.depth,l=$({key:"pano.".concat(a.panoId)},Yn(this.imageOptions,["format","size","quality","sharpen","mappings"])),u=this.imageOptions.transform,c=a.images,h=a.position,p=a.quaternion,d=(new e.Matrix4).compose(h,p,new e.Vector3(-1,1,1)),f="pano:"+Jn(c);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===f)return;var v=this.pendingTextureTask.panoId,m=We(v);null===(i=this.panoMeshes[v])||void 0===i||i.setProgress(0),this.emit("pano.texture.abort",Xo("pano.texture.abort",{error:null,progress:0,meta:null,pano:m})),this.pendingTextureTask.onError(new Error("pano ".concat(JSON.stringify(m)," texture aborted")))}var A="move-to-pano-"+a.panoId;this.pending.add(A),this.pendingTextureTask={panoId:a.panoId,hash:f,onLoad:function(e){o.pending.delete(A),o.destroyed?e.body.dispose():(e.body.name=f,o.doMoveToPano(a.pano,e.body,r))},onError:function(e){o.pending.delete(A);var t=$($($({},a.pano),{mode:o.mode}),ra(o.camera.pose));o.emit("pano.error",Xo("pano.error",{error:e,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:t})),o.emit("pano.cancel",Xo("pano.cancel",{error:null,userAction:o.userAction,options:r,prevPano:o.currentPano,progress:0,state:t})),r.moveCancelCallback&&r.moveCancelCallback()}};var g=this.panoMeshes[a.panoId];g&&g.tap&&g.tap(),this.depthTextureLoader.load(s,c,{imageURL:{transform:u,options:l},position:h,matrix:d,allowHosts:a.work.allowHosts,networkSubscribe:this.networkSubscribe,requestProxy:this.requestProxy},(function(e){var t,r;(null===(t=o.pendingTextureTask)||void 0===t?void 0:t.hash)===f?(o.pendingTextureTask.onLoad(e),null===(r=o.panoMeshes[a.panoId])||void 0===r||r.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.success",Xo("pano.texture.success",{error:null,progress:1,meta:e.meta,pano:a.pano}))):e.body.dispose()}),(function(e){var t,r;(null===(t=o.pendingTextureTask)||void 0===t?void 0:t.hash)===f&&(o.pendingTextureTask.onError(e),null===(r=o.panoMeshes[a.panoId])||void 0===r||r.setProgress(0),delete o.pendingTextureTask,o.emit("pano.texture.error",Xo("pano.texture.error",{error:e,progress:0,meta:null,pano:a.pano})),o.emit("error",e))}),(function(e){var t,r;o.emit("pano.texture.progress",Xo("pano.texture.progress",{error:null,progress:e,meta:null,pano:a.pano})),(null===(t=o.pendingTextureTask)||void 0===t?void 0:t.hash)===f&&(null===(r=o.panoMeshes[a.panoId])||void 0===r||r.setProgress(e))}),this.renderer),this.emit("pano.texture.load",Xo("pano.texture.load",{error:null,progress:0,meta:null,pano:a.pano}))},r.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(t){var n=e.initial,i=(n.state,n.currentState,n.duration),o=n.userAction,a=r.initAnimationEndState(e),s={workCode:a.workCode,panoIndex:a.panoIndex},l=!1;e.userAction=o,e.moveToPano(s,{longitude:a.longitude,latitude:a.latitude,fov:a.fov,duration:i,moveStartCallback:function(t){l=!0,e.emit("initAnimation.start",Xo("initAnimation.start",{state:t,userAction:o}))},moveEndCallback:function(r){e.emit("initAnimation.end",Xo("initAnimation.end",{state:r,userAction:e.userAction})),t()},moveCancelCallback:function(){var r=$($($({},s),{mode:e.mode}),ra(e.camera.pose));!1===l&&e.emit("initAnimation.start",Xo("initAnimation.start",{state:r,userAction:e.userAction})),e.emit("initAnimation.end",Xo("initAnimation.end",{state:r,userAction:e.userAction})),t()}},o)}))},r.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},r.prototype.locationMotionKeyframesLength=function(e){for(var t=0,r=1;r<e.length;r++){var n=this.panoResourceFromLocationMotionKeyframe(e[r-1]).position,i=this.panoResourceFromLocationMotionKeyframe(e[r]).position;t+=n.distanceTo(i)*(e[r].value.count-e[r-1].value.count)}return t},r.prototype.updatePanoMeshes=function(){for(var e=this,t={},r=0,n=Object.keys(this.panoMeshes);r<n.length;r++){var i=n[r],o=this.panoMeshes[i];t[i]=o,delete this.panoMeshes[i]}for(var a=1,s={},l=function(t){var r=ea(t.accessibleIds,(function(r){var n=e.works.getResolvedObserver(r);return n?Or(n.standingPosition.distanceTo(t.standingPosition),1,1/0):1/0}),!0)[1];void 0===s[t.panoId]&&(s[t.panoId]=r)},u=0,c=this.works.resolvedObservers;u<c.length;u++)l(f=c[u]);var h=Object.keys(s).map((function(e){return s[e]}));h.length&&(a=Or(h.reduce((function(e,t){return e+t}),0)/h.length*.6,1,3));for(var p=0,d=this.works.resolvedObservers;p<d.length;p++){var f;o=void 0,t[(f=d[p]).panoId]?(!0===(o=t[f.panoId]).loading&&!1===f.loadable&&o.setLoading(!1),delete t[f.panoId]):((o=this.panoCircleMeshCreator(f.pano)).name="PanoCircleMesh_"+f.panoId,this.helper.remove(o)),o.scale.set(a,1,a),o.position.copy(f.standingPosition),this.panoMeshes[f.panoId]=o}for(var v=0,m=Object.keys(t);v<m.length;v++){var A=m[v];this.helper.remove(t[A]),t[A].dispose(),delete t[A]}},r.prototype.doMoveToPano=function(t,r,n){var i,o,a,s,l=this;void 0===n&&(n={});var u=ue(),c=ki(),h=this.works.getResolvedObserver(t);if(!h)throw new Error("panoId ".concat(JSON.stringify(t)," never found"));var p,d,f,v=this.panoResources[c]={panoId:h.panoId,effect:null!==(i=n.effect)&&void 0!==i?i:"fly",panoModel:r,matrix:(new e.Matrix4).compose(h.position,h.quaternion,Vs),position:h.position.clone()};if(r.visible=!1,r.renderOrder=-1,this.panoModelGroup.add(r),this.locationMotion.ended){var m=this.locationMotion.getKeyFrameSegment(u),A=(m[0],m[1]),g=this.locationMotion.value,y=this.panoResourceFromLocationMotionKeyframe(A).position,b=v.position;p=Math.max(y.distanceTo(b),1),d=[{key:A.key,progress:0,value:$($({},g),{count:0})},{key:c,progress:1,value:{distance:0,perspToOrtho:0,modelAlpha:0,orthoDistance:1,count:1}}],f=0}else{var x=this.locationMotion.getKeyFrameSegment(u),w=x[0],M=(A=x[1],g=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(w).position),E=(y=this.panoResourceFromLocationMotionKeyframe(A).position,b=v.position,A.value.count-g.count),C=Math.max(M.distanceTo(y),1)*E;p=C+Math.max(y.distanceTo(b),1),d=[{key:w.key,progress:0,value:$({},g)},{key:A.key,progress:C/p,value:A.value},{key:c,progress:1,value:{count:A.value.count+1,distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0}}];var S=this.locationMotionKeyframesLength(this.locationMotion.keyframes),I=this.locationMotionKeyframesLength(d);f=0===S||0===S?0:this.locationMotion.getProgressVelocity(u)*S/I}var P=this.calculateMovingDuration(n.duration,"fade"===n.effect||"montage"===n.effect?0:p),T={longitude:n.longitude,latitude:n.latitude,fov:n.fov},B=$($({},t),{mode:this.mode,longitude:null!==(o=T.longitude)&&void 0!==o?o:this.camera.pose.longitude,latitude:null!==(a=T.latitude)&&void 0!==a?a:this.camera.pose.latitude,fov:null!==(s=T.fov)&&void 0!==s?s:this.camera.pose.fov,offset:h.position.clone(),distance:this.camera.pose.distance}),R=this.currentPano;this.emit("pano.moveTo",Xo("pano.moveTo",{options:n,prevPano:R,progress:0,state:B,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(B),this.cameraMotion.set(T,P).catch(se),this.locationMotion.setKeyframes(d,P,f).then((function(){var e=$($({},t),{mode:l.mode,longitude:l.camera.pose.longitude,latitude:l.camera.pose.latitude,fov:l.camera.pose.fov,offset:l.camera.pose.offset.clone(),distance:l.camera.pose.distance});l.emit("pano.arrived",Xo("pano.arrived",{options:n,prevPano:R,progress:1,state:e,userAction:l.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(e)}),(function(){l.emit("pano.cancel",Xo("pano.cancel",{options:n,prevPano:R,progress:0,state:B,userAction:l.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()}))},r.prototype.getForwardObserverOrNot=function(t){var r=this,n=this.camera.getDirection(new e.Vector3),i=this.camera.position.clone(),o=this.works.getResolvedObserver(this.currentPano);if(!o)return null;var a=o.accessibleIds.filter((function(t){if(t===Ke(r.currentPano))return!1;var n=r.works.getResolvedObserver(t);if(!n)return!1;var o=n.standingPosition.clone().sub(i);return 0!==o.length()&&!(o.angleTo(new e.Vector3(0,-1,0))<Math.PI/12)&&(n.loadable||n.active)})),s=(t?t.ray.direction.clone():n.clone()).setY(0);if(0===s.length())return null;for(var l=a.slice().sort((function(e,t){var n=r.works.getResolvedObserver(e).position.clone().setY(i.y),o=r.works.getResolvedObserver(t).position.clone().setY(i.y);return n.distanceTo(i)-o.distanceTo(i)})),u=0,c=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];u<c.length;u++)for(var h=c[u],p=0,d=l;p<d.length;p++){var f=d[p],v=this.works.getResolvedObserver(f);if(v){var m=v.position.clone().setY(i.y).sub(i);if(m&&0!==m.length()&&s.angleTo(m)<h)return v}}return null},r.prototype.onTapGesture=function(t){var r,n=this;this.userAction=t.userAction,this.stopMomentumMovement();var i=t.center.raycaster,o=this.camera.getDirection(new e.Vector3).setY(0),a=null,s=this.works.getResolvedObserver(this.currentPano);if(s){var l=s.accessibleIds.filter((function(e){if(e===Ke(n.currentPano))return!1;var t=n.works.getResolvedObserver(e);return!!t&&!(t.position.distanceTo(n.camera.position)>n.maxAccessibleDistance)&&(t.loadable||t.active)})),u=i.intersectObject(this.boundingMesh,!0)[0];if(u){var c=ea(l,(function(e){var t=n.works.getResolvedObserver(e).standingPosition.clone();return t.clone().sub(n.camera.position).setY(0).angleTo(o)>Math.PI/2?1/0:t.distanceTo(u.point)}),!0),h=c[0],p=c[1];h&&p<this.panoTapTriggerRadius&&(a=null!==(r=this.works.getResolvedObserver(h))&&void 0!==r?r:null)}a||(a=this.getForwardObserverOrNot(i));for(var d=0,f=this.locationMotion.keyframes;d<f.length;d++){var v=f[d],m=this.panoResourceFromLocationMotionKeyframe(v);if(!(v.progress<this.locationMotion.progress)&&a&&m.panoId===a.panoId){a=null;break}}if(a){for(var A={},g=Math.PI/6,y=Math.PI/12,b=new e.Vector3(0,1,0),x=a.position.clone().setY(0).sub(s.position.clone().setY(0)).normalize(),w=x.clone().applyAxisAngle(b,g),M=x.clone().applyAxisAngle(b,-g),E=[],C=[],S=[],I=0,P=a.accessibleIds;I<P.length;I++){var T=We(h=P[I]);if(!Ye(T,this.currentPano)&&!Ye(T,a.pano)){var B=this.works.getResolvedObserver(h);if(B){var R=B.position.clone().sub(a.position).setY(0);x.angleTo(R)<g?S.push(R):w.angleTo(R)<g?E.push(R):M.angleTo(R)<g&&C.push(R)}}}var O=(S.length>0?S:re(re([],E,!0),C,!0)).slice().sort((function(e,t){return e.angleTo(x)-t.angleTo(x)}))[0];O&&O.angleTo(o)>y&&(A.longitude=Math.atan2(-O.x,-O.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(A.latitude=Or(0,this.minLatitude,this.maxLatitude));var k=$({},t.state);if(k.workCode=a.pano.workCode,k.panoIndex=a.pano.panoIndex,void 0!==A.longitude&&(k.longitude=A.longitude),void 0!==A.latitude&&(k.latitude=A.latitude),void 0!==A.fov&&(k.fov=A.fov),k.distance=0,k.offset=a?a.position.clone():new e.Vector3,t.state=k,this.emit("gesture.tap",t),!t.defaultPrevented){if(this.emit("pano.select",Xo("pano.select",{prevPano:this.currentPano,state:k,userAction:t.userAction,options:A,progress:0,error:null})),a&&!a.active){var D=a.panoId;this.panoMeshes[D]&&(this.panoMeshes[D].setDisabled(!1),this.panoMeshes[D].setLoading(!0))}a&&a.active&&this.emit("pano.request",Xo("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:k,options:A,error:null}))}}else this.emit("gesture.tap",t),t.defaultPrevented||!0===this.locationMotion.ended&&this.cameraBounce()}},r}(ba);const zs=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{ZnvH{vs|z-znA-z|qrycvrZnvHn\bv{t-rp?-bH|vq-znv{56-\nb-J-HrpA-z]|vv|{-J-z|qrycvrZnv-7-rpA5}|vv|{9>;=6Htyl]|vv|{-J-}|wrpv|{Znv-7-z]|vv|{H\f"),_s=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("0rr{v|{-TYlRealsntlqr}u-G-r{noyr<<-<<-nqn}rq-s|z-ur-RQY-unqr-p|qr-s|z-Puvvn{-O|pur{\b-v{-py|q-p|z}nrG<<-u}G<<tvuo;p|z<py|qp|z}nr<{x<rr<znr<}ytv{<\0RQY<unqr<RQY<<}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{H{vs|z-sy|n-prr{dvquH{vs|z-sy|n-prr{UrvtuH{vs|z-rp?-{rvtuo|h[RVTUO\\b_lP\\b[ajH{vs|z-sy|n-rqy`r{tuH{vs|z-sy|n-nqvH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-[rnH{vs|z-sy|n-SnH{vs|z-znA-]|wH{vs|z-nz}yr?Q-RQYP|y|H{vs|z-nz}yr?Q-RQYQr}uHn\bv{t-rp?-bHsy|n-r}|{r5sy|n-qr}u6\nrp?-_nqv-J-nqv-<-rp?5prr{dvqu9-prr{Urvtu6Hsy|n-z-J-=;=Hs|5v{-v-J-=H-v-I-[RVTUO\\b_lP\\b[aH-v886\nrp?-[rvtuo|-J-b-8-_nqv-7-{rvtuo|hvjHsy|n-{rvtuo|Qr}u-J-rr?Q5RQYP|y|9-[rvtuo|6;nH{rvtuo|Qr}u-J-5{rvtuo|Qr}u-JJ->;=6-L-=;=-G-{rvtuo|Qr}uHvs5{rvtuo|Qr}u-.J-=;=6\nvs5qr}u-JJ-=;=6\nz-8J->==;=H\fryr\nz-8J-zn5=;=9-qr}u-:-{rvtuo|Qr}u6H\f\f\fr{-z-<-sy|n5[RVTUO\\b_lP\\b[a6H\f|vq-znv{56\nrpA-pRQY-J-rr?Q5RQYP|y|9-b6H--sy|n-qr}u-J-pRQY;nHqr}u-J-5qr}u-JJ->;=6-L-=;=-G-qr}uHsy|n-r-J-r}|{r5qr}u6Hsy|n-unqr-J-r}5:r-7-@==;=-7-rqy`r{tu6HtylSntP|y|-J-rpA5pRQY;to-7-unqr9-|}npv\b6H\n-<<-vr-rtyn-u\b}ro|yvp-qr}u-nyr-|-qr}u-ossrsy|n-qy-J-}|5?;=9-qr}u6HrpA-q}-J-]|w-7-rpA5=;=9-=;=9-:qy9->;=6Hsy|n-}\t-J-q};\t-<-q};Hsy|n-sntQr}u-J-5}\t-8->;=6-<-?;=HtylSntQr}uRea-J-sntQr}uH\fvs5qr}u-JJ-=;=6\nqvpnqH\f\f");var qs=function(t){function r(r){void 0===r&&(r={});var n=t.call(this)||this;return n.uniforms={screenWidth:Hs("f",0),screenHeight:Hs("f",0),edlStrength:Hs("f",1),uNear:Hs("f",1),uFar:Hs("f",1),radius:Hs("f",1),neighbours:Hs("2fv",new Float32Array),depthMap:Hs("t",new e.Texture),uEDLColor:Hs("t",new e.Texture),uEDLDepth:Hs("t",new e.Texture),opacity:Hs("f",1),uProj:Hs("Matrix4fv",new Float32Array)},n.neighbourCount=8,n.updateShaderSource(),n.transparent=!0,n}return Z(r,t),r.prototype.getUniform=function(e){return void 0===this.uniforms?void 0:this.uniforms[e].value},r.prototype.setUniform=function(e,t){void 0!==this.uniforms&&(this.uniforms[e].value=t)},r.prototype.getDefines=function(){return""+"#define NEIGHBOUR_COUNT "+this.neighbourCount+"\n"},r.prototype.updateShaderSource=function(){var e=this.getDefines()+zs,t=this.getDefines()+_s;this.setValues({vertexShader:e,fragmentShader:t}),this.needsUpdate=!0},ee([js("screenWidth"),te("design:type",Number)],r.prototype,"screenWidth",void 0),ee([js("screenHeight"),te("design:type",Number)],r.prototype,"screenHeight",void 0),ee([js("edlStrength"),te("design:type",Number)],r.prototype,"edlStrength",void 0),ee([js("uNear"),te("design:type",Number)],r.prototype,"uNear",void 0),ee([js("uFar"),te("design:type",Number)],r.prototype,"uFar",void 0),ee([js("radius"),te("design:type",Number)],r.prototype,"radius",void 0),ee([js("neighbours",!0),te("design:type",Float32Array)],r.prototype,"neighbours",void 0),ee([js("depthMap"),te("design:type",e.Texture)],r.prototype,"depthMap",void 0),ee([js("uEDLColor"),te("design:type",e.Texture)],r.prototype,"uEDLColor",void 0),ee([js("uEDLDepth"),te("design:type",e.Texture)],r.prototype,"uEDLDepth",void 0),ee([js("uProj"),te("design:type",Array)],r.prototype,"uProj",void 0),r}(e.RawShaderMaterial);function Hs(e,t){return{type:e,value:t}}function js(e,t){return void 0===t&&(t=!1),function(r,n){Object.defineProperty(r,n,{get:function(){return this.getUniform(e)},set:function(r){r!==this.getUniform(e)&&(this.setUniform(e,r),t&&this.updateShaderSource())}})}}var Gs=new e.OrthographicCamera(-1,1,1,-1,0,1),Ks=new e.BufferGeometry;Ks.setAttribute("position",new e.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),Ks.setAttribute("uv",new e.Float32BufferAttribute([0,2,0,0,2,0],2));var Ws=new e.Mesh(Ks),Ys=new e.Scene;Ys.add(Ws);var Xs=function(t){function r(r,n,i,o){var a=t.call(this,r,n,i,o)||this;return a.sharedV2=new e.Vector2,a.renderer=r,a.material=new qs,Ws.material=a.material,a}return Z(r,t),r.prototype.render=function(e){var t=this.camera,r=this.material.uniforms,n=this.renderer.getSize(this.sharedV2);r.screenWidth.value=n.x,r.screenHeight.value=n.y;var i=t.projectionMatrix,o=new Float32Array(16);o.set(i.elements);for(var a=new Float32Array(2*this.material.neighbourCount),s=0;s<this.material.neighbourCount;s++)a[2*s+0]=Math.cos(2*s*Math.PI/this.material.neighbourCount),a[2*s+1]=Math.sin(2*s*Math.PI/this.material.neighbourCount);r.neighbours.value=a,r.uNear.value=t.near,r.uFar.value=t.far,r.uEDLColor.value=e[0].texture,r.uProj.value=o,r.edlStrength.value=1,r.radius.value=1,r.opacity.value=1,this.renderer.setRenderTarget(null),this.renderer.render(Ys,Gs)},r.prototype.dispose=function(){this.copyPass.dispose()},r}(Ra);const Js=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{H{vs|z-nz}yr?Q-drvtuZn}H{vs|z-nz}yr?Q-Qr}uZn}Hn\bv{t-rp?-bH|vq-znv{56-\n<<-sy|n-qr}u-J-rr?Q5Qr}uZn}9-b6;H<<-vs5qr}u-KJ->;=6\n<<-qvpnqH<<-\f<<-tylSntP|y|-J-rpA5qr}u9->;=9-=;=9->;=6HrpA-p|y|-J-rr?Q5drvtuZn}9-b6H-p|y|-J-p|y|-<-p|y|;HtylSntP|y|-J-rpA5p|y|;\b\t9->;=6H-<<-tylSntQr}uRea-J-qr}uH\f"),Zs=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{ZnvH{vs|z-znA-z|qrycvrZnvHn\bv{t-rp?-bH|vq-znv{56-\nb-J-Htyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-rpA5}|vv|{9>;=6H\f");var $s=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,{vertexShader:Zs,fragmentShader:Js})||this;return r.uniforms={uDepthMap:el("t",null),uWeightMap:el("t",null)},r.depthTest=!0,r.depthWrite=!0,r.opacity=1,r}return Z(t,e),t.prototype.getUniform=function(e){return void 0===this.uniforms?void 0:this.uniforms[e].value},t.prototype.setUniform=function(e,t){void 0!==this.uniforms&&(this.uniforms[e].value=t)},ee([tl("uDepthMap"),te("design:type",Number)],t.prototype,"uDepthMap",void 0),ee([tl("uWeightMap"),te("design:type",Number)],t.prototype,"uWeightMap",void 0),t}(e.RawShaderMaterial);function el(e,t){return{type:e,value:t}}function tl(e,t){return void 0===t&&(t=!1),function(r,n){Object.defineProperty(r,n,{get:function(){return this.getUniform(e)},set:function(r){r!==this.getUniform(e)&&(this.setUniform(e,r),t&&this.updateShaderSource())}})}}var rl=new e.OrthographicCamera(-1,1,1,-1,0,1),nl=new e.BufferGeometry;nl.setAttribute("position",new e.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),nl.setAttribute("uv",new e.Float32BufferAttribute([0,2,0,0,2,0],2));var il=new e.Mesh(nl),ol=new e.Scene;ol.add(il);var al=function(t){function r(r,n,i,o){var a=t.call(this,r,n,i,o)||this;return a.sharedV2=new e.Vector2,a.renderer=r,a.material=new $s,a.scene=n,a.camera=i,il.material=a.material,a}return Z(r,t),r.prototype.render=function(e){var t=this.material.uniforms;this.renderer.setRenderTarget(e[1]),this.models.setMaterial({useHQWeight:!0,useHQDepth:!1}),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.render(this.scene,this.camera),t.uWeightMap.value=e[1].texture,this.renderer.setRenderTarget(null),this.renderer.render(ol,rl),this.models.setMaterial({useHQWeight:!1,useHQDepth:!0}),this.models.update(this.renderer,this.camera,"Mapview")},r.prototype.dispose=function(){this.copyPass.dispose()},r}(Ra),sl=Number.MAX_VALUE||1/0,ll=function(t){function r(n){var i,o=this,a=r.parseArgs(n);return(o=t.call(this,a)||this).mode="Mapview",o.defaultLatitude=a.defaultLatitude,o.defaultDistance=a.defaultDistance,o.maxLatitude=a.maxLatitude,o.minLatitude=a.minLatitude,o.locationMotion=new Eo({x:o.camera.pose.offset.x,y:o.camera.pose.offset.y,z:o.camera.pose.offset.z,distance:o.camera.pose.distance,modelAlpha:null!==(i=o.models.getMaterial().modelAlpha)&&void 0!==i?i:0,perspToOrtho:o.camera.perspToOrtho.x,orthoDistance:o.camera.orthoDistance}),o.intersectMeshCreator=a.intersectMeshCreator,o.intersectMesh=o.intersectMeshCreator(),o.intersectMesh.name="intersect",o.intersectMesh.visible=!1,o.currentTapId=null,o.helper.add(o.intersectMesh),o.edlTarget=new e.WebGLRenderTarget(1024,1024,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,format:e.RGBAFormat,type:e.FloatType,depthTexture:new e.DepthTexture(1024,1024,e.UnsignedIntType)}),o.edlEffect=new Xs(o.renderer,o.scene,o.camera,o.models),o.hqEffect=new al(o.renderer,o.scene,o.camera,o.models),o}return Z(r,t),r.parseArgs=function(e){var n,i,o,a,s;if(e instanceof r)return e;var l=t.parseArgs.call(this,e);return $($({},l),{defaultLatitude:null!==(n=e.defaultLatitude)&&void 0!==n?n:Math.PI/4,defaultDistance:null!==(i=e.defaultDistance)&&void 0!==i?i:50,maxLatitude:null!==(o=e.maxLatitude)&&void 0!==o?o:+Math.PI/2,minLatitude:null!==(a=e.minLatitude)&&void 0!==a?a:0,intersectMeshCreator:null!==(s=e.intersectMeshCreator)&&void 0!==s?s:function(){return new Fo}})},r.distanceFromModel=function(e,t,r){var n=e.bounding,i=Math.pow(Math.pow(n.max.x-n.min.x+1,2)+Math.pow(n.max.y-n.min.y+1,2)+Math.pow(n.max.z-n.min.z+1,2),.5),o=i/2/Math.tan(Math.PI*t/360);return r<1&&(o/=r),isNaN(o)?i:o},r.initAnimationEndState=function(t){var n,i,o,a,s,l,u,c,h,p,d=this.parseArgs(t),f=d.works,v=d.models,m=t.initial,A=m.state,g=m.currentState,y="number"==typeof A.panoIndex?{workCode:null!==(o=null!==(n=A.workCode)&&void 0!==n?n:null===(i=d.works[0])||void 0===i?void 0:i.workCode)&&void 0!==o?o:"",panoIndex:A.panoIndex}:{workCode:g.workCode,panoIndex:g.panoIndex},b=null!==(a=A.longitude)&&void 0!==a?a:g.longitude,x=Or(null!==(s=A.latitude)&&void 0!==s?s:function(e){switch(e){case"Floorplan":case"Mapview":return!0;default:return!1}}(g.mode)?g.latitude:d.defaultLatitude,d.minLatitude,d.maxLatitude),w=Or(null!==(l=A.distance)&&void 0!==l?l:d.defaultDistance,0,r.distanceFromModel(d.models,46,d.camera.aspect)),M=null!==(p=null!==(c=null===(u=A.offset)||void 0===u?void 0:u.clone())&&void 0!==c?c:null===(h=f.getResolvedObserver(y))||void 0===h?void 0:h.position.clone())&&void 0!==p?p:new e.Vector3;return v.bounding.containsPoint(M)||v.bounding.getCenter(M),$($({},y),{mode:"Mapview",longitude:b,latitude:x,fov:46,offset:M,distance:w})},r.prototype.destroy=function(){t.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},r.prototype.isReady=function(){return!1!==this.locationMotion.ended&&t.prototype.isReady.call(this)},r.prototype.updateWork=function(e,t,n,i){var o,a,s;this.userAction=i,this.works=e;var l=r.initAnimationEndState($($({},this),{initial:{currentState:$($({},this.currentPano),this.camera.pose),duration:n,state:t,userAction:i}}));this.currentPano={workCode:l.workCode,panoIndex:l.panoIndex};var u={longitude:l.longitude,latitude:l.latitude,fov:l.fov},c={x:null===(o=l.offset)||void 0===o?void 0:o.x,y:null===(a=l.offset)||void 0===a?void 0:a.y,z:null===(s=l.offset)||void 0===s?void 0:s.z,distance:l.distance};return this.locationMotion.set(c,n).catch(se),this.cameraMotion.set(u,n).catch(se),!0},r.prototype.updateModel=function(e){t.prototype.updateModel.call(this,e)},r.prototype.updateTime=function(t,r){if(!this.destroyed){var n={},i={};this.locationMotion.ended||(this.locationMotion.update(t),n.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Or(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,i.distance=this.locationMotion.value.distance,i.offset=new e.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(t),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),ta(n)||this.models.setMaterial(n),ta(i)||this.setCamera(i)}},r.prototype.getTargetState=function(){var t=this.cameraMotion.getKeyFrameSegment(ue())[1],r=this.locationMotion.getKeyFrameSegment(ue())[1];return $($({},this.currentPano),{mode:this.mode,longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov,distance:r.value.distance,offset:new e.Vector3(r.value.x,r.value.y,r.value.z)})},r.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(t){var n=e.initial,i=(n.state,n.currentState,n.duration),o=n.userAction;e.userAction=o;var a=r.initAnimationEndState(e),s={longitude:a.longitude,latitude:a.latitude,fov:a.fov},l={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance,modelAlpha:1,perspToOrtho:0,orthoDistance:a.distance};e.emit("initAnimation.start",Xo("initAnimation.start",{state:a,userAction:e.userAction})),e.cameraMotion.set(s,i).catch(se),e.locationMotion.set(l,i).then((function(){e.emit("initAnimation.end",Xo("initAnimation.end",{state:a,userAction:e.userAction}))}),(function(t){var r=$($($({},e.currentPano),{mode:e.mode}),ra(e.camera.pose));e.emit("initAnimation.end",Xo("initAnimation.end",{state:r,userAction:e.userAction}))})).then((function(){t()}))}))},r.prototype.getForwardObserverOrNot=function(e){var t=this.models.intersectRaycaster(e)[0];if(!t)return null;var r=ea(this.works.resolvedObservers,(function(e){return e.standingPosition.distanceTo(t.point)}),!0),n=r[0],i=r[1];return n&&i<10?n:null},r.prototype.coordinatesForOffset=function(t){var r=this.cameraMotion.value.fov,n=this.camera.aspect,i=this.renderer.getSize(new e.Vector2);return{longitude:2*t.x/(i.x*this.scissor.width)*r/95*n,latitude:-2*t.y/(i.y*this.scissor.height)*r/95}},r.prototype.requestMomentumMovement=function(t,r,n,i){var o=this;if(null!==this.inMomentumMovement){for(var a=$({},n),s={longitude:0,latitude:0,x:0,y:0,z:0},l=0;l<i;l++)a.longitude*=.996,a.latitude*=.994008,a.x*=.99,a.y*=.99,a.z*=.99,s.longitude+=a.longitude,s.latitude+=a.latitude,s.x+=a.x,s.y+=a.y,s.z+=a.z;var u=Ho(this.cameraMotion.value.longitude+s.longitude),c=Or(this.cameraMotion.value.latitude+s.latitude,this.minLatitude,this.maxLatitude),h=Or(this.locationMotion.value.x+s.x,this.models.bounding.min.x,this.models.bounding.max.x),p=Or(this.locationMotion.value.y+s.y,this.models.bounding.min.y,this.models.bounding.max.y),d=Or(this.locationMotion.value.z+s.z,this.models.bounding.min.z,this.models.bounding.max.z),f=$($({},this.currentPano),{mode:this.mode,longitude:u,latitude:c,offset:new e.Vector3(h,p,d),fov:this.cameraMotion.value.fov,distance:this.camera.pose.distance}),v=!(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),m=Xo("gesture.momentum",$($({},t),{isFirst:r,isFinal:v,state:f}));this.inMomentumMovement.event=m,this.emit("gesture.momentum",m),t.defaultPrevented?this.inMomentumMovement=null:this.inMomentumMovement&&(this.cameraMotion.set({longitude:u,latitude:c},0).catch(se),this.locationMotion.set({x:f.offset.x,y:f.offset.y,z:f.offset.z},0).catch(se),v?this.inMomentumMovement=null:Oe.shared.add((function(e,r){o.requestMomentumMovement(t,!1,a,0|r)}),!0,1))}},r.prototype.fixFinalState=function(t){var r=zt(t,new e.Vector3),n=(new e.Vector3).copy(t.offset).sub(r.clone().multiplyScalar(t.distance)),i=new e.Raycaster(n,r);i.near=.5;var o=this.models.intersectRaycaster(i)[0];o&&(t.distance=Or(o.distance,0,sl),t.offset.copy(n).add(r.clone().multiplyScalar(t.distance)))},r.prototype.onPanGesture=function(t){this.userAction=t.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=t.pointers.length,n=this.panState,i=0;"mouse"===t.pointerType&&(i=t.srcEvent.buttons),n&&0===i&&0!==n.buttons&&(i=n.buttons);var o=null==n?void 0:n.target;if(!o){var a=this.relativeClientPosition(t.center),s=new e.Raycaster;s.setFromCamera(a,this.camera),s.near=.5,o=(new e.Vector3).copy(s.ray.direction).multiplyScalar(3).add(s.ray.origin);var l=this.models.intersectRaycaster(s)[0];if(l)o.copy(l.point);else{var u=(new e.Vector3).copy(this.camera.pose.offset).sub(this.camera.position),c=(new e.Plane).setFromNormalAndCoplanarPoint(u,this.camera.pose.offset);s.ray.intersectPlane(c,o)}}if(t.isFinal?delete this.panState:this.panState={target:o,buttons:i,pointerLength:r,x:t.center.x,y:t.center.y},void 0!==n&&n.pointerLength===r)if(r>1||2===i){var h={x:t.center.x-n.x,y:t.center.y-n.y},p=(new e.Vector3).copy(this.camera.position).sub(n.target).length();p*=Math.tan(this.camera.fov/2*Math.PI/180);var d=(new e.Vector3).copy(this.camera.pose.offset),f=2*h.x*p/this.element.clientHeight,v=2*h.y*p/this.element.clientHeight,m=new e.Vector3;m.setFromMatrixColumn(this.camera.matrix,0),m.multiplyScalar(-f),d.add(m),this.camera.pose.latitude<Math.PI/12?m.setFromMatrixColumn(this.camera.matrix,1):(m.setFromMatrixColumn(this.camera.matrix,0),m.crossVectors(this.camera.up,m)),m.multiplyScalar(v),d.add(m),d.clamp(this.models.bounding.min,this.models.bounding.max);var A=$($({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:d,distance:this.camera.pose.distance});if(t.state=A,this.emit("gesture.pan",t),t.defaultPrevented)return;if(this.locationMotion.set({x:A.offset.x,y:A.offset.y,z:A.offset.z},0).catch(se),t.isFinal&&(this.fixFinalState(A),this.locationMotion.set({distance:A.distance,x:A.offset.x,y:A.offset.y,z:A.offset.z},0).catch(se)),t.isFinal){var g=2*t.velocityX*p/this.element.clientHeight,y=2*t.velocityY*p/this.element.clientHeight,b=new e.Vector3,x=new e.Vector3;b.setFromMatrixColumn(this.camera.matrix,0),b.multiplyScalar(-g),x.add(b),this.camera.pose.latitude<Math.PI/4?b.setFromMatrixColumn(this.camera.matrix,1):(b.setFromMatrixColumn(this.camera.matrix,0),b.crossVectors(this.camera.up,b)),b.multiplyScalar(y),x.add(b),this.inMomentumMovement={uuid:ki()},this.requestMomentumMovement(t,!0,{longitude:0,latitude:0,x:x.x,y:x.y,z:x.z},0)}}else{(h={x:t.center.x-n.x,y:t.center.y-n.y}).x*=-1,h.y*=-1;var w=this.coordinatesForOffset(h),M=Ho(this.cameraMotion.value.longitude+w.longitude),E=Or(this.cameraMotion.value.latitude+w.latitude,this.minLatitude,this.maxLatitude);if(this.camera.aspect<1&&Math.abs(t.overallVelocityX)>.2&&Math.atan2(Math.abs(t.overallVelocityY),Math.abs(t.overallVelocityX))<Math.PI/6.923&&(E=this.cameraMotion.value.latitude),A=$($({},this.currentPano),{mode:this.mode,longitude:M,latitude:E,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance}),t.isFinal&&this.fixFinalState(A),t.state=A,this.emit("gesture.pan",t),t.defaultPrevented)return;if(this.cameraMotion.set({longitude:A.longitude,latitude:A.latitude},0).catch(se),this.locationMotion.set({distance:A.distance,x:A.offset.x,y:A.offset.y,z:A.offset.z},0).catch(se),t.isFinal){var C=-1*t.velocityX,S=-1*t.velocityY;this.inMomentumMovement={uuid:ki()},this.requestMomentumMovement(t,!0,$($({},this.coordinatesForOffset({x:C,y:S})),{x:0,y:0,z:0}),0)}}},r.prototype.onPinchGesture=function(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();var r=null===(t=this.pinchState)||void 0===t?void 0:t.distance;if(e.isFirst)this.pinchState={x:e.center.x,y:e.center.y,distance:this.locationMotion.value.distance};else if(e.isFinal&&(delete this.panState,delete this.pinchState),void 0!==r){var n=Or(r/e.scale,0,sl);e.state.distance=n,this.emit("gesture.pinch",e),e.defaultPrevented||(this.locationMotion.set({distance:n},0).catch(se),e.type="gesture.pan",this.onPanGesture(e))}},r.prototype.onMouseMove=function(t){var r,n;if(this.intersectMesh.parent&&!this.panState&&(this.emit("gesture.mousemove",t),!t.defaultPrevented)){var i=t.center.raycaster;if(i.near=.5,t.isFinal&&this.intersectMesh.parent&&!0===this.intersectMesh.visible)this.hideIntersectMesh();else{var o=this.models.intersectRaycaster(i)[0],a=Xo("intersect.update",{raycaster:i,intersection:null!=o?o:null,object:this.intersectMesh});if(this.emit("intersect.update",a),a.defaultPrevented)this.hideIntersectMesh();else if(o){var s=null!==(n=null===(r=o.face)||void 0===r?void 0:r.normal)&&void 0!==n?n:(new e.Vector3).copy(i.ray.direction).multiplyScalar(-1),l=s.clone().multiplyScalar(.05),u=o.point.clone().add(l);this.intersectMesh.position.copy(u);var c=u.clone().add(l);if(this.intersectMesh.lookAt(c),Math.abs(s.y)>.99){var h=this.camera.position.clone().sub(u);this.intersectMesh.rotation.z=-Math.atan2(h.z,h.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}}},r.prototype.onMouseWheel=function(e){if(this.userAction=e.userAction,this.stopMomentumMovement(),e.isFinal){var t=e.state;if(this.fixFinalState(t),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var r={x:t.offset.x,y:t.offset.y,z:t.offset.z,distance:t.distance};this.locationMotion.set(r,0).catch(se)}else{var n=Or(this.locationMotion.value.distance-e.center.delta/2,0,sl);if(e.state.distance=n,this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:n},0).catch(se)}},r.prototype.onTapGesture=function(t){var r=this;this.userAction=t.userAction,this.stopMomentumMovement();var n=t.center.raycaster,i=this.getForwardObserverOrNot(n);if(i){var o={longitude:this.camera.pose.longitude,latitude:0},a=$($({},t.state),{mode:"Panorama",workCode:i.pano.workCode,panoIndex:i.pano.panoIndex,longitude:o.longitude,latitude:o.latitude,offset:i?i.position.clone():new e.Vector3,distance:0});if(t.state=a,this.emit("gesture.tap",t),!t.defaultPrevented&&(this.emit("pano.select",Xo("pano.select",{prevPano:this.currentPano,state:a,userAction:t.userAction,options:o,progress:0,error:null})),i&&i.active)){var s=this.currentTapId=ki();this.preloadPano(i.pano).then((function(e){r.currentTapId===s&&r.emit("pano.request",Xo("pano.request",{userAction:!0,prevPano:r.currentPano,progress:0,state:a,options:o,error:null}))}))}}else this.emit("gesture.tap",t)},r.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},r.prototype.postProcessing=function(e,t){var r;if(!this.destroyed)return"edl"===t?this.edlEffect.render(e):"hq"===t?null===(r=this.hqEffect)||void 0===r?void 0:r.render(e):void 0},r}(sa);function ul(e){return null==e}var cl={type:"move"},hl=function(){function t(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return t.prototype.getHandSpace=function(){return null===this._hand&&(this._hand=new e.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},t.prototype.getTargetRaySpace=function(){return null===this._targetRay&&(this._targetRay=new e.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new e.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new e.Vector3),this._targetRay},t.prototype.getGripSpace=function(){return null===this._grip&&(this._grip=new e.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new e.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new e.Vector3),this._grip},t.prototype.dispatchEvent=function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this},t.prototype.disconnect=function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},t.prototype.getAxes=function(){return this._axes},t.prototype.update=function(t,r,n){var i=null,o=null,a=null,s=this._targetRay,l=this._grip,u=this._hand;if(t&&t.gamepad&&t.gamepad.axes&&(this._axes=[t.gamepad.axes[2],t.gamepad.axes[3]]),t&&"visible-blurred"!==r.session.visibilityState)if(null!==s&&null!==(i=r.getPose(t.targetRaySpace,n))&&(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(cl)),u&&t.hand){a=!0;for(var c=0,h=t.hand.values();c<h.length;c++){var p=h[c],d=r.getJointPose(p,n);if(void 0===u.joints[p.jointName]){var f=new e.Group;f.matrixAutoUpdate=!1,f.visible=!1,u.joints[p.jointName]=f,u.add(f)}var v=u.joints[p.jointName];null!==d&&(v.matrix.fromArray(d.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=d.radius),v.visible=null!==d}var m=u.joints["index-finger-tip"],A=u.joints["thumb-tip"],g=m.position.distanceTo(A.position);u.inputState.pinching&&g>.025?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!u.inputState.pinching&&g<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==l&&t.gripSpace&&null!==(o=r.getPose(t.gripSpace,n))&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1);return null!==s&&(s.visible=null!==i),null!==l&&(l.visible=null!==o),null!==u&&(u.visible=null!==a),this},t}(),pl=function(){function t(t,r,n){var i,o,a,s,l;this.isPanorama=null===(i=null==n?void 0:n.isPanorama)||void 0===i||i,this.machineType=null!==(o=null==n?void 0:n.machineType)&&void 0!==o?o:"Pico",this.renderer=t,this.gl=r,this.enabled=!1,this.session=null,this.referenceSpaceType=null!==(a=null==n?void 0:n.referenceSpaceType)&&void 0!==a?a:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=null!==(s=null==n?void 0:n.onSessionStart)&&void 0!==s?s:se,this.onSessionEndCallback=null!==(l=null==n?void 0:n.onSessionEnd)&&void 0!==l?l:se,this.controllers=[new hl,new hl],this.inputSourcesMap=new Map,this.cameraVR=new e.ArrayCamera,this.cameraL=new e.PerspectiveCamera,this.cameraR=new e.PerspectiveCamera,this.cameraL.viewport=new e.Vector4,this.cameraR.viewport=new e.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 e.Vector3,this.cameraRPos=new e.Vector3}return t.prototype.getController=function(e){var t=this.controllers[e];return t||console.warn("no controller find"),t.getTargetRaySpace()},t.prototype.getControllerGrip=function(e){var t=this.controllers[e];return t||console.warn("no controller find"),t.getGripSpace()},t.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},t.prototype.updateCamera=function(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)},t.prototype.setProjectionFromUnion=function(e,t,r){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(r.matrixWorld);var n=this.cameraLPos.distanceTo(this.cameraRPos),i=t.projectionMatrix.elements,o=r.projectionMatrix.elements,a=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],u=(i[9]-1)/i[5],c=(i[8]-1)/i[0],h=(o[8]+1)/o[0],p=a*c,d=a*h,f=n/(-c+h),v=f*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(v),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var m=a+f,A=s+f,g=p-v,y=d+(n-v),b=l*s/A*m,x=u*s/A*m;e.projectionMatrix.makePerspective(g,y,b,x,m,A)},t.prototype.getCamera=function(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);var t=e.parent,r=this.cameraVR.cameras;this.updateCamera(this.cameraVR,t);for(var n=0;n<r.length;n++)this.updateCamera(r[n],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);for(var i=e.children,o=(n=0,i.length);n<o;n++)i[n].updateMatrixWorld(!0);return 2===r.length?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},t.prototype.updateInputSources=function(e){if(this.session){for(var t=this.session.inputSources,r=0;r<this.controllers.length;r++)this.inputSourcesMap.set(t[r],this.controllers[r]);for(r=0;r<e.removed.length;r++){var n=e.removed[r];(i=this.inputSourcesMap.get(n))&&(i.dispatchEvent({type:"disconnected",data:n}),this.inputSourcesMap.delete(n))}for(r=0;r<e.added.length;r++){var i;n=e.added[r],(i=this.inputSourcesMap.get(n))&&i.dispatchEvent({type:"connected",data:n})}}else console.warn("session is lose!")},t.prototype.onSessionEvent=function(e){var t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})},t.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach((function(e,t){e.disconnect(t)})),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,Oe.shared.setContext(null),this.onSessionEndCallback()},t.prototype.onRequestReferenceSpace=function(e){this.referenceSpace=e,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},t.prototype.setSession=function(e){var t=this;if(this.session=e,this.session){this.session.addEventListener("select",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("selectstart",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("selectend",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeeze",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeezestart",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeezeend",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("end",(function(e){t.onSessionEnd()}));var r=this.gl.getContextAttributes();this.gl.makeXRCompatible().then((function(){var e={antialias:null==r?void 0:r.antialias,alpha:null==r?void 0:r.alpha,depth:null==r?void 0:r.depth,stencil:null==r?void 0:r.stencil,framebufferScaleFactor:1};if(t.session){switch(t.machineType){case"Pico":t.session.updateRenderState({baseLayer:new XRWebGLLayer(t.session,t.gl,e)});break;case"Oculus":t.session.updateRenderState({layers:[new XRWebGLLayer(t.session,t.gl,e)]});break;default:t.machineType}t.session.requestReferenceSpace(t.referenceSpaceType).then((function(e){t.onRequestReferenceSpace(e)})),t.session.addEventListener("inputsourceschange",(function(e){t.updateInputSources(e)}))}else console.error("session is lose while set session!")}))}},t}(),dl=function(t){function r(){var r=t.call(this)||this;return r.type="LineSegmentsGeometry",r.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),r.setAttribute("position",new e.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)),r.setAttribute("uv",new e.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),r}return Z(r,t),r.prototype.applyMatrix4=function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},r.prototype.setPositions=function(t){var r;r=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var n=new e.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceStart",new e.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new e.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},r.prototype.setColors=function(t){var r;r=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var n=new e.InstancedInterleavedBuffer(r,6,1);return this.setAttribute("instanceColorStart",new e.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new e.InterleavedBufferAttribute(n,3,3)),this},r.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},r.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},r.prototype.fromMesh=function(t){return this.fromWireframeGeometry(new e.WireframeGeometry(t.geometry)),this},r.prototype.fromLineSegments=function(t){var r=t.geometry;if(r instanceof e.Geometry){var n=(new e.BufferGeometry).fromGeometry(r);this.setPositions(n.attributes.position.array)}else r instanceof e.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},r.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new e.Box3);var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(void 0!==t&&void 0!==r){var n=new e.Box3;this.boundingBox.setFromBufferAttribute(t),n.setFromBufferAttribute(r),this.boundingBox.union(n)}},r.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new e.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(void 0!==t&&void 0!==r){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var i=0,o=new e.Vector3,a=0,s=t.count;a<s;a++)o.fromBufferAttribute(t,a),i=Math.max(i,n.distanceToSquared(o)),o.fromBufferAttribute(r,a),i=Math.max(i,n.distanceToSquared(o));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)}},r.prototype.toJSON=function(){},r}(e.InstancedBufferGeometry);Object.assign(dl.prototype,{isLineSegmentsGeometry:!0});var fl={uniforms:e.UniformsUtils.merge([e.UniformsLib.common,e.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new e.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"},vl=function(t){function r(r){var n=t.call(this,{uniforms:e.UniformsUtils.clone(fl.uniforms),vertexShader:fl.vertexShader,fragmentShader:fl.fragmentShader,clipping:!0})||this;return n.type="LineMaterial",n.dashed=!1,Object.defineProperties(n,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}}}),n.setValues(r),n}return Z(r,t),r}(e.ShaderMaterial);Object.assign(vl.prototype,{isLineMaterial:!0});var ml=function(t){function r(e,r){var n=t.call(this)||this;return n.type="LineSegments2",n.geometry=void 0!==e?e:new dl,n.material=void 0!==r?r:new vl({color:16777215*Math.random()}),n}return Z(r,t),r.prototype.computeLineDistances=function(){for(var t=this.geometry,r=t.attributes.instanceStart,n=t.attributes.instanceEnd,i=new Float32Array(2*r.count),o=new e.Vector3,a=new e.Vector3,s=0,l=0,u=r.count;s<u;s++,l+=2)o.fromBufferAttribute(r,s),a.fromBufferAttribute(n,s),i[l]=0===l?0:i[l-1],i[l+1]=i[l]+o.distanceTo(a);var c=new e.InstancedInterleavedBuffer(i,2,1);return t.setAttribute("instanceDistanceStart",new e.InterleavedBufferAttribute(c,1,0)),t.setAttribute("instanceDistanceEnd",new e.InterleavedBufferAttribute(c,1,1)),this},r.prototype.raycast=function(t,r){null===t.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var n=t.ray,i=t.camera,o=i.projectionMatrix,a=this.geometry,s=this.material,l=s.resolution,u=s.linewidth,c=a.attributes.instanceStart,h=a.attributes.instanceEnd,p=new e.Vector4,d=new e.Vector4,f=new e.Vector4,v=new e.Vector3,m=new e.Matrix4,A=new e.Line3,g=new e.Vector3;n.at(1,f),f.w=1,f.applyMatrix4(i.matrixWorldInverse),f.applyMatrix4(o),f.multiplyScalar(1/f.w),f.x*=l.x/2,f.y*=l.y/2,f.z=0,v.copy(f);var y=this.matrixWorld;m.multiplyMatrices(i.matrixWorldInverse,y);for(var b=0,x=c.count;b<x;b++){p.fromBufferAttribute(c,b),d.fromBufferAttribute(h,b),p.w=1,d.w=1,p.applyMatrix4(m),d.applyMatrix4(m),p.applyMatrix4(o),d.applyMatrix4(o),p.multiplyScalar(1/p.w),d.multiplyScalar(1/d.w);var w=p.z<-1&&d.z<-1,M=p.z>1&&d.z>1;if(!w&&!M){p.x*=l.x/2,p.y*=l.y/2,d.x*=l.x/2,d.y*=l.y/2,A.start.copy(p),A.start.z=0,A.end.copy(d),A.end.z=0;var E=A.closestPointToPointParameter(v,!0);A.at(E,g);var C=e.MathUtils.lerp(p.z,d.z,E),S=C>=-1&&C<=1,I=v.distanceTo(g)<.5*u;if(S&&I){A.start.fromBufferAttribute(c,b),A.end.fromBufferAttribute(h,b),A.start.applyMatrix4(y),A.end.applyMatrix4(y);var P=new e.Vector3,T=new e.Vector3;n.distanceSqToSegment(A.start,A.end,T,P),r.push({point:T,pointOnLine:P,distance:n.origin.distanceTo(T),object:this,faceIndex:b})}}}},r}(e.Mesh);Object.assign(ml.prototype,{isLineSegments2:!0});var Al=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.type="Line2",n}return Z(t,e),t}(ml);Object.assign(Al.prototype,{isLine2:!0});var gl=function(t){function r(){var e=t.call(this)||this;return e.type="LineGeometry",e}return Z(r,t),r.prototype.setPositions=function(e){for(var r=e.length-3,n=new Float32Array(2*r),i=0;i<r;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return t.prototype.setPositions.call(this,n),this},r.prototype.setColors=function(e){for(var r=e.length-3,n=new Float32Array(2*r),i=0;i<r;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return t.prototype.setColors.call(this,n),this},r.prototype.fromLine=function(t){var r=t.geometry;if(r instanceof e.Geometry){var n=(new e.BufferGeometry).fromGeometry(r);this.setPositions(n.attributes.position.array)}else r instanceof e.BufferGeometry&&this.setPositions(r.attributes.position.array);return this},r.prototype.copy=function(){return this},r}(dl);Object.assign(gl.prototype,{isLineGeometry:!0});var yl=14467195,bl=null,xl=function(t){function r(r,n){void 0===r&&(r=new e.Vector3),void 0===n&&(n=new e.Vector3);var i=t.call(this)||this;i.type="FiveLine",i.needsRender=!0;var o=new gl,a=new vl({color:yl,linewidth:2,dashScale:20,dashed:!1});i.line=new Al(o,a);var s=new e.BufferGeometry,l=new e.PointsMaterial({color:yl,size:8,map:bl||(bl=(new e.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwD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imxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==")),sizeAttenuation:!1,transparent:!0});return i.points=new e.Points(s,l),i.points.renderOrder=11,i.points.frustumCulled=!1,i.setPoints(r,n),i.add(i.line,i.points),i}return Z(r,t),Object.defineProperty(r,"version",{get:function(){return"6.0.0-alpha.7"},enumerable:!1,configurable:!0}),r.prototype.setPoints=function(t,r){var n=[].concat(t.toArray(),r.toArray());this.points.geometry.setAttribute("position",new e.BufferAttribute(new Float32Array(n),3)),this.line.geometry.setPositions(n),this.line.computeLineDistances(),this.needsRender=!0},r.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new e.Vector3(t[0],t[1],t[2]),new e.Vector3(t[3],t[4],t[5])]},r.prototype.setMaterial=function(e){var t=this.line.material;for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];"dashed"===r?(t.dashed=n,n?t.defines.USE_DASH="":delete t.defines.USE_DASH,t.needsUpdate=!0):t[r]=e[r]}this.needsRender=!0},r.prototype.setResolution=function(e,t){var r=this.line.material.resolution;r.x===e&&r.y===t||(r.set(e,t),this.needsRender=!0)},r}(e.Object3D);Object.assign(xl.prototype,{isFiveLine:!0});const wl={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"})};async function Ml(e){const t=await fetch(e);if(t.ok)return t.json();throw new Error(t.statusText)}const El={xAxis:0,yAxis:0,button:0,state:wl.ComponentState.DEFAULT};class Cl{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===wl.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(El)}updateFromComponent({xAxis:e,yAxis:t,button:r,state:n}){const{normalizedXAxis:i,normalizedYAxis:o}=function(e=0,t=0){let r=e,n=t;if(Math.sqrt(e*e+t*t)>1){const i=Math.atan2(t,e);r=Math.cos(i),n=Math.sin(i)}return{normalizedXAxis:.5*r+.5,normalizedYAxis:.5*n+.5}}(e,t);switch(this.componentProperty){case wl.ComponentProperty.X_AXIS:this.value=this.states.includes(n)?i:.5;break;case wl.ComponentProperty.Y_AXIS:this.value=this.states.includes(n)?o:.5;break;case wl.ComponentProperty.BUTTON:this.value=this.states.includes(n)?r:0;break;case wl.ComponentProperty.STATE:this.valueNodeProperty===wl.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(n):this.value=this.states.includes(n)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Sl{constructor(e,t){if(!(e&&t&&t.visualResponses&&t.gamepadIndices&&0!==Object.keys(t.gamepadIndices).length))throw new 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=>{const r=new Cl(t.visualResponses[e]);this.visualResponses[e]=r})),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:wl.ComponentState.DEFAULT,button:void 0!==this.gamepadIndices.button?0:void 0,xAxis:void 0!==this.gamepadIndices.xAxis?0:void 0,yAxis:void 0!==this.gamepadIndices.yAxis?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=wl.ComponentState.DEFAULT,void 0!==this.gamepadIndices.button&&e.buttons.length>this.gamepadIndices.button){const 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||1===this.values.button?this.values.state=wl.ComponentState.PRESSED:(t.touched||this.values.button>wl.ButtonTouchThreshold)&&(this.values.state=wl.ComponentState.TOUCHED)}void 0!==this.gamepadIndices.xAxis&&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===wl.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>wl.AxisTouchThreshold&&(this.values.state=wl.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.yAxis&&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===wl.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>wl.AxisTouchThreshold&&(this.values.state=wl.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach((e=>{e.updateFromComponent(this.values)}))}}class Il{constructor(e,t,r){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=r,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach((e=>{const t=this.layoutDescription.components[e];this.components[e]=new Sl(e,t)})),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const 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)}))}}class Pl extends e.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e||(this.envMap=e,this.traverse((e=>{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=>{const{valueNode:t,minNode:r,maxNode:n,value:i,valueNodeProperty:o}=e;t&&(o===wl.VisualResponseProperty.VISIBILITY?t.visible=i:o===wl.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(r.quaternion).slerp(n.quaternion,i),t.position.lerpVectors(r.position,n.position,i)))}))})))}}function Tl(t,r){!function(t,r){Object.values(t.components).forEach((t=>{const{type:n,touchPointNodeName:i,visualResponses:o}=t;if(n===wl.ComponentType.TOUCHPAD)if(t.touchPointNode=r.getObjectByName(i),t.touchPointNode){const r=new e.SphereGeometry(.001),n=new e.MeshBasicMaterial({color:255}),i=new e.Mesh(r,n);t.touchPointNode.add(i)}else console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);Object.values(o).forEach((e=>{const{valueNodeName:t,minNodeName:n,maxNodeName:i,valueNodeProperty:o}=e;if(o===wl.VisualResponseProperty.TRANSFORM){if(e.minNode=r.getObjectByName(n),e.maxNode=r.getObjectByName(i),!e.minNode)return void console.warn(`Could not find ${n} in the model`);if(!e.maxNode)return void console.warn(`Could not find ${i} in the model`)}e.valueNode=r.getObjectByName(t),e.valueNode||console.warn(`Could not find ${t} in the model`)}))}))}(t.motionController,r),t.envMap&&r.traverse((e=>{e.isMesh&&(e.material.envMap=t.envMap,e.material.needsUpdate=!0)})),t.add(r)}class Bl{constructor(e=null){this.gltfLoader=e,this.path="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",this._assetCache={},this.gltfLoader||(this.gltfLoader=new mn)}createControllerModel(e){const t=new Pl;let r=null;return e.addEventListener("connected",(e=>{const n=e.data;"tracked-pointer"===n.targetRayMode&&n.gamepad&&async function(e,t,r=null,n=!0){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No basePath supplied");const i=await async function(e){if(!e)throw new Error("No basePath supplied");return await Ml(`${e}/profilesList.json`)}(t);let o;if(e.profiles.some((e=>{const r=i[e];return r&&(o={profileId:e,profilePath:`${t}/${r.path}`,deprecated:!!r.deprecated}),!!o})),!o){if(!r)throw new Error("No matching profile name found");const e=i[r];if(!e)throw new Error(`No matching profile name found and default profile "${r}" missing.`);o={profileId:r,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}const a=await Ml(o.profilePath);let s;if(n){let t;if(t="any"===e.handedness?a.layouts[Object.keys(a.layouts)[0]]:a.layouts[e.handedness],!t)throw new Error(`No matching handedness, ${e.handedness}, in profile ${o.profileId}`);t.assetPath&&(s=o.profilePath.replace("profile.json",t.assetPath))}return{profile:a,assetPath:s}}(n,this.path,"generic-trigger").then((({profile:e,assetPath:i})=>{t.motionController=new Il(n,e,i);const o=this._assetCache[t.motionController.assetUrl];if(o)r=o.scene.clone(),Tl(t,r);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(t.motionController.assetUrl,(e=>{this._assetCache[t.motionController.assetUrl]=e,r=e.scene.clone(),Tl(t,r)}),null,(()=>{throw new Error(`Asset ${t.motionController.assetUrl} missing or malformed.`)}))}})).catch((e=>{console.warn(e)}))})),e.addEventListener("disconnected",(()=>{t.motionController=null,t.remove(r),r=null})),t}}var Rl=300,Ol=(new e.Matrix4).makeRotationAxis(new e.Vector3(0,1,0),Math.PI),kl=new e.Vector3(-1,1,1),Dl=function(t){function r(r){var n=t.call(this,r)||this;n.xrManager=new pl(n.renderer,n.renderer.getContext(),{onSessionStart:function(e){n.emit("xr.session.start",Xo("xr.session.start",{session:e,machineType:n.xrManager.machineType}))},onSessionEnd:function(){n.emit("xr.session.end",Xo("xr.session.end",{session:null,machineType:n.xrManager.machineType}))}}),n.xrControllerRay=[new e.Raycaster,new e.Raycaster],n.pointerLine=new xl,n.panoResources={},n.panoResources[n.locationMotion.keyframes[0].key=n.locationMotion.keyframes[1].key=ki()]={panoId:Ke(n.currentPano),leftPanoPicture:null,position:n.camera.pose.offset.clone(),effect:"fade"},n.parallaxCameraMatrixs=[];var i=Oe.shared.getContext();if(!i)return console.error("获取session失败,请退出重试"),n;n.xrManager.setSession(i),n.controllerWrappers=[new e.Group,new e.Group],n.scene.add(n.controllerWrappers[0],n.controllerWrappers[1]);var o=n.xrManager.getController(0);n.controllerWrappers[0].add(o);var a=n.xrManager.getController(1);n.controllerWrappers[1].add(a);var s=new Bl,l=n.xrManager.getControllerGrip(0);l.add(s.createControllerModel(l)),n.controllerWrappers[0].add(l);var u=n.xrManager.getControllerGrip(1);u.add(s.createControllerModel(u)),n.controllerWrappers[1].add(u);var c=(new e.BufferGeometry).setFromPoints([new e.Vector3(0,0,0),new e.Vector3(0,0,-1)]),h=new e.Line(c);return h.name="line",h.scale.z=5,o.add(h.clone()),a.add(h.clone()),n.xrControllerState={LeftAxesUp:{startPressingTIme:0,pressed:!1},LeftAxesDown:{startPressingTIme:0,pressed:!1},LeftAxesLeft:{startPressingTIme:0,pressed:!1},LeftAxesRight:{startPressingTIme:0,pressed:!1},LeftTrigger:{startPressingTIme:0,pressed:!1},LeftPinch:{startPressingTIme:0,pressed:!1},RightAxesUp:{startPressingTIme:0,pressed:!1},RightAxesDown:{startPressingTIme:0,pressed:!1},RightAxesLeft:{startPressingTIme:0,pressed:!1},RightAxesRight:{startPressingTIme:0,pressed:!1},RightTrigger:{startPressingTIme:0,pressed:!1},RightPinch:{startPressingTIme:0,pressed:!1},Y:{startPressingTIme:0,pressed:!1},X:{startPressingTIme:0,pressed:!1},A:{startPressingTIme:0,pressed:!1},B:{startPressingTIme:0,pressed:!1}},n}return Z(r,t),r.parseArgs=function(e){if(e instanceof r)return e;var n=$($({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return t.parseArgs.call(this,n)},r.initAnimationEndState=function(e){var r=this.parseArgs(e),n=t.initAnimationEndState.call(this,r);return $($({},n),{mode:"XRPanorama"})},r.prototype.moveToPano=function(t,r,n){var i,o,a,s,l=this;this.userAction=n,this.stopMomentumMovement();var u=this.works.getResolvedObserver(t);if(!u)throw new Error("Invalid PanoIndex");var c=this.imageOptions.size;if(void 0===c&&u){var h=u.images.up.match(/\/cube_(\d+)\//);h&&(c=Number(h[1]))}void 0===c&&(c=2048);var p=this.imageOptions.transform,d=function(e,t){return Ve(e,p,t)},f=$({key:"pano.".concat(u.panoId)},Yn(this.imageOptions,["format","size","quality"])),v=u.images,m=null!==(o=null===(i=u.images.tiles)||void 0===i?void 0:i.filter((function(e){return e.size>c})))&&void 0!==o?o:null,A="pano:"+Jn([v,f,p]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===A)return;var g=this.pendingTextureTask.panoId;null===(a=this.panoMeshes[g])||void 0===a||a.setProgress(0),this.emit("pano.texture.abort",Xo("pano.texture.abort",{error:null,progress:0,meta:null,pano:u.pano})),this.pendingTextureTask.onError(new Error("texture aborted"))}var y,b=this.models.getMaterial()||{},x=b.pano0,w=b.pano1;if((null==x?void 0:x.map.name)===A?y=x:(null==w?void 0:w.map.name)===A&&(y=w),y){var M={panoId:u.panoId,effect:null!==(s=r.effect)&&void 0!==s?s:"fade",leftPanoPicture:{map:y.map,luminanceMap:y.luminanceMap,matrix:(new e.Matrix4).compose(u.position,u.quaternion,kl)},position:u.position.clone()};this.doMoveToPano(u.pano,M,r)}else{var E="move-to-pano-"+u.panoId;this.pending.add(E),this.pendingTextureTask={panoId:u.panoId,hash:A,onLoad:function(t){var n;if(l.pending.delete(E),l.destroyed)t.body.dispose();else{t.body.name=A;var i={panoId:u.panoId,effect:null!==(n=r.effect)&&void 0!==n?n:"fade",leftPanoPicture:{map:t.body,luminanceMap:null,matrix:(new e.Matrix4).compose(u.position,u.quaternion,kl)},position:u.position.clone()};l.doMoveToPano(u.pano,i,r)}},onError:function(e){l.pending.delete(E);var t=$($($({},u.pano),{mode:l.mode}),ra(l.camera.pose));l.emit("pano.error",Xo("pano.error",{error:e,userAction:l.userAction,options:r,prevPano:l.currentPano,progress:0,state:t})),l.emit("pano.cancel",Xo("pano.cancel",{error:null,userAction:l.userAction,options:r,prevPano:l.currentPano,progress:0,state:t})),r.moveCancelCallback&&r.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&m&&m.length?this.textureLoader.loadTiledCubeTexture(v,m,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:d,options:f},format:e.RGBAFormat,viaAjax:!0},void 0,void 0,(function(e){var t,r;l.emit("pano.texture.progress",Xo("pano.texture.progress",{error:null,progress:e,meta:null,pano:u.pano})),(null===(t=l.pendingTextureTask)||void 0===t?void 0:t.hash)===A&&(null===(r=l.panoMeshes[u.panoId])||void 0===r||r.setProgress(e))}),this.renderer):this.textureLoader.loadCubeTexture(v,{imageURL:{transform:d,options:f},format:e.RGBAFormat},void 0,void 0,(function(e){var t,r;(null===(t=l.pendingTextureTask)||void 0===t?void 0:t.hash)===A&&(null===(r=l.panoMeshes[u.panoId])||void 0===r||r.setProgress(e)),l.emit("pano.texture.progress",Xo("pano.texture.progress",{error:null,progress:e,meta:null,pano:u.pano}))}),this.renderer)]).then((function(e){var t,r,n=e[0];(null===(t=l.pendingTextureTask)||void 0===t?void 0:t.hash)===A?(l.pendingTextureTask.onLoad(n),null===(r=l.panoMeshes[u.panoId])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("pano.texture.success",Xo("pano.texture.success",{error:null,progress:1,meta:n.meta,pano:u.pano}))):n.body.dispose()})).catch((function(e){var t,r;(null===(t=l.pendingTextureTask)||void 0===t?void 0:t.hash)===A&&(l.pendingTextureTask.onError(e),null===(r=l.panoMeshes[u.panoId])||void 0===r||r.setProgress(0),delete l.pendingTextureTask,l.emit("pano.texture.error",Xo("pano.texture.error",{error:e,progress:0,meta:null,pano:u.pano})),l.emit("error",e))})),this.emit("pano.texture.load",Xo("pano.texture.load",{error:null,progress:0,meta:null,pano:u.pano}))}},r.prototype.doMoveToPano=function(t,r,n){var i,o,a,s=this;void 0===n&&(n={});var l,u,c,h=ue(),p=ki();if(this.panoResources[p]=r,this.locationMotion.ended){var d=this.locationMotion.getKeyFrameSegment(h),f=(d[0],d[1]),v=this.locationMotion.value,m=this.panoResourceFromLocationMotionKeyframe(f).position,A=r.position;l=Math.max(m.distanceTo(A),1),u=[{key:f.key,progress:0,value:$($({},v),{count:0})},{key:p,progress:1,value:{distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0,count:1}}],c=0}else{var g=this.locationMotion.getKeyFrameSegment(h),y=g[0],b=(f=g[1],v=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(y).position),x=(m=this.panoResourceFromLocationMotionKeyframe(f).position,A=r.position,f.value.count-v.count),w=Math.max(b.distanceTo(m),1)*x;l=w+Math.max(m.distanceTo(A),1),u=[{key:y.key,progress:0,value:$({},v)},{key:f.key,progress:w/l,value:f.value},{key:p,progress:1,value:{count:f.value.count+1,distance:0,perspToOrtho:0,orthoDistance:1,modelAlpha:0}}];var M=this.locationMotionKeyframesLength(this.locationMotion.keyframes),E=this.locationMotionKeyframesLength(u);c=this.locationMotion.getProgressVelocity(h)*M/E}var C=this.calculateMovingDuration(n.duration,l),S={longitude:n.longitude,latitude:n.latitude,fov:n.fov},I=$($({},t),{mode:this.mode,longitude:null!==(i=S.longitude)&&void 0!==i?i:this.camera.pose.longitude,latitude:null!==(o=S.latitude)&&void 0!==o?o:this.camera.pose.latitude,fov:null!==(a=S.fov)&&void 0!==a?a:this.camera.pose.fov,offset:r.position.clone(),distance:0}),P=this.currentPano;this.emit("pano.moveTo",Xo("pano.moveTo",{options:n,prevPano:P,progress:0,state:I,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(I),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=se,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(S,C).catch(se),this.locationMotion.setKeyframes(u,C,c).then((function(){var r,i,o,a=$($({},t),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:0});s.emit("pano.arrived",Xo("pano.arrived",{options:n,prevPano:P,progress:1,state:a,userAction:s.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(a);var l=s.works.getResolvedObserver(s.currentPano);if(l&&l.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var u=Ol.clone().multiply(null!==(o=null===(i=null===(r=s.models.getMaterial())||void 0===r?void 0:r.pano1)||void 0===i?void 0:i.matrix)&&void 0!==o?o:new e.Matrix4).multiply(l.video.matrix),c={map:s.videoTexture,size:l.video.size,matrix:u,alpha:1},h=ki(),p=s.videoTexture.image;p.setAttribute("uuid",h),xa().then((function(e){e&&l.video&&p.getAttribute("uuid")===h&&(p.oncanplay=function(){p.oncanplay=se,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=se,s.panoVideo.setMaterial(c))},p.src=l.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){s.emit("pano.cancel",Xo("pano.cancel",{options:n,prevPano:P,progress:0,state:I,userAction:s.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()}))},r.prototype.checkSelectedPano=function(t){var r,n,i,o,a=this;this.stopMomentumMovement();var s=this.camera.getDirection(new e.Vector3).setY(0),l=null,u=this.works.getResolvedObserver(this.currentPano);if(!u)return null;var c=u.accessibleIds.filter((function(e){var t=We(e);if(Ye(t,a.currentPano))return!1;var r=a.works.getResolvedObserver(t);return!!r&&!(r.position.distanceTo(a.camera.position)>a.maxAccessibleDistance)&&(r.loadable||r.active)})),h=this.models.intersectRaycaster(t)[0];if(h){var p=ea(c,(function(e){var t=a.works.getResolvedObserver(e);return t?t.standingPosition.clone().distanceTo(h.point):1/0}),!0),d=p[0],f=p[1];d&&f<this.panoTapTriggerRadius&&(l=null!==(r=this.works.getResolvedObserver(d))&&void 0!==r?r:null)}if(ul(l)){var v=this.getForwardObserverOrNot(t);v&&(l=v)}for(var m=0,A=this.locationMotion.keyframes;m<A.length;m++){var g=A[m],y=this.panoResourceFromLocationMotionKeyframe(g);if(!(g.progress<this.locationMotion.progress)&&l&&y.panoId===l.panoId){l=null;break}}if(ul(l))return!0===this.locationMotion.ended&&this.cameraBounce(),null;if(l&&!l.active){var b=l.panoId;this.panoMeshes[b]&&(this.panoMeshes[b].setDisabled(!1),this.panoMeshes[b].setLoading(!0))}var x={};if(l){x.effect="fade";for(var w=Math.PI/6,M=Math.PI/12,E=new e.Vector3(0,1,0),C=l.position.clone().setY(0).sub(u.position.clone().setY(0)).normalize(),S=C.clone().applyAxisAngle(E,w),I=C.clone().applyAxisAngle(E,-w),P=[],T=[],B=[],R=0,O=l.accessibleIds;R<O.length;R++){var k=We(d=O[R]);if(!Ye(k,this.currentPano)&&!Ye(k,l.pano)){var D=this.works.getResolvedObserver(d);if(D){var L=D.position.clone().sub(l.position).setY(0);C.angleTo(L)<w?B.push(L):S.angleTo(L)<w?P.push(L):I.angleTo(L)<w&&T.push(L)}}}var F=(B.length>0?B:re(re([],P,!0),T,!0)).slice().sort((function(e,t){return e.angleTo(C)-t.angleTo(C)}))[0];F&&F.angleTo(s)>M&&(x.longitude=Math.atan2(-F.x,-F.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(x.latitude=Or(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(x.fov=this.defaultFov);var Q={workCode:l.pano.workCode,panoIndex:l.pano.panoIndex,mode:this.mode,longitude:null!==(n=x.longitude)&&void 0!==n?n:this.camera.pose.longitude,latitude:null!==(i=x.latitude)&&void 0!==i?i:this.camera.pose.latitude,fov:null!==(o=x.fov)&&void 0!==o?o:this.camera.pose.fov,distance:0,offset:l?l.position.clone():new e.Vector3};return this.emit("pano.select",Xo("pano.select",{prevPano:this.currentPano,state:Q,userAction:!0,options:x,progress:0,error:null})),l&&l.active?(this.emit("pano.request",Xo("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:Q,options:x,error:null})),l.pano):null},r.prototype.destroy=function(){t.prototype.destroy.call(this)},r.prototype.isReady=function(){return!1},r.prototype.updateTime=function(t,r){for(var n,i,o,a,s,l,u,c,h=this,p=[],d=2;d<arguments.length;d++)p[d-2]=arguments[d];var f={},v={},m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),A=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),g=!1;if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(t),v.longitude=this.cameraMotion.value.longitude,v.latitude=this.cameraMotion.value.latitude,v.fov=this.cameraMotion.value.fov),!1===this.locationMotion.ended){this.locationMotion.update(t);var y=this.locationMotion.getKeyFrameSegment(t),b=y[0],x=y[1],w=this.panoResourceFromLocationMotionKeyframe(b),M=this.panoResourceFromLocationMotionKeyframe(x),E=(new e.Vector3).copy(w.position),C=(new e.Vector3).copy(M.position),S=this.locationMotion.value.count-x.value.count+1;f.progress=S,f.modelAlpha=this.locationMotion.value.modelAlpha,this.camera.perspToOrtho.setScalar(Or(this.locationMotion.value.perspToOrtho,0,1)),this.camera.orthoDistance=this.locationMotion.value.orthoDistance,M.leftPanoPicture&&(S<1?w.leftPanoPicture&&(f.pano0=w.leftPanoPicture):f.pano0=M.leftPanoPicture,f.pano1=M.leftPanoPicture),g=f.useBlackTransition="instant"===M.effect||"montage"===M.effect,"fade"!==M.effect&&"montage"!==M.effect||(f.pano0&&w.leftPanoPicture&&(f.pano0={map:f.pano0.map,luminanceMap:f.pano0.luminanceMap,matrix:w.leftPanoPicture.matrix.clone().setPosition(M.position)}),E.copy(C)),v.distance=this.locationMotion.value.distance,v.offset=new e.Vector3(E.x+(C.x-E.x)*S,E.y+(C.y-E.y)*S,E.z+(C.z-E.z)*S);for(var I=[],P=[],T=0,B=this.locationMotion.keyframes;T<B.length;T++){var R=B[T],O=R.key,k=R.progress;void 0!==O&&(I.push(O),k>=this.locationMotion.progress&&P.push(O))}for(var D=0,L=Object.keys(this.panoResources);D<L.length;D++){var F=L[D];if(!(P.indexOf(F)>=0)){var Q=this.panoResources[F];if(Q.leftPanoPicture){var N=Q.leftPanoPicture.map;if(N){if(N===(null===(n=f.pano0)||void 0===n?void 0:n.map))continue;if(N===(null===(i=f.pano1)||void 0===i?void 0:i.map))continue;N instanceof Ot&&N.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(N.cubeRenderTarget),N.dispose(),Q.leftPanoPicture=null}}I.indexOf(F)>=0||delete this.panoResources[F]}}this.currentPano=We(M.panoId),this.emit("pano.moving",Xo("pano.moving",{userAction:this.userAction,prevPano:We(m.panoId),state:$($($($({},We(A.panoId)),{mode:this.mode}),ra(this.camera.pose)),v),options:{},progress:this.locationMotion.progress,error:null}))}!1===ta(f)&&((null===(o=f.pano0)||void 0===o?void 0:o.map)&&f.pano0.map instanceof Ot&&!f.pano0.map.cubeRenderTarget&&(f.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(a=f.pano1)||void 0===a?void 0:a.map)&&f.pano1.map instanceof Ot&&!f.pano1.map.cubeRenderTarget&&(f.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(f)),!1===ta(v)&&this.setCamera(v),p[0];var V=p[1];if(V)if(this.xrManager.session){var U=this.xrManager.referenceSpace;if(U){var z=this.xrManager.cameraVR,_=this.xrManager.cameraL,q=this.xrManager.cameraR,H=[_,q],j=V.getViewerPose(U),G=new e.Vector3(0,0,0);if(j){var K;switch(this.xrManager.machineType){case"Pico":K=this.xrManager.session.renderState.baseLayer;break;case"Oculus":var W=this.xrManager.session.renderState.layers;W&&(K=W[0]);break;default:this.xrManager.machineType}var Y=j.views;if(K){this.renderer.setFramebuffer(K.framebuffer);var X=!1;Y.length!==z.cameras.length&&(z.cameras.length=0,X=!0),this.parallaxCameraMatrixs=[];var J=new e.Vector3,Z=new e.Vector3;(new e.Matrix4).fromArray(Y[0].transform.matrix).decompose(J,new e.Quaternion,new e.Vector3),(new e.Matrix4).fromArray(Y[1].transform.matrix).decompose(Z,new e.Quaternion,new e.Vector3),Z.clone().sub(J).normalize();var ee=new e.Vector3,te=new e.Quaternion,re=new e.Vector3;this.camera.matrix.decompose(ee,te,re);for(var ne=0;ne<Y.length;ne++){var ie=Y[ne],oe=K.getViewport(ie),ae=H[ne];ae.matrix.fromArray(ie.transform.matrix);var se=new e.Vector3,le=new e.Quaternion,ue=new e.Vector3;ae.matrix.decompose(se,le,ue),G.copy(ee),ae.position.copy(ee),ae.quaternion.copy(le),ae.scale.copy(ue),ae.updateMatrix(),ae.projectionMatrix.fromArray(ie.projectionMatrix),ae.viewport.set(oe.x,oe.y,oe.width,oe.height),!0===X&&z.cameras.push(ae)}var ce=this.works.getResolvedObserver(this.currentPano),he=j.views[0].transform.position,pe=j.views[1].transform.position,de=new e.Vector3((he.x+pe.x)/2,0,(he.z+pe.z)/2),fe=this.xrManager.session.inputSources;for(ne=0;ne<this.xrManager.controllers.length;ne++){var ve=this.xrManager.controllers[ne],me=fe[ne];ve.update(me,V,U);var Ae=this.xrManager.getController(ne),ge=new e.Vector3(0,ce?ce.standingPosition.y:0,0),ye=Ae.position.clone().add(G).add(ge).sub(de);this.controllerWrappers[ne].position.copy(ye).add(ge),this.xrControllerRay[ne].set(this.xrManager.getController(1).position.clone().add(G).add(ge),new e.Vector3(0,0,-1).applyEuler(Ae.rotation));var be=this.models.intersectRaycaster(this.xrControllerRay[1]);0===be.length&&(be=this.xrControllerRay[1].intersectObject(this.boundingMesh,!0));var xe=be[0],we=Xo("intersect.update",{raycaster:null!==(s=this.xrControllerRay[1])&&void 0!==s?s:null,intersection:null!=xe?xe:null,object:this.intersectMesh});if(this.emit("intersect.update",we),we.defaultPrevented)return void this.hideIntersectMesh();if(xe&&xe.face){this.pointerLine.setPoints(ye,xe.point);var Me=xe.face.normal,Ee=Me.clone().multiplyScalar(.05),Ce=xe.point.clone().add(Ee);this.intersectMesh.position.copy(Ce);var Se=Ce.clone().add(Ee);if(this.intersectMesh.lookAt(Se),Math.abs(Me.y)>.99){var Ie=this.camera.position.clone().sub(Ce);this.intersectMesh.rotation.z=-Math.atan2(Ie.z,Ie.x)}this.intersectMesh.visible=!0,this.needsRender=!0}}if(this.camera.pose.distance>.1||g){if(ce)for(var Pe=0,Te=Object.keys(this.panoMeshes);Pe<Te.length;Pe++){var Be=Te[Pe];(Ne=this.panoMeshes[Be]).setOpacity(0),Ne.setCurrent(!1),Ne.updateTime&&Ne.updateTime(t,r)}}else if(ce){var Re=ea(ce.visibleIds,(function(e){var t=h.works.getResolvedObserver(e);return t?ce.standingPosition.distanceTo(t.standingPosition):1/0}),!0),Oe=Re[1];Oe=Or(Oe,2.5,1/0);for(var ke=ce.visibleIds.concat(Ke(this.currentPano)),De=this.getForwardObserverOrNot(),Le=this.camera.getDirection(new e.Vector3),Fe=0,Qe=Object.keys(this.panoMeshes);Fe<Qe.length;Fe++){Be=Qe[Fe];var Ne=this.panoMeshes[Be],Ve=this.works.getResolvedObserver(Be);if(-1===ke.indexOf(Be))Ne.setCurrent(!1),Ne.setOpacity(0);else if(Ve)if(Ve.loadable||Ve.active){var Ue=Ne.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Ne.setCurrent(!Ne.loading&&0===Ne.progress&&null!==De&&De.panoId===Be),Ne.setOpacity(Ue<.01?0:Or(Oe/Ue*1.2,.65,.98));var ze=this.camera.position.clone().setY(Ne.position.y),_e=(new e.Vector3).copy(Ne.position).sub(ze).normalize();if(Be===Ke(this.currentPano)){var qe=Or((.5-ze.distanceTo(Ne.position))/.5,0,1);_e.multiplyScalar(1-qe).add(Le.clone().multiplyScalar(qe))}_e.length()>0&&Ne.quaternion.setFromEuler(new e.Euler(0,Math.atan2(_e.x,_e.z),0))}else Ne.setCurrent(!1),Ne.setOpacity(0);else Ne.setCurrent(!1),Ne.setOpacity(0);Ne.updateTime&&Ne.updateTime(t,r)}}var He=function(){if(!1===h.tileLevelForFov)return 0;var t=new e.Vector2(4e3,4e3),r=A.panoId,n=h.works.getResolvedObserver(r),i=h.imageOptions.size;if(void 0===i&&n){var o=n.images.up.match(/\/cube_(\d+)\//);o&&(i=Number(o[1]))}void 0===i&&(i=2048);var a=0;i>=1024&&(a=1),i>=2048&&(a=2),i>=4096&&(a=3),i>=8192&&(a=4);var s=h.tileLevelForFov(_.fov,t);return s>a?s:0}(),je=function(){var t=new e.PerspectiveCamera;t.applyMatrix4(z.matrix),t.position.set(0,0,0);var r=h.works.getResolvedObserver(A.panoId),n=null!=r?r:ce;return n&&t.quaternion.premultiply(n.quaternion.clone().inverse()),t.updateProjectionMatrix(),t.updateMatrixWorld(!0),(new e.Frustum).setFromProjectionMatrix((new e.Matrix4).multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse))}();A.panoId===Ke(this.currentPano)&&(null===(l=A.leftPanoPicture)||void 0===l?void 0:l.map)instanceof Ot&&(A.leftPanoPicture.map.update(je,He),!0===A.leftPanoPicture.map.needsRender&&(this.needsRender=!0));var Ge=this.tiling.object.visible;if(He>this.TILED_CUBE_TEXTURE_LEVEL&&this.initAnimationed){var Ye=A.panoId,Xe=this.works.getResolvedObserver(Ye);Xe&&Vo(this.camera.position,Xe.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Ye&&this.tiling.cleanup(),this.tiling.panoId=Ye,this.tiling.setResource(null!==(c=null===(u=Xe.images)||void 0===u?void 0:u.tiles)&&void 0!==c?c:[],this.enableIOSEDR&&Xe.images.luminance?Xe.images.luminance:null),this.tiling.setAllowHosts(Xe.work.allowHosts),this.tiling.setNetworkSubscribe(this.networkSubscribe),this.tiling.setRequestProxy(this.requestProxy),this.tiling.setRotation(Xe.quaternion),this.tiling.setPosition(Xe.position),this.tiling.update(je,He,t)):this.tiling.object.visible=!1}else this.tiling.object.visible=!1;Ge!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(t),this.updateControllerHelper(fe,t)}else console.error("no layer found")}}}else console.error("session丢失,请重试");else console.error("xrFrame丢失,请重试")},r.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.scene,e)},r.prototype.onPanGesture=function(){},r.prototype.onTapGesture=function(){},r.prototype.onPinchGesture=function(){},r.prototype.onMouseMove=function(){},r.prototype.onMouseOut=function(){},r.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},r.prototype.updateControllerHelper=function(e,t){if(e&&2===e.length&&e[0].gamepad&&e[1].gamepad)for(var r=0;r<e.length;r++){var n=e[r].handedness,i=e[r].gamepad;switch(n){case"left":-1===i.axes[2]?this.xrControllerState.LeftAxesLeft.pressed||(this.xrControllerState.LeftAxesLeft.pressed=!0,t-this.xrControllerState.LeftAxesLeft.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"LeftAxesLeft",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.LeftAxesLeft.pressed=!1,this.xrControllerState.LeftAxesLeft.startPressingTIme=0),1===i.axes[2]?this.xrControllerState.LeftAxesRight.pressed||(this.xrControllerState.LeftAxesRight.pressed=!0,t-this.xrControllerState.LeftAxesRight.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"LeftAxesRight",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.LeftAxesRight.pressed=!1,this.xrControllerState.LeftAxesRight.startPressingTIme=0),-1===i.axes[3]?this.xrControllerState.LeftAxesUp.pressed||(this.xrControllerState.LeftAxesUp.pressed=!0,t-this.xrControllerState.LeftAxesUp.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"LeftAxesUp",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.LeftAxesUp.pressed=!1,this.xrControllerState.LeftAxesUp.startPressingTIme=0),1===i.axes[3]?this.xrControllerState.LeftAxesDown.pressed||(this.xrControllerState.LeftAxesDown.pressed=!0,t-this.xrControllerState.LeftAxesDown.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"LeftAxesDown",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.LeftAxesDown.pressed=!1,this.xrControllerState.LeftAxesDown.startPressingTIme=0),i.buttons[4].pressed?this.xrControllerState.X.pressed||(this.xrControllerState.X.pressed=!0,t-this.xrControllerState.X.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"X",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.X.pressed=!1,this.xrControllerState.X.startPressingTIme=0),i.buttons[5].pressed?this.xrControllerState.Y.pressed||(this.xrControllerState.Y.pressed=!0,t-this.xrControllerState.Y.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"Y",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.Y.pressed=!1,this.xrControllerState.Y.startPressingTIme=0),(null==i?void 0:i.buttons[0].pressed)?this.xrControllerState.LeftTrigger.pressed||(this.xrControllerState.LeftTrigger.pressed=!0,t-this.xrControllerState.LeftTrigger.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"LeftTrigger",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.LeftTrigger.pressed=!1,this.xrControllerState.LeftTrigger.startPressingTIme=0),(null==i?void 0:i.buttons[1].pressed)?this.xrControllerState.LeftPinch.pressed||(this.xrControllerState.LeftPinch.pressed=!0,t-this.xrControllerState.LeftPinch.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"LeftPinch",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.LeftPinch.pressed=!1,this.xrControllerState.LeftPinch.startPressingTIme=0);break;case"right":-1===i.axes[2]?this.xrControllerState.RightAxesLeft.pressed||(this.xrControllerState.RightAxesLeft.pressed=!0,t-this.xrControllerState.RightAxesLeft.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"RightAxesLeft",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.RightAxesLeft.pressed=!1,this.xrControllerState.RightAxesLeft.startPressingTIme=0),1===i.axes[2]?this.xrControllerState.RightAxesRight.pressed||(this.xrControllerState.RightAxesRight.pressed=!0,t-this.xrControllerState.RightAxesRight.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"RightAxesRight",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.RightAxesRight.pressed=!1,this.xrControllerState.RightAxesRight.startPressingTIme=0),-1===i.axes[3]?this.xrControllerState.RightAxesUp.pressed||(this.xrControllerState.RightAxesUp.pressed=!0,t-this.xrControllerState.RightAxesUp.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"RightAxesUp",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.RightAxesUp.pressed=!1,this.xrControllerState.RightAxesUp.startPressingTIme=0),1===i.axes[3]?this.xrControllerState.RightAxesDown.pressed||(this.xrControllerState.RightAxesDown.pressed=!0,t-this.xrControllerState.RightAxesDown.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"RightAxesDown",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.RightAxesDown.pressed=!1,this.xrControllerState.RightAxesDown.startPressingTIme=0),i.buttons[4].pressed?this.xrControllerState.A.pressed||(this.xrControllerState.A.pressed=!0,t-this.xrControllerState.A.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"A",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.A.pressed=!1,this.xrControllerState.A.startPressingTIme=0),i.buttons[5].pressed?this.xrControllerState.B.pressed||(this.xrControllerState.B.pressed=!0,t-this.xrControllerState.B.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"B",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.B.pressed=!1,this.xrControllerState.B.startPressingTIme=0),(null==i?void 0:i.buttons[0].pressed)?this.xrControllerState.RightTrigger.pressed||(this.xrControllerState.RightTrigger.pressed=!0,t-this.xrControllerState.RightTrigger.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"RightTrigger",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.RightTrigger.pressed=!1,this.xrControllerState.RightTrigger.startPressingTIme=0),(null==i?void 0:i.buttons[1].pressed)?this.xrControllerState.RightPinch.pressed||(this.xrControllerState.RightPinch.pressed=!0,t-this.xrControllerState.RightPinch.startPressingTIme>=Rl&&this.emit("xr.gesture.tap",Xo("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:"RightPinch",isFinal:!0,isFirst:!0,controllers:this.xrControllerRay.map((function(e){return{raycaster:e}}))}))):(this.xrControllerState.RightPinch.pressed=!1,this.xrControllerState.RightPinch.startPressingTIme=0)}}},r}(es),Ll={Floorplan:la,Topview:ya,Panorama:es,VRPanorama:Rs,Model:ks,DepthPanorama:Us,Mapview:ll,XRPanorama:Dl},Fl=["gesture.pan","gesture.tap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap"];function Ql(e){for(var t,r,n={},i=0,o=e.split(/(\;|\,)/);i<o.length;i++){var a=o[i].split("="),s=null===(t=a[0])||void 0===t?void 0:t.trim(),l=null===(r=a[1])||void 0===r?void 0:r.trim();s&&l&&(n[s]=l)}return n}function Nl(){for(var e,t=document.getElementsByTagName("meta"),r=0;r<t.length;r++){var n=t[r];if("viewport"===n.getAttribute("name")){var i=Ql(null!==(e=n.getAttribute("content"))&&void 0!==e?e:""),o=Number(i["initial-scale"]);if(!isNaN(o))return o}}return 1}var Vl=[351,63],Ul=[20,20],zl=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),_l=new Float32Array([0,0,1,0,0,1,1,1]),ql=new Uint8Array([0,1,2,1,3,2]),Hl=new e.BufferGeometry;Hl.setAttribute("position",new e.BufferAttribute(zl,3)),Hl.setAttribute("uv",new e.BufferAttribute(_l,2)),Hl.setIndex(new e.BufferAttribute(ql,1));var jl=new e.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),Gl=new e.Mesh(Hl,jl);Gl.matrixAutoUpdate=!1;var Kl=new e.Scene;Kl.add(Gl),Kl.matrixAutoUpdate=!1;var Wl=new e.OrthographicCamera(-.5,.5,.5,-.5,.1,1);Wl.position.set(0,0,.5),Wl.lookAt(0,0,0),Wl.updateMatrixWorld(!0),Wl.matrixAutoUpdate=!1;var Yl=new e.Vector4,Xl=new e.Vector4;function Jl(t){if(jl.map){var r=t.getViewport(Yl),n=t.getScissor(Xl),i=t.getScissorTest(),o=t.autoClear,a=n.x+Ul[0]/3,s=n.y+Ul[1]/3,l=Vl[0]/3,u=Vl[1]/3;t.setViewport(a,s,l,u),t.setScissor(a,s,l,u),t.setScissorTest(!0),t.autoClear=!1,t.render(Kl,Wl),t.setViewport(r),t.setScissor(n),t.setScissorTest(i),t.autoClear=o}else{var c=new e.Texture,h=new Image;h.onload=function(){c.image=h,c.wrapS=e.ClampToEdgeWrapping,c.wrapT=e.ClampToEdgeWrapping,c.minFilter=e.LinearFilter,c.needsUpdate=!0,c.generateMipmaps=!1,jl.needsUpdate=!0,h.onload=se},h.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjh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RjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==",jl.map=c}}var Zl=function(e){return 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/")},$l=new e.Vector2,eu=new e.Frustum,tu=new e.Matrix4,ru=new WeakMap,nu=new WeakMap,iu=bo([]),ou=function(t){function r(r){void 0===r&&(r={});var n,i,o,a,s,l,u,c,h,p,d,f=this;if((f=t.call(this)||this).ident=ki(),au.instances[f.ident]=f,f.renderSwitch01=0,f.currentMode="Panorama",f.pano={workCode:"",panoIndex:0},f.needsRender=!1,f.onlyRenderIfNeeds=null===(n=r.onlyRenderIfNeeds)||void 0===n||n,f.imageOptions=$({},null!==(i=r.imageOptions)&&void 0!==i?i:{}),f.textureOptions=$({},null!==(o=r.textureOptions)&&void 0!==o?o:{}),f.modelLodOptions=$({},null!==(a=r.modelLod)&&void 0!==a?a:{}),f.poweredByRealsee=null===(s=r.poweredByRealsee)||void 0===s||s,f.extraElements=[],f.controllerInits={Panorama:Object.assign({},r.panorama),Model:Object.assign({},r.model),Floorplan:Object.assign({},r.floorplan),Topview:Object.assign({},r.topview),Mapview:Object.assign({},r.mapview),DepthPanorama:Object.assign({},r.depthPanorama),VRPanorama:Object.assign({},r.vrPanorama),XRPanorama:Object.assign({},r.xrPanorama)},f.fps={testCount:0,testTime:ue()},f.info=null,f.modeChangeDuration=null!==(l=r.modeChangeDuration)&&void 0!==l?l:800,"undefined"!=typeof window)if(r.renderer)r.renderer instanceof Vt&&f.throwError(new Error("cannot render a internal renderer")),f.renderer=r.renderer;else try{f.renderer=new Vt({preserveDrawingBuffer:r.preserveDrawingBuffer,backgroundColor:r.backgroundColor,backgroundAlpha:r.backgroundAlpha,antialias:r.antialias,webgl2:null==r?void 0:r.webgl2});var v=Nl();f.renderer.setPixelRatio(1===v?window.devicePixelRatio:1),f.renderer.setSize(512,512)}catch(e){e instanceof Error&&f.throwError(e)}f.getPixelsRenderTarget=new e.WebGLRenderTarget(1,1,{encoding:null!==(c=null===(u=f.renderer)||void 0===u?void 0:u.outputEncoding)&&void 0!==c?c:e.sRGBEncoding}),f.scissor=Object.assign({left:0,bottom:0,width:1,height:1},r.scissor),f.camera=new Gt(90),f.scene=new Ut,f.scene.matrixAutoUpdate=!1,f.lastLoadWorkTask=Promise.resolve(),f.requestProxy=null!==(h=r.requestProxy)&&void 0!==h?h:Zl,f.networkSubscribe=new Ce,f.networkSubscribe.on("network",(function(e,t,r,n){var i;f.emit("network.resource",Xo("network.resource",{source:e,requestType:t,requestState:r,detail:n})),null===(i=f.analysis)||void 0===i||i.network(f.works,e,t,r,n)})),f.boundingMesh=(p=new e.Box3(new e.Vector3(-.5,-.5,-.5),new e.Vector3(.5,.5,.5)),void 0===d&&(d=zo),new _o(p,d)),f.boundingMesh.name="bounding",f.scene.add(f.boundingMesh),f.models=Xi(),f.models.push(new Yi),f.lastModels=Xi(),f.readyCallbacks=[],f.syncingState=!1,f.modelGroup=new e.Group,f.modelGroup.visible=!1,f.modelGroup.name="model",f.modelGroup.matrixAutoUpdate=!1,f.modelGroup.renderOrder=-4,f.scene.add(f.modelGroup),f.helperGroup=new e.Group,f.helperGroup.name="helper",f.helperGroup.matrixAutoUpdate=!1,f.scene.add(f.helperGroup),f.videoTexture=new e.VideoTexture(r.videoInstance||function(){var e=document.createElement("video");e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin="";var t=function(){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}()),function(t){(r=new e.DirectionalLight(16777215,.5)).position.copy(new e.Vector3(1,1,1)),t.add(r);var r=new e.DirectionalLight(16777215,.3);t.add(r),r=new e.AmbientLight(16777215,.3),t.add(r)}(f.scene),f.copyEffect=new Ra(f.renderer,f.scene,f.camera,f.models),f.state={mode:f.currentMode,workCode:f.pano.workCode,panoIndex:f.pano.panoIndex,longitude:f.camera.pose.longitude,latitude:f.camera.pose.latitude,fov:f.camera.pose.fov,offset:f.camera.pose.offset.clone(),distance:f.camera.pose.distance},f.stateSynced=!1,f._enableIOSEDR=!1,f.destroyed=!1,f.paused=!0,"undefined"!=typeof window&&(!1!==r.play&&f.play(),f.stopAnimationLoop=Oe.shared.add((function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];f.updateTime.apply(f,re([e,t],r,!1))}),!1,0,10));var m,A=function(){"undefined"!=typeof document&&null===document.fullscreenElement&&"VRPanorama"===f.currentMode&&f.controller.emit("vr.requestExit",Xo("vr.requestExit",{}))};if("undefined"!=typeof document&&document.addEventListener("fullscreenchange",A,!1),f.removeEventListeners=function(){"undefined"!=typeof document&&document.removeEventListener("fullscreenchange",A,!1)},f.plugins={},r.plugins&&r.plugins.length)for(var g=0,y=r.plugins;g<y.length;g++){var b=y[g];if("function"==typeof b)b(f);else if(Array.isArray(b)){var x=b[0],w=b[1],M=b[2];if("function"==typeof x){var E=x(f,M);"string"==typeof w&&(f.plugins[w]?f.throwError(new Error("plugin name ".concat(w," is exists."))):f.plugins[w]=E)}}}return f.gpuPickingRenderTarget=new e.WebGLRenderTarget(1,1),f.meshReplaceMaterialMap=new Map,f.meshOriginMaterialMap=new Map,(m=f).on("initAnimation.start",(function(e){m.emit("initAnimationWillStart",e.state.panoIndex,e.state,e.userAction)})),m.on("initAnimation.end",(function(e){m.emit("initAnimationEnded",e.state.panoIndex,e.state,e.userAction)})),m.on("gesture.pan",(function(e){m.emit("wantsGesture","pan",e.pointers,e.isFinal)&&e.preventDefault(),m.emit("wantsPanGesture",e.state,e.isFinal)&&e.preventDefault(),e.defaultPrevented||(m.emit("gesture","pan",e.pointers,e.isFinal),m.emit("panGesture",e.state,e.isFinal))})),m.on("gesture.tap",(function(e){m.emit("wantsGesture","tap",e.pointers,e.isFinal)&&e.preventDefault(),m.emit("wantsTapGesture",e.center.raycaster,e.center.coords,e.isFinal)&&e.preventDefault(),e.defaultPrevented||(m.emit("gesture","tap",e.pointers,e.isFinal),m.emit("tapGesture",e.center.raycaster,e.center.coords,e.isFinal))})),m.on("gesture.press",(function(e){m.emit("wantsGesture","press",e.pointers,e.isFinal)&&e.preventDefault(),m.emit("wantsPressGesture",e.center.raycaster,e.center.coords,e.center.delta,e.isFinal)&&e.preventDefault(),e.defaultPrevented||(m.emit("gesture","press",e.pointers,e.isFinal),m.emit("pressGesture",e.center.raycaster,e.center.coords,e.center.delta,e.isFinal))})),m.on("gesture.pinch",(function(e){m.emit("wantsGesture","pinch",e.pointers,e.isFinal)&&e.preventDefault(),m.emit("wantsPinchGesture",e.scale,e.state.fov,e.isFinal)&&e.preventDefault(),e.defaultPrevented||(m.emit("gesture","pinch",e.pointers,e.isFinal),m.emit("pinchGesture",e.scale,e.state.fov,e.isFinal))})),m.on("gesture.mousewheel",(function(e){m.emit("wantsGesture","mouseWheel",e.pointers,e.isFinal)&&e.preventDefault(),m.emit("wantsMouseWheel",e.center.delta,e.state.fov,e.isFinal)&&e.preventDefault(),e.defaultPrevented||(m.emit("gesture","mouseWheel",e.pointers,e.isFinal),m.emit("mouseWheel",e.center.delta,e.state.fov,e.isFinal))})),m.on("gesture.mousemove",(function(e){m.emit("wantsGesture","mouseMove",e.pointers,e.isFinal)&&e.preventDefault(),e.defaultPrevented||(m.emit("gesture","mouseMove",e.pointers,e.isFinal),m.emit("wantsChangeCameraFov",e.state.fov)&&e.preventDefault())})),m.on("gesture.momentum",(function(e){m.emit("wantsInteriaPan",e.state)&&e.preventDefault(),e.defaultPrevented||m.emit("interiaPan",e.state,e.isFinal)})),m.on("camera.update",(function(e){m.emit("cameraFovUpdate",e.state.fov,e.userAction),m.emit("cameraDirectionUpdate",e.state,e.userAction);var t=zt(e.state);t.setLength(e.state.distance);var r=e.state.offset.clone().sub(t);m.emit("cameraPositionUpdate",r,e.userAction),m.emit("cameraUpdate",e.state,e.userAction)})),m.on("intersect.update",(function(e){e.intersection?(m.emit("wantsShowIntersectionOnModel",e.raycaster)&&e.preventDefault(),e.defaultPrevented||m.emit("intersectionOnModelUpdate",e.intersection,e.object)):m.emit("intersectionHidden")})),m.on("pano.request",(function(e){var t=m.emit("wantsMoveToPano",e.state.panoIndex,e.options,e.userAction);t||(t=m.emit("wantsToMoveToPano",e.state.panoIndex,e.options,e.userAction)),t&&e.preventDefault(),e.defaultPrevented||m.emit("panoWillLoad",e.state.panoIndex)})),m.on("pano.select",(function(e){m.emit("panoSelected",e.state.panoIndex)})),m.on("pano.moveTo",(function(e){m.emit("panoLoaded",e.state.panoIndex),m.emit("moveToPano",e.state.panoIndex,e.userAction),m.emit("panoWillArrive",e.state.panoIndex,e.state,e.userAction)})),m.on("pano.moving",(function(e){m.emit("movingToPano",e.state.panoIndex,e.prevPano.panoIndex,e.progress)})),m.on("pano.arrived",(function(e){m.emit("panoArrived",e.state.panoIndex,e.state,e.userAction)})),m.on("pano.cancel",(function(e){m.emit("moveToPanoCanceled",e.state.panoIndex)})),m.on("pano.error",(function(e){m.emit("panoLoadError",e.error,e.state.panoIndex)})),m.on("pano.texture.load",(function(e){m.emit("textureStartLoad",e.pano.panoIndex)})),m.on("pano.texture.success",(function(e){m.emit("textureLoaded",e.pano.panoIndex,e.meta)})),m.on("pano.texture.error",(function(e){m.emit("textureError",e.error,e.pano.panoIndex)})),m.on("pano.texture.abort",(function(e){m.emit("textureAbort",e.pano.panoIndex)})),m.on("pano.texture.progress",(function(e){m.emit("textureLoading",e.progress,e.pano.panoIndex)})),m.on("xr.session.start",(function(e){m.emit("webXRSessionStart")})),m.on("xr.session.end",(function(e){m.emit("webXRSessionEnd")})),m.on("xr.gesture.tap",(function(e){m.emit("webXRControllerEvent","tap",e.buttons,{raycaster:e.controllers.map((function(e){return e.raycaster}))})})),m.on("works.request",(function(e){m.emit("willLoad",e.input,e.works[0],e.state)})),m.on("works.load",(function(e){m.emit("load",e.input,e.works[0],e.state)})),m.on("works.ready",(function(e){m.emit("loaded",e.input,e.works[0])})),m.on("state.change",(function(e){m.emit("stateChange",e.state,e.userAction)})),m.on("currentState.change",(function(e){m.emit("currentStateChange",e.state,e.userAction)})),m.on("state.set",(function(e){m.emit("setState",e.state)})),m.on("state.synced",(function(e){m.emit("stateSynced",e.state)})),m.on("model.request",(function(e){m.emit("modelWillLoad",e.work.model)})),m.on("model.error",(function(e){m.emit("modelLoadError",e.error,e.model)})),m.on("model.load",(function(e){m.emit("modelLoaded",e.model)})),m.on("model.changeShownFloor",(function(e){m.emit("modelShownFloorChange",e.model.shownFloor,e.model.floorLength)})),m.on("render",(function(e){m.emit("renderFrame",e.needsRender)})),m.on("mode.change.request",(function(e){m.emit("wantsChangeMode",e.mode,e.prevMode)})),m.on("mode.change",(function(e){m.emit("modeChange",e.mode,e.prevMode,e.state.panoIndex,e.state,e.userAction)})),m.on("helpers.visible",(function(e){m.emit("helpersVisibleChange",e.object.visible)})),m.on("network.resource",(function(e){m.emit("network",e.source,e.requestType,e.requestState,e.detail)})),f}return Z(r,t),Object.defineProperty(r,"version",{get:function(){return"6.0.0-alpha.7"},enumerable:!1,configurable:!0}),Object.defineProperty(r,"dracoPath",{get:function(){return vn.decoderPath},set:function(e){vn.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),r.prototype.getGPUPicking=function(t,r,n,i,o){var a=this;if(void 0===i&&(i=1),void 0===o&&(o=new e.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.models.setMaterial({constantColor:o}),this.scene.traverse((function(t){if(t instanceof e.Mesh&&!(t instanceof tt)){var r=Object.keys(n).filter((function(e){return e===t.uuid}))[0];if(r)if(a.meshOriginMaterialMap.set(r,t.material),a.meshReplaceMaterialMap.get(r))t.material=a.meshReplaceMaterialMap.get(r);else{var i=new e.ShaderMaterial({uniforms:{color:{value:n[r]}},vertexShader:"\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n }\n ",fragmentShader:"\n uniform vec3 color;\n void main() {\n gl_FragColor = vec4( color, 1.0 );\n }\n "});i.depthTest=t.material.depthTest,i.side=t.material.side,a.meshReplaceMaterialMap.set(r,i),t.material=i}}}));var s=this.renderer.getSize(new e.Vector2);this.camera.setViewOffset(s.width,s.height,t*i,r*i,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var l=new Uint8Array(4);return this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse((function(t){t instanceof e.Mesh&&!(t instanceof tt)&&a.meshOriginMaterialMap.get(t.uuid)&&(t.material=a.meshOriginMaterialMap.get(t.uuid))})),this.models.setMaterial({constantColor:null}),Object.keys(n).filter((function(t){return n[t].equals((new e.Color).setRGB(l[0]/255,l[1]/255,l[2]/255))}))[0]||!1},r.prototype.dispose=function(){var e,t;if(!0!==this.destroyed){delete au.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),null===(e=this.renderer)||void 0===e||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var r=this.getElement();r&&r.parentNode&&r.parentNode.removeChild(r);var n=this.models.getMaterial();n&&(n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==(null===(t=n.pano0)||void 0===t?void 0:t.map)&&n.pano1.map.dispose());for(var i=0,o=this.models;i<o.length;i++)o[i].dispose();this.models.length=0,this.models.setMaterial({pano0:null,pano1:null}),this.meshReplaceMaterialMap.forEach((function(e){e.dispose()})),this.meshOriginMaterialMap.forEach((function(e){e.dispose()})),this.renderer instanceof Vt&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},r.prototype.setScissor=function(e){Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize()},Object.defineProperty(r.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",Xo("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&"Panorama"===this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"postProcessingType",{get:function(){return"Panorama"===this.currentMode&&this.enableIOSEDR?"luminance":"Mapview"===this.currentMode&&this.enableEDL?"edl":"Mapview"===this.currentMode&&this.enableHQ?"hq":null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"enableEDL",{get:function(){return this.models.getMaterial().useEDL},set:function(t){var n,i,o,a;if(!0===t&&this.currentMode!==r.Mode.Mapview)throw new Error("只支持Mapview下开启EDL");if(this.models.setMaterial({useEDL:t}),this.boundingMesh.visible=!t,t){if(!this.screenBuffers){var s=this.getDrawingBufferSize($l);this.screenBuffers=[new e.WebGLRenderTarget(s.x,s.y,{encoding:null!==(i=null===(n=this.renderer)||void 0===n?void 0:n.outputEncoding)&&void 0!==i?i:e.sRGBEncoding,minFilter:e.NearestFilter,magFilter:e.NearestFilter,format:e.RGBAFormat,type:e.FloatType}),new e.WebGLRenderTarget(s.x,s.y,{encoding:null!==(a=null===(o=this.renderer)||void 0===o?void 0:o.outputEncoding)&&void 0!==a?a:e.sRGBEncoding,minFilter:e.LinearMipMapLinearFilter,magFilter:e.LinearMipMapLinearFilter})]}}else this.screenBuffers&&(this.screenBuffers.forEach((function(e){e.dispose()})),delete this.screenBuffers);this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"enableHQ",{get:function(){return this.models.getMaterial().useHQWeight||this.models.getMaterial().useHQDepth||!1},set:function(t){var n,i;if(!0===t&&this.currentMode!==r.Mode.Mapview)throw new Error("只支持Mapview下开启HQ");if(!0===t?this.models.setMaterial({useHQDepth:!0,useHQWeight:!1}):this.models.setMaterial({useHQDepth:!1,useHQWeight:!1}),this.boundingMesh.visible=!t,t){if(!this.screenBuffers){var o=this.getDrawingBufferSize($l),a=new e.WebGLRenderTarget(o.x,o.y,{minFilter:e.NearestFilter,magFilter:e.NearestFilter,format:e.RGBAFormat,type:e.FloatType,depthTexture:new e.DepthTexture(o.x,o.y,e.UnsignedIntType)}),s=new e.WebGLRenderTarget(o.x,o.y,{encoding:null!==(i=null===(n=this.renderer)||void 0===n?void 0:n.outputEncoding)&&void 0!==i?i:e.sRGBEncoding,minFilter:e.NearestFilter,magFilter:e.NearestFilter,format:e.RGBAFormat,type:e.FloatType,depthTexture:a.depthTexture});this.screenBuffers=[a,s]}}else this.screenBuffers&&(this.screenBuffers.forEach((function(e){e.dispose()})),delete this.screenBuffers);this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"enablePostProcessing",{get:function(){return void 0!==this.screenBuffers},set:function(t){var r,n,i,o;if(t){if(!this.screenBuffers){var a=this.getDrawingBufferSize($l);this.screenBuffers=[new e.WebGLRenderTarget(a.x,a.y,{encoding:null!==(n=null===(r=this.renderer)||void 0===r?void 0:r.outputEncoding)&&void 0!==n?n:e.sRGBEncoding}),new e.WebGLRenderTarget(a.x,a.y,{encoding:null!==(o=null===(i=this.renderer)||void 0===i?void 0:i.outputEncoding)&&void 0!==o?o:e.sRGBEncoding})]}}else this.screenBuffers&&(this.screenBuffers.forEach((function(e){e.dispose()})),delete this.screenBuffers);this.needsRender=!0},enumerable:!1,configurable:!0}),r.prototype.updateConfiguration=function(e){var t=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),"Panorama"===this.currentMode&&(t=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),"Model"===this.currentMode&&(t=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),"Floorplan"===this.currentMode&&(t=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),"Topview"===this.currentMode&&(t=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.topview),"Mapview"===this.currentMode&&(t=!0)),e.depthPanorama&&(Object.assign(this.controllerInits.DepthPanorama,e.depthPanorama),"DepthPanorama"===this.currentMode&&(t=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),"VRPanorama"===this.currentMode&&(t=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),"Panorama"!==this.currentMode&&"DepthPanorama"!==this.currentMode&&"VRPanorama"!==this.currentMode||(t=!0)),t&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions)},r.prototype.appendTo=function(e,t){if(void 0===t&&(t={}),this.renderer)if(this.renderer instanceof Vt){var r=this.getElement();if(r){e.appendChild(r),this.refresh(t);var n=window.getComputedStyle(e).position;"relative"!==n&&"absolute"!==n&&"fixed"!==n&&"sticky"!==n&&(e.style.position="relative")}}else this.throwError(new Error("cannot call appendTo method when render a external renderer"))},r.prototype.refresh=function(t,r){if(void 0===t&&(t={}),this.renderer){var n=this.getElement();if(n){var i=n.parentNode;if(i&&i.nodeName){var o=t.width,a=void 0===o?i.offsetWidth:o,s=t.height,l=void 0===s?i.offsetHeight:s;this.renderer instanceof Vt&&(r&&this.renderer.setPixelRatio(r),this.renderer.setSize(a,l))}var u=this.renderer.getSize(new e.Vector2);this.camera.aspect=u.x*this.scissor.width/(u.y*this.scissor.height),this.camera.updateProjectionMatrix(),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(),this.needsRender=!0}}},r.prototype.addExtraElement=function(e){var t=this;return-1===this.extraElements.indexOf(e)&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return t.removeExtraElement(e)}},r.prototype.removeExtraElement=function(e){var t=this.extraElements.indexOf(e);-1!==t&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))},r.prototype.getPose=function(){var e=this.camera.copyPose(),t=e.longitude,r=e.latitude,n=e.fov,i=e.offset,o=e.distance;return{longitude:t,latitude:r,fov:n,offset:i.clone(),distance:o}},r.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},r.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},r.prototype.updateCamera=function(e,t,r){return void 0===r&&(r=!0),this.controller?(this.controller.stopMomentumMovement(),this.controller.updateCamera(e,t,r)):Promise.reject(new Error("controller is not initialized."))},r.prototype.updateCameraWithKeyframes=function(e,t,r){return void 0===r&&(r=!0),this.controller?(this.controller.stopMomentumMovement(),this.controller.updateCameraWithKeyframes(e,t,r)):Promise.reject(new Error("controller is not initialized."))},r.prototype.getLongitudeAndLatitude=function(){var e=this.getPose();return{longitude:e.longitude,latitude:e.latitude}},r.prototype.getOffset=function(){return this.getPose().offset},r.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var t=this.works.getResolvedObserver(this.pano);if(t){var r=new e.Object3D;return r.position.copy(t.position),r.quaternion.copy(t.quaternion),r.scale.set(1,1,1),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrixAutoUpdate=!1,function(t,r){var n=new e.Vector3(0,0,-1);n.applyQuaternion(t.quaternion);var i=r.quaternion.clone().inverse();return n.applyQuaternion(i),{theta:Math.atan2(n.x,-n.z),phi:-Math.asin(n.y),lookAtVector:n}}(this.camera,r)}}return null},Object.defineProperty(r.prototype,"works",{get:function(){var e=nu.get(this);if(!e)return iu;for(var t=0,r=e;t<r.length;t++){var n=r[t];if(!lo.has(n))return iu}return e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"model",{get:function(){return this.models[0]},enumerable:!1,configurable:!0}),r.prototype.load=function(e,t,r,n){var i=this;if(void 0===n&&(n=!0),!this.renderer)throw new Error("renderer is not initialized");var o=this.lastLoadWorkTask.then((function(){return!(o=e)||"object"!=typeof o&&"function"!=typeof o||"function"!=typeof o.then?i.load_(e,t,r,n):e.then((function(e){return i.load_(e,t,r,n)}));var o}));return this.lastLoadWorkTask=o.catch((function(e){i.throwError(e)})),o},r.prototype.load_=function(t,n,i,o){var a,s,l,u,c,h,p,d=this;void 0===o&&(o=!0);var f=[];if(Array.isArray(t))for(var v=0,m=t;v<m.length;v++){var A=m[v];"string"!=typeof A&&"work"in A?f.push(yo(A.work,A)):f.push(yo(A))}else f.push(yo(t));var g=bo(f),y=this.works;void 0===n&&(n=0!==y.length?"inherit":"initial");var b=g.initial,x=b.work.observers[0],w=x?{workCode:x.work.workCode,panoIndex:x.panoIndex}:{workCode:"",panoIndex:0},M=null!==(a=b.mode)&&void 0!==a?a:x?"Panorama":"Mapview",E={};if("inherit"===n)M=this.currentMode,(C=g.resolvedObservers[this.panoIndex])?w={workCode:C.work.workCode,panoIndex:C.panoIndex}:"number"==typeof g.initial.panoIndex?w={workCode:g.initial.work.workCode,panoIndex:g.initial.panoIndex}:"Panorama"!==M&&"DepthPanorama"!==M&&"VRPanorama"!==M&&"XRPanorama"!==M||(M="Mapview"),E={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:this.camera.pose.distance,offset:this.camera.pose.offset.clone()};else if("initial"===n)"number"==typeof b.panoIndex&&(w={workCode:b.work.workCode,panoIndex:b.panoIndex}),b.mode&&(M=b.mode),E={longitude:b.longitude,latitude:b.latitude,fov:b.fov,distance:b.distance,offset:null===(s=b.offset)||void 0===s?void 0:s.clone()};else{var C;M=null!==(l=n.mode)&&void 0!==l?l:this.currentMode,"number"==typeof n.panoIndex&&(C=g.getResolvedObserver({workCode:null!==(h=null!==(u=n.workCode)&&void 0!==u?u:null===(c=this.work)||void 0===c?void 0:c.workCode)&&void 0!==h?h:"",panoIndex:n.panoIndex}))&&(w={workCode:C.work.workCode,panoIndex:C.panoIndex}),E={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset}}var S=$($($({},w),{mode:M}),E);this.emit("works.request",Xo("works.request",{input:t,works:g,state:S,userAction:o}));var I=function(){d.modelGroup.visible=!0,d.pano=w;var e=d.controller?null!=i?i:d.modeChangeDuration:0,t=$($({initial:{state:E,currentState:d.getCurrentState(),duration:e,userAction:o}},d.commonParams()),d.controllerInits[M]);d.controller&&d.currentMode===M?!1===d.controller.updateWork(g,E,e,o)&&(d.controller.destroy(),d.controller=d.applyController(M,t)):d.controller=d.applyController(M,t)};if(nu.set(this,g),M===r.Mode.Floorplan||M===r.Mode.Topview||M===r.Mode.Mapview||M===r.Mode.Model)this.loadModel(g).then((function(){if(d.needsRender=!0,I(),d.controller&&0===d.controller.initial.duration){var e=Ll[M].initAnimationEndState(d.controller);d.camera.setFromPose(e)}d.emit("cameraUpdate",d.camera.copyPose(),o)}));else{if(!this.controller){var P=new e.Vector3,T=g.getResolvedObserver(w);T&&P.copy(T.position),this.camera.setFromPose({fov:E.fov,longitude:E.longitude,latitude:E.latitude,distance:E.distance,offset:null!==(p=E.offset)&&void 0!==p?p:P}),this.needsRender=!0}I(),this.controller.once("pano.moveTo",(function(){d.needsRender=!0,d.emit("cameraUpdate",d.camera.copyPose(),o),d.loadModel(g)}))}return this.emit("works.load",Xo("works.load",{input:t,state:this.getCurrentState(),userAction:o,works:g})),this.ready().then((function(){var e;d.emit("works.ready",Xo("works.ready",{input:t,state:d.getCurrentState(),userAction:o,works:g})),null===(e=d.analysis)||void 0===e||e.work(g)}))},r.prototype.changeMode=function(e,t,n,i,o){var a=this;return void 0===t&&(t={}),void 0===n&&(n=this.modeChangeDuration),void 0===i&&(i=!0),void 0===o&&(o=!1),new Promise((function(s,l){var u,c,h;if(!a.renderer)throw new Error("renderer is not initialized.");var p="number"==typeof(t=$({},t)).panoIndex?{workCode:null!==(h=null!==(u=t.workCode)&&void 0!==u?u:null===(c=a.work)||void 0===c?void 0:c.workCode)&&void 0!==h?h:"",panoIndex:t.panoIndex}:a.pano;if(!r.Mode.hasOwnProperty(e)){var d=new Error('mode "'.concat(e,'" is not existed'));return a.throwError(d),void l(d)}if((e===r.Mode.Floorplan||e===r.Mode.Topview||e===r.Mode.Mapview||e===r.Mode.Model)&&!a.models.loaded)return d=new Error("model is not ready."),a.throwError(d),void l(d);if((e===r.Mode.Panorama||e===r.Mode.VRPanorama||e===r.Mode.XRPanorama)&&!a.works.getResolvedObserver(p))return d=new Error("PanoId ".concat(Ke(p)," not existed.")),a.throwError(d),void l(d);var f=a.controller,v=a.currentMode,m=function(){if(a.controller&&a.controller.stopMomentumMovement(),a.controller&&!1===o&&v===e)e===r.Mode.Panorama||e===r.Mode.DepthPanorama||e===r.Mode.Model||e===r.Mode.VRPanorama||e===r.Mode.XRPanorama?Ye(a.pano,p)&&"moveToPano"in a.controller&&"function"==typeof a.controller.moveToPano?a.controller.moveToPano(p,$({duration:n},t),i):a.controller.updateCamera(t,n,i).catch(se):(Ye(a.pano,p)||(a.pano=p),a.controller.updateCamera(t,n,i).catch(se));else{var l=$($({},t),p),u=$($({initial:{state:l,currentState:a.getCurrentState(),duration:n,userAction:i}},a.commonParams()),a.controllerInits[e]),c=Ll[e].initAnimationEndState(u),h=Xo("mode.change.request",{prevMode:a.currentMode,mode:e,state:c,userAction:i});if(a.emit("mode.change.request",h),!h.defaultPrevented){f&&f.destroy(),a.controller=a.applyController(e,u);var d=Xo("mode.change",{prevMode:a.currentMode,mode:e,state:c,userAction:i});a.emit("mode.change",d)}}s()};if(e===r.Mode.VRPanorama)a.requestFullscreen(),("undefined"==typeof location||"https:"!==location.protocol?Promise.reject(new Error("Request DeviceOrientation Permission denied.")):"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){if("granted"==e)return Promise.resolve();var t=new Error("Request DeviceOrientation Permission denied.");return Promise.reject(t)})):Promise.resolve()).then((function(){return m()})).catch((function(e){e instanceof Error&&(a.exitFullscreen(),a.throwError(e),l(e))}));else if(e===r.Mode.XRPanorama){var A=Oe.shared.getContext();A?A.end():function(){if("xr"in navigator)return navigator.xr.isSessionSupported("immersive-vr").then((function(e){return e?Promise.resolve():Promise.reject()})).then((function(){return navigator.xr.requestSession("immersive-vr",{optionalFeatures:["local-floor","bounded-floor"]}).then((function(e){return Promise.resolve(e)}))}));var e=new Error("Request XR Permission denied.");return Promise.reject(e)}().then((function(e){Oe.shared.setContext(e),m()})).catch((function(e){e instanceof Error&&(a.throwError(e),l(e))}))}else m()}))},r.prototype.getPixels=function(t,r,n,i,o){if(void 0===o&&(o=1),!this.renderer)throw new Error("renderer is not initialized.");var a=this.getPixelsRenderTarget,s=this.renderer.getSize(new e.Vector2);t=Or(t,Math.floor(n/2),Math.floor(s.x-n)),r=Or(r,Math.floor(i/2),Math.floor(s.y-i)),a.setSize(n*o,i*o),this.renderer.setRenderTarget(a),this.camera.setViewOffset(s.width,s.height,t,s.height-r-i,n,i),this.controller?this.controller.render():this.renderer.render(this.scene,this.camera);var l=new Uint8Array(n*o*i*o*4);return this.renderer.readRenderTargetPixels(a,0,0,n*o,i*o,l),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),l},r.prototype.getElement=function(){var e;return null===(e=this.renderer)||void 0===e?void 0:e.domElement},Object.defineProperty(r.prototype,"observers",{get:function(){return this.works.resolvedObservers},enumerable:!1,configurable:!0}),r.prototype.render=function(e,t){var r=this;if(void 0===t&&(t=!1),!this.renderer)return null;if(t){var n=this.renderer.getSize($l);this.scene.traverseVisible((function(e){e.setResolution&&e.setResolution(n.x,n.y)}))}if(this.controller&&this.screenBuffers&&null===this.renderer.getRenderTarget()){var i=this.getDrawingBufferSize($l);return this.screenBuffers.forEach((function(e){e.setSize(i.x,i.y)})),this.renderer.setRenderTarget(this.screenBuffers[0]),this.controller.render(),this.info={memory:this.controller.renderer.info.memory,render:this.controller.renderer.info.render},"VRPanorama"!==this.currentMode&&"XRPanorama"!==this.currentMode&&this.poweredByRealsee&&Jl(this.renderer),this.renderer.setRenderTarget(null),e&&Oe.shared.add(e,!0),this.screenBuffers[0]}return this.aroundScissor((function(){r.renderer&&(r.controller?(r.controller.render(),r.info={memory:r.controller.renderer.info.memory,render:r.controller.renderer.info.render}):(r.renderer.render(r.scene,r.camera),r.info={memory:r.renderer.info.memory,render:r.renderer.info.render}),r.poweredByRealsee&&"VRPanorama"!==r.currentMode&&"XRPanorama"!==r.currentMode&&Jl(r.renderer)),e&&Oe.shared.add(e,!0)})),null},r.prototype.updateTime=function(t,r){for(var n,i,o,a=this,s=[],l=2;l<arguments.length;l++)s[l-2]=arguments[l];if(!this.destroyed){if(this.works.update(),this.renderer){var u=this.models.loaded;if(this.models.update(this.renderer,this.camera,this.currentMode),!1===u&&!0===this.models.loaded&&this.emit("models.load",Xo("models.load",{models:this.models})),this.models.loaded){for(var c=0,h=this.models;c<h.length;c++)(f=h[c]).parent!==this.modelGroup&&(this.modelGroup.add(f),this.needsRender=!0);if(this.lastModels.length>0){for(var p=0,d=this.lastModels;p<d.length;p++){var f=d[p];this.modelGroup.remove(f),f.dispose(),this.needsRender=!0}this.lastModels.length=0}}this.lastModels.setMaterial(this.models.getMaterial()),this.lastModels.materialVersion=this.models.materialVersion,this.lastModels.update(this.renderer,this.camera,this.currentMode)}this.syncingState=this.syncState(t,r),this.controller&&(n=this.controller).updateTime.apply(n,re([t,r],s,!1)),this.syncingState=!1,this.camera.updateTime(t,r);var v=new e.Vector2(512,512),m=new e.Vector2(512,512);this.renderer&&(this.renderer.getSize(v),v.x*=this.scissor.width,v.y*=this.scissor.height,this.renderer.getDrawingBufferSize(m),m.x*=this.scissor.width,m.y*=this.scissor.height);for(var A=new e.Box3,g=new e.Box3,y=new e.Vector3(4,4,4),b=0,x=this.works.resolvedObservers;b<x.length;b++){var w=x[b];g.setFromCenterAndSize(w.position,y),A.union(g)}A.union(this.models.bounding),A.getCenter(this.boundingMesh.position),A.getSize(this.boundingMesh.scale),this.boundingMesh.boundingBox.copy(A);var M=null!==(i=this.models.getMaterial())&&void 0!==i?i:{},E=1-(null!==(o=M.modelAlpha)&&void 0!==o?o:0);M.opacity=Or(4*E-3,0,1),M.clippers=null,M.floorIndex=-2,this.boundingMesh.setMaterial(M),this.renderer&&this.boundingMesh.update(this.renderer,this.camera),this.boundingMesh.needsRender=!1;var C=Xo("render.prepare",{needsRender:!0,info:null});if(this.emit("render.prepare",C),!C.defaultPrevented){var S=[];tu.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),eu.setFromProjectionMatrix(tu);for(var I=0,P=this.scene.children;I<P.length;I++){var T=P[I];T!==this.modelGroup&&T!==this.boundingMesh&&T instanceof e.Object3D&&T.traverseVisible((function(r){if(r.setResolution&&r.setResolution(v.x,v.y),r.setTime&&r.setTime(t),r.mixer instanceof e.AnimationMixer){var n=ru.get(r.mixer);n||(n=new e.Clock,ru.set(r.mixer,n)),r.mixer.update(n.getDelta())}(r instanceof e.Mesh||r instanceof e.Line||r instanceof e.Points)&&(r instanceof e.ImmediateRenderObject||!r.frustumCulled||eu.intersectsObject(r))&&S.push(r)}))}if(m.width*m.height>8388608?this.renderSwitch01=1^this.renderSwitch01:this.renderSwitch01=0,this.renderer&&!1===this.paused&&0===this.renderSwitch01){var B=void 0;if(!0!==this.onlyRenderIfNeeds)B=this.render();else{if(this.controller&&!0===this.controller.needsRender&&(this.controller.needsRender=!1,this.needsRender=!0),!0===this.camera.needsRender&&(this.camera.needsRender=!1,this.needsRender=!0),!0===this.models.needsRender&&(this.models.needsRender=!1,this.needsRender=!0),!0!==this.needsRender)for(var R=0,O=S;R<O.length;R++){var k=O[R],D=function(e){!0===e.needsRender?(e.needsRender=!1,a.needsRender=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(a.needsRender=!0)};D(k),k.traverseAncestors(D)}!1!==this.needsRender&&(B=this.render())}if(this.needsRender=!1,this.controller&&this.screenBuffers){var L=this.controller,F=this.screenBuffers;this.aroundScissor((function(){L.postProcessing(F,a.postProcessingType)}))}this.hasListener("render")&&this.emit("render",Xo("render",{needsRender:void 0!==B,info:this.info}))}this.needsRender=!1}this.fps.testTime&&t-this.fps.testTime<1e3?this.fps.testCount++:(this.emit("fps",this.fps.testCount),this.fps.testTime=t,this.fps.testCount=0)}},r.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof Vt&&this.renderer.clear(!0,!0,!0)},r.prototype.play=function(){this.needsRender=!0,this.paused=!1},r.prototype.moveToPano=function(e,t,n){void 0===t&&(t={}),void 0===n&&(n=!0);var i=this.controller,o=this.renderer;if(!i)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!o)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();var a=this.works.getResolvedObserver(e);if(!a)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var s={workCode:a.work.workCode,panoIndex:a.panoIndex};return"moveToPano"in i&&"function"==typeof i.moveToPano?i.moveToPano(s,t,n):a&&(this.pano=s,this.once("initAnimation.start",(function(e){t.moveStartCallback&&t.moveStartCallback(e.state)})),this.once("initAnimation.end",(function(e){t.moveEndCallback&&t.moveEndCallback(e.state)})),this.changeMode(r.Mode.Panorama,t,void 0,n)),this.ready()},r.prototype.preloadPano=function(e,t){var r=this;void 0===t&&(t=se);var n=this.works.getResolvedObserver(e);if(!n)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));var i=n.work.allowHosts,o=ue();return Promise.all(["right","left","up","down","front","back"].map((function(e){var t=$({key:"pano.".concat(n.panoId,".").concat(e)},Yn(r.imageOptions,["size","format","quality","mappings"])),o=n.images[e];return Pe(r.imageOptions.transform?r.imageOptions.transform(o,t):Ne(o,t),{allowHosts:i,requestProxy:r.requestProxy,networkSubscribe:r.networkSubscribe})}))).then((function(){var e=ue()-o;return t(e),e}))},r.prototype.project2d=function(t,r){if(void 0===r&&(r=!1),!this.renderer)return null;if(this.models.length>0&&r){var n=this.camera.position,i=t.clone().sub(n),o=new e.Raycaster(n,i.clone().normalize()),a=this.models.intersectRaycaster(o)[0];if(a&&a.distance+.01<i.length())return null}var s=t.clone().project(this.camera);if(Math.abs(s.z)>1)return null;var l=this.renderer.getSize(new e.Vector2),u=l.x*this.scissor.width,c=l.y*this.scissor.height,h=l.x*this.scissor.left+(s.x+1)/2*u,p=l.y*(1-this.scissor.bottom-this.scissor.height)+(1-s.y)/2*c;return new e.Vector2(h,p)},r.prototype.getRenderObjects=function(t){tu.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),eu.setFromProjectionMatrix(tu),t||(t=this.scene);var r=[];return t.traverseVisible((function(t){(t instanceof e.Mesh||t instanceof e.Line||t instanceof e.Points)&&(t instanceof e.ImmediateRenderObject||!t.frustumCulled||eu.intersectsObject(t))&&r.push(t)})),r},r.prototype.getCurrentState=function(){return $($({},this.getPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},r.prototype.setState=function(t,n,i){var o,a,s,l,u,c,h,p,d,f,v;void 0===n&&(n=!1),void 0===i&&(i=!0),!(t=Object.assign({},t)).offset||t instanceof e.Vector3||(t.offset=new e.Vector3(t.offset.x,t.offset.y,t.offset.z)),"number"==typeof t.panoIndex&&(v=t.workCode?{workCode:t.workCode,panoIndex:t.panoIndex}:{workCode:null!==(a=null===(o=this.work)||void 0===o?void 0:o.workCode)&&void 0!==a?a:"",panoIndex:t.panoIndex});var m,A,g,y,b,x=null!==(s=t.mode)&&void 0!==s?s:this.state.mode;if(t.mode!==r.Mode.Floorplan&&t.mode!==r.Mode.Topview&&t.mode!==r.Mode.Mapview&&t.mode!==r.Mode.Model||this.models.loaded){if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==x){if("VRPanorama"===x)return void this.changeMode("VRPanorama",void 0,void 0,!0);var w={workCode:null==v?void 0:v.workCode,panoIndex:null==v?void 0:v.panoIndex};"number"==typeof t.longitude&&(w.longitude=t.longitude),"number"==typeof t.latitude&&(w.latitude=t.latitude),"number"==typeof t.fov&&(w.fov=t.fov),"number"==typeof t.distance&&"Mapview"===t.mode&&(w.distance=t.distance),t.offset instanceof e.Vector3&&"Mapview"===t.mode&&(w.offset=t.offset);var M=$($({initial:{state:w,currentState:this.getCurrentState(),duration:this.modeChangeDuration,userAction:!1}},this.commonParams()),this.controllerInits[x]),E=Ll[x].initAnimationEndState(M);m=E.longitude,A=E.latitude,g=E.fov,y=E.offset,b=E.distance}else m=null!==(l=t.longitude)&&void 0!==l?l:this.state.longitude,A=null!==(u=t.latitude)&&void 0!==u?u:this.state.latitude,g=null!==(c=t.fov)&&void 0!==c?c:this.state.fov,y=null!==(h=t.offset)&&void 0!==h?h:this.state.offset,b=null!==(p=t.distance)&&void 0!==p?p:this.state.distance;var C={workCode:(null!=v?v:this.pano).workCode,panoIndex:(null!=v?v:this.pano).panoIndex,mode:x,longitude:m,latitude:A,fov:g,offset:y,distance:b};this.emit("state.set",Xo("state.set",{userAction:i,state:C})),Zo(this.state,C)||(this.controller&&"VRPanorama"===C.mode&&C.mode!==this.state.mode?(Jo(this.state,C),this.changeMode("VRPanorama")):this.controller&&"XRPanorama"===C.mode&&C.mode!==this.state.mode?(Jo(this.state,C),this.changeMode("XRPanorama")):(Jo(this.state,C),this.controller&&i&&(this.controller.userAction=!1),n&&this.state.mode===C.mode&&(this.syncingState=this.syncState(ue(),0,n),this.syncingState&&(null===(d=this.controller)||void 0===d||d.updateTime(ue(),0),this.syncingState=!1)),this.emit("state.change",Xo("state.change",{userAction:i,state:this.state})),null===(f=this.analysis)||void 0===f||f.state(this.works,this.state)))}else this.throwError(new Error("model is not ready."))},r.prototype.aroundScissor=function(t){if(this.renderer)if("XRPanorama"!==this.state.mode){var r=new e.Vector2,n=0!==this.scissor.left||0!==this.scissor.bottom||1!==this.scissor.width||1!==this.scissor.height;if(n){this.renderer.getSize(r);var i=Math.floor(r.x*this.scissor.left),o=Math.floor(r.y*this.scissor.bottom),a=Math.floor(r.x*this.scissor.width),s=Math.floor(r.y*this.scissor.height);this.renderer.setViewport(i,o,a,s),this.renderer.setScissor(i,o,a,s),this.renderer.setScissorTest(!0)}t(),n&&(this.renderer.setViewport(0,0,r.x,r.y),this.renderer.setScissor(0,0,r.x,r.y),this.renderer.setScissorTest(!1))}else t()},r.prototype.syncState=function(t,n,i){void 0===i&&(i=!1);var o=this.stateSynced;if(this.stateSynced=!1,0===this.works.length)return!1;if(!this.controller)return!1;if(this.state.mode!==this.currentMode){var a={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,a,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Ll.Model){if(!this.camera.pose.offset.equals(this.state.offset)){var s={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,$($({},s),{duration:i?0:void 0}),!1),!0}}else{var l={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!Ye(l,this.pano)&&"moveToPano"in this.controller&&"function"==typeof this.controller.moveToPano)return s={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance},this.controller.moveToPano(l,s,!1),!0}if(this.controller instanceof Ll.Topview||this.controller instanceof Ll.Mapview){var u=1,c=Math.PI/45,h=i?this.state.fov:Ko(this.camera.pose.fov,this.state.fov,u),p=i?this.state.distance:Ko(this.camera.pose.distance,this.state.distance,.2),d=i?(new e.Vector3).copy(this.state.offset):function(t,r,n){if(t.equals(r))return(new e.Vector3).copy(r);var i=(new e.Vector3).subVectors(r,t);return i.lengthSq()<.2*.2?i.copy(r):i.setLength(.2).add(t)}(this.camera.pose.offset,this.state.offset),f=i?{longitude:this.state.longitude,latitude:this.state.latitude}:Wo({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},c),v=f.longitude,m=f.latitude;if(this.controller instanceof Ll.Mapview){if(No(h,this.camera.pose.fov)||Uo(d,this.camera.pose.offset)||No(p,this.camera.pose.distance)||No(v,this.camera.pose.longitude,2*Math.PI)||No(m,this.camera.pose.latitude)){var A={x:d.x,y:d.y,z:d.z},g={fov:h};return Object.assign(A,{distance:p}),Object.assign(g,{longitude:v,latitude:m}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(g,0).catch(se),this.controller.locationMotion.set(A,0).catch(se),!0}}else if(No(h,this.camera.pose.fov)||Uo(d,this.camera.pose.offset))return A={x:d.x,y:d.y,z:d.z},g={fov:h},this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(g,0).catch(se),this.controller.locationMotion.set(A,0).catch(se),!0}else{u=1,c=Math.PI/45,h=i?this.state.fov:Ko(this.camera.pose.fov,this.state.fov,u);var y=i?{longitude:this.state.longitude,latitude:this.state.latitude}:Wo({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},c);if(v=y.longitude,m=y.latitude,No(v,this.camera.pose.longitude,2*Math.PI)||No(m,this.camera.pose.latitude)||No(h,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:v,latitude:m,fov:h},0).catch(se),!0}if(this.stateSynced=!0,!1===o&&this.emit("state.synced",Xo("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var b=this.currentMode;if(b!==r.Mode.Floorplan&&b!==r.Mode.Topview&&b!==r.Mode.Mapview&&b!==r.Mode.Model||this.models.loaded){var x=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var w=0,M=x;w<M.length;w++){var E=M[w];this.controller instanceof Ll.Panorama?!0!==E.tile||this.controller.isTileReady()?E():this.readyCallbacks.push(E):E()}}}return!1},r.prototype.ready=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(r){var n;t.readyCallbacks.push(Object.assign(r,{tile:null!==(n=e.tile)&&void 0!==n&&n}))}))},r.prototype.requestFullscreen=function(){var e;if(Yo()){var t=null===(e=this.getElement())||void 0===e?void 0:e.parentNode;t&&"requestFullscreen"in t&&"undefined"!=typeof document&&null===document.fullscreenElement&&t.requestFullscreen()}},r.prototype.exitFullscreen=function(){"undefined"!=typeof document&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},r.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},r.prototype.loadModel=function(e){for(var t=this,r=[],n=function(e){var n=i.models.filter((function(t){var r;return(null===(r=t.work)||void 0===r?void 0:r.workCode)===e.workCode}))[0];if(n)n.work=e,r.push(n);else{var o=new Yi({onError:function(r){t.emit("model.error",Xo("model.request",{work:e,model:o,error:r}))},onShownFloorChange:function(r){t.emit("model.changeShownFloor",Xo("model.request",{work:e,model:o,error:null}))},onLoad:function(){t.emit("model.load",Xo("model.request",{work:e,model:o,error:null}))}});r.push(o),i.emit("model.request",Xo("model.request",{work:e,model:o,error:null})),o.load(e,{networkSubscribe:i.networkSubscribe,requestProxy:i.requestProxy,textureOptions:i.textureOptions})}},i=this,o=0,a=e;o<a.length;o++)n(a[o]);if(this.models.length>0){for(var s=0,l=this.models;s<l.length;s++){var u=l[s];-1===r.indexOf(u)&&this.lastModels.push(u)}this.models.length=0}for(var c=0,h=r;c<h.length;c++)u=h[c],this.models.push(u);return this.renderer&&(this.models.loaded=!1),new Promise((function(e){t.on("models.load",(function(){e()}))}))},r.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,helper:this.helperGroup,boundingMesh:this.boundingMesh,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),models:this.models,works:this.works,imageOptions:this.imageOptions,enableIOSEDR:this._enableIOSEDR,enableEDL:this.enableEDL,extraElements:this.extraElements,videoTexture:this.videoTexture,networkSubscribe:this.networkSubscribe,requestProxy:this.requestProxy}},r.prototype.applyController=function(e,t){var n=this;if(!this.renderer)throw new Error("renderer is not initialized.");e!==r.Mode.Mapview&&(this.enableEDL=!1);var i=Ll[e];if(e!==this.currentMode)for(var o=0,a=this.models;o<a.length;o++)a[o].show();this.currentMode=e;for(var s=new i(t),l=function(e){s.on(e,(function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(n.emit.apply(n,re([e],t,!1)))return!1}))},u=0,c=Fl;u<c.length;u++)l(c[u]);var h=Ll[e].initAnimationEndState(t),p=t.initial.userAction;return Zo(this.state,h)||(Jo(this.state,h),this.emit("state.change",Xo("state.change",{userAction:p,state:this.state}))),this.emit("currentState.change",Xo("currentState.change",{userAction:p,state:this.getCurrentState()})),s.on("camera.update",(function(e){var t;if(n.controller){var r=n.controller.getTargetState();e.userAction&&!1===n.syncingState&&n.state.mode===r.mode&&!Zo(n.state,r)&&(Jo(n.state,r),n.emit("state.change",Xo("state.change",{userAction:e.userAction,state:n.state})),null===(t=n.analysis)||void 0===t||t.state(n.works,n.state))}n.emit("currentState.change",Xo("currentState.change",{userAction:e.userAction,state:n.getCurrentState()}))})),s.on("initAnimation.start",(function(e){var t,r=e.state,i=e.userAction;i&&n.state.mode===r.mode&&!Zo(n.state,r)&&(Jo(n.state,r),n.emit("state.change",Xo("state.change",{userAction:i,state:n.state})),null===(t=n.analysis)||void 0===t||t.state(n.works,n.state))})),s.on("initAnimation.end",(function(e){var t,r=e.state,i=e.userAction;i&&n.state.mode===r.mode&&!Zo(n.state,r)&&(Jo(n.state,r),n.emit("state.change",Xo("state.change",{userAction:i,state:n.state})),null===(t=n.analysis)||void 0===t||t.state(n.works,n.state))})),s.on("pano.moveTo",(function(e){var t,r=e.state,i=e.userAction;n.pano={workCode:r.workCode,panoIndex:r.panoIndex},i&&n.state.mode===r.mode&&!Zo(n.state,r)&&(Jo(n.state,r),n.emit("state.change",Xo("state.change",{userAction:i,state:n.state})),null===(t=n.analysis)||void 0===t||t.state(n.works,n.state))})),s.on("pano.arrived",(function(e){var t,r=e.state,i=e.userAction;i&&n.state.mode===r.mode&&!Zo(n.state,r)&&(Jo(n.state,r),n.emit("state.change",Xo("state.change",{userAction:i,state:n.state})),null===(t=n.analysis)||void 0===t||t.state(n.works,n.state))})),s.on("pano.moveTo",(function(e){var t=e.userAction;n.emit("currentState.change",Xo("currentState.change",{userAction:t,state:n.getCurrentState()}))})),s.on("pano.request",(function(e){n.emit("pano.request",e),e.defaultPrevented||n.moveToPano(e.state,e.options,e.userAction)})),s.on("vr.requestExit",(function(){n.currentMode===r.Mode.VRPanorama&&(n.exitFullscreen(),n.changeMode(r.Mode.Panorama))})),s.on("error",(function(e){return n.throwError(e)})),s},r.prototype.removeEventListeners=function(){},r.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",DepthPanorama:"DepthPanorama",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},r.Line=null,r}(ae),au={instances:{},constructor:ou};"undefined"!=typeof window&&Object.assign(window,{__FIVE_DEBUG__:au});var su=function(){function e(){}return e.createButton=function(e){var t=document.createElement("button");function r(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",r(t),navigator.xr.isSessionSupported("immersive-vr").then((function(r){r?(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()}):(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,t.textContent="VR NOT SUPPORTED")})),t;var n=document.createElement("a");return!1===window.isSecureContext?(n.href=document.location.href.replace(/^http:/,"https:"),n.innerHTML="WEBXR NEEDS HTTPS"):(n.href="https://immersiveweb.dev/",n.innerHTML="WEBXR NOT AVAILABLE"),n.style.left="calc(50% - 90px)",n.style.width="180px",n.style.textDecoration="none",r(n),n},e}()})(),__webpack_exports__})()));
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* @realsee/five
|
|
4
|
+
* Generated: 12/20/2023
|
|
5
|
+
* Version: 6.0.0-alpha.71
|
|
6
|
+
* Terms:
|
|
7
|
+
* Realsee SDK License Agreement
|
|
8
|
+
* Update: July 28, 2021
|
|
9
|
+
* THIS LICENSE AGREEMENT BETWEEN YOU AND 【BEIKE REALSEE TECHNOLOGY (HK)
|
|
10
|
+
* LIMITED】(“Realsee”) FORMS A LEGALLY BINDING CONTRACT BETWEEN YOU AND REALSEE IN
|
|
11
|
+
* RELATION TO YOUR USE OF THE SDK. This License Agreement accompanies the Realsee
|
|
12
|
+
* Software Development Kit(s) for the software and related explanatory materials
|
|
13
|
+
* (the "SDK") and includes any upgrades, modified versions, updates, additions,
|
|
14
|
+
* and copies of the SDK licensed to You by Realsee.
|
|
15
|
+
* BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE
|
|
16
|
+
* THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THIS AGREEMENT. YOU ARE
|
|
17
|
+
* AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO
|
|
18
|
+
* THE TERMS AND CONDITIONS STATED BELOW.
|
|
19
|
+
* This Agreement applies to Your use of the SDK in the country in which You
|
|
20
|
+
* legally install it (“Territory”) and is subject to the laws of such Territory
|
|
21
|
+
* and further subject to Section 12 below. Different terms, conditions, and
|
|
22
|
+
* limitations may apply to the use of the SDK in any additional countries.
|
|
23
|
+
* 1. DEFINITIONS.
|
|
24
|
+
* “Agreement” means this Realsee SDK License Agreement.
|
|
25
|
+
* “Developer”, “You” and “Your” means the person(s) or entity acquiring or using
|
|
26
|
+
* the SDK or otherwise exercising rights under the terms of this Agreement.
|
|
27
|
+
* “Documentation” means the technical or other specifications or documentation
|
|
28
|
+
* that Realsee may provide to You for use in connection with the SDK.
|
|
29
|
+
* “Integrated Product” means any software, website, or on-line service developed
|
|
30
|
+
* by You based on or using the SDK (collectively, the “Integrated Product”).
|
|
31
|
+
* “Intellectual Property” means any patents, patent rights, trademarks, service
|
|
32
|
+
* marks, registered and unregistered designs, applications for any of the
|
|
33
|
+
* foregoing, copyright, and any other similar protected rights in any country and
|
|
34
|
+
* to the extent recognised by any relevant jurisdiction as intellectual property,
|
|
35
|
+
* trade secrets, know-how and confidential information. Realsee reserves all
|
|
36
|
+
* rights not expressly granted to You.
|
|
37
|
+
* “Realsee” means [Beike Realsee Technology (HK) Limited, a company incorporated
|
|
38
|
+
* and validly existing under the laws of Hong Kong].
|
|
39
|
+
* “SDK” means the Realsee-proprietary Software Development Kits (SDK) provided
|
|
40
|
+
* hereunder, includes all development tools (including any compiler and debugger),
|
|
41
|
+
* application programming interfaces (“APIs”), libraries, binary utilities, header
|
|
42
|
+
* files, Documentation, content, data, code samples, and other materials provided
|
|
43
|
+
* to You in connection with this Agreement, whether delivered through a download,
|
|
44
|
+
* or any other media or form, and is licensed, not sold, to You by Realsee for use
|
|
45
|
+
* only under the terms of this Agreement. The terms of this Agreement will govern
|
|
46
|
+
* any updates provided by Realsee that replace and/or supplement the original SDK
|
|
47
|
+
* delivered to You, unless such update is accompanied by a separate license, in
|
|
48
|
+
* which case the terms of such license will govern.
|
|
49
|
+
* 2. LICENSED USES AND RESTRICTIONS.
|
|
50
|
+
* 2.1 Subject to the restrictions contained in this Section 2, Realsee grants to
|
|
51
|
+
* You during the term, a limited, non-exclusive, revocable, non-sublicensable,
|
|
52
|
+
* non-transferable license to install and use the SDK within the Territory only
|
|
53
|
+
* for the purpose of internal development.
|
|
54
|
+
* 2.2 Restrictions. You acknowledge and agree that, You shall not, and shall
|
|
55
|
+
* ensure that Your affiliates, employees, agents, representatives, officers,
|
|
56
|
+
* representatives, and subcontractors do not (directly or indirectly):
|
|
57
|
+
* 2.2.1 decompile, reverse engineer, disassemble or attempt to derive the source
|
|
58
|
+
* code of, those components of the SDK provided in object code form, or any part
|
|
59
|
+
* thereof;
|
|
60
|
+
* 2.2.2 remove, alter, or obscure any copyright notice or other proprietary rights
|
|
61
|
+
* notice on any part of the SDK;
|
|
62
|
+
* 2.2.3 sell, assign, pledge, rent, lease, lend, upload to or host on any website
|
|
63
|
+
* or server for use by any third party except You, redistribute, or sublicense the
|
|
64
|
+
* SDK (or any part thereof), or operate the SDK (or any part thereof) in the
|
|
65
|
+
* capacity of a service bureau or other hosted services provider, in whole or in
|
|
66
|
+
* part, nor may You enable others to do so;
|
|
67
|
+
* 2.2.4 or alter, modify, customize or improve the SDK, or any part thereof;
|
|
68
|
+
* 2.2.5 use the SDK (or any part thereof) for any illegal purpose, in any manner
|
|
69
|
+
* that is inconsistent with the terms of this Agreement, or to engage in any
|
|
70
|
+
* illegal activity;
|
|
71
|
+
* 2.2.6 use the SDK (or any part thereof) in any manner that may damage the
|
|
72
|
+
* operation of Realsee’s products or services; or
|
|
73
|
+
* 2.2.7 use the SDK or any information contained therein or otherwise provided by
|
|
74
|
+
* Realsee for the purpose of developing, or having developed, any product
|
|
75
|
+
* competitive with any Realsee product or service, as determined by Realsee in its
|
|
76
|
+
* sole discretion;
|
|
77
|
+
* 2.2.8 include any portion of the SDK in Your Developer products.
|
|
78
|
+
* 2.3 Realsee has the right to impose reasonable conditions such as a reasonable
|
|
79
|
+
* fee for use of the SDK in Integrated Product in the future.
|
|
80
|
+
* 2.4 You may make a limited number of copies of the SDK to be used by Your
|
|
81
|
+
* employees or consultants as provided herein, and not for general business
|
|
82
|
+
* purposes, and such employees or consultants shall be subject to the obligations
|
|
83
|
+
* and restrictions in this Agreement.
|
|
84
|
+
* 2.5 All licenses not expressly granted in this Agreement are reserved and no
|
|
85
|
+
* other licenses, immunity, or rights, express or implied, are granted by Realsee,
|
|
86
|
+
* by implication, estoppel, or otherwise.
|
|
87
|
+
* 3. CONFIDENTIALITY.
|
|
88
|
+
* The SDK and all source code, Documentation, specifications, engineering details,
|
|
89
|
+
* and related information pertaining to the SDK, whether in oral, written,
|
|
90
|
+
* graphic, or electronic form, are and shall remain the confidential and
|
|
91
|
+
* proprietary information of Realsee or its licensors (collectively, the
|
|
92
|
+
* “Confidential Information”). You shall (i) disclose Confidential Information to
|
|
93
|
+
* only those directors and employees (collectively, “Affiliates”) whose duties
|
|
94
|
+
* justify their need to know such information and who have been clearly informed
|
|
95
|
+
* of their obligation to maintain the confidential, proprietary, and/or trade
|
|
96
|
+
* secret status of such Confidential Information; and (ii) use Confidential
|
|
97
|
+
* Information solely in accordance with the license granted hereunder. In any
|
|
98
|
+
* event, You and Your Affiliates shall treat Confidential Information as strictly
|
|
99
|
+
* confidential and shall use the same care to prevent disclosure of such
|
|
100
|
+
* information as You use with respect to Your own similar confidential and/or
|
|
101
|
+
* proprietary information, which shall not be less than the care a reasonable
|
|
102
|
+
* person would use under similar circumstances. All Confidential Information, and
|
|
103
|
+
* any copies thereof, shall be returned promptly to Realsee upon request. You
|
|
104
|
+
* shall ensure that Your Affiliates comply with the provisions of this Section 3,
|
|
105
|
+
* and You shall be liable for any breach of this Section 3 resulting from the act
|
|
106
|
+
* or omission of any of Your Affiliates. You shall not disclose Confidential
|
|
107
|
+
* Information to any third party, including, without limitation, any of Your
|
|
108
|
+
* subcontractors.
|
|
109
|
+
* 4. PROPRIETARY RIGHTS.
|
|
110
|
+
* 4.1 As between You and Realsee, Realsee and/or its licensors retain ownership of
|
|
111
|
+
* all right, title, and interest in, to, and under the SDK, including, without
|
|
112
|
+
* limitation, all patents, copyrights, trade secrets, trademarks and other
|
|
113
|
+
* intellectual property and other proprietary rights therein, and reserve all
|
|
114
|
+
* rights not expressly granted to You.
|
|
115
|
+
* 4.2 The items contained in the SDK are the intellectual property of Realsee and
|
|
116
|
+
* its licensors and are protected by PRC copyright and patent law, international
|
|
117
|
+
* treaty provisions and applicable laws of the country in which it is being used.
|
|
118
|
+
* You agree to protect all copyright and other ownership interests of Realsee
|
|
119
|
+
* and/or its licensors in all items in the SDK supplied under this License
|
|
120
|
+
* Agreement. You agree that all copies of the items in the SDK, reproduced for any
|
|
121
|
+
* reason by You, contain the same copyright notices, and other proprietary notices
|
|
122
|
+
* as appropriate, as appear on or in the original items delivered by Realsee in
|
|
123
|
+
* the SDK. Realsee and/or its licensors retain title and ownership of the items in
|
|
124
|
+
* the SDK, the media on which it is loaded, and all subsequent copies, regardless
|
|
125
|
+
* of the form or media in or on which the original and other copies may exist.
|
|
126
|
+
* Except as stated above, this Agreement does not grant You any rights to patents,
|
|
127
|
+
* copyrights, trade secrets, trademarks or any other rights in respect to the
|
|
128
|
+
* items in the SDK.
|
|
129
|
+
* 5. TERM AND TERMINATION.
|
|
130
|
+
* 5.1 This Agreement is effective until terminated. Realsee has the right to
|
|
131
|
+
* terminate this Agreement immediately, without judicial intervention, if You fail
|
|
132
|
+
* to comply with any term herein. Upon any such termination You must remove all
|
|
133
|
+
* full and partial copies of the items in the SDK from Your computer and
|
|
134
|
+
* discontinue the use of the items in the SDK.
|
|
135
|
+
* 5.2 Realsee may at any time, terminate the Agreement with You if: (A) You have
|
|
136
|
+
* breached any provision of the Agreement; or (B) Realsee is required to do so by
|
|
137
|
+
* law; or (C) Realsee decides to no longer provide the SDK or certain parts of the
|
|
138
|
+
* SDK to users in the country in which You are resident or from which You use the
|
|
139
|
+
* service, or the provision of the SDK or certain SDK services to You by Realsee
|
|
140
|
+
* is, in Realsee's sole discretion, no longer legally or commercially viable.
|
|
141
|
+
* 5.3 When the Agreement comes to an end, all of the legal rights, obligations and
|
|
142
|
+
* liabilities that You and Realsee have benefited from, been subject to (or which
|
|
143
|
+
* have accrued over time whilst the Agreement has been in force) or which are
|
|
144
|
+
* expressed to continue indefinitely, shall be unaffected by this cessation, and
|
|
145
|
+
* the provisions of Section 3, 4, 6, 7 and 8 shall continue to apply to such
|
|
146
|
+
* rights, obligations and liabilities indefinitely.
|
|
147
|
+
* 6. DISCLAIMER OF WARRANTY.
|
|
148
|
+
* YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE
|
|
149
|
+
* LAW, USE OF THE SDK (OR ANY PART THEREOF) IS AT YOUR SOLE RISK AND THAT THE
|
|
150
|
+
* ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS
|
|
151
|
+
* WITH YOU. REALSEE LICENSES THE SDK TO YOU ONLY ON AN "AS-IS" BASIS. REALSEE
|
|
152
|
+
* MAKES NO REPRESENTATION WITH RESPECT TO THE ADEQUACY OF ANY ITEMS IN THE SDK,
|
|
153
|
+
* WHETHER OR NOT USED BY YOU IN THE DEVELOPMENT OF INTEGRATED PRODUCT, FOR ANY
|
|
154
|
+
* PARTICULAR PURPOSE OR WITH RESPECT TO THEIR ADEQUACY TO PRODUCE ANY PARTICULAR
|
|
155
|
+
* RESULT. REALSEE AND ITS LICENSORS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING
|
|
156
|
+
* OUT OF THIS AGREEMENT OR FROM THE DISTRIBUTION OR USE OF INTEGRATED PRODUCT
|
|
157
|
+
* CONTAINING PORTIONS OF THE SDK. REALSEE AND ITS LICENSORS DISCLAIM ALL
|
|
158
|
+
* WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED
|
|
159
|
+
* CONDITIONS OR WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
160
|
+
* OR NONINFRINGEMENT OF ANY THIRD PARTY RIGHT IN RESPECT OF THE ITEMS IN THE SDK
|
|
161
|
+
* OR ANY SERVICES RELATED TO THE SDK.
|
|
162
|
+
* REALSEE IS UNDER NO OBLIGATION TO PROVIDE ANY SUPPORT UNDER THIS LICENSE
|
|
163
|
+
* AGREEMENT, INCLUDING UPGRADES OR FUTURE VERSIONS OF THE SDK OR ANY PORTIONS
|
|
164
|
+
* THEREOF, TO YOU, END USER OR TO ANY OTHER PARTY.
|
|
165
|
+
* 7. LIMITATION OF LIABILITY.
|
|
166
|
+
* TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL REALSEE OR ITS
|
|
167
|
+
* LICENSORS BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, OR
|
|
168
|
+
* CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE,
|
|
169
|
+
* LOSS OF BUSINESS, REVENUE, OR PROFITS, LOSS OF OPPORTUNITY (WHETHER DIRECT OR
|
|
170
|
+
* INDIRECT), CORRUPTION OR LOSS OF DATA, LOSS OF REPUTATION OR SAVINGS, DOWNTIME,
|
|
171
|
+
* OR DAMAGE TO, LOSS OF OR REPLACEMENT OF DATA OR TRANSACTIONS, COST OF
|
|
172
|
+
* PROCUREMENT OF SUBSTITUTE SERVICES, BUSINESS INTERRUPTION, OR ANY OTHER
|
|
173
|
+
* COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY
|
|
174
|
+
* TO USE THE SDK (OR ANY PART THEREOF), ANY INTEGRATED PRODUCT, OR ANY THIRD PARTY
|
|
175
|
+
* SOFTWARE, APPLICATIONS, OR SERVICES IN CONJUNCTION WITH THE SDK (OR ANY PART
|
|
176
|
+
* THEREOF), HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT,
|
|
177
|
+
* OR OTHERWISE) AND EVEN IF REALSEE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
178
|
+
* DAMAGES. IN NO EVENT WILL REALSEE’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES
|
|
179
|
+
* EXCEED ONE HUNDRED DOLLARS ($100.00). THE FOREGOING LIMITATIONS WILL APPLY EVEN
|
|
180
|
+
* IF THE ABOVE STATED REMEDY FAILS OF ITS ESSENTIAL PURPOSE. THE LIMITATIONS
|
|
181
|
+
* CONTAINED IN SECTIONS 6 AND THIS SECTION 7 ARE A FUNDAMENTAL PART OF THE BASIS
|
|
182
|
+
* OF REALSEE’S BARGAIN HEREUNDER, AND REALSEE WOULD NOT ENTER INTO THIS AGREEMENT
|
|
183
|
+
* OR PROVIDE YOU WITH ACCESS TO THE SDK ABSENT SUCH LIMITATIONS.
|
|
184
|
+
* 8. INDEMNIFICATION.
|
|
185
|
+
* To the extent permitted by applicable law, You agree to indemnify, defend and
|
|
186
|
+
* hold harmless Realsee, its affiliates and each of their directors, officers,
|
|
187
|
+
* employees, independent contractors, and agents (each a “Realsee Indemnified
|
|
188
|
+
* Party”) from any and all claims, losses, liabilities, damages, expenses, and
|
|
189
|
+
* costs (including without limitation attorneys’ fees and court costs) incurred by
|
|
190
|
+
* a Realsee Indemnified Party as a result of: (i) Your non-compliance with any
|
|
191
|
+
* terms of this Agreement; (ii) Your use of the SDK (or any part thereof); or
|
|
192
|
+
* (iii) Your use of any Integrated Product, including any claim that Integrated
|
|
193
|
+
* Product infringes the copyright, trademark, trade secret or other intellectual
|
|
194
|
+
* property right of a third party.
|
|
195
|
+
* 9. ACKNOWLEDGEMENTS.
|
|
196
|
+
* Portions of the SDK may utilize or include third party software and other
|
|
197
|
+
* copyrighted material. Acknowledgments, licensing terms, and disclaimers for such
|
|
198
|
+
* material are contained in Documentation for the SDK or may otherwise accompany
|
|
199
|
+
* such material, and Your use of such materials governed by their respective
|
|
200
|
+
* terms. In the event of conflict between the terms of this Agreement and an
|
|
201
|
+
* applicable open source or third party agreement, the open source or third party
|
|
202
|
+
* agreement will control solely with respect to the open source software or third
|
|
203
|
+
* party software. Moreover, You shall not subject any items (including not limited
|
|
204
|
+
* to source code, object code, and any software) included in the SDK to any open
|
|
205
|
+
* source license.
|
|
206
|
+
* 10. NON-BLOCKING OF REALSEE DEVELOPMENT.
|
|
207
|
+
* You acknowledge that Realsee is currently developing or may develop technologies
|
|
208
|
+
* and products in the future that have or may have design and/or functionality
|
|
209
|
+
* similar to Integrated Product that You may develop based on Your license herein.
|
|
210
|
+
* Nothing in this Agreement shall impair, limit or curtail Realsee's right to
|
|
211
|
+
* continue with its development, maintenance and/or distribution of Realsee's
|
|
212
|
+
* technology or products.
|
|
213
|
+
* 11. GENERAL.
|
|
214
|
+
* 11.1 Export Control. You may not use or otherwise export or re-export the SDK
|
|
215
|
+
* (or any part thereof) except as authorized by United States law and the laws of
|
|
216
|
+
* the jurisdiction(s) in which the SDK (or any part thereof) was obtained. In
|
|
217
|
+
* particular, but without limitation, the SDK may not be exported or re-exported
|
|
218
|
+
* (i) into any U.S. embargoed countries or (ii) to anyone on the U.S. Treasury
|
|
219
|
+
* Department's list of Specially Designated Nationals or the U.S. Department of
|
|
220
|
+
* Commerce Denied Person's List or Entity List. By using the SDK (or any part
|
|
221
|
+
* thereof), You represent and warrant that You are not located in any such country
|
|
222
|
+
* or on any such list.
|
|
223
|
+
* 11.2 Governing Law. This Agreement and the rights of the parties hereunder shall
|
|
224
|
+
* be governed by and construed in accordance with the laws of People’s Republic of
|
|
225
|
+
* China (for purpose of this Agreement, excluding Hong Kong, Taiwan, and Macau),
|
|
226
|
+
* without reference to its conflict of laws principles. Any dispute, controversy
|
|
227
|
+
* or claim arising from or in connection with this Agreement, or the breach,
|
|
228
|
+
* termination or invalidity thereof, shall be submitted to China International
|
|
229
|
+
* Economic and Trade Arbitration Commission (“CIETAC”) for arbitration in Beijing
|
|
230
|
+
* which shall be conducted in accordance with the CIETAC's arbitration rules in
|
|
231
|
+
* effect at the time of applying for arbitration. The arbitral award is final and
|
|
232
|
+
* binding upon both parties.
|
|
233
|
+
* 11.3 Severability. If any provision of this Agreement is held by a court of
|
|
234
|
+
* competent jurisdiction to be unenforceable for any reason, the remaining
|
|
235
|
+
* provisions hereof will be unaffected and remain in full force and effect.
|
|
236
|
+
* 11.4. Modifications. Realsee reserves the right, from time to time, with or
|
|
237
|
+
* without notice to You, to make revisions to this Agreement in our sole and
|
|
238
|
+
* absolute discretion. The most current version of this Agreement will supersede
|
|
239
|
+
* all previous versions and shall be made available on the website where the SDK
|
|
240
|
+
* is made available, or by such other means as Realsee may determine in its
|
|
241
|
+
* discretion. Any modified versions of this Agreement hereto shall take effect
|
|
242
|
+
* from the time that it is made available. You shall be responsible for regularly
|
|
243
|
+
* checking for notice of any such modifications. You agree that Your continued use
|
|
244
|
+
* of the SDK constitutes Your agreement to the modified Agreement.
|
|
245
|
+
* 11.5 Relationship of the Parties. This Agreement will not be construed as
|
|
246
|
+
* creating an agency, partnership, joint venture, fiduciary duty, or any other
|
|
247
|
+
* form of legal association between You and Realsee, and You will not represent to
|
|
248
|
+
* the contrary, whether expressly, by implication, appearance, or otherwise.
|
|
249
|
+
* 11.6 Entire Agreement; Governing Language. This Agreement constitutes the entire
|
|
250
|
+
* agreement between You and Realsee with respect to the use of the SDK licensed
|
|
251
|
+
* hereunder and supersedes all prior understandings regarding such subject matter.
|
|
252
|
+
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
|
+
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
|
+
* Agreement and all related documents shall be drafted in English.
|
|
255
|
+
*/!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FiveSDK={},e.THREE)}(this,(function(exports,THREE){"use strict";function _interopNamespaceDefault(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const THREE__namespace=_interopNamespaceDefault(THREE);var version=Number(THREE__namespace.REVISION);if(version<115||version>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');
|
|
256
|
+
/**
|
|
257
|
+
* @license
|
|
258
|
+
* The 'jsrsasign'(RSA-Sign JavaScript Library) License
|
|
259
|
+
*
|
|
260
|
+
* Copyright (c) 2010-2021 Kenji Urushima
|
|
261
|
+
*
|
|
262
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
263
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
264
|
+
* in the Software without restriction, including without limitation the rights
|
|
265
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
266
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
267
|
+
* furnished to do so, subject to the following conditions:
|
|
268
|
+
*
|
|
269
|
+
* The above copyright notice and this permission notice shall be included in
|
|
270
|
+
* all copies or substantial portions of the Software.
|
|
271
|
+
*
|
|
272
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
273
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
274
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
275
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
276
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
277
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
278
|
+
* THE SOFTWARE.
|
|
279
|
+
*
|
|
280
|
+
* LICENSE: MIT License
|
|
281
|
+
*/
|
|
282
|
+
/**
|
|
283
|
+
* @license
|
|
284
|
+
* RSA and ECC in JavaScript
|
|
285
|
+
*
|
|
286
|
+
* Copyright (c) 2003-2005 Tom Wu All Rights Reserved.
|
|
287
|
+
*
|
|
288
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
289
|
+
* a copy of this software and associated documentation files (the
|
|
290
|
+
* "Software"), to deal in the Software without restriction, including
|
|
291
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
292
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
293
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
294
|
+
* the following conditions:
|
|
295
|
+
*
|
|
296
|
+
* The above copyright notice and this permission notice shall be
|
|
297
|
+
* included in all copies or substantial portions of the Software.
|
|
298
|
+
*
|
|
299
|
+
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
|
300
|
+
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
|
301
|
+
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
|
302
|
+
*
|
|
303
|
+
* IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
|
|
304
|
+
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
|
|
305
|
+
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
|
|
306
|
+
* THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
|
|
307
|
+
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
308
|
+
*
|
|
309
|
+
* In addition, the following condition applies:
|
|
310
|
+
*
|
|
311
|
+
* All redistributions must retain an intact copy of this copyright notice
|
|
312
|
+
* and disclaimer.
|
|
313
|
+
*
|
|
314
|
+
* http://www-cs-students.stanford.edu/~tjw/jsbn/
|
|
315
|
+
* LICENSE: BSD License
|
|
316
|
+
* PART: ext/{base64,jsbn,jsbn2,prgn4,rng,rsa,rsa2}
|
|
317
|
+
*/
|
|
318
|
+
/**
|
|
319
|
+
* @license
|
|
320
|
+
* CryptoJS
|
|
321
|
+
*
|
|
322
|
+
* Copyright (c) 2009-2013 Jeff Mott
|
|
323
|
+
*
|
|
324
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
325
|
+
* a copy of this software and associated documentation files (the
|
|
326
|
+
* "Software"), to deal in the Software without restriction, including
|
|
327
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
328
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
329
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
330
|
+
* the following conditions:
|
|
331
|
+
*
|
|
332
|
+
* The above copyright notice and this permission notice shall be
|
|
333
|
+
* included in all copies or substantial portions of the Software.
|
|
334
|
+
*
|
|
335
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
336
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
337
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
338
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
339
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
340
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
341
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
342
|
+
*
|
|
343
|
+
* https://code.google.com/p/crypto-js/wiki/License
|
|
344
|
+
* PART: ext/cryptojs
|
|
345
|
+
*/var KJUR={},CryptoJS=CryptoJS||function(e,t){var n={},r=n.lib={},i=r.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var a=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=a<<24-(r+o)%4*8}else for(o=0;o<i;o+=4)t[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r<t;r+=4)n.push(4294967296*e.random()|0);return new o.init(n,t)}}),a=n.enc={},s=a.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new o.init(n,t/2)}},c=a.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new o.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},u=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,i);if(c){for(var u=0;u<c;u+=a)this._doProcessBlock(r,u);var p=r.splice(0,c);n.sigBytes-=l}return new o.init(p,l)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=u.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new p.HMAC.init(e,n).finalize(t)}}});var p=n.algo={};return n}(Math),dbits;function BigInteger(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function nbi(){return new BigInteger(null)}function am1(e,t,n,r,i,o){for(;--o>=0;){var a=t*this[e++]+n[r]+i;i=Math.floor(a/67108864),n[r++]=67108863&a}return i}function am2(e,t,n,r,i,o){for(var a=32767&t,s=t>>15;--o>=0;){var c=32767&this[e],l=this[e++]>>15,u=s*c+l*a;i=((c=a*c+((32767&u)<<15)+n[r]+(1073741823&i))>>>30)+(u>>>15)+s*l+(i>>>30),n[r++]=1073741823&c}return i}function am3(e,t,n,r,i,o){for(var a=16383&t,s=t>>14;--o>=0;){var c=16383&this[e],l=this[e++]>>14,u=s*c+l*a;i=((c=a*c+((16383&u)<<14)+n[r]+i)>>28)+(u>>14)+s*l,n[r++]=268435455&c}return i}!function(e){for(var t=CryptoJS,n=(i=t.lib).WordArray,r=i.Hasher,i=t.algo,o=[],a=[],s=function(e){return 4294967296*(e-(0|e))|0},c=2,l=0;64>l;){var u;e:{u=c;for(var p=e.sqrt(u),d=2;d<=p;d++)if(!(u%d)){u=!1;break e}u=!0}u&&(8>l&&(o[l]=s(e.pow(c,.5))),a[l]=s(e.pow(c,1/3)),l++),c++}var h=[];i=i.SHA256=r.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],p=n[7],d=0;64>d;d++){if(16>d)h[d]=0|e[t+d];else{var f=h[d-15],m=h[d-2];h[d]=((f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3)+h[d-7]+((m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10)+h[d-16]}f=p+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&l^~c&u)+a[d]+h[d],m=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&o^i&o),p=u,u=l,l=c,c=s+f|0,s=o,o=i,i=r,r=f+m|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0,n[5]=n[5]+l|0,n[6]=n[6]+u|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(i),t.HmacSHA256=r._createHmacHelper(i)}(Math),CryptoJS.lib.Cipher||function(e){var t=(h=CryptoJS).lib,n=t.Base,r=t.WordArray,i=t.BufferedBlockAlgorithm,o=h.enc.Base64,a=h.algo.EvpKDF,s=t.Cipher=i.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,n,r){return("string"==typeof n?f:d).encrypt(e,t,n,r)},decrypt:function(t,n,r){return("string"==typeof n?f:d).decrypt(e,t,n,r)}}}});t.StreamCipher=s.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var c=h.mode={},l=function(e,t,n){var r=this._iv;r?this._iv=undefined:r=this._prevBlock;for(var i=0;i<n;i++)e[t+i]^=r[i]},u=(t.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();u.Encryptor=u.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize;l.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),u.Decryptor=u.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=e.slice(t,t+r);n.decryptBlock(e,t),l.call(this,e,t,r),this._prevBlock=i}}),c=c.CBC=u,u=(h.pad={}).Pkcs7={pad:function(e,t){for(var n,i=(n=(n=4*t)-e.sigBytes%n)<<24|n<<16|n<<8|n,o=[],a=0;a<n;a+=4)o.push(i);n=r.create(o,n),e.concat(n)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=s.extend({cfg:s.cfg.extend({mode:c,padding:u}),reset:function(){s.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var p=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),d=(c=(h.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.create([1398893684,1701076831]).concat(e).concat(t):t).toString(o)},parse:function(e){var t=(e=o.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var n=r.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:c}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,p.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),h=(h.kdf={}).OpenSSL={execute:function(e,t,n,i){return i||(i=r.random(8)),e=a.create({keySize:t+n}).compute(e,i),n=r.create(e.words.slice(t),4*n),e.sigBytes=4*t,p.create({key:e,iv:n,salt:i})}},f=t.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:h}),encrypt:function(e,t,n,r){return n=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,(e=d.encrypt.call(this,e,t,n.key,r)).mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,d.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=CryptoJS,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],o=[],a=[],s=[],c=[],l=[],u=[],p=[],d=[],h=[],f=0;256>f;f++)h[f]=128>f?f<<1:f<<1^283;var m=0,v=0;for(f=0;256>f;f++){var A=(A=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&A^99;r[m]=A,i[A]=m;var g=h[m],y=h[g],b=h[y],E=257*h[A]^16843008*A;o[m]=E<<24|E>>>8,a[m]=E<<16|E>>>16,s[m]=E<<8|E>>>24,c[m]=E,E=16843009*b^65537*y^257*g^16843008*m,l[A]=E<<24|E>>>8,u[A]=E<<16|E>>>16,p[A]=E<<8|E>>>24,d[A]=E,m?(m=g^h[h[h[b^g]]],v^=h[h[v]]):m=v=1}var _=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=t.extend({_doReset:function(){for(var e=(n=this._key).words,t=n.sigBytes/4,n=4*((this._nRounds=t+6)+1),i=this._keySchedule=[],o=0;o<n;o++)if(o<t)i[o]=e[o];else{var a=i[o-1];o%t?6<t&&4==o%t&&(a=r[a>>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a]):(a=r[(a=a<<8|a>>>24)>>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a],a^=_[o/t|0]<<24),i[o]=i[o-t]^a}for(e=this._invKeySchedule=[],t=0;t<n;t++)o=n-t,a=t%4?i[o]:i[o-4],e[t]=4>t||4>=o?a:l[r[a>>>24]]^u[r[a>>>16&255]]^p[r[a>>>8&255]]^d[r[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,s,c,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,u,p,d,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,o,a,s){for(var c=this._nRounds,l=e[t]^n[0],u=e[t+1]^n[1],p=e[t+2]^n[2],d=e[t+3]^n[3],h=4,f=1;f<c;f++){var m=r[l>>>24]^i[u>>>16&255]^o[p>>>8&255]^a[255&d]^n[h++],v=r[u>>>24]^i[p>>>16&255]^o[d>>>8&255]^a[255&l]^n[h++],A=r[p>>>24]^i[d>>>16&255]^o[l>>>8&255]^a[255&u]^n[h++];d=r[d>>>24]^i[l>>>16&255]^o[u>>>8&255]^a[255&p]^n[h++],l=m,u=v,p=A}m=(s[l>>>24]<<24|s[u>>>16&255]<<16|s[p>>>8&255]<<8|s[255&d])^n[h++],v=(s[u>>>24]<<24|s[p>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^n[h++],A=(s[p>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&u])^n[h++],d=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[u>>>8&255]<<8|s[255&p])^n[h++],e[t]=m,e[t+1]=v,e[t+2]=A,e[t+3]=d},keySize:8});e.AES=t._createHelper(n)}(),"undefined"!=typeof navigator&&"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=am2,dbits=30):"undefined"!=typeof navigator&&"Netscape"!=navigator.appName?(BigInteger.prototype.am=am1,dbits=26):(BigInteger.prototype.am=am3,dbits=28),BigInteger.prototype.DB=dbits,BigInteger.prototype.DM=(1<<dbits)-1,BigInteger.prototype.DV=1<<dbits;var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP),BigInteger.prototype.F1=BI_FP-dbits,BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array,rr,vv;for(rr="0".charCodeAt(0),vv=0;vv<=9;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;function int2char(e){return BI_RM.charAt(e)}function intAt(e,t){var n=BI_RC[e.charCodeAt(t)];return null==n?-1:n}function bnpCopyTo(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function bnpFromInt(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function nbv(e){var t=nbi();return t.fromInt(e),t}function bnpFromString(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var a=8==n?255&e[r]:intAt(e,r);a<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==o?this[this.t++]=a:o+n>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,(o+=n)>=this.DB&&(o-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function bnToString(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,r=(1<<t)-1,i=!1,o="",a=this.t,s=this.DB-a*this.DB%t;if(a-- >0)for(s<this.DB&&(n=this[a]>>s)>0&&(i=!0,o=int2char(n));a>=0;)s<t?(n=(this[a]&(1<<s)-1)<<t-s,n|=this[--a]>>(s+=this.DB-t)):(n=this[a]>>(s-=t)&r,s<=0&&(s+=this.DB,--a)),n>0&&(i=!0),i&&(o+=int2char(n));return i?o:"0"}function bnNegate(){var e=nbi();return BigInteger.ZERO.subTo(this,e),e}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function nbits(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function bnpDRShiftTo(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function bnpLShiftTo(e,t){var n,r=e%this.DB,i=this.DB-r,o=(1<<i)-1,a=Math.floor(e/this.DB),s=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)t[n+a+1]=this[n]>>i|s,s=(this[n]&o)<<r;for(n=a-1;n>=0;--n)t[n]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()}function bnpRShiftTo(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[n]>>r;for(var a=n+1;a<this.t;++a)t[a-n-1]|=(this[a]&o)<<i,t[a-n]=this[a]>>r;r>0&&(t[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}}function bnpSubTo(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function bnpMultiplyTo(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i<r.t;++i)t[i+n.t]=n.am(0,r[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&BigInteger.ZERO.subTo(t,t)}function bnpSquareTo(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function bnpDivRemTo(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t)return null!=t&&t.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=nbi());var o=nbi(),a=this.s,s=e.s,c=this.DB-nbits(r[r.t-1]);c>0?(r.lShiftTo(c,o),i.lShiftTo(c,n)):(r.copyTo(o),i.copyTo(n));var l=o.t,u=o[l-1];if(0!=u){var p=u*(1<<this.F1)+(l>1?o[l-2]>>this.F2:0),d=this.FV/p,h=(1<<this.F1)/p,f=1<<this.F2,m=n.t,v=m-l,A=null==t?nbi():t;for(o.dlShiftTo(v,A),n.compareTo(A)>=0&&(n[n.t++]=1,n.subTo(A,n)),BigInteger.ONE.dlShiftTo(l,A),A.subTo(o,o);o.t<l;)o[o.t++]=0;for(;--v>=0;){var g=n[--m]==u?this.DM:Math.floor(n[m]*d+(n[m-1]+f)*h);if((n[m]+=o.am(0,g,n,v,0,l))<g)for(o.dlShiftTo(v,A),n.subTo(A,n);n[m]<--g;)n.subTo(A,n)}null!=t&&(n.drShiftTo(l,t),a!=s&&BigInteger.ZERO.subTo(t,t)),n.t=l,n.clamp(),c>0&&n.rShiftTo(c,n),a<0&&BigInteger.ZERO.subTo(n,n)}}}function bnMod(e){var t=nbi();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(BigInteger.ZERO)>0&&e.subTo(t,t),t}function Classic(e){this.m=e}function cConvert(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function cRevert(e){return e}function cReduce(e){e.divRemTo(this.m,null,e)}function cMulTo(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function cSqrTo(e,t){e.squareTo(t),this.reduce(t)}function bnpInvDigit(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t}function Montgomery(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function montConvert(e){var t=nbi();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(BigInteger.ZERO)>0&&this.m.subTo(t,t),t}function montRevert(e){var t=nbi();return e.copyTo(t),this.reduce(t),t}function montReduce(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function montSqrTo(e,t){e.squareTo(t),this.reduce(t)}function montMulTo(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function bnpIsEven(){return 0==(this.t>0?1&this[0]:this.s)}function bnpExp(e,t){if(e>4294967295||e<1)return BigInteger.ONE;var n=nbi(),r=nbi(),i=t.convert(this),o=nbits(e)-1;for(i.copyTo(n);--o>=0;)if(t.sqrTo(n,r),(e&1<<o)>0)t.mulTo(r,i,n);else{var a=n;n=r,r=a}return t.revert(n)}function bnModPowInt(e,t){var n;return n=e<256||t.isEven()?new Classic(t):new Montgomery(t),this.exp(e,n)}
|
|
346
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
|
|
347
|
+
function bnIntValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function bnpChunkSize(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function bnSigNum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function bnpToRadix(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=nbv(n),i=nbi(),o=nbi(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substr(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a}Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo,Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo,BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1),BigInteger.prototype.chunkSize=bnpChunkSize,BigInteger.prototype.toRadix=bnpToRadix,BigInteger.prototype.intValue=bnIntValue,BigInteger.prototype.signum=bnSigNum;
|
|
348
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
|
|
349
|
+
var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64pad="=";function hex2b64(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=b64map.charAt(n>>6)+b64map.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=b64map.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=b64map.charAt(n>>2)+b64map.charAt((3&n)<<4));(3&r.length)>0;)r+=b64pad;return r}function b64tohex(e){var t,n,r,i="",o=0;for(t=0;t<e.length&&e.charAt(t)!=b64pad;++t)(r=b64map.indexOf(e.charAt(t)))<0||(0==o?(i+=int2char(r>>2),n=3&r,o=1):1==o?(i+=int2char(n<<2|r>>4),n=15&r,o=2):2==o?(i+=int2char(n),i+=int2char(r>>2),n=3&r,o=3):(i+=int2char(n<<2|r>>4),i+=int2char(15&r),o=0));return 1==o&&(i+=int2char(n<<2)),i}
|
|
350
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function parseBigInt(e,t){return new BigInteger(e,t)}function pkcs1pad2(e,t){if(t<e.length+11)throw"Message too long for RSA";for(var n=new Array,r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=63&i|128,n[--t]=i>>6|192):(n[--t]=63&i|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var o=new SecureRandom,a=new Array;t>2;){for(a[0]=0;0==a[0];)o.nextBytes(a);n[--t]=a[0]}return n[--t]=2,n[--t]=0,new BigInteger(n)}function oaep_mgf1_arr(e,t,n){for(var r="",i=0;r.length<t;)r+=n(String.fromCharCode.apply(String,e.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return r}function oaep_pad(e,t,n,r){var i=KJUR.crypto.MessageDigest,o=KJUR.crypto.Util,a=null;if(n||(n="sha1"),"string"==typeof n&&(a=i.getCanonicalAlgName(n),r=i.getHashLength(a),n=function(e){return hextorstr(o.hashHex(rstrtohex(e),a))}),e.length+2*r+2>t)throw"Message too long for RSA";var s,c="";for(s=0;s<t-e.length-2*r-2;s+=1)c+="\0";var l=n("")+c+""+e,u=new Array(r);(new SecureRandom).nextBytes(u);var p=oaep_mgf1_arr(u,l.length,n),d=[];for(s=0;s<l.length;s+=1)d[s]=l.charCodeAt(s)^p.charCodeAt(s);var h=oaep_mgf1_arr(d,u.length,n),f=[0];for(s=0;s<u.length;s+=1)f[s+1]=u[s]^h.charCodeAt(s);return new BigInteger(f.concat(d))}function RSAKey(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function RSASetPublic(e,t){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof e)this.n=e,this.e=t;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA public key";this.n=parseBigInt(e,16),this.e=parseInt(t,16)}}function RSADoPublic(e){return e.modPowInt(this.e,this.n)}function RSAEncrypt(e){var t=pkcs1pad2(e,this.n.bitLength()+7>>3);if(null==t)return null;var n=this.doPublic(t);if(null==n)return null;var r=n.toString(16);return 0==(1&r.length)?r:"0"+r}function RSAEncryptOAEP(e,t,n){var r=oaep_pad(e,this.n.bitLength()+7>>3,t,n);if(null==r)return null;var i=this.doPublic(r);if(null==i)return null;var o=i.toString(16);return 0==(1&o.length)?o:"0"+o}
|
|
351
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
|
|
352
|
+
function pkcs1unpad2(e,t){for(var n=e.toByteArray(),r=0;r<n.length&&0==n[r];)++r;if(n.length-r!=t-1||2!=n[r])return null;for(++r;0!=n[r];)if(++r>=n.length)return null;for(var i="";++r<n.length;){var o=255&n[r];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&o)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return i}function oaep_mgf1_str(e,t,n){for(var r="",i=0;r.length<t;)r+=n(e+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])),i+=1;return r}function oaep_unpad(e,t,n,r){var i=KJUR.crypto.MessageDigest,o=KJUR.crypto.Util,a=null;for(n||(n="sha1"),"string"==typeof n&&(a=i.getCanonicalAlgName(n),r=i.getHashLength(a),n=function(e){return hextorstr(o.hashHex(rstrtohex(e),a))}),e=e.toByteArray(),s=0;s<e.length;s+=1)e[s]&=255;for(;e.length<t;)e.unshift(0);if((e=String.fromCharCode.apply(String,e)).length<2*r+2)throw"Cipher too short";var s,c=e.substr(1,r),l=e.substr(r+1),u=oaep_mgf1_str(l,r,n),p=[];for(s=0;s<c.length;s+=1)p[s]=c.charCodeAt(s)^u.charCodeAt(s);var d=oaep_mgf1_str(String.fromCharCode.apply(String,p),e.length-r,n),h=[];for(s=0;s<l.length;s+=1)h[s]=l.charCodeAt(s)^d.charCodeAt(s);if((h=String.fromCharCode.apply(String,h)).substr(0,r)!==n(""))throw"Hash mismatch";var f=(h=h.substr(r)).indexOf("");if((-1!=f?h.substr(0,f).lastIndexOf("\0"):-1)+1!=f)throw"Malformed data";return h.substr(f+1)}function RSASetPrivate(e,t,n){if(this.isPrivate=!0,"string"!=typeof e)this.n=e,this.e=t,this.d=n;else{if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key";this.n=parseBigInt(e,16),this.e=parseInt(t,16),this.d=parseBigInt(n,16)}}function RSASetPrivateEx(e,t,n,r,i,o,a,s){if(this.isPrivate=!0,this.isPublic=!1,null==e)throw"RSASetPrivateEx N == null";if(null==t)throw"RSASetPrivateEx E == null";if(0==e.length)throw"RSASetPrivateEx N.length == 0";if(0==t.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=e&&null!=t&&e.length>0&&t.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=parseBigInt(e,16),this.e=parseInt(t,16),this.d=parseBigInt(n,16),this.p=parseBigInt(r,16),this.q=parseBigInt(i,16),this.dmp1=parseBigInt(o,16),this.dmq1=parseBigInt(a,16),this.coeff=parseBigInt(s,16)}function RSADoPrivate(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)}function RSADecrypt(e){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var t=parseBigInt(e,16),n=this.doPrivate(t);return null==n?null:pkcs1unpad2(n,this.n.bitLength()+7>>3)}function RSADecryptOAEP(e,t,n){if(e.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var r=parseBigInt(e,16),i=this.doPrivate(r);return null==i?null:oaep_unpad(i,this.n.bitLength()+7>>3,t,n)}function b64utob64(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function b64utohex(e){return b64tohex(b64utob64(e))}function hextoutf8(e){return decodeURIComponent(hextouricmp(e))}function hextorstr(e){for(var t="",n=0;n<e.length-1;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t}function rstrtohex(e){for(var t="",n=0;n<e.length;n++)t+=("0"+e.charCodeAt(n).toString(16)).slice(-2);return t}function hextob64(e){return hex2b64(e)}function hextob64nl(e){var t=hextob64(e).replace(/(.{64})/g,"$1\r\n");return t=t.replace(/\r\n$/,"")}function b64nltohex(e){return b64tohex(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}function hextopem(e,t){return"-----BEGIN "+t+"-----\r\n"+hextob64nl(e)+"\r\n-----END "+t+"-----\r\n"}function pemtohex(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return b64nltohex(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function hextouricmp(e){return e.replace(/(..)/g,"%$1")}function hextoipv6(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var t=(e=e.toLowerCase()).match(/.{1,4}/g),n=0;n<8;n++)t[n]=t[n].replace(/^0+/,""),""==t[n]&&(t[n]="0");var r=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===r)return e.slice(1,-1);var i="";for(n=0;n<r.length;n++)r[n].length>i.length&&(i=r[n]);return(e=e.replace(i,"::")).slice(1,-1)}function hextoip(e){var t="malformed hex value";if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8!=e.length)return 32==e.length?hextoipv6(e):e;try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(n){throw t}}function ucs2hextoutf8(e){return e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),n=parseInt(e.substr(2),16);if(0==t&n<128)return String.fromCharCode(n);if(t<8){var r=128|63&n;return hextoutf8((192|(7&t)<<3|(192&n)>>6).toString(16)+r.toString(16))}r=128|(15&t)<<2|(192&n)>>6;var i=128|63&n;return hextoutf8((224|(240&t)>>4).toString(16)+r.toString(16)+i.toString(16))})).join("")}function ishex(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function hextoposhex(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function hextooid(e){if(!ishex(e))return null;try{var t=[],n=e.substr(0,2),r=parseInt(n,16);t[0]=new String(Math.floor(r/40)),t[1]=new String(r%40);for(var i=e.substr(2),o=[],a=0;a<i.length/2;a++)o.push(parseInt(i.substr(2*a,2),16));var s=[],c="";for(a=0;a<o.length;a++)128&o[a]?c+=strpad((127&o[a]).toString(2),7):(c+=strpad((127&o[a]).toString(2),7),s.push(new String(parseInt(c,2))),c="");var l=t.join(".");return s.length>0&&(l=l+"."+s.join(".")),l}catch(u){return null}}RSAKey.prototype.doPublic=RSADoPublic,RSAKey.prototype.setPublic=RSASetPublic,RSAKey.prototype.encrypt=RSAEncrypt,RSAKey.prototype.encryptOAEP=RSAEncryptOAEP,RSAKey.prototype.type="RSA",RSAKey.prototype.doPrivate=RSADoPrivate,RSAKey.prototype.setPrivate=RSASetPrivate,RSAKey.prototype.setPrivateEx=RSASetPrivateEx,RSAKey.prototype.decrypt=RSADecrypt,RSAKey.prototype.decryptOAEP=RSADecryptOAEP,void 0!==KJUR.lang&&KJUR.lang||(KJUR.lang={}),KJUR.lang.String=function(){},KJUR.lang.String.isHex=function(e){return ishex(e)},KJUR.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var strpad=function(e,t,n){return null==n&&(n="0"),e.length>=t?e:new Array(t-e.length+1).join(n)+e};function bitstrtoint(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var n=parseInt(t,16),r=e.substr(2),i=parseInt(r,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-n),parseInt(i,2)}catch(o){return-1}}void 0!==KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:CryptoJS.algo.MD5,sha1:CryptoJS.algo.SHA1,sha224:CryptoJS.algo.SHA224,sha256:CryptoJS.algo.SHA256,sha384:CryptoJS.algo.SHA384,sha512:CryptoJS.algo.SHA512,ripemd160:CryptoJS.algo.RIPEMD160},this.hashString=function(e,t){return new KJUR.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new KJUR.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")}},KJUR.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=KJUR.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=KJUR.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(n){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+n}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=CryptoJS.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(CryptoJS.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(n){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+n}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},KJUR.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},KJUR.crypto.MessageDigest.getHashLength=function(e){var t=KJUR.crypto.MessageDigest,n=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[n])throw"not supported algorithm: "+e;return t.HASHLENGTH[n]},KJUR.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},KJUR.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var n="",r=t/4-e.length,i=0;i<r;i++)n+="0";return n+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new KJUR.crypto.MessageDigest({alg:this.mdAlgName})}catch(n){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+n)}this.init=function(e,t){var n=null;try{n=void 0===t?KEYUTIL.getKey(e):KEYUTIL.getKey(e,t)}catch(r){throw"init failed:"+r}if(!0===n.isPrivate)this.prvKey=n,this.state="SIGN";else{if(!0!==n.isPublic)throw"init failed.:"+n;this.pubKey=n,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.verify=function(e){if(this.sHashHex=this.md.digest(),this.pubKey instanceof RSAKey&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof RSAKey&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=KEYUTIL.getKey(e.prvkeypem);this.init(t)}catch(n){throw"fatal error to load pem private key: "+n}}},KJUR.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}};var KEYUTIL=function(){var e=function(e,n,r){return t(CryptoJS.AES,e,n,r)},t=function(e,t,n,r){var i=CryptoJS.enc.Hex.parse(t),o=CryptoJS.enc.Hex.parse(n),a=CryptoJS.enc.Hex.parse(r),s={};s.key=o,s.iv=a,s.ciphertext=i;var c=e.decrypt(s,o,{iv:a});return CryptoJS.enc.Hex.stringify(c)},n=function(e,t,n){return r(CryptoJS.AES,e,t,n)},r=function(e,t,n,r){var i=CryptoJS.enc.Hex.parse(t),o=CryptoJS.enc.Hex.parse(n),a=CryptoJS.enc.Hex.parse(r),s=e.encrypt(i,o,{iv:a}),c=CryptoJS.enc.Hex.parse(s.toString());return CryptoJS.enc.Base64.stringify(c)},i={"AES-256-CBC":{proc:e,eproc:n,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:n,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:n,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,n,r){return t(CryptoJS.TripleDES,e,n,r)},eproc:function(e,t,n){return r(CryptoJS.TripleDES,e,t,n)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,n,r){return t(CryptoJS.DES,e,n,r)},eproc:function(e,t,n){return r(CryptoJS.DES,e,t,n)},keylen:8,ivlen:8}},o=function(e){var t={},n=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));n&&(t.cipher=n[1],t.ivsalt=n[2]);var r=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(t.type=r[1]);var i=-1,o=0;-1!=e.indexOf("\r\n\r\n")&&(i=e.indexOf("\r\n\r\n"),o=2),-1!=e.indexOf("\n\n")&&(i=e.indexOf("\n\n"),o=1);var a=e.indexOf("-----END");if(-1!=i&&-1!=a){var s=e.substring(i+2*o,a-o);s=s.replace(/\s+/g,""),t.data=s}return t},a=function(e,t,n){for(var r=n.substring(0,16),o=CryptoJS.enc.Hex.parse(r),a=CryptoJS.enc.Utf8.parse(t),s=i[e].keylen+i[e].ivlen,c="",l=null;;){var u=CryptoJS.algo.MD5.create();if(null!=l&&u.update(l),u.update(a),u.update(o),l=u.finalize(),(c+=CryptoJS.enc.Hex.stringify(l)).length>=2*s)break}var p={};return p.keyhex=c.substr(0,2*i[e].keylen),p.ivhex=c.substr(2*i[e].keylen,2*i[e].ivlen),p},s=function(e,t,n,r){var o=CryptoJS.enc.Base64.parse(e),a=CryptoJS.enc.Hex.stringify(o);return(0,i[t].proc)(a,n,r)};return{version:"1.0.0",parsePKCS5PEM:function(e){return o(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,n){return a(e,t,n)},decryptKeyB64:function(e,t,n,r){return s(e,t,n,r)},getDecryptedKeyHex:function(e,t){var n=o(e),r=n.cipher,i=n.ivsalt,c=n.data,l=a(r,t,i).keyhex;return s(c,r,l,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,n,r,o){var s="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===i[r])throw"KEYUTIL unsupported algorithm: "+r;if(void 0===o||null==o){var c=function(e){var t=CryptoJS.lib.WordArray.random(e);return CryptoJS.enc.Hex.stringify(t)}(i[r].ivlen);o=c.toUpperCase()}var l=function(e,t,n,r){return(0,i[t].eproc)(e,n,r)}(t,r,a(r,n,o).keyhex,o);s="-----BEGIN "+e+" PRIVATE KEY-----\r\n";return s+="Proc-Type: 4,ENCRYPTED\r\n",s+="DEK-Info: "+r+","+o+"\r\n",s+="\r\n",s+=l.replace(/(.{64})/g,"$1\r\n"),s+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=ASN1HEX,n=t.getChildIdx,r=t.getV,i={},o=n(e,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;i.ciphertext=r(e,o[1]);var a=n(e,o[0]);if(2!=a.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+a.length;if("2a864886f70d01050d"!=r(e,a[0]))throw"this only supports pkcs5PBES2";var s=n(e,a[1]);if(2!=a.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+s.length;var c=n(e,s[1]);if(2!=c.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+c.length;if("2a864886f70d0307"!=r(e,c[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=r(e,c[1]);var l=n(e,s[0]);if(2!=l.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+l.length;if("2a864886f70d01050c"!=r(e,l[0]))throw"this only supports pkcs5PBKDF2";var u=n(e,l[1]);if(u.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+u.length;i.pbkdf2Salt=r(e,u[0]);var p=r(e,u[1]);try{i.pbkdf2Iter=parseInt(p,16)}catch(d){throw"malformed format pbkdf2Iter: "+p}return i},getPBKDF2KeyHexFromParam:function(e,t){var n=CryptoJS.enc.Hex.parse(e.pbkdf2Salt),r=e.pbkdf2Iter,i=CryptoJS.PBKDF2(t,n,{keySize:6,iterations:r});return CryptoJS.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var n=pemtohex(e,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(n),i=KEYUTIL.getPBKDF2KeyHexFromParam(r,t),o={};o.ciphertext=CryptoJS.enc.Hex.parse(r.ciphertext);var a=CryptoJS.enc.Hex.parse(i),s=CryptoJS.enc.Hex.parse(r.encryptionSchemeIV),c=CryptoJS.TripleDES.decrypt(o,a,{iv:s});return CryptoJS.enc.Hex.stringify(c)},getKeyFromEncryptedPKCS8PEM:function(e,t){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function(e){var t=ASN1HEX,n=t.getChildIdx,r=t.getV,i={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=n(e,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var a=n(e,o[1]);if(2!=a.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(a[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=r(e,a[0]),"06"==e.substr(a[1],2)&&(i.algparam=r(e,a[1])),"04"!=e.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=t.getVidx(e,o[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=pemtohex(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,n=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==n.algoid)t=new RSAKey;else if(KJUR.crypto.DSA&&"2a8648ce380401"==n.algoid)t=new KJUR.crypto.DSA;else{if(!KJUR.crypto.ECDSA||"2a8648ce3d0201"!=n.algoid)throw"unsupported private key algorithm";t=new KJUR.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,n=ASN1HEX.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===n)t=new RSAKey;else if(KJUR.crypto.DSA&&"2a8648ce380401"===n)t=new KJUR.crypto.DSA;else{if(!KJUR.crypto.ECDSA||"2a8648ce3d0201"!==n)throw"unsupported PKCS#8 public key hex";t=new KJUR.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=ASN1HEX,n=t.getChildIdx,r=t.getV,i={};if("30"!=e.substr(0,2))throw"malformed RSA key(code:001)";var o=n(e,0);if(2!=o.length)throw"malformed RSA key(code:002)";if("02"!=e.substr(o[0],2))throw"malformed RSA key(code:003)";if(i.n=r(e,o[0]),"02"!=e.substr(o[1],2))throw"malformed RSA key(code:004)";return i.e=r(e,o[1]),i},parsePublicPKCS8Hex:function(e){var t=ASN1HEX,n=t.getChildIdx,r=t.getV,i={algparam:null},o=n(e,0);if(2!=o.length)throw"outer DERSequence shall have 2 elements: "+o.length;var a=o[0];if("30"!=e.substr(a,2))throw"malformed PKCS8 public key(code:001)";var s=n(e,a);if(2!=s.length)throw"malformed PKCS8 public key(code:002)";if("06"!=e.substr(s[0],2))throw"malformed PKCS8 public key(code:003)";if(i.algoid=r(e,s[0]),"06"==e.substr(s[1],2)?i.algparam=r(e,s[1]):"30"==e.substr(s[1],2)&&(i.algparam={},i.algparam.p=t.getVbyList(e,s[1],[0],"02"),i.algparam.q=t.getVbyList(e,s[1],[1],"02"),i.algparam.g=t.getVbyList(e,s[1],[2],"02")),"03"!=e.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return i.key=r(e,o[1]).substr(2),i}}}();KEYUTIL.getKey=function(e,t,n){var r=(v=ASN1HEX).getChildIdx;v.getV;var i=v.getVbyList,o=KJUR.crypto,a=o.ECDSA,s=o.DSA,c=RSAKey,l=pemtohex,u=KEYUTIL;if(void 0!==c&&e instanceof c)return e;if(void 0!==a&&e instanceof a)return e;if(void 0!==s&&e instanceof s)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new a({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new a({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(M=new c).setPublic(e.n,e.e),M;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(M=new c).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),M;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(M=new c).setPrivate(e.n,e.e,e.d),M;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(M=new s).setPublic(e.p,e.q,e.g,e.y),M;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(M=new s).setPrivate(e.p,e.q,e.g,e.y,e.x),M;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(M=new c).setPublic(b64utohex(e.n),b64utohex(e.e)),M;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(M=new c).setPrivateEx(b64utohex(e.n),b64utohex(e.e),b64utohex(e.d),b64utohex(e.p),b64utohex(e.q),b64utohex(e.dp),b64utohex(e.dq),b64utohex(e.qi)),M;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(M=new c).setPrivate(b64utohex(e.n),b64utohex(e.e),b64utohex(e.d)),M;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var p=(w=new a({curve:e.crv})).ecparams.keylen/4,d="04"+("0000000000"+b64utohex(e.x)).slice(-p)+("0000000000"+b64utohex(e.y)).slice(-p);return w.setPublicKeyHex(d),w}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){p=(w=new a({curve:e.crv})).ecparams.keylen/4,d="04"+("0000000000"+b64utohex(e.x)).slice(-p)+("0000000000"+b64utohex(e.y)).slice(-p);var h=("0000000000"+b64utohex(e.d)).slice(-p);return w.setPublicKeyHex(d),w.setPrivateKeyHex(h),w}if("pkcs5prv"===n){var f,m=e,v=ASN1HEX;if(9===(f=r(m,0)).length)(M=new c).readPKCS5PrvKeyHex(m);else if(6===f.length)(M=new s).readPKCS5PrvKeyHex(m);else{if(!(f.length>2&&"04"===m.substr(f[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(M=new a).readPKCS5PrvKeyHex(m)}return M}if("pkcs8prv"===n)return M=u.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===n)return u._getKeyFromPublicPKCS8Hex(e);if("x509pub"===n)return X509.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return X509.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var A=pemtohex(e,"PUBLIC KEY");return u._getKeyFromPublicPKCS8Hex(A)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var g=l(e,"RSA PRIVATE KEY");return u.getKey(g,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var y=i(I=l(e,"DSA PRIVATE KEY"),0,[1],"02"),b=i(I,0,[2],"02"),E=i(I,0,[3],"02"),_=i(I,0,[4],"02"),T=i(I,0,[5],"02");return(M=new s).setPrivate(new BigInteger(y,16),new BigInteger(b,16),new BigInteger(E,16),new BigInteger(_,16),new BigInteger(T,16)),M}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){g=l(e,"EC PRIVATE KEY");return u.getKey(g,null,"pkcs5prv")}if(-1!=e.indexOf("-END PRIVATE KEY-"))return u.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var x=u.getDecryptedKeyHex(e,t),R=new RSAKey;return R.readPKCS5PrvKeyHex(x),R}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var w,M=i(I=u.getDecryptedKeyHex(e,t),0,[1],"04"),S=i(I,0,[2,0],"06"),C=i(I,0,[3,0],"03").substr(2);if(void 0===KJUR.crypto.OID.oidhex2name[S])throw"undefined OID(hex) in KJUR.crypto.OID: "+S;return(w=new a({curve:KJUR.crypto.OID.oidhex2name[S]})).setPublicKeyHex(C),w.setPrivateKeyHex(M),w.isPublic=!1,w}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var I;y=i(I=u.getDecryptedKeyHex(e,t),0,[1],"02"),b=i(I,0,[2],"02"),E=i(I,0,[3],"02"),_=i(I,0,[4],"02"),T=i(I,0,[5],"02");return(M=new s).setPrivate(new BigInteger(y,16),new BigInteger(b,16),new BigInteger(E,16),new BigInteger(_,16),new BigInteger(T,16)),M}if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return u.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},void 0!==KJUR.asn1&&KJUR.asn1||(KJUR.asn1={}),KJUR.asn1.ASN1Util={},KJUR.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",n=parseInt(e.substr(0,2),16),r=(t=Math.floor(n/40)+"."+n%40,""),i=2;i<e.length;i+=2){var o=("00000000"+parseInt(e.substr(i,2),16).toString(2)).slice(-8);if(r+=o.substr(1,7),"0"==o.substr(0,1))t=t+"."+new BigInteger(r,2).toString(10),r=""}return t};var ASN1HEX=new function(){};function _rsasign_getAlgNameAndHashFromHexDisgestInfo(e){for(var t in KJUR.crypto.Util.DIGESTINFOHEAD){var n=KJUR.crypto.Util.DIGESTINFOHEAD[t],r=n.length;if(e.substring(0,r)==n)return[t,e.substring(r)]}return[]}function X509(e){var t,n=ASN1HEX,r=n.getChildIdx,i=n.getV,o=n.getTLV,a=n.getVbyList,s=n.getVbyListEx,c=n.getTLVbyList,l=n.getTLVbyListEx,u=n.getIdxbyList,p=n.getIdxbyListEx,d=n.getVidx,h=n.getInt,f=n.oidname,m=n.hextooidstr,v=pemtohex;try{t=KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(A){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var e=c(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=c(e,0,[0]),n=h(t,0);if(n<0||2<n)throw new Error("malformed version field");return this.version=n+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return s(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=l(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var n in t)if(e===t[n])return n;return f(s(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return c(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return c(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=a(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getNotAfter=function(){var e=a(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getPublicKeyHex=function(){return n.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return u(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return u(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return KEYUTIL.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=c(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),r=c(this.hex,0,[0],"30"),i=new KJUR.crypto.Signature({alg:t});return i.init(e),i.updateHex(r),i.verify(n)},this.parseExt=function(e){var t,o,s;if(void 0===e){if(s=this.hex,3!==this.version)return-1;t=u(s,0,[0,7,0],"30"),o=r(s,t)}else{s=pemtohex(e);var c=u(s,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(s,c))return void(this.aExtInfo=new Array);t=u(s,0,[0,3,0,1,0],"30"),o=r(s,t),this.hex=s}this.aExtInfo=new Array;for(var l=0;l<o.length;l++){var p={critical:!1},h=0;3===r(s,o[l]).length&&(p.critical=!0,h=1),p.oid=n.hextooidstr(a(s,o[l],[0],"06"));var f=u(s,o[l],[1+h]);p.vidx=d(s,f),this.aExtInfo.push(p)}},this.getExtInfo=function(e){var t=this.aExtInfo,n=e;if(e.match(/^[0-9.]+$/)||(n=KJUR.asn1.x509.OID.name2oid(e)),""!==n)for(var r=0;r<t.length;r++)if(t[r].oid===n)return t[r]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("basicConstraints");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var r={extname:"basicConstraints"};if(t&&(r.critical=!0),"3000"===e)return r;if("30030101ff"===e)return r.cA=!0,r;if("30060101ff02"===e.substr(0,12)){var a=i(e,10),s=parseInt(a,16);return r.cA=!0,r.pathLen=s,r}throw new Error("hExtV parse error: "+e)},this.getExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("keyUsage");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var r={extname:"keyUsage"};return t&&(r.critical=!0),r.names=this.getExtKeyUsageString(e).split(","),r},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=o(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var n="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(n=n.slice(-8)),10==e.length&&(n=n.slice(-16)),""==(n=n.replace(/0+$/,""))&&(n="0"),n},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),n=new Array,r=0;r<t.length;r++)"1"==t.substr(r,1)&&n.push(X509.KEYUSAGE_NAME[r]);return n.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("subjectKeyIdentifier");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var r={extname:"subjectKeyIdentifier"};t&&(r.critical=!0);var a=i(e,0);return r.kid={hex:a},r},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("authorityKeyIdentifier");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var a={extname:"authorityKeyIdentifier"};t&&(a.critical=!0);for(var s=r(e,0),c=0;c<s.length;c++){var l=e.substr(s[c],2);if("80"===l&&(a.kid={hex:i(e,s[c])}),"a1"===l){var u=o(e,s[c]),p=this.getGeneralNames(u);a.issuer=p[0].dn}"82"===l&&(a.sn={hex:i(e,s[c])})}return a},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("extKeyUsage");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var a={extname:"extKeyUsage",array:[]};t&&(a.critical=!0);for(var s=r(e,0),c=0;c<s.length;c++)a.array.push(f(i(e,s[c])));return a},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,n=o(this.hex,e.vidx);if(""===n)return t;for(var a=r(n,0),s=0;s<a.length;s++)t.push(f(i(n,a[s])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("subjectAltName");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var r={extname:"subjectAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("issuerAltName");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var r={extname:"issuerAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getGeneralNames=function(e){for(var t=r(e,0),n=[],i=0;i<t.length;i++){var a=this.getGeneralName(o(e,t[i]));void 0!==a&&n.push(a)}return n},this.getGeneralName=function(e){var t=e.substr(0,2),n=i(e,0),r=hextorstr(n);return"81"==t?{rfc822:r}:"82"==t?{dns:r}:"86"==t?{uri:r}:"87"==t?{ip:hextoip(n)}:"a4"==t?{dn:this.getX500Name(n)}:void 0},this.getExtSubjectAltName2=function(){var e,t,n,a=this.getExtInfo("subjectAltName");if(void 0===a)return a;for(var s=new Array,c=o(this.hex,a.vidx),l=r(c,0),u=0;u<l.length;u++)n=c.substr(l[u],2),e=i(c,l[u]),"81"===n&&(t=hextoutf8(e),s.push(["MAIL",t])),"82"===n&&(t=hextoutf8(e),s.push(["DNS",t])),"84"===n&&(t=X509.hex2dn(e,0),s.push(["DN",t])),"86"===n&&(t=hextoutf8(e),s.push(["URI",t])),"87"===n&&(t=hextoip(e),s.push(["IP",t]));return s},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("cRLDistributionPoints");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var i={extname:"cRLDistributionPoints",array:[]};t&&(i.critical=!0);for(var a=r(e,0),s=0;s<a.length;s++){var c=o(e,a[s]);i.array.push(this.getDistributionPoint(c))}return i},this.getDistributionPoint=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var a=e.substr(n[i],2),s=o(e,n[i]);"a0"==a&&(t.dpname=this.getDistributionPointName(s))}return t},this.getDistributionPointName=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var a=e.substr(n[i],2),s=o(e,n[i]);"a0"==a&&(t.full=this.getGeneralNames(s))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtInfo("cRLDistributionPoints");if(void 0===e)return e;for(var t=new Array,n=r(this.hex,e.vidx),i=0;i<n.length;i++)try{var o=hextoutf8(a(this.hex,n[i],[0,0,0],"86"));t.push(o)}catch(s){}return t},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},n=r(this.hex,e.vidx),i=0;i<n.length;i++){var o=a(this.hex,n[i],[0],"06"),s=a(this.hex,n[i],[1],"86");"2b06010505073001"===o&&t.ocsp.push(hextoutf8(s)),"2b06010505073002"===o&&t.caissuer.push(hextoutf8(s))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("authorityInfoAccess");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var i={extname:"authorityInfoAccess",array:[]};t&&(i.critical=!0);for(var c=r(e,0),l=0;l<c.length;l++){var u=s(e,c[l],[0],"06"),p=hextoutf8(a(e,c[l],[1],"86"));if("2b06010505073001"==u)i.array.push({ocsp:p});else{if("2b06010505073002"!=u)throw new Error("unknown method: "+u);i.array.push({caissuer:p})}}return i},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("certificatePolicies");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var i={extname:"certificatePolicies",array:[]};t&&(i.critical=!0);for(var a=r(e,0),s=0;s<a.length;s++){var c=o(e,a[s]),l=this.getPolicyInformation(c);i.array.push(l)}return i},this.getPolicyInformation=function(e){var t={},n=a(e,0,[0],"06");t.policyoid=f(n);var i=p(e,0,[1],"30");if(-1!=i){t.array=[];for(var s=r(e,i),c=0;c<s.length;c++){var l=o(e,s[c]),u=this.getPolicyQualifierInfo(l);t.array.push(u)}}return t},this.getPolicyQualifierInfo=function(e){var t={},n=a(e,0,[0],"06");if("2b06010505070201"===n){var r=s(e,0,[1],"16");t.cps=hextorstr(r)}else if("2b06010505070202"===n){var i=c(e,0,[1],"30");t.unotice=this.getUserNotice(i)}return t},this.getUserNotice=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var a=o(e,n[i]);"30"!=a.substr(0,2)&&(t.exptext=this.getDisplayText(a))}return t},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=hextorstr(i(e,0)),t},this.getExtCRLNumber=function(e,t){var n={extname:"cRLNumber"};if(t&&(n.critical=!0),"02"==e.substr(0,2))return n.num={hex:i(e,0)},n;throw new Error("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var n={extname:"cRLReason"};if(t&&(n.critical=!0),"0a"==e.substr(0,2))return n.code=parseInt(i(e,0),16),n;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var n={extname:"ocspNonce"};t&&(n.critical=!0);var r=i(e,0);return n.hex=r,n},this.getExtOcspNoCheck=function(e,t){var n={extname:"ocspNoCheck"};return t&&(n.critical=!0),n},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("adobeTimeStamp");if(void 0===n)return;e=o(this.hex,n.vidx),t=n.critical}var i={extname:"adobeTimeStamp"};t&&(i.critical=!0);var a=r(e,0);if(a.length>1){var s=o(e,a[1]),c=this.getGeneralName(s);null!=c.uri&&(i.uri=c.uri)}if(a.length>2){var l=o(e,a[2]);"0101ff"==l&&(i.reqauth=!0),"010100"==l&&(i.reqauth=!1)}return i},this.getX500NameRule=function(e){for(var t=null,n=[],r=0;r<e.length;r++)for(var i=e[r],o=0;o<i.length;o++)n.push(i[o]);for(r=0;r<n.length;r++){var a=n[r],s=a.ds,c=a.value,l=a.type;if("prn"!=s&&"utf8"!=s&&"ia5"!=s)return"mixed";if("ia5"==s){if("CN"!=l)return"mixed";if(KJUR.lang.String.isMail(c))continue;return"mixed"}if("C"==l){if("prn"==s)continue;return"mixed"}if(null==t)t=s;else if(t!==s)return"mixed"}return null==t?"prn":t},this.getX500Name=function(e){var t=this.getX500NameArray(e);return{array:t,str:this.dnarraytostr(t)}},this.getX500NameArray=function(e){for(var t=[],n=r(e,0),i=0;i<n.length;i++)t.push(this.getRDN(o(e,n[i])));return t},this.getRDN=function(e){for(var t=[],n=r(e,0),i=0;i<n.length;i++)t.push(this.getAttrTypeAndValue(o(e,n[i])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},n=r(e,0),i=a(e,n[0],[],"06"),o=a(e,n[1],[]),s=KJUR.asn1.ASN1Util.oidHexToInt(i);return t.type=KJUR.asn1.x509.OID.oid2atype(s),t.ds=this.HEX2STAG[e.substr(n[1],2)],"bmp"!=t.ds?t.value=hextoutf8(o):t.value=ucs2hextoutf8(o),t},this.readCertPEM=function(e){this.readCertHex(v(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{u(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getParam=function(){var e={};return e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(),e.sbjpubkey=hextopem(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&(-1!=p(this.hex,0,[0,"[3]"])&&(e=l(this.hex,0,[0,"[3]",0],"30")));for(var t=[],n=r(e,0),i=0;i<n.length;i++){var a=o(e,n[i]),s=this.getExtParam(a);null!=s&&t.push(s)}return t},this.getExtParam=function(e){var t=r(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var n=m(a(e,0,[0],"06")),i=!1;3==t&&"0101ff"==c(e,0,[1])&&(i=!0);var o=c(e,0,[t-1,0]),s=void 0;if("2.5.29.14"==n?s=this.getExtSubjectKeyIdentifier(o,i):"2.5.29.15"==n?s=this.getExtKeyUsage(o,i):"2.5.29.17"==n?s=this.getExtSubjectAltName(o,i):"2.5.29.18"==n?s=this.getExtIssuerAltName(o,i):"2.5.29.19"==n?s=this.getExtBasicConstraints(o,i):"2.5.29.31"==n?s=this.getExtCRLDistributionPoints(o,i):"2.5.29.32"==n?s=this.getExtCertificatePolicies(o,i):"2.5.29.35"==n?s=this.getExtAuthorityKeyIdentifier(o,i):"2.5.29.37"==n?s=this.getExtExtKeyUsage(o,i):"1.3.6.1.5.5.7.1.1"==n?s=this.getExtAuthorityInfoAccess(o,i):"2.5.29.20"==n?s=this.getExtCRLNumber(o,i):"2.5.29.21"==n?s=this.getExtCRLReason(o,i):"1.3.6.1.5.5.7.48.1.2"==n?s=this.getExtOcspNonce(o,i):"1.3.6.1.5.5.7.48.1.5"==n?s=this.getExtOcspNoCheck(o,i):"1.2.840.113583.1.1.9.1"==n&&(s=this.getExtAdobeTimeStamp(o,i)),null!=s)return s;var l={extname:n,extn:o};return i&&(l.critical=!0),l},this.findExt=function(e,t){for(var n=0;n<e.length;n++)if(e[n].extname==t)return e[n];return null},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var e,t,n,r,i=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];if(t+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var o=0;o<i.array.length;o++){var a=i.array[o];void 0!==a.cps&&(t+=" cps: "+a.cps+"\n")}}return t},o=function(e){for(var t="",n=e.array,i=0;i<n.length;i++){var o=n[i];try{void 0!==o.dpname.full[0].uri&&(t+=" "+o.dpname.full[0].uri+"\n")}catch(r){}try{void 0!==o.dname.full[0].dn.hex&&(t+=" "+X509.hex2dn(o.dpname.full[0].dn.hex)+"\n")}catch(r){}}return t},a=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];void 0!==i.caissuer&&(t+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(t+=" ocsp: "+i.ocsp+"\n")}return t};if(e="Basic Fields\n",e+=" serial number: "+this.getSerialNumberHex()+"\n",e+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+=" issuer: "+this.getIssuerString()+"\n",e+=" notBefore: "+this.getNotBefore()+"\n",e+=" notAfter: "+this.getNotAfter()+"\n",e+=" subject: "+this.getSubjectString()+"\n",e+=" subject public key info: \n",e+=" key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+=" n="+hextoposhex(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+hextoposhex(t.e.toString(16))+"\n"),null!=(n=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var s=0;s<n.length;s++){var c=n[s],l=KJUR.asn1.x509.OID.oid2name(c.oid);""===l&&(l=c.oid);var u="";if(!0===c.critical&&(u="CRITICAL"),e+=" "+l+" "+u+":\n","basicConstraints"===l){var p=this.getExtBasicConstraints();void 0===p.cA?e+=" {}\n":(e+=" cA=true",void 0!==p.pathLen&&(e+=", pathLen="+p.pathLen),e+="\n")}else if("keyUsage"===l)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===l)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===l){var d=this.getExtAuthorityKeyIdentifier();void 0!==d.kid&&(e+=" kid="+d.kid.hex+"\n")}else{if("extKeyUsage"===l)e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===l)e+=" "+(r=this.getExtSubjectAltName(),JSON.stringify(r.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===l)e+=o(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===l)e+=a(this.getExtAuthorityInfoAccess());else"certificatePolicies"===l&&(e+=i(this.getExtCertificatePolicies()))}}}return e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",e+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):KJUR.lang.String.isHex(e)&&this.readCertHex(e))}function sha256(e){return CryptoJS.SHA256(e).toString()}ASN1HEX.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var n=parseInt(e.substr(t+3,1));return 0==n?-1:0<n&&n<10?n+1:-2},ASN1HEX.getL=function(e,t){var n=ASN1HEX.getLblen(e,t);return n<1?"":e.substr(t+2,2*n)},ASN1HEX.getVblen=function(e,t){var n;return""==(n=ASN1HEX.getL(e,t))?-1:("8"===n.substr(0,1)?new BigInteger(n.substr(2),16):new BigInteger(n,16)).intValue()},ASN1HEX.getVidx=function(e,t){var n=ASN1HEX.getLblen(e,t);return n<0?n:t+2*(n+1)},ASN1HEX.getV=function(e,t){var n=ASN1HEX.getVidx(e,t),r=ASN1HEX.getVblen(e,t);return e.substr(n,2*r)},ASN1HEX.getTLV=function(e,t){return e.substr(t,2)+ASN1HEX.getL(e,t)+ASN1HEX.getV(e,t)},ASN1HEX.getTLVblen=function(e,t){return 2+2*ASN1HEX.getLblen(e,t)+2*ASN1HEX.getVblen(e,t)},ASN1HEX.getNextSiblingIdx=function(e,t){return ASN1HEX.getVidx(e,t)+2*ASN1HEX.getVblen(e,t)},ASN1HEX.getChildIdx=function(e,t){var n,r,i,o=ASN1HEX,a=[];n=o.getVidx(e,t),r=2*o.getVblen(e,t),"03"==e.substr(t,2)&&(n+=2,r-=2),i=0;for(var s=n;i<=r;){var c=o.getTLVblen(e,s);if((i+=c)<=r&&a.push(s),s+=c,i>=r)break}return a},ASN1HEX.getNthChildIdx=function(e,t,n){return ASN1HEX.getChildIdx(e,t)[n]},ASN1HEX.getIdxbyList=function(e,t,n,r){var i,o,a=ASN1HEX;return 0==n.length?void 0!==r&&e.substr(t,2)!==r?-1:t:(i=n.shift())>=(o=a.getChildIdx(e,t)).length?-1:a.getIdxbyList(e,o[i],n,r)},ASN1HEX.getIdxbyListEx=function(e,t,n,r){var i,o,a=ASN1HEX;if(0==n.length)return void 0!==r&&e.substr(t,2)!==r?-1:t;i=n.shift(),o=a.getChildIdx(e,t);for(var s=0,c=0;c<o.length;c++){var l=e.substr(o[c],2);if("number"==typeof i&&!a.isContextTag(l)&&s==i||"string"==typeof i&&a.isContextTag(l,i))return a.getIdxbyListEx(e,o[c],n,r);a.isContextTag(l)||s++}return-1},ASN1HEX.getTLVbyList=function(e,t,n,r){var i=ASN1HEX,o=i.getIdxbyList(e,t,n,r);return-1==o||o>=e.length?null:i.getTLV(e,o)},ASN1HEX.getTLVbyListEx=function(e,t,n,r){var i=ASN1HEX,o=i.getIdxbyListEx(e,t,n,r);return-1==o?null:i.getTLV(e,o)},ASN1HEX.getVbyList=function(e,t,n,r,i){var o,a,s=ASN1HEX;return-1==(o=s.getIdxbyList(e,t,n,r))||o>=e.length?null:(a=s.getV(e,o),!0===i&&(a=a.substr(2)),a)},ASN1HEX.getVbyListEx=function(e,t,n,r,i){var o,a,s=ASN1HEX;return-1==(o=s.getIdxbyListEx(e,t,n,r))?null:(a=s.getV(e,o),"03"==e.substr(o,2)&&!1!==i&&(a=a.substr(2)),a)},ASN1HEX.getInt=function(e,t,n){null==n&&(n=-1);try{var r=e.substr(t,2);if("02"!=r&&"03"!=r)return n;var i=ASN1HEX.getV(e,t);return"02"==r?parseInt(i,16):bitstrtoint(i)}catch(o){return n}},ASN1HEX.getOID=function(e,t,n){null==n&&(n=null);try{return"06"!=e.substr(t,2)?n:hextooid(ASN1HEX.getV(e,t))}catch(r){return n}},ASN1HEX.getOIDName=function(e,t,n){null==n&&(n=null);try{var r=ASN1HEX.getOID(e,t,n);if(r==n)return n;var i=KJUR.asn1.x509.OID.oid2name(r);return""==i?r:i}catch(o){return n}},ASN1HEX.getString=function(e,t,n){null==n&&(n=null);try{return hextorstr(ASN1HEX.getV(e,t))}catch(r){return n}},ASN1HEX.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},n=[],r=e.substr(0,2),i=parseInt(r,16);n[0]=new String(Math.floor(i/40)),n[1]=new String(i%40);for(var o=e.substr(2),a=[],s=0;s<o.length/2;s++)a.push(parseInt(o.substr(2*s,2),16));var c=[],l="";for(s=0;s<a.length;s++)128&a[s]?l+=t((127&a[s]).toString(2),7):(l+=t((127&a[s]).toString(2),7),c.push(new String(parseInt(l,2))),l="");var u=n.join(".");return c.length>0&&(u=u+"."+c.join(".")),u},ASN1HEX.isContextTag=function(e,t){var n,r;e=e.toLowerCase();try{n=parseInt(e,16)}catch(i){return-1}if(void 0===t)return 128==(192&n);try{return null!=t.match(/^\[[0-9]+\]$/)&&(!((r=parseInt(t.substr(1,t.length-1),10))>31)&&(128==(192&n)&&(31&n)==r))}catch(i){return!1}},ASN1HEX.isASN1HEX=function(e){var t=ASN1HEX;if(e.length%2==1)return!1;var n=t.getVblen(e,0),r=e.substr(0,2),i=t.getL(e,0);return e.length-r.length-i.length==2*n},ASN1HEX.checkStrictDER=function(e,t,n,r,i){var o=ASN1HEX;if(void 0===n){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!KJUR.lang.String.isHex(e))throw new Error("not hex string");n=e.length,i=(r=e.length/2)<128?1:Math.ceil(r.toString(16))+1}if(o.getL(e,t).length>2*i)throw new Error("L of TLV too long: idx="+t);var a=o.getVblen(e,t);if(a>r)throw new Error("value of L too long than hex: idx="+t);var s=o.getTLV(e,t),c=s.length-2-o.getL(e,t).length;if(c!==2*a)throw new Error("V string length and L's value not the same:"+c+"/"+2*a);if(0===t&&e.length!=s.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+s.length);var l=e.substr(t,2);if("02"===l){var u=o.getVidx(e,t);if("00"==e.substr(u,2)&&e.charCodeAt(u+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(l,16)){for(var p=o.getVblen(e,t),d=0,h=o.getChildIdx(e,t),f=0;f<h.length;f++){d+=o.getTLV(e,h[f]).length,o.checkStrictDER(e,h[f],n,r,i)}if(2*p!=d)throw new Error("sum of children's TLV length and L unmatch: "+2*p+"!="+d)}},ASN1HEX.oidname=function(e){var t=KJUR.asn1;KJUR.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var n=t.x509.OID.oid2name(e);return""===n&&(n=e),n},void 0!==KJUR.asn1&&KJUR.asn1||(KJUR.asn1={}),void 0!==KJUR.asn1.x509&&KJUR.asn1.x509||(KJUR.asn1.x509={}),KJUR.asn1.x509.AlgorithmIdentifier={},KJUR.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},KJUR.asn1.x509.OID=new function(e){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var t=this.name2oidList[e],n=new KJUR.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var t;if(e.match(/^\d+\.\d+\.[0-9.]+$/))t=e;else if(void 0!==this.atype2oidList[e])t=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw"AttributeType name undefined: "+e;t=this.name2oidList[e]}var n=new KJUR.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n}},KJUR.asn1.x509.OID.oid2name=function(e){var t=KJUR.asn1.x509.OID.name2oidList;for(var n in t)if(t[n]==e)return n;return""},KJUR.asn1.x509.OID.oid2atype=function(e){var t=KJUR.asn1.x509.OID.atype2oidList;for(var n in t)if(t[n]==e)return n;return e},KJUR.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=KJUR.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},RSAKey.getPosArrayOfChildrenFromHex=function(e){return ASN1HEX.getChildIdx(e,0)},RSAKey.getHexValueArrayOfChildrenFromHex=function(e){var t,n=ASN1HEX.getV,r=n(e,(t=RSAKey.getPosArrayOfChildrenFromHex(e))[0]),i=n(e,t[1]),o=n(e,t[2]),a=n(e,t[3]),s=n(e,t[4]),c=n(e,t[5]),l=n(e,t[6]),u=n(e,t[7]),p=n(e,t[8]);return(t=new Array).push(r,i,o,a,s,c,l,u,p),t},RSAKey.prototype.readPrivateKeyFromPEMString=function(e){var t=pemtohex(e),n=RSAKey.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},RSAKey.prototype.readPKCS5PrvKeyHex=function(e){var t=RSAKey.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},RSAKey.prototype.readPKCS8PrvKeyHex=function(e){var t,n,r,i,o,a,s,c,l=ASN1HEX,u=l.getVbyListEx;if(!1===l.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=u(e,0,[2,0,1],"02"),n=u(e,0,[2,0,2],"02"),r=u(e,0,[2,0,3],"02"),i=u(e,0,[2,0,4],"02"),o=u(e,0,[2,0,5],"02"),a=u(e,0,[2,0,6],"02"),s=u(e,0,[2,0,7],"02"),c=u(e,0,[2,0,8],"02")}catch(p){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,n,r,i,o,a,s,c)},RSAKey.prototype.readPKCS5PubKeyHex=function(e){var t=ASN1HEX,n=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(e,0);if(2!==r.length||"02"!==e.substr(r[0],2)||"02"!==e.substr(r[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=n(e,r[0]),o=n(e,r[1]);this.setPublic(i,o)},RSAKey.prototype.readPKCS8PubKeyHex=function(e){var t=ASN1HEX;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var n=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(n)},RSAKey.prototype.readCertPubKeyHex=function(e,t){var n,r;(n=new X509).readCertHex(e),r=n.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)},RSAKey.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var n=parseBigInt(t,16),r=this.n.bitLength();if(n.bitLength()>r)return!1;var i=this.doPublic(n).toString(16);if(i.length+3!=r/4)return!1;var o=_rsasign_getAlgNameAndHashFromHexDisgestInfo(i.replace(/^1f+00/,""));if(0==o.length)return!1;var a,s=o[0];return o[1]==(a=e,KJUR.crypto.Util.hashString(a,s))},RSAKey.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var n=parseBigInt(t,16);if(n.bitLength()>this.n.bitLength())return 0;var r=_rsasign_getAlgNameAndHashFromHexDisgestInfo(this.doPublic(n).toString(16).replace(/^1f+00/,""));return 0!=r.length&&(r[0],r[1]==e)},RSAKey.prototype.verifyPSS=function(e,t,n,r){var i,o=(i=rstrtohex(e),KJUR.crypto.Util.hashHex(i,n));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(o,t,n,r)},RSAKey.prototype.verifyWithMessageHashPSS=function(e,t,n,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,o=new BigInteger(t,16),a=function(e){return KJUR.crypto.Util.hashHex(e,n)},s=hextorstr(e),c=s.length,l=this.n.bitLength()-1,u=Math.ceil(l/8);if(-1===r||void 0===r)r=c;else if(-2===r)r=u-c-2;else if(r<-2)throw new Error("invalid salt length");if(u<c+r+2)throw new Error("data too long");var p=this.doPublic(o).toByteArray();for(i=0;i<p.length;i+=1)p[i]&=255;for(;p.length<u;)p.unshift(0);if(188!==p[u-1])throw new Error("encoded message does not end in 0xbc");var d=(p=String.fromCharCode.apply(String,p)).substr(0,u-c-1),h=p.substr(d.length,c),f=65280>>8*u-l&255;if(0!=(d.charCodeAt(0)&f))throw new Error("bits beyond keysize not zero");var m=pss_mgf1_str(h,d.length,a),v=[];for(i=0;i<d.length;i+=1)v[i]=d.charCodeAt(i)^m.charCodeAt(i);v[0]&=~f;var A=u-c-r-2;for(i=0;i<A;i+=1)if(0!==v[i])throw new Error("leftmost octets not zero");if(1!==v[A])throw new Error("0x01 marker not found");return h===hextorstr(a(rstrtohex("\0\0\0\0\0\0\0\0"+s+String.fromCharCode.apply(String,v.slice(-r)))))},RSAKey.SALT_LEN_HLEN=-1,RSAKey.SALT_LEN_MAX=-2,RSAKey.SALT_LEN_RECOVER=-2,X509.hex2dn=function(e,t){void 0===t&&(t=0);var n=new X509;return ASN1HEX.getTLV(e,t),n.getX500Name(e).str},X509.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var n=new Array,r=ASN1HEX.getChildIdx(e,t),i=0;i<r.length;i++)n.push(X509.hex2attrTypeValue(e,r[i]));return(n=n.map((function(e){return e.replace("+","\\+")}))).join("+")},X509.hex2attrTypeValue=function(e,t){var n=ASN1HEX,r=n.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var i=n.getChildIdx(e,t);2!==i.length||e.substr(i[0],2);var o=r(e,i[0]),a=KJUR.asn1.ASN1Util.oidHexToInt(o);return KJUR.asn1.x509.OID.oid2atype(a)+"="+hextorstr(r(e,i[1]))},X509.getPublicKeyFromCertHex=function(e){var t=new X509;return t.readCertHex(e),t.getPublicKey()},X509.getPublicKeyFromCertPEM=function(e){var t=new X509;return t.readCertPEM(e),t.getPublicKey()},X509.getPublicKeyInfoPropOfCertPEM=function(e){var t,n,r=ASN1HEX.getVbyList,i={};return i.algparam=null,(t=new X509).readCertPEM(e),n=t.getPublicKeyHex(),i.keyhex=r(n,0,[1],"03").substr(2),i.algoid=r(n,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=r(n,0,[0,1],"06")),i},X509.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var certificates=[(x509=new X509,x509.readCertPEM(function(){return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}(":::::ORTV[-PR_aVSVPNaR:::::ZVVS@\tPPNErtNVONtVWNZR}@]nU\0ZaZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`V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ZOt[cU_ZROaNQN^U<ZN=TP`\0T`Vo@Q^ROPbNNAVPN^P\0{y\0Bs\\8\0R[z]w??qZP?NpgdenSuvv?>|f_?UpYPcQ\\gCb8zxtSvsOQNg>[\\\0\bx\b_o@8\0g`Z<PyUE`8yu}\\g{@`s`zUgErRtve{YdCvoO@>WFDtABNp\0feUWszpQaEYNAc]^xB[@]BDAN8\b}XA=EnO}Pud8TA\t?yPrVv{\\>E]o`BO^RE^X[W[rEU?x\bf>V\tOUwY=>X[\\E`tW[8}VwpFBQcnrPF}yUtd8<Doe_\b[oOVUep@pYY\0cegY{r\t?\bAbq?ff8}UaXoN_D]_X_8yozYFT`N{`\\{zvu?\bDWT}=_<StX\tNx\0\b\t\0aT=c@ucnWfR[vf>RFxAFV}{N`dN^\\<eawBPxx}quT=|{T_R@Fp^Y<ZevRsWaZ]V\tCVrRVtAAc[\tQp|d|tqoQ=T|XX\t=u\\N8XNCx\\aU>wz\tX<e@Vc?dy\\|^FEq|=p`pBdF@bs^d<]vp\\^TZ\tP\bZ\b\\YNNSZ_\\w^|TsD8db\t_\tY\\o^Cw>Z\0x\\^aN]wWf\bA}\tC^d_{ZC@\by]gY@E\tBFY?OsaqbDcVgQbZeFc\tovtucxnq|<TnuyXRveYFOegCpAs{YTe|>bE<OXsSqCBWD_SVepfvCCUg]z\tZvQ[\0s|U>pFz\b=OwT``fNJJ:::::R[Q-PR_aVSVPNaR:::::")),x509)],x509;function getCertificateBySubjectHex(e,t){for(var n=0,r=t;n<r.length;n++){var i=r[n];if(i.getSubjectHex()===e)return i}}function verifyCertificate_(e,t){var n=e.getIssuerHex();if(n===e.getSubjectHex())return e.verifySignature(e.getPublicKey());var r=getCertificateBySubjectHex(n,t);return!!r&&(!1!==e.verifySignature(r.getPublicKey())&&verifyCertificate_(r,t))}function verifyCertificate(e){return e.getIssuerHex()!==e.getSubjectHex()&&verifyCertificate_(e,certificates)}function addCertificate(e){var t=new X509;"string"==typeof e?t.readCertPEM(e):t.readCertHex(e.hex);var n=verifyCertificate(t);return certificates.push(t),n}function verifyMessage(e,t,n){var r=new X509;if("string"==typeof n?r.readCertPEM(n):r.readCertHex(n.hex),!1===verifyCertificate(r))return!1;var i=new RSAKey;return i.readCertPubKeyHex(r.hex,6),!!i.verify(e,b64tohex(t))}addCertificate(function(){return arguments[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}(":::::ORTV[-PR_aVSVPNaR:::::ZVVTU\tPPONrtNVONtVWNW=_SVw\tVE=ZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\bZQNAZaN\\aZ\t[QSnS=\b[aNBZQZ\\aZ\t[QSnZVTaZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tRbZOVTN>bRPtYoTyuoz}}f`Bwo?=RQN\\Ot[cONZO>Wyfd\tgdbRaN]Ot[cONZZPRuupz_@feWyZ`bVfWX|gVup[N^xOSugnec|fdyndB{^T}fdB\0ndRf?FZVVPVwN[Otx\0uxvTF=ON^RSNN\\PNtENZVVPPtXPNtRN?=?]q[VD|{\\oyo`oOu}F\tSAe`tn[t\tu\b8^a]qx\bE_^ZN?[QC\0yuOpybY8r\\RPAS=8rUq\0E8>xean^e\bf]Y`XO}{C[Ur^?\0x[SRXvVQ\\CFr}QnAPRQFO=Yw\0_TePCOFV@|N>ROXcDrT<>bW<ssO?NOT{^s]uU\0gS\bBffsfE\0AfDyQEZR`]XBo|Qw}yYdwwTvOFcBndUz^\\{]\tb=^yQYSTQ`]\0?tR{WRUun\\\0bVe_E|VWWV|r\tAo\0\tF`fdzCnRtq\br\t\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@}CxWVTUsAYdNd?{APQr8{P]]AZ>aR\0[D<z?Tr@`u@X|YDwd_<p<>zWE>]\0=X`\b@uucp|^_Qb@uZouTX^o\0\\{PCq{ug8^f[YQAWad8FNqxFQE?ZOo\t}RnO\bsQc\txyccn=nxvs>bDBf\b\bW\\TuTnvAO^U\0QXC>xx8FxRFf<tJ:::::R[Q-PR_aVSVPNaR:::::"));var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)};function __decorate(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function __metadata(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function __awaiter(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(t){o(t)}}function s(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function __generator(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(c){s=[6,c],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function __spreadArray(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function createSymbol(e){return"undefined"==typeof Symbol?"$Symbol<".concat(e,">$"):Symbol(e)}"function"==typeof SuppressedError&&SuppressedError;var EVENT_SYMBOL=createSymbol("$$FIVE_EVENT$$");function __generateEventIfNotExisted(e){return e[EVENT_SYMBOL]||(e[EVENT_SYMBOL]={}),e[EVENT_SYMBOL]}function __removeEventIfNotExisted(e){e[EVENT_SYMBOL]||delete e[EVENT_SYMBOL]}var Subscribe=function(){function e(){}return e.prototype.hasListener=function(e){var t=__generateEventIfNotExisted(this);return t&&t[e]&&t[e].callbacks.length>0},e.prototype.on=function(e,t,n){var r=this,i=__generateEventIfNotExisted(this);return i[e]||(i[e]={called:[!1],callbacks:[]}),i[e].callbacks.push([t,n||!1]),function(){return r.off(e,t)}},e.prototype.once=function(e,t){return this.on(e,t,!0)},e.prototype.off=function(e,t){if(void 0!==e){var n=__generateEventIfNotExisted(this);if(n[e]||(n[e]={called:[!1],callbacks:[]}),void 0!==t){for(var r=0;r<n[e].callbacks.length&&n[e].callbacks[r][0]!==t;r++);r<n[e].callbacks.length&&n[e].callbacks.splice(r,1)}else n[e].callbacks.length=0}else __removeEventIfNotExisted(this)},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=!1,i=__generateEventIfNotExisted(this);i[e]||(i[e]={called:[!1],callbacks:[]}),i[e].called=[!0,t];for(var o=0,a=i[e].callbacks.slice();o<a.length;o++){var s=a[o],c=s[0],l=s[1],u=void 0!==l&&l,p=c.apply(void 0,t);u&&this.off(e,c),!1===p&&(r=!0)}return r},e.prototype.waitUnitl=function(e){var t=this,n=__generateEventIfNotExisted(this);n[e]||(n[e]={called:[!1],callbacks:[]});var r=n[e].called,i=r[0],o=r[1];return i?Promise.resolve(o):new Promise((function(n){t.once(e,(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(e),!0}))}))},e}();function noop$1(){}var start="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),now="undefined"!=typeof performance?function(){return start+performance.now()}:function(){return Date.now()};function deepFreeze(e){Object.freeze(e);var t="function"==typeof e,n=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach((function(r){!n.call(e,r)||t&&("caller"===r||"callee"===r||"arguments"===r)||null===e[r]||"object"!=typeof e[r]&&"function"!=typeof e[r]||Object.isFrozen(e[r])||deepFreeze(e[r])})),e}var domainRegex=/^([^.]+)(\.([^.]+))*$/;function match(e,t){if("*"===e)return!0;var n=e.split(".").reverse(),r=t.split(".").reverse();if(n.length<=1)return e===t;for(var i=0;i<n.length;i++)if(n[i]!==r[i])return!1;return!0}function isIPDomain(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function matchDomain(e,t){return domainRegex.test(e)&&domainRegex.test(t)&&match(e,t)}var JSONP_REGEXPS=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],BUILDIN_ALLOW_HOST=deepFreeze(JSON.parse(function(){return arguments[0].split("").map((function(e){return 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/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"))),NetworkProxyError=function(e){function t(t,n,r){return e.call(this,"[NETWORK]: request proxy error(type: ".concat(n,", reason: ").concat(r,"): ").concat(t))||this}return __extends(t,e),t}(Error),NetworkResponseError=function(e){function t(t,n,r){var i=e.call(this,"[NETWORK]: response error(type: ".concat(n,", status: ").concat(r,"): ").concat(t))||this;return i.httpStatus=r,i}return __extends(t,e),t}(Error);!function(e){function t(t,n){return e.call(this,"[NETWORK]: request abort(type: ".concat(n,"): ").concat(t))||this}__extends(t,e)}(Error);var NetworkTimeoutError=function(e){function t(t,n,r){return e.call(this,"[NETWORK]: request timeout(type: ".concat(n,", timeout: ").concat(r,"ms): ").concat(t))||this}return __extends(t,e),t}(Error),NetworkFirbiddenError=function(e){function t(t,n,r){return e.call(this,"[NETWORK]: request forbidden(type: ".concat(n,", reason: ").concat(r,"): ").concat(t))||this}return __extends(t,e),t}(Error);function parseHeaders(e){if(!e)return{};for(var t={},n=e.trim().split("\n"),r=0;r<n.length;r++){var i=n[r],o=i.indexOf(":"),a=i.slice(0,o).trim().toLowerCase(),s=i.slice(o+1).trim();s&&(t[a]?t[a]+=", "+s:t[a]=s)}return t}function matchJsonpFunctionName(e){for(var t=0,n=JSONP_REGEXPS;t<n.length;t++){var r=n[t],i=e.match(r);if(i)return"jsonp_"+i[1]}return null}function isJsonpSource(e){return null!==matchJsonpFunctionName(e)}function getProtocol(e){var t=e.match(/^([0-9a-z]+\:)\/\/(([^:/?#]*)(?::[0-9]+)?)/);return t?t[1]:location.protocol}function hostnameFromURL(e){if(/^blob\:/i.test(e))return"blob:";if(/^data\:/i.test(e))return"data:";var t=e.match(/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i);return t?t[2]:location.hostname}var NetworkSubscribe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(Subscribe);function ajax(e,t,n,r,i){void 0===t&&(t={}),void 0===n&&(n=noop$1),void 0===r&&(r=noop$1),void 0===i&&(i=noop$1);var o=now(),a=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(n){var r,i=matchJsonpFunctionName(e)?"Script":"XMLHttpRequest",o=new NetworkProxyError(a,i,n&&n.message?String(n.message):String(n));return null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,i,"proxy-error",o.message),Promise.reject(o)})).then((function(e){return new Promise((function(s,c){var l,u=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),p=hostnameFromURL(e),d=matchJsonpFunctionName(e);if(0!==location.hostname.length&&!isIPDomain(location.hostname)&&0===BUILDIN_ALLOW_HOST.filter((function(e){return matchDomain(e,location.hostname)})).length&&!isIPDomain(p)&&0===u.filter((function(e){return matchDomain(e,p)})).length){var h=d?"Script":"XMLHttpRequest",f=new NetworkFirbiddenError(e,h,"request host(".concat(p,") is not allowed"));return r(f),c(f),void(null===(l=t.networkSubscribe)||void 0===l||l.emit("network",e,h,"forbidden",f.message))}if(d){var m=window,v=null,A=!1,g=document.createElement("script");m[d]=function(i){var l,u,p=now(),h=p-o;if(delete m[d],g.parentNode&&g.parentNode.removeChild(g),null!==v&&(window.clearTimeout(v),v=null),!0!==A){if(0!==i.indexOf("data:")){var f=new NetworkResponseError(e,"Script",500);return r(f),c(f),void(null===(l=t.networkSubscribe)||void 0===l||l.emit("network",e,"Script","error",f.message))}var y=i.split(","),b=(y[0].match(/:(.*?);/)||[])[1],E=y[1];if("arraybuffer"===t.responseType||"blob"===t.responseType){for(var _=atob(y[1]),T=_.length,x=new Uint8Array(T),R=0;R<T;R++)x[R]=_.charCodeAt(R);E="arraybuffer"===t.responseType?x.buffer:new Blob([x],{type:b})}var w={body:E,meta:{origin:a,source:e,requestTime:o,responseTime:p,costs:h,headers:{}}};n(w),s(w),null===(u=t.networkSubscribe)||void 0===u||u.emit("network",e,"Script","ok",JSON.stringify(w.meta)),A=!0}},g.src=e,document.body.appendChild(g),"number"==typeof t.timeout&&(v=window.setTimeout((function(){var n;if(v=null,!0!==A){A=!0;var i=new NetworkTimeoutError(e,"Script",t.timeout||NaN);r(i),c(i),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Script","timeout",i.message)}}),t.timeout))}else{var y=!1,b=new XMLHttpRequest,E=function(){b&&(b.removeEventListener("timeout",_,!1),b.removeEventListener("progress",T,!1),b.removeEventListener("load",x,!1),b.removeEventListener("error",R,!1)),b=null,E=noop$1},_=function(){var n;if(!0!==y){y=!0,E();var i=new NetworkTimeoutError(e,"XMLHttpRequest",t.timeout||NaN);r(i),c(i),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"XMLHttpRequest","timeout",i.message)}},T=function(e){!0!==y&&e.lengthComputable&&(e.total<=0||i(e.loaded/e.total))},x=function(r){var i;if(!0!==y){var c=this.status;if(0===c||c>=200&&c<400){y=!0,E();var l=now(),u=l-o,p=parseHeaders(this.getAllResponseHeaders()),d=r.total,h={body:this.response,meta:{origin:a,source:e,requestTime:o,responseTime:l,costs:u,headers:p,size:d}};n(h),s(h),null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"XMLHttpRequest","ok",JSON.stringify(h.meta))}else R.call(this)}},R=function(){var n;if(!0!==y){y=!0,E();var i=new NetworkResponseError(e,"XMLHttpRequest",this.status);r(i),c(i),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"XMLHttpRequest","error",i.message)}};b.addEventListener("timeout",_,!1),b.addEventListener("progress",T,!1),b.addEventListener("load",x,!1),b.addEventListener("error",R,!1),t.responseType&&(b.responseType=t.responseType),"number"==typeof t.timeout&&(b.timeout=t.timeout),b.open("GET",e,!0),b.send(null)}}))}))}var preloadCache={};function preload(e,t){void 0===t&&(t={});var n=now(),r=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(n){var i,o=new NetworkProxyError(r,"Link",n&&n.message?String(n.message):String(n));return null===(i=t.networkSubscribe)||void 0===i||i.emit("network",e,"Link","proxy-error",o.message),Promise.reject(o)})).then((function(e){return e in preloadCache?preloadCache[e]:preloadCache[e]=new Promise((function(i,o){var a,s=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),c=hostnameFromURL(e);if(0!==location.hostname.length&&!isIPDomain(location.hostname)&&0===BUILDIN_ALLOW_HOST.filter((function(e){return matchDomain(e,location.hostname)})).length&&!isIPDomain(c)&&0===s.filter((function(e){return matchDomain(e,c)})).length){var l=new NetworkFirbiddenError(e,"Link","request host(".concat(c,") is not allowed"));return o(l),void(null===(a=t.networkSubscribe)||void 0===a||a.emit("network",e,"Link","forbidden",l.message))}var u=document.createElement("link");u.href=e,u.rel=u.relList&&u.relList.supports("prefetch")?"prefetch":"preload",u.as="fetch",u.crossOrigin="";var p=document.head||document.getElementsByTagName("head")[0];p&&p.appendChild(u);var d=!1;u.onload=function(){var o;if(!0!==d){d=!0,i();var a=now(),s={origin:r,source:e,requestTime:n,responseTime:a,costs:a-n,headers:{}};null===(o=t.networkSubscribe)||void 0===o||o.emit("network",e,"Link","preload",JSON.stringify(s))}},u.onerror=function(n){var r;if(!0!==d){d=!0;var i=new NetworkResponseError(e,"Link",0);o(i),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Link","error",i.message)}}}))}))}function loadImage(e,t,n,r,i,o){void 0===t&&(t={}),void 0===n&&(n=noop$1),void 0===r&&(r=noop$1),void 0===i&&(i=noop$1);var a=now(),s=e;return Promise.resolve().then((function(){return t.requestProxy?t.requestProxy(e):e})).then((function(e){return/^https\:/.test(location.href)&&/^http\:/.test(e)?(console.warn("The page at '".concat(location.href,"' was loaded over HTTPS, but requested an insecure element '").concat(e,"'. This request was automatically upgraded to HTTPS")),e.replace(/^http\:/,"https:")):e})).catch((function(n){var r,i=new NetworkProxyError(s,"Image",n&&n.message?String(n.message):String(n));return null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Image","proxy-error",i.message),Promise.reject(i)})).then((function(e){return new Promise((function(c,l){var u,p=t.allowHosts?BUILDIN_ALLOW_HOST.concat(t.allowHosts):BUILDIN_ALLOW_HOST.slice(),d=hostnameFromURL(e);if(0!==location.hostname.length&&!isIPDomain(location.hostname)&&0===BUILDIN_ALLOW_HOST.filter((function(e){return matchDomain(e,location.hostname)})).length&&!isIPDomain(d)&&0===p.filter((function(e){return matchDomain(e,d)})).length){var h=new NetworkFirbiddenError(e,"Image","request host(".concat(d,") is not allowed"));return r(h),l(h),void(null===(u=t.networkSubscribe)||void 0===u||u.emit("network",e,"Image","forbidden",h.message))}var f=null!=o?o:new Image,m=!1,v=null;"number"==typeof t.timeout&&(v=window.setTimeout((function(){var n;if(f.onload=noop$1,f.onerror=noop$1,v=null,!0!==m){m=!0;var i=new NetworkTimeoutError(e,"Image",t.timeout);r(i),l(i),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Image","timeout",i.message)}}),t.timeout)),f.onload=function(){var r;if(f.onload=noop$1,f.onerror=noop$1,null!==v&&(clearTimeout(v),v=null),!0!==m){var o=now();m=!0;var l={body:f,meta:{headers:{},origin:s,source:e,requestTime:a,responseTime:o,costs:o-a}};i(1),n(l),c(l),null===(r=t.networkSubscribe)||void 0===r||r.emit("network",e,"Image","ok",JSON.stringify(l.meta))}},f.onerror=function(){var n;if(f.onload=noop$1,f.onerror=noop$1,null!==v&&(clearTimeout(v),v=null),!0!==m){m=!0;var i=new NetworkResponseError(e,"Image",0);r(i),l(i),null===(n=t.networkSubscribe)||void 0===n||n.emit("network",e,"Image","ok",i.message)}},i(0),f.src=e}))}))}var Fetcher=function(){function e(e){void 0===e&&(e={}),this.options=deepFreeze(e)}return e.prototype.ajax=function(e,t,n,r,i){var o;void 0===t&&(t={}),void 0===n&&(n=noop$1),void 0===r&&(r=noop$1),void 0===i&&(i=noop$1);var a=this.options;return ajax(e,{responseType:t.responseType,timeout:null!==(o=t.timeout)&&void 0!==o?o:a.timeout,get allowHosts(){var e;return null!==(e=t.allowHosts)&&void 0!==e?e:a.allowHosts},get requestProxy(){var e;return null!==(e=t.requestProxy)&&void 0!==e?e:a.requestProxy},get networkSubscribe(){var e;return null!==(e=t.networkSubscribe)&&void 0!==e?e:a.networkSubscribe}},n,r,i)},e.prototype.loadImage=function(e,t,n,r,i,o){var a;void 0===t&&(t={}),void 0===n&&(n=noop$1),void 0===r&&(r=noop$1),void 0===i&&(i=noop$1);var s=this.options;return loadImage(e,{timeout:null!==(a=t.timeout)&&void 0!==a?a:s.timeout,get allowHosts(){var e;return null!==(e=t.allowHosts)&&void 0!==e?e:s.allowHosts},get requestProxy(){var e;return null!==(e=t.requestProxy)&&void 0!==e?e:s.requestProxy},get networkSubscribe(){var e;return null!==(e=t.networkSubscribe)&&void 0!==e?e:s.networkSubscribe}},n,r,i,o)},e.prototype.preload=function(e,t){var n;void 0===t&&(t={});var r=this.options;return preload(e,{timeout:null!==(n=t.timeout)&&void 0!==n?n:r.timeout,get allowHosts(){var e;return null!==(e=t.allowHosts)&&void 0!==e?e:r.allowHosts},get requestProxy(){var e;return null!==(e=t.requestProxy)&&void 0!==e?e:r.requestProxy},get networkSubscribe(){var e;return null!==(e=t.networkSubscribe)&&void 0!==e?e:r.networkSubscribe}})},e}(),internalFetcher=new Fetcher,_requestAnimationFrame=function(){if("undefined"!=typeof window){var e=window;return e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame||function(e){return setTimeout(e,16)}}return function(e){return setTimeout(e,16)}}(),_cancelAnimationFrame=function(e){var t;if("undefined"!=typeof window){var n=window;t=n.cancelAnimationFrame||n.mozCancelAnimationFrame||n.webkitCancelAnimationFrame||n.msCancelAnimationFrame||function(e){return window.clearTimeout(e)}}else t=function(e){return window.clearTimeout(e)};t(e)},DEFAULT_ORDER=5,deviceFrameTime=16,AnimationFrameLoop=function(){function e(){this.frames=[],this.stoped=!1,this.time=now(),this.context=null,this.loop=this.loop.bind(this),this.loop()}return Object.defineProperty(e,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new e),this.sharedInstance},enumerable:!1,configurable:!0}),e.getFrameTime=function(){return deviceFrameTime},e.prototype.loop=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!this.stoped){var n=now(),r=n-this.time;this.time=n;var i=[];deviceFrameTime=r;for(var o=0,a=this.frames;o<a.length;o++){var s=a[o];if(s.delay>0)s.delay=s.delay-1;else{try{s.callback.apply(s,__spreadArray([n,r],e,!1))}catch(c){console.error(c)}s.once&&i.push(s)}}i.length>0&&(this.frames=this.frames.filter((function(e){return-1===i.indexOf(e)}))),this.requestAnimationFrame(this.loop)}},e.prototype.setContext=function(e){this.cancelAnimationFrame(this.requestId),this.context=e,this.requestId=this.requestAnimationFrame(this.loop)},e.prototype.getContext=function(){return this.context},e.prototype.requestAnimationFrame=function(e){return this.context?this.context.requestAnimationFrame(e):_requestAnimationFrame(e)},e.prototype.cancelAnimationFrame=function(e){this.context?this.context.cancelAnimationFrame(e):_cancelAnimationFrame(this.loop),this.requestId=null},e.prototype.remove=function(e){var t=this.frames.indexOf(e);t>=0&&this.frames.splice(t,1)},e.prototype.add=function(e,t,n,r){var i=this;void 0===t&&(t=!1),void 0===n&&(n=0),void 0===r&&(r=DEFAULT_ORDER);var o={callback:e,once:t,delay:n,order:r};return this.frames.push(o),this.frames.sort((function(e,t){return e.order-t.order})),function(){return i.remove(o)}},e.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},e}(),DEFAULT_IMAGE_URL_MAPPINGS={"vrlab-public.ljcdn.com":{type:"tencentCloud",pano:["vrlab-image1.ljcdn.com","vrlab-image2.ljcdn.com"],texture:["vrlab-image3.ljcdn.com"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vrlab-image4.ljcdn.com"]},"vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["vr-image-1.realsee-cdn.cn","vr-image-2.realsee-cdn.cn"],texture:["vr-image-3.realsee-cdn.cn"],tile:["vr-tile-1.realsee-cdn.cn","vr-tile-2.realsee-cdn.cn"],model:["vr-model-1.realsee-cdn.cn","vr-model-2.realsee-cdn.cn"],default:["vr-image-4.realsee-cdn.cn"]},"vr-public.rscdn.cn":{type:"tencentCloud",pano:["vr-image-1.rscdn.cn","vr-image-2.rscdn.cn"],texture:["vr-image-3.rscdn.cn"],tile:["vr-tile-1.rscdn.cn","vr-tile-2.rscdn.cn"],model:["vr-model-1.rscdn.cn","vr-model-2.rscdn.cn"],default:["vr-image-4.rscdn.cn"]},"mars-public.realsee-cdn.cn":{type:"aliyun",pano:["mars-image-1.realsee-cdn.cn","mars-image-2.realsee-cdn.cn"],texture:["mars-image-3.realsee-cdn.cn"],tile:["mars-tile-1.realsee-cdn.cn","mars-tile-2.realsee-cdn.cn"],model:["mars-model-1.realsee-cdn.cn","mars-model-2.realsee-cdn.cn"],default:["mars-image-4.realsee-cdn.cn"]},"global-public.realsee-cdn.com":{type:"tencentCloud",pano:["global-image-1.realsee-cdn.com","global-image-2.realsee-cdn.com"],texture:["global-image-3.realsee-cdn.com"],tile:["global-tile-1.realsee-cdn.com","global-tile-2.realsee-cdn.com"],model:["global-model-1.realsee-cdn.com","global-model-2.realsee-cdn.com"],default:["global-image-4.realsee-cdn.com"]},"earth-ga-public.realsee-cdn.cn":{type:"tencentCloud",pano:["earth-ga-image-1.realsee-cdn.cn","earth-ga-image-2.realsee-cdn.cn"],texture:["earth-ga-image-3.realsee-cdn.cn"],tile:["earth-ga-tile-1.realsee-cdn.cn","earth-ga-tile-2.realsee-cdn.cn"],model:["earth-ga-model-1.realsee-cdn.cn","earth-ga-model-2.realsee-cdn.cn"],default:["earth-ga-image-4.realsee-cdn.cn"]},"test-vr-public.realsee-cdn.com":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],texture:["test-vr-image.realsee-cdn.com"],tile:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],model:["test-vr-image.realsee-cdn.com","test-vr-image.realsee-cdn.com"],default:["test-vr-image.realsee-cdn.com"]},"test-vr-public.realsee-cdn.cn":{type:"tencentCloud",pano:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],texture:["test-vr-image.realsee-cdn.cn"],tile:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],model:["test-vr-image.realsee-cdn.cn","test-vr-image.realsee-cdn.cn"],default:["test-vr-image.realsee-cdn.cn"]}},URL_DOMAIN_REGEX=/^https?\:\/\/?([^\/]+)/;function getDomain(e){var t=e.match(URL_DOMAIN_REGEX);return null===t?null:t[1]}function replaceDomain(e,t){return e.replace(URL_DOMAIN_REGEX,(function(e,n){return e.slice(0,e.length-n.length)+t}))}function route(e,t,n){var r=t.split("."),i=r[0],o=r.slice(1);if("texture"===i)return replaceDomain(e,n.texture[0]);if("pano"===i||"pano_luminance"===i)switch(o[0],o[1]){case"front":case"left":case"up":return replaceDomain(e,n.pano[0]);case"down":case"right":case"back":return replaceDomain(e,n.pano[1])}else if("pano_tile"===i||"pano_tile_luminance"===i){o[0],o[1];var a=o[2],s=o[3],c=o[4],l=Math.pow(2,Number(a))*Number(s)+Number(c);if(!isNaN(l))return replaceDomain(e,n.tile[l%2])}else if("model"===i){var u=o[0];l=Number(u);if(!isNaN(l))return replaceDomain(e,n.model[l%2])}return replaceDomain(e,n.default[0])}var tencentCloudImageProcesser=function(e,t){var n,r=e.split("?")[0],i=r.split(".").pop();if("jpeg"===i&&(i="jpg"),"png"!==i&&"jpg"!==i)return e;var o="";if(void 0!==t.format&&t.format!==i&&(o+="/format/".concat(t.format)),void 0!==t.cut&&(o+="/cut/".concat(t.cut[2],"x").concat(t.cut[3],"x").concat(t.cut[0],"x").concat(t.cut[1])),void 0!==t.quality){var a=null!==(n=t.format)&&void 0!==n?n:i;a&&["jpg","webp","tpg","heif","avif"].indexOf(a)>=0&&(o+="/quality/".concat(t.quality))}if(void 0!==t.size){var s=e.match(/\/cube_(\d+)\//);(s?Number(s[1]):NaN)!==Number(t.size)&&(o+="/thumbnail/".concat(t.size,"x"))}return void 0!==t.sharpen&&(o+="/sharpen/".concat(t.sharpen)),o.length&&(o="?imageMogr2"+o),r+o},aliyunOOSImageProcesser=function(e,t){var n,r=e.split("?")[0],i=r.split(".").pop();if("jpeg"===i&&(i="jpg"),"png"!==i&&"jpg"!==i)return e;var o="",a=[],s=t.format,c=t.quality,l=t.size;if(void 0!==s&&s!==i&&a.push("format,".concat("heif"===s?"heic":s)),void 0!==t.cut){var u=t.cut,p=u[0],d=u[1],h=u[2],f=u[3];a.push("crop,x_".concat(p,",y_").concat(d,",w_").concat(h,",h_").concat(f,",g_nw"))}if(void 0!==c&&100!==c){var m=null!==(n=t.format)&&void 0!==n?n:i;m&&["jpg","webp"].indexOf(m)>=0&&a.push("quality,Q_".concat(c))}return l&&2048!==l&&a.push("resize,w_".concat(l)),void 0!==t.sharpen&&a.push("sharpen,".concat(t.sharpen)),a.length&&(o="?x-oss-process=image/"+a.join("/")),r+o};function imageURL(e,t){var n=__assign(__assign({},DEFAULT_IMAGE_URL_MAPPINGS),t.mappings),r=getDomain(e);if(null===r)return e;var i=n[r];return i?(e=route(e,t.key,i),/\.basis(\?|$)/.test(e)&&(e=e.replace(/\.basis(\?|$)/,".jpg$1")),"tencentCloud"===i.type?tencentCloudImageProcesser(e,t):"aliyun"===i.type?aliyunOOSImageProcesser(e,t):e):e}function applyImageURLOptions(e,t,n){void 0===t&&(t=imageURL);var r=t(e,n);if(r===e&&n.cut)throw new Error("ImageURL: cut option not applied.");return r}var webp="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAIAAUAmJaQAA3AA/vz0AAA=",avif="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAGhbWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAsaWxvYwAAAABEAAACAAEAAAABAAAB3gAAABkAAgAAAAEAAAHJAAAAFQAAAEJpaW5mAAAAAAACAAAAGmluZmUCAAAAAAEAAGF2MDFDb2xvcgAAAAAaaW5mZQIAAAAAAgAAYXYwMUFscGhhAAAAABppcmVmAAAAAAAAAA5hdXhsAAIAAQABAAAA12lwcnAAAACxaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIAAoAAAAAUaXNwZQAAAAAAAAACAAAAAgAAAA5waXhpAAAAAAEIAAAADGF2MUOBABwAAAAAOGF1eEMAAAAAdXJuOm1wZWc6bXBlZ0I6Y2ljcDpzeXN0ZW1zOmF1eGlsaWFyeTphbHBoYQAAAAAeaXBtYQAAAAAAAAACAAEEAQKDBAACBAUGhwgAAAA2bWRhdBIACgQYADLVMgsWQBhhIAQqrNj/+BIACgUYADLEoDIOFkADDDDCQAACDaqCCb4=",heif="data:image/heif;base64,AAAAGGZ0eXBoZWljAAAAAG1pZjFoZWljAAABL21ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAHBpY3QAAAAAAAAAAAAAAAAAAAAADnBpdG0AAAAAAAEAAAAjaWluZgAAAAAAAQAAABVpbmZlAgAAAAABAABodmMxAAAAAK9pcHJwAAAAkmlwY28AAAB2aHZjQwEBYAAAAAAAAAAAAADwAPz9+PgAACcDoAABAB5AAQwG//8BYAAAAwAAAwAAAwAAAwAAAwAAreTLgSChAAEAI0IBBwFgAAADAAADAAADAAADAAADAAChInJJlreTLySZNdggogABAAdEAcA98DMkAAAAFGlzcGUAAAAAAAAAAgAAAAIAAAAVaXBtYQAAAAAAAAABAAECgQIAAAAiaWxvYwAAAABEQAABAAEAAAAAAU8AAQAAAAAAAAAOAAAAFm1kYXQAAAAKJgGvLvkQwuWM4A==";function checkImage(e){return new Promise((function(t){var n=new Image,r=setTimeout((function(){n.onload=n.onerror=function(){},clearTimeout(r),t(!1)}),100);n.onload=n.onerror=function(){n.onload=n.onerror=function(){},clearTimeout(r),t(2===n.height)},n.src=e}))}var imageSupportCache=null;function imageSupport(){return imageSupportCache||(imageSupportCache=Promise.all([checkImage(webp),checkImage(avif),checkImage(heif)]).then((function(e){return{webp:e[0],avif:e[1],heif:e[2]}})))}var PANO_ID_REG=/^(.*)\[(\d+)\]$/;function panoStringify(e){if(!isNaN(e.panoIndex)&&isFinite(e.panoIndex))return"".concat(e.workCode,"[").concat(e.panoIndex,"]");throw new Error("Invalid Pano")}function panoParse(e){var t=e.match(PANO_ID_REG);if(t){t[0];var n=t[1],r=t[2],i=Math.floor(Number(r));if(!isNaN(i)&&isFinite(i))return{workCode:n,panoIndex:i}}throw new Error("Invalid PanoId")}function panoEqual(e,t){return panoStringify(e)===panoStringify(t)}function isPanoId(e){return"string"==typeof e&&PANO_ID_REG.test(e)}var PBMGroup=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(THREE__namespace.Group),PBMMesh=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.onBeforeRender=onBeforeRender$1,r}return __extends(t,e),t}(THREE__namespace.Mesh);function onBeforeRender$1(e,t,n){for(var r=0,i=this.material;r<i.length;r++){var o=i[r];this.model&&o.syncModel(this.model),o.update(e,n)}}var gradientTexture=(new THREE__namespace.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAABCAYAAACouxZ2AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAAQAAAAB7UD0+AAACA0lEQVRIDXWUW3YjIQxEwdnV/GT/q8kO3FO3pAJst3PSAaR6Cbszf//9XeMxxpjXmI+pVXudp2s6PC4dqHff9e6D7/PZLy46xQvG+sZvrfK8xgXUeq85yINe9bdmtOK1+kun5vjgq58a+eZPna9jvmjiserqG/+Whathvo3L3WhV89L9sXI/m18z2uene9ap/ftsuT9WZxoHXzW56/fpj8l7+tTw7P011NdpqnY19sRsfuHMA9u8oZWfDz4+fra/dfG1V60ydZ7qba1g7UNAeK0JP7ydD7/OqH6wO2f7HTq+B/lbL9qsB3/N1/UzR81XfPzw4tp5OPvRneacteq8Xo0xR3vuv/kPz0KtX0Nhg0eHuaNXdWI3X/ld427h++vzyp99V6VPrzWFhbv4ayay4oFecm198MmUXN/mL+x7npq/uJXBGb/MTw4+t+SvbLoTZnUW5uHhz7nWcTxT73OwXV7cxT9wbBf/0LnDBgcnHmtPLYba32Hp808sMy1u88yhr58n70/v4xX92GSN19l/2UsqGmiH94Hpxjcs+DO/ccpIVNVp62PUWXu//ur1GQy1Cf+GZ13rtNYN1po3/NI79fGXibHkq4z25xvV2pW3szpneXsW8SsreTe/NIPrtXMnH7wPf+LEN6tqhUVHj3XKD/72p9eafCeYB3zuonnbv7yqP8d/o4K6gRb1wbYAAAAASUVORK5CYII=");gradientTexture.minFilter=THREE__namespace.NearestFilter,gradientTexture.magFilter=THREE__namespace.NearestFilter,gradientTexture.wrapS=THREE__namespace.RepeatWrapping,gradientTexture.wrapT=THREE__namespace.RepeatWrapping;var defaultPbmParameters={pano0:null,pano1:null,shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,useBlackTransition:!1,clippers:null,constantColor:null,useEDL:!1,useHQWeight:!1,useHQDepth:!1,pointColor:"RGB",pointSize:"ATTENUATION",pointBack:"DARK",pointShape:"SQUARE",pointScale:.03,pointMaxPixel:40,pointMinPixel:.5,gradientTexture:gradientTexture};function isEqualClipperParameters(e,t){var n=null!=e?e:[],r=null!=t?t:[];if(r.length!==n.length)return!1;for(var i=0;i<r.length;i++)if(!n[i].clippingBoxMatrix.equals(r[i].clippingBoxMatrix)||n[i].floorIndex!==r[i].floorIndex)return!1;return!0}function isEqualPBMPanoPicture(e,t){return e&&t?e.luminanceMap===t.luminanceMap&&e.map===t.map&&e.matrix.equals(t.matrix):!e&&!t}function updatePBMParameters(e,t){var n=!1;for(var r in t)switch(r){case"clippers":isEqualClipperParameters(e[r],t[r])||(e[r]=t[r],n=!0);break;case"pano0":case"pano1":isEqualPBMPanoPicture(e[r],t[r])||(e[r]=t[r],n=!0);break;default:e[r]!==t[r]&&(e[r]=t[r],n=!0)}return n}var PBMPointCloud=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.onBeforeRender=onBeforeRender,r}return __extends(t,e),t}(THREE__namespace.Points);function onBeforeRender(e,t,n){this.model&&this.material.syncModel(this.model),this.material.update(e,n)}var scratchMaterialSet=new Set,PBMContainer=function(e){function t(){var t=e.call(this)||this;return t.needsRender=!0,t.pbmMaterialParametersVersion=0,t.materialParameters=__assign({},defaultPbmParameters),t}return __extends(t,e),t.prototype.getMaterial=function(){return __assign({},this.materialParameters)},t.prototype.setMaterial=function(e){var t=this;Object.assign(this.materialParameters,e),scratchMaterialSet.clear(),this.traverse((function(e){if(e instanceof PBMMesh)for(var n=0,r=e.material;n<r.length;n++){var i=r[n];scratchMaterialSet.has(i)||(Object.assign(i,t.materialParameters),scratchMaterialSet.add(i))}e instanceof PBMPointCloud&&(scratchMaterialSet.has(e.material)||(Object.assign(e.material,t.materialParameters),scratchMaterialSet.add(e.material)))})),scratchMaterialSet.clear(),this.needsRender=!0},t}(THREE__namespace.Group),FACE_ORDER$1=["right","left","up","down","front","back"];function getBox(e,t,n,r){var i=new THREE__namespace.Box3;switch(e){case"up":i.min.y=.5,i.max.y=.5,i.min.x=+t-.5,i.max.x=+t-.5+r,i.min.z=.5-n-r,i.max.z=.5-n;break;case"down":i.min.y=-.5,i.max.y=-.5,i.min.x=+t-.5,i.max.x=+t-.5+r,i.min.z=+n-.5,i.max.z=+n-.5+r;break;case"left":i.min.x=-.5,i.max.x=-.5,i.min.z=.5-t-r,i.max.z=.5-t,i.min.y=.5-n-r,i.max.y=.5-n;break;case"right":i.min.x=.5,i.max.x=.5,i.min.z=+t-.5,i.max.z=+t-.5+r,i.min.y=.5-n-r,i.max.y=.5-n;break;case"front":i.min.z=-.5,i.max.z=-.5,i.min.x=+t-.5,i.max.x=+t-.5+r,i.min.y=.5-n-r,i.max.y=.5-n;break;case"back":i.min.z=.5,i.max.z=.5,i.min.x=.5-t-r,i.max.x=.5-t,i.min.y=.5-n-r,i.max.y=.5-n}return i.applyMatrix4((new THREE__namespace.Matrix4).makeRotationY(Math.PI))}var createChildren=function(e,t){if(!(e.level>=t))for(var n=e.level+1,r=e.size/2,i=0,o=[new THREE__namespace.Vector2(e.position.x,e.position.y),new THREE__namespace.Vector2(e.position.x+r,e.position.y),new THREE__namespace.Vector2(e.position.x,e.position.y+r),new THREE__namespace.Vector2(e.position.x+r,e.position.y+r)];i<o.length;i++){var a=o[i],s={face:e.face,level:n,size:r,position:a,box:getBox(e.face,a.x,a.y,r),children:[]};e.children.push(s),createChildren(s,t)}};function createTileCubeNode(e,t){var n={level:0,face:e,position:new THREE__namespace.Vector2(0,0),size:1,box:getBox(e,0,0,1),children:[]};return createChildren(n,t),n}function createTileCubeTree(e){return{children:FACE_ORDER$1.map((function(t){return createTileCubeNode(t,e)}))}}function traverseTileCubeNode(e,t){for(var n=0,r=e.children;n<r.length;n++){var i=r[n];!1!==t(i)&&traverseTileCubeNode(i,t)}}var CUBE_GEOMETRY=new THREE__namespace.BoxBufferGeometry(1,1,1,1,1);CUBE_GEOMETRY.deleteAttribute("uv"),CUBE_GEOMETRY.deleteAttribute("normal"),CUBE_GEOMETRY.groups=[],CUBE_GEOMETRY.scale(-1,1,1);var CUBE_VERTEX_SHADER="\nvarying vec3 worldPosition;\nvoid main() {\n vec4 transform = vec4(position, 1.0);\n worldPosition = (modelMatrix * transform).xyz;\n gl_Position = projectionMatrix * modelViewMatrix * transform;\n}\n",CUBE_RAGMENT_SHADER="\nuniform samplerCube map;\nvarying vec3 worldPosition;\nvoid main() {\n gl_FragColor = textureCube(map, worldPosition);\n}\n",CUBE_MATERIAL=new THREE__namespace.ShaderMaterial({uniforms:{map:{value:null}},vertexShader:CUBE_VERTEX_SHADER,fragmentShader:CUBE_RAGMENT_SHADER,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1,fog:!1}),scene$3=new THREE__namespace.Scene;scene$3.matrixAutoUpdate=!1;var mesh$5=new THREE__namespace.Mesh(CUBE_GEOMETRY,CUBE_MATERIAL),_a$3;function renderCubeTextureToCubeRenderTarget(e,t,n){CUBE_MATERIAL.uniforms.map.value=e;var r=n.autoClear;n.autoClear=!1;var i=new THREE__namespace.CubeCamera(.1,2,t);i.matrixAutoUpdate=!1,i.update(n,scene$3),n.autoClear=r,CUBE_MATERIAL.uniforms.map.value=null}mesh$5.matrixAutoUpdate=!1,scene$3.add(mesh$5);var SQRT1_2$1=null!==(_a$3=Math.SQRT1_2)&&void 0!==_a$3?_a$3:Math.sqrt(2),QUATERNION={up:new THREE__namespace.Quaternion(SQRT1_2$1,0,0,SQRT1_2$1),down:new THREE__namespace.Quaternion(-SQRT1_2$1,0,0,SQRT1_2$1),left:new THREE__namespace.Quaternion(0,SQRT1_2$1,0,SQRT1_2$1),right:new THREE__namespace.Quaternion(0,-SQRT1_2$1,0,SQRT1_2$1),front:new THREE__namespace.Quaternion(0,0,0,1),back:new THREE__namespace.Quaternion(0,1,0,0)},PLAME_GEOMETRY=(vertices2=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs2=new Float32Array([0,0,1,0,0,1,1,1]),index2=new Uint8Array([0,1,2,1,3,2]),geometry2=new THREE__namespace.BufferGeometry,geometry2.setAttribute("position",new THREE__namespace.BufferAttribute(vertices2,3)),geometry2.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs2,2)),geometry2.setIndex(new THREE__namespace.BufferAttribute(index2,1)),geometry2),vertices2,uvs2,index2,geometry2,PLANE_VERTEX_SHADER="\nvarying vec2 vUv;\nuniform float flipY;\nvoid main() {\n vUv = vec2(uv.x, mix(uv.y, (1.0 - uv.y), flipY));\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",PLANE_FRAGMENT_SHADER="\nuniform sampler2D map;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n}\n",cacheMaterials=[];function getMaterial(){var e=cacheMaterials.pop();return e||new THREE__namespace.ShaderMaterial({uniforms:{map:{value:null},flipY:{value:0}},vertexShader:PLANE_VERTEX_SHADER,fragmentShader:PLANE_FRAGMENT_SHADER,depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1,fog:!1})}function releaseMaterial(e){e.uniforms.map.value=null,cacheMaterials.push(e)}function renderTexturesToCubeRenderTarget(e,t,n){var r=new THREE__namespace.Scene;r.matrixAutoUpdate=!1;var i=new THREE__namespace.Group;i.scale.set(1,1,-1),r.add(i);for(var o=[],a=0,s=e;a<s.length;a++){var c=s[a],l=getMaterial();o.push(l),l.uniforms.map.value=c.texture,l.uniforms.flipY.value=c.flipY?1:0;var u=new THREE__namespace.Group,p=new THREE__namespace.Mesh(PLAME_GEOMETRY,l);p.position.set(c.position.x+c.size.x/2-.5,1-(c.position.y+c.size.y/2)-.5,-.5),p.scale.set(c.size.x,c.size.y,1),u.quaternion.copy(QUATERNION[c.face]),u.add(p),i.add(u)}var d=n.autoClear;n.autoClear=!1;var h=new THREE__namespace.CubeCamera(.1,2,t);h.matrixAutoUpdate=!1,h.update(n,r),n.autoClear=d;for(var f=0,m=o;f<m.length;f++){releaseMaterial(l=m[f])}}var asyncImageTaskQueue=[],IMAGE_TASK_EACH_FRAME=6,imageTaskEachFrame=0;AnimationFrameLoop.shared.add((function(){if(imageTaskEachFrame=IMAGE_TASK_EACH_FRAME,asyncImageTaskQueue.length)for(var e=0,t=asyncImageTaskQueue.splice(0,imageTaskEachFrame);e<t.length;e++){var n=t[e];imageTaskEachFrame--,n()}}));var canUseNativeImageBitmap=function(){return!1}();function createImageBitmapLikeImage(){var e=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","img"),{crossOrigin:"",close:function(){e.onerror=e.onload=e.close=noop$1;var t=e.src;e.removeAttribute("src"),/^blob\:/.test(t)&&URL.revokeObjectURL(t)}});return e}function createImageBitmapLike(e){return new Promise((function(t,n){var r=createImageBitmapLikeImage();r.onload=function(){/^blob\:/.test(r.src)&&URL.revokeObjectURL(r.src),r.onload=r.onerror=noop$1,setTimeout((function(){t(r)}),0)},r.onerror=function(){var e=r.src;r.onload=r.onerror=noop$1,r.close(),n(new Error("image load error: ".concat(e)))},r.src=URL.createObjectURL(e)}))}function createImageBitmapLikeAsync(e){return new Promise((function(t){asyncImageTaskQueue.push((function(){t(createImageBitmapLike(e))}))}))}var canvasPool=[];function createCanvas(e,t){var n=canvasPool.shift();if(n)return n.width=e,n.height=t,n;var r=Object.assign(document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),{close:function(){r.close=noop$1,canvasPool.push(r)}});return r}function poolImageToTexture(e,t){if(t&&(e.width>t.width||e.height>t.height)){var n=createCanvas(Math.min(e.width,t.width),Math.min(e.height,t.height)),r=n.getContext("2d");r.clearRect(0,0,n.width,n.height),r.drawImage(e,0,0,n.width,n.height),e.close();var i=new THREE__namespace.Texture(n);i.needsUpdate=!0,i.flipY=!0;var o=i.dispose;return i.dispose=function(){n.close(),o.call(i),i.dispose=o},i}var a=new THREE__namespace.Texture(e);a.needsUpdate=!0,"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?a.flipY=!1:a.flipY=!0;var s=a.dispose;return a.dispose=function(){e.close(),s.call(a),a.dispose=s},a}function poolImagesToCubeTexture(e){var t=new THREE__namespace.CubeTexture(e);t.needsUpdate=!0,t.flipY=!1;var n=t.dispose;return t.dispose=function(){for(var r=0,i=e;r<i.length;r++){i[r].close()}n.call(t),t.dispose=n},t}var FACE_ORDER=["right","left","up","down","front","back"],MAX_TILE_RENDER_EACH_FRAME=4,TileCubeTextureTarget=function(){function e(e,t,n,r,i){this.tileTree=t,this.tileSources=n,this.options=r,this.renderer=i,this.name="",this.needsRender=!1,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.textures=[],this.baseCubeTexture=e}return Object.defineProperty(e.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(e){var t,n,r,i,o;if(null===e)throw new Error("cannot set cubeRenderTarget to null.");e.width!==this.options.textureSize&&e.setSize(this.options.textureSize,this.options.textureSize),e.texture.format=null!==(t=this.options.format)&&void 0!==t?t:THREE__namespace.RGBAFormat,e.texture.minFilter=null!==(n=this.options.minFilter)&&void 0!==n?n:THREE__namespace.LinearFilter,e.texture.magFilter=null!==(r=this.options.magFilter)&&void 0!==r?r:THREE__namespace.LinearFilter,e.texture.wrapS=null!==(i=this.options.wrapS)&&void 0!==i?i:THREE__namespace.ClampToEdgeWrapping,e.texture.wrapT=null!==(o=this.options.wrapT)&&void 0!==o?o:THREE__namespace.ClampToEdgeWrapping,this.baseCubeTexture&&(renderCubeTextureToCubeRenderTarget(this.baseCubeTexture,e,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&renderCubeTextureToCubeRenderTarget(this._cubeRenderTarget.texture,e,this.renderer),this._cubeRenderTarget=e},enumerable:!1,configurable:!0}),e.prototype.requestTile=function(e){var t,n,r,i,o,a,s=this,c=this.tileSources.filter((function(t){return t.level===e.level}))[0];if(c){var l=c.size,u=Math.pow(2,e.level)*e.position.y,p=Math.pow(2,e.level)*e.position.x,d="".concat((null!==(r=null===(n=null===(t=this.options.imageURL)||void 0===t?void 0:t.options)||void 0===n?void 0:n.key)&&void 0!==r?r:"pano.0").replace(/^pano/,"pano_tile"),".").concat(e.face,".").concat(e.level,".").concat(u,".").concat(p),h=__assign(__assign({},null!==(o=null===(i=this.options.imageURL)||void 0===i?void 0:i.options)&&void 0!==o?o:{key:"unknown"}),{key:d,size:l*e.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[l*e.position.x,l*e.position.y,l*e.size,l*e.size]});this.loadingCubeNodes.add(e),this.options.textureLoader.loadTexture(c[e.face],{imageURL:{transform:null===(a=this.options.imageURL)||void 0===a?void 0:a.transform,options:__assign({},h)},format:THREE__namespace.RGBAFormat,viaAjax:canUseNativeImageBitmap,timeout:this.options.timeout,fetcher:this.options.fetcher}).then((function(t){s.disposed?t.body.dispose():(s.textures.push({face:e.face,level:e.level,position:e.position,size:new THREE__namespace.Vector2(e.size,e.size),texture:t.body,flipY:!t.body.flipY}),s.loadedCubeNodes.add(e))})).catch(noop$1).then((function(){s.disposed||s.loadingCubeNodes.delete(e)}))}else this.loadedCubeNodes.add(e)},e.prototype.update=function(e,t){var n=this;if(!this.disposed){var r=[];traverseTileCubeNode(this.tileTree,(function(i){return!n.loadingCubeNodes.has(i)&&(!(i.level>t)&&(!!e.intersectsBox(i.box)&&(n.loadedCubeNodes.has(i)?void 0:(r.push(i),!1))))}));for(var i=0,o=r;i<o.length;i++){var a=o[i];this.requestTile(a)}if(this.cubeRenderTarget&&this.textures.length){var s=this.textures.splice(0,MAX_TILE_RENDER_EACH_FRAME);renderTexturesToCubeRenderTarget(s,this.cubeRenderTarget,this.renderer),this.needsRender=!0;for(var c=0,l=s;c<l.length;c++){l[c].texture.dispose()}}}},Object.defineProperty(e.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var e=0,t=this.textures;e<t.length;e++){t[e].texture.dispose()}this.textures.length=0}},e}(),TextureLoader=function(){function e(){}return e.prototype.loadTexture=function(e,t,n,r,i,o){var a,s,c,l;void 0===n&&(n=noop$1),void 0===r&&(r=noop$1),void 0===i&&(i=noop$1);var u={};void 0!==t.flipY&&(u.flipY=t.flipY),void 0!==t.format&&(u.format=t.format),void 0!==t.minFilter&&(u.minFilter=t.minFilter),void 0!==t.magFilter&&(u.magFilter=t.magFilter);var p=null!==(s=null===(a=t.imageURL)||void 0===a?void 0:a.options)&&void 0!==s?s:{key:"unknown"},d=getProtocol(e=applyImageURLOptions(e,null===(c=t.imageURL)||void 0===c?void 0:c.transform,p)),h=null!==(l=t.viaAjax)&&void 0!==l&&l,f=isJsonpSource(e),m=/^https?:/.test(d);if(f?h=!0:m||(h=!1),h){return t.fetcher.ajax(e,{timeout:t.timeout,responseType:"blob"},void 0,void 0,i).then((function(e){return createImageBitmapLikeAsync(e.body)})).then((function(e){return poolImageToTexture(e,t.maxSize)})).then((function(e){return Object.assign(e,u),e})).then((function(e){var t={meta:null,body:e};return n(t),t})).catch((function(e){return r(e),Promise.reject(e)}))}var v,A=null;return Promise.resolve().then((function(){return createImageBitmapLikeImage()})).then((function(n){return v=n,t.fetcher.loadImage(e,{timeout:t.timeout},void 0,void 0,i,n)})).then((function(e){return A=e.meta,poolImageToTexture(e.body,t.maxSize)})).then((function(e){return Object.assign(e,u),e})).then((function(e){var t={meta:A,body:e};return n(t),t})).catch((function(e){return v&&v.close(),r(e),Promise.reject(e)}))},e.prototype.loadCubeTexture=function(e,t,n,r,i,o){var a,s,c,l;void 0===n&&(n=noop$1),void 0===r&&(r=noop$1),void 0===i&&(i=noop$1),void 0!==t.format&&t.format,void 0!==t.minFilter&&t.minFilter,void 0!==t.magFilter&&t.magFilter;for(var u=[e[FACE_ORDER[0]],e[FACE_ORDER[1]],e[FACE_ORDER[2]],e[FACE_ORDER[3]],e[FACE_ORDER[4]],e[FACE_ORDER[5]]],p=[],d=[0,0,0,0,0,0],h=[],f=function(e){var n=null!==(s=null===(a=t.imageURL)||void 0===a?void 0:a.options)&&void 0!==s?s:{key:"unknown"},r=applyImageURLOptions(u[e],null===(c=t.imageURL)||void 0===c?void 0:c.transform,__assign(__assign({},n),{key:n.key+"."+FACE_ORDER[e]})),o=getProtocol(r),f=function(t){d[e]=t,i(d.reduce((function(e,t){return e+t}),0)/6)},m=null!==(l=t.viaAjax)&&void 0!==l&&l,v=/^https?:$/.test(o);if(isJsonpSource(r)?m=!0:v||(m=!1),m){var A=t.fetcher.ajax(r,{timeout:t.timeout,responseType:"blob"},void 0,void 0,f).then((function(t){return h[e]=t.meta,createImageBitmapLikeAsync(t.body)}));p.push(A)}else{var g;A=Promise.resolve().then((function(){return createImageBitmapLikeImage()})).then((function(e){return g=e,t.fetcher.loadImage(r,{timeout:t.timeout},void 0,void 0,f,e)})).then((function(t){return h[e]=t.meta,t.body})).catch((function(e){return g&&g.close(),Promise.reject(e)}));p.push(A)}},m=0;m<6;m++)f(m);return Promise.all(p).then((function(e){return poolImagesToCubeTexture(e)})).then((function(e){return Object.assign(e,__assign({encoding:THREE__namespace.sRGBEncoding},t)),e})).then((function(e){var t={body:e,meta:h};return n(t),t})).catch((function(e){for(var t=0,n=p;t<n.length;t++){n[t].then((function(e){return e.close()})).catch(noop$1)}return r(e),Promise.reject(e)}))},e.prototype.loadTiledCubeTexture=function(e,t,n,r,i,o,a){var s=this;return void 0===r&&(r=noop$1),void 0===i&&(i=noop$1),void 0===o&&(o=noop$1),new Promise((function(c,l){var u,p;s.loadCubeTexture(e,{imageURL:{transform:null===(u=n.imageURL)||void 0===u?void 0:u.transform,options:null===(p=n.imageURL)||void 0===p?void 0:p.options},format:THREE__namespace.RGBAFormat,viaAjax:n.viaAjax,timeout:n.timeout,fetcher:n.fetcher},(function(e){var i,o,l=e.meta,u=e.body,p=null!==(i=n.tileImageSize)&&void 0!==i?i:512,d=null!==(o=n.tileMaxLevel)&&void 0!==o?o:2,h=Math.max(1024*d,512),f=createTileCubeTree(d),m={meta:l,body:new TileCubeTextureTarget(u,f,t,{textureSize:h,tileImageSize:p,textureLoader:s,imageURL:n.imageURL,timeout:n.timeout,fetcher:n.fetcher},a)};r(m),c(m)}),(function(e){i(e),l(e)}),o,a).catch(noop$1)}))},e}();const vertexShader$6=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--nvor-sy|n-sy||H--n\bv{t-sy|n-Sy||H0r{qvsnvor-sy|n-v_||sZnxHn\bv{t-sy|n-V_||sZnxHn\bv{t-rp@-[|znyHn\bv{t-rp@-cvr]|vv|{Hn\bv{t-rpA-|yq]|vv|{Hn\bv{t-sy|n-Y|tQr}uHn\bv{t-znA-cvrZnvH0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrrK0v{pyqr-I?l}nlrrK0v{pyqr-Ip|y|l}nlrrK0v{pyqr-Iunq|zn}l}nlrrK|vq-znv{56-\n--0v{pyqr-IlrrK--0v{pyqr-I?lrrK--0v{pyqr-Ip|y|lrrK--0v{pyqr-Iortv{{|znylrrK--0v{pyqr-Iqrsny{|znylrrK--rpA-n{s|zrq-J-rpA5}|vv|{9->;=6H--rpA-z]|vv|{-J-z|qrycvrZnv-7-n{s|zrqH--[|zny-J-{|znyv\tr5n{s|zrq[|zny6H--0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6----Sy||-J-sy||H--0r{qvs--cvr]|vv|{-J-:z]|vv|{;\b\tH--|yq]|vv|{-J-z|qryZnv-7-n{s|zrqH--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-n{s|zrqH--0v{pyqr-Iunq|zn}lrrK--Y|tQr}u-J-y|t?5:z]|vv|{;\t6H--cvrZnv-J-vrZnvH--V_||sZnx-J-v_||sZnxH\f"),fragmentShader$6=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=60qrsv{r-aNb-C;?E@>EB?{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-rp@-qvssrH{vs|z-rp@-rzvvrH{vs|z-rp@-}rpynH{vs|z-sy|n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|;9-rp|;\t6H--r{-rp?5=;B-8-}uv-<-aNb9-urn-<-]V6H\f|vq-znv{56-\n--sy|n-ory|{tv{tSY||-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6----ory|{tv{tSY||-J-Sy||H--0ryr----ory|{tv{tSY||-J-sy||H--0r{qvs--zn@-pnzrn_|nv|{Znv-J-zn@5cvrZnvh=jh=j9-cvrZnvh>jh=j9-cvrZnvh?jh=j9cvrZnvh=jh>j9-cvrZnvh>jh>j9-cvrZnvh?jh>j9cvrZnvh=jh?j9-cvrZnvh>jh?j9-cvrZnvh?jh?j6H--rp@-pnzrnQvrpv|{-J-{|znyv\tr5pnzrn_|nv|{Znv-7-rp@5=;=9=;=9>;=66H--vs5pnzrnQvrpv|{;\b-K-=;E-33-V_||sZnx-JJ->;=6-\n----qvpnqH--\f--<<前置裁切计算--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znvV{rr-7-|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr-I-=;=-\v\v-no5ory|{tv{tSY||-:-pyv}}rh-v-j;sy||V{qr6-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;-K-:=;B-33-pyv}}r]|vv|{;-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|{;\t-K-:=;B-33-pyv}}r]|vv|{;\t-I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9->;=6H----r{H--0r{qvs--<<楼层选择计算--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr-KJ-=;=-33-no5ory|{tv{tSY||-:-u|{Sy||V{qr6-KJ->;=6-\n----sy||\\}npv\b-J-=;>H--\f--rpA-qvssrP|y|-J-rpA5qvssr;to9-|}npv\b6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5rp@5=;=69-rp@5=;=69-rp@5=;=69-rp@5=;=66H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--<<-调整曝光值--vnqvn{pr-J-vnqvn{pr-7-r}|rH--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--0v{pyqr-In|zn}lsntzr{K--<<-减少方向光对模型的影响--rp@-|t|v{tYvtu-J-5rsyrprqYvtu;qvrpQvssr-7-=;?6-8----rsyrprqYvtu;v{qvrpQvssr-8----rsyrprqYvtu;v{qvrp`}rpyn-8----|nyRzvvr_nqvn{prH--<<-修复黑色面片的问题--vs-5|t|v{tYvtu;-K-=;=-\v\v-|t|v{tYvtu;t-K-=;=-\v\v-|t|v{tYvtu;o-K-=;=6-\n----tylSntP|y|-J-rpA5|t|v{tYvtu9-qvssrP|y|;n6H--\f-ryr-\n----tylSntP|y|-J-rpA5OYNPXlP\\Y\\_;\b\t9-qvssrP|y|;n6H--\f--rp@-}n{|=a|crr-J-5|yq]|vv|{;\b\t-:-}n{|=lznvh@j;\b\t6-7-zn@5}n{|=lznv6H--rp@-}n{|>a|crr-J-5|yq]|vv|{;\b\t-:-}n{|>lznvh@j;\b\t6-7-zn@5}n{|>lznv6H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-rrPor5}n{|=lzn}9-}n{|=a|crr6H--rpA-}n{|>P|y|-J-rrPor5}n{|>lzn}9-}n{|>a|crr6H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-rrPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr6;H----}n{|>P|y|;n-J->;=-:-rrPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr6;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv5}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv5}n{|P|y|9-}n{|>P|y|9-zn5=;=9-oynpx]|tr-:-?;=66H--0ryr----}n{|P|y|-J-zv5}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6----rp@-pnzrna|crr-J-|yq]|vv|{;\b\t-:-pnzrn]|vv|{H----rpA-zn}P||q-J-rpA5pnzrna|crr9->;=6-7-}n{|cvqr|lznvH----rp?--J-rp?5------=;B-8-zn}P||q;-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;9------=;B-:-zn}P||q;\b-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;\b----6H----rpA-vqr|P|y|-J-rr?Q5}n{|cvqr|lzn}9-6H----sy|n-znpu-J-5>;=-:-r}5=;=9-zn}P||q;\t66-7-5>;=-:-r}5=;B9-no5;-:-=;B666-7-5>;=-:-r}5=;B9-no5;\b-:-=;B666H----sy|n-ny}un-J-pynz}5=;=9->;=9-B;=-7-5>;=-:-pynz}5qvn{pr59-rp?5=;B9-=;B66-<-=;BB-9-=;=9->;=666H----}n{|P|y|-J-zv5}n{|P|y|9-vqr|P|y|9-znpu-7-ny}un-7-}n{|cvqr|lny}un6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\l\\]NPVaf6----tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H----tylSntP|y|;n-J-|}npv\bH--0ryr----tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b-7-sy||\\}npv\b6H----tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs\f");var EMPTY_CUBE_TEXTURE=new THREE__namespace.WebGLCubeRenderTarget(1).texture;EMPTY_CUBE_TEXTURE.name="EMPTY_TEXTURE";var shaderUniforms$2=Object.assign({modelAlpha:new THREE__namespace.Uniform(0),progress:new THREE__namespace.Uniform(0),pano0_map:new THREE__namespace.Uniform(EMPTY_CUBE_TEXTURE),pano0_luminanceMap:new THREE__namespace.Uniform(null),pano0_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),pano1_map:new THREE__namespace.Uniform(EMPTY_CUBE_TEXTURE),pano1_luminanceMap:new THREE__namespace.Uniform(null),pano1_matrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),floor:new THREE__namespace.Uniform(0)},{exposure:new THREE__namespace.Uniform(1),emissive:new THREE__namespace.Uniform(new THREE__namespace.Color(0)),emissiveMap:new THREE__namespace.Uniform(null),specular:new THREE__namespace.Uniform(new THREE__namespace.Color(1118481)),specularMap:new THREE__namespace.Uniform(null),normalMap:new THREE__namespace.Uniform(null),bumpMap:new THREE__namespace.Uniform(null),shininess:new THREE__namespace.Uniform(30)},THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.common),THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.lights)),PBMMeshMaterial=function(e){function t(t){var n,r,i,o,a,s,c,l,u,p,d,h,f,m,v,A,g,y,b,E;void 0===t&&(t={});var _,T=e.call(this,{vertexShader:vertexShader$6,fragmentShader:fragmentShader$6,uniforms:THREE__namespace.UniformsUtils.clone(shaderUniforms$2),defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_FLOOR:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_POINT_NORMAL:!1,USE_POINT_CIRCLE:!1,USE_POINT_ADAPTIVE_SIZE:!1,USE_POINT_COLOR_ALTITUDE:!1},lights:!0})||this,x=null,R=null;return Object.defineProperties(T,{pano0:{get:function(){return x},set:function(e){if(x!==e){x=e,null===e?(this.uniforms.pano0_map.value=EMPTY_CUBE_TEXTURE,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=e.map instanceof TileCubeTextureTarget?e.map.texture:e.map,this.uniforms.pano0_luminanceMap.value=e.luminanceMap instanceof TileCubeTextureTarget?e.luminanceMap.texture:e.luminanceMap,this.uniforms.pano0_matrix.value.copy(e.matrix));var t=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==t&&(this.defines.USE_LUMINANCE=t,this.needsUpdate=!0)}}},pano1:{get:function(){return R},set:function(e){if(R!==e){R=e,null===e?(this.uniforms.pano1_map.value=EMPTY_CUBE_TEXTURE,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=e.map instanceof TileCubeTextureTarget?e.map.texture:e.map,this.uniforms.pano1_luminanceMap.value=e.luminanceMap instanceof TileCubeTextureTarget?e.luminanceMap.texture:e.luminanceMap,this.uniforms.pano1_matrix.value.copy(e.matrix));var t=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==t&&(this.defines.USE_LUMINANCE=t,this.needsUpdate=!0)}}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(e){this.uniforms.modelAlpha.value=e}},progress:{get:function(){return this.uniforms.progress.value},set:function(e){this.uniforms.progress.value=e}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(e){this.defines.USE_BLACK_TRANSITION!==e&&(this.defines.USE_BLACK_TRANSITION=e,this.needsUpdate=!0)}},constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(e){this.uniforms.constantColor.value=e;var t=null!==e;this.defines.USE_CONSTANT_COLOR!==t&&(this.defines.USE_CONSTANT_COLOR=t,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(e){this.uniforms.shownFloorIndex.value=e}},clippers:{get:function(){return _},set:function(e){_!==e&&(_=e,this.uniforms.clippers.value=(_||[]).map((function(e){var t="number"==typeof e.floorIndex?e.floorIndex:-1;return{matrixInverse:(new THREE__namespace.Matrix4).getInverse(e.clippingBoxMatrix),floorIndex:t}})),this.needsUpdate=!0)}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(e){e!==this.defines.USE_EDL&&(this.defines.USE_EDL=e,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(e){e!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=e,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(e){e!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=e,this.needsUpdate=!0)}},floor:{get:function(){return this.uniforms.floor.value},set:function(e){this.uniforms.floor.value=e}}}),T.pano0=null!==(n=t.pano0)&&void 0!==n?n:defaultPbmParameters.pano0,T.pano1=null!==(r=t.pano1)&&void 0!==r?r:defaultPbmParameters.pano1,T.modelAlpha=null!==(i=t.modelAlpha)&&void 0!==i?i:defaultPbmParameters.modelAlpha,T.progress=null!==(o=t.progress)&&void 0!==o?o:defaultPbmParameters.progress,T.useBlackTransition=null!==(a=t.useBlackTransition)&&void 0!==a?a:defaultPbmParameters.useBlackTransition,T.constantColor=null!==(s=t.constantColor)&&void 0!==s?s:defaultPbmParameters.constantColor,T.opacity=null!==(c=t.opacity)&&void 0!==c?c:defaultPbmParameters.opacity,T.shownFloorIndex=null!==(l=t.shownFloorIndex)&&void 0!==l?l:defaultPbmParameters.shownFloorIndex,T.clippers=null!==(u=t.clippers)&&void 0!==u?u:defaultPbmParameters.clippers,T.useEDL=null!==(p=t.useEDL)&&void 0!==p?p:defaultPbmParameters.useEDL,T.useHQWeight=null!==(d=t.useHQWeight)&&void 0!==d?d:defaultPbmParameters.useHQWeight,T.useHQDepth=null!==(h=t.useHQDepth)&&void 0!==h?h:defaultPbmParameters.useHQDepth,T.pointSize=null!==(f=t.pointSize)&&void 0!==f?f:defaultPbmParameters.pointSize,T.pointColor=null!==(m=t.pointColor)&&void 0!==m?m:defaultPbmParameters.pointColor,T.pointShape=null!==(v=t.pointShape)&&void 0!==v?v:defaultPbmParameters.pointShape,T.pointScale=null!==(A=t.pointScale)&&void 0!==A?A:defaultPbmParameters.pointScale,T.pointBack=null!==(g=t.pointBack)&&void 0!==g?g:defaultPbmParameters.pointBack,T.pointMinPixel=null!==(y=t.pointMinPixel)&&void 0!==y?y:defaultPbmParameters.pointMinPixel,T.pointMaxPixel=null!==(b=t.pointMaxPixel)&&void 0!==b?b:defaultPbmParameters.pointMaxPixel,T.gradientTexture=null!==(E=t.gradientTexture)&&void 0!==E?E:defaultPbmParameters.gradientTexture,T.floor=0,T}return __extends(t,e),t.prototype.onBeforeCompile=function(e,t){var n,r,i=String(null!==(r=null===(n=this.clippers)||void 0===n?void 0:n.length)&&void 0!==r?r:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,i),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,i)},t.prototype.update=function(e,t){this.transparent=this.shownFloorIndex>-1||this.opacity<1,this.blending=this.transparent?THREE__namespace.NormalBlending:THREE__namespace.NoBlending},t.prototype.syncModel=function(e){var t="".concat(e.id,":").concat(e.materialVersion);t!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.syncModelVersion=t)},t}(THREE__namespace.ShaderMaterial),InternalWebGLRenderer=function(e){function t(t){var n=t.preserveDrawingBuffer,r=void 0===n||n,i=t.premultipliedAlpha,o=void 0===i||i,a=t.stencil,s=void 0===a||a,c=t.backgroundColor,l=void 0===c?1579548:c,u=t.backgroundAlpha,p=void 0===u?1:u,d=t.pixelRatio,h=void 0===d?1:d,f=this,m={antialias:t.antialias,alpha:!0,preserveDrawingBuffer:r,stencil:s,premultipliedAlpha:o,powerPreference:"high-performance"};if(t.webgl2){var v=document.createElement("canvas"),A=v.getContext("webgl2",m);A?f=e.call(this,__assign(__assign({},m),{antialias:!0,canvas:v,context:A}))||this:(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),f=e.call(this,m)||this)}else f=e.call(this,m)||this;return f.setPixelRatio(h),f.setClearColor(l,p),f.outputEncoding=THREE__namespace.sRGBEncoding,f.autoClear=!0,f}return __extends(t,e),t}(THREE__namespace.WebGLRenderer),Scene=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.add=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.add.apply(this,t)},t.prototype.remove=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.remove.apply(this,t)},t}(THREE__namespace.Scene);function coordinatesToVector(e,t){var n=Math.abs(Math.cos(e.latitude)),r=-Math.sin(e.longitude)*n,i=-Math.sin(e.latitude),o=-Math.cos(e.longitude)*n;return t?t.set(r,i,o):new THREE__namespace.Vector3(r,i,o)}var DEFAULT_ASPECT=1,DEFAULT_NEAR=.1,DEFAULT_FAR=2e3,TAU$2=2*Math.PI,PI_2=Math.PI/2;function formatRad$1(e){return e>0&&e<=TAU$2?e:(e%TAU$2+TAU$2)%TAU$2}function matrixLerp(e,t,n,r){n=Math.pow(n,4);for(var i=0;i<16;i++)r.elements[i]=e.elements[i]+(t.elements[i]-e.elements[i])*n;return r}var Camera=function(e){function t(t,n,r,i,o,a,s){void 0===n&&(n=DEFAULT_ASPECT),void 0===r&&(r=DEFAULT_NEAR),void 0===i&&(i=DEFAULT_FAR),void 0===o&&(o=new THREE__namespace.Vector2),void 0===a&&(a=512),void 0===s&&(s=1);var c=e.call(this)||this;c.fov=t,c.aspect=n,c.near=r,c.far=i,c.perspToOrtho=o,c.screenHeight=a,c.pixelRatio=s,c.needsRender=!0,c.pose={longitude:0,latitude:0,fov:t,distance:0,offset:new THREE__namespace.Vector3},c.computePose(),c.perspectiveCamera=new THREE__namespace.PerspectiveCamera(c.fov,c.aspect,.001,c.far);var l=Math.max(c.orthoDistance,.01)*Math.tan(.5*c.fov/180*Math.PI),u=-.5*c.aspect*2*l;return c.orthographicCamera=new THREE__namespace.OrthographicCamera(u,-u,l,-l,.001,c.far),c.computeProjectionMatrix(),c.lastValues={position:c.position.clone(),quaternion:c.quaternion.clone(),scale:c.scale.clone(),fov:c.fov,aspect:c.aspect,near:c.near,far:c.far,perspToOrtho:c.perspToOrtho.clone()},c.type=c.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera",c}return __extends(t,e),Object.defineProperty(t.prototype,"orthoDistance",{get:function(){return this.pose.distance>1?this.pose.distance:1+(this.pose.distance-1)*this.perspToOrtho.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return"OrthographicCamera"===this.type?this.orthographicCamera.zoom:"PerspectiveCamera"===this.type?this.perspectiveCamera.zoom:1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return"OrthographicCamera"===this.type?this.orthographicCamera.top:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return"OrthographicCamera"===this.type?this.orthographicCamera.bottom:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return"OrthographicCamera"===this.type?this.orthographicCamera.left:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return"OrthographicCamera"===this.type?this.orthographicCamera.right:0},enumerable:!1,configurable:!0}),t.prototype.getDirection=function(e){return coordinatesToVector(this.pose,e)},t.prototype.computePose=function(e){void 0===e&&(e=0);var t=this.getDirection(new THREE__namespace.Vector3);this.pose.longitude=formatRad$1(-Math.atan2(t.x,-t.z)),this.pose.latitude=-Math.asin(t.y/1),this.pose.fov=this.fov,this.pose.distance=e;var n=(new THREE__namespace.Vector3).add(this.position).add(t.clone().setLength(this.pose.distance));return this.pose.offset.copy(n),this},t.prototype.setFromPose=function(e){var t,n,r,i,o,a=formatRad$1(null!==(t=e.longitude)&&void 0!==t?t:this.pose.longitude),s=Math.max(1e-4-PI_2,Math.min(PI_2-1e-4,null!==(n=e.latitude)&&void 0!==n?n:this.pose.latitude)),c=null!==(r=e.fov)&&void 0!==r?r:this.pose.fov,l=null!==(i=e.distance)&&void 0!==i?i:this.pose.distance,u=null!==(o=e.offset)&&void 0!==o?o:this.pose.offset,p=coordinatesToVector({longitude:a,latitude:s}).normalize();return this.position.set(0,0,0),this.lookAt(p),this.position.add(u).sub(p.clone().setLength(l)),this.fov!==c&&(this.fov=c,this.updateProjectionMatrix()),this.updateMatrixWorld(),this.pose.longitude=a,this.pose.latitude=s,this.pose.fov=c,this.pose.distance=l,this.pose.offset.copy(u),this.needsRender=!0,this},t.prototype.copyPose=function(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}},t.prototype.computeProjectionMatrix=function(){matrixLerp(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.getInverse(this.projectionMatrix),this.needsRender=!0},t.prototype.setViewOffset=function(e,t,n,r,i,o){this.perspectiveCamera.setViewOffset(e,t,n,r,i,o),this.orthographicCamera.setViewOffset(e,t,n,r,i,o),this.computeProjectionMatrix()},t.prototype.clearViewOffset=function(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()},t.prototype.updateProjectionMatrix=function(){this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()},Object.defineProperty(t.prototype,"perspectiveProjectionMatrix",{get:function(){return this.perspectiveCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveProjectionMatrixInverse",{get:function(){return this.perspectiveCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrix",{get:function(){return this.orthographicCamera.projectionMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"orthographicProjectionMatrixInverse",{get:function(){return this.orthographicCamera.projectionMatrixInverse},enumerable:!1,configurable:!0}),t.prototype.updateTime=function(e,t){var n=!1;if(this.lastValues.fov===this.fov&&this.lastValues.near===this.near&&this.lastValues.far===this.far&&this.lastValues.aspect===this.aspect||(this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),n=!0),!(this.lastValues.position.equals(this.position)&&this.lastValues.quaternion.equals(this.quaternion)&&this.lastValues.scale.equals(this.scale)&&this.lastValues.perspToOrtho.equals(this.perspToOrtho)&&this.lastValues.fov===this.fov&&this.lastValues.near===this.near&&this.lastValues.far===this.far&&this.lastValues.aspect===this.aspect)){var r=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),i=-.5*this.aspect*2*r;this.orthographicCamera.left=i,this.orthographicCamera.right=-i,this.orthographicCamera.top=r,this.orthographicCamera.bottom=-r,this.orthographicCamera.updateProjectionMatrix(),n=!0}n&&this.computeProjectionMatrix(),this.lastValues.position.copy(this.position),this.lastValues.quaternion.copy(this.quaternion),this.lastValues.scale.copy(this.scale),this.lastValues.fov=this.fov,this.lastValues.aspect=this.aspect,this.lastValues.near=this.near,this.lastValues.far=this.far,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.type=this.perspToOrtho.x<1?"PerspectiveCamera":"OrthographicCamera"},Object.defineProperty(t.prototype,"isPerspectiveCamera",{get:function(){return this.perspToOrtho.x<1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOrthographicCamera",{get:function(){return this.perspToOrtho.x>=1},enumerable:!1,configurable:!0}),t.prototype.copy=function(t,n){return e.prototype.copy.call(this,t,n),this.fov=t.fov,this.aspect=t.aspect,this.near=t.near,this.far=t.far,this.perspToOrtho.copy(t.perspToOrtho),this.updateTime(now(),0),this},t}(THREE__namespace.Camera),VolumePlaneIntersect,VolumePlaneIntersect2;VolumePlaneIntersect2=VolumePlaneIntersect||(VolumePlaneIntersect={}),VolumePlaneIntersect2[VolumePlaneIntersect2.Outside=-1]="Outside",VolumePlaneIntersect2[VolumePlaneIntersect2.Intersecting=0]="Intersecting",VolumePlaneIntersect2[VolumePlaneIntersect2.Inside=1]="Inside";var EPSILON$2=1e-6,scratchVector=new THREE__namespace.Vector3,scratchMatrix4$3=new THREE__namespace.Matrix4,scratchXAxis=new THREE__namespace.Vector3,scratchYAxis=new THREE__namespace.Vector3,scratchZAxis=new THREE__namespace.Vector3,scratchSize=new THREE__namespace.Vector3,scratchBox3=new THREE__namespace.Box3,scratchSphere$1=new THREE__namespace.Sphere,scratchMatrix4Inverse$1=new THREE__namespace.Matrix4,scratchRay$1=new THREE__namespace.Ray,scratchObject3D=new THREE__namespace.Object3D,scratchFrustum=new THREE__namespace.Frustum;function quaternionFromMatrix3(e,t){var n=e.elements;return t.setFromRotationMatrix(scratchMatrix4$3.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1)),t}var CullingVolume=function(){function e(e){void 0===e&&(e=[]),this.planes=e}return Object.defineProperty(e,"MASK_OUTSIDE",{get:function(){return 4294967295},enumerable:!1,configurable:!0}),Object.defineProperty(e,"MASK_INSIDE",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e,"MASK_INDETERMINATE",{get:function(){return 2147483647},enumerable:!1,configurable:!0}),e.prototype.setFromFrustum=function(e){return this.planes=e.planes.map((function(e){return e.clone()})),this},e.prototype.setFromCamera=function(e){return scratchMatrix4$3.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),scratchFrustum.setFromProjectionMatrix(scratchMatrix4$3),this.setFromFrustum(scratchFrustum),this},e.prototype.computeVisibility=function(e){for(var t=VolumePlaneIntersect.Inside,n=0,r=this.planes;n<r.length;n++){var i=r[n];switch(e.intersectPlane(i)){case VolumePlaneIntersect.Outside:return VolumePlaneIntersect.Outside;case VolumePlaneIntersect.Intersecting:t=VolumePlaneIntersect.Intersecting}}return t},e.prototype.computeVisibilityWithPlaneMask=function(t,n){if(n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;for(var r=e.MASK_INSIDE,i=Math.min(32,this.planes.length),o=0;o<i;++o){var a=1<<o;if(0!=(n&a)){var s=this.planes[o],c=t.intersectPlane(s);if(c===VolumePlaneIntersect.Outside)return e.MASK_OUTSIDE;c===VolumePlaneIntersect.Intersecting&&(r|=a)}}return r},e}(),BoxBoundingVolume=function(){function e(){this.type="box",this.center=new THREE__namespace.Vector3,this.halfSize=new THREE__namespace.Vector3,this.rotation=new THREE__namespace.Matrix3}return e.prototype.fromJson=function(e){var t=e.box;this.center.set(t[0],t[1],t[2]);var n=t[3],r=t[4],i=t[5],o=t[6],a=t[7],s=t[8],c=t[9],l=t[10],u=t[11],p=Math.sqrt(n*n+r*r+i*i),d=Math.sqrt(o*o+a*a+s*s),h=Math.sqrt(c*c+l*l+u*u);this.halfSize.set(p,d,h);var f=this.halfSize.toArray().reduce((function(e,t){return e+t}),0);return(isNaN(f)||f<=0)&&this.halfSize.setScalar(EPSILON$2),this.rotation.fromArray([n/p,r/p,i/p,o/d,a/d,s/d,c/h,l/h,u/h]),isNaN(this.rotation.toArray().reduce((function(e,t){return e+t}),0))&&this.rotation.identity(),this},e.prototype.toJson=function(){return this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),{box:__spreadArray(__spreadArray(__spreadArray(__spreadArray([],this.center.toArray(),!0),scratchXAxis.multiplyScalar(this.halfSize.x).toArray(),!0),scratchYAxis.multiplyScalar(this.halfSize.y).toArray(),!0),scratchZAxis.multiplyScalar(this.halfSize.z).toArray(),!0)}},e.prototype.copy=function(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this},e.prototype.clone=function(){return(new e).copy(this)},e.prototype.applyMatrix4=function(e){return scratchObject3D.position.copy(this.center),quaternionFromMatrix3(this.rotation,scratchObject3D.quaternion),scratchObject3D.scale.copy(this.halfSize),scratchObject3D.matrix.compose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),scratchObject3D.matrix.premultiply(e),scratchObject3D.matrix.decompose(scratchObject3D.position,scratchObject3D.quaternion,scratchObject3D.scale),this.center.copy(scratchObject3D.position),this.rotation.setFromMatrix4(scratchMatrix4$3.makeRotationFromQuaternion(scratchObject3D.quaternion)),this.halfSize.copy(scratchObject3D.scale),this},e.prototype.getCenter=function(e){return e.copy(this.center)},e.prototype.distanceSquaredTo=function(e){var t,n=this.rotation.elements,r=e.x-this.center.x,i=e.y-this.center.y,o=e.z-this.center.z,a=0;return(t=r*n[0]+i*n[1]+o*n[2])<0&&(t=-t),(t-=this.halfSize.x)>0&&(a+=t*t),(t=r*n[3]+i*n[4]+o*n[5])<0&&(t=-t),(t-=this.halfSize.y)>0&&(a+=t*t),(t=r*n[6]+i*n[7]+o*n[8])<0&&(t=-t),(t-=this.halfSize.z)>0&&(a+=t*t),a},e.prototype.distanceTo=function(e){return Math.sqrt(this.distanceSquaredTo(e))},e.prototype.getBoundingBox=function(e){return e.makeEmpty(),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchXAxis.setLength(this.halfSize.x),scratchYAxis.setLength(this.halfSize.y),scratchZAxis.setLength(this.halfSize.z),e.expandByPoint(scratchVector.copy(this.center).add(scratchXAxis)),e.expandByPoint(scratchVector.copy(this.center).sub(scratchXAxis)),e.expandByPoint(scratchVector.copy(this.center).add(scratchYAxis)),e.expandByPoint(scratchVector.copy(this.center).sub(scratchYAxis)),e.expandByPoint(scratchVector.copy(this.center).add(scratchZAxis)),e.expandByPoint(scratchVector.copy(this.center).sub(scratchZAxis)),e},e.prototype.toGeometry=function(){var e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);scratchVector.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,0),scratchVector.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,3),scratchVector.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,6),scratchVector.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,9),scratchVector.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,12),scratchVector.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,15),scratchVector.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,18),scratchVector.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,21);var n=new THREE__namespace.BufferGeometry;return n.setIndex(new THREE__namespace.BufferAttribute(e,1)),n.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n},e.prototype.intersectPlane=function(e){var t=this.center,n=e.normal,r=this.rotation.elements,i=this.halfSize,o=n.x,a=n.y,s=n.z,c=Math.abs(o*r[0]*i.x+a*r[1]*i.x+s*r[2]*i.x)+Math.abs(o*r[3]*i.y+a*r[4]*i.y+s*r[5]*i.y)+Math.abs(o*r[6]*i.z+a*r[7]*i.z+s*r[8]*i.z),l=n.dot(t)+e.constant;return l<=-c?VolumePlaneIntersect.Outside:l>=c?VolumePlaneIntersect.Inside:VolumePlaneIntersect.Intersecting},e.prototype.intersectRay=function(e,t){scratchSize.copy(this.halfSize).multiplyScalar(2),scratchBox3.setFromCenterAndSize(scratchVector.set(0,0,0),scratchSize),this.rotation.extractBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$3.makeBasis(scratchXAxis,scratchYAxis,scratchZAxis),scratchMatrix4$3.setPosition(this.center),scratchMatrix4Inverse$1.getInverse(scratchMatrix4$3),scratchRay$1.copy(e).applyMatrix4(scratchMatrix4Inverse$1);var n=scratchRay$1.intersectBox(scratchBox3,scratchVector);return!!n&&(void 0===t||n.applyMatrix4(scratchMatrix4$3).distanceTo(e.origin)<t)},e}(),SphereBoundingVolume=function(){function e(){this.type="sphere",this.center=new THREE__namespace.Vector3,this.radius=-1}return e.prototype.fromJson=function(e){var t=e.sphere;return this.center.set(t[0],t[1],t[2]),this.radius=Math.max(t[3],EPSILON$2),this},e.prototype.toJson=function(){return{sphere:__spreadArray(__spreadArray([],this.center.toArray(),!0),[this.radius],!1)}},e.prototype.copy=function(e){return this.center.copy(e.center),this.radius=e.radius,this},e.prototype.clone=function(){return(new e).copy(this)},e.prototype.getBoundingBox=function(e){return e.setFromCenterAndSize(this.center,scratchSize.set(1,1,1).multiplyScalar(2*this.radius)),e},e.prototype.toGeometry=function(){for(var e=32,t=new Float32Array(384),n=0;n<=e;n++){var r=0;r=n/e*Math.PI*2,t[6*n+0]=this.center.x+Math.cos(r)*this.radius,t[6*n+1]=this.center.y+Math.sin(r)*this.radius,t[6*n+2]=this.center.z+0,r=(n+1)/e*Math.PI*2,t[6*n+3]=this.center.x+Math.cos(r)*this.radius,t[6*n+4]=this.center.y+Math.sin(r)*this.radius,t[6*n+5]=this.center.z+0}for(n=e;n<=64;n++){r=0;r=n/e*Math.PI*2,t[6*n+0]=this.center.x+Math.cos(r)*this.radius,t[6*n+1]=this.center.y+0,t[6*n+2]=this.center.z+Math.sin(r)*this.radius,r=(n+1)/e*Math.PI*2,t[6*n+3]=this.center.x+Math.cos(r)*this.radius,t[6*n+4]=this.center.y+0,t[6*n+5]=this.center.z+Math.sin(r)*this.radius}var i=new THREE__namespace.BufferGeometry;return i.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),i.computeBoundingBox(),i.computeBoundingSphere(),i},e.prototype.applyMatrix4=function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},e.prototype.getCenter=function(e){return e.copy(this.center)},e.prototype.distanceSquaredTo=function(e){var t=this.distanceTo(e);return t*t},e.prototype.distanceTo=function(e){var t=this.center.distanceTo(e)-this.radius;return t<=0?0:t},e.prototype.intersectPlane=function(e){var t=this.center,n=this.radius,r=e.normal.dot(t)+e.constant;return r<-n?VolumePlaneIntersect.Outside:r<n?VolumePlaneIntersect.Intersecting:VolumePlaneIntersect.Inside},e.prototype.intersectRay=function(e,t){scratchSphere$1.set(this.center,this.radius);var n=e.intersectSphere(scratchSphere$1,scratchVector);return!!n&&(void 0===t||e.origin.distanceTo(n)<t)},e}(),RegionBoundingVolume=function(){function e(){throw this.type="regin",this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,new Error("Region bounding volume not supported.")}return e.prototype.fromJson=function(e){var t=e.region;return this.west=t[0],this.south=t[1],this.east=t[2],this.north=t[3],this.minHeight=t[4],this.maxHeight=t[5],this},e.prototype.toJson=function(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}},e.prototype.copy=function(e){return this.west=e.west,this.south=e.south,this.east=e.east,this.north=e.north,this.minHeight=e.minHeight,this.maxHeight=e.maxHeight,this},e.prototype.clone=function(){return(new e).copy(this)},e.prototype.getBoundingBox=function(e){throw new Error("not implemented")},e.prototype.toGeometry=function(){throw new Error("not implemented")},e.prototype.applyMatrix4=function(e){throw new Error("not implemented")},e.prototype.getCenter=function(e){throw new Error("not implemented")},e.prototype.distanceTo=function(e){throw new Error("not implemented")},e.prototype.distanceSquaredTo=function(e){throw new Error("not implemented")},e.prototype.intersectPlane=function(e){throw new Error("not implemented")},e.prototype.intersectRay=function(e){throw new Error("not implemented")},e}();function makeBoundingVolume(e){if("box"in e)return(new BoxBoundingVolume).fromJson(e);if("sphere"in e)return(new SphereBoundingVolume).fromJson(e);if("region"in e)return(new RegionBoundingVolume).fromJson(e);throw new Error("BoundingVolume ".concat(JSON.stringify(e)," never suppored."))}var debugMaterials=[2621517,3801199,4915345,5963950,7274706,8782079,9575167,10434047,11623423,12482559,13274879,13870335,14464511,15125247,15852031,16446719].map((function(e){return new THREE__namespace.LineBasicMaterial({color:e,depthWrite:!1,transparent:!0})})),debugBoxGeometry=function(){var e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);scratchVector.set(1,1,1).toArray(t,0),scratchVector.set(-1,1,1).toArray(t,3),scratchVector.set(-1,-1,1).toArray(t,6),scratchVector.set(1,-1,1).toArray(t,9),scratchVector.set(1,1,-1).toArray(t,12),scratchVector.set(-1,1,-1).toArray(t,15),scratchVector.set(-1,-1,-1).toArray(t,18),scratchVector.set(1,-1,-1).toArray(t,21);var n=new THREE__namespace.BufferGeometry;return n.setIndex(new THREE__namespace.BufferAttribute(e,1)),n.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n}(),debugSphereGeometry=function(){for(var e=32,t=new Float32Array(384),n=0;n<=e;n++){var r=0;r=n/e*Math.PI*2,t[6*n+0]=Math.cos(r),t[6*n+1]=Math.sin(r),t[6*n+2]=0,r=(n+1)/e*Math.PI*2,t[6*n+3]=Math.cos(r),t[6*n+4]=Math.sin(r),t[6*n+5]=0}for(n=e;n<=64;n++){r=0;r=n/e*Math.PI*2,t[6*n+0]=Math.cos(r),t[6*n+1]=0,t[6*n+2]=Math.sin(r),r=(n+1)/e*Math.PI*2,t[6*n+3]=Math.cos(r),t[6*n+4]=0,t[6*n+5]=Math.sin(r)}var i=new THREE__namespace.BufferGeometry;return i.setAttribute("position",new THREE__namespace.BufferAttribute(t,3)),i.computeBoundingBox(),i.computeBoundingSphere(),i}();function createDebugBoundingMesh(e,t){var n;if(e instanceof BoxBoundingVolume)return(n=new THREE__namespace.LineSegments(debugBoxGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)])).position.copy(e.center),quaternionFromMatrix3(e.rotation,n.quaternion),n.scale.set(e.halfSize.x,e.halfSize.y,e.halfSize.z),n.matrix.compose(n.position,n.quaternion,n.scale),n;if(e instanceof SphereBoundingVolume)return(n=new THREE__namespace.LineSegments(debugSphereGeometry,debugMaterials[Math.min(t,debugMaterials.length-1)])).position.copy(e.center),n.scale.set(e.radius,e.radius,e.radius),n.matrix.compose(n.position,n.quaternion,n.scale),n;throw new Error("never")}var Tile=function(){function e(t,n,r,i){var o,a,s,c=this;this.parent=null,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,selectionDepth:0,shouldRefine:!1,distanceToCamera:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1},this.parent=null!=i?i:null,this.tileset=r,this.refine=null!==(o=n.refine)&&void 0!==o?o:this.parent?this.parent.refine:"REPLACE",this.transform=new THREE__namespace.Matrix4,n.transform&&this.transform.fromArray(n.transform),this.parent&&this.transform.premultiply(this.parent.transform),"number"==typeof n.geometricError?this.geometricError=n.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=null!==(s=null===(a=this.parent)||void 0===a?void 0:a.geometricError)&&void 0!==s?s:0,n.content&&n.content.uri?(this.content={uri:n.content.uri,loadState:"UNLOADED",byteLength:0},void 0!==n.content.group&&(this.content.group=n.content.group),n.content.boundingVolume&&(this.content.boundingVolume=makeBoundingVolume(n.content.boundingVolume).applyMatrix4(this.transform)),/\.json$/.test(this.content.uri)?this.type="TILESET":this.type="SCENEGRAPH"):(this.content=null,this.type="EMPTY"),n.boundingVolume&&(this.boundingVolume=makeBoundingVolume(n.boundingVolume).applyMatrix4(this.transform)),n.viewerRequestVolume&&(this.viewerRequestVolume=makeBoundingVolume(n.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=n.extras||{},n.children?this.children=n.children.map((function(t,n){return new e("".concat(c.id,".").concat(n),t,r,c)})):this.children=[]}return e.prototype.updateState=function(e){this.state.frameNumber=e.frameNumber;var t=this.tileset.transformIsIdentity?null:this.tileset.transform;if(this.boundingVolume){var n=t?this.boundingVolume.clone().applyMatrix4(t):this.boundingVolume;this.state.distanceToCamera=n.distanceTo(e.camera.position);var r=this.parent?this.parent.state.visibilityPlaneMask:CullingVolume.MASK_INDETERMINATE;this.state.visibilityPlaneMask=e.cullingVolume.computeVisibilityWithPlaneMask(n,r),this.state.visible=this.state.visibilityPlaneMask!==CullingVolume.MASK_OUTSIDE}else this.state.distanceToCamera=0,this.state.visibilityPlaneMask=CullingVolume.MASK_INDETERMINATE,this.state.visible=!0;if(this.viewerRequestVolume){var i=t?this.viewerRequestVolume.clone().applyMatrix4(t):this.viewerRequestVolume;this.state.inRequestVolume=i.distanceSquaredTo(e.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(e,this.state.distanceToCamera,!1)},Object.defineProperty(e.prototype,"selected",{get:function(){return this.state.selectedFrameNumber===this.tileset.frameNumber},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasChildren",{get:function(){return this.children.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"siblingIndex",{get:function(){var e,t;return null!==(t=null===(e=this.parent)||void 0===e?void 0:e.children.indexOf(this))&&void 0!==t?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasTilesetContent",{get:function(){return this.children.length>0&&"TILESET"===this.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRenderContent",{get:function(){return"MESH"===this.type||"SCENEGRAPH"===this.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentAvailable",{get:function(){var e;return this.hasRenderContent&&"READY"===(null===(e=this.content)||void 0===e?void 0:e.loadState)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasUnloadedContent",{get:function(){var e;return"UNLOADED"===(null===(e=this.content)||void 0===e?void 0:e.loadState)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasEmptyContent",{get:function(){return"EMPTY"===this.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentReady",{get:function(){var e;return"READY"===(null===(e=this.content)||void 0===e?void 0:e.loadState)||this.hasEmptyContent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentByteLength",{get:function(){return this.content?this.content.byteLength:0},enumerable:!1,configurable:!0}),e.prototype.loadContent=function(){var e,t=this;if(this.hasEmptyContent||!(null===(e=this.content)||void 0===e?void 0:e.uri))return Promise.resolve(!1);var n=this.content;return n.data?Promise.resolve(!0):(n.loadState="LOADING",this.tileset.requestScheduler.scheduleRequest(this.id,(function(){return t.getPriority()})).then((function(e){return e?t.tileset.options.contentLoader(t).then((function(t){return e.done(),n.loadState=t?"READY":"UNLOADED",t})).catch((function(t){return n.loadState="FAILED",e.done(),Promise.reject(t)})):(n.loadState="UNLOADED",Promise.resolve(!1))})))},e.prototype.unloadContent=function(){return this.content&&(this.content.loadState="UNLOADED",this.content.byteLength=0),!0},e.prototype.getScreenSpaceError=function(e,t,n){var r=this.tileset.transformIsIdentity?1:this.tileset.transform.getMaxScaleOnAxis(),i=this.parent?this.parent.geometricError:this.tileset.geometricError,o=r*(n?i:this.geometricError);if(0===o)return 0;var a=Math.max(t,.001);return o*e.height/(a*e.sseDenominator)},e.prototype.getPriority=function(){var e="ADD"===this.refine||this.tileset.skipLevelOfDetail;if(e&&!this.state.visible)return-1;if(this.tileset.frameNumber-this.state.touchedFrameNumber>=1)return-1;if("UNLOADED"===this.content.loadState)return-1;var t=this.parent,n=t&&(!e||0===this.state.screenSpaceError)?t.state.screenSpaceError:this.state.screenSpaceError,r=this.tileset.root?this.tileset.root.state.screenSpaceError:0;return Math.max(r-n,0)},e}(),RequestScheduler=function(){function e(){this.maxRequests=e.DEFAULT_MAX_REQUESTS,this.activeRequests=0,this.requestQueue=[],this.requestMap=new Map,this.deferred=null}return e.prototype.scheduleRequest=function(e,t){var n=this.requestMap.get(e);if(n)return n;var r={identiy:e,priority:0,getPriority:t,resolve:function(){}},i=new Promise((function(e){return r.resolve=e}));return this.requestQueue.push(r),this.requestMap.set(e,i),this.issueNewRequests(),i},e.prototype.reset=function(){for(var e=0,t=this.requestQueue;e<t.length;e++){t[e].resolve(null)}this.requestQueue.length=0,this.requestMap.clear(),this.activeRequests=0},e.prototype.issueRequest=function(e){var t=this,n=e.identiy,r=e.resolve,i=!1;this.activeRequests++,r({done:function(){i||(i=!0,t.requestMap.delete(n),t.activeRequests--,t.issueNewRequests())}})},e.prototype.issueNewRequests=function(){var e=this;this.deferred||(this.deferred=setTimeout((function(){return e.issueNewRequestsAsync()}),0))},e.prototype.issueNewRequestsAsync=function(){this.deferred=null;var e=Math.max(this.maxRequests-this.activeRequests,0);if(0!==e){this.updateAllRequests();for(var t=0;t<e;t++){var n=this.requestQueue.shift();if(!n)break;this.issueRequest(n)}}},e.prototype.updateAllRequests=function(){for(var e=this.requestQueue,t=0;t<e.length;t++){var n=e[t];!1===this.updateRequest(n)&&(e.splice(t,1),this.requestMap.delete(n.identiy),t--)}e.sort((function(e,t){return e.priority-t.priority}))},e.prototype.updateRequest=function(e){return e.priority=e.getPriority(e.identiy),!(e.priority<0)||(e.resolve(null),!1)},e.DEFAULT_MAX_REQUESTS=6,e}(),CacheNode=function(){return function(e,t,n){this.item=e,this.previous=t,this.next=n}}(),CacheNodeList=function(){function e(){this.head=null,this.tail=null,this._length=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),e.prototype.add=function(e){var t=new CacheNode(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t},e.prototype.remove=function(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--},e.prototype.splice=function(e,t){e!==t&&(this.remove(t),this.insert(e,t))},e.prototype.insert=function(e,t){var n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,this._length++},e.prototype.toArray=function(){for(var e=[],t=this.head;t;)e.push(t),t=t.next;return e},e}(),TilesetCache=function(){function e(){this.cacheNodeMap=new Map,this.list=new CacheNodeList,this.sentinel=this.list.add("sentinel")}return e.prototype.reset=function(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)},e.prototype.touch=function(e){var t=this.cacheNodeMap.get(e);t&&this.list.splice(this.sentinel,t)},e.prototype.add=function(e,t){if(!this.cacheNodeMap.has(e)){var n=this.list.add(e);this.cacheNodeMap.set(e,n),t&&t(e)}},e.prototype.unloadTile=function(e,t){var n=this.cacheNodeMap.get(e);n&&(this.list.remove(n),this.cacheNodeMap.delete(e),t&&t(e))},e.prototype.unloadTiles=function(e,t){for(var n=this.list.head;n!==this.sentinel&&e();){var r=n.item;n=n.next,this.unloadTile(r,t)}},e.prototype.toArray=function(){for(var e=[],t=0,n=this.list.toArray();t<n.length;t++){var r=n[t];"sentinel"!==r.item&&e.push(r.item)}return e},e}(),ManagedArray=function(){function e(){this.map=new Map,this.array=[],this._length=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),e.prototype.get=function(e){return this.array[e]},e.prototype.set=function(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)},e.prototype.delete=function(e){var t=this.map.get(e);void 0!==t&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)},e.prototype.push=function(e){if(!this.map.has(e)){var t=this._length++;this.array[t]=e,this.map.set(e,t)}},e.prototype.pop=function(){var e=this.array[--this._length];return this.map.delete(e),e},e.prototype.reset=function(){this.array=[],this.map=new Map,this._length=0},e.prototype.find=function(e){return this.map.has(e)},e}(),TilesetTraverser=function(){function e(){this.loadSiblings=e.DEFAULT_LOAD_SIBLINGS,this.skipLevelOfDetail=e.DEFAULT_SKIP_LEVEL_OF_DETAIL,this.maxScreenSpaceError=e.DEFAULT_MAX_SCREEN_SPACE_ERROR,this._canSelectTile=!0,this._traversalStack=new ManagedArray,this._emptyTraversalStack=new ManagedArray,this.root=null,this.selectedTiles=new Map,this.requestedTiles=new Map,this.needsRefinedTiles=new Map,this.emptyTiles=new Map}return e.prototype.traverse=function(e,t,n){void 0===n&&(n=[]),this.root=e,this.reset();for(var r=0,i=n;r<i.length;r++){var o=i[r];this._traversalStack.reset(),this._emptyTraversalStack.reset(),this._canSelectTile=o.camera.visible,this.updateTile(e,o),this.executeTraversal(e,o)}this._traversalStack.reset(),this._emptyTraversalStack.reset(),this._canSelectTile=!0,this.updateTile(e,t),this.executeTraversal(e,t)},e.prototype.reset=function(){this.needsRefinedTiles.clear(),this.requestedTiles.clear(),this.selectedTiles.clear(),this.emptyTiles.clear(),this._traversalStack.reset(),this._emptyTraversalStack.reset()},e.prototype.executeTraversal=function(e,t){var n=this._traversalStack;if(e.state.selectionDepth=0,t.maxLevelOfDetail>=0)for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){var r=n.pop(),i=!1;if(this.canTraverse(r,t,!1,!1)){var o=r.hasRenderContent?r.state.selectionDepth+1:r.state.selectionDepth;this.updateChildTiles(r,t,o),i=this.updateAndPushChildren(r,t,n)}var a=r.parent,s=!a||a.state.shouldRefine,c=!i;r.hasRenderContent?"ADD"===r.refine?(this.loadTile(r,t.frameNumber),this.selectTile(r,t)):"REPLACE"===r.refine&&(this.loadTile(r,t.frameNumber),c&&this.selectTile(r,t)):(this.emptyTiles.set(r.id,r),this.loadTile(r,t.frameNumber),c&&this.selectTile(r,t)),this.touchTile(r,t),r.state.shouldRefine=i&&s}},e.prototype.updateChildTiles=function(e,t,n){for(var r=0,i=e.children;r<i.length;r++){var o=i[r];o.state.selectionDepth=n,this.updateTile(o,t)}return!0},e.prototype.updateAndPushChildren=function(e,t,n){for(var r=e.children,i="REPLACE"===e.refine&&e.hasRenderContent&&!this.skipLevelOfDetail,o=!1,a=!0,s=0,c=r;s<c.length;s++){var l=c[s];if(l.state.visible&&l.state.inRequestVolume?(n.find(l)&&n.delete(l),n.push(l),o=!0):(i||this.loadSiblings)&&(this.loadTile(l,t.frameNumber),this.touchTile(l,t)),i){var u=void 0;u=!!l.state.inRequestVolume&&(l.hasRenderContent?l.contentAvailable:this.executeEmptyTraversal(l,t)),a=a&&u}}return o||(a=!1),a},e.prototype.updateTile=function(e,t){this.updateTileVisibility(e,t)},e.prototype.selectTile=function(e,t){this.shouldSelectTile(e)&&(e.state.selectedFrameNumber=t.frameNumber,this.selectedTiles.set(e.id,e)),this.needsRefinedTiles.set(e.id,e)},e.prototype.loadTile=function(e,t){this.shouldLoadTile(e)&&(e.state.requestedFrameNumber=t,this.requestedTiles.set(e.id,e)),this.needsRefinedTiles.set(e.id,e)},e.prototype.touchTile=function(e,t){e.tileset.cache.touch(e),e.state.touchedFrameNumber=t.frameNumber},e.prototype.canTraverse=function(e,t,n,r){return!!e.hasChildren&&(!!e.hasTilesetContent||!(!r&&!e.state.visible)&&this.shouldRefine(e,t,n))},e.prototype.shouldLoadTile=function(e){return e.hasUnloadedContent},e.prototype.shouldSelectTile=function(e){return e.contentAvailable&&!this.skipLevelOfDetail&&this._canSelectTile},e.prototype.shouldRefine=function(e,t,n){if(e.hasEmptyContent)return!0;if(e.hasRenderContent){if(e.state.selectionDepth>=t.maxLevelOfDetail)return!1;if(e.state.selectionDepth<t.minLevelOfDetail)return!0}var r=e.state.screenSpaceError;return n&&(r=e.getScreenSpaceError(t,e.state.distanceToCamera,!0)),r>this.maxScreenSpaceError},e.prototype.updateTileVisibility=function(e,t){if(e.updateState(t),e.state.visible&&e.state.inRequestVolume){var n=e.children.length>0;if(e.hasTilesetContent&&n){var r=e.children[0];return this.updateTileVisibility(r,t),void(e.state.visible=r.state.visible)}this.meetsScreenSpaceErrorEarly(e,t)&&(e.state.visible=!1)}},e.prototype.meetsScreenSpaceErrorEarly=function(e,t){var n=e.parent;return!(!n||"ADD"!==n.refine)&&!this.shouldRefine(e,t,!0)},e.prototype.compareDistanceToCamera=function(e,t){return t.state.distanceToCamera-e.state.distanceToCamera},e.prototype.executeEmptyTraversal=function(e,t){var n=!0,r=this._emptyTraversalStack;for(r.push(e);r.length>0&&n;){var i=r.pop();if(this.updateTile(i,t),i.state.visible||this.loadTile(i,t.frameNumber),this.touchTile(i,t),!i.hasRenderContent&&this.canTraverse(i,t,!1,!0))for(var o=0,a=i.children;o<a.length;o++){var s=a[o];r.find(s)&&r.delete(s),r.push(s)}else i.contentAvailable||(n=!1)}return n},e.DEFAULT_SKIP_LEVEL_OF_DETAIL=!1,e.DEFAULT_LOAD_SIBLINGS=!1,e.DEFAULT_MAX_SCREEN_SPACE_ERROR=4,e}(),identityMatrix4=new THREE__namespace.Matrix4,Tileset=function(){function e(t,n,r){var i,o;this.id=t,this.transform=new THREE__namespace.Matrix4,this.transformIsIdentity=!0,this.asset={version:n.asset.version,tilesetVersion:n.asset.tilesetVersion||"",gltfUpAxis:null!==(i=n.asset.gltfUpAxis)&&void 0!==i?i:"Y",overview:n.asset.overview},this.properties=null!==(o=n.properties)&&void 0!==o?o:{},this.options=r,this.traverser=new TilesetTraverser,this.cache=new TilesetCache,this.requestScheduler=new RequestScheduler,this.frameNumber=0,this.pendingCount=0,this.tiles=new Map,this.memoryUsageInBytes=0,this.root=new Tile("".concat(this.id,".0"),n.root,this),this.geometricError=n.geometricError,this.maxMemoryUsage=e.DEFAULT_MAX_MEMORY_USAGE}return Object.defineProperty(e.prototype,"maxRequests",{get:function(){return this.requestScheduler.maxRequests},set:function(e){this.requestScheduler.maxRequests=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skipLevelOfDetail",{get:function(){return this.traverser.skipLevelOfDetail},set:function(e){this.traverser.skipLevelOfDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScreenSpaceError",{get:function(){return this.traverser.maxScreenSpaceError},set:function(e){this.traverser.maxScreenSpaceError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectedTiles",{get:function(){return this.traverser.selectedTiles},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needsRefinedTiles",{get:function(){return this.traverser.needsRefinedTiles},enumerable:!1,configurable:!0}),e.prototype.reset=function(){for(var e,t=this,n=[this.root];e=n.pop();){for(var r=0,i=e.children.length;r<i;r++)n.push(e.children[r]);this.cache.unloadTile(e,(function(e){return t.unloadTile(e)}))}this.cache.reset(),this.traverser.reset(),this.requestScheduler.reset(),this.tiles.clear()},e.prototype.isLoaded=function(){return 0===this.pendingCount&&0!==this.frameNumber},e.prototype.traverse=function(e,t){var n=this;void 0===t&&(t=[]),this.transformIsIdentity=this.transform.equals(identityMatrix4),this.traverser.traverse(this.root,e,t),this.selectedTiles.forEach((function(e){n.tiles.set(e.id,e)})),this.traverser.requestedTiles.forEach((function(e){e.hasUnloadedContent&&n.loadTile(e)})),this.cache.unloadTiles((function(){return n.memoryUsageInBytes>1024*n.maxMemoryUsage*1024}),(function(e){n.unloadTile(e),n.tiles.delete(e.id)}))},e.prototype.loadTile=function(e){var t=this;this.pendingCount++,e.loadContent().catch((function(n){return t.options.onTileError(e,n),!1})).then((function(n){var r;t.pendingCount--,n&&((null===(r=e.content)||void 0===r?void 0:r.data)&&t.cache.add(e,(function(){t.memoryUsageInBytes+=e.contentByteLength})),t.options.onTileLoad(e))}))},e.prototype.unloadTile=function(e){this.memoryUsageInBytes-=e.contentByteLength,this.options.onTileUnload(e),e.unloadContent()},e.DEFAULT_VIEW_DISTANCE_SCALE=1,e.DEFAULT_MAX_MEMORY_USAGE=16,e.DEFAULT_MAX_SCREEN_SPACE_ERROR=TilesetTraverser.DEFAULT_MAX_SCREEN_SPACE_ERROR,e.DEFAULT_MAX_REQUESTS=RequestScheduler.DEFAULT_MAX_REQUESTS,e}(),BVHNode=function(){return function(e,t,n,r){this.extents=e,this.startIndex=t,this.endIndex=n,this.deepth=r}}();function intersectNodeBox(e,t,n,r){void 0===r&&(r=0);var i=n.extents[0]-r,o=n.extents[1]-r,a=n.extents[2]-r,s=n.extents[3]+r,c=n.extents[4]+r,l=n.extents[5]+r,u={min:0,max:0};t.x>=0?(u.min=(i-e.x)*t.x,u.max=(s-e.x)*t.x):(u.min=(s-e.x)*t.x,u.max=(i-e.x)*t.x);var p={min:0,max:0};if(t.y>=0?(p.min=(o-e.y)*t.y,p.max=(c-e.y)*t.y):(p.min=(c-e.y)*t.y,p.max=(o-e.y)*t.y),u.min>p.max||p.min>u.max)return!1;p.min>u.min&&(u.min=p.min),p.max<u.max&&(u.max=p.max);var d={min:0,max:0};return t.z>=0?(d.min=(a-e.z)*t.z,d.max=(l-e.z)*t.z):(d.min=(l-e.z)*t.z,d.max=(a-e.z)*t.z),!(u.min>d.max||d.min>u.max)&&(d.min>u.min&&(u.min=d.min),d.max<u.max&&(u.max=d.max),!(u.max<0))}var BVHVector3=function(){function e(e,t,n){this.x=e,this.y=t,this.z=n}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},e.prototype.set=function(e,t,n){return this.x=e,this.y=t,this.z=n,this},e.prototype.fromArray=function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},e.prototype.toArray=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},e.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},e.prototype.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},e.prototype.addScaledVector=function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},e.prototype.cross=function(e){var t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this},e.prototype.crossVectors=function(e,t){var n=e.x,r=e.y,i=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},e.prototype.distanceTo=function(e){return Math.sqrt(this.distanceToSquared(e))},e.prototype.distanceToSquared=function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e}(),BVHIntersect=function(){return function(e,t,n){this.triangle=e,this.intersectionPoint=t,this.index=n}}(),EPSILON$1=1e-6,BVHMesh=function(){function e(e,t){if(this.positionArray=e,t)this.indicesArray=t;else{for(var n=e.length/3,r=n>65535?new Uint32Array(n):new Uint16Array(n),i=0;i<n;i++)r[i]=i;this.indicesArray=r}}return e.prototype.createTree=function(e,t,n){var r=this.positionArray,i=this.indicesArray,o=i.length/3,a=o>65535?new Uint32Array(o):new Uint16Array(o),s=new Float32Array(6*o),c=[],l=0;if(n)for(var u=0,p=0,d=0,h=void 0,f=void 0,m=void 0,v=void 0,A=void 0,g=void 0,y=void 0;u<o;u+=1,p+=3,d+=6)a[u]=u,h=v=r[3*i[p]],(y=r[3*i[p+1]])<h&&(h=y),y>v&&(v=y),(y=r[3*i[p+2]])<h&&(h=y),y>v&&(v=y),f=A=r[3*i[p]+1],(y=r[3*i[p+1]+1])<f&&(f=y),y>A&&(A=y),(y=r[3*i[p+2]+1])<f&&(f=y),y>A&&(A=y),m=g=r[3*i[p]+2],(y=r[3*i[p+1]+2])<m&&(m=y),y>g&&(g=y),(y=r[3*i[p+2]+2])<m&&(m=y),y>g&&(g=y),s[d]=h,s[d+1]=f,s[d+2]=m,s[d+3]=v,s[d+4]=A,s[d+5]=g;else{var b=1/0,E=1/0,_=1/0,T=-1/0,x=-1/0,R=-1/0;for(u=0,p=0,d=0,h=void 0,f=void 0,m=void 0,v=void 0,A=void 0,g=void 0,y=void 0;u<o;u+=1,p+=3,d+=6)a[u]=u,h=v=r[3*i[p]],(y=r[3*i[p+1]])<h&&(h=y),y>v&&(v=y),(y=r[3*i[p+2]])<h&&(h=y),y>v&&(v=y),f=A=r[3*i[p]+1],(y=r[3*i[p+1]+1])<f&&(f=y),y>A&&(A=y),(y=r[3*i[p+2]+1])<f&&(f=y),y>A&&(A=y),m=g=r[3*i[p]+2],(y=r[3*i[p+1]+2])<m&&(m=y),y>g&&(g=y),(y=r[3*i[p+2]+2])<m&&(m=y),y>g&&(g=y),s[d]=h,s[d+1]=f,s[d+2]=m,s[d+3]=v,s[d+4]=A,s[d+5]=g,h<b&&(b=h),v>T&&(T=v),f<E&&(E=f),A>x&&(x=A),m<_&&(_=m),g>R&&(R=g);n=[b,E,_,T,x,R]}var w=new BVHNode(n,0,o,0);c[l++]=w;var M=[],S=[0,1,2],C=function(e,t){return M[t]-M[e]};function I(n){var r=n.startIndex,i=n.endIndex,o=n.extents;M[0]=o[3]-o[0],M[1]=o[4]-o[1],M[2]=o[5]-o[2],S.sort(C);for(var u=0;u<3;u++){for(var p=S[u],d=o[p]+o[p+3],h=r,f=i-1,m=-1,v=void 0;h<=f;)-1===m?(v=a[h],s[6*v+p]+s[6*v+p+3]<d?h++:m=v):(v=a[f],s[6*v+p]+s[6*v+p+3]>=d||(a[h]=v,a[f]=m,m=-1,h++),f--);if(h>r&&h<i){var A=new BVHNode(calcExtents(a,s,r,h,EPSILON$1),r,h,n.deepth+1);A.deepth<t&&A.endIndex-A.startIndex>e&&(c[l++]=A);var g=new BVHNode(calcExtents(a,s,h,i,EPSILON$1),h,i,n.deepth+1);g.deepth<t&&g.endIndex-g.startIndex>e&&(c[l++]=g),n.node0=A,n.node1=g,n.startIndex=0,n.endIndex=0;break}}}for(;l;)I(c[--l]);return this.offsetArray=a,this.rootNode=w,c.length=0,this},e.prototype.trianglesInSphere=function(e,t){for(var n,r=this.positionArray,i=this.indicesArray,o=this.offsetArray,a=[this.rootNode],s=[];n=a.pop();){var c=clamp$1(e.x,n.extents[0],n.extents[3])-e.x,l=clamp$1(e.y,n.extents[1],n.extents[4])-e.y,u=clamp$1(e.z,n.extents[2],n.extents[5])-e.z;if(c*c+l*l+u*u<=t*t){n.node0&&a.push(n.node0),n.node1&&a.push(n.node1);for(var p=n.startIndex;p<n.endIndex;p++)s.push(o[p])}}var d=s.length,h=new Float32Array(9*d);for(p=0;p<d;p++){var f=s[p];h[9*p]=r[3*i[f]],h[9*p+1]=r[3*i[f]+1],h[9*p+2]=r[3*i[f]+2],h[9*p+3]=r[3*i[f+1]],h[9*p+4]=r[3*i[f+1]+1],h[9*p+5]=r[3*i[f+1]+2],h[9*p+6]=r[3*i[f+2]],h[9*p+7]=r[3*i[f+2]+1],h[9*p+8]=r[3*i[f+2]+2]}return h},e.prototype.intersectRay=function(e,t,n){for(var r,i=this.positionArray,o=this.indicesArray,a=this.offsetArray,s=this.rootNode,c=new BVHVector3(1/t.x,1/t.y,1/t.z),l=[s];r=l.pop();)if(intersectNodeBox(e,c,r)){for(var u=r.startIndex,p=r.endIndex,d=void 0,h=void 0,f=void 0,m=e.x,v=e.y,A=e.z,g=t.x,y=t.y,b=t.z,E=void 0,_=void 0,T=void 0,x=void 0,R=void 0,w=void 0,M=void 0,S=void 0,C=void 0,I=void 0,P=void 0,B=void 0,O=void 0,k=void 0,H=void 0,F=void 0,L=void 0,D=void 0,N=void 0,V=void 0,U=void 0,Q=void 0,z=void 0,j=void 0,q=void 0,G=void 0,K=void 0;u<p;u++){if(E=i[f=3*o[h=3*(d=a[u])]],_=i[++f],T=i[++f],x=i[f=3*o[h+1]],R=i[++f],w=i[++f],M=i[f=3*o[h+2]],S=i[++f],(z=g*(F=(P=R-_)*(H=(C=i[++f])-T)-(B=w-T)*(k=S-_))+y*(L=B*(O=M-E)-(I=x-E)*H)+b*(D=I*k-P*O))>0)Q=1;else{if(!(z<0))continue;Q=-1,z=-z}(j=Q*(g*((V=v-_)*H-(U=A-T)*k)+y*(U*O-(N=m-E)*H)+b*(N*k-V*O)))<0||((q=Q*(g*(P*U-B*V)+y*(B*N-I*U)+b*(I*V-P*N)))<0||j+q>z||(G=-Q*(N*F+V*L+U*D))<0||(K=G/z,n.push(new BVHIntersect([E,_,T,x,R,w,M,S,C],[m+g*K,v+y*K,A+b*K],d))))}r.node0&&l.push(r.node0),r.node1&&l.push(r.node1)}return n},e}();function clamp$1(e,t,n){return e<t?t:e>n?n:e}function calcExtents(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];for(var o=1/0,a=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0,p=n,d=void 0,h=void 0;p<r;p++)(h=t[d=6*e[p]])<o&&(o=h),(h=t[d+1])<a&&(a=h),(h=t[d+2])<s&&(s=h),(h=t[d+3])>c&&(c=h),(h=t[d+4])>l&&(l=h),(h=t[d+5])>u&&(u=h);return[o-i,a-i,s-i,c+i,l+i,u+i]}var EPSILON=1e-6,BVHPoints=function(){function e(e,t){this.positionArray=e,this.indicesArray=t}return e.prototype.createTree=function(e,t,n){var r=this.positionArray,i=this.indicesArray,o=i?i.length:r.length/3,a=o>65535?new Uint32Array(o):new Uint16Array(o),s=[],c=0;if(n)for(var l=0;l<o;l+=1)a[l]=l;else{for(var u=i?3*i[0]:0,p=r[u],d=r[u+1],h=r[u+2],f=p,m=d,v=h,A=(l=0,0),g=void 0,y=void 0,b=void 0;l<o;l+=1,A+=3)a[l]=l,u=3*(i?i[A]:A),(g=r[u])<p?p=g:g>f&&(f=g),(y=r[u+1])<d?d=y:y>m&&(m=y),(b=r[u+2])<h?h=b:b>v&&(v=b);n=[p,d,h,f,m,v]}var E=new BVHNode(n,0,o,0);s[c++]=E;var _=[],T=[0,1,2],x=function(e,t){return _[t]-_[e]};function R(n){var o=n.startIndex,l=n.endIndex,u=n.extents;_[0]=u[3]-u[0],_[1]=u[4]-u[1],_[2]=u[5]-u[2];for(var p,d,h=T.sort(x)[0],f=(u[h]+u[h+3])/2,m=o,v=l-1,A=-1;m<=v;)-1===A?(p=a[m],d=3*(i?i[p]:p),r[d+h]<f?m++:A=p):(p=a[v],d=3*(i?i[p]:p),r[d+h]>=f||(a[m]=p,a[v]=A,A=-1,m++),v--);if(m>o){var g=u.slice();g[h+3]=f+EPSILON;var y=new BVHNode(g,o,m,n.deepth+1);y.deepth<t&&y.endIndex-y.startIndex>e&&(s[c++]=y),n.node0=y}if(l>m){var b=u.slice();b[h]=f-EPSILON;var E=new BVHNode(b,m,l,n.deepth+1);E.deepth<t&&E.endIndex-E.startIndex>e&&(s[c++]=E),n.node1=E}n.startIndex=0,n.endIndex=0}for(;c;)R(s[--c]);return this.offsetArray=a,this.rootNode=E,s.length=0,this},e.prototype.intersectRay=function(e,t,n,r){for(var i,o=this.positionArray,a=this.indicesArray,s=this.offsetArray,c=this.rootNode,l=n*n,u=new BVHVector3(1/t.x,1/t.y,1/t.z),p=[c];i=p.pop();)if(intersectNodeBox(e,u,i,n)){for(var d=i.startIndex,h=i.endIndex,f=void 0,m=void 0,v=void 0,A=void 0,g=void 0,y=void 0,b=void 0,E=void 0,_=void 0,T=void 0,x=void 0,R=void 0;d<h;d++)f=s[d],v=o[m=3*(a?a[f]:f)],A=o[++m],g=o[++m],y=e.x,b=e.y,E=e.z,(R=(_=t.x)*(v-y)+(T=t.y)*(A-b)+(x=t.z)*(g-E))>0&&(y+=_*R,b+=T*R,E+=x*R),(R=(_=v-y)*_+(T=A-b)*T+(x=g-E)*x)<=l&&r.push(new BVHIntersect([v,A,g,v,A,g,v,A,g],[y,b,E],f));i.node0&&p.push(i.node0),i.node1&&p.push(i.node1)}return r},e}(),bvhMeshMap=new Map,bvhPointsMap=new Map,scratchRay=new THREE__namespace.Ray,scratchNormalMatrix=new THREE__namespace.Matrix3,scratchInverseMatrix=new THREE__namespace.Matrix4,scratchIntersectionFaceA$1=new THREE__namespace.Vector3,scratchIntersectionFaceB$1=new THREE__namespace.Vector3,scratchIntersectionFaceC$1=new THREE__namespace.Vector3,scratchIntersectionTriangle=new THREE__namespace.Triangle;function raycastMesh(e,t,n,r){var i,o=e.matrixWorld;scratchInverseMatrix.getInverse(o),scratchRay.copy(n.ray).applyMatrix4(scratchInverseMatrix);for(var a=t.intersectRay(scratchRay.origin,scratchRay.direction,[]),s=e.geometry,c=e.material,l=s.groups,u=s.index,p=0,d=a.length;p<d;p++){var h=a[p],f=h.triangle,m=h.index,v=h.intersectionPoint,A=new THREE__namespace.Vector3(v[0],v[1],v[2]).applyMatrix4(o),g=n.ray.origin.distanceTo(A);if(!(g<n.near||g>n.far)){var y=void 0;if(Array.isArray(c)){if(l)for(var b=3*m,E=0,_=l;E<_.length;E++){var T=_[E];if(b>=T.start&&b-T.start<T.count){y=c[null!==(i=T.materialIndex)&&void 0!==i?i:0];break}}}else y=c;if(y){var x=scratchIntersectionTriangle.set(scratchIntersectionFaceA$1.set(f[0],f[1],f[2]).applyMatrix4(o),scratchIntersectionFaceB$1.set(f[3],f[4],f[5]).applyMatrix4(o),scratchIntersectionFaceC$1.set(f[6],f[7],f[8]).applyMatrix4(o)).getNormal(new THREE__namespace.Vector3),R=3*m,w=new THREE__namespace.Face3(u?u.array[R]:R,u?u.array[R+1]:R+1,u?u.array[R+2]:R+2,x),M=n.ray.direction.dot(x);y.side===THREE__namespace.FrontSide&&M>=0||y.side===THREE__namespace.BackSide&&M<=0||r.push({distance:g,object:e,face:w,point:A,distanceToRay:0,faceIndex:m})}}}}function raycastPoints(e,t,n,r){var i,o,a=e.matrixWorld;scratchNormalMatrix.getNormalMatrix(a),scratchInverseMatrix.getInverse(a);var s=(null!==(o=null===(i=n.params.Points)||void 0===i?void 0:i.threshold)&&void 0!==o?o:1)*scratchInverseMatrix.getMaxScaleOnAxis();scratchRay.copy(n.ray).applyMatrix4(scratchInverseMatrix);for(var c=t.intersectRay(scratchRay.origin,scratchRay.direction,s,[]),l=e.geometry,u=l.index,p=l.getAttribute("normal"),d=0,h=c.length;d<h;d++){var f=c[d],m=f.triangle,v=f.index,A=f.intersectionPoint,g=new THREE__namespace.Vector3(A[0],A[1],A[2]).applyMatrix4(a),y=n.ray.origin.distanceTo(g);if(!(y<n.near||y>n.far)){var b=scratchIntersectionFaceA$1.set(m[0],m[1],m[2]).applyMatrix4(a),E=u?u.array[v]:v,_=void 0;p instanceof THREE__namespace.BufferAttribute&&(_=(new THREE__namespace.Vector3).fromBufferAttribute(p,E).applyNormalMatrix(scratchNormalMatrix));var T=new THREE__namespace.Face3(E,E,E,_);r.push({distance:y,object:e,face:T,point:g,distanceToRay:g.distanceTo(b),index:v})}}}function generateBvhTreeForMesh(e,t,n){var r;if(void 0===t&&(t=100),void 0===n&&(n=10),e.geometry instanceof THREE__namespace.BufferGeometry){var i=e.geometry.getAttribute("position");if(i instanceof THREE__namespace.BufferAttribute){var o=e.raycast,a=function(e,t){var n=bvhMeshMap.get(this);n?raycastMesh(this,n,e,t):o.call(this,e,t)};e.raycast=a;var s=i.array,c=null===(r=e.geometry.getIndex())||void 0===r?void 0:r.array,l=e.geometry.boundingBox,u=l?[l.min.x,l.min.y,l.min.z,l.max.x,l.max.y,l.max.z]:void 0,p=new BVHMesh(s,c);return p.createTree(t,n,u),bvhMeshMap.set(e,p),function(){bvhMeshMap.delete(e),e.raycast===a&&(e.raycast=o)}}}return function(){}}function generateBvhTreeForPoints(e,t,n){var r;if(void 0===t&&(t=100),void 0===n&&(n=10),e.geometry instanceof THREE__namespace.BufferGeometry){var i=e.geometry.getAttribute("position");if(i instanceof THREE__namespace.BufferAttribute){var o=e.raycast,a=function(e,t){var n=bvhPointsMap.get(this);n?raycastPoints(this,n,e,t):o.call(this,e,t)};e.raycast=a;var s=i.array,c=null===(r=e.geometry.getIndex())||void 0===r?void 0:r.array,l=e.geometry.boundingBox,u=l?[l.min.x,l.min.y,l.min.z,l.max.x,l.max.y,l.max.z]:void 0,p=new BVHPoints(s,c);return p.createTree(t,n,u),bvhPointsMap.set(e,p),function(){bvhPointsMap.delete(e),e.raycast===a&&(e.raycast=o)}}}return function(){}}function generateBvhTree(e,t,n){void 0===t&&(t=100),void 0===n&&(n=10);var r=[];return e.traverse((function(e){if(e instanceof THREE__namespace.Mesh){var i=generateBvhTreeForMesh(e,t,n);r.push(i)}else if(e instanceof THREE__namespace.Points){i=generateBvhTreeForPoints(e,t,n);r.push(i)}})),function(){for(var e=0,t=r;e<t.length;e++){(0,t[e])()}}}var scratchIntersectionFaceA=new THREE__namespace.Vector3,scratchIntersectionFaceB=new THREE__namespace.Vector3,scratchIntersectionFaceC=new THREE__namespace.Vector3,TileNode=function(e){function t(t,n){var r=e.call(this)||this;r.renderOrder=-4;var i=generateBvhTree(t,200,10);return r.disposers=[n,i],r.add(t),r}return __extends(t,e),t.prototype.intersectRaycaster=function(e,t,n){var r=this;void 0===t&&(t=!0),void 0===n&&(n=[]);for(var i,o=this.children.slice();i=o.pop();)if(i.visible){i.raycast(e,n);for(var a=0,s=i.children.length;a<s;a++)o.push(i.children[a])}return n.forEach((function(e){var t,n,i=0;if((e.object instanceof PBMMesh||e.object instanceof PBMPointCloud)&&e.face){var o=Array.isArray(e.object.material)?e.object.material[e.face.materialIndex]:e.object.material;if(o)if(o.defines.USE_VERTEX_FLOOR){var a=null===(t=e.object.geometry.attributes.position)||void 0===t?void 0:t.array,s=null===(n=e.object.geometry.attributes.floor)||void 0===n?void 0:n.array;if(a&&s){var c=scratchIntersectionFaceA.set(a[3*e.face.a],a[3*e.face.a+1],a[3*e.face.a+2]).applyMatrix4(r.matrixWorld),l=scratchIntersectionFaceB.set(a[3*e.face.b],a[3*e.face.b+1],a[3*e.face.b+2]).applyMatrix4(r.matrixWorld),u=scratchIntersectionFaceC.set(a[3*e.face.c],a[3*e.face.c+1],a[3*e.face.c+2]).applyMatrix4(r.matrixWorld),p=e.point.distanceTo(c),d=e.point.distanceTo(l),h=e.point.distanceTo(u);i=Math.round((p*s[e.face.a]+d*s[e.face.b]+h*s[e.face.c])/(p+d+h))}}else i=o.floor}e.floor=i})),t&&n.sort((function(e,t){return e.distance-t.distance})),n},t.prototype.dispose=function(){for(var e=0,t=this.disposers;e<t.length;e++){(0,t[e])()}this.disposers.length=0},t}(THREE__namespace.Group);function pathJoin(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=[];e=e.map((function(e){return(null!=e?e:"").trim()})).filter((function(e){return e.length>0&&!/^\/+$/.test(e)}));for(var r=0;r<e.length;r++){var i=0===r,o=r===e.length-1,a=e[r];i||(a=a.replace(/^\.\//,"").replace(/^\/+/,"")),o||(a=a.replace(/\/+$/,"")),n.push(a)}return n.join("/")}function isAbsoluteURL(e){return 0===e.indexOf("//")||/^[0-9a-z]+\:/i.test(e)}function normalizeTileHeader(e,t){if(e.content&&e.content.uri&&(isAbsoluteURL(e.content.uri)||(e.content.uri=pathJoin(t,e.content.uri))),e.children)for(var n=0,r=e.children;n<r.length;n++){normalizeTileHeader(r[n],t)}return e}function normalizeTilesetHeader(e,t){return e.asset.overview&&(isAbsoluteURL(e.asset.overview.imageFile)||(e.asset.overview.imageFile=pathJoin(t,e.asset.overview.imageFile)),isAbsoluteURL(e.asset.overview.worldFile)||(e.asset.overview.worldFile=pathJoin(t,e.asset.overview.worldFile))),normalizeTileHeader(e.root,t),e}function appendSearch(e,t){return"?"!==t[0]&&"&"!==t[0]||(t=t.slice(1)),t?("?"!==e[e.length-1]&&"&"!==e[e.length-1]||(e=e.slice(0,-1)),e.indexOf("?")>=0?"".concat(e,"&").concat(t):"".concat(e,"?").concat(t)):e}var SIZEOF_UINT32$1=4,_a$2,GL_TYPE,GL_TYPE2;function parseHeader(e,t,n){var r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=SIZEOF_UINT32$1,e.version=r.getUint32(n,!0),n+=SIZEOF_UINT32$1,e.byteLength=r.getUint32(n,!0),n+=SIZEOF_UINT32$1,1!==e.version)throw new Error("3D Tile Version ".concat(e.version," not supported"));return n}GL_TYPE2=GL_TYPE||(GL_TYPE={}),GL_TYPE2[GL_TYPE2.BYTE=5120]="BYTE",GL_TYPE2[GL_TYPE2.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",GL_TYPE2[GL_TYPE2.SHORT=5122]="SHORT",GL_TYPE2[GL_TYPE2.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",GL_TYPE2[GL_TYPE2.INT=5124]="INT",GL_TYPE2[GL_TYPE2.UNSIGNED_INT=5125]="UNSIGNED_INT",GL_TYPE2[GL_TYPE2.FLOAT=5126]="FLOAT",GL_TYPE2[GL_TYPE2.DOUBLE=5130]="DOUBLE";var GL_TYPE_TO_ARRAY_TYPE=(_a$2={},_a$2[GL_TYPE.DOUBLE]=Float64Array,_a$2[GL_TYPE.FLOAT]=Float32Array,_a$2[GL_TYPE.UNSIGNED_SHORT]=Uint16Array,_a$2[GL_TYPE.UNSIGNED_INT]=Uint32Array,_a$2[GL_TYPE.UNSIGNED_BYTE]=Uint8Array,_a$2[GL_TYPE.BYTE]=Int8Array,_a$2[GL_TYPE.SHORT]=Int16Array,_a$2[GL_TYPE.INT]=Int32Array,_a$2),NAME_TO_GL_TYPE={DOUBLE:GL_TYPE.DOUBLE,FLOAT:GL_TYPE.FLOAT,UNSIGNED_SHORT:GL_TYPE.UNSIGNED_SHORT,UNSIGNED_INT:GL_TYPE.UNSIGNED_INT,UNSIGNED_BYTE:GL_TYPE.UNSIGNED_BYTE,BYTE:GL_TYPE.BYTE,SHORT:GL_TYPE.SHORT,INT:GL_TYPE.INT};function getArrayType(e){var t=GL_TYPE_TO_ARRAY_TYPE[e];if(!t)throw new Error("Failed to convert GL type");return t}function getByteSize(e){return getArrayType(e).BYTES_PER_ELEMENT}function createTypedArray(e,t,n,r){void 0===n&&(n=0);var i=getArrayType(e);return n%getByteSize(e)!=0?new i(r?t.slice(n,n+r*getByteSize(e)):t.slice(n)):new i(t,n,null!=r?r:(t.byteLength-n)/getByteSize(e))}function glTypeFromName(e){var t=NAME_TO_GL_TYPE[e];if(!t)throw new Error("Failed to convert GL type");return t}var FeatureTable=function(){function e(e,t){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=t;var n=this.getGlobalProperty("POINTS_LENGTH",GL_TYPE.UNSIGNED_INT,1);n&&n.length&&(this.featuresLength=n[0])}return e.prototype.getExtension=function(e){return this.json.extensions&&this.json.extensions[e]},e.prototype.hasProperty=function(e){return Boolean(this.json[e])},e.prototype.getGlobalProperty=function(e,t,n){var r=this.json[e];return"number"==typeof r?new(getArrayType(t))([r]):Array.isArray(r)?new(getArrayType(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null},e.prototype.getPropertyArray=function(e,t,n){var r=this.json[e];return r&&Number.isFinite(r.byteOffset)?("componentType"in r&&(t=glTypeFromName(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)},e.prototype.getProperty=function(e,t,n,r,i){if(!this.json[e])return null;var o=this.getPropertyArray(e,t,n);if(1===n)return i[0]=o[r],i;for(var a=0;a<n;++a)i[a]=o[n*r+a];return i},e.prototype.getTypedArrayFromBinary=function(e,t,n,r,i){var o=this.cachedTypedArrays,a=o[e];return a||(a=createTypedArray(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),o[e]=a),a},e.prototype.getTypedArrayFromArray=function(e,t,n){var r=this.cachedTypedArrays,i=r[e];return i||(i=createTypedArray(t,n),r[e]=i),i},e}(),SIZEOF_UINT32=4,DEPRECATION_WARNING="b3dm tile in legacy format.";function getStringFromArrayBuffer(e,t,n){var r=new TextDecoder("utf8"),i=new Uint8Array(e,t,n);return r.decode(i)}function parseTable(e,t,n){return n=parseBatchTable(e,t,n=parseFeatureTable(e,t,n=parseTablesHeader(e,t,n)))}function parseTablesHeader(e,t,n){var r=new DataView(t),i=0;e.header=e.header||{};var o=r.getUint32(n,!0);n+=SIZEOF_UINT32;var a=r.getUint32(n,!0);n+=SIZEOF_UINT32;var s=r.getUint32(n,!0);n+=SIZEOF_UINT32;var c=r.getUint32(n,!0);return n+=SIZEOF_UINT32,s>=570425344?(n-=2*SIZEOF_UINT32,i=o,s=a,c=0,o=0,a=0,console.warn(DEPRECATION_WARNING)):c>=570425344&&(n-=SIZEOF_UINT32,i=s,s=o,c=a,o=0,a=0,console.warn(DEPRECATION_WARNING)),e.header.featureTableJsonByteLength=o,e.header.featureTableBinaryByteLength=a,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=c,e.header.batchLength=i,n}function parseFeatureTable(e,t,n){var r=e.header||{},i=r.featureTableJsonByteLength,o=r.featureTableBinaryByteLength,a=r.batchLength;if(e.featureTableJson={BATCH_LENGTH:a||0},i&&i>0){var s=getStringFromArrayBuffer(t,n,i);e.featureTableJson=JSON.parse(s)}n+=i||0,e.featureTableBinary=new Uint8Array(t,n,o),n+=o||0,e.rtcCenter=[0,0,0];var c=new FeatureTable(e.featureTableJson,e.featureTableBinary);if(Array.isArray(c.json.RTC_CENTER)){var l=c.json.RTC_CENTER;e.rtcCenter[0]=l[0],e.rtcCenter[1]=l[1],e.rtcCenter[2]=l[2]}else{(l=c.getGlobalProperty("RTC_CENTER",GL_TYPE.FLOAT,3))&&(e.rtcCenter[0]=l[0],e.rtcCenter[1]=l[1],e.rtcCenter[2]=l[2])}return n}function parseBatchTable(e,t,n){var r=e.header||{},i=r.batchTableJsonByteLength,o=r.batchTableBinaryByteLength;if(i&&i>0){var a=getStringFromArrayBuffer(t,n,i);e.batchTableJson=JSON.parse(a),n+=i,o&&o>0&&(e.batchTableBinary=new Uint8Array(t,n,o),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=o)}return n}function sliceArrayBuffer(e,t,n){var r=void 0!==n?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}function parseGlTFArrayBuffer(e,t,n){var r=e.byteLength-n;if(0===r)throw new Error("glTF byte length must be greater than 0.");return n%4!=0&&console.warn("".concat(e.type,": embedded glb is not aligned to a 4-byte boundary.")),e.gltfArrayBuffer=sliceArrayBuffer(t,n,r),e.byteLength}function decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(i){return t}}var WEBGL_CONSTANTS={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:THREE__namespace.NearestFilter,9729:THREE__namespace.LinearFilter,9984:THREE__namespace.NearestMipmapNearestFilter,9985:THREE__namespace.LinearMipmapNearestFilter,9986:THREE__namespace.NearestMipmapLinearFilter,9987:THREE__namespace.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:THREE__namespace.ClampToEdgeWrapping,33648:THREE__namespace.MirroredRepeatWrapping,10497:THREE__namespace.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:THREE__namespace.InterpolateLinear,STEP:THREE__namespace.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function values(e){var t=[];for(var n in e)t.push(e[n]);return t}var Parser=function(){function e(e,t,n){this.json=e,this.extensions=t,this.options=n,this.cache=new Map,this.disposeSet=new Set,this.nodeNamesUsed={}}return e.prototype.dispose=function(){this.cache.clear(),this.disposeSet.forEach((function(e){e.dispose()})),this.disposeSet.clear()},e.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r=0,i=t.length;r<i;r++)for(var o=t[r].joints,a=0,s=o.length;a<s;a++)e[o[a]].isBone=!0;for(var c=0,l=e.length;c<l;c++){var u=e[c];void 0!==u.mesh&&void 0!==u.skin&&(n[u.mesh].isSkinnedMesh=!0)}},e.prototype.parse=function(){var e=this,t=this.json,n=this.extensions;this.dispose(),this.markDefs();for(var r=0,i=values(n);r<i.length;r++){i[r].markDefs(this)}return Promise.all(values(n).map((function(t){return t.prepare(e)}))).then((function(){var n,r,i;return Promise.all([Promise.all((null!==(n=t.scenes)&&void 0!==n?n:[]).map((function(t,n){return e.loadScene(n)}))),Promise.all((null!==(r=t.animations)&&void 0!==r?r:[]).map((function(t,n){return e.loadAnimation(n)}))),Promise.all((null!==(i=t.cameras)&&void 0!==i?i:[]).map((function(t,n){return e.loadCamera(n)})))])})).then((function(r){var i=r[0],o=r[1],a=r[2],s={json:e.json,scene:i[t.scene||0],scenes:i,animations:o,cameras:a,dispose:function(){return e.dispose()}};return Promise.all(values(n).map((function(t){return t.emitResult(s,e)}))).then((function(){return s}))}))},e.prototype.loadCamera=function(e){var t="camera:"+e,n=this.cache.get(t);if(n)return n;for(var r=null,i=0,o=values(this.extensions);i<o.length;i++){if(r=o[i].loadCamera(e,this))break}if(!r){var a=void 0,s=this.json.cameras[e],c=s[s.type];c?"perspective"===s.type?a=new THREE__namespace.PerspectiveCamera(THREE__namespace.MathUtils.radToDeg(c.yfov),c.aspectRatio||1,c.znear||1,c.zfar||2e6):"orthographic"===s.type?a=new THREE__namespace.OrthographicCamera(-c.xmag,c.xmag,c.ymag,-c.ymag,c.znear,c.zfar):(console.warn("glTF: Invalid camera type ".concat(s.type,".")),a=new THREE__namespace.Camera):(console.warn("glTF: Missing camera parameters."),a=new THREE__namespace.Camera),s.name&&(a.name=this.createUniqueName(s.name)),r=Promise.resolve(a)}return this.cache.set(t,r),r},e.prototype.loadSkin=function(e){var t,n="animation:"+e,r=this.cache.get(n);if(r)return r;var i=this.json.skins[e],o={joints:i.joints};return t=void 0===i.inverseBindMatrices?Promise.resolve(o):this.loadAccessor(i.inverseBindMatrices).then((function(e){return e&&(o.inverseBindMatrices=e),o})),this.cache.set(n,t),t},e.prototype.loadAnimation=function(e){var t="animation:"+e,n=this.cache.get(t);if(n)return n;for(var r=null,i=0,o=values(this.extensions);i<o.length;i++){if(r=o[i].loadAnimation(e,this))break}if(!r){for(var a=this.json.animations[e],s=[],c=[],l=[],u=[],p=[],d=0,h=a.channels.length;d<h;d++){var f=a.channels[d],m=a.samplers[f.sampler],v=f.target,A=void 0!==v.node?v.node:v.id,g=void 0!==a.parameters?a.parameters[m.input]:m.input,y=void 0!==a.parameters?a.parameters[m.output]:m.output;s.push(this.loadNode(A)),c.push(this.loadAccessor(g)),l.push(this.loadAccessor(y)),u.push(m),p.push(v)}r=Promise.all([Promise.all(s),Promise.all(c),Promise.all(l),Promise.all(u),Promise.all(p)]).then((function(t){for(var n=t[0],r=t[1],i=t[2],o=t[3],s=t[4],c=[],l=function(e,t){var a=n[e],l=r[e],u=i[e],p=o[e],d=s[e];if(void 0===a)return"continue";a.updateMatrix(),a.matrixAutoUpdate=!0;var h=void 0;switch(PATH_PROPERTIES[d.path]){case PATH_PROPERTIES.weights:h=THREE__namespace.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:h=THREE__namespace.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:default:h=THREE__namespace.VectorKeyframeTrack}var f=a.name?a.name:a.uuid,m=void 0!==p.interpolation?INTERPOLATION[p.interpolation]:THREE__namespace.InterpolateLinear,v=[];PATH_PROPERTIES[d.path]===PATH_PROPERTIES.weights?a.traverse((function(e){e.morphTargetInfluences&&v.push(e.name?e.name:e.uuid)})):v.push(f);var A=u.array;if(u.normalized){for(var g=getNormalizedComponentScale(A.constructor),y=new Float32Array(A.length),b=0,E=A.length;b<E;b++)y[b]=A[b]*g;A=y}for(b=0,E=v.length;b<E;b++){var _=new h(v[b]+"."+PATH_PROPERTIES[d.path],l.array,A,m);c.push(_)}},u=0,p=n.length;u<p;u++)l(u);var d=a.name?a.name:"animation_"+e;return new THREE__namespace.AnimationClip(d,void 0,c)}))}return this.cache.set(t,r),r},e.prototype.loadBuffer=function(e){var t=this.json.buffers[e];if(t.type&&"arraybuffer"!==t.type)throw new Error("glTF: "+t.type+" buffer type is not supported.");var n="buffer:"+e,r=this.cache.get(n);if(r)return r;for(var i=null,o=0,a=values(this.extensions);o<a.length;o++){if(i=a[o].loadBuffer(e,this))break}if(!i){var s=this.json.buffers[e];i=this.options.fetcher.ajax(this.resolveResouce(s.uri),{responseType:"arraybuffer"}).then((function(e){return e.body}))}return this.cache.set(n,i),i},e.prototype.loadBufferView=function(e){var t="bufferView:"+e,n=this.cache.get(t);if(n)return n;for(var r=null,i=0,o=values(this.extensions);i<o.length;i++){if(r=o[i].loadBufferView(e,this))break}if(!r){var a=this.json.bufferViews[e];r=this.loadBuffer(a.buffer).then((function(e){var t=a.byteLength||0,n=a.byteOffset||0;return e.slice(n,n+t)}))}return this.cache.set(t,r),r},e.prototype.loadAccessor=function(e){var t=this,n="accessor:"+e,r=this.cache.get(n);if(r)return r;var i=null;if(!i){var o=this.json.accessors[e];if(void 0===o.bufferView&&void 0===o.sparse)i=Promise.resolve(null);else{var a=[];void 0!==o.bufferView?a.push(this.loadBufferView(o.bufferView)):a.push(Promise.resolve(null)),void 0!==o.sparse&&(a.push(this.loadBufferView(o.sparse.indices.bufferView)),a.push(this.loadBufferView(o.sparse.values.bufferView))),i=Promise.all(a).then((function(e){var n,r,i=e[0],a=WEBGL_TYPE_SIZES[o.type],s=WEBGL_COMPONENT_TYPES[o.componentType],c=s.BYTES_PER_ELEMENT,l=c*a,u=o.byteOffset||0,p=void 0!==o.bufferView?t.json.bufferViews[o.bufferView].byteStride:void 0,d=!0===o.normalized;if(p&&p!==l){var h=Math.floor(u/p),f="InterleavedBuffer:"+o.bufferView+":"+o.componentType+":"+h+":"+o.count,m=t.cache.get(f);m||(n=new s(i,h*p,o.count*p/c),m=new THREE__namespace.InterleavedBuffer(n,p/c),t.cache.set(f,m)),r=new THREE__namespace.InterleavedBufferAttribute(m,a,u%p/c,d)}else n=null===i?new s(o.count*a):new s(i,u,o.count*a),r=new THREE__namespace.BufferAttribute(n,a,d);if(void 0!==o.sparse){var v=WEBGL_TYPE_SIZES.SCALAR,A=WEBGL_COMPONENT_TYPES[o.sparse.indices.componentType],g=o.sparse.indices.byteOffset||0,y=o.sparse.values.byteOffset||0,b=new A(e[1],g,o.sparse.count*v),E=new s(e[2],y,o.sparse.count*a);null!==i&&(r=new THREE__namespace.BufferAttribute(r.array.slice(),r.itemSize,r.normalized));for(var _=0,T=b.length;_<T;_++){var x=b[_];if(r.setX(x,E[_*a]),a>=2&&r.setY(x,E[_*a+1]),a>=3&&r.setZ(x,E[_*a+2]),a>=4&&r.setW(x,E[_*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r}))}}return this.cache.set(n,i),i},e.prototype.createPrimitiveKey=function(e){for(var t=0,n=values(this.extensions);t<n.length;t++){var r=n[t].createPrimitiveKey(e,this);if(r)return r}for(var i="",o=Object.keys(e.attributes).sort(),a=0,s=o.length;a<s;a++)i+=o[a]+":"+e.attributes[o[a]]+";";return e.indices+":"+i+":"+e.mode},e.prototype.loadGeometry=function(e){var t=this,n="geometry:"+this.createPrimitiveKey(e),r=this.cache.get(n);if(r)return r;for(var i=null,o=0,a=values(this.extensions);o<a.length;o++){if(i=a[o].loadGeometry(e,this))break}return i||(i=this.addGeometryPrimitiveAttributes(new THREE__namespace.BufferGeometry,e)),i=i.then((function(e){return t.disposeSet.add(e),e})),this.cache.set(n,i),i},e.prototype.loadImage=function(e){var t="image:"+e,n=this.cache.get(t);if(n)return n;for(var r=null,i=0,o=values(this.extensions);i<o.length;i++){if(r=o[i].loadImage(e,this))break}if(!r){var a=this.json.images[e];if(a.bufferView)r=this.loadBufferView(a.bufferView).then((function(e){return createImageBitmapLike(new Blob([e],{type:a.mimeType}))}));else{if(!a.uri)throw new Error("glTF: Invalid image defs.");var s=this.resolveResouce(a.uri);r=this.options.fetcher.loadImage(s,{},void 0,void 0,void 0,createImageBitmapLikeImage()).then((function(e){return e.body}))}}return this.cache.set(t,r),r},e.prototype.loadMaterialAsMeshStandardMaterial=function(e){var t=this,n=[],r=new THREE__namespace.MeshStandardMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,Object.keys(e.attributes).filter((function(e){return"color"===ATTRIBUTES[e]})).length>0&&(r.vertexColors=!0),0===Object.keys(e.attributes).filter((function(e){return"normal"===ATTRIBUTES[e]})).length&&(r.flatShading=!0),0===Object.keys(e.attributes).filter((function(e){return"tangent"===ATTRIBUTES[e]})).length&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),void 0!==e.material){var i=this.json.materials[e.material];i.name&&(r.name=i.name);var o=i.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var a=o.baseColorFactor;r.color.fromArray(a),r.opacity=a[3]}void 0!==o.baseColorTexture&&n.push(this.createMaterialTexture(o.baseColorTexture).then((function(e){e.encoding=THREE__namespace.sRGBEncoding,r.map=e,t.disposeSet.add(e)}))),r.metalness=void 0!==o.metallicFactor?o.metallicFactor:1,r.roughness=void 0!==o.roughnessFactor?o.roughnessFactor:1,void 0!==o.metallicRoughnessTexture&&n.push(this.createMaterialTexture(o.metallicRoughnessTexture).then((function(e){e.encoding=THREE__namespace.sRGBEncoding,r.metalnessMap=e,r.roughnessMap=e,t.disposeSet.add(e)}))),!0===i.doubleSided&&(r.side=THREE__namespace.DoubleSide);var s=i.alphaMode||ALPHA_MODES.OPAQUE;if(s===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,s===ALPHA_MODES.MASK&&(r.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&(n.push(this.createMaterialTexture(i.normalTexture).then((function(e){r.normalMap=e,t.disposeSet.add(e)}))),r.normalScale=new THREE__namespace.Vector2(1,1),void 0!==i.normalTexture.scale)){var c=i.normalTexture.scale;r.normalScale.set(c,c)}void 0!==i.occlusionTexture&&(n.push(this.createMaterialTexture(i.occlusionTexture).then((function(e){r.aoMap=e,t.disposeSet.add(e)}))),void 0!==i.occlusionTexture.strength&&(r.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&(r.emissive=(new THREE__namespace.Color).fromArray(i.emissiveFactor)),void 0!==i.emissiveTexture&&n.push(this.createMaterialTexture(i.emissiveTexture).then((function(e){r.emissiveMap=e,t.disposeSet.add(e)})))}return this.disposeSet.add(r),Promise.all(n).then((function(){return r}))},e.prototype.loadMaterialAsLineBasicMaterial=function(e){var t=new THREE__namespace.LineBasicMaterial;if(t.color=new THREE__namespace.Color(1,1,1),t.opacity=1,Object.keys(e.attributes).filter((function(e){return"color"===ATTRIBUTES[e]})).length>0&&(t.vertexColors=!0),0===Object.keys(e.attributes).filter((function(e){return"tangent"===ATTRIBUTES[e]})).length&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),void 0!==e.material){var n=this.json.materials[e.material];n.name&&(t.name=n.name);var r=n.pbrMetallicRoughness||{};if(Array.isArray(r.baseColorFactor)){var i=r.baseColorFactor;t.color.fromArray(i),t.opacity=i[3]}!0===n.doubleSided&&(t.side=THREE__namespace.DoubleSide);var o=n.alphaMode||ALPHA_MODES.OPAQUE;o===ALPHA_MODES.BLEND?(t.transparent=!0,t.depthWrite=!1):(t.transparent=!1,o===ALPHA_MODES.MASK&&(t.alphaTest=void 0!==n.alphaCutoff?n.alphaCutoff:.5))}return this.disposeSet.add(t),Promise.all([]).then((function(){return t}))},e.prototype.loadMaterialAsPointsMaterial=function(e){var t=this,n=[],r=new THREE__namespace.PointsMaterial;if(r.color=new THREE__namespace.Color(1,1,1),r.opacity=1,r.sizeAttenuation=!1,Object.keys(e.attributes).filter((function(e){return"color"===ATTRIBUTES[e]})).length>0&&(r.vertexColors=!0),0===Object.keys(e.attributes).filter((function(e){return"tangent"===ATTRIBUTES[e]})).length&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),void 0!==e.material){var i=this.json.materials[e.material];i.name&&(r.name=i.name);var o=i.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var a=o.baseColorFactor;r.color.fromArray(a),r.opacity=a[3]}void 0!==o.baseColorTexture&&n.push(this.createMaterialTexture(o.baseColorTexture).then((function(e){e.encoding=THREE__namespace.sRGBEncoding,r.map=e,t.disposeSet.add(e)}))),!0===i.doubleSided&&(r.side=THREE__namespace.DoubleSide);var s=i.alphaMode||ALPHA_MODES.OPAQUE;s===ALPHA_MODES.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,s===ALPHA_MODES.MASK&&(r.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5))}return this.disposeSet.add(r),Promise.all(n).then((function(){return r}))},e.prototype.loadMaterial=function(e){var t,n=this,r=null!==(t=e.mode)&&void 0!==t?t:WEBGL_CONSTANTS.TRIANGLES,i="material:"+this.createPrimitiveKey(e),o=this.cache.get(i);if(o)return o;for(var a=null,s=0,c=values(this.extensions);s<c.length;s++){if(a=c[s].loadMaterial(e,this))break}if(r===WEBGL_CONSTANTS.TRIANGLES||r===WEBGL_CONSTANTS.TRIANGLE_STRIP||r===WEBGL_CONSTANTS.TRIANGLE_FAN)a=this.loadMaterialAsMeshStandardMaterial(e);else if(r===WEBGL_CONSTANTS.LINES||r===WEBGL_CONSTANTS.LINE_STRIP||r===WEBGL_CONSTANTS.LINE_LOOP)a=this.loadMaterialAsLineBasicMaterial(e);else{if(r!==WEBGL_CONSTANTS.POINTS)throw new Error("glTF: Primitive mode unsupported: "+r);a=this.loadMaterialAsPointsMaterial(e)}return a=a.then((function(e){return n.disposeSet.add(e),e})),this.cache.set(i,a),a},e.prototype.loadTexture=function(e){var t=this,n="texture:"+e,r=this.cache.get(n);if(r)return r;for(var i=null,o=0,a=values(this.extensions);o<a.length;o++){if(i=a[o].loadTexture(e,this))break}if(!i){var s=this.json.textures[e];i=this.loadImage(s.source).then((function(e){var n=new THREE__namespace.Texture(e);n.needsUpdate=!0,n.flipY=!1,s.name&&(n.name=s.name);var r=(t.json.samplers||{})[s.sampler]||{};n.magFilter=WEBGL_FILTERS[r.magFilter]||THREE__namespace.LinearFilter,n.minFilter=WEBGL_FILTERS[r.minFilter]||THREE__namespace.LinearMipmapLinearFilter,n.wrapS=WEBGL_WRAPPINGS[r.wrapS]||THREE__namespace.RepeatWrapping,n.wrapT=WEBGL_WRAPPINGS[r.wrapT]||THREE__namespace.RepeatWrapping;var i=n.dispose;return n.dispose=function(){return n.dispose=i,e.close(),i.call(this)},n}))}return i=i.then((function(e){return t.disposeSet.add(e),e})),this.cache.set(n,i),i},e.prototype.loadMesh=function(e){for(var t=this,n=null,r=0,i=values(this.extensions);r<i.length;r++){if(n=i[r].loadMesh(e,this))break}if(!n){var o=this.json.meshes[e],a=o.primitives,s=Promise.all(a.map((function(e){return t.loadGeometry(e)}))),c=Promise.all(a.map((function(e){return t.loadMaterial(e)})));n=Promise.all([s,c]).then((function(n){for(var r=n[0],i=n[1],s=[],c=0;c<a.length;c++){var l=a[c],u=r[c],p=i[c],d=l.mode||WEBGL_CONSTANTS.TRIANGLES,h=void 0;if(d===WEBGL_CONSTANTS.TRIANGLES||d===WEBGL_CONSTANTS.TRIANGLE_STRIP||d===WEBGL_CONSTANTS.TRIANGLE_FAN)if(d===WEBGL_CONSTANTS.TRIANGLE_STRIP?u=t.toGeometryTrianglesDrawMode(u,THREE__namespace.TriangleStripDrawMode):d===WEBGL_CONSTANTS.TRIANGLE_FAN&&(u=t.toGeometryTrianglesDrawMode(u,THREE__namespace.TriangleFanDrawMode)),o.isSkinnedMesh){var f=new THREE__namespace.SkinnedMesh(u,p);u.attributes.skinWeight.normalized||f.normalizeSkinWeights(),h=f}else h=new THREE__namespace.Mesh(u,p);else if(d===WEBGL_CONSTANTS.POINTS)h=new THREE__namespace.Points(u,p);else if(d===WEBGL_CONSTANTS.LINES)h=new THREE__namespace.LineSegments(u,p);else if(d===WEBGL_CONSTANTS.LINE_STRIP)h=new THREE__namespace.Line(u,p);else{if(d!==WEBGL_CONSTANTS.LINE_LOOP)throw new Error("glTF: Primitive mode unsupported: "+d);h=new THREE__namespace.LineLoop(u,p)}if(Object.keys(u.morphAttributes).length>0){if(void 0!==o.weights)for(var m=0,v=o.weights.length;m<v;m++)h.morphTargetInfluences[m]=o.weights[m];if(o.extras&&Array.isArray(o.extras.targetNames)){var A=o.extras.targetNames;if(h.morphTargetInfluences.length===A.length){h.morphTargetDictionary={};for(m=0,v=A.length;m<v;m++)h.morphTargetDictionary[A[m]]=m}else console.warn("glTF: Invalid extras.targetNames length. Ignoring names.")}}h.name=t.createUniqueName(o.name||"mesh_"+e),s.push(h)}if(1===s.length)return s[0];for(var g=new THREE__namespace.Group,y=0,b=s;y<b.length;y++){h=b[y];g.add(h)}return g}))}return n},e.prototype.loadNodeAttachments=function(e){for(var t=[],n=0,r=values(this.extensions);n<r.length;n++){var i=r[n].loadNodeAttachments(e,this);i&&t.push(i)}return t},e.prototype.loadNode=function(e){var t="node:"+e,n=this.cache.get(t);if(n)return n;var r=this.json.nodes[e],i=r.name?this.createUniqueName(r.name):"",o=[];void 0!==r.mesh&&o.push(this.loadMesh(r.mesh).then((function(e){if(void 0!==r.weights){var t=r.weights;e.traverse((function(e){if(e instanceof THREE__namespace.Mesh||e instanceof THREE__namespace.Line||e instanceof THREE__namespace.Points)for(var n=0,r=t.length;n<r;n++)e.morphTargetInfluences[n]=t[n]}))}return e}))),void 0!==r.camera&&o.push(this.loadCamera(r.camera));for(var a=0,s=this.loadNodeAttachments(e);a<s.length;a++){var c=s[a];o.push(c)}return Promise.all(o).then((function(e){var t;if((t=!0===r.isBone?new THREE__namespace.Bone:e.length>1?new THREE__namespace.Group:1===e.length?e[0]:new THREE__namespace.Object3D)!==e[0])for(var n=0,o=e.length;n<o;n++)t.add(e[n]);if(r.name&&(t.name=i),void 0!==r.matrix){var a=new THREE__namespace.Matrix4;a.fromArray(r.matrix),t.applyMatrix4(a)}else void 0!==r.translation&&t.position.fromArray(r.translation),void 0!==r.rotation&&t.quaternion.fromArray(r.rotation),void 0!==r.scale&&t.scale.fromArray(r.scale);return t}))},e.prototype.loadScene=function(e){var t=this.json.scenes[e],n=new THREE__namespace.Group;t.name&&(n.name=this.createUniqueName(t.name));for(var r=t.nodes||[],i=[],o=0,a=r.length;o<a;o++)i.push(this.buildNodeHierarchy(r[o],n));return Promise.all(i).then((function(){return n}))},e.prototype.createMaterialTexture=function(e){var t=this;return this.loadTexture(e.index).then((function(n){for(var r=0,i=values(t.extensions);r<i.length;r++){var o=i[r].extendTexture(n,e,t);o&&(n=o)}return n}))},e.prototype.addGeometryPrimitiveAttributes=function(e,t){var n=this,r=t.attributes,i=[],o=function(t){var n=ATTRIBUTES[t]||t.toLowerCase();if(n in e.attributes)return"continue";i.push(a.loadAccessor(r[t]).then((function(t){t&&e.setAttribute(n,t)})))},a=this;for(var s in r)o(s);void 0===t.indices||e.index||i.push(this.loadAccessor(t.indices).then((function(t){t&&e.setIndex(t)})));var c=new THREE__namespace.Box3;if(void 0!==r.POSITION){var l=(g=this.json.accessors[r.POSITION]).min,u=g.max;if(void 0!==l&&void 0!==u){if(c.set(new THREE__namespace.Vector3(l[0],l[1],l[2]),new THREE__namespace.Vector3(u[0],u[1],u[2])),g.normalized){var p=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[g.componentType]);c.min.multiplyScalar(p),c.max.multiplyScalar(p)}}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}var d=t.targets;if(void 0!==d){for(var h=new THREE__namespace.Vector3,f=new THREE__namespace.Vector3,m=0,v=d.length;m<v;m++){var A=d[m];if(void 0!==A.POSITION){var g;l=(g=this.json.accessors[A.POSITION]).min,u=g.max;if(void 0!==l&&void 0!==u){if(f.setX(Math.max(Math.abs(l[0]),Math.abs(u[0]))),f.setY(Math.max(Math.abs(l[1]),Math.abs(u[1]))),f.setZ(Math.max(Math.abs(l[2]),Math.abs(u[2]))),g.normalized){p=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[g.componentType]);f.multiplyScalar(p)}h.max(f)}else console.warn("glTF: Missing min/max properties for accessor POSITION.")}}c.expandByVector(h)}e.boundingBox=c;var y=new THREE__namespace.Sphere;return c.getCenter(y.center),y.radius=c.min.distanceTo(c.max)/2,e.boundingSphere=y,Promise.all(i).then((function(){if(e.attributes.uv&&!e.attributes.uv2&&n.options.copyUV2&&e.setAttribute("uv2",e.attributes.uv),t.targets){for(var r=!1,i=!1,o=0,a=t.targets.length;o<a;o++){var s=t.targets[o];if(void 0!==s.POSITION&&(r=!0),void 0!==s.NORMAL&&(i=!0),r&&i)break}if(!r&&!i)return e;var c=[];e.morphTargetsRelative=!0;var l=function(o,a){var s=t.targets[o];r?c.push(n.loadAccessor(s.POSITION).then((function(t){t&&(e.morphAttributes.position[o]=t)}))):e.morphAttributes.position[o]=e.attributes.position,i?c.push(n.loadAccessor(s.NORMAL).then((function(t){t&&(e.morphAttributes.normal[o]=t)}))):e.morphAttributes.normal[o]=e.attributes.normal};for(o=0,a=t.targets.length;o<a;o++)l(o);return Promise.all(c).then((function(){return e}))}return e}))},e.prototype.buildNodeHierarchy=function(e,t){var n=this,r=this.json.nodes[e];return this.loadNode(e).then((function(e){return void 0===r.skin?e:n.loadSkin(r.skin).then((function(e){for(var r=[],i=0,o=(t=e).joints.length;i<o;i++)r.push(n.loadNode(t.joints[i]));return Promise.all(r)})).then((function(n){return e.traverse((function(e){if(e instanceof THREE__namespace.SkinnedMesh){for(var r=[],i=[],o=0,a=n.length;o<a;o++){var s=n[o];if(s instanceof THREE__namespace.Bone){r.push(s);var c=new THREE__namespace.Matrix4;void 0!==t.inverseBindMatrices&&c.fromArray(t.inverseBindMatrices.array,16*o),i.push(c)}else console.warn('glTF: Joint "%s" could not be found.',t.joints[o])}e.bind(new THREE__namespace.Skeleton(r,i),e.matrixWorld)}})),e}));var t})).then((function(e){t.add(e);var i=[];if(r.children)for(var o=r.children,a=0,s=o.length;a<s;a++){var c=o[a];i.push(n.buildNodeHierarchy(c,e))}return Promise.all(i).then((function(){return e}))}))},e.prototype.createUniqueName=function(e){for(var t=THREE__namespace.PropertyBinding.sanitizeNodeName(e||""),n=t,r=1;this.nodeNamesUsed[n];++r)n=t+"_"+r;return this.nodeNamesUsed[n]=!0,n},e.prototype.resolveResouce=function(e){return pathJoin(this.options.resourcePath,appendSearch(e,this.options.search))},e.prototype.toGeometryTrianglesDrawMode=function(e,t){var n=e.getIndex();if(null===n){var r=[],i=e.getAttribute("position");if(void 0!==i){for(var o=0;o<i.count;o++)r.push(o);e.setIndex(r),n=e.getIndex()}}if(null===n)return console.error("glTF: Undefined position attribute. Processing not possible."),e;var a=n.count-2,s=[];if(t===THREE__namespace.TriangleFanDrawMode)for(o=1;o<=a;o++)s.push(n.getX(0)),s.push(n.getX(o)),s.push(n.getX(o+1));else for(o=0;o<a;o++)o%2==0?(s.push(n.getX(o)),s.push(n.getX(o+1)),s.push(n.getX(o+2))):(s.push(n.getX(o+2)),s.push(n.getX(o+1)),s.push(n.getX(o)));s.length/3!==a&&console.error("glTF: Unable to generate correct amount of triangles.");var c=e.clone();return c.setIndex(s),c},e}();function getNormalizedComponentScale(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("glTF: Unsupported normalized accessor component type.")}}var BaseExtension=function(){function e(){}return e.prototype.markDefs=function(e){},e.prototype.prepare=function(e){},e.prototype.emitResult=function(e,t){},e.prototype.createPrimitiveKey=function(e,t){},e.prototype.extendTexture=function(e,t,n){return null},e.prototype.loadBuffer=function(e,t){return null},e.prototype.loadBufferView=function(e,t){return null},e.prototype.loadImage=function(e,t){return null},e.prototype.loadTexture=function(e,t){return null},e.prototype.loadGeometry=function(e,t){return null},e.prototype.loadMaterial=function(e,t){return null},e.prototype.loadMesh=function(e,t){return null},e.prototype.loadNodeAttachments=function(e,t){return null},e.prototype.loadCamera=function(e,t){return null},e.prototype.loadAnimation=function(e,t){return null},e}(),KHR_binary_glTF=function(e){function t(){var t=e.call(this)||this;return t.header={magic:"",version:0,length:0},t.content="",t.body=null,t}return __extends(t,e),t.getMagic=function(e){return decodeText(new Uint8Array(e.slice(0,4)))},t.prototype.loadGlbBinary=function(e){var n=new DataView(e,0,t.HEADER_LENGTH);if(this.header={magic:t.getMagic(e),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==t.HEADER_MAGIC)throw new Error("glTF:KHR_binary_glTF: Unsupported.");if(this.header.version<2)throw new Error("glTF:KHR_binary_glTF: Legacy binary file detected.");for(var r=new DataView(e,t.HEADER_LENGTH),i=0,o=null,a=null;i<r.byteLength;){var s=r.getUint32(i,!0);i+=4;var c=r.getUint32(i,!0);if(i+=4,c===t.CHUNK_TYPES.JSON)o=decodeText(new Uint8Array(e,t.HEADER_LENGTH+i,s));else if(c===t.CHUNK_TYPES.BIN){var l=t.HEADER_LENGTH+i;a=e.slice(l,l+s)}i+=s}if(null===o)throw new Error("glTF:KHR_binary_glTF: JSON content not found.");this.content=o,this.body=a},t.prototype.loadBuffer=function(e,t){return void 0===t.json.buffers[e].uri&&0===e&&this.body?Promise.resolve(this.body):null},t.HEADER_MAGIC="glTF",t.HEADER_LENGTH=12,t.CHUNK_TYPES={JSON:1313821514,BIN:5130562},t}(BaseExtension),defaultDecoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/",defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},Draco=function(){function e(){this.decoderPath=defaultDecoderPath,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=""}return e.prototype.setDecoderPath=function(e){this.decoderPath=e},e.prototype.setDecoderConfig=function(e){return this.decoderConfig=e,this},e.prototype.setWorkerLimit=function(e){return this.workerLimit=e,this},e.prototype.decodeDracoFile=function(e,t,n,r){var i={attributeIDs:n||defaultAttributeIDs,attributeTypes:r||defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)},e.prototype.decodeGeometry=function(e,t){var n,r=this;for(var i in void 0===t&&(t={attributeIDs:defaultAttributeIDs,attributeTypes:defaultAttributeTypes,useUniqueIDs:!1}),t.attributeTypes){var o=t.attributeTypes[i];void 0!==o.BYTES_PER_ELEMENT&&(t.attributeTypes[i]=o.name)}var a=this.workerNextTaskID++,s=e.byteLength,c=this._getWorker(a,s).then((function(r){return n=r,new Promise((function(r,i){n._callbacks[a]={resolve:r,reject:i},n.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))})).then((function(e){return r._createGeometry(e.geometry)}));return c.catch((function(){return!0})).then((function(){n&&a&&r._releaseTask(n,a)})),c},e.prototype._createGeometry=function(e){var t=new THREE__namespace.BufferGeometry;e.index&&t.setIndex(new THREE__namespace.BufferAttribute(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var r=e.attributes[n],i=r.name,o=r.array,a=r.itemSize;t.setAttribute(i,new THREE__namespace.BufferAttribute(o,a))}return t},e.prototype._initDecoder=function(){var e=this;if(this.decoderPending)return this.decoderPending;if("object"!=typeof WebAssembly||"js"===this.decoderConfig.type){var t=ajax(this.decoderPath+"draco_decoder.js",{responseType:"text"}).then((function(e){return e.body}));this.decoderPending=t.then((function(t){var n=["/* draco decoder */",t,"","/* worker */",DRACOWorker].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([n]))}))}else{t=ajax(this.decoderPath+"draco_wasm_wrapper.js",{responseType:"text"}).then((function(e){return e.body}));var n=ajax(this.decoderPath+"draco_decoder.wasm",{responseType:"arraybuffer"}).then((function(e){return e.body}));this.decoderPending=Promise.all([t,n]).then((function(t){var n=t[0],r=t[1];e.decoderConfig.wasmBinary=r;var i=["/* draco decoder */",n,"","/* worker */",DRACOWorker].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([i]))}))}return this.decoderPending},e.prototype._getWorker=function(e,t){var n=this;return this._initDecoder().then((function(){if(n.workerPool.length<n.workerLimit){var r=new Worker(n.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:n.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('DRACO: Unexpected message, "'+t.type+'"')}},n.workerPool.push(r)}else n.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var i=n.workerPool[n.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i}))},e.prototype._releaseTask=function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},e.prototype.dispose=function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this},e}(),draco=new Draco,DRACOWorker="\n let decoderConfig;\n let decoderPending;\n\n onmessage = function ( e ) {\n\n const message = e.data;\n\n switch ( message.type ) {\n\n case 'init':\n decoderConfig = message.decoderConfig;\n decoderPending = new Promise( function ( resolve/*, reject*/ ) {\n\n decoderConfig.onModuleLoaded = function ( draco ) {\n\n // Module is Promise-like. Wrap before resolving to avoid loop.\n resolve( { draco: draco } );\n\n };\n\n DracoDecoderModule( decoderConfig ); // eslint-disable-line no-undef\n\n } );\n break;\n\n case 'decode':\n const buffer = message.buffer;\n const taskConfig = message.taskConfig;\n decoderPending.then( ( module ) => {\n\n const draco = module.draco;\n const decoder = new draco.Decoder();\n const decoderBuffer = new draco.DecoderBuffer();\n decoderBuffer.Init( new Int8Array( buffer ), buffer.byteLength );\n\n try {\n\n const geometry = decodeGeometry( draco, decoder, decoderBuffer, taskConfig );\n\n const buffers = geometry.attributes.map( ( attr ) => attr.array.buffer );\n\n if ( geometry.index ) buffers.push( geometry.index.array.buffer );\n\n self.postMessage( { type: 'decode', id: message.id, geometry }, buffers );\n\n } catch ( error ) {\n\n console.error( error );\n\n self.postMessage( { type: 'error', id: message.id, error: error.message } );\n\n } finally {\n\n draco.destroy( decoderBuffer );\n draco.destroy( decoder );\n\n }\n\n } );\n break;\n\n }\n\n };\n\n function decodeGeometry( draco, decoder, decoderBuffer, taskConfig ) {\n\n const attributeIDs = taskConfig.attributeIDs;\n const attributeTypes = taskConfig.attributeTypes;\n\n let dracoGeometry;\n let decodingStatus;\n\n const geometryType = decoder.GetEncodedGeometryType( decoderBuffer );\n\n if ( geometryType === draco.TRIANGULAR_MESH ) {\n\n dracoGeometry = new draco.Mesh();\n decodingStatus = decoder.DecodeBufferToMesh( decoderBuffer, dracoGeometry );\n\n } else if ( geometryType === draco.POINT_CLOUD ) {\n\n dracoGeometry = new draco.PointCloud();\n decodingStatus = decoder.DecodeBufferToPointCloud( decoderBuffer, dracoGeometry );\n\n } else {\n\n throw new Error( 'THREE.DRACOLoader: Unexpected geometry type.' );\n\n }\n\n if ( ! decodingStatus.ok() || dracoGeometry.ptr === 0 ) {\n\n throw new Error( 'THREE.DRACOLoader: Decoding failed: ' + decodingStatus.error_msg() );\n\n }\n\n const geometry = { index: null, attributes: [] };\n\n // Gather all vertex attributes.\n for ( const attributeName in attributeIDs ) {\n\n const attributeType = self[ attributeTypes[ attributeName ] ];\n\n let attribute;\n let attributeID;\n\n // A Draco file may be created with default vertex attributes, whose attribute IDs\n // are mapped 1:1 from their semantic name (POSITION, NORMAL, ...). Alternatively,\n // a Draco file may contain a custom set of attributes, identified by known unique\n // IDs. glTF files always do the latter, and .drc files typically do the former.\n if ( taskConfig.useUniqueIDs ) {\n\n attributeID = attributeIDs[ attributeName ];\n attribute = decoder.GetAttributeByUniqueId( dracoGeometry, attributeID );\n\n } else {\n\n attributeID = decoder.GetAttributeId( dracoGeometry, draco[ attributeIDs[ attributeName ] ] );\n\n if ( attributeID === - 1 ) continue;\n\n attribute = decoder.GetAttribute( dracoGeometry, attributeID );\n\n }\n\n geometry.attributes.push( decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) );\n\n }\n\n // Add index.\n if ( geometryType === draco.TRIANGULAR_MESH ) {\n\n geometry.index = decodeIndex( draco, decoder, dracoGeometry );\n\n }\n\n draco.destroy( dracoGeometry );\n\n return geometry;\n\n }\n\n function decodeIndex( draco, decoder, dracoGeometry ) {\n\n const numFaces = dracoGeometry.num_faces();\n const numIndices = numFaces * 3;\n const byteLength = numIndices * 4;\n\n const ptr = draco._malloc( byteLength );\n decoder.GetTrianglesUInt32Array( dracoGeometry, byteLength, ptr );\n const index = new Uint32Array( draco.HEAPF32.buffer, ptr, numIndices ).slice();\n draco._free( ptr );\n\n return { array: index, itemSize: 1 };\n\n }\n\n function decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) {\n\n const numComponents = attribute.num_components();\n const numPoints = dracoGeometry.num_points();\n const numValues = numPoints * numComponents;\n const byteLength = numValues * attributeType.BYTES_PER_ELEMENT;\n const dataType = getDracoDataType( draco, attributeType );\n\n const ptr = draco._malloc( byteLength );\n decoder.GetAttributeDataArrayForAllPoints( dracoGeometry, attribute, dataType, byteLength, ptr );\n const array = new attributeType( draco.HEAPF32.buffer, ptr, numValues ).slice();\n draco._free( ptr );\n\n return {\n name: attributeName,\n array: array,\n itemSize: numComponents\n };\n\n }\n\n function getDracoDataType( draco, attributeType ) {\n\n switch ( attributeType ) {\n\n case Float32Array: return draco.DT_FLOAT32;\n case Int8Array: return draco.DT_INT8;\n case Int16Array: return draco.DT_INT16;\n case Int32Array: return draco.DT_INT32;\n case Uint8Array: return draco.DT_UINT8;\n case Uint16Array: return draco.DT_UINT16;\n case Uint32Array: return draco.DT_UINT32;\n\n }\n\n }\n",EXTENSION_NAME$5="KHR_draco_mesh_compression",KHR_draco_mesh_compression=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.loadGeometry=function(e,t){return e.extensions&&e.extensions[EXTENSION_NAME$5]?this.decodePrimitive(e,t).then((function(n){return t.addGeometryPrimitiveAttributes(n,e)})):null},t.prototype.decodePrimitive=function(e,t){var n=t.json,r=e.extensions[EXTENSION_NAME$5].bufferView,i=e.extensions[EXTENSION_NAME$5].attributes,o={},a={},s={};for(var c in i){var l=ATTRIBUTES[c]||c.toLowerCase();o[l]=i[c]}for(var c in e.attributes){l=ATTRIBUTES[c]||c.toLowerCase();if(void 0!==i[c]){var u=n.accessors[e.attributes[c]],p=WEBGL_COMPONENT_TYPES[u.componentType];s[l]=p,a[l]=!0===u.normalized}}return t.loadBufferView(r).then((function(e){return new Promise((function(t){draco.decodeDracoFile(e,(function(e){for(var n in e.attributes){var r=e.attributes[n],i=a[n];void 0!==i&&(r.normalized=i)}t(e)}),o,s)}))}))},t}(BaseExtension),WorkerPool$1=function(){function e(e){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}return e.prototype._initWorker=function(e){if(this.workerCreator&&!this.workers[e]){var t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}},e.prototype._getIdleWorker=function(){for(var e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1},e.prototype._onMessage=function(e,t){var n=this.workersResolve[e];if(n&&n(t),this.queue.length){var r=this.queue.shift(),i=r.resolve,o=r.msg,a=r.transfer;this.workersResolve[e]=i,this.workers[e].postMessage(o,a)}else this.workerStatus^=1<<e},e.prototype.setWorkerCreator=function(e){this.workerCreator=e},e.prototype.setWorkerLimit=function(e){this.pool=e},e.prototype.postMessage=function(e,t){var n=this;return new Promise((function(r){var i=n._getIdleWorker();-1!==i?(n._initWorker(i),n.workerStatus|=1<<i,n.workersResolve[i]=r,n.workers[i].postMessage(e,t)):n.queue.push({resolve:r,msg:e,transfer:t})}))},e.prototype.dispose=function(){this.workers.forEach((function(e){return e.terminate()})),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0},e}(),defaultTranscoderPath="https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/basis/1.16/",KTX2TransferSRGB=2,KTX2_ALPHA_PREMULTIPLIED=1,KTX2=function(){function e(){this.transcoderPath=defaultTranscoderPath,this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new WorkerPool$1(4),this.workerSourceURL="",this.workerConfig=null}return e.prototype.setTranscoderPath=function(e){this.transcoderPath=e},e.prototype.detectSupport=function(e){if(!this.workerConfig){var t=console.warn;console.warn=function(){},this.workerConfig={astcSupported:!!e.extensions.get("WEBGL_compressed_texture_astc"),etc1Supported:!!e.extensions.get("WEBGL_compressed_texture_etc1"),etc2Supported:!!e.extensions.get("WEBGL_compressed_texture_etc"),dxtSupported:!!e.extensions.get("WEBGL_compressed_texture_s3tc"),bptcSupported:!!e.extensions.get("EXT_texture_compression_bptc"),pvrtcSupported:!!e.extensions.get("WEBGL_compressed_texture_pvrtc")||!!e.extensions.get("WEBKIT_WEBGL_compressed_texture_pvrtc")},console.warn=t}return this},e.prototype.init=function(){var e=this;if(!this.transcoderPending){var t=ajax(this.transcoderPath+"basis_transcoder.js",{responseType:"text"}).then((function(e){return e.body})),n=ajax(this.transcoderPath+"basis_transcoder.wasm",{responseType:"arraybuffer"}).then((function(e){return e.body}));this.transcoderPending=Promise.all([t,n]).then((function(t){var n=t[0],r=t[1],i=["/* constants */","let _EngineFormat = "+JSON.stringify(EngineFormat),"let _TranscoderFormat = "+JSON.stringify(TranscoderFormat),"let _BasisFormat = "+JSON.stringify(BasisFormat),"/* basis_transcoder.js */",n,"/* worker */",BasisWorker].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([i])),e.transcoderBinary=r,e.workerPool.setWorkerCreator((function(){var t=new Worker(e.workerSourceURL),n=e.transcoderBinary.slice(0);return t.postMessage({type:"init",config:e.workerConfig,transcoderBinary:n},[n]),t}))}))}return this.transcoderPending},e.prototype.parse=function(e){return this._createTexture([e])},e.prototype._createTextureFrom=function(e){var t=e.mipmaps,n=e.width,r=e.height,i=e.format,o=e.type,a=e.error,s=e.dfdTransferFn,c=e.dfdFlags;if("error"===o)return Promise.reject(a);var l=new THREE__namespace.CompressedTexture(t,n,r,i,THREE__namespace.UnsignedByteType);return l.minFilter=1===t.length?THREE__namespace.LinearFilter:THREE__namespace.LinearMipmapLinearFilter,l.magFilter=THREE__namespace.LinearFilter,l.generateMipmaps=!1,l.needsUpdate=!0,l.encoding=s===KTX2TransferSRGB?THREE__namespace.sRGBEncoding:THREE__namespace.LinearEncoding,l.premultiplyAlpha=!!(c&KTX2_ALPHA_PREMULTIPLIED),Promise.resolve(l)},e.prototype._createTexture=function(e){var t=this;return this.init().then((function(){return t.workerPool.postMessage({type:"transcode",buffers:e},e)})).then((function(e){return t._createTextureFrom(e.data)}))},e.prototype.dispose=function(){return URL.revokeObjectURL(this.workerSourceURL),this.workerPool.dispose(),this},e}(),ktx2=new KTX2,BasisFormat={ETC1S:0,UASTC_4x4:1},TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},EngineFormat={RGBAFormat:THREE__namespace.RGBAFormat,RGBA_ASTC_4x4_Format:THREE__namespace.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:THREE__namespace.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:THREE__namespace.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:THREE__namespace.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:THREE__namespace.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:THREE__namespace.RGB_ETC1_Format,RGB_ETC2_Format:THREE__namespace.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:THREE__namespace.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:THREE__namespace.RGB_S3TC_DXT1_Format},BasisWorker="\n\n let config;\n let transcoderPending;\n let BasisModule;\n\n const EngineFormat = _EngineFormat; // eslint-disable-line no-undef\n const TranscoderFormat = _TranscoderFormat; // eslint-disable-line no-undef\n const BasisFormat = _BasisFormat; // eslint-disable-line no-undef\n\n self.addEventListener( 'message', function ( e ) {\n\n const message = e.data;\n\n switch ( message.type ) {\n\n case 'init':\n config = message.config;\n init( message.transcoderBinary );\n break;\n\n case 'transcode':\n transcoderPending.then( () => {\n\n try {\n\n const { width, height, hasAlpha, mipmaps, format, dfdTransferFn, dfdFlags } = transcode( message.buffers[ 0 ] );\n\n const buffers = [];\n\n for ( let i = 0; i < mipmaps.length; ++ i ) {\n\n buffers.push( mipmaps[ i ].data.buffer );\n\n }\n\n self.postMessage( { type: 'transcode', id: message.id, width, height, hasAlpha, mipmaps, format, dfdTransferFn, dfdFlags }, buffers );\n\n } catch ( error ) {\n\n console.error( error );\n\n self.postMessage( { type: 'error', id: message.id, error: error.message } );\n\n }\n\n } );\n break;\n\n }\n\n } );\n\n function init( wasmBinary ) {\n\n transcoderPending = new Promise( ( resolve ) => {\n\n BasisModule = { wasmBinary, onRuntimeInitialized: resolve };\n BASIS( BasisModule ); // eslint-disable-line no-undef\n\n } ).then( () => {\n\n BasisModule.initializeBasis();\n\n if ( BasisModule.KTX2File === undefined ) {\n\n console.warn( 'THREE.KTX2Loader: Please update Basis Universal transcoder.' );\n\n }\n\n } );\n\n }\n\n function transcode( buffer ) {\n\n const ktx2File = new BasisModule.KTX2File( new Uint8Array( buffer ) );\n\n function cleanup() {\n\n ktx2File.close();\n ktx2File.delete();\n\n }\n\n if ( ! ktx2File.isValid() ) {\n\n cleanup();\n throw new Error( 'THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file' );\n\n }\n\n const basisFormat = ktx2File.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S;\n const width = ktx2File.getWidth();\n const height = ktx2File.getHeight();\n const levels = ktx2File.getLevels();\n const hasAlpha = ktx2File.getHasAlpha();\n const dfdTransferFn = ktx2File.getDFDTransferFunc();\n const dfdFlags = ktx2File.getDFDFlags();\n\n const { transcoderFormat, engineFormat } = getTranscoderFormat( basisFormat, width, height, hasAlpha );\n\n if ( ! width || ! height || ! levels ) {\n\n cleanup();\n throw new Error( 'THREE.KTX2Loader:\tInvalid texture' );\n\n }\n\n if ( ! ktx2File.startTranscoding() ) {\n\n cleanup();\n throw new Error( 'THREE.KTX2Loader: .startTranscoding failed' );\n\n }\n\n const mipmaps = [];\n\n for ( let mip = 0; mip < levels; mip ++ ) {\n\n const levelInfo = ktx2File.getImageLevelInfo( mip, 0, 0 );\n const mipWidth = levelInfo.origWidth;\n const mipHeight = levelInfo.origHeight;\n const dst = new Uint8Array( ktx2File.getImageTranscodedSizeInBytes( mip, 0, 0, transcoderFormat ) );\n\n const status = ktx2File.transcodeImage(\n dst,\n mip,\n 0,\n 0,\n transcoderFormat,\n 0,\n - 1,\n - 1,\n );\n\n if ( ! status ) {\n\n cleanup();\n throw new Error( 'THREE.KTX2Loader: .transcodeImage failed.' );\n\n }\n\n mipmaps.push( { data: dst, width: mipWidth, height: mipHeight } );\n\n }\n\n cleanup();\n\n return { width, height, hasAlpha, mipmaps, format: engineFormat, dfdTransferFn, dfdFlags };\n\n }\n\n //\n\n // Optimal choice of a transcoder target format depends on the Basis format (ETC1S or UASTC),\n // device capabilities, and texture dimensions. The list below ranks the formats separately\n // for ETC1S and UASTC.\n //\n // In some cases, transcoding UASTC to RGBA32 might be preferred for higher quality (at\n // significant memory cost) compared to ETC1/2, BC1/3, and PVRTC. The transcoder currently\n // chooses RGBA32 only as a last resort and does not expose that option to the caller.\n const FORMAT_OPTIONS = [\n {\n if: 'astcSupported',\n basisFormat: [ BasisFormat.UASTC_4x4 ],\n transcoderFormat: [ TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4 ],\n engineFormat: [ EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format ],\n priorityETC1S: Infinity,\n priorityUASTC: 1,\n needsPowerOfTwo: false,\n },\n {\n if: 'bptcSupported',\n basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],\n transcoderFormat: [ TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5 ],\n engineFormat: [ EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format ],\n priorityETC1S: 3,\n priorityUASTC: 2,\n needsPowerOfTwo: false,\n },\n {\n if: 'dxtSupported',\n basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],\n transcoderFormat: [ TranscoderFormat.BC1, TranscoderFormat.BC3 ],\n engineFormat: [ EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format ],\n priorityETC1S: 4,\n priorityUASTC: 5,\n needsPowerOfTwo: false,\n },\n {\n if: 'etc2Supported',\n basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],\n transcoderFormat: [ TranscoderFormat.ETC1, TranscoderFormat.ETC2 ],\n engineFormat: [ EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format ],\n priorityETC1S: 1,\n priorityUASTC: 3,\n needsPowerOfTwo: false,\n },\n {\n if: 'etc1Supported',\n basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],\n transcoderFormat: [ TranscoderFormat.ETC1, TranscoderFormat.ETC1 ],\n engineFormat: [ EngineFormat.RGB_ETC1_Format, EngineFormat.RGB_ETC1_Format ],\n priorityETC1S: 2,\n priorityUASTC: 4,\n needsPowerOfTwo: false,\n },\n {\n if: 'pvrtcSupported',\n basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],\n transcoderFormat: [ TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA ],\n engineFormat: [ EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format ],\n priorityETC1S: 5,\n priorityUASTC: 6,\n needsPowerOfTwo: true,\n },\n ];\n\n const ETC1S_OPTIONS = FORMAT_OPTIONS.sort( function ( a, b ) {\n\n return a.priorityETC1S - b.priorityETC1S;\n\n } );\n const UASTC_OPTIONS = FORMAT_OPTIONS.sort( function ( a, b ) {\n\n return a.priorityUASTC - b.priorityUASTC;\n\n } );\n\n function getTranscoderFormat( basisFormat, width, height, hasAlpha ) {\n\n let transcoderFormat;\n let engineFormat;\n\n const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS;\n\n for ( let i = 0; i < options.length; i ++ ) {\n\n const opt = options[ i ];\n\n if ( ! config[ opt.if ] ) continue;\n if ( ! opt.basisFormat.includes( basisFormat ) ) continue;\n if ( opt.needsPowerOfTwo && ! ( isPowerOfTwo( width ) && isPowerOfTwo( height ) ) ) continue;\n\n transcoderFormat = opt.transcoderFormat[ hasAlpha ? 1 : 0 ];\n engineFormat = opt.engineFormat[ hasAlpha ? 1 : 0 ];\n\n return { transcoderFormat, engineFormat };\n\n }\n\n console.warn( 'KTX2: No suitable compressed texture format found. Decoding to RGBA32.' );\n\n transcoderFormat = TranscoderFormat.RGBA32;\n engineFormat = EngineFormat.RGBAFormat;\n\n return { transcoderFormat, engineFormat };\n\n }\n\n function isPowerOfTwo( value ) {\n\n if ( value <= 2 ) return true;\n\n return ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n }\n",EXTENSION_NAME$4="KHR_texture_basisu",KHR_texture_basisu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.loadTexture=function(e,t){var n=t.json.textures[e];if(!n.extensions||!n.extensions[EXTENSION_NAME$4])return null;var r=n.extensions[EXTENSION_NAME$4],i=t.json.images[r.source],o=null;if(i.bufferView)o=t.loadBufferView(i.bufferView).then((function(e){return ktx2.parse(e)}));else{if(!i.uri)throw new Error("glTF: Invalid image defs.");o=t.options.fetcher.ajax(t.resolveResouce(i.uri),{responseType:"arraybuffer"}).then((function(e){return ktx2.parse(e.body)}))}return o},t}(BaseExtension),EXTENSION_NAME$3="KHR_texture_transform",KHR_texture_transform=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.extendTexture=function(e,t,n){var r=void 0!==t.extensions?t.extensions[EXTENSION_NAME$3]:void 0;return r?(void 0!==r.texCoord&&console.warn('glTF: Custom UV sets in "'+EXTENSION_NAME$3+'" extension not yet supported.'),void 0===r.offset&&void 0===r.rotation&&void 0===r.scale||((e=e.clone()).needsUpdate=!0,void 0!==r.offset&&e.offset.fromArray(r.offset),void 0!==r.rotation&&(e.rotation=r.rotation),void 0!==r.scale&&e.repeat.fromArray(r.scale)),e):null},t}(BaseExtension),KHR_mesh_quantization=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t}(BaseExtension),meshoptDecoder=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var n,r=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;a9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;d8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:N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AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:78Yqdbk:qzezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlinalgic9Wfglawcj;cbffhOdndndndndnaHalco4fRbbalci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOaoRblaoRbbgAco4glalciSgCE86bbawcj;cbfaifglcGfaoclfaCfgORbbaAcl4ciGgCaCciSgCE86bbalcVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbalc7faOaCfgORbbaAciGgAaAciSgAE86bbalctfaOaAfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkaOaoRbwaoRbbgAcl4glalcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgORbbaAcsGgAaAcsSgAE86bbalcVfaOaAfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekaOao8Pbb83bbaOcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhPdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkaCcefhCamcefgmad6hsamad9hmbkaPhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaPhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj;8ifcjjj98G::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",i=WebAssembly.instantiate(o(r),{}).then((function(e){(n=e.instance).exports.__wasm_call_ctors()}));function o(e){for(var n=new Uint8Array(e.length),r=0;r<e.length;++r){var i=e.charCodeAt(r);n[r]=i>96?i-97:i>64?i-39:i+4}var o=0;for(r=0;r<e.length;++r)n[o++]=n[r]<60?t[n[r]]:64*(n[r]-60)+n[++r];return n.buffer.slice(0,o)}function a(e,t,r,i,o,a){var s=n.exports.sbrk,c=r+3&-4,l=s(c*i),u=s(o.length),p=new Uint8Array(n.exports.memory.buffer);p.set(o,u);var d=e(l,r,i,u,o.length);if(0==d&&a&&a(l,c,i),t.set(p.subarray(l,l+r*i)),s(l-s(0)),0!=d)throw new Error("Malformed buffer data: "+d)}var s={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},c={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},l=[],u=0;function p(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function d(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(o(r))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+a.toString()+h.toString(),n=new Blob([t],{type:"text/javascript"}),i=URL.createObjectURL(n),s=0;s<e;++s)l[s]=p(i);URL.revokeObjectURL(i)}function h(e){i.then((function(){var t=e.data;try{var r=new Uint8Array(t.count*t.size);a(n.exports[t.mode],r,t.count,t.size,t.source,n.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:r},[r.buffer])}catch(i){self.postMessage({id:t.id,count:t.count,action:"reject",value:i})}}))}return{ready:i,supported:!0,useWorkers:function(e){d(e)},decodeVertexBuffer:function(e,t,r,i,o){a(n.exports.meshopt_decodeVertexBuffer,e,t,r,i,n.exports[s[o]])},decodeIndexBuffer:function(e,t,r,i){a(n.exports.meshopt_decodeIndexBuffer,e,t,r,i)},decodeIndexSequence:function(e,t,r,i){a(n.exports.meshopt_decodeIndexSequence,e,t,r,i)},decodeGltfBuffer:function(e,t,r,i,o,l){a(n.exports[c[o]],e,t,r,i,n.exports[s[l]])},decodeGltfBufferAsync:function(e,t,r,o,p){return l.length>0?function(e,t,n,r,i){for(var o=l[0],a=1;a<l.length;++a)l[a].pending<o.pending&&(o=l[a]);return new Promise((function(a,s){var c=new Uint8Array(n),l=u++;o.pending+=e,o.requests[l]={resolve:a,reject:s},o.object.postMessage({id:l,count:e,size:t,source:c,mode:r,filter:i},[c.buffer])}))}(e,t,r,c[o],s[p]):i.then((function(){var i=new Uint8Array(e*t);return a(n.exports[c[o]],i,e,t,r,n.exports[s[p]]),i}))}}}(),EXTENSION_NAME$2="EXT_meshopt_compression",EXT_meshopt_compression=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.loadBufferView=function(e,t){var n=t.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[EXTENSION_NAME$2]){var i=r.extensions[EXTENSION_NAME$2],o=t.loadBuffer(i.buffer);if(!meshoptDecoder.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(EXTENSION_NAME$2)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([o,meshoptDecoder.ready]).then((function(e){var t=e[0],n=i.byteOffset||0,r=i.byteLength||0,o=i.count,a=i.byteStride,s=new ArrayBuffer(o*a),c=new Uint8Array(t,n,r);return meshoptDecoder.decodeGltfBuffer(new Uint8Array(s),o,a,c,i.mode,i.filter),s}))}return null},t}(BaseExtension),EXTENSION_NAME$1="EXT_texture_webp",EXT_texture_webp=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.supportsWep=!1,t}return __extends(t,e),t.prototype.prepare=function(e){var t=this;return imageSupport().then((function(e){t.supportsWep=e.webp}))},t.prototype.loadTexture=function(e,t){var n=t.json.textures[e];if(!n.extensions||!n.extensions[EXTENSION_NAME$1])return null;if(!this.supportsWep)return null;var r=n.extensions[EXTENSION_NAME$1];return t.loadImage(r.source).then((function(e){var r=new THREE__namespace.Texture(e);r.needsUpdate=!0,r.flipY=!1,n.name&&(r.name=n.name);var i=(t.json.samplers||{})[n.sampler]||{};return r.magFilter=WEBGL_FILTERS[i.magFilter]||THREE__namespace.LinearFilter,r.minFilter=WEBGL_FILTERS[i.minFilter]||THREE__namespace.LinearMipmapLinearFilter,r.wrapS=WEBGL_WRAPPINGS[i.wrapS]||THREE__namespace.RepeatWrapping,r.wrapT=WEBGL_WRAPPINGS[i.wrapT]||THREE__namespace.RepeatWrapping,r}))},t}(BaseExtension),EXTENSION_NAME="CESIUM_RTC",CESIUM_RTC=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.emitResult=function(e,t){if(t.json.extensions[EXTENSION_NAME]&&t.json.extensions[EXTENSION_NAME].center){var n=t.json.extensions[EXTENSION_NAME].center;e.CESIUM_RTC={center:(new THREE__namespace.Vector3).fromArray(n)}}},t}(BaseExtension);const pointcloudFragmentShader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-u|{Sy||V{qrH0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6--{vs|z-rp@-p|{n{P|y|H0r{qvs0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6n\bv{t-rp@-[|znyH0r{qvs0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--n\bv{t-sy|n-Sy||H0ryr--{vs|z-sy|n-sy||H0r{qvsn\bv{t-rpA-|yq]|vv|{Hn\bv{t-rp@-P|y|Hn\bv{t-sy|n-Y|tQr}uHn\bv{t-sy|n-]|v{`v\trHp-Pyv}}r-\n--znA-znvV{rrH--sy|n-sy||V{qrH\fH0vs-[bZlPYV]]R_`-K-=--{vs|z-Pyv}}r-pyv}}rh[bZlPYV]]R_`jH0r{qvs|vq-znv{56-\n--sy|n-ory|{tv{tSY||-J-=;=H--0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6----ory|{tv{tSY||-J-Sy||H--0ryr----ory|{tv{tSY||-J-sy||H--0r{qvs--<<前置裁切计算--0vs-[bZlPYV]]R_`-K-=----o||y-pyv}}rqH----rpA-pyv}}r]|vv|{H----0}ntzn-{|yyly||}ln----s|-5-v{-v-J-=H-v-I-[bZlPYV]]R_`H-v-88-6-\n------pyv}}r]|vv|{-J-pyv}}rh-v-j;znvV{rr-7-|yq]|vv|{H------pyv}}rq-J-5pyv}}rh-v-j;sy||V{qr-I-=;=-\v\v-no5ory|{tv{tSY||-:-pyv}}rh-v-j;sy||V{qr6-I->;=6H------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;-K-:=;B-33-pyv}}r]|vv|{;-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|{;\t-K-:=;B-33-pyv}}r]|vv|{;\t-I-=;BH------vs-5pyv}}rq6-\n--------qvpnqH------\f----\f----0}ntzn-{|yyly||}lr{q--0r{qvs--<<楼层选择计算--sy|n-sy||\\}npv\b-J->;=H--vs-5u|{Sy||V{qr-KJ-=;=-33-no5ory|{tv{tSY||-:-u|{Sy||V{qr6-KJ->;=6-\n----sy||\\}npv\b-J-=;>H--\f--rp@-sv{nyP|y|-J-P|y|H--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----0vs-qrsv{rq5b`Rl]\\V[alONPXlUVQQR[6------rp@-pnzrnQvrpv|{-J-{|znyv\tr5pnzrn]|vv|{-:-|yq]|vv|{;\b\t6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------qvpnqH------\f----0ryvs-qrsv{rq5b`Rl]\\V[alONPXlQN_X6------rp@-pnzrnQvrpv|{-J-{|znyv\tr5pnzrn]|vv|{-:-|yq]|vv|{;\b\t6H------vs-5q|5pnzrnQvrpv|{9-[|zny6-I-=;=6-\n--------sv{nyP|y|-J-sv{nyP|y|-7-=;EH------\f----0r{qvs--0r{qvs--0vs-qrsv{rq5b`Rl]\\V[al`UN]RlPV_PYR6----sy|n--J-?;=-7-tyl]|v{P||q;-:->;=H----sy|n--J-?;=-7-tyl]|v{P||q;\b-:->;=H----sy|n-pp-J-7-8-7H----vs-5]|v{`v\tr-K-E;=-33-pp-K->;=6-\n------qvpnqH----\f--0r{qvs--0vs-qrsv{rq5b`RlP\\[`aN[alP\\Y\\_6----tylSntP|y|-J-rpA5p|{n{P|y|;9-p|{n{P|y|;t9-p|{n{P|y|;o9->;=6H--0ryr----tylSntP|y|-J-rpA5sv{nyP|y|9-z|qryNy}un-7-|}npv\b-7-sy||\\}npv\b6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----tylSntP|y|;n-J-Y|tQr}uH--0r{qvs--0vs-qrsv{rq5b`RlU^ldRVTUa6----sy|n-qvn{pr-J-?;=-7-yr{tu5tyl]|v{P||q;\b-:-=;B6H----sy|n-rvtu-J-zn5=;=9->;=-:-qvn{pr6H----rvtu-J-}|5rvtu9->;B6H----tylSntP|y|;n-J-rvtuH----tylSntP|y|;\b\t-J-tylSntP|y|;\b\t-7-rvtuH--0r{qvs\f"),pointcloudVertexShader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("nvor-rp@-p|y|H0vs-qrsv{rq5b`RlcR_aRelSY\\\\_6--nvor-sy|n-sy||H--n\bv{t-sy|n-Sy||H0r{qvs{vs|z-sy|n-prr{UrvtuH{vs|z-sy|n-}vry_nv|H{vs|z-sy|n-}|v{`pnyrH{vs|z-sy|n-}|v{Zv{]vryH{vs|z-sy|n-}|v{Zn]vryH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-tr|zrvpR|H0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6--{vs|z-nz}yr?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9-:}|wrpv|{Znvh?jh@j6-7-?;=H----rny]|v{`v\tr-J-prr{Urvtu-7-rny]|v{`v\tr-<-urvtuH--0ryvs-qrsv{rq5b`Rl]\\V[al`VgRlNaaR[bNaV\\[6----sy|n-urvtu-J->;=-<-}|wrpv|{Znvh>jh>j-7-zv5>;=9-:z]|vv|{;\t9-:}|wrpv|{Znvh?jh@j6-7-?;=H----rny]|v{`v\tr-J-prr{Urvtu-7-rny]|v{`v\tr-<-urvtuH--0r{qvs--tyl]|v{`v\tr-J-pynz}5rny]|v{`v\tr9-}|v{Zv{]vry-7-}vry_nv|9-}|v{Zn]vry-7-}vry_nv|6H--]|v{`v\tr-J-tyl]|v{`v\trH--0vs-qrsv{rq5b`Rl]\\V[alP\\Y\\_lNYaVabQR6----P|y|-J-trP|y|O\bUrvtu5tnqvr{arr9-|yq]|vv|{6H--0ryr----P|y|-J-p|y|H--0r{qvs--0vs-qrsv{rq5b`Rl]\\V[al[\\_ZNY6----[|zny-J-{|znyv\tr5zn@5z|qryZnv6-7-{|zny6H--0r{qvs--0vs-qrsv{rq5b`RlRQY6----Y|tQr}u-J-y|t?5:z]|vv|{;\t6H--0r{qvs--0vs-qrsv{rq5b`RlU^lQR]aU6----<<-sy|n-}|wSnp|-J-:=;B-7-prr{Urvtu-<-5n{5s|-<-?;=6-7-z]|vv|{;\t6H----<<-sy|n-_nqv-J-rny]|v{`v\tr-<-}|wSnp|H----sy|n-|vtv{nyQr}u-J-tyl]|vv|{;H----sy|n-nqwrqQr}u-J-|vtv{nyQr}u-8-=;>H----sy|n-nqw-J-nqwrqQr}u-<-|vtv{nyQr}uH----z]|vv|{;\b\t-J-z]|vv|{;\b\t-7-nqwH----tyl]|vv|{-J-}|wrpv|{Znv-7-z]|vv|{H--0r{qvs\f");var scratchVector4=new THREE__namespace.Vector4,shaderUniforms$1=Object.assign({pointScale:new THREE__namespace.Uniform(1),pointMinPixel:new THREE__namespace.Uniform(1),pointMaxPixel:new THREE__namespace.Uniform(1),opacity:new THREE__namespace.Uniform(1),gradientTexture:new THREE__namespace.Uniform(null),modelAlpha:new THREE__namespace.Uniform(0),clippers:new THREE__namespace.Uniform([]),shownFloorIndex:new THREE__namespace.Uniform(-1),constantColor:new THREE__namespace.Uniform(null),geometricError:new THREE__namespace.Uniform(0),pixelRatio:new THREE__namespace.Uniform(1),screenHeight:new THREE__namespace.Uniform(512),floor:new THREE__namespace.Uniform(0)},THREE__namespace.UniformsUtils.clone(THREE__namespace.UniformsLib.common)),PBMPointCloudMaterial=function(e){function t(t){var n,r,i,o,a,s,c,l,u,p,d,h,f,m,v,A,g,y,b,E;void 0===t&&(t={});var _,T=e.call(this,{vertexShader:pointcloudVertexShader,fragmentShader:pointcloudFragmentShader,uniforms:THREE__namespace.UniformsUtils.clone(shaderUniforms$1),defines:{USE_CONSTANT_COLOR:!1,USE_EDL:!1,USE_HQ_WEIGHT:!1,USE_HQ_DEPTH:!1,NUM_CLIPPING_BOX:!1,USE_CLIPFLOOR:!1,USE_VERTEX_FLOOR:!1,USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_POINT_NORMAL:!1,USE_POINT_SHAPE_CIRCLE:!1,USE_POINT_SIZE_ATTENUATION:!1,USE_POINT_SIZE_GEOMETRIC:!1,USE_POINT_BACK_HIDDEN:!1,USE_POINT_BACK_DARK:!1}})||this;return Object.defineProperties(T,{constantColor:{get:function(){return this.uniforms.constantColor.value},set:function(e){this.uniforms.constantColor.value=e;var t=null!==e;this.defines.USE_CONSTANT_COLOR!==t&&(this.defines.USE_CONSTANT_COLOR=t,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(e){this.uniforms.modelAlpha.value=e}},shownFloorIndex:{get:function(){return this.uniforms.shownFloorIndex.value},set:function(e){this.uniforms.shownFloorIndex.value=e}},clippers:{get:function(){return _},set:function(e){_!==e&&(_=e,this.uniforms.clippers.value=(_||[]).map((function(e){var t="number"==typeof e.floorIndex?e.floorIndex:-1;return{matrixInverse:(new THREE__namespace.Matrix4).getInverse(e.clippingBoxMatrix),floorIndex:t}})),this.needsUpdate=!0)}},pointColor:{get:function(){return!0===this.defines.USE_POINT_COLOR_ALTITUDE?"ALTITUDE":"RGB"},set:function(e){var t="ALTITUDE"===e;this.defines.USE_POINT_COLOR_ALTITUDE!==t&&(this.defines.USE_POINT_COLOR_ALTITUDE=t,this.needsUpdate=!0)}},pointSize:{get:function(){return!0===this.defines.USE_POINT_SIZE_GEOMETRIC?"GEOMETRIC":!0===this.defines.USE_POINT_SIZE_ATTENUATION?"ATTENUATION":"FIXED"},set:function(e){var t="ATTENUATION"===e,n="GEOMETRIC"===e;this.defines.USE_POINT_SIZE_GEOMETRIC!==n&&(this.defines.USE_POINT_SIZE_GEOMETRIC=n,this.needsUpdate=!0),this.defines.USE_POINT_SIZE_ATTENUATION!==t&&(this.defines.USE_POINT_SIZE_ATTENUATION=t,this.needsUpdate=!0)}},pointShape:{get:function(){return!0===this.defines.USE_POINT_SHAPE_CIRCLE?"CIRCLE":"SQUARE"},set:function(e){var t="CIRCLE"===e;this.defines.USE_POINT_SHAPE_CIRCLE!==t&&(this.defines.USE_POINT_SHAPE_CIRCLE=t,this.needsUpdate=!0)}},pointScale:{get:function(){return this.uniforms.pointScale.value},set:function(e){this.uniforms.pointScale.value=e}},pointBack:{get:function(){return!0===this.defines.USE_POINT_BACK_HIDDEN?"HIDDEN":!0===this.defines.USE_POINT_BACK_DARK?"DARK":"VISIBLE"},set:function(e){var t="HIDDEN"===e,n="DARK"===e;this.defines.USE_POINT_BACK_HIDDEN!==t&&(this.defines.USE_POINT_BACK_HIDDEN=t,this.needsUpdate=!0),this.defines.USE_POINT_BACK_DARK!==n&&(this.defines.USE_POINT_BACK_DARK=n,this.needsUpdate=!0)}},pointMinPixel:{get:function(){return this.uniforms.pointMinPixel.value},set:function(e){this.uniforms.pointMinPixel.value=e}},pointMaxPixel:{get:function(){return this.uniforms.pointMaxPixel.value},set:function(e){this.uniforms.pointMaxPixel.value=e}},useEDL:{get:function(){return this.defines.USE_EDL},set:function(e){e!==this.defines.USE_EDL&&(this.defines.USE_EDL=e,this.needsUpdate=!0)}},useHQWeight:{get:function(){return this.defines.USE_HQ_WEIGHT},set:function(e){e!==this.defines.USE_HQ_WEIGHT&&(this.defines.USE_HQ_WEIGHT=e,this.needsUpdate=!0)}},useHQDepth:{get:function(){return this.defines.USE_HQ_DEPTH},set:function(e){e!==this.defines.USE_HQ_DEPTH&&(this.defines.USE_HQ_DEPTH=e,this.needsUpdate=!0)}},gradientTexture:{get:function(){return this.uniforms.gradientTexture.value},set:function(e){this.uniforms.gradientTexture.value=e}},floor:{get:function(){return this.uniforms.floor.value},set:function(e){this.uniforms.floor.value=e}}}),T.pano0=null!==(n=t.pano0)&&void 0!==n?n:defaultPbmParameters.pano0,T.pano1=null!==(r=t.pano1)&&void 0!==r?r:defaultPbmParameters.pano1,T.modelAlpha=null!==(i=t.modelAlpha)&&void 0!==i?i:defaultPbmParameters.modelAlpha,T.progress=null!==(o=t.progress)&&void 0!==o?o:defaultPbmParameters.progress,T.useBlackTransition=null!==(a=t.useBlackTransition)&&void 0!==a?a:defaultPbmParameters.useBlackTransition,T.constantColor=null!==(s=t.constantColor)&&void 0!==s?s:defaultPbmParameters.constantColor,T.opacity=null!==(c=t.opacity)&&void 0!==c?c:defaultPbmParameters.opacity,T.shownFloorIndex=null!==(l=t.shownFloorIndex)&&void 0!==l?l:defaultPbmParameters.shownFloorIndex,T.clippers=null!==(u=t.clippers)&&void 0!==u?u:defaultPbmParameters.clippers,T.useEDL=null!==(p=t.useEDL)&&void 0!==p?p:defaultPbmParameters.useEDL,T.useHQWeight=null!==(d=t.useHQWeight)&&void 0!==d?d:defaultPbmParameters.useHQWeight,T.useHQDepth=null!==(h=t.useHQDepth)&&void 0!==h?h:defaultPbmParameters.useHQDepth,T.pointColor=null!==(f=t.pointColor)&&void 0!==f?f:defaultPbmParameters.pointColor,T.pointShape=null!==(m=t.pointShape)&&void 0!==m?m:defaultPbmParameters.pointShape,T.pointSize=null!==(v=t.pointSize)&&void 0!==v?v:defaultPbmParameters.pointSize,T.pointScale=null!==(A=t.pointScale)&&void 0!==A?A:defaultPbmParameters.pointScale,T.pointBack=null!==(g=t.pointBack)&&void 0!==g?g:defaultPbmParameters.pointBack,T.pointMinPixel=null!==(y=t.pointMinPixel)&&void 0!==y?y:defaultPbmParameters.pointMinPixel,T.pointMaxPixel=null!==(b=t.pointMaxPixel)&&void 0!==b?b:defaultPbmParameters.pointMaxPixel,T.gradientTexture=null!==(E=t.gradientTexture)&&void 0!==E?E:defaultPbmParameters.gradientTexture,T.floor=0,T.transparent=!1,T}return __extends(t,e),t.prototype.onBeforeCompile=function(e,t){var n,r,i=String(null!==(r=null===(n=this.clippers)||void 0===n?void 0:n.length)&&void 0!==r?r:0);e.vertexShader=e.vertexShader.replace(/NUM_CLIPPERS/g,i),e.fragmentShader=e.fragmentShader.replace(/NUM_CLIPPERS/g,i)},t.prototype.update=function(e,t){var n=t instanceof Camera?t.pixelRatio:e.getPixelRatio(),r=t instanceof Camera?t.screenHeight:e.getViewport(scratchVector4).z;this.uniforms.pixelRatio.value=n,this.uniforms.screenHeight.value=r,this.transparent=this.shownFloorIndex>-1||this.opacity<1||this.modelAlpha<1,this.useEDL&&(this.transparent=!1),this.useHQDepth&&(this.depthTest=!0,this.depthWrite=!0),this.useHQWeight?(this.depthWrite=!1,this.blending=THREE__namespace.CustomBlending,this.blendSrc=THREE__namespace.SrcAlphaFactor,this.blendSrcAlpha=THREE__namespace.SrcAlphaFactor,this.blendDst=THREE__namespace.OneFactor,this.blendDstAlpha=THREE__namespace.OneFactor):(this.depthWrite=!0,this.transparent=this.shownFloorIndex>-1||this.opacity<1||this.modelAlpha<1,this.blendDst=THREE__namespace.OneMinusSrcAlphaFactor,this.blendEquation=THREE__namespace.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blending=THREE__namespace.NormalBlending)},t.prototype.syncModel=function(e){var t="".concat(e.id,":").concat(e.materialVersion);t!==this.syncModelVersion&&(Object.assign(this,e.getMaterial()),this.syncModelVersion=t)},t}(THREE__namespace.ShaderMaterial),PBM_mesh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.loadMesh=function(e,t){var n=this,r=t.json.meshes[e],i=r.primitives,o=Promise.all(i.map((function(e){return t.loadGeometry(e)}))),a=Promise.all(i.map((function(e){return n.loadPBMMaterial(e,t)}))),s=Promise.all([o,a]).then((function(n){for(var o=n[0],a=n[1],s=[],c=0;c<i.length;c++){var l=i[c],u=o[c],p=a[c];void 0===u.attributes.normal&&(p.flatShading=!0),void 0===u.attributes.tangent&&p.normalScale&&(p.normalScale.y*=-1);var d=l.mode||WEBGL_CONSTANTS.TRIANGLES,h=void 0;if(d===WEBGL_CONSTANTS.TRIANGLES||d===WEBGL_CONSTANTS.TRIANGLE_STRIP||d===WEBGL_CONSTANTS.TRIANGLE_FAN)d===WEBGL_CONSTANTS.TRIANGLE_STRIP?u=t.toGeometryTrianglesDrawMode(u,THREE__namespace.TriangleStripDrawMode):d===WEBGL_CONSTANTS.TRIANGLE_FAN&&(u=t.toGeometryTrianglesDrawMode(u,THREE__namespace.TriangleFanDrawMode)),(u=u.clone()).clearGroups(),u.addGroup(0,u.index?u.index.count:u.attributes.position.count,0),u.attributes.normal||u.computeVertexNormals(),h=new PBMMesh(u,[p]);else{if(d!==WEBGL_CONSTANTS.POINTS)throw new Error("glTF: Primitive mode unsupported: "+d);h=new PBMPointCloud(u,p)}h.name=t.createUniqueName(r.name||"mesh_"+e),s.push(h)}if(1===s.length)return s[0];for(var f=new THREE__namespace.Group,m=0,v=s;m<v.length;m++){h=v[m];f.add(h)}return f}));return s},t.prototype.loadPBMMaterial=function(e,t){var n=e.mode,r=null;if(n===WEBGL_CONSTANTS.TRIANGLES||n===WEBGL_CONSTANTS.TRIANGLE_STRIP||n===WEBGL_CONSTANTS.TRIANGLE_FAN)r=this.loadPBMMeshMaterial(e,t);else{if(n!==WEBGL_CONSTANTS.POINTS)throw new Error("glTF: Primitive mode unsupported: "+n);r=this.loadPBMPointCloudMaterial(e,t)}return r},t.prototype.extendTexture=function(e,t,n){return e.minFilter=THREE__namespace.LinearFilter,e.magFilter=THREE__namespace.LinearFilter,e.generateMipmaps=!1,e},t.prototype.loadPBMPointCloudMaterial=function(e,t){var n=new PBMPointCloudMaterial;return Object.keys(e.attributes).filter((function(e){return"normal"===ATTRIBUTES[e]})).length>0&&(n.defines.USE_POINT_NORMAL=!0),Promise.resolve(n)},t.prototype.loadPBMMeshMaterial=function(e,t){var n=[],r=new PBMMeshMaterial;if(r.uniforms.diffuse.value=new THREE__namespace.Color(1,1,1),r.uniforms.exposure.value=3.3,r.defines.USE_MAP=!1,Object.keys(e.attributes).filter((function(e){return"color"===ATTRIBUTES[e]})).length>0&&(r.vertexColors=!0),0===Object.keys(e.attributes).filter((function(e){return"tangent"===ATTRIBUTES[e]})).length&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),void 0!==e.material){var i=t.json.materials[e.material];i.name&&(r.name=i.name);var o=i.pbrMetallicRoughness||{};if(Array.isArray(o.baseColorFactor)){var a=o.baseColorFactor;r.uniforms.diffuse.value.fromArray(a)}if(void 0!==o.baseColorTexture&&n.push(t.createMaterialTexture(o.baseColorTexture).then((function(e){r.uniforms.map.value=e,r.defines.USE_MAP=!0}))),!0===i.doubleSided&&(r.side=THREE__namespace.DoubleSide),void 0!==i.normalTexture&&(n.push(t.createMaterialTexture(i.normalTexture).then((function(e){r.uniforms.normalMap.value=e}))),r.uniforms.normalScale.value=new THREE__namespace.Vector2(1,1),void 0!==i.normalTexture.scale)){var s=i.normalTexture.scale;r.uniforms.normalScale.value.set(s,s)}}return Promise.all(n).then((function(){return r}))},t}(BaseExtension),EXTENSIONS={KHR_binary_glTF:KHR_binary_glTF,KHR_draco_mesh_compression:KHR_draco_mesh_compression,KHR_texture_basisu:KHR_texture_basisu,KHR_texture_transform:KHR_texture_transform,KHR_mesh_quantization:KHR_mesh_quantization,EXT_meshopt_compression:EXT_meshopt_compression,EXT_texture_webp:EXT_texture_webp,CESIUM_RTC:CESIUM_RTC,PBM_mesh:PBM_mesh};function parseGltf(e,t){var n,r,i,o,a={};if(t.addonExtensions)for(var s=0,c=t.addonExtensions;s<c.length;s++){var l=c[s];a[l]=new EXTENSIONS[l]}if("string"==typeof e)o=e;else if(EXTENSIONS.KHR_binary_glTF.getMagic(e)===EXTENSIONS.KHR_binary_glTF.HEADER_MAGIC){var u=new EXTENSIONS.KHR_binary_glTF;try{u.loadGlbBinary(e)}catch(m){return Promise.reject(m)}a.KHR_binary_glTF=u,o=u.content}else o=decodeText(new Uint8Array(e));var p=JSON.parse(o);if(void 0===p.asset||Number(p.asset.version[0])<2)return Promise.reject(new Error("glTF: Unsupported asset. glTF versions >=2.0 are supported."));if(p.extensionsUsed)for(var d=p.extensionsRequired||[],h=0;h<p.extensionsUsed.length;h++){var f=p.extensionsUsed[h];a[f]||(EXTENSIONS[f]?a[f]=new EXTENSIONS[f]:d.indexOf(f)>=0&&console.warn('glTF: Unknown extension "'+f+'".'))}return new Parser(p,a,{copyUV2:null===(n=t.copyUV2)||void 0===n||n,resourcePath:null!==(r=t.resourcePath)&&void 0!==r?r:"",search:null!==(i=t.search)&&void 0!==i?i:"",fetcher:t.fetcher}).parse()}var ROTATE_X_MATRIX$1=(new THREE__namespace.Matrix4).fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadB3dm(e,t){var n={uri:e,gltfUpAxis:t.upAxis};return Promise.resolve().then((function(){return t.fetcher.ajax(e,{responseType:"arraybuffer"}).then((function(e){return e.body}))})).then((function(e){return Promise.resolve(0).then((function(t){return parseHeader(n,e,t)})).then((function(t){return parseTable(n,e,t)})).then((function(t){return parseGlTFArrayBuffer(n,e,t)}))})).then((function(){var r;return parseGltf(n.gltfArrayBuffer,{copyUV2:!1,addonExtensions:["PBM_mesh"],resourcePath:e.slice(0,e.lastIndexOf("/")+1),search:null!==(r=e.split("?")[1])&&void 0!==r?r:"",fetcher:t.fetcher}).then((function(e){var r=new THREE__namespace.Matrix4;"Z"!==t.upAxis&&r.premultiply(ROTATE_X_MATRIX$1);var i=(new THREE__namespace.Matrix4).setPosition(n.rtcCenter[0],n.rtcCenter[1],n.rtcCenter[2]);if(r.premultiply(i),e.CESIUM_RTC){var o=(new THREE__namespace.Matrix4).setPosition(e.CESIUM_RTC.center);r.premultiply(o)}var a=e.scene;return a.applyMatrix4(r),{type:"b3dm",uri:n.uri,byteLength:n.byteLength,object:a,dispose:function(){return e.dispose()}}}))}))}var WorkerPool=function(){function e(e,t){this.pool=t,this.workerCreator=e,this.queue=[],this.workers=[],this.workersResolver=[],this.workerStatus=0}return e.prototype.initWorker=function(e){if(this.workerCreator&&!this.workers[e]){var t=this.workerCreator();t.addEventListener("message",this.onMessage.bind(this,e)),this.workers[e]=t}},e.prototype.getIdleWorker=function(){for(var e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1},e.prototype.onMessage=function(e,t){var n=this.workersResolver[e],r=n.resolve,i=n.reject;if(t.data&&"$$error"in t.data?i(t.data.$$error):r(t.data),this.queue.length){var o=this.queue.shift(),a=o.resolve,s=o.reject,c=o.input,l=o.transfer;this.workersResolver[e]={resolve:a,reject:s},this.workers[e].postMessage(c,l)}else this.workerStatus^=1<<e},e.prototype.postMessage=function(e,t){var n=this;return void 0===t&&(t=[]),new Promise((function(r,i){var o=n.getIdleWorker();-1!==o?(n.initWorker(o),n.workerStatus|=1<<o,n.workersResolver[o]={resolve:r,reject:i},n.workers[o].postMessage(e,t)):n.queue.push({resolve:r,reject:i,input:e,transfer:t})}))},e.prototype.dispose=function(){this.workers.forEach((function(e){return e.terminate()})),this.workersResolver.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0},e}();const encodedJs="IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciByLHQsZTsoZT10fHwodD17fSkpW2UuQllURT01MTIwXT0iQllURSIsZVtlLlVOU0lHTkVEX0JZVEU9NTEyMV09IlVOU0lHTkVEX0JZVEUiLGVbZS5TSE9SVD01MTIyXT0iU0hPUlQiLGVbZS5VTlNJR05FRF9TSE9SVD01MTIzXT0iVU5TSUdORURfU0hPUlQiLGVbZS5JTlQ9NTEyNF09IklOVCIsZVtlLlVOU0lHTkVEX0lOVD01MTI1XT0iVU5TSUdORURfSU5UIixlW2UuRkxPQVQ9NTEyNl09IkZMT0FUIixlW2UuRE9VQkxFPTUxMzBdPSJET1VCTEUiO3ZhciBuPSgocj17fSlbdC5ET1VCTEVdPUZsb2F0NjRBcnJheSxyW3QuRkxPQVRdPUZsb2F0MzJBcnJheSxyW3QuVU5TSUdORURfU0hPUlRdPVVpbnQxNkFycmF5LHJbdC5VTlNJR05FRF9JTlRdPVVpbnQzMkFycmF5LHJbdC5VTlNJR05FRF9CWVRFXT1VaW50OEFycmF5LHJbdC5CWVRFXT1JbnQ4QXJyYXksclt0LlNIT1JUXT1JbnQxNkFycmF5LHJbdC5JTlRdPUludDMyQXJyYXksciksbz17RE9VQkxFOnQuRE9VQkxFLEZMT0FUOnQuRkxPQVQsVU5TSUdORURfU0hPUlQ6dC5VTlNJR05FRF9TSE9SVCxVTlNJR05FRF9JTlQ6dC5VTlNJR05FRF9JTlQsVU5TSUdORURfQllURTp0LlVOU0lHTkVEX0JZVEUsQllURTp0LkJZVEUsU0hPUlQ6dC5TSE9SVCxJTlQ6dC5JTlR9O2Z1bmN0aW9uIGEocil7dmFyIHQ9bltyXTtpZighdCl0aHJvdyBuZXcgRXJyb3IoIkZhaWxlZCB0byBjb252ZXJ0IEdMIHR5cGUiKTtyZXR1cm4gdH1mdW5jdGlvbiBpKHIpe3JldHVybiBhKHI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X0oKTsK",blob$1="undefined"!=typeof window&&window.Blob&&new Blob([atob(encodedJs)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper(e){let t;try{if(t=blob$1&&(window.URL||window.webkitURL).createObjectURL(blob$1),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",(()=>{(window.URL||window.webkitURL).revokeObjectURL(t)})),n}catch(n){return new Worker("data:application/javascript;base64,"+encodedJs,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var attributeWorkerPool=new WorkerPool((function(){return new WorkerWrapper}),4);function parsePointCloud(e,t,n){var r=new FeatureTable(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then((function(){var e=r.getExtension("3DTILES_draco_point_compression");return e?parseDraco(e,r):attributeWorkerPool.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])})).then((function(t){return e.attributes=t,n}))}function parseDraco(e,t){return __awaiter(this,void 0,void 0,(function(){var n,r,i,o,a,s;return __generator(this,(function(c){if(n=e.properties||{},r=e.byteOffset,i=e.byteLength,!n||!Number.isFinite(r)||!i)throw new Error("Draco properties, byteOffset, and byteLength must be defined");return o=t.buffer.slice(r,r+i),a=e.properties,s={POSITION:"Float32Array",NORMAL:"Float32Array",RGB:"Uint8Array",RGBA:"Uint8Array"},[2,draco.decodeGeometry(o.buffer,{attributeIDs:a,attributeTypes:s,useUniqueIDs:!0}).then((function(e){var t,n=e.getAttribute("POSITION"),r=e.getAttribute("RGB"),i=e.getAttribute("RGBA"),o=e.getAttribute("NORMAL");if(i)t=i;else if(r){for(var a=r.count,s=r.array,c=new Uint8Array(4*a),l=0,u=void 0,p=void 0;l<a;l++)u=3*l,c[p=4*l]=s[u],c[++p]=s[++u],c[++p]=s[++u];t=new THREE__namespace.BufferAttribute(c,4,r.normalized)}return{position:n?{array:n.array,itemSize:n.itemSize,normalized:n.normalized}:null,color:t?{array:t.array,itemSize:t.itemSize,normalized:t.normalized}:null,normal:o?{array:o.array,itemSize:o.itemSize,normalized:o.normalized}:null}}))]}))}))}function loadPnts(e,t){var n={uri:e};return Promise.resolve().then((function(){return t.fetcher.ajax(e,{responseType:"arraybuffer"}).then((function(e){return e.body}))})).then((function(e){return Promise.resolve(0).then((function(t){return parseHeader(n,e,t)})).then((function(t){return parseTable(n,e,t)})).then((function(t){return parsePointCloud(n,e,t)}))})).then((function(){var e;return createPoints(n.attributes,{computeBoundingBox:null===(e=t.computeBoundingBox)||void 0===e||e})})).then((function(e){var t=new THREE__namespace.Matrix4,r=(new THREE__namespace.Matrix4).setPosition(n.rtcCenter[0],n.rtcCenter[1],n.rtcCenter[2]);return t.premultiply(r),e.object.applyMatrix4(t),{type:"pnts",uri:n.uri,byteLength:n.byteLength,object:e.object,dispose:function(){return e.dispose()}}}))}function createPoints(e,t){var n=new Set,r=new THREE__namespace.BufferGeometry;n.add(r);var i=new PBMPointCloudMaterial;n.add(i),e.position&&r.setAttribute("position",new THREE__namespace.BufferAttribute(e.position.array,e.position.itemSize,e.position.normalized)),e.color&&r.setAttribute("color",new THREE__namespace.BufferAttribute(e.color.array,e.color.itemSize,e.color.normalized)),e.normal&&(r.setAttribute("normal",new THREE__namespace.BufferAttribute(e.normal.array,e.normal.itemSize,e.normal.normalized)),i.defines.USE_POINT_NORMAL=!0),t.computeBoundingBox&&r.computeBoundingBox();var o=new PBMPointCloud(r,i);return o.matrix.compose(o.position,o.quaternion,o.scale),o.matrixAutoUpdate=!1,o.frustumCulled=!1,o.renderOrder=-1e3,Promise.resolve({object:o,dispose:function(){n.forEach((function(e){e.dispose()})),n.clear()}})}function createLZMA(){var e={OutWindow:function(){this._windowSize=0}};return e.OutWindow.prototype.create=function(e){this._buffer&&this._windowSize===e||(this._buffer=[]),this._windowSize=e,this._pos=0,this._streamPos=0},e.OutWindow.prototype.flush=function(){var e=this._pos-this._streamPos;if(0!==e){for(;e--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},e.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},e.OutWindow.prototype.setStream=function(e){this.releaseStream(),this._stream=e},e.OutWindow.prototype.init=function(e){e||(this._streamPos=0,this._pos=0)},e.OutWindow.prototype.copyBlock=function(e,t){var n=this._pos-e-1;for(n<0&&(n+=this._windowSize);t--;)n>=this._windowSize&&(n=0),this._buffer[this._pos++]=this._buffer[n++],this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.putByte=function(e){this._buffer[this._pos++]=e,this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.getByte=function(e){var t=this._pos-e-1;return t<0&&(t+=this._windowSize),this._buffer[t]},e.RangeDecoder=function(){},e.RangeDecoder.prototype.setStream=function(e){this._stream=e},e.RangeDecoder.prototype.releaseStream=function(){this._stream=null},e.RangeDecoder.prototype.init=function(){var e=5;for(this._code=0,this._range=-1;e--;)this._code=this._code<<8|this._stream.readByte()},e.RangeDecoder.prototype.decodeDirectBits=function(e){for(var t,n=0,r=e;r--;)this._range>>>=1,t=this._code-this._range>>>31,this._code-=this._range&t-1,n=n<<1|1-t,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return n},e.RangeDecoder.prototype.decodeBit=function(e,t){var n=e[t],r=(this._range>>>11)*n;return(2147483648^this._code)<(2147483648^r)?(this._range=r,e[t]+=2048-n>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=r,this._code-=r,e[t]-=n>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},e.initBitModels=function(e,t){for(;t--;)e[t]=1024},e.BitTreeDecoder=function(e){this._models=[],this._numBitLevels=e},e.BitTreeDecoder.prototype.init=function(){e.initBitModels(this._models,1<<this._numBitLevels)},e.BitTreeDecoder.prototype.decode=function(e){for(var t=1,n=this._numBitLevels;n--;)t=t<<1|e.decodeBit(this._models,t);return t-(1<<this._numBitLevels)},e.BitTreeDecoder.prototype.reverseDecode=function(e){for(var t,n=1,r=0,i=0;i<this._numBitLevels;++i)n=n<<1|(t=e.decodeBit(this._models,n)),r|=t<<i;return r},e.reverseDecode2=function(e,t,n,r){for(var i,o=1,a=0,s=0;s<r;++s)o=o<<1|(i=n.decodeBit(e,t+o)),a|=i<<s;return a},e.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new e.BitTreeDecoder(8),this._numPosStates=0},e.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new e.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new e.BitTreeDecoder(3)},e.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(e.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},e.LenDecoder.prototype.decode=function(e,t){return 0===e.decodeBit(this._choice,0)?this._lowCoder[t].decode(e):0===e.decodeBit(this._choice,1)?8+this._midCoder[t].decode(e):16+this._highCoder.decode(e)},e.Decoder2=function(){this._decoders=[]},e.Decoder2.prototype.init=function(){e.initBitModels(this._decoders,768)},e.Decoder2.prototype.decodeNormal=function(e){var t=1;do{t=t<<1|e.decodeBit(this._decoders,t)}while(t<256);return 255&t},e.Decoder2.prototype.decodeWithMatchByte=function(e,t){var n,r,i=1;do{if(n=t>>7&1,t<<=1,i=i<<1|(r=e.decodeBit(this._decoders,(1+n<<8)+i)),n!==r){for(;i<256;)i=i<<1|e.decodeBit(this._decoders,i);break}}while(i<256);return 255&i},e.LiteralDecoder=function(){},e.LiteralDecoder.prototype.create=function(t,n){var r;if(!this._coders||this._numPrevBits!==n||this._numPosBits!==t)for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=n,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=new e.Decoder2},e.LiteralDecoder.prototype.init=function(){for(var e=1<<this._numPrevBits+this._numPosBits;e--;)this._coders[e].init()},e.LiteralDecoder.prototype.getDecoder=function(e,t){return this._coders[((e&this._posMask)<<this._numPrevBits)+((255&t)>>>8-this._numPrevBits)]},e.Decoder=function(){this._outWindow=new e.OutWindow,this._rangeDecoder=new e.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new e.BitTreeDecoder(4),this._lenDecoder=new e.LenDecoder,this._repLenDecoder=new e.LenDecoder,this._literalDecoder=new e.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new e.BitTreeDecoder(6),this._posSlotDecoder[1]=new e.BitTreeDecoder(6),this._posSlotDecoder[2]=new e.BitTreeDecoder(6),this._posSlotDecoder[3]=new e.BitTreeDecoder(6)},e.Decoder.prototype.setDictionarySize=function(e){return!(e<0)&&(this._dictionarySize!==e&&(this._dictionarySize=e,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},e.Decoder.prototype.setLcLpPb=function(e,t,n){var r=1<<n;return!(e>8||t>4||n>4)&&(this._literalDecoder.create(t,e),this._lenDecoder.create(r),this._repLenDecoder.create(r),this._posStateMask=r-1,!0)},e.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),e.initBitModels(this._isMatchDecoders,192),e.initBitModels(this._isRep0LongDecoders,192),e.initBitModels(this._isRepDecoders,12),e.initBitModels(this._isRepG0Decoders,12),e.initBitModels(this._isRepG1Decoders,12),e.initBitModels(this._isRepG2Decoders,12),e.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},e.Decoder.prototype.decode=function(t,n,r){var i,o,a,s,c,l,u=0,p=0,d=0,h=0,f=0,m=0,v=0;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(n),this.init();r<0||m<r;)if(i=m&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(u<<4)+i))o=this._literalDecoder.getDecoder(m++,v),v=u>=7?o.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(p)):o.decodeNormal(this._rangeDecoder),this._outWindow.putByte(v),u=u<4?0:u-(u<10?3:6);else{if(1===this._rangeDecoder.decodeBit(this._isRepDecoders,u))a=0,0===this._rangeDecoder.decodeBit(this._isRepG0Decoders,u)?0===this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(u<<4)+i)&&(u=u<7?9:11,a=1):(0===this._rangeDecoder.decodeBit(this._isRepG1Decoders,u)?s=d:(0===this._rangeDecoder.decodeBit(this._isRepG2Decoders,u)?s=h:(s=f,f=h),h=d),d=p,p=s),0===a&&(a=2+this._repLenDecoder.decode(this._rangeDecoder,i),u=u<7?8:11);else if(f=h,h=d,d=p,a=2+this._lenDecoder.decode(this._rangeDecoder,i),u=u<7?7:10,(c=this._posSlotDecoder[a<=5?a-2:3].decode(this._rangeDecoder))>=4){if(p=(2|1&c)<<(l=(c>>1)-1),c<14)p+=e.reverseDecode2(this._posDecoders,p-c-1,this._rangeDecoder,l);else if(p+=this._rangeDecoder.decodeDirectBits(l-4)<<4,(p+=this._posAlignDecoder.reverseDecode(this._rangeDecoder))<0){if(-1===p)break;return!1}}else p=c;if(p>=m||p>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(p,a),m+=a,v=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},e.Decoder.prototype.setDecoderProperties=function(e){var t,n,r,i,o;return!(e.size<5)&&(n=(t=e.readByte())%9,r=(t=~~(t/9))%5,i=~~(t/5),!!this.setLcLpPb(n,r,i)&&(o=e.readByte(),o|=e.readByte()<<8,o|=e.readByte()<<16,o+=16777216*e.readByte(),this.setDictionarySize(o)))},e.decompress=function(t,n,r,i){var o=new e.Decoder;if(!o.setDecoderProperties(t))throw"Incorrect stream properties";if(!o.decode(n,r,i))throw"Error in data stream";return!0},e.decompressFile=function(t,n){var r,i=new e.Decoder;if(!i.setDecoderProperties(t))throw"Incorrect stream properties";if(r=t.readByte(),r|=t.readByte()<<8,r|=t.readByte()<<16,r+=16777216*t.readByte(),t.readByte(),t.readByte(),t.readByte(),t.readByte(),!i.decode(t,n,r))throw"Error in data stream";return!0},e}var LZMA=createLZMA();function createWASM(){return function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),r=0;r<64;r++)n[t.charCodeAt(r)]=r;var i,o,a,s,c,l=.75*e.length,u=e.length,p=0;"="===e[e.length-1]&&(l--,"="===e[e.length-2]&&l--);var d=new ArrayBuffer(l),h=new Uint8Array(d);for(i=0;i<u;i+=4)o=n[e.charCodeAt(i)],a=n[e.charCodeAt(i+1)],s=n[e.charCodeAt(i+2)],c=n[e.charCodeAt(i+3)],h[p++]=o<<2|a>>4,h[p++]=(15&a)<<4|s>>2,h[p++]=(3&s)<<6|63&c;return d}("AGFzbQEAAAABSg1gAABgAX8Bf2ACf38Bf2AEf39/fwBgA39/fwBgAX8AYAJ/fwBgA39/fwF/YAR/f39/AX9gAn9/AGABfwF/YAABf2AEf39/fwF/AhsCA2VudgVhYm9ydAADA2VudgZtZW1vcnkCAAEDJiUBAQkKAgoKCwsLCwsAAgoBAgQKAQYFCAoFBQQEBwgCBwwCAQAABAQBcAABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwc9BgZtZW1vcnkCAAV0YWJsZQEABXJlc2V0AA0KbmV3VThBcnJheQAQCnVucGFja1NpemUAFAZkZWNvZGUAIwgBJAkHAQBBAAsBJQqAViVoAQN/IABBgICAgARLBEAACyMBIgEgAEEBIABBAUsbakEHakF4cSICPwAiA0EQdEsEQCADIAIgAWtB//8DakGAgHxxQRB2IgAgAyAAShtAAEEASARAIABAAEEASARAAAsLCyACJAEgAQsbAQF/QQFBICAAQQdqZ2t0EAEiASAANgIAIAELkQMBAX8gAUUEQA8LIABBADoAACAAIAFqQQFrQQA6AAAgAUECTQRADwsgAEEBakEAOgAAIABBAmpBADoAACAAIAFqIgJBAmtBADoAACACQQNrQQA6AAAgAUEGTQRADwsgAEEDakEAOgAAIAAgAWpBBGtBADoAACABQQhNBEAPC0EAIABrQQNxIgIgAGoiAEEANgIAIAEgAmtBfHEiASAAakEEa0EANgIAIAFBCE0EQA8LIABBBGpBADYCACAAQQhqQQA2AgAgACABaiICQQxrQQA2AgAgAkEIa0EANgIAIAFBGE0EQA8LIABBDGpBADYCACAAQRBqQQA2AgAgAEEUakEANgIAIABBGGpBADYCACAAIAFqIgJBHGtBADYCACACQRhrQQA2AgAgAkEUa0EANgIAIAJBEGtBADYCACAAQQRxQRhqIgIgAGohACABIAJrIQEDQCABQSBPBEAgAEIANwMAIABBCGpCADcDACAAQRBqQgA3AwAgAEEYakIANwMAIAFBIGshASAAQSBqIQAMAQsLC1EBA38gAEH+////AEsEQEEAQSBBLUEnEAAACyAAQQJ0IgMQAiECQQgQASIBQQA2AgAgAUEANgIEIAEgAjYCACABIAA2AgQgAkEIaiADEAMgAQtmAQF/IAFB/P///wFLBEBBAEHAAEEXQSIQAAALIAFBAXQiARACIgJBCGogARADIABFBEBBDBABIQALIABBADYCACAAQQA2AgQgAEEANgIIIAAgAjYCACAAQQA2AgQgACABNgIIIAALCgBBDBABIAAQBQsuAQF/QQgQASIBQQA2AgAgAUEANgIEIAEgADYCBCABQQEgASgCBHQQBjYCACABC6EBAQR/QRAQASIBQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgxBEBAEIQIDQCAAQRBIBEBBAxAHIQMgAigCACAAQQJ0aiADNgIIIABBAWohAAwBCwsgASACNgIEQRAQBCECQQAhAANAIABBEEgEQEEDEAchAyACKAIAIABBAnRqIAM2AgggAEEBaiEADAELCyABIAI2AgggAUEIEAc2AgwgAQs0AQF/Q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wRAIAFBAkYEQCAFBEAgACgCACgCCCgCECACRw0DCwUMAgsLIAAoAgAoAgQtAAQaQQFBACAAKAIAKAIIKAIQIAAoAgAoAggoAgQQIQ8LQQBBAUEAQQAQIQsIACMDIAAQIgsWAEG4ASQAIwAkAUGAgIAIJAIQDCQDCwMAAQsLtwEEAEEICxcKAAAAdQBzAGUAIABzAHQAcgBpAGMAdABBIAsdDQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHMAQcAACzkbAAAAfgBsAGkAYgAvAGkAbgB0AGUAcgBuAGEAbAAvAHQAeQBwAGUAZABhAHIAcgBhAHkALgB0AHMAQYABCzMYAAAAcwByAGMALwBsAHoAbQBhAC8AbAB6AG0AYQAtAGQAZQBjAG8AZABlAHIALgB0AHM=")}function decodeLZMA(e,t,n){try{var r={data:t,offset:0,readByte:function(){return this.data[this.offset++]}},i=r.data.length,o={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/i);this.data[t]||(this.data[t]=new Uint8Array(i)),this.data[t][this.offset%i]=e,this.offset++}};e.decompressFile(r,o);for(var a=new Uint8Array(o.offset),s=0;s<o.offset;s++)a[s]=o.data[Math.floor(s/i)][s%i];n(null,a)}catch(c){n(c)}}function decodeLZMAWithWASM(e,t,n){try{var r=new WebAssembly.Memory({initial:16}),i=new WebAssembly.Module(e),o=new WebAssembly.Instance(i,{env:{memory:r,abort:function(){n(new Error("webAssembly abort"))}}}).exports,a=o.newU8Array(t.length);new Uint8Array(r.buffer,a+24,t.length).set(t);var s=o.decode(a),c=new Uint32Array(r.buffer,s,4),l=c[0],u=c[2],p=c[3];l?n(null,new Uint8Array(r.buffer,p+24,u).slice(0,u)):n(new Error("lzma deocder error"))}catch(d){n(d)}}var lzmaWorkerSource="\nvar decodeLZMA = (function() {\n var LZMA = (".concat(createLZMA.toString(),")();\n return function(data, callback) {\n return (").concat(decodeLZMA.toString(),")(LZMA, data, callback);\n }\n})();\n\nvar decodeLZMAWithWASM = (function() {\n var LZMA_WASM = (").concat(createWASM.toString(),")();\n return function(data, callback) {\n return (").concat(decodeLZMAWithWASM.toString(),')(LZMA_WASM, data, callback);\n }\n})();\n\nself.onmessage = function(event) {\n var packet = event.data;\n if (!packet.id) {\n postMessage({ id: packet.id, error: "No incoming id." });\n return;\n }\n if (!packet.data) {\n postMessage({ id: packet.id, error: "No input data." });\n return;\n }\n if (packet.type == "decompress") {\n if (packet.data.constructor !== Uint8Array) {\n postMessage({ id: packet.id, error: "Input data is not Uint8Array." });\n }\n const callback = function(error, result) {\n if (error) {\n postMessage({ id: packet.id, error: error.toString() });\n } else {\n postMessage({ id: packet.id, result: result, error: null }, [ result.buffer ]);\n }\n }\n if (typeof WebAssembly !== "undefined" && WebAssembly.instantiate) {\n decodeLZMAWithWASM(packet.data, callback);\n } else {\n decodeLZMA(packet.data, callback);\n }\n return;\n }\n postMessage({ id: packet.id, error: "type never matched." });\n};\n'),support="undefined"!=typeof Worker&&"undefined"!=typeof Blob,lzmaWorkerURL="";if(support)try{var blob=new Blob([lzmaWorkerSource],{type:"text/javascript"});lzmaWorkerURL=URL.createObjectURL(blob)}catch(error){}var LZMAWorker=function(){function e(){var e=this;if(!support)throw new Error("LZMAWorker cannot work in this broswer.");this.callCounter=0,this.requests={};var t=this.worker=new Worker(lzmaWorkerURL);t.onmessage=function(t){var n=t.data,r=n.id,i=n.result,o=n.error,a=e.getKey(r);e.requests[a]&&(o?e.requests[a](new Error(o)):e.requests[a](null,i),delete e.requests[a])},t.onerror=function(e){return console.error(e)}}return e.prototype.getKey=function(e){return"key_"+String(e)},e.prototype.decompress=function(e,t){var n=++this.callCounter;this.requests[this.getKey(n)]=t,this.worker.postMessage({type:"decompress",id:n,data:e},[e.buffer])},e.prototype.terminate=function(){this.worker.terminate()},e.support=support,e}();function readUint32(e){return Array.prototype.reduce.call(e,(function(e,t,n){return e|t<<8*n}),0)}function binaryArrays(e){for(var t,n=[],r=e.length,i=function(r){var i={data:e[r],offset:0,readByte:function(){return this.data[this.offset++]}},o=i.data.length,a={data:[],offset:0,writeByte:function(e){var t=Math.floor(this.offset/o);this.data[t]||(this.data[t]=new Uint8Array(o)),this.data[t][this.offset%o]=e,this.offset++}};LZMA.decompressFile(i,a),t=new Uint8Array(a.offset);for(var s=0;s<a.offset;s++)t[s]=a.data[Math.floor(s/o)][s%o];n.push(t)},o=0;o<r;o++)i(o);return n}function binaryArraysWithWorker(e){for(var t=[],n=e.length,r=function(n){t.push(new Promise((function(t,r){var i=new LZMAWorker;i.decompress(e[n],(function(e,n){if(i.terminate(),e)return r(e);t(n)}))})))},i=0;i<n;i++)r(i);return Promise.all(t)}function lzma(e){var t=new Uint8Array(e),n=readUint32(t.slice(0,4));if(n>10)return Promise.reject(new Error("LZMA got too many sub chunks."));for(var r=[],i=[],o=4+4*n,a=0;a<n;a++)i[a]=readUint32(t.slice(4+4*a,8+4*a)),r[a]=a===n-1?t.subarray(o,o+i[a]):t.slice(o,o+i[a]),o+=i[a];return LZMAWorker.support?binaryArraysWithWorker(r):Promise.resolve(binaryArrays(r))}var dequeuing=!1,queue=[];function dequeue(e){if(void 0===e&&(e=!1),e||!dequeuing){dequeuing=!0;var t=queue.shift();if(t){try{t()}catch(error){}AnimationFrameLoop.shared.add((function(){return dequeue(!0)}),!0,2,-100)}else dequeuing=!1}}function delay(e){return new Promise((function(t,n){queue.push((function(){try{t(e())}catch(error){n(error)}})),AnimationFrameLoop.shared.add((function(){return dequeue()}),!0,2,-100)}))}function pick(e,t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r];o in e&&(n[o]=e[o])}return n}function omit(e,t){for(var n=__assign({},e),r=0,i=t;r<i.length;r++){var o=i[r];o in n&&delete n[o]}return n}function jsonStableStrinfiy_(e,t){void 0===t&&(t=!1);var n=typeof e;if("string"===n)return JSON.stringify(e);if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(e instanceof Array){for(var r="[",i=e.length-1,o=0;o<i;o++)r+=jsonStableStrinfiy_(e[o],!1)+",";return i>-1&&(r+=jsonStableStrinfiy_(e[o],!1)),r+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return jsonStableStrinfiy_(e.toJSON(),t);var a=Object.keys(e).sort(),s=a.length;for(r="",o=0;o<s;){var c=a[o],l=jsonStableStrinfiy_(e[c],!0);void 0!==l&&(o&&""!==r&&(r+=","),r+=JSON.stringify(c)+":"+l),o++}return"{"+r+"}"}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 jsonHash(e){return"hash::".concat(jsonStableStrinfiy_(e,!1))}var renderTarget=new THREE__namespace.WebGLRenderTarget(1,1),camera$2=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1);camera$2.matrixAutoUpdate=!1;var geometry$5=new THREE__namespace.BufferGeometry;geometry$5.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3));var mesh$4=new THREE__namespace.Mesh(geometry$5);mesh$4.matrixAutoUpdate=!1;var scene$2=new THREE__namespace.Scene;scene$2.add(mesh$4),scene$2.matrixAutoUpdate=!1;var textureMaterial=new THREE__namespace.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform sampler2D map;\n void main() {\n gl_FragColor = texture2D(map, vec2(0, 0));\n }\n ",depthTest:!1,depthWrite:!1,stencilWrite:!1,colorWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1}),cubeTextureMaterial=new THREE__namespace.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform samplerCube map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0, 0));\n }\n ",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:THREE__namespace.NoBlending,lights:!1,toneMapped:!1}),task=Promise.resolve();function initTexture(e,t){if(!t)return Promise.resolve(e);var n=t.getRenderTarget();t.setRenderTarget(renderTarget),e instanceof THREE__namespace.CubeTexture?(mesh$4.material=cubeTextureMaterial,cubeTextureMaterial.uniforms.map.value=e,t.render(scene$2,camera$2),cubeTextureMaterial.uniforms.map.value=null):(mesh$4.material=textureMaterial,textureMaterial.uniforms.map.value=e,t.render(scene$2,camera$2),cubeTextureMaterial.uniforms.map.value=null),t.setRenderTarget(n);var r=task.then((function(){return new Promise((function(t){AnimationFrameLoop.shared.add((function(){t(e)}),!0)}))}));return task=r.catch((function(){})),r}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},indexMinimal={},minimal$1={},aspromise=asPromise;function asPromise(e,t){for(var n=new Array(arguments.length-1),r=0,i=2,o=!0;i<arguments.length;)n[r++]=arguments[i++];return new Promise((function(i,a){n[r]=function(e){if(o)if(o=!1,e)a(e);else{for(var t=new Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];i.apply(null,t)}};try{e.apply(t||null,n)}catch(s){o&&(o=!1,a(s))}}))}var base64$1={};!function(e){var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var n=new Array(64),r=new Array(123),i=0;i<64;)r[n[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;t.encode=function(e,t,r){for(var i,o=null,a=[],s=0,c=0;t<r;){var l=e[t++];switch(c){case 0:a[s++]=n[l>>2],i=(3&l)<<4,c=1;break;case 1:a[s++]=n[i|l>>4],i=(15&l)<<2,c=2;break;case 2:a[s++]=n[i|l>>6],a[s++]=n[63&l],c=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return c&&(a[s++]=n[i],a[s++]=61,1===c&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var o="invalid encoding";t.decode=function(e,t,n){for(var i,a=n,s=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&s>1)break;if(void 0===(l=r[l]))throw Error(o);switch(s){case 0:i=l,s=1;break;case 1:t[n++]=i<<2|(48&l)>>4,i=l,s=2;break;case 2:t[n++]=(15&i)<<4|(60&l)>>2,i=l,s=3;break;case 3:t[n++]=(3&i)<<6|l,s=0}}if(1===s)throw Error(o);return n-a},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},EventEmitter.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},EventEmitter.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this};var float=factory(factory);function factory(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=128===n[3];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3]}function o(e,r,i){t[0]=e,r[i]=n[3],r[i+1]=n[2],r[i+2]=n[1],r[i+3]=n[0]}function a(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function s(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.writeFloatLE=r?i:o,e.writeFloatBE=r?o:i,e.readFloatLE=r?a:s,e.readFloatBE=r?s:a}():function(){function t(e,t,n,r){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,r)}}function n(e,t,n){var r=e(t,n),i=2*(r>>31)+1,o=r>>>23&255,a=8388607&r;return 255===o?a?NaN:i*(1/0):0===o?1401298464324817e-60*i*a:i*Math.pow(2,o-150)*(a+8388608)}e.writeFloatLE=t.bind(null,writeUintLE),e.writeFloatBE=t.bind(null,writeUintBE),e.readFloatLE=n.bind(null,readUintLE),e.readFloatBE=n.bind(null,readUintBE)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function o(e,r,i){t[0]=e,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function a(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function s(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?i:o,e.writeDoubleBE=r?o:i,e.readDoubleLE=r?a:s,e.readDoubleBE=r?s:a}():function(){function t(e,t,n,r,i,o){var a=r<0?1:0;if(a&&(r=-r),0===r)e(0,i,o+t),e(1/r>0?0:2147483648,i,o+n);else if(isNaN(r))e(0,i,o+t),e(2146959360,i,o+n);else if(r>17976931348623157e292)e(0,i,o+t),e((a<<31|2146435072)>>>0,i,o+n);else{var s;if(r<22250738585072014e-324)e((s=r/5e-324)>>>0,i,o+t),e((a<<31|s/4294967296)>>>0,i,o+n);else{var c=Math.floor(Math.log(r)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(s=r*Math.pow(2,-c))>>>0,i,o+t),e((a<<31|c+1023<<20|1048576*s&1048575)>>>0,i,o+n)}}}function n(e,t,n,r,i){var o=e(r,i+t),a=e(r,i+n),s=2*(a>>31)+1,c=a>>>20&2047,l=4294967296*(1048575&a)+o;return 2047===c?l?NaN:s*(1/0):0===c?5e-324*s*l:s*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,writeUintLE,0,4),e.writeDoubleBE=t.bind(null,writeUintBE,4,0),e.readDoubleLE=n.bind(null,readUintLE,0,4),e.readDoubleBE=n.bind(null,readUintBE,4,0)}(),e}function writeUintLE(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function writeUintBE(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function readUintLE(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function readUintBE(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}var inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}var utf8$2={},exports2,utf82;exports2=utf8$2,utf82=exports2,utf82.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},utf82.read=function(e,t,n){if(n-t<1)return"";for(var r,i=null,o=[],a=0;t<n;)(r=e[t++])<128?o[a++]=r:r>191&&r<224?o[a++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[a++]=55296+(r>>10),o[a++]=56320+(1023&r)):o[a++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),a=0);return i?(a&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))},utf82.write=function(e,t,n){for(var r,i,o=n,a=0;a<e.length;++a)(r=e.charCodeAt(a))<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(i=e.charCodeAt(a+1)))?(r=65536+((1023&r)<<10)+(1023&i),++a,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-o};var pool_1=pool,longbits,hasRequiredLongbits,hasRequiredMinimal;function pool(e,t,n){var r=n||8192,i=r>>>1,o=null,a=r;return function(n){if(n<1||n>i)return e(n);a+n>r&&(o=e(r),a=0);var s=t.call(o,a,a+=n);return 7&a&&(a=1+(7|a)),s}}function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var e=requireMinimal();function t(e,t){this.lo=e>>>0,this.hi=t>>>0}var n=t.zero=new t(0,0);n.toNumber=function(){return 0},n.zzEncode=n.zzDecode=function(){return this},n.length=function(){return 1};var r=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(e){if(0===e)return n;var r=e<0;r&&(e=-e);var i=e>>>0,o=(e-i)/4294967296>>>0;return r&&(o=~o>>>0,i=~i>>>0,++i>4294967295&&(i=0,++o>4294967295&&(o=0))),new t(i,o)},t.from=function(r){if("number"==typeof r)return t.fromNumber(r);if(e.isString(r)){if(!e.Long)return t.fromNumber(parseInt(r,10));r=e.Long.fromString(r)}return r.low||r.high?new t(r.low>>>0,r.high>>>0):n},t.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},t.prototype.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var i=String.prototype.charCodeAt;return t.fromHash=function(e){return e===r?n:new t((i.call(e,0)|i.call(e,1)<<8|i.call(e,2)<<16|i.call(e,3)<<24)>>>0,(i.call(e,4)|i.call(e,5)<<8|i.call(e,6)<<16|i.call(e,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},t.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},t.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10},longbits}function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(e){var t=e;function n(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function r(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&n(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}t.asPromise=aspromise,t.base64=base64$1,t.EventEmitter=eventemitter,t.float=float,t.inquire=inquire_1,t.utf8=utf8$2,t.pool=pool_1,t.LongBits=requireLongbits(),t.isNode=Boolean(void 0!==commonjsGlobal&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),t.global=t.isNode&&commonjsGlobal||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||commonjsGlobal,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isObject=function(e){return e&&"object"==typeof e},t.isset=t.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(n){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,n){var r=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(r.lo,r.hi,n):r.toNumber(Boolean(n))},t.merge=n,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=r,t.ProtocolError=r("ProtocolError"),t.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},t.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;e?(t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},t._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):t._Buffer_from=t._Buffer_allocUnsafe=null}}(minimal$1)),minimal$1}var writer=Writer$1,util$4=requireMinimal(),BufferWriter$1,LongBits$1=util$4.LongBits,base64=util$4.base64,utf8$1=util$4.utf8;function Op(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function noop(){}function State(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function Writer$1(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}var create$1=function(){return util$4.Buffer?function(){return(Writer$1.create=function(){return new BufferWriter$1})()}:function(){return new Writer$1}};function writeByte(e,t,n){t[n]=255&e}function writeVarint32(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e}function VarintOp(e,t){this.len=e,this.next=void 0,this.val=t}function writeVarint64(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function writeFixed32(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}Writer$1.create=create$1(),Writer$1.alloc=function(e){return new util$4.Array(e)},util$4.Array!==Array&&(Writer$1.alloc=util$4.pool(Writer$1.alloc,util$4.Array.prototype.subarray)),Writer$1.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Op(e,t,n),this.len+=t,this},VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer$1.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new VarintOp((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},Writer$1.prototype.int32=function(e){return e<0?this._push(writeVarint64,10,LongBits$1.fromNumber(e)):this.uint32(e)},Writer$1.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},Writer$1.prototype.uint64=function(e){var t=LongBits$1.from(e);return this._push(writeVarint64,t.length(),t)},Writer$1.prototype.int64=Writer$1.prototype.uint64,Writer$1.prototype.sint64=function(e){var t=LongBits$1.from(e).zzEncode();return this._push(writeVarint64,t.length(),t)},Writer$1.prototype.bool=function(e){return this._push(writeByte,1,e?1:0)},Writer$1.prototype.fixed32=function(e){return this._push(writeFixed32,4,e>>>0)},Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32,Writer$1.prototype.fixed64=function(e){var t=LongBits$1.from(e);return this._push(writeFixed32,4,t.lo)._push(writeFixed32,4,t.hi)},Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64,Writer$1.prototype.float=function(e){return this._push(util$4.float.writeFloatLE,4,e)},Writer$1.prototype.double=function(e){return this._push(util$4.float.writeDoubleLE,8,e)};var writeBytes=util$4.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};Writer$1.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(writeByte,1,0);if(util$4.isString(e)){var n=Writer$1.alloc(t=base64.length(e));base64.decode(e,n,0),e=n}return this.uint32(t)._push(writeBytes,t,e)},Writer$1.prototype.string=function(e){var t=utf8$1.length(e);return t?this.uint32(t)._push(utf8$1.write,t,e):this._push(writeByte,1,0)},Writer$1.prototype.fork=function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer$1.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer$1.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},Writer$1.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},Writer$1._configure=function(e){BufferWriter$1=e,Writer$1.create=create$1(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$3=requireMinimal();function BufferWriter(){Writer.call(this)}function writeStringBuffer(e,t,n){e.length<40?util$3.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}BufferWriter._configure=function(){BufferWriter.alloc=util$3._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$3.Buffer&&util$3.Buffer.prototype instanceof Uint8Array&&"set"===util$3.Buffer.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},BufferWriter.prototype.bytes=function(e){util$3.isString(e)&&(e=util$3._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(BufferWriter.writeBytesBuffer,t,e),this},BufferWriter.prototype.string=function(e){var t=util$3.Buffer.byteLength(e);return this.uint32(t),t&&this._push(writeStringBuffer,t,e),this},BufferWriter._configure();var reader=Reader$1,util$2=requireMinimal(),BufferReader$1,LongBits=util$2.LongBits,utf8=util$2.utf8;function indexOutOfRange(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function Reader$1(e){this.buf=e,this.pos=0,this.len=e.length}var create_array="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Reader$1(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Reader$1(e);throw Error("illegal buffer")},create=function(){return util$2.Buffer?function(e){return(Reader$1.create=function(e){return util$2.Buffer.isBuffer(e)?new BufferReader$1(e):create_array(e)})(e)}:create_array};function readLongVarint(){var e=new LongBits(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function readFixed32_end(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.create=create(),Reader$1.prototype._slice=util$2.Array.prototype.subarray||util$2.Array.prototype.slice,Reader$1.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return e}}(),Reader$1.prototype.int32=function(){return 0|this.uint32()},Reader$1.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},Reader$1.prototype.bool=function(){return 0!==this.uint32()},Reader$1.prototype.fixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader$1.prototype.sfixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return 0|readFixed32_end(this.buf,this.pos+=4)},Reader$1.prototype.float=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var e=util$2.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},Reader$1.prototype.double=function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var e=util$2.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},Reader$1.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw indexOutOfRange(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var r=util$2.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)},Reader$1.prototype.string=function(){var e=this.bytes();return utf8.read(e,0,e.length)},Reader$1.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw indexOutOfRange(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw indexOutOfRange(this)}while(128&this.buf[this.pos++]);return this},Reader$1.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},Reader$1._configure=function(e){BufferReader$1=e,Reader$1.create=create(),BufferReader$1._configure();var t=util$2.Long?"toLong":"toNumber";util$2.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[t](!1)},uint64:function(){return readLongVarint.call(this)[t](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[t](!1)},fixed64:function(){return readFixed64.call(this)[t](!0)},sfixed64:function(){return readFixed64.call(this)[t](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$1=requireMinimal();function BufferReader(e){Reader.call(this,e)}BufferReader._configure=function(){util$1.Buffer&&(BufferReader.prototype._slice=util$1.Buffer.prototype.slice)},BufferReader.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},BufferReader._configure();var rpc={},service=Service,util=requireMinimal();function Service(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service,Service.prototype.rpcCall=function e(t,n,r,i,o){if(!i)throw TypeError("request must be specified");var a=this;if(!o)return util.asPromise(e,a,t,n,r,i);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),(function(e,n){if(e)return a.emit("error",e,t),o(e);if(null!==n){if(!(n instanceof r))try{n=r[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(i){return a.emit("error",i,t),o(i)}return a.emit("data",n,t),o(null,n)}a.end(!0)}))}catch(s){return a.emit("error",s,t),void setTimeout((function(){o(s)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},Service.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},function(e){e.Service=service}(rpc);var roots={};!function(e){var t=e;function n(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}t.build="minimal",t.Writer=writer,t.BufferWriter=writer_buffer,t.Reader=reader,t.BufferReader=reader_buffer,t.util=requireMinimal(),t.rpc=rpc,t.roots=roots,t.configure=n,n()}(indexMinimal);var minimal=indexMinimal;const $Reader$1=minimal.Reader,$util$1=minimal.util,$root$1=minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]||(minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/pbm.proto"]={}),Model$2=$root$1.Model=(()=>{function e(e){if(this.chunks=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.chunks=$util$1.emptyArray,e.prototype.createAt=$util$1.Long?$util$1.Long.fromBits(0,0,!0):0,e.prototype.description="",e.decode=function(e,t){e instanceof $Reader$1||(e=$Reader$1.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root$1.Model;for(;e.pos<n;){let t=e.uint32();switch(t>>>3){case 1:r.chunks&&r.chunks.length||(r.chunks=[]),r.chunks.push($root$1.Chunk.decode(e,e.uint32()));break;case 2:r.createAt=e.uint64();break;case 3:r.description=e.string();break;default:e.skipType(7&t)}}return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Model"},e})();function loadPbm(e,t){var n,r,i,o={byteLength:0},a=autoRestImageOptionsByTextureLength(null!==(n=t.textureOptions)&&void 0!==n?n:{},null!==(i=null===(r=t.textureArray)||void 0===r?void 0:r.length)&&void 0!==i?i:0),s={};if(t.textureArray)for(var c=0,l=t.textureArray;c<l.length;c++){var u=l[c];s[u]=loadTexture$1(u,a,t.fetcher)}return Promise.resolve().then((function(){return t.fetcher.ajax(e,{responseType:"arraybuffer"})})).then((function(e){return o.byteLength=e.body.byteLength,delay((function(){var t=new Uint8Array(e.body);return Model$2.decode(t)}))})).then((function(n){return delay((function(){var r,i;return parse$2(n,null!==(r=t.textureBaseUri)&&void 0!==r?r:function(){var t=e.lastIndexOf("/");if(t>=0){var n=e.slice(0,t)+"/";return/\/model\/$/.test(n)&&(n=n.replace(/\/model\/$/,"/materials/")),n}return""}(),(null!==(i=t.textureArray)&&void 0!==i?i:[]).slice(),a,s,t.fetcher)}))})).then((function(t){var n=new THREE__namespace.Group;n.renderOrder=-4,n.matrixAutoUpdate=!1,n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(var r=0,i=t.objects;r<i.length;r++){var a=i[r];n.add(a)}return t.texturePromise.then((function(){return{type:"pbm",uri:e,byteLength:o.byteLength,object:n,dispose:function(){return t.dispose()}}}))}))}$root$1.Chunk=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.vertices=null,e.prototype.faces=null,e.prototype.name="",e.prototype.texture="",e.decode=function(e,t){e instanceof $Reader$1||(e=$Reader$1.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root$1.Chunk;for(;e.pos<n;){let t=e.uint32();switch(t>>>3){case 1:r.vertices=$root$1.Vertices.decode(e,e.uint32());break;case 2:r.faces=$root$1.Faces.decode(e,e.uint32());break;case 3:r.name=e.string();break;case 4:r.texture=e.string();break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("vertices"))throw $util$1.ProtocolError("missing required 'vertices'",{instance:r});if(!r.hasOwnProperty("faces"))throw $util$1.ProtocolError("missing required 'faces'",{instance:r});if(!r.hasOwnProperty("name"))throw $util$1.ProtocolError("missing required 'name'",{instance:r});return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Chunk"},e})(),$root$1.Vertices=(()=>{function e(e){if(this.xyz=[],this.uvs=[],this.marks=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.xyz=$util$1.emptyArray,e.prototype.uvs=$util$1.emptyArray,e.prototype.marks=$util$1.emptyArray,e.decode=function(e,t){e instanceof $Reader$1||(e=$Reader$1.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root$1.Vertices;for(;e.pos<n;){let t=e.uint32();switch(t>>>3){case 1:if(r.xyz&&r.xyz.length||(r.xyz=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.xyz.push(e.float())}else r.xyz.push(e.float());break;case 2:if(r.uvs&&r.uvs.length||(r.uvs=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.uvs.push(e.float())}else r.uvs.push(e.float());break;case 3:if(r.marks&&r.marks.length||(r.marks=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.marks.push(e.int32())}else r.marks.push(e.int32());break;default:e.skipType(7&t)}}return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Vertices"},e})(),$root$1.Faces=(()=>{function e(e){if(this.indices=[],this.normals=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.indices=$util$1.emptyArray,e.prototype.normals=$util$1.emptyArray,e.decode=function(e,t){e instanceof $Reader$1||(e=$Reader$1.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root$1.Faces;for(;e.pos<n;){let t=e.uint32();switch(t>>>3){case 1:if(r.indices&&r.indices.length||(r.indices=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.indices.push(e.uint32())}else r.indices.push(e.uint32());break;case 2:if(r.normals&&r.normals.length||(r.normals=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.normals.push(e.float())}else r.normals.push(e.float());break;default:e.skipType(7&t)}}return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Faces"},e})(),$root$1.VertexMark=(()=>{const e={},t=Object.create(e);return t[e[0]="VERTEX_MARK_UNSPECIFIED"]=0,t[e[1]="VERTEX_MARK_ROOF"]=1,t})();var MODEL_FLIP_MATRIX=(new THREE__namespace.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),E=MODEL_FLIP_MATRIX.elements;function parseFloorName(e){var t=e.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function parseChunkName(e){var t=e.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function parseSubName(e){var t=e.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}function chunkOrder(e){return 1e6*parseFloorName(e.name)+1e3*parseChunkName(e.name)+parseSubName(e.name)}function parsePBMModel(e){for(var t,n,r,i="number"==typeof e.createAt?e.createAt:0,o=null!==(t=e.description)&&void 0!==t?t:"",a=[],s=!0,c=!0,l=0,u=e.chunks;l<u.length;l++){if(!(ie=u[l]).vertices.marks||0===ie.vertices.marks.length){c=!1;break}}for(var p=0,d=e.chunks;p<d.length;p++){if(!(ie=d[p]).faces.normals||0===ie.faces.normals.length){s=!1;break}}for(var h=[],f=0,m=e.chunks.sort((function(e,t){return chunkOrder(e)-chunkOrder(t)}));f<m.length;f++){var v=parseFloorName((ie=m[f]).name);h[v]||(h[v]=[]),h[v].push(ie)}for(var A=0;A<h.length;A++){var g=h[A];if(g)if(s){for(var y=0,b=0;b<g.length;b++){y+=(ie=g[b]).faces.indices.length}for(var _=new Float32Array(3*y),T=new Float32Array(y),x=new Float32Array(2*y),R=new Float32Array(3*y),w=[],M=[1/0,1/0,1/0,-1/0,-1/0,-1/0],S=0,C=0;C<g.length;C++){var I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],P=(ie=g[C]).vertices.xyz,B=ie.vertices.uvs,O=ie.faces.indices,k=ie.faces.normals,H=ie.vertices.marks,F=O.length;for(b=0;b<F;b++){var L=O[b],D=P[3*L],N=P[3*L+1],V=P[3*L+2],U=1/(E[3]*D+E[7]*N+E[11]*V+E[15]),Q=(E[0]*D+E[4]*N+E[8]*V+E[12])*U,z=(E[1]*D+E[5]*N+E[9]*V+E[13])*U,j=(E[2]*D+E[6]*N+E[10]*V+E[14])*U;_[3*S+3*b]=Q,_[3*S+3*b+1]=z,_[3*S+3*b+2]=j,T[S+b]=c?H[L]:0,x[2*S+2*b]=B[2*L],x[2*S+2*b+1]=B[2*L+1];var q=3*Math.floor(b/3),G=k[q],K=k[q+1],W=k[q+2],X=1/(E[3]*G+E[7]*K+E[11]*W+E[15]),J=(E[0]*G+E[4]*K+E[8]*W+E[12])*X,Y=(E[1]*G+E[5]*K+E[9]*W+E[13])*X,Z=(E[2]*G+E[6]*K+E[10]*W+E[14])*X;R[3*S+3*b]=J,R[3*S+3*b+1]=Y,R[3*S+3*b+2]=Z,Q<I[0]&&(I[0]=Q),z<I[1]&&(I[1]=z),j<I[2]&&(I[2]=j),Q>I[3]&&(I[3]=Q),z>I[4]&&(I[4]=z),j>I[5]&&(I[5]=j)}I[0]<M[0]&&(M[0]=I[0]),I[1]<M[1]&&(M[1]=I[1]),I[2]<M[2]&&(M[2]=I[2]),I[3]>M[3]&&(M[3]=I[3]),I[4]>M[4]&&(M[4]=I[4]),I[5]>M[5]&&(M[5]=I[5]),w.push({materialIndex:C,name:ie.name,chunkName:parseChunkName(ie.name),start:S,count:ie.faces.indices.length,texture:null!==(n=ie.texture)&&void 0!==n?n:void 0}),S+=F}var $={createAt:i,description:o,vertices:_,uvs:x,normals:R,indices:null,floorIndex:A,groups:w,extents:M,vertexMarks:T};a.push($)}else{y=0;var ee=0;for(b=0;b<g.length;b++){ee+=(ie=g[b]).vertices.xyz.length/3,y+=ie.faces.indices.length}_=new Float32Array(3*ee),x=new Float32Array(2*ee),R=new Float32Array(3*ee);var te=new Float32Array(ee),ne=new Uint32Array(y),re=(T=new Float32Array(y),w=[],M=[1/0,1/0,1/0,-1/0,-1/0,-1/0],0);for(S=0,C=0;C<g.length;C++){I=[1/0,1/0,1/0,-1/0,-1/0,-1/0],P=(ie=g[C]).vertices.xyz,H=ie.vertices.marks,B=ie.vertices.uvs,O=ie.faces.indices;var ie,oe=P.length/3;for(F=O.length,b=0;b<oe;b++){D=P[3*b],N=P[3*b+1],V=P[3*b+2],U=1/(E[3]*D+E[7]*N+E[11]*V+E[15]),Q=(E[0]*D+E[4]*N+E[8]*V+E[12])*U,z=(E[1]*D+E[5]*N+E[9]*V+E[13])*U,j=(E[2]*D+E[6]*N+E[10]*V+E[14])*U;_[3*S+3*b]=Q,_[3*S+3*b+1]=z,_[3*S+3*b+2]=j,T[S+b]=c?H[b]:0,x[2*S+2*b]=B[2*b],x[2*S+2*b+1]=B[2*b+1],te[S+b]=A,Q<I[0]&&(I[0]=Q),z<I[1]&&(I[1]=z),j<I[2]&&(I[2]=j),Q>I[3]&&(I[3]=Q),z>I[4]&&(I[4]=z),j>I[5]&&(I[5]=j)}I[0]<M[0]&&(M[0]=I[0]),I[1]<M[1]&&(M[1]=I[1]),I[2]<M[2]&&(M[2]=I[2]),I[3]>M[3]&&(M[3]=I[3]),I[4]>M[4]&&(M[4]=I[4]),I[5]>M[5]&&(M[5]=I[5]);for(b=0;b<F;b++)ne[re+b]=S+O[b];w.push({materialIndex:C,name:ie.name,chunkName:parseChunkName(ie.name),start:re,count:ie.faces.indices.length,texture:null!==(r=ie.texture)&&void 0!==r?r:void 0}),S+=oe,re+=F}for(b=0;b<y;b+=3){var ae,se,ce,le,ue,pe,de,he,fe,me,ve,Ae,ge,ye,be,Ee;G=void 0,K=void 0,W=void 0;ae=3*ne[b],se=3*ne[b+1],ce=3*ne[b+2],le=_[ae],ue=_[ae+1],pe=_[ae+2],de=_[se],he=_[se+1],fe=_[se+2],me=_[ce],G=(Ae=_[ce+1]-he)*(Ee=pe-fe)-(ge=_[ce+2]-fe)*(be=ue-he),K=ge*(ye=le-de)-(ve=me-de)*Ee,W=ve*be-Ae*ye,R[ae]+=G,R[ae+1]+=K,R[ae+2]+=W,R[se]+=G,R[se+1]+=K,R[se+2]+=W,R[ce]+=G,R[ce+1]+=K,R[ce+2]+=W}$={createAt:i,description:o,vertices:_,uvs:x,normals:R,indices:ne,floorIndex:A,groups:w,extents:M,vertexMarks:T};a.push($)}}return a}function loadTexture$1(e,t,n,r){var i=__assign({key:"texture.pbm"},pick(t,["format","quality","size","sharpen","mappings"])),o=(new TextureLoader).loadTexture(e,{imageURL:{transform:t.transform,options:i},wrapS:THREE__namespace.ClampToEdgeWrapping,wrapT:THREE__namespace.ClampToEdgeWrapping,minFilter:THREE__namespace.LinearFilter,maxSize:"number"==typeof i.size?new THREE__namespace.Vector2(i.size,i.size):void 0,fetcher:n}).then((function(e){var t=e.body;return t.needsUpdate=!0,initTexture(t,r)}));return Object.assign(o,{url:e,textureOptions:t})}function parse$2(e,t,n,r,i,o,a){void 0===i&&(i={});for(var s=parsePBMModel(e),c=0,l="",u=[],p={},d=new Set,h=0,f=s;h<f.length;h++){var m=f[h],v=m.createAt,A=m.description,g=m.vertices,y=m.vertexMarks,b=m.uvs,E=m.normals,_=m.indices,T=m.floorIndex,x=m.groups,R=m.extents,w=new THREE__namespace.Box3;w.min.x=R[0],w.min.y=R[1],w.min.z=R[2],w.max.x=R[3],w.max.y=R[4],w.max.z=R[5];var M=new THREE__namespace.BufferGeometry;M.setAttribute("position",new THREE__namespace.BufferAttribute(g,3)),M.setAttribute("uv",new THREE__namespace.BufferAttribute(b,2)),M.setAttribute("normal",new THREE__namespace.BufferAttribute(E,3)),M.setAttribute("isRoofMark",new THREE__namespace.BufferAttribute(y,1)),_&&M.setIndex(new THREE__namespace.BufferAttribute(_,1)),M.boundingBox=w,M.boundingSphere=w.getBoundingSphere(new THREE__namespace.Sphere);for(var S=0,C=x;S<C.length;S++){var I=C[S];M.addGroup(I.start,I.count,I.materialIndex)}d.add(M);for(var P=[],B=0,O=x;B<O.length;B++){I=O[B];var k=n[I.chunkName]||(I.texture?pathJoin(t||"",I.texture):void 0),H=new PBMMeshMaterial;H.defines.USE_VERTEX_FLOOR=!1,H.floor=T,P.push(H),k?p[k]?p[k].push(H):p[k]=[H]:(H.defines.USE_MAP=!1,H.uniforms.diffuse.value=new THREE__namespace.Color(16777215)),d.add(H)}var F=new PBMMesh(M,P);F.name="model_floor_"+T,F.userData.createAt=v,F.userData.description=A,F.matrix.compose(F.position,F.quaternion,F.scale),F.matrixAutoUpdate=!1,F.frustumCulled=!1,F.renderOrder=-1e3+T,c=v,l=A,u.push(F)}var L="",D=function(e){e=autoRestImageOptionsByTextureLength(e,n.length);var t=[],r=jsonHash(e);if(L===r)return Promise.resolve();L=r;for(var s=function(n){var s=null;n in i&&(jsonHash(i[n].textureOptions)===jsonHash(e)?s=i[n]:i[n].then((function(e){return e.dispose()}))),s||(s=loadTexture$1(n,e,o,a)),t.push(s.then((function(e){if(L===r)for(var t=0,i=p[n];t<i.length;t++){var o=i[t];o.uniforms.map.value&&(d.delete(o.uniforms.map.value),o.uniforms.map.value.dispose()),o.uniforms.map.value=e,d.add(e),o.uniforms.exposure.value=3.3}else e.dispose()})).catch((function(){if(L===r)for(var e=0,t=p[n];e<t.length;e++){var i=t[e];i.uniforms.map.value&&(d.delete(i.uniforms.map.value),i.uniforms.map.value.dispose()),i.uniforms.map.value=null,i.defines.USE_MAP=!1,i.uniforms.diffuse.value=new THREE__namespace.Color(16777215)}})))},c=0,l=Object.keys(p);c<l.length;c++){s(u=l[c])}for(var u in i)delete i[u];return Promise.all(t).then((function(){}))};return{createAt:c,description:l,objects:u,texturePromise:D(r),updateTexture:D,dispose:function(){d.forEach((function(e){e.dispose()})),d.clear()}}}function autoRestImageOptionsByTextureLength(e,t){return!1!==(e=Object.assign({},e)).autoResize&&(t>96?e.size=Math.min(e.size||1/0,100):t>48?e.size=Math.min(e.size||1/0,200):t>24?e.size=Math.min(e.size||1/0,400):t>22?e.size=Math.min(e.size||1/0,800):t>5&&(e.size=Math.min(e.size||1/0,1024))),e}function loadAt3d(e,t){var n,r,i,o=0,a=autoRestImageOptionsByTextureLength(null!==(n=t.textureOptions)&&void 0!==n?n:{},null!==(i=null===(r=t.textureArray)||void 0===r?void 0:r.length)&&void 0!==i?i:0),s={};if(t.textureArray)for(var c=0,l=t.textureArray;c<l.length;c++){var u=l[c];s[u]=loadTexture$1(u,a,t.fetcher)}return Promise.resolve().then((function(){return t.fetcher.ajax(e,{responseType:"arraybuffer"})})).then((function(e){return lzma(e.body)})).then((function(e){return delay((function(){for(var t,n={chunks:[],createAt:void 0,description:void 0},r=0,i=e;r<i.length;r++){var o=i[r],a=Model$2.decode(o);a.chunks.length&&((t=n.chunks).push.apply(t,a.chunks),n.createAt=a.createAt,n.description=a.description)}return n}))})).then((function(n){return delay((function(){var r,i,o;return parse$2(n,null!==(r=t.textureBaseUri)&&void 0!==r?r:function(){var t=e.lastIndexOf("/");if(t>=0){var n=e.slice(0,t)+"/";return/\/model\/$/.test(n)&&(n=n.replace(/\/model\/$/,"/materials/")),n}return""}(),(null!==(i=t.textureArray)&&void 0!==i?i:[]).slice(),null!==(o=t.textureOptions)&&void 0!==o?o:{},s,t.fetcher)}))})).then((function(t){var n=new THREE__namespace.Group;n.renderOrder=-4,n.name=e;for(var r=0,i=t.objects;r<i.length;r++){var a=i[r];n.add(a)}return t.texturePromise.then((function(){return{type:"at3d",uri:e,byteLength:o,object:n,dispose:function(){return t.dispose()}}}))}))}const $Reader=minimal.Reader,$util=minimal.util,$root=minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]||(minimal.roots["@REALSEE/FIVE:five/loaders/model/proto/dome.proto"]={}),Model$1=$root.Model=(()=>{function e(e){if(this.meshes=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.meshes=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.Model;for(;e.pos<n;){let t=e.uint32();if(t>>>3==1)r.meshes&&r.meshes.length||(r.meshes=[]),r.meshes.push($root.Mesh.decode(e,e.uint32()));else e.skipType(7&t)}return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Model"},e})();function loadDome(e,t){var n={byteLength:0};return Promise.resolve().then((function(){return t.fetcher.ajax(e,{responseType:"arraybuffer"})})).then((function(e){return n.byteLength=e.body.byteLength,parse$1(new Uint8Array(e.body),t.textureBaseUri||"",t.textureOptions,t.fetcher)})).then((function(t){var r=new THREE__namespace.Group;r.renderOrder=-4,r.matrixAutoUpdate=!1,r.matrix.compose(r.position,r.quaternion,r.scale),r.name=e;for(var i=0,o=t.objects;i<o.length;i++){var a=o[i];r.add(a)}return t.texturePromise.then((function(){return{type:"dome",uri:e,byteLength:n.byteLength,object:r,dispose:function(){return t.dispose()}}}))}))}function flipBufferGeometryNormals(e){for(var t=[0,0,0],n=0;n<e.attributes.normal.array.length/9;n++)t[0]=e.attributes.normal.array[9*n],t[1]=e.attributes.normal.array[9*n+1],t[2]=e.attributes.normal.array[9*n+2],e.attributes.normal.array[9*n]=e.attributes.normal.array[9*n+6],e.attributes.normal.array[9*n+1]=e.attributes.normal.array[9*n+7],e.attributes.normal.array[9*n+2]=e.attributes.normal.array[9*n+8],e.attributes.normal.array[9*n+6]=t[0],e.attributes.normal.array[9*n+7]=t[1],e.attributes.normal.array[9*n+8]=t[2];for(n=0;n<e.attributes.position.array.length/9;n++)t[0]=e.attributes.position.array[9*n],t[1]=e.attributes.position.array[9*n+1],t[2]=e.attributes.position.array[9*n+2],e.attributes.position.array[9*n]=e.attributes.position.array[9*n+6],e.attributes.position.array[9*n+1]=e.attributes.position.array[9*n+7],e.attributes.position.array[9*n+2]=e.attributes.position.array[9*n+8],e.attributes.position.array[9*n+6]=t[0],e.attributes.position.array[9*n+7]=t[1],e.attributes.position.array[9*n+8]=t[2];for(n=0;n<e.attributes.uv.array.length/6;n++)t[0]=e.attributes.uv.array[6*n],t[1]=e.attributes.uv.array[6*n+1],e.attributes.uv.array[6*n]=e.attributes.uv.array[6*n+4],e.attributes.uv.array[6*n+1]=e.attributes.uv.array[6*n+5],e.attributes.uv.array[6*n+4]=t[0],e.attributes.uv.array[6*n+5]=t[1];e.attributes.normal.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.uv.needsUpdate=!0}function parseGeometry(e){var t=e.position,n=e.normal,r=e.uv,i=e.uv2,o=e.groups,a=new THREE__namespace.BufferGeometry;a.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(t.array),3)),n&&a.setAttribute("normal",new THREE__namespace.BufferAttribute(new Float32Array(n.array),3)),r&&a.setAttribute("uv",new THREE__namespace.BufferAttribute(new Float32Array(r.array),2)),i&&a.setAttribute("uv2",new THREE__namespace.BufferAttribute(new Float32Array(i.array),2));for(var s=0,c=o;s<c.length;s++){var l=c[s];a.addGroup(l.start,l.count,l.materialIndex)}return a}function loadTexture(e,t,n,r,i,o,a){if(a.hasOwnProperty(e))return a[e];isAbsoluteURL(e=e.split("?")[0])||(e=pathJoin(t,e)),0===(e=e.replace(/\/\/vrlab-image\d*.ljcdn.com\//,"//vrlab-public.ljcdn.com/")).indexOf("//")&&(e="https:"+e);var s=__assign({key:"texture.dome",size:64},pick(n,["quality","format","sharpen","mappings"]));return a[e]=i.loadTexture(e,{imageURL:{transform:n.transform,options:s},wrapS:THREE__namespace.RepeatWrapping,wrapT:THREE__namespace.RepeatWrapping,fetcher:o}).then((function(e){var t=e.body;return r&&t.repeat.copy(r),t.needsUpdate=!0,t.updateMatrix(),t}))}function parseMaterial(e,t,n,r,i,o,a){var s=[],c=new PBMMeshMaterial;a.add(c);var l=c.uniforms;l.exposure.value=4.3;var u=c.defines;if(u.USE_MAP=!1,u.USE_UV=!1,e.kd&&(l.diffuse.value=(new THREE__namespace.Color).fromArray(e.kd.rgb)),e.mapkd){var p=null;if(e.mapkdrepeat){var d=e.mapkdrepeat.split(/\s+/).map((function(e){return Number(e)})),h=d[0],f=d[1];p=new THREE__namespace.Vector2(h,f)}s.push(loadTexture(e.mapkd,t,n,p,r,i,o).then((function(e){u.USE_MAP=!0,u.USE_UV=!0,l.map.value=e,a.add(e),l.uvTransform.value=e.matrix,c.needsUpdate=!0})).catch(noop$1))}if(e.ks&&(l.specular.value=(new THREE__namespace.Color).fromArray(e.ks.rgb)),e.mapks&&s.push(loadTexture(e.mapks,t,n,null,r,i,o).then((function(e){l.specularMap.value=e,a.add(e)})).catch(noop$1)),e.ke&&(l.emissive.value=(new THREE__namespace.Color).fromArray(e.ke.rgb)),e.mapke&&s.push(loadTexture(e.mapke,t,n,null,r,i,o).then((function(e){l.emissiveMap.value=e,a.add(e)})).catch(noop$1)),e.norm&&s.push(loadTexture(e.norm,t,n,null,r,i,o).then((function(e){l.normalMap.value=e,a.add(e)})).catch(noop$1)),e.mapbump&&s.push(loadTexture(e.mapbump,t,n,null,r,i,o).then((function(e){l.bumpMap.value=e,a.add(e)})).catch(noop$1)),e.bump&&s.push(loadTexture(e.bump,t,n,null,r,i,o).then((function(e){l.bumpMap.value=e,a.add(e)})).catch(noop$1)),"number"==typeof e.ns&&(l.shininess.value=e.ns),"number"==typeof e.d){var m=e.d;m>0&&m<1&&(c.opacity=m)}return c.floor=0,c.defines.USE_VERTEX_FLOOR=!1,{material:c,textureReady:Promise.all(s).then(noop$1)}}function fromProtoBuf(e){return Model$1.decode(e).meshes}function parse$1(e,t,n,r){for(var i=[],o=[],a=new Set,s=fromProtoBuf(e),c=new TextureLoader,l=new THREE__namespace.Matrix4,u=new THREE__namespace.Vector3,p=new THREE__namespace.Quaternion,d=new THREE__namespace.Vector3,h={},f=0,m=s;f<m.length;f++){var v=m[f],A=v.name,g=v.chunks,y=v.matrix;if("Ceiling"!==A&&"CeilingDrop"!==A)for(var b=0,E=y;b<E.length;b++){var _=E[b];l.elements=_.elements;var T=new THREE__namespace.Group;T.renderOrder=-4;for(var x=0;x<g.length;x++){var R=parseGeometry(g[x].geometry);R.applyMatrix4(l),l.decompose(u,p,d),d.x*d.y*d.z<0&&R.attributes.normal&&R.attributes.position&&R.attributes.uv&&flipBufferGeometryNormals(R),a.add(R);for(var w=[],M=0,S=g[x].material;M<S.length;M++){var C=parseMaterial(S[M],t||"",n,c,r,h,a),I=C.material,P=C.textureReady;o.push(P),w.push(I)}var B=new PBMMesh(R,w);B.name="chunk_"+x,B.matrix.compose(B.position,B.quaternion,B.scale),B.matrixAutoUpdate=!1,B.frustumCulled=!1,B.renderOrder=-1e3,T.add(B)}T.name=A,i.push(T)}}return{createAt:0,description:"",objects:i,texturePromise:Promise.all(o).catch(noop$1),updateTexture:function(e){return Promise.resolve()},dispose:function(){a.forEach((function(e){e.dispose()})),a.clear()}}}function loadDomez(e,t){var n={byteLength:0};return Promise.resolve().then((function(){return t.fetcher.ajax(e,{responseType:"arraybuffer"})})).then((function(e){return n.byteLength=e.body.byteLength,lzma(e.body)})).then((function(e){var t=e.reduce((function(e,t){return e+t.length}),0),n=new Uint8Array(t),r=0;return e.forEach((function(e){n.set(e,r),r+=e.length})),n})).then((function(e){return parse$1(e,t.textureBaseUri||"",t.textureOptions,t.fetcher)})).then((function(t){var r=new THREE__namespace.Group;r.renderOrder=-4,r.name=e;for(var i=0,o=t.objects;i<o.length;i++){var a=o[i];r.add(a)}return t.texturePromise.then((function(){return{type:"domez",uri:e,byteLength:n.byteLength,object:r,dispose:function(){return t.dispose()}}}))}))}$root.Mesh=(()=>{function e(e){if(this.chunks=[],this.matrix=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.chunks=$util.emptyArray,e.prototype.matrix=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.Mesh;for(;e.pos<n;){let t=e.uint32();switch(t>>>3){case 1:r.name=e.string();break;case 2:r.chunks&&r.chunks.length||(r.chunks=[]),r.chunks.push($root.Chunk.decode(e,e.uint32()));break;case 3:r.matrix&&r.matrix.length||(r.matrix=[]),r.matrix.push($root.Matrix.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("name"))throw $util.ProtocolError("missing required 'name'",{instance:r});return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Mesh"},e})(),$root.Matrix=(()=>{function e(e){if(this.elements=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.elements=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.Matrix;for(;e.pos<n;){let t=e.uint32();if(t>>>3==1)if(r.elements&&r.elements.length||(r.elements=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.elements.push(e.float())}else r.elements.push(e.float());else e.skipType(7&t)}return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Matrix"},e})(),$root.Chunk=(()=>{function e(e){if(this.material=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.geometry=null,e.prototype.material=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.Chunk;for(;e.pos<n;){let t=e.uint32();switch(t>>>3){case 2:r.geometry=$root.Geometry.decode(e,e.uint32());break;case 3:r.material&&r.material.length||(r.material=[]),r.material.push($root.Material.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("geometry"))throw $util.ProtocolError("missing required 'geometry'",{instance:r});return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Chunk"},e})(),$root.Geometry=(()=>{function e(e){if(this.groups=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.position=null,e.prototype.uv=null,e.prototype.uv2=null,e.prototype.normal=null,e.prototype.groups=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.Geometry;for(;e.pos<n;){let t=e.uint32();switch(t>>>3){case 1:r.position=$root.Position.decode(e,e.uint32());break;case 2:r.uv=$root.UV.decode(e,e.uint32());break;case 3:r.uv2=$root.UV.decode(e,e.uint32());break;case 4:r.normal=$root.Normal.decode(e,e.uint32());break;case 5:r.groups&&r.groups.length||(r.groups=[]),r.groups.push($root.Group.decode(e,e.uint32()));break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("position"))throw $util.ProtocolError("missing required 'position'",{instance:r});if(!r.hasOwnProperty("normal"))throw $util.ProtocolError("missing required 'normal'",{instance:r});return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Geometry"},e})(),$root.Position=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.array=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.Position;for(;e.pos<n;){let t=e.uint32();if(t>>>3==1)if(r.array&&r.array.length||(r.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.array.push(e.float())}else r.array.push(e.float());else e.skipType(7&t)}return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Position"},e})(),$root.UV=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.array=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.UV;for(;e.pos<n;){let t=e.uint32();if(t>>>3==1)if(r.array&&r.array.length||(r.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.array.push(e.float())}else r.array.push(e.float());else e.skipType(7&t)}return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UV"},e})(),$root.Normal=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.array=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.Normal;for(;e.pos<n;){let t=e.uint32();if(t>>>3==1)if(r.array&&r.array.length||(r.array=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.array.push(e.float())}else r.array.push(e.float());else e.skipType(7&t)}return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Normal"},e})(),$root.Group=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.start=0,e.prototype.count=0,e.prototype.materialIndex=0,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.Group;for(;e.pos<n;){let t=e.uint32();switch(t>>>3){case 1:r.start=e.uint32();break;case 2:r.count=e.uint32();break;case 3:r.materialIndex=e.uint32();break;default:e.skipType(7&t)}}if(!r.hasOwnProperty("start"))throw $util.ProtocolError("missing required 'start'",{instance:r});if(!r.hasOwnProperty("count"))throw $util.ProtocolError("missing required 'count'",{instance:r});if(!r.hasOwnProperty("materialIndex"))throw $util.ProtocolError("missing required 'materialIndex'",{instance:r});return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Group"},e})(),$root.Material=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.kd=null,e.prototype.ks=null,e.prototype.ke=null,e.prototype.mapkd="",e.prototype.mapks="",e.prototype.mapke="",e.prototype.norm="",e.prototype.mapbump="",e.prototype.bump="",e.prototype.mapd="",e.prototype.ns=0,e.prototype.d=0,e.prototype.tr=0,e.prototype.mapkdrepeat="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.Material;for(;e.pos<n;){let t=e.uint32();switch(t>>>3){case 1:r.kd=$root.Color.decode(e,e.uint32());break;case 2:r.ks=$root.Color.decode(e,e.uint32());break;case 3:r.ke=$root.Color.decode(e,e.uint32());break;case 4:r.mapkd=e.string();break;case 5:r.mapks=e.string();break;case 6:r.mapke=e.string();break;case 7:r.norm=e.string();break;case 8:r.mapbump=e.string();break;case 9:r.bump=e.string();break;case 10:r.mapd=e.string();break;case 11:r.ns=e.float();break;case 12:r.d=e.float();break;case 13:r.tr=e.float();break;case 14:r.mapkdrepeat=e.string();break;default:e.skipType(7&t)}}return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Material"},e})(),$root.Color=(()=>{function e(e){if(this.rgb=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.rgb=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));let n=void 0===t?e.len:e.pos+t,r=new $root.Color;for(;e.pos<n;){let t=e.uint32();if(t>>>3==1)if(r.rgb&&r.rgb.length||(r.rgb=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)r.rgb.push(e.float())}else r.rgb.push(e.float());else e.skipType(7&t)}return r},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/Color"},e})();var ROTATE_X_MATRIX=(new THREE__namespace.Matrix4).fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);function loadGlb(e,t){var n=0;return Promise.resolve().then((function(){return t.fetcher.ajax(e,{responseType:"arraybuffer"}).then((function(e){return n=e.body.byteLength,e.body}))})).then((function(n){var r;return parseGltf(n,{copyUV2:!1,addonExtensions:["PBM_mesh"],resourcePath:e.slice(0,e.lastIndexOf("/")+1),search:null!==(r=e.split("?")[1])&&void 0!==r?r:"",fetcher:t.fetcher})})).then((function(r){var i=new THREE__namespace.Matrix4;if("Z"!==t.upAxis&&i.premultiply(ROTATE_X_MATRIX),r.CESIUM_RTC){var o=(new THREE__namespace.Matrix4).setPosition(r.CESIUM_RTC.center);i.premultiply(o)}var a=r.scene;return a.applyMatrix4(i),{type:"glb",uri:e,byteLength:n,object:a,dispose:function(){return r.dispose()}}}))}var scratchVector3$2=new THREE__namespace.Vector3,scratchMatrix4$2=new THREE__namespace.Matrix4,refineTimeInterval=30;function attachFloor(e,t){var n=t.tileset.properties.floorInfo;e.traverse((function(e){if("floor"in t.extras)e instanceof PBMMesh?(e.material.forEach((function(e){e.floor=t.extras.floor})),e.renderOrder=-1e3+t.extras.floor):e instanceof PBMPointCloud&&(e.material.floor=t.extras.floor,e.renderOrder=-1e3+t.extras.floor);else if((e instanceof PBMMesh||e instanceof PBMPointCloud)&&n){var r=e.geometry.index,i=e.geometry.getAttribute("position"),o=0,a=new Float32Array(i.count);if(n)if(r){for(l=0,u=r.count,p=0;p<u;p++){var s=r.array[p];scratchVector3$2.set(i.array[3*s+0],i.array[3*s+1],i.array[3*s+2]),scratchVector3$2.applyMatrix4(e.matrixWorld);d=scratchVector3$2.y;a[s]=0;for(h=0;h<n.length;h++){var c=n[h];if(d<c.ground+c.height){a[s]=h;break}}l+=a[s]}o=l/u}else{for(var l=0,u=i.count,p=0;p<u;p++){scratchVector3$2.set(i.array[3*p+0],i.array[3*p+1],i.array[3*p+2]),scratchVector3$2.applyMatrix4(e.matrixWorld);var d=scratchVector3$2.y;a[p]=0;for(var h=0;h<n.length;h++){var f=n[h];if(d<f.ground+f.height){a[p]=h;break}}l+=a[p]}o=l/u}e.renderOrder=-1e3+o,e.geometry.setAttribute("floor",new THREE__namespace.BufferAttribute(a,1)),Array.isArray(e.material)?e.material.forEach((function(e){e.defines.USE_VERTEX_FLOOR=!0,e.needsUpdate=!0})):(e.material.defines.USE_VERTEX_FLOOR=!0,e.material.needsUpdate=!0)}}))}var Tile3DModel=function(e){function t(n,r,i,o){var a,s,c,l,u=e.call(this)||this;u.model=n,u.objType=r,u.search=null!==(a=o.search)&&void 0!==a?a:"",u.unloadTileQueue=[],u.boundingBox=new THREE__namespace.Box3,u.minLevelOfDetail=t.DEFAULT_MIN_LEVEL_OF_DETAIL,u.maxLevelOfDetail=t.DEFAULT_MAX_LEVEL_OF_DETAIL,u.needsRefined=!0,u.refined=!1,u.refineProgress=[0,0],u.loaded=!1,u.disposed=!1,u.needsRender=!0,u.matrixAutoUpdate=!1,u.renderOrder=-4,u.lastRefineTime=-1,u.nodes=new Map,u.nodeGroup=new THREE__namespace.Group,u.nodeGroup.matrixAutoUpdate=!1,u.nodeGroup.renderOrder=-4,u.add(u.nodeGroup),u.debugBoundings=new Map,u.debugBoundingGroup=new THREE__namespace.Group,u.debugBoundingGroup.visible=!1,u.debugBoundingGroup.matrixAutoUpdate=!1,u.debugBoundingGroup.renderOrder=-4,u.add(u.debugBoundingGroup),u.cacheCameras=[];var p=normalizeTilesetHeader(i,null!==(s=o.resourcePath)&&void 0!==s?s:"");return u.tileset=new Tileset(null!==(l=null===(c=u.model.work)||void 0===c?void 0:c.workCode)&&void 0!==l?l:"",p,{contentLoader:function(e){return u.loadContent(e,{fetcher:o.fetcher})},onTileLoad:function(){},onTileUnload:function(e){u.unloadTileQueue.push(e)},onTileError:function(e,t){o.onError&&o.onError(Object.assign(t,{error:t})),console.error("Tile error",e.id,t)}}),u.tileset.root.boundingVolume&&u.tileset.root.boundingVolume.getBoundingBox(u.boundingBox),u}return __extends(t,e),Object.defineProperty(t.prototype,"debug",{get:function(){return this.debugBoundingGroup.visible},set:function(e){this.debugBoundingGroup.visible!==e&&(this.debugBoundingGroup.visible=e,this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxMemoryUsage",{get:function(){return this.tileset.maxMemoryUsage},set:function(e){this.tileset.maxMemoryUsage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxRequests",{get:function(){return this.tileset.maxRequests},set:function(e){this.tileset.maxRequests=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxScreenSpaceError",{get:function(){return this.tileset.maxScreenSpaceError},set:function(e){this.tileset.maxScreenSpaceError=e},enumerable:!1,configurable:!0}),t.prototype.loadContent=function(e,t){var n=this;if(!e.content)return Promise.resolve(!1);var r=e.content,i=appendSearch(r.uri,this.search);if("TILESET"===e.type){var o=imageURL(i,{key:"model.".concat(e.siblingIndex)});return t.fetcher.ajax(o,{responseType:"text"}).then((function(e){return e.body})).then((function(e){var t=o.slice(0,o.lastIndexOf("/")+1);return normalizeTilesetHeader(JSON.parse(e),t)})).then((function(t){return e.geometricError=t.geometricError,0===e.children.length&&(e.children=[new Tile("".concat(e.id,".0"),t.root,e.tileset,e)]),!0}))}return"SCENEGRAPH"===e.type?Promise.resolve().then((function(){var n,r,o,a,s,c,l,u,p,d,h="",f=i.split("#"),m=f[0],v=(f[1]||m).split("?")[0].match(/\.([0-9a-zA-Z]+)$/);return v&&(h=v[1]),"b3dm"===h?loadB3dm(imageURL(i,{key:"model.".concat(e.siblingIndex)}),{upAxis:e.tileset.asset.gltfUpAxis,fetcher:t.fetcher}).then((function(t){return t.object.applyMatrix4(e.transform),t.object.updateWorldMatrix(!1,!0),t.object.matrixAutoUpdate=!1,attachFloor(t.object,e),t})):"pnts"===h?loadPnts(imageURL(i,{key:"model.".concat(e.siblingIndex)}),{fetcher:t.fetcher,computeBoundingBox:!1}).then((function(t){if(t.object.applyMatrix4(e.transform),t.object.updateWorldMatrix(!1,!0),t.object.matrixAutoUpdate=!1,e.boundingVolume){var n=e.boundingVolume;t.object.traverse((function(e){if(e instanceof PBMPointCloud){scratchMatrix4$2.getInverse(e.matrixWorld);var t=new THREE__namespace.Box3;n.getBoundingBox(t),t.applyMatrix4(scratchMatrix4$2),e.geometry.boundingBox=t}}))}return t})):"glb"===h?loadGlb(imageURL(i,{key:"model.".concat(e.siblingIndex)}),{upAxis:e.tileset.asset.gltfUpAxis,fetcher:t.fetcher}).then((function(t){return t.object.applyMatrix4(e.transform),t.object.updateWorldMatrix(!1,!0),t.object.matrixAutoUpdate=!1,attachFloor(t.object,e),t})):"at3d"===h?loadAt3d(e.extras.at3d?i:imageURL(i,{key:"model.".concat(e.siblingIndex)}),{textureBaseUri:null===(n=e.extras.at3d)||void 0===n?void 0:n.textureBaseUri,textureArray:null===(r=e.extras.at3d)||void 0===r?void 0:r.textureArray,textureOptions:null===(o=e.extras.at3d)||void 0===o?void 0:o.textureOptions,fetcher:t.fetcher}).then((function(t){return t.object.applyMatrix4(e.transform),t.object.updateWorldMatrix(!1,!0),t.object.matrixAutoUpdate=!1,t})):"pbm"===h?loadPbm(e.extras.pbm?i:imageURL(i,{key:"model.".concat(e.siblingIndex)}),{textureBaseUri:null===(a=e.extras.pbm)||void 0===a?void 0:a.textureBaseUri,textureArray:null===(s=e.extras.pbm)||void 0===s?void 0:s.textureArray,textureOptions:null===(c=e.extras.pbm)||void 0===c?void 0:c.textureOptions,fetcher:t.fetcher}).then((function(t){return t.object.applyMatrix4(e.transform),t.object.updateWorldMatrix(!1,!0),t.object.matrixAutoUpdate=!1,t})):"dome"===h?loadDome(e.extras.dome?i:imageURL(i,{key:"model.".concat(e.siblingIndex)}),{textureBaseUri:null===(l=e.extras.dome)||void 0===l?void 0:l.textureBaseUri,textureOptions:null===(u=e.extras.dome)||void 0===u?void 0:u.textureOptions,fetcher:t.fetcher}).then((function(t){return t.object.applyMatrix4(e.transform),t.object.updateWorldMatrix(!1,!0),t.object.matrixAutoUpdate=!1,t})):"domez"===h?loadDomez(e.extras.domez?i:imageURL(i,{key:"model.".concat(e.siblingIndex)}),{textureBaseUri:null===(p=e.extras.domez)||void 0===p?void 0:p.textureBaseUri,textureOptions:null===(d=e.extras.domez)||void 0===d?void 0:d.textureOptions,fetcher:t.fetcher}).then((function(t){return t.object.applyMatrix4(e.transform),t.object.updateWorldMatrix(!1,!0),t.object.matrixAutoUpdate=!1,t})):void 0})).then((function(t){if(!t)return!1;var i={type:t.type,uri:t.uri,byteLength:t.byteLength,object:new TileNode(t.object,t.dispose)};if(n.disposed)return i.object.dispose(),r.data=void 0,r.byteLength=0,!1;if(i.object.traverse((function(e){(e instanceof PBMPointCloud||e instanceof PBMMesh)&&(e.model=n.model)})),"pnts"===t.type&&(t.object.material.uniforms.geometricError.value=e.geometricError),r.data=i,r.byteLength=i.byteLength,i.object.traverse((function(e){e.renderOrder>-4&&(e.renderOrder=-4)})),i.object.visible=!1,n.boundingBox.expandByObject(i.object),n.nodes.set(e.id,i.object),n.nodeGroup.add(i.object),e.boundingVolume){var o=createDebugBoundingMesh(e.boundingVolume,e.state.selectionDepth);o.matrixWorldNeedsUpdate=!0,o.matrixAutoUpdate=!1,o.frustumCulled=!1,o.visible=!0,n.debugBoundings.set(e.id,o),n.debugBoundingGroup.add(o)}return!0})):Promise.resolve(!1)},t.prototype.intersectRaycaster=function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=[]);for(var r,i=[this.tileset.root],o=this.tileset.transform;r=i.pop();){var a=void 0;if(r.boundingVolume)a=r.boundingVolume.clone().applyMatrix4(o).intersectRay(e.ray,e.far);else a=!0;if(a){for(var s=0,c=r.children.length;s<c;s++)i.push(r.children[s]);r.selected&&r.content&&r.content.data&&r.content.data.object.intersectRaycaster(e,!1,n)}}return t&&n.sort((function(e,t){return e.distance-t.distance})),n},t.prototype.update=function(e,t){var n=this;this.tileset.transform.equals(this.matrixWorld)||this.tileset.transform.copy(this.matrixWorld);var r,i,o=now();if(this.needsRefined&&o-this.lastRefineTime>refineTimeInterval){this.lastRefineTime=o,this.tileset.cache.reset(),this.tileset.frameNumber++;var a={camera:{position:(new THREE__namespace.Vector3).copy(t.position),direction:t.getDirection(new THREE__namespace.Vector3),up:(new THREE__namespace.Vector3).copy(t.up),visible:t.visible},minLevelOfDetail:this.visible?this.minLevelOfDetail:-1,maxLevelOfDetail:this.visible?this.maxLevelOfDetail:-1,height:t.screenHeight,pixelRatio:t.pixelRatio,frameNumber:this.tileset.frameNumber,sseDenominator:2*Math.tan(.5*t.fov/180*Math.PI),cullingVolume:(new CullingVolume).setFromCamera(t)},s=this.cacheCameras.map((function(e){return __assign(__assign({},a),{camera:{position:(new THREE__namespace.Vector3).copy(e.position),direction:e.getWorldDirection(new THREE__namespace.Vector3),up:(new THREE__namespace.Vector3).copy(e.up),visible:e.visible},cullingVolume:(new CullingVolume).setFromCamera(e)})}));this.tileset.traverse(a,s),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach((function(e){if(n.refineProgress[1]++,e.content&&e.state.visible){var t=e.content.loadState;if("UNLOADED"===t||"LOADING"===t)return void(n.refined=!1)}n.refineProgress[0]++})),!1===this.loaded&&(this.loaded=!0,this.tileset.needsRefinedTiles.forEach((function(e){if(!1!==n.loaded&&e.content&&e.state.visible&&0===e.state.selectionDepth){var t=e.content.loadState;"UNLOADED"!==t&&"LOADING"!==t||(n.loaded=!1)}})))}for(this.tileset.tiles.forEach((function(e){var t=e.selected,i=e.id;(r=n.nodes.get(i))&&r.visible!==t&&(r.visible=t,n.needsRender=!0),(r=n.debugBoundings.get(i))&&r.visible!==t&&(r.visible=t,n.needsRender=!0)}));i=this.unloadTileQueue.pop();){var c=i.id,l=i.content;l&&l.data&&(l.data.object.dispose(),l.data=void 0,l.byteLength=0),(r=this.nodes.get(c))&&(this.nodeGroup.remove(r),this.nodes.delete(c),this.needsRender=!0),(r=this.debugBoundings.get(c))&&(this.debugBoundingGroup.remove(r),this.debugBoundings.delete(c),this.needsRender=!0)}},t.prototype.dispose=function(){var e,t,n=this;for(this.disposed=!0,this.tileset.reset();e=this.unloadTileQueue.pop();){var r=e.id,i=e.content;i&&i.data&&(i.data.object.dispose(),i.data=void 0,i.byteLength=0),(t=this.nodes.get(r))&&(this.nodeGroup.remove(t),this.nodes.delete(r),this.needsRender=!0),(t=this.debugBoundings.get(r))&&(this.debugBoundingGroup.remove(t),this.debugBoundings.delete(r),this.needsRender=!0)}this.nodes.forEach((function(e,t,r){n.nodeGroup.remove(e),e.dispose(),r.delete(t)}))},t.DEFAULT_MIN_LEVEL_OF_DETAIL=-1,t.DEFAULT_MAX_LEVEL_OF_DETAIL=20,t.DEFAULT_MAX_MEMORY_USAGE=16,t.DEFAULT_MAX_SCREEN_SPACE_ERROR=Tileset.DEFAULT_MAX_SCREEN_SPACE_ERROR,t.DEFAULT_MAX_REQUESTS=Tileset.DEFAULT_MAX_REQUESTS,t}(THREE__namespace.Object3D);function clamp(e,t,n){return e<t?t:e>n?n:e}function headingToLongitude(e){return-(360*(e-.25)+90)/180*Math.PI}function equal(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!equal(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((n=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!=r--;){var o=i[r];if(!equal(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function isNumber(e){return"number"==typeof e}function isPowerOfTwo(e){return 0==(e&e-1)&&0!==e}var error_invalid_input=function(){return new Error("Invalid input.")},error_invalid_certificate=function(){return new Error("Invalid certificate.")},error_invalid_signature=function(){return new Error("Invalid signature.")},error_date_expired=function(e){return new Error("date(".concat(e.toString(),") expired."))},error_host_not_allowed=function(e){return new Error("host(".concat(JSON.stringify(e),") is not allowed."))};function ObjectOmit(e,t){for(var n={},r=0,i=Object.keys(e);r<i.length;r++){var o=i[r];-1===t.indexOf(o)&&(n[o]=e[o])}return n}function jsonStableNoneNumberStrinfiy_(e,t){void 0===t&&(t=!1);var n=typeof e;if("string"===n)return JSON.stringify(e);if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(e instanceof Array){for(var r="[",i=e.length-1,o=0;o<i;o++)r+=jsonStableNoneNumberStrinfiy_(e[o],!1)+",";return i>-1&&(r+=jsonStableNoneNumberStrinfiy_(e[o],!1)),r+"]"}if(e instanceof Object){if("function"==typeof e.toJSON)return jsonStableNoneNumberStrinfiy_(e.toJSON(),t);var a=Object.keys(e).sort(),s=a.length;for(r="",o=0;o<s;){var c=a[o],l=jsonStableNoneNumberStrinfiy_(e[c],!0);void 0!==l&&(o&&""!==r&&(r+=","),r+=JSON.stringify(c)+":"+l),o++}return"{"+r+"}"}switch(n){case"function":case"undefined":return t?void 0:null;case"number":return 0;default:return isFinite(e)?e:null}}function jsonStableNoneNumberStrinfiy(e){return String(jsonStableNoneNumberStrinfiy_(e,!1))}function verify(e){var t,n,r;if(Array.isArray(e)){var i,o,a=void 0;if(e.length<=0)return error_invalid_input();for(var s=function(t){var n=verify(e[t]);if(n instanceof Error)return{value:n};if(a){if(a!==n.issuer)return{value:error_invalid_certificate()}}else a=n.issuer;i?n.expire.getTime()<i.getTime()&&(i=n.expire):i=n.expire,o=o?o.filter((function(e){return-1!==n.allowHosts.indexOf(e)})):n.allowHosts},c=0;c<e.length;c++){var l=s(c);if("object"==typeof l)return l.value}return deepFreeze({issuer:a,expire:i,allowHosts:o})}var u=JSON.parse(e),p="undefined"!=typeof location?location.hostname:"",d=Date.now();if("object"!=typeof u)return error_invalid_input();var h=new Date("string"==typeof u.expire_at&&/^\d+$/.test(u.expire_at)?Number(u.expire_at):u.expire_at),f=Array.isArray(u.allow_hosts)?u.allow_hosts:[];if(0===p.length||isIPDomain(p)||BUILDIN_ALLOW_HOST.filter((function(e){return matchDomain(e,p)})).length>0){var m=String(null!==(t=u.certificate)&&void 0!==t?t:"");if(m){var v=new X509;return v.readCertPEM(m),deepFreeze({issuer:v.getSubjectString(),expire:h,allowHosts:f})}return deepFreeze({issuer:"none",expire:h,allowHosts:f})}var A=String(null!==(n=u.certificate)&&void 0!==n?n:"");if(!A)return error_invalid_certificate();var g=new X509;g.readCertPEM(A);var y=String(null!==(r=u._signature)&&void 0!==r?r:"");return y?!1===verifyMessage(jsonStableNoneNumberStrinfiy(ObjectOmit(u,["_signature"])),y,g)?error_invalid_signature():d<h.getTime()?0===f.filter((function(e){return matchDomain(e,p)})).length?error_host_not_allowed(p):deepFreeze({issuer:g.getSubjectString(),expire:h,allowHosts:f}):error_date_expired(h):error_invalid_signature()}var scratchMatrix4$1=new THREE__namespace.Matrix4,workRawMapping=new WeakMap,Work=function(){function e(e,t){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={work:this},this.observers=[],this.issuer="none",this.raw={works:[""],options:""},this.options={transform:new THREE__namespace.Matrix4};var n=parse(e,t,this);if(n instanceof Error)throw new Error("[PARSE FAILED]: "+n.message+"\nError work input:\n"+JSON.stringify(e))}return e.prototype.toJSON=function(){return this.raw},e.parse=parseWork,e}();function getType(e){return null==e?"null":Array.isArray(e)?"array":"object"==typeof e?"dict":"value"}function deepMerge(e,t){var n=getType(e),r=getType(t);if("null"===r)return e;if("value"===r)return t;if(r!==n)return JSON.parse(JSON.stringify(t));if("array"===r)for(var i=0;i<t.length;i++)e[i]=deepMerge(e[i],t[i]);else if("dict"===r)for(var o in t)e[o]=deepMerge(e[o],t[o]);return e}function startWithString(e,t){return 0===e.indexOf(t)}function urlWithParseOptions(e,t,n,r){var i,o=t;if(!0===r.jsonp){o=t.replace(/([\?\#].*)?$/i,"");var a=sha256("".concat(o)).slice(0,7);o="".concat(o,".").concat(a,".jsonp")}if(!0===r.shortPath){var s=o.replace(e,"").split("."),c=null!==(i=s.shift())&&void 0!==i?i:"",l=s.join(".");o=pathJoin(e,sha256(c))+(l?"."+l:"")}var u=o.replace(e,"");return r.baseURL&&(o=pathJoin(r.baseURL,u)),o}function panoURL(e,t,n,r,i){var o=n;return isAbsoluteURL(n)||(t&&(t=pathJoin(t,String(r))),o=pathJoin(t,o)),isAbsoluteURL(o)||(o=pathJoin(e,o)),startWithString(o,e)||console.warn("".concat(o," is not start with base_url(").concat(e,").")),urlWithParseOptions(e,o,"panorama",i)}function fileURL(e,t,n){var r=t;return isAbsoluteURL(r)||(r=pathJoin(e,t)),startWithString(r,e)||console.warn("".concat(r," is not start with base_url(").concat(e,").")),urlWithParseOptions(e,r,"model",n)}function textureURL$1(e,t,n,r){var i=t;return isAbsoluteURL(i)||(i=pathJoin(n,i)),isAbsoluteURL(i)||(i=pathJoin(e,i)),startWithString(i,e)||console.warn("".concat(i," is not start with base_url(").concat(e,").")),urlWithParseOptions(e,i,"texture",r)}function parse(e,t,n){for(var r,i,o,a,s,c,l,u,p,d,h,f,m,v,A,g,y,b,E=JSON.stringify(t),_=[],T=0,x=[].concat(e);T<x.length;T++){var R=x[T];R instanceof Work?_.push.apply(_,R.raw.works):"string"==typeof R?_.push(R):_.push(JSON.stringify(R))}var w=verify(_);if(w instanceof Error)return w;t=JSON.parse(E);var M,S={transform:new THREE__namespace.Matrix4};if(void 0!==t.debug&&(S.debug=t.debug),t.transform&&(Array.isArray(t.transform)?S.transform.fromArray(t.transform):S.transform.copy(t.transform)),t.viewerRequestVolume&&("clone"in t.viewerRequestVolume?S.viewerRequestVolume=t.viewerRequestVolume.clone():S.viewerRequestVolume=makeBoundingVolume(t.viewerRequestVolume)),void 0!==t.modelMinLevelOfDetail&&t.modelMinLevelOfDetail>=0&&(S.modelMinLevelOfDetail=t.modelMinLevelOfDetail),void 0!==t.modelMaxLevelOfDetail&&t.modelMaxLevelOfDetail>=0&&(S.modelMaxLevelOfDetail=t.modelMaxLevelOfDetail),void 0!==t.modelMaxRequests&&t.modelMaxRequests>=0&&(S.modelMaxRequests=t.modelMaxRequests),void 0!==t.modelMaxMemoryUsage&&t.modelMaxMemoryUsage>=0&&(S.modelMaxMemoryUsage=t.modelMaxMemoryUsage),void 0!==t.modelMaxScreenSpaceError&&t.modelMaxScreenSpaceError>=0&&(S.modelMaxScreenSpaceError=t.modelMaxScreenSpaceError),Object.defineProperty(n,"options",{configurable:!1,get:function(){return S}}),e=_.map((function(e){return JSON.parse(e)})).reduce((function(e,t){return deepMerge(e,t)})),Object.defineProperty(n,"raw",{configurable:!1,get:function(){return{works:_,options:E}}}),t.workCode&&("string"==typeof t.workCode?M=t.workCode:"function"==typeof t.workCode&&(M=t.workCode(e))),void 0===M&&(M=String(e.resource_code||e.basic_code||e.vr_code||e.code||e.project_id||e.work_code||e.workCode)),void 0===M)return new Error("WorkCode never matched.");Object.defineProperty(n,"workCode",{configurable:!1,get:function(){return M}});var C=String(e.name);if(Object.defineProperty(n,"name",{configurable:!1,get:function(){return C}}),w instanceof Error)return w;Object.defineProperty(n,"issuer",{configurable:!1,get:function(){return w.issuer}}),Object.defineProperty(n,"expire",{configurable:!1,get:function(){return w.expire}}),Object.defineProperty(n,"allowHosts",{configurable:!1,get:function(){return w.allowHosts}});var I=null!==(r=e.base_url)&&void 0!==r?r:"";if(I&&"/"!==I[I.length-1]&&(I+="/"),w instanceof Error)return w;if(e.model){var P,B,O,k={work:n,layers:[]};e.model.file?P=fileURL(I,e.model.file,t):e.model.file_url&&(P=fileURL(I,e.model.file_url,t)),Object.defineProperty(k,"file",{configurable:!1,get:function(){return P}}),e.model.textureBase?B=textureURL$1(I,"",e.model.textureBase,t):e.model.material_base_url?B=textureURL$1(I,"",e.model.material_base_url,t):k.file&&(B=k.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Object.defineProperty(k,"textureBase",{configurable:!1,get:function(){return B}}),Array.isArray(e.model.textures)?(O=e.model.textures.map((function(n){var r,i;return textureURL$1(I,n,null!==(i=null!==(r=e.model.textureBase)&&void 0!==r?r:e.model.material_base_url)&&void 0!==i?i:"",t)})),Object.freeze(O)):Array.isArray(e.model.material_textures)&&(O=e.model.material_textures.map((function(n){var r,i;return textureURL$1(I,n,null!==(i=null!==(r=e.model.textureBase)&&void 0!==r?r:e.model.material_base_url)&&void 0!==i?i:"",t)})),Object.freeze(O)),Object.defineProperty(k,"textures",{configurable:!1,get:function(){return O}});var H=[];if(Array.isArray(e.model.tiles))for(var F=0,L=e.model.tiles;F<L.length;F++){var D=L[F];D&&(D.tileset||D.tileset_url)&&H.push(Object.freeze({type:null!==(i=D.type)&&void 0!==i?i:"mesh",name:null!==(o=D.name)&&void 0!==o?o:"",upAxis:null!==(s=null!==(a=D.upAxis)&&void 0!==a?a:D.up_axis)&&void 0!==s?s:"-Y",tileset:D.tileset||D.tileset_url}))}else e.model.tiles&&(e.model.tiles.tileset||e.model.tiles.tileset_url)&&H.push(Object.freeze({type:null!==(c=e.model.tiles.type)&&void 0!==c?c:"mesh",name:null!==(l=e.model.tiles.name)&&void 0!==l?l:"lod",upAxis:null!==(p=null!==(u=e.model.tiles.upAxis)&&void 0!==u?u:e.model.tiles.up_axis)&&void 0!==p?p:"-Y",tileset:e.model.tiles.tileset||e.model.tiles.tileset_url}));if(Array.isArray(e.model.layers))for(var N=0,V=e.model.layers;N<V.length;N++){var U=V[N];U&&(U.tileset||U.tileset_url)&&H.push(Object.freeze({type:null!==(d=U.type)&&void 0!==d?d:"mesh",name:null!==(h=U.name)&&void 0!==h?h:"",upAxis:null!==(f=U.upAxis)&&void 0!==f?f:U.up_axis,tileset:U.tileset||U.tileset_url}))}Object.freeze(H),Object.defineProperty(k,"layers",{configurable:!1,get:function(){return H}}),Object.defineProperty(n,"model",{configurable:!1,get:function(){if(k.file||k.layers.length)return k}})}if(w instanceof Error)return w;var Q=[];if(e.observers&&Array.isArray(e.observers)){var z=[];e.panorama&&(Array.isArray(e.panorama)?z=e.panorama:Array.isArray(e.panorama.list)?z=e.panorama.list:Array.isArray(e.panorama.info)&&(z=e.panorama.info));for(var j=function(r){var i={},o=e.observers[r];if(!o)return"break";var a=z[r];if(!a)return"break";o=Object.assign({},o,a,{active:!1!==o.active&&!1!==a.active}),Object.defineProperty(i,"work",{configurable:!1,get:function(){return n}}),Object.defineProperty(i,"index",{configurable:!1,get:function(){return r}}),Object.defineProperty(i,"panoIndex",{configurable:!1,get:function(){return r}});var s=panoStringify({workCode:n.workCode,panoIndex:r});Object.defineProperty(i,"panoId",{configurable:!1,get:function(){return s}});var c=Object.freeze({workCode:n.workCode,panoIndex:r});Object.defineProperty(i,"pano",{configurable:!1,get:function(){return c}});var l=!1!==o.active;Object.defineProperty(i,"active",{configurable:!1,get:function(){return l}});var u=!0===o.loadable;Object.defineProperty(i,"loadable",{configurable:!1,get:function(){return u}});var p=o.derived_id;Object.defineProperty(i,"derivedId",{configurable:!1,get:function(){return p}});var d=o.derived_id_str;Object.defineProperty(i,"derivedIdStr",{configurable:!1,get:function(){return d}});var h=null!==(b=null!==(g=null!==(v=null===(m=e.panorama)||void 0===m?void 0:m.pano_high_cube_base_url)&&void 0!==v?v:null===(A=e.panorama)||void 0===A?void 0:A.pano_cube_base_url)&&void 0!==g?g:null===(y=e.panorama)||void 0===y?void 0:y.base_url)&&void 0!==b?b:"",f={up:panoURL(I,h,o.images?o.images.up:o.up,r,t),down:panoURL(I,h,o.images?o.images.down:o.down,r,t),right:panoURL(I,h,o.images?o.images.right:o.right,r,t),left:panoURL(I,h,o.images?o.images.left:o.left,r,t),front:panoURL(I,h,o.images?o.images.front:o.front,r,t),back:panoURL(I,h,o.images?o.images.back:o.back,r,t)},E=o.images?o.images.depth:o.depth;E&&(f.depth=panoURL(I,h,E,r,t));var _=o.images?o.images.luminance:o.luminance;_&&(f.luminance=Object.freeze({up:panoURL(I,h,_.up,r,t),down:panoURL(I,h,_.down,r,t),right:panoURL(I,h,_.right,r,t),left:panoURL(I,h,_.left,r,t),front:panoURL(I,h,_.front,r,t),back:panoURL(I,h,_.back,r,t)}));var T=o.images?o.images.tiles:o.tiles;if(T){for(var x=[],R=function(e){var t=e.match(/\/cube_(\d+)\//);if(t){var n=Number(t[1]);if(isPowerOfTwo(n))return n}return!1},w=function(e,t){return e.replace(/\/cube_(\d+)\//,(function(){return"/cube_".concat(t,"/")}))},M=0,S=T;M<S.length;M++){var C=S[M];if("number"==typeof C){var P=C,B=R(f.front);if(!1===B)continue;if((N=Math.max(B,512*Math.pow(2,P)))>2048){var O=w(f.up,N),k=w(f.down,N),H=w(f.right,N),F=w(f.left,N),L=w(f.front,N),D=w(f.back,N);x.push(Object.freeze({level:P,size:N,up:O,down:k,right:H,left:F,front:L,back:D}))}else{O=f.up,k=f.down,H=f.right,F=f.left,L=f.front,D=f.back;x.push(Object.freeze({level:P,size:N,up:O,down:k,right:H,left:F,front:L,back:D}))}}else{var N;if("number"!=typeof(P=C.level))continue;if("number"!=typeof(N=C.size))continue;O=panoURL(I,h,C.up,r,t),k=panoURL(I,h,C.down,r,t),H=panoURL(I,h,C.right,r,t),F=panoURL(I,h,C.left,r,t),L=panoURL(I,h,C.front,r,t),D=panoURL(I,h,C.back,r,t);x.push(Object.freeze({level:P,size:N,up:O,down:k,right:H,left:F,front:L,back:D}))}}x.sort((function(e,t){return e.level-t.level})),Object.freeze(x),Object.defineProperty(f,"tiles",{configurable:!1,get:function(){return x}})}Object.freeze(f),Object.defineProperty(i,"images",{configurable:!1,get:function(){return f}});var V=new THREE__namespace.Vector3;if(o.position instanceof THREE__namespace.Vector3)V.copy(o.position);else{if(!Array.isArray(o.position))return"break";V.fromArray(o.position)}Object.freeze(V),Object.defineProperty(i,"position",{configurable:!1,get:function(){return V}});var U=new THREE__namespace.Vector3;if(o.standingPosition instanceof THREE__namespace.Vector3)U.copy(o.standingPosition);else if(Array.isArray(o.standingPosition))U.fromArray(o.standingPosition);else if(o.standing_position instanceof THREE__namespace.Vector3)U.copy(o.standing_position);else{if(!Array.isArray(o.standing_position))return"break";U.fromArray(o.standing_position)}Object.freeze(U),Object.defineProperty(i,"standingPosition",{configurable:!1,get:function(){return U}});var j=new THREE__namespace.Quaternion;if(o.quaternion instanceof THREE__namespace.Quaternion)j.copy(o.quaternion);else if(Array.isArray(o.quaternion))j.fromArray(o.quaternion);else{if(!o.quaternion)return"break";var q=o.quaternion,G=q.x,K=q.y,W=q.z,X=q.w;j.set(G,K,W,X)}Object.freeze(j),Object.defineProperty(i,"quaternion",{configurable:!1,get:function(){return j}});var J,Y=0;isNumber(o.floorIndex)?Y=o.floorIndex:isNumber(o.floor_index)?Y=o.floor_index:isNumber(o.floor)&&(Y=o.floor),Object.defineProperty(i,"floorIndex",{configurable:!1,get:function(){return Y}}),o.video&&(J={},"string"==typeof o.video.source&&(J.source=o.video.source),o.video.matrix instanceof THREE__namespace.Matrix4?J.matrix=o.video.matrix.clone():Array.isArray(o.video.matrix)&&(J.matrix=(new THREE__namespace.Matrix4).fromArray(o.video.matrix)),o.video.size instanceof THREE__namespace.Vector2?J.size=o.video.size.clone():Array.isArray(o.video.size)&&(J.size=(new THREE__namespace.Vector2).fromArray(o.video.size)),J.source&&J.matrix&&J.size&&(i.video=J)),Object.freeze(J),Object.defineProperty(i,"video",{configurable:!1,get:function(){return J}}),Array.isArray(o.accessibleNodes)?(i.accessibleNodes=o.accessibleNodes.slice(),i.accessibleIds=o.accessibleNodes.map((function(e){return panoStringify({workCode:n.workCode,panoIndex:e})}))):Array.isArray(o.accessible_nodes)&&(i.accessibleNodes=o.accessible_nodes.slice(),i.accessibleIds=o.accessible_nodes.map((function(e){return panoStringify({workCode:n.workCode,panoIndex:e})}))),Array.isArray(o.visibleNodes)?(i.visibleNodes=o.visibleNodes.slice(),i.visibleIds=o.visibleNodes.map((function(e){return panoStringify({workCode:n.workCode,panoIndex:e})}))):Array.isArray(o.visible_nodes)&&(i.visibleNodes=o.visible_nodes.slice(),i.visibleIds=o.visible_nodes.map((function(e){return panoStringify({workCode:n.workCode,panoIndex:e})}))),Q[r]=i},q=0;q<e.observers.length;q++){if("break"===j(q))break}}for(var G=function(e){if(e.accessibleIds){var t=e.accessibleIds.filter((function(e){return!!Q.find((function(t){return t.panoId===e}))}));Object.freeze(t),Object.defineProperty(e,"accessibleIds",{configurable:!1,get:function(){return t}})}else{for(var n=[],r=0;r<Q.length;r++)Q[r]!==e&&(Math.abs(Q[r].position.y-e.position.y)>3||Q[r].position.distanceTo(e.position)>10||n.push(Q[r].panoId));Object.freeze(n),Object.defineProperty(e,"accessibleIds",{configurable:!1,get:function(){return n}})}if(e.accessibleNodes){var i=e.accessibleNodes.filter((function(e){return!!Q.find((function(t){return t.panoIndex===e}))}));Object.freeze(i),Object.defineProperty(e,"accessibleNodes",{configurable:!1,get:function(){return i}})}else{var o=[];for(r=0;r<Q.length;r++)Q[r]!==e&&(Math.abs(Q[r].position.y-e.position.y)>3||Q[r].position.distanceTo(e.position)>10||o.push(Q[r].panoIndex));Object.freeze(o),Object.defineProperty(e,"accessibleNodes",{configurable:!1,get:function(){return o}})}if(e.visibleIds){var a=e.visibleIds.filter((function(e){return!!Q.find((function(t){return t.panoId===e}))}));Object.freeze(a),Object.defineProperty(e,"visibleIds",{configurable:!1,get:function(){return a}})}else{var s=e.accessibleIds.slice();Object.freeze(s),Object.defineProperty(e,"visibleIds",{configurable:!1,get:function(){return s}})}if(e.visibleNodes){var c=e.visibleNodes.filter((function(e){return!!Q.find((function(t){return t.panoIndex===e}))}));Object.freeze(c),Object.defineProperty(e,"visibleNodes",{configurable:!1,get:function(){return c}})}else{var l=e.accessibleNodes.slice();Object.freeze(l),Object.defineProperty(e,"visibleNodes",{configurable:!1,get:function(){return l}})}},K=0,W=Q;K<W.length;K++){G(W[K])}if(Object.freeze(Q),Object.defineProperty(n,"observers",{configurable:!1,get:function(){return Q}}),w instanceof Error)return w;if(e.initial){if(("Panorama"===e.initial.mode&&0===n.observers.length||"Floorplan"===e.initial.mode||"Topview"===e.initial.mode||"Model"===e.initial.mode||"Mapview"===e.initial.mode||"DepthPanorama"===e.initial.mode)&&(n.initial.mode=e.initial.mode),isNumber(e.initial.latitude)&&(n.initial.latitude=e.initial.latitude),isNumber(e.initial.longitude)?n.initial.longitude=e.initial.longitude:isNumber(e.initial.heading)&&(n.initial.longitude=headingToLongitude(e.initial.heading)),isNumber(e.initial.fov)&&(n.initial.fov=e.initial.fov),n.observers.length>0){var X=void 0;isNumber(e.initial.panoIndex)?X=e.initial.panoIndex:isNumber(e.initial.pano_index)?X=e.initial.pano_index:isNumber(e.initial.pano)&&(X=e.initial.pano),"number"==typeof X&&(X=clamp(X,0,n.observers.length-1),n.initial.panoIndex=X)}if(isNumber(e.initial.distance)&&(n.initial.distance=e.initial.distance),Array.isArray(e.initial.offset)){var J=[0,0,0].map((function(t,n){var r=Number(e.initial.offset[n]);return isNaN(r)||!isFinite(r)?0:r}));n.initial.offset=(new THREE__namespace.Vector3).fromArray(J)}n.initial.mode||"number"!=typeof n.initial.panoIndex||(n.initial.mode="Panorama")}return w instanceof Error?w:(workRawMapping.set(n,{works:_,options:E}),n)}function parseWork(e,t){"string"==typeof e&&"{"===e.trim()[0]&&(e=JSON.parse(e));var n=workRawMapping.get(e);if(n){if(t&&!equal(JSON.parse(n.options),t))throw new Error("[PARSE FAILED]: work is parsed with different options.");return e}try{return new Work(e,null!=t?t:{})}catch(error){throw new Error("[PARSE FAILED]: "+error.message+"\nError work input:\n"+JSON.stringify(e))}}function createWorks(e){for(var t={},n=[],r={},i=0,o=e;i<o.length;i++){var a=o[i],s=t[a.workCode];s||(s=t[a.workCode]=(new THREE__namespace.Matrix4).copy(a.options.transform));for(var c=0,l=a.observers;c<l.length;c++){var u=l[c],p={isResolved:!0,active:u.active,accessibleIds:u.accessibleIds,visibleIds:u.visibleIds,accessibleNodes:u.accessibleNodes,visibleNodes:u.visibleNodes,floorIndex:u.floorIndex,images:u.images,index:u.index,panoIndex:u.panoIndex,loadable:u.loadable,panoId:u.panoId,pano:u.pano,work:u.work,derivedId:u.derivedId,video:u.video,position:(new THREE__namespace.Vector3).copy(u.position).applyMatrix4(s),standingPosition:(new THREE__namespace.Vector3).copy(u.standingPosition).applyMatrix4(s),quaternion:(new THREE__namespace.Quaternion).setFromRotationMatrix(scratchMatrix4$1.makeRotationFromQuaternion(u.quaternion).premultiply(s))};Object.freeze(p),n.push(p),r[p.panoId]=p}}Object.freeze(n);for(var d=e.slice(),h={},f=0,m=d;f<m.length;f++){a=m[f];h[a.workCode]=a}return Object.freeze(Object.assign(d,{get initial(){return d.length>0?d[0].initial:{work:{}}},get resolvedObservers(){return n},getWork:function(e){return h[e]},getResolvedObserver:function(t){var n,i;return isPanoId(t)?r[t]:"number"==typeof t?r[panoStringify({workCode:null!==(i=null===(n=e[0])||void 0===n?void 0:n.workCode)&&void 0!==i?i:"",panoIndex:t})]:r[panoStringify(t)]},update:function(){for(var e={},r=0,i=d;r<i.length;r++){var o=i[r],a=o.options.transform,s=t[o.workCode];s?s.equals(a)||(s.copy(a),e[o.workCode]=!0):(t[o.workCode]=(new THREE__namespace.Matrix4).copy(a),e[o.workCode]=!0)}for(var c=0,l=n;c<l.length;c++){var u=l[c];if(!0===e[u.work.workCode]){var p=u.work.observers[u.index],h=u.work.options.transform;u.position.copy(p.position).applyMatrix4(h),u.standingPosition.copy(p.standingPosition).applyMatrix4(h),u.quaternion.setFromRotationMatrix(scratchMatrix4$1.makeRotationFromQuaternion(p.quaternion).premultiply(h))}}}}))}var fetcherMap=new Map;function getFetcher(e){var t=fetcherMap.get(e);if(t)return t;throw new Error("fetcher never registered.")}function registerFetcher(e,t){return fetcherMap.set(e,t)}var scratchVector3$1=new THREE__namespace.Vector3,scratchMatrix3=new THREE__namespace.Matrix3,a=6378137,invF=298.257223563;function coordinatesFromPoint(e){for(var t=a-a/invF,n=(a*a-t*t)/(a*a),r=Math.sqrt(e.x*e.x+e.y*e.y),i=0,o=Math.atan2(e.z,r),s=0;i++<1e3;){var c=Math.sin(o),l=a/Math.sqrt(1-n*c*c);s=r/Math.cos(o)-l;var u=Math.atan2(e.z/(l*(1-n)+s),r/(l+s));if(Math.abs(u-o)<1e-12)break;o=u}return{longitude:Math.atan2(e.y,e.x),latitude:o,altitude:s}}function pointFromCoordinates(e){var t=a-a/invF,n=(a*a-t*t)/(a*a),r=Math.sin(e.latitude),i=Math.cos(e.latitude),o=Math.sin(e.longitude),s=Math.cos(e.longitude),c=a/Math.sqrt(1-n*r*r),l=(c+e.altitude)*i*s,u=(c+e.altitude)*i*o,p=(t*t/(a*a)*c+e.altitude)*r;return new THREE__namespace.Vector3(l,u,p)}function getWorldToLocalMatrix(e,t){var n=coordinatesFromPoint(e),r=n.longitude,i=n.latitude,o=n.altitude,a=Math.sin(i),s=Math.sin(r),c=Math.cos(i),l=Math.cos(r),u=t.fromArray([-s,-a*l,c*l,0,+l,-a*s,c*s,0,0,c,a,0,0,0,0,1]),p=scratchMatrix3.setFromMatrix4(u),d=scratchVector3$1.copy(e).applyMatrix3(p).multiplyScalar(-1);u.setPosition(d);var h=(new THREE__namespace.Matrix4).fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,o,1]);return u.premultiply(h),u}var BufferGeometryUtils={computeTangents:function(e){var t=e.index,n=e.attributes;if(null!==t&&void 0!==n.position&&void 0!==n.normal&&void 0!==n.uv){var r=t.array,i=n.position.array,o=n.normal.array,a=n.uv.array,s=i.length/3;void 0===n.tangent&&e.setAttribute("tangent",new THREE__namespace.BufferAttribute(new Float32Array(4*s),4));for(var c=n.tangent.array,l=[],u=[],p=0;p<s;p++)l[p]=new THREE__namespace.Vector3,u[p]=new THREE__namespace.Vector3;var d=new THREE__namespace.Vector3,h=new THREE__namespace.Vector3,f=new THREE__namespace.Vector3,m=new THREE__namespace.Vector2,v=new THREE__namespace.Vector2,A=new THREE__namespace.Vector2,g=new THREE__namespace.Vector3,y=new THREE__namespace.Vector3,b=e.groups;0===b.length&&(b=[{start:0,count:r.length}]);p=0;for(var E=b.length;p<E;++p)for(var _=B=(P=b[p]).start,T=B+P.count;_<T;_+=3)O(r[_+0],r[_+1],r[_+2]);var x,R,w,M=new THREE__namespace.Vector3,S=new THREE__namespace.Vector3,C=new THREE__namespace.Vector3,I=new THREE__namespace.Vector3;for(p=0,E=b.length;p<E;++p){var P,B;for(_=B=(P=b[p]).start,T=B+P.count;_<T;_+=3)k(r[_+0]),k(r[_+1]),k(r[_+2])}}else console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");function O(e,t,n){d.fromArray(i,3*e),h.fromArray(i,3*t),f.fromArray(i,3*n),m.fromArray(a,2*e),v.fromArray(a,2*t),A.fromArray(a,2*n);var r=h.x-d.x,o=f.x-d.x,s=h.y-d.y,c=f.y-d.y,p=h.z-d.z,b=f.z-d.z,E=v.x-m.x,_=A.x-m.x,T=v.y-m.y,x=A.y-m.y,R=1/(E*x-_*T);g.set((x*r-T*o)*R,(x*s-T*c)*R,(x*p-T*b)*R),y.set((E*o-_*r)*R,(E*c-_*s)*R,(E*b-_*p)*R),l[e].add(g),l[t].add(g),l[n].add(g),u[e].add(y),u[t].add(y),u[n].add(y)}function k(e){C.fromArray(o,3*e),I.copy(C),R=l[e],M.copy(R),M.sub(C.multiplyScalar(C.dot(R))).normalize(),S.crossVectors(I,R),w=S.dot(u[e]),x=w<0?-1:1,c[4*e]=M.x,c[4*e+1]=M.y,c[4*e+2]=M.z,c[4*e+3]=x}},mergeBufferGeometries:function(e,t){for(var n=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),i=new Set(Object.keys(e[0].morphAttributes)),o={},a={},s=new THREE__namespace.BufferGeometry,c=0,l=0;l<e.length;++l){var u=e[l];if(n!==(null!==u.index))return null;for(var p in u.attributes){if(!r.has(p))return null;void 0===o[p]&&(o[p]=[]),o[p].push(u.attributes[p])}for(var p in u.morphAttributes){if(!i.has(p))return null;void 0===a[p]&&(a[p]=[]),a[p].push(u.morphAttributes[p])}if(s.userData.mergedUserData=s.userData.mergedUserData||[],s.userData.mergedUserData.push(u.userData),t){var d;if(n)d=u.index.count;else{if(void 0===u.attributes.position)return null;d=u.attributes.position.count}s.addGroup(c,d,l),c+=d}}if(n){var h=0,f=[];for(l=0;l<e.length;++l){for(var m=e[l].index,v=0;v<m.count;++v)f.push(m.getX(v)+h);h+=e[l].attributes.position.count}s.setIndex(f)}for(var p in o){var A=this.mergeBufferAttributes(o[p]);if(!A)return null;s.setAttribute(p,A)}for(var p in a){var g=a[p][0].length;if(0===g)break;s.morphAttributes=s.morphAttributes||{},s.morphAttributes[p]=[];for(l=0;l<g;++l){var y=[];for(v=0;v<a[p].length;++v)y.push(a[p][v][l]);var b=this.mergeBufferAttributes(y);if(!b)return null;s.morphAttributes[p].push(b)}}return s},mergeBufferAttributes:function(e){for(var t,n,r,i=0,o=0;o<e.length;++o){var a=e[o];if(a.isInterleavedBufferAttribute)return null;if(void 0===t&&(t=a.array.constructor),t!==a.array.constructor)return null;if(void 0===n&&(n=a.itemSize),n!==a.itemSize)return null;if(void 0===r&&(r=a.normalized),r!==a.normalized)return null;i+=a.array.length}var s=new t(i),c=0;for(o=0;o<e.length;++o)s.set(e[o].array,c),c+=e[o].array.length;return new THREE__namespace.BufferAttribute(s,n,r)},interleaveAttributes:function(e){for(var t,n=0,r=0,i=0,o=e.length;i<o;++i){var a=e[i];if(void 0===t&&(t=a.array.constructor),t!==a.array.constructor)return console.warn("AttributeBuffers of different types cannot be interleaved"),null;n+=a.array.length,r+=a.itemSize}var s=new THREE__namespace.InterleavedBuffer(new t(n),r),c=0,l=[],u=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"],d=0;for(o=e.length;d<o;d++){var h=(a=e[d]).itemSize,f=a.count,m=new THREE__namespace.InterleavedBufferAttribute(s,h,c,a.normalized);l.push(m),c+=h;for(var v=0;v<f;v++)for(var A=0;A<h;A++)m[p[A]](v,a[u[A]](v))}return l},estimateBytesUsed:function(e){var t=0;for(var n in e.attributes){var r=e.getAttribute(n);t+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}var i=e.getIndex();return t+=i?i.count*i.itemSize*i.array.BYTES_PER_ELEMENT:0},mergeVertices:function(e,t){void 0===t&&(t=1e-4),t=Math.max(t,Number.EPSILON);for(var n={},r=e.getIndex(),i=e.getAttribute("position"),o=r?r.count:i.count,a=0,s=Object.keys(e.attributes),c={},l={},u=[],p=["getX","getY","getZ","getW"],d=0,h=s.length;d<h;d++){c[y=s[d]]=[],(T=e.morphAttributes[y])&&(l[y]=new Array(T.length).fill().map((function(){return[]})))}var f=Math.log10(1/t),m=Math.pow(10,f);for(d=0;d<o;d++){var v=r?r.getX(d):d,A="",g=0;for(h=s.length;g<h;g++)for(var y=s[g],b=(_=e.getAttribute(y)).itemSize,E=0;E<b;E++)A+="".concat(~~(_[p[E]](v)*m),",");if(A in n)u.push(n[A]);else{for(g=0,h=s.length;g<h;g++){y=s[g];var _=e.getAttribute(y),T=e.morphAttributes[y],x=(b=_.itemSize,c[y]),R=l[y];for(E=0;E<b;E++){var w=p[E];if(x.push(_[w](v)),T)for(var M=0,S=T.length;M<S;M++)R[M].push(T[M][w](v))}}n[A]=a,u.push(a),a++}}var C=e.clone();for(d=0,h=s.length;d<h;d++){y=s[d];var I=e.getAttribute(y),P=new I.array.constructor(c[y]);_=new THREE__namespace.BufferAttribute(P,I.itemSize,I.normalized);if(C.setAttribute(y,_),y in l)for(g=0;g<l[y].length;g++){var B=e.morphAttributes[y][g],O=(P=new B.array.constructor(l[y][g]),new THREE__namespace.BufferAttribute(P,B.itemSize,B.normalized));C.morphAttributes[y][g]=O}}return C.setIndex(u),C}};function isThirdPersonMode(e){switch(e){case"Floorplan":case"Mapview":return!0;default:return!1}}function isFristPersonMode(e){switch(e){case"Panorama":case"VRPanorama":case"XRPanorama":case"Model":case"DepthPanorama":return!0;default:return!1}}var scratchVector3=new THREE__namespace.Vector3,scratchSphere=new THREE__namespace.Sphere,scratchMatrix4=new THREE__namespace.Matrix4,scratchMatrix4Inverse=new THREE__namespace.Matrix4,scratchBoundingBox=new THREE__namespace.Box3,ROTATE_X_90_MATRIX=(new THREE__namespace.Matrix4).fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),DEFAULT_BOUNDING=new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5));function getExt(e){var t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(e);if(t){var n=String(t[1]).trim().split(".").slice(1).reverse()[0];if(n)return n}return""}var Model=function(e){function t(t){var n,r,i,o;void 0===t&&(t={});var a=e.call(this)||this;return a.name="",a.coordinatesSystemTransformers=null!==(n=t.coordinatesSystemTransformers)&&void 0!==n?n:[],a.onError=null!==(r=t.onError)&&void 0!==r?r:noop$1,a.onShownFloorChange=null!==(i=t.onShownFloorChange)&&void 0!==i?i:noop$1,a.onLoad=null!==(o=t.onLoad)&&void 0!==o?o:noop$1,a.work=null,a.viewLayers=[],a.bounding=new THREE__namespace.Box3(new THREE__namespace.Vector3,new THREE__namespace.Vector3),a.floorLength=0,a.textureOptions={},a.refined=!1,a.refineProgress=[0,0],a.loaded=!1,a.matrixAutoUpdate=!1,a.renderOrder=-4,a.needsRender=!0,a.autoRefine=!0,a.materialVersion=0,a.materialParameters=__assign({},defaultPbmParameters),a.cacheCameras=[],a.disposed=!1,a}return __extends(t,e),Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.viewLayers.length},enumerable:!1,configurable:!0}),t.prototype.getMaterial=function(){return __assign({},this.materialParameters)},t.prototype.setMaterial=function(e){var t=this.materialParameters.shownFloorIndex;if(updatePBMParameters(this.materialParameters,e)){var n=this.materialParameters.shownFloorIndex;t!==n&&this.onShownFloorChange(n),this.materialVersion++,this.needsRender=!0}},Object.defineProperty(t.prototype,"shownFloorIndex",{get:function(){return this.materialParameters.shownFloorIndex},set:function(e){this.setMaterial({shownFloorIndex:e})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shownFloor",{get:function(){return-1===this.shownFloorIndex?null:this.shownFloorIndex},set:function(e){this.shownFloorIndex=null===e?-1:e},enumerable:!1,configurable:!0}),t.prototype.show=function(e){this.shownFloor=null!=e?e:null},Object.defineProperty(t.prototype,"clippers",{get:function(){return this.materialParameters.clippers},set:function(e){this.setMaterial({clippers:e})},enumerable:!1,configurable:!0}),t.prototype.getEdgesBySphere=function(e,t){void 0===t&&(t=30/180*Math.PI);for(var n=Math.cos(t),r=[],i=0,o=this.children;i<o.length;i++){var a=o[i];if(a instanceof Tile3DModel)a.tileset.selectedTiles.forEach((function(t){var i,o,a;if(!(t.boundingVolume&&t.boundingVolume.distanceTo(e.center)>e.radius)){var s=null===(o=null===(i=t.content)||void 0===i?void 0:i.data)||void 0===o?void 0:o.object;if(s&&s.visible){var c=[];if(s.traverseVisible((function(t){if(t instanceof THREE__namespace.Mesh){var n=bvhMeshMap.get(t);if(n){scratchMatrix4.copy(t.matrixWorld),scratchMatrix4Inverse.getInverse(scratchMatrix4),scratchSphere.copy(e).applyMatrix4(scratchMatrix4Inverse);var r=n.trianglesInSphere(scratchSphere.center,scratchSphere.radius),i=new THREE__namespace.BufferGeometry;i.setAttribute("position",new THREE__namespace.BufferAttribute(r,3)),i.applyMatrix4(t.matrixWorld),i=BufferGeometryUtils.mergeVertices(i,.01),c.push(i)}}})),0===c.length)return;for(var l=["a","b","c"],u=BufferGeometryUtils.mergeBufferGeometries(c,!1),p=u.getAttribute("position").array,d=(null===(a=u.getIndex())||void 0===a?void 0:a.array)||[],h=[],f=[],m=0,v=p.length;m<v;m+=3){var A=new THREE__namespace.Vector3(p[m],p[m+1],p[m+2]);h.push(A)}for(m=0,v=d.length;m<v;m+=3){var g=d[m],y=d[m+1],b=d[m+2],E=(new THREE__namespace.Vector3).crossVectors(h[y].clone().sub(h[g]),h[b].clone().sub(h[g])).normalize();f.push({a:g,b:y,c:b,normal:E})}var _={};for(m=0,v=f.length;m<v;m++)for(var T=f[m],x=0;x<3;x++){var R=T[l[x]],w=T[l[(x+1)%3]],M=[Math.min(R,w),Math.max(R,w)];void 0===_[S=M[0]+"-"+M[1]]?_[S]={index1:M[0],index2:M[1],face1:m}:_[S].face2=m}for(var S in _){var C=_[S];if(void 0===C.face2||f[C.face1].normal.dot(f[C.face2].normal)<=n){var I=h[C.index1],P=h[C.index2];r.push(new THREE__namespace.Line3(I,P))}}h.length=0,f.length=0}}}))}return r},t.prototype.intersectRaycaster=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!0);for(var r=[],i=0,o=this.children.length;i<o;i++){var a=this.children[i];a.visible&&a instanceof Tile3DModel&&a.intersectRaycaster(e,!1,r)}return null!=t&&(r=r.filter((function(e){return e.floor===t}))),n&&r.sort((function(e,t){return e.distance-t.distance})),r},t.prototype.load=function(e,t){var n,r,i,o=this;if(void 0===t&&(t={}),this.work=e,this.name=this.work.workCode,!e.model)return Promise.resolve();for(var a=e.model,s=e.options,c=0,l=0,u=e.observers;l<u.length;l++){var p=u[l];c=Math.max(c,p.floorIndex)}this.floorLength=c+1;for(var d=!1,h=[],f=function(t){var n=t.tileset,i=t.upAxis,a=t.name,c=t.type;"mesh"===c&&(d=!0);var l=n.split("#"),u=l[0],p=l[1],f=null!==(r=(p||u).split("?")[1])&&void 0!==r?r:"",m=getFetcher(e).ajax(imageURL(n,{key:"model.0"}),{responseType:"text"}).then((function(e){var t=JSON.parse(e.body),n=t.root;"lodVersion"in t&&(i="-Y","floorInfo"in t&&(t.properties=t.properties||{},t.properties.floorInfo=t.floorInfo.map((function(e){return{ground:-e.ground,height:e.height}})),delete t.floorInfo),t.asset.tilesetVersion=String(t.lodVersion),delete t.lodVersion);var r=n.boundingVolume?makeBoundingVolume(n.boundingVolume):void 0;r&&n.transform&&r.applyMatrix4(scratchMatrix4.fromArray(n.transform));var a=o.coordinatesSystemTransformers.find((function(e){return e.name===i}));if(!a)return Promise.reject(new Error("CoordinatesSystemTransformers: ".concat(i," not found.")));var c=new THREE__namespace.Vector3;return r&&r.getCenter(c),"transformToEarthCentered"in a?Promise.resolve().then((function(){return a.transformToEarthCentered(c)})).then((function(e){var i,o=new THREE__namespace.Matrix4,a="";if(r){r.getCenter(scratchVector3),scratchVector3.applyMatrix4(e),o.premultiply(e).premultiply(getWorldToLocalMatrix(scratchVector3,scratchMatrix4)).premultiply(ROTATE_X_90_MATRIX);var c=coordinatesFromPoint(scratchVector3),l=c.longitude;a=[c.latitude,l].map((function(e){return(e/Math.PI*180).toFixed(6)})).join(",")}return t.root={refine:null!==(i=n.refine)&&void 0!==i?i:"REPLACE",geometricError:t.geometricError,transform:o.toArray(),boundingVolume:r?r.toJson():void 0,viewerRequestVolume:s.viewerRequestVolume?s.viewerRequestVolume.toJson():void 0,children:[n]},{tilesetHeader:t,coordinates:a,worldToLocalTransform:o}})):Promise.resolve().then((function(){return a.transformToUpAxisZ(c)})).then((function(e){var i,o=new THREE__namespace.Matrix4;o.premultiply(e).premultiply(ROTATE_X_90_MATRIX);return t.root={refine:null!==(i=n.refine)&&void 0!==i?i:"REPLACE",geometricError:t.geometricError,transform:o.toArray(),boundingVolume:r?r.toJson():void 0,viewerRequestVolume:s.viewerRequestVolume?s.viewerRequestVolume.toJson():void 0,children:[n]},{tilesetHeader:t,coordinates:"",worldToLocalTransform:o}}))})).then((function(t){var r=t.tilesetHeader,l=t.coordinates,u=t.worldToLocalTransform,p=n?n.slice(0,n.lastIndexOf("/")+1):"",d=new Tile3DModel(o,c,r,{resourcePath:p,search:f,fetcher:getFetcher(e)});d.name=n,d.matrix.copy(s.transform),d.matrix.decompose(d.position,d.quaternion,d.scale),d.matrixWorldNeedsUpdate=!0;return{name:a,type:c,upAxis:i,coordinates:l,scene:d,error:null,coordinatesToWorldPoint:function(e){return pointFromCoordinates(e).applyMatrix4(u).applyMatrix4(d.matrix)},worldPointToCoordinates:function(e){var t=(new THREE__namespace.Matrix4).premultiply(u).premultiply(d.matrix),n=(new THREE__namespace.Matrix4).getInverse(t);return coordinatesFromPoint(e.clone().applyMatrix4(n))}}}));h.push(m.catch((function(e){o.onError(e);return{name:a,type:c,scene:null,error:e,upAxis:i,coordinates:"",coordinatesToWorldPoint:function(e){throw new Error("coordinatesToWorldPoint require World Coordinates upAxis.")},worldPointToCoordinates:function(e){throw new Error("worldPointToCoordinates require World Coordinates upAxis.")}}})))},m=0,v=a.layers;m<v.length;m++){f(v[m])}if(!d&&a.file){var A=a.file,g=a.textureBase,y=a.textures,b={asset:{gltfUpAxis:"Z",version:"0.0"},geometricError:0,root:{content:{uri:A},refine:"REPLACE",geometricError:0,viewerRequestVolume:s.viewerRequestVolume?s.viewerRequestVolume.toJson():void 0,extras:(n={},n[getExt(A)||"at3d"]={textureBaseUri:g,textureArray:y,textureOptions:null!==(i=t.textureOptions)&&void 0!==i?i:{}},n)}},E=A.slice(0,A.lastIndexOf("/")+1),_=new Tile3DModel(this,"mesh",b,{resourcePath:E,fetcher:getFetcher(e)});_.name=A,_.matrix.copy(s.transform),_.matrix.decompose(_.position,_.quaternion,_.scale),_.matrixWorldNeedsUpdate=!0;var T=Promise.resolve({scene:_,error:null,coordinates:"",name:"fallback",type:"mesh",upAxis:"Y",coordinatesToWorldPoint:function(e){throw new Error("coordinatesToWorldPoint require WGS84 upAxis.")},worldPointToCoordinates:function(e){throw new Error("worldPointToCoordinates require WGS84 upAxis.")}});h.push(T)}return Promise.all(h).then((function(e){for(var t=[],n=[],r=[],i=0,a=e;i<a.length;i++){var s=a[i];if(o.viewLayers.push(s),s.scene){if(o.disposed){s.scene.dispose();continue}switch(o.add(s.scene),s.scene.visible=!1,s.type){case"lod":t.push(s.scene);break;case"point_cloud":n.push(s.scene);break;default:r.push(s.scene)}}}t.length?t[0].visible=!0:n.length?n[0].visible=!0:r.length&&(r[0].visible=!0)}))},t.prototype.update=function(e,t,n){var r,i,o,a,s,c;if(this.children.length){var l=this.loaded;this.refined=null!==this.work,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=null!==this.work,this.bounding.makeEmpty();for(var u=0,p=this.children;u<p.length;u++){var d=p[u];d instanceof Tile3DModel&&(this.work&&(d.minLevelOfDetail=null!==(r=this.work.options.modelMinLevelOfDetail)&&void 0!==r?r:Tile3DModel.DEFAULT_MIN_LEVEL_OF_DETAIL,d.maxLevelOfDetail=0!==this.materialParameters.modelAlpha&&d.loaded?null!==(i=this.work.options.modelMaxLevelOfDetail)&&void 0!==i?i:Tile3DModel.DEFAULT_MAX_LEVEL_OF_DETAIL:0,d.maxScreenSpaceError=null!==(o=this.work.options.modelMaxScreenSpaceError)&&void 0!==o?o:Tile3DModel.DEFAULT_MAX_SCREEN_SPACE_ERROR,d.maxRequests=null!==(a=this.work.options.modelMaxRequests)&&void 0!==a?a:Tile3DModel.DEFAULT_MAX_REQUESTS,d.maxMemoryUsage=null!==(s=this.work.options.modelMaxMemoryUsage)&&void 0!==s?s:Tile3DModel.DEFAULT_MAX_MEMORY_USAGE,d.debug=null!==(c=this.work.options.debug)&&void 0!==c&&c,d.cacheCameras=this.cacheCameras,!1===this.autoRefine?d.needsRefined=!1:isFristPersonMode(n)?d.needsRefined=0===this.materialParameters.modelAlpha||1===this.materialParameters.modelAlpha:d.needsRefined=!0,this.work.options.transform.equals(d.matrix)||(d.matrix.copy(this.work.options.transform),d.matrix.decompose(d.position,d.quaternion,d.scale),d.matrixWorldNeedsUpdate=!0)),d.update(e,t),d.boundingBox.isEmpty()||(scratchBoundingBox.copy(d.boundingBox).applyMatrix4(d.matrix),this.bounding.union(scratchBoundingBox)),!0===d.needsRender&&(d.needsRender=!1,this.needsRender=!0),!1===d.refined&&(this.refined=!1),this.refineProgress[0]+=d.refineProgress[0],this.refineProgress[1]+=d.refineProgress[1],!1===d.loaded&&(this.loaded=!1))}this.bounding.isEmpty()&&this.bounding.copy(DEFAULT_BOUNDING),!1===l&&!0===this.loaded&&this.onLoad()}else this.work&&!this.work.model?(this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=!0):(this.refined=!1,this.refineProgress[0]=0,this.refineProgress[1]=0,this.loaded=!1),this.bounding.set(new THREE__namespace.Vector3,new THREE__namespace.Vector3)},t.prototype.dispose=function(){var e;for(this.disposed=!0;e=this.children[0];)e instanceof Tile3DModel&&e.dispose(),this.remove(e)},t}(THREE__namespace.Object3D);function createModels(){var e=new THREE__namespace.Box3,t=omit(defaultPbmParameters,["clippers","shownFloorIndex"]),n=Object.assign([],{bounding:e,needsRender:!1,refined:!1,refineProgress:[0,0],loaded:!1,materialVersion:0,cacheCameras:[],autoUpdate:!0,intersectRaycaster:function(e,t,r){var i;if(void 0===r&&(r=!0),1===n.length)i=n[0].intersectRaycaster(e,t,r);else if(0===n.length)i=[];else{i=[];for(var o=0,a=n;o<a.length;o++){var s=a[o];if(s.visible){var c=s.intersectRaycaster(e,t,!1);c.length&&i.push.apply(i,c)}}r&&i.sort((function(e,t){return e.distance-t.distance}))}return i},setMaterial:function(e){updatePBMParameters(t,e)&&(n.materialVersion++,n.needsRender=!0)},getMaterial:function(){return __assign({},t)},update:function(r,i,o){if(!1!==n.autoUpdate){n.refined=n.length>0,n.loaded=n.length>0,n.refineProgress[0]=0,n.refineProgress[1]=0,e.makeEmpty();for(var a=0,s=n.cacheCameras;a<s.length;a++){var c=s[a];c.updateMatrixWorld(!0),c.updateProjectionMatrix()}for(var l=0,u=n;l<u.length;l++){var p=u[l];p.setMaterial(t),p.cacheCameras=n.cacheCameras,p.update(r,i,o),!0===p.needsRender&&(n.needsRender=!0,p.needsRender=!1),!1===p.refined&&(n.refined=!1),n.refineProgress[0]+=p.refineProgress[0],n.refineProgress[1]+=p.refineProgress[1],!1===p.loaded&&(n.loaded=!1),e.union(p.bounding)}e.isEmpty()&&e.copy(DEFAULT_BOUNDING)}}});return n}function mixNumber(e,t,n){return e+(t-e)*n}function value(e,t,n,r){var i=(t*n+2*e)/Math.pow(n,3),o=-(2*t*n+3*e)/Math.pow(n,2),a=t,s=e;return i*Math.pow(r,3)+o*Math.pow(r,2)+a*r+s}function velocity(e,t,n,r){var i=(t*n+2*e)/Math.pow(n,3),o=-(2*t*n+3*e)/Math.pow(n,2),a=t;return 3*i*Math.pow(r,2)+2*o*r+a}function mixCircle(e,t,n,r){var i=r[1]-r[0];return e=circleValue(e,r),mixNumber((t=circleValue(t,r))-e>i/2?e+i:e-t>i/2?e-i:e,t,n)}function circleValue(e,t){var n=t[1]-t[0];return e<t[0]?circleValue(e+n,t):e>=t[1]?circleValue(e-n,t):e}function mixValue(e,t,n,r){return r?mixCircle(e,t,n,r):mixNumber(e,t,n)}var Motion=function(){function e(e){for(var t in this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=now(),this.startVelocity=0,this.duration=0,this.keyframes=[],e){var n=e[t];"number"==typeof n?(this.value[t]=n,this.config[t]={circle:!1}):(this.value[t]=n.value,this.config[t]={circle:n.circle})}this.keyframes=[{progress:0,value:__assign({},this.value)},{progress:1,value:__assign({},this.value)}]}return e.prototype.getProgress=function(e){var t=e-this.startTime;return t<0?0:t>=this.duration?1:1-value(1,this.startVelocity,this.duration,t)},e.prototype.getValue=function(e){for(var t=1;t<this.keyframes.length;t++)if(this.keyframes[t].progress>e){var n=this.keyframes[t-1],r=this.keyframes[t],i={};for(var o in this.config){var a=(e-n.progress)/(r.progress-n.progress);i[o]=mixValue(n.value[o],r.value[o],a,this.config[o].circle)}return i}return __assign({},this.keyframes[this.keyframes.length-1].value)},e.prototype.getProgressVelocity=function(e){var t=e-this.startTime;return t>=this.duration?0:velocity(1,this.startVelocity,this.duration,t)},e.prototype.update=function(e){return!!this.ended||(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},e.prototype.getKeyFrameSegment=function(e){for(var t=this.getProgress(e),n=1;n<this.keyframes.length;n++)if(this.keyframes[n].progress>t)return[this.keyframes[n-1],this.keyframes[n]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},e.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},e.prototype.set=function(e,t,n,r){var i;void 0===n&&(n=0),isNaN(t)&&(t=0),isNaN(n)&&(n=0),r=null!=r?r:now();var o=this.getProgress(r),a=this.getValue(o),s={};for(var c in this.config)s[c]=null!==(i=e[c])&&void 0!==i?i:a[c];var l=[{progress:0,value:a},{progress:1,value:s}];return this.setKeyframes(l,t,n,r)},e.prototype.setKeyframes=function(e,t,n,r){var i=this;if(void 0===n&&(n=0),e.length<2)throw new Error("keyframes invalid.");return isNaN(t)&&(t=0),isNaN(n)&&(n=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise((function(o,a){r=null!=r?r:now(),i.progress=0,i.ended=!1,i.startTime=r,i.startVelocity=n,i.keyframes=e,i.duration=t,0===t?(i.progress=1,i.value=__assign({},e[e.length-1].value)):i.value=__assign({},e[0].value),i.callbacks=[o,a]}))},e.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},e}(),easeOut$2=function(e){return e*(2-e)},sharedGeometry2$2=function(){var e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),r=new THREE__namespace.BufferGeometry;return r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.setAttribute("uv",new THREE__namespace.BufferAttribute(t,2)),r.setIndex(new THREE__namespace.BufferAttribute(n,1)),r}(),vertexShader$5="\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader$5="\nuniform vec3 baseColor;\nuniform float circleScale;\nuniform float ringScale;\nuniform float ringOpacity;\nuniform float loadingAngle;\nuniform float loadingOpacity;\nuniform float progress;\nuniform float progressOpacity;\nuniform float expand0;\nuniform float expand1;\nuniform float expandOpacity;\nuniform float opacity;\nuniform float tapScale;\nuniform float tapOpacity;\nuniform float disable;\nvarying vec2 vUv;\n\n#define PI 3.141592653589793\n#define TAU 6.283185307179586\n#define SMOOTH_DIST 0.017\n#define CENTER vec2(0.5, 0.5)\n\nfloat inside(float innerDist) {\n float dist = length(CENTER - vUv);\n return smoothstep(innerDist, innerDist + SMOOTH_DIST, dist);\n}\nfloat outside(float outerDist) {\n float dist = length(CENTER - vUv);\n return 1.0 - smoothstep(outerDist - SMOOTH_DIST, outerDist, dist);\n}\n\nvec4 create_circle() {\n float dist = length(CENTER - vUv);\n float gradient = clamp(0.8 + abs(dot(normalize(vec2(1.0, -1.0)), vUv - CENTER)) * 1.5, 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * tapOpacity * inside(0.15 * circleScale * tapScale) * outside(0.234 * circleScale * tapScale));\n}\n\nvec4 create_disable() {\n float dist = length(CENTER - vUv);\n return vec4(1.0, 1.0, 1.0, 0.5 * tapOpacity * outside(0.32 * circleScale * tapScale));\n}\n\nvec4 create_ring() {\n float gradient = clamp(0.5 + abs(dot(normalize(vec2(1.0, 1.0)), vUv - CENTER)), 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * tapOpacity * ringOpacity * inside(0.27 * ringScale * tapScale) * outside(0.32 * ringScale * tapScale));\n}\n\nvec4 create_loading() {\n float angle = PI - atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n angle = mod(angle + loadingAngle, TAU);\n float gradient = (1.0 - smoothstep(0.0, TAU, angle)) * 0.4 + 0.1;\n return vec4(1.0, 1.0, 1.0, gradient * tapOpacity * loadingOpacity * inside(0.208 * circleScale * tapScale) * outside(0.3 * circleScale * tapScale));\n}\n\nvec4 create_progress() {\n float angle = PI + atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n float bar = (1.0 - step(progress * TAU, angle)) * 0.5;\n return vec4(1.0, 1.0, 1.0, bar * tapOpacity * progressOpacity * inside(0.208 * circleScale * tapScale) * outside(0.3 * circleScale * tapScale));\n}\n\nvec4 create_expand0() {\n float width = 0.2;\n float radius = 0.2 + (0.43 - 0.2) * expand0;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand0 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * expandOpacity * outside(radius));\n}\n\nvec4 create_expand1() {\n float width = 0.2;\n float radius = 0.2 + (0.43 - 0.2) * expand1;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand1 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * expandOpacity * outside(radius));\n}\n\nvoid main() {\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0);\n\n vec4 expand1Color = create_expand1();\n gl_FragColor = mix(gl_FragColor, expand1Color, expand1Color.a);\n\n vec4 expand0Color = create_expand0();\n gl_FragColor = mix(gl_FragColor, expand0Color, expand0Color.a);\n\n vec4 progressColor = create_progress();\n gl_FragColor = mix(gl_FragColor, progressColor, progressColor.a);\n\n vec4 loadingColor = create_loading();\n gl_FragColor = mix(gl_FragColor, loadingColor, loadingColor.a);\n\n vec4 circleColor = create_circle();\n gl_FragColor = mix(gl_FragColor, circleColor, circleColor.a);\n\n vec4 ringColor = create_ring();\n gl_FragColor = mix(gl_FragColor, ringColor, ringColor.a);\n\n gl_FragColor = mix(gl_FragColor, create_disable(), disable);\n\n gl_FragColor = vec4(gl_FragColor.rgb * baseColor, gl_FragColor.a * opacity * opacity);\n}\n",PanoCircleMesh=function(e){function t(t){var n,r;void 0===t&&(t={});var i=e.call(this)||this,o=null!==(n=t.color)&&void 0!==n?n:16777215,a=null!==(r=t.scale)&&void 0!==r?r:1;return i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.currentMotion=new Motion({progress:0}),i.ringMotion=new Motion({scale:1,opacity:1}),i.tapMotion=new Motion({scale:1,opacity:1}),i.loadingOpacityMotion=new Motion({opacity:0}),i.progressMotion=new Motion({progress:0}),i.progressOpacityMotion=new Motion({opacity:0}),i.opacityMotion=new Motion({opacity:0}),i.disableMotion=new Motion({progress:0}),i.panoMesh=new THREE__namespace.Mesh(sharedGeometry2$2,new THREE__namespace.ShaderMaterial({blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,vertexShader:vertexShader$5,fragmentShader:fragmentShader$5,uniforms:{baseColor:{value:new THREE__namespace.Color(o)},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}}})),i.renderOrder=-2,i.panoMesh.renderOrder=-2,i.panoMesh.position.y=.004,i.panoMesh.scale.set(a,1,a),i.add(i.panoMesh),i.currentStartTime=now(),i.needsRender=!0,i}return __extends(t,e),t.prototype.setProgress=function(e){var t=this;this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=clamp(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},500).catch(noop$1),0===e?this.progressOpacityMotion.set({opacity:0},500).catch(noop$1).then((function(){t.progressMotion.set({progress:0},0).catch(noop$1)})):this.progressMotion.set({progress:clamp(1.2*e,0,1)},100).catch(noop$1)),this.progress=e)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp(e,0,1),this.opacityMotion.set({opacity:e},200).catch(noop$1))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(noop$1),this.current=e,!0===this.current&&(this.currentStartTime=now()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(noop$1))},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(noop$1))},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();return this.progressOpacityMotion.set({opacity:0},0).catch(noop$1),this.progressMotion.set({progress:0},0).catch(noop$1),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((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(noop$1),e.progressMotion.set({progress:e.progress},120).catch(noop$1)})).catch(noop$1)},t.prototype.updateTime=function(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);var n=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=n,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var r=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=r,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);r=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=r,this.needsRender=!0}if(this.visible=0!==this.opacityMotion.value.opacity,(!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%(2*Math.PI),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;var i=(e-this.currentStartTime-1500)/2e3;if(i%5<2){var o=1+Math.sin(Math.PI*i)/25*this.currentMotion.value.progress;this.panoMesh.material.uniforms.circleScale.value=o,this.needsRender=!0}var a=(e-this.currentStartTime-1500)/2e3;if(a%5<2){var s=a%1;this.panoMesh.material.uniforms.expand0.value=easeOut$2(s)*this.currentMotion.value.progress,this.needsRender=!0}var c=(e-this.currentStartTime-1e3)/2e3;if(c%5<2){s=c%1;this.panoMesh.material.uniforms.expand1.value=easeOut$2(s)*this.currentMotion.value.progress,this.needsRender=!0}}this.currentMotion.value.progress>.2&&0===this.progress&&!1===this.loading?(e-this.currentStartTime-1e3)/2e3%5<2?.8!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:.8,opacity:0},600).catch(noop$1):1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},600).catch(noop$1):1!==this.ringMotion.getTargetKeyframe().value.scale&&this.ringMotion.set({scale:1,opacity:1},600).catch(noop$1);if(!this.ringMotion.ended){var l=this.ringMotion.value;o=l.scale,r=l.opacity;this.ringMotion.update(e),this.panoMesh.material.uniforms.ringScale.value=o,this.panoMesh.material.uniforms.ringOpacity.value=r,this.needsRender=!0}if(!this.disableMotion.ended){n=this.disableMotion.value.progress;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=n,this.needsRender=!0}},t.prototype.dispose=function(){this.ringMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()},t}(THREE__namespace.Object3D),easeOut$1=function(e){return e*(2-e)},sharedGeometry2$1=function(){var e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),r=new THREE__namespace.BufferGeometry;return r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.setAttribute("uv",new THREE__namespace.BufferAttribute(t,2)),r.setIndex(new THREE__namespace.BufferAttribute(n,1)),r}(),vertexShader$4="\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader$4="\nuniform vec3 baseColor;\nuniform float circleScale;\nuniform float circleOpacity;\nuniform float loadingAngle;\nuniform float loadingOpacity;\nuniform float progress;\nuniform float progressOpacity;\nuniform float expand0;\nuniform float expand1;\nuniform float expandOpacity;\nuniform float opacity;\nuniform float tapScale;\nuniform float tapOpacity;\nuniform float disable;\nvarying vec2 vUv;\n\n#define PI 3.141592653589793\n#define TAU 6.283185307179586\n#define SMOOTH_DIST 0.017\n#define CENTER vec2(0.5, 0.5)\n\nfloat inside(float innerDist) {\n float dist = length(CENTER - vUv);\n return smoothstep(innerDist, innerDist + SMOOTH_DIST, dist);\n}\nfloat outside(float outerDist) {\n float dist = length(CENTER - vUv);\n return 1.0 - smoothstep(outerDist - SMOOTH_DIST, outerDist, dist);\n}\n\nvec4 create_circle() {\n float dist = length(CENTER - vUv);\n return vec4(1.0, 1.0, 1.0, 0.8 * circleOpacity * tapOpacity * inside(0.2 * circleScale * tapScale) * outside(0.3 * circleScale * tapScale));\n}\n\nvec4 create_disable() {\n float dist = length(CENTER - vUv);\n return vec4(1.0, 1.0, 1.0, 0.5 * tapOpacity * outside(0.32 * circleScale * tapScale));\n}\n\nvec4 create_loading() {\n float angle = PI - atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n angle = mod(angle + loadingAngle, TAU);\n float gradient = (1.0 - smoothstep(0.0, TAU, angle)) * 0.9 + 0.1;\n return vec4(1.0, 1.0, 1.0, gradient * tapOpacity * loadingOpacity * inside(0.2 * circleScale * tapScale) * outside(0.3 * circleScale * tapScale));\n}\n\nvec4 create_progress() {\n float angle = PI + atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n float bar = (1.0 - step(progress * TAU, angle)) * 0.7;\n return vec4(1.0, 1.0, 1.0, bar * tapOpacity * progressOpacity * inside(0.2 * circleScale * tapScale) * outside(0.3 * circleScale * tapScale));\n}\n\nvec4 create_expand0() {\n float width = 0.2;\n float radius = 0.25 + (0.5 - 0.25) * expand0;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand0 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * expandOpacity * outside(radius));\n}\n\nvec4 create_expand1() {\n float width = 0.2;\n float radius = 0.25 + (0.48 - 0.25) * expand1;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand1 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(1.0, 1.0, 1.0, gradient * expandOpacity * outside(radius));\n}\n\nvoid main() {\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0);\n\n vec4 expand1Color = create_expand1();\n gl_FragColor = mix(gl_FragColor, expand1Color, expand1Color.a);\n\n vec4 expand0Color = create_expand0();\n gl_FragColor = mix(gl_FragColor, expand0Color, expand0Color.a);\n\n vec4 circleColor = create_circle();\n gl_FragColor = mix(gl_FragColor, circleColor, circleColor.a);\n\n vec4 progressColor = create_progress();\n gl_FragColor = mix(gl_FragColor, progressColor, progressColor.a);\n\n vec4 loadingColor = create_loading();\n gl_FragColor = mix(gl_FragColor, loadingColor, loadingColor.a);\n\n gl_FragColor = mix(gl_FragColor, create_disable(), disable);\n\n gl_FragColor = vec4(gl_FragColor.rgb * baseColor, gl_FragColor.a * opacity * opacity);\n}\n",PanoCircleMeshSolid=function(e){function t(t){var n,r;void 0===t&&(t={});var i=e.call(this)||this,o=null!==(n=t.color)&&void 0!==n?n:16777215,a=null!==(r=t.scale)&&void 0!==r?r:1;return i.progress=0,i.opacity=0,i.loading=!1,i.current=!1,i.disabled=!1,i.currentMotion=new Motion({progress:0}),i.tapMotion=new Motion({scale:1,opacity:1}),i.loadingOpacityMotion=new Motion({opacity:0}),i.progressMotion=new Motion({progress:0}),i.progressOpacityMotion=new Motion({opacity:0}),i.opacityMotion=new Motion({opacity:0}),i.disableMotion=new Motion({progress:0}),i.panoMesh=new THREE__namespace.Mesh(sharedGeometry2$1,new THREE__namespace.ShaderMaterial({blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,vertexShader:vertexShader$4,fragmentShader:fragmentShader$4,uniforms:{baseColor:{value:new THREE__namespace.Color(o)},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}}})),i.renderOrder=-2,i.panoMesh.renderOrder=-2,i.panoMesh.position.y=.004,i.panoMesh.scale.set(a,1,a),i.add(i.panoMesh),i.currentStartTime=now(),i.needsRender=!0,i}return __extends(t,e),t.prototype.setProgress=function(e){var t=this;this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=clamp(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},500).catch(noop$1),0===e?this.progressOpacityMotion.set({opacity:0},500).catch(noop$1).then((function(){t.progressMotion.set({progress:0},0).catch(noop$1)})):this.progressMotion.set({progress:clamp(1.2*e,0,1)},100).catch(noop$1)),this.progress=e)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp(e,0,1),this.opacityMotion.set({opacity:e},200).catch(noop$1))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(noop$1),this.current=e,!0===this.current&&(this.currentStartTime=now()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(noop$1))},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(noop$1))},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();return this.progressOpacityMotion.set({opacity:0},0).catch(noop$1),this.progressMotion.set({progress:0},0).catch(noop$1),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((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(noop$1),e.progressMotion.set({progress:e.progress},120).catch(noop$1)})).catch(noop$1)},t.prototype.updateTime=function(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);var n=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=n,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var r=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=r,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);r=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=r,this.needsRender=!0}if(this.visible=0!==this.opacityMotion.value.opacity,(!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%(2*Math.PI),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;var i=(e-this.currentStartTime-1500)/2e3;if(i%5<2){var o=1+Math.sin(Math.PI*i)/25*this.currentMotion.value.progress;this.panoMesh.material.uniforms.circleScale.value=o,this.needsRender=!0}var a=(e-this.currentStartTime-1500)/2e3;if(a%5<2){var s=a%1;this.panoMesh.material.uniforms.expand0.value=easeOut$1(s)*this.currentMotion.value.progress,this.needsRender=!0}var c=(e-this.currentStartTime-1e3)/2e3;if(c%5<2){s=c%1;this.panoMesh.material.uniforms.expand1.value=easeOut$1(s)*this.currentMotion.value.progress,this.needsRender=!0}}if(!this.disableMotion.ended){n=this.disableMotion.value.progress;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=n,this.needsRender=!0}},t.prototype.dispose=function(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()},t}(THREE__namespace.Object3D),easeOut=function(e){return e*(2-e)},sharedGeometry2=function(){var e=new Float32Array([-.18,0,-.18,.18,0,-.18,-.18,0,.18,.18,0,.18]),t=new Float32Array([1,0,0,0,1,1,0,1]),n=new Uint8Array([0,2,1,2,3,1]),r=new THREE__namespace.BufferGeometry;return r.setAttribute("position",new THREE__namespace.BufferAttribute(e,3)),r.setAttribute("uv",new THREE__namespace.BufferAttribute(t,2)),r.setIndex(new THREE__namespace.BufferAttribute(n,1)),r}(),vertexShader$3="\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader$3="\n#if defined(USE_MAP)\nuniform sampler2D map;\nuniform float mapAlpha;\n#endif\n#if defined(USE_BORDER)\nuniform float borderWidth;\nuniform vec3 borderColor;\n#endif\nuniform vec3 baseColor;\nuniform float circleScale;\nuniform float circleOpacity;\nuniform float loadingAngle;\nuniform float loadingOpacity;\nuniform float progress;\nuniform float progressOpacity;\nuniform float expand0;\nuniform float expand1;\nuniform float expandOpacity;\nuniform float opacity;\nuniform float tapScale;\nuniform float tapOpacity;\nuniform float disable;\nvarying vec2 vUv;\n\n#define PI 3.141592653589793\n#define TAU 6.283185307179586\n#define SMOOTH_DIST 0.017\n#define CENTER vec2(0.5, 0.5)\n\nfloat inside(float innerDist) {\n float dist = length(CENTER - vUv);\n return smoothstep(innerDist, innerDist + SMOOTH_DIST, dist);\n}\nfloat outside(float outerDist) {\n float dist = length(CENTER - vUv);\n return 1.0 - smoothstep(outerDist - SMOOTH_DIST, outerDist, dist);\n}\n\nvec4 create_circle() {\n float dist = length(CENTER - vUv);\n float radius = 0.3 * circleScale * tapScale;\n #if defined(USE_MAP)\n float delta = radius / 0.5;\n vec2 deltaUv = (vUv - CENTER) / delta + CENTER;\n vec4 image = texture2D(map, deltaUv);\n image.a = image.a * mapAlpha;\n #if defined(USE_COLOR)\n image = vec4(baseColor, 1.0) * image;\n #endif\n #endif\n #if defined(USE_REVERSE)\n image = vec4(baseColor, 1.0 - image.a);\n #else\n #if defined(USE_BORDER)\n float borderDist = clamp(borderWidth, 0.0, 1.0);\n float clipAlpha = inside(radius - borderDist * radius);\n float gradient = clamp(borderWidth * 2.0 + abs(dot(normalize(vec2(1.0, -1.0)), vUv - CENTER)), 0.0, 1.0);\n vec4 borderColor = vec4(borderColor, clipAlpha * gradient);\n image = mix(borderColor, image, image.a);\n #endif\n #endif\n return vec4(image.rgb, image.a * circleOpacity * tapOpacity * outside(radius));\n}\n\nvec4 create_disable() {\n float dist = length(CENTER - vUv);\n return vec4(baseColor, 0.5 * tapOpacity * outside(0.32 * circleScale * tapScale));\n}\n\nvec4 create_loading() {\n float angle = PI - atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n angle = mod(angle + loadingAngle, TAU);\n float gradient = (1.0 - smoothstep(0.0, TAU, angle)) * 0.9 + 0.1;\n float radius = 0.3 * circleScale * tapScale;\n float inner = inside(radius - 0.2 * radius);\n #if defined(USE_BORDER)\n float borderDist = clamp(borderWidth, 0.0, 1.0);\n inner = inside(radius - borderDist * radius);\n #endif\n return vec4(baseColor, gradient * tapOpacity * loadingOpacity * inner * outside(radius));\n}\n\nvec4 create_progress() {\n float angle = PI + atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n float bar = (1.0 - step(progress * TAU, angle)) * 0.7;\n float radius = 0.3 * circleScale * tapScale;\n float inner = inside(radius - 0.2 * radius);\n #if defined(USE_BORDER)\n float borderDist = clamp(borderWidth, 0.0, 1.0);\n inner = inside(radius - borderDist * radius);\n #endif\n return vec4(baseColor, bar * tapOpacity * progressOpacity * inner * outside(radius));\n}\n\nvec4 create_expand0() {\n float width = 0.2;\n float radius = 0.25 + (0.5 - 0.25) * expand0;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand0 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(baseColor, gradient * expandOpacity * outside(radius));\n}\n\nvec4 create_expand1() {\n float width = 0.2;\n float radius = 0.25 + (0.48 - 0.25) * expand1;\n float dist = length(CENTER - vUv);\n float gradient = (1.0 - clamp((radius - dist) / width, 0.0, 1.0)) * 0.8 * clamp((1.0 - abs(expand1 - 0.5) * 2.0) * 1.2, 0.0, 1.0);\n return vec4(baseColor, gradient * expandOpacity * outside(radius));\n}\n\nvoid main() {\n gl_FragColor = vec4(baseColor, 0);\n\n vec4 expand1Color = create_expand1();\n gl_FragColor = mix(gl_FragColor, expand1Color, expand1Color.a);\n\n vec4 expand0Color = create_expand0();\n gl_FragColor = mix(gl_FragColor, expand0Color, expand0Color.a);\n\n vec4 circleColor = create_circle();\n gl_FragColor = mix(gl_FragColor, circleColor, circleColor.a);\n\n vec4 progressColor = create_progress();\n gl_FragColor = mix(gl_FragColor, progressColor, progressColor.a);\n\n vec4 loadingColor = create_loading();\n gl_FragColor = mix(gl_FragColor, loadingColor, loadingColor.a);\n\n gl_FragColor = mix(gl_FragColor, create_disable(), disable);\n\n gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);\n}\n",PanoCircleMeshCustom=function(e){function t(t){var n,r,i,o,a,s,c;void 0===t&&(t={});var l=e.call(this)||this,u=null!==(n=t.color)&&void 0!==n?n:16777215,p=null!==(r=t.scale)&&void 0!==r?r:1,d=t.map,h=null!==(i=t.mapAlpha)&&void 0!==i?i:1,f=null!==(o=t.mapUseColor)&&void 0!==o&&o,m=null!==(a=t.mapUseReverse)&&void 0!==a&&a,v=null!==(s=t.borderWidth)&&void 0!==s?s:.1,A=null!==(c=t.borderColor)&&void 0!==c?c:16777215;return l.progress=0,l.opacity=0,l.loading=!1,l.current=!1,l.disabled=!1,l.currentMotion=new Motion({progress:0}),l.tapMotion=new Motion({scale:1,opacity:1}),l.loadingOpacityMotion=new Motion({opacity:0}),l.progressMotion=new Motion({progress:0}),l.progressOpacityMotion=new Motion({opacity:0}),l.opacityMotion=new Motion({opacity:0}),l.disableMotion=new Motion({progress:0}),l.panoMesh=new THREE__namespace.Mesh(sharedGeometry2,new THREE__namespace.ShaderMaterial({blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,vertexShader:vertexShader$3,fragmentShader:fragmentShader$3,defines:{USE_COLOR:f,USE_MAP:void 0!==d,USE_BORDER:v>0,USE_REVERSE:m},uniforms:{baseColor:{value:new THREE__namespace.Color(u)},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:h},borderWidth:{value:v},borderColor:{value:new THREE__namespace.Color(A)}}})),l.renderOrder=-2,l.panoMesh.renderOrder=-2,l.panoMesh.position.y=.004,l.panoMesh.scale.set(p,1,p),l.add(l.panoMesh),l.currentStartTime=now(),l.needsRender=!0,l}return __extends(t,e),t.prototype.setProgress=function(e){var t=this;this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=clamp(e,0,1),this.tapMotion.ended&&(0===this.progress&&this.progressOpacityMotion.set({opacity:1},500).catch(noop$1),0===e?this.progressOpacityMotion.set({opacity:0},500).catch(noop$1).then((function(){t.progressMotion.set({progress:0},0).catch(noop$1)})):this.progressMotion.set({progress:clamp(1.2*e,0,1)},100).catch(noop$1)),this.progress=e)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp(e,0,1),this.opacityMotion.set({opacity:e},200).catch(noop$1))},t.prototype.setCurrent=function(e){this.current!==e&&(this.currentMotion.set({progress:e?1:0},2e3).catch(noop$1),this.current=e,!0===this.current&&(this.currentStartTime=now()))},t.prototype.setLoading=function(e){this.loading!==e&&(this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:e?1:0},500).catch(noop$1))},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMotion.set({progress:e?1:0},500).catch(noop$1))},t.prototype.tap=function(){var e=this;if(!this.tapMotion.ended)return Promise.resolve();return this.progressOpacityMotion.set({opacity:0},0).catch(noop$1),this.progressMotion.set({progress:0},0).catch(noop$1),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((function(){e.progressOpacityMotion.set({opacity:e.progress>0?1:0},300).catch(noop$1),e.progressMotion.set({progress:e.progress},120).catch(noop$1)})).catch(noop$1)},t.prototype.updateTime=function(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);var n=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=n,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);var r=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=r,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);r=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=r,this.needsRender=!0}if(this.visible=0!==this.opacityMotion.value.opacity,(!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%(2*Math.PI),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;var i=(e-this.currentStartTime-1500)/2e3;if(i%5<2){var o=i%1;this.panoMesh.material.uniforms.expand0.value=easeOut(o)*this.currentMotion.value.progress,this.needsRender=!0}var a=(e-this.currentStartTime-1e3)/2e3;if(a%5<2){o=a%1;this.panoMesh.material.uniforms.expand1.value=easeOut(o)*this.currentMotion.value.progress,this.needsRender=!0}}if(!this.disableMotion.ended){n=this.disableMotion.value.progress;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=n,this.needsRender=!0}},t.prototype.dispose=function(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()},t}(THREE__namespace.Object3D),sharedGeometry$3=new THREE__namespace.CircleBufferGeometry(.1,16),vertexShader$2="\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader$2="\nvarying vec2 vUv;\n\nfloat smoothDist = 0.01;\nvoid main() {\n vec2 center = vec2(0.5, 0.5);\n float dist = length(center - vUv);\n float outerDist = 0.49;\n float innerDist = 0.29;\n\n float outside = 1.0 - smoothstep(outerDist - smoothDist, outerDist, dist);\n float inside = smoothstep(innerDist, innerDist + smoothDist, dist);\n\n vec4 bg = vec4(0.576, 0.635, 1.0, 0.3);\n float gradientAlpha = clamp(abs(dist - (outerDist + innerDist) / 2.0) / (outerDist - innerDist) * 1.5 + 0.1, 0.0, 1.0);\n vec4 gradient = vec4(1.0, 1.0, 1.0, gradientAlpha);\n\n gl_FragColor = mix(bg, gradient, gradient.a);\n\n gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * outside * inside);\n}\n",sharedMaterial=new THREE__namespace.ShaderMaterial({vertexShader:vertexShader$2,fragmentShader:fragmentShader$2,transparent:!0}),IntersectMesh=function(e){function t(){var t=e.call(this)||this;return t.ringMesh=new THREE__namespace.Mesh(sharedGeometry$3,sharedMaterial),t.ringMesh.renderOrder=-2,t.add(t.ringMesh),t}return __extends(t,e),t.prototype.dispose=function(){this.remove(this.ringMesh)},t}(THREE__namespace.Object3D);function S4(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function createUuid(){return(S4()+S4()+"-"+S4()+"-4"+S4().substr(0,3)+"-"+S4()+"-"+S4()+S4()+S4()).toLowerCase()}function isSimilarValue(e,t,n){var r=Math.abs(e-t);return r<.001||void 0!==n&&Math.abs(n-r)<.001}function notSimilarValue(e,t,n){return!isSimilarValue(e,t,n)}function isSimilarVector3(e,t){return e.distanceTo(t)<.001}function notSimilarVector3(e,t){return!isSimilarVector3(e,t)}var DEFAULT_OFFSET_VECTOR=new THREE__namespace.Vector3(0,0,0),BoundingMesh=function(e){function t(t,n){void 0===n&&(n=DEFAULT_OFFSET_VECTOR);var r=e.call(this)||this,i=new THREE__namespace.BoxBufferGeometry(t.max.x-t.min.x+2*n.x,t.max.y-t.min.y+2*n.y,t.max.z-t.min.z+2*n.z,1,1);i.clearGroups(),i.addGroup(0,i.index?i.index.count:i.attributes.position.count,0),i.applyMatrix4((new THREE__namespace.Matrix4).makeScale(-1,1,1)),i.computeVertexNormals();var o=new PBMMeshMaterial;o.defines.USE_MAP=!1,o.defines.USE_UV=!1,o.defines.USE_PANO_OPACITY=!0,o.uniforms.diffuse.value=new THREE__namespace.Color(10066329),o.depthWrite=!1;var a=new PBMMesh(i,[o]);return a.position.copy(t.getCenter(new THREE__namespace.Vector3)),a.frustumCulled=!1,r.add(a),r.boundingBox=new THREE__namespace.Box3,r.boundingBox.setFromObject(r),r.renderOrder=a.renderOrder=-1001,r}return __extends(t,e),t}(PBMContainer);function generateBoundingMesh(e,t){return void 0===t&&(t=DEFAULT_OFFSET_VECTOR),new BoundingMesh(e,t)}function cameraWorldToLocal(e,t){var n=new THREE__namespace.Vector3(0,0,-1);n.applyQuaternion(e.quaternion);var r=t.quaternion.clone().inverse();return n.applyQuaternion(r),{theta:Math.atan2(n.x,-n.z),phi:-Math.asin(n.y),lookAtVector:n}}var TAU$1=2*Math.PI;function formatRad(e){return e>=0&&e<TAU$1?e:(e%TAU$1+TAU$1)%TAU$1}var PI=Math.PI,TAU=2*PI;function stepNumber(e,t,n){if(e===t)return t;var r=t-e;return Math.abs(r)<=n?t:e+(r>0?1:-1)*n}function stepVector(e,t,n){if(e.equals(t))return(new THREE__namespace.Vector3).copy(t);var r=(new THREE__namespace.Vector3).subVectors(t,e);return r.lengthSq()<n*n?r.copy(t):r.setLength(n).add(e)}function stepCoordinates(e,t,n){if(e.longitude===t.longitude&&e.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};var r=formatRad(e.longitude),i=e.latitude,o=formatRad(t.longitude),a=t.latitude;o-r>PI?r+=TAU:r-o>PI&&(r-=TAU);var s=n/Math.sqrt(Math.pow(o-r,2)+Math.pow(a-i,2));return s>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(o-r)*s,latitude:i+(a-i)*s}}function isPromise(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}!function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(error){return!1}}();var isMobile=function(){var e="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"node";return/android/i.test(e)||/webos/i.test(e)||/ipad|iphone|ipod/i.test(e)||/iemobile/i.test(e)||/opera mini/i.test(e)||/blackberry/i.test(e)||/windows phone/i.test(e)};function createEvent(e,t){for(var n=!1,r={type:e,timeStamp:now(),get defaultPrevented(){return n},preventDefault:function(){n=!0}},i=0,o=Object.keys(t);i<o.length;i++){var a=o[i];a in r||(r[a]=t[a])}return r}function requestDeviceOrientationPermission(){return"undefined"==typeof location||"https:"!==location.protocol?Promise.reject(new Error("Request DeviceOrientation Permission denied.")):"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){if("granted"==e)return Promise.resolve();var t=new Error("Request DeviceOrientation Permission denied.");return Promise.reject(t)})):Promise.resolve()}function requestXRSessionPermission(){if("xr"in navigator)return navigator.xr.isSessionSupported("immersive-vr").then((function(e){return e?Promise.resolve():Promise.reject()})).then((function(){return navigator.xr.requestSession("immersive-vr",{optionalFeatures:["local-floor","bounded-floor"]}).then((function(e){return Promise.resolve(e)}))}));var e=new Error("Request XR Permission denied.");return Promise.reject(e)}function assignState(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 stateEqual(e,t){return e.workCode===t.workCode&&e.mode===t.mode&&e.panoIndex===t.panoIndex&&isSimilarValue(e.longitude,t.longitude,2*Math.PI)&&isSimilarValue(e.latitude,t.latitude)&&isSimilarValue(e.fov,t.fov)&&isSimilarVector3(e.offset,t.offset)&&isSimilarValue(e.distance,t.distance)}var defaultIterator=function(e){return Number(e)};function arrayMin(e,t,n){var r;void 0===t&&(t=defaultIterator),void 0===n&&(n=!1);for(var i,o=1/0,a=0,s=e;a<s.length;a++){var c=s[a],l=t(c);l<=o&&(i=(r=[c,l])[0],o=r[1])}return isFinite(o)||(o=0),n?[i,o]:i}function isEmptyObject(e){for(var t in e)return!1;return!0}function clonePose(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}
|
|
353
|
+
/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
354
|
+
* http://hammerjs.github.io/
|
|
355
|
+
*
|
|
356
|
+
* Copyright (c) 2016 Jorik Tangelder;
|
|
357
|
+
* Licensed under the MIT license */var Hammer=function(e,t,n,r){var i,o=["","webkit","Moz","MS","ms","o"],a=t.createElement?t.createElement("div"):r,s="function",c=Math.round,l=Math.abs,u=Date.now;function p(e,t,n){return setTimeout(g(e,n),t)}function d(e,t,n){return!!Array.isArray(e)&&(h(e,n[t],n),!0)}function h(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 f(t,n,r){var i="DEPRECATED METHOD: "+n+"\n"+r+" AT \n";return function(){var n=new 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",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,i,r),t.apply(this,arguments)}}i="function"!=typeof Object.assign?function(e){if(e===r||null===e)throw new 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&&null!==i)for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])}return t}:Object.assign;var m=f((function(e,t,n){for(var i=Object.keys(t),o=0;o<i.length;)(!n||n&&e[i[o]]===r)&&(e[i[o]]=t[i[o]]),o++;return e}),"extend","Use `assign`."),v=f((function(e,t){return m(e,t,!0)}),"merge","Use `assign`.");function A(e,t,n){var r,o=t.prototype;(r=e.prototype=Object.create(o)).constructor=e,r._super=o,n&&i(r,n)}function g(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return typeof e==s?e.apply(t&&t[0]||r,t):e}function b(e,t){return e===r?t:e}function E(e,t,n){h(R(t),(function(t){e.addEventListener(t,n,!1)}))}function _(e,t,n){h(R(t),(function(t){e.removeEventListener(t,n,!1)}))}function T(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function x(e,t){return e.indexOf(t)>-1}function R(e){return e.trim().split(/\s+/g)}function w(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 M(e){return Array.prototype.slice.call(e,0)}function S(e,t,n){for(var r=[],i=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];w(i,a)<0&&r.push(e[o]),i[o]=a,o++}return n&&(r=t?r.sort((function(e,n){return e[t]>n[t]})):r.sort()),r}function C(e,t){for(var n,i,a=t[0].toUpperCase()+t.slice(1),s=0;s<o.length;){if((i=(n=o[s])?n+a:t)in e)return i;s++}return r}var I=1;function P(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var B="ontouchstart"in e,O=C(e,"PointerEvent")!==r,k=B&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),H="touch",F="mouse",L=25,D=1,N=4,V=8,U=1,Q=2,z=4,j=8,q=16,G=Q|z,K=j|q,W=G|K,X=["x","y"],J=["clientX","clientY"];function Y(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()}function Z(e,t,n){var i=n.pointers.length,o=n.changedPointers.length,a=t&D&&i-o==0,s=t&(N|V)&&i-o==0;n.isFirst=!!a,n.isFinal=!!s,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,i=t.pointers,o=i.length;n.firstInput||(n.firstInput=$(t));o>1&&!n.firstMultiple?n.firstMultiple=$(t):1===o&&(n.firstMultiple=!1);var a=n.firstInput,s=n.firstMultiple,c=s?s.center:a.center,p=t.center=ee(i);t.timeStamp=u(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=ie(c,p),t.distance=re(c,p),function(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},o=e.prevInput||{};t.eventType!==D&&o.eventType!==N||(i=e.prevDelta={x:o.deltaX||0,y:o.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)}(n,t),t.offsetDirection=ne(t.deltaX,t.deltaY);var d=te(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=l(d.x)>l(d.y)?d.x:d.y,t.scale=s?(h=s.pointers,f=i,re(f[0],f[1],J)/re(h[0],h[1],J)):1,t.rotation=s?function(e,t){return ie(t[1],t[0],J)+ie(e[1],e[0],J)}(s.pointers,i):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,i,o,a,s=e.lastInterval||t,c=t.timeStamp-s.timeStamp;if(t.eventType!=V&&(c>L||s.velocity===r)){var u=t.deltaX-s.deltaX,p=t.deltaY-s.deltaY,d=te(c,u,p);i=d.x,o=d.y,n=l(d.x)>l(d.y)?d.x:d.y,a=ne(u,p),e.lastInterval=t}else n=s.velocity,i=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=n,t.velocityX=i,t.velocityY=o,t.direction=a}(n,t);var h,f;var m=e.element;T(t.srcEvent.target,m)&&(m=t.srcEvent.target);t.target=m}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function $(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:c(e.pointers[n].clientX),clientY:c(e.pointers[n].clientY)},n++;return{timeStamp:u(),pointers:t,center:ee(t),deltaX:e.deltaX,deltaY:e.deltaY}}function ee(e){var t=e.length;if(1===t)return{x:c(e[0].clientX),y:c(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:c(n/t),y:c(r/t)}}function te(e,t,n){return{x:t/e||0,y:n/e||0}}function ne(e,t){return e===t?U:l(e)>=l(t)?e<0?Q:z:t<0?j:q}function re(e,t,n){n||(n=X);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function ie(e,t,n){n||(n=X);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return 180*Math.atan2(i,r)/Math.PI}Y.prototype={handler:function(){},init:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(P(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(P(this.element),this.evWin,this.domHandler)}};var oe={mousedown:D,mousemove:2,mouseup:N},ae="mousedown",se="mousemove mouseup";function ce(){this.evEl=ae,this.evWin=se,this.pressed=!1,Y.apply(this,arguments)}A(ce,Y,{handler:function(e){var t=oe[e.type];t&D&&(0===e.button||2===e.button)&&(this.pressed=!0),2&t&&1!==e.which&&(t=N),this.pressed&&(t&N&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:F,srcEvent:e}))}});var le={pointerdown:D,pointermove:2,pointerup:N,pointercancel:V,pointerout:V},ue={2:H,3:"pen",4:F,5:"kinect"},pe="pointerdown",de="pointermove pointerup pointercancel";function he(){this.evEl=pe,this.evWin=de,Y.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(pe="MSPointerDown",de="MSPointerMove MSPointerUp MSPointerCancel"),A(he,Y,{handler:function(e){var t=this.store,n=!1,r=!1,i=e.type.toLowerCase().replace("ms",""),o=le[i],a=ue[e.pointerType]||e.pointerType,s=a==H,c=w(t,e.pointerId,"pointerId");o&D&&(0===e.button||2===e.button||s)?c<0&&(t.push(e),c=t.length-1):o&(N|V)?n=!0:s||0!==e.buttons||(n=!0,r=!0,o=le.pointerup),c<0||(r||(t[c]=e),this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:t[c]}),n&&t.splice(c,1))}});var fe={touchstart:D,touchmove:2,touchend:N,touchcancel:V};function me(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Y.apply(this,arguments)}function ve(e,t){var n=M(e.touches),r=M(e.changedTouches);return t&(N|V)&&(n=S(n.concat(r),"identifier",!0)),[n,r]}A(me,Y,{handler:function(e){var t=fe[e.type];if(t===D&&(this.started=!0),this.started){var n=ve.call(this,e,t);t&(N|V)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:H,srcEvent:e})}}});var Ae={touchstart:D,touchmove:2,touchend:N,touchcancel:V},ge="touchstart touchmove touchend touchcancel";function ye(){this.evTarget=ge,this.targetIds={},Y.apply(this,arguments)}function be(e,t){var n=M(e.touches),r=this.targetIds;if(t&(2|D)&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=M(e.changedTouches),s=[],c=this.target;if(o=n.filter((function(e){return T(e.target,c)})),t===D)for(i=0;i<o.length;)r[o[i].identifier]=!0,i++;for(i=0;i<a.length;)r[a[i].identifier]&&s.push(a[i]),t&(N|V)&&delete r[a[i].identifier],i++;return s.length?[S(o.concat(s),"identifier",!0),s]:void 0}A(ye,Y,{handler:function(e){var t=Ae[e.type],n=be.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:H,srcEvent:e})}});var Ee=2500;function _e(){Y.apply(this,arguments);var e=g(this.handler,this);this.touch=new ye(this.manager,e),this.mouse=new ce(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function Te(e,t){e&D?(this.primaryTouch=t.changedPointers[0].identifier,xe.call(this,t)):e&(N|V)&&xe.call(this,t)}function xe(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)}),Ee)}}function Re(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],o=Math.abs(t-i.x),a=Math.abs(n-i.y);if(o<=25&&a<=25)return!0}return!1}A(_e,Y,{handler:function(e,t,n){var r=n.pointerType==H,i=n.pointerType==F;if(!(i&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)Te.call(this,t,n);else if(i&&Re.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var we=a?C(a.style,"touchAction"):r,Me=we!==r,Se="compute",Ce="auto",Ie="manipulation",Pe="none",Be="pan-x",Oe="pan-y",ke=function(){if(!Me)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)})),t}();function He(e,t){this.manager=e,this.set(t)}He.prototype={set:function(e){e==Se&&(e=this.compute()),Me&&this.manager.element.style&&ke[e]&&(this.manager.element.style[we]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return h(this.manager.recognizers,(function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(x(e,Pe))return Pe;var t=x(e,Be),n=x(e,Oe);if(t&&n)return Pe;if(t||n)return t?Be:Oe;if(x(e,Ie))return Ie;return Ce}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var r=this.actions,i=x(r,Pe)&&!ke[Pe],o=x(r,Oe)&&!ke[Oe],a=x(r,Be)&&!ke[Be];if(i){var s=1===e.pointers.length,c=e.distance<2,l=e.deltaTime<250;if(s&&c&&l)return}if(!a||!o)return i||o&&n&G||a&&n&K?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Fe=1,Le=32;function De(e){this.options=i({},this.defaults,e||{}),this.id=I++,this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=Fe,this.simultaneous={},this.requireFail=[]}function Ne(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Ve(e){return e==q?"down":e==j?"up":e==Q?"left":e==z?"right":""}function Ue(e,t){var n=t.manager;return n?n.get(e):e}function Qe(){De.apply(this,arguments)}function ze(){Qe.apply(this,arguments),this.pX=null,this.pY=null}function je(){Qe.apply(this,arguments)}function qe(){De.apply(this,arguments),this._timer=null,this._input=null}function Ge(){Qe.apply(this,arguments)}function Ke(){Qe.apply(this,arguments)}function We(){De.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Xe(e,t){return(t=t||{}).recognizers=b(t.recognizers,Xe.defaults.preset),new Je(e,t)}De.prototype={defaults:{},set:function(e){return i(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 t[(e=Ue(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,"dropRecognizeWith",this)||(e=Ue(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(d(e,"requireFailure",this))return this;var t=this.requireFail;return-1===w(t,e=Ue(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,"dropRequireFailure",this))return this;e=Ue(e,this);var t=w(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<8&&r(t.options.event+Ne(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=8&&r(t.options.event+Ne(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Le},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(Le|Fe)))return!1;e++}return!0},recognize:function(e){var t=i({},e);if(!y(this.options.enable,[this,t]))return this.reset(),void(this.state=Le);56&this.state&&(this.state=Fe),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},A(Qe,De,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,r=6&t,i=this.attrTest(e);return r&&(n&V||!i)?16|t:r||i?n&N?8|t:2&t?4|t:2:Le}}),A(ze,Qe,{defaults:{event:"pan",threshold:10,pointers:1,direction:W},getTouchAction:function(){var e=this.options.direction,t=[];return e&G&&t.push(Oe),e&K&&t.push(Be),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,o=e.deltaX,a=e.deltaY;return i&t.direction||(t.direction&G?(i=0===o?U:o<0?Q:z,n=o!=this.pX,r=Math.abs(e.deltaX)):(i=0===a?U:a<0?j:q,n=a!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return Qe.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Ve(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),A(je,Qe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),A(qe,De,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ce]},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&(N|V)&&!i)this.reset();else if(e.eventType&D)this.reset(),this._timer=p((function(){this.state=8,this.tryEmit()}),t.time,this);else if(e.eventType&N)return 8;return Le},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&N?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}}),A(Ge,Qe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),A(Ke,Qe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:G|K,pointers:1},getTouchAction:function(){return ze.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(G|K)?t=e.overallVelocity:n&G?t=e.overallVelocityX:n&K&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&l(t)>this.options.velocity&&e.eventType&N},emit:function(e){var t=Ve(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),A(We,De,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ie]},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&D&&0===this.count)return this.failTimeout();if(r&&i&&n){if(e.eventType!=N)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||re(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=p((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Le},failTimeout:function(){return this._timer=p((function(){this.state=Le}),this.options.interval,this),Le},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Xe.VERSION="2.0.7",Xe.defaults={domEvents:!1,touchAction:Se,enable:!0,inputTarget:null,inputClass:null,preset:[[Ge,{enable:!1}],[je,{enable:!1},["rotate"]],[Ke,{direction:G}],[ze,{direction:G},["swipe"]],[We],[We,{event:"doubletap",taps:2},["tap"]],[qe]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Je(e,t){var n;this.options=i({},Xe.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((n=this).options.inputClass||(O?he:k?ye:B?_e:ce))(n,Z),this.touchAction=new He(this,this.options.touchAction),Ye(this,!0),h(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)}function Ye(e,t){var n,r=e.element;r.style&&(h(e.options.cssProps,(function(i,o){n=C(r.style,o),t?(e.oldCssProps[n]=r.style[n],r.style[n]=i):r.style[n]=e.oldCssProps[n]||""})),t||(e.oldCssProps={}))}return Je.prototype={set:function(e){return i(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?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var r=this.recognizers,i=t.curRecognizer;(!i||i&&8&i.state)&&(i=t.curRecognizer=null);for(var o=0;o<r.length;)n=r[o],2===t.stopped||i&&n!=i&&!n.canRecognizeWith(i)?n.reset():n.recognize(e),!i&&14&n.state&&(i=t.curRecognizer=n),o++}},get:function(e){if(e instanceof De)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)){var t=this.recognizers,n=w(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==r&&t!==r){var n=this.handlers;return h(R(e),(function(e){n[e]=n[e]||[],n[e].push(t)})),this}},off:function(e,t){if(e!==r){var n=this.handlers;return h(R(e),(function(e){t?n[e]&&n[e].splice(w(n[e],t),1):delete n[e]})),this}},emit:function(e,n){this.options.domEvents&&function(e,n){var r=t.createEvent("Event");r.initEvent(e,!0,!0),r.gesture=n,n.target.dispatchEvent(r)}(e,n);var r=this.handlers[e]&&this.handlers[e].slice();if(r&&r.length){n.type=e,n.preventDefault=function(){n.srcEvent.preventDefault()};for(var i=0;i<r.length;)r[i](n),i++}},destroy:function(){this.element&&Ye(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},i(Xe,{INPUT_START:D,INPUT_MOVE:2,INPUT_END:N,INPUT_CANCEL:V,STATE_POSSIBLE:Fe,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:Le,DIRECTION_NONE:U,DIRECTION_LEFT:Q,DIRECTION_RIGHT:z,DIRECTION_UP:j,DIRECTION_DOWN:q,DIRECTION_HORIZONTAL:G,DIRECTION_VERTICAL:K,DIRECTION_ALL:W,Manager:Je,Input:Y,TouchAction:He,TouchInput:ye,MouseInput:ce,PointerEventInput:he,TouchMouseInput:_e,SingleTouchInput:me,Recognizer:De,AttrRecognizer:Qe,Tap:We,Pan:ze,Swipe:Ke,Pinch:je,Rotate:Ge,Press:qe,on:E,off:_,each:h,merge:v,extend:m,assign:i,inherit:A,bindFn:g,prefixed:C}),Xe}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{});function calculateThreeMouse(e,t,n){var r=t.getBoundingClientRect(),i=r.top,o=r.left,a=r.width,s=r.height;return n&&(o+=a*n.left,i+=s*(1-n.bottom-n.height),a*=n.width,s*=n.height),new THREE__namespace.Vector2((e.x-o)/a*2-1,-(e.y-i)/s*2+1)}var BaseController=function(e){function t(n){var r,i,o,a,s,c,l=e.call(this)||this,u=t.parseArgs(n);return l.mode="",l.pending=new Set,l.userAction=u.initial.userAction,l.destroyed=!1,l.ident=u.ident,l.scene=u.scene,l.xrCustomObjectsScene=u.xrCustomObjectsScene,l.helper=u.helper,l.boundingMesh=u.boundingMesh,l.camera=u.camera,l.renderer=u.renderer,l.scissor=u.scissor,l.element=u.element,l.models=u.models,l.enableWheel=u.enableWheel,l.enableIOSEDR=null!==(r=u.enableIOSEDR)&&void 0!==r&&r,l.enableEDL=null===(i=u.enableEDL)||void 0===i||i,l.enableHQ=null===(o=u.enableHQ)||void 0===o||o,l.works=u.works,l.imageOptions=u.imageOptions,l.videoTexture=u.videoTexture,l.extraElements=u.extraElements,l.initial=u.initial,l.currentPano="number"==typeof l.initial.state.panoIndex?{workCode:null!==(c=null!==(a=l.initial.state.workCode)&&void 0!==a?a:null===(s=u.works[0])||void 0===s?void 0:s.workCode)&&void 0!==c?c:"",panoIndex:l.initial.state.panoIndex}:{workCode:l.initial.currentState.workCode,panoIndex:l.initial.currentState.panoIndex},l.needsRender=!0,l.cameraMotion=new Motion({longitude:{value:l.camera.pose.longitude,circle:[0,2*Math.PI]},latitude:l.camera.pose.latitude,fov:l.camera.pose.fov}),l.inMomentumMovement=null,l.eventUnbinds=[u.element].concat(u.extraElements||[]).map((function(e){return l.bindEvents(e)})),l.pending.add("init-animation"),l.initAnimationReady=new Promise((function(e){AnimationFrameLoop.shared.add((function(){l.initAnimation().then((function(){l.pending.delete("init-animation"),e()}))}),!0)})),l}return __extends(t,e),t.parseArgs=function(e){return e instanceof t?e:__assign({},e)},t.initAnimationEndState=function(e){var t,n,r,i,o,a,s,c,l=this.parseArgs(e),u=l.initial,p=u.state,d=u.currentState,h="number"==typeof p.panoIndex?{workCode:null!==(r=null!==(t=p.workCode)&&void 0!==t?t:null===(n=l.works[0])||void 0===n?void 0:n.workCode)&&void 0!==r?r:"",panoIndex:p.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex};return __assign(__assign({},h),{mode:"",longitude:null!==(i=p.longitude)&&void 0!==i?i:d.longitude,latitude:null!==(o=p.latitude)&&void 0!==o?o:d.latitude,fov:null!==(a=p.fov)&&void 0!==a?a:d.fov,offset:null!==(s=p.offset)&&void 0!==s?s:d.offset,distance:null!==(c=p.distance)&&void 0!==c?c:d.distance})},t.prototype.destroy=function(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(var t=0,n=this.eventUnbinds;t<n.length;t++){(0,n[t])()}this.copyEffect&&(this.copyEffect.dispose(),delete this.copyEffect),delete this.panState,null===(e=this.pressState)||void 0===e||e.stop(),delete this.pressState},t.prototype.isReady=function(){return null===this.inMomentumMovement&&0===this.pending.size&&!0===this.cameraMotion.ended},t.prototype.bindExtraElement=function(e){for(var t=0,n=this.eventUnbinds;t<n.length;t++){if(n[t].element===e)return}this.eventUnbinds.push(this.bindEvents(e))},t.prototype.unbindExtraElement=function(e){for(var t=[],n=0,r=this.eventUnbinds;n<r.length;n++){var i=r[n];i.element===e?i():t.push(i)}this.eventUnbinds=t},t.prototype.updateRenderSize=function(){this.needsRender=!0},t.prototype.updateModel=function(e){this.needsRender=!0},t.prototype.updateWork=function(e,t,n,r){return this.works=e,this.userAction=r,!1},t.prototype.updateTime=function(e,t){if(!this.destroyed){var n={};this.cameraMotion.ended&&(this.cameraMotion.update(e),n.longitude=this.cameraMotion.value.longitude,n.latitude=this.cameraMotion.value.latitude,n.fov=this.cameraMotion.value.fov),isEmptyObject(n)&&this.setCamera(n)}},t.prototype.render=function(){this.renderer.render(this.scene,this.camera)},t.prototype.postProcessing=function(e,t){this.destroyed},t.prototype.updateCamera=function(e,t,n){var r=this;return this.initAnimationReady.then((function(){r.userAction=n,r.stopMomentumMovement();var i={};return void 0!==e.longitude&&(i.longitude=e.longitude),void 0!==e.latitude&&(i.latitude=e.latitude),void 0!==e.fov&&(i.fov=e.fov),r.cameraMotion.set(i,t).catch(noop$1)}))},t.prototype.updateCameraWithKeyframes=function(e,t,n){var r=this;return this.initAnimationReady.then((function(){r.userAction=n,r.stopMomentumMovement();for(var i=[],o=0,a=e;o<a.length;o++){var s=a[o];i.push({key:s.key,progress:s.progress,value:{longitude:s.value.longitude,latitude:s.value.latitude,fov:s.value.fov}})}return r.cameraMotion.setKeyframes(i,t)}))},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1];return __assign(__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})},t.prototype.initAnimation=function(){var e=this.initial;e.state,e.currentState,e.duration;var n=e.userAction,r=t.initAnimationEndState(this);return this.userAction=n,this.emit("initAnimation.start",createEvent("initAnimation.start",{state:r,userAction:this.userAction})),this.emit("initAnimation.end",createEvent("initAnimation.end",{state:r,userAction:this.userAction})),Promise.resolve()},t.prototype.setCamera=function(e){var t,n,r,i,o;void 0===e&&(e={});var a=null!==(t=e.longitude)&&void 0!==t?t:this.camera.pose.longitude,s=null!==(n=e.latitude)&&void 0!==n?n:this.camera.pose.latitude,c=null!==(r=e.fov)&&void 0!==r?r:this.camera.pose.fov,l=null!==(i=e.distance)&&void 0!==i?i:this.camera.pose.distance,u=null!==(o=e.offset)&&void 0!==o?o:this.camera.pose.offset,p=notSimilarValue(a,this.camera.pose.longitude,2*Math.PI)||notSimilarValue(s,this.camera.pose.latitude),d=notSimilarValue(c,this.camera.pose.fov),h=notSimilarValue(l,this.camera.pose.distance),f=notSimilarVector3(u,this.camera.pose.offset);(d||p||f||h)&&(this.camera.setFromPose({longitude:a,latitude:s,fov:c,distance:l,offset:u}),this.emit("camera.update",createEvent("camera.update",{userAction:this.userAction,state:__assign(__assign({},this.currentPano),{mode:this.mode,longitude:a,latitude:s,fov:c,offset:u,distance:l})})),this.needsRender=!0)},t.prototype.stopMomentumMovement=function(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){var e=createEvent("gesture.momentum",__assign(__assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit("gesture.momentum",e)}this.inMomentumMovement=null},t.prototype.onPanGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pan",e)},t.prototype.onTapGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.tap",e)},t.prototype.onPressGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.press",e)},t.prototype.onPinchGesture=function(e){this.stopMomentumMovement(),this.emit("gesture.pinch",e)},t.prototype.onMouseWheel=function(e){this.stopMomentumMovement(),this.emit("gesture.mousewheel",e)},t.prototype.onMouseMove=function(e){this.stopMomentumMovement(),this.emit("gesture.mousemove",e)},t.prototype.relativeClientPosition=function(e){return calculateThreeMouse(e,this.element,this.scissor)},t.prototype.bindEvents=function(e){var t=this,n=function(e){var n=calculateThreeMouse(e,t.element,t.scissor);return!(Math.abs(n.x)>1||Math.abs(n.y)>1)},r=new Hammer.Manager(e),i=function(e){return e.session.firstInput||null};r.add(new Hammer.Pan({threshold:10,pointers:0})),r.add(new Hammer.Tap({interval:410})),r.add(new Hammer.Pinch({threshold:0,pointers:2})),r.on("panstart pan",(function(e){var o=i(r);if(!o||n(o.center)){var a,s,c,l=createEvent("gesture.pan",{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map((function(e){var n=t.relativeClientPosition(e),r=new THREE__namespace.Raycaster;return r.params.Points={threshold:.1},r.setFromCamera(n,t.camera),{x:e.x,y:e.y,delta:0,buttons:0,coords:n,raycaster:r}})),isFirst:e.isFirst,isFinal:e.isFinal,scale:e.scale,center:(a=e.center,s=t.relativeClientPosition(a),c=new THREE__namespace.Raycaster,c.params.Points={threshold:.1},c.setFromCamera(s,t.camera),{x:a.x,y:a.y,delta:0,buttons:0,coords:s,raycaster:c}),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:__assign(__assign({mode:t.mode},t.currentPano),clonePose(t.camera.pose))});t.onPanGesture(l),f()}})),r.on("tap",(function(e){if("mouse"!==e.pointerType||0===e.srcEvent.button){var o=i(r);if(!o||n(o.center)){var a,s,c,l=createEvent("gesture.tap",{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map((function(e){var n=t.relativeClientPosition(e),r=new THREE__namespace.Raycaster;return r.params.Points={threshold:.1},r.setFromCamera(n,t.camera),{x:e.x,y:e.y,delta:0,buttons:0,coords:n,raycaster:r}})),isFirst:!0,isFinal:!0,scale:e.scale,center:(a=e.center,s=t.relativeClientPosition(a),c=new THREE__namespace.Raycaster,c.params.Points={threshold:.1},c.setFromCamera(s,t.camera),{x:a.x,y:a.y,delta:0,buttons:0,coords:s,raycaster:c}),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:__assign(__assign({mode:t.mode},t.currentPano),clonePose(t.camera.pose))});t.onTapGesture(l),f()}}})),r.on("pinchstart pinch pinchend",(function(e){var o=i(r);if(!o||n(o.center)){var a,s,c,l=createEvent("gesture.pinch",{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map((function(e){var n,r=t.relativeClientPosition(e),i=new THREE__namespace.Raycaster;return i.params.Points={threshold:.1},i.setFromCamera(r,t.camera),{x:e.x,y:e.y,delta:null!==(n=e.delta)&&void 0!==n?n:0,buttons:0,coords:r,raycaster:i}})),isFirst:"pinchstart"===e.type,isFinal:"pinchend"===e.type,scale:e.scale,center:(a=e.center,s=t.relativeClientPosition(a),c=new THREE__namespace.Raycaster,c.params.Points={threshold:.1},c.setFromCamera(s,t.camera),{x:a.x,y:a.y,delta:0,buttons:0,coords:s,raycaster:c}),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:__assign(__assign({mode:t.mode},t.currentPano),clonePose(t.camera.pose))});t.onPinchGesture(l),f()}}));var o=null,a=null,s=function(e,n,r){var i={x:r.clientX,y:r.clientY},o=t.relativeClientPosition(i),a=new THREE__namespace.Raycaster;a.params.Points={threshold:.1},a.setFromCamera(o,t.camera);var s=__assign(__assign({},i),{coords:o,raycaster:a,buttons:r.buttons,delta:0}),c="pinchend"===e?n:n-r.deltaY/280;return createEvent("gesture.pinch",{target:r.target,pointerType:"mouse",srcEvent:r,pointers:[__assign({},s)],isFirst:"pinchstart"===e,isFinal:"pinchend"===e,scale:clamp(c,.1,10),center:__assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:t.mode},t.currentPano),clonePose(t.camera.pose))})},c=function(e){var r,i={x:e.clientX,y:e.clientY};if(n(i)){if(e.preventDefault(),e.ctrlKey){var c=null!==(r=null==o?void 0:o.prevEvent.scale)&&void 0!==r?r:1,l=s(o?"pinch":"pinchstart",c,e);null===o?o={firstEvent:l,prevEvent:l}:o.prevEvent=l,t.onPinchGesture(l),null!==a&&window.clearTimeout(a),a=window.setTimeout((function(){var n;a=null;var r=null!==(n=null==o?void 0:o.prevEvent.scale)&&void 0!==n?n:1,i=s("pinchend",r,e);o=null,t.onPinchGesture(i)}),200)}else{var u=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,p=void 0!==t.mouseWheelState,d={x:e.clientX,y:e.clientY},h=t.relativeClientPosition(d),m=new THREE__namespace.Raycaster;m.params.Points={threshold:.1},m.setFromCamera(h,t.camera);var v=__assign(__assign({},d),{coords:h,raycaster:m,buttons:e.buttons,delta:u});l=createEvent("gesture.mousewheel",{target:e.target,pointerType:"mouse",srcEvent:e,pointers:[__assign({},v)],isFirst:p,isFinal:!1,scale:0,center:__assign({},v),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:t.mode},t.currentPano),clonePose(t.camera.pose))});t.onMouseWheel(l),t.mouseWheelState&&clearTimeout(t.mouseWheelState.timer),t.mouseWheelState={timer:setTimeout((function(){delete t.mouseWheelState;var n=createEvent("gesture.mousewheel",{target:e.target,pointerType:"mouse",srcEvent:e,pointers:[__assign(__assign({},v),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:__assign(__assign({},v),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:t.mode},t.currentPano),clonePose(t.camera.pose))});t.onMouseWheel(n)}),100)}}f()}},l=function(e){if(!isMobile())if(n({x:e.clientX,y:e.clientY})){var r=!1;t.mouseMoveState||(r=!0);var i={x:e.clientX,y:e.clientY},o=t.relativeClientPosition(i),a=new THREE__namespace.Raycaster;a.params.Points={threshold:.1},a.setFromCamera(o,t.camera);var s=__assign(__assign({},i),{coords:o,raycaster:a,buttons:e.buttons,delta:0}),c=createEvent("gesture.mousemove",{target:e.target,pointerType:"mouse",srcEvent:e,pointers:[__assign({},s)],isFirst:r,isFinal:!1,scale:0,center:__assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:t.mode},t.currentPano),clonePose(t.camera.pose))});t.mouseMoveState||(t.mouseMoveState={timeStamp:now(),event:c}),t.onMouseMove(c),t.pressState&&Math.abs(e.clientX-t.pressState.event.center.y)>10&&Math.abs(e.clientY-t.pressState.event.center.y)>10&&f()}else u()},u=function(){if(t.mouseMoveState){var e=createEvent(t.mouseMoveState.event.type,__assign(__assign({},t.mouseMoveState.event),{isFinal:!0}));t.onMouseMove(e)}f()},p=function(e){if(n(e.center)){var r=!1;t.pressState||(r=!0,t.pressState={event:e,timeStamp:now(),stop:noop$1});var i=now()-t.pressState.timeStamp,o=createEvent(t.pressState.event.type,__assign(__assign({},t.pressState.event),{isFirst:r,isFinal:!1,center:__assign(__assign({},t.pressState.event.center),{delta:i}),pointers:t.pressState.event.pointers.map((function(e){return __assign(__assign({},e),{delta:i})}))}));t.onPressGesture(o),t.pressState&&(t.pressState.stop=AnimationFrameLoop.shared.add((function(t){p(e)}),!0,1))}else f()},d=function(e){if(f(),!(e.touches.length>1||e.changedTouches.length<=0)){var n={x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY},r=t.relativeClientPosition(n),i=new THREE__namespace.Raycaster;i.params.Points={threshold:.1},i.setFromCamera(r,t.camera);var o=__assign(__assign({},n),{coords:r,raycaster:i,buttons:0,delta:0}),a=createEvent("gesture.press",{target:e.target,pointerType:"touch",srcEvent:e,pointers:[__assign({},o)],isFirst:!1,isFinal:!1,scale:0,center:o,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:t.mode},t.currentPano),clonePose(t.camera.pose))});p(a)}},h=function(e){f();var n={x:e.clientX,y:e.clientY},r=t.relativeClientPosition(n),i=new THREE__namespace.Raycaster;i.params.Points={threshold:.1},i.setFromCamera(r,t.camera);var o=__assign(__assign({},n),{coords:r,raycaster:i,buttons:e.buttons,delta:0}),a=createEvent("gesture.press",{target:e.target,pointerType:"mouse",srcEvent:e,pointers:[__assign({},o)],isFirst:!1,isFinal:!1,scale:0,center:o,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:t.mode},t.currentPano),clonePose(t.camera.pose))});p(a)},f=function(){var e;if(t.pressState){var n=now()-t.pressState.timeStamp,r=createEvent(t.pressState.event.type,__assign(__assign({},t.pressState.event),{center:__assign(__assign({},t.pressState.event.center),{delta:n}),isFirst:!1,isFinal:!0,pointers:t.pressState.event.pointers.map((function(e){return __assign(__assign({},e),{delta:n})}))}));t.onPressGesture(r),null===(e=t.pressState)||void 0===e||e.stop(),delete t.pressState}},m=null,v=function(e){var n,r=!1,i=!1;switch(e.type){case"gesturestart":r=!0;break;case"gestureend":i=!0}var o={x:e.clientX,y:e.clientY},a=t.relativeClientPosition(o),s=new THREE__namespace.Raycaster;s.params.Points={threshold:.1},s.setFromCamera(a,t.camera);var c=__assign(__assign({},o),{coords:a,raycaster:s,buttons:0,delta:0});return createEvent("gesture.pinch",{target:e.target,pointerType:"mouse",srcEvent:e,pointers:[__assign({},c)],isFirst:r,isFinal:i,scale:null!==(n=e.scale)&&void 0!==n?n:1,center:__assign({},c),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:__assign(__assign({mode:t.mode},t.currentPano),clonePose(t.camera.pose))})},A=function(e){if(e.preventDefault(),!isMobile()){var r=v(e),i=(m={firstEvent:r}).firstEvent;i&&!n(i.center)||t.onPinchGesture(r)}},g=function(e){if(e.preventDefault(),!isMobile()&&m){var r=v(e),i=m.firstEvent;i&&!n(i.center)||t.onPinchGesture(r)}},y=function(e){if(e.preventDefault(),!isMobile()&&m){var r=v(e),i=m.firstEvent;m=null,i&&!n(i.center)||t.onPinchGesture(r)}},b=function(t){if(t&&"function"==typeof t.preventDefault&&t.currentTarget===e&&t.preventDefault(),"function"==typeof getSelection){var n=getSelection();n&&n.focusNode&&(n.removeAllRanges&&n.removeAllRanges(),n.empty&&n.empty())}};this.enableWheel&&e.addEventListener("wheel",c,{passive:!1}),e.addEventListener("mousemove",l,!1),e.addEventListener("mouseout",u,!1),e.addEventListener("touchstart",d,{passive:!0}),e.addEventListener("touchend",f,!1),e.addEventListener("touchcancel",f,!1),e.addEventListener("mousedown",h,!1),e.addEventListener("mouseup",f,!1),e.addEventListener("gesturestart",A,{passive:!1}),e.addEventListener("gesturechange",g,{passive:!1}),e.addEventListener("gestureend",y,{passive:!1}),e.addEventListener("touchstart",b,{passive:!1}),e.addEventListener("contextmenu",b,!1);return Object.assign((function(){r.destroy(),e.removeEventListener("wheel",c,!1),e.removeEventListener("mousemove",l,!1),e.removeEventListener("mouseout",u,!1),e.removeEventListener("touchstart",d,!1),e.removeEventListener("touchend",f,!1),e.removeEventListener("touchcancel",f,!1),e.removeEventListener("mousedown",h,!1),e.removeEventListener("mouseup",f,!1),e.removeEventListener("gesturestart",A,!1),e.removeEventListener("gesturechange",g,!1),e.removeEventListener("gestureend",y,!1),e.removeEventListener("touchstart",b,!1),e.removeEventListener("contextmenu",b,!1)}),{element:e})},t.prototype.preloadPano=function(e,t){var n=this;void 0===t&&(t=noop$1);var r=this.works.getResolvedObserver(e);if(!r)return Promise.resolve();return Promise.all(["right","left","up","down","front","back"].map((function(t){var i=__assign({key:"pano.".concat(panoStringify(e),".").concat(t)},pick(n.imageOptions,["size","format","quality","mappings"])),o=applyImageURLOptions(r.images[t],n.imageOptions.transform,i);return getFetcher(r.work).preload(o)}))).then((function(){return t(e),e}))},t}(Subscribe),FloorplanController=function(e){function t(n){var r,i=this,o=t.parseArgs(n);return(i=e.call(this,o)||this).mode="Floorplan",i.defaultLongitude=o.defaultLongitude,i.defaultLatitude=o.defaultLatitude,i.defaultFov=o.defaultFov,i.maxFov=o.maxFov,i.minFov=o.minFov,i.maxLatitude=o.maxLatitude,i.minLatitude=o.minLatitude,i.locationMotion=new Motion({x:i.camera.pose.offset.x,y:i.camera.pose.offset.y,z:i.camera.pose.offset.z,distance:i.camera.pose.distance}),i.modelAlphaMotion=new Motion({modelAlpha:null!==(r=i.models.getMaterial().modelAlpha)&&void 0!==r?r:0}),i.perspToOrthoMotion=new Motion({perspToOrtho:i.camera.perspToOrtho.x}),i.currentTapId=null,i.intersectMeshCreator=o.intersectMeshCreator,i.intersectMesh=i.intersectMeshCreator(),i.intersectMesh.name="intersect",i.intersectMesh.visible=!1,i.helper.add(i.intersectMesh),i}return __extends(t,e),t.distanceFromModel=function(e,t,n){var r=e.bounding,i=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),.5),o=i/2/Math.tan(Math.PI*t/360);return n<1&&(o/=n),isNaN(o)?i:o},t.parseArgs=function(n){var r,i,o,a,s,c,l,u;if(n instanceof t)return n;var p=e.parseArgs.call(this,n);return __assign(__assign({},p),{defaultLongitude:null!==(r=n.defaultLongitude)&&void 0!==r?r:Math.PI/4,defaultLatitude:null!==(i=n.defaultLatitude)&&void 0!==i?i:Math.PI/4,defaultFov:null!==(o=n.defaultFov)&&void 0!==o?o:80,maxFov:null!==(a=n.maxFov)&&void 0!==a?a:120,minFov:null!==(s=n.minFov)&&void 0!==s?s:20,maxLatitude:null!==(c=n.maxLatitude)&&void 0!==c?c:+Math.PI/2,minLatitude:null!==(l=n.minLatitude)&&void 0!==l?l:-Math.PI/2,intersectMeshCreator:null!==(u=n.intersectMeshCreator)&&void 0!==u?u:function(){return new IntersectMesh}})},t.initAnimationEndState=function(e){var n,r,i,o,a,s,c=this.parseArgs(e),l=e.initial,u=l.state,p=l.currentState,d="number"==typeof u.panoIndex?{workCode:null!==(i=null!==(n=u.workCode)&&void 0!==n?n:null===(r=c.works[0])||void 0===r?void 0:r.workCode)&&void 0!==i?i:"",panoIndex:u.panoIndex}:{workCode:p.workCode,panoIndex:p.panoIndex};return __assign(__assign({},d),{mode:"Floorplan",longitude:null!==(o=u.longitude)&&void 0!==o?o:isThirdPersonMode(p.mode)?p.longitude:c.defaultLongitude,latitude:clamp(null!==(a=u.latitude)&&void 0!==a?a:"Floorplan"===p.mode?p.latitude:c.defaultLatitude,c.minLatitude,c.maxLatitude),fov:null!==(s=u.fov)&&void 0!==s?s:c.defaultFov,offset:e.models.bounding.getCenter(new THREE__namespace.Vector3),distance:t.distanceFromModel(c.models,c.defaultFov,c.camera.aspect)})},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,t,n,r){return this.works=e,this.updateCamera(t,null!=n?n:0,r),!0},t.prototype.updateModel=function(n){e.prototype.updateModel.call(this,n);var r=n.bounding.getCenter(new THREE__namespace.Vector3),i=t.distanceFromModel(n,this.defaultFov,this.camera.aspect);this.locationMotion.set({x:r.x,y:r.y,z:r.z,distance:i},0).catch(noop$1)},t.prototype.updateCamera=function(e,t,n){var r=this;return this.initAnimationReady.then((function(){r.userAction=n,r.stopMomentumMovement();var i={},o={};return void 0!==e.distance&&(i.distance=e.distance),void 0!==e.offset&&(i.x=e.offset.x,i.y=e.offset.y,i.z=e.offset.z),void 0!==e.longitude&&(o.longitude=e.longitude),void 0!==e.latitude&&(o.latitude=e.latitude),void 0!==e.fov&&(o.fov=e.fov),r.locationMotion.set(i,t).catch(noop$1),r.cameraMotion.set(o,t).catch(noop$1)}))},t.prototype.updateCameraWithKeyframes=function(e,t,n){var r=this;return this.initAnimationReady.then((function(){r.userAction=n,r.stopMomentumMovement();for(var i=[],o=[],a=0,s=e;a<s.length;a++){var c=s[a];i.push({key:c.key,progress:c.progress,value:{distance:c.value.distance,x:c.value.offset.x,y:c.value.offset.x,z:c.value.offset.x}}),o.push({key:c.key,progress:c.progress,value:{longitude:c.value.longitude,latitude:c.value.latitude,fov:c.value.fov}})}return r.locationMotion.setKeyframes(i,t).catch(noop$1),r.cameraMotion.setKeyframes(e,t)}))},t.prototype.updateTime=function(e,t){if(!this.destroyed){var n={},r={};this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),n.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended||(this.locationMotion.update(e),r.distance=this.locationMotion.value.distance,r.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),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),isEmptyObject(n)||this.models.setMaterial(n),isEmptyObject(r)||this.setCamera(r)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],t=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(n){var r=e.initial;r.state,r.currentState;var i=r.duration,o=r.userAction;e.userAction=o;var a=t.initAnimationEndState(e),s=pick(a,["longitude","latitude","fov"]),c={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:a,userAction:e.userAction})),e.modelAlphaMotion.set({modelAlpha:1},i/3).catch(noop$1),e.perspToOrthoMotion.set({perspToOrtho:0},i).catch(noop$1),e.cameraMotion.set(s,i).catch(noop$1),e.locationMotion.set(c,i).then((function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:a,userAction:e.userAction}))}),(function(t){var n=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:n,userAction:e.userAction}))})).then((function(){n()}))}))},t.prototype.updateRenderSize=function(){this.locationMotion.set({distance:t.distanceFromModel(this.models,this.defaultFov,this.camera.aspect)},0).catch(noop$1)},t.prototype.getForwardObserverOrNot=function(e){var t=this.models.intersectRaycaster(e)[0];if(!t)return null;var n=arrayMin(this.works.resolvedObservers,(function(e){return e.standingPosition.distanceTo(t.point)}),!0),r=n[0],i=n[1];return r&&i<10?r:null},t.prototype.coordinatesForOffset=function(e){var t=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(t.x*this.scissor.width),latitude:2*e.y/(t.y*this.scissor.height)}},t.prototype.requestMomentumMovement=function(e,t,n,r){var i=this;if(null!==this.inMomentumMovement){for(var o=__assign({},n),a={longitude:0,latitude:0},s=0;s<r;s++)o.longitude*=.996,o.latitude*=.994008,a.longitude+=o.longitude,a.latitude+=o.latitude;var c=formatRad(this.cameraMotion.value.longitude+a.longitude),l=clamp(this.cameraMotion.value.latitude+a.latitude,this.minLatitude,this.maxLatitude),u=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:l,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),p=!(o.longitude>1e-4||o.longitude<-1e-4||o.latitude>1e-4||o.latitude<-1e-4),d=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:t,isFinal:p,state:u}));this.inMomentumMovement.event=d,this.emit("gesture.momentum",d),e.defaultPrevented?this.inMomentumMovement=null:this.inMomentumMovement&&(this.cameraMotion.set({longitude:c,latitude:l},0).catch(noop$1),p?this.inMomentumMovement=null:AnimationFrameLoop.shared.add((function(t,n){i.requestMomentumMovement(e,!1,o,0|n)}),!0,1))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var t=this.panState,n=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:n,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===n){var r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.relativeClientPosition(e.center),o=this.camera.pose.latitude<Math.PI/6||i.y<0?1:-1;r.x*=o;var a=this.coordinatesForOffset(r),s=formatRad(this.cameraMotion.value.longitude+a.longitude),c=clamp(this.cameraMotion.value.latitude+a.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(c=this.cameraMotion.value.latitude);var l=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:s,latitude:c,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=l,this.emit("gesture.pan",e),!e.defaultPrevented&&(this.cameraMotion.set({longitude:l.longitude,latitude:l.latitude},0).catch(noop$1),e.isFinal)){var u=e.velocityX*o,p=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:u,y:p}),0)}}},t.prototype.onPinchGesture=function(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();var n=null===(t=this.pinchState)||void 0===t?void 0:t.fov;if(e.isFirst)this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};else if(e.isFinal&&(delete this.panState,delete this.pinchState),void 0!==n){var r=clamp(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(noop$1),this.onPanGesture(e))}},t.prototype.onMouseMove=function(e){var t,n;if(this.intersectMesh.parent&&!this.panState)if(this.emit("gesture.mousemove",e),e.defaultPrevented)this.hideIntersectMesh();else{var r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&!0===this.intersectMesh.visible)this.hideIntersectMesh();else{var i=this.models.intersectRaycaster(r)[0],o=createEvent("intersect.update",{raycaster:r,intersection:null!=i?i:null,object:this.intersectMesh});if(this.emit("intersect.update",o),o.defaultPrevented)this.hideIntersectMesh();else if(i){var a=null!==(n=null===(t=i.face)||void 0===t?void 0:t.normal)&&void 0!==n?n:(new THREE__namespace.Vector3).copy(r.ray.direction).multiplyScalar(-1),s=a.clone().multiplyScalar(.05),c=i.point.clone().add(s);this.intersectMesh.position.copy(c);var l=c.clone().add(s);if(this.intersectMesh.lookAt(l),Math.abs(a.y)>.99){var u=this.camera.position.clone().sub(c);this.intersectMesh.rotation.z=-Math.atan2(u.z,u.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}}},t.prototype.onMouseWheel=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var t=this.minFov,n=this.maxFov,r=clamp(this.camera.fov-e.center.delta,t,n);e.state.fov=r,this.emit("gesture.mousewheel",e),e.defaultPrevented||this.cameraMotion.set({fov:r},0).catch(noop$1)},t.prototype.onTapGesture=function(e){var t=this;this.userAction=!0,this.stopMomentumMovement();var n=e.center.raycaster,r=this.getForwardObserverOrNot(n);if(r){var i={longitude:this.camera.pose.longitude,latitude:0},o=__assign(__assign({},e.state),{mode:"Panorama",workCode:r.pano.workCode,panoIndex:r.pano.panoIndex,longitude:i.longitude,latitude:i.latitude,offset:r?r.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=o,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:o,userAction:e.userAction,options:i,progress:0,error:null})),r&&r.active)){var a=this.currentTapId=createUuid();this.preloadPano(r.pano).then((function(e){t.currentTapId===a&&t.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:t.currentPano,progress:0,state:o,options:i,error:null}))}))}}else this.emit("gesture.tap",e)},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t}(BaseController),ViewDirection={Top:{longitude:0,latitude:Math.PI/2},FrontSide:{longitude:0,latitude:0},LeftSide:{longitude:Math.PI/2,latitude:0},BackSide:{longitude:Math.PI,latitude:0},RightSide:{longitude:1.5*Math.PI,latitude:0}};function panLeft(e,t){var n=(new THREE__namespace.Vector3).copy(t);return n.multiplyScalar(-e),n}function panUp(e,t){var n=(new THREE__namespace.Vector3).copy(t);return n.multiplyScalar(e),n}var TopviewController=function(e){function t(n){var r=this,i=t.parseArgs(n);return(r=e.call(this,i)||this).mode="Topview",r}return __extends(t,e),t.parseArgs=function(n){if(n instanceof t)return n;var r=__assign(__assign({},n.initial),{state:__assign(__assign({},n.initial.state),{longitude:0,latitude:Math.PI/2})}),i=__assign(__assign({},n),{initial:r,maxLatitude:Math.PI/2,minLatitude:Math.PI/2,defaultLongitude:0,defaultLatitude:Math.PI/2});return e.parseArgs.call(this,i)},t.initAnimationEndState=function(t){var n=this.parseArgs(t),r=e.initAnimationEndState.call(this,n);return __assign(__assign({},r),{mode:"Topview"})},t.prototype.updateModel=function(e){this.needsRender=!0;var t=this.models.bounding.getCenter(new THREE__namespace.Vector3);this.locationMotion.set({x:t.x,y:t.y,z:t.z,distance:FloorplanController.distanceFromModel(this.models,this.defaultFov,this.camera.aspect)},0).catch(noop$1)},t.prototype.updateCamera=function(e,t,n){var r=this;return this.initAnimationReady.then((function(){r.userAction=n,r.stopMomentumMovement();var i={},o={};return void 0!==e.distance&&(i.distance=e.distance),void 0!==e.offset&&(i.x=e.offset.x,i.y=e.offset.y,i.z=e.offset.z),void 0!==e.longitude&&(o.longitude=e.longitude),void 0!==e.latitude&&(o.latitude=e.latitude),void 0!==e.fov&&(o.fov=e.fov),r.locationMotion.set(i,t).catch(noop$1),r.cameraMotion.set(o,t).catch(noop$1)}))},t.prototype.updateCameraWithKeyframes=function(e,t,n){var r=this;return this.initAnimationReady.then((function(){r.userAction=n,r.stopMomentumMovement();for(var i=[],o=[],a=0,s=e;a<s.length;a++){var c=s[a];i.push({key:c.key,progress:c.progress,value:{distance:c.value.distance,x:c.value.offset.x,y:c.value.offset.x,z:c.value.offset.x}}),o.push({key:c.key,progress:c.progress,value:{longitude:c.value.longitude,latitude:c.value.latitude,fov:c.value.fov}})}return r.locationMotion.setKeyframes(i,t).catch(noop$1),r.cameraMotion.setKeyframes(e,t)}))},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(n){var r=e.initial;r.state,r.currentState;var i=r.duration,o=r.userAction;e.userAction=o;var a=t.initAnimationEndState(e),s={longitude:a.longitude,latitude:a.latitude,fov:a.fov},c={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:a,userAction:e.userAction})),e.modelAlphaMotion.set({modelAlpha:1},i/3).catch(noop$1),e.perspToOrthoMotion.set({perspToOrtho:1},i).catch(noop$1),e.cameraMotion.set(s,i).catch(noop$1),e.locationMotion.set(c,i).then((function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:a,userAction:e.userAction}))}),(function(t){var n=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:n,userAction:e.userAction}))})).then((function(){n()}))}))},t.prototype.getZoomOffsetFromFov=function(e,t,n){var r=this.camera.getDirection(new THREE__namespace.Vector3),i=Math.tan(n/2*Math.PI/180),o=Math.tan(t.fov/2*Math.PI/180),a=(o-i)/o,s=new THREE__namespace.Raycaster;s.params.Points={threshold:.1},s.setFromCamera(e,t);var c=s.ray.direction,l=c.angleTo(r),u=FloorplanController.distanceFromModel(this.models,this.defaultFov,this.camera.aspect),p=u*Math.tan(l),d=c.clone().setLength(u*Math.cos(l)).projectOnPlane(r),h=d.length(),f=a/h*d.x*p,m=a/h*d.z*p,v=a/h*d.y*p;return new THREE__namespace.Vector3(f,v,m)},t.prototype.requestMomentumMovement=function(){this.inMomentumMovement=null},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var t=this.panState,n=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:n,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===n){var r=e.center.x-t.x,i=e.center.y-t.y,o=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=this.models.bounding,s={left:new THREE__namespace.Vector3,up:new THREE__namespace.Vector3,cameraDirection:"y"};this.cameraMotion.value.longitude===ViewDirection.Top.longitude&&this.cameraMotion.value.latitude===ViewDirection.Top.latitude?(s.left.set(1,0,0),s.up.set(0,0,-1),s.cameraDirection="y"):this.cameraMotion.value.longitude===ViewDirection.FrontSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.FrontSide.latitude?(s.left.set(1,0,0),s.up.set(0,1,0),s.cameraDirection="z"):this.cameraMotion.value.longitude===ViewDirection.BackSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.BackSide.latitude?(s.left.set(1,0,0),s.up.set(0,-1,0),s.cameraDirection="z"):this.cameraMotion.value.longitude===ViewDirection.RightSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.RightSide.latitude?(s.left.set(0,0,-1),s.up.set(0,-1,0),s.cameraDirection="x"):this.cameraMotion.value.longitude===ViewDirection.LeftSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.LeftSide.latitude&&(s.left.set(0,0,-1),s.up.set(0,1,0),s.cameraDirection="x");var c=(this.camera.position[s.cameraDirection]-a.min[s.cameraDirection])*Math.tan(this.camera.fov/2*Math.PI/180),l=this.renderer.getSize(new THREE__namespace.Vector2);o.add(panLeft(2*r*c/l.y,s.left)),o.add(panUp(2*i*c/l.y,s.up)),o.clamp(this.models.bounding.min,this.models.bounding.max);var u=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:o,distance:this.locationMotion.value.distance});e.state=u,this.emit("gesture.pan",e),e.defaultPrevented||this.locationMotion.set({x:o.x,y:o.y,z:o.z},0).catch(noop$1)}},t.prototype.onPinchGesture=function(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();var n=null===(t=this.pinchState)||void 0===t?void 0:t.fov;if(e.isFirst)this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};else if(e.isFinal&&delete this.pinchState,void 0!==n){var r=clamp(n/e.scale,this.minFov,this.maxFov),i=this.relativeClientPosition({x:e.center.x,y:e.center.y}),o=this.getZoomOffsetFromFov(i,this.camera,r);this.cameraMotion.value.longitude===ViewDirection.Top.longitude&&this.cameraMotion.value.latitude===ViewDirection.Top.latitude?o.y=0:this.cameraMotion.value.longitude===ViewDirection.FrontSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.FrontSide.latitude||this.cameraMotion.value.longitude===ViewDirection.BackSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.BackSide.latitude?o.z=0:(this.cameraMotion.value.longitude===ViewDirection.RightSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.RightSide.latitude||this.cameraMotion.value.longitude===ViewDirection.LeftSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.LeftSide.latitude)&&(o.x=0);var a=this.camera.pose.offset.clone().add(o);e.state.offset.copy(a),e.state.fov=r,this.emit("gesture.pinch",e),e.defaultPrevented||(this.locationMotion.set({x:a.x,y:a.y,z:a.z},0).catch(noop$1),this.cameraMotion.set({fov:r},0).catch(noop$1),e.type="gesture.pan",this.onPanGesture(e))}},t.prototype.onMouseWheel=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var t=clamp(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov),n=e.center.coords,r=this.getZoomOffsetFromFov(n,this.camera,t);this.cameraMotion.value.longitude===ViewDirection.Top.longitude&&this.cameraMotion.value.latitude===ViewDirection.Top.latitude?r.y=0:this.cameraMotion.value.longitude===ViewDirection.FrontSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.FrontSide.latitude||this.cameraMotion.value.longitude===ViewDirection.BackSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.BackSide.latitude?r.z=0:(this.cameraMotion.value.longitude===ViewDirection.RightSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.RightSide.latitude||this.cameraMotion.value.longitude===ViewDirection.LeftSide.longitude&&this.cameraMotion.value.latitude===ViewDirection.LeftSide.latitude)&&(r.x=0);var i=this.camera.pose.offset.clone().add(r);e.state.offset.copy(i),e.state.fov=t,this.emit("gesture.mousewheel",e),e.defaultPrevented||(this.locationMotion.set({x:i.x,y:i.y,z:i.z},0).catch(noop$1),this.cameraMotion.set({fov:t},0).catch(noop$1))},t}(FloorplanController),PanoramaLikeController=function(e){function t(n){var r=this,i=t.parseArgs(n);return(r=e.call(this,i)||this).mode="PanoramaLike",r.defaultLatitude=i.defaultLatitude,r.defaultFov=i.defaultFov,r.maxFov=i.maxFov,r.minFov=i.minFov,r.maxLatitude=i.maxLatitude,r.minLatitude=i.minLatitude,r.moveSpeed=i.moveSpeed,r.intersectMeshCreator=i.intersectMeshCreator,r.intersectMesh=r.intersectMeshCreator(),r.intersectMesh.name="intersect",r.intersectMesh.visible=!1,r.helper.add(r.intersectMesh),r}return __extends(t,e),t.parseArgs=function(n){var r,i,o,a,s,c,l,u;if(n instanceof t)return n;var p=e.parseArgs.call(this,n);return __assign(__assign({},p),{defaultLatitude:null!==(r=n.defaultLatitude)&&void 0!==r?r:0,defaultFov:null!==(i=n.defaultFov)&&void 0!==i?i:90,maxFov:null!==(o=n.maxFov)&&void 0!==o?o:120,minFov:null!==(a=n.minFov)&&void 0!==a?a:40,maxLatitude:null!==(s=n.maxLatitude)&&void 0!==s?s:+Math.PI/2,minLatitude:null!==(c=n.minLatitude)&&void 0!==c?c:-Math.PI/2,moveSpeed:null!==(l=n.moveSpeed)&&void 0!==l?l:3.4,intersectMeshCreator:null!==(u=n.intersectMeshCreator)&&void 0!==u?u:function(){return new IntersectMesh}})},t.initAnimationEndState=function(e){var t,n,r,i,o,a,s=this.parseArgs(e),c=s.works,l=e.initial,u=l.state,p=l.currentState,d="number"==typeof u.panoIndex?{workCode:null!==(r=null!==(t=u.workCode)&&void 0!==t?t:null===(n=s.works[0])||void 0===n?void 0:n.workCode)&&void 0!==r?r:"",panoIndex:u.panoIndex}:{workCode:p.workCode,panoIndex:p.panoIndex},h=c.getResolvedObserver(d),f=null!==(i=u.longitude)&&void 0!==i?i:p.longitude,m=clamp(null!==(o=u.latitude)&&void 0!==o?o:isFristPersonMode(p.mode)?p.latitude:s.defaultLatitude,s.minLatitude,s.maxLatitude),v=clamp(null!==(a=u.fov)&&void 0!==a?a:isFristPersonMode(p.mode)?p.fov:s.defaultFov,s.minFov,s.maxFov),A=h?h.position.clone():new THREE__namespace.Vector3;return{workCode:d.workCode,panoIndex:d.panoIndex,mode:"PanoramaLike",longitude:f,latitude:m,fov:v,offset:A,distance:0}},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),delete this.panState},t.prototype.isReady=function(){return!this.panState&&(!this.pinchState&&e.prototype.isReady.call(this))},t.prototype.calculateMovingDuration=function(e,t){switch(typeof e){case"function":return e(t,this.moveSpeed);case"number":return e;case"string":return Number(e);default:return clamp(t,2,5)/this.moveSpeed*1e3}},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t.prototype.coordinatesForOffset=function(e){var t=this.cameraMotion.value.fov,n=this.camera.aspect,r=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:2*e.x/(r.x*this.scissor.width)*t/95*n,latitude:-2*e.y/(r.y*this.scissor.height)*t/95}},t.prototype.cameraBounce=function(){var e=this.cameraMotion.value,t=e.longitude,n=e.latitude,r=e.fov,i=[{progress:0,value:{longitude:t,latitude:n,fov:r}},{progress:.5,value:{longitude:t,latitude:n,fov:.98*r}},{progress:1,value:{longitude:t,latitude:n,fov:r}}];this.cameraMotion.setKeyframes(i,500).catch(noop$1)},t.prototype.requestMomentumMovement=function(e,t,n,r){var i=this;if(null!==this.inMomentumMovement){for(var o=__assign({},n),a={longitude:0,latitude:0},s=0;s<r;s++)o.longitude*=.996,o.latitude*=.98604,a.longitude+=o.longitude,a.latitude+=o.latitude;var c=formatRad(this.cameraMotion.value.longitude+a.longitude),l=clamp(this.cameraMotion.value.latitude+a.latitude,this.minLatitude,this.maxLatitude),u=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:l,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),p=!(o.longitude>1e-4||o.longitude<-1e-4||o.latitude>1e-4||o.latitude<-1e-4),d=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:t,isFinal:p,state:u}));this.inMomentumMovement.event=d,this.emit("gesture.momentum",d),e.defaultPrevented?this.inMomentumMovement=null:this.inMomentumMovement&&(this.cameraMotion.set({longitude:c,latitude:l},0).catch(noop$1),p?this.inMomentumMovement=null:AnimationFrameLoop.shared.add((function(t,n){i.requestMomentumMovement(e,!1,o,0|n)}),!0,1))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var t=this.panState,n=e.pointers.length;if(e.isFinal?delete this.panState:this.panState={pointerLength:n,x:e.center.x,y:e.center.y},void 0!==t&&t.pointerLength===n){var r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.coordinatesForOffset(r),o=formatRad(this.cameraMotion.value.longitude+i.longitude),a=clamp(this.cameraMotion.value.latitude+i.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(a=this.cameraMotion.value.latitude);var s=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:a,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=s,this.emit("gesture.pan",e),!e.defaultPrevented){var c={longitude:s.longitude,latitude:s.latitude,fov:s.fov};if(this.cameraMotion.set(c,0).catch(noop$1),e.isFinal){var l=e.velocityX,u=.6*e.velocityY;Math.abs(u)>.5&&Math.abs(l)<.5&&(l=0),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:l,y:u}),0)}}}},t.prototype.onPinchGesture=function(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();var n=null===(t=this.pinchState)||void 0===t?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};else if(e.isFinal&&delete this.pinchState,void 0!==n){var i=clamp(n/r,this.minFov,this.maxFov);e.state.fov=i,this.emit("gesture.pinch",e),e.defaultPrevented||(this.cameraMotion.set({fov:i},0).catch(noop$1),e.type="gesture.pan",this.onPanGesture(e))}},t.prototype.onMouseWheel=function(e){this.userAction=e.userAction,this.stopMomentumMovement();var t=clamp(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(noop$1)},t.prototype.onMouseMove=function(e){var t,n;if(this.intersectMesh.parent&&!this.panState&&(this.emit("gesture.mousemove",e),!e.defaultPrevented)){var r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&!0===this.intersectMesh.visible)this.hideIntersectMesh();else{var i=this.models.intersectRaycaster(r)[0],o=createEvent("intersect.update",{raycaster:r,intersection:null!=i?i:null,object:this.intersectMesh});if(this.emit("intersect.update",o),o.defaultPrevented)this.hideIntersectMesh();else if(i){var a=null!==(n=null===(t=i.face)||void 0===t?void 0:t.normal)&&void 0!==n?n:(new THREE__namespace.Vector3).copy(r.ray.direction).multiplyScalar(-1),s=a.clone().multiplyScalar(.05),c=i.point.clone().add(s);this.intersectMesh.position.copy(c);var l=c.clone().add(s);if(this.intersectMesh.lookAt(l),Math.abs(a.y)>.99){var u=this.camera.position.clone().sub(c);this.intersectMesh.rotation.z=-Math.atan2(u.z,u.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}}},t}(BaseController),blankVideo="data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEg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AAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw",result;function canplayVideo(){return result||(result=new Promise((function(e){var t,n=document.createElement("video");n.muted=!0,n.src=blankVideo,n.addEventListener("timeupdate",(function r(){n.removeEventListener("timeupdate",r,!1),clearTimeout(t);var i=document.createElement("canvas");i.width=i.height=1;var o=i.getContext("2d");o?(o.drawImage(n,0,0,1,1),o.getImageData(0,0,1,1).data[3]>10?e(!0):e(!1)):e(!1)}),!1),n.addEventListener("canplay",(function e(){n.removeEventListener("canplay",e,!1),n.play()}),!1),t=window.setTimeout((function(){return e(!1)}),1e3)})))}var camera$1=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$4=new THREE__namespace.BufferGeometry;geometry$4.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$4.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$3=new THREE__namespace.Mesh(geometry$4),scene$1=new THREE__namespace.Scene;scene$1.add(mesh$3);var DEFAULT_VERTEX_SHADER="\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",Pass=function(){function e(e,t){var n;this.renderer=e,this.material=new THREE__namespace.ShaderMaterial({vertexShader:null!==(n=t.vertex)&&void 0!==n?n:DEFAULT_VERTEX_SHADER,fragmentShader:t.fragment,uniforms:Object.assign({inputBuffer:new THREE__namespace.Uniform(null)},t.uniforms),defines:Object.assign({},t.defines),blending:THREE__namespace.NoBlending,depthWrite:!1,depthTest:!1})}return e.prototype.render=function(e,t){var n=this.renderer.getRenderTarget(),r=mesh$3.material;this.material.uniforms.inputBuffer.value=e.texture,mesh$3.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(scene$1,camera$1),this.renderer.setRenderTarget(n),mesh$3.material=r},e.prototype.dispose=function(){this.material.dispose()},e}(),VALUE_VERTEX_SHADER="\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",VALUE_FRAGMENT_SHADER="\nuniform vec3 inputValue;\nvoid main() {\n gl_FragColor = vec4(inputValue, 1.0);\n}\n",ValuePass=function(){function e(e){this.renderer=e,this.material=new THREE__namespace.ShaderMaterial({vertexShader:VALUE_VERTEX_SHADER,fragmentShader:VALUE_FRAGMENT_SHADER,uniforms:Object.assign({inputValue:new THREE__namespace.Uniform(new THREE__namespace.Vector3)}),blending:THREE__namespace.NoBlending,depthWrite:!1,depthTest:!1})}return e.prototype.render=function(e,t){var n=this.renderer.getRenderTarget(),r=mesh$3.material;this.material.uniforms.inputValue.value.copy(e),mesh$3.material=this.material,this.renderer.setRenderTarget(t||null),this.renderer.render(scene$1,camera$1),this.renderer.setRenderTarget(n),mesh$3.material=r},e.prototype.dispose=function(){this.material.dispose()},e}(),FRAGMENT$1="\n#include <common>\nuniform sampler2D inputBuffer;\nuniform float scale;\nvarying vec2 vUv;\n\nvoid main() {\n float u = (vUv.x - 0.5) * scale + 0.5;\n float v = (vUv.y - 0.5) * scale + 0.5;\n vec3 rgb = texture2D(inputBuffer, vec2(u, v)).rgb;\n float luminance = clamp(linearToRelativeLuminance(rgb), 0.1, 0.9);\n gl_FragColor = vec4(luminance);\n}\n",LuminancePass=function(e){function t(t,n){return void 0===n&&(n=.5),e.call(this,t,{uniforms:{inputBuffer:new THREE__namespace.Uniform(null),scale:new THREE__namespace.Uniform(n)},fragment:FRAGMENT$1})||this}return __extends(t,e),t}(Pass),FRAGMENT="\nuniform sampler2D inputBuffer;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(inputBuffer, vUv);\n}\n",CopyPass=function(e){function t(t){return e.call(this,t,{fragment:FRAGMENT})||this}return __extends(t,e),t}(Pass),Effect=function(){function e(e,t,n,r){this.enable=!0,this.renderer=e,this.scene=t,this.camera=n,this.models=r,this.copyPass=new CopyPass(this.renderer)}return e.prototype.render=function(e,t){},e.prototype.dispose=function(){this.copyPass.dispose()},e}(),NextStepPass=function(e){function t(t,n){void 0===n&&(n=.002);var r=e.call(this,t,{uniforms:{targetBuffer:new THREE__namespace.Uniform(null),inputBuffer:new THREE__namespace.Uniform(null),step:new THREE__namespace.Uniform(n)},fragment:"\n uniform sampler2D targetBuffer;\n uniform sampler2D inputBuffer;\n uniform float step;\n varying vec2 vUv;\n void main() {\n\n #ifdef GL_EXT_shader_texture_lod\n #if __VERSION__ < 300\n float target = texture2DLodEXT(targetBuffer, vUv, 5.0).r;\n #else\n float target = textureLod(targetBuffer, vUv, 5.0).r;\n #endif\n #else\n float target = texture2D(targetBuffer, vUv).r;\n #endif\n float current = texture2D(inputBuffer, vUv).r;\n\n float result;\n if (abs(target - current) < step) {\n result = target;\n } else if (target - current > 0.0) {\n result = current + step;\n } else {\n result = current - step;\n }\n gl_FragColor = vec4(result, result, result, 1.0);\n }\n "})||this;return r.material.extensions.shaderTextureLOD=!0,r}return __extends(t,e),Object.defineProperty(t.prototype,"targetBuffer",{get:function(){return this.material.uniforms.targetBuffer.value},set:function(e){this.material.uniforms.targetBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"step",{get:function(){return this.material.uniforms.step.value},set:function(e){this.material.uniforms.step.value=e},enumerable:!1,configurable:!0}),t}(Pass),LuminanceAdaptivePass=function(e){function t(t){var n=e.call(this,t,{uniforms:{inputBuffer:new THREE__namespace.Uniform(null),luminanceAdaptiveBuffer:new THREE__namespace.Uniform(null),progress:new THREE__namespace.Uniform(0)},fragment:"\n #include <common>\n uniform sampler2D inputBuffer;\n uniform sampler2D luminanceAdaptiveBuffer;\n uniform float progress;\n varying vec2 vUv;\n\n void main() {\n float middleGrey = 1.5;\n float whitePoint = 13.0;\n float exposure = 1.4;\n vec4 inputColor = texture2D(inputBuffer, vUv);\n vec3 rgb = inputColor.rgb * exposure;\n float alpha = inputColor.a;\n float luminance = linearToRelativeLuminance(rgb);\n float lumAvg = texture2D(luminanceAdaptiveBuffer, vec2(0.5)).r;\n float lumScaled = (luminance * middleGrey) / max(lumAvg, 1e-6);\n float lumCompressed = lumScaled * (1.0 + lumScaled / (whitePoint * whitePoint));\n lumCompressed /= (1.0 + lumScaled);\n rgb = clamp(lumCompressed * rgb, 0.0, 1.0);\n gl_FragColor = mix(inputColor, vec4(rgb, alpha), progress * 0.9);\n }\n "})||this;return n.material.transparent=!0,n}return __extends(t,e),Object.defineProperty(t.prototype,"luminanceAdaptiveBuffer",{get:function(){return this.material.uniforms.luminanceAdaptiveBuffer.value},set:function(e){this.material.uniforms.luminanceAdaptiveBuffer.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"progress",{get:function(){return this.material.uniforms.progress.value},set:function(e){this.material.uniforms.progress.value=e},enumerable:!1,configurable:!0}),t}(Pass),LuminanceAdaptiveEffect=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r,i)||this;return o.enableTime=now(),o.renderer=t,o.valuePass=new ValuePass(o.renderer),o.luminancePass=new LuminancePass(o.renderer,Math.sqrt(1/3)),o.nextStepPass=new NextStepPass(o.renderer,.01),o.luminanceAdaptivePass=new LuminanceAdaptivePass(o.renderer),o}return __extends(t,e),t.prototype.render=function(e){if(!this.enable)return this.enableTime=null,void this.copyPass.render(e[0],e[1]);null===this.enableTime&&(this.enableTime=now()),this.luminanceTargetBuffer||(this.luminanceTargetBuffer=new THREE__namespace.WebGLRenderTarget(128,128,{minFilter:THREE__namespace.LinearMipmapLinearFilter,magFilter:THREE__namespace.LinearFilter,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1,format:THREE__namespace.RGBAFormat,generateMipmaps:!0}),this.nextStepPass.targetBuffer=this.luminanceTargetBuffer.texture),this.luminancePass.render(e[0],this.luminanceTargetBuffer),this.luminancePrevBuffer||(this.luminancePrevBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminancePrevBuffer)),this.luminanceNextBuffer||(this.luminanceNextBuffer=new THREE__namespace.WebGLRenderTarget(1,1,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,type:THREE__namespace.HalfFloatType,encoding:this.renderer.outputEncoding,stencilBuffer:!1,depthBuffer:!1}),this.valuePass.render(new THREE__namespace.Vector3(.5,.5,.5),this.luminanceNextBuffer),this.luminanceAdaptivePass.luminanceAdaptiveBuffer=this.luminanceNextBuffer.texture),this.copyPass.render(this.luminanceNextBuffer,this.luminancePrevBuffer),this.nextStepPass.render(this.luminancePrevBuffer,this.luminanceNextBuffer),this.luminanceAdaptivePass.progress=Math.min((now()-this.enableTime)/100,1),this.luminanceAdaptivePass.render(e[0])},t.prototype.dispose=function(){var e,t,n;null===(e=this.luminanceTargetBuffer)||void 0===e||e.dispose(),null===(t=this.luminancePrevBuffer)||void 0===t||t.dispose(),null===(n=this.luminanceNextBuffer)||void 0===n||n.dispose(),this.copyPass.dispose(),this.luminancePass.dispose(),this.nextStepPass.dispose(),this.luminanceAdaptivePass.dispose()},t}(Effect),_a$1,TILE_IMAGE_SIZE=512,MAX_TILE_COUNT=32,SQRT1_2=null!==(_a$1=Math.SQRT1_2)&&void 0!==_a$1?_a$1:Math.sqrt(2),TILE_QUATERNION={up:new THREE__namespace.Quaternion(SQRT1_2,0,0,SQRT1_2),down:new THREE__namespace.Quaternion(-SQRT1_2,0,0,SQRT1_2),left:new THREE__namespace.Quaternion(0,SQRT1_2,0,SQRT1_2),right:new THREE__namespace.Quaternion(0,-SQRT1_2,0,SQRT1_2),front:new THREE__namespace.Quaternion(0,0,0,1),back:new THREE__namespace.Quaternion(0,1,0,0)},vertices$2=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs$1=new Float32Array([0,0,1,0,0,1,1,1]),index$2=new Uint8Array([0,1,2,1,3,2]),geometry$3=new THREE__namespace.BufferGeometry;geometry$3.setAttribute("position",new THREE__namespace.BufferAttribute(vertices$2,3)),geometry$3.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs$1,2)),geometry$3.setIndex(new THREE__namespace.BufferAttribute(index$2,1));var TILE_MATERIAL_VERTEX_SHADER="\nuniform float flipY;\nvarying vec2 vUv;\nvoid main() {\n vUv = vec2(uv.x, mix(uv.y, (1.0 - uv.y), flipY));\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",TILE_MATERIAL_FRAGMENT_SHADER="\n#if defined(USE_LUMINANCE)\nuniform sampler2D luminanceMap;\n#endif\nuniform sampler2D map;\nvarying vec2 vUv;\n\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n #if defined(USE_LUMINANCE)\n gl_FragColor.a = 1.0 - texture2D(luminanceMap, vUv).r;\n #endif\n}\n",TileMaterial=function(e){function t(){var t=e.call(this,{uniforms:{map:{value:null},luminanceMap:{value:null},flipY:{value:0}},vertexShader:TILE_MATERIAL_VERTEX_SHADER,fragmentShader:TILE_MATERIAL_FRAGMENT_SHADER})||this;return t.depthTest=!1,t.depthWrite=!1,t.blending=THREE__namespace.NoBlending,t.map=t.uniforms.map.value,t.luminanceMap=t.uniforms.luminanceMap.value,t.flipY=t.uniforms.flipY.value,Object.defineProperties(t,{map:{get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},luminanceMap:{get:function(){return this.uniforms.luminanceMap.value},set:function(e){this.uniforms.luminanceMap.value=e,this.defines.USE_LUMINANCE=null!==e,this.needsUpdate=!0}},flipY:{get:function(){return 1===this.uniforms.flipY.value},set:function(e){this.uniforms.flipY.value=e?1:0}}}),t}return __extends(t,e),t}(THREE__namespace.ShaderMaterial),TileMesh=function(e){function t(t,n){var r=e.call(this,geometry$3,new TileMaterial)||this;return t.box.getCenter(r.position),r.quaternion.multiplyQuaternions((new THREE__namespace.Quaternion).setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),-Math.PI),TILE_QUATERNION[t.face]),r.scale.setScalar(t.size),r.node=t,r.name="tiling:tile",r.material.visible=!1,r.activeTime=-1,r.disposed=!1,r.needsRender=!1,r.frustumCulled=!1,n.then((function(e){var t=e[0],n=e[1];r.disposed?(t.dispose(),null==n||n.dispose()):(r.material.map=t,r.material.luminanceMap=n,r.material.flipY=!t.flipY,r.material.needsUpdate=!0,r.material.visible=!0,r.needsRender=!0)})).catch(noop$1),r}return __extends(t,e),t.prototype.updateTime=function(e){},t.prototype.dispose=function(){var e;this.disposed=!0,this.material.map&&(this.material.map.dispose(),null===(e=this.material.luminanceMap)||void 0===e||e.dispose()),this.material.dispose()},t}(THREE__namespace.Mesh),TilingObject3D=function(e){function t(){var t=e.call(this)||this;return t.needsRender=!1,t.name="tiling",t}return __extends(t,e),t}(THREE__namespace.Group),Tiling=function(){function e(e,t,n){this.disposed=!1,this.textureLoader=new TextureLoader,this.minLevel=t,this.level=0,this.panoId="[0]",this.pedding=0,this.tileTree=createTileCubeTree(this.minLevel),this.tileMeshes=new Map,this.resource=[],this.luminance=null,this.imageOptions=n,this.fetcher=e,this.object=new TilingObject3D,this.object.renderOrder=-3}return e.prototype.setFetcher=function(e){this.fetcher=e},e.prototype.cleanup=function(){var e=this;this.tileMeshes.forEach((function(t){t.dispose(),e.object.remove(t),e.object.needsRender=!0})),this.tileMeshes.clear()},e.prototype.setRotation=function(e){this.disposed||this.object.quaternion.equals(e)||(this.object.quaternion.copy(e),this.object.needsRender=!0)},e.prototype.setPosition=function(e){this.disposed||this.object.position.equals(e)||(this.object.position.copy(e),this.object.needsRender=!0)},e.prototype.setResource=function(e,t){var n,r;if(!this.disposed&&(this.resource!==e||this.luminance!==t)){this.cleanup(),this.resource=e;var i=null!==(r=null===(n=e.slice().sort((function(e,t){return t.level-e.level}))[0])||void 0===n?void 0:n.level)&&void 0!==r?r:0;this.tileTree=createTileCubeTree(i),this.luminance=t,this.object.needsRender=!0}},e.prototype.update=function(e,t,n){var r=this;if(!this.disposed){this.level=t;var i=e.planes[5].normal,o=[];t>=this.minLevel&&traverseTileCubeNode(this.tileTree,(function(n){if(!(n.level<r.minLevel))return!(n.level>t)&&(!!e.intersectsBox(n.box)&&void o.push(n))}));var a=new THREE__namespace.Vector3;o.sort((function(e,t){return e.level!==t.level?e.level-t.level:e.box.getCenter(a).angleTo(i)-t.box.getCenter(a).angleTo(i)}));for(var s=new Set,c=function(e){var t=l.resource.filter((function(t){return t.level===e.level}))[0];if(!t)return"continue";if(s.add(e),l.tileMeshes.has(e))return l.tileMeshes.get(e).activeTime=n,"continue";var i=t.size,o=l.imageOptions.transform,a=Math.pow(2,e.level)*e.position.y,c=Math.pow(2,e.level)*e.position.x,u="".concat(l.panoId,".").concat(e.face,".").concat(e.level,".").concat(a,".").concat(c),p=__assign(__assign({key:"pano_tile.".concat(u)},pick(l.imageOptions,["format","size","quality","sharpen","mappings"])),{size:i*e.size===TILE_IMAGE_SIZE?void 0:TILE_IMAGE_SIZE,cut:[i*e.position.x,i*e.position.y,i*e.size,i*e.size]}),d=l.textureLoader.loadTexture(t[e.face],{imageURL:{transform:o,options:p},viaAjax:canUseNativeImageBitmap,fetcher:l.fetcher}).then((function(e){return e.body})),h=null;if(l.luminance){var f=l.luminance[e.face],m=f.match(/\/cube_(\d+)\//),v=!!m&&Number(m[1]);if(!1!==v){var A=__assign(__assign({},p),{size:v*e.size==TILE_IMAGE_SIZE/2?void 0:TILE_IMAGE_SIZE/2,cut:[v*e.position.x,v*e.position.y,v*e.size,v*e.size],key:"pano_tile_luminance.".concat(u)});h=l.textureLoader.loadTexture(f,{imageURL:{transform:l.imageOptions.transform,options:A},viaAjax:canUseNativeImageBitmap,fetcher:l.fetcher}).then((function(e){return e.body})).catch((function(){return null}))}}l.pedding++;var g=Promise.all([d,h]).then((function(e){return r.pedding--,e}),(function(e){return r.pedding--,Promise.reject(e)})),y=new TileMesh(e,g);y.name="tiling:tile-".concat(u),y.activeTime=n,y.renderOrder=e.level,l.tileMeshes.set(e,y),l.object.needsRender=!0,l.object.add(y)},l=this,u=0,p=o;u<p.length;u++){c(m=p[u])}var d=[];this.tileMeshes.forEach((function(e,n){s.has(n)||d.push(n),e.visible=n.level<=t}));for(var h=0,f=d.sort((function(e,t){var n,i,o,a;return(null!==(i=null===(n=r.tileMeshes.get(t))||void 0===n?void 0:n.activeTime)&&void 0!==i?i:0)-(null!==(a=null===(o=r.tileMeshes.get(e))||void 0===o?void 0:o.activeTime)&&void 0!==a?a:0)})).slice(Math.max(0,MAX_TILE_COUNT-s.size));h<f.length;h++){var m=f[h],v=this.tileMeshes.get(m);v&&(v.dispose(),this.object.remove(v),this.object.needsRender=!0),this.tileMeshes.delete(m)}}},e.prototype.dispose=function(){this.cleanup(),this.resource=[],this.disposed=!0},e}(),vertices$1=new Float32Array([-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1]),index$1=new Uint8Array([0,2,1,2,3,1,4,6,5,6,7,5,8,10,9,10,11,9,12,14,13,14,15,13,16,18,17,18,19,17,20,22,21,22,23,21]),sharedGeometry$2=new THREE__namespace.BufferGeometry;sharedGeometry$2.setAttribute("position",new THREE__namespace.BufferAttribute(vertices$1,3)),sharedGeometry$2.setIndex(new THREE__namespace.BufferAttribute(index$1,1));var PANO_VIDEO_MATERIAL_VERTEX_SHADER="\n#if defined(USE_PANO_VIDEO)\nvarying vec3 worldPosition;\n#endif\nvoid main() {\n vec4 transformed = vec4(position, 1.0);\n #if defined(USE_PANO_VIDEO)\n worldPosition = (modelMatrix * transformed).xyz;\n #endif\n gl_Position = projectionMatrix * modelViewMatrix * transformed;\n}\n",PANO_VIDEO_TILE_MATERIAL_FRAGMENT_SHADER="\nuniform vec2 size;\nuniform mat4 matrix;\nuniform float alpha;\nuniform sampler2D map;\n#if defined(USE_PANO_VIDEO)\nvarying vec3 worldPosition;\n#endif\n#include <common>\nvoid main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n #if defined(USE_PANO_VIDEO)\n vec3 cameraToVertex = worldPosition - cameraPosition;\n vec4 mapCoods = vec4(cameraToVertex, 1.0) * matrix;\n vec2 uv = vec2(\n 0.5 + mapCoods.x / mapCoods.z / size.x,\n 0.5 - mapCoods.y / mapCoods.z / size.y\n );\n vec4 videoColor = texture2D(map, uv);\n float match = (1.0 - step(0.0, mapCoods.z)) * (1.0 - step(0.5, abs(uv.x - 0.5))) * (1.0 - step(0.5, abs(uv.y - 0.5)));\n float blendAlpha = clamp(0.0, 1.0, 5.0 * (1.0 - clamp(distance(uv, vec2(0.5, 0.5)) / 0.55 , 0.0, 1.0)));\n gl_FragColor = vec4(videoColor.rgb, match * blendAlpha * alpha);\n #endif\n}\n",PanoVideo=function(){function e(){this.material=new THREE__namespace.ShaderMaterial({vertexShader:PANO_VIDEO_MATERIAL_VERTEX_SHADER,fragmentShader:PANO_VIDEO_TILE_MATERIAL_FRAGMENT_SHADER,uniforms:{size:new THREE__namespace.Uniform(null),matrix:new THREE__namespace.Uniform(null),alpha:new THREE__namespace.Uniform(null),map:new THREE__namespace.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor}),this.object=new THREE__namespace.Mesh(sharedGeometry$2,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.name="pano-video",this.alphaMotion=new Motion({alpha:0})}return e.prototype.setMaterial=function(e){e?(this.material.uniforms.size.value=e.size,this.material.uniforms.matrix.value=e.matrix,this.material.uniforms.map.value=e.map,this.alphaMotion.set({alpha:e.alpha},500).catch(noop$1),this.material.uniforms.alpha.value=e.alpha):(this.material.uniforms.size.value=null,this.material.uniforms.matrix.value=null,this.material.uniforms.map.value=null,this.alphaMotion.set({alpha:0},0).catch(noop$1));var t=null!==e;t!==this.material.defines.USE_PANO_VIDEO&&(this.material.defines.USE_PANO_VIDEO=t,this.material.needsUpdate=!0,this.object.visible=null!==e)},e.prototype.updateTime=function(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)},e.prototype.dispose=function(){this.material.dispose()},e}(),ROTATE_Y_PI_MATRIX$1=(new THREE__namespace.Matrix4).makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE$2=new THREE__namespace.Vector3(-1,1,1),CubeRenderTargetPool=function(){function e(e){void 0===e&&(e=0),this.width=e,this.pool=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.pool.length},enumerable:!1,configurable:!0}),e.prototype.create=function(){return new THREE__namespace.WebGLCubeRenderTarget(this.width,{stencilBuffer:!1,depthBuffer:!1})},e.prototype.pop=function(){var e=this.pool.pop();return e||this.create()},e.prototype.push=function(e){-1===this.pool.indexOf(e)&&this.pool.push(e)},e.prototype.clear=function(){for(var e=0,t=this.pool;e<t.length;e++){t[e].dispose()}this.pool.length=0},e}(),PanoramaController=function(e){function t(n){var r,i,o,a,s=this,c=t.parseArgs(n);(s=e.call(this,c)||this).TILED_CUBE_TEXTURE_LEVEL=2,s.mode="Panorama",s.tileLevel=0,s.initAnimationed=!1,s.maxAccessibleDistance=c.maxAccessibleDistance,s.panoTapTriggerRadius=c.panoTapTriggerRadius,s.panoCircleMeshCreator=c.panoCircleMeshCreator,s.tileLevelForFov=c.tileLevelForFov,s.luminanceAdaptiveEffectEnable=c.luminanceAdaptiveEffectEnable,s.colorCubeRenderTargetPool=new CubeRenderTargetPool,s.luminanceCubeRenderTargetPool=new CubeRenderTargetPool;var l=s.models.getMaterial()||{},u=l.pano0,p=l.pano1;u&&(null==p?void 0:p.map)!==u.map&&(s.models.setMaterial({pano0:p}),u.map.dispose(),u.map instanceof TileCubeTextureTarget&&u.map.cubeRenderTarget&&s.colorCubeRenderTargetPool.push(u.map.cubeRenderTarget),u.luminanceMap&&(u.luminanceMap.dispose(),u.luminanceMap instanceof TileCubeTextureTarget&&u.luminanceMap.cubeRenderTarget&&s.luminanceCubeRenderTargetPool.push(u.luminanceMap.cubeRenderTarget)));for(var d=s.colorCubeRenderTargetPool.size;d<2;d++){var h=Math.max(1024*s.TILED_CUBE_TEXTURE_LEVEL,512),f=s.colorCubeRenderTargetPool.create();f.setSize(h,h),renderCubeTextureToCubeRenderTarget(null,f,s.renderer),s.colorCubeRenderTargetPool.push(f)}s.panoMeshes={},s.updatePanoMeshes(),s.locationMotion=new Motion({count:0,distance:s.camera.pose.distance}),s.modelAlphaMotion=new Motion({modelAlpha:null!==(i=null===(r=s.models.getMaterial())||void 0===r?void 0:r.modelAlpha)&&void 0!==i?i:0}),s.perspToOrthoMotion=new Motion({perspToOrtho:s.camera.perspToOrtho.x}),s.panoResources={},s.panoResources[s.locationMotion.keyframes[0].key=s.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(s.currentPano),panoPicture:null!==(a=null===(o=s.models.getMaterial())||void 0===o?void 0:o.pano1)&&void 0!==a?a:null,position:s.camera.pose.offset.clone(),effect:"fly"};var m=s.works.getResolvedObserver(s.currentPano);return s.textureLoader=new TextureLoader,s.tiling=new Tiling(m?getFetcher(m.work):internalFetcher,s.TILED_CUBE_TEXTURE_LEVEL+1,s.imageOptions),s.scene.add(s.tiling.object),s.panoVideo=new PanoVideo,s.scene.add(s.panoVideo.object),s}return __extends(t,e),t.parseArgs=function(n){var r,i,o,a,s;if(n instanceof t)return n;var c=e.parseArgs.call(this,n);return __assign(__assign({},c),{maxAccessibleDistance:null!==(r=n.maxAccessibleDistance)&&void 0!==r?r:5,panoTapTriggerRadius:null!==(i=n.panoTapTriggerRadius)&&void 0!==i?i:.5,panoCircleMeshCreator:null!==(o=n.panoCircleMeshCreator)&&void 0!==o?o:function(e){return new PanoCircleMesh},tileLevelForFov:null!==(a=n.tileLevelForFov)&&void 0!==a?a:function(e,t){var n=function(e){return e/180*Math.PI},r=t.height/2/Math.tan(n(e/2)),i=t.width>t.height?e:2*Math.atan(Math.tan(n(e/2))*(t.width/t.height))/Math.PI*180,o=r*(Math.tan(n(i/2))-Math.tan(n(i/2-1)));return o>60?4:o>30?3:o>18?2:o>12?1:0},luminanceAdaptiveEffectEnable:null===(s=n.luminanceAdaptiveEffectEnable)||void 0===s||s})},t.initAnimationEndState=function(t){var n=this.parseArgs(t),r=e.initAnimationEndState.call(this,n);return __assign(__assign({},r),{mode:"Panorama"})},t.prototype.destroy=function(){var t,n;if(e.prototype.destroy.call(this),this.scene.remove(this.tiling.object),this.tiling.dispose(),this.locationMotion.dispose(),this.colorCubeRenderTargetPool.clear(),this.luminanceCubeRenderTargetPool.clear(),delete this.pendingTextureTask,this.panoMeshes)for(var r=0,i=Object.keys(this.panoMeshes);r<i.length;r++){var o=i[r],a=this.panoMeshes[o];this.helper.remove(a),a.dispose(),delete this.panoMeshes[o]}var s=this.videoTexture.image;s.pause(),s.oncanplay=function(){},s.ontimeupdate=function(){},this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();for(var c=null!==(t=this.models.getMaterial())&&void 0!==t?t:{},l=c.pano0,u=c.pano1,p=0,d=Object.keys(this.panoResources);p<d.length;p++){var h=d[p],f=this.panoResources[h];if(f.panoPicture){var m=f.panoPicture.map;m&&m!==(null==l?void 0:l.map)&&m!==(null==u?void 0:u.map)&&(m.dispose(),null===(n=f.panoPicture.luminanceMap)||void 0===n||n.dispose(),f.panoPicture=null)}delete this.panoResources[h]}this.luminanceAdaptiveEffect&&(this.luminanceAdaptiveEffect.dispose(),delete this.luminanceAdaptiveEffect)},t.prototype.isReady=function(){return!0===this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.isTileReady=function(){var e,t,n,r=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),i=(null===(e=r.panoPicture)||void 0===e?void 0:e.map)instanceof TileCubeTextureTarget&&null!==(n=null===(t=r.panoPicture)||void 0===t?void 0:t.map.tilePending)&&void 0!==n?n:0,o=this.tiling.pedding;return this.initAnimationed&&i<=0&&o<=0},t.prototype.updateWork=function(e,n,r,i){var o=this;this.userAction=i,this.works=e;var a=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:r,state:n,userAction:i}})),s={workCode:a.workCode,panoIndex:a.panoIndex},c=this.works.getWork(s.workCode);return this.tiling.setFetcher(c?getFetcher(c):internalFetcher),this.tiling.cleanup(),this.initAnimationed=!1,this.hideIntersectMesh(),this.updatePanoMeshes(),this.moveToPano(s,{effect:"fade",duration:r,longitude:n.longitude,latitude:n.latitude,fov:n.fov,moveEndCallback:function(){o.initAnimationed=!0},moveCancelCallback:function(){o.initAnimationed=!0}},i),!0},t.prototype.updateModel=function(e){this.models=e,this.updatePanoMeshes()},t.prototype.updateTime=function(e,t){var n,r,i,o,a,s,c,l,u,p,d=this;if(!this.destroyed){var h={},f={},m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),v=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),A=!1;if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),f.longitude=this.cameraMotion.value.longitude,f.latitude=this.cameraMotion.value.latitude,f.fov=this.cameraMotion.value.fov),!1===this.modelAlphaMotion.ended&&(this.modelAlphaMotion.update(e),h.modelAlpha=this.modelAlphaMotion.value.modelAlpha),!1===this.perspToOrthoMotion.ended&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!1===this.locationMotion.ended){this.locationMotion.update(e);var g=this.locationMotion.getKeyFrameSegment(e),y=g[0],b=g[1],E=this.panoResourceFromLocationMotionKeyframe(y),_=this.panoResourceFromLocationMotionKeyframe(b),T=(new THREE__namespace.Vector3).copy(E.position),x=(new THREE__namespace.Vector3).copy(_.position),R=this.locationMotion.value.count-b.value.count+1;h.progress=R,_.panoPicture&&(R<1?E.panoPicture&&(h.pano0=E.panoPicture):h.pano0=_.panoPicture,h.pano1=_.panoPicture),A=h.useBlackTransition="instant"===_.effect||"montage"===_.effect,"fade"!==_.effect&&"montage"!==_.effect||(h.pano0&&E.panoPicture&&(h.pano0={map:h.pano0.map,luminanceMap:h.pano0.luminanceMap,matrix:E.panoPicture.matrix.clone().setPosition(_.position)}),T.copy(x)),f.distance=this.locationMotion.value.distance,f.offset=new THREE__namespace.Vector3(T.x+(x.x-T.x)*R,T.y+(x.y-T.y)*R,T.z+(x.z-T.z)*R);for(var w=[],M=[],S=0,C=this.locationMotion.keyframes;S<C.length;S++){var I=C[S],P=I.key,B=I.progress;void 0!==P&&(w.push(P),B>=this.locationMotion.progress&&M.push(P))}for(var O=0,k=Object.keys(this.panoResources);O<k.length;O++){var H=k[O];if(!(M.indexOf(H)>=0)){var F=this.panoResources[H];if(F.panoPicture){var L=F.panoPicture.map,D=F.panoPicture.luminanceMap;if(L){if(L===(null===(n=h.pano0)||void 0===n?void 0:n.map))continue;if(L===(null===(r=h.pano1)||void 0===r?void 0:r.map))continue;L instanceof TileCubeTextureTarget&&L.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(L.cubeRenderTarget),L.dispose(),D&&(D instanceof TileCubeTextureTarget&&D.cubeRenderTarget&&this.luminanceCubeRenderTargetPool.push(D.cubeRenderTarget),D.dispose()),F.panoPicture=null}}w.indexOf(H)>=0||delete this.panoResources[H]}}this.currentPano=panoParse(_.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(m.panoId),state:__assign(__assign(__assign(__assign({},panoParse(v.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),f),options:{},progress:this.locationMotion.progress,error:null}))}!1===isEmptyObject(h)&&((null===(i=h.pano0)||void 0===i?void 0:i.map)&&h.pano0.map instanceof TileCubeTextureTarget&&!h.pano0.map.cubeRenderTarget&&(h.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(o=h.pano0)||void 0===o?void 0:o.luminanceMap)&&h.pano0.luminanceMap instanceof TileCubeTextureTarget&&!h.pano0.luminanceMap.cubeRenderTarget&&(h.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),(null===(a=h.pano1)||void 0===a?void 0:a.map)&&h.pano1.map instanceof TileCubeTextureTarget&&!h.pano1.map.cubeRenderTarget&&(h.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(s=h.pano1)||void 0===s?void 0:s.luminanceMap)&&h.pano1.luminanceMap instanceof TileCubeTextureTarget&&!h.pano1.luminanceMap.cubeRenderTarget&&(h.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(h)),!1===isEmptyObject(f)&&this.setCamera(f);var N=this.works.getResolvedObserver(this.currentPano),V=this.locationMotion.ended?this.getForwardObserverOrNot():null;if(this.camera.pose.distance>.1||A){if(N)for(var U=0,Q=Object.keys(this.panoMeshes);U<Q.length;U++){var z=Q[U];(X=this.panoMeshes[z]).setOpacity(0),X.setCurrent(!1),X.updateTime&&X.updateTime(e,t)}}else if(N){var j=arrayMin(N.visibleIds,(function(e){var t=d.works.getResolvedObserver(e);return t?N.standingPosition.distanceTo(t.standingPosition):1/0}),!0)[1];j=clamp(j,2.5,1/0);for(var q=N.visibleIds.concat(panoStringify(this.currentPano)),G=this.camera.getDirection(new THREE__namespace.Vector3),K=0,W=Object.keys(this.panoMeshes);K<W.length;K++){z=W[K];var X=this.panoMeshes[z],J=this.works.getResolvedObserver(z);if(-1===q.indexOf(z))X.setCurrent(!1),X.setOpacity(0);else if(J)if(J.loadable||J.active){var Y=X.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);X.setCurrent(!X.loading&&0===X.progress&&null!==V&&V.panoId===z),X.setOpacity(Y<.01?0:clamp(j/Y*1.2,.4,.85));var Z=this.camera.position.clone().setY(X.position.y),$=(new THREE__namespace.Vector3).copy(X.position).sub(Z).normalize();if(z===panoStringify(this.currentPano)){var ee=clamp((.5-Z.distanceTo(X.position))/.5,0,1);$.multiplyScalar(1-ee).add(G.clone().multiplyScalar(ee))}$.length()>0&&X.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2($.x,$.z),0))}else X.setCurrent(!1),X.setOpacity(0);else X.setCurrent(!1),X.setOpacity(0);X.updateTime&&X.updateTime(e,t)}}var te=this.tileLevel=function(){if(!1===d.tileLevelForFov)return 0;var e=d.renderer.getDrawingBufferSize(new THREE__namespace.Vector2);e.width*=d.scissor.width,e.height*=d.scissor.height;var t=v.panoId,n=d.works.getResolvedObserver(t),r=d.imageOptions.size;if(void 0===r&&n){var i=n.images.up.match(/\/cube_(\d+)\//);i&&(r=Number(i[1]))}void 0===r&&(r=2048);var o=0;r>=1024&&(o=1),r>=2048&&(o=2),r>=4096&&(o=3),r>=8192&&(o=4);var a=d.tileLevelForFov(d.camera.fov,e);return a>o?a:0}(),ne=function(){var e=d.camera.quaternion.clone(),t=d.works.getResolvedObserver(v.panoId),n=null!=t?t:N;n&&e.premultiply(n.quaternion.clone().inverse());var r=(new THREE__namespace.Matrix4).makeRotationFromQuaternion(e),i=(new THREE__namespace.Matrix4).getInverse(r);return(new THREE__namespace.Frustum).setFromProjectionMatrix((new THREE__namespace.Matrix4).multiplyMatrices(d.camera.projectionMatrix,i))}();v.panoId===panoStringify(this.currentPano)&&((null===(c=v.panoPicture)||void 0===c?void 0:c.map)instanceof TileCubeTextureTarget&&(v.panoPicture.map.update(ne,te),!0===v.panoPicture.map.needsRender&&(v.panoPicture.map.needsRender=!1,this.needsRender=!0)),(null===(l=v.panoPicture)||void 0===l?void 0:l.luminanceMap)instanceof TileCubeTextureTarget&&(v.panoPicture.luminanceMap.update(ne,te),!0===v.panoPicture.luminanceMap.needsRender&&(v.panoPicture.luminanceMap.needsRender=!1,this.needsRender=!0)));var re=this.tiling.object.visible;if(this.initAnimationed){var ie=v.panoId,oe=this.works.getResolvedObserver(ie);oe&&isSimilarVector3(this.camera.position,oe.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==ie&&this.tiling.cleanup(),this.tiling.panoId=ie,this.tiling.setResource(null!==(p=null===(u=oe.images)||void 0===u?void 0:u.tiles)&&void 0!==p?p:[],this.enableIOSEDR&&oe.images.luminance?oe.images.luminance:null),this.tiling.setFetcher(getFetcher(oe.work)),this.tiling.setRotation(oe.quaternion),this.tiling.setPosition(oe.position),te>this.TILED_CUBE_TEXTURE_LEVEL?this.tiling.update(ne,te,e):this.tiling.update(ne,0,e)):this.tiling.object.visible=!1}else this.tiling.object.visible=!1;re!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e)}},t.prototype.render=function(){var t=this.works.getResolvedObserver(this.currentPano);t&&t.video&&(this.needsRender=!0),e.prototype.render.call(this)},t.prototype.postProcessing=function(e,t){if(!this.destroyed)return"luminance"===t?(this.luminanceAdaptiveEffect||(this.luminanceAdaptiveEffect=new LuminanceAdaptiveEffect(this.renderer,this.scene,this.camera,this.models),this.luminanceAdaptiveEffect.enable=this.luminanceAdaptiveEffectEnable),this.luminanceAdaptiveEffect.render(e)):void 0},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],t=this.locationMotion.getKeyFrameSegment(now())[1],n=this.panoResourceFromLocationMotionKeyframe(t),r=this.works.getResolvedObserver(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():this.camera.position.clone(),distance:this.locationMotion.value.distance}},t.prototype.moveToPano=function(e,t,n){var r,i,o,a,s=this;this.userAction=n,this.stopMomentumMovement();var c=this.works.getResolvedObserver(e);if(!c)throw new Error("Invalid PanoId ".concat(JSON.stringify(e)));var l=this.imageOptions.size;if(void 0===l&&c){var u=c.images.up.match(/\/cube_(\d+)\//);u&&(l=Number(u[1]))}void 0===l&&(l=2048);var p=this.imageOptions.transform,d=__assign({key:"pano.".concat(c.panoId)},pick(this.imageOptions,["format","size","quality","sharpen","mappings"])),h=c.images,f=null!==(i=null===(r=c.images.tiles)||void 0===r?void 0:r.filter((function(e){return e.size>l})))&&void 0!==i?i:null,m=p,v={key:"pano_luminance.".concat(c.panoId),size:d.size?d.size/2:1024},A=this.enableIOSEDR&&c.images.luminance?c.images.luminance:null,g=function(){if(!c.images.tiles)return null;if(!A)return null;var e=A.up.match(/\/cube_(\d+)\//),t=!!e&&Number(e[1]);return!1===t?null:null==f?void 0:f.map((function(e){return{level:e.level,size:t,back:A.back,front:A.front,left:A.left,right:A.right,up:A.up,down:A.down}}))}(),y="pano:"+jsonHash([h,d,p]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===y)return;var b=this.pendingTextureTask.panoId;null===(o=this.panoMeshes[b])||void 0===o||o.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:c.pano})),this.pendingTextureTask.onError(new Error("texture aborted"))}var E="move-to-pano-"+c.panoId;this.pending.add(E);var _,T=this.models.getMaterial()||{},x=T.pano0,R=T.pano1;if(x&&x.map.name===y&&null!==x.luminanceMap===this.enableIOSEDR?_=x:(null==R?void 0:R.map.name)===y&&null!==R.luminanceMap===this.enableIOSEDR&&(_=R),_){var w={panoId:c.panoId,effect:null!==(a=t.effect)&&void 0!==a?a:"fly",panoPicture:{map:_.map,luminanceMap:_.luminanceMap,matrix:(new THREE__namespace.Matrix4).compose(c.position,c.quaternion,PANO_TEXTURE_SCALE$2)},position:c.position.clone()};AnimationFrameLoop.shared.add((function(){s.pending.delete(E),s.doMoveToPano(c.pano,w,t)}),!0,1)}else{this.pendingTextureTask={panoId:c.panoId,hash:y,onLoad:function(e,n){var r,i;if(s.pending.delete(E),s.destroyed)e.body.dispose();else{e.body.name=y;var o={panoId:c.panoId,effect:null!==(r=t.effect)&&void 0!==r?r:"fly",panoPicture:{map:e.body,luminanceMap:null!==(i=null==n?void 0:n.body)&&void 0!==i?i:null,matrix:(new THREE__namespace.Matrix4).compose(c.position,c.quaternion,PANO_TEXTURE_SCALE$2)},position:c.position.clone()};s.doMoveToPano(c.pano,o,t)}},onError:function(e){s.pending.delete(E);var n=__assign(__assign(__assign({},c.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:e,userAction:s.userAction,options:t,prevPano:s.currentPano,progress:0,state:n})),s.emit("pano.cancel",createEvent("pano.cancel",{error:e,userAction:s.userAction,options:t,prevPano:s.currentPano,progress:0,state:n})),s.emit("error",e),t.moveCancelCallback&&t.moveCancelCallback()}};var M=this.panoMeshes[c.panoId];M&&M.tap&&M.tap(),Promise.all([this.tileLevelForFov&&f&&f.length?this.textureLoader.loadTiledCubeTexture(h,f,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:p,options:d},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(c.work)},void 0,void 0,(function(e){var t,n;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:e,meta:null,pano:c.pano})),(null===(t=s.pendingTextureTask)||void 0===t?void 0:t.hash)===y&&(null===(n=s.panoMeshes[c.panoId])||void 0===n||n.setProgress(e))}),this.renderer):this.textureLoader.loadCubeTexture(h,{imageURL:{transform:p,options:d},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(c.work)},void 0,void 0,(function(e){var t,n;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:e,meta:null,pano:c.pano})),(null===(t=s.pendingTextureTask)||void 0===t?void 0:t.hash)===y&&(null===(n=s.panoMeshes[c.panoId])||void 0===n||n.setProgress(e))}),this.renderer),A?this.tileLevelForFov&&g&&g.length?this.textureLoader.loadTiledCubeTexture(A,g,{tileImageSize:256,tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:m,options:v},fetcher:getFetcher(c.work)},void 0,void 0,void 0,this.renderer).catch((function(){return null})):this.textureLoader.loadCubeTexture(A,{imageURL:{transform:m,options:v},fetcher:getFetcher(c.work)},void 0,void 0,void 0,this.renderer).catch((function(){return null})):Promise.resolve(null)]).then((function(e){var t,n,r=e[0],i=e[1];(null===(t=s.pendingTextureTask)||void 0===t?void 0:t.hash)===y?(s.pendingTextureTask.onLoad(r,i),null===(n=s.panoMeshes[c.panoId])||void 0===n||n.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:r.meta,pano:c.pano}))):(r.body.dispose(),null==i||i.body.dispose())})).catch((function(e){var t,n;(null===(t=s.pendingTextureTask)||void 0===t?void 0:t.hash)===y&&(s.pendingTextureTask.onError(e),null===(n=s.panoMeshes[c.panoId])||void 0===n||n.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:e,progress:0,meta:null,pano:c.pano})),s.emit("error",e))})),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:c.pano}))}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(n){var r=e.initial;r.state,r.currentState;var i=r.duration,o=r.userAction;e.userAction=o;var a=t.initAnimationEndState(e),s={workCode:a.workCode,panoIndex:a.panoIndex},c={modelAlpha:0},l={perspToOrtho:0},u=!1;e.moveToPano(s,{longitude:a.longitude,latitude:a.latitude,fov:a.fov,duration:i,moveStartCallback:function(t){u=!0,e.perspToOrthoMotion.set(l,i).catch(noop$1),e.modelAlphaMotion.setKeyframes([{progress:0,value:__assign({},e.modelAlphaMotion.value)},{progress:.6,value:__assign({},e.modelAlphaMotion.value)},{progress:1,value:c}],i).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:t,userAction:e.userAction}))},moveEndCallback:function(t){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:t,userAction:e.userAction})),e.initAnimationed=!0,n()},moveCancelCallback:function(){var t=__assign(__assign(__assign({},s),{mode:e.mode}),clonePose(e.camera.pose));!1===u&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:t,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:t,userAction:e.userAction})),e.initAnimationed=!0,n()}},o)}))},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var t=0,n=1;n<e.length;n++){var r=this.panoResourceFromLocationMotionKeyframe(e[n-1]).position,i=this.panoResourceFromLocationMotionKeyframe(e[n]).position;t+=r.distanceTo(i)*(e[n].value.count-e[n-1].value.count)}return t},t.prototype.updatePanoMeshes=function(){for(var e=this,t={},n=0,r=Object.keys(this.panoMeshes);n<r.length;n++){var i=r[n],o=this.panoMeshes[i];t[i]=o,delete this.panoMeshes[i]}for(var a=1,s={},c=function(t){var n=arrayMin(t.accessibleIds,(function(n){var r=e.works.getResolvedObserver(n);return r?clamp(r.standingPosition.distanceTo(t.standingPosition),1,1/0):1/0}),!0)[1];void 0===s[t.panoId]&&(s[t.panoId]=n)},l=0,u=this.works.resolvedObservers;l<u.length;l++){c(f=u[l])}var p=Object.keys(s).map((function(e){return s[e]}));p.length&&(a=clamp(.6*(p.reduce((function(e,t){return e+t}),0)/p.length),1,3));for(var d=0,h=this.works.resolvedObservers;d<h.length;d++){var f;o=void 0;t[(f=h[d]).panoId]?(!0===(o=t[f.panoId]).loading&&!1===f.loadable&&o.setLoading(!1),delete t[f.panoId]):((o=this.panoCircleMeshCreator(f.pano)).name="PanoCircleMesh_"+f.panoId,this.helper.add(o)),o.scale.set(a,1,a),o.position.copy(f.standingPosition),this.panoMeshes[f.panoId]=o}for(var m=0,v=Object.keys(t);m<v.length;m++){var A=v[m];this.helper.remove(t[A]),t[A].dispose(),delete t[A]}},t.prototype.doMoveToPano=function(e,t,n){var r,i,o,a,s=this;void 0===n&&(n={});var c=now(),l=createUuid();this.tiling.cleanup(),this.panoResources[l]=t;var u,p,d;if(this.locationMotion.ended){var h=this.locationMotion.getKeyFrameSegment(c);h[0];var f=h[1],m=this.locationMotion.value,v=(null!==(r=this.panoResourceFromLocationMotionKeyframe(f))&&void 0!==r?r:this.camera).position,A=t.position;u=Math.max(v.distanceTo(A),1),p=[{key:f.key,progress:0,value:__assign(__assign({},m),{count:0})},{key:l,progress:1,value:{distance:0,count:1}}],d=0}else{var g=this.locationMotion.getKeyFrameSegment(c),y=g[0],b=(f=g[1],m=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(y).position),E=(v=this.panoResourceFromLocationMotionKeyframe(f).position,A=t.position,f.value.count-m.count),_=Math.max(b.distanceTo(v),1)*E;u=_+Math.max(v.distanceTo(A),1),p=[{key:y.key,progress:0,value:__assign({},m)},{key:f.key,progress:_/u,value:f.value},{key:l,progress:1,value:{count:f.value.count+1,distance:0}}];var T=this.locationMotionKeyframesLength(this.locationMotion.keyframes),x=this.locationMotionKeyframesLength(p);d=0===T||0===T?0:this.locationMotion.getProgressVelocity(c)*T/x}var R=this.calculateMovingDuration(n.duration,"fade"===n.effect||"montage"===n.effect?0:u),w={longitude:n.longitude,latitude:n.latitude,fov:n.fov},M=__assign(__assign({},e),{mode:this.mode,longitude:null!==(i=w.longitude)&&void 0!==i?i:this.camera.pose.longitude,latitude:null!==(o=w.latitude)&&void 0!==o?o:this.camera.pose.latitude,fov:null!==(a=w.fov)&&void 0!==a?a:this.camera.pose.fov,offset:t.position.clone(),distance:this.camera.pose.distance}),S=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:n,prevPano:S,progress:0,state:M,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(M),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(w,R).catch(noop$1),this.locationMotion.setKeyframes(p,R,d).then((function(){var t,r,i=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:s.camera.pose.distance});s.emit("pano.arrived",createEvent("pano.arrived",{options:n,prevPano:S,progress:1,state:i,userAction:s.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(i);var o=s.works.getResolvedObserver(e);if(o&&o.video&&s.videoTexture&&s.videoTexture.image instanceof HTMLVideoElement){var a=ROTATE_Y_PI_MATRIX$1.clone().multiply(null!==(r=null===(t=s.models.getMaterial().pano1)||void 0===t?void 0:t.matrix)&&void 0!==r?r:new THREE__namespace.Matrix4).multiply(o.video.matrix),c={map:s.videoTexture,size:o.video.size,matrix:a,alpha:1},l=createUuid(),u=s.videoTexture.image;u.setAttribute("uuid",l),canplayVideo().then((function(e){e&&o.video&&u.getAttribute("uuid")===l&&(u.oncanplay=function(){u.oncanplay=noop$1,u.play()},u.ontimeupdate=function(){u.currentTime>.5&&(u.ontimeupdate=noop$1,s.panoVideo.setMaterial(c))},u.src=o.video.source)})).catch((function(){u.removeAttribute("uuid")}))}}),(function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:n,prevPano:S,progress:0,state:M,userAction:s.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()}))},t.prototype.getForwardObserverOrNot=function(e){var t=this,n=this.works.getResolvedObserver(this.currentPano);if(!n)return null;var r=null!=e?e:new THREE__namespace.Raycaster(this.camera.position.clone(),this.camera.getDirection(new THREE__namespace.Vector3));r.params.Points={threshold:.1};var i=n.standingPosition.clone();if(n.position.distanceTo(r.ray.origin)>1){var o=this.models.intersectRaycaster(new THREE__namespace.Raycaster(r.ray.origin,new THREE__namespace.Vector3(0,-1,0)))[0];o&&o.distance<=2?i.copy(o.point):i.copy(r.ray.origin).add(new THREE__namespace.Vector3(0,-1.5,0))}var a=this.models.intersectRaycaster(r)[0],s=(a?a.point:r.ray.origin.clone().add(r.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(i).normalize();if(0===s.length())return null;for(var c=n.accessibleIds.filter((function(e){if(e===panoStringify(t.currentPano))return!1;var n=t.works.getResolvedObserver(e);if(!n)return!1;var r=n.standingPosition.clone().project(t.camera);return!(Math.abs(r.z)>1)&&(!(Math.abs(r.x)>1)&&(!(Math.abs(r.y)>1)&&(n.loadable||n.active)))})).slice().sort((function(e,n){return t.works.getResolvedObserver(e).standingPosition.clone().distanceTo(i)-t.works.getResolvedObserver(n).standingPosition.clone().distanceTo(i)})),l=0,u=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];l<u.length;l++)for(var p=u[l],d=0,h=c;d<h.length;d++){var f=h[d],m=this.works.getResolvedObserver(f);if(m){var v=m.standingPosition.clone().sub(i);if(v&&0!==v.length()&&s.angleTo(v)<p)return m}}return null},t.prototype.onTapGesture=function(e){var t,n=this;if(this.userAction=e.userAction,this.stopMomentumMovement(),this.initAnimationed){if(!this.locationMotion.ended)if(this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]).panoId!==panoStringify(this.currentPano))return;var r=e.center.raycaster,i=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),o=null,a=this.works.getResolvedObserver(this.currentPano);if(a){var s=a.accessibleIds.filter((function(e){if(e===panoStringify(n.currentPano))return!1;var t=n.works.getResolvedObserver(e);return!!t&&(!(t.position.distanceTo(n.camera.position)>n.maxAccessibleDistance)&&(t.loadable||t.active))})),c=this.models.intersectRaycaster(r)[0];if(c){var l=arrayMin(s,(function(e){var t=n.works.getResolvedObserver(e);return t?t.standingPosition.clone().distanceTo(c.point):1/0}),!0),u=l[0],p=l[1];u&&p<this.panoTapTriggerRadius&&(o=null!==(t=this.works.getResolvedObserver(u))&&void 0!==t?t:null)}o||(o=this.getForwardObserverOrNot(r));for(var d=0,h=this.locationMotion.keyframes;d<h.length;d++){var f=h[d],m=this.panoResourceFromLocationMotionKeyframe(f);if(!(f.progress<this.locationMotion.progress)&&(o&&m.panoId===o.panoId)){o=null;break}}if(o){for(var v={},A=Math.PI/6,g=Math.PI/12,y=o.position.clone().setY(0).sub(a.position.clone().setY(0)).normalize(),b=[],E=0,_=o.accessibleIds;E<_.length;E++){var T=panoParse(u=_[E]);if(!panoEqual(T,this.currentPano)&&!panoEqual(T,o.pano)){var x=this.works.getResolvedObserver(u);if(x){var R=x.position.clone().sub(o.position).setY(0);y.angleTo(R)<A&&b.push(R)}}}var w=(b.length>0?b:__spreadArray(__spreadArray([],[],!0),[],!0)).slice().sort((function(e,t){return e.angleTo(y)-t.angleTo(y)}))[0];w&&w.angleTo(i)>g&&(v.longitude=Math.atan2(-w.x,-w.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(v.latitude=clamp(0,this.minLatitude,this.maxLatitude));var M=__assign({},e.state);if(M.workCode=o.pano.workCode,M.panoIndex=o.pano.panoIndex,void 0!==v.longitude&&(M.longitude=v.longitude),void 0!==v.latitude&&(M.latitude=v.latitude),void 0!==v.fov&&(M.fov=v.fov),M.distance=0,M.offset=o.position.clone(),e.state=M,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:M,userAction:e.userAction,options:v,progress:0,error:null})),o&&!o.active){var S=o.panoId;this.panoMeshes[S]&&(this.panoMeshes[S].setDisabled(!1),this.panoMeshes[S].setLoading(!0))}o&&o.active&&this.emit("pano.request",createEvent("pano.request",{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:M,options:v,error:null}))}}else this.emit("gesture.tap",e),e.defaultPrevented||!0===this.locationMotion.ended&&this.cameraBounce()}}},t}(PanoramaLikeController),DEG_TO_RAD=Math.PI/180,RAD_TO_DEG=180/Math.PI,MIN_TIMESTEP=.001,MAX_TIMESTEP=1,isIOS=(isIOS2="undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.platform),function(){return isIOS2}),isIOS2,isSafari=(isSafari2="undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent),function(){return isSafari2}),isSafari2,isFirefoxAndroid=(isFirefoxAndroid2="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android"),function(){return isFirefoxAndroid2}),isFirefoxAndroid2,getChromeVersion=(match2="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9]+)/):null,value2=match2?parseInt(match2[1],10):null,function(){return value2}),match2,value2,isChromeWithoutDeviceMotion=function(){var e=!1;if(65===getChromeVersion()){var t="undefined"!=typeof navigator?navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/):null;if(t){var n=t[1].split(".");n[0],n[1];var r=n[2],i=n[3];e=3325===parseInt(r,10)&&parseInt(i,10)<148}}return function(){return e}}(),isSafariWithoutDeviceMotion=function(){var e=isIOS()&&isSafari()&&"undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("13_4");return function(){return e}}(),isR7=(isR72="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("R7 Build"),function(){return isR72}),isR72;function isLandscapeMode(){var e="undefined"!=typeof window&&(90==window.orientation||-90==window.orientation);return isR7()?!e:e}function isTimestampDeltaValid(e){return!isNaN(e)&&(!(e<=MIN_TIMESTEP)&&!(e>MAX_TIMESTEP))}function getQuaternionAngle(e){return e.w>1?0:2*Math.acos(e.w)}var warnOnce=function(){var e={};return function(t,n){void 0===e[t]&&(console.warn("cardboard: "+n),e[t]=!0)}}();function getOriginFromUrl(e){var t,n=e.indexOf("://");t=-1!==n?n+3:0;var r=e.indexOf("/",t);return-1===r&&(r=e.length),e.substring(0,r)}function isInsideCrossOriginIFrame(){if("undefined"==typeof window)return!1;if("undefined"==typeof document)return!1;var e=window.self!==window.top,t=getOriginFromUrl(document.referrer),n=getOriginFromUrl(window.location.href);return e&&t!==n}var updateEyeViewMatrices=function(){return function(e,t,n){var r,i,o,a,s,c,l,u,p,d,h,f,m,v,A,g,y,b,E;r=e,a=(i=t)?i[0]:0,s=i?i[1]:0,c=i?i[2]:0,l=i?i[3]:1,h=a*(u=a+a),f=a*(p=s+s),m=a*(d=c+c),v=s*p,A=s*d,g=c*d,y=l*u,b=l*p,E=l*d,r[0]=1-(v+g),r[1]=f+E,r[2]=m-b,r[3]=0,r[4]=f-E,r[5]=1-(h+g),r[6]=A+y,r[7]=0,r[8]=m+b,r[9]=A-y,r[10]=1-(h+v),r[11]=0,r[12]=o?o[0]:0,r[13]=o?o[1]:0,r[14]=o?o[2]:0,r[15]=1,n&&function(e,t,n){var r,i,o,a,s,c,l,u,p,d,h,f,m=n[0],v=n[1],A=n[2];t===e?(e[12]=t[0]*m+t[4]*v+t[8]*A+t[12],e[13]=t[1]*m+t[5]*v+t[9]*A+t[13],e[14]=t[2]*m+t[6]*v+t[10]*A+t[14],e[15]=t[3]*m+t[7]*v+t[11]*A+t[15]):(r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],c=t[5],l=t[6],u=t[7],p=t[8],d=t[9],h=t[10],f=t[11],e[0]=r,e[1]=i,e[2]=o,e[3]=a,e[4]=s,e[5]=c,e[6]=l,e[7]=u,e[8]=p,e[9]=d,e[10]=h,e[11]=f,e[12]=r*m+s*v+p*A+t[12],e[13]=i*m+c*v+d*A+t[13],e[14]=o*m+l*v+h*A+t[14],e[15]=a*m+u*v+f*A+t[15])}(e,e,n),function(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],c=t[6],l=t[7],u=t[8],p=t[9],d=t[10],h=t[11],f=t[12],m=t[13],v=t[14],A=t[15],g=n*s-r*a,y=n*c-i*a,b=n*l-o*a,E=r*c-i*s,_=r*l-o*s,T=i*l-o*c,x=u*m-p*f,R=u*v-d*f,w=u*A-h*f,M=p*v-d*m,S=p*A-h*m,C=d*A-h*v,I=g*C-y*S+b*M+E*w-_*R+T*x;I&&(I=1/I,e[0]=(s*C-c*S+l*M)*I,e[1]=(i*S-r*C-o*M)*I,e[2]=(m*T-v*_+A*E)*I,e[3]=(d*_-p*T-h*E)*I,e[4]=(c*w-a*C-l*R)*I,e[5]=(n*C-i*w+o*R)*I,e[6]=(v*b-f*T-A*y)*I,e[7]=(u*T-d*b+h*y)*I,e[8]=(a*S-s*w+l*x)*I,e[9]=(r*w-n*S-o*x)*I,e[10]=(f*_-m*b+A*g)*I,e[11]=(p*b-u*_-h*g)*I,e[12]=(s*R-a*M-c*x)*I,e[13]=(n*M-r*R+i*x)*I,e[14]=(m*y-f*E-v*g)*I,e[15]=(u*E-p*y+d*g)*I)}(e,e)}}(),SensorSample=function(){function e(e,t){void 0===e&&(e=new THREE__namespace.Vector3),void 0===t&&(t=0),this.sample=e,this.timestampS=t}return e.prototype.set=function(e,t){this.sample=e,this.timestampS=t},e.prototype.copy=function(e){this.set(e.sample,e.timestampS)},e}(),ComplementaryFilter=function(){function e(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new SensorSample,this.currentGyroMeasurement=new SensorSample,this.previousGyroMeasurement=new SensorSample,isIOS()?this.filterQ=new THREE__namespace.Quaternion(-1,0,0,1):this.filterQ=new THREE__namespace.Quaternion(1,0,0,1),this.previousFilterQ=new THREE__namespace.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new THREE__namespace.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new THREE__namespace.Vector3,this.measuredGravity=new THREE__namespace.Vector3,this.gyroIntegralQ=new THREE__namespace.Quaternion}return e.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},e.prototype.addGyroMeasurement=function(e,t){this.currentGyroMeasurement.set(e,t),isTimestampDeltaValid(t-this.previousGyroMeasurement.timestampS)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},e.prototype.getOrientation=function(){return this.filterQ},e.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var n=new THREE__namespace.Quaternion;n.copy(this.filterQ),n.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(n),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var r=new THREE__namespace.Quaternion;r.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),r.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",RAD_TO_DEG*getQuaternionAngle(r),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));var i=new THREE__namespace.Quaternion;i.copy(this.filterQ),i.multiply(r),this.filterQ.slerp(i,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},e.prototype.accelToQuaternion_=function(e){var t=new THREE__namespace.Vector3;t.copy(e),t.normalize();var n=new THREE__namespace.Quaternion;return n.setFromUnitVectors(new THREE__namespace.Vector3(0,0,-1),t),n.inverse(),n},e.prototype.gyroToQuaternionDelta_=function(e,t){var n=new THREE__namespace.Quaternion,r=new THREE__namespace.Vector3;return r.copy(e),r.normalize(),n.setFromAxisAngle(r,e.length()*t),n},e}(),PosePredictor=function(){function e(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new THREE__namespace.Quaternion,this.previousTimestampS=null,this.deltaQ=new THREE__namespace.Quaternion,this.outQ=new THREE__namespace.Quaternion}return e.prototype.getPrediction=function(e,t,n){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=n,e;var r=new THREE__namespace.Vector3;r.copy(t),r.normalize();var i=t.length();if(i<20*DEG_TO_RAD)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(RAD_TO_DEG*i).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;var o=i*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(r,o),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=n,this.outQ},e}(),Distortion=function(){function e(e){this.coefficients=e}return e.prototype.distortInverse=function(e){for(var t=0,n=1,r=e-this.distort(t);Math.abs(n-t)>1e-4;){var i=e-this.distort(n),o=n-i*((n-t)/(i-r));t=n,n=o,r=i}return n},e.prototype.distort=function(e){for(var t=e*e,n=0,r=0;r<this.coefficients.length;r++)n=t*(n+this.coefficients[r]);return(n+1)*e},e}(),Pose=function(){return function(){this.angularAcceleration=null,this.angularVelocity=null,this.linearAcceleration=null,this.linearVelocity=null,this.orientation=null,this.position=null}}(),FieldOfView=function(){return function(){this.leftDegrees=0,this.rightDegrees=0,this.upDegrees=0,this.downDegrees=0}}(),Sensor=function(){function e(e,t,n,r){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=n,this.accelerometer=new THREE__namespace.Vector3,this.gyroscope=new THREE__namespace.Vector3,this.filter=new ComplementaryFilter(e,r),this.posePredictor=new PosePredictor(t,r),this.isFirefoxAndroid=isFirefoxAndroid(),this.isIOS=isIOS();var i=getChromeVersion();this.isDeviceMotionInRadians=!this.isIOS&&null!==i&&i<66,this.isWithoutDeviceMotion=isChromeWithoutDeviceMotion()||isSafariWithoutDeviceMotion(),this.filterToWorldQ=new THREE__namespace.Quaternion,isIOS()?this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new THREE__namespace.Quaternion,this.worldToScreenQ=new THREE__namespace.Quaternion,this.originalPoseAdjustQ=new THREE__namespace.Quaternion;var o="undefined"!=typeof window?-window.orientation*Math.PI/180:0;this.originalPoseAdjustQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),o),this.setScreenTransform_(),isLandscapeMode()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new THREE__namespace.Quaternion,this.orientationOut_=new Float32Array(4),this.previousTimestampS=Date.now()}return e.prototype.getPosition=function(){return null},e.prototype.getOrientation=function(){var e;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(r=(new THREE__namespace.Quaternion).setFromAxisAngle(new THREE__namespace.Vector3(0,0,-1),0),i=new THREE__namespace.Quaternion,"undefined"!=typeof window&&-90===window.orientation?i.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/-2):i.setFromAxisAngle(new THREE__namespace.Vector3(0,1,0),Math.PI/2),r.multiply(i)),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((n=new THREE__namespace.Quaternion).setFromAxisAngle(new THREE__namespace.Vector3(1,0,0),-Math.PI/2),n),e=this._deviceOrientationQ;var t=new THREE__namespace.Quaternion;return t.copy(e),t.multiply(this.deviceOrientationFilterToWorldQ),t.multiply(this.resetQ),t.multiply(this.worldToScreenQ),t.multiplyQuaternions(this.deviceOrientationFixQ,t),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}var n,r,i,o=this.filter.getOrientation();e=this.posePredictor.getPrediction(o,this.gyroscope,this.previousTimestampS);var a=new THREE__namespace.Quaternion;return a.copy(this.filterToWorldQ),a.multiply(this.resetQ),a.multiply(e),a.multiply(this.worldToScreenQ),this.yawOnly&&(a.x=0,a.z=0,a.normalize()),this.orientationOut_[0]=a.x,this.orientationOut_[1]=a.y,this.orientationOut_[2]=a.z,this.orientationOut_[3]=a.w,this.orientationOut_},e.prototype.getPose=function(){var e=new Pose;return e.orientation=this.getOrientation(),e},e.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),isLandscapeMode()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},e.prototype.getFrameData=function(e){var 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),updateEyeViewMatrices(e.leftViewMatrix,t,n.left),updateEyeViewMatrices(e.rightViewMatrix,t,n.right),e},e.prototype.start=function(){if("undefined"==typeof window)return function(){};var e=this.onDeviceMotion_.bind(this),t=this.onOrientationChange_.bind(this),n=this.onMessage_.bind(this),r=this.onDeviceOrientation_.bind(this);return isIOS()&&isInsideCrossOriginIFrame()&&window.addEventListener("message",n),window.addEventListener("orientationchange",t),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",r):window.addEventListener("devicemotion",e),function(){window.removeEventListener("devicemotion",e),window.removeEventListener("deviceorientation",t),window.removeEventListener("orientationchange",t),window.removeEventListener("message",n)}},e.prototype.getEyeOffset=function(){return{left:[.5*-this.viewer.interLensDistance,0,0],right:[.5*this.viewer.interLensDistance,0,0]}},e.prototype.getEyeProjectionMatrix=function(){var e=this.getEyeFieldOfView(),t=this.depthNear,n=this.depthFar,r={left:[],right:[]},i=e.left.upDegrees*DEG_TO_RAD,o=e.left.downDegrees*DEG_TO_RAD,a=2/((c=e.left.leftDegrees*DEG_TO_RAD)+(l=e.left.rightDegrees*DEG_TO_RAD)),s=2/(i+o);r.left[0]=a,r.left[1]=0,r.left[2]=0,r.left[3]=0,r.left[4]=0,r.left[5]=s,r.left[6]=0,r.left[7]=0,r.left[8]=-(c-l)*a*.5,r.left[9]=(i-o)*s*.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;var c,l;i=e.right.upDegrees*DEG_TO_RAD,o=e.right.downDegrees*DEG_TO_RAD,a=2/((c=e.right.leftDegrees*DEG_TO_RAD)+(l=e.right.rightDegrees*DEG_TO_RAD)),s=2/(i+o);return r.right[0]=a,r.right[1]=0,r.right[2]=0,r.right[3]=0,r.right[4]=0,r.right[5]=s,r.right[6]=0,r.right[7]=0,r.right[8]=-(c-l)*a*.5,r.right[9]=(i-o)*s*.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,r},e.prototype.getEyeFieldOfView=function(){var e=this.viewer,t=this.device,n=new Distortion(e.distortionCoefficients),r=e.screenLensDistance,i=(t.widthMeters-e.interLensDistance)/2,o=e.interLensDistance/2,a=e.baselineLensDistance-t.bevelMeters,s=t.heightMeters-a,c=RAD_TO_DEG*Math.atan(n.distort(i/r)),l=RAD_TO_DEG*Math.atan(n.distort(o/r)),u=RAD_TO_DEG*Math.atan(n.distort(a/r)),p=RAD_TO_DEG*Math.atan(n.distort(s/r)),d=new FieldOfView,h=new FieldOfView;return d.leftDegrees=Math.min(c,e.fov),d.rightDegrees=Math.min(l,e.fov),d.downDegrees=Math.min(u,e.fov),d.upDegrees=Math.min(p,e.fov),h.leftDegrees=d.rightDegrees,h.rightDegrees=d.leftDegrees,h.upDegrees=d.upDegrees,h.downDegrees=d.downDegrees,{left:d,right:h}},e.prototype.onDeviceOrientation_=function(e){this._deviceOrientationQ=this._deviceOrientationQ||new THREE__namespace.Quaternion;var t=e.alpha,n=e.beta,r=e.gamma;t=(t||0)*Math.PI/180,n=(n||0)*Math.PI/180,r=(r||0)*Math.PI/180,this._deviceOrientationQ.setFromEuler(new THREE__namespace.Euler(t,n,-r,"YXZ"))},e.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},e.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,n=e.rotationRate,r=e.timeStamp/1e3,i=r-this.previousTimestampS;return i<0?(warnOnce("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=r)):i<=MIN_TIMESTEP||i>MAX_TIMESTEP?(warnOnce("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=r)):(t&&(this.accelerometer.set(-t.x,-t.y,-t.z),n&&(isR7()?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)),void(this.previousTimestampS=r))},e.prototype.onOrientationChange_=function(){this.setScreenTransform_()},e.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&("devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent))},e.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),"undefined"!=typeof window?window.orientation:0){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new THREE__namespace.Vector3(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},e}(),defaultLeftBounds=[0,0,.5,1],defaultRightBounds=[.5,0,.5,1],Cardboard=function(){function e(e){var t=this;this.renderer=e,this.sensor=new Sensor(.98,.04,!1,!1),this.scale=1,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera;var n=this.sensor.start();this.dispose=function(){var e=t.renderer.getSize(new THREE__namespace.Vector2);t.renderer.setScissor(0,0,e.width,e.height),t.renderer.setViewport(0,0,e.width,e.height),t.renderer.setScissorTest(!1),n()}}return e.prototype.render=function(e,t){var n=this.renderer.getSize(new THREE__namespace.Vector2);if(n.width>n.height){var r=e.autoUpdate;r&&(e.updateMatrixWorld(),e.autoUpdate=!1);var i={x:Math.round(n.width*defaultLeftBounds[0]),y:Math.round(n.height*defaultLeftBounds[1]),width:Math.round(n.width*defaultLeftBounds[2]),height:Math.round(n.height*defaultLeftBounds[3])},o={x:Math.round(n.width*defaultRightBounds[0]),y:Math.round(n.height*defaultRightBounds[1]),width:Math.round(n.width*defaultRightBounds[2]),height:Math.round(n.height*defaultRightBounds[3])};this.renderer.setScissorTest(!0),this.renderer.autoClear&&this.renderer.clear(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),t.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale);var a=this.sensor.getEyeOffset();this.cameraL.translateOnAxis((new THREE__namespace.Vector3).fromArray(a.left),this.scale),this.cameraR.translateOnAxis((new THREE__namespace.Vector3).fromArray(a.right),this.scale);var s=this.sensor.getEyeProjectionMatrix();this.cameraL.projectionMatrix.elements=s.left.slice(),this.cameraR.projectionMatrix.elements=s.right.slice(),this.renderer.setViewport(i.x,i.y,i.width,i.height),this.renderer.setScissor(i.x,i.y,i.width,i.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,n.width,n.height),this.renderer.setScissor(0,0,n.width,n.height),this.renderer.setScissorTest(!1),r&&(e.autoUpdate=!0)}else this.renderer.render(e,t)},e.prototype.dispose=function(){},e}();const cardboard="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADqCAMAAAAvZYhaAAAC/VBMVEUAAAD///99fX37+/v5+fn29vbx8fHv7+/Nzc3o6Ojq6urh4eHU1NTR0dGDg4Pl5eWSkpLHx8fj4+Pe3t7X19fAwMDZ2dnCwsKrq6uioqLb29uNjY2enp67u7t5eXmAgIC2traWlpa5ubnKysqmpqZycnKHh4eurq6ysrKKioqDg4Pd3d12dnb9/f1vb2/s7OxlZWXz8/OoqKiZmZlpaWmbm5teXl7W1tbJycnExMRiYmJsbGywsLCPj49aWlq9vb1UVFRYWFhra2t+fn7t7e1RUVFOTk6Dg4OAgICCgoKKioqEhISIiIhqamqCgoKIiIiQkJCIiIiWlpawsLBmZmaAgICenp6Li4uBgYGTk5OMjIyVlZWFhYWCgoKvr6+Ojo59fX2SkpKvr6+Ojo6QkJCurq6BgYGxsbF8fHx4eHitra2enp6srKyJiYmurq54eHj5+fl+fn57e3v////5+fnS0tLAwM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JKCBB83OfYAcNVjFcSrvzo95WOShB83Ody5V24fqzO0nAUSzB/89Nph38VqmuOa3gticJOP9fApuHTDt4nFJ7AXdPC0lg8/gq8y5XapSrgpUgbQ0JpF5u97hS1fOC26nlJJA8Yd41Sg3fU4dtRQkKeXSN3jo4Qqm0397OmyZOGatoDrScBIWM3DFn5kXi1ZyqRSUoZtKOa1vWKArztqgEnhIHty4f9/btuEstKwGkxf+XuCT5CbTFnFRuxktuAAAAAElFTkSuQmCC";var _a,LOCALE={zh:{TITLE:"眼镜模式",HIT:"请将手机横屏放入 VR 眼镜中"},en:{TITLE:"GLASSES MODE",HIT:"Please put the mobile phone horizontally into the VR glasses."},ja:{TITLE:"メガネモード",HIT:"携帯電話をVRメガネに水平に入れてください。"}},TEXT="undefined"!=typeof navigator&&null!==(_a=LOCALE[navigator.language.split("-")[0]])&&void 0!==_a?_a:LOCALE.zh,CONTENTS="\n<style>\n.$id {\n all: initial;\n position: absolute;\n overflow: hidden;\n display: none;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n.$id-modal {\n width: 100%;\n height: 332px;\n position: absolute;\n bottom: -2px;\n left: 0;\n right: 0;\n overflow: hidden;\n pointer-events: none;\n will-change: transform;\n animation: $id-modal-fade-in 0.3s ease 1;\n}\n.$id-modal-bg {\n background: rgba(0, 0, 0, 0.75);\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n}\n.$id-modal-bg-line {\n height: 1px;\n background-image: linear-gradient(\n 85deg,\n rgba(162, 177, 255, 0.3) 1%,\n rgba(120, 126, 255, 0.8) 30%,\n rgba(147, 218, 255, 0.8) 66%,\n rgba(250, 255, 184, 0.3) 92%\n );\n}\n.$id-modal-bg-wave svg {\n width: 375px;\n height: 61px;\n display: block;\n}\n.$id-modal-content {\n color: #ffffff;\n padding: 0 14px;\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n overflow: hidden;\n}\n.$id-modal-content-title {\n font-size: 17px;\n font-family: sans-serif;\n line-height: 18px;\n padding: 20px 0;\n font-weight: bold;\n}\n.$id-modal-content-hit {\n font-size: 14px;\n font-family: sans-serif;\n line-height: 24px;\n opacity: 0.85;\n}\n.$id-modal-content-guide {\n position: relative;\n width: 168px;\n height: 139px;\n margin: 36px auto 0;\n}\n.$id-modal-content-guide-cardboard {\n position: absolute;\n width: 100px;\n height: 82px;\n left: 68px;\n top: 57px;\n}\n.$id-modal-content-guide-cardboard-image {\n width: 100px;\n height: 82px;\n background-image: url(".concat(cardboard,");\n background-size: 100%;\n background-repeat: no-repeat;\n}\n.$id-modal-content-guide-phone {\n position: absolute;\n width: 58px;\n height: 56px;\n left: 0;\n top: 0;\n}\n.$id-modal-content-guide-phone-move-x {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n will-change: transform;\n animation: $id-guide-move-x 4s 0.5s infinite;\n}\n.$id-modal-content-guide-phone-move-y {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n will-change: transform;\n animation: $id-guide-move-y 4s cubic-bezier(0.42, 0, 0.23, 0.98) 0.5s infinite;\n}\n.$id-modal-content-guide-phone-blink {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n will-change: opacity;\n animation: $id-guide-blink 4s 0.5s infinite;\n}\n.$id-modal-content-guide-phone-image {\n width: 58px;\n height: 56px;\n background-image: url(").concat(phone,');\n background-size: 100%;\n background-repeat: no-repeat;\n}\n.$id-modal-close {\n position: absolute;\n top: 20px;\n right: 14px;\n width: 14px;\n height: 14px;\n}\n.$id-modal-close svg {\n width: 14px;\n height: 14px;\n display: block;\n}\n\n@keyframes $id-modal-fade-in {\n 0% { transform: translate3d(0, 100%, 0); opacity: 0.5; }\n 100% { transform: translate3d(0, 0, 0); opacity: 1; }\n}\n@keyframes $id-guide-blink {\n 0% { opacity: 0; }\n 7% { opacity: 0; }\n 12% { opacity: 1; }\n 29% { opacity: 1; }\n 34% { opacity: 0.3; }\n 39% { opacity: 1; }\n 44% { opacity: 0.3; }\n 49% { opacity: 1; }\n 80% { opacity: 1; }\n 100% { opacity: 0; }\n}\n@keyframes $id-guide-move-x {\n 0% { transform: translate3d(0, 0, 0); }\n 57% { transform: translate3d(0, 0, 0); }\n 80% { transform: translate3d(70px, 0, 0); }\n 100% { transform: translate3d(70px, 0, 0); }\n}\n@keyframes $id-guide-move-y {\n 0% { transform: translate3d(0, 0, 0); }\n 57% { transform: translate3d(0, 0, 0); }\n 80% { transform: translate3d(0, 58px, 0); }\n 100% { transform: translate3d(0, 58px, 0); }\n}\n@media screen and (orientation: portrait) {\n .$id {\n display: block;\n }\n}\n</style>\n<div class="$id-modal">\n <div class="$id-modal-bg">\n <div class="$id-modal-bg-line"></div>\n <div class="$id-modal-bg-wave">\n <svg width="375" height="61" viewBox="0 0 375 61" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <linearGradient x1="0" y1="0%" x2="0" y2="100%" id="$id-2y6_dj_hgp">\n <stop stop-color="#8598FF" stop-opacity="0.15" offset="0%"></stop>\n <stop stop-color="#000" stop-opacity="0" offset="100%"></stop>\n </linearGradient>\n </defs>\n <path transform="translate(187.5, 30.5) scale(-1, 1) translate(-187.5, -30.5)" fill="url(#$id-2y6_dj_hgp)" d="\nM0,1\nC83.001,1.706 140.146,4.164 171.435,8.374\nC218.369,14.688 253.467,26.308 273.002,33\nC292.536,39.691323.501,51 343.709,56\nC357.182,59.333 367.612,61 375,61\nL375,0\nL0,0\nL0,1\nZ\n"></path>\n </svg>\n </div>\n </div>\n <div class="$id-modal-content">\n <div class="$id-modal-content-title">').concat(TEXT.TITLE,'</div>\n <div class="$id-modal-content-hit">').concat(TEXT.HIT,'</div>\n <div class="$id-modal-content-guide">\n <div class="$id-modal-content-guide-phone">\n <div class="$id-modal-content-guide-phone-move-x">\n <div class="$id-modal-content-guide-phone-move-y">\n <div class="$id-modal-content-guide-phone-blink">\n <div class="$id-modal-content-guide-phone-image"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="$id-modal-content-guide-cardboard">\n <div class="$id-modal-content-guide-cardboard-image"></div>\n </div>\n </div>\n </div>\n <div class="$id-modal-close">\n <svg width="14" height="14" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <defs>\n <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="70%" id="$id-ho0itsc4p9">\n <stop stop-color="#FFF" stop-opacity="0.75" offset="0%"></stop>\n <stop stop-color="#FFF" stop-opacity="0.22" offset="100%"></stop>\n </radialGradient>\n </defs>\n <path transform="translate(-3, -3)" fill="url(#$id-ho0itsc4p9)" fill-rule="nonzero" d="\nM16.791,3.198\nC17.044,3.438 17.067,3.814 16.860,4.080\nL16.791,4.156\nL12.144,9.331\nC11.803,9.711 11.803,10.288 12.144,10.668\nL16.791,15.843\nC17.044,16.084 17.067,16.460 16.860,16.725\nL16.791,16.801\nC16.538,17.042 16.142,17.063 15.864,16.867\nL15.784,16.801\nL10.000,11.250\nL4.215,16.801\nL4.135,16.867\nC3.857,17.063 3.461,17.042 3.208,16.801\nL3.208,16.801\nL3.139,16.725\nC2.932,16.460 2.955,16.084 3.208,15.843\nL3.208,15.843\nL7.855,10.668\nC8.196,10.288 8.196,9.711 7.855,9.331\nL7.855,9.331\nL3.208,4.156\nL3.139,4.080\nC2.932,3.814 2.955,3.438 3.208,3.198\nC3.486,2.933 3.937,2.933 4.215,3.198\nL4.215,3.198 L9.999,8.749\nL15.784,3.198\nC16.062,2.933 16.513,2.933 16.791,3.198\nZ\n"></path>\n </svg>\n </div>\n</div>\n');function createContents(e){for(var t=1,n=document.getElementsByTagName("meta"),r=0;r<n.length;r++){var i=n[r];if("viewport"===i.getAttribute("name")){var o=(i.getAttribute("content")||"").match(/initial\-scale\=([\d|\.]+)/);o&&(t=Number(o[1])),isNaN(t)&&(t=1)}}return CONTENTS.replace(/\n/g," ").replace(/\ +/g," ").replace(/\$id/g,e).replace(/(\d+)px/g,(function(e,n){return function(e){return Math.floor(e*t)+"px"}(Number(n))}))}function createHelper(){var e="five_vr_helper_"+createUuid(),t=createContents(e),n=document.createElement("div");return n.className=e,n.innerHTML=t,n}var sharedGeometry$1=new THREE__namespace.CircleBufferGeometry(.12,16),vertexShader$1="\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader$1="\nuniform float circleScale;\nuniform float circleFade;\nuniform float circleOpacity;\nuniform float loadingAngle;\nuniform float loadingOpacity;\nuniform float opacity;\nuniform float disable;\nvarying vec2 vUv;\n\n#define PI 3.141592653589793\n#define TAU 6.283185307179586\n#define SMOOTH_DIST 0.017\n#define CENTER vec2(0.5, 0.5)\n\nfloat inside(float innerDist) {\n float dist = length(CENTER - vUv);\n return smoothstep(innerDist, innerDist + SMOOTH_DIST, dist);\n}\nfloat outside(float outerDist) {\n float dist = length(CENTER - vUv);\n return 1.0 - smoothstep(outerDist - SMOOTH_DIST, outerDist, dist);\n}\n\nvec4 create_circle() {\n float dist = length(CENTER - vUv);\n float gradient = clamp(0.98 + abs(dot(normalize(vec2(1.0, -1.0)), vUv - CENTER)) * 2.0, 0.0, 1.0);\n vec3 color = mix(vec3(0.576, 0.635, 1.0), vec3(1.0, 1.0, 1.0), circleFade * 0.5);\n return vec4(color, 1.0 * gradient * circleOpacity * outside(0.3 * circleScale));\n}\n\nvec4 create_disable() {\n float dist = length(CENTER - vUv);\n return vec4(1.0, 1.0, 1.0, 0.5 * outside(0.32 * circleScale));\n}\n\nvec4 create_loading() {\n float angle = PI - atan(CENTER.x - vUv.x, CENTER.y - vUv.y);\n angle = mod(angle + loadingAngle, TAU);\n float gradient = (1.0 - smoothstep(0.0, TAU, angle)) * 0.9 + 0.1;\n return vec4(1.0, 1.0, 1.0, gradient * loadingOpacity * inside(0.2 * circleScale) * outside(0.25 * circleScale));\n}\n\nvoid main() {\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0);\n\n vec4 circleColor = create_circle();\n gl_FragColor = mix(gl_FragColor, circleColor, circleColor.a);\n\n vec4 loadingColor = create_loading();\n gl_FragColor = mix(gl_FragColor, loadingColor, loadingColor.a);\n\n gl_FragColor = mix(gl_FragColor, create_disable(), disable);\n\n gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);\n}\n",ringVertexShader="\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",ringFragmentShader="\nvarying vec2 vUv;\nuniform float opacity;\n\nfloat smoothDist = 0.01;\nvoid main() {\n vec2 center = vec2(0.5, 0.5);\n float dist = length(center - vUv);\n float outerDist = 0.49;\n float innerDist = 0.29;\n\n float outside = 1.0 - smoothstep(outerDist - smoothDist, outerDist, dist);\n float inside = smoothstep(innerDist, innerDist + smoothDist, dist);\n\n vec4 bg = vec4(0.576, 0.635, 1.0, 0.3);\n float gradientAlpha = clamp(abs(dist - (outerDist + innerDist) / 2.0) / (outerDist - innerDist) * 1.5 + 0.1, 0.0, 1.0);\n vec4 gradient = vec4(1.0, 1.0, 1.0, gradientAlpha);\n\n gl_FragColor = mix(bg, gradient, gradient.a);\n\n gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity * outside * inside);\n}\n",PanoSphereMesh=function(e){function t(){var t=e.call(this)||this;t.progress=0,t.opacity=0,t.loading=!1,t.current=!1,t.disabled=!1,t.currentMotion=new Motion({ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}),t.opacityMotion=new Motion({opacity:0}),t.loadingMotion=new Motion({opacity:0}),t.disableMotion=new Motion({opacity:0});var n={blending:THREE__namespace.CustomBlending,blendSrc:THREE__namespace.SrcAlphaFactor,blendDst:THREE__namespace.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE__namespace.OneFactor,blendDstAlpha:THREE__namespace.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0};return t.hitTestMesh=new THREE__namespace.Mesh(sharedGeometry$1,new THREE__namespace.MeshBasicMaterial(__assign(__assign({},n),{color:0,opacity:0}))),t.hitTestMesh.scale.set(1.5,1.5,1.5),t.ringMesh=new THREE__namespace.Mesh(sharedGeometry$1,new THREE__namespace.ShaderMaterial(__assign(__assign({},n),{vertexShader:ringVertexShader,fragmentShader:ringFragmentShader,uniforms:{opacity:{value:0}}}))),t.panoMesh=new THREE__namespace.Mesh(sharedGeometry$1,new THREE__namespace.ShaderMaterial(__assign(__assign({},n),{vertexShader:vertexShader$1,fragmentShader:fragmentShader$1,uniforms:{circleScale:{value:1.1},circleFade:{value:0},circleOpacity:{value:.5},loadingAngle:{value:0},loadingOpacity:{value:0},opacity:{value:0},disable:{value:0}}}))),t.add(t.hitTestMesh),t.add(t.ringMesh),t.add(t.panoMesh),t.renderOrder=1e4,t.needsRender=!0,t}return __extends(t,e),t.prototype.setProgress=function(e){this.progress=e,this.setLoading(e>0)},t.prototype.setOpacity=function(e){this.opacity!==e&&(this.opacity=e=clamp(e,0,1),this.opacityMotion.set({opacity:e},30).catch(noop$1))},t.prototype.setCurrent=function(e){if(this.current!==e){if(e){var t=[{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}}];this.currentMotion.setKeyframes(t,1500).catch(noop$1)}else{t=[{progress:0,value:__assign({},this.currentMotion.value)},{progress:1,value:{ringScale:1.1,ringOpacity:0,circleFade:0,circleOpacity:.85,circleScale:1}}];this.currentMotion.setKeyframes(t,200).catch(noop$1)}this.current=e}},t.prototype.setLoading=function(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(noop$1):this.loadingMotion.set({opacity:0},0).catch(noop$1),this.loading=e,!0===this.disabled&&this.setDisabled(!1),this.needsRender=!0)},t.prototype.setDisabled=function(e){this.disabled!==e&&(this.disabled=e,!0===this.loading&&this.setLoading(!1),this.disableMotion.set({opacity:e?1:0},300).catch(noop$1),this.needsRender=!0)},t.prototype.tap=function(){return Promise.resolve()},t.prototype.updateTime=function(e,t){this.opacityMotion.update(e),this.currentMotion.update(e),this.loadingMotion.update(e);var n=this.opacityMotion.value.opacity;this.visible=0!==n;var r=this.currentMotion.value,i=r.ringScale,o=r.ringOpacity,a=r.circleFade,s=r.circleOpacity,c=r.circleScale;this.ringMesh.scale.set(i,1,i),this.ringMesh.material.uniforms.opacity.value=o*n,this.panoMesh.material.uniforms.opacity.value=n,this.panoMesh.material.uniforms.circleOpacity.value=s,this.panoMesh.material.uniforms.circleScale.value=c,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%(2*Math.PI),this.needsRender=!0},t.prototype.dispose=function(){this.hitTestMesh.material.dispose(),this.ringMesh.material.dispose(),this.panoMesh.material.dispose()},t}(THREE__namespace.Object3D),ACTIVE_TO_CURRENT_DELAY=1500,VRPanoramaController=function(e){function t(n){var r=this,i=t.parseArgs(n);(r=e.call(this,i)||this).mode="VRPanorama",r.cardboard=new Cardboard(r.renderer);var o=createHelper();r.helperElement=o;var a=new Hammer(o);return r.element.parentNode&&(r.element.parentNode.insertBefore(o,r.element),r.setHelperElementSize(),a.on("tap",(function(){return r.emit("vr.requestExit",createEvent("vr.requestExit",{}))}))),r.destroyHelper=function(){a.destroy(),o.parentNode&&o.parentNode.removeChild(o),delete r.helperElement},r}return __extends(t,e),t.parseArgs=function(n){if(n instanceof t)return n;var r=__assign(__assign({},n),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return e.parseArgs.call(this,r)},t.initAnimationEndState=function(t){var n=this.parseArgs(t),r=e.initAnimationEndState.call(this,n);return __assign(__assign({},r),{mode:"VRPanorama"})},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.cardboard.dispose(),this.destroyHelper();for(var t=0,n=Object.keys(this.panoMeshes);t<n.length;t++){var r=n[t],i=this.panoMeshes[r];this.helper.remove(i),i.dispose(),delete this.panoMeshes[r]}},t.prototype.isReady=function(){return!1},t.prototype.updateRenderSize=function(){this.needsRender=!0,this.setHelperElementSize()},t.prototype.updateCamera=function(e,t,n){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,t,n){return Promise.resolve()},t.prototype.updatePanoMeshesVisible=function(){for(var e=this.works.getResolvedObserver(this.currentPano),t=(e?e.visibleIds:[]).concat(panoStringify(this.currentPano)),n=0,r=this.works.resolvedObservers;n<r.length;n++){var i=r[n],o=this.panoMeshes[i.panoId];o&&(t.indexOf(i.panoId)>=0?o.parent!==this.helper&&this.helper.add(o):o.parent===this.helper&&(this.helper.remove(o),o.setOpacity(0)))}},t.prototype.updatePanoMeshes=function(){for(var e=0,t=Object.keys(this.panoMeshes);e<t.length;e++){var n=t[e],r=this.panoMeshes[n];this.helper.remove(r),r.dispose(),delete this.panoMeshes[n]}for(var i=0,o=this.works.resolvedObservers;i<o.length;i++){var a=o[i],s=a.panoId,c=new PanoSphereMesh;c.name="panoSphere_".concat(s),c.position.copy(a.position),c.needsRender=!0,this.panoMeshes[s]=c}this.updatePanoMeshesVisible()},t.prototype.updateTime=function(e,t){var n,r,i,o,a,s;if(!this.destroyed){var c=this.currentPano;this.userAction=!0,this.needsRender=!0;var l={},u={};if(!1===this.modelAlphaMotion.ended&&(this.modelAlphaMotion.update(e),l.modelAlpha=this.modelAlphaMotion.value.modelAlpha),!1===this.perspToOrthoMotion.ended&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!1===this.locationMotion.ended){this.locationMotion.update(e);var p=this.locationMotion.getKeyFrameSegment(e),d=p[0],h=p[1],f=this.panoResourceFromLocationMotionKeyframe(d),m=this.panoResourceFromLocationMotionKeyframe(h),v=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),A=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),g=f.position,y=m.position,b=this.locationMotion.value.count-h.value.count+1;l.useBlackTransition="instant"===m.effect,m.panoPicture&&(b<1?f.panoPicture&&(l.pano0=f.panoPicture):l.pano0=m.panoPicture,l.pano1=m.panoPicture),"fade"===m.effect&&(l.pano0&&f.panoPicture&&(l.pano0={map:l.pano0.map,luminanceMap:l.pano0.luminanceMap,matrix:f.panoPicture.matrix.clone().setPosition(m.position)}),g.copy(y)),l.progress=b,u.distance=this.locationMotion.value.distance,u.offset=new THREE__namespace.Vector3(g.x+(y.x-g.x)*b,g.y+(y.y-g.y)*b,g.z+(y.z-g.z)*b);for(var E=[],_=[],T=0,x=this.locationMotion.keyframes;T<x.length;T++){var R=x[T],w=R.key,M=R.progress;void 0!==w&&(E.push(w),M>=this.locationMotion.progress&&_.push(w))}for(var S=0,C=Object.keys(this.panoResources);S<C.length;S++){var I=C[S];if(!(_.indexOf(I)>=0)){var P=this.panoResources[I];if(P.panoPicture){var B=P.panoPicture.map;if(B){if(B===(null===(n=l.pano0)||void 0===n?void 0:n.map))continue;if(B===(null===(r=l.pano1)||void 0===r?void 0:r.map))continue;B.dispose(),P.panoPicture=null}}E.indexOf(I)>=0||delete this.panoResources[I]}}this.currentPano=panoParse(m.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(v.panoId),state:__assign(__assign(__assign(__assign({},panoParse(A.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),u),options:{},progress:this.locationMotion.progress,error:null}))}!1===isEmptyObject(l)&&((null===(i=l.pano0)||void 0===i?void 0:i.map)&&l.pano0.map instanceof TileCubeTextureTarget&&!l.pano0.map.cubeRenderTarget&&(l.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(o=l.pano0)||void 0===o?void 0:o.luminanceMap)&&l.pano0.luminanceMap instanceof TileCubeTextureTarget&&!l.pano0.luminanceMap.cubeRenderTarget&&(l.pano0.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),(null===(a=l.pano1)||void 0===a?void 0:a.map)&&l.pano1.map instanceof TileCubeTextureTarget&&!l.pano1.map.cubeRenderTarget&&(l.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(s=l.pano1)||void 0===s?void 0:s.luminanceMap)&&l.pano1.luminanceMap instanceof TileCubeTextureTarget&&!l.pano1.luminanceMap.cubeRenderTarget&&(l.pano1.luminanceMap.cubeRenderTarget=this.luminanceCubeRenderTargetPool.pop()),this.models.setMaterial(l)),u.offset&&this.camera.position.copy(u.offset),panoEqual(this.currentPano,c)&&this.updatePanoMeshesVisible();var O=this.camera.pose.longitude,k=this.camera.pose.latitude;this.camera.quaternion.fromArray(this.cardboard.sensor.getOrientation()),this.camera.updateMatrixWorld(),this.camera.computePose();var H=this.works.getResolvedObserver(this.currentPano);if(H)for(var F=0,L=H.visibleIds.concat(panoStringify(this.currentPano));F<L.length;F++){var D=L[F],N=panoParse(D);if(q=this.works.getResolvedObserver(N)){var V=this.panoMeshes[D];if(q.loadable||q.active){var U=V.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);U<.05?V.setOpacity(0):V.setOpacity(clamp(1.5/U,0,1)),panoEqual(this.currentPano,N)&&V.setOpacity(0),V.lookAt(this.camera.position)}else V.setOpacity(0)}}for(var Q=this.intersect(e),z=0,j=this.works.resolvedObservers;z<j.length;z++){var q=j[z];(V=this.panoMeshes[q.panoId])&&(V.setCurrent(V===Q),V.updateTime&&V.updateTime(e,t))}O===this.camera.pose.longitude&&k===this.camera.pose.latitude||(this.cameraMotion.set(pick(this.camera.pose,["longitude","latitude"]),0).catch(noop$1),this.emit("camera.update",createEvent("camera.update",{userAction:!0,state:__assign(__assign(__assign({},this.currentPano),{mode:this.mode}),clonePose(this.camera.pose))})))}},t.prototype.render=function(){this.cardboard.render(this.scene,this.camera)},t.prototype.setCamera=function(e){},t.prototype.destroyHelper=function(){},t.prototype.setHelperElementSize=function(){if(this.helperElement){var e=new THREE__namespace.Vector2(this.element.offsetWidth,this.element.offsetHeight),t=e.x*this.scissor.left,n=e.y*(1-this.scissor.bottom-this.scissor.height),r=e.x*this.scissor.width,i=e.y*this.scissor.height;this.helperElement.style.marginLeft=t+"px",this.helperElement.style.marginTop=n+"px",this.helperElement.style.width=r+"px",this.helperElement.style.height=i+"px"}},t.prototype.intersect=function(e){var t,n;if(!1===this.locationMotion.ended)return this.intersectMesh.visible=!1,delete this.activePanoMesh,void delete this.activeTime;if(this.activePanoMesh&&this.activeTime&&e-this.activeTime>ACTIVE_TO_CURRENT_DELAY){for(var r=this.activePanoMesh,i=null,o=0,a=Object.keys(this.panoMeshes);o<a.length;o++){var s=a[o];if(this.panoMeshes[s]===r){i=s;break}}return null!==i&&this.moveToPano(panoParse(i),{},!0),delete this.activePanoMesh,delete this.activeTime,r}var c=this.camera.getDirection(new THREE__namespace.Vector3),l=new THREE__namespace.Raycaster(this.camera.position,c);l.params.Points={threshold:.1};for(var u=void 0,p=[],d=this.works.getResolvedObserver(this.currentPano),h=0,f=d?d.visibleIds:[];h<f.length;h++){i=f[h];var m=this.panoMeshes[i],v=l.intersectObject(null!==(t=m.hitTestMesh)&&void 0!==t?t:m,!0)[0];v&&p.push({panoMesh:m,intersection:__assign({floor:null!==(n=null==d?void 0:d.floorIndex)&&void 0!==n?n:0},v)})}var A=p.sort((function(e,t){return e.intersection.distance-t.intersection.distance}))[0];A?(u=A.intersection,this.activePanoMesh!==A.panoMesh&&(this.activePanoMesh=A.panoMesh,this.activeTime=e),this.intersectMesh.position.copy(A.panoMesh.position),this.intersectMesh.lookAt(this.camera.position),this.intersectMesh.visible=!1):(this.activePanoMesh=void 0,this.activeTime=void 0),u||(u=this.models.intersectRaycaster(l)[0]);var g=createEvent("intersect.update",{raycaster:l,intersection:null!=u?u:null,object:this.intersectMesh});if(this.emit("intersect.update",g),!g.defaultPrevented){if(u&&u.face){var y=u.face.normal,b=new THREE__namespace.Quaternion;b.setFromUnitVectors(new THREE__namespace.Vector3(0,0,1),y),this.intersectMesh.quaternion.copy(b);var E=y.clone().multiplyScalar(.05),_=u.point.clone().add(E);this.intersectMesh.position.copy(_),this.intersectMesh.visible=!0}else this.intersectMesh.visible=!1;return null==A?void 0:A.panoMesh}this.hideIntersectMesh()},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t}(PanoramaController),HUMAN_EYE_POSITION=new THREE__namespace.Vector3(0,1.6,0),ModelController=function(e){function t(n){var r,i=this,o=t.parseArgs(n);return(i=e.call(this,o)||this).mode="Model",i.locationMotion=new Motion({x:i.camera.pose.offset.x,y:i.camera.pose.offset.y,z:i.camera.pose.offset.z,distance:i.camera.pose.distance}),i.modelAlphaMotion=new Motion({modelAlpha:null!==(r=i.models.getMaterial().modelAlpha)&&void 0!==r?r:0}),i.perspToOrthoMotion=new Motion({perspToOrtho:i.camera.perspToOrtho.x}),i}return __extends(t,e),t.parseArgs=function(n){return n instanceof t?n:e.parseArgs.call(this,n)},t.initAnimationEndState=function(e){var t,n,r,i,o,a,s=this.parseArgs(e),c=s.works,l=e.initial,u=l.state,p=l.currentState,d="number"==typeof u.panoIndex?{workCode:null!==(r=null!==(t=u.workCode)&&void 0!==t?t:null===(n=s.works[0])||void 0===n?void 0:n.workCode)&&void 0!==r?r:"",panoIndex:u.panoIndex}:{workCode:p.workCode,panoIndex:p.panoIndex},h=c.getResolvedObserver(d),f=null!==(i=u.longitude)&&void 0!==i?i:p.longitude,m=clamp(null!==(o=u.latitude)&&void 0!==o?o:!h||isFristPersonMode(p.mode)?p.latitude:s.defaultLatitude,s.minLatitude,s.maxLatitude),v=clamp(null!==(a=u.fov)&&void 0!==a?a:!h||isFristPersonMode(p.mode)?p.fov:s.defaultFov,s.minFov,s.maxFov),A=new THREE__namespace.Vector3;if(s.initial.state.offset)A.copy(s.initial.state.offset);else if(h)A.copy(h.position);else{var g=coordinatesToVector(p).setLength(p.distance);A.copy(s.initial.currentState.offset).sub(g)}return{workCode:d.workCode,panoIndex:d.panoIndex,mode:"Model",longitude:f,latitude:m,fov:v,offset:A,distance:0}},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.locationMotion.dispose()},t.prototype.isReady=function(){return!1!==this.locationMotion.ended},t.prototype.updateWork=function(e,n,r,i){this.works=e;var o=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:r,state:n,userAction:i}}));this.hideIntersectMesh();var a={duration:0,longitude:o.longitude,latitude:o.latitude,fov:o.fov};return this.moveToPosition(o.offset,a,i),!0},t.prototype.updateCamera=function(e,t,n){var r=this;return this.initAnimationReady.then((function(){r.userAction=n,r.stopMomentumMovement();var i={},o={};return i.distance=0,void 0!==e.offset&&(i.x=e.offset.x,i.y=e.offset.y,i.z=e.offset.z),void 0!==e.longitude&&(o.longitude=e.longitude),void 0!==e.latitude&&(o.latitude=e.latitude),void 0!==e.fov&&(o.fov=e.fov),r.locationMotion.set(i,t).catch(noop$1),r.cameraMotion.set(o,t).catch(noop$1)}))},t.prototype.updateCameraWithKeyframes=function(e,t,n){var r=this;return this.initAnimationReady.then((function(){r.userAction=n,r.stopMomentumMovement();for(var i=[],o=[],a=0,s=e;a<s.length;a++){var c=s[a];i.push({key:c.key,progress:c.progress,value:{distance:0,x:c.value.offset.x,y:c.value.offset.x,z:c.value.offset.x}}),o.push({key:c.key,progress:c.progress,value:{longitude:c.value.longitude,latitude:c.value.latitude,fov:c.value.fov}})}return r.locationMotion.setKeyframes(i,t).catch(noop$1),r.cameraMotion.setKeyframes(e,t)}))},t.prototype.updateTime=function(e,t){if(!this.destroyed){var n={},r={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),n.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),r.distance=this.locationMotion.value.distance,r.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);var i=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),o=arrayMin(this.works.resolvedObservers,(function(e){return e.position.distanceTo(i)}));this.currentPano=o?{workCode:o.work.workCode,panoIndex:o.panoIndex}:{workCode:"",panoIndex:0}}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),isEmptyObject(n)||this.models.setMaterial(n),isEmptyObject(r)||this.setCamera(r)}},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(n){var r=e.initial;r.state,r.currentState;var i=r.duration,o=r.userAction;e.userAction=o;var a=t.initAnimationEndState(e),s={modelAlpha:1},c={perspToOrtho:0},l={longitude:a.longitude,latitude:a.latitude,fov:a.fov,duration:i,moveStartCallback:function(t){e.perspToOrthoMotion.set(c,i).catch(noop$1),e.modelAlphaMotion.set(s,i).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:t,userAction:e.userAction}))},moveEndCallback:function(t){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:t,userAction:e.userAction})),n()},moveCancelCallback:function(){var t=e.currentPano,r=__assign(__assign({},t),{mode:e.mode,longitude:e.camera.pose.longitude,latitude:e.camera.pose.latitude,fov:e.camera.pose.fov,offset:e.camera.pose.offset.clone(),distance:e.camera.pose.distance});e.emit("initAnimation.end",createEvent("initAnimation.end",{state:r,userAction:e.userAction})),n()}};e.moveToPosition(a.offset,l,o)}))},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],t=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new THREE__namespace.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance})},t.prototype.moveToPano=function(e,t,n){void 0===t&&(t={});var r=this.works.getResolvedObserver(e);r&&this.moveToPosition(r.position,t,n)},t.prototype.moveToPosition=function(e,t,n){var r,i,o,a=this;void 0===t&&(t={}),this.userAction=n,this.stopMomentumMovement();for(var s=now(),c=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=c.distanceTo(e),u=this.locationMotion.getProgressVelocity(s),p=0,d=1;d<this.locationMotion.keyframes.length;d++){var h=this.locationMotion.keyframes[d-1].value,f=h.x,m=h.y,v=h.z,A=this.locationMotion.keyframes[d].value,g=A.x,y=A.y,b=A.z;p+=Math.sqrt(Math.pow(g-f,2)+Math.pow(y-m,2)+Math.pow(b-v,2))}var E=0===l?0:u*p/l,_=this.calculateMovingDuration(t.duration,l),T={x:e.x,y:e.y,z:e.z,distance:0},x={longitude:t.longitude,latitude:t.latitude,fov:t.fov},R=arrayMin(this.works.resolvedObservers,(function(e){return e.position.distanceTo(c)})),w=R?{workCode:R.work.workCode,panoIndex:R.panoIndex}:{workCode:"",panoIndex:0},M=__assign(__assign({},w),{mode:this.mode,longitude:null!==(r=x.longitude)&&void 0!==r?r:this.camera.pose.longitude,latitude:null!==(i=x.latitude)&&void 0!==i?i:this.camera.pose.latitude,fov:null!==(o=x.fov)&&void 0!==o?o:this.camera.pose.fov,offset:e.clone(),distance:0}),S=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:t,prevPano:S,progress:0,state:M,userAction:this.userAction,error:null})),t.moveStartCallback&&t.moveStartCallback(M),this.cameraMotion.set(x,_).catch(noop$1),this.locationMotion.set(T,_,E).then((function(){var e=__assign(__assign(__assign({},w),{mode:a.mode}),clonePose(a.camera.pose));a.emit("pano.arrived",createEvent("pano.arrived",{options:t,prevPano:S,progress:0,state:e,userAction:a.userAction,error:null})),t.moveEndCallback&&t.moveEndCallback(e)}),(function(){t.moveCancelCallback&&t.moveCancelCallback(),a.emit("pano.cancel",createEvent("pano.cancel",{options:t,prevPano:S,progress:0,state:M,userAction:a.userAction,error:null}))}))},t.prototype.onTapGesture=function(e){var t=e.center.raycaster;this.stopMomentumMovement();var n=this.models.intersectRaycaster(t)[0];if(n&&n.face){var r=n.face.normal,i=n.point;if(new THREE__namespace.Vector3(0,1,0).angleTo(r)>Math.PI/3){var o=r.clone().setLength(.3).add(i);t.set(o,new THREE__namespace.Vector3(0,-1,0)),n=this.models.intersectRaycaster(t)[0]}}if(n){var a=(new THREE__namespace.Vector3).copy(n.point).add(HUMAN_EYE_POSITION),s=arrayMin(this.works.resolvedObservers,(function(e){return e.position.distanceTo(a)}),!0),c=s[0],l=s[1];c&&l<5&&(a.y=c.position.y),e.state.offset.copy(a),e.state.distance=0,this.emit("gesture.tap",e),e.defaultPrevented||this.moveToPosition(a,{},!0)}else this.emit("gesture.tap",e),e.defaultPrevented||this.cameraBounce()},t}(PanoramaLikeController);const vertexShader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("{vs|z-rp@-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Qv}ynprzr{Zn}9-n{s|zrqP||q6H----qvn{pr-J-pnyr-7-}n{|Qv}ynprzr{;H----qvn{pr-J-qvn{pr-7-p|5]V-7-5p||q;\b-:-=;EB66H----qvn{pr-J-pnyrH--\f--rpA-ry]|vv|{-J-rpA5}|vv|{-8-}n{|]|vv|{-8-{|znyv\tr5|yq]|vv|{;\b\t6-7-qvn{pr9->;=6H--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-ry]|vv|{H\f"),fragmentShader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("{vs|z-sy|n-|}npv\bH{vs|z-nz}yrPor-}n{|Zn}H{vs|z-nz}yr?Q-}n{|Qv}ynprzr{Zn}Hn\bv{t-rp@-}n{|d|yq]|vv|{H|vq-znv{56-\n--rpA-}n{|P|y|-J-rrPor5}n{|Zn}9-}n{|d|yq]|vv|{;\b\t6H--tylSntP|y|-J-rpA5}n{|P|y|;to9-|}npv\b6H\f");var shaderUniforms=Object.assign({opacity:new THREE__namespace.Uniform(1),scale:new THREE__namespace.Uniform(13.1),panoMap:new THREE__namespace.Uniform(null),panoDisplacementMap:new THREE__namespace.Uniform(null),panoPosition:new THREE__namespace.Uniform(new THREE__namespace.Vector3),panoMatrix:new THREE__namespace.Uniform(new THREE__namespace.Matrix4)},{emissive:new THREE__namespace.Uniform(new THREE__namespace.Color(0)),emissiveMap:new THREE__namespace.Uniform(null),specular:new THREE__namespace.Uniform(new THREE__namespace.Color(1118481)),specularMap:new THREE__namespace.Uniform(null),normalMap:new THREE__namespace.Uniform(null),bumpMap:new THREE__namespace.Uniform(null),shininess:new THREE__namespace.Uniform(30)},THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.lights),sharedGeometry=new THREE__namespace.SphereBufferGeometry(.01,128,128);function toPanoModel(e,t,n,r){var i=new THREE__namespace.ShaderMaterial({side:THREE__namespace.BackSide,vertexShader:vertexShader,fragmentShader:fragmentShader,transparent:!0,uniforms:THREE__namespace.UniformsUtils.clone(shaderUniforms)}),o=t;return o.needsUpdate=!0,o.minFilter=THREE__namespace.LinearFilter,o.magFilter=THREE__namespace.LinearFilter,e.needsUpdate=!0,e.minFilter=THREE__namespace.LinearFilter,e.magFilter=THREE__namespace.LinearFilter,i.uniforms.opacity.value=0,i.uniforms.panoMap.value=o,i.uniforms.panoDisplacementMap.value=e,i.uniforms.panoPosition.value=n,i.uniforms.panoMatrix.value=r,Object.assign(new THREE__namespace.Mesh(sharedGeometry,i),{frustumCulled:!1,dispose:function(){this.material instanceof THREE__namespace.ShaderMaterial&&(this.material.uniforms.panoDisplacementMap.value.dispose(),this.material.uniforms.panoDisplacementMap.value=null,this.material.dispose())}})}var DepthTextureLoader=function(){function e(){this.textureLoader=new TextureLoader}return e.prototype.load=function(e,t,n,r,i,o,a){var s=[0,0],c=function(e,t){s[t]=e,o(.8*s[0]+.2*s[1])},l=[this.textureLoader.loadTexture(e,{imageURL:n.imageURL,viaAjax:!0,timeout:n.timeout,fetcher:n.fetcher},void 0,void 0,(function(e){return c(e,1)}),a),this.textureLoader.loadCubeTexture(t,{imageURL:n.imageURL,viaAjax:!0,timeout:n.timeout,fetcher:n.fetcher},void 0,void 0,(function(e){return c(e,0)}),a)];return Promise.all(l).then((function(e){var t=e[0],i=e[1],o={body:toPanoModel(t.body,i.body,n.position,n.matrix),meta:__spreadArray([t.meta],i.meta,!0)};return r(o),o})).catch((function(e){for(var t=0,n=l;t<n.length;t++){n[t].then((function(e){return e.body.dispose()})).catch(noop$1)}return i(e),Promise.reject(e)}))},e}(),PANO_TEXTURE_SCALE$1=new THREE__namespace.Vector3(-1,1,1),DepthPanoramaController=function(e){function t(n){var r,i,o,a=this,s=t.parseArgs(n);a=e.call(this,s)||this;var c=s.initial;return c.state,c.currentState,a.maxAccessibleDistance=s.maxAccessibleDistance,a.panoTapTriggerRadius=s.panoTapTriggerRadius,a.panoCircleMeshCreator=s.panoCircleMeshCreator,a.panoModelGroup=new THREE__namespace.Group,a.panoModelGroup.name="panoModels",a.scene.add(a.panoModelGroup),a.panoMeshes={},a.updatePanoMeshes(),a.helper.remove(a.intersectMesh),a.locationMotion=new Motion({count:0,distance:a.camera.pose.distance}),a.modelAlphaMotion=new Motion({modelAlpha:null!==(r=a.models.getMaterial().modelAlpha)&&void 0!==r?r:0}),a.perspToOrthoMotion=new Motion({perspToOrtho:a.camera.perspToOrtho.x}),a.panoResources={},a.panoResources[a.locationMotion.keyframes[0].key=a.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(a.currentPano),matrix:null!==(o=null===(i=a.models.getMaterial().pano1)||void 0===i?void 0:i.matrix)&&void 0!==o?o:new THREE__namespace.Matrix4,position:a.camera.pose.offset.clone(),effect:"fly"},a.depthTextureLoader=new DepthTextureLoader,a}return __extends(t,e),t.parseArgs=function(n){var r,i,o;if(n instanceof t)return n;var a=e.parseArgs.call(this,n);return __assign(__assign({},a),{maxAccessibleDistance:null!==(r=n.maxAccessibleDistance)&&void 0!==r?r:5,panoTapTriggerRadius:null!==(i=n.panoTapTriggerRadius)&&void 0!==i?i:1,panoCircleMeshCreator:null!==(o=n.panoCircleMeshCreator)&&void 0!==o?o:function(e){return new PanoCircleMesh}})},t.initAnimationEndState=function(t){var n=this.parseArgs(t),r=e.initAnimationEndState.call(this,n);return __assign(__assign({},r),{mode:"DepthPanorama"})},t.prototype.destroy=function(){var t;if(e.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.pendingTextureTask,this.panoModelGroup){for(var n=0,r=this.panoModelGroup.children;n<r.length;n++){var i=r[n];"function"==typeof i.dispose&&i.dispose()}this.scene.remove(this.panoModelGroup)}if(this.panoMeshes)for(var o=0,a=Object.keys(this.panoMeshes);o<a.length;o++){var s=a[o],c=this.panoMeshes[s];this.helper.remove(c),c.dispose(),delete this.panoMeshes[s]}for(var l=null!==(t=this.models.getMaterial())&&void 0!==t?t:{},u=l.pano0,p=l.pano1,d=0,h=Object.keys(this.panoResources);d<h.length;d++){var f=h[d],m=this.panoResources[f];m.panoModel&&m.panoModel.material.uniforms.panoMap.value!==(null==u?void 0:u.map)&&m.panoModel.material.uniforms.panoMap.value!==(null==p?void 0:p.map)&&(this.panoModelGroup.remove(m.panoModel),m.panoModel.material.uniforms.panoMap.value.dispose(),m.panoModel.dispose(),delete m.panoModel),delete this.panoResources[f]}},t.prototype.isReady=function(){return!1===this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,n,r,i){this.userAction=i,this.works=e;var o=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:r,state:n,userAction:i}})),a={workCode:o.workCode,panoIndex:o.panoIndex};return this.hideIntersectMesh(),this.updatePanoMeshes(),this.moveToPano(a,{effect:"fade",duration:r,longitude:n.longitude,latitude:n.latitude,fov:n.fov},i),!0},t.prototype.updateTime=function(e,t){var n,r,i=this;if(!this.destroyed){var o={},a={},s=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),c=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),l=!1;if(!1===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),!1===this.modelAlphaMotion.ended&&(this.modelAlphaMotion.update(e),o.modelAlpha=this.modelAlphaMotion.value.modelAlpha),!1===this.perspToOrthoMotion.ended&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!1===this.locationMotion.ended){this.locationMotion.update(e);var u=this.locationMotion.getKeyFrameSegment(e),p=u[0],d=u[1],h=this.panoResourceFromLocationMotionKeyframe(p),f=this.panoResourceFromLocationMotionKeyframe(d),m=(new THREE__namespace.Vector3).copy(h.position),v=(new THREE__namespace.Vector3).copy(f.position),A=this.locationMotion.value.count-d.value.count+1;o.progress=A;for(var g=0,y=this.panoModelGroup.children;g<y.length;g++){var b=y[g];b.visible=b===h.panoModel||b===f.panoModel}h.panoModel&&(h.panoModel.material.uniforms.opacity.value=1-A,h.panoModel.material.depthTest=0!==A),f.panoModel&&(f.panoModel.material.uniforms.opacity.value=A,f.panoModel.material.depthTest=1!==A),f.panoModel&&(A<1?h.panoModel&&(o.pano0={map:h.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:h.matrix}):o.pano0={map:f.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:f.matrix},o.pano1={map:f.panoModel.material.uniforms.panoMap.value,luminanceMap:null,matrix:f.matrix}),l=o.useBlackTransition="instant"===f.effect||"montage"===f.effect,"fade"!==f.effect&&"montage"!==f.effect||(o.pano0&&(o.pano0={map:o.pano0.map,luminanceMap:null,matrix:h.matrix.clone().setPosition(f.position)}),m.copy(v)),a.distance=this.locationMotion.value.distance,a.offset=new THREE__namespace.Vector3(m.x+(v.x-m.x)*A,m.y+(v.y-m.y)*A,m.z+(v.z-m.z)*A);for(var E=[],_=[],T=0,x=this.locationMotion.keyframes;T<x.length;T++){var R=x[T],w=R.key,M=R.progress;void 0!==w&&(E.push(w),M>=this.locationMotion.progress&&_.push(w))}for(var S=0,C=Object.keys(this.panoResources);S<C.length;S++){var I=C[S];if(!(_.indexOf(I)>=0)){var P=this.panoResources[I];if(P.panoModel){if(P.panoModel.material.uniforms.panoMap.value===(null===(n=o.pano0)||void 0===n?void 0:n.map))continue;if(P.panoModel.material.uniforms.panoMap.value===(null===(r=o.pano1)||void 0===r?void 0:r.map))continue;this.panoModelGroup.remove(P.panoModel),P.panoModel.material.uniforms.panoMap.value.dispose(),P.panoModel.dispose(),delete P.panoModel}E.indexOf(I)>=0||delete this.panoResources[I]}}this.currentPano=panoParse(f.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(s.panoId),state:__assign(__assign(__assign(__assign({},panoParse(c.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),a),options:{},progress:this.locationMotion.progress,error:null}))}!1===isEmptyObject(o)&&this.models.setMaterial(o),!1===isEmptyObject(a)&&this.setCamera(a);var B=this.works.getResolvedObserver(this.currentPano),O=this.locationMotion.ended?this.getForwardObserverOrNot():null;if(this.camera.pose.distance>.1||l){if(B)for(var k=0,H=Object.keys(this.panoMeshes);k<H.length;k++){var F=H[k];(Q=this.panoMeshes[F]).setOpacity(0),Q.setCurrent(!1),Q.updateTime&&Q.updateTime(e,t)}}else if(B){var L=arrayMin(B.visibleIds,(function(e){var t=i.works.getResolvedObserver(e);return t?B.standingPosition.distanceTo(t.standingPosition):1/0}),!0)[1];L=clamp(L,2.5,1/0);for(var D=B.visibleIds.concat(panoStringify(this.currentPano)),N=this.camera.getDirection(new THREE__namespace.Vector3),V=0,U=Object.keys(this.panoMeshes);V<U.length;V++){F=U[V];var Q=this.panoMeshes[F],z=this.works.getResolvedObserver(F);if(-1===D.indexOf(F))Q.setCurrent(!1),Q.setOpacity(0);else if(z)if(z.loadable||z.active){var j=Q.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Q.setCurrent(!Q.loading&&0===Q.progress&&null!==O&&O.panoId===F),Q.setOpacity(j<.01?0:clamp(L/j*1.2,.4,.85));var q=this.camera.position.clone().setY(Q.position.y),G=(new THREE__namespace.Vector3).copy(Q.position).sub(q).normalize();if(F===panoStringify(this.currentPano)){var K=clamp((.5-q.distanceTo(Q.position))/.5,0,1);G.multiplyScalar(1-K).add(N.clone().multiplyScalar(K))}G.length()>0&&Q.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(G.x,G.z),0))}else Q.setCurrent(!1),Q.setOpacity(0);else Q.setCurrent(!1),Q.setOpacity(0);Q.updateTime&&Q.updateTime(e,t)}}}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],t=this.locationMotion.getKeyFrameSegment(now())[1],n=this.panoResourceFromLocationMotionKeyframe(t),r=this.works.getResolvedObserver(n.panoId);return{mode:this.mode,workCode:r?r.work.workCode:this.currentPano.workCode,panoIndex:r?r.pano.panoIndex:this.currentPano.panoIndex,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:r?r.position.clone():this.camera.position.clone(),distance:0}},t.prototype.moveToPano=function(e,t,n){var r,i=this;void 0===t&&(t={});var o=this.works.getResolvedObserver(e);if(!o)throw new Error("panoId ".concat(JSON.stringify(e)," is not found."));this.userAction=n;var a=o.images.depth,s=__assign({key:"pano.".concat(o.panoId)},pick(this.imageOptions,["format","size","quality","sharpen","mappings"])),c=this.imageOptions.transform,l=o.images,u=o.position,p=o.quaternion,d=(new THREE__namespace.Matrix4).compose(u,p,new THREE__namespace.Vector3(-1,1,1)),h="pano:"+jsonHash(l);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===h)return;var f=this.pendingTextureTask.panoId,m=panoParse(f);null===(r=this.panoMeshes[f])||void 0===r||r.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:m})),this.pendingTextureTask.onError(new Error("pano ".concat(JSON.stringify(m)," texture aborted")))}var v="move-to-pano-"+o.panoId;this.pending.add(v),this.pendingTextureTask={panoId:o.panoId,hash:h,onLoad:function(e){i.pending.delete(v),i.destroyed?e.body.dispose():(e.body.name=h,i.doMoveToPano(o.pano,e.body,t))},onError:function(e){i.pending.delete(v);var n=__assign(__assign(__assign({},o.pano),{mode:i.mode}),clonePose(i.camera.pose));i.emit("pano.error",createEvent("pano.error",{error:e,userAction:i.userAction,options:t,prevPano:i.currentPano,progress:0,state:n})),i.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:i.userAction,options:t,prevPano:i.currentPano,progress:0,state:n})),t.moveCancelCallback&&t.moveCancelCallback()}};var A=this.panoMeshes[o.panoId];A&&A.tap&&A.tap(),this.depthTextureLoader.load(a,l,{imageURL:{transform:c,options:s},position:u,matrix:d,fetcher:getFetcher(o.work)},(function(e){var t,n;(null===(t=i.pendingTextureTask)||void 0===t?void 0:t.hash)===h?(i.pendingTextureTask.onLoad(e),null===(n=i.panoMeshes[o.panoId])||void 0===n||n.setProgress(0),delete i.pendingTextureTask,i.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:e.meta,pano:o.pano}))):e.body.dispose()}),(function(e){var t,n;(null===(t=i.pendingTextureTask)||void 0===t?void 0:t.hash)===h&&(i.pendingTextureTask.onError(e),null===(n=i.panoMeshes[o.panoId])||void 0===n||n.setProgress(0),delete i.pendingTextureTask,i.emit("pano.texture.error",createEvent("pano.texture.error",{error:e,progress:0,meta:null,pano:o.pano})),i.emit("error",e))}),(function(e){var t,n;i.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:e,meta:null,pano:o.pano})),(null===(t=i.pendingTextureTask)||void 0===t?void 0:t.hash)===h&&(null===(n=i.panoMeshes[o.panoId])||void 0===n||n.setProgress(e))}),this.renderer),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:o.pano}))},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(n){var r=e.initial;r.state,r.currentState;var i=r.duration,o=r.userAction,a=t.initAnimationEndState(e),s={workCode:a.workCode,panoIndex:a.panoIndex},c=!1;e.userAction=o;var l={modelAlpha:0},u={perspToOrtho:0};e.moveToPano(s,{longitude:a.longitude,latitude:a.latitude,fov:a.fov,duration:i,moveStartCallback:function(t){c=!0,e.perspToOrthoMotion.set(u,i).catch(noop$1),e.modelAlphaMotion.set(l,i).catch(noop$1),e.emit("initAnimation.start",createEvent("initAnimation.start",{state:t,userAction:o}))},moveEndCallback:function(t){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:t,userAction:e.userAction})),n()},moveCancelCallback:function(){var t=__assign(__assign(__assign({},s),{mode:e.mode}),clonePose(e.camera.pose));!1===c&&e.emit("initAnimation.start",createEvent("initAnimation.start",{state:t,userAction:e.userAction})),e.emit("initAnimation.end",createEvent("initAnimation.end",{state:t,userAction:e.userAction})),n()}},o)}))},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.locationMotionKeyframesLength=function(e){for(var t=0,n=1;n<e.length;n++){var r=this.panoResourceFromLocationMotionKeyframe(e[n-1]).position,i=this.panoResourceFromLocationMotionKeyframe(e[n]).position;t+=r.distanceTo(i)*(e[n].value.count-e[n-1].value.count)}return t},t.prototype.updatePanoMeshes=function(){for(var e=this,t={},n=0,r=Object.keys(this.panoMeshes);n<r.length;n++){var i=r[n],o=this.panoMeshes[i];t[i]=o,delete this.panoMeshes[i]}for(var a=1,s={},c=function(t){var n=arrayMin(t.accessibleIds,(function(n){var r=e.works.getResolvedObserver(n);return r?clamp(r.standingPosition.distanceTo(t.standingPosition),1,1/0):1/0}),!0)[1];void 0===s[t.panoId]&&(s[t.panoId]=n)},l=0,u=this.works.resolvedObservers;l<u.length;l++){c(f=u[l])}var p=Object.keys(s).map((function(e){return s[e]}));p.length&&(a=clamp(.6*(p.reduce((function(e,t){return e+t}),0)/p.length),1,3));for(var d=0,h=this.works.resolvedObservers;d<h.length;d++){var f;o=void 0;t[(f=h[d]).panoId]?(!0===(o=t[f.panoId]).loading&&!1===f.loadable&&o.setLoading(!1),delete t[f.panoId]):((o=this.panoCircleMeshCreator(f.pano)).name="PanoCircleMesh_"+f.panoId,this.helper.remove(o)),o.scale.set(a,1,a),o.position.copy(f.standingPosition),this.panoMeshes[f.panoId]=o}for(var m=0,v=Object.keys(t);m<v.length;m++){var A=v[m];this.helper.remove(t[A]),t[A].dispose(),delete t[A]}},t.prototype.doMoveToPano=function(e,t,n){var r,i,o,a,s=this;void 0===n&&(n={});var c=now(),l=createUuid(),u=this.works.getResolvedObserver(e);if(!u)throw new Error("panoId ".concat(JSON.stringify(e)," never found"));var p=this.panoResources[l]={panoId:u.panoId,effect:null!==(r=n.effect)&&void 0!==r?r:"fly",panoModel:t,matrix:(new THREE__namespace.Matrix4).compose(u.position,u.quaternion,PANO_TEXTURE_SCALE$1),position:u.position.clone()};t.visible=!1,t.renderOrder=-1,this.panoModelGroup.add(t);var d,h,f;if(this.locationMotion.ended){var m=this.locationMotion.getKeyFrameSegment(c);m[0];var v=m[1],A=this.locationMotion.value,g=this.panoResourceFromLocationMotionKeyframe(v).position,y=p.position;d=Math.max(g.distanceTo(y),1),h=[{key:v.key,progress:0,value:__assign(__assign({},A),{count:0})},{key:l,progress:1,value:{distance:0,count:1}}],f=0}else{var b=this.locationMotion.getKeyFrameSegment(c),E=b[0],_=(v=b[1],A=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(E).position),T=(g=this.panoResourceFromLocationMotionKeyframe(v).position,y=p.position,v.value.count-A.count),x=Math.max(_.distanceTo(g),1)*T;d=x+Math.max(g.distanceTo(y),1),h=[{key:E.key,progress:0,value:__assign({},A)},{key:v.key,progress:x/d,value:v.value},{key:l,progress:1,value:{count:v.value.count+1,distance:0}}];var R=this.locationMotionKeyframesLength(this.locationMotion.keyframes),w=this.locationMotionKeyframesLength(h);f=0===R||0===R?0:this.locationMotion.getProgressVelocity(c)*R/w}var M=this.calculateMovingDuration(n.duration,"fade"===n.effect||"montage"===n.effect?0:d),S={longitude:n.longitude,latitude:n.latitude,fov:n.fov},C=__assign(__assign({},e),{mode:this.mode,longitude:null!==(i=S.longitude)&&void 0!==i?i:this.camera.pose.longitude,latitude:null!==(o=S.latitude)&&void 0!==o?o:this.camera.pose.latitude,fov:null!==(a=S.fov)&&void 0!==a?a:this.camera.pose.fov,offset:u.position.clone(),distance:this.camera.pose.distance}),I=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:n,prevPano:I,progress:0,state:C,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(C),this.cameraMotion.set(S,M).catch(noop$1),this.locationMotion.setKeyframes(h,M,f).then((function(){var t=__assign(__assign({},e),{mode:s.mode,longitude:s.camera.pose.longitude,latitude:s.camera.pose.latitude,fov:s.camera.pose.fov,offset:s.camera.pose.offset.clone(),distance:s.camera.pose.distance});s.emit("pano.arrived",createEvent("pano.arrived",{options:n,prevPano:I,progress:1,state:t,userAction:s.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(t)}),(function(){s.emit("pano.cancel",createEvent("pano.cancel",{options:n,prevPano:I,progress:0,state:C,userAction:s.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()}))},t.prototype.getForwardObserverOrNot=function(e){var t=this,n=this.camera.getDirection(new THREE__namespace.Vector3),r=this.camera.position.clone(),i=this.works.getResolvedObserver(this.currentPano);if(!i)return null;var o=i.accessibleIds.filter((function(e){if(e===panoStringify(t.currentPano))return!1;var n=t.works.getResolvedObserver(e);if(!n)return!1;var i=n.standingPosition.clone().sub(r);return 0!==i.length()&&(!(i.angleTo(new THREE__namespace.Vector3(0,-1,0))<Math.PI/12)&&(n.loadable||n.active))})),a=(e?e.ray.direction.clone():n.clone()).setY(0);if(0===a.length())return null;for(var s=o.slice().sort((function(e,n){var i=t.works.getResolvedObserver(e).position.clone().setY(r.y),o=t.works.getResolvedObserver(n).position.clone().setY(r.y);return i.distanceTo(r)-o.distanceTo(r)})),c=0,l=[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3];c<l.length;c++)for(var u=l[c],p=0,d=s;p<d.length;p++){var h=d[p],f=this.works.getResolvedObserver(h);if(f){var m=f.position.clone().setY(r.y).sub(r);if(m&&0!==m.length()&&a.angleTo(m)<u)return f}}return null},t.prototype.onTapGesture=function(e){var t,n=this;this.userAction=e.userAction,this.stopMomentumMovement();var r=e.center.raycaster,i=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),o=null,a=this.works.getResolvedObserver(this.currentPano);if(a){var s=a.accessibleIds.filter((function(e){if(e===panoStringify(n.currentPano))return!1;var t=n.works.getResolvedObserver(e);return!!t&&(!(t.position.distanceTo(n.camera.position)>n.maxAccessibleDistance)&&(t.loadable||t.active))})),c=r.intersectObject(this.boundingMesh,!0)[0];if(c){var l=arrayMin(s,(function(e){var t=n.works.getResolvedObserver(e).standingPosition.clone();return t.clone().sub(n.camera.position).setY(0).angleTo(i)>Math.PI/2?1/0:t.distanceTo(c.point)}),!0),u=l[0],p=l[1];u&&p<this.panoTapTriggerRadius&&(o=null!==(t=this.works.getResolvedObserver(u))&&void 0!==t?t:null)}o||(o=this.getForwardObserverOrNot(r));for(var d=0,h=this.locationMotion.keyframes;d<h.length;d++){var f=h[d],m=this.panoResourceFromLocationMotionKeyframe(f);if(!(f.progress<this.locationMotion.progress)&&(o&&m.panoId===o.panoId)){o=null;break}}if(o){for(var v={},A=Math.PI/6,g=Math.PI/12,y=new THREE__namespace.Vector3(0,1,0),b=o.position.clone().setY(0).sub(a.position.clone().setY(0)).normalize(),E=b.clone().applyAxisAngle(y,A),_=b.clone().applyAxisAngle(y,-A),T=[],x=[],R=[],w=0,M=o.accessibleIds;w<M.length;w++){var S=panoParse(u=M[w]);if(!panoEqual(S,this.currentPano)&&!panoEqual(S,o.pano)){var C=this.works.getResolvedObserver(u);if(C){var I=C.position.clone().sub(o.position).setY(0);b.angleTo(I)<A?R.push(I):E.angleTo(I)<A?T.push(I):_.angleTo(I)<A&&x.push(I)}}}var P=(R.length>0?R:__spreadArray(__spreadArray([],T,!0),x,!0)).slice().sort((function(e,t){return e.angleTo(b)-t.angleTo(b)}))[0];P&&P.angleTo(i)>g&&(v.longitude=Math.atan2(-P.x,-P.z)),this.cameraMotion.value.latitude<-Math.PI/4&&(v.latitude=clamp(0,this.minLatitude,this.maxLatitude));var B=__assign({},e.state);if(B.workCode=o.pano.workCode,B.panoIndex=o.pano.panoIndex,void 0!==v.longitude&&(B.longitude=v.longitude),void 0!==v.latitude&&(B.latitude=v.latitude),void 0!==v.fov&&(B.fov=v.fov),B.distance=0,B.offset=o?o.position.clone():new THREE__namespace.Vector3,e.state=B,this.emit("gesture.tap",e),!e.defaultPrevented){if(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:B,userAction:e.userAction,options:v,progress:0,error:null})),o&&!o.active){var O=o.panoId;this.panoMeshes[O]&&(this.panoMeshes[O].setDisabled(!1),this.panoMeshes[O].setLoading(!0))}o&&o.active&&this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:B,options:v,error:null}))}}else this.emit("gesture.tap",e),e.defaultPrevented||!0===this.locationMotion.ended&&this.cameraBounce()}},t}(PanoramaLikeController);const edlVertexShader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{ZnvH{vs|z-znA-z|qrycvrZnvHn\bv{t-rp?-bH|vq-znv{56-\nb-J-HrpA-z]|vv|{-J-z|qrycvrZnv-7-rpA5}|vv|{9>;=6Htyl]|vv|{-J-}|wrpv|{Znv-7-z]|vv|{H\f"),edlFragmentShader=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("0rr{v|{-TYlRealsntlqr}u-G-r{noyr<<<<-nqn}rq-s|z-ur-RQY-unqr-p|qr-s|z-Puvvn{-O|pur{\b-v{-py|q-p|z}nrG<<-u}G<<tvuo;p|z<py|qp|z}nr<{x<rr<znr<}ytv{<\0RQY<unqr<RQY<<}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{H{vs|z-sy|n-prr{dvquH{vs|z-sy|n-prr{UrvtuH{vs|z-rp?-{rvtuo|h[RVTUO\\b_lP\\b[ajH{vs|z-sy|n-rqy`r{tuH{vs|z-sy|n-nqvH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-[rnH{vs|z-sy|n-SnH{vs|z-znA-]|wH{vs|z-nz}yr?Q-RQYP|y|Hn\bv{t-rp?-bHsy|n-r}|{r5sy|n-qr}u6\n--rp?-_nqv-J-nqv-<-rp?5prr{dvqu9-prr{Urvtu6H--sy|n-z-J-=;=H--s|5v{-v-J-=H-v-I-[RVTUO\\b_lP\\b[aH-v886\n----rp?-[rvtuo|-J-b-8-_nqv-7-{rvtuo|hvjH----sy|n-{rvtuo|Qr}u-J-rr?Q5RQYP|y|9-[rvtuo|6;nH----{rvtuo|Qr}u-J-5{rvtuo|Qr}u-JJ->;=6-L-=;=-G-{rvtuo|Qr}uH----vs5{rvtuo|Qr}u-.J-=;=6\n------vs5qr}u-JJ-=;=6\n--------z-8J->==;=H------\fryr\n--------z-8J-zn5=;=9-qr}u-:-{rvtuo|Qr}u6H------\f----\f--\f--r{-z-<-sy|n5[RVTUO\\b_lP\\b[a6H\f|vq-znv{56\n--rpA-pRQY-J-rr?Q5RQYP|y|9-b6H--sy|n-qr}u-J-pRQY;nH--qr}u-J-5qr}u-JJ->;=6-L-=;=-G-qr}uH--sy|n-r-J-r}|{r5qr}u6H--sy|n-unqr-J-r}5:r-7-@==;=-7-rqy`r{tu6H--tylSntP|y|-J-rpA5pRQY;to-7-unqr9-|}npv\b6H--\n-<<-vr-rtyn-u\b}ro|yvp-qr}u-nyr-|-qr}u-ossr----sy|n-qy-J-}|5?;=9-qr}u6H----rpA-q}-J-]|w-7-rpA5=;=9-=;=9-:qy9->;=6H----sy|n-}\t-J-q};\t-<-q};H----sy|n-sntQr}u-J-5}\t-8->;=6-<-?;=H----<<-tylSntQr}uRea-J-sntQr}uH--\f--vs5qr}u-JJ-=;=6\n----qvpnqH--\f\f");var EDLMaterial=function(e){function t(t){var n=e.call(this)||this;return n.uniforms={screenWidth:makeUniform$1("f",0),screenHeight:makeUniform$1("f",0),edlStrength:makeUniform$1("f",1),uNear:makeUniform$1("f",1),uFar:makeUniform$1("f",1),radius:makeUniform$1("f",1),neighbours:makeUniform$1("2fv",new Float32Array),depthMap:makeUniform$1("t",new THREE__namespace.Texture),uEDLColor:makeUniform$1("t",new THREE__namespace.Texture),uEDLDepth:makeUniform$1("t",new THREE__namespace.Texture),opacity:makeUniform$1("f",1),uProj:makeUniform$1("Matrix4fv",new Float32Array)},n.neighbourCount=8,n.updateShaderSource(),n.transparent=!0,n}return __extends(t,e),t.prototype.getUniform=function(e){return void 0===this.uniforms?void 0:this.uniforms[e].value},t.prototype.setUniform=function(e,t){void 0!==this.uniforms&&(this.uniforms[e].value=t)},t.prototype.getDefines=function(){var e="";return e+="#define NEIGHBOUR_COUNT "+this.neighbourCount+"\n"},t.prototype.updateShaderSource=function(){var e=this.getDefines()+edlVertexShader,t=this.getDefines()+edlFragmentShader;this.setValues({vertexShader:e,fragmentShader:t}),this.needsUpdate=!0},__decorate([uniform$1("screenWidth"),__metadata("design:type",Number)],t.prototype,"screenWidth",void 0),__decorate([uniform$1("screenHeight"),__metadata("design:type",Number)],t.prototype,"screenHeight",void 0),__decorate([uniform$1("edlStrength"),__metadata("design:type",Number)],t.prototype,"edlStrength",void 0),__decorate([uniform$1("uNear"),__metadata("design:type",Number)],t.prototype,"uNear",void 0),__decorate([uniform$1("uFar"),__metadata("design:type",Number)],t.prototype,"uFar",void 0),__decorate([uniform$1("radius"),__metadata("design:type",Number)],t.prototype,"radius",void 0),__decorate([uniform$1("neighbours",!0),__metadata("design:type",Float32Array)],t.prototype,"neighbours",void 0),__decorate([uniform$1("depthMap"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"depthMap",void 0),__decorate([uniform$1("uEDLColor"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"uEDLColor",void 0),__decorate([uniform$1("uEDLDepth"),__metadata("design:type",THREE__namespace.Texture)],t.prototype,"uEDLDepth",void 0),__decorate([uniform$1("uProj"),__metadata("design:type",Array)],t.prototype,"uProj",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform$1(e,t){return{type:e,value:t}}function uniform$1(e,t){return void 0===t&&(t=!1),function(n,r){Object.defineProperty(n,r,{get:function(){return this.getUniform(e)},set:function(n){n!==this.getUniform(e)&&(this.setUniform(e,n),t&&this.updateShaderSource())}})}}var passCamera$1=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$2=new THREE__namespace.BufferGeometry;geometry$2.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$2.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$2=new THREE__namespace.Mesh(geometry$2),edlEffectScene=new THREE__namespace.Scene;edlEffectScene.add(mesh$2);var EDLEffect=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r,i)||this;return o.sharedV2=new THREE__namespace.Vector2,o.renderer=t,o.material=new EDLMaterial,mesh$2.material=o.material,o}return __extends(t,e),t.prototype.render=function(e){var t=this.camera,n=this.material.uniforms,r=this.renderer.getSize(this.sharedV2);n.screenWidth.value=r.x,n.screenHeight.value=r.y;var i=t.projectionMatrix,o=new Float32Array(16);o.set(i.elements);for(var a=new Float32Array(2*this.material.neighbourCount),s=0;s<this.material.neighbourCount;s++)a[2*s+0]=Math.cos(2*s*Math.PI/this.material.neighbourCount),a[2*s+1]=Math.sin(2*s*Math.PI/this.material.neighbourCount);n.neighbours.value=a,n.uNear.value=t.near,n.uFar.value=t.far,n.uEDLColor.value=e[0].texture,n.uProj.value=o,n.edlStrength.value=.25,n.radius.value=1,n.opacity.value=1,this.renderer.setRenderTarget(null),this.renderer.render(edlEffectScene,passCamera$1)},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect);const fragment=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{H{vs|z-nz}yr?Q-drvtuZn}H{vs|z-nz}yr?Q-Qr}uZn}Hn\bv{t-rp?-bH|vq-znv{56-\nsy|n-qr}u-J-rr?Q5Qr}uZn}9-b6;Hvs5qr}u-KJ->;=6\nqvpnqH\frpA-p|y|-J-rr?Q5drvtuZn}9-b6H-p|y|-J-p|y|-<-p|y|;HtylSntP|y|-J-rpA5p|y|;\b\t9->;=6H-\f"),vertex=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e[0].split("").map((function(e){return e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)})).join("")}("}rpvv|{-zrqvz}-sy|nH}rpvv|{-zrqvz}-v{Hnvor-rp@-}|vv|{Hnvor-rp?-H{vs|z-znA-}|wrpv|{ZnvH{vs|z-znA-z|qrycvrZnvHn\bv{t-rp?-bH|vq-znv{56-\nb-J-Htyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-rpA5}|vv|{9>;=6H\f");var HQMaterial=function(e){function t(t){var n=e.call(this,{vertexShader:vertex,fragmentShader:fragment})||this;return n.uniforms={uDepthMap:makeUniform("t",null),uWeightMap:makeUniform("t",null)},n.depthTest=!0,n.depthWrite=!0,n.opacity=1,n}return __extends(t,e),t.prototype.getUniform=function(e){return void 0===this.uniforms?void 0:this.uniforms[e].value},t.prototype.setUniform=function(e,t){void 0!==this.uniforms&&(this.uniforms[e].value=t)},__decorate([uniform("uDepthMap"),__metadata("design:type",Number)],t.prototype,"uDepthMap",void 0),__decorate([uniform("uWeightMap"),__metadata("design:type",Number)],t.prototype,"uWeightMap",void 0),t}(THREE__namespace.RawShaderMaterial);function makeUniform(e,t){return{type:e,value:t}}function uniform(e,t){return void 0===t&&(t=!1),function(n,r){Object.defineProperty(n,r,{get:function(){return this.getUniform(e)},set:function(n){n!==this.getUniform(e)&&(this.setUniform(e,n),t&&this.updateShaderSource())}})}}var passCamera=new THREE__namespace.OrthographicCamera(-1,1,1,-1,0,1),geometry$1=new THREE__namespace.BufferGeometry;geometry$1.setAttribute("position",new THREE__namespace.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),geometry$1.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([0,2,0,0,2,0],2));var mesh$1=new THREE__namespace.Mesh(geometry$1),hqScene=new THREE__namespace.Scene;hqScene.add(mesh$1);var HQEffect=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r,i)||this;return o.sharedV2=new THREE__namespace.Vector2,o.renderer=t,o.material=new HQMaterial,o.scene=n,o.camera=r,mesh$1.material=o.material,o}return __extends(t,e),t.prototype.render=function(e){var t=this.material.uniforms;this.models.setMaterial({useHQWeight:!0,useHQDepth:!1}),this.renderer.setRenderTarget(e[1]),this.models.update(this.renderer,this.camera,"Mapview"),this.renderer.autoClearDepth=!1,this.renderer.setClearAlpha(0),this.renderer.render(this.scene,this.camera),t.uWeightMap.value=e[1].texture,t.uDepthMap.value=e[0].depthTexture,this.renderer.setRenderTarget(null),this.renderer.autoClearDepth=!0,this.renderer.setClearAlpha(1),this.renderer.render(hqScene,passCamera),this.models.setMaterial({useHQWeight:!1,useHQDepth:!0}),this.models.update(this.renderer,this.camera,"Mapview")},t.prototype.dispose=function(){this.copyPass.dispose()},t}(Effect),RAYCASTER_NEAR=.5,minDistance=0,MapviewController=function(e){function t(n){var r,i=this,o=t.parseArgs(n);return(i=e.call(this,o)||this).mode="Mapview",i.defaultLongitude=o.defaultLongitude,i.defaultLatitude=o.defaultLatitude,i.defaultDistance=o.defaultDistance,i.maxLatitude=o.maxLatitude,i.minLatitude=o.minLatitude,i.locationMotion=new Motion({x:i.camera.pose.offset.x,y:i.camera.pose.offset.y,z:i.camera.pose.offset.z,distance:i.camera.pose.distance}),i.modelAlphaMotion=new Motion({modelAlpha:null!==(r=i.models.getMaterial().modelAlpha)&&void 0!==r?r:0}),i.perspToOrthoMotion=new Motion({perspToOrtho:i.camera.perspToOrtho.x}),i.intersectMeshCreator=o.intersectMeshCreator,i.intersectMesh=i.intersectMeshCreator(),i.intersectMesh.name="intersect",i.intersectMesh.visible=!1,i.currentTapId=null,i.helper.add(i.intersectMesh),i.edlTarget=new THREE__namespace.WebGLRenderTarget(1024,1024,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(1024,1024,THREE__namespace.UnsignedIntType)}),i.edlEffect=new EDLEffect(i.renderer,i.scene,i.camera,i.models),i.hqEffect=new HQEffect(i.renderer,i.scene,i.camera,i.models),i}return __extends(t,e),t.parseArgs=function(n){var r,i,o,a,s,c;if(n instanceof t)return n;var l=e.parseArgs.call(this,n);return __assign(__assign({},l),{defaultLongitude:null!==(r=n.defaultLongitude)&&void 0!==r?r:Math.PI/4,defaultLatitude:null!==(i=n.defaultLatitude)&&void 0!==i?i:Math.PI/4,defaultDistance:null!==(o=n.defaultDistance)&&void 0!==o?o:150,maxLatitude:null!==(a=n.maxLatitude)&&void 0!==a?a:+Math.PI/2,minLatitude:null!==(s=n.minLatitude)&&void 0!==s?s:0,intersectMeshCreator:null!==(c=n.intersectMeshCreator)&&void 0!==c?c:function(){return new IntersectMesh}})},t.distanceFromModel=function(e,t,n){var r=e.bounding,i=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),.5),o=i/2/Math.tan(Math.PI*t/360);return n<1&&(o/=n),isNaN(o)?i:o},t.initAnimationEndState=function(e){var n,r,i,o,a,s,c,l=this.parseArgs(e),u=l.works,p=l.models,d=e.initial,h=d.state,f=d.currentState,m="number"==typeof h.panoIndex?{workCode:null!==(i=null!==(n=h.workCode)&&void 0!==n?n:null===(r=l.works[0])||void 0===r?void 0:r.workCode)&&void 0!==i?i:"",panoIndex:h.panoIndex}:{workCode:f.workCode,panoIndex:f.panoIndex},v=u.getResolvedObserver(m),A=null!==(o=h.fov)&&void 0!==o?o:60,g=clamp(null!==(a=h.latitude)&&void 0!==a?a:isThirdPersonMode(f.mode)?f.latitude:l.defaultLatitude,l.minLatitude,l.maxLatitude),y=t.distanceFromModel(l.models,A,l.camera.aspect),b=new THREE__namespace.Vector3,E=null!==(s=h.distance)&&void 0!==s?s:Math.min(l.defaultDistance,y),_=null!==(c=h.longitude)&&void 0!==c?c:isThirdPersonMode(f.mode)?f.longitude:l.defaultLongitude;return h.offset?b.copy(h.offset):l.defaultDistance<y&&v?(b.copy(v.position),void 0===h.longitude&&(_=f.longitude)):b.copy(p.bounding.getCenter(b)),p.bounding.containsPoint(b)||p.bounding.getCenter(b),__assign(__assign({},m),{mode:"Mapview",longitude:_,latitude:g,fov:A,offset:b,distance:E})},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.locationMotion.dispose(),delete this.panState,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)},t.prototype.isReady=function(){return!1!==this.locationMotion.ended&&e.prototype.isReady.call(this)},t.prototype.updateWork=function(e,n,r,i){this.userAction=i,this.works=e;var o=t.initAnimationEndState(__assign(__assign({},this),{initial:{currentState:__assign(__assign({},this.currentPano),this.camera.pose),duration:r,state:n,userAction:i}}));this.currentPano={workCode:o.workCode,panoIndex:o.panoIndex};var a={longitude:o.longitude,latitude:o.latitude,fov:o.fov},s={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance,orthoDistance:o.distance};return this.locationMotion.set(s,r).catch(noop$1),this.cameraMotion.set(a,r).catch(noop$1),!0},t.prototype.updateModel=function(t){e.prototype.updateModel.call(this,t)},t.prototype.updateCamera=function(e,t,n){var r=this;return this.initAnimationReady.then((function(){r.userAction=n,r.stopMomentumMovement();var i={},o={};return void 0!==e.distance&&(i.distance=e.distance),void 0!==e.offset&&(i.x=e.offset.x,i.y=e.offset.y,i.z=e.offset.z),void 0!==e.longitude&&(o.longitude=e.longitude),void 0!==e.latitude&&(o.latitude=e.latitude),void 0!==e.fov&&(o.fov=e.fov),r.locationMotion.set(i,t).catch(noop$1),r.cameraMotion.set(o,t).catch(noop$1)}))},t.prototype.updateCameraWithKeyframes=function(e,t,n){var r=this;return this.initAnimationReady.then((function(){r.userAction=n,r.stopMomentumMovement();for(var i=[],o=[],a=0,s=e;a<s.length;a++){var c=s[a];i.push({key:c.key,progress:c.progress,value:{distance:c.value.distance,x:c.value.offset.x,y:c.value.offset.x,z:c.value.offset.x}}),o.push({key:c.key,progress:c.progress,value:{longitude:c.value.longitude,latitude:c.value.latitude,fov:c.value.fov}})}return r.locationMotion.setKeyframes(i,t).catch(noop$1),r.cameraMotion.setKeyframes(e,t)}))},t.prototype.updateTime=function(e,t){if(!this.destroyed){var n={},r={};if(this.locationMotion.ended||(this.locationMotion.update(e),r.distance=this.locationMotion.value.distance,r.offset=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),!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;var i=Math.PI/2-r.latitude<.02?1:0;this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==i&&this.perspToOrthoMotion.set({perspToOrtho:i},500).catch(noop$1)}this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),n.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),isEmptyObject(n)||this.models.setMaterial(n),isEmptyObject(r)||this.setCamera(r)}},t.prototype.getTargetState=function(){var e=this.cameraMotion.getKeyFrameSegment(now())[1],t=this.locationMotion.getKeyFrameSegment(now())[1];return __assign(__assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:t.value.distance,offset:new THREE__namespace.Vector3(t.value.x,t.value.y,t.value.z)})},t.prototype.initAnimation=function(){var e=this;return this.destroyed?Promise.resolve():new Promise((function(n){var r=e.initial;r.state,r.currentState;var i=r.duration,o=r.userAction;e.userAction=o;var a=t.initAnimationEndState(e),s={longitude:a.longitude,latitude:a.latitude,fov:a.fov},c={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance};e.emit("initAnimation.start",createEvent("initAnimation.start",{state:a,userAction:e.userAction})),e.perspToOrthoMotion.set({perspToOrtho:0},i).catch(noop$1),e.modelAlphaMotion.set({modelAlpha:1},i/3).catch(noop$1),e.cameraMotion.set(s,i).catch(noop$1),e.locationMotion.set(c,i).then((function(){e.emit("initAnimation.end",createEvent("initAnimation.end",{state:a,userAction:e.userAction}))}),(function(t){var n=__assign(__assign(__assign({},e.currentPano),{mode:e.mode}),clonePose(e.camera.pose));e.emit("initAnimation.end",createEvent("initAnimation.end",{state:n,userAction:e.userAction}))})).then((function(){n()}))}))},t.prototype.getForwardObserverOrNot=function(e){var t=this.models.intersectRaycaster(e)[0];if(!t)return null;var n=arrayMin(this.works.resolvedObservers,(function(e){return e.standingPosition.distanceTo(t.point)}),!0),r=n[0],i=n[1];return r&&i<10?r:null},t.prototype.coordinatesForOffset=function(e){var t=this.renderer.getSize(new THREE__namespace.Vector2);return{longitude:-2*e.x/(t.x*this.scissor.width),latitude:2*e.y/(t.y*this.scissor.height)}},t.prototype.requestMomentumMovement=function(e,t,n,r){var i=this;if(null!==this.inMomentumMovement){for(var o=__assign({},n),a={longitude:0,latitude:0,x:0,y:0,z:0},s=0;s<r;s++)o.longitude*=.996,o.latitude*=.994008,o.x*=.99,o.y*=.99,o.z*=.99,a.longitude+=o.longitude,a.latitude+=o.latitude,a.x+=o.x,a.y+=o.y,a.z+=o.z;var c=formatRad(this.cameraMotion.value.longitude+a.longitude),l=clamp(this.cameraMotion.value.latitude+a.latitude,this.minLatitude,this.maxLatitude),u=clamp(this.locationMotion.value.x+a.x,this.models.bounding.min.x,this.models.bounding.max.x),p=clamp(this.locationMotion.value.y+a.y,this.models.bounding.min.y,this.models.bounding.max.y),d=clamp(this.locationMotion.value.z+a.z,this.models.bounding.min.z,this.models.bounding.max.z),h=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:l,offset:new THREE__namespace.Vector3(u,p,d),fov:this.cameraMotion.value.fov,distance:this.camera.pose.distance}),f=!(Math.abs(o.longitude)>1e-4||Math.abs(o.latitude)>1e-4||Math.abs(o.x)>1e-4||Math.abs(o.y)>1e-4||Math.abs(o.z)>1e-4),m=createEvent("gesture.momentum",__assign(__assign({},e),{isFirst:t,isFinal:f,state:h}));this.inMomentumMovement.event=m,this.emit("gesture.momentum",m),e.defaultPrevented?this.inMomentumMovement=null:this.inMomentumMovement&&(this.cameraMotion.set({longitude:c,latitude:l},0).catch(noop$1),this.locationMotion.set({x:h.offset.x,y:h.offset.y,z:h.offset.z},0).catch(noop$1),f?this.inMomentumMovement=null:AnimationFrameLoop.shared.add((function(t,n){i.requestMomentumMovement(e,!1,o,0|n)}),!0,1))}},t.prototype.fixFinalState=function(e){if(1!==this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho){var t=coordinatesToVector(e,new THREE__namespace.Vector3),n=(new THREE__namespace.Vector3).copy(e.offset).sub(t.clone().multiplyScalar(e.distance)),r=new THREE__namespace.Raycaster(n,t);r.params.Points={threshold:.1},r.near=RAYCASTER_NEAR;var i=this.models.intersectRaycaster(r)[0];if(!i&&r.ray.direction.y<-.3){var o=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),a=r.ray.intersectPlane(o,new THREE__namespace.Vector3);if(a){var s=a.distanceTo(r.ray.origin);s<1e4&&s>=r.near&&(i={distance:s,floor:0,point:a,object:this.scene,face:null})}}i&&(e.distance=clamp(i.distance,minDistance,1/0),e.offset.copy(n).add(t.clone().multiplyScalar(e.distance)))}},t.prototype.onPanGesture=function(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var t=e.pointers.length,n=this.panState,r=0;"mouse"===e.pointerType&&(r=e.srcEvent.buttons),n&&0===r&&0!==n.buttons&&(r=n.buttons);var i=null==n?void 0:n.target;if(!i){var o=this.relativeClientPosition(e.center),a=new THREE__namespace.Raycaster;a.params.Points={threshold:.1},a.setFromCamera(o,this.camera),a.near=RAYCASTER_NEAR,i=(new THREE__namespace.Vector3).copy(a.ray.direction).multiplyScalar(3).add(a.ray.origin);var s=this.models.intersectRaycaster(a)[0];if(!s&&a.ray.direction.y<-.3){var c=new THREE__namespace.Plane(new THREE__namespace.Vector3(0,1,0),0),l=a.ray.intersectPlane(c,new THREE__namespace.Vector3);if(l){var u=l.distanceTo(a.ray.origin);u<1e4&&u>=a.near&&(s={distance:u,floor:0,point:l,object:this.scene})}}if(s)i.copy(s.point);else{var p=(new THREE__namespace.Vector3).copy(this.camera.pose.offset).sub(this.camera.position);c=(new THREE__namespace.Plane).setFromNormalAndCoplanarPoint(p,this.camera.pose.offset);a.ray.intersectPlane(c,i)}}if(e.isFinal?delete this.panState:this.panState={target:i,buttons:r,pointerLength:t,x:e.center.x,y:e.center.y},void 0!==n&&n.pointerLength===t)if(t>1||2===r){var d={x:e.center.x-n.x,y:e.center.y-n.y},h=new THREE__namespace.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),f=coordinatesToVector(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(h),m=(new THREE__namespace.Vector3).copy(f).sub(n.target).length();m*=Math.tan(this.camera.pose.fov/2*Math.PI/180);var v=this.renderer.getSize(new THREE__namespace.Vector2),A=2*d.x*m/v.y,g=2*d.y*m/v.y,y=new THREE__namespace.Vector3;y.setFromMatrixColumn(this.camera.matrix,0),y.multiplyScalar(-A),h.add(y),this.camera.pose.latitude<Math.PI/9?y.setFromMatrixColumn(this.camera.matrix,1):(y.setFromMatrixColumn(this.camera.matrix,0),y.crossVectors(this.camera.up,y)),y.multiplyScalar(g),h.add(y),h.clamp(this.models.bounding.min,this.models.bounding.max);var b=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:h,distance:this.camera.pose.distance});if(e.state=b,this.emit("gesture.pan",e),e.defaultPrevented)return;if(this.locationMotion.set({x:b.offset.x,y:b.offset.y,z:b.offset.z},0).catch(noop$1),e.isFinal&&(this.fixFinalState(b),this.locationMotion.set({distance:b.distance,x:b.offset.x,y:b.offset.y,z:b.offset.z},0).catch(noop$1)),e.isFinal){var E=this.renderer.getSize(new THREE__namespace.Vector2),_=2*e.velocityX*m/E.y,T=2*e.velocityY*m/E.y,x=new THREE__namespace.Vector3,R=new THREE__namespace.Vector3;x.setFromMatrixColumn(this.camera.matrix,0),x.multiplyScalar(-_),R.add(x),this.camera.pose.latitude<Math.PI/4?x.setFromMatrixColumn(this.camera.matrix,1):(x.setFromMatrixColumn(this.camera.matrix,0),x.crossVectors(this.camera.up,x)),x.multiplyScalar(T),R.add(x),this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:R.x,y:R.y,z:R.z},0)}}else{d={x:e.center.x-n.x,y:e.center.y-n.y};var w=this.coordinatesForOffset(d),M=formatRad(this.cameraMotion.value.longitude+w.longitude),S=clamp(this.cameraMotion.value.latitude+w.latitude,this.minLatitude,this.maxLatitude);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(S=this.cameraMotion.value.latitude);b=__assign(__assign({},this.currentPano),{mode:this.mode,longitude:M,latitude:S,fov:this.camera.pose.fov,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&this.fixFinalState(b),e.state=b,this.emit("gesture.pan",e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:b.distance,x:b.offset.x,y:b.offset.y,z:b.offset.z},0).catch(noop$1):this.cameraMotion.set({longitude:b.longitude,latitude:b.latitude},0).catch(noop$1),e.isFinal){var C=e.velocityX,I=e.velocityY;this.inMomentumMovement={uuid:createUuid()},this.requestMomentumMovement(e,!0,__assign(__assign({},this.coordinatesForOffset({x:C,y:I})),{x:0,y:0,z:0}),0)}}},t.prototype.onPinchGesture=function(e){var n;this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();var r=null===(n=this.pinchState)||void 0===n?void 0:n.distance;if(e.isFirst)this.pinchState={x:e.center.x,y:e.center.y,scale:1,distance:this.locationMotion.value.distance};else{if(e.isFinal)return delete this.panState,void delete this.pinchState;if(void 0!==r){var i,o=this.models.bounding.getCenter(new THREE__namespace.Vector3),a=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),s=clamp(r/e.scale,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(s));!this.models.bounding.containsPoint(c)&&this.pinchState&&this.pinchState.scale>e.scale&&o.distanceTo(c)>a?i=e.state.distance:(i=s,this.pinchState&&(this.pinchState.scale=e.scale)),e.state.distance=i,this.emit("gesture.pinch",e),e.defaultPrevented||(this.locationMotion.set({distance:e.state.distance},0).catch(noop$1),"mouse"!==e.pointerType&&(e.type="gesture.pan",this.onPanGesture(e)))}}},t.prototype.onMouseMove=function(e){var t,n;if(this.intersectMesh.parent&&!(this.panState||this.pinchState||this.mouseWheelState||(this.emit("gesture.mousemove",e),e.defaultPrevented))){var r=e.center.raycaster;if(r.near=RAYCASTER_NEAR,r.far=500,e.isFinal&&this.intersectMesh.parent&&!0===this.intersectMesh.visible)this.hideIntersectMesh();else{var i=this.models.intersectRaycaster(r)[0],o=createEvent("intersect.update",{raycaster:r,intersection:null!=i?i:null,object:this.intersectMesh});if(this.emit("intersect.update",o),o.defaultPrevented)this.hideIntersectMesh();else if(i){var a=null!==(n=null===(t=i.face)||void 0===t?void 0:t.normal)&&void 0!==n?n:(new THREE__namespace.Vector3).copy(r.ray.direction).multiplyScalar(-1),s=a.clone().multiplyScalar(.05),c=i.point.clone().add(s);this.intersectMesh.position.copy(c);var l=c.clone().add(s);if(this.intersectMesh.lookAt(l),Math.abs(a.y)>.99){var u=this.camera.position.clone().sub(c);this.intersectMesh.rotation.z=-Math.atan2(u.z,u.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}}},t.prototype.onMouseWheel=function(e){if(this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),e.isFinal){var n=e.state;if(this.fixFinalState(n),this.emit("gesture.mousewheel",e),e.defaultPrevented)return;var r={x:n.offset.x,y:n.offset.y,z:n.offset.z,distance:n.distance};this.locationMotion.set(r,0).catch(noop$1)}else{var i=e.center.delta/2*Math.max(Math.log(this.locationMotion.value.distance),1),o=this.models.bounding.getCenter(new THREE__namespace.Vector3),a=t.distanceFromModel(this.models,this.cameraMotion.value.fov,this.camera.aspect),s=clamp(this.locationMotion.value.distance-i,minDistance,1/0),c=e.state.offset.clone().sub(coordinatesToVector(e.state).setLength(s)),l=!this.models.bounding.containsPoint(c)&&i<0&&o.distanceTo(c)>a?e.state.distance:s;if(e.state.distance=s,this.emit("gesture.mousewheel",e),e.defaultPrevented)return;this.locationMotion.set({distance:l},0).catch(noop$1)}},t.prototype.onTapGesture=function(e){var t=this;this.userAction=e.userAction,this.stopMomentumMovement();var n=e.center.raycaster,r=this.getForwardObserverOrNot(n);if(r){var i={longitude:this.camera.pose.longitude,latitude:0},o=__assign(__assign({},e.state),{mode:"Panorama",workCode:r.pano.workCode,panoIndex:r.pano.panoIndex,longitude:i.longitude,latitude:i.latitude,offset:r?r.position.clone():new THREE__namespace.Vector3,distance:0});if(e.state=o,this.emit("gesture.tap",e),!e.defaultPrevented&&(this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:o,userAction:e.userAction,options:i,progress:0,error:null})),r&&r.active)){var a=this.currentTapId=createUuid();this.preloadPano(r.pano).then((function(e){t.currentTapId===a&&t.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:t.currentPano,progress:0,state:o,options:i,error:null}))}))}}else this.emit("gesture.tap",e)},t.prototype.hideIntersectMesh=function(){this.intersectMesh.visible=!1,this.needsRender=!0},t.prototype.postProcessing=function(e,t){var n;if(!this.destroyed)return"edl"===t?this.edlEffect.render(e):"hq"===t?null===(n=this.hqEffect)||void 0===n?void 0:n.render(e):void 0},t}(BaseController);function isNil(e){return null==e}var _moveEvent={type:"move"},XRController=function(){function e(){this._targetRay=null,this._grip=null,this._hand=null,this._axes=[0,0]}return e.prototype.getHandSpace=function(){return null===this._hand&&(this._hand=new THREE__namespace.Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},e.prototype.getTargetRaySpace=function(){return null===this._targetRay&&(this._targetRay=new THREE__namespace.Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new THREE__namespace.Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new THREE__namespace.Vector3),this._targetRay},e.prototype.getGripSpace=function(){return null===this._grip&&(this._grip=new THREE__namespace.Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new THREE__namespace.Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new THREE__namespace.Vector3),this._grip},e.prototype.dispatchEvent=function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this},e.prototype.disconnect=function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},e.prototype.getAxes=function(){return this._axes},e.prototype.update=function(e,t,n){var r=null,i=null,o=null,a=this._targetRay,s=this._grip,c=this._hand;if(e&&e.gamepad&&e.gamepad.axes&&(this._axes=[e.gamepad.axes[2],e.gamepad.axes[3]]),e&&"visible-blurred"!==t.session.visibilityState)if(null!==a&&null!==(r=t.getPose(e.targetRaySpace,n))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent)),c&&e.hand){o=!0;for(var l=0,u=e.hand.values();l<u.length;l++){var p=u[l],d=t.getJointPose(p,n);if(void 0===c.joints[p.jointName]){var h=new THREE__namespace.Group;h.matrixAutoUpdate=!1,h.visible=!1,c.joints[p.jointName]=h,c.add(h)}var f=c.joints[p.jointName];null!==d&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.jointRadius=d.radius),f.visible=null!==d}var m=c.joints["index-finger-tip"],v=c.joints["thumb-tip"],A=m.position.distanceTo(v.position);c.inputState.pinching&&A>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&A<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(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);return null!==a&&(a.visible=null!==r),null!==s&&(s.visible=null!==i),null!==c&&(c.visible=null!==o),this},e}(),framebufferScaleFactor=1,XRManager=function(){function e(e,t,n){var r,i,o,a,s;this.isPanorama=null===(r=null==n?void 0:n.isPanorama)||void 0===r||r,this.machineType=null!==(i=null==n?void 0:n.machineType)&&void 0!==i?i:"Pico",this.renderer=e,this.gl=t,this.enabled=!1,this.session=null,this.referenceSpaceType=null!==(o=null==n?void 0:n.referenceSpaceType)&&void 0!==o?o:"local-floor",this.referenceSpace=null,this.onSessionStartCallback=null!==(a=null==n?void 0:n.onSessionStart)&&void 0!==a?a:noop$1,this.onSessionEndCallback=null!==(s=null==n?void 0:n.onSessionEnd)&&void 0!==s?s:noop$1,this.controllers=[new XRController,new XRController],this.inputSourcesMap=new Map,this.cameraVR=new THREE__namespace.ArrayCamera,this.cameraL=new THREE__namespace.PerspectiveCamera,this.cameraR=new THREE__namespace.PerspectiveCamera,this.cameraL.viewport=new THREE__namespace.Vector4,this.cameraR.viewport=new THREE__namespace.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 THREE__namespace.Vector3,this.cameraRPos=new THREE__namespace.Vector3}return e.prototype.getController=function(e){var t=this.controllers[e];return t||console.warn("no controller find"),t.getTargetRaySpace()},e.prototype.getRightController=function(){if(!this.session)return null;var e="right"===this.session.inputSources[0].handedness?0:1,t=this.controllers[e];return t||console.warn("no controller find"),t.getTargetRaySpace()},e.prototype.getLeftController=function(){if(!this.session)return null;var e="left"===this.session.inputSources[0].handedness?0:1,t=this.controllers[e];return t||console.warn("no controller find"),t.getTargetRaySpace()},e.prototype.getControllerGrip=function(e){var t=this.controllers[e];return t||console.warn("no controller find"),t.getGripSpace()},e.prototype.getCameras=function(){return{cameraL:this.cameraL,cameraR:this.cameraR,cameraVR:this.cameraVR}},e.prototype.updateCamera=function(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)},e.prototype.setProjectionFromUnion=function(e,t,n){this.cameraLPos.setFromMatrixPosition(t.matrixWorld),this.cameraRPos.setFromMatrixPosition(n.matrixWorld);var r=this.cameraLPos.distanceTo(this.cameraRPos),i=t.projectionMatrix.elements,o=n.projectionMatrix.elements,a=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],p=(o[8]+1)/o[0],d=a*u,h=a*p,f=r/(-u+p),m=f*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var v=a+f,A=s+f,g=d-m,y=h+(r-m),b=c*s/A*v,E=l*s/A*v;e.projectionMatrix.makePerspective(g,y,b,E,v,A)},e.prototype.getCamera=function(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);var t=e.parent,n=this.cameraVR.cameras;this.updateCamera(this.cameraVR,t);for(var r=0;r<n.length;r++)this.updateCamera(n[r],t);e.matrixWorld.copy(this.cameraVR.matrixWorld);for(var i=e.children,o=(r=0,i.length);r<o;r++)i[r].updateMatrixWorld(!0);return 2===n.length?this.setProjectionFromUnion(this.cameraVR,this.cameraL,this.cameraR):this.cameraVR.projectionMatrix.copy(this.cameraL.projectionMatrix),this.cameraVR},e.prototype.updateInputSources=function(e){if(this.session){for(var t=this.session.inputSources,n=0;n<this.controllers.length;n++)this.inputSourcesMap.set(t[n],this.controllers[n]);for(n=0;n<e.removed.length;n++){var r=e.removed[n];(i=this.inputSourcesMap.get(r))&&(i.dispatchEvent({type:"disconnected",data:r}),this.inputSourcesMap.delete(r))}for(n=0;n<e.added.length;n++){var i;r=e.added[n];(i=this.inputSourcesMap.get(r))&&i.dispatchEvent({type:"connected",data:r})}}else console.warn("session is lose!")},e.prototype.onSessionEvent=function(e){var t=this.inputSourcesMap.get(e.inputSource);t&&t.dispatchEvent({type:e.type})},e.prototype.onSessionEnd=function(){this.inputSourcesMap.forEach((function(e,t){e.disconnect(t)})),this.inputSourcesMap.clear(),this.renderer.setFramebuffer(null),this.renderer.setRenderTarget(this.renderer.getRenderTarget()),this.isPresenting=!1,this.session=null,AnimationFrameLoop.shared.setContext(null),this.onSessionEndCallback()},e.prototype.onRequestReferenceSpace=function(e){this.referenceSpace=e,this.isPresenting=!0,this.session&&this.onSessionStartCallback(this.session)},e.prototype.setSession=function(e){var t=this;if(this.session=e,this.session){this.session.addEventListener("select",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("selectstart",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("selectend",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeeze",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeezestart",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("squeezeend",(function(e){t.onSessionEvent(e)})),this.session.addEventListener("end",(function(e){t.onSessionEnd()}));var n=this.gl.getContextAttributes();this.gl.makeXRCompatible().then((function(){var e={antialias:null==n?void 0:n.antialias,alpha:null==n?void 0:n.alpha,depth:null==n?void 0:n.depth,stencil:null==n?void 0:n.stencil,framebufferScaleFactor:framebufferScaleFactor};if(t.session){switch(t.machineType){case"Pico":t.session.updateRenderState({baseLayer:new XRWebGLLayer(t.session,t.gl,e)});break;case"Oculus":t.session.updateRenderState({layers:[new XRWebGLLayer(t.session,t.gl,e)]});break;default:t.machineType}t.session.requestReferenceSpace(t.referenceSpaceType).then((function(e){t.onRequestReferenceSpace(e)})),t.session.addEventListener("inputsourceschange",(function(e){t.updateInputSources(e)}))}else console.error("session is lose while set session!")}))}},e}(),LineSegmentsGeometry=function(e){function t(){var t=e.call(this)||this;t.type="LineSegmentsGeometry";return t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new THREE__namespace.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)),t.setAttribute("uv",new THREE__namespace.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return __extends(t,e),t.prototype.applyMatrix4=function(e){var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},t.prototype.setPositions=function(e){var t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;var n=new THREE__namespace.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new THREE__namespace.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new THREE__namespace.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},t.prototype.setColors=function(e){var t;t=e instanceof Float32Array?e:Array.isArray(e)?new Float32Array(e):new Float32Array;var n=new THREE__namespace.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new THREE__namespace.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new THREE__namespace.InterleavedBufferAttribute(n,3,3)),this},t.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},t.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new THREE__namespace.WireframeGeometry(e.geometry)),this},t.prototype.fromLineSegments=function(e){var t=e.geometry;if(t instanceof THREE__namespace.Geometry){var n=(new THREE__namespace.BufferGeometry).fromGeometry(t);this.setPositions(n.attributes.position.array)}else t instanceof THREE__namespace.BufferGeometry&&this.setPositions(t.attributes.position.array);return this},t.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new THREE__namespace.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var n=new THREE__namespace.Box3;this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(t),this.boundingBox.union(n)}},t.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new THREE__namespace.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var r=0,i=new THREE__namespace.Vector3,o=0,a=e.count;o<a;o++)i.fromBufferAttribute(e,o),r=Math.max(r,n.distanceToSquared(i)),i.fromBufferAttribute(t,o),r=Math.max(r,n.distanceToSquared(i));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},t.prototype.toJSON=function(){},t}(THREE__namespace.InstancedBufferGeometry);Object.assign(LineSegmentsGeometry.prototype,{isLineSegmentsGeometry:!0});var lineShader={uniforms:THREE__namespace.UniformsUtils.merge([THREE__namespace.UniformsLib.common,THREE__namespace.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new THREE__namespace.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"},LineMaterial=function(e){function t(t){var n=e.call(this,{uniforms:THREE__namespace.UniformsUtils.clone(lineShader.uniforms),vertexShader:lineShader.vertexShader,fragmentShader:lineShader.fragmentShader,clipping:!0})||this;return n.type="LineMaterial",n.dashed=!1,Object.defineProperties(n,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}}}),n.setValues(t),n}return __extends(t,e),t}(THREE__namespace.ShaderMaterial);Object.assign(LineMaterial.prototype,{isLineMaterial:!0});var LineSegments2=function(e){function t(t,n){var r=e.call(this)||this;return r.type="LineSegments2",r.geometry=void 0!==t?t:new LineSegmentsGeometry,r.material=void 0!==n?n:new LineMaterial({color:16777215*Math.random()}),r}return __extends(t,e),t.prototype.computeLineDistances=function(){for(var e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),i=new THREE__namespace.Vector3,o=new THREE__namespace.Vector3,a=0,s=0,c=t.count;a<c;a++,s+=2)i.fromBufferAttribute(t,a),o.fromBufferAttribute(n,a),r[s]=0===s?0:r[s-1],r[s+1]=r[s]+i.distanceTo(o);var l=new THREE__namespace.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new THREE__namespace.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new THREE__namespace.InterleavedBufferAttribute(l,1,1)),this},t.prototype.raycast=function(e,t){null===e.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var n=e.ray,r=e.camera,i=r.projectionMatrix,o=this.geometry,a=this.material,s=a.resolution,c=a.linewidth,l=o.attributes.instanceStart,u=o.attributes.instanceEnd,p=new THREE__namespace.Vector4,d=new THREE__namespace.Vector4,h=new THREE__namespace.Vector4,f=new THREE__namespace.Vector3,m=new THREE__namespace.Matrix4,v=new THREE__namespace.Line3,A=new THREE__namespace.Vector3;n.at(1,h),h.w=1,h.applyMatrix4(r.matrixWorldInverse),h.applyMatrix4(i),h.multiplyScalar(1/h.w),h.x*=s.x/2,h.y*=s.y/2,h.z=0,f.copy(h);var g=this.matrixWorld;m.multiplyMatrices(r.matrixWorldInverse,g);for(var y=0,b=l.count;y<b;y++){p.fromBufferAttribute(l,y),d.fromBufferAttribute(u,y),p.w=1,d.w=1,p.applyMatrix4(m),d.applyMatrix4(m),p.applyMatrix4(i),d.applyMatrix4(i),p.multiplyScalar(1/p.w),d.multiplyScalar(1/d.w);var E=p.z<-1&&d.z<-1,_=p.z>1&&d.z>1;if(!E&&!_){p.x*=s.x/2,p.y*=s.y/2,d.x*=s.x/2,d.y*=s.y/2,v.start.copy(p),v.start.z=0,v.end.copy(d),v.end.z=0;var T=v.closestPointToPointParameter(f,!0);v.at(T,A);var x=THREE__namespace.MathUtils.lerp(p.z,d.z,T),R=x>=-1&&x<=1,w=f.distanceTo(A)<.5*c;if(R&&w){v.start.fromBufferAttribute(l,y),v.end.fromBufferAttribute(u,y),v.start.applyMatrix4(g),v.end.applyMatrix4(g);var M=new THREE__namespace.Vector3,S=new THREE__namespace.Vector3;n.distanceSqToSegment(v.start,v.end,S,M),t.push({point:S,pointOnLine:M,distance:n.origin.distanceTo(S),object:this,faceIndex:y})}}}},t}(THREE__namespace.Mesh);Object.assign(LineSegments2.prototype,{isLineSegments2:!0});var Line2=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.type="Line2",r}return __extends(t,e),t}(LineSegments2);Object.assign(Line2.prototype,{isLine2:!0});var LineGeometry=function(e){function t(){var t=e.call(this)||this;return t.type="LineGeometry",t}return __extends(t,e),t.prototype.setPositions=function(t){for(var n=t.length-3,r=new Float32Array(2*n),i=0;i<n;i+=3)r[2*i]=t[i],r[2*i+1]=t[i+1],r[2*i+2]=t[i+2],r[2*i+3]=t[i+3],r[2*i+4]=t[i+4],r[2*i+5]=t[i+5];return e.prototype.setPositions.call(this,r),this},t.prototype.setColors=function(t){for(var n=t.length-3,r=new Float32Array(2*n),i=0;i<n;i+=3)r[2*i]=t[i],r[2*i+1]=t[i+1],r[2*i+2]=t[i+2],r[2*i+3]=t[i+3],r[2*i+4]=t[i+4],r[2*i+5]=t[i+5];return e.prototype.setColors.call(this,r),this},t.prototype.fromLine=function(e){var t=e.geometry;if(t instanceof THREE__namespace.Geometry){var n=(new THREE__namespace.BufferGeometry).fromGeometry(t);this.setPositions(n.attributes.position.array)}else t instanceof THREE__namespace.BufferGeometry&&this.setPositions(t.attributes.position.array);return this},t.prototype.copy=function(){return this},t}(LineSegmentsGeometry);Object.assign(LineGeometry.prototype,{isLineGeometry:!0});var circleImageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==",DEFAULT_COLOR=14467195,POINT_SIZE=8,DEFAULT_LINEWIDTH=2,DEFAULT_DASHSCALE=20,sharedCircleTexture=null,FiveLine=function(e){function t(t,n){void 0===t&&(t=new THREE__namespace.Vector3),void 0===n&&(n=new THREE__namespace.Vector3);var r=e.call(this)||this;r.type="FiveLine",r.needsRender=!0;var i=new LineGeometry,o=new LineMaterial({color:DEFAULT_COLOR,linewidth:DEFAULT_LINEWIDTH,dashScale:DEFAULT_DASHSCALE,dashed:!1});r.line=new Line2(i,o);var a=new THREE__namespace.BufferGeometry,s=new THREE__namespace.PointsMaterial({color:DEFAULT_COLOR,size:POINT_SIZE,map:sharedCircleTexture||(sharedCircleTexture=(new THREE__namespace.TextureLoader).load(circleImageURL)),sizeAttenuation:!1,transparent:!0});return r.points=new THREE__namespace.Points(a,s),r.points.renderOrder=11,r.points.frustumCulled=!1,r.setPoints(t,n),r.add(r.line,r.points),r}return __extends(t,e),Object.defineProperty(t,"version",{get:function(){return"6.0.0-alpha.71"},enumerable:!1,configurable:!0}),t.prototype.setPoints=function(e,t){var n=[].concat(e.toArray(),t.toArray());this.points.geometry.setAttribute("position",new THREE__namespace.BufferAttribute(new Float32Array(n),3)),this.line.geometry.setPositions(n),this.line.computeLineDistances(),this.needsRender=!0},t.prototype.getPoints=function(){var e=this.points.geometry.attributes.position.array;return[new THREE__namespace.Vector3(e[0],e[1],e[2]),new THREE__namespace.Vector3(e[3],e[4],e[5])]},t.prototype.setMaterial=function(e){var t=this.line.material;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];"dashed"===n?(t.dashed=r,r?t.defines.USE_DASH="":delete t.defines.USE_DASH,t.needsUpdate=!0):t[n]=e[n]}this.needsRender=!0},t.prototype.setResolution=function(e,t){var n=this.line.material.resolution;n.x===e&&n.y===t||(n.set(e,t),this.needsRender=!0)},t}(THREE__namespace.Object3D);Object.assign(FiveLine.prototype,{isFiveLine:!0});var Constants={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};function fetchJsonFile(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:return[4,fetch(e)];case 1:if((t=n.sent()).ok)return[2,t.json()];throw new Error(t.statusText)}}))}))}function fetchProfilesList(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!e)throw new Error("No basePath supplied");return"profilesList.json",[4,fetchJsonFile("".concat(e,"/").concat("profilesList.json"))];case 1:return[2,t.sent()]}}))}))}function fetchProfile(e,t,n,r){return void 0===n&&(n=null),void 0===r&&(r=!0),__awaiter(this,void 0,void 0,(function(){var i,o,a,s,c,l;return __generator(this,(function(u){switch(u.label){case 0:if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No basePath supplied");return[4,fetchProfilesList(t)];case 1:if(i=u.sent(),e.profiles.some((function(e){var n=i[e];return n&&(o={profileId:e,profilePath:"".concat(t,"/").concat(n.path),deprecated:!!n.deprecated}),!!o})),!o){if(!n)throw new Error("No matching profile name found");if(!(a=i[n]))throw new Error('No matching profile name found and default profile "'.concat(n,'" missing.'));o={profileId:n,profilePath:"".concat(t,"/").concat(a.path),deprecated:!!a.deprecated}}return[4,fetchJsonFile(o.profilePath)];case 2:if(s=u.sent(),r){if(void 0,!(l=s.layouts[e.handedness]))throw new Error("No matching handedness, ".concat(e.handedness,", in profile ").concat(o.profileId));l.assetPath&&(c=o.profilePath.replace("profile.json",l.assetPath))}return[2,{profile:s,assetPath:c}]}}))}))}var defaultComponentValues={xAxis:0,yAxis:0,button:0,state:Constants.ComponentState.DEFAULT};function normalizeAxes(e,t){void 0===e&&(e=0),void 0===t&&(t=0);var n=e,r=t;if(Math.sqrt(e*e+t*t)>1){var i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:.5*n+.5,normalizedYAxis:.5*r+.5}}var VisualResponse=function(){function e(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(defaultComponentValues)}return e.prototype.updateFromComponent=function(e){var t=e.xAxis,n=e.yAxis,r=e.button,i=e.state,o=normalizeAxes(t,n),a=o.normalizedXAxis,s=o.normalizedYAxis;switch(this.componentProperty){case Constants.ComponentProperty.X_AXIS:this.value=this.states.includes(i)?a:.5;break;case Constants.ComponentProperty.Y_AXIS:this.value=this.states.includes(i)?s:.5;break;case Constants.ComponentProperty.BUTTON:this.value=this.states.includes(i)?r:0;break;case Constants.ComponentProperty.STATE:this.valueNodeProperty===Constants.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(i):this.value=this.states.includes(i)?1:0;break;default:throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty))}},e}(),Component=function(){function e(e,t){var n=this;if(!(e&&t&&t.visualResponses&&t.gamepadIndices&&0!==Object.keys(t.gamepadIndices).length))throw new 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((function(e){var r=new VisualResponse(t.visualResponses[e]);n.visualResponses[e]=r})),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:Constants.ComponentState.DEFAULT,button:void 0!==this.gamepadIndices.button?0:void 0,xAxis:void 0!==this.gamepadIndices.xAxis?0:void 0,yAxis:void 0!==this.gamepadIndices.yAxis?0:void 0}}return Object.defineProperty(e.prototype,"data",{get:function(){return __assign({id:this.id},this.values)},enumerable:!1,configurable:!0}),e.prototype.updateFromGamepad=function(e){var t=this;if(this.values.state=Constants.ComponentState.DEFAULT,void 0!==this.gamepadIndices.button&&e.buttons.length>this.gamepadIndices.button){var n=e.buttons[this.gamepadIndices.button];this.values.button=n.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,n.pressed||1===this.values.button?this.values.state=Constants.ComponentState.PRESSED:(n.touched||this.values.button>Constants.ButtonTouchThreshold)&&(this.values.state=Constants.ComponentState.TOUCHED)}void 0!==this.gamepadIndices.xAxis&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.yAxis&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Constants.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Constants.AxisTouchThreshold&&(this.values.state=Constants.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach((function(e){e.updateFromComponent(t.values)}))},e}(),MotionController=function(){function e(e,t,n){var r=this;if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new 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((function(e){var t=r.layoutDescription.components[e];r.components[e]=new Component(e,t)})),this.updateFromGamepad()}return Object.defineProperty(e.prototype,"gripSpace",{get:function(){return this.xrInputSource.gripSpace},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"targetRaySpace",{get:function(){return this.xrInputSource.targetRaySpace},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){var e=[];return Object.values(this.components).forEach((function(t){e.push(t.data)})),e},enumerable:!1,configurable:!0}),e.prototype.updateFromGamepad=function(){var e=this;Object.values(this.components).forEach((function(t){t.updateFromGamepad(e.xrInputSource.gamepad)}))},e}(),DEFAULT_PROFILES_PATH="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",DEFAULT_PROFILE="generic-trigger",XRControllerModel=function(e){function t(){var t=e.call(this)||this;return t.motionController=null,t.envMap=null,t}return __extends(t,e),t.prototype.setEnvironmentMap=function(e){var t=this;return this.envMap==e||(this.envMap=e,this.traverse((function(e){e instanceof THREE__namespace.Mesh&&e.isMesh&&(e.material.envMap=t.envMap,e.material.needsUpdate=!0)}))),this},t.prototype.updateMatrixWorld=function(t){e.prototype.updateMatrixWorld.call(this,t),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach((function(e){Object.values(e.visualResponses).forEach((function(e){var t=e.valueNode,n=e.minNode,r=e.maxNode,i=e.value,o=e.valueNodeProperty;t&&(o===Constants.VisualResponseProperty.VISIBILITY?t.visible=i:o===Constants.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))}))})))},t}(THREE.Object3D);function findNodes(e,t){Object.values(e.components).forEach((function(e){var n=e.type,r=e.touchPointNodeName,i=e.visualResponses;if(n===Constants.ComponentType.TOUCHPAD)if(e.touchPointNode=t.getObjectByName(r),e.touchPointNode){var o=new THREE.SphereGeometry(.001),a=new THREE.MeshBasicMaterial({color:255}),s=new THREE.Mesh(o,a);e.touchPointNode.add(s)}else console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id));Object.values(i).forEach((function(e){var n=e.valueNodeName,r=e.minNodeName,i=e.maxNodeName;if(e.valueNodeProperty===Constants.VisualResponseProperty.TRANSFORM){if(e.minNode=t.getObjectByName(r),e.maxNode=t.getObjectByName(i),!e.minNode)return void console.warn("Could not find ".concat(r," in the model"));if(!e.maxNode)return void console.warn("Could not find ".concat(i," in the model"))}e.valueNode=t.getObjectByName(n),e.valueNode||console.warn("Could not find ".concat(n," in the model"))}))}))}function addAssetSceneToControllerModel(e,t){findNodes(e.motionController,t),e.envMap&&t.traverse((function(t){t instanceof THREE__namespace.Mesh&&t.isMesh&&(t.material.envMap=e.envMap,t.material.needsUpdate=!0)})),e.add(t)}var XRControllerModelFactory=function(){function e(e){void 0===e&&(e=null),this.gltfLoader=e,this.path=DEFAULT_PROFILES_PATH,this._assetCache={}}return e.prototype.createControllerModel=function(e){var t=this,n=new XRControllerModel,r=null;return e.addEventListener("connected",(function(e){var i=e.data;"tracked-pointer"===i.targetRayMode&&i.gamepad&&fetchProfile(i,t.path,DEFAULT_PROFILE).then((function(e){var o=e.profile,a=e.assetPath;n.motionController=new MotionController(i,o,a);var s=t._assetCache[n.motionController.assetUrl];if(s)r=s.scene.clone(),addAssetSceneToControllerModel(n,r);else{if(!t.gltfLoader)throw new Error("GLTFLoader not set.");t.gltfLoader.load(n.motionController.assetUrl,(function(e){t._assetCache[n.motionController.assetUrl]=e,r=e.scene.clone(),addAssetSceneToControllerModel(n,r)}))}})).catch((function(e){console.warn(e)}))})),e.addEventListener("disconnected",(function(){n.motionController=null,n.remove(r),r=null})),n},e}();function mapPanoResource(e,t){if(!t)return e;var n=e.match(/\d+_[a-z].png/);return e.substring(0,n.index)+t+"/"+e.substring(n.index)}var CONTROLLER_EVNET_DELTA_TIME=300,ROTATE_Y_PI_MATRIX=(new THREE__namespace.Matrix4).makeRotationAxis(new THREE__namespace.Vector3(0,1,0),Math.PI),PANO_TEXTURE_SCALE=new THREE__namespace.Vector3(-1,1,1),XRPanoramaController=function(e){function t(t){var n,r=e.call(this,t)||this;r.xrManager=new XRManager(r.renderer,r.renderer.getContext(),{onSessionStart:function(e){r.emit("xr.session.start",createEvent("xr.session.start",{session:e,machineType:r.xrManager.machineType}))},onSessionEnd:function(){r.emit("xr.session.end",createEvent("xr.session.end",{session:null,machineType:r.xrManager.machineType}))}}),r.xrControllerRay={left:new THREE__namespace.Raycaster,right:new THREE__namespace.Raycaster},r.xrControllerRay.left.params.Points={threshold:.1},r.xrControllerRay.right.params.Points={threshold:.1},r.pointerLines={left:new FiveLine,right:new FiveLine},r.pointerLines.left.visible=!1,r.pointerLines.right.visible=!0,r.pointerLines.left.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.left.points.material.depthTest=!1,r.pointerLines.right.setMaterial({color:new THREE__namespace.Vector3(1,1,1)}),r.pointerLines.right.points.material.depthTest=!1,r.scene.add(r.pointerLines.left,r.pointerLines.right),r.panoResources={},r.panoResources[r.locationMotion.keyframes[0].key=r.locationMotion.keyframes[1].key=createUuid()]={panoId:panoStringify(r.currentPano),leftPanoPicture:null,position:r.camera.pose.offset.clone(),effect:"fade"},r.parallaxCameraMatrixs=[],r.onlyUseRightController=null!==(n=t.onlyUseRightController)&&void 0!==n&&n;var i=AnimationFrameLoop.shared.getContext();if(!i)return console.error("获取session失败,请退出重试"),r;r.on("xr.session.end",(function(){r.scene.remove(r.pointerLines.left,r.pointerLines.right)})),r.xrManager.setSession(i),r.controllerWrappers=[new THREE__namespace.Group,new THREE__namespace.Group],r.scene.add(r.controllerWrappers[0],r.controllerWrappers[1]);var o=r.xrManager.getController(0);r.controllerWrappers[0].add(o);var a=r.xrManager.getController(1);r.controllerWrappers[1].add(a);var s=new XRControllerModelFactory;return s.gltfLoader={load:function(e,t){internalFetcher.ajax(e,{responseType:"arraybuffer"}).then((function(t){var n;return parseGltf(t.body,{resourcePath:e.slice(0,e.lastIndexOf("/")+1),search:null!==(n=e.split("?")[1])&&void 0!==n?n:"",fetcher:internalFetcher})})).then((function(e){return t(e)}))}},r.on("xr.session.start",(function(){var e=r.xrManager.getControllerGrip(0);if(e.add(s.createControllerModel(e)),r.controllerWrappers[0].add(e),!r.onlyUseRightController){var t=r.xrManager.getControllerGrip(1);t.add(s.createControllerModel(t)),r.controllerWrappers[1].add(t)}})),r.xrControllerState={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}},r}return __extends(t,e),t.parseArgs=function(n){if(n instanceof t)return n;var r=__assign(__assign({},n),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return e.parseArgs.call(this,r)},t.initAnimationEndState=function(t){var n=this.parseArgs(t),r=e.initAnimationEndState.call(this,n);return __assign(__assign({},r),{mode:"XRPanorama"})},t.prototype.moveToPano=function(e,t,n){var r,i,o,a,s=this;this.userAction=n,this.stopMomentumMovement();var c=this.works.getResolvedObserver(e);if(!c)throw new Error("Invalid PanoIndex");var l=this.imageOptions.size;if(void 0===l&&c){var u=c.images.up.match(/\/cube_(\d+)\//);u&&(l=Number(u[1]))}void 0===l&&(l=2048);var p=this.imageOptions.transform,d=function(e,t){return mapPanoResource(applyImageURLOptions(e,p,t))},h=__assign({key:"pano.".concat(c.panoId)},pick(this.imageOptions,["format","size","quality"])),f=c.images,m=null!==(i=null===(r=c.images.tiles)||void 0===r?void 0:r.filter((function(e){return e.size>l})))&&void 0!==i?i:null,v="pano:"+jsonHash([f,h,p]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===v)return;var A=this.pendingTextureTask.panoId;null===(o=this.panoMeshes[A])||void 0===o||o.setProgress(0),this.emit("pano.texture.abort",createEvent("pano.texture.abort",{error:null,progress:0,meta:null,pano:c.pano})),this.pendingTextureTask.onError(new Error("texture aborted"))}var g,y=this.models.getMaterial()||{},b=y.pano0,E=y.pano1;if((null==b?void 0:b.map.name)===v?g=b:(null==E?void 0:E.map.name)===v&&(g=E),g){var _={panoId:c.panoId,effect:null!==(a=t.effect)&&void 0!==a?a:"fade",leftPanoPicture:{map:g.map,luminanceMap:g.luminanceMap,matrix:(new THREE__namespace.Matrix4).compose(c.position,c.quaternion,PANO_TEXTURE_SCALE)},position:c.position.clone()};this.doMoveToPano(c.pano,_,t)}else{var T="move-to-pano-"+c.panoId;this.pending.add(T),this.pendingTextureTask={panoId:c.panoId,hash:v,onLoad:function(e){var n;if(s.pending.delete(T),s.destroyed)e.body.dispose();else{e.body.name=v;var r={panoId:c.panoId,effect:null!==(n=t.effect)&&void 0!==n?n:"fade",leftPanoPicture:{map:e.body,luminanceMap:null,matrix:(new THREE__namespace.Matrix4).compose(c.position,c.quaternion,PANO_TEXTURE_SCALE)},position:c.position.clone()};s.doMoveToPano(c.pano,r,t)}},onError:function(e){s.pending.delete(T);var n=__assign(__assign(__assign({},c.pano),{mode:s.mode}),clonePose(s.camera.pose));s.emit("pano.error",createEvent("pano.error",{error:e,userAction:s.userAction,options:t,prevPano:s.currentPano,progress:0,state:n})),s.emit("pano.cancel",createEvent("pano.cancel",{error:null,userAction:s.userAction,options:t,prevPano:s.currentPano,progress:0,state:n})),t.moveCancelCallback&&t.moveCancelCallback()}},Promise.all([this.tileLevelForFov&&m&&m.length?this.textureLoader.loadTiledCubeTexture(f,m,{tileMaxLevel:this.TILED_CUBE_TEXTURE_LEVEL,imageURL:{transform:d,options:h},format:THREE__namespace.RGBAFormat,viaAjax:!0,fetcher:getFetcher(c.work)},void 0,void 0,(function(e){var t,n;s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:e,meta:null,pano:c.pano})),(null===(t=s.pendingTextureTask)||void 0===t?void 0:t.hash)===v&&(null===(n=s.panoMeshes[c.panoId])||void 0===n||n.setProgress(e))}),this.renderer):this.textureLoader.loadCubeTexture(f,{imageURL:{transform:d,options:h},format:THREE__namespace.RGBAFormat,fetcher:getFetcher(c.work)},void 0,void 0,(function(e){var t,n;(null===(t=s.pendingTextureTask)||void 0===t?void 0:t.hash)===v&&(null===(n=s.panoMeshes[c.panoId])||void 0===n||n.setProgress(e)),s.emit("pano.texture.progress",createEvent("pano.texture.progress",{error:null,progress:e,meta:null,pano:c.pano}))}),this.renderer)]).then((function(e){var t,n,r=e[0];(null===(t=s.pendingTextureTask)||void 0===t?void 0:t.hash)===v?(s.pendingTextureTask.onLoad(r),null===(n=s.panoMeshes[c.panoId])||void 0===n||n.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.success",createEvent("pano.texture.success",{error:null,progress:1,meta:r.meta,pano:c.pano}))):r.body.dispose()})).catch((function(e){var t,n;(null===(t=s.pendingTextureTask)||void 0===t?void 0:t.hash)===v&&(s.pendingTextureTask.onError(e),null===(n=s.panoMeshes[c.panoId])||void 0===n||n.setProgress(0),delete s.pendingTextureTask,s.emit("pano.texture.error",createEvent("pano.texture.error",{error:e,progress:0,meta:null,pano:c.pano})),s.emit("error",e))})),this.emit("pano.texture.load",createEvent("pano.texture.load",{error:null,progress:0,meta:null,pano:c.pano}))}},t.prototype.doMoveToPano=function(e,t,n){var r,i,o,a=this;void 0===n&&(n={});var s=now(),c=createUuid();this.panoResources[c]=t;var l,u,p;if(this.locationMotion.ended){var d=this.locationMotion.getKeyFrameSegment(s);d[0];var h=d[1],f=this.locationMotion.value,m=this.panoResourceFromLocationMotionKeyframe(h).position,v=t.position;l=Math.max(m.distanceTo(v),1),u=[{key:h.key,progress:0,value:__assign(__assign({},f),{count:0})},{key:c,progress:1,value:{distance:0,count:1}}],p=0}else{var A=this.locationMotion.getKeyFrameSegment(s),g=A[0],y=(h=A[1],f=this.locationMotion.value,this.panoResourceFromLocationMotionKeyframe(g).position),b=(m=this.panoResourceFromLocationMotionKeyframe(h).position,v=t.position,h.value.count-f.count),E=Math.max(y.distanceTo(m),1)*b;l=E+Math.max(m.distanceTo(v),1),u=[{key:g.key,progress:0,value:__assign({},f)},{key:h.key,progress:E/l,value:h.value},{key:c,progress:1,value:{count:h.value.count+1,distance:0}}];var _=this.locationMotionKeyframesLength(this.locationMotion.keyframes),T=this.locationMotionKeyframesLength(u);p=this.locationMotion.getProgressVelocity(s)*_/T}var x=this.calculateMovingDuration(n.duration,l),R={longitude:n.longitude,latitude:n.latitude,fov:n.fov},w=__assign(__assign({},e),{mode:this.mode,longitude:null!==(r=R.longitude)&&void 0!==r?r:this.camera.pose.longitude,latitude:null!==(i=R.latitude)&&void 0!==i?i:this.camera.pose.latitude,fov:null!==(o=R.fov)&&void 0!==o?o:this.camera.pose.fov,offset:t.position.clone(),distance:0}),M=this.currentPano;this.emit("pano.moveTo",createEvent("pano.moveTo",{options:n,prevPano:M,progress:0,state:w,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(w),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute("src")&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute("uuid"),this.videoTexture.image.removeAttribute("src"),this.videoTexture.image.oncanplay=noop$1,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),this.cameraMotion.set(R,x).catch(noop$1),this.locationMotion.setKeyframes(u,x,p).then((function(){var t,r,i,o=__assign(__assign({},e),{mode:a.mode,longitude:a.camera.pose.longitude,latitude:a.camera.pose.latitude,fov:a.camera.pose.fov,offset:a.camera.pose.offset.clone(),distance:0});a.emit("pano.arrived",createEvent("pano.arrived",{options:n,prevPano:M,progress:1,state:o,userAction:a.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(o);var s=a.works.getResolvedObserver(a.currentPano);if(s&&s.video&&a.videoTexture&&a.videoTexture.image instanceof HTMLVideoElement){var c=ROTATE_Y_PI_MATRIX.clone().multiply(null!==(i=null===(r=null===(t=a.models.getMaterial())||void 0===t?void 0:t.pano1)||void 0===r?void 0:r.matrix)&&void 0!==i?i:new THREE__namespace.Matrix4).multiply(s.video.matrix),l={map:a.videoTexture,size:s.video.size,matrix:c,alpha:1},u=createUuid(),p=a.videoTexture.image;p.setAttribute("uuid",u),canplayVideo().then((function(e){e&&s.video&&p.getAttribute("uuid")===u&&(p.oncanplay=function(){p.oncanplay=noop$1,p.play()},p.ontimeupdate=function(){p.currentTime>.5&&(p.ontimeupdate=noop$1,a.panoVideo.setMaterial(l))},p.src=s.video.source)})).catch((function(){p.removeAttribute("uuid")}))}}),(function(){a.emit("pano.cancel",createEvent("pano.cancel",{options:n,prevPano:M,progress:0,state:w,userAction:a.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()}))},t.prototype.checkSelectedPano=function(e){var t,n,r,i,o=this;this.stopMomentumMovement();var a=this.camera.getDirection(new THREE__namespace.Vector3).setY(0),s=null,c=this.works.getResolvedObserver(this.currentPano);if(!c)return null;var l=c.accessibleIds.filter((function(e){var t=panoParse(e);if(panoEqual(t,o.currentPano))return!1;var n=o.works.getResolvedObserver(t);return!!n&&(!(n.position.distanceTo(o.camera.position)>o.maxAccessibleDistance)&&(n.loadable||n.active))})),u=this.models.intersectRaycaster(e)[0];if(u){var p=arrayMin(l,(function(e){var t=o.works.getResolvedObserver(e);return t?t.standingPosition.clone().distanceTo(u.point):1/0}),!0),d=p[0],h=p[1];d&&h<this.panoTapTriggerRadius&&(s=null!==(t=this.works.getResolvedObserver(d))&&void 0!==t?t:null)}if(isNil(s)){var f=this.getForwardObserverOrNot(e);f&&(s=f)}for(var m=0,v=this.locationMotion.keyframes;m<v.length;m++){var A=v[m],g=this.panoResourceFromLocationMotionKeyframe(A);if(!(A.progress<this.locationMotion.progress)&&(s&&g.panoId===s.panoId)){s=null;break}}if(isNil(s))return!0===this.locationMotion.ended&&this.cameraBounce(),null;if(s&&!s.active){var y=s.panoId;this.panoMeshes[y]&&(this.panoMeshes[y].setDisabled(!1),this.panoMeshes[y].setLoading(!0))}var b={};if(s){b.effect="fade";for(var E=Math.PI/6,_=Math.PI/12,T=new THREE__namespace.Vector3(0,1,0),x=s.position.clone().setY(0).sub(c.position.clone().setY(0)).normalize(),R=x.clone().applyAxisAngle(T,E),w=x.clone().applyAxisAngle(T,-E),M=[],S=[],C=[],I=0,P=s.accessibleIds;I<P.length;I++){var B=panoParse(d=P[I]);if(!panoEqual(B,this.currentPano)&&!panoEqual(B,s.pano)){var O=this.works.getResolvedObserver(d);if(O){var k=O.position.clone().sub(s.position).setY(0);x.angleTo(k)<E?C.push(k):R.angleTo(k)<E?M.push(k):w.angleTo(k)<E&&S.push(k)}}}var H=(C.length>0?C:__spreadArray(__spreadArray([],M,!0),S,!0)).slice().sort((function(e,t){return e.angleTo(x)-t.angleTo(x)}))[0];H&&H.angleTo(a)>_&&(b.longitude=Math.atan2(-H.x,-H.z))}this.cameraMotion.value.latitude<-Math.PI/4&&(b.latitude=clamp(0,this.minLatitude,this.maxLatitude)),this.cameraMotion.value.fov<60&&(b.fov=this.defaultFov);var F={workCode:s.pano.workCode,panoIndex:s.pano.panoIndex,mode:this.mode,longitude:null!==(n=b.longitude)&&void 0!==n?n:this.camera.pose.longitude,latitude:null!==(r=b.latitude)&&void 0!==r?r:this.camera.pose.latitude,fov:null!==(i=b.fov)&&void 0!==i?i:this.camera.pose.fov,distance:0,offset:s?s.position.clone():new THREE__namespace.Vector3};return this.emit("pano.select",createEvent("pano.select",{prevPano:this.currentPano,state:F,userAction:!0,options:b,progress:0,error:null})),s&&s.active?(this.emit("pano.request",createEvent("pano.request",{userAction:!0,prevPano:this.currentPano,progress:0,state:F,options:b,error:null})),s.pano):null},t.prototype.destroy=function(){e.prototype.destroy.call(this)},t.prototype.isReady=function(){return!1},t.prototype.updateCamera=function(e,t,n){return Promise.resolve()},t.prototype.updateCameraWithKeyframes=function(e,t,n){return Promise.resolve()},t.prototype.updateTime=function(e,t){for(var n,r,i,o,a,s,c,l,u=this,p=[],d=2;d<arguments.length;d++)p[d-2]=arguments[d];this.userAction=!0;var h={},f={},m=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[0]),v=this.panoResourceFromLocationMotionKeyframe(this.locationMotion.keyframes[this.locationMotion.keyframes.length-1]),A=!1;if(!1===this.cameraMotion.ended&&(this.cameraMotion.update(e),f.longitude=this.cameraMotion.value.longitude,f.latitude=this.cameraMotion.value.latitude,f.fov=this.cameraMotion.value.fov),!1===this.modelAlphaMotion.ended&&(this.modelAlphaMotion.update(e),h.modelAlpha=this.modelAlphaMotion.value.modelAlpha),!1===this.perspToOrthoMotion.ended&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(clamp(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!1===this.locationMotion.ended){this.locationMotion.update(e);var g=this.locationMotion.getKeyFrameSegment(e),y=g[0],b=g[1],E=this.panoResourceFromLocationMotionKeyframe(y),_=this.panoResourceFromLocationMotionKeyframe(b),T=(new THREE__namespace.Vector3).copy(E.position),x=(new THREE__namespace.Vector3).copy(_.position),R=this.locationMotion.value.count-b.value.count+1;h.progress=R,_.leftPanoPicture&&(R<1?E.leftPanoPicture&&(h.pano0=E.leftPanoPicture):h.pano0=_.leftPanoPicture,h.pano1=_.leftPanoPicture),A=h.useBlackTransition="instant"===_.effect||"montage"===_.effect,"fade"!==_.effect&&"montage"!==_.effect||(h.pano0&&E.leftPanoPicture&&(h.pano0={map:h.pano0.map,luminanceMap:h.pano0.luminanceMap,matrix:E.leftPanoPicture.matrix.clone().setPosition(_.position)}),T.copy(x)),f.distance=this.locationMotion.value.distance,f.offset=new THREE__namespace.Vector3(T.x+(x.x-T.x)*R,T.y+(x.y-T.y)*R,T.z+(x.z-T.z)*R);for(var w=[],M=[],S=0,C=this.locationMotion.keyframes;S<C.length;S++){var I=C[S],P=I.key,B=I.progress;void 0!==P&&(w.push(P),B>=this.locationMotion.progress&&M.push(P))}for(var O=0,k=Object.keys(this.panoResources);O<k.length;O++){var H=k[O];if(!(M.indexOf(H)>=0)){var F=this.panoResources[H];if(F.leftPanoPicture){var L=F.leftPanoPicture.map;if(L){if(L===(null===(n=h.pano0)||void 0===n?void 0:n.map))continue;if(L===(null===(r=h.pano1)||void 0===r?void 0:r.map))continue;L instanceof TileCubeTextureTarget&&L.cubeRenderTarget&&this.colorCubeRenderTargetPool.push(L.cubeRenderTarget),L.dispose(),F.leftPanoPicture=null}}w.indexOf(H)>=0||delete this.panoResources[H]}}this.currentPano=panoParse(_.panoId),this.emit("pano.moving",createEvent("pano.moving",{userAction:this.userAction,prevPano:panoParse(m.panoId),state:__assign(__assign(__assign(__assign({},panoParse(v.panoId)),{mode:this.mode}),clonePose(this.camera.pose)),f),options:{},progress:this.locationMotion.progress,error:null}))}!1===isEmptyObject(h)&&((null===(i=h.pano0)||void 0===i?void 0:i.map)&&h.pano0.map instanceof TileCubeTextureTarget&&!h.pano0.map.cubeRenderTarget&&(h.pano0.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),(null===(o=h.pano1)||void 0===o?void 0:o.map)&&h.pano1.map instanceof TileCubeTextureTarget&&!h.pano1.map.cubeRenderTarget&&(h.pano1.map.cubeRenderTarget=this.colorCubeRenderTargetPool.pop()),this.models.setMaterial(h)),!1===isEmptyObject(f)&&this.setCamera(f);var D=this.works.getResolvedObserver(this.currentPano),N=p[1];if(N)if(this.xrManager.session){var V=this.xrManager.referenceSpace;if(V){var U=this.xrManager.cameraVR,Q=this.xrManager.cameraL,z=this.xrManager.cameraR,j=[Q,z],q=N.getViewerPose(V),G=new THREE__namespace.Vector3(0,0,0);if(q){var K;K=this.xrManager.session.renderState.baseLayer;var W=q.views;if(K){this.renderer.setFramebuffer(K.framebuffer);var X=!1;W.length!==U.cameras.length&&(U.cameras.length=0,X=!0),this.parallaxCameraMatrixs=[];var J=new THREE__namespace.Vector3,Y=new THREE__namespace.Vector3;(new THREE__namespace.Matrix4).fromArray(W[0].transform.matrix).decompose(J,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),(new THREE__namespace.Matrix4).fromArray(W[1].transform.matrix).decompose(Y,new THREE__namespace.Quaternion,new THREE__namespace.Vector3),Y.clone().sub(J).normalize();var Z=new THREE__namespace.Vector3,$=new THREE__namespace.Quaternion,ee=new THREE__namespace.Vector3;this.camera.matrix.decompose(Z,$,ee);for(var te=0;te<W.length;te++){var ne=W[te],re=K.getViewport(ne),ie=j[te];ie.matrix.fromArray(ne.transform.matrix);var oe=new THREE__namespace.Vector3,ae=new THREE__namespace.Quaternion,se=new THREE__namespace.Vector3;ie.matrix.decompose(oe,ae,se),G.copy(Z),ie.position.copy(Z),ie.quaternion.copy(ae),ie.scale.copy(se),ie.updateMatrix(),ie.projectionMatrix.fromArray(ne.projectionMatrix),ie.viewport.set(re.x,re.y,re.width,re.height),!0===X&&U.cameras.push(ie)}q.views[0].transform.position,q.views[1].transform.position;var ce=this.xrManager.session.inputSources;for(te=0;te<this.xrManager.controllers.length;te++){var le=this.xrManager.controllers[te],ue=ce[te];if(ue){le.update(ue,N,V);var pe=this.xrManager.getController(te),de=new THREE__namespace.Vector3(0,1.2,0),he=pe.position.clone().add(G).sub(de);"left"===ue.handedness?this.xrControllerRay.left.set(he,new THREE__namespace.Vector3(0,0,-1).applyEuler(pe.rotation)):"right"===ue.handedness&&this.xrControllerRay.right.set(he,new THREE__namespace.Vector3(0,0,-1).applyEuler(pe.rotation)),this.controllerWrappers[te].position.copy(new THREE__namespace.Vector3(0,0,0).add(G).sub(de));var fe=this.models.intersectRaycaster(this.xrControllerRay.right);if(0===fe.length&&(fe=this.xrControllerRay.right.intersectObject(this.boundingMesh,!0).map((function(e){var t;return __assign({floor:null!==(t=null==D?void 0:D.floorIndex)&&void 0!==t?t:0},e)}))),fe.length>=1&&fe[0].face)if("right"===ue.handedness){var me=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),ve=fe[0].face.normal,Ae=ve.clone().multiplyScalar(.05),ge=fe[0].point.clone().add(Ae);this.intersectMesh.position.copy(ge);var ye=ge.clone().add(Ae);if(this.intersectMesh.lookAt(ye),Math.abs(ve.y)>.99){var be=this.camera.position.clone().sub(ge);this.intersectMesh.rotation.z=-Math.atan2(be.z,be.x)}this.intersectMesh.visible=!0,this.needsRender=!0,me.length>0?(this.pointerLines.right.setPoints(he,me[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(he,fe[0].point));var Ee=fe[0],_e=createEvent("intersect.update",{raycaster:null!==(a=this.xrControllerRay.right)&&void 0!==a?a:null,intersection:null!=Ee?Ee:null,object:this.intersectMesh});if(this.emit("intersect.update",_e),_e.defaultPrevented)return void this.hideIntersectMesh()}else this.pointerLines.left.setPoints(he,fe[0].point)}}if(this.camera.pose.distance>.1||A){if(D)for(var Te=0,xe=Object.keys(this.panoMeshes);Te<xe.length;Te++){var Re=xe[Te];(Be=this.panoMeshes[Re]).setOpacity(0),Be.setCurrent(!1),Be.updateTime&&Be.updateTime(e,t)}}else if(D){var we=arrayMin(D.visibleIds,(function(e){var t=u.works.getResolvedObserver(e);return t?D.standingPosition.distanceTo(t.standingPosition):1/0}),!0)[1];we=clamp(we,2.5,1/0);for(var Me=D.visibleIds.concat(panoStringify(this.currentPano)),Se=this.getForwardObserverOrNot(),Ce=this.camera.getDirection(new THREE__namespace.Vector3),Ie=0,Pe=Object.keys(this.panoMeshes);Ie<Pe.length;Ie++){Re=Pe[Ie];var Be=this.panoMeshes[Re],Oe=this.works.getResolvedObserver(Re);if(-1===Me.indexOf(Re))Be.setCurrent(!1),Be.setOpacity(0);else if(Oe)if(Oe.loadable||Oe.active){var ke=Be.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);Be.setCurrent(!Be.loading&&0===Be.progress&&null!==Se&&Se.panoId===Re),Be.setOpacity(ke<.01?0:clamp(we/ke*1.2,.65,.98));var He=this.camera.position.clone().setY(Be.position.y),Fe=(new THREE__namespace.Vector3).copy(Be.position).sub(He).normalize();if(Re===panoStringify(this.currentPano)){var Le=clamp((.5-He.distanceTo(Be.position))/.5,0,1);Fe.multiplyScalar(1-Le).add(Ce.clone().multiplyScalar(Le))}Fe.length()>0&&Be.quaternion.setFromEuler(new THREE__namespace.Euler(0,Math.atan2(Fe.x,Fe.z),0))}else Be.setCurrent(!1),Be.setOpacity(0);else Be.setCurrent(!1),Be.setOpacity(0);Be.updateTime&&Be.updateTime(e,t)}}var De=function(){if(!1===u.tileLevelForFov)return 0;var e=new THREE__namespace.Vector2(4e3,4e3),t=v.panoId,n=u.works.getResolvedObserver(t),r=u.imageOptions.size;if(void 0===r&&n){var i=n.images.up.match(/\/cube_(\d+)\//);i&&(r=Number(i[1]))}void 0===r&&(r=2048);var o=0;r>=1024&&(o=1),r>=2048&&(o=2),r>=4096&&(o=3),r>=8192&&(o=4);var a=u.tileLevelForFov(Q.fov,e);return a>o?a:0}(),Ne=function(){var e=new THREE__namespace.PerspectiveCamera;e.applyMatrix4(U.matrix),e.position.set(0,0,0);var t=u.works.getResolvedObserver(v.panoId),n=null!=t?t:D;return n&&e.quaternion.premultiply(n.quaternion.clone().inverse()),e.updateProjectionMatrix(),e.updateMatrixWorld(!0),(new THREE__namespace.Frustum).setFromProjectionMatrix((new THREE__namespace.Matrix4).multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse))}();v.panoId===panoStringify(this.currentPano)&&(null===(s=v.leftPanoPicture)||void 0===s?void 0:s.map)instanceof TileCubeTextureTarget&&(v.leftPanoPicture.map.update(Ne,De),!0===v.leftPanoPicture.map.needsRender&&(this.needsRender=!0));var Ve=this.tiling.object.visible;if(De>this.TILED_CUBE_TEXTURE_LEVEL&&this.initAnimationed){var Ue=v.panoId,Qe=this.works.getResolvedObserver(Ue);Qe&&isSimilarVector3(this.camera.position,Qe.position)&&this.locationMotion.ended?(this.tiling.object.visible=!0,this.tiling.panoId!==Ue&&this.tiling.cleanup(),this.tiling.panoId=Ue,this.tiling.setResource(null!==(l=null===(c=Qe.images)||void 0===c?void 0:c.tiles)&&void 0!==l?l:[],this.enableIOSEDR&&Qe.images.luminance?Qe.images.luminance:null),this.tiling.setFetcher(getFetcher(Qe.work)),this.tiling.setRotation(Qe.quaternion),this.tiling.setPosition(Qe.position),this.tiling.update(Ne,De,e)):this.tiling.object.visible=!1}else this.tiling.object.visible=!1;Ve!==this.tiling.object.visible&&(this.tiling.object.needsRender=!0),this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),!ce||ce.length<1||this.updateControllerHelper(ce,e,t)}else console.error("no layer found")}}}else console.error("session丢失,请重试");else console.error("xrFrame丢失,请重试")},t.prototype.render=function(){var e=this.xrManager.getCamera(this.camera);this.renderer.render(this.scene,e)},t.prototype.onPanGesture=function(){},t.prototype.onTapGesture=function(){},t.prototype.onPinchGesture=function(){},t.prototype.onMouseMove=function(){},t.prototype.onMouseOut=function(){},t.prototype.panoResourceFromLocationMotionKeyframe=function(e){return this.panoResources[e.key]},t.prototype.updateControllerHelper=function(e,t,n){var r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e&&0!==e.length){for(var o={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}},a=0;a<e.length;a++){var s=e[a].handedness,c=e[a].gamepad;switch(s){case"left":c.axes&&(this.emitEvent(-1===c.axes[2],"LeftAxesLeft",t),this.emitEvent(1===c.axes[2],"LeftAxesRight",t),this.emitEvent(-1===c.axes[3],"LeftAxesUp",t),this.emitEvent(1===c.axes[3],"LeftAxesDown",t)),(null==c?void 0:c.buttons)&&(this.emitEvent(null==c?void 0:c.buttons[4].pressed,"X",t),this.emitEvent(c.buttons[5].pressed,"Y",t),this.emitEvent(null==c?void 0:c.buttons[0].pressed,"LeftTrigger",t),this.emitEvent(null==c?void 0:c.buttons[1].pressed,"LeftPinch",t));var l={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};o.buttons.X=!(!c.buttons||!c.buttons[4])&&c.buttons[4].pressed,o.buttons.Y=!(!c.buttons||!c.buttons[5])&&(null==c?void 0:c.buttons[5].pressed),o.buttons.LeftTrigger=!(!c.buttons||!c.buttons[0])&&(null==c?void 0:c.buttons[0].pressed),o.buttons.LeftPinch=!(!c.buttons||!c.buttons[1])&&(null==c?void 0:c.buttons[1].pressed),o.left=l;break;case"right":c.axes&&(this.emitEvent(-1===c.axes[2],"RightAxesLeft",t),this.emitEvent(1===c.axes[2],"RightAxesRight",t),this.emitEvent(-1===c.axes[3],"RightAxesUp",t),this.emitEvent(1===c.axes[3],"RightAxesDown",t)),c.buttons&&(this.emitEvent(null==c?void 0:c.buttons[4].pressed,"A",t),this.emitEvent(c.buttons[5].pressed,"B",t),this.emitEvent(null==c?void 0:c.buttons[0].pressed,"RightTrigger",t),this.emitEvent(null==c?void 0:c.buttons[1].pressed,"RightPinch",t));var u={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};o.right=u,o.buttons.A=!(!c.buttons||!c.buttons[4])&&(null==c?void 0:c.buttons[4].pressed),o.buttons.B=!(!c.buttons||!c.buttons[5])&&(null==c?void 0:c.buttons[5].pressed),o.buttons.RightTrigger=!(!c.buttons||!c.buttons[0])&&(null==c?void 0:c.buttons[0].pressed),o.buttons.RightPinch=!(!c.buttons||!c.buttons[1])&&(null==c?void 0:c.buttons[1].pressed)}}this.emit("xr.controller.update",createEvent("xr.controller.update",o))}},t.prototype.emitEvent=function(e,t,n){var r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)!1===this.xrControllerState[t].touchStart?(this.xrControllerState[t].touchStartTime=n,this.xrControllerState[t].touchStart=!0,this.emit("xr.gesture.buttonDown",createEvent("xr.gesture.buttonDown",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrControllerState[t].touchStartTime>CONTROLLER_EVNET_DELTA_TIME&&this.emit("xr.gesture.press",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(!0===this.xrControllerState[t].touchStart){if(this.emit("xr.gesture.buttonUp",createEvent("xr.gesture.buttonUp",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrControllerState[t].touchStartTime<=CONTROLLER_EVNET_DELTA_TIME)this.emit("xr.gesture.tap",createEvent("xr.gesture.tap",{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}}))||"RightTrigger"===t&&this.checkSelectedPano(this.xrControllerRay.right);this.xrControllerState[t].touchStart=!1,this.xrControllerState[t].touchStartTime=0}},t}(PanoramaController),Controllers={Floorplan:FloorplanController,Topview:TopviewController,Panorama:PanoramaController,VRPanorama:VRPanoramaController,Model:ModelController,DepthPanorama:DepthPanoramaController,Mapview:MapviewController,XRPanorama:XRPanoramaController},PROXY_CONTROLLER_EVENT_NAMES=["gesture.pan","gesture.tap","gesture.press","gesture.pinch","gesture.mousewheel","gesture.mousemove","gesture.momentum","initAnimation.start","initAnimation.end","camera.update","intersect.update","pano.select","pano.moveTo","pano.moving","pano.arrived","pano.cancel","pano.error","pano.texture.load","pano.texture.progress","pano.texture.success","pano.texture.error","pano.texture.abort","xr.session.start","xr.session.end","xr.gesture.tap","xr.gesture.press","xr.gesture.buttonUp","xr.gesture.buttonDown","xr.controller.update"];function initLegacyEvent(e){e.on("initAnimation.start",(function(t){e.emit("initAnimationWillStart",t.state.panoIndex,t.state,t.userAction)})),e.on("initAnimation.end",(function(t){e.emit("initAnimationEnded",t.state.panoIndex,t.state,t.userAction)})),e.on("gesture.pan",(function(t){e.emit("wantsGesture","pan",t.pointers,t.isFinal)&&t.preventDefault(),e.emit("wantsPanGesture",t.state,t.isFinal)&&t.preventDefault(),t.defaultPrevented||(e.emit("gesture","pan",t.pointers,t.isFinal),e.emit("panGesture",t.state,t.isFinal))})),e.on("gesture.tap",(function(t){e.emit("wantsGesture","tap",t.pointers,t.isFinal)&&t.preventDefault(),e.emit("wantsTapGesture",t.center.raycaster,t.center.coords,t.isFinal)&&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.press",(function(t){e.emit("wantsGesture","press",t.pointers,t.isFinal)&&t.preventDefault(),e.emit("wantsPressGesture",t.center.raycaster,t.center.coords,t.center.delta,t.isFinal)&&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",(function(t){e.emit("wantsGesture","pinch",t.pointers,t.isFinal)&&t.preventDefault(),e.emit("wantsPinchGesture",t.scale,t.state.fov,t.isFinal)&&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",(function(t){e.emit("wantsGesture","mouseWheel",t.pointers,t.isFinal)&&t.preventDefault(),e.emit("wantsMouseWheel",t.center.delta,t.state.fov,t.isFinal)&&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",(function(t){e.emit("wantsGesture","mouseMove",t.pointers,t.isFinal)&&t.preventDefault(),t.defaultPrevented||(e.emit("gesture","mouseMove",t.pointers,t.isFinal),e.emit("wantsChangeCameraFov",t.state.fov)&&t.preventDefault())})),e.on("gesture.momentum",(function(t){e.emit("wantsInteriaPan",t.state)&&t.preventDefault(),t.defaultPrevented||e.emit("interiaPan",t.state,t.isFinal)})),e.on("camera.update",(function(t){e.emit("cameraFovUpdate",t.state.fov,t.userAction),e.emit("cameraDirectionUpdate",t.state,t.userAction);var n=coordinatesToVector(t.state);n.setLength(t.state.distance);var r=t.state.offset.clone().sub(n);e.emit("cameraPositionUpdate",r,t.userAction),e.emit("cameraUpdate",t.state,t.userAction)})),e.on("intersect.update",(function(t){if(t.intersection){e.emit("wantsShowIntersectionOnModel",t.raycaster)&&t.preventDefault(),t.defaultPrevented||e.emit("intersectionOnModelUpdate",t.intersection,t.object)}else e.emit("intersectionHidden")})),e.on("pano.request",(function(t){var 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",(function(t){e.emit("panoSelected",t.state.panoIndex)})),e.on("pano.moveTo",(function(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",(function(t){e.emit("movingToPano",t.state.panoIndex,t.prevPano.panoIndex,t.progress)})),e.on("pano.arrived",(function(t){e.emit("panoArrived",t.state.panoIndex,t.state,t.userAction)})),e.on("pano.cancel",(function(t){e.emit("moveToPanoCanceled",t.state.panoIndex)})),e.on("pano.error",(function(t){e.emit("panoLoadError",t.error,t.state.panoIndex)})),e.on("pano.texture.load",(function(t){e.emit("textureStartLoad",t.pano.panoIndex)})),e.on("pano.texture.success",(function(t){e.emit("textureLoaded",t.pano.panoIndex,t.meta)})),e.on("pano.texture.error",(function(t){e.emit("textureError",t.error,t.pano.panoIndex)})),e.on("pano.texture.abort",(function(t){e.emit("textureAbort",t.pano.panoIndex)})),e.on("pano.texture.progress",(function(t){e.emit("textureLoading",t.progress,t.pano.panoIndex)})),e.on("xr.session.start",(function(t){e.emit("webXRSessionStart")})),e.on("xr.session.end",(function(t){e.emit("webXRSessionEnd")})),e.on("xr.gesture.tap",(function(t){e.emit("webXRControllerEvent","tap",t.buttons,{raycaster:t.controllers.raycaster})})),e.on("xr.gesture.press",(function(t){e.emit("webXRControllerEvent","press",t.buttons,{raycaster:t.controllers.raycaster})})),e.on("xr.gesture.buttonUp",(function(t){e.emit("webXRControllerEvent","buttonUp",t.buttons,{raycaster:t.controllers.raycaster})})),e.on("xr.gesture.buttonDown",(function(t){e.emit("webXRControllerEvent","buttonDown",t.buttons,{raycaster:t.controllers.raycaster})})),e.on("xr.controller.update",(function(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",(function(t){e.emit("willLoad",t.input,t.works[0],t.state)})),e.on("works.load",(function(t){e.emit("load",t.input,t.works[0],t.state)})),e.on("works.ready",(function(t){e.emit("loaded",t.input,t.works[0])})),e.on("state.change",(function(t){e.emit("stateChange",t.state,t.userAction)})),e.on("currentState.change",(function(t){e.emit("currentStateChange",t.state,t.userAction)})),e.on("state.set",(function(t){e.emit("setState",t.state)})),e.on("state.synced",(function(t){e.emit("stateSynced",t.state)})),e.on("model.request",(function(t){e.emit("modelWillLoad",t.work.model)})),e.on("model.error",(function(t){e.emit("modelLoadError",t.error,t.model)})),e.on("model.load",(function(t){e.emit("modelLoaded",t.model)})),e.on("model.changeShownFloor",(function(t){e.emit("modelShownFloorChange",t.model.shownFloor,t.model.floorLength)})),e.on("render",(function(t){e.emit("renderFrame",t.needsRender)})),e.on("mode.change.request",(function(t){e.emit("wantsChangeMode",t.mode,t.prevMode)})),e.on("mode.change",(function(t){e.emit("modeChange",t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)})),e.on("helpers.visible",(function(t){e.emit("helpersVisibleChange",t.object.visible)})),e.on("network.resource",(function(t){e.emit("network",t.source,t.requestType,t.requestState,t.detail)}))}function generateDefaultVideoElement(){var e=document.createElement("video");e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin="";var t=function(){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}function initLights(e){(t=new THREE__namespace.DirectionalLight(16777215,.5)).position.copy(new THREE__namespace.Vector3(1,1,1)),e.add(t);var t=new THREE__namespace.DirectionalLight(16777215,.3);e.add(t);t=new THREE__namespace.AmbientLight(16777215,.3);e.add(t)}function parseKeyValue(e){for(var t,n,r={},i=0,o=e.split(/(\;|\,)/);i<o.length;i++){var a=o[i].split("="),s=null===(t=a[0])||void 0===t?void 0:t.trim(),c=null===(n=a[1])||void 0===n?void 0:n.trim();s&&c&&(r[s]=c)}return r}function getViewportScale(){for(var e,t=document.getElementsByTagName("meta"),n=0;n<t.length;n++){var r=t[n];if("viewport"===r.getAttribute("name")){var i=parseKeyValue(null!==(e=r.getAttribute("content"))&&void 0!==e?e:""),o=Number(i["initial-scale"]);if(!isNaN(o))return o}}return 1}const textureURL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hI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==";var imageSize=[351,63],imageOffset=[20,20],vertices=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),uvs=new Float32Array([0,0,1,0,0,1,1,1]),index=new Uint8Array([0,1,2,1,3,2]),geometry=new THREE__namespace.BufferGeometry;geometry.setAttribute("position",new THREE__namespace.BufferAttribute(vertices,3)),geometry.setAttribute("uv",new THREE__namespace.BufferAttribute(uvs,2)),geometry.setIndex(new THREE__namespace.BufferAttribute(index,1));var material=new THREE__namespace.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),mesh=new THREE__namespace.Mesh(geometry,material);mesh.matrixAutoUpdate=!1;var scene=new THREE__namespace.Scene;scene.add(mesh),scene.matrixAutoUpdate=!1;var camera=new THREE__namespace.OrthographicCamera(-.5,.5,.5,-.5,.1,1);camera.position.set(0,0,.5),camera.lookAt(0,0,0),camera.updateMatrixWorld(!0),camera.matrixAutoUpdate=!1;var prevViewport=new THREE__namespace.Vector4,prevScissor=new THREE__namespace.Vector4;function renderPoweredByRealsee(e){if(material.map){var t=e.getViewport(prevViewport),n=e.getScissor(prevScissor),r=e.getScissorTest(),i=e.autoClear,o=n.x+imageOffset[0]/3,a=n.y+imageOffset[1]/3,s=imageSize[0]/3,c=imageSize[1]/3;e.setViewport(o,a,s,c),e.setScissor(o,a,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(scene,camera),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{var l=new THREE__namespace.Texture,u=new Image;u.onload=function(){l.image=u,l.wrapS=THREE__namespace.ClampToEdgeWrapping,l.wrapT=THREE__namespace.ClampToEdgeWrapping,l.minFilter=THREE__namespace.LinearFilter,l.needsUpdate=!0,l.generateMipmaps=!1,material.needsUpdate=!0,u.onload=noop$1},u.src=textureURL,material.map=l}}var DEFAULT_MODE_CHANGE_DURATION=800,DEFAULT_REQUEST_PROXY=function(e){return 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/")},BUILTIN_COORDINATESSYSTEMTRANSFORMERS=[{name:"Z",transformToUpAxisZ:function(){return new THREE__namespace.Matrix4}},{name:"Y",transformToUpAxisZ:function(){return(new THREE__namespace.Matrix4).makeRotationAxis(new THREE__namespace.Vector3(1,0,0),+Math.PI/2)}},{name:"-Y",transformToUpAxisZ:function(){return(new THREE__namespace.Matrix4).makeRotationAxis(new THREE__namespace.Vector3(1,0,0),-Math.PI/2)}},{name:"WGS84",transformToEarthCentered:function(){return new THREE__namespace.Matrix4}},{name:"GCJ02",transformToEarthCentered:function(){return new THREE__namespace.Matrix4}},{name:"BD09",transformToEarthCentered:function(){return new THREE__namespace.Matrix4}}],sharedVector2=new THREE__namespace.Vector2,sharedFrustum=new THREE__namespace.Frustum,sharedProjScreenMatrix=new THREE__namespace.Matrix4,clockForMixer=new WeakMap,worksMap=new WeakMap,emptyWorks=createWorks([]),Five=function(e){function t(t){var n,r,i,o,a,s,c,l,u,p;void 0===t&&(t={});var d=e.call(this)||this;d.ident=createUuid(),__FIVE_DEBUG__.instances[d.ident]=d,d.renderSwitch01=0,d.currentMode="Panorama",d.pano={workCode:"",panoIndex:0},d.needsRender=!1,d.onlyRenderIfNeeds=null===(n=t.onlyRenderIfNeeds)||void 0===n||n,d.imageOptions=__assign({},null!==(r=t.imageOptions)&&void 0!==r?r:{}),d.textureOptions=__assign({},null!==(i=t.textureOptions)&&void 0!==i?i:{}),d.poweredByRealsee=null===(o=t.poweredByRealsee)||void 0===o||o,d.extraElements=[],d.controllerInits={Panorama:Object.assign({},t.panorama),Model:Object.assign({},t.model),Floorplan:Object.assign({},t.floorplan),Topview:Object.assign({},t.topview),Mapview:Object.assign({},t.mapview),DepthPanorama:Object.assign({},t.depthPanorama),VRPanorama:Object.assign({},t.vrPanorama),XRPanorama:Object.assign({},t.xrPanorama)},d.coordinatesSystemTransformers=__spreadArray([],null!==(a=t.coordinatesSystemTransformers)&&void 0!==a?a:[],!0);for(var h=function(e){f.coordinatesSystemTransformers.find((function(t){return t.name===e.name}))||f.coordinatesSystemTransformers.push(__assign({},e))},f=this,m=0,v=BUILTIN_COORDINATESSYSTEMTRANSFORMERS;m<v.length;m++){h(v[m])}if(d.fps={testCount:0,testTime:now()},d.info=null,d.modeChangeDuration=null!==(s=t.modeChangeDuration)&&void 0!==s?s:DEFAULT_MODE_CHANGE_DURATION,d.enableWheel=null===(c=t.enableWheel)||void 0===c||c,"undefined"!=typeof window)if(t.renderer)t.renderer instanceof InternalWebGLRenderer&&d.throwError(new Error("cannot render a internal renderer")),d.renderer=t.renderer;else try{d.renderer=new InternalWebGLRenderer({preserveDrawingBuffer:t.preserveDrawingBuffer,backgroundColor:t.backgroundColor,backgroundAlpha:t.backgroundAlpha,antialias:t.antialias,webgl2:null==t?void 0:t.webgl2});var A=getViewportScale();d.renderer.setPixelRatio(1===A?window.devicePixelRatio:1),d.renderer.setSize(512,512)}catch(error){error instanceof Error&&d.throwError(error)}d.getPixelsRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1,{encoding:null!==(u=null===(l=d.renderer)||void 0===l?void 0:l.outputEncoding)&&void 0!==u?u:THREE__namespace.sRGBEncoding}),d.scissor=Object.assign({left:0,bottom:0,width:1,height:1},t.scissor),d.camera=new Camera(90),d.scene=new Scene,d.xrCustomObjectsScene=new THREE__namespace.Scene,d.scene.add(d.xrCustomObjectsScene),d.scene.matrixAutoUpdate=!1,d.lastLoadWorkTask=Promise.resolve(),d.requestProxy=null!==(p=t.requestProxy)&&void 0!==p?p:DEFAULT_REQUEST_PROXY,d.networkSubscribe=new NetworkSubscribe,d.networkSubscribe.on("network",(function(e,t,n,r){var i;d.emit("network.resource",createEvent("network.resource",{source:e,requestType:t,requestState:n,detail:r})),null===(i=d.analysis)||void 0===i||i.network(d.works,e,t,n,r)})),d.boundingMesh=generateBoundingMesh(new THREE__namespace.Box3(new THREE__namespace.Vector3(-.5,-.5,-.5),new THREE__namespace.Vector3(.5,.5,.5))),d.boundingMesh.name="bounding",d.scene.add(d.boundingMesh),d.models=createModels(),d.models.push(new Model),d.lastModels=createModels(),d.readyCallbacks=[],d.syncingState=!1,d.modelGroup=new THREE__namespace.Group,d.modelGroup.visible=!1,d.modelGroup.name="model",d.modelGroup.matrixAutoUpdate=!1,d.modelGroup.renderOrder=-4,d.scene.add(d.modelGroup),d.helperGroup=new THREE__namespace.Group,d.helperGroup.name="helper",d.helperGroup.matrixAutoUpdate=!1,d.scene.add(d.helperGroup),d.videoTexture=new THREE__namespace.VideoTexture(t.videoInstance||generateDefaultVideoElement()),initLights(d.scene),d.copyEffect=new Effect(d.renderer,d.scene,d.camera,d.models),d.state={mode:d.currentMode,workCode:d.pano.workCode,panoIndex:d.pano.panoIndex,longitude:d.camera.pose.longitude,latitude:d.camera.pose.latitude,fov:d.camera.pose.fov,offset:d.camera.pose.offset.clone(),distance:d.camera.pose.distance},d.stateSynced=!1,d._enableIOSEDR=!1,d.destroyed=!1,d.paused=!0,"undefined"!=typeof window&&(!1!==t.play&&d.play(),d.stopAnimationLoop=AnimationFrameLoop.shared.add((function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];d.updateTime.apply(d,__spreadArray([e,t],n,!1))}),!1,0,10));var g=function(){"undefined"!=typeof document&&null===document.fullscreenElement&&"VRPanorama"===d.currentMode&&d.controller.emit("vr.requestExit",createEvent("vr.requestExit",{}))},y=function(){d.needsRender=!0};if("undefined"!=typeof document&&document.addEventListener("fullscreenchange",g,!1),d.renderer&&d.renderer.domElement.addEventListener("webglcontextrestored",y,!1),d.removeEventListeners=function(){"undefined"!=typeof document&&document.removeEventListener("fullscreenchange",g,!1),d.renderer&&d.renderer.domElement.removeEventListener("webglcontextrestored",y,!1)},d.plugins={},t.plugins&&t.plugins.length)for(var b=0,E=t.plugins;b<E.length;b++){var _=E[b];if("function"==typeof _)_(d);else if(Array.isArray(_)){var T=_[0],x=_[1],R=_[2];if("function"==typeof T){var w=T(d,R);"string"==typeof x&&(d.plugins[x]?d.throwError(new Error("plugin name ".concat(x," is exists."))):d.plugins[x]=w)}}}return d.gpuPickingRenderTarget=new THREE__namespace.WebGLRenderTarget(1,1),d.meshReplaceMaterialMap=new Map,d.meshOriginMaterialMap=new Map,initLegacyEvent(d),d}return __extends(t,e),Object.defineProperty(t,"version",{get:function(){return"6.0.0-alpha.71"},enumerable:!1,configurable:!0}),Object.defineProperty(t,"dracoPath",{get:function(){return draco.decoderPath},set:function(e){draco.setDecoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ktx2Path",{get:function(){return ktx2.transcoderPath},set:function(e){ktx2.setTranscoderPath(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panoIndex",{get:function(){return this.pano.panoIndex},enumerable:!1,configurable:!0}),t.prototype.getGPUPicking=function(e,t,n,r,i){var o=this;if(void 0===r&&(r=1),void 0===i&&(i=new THREE__namespace.Vector3(0,0,0)),!this.renderer)throw new Error("renderer is not initialized.");this.models.setMaterial({constantColor:i}),this.scene.traverse((function(e){if(e instanceof THREE__namespace.Mesh&&!(e instanceof PBMMesh)){var t=Object.keys(n).filter((function(t){return t===e.uuid}))[0];if(t)if(o.meshOriginMaterialMap.set(t,e.material),o.meshReplaceMaterialMap.get(t))e.material=o.meshReplaceMaterialMap.get(t);else{var r=new THREE__namespace.ShaderMaterial({uniforms:{color:{value:n[t]}},vertexShader:"\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n }\n ",fragmentShader:"\n uniform vec3 color;\n void main() {\n gl_FragColor = vec4( color, 1.0 );\n }\n "});r.depthTest=e.material.depthTest,r.side=e.material.side,o.meshReplaceMaterialMap.set(t,r),e.material=r}}}));var a=this.renderer.getSize(new THREE__namespace.Vector2);this.camera.setViewOffset(a.width,a.height,e*r,t*r,1,1),this.renderer.setRenderTarget(this.gpuPickingRenderTarget),this.render();var s=new Uint8Array(4);this.renderer.readRenderTargetPixels(this.gpuPickingRenderTarget,0,0,1,1,s),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),this.scene.traverse((function(e){e instanceof THREE__namespace.Mesh&&!(e instanceof PBMMesh)&&o.meshOriginMaterialMap.get(e.uuid)&&(e.material=o.meshOriginMaterialMap.get(e.uuid))})),this.models.setMaterial({constantColor:null});var c=Object.keys(n).filter((function(e){return n[e].equals((new THREE__namespace.Color).setRGB(s[0]/255,s[1]/255,s[2]/255))}))[0];return c||!1},t.prototype.dispose=function(){var e,t;if(!0!==this.destroyed){delete __FIVE_DEBUG__.instances[this.ident],this.emit("dispose"),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),delete this.stopAnimationLoop),null===(e=this.renderer)||void 0===e||e.setAnimationLoop(null),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);var n=this.getElement();n&&n.parentNode&&n.parentNode.removeChild(n);var r=this.models.getMaterial();r&&(r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==(null===(t=r.pano0)||void 0===t?void 0:t.map)&&r.pano1.map.dispose());for(var i=0,o=this.models;i<o.length;i++){o[i].dispose()}this.models.length=0,this.models.setMaterial({pano0:null,pano1:null}),this.meshReplaceMaterialMap.forEach((function(e){e.dispose()})),this.meshOriginMaterialMap.forEach((function(e){e.dispose()})),this.renderer instanceof InternalWebGLRenderer&&this.renderer.forceContextLoss&&this.renderer.forceContextLoss()}},t.prototype.setScissor=function(e){Object.assign(this.scissor,e),this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize()},Object.defineProperty(t.prototype,"helperVisible",{get:function(){return this.helperGroup.visible},set:function(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit("helpers.visible",createEvent("helpers.visible",{object:this.helperGroup})),this.needsRender=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableIOSEDR",{get:function(){return this._enableIOSEDR},set:function(e){this._enableIOSEDR!==e&&(this._enableIOSEDR=e,this.currentMode&&"Panorama"===this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"postProcessingType",{get:function(){return"Panorama"===this.currentMode&&this.enableIOSEDR?"luminance":"Mapview"===this.currentMode&&this.enableEDL?"edl":"Mapview"===this.currentMode&&this.enableHQ?"hq":null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEDL",{get:function(){return this.models.getMaterial().useEDL},set:function(e){var n,r,i,o;if(!0===e&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启EDL");if(this.models.setMaterial({useEDL:e}),this.boundingMesh.visible=!e,e){if(!this.screenBuffers){var a=this.getDrawingBufferSize(sharedVector2);this.screenBuffers=[new THREE__namespace.WebGLRenderTarget(a.x,a.y,{encoding:null!==(r=null===(n=this.renderer)||void 0===n?void 0:n.outputEncoding)&&void 0!==r?r:THREE__namespace.sRGBEncoding,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType}),new THREE__namespace.WebGLRenderTarget(a.x,a.y,{encoding:null!==(o=null===(i=this.renderer)||void 0===i?void 0:i.outputEncoding)&&void 0!==o?o:THREE__namespace.sRGBEncoding,minFilter:THREE__namespace.LinearMipMapLinearFilter,magFilter:THREE__namespace.LinearMipMapLinearFilter})]}}else this.screenBuffers&&(this.screenBuffers.forEach((function(e){e.dispose()})),delete this.screenBuffers);this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableHQ",{get:function(){return this.models.getMaterial().useHQWeight||this.models.getMaterial().useHQDepth||!1},set:function(e){var n,r;if(!0===e&&this.currentMode!==t.Mode.Mapview)throw new Error("只支持Mapview下开启HQ");if(!0===e?this.models.setMaterial({useHQDepth:!0,useHQWeight:!1,pointShape:"CIRCLE"}):this.models.setMaterial({useHQDepth:!1,useHQWeight:!1}),this.boundingMesh.visible=!e,e){if(!this.screenBuffers){var i=this.getDrawingBufferSize(sharedVector2),o=new THREE__namespace.WebGLRenderTarget(i.x,i.y,{minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:new THREE__namespace.DepthTexture(i.x,i.y,THREE__namespace.UnsignedIntType)});o.depthTexture.format=THREE__namespace.DepthFormat,o.depthBuffer=!0;var a=new THREE__namespace.WebGLRenderTarget(i.x,i.y,{encoding:null!==(r=null===(n=this.renderer)||void 0===n?void 0:n.outputEncoding)&&void 0!==r?r:THREE__namespace.sRGBEncoding,minFilter:THREE__namespace.NearestFilter,magFilter:THREE__namespace.NearestFilter,format:THREE__namespace.RGBAFormat,type:THREE__namespace.FloatType,depthTexture:o.depthTexture});this.screenBuffers=[o,a]}}else this.screenBuffers&&(this.screenBuffers.forEach((function(e){e.dispose()})),delete this.screenBuffers);this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enablePostProcessing",{get:function(){return void 0!==this.screenBuffers},set:function(e){var t,n,r,i;if(e){if(!this.screenBuffers){var o=this.getDrawingBufferSize(sharedVector2);this.screenBuffers=[new THREE__namespace.WebGLRenderTarget(o.x,o.y,{encoding:null!==(n=null===(t=this.renderer)||void 0===t?void 0:t.outputEncoding)&&void 0!==n?n:THREE__namespace.sRGBEncoding}),new THREE__namespace.WebGLRenderTarget(o.x,o.y,{encoding:null!==(i=null===(r=this.renderer)||void 0===r?void 0:r.outputEncoding)&&void 0!==i?i:THREE__namespace.sRGBEncoding})]}}else this.screenBuffers&&(this.screenBuffers.forEach((function(e){e.dispose()})),delete this.screenBuffers);this.needsRender=!0},enumerable:!1,configurable:!0}),t.prototype.updateConfiguration=function(e){var t=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,e.panorama),"Panorama"===this.currentMode&&(t=!0)),e.model&&(Object.assign(this.controllerInits.Model,e.model),"Model"===this.currentMode&&(t=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,e.floorplan),"Floorplan"===this.currentMode&&(t=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,e.topview),"Topview"===this.currentMode&&(t=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,e.topview),"Mapview"===this.currentMode&&(t=!0)),e.depthPanorama&&(Object.assign(this.controllerInits.DepthPanorama,e.depthPanorama),"DepthPanorama"===this.currentMode&&(t=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,e.vrPanorama),"VRPanorama"===this.currentMode&&(t=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),"Panorama"!==this.currentMode&&"DepthPanorama"!==this.currentMode&&"VRPanorama"!==this.currentMode||(t=!0)),t&&this.controller&&this.currentMode&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions)},t.prototype.appendTo=function(e,t){if(void 0===t&&(t={}),this.renderer)if(this.renderer instanceof InternalWebGLRenderer){var n=this.getElement();if(n){e.appendChild(n),this.refresh(t);var r=window.getComputedStyle(e).position;"relative"!==r&&"absolute"!==r&&"fixed"!==r&&"sticky"!==r&&(e.style.position="relative")}}else this.throwError(new Error("cannot call appendTo method when render a external renderer"))},t.prototype.refresh=function(e,t){if(void 0===e&&(e={}),this.renderer){var n=this.getElement();if(n){var r=n.parentNode;if(r&&r.nodeName){var i=e.width,o=void 0===i?r.offsetWidth:i,a=e.height,s=void 0===a?r.offsetHeight:a;this.renderer instanceof InternalWebGLRenderer&&(t&&this.renderer.setPixelRatio(t),this.renderer.setSize(o,s))}this.controller&&this.controller.updateRenderSize&&this.controller.updateRenderSize(),this.needsRender=!0}}},t.prototype.addExtraElement=function(e){var t=this;return-1===this.extraElements.indexOf(e)&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),function(){return t.removeExtraElement(e)}},t.prototype.removeExtraElement=function(e){var t=this.extraElements.indexOf(e);-1!==t&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))},t.prototype.getPose=function(){var e=this.camera.copyPose(),t=e.longitude,n=e.latitude,r=e.fov,i=e.offset,o=e.distance;return{longitude:t,latitude:n,fov:r,offset:i.clone(),distance:o}},t.prototype.getSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.getDrawingBufferSize=function(e){if(!this.renderer)throw new Error("renderer is not initialized");return this.renderer.getDrawingBufferSize(e),e.x*=this.scissor.width,e.y*=this.scissor.height,e},t.prototype.updateCamera=function(e,t,n){return void 0===n&&(n=!0),this.controller?this.controller.updateCamera(e,t,n):Promise.reject(new Error("controller is not initialized."))},t.prototype.updateCameraWithKeyframes=function(e,t,n){return void 0===n&&(n=!0),this.controller?this.controller.updateCameraWithKeyframes(e,t,n):Promise.reject(new Error("controller is not initialized."))},t.prototype.getLongitudeAndLatitude=function(){var e=this.getPose();return{longitude:e.longitude,latitude:e.latitude}},t.prototype.getOffset=function(){return this.getPose().offset},t.prototype.getCameraLocal=function(){if(this.pano.workCode&&this.controller&&this.works){var e=this.works.getResolvedObserver(this.pano);if(e){var t=new THREE__namespace.Object3D;return t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.set(1,1,1),t.matrix.compose(t.position,t.quaternion,t.scale),t.matrixAutoUpdate=!1,cameraWorldToLocal(this.camera,t)}}return null},Object.defineProperty(t.prototype,"works",{get:function(){var e=worksMap.get(this);if(!e)return emptyWorks;for(var t=0,n=e;t<n.length;t++){var r=n[t];if(!workRawMapping.has(r))return emptyWorks}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"work",{get:function(){return this.works[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.models[0]},enumerable:!1,configurable:!0}),t.prototype.load=function(e,t,n,r){var i=this;if(void 0===r&&(r=!0),!this.renderer)throw new Error("renderer is not initialized");var o=this.lastLoadWorkTask.then((function(){return isPromise(e)?e.then((function(e){return i.load_(e,t,n,r)})):i.load_(e,t,n,r)}));return this.lastLoadWorkTask=o.catch((function(e){i.throwError(e)})),o},t.prototype.load_=function(e,n,r,i){var o,a,s,c,l,u,p=this;void 0===i&&(i=!0);var d=[];if(Array.isArray(e))for(var h=0,f=e;h<f.length;h++){var m=f[h];"string"!=typeof m&&"work"in m?d.push(parseWork(m.work,m)):d.push(parseWork(m))}else d.push(parseWork(e));for(var v=createWorks(d),A=function(e){var t=g;registerFetcher(e,new Fetcher({allowHosts:e.allowHosts,get requestProxy(){return t.requestProxy},get networkSubscribe(){return t.networkSubscribe}}))},g=this,y=0,b=v;y<b.length;y++){A(b[y])}var E=this.works;void 0===n&&(n=0!==E.length?"inherit":"initial");var _=v.initial,T=_.work.observers[0],x=T?{workCode:T.work.workCode,panoIndex:T.panoIndex}:{workCode:_.work.workCode,panoIndex:0},R=null!==(o=_.mode)&&void 0!==o?o:T?"Panorama":"Mapview",w={};if("inherit"===n)R=this.currentMode,(M=v.resolvedObservers[this.panoIndex])?x={workCode:M.work.workCode,panoIndex:M.panoIndex}:"number"==typeof v.initial.panoIndex?x={workCode:v.initial.work.workCode,panoIndex:v.initial.panoIndex}:"Panorama"!==R&&"DepthPanorama"!==R&&"VRPanorama"!==R&&"XRPanorama"!==R||(R="Mapview"),w={longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:this.camera.pose.distance,offset:this.camera.pose.offset.clone()};else if("initial"===n)"number"==typeof _.panoIndex&&(x={workCode:_.work.workCode,panoIndex:_.panoIndex}),_.mode&&(R=_.mode),w={longitude:_.longitude,latitude:_.latitude,fov:_.fov,distance:_.distance,offset:null===(a=_.offset)||void 0===a?void 0:a.clone()};else{var M;if(R=null!==(s=n.mode)&&void 0!==s?s:this.currentMode,"number"==typeof n.panoIndex)(M=v.getResolvedObserver({workCode:null!==(l=null!==(c=n.workCode)&&void 0!==c?c:_.work.workCode)&&void 0!==l?l:"",panoIndex:n.panoIndex}))&&(x={workCode:M.work.workCode,panoIndex:M.panoIndex});w={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset}}var S=__assign(__assign(__assign({},x),{mode:R}),w);this.emit("works.request",createEvent("works.request",{input:e,works:v,state:S,userAction:i}));var C=function(){p.pano=x;var e=p.controller?null!=r?r:p.modeChangeDuration:0,t=__assign(__assign({initial:{state:S,currentState:p.getCurrentState(),duration:e,userAction:i}},p.commonParams()),p.controllerInits[R]);if(p.controller&&p.currentMode===R)!1===p.controller.updateWork(v,S,e,i)&&(p.controller.destroy(),p.controller=p.applyController(R,t));else{var n=p.currentMode,o=Controllers[R].initAnimationEndState(t);if(p.controller)p.controller.destroy();else{var a=Controllers[R].initAnimationEndState(t);p.camera.setFromPose(a),p.modelGroup.visible=!0,p.emit("camera.update",createEvent("camera.update",{state:p.getCurrentState(),userAction:i}))}p.controller=p.applyController(R,t);var s=createEvent("mode.change",{prevMode:n,mode:R,state:o,userAction:i});p.emit("mode.change",s)}};if(worksMap.set(this,v),!this.controller){var I=__assign(__assign({initial:{state:S,currentState:this.getCurrentState(),duration:0,userAction:i}},this.commonParams()),this.controllerInits[R]),P=Controllers[R].initAnimationEndState(I);this.camera.setFromPose(P),this.emit("camera.update",createEvent("camera.update",{state:this.getCurrentState(),userAction:i}))}if(R===t.Mode.Floorplan||R===t.Mode.Topview||R===t.Mode.Mapview||R===t.Mode.Model)this.loadModel(v).then((function(){p.needsRender=!0,C(),p.emit("camera.update",createEvent("camera.update",{state:p.getCurrentState(),userAction:i}))}));else{if(!this.controller){var B=new THREE__namespace.Vector3,O=v.getResolvedObserver(x);O&&B.copy(O.position),this.camera.setFromPose({fov:w.fov,longitude:w.longitude,latitude:w.latitude,distance:w.distance,offset:null!==(u=w.offset)&&void 0!==u?u:B}),this.needsRender=!0}C(),this.controller.once("pano.moveTo",(function(){p.needsRender=!0,p.emit("camera.update",createEvent("camera.update",{state:p.getCurrentState(),userAction:i})),p.loadModel(v)}))}return this.emit("works.load",createEvent("works.load",{input:e,state:this.getCurrentState(),userAction:i,works:v})),this.ready().then((function(){var t;p.emit("works.ready",createEvent("works.ready",{input:e,state:p.getCurrentState(),userAction:i,works:v})),null===(t=p.analysis)||void 0===t||t.work(v)}))},t.prototype.changeMode=function(e,n,r,i,o){var a=this;return void 0===n&&(n={}),void 0===r&&(r=this.modeChangeDuration),void 0===i&&(i=!0),void 0===o&&(o=!1),new Promise((function(s,c){var l,u,p;if(!a.renderer)throw new Error("renderer is not initialized.");var d="number"==typeof(n=__assign({},n)).panoIndex?{workCode:null!==(p=null!==(l=n.workCode)&&void 0!==l?l:null===(u=a.work)||void 0===u?void 0:u.workCode)&&void 0!==p?p:"",panoIndex:n.panoIndex}:a.pano;if(!t.Mode.hasOwnProperty(e)){var h=new Error('mode "'.concat(e,'" is not existed'));return a.throwError(h),void c(h)}if((e===t.Mode.Floorplan||e===t.Mode.Topview||e===t.Mode.Mapview||e===t.Mode.Model)&&!a.models.loaded){h=new Error("model is not ready.");return a.throwError(h),void c(h)}if((e===t.Mode.Panorama||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama)&&!a.works.getResolvedObserver(d)){h=new Error("PanoId ".concat(panoStringify(d)," not existed."));return a.throwError(h),void c(h)}var f=a.controller,m=a.currentMode,v=function(){if(a.controller&&a.controller.stopMomentumMovement(),a.controller&&!1===o&&m===e)e===t.Mode.Panorama||e===t.Mode.DepthPanorama||e===t.Mode.Model||e===t.Mode.VRPanorama||e===t.Mode.XRPanorama?panoEqual(a.pano,d)&&"moveToPano"in a.controller&&"function"==typeof a.controller.moveToPano?a.controller.moveToPano(d,__assign({duration:r},n),i):a.controller.updateCamera(n,r,i).catch(noop$1):(panoEqual(a.pano,d)||(a.pano=d),a.controller.updateCamera(n,r,i).catch(noop$1));else{var c=__assign(__assign({},n),d),l=__assign(__assign({initial:{state:c,currentState:a.getCurrentState(),duration:r,userAction:i}},a.commonParams()),a.controllerInits[e]),u=Controllers[e].initAnimationEndState(l),p=createEvent("mode.change.request",{prevMode:a.currentMode,mode:e,state:u,userAction:i});if(a.emit("mode.change.request",p),!p.defaultPrevented){f&&f.destroy(),a.controller=a.applyController(e,l);var h=createEvent("mode.change",{prevMode:a.currentMode,mode:e,state:u,userAction:i});a.emit("mode.change",h)}}s()};if(e===t.Mode.VRPanorama)a.requestFullscreen(),requestDeviceOrientationPermission().then((function(){return v()})).catch((function(e){e instanceof Error&&(a.exitFullscreen(),a.throwError(e),c(e))}));else if(e===t.Mode.XRPanorama){var A=AnimationFrameLoop.shared.getContext();A?A.end():requestXRSessionPermission().then((function(e){AnimationFrameLoop.shared.setContext(e),v()})).catch((function(e){e instanceof Error&&(a.throwError(e),c(e))}))}else v()}))},t.prototype.getPixels=function(e,t,n,r,i){if(void 0===i&&(i=1),!this.renderer)throw new Error("renderer is not initialized.");var o=this.getPixelsRenderTarget,a=this.renderer.getSize(new THREE__namespace.Vector2);e=clamp(e,Math.floor(n/2),Math.floor(a.x-n)),t=clamp(t,Math.floor(r/2),Math.floor(a.y-r)),o.setSize(n*i,r*i),this.renderer.setRenderTarget(o),this.camera.setViewOffset(a.width,a.height,e,a.height-t-r,n,r),this.controller?this.controller.render():this.renderer.render(this.scene,this.camera);var s=new Uint8Array(n*i*r*i*4);return this.renderer.readRenderTargetPixels(o,0,0,n*i,r*i,s),this.renderer.setRenderTarget(null),this.camera.clearViewOffset(),s},t.prototype.getElement=function(){var e;return null===(e=this.renderer)||void 0===e?void 0:e.domElement},Object.defineProperty(t.prototype,"observers",{get:function(){return this.works.resolvedObservers},enumerable:!1,configurable:!0}),t.prototype.render=function(e,t){var n=this;if(void 0===t&&(t=!1),!this.renderer)return null;if(t){var r=this.renderer.getSize(sharedVector2);this.scene.traverseVisible((function(e){e.setResolution&&e.setResolution(r.x,r.y)}))}if(this.controller&&this.screenBuffers&&null===this.renderer.getRenderTarget()){var i=this.getDrawingBufferSize(sharedVector2);return this.screenBuffers.forEach((function(e){e.setSize(i.x,i.y)})),this.renderer.setRenderTarget(this.screenBuffers[0]),this.controller.render(),this.info={memory:__assign({},this.controller.renderer.info.memory),render:__assign({},this.controller.renderer.info.render)},"VRPanorama"!==this.currentMode&&"XRPanorama"!==this.currentMode&&this.poweredByRealsee&&renderPoweredByRealsee(this.renderer),e&&AnimationFrameLoop.shared.add(e,!0),this.screenBuffers[0]}return this.aroundScissor((function(){n.renderer&&(n.controller?(n.controller.render(),n.info={memory:__assign({},n.controller.renderer.info.memory),render:__assign({},n.controller.renderer.info.render)}):(n.renderer.render(n.scene,n.camera),n.info={memory:__assign({},n.renderer.info.memory),render:__assign({},n.renderer.info.render)}),n.poweredByRealsee&&"VRPanorama"!==n.currentMode&&"XRPanorama"!==n.currentMode&&renderPoweredByRealsee(n.renderer)),e&&AnimationFrameLoop.shared.add(e,!0)})),null},t.prototype.updateTime=function(e,t){for(var n,r,i,o=this,a=[],s=2;s<arguments.length;s++)a[s-2]=arguments[s];if(!this.destroyed){if(this.works.update(),this.syncingState=this.syncState(e,t),this.controller&&(n=this.controller).updateTime.apply(n,__spreadArray([e,t],a,!1)),this.renderer){var c=this.getSize(sharedVector2),l=this.renderer.getPixelRatio();this.camera.screenHeight=c.height,this.camera.pixelRatio=l,this.camera.aspect=c.width/c.height}if(this.camera.updateTime(e,t),this.renderer){ktx2.detectSupport(this.renderer);var u=this.models.loaded,p=this.models.refined;if(this.models.update(this.renderer,this.camera,this.currentMode),!1===u&&!0===this.models.loaded&&this.emit("models.load",createEvent("models.load",{models:this.models})),!1===p&&!0===this.models.refined&&this.emit("models.refined",createEvent("models.refined",{models:this.models})),this.models.loaded){for(var d=0,h=this.models;d<h.length;d++){(v=h[d]).parent!==this.modelGroup&&(this.modelGroup.add(v),this.needsRender=!0)}if(this.lastModels.length>0){for(var f=0,m=this.lastModels;f<m.length;f++){var v=m[f];this.modelGroup.remove(v),v.dispose(),this.needsRender=!0}this.lastModels.length=0}}this.lastModels.setMaterial(this.models.getMaterial()),this.lastModels.materialVersion=this.models.materialVersion,this.lastModels.update(this.renderer,this.camera,this.currentMode)}this.syncingState=!1;var A=new THREE__namespace.Vector2(512,512),g=new THREE__namespace.Vector2(512,512);this.renderer&&(this.renderer.getSize(A),A.x*=this.scissor.width,A.y*=this.scissor.height,this.renderer.getDrawingBufferSize(g),g.x*=this.scissor.width,g.y*=this.scissor.height);for(var y=new THREE__namespace.Box3,b=new THREE__namespace.Box3,E=new THREE__namespace.Vector3(4,4,4),_=0,T=this.works.resolvedObservers;_<T.length;_++){var x=T[_];b.setFromCenterAndSize(x.position,E),y.union(b)}y.union(this.models.bounding),y.getCenter(this.boundingMesh.position),y.getSize(this.boundingMesh.scale),this.boundingMesh.boundingBox.copy(y);var R=null!==(r=this.models.getMaterial())&&void 0!==r?r:{},w=1-(null!==(i=R.modelAlpha)&&void 0!==i?i:0);R.opacity=clamp(4*w-3,0,1),R.clippers=null,R.shownFloorIndex=-2,this.boundingMesh.setMaterial(R),this.boundingMesh.needsRender=!1;var M=createEvent("render.prepare",{needsRender:!0,info:null});if(this.emit("render.prepare",M),!M.defaultPrevented){var S=[];sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix);for(var C=0,I=this.scene.children;C<I.length;C++){var P=I[C];P!==this.modelGroup&&(P!==this.boundingMesh&&P instanceof THREE__namespace.Object3D&&P.traverseVisible((function(t){if(t.setResolution&&t.setResolution(A.x,A.y),t.setTime&&t.setTime(e),t.mixer instanceof THREE__namespace.AnimationMixer){var n=clockForMixer.get(t.mixer);n||(n=new THREE__namespace.Clock,clockForMixer.set(t.mixer,n)),t.mixer.update(n.getDelta())}(t instanceof THREE__namespace.Mesh||t instanceof THREE__namespace.Line||t instanceof THREE__namespace.Points)&&(t instanceof THREE__namespace.ImmediateRenderObject||!t.frustumCulled||sharedFrustum.intersectsObject(t))&&S.push(t)})))}if(g.width*g.height>8388608?this.renderSwitch01=1^this.renderSwitch01:this.renderSwitch01=0,this.renderer&&!1===this.paused&&0===this.renderSwitch01){var B=void 0;if(!0!==this.onlyRenderIfNeeds)B=this.render();else{if(this.controller&&!0===this.controller.needsRender&&(this.controller.needsRender=!1,this.needsRender=!0),!0===this.camera.needsRender&&(this.camera.needsRender=!1,this.needsRender=!0),!0===this.models.needsRender&&(this.models.needsRender=!1,this.needsRender=!0),!0!==this.needsRender)for(var O=0,k=S;O<k.length;O++){var H=k[O],F=function(e){!0===e.needsRender?(e.needsRender=!1,o.needsRender=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(o.needsRender=!0)};F(H),H.traverseAncestors(F)}!1!==this.needsRender&&(B=this.render())}if(this.needsRender=!1,this.controller&&this.screenBuffers){var L=this.controller,D=this.screenBuffers;this.aroundScissor((function(){L.postProcessing(D,o.postProcessingType)}))}this.hasListener("render")&&this.emit("render",createEvent("render",{needsRender:void 0!==B,info:this.info}))}this.needsRender=!1}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)}},t.prototype.pause=function(){this.paused=!0,this.renderer&&this.renderer instanceof InternalWebGLRenderer&&this.renderer.clear(!0,!0,!0)},t.prototype.play=function(){this.needsRender=!0,this.paused=!1},t.prototype.moveToPano=function(e,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var i=this.controller,o=this.renderer;if(!i)return this.throwError(new Error("controller is not initialized.")),Promise.resolve();if(!o)return this.throwError(new Error("renderer is not initialized.")),Promise.resolve();var a=this.works.getResolvedObserver(e);if(!a)return this.throwError(new Error("pano ".concat(JSON.stringify(e)," not existed."))),Promise.resolve();var s={workCode:a.work.workCode,panoIndex:a.panoIndex};return"moveToPano"in i&&"function"==typeof i.moveToPano?i.moveToPano(s,n,r):a&&(this.pano=s,this.once("initAnimation.start",(function(e){n.moveStartCallback&&n.moveStartCallback(e.state)})),this.once("initAnimation.end",(function(e){n.moveEndCallback&&n.moveEndCallback(e.state)})),this.changeMode(t.Mode.Panorama,n,void 0,r)),this.ready()},t.prototype.preloadPano=function(e,t){var n=this;void 0===t&&(t=noop$1);var r=this.works.getResolvedObserver(e);if(!r)return Promise.reject(new Error("Pano ".concat(JSON.stringify(e)," never found")));r.work.allowHosts;var i=now();return Promise.all(["right","left","up","down","front","back"].map((function(e){var t=__assign({key:"pano.".concat(r.panoId,".").concat(e)},pick(n.imageOptions,["size","format","quality","mappings"])),i=r.images[e],o=n.imageOptions.transform?n.imageOptions.transform(i,t):imageURL(i,t);return getFetcher(r.work).preload(o)}))).then((function(){var e=now()-i;return t(e),e}))},t.prototype.project2d=function(e,t){if(void 0===t&&(t=!1),!this.renderer)return null;if(this.models.length>0&&t){var n=this.camera.position,r=e.clone().sub(n),i=new THREE__namespace.Raycaster(n,r.clone().normalize());i.params.Points={threshold:.1};var o=this.models.intersectRaycaster(i)[0];if(o&&o.distance+.01<r.length())return null}var a=e.clone().project(this.camera);if(Math.abs(a.z)>1)return null;var s=this.renderer.getSize(new THREE__namespace.Vector2),c=s.x*this.scissor.width,l=s.y*this.scissor.height,u=s.x*this.scissor.left+(a.x+1)/2*c,p=s.y*(1-this.scissor.bottom-this.scissor.height)+(1-a.y)/2*l;return new THREE__namespace.Vector2(u,p)},t.prototype.getRenderObjects=function(e){sharedProjScreenMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),sharedFrustum.setFromProjectionMatrix(sharedProjScreenMatrix),e||(e=this.scene);var t=[];return e.traverseVisible((function(e){(e instanceof THREE__namespace.Mesh||e instanceof THREE__namespace.Line||e instanceof THREE__namespace.Points)&&(e instanceof THREE__namespace.ImmediateRenderObject||!e.frustumCulled||sharedFrustum.intersectsObject(e))&&t.push(e)})),t},t.prototype.getCurrentState=function(){return __assign(__assign({},this.getPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})},t.prototype.setState=function(e,n,r){var i,o,a,s,c,l,u,p,d,h,f;void 0===n&&(n=!1),void 0===r&&(r=!0),!(e=Object.assign({},e)).offset||e instanceof THREE__namespace.Vector3||(e.offset=new THREE__namespace.Vector3(e.offset.x,e.offset.y,e.offset.z)),"number"==typeof e.panoIndex&&(f=e.workCode?{workCode:e.workCode,panoIndex:e.panoIndex}:{workCode:null!==(o=null===(i=this.work)||void 0===i?void 0:i.workCode)&&void 0!==o?o:"",panoIndex:e.panoIndex});var m,v,A,g,y,b=null!==(a=e.mode)&&void 0!==a?a:this.state.mode;if(e.mode!==t.Mode.Floorplan&&e.mode!==t.Mode.Topview&&e.mode!==t.Mode.Mapview&&e.mode!==t.Mode.Model||this.models.loaded){if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==b){if("VRPanorama"===b)return void this.changeMode("VRPanorama",void 0,void 0,!0);var E={workCode:null==f?void 0:f.workCode,panoIndex:null==f?void 0:f.panoIndex};"number"==typeof e.longitude&&(E.longitude=e.longitude),"number"==typeof e.latitude&&(E.latitude=e.latitude),"number"==typeof e.fov&&(E.fov=e.fov),"number"==typeof e.distance&&(E.distance=e.distance),e.offset instanceof THREE__namespace.Vector3&&(E.offset=e.offset);var _=__assign(__assign({initial:{state:E,currentState:this.getCurrentState(),duration:this.modeChangeDuration,userAction:!1}},this.commonParams()),this.controllerInits[b]),T=Controllers[b].initAnimationEndState(_);m=T.longitude,v=T.latitude,A=T.fov,g=T.offset,y=T.distance}else m=null!==(s=e.longitude)&&void 0!==s?s:this.state.longitude,v=null!==(c=e.latitude)&&void 0!==c?c:this.state.latitude,A=null!==(l=e.fov)&&void 0!==l?l:this.state.fov,g=null!==(u=e.offset)&&void 0!==u?u:this.state.offset,y=null!==(p=e.distance)&&void 0!==p?p:this.state.distance;var x={workCode:(null!=f?f:this.pano).workCode,panoIndex:(null!=f?f:this.pano).panoIndex,mode:b,longitude:m,latitude:v,fov:A,offset:g,distance:y};this.emit("state.set",createEvent("state.set",{userAction:r,state:x})),stateEqual(this.state,x)||(this.controller&&"VRPanorama"===x.mode&&x.mode!==this.state.mode?(assignState(this.state,x),this.changeMode("VRPanorama")):this.controller&&"XRPanorama"===x.mode&&x.mode!==this.state.mode?(assignState(this.state,x),this.changeMode("XRPanorama")):(assignState(this.state,x),this.controller&&r&&(this.controller.userAction=!1),n&&this.state.mode===x.mode&&(this.syncingState=this.syncState(now(),0,n),this.syncingState&&(null===(d=this.controller)||void 0===d||d.updateTime(now(),0),this.syncingState=!1)),this.emit("state.change",createEvent("state.change",{userAction:r,state:this.state})),null===(h=this.analysis)||void 0===h||h.state(this.works,this.state)))}else this.throwError(new Error("model is not ready."))},t.prototype.aroundScissor=function(e){if(this.renderer)if("XRPanorama"!==this.state.mode){var t=new THREE__namespace.Vector2,n=0!==this.scissor.left||0!==this.scissor.bottom||1!==this.scissor.width||1!==this.scissor.height;if(n){this.renderer.getSize(t);var r=Math.floor(t.x*this.scissor.left),i=Math.floor(t.y*this.scissor.bottom),o=Math.floor(t.x*this.scissor.width),a=Math.floor(t.y*this.scissor.height);this.renderer.setViewport(r,i,o,a),this.renderer.setScissor(r,i,o,a),this.renderer.setScissorTest(!0)}e(),n&&(this.renderer.setViewport(0,0,t.x,t.y),this.renderer.setScissor(0,0,t.x,t.y),this.renderer.setScissorTest(!1))}else e()},t.prototype.syncState=function(e,n,r){void 0===r&&(r=!1);var i=this.stateSynced;if(this.stateSynced=!1,0===this.works.length)return!1;if(!this.controller)return!1;if(this.state.mode!==this.currentMode){var o={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,o,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof Controllers.Model){if(notSimilarVector3(this.camera.pose.offset,this.state.offset)){var a={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,__assign(__assign({},a),{duration:r?0:void 0}),!1),!0}}else{var s={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!panoEqual(s,this.pano)&&"moveToPano"in this.controller&&"function"==typeof this.controller.moveToPano){a={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(s,a,!1),!0}}if(this.controller instanceof Controllers.Floorplan||this.controller instanceof Controllers.Topview||this.controller instanceof Controllers.Mapview){var c=Math.PI/45,l=r?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,1),u=Math.abs(this.camera.pose.distance-this.state.distance),p=u>3?u/15:.2,d=r?this.state.distance:stepNumber(this.camera.pose.distance,this.state.distance,p),h=this.camera.pose.offset.distanceTo(this.state.offset),f=h>3?h/15:.2,m=r?(new THREE__namespace.Vector3).copy(this.state.offset):stepVector(this.camera.pose.offset,this.state.offset,f),v=r?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},c),A=v.longitude,g=v.latitude;if(notSimilarValue(l,this.camera.pose.fov)||notSimilarVector3(m,this.camera.pose.offset)||notSimilarValue(d,this.camera.pose.distance)||notSimilarValue(A,this.camera.pose.longitude,2*Math.PI)||notSimilarValue(g,this.camera.pose.latitude)){var y={x:m.x,y:m.y,z:m.z},b={fov:l};return Object.assign(y,{distance:d}),Object.assign(b,{longitude:A,latitude:g}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(b,0).catch(noop$1),this.controller.locationMotion.set(y,0).catch(noop$1),!0}}else{var E=Math.PI/45,_=(l=r?this.state.fov:stepNumber(this.camera.pose.fov,this.state.fov,1),r?{longitude:this.state.longitude,latitude:this.state.latitude}:stepCoordinates({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},E));A=_.longitude,g=_.latitude;if(notSimilarValue(A,this.camera.pose.longitude,2*Math.PI)||notSimilarValue(g,this.camera.pose.latitude)||notSimilarValue(l,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:A,latitude:g,fov:l},0).catch(noop$1),!0}if(this.stateSynced=!0,!1===i&&this.emit("state.synced",createEvent("state.synced",{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){var T=this.currentMode;if(!(T===t.Mode.Floorplan||T===t.Mode.Topview||T===t.Mode.Mapview||T===t.Mode.Model)||this.models.loaded){var x=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(var R=0,w=x;R<w.length;R++){var M=w[R];this.controller instanceof Controllers.Panorama?!0!==M.tile||this.controller.isTileReady()?M():this.readyCallbacks.push(M):M()}}}return!1},t.prototype.ready=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(n){var r;t.readyCallbacks.push(Object.assign(n,{tile:null!==(r=e.tile)&&void 0!==r&&r}))}))},t.prototype.requestFullscreen=function(){var e;if(isMobile()){var t=null===(e=this.getElement())||void 0===e?void 0:e.parentNode;t&&"requestFullscreen"in t&&"undefined"!=typeof document&&null===document.fullscreenElement&&t.requestFullscreen()}},t.prototype.exitFullscreen=function(){"undefined"!=typeof document&&document.fullscreenElement&&"exitFullscreen"in document&&document.exitFullscreen()},t.prototype.throwError=function(e){this.hasListener("error")?this.emit("error",e):console.error(e)},t.prototype.loadModel=function(e){for(var t=this,n=[],r=function(e){var r=i.models.filter((function(t){var n;return(null===(n=t.work)||void 0===n?void 0:n.workCode)===e.workCode}))[0];if(r)r.work=e,n.push(r);else{var o=new Model({coordinatesSystemTransformers:i.coordinatesSystemTransformers,onError:function(n){t.emit("model.error",createEvent("model.request",{work:e,model:o,error:n}))},onShownFloorChange:function(n){t.emit("model.changeShownFloor",createEvent("model.request",{work:e,model:o,error:null}))},onLoad:function(){t.emit("model.load",createEvent("model.request",{work:e,model:o,error:null}))}});n.push(o),i.emit("model.request",createEvent("model.request",{work:e,model:o,error:null})),o.load(e,{textureOptions:i.textureOptions})}},i=this,o=0,a=e;o<a.length;o++){r(a[o])}if(this.models.length>0){for(var s=0,c=this.models;s<c.length;s++){var l=c[s];-1===n.indexOf(l)&&this.lastModels.push(l)}this.models.length=0}for(var u=0,p=n;u<p.length;u++){l=p[u];this.models.push(l)}return this.renderer&&(this.models.loaded=!1),new Promise((function(e){t.on("models.load",(function(){e()}))}))},t.prototype.commonParams=function(){return{ident:this.ident,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,boundingMesh:this.boundingMesh,camera:this.camera,renderer:this.renderer,scissor:this.scissor,element:this.getElement(),models:this.models,works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,enableIOSEDR:this._enableIOSEDR,enableEDL:this.enableEDL,enableHQ:this.enableHQ,extraElements:this.extraElements,videoTexture:this.videoTexture}},t.prototype.applyController=function(e,n){var r=this;if(!this.renderer)throw new Error("renderer is not initialized.");e!==t.Mode.Mapview&&(this.enableEDL=!1,this.enableHQ=!1);var i=Controllers[e];if(e!==this.currentMode)for(var o=0,a=this.models;o<a.length;o++){a[o].show()}this.currentMode=e;for(var s=new i(n),c=function(e){s.on(e,(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(r.emit.apply(r,__spreadArray([e],t,!1)))return!1}))},l=0,u=PROXY_CONTROLLER_EVENT_NAMES;l<u.length;l++){c(u[l])}var p=Controllers[e].initAnimationEndState(n),d=n.initial.userAction;return stateEqual(this.state,p)||(assignState(this.state,p),this.emit("state.change",createEvent("state.change",{userAction:d,state:this.state}))),this.emit("currentState.change",createEvent("currentState.change",{userAction:d,state:this.getCurrentState()})),s.on("camera.update",(function(e){var t;if(r.controller){var n=r.controller.getTargetState();e.userAction&&!1===r.syncingState&&r.state.mode===n.mode&&!stateEqual(r.state,n)&&(assignState(r.state,n),r.emit("state.change",createEvent("state.change",{userAction:e.userAction,state:r.state})),null===(t=r.analysis)||void 0===t||t.state(r.works,r.state))}r.emit("currentState.change",createEvent("currentState.change",{userAction:e.userAction,state:r.getCurrentState()}))})),s.on("initAnimation.start",(function(e){var t,n=e.state,i=e.userAction;i&&r.state.mode===n.mode&&!stateEqual(r.state,n)&&(assignState(r.state,n),r.emit("state.change",createEvent("state.change",{userAction:i,state:r.state})),null===(t=r.analysis)||void 0===t||t.state(r.works,r.state))})),s.on("initAnimation.end",(function(e){var t,n=e.state,i=e.userAction;i&&r.state.mode===n.mode&&!stateEqual(r.state,n)&&(assignState(r.state,n),r.emit("state.change",createEvent("state.change",{userAction:i,state:r.state})),null===(t=r.analysis)||void 0===t||t.state(r.works,r.state))})),s.on("pano.moveTo",(function(e){var t,n=e.state,i=e.userAction;r.pano={workCode:n.workCode,panoIndex:n.panoIndex},i&&r.state.mode===n.mode&&!stateEqual(r.state,n)&&(assignState(r.state,n),r.emit("state.change",createEvent("state.change",{userAction:i,state:r.state})),null===(t=r.analysis)||void 0===t||t.state(r.works,r.state))})),s.on("pano.arrived",(function(e){var t,n=e.state,i=e.userAction;i&&r.state.mode===n.mode&&!stateEqual(r.state,n)&&(assignState(r.state,n),r.emit("state.change",createEvent("state.change",{userAction:i,state:r.state})),null===(t=r.analysis)||void 0===t||t.state(r.works,r.state))})),s.on("pano.moveTo",(function(e){var t=e.userAction;r.emit("currentState.change",createEvent("currentState.change",{userAction:t,state:r.getCurrentState()}))})),s.on("pano.request",(function(e){r.emit("pano.request",e),e.defaultPrevented||r.moveToPano(e.state,e.options,e.userAction)})),s.on("vr.requestExit",(function(){r.currentMode===t.Mode.VRPanorama&&(r.exitFullscreen(),r.changeMode(t.Mode.Panorama))})),s.on("error",(function(e){return r.throwError(e)})),s},t.prototype.removeEventListeners=function(){},t.Mode={Panorama:"Panorama",Model:"Model",Floorplan:"Floorplan",Topview:"Topview",Mapview:"Mapview",DepthPanorama:"DepthPanorama",VRPanorama:"VRPanorama",XRPanorama:"XRPanorama"},t.Line=null,t}(Subscribe),__FIVE_DEBUG__={instances:{},constructor:Five};"undefined"!=typeof window&&Object.assign(window,{__FIVE_DEBUG__:__FIVE_DEBUG__});var XRButton=function(){function e(){}return e.createButton=function(e){var t=document.createElement("button");function n(){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,t.textContent="VR NOT SUPPORTED"}function r(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",r(t),navigator.xr.isSessionSupported("immersive-vr").then((function(r){r?(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()}):n()})),t;var i=document.createElement("a");return!1===window.isSecureContext?(i.href=document.location.href.replace(/^http:/,"https:"),i.innerHTML="WEBXR NEEDS HTTPS"):(i.href="https://immersiveweb.dev/",i.innerHTML="WEBXR NOT AVAILABLE"),i.style.left="calc(50% - 90px)",i.style.width="180px",i.style.textDecoration="none",r(i),i},e}();exports.AnimationFrameLoop=AnimationFrameLoop,exports.Camera=Camera,exports.Fetcher=Fetcher,exports.Five=Five,exports.InternalWebGLRenderer=InternalWebGLRenderer,exports.IntersectMesh=IntersectMesh,exports.Model=Model,exports.NetworkSubscribe=NetworkSubscribe,exports.PBMContainer=PBMContainer,exports.PBMGroup=PBMGroup,exports.PBMMesh=PBMMesh,exports.PBMMeshMaterial=PBMMeshMaterial,exports.PROXY_CONTROLLER_EVENT_NAMES=PROXY_CONTROLLER_EVENT_NAMES,exports.PanoCircleMesh=PanoCircleMesh,exports.PanoCircleMeshCustom=PanoCircleMeshCustom,exports.PanoCircleMeshSolid=PanoCircleMeshSolid,exports.RequestScheduler=RequestScheduler,exports.Scene=Scene,exports.Subscribe=Subscribe,exports.TextureLoader=TextureLoader,exports.Tile=Tile,exports.Tile3DModel=Tile3DModel,exports.TileCubeTextureTarget=TileCubeTextureTarget,exports.TileNode=TileNode,exports.Tileset=Tileset,exports.TilesetCache=TilesetCache,exports.TilesetTraverser=TilesetTraverser,exports.Work=Work,exports.XRButton=XRButton,exports.defaultImageURLTransform=imageURL,exports.defaultPbmParameters=defaultPbmParameters,exports.getViewportScale=getViewportScale,exports.imageSupport=imageSupport,exports.isPanoId=isPanoId,exports.loadAt3d=loadAt3d,exports.loadB3dm=loadB3dm,exports.loadDome=loadDome,exports.loadDomez=loadDomez,exports.loadPbm=loadPbm,exports.loadPnts=loadPnts,exports.panoEqual=panoEqual,exports.panoParse=panoParse,exports.panoStringify=panoStringify,exports.parseWork=parseWork,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));
|