@realsee/five-webgpu 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS_READ_ME.md +9 -0
- package/AI_CONTEXT.md +9 -0
- package/README.md +80 -0
- package/TERMS.txt +54 -0
- package/ai_guides/README.md +118 -0
- package/ai_guides/ai-doc-guidelines.md +102 -0
- package/ai_guides/api.md +274 -0
- package/ai_guides/features/3dtile.md +172 -0
- package/ai_guides/features/camera-animation.md +205 -0
- package/ai_guides/features/clipper.md +135 -0
- package/ai_guides/features/coordinate-system.md +128 -0
- package/ai_guides/features/event.md +154 -0
- package/ai_guides/features/five.md +184 -0
- package/ai_guides/features/gesture.md +181 -0
- package/ai_guides/features/get-screen-pixels.md +182 -0
- package/ai_guides/features/image-options.md +164 -0
- package/ai_guides/features/load-external-model.md +350 -0
- package/ai_guides/features/load-progress.md +140 -0
- package/ai_guides/features/material.md +153 -0
- package/ai_guides/features/mode.md +269 -0
- package/ai_guides/features/model.md +186 -0
- package/ai_guides/features/move-pano-effect.md +145 -0
- package/ai_guides/features/multi-work.md +146 -0
- package/ai_guides/features/pano-filter.md +144 -0
- package/ai_guides/features/pano-tile.md +132 -0
- package/ai_guides/features/pano-uv.md +131 -0
- package/ai_guides/features/parameter.md +153 -0
- package/ai_guides/features/raycast.md +175 -0
- package/ai_guides/features/request-proxy.md +112 -0
- package/ai_guides/features/screen-project.md +165 -0
- package/ai_guides/features/state.md +101 -0
- package/ai_guides/features/ultra-hdr.md +204 -0
- package/ai_guides/features/view-layer.md +187 -0
- package/ai_guides/features/work.md +303 -0
- package/ai_guides/glossary.md +93 -0
- package/ai_guides/intro.md +23 -0
- package/ai_guides/quick-start.md +69 -0
- package/ai_guides/release_notes/6.6.md +86 -0
- package/ai_guides/release_notes/6.7.md +401 -0
- package/ai_guides/release_notes/6.8.md +208 -0
- package/ai_guides/support.md +23 -0
- package/ai_guides/template.md +70 -0
- package/docs/.nojekyll +1 -0
- package/docs/00_FOR_AI_AGENTS.md +12 -0
- package/docs/README.md +12 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +134 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/index.AdaptiveLuminancePass.html +23 -0
- package/docs/classes/index.AnimationFrameLoop.html +18 -0
- package/docs/classes/index.BoundingMesh.html +4 -0
- package/docs/classes/index.Camera.html +42 -0
- package/docs/classes/index.EffectComposer.html +25 -0
- package/docs/classes/index.EyeDomeLightingPass.html +20 -0
- package/docs/classes/index.Fetcher.html +5 -0
- package/docs/classes/index.Five.html +311 -0
- package/docs/classes/index.FivePass.html +17 -0
- package/docs/classes/index.FiveRenderer.html +8 -0
- package/docs/classes/index.FlowingFireworks3DPass.html +22 -0
- package/docs/classes/index.FlowingLight2DPass.html +21 -0
- package/docs/classes/index.FlowingLight3DPass.html +23 -0
- package/docs/classes/index.FullScreenQuad.html +7 -0
- package/docs/classes/index.GaussianBlurPass.html +19 -0
- package/docs/classes/index.Histogram.html +19 -0
- package/docs/classes/index.InternalWebGPURenderer.html +4 -0
- package/docs/classes/index.Model.html +93 -0
- package/docs/classes/index.ModelScene.html +40 -0
- package/docs/classes/index.Motion.html +17 -0
- package/docs/classes/index.NetworkSubscribe.html +41 -0
- package/docs/classes/index.PBMGaussianSplattingNodeMaterial.html +37 -0
- package/docs/classes/index.PBMGaussianSplattingObject.html +32 -0
- package/docs/classes/index.PBMGaussianSplattingRenderMesh.html +19 -0
- package/docs/classes/index.PBMGroup.html +5 -0
- package/docs/classes/index.PBMMesh.html +2 -0
- package/docs/classes/index.PBMMeshBasicMaterial.html +70 -0
- package/docs/classes/index.PBMMeshBasicNodeMaterial.html +74 -0
- package/docs/classes/index.PBMMeshPanoOnlyMaterial.html +70 -0
- package/docs/classes/index.PBMMeshPanoOnlyNodeMaterial.html +74 -0
- package/docs/classes/index.PBMMeshPhongMaterial.html +69 -0
- package/docs/classes/index.PBMMeshPhongNodeMaterial.html +73 -0
- package/docs/classes/index.PBMMeshPhysicalMaterial.html +69 -0
- package/docs/classes/index.PBMMeshPhysicalNodeMaterial.html +73 -0
- package/docs/classes/index.PBMPanoFilter.html +61 -0
- package/docs/classes/index.PBMPointCloud.html +50 -0
- package/docs/classes/index.PBMSkinnedMesh.html +8 -0
- package/docs/classes/index.PBMUpdateable.html +41 -0
- package/docs/classes/index.PanoCircleMesh.html +30 -0
- package/docs/classes/index.PanoCircleMeshCustom.html +30 -0
- package/docs/classes/index.PanoCircleMeshSolid.html +30 -0
- package/docs/classes/index.Parameter.html +114 -0
- package/docs/classes/index.Scene.html +18 -0
- package/docs/classes/index.Subscribe.html +43 -0
- package/docs/classes/index.TextureLoader.html +4 -0
- package/docs/classes/index.Tile.html +34 -0
- package/docs/classes/index.Tile3D.html +98 -0
- package/docs/classes/index.TileCache.html +8 -0
- package/docs/classes/index.TileNode.html +14 -0
- package/docs/classes/index.TileRequestScheduler.html +4 -0
- package/docs/classes/index.Tileset.html +38 -0
- package/docs/classes/index.Trajectory.html +8 -0
- package/docs/classes/index.TrajectoryNode.html +8 -0
- package/docs/classes/index.Work.html +52 -0
- package/docs/classes/index.WorkResolvedObserver.html +68 -0
- package/docs/documents/README.html +134 -0
- package/docs/documents/ai-doc-guidelines.html +117 -0
- package/docs/documents/api.html +337 -0
- package/docs/documents/features_3dtile.html +216 -0
- package/docs/documents/features_camera-animation.html +157 -0
- package/docs/documents/features_clipper.html +80 -0
- package/docs/documents/features_coordinate-system.html +127 -0
- package/docs/documents/features_event.html +104 -0
- package/docs/documents/features_five.html +147 -0
- package/docs/documents/features_gesture.html +121 -0
- package/docs/documents/features_get-screen-pixels.html +88 -0
- package/docs/documents/features_image-options.html +108 -0
- package/docs/documents/features_load-external-model.html +600 -0
- package/docs/documents/features_load-progress.html +110 -0
- package/docs/documents/features_material.html +341 -0
- package/docs/documents/features_mode.html +114 -0
- package/docs/documents/features_model.html +141 -0
- package/docs/documents/features_move-pano-effect.html +110 -0
- package/docs/documents/features_multi-work.html +97 -0
- package/docs/documents/features_pano-filter.html +119 -0
- package/docs/documents/features_pano-tile.html +100 -0
- package/docs/documents/features_pano-uv.html +82 -0
- package/docs/documents/features_parameter.html +101 -0
- package/docs/documents/features_raycast.html +98 -0
- package/docs/documents/features_request-proxy.html +78 -0
- package/docs/documents/features_screen-project.html +112 -0
- package/docs/documents/features_state.html +71 -0
- package/docs/documents/features_ultra-hdr.html +188 -0
- package/docs/documents/features_view-layer.html +158 -0
- package/docs/documents/features_work.html +129 -0
- package/docs/documents/glossary.html +94 -0
- package/docs/documents/intro.html +24 -0
- package/docs/documents/quick-start.html +32 -0
- package/docs/documents/release_notes_6.6.html +79 -0
- package/docs/documents/release_notes_6.7.html +209 -0
- package/docs/documents/release_notes_6.8.html +189 -0
- package/docs/documents/support.html +49 -0
- package/docs/documents/template.html +80 -0
- package/docs/enums/index.VolumePlaneIntersect.html +4 -0
- package/docs/functions/index.coordinatesToVector.html +2 -0
- package/docs/functions/index.createDebugBoundingMesh.html +1 -0
- package/docs/functions/index.createWorks.html +1 -0
- package/docs/functions/index.defaultImageURLTransform.html +5 -0
- package/docs/functions/index.getViewportScale.html +1 -0
- package/docs/functions/index.headingToLongitude.html +4 -0
- package/docs/functions/index.imageSupport.html +1 -0
- package/docs/functions/index.isBoundingVolume.html +1 -0
- package/docs/functions/index.isPanoId.html +1 -0
- package/docs/functions/index.loadAt3d.html +1 -0
- package/docs/functions/index.loadDome.html +1 -0
- package/docs/functions/index.loadDomez.html +1 -0
- package/docs/functions/index.loadGltf.html +1 -0
- package/docs/functions/index.loadPbm.html +1 -0
- package/docs/functions/index.loadPly.html +1 -0
- package/docs/functions/index.longitudeToHeading.html +4 -0
- package/docs/functions/index.makeBoundingVolume.html +1 -0
- package/docs/functions/index.panoEqual.html +1 -0
- package/docs/functions/index.panoParse.html +1 -0
- package/docs/functions/index.panoStringify.html +1 -0
- package/docs/functions/index.parseWork.html +7 -0
- package/docs/functions/index.registerPBMMaterials.html +3 -0
- package/docs/functions/index.vectorToCoordinates.html +2 -0
- package/docs/functions/index.workToJson.html +1 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +134 -0
- package/docs/interfaces/index.AddableObject.html +9 -0
- package/docs/interfaces/index.AjaxOptions.html +9 -0
- package/docs/interfaces/index.AnimationFrame.html +6 -0
- package/docs/interfaces/index.AnimationFrameContext.html +3 -0
- package/docs/interfaces/index.BaseEvent.html +5 -0
- package/docs/interfaces/index.BoundingVolume.html +15 -0
- package/docs/interfaces/index.BoxBoundingVolume.html +18 -0
- package/docs/interfaces/index.CameraPose.html +6 -0
- package/docs/interfaces/index.CullingVolume.html +9 -0
- package/docs/interfaces/index.Draco.html +12 -0
- package/docs/interfaces/index.EventCallback.html +394 -0
- package/docs/interfaces/index.FiveInitArgs.html +104 -0
- package/docs/interfaces/index.FiveLoadOptions.html +12 -0
- package/docs/interfaces/index.FloorplanControllerCustomInitArgs.html +17 -0
- package/docs/interfaces/index.GestureEvent.html +19 -0
- package/docs/interfaces/index.IPBMMaterial.html +64 -0
- package/docs/interfaces/index.ImageOptions.html +21 -0
- package/docs/interfaces/index.ImageURLMappings.html +1 -0
- package/docs/interfaces/index.ImageURLOptions.html +17 -0
- package/docs/interfaces/index.IntersectEvent.html +8 -0
- package/docs/interfaces/index.IntersectMesh.html +2 -0
- package/docs/interfaces/index.IntersectMeshInterface.html +3 -0
- package/docs/interfaces/index.Intersection.html +9 -0
- package/docs/interfaces/index.LoosePanoWork.html +10 -0
- package/docs/interfaces/index.LooseWork.html +15 -0
- package/docs/interfaces/index.LooseWorkInitial.html +11 -0
- package/docs/interfaces/index.LooseWorkModel.html +8 -0
- package/docs/interfaces/index.LooseWorkObserver.html +17 -0
- package/docs/interfaces/index.LooseWorkPanorama.html +22 -0
- package/docs/interfaces/index.LooseWorkVideo.html +4 -0
- package/docs/interfaces/index.LooseWorkWithExtrinsics.html +15 -0
- package/docs/interfaces/index.MapviewControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/index.ModeChangeEvent.html +9 -0
- package/docs/interfaces/index.ModelControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/index.ModelEvent.html +8 -0
- package/docs/interfaces/index.ModelOptions.html +11 -0
- package/docs/interfaces/index.ModelSceneEvent.html +6 -0
- package/docs/interfaces/index.ModelTileEvent.html +8 -0
- package/docs/interfaces/index.MotionKeyframe.html +4 -0
- package/docs/interfaces/index.MovePanoOptions.html +35 -0
- package/docs/interfaces/index.NetworkAbortError.html +1 -0
- package/docs/interfaces/index.NetworkFirbiddenError.html +1 -0
- package/docs/interfaces/index.NetworkOptions.html +7 -0
- package/docs/interfaces/index.NetworkProxyError.html +1 -0
- package/docs/interfaces/index.NetworkResourceEvent.html +9 -0
- package/docs/interfaces/index.NetworkResponseError.html +2 -0
- package/docs/interfaces/index.NetworkTimeoutError.html +1 -0
- package/docs/interfaces/index.ObjectEvent.html +6 -0
- package/docs/interfaces/index.PBMClipperParameter.html +3 -0
- package/docs/interfaces/index.PBMHDRConfig.html +12 -0
- package/docs/interfaces/index.PBMPanoDepth.html +9 -0
- package/docs/interfaces/index.PBMPanoFilterValue.html +6 -0
- package/docs/interfaces/index.PBMPanoPicture.html +14 -0
- package/docs/interfaces/index.PBMRefinedScreen.html +6 -0
- package/docs/interfaces/index.PanoCircleMeshCustomOptions.html +9 -0
- package/docs/interfaces/index.PanoCircleMeshInterface.html +30 -0
- package/docs/interfaces/index.PanoCircleMeshOptions.html +3 -0
- package/docs/interfaces/index.PanoCircleMeshSolidOptions.html +3 -0
- package/docs/interfaces/index.PanoEvent.html +11 -0
- package/docs/interfaces/index.PanoTextureEvent.html +9 -0
- package/docs/interfaces/index.PanoramaControllerCustomInitArgs.html +41 -0
- package/docs/interfaces/index.PanoramaLikeControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/index.ParameterMaterialValue.html +74 -0
- package/docs/interfaces/index.ParameterTilesetValue.html +30 -0
- package/docs/interfaces/index.ParameterValue.html +103 -0
- package/docs/interfaces/index.Pass.html +9 -0
- package/docs/interfaces/index.PointCloudData.html +6 -0
- package/docs/interfaces/index.Pose.html +12 -0
- package/docs/interfaces/index.RegionBoundingVolume.html +21 -0
- package/docs/interfaces/index.RenderEvent.html +6 -0
- package/docs/interfaces/index.ResolvedParameterValue.html +104 -0
- package/docs/interfaces/index.RgbaData.html +7 -0
- package/docs/interfaces/index.SphereBoundingVolume.html +17 -0
- package/docs/interfaces/index.SplatData.html +10 -0
- package/docs/interfaces/index.State.html +23 -0
- package/docs/interfaces/index.StateEvent.html +7 -0
- package/docs/interfaces/index.TextureOptions.html +23 -0
- package/docs/interfaces/index.Tile3DOptions.html +11 -0
- package/docs/interfaces/index.TileCoordinateSystem.html +3 -0
- package/docs/interfaces/index.TileHeader.html +9 -0
- package/docs/interfaces/index.TilesetHeader.html +20 -0
- package/docs/interfaces/index.TilesetOptions.html +7 -0
- package/docs/interfaces/index.TopviewControllerCustomInitArgs.html +13 -0
- package/docs/interfaces/index.TrajectoryHeader.html +5 -0
- package/docs/interfaces/index.ViewLayer.html +97 -0
- package/docs/interfaces/index.Viewport.html +13 -0
- package/docs/interfaces/index.WebXRAxesParams.html +4 -0
- package/docs/interfaces/index.WebXRControllerParams.html +2 -0
- package/docs/interfaces/index.WorkCubeImage.html +15 -0
- package/docs/interfaces/index.WorkImage.html +22 -0
- package/docs/interfaces/index.WorkInitial.html +17 -0
- package/docs/interfaces/index.WorkInitialJson.html +8 -0
- package/docs/interfaces/index.WorkJson.html +11 -0
- package/docs/interfaces/index.WorkModel.html +16 -0
- package/docs/interfaces/index.WorkModelJson.html +6 -0
- package/docs/interfaces/index.WorkModelLayer.html +11 -0
- package/docs/interfaces/index.WorkModelLayerJson.html +5 -0
- package/docs/interfaces/index.WorkObserver.html +63 -0
- package/docs/interfaces/index.WorkObserverJson.html +10 -0
- package/docs/interfaces/index.WorkPanoramaJson.html +14 -0
- package/docs/interfaces/index.WorkPanoramasJson.html +3 -0
- package/docs/interfaces/index.WorkTile.html +21 -0
- package/docs/interfaces/index.WorkVideo.html +9 -0
- package/docs/interfaces/index.WorksEvent.html +8 -0
- package/docs/interfaces/index.XRControllerEvent.html +8 -0
- package/docs/interfaces/index.XRGestureEvent.html +11 -0
- package/docs/interfaces/index.XRSessionEvent.html +7 -0
- package/docs/modules/index.html +1 -0
- package/docs/modules.html +1 -0
- package/docs/types/index.AjaxResponseType.html +1 -0
- package/docs/types/index.AjaxResponseTypeMapping.html +1 -0
- package/docs/types/index.AnimationFrameLoopType.html +1 -0
- package/docs/types/index.BoundingVolumeJson.html +1 -0
- package/docs/types/index.BoxBoundingVolumeJson.html +2 -0
- package/docs/types/index.ControllerCustomInitTypes.html +6 -0
- package/docs/types/index.ControllerEventTypes.html +68 -0
- package/docs/types/index.CubeFace.html +1 -0
- package/docs/types/index.EasingFunction.html +1 -0
- package/docs/types/index.EventTypes.html +28 -0
- package/docs/types/index.FivePlugin.html +4 -0
- package/docs/types/index.FivePluginInit.html +3 -0
- package/docs/types/index.FivePluginInstance.html +3 -0
- package/docs/types/index.FlowingFireworks3DPassLine.html +16 -0
- package/docs/types/index.FlowingLight2DPassLine.html +10 -0
- package/docs/types/index.FlowingLight3DPassLine.html +10 -0
- package/docs/types/index.GestureTypes.html +1 -0
- package/docs/types/index.LegacyEventType.html +282 -0
- package/docs/types/index.LoadResultType.html +12 -0
- package/docs/types/index.Mode.html +15 -0
- package/docs/types/index.Models.html +11 -0
- package/docs/types/index.MotionCircle.html +2 -0
- package/docs/types/index.MotionConfig.html +1 -0
- package/docs/types/index.MotionInitalValue.html +1 -0
- package/docs/types/index.MotionValue.html +1 -0
- package/docs/types/index.MovePanoEffect.html +12 -0
- package/docs/types/index.NetWorkMeta.html +8 -0
- package/docs/types/index.NetworkError.html +1 -0
- package/docs/types/index.NetworkErrorCallback.html +1 -0
- package/docs/types/index.NetworkProgressCallback.html +1 -0
- package/docs/types/index.NetworkResponse.html +3 -0
- package/docs/types/index.NetworkState.html +1 -0
- package/docs/types/index.NetworkSuccessCallback.html +1 -0
- package/docs/types/index.NetworkType.html +1 -0
- package/docs/types/index.OutputTextureDataType.html +1 -0
- package/docs/types/index.PBMAlphaMode.html +1 -0
- package/docs/types/index.PBMColorStyle.html +1 -0
- package/docs/types/index.PBMFloorStyle.html +1 -0
- package/docs/types/index.PBMMeshMaterial.html +1 -0
- package/docs/types/index.PBMPointBack.html +1 -0
- package/docs/types/index.PBMPointCloudShaderType.html +1 -0
- package/docs/types/index.PBMPointShape.html +1 -0
- package/docs/types/index.PBMPointSize.html +1 -0
- package/docs/types/index.PBMTransition.html +1 -0
- package/docs/types/index.Pano.html +3 -0
- package/docs/types/index.PanoId.html +1 -0
- package/docs/types/index.ParseOptions.html +13 -0
- package/docs/types/index.PostProcessingType.html +1 -0
- package/docs/types/index.RegionBoundingVolumeJson.html +2 -0
- package/docs/types/index.RequestAnimationFrameArgs.html +1 -0
- package/docs/types/index.Scissor.html +2 -0
- package/docs/types/index.SphereBoundingVolumeJson.html +2 -0
- package/docs/types/index.SubscribeEventMap.html +1 -0
- package/docs/types/index.TileCacheOptions.html +3 -0
- package/docs/types/index.TileContentData.html +6 -0
- package/docs/types/index.TileRequestOrder.html +1 -0
- package/docs/types/index.TileRequestSchedulerOptions.html +4 -0
- package/docs/types/index.TilesetFrameState.html +21 -0
- package/docs/types/index.TrajectoryContentData.html +7 -0
- package/docs/types/index.WebXRControllerKey.html +1 -0
- package/docs/types/index.WebXRControllerType.html +1 -0
- package/docs/types/index.Works.html +1 -0
- package/docs/variables/index.PROXY_CONTROLLER_EVENT_NAMES.html +1 -0
- package/docs/variables/index.controllersDefaultInitArgs.html +1 -0
- package/docs/variables/index.draco.html +1 -0
- package/five/application/analysis.d.ts +40 -0
- package/five/application/controllers.d.ts +33 -0
- package/five/application/events-legacy.d.ts +454 -0
- package/five/application/events.d.ts +69 -0
- package/five/application/five.d.ts +498 -0
- package/five/application/fiveInitArgs.d.ts +173 -0
- package/five/application/fiveLoadOptions.d.ts +21 -0
- package/five/application/generateDefaultVideoElement.d.ts +2 -0
- package/five/application/getViewportScale.d.ts +2 -0
- package/five/application/initLights.d.ts +3 -0
- package/five/application/mode.d.ts +24 -0
- package/five/application/renderPoweredByRealsee.d.ts +3 -0
- package/five/assets/cardboard-png-data-url.d.ts +2 -0
- package/five/assets/gradient-png-data-url.d.ts +2 -0
- package/five/assets/loading-png-data-url.d.ts +2 -0
- package/five/assets/phone-png-data-url.d.ts +2 -0
- package/five/assets/realsee-pmg-data-url.d.ts +2 -0
- package/five/bvh/bvhMath.d.ts +33 -0
- package/five/bvh/bvhMesh.d.ts +7 -0
- package/five/bvh/bvhNode.d.ts +29 -0
- package/five/bvh/bvhObject.d.ts +19 -0
- package/five/bvh/bvhPoints.d.ts +6 -0
- package/five/bvh/index.d.ts +14 -0
- package/five/bvh/type.d.ts +1 -0
- package/five/bvh/worker.d.ts +36 -0
- package/five/certificates/hardware.d.ts +1 -0
- package/five/controllers/base.d.ts +166 -0
- package/five/controllers/events.d.ts +71 -0
- package/five/controllers/floorplan.d.ts +119 -0
- package/five/controllers/mapview.d.ts +138 -0
- package/five/controllers/model.d.ts +57 -0
- package/five/controllers/panorama.d.ts +143 -0
- package/five/controllers/panoramaLike.d.ts +87 -0
- package/five/controllers/topview.d.ts +42 -0
- package/five/core/camera.d.ts +65 -0
- package/five/core/internalWebGPURenderer.d.ts +13 -0
- package/five/core/panoVideo.d.ts +18 -0
- package/five/core/scene.d.ts +10 -0
- package/five/core/tiling.d.ts +56 -0
- package/five/declare.d.ts +35 -0
- package/five/gaussian-splatting/util/renderData.d.ts +66 -0
- package/five/gaussian-splatting/wasm/data.d.ts +20 -0
- package/five/gaussian-splatting/wasm/sort.d.ts +18 -0
- package/five/gaussian-splatting/worker/dataWorker.d.ts +1 -0
- package/five/gaussian-splatting/worker/sortWorker.d.ts +1 -0
- package/five/index.d.ts +58 -0
- package/five/index.js +1179 -0
- package/five/index.mjs +25111 -0
- package/five/meshes/boundingMesh.d.ts +12 -0
- package/five/meshes/intersectMesh.d.ts +8 -0
- package/five/meshes/panoCircleMesh.d.ts +36 -0
- package/five/meshes/panoCircleMeshCustom.d.ts +40 -0
- package/five/meshes/panoCircleMeshSolid.d.ts +35 -0
- package/five/meshes/panoSphereMesh.d.ts +29 -0
- package/five/model/helpers/coordinate-transform.d.ts +3 -0
- package/five/model/helpers/ellipsoid-coordinates.d.ts +14 -0
- package/five/model/helpers/get-edges-by-sphere.d.ts +8 -0
- package/five/model/helpers/get-recommend-tile3d-parameters.d.ts +8 -0
- package/five/model/index.d.ts +55 -0
- package/five/model/intersection.d.ts +18 -0
- package/five/model/loaders/at3d.d.ts +12 -0
- package/five/model/loaders/b3dm.d.ts +10 -0
- package/five/model/loaders/dome.d.ts +22 -0
- package/five/model/loaders/domez.d.ts +11 -0
- package/five/model/loaders/fbx.d.ts +8 -0
- package/five/model/loaders/glTF-helpers/extensions/CESIUM_RTC.d.ts +9 -0
- package/five/model/loaders/glTF-helpers/extensions/EXT_meshopt_compression.d.ts +8 -0
- package/five/model/loaders/glTF-helpers/extensions/EXT_texture_webp.d.ts +11 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_animation_pointer.d.ts +6 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_binary_glTF.d.ts +25 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_draco_mesh_compression.d.ts +11 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting.d.ts +26 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz.d.ts +11 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz_2.d.ts +13 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_clearcoat.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_emissive_strength.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_sheen.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_transmission.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_unlit.d.ts +12 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_mesh_quantization.d.ts +6 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_node_visibility.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_texture_basisu.d.ts +9 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_texture_transform.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/REALSEE_materials_lightmap.d.ts +7 -0
- package/five/model/loaders/glTF-helpers/extensions/base.d.ts +25 -0
- package/five/model/loaders/glTF-helpers/glTF.d.ts +713 -0
- package/five/model/loaders/glTF-helpers/index.d.ts +51 -0
- package/five/model/loaders/glTF-helpers/parser.d.ts +115 -0
- package/five/model/loaders/glTF-helpers/type.d.ts +14 -0
- package/five/model/loaders/gltf.d.ts +10 -0
- package/five/model/loaders/obj.d.ts +9 -0
- package/five/model/loaders/pbm.d.ts +26 -0
- package/five/model/loaders/ply.d.ts +24 -0
- package/five/model/loaders/pnts.d.ts +8 -0
- package/five/model/loaders/protobuf/dome.d.ts +540 -0
- package/five/model/loaders/protobuf/pbm.d.ts +203 -0
- package/five/model/loaders/shared.d.ts +16 -0
- package/five/model/loaders/splat.d.ts +8 -0
- package/five/model/loaders/spz.d.ts +14 -0
- package/five/model/loaders/tile3d-helpers/feature-table.d.ts +15 -0
- package/five/model/loaders/tile3d-helpers/gl-type.d.ts +20 -0
- package/five/model/loaders/tile3d-helpers/parse-gltf-array-buffer.d.ts +2 -0
- package/five/model/loaders/tile3d-helpers/parse-header.d.ts +2 -0
- package/five/model/loaders/tile3d-helpers/parse-point-cloud-attributes.d.ts +2 -0
- package/five/model/loaders/tile3d-helpers/parse-point-cloud-attributes.worker.d.ts +6 -0
- package/five/model/loaders/tile3d-helpers/parse-table.d.ts +3 -0
- package/five/model/loaders/tile3d-helpers/tile3d-type.d.ts +36 -0
- package/five/model/loaders/x3p.d.ts +22 -0
- package/five/model/materials/nodes/pbmMeshBasicNodeMaterial.d.ts +14 -0
- package/five/model/materials/nodes/pbmMeshPanoOnlyNodeMaterial.d.ts +14 -0
- package/five/model/materials/nodes/pbmMeshPhongNodeMaterial.d.ts +14 -0
- package/five/model/materials/nodes/pbmMeshPhysicalNodeMaterial.d.ts +14 -0
- package/five/model/materials/nodes/pbmPointCloudNodeMaterial.d.ts +22 -0
- package/five/model/materials/pbmGaussianSplattingNodeMaterial.d.ts +78 -0
- package/five/model/materials/pbmMaterial.d.ts +171 -0
- package/five/model/materials/pbmMaterialRegister.d.ts +6 -0
- package/five/model/materials/pbmMeshMaterial.d.ts +57 -0
- package/five/model/materials/pbmPointCloudMaterial.d.ts +20 -0
- package/five/model/materials/pbmPointCloudNodeMaterial.d.ts +46 -0
- package/five/model/materials/tsl/colorFilter.d.ts +9 -0
- package/five/model/materials/tsl/defines.d.ts +68 -0
- package/five/model/materials/tsl/nodeTypes.d.ts +12 -0
- package/five/model/materials/tsl/outputBuilder.d.ts +26 -0
- package/five/model/materials/tsl/panoColor.d.ts +17 -0
- package/five/model/materials/tsl/panoTransition.d.ts +8 -0
- package/five/model/materials/tsl/utils.d.ts +11 -0
- package/five/model/model-scene.d.ts +172 -0
- package/five/model/model.d.ts +203 -0
- package/five/model/objects/pbmGaussianSplattingObject.d.ts +47 -0
- package/five/model/objects/pbmGaussianSplattingRenderMesh.d.ts +73 -0
- package/five/model/objects/pbmGroup.d.ts +8 -0
- package/five/model/objects/pbmMesh.d.ts +10 -0
- package/five/model/objects/pbmPointCloud.d.ts +89 -0
- package/five/model/objects/pbmPointCloudObject.d.ts +81 -0
- package/five/model/parameter.d.ts +138 -0
- package/five/model/tile3d/header.d.ts +88 -0
- package/five/model/tile3d/index.d.ts +213 -0
- package/five/model/tile3d/tile-cache.d.ts +18 -0
- package/five/model/tile3d/tile-content.d.ts +10 -0
- package/five/model/tile3d/tile-node.d.ts +26 -0
- package/five/model/tile3d/tile-request-scheduler.d.ts +17 -0
- package/five/model/tile3d/tile.d.ts +79 -0
- package/five/model/tile3d/tileset-base-traverser.d.ts +59 -0
- package/five/model/tile3d/tileset-most-detail-traverser.d.ts +14 -0
- package/five/model/tile3d/tileset-normal-traverser.d.ts +15 -0
- package/five/model/tile3d/tileset-skip-traverser.d.ts +60 -0
- package/five/model/tile3d/tileset.d.ts +65 -0
- package/five/model/tile3d/trajectory-content.d.ts +0 -0
- package/five/model/tile3d/trajectory-node.d.ts +15 -0
- package/five/model/tile3d/trajectory.d.ts +30 -0
- package/five/model/tile3d/types.d.ts +33 -0
- package/five/model/view-layer.d.ts +20 -0
- package/five/renderer/compute-renderers/pointcloud-compute-renderer.d.ts +154 -0
- package/five/renderer/compute-renderers/rgb565.d.ts +45 -0
- package/five/renderer/compute-renderers/shaders/clear.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/fullscreenQuad.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/rasterize.d.ts +2 -0
- package/five/renderer/five-renderer.d.ts +33 -0
- package/five/renderer/index.d.ts +3 -0
- package/five/renderer/postprocessing/composer.d.ts +45 -0
- package/five/renderer/postprocessing/index.d.ts +8 -0
- package/five/renderer/postprocessing/passes/adaptive-luminance-pass.d.ts +27 -0
- package/five/renderer/postprocessing/passes/eye-dome-lighting-pass.d.ts +31 -0
- package/five/renderer/postprocessing/passes/flowing-fireworks-3d-pass.d.ts +71 -0
- package/five/renderer/postprocessing/passes/flowing-light-2d-pass.d.ts +26 -0
- package/five/renderer/postprocessing/passes/flowing-light-3d-pass.d.ts +75 -0
- package/five/renderer/postprocessing/passes/gaussian-blur-pass.d.ts +22 -0
- package/five/renderer/postprocessing/passes/pass.d.ts +38 -0
- package/five/renderer/scene-renderers/scene-renderer.d.ts +9 -0
- package/five/renderer/tools/full-screen-quad.d.ts +17 -0
- package/five/renderer/tools/postprocess-uv.d.ts +11 -0
- package/five/renderer/tools/render-cube-to-equirectangular.d.ts +7 -0
- package/five/renderer/tools/render-full-screen-depth.d.ts +2 -0
- package/five/renderer/tools/render-full-screen.d.ts +2 -0
- package/five/texture/histogram.d.ts +54 -0
- package/five/texture/imageBitmap.d.ts +13 -0
- package/five/texture/initTexture.d.ts +3 -0
- package/five/texture/loader.d.ts +39 -0
- package/five/texture/textureData.d.ts +11 -0
- package/five/thirdparty/fflate.d.ts +1407 -0
- package/five/thirdparty/hammer.d.ts +375 -0
- package/five/thirdparty/jsrsasign.d.ts +753 -0
- package/five/thirdparty/meshopt_decoder.d.ts +15 -0
- package/five/three-version-check.d.ts +1 -0
- package/five/types/addableObject.d.ts +12 -0
- package/five/types/cube.d.ts +2 -0
- package/five/types/gestureInput.d.ts +24 -0
- package/five/types/imageOptions.d.ts +20 -0
- package/five/types/intersectMeshInterface.d.ts +8 -0
- package/five/types/movePanoEffect.d.ts +13 -0
- package/five/types/movePanoOptions.d.ts +36 -0
- package/five/types/panoCircleMeshInterface.d.ts +34 -0
- package/five/types/plugin.d.ts +25 -0
- package/five/types/pose.d.ts +17 -0
- package/five/types/state.d.ts +20 -0
- package/five/types/viewport.d.ts +22 -0
- package/five/utils/ajax.d.ts +66 -0
- package/five/utils/animationFrameLoop.d.ts +45 -0
- package/five/utils/array.d.ts +31 -0
- package/five/utils/asyncTaskQueue.d.ts +8 -0
- package/five/utils/bufferGeometry.d.ts +33 -0
- package/five/utils/calculateProgress.d.ts +39 -0
- package/five/utils/calculateThreeMouse.d.ts +13 -0
- package/five/utils/canplayVideo.d.ts +2 -0
- package/five/utils/clamp.d.ts +2 -0
- package/five/utils/clock.d.ts +30 -0
- package/five/utils/createSymbol.d.ts +5 -0
- package/five/utils/decodeText.d.ts +2 -0
- package/five/utils/deepEqual.d.ts +2 -0
- package/five/utils/deepFreeze.d.ts +2 -0
- package/five/utils/defineProperty.d.ts +9 -0
- package/five/utils/detector.d.ts +14 -0
- package/five/utils/distance.d.ts +10 -0
- package/five/utils/draco.d.ts +26 -0
- package/five/utils/easing.d.ts +63 -0
- package/five/utils/event.d.ts +159 -0
- package/five/utils/face3.d.ts +12 -0
- package/five/utils/formatRad.d.ts +7 -0
- package/five/utils/hdr-data.d.ts +13 -0
- package/five/utils/imageSupport.d.ts +6 -0
- package/five/utils/imageURL.d.ts +42 -0
- package/five/utils/isEmptyObject.d.ts +2 -0
- package/five/utils/isNil.d.ts +6 -0
- package/five/utils/isNumber.d.ts +2 -0
- package/five/utils/isPowerOfTwo.d.ts +2 -0
- package/five/utils/isPromise.d.ts +2 -0
- package/five/utils/isSimilar.d.ts +6 -0
- package/five/utils/json.d.ts +7 -0
- package/five/utils/ktx2.d.ts +30 -0
- package/five/utils/lzma/index.d.ts +2 -0
- package/five/utils/lzma/lzma.d.ts +3 -0
- package/five/utils/lzma/lzmaWASM.d.ts +2 -0
- package/five/utils/lzma/lzmaWorker.d.ts +14 -0
- package/five/utils/memoryUsage.d.ts +37 -0
- package/five/utils/motion.d.ts +38 -0
- package/five/utils/noop.d.ts +6 -0
- package/five/utils/now.d.ts +7 -0
- package/five/utils/pano.d.ts +9 -0
- package/five/utils/pick.d.ts +3 -0
- package/five/utils/poseUtils.d.ts +5 -0
- package/five/utils/renderCubeTextureToCubeRenderTarget.d.ts +3 -0
- package/five/utils/renderDepth.d.ts +2 -0
- package/five/utils/renderTexturesToCubeRenderTarget.d.ts +10 -0
- package/five/utils/requestPermission.d.ts +3 -0
- package/five/utils/shaderContentFix.d.ts +7 -0
- package/five/utils/shaderMaterial.d.ts +20 -0
- package/five/utils/stateUtils.d.ts +5 -0
- package/five/utils/string-pattern.d.ts +8 -0
- package/five/utils/subscribe.d.ts +67 -0
- package/five/utils/tileCube.d.ts +19 -0
- package/five/utils/toFastProperties.d.ts +1 -0
- package/five/utils/typedCache.d.ts +10 -0
- package/five/utils/uniform.d.ts +15 -0
- package/five/utils/url.d.ts +35 -0
- package/five/utils/uuid.d.ts +5 -0
- package/five/utils/values.d.ts +2 -0
- package/five/utils/vectorCoordinates.d.ts +29 -0
- package/five/utils/volume.d.ts +111 -0
- package/five/utils/worker.d.ts +26 -0
- package/five/work/_ALLOW_HOST.d.ts +2 -0
- package/five/work/index.d.ts +6 -0
- package/five/work/keychain.d.ts +5 -0
- package/five/work/looseWorkType.d.ts +128 -0
- package/five/work/verify.d.ts +7 -0
- package/five/work/work.d.ts +246 -0
- package/five/work/workFetcher.d.ts +4 -0
- package/five/work/workJson.d.ts +3 -0
- package/five/work/workJsonType.d.ts +73 -0
- package/five/work/workObserverUtils.d.ts +36 -0
- package/five/work/workParser.d.ts +6 -0
- package/five/work/workResolvedObserver.d.ts +12 -0
- package/five/work/workVerify.d.ts +2 -0
- package/five/work/works.d.ts +10 -0
- package/llms.txt +66 -0
- package/package.json +56 -0
- package/plugins/BasePlugin/index.d.ts +96 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.d.ts +66 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.d.ts +5 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/typing.d.ts +32 -0
- package/plugins/index.d.ts +2 -0
- package/plugins/index.js +255 -0
- package/plugins/index.mjs +539 -0
- package/plugins/utils/absoluteUrl.d.ts +5 -0
- package/react/autoCanvas.d.ts +9 -0
- package/react/canvas.d.ts +19 -0
- package/react/context.d.ts +12 -0
- package/react/createProvider.d.ts +98 -0
- package/react/createStore.d.ts +144 -0
- package/react/fiveApp.d.ts +22 -0
- package/react/hooks/unsafe__useFiveInstance.d.ts +9 -0
- package/react/hooks/useFiveAction.d.ts +147 -0
- package/react/hooks/useFiveCameraDirection.d.ts +7 -0
- package/react/hooks/useFiveCameraRaycaster.d.ts +7 -0
- package/react/hooks/useFiveCurrentObserver.d.ts +11 -0
- package/react/hooks/useFiveCurrentState.d.ts +15 -0
- package/react/hooks/useFiveEventCallback.d.ts +12 -0
- package/react/hooks/useFiveFloor.d.ts +15 -0
- package/react/hooks/useFiveHelper.d.ts +14 -0
- package/react/hooks/useFiveModelBounding.d.ts +5 -0
- package/react/hooks/useFiveModelEffect.d.ts +14 -0
- package/react/hooks/useFiveModelIntersectRaycaster.d.ts +22 -0
- package/react/hooks/useFiveModelReadyState.d.ts +8 -0
- package/react/hooks/useFivePlugin.d.ts +22 -0
- package/react/hooks/useFiveProject2d.d.ts +21 -0
- package/react/hooks/useFiveSceneEffect.d.ts +21 -0
- package/react/hooks/useFiveState.d.ts +6 -0
- package/react/hooks/useFiveWork.d.ts +29 -0
- package/react/index.d.ts +28 -0
- package/react/index.js +255 -0
- package/react/index.mjs +896 -0
- package/react/withFive.d.ts +213 -0
- package/resource/basis/1.16/basis_transcoder.js +22 -0
- package/resource/basis/1.16/basis_transcoder.wasm +0 -0
- package/resource/basis/README.md +5 -0
- package/resource/draco/1.5.6/draco_decoder.js +34 -0
- package/resource/draco/1.5.6/draco_decoder.wasm +0 -0
- package/resource/draco/1.5.6/draco_decoder_gltf.js +33 -0
- package/resource/draco/1.5.6/draco_decoder_gltf.wasm +0 -0
- package/resource/draco/1.5.6/draco_encoder.js +35 -0
- package/resource/draco/1.5.6/draco_encoder.wasm +0 -0
- package/resource/draco/1.5.6/draco_encoder_wrapper.js +97 -0
- package/resource/draco/1.5.6/draco_wasm_wrapper.js +117 -0
- package/resource/draco/1.5.6/draco_wasm_wrapper_gltf.js +116 -0
- package/resource/draco/README.md +5 -0
- package/umd/five-plugins.js +255 -0
- package/umd/five-react.js +255 -0
- package/umd/five.js +1579 -0
package/five/index.js
ADDED
|
@@ -0,0 +1,1179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* @realsee/five-webgpu
|
|
4
|
+
* Generated: 2026/7/14
|
|
5
|
+
* Version: 1.0.0-alpha.1
|
|
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
|
+
*/Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("three/webgpu");c=s(c,1);let l=require("protobufjs/minimal");l=s(l,1);let u=require("three");u=s(u,1);let d=require("three/tsl");Number(c.REVISION);var f={},p=p||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)}}}(),a=r.WordArray=i.extend({init:function(e,n){e=this.words=e||[],n==t?this.sigBytes=e.length*4:this.sigBytes=n},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 a=0;a<i;a++){var o=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=o<<24-(r+a)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>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(e.random()*4294967296|0);return new a.init(n,t)}}),o=n.enc={},s=o.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((a&15).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 a.init(n,t/2)}},c=o.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}return r.join(``)},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(e.charCodeAt(r)&255)<<24-r%4*8;return new a.init(n,t)}},l=o.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error(`Malformed UTF-8 data`)}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},u=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){typeof e==`string`&&(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,o=this.blockSize,s=i/(o*4);s=t?e.ceil(s):e.max((s|0)-this._minBufferSize,0);var c=s*o,l=e.min(c*4,i);if(c){for(var u=0;u<c;u+=o)this._doProcessBlock(r,u);var d=r.splice(0,c);n.sigBytes-=l}return new a.init(d,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:512/32,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new d.HMAC.init(e,n).finalize(t)}}});var d=n.algo={};return n}(Math);(function(e){for(var t=p,n=t.lib,r=n.WordArray,i=n.Hasher,n=t.algo,a=[],o=[],s=function(e){return 4294967296*(e-(e|0))|0},c=2,l=0;64>l;){var u;a:{u=c;for(var d=e.sqrt(u),f=2;f<=d;f++)if(!(u%f)){u=!1;break a}u=!0}u&&(8>l&&(a[l]=s(e.pow(c,.5))),o[l]=s(e.pow(c,1/3)),l++),c++}var m=[],n=n.SHA256=i.extend({_doReset:function(){this._hash=new r.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],s=n[3],c=n[4],l=n[5],u=n[6],d=n[7],f=0;64>f;f++){if(16>f)m[f]=e[t+f]|0;else{var p=m[f-15],h=m[f-2];m[f]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+m[f-7]+((h<<15|h>>>17)^(h<<13|h>>>19)^h>>>10)+m[f-16]}p=d+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&l^~c&u)+o[f]+m[f],h=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&a^i&a),d=u,u=l,l=c,c=s+p|0,s=a,a=i,i=r,r=p+h|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|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]+d|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[(i+64>>>9<<4)+14]=e.floor(r/4294967296),n[(i+64>>>9<<4)+15]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(n),t.HmacSHA256=i._createHmacHelper(n)})(Math),p.lib.Cipher||function(e){var t=p,n=t.lib,r=n.Base,i=n.WordArray,a=n.BufferedBlockAlgorithm,o=t.enc.Base64,s=t.algo.EvpKDF,c=n.Cipher=a.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,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.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(typeof n==`string`?h:m).encrypt(e,t,n,r)},decrypt:function(t,n,r){return(typeof n==`string`?h:m).decrypt(e,t,n,r)}}}});n.StreamCipher=c.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=t.mode={},u=function(t,n,r){var i=this._iv;i?this._iv=e:i=this._prevBlock;for(var a=0;a<r;a++)t[n+a]^=i[a]},d=(n.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();d.Encryptor=d.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize;u.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),d.Decryptor=d.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=e.slice(t,t+r);n.decryptBlock(e,t),u.call(this,e,t,r),this._prevBlock=i}}),l=l.CBC=d,d=(t.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,n=n-e.sigBytes%n,r=n<<24|n<<16|n<<8|n,a=[],o=0;o<n;o+=4)a.push(r);n=i.create(a,n),e.concat(n)},unpad:function(e){e.sigBytes-=e.words[e.sigBytes-1>>>2]&255}},n.BlockCipher=c.extend({cfg:c.cfg.extend({mode:l,padding:d}),reset:function(){c.reset.call(this);var e=this.cfg,t=e.iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=e.createEncryptor;else n=e.createDecryptor,this._minBufferSize=1;this._mode=n.call(e,this,t&&t.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 f=n.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),l=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return e=e.salt,(e?i.create([1398893684,1701076831]).concat(e).concat(t):t).toString(o)},parse:function(e){e=o.parse(e);var t=e.words;if(t[0]==1398893684&&t[1]==1701076831){var n=i.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return f.create({ciphertext:e,salt:n})}},m=n.SerializableCipher=r.extend({cfg:r.extend({format:l}),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,f.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 typeof e==`string`?t.parse(e,this):e}}),t=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){return r||(r=i.random(8)),e=s.create({keySize:t+n}).compute(e,r),n=i.create(e.words.slice(t),4*n),e.sigBytes=4*t,f.create({key:e,iv:n,salt:r})}},h=n.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:t}),encrypt:function(e,t,n,r){return r=this.cfg.extend(r),n=r.kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,e=m.encrypt.call(this,e,t,n.key,r),e.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,m.decrypt.call(this,e,t,n.key,r)}})}(),(function(){for(var e=p,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],a=[],o=[],s=[],c=[],l=[],u=[],d=[],f=[],m=[],h=0;256>h;h++)m[h]=128>h?h<<1:h<<1^283;for(var g=0,_=0,h=0;256>h;h++){var v=_^_<<1^_<<2^_<<3^_<<4,v=v>>>8^v&255^99;r[g]=v,i[v]=g;var y=m[g],b=m[y],x=m[b],S=257*m[v]^16843008*v;a[g]=S<<24|S>>>8,o[g]=S<<16|S>>>16,s[g]=S<<8|S>>>24,c[g]=S,S=16843009*x^65537*b^257*y^16843008*g,l[v]=S<<24|S>>>8,u[v]=S<<16|S>>>16,d[v]=S<<8|S>>>24,f[v]=S,g?(g=y^m[m[m[x^y]]],_^=m[m[_]]):g=_=1}var C=[0,1,2,4,8,16,32,64,128,27,54],n=n.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes/4,e=4*((this._nRounds=n+6)+1),i=this._keySchedule=[],a=0;a<e;a++)if(a<n)i[a]=t[a];else{var o=i[a-1];a%n?6<n&&a%n==4&&(o=r[o>>>24]<<24|r[o>>>16&255]<<16|r[o>>>8&255]<<8|r[o&255]):(o=o<<8|o>>>24,o=r[o>>>24]<<24|r[o>>>16&255]<<16|r[o>>>8&255]<<8|r[o&255],o^=C[a/n|0]<<24),i[a]=i[a-n]^o}for(t=this._invKeySchedule=[],n=0;n<e;n++)a=e-n,o=n%4?i[a]:i[a-4],t[n]=4>n||4>=a?o:l[r[o>>>24]]^u[r[o>>>16&255]]^d[r[o>>>8&255]]^f[r[o&255]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,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,d,f,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,o,s){for(var c=this._nRounds,l=e[t]^n[0],u=e[t+1]^n[1],d=e[t+2]^n[2],f=e[t+3]^n[3],p=4,m=1;m<c;m++)var h=r[l>>>24]^i[u>>>16&255]^a[d>>>8&255]^o[f&255]^n[p++],g=r[u>>>24]^i[d>>>16&255]^a[f>>>8&255]^o[l&255]^n[p++],_=r[d>>>24]^i[f>>>16&255]^a[l>>>8&255]^o[u&255]^n[p++],f=r[f>>>24]^i[l>>>16&255]^a[u>>>8&255]^o[d&255]^n[p++],l=h,u=g,d=_;h=(s[l>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[f&255])^n[p++],g=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[f>>>8&255]<<8|s[l&255])^n[p++],_=(s[d>>>24]<<24|s[f>>>16&255]<<16|s[l>>>8&255]<<8|s[u&255])^n[p++],f=(s[f>>>24]<<24|s[l>>>16&255]<<16|s[u>>>8&255]<<8|s[d&255])^n[p++],e[t]=h,e[t+1]=g,e[t+2]=_,e[t+3]=f},keySize:8});e.AES=t._createHelper(n)})();var m,h=!0;function g(e,t,n){e!=null&&(typeof e==`number`?this.fromNumber(e,t,n):t==null&&typeof e!=`string`?this.fromString(e,256):this.fromString(e,t))}function _(){return new g(null)}function v(e,t,n,r,i,a){for(;--a>=0;){var o=t*this[e++]+n[r]+i;i=Math.floor(o/67108864),n[r++]=o&67108863}return i}function y(e,t,n,r,i,a){for(var o=t&32767,s=t>>15;--a>=0;){var c=this[e]&32767,l=this[e++]>>15,u=s*c+l*o;c=o*c+((u&32767)<<15)+n[r]+(i&1073741823),i=(c>>>30)+(u>>>15)+s*l+(i>>>30),n[r++]=c&1073741823}return i}function b(e,t,n,r,i,a){for(var o=t&16383,s=t>>14;--a>=0;){var c=this[e]&16383,l=this[e++]>>14,u=s*c+l*o;c=o*c+((u&16383)<<14)+n[r]+i,i=(c>>28)+(u>>14)+s*l,n[r++]=c&268435455}return i}h&&typeof navigator<`u`&&navigator.appName==`Microsoft Internet Explorer`?(g.prototype.am=y,m=30):h&&typeof navigator<`u`&&navigator.appName!=`Netscape`?(g.prototype.am=v,m=26):(g.prototype.am=b,m=28),g.prototype.DB=m,g.prototype.DM=(1<<m)-1,g.prototype.DV=1<<m;var x=52;g.prototype.FV=Math.pow(2,x),g.prototype.F1=x-m,g.prototype.F2=2*m-x;var S=`0123456789abcdefghijklmnopqrstuvwxyz`,C=[],w=48,T;for(T=0;T<=9;++T)C[w++]=T;for(w=97,T=10;T<36;++T)C[w++]=T;for(w=65,T=10;T<36;++T)C[w++]=T;function E(e){return S.charAt(e)}function D(e,t){var n=C[e.charCodeAt(t)];return n==null?-1:n}function O(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function k(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 A(e){var t=_();return t.fromInt(e),t}function j(e,t){var n;if(t==16)n=4;else if(t==8)n=3;else if(t==256)n=8;else if(t==2)n=1;else if(t==32)n=5;else if(t==4)n=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,i=!1,a=0;--r>=0;){var o=n==8?e[r]&255:D(e,r);if(o<0){e.charAt(r)==`-`&&(i=!0);continue}i=!1,a==0?this[this.t++]=o:a+n>this.DB?(this[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this[this.t++]=o>>this.DB-a):this[this.t-1]|=o<<a,a+=n,a>=this.DB&&(a-=this.DB)}n==8&&e[0]&128&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&g.ZERO.subTo(this,this)}function M(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function N(e){if(this.s<0)return`-`+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var n=(1<<t)-1,r,i=!1,a=``,o=this.t,s=this.DB-o*this.DB%t;if(o-->0)for(s<this.DB&&(r=this[o]>>s)>0&&(i=!0,a=E(r));o>=0;)s<t?(r=(this[o]&(1<<s)-1)<<t-s,r|=this[--o]>>(s+=this.DB-t)):(r=this[o]>>(s-=t)&n,s<=0&&(s+=this.DB,--o)),r>0&&(i=!0),i&&(a+=E(r));return i?a:`0`}function ee(){var e=_();return g.ZERO.subTo(this,e),e}function P(){return this.s<0?this.negate():this}function F(e){var t=this.s-e.s;if(t!=0)return t;var n=this.t;if(t=n-e.t,t!=0)return this.s<0?-t:t;for(;--n>=0;)if((t=this[n]-e[n])!=0)return t;return 0}function te(e){var t=1,n;return(n=e>>>16)!=0&&(e=n,t+=16),(n=e>>8)!=0&&(e=n,t+=8),(n=e>>4)!=0&&(e=n,t+=4),(n=e>>2)!=0&&(e=n,t+=2),(n=e>>1)!=0&&(e=n,t+=1),t}function ne(){return this.t<=0?0:this.DB*(this.t-1)+te(this[this.t-1]^this.s&this.DM)}function I(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 re(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 ie(e,t){var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<n&this.DM,s;for(s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>r|o,o=(this[s]&i)<<n;for(s=a-1;s>=0;--s)t[s]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()}function L(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}var r=e%this.DB,i=this.DB-r,a=(1<<r)-1;t[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&a)<<i,t[o-n]=this[o]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<i),t.t=this.t-n,t.clamp()}function ae(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 R(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&&g.ZERO.subTo(t,t)}function z(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 oe(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t){t!=null&&t.fromInt(0),n!=null&&this.copyTo(n);return}n==null&&(n=_());var a=_(),o=this.s,s=e.s,c=this.DB-te(r[r.t-1]);c>0?(r.lShiftTo(c,a),i.lShiftTo(c,n)):(r.copyTo(a),i.copyTo(n));var l=a.t,u=a[l-1];if(u!=0){var d=u*(1<<this.F1)+(l>1?a[l-2]>>this.F2:0),f=this.FV/d,p=(1<<this.F1)/d,m=1<<this.F2,h=n.t,v=h-l,y=t==null?_():t;for(a.dlShiftTo(v,y),n.compareTo(y)>=0&&(n[n.t++]=1,n.subTo(y,n)),g.ONE.dlShiftTo(l,y),y.subTo(a,a);a.t<l;)a[a.t++]=0;for(;--v>=0;){var b=n[--h]==u?this.DM:Math.floor(n[h]*f+(n[h-1]+m)*p);if((n[h]+=a.am(0,b,n,v,0,l))<b)for(a.dlShiftTo(v,y),n.subTo(y,n);n[h]<--b;)n.subTo(y,n)}t!=null&&(n.drShiftTo(l,t),o!=s&&g.ZERO.subTo(t,t)),n.t=l,n.clamp(),c>0&&n.rShiftTo(c,n),o<0&&g.ZERO.subTo(n,n)}}}function se(e){var t=_();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(g.ZERO)>0&&e.subTo(t,t),t}function ce(e){this.m=e}function le(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function ue(e){return e}function de(e){e.divRemTo(this.m,null,e)}function fe(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function pe(e,t){e.squareTo(t),this.reduce(t)}ce.prototype.convert=le,ce.prototype.revert=ue,ce.prototype.reduce=de,ce.prototype.mulTo=fe,ce.prototype.sqrTo=pe;function me(){if(this.t<1)return 0;var e=this[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function he(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function ge(e){var t=_();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(g.ZERO)>0&&this.m.subTo(t,t),t}function _e(e){var t=_();return e.copyTo(t),this.reduce(t),t}function ve(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=e[t]&32767,r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=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 ye(e,t){e.squareTo(t),this.reduce(t)}function be(e,t,n){e.multiplyTo(t,n),this.reduce(n)}he.prototype.convert=ge,he.prototype.revert=_e,he.prototype.reduce=ve,he.prototype.mulTo=be,he.prototype.sqrTo=ye;function xe(){return(this.t>0?this[0]&1:this.s)==0}function Se(e,t){if(e>4294967295||e<1)return g.ONE;var n=_(),r=_(),i=t.convert(this),a=te(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<<a)>0)t.mulTo(r,i,n);else{var o=n;n=r,r=o}return t.revert(n)}function Ce(e,t){var n=e<256||t.isEven()?new ce(t):new he(t);return this.exp(e,n)}g.prototype.copyTo=O,g.prototype.fromInt=k,g.prototype.fromString=j,g.prototype.clamp=M,g.prototype.dlShiftTo=I,g.prototype.drShiftTo=re,g.prototype.lShiftTo=ie,g.prototype.rShiftTo=L,g.prototype.subTo=ae,g.prototype.multiplyTo=R,g.prototype.squareTo=z,g.prototype.divRemTo=oe,g.prototype.invDigit=me,g.prototype.isEven=xe,g.prototype.exp=Se,g.prototype.toString=N,g.prototype.negate=ee,g.prototype.abs=P,g.prototype.compareTo=F,g.prototype.bitLength=ne,g.prototype.mod=se,g.prototype.modPowInt=Ce,g.ZERO=A(0),g.ONE=A(1);function we(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Te(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Ee(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function De(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return`0`;var t=this.chunkSize(e),n=Math.pow(e,t),r=A(n),i=_(),a=_(),o=``;for(this.divRemTo(r,i,a);i.signum()>0;)o=(n+a.intValue()).toString(e).substr(1)+o,i.divRemTo(r,i,a);return a.intValue().toString(e)+o}g.prototype.chunkSize=Te,g.prototype.toRadix=De,g.prototype.intValue=we,g.prototype.signum=Ee;var Oe=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ke=`=`;function Ae(e){var t,n,r=``;for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=Oe.charAt(n>>6)+Oe.charAt(n&63);if(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=Oe.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=Oe.charAt(n>>2)+Oe.charAt((n&3)<<4)),ke)for(;(r.length&3)>0;)r+=ke;return r}function je(e){var t=``,n,r=0,i,a;for(n=0;n<e.length&&e.charAt(n)!=ke;++n)a=Oe.indexOf(e.charAt(n)),!(a<0)&&(r==0?(t+=E(a>>2),i=a&3,r=1):r==1?(t+=E(i<<2|a>>4),i=a&15,r=2):r==2?(t+=E(i),t+=E(a>>2),i=a&3,r=3):(t+=E(i<<2|a>>4),t+=E(a&15),r=0));return r==1&&(t+=E(i<<2)),t}function Me(e,t){return new g(e,t)}function Ne(e,t){if(t<e.length+11)throw`Message too long for RSA`;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=i&63|128,n[--t]=i>>6|192):(n[--t]=i&63|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var a=new SecureRandom,o=[];t>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new g(n)}function Pe(e,t,n){for(var r=``,i=0;r.length<t;)r+=n(String.fromCharCode.apply(String,e.concat([(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255]))),i+=1;return r}function Fe(e,t,n,r){var i=f.crypto.MessageDigest,a=f.crypto.Util,o=null;if(n||(n=`sha1`),typeof n==`string`&&(o=i.getCanonicalAlgName(n),r=i.getHashLength(o),n=function(e){return Ze(a.hashHex(Qe(e),o))}),e.length+2*r+2>t)throw`Message too long for RSA`;var s=``,c;for(c=0;c<t-e.length-2*r-2;c+=1)s+=`\0`;var l=n(``)+s+``+e,u=Array(r);new SecureRandom().nextBytes(u);var d=Pe(u,l.length,n),p=[];for(c=0;c<l.length;c+=1)p[c]=l.charCodeAt(c)^d.charCodeAt(c);var m=Pe(p,u.length,n),h=[0];for(c=0;c<u.length;c+=1)h[c+1]=u[c]^m.charCodeAt(c);return new g(h.concat(p))}function B(){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 Ie(e,t){if(this.isPublic=!0,this.isPrivate=!1,typeof e!=`string`)this.n=e,this.e=t;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=Me(e,16),this.e=parseInt(t,16);else throw`Invalid RSA public key`}function Le(e){return e.modPowInt(this.e,this.n)}function Re(e){var t=Ne(e,this.n.bitLength()+7>>3);if(t==null)return null;var n=this.doPublic(t);if(n==null)return null;var r=n.toString(16);return r.length&1?`0`+r:r}function ze(e,t,n){var r=Fe(e,this.n.bitLength()+7>>3,t,n);if(r==null)return null;var i=this.doPublic(r);if(i==null)return null;var a=i.toString(16);return a.length&1?`0`+a:a}B.prototype.doPublic=Le,B.prototype.setPublic=Ie,B.prototype.encrypt=Re,B.prototype.encryptOAEP=ze,B.prototype.type=`RSA`;function Be(e,t){for(var n=e.toByteArray(),r=0;r<n.length&&n[r]==0;)++r;if(n.length-r!=t-1||n[r]!=2)return null;for(++r;n[r]!=0;)if(++r>=n.length)return null;for(var i=``;++r<n.length;){var a=n[r]&255;a<128?i+=String.fromCharCode(a):a>191&&a<224?(i+=String.fromCharCode((a&31)<<6|n[r+1]&63),++r):(i+=String.fromCharCode((a&15)<<12|(n[r+1]&63)<<6|n[r+2]&63),r+=2)}return i}function Ve(e,t,n){for(var r=``,i=0;r.length<t;)r+=n(e+String.fromCharCode.apply(String,[(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255])),i+=1;return r}function He(e,t,n,r){var i=f.crypto.MessageDigest,a=f.crypto.Util,o=null;n||(n=`sha1`),typeof n==`string`&&(o=i.getCanonicalAlgName(n),r=i.getHashLength(o),n=function(e){return Ze(a.hashHex(Qe(e),o))}),e=e.toByteArray();var s;for(s=0;s<e.length;s+=1)e[s]&=255;for(;e.length<t;)e.unshift(0);if(e=String.fromCharCode.apply(String,e),e.length<2*r+2)throw`Cipher too short`;var c=e.substr(1,r),l=e.substr(r+1),u=Ve(l,r,n),d=[],s;for(s=0;s<c.length;s+=1)d[s]=c.charCodeAt(s)^u.charCodeAt(s);var p=Ve(String.fromCharCode.apply(String,d),e.length-r,n),m=[];for(s=0;s<l.length;s+=1)m[s]=l.charCodeAt(s)^p.charCodeAt(s);if(m=String.fromCharCode.apply(String,m),m.substr(0,r)!==n(``))throw`Hash mismatch`;m=m.substr(r);var h=m.indexOf(``);if((h==-1?-1:m.substr(0,h).lastIndexOf(`\0`))+1!=h)throw`Malformed data`;return m.substr(h+1)}function Ue(e,t,n){if(this.isPrivate=!0,typeof e!=`string`)this.n=e,this.e=t,this.d=n;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=Me(e,16),this.e=parseInt(t,16),this.d=Me(n,16);else throw`Invalid RSA private key`}function We(e,t,n,r,i,a,o,s){if(this.isPrivate=!0,this.isPublic=!1,e==null)throw`RSASetPrivateEx N == null`;if(t==null)throw`RSASetPrivateEx E == null`;if(e.length==0)throw`RSASetPrivateEx N.length == 0`;if(t.length==0)throw`RSASetPrivateEx E.length == 0`;if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=Me(e,16),this.e=parseInt(t,16),this.d=Me(n,16),this.p=Me(r,16),this.q=Me(i,16),this.dmp1=Me(a,16),this.dmq1=Me(o,16),this.coeff=Me(s,16);else throw`Invalid RSA private key in RSASetPrivateEx`}function Ge(e){if(this.p==null||this.q==null)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 Ke(e){if(e.length!=Math.ceil(this.n.bitLength()/4))throw Error(`wrong ctext length`);var t=Me(e,16),n=this.doPrivate(t);return n==null?null:Be(n,this.n.bitLength()+7>>3)}function qe(e,t,n){if(e.length!=Math.ceil(this.n.bitLength()/4))throw Error(`wrong ctext length`);var r=Me(e,16),i=this.doPrivate(r);return i==null?null:He(i,this.n.bitLength()+7>>3,t,n)}B.prototype.doPrivate=Ge,B.prototype.setPrivate=Ue,B.prototype.setPrivateEx=We,B.prototype.decrypt=Ke,B.prototype.decryptOAEP=qe,(f.lang===void 0||!f.lang)&&(f.lang={}),f.lang.String=function(){};function Je(e){return e.length%4==2?e+=`==`:e.length%4==3&&(e+=`=`),e=e.replace(/-/g,`+`),e=e.replace(/_/g,`/`),e}function Ye(e){return je(Je(e))}function Xe(e){return decodeURIComponent(it(e))}function Ze(e){for(var t=``,n=0;n<e.length-1;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t}function Qe(e){for(var t=``,n=0;n<e.length;n++)t+=(`0`+e.charCodeAt(n).toString(16)).slice(-2);return t}function $e(e){return Ae(e)}function et(e){var t=$e(e).replace(/(.{64})/g,`$1\r
|
|
256
|
+
`);return t=t.replace(/\r\n$/,``),t}function tt(e){return je(e.replace(/[^0-9A-Za-z\/+=]*/g,``))}function nt(e,t){var n=et(e);return`-----BEGIN `+t+`-----\r
|
|
257
|
+
`+n+`\r
|
|
258
|
+
-----END `+t+`-----\r
|
|
259
|
+
`}function rt(e,t){if(e.indexOf(`-----BEGIN `)==-1)throw`can't find PEM header: `+t;return t===void 0?(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,``),e=e.replace(/-----END [^-]+-----[^]*$/,``)):(e=e.replace(RegExp(`^[^]*-----BEGIN `+t+`-----`),``),e=e.replace(RegExp(`-----END `+t+`-----[^]*$`),``)),tt(e)}function it(e){return e.replace(/(..)/g,`%$1`)}function at(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw`malformed IPv6 address octet`;e=e.toLowerCase();for(var t=e.match(/.{1,4}/g),n=0;n<8;n++)t[n]=t[n].replace(/^0+/,``),t[n]==``&&(t[n]=`0`);e=`:`+t.join(`:`)+`:`;var r=e.match(/:(0:){2,}/g);if(r===null)return e.slice(1,-1);for(var i=``,n=0;n<r.length;n++)r[n].length>i.length&&(i=r[n]);return e=e.replace(i,`::`),e.slice(1,-1)}function ot(e){var t=`malformed hex value`;if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(e.length==8){var n;try{return n=parseInt(e.substr(0,2),16)+`.`+parseInt(e.substr(2,2),16)+`.`+parseInt(e.substr(4,2),16)+`.`+parseInt(e.substr(6,2),16),n}catch(e){throw t}}else if(e.length==32)return at(e);else return e}function st(e){function t(e){var t=parseInt(e.substr(0,2),16),n=parseInt(e.substr(2),16);if(t==0&n<128)return String.fromCharCode(n);if(t<8){var r=192|(t&7)<<3|(n&192)>>6,i=128|n&63;return Xe(r.toString(16)+i.toString(16))}var r=224|(t&240)>>4,i=128|(t&15)<<2|(n&192)>>6,a=128|n&63;return Xe(r.toString(16)+i.toString(16)+a.toString(16))}return e.match(/.{4}/g).map(t).join(``)}f.lang.String.isHex=function(e){return ct(e)};function ct(e){return!!(e.length%2==0&&(e.match(/^[0-9a-f]+$/)||e.match(/^[0-9A-F]+$/)))}f.lang.String.isMail=function(e){return e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)!==null};function lt(e){return e.length%2==1?`0`+e:e.substr(0,1)>`7`?`00`+e:e}function ut(e){if(!ct(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),a=[],o=0;o<i.length/2;o++)a.push(parseInt(i.substr(o*2,2),16));for(var s=[],c=``,o=0;o<a.length;o++)a[o]&128?c+=dt((a[o]&127).toString(2),7):(c+=dt((a[o]&127).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(e){return null}}var dt=function(e,t,n){return n==null&&(n=`0`),e.length>=t?e:Array(t-e.length+1).join(n)+e};function ft(e){try{var t=e.substr(0,2);if(t==`00`)return parseInt(e.substr(2),16);var n=parseInt(t,16),r=e.substr(2),i=parseInt(r,16).toString(2);return i==`0`&&(i=`00000000`),i=i.slice(0,0-n),parseInt(i,2)}catch(e){return-1}}(f.crypto===void 0||!f.crypto)&&(f.crypto={}),f.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:p.algo.MD5,sha1:p.algo.SHA1,sha224:p.algo.SHA224,sha256:p.algo.SHA256,sha384:p.algo.SHA384,sha512:p.algo.SHA512,ripemd160:p.algo.RIPEMD160},this.hashString=function(e,t){return new f.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new f.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`)}},f.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(e=f.crypto.MessageDigest.getCanonicalAlgName(e),e!==null&&t===void 0&&(t=f.crypto.Util.DEFAULTPROVIDER[e]),`:md5:sha1:sha224:sha256:sha384:sha512:ripemd160:`.indexOf(e)!=-1&&t==`cryptojs`){try{this.md=f.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=p.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(p.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(`:sha256:`.indexOf(e)!=-1&&t==`sjcl`){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},e!==void 0&&e.alg!==void 0&&(this.algName=e.alg,e.prov===void 0&&(this.provName=f.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},f.crypto.MessageDigest.getCanonicalAlgName=function(e){return typeof e==`string`&&(e=e.toLowerCase(),e=e.replace(/-/,``)),e},f.crypto.MessageDigest.getHashLength=function(e){var t=f.crypto.MessageDigest,n=t.getCanonicalAlgName(e);if(t.HASHLENGTH[n]===void 0)throw`not supported algorithm: `+e;return t.HASHLENGTH[n]},f.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},f.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(),this.pubkeyAlgName==`rsaandmgf1`&&this.mdAlgName==`sha`&&(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(),t!=`cryptojs/jsrsa`)throw Error(`provider not supported: `+t);if(`:md5:sha1:sha224:sha256:sha384:sha512:ripemd160:`.indexOf(this.mdAlgName)!=-1){try{this.md=new f.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw Error(`setAlgAndProvider hash alg set fail alg=`+this.mdAlgName+`/`+e)}this.init=function(e,t){var n=null;try{n=t===void 0?pt.getKey(e):pt.getKey(e,t)}catch(e){throw`init failed:`+e}if(n.isPrivate===!0)this.prvKey=n,this.state=`SIGN`;else if(n.isPublic===!0)this.pubKey=n,this.state=`VERIFY`;else throw`init failed.:`+n},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 B&&this.pubkeyAlgName===`rsaandmgf1`)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof B&&this.pubkeyAlgName===`rsa`)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,e!==void 0&&(e.alg!==void 0&&(this.algName=e.alg,e.prov===void 0?this.provName=f.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+`:`+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),e.psssaltlen!==void 0&&(this.pssSaltLen=e.psssaltlen),e.prvkeypem!==void 0)){if(e.prvkeypas!==void 0)throw`both prvkeypem and prvkeypas parameters not supported`;try{var t=pt.getKey(e.prvkeypem);this.init(t)}catch(e){throw`fatal error to load pem private key: `+e}}},f.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 pt=function(){var e=function(e,t,n){return r(p.AES,e,t,n)},t=function(e,t,n){return r(p.TripleDES,e,t,n)},n=function(e,t,n){return r(p.DES,e,t,n)},r=function(e,t,n,r){var i=p.enc.Hex.parse(t),a=p.enc.Hex.parse(n),o=p.enc.Hex.parse(r),s={};s.key=a,s.iv=o,s.ciphertext=i;var c=e.decrypt(s,a,{iv:o});return p.enc.Hex.stringify(c)},i=function(e,t,n){return s(p.AES,e,t,n)},a=function(e,t,n){return s(p.TripleDES,e,t,n)},o=function(e,t,n){return s(p.DES,e,t,n)},s=function(e,t,n,r){var i=p.enc.Hex.parse(t),a=p.enc.Hex.parse(n),o=p.enc.Hex.parse(r),s=e.encrypt(i,a,{iv:o}),c=p.enc.Hex.parse(s.toString());return p.enc.Base64.stringify(c)},c={"AES-256-CBC":{proc:e,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:t,eproc:a,keylen:24,ivlen:8},"DES-CBC":{proc:n,eproc:o,keylen:8,ivlen:8}},l=function(e){var t=p.lib.WordArray.random(e);return p.enc.Hex.stringify(t)},u=function(e){var t={},n=e.match(RegExp(`DEK-Info: ([^,]+),([0-9A-Fa-f]+)`,`m`));n&&(t.cipher=n[1],t.ivsalt=n[2]);var r=e.match(RegExp(`-----BEGIN ([A-Z]+) PRIVATE KEY-----`));r&&(t.type=r[1]);var i=-1,a=0;e.indexOf(`\r
|
|
260
|
+
\r
|
|
261
|
+
`)!=-1&&(i=e.indexOf(`\r
|
|
262
|
+
\r
|
|
263
|
+
`),a=2),e.indexOf(`
|
|
264
|
+
|
|
265
|
+
`)!=-1&&(i=e.indexOf(`
|
|
266
|
+
|
|
267
|
+
`),a=1);var o=e.indexOf(`-----END`);if(i!=-1&&o!=-1){var s=e.substring(i+a*2,o-a);s=s.replace(/\s+/g,``),t.data=s}return t},d=function(e,t,n){for(var r=n.substring(0,16),i=p.enc.Hex.parse(r),a=p.enc.Utf8.parse(t),o=c[e].keylen+c[e].ivlen,s=``,l=null;;){var u=p.algo.MD5.create();if(l!=null&&u.update(l),u.update(a),u.update(i),l=u.finalize(),s+=p.enc.Hex.stringify(l),s.length>=o*2)break}var d={};return d.keyhex=s.substr(0,c[e].keylen*2),d.ivhex=s.substr(c[e].keylen*2,c[e].ivlen*2),d},m=function(e,t,n,r){var i=p.enc.Base64.parse(e),a=p.enc.Hex.stringify(i),o=c[t].proc;return o(a,n,r)},h=function(e,t,n,r){var i=c[t].eproc;return i(e,n,r)};return{version:`1.0.0`,parsePKCS5PEM:function(e){return u(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,n){return d(e,t,n)},decryptKeyB64:function(e,t,n,r){return m(e,t,n,r)},getDecryptedKeyHex:function(e,t){var n=u(e);n.type;var r=n.cipher,i=n.ivsalt,a=n.data,o=d(r,t,i).keyhex;return m(a,r,o,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,n,r,i){var a=``;if((r===void 0||r==null)&&(r=`AES-256-CBC`),c[r]===void 0)throw`KEYUTIL unsupported algorithm: `+r;if(i===void 0||i==null){var o=c[r].ivlen;i=l(o).toUpperCase()}var s=d(r,n,i).keyhex,u=h(t,r,s,i).replace(/(.{64})/g,`$1\r
|
|
268
|
+
`),a=`-----BEGIN `+e+` PRIVATE KEY-----\r
|
|
269
|
+
`;return a+=`Proc-Type: 4,ENCRYPTED\r
|
|
270
|
+
`,a+=`DEK-Info: `+r+`,`+i+`\r
|
|
271
|
+
`,a+=`\r
|
|
272
|
+
`,a+=u,a+=`\r
|
|
273
|
+
-----END `+e+` PRIVATE KEY-----\r
|
|
274
|
+
`,a},parseHexOfEncryptedPKCS8:function(e){var t=V,n=t.getChildIdx,r=t.getV,i={},a=n(e,0);if(a.length!=2)throw`malformed format: SEQUENCE(0).items != 2: `+a.length;i.ciphertext=r(e,a[1]);var o=n(e,a[0]);if(o.length!=2)throw`malformed format: SEQUENCE(0.0).items != 2: `+o.length;if(r(e,o[0])!=`2a864886f70d01050d`)throw`this only supports pkcs5PBES2`;var s=n(e,o[1]);if(o.length!=2)throw`malformed format: SEQUENCE(0.0.1).items != 2: `+s.length;var c=n(e,s[1]);if(c.length!=2)throw`malformed format: SEQUENCE(0.0.1.1).items != 2: `+c.length;if(r(e,c[0])!=`2a864886f70d0307`)throw`this only supports TripleDES`;i.encryptionSchemeAlg=`TripleDES`,i.encryptionSchemeIV=r(e,c[1]);var l=n(e,s[0]);if(l.length!=2)throw`malformed format: SEQUENCE(0.0.1.0).items != 2: `+l.length;if(r(e,l[0])!=`2a864886f70d01050c`)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 d=r(e,u[1]);try{i.pbkdf2Iter=parseInt(d,16)}catch(e){throw`malformed format pbkdf2Iter: `+d}return i},getPBKDF2KeyHexFromParam:function(e,t){var n=p.enc.Hex.parse(e.pbkdf2Salt),r=e.pbkdf2Iter,i=p.PBKDF2(t,n,{keySize:192/32,iterations:r});return p.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var n=rt(e,`ENCRYPTED PRIVATE KEY`),r=this.parseHexOfEncryptedPKCS8(n),i=pt.getPBKDF2KeyHexFromParam(r,t),a={};a.ciphertext=p.enc.Hex.parse(r.ciphertext);var o=p.enc.Hex.parse(i),s=p.enc.Hex.parse(r.encryptionSchemeIV),c=p.TripleDES.decrypt(a,o,{iv:s});return p.enc.Hex.stringify(c)},getKeyFromEncryptedPKCS8PEM:function(e,t){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function(e){var t=V,n=t.getChildIdx,r=t.getV,i={};if(i.algparam=null,e.substr(0,2)!=`30`)throw Error(`malformed plain PKCS8 private key(code:001)`);var a=n(e,0);if(a.length<3)throw Error(`malformed plain PKCS8 private key(code:002)`);if(e.substr(a[1],2)!=`30`)throw Error(`malformed PKCS8 private key(code:003)`);var o=n(e,a[1]);if(o.length!=2)throw Error(`malformed PKCS8 private key(code:004)`);if(e.substr(o[0],2)!=`06`)throw Error(`malformed PKCS8 private key(code:005)`);if(i.algoid=r(e,o[0]),e.substr(o[1],2)==`06`&&(i.algparam=r(e,o[1])),e.substr(a[2],2)!=`04`)throw Error(`malformed PKCS8 private key(code:006)`);return i.keyidx=t.getVidx(e,a[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=rt(e,`PRIVATE KEY`);return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t=this.parsePlainPrivatePKCS8Hex(e),n;if(t.algoid==`2a864886f70d010101`)n=new B;else if(f.crypto.DSA&&t.algoid==`2a8648ce380401`)n=new f.crypto.DSA;else if(f.crypto.ECDSA&&t.algoid==`2a8648ce3d0201`)n=new f.crypto.ECDSA;else throw`unsupported private key algorithm`;return n.readPKCS8PrvKeyHex(e),n},_getKeyFromPublicPKCS8Hex:function(e){var t,n=V.getVbyList(e,0,[0,0],`06`);if(n===`2a864886f70d010101`)t=new B;else if(f.crypto.DSA&&n===`2a8648ce380401`)t=new f.crypto.DSA;else if(f.crypto.ECDSA&&n===`2a8648ce3d0201`)t=new f.crypto.ECDSA;else throw`unsupported PKCS#8 public key hex`;return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=V,n=t.getChildIdx,r=t.getV,i={};if(e.substr(0,2)!=`30`)throw`malformed RSA key(code:001)`;var a=n(e,0);if(a.length!=2)throw`malformed RSA key(code:002)`;if(e.substr(a[0],2)!=`02`)throw`malformed RSA key(code:003)`;if(i.n=r(e,a[0]),e.substr(a[1],2)!=`02`)throw`malformed RSA key(code:004)`;return i.e=r(e,a[1]),i},parsePublicPKCS8Hex:function(e){var t=V,n=t.getChildIdx,r=t.getV,i={};i.algparam=null;var a=n(e,0);if(a.length!=2)throw`outer DERSequence shall have 2 elements: `+a.length;var o=a[0];if(e.substr(o,2)!=`30`)throw`malformed PKCS8 public key(code:001)`;var s=n(e,o);if(s.length!=2)throw`malformed PKCS8 public key(code:002)`;if(e.substr(s[0],2)!=`06`)throw`malformed PKCS8 public key(code:003)`;if(i.algoid=r(e,s[0]),e.substr(s[1],2)==`06`?i.algparam=r(e,s[1]):e.substr(s[1],2)==`30`&&(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`)),e.substr(a[1],2)!=`03`)throw`malformed PKCS8 public key(code:004)`;return i.key=r(e,a[1]).substr(2),i}}}();pt.getKey=function(e,t,n){var r=V,i=r.getChildIdx;r.getV;var a=r.getVbyList,o=f.crypto,s=o.ECDSA,c=o.DSA,l=B,u=rt,d=pt;if(l!==void 0&&e instanceof l||s!==void 0&&e instanceof s||c!==void 0&&e instanceof c)return e;if(e.curve!==void 0&&e.xy!==void 0&&e.d===void 0)return new s({pub:e.xy,curve:e.curve});if(e.curve!==void 0&&e.d!==void 0)return new s({prv:e.d,curve:e.curve});if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var p=new l;return p.setPublic(e.n,e.e),p}if(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===void 0){var p=new l;return p.setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),p}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p===void 0){var p=new l;return p.setPrivate(e.n,e.e,e.d),p}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x===void 0){var p=new c;return p.setPublic(e.p,e.q,e.g,e.y),p}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x!==void 0){var p=new c;return p.setPrivate(e.p,e.q,e.g,e.y,e.x),p}if(e.kty===`RSA`&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var p=new l;return p.setPublic(Ye(e.n),Ye(e.e)),p}if(e.kty===`RSA`&&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!==void 0){var p=new l;return p.setPrivateEx(Ye(e.n),Ye(e.e),Ye(e.d),Ye(e.p),Ye(e.q),Ye(e.dp),Ye(e.dq),Ye(e.qi)),p}if(e.kty===`RSA`&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0){var p=new l;return p.setPrivate(Ye(e.n),Ye(e.e),Ye(e.d)),p}if(e.kty===`EC`&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d===void 0){var m=new s({curve:e.crv}),h=m.ecparams.keylen/4,_=(`0000000000`+Ye(e.x)).slice(-h),v=(`0000000000`+Ye(e.y)).slice(-h),y=`04`+_+v;return m.setPublicKeyHex(y),m}if(e.kty===`EC`&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d!==void 0){var m=new s({curve:e.crv}),h=m.ecparams.keylen/4,_=(`0000000000`+Ye(e.x)).slice(-h),v=(`0000000000`+Ye(e.y)).slice(-h),y=`04`+_+v,b=(`0000000000`+Ye(e.d)).slice(-h);return m.setPublicKeyHex(y),m.setPrivateKeyHex(b),m}if(n===`pkcs5prv`){var x=e,r=V,S=i(x,0),p;if(S.length===9)p=new l,p.readPKCS5PrvKeyHex(x);else if(S.length===6)p=new c,p.readPKCS5PrvKeyHex(x);else if(S.length>2&&x.substr(S[1],2)===`04`)p=new s,p.readPKCS5PrvKeyHex(x);else throw`unsupported PKCS#1/5 hexadecimal key`;return p}if(n===`pkcs8prv`){var p=d.getKeyFromPlainPrivatePKCS8Hex(e);return p}if(n===`pkcs8pub`)return d._getKeyFromPublicPKCS8Hex(e);if(n===`x509pub`)return ht.getPublicKeyFromCertHex(e);if(e.indexOf(`-END CERTIFICATE-`,0)!=-1||e.indexOf(`-END X509 CERTIFICATE-`,0)!=-1||e.indexOf(`-END TRUSTED CERTIFICATE-`,0)!=-1)return ht.getPublicKeyFromCertPEM(e);if(e.indexOf(`-END PUBLIC KEY-`)!=-1){var C=rt(e,`PUBLIC KEY`);return d._getKeyFromPublicPKCS8Hex(C)}if(e.indexOf(`-END RSA PRIVATE KEY-`)!=-1&&e.indexOf(`4,ENCRYPTED`)==-1){var w=u(e,`RSA PRIVATE KEY`);return d.getKey(w,null,`pkcs5prv`)}if(e.indexOf(`-END DSA PRIVATE KEY-`)!=-1&&e.indexOf(`4,ENCRYPTED`)==-1){var T=u(e,`DSA PRIVATE KEY`),E=a(T,0,[1],`02`),D=a(T,0,[2],`02`),O=a(T,0,[3],`02`),k=a(T,0,[4],`02`),A=a(T,0,[5],`02`),p=new c;return p.setPrivate(new g(E,16),new g(D,16),new g(O,16),new g(k,16),new g(A,16)),p}if(e.indexOf(`-END EC PRIVATE KEY-`)!=-1&&e.indexOf(`4,ENCRYPTED`)==-1){var w=u(e,`EC PRIVATE KEY`);return d.getKey(w,null,`pkcs5prv`)}if(e.indexOf(`-END PRIVATE KEY-`)!=-1)return d.getKeyFromPlainPrivatePKCS8PEM(e);if(e.indexOf(`-END RSA PRIVATE KEY-`)!=-1&&e.indexOf(`4,ENCRYPTED`)!=-1){var j=d.getDecryptedKeyHex(e,t),M=new B;return M.readPKCS5PrvKeyHex(j),M}if(e.indexOf(`-END EC PRIVATE KEY-`)!=-1&&e.indexOf(`4,ENCRYPTED`)!=-1){var T=d.getDecryptedKeyHex(e,t),p=a(T,0,[1],`04`),N=a(T,0,[2,0],`06`),ee=a(T,0,[3,0],`03`).substr(2),P=``;if(f.crypto.OID.oidhex2name[N]!==void 0)P=f.crypto.OID.oidhex2name[N];else throw`undefined OID(hex) in KJUR.crypto.OID: `+N;var m=new s({curve:P});return m.setPublicKeyHex(ee),m.setPrivateKeyHex(p),m.isPublic=!1,m}if(e.indexOf(`-END DSA PRIVATE KEY-`)!=-1&&e.indexOf(`4,ENCRYPTED`)!=-1){var T=d.getDecryptedKeyHex(e,t),E=a(T,0,[1],`02`),D=a(T,0,[2],`02`),O=a(T,0,[3],`02`),k=a(T,0,[4],`02`),A=a(T,0,[5],`02`),p=new c;return p.setPrivate(new g(E,16),new g(D,16),new g(O,16),new g(k,16),new g(A,16)),p}if(e.indexOf(`-END ENCRYPTED PRIVATE KEY-`)!=-1)return d.getKeyFromEncryptedPKCS8PEM(e,t);throw Error(`not supported argument`)},(f.asn1===void 0||!f.asn1)&&(f.asn1={}),f.asn1.ASN1Util={},f.asn1.ASN1Util.oidHexToInt=function(e){for(var t=``,n=parseInt(e.substr(0,2),16),r=Math.floor(n/40),i=n%40,t=r+`.`+i,a=``,o=2;o<e.length;o+=2){var s=(`00000000`+parseInt(e.substr(o,2),16).toString(2)).slice(-8);if(a+=s.substr(1,7),s.substr(0,1)==`0`){var c=new g(a,2);t=t+`.`+c.toString(10),a=``}}return t};var V=new function(){};V.getLblen=function(e,t){if(e.substr(t+2,1)!=`8`)return 1;var n=parseInt(e.substr(t+3,1));return n==0?-1:0<n&&n<10?n+1:-2},V.getL=function(e,t){var n=V.getLblen(e,t);return n<1?``:e.substr(t+2,n*2)},V.getVblen=function(e,t){var n=V.getL(e,t),r;return n==``?-1:(r=n.substr(0,1)===`8`?new g(n.substr(2),16):new g(n,16),r.intValue())},V.getVidx=function(e,t){var n=V.getLblen(e,t);return n<0?n:t+(n+1)*2},V.getV=function(e,t){var n=V.getVidx(e,t),r=V.getVblen(e,t);return e.substr(n,r*2)},V.getTLV=function(e,t){return e.substr(t,2)+V.getL(e,t)+V.getV(e,t)},V.getTLVblen=function(e,t){return 2+V.getLblen(e,t)*2+V.getVblen(e,t)*2},V.getNextSiblingIdx=function(e,t){return V.getVidx(e,t)+V.getVblen(e,t)*2},V.getChildIdx=function(e,t){var n=V,r=[],i=n.getVidx(e,t),a=n.getVblen(e,t)*2,o;e.substr(t,2)==`03`&&(i+=2,a-=2),o=0;for(var s=i;o<=a;){var c=n.getTLVblen(e,s);if(o+=c,o<=a&&r.push(s),s+=c,o>=a)break}return r},V.getNthChildIdx=function(e,t,n){return V.getChildIdx(e,t)[n]},V.getIdxbyList=function(e,t,n,r){var i=V,a,o;return n.length==0?r!==void 0&&e.substr(t,2)!==r?-1:t:(a=n.shift(),o=i.getChildIdx(e,t),a>=o.length?-1:i.getIdxbyList(e,o[a],n,r))},V.getIdxbyListEx=function(e,t,n,r){var i=V,a,o;if(n.length==0)return r!==void 0&&e.substr(t,2)!==r?-1:t;a=n.shift(),o=i.getChildIdx(e,t);for(var s=0,c=0;c<o.length;c++){var l=e.substr(o[c],2);if(typeof a==`number`&&!i.isContextTag(l)&&s==a||typeof a==`string`&&i.isContextTag(l,a))return i.getIdxbyListEx(e,o[c],n,r);i.isContextTag(l)||s++}return-1},V.getTLVbyList=function(e,t,n,r){var i=V,a=i.getIdxbyList(e,t,n,r);return a==-1||a>=e.length?null:i.getTLV(e,a)},V.getTLVbyListEx=function(e,t,n,r){var i=V,a=i.getIdxbyListEx(e,t,n,r);return a==-1?null:i.getTLV(e,a)},V.getVbyList=function(e,t,n,r,i){var a=V,o=a.getIdxbyList(e,t,n,r),s;return o==-1||o>=e.length?null:(s=a.getV(e,o),i===!0&&(s=s.substr(2)),s)},V.getVbyListEx=function(e,t,n,r,i){var a=V,o=a.getIdxbyListEx(e,t,n,r),s;return o==-1?null:(s=a.getV(e,o),e.substr(o,2)==`03`&&i!==!1&&(s=s.substr(2)),s)},V.getInt=function(e,t,n){n==null&&(n=-1);try{var r=e.substr(t,2);if(r!=`02`&&r!=`03`)return n;var i=V.getV(e,t);return r==`02`?parseInt(i,16):ft(i)}catch(e){return n}},V.getOID=function(e,t,n){n==null&&(n=null);try{return e.substr(t,2)==`06`?ut(V.getV(e,t)):n}catch(e){return n}},V.getOIDName=function(e,t,n){n==null&&(n=null);try{var r=V.getOID(e,t,n);if(r==n)return n;var i=f.asn1.x509.OID.oid2name(r);return i==``?r:i}catch(e){return n}},V.getString=function(e,t,n){n==null&&(n=null);try{return Ze(V.getV(e,t))}catch(e){return n}},V.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e: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 a=e.substr(2),o=[],s=0;s<a.length/2;s++)o.push(parseInt(a.substr(s*2,2),16));for(var c=[],l=``,s=0;s<o.length;s++)o[s]&128?l+=t((o[s]&127).toString(2),7):(l+=t((o[s]&127).toString(2),7),c.push(new String(parseInt(l,2))),l=``);var u=n.join(`.`);return c.length>0&&(u=u+`.`+c.join(`.`)),u},V.isContextTag=function(e,t){e=e.toLowerCase();var n,r;try{n=parseInt(e,16)}catch(e){return-1}if(t===void 0)return(n&192)==128;try{return t.match(/^\[[0-9]+\]$/)==null||(r=parseInt(t.substr(1,t.length-1),10),r>31)?!1:(n&192)==128&&(n&31)==r}catch(e){return!1}},V.isASN1HEX=function(e){var t=V;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==n*2},V.checkStrictDER=function(e,t,n,r,i){var a=V;if(n===void 0){if(typeof e!=`string`||(e=e.toLowerCase(),!f.lang.String.isHex(e)))throw Error(`not hex string`);n=e.length,r=e.length/2,i=r<128?1:Math.ceil(r.toString(16))+1}if(a.getL(e,t).length>i*2)throw Error(`L of TLV too long: idx=`+t);var o=a.getVblen(e,t);if(o>r)throw Error(`value of L too long than hex: idx=`+t);var s=a.getTLV(e,t),c=s.length-2-a.getL(e,t).length;if(c!==o*2)throw Error(`V string length and L's value not the same:`+c+`/`+o*2);if(t===0&&e.length!=s.length)throw Error(`total length and TLV length unmatch:`+e.length+`!=`+s.length);var l=e.substr(t,2);if(l===`02`){var u=a.getVidx(e,t);if(e.substr(u,2)==`00`&&e.charCodeAt(u+2)<56)throw Error(`not least zeros for DER INTEGER`)}if(parseInt(l,16)&32){for(var d=a.getVblen(e,t),p=0,m=a.getChildIdx(e,t),h=0;h<m.length;h++){var g=a.getTLV(e,m[h]);p+=g.length,a.checkStrictDER(e,m[h],n,r,i)}if(d*2!=p)throw Error(`sum of children's TLV length and L unmatch: `+d*2+`!=`+p)}},V.oidname=function(e){var t=f.asn1;f.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var n=t.x509.OID.oid2name(e);return n===``&&(n=e),n},(f.asn1===void 0||!f.asn1)&&(f.asn1={}),(f.asn1.x509===void 0||!f.asn1.x509)&&(f.asn1.x509={}),f.asn1.x509.AlgorithmIdentifier={},f.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:`300d06092a864886f70d01010a3000`,SHA256withRSAandMGF1:`303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120`,SHA384withRSAandMGF1:`303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130`,SHA512withRSAandMGF1:`303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140`},f.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(this.objCache[e]!==void 0)return this.objCache[e];if(this.name2oidList[e]===void 0)throw`Name of ObjectIdentifier not defined: `+e;var t=this.name2oidList[e],n=new f.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n},this.atype2obj=function(e){if(this.objCache[e]!==void 0)return this.objCache[e];var t;if(e.match(/^\d+\.\d+\.[0-9.]+$/))t=e;else if(this.atype2oidList[e]!==void 0)t=this.atype2oidList[e];else if(this.name2oidList[e]!==void 0)t=this.name2oidList[e];else throw`AttributeType name undefined: `+e;var n=new f.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n}},f.asn1.x509.OID.oid2name=function(e){var t=f.asn1.x509.OID.name2oidList;for(var n in t)if(t[n]==e)return n;return``},f.asn1.x509.OID.oid2atype=function(e){var t=f.asn1.x509.OID.atype2oidList;for(var n in t)if(t[n]==e)return n;return e},f.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=f.asn1.x509.OID.name2oidList;return t[e]===void 0?``:t[e]},B.getPosArrayOfChildrenFromHex=function(e){return V.getChildIdx(e,0)},B.getHexValueArrayOfChildrenFromHex=function(e){var t=V.getV,n=B.getPosArrayOfChildrenFromHex(e),r=t(e,n[0]),i=t(e,n[1]),a=t(e,n[2]),o=t(e,n[3]),s=t(e,n[4]),c=t(e,n[5]),l=t(e,n[6]),u=t(e,n[7]),d=t(e,n[8]),n=[];return n.push(r,i,a,o,s,c,l,u,d),n},B.prototype.readPrivateKeyFromPEMString=function(e){var t=rt(e),n=B.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},B.prototype.readPKCS5PrvKeyHex=function(e){var t=B.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},B.prototype.readPKCS8PrvKeyHex=function(e){var t,n,r,i,a,o,s,c,l=V,u=l.getVbyListEx;if(l.isASN1HEX(e)===!1)throw 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`),a=u(e,0,[2,0,5],`02`),o=u(e,0,[2,0,6],`02`),s=u(e,0,[2,0,7],`02`),c=u(e,0,[2,0,8],`02`)}catch(e){throw Error(`malformed PKCS#8 plain RSA private key`)}this.setPrivateEx(t,n,r,i,a,o,s,c)},B.prototype.readPKCS5PubKeyHex=function(e){var t=V,n=t.getV;if(t.isASN1HEX(e)===!1)throw Error(`keyHex is not ASN.1 hex string`);var r=t.getChildIdx(e,0);if(r.length!==2||e.substr(r[0],2)!==`02`||e.substr(r[1],2)!==`02`)throw Error(`wrong hex for PKCS#5 public key`);var i=n(e,r[0]),a=n(e,r[1]);this.setPublic(i,a)},B.prototype.readPKCS8PubKeyHex=function(e){var t=V;if(t.isASN1HEX(e)===!1)throw Error(`not ASN.1 hex string`);if(t.getTLVbyListEx(e,0,[0,0])!==`06092a864886f70d010101`)throw Error(`not PKCS8 RSA public key`);var n=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(n)},B.prototype.readCertPubKeyHex=function(e,t){var n=new ht,r;n.readCertHex(e),r=n.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};function mt(e){for(var t in f.crypto.Util.DIGESTINFOHEAD){var n=f.crypto.Util.DIGESTINFOHEAD[t],r=n.length;if(e.substring(0,r)==n)return[t,e.substring(r)]}return[]}B.prototype.verify=function(e,t){if(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null)return!1;var n=Me(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 a=mt(i.replace(/^1f+00/,``));if(a.length==0)return!1;var o=a[0];return a[1]==function(e){return f.crypto.Util.hashString(e,o)}(e)},B.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var n=Me(t,16);if(n.bitLength()>this.n.bitLength())return 0;var r=mt(this.doPublic(n).toString(16).replace(/^1f+00/,``));return r.length==0?!1:(r[0],r[1]==e)},B.prototype.verifyPSS=function(e,t,n,r){var i=function(e){return f.crypto.Util.hashHex(e,n)}(Qe(e));return r===void 0&&(r=-1),this.verifyWithMessageHashPSS(i,t,n,r)},B.prototype.verifyWithMessageHashPSS=function(e,t,n,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=new g(t,16),a=function(e){return f.crypto.Util.hashHex(e,n)},o=Ze(e),s=o.length,c=this.n.bitLength()-1,l=Math.ceil(c/8),u;if(r===-1||r===void 0)r=s;else if(r===-2)r=l-s-2;else if(r<-2)throw Error(`invalid salt length`);if(l<s+r+2)throw Error(`data too long`);var d=this.doPublic(i).toByteArray();for(u=0;u<d.length;u+=1)d[u]&=255;for(;d.length<l;)d.unshift(0);if(d[l-1]!==188)throw Error(`encoded message does not end in 0xbc`);d=String.fromCharCode.apply(String,d);var p=d.substr(0,l-s-1),m=d.substr(p.length,s),h=65280>>8*l-c&255;if((p.charCodeAt(0)&h)!==0)throw Error(`bits beyond keysize not zero`);var _=pss_mgf1_str(m,p.length,a),v=[];for(u=0;u<p.length;u+=1)v[u]=p.charCodeAt(u)^_.charCodeAt(u);v[0]&=~h;var y=l-s-r-2;for(u=0;u<y;u+=1)if(v[u]!==0)throw Error(`leftmost octets not zero`);if(v[y]!==1)throw Error(`0x01 marker not found`);return m===Ze(a(Qe(`\0\0\0\0\0\0\0\0`+o+String.fromCharCode.apply(String,v.slice(-r)))))},B.SALT_LEN_HLEN=-1,B.SALT_LEN_MAX=-2,B.SALT_LEN_RECOVER=-2;function ht(e){var t=V,n=t.getChildIdx,r=t.getV,i=t.getTLV,a=t.getVbyList,o=t.getVbyListEx,s=t.getTLVbyList,c=t.getTLVbyListEx,l=t.getIdxbyList,u=t.getIdxbyListEx,d=t.getVidx,p=t.getInt,m=t.oidname,h=t.hextooidstr,g=rt,_;try{_=f.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(this.hex===null||this.version!==0)return this.version;var e=s(this.hex,0,[0,0]);if(e.substr(0,2)==`a0`){var t=p(s(e,0,[0]),0);if(t<0||2<t)throw Error(`malformed version field`);return this.version=t+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return o(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 t in _)if(e===_[t])return t;return m(o(e,0,[0],`06`))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return s(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 s(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),e},this.getNotAfter=function(){var e=a(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,`%$1`),e=decodeURIComponent(e),e},this.getPublicKeyHex=function(){return t.getTLVbyList(this.hex,0,[0,6+this.foffset],`30`)},this.getPublicKeyIdx=function(){return l(this.hex,0,[0,6+this.foffset],`30`)},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return l(this.hex,e,[1,0],`30`)},this.getPublicKey=function(){return pt.getKey(this.getPublicKeyHex(),null,`pkcs8pub`)},this.getSignatureAlgorithmName=function(){var e=s(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=s(this.hex,0,[0],`30`),i=new f.crypto.Signature({alg:t});return i.init(e),i.updateHex(r),i.verify(n)},this.parseExt=function(e){var i,o,s;if(e===void 0){if(s=this.hex,this.version!==3)return-1;i=l(s,0,[0,7,0],`30`),o=n(s,i)}else{s=rt(e);var c=l(s,0,[0,3,0,0],`06`);if(r(s,c)!=`2a864886f70d01090e`){this.aExtInfo=[];return}i=l(s,0,[0,3,0,1,0],`30`),o=n(s,i),this.hex=s}this.aExtInfo=[];for(var u=0;u<o.length;u++){var f={};f.critical=!1;var p=n(s,o[u]),m=0;p.length===3&&(f.critical=!0,m=1),f.oid=t.hextooidstr(a(s,o[u],[0],`06`));var h=l(s,o[u],[1+m]);f.vidx=d(s,h),this.aExtInfo.push(f)}},this.getExtInfo=function(e){var t=this.aExtInfo,n=e;if(e.match(/^[0-9.]+$/)||(n=f.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(e===void 0&&t===void 0){var n=this.getExtInfo(`basicConstraints`);if(n===void 0)return;e=i(this.hex,n.vidx),t=n.critical}var a={extname:`basicConstraints`};if(t&&(a.critical=!0),e===`3000`)return a;if(e===`30030101ff`)return a.cA=!0,a;if(e.substr(0,12)===`30060101ff02`){var o=r(e,10),s=parseInt(o,16);return a.cA=!0,a.pathLen=s,a}throw Error(`hExtV parse error: `+e)},this.getExtKeyUsage=function(e,t){if(e===void 0&&t===void 0){var n=this.getExtInfo(`keyUsage`);if(n===void 0)return;e=i(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(e===void 0){var t=this.getExtInfo(`keyUsage`);if(t===void 0)return``;e=i(this.hex,t.vidx)}if(e.length!=8&&e.length!=10)throw Error(`malformed key usage value: `+e);var n=`000000000000000`+parseInt(e.substr(6),16).toString(2);return e.length==8&&(n=n.slice(-8)),e.length==10&&(n=n.slice(-16)),n=n.replace(/0+$/,``),n==``&&(n=`0`),n},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),n=[],r=0;r<t.length;r++)t.substr(r,1)==`1`&&n.push(ht.KEYUSAGE_NAME[r]);return n.join(`,`)},this.getExtSubjectKeyIdentifier=function(e,t){if(e===void 0&&t===void 0){var n=this.getExtInfo(`subjectKeyIdentifier`);if(n===void 0)return;e=i(this.hex,n.vidx),t=n.critical}var a={extname:`subjectKeyIdentifier`};return t&&(a.critical=!0),a.kid={hex:r(e,0)},a},this.getExtAuthorityKeyIdentifier=function(e,t){if(e===void 0&&t===void 0){var a=this.getExtInfo(`authorityKeyIdentifier`);if(a===void 0)return;e=i(this.hex,a.vidx),t=a.critical}var o={extname:`authorityKeyIdentifier`};t&&(o.critical=!0);for(var s=n(e,0),c=0;c<s.length;c++){var l=e.substr(s[c],2);if(l===`80`&&(o.kid={hex:r(e,s[c])}),l===`a1`){var u=i(e,s[c]);o.issuer=this.getGeneralNames(u)[0].dn}l===`82`&&(o.sn={hex:r(e,s[c])})}return o},this.getExtExtKeyUsage=function(e,t){if(e===void 0&&t===void 0){var a=this.getExtInfo(`extKeyUsage`);if(a===void 0)return;e=i(this.hex,a.vidx),t=a.critical}var o={extname:`extKeyUsage`,array:[]};t&&(o.critical=!0);for(var s=n(e,0),c=0;c<s.length;c++)o.array.push(m(r(e,s[c])));return o},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo(`extKeyUsage`);if(e===void 0)return e;var t=[],a=i(this.hex,e.vidx);if(a===``)return t;for(var o=n(a,0),s=0;s<o.length;s++)t.push(m(r(a,o[s])));return t},this.getExtSubjectAltName=function(e,t){if(e===void 0&&t===void 0){var n=this.getExtInfo(`subjectAltName`);if(n===void 0)return;e=i(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(e===void 0&&t===void 0){var n=this.getExtInfo(`issuerAltName`);if(n===void 0)return;e=i(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=n(e,0),r=[],a=0;a<t.length;a++){var o=this.getGeneralName(i(e,t[a]));o!==void 0&&r.push(o)}return r},this.getGeneralName=function(e){var t=e.substr(0,2),n=r(e,0),i=Ze(n);if(t==`81`)return{rfc822:i};if(t==`82`)return{dns:i};if(t==`86`)return{uri:i};if(t==`87`)return{ip:ot(n)};if(t==`a4`)return{dn:this.getX500Name(n)}},this.getExtSubjectAltName2=function(){var e,t,a,o=this.getExtInfo(`subjectAltName`);if(o===void 0)return o;for(var s=[],c=i(this.hex,o.vidx),l=n(c,0),u=0;u<l.length;u++)a=c.substr(l[u],2),e=r(c,l[u]),a===`81`&&(t=Xe(e),s.push([`MAIL`,t])),a===`82`&&(t=Xe(e),s.push([`DNS`,t])),a===`84`&&(t=ht.hex2dn(e,0),s.push([`DN`,t])),a===`86`&&(t=Xe(e),s.push([`URI`,t])),a===`87`&&(t=ot(e),s.push([`IP`,t]));return s},this.getExtCRLDistributionPoints=function(e,t){if(e===void 0&&t===void 0){var r=this.getExtInfo(`cRLDistributionPoints`);if(r===void 0)return;e=i(this.hex,r.vidx),t=r.critical}var a={extname:`cRLDistributionPoints`,array:[]};t&&(a.critical=!0);for(var o=n(e,0),s=0;s<o.length;s++){var c=i(e,o[s]);a.array.push(this.getDistributionPoint(c))}return a},this.getDistributionPoint=function(e){for(var t={},r=n(e,0),a=0;a<r.length;a++){var o=e.substr(r[a],2),s=i(e,r[a]);o==`a0`&&(t.dpname=this.getDistributionPointName(s))}return t},this.getDistributionPointName=function(e){for(var t={},r=n(e,0),a=0;a<r.length;a++){var o=e.substr(r[a],2),s=i(e,r[a]);o==`a0`&&(t.full=this.getGeneralNames(s))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtInfo(`cRLDistributionPoints`);if(e===void 0)return e;for(var t=[],r=n(this.hex,e.vidx),i=0;i<r.length;i++)try{var o=Xe(a(this.hex,r[i],[0,0,0],`86`));t.push(o)}catch(e){}return t},this.getExtAIAInfo=function(){var e=this.getExtInfo(`authorityInfoAccess`);if(e===void 0)return e;for(var t={ocsp:[],caissuer:[]},r=n(this.hex,e.vidx),i=0;i<r.length;i++){var o=a(this.hex,r[i],[0],`06`),s=a(this.hex,r[i],[1],`86`);o===`2b06010505073001`&&t.ocsp.push(Xe(s)),o===`2b06010505073002`&&t.caissuer.push(Xe(s))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(e===void 0&&t===void 0){var r=this.getExtInfo(`authorityInfoAccess`);if(r===void 0)return;e=i(this.hex,r.vidx),t=r.critical}var s={extname:`authorityInfoAccess`,array:[]};t&&(s.critical=!0);for(var c=n(e,0),l=0;l<c.length;l++){var u=o(e,c[l],[0],`06`),d=Xe(a(e,c[l],[1],`86`));if(u==`2b06010505073001`)s.array.push({ocsp:d});else if(u==`2b06010505073002`)s.array.push({caissuer:d});else throw Error(`unknown method: `+u)}return s},this.getExtCertificatePolicies=function(e,t){if(e===void 0&&t===void 0){var r=this.getExtInfo(`certificatePolicies`);if(r===void 0)return;e=i(this.hex,r.vidx),t=r.critical}var a={extname:`certificatePolicies`,array:[]};t&&(a.critical=!0);for(var o=n(e,0),s=0;s<o.length;s++){var c=i(e,o[s]),l=this.getPolicyInformation(c);a.array.push(l)}return a},this.getPolicyInformation=function(e){var t={};t.policyoid=m(a(e,0,[0],`06`));var r=u(e,0,[1],`30`);if(r!=-1){t.array=[];for(var o=n(e,r),s=0;s<o.length;s++){var c=i(e,o[s]),l=this.getPolicyQualifierInfo(c);t.array.push(l)}}return t},this.getPolicyQualifierInfo=function(e){var t={},n=a(e,0,[0],`06`);if(n===`2b06010505070201`)t.cps=Ze(o(e,0,[1],`16`));else if(n===`2b06010505070202`){var r=s(e,0,[1],`30`);t.unotice=this.getUserNotice(r)}return t},this.getUserNotice=function(e){for(var t={},r=n(e,0),a=0;a<r.length;a++){var o=i(e,r[a]);o.substr(0,2)!=`30`&&(t.exptext=this.getDisplayText(o))}return t},this.getDisplayText=function(e){var t={"0c":`utf8`,16:`ia5`,"1a":`vis`,"1e":`bmp`},n={};return n.type=t[e.substr(0,2)],n.str=Ze(r(e,0)),n},this.getExtCRLNumber=function(e,t){var n={extname:`cRLNumber`};if(t&&(n.critical=!0),e.substr(0,2)==`02`)return n.num={hex:r(e,0)},n;throw Error(`hExtV parse error: `+e)},this.getExtCRLReason=function(e,t){var n={extname:`cRLReason`};if(t&&(n.critical=!0),e.substr(0,2)==`0a`)return n.code=parseInt(r(e,0),16),n;throw Error(`hExtV parse error: `+e)},this.getExtOcspNonce=function(e,t){var n={extname:`ocspNonce`};return t&&(n.critical=!0),n.hex=r(e,0),n},this.getExtOcspNoCheck=function(e,t){var n={extname:`ocspNoCheck`};return t&&(n.critical=!0),n},this.getExtAdobeTimeStamp=function(e,t){if(e===void 0&&t===void 0){var r=this.getExtInfo(`adobeTimeStamp`);if(r===void 0)return;e=i(this.hex,r.vidx),t=r.critical}var a={extname:`adobeTimeStamp`};t&&(a.critical=!0);var o=n(e,0);if(o.length>1){var s=i(e,o[1]),c=this.getGeneralName(s);c.uri!=null&&(a.uri=c.uri)}if(o.length>2){var l=i(e,o[2]);l==`0101ff`&&(a.reqauth=!0),l==`010100`&&(a.reqauth=!1)}return a},this.getX500NameRule=function(e){for(var t=``,n=``,r=null,i=[],a=0;a<e.length;a++)for(var o=e[a],s=0;s<o.length;s++)i.push(o[s]);for(var a=0;a<i.length;a++){var c=i[a],l=c.ds,u=c.value,d=c.type;if(t+=`:`+l,l!=`prn`&&l!=`utf8`&&l!=`ia5`)return`mixed`;if(l==`ia5`){if(d!=`CN`)return`mixed`;if(f.lang.String.isMail(u))continue;return`mixed`}if(d==`C`){if(l==`prn`)continue;return`mixed`}if(n+=`:`+l,r==null)r=l;else if(r!==l)return`mixed`}return r==null?`prn`:r},this.getX500Name=function(e){var t=this.getX500NameArray(e);return{array:t,str:this.dnarraytostr(t)}},this.getX500NameArray=function(e){for(var t=[],r=n(e,0),a=0;a<r.length;a++)t.push(this.getRDN(i(e,r[a])));return t},this.getRDN=function(e){for(var t=[],r=n(e,0),a=0;a<r.length;a++)t.push(this.getAttrTypeAndValue(i(e,r[a])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},r=n(e,0),i=a(e,r[0],[],`06`),o=a(e,r[1],[]),s=f.asn1.ASN1Util.oidHexToInt(i);return t.type=f.asn1.x509.OID.oid2atype(s),t.ds=this.HEX2STAG[e.substr(r[1],2)],t.ds==`bmp`?t.value=st(o):t.value=Xe(o),t},this.readCertPEM=function(e){this.readCertHex(g(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{l(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=nt(this.getPublicKeyHex(),`PUBLIC KEY`),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){e==null&&u(this.hex,0,[0,`[3]`])!=-1&&(e=c(this.hex,0,[0,`[3]`,0],`30`));for(var t=[],r=n(e,0),a=0;a<r.length;a++){var o=i(e,r[a]),s=this.getExtParam(o);s!=null&&t.push(s)}return t},this.getExtParam=function(e){var t=n(e,0).length;if(t!=2&&t!=3)throw Error(`wrong number elements in Extension: `+t+` `+e);var r=h(a(e,0,[0],`06`)),i=!1;t==3&&s(e,0,[1])==`0101ff`&&(i=!0);var o=s(e,0,[t-1,0]),c=void 0;if(r==`2.5.29.14`?c=this.getExtSubjectKeyIdentifier(o,i):r==`2.5.29.15`?c=this.getExtKeyUsage(o,i):r==`2.5.29.17`?c=this.getExtSubjectAltName(o,i):r==`2.5.29.18`?c=this.getExtIssuerAltName(o,i):r==`2.5.29.19`?c=this.getExtBasicConstraints(o,i):r==`2.5.29.31`?c=this.getExtCRLDistributionPoints(o,i):r==`2.5.29.32`?c=this.getExtCertificatePolicies(o,i):r==`2.5.29.35`?c=this.getExtAuthorityKeyIdentifier(o,i):r==`2.5.29.37`?c=this.getExtExtKeyUsage(o,i):r==`1.3.6.1.5.5.7.1.1`?c=this.getExtAuthorityInfoAccess(o,i):r==`2.5.29.20`?c=this.getExtCRLNumber(o,i):r==`2.5.29.21`?c=this.getExtCRLReason(o,i):r==`1.3.6.1.5.5.7.48.1.2`?c=this.getExtOcspNonce(o,i):r==`1.3.6.1.5.5.7.48.1.5`?c=this.getExtOcspNoCheck(o,i):r==`1.2.840.113583.1.1.9.1`&&(c=this.getExtAdobeTimeStamp(o,i)),c!=null)return c;var l={extname:r,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){function t(e){return e.map(function(e){return n(e).replace(/\+/,`\\+`)}).join(`+`)}function n(e){return e.type+`=`+e.value}return`/`+e.map(function(e){return t(e).replace(/\//,`\\/`)}).join(`/`)},this.getInfo=function(){var e=function(e){return JSON.stringify(e.array).replace(/[\[\]\{\}\"]/g,``)},t=function(e){for(var t=``,n=e.array,r=0;r<n.length;r++){var i=n[r];if(t+=` policy oid: `+i.policyoid+`
|
|
275
|
+
`,i.array!==void 0)for(var a=0;a<i.array.length;a++){var o=i.array[a];o.cps!==void 0&&(t+=` cps: `+o.cps+`
|
|
276
|
+
`)}}return t},n=function(e){for(var t=``,n=e.array,r=0;r<n.length;r++){var i=n[r];try{i.dpname.full[0].uri!==void 0&&(t+=` `+i.dpname.full[0].uri+`
|
|
277
|
+
`)}catch(e){}try{i.dname.full[0].dn.hex!==void 0&&(t+=` `+ht.hex2dn(i.dpname.full[0].dn.hex)+`
|
|
278
|
+
`)}catch(e){}}return t},r=function(e){for(var t=``,n=e.array,r=0;r<n.length;r++){var i=n[r];i.caissuer!==void 0&&(t+=` caissuer: `+i.caissuer+`
|
|
279
|
+
`),i.ocsp!==void 0&&(t+=` ocsp: `+i.ocsp+`
|
|
280
|
+
`)}return t},i=`Basic Fields
|
|
281
|
+
`,a,o;if(i+=` serial number: `+this.getSerialNumberHex()+`
|
|
282
|
+
`,i+=` signature algorithm: `+this.getSignatureAlgorithmField()+`
|
|
283
|
+
`,i+=` issuer: `+this.getIssuerString()+`
|
|
284
|
+
`,i+=` notBefore: `+this.getNotBefore()+`
|
|
285
|
+
`,i+=` notAfter: `+this.getNotAfter()+`
|
|
286
|
+
`,i+=` subject: `+this.getSubjectString()+`
|
|
287
|
+
`,i+=` subject public key info:
|
|
288
|
+
`,a=this.getPublicKey(),i+=` key algorithm: `+a.type+`
|
|
289
|
+
`,a.type===`RSA`&&(i+=` n=`+lt(a.n.toString(16)).substr(0,16)+`...
|
|
290
|
+
`,i+=` e=`+lt(a.e.toString(16))+`
|
|
291
|
+
`),o=this.aExtInfo,o!=null){i+=`X509v3 Extensions:
|
|
292
|
+
`;for(var s=0;s<o.length;s++){var c=o[s],l=f.asn1.x509.OID.oid2name(c.oid);l===``&&(l=c.oid);var u=``;if(c.critical===!0&&(u=`CRITICAL`),i+=` `+l+` `+u+`:
|
|
293
|
+
`,l===`basicConstraints`){var d=this.getExtBasicConstraints();d.cA===void 0?i+=` {}
|
|
294
|
+
`:(i+=` cA=true`,d.pathLen!==void 0&&(i+=`, pathLen=`+d.pathLen),i+=`
|
|
295
|
+
`)}else if(l===`keyUsage`)i+=` `+this.getExtKeyUsageString()+`
|
|
296
|
+
`;else if(l===`subjectKeyIdentifier`)i+=` `+this.getExtSubjectKeyIdentifier().kid.hex+`
|
|
297
|
+
`;else if(l===`authorityKeyIdentifier`){var p=this.getExtAuthorityKeyIdentifier();p.kid!==void 0&&(i+=` kid=`+p.kid.hex+`
|
|
298
|
+
`)}else if(l===`extKeyUsage`){var m=this.getExtExtKeyUsage().array;i+=` `+m.join(`, `)+`
|
|
299
|
+
`}else if(l===`subjectAltName`){var h=e(this.getExtSubjectAltName());i+=` `+h+`
|
|
300
|
+
`}else if(l===`cRLDistributionPoints`){var g=this.getExtCRLDistributionPoints();i+=n(g)}else if(l===`authorityInfoAccess`){var _=this.getExtAuthorityInfoAccess();i+=r(_)}else l===`certificatePolicies`&&(i+=t(this.getExtCertificatePolicies()))}}return i+=`signature algorithm: `+this.getSignatureAlgorithmName()+`
|
|
301
|
+
`,i+=`signature: `+this.getSignatureValueHex().substr(0,16)+`...
|
|
302
|
+
`,i},typeof e==`string`&&(e.indexOf(`-----BEGIN`)==-1?f.lang.String.isHex(e)&&this.readCertHex(e):this.readCertPEM(e))}ht.hex2dn=function(e,t){t===void 0&&(t=0);var n=new ht;return V.getTLV(e,t),n.getX500Name(e).str},ht.hex2rdn=function(e,t){if(t===void 0&&(t=0),e.substr(t,2)!==`31`)throw Error(`malformed RDN`);for(var n=[],r=V.getChildIdx(e,t),i=0;i<r.length;i++)n.push(ht.hex2attrTypeValue(e,r[i]));return n=n.map(function(e){return e.replace(`+`,`\\+`)}),n.join(`+`)},ht.hex2attrTypeValue=function(e,t){var n=V,r=n.getV;if(t===void 0&&(t=0),e.substr(t,2)!==`30`)throw Error(`malformed attribute type and value`);var i=n.getChildIdx(e,t);i.length!==2||e.substr(i[0],2);var a=r(e,i[0]),o=f.asn1.ASN1Util.oidHexToInt(a),s=f.asn1.x509.OID.oid2atype(o),c=Ze(r(e,i[1]));return s+`=`+c},ht.getPublicKeyFromCertHex=function(e){var t=new ht;return t.readCertHex(e),t.getPublicKey()},ht.getPublicKeyFromCertPEM=function(e){var t=new ht;return t.readCertPEM(e),t.getPublicKey()},ht.getPublicKeyInfoPropOfCertPEM=function(e){var t=V.getVbyList,n={},r,i;return n.algparam=null,r=new ht,r.readCertPEM(e),i=r.getPublicKeyHex(),n.keyhex=t(i,0,[1],`03`).substr(2),n.algoid=t(i,0,[0,0],`06`),n.algoid===`2a8648ce3d0201`&&(n.algparam=t(i,0,[0,1],`06`)),n},ht.KEYUSAGE_NAME=[`digitalSignature`,`nonRepudiation`,`keyEncipherment`,`dataEncipherment`,`keyAgreement`,`keyCertSign`,`cRLSign`,`encipherOnly`,`decipherOnly`];function gt(e){return p.SHA256(e).toString()}var _t=[(()=>{let e=new ht;return e.readCertPEM(function(...e){return arguments[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVS@ PPNErtNVONtVWNZR}@]nU\0ZaZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg R^ZNATN>bROU^zc}nzyg R]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\x07\\QN>Z N\\Q^B[QqnS=\b\\QN>Zwp\\Q^B[QqnZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg R^ZNATN>bROU^zc}nzyg R]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaPPNvVQ^fWX|gVup[N^ROO^NQttV]NQPPNt|PttVONZU|C\b\\@@e^Xv{[vTtd8`nyO@\x07ebN[bqx=ng? S^w@|XAz|qUTwfzn]Bu<qs_ae\\y<}u`eRAoE`_\\s\0r|b{rp_o<oC@o=x\bw_cUUZPApQevD\\FxFo\x07FgE=<sq[p<coqyn>TEpP@aSC_YDU8\0|8TB?c>r\\=rp`pcwP}c\0PP_\\RS\\EPVSy8x`\0?R|NP P>}A^VP}Ex\bU\x07Za=syDw}>Ya\x078wPp[pRnn\brU^dE8U?a\bcW|<FEbbupn^`ZNr sof[wA}e{\\z}w[YDQ|dt=wC Nv\x07bR\x07Z@@U|ZAYpFsabCBB\\`wrqxsYW8uFyWdaWezeUeA_8VoVupvY[TD[OYdpO\bC[wX\\O]=[QRpV\0d`\x07N\0RXt^Z}vEpdC=\bY?\x07=V}?^W\bad|qN@Ww>@PycaqANE]asPcE^OB_VA?>wzeftac Z guf\bF]\x07DCP?znNYf uaYu[`\x07=b|v]Bp=RAS``\\PRDW]_`UXdUg=SuqwVFDeB D8{B>\\sPY\x07bEU FQXz\0@\x07`zsqgfD\0[WY\bPeZc} \0bx?Rfed\x07}BUe\x07|Uo\0y?\bsSXZOSBCgbFqf\0Bs?b?d<VE\\Zzns\\d@?dPvf\\{}_\0Sd[<q_YB\x07Y`Ffg=sY>{t<fu]x\x07rFNtZONNTwbQO\\ZO=TN>bqQt^dOOaAFXw= PCVxsv?{`a\bvS8YQ[aNsOt[cU`ZRTQNdtOaAFXw= PCVxsv?{`a\bvS8YQ[aNZOt[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=E\x07nO}Pud8TA ?yPrVv{\\>E]o`BO^RE^X[W[rEU?x\bf>V OUwY=>X[\\E`tW[8}VwpF\x07BQcnrPF}yUtd8<Doe_\b[oOVU\x07ep@pYY\0cegY{r ?\bAbq?ff8}UaXoN_D]_X_8yozYFT`N{`\\{zvu?\bDWT}=_<\x07StX Nx\x07\0\b \0aT=c@ucnWfR[vf>RFxAFV}{N`dN^\\<eawBPxx}quT=|{T_R@Fp^Y<ZevRsWaZ]V CVrRVtAAc[ Qp|d|tqoQ=T|XX =u\\N8XNCx\\aU>wz X<e@Vc?dy\\|^FEq|=p`pBdF@bs^d<]vp\\^TZ P\bZ\b\\YNNSZ_\\w^|TsD8db _ Y\\o^Cw>Z\0x\\^aN]wWf\bA} C^d_{\x07ZC@\by]gY@E BFY?OsaqbDcVgQbZeFc ovtucxnq|<TnuyXRveYFOegCpAs{YTe|>bE<OXsSqCBWD_SVepfvCCUg]z ZvQ[\0s|U>pFz\b=OwT``fNJJ:::::R[Q-PR_aVSVPNaR:::::")),e})()];function vt(e,t){for(let n of t)if(n.getSubjectHex()===e)return n}function yt(e,t){let n=e.getIssuerHex();if(n===e.getSubjectHex())return e.verifySignature(e.getPublicKey());let r=vt(n,t);return!r||e.verifySignature(r.getPublicKey())===!1?!1:yt(r,t)}function bt(e){return e.getIssuerHex()===e.getSubjectHex()?!1:yt(e,_t)}function xt(e){let t=new ht;typeof e==`string`?t.readCertPEM(e):t.readCertHex(e.hex);let n=bt(t);return _t.push(t),n}function St(e,t,n){let r=new ht;if(typeof n==`string`?r.readCertPEM(n):r.readCertHex(n.hex),bt(r)===!1)return!1;let i=new B;return i.readCertPubKeyHex(r.hex,6),!!i.verify(e,je(t))}xt(function(...e){return arguments[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVTU PPONrtNVONtVWNW=_SVw VE=ZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg R^ZNATN>bROU^zc}nzyg R]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\bZQNAZaN\\aZ [QSnS=\b[aNBZQZ\\aZ [QSnZVTaZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg R^ZNATN>bROU^zc}nzyg RbZOVTN>bRPtYoTyuoz}}f`Bwo?=\x07RQN\\Ot[cONZO>Wyfd\x07 gdb\x07RaN]Ot[cONZZPRuupz_@feWyZ`bVfWX|gVup[N^xOSugnec|fdy\x07ndB{^T\x07}fdB\0ndRf?FZVVPVwN[Otx\0uxvTF=ON^RSNN\\PNtENZVVPPtXPNtRN?=?]q[VD|{\\oyo`oOu}F SA\x07e`tn[t u\b8^a]qx\bE_^\x07ZN?[QC\0yuOpybY8r\\RPAS=8rUq\0E8>xean^e\bf]Y`XO}{C[Ur^?\0x[SRXvVQ\\CFr}QnAPRQ\x07FO=Yw\0_TePCOFV@|\x07N>ROXcDrT<>bW<ssO?NOT{^s]uU\0gS\bBffsfE\0AfDyQEZR`]XBo|Qw}yYdwwTvOFcBndUz^\\{] b=^yQYSTQ`]\0?tR{WRUun\\\0bVe_E|VWWV|r Ao\0 F`fdzCnRtq\br \b8eBp=Z\\TRaadc}@Eub`\x07quuNqAdF\0aUay{}x>tgVz` _YBFwu_q?egt8v[o\x008 wTQcrA <z{DZoEE^rZTrpaZQzqpBY]^zt8[bQv}yEWw XDYQB\0QB\bx_^X]|uEDtPf[n[r_bpB[bE}?ung|bnU|NYOoedY_tvXySZfYP\x07\x07dWV]OE^\bOFwA}<uXoO}_NDz8aon\x07zWOfcv@?>snfqu@FeEx^\\\bVfuO`\\\0tSg]zDU}QrAT| OZV|OvpVD<sN@z`<_cSrNCW>?=Au?g_8v{|}}WF>Sr>QBxO d_D}eBb?Uq^b [y}x]}{?P|BQtecTB[pQBW>|p|nfv\0zU\x07xOO}WqwE=<PURZy@X8r\\]u=<pPNRNNn\\OtaO<ZOETPdPT`NTT8RVOQ^^`SuO`gdSp?cyVRg\bo?B=VR[OZO=TN>bqQt^dOO`Fy\x07WadZcAD peXybcW@}Qf\\QNsOt[cU`ZRTQNdtOaAFXw= PCVxsv?{`a\bvS8YQ[aN]Ot[cU_ZONsEROaNQN^U<ZNTN>bqQ^RNVOOwN[Otx\0uxvTF=ON^SNN\\PNtRNrx a[}tP_g8FbD\0^\0qt<f88ufuN]^}]gp\bqYudF88Fas_Ef` ?^x>X}esa{>\\r?eE]CC_cZ[vQs >gX[szONg=^pn=<e]nbSz\bZvac\b[w^nA_`vP|@8w[}nQobe=??oRYf{vpRxcC}yCd>8[NDx{Ne\\t8oou=guC\x07>>g\x07vb}ACd ``Ntq\0yC[Q{|ynpNQqSqzxF<_PFDw<]Bnnu>F<XgU_Zf\\\\A=gu\\codOwQ]oQ<f>gv_pwozwC}xX>C`c]suEdfW?cbeo\b`BbyR@eFTUwSud=t]sS\\onc XSq {\0\x07DvAVBbnTqEE[QzDyqF`bF}R=Q?VeDo<Vzb\0w}D}NZ\0t}^?OyFP\bVaVNrTNYqe?[NRYTSQby@yzWvT`wQo}y]c_WgxBYCy RNRg@\x07NZCaaq8?` ^`?ryD =obzw?E]Ou\x07]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{ug\x078^f[YQAWad8FNqxFQE?ZOo }RnO\bsQc xyccn=nxvs>bDBf\b\bW\\TuTnvAO^U\0QXC>xx8FxRFf<tJ:::::R[Q-PR_aVSVPNaR:::::"));var Ct=class extends c.Group{},wt=null;function Tt(e){if(wt!==null&&typeof wt.property){let e=wt;return wt=Tt.prototype=null,e}return wt=Tt.prototype=e==null?Object.create(null):e,new Tt}var Et=10;for(let e=0;e<=Et;e++)Tt();function Dt(e){return Tt(e)}var Ot=class extends c.Mesh{constructor(e,t){super(e,t),Dt(this)}},kt=class extends c.SkinnedMesh{constructor(e,t,n){super(e,t,n),Dt(this)}},At=class e extends c.Points{get positions(){let e=this.geometry.getAttribute(`position`);return e?e.array:new Float32Array}get rotations(){let e=this.geometry.getAttribute(`rotation`);return e?e.array:new Float32Array}get scales(){let e=this.geometry.getAttribute(`scale`);return e?e.array:new Float32Array}get colors(){let e=this.geometry.getAttribute(`color`);return e?e.array:new Uint8Array}get selection(){let e=this.geometry.getAttribute(`selection`);return e?e.array:new Uint8Array}get sh1(){let e=this.geometry.getAttribute(`sh1`);return e?e.array:void 0}get sh2(){let e=this.geometry.getAttribute(`sh2`);return e?e.array:void 0}get sh3(){let e=this.geometry.getAttribute(`sh3`);return e?e.array:void 0}constructor(e){var t;let n=new c.BufferGeometry;super(n),this.transformChanged=!1,this.selectedChanged=!1,this.transferDetached=!1,this.maxSHDegree=0,this.usedSHDegree=0,this.gsViewLayerKey=``,this.gsClippers=[],this._selected=!1,this.material.visible=!1,this.numPoints=e?e.numPoints:0,this.maxSHDegree=(t=e==null?void 0:e.shDegree)==null?0:t,this.usedSHDegree=0,e&&e.positions?n.setAttribute(`position`,new c.BufferAttribute(e.positions,3)):n.setAttribute(`position`,new c.BufferAttribute(new Float32Array,3)),e&&e.rotations?n.setAttribute(`rotation`,new c.BufferAttribute(e.rotations,4)):n.setAttribute(`rotation`,new c.BufferAttribute(new Float32Array,4)),e&&e.scales?n.setAttribute(`scale`,new c.BufferAttribute(e.scales,3)):n.setAttribute(`scale`,new c.BufferAttribute(new Float32Array,3)),e&&e.colors?n.setAttribute(`color`,new c.BufferAttribute(e.colors,4,!0)):n.setAttribute(`color`,new c.BufferAttribute(new Uint8Array,4,!0));let r=new Uint8Array(this.numPoints);if(n.setAttribute(`selection`,new c.BufferAttribute(r,1)),e!=null&&e.sh1&&n.setAttribute(`sh1`,new c.BufferAttribute(e.sh1,9)),e!=null&&e.sh2&&n.setAttribute(`sh2`,new c.BufferAttribute(e.sh2,15)),e!=null&&e.sh3&&n.setAttribute(`sh3`,new c.BufferAttribute(e.sh3,21)),this._boundingBox=new c.Box3(new c.Vector3(1/0,1/0,1/0),new c.Vector3(-1/0,-1/0,-1/0)),e&&e.positions)for(let t=0;t<this.numPoints;t++)this._boundingBox.expandByPoint(new c.Vector3(e.positions[3*t],e.positions[3*t+1],e.positions[3*t+2]));this.matrixAutoUpdate=!1,this.lastMatrixWorld=null}serialize(){let t=new Uint8Array(this.numPoints*e.RowLength),n=new Float32Array(t.buffer),r=new Uint8Array(t.buffer),i=this.positions,a=this.colors,o=this.scales,s=this.rotations;for(let e=0;e<this.numPoints;e++)n[8*e+0]=i[3*e+0],n[8*e+1]=i[3*e+1],n[8*e+2]=i[3*e+2],r[32*e+24+0]=a[4*e+0],r[32*e+24+1]=a[4*e+1],r[32*e+24+2]=a[4*e+2],r[32*e+24+3]=a[4*e+3],n[8*e+3+0]=o[3*e+0],n[8*e+3+1]=o[3*e+1],n[8*e+3+2]=o[3*e+2],r[32*e+28+0]=s[4*e+0]*128+128&255,r[32*e+28+1]=s[4*e+1]*128+128&255,r[32*e+28+2]=s[4*e+2]*128+128&255,r[32*e+28+3]=s[4*e+3]*128+128&255;return t}reattach(e,t,n,r,i){let a=new Float32Array(e),o=new Float32Array(t),s=new Float32Array(n),l=new Uint8Array(r),u=new Uint8Array(i);this.geometry.setAttribute(`position`,new c.BufferAttribute(a,3)),this.geometry.setAttribute(`rotation`,new c.BufferAttribute(o,4)),this.geometry.setAttribute(`scale`,new c.BufferAttribute(s,3)),this.geometry.setAttribute(`color`,new c.BufferAttribute(l,4,!0)),this.geometry.setAttribute(`selection`,new c.BufferAttribute(u,1)),this.transferDetached=!1}get selected(){return this._selected}set selected(e){this._selected!==e&&(this._selected=e,this.selectedChanged=!0)}get boundingBox(){let e=new c.Vector3;this._boundingBox.getCenter(e),e.add(this.position);let t=new c.Vector3;this._boundingBox.getSize(t),t.multiply(this.scale);let n=new c.Vector3;return n.copy(t).multiplyScalar(.5),new c.Box3(e.clone().sub(n),e.clone().add(n))}dispose(){this.geometry.dispose()}raycast(e,t){var n,r;let i=this.matrixWorld,a=(r=(n=e.params.Points)==null?void 0:n.threshold)==null?0:r;if(this._boundingBox.isEmpty())return;let o=new c.Vector3;this._boundingBox.getCenter(o);let s=new c.Vector3;this._boundingBox.getSize(s);let l=Math.max(s.x,s.y,s.z)*.5,u=new c.Sphere(o,l);if(u.applyMatrix4(i),u.radius+=a,e.ray.intersectsSphere(u)===!1)return;let d=new c.Matrix4;d.copy(i).invert();let f=new c.Ray;f.copy(e.ray).applyMatrix4(d);let p=a/((this.scale.x+this.scale.y+this.scale.z)/3),m=p*p,h=this.geometry.getAttribute(`position`);if(!h)return;let g=h.array,_=this.numPoints;for(let n=0;n<_;n++){let r=new c.Vector3(g[n*3],g[n*3+1],g[n*3+2]),a=f.distanceSqToPoint(r);if(a<m){let o=new c.Vector3;f.closestPointToPoint(r,o),o.applyMatrix4(i);let s=e.ray.origin.distanceTo(o);if(s<e.near||s>e.far)continue;t.push({distance:s,distanceToRay:Math.sqrt(a),point:o,index:n,face:null,object:this})}}}};At.RowLength=32;function jt(){return((1+Math.random())*65536|0).toString(16).substring(1)}function Mt(){return(jt()+jt()+`-`+jt()+`-4`+jt().substr(0,3)+`-`+jt()+`-`+jt()+jt()+jt()).toLowerCase()}function H(e,t,n){return e<t?t:typeof n==`number`&&e>n?n:e}function Nt(e){return typeof Symbol>`u`?`$Symbol<${e}>$`:Symbol(e)}var Pt=Nt(`$$FIVE_EVENT$$`);function Ft(e){return e[Pt]||(e[Pt]={}),e[Pt]}function It(e){e[Pt]&&delete e[Pt]}var Lt=class{hasListener(e){let t=Ft(this);return t&&t[e]&&t[e].callbacks.length>0}on(e,t,n){let r=Ft(this);return r[e]||(r[e]={callbacks:[]}),r[e].callbacks.push([t,n||!1]),()=>this.off(e,t)}once(e,t){return this.on(e,t,!0)}off(e,t){if(e===void 0){It(this);return}let n=Ft(this);if(n[e]||(n[e]={callbacks:[]}),t===void 0){n[e].callbacks.length=0;return}let r=0;for(;r<n[e].callbacks.length&&n[e].callbacks[r][0]!==t;r++);r<n[e].callbacks.length&&n[e].callbacks.splice(r,1)}emit(e,...t){let n=!1,r=Ft(this);r[e]||(r[e]={callbacks:[]});let i=r[e].callbacks.slice();for(let[r,a=!1]of i){let i=r(...t);a&&this.off(e,r),i===!1&&(n=!0)}return n}waitUntil(e,t){return new Promise(n=>{let r=this.on(e,(...e)=>{(!t||t(...e)!==!1)&&(n(e),r())})})}},Rt=class extends Lt{},zt=class e extends Rt{static computeLut(e,t,n,r=1024,i=1,a,o){let s=H(e,-255,255)/255,c=H(t,-255,255)/255,l=H(n,-255,255)/255,u=new Float32Array(5),d=new Float32Array(5),f=new Float32Array(5);u[0]=0,u[1]=.125,u[2]=.5,u[3]=.875,u[4]=1;for(let e=0;e<5;e++)f[e]=u[e]*(1+l);f[4]=Math.max(1,f[4]);for(let e=0;e<5;e++){let t=Math.pow(f[e]/f[4],2.2),n=Math.pow(f[e]/f[4],.45454545454545453);e<2?d[e]=f[e]+n*c:e>2?d[e]=f[e]+t*s:d[e]=f[e]}d[0]=0,d[4]=Math.max(1,d[4]),d[1]=Math.max(d[0]+.05,d[1]),d[3]=Math.min(d[4]-.0875,d[3]),d[2]=Math.max(Math.min(d[3]-.275,d[2]),d[1]+.275),a=a==null?new Float32Array(r*i):a,o=o==null?0:o;let p=r*2;for(let e=0;e<p;e++){let t=e/p,n=t*t,s=n*t,c=s*t,l=1-t,f=l*l,m=f*l,h=m*l,g=h*u[0]+4*m*t*u[1]+6*f*n*u[2]+4*l*s*u[3]+c*u[4],_=h*d[0]+4*m*t*d[1]+6*f*n*d[2]+4*l*s*d[3]+c*d[4],v=H(Math.round(g*(r-1)),0,r-1);for(let e=0;e<i;e++)a[o+v*i+e]=_}return a}constructor(){super(),this.id=Mt();let t=()=>this.emit(`update`),n=0;this.contrast={get contrastBias(){return n},set contrastBias(e){n=e,t()}};let r=0;this.saturation={get saturationBias(){return r},set saturationBias(e){r=e,t()}};let i=0,a=0;this.color={get temperatureBias(){return i},set temperatureBias(e){i=e,t()},get tintBias(){return a},set tintBias(e){a=e,t()}};let o=0,s=0,l=0,u=[0,0,0].join(`:`),d=1024,f=new Float32Array(d*4);e.computeLut(0,0,0,d,4,f);let p=new c.DataTexture(f,d,1);p.flipY=!1,p.format=c.RGBAFormat,p.type=c.FloatType,p.minFilter=c.NearestFilter,p.magFilter=c.NearestFilter,p.generateMipmaps=!1,p.needsUpdate=!0;let m=()=>{let t=[o,s,l].join(`:`);return t!==u&&(e.computeLut(o,s,l,d,4,f),p.needsUpdate=!0,u=t),p};this.highlightShadow={lutMap:p,get highlightBias(){return o},set highlightBias(e){o=e,m(),t()},get shadowBias(){return s},set shadowBias(e){s=e,m(),t()},get globalBias(){return l},set globalBias(e){l=e,m(),t()}}}toValue(){return{saturationSaturationBias:this.saturation.saturationBias,contrastContrastBias:this.contrast.contrastBias,highlightShadowLutMap:this.highlightShadow.lutMap,colorTemperatureBias:this.color.temperatureBias,colorTintBias:this.color.tintBias}}},Bt=`pano0Map.pano0MapSize.pano0Histogram.pano0Matrix.pano0Zoom.pano0GainMap.pano0HdrMaxContentBoost.pano0HdrMinContentBoost.pano0HdrCapacityMin.pano0HdrCapacityMax.pano0HdrGamma.pano0DepthMap.pano0DepthMaxDepth.pano1Map.pano1MapSize.pano1Histogram.pano1Matrix.pano1Zoom.pano1GainMap.pano1HdrMaxContentBoost.pano1HdrMinContentBoost.pano1HdrCapacityMin.pano1HdrCapacityMax.pano1HdrGamma.pano1DepthMap.pano1DepthMaxDepth.panoFilterSaturationBias.panoFilterContrastBias.panoFilterLutMap.panoFilterTemperatureBias.panoFilterTintBias.refinedScreenMap.refinedScreenProjectionMatrix.refinedScreenMatrixInverse.refinedScreenOpacity.refinedScreenPano.pointSize.pointShape.pointBack.pointScale.pointMinPixel.pointMaxPixel.vertexMarks.colorAlpha.alphaMode.modelAlpha.progress.transition.colorStyle.constantColor.floorIndex.shownFloorIndex.floorStyle.brightness.colorSaturation.colorBrightness.gradientTexture.useHDR.maxDisplayBoost.modelBoundingMin.modelBoundingMax`.split(`.`);function Vt(){return{pano0Map:null,pano0MapSize:1,pano0Histogram:new c.Vector4,pano0Matrix:new c.Matrix4,pano0Zoom:1,pano0GainMap:null,pano0HdrMaxContentBoost:1,pano0HdrMinContentBoost:1,pano0HdrCapacityMin:1,pano0HdrCapacityMax:1e3,pano0HdrGamma:1,pano0DepthMap:null,pano0DepthMaxDepth:1,pano1Map:null,pano1MapSize:1,pano1Histogram:new c.Vector4,pano1Matrix:new c.Matrix4,pano1Zoom:1,pano1GainMap:null,pano1HdrMaxContentBoost:1,pano1HdrMinContentBoost:1,pano1HdrCapacityMin:1,pano1HdrCapacityMax:1e3,pano1HdrGamma:1,pano1DepthMap:null,pano1DepthMaxDepth:1,panoFilterSaturationBias:0,panoFilterContrastBias:0,panoFilterLutMap:null,panoFilterTemperatureBias:0,panoFilterTintBias:0,refinedScreenMap:null,refinedScreenProjectionMatrix:new c.Matrix4,refinedScreenMatrixInverse:new c.Matrix4,refinedScreenOpacity:0,refinedScreenPano:0,pointSize:`ATTENUATION`,pointBack:`DARK`,pointShape:`CIRCLE`,pointScale:.02,pointMaxPixel:40,pointMinPixel:0,vertexMarks:!1,colorAlpha:1,alphaMode:`OPAQUE`,modelAlpha:1,progress:0,transition:`FADE`,colorStyle:`RGB`,constantColor:new c.Vector3,floorIndex:-1,shownFloorIndex:-1,floorStyle:`OPACITY`,brightness:1,colorSaturation:0,colorBrightness:0,gradientTexture:null,useHDR:!1,maxDisplayBoost:1,modelBoundingMin:new c.Vector3,modelBoundingMax:new c.Vector3}}function Ht(e,t){e.pano0Map=t.pano0Map,e.pano0MapSize=t.pano0MapSize,e.pano0Histogram.copy(t.pano0Histogram),e.pano0Matrix.copy(t.pano0Matrix),e.pano0Zoom=t.pano0Zoom,e.pano0GainMap=t.pano0GainMap,e.pano0HdrMaxContentBoost=t.pano0HdrMaxContentBoost,e.pano0HdrMinContentBoost=t.pano0HdrMinContentBoost,e.pano0HdrCapacityMin=t.pano0HdrCapacityMin,e.pano0HdrCapacityMax=t.pano0HdrCapacityMax,e.pano0HdrGamma=t.pano0HdrGamma,e.pano0DepthMap=t.pano0DepthMap,e.pano0DepthMaxDepth=t.pano0DepthMaxDepth,e.pano1Map=t.pano1Map,e.pano1MapSize=t.pano1MapSize,e.pano1Histogram.copy(t.pano1Histogram),e.pano1Matrix.copy(t.pano1Matrix),e.pano1Zoom=t.pano1Zoom,e.pano1GainMap=t.pano1GainMap,e.pano1HdrMaxContentBoost=t.pano1HdrMaxContentBoost,e.pano1HdrMinContentBoost=t.pano1HdrMinContentBoost,e.pano1HdrCapacityMin=t.pano1HdrCapacityMin,e.pano1HdrCapacityMax=t.pano1HdrCapacityMax,e.pano1HdrGamma=t.pano1HdrGamma,e.pano1DepthMap=t.pano1DepthMap,e.pano1DepthMaxDepth=t.pano1DepthMaxDepth,e.panoFilterSaturationBias=t.panoFilterSaturationBias,e.panoFilterContrastBias=t.panoFilterContrastBias,e.panoFilterLutMap=t.panoFilterLutMap,e.panoFilterTemperatureBias=t.panoFilterTemperatureBias,e.panoFilterTintBias=t.panoFilterTintBias,e.refinedScreenMap=t.refinedScreenMap,e.refinedScreenProjectionMatrix.copy(t.refinedScreenProjectionMatrix),e.refinedScreenMatrixInverse.copy(t.refinedScreenMatrixInverse),e.refinedScreenOpacity=t.refinedScreenOpacity,e.refinedScreenPano=t.refinedScreenPano,e.pointSize=t.pointSize,e.pointShape=t.pointShape,e.pointScale=t.pointScale,e.pointMaxPixel=t.pointMaxPixel,e.pointMinPixel=t.pointMinPixel,e.vertexMarks=t.vertexMarks,e.colorAlpha=t.colorAlpha,e.alphaMode=t.alphaMode,e.modelAlpha=t.modelAlpha,e.progress=t.progress,e.transition=t.transition,e.colorStyle=t.colorStyle,e.floorStyle=t.floorStyle,e.brightness=t.brightness,e.colorSaturation=t.colorSaturation,e.colorBrightness=t.colorBrightness,e.floorIndex=t.floorIndex,e.shownFloorIndex=t.shownFloorIndex,e.useHDR=t.useHDR,e.maxDisplayBoost=t.maxDisplayBoost,e.gradientTexture=t.gradientTexture,e.constantColor.copy(t.constantColor),e.modelBoundingMin.copy(t.modelBoundingMin),e.modelBoundingMax.copy(t.modelBoundingMax)}function Ut(e){return e!=null&&e.isPBMMaterial===!0}function Wt(e){return[`useHDR:${e.useHDR}`,`pano0Map:${!!e.pano0Map}`,`pano0GainMap:${!!e.pano0GainMap}`,`pano0DepthMap:${!!e.pano0DepthMap}`,`pano1Map:${!!e.pano1Map}`,`pano1GainMap:${!!e.pano1GainMap}`,`pano1DepthMap:${!!e.pano1DepthMap}`,`floorStyle:${e.floorStyle}`,`colorStyle:${e.colorStyle}`,`gradientTexture:${e.gradientTexture}`,`refinedScreenMap:${e.refinedScreenMap}`,`panoFilterLutMap:${!!e.panoFilterLutMap}`,`panoFilterLutMap:${!!e.panoFilterLutMap}`,`transition:${e.transition}`,`pointBack:${e.pointBack}`,`pointSize:${e.pointSize}`,`pointShape:${e.pointShape}`,`transparent:${e.transparent}`].join(`-`)}function Gt(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m;let h=t===0?`pano0`:`pano1`;n===null?(e[`${h}Map`]=null,e[`${h}MapSize`]=1,e[`${h}Histogram`].set(0,0,0,0),e[`${h}Matrix`].identity(),e[`${h}Zoom`]=1,e[`${h}GainMap`]=null,e[`${h}HdrMaxContentBoost`]=1,e[`${h}HdrMinContentBoost`]=1,e[`${h}HdrCapacityMin`]=1,e[`${h}HdrCapacityMax`]=1e3,e[`${h}HdrGamma`]=1):(e[`${h}Map`]=n.map,e[`${h}MapSize`]=n.mapSize,e[`${h}Histogram`].copy(n.mapHistogram),e[`${h}Matrix`].copy(n.matrix),e[`${h}Zoom`]=n.zoom,e[`${h}GainMap`]=(i=(r=n.hdrConfig)==null?void 0:r.map)==null?null:i,e[`${h}HdrMaxContentBoost`]=(o=(a=n.hdrConfig)==null?void 0:a.maxContentBoost)==null?1:o,e[`${h}HdrMinContentBoost`]=(c=(s=n.hdrConfig)==null?void 0:s.minContentBoost)==null?1:c,e[`${h}HdrCapacityMin`]=(u=(l=n.hdrConfig)==null?void 0:l.hdrCapacityMin)==null?1:u,e[`${h}HdrCapacityMax`]=(f=(d=n.hdrConfig)==null?void 0:d.hdrCapacityMax)==null?1e3:f,e[`${h}HdrGamma`]=(m=(p=n.hdrConfig)==null?void 0:p.gamma)==null?1:m)}function Kt(e,t,n){let r=t===0?`pano0`:`pano1`;n===null?(e[`${r}DepthMap`]=null,e[`${r}DepthMaxDepth`]=1):(e[`${r}DepthMap`]=n.map,e[`${r}DepthMaxDepth`]=n.maxDepth)}function qt(e,t){t?(e.panoFilterSaturationBias=t.saturationSaturationBias,e.panoFilterContrastBias=t.contrastContrastBias,e.panoFilterLutMap=t.highlightShadowLutMap,e.panoFilterTemperatureBias=t.colorTemperatureBias,e.panoFilterTintBias=t.colorTintBias):(e.panoFilterSaturationBias=0,e.panoFilterContrastBias=0,e.panoFilterLutMap=null,e.panoFilterTemperatureBias=0,e.panoFilterTintBias=0)}function Jt(e,t){t===null?(e.refinedScreenMap=null,e.refinedScreenProjectionMatrix.identity(),e.refinedScreenMatrixInverse.identity(),e.refinedScreenOpacity=0,e.refinedScreenPano=0):(e.refinedScreenMap=t.map,e.refinedScreenProjectionMatrix=t.projectionMatrix.clone(),e.refinedScreenMatrixInverse=t.matrixInverse.clone(),e.refinedScreenOpacity=t.opacity,e.refinedScreenPano=t.pano)}function Yt(e,t){var n,r;let i=Wt(e);Gt(e,0,t.pano0),Kt(e,0,t.pano0Depth),Gt(e,1,t.pano1),Kt(e,1,t.pano1Depth),qt(e,(r=(n=t.panoFilter)==null?void 0:n.toValue())==null?null:r),Jt(e,t.refinedScreen),e.pointSize=t.pointSize,e.pointShape=t.pointShape,e.pointScale=t.pointScale,e.pointMaxPixel=t.pointMaxPixel,e.pointMinPixel=t.pointMinPixel,e.vertexMarks=t.vertexMarks,e.transition=t.transition,e.floorStyle=t.floorStyle,e.colorStyle=t.colorStyle,e.constantColor.copy(t.constantColor),e.shownFloorIndex=t.shownFloorIndex,e.useHDR=t.useHDR,e.maxDisplayBoost=t.maxDisplayBoost,e.colorSaturation=t.colorSaturation,e.colorBrightness=t.colorBrightness,e.gradientTexture=t.gradientTexture,e.modelBoundingMin.copy(t.boundingBox.min),e.modelBoundingMax.copy(t.boundingBox.max),e.modelAlpha=t.modelAlpha,e.progress=t.progress,e.opacity=t.opacity,e.brightness=t.brightness,e.transparent=e.alphaMode===`BLEND`,e.blending=c.NormalBlending,e.depthWrite=!0,e.depthTest=!0,t.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),e.shownFloorIndex>-1&&e.shownFloorIndex!==e.floorIndex&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.alphaMap&&e.alphaMode===`BLEND`&&(e.transparent=!0),e.colorAlpha<1&&e.alphaMode===`BLEND`&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),e.modelAlpha<=0&&(e.transparent=!1),e.depthWrite=!e.transparent,t.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=c.AdditiveBlending),i!==Wt(e)&&(e.needsUpdate=!0)}var Xt=class extends c.Material{constructor(){super(),this.isPBMMaterial=!0,this.shaderType=`standard`,this.type=`PBMPointCloudMaterial`,Object.assign(this,Vt())}copy(e){return super.copy(e),Ht(this,e),this}};function Zt(e,t){return!!e&&e.length>=t*4}function Qt(e,t,n){let r=t*4;n.set(e[r]/127,e[r+1]/127,e[r+2]/127)}function $t(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_;if(!(e!=null&&e.array)||t<=0)return null;let v=e.array,y=Math.max(1,e.itemSize),b=e.normalized===!0,x=e.array;if(x instanceof Int8Array&&y===4&&b&&x.length>=t*4)return x;let S=new Int8Array(t*4);if(b&&x instanceof Int8Array){for(let e=0;e<t;e++){let t=e*y,s=e*4;S[s]=(n=v[t])==null?0:n,S[s+1]=(i=(r=v[t+1])==null?v[t]:r)==null?0:i,S[s+2]=(o=(a=v[t+2])==null?v[t]:a)==null?0:o}return S}if(b&&x instanceof Uint8Array){for(let e=0;e<t;e++){let t=e*y,n=e*4;S[n]=Math.max(-127,Math.min(127,Math.round(((s=v[t])==null?0:s)/255*2-1)*127)),S[n+1]=Math.max(-127,Math.min(127,Math.round(((l=(c=v[t+1])==null?v[t]:c)==null?0:l)/255*2-1)*127)),S[n+2]=Math.max(-127,Math.min(127,Math.round(((d=(u=v[t+2])==null?v[t]:u)==null?0:d)/255*2-1)*127))}return S}if(x instanceof Float32Array&&y===3&&!b){for(let e=0;e<t;e++){let t=e*3,n=e*4;S[n]=Math.max(-127,Math.min(127,Math.round(((f=v[t])==null?0:f)*127))),S[n+1]=Math.max(-127,Math.min(127,Math.round(((p=v[t+1])==null?0:p)*127))),S[n+2]=Math.max(-127,Math.min(127,Math.round(((m=v[t+2])==null?0:m)*127)))}return S}for(let e=0;e<t;e++){let t=e*y,n=e*4;S[n]=Math.max(-127,Math.min(127,Math.round(((h=v[t])==null?0:h)*127))),S[n+1]=Math.max(-127,Math.min(127,Math.round(((g=v[t+1])==null?0:g)*127))),S[n+2]=Math.max(-127,Math.min(127,Math.round(((_=v[t+2])==null?0:_)*127)))}return S}var en=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),tn=[0,1,2,0,2,3],nn=class e extends c.Mesh{constructor(t,n){var r;let i=n==null?new Xt:n,a=e.createInstancedGeometry(t);super(a,i),this.isPBMPointCloud=!0,this.pointSize=`ATTENUATION`,this.pointShape=`CIRCLE`,this.pointScale=.02,this.pointMinPixel=0,this.pointMaxPixel=40,this.pointBack=`VISIBLE`,this.floorIndex=0,this.maxDisplayBoost=1,this.opacity=1,this.modelAlpha=1,this.brightness=1,this.floorStyle=`VISIBILITY`,this.shownFloorIndex=-1,this.colorStyle=`RGB`,this.constantColor=new c.Vector3(.6,.6,.6),this.gradientTexture=null,this.colorSaturation=0,this.colorBrightness=0,this.outlineGain=0,this.distanceGain=0,this.useAddBlend=!1,this.vertexMarks=!1,this.clippers=[],this.modelBoundingMin=new c.Vector3,this.modelBoundingMax=new c.Vector3,this.styleRevision=0,this._positionVersion=0,this.numPoints=(r=t==null?void 0:t.numPoints)==null?0:r,this.matrixAutoUpdate=!1,this.frustumCulled=!1,t!=null&&t.normals||(i.flatShading=!0),this._boundingBox=new c.Box3(new c.Vector3(1/0,1/0,1/0),new c.Vector3(-1/0,-1/0,-1/0)),t!=null&&t.positions&&this._computeBoundsFromArray(t.positions,this.numPoints,this._boundingBox)}get positions(){var e,t;return(t=(e=this.geometry.getAttribute(`instancePosition`))==null?void 0:e.array)==null?new Float32Array:t}get colors(){var e,t;return(t=(e=this.geometry.getAttribute(`instanceColor`))==null?void 0:e.array)==null?new Float32Array:t}get normals(){let e=this.geometry.getAttribute(`instanceNormal`);return e?e.array:null}get positionVersion(){return this._positionVersion}get pointCount(){return this.numPoints}get visiblePointCount(){return this.geometry.instanceCount===1/0?this.numPoints:this.geometry.instanceCount}set visiblePointCount(e){this.geometry.instanceCount=Math.max(0,Math.min(e,this.numPoints))}swapPositionsBuffer(e){let t=this.geometry.getAttribute(`instancePosition`);t&&t.array===e||(this.geometry.setAttribute(`instancePosition`,new c.InstancedBufferAttribute(e,3)),this._positionVersion=this._positionVersion+1|0)}setLocalBoundingBox(e){this._boundingBox.copy(e)}getLocalBoundingBoxExtents(){if(this._boundingBox.isEmpty())return;let{min:e,max:t}=this._boundingBox;return[e.x,e.y,e.z,t.x,t.y,t.z]}get boundingBox(){let e=new c.Vector3;this._boundingBox.getCenter(e),e.add(this.position);let t=new c.Vector3;this._boundingBox.getSize(t),t.multiply(this.scale);let n=new c.Vector3().copy(t).multiplyScalar(.5);return new c.Box3(e.clone().sub(n),e.clone().add(n))}dispose(){this.dispatchEvent({type:`dispose`}),this.geometry.dispose(),this.material.dispose()}raycast(e,t){var n,r;let i=this.matrixWorld,a=(r=(n=e.params.Points)==null?void 0:n.threshold)==null?0:r;if(this._boundingBox.isEmpty())return;let o=new c.Vector3;this._boundingBox.getCenter(o);let s=new c.Vector3;this._boundingBox.getSize(s);let l=Math.max(s.x,s.y,s.z)*.5,u=new c.Sphere(o,l);if(u.applyMatrix4(i),u.radius+=a,e.ray.intersectsSphere(u)===!1)return;let d=new c.Matrix4().copy(i).invert(),f=new c.Ray().copy(e.ray).applyMatrix4(d),p=a/((this.scale.x+this.scale.y+this.scale.z)/3),m=p*p,h=this.positions,g=this.normals,_=this.numPoints,v=Zt(g,_),y=v?new c.Matrix3().getNormalMatrix(i):null,b=v?new c.Vector3:null;for(let n=0;n<_;n++){let r=new c.Vector3(h[n*3],h[n*3+1],h[n*3+2]),a=f.distanceSqToPoint(r);if(a<m){let o=new c.Vector3;f.closestPointToPoint(r,o),o.applyMatrix4(i);let s=e.ray.origin.distanceTo(o);if(s<e.near||s>e.far)continue;let l=null;v&&b&&y&&g&&(Qt(g,n,b),b.lengthSq()>1e-12&&(b.applyMatrix3(y).normalize(),l={a:n,b:n,c:n,normal:b.clone(),materialIndex:0})),t.push({distance:s,distanceToRay:Math.sqrt(a),point:o,index:n,face:l,object:this})}}}_computeBoundsFromArray(e,t,n){let r=1/0,i=1/0,a=1/0,o=-1/0,s=-1/0,c=-1/0;for(let n=0;n<t;n++){let t=n*3,l=e[t],u=e[t+1],d=e[t+2];l<r&&(r=l),u<i&&(i=u),d<a&&(a=d),l>o&&(o=l),u>s&&(s=u),d>c&&(c=d)}Number.isFinite(r)&&Number.isFinite(i)&&Number.isFinite(a)&&Number.isFinite(o)&&Number.isFinite(s)&&Number.isFinite(c)&&(n.min.set(r,i,a),n.max.set(o,s,c))}static createInstancedGeometry(e){var t;let n=new c.InstancedBufferGeometry;n.setAttribute(`position`,new c.BufferAttribute(en,3)),n.setIndex(tn);let r=(t=e==null?void 0:e.numPoints)==null?0:t;if(e!=null&&e.positions&&n.setAttribute(`instancePosition`,new c.InstancedBufferAttribute(e.positions,3)),e!=null&&e.colors){let t=e.colors instanceof Uint8Array;n.setAttribute(`instanceColor`,new c.InstancedBufferAttribute(e.colors,3,t))}e!=null&&e.normals&&n.setAttribute(`instanceNormal`,new c.InstancedBufferAttribute(e.normals,4,!0)),n.instanceCount=r;let i=new c.Box3;if(e!=null&&e.positions){let t=new c.Vector3;for(let n=0;n<r;n++)t.set(e.positions[n*3],e.positions[n*3+1],e.positions[n*3+2]),i.expandByPoint(t)}return n.boundingBox=i,n.boundingSphere=new c.Sphere,i.getBoundingSphere(n.boundingSphere),n}};function rn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function an(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var on='(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function t(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=e.apply(n,r);function s(e){t(o,i,a,s,c,`next`,e)}function c(e){t(o,i,a,s,c,`throw`,e)}s(void 0)})}}function r(){return i.apply(this,arguments)}function i(){return i=n(function*(e={}){var t,r=e,i=!1,a=!0,o=self.location.href;if(i||a){try{new URL(`.`,o).href}catch(e){}(function(){var e=n(function*(e){var t=yield fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)});return function(t){return e.apply(this,arguments)}})()}console.log.bind(console),console.error.bind(console);var s=!1;function c(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var l,u,d=!1;function f(){var e=N.buffer;new Int8Array(e),new Int16Array(e),r.HEAPU8=u=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),r.HEAPU32=new Uint32Array(e),r.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function p(){if(r.preRun)for(typeof r.preRun==`function`&&(r.preRun=[r.preRun]);r.preRun.length;)E(r.preRun.shift());S(T)}function m(){d=!0,L.c()}function h(){if(r.postRun)for(typeof r.postRun==`function`&&(r.postRun=[r.postRun]);r.postRun.length;)w(r.postRun.shift());S(C)}var g;function _(){return c(`\\0asm\\0\\0\\00\\b\\`\\`}}\\`|}\\`}\\`||\\`\\v\\0\\`\\0\\`\\0\\0\\x07aa\\0\\0\\r\\0\\0\\x07\\x07\\bAÀ¤\\v\\x07b\\0c\\0\\rd\\0\ne\\0\\ff\\0\\v\\f\núT\\rO| \\0 \\0¢"\\0 \\0 \\0¢"¢ \\0DiPîàBù>¢D\'èÀV¿\\xA0¢ DB:áSU¥?¢ \\0D^\\fýÿÿß¿¢D\\0\\0\\0\\0\\0\\0ð?\\xA0\\xA0\\xA0¶\\vT~@AÀ (\\0" \\0B\\x07|Bøÿÿÿ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vAÄ A06\\0A\\vAÀ \\x006\\0 \\vK| \\0 \\0 \\0¢"¢" ¢¢ D§F;ÍÆ>¢DtçÊâù\\0*¿\\xA0¢ D²ûn?¢Dw¬ËTUUÅ¿\\xA0¢ \\0\\xA0\\xA0¶\\v¨\\0@ A\\bN@ \\0D\\0\\0\\0\\0\\0\\0à¢!\\0 AÿI@ Aÿ\\x07k!\\f\\v \\0D\\0\\0\\0\\0\\0\\0à¢!\\0Aý AýO\\x1BAþk!\\f\\v AxJ\\r\\0 \\0D\\0\\0\\0\\0\\0\\0\\`¢!\\0 A¸pK@ AÉ\\x07j!\\f\\v \\0D\\0\\0\\0\\0\\0\\0\\`¢!\\0Aðh AðhM\\x1BAj!\\v \\0 Aÿ\\x07jB4¿¢\\v
} \\0¼"AvAÿq"AM} Aý\\0M@ \\0C\\0\\0\\0\\0\\v} \\0"\\0C\\0\\0\\0KC\\0\\0\\0Ë \\0"C\\0\\0\\0?^@ \\0 C\\0\\0¿\\f\\v \\0 "\\0 C\\0\\0\\0¿_E\\r\\0 \\0C\\0\\0?\\v"\\0 \\0 A\\0H\\x1B \\0\\v\\v!\\0 \\0C\\0\\0\\0\\0C\\0\\0\\0\\0 \\0¼Aÿÿÿÿ\\x07qAü\\x07M\\x1B\\v+\\0 \\0 \\0 \\0CkÓ\\r¼Cº/½Cuª*> \\0C®å4¿C\\0\\0?\\vÈ| \\0C\\`B¢\\r]A\\0AÿA}C\\0\\0\\0\\0 \\0¼"AüF\\r\\0@ Aü\\x07kAÿÿÿxM@ At"E@#\\0Ak"C\\0\\0¿8\\f *\\fC\\0\\0\\0\\0\\f\\v Aü\\x07F\\r AxI A\\0NqE@ \\0 \\0"\\0 \\0\\f\\v \\0C\\0\\0\\0K¼AÜ\\0k!\\vA\n+\\0 AÌùk"A|qk¾» AvAðq"+\\b¢D\\0\\0\\0\\0\\0\\0ð¿\\xA0" ¢"¢A\n+\\0 ¢A\n+\\0\\xA0\\xA0 ¢ Au·A\n+\\0¢ +\\b\\xA0 \\xA0\\xA0¶!\\0\\v \\0\\vC\\0\\0@AC\\0\\0¨AC\\0\\0~CC\\0\\0?ü\\0" AL\\x1B" AÿN\\x1B\\vAÿq\\vr \\0¼"Aÿÿÿq!@ AvAÿq"E\\r\\0 Að\\0M@ ArAñ\\0 kv!\\f\\v AK@Aø!A\\0!\\f\\v A\ntA\\x07k!\\v AvAqr A\\rvr\\v¬|\n}@ $G@ $A\\fl"\\0Aj"j*\\0! \\0A\\bj"j*\\0! \\0 \\bj \\0 j*\\0"8\\0 \\b j 8\\0 \\bj 8\\0 $At"\\x1Bj \\x1Bj"*\\x008\\0 $At"Ar"At"j j"*\\x008\\0 Ar"At"%j %j" *\\x008\\0 Ar"!At"&j &j""*\\x008\\0 \\0 \nj \\0 j"\'*\\x008\\0 \nj j"(*\\x008\\0 \n j j*\\0"8\\0 \\x07 \\x1Bj j-\\0\\0 j-\\0\\0A\\btr j-\\0\\0Atr !j-\\0\\0Atr6\\0 \\x07 j Atr6\\0 *\\0" "*\\0" *\\0" *\\0" "C\\0\\0\\0\\0^@ "! ! ! !\\vC\\0\\0?!C\\0\\0\\0\\0!C\\0\\0\\0\\0!} C\\0\\0\\0\\0]@ ! ! ! !\\v C\\0\\0? C\\0\\0?]\\x1B"¼"Aÿÿÿÿ\\x07q"\\0AüO@C\\0\\0\\0\\0CÚI@ A\\0N\\x1B \\0AüF\\rC\\0\\0\\0\\0 \\f\\v} \\0Aÿÿÿ÷M@CÚÉ? \\0AI\\rCh!¢3 \\x07 CÚÉ?\\f\\v A\\0H@CÚÉ? C\\0\\0?C\\0\\0\\0?"" \\x07Ch!¢³" \\f\\vC\\0\\0? C\\0\\0\\0?"" \\x07 ¼A\\`q¾" " \\v\\v"!#\\0Ak"$\\0@ ¼"Aÿÿÿÿ\\x07q"\\0AÚ¤úM@ \\0AÌI\\r »!\\f\\v \\0AѧíM@ »!\\v \\0AãÛM@ A\\0H@ \\vD-DTû!ù?\\xA0!\\f\\v \\vD-DTû!ù¿\\xA0!\\f\\vD-DTû! ÀD-DTû! @ A\\0N\\x1B \\v\\xA0!\\f\\v \\0AÕãM@ \\0AßÛ¿
M@ »!\\v A\\0H@ \\vDÒ!3|Ù@\\xA0!\\f\\v \\vDÒ!3|ÙÀ\\xA0!\\f\\vD-DTû!@D-DTû!À A\\0H\\x1B »\\xA0!\\f\\v \\0Aü\\x07O@ !\\f\\v#\\0Ak"$\\0@ ¼")Aÿÿÿÿ\\x07q"\\0AÚ¤îM@ »"\\f \\fDÈÉm0_ä?¢D\\0\\0\\0\\0\\0\\x008C\\xA0D\\0\\0\\0\\0\\0\\x008Ã\\xA0"\\vD\\0\\0\\0Pû!ù¿¢\\xA0 \\vDcba´Q¾¢\\xA0"\\r9\\b \\vü!\\0 \\rD\\0\\0\\0\\`û!é¿c@ \\f \\vD\\0\\0\\0\\0\\0\\0ð¿\\xA0"\\vD\\0\\0\\0Pû!ù¿¢\\xA0 \\vDcba´Q¾¢\\xA09\\b \\0Ak!\\0\\f\\v \\rD\\0\\0\\0\\`û!é?dE\\r \\f \\vD\\0\\0\\0\\0\\0\\0ð?\\xA0"\\vD\\0\\0\\0Pû!ù¿¢\\xA0 \\vDcba´Q¾¢\\xA09\\b \\0Aj!\\0\\f\\v \\0Aü\\x07O@ »9\\bA\\0!\\0\\f\\v \\0 \\0AvAk"\\0Atk¾»9\\b A\\bj!"A\\0!#\\0A°k"$\\0 \\0 \\0AkAm"A\\0 A\\0J\\x1B"Ahlj!A\\xA0\n(\\0"A\\0N@ Aj!\\0 !@ AÀj Atj A\\0H|D\\0\\0\\0\\0\\0\\0\\0\\0 At(°\n·\\v9\\0 Aj! Aj" \\0G\\r\\0\\v\\v Ak!\\x1BA\\0!\\0 A\\0 A\\0J\\x1B!@A\\0!D\\0\\0\\0\\0\\0\\0\\0\\0!\\v@ " Atj+\\0 AÀj \\0 kAtj+\\0¢ \\v\\xA0!\\v Aj"AG\\r\\0\\v \\0Atj \\v9\\0 \\0 F \\0Aj!\\0E\\r\\0\\vA/ k!*A0 k!# AtA°\nj!+ Ak!, !\\0@@ \\0Atj+\\0!\\vA\\0! \\0! \\0A\\0J@@ Aàj Atj \\vD\\0\\0\\0\\0\\0\\0p>¢ü·"\\fD\\0\\0\\0\\0\\0\\0pÁ¢ \\v\\xA0ü6\\0 AtjA\\bk+\\0 \\f\\xA0!\\v Ak! Aj" \\0G\\r\\0\\v\\v \\v \\x1B"\\v \\vD\\0\\0\\0\\0\\0\\0À?¢D\\0\\0\\0\\0\\0\\0 À¢\\xA0"\\v \\vü" ·¡!\\v@@@ \\x1BA\\0L"-E@ \\0At j" (Ü" #u" #tk"6Ü j! *u\\f\\v \\x1B\\r \\0At j(ÜAu\\v"!A\\0L\\r\\f\\vA!! \\vD\\0\\0\\0\\0\\0\\0à?f\\r\\0A\\0!!\\f\\vA\\0!A\\0!A! \\0A\\0J@@ Aàj Atj".(\\0!@ . Aÿÿÿ\\x07 E\\rA\\b\\v k6\\0A!A\\0\\f\\vA\\0!A\\v! Aj" \\0G\\r\\0\\v\\v@ -\\r\\0Aÿÿÿ!@@ ,\\0\\vAÿÿÿ!\\v \\0At j" (Ü q6Ü\\v Aj! !AG\\r\\0D\\0\\0\\0\\0\\0\\0ð? \\v¡!\\vA!! \\r\\0 \\vD\\0\\0\\0\\0\\0\\0ð? \\x1B¡!\\v\\v \\vD\\0\\0\\0\\0\\0\\0\\0\\0a@A\\0! \\0!@ \\0 L\\r\\0@ Aàj Ak"Atj(\\0 r! J\\r\\0\\v E\\r\\0@ \\x1BAk!\\x1B Aàj \\0Ak"\\0Atj(\\0E\\r\\0\\v\\f\\vA!@ "Aj! Aàj kAtj(\\0E\\r\\0\\v \\0 j!@ AÀj \\0Aj"\\0Atj + \\0Atj(\\0·9\\0A\\0!D\\0\\0\\0\\0\\0\\0\\0\\0!\\v@ " Atj+\\0 AÀj \\0 kAtj+\\0¢ \\v\\xA0!\\v Aj"AG\\r\\0\\v \\0Atj \\v9\\0 \\0 H\\r\\0\\v !\\0\\f\\v\\v@ \\vA k"\\vD\\0\\0\\0\\0\\0\\0pAf@ Aàj \\0Atj \\vD\\0\\0\\0\\0\\0\\0p>¢ü"·D\\0\\0\\0\\0\\0\\0pÁ¢ \\v\\xA0ü6\\0 \\0Aj!\\0 !\\x1B\\f\\v \\vü!\\v Aàj \\0Atj 6\\0\\vD\\0\\0\\0\\0\\0\\0ð? \\x1B!\\v \\0A\\0N@ \\0!@ "Atj \\v Aàj Atj(\\0·¢9\\0 Ak! \\vD\\0\\0\\0\\0\\0\\0p>¢!\\v \\r\\0\\vA\\0! \\0!@ J\\x1B!\\x1B \\0 k! Atj!"A\\0!D\\0\\0\\0\\0\\0\\0\\0\\0!\\v@ At"#+ " #j+\\0¢ \\v\\xA0!\\v \\x1BG Aj!\\r\\0\\v A\\xA0j Atj \\v9\\0 Ak! \\0 G Aj!\\r\\0\\v\\vD\\0\\0\\0\\0\\0\\0\\0\\0!\\v \\0A\\0N@@ \\0"Ak!\\0 \\v A\\xA0j Atj+\\0\\xA0!\\v \\r\\0\\v\\v \\v \\v !\\x1B9\\0 A°j$\\0 A\\x07q!\\0 +\\0!\\v )A\\0H@ \\v9\\bA\\0 \\0k!\\0\\f\\v \\v9\\b\\v Aj$\\0 +\\b!\\v@@@@ \\0AqAk\\0\\v \\v!\\f\\v \\v!\\f\\v \\v!\\f\\v \\v!\\v Aj$\\0 C½75^@ ! ! !\\v "C\\0\\0\\0\\0^@ ! ! !\\v@ C\\0\\0\\0\\0\\`@ !\\f\\vC\\0\\0? " C\\0\\0\\0\\0\\`\\x1B!C\\0\\0? " C\\0\\0\\0\\0\\`\\x1B!\\v C\\0\\0\\0?C\\0\\0\\0?C\\0\\0C! \\x07 %j C\\0\\0\\0?C\\0\\0\\0?C\\0\\0CC\\0\\0CüAt r C\\0\\0CüAtr6\\0 \'*\\0\\b!\\0 \\x07 &j \\0 (*\\0\\bA\\btr \\bAtr CÛI@C\\0\\0CC\\0\\0CüAtr6\\0 $Aj!$\\f\\v\\v\\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r (\\0"k"AØ (\\0I\\r \\0 j!\\0@@@AÜ (\\0 G@ (\\f! AÿM@ (\\b"G\\rAÈ AÈ (\\0A~ Avwq6\\0\\f\\v (!\\x07 G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rAÐ \\x006\\0 A~q6 \\0Ar6 \\x006\\0\\v 6\\f 6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(ø" F@ Aø"j 6\\0 \\rAÌ AÌ (\\0A~ wq6\\0\\f\\v@ \\x07(F@ \\x07 6\\f\\v \\x07 6\\v E\\r\\v \\x076 ("@ 6 6\\v ("E\\r\\0 6 6\\v O\\r\\0 ("AqE\\r\\0@@@@ AqE@Aà (\\0 F@Aà 6\\0AÔ AÔ (\\0 \\0j"\\x006\\0 \\0Ar6 AÜ (\\0G\\rAÐ A\\x006\\0AÜ A\\x006\\0\\vAÜ (\\0"\\x07 F@AÜ 6\\0AÐ AÐ (\\0 \\0j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\v Axq \\0j!\\0 (\\f! AÿM@ (\\b" F@AÈ AÈ (\\0A~ Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!\\b G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v A~q6 \\0Ar6 \\0 j \\x006\\0\\f\\vA\\0!\\v \\bE\\r\\0@ ("At"(ø" F@ Aø"j 6\\0 \\rAÌ AÌ (\\0A~ wq6\\0\\f\\v@ \\b(F@ \\b 6\\f\\v \\b 6\\v E\\r\\v \\b6 ("@ 6 6\\v ("E\\r\\0 6 6\\v \\0Ar6 \\0 j \\x006\\0 \\x07G\\r\\0AÐ \\x006\\0\\v \\0AÿM@ \\0AøqAð j!AÈ (\\0"A \\0Avt"\\0qE@AÈ \\0 r6\\0 \\f\\v (\\b\\v!\\0 6\\b \\0 6\\f 6\\f \\x006\\b\\vA! \\0Aÿÿÿ\\x07M@ \\0A& \\0A\\bvg"kvAq AtrA>s!\\v 6 B\\x007 AtAø"j!@AÌ (\\0"A t"qE@AÌ r6\\0 6\\0A!A\\b\\f\\v \\0A AvkA\\0 AG\\x1Bt! (\\0!@ "(Axq \\0F\\r Av! At! Aqj"("\\r\\0\\v 6A! !A\\b\\v!\\0 "\\f\\v (\\b" 6\\f 6\\bA!\\0A\\b!A\\0\\v! j 6\\0 6\\f \\0 j 6\\0Aè Aè (\\0Ak"\\0A \\0\\x1B6\\0\\v\\v¸\'\\v#\\0Ak"\n$\\0@@@@@@@@@@ \\0AôM@AÈ (\\0"A \\0A\\vjAøq \\0A\\vI\\x1B"Av"\\0v"Aq@@ AsAq \\0j"At"Að j"\\0 (ø "(\\b"F@AÈ A~ wq6\\0\\f\\v \\x006\\f \\0 6\\b\\v A\\bj!\\0 Ar6 j" (Ar6\\f\\v\\v AÐ (\\0"\\bM\\r @@A \\0t"A\\0 kr \\0tqh"At"Að j" (ø "\\0(\\b"F@AÈ A~ wq"6\\0\\f\\v 6\\f 6\\b\\v \\0 Ar6 \\0 j"\\x07 k"Ar6 \\0 j 6\\0 \\b@ \\bAxqAð j!AÜ (\\0! A \\bAvt"qE@AÈ r6\\0 \\f\\v (\\b\\v! 6\\b 6\\f 6\\f 6\\b\\v \\0A\\bj!\\0AÜ \\x076\\0AÐ 6\\0\\f\\v\\vAÌ (\\0"\\vE\\r \\vhAt(ø""(Axq k! !@@ ("\\0E@ ("\\0E\\r\\v \\0(Axq k" I"\\x1B! \\0 \\x1B! \\0!\\f\\v\\v (! (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\n\\v (" Aj ("E\\r Aj\\v!@ !\\x07 "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v \\x07A\\x006\\0\\f \\vA! \\0A¿K\\r\\0 \\0A\\vj"Axq!AÌ (\\0"\\x07E\\r\\0A!\\bA\\0 k! \\0Aôÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtkA>j!\\b\\v@@@ \\bAt(ø""E@A\\0!\\0\\f\\vA\\0!\\0 A \\bAvkA\\0 \\bAG\\x1Bt!@@ (Axq k" O\\r\\0 ! "\\r\\0A\\0! !\\0\\f\\v \\0 (" AvAqj("F\\x1B \\0 \\x1B!\\0 At! \\r\\0\\v\\v \\0 rE@A\\0!A \\bt"\\0A\\0 \\0kr \\x07q"\\0E\\r \\0hAt(ø"!\\0\\v \\0E\\r\\v@ \\0(Axq k" I! \\x1B! \\0 \\x1B! \\0(" \\0(\\v"\\0\\r\\0\\v\\v E\\r\\0 AÐ (\\0 kO\\r\\0 (!\\b (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\\b\\v (" Aj ("E\\r Aj\\v!@ ! "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v A\\x006\\0\\f\\x07\\v AÐ (\\0"M@AÜ (\\0!\\0@ k"AO@ \\0 j" Ar6 \\0 j 6\\0 \\0 Ar6\\f\\v \\0 Ar6 \\0 j" (Ar6A\\0!A\\0!\\vAÐ 6\\0AÜ 6\\0 \\0A\\bj!\\0\\f \\v AÔ (\\0"I@AÔ k"6\\0Aà Aà (\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f \\vA\\0!\\0 A/j"A\\xA0$(\\0@A¨$(\\0\\f\\vA¬$B7\\0A¤$B\\xA07\\0A\\xA0$ \nA\\fjApqAتժs6\\0A´$A\\x006\\0A$A\\x006\\0A \\v"j"A\\0 k"\\x07q" M\\r\\bA$(\\0"@Aø#(\\0"\\b j" \\bM Ir\\r \\v@A$-\\0\\0AqE@@@@@Aà (\\0"@A$!\\0@ \\0(\\0"\\b M@ \\b \\0(jI\\r\\v \\0(\\b"\\0\\r\\0\\v\\vA\\0"AF\\r !A¤$(\\0"\\0Ak" q@ k jA\\0 \\0kqj!\\v M\\rA$(\\0"\\0@Aø#(\\0" j"\\x07 M \\0 \\x07Ir\\r\\v "\\0 G\\r\\f\\v k \\x07q"" \\0(\\0 \\0(jF\\r !\\0\\v \\0AF\\r A0j M@ \\0!\\f\\vA¨$(\\0" kjA\\0 kq"AF\\r j! \\0!\\f\\v AG\\r\\vA$A$(\\0Ar6\\0\\v "AFA\\0"\\0AFr \\0 Mr\\r \\0 k" A(jM\\r\\vAø#Aø#(\\0 j"\\x006\\0Aü#(\\0 \\0I@Aü# \\x006\\0\\v@Aà (\\0"@A$!\\0@ \\0(\\0" \\0("jF\\r \\0(\\b"\\0\\r\\0\\v\\f\\vAØ (\\0"\\0A\\0 \\0 M\\x1BE@AØ 6\\0\\vA\\0!\\0A$ 6\\0A$ 6\\0Aè A6\\0Aì A\\xA0$(\\x006\\0A$A\\x006\\0@ \\0At" Að j"6ø 6ü \\0Aj"\\0A G\\r\\0\\vAÔ A(k"\\0Ax kA\\x07q"k"6\\0Aà j"6\\0 Ar6 \\0 jA(6Aä A°$(\\x006\\0\\f\\v M Kr\\r \\0(\\fA\\bq\\r \\0 j6Aà Ax kA\\x07q"\\0j"6\\0AÔ AÔ (\\0 j" \\0k"\\x006\\0 \\0Ar6 jA(6Aä A°$(\\x006\\0\\f\\vA\\0!\\0\\f\\vA\\0!\\0\\f\\vAØ (\\0 K@AØ 6\\0\\v j!A$!\\0@@ \\0(\\0"G@ \\0(\\b"\\0\\r\\f\\v\\v \\0-\\0\\fA\\bqE\\r\\vA$!\\0@@ \\0(\\0" M@ \\0(j"I\\r\\v \\0(\\b!\\0\\f\\v\\vAÔ A(k"\\0Ax kA\\x07q"k"\\x076\\0Aà j"6\\0 \\x07Ar6 \\0 jA(6Aä A°$(\\x006\\0 A\' kA\\x07qjA/k"\\0 \\0 AjI\\x1B"A\\x1B6 A$)\\x007 A$)\\x007\\bA$ A\\bj6\\0A$ 6\\0A$ 6\\0A$A\\x006\\0 Aj!\\0@ \\0A\\x076 \\0A\\bj \\0Aj!\\0 I\\r\\0\\v F\\r\\0 (A~q6 k"Ar6 6\\0 AÿM@ AøqAð j!\\0AÈ (\\0"A Avt"qE@AÈ r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\fA\\f!A\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtAø"j!@@AÌ (\\0"A \\0t"qE@AÌ r6\\0 6\\0\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"("\\r\\0\\v 6\\v 6A\\b! "!\\0A\\f\\f\\v (\\b"\\0 6\\f 6\\b \\x006\\bA\\0!\\0A!A\\f\\v j 6\\0 j \\x006\\0\\vAÔ (\\0"\\0 M\\r\\0AÔ \\0 k"6\\0Aà Aà (\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f\\vAÄ A06\\0A\\0!\\0\\f\\v \\0 6\\0 \\0 \\0( j6 Ax kA\\x07qj"\\b Ar6 Ax kA\\x07qj" \\bj"k!\\x07@Aà (\\0 F@Aà 6\\0AÔ AÔ (\\0 \\x07j"\\x006\\0 \\0Ar6\\f\\vAÜ (\\0 F@AÜ 6\\0AÐ AÐ (\\0 \\x07j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\f\\v ("\\0AqAF@ \\0Axq! (\\f!@ \\0AÿM@ (\\b" F@AÈ AÈ (\\0A~ \\0Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!@ G@ (\\b"\\0 6\\f \\x006\\b\\f\\v@ ("\\0 Aj ("\\0E\\r Aj\\v!@ ! \\0"Aj! \\0("\\0\\r\\0 Aj! ("\\0\\r\\0\\v A\\x006\\0\\f\\vA\\0!\\v E\\r\\0@ ("\\0At"(ø" F@ Aø"j 6\\0 \\rAÌ AÌ (\\0A~ \\0wq6\\0\\f\\v@ (F@ 6\\f\\v 6\\v E\\r\\v 6 ("\\0@ \\x006 \\0 6\\v ("\\0E\\r\\0 \\x006 \\0 6\\v \\x07 j!\\x07 j"(!\\0\\v \\0A~q6 \\x07Ar6 \\x07j \\x076\\0 \\x07AÿM@ \\x07AøqAð j!\\0AÈ (\\0"A \\x07Avt"qE@AÈ r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA! \\x07Aÿÿÿ\\x07M@ \\x07A& \\x07A\\bvg"\\0kvAq \\0AtrA>s!\\v 6 B\\x007 AtAø"j!\\0@@AÌ (\\0"A t"qE@AÌ r6\\0 \\0 6\\0\\f\\v \\x07A AvkA\\0 AG\\x1Bt! \\0(\\0!@ "\\0(Axq \\x07F\\r Av! At! \\0 Aqj"("\\r\\0\\v 6\\v \\x006 6\\f 6\\b\\f\\v \\0(\\b" 6\\f \\0 6\\b A\\x006 \\x006\\f 6\\b\\v \\bA\\bj!\\0\\f\\v@ \\bE\\r\\0@ ("At"(ø" F@ Aø"j \\x006\\0 \\0\\rAÌ \\x07A~ wq"\\x076\\0\\f\\v@ \\b(F@ \\b \\x006\\f\\v \\b \\x006\\v \\0E\\r\\v \\0 \\b6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 AÿM@ AøqAð j!\\0AÈ (\\0"A Avt"qE@AÈ r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtAø"j!@@ \\x07A \\0t"qE@AÌ \\x07r6\\0 6\\0 6\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"\\x07("\\r\\0\\v \\x07 6 6\\v 6\\f 6\\b\\f\\v (\\b"\\0 6\\f 6\\b A\\x006 6\\f \\x006\\b\\v A\\bj!\\0\\f\\v@ E\\r\\0@ ("At"(ø" F@ Aø"j \\x006\\0 \\0\\rAÌ \\vA~ wq6\\0\\f\\v@ (F@ \\x006\\f\\v \\x006\\v \\0E\\r\\v \\0 6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 \\b@ \\bAxqAð j!\\0AÜ (\\0!A \\bAvt"\\x07 qE@AÈ \\x07r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\vAÜ 6\\0AÐ 6\\0\\v A\\bj!\\0\\v \nAj$\\0 \\0\\v\\0\\v\\vË\\0A\\b\\v÷¾óøyìaö?Þª÷{Õ¿=¯Jíqõ?ÛmÀ§ð¾Ò¿°ðð9ô?g:Q®Ð¿
¸°Éó?é$¦Ø1Ë¿¥d\\f\\ró?XwÀ\nOWÆ¿\\xA0\\v{"^ò?\\0Ç+ªÁ¿?4JJ»ñ?^ÎvNº¿ºåðX#ñ?ÌaZ<±¿§\\0A?ð?\\fá8ôR¢¿\\0\\0\\0\\0\\0\\0ð?\\0\\0\\0\\0\\0\\0\\0\\0¬Gý\\`î?Yò]ª¥ª?\\xA0j³¤ì?´.6ªS^¼?æüjW6 ë?\\bÛ wå&Å?-ª¡cÑÂé?pG"\\rÂË?íAxæè?á~\\xA0ÈÑ?bHSõÜgç? î¶W0Ô?ï9úþB.æ?4¸H£Ð¿j\\và\\v[WÕ?#A\nòþÿß¿\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0ù¢\\0DNn\\0ü)\\0ÑW\'\\0Ý4õ\\0bÛÀ\\0<\\0AC\\0cQþ\\0»Þ«\\0·aÅ\\0:n$\\0ÒMB\\0Ià\\0 ê.\\0Ñ\\0ëþ\\0)±\\0è>§\\0õ5\\0D».\\0é\\0´&p\\0A~_\\0Ö9\\0S9\\0ô9\\0_\\0(ù½\\0ø;\\0Þÿ\\0\\0/ï\\0\nZ\\0mm\\0Ï~6\\0 Ë\'\\0FO·\\0f?\\0-ê_\\0º\'u\\0åëÇ\\0={ñ\\0÷9\\x07\\0R\\0ûkê\\0±_\\0\\b]\\x000V\\0{üF\\0ð«k\\0 ¼Ï\\x006ô\\0ã©\\0^a\\0\\b\\x1Bæ\\0
e\\0\\xA0_\\0@h\\0Øÿ\\0\'sM\\01\\0ÊV\\0ɨs\\0{â\\`\\0kÀ\\0ÄG\\0ÍgÃ\\0 èÜ\\0Y*\\0vÄ\\0¦\\0D¯Ý\\0WÑ\\0¥>\\0\\x07ÿ\\x003~?\\0Â2è\\0OÞ\\0»}2\\0&=Ã\\0kï\\0ø^\\x005:\\0òÊ\\0ñ\\0|!\\0j$|\\0Õnú\\x000-w\\0;C\\0µÆ\\0Ã\\0ÄÂ\\0,MA\\0\\f\\0]\\0}F\\0ãq-\\0Æ\\x003b\\0\\0´Ò|\\0´§\\x007UÕ\\0×>ö\\0£\\0Mvü\\0d*\\0p׫\\0c|ø\\0z°W\\0ç\\0ÀIV\\0;ÖÙ\\0§8\\0$#Ë\\0Öw\\0ZT#\\0\\0¹\\0ñ\n\\x1B\\0Îß\\01ÿ\\0fj\\0Wa\\0¬ûG\\0~Ø\\0"e·\\x002è\\0æ¿\\`\\0ïÄÍ\\0l6 \\0]?Ô\\0Þ×\\0X;Þ\\0Þ\\0Ò"(\\0(è\\0âXM\\0ÆÊ2\\0\\bã\\0à}Ë\\0ÀP\\0ó§\\0à[\\0.4\\0b\\0H\\0õ[\\0°\\0éò\\0HJC\\0gÓ\\0ªÝØ\\0®_B\\0jaÎ\\0\n(¤\\0Ó´\\0¦ò\\0\\\\w\\0£Â\\0a<\\0sx\\0¯Z\\0o×½\\0-¦c\\0ô¿Ë\\0ï\\0&Ág\\0UÊE\\0ÊÙ6\\0(¨Ò\\0Âa\\0Éw\\0&\\0F\\0ÄYÄ\\0ÈÅD\\0M²\\0\\0ó\\0ÔC\\0)Iå\\0ýÕ\\0\\0¾ü\\0Ì\\0pÎî\\0>õ\\0ìñ\\0³çÃ\\0Çø(\\0\\0Áq>\\0. ³\\0\\vEó\\0\\0« {\\0.µ\\0GÂ\\0{2/\\0\\fUm\\0r§\\0kç\\x001Ë\\0yJ\\0Ayâ\\0ôß\\0è\\0âæ\\01\\0ík\\0__6\\0»ý\\0H´\\0g¤l\\0qrB\\0]2\\0¸\\0¼å \\01%\\0÷t9\\x000\\0\\r\\f\\0K\\bh\\0,îX\\0Gª\\0tç\\0½Ö$\\0÷}¦\\0nHr\\0ï\\0¦\\0´ö\\0ÑSQ\\0Ï\nò\\0 3\\0õK~\\0²ch\\0Ý>_\\0@]\\0
\\0UR)\\x007dÀ\\0mØ\\x002H2\\0[Lu\\0NqÔ\\0ETn\\0\\v Á\\0*õi\\0fÕ\\0\'\\x07\\0]P\\0´;Û\\0êvÅ\\0ù\\0Ik}\\0\'º\\0i)\\0ÆÌ¬\\0T\\0âj\\0Ù\\0,rP\\0¤¾\\0w\\x07\\0ó0p\\0\\0ü\'\\0êq¨\\0fÂI\\0dà=\\0Ý\\0£?\\0Cý\\0\\r\\x001AÞ\\09\\0Ýp\\0·ç\\0\\bß;\\07+\\0\\\\\\xA0\\0Z\\0\\0èØ\\0l¯\\0ÛÿK\\x008\\0Yv\\0b¥\\0aË»\\0ǹ\\0@½\\0Òò\\0Iu\'\\0ë¶ö\\0Û"»\\0\nª\\0&/\\0dv\\0 ;3\\0\\0Q:ª\\0£Â\\0¯í®\\0\\\\&\\0mÂM\\0-z\\0ÀV\\0?\\0 ðö\\0+@\\0m1\\x009´\\x07\\0\\f \\0ØÃ[\\0õÄ\\0ÆK\\0NÊ¥\\0§7Í\\0æ©6\\0«\\0ÝBh\\0cÞ\\0vï\\0hR\\0üÛ7\\0®¡«\\0ß1\\0\\0®¡\\0\\fûÚ\\0dMf\\0í·\\0)e0\\0WV¿\\0Gÿ:\\0jù¹\\0u¾ó\\0(ß\\0«0\\0fö\\0Ë\\0ú"\\0Ùä\\0=³¤\\0W\\x1B\\x006Í \\0NBé\\0¾¤\\x003#µ\\0ðª\\0Oe¨\\0ÒÁ¥\\0\\v?\\0[xÍ\\0#ùv\\0{\\0r\\0ƦS\\0onâ\\0ïë\\0\\0JX\\0ÄÚ·\\0ªfº\\0vÏÏ\\0Ñ\\0±ñ-\\0Á\\0Ãw\\0HÚ\\0÷]\\xA0\\0Æô\\0¬ð/\\0Ýì\\0?\\\\¼\\0ÐÞm\\0Ç\\0*Û¶\\0£%:\\0\\0¯\\0S\\0¶W\\0)-´\\0K~\\0Ú\\x07§\\0vª\\0{Y¡\\0*\\0Ü·-\\0úåý\\0Ûþ\\0¾ý\\0ävl\\0©ü\\0>p\\0
n\\0ýÿ\\0(>\\x07\\0ag3\\0*\\0M½ê\\0³ç¯\\0mn\\0g9\\x001¿[\\0×H\\x000ß\\0Ç-C\\0%a5\\0ÉpÎ\\x000˸\\0¿lý\\0¤\\0¢\\0lä\\0ZÝ\\xA0\\0!oG\\0bÒ\\0¹\\\\\\0paI\\0kVà\\0R\\0PU7\\0Õ·\\x003ñÄ\\0n_\\0]0ä\\0
.©\\0²Ã\\0¡26\\0\\b·¤\\0ê±Ô\\0÷!\\0iä\\0\'ÿw\\0\\f\\0@-\\0OÍ\\xA0\\0 ¥\\0³¢Ó\\0/]\n\\0´ùB\\0ÚË\\0}¾Ð\\0ÛÁ\\0«½\\0Ê¢\\0\\bj\\\\\\0.U\\0\'\\0U\\0ð\\0á\\x07\\0\\vd\\0A\\0¾Þ\\0Úý*\\0k%¶\\0{4\\0óþ\\0¹¿\\0hjO\\0J*¨\\0OÄZ\\0-ø¼\\0×Z\\0ôÇ\\0\\rM\\0 :¦\\0¤W_\\0?±\\08\\0Ì \\0qÝ\\0ÉÞ¶\\0¿\\`õ\\0Me\\0\\x07k\\0°¬\\0²ÀÐ\\0QUH\\0û\\0rÃ\\0£;\\0À@5\\0Ü{\\0àEÌ\\0N)ú\\0ÖÊÈ\\0èóA\\0|dÞ\\0dØ\\0Ù¾1\\0¤Ã\\0wXÔ\\0iãÅ\\0ðÚ\\0º:<\\0FF\\0Uu_\\0Ò½õ\\0nÆ\\0¬.]\\0Dí\\0>B\\0aÄ\\0)ýé\\0çÖó\\0"|Ê\\0o5\\0\\bàÅ\\0ÿ×\\0njâ\\0°ýÆ\\0\\bÁ\\0|]t\\0k²\\0Ín\\0>r{\\0Æj\\0÷Ï©\\0)sß\\0µÉº\\0·\\0Q\\0â²\\r\\0tº$\\0å}\\`\\0tØ\\0\\r,\\0\\f\\0~f\\0)\\0zv\\0ýý¾\\0VEï\\0Ù~6\\0ìÙ\\0º¹\\0Äü\\x001¨\'\\0ñnÃ\\0Å6\\0بV\\0´¨µ\\0ÏÌ\\0-\\0oW4\\0,V\\0Îã\\0Ö ¹\\0k^ª\\0>*\\0_Ì\\0ý\\vJ\\0áôû\\0;m\\0â,\\0éÔ\\0ü´©\\0ïîÑ\\0.5É\\0/9a\\x008!D\\0\\x1BÙÈ\\0ü\n\\0ûJj\\0/Ø\\0S´\\0N\\0T"Ì\\0*UÜ\\0ÀÆÖ\\0\\v\\0p¸\\0id\\0&Z\\`\\0?Rî\\0\\0ôµ\\0üËõ\\x004¼-\\x004¼î\\0è]Ì\\0Ý^\\`\\0g\\03ï\\0ɸ\\0aX\\0áW¼\\0QÆ\\0Ø>\\0ÝqH\\0-Ý\\0¯¡\\0!,F\\0Yó×\\0Ùz\\0TÀ\\0Oú\\0Vü\\0åy®\\0"6\\x008"\\0gÜ\\0Uèª\\0&8\\0Êç\\0Q\\r¤\\03±\\0©×\\0iH\\0e²ð\\0§\\0L\\0ùÑ6\\0!³\\0{J\\0Ï!\\0@Ü\\0ÜGU\\0át:\\0gëB\\0þß\\0^Ô_\\0{g¤\\0º¬z\\0Uö¢\\0+#\\0AºU\\0Yn\\b\\0!*\\x009G\\0ãæ\\0åÔ\\0Iû@\\0ÿVé\\0Ê\\0ÅY\\0ú+\\0ÓÁÅ\\0ÅÏ\\0ÛZ®\\0GÅ\\0
Cb\\0!;\\0,y\\0a\\0*L{\\0,\\0C¿\\0&\\0x<\\0¨Ää\\0åÛ{\\0Ä:Â\\0&ôê\\0÷g\\0\\r¿\\0e£+\\0=±\\0½|\\v\\0¤QÜ\\0\'Ýc\\0iáÝ\\0\\0¨)\\0hÎ(\\0 í´\\0D \\0NÊ\\0pc\\0~|#\\0¹2\\0§õ\\0Vç\\0!ñ\\b\\0µ*\\0o~M\\0¥Q\\0µù«\\0ßÖ\\0Ýa\\06\\0Ä:\\0¢¡\\0rím\\x009z\\0¸©\\0k2\\\\\\0F\'[\\0\\x004í\\0Ò\\0w\\0üôU\\0YM\\0àq\\0A \\v=@û!ù?\\0\\0\\0\\0-Dt>\\0\\0\\0Fø<\\0\\0\\0\\`QÌx;\\0\\0\\0\\x1Bð9\\0\\0\\0@ %z8\\0\\0\\0"ã6\\0\\0\\0\\0ói5\\0AÀ \\v@`)}function v(e){return e}function y(e,t){var n,r=v(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function b(){return{a:F}}function x(){function e(e,t){return L=e.exports,P(L),f(),L}var t=b();return r.instantiateWasm?new Promise((n,i)=>{r.instantiateWasm(t,(t,r)=>{n(e(t,r))})}):(g!=null||(g=_()),e(y(g,t)[0]))}for(var S=e=>{for(;e.length>0;)e.shift()(r)},C=[],w=e=>C.push(e),T=[],E=e=>T.push(e),D=()=>2147483648,O=(e,t)=>Math.ceil(e/t)*t,k=e=>{var t=(e-N.buffer.byteLength+65535)/65536|0;try{return N.grow(t),f(),1}catch(e){}},A=e=>{var t=u.length;e>>>=0;var n=D();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),k(Math.min(n,O(Math.max(e,i),65536))))return!0}return!1},j=new Uint8Array(123),M=25;M>=0;--M)j[48+M]=52+M,j[65+M]=M,j[97+M]=26+M;if(j[43]=62,j[47]=63,r.noExitRuntime&&r.noExitRuntime,r.print&&r.print,r.printErr&&r.printErr,r.wasmBinary&&r.wasmBinary,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.preInit)for(typeof r.preInit==`function`&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.shift()();var N;function P(e){r._pack=e.d,r._malloc=e.e,r._free=e.f,N=e.b,e.__indirect_function_table}var F={a:A};function I(){p();function e(){var e;r.calledRun=!0,!s&&(m(),l==null||l(r),(e=r.onRuntimeInitialized)==null||e.call(r),h())}r.setStatus?(r.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>r.setStatus(``),1),e()},1)):e()}var L=x();return I(),t=d?r:new Promise((e,t)=>{l=e}),t}),i.apply(this,arguments)}let a;function o(){return e(this,void 0,void 0,function*(){a=yield r()})}let s=0,c=[],l=!1,u=!1,d,f,p,m,h,g,_,v,y,b=t=>e(void 0,void 0,void 0,function*(){for(;u;)yield new Promise(e=>setTimeout(e,0));a||(u=!0,yield o(),u=!1);let e=Math.pow(2,Math.ceil(Math.log2(t.vertexCount)));e>s&&(s>0&&(a._free(d),a._free(f),a._free(p),a._free(m),a._free(h),a._free(g),a._free(_),a._free(v),a._free(y)),s=e,d=a._malloc(3*s*4),f=a._malloc(4*s*4),p=a._malloc(3*s*4),m=a._malloc(4*s),h=a._malloc(s),g=a._malloc(8*s*4),_=a._malloc(3*s*4),v=a._malloc(4*s*4),y=a._malloc(3*s*4)),a.HEAPF32.set(t.positions,d/4),a.HEAPF32.set(t.rotations,f/4),a.HEAPF32.set(t.scales,p/4),a.HEAPU8.set(t.colors,m),a.HEAPU8.set(t.selection,h),a._pack(t.selected,t.vertexCount,d,f,p,m,h,g,_,v,y);let n=new Uint32Array(a.HEAPU32.buffer,g,t.vertexCount*8),r=new Uint32Array(n.slice().buffer),i=new Float32Array(a.HEAPF32.buffer,_,t.vertexCount*3),c=new Float32Array(i.slice().buffer),b=new Float32Array(a.HEAPF32.buffer,v,t.vertexCount*4),x=new Float32Array(b.slice().buffer),S=new Float32Array(a.HEAPF32.buffer,y,t.vertexCount*3),C={data:r,worldPositions:c,worldRotations:x,worldScales:new Float32Array(S.slice().buffer),offset:t.offset,vertexCount:t.vertexCount,positions:t.positions.buffer,rotations:t.rotations.buffer,scales:t.scales.buffer,colors:t.colors.buffer,selection:t.selection.buffer};self.postMessage({response:C},[C.data.buffer,C.worldPositions.buffer,C.worldRotations.buffer,C.worldScales.buffer,C.positions,C.rotations,C.scales,C.colors,C.selection]),l=!1}),x=()=>{c.length!==0&&(l||(l=!0,b(c.shift()),setTimeout(()=>{l=!1,x()},0)))};self.onmessage=e=>new Promise((t,n)=>{if(e.data.splat){let n=e.data.splat;for(let e=0;e<c.length;e++)if(c[e].offset===n.offset){c[e]=n,t(!0);return}c.push(n),x(),t(!0)}})})();',sn=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,on],{type:`text/javascript;charset=utf-8`});function cn(e){let t;try{if(t=sn&&(self.URL||self.webkitURL).createObjectURL(sn),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(on),{name:e==null?void 0:e.name})}}function ln(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function un(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){ln(a,r,i,o,s,`next`,e)}function s(e){ln(a,r,i,o,s,`throw`,e)}o(void 0)})}}function dn(){return fn.apply(this,arguments)}function fn(){return fn=un(function*(e={}){var t,n=e,r=!1,i=!0,a={}.url;if(r||i){try{new URL(`.`,a).href}catch(e){}(function(){var e=un(function*(e){var t=yield fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)});return function(t){return e.apply(this,arguments)}})()}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==`function`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,F.c()}function m(){if(n.postRun)for(typeof n.postRun==`function`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(`\0asm\0\0\00\b\`\`}}\`|}\`}\`||\`\v\0\`\0\`\0\0\x07aa\0\0\r\0\0\x07\x07\bAÀ¤\v\x07b\0c\0\rd\0
|
|
303
|
+
e\0\ff\0\v\f
|
|
304
|
+
úT\rO| \0 \0¢"\0 \0 \0¢"¢ \0DiPîàBù>¢D'èÀV¿\xA0¢ DB:áSU¥?¢ \0D^\fýÿÿß¿¢D\0\0\0\0\0\0ð?\xA0\xA0\xA0¶\vT~@AÀ (\0" \0B\x07|Bøÿÿÿ|"BÿÿÿÿX@ §"\0?\0AtM\r \0\0\r\vAÄ A06\0A\vAÀ \x006\0 \vK| \0 \0 \0¢"¢" ¢¢ D§F;ÍÆ>¢DtçÊâù\0*¿\xA0¢ D²ûn?¢Dw¬ËTUUÅ¿\xA0¢ \0\xA0\xA0¶\v¨\0@ A\bN@ \0D\0\0\0\0\0\0à¢!\0 AÿI@ Aÿ\x07k!\f\v \0D\0\0\0\0\0\0à¢!\0Aý AýO\x1BAþk!\f\v AxJ\r\0 \0D\0\0\0\0\0\0\`¢!\0 A¸pK@ AÉ\x07j!\f\v \0D\0\0\0\0\0\0\`¢!\0Aðh AðhM\x1BAj!\v \0 Aÿ\x07jB4¿¢\v
} \0¼"AvAÿq"AM} Aý\0M@ \0C\0\0\0\0\v} \0"\0C\0\0\0KC\0\0\0Ë \0"C\0\0\0?^@ \0 C\0\0¿\f\v \0 "\0 C\0\0\0¿_E\r\0 \0C\0\0?\v"\0 \0 A\0H\x1B \0\v\v!\0 \0C\0\0\0\0C\0\0\0\0 \0¼Aÿÿÿÿ\x07qAü\x07M\x1B\v+\0 \0 \0 \0CkÓ\r¼Cº/½Cuª*> \0C®å4¿C\0\0?\vÈ| \0C\`B¢\r]A\0AÿA}C\0\0\0\0 \0¼"AüF\r\0@ Aü\x07kAÿÿÿxM@ At"E@#\0Ak"C\0\0¿8\f *\fC\0\0\0\0\f\v Aü\x07F\r AxI A\0NqE@ \0 \0"\0 \0\f\v \0C\0\0\0K¼AÜ\0k!\vA
|
|
305
|
+
+\0 AÌùk"A|qk¾» AvAðq"+\b¢D\0\0\0\0\0\0ð¿\xA0" ¢"¢A
|
|
306
|
+
+\0 ¢A
|
|
307
|
+
+\0\xA0\xA0 ¢ Au·A
|
|
308
|
+
+\0¢ +\b\xA0 \xA0\xA0¶!\0\v \0\vC\0\0@AC\0\0¨AC\0\0~CC\0\0?ü\0" AL\x1B" AÿN\x1B\vAÿq\vr \0¼"Aÿÿÿq!@ AvAÿq"E\r\0 Að\0M@ ArAñ\0 kv!\f\v AK@Aø!A\0!\f\v A
|
|
309
|
+
tA\x07k!\v AvAqr A\rvr\v¬|
|
|
310
|
+
}@ $G@ $A\fl"\0Aj"j*\0! \0A\bj"j*\0! \0 \bj \0 j*\0"8\0 \b j 8\0 \bj 8\0 $At"\x1Bj \x1Bj"*\x008\0 $At"Ar"At"j j"*\x008\0 Ar"At"%j %j" *\x008\0 Ar"!At"&j &j""*\x008\0 \0
|
|
311
|
+
j \0 j"'*\x008\0
|
|
312
|
+
j j"(*\x008\0
|
|
313
|
+
j j*\0"8\0 \x07 \x1Bj j-\0\0 j-\0\0A\btr j-\0\0Atr !j-\0\0Atr6\0 \x07 j Atr6\0 *\0" "*\0" *\0" *\0" "C\0\0\0\0^@ "! ! ! !\vC\0\0?!C\0\0\0\0!C\0\0\0\0!} C\0\0\0\0]@ ! ! ! !\v C\0\0? C\0\0?]\x1B"¼"Aÿÿÿÿ\x07q"\0AüO@C\0\0\0\0CÚI@ A\0N\x1B \0AüF\rC\0\0\0\0 \f\v} \0Aÿÿÿ÷M@CÚÉ? \0AI\rCh!¢3 \x07 CÚÉ?\f\v A\0H@CÚÉ? C\0\0?C\0\0\0?"" \x07Ch!¢³" \f\vC\0\0? C\0\0\0?"" \x07 ¼A\`q¾" " \v\v"!#\0Ak"$\0@ ¼"Aÿÿÿÿ\x07q"\0AÚ¤úM@ \0AÌI\r »!\f\v \0AѧíM@ »!\v \0AãÛM@ A\0H@ \vD-DTû!ù?\xA0!\f\v \vD-DTû!ù¿\xA0!\f\vD-DTû! ÀD-DTû! @ A\0N\x1B \v\xA0!\f\v \0AÕãM@ \0AßÛ¿
M@ »!\v A\0H@ \vDÒ!3|Ù@\xA0!\f\v \vDÒ!3|ÙÀ\xA0!\f\vD-DTû!@D-DTû!À A\0H\x1B »\xA0!\f\v \0Aü\x07O@ !\f\v#\0Ak"$\0@ ¼")Aÿÿÿÿ\x07q"\0AÚ¤îM@ »"\f \fDÈÉm0_ä?¢D\0\0\0\0\0\x008C\xA0D\0\0\0\0\0\x008Ã\xA0"\vD\0\0\0Pû!ù¿¢\xA0 \vDcba´Q¾¢\xA0"\r9\b \vü!\0 \rD\0\0\0\`û!é¿c@ \f \vD\0\0\0\0\0\0ð¿\xA0"\vD\0\0\0Pû!ù¿¢\xA0 \vDcba´Q¾¢\xA09\b \0Ak!\0\f\v \rD\0\0\0\`û!é?dE\r \f \vD\0\0\0\0\0\0ð?\xA0"\vD\0\0\0Pû!ù¿¢\xA0 \vDcba´Q¾¢\xA09\b \0Aj!\0\f\v \0Aü\x07O@ »9\bA\0!\0\f\v \0 \0AvAk"\0Atk¾»9\b A\bj!"A\0!#\0A°k"$\0 \0 \0AkAm"A\0 A\0J\x1B"Ahlj!A\xA0
|
|
314
|
+
(\0"A\0N@ Aj!\0 !@ AÀj Atj A\0H|D\0\0\0\0\0\0\0\0 At(°
|
|
315
|
+
·\v9\0 Aj! Aj" \0G\r\0\v\v Ak!\x1BA\0!\0 A\0 A\0J\x1B!@A\0!D\0\0\0\0\0\0\0\0!\v@ " Atj+\0 AÀj \0 kAtj+\0¢ \v\xA0!\v Aj"AG\r\0\v \0Atj \v9\0 \0 F \0Aj!\0E\r\0\vA/ k!*A0 k!# AtA°
|
|
316
|
+
j!+ Ak!, !\0@@ \0Atj+\0!\vA\0! \0! \0A\0J@@ Aàj Atj \vD\0\0\0\0\0\0p>¢ü·"\fD\0\0\0\0\0\0pÁ¢ \v\xA0ü6\0 AtjA\bk+\0 \f\xA0!\v Ak! Aj" \0G\r\0\v\v \v \x1B"\v \vD\0\0\0\0\0\0À?¢D\0\0\0\0\0\0 À¢\xA0"\v \vü" ·¡!\v@@@ \x1BA\0L"-E@ \0At j" (Ü" #u" #tk"6Ü j! *u\f\v \x1B\r \0At j(ÜAu\v"!A\0L\r\f\vA!! \vD\0\0\0\0\0\0à?f\r\0A\0!!\f\vA\0!A\0!A! \0A\0J@@ Aàj Atj".(\0!@ . Aÿÿÿ\x07 E\rA\b\v k6\0A!A\0\f\vA\0!A\v! Aj" \0G\r\0\v\v@ -\r\0Aÿÿÿ!@@ ,\0\vAÿÿÿ!\v \0At j" (Ü q6Ü\v Aj! !AG\r\0D\0\0\0\0\0\0ð? \v¡!\vA!! \r\0 \vD\0\0\0\0\0\0ð? \x1B¡!\v\v \vD\0\0\0\0\0\0\0\0a@A\0! \0!@ \0 L\r\0@ Aàj Ak"Atj(\0 r! J\r\0\v E\r\0@ \x1BAk!\x1B Aàj \0Ak"\0Atj(\0E\r\0\v\f\vA!@ "Aj! Aàj kAtj(\0E\r\0\v \0 j!@ AÀj \0Aj"\0Atj + \0Atj(\0·9\0A\0!D\0\0\0\0\0\0\0\0!\v@ " Atj+\0 AÀj \0 kAtj+\0¢ \v\xA0!\v Aj"AG\r\0\v \0Atj \v9\0 \0 H\r\0\v !\0\f\v\v@ \vA k"\vD\0\0\0\0\0\0pAf@ Aàj \0Atj \vD\0\0\0\0\0\0p>¢ü"·D\0\0\0\0\0\0pÁ¢ \v\xA0ü6\0 \0Aj!\0 !\x1B\f\v \vü!\v Aàj \0Atj 6\0\vD\0\0\0\0\0\0ð? \x1B!\v \0A\0N@ \0!@ "Atj \v Aàj Atj(\0·¢9\0 Ak! \vD\0\0\0\0\0\0p>¢!\v \r\0\vA\0! \0!@ J\x1B!\x1B \0 k! Atj!"A\0!D\0\0\0\0\0\0\0\0!\v@ At"#+ " #j+\0¢ \v\xA0!\v \x1BG Aj!\r\0\v A\xA0j Atj \v9\0 Ak! \0 G Aj!\r\0\v\vD\0\0\0\0\0\0\0\0!\v \0A\0N@@ \0"Ak!\0 \v A\xA0j Atj+\0\xA0!\v \r\0\v\v \v \v !\x1B9\0 A°j$\0 A\x07q!\0 +\0!\v )A\0H@ \v9\bA\0 \0k!\0\f\v \v9\b\v Aj$\0 +\b!\v@@@@ \0AqAk\0\v \v!\f\v \v!\f\v \v!\f\v \v!\v Aj$\0 C½75^@ ! ! !\v "C\0\0\0\0^@ ! ! !\v@ C\0\0\0\0\`@ !\f\vC\0\0? " C\0\0\0\0\`\x1B!C\0\0? " C\0\0\0\0\`\x1B!\v C\0\0\0?C\0\0\0?C\0\0C! \x07 %j C\0\0\0?C\0\0\0?C\0\0CC\0\0CüAt r C\0\0CüAtr6\0 '*\0\b!\0 \x07 &j \0 (*\0\bA\btr \bAtr CÛI@C\0\0CC\0\0CüAtr6\0 $Aj!$\f\v\v\vß\v\b@ \0E\r\0 \0A\bk" \0Ak(\0"Axq"\0j!@ Aq\r\0 AqE\r (\0"k"AØ (\0I\r \0 j!\0@@@AÜ (\0 G@ (\f! AÿM@ (\b"G\rAÈ AÈ (\0A~ Avwq6\0\f\v (!\x07 G@ (\b" 6\f 6\b\f\v (" Aj ("E\r Aj\v!@ ! "Aj! ("\r\0 Aj! ("\r\0\v A\x006\0\f\v ("AqAG\rAÐ \x006\0 A~q6 \0Ar6 \x006\0\v 6\f 6\b\f\vA\0!\v \x07E\r\0@ ("At"(ø" F@ Aø"j 6\0 \rAÌ AÌ (\0A~ wq6\0\f\v@ \x07(F@ \x07 6\f\v \x07 6\v E\r\v \x076 ("@ 6 6\v ("E\r\0 6 6\v O\r\0 ("AqE\r\0@@@@ AqE@Aà (\0 F@Aà 6\0AÔ AÔ (\0 \0j"\x006\0 \0Ar6 AÜ (\0G\rAÐ A\x006\0AÜ A\x006\0\vAÜ (\0"\x07 F@AÜ 6\0AÐ AÐ (\0 \0j"\x006\0 \0Ar6 \0 j \x006\0\v Axq \0j!\0 (\f! AÿM@ (\b" F@AÈ AÈ (\0A~ Avwq6\0\f\v 6\f 6\b\f\v (!\b G@ (\b" 6\f 6\b\f\v (" Aj ("E\r Aj\v!@ ! "Aj! ("\r\0 Aj! ("\r\0\v A\x006\0\f\v A~q6 \0Ar6 \0 j \x006\0\f\vA\0!\v \bE\r\0@ ("At"(ø" F@ Aø"j 6\0 \rAÌ AÌ (\0A~ wq6\0\f\v@ \b(F@ \b 6\f\v \b 6\v E\r\v \b6 ("@ 6 6\v ("E\r\0 6 6\v \0Ar6 \0 j \x006\0 \x07G\r\0AÐ \x006\0\v \0AÿM@ \0AøqAð j!AÈ (\0"A \0Avt"\0qE@AÈ \0 r6\0 \f\v (\b\v!\0 6\b \0 6\f 6\f \x006\b\vA! \0Aÿÿÿ\x07M@ \0A& \0A\bvg"kvAq AtrA>s!\v 6 B\x007 AtAø"j!@AÌ (\0"A t"qE@AÌ r6\0 6\0A!A\b\f\v \0A AvkA\0 AG\x1Bt! (\0!@ "(Axq \0F\r Av! At! Aqj"("\r\0\v 6A! !A\b\v!\0 "\f\v (\b" 6\f 6\bA!\0A\b!A\0\v! j 6\0 6\f \0 j 6\0Aè Aè (\0Ak"\0A \0\x1B6\0\v\v¸'\v#\0Ak"
|
|
317
|
+
$\0@@@@@@@@@@ \0AôM@AÈ (\0"A \0A\vjAøq \0A\vI\x1B"Av"\0v"Aq@@ AsAq \0j"At"Að j"\0 (ø "(\b"F@AÈ A~ wq6\0\f\v \x006\f \0 6\b\v A\bj!\0 Ar6 j" (Ar6\f\v\v AÐ (\0"\bM\r @@A \0t"A\0 kr \0tqh"At"Að j" (ø "\0(\b"F@AÈ A~ wq"6\0\f\v 6\f 6\b\v \0 Ar6 \0 j"\x07 k"Ar6 \0 j 6\0 \b@ \bAxqAð j!AÜ (\0! A \bAvt"qE@AÈ r6\0 \f\v (\b\v! 6\b 6\f 6\f 6\b\v \0A\bj!\0AÜ \x076\0AÐ 6\0\f\v\vAÌ (\0"\vE\r \vhAt(ø""(Axq k! !@@ ("\0E@ ("\0E\r\v \0(Axq k" I"\x1B! \0 \x1B! \0!\f\v\v (! (\f"\0G@ (\b" \x006\f \0 6\b\f
|
|
318
|
+
\v (" Aj ("E\r Aj\v!@ !\x07 "\0Aj! \0("\r\0 \0Aj! \0("\r\0\v \x07A\x006\0\f \vA! \0A¿K\r\0 \0A\vj"Axq!AÌ (\0"\x07E\r\0A!\bA\0 k! \0Aôÿÿ\x07M@ A& A\bvg"\0kvAq \0AtkA>j!\b\v@@@ \bAt(ø""E@A\0!\0\f\vA\0!\0 A \bAvkA\0 \bAG\x1Bt!@@ (Axq k" O\r\0 ! "\r\0A\0! !\0\f\v \0 (" AvAqj("F\x1B \0 \x1B!\0 At! \r\0\v\v \0 rE@A\0!A \bt"\0A\0 \0kr \x07q"\0E\r \0hAt(ø"!\0\v \0E\r\v@ \0(Axq k" I! \x1B! \0 \x1B! \0(" \0(\v"\0\r\0\v\v E\r\0 AÐ (\0 kO\r\0 (!\b (\f"\0G@ (\b" \x006\f \0 6\b\f\b\v (" Aj ("E\r Aj\v!@ ! "\0Aj! \0("\r\0 \0Aj! \0("\r\0\v A\x006\0\f\x07\v AÐ (\0"M@AÜ (\0!\0@ k"AO@ \0 j" Ar6 \0 j 6\0 \0 Ar6\f\v \0 Ar6 \0 j" (Ar6A\0!A\0!\vAÐ 6\0AÜ 6\0 \0A\bj!\0\f \v AÔ (\0"I@AÔ k"6\0Aà Aà (\0"\0 j"6\0 Ar6 \0 Ar6 \0A\bj!\0\f \vA\0!\0 A/j"A\xA0$(\0@A¨$(\0\f\vA¬$B7\0A¤$B\xA07\0A\xA0$
|
|
319
|
+
A\fjApqAتժs6\0A´$A\x006\0A$A\x006\0A \v"j"A\0 k"\x07q" M\r\bA$(\0"@Aø#(\0"\b j" \bM Ir\r \v@A$-\0\0AqE@@@@@Aà (\0"@A$!\0@ \0(\0"\b M@ \b \0(jI\r\v \0(\b"\0\r\0\v\vA\0"AF\r !A¤$(\0"\0Ak" q@ k jA\0 \0kqj!\v M\rA$(\0"\0@Aø#(\0" j"\x07 M \0 \x07Ir\r\v "\0 G\r\f\v k \x07q"" \0(\0 \0(jF\r !\0\v \0AF\r A0j M@ \0!\f\vA¨$(\0" kjA\0 kq"AF\r j! \0!\f\v AG\r\vA$A$(\0Ar6\0\v "AFA\0"\0AFr \0 Mr\r \0 k" A(jM\r\vAø#Aø#(\0 j"\x006\0Aü#(\0 \0I@Aü# \x006\0\v@Aà (\0"@A$!\0@ \0(\0" \0("jF\r \0(\b"\0\r\0\v\f\vAØ (\0"\0A\0 \0 M\x1BE@AØ 6\0\vA\0!\0A$ 6\0A$ 6\0Aè A6\0Aì A\xA0$(\x006\0A$A\x006\0@ \0At" Að j"6ø 6ü \0Aj"\0A G\r\0\vAÔ A(k"\0Ax kA\x07q"k"6\0Aà j"6\0 Ar6 \0 jA(6Aä A°$(\x006\0\f\v M Kr\r \0(\fA\bq\r \0 j6Aà Ax kA\x07q"\0j"6\0AÔ AÔ (\0 j" \0k"\x006\0 \0Ar6 jA(6Aä A°$(\x006\0\f\vA\0!\0\f\vA\0!\0\f\vAØ (\0 K@AØ 6\0\v j!A$!\0@@ \0(\0"G@ \0(\b"\0\r\f\v\v \0-\0\fA\bqE\r\vA$!\0@@ \0(\0" M@ \0(j"I\r\v \0(\b!\0\f\v\vAÔ A(k"\0Ax kA\x07q"k"\x076\0Aà j"6\0 \x07Ar6 \0 jA(6Aä A°$(\x006\0 A' kA\x07qjA/k"\0 \0 AjI\x1B"A\x1B6 A$)\x007 A$)\x007\bA$ A\bj6\0A$ 6\0A$ 6\0A$A\x006\0 Aj!\0@ \0A\x076 \0A\bj \0Aj!\0 I\r\0\v F\r\0 (A~q6 k"Ar6 6\0 AÿM@ AøqAð j!\0AÈ (\0"A Avt"qE@AÈ r6\0 \0\f\v \0(\b\v! \0 6\b 6\fA\f!A\b\f\vA!\0 Aÿÿÿ\x07M@ A& A\bvg"\0kvAq \0AtrA>s!\0\v \x006 B\x007 \0AtAø"j!@@AÌ (\0"A \0t"qE@AÌ r6\0 6\0\f\v A \0AvkA\0 \0AG\x1Bt!\0 (\0!@ "(Axq F\r \0Av! \0At!\0 Aqj"("\r\0\v 6\v 6A\b! "!\0A\f\f\v (\b"\0 6\f 6\b \x006\bA\0!\0A!A\f\v j 6\0 j \x006\0\vAÔ (\0"\0 M\r\0AÔ \0 k"6\0Aà Aà (\0"\0 j"6\0 Ar6 \0 Ar6 \0A\bj!\0\f\vAÄ A06\0A\0!\0\f\v \0 6\0 \0 \0( j6 Ax kA\x07qj"\b Ar6 Ax kA\x07qj" \bj"k!\x07@Aà (\0 F@Aà 6\0AÔ AÔ (\0 \x07j"\x006\0 \0Ar6\f\vAÜ (\0 F@AÜ 6\0AÐ AÐ (\0 \x07j"\x006\0 \0Ar6 \0 j \x006\0\f\v ("\0AqAF@ \0Axq! (\f!@ \0AÿM@ (\b" F@AÈ AÈ (\0A~ \0Avwq6\0\f\v 6\f 6\b\f\v (!@ G@ (\b"\0 6\f \x006\b\f\v@ ("\0 Aj ("\0E\r Aj\v!@ ! \0"Aj! \0("\0\r\0 Aj! ("\0\r\0\v A\x006\0\f\vA\0!\v E\r\0@ ("\0At"(ø" F@ Aø"j 6\0 \rAÌ AÌ (\0A~ \0wq6\0\f\v@ (F@ 6\f\v 6\v E\r\v 6 ("\0@ \x006 \0 6\v ("\0E\r\0 \x006 \0 6\v \x07 j!\x07 j"(!\0\v \0A~q6 \x07Ar6 \x07j \x076\0 \x07AÿM@ \x07AøqAð j!\0AÈ (\0"A \x07Avt"qE@AÈ r6\0 \0\f\v \0(\b\v! \0 6\b 6\f \x006\f 6\b\f\vA! \x07Aÿÿÿ\x07M@ \x07A& \x07A\bvg"\0kvAq \0AtrA>s!\v 6 B\x007 AtAø"j!\0@@AÌ (\0"A t"qE@AÌ r6\0 \0 6\0\f\v \x07A AvkA\0 AG\x1Bt! \0(\0!@ "\0(Axq \x07F\r Av! At! \0 Aqj"("\r\0\v 6\v \x006 6\f 6\b\f\v \0(\b" 6\f \0 6\b A\x006 \x006\f 6\b\v \bA\bj!\0\f\v@ \bE\r\0@ ("At"(ø" F@ Aø"j \x006\0 \0\rAÌ \x07A~ wq"\x076\0\f\v@ \b(F@ \b \x006\f\v \b \x006\v \0E\r\v \0 \b6 ("@ \0 6 \x006\v ("E\r\0 \0 6 \x006\v@ AM@ j"\0Ar6 \0 j"\0 \0(Ar6\f\v Ar6 j" Ar6 j 6\0 AÿM@ AøqAð j!\0AÈ (\0"A Avt"qE@AÈ r6\0 \0\f\v \0(\b\v! \0 6\b 6\f \x006\f 6\b\f\vA!\0 Aÿÿÿ\x07M@ A& A\bvg"\0kvAq \0AtrA>s!\0\v \x006 B\x007 \0AtAø"j!@@ \x07A \0t"qE@AÌ \x07r6\0 6\0 6\f\v A \0AvkA\0 \0AG\x1Bt!\0 (\0!@ "(Axq F\r \0Av! \0At!\0 Aqj"\x07("\r\0\v \x07 6 6\v 6\f 6\b\f\v (\b"\0 6\f 6\b A\x006 6\f \x006\b\v A\bj!\0\f\v@ E\r\0@ ("At"(ø" F@ Aø"j \x006\0 \0\rAÌ \vA~ wq6\0\f\v@ (F@ \x006\f\v \x006\v \0E\r\v \0 6 ("@ \0 6 \x006\v ("E\r\0 \0 6 \x006\v@ AM@ j"\0Ar6 \0 j"\0 \0(Ar6\f\v Ar6 j" Ar6 j 6\0 \b@ \bAxqAð j!\0AÜ (\0!A \bAvt"\x07 qE@AÈ \x07r6\0 \0\f\v \0(\b\v! \0 6\b 6\f \x006\f 6\b\vAÜ 6\0AÐ 6\0\v A\bj!\0\v
|
|
320
|
+
Aj$\0 \0\v\0\v\vË\0A\b\v÷¾óøyìaö?Þª÷{Õ¿=¯Jíqõ?ÛmÀ§ð¾Ò¿°ðð9ô?g:Q®Ð¿
¸°Éó?é$¦Ø1Ë¿¥d\f\ró?XwÀ
|
|
321
|
+
OWÆ¿\xA0\v{"^ò?\0Ç+ªÁ¿?4JJ»ñ?^ÎvNº¿ºåðX#ñ?ÌaZ<±¿§\0A?ð?\fá8ôR¢¿\0\0\0\0\0\0ð?\0\0\0\0\0\0\0\0¬Gý\`î?Yò]ª¥ª?\xA0j³¤ì?´.6ªS^¼?æüjW6 ë?\bÛ wå&Å?-ª¡cÑÂé?pG"\rÂË?íAxæè?á~\xA0ÈÑ?bHSõÜgç? î¶W0Ô?ï9úþB.æ?4¸H£Ð¿j\và\v[WÕ?#A
|
|
322
|
+
òþÿß¿\0\0\0\0\0\0\0\0\0\0\0\0ù¢\0DNn\0ü)\0ÑW'\0Ý4õ\0bÛÀ\0<\0AC\0cQþ\0»Þ«\0·aÅ\0:n$\0ÒMB\0Ià\0 ê.\0Ñ\0ëþ\0)±\0è>§\0õ5\0D».\0é\0´&p\0A~_\0Ö9\0S9\0ô9\0_\0(ù½\0ø;\0Þÿ\0\0/ï\0
|
|
323
|
+
Z\0mm\0Ï~6\0 Ë'\0FO·\0f?\0-ê_\0º'u\0åëÇ\0={ñ\0÷9\x07\0R\0ûkê\0±_\0\b]\x000V\0{üF\0ð«k\0 ¼Ï\x006ô\0ã©\0^a\0\b\x1Bæ\0
e\0\xA0_\0@h\0Øÿ\0'sM\01\0ÊV\0ɨs\0{â\`\0kÀ\0ÄG\0ÍgÃ\0 èÜ\0Y*\0vÄ\0¦\0D¯Ý\0WÑ\0¥>\0\x07ÿ\x003~?\0Â2è\0OÞ\0»}2\0&=Ã\0kï\0ø^\x005:\0òÊ\0ñ\0|!\0j$|\0Õnú\x000-w\0;C\0µÆ\0Ã\0ÄÂ\0,MA\0\f\0]\0}F\0ãq-\0Æ\x003b\0\0´Ò|\0´§\x007UÕ\0×>ö\0£\0Mvü\0d*\0p׫\0c|ø\0z°W\0ç\0ÀIV\0;ÖÙ\0§8\0$#Ë\0Öw\0ZT#\0\0¹\0ñ
|
|
324
|
+
\x1B\0Îß\01ÿ\0fj\0Wa\0¬ûG\0~Ø\0"e·\x002è\0æ¿\`\0ïÄÍ\0l6 \0]?Ô\0Þ×\0X;Þ\0Þ\0Ò"(\0(è\0âXM\0ÆÊ2\0\bã\0à}Ë\0ÀP\0ó§\0à[\0.4\0b\0H\0õ[\0°\0éò\0HJC\0gÓ\0ªÝØ\0®_B\0jaÎ\0
|
|
325
|
+
(¤\0Ó´\0¦ò\0\\w\0£Â\0a<\0sx\0¯Z\0o×½\0-¦c\0ô¿Ë\0ï\0&Ág\0UÊE\0ÊÙ6\0(¨Ò\0Âa\0Éw\0&\0F\0ÄYÄ\0ÈÅD\0M²\0\0ó\0ÔC\0)Iå\0ýÕ\0\0¾ü\0Ì\0pÎî\0>õ\0ìñ\0³çÃ\0Çø(\0\0Áq>\0. ³\0\vEó\0\0« {\0.µ\0GÂ\0{2/\0\fUm\0r§\0kç\x001Ë\0yJ\0Ayâ\0ôß\0è\0âæ\01\0ík\0__6\0»ý\0H´\0g¤l\0qrB\0]2\0¸\0¼å \01%\0÷t9\x000\0\r\f\0K\bh\0,îX\0Gª\0tç\0½Ö$\0÷}¦\0nHr\0ï\0¦\0´ö\0ÑSQ\0Ï
|
|
326
|
+
ò\0 3\0õK~\0²ch\0Ý>_\0@]\0
\0UR)\x007dÀ\0mØ\x002H2\0[Lu\0NqÔ\0ETn\0\v Á\0*õi\0fÕ\0'\x07\0]P\0´;Û\0êvÅ\0ù\0Ik}\0'º\0i)\0ÆÌ¬\0T\0âj\0Ù\0,rP\0¤¾\0w\x07\0ó0p\0\0ü'\0êq¨\0fÂI\0dà=\0Ý\0£?\0Cý\0\r\x001AÞ\09\0Ýp\0·ç\0\bß;\07+\0\\\xA0\0Z\0\0èØ\0l¯\0ÛÿK\x008\0Yv\0b¥\0aË»\0ǹ\0@½\0Òò\0Iu'\0ë¶ö\0Û"»\0
|
|
327
|
+
ª\0&/\0dv\0 ;3\0\0Q:ª\0£Â\0¯í®\0\\&\0mÂM\0-z\0ÀV\0?\0 ðö\0+@\0m1\x009´\x07\0\f \0ØÃ[\0õÄ\0ÆK\0NÊ¥\0§7Í\0æ©6\0«\0ÝBh\0cÞ\0vï\0hR\0üÛ7\0®¡«\0ß1\0\0®¡\0\fûÚ\0dMf\0í·\0)e0\0WV¿\0Gÿ:\0jù¹\0u¾ó\0(ß\0«0\0fö\0Ë\0ú"\0Ùä\0=³¤\0W\x1B\x006Í \0NBé\0¾¤\x003#µ\0ðª\0Oe¨\0ÒÁ¥\0\v?\0[xÍ\0#ùv\0{\0r\0ƦS\0onâ\0ïë\0\0JX\0ÄÚ·\0ªfº\0vÏÏ\0Ñ\0±ñ-\0Á\0Ãw\0HÚ\0÷]\xA0\0Æô\0¬ð/\0Ýì\0?\\¼\0ÐÞm\0Ç\0*Û¶\0£%:\0\0¯\0S\0¶W\0)-´\0K~\0Ú\x07§\0vª\0{Y¡\0*\0Ü·-\0úåý\0Ûþ\0¾ý\0ävl\0©ü\0>p\0
n\0ýÿ\0(>\x07\0ag3\0*\0M½ê\0³ç¯\0mn\0g9\x001¿[\0×H\x000ß\0Ç-C\0%a5\0ÉpÎ\x000˸\0¿lý\0¤\0¢\0lä\0ZÝ\xA0\0!oG\0bÒ\0¹\\\0paI\0kVà\0R\0PU7\0Õ·\x003ñÄ\0n_\0]0ä\0
.©\0²Ã\0¡26\0\b·¤\0ê±Ô\0÷!\0iä\0'ÿw\0\f\0@-\0OÍ\xA0\0 ¥\0³¢Ó\0/]
|
|
328
|
+
\0´ùB\0ÚË\0}¾Ð\0ÛÁ\0«½\0Ê¢\0\bj\\\0.U\0'\0U\0ð\0á\x07\0\vd\0A\0¾Þ\0Úý*\0k%¶\0{4\0óþ\0¹¿\0hjO\0J*¨\0OÄZ\0-ø¼\0×Z\0ôÇ\0\rM\0 :¦\0¤W_\0?±\08\0Ì \0qÝ\0ÉÞ¶\0¿\`õ\0Me\0\x07k\0°¬\0²ÀÐ\0QUH\0û\0rÃ\0£;\0À@5\0Ü{\0àEÌ\0N)ú\0ÖÊÈ\0èóA\0|dÞ\0dØ\0Ù¾1\0¤Ã\0wXÔ\0iãÅ\0ðÚ\0º:<\0FF\0Uu_\0Ò½õ\0nÆ\0¬.]\0Dí\0>B\0aÄ\0)ýé\0çÖó\0"|Ê\0o5\0\bàÅ\0ÿ×\0njâ\0°ýÆ\0\bÁ\0|]t\0k²\0Ín\0>r{\0Æj\0÷Ï©\0)sß\0µÉº\0·\0Q\0â²\r\0tº$\0å}\`\0tØ\0\r,\0\f\0~f\0)\0zv\0ýý¾\0VEï\0Ù~6\0ìÙ\0º¹\0Äü\x001¨'\0ñnÃ\0Å6\0بV\0´¨µ\0ÏÌ\0-\0oW4\0,V\0Îã\0Ö ¹\0k^ª\0>*\0_Ì\0ý\vJ\0áôû\0;m\0â,\0éÔ\0ü´©\0ïîÑ\0.5É\0/9a\x008!D\0\x1BÙÈ\0ü
|
|
329
|
+
\0ûJj\0/Ø\0S´\0N\0T"Ì\0*UÜ\0ÀÆÖ\0\v\0p¸\0id\0&Z\`\0?Rî\0\0ôµ\0üËõ\x004¼-\x004¼î\0è]Ì\0Ý^\`\0g\03ï\0ɸ\0aX\0áW¼\0QÆ\0Ø>\0ÝqH\0-Ý\0¯¡\0!,F\0Yó×\0Ùz\0TÀ\0Oú\0Vü\0åy®\0"6\x008"\0gÜ\0Uèª\0&8\0Êç\0Q\r¤\03±\0©×\0iH\0e²ð\0§\0L\0ùÑ6\0!³\0{J\0Ï!\0@Ü\0ÜGU\0át:\0gëB\0þß\0^Ô_\0{g¤\0º¬z\0Uö¢\0+#\0AºU\0Yn\b\0!*\x009G\0ãæ\0åÔ\0Iû@\0ÿVé\0Ê\0ÅY\0ú+\0ÓÁÅ\0ÅÏ\0ÛZ®\0GÅ\0
Cb\0!;\0,y\0a\0*L{\0,\0C¿\0&\0x<\0¨Ää\0åÛ{\0Ä:Â\0&ôê\0÷g\0\r¿\0e£+\0=±\0½|\v\0¤QÜ\0'Ýc\0iáÝ\0\0¨)\0hÎ(\0 í´\0D \0NÊ\0pc\0~|#\0¹2\0§õ\0Vç\0!ñ\b\0µ*\0o~M\0¥Q\0µù«\0ßÖ\0Ýa\06\0Ä:\0¢¡\0rím\x009z\0¸©\0k2\\\0F'[\0\x004í\0Ò\0w\0üôU\0YM\0àq\0A \v=@û!ù?\0\0\0\0-Dt>\0\0\0Fø<\0\0\0\`QÌx;\0\0\0\x1Bð9\0\0\0@ %z8\0\0\0"ã6\0\0\0\0ói5\0AÀ \v@`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:ee}}function b(){function e(e,t){return F=e.exports,N(F),d(),F}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h!=null||(h=g()),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch(e){}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==`function`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var ee={a:k};function P(){f();function e(){var e;n.calledRun=!0,!o&&(p(),c==null||c(n),(e=n.onRuntimeInitialized)==null||e.call(n),m())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var F=b();return P(),t=u?n:new Promise((e,t)=>{c=e}),t}),fn.apply(this,arguments)}var pn=new c.Matrix4,mn=null;function hn(){return mn||(mn=dn()),mn}var gn=null;function _n(){return gn||(gn=new cn),gn}var vn=class{static warmupWasm(){hn()}constructor(e,t=0){this.dataChanged=!1,this.transformsChanged=!1,this.maxShDegree=0,this.initialBuildComplete=!1,this.pendingInitialBuildCount=0,this.sortDataReleased=!1,this.aggregatedDataReleased=!1,this.shDataReleased=!1,this.indexDataReleased=!1,this.disposed=!1,this.resolveReadyPromise=null,this.objectsInOrder=[],this.generation=t,this.readyPromise=new Promise(e=>{this.resolveReadyPromise=e});let n=0,r=0;this.splatIndices=new Map,this.offsets=new Map,this.layerKeys=[],this.layerKeyToIndex=new Map,this.objectLayerIndices=new Map;let i=new Map;e.forEach(e=>{this.splatIndices.set(e,r),this.offsets.set(e,n),i.set(n,e);let t=e.gsViewLayerKey||e.uuid,a=this.layerKeyToIndex.get(t);a===void 0&&(a=this.layerKeys.length,this.layerKeys.push(t),this.layerKeyToIndex.set(t,a)),this.objectLayerIndices.set(e,a),n+=e.numPoints,r++,this.objectsInOrder.push(e)}),this.numPoints=n,this.pendingInitialBuildCount=e.length,this.initialBuildComplete=this.pendingInitialBuildCount===0,this.width=2048,this.height=Math.ceil(this.numPoints/this.width),this.data=new Uint32Array(this.width*this.height*4),this.transformsWidth=9,this.transformsHeight=i.size,this.transforms=new Float32Array(this.transformsWidth*this.transformsHeight*4),this.transformIndicesWidth=1024,this.transformIndicesHeight=Math.ceil(this.numPoints/this.transformIndicesWidth),this.transformIndices=new Uint32Array(this.transformIndicesWidth*this.transformIndicesHeight),this.layerIndicesWidth=1024,this.layerIndicesHeight=Math.ceil(this.numPoints/this.layerIndicesWidth),this.layerIndices=new Uint32Array(this.layerIndicesWidth*this.layerIndicesHeight),this.positions=new Float32Array(this.numPoints*3),this.rotations=new Float32Array(this.numPoints*4),this.scales=new Float32Array(this.numPoints*3);let a=0;e.forEach(e=>{e.maxSHDegree>a&&(a=e.maxSHDegree)}),this.maxShDegree=a,a>=1&&(this.sh1=new Float32Array(this.numPoints*9)),a>=2&&(this.sh2=new Float32Array(this.numPoints*15)),a>=3&&(this.sh3=new Float32Array(this.numPoints*21)),e.forEach(e=>{let t=this.offsets.get(e);e.sh1&&this.sh1&&this.sh1.set(e.sh1,t*9),e.sh2&&this.sh2&&this.sh2.set(e.sh2,t*15),e.sh3&&this.sh3&&this.sh3.set(e.sh3,t*21)}),this.worker=_n(),this.worker.onmessage=e=>{if(!this.disposed&&e.data.response){let t=e.data.response,n=i.get(t.offset);if(!n)return;this.updateTransform(n);let r=this.splatIndices.get(n),a=this.objectLayerIndices.get(n);for(let e=0;e<n.numPoints;e++)this.transformIndices[t.offset+e]=r,this.layerIndices[t.offset+e]=a;this.data.set(t.data,t.offset*4),n.reattach(t.positions,t.rotations,t.scales,t.colors,t.selection),this.positions.set(t.worldPositions,t.offset*3),this.rotations.set(t.worldRotations,t.offset*4),this.scales.set(t.worldScales,t.offset*3),n.selectedChanged=!1,this.dataChanged=!0}},hn().then(e=>{if(this.disposed){this.completeInitialBuild();return}this.splatIndices.forEach((t,n)=>{this.disposed||this.buildImmediate(e,n)})}).catch(e=>{console.warn(`RenderData wasm load failed:`,e),this.completeInitialBuild()}),this.pendingInitialBuildCount===0&&this.completeInitialBuild()}updateTransform(e){let t=this.splatIndices.get(e)*36,n=e.matrixWorld.elements;this.transforms.set(n,t),this.transforms[t+16]=+!!e.selected,this.transforms[t+17]=0,this.transforms[t+18]=0,this.transforms[t+19]=0,pn.copy(e.matrixWorld).invert(),this.transforms.set(pn.elements,t+20),e.transformChanged=!1,e.selectedChanged=!1,this.transformsChanged=!0}releaseSortData(){this.sortDataReleased||(this.positions=new Float32Array,this.rotations=new Float32Array,this.scales=new Float32Array,this.sortDataReleased=!0)}releaseAggregatedData(){this.aggregatedDataReleased||(this.data=new Uint32Array,this.indexDataReleased||this.releaseIndexData(),this.shDataReleased||this.releaseSHData(),this.aggregatedDataReleased=!0)}releaseSHData(){this.shDataReleased||(this.sh1=void 0,this.sh2=void 0,this.sh3=void 0,this.shDataReleased=!0)}releaseIndexData(){this.indexDataReleased||(this.transformIndices=new Uint32Array,this.layerIndices=new Uint32Array,this.indexDataReleased=!0)}rebuildSortData(){return an(this,void 0,void 0,function*(){if(!this.sortDataReleased||this.disposed)return;let e=yield hn();if(!this.disposed){this.positions=new Float32Array(this.numPoints*3),this.rotations=new Float32Array(this.numPoints*4),this.scales=new Float32Array(this.numPoints*3);for(let t of this.objectsInOrder){let n=this.offsets.get(t);if(n===void 0)continue;let r=e._malloc(3*t.numPoints*4),i=e._malloc(4*t.numPoints*4),a=e._malloc(3*t.numPoints*4),o=e._malloc(4*t.numPoints),s=e._malloc(t.numPoints),c=e._malloc(4*t.numPoints*4),l=e._malloc(3*t.numPoints*4),u=e._malloc(4*t.numPoints*4),d=e._malloc(3*t.numPoints*4);e.HEAPF32.set(t.positions,r/4),e.HEAPF32.set(t.rotations,i/4),e.HEAPF32.set(t.scales,a/4),e.HEAPU8.set(t.colors,o),e.HEAPU8.set(t.selection,s),e._pack(t.selected,t.numPoints,r,i,a,o,s,c,l,u,d);let f=new Float32Array(e.HEAPF32.buffer,l,t.numPoints*3),p=new Float32Array(e.HEAPF32.buffer,u,t.numPoints*4),m=new Float32Array(e.HEAPF32.buffer,d,t.numPoints*3);this.positions.set(f,n*3),this.rotations.set(p,n*4),this.scales.set(m,n*3),e._free(r),e._free(i),e._free(a),e._free(o),e._free(s),e._free(c),e._free(l),e._free(u),e._free(d)}this.sortDataReleased=!1}})}getObjectsInOrder(){return this.objectsInOrder}canIncrementalAppend(e){if(this.disposed||e.length<=this.objectsInOrder.length)return!1;for(let t=0;t<this.objectsInOrder.length;t++)if(e[t]!==this.objectsInOrder[t])return!1;return!0}appendObjects(e){return an(this,void 0,void 0,function*(){if(this.disposed)return!1;if(e.length===0)return!0;let t=yield hn();if(this.disposed)return!1;let n=this.numPoints,r=this.objectsInOrder.length,i=n+e.reduce((e,t)=>e+t.numPoints,0),a=r+e.length;this.numPoints=i,this.height=Math.ceil(this.numPoints/this.width),this.data=this.expandUint32Array(this.data,this.width*this.height*4),this.transformsHeight=a,this.transforms=this.expandFloat32Array(this.transforms,this.transformsWidth*this.transformsHeight*4),this.transformIndicesHeight=Math.ceil(this.numPoints/this.transformIndicesWidth),this.transformIndices=this.expandUint32Array(this.transformIndices,this.transformIndicesWidth*this.transformIndicesHeight),this.layerIndicesHeight=Math.ceil(this.numPoints/this.layerIndicesWidth),this.layerIndices=this.expandUint32Array(this.layerIndices,this.layerIndicesWidth*this.layerIndicesHeight),this.positions=this.expandFloat32Array(this.positions,this.numPoints*3),this.rotations=this.expandFloat32Array(this.rotations,this.numPoints*4),this.scales=this.expandFloat32Array(this.scales,this.numPoints*3);let o=e.reduce((e,t)=>Math.max(e,t.maxSHDegree),this.maxShDegree);o>this.maxShDegree&&(this.maxShDegree=o),this.maxShDegree>=1&&(this.sh1=this.expandFloat32Array(this.sh1,this.numPoints*9)),this.maxShDegree>=2&&(this.sh2=this.expandFloat32Array(this.sh2,this.numPoints*15)),this.maxShDegree>=3&&(this.sh3=this.expandFloat32Array(this.sh3,this.numPoints*21));let s=n,c=r;return e.forEach(e=>{this.splatIndices.set(e,c),this.offsets.set(e,s),this.objectsInOrder.push(e);let t=e.gsViewLayerKey||e.uuid,n=this.layerKeyToIndex.get(t);n===void 0&&(n=this.layerKeys.length,this.layerKeys.push(t),this.layerKeyToIndex.set(t,n)),this.objectLayerIndices.set(e,n),e.sh1&&this.sh1&&this.sh1.set(e.sh1,s*9),e.sh2&&this.sh2&&this.sh2.set(e.sh2,s*15),e.sh3&&this.sh3&&this.sh3.set(e.sh3,s*21),s+=e.numPoints,c++}),e.forEach(e=>{this.buildImmediate(t,e)}),!0})}buildImmediate(e,t){if(this.disposed)return;this.updateTransform(t);let n=e._malloc(3*t.numPoints*4),r=e._malloc(4*t.numPoints*4),i=e._malloc(3*t.numPoints*4),a=e._malloc(4*t.numPoints),o=e._malloc(t.numPoints),s=e._malloc(4*t.numPoints*4),c=e._malloc(3*t.numPoints*4),l=e._malloc(4*t.numPoints*4),u=e._malloc(3*t.numPoints*4);e.HEAPF32.set(t.positions,n/4),e.HEAPF32.set(t.rotations,r/4),e.HEAPF32.set(t.scales,i/4),e.HEAPU8.set(t.colors,a),e.HEAPU8.set(t.selection,o),e._pack(t.selected,t.numPoints,n,r,i,a,o,s,c,l,u);let d=new Uint32Array(e.HEAPU32.buffer,s,t.numPoints*4),f=new Float32Array(e.HEAPF32.buffer,c,t.numPoints*3),p=new Float32Array(e.HEAPF32.buffer,l,t.numPoints*4),m=new Float32Array(e.HEAPF32.buffer,u,t.numPoints*3),h=this.splatIndices.get(t),g=this.offsets.get(t),_=this.objectLayerIndices.get(t);for(let e=0;e<t.numPoints;e++)this.transformIndices[g+e]=h,this.layerIndices[g+e]=_;this.data.set(d,g*4),this.positions.set(f,g*3),this.rotations.set(p,g*4),this.scales.set(m,g*3),e._free(n),e._free(r),e._free(i),e._free(a),e._free(o),e._free(s),e._free(c),e._free(l),e._free(u),this.dataChanged=!0,this.pendingInitialBuildCount=Math.max(0,this.pendingInitialBuildCount-1),this.pendingInitialBuildCount===0&&this.completeInitialBuild()}expandFloat32Array(e,t){if(!e)return new Float32Array(t);if(e.length>=t)return e;let n=new Float32Array(t);return n.set(e.subarray(0,e.length)),n}expandUint32Array(e,t){if(!e)return new Uint32Array(t);if(e.length>=t)return e;let n=new Uint32Array(t);return n.set(e.subarray(0,e.length)),n}getSplat(e){let t=null;return this.offsets.forEach((n,r)=>{if(e>=n)t=r;else return}),t}getLocalIndex(e,t){return t-this.offsets.get(e)}dispose(){this.disposed||(this.disposed=!0,this.completeInitialBuild())}completeInitialBuild(){this.initialBuildComplete||(this.initialBuildComplete=!0),this.resolveReadyPromise&&(this.resolveReadyPromise(),this.resolveReadyPromise=null)}},yn=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function t(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=e.apply(n,r);function s(e){t(o,i,a,s,c,\`next\`,e)}function c(e){t(o,i,a,s,c,\`throw\`,e)}s(void 0)})}}function r(){return i.apply(this,arguments)}function i(){return i=n(function*(e={}){var t,r=e,i=!1,a=!0,o=self.location.href;if(i||a){try{new URL(\`.\`,o).href}catch(e){}(function(){var e=n(function*(e){var t=yield fetch(e,{credentials:\`same-origin\`});if(t.ok)return t.arrayBuffer();throw Error(t.status+\` : \`+t.url)});return function(t){return e.apply(this,arguments)}})()}console.log.bind(console),console.error.bind(console);var s=!1;function c(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var l,u,d=!1;function f(){var e=N.buffer;new Int8Array(e),new Int16Array(e),r.HEAPU8=u=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),r.HEAPU32=new Uint32Array(e),r.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function p(){if(r.preRun)for(typeof r.preRun==\`function\`&&(r.preRun=[r.preRun]);r.preRun.length;)E(r.preRun.shift());S(T)}function m(){d=!0,L.c()}function h(){if(r.postRun)for(typeof r.postRun==\`function\`&&(r.postRun=[r.postRun]);r.postRun.length;)w(r.postRun.shift());S(C)}var g;function _(){return c(\`\\0asm\\0\\0\\0\\x1B\\\`\\\`\\0\\\`
|
|
330
|
+
\\\`\\0\\0\\x07aa\\0\\0\\0\\0\\x07\\bA\\v\\x07b\\0c\\0d\\0e\\0f\\0\\f
|
|
331
|
+
ü9T~@A\\b(\\0" \\0B\\x07|Bøÿÿÿ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vA\\bA06\\0A\\vA\\b \\x006\\0 \\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r (\\0"k"A\\b(\\0I\\r \\0 j!\\0@@@A\\b(\\0 G@ (\\f! AÿM@ (\\b"G\\rA\\bA\\b(\\0A~ Avwq6\\0\\f\\v (!\\x07 G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rA\\b \\x006\\0 A~q6 \\0Ar6 \\x006\\0\\v 6\\f 6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(¸
|
|
332
|
+
F@ A¸
|
|
333
|
+
j 6\\0 \\rA\\bA\\b(\\0A~ wq6\\0\\f\\v@ \\x07(F@ \\x07 6\\f\\v \\x07 6\\v E\\r\\v \\x076 ("@ 6 6\\v ("E\\r\\0 6 6\\v O\\r\\0 ("AqE\\r\\0@@@@ AqE@A\\xA0\\b(\\0 F@A\\xA0\\b 6\\0A\\bA\\b(\\0 \\0j"\\x006\\0 \\0Ar6 A\\b(\\0G\\rA\\bA\\x006\\0A\\bA\\x006\\0\\vA\\b(\\0"\\x07 F@A\\b 6\\0A\\bA\\b(\\0 \\0j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\v Axq \\0j!\\0 (\\f! AÿM@ (\\b" F@A\\bA\\b(\\0A~ Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!\\b G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v A~q6 \\0Ar6 \\0 j \\x006\\0\\f\\vA\\0!\\v \\bE\\r\\0@ ("At"(¸
|
|
334
|
+
F@ A¸
|
|
335
|
+
j 6\\0 \\rA\\bA\\b(\\0A~ wq6\\0\\f\\v@ \\b(F@ \\b 6\\f\\v \\b 6\\v E\\r\\v \\b6 ("@ 6 6\\v ("E\\r\\0 6 6\\v \\0Ar6 \\0 j \\x006\\0 \\x07G\\r\\0A\\b \\x006\\0\\v \\0AÿM@ \\0AøqA°\\bj!A\\b(\\0"A \\0Avt"\\0qE@A\\b \\0 r6\\0 \\f\\v (\\b\\v!\\0 6\\b \\0 6\\f 6\\f \\x006\\b\\vA! \\0Aÿÿÿ\\x07M@ \\0A& \\0A\\bvg"kvAq AtrA>s!\\v 6 B\\x007 AtA¸
|
|
336
|
+
j!@A\\b(\\0"A t"qE@A\\b r6\\0 6\\0A!A\\b\\f\\v \\0A AvkA\\0 AG\\x1Bt! (\\0!@ "(Axq \\0F\\r Av! At! Aqj"("\\r\\0\\v 6A! !A\\b\\v!\\0 "\\f\\v (\\b" 6\\f 6\\bA!\\0A\\b!A\\0\\v! j 6\\0 6\\f \\0 j 6\\0A¨\\bA¨\\b(\\0Ak"\\0A \\0\\x1B6\\0\\v\\v¸'\\v#\\0Ak"
|
|
337
|
+
$\\0@@@@@@@@@@ \\0AôM@A\\b(\\0"A \\0A\\vjAøq \\0A\\vI\\x1B"Av"\\0v"Aq@@ AsAq \\0j"At"A°\\bj"\\0 (¸\\b"(\\b"F@A\\b A~ wq6\\0\\f\\v \\x006\\f \\0 6\\b\\v A\\bj!\\0 Ar6 j" (Ar6\\f\\v\\v A\\b(\\0"\\bM\\r @@A \\0t"A\\0 kr \\0tqh"At"A°\\bj" (¸\\b"\\0(\\b"F@A\\b A~ wq"6\\0\\f\\v 6\\f 6\\b\\v \\0 Ar6 \\0 j"\\x07 k"Ar6 \\0 j 6\\0 \\b@ \\bAxqA°\\bj!A\\b(\\0! A \\bAvt"qE@A\\b r6\\0 \\f\\v (\\b\\v! 6\\b 6\\f 6\\f 6\\b\\v \\0A\\bj!\\0A\\b \\x076\\0A\\b 6\\0\\f\\v\\vA\\b(\\0"\\vE\\r \\vhAt(¸
|
|
338
|
+
"(Axq k! !@@ ("\\0E@ ("\\0E\\r\\v \\0(Axq k" I"\\x1B! \\0 \\x1B! \\0!\\f\\v\\v (! (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f
|
|
339
|
+
\\v (" Aj ("E\\r Aj\\v!@ !\\x07 "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v \\x07A\\x006\\0\\f \\vA! \\0A¿K\\r\\0 \\0A\\vj"Axq!A\\b(\\0"\\x07E\\r\\0A!\\bA\\0 k! \\0Aôÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtkA>j!\\b\\v@@@ \\bAt(¸
|
|
340
|
+
"E@A\\0!\\0\\f\\vA\\0!\\0 A \\bAvkA\\0 \\bAG\\x1Bt!@@ (Axq k" O\\r\\0 ! "\\r\\0A\\0! !\\0\\f\\v \\0 (" AvAqj("F\\x1B \\0 \\x1B!\\0 At! \\r\\0\\v\\v \\0 rE@A\\0!A \\bt"\\0A\\0 \\0kr \\x07q"\\0E\\r \\0hAt(¸
|
|
341
|
+
!\\0\\v \\0E\\r\\v@ \\0(Axq k" I! \\x1B! \\0 \\x1B! \\0(" \\0(\\v"\\0\\r\\0\\v\\v E\\r\\0 A\\b(\\0 kO\\r\\0 (!\\b (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\\b\\v (" Aj ("E\\r Aj\\v!@ ! "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v A\\x006\\0\\f\\x07\\v A\\b(\\0"M@A\\b(\\0!\\0@ k"AO@ \\0 j" Ar6 \\0 j 6\\0 \\0 Ar6\\f\\v \\0 Ar6 \\0 j" (Ar6A\\0!A\\0!\\vA\\b 6\\0A\\b 6\\0 \\0A\\bj!\\0\\f \\v A\\b(\\0"I@A\\b k"6\\0A\\xA0\\bA\\xA0\\b(\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f \\vA\\0!\\0 A/j"Aà\\v(\\0@Aè\\v(\\0\\f\\vAì\\vB7\\0Aä\\vB\\xA07\\0Aà\\v
|
|
342
|
+
A\\fjApqAتժs6\\0Aô\\vA\\x006\\0AÄ\\vA\\x006\\0A \\v"j"A\\0 k"\\x07q" M\\r\\bAÀ\\v(\\0"@A¸\\v(\\0"\\b j" \\bM Ir\\r \\v@AÄ\\v-\\0\\0AqE@@@@@A\\xA0\\b(\\0"@AÈ\\v!\\0@ \\0(\\0"\\b M@ \\b \\0(jI\\r\\v \\0(\\b"\\0\\r\\0\\v\\vA\\0"AF\\r !Aä\\v(\\0"\\0Ak" q@ k jA\\0 \\0kqj!\\v M\\rAÀ\\v(\\0"\\0@A¸\\v(\\0" j"\\x07 M \\0 \\x07Ir\\r\\v "\\0 G\\r\\f\\v k \\x07q"" \\0(\\0 \\0(jF\\r !\\0\\v \\0AF\\r A0j M@ \\0!\\f\\vAè\\v(\\0" kjA\\0 kq"AF\\r j! \\0!\\f\\v AG\\r\\vAÄ\\vAÄ\\v(\\0Ar6\\0\\v "AFA\\0"\\0AFr \\0 Mr\\r \\0 k" A(jM\\r\\vA¸\\vA¸\\v(\\0 j"\\x006\\0A¼\\v(\\0 \\0I@A¼\\v \\x006\\0\\v@A\\xA0\\b(\\0"@AÈ\\v!\\0@ \\0(\\0" \\0("jF\\r \\0(\\b"\\0\\r\\0\\v\\f\\vA\\b(\\0"\\0A\\0 \\0 M\\x1BE@A\\b 6\\0\\vA\\0!\\0AÌ\\v 6\\0AÈ\\v 6\\0A¨\\bA6\\0A¬\\bAà\\v(\\x006\\0AÔ\\vA\\x006\\0@ \\0At" A°\\bj"6¸\\b 6¼\\b \\0Aj"\\0A G\\r\\0\\vA\\b A(k"\\0Ax kA\\x07q"k"6\\0A\\xA0\\b j"6\\0 Ar6 \\0 jA(6A¤\\bAð\\v(\\x006\\0\\f\\v M Kr\\r \\0(\\fA\\bq\\r \\0 j6A\\xA0\\b Ax kA\\x07q"\\0j"6\\0A\\bA\\b(\\0 j" \\0k"\\x006\\0 \\0Ar6 jA(6A¤\\bAð\\v(\\x006\\0\\f\\vA\\0!\\0\\f\\vA\\0!\\0\\f\\vA\\b(\\0 K@A\\b 6\\0\\v j!AÈ\\v!\\0@@ \\0(\\0"G@ \\0(\\b"\\0\\r\\f\\v\\v \\0-\\0\\fA\\bqE\\r\\vAÈ\\v!\\0@@ \\0(\\0" M@ \\0(j"I\\r\\v \\0(\\b!\\0\\f\\v\\vA\\b A(k"\\0Ax kA\\x07q"k"\\x076\\0A\\xA0\\b j"6\\0 \\x07Ar6 \\0 jA(6A¤\\bAð\\v(\\x006\\0 A' kA\\x07qjA/k"\\0 \\0 AjI\\x1B"A\\x1B6 AÐ\\v)\\x007 AÈ\\v)\\x007\\bAÐ\\v A\\bj6\\0AÌ\\v 6\\0AÈ\\v 6\\0AÔ\\vA\\x006\\0 Aj!\\0@ \\0A\\x076 \\0A\\bj \\0Aj!\\0 I\\r\\0\\v F\\r\\0 (A~q6 k"Ar6 6\\0 AÿM@ AøqA°\\bj!\\0A\\b(\\0"A Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\fA\\f!A\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtA¸
|
|
343
|
+
j!@@A\\b(\\0"A \\0t"qE@A\\b r6\\0 6\\0\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"("\\r\\0\\v 6\\v 6A\\b! "!\\0A\\f\\f\\v (\\b"\\0 6\\f 6\\b \\x006\\bA\\0!\\0A!A\\f\\v j 6\\0 j \\x006\\0\\vA\\b(\\0"\\0 M\\r\\0A\\b \\0 k"6\\0A\\xA0\\bA\\xA0\\b(\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f\\vA\\bA06\\0A\\0!\\0\\f\\v \\0 6\\0 \\0 \\0( j6 Ax kA\\x07qj"\\b Ar6 Ax kA\\x07qj" \\bj"k!\\x07@A\\xA0\\b(\\0 F@A\\xA0\\b 6\\0A\\bA\\b(\\0 \\x07j"\\x006\\0 \\0Ar6\\f\\vA\\b(\\0 F@A\\b 6\\0A\\bA\\b(\\0 \\x07j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\f\\v ("\\0AqAF@ \\0Axq! (\\f!@ \\0AÿM@ (\\b" F@A\\bA\\b(\\0A~ \\0Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!@ G@ (\\b"\\0 6\\f \\x006\\b\\f\\v@ ("\\0 Aj ("\\0E\\r Aj\\v!@ ! \\0"Aj! \\0("\\0\\r\\0 Aj! ("\\0\\r\\0\\v A\\x006\\0\\f\\vA\\0!\\v E\\r\\0@ ("\\0At"(¸
|
|
344
|
+
F@ A¸
|
|
345
|
+
j 6\\0 \\rA\\bA\\b(\\0A~ \\0wq6\\0\\f\\v@ (F@ 6\\f\\v 6\\v E\\r\\v 6 ("\\0@ \\x006 \\0 6\\v ("\\0E\\r\\0 \\x006 \\0 6\\v \\x07 j!\\x07 j"(!\\0\\v \\0A~q6 \\x07Ar6 \\x07j \\x076\\0 \\x07AÿM@ \\x07AøqA°\\bj!\\0A\\b(\\0"A \\x07Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA! \\x07Aÿÿÿ\\x07M@ \\x07A& \\x07A\\bvg"\\0kvAq \\0AtrA>s!\\v 6 B\\x007 AtA¸
|
|
346
|
+
j!\\0@@A\\b(\\0"A t"qE@A\\b r6\\0 \\0 6\\0\\f\\v \\x07A AvkA\\0 AG\\x1Bt! \\0(\\0!@ "\\0(Axq \\x07F\\r Av! At! \\0 Aqj"("\\r\\0\\v 6\\v \\x006 6\\f 6\\b\\f\\v \\0(\\b" 6\\f \\0 6\\b A\\x006 \\x006\\f 6\\b\\v \\bA\\bj!\\0\\f\\v@ \\bE\\r\\0@ ("At"(¸
|
|
347
|
+
F@ A¸
|
|
348
|
+
j \\x006\\0 \\0\\rA\\b \\x07A~ wq"\\x076\\0\\f\\v@ \\b(F@ \\b \\x006\\f\\v \\b \\x006\\v \\0E\\r\\v \\0 \\b6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 AÿM@ AøqA°\\bj!\\0A\\b(\\0"A Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtA¸
|
|
349
|
+
j!@@ \\x07A \\0t"qE@A\\b \\x07r6\\0 6\\0 6\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"\\x07("\\r\\0\\v \\x07 6 6\\v 6\\f 6\\b\\f\\v (\\b"\\0 6\\f 6\\b A\\x006 6\\f \\x006\\b\\v A\\bj!\\0\\f\\v@ E\\r\\0@ ("At"(¸
|
|
350
|
+
F@ A¸
|
|
351
|
+
j \\x006\\0 \\0\\rA\\b \\vA~ wq6\\0\\f\\v@ (F@ \\x006\\f\\v \\x006\\v \\0E\\r\\v \\0 6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 \\b@ \\bAxqA°\\bj!\\0A\\b(\\0!A \\bAvt"\\x07 qE@A\\b \\x07r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\vA\\b 6\\0A\\b 6\\0\\v A\\bj!\\0\\v
|
|
352
|
+
Aj$\\0 \\0\\v
|
|
353
|
+
}@ E@\\f\\vA!\\v@ \\fF@A\\0!\\f \\x07A\\0Aü\\v\\0 \\bA\\0Aü\\v\\0A\\0!
|
|
354
|
+
@
|
|
355
|
+
F@A\\0!
|
|
356
|
+
@
|
|
357
|
+
AF@A\\0!
|
|
358
|
+
@
|
|
359
|
+
F@A\\0!A\\0!
|
|
360
|
+
@
|
|
361
|
+
AF@A\\0!
|
|
362
|
+
@
|
|
363
|
+
\\fF\\r\\v \\b
|
|
364
|
+
Atj(\\0"\\0Atj(\\0AsAvAüÿqj" (\\0"Aj6\\0 Atj \\x006\\0
|
|
365
|
+
Aj!
|
|
366
|
+
\\f\\0\\v\\0 \\b
|
|
367
|
+
Atj"\\0(\\0 \\0 6\\0
|
|
368
|
+
Aj!
|
|
369
|
+
j!\\f\\v\\0\\v\\0\\v
|
|
370
|
+
Atj(\\0"\\0Aü\\x07G@ \\x07 \\0AsAÿÿqAtj"\\0 \\0(\\0"\\0Aj6\\0 \\0Atj
|
|
371
|
+
6\\0\\v
|
|
372
|
+
Aj!
|
|
373
|
+
\\f\\0\\v\\0 \\x07
|
|
374
|
+
Atj"\\0(\\0 \\0 \\f6\\0
|
|
375
|
+
Aj!
|
|
376
|
+
\\fj!\\f\\f\\v\\0\\v\\0\\v
|
|
377
|
+
Atj(\\0"\\0Aü\\x07G@ \\x07 \\0As"\\0AÿÿqAtj" (\\0Aj6\\0 \\b \\0AvAüÿqj"\\0 \\0(\\0Aj6\\0\\v
|
|
378
|
+
Aj!
|
|
379
|
+
\\f\\0\\v\\0 \\fA\\flj"
|
|
380
|
+
*\\0!
|
|
381
|
+
*\\b!
|
|
382
|
+
*! \\v \\fAt"\\rj(\\0"
|
|
383
|
+
G@
|
|
384
|
+
AÐ\\0lj"\\v*< \\0*8" \\v*8 \\0*(" \\v*0 \\0*\\b" \\0*" \\v*4! \\v*, \\v*( \\v* \\v*$! \\v* \\v* \\v* \\v*! \\v*\\f \\v*\\b \\v*\\0 \\v* !
|
|
385
|
+
!\\v\\vAü\\x07!
|
|
386
|
+
\\rj "C\\0\\0\\\\ ¼"
|
|
387
|
+
AAx
|
|
388
|
+
A\\0H\\x1BsAü\\x07\\v6\\0 \\fAj!\\f\\f\\v\\0\\v\\0\\v \\f\\v\\0\\v\\v \\0A\\b\\v\`)}function v(e){return e}function y(e,t){var n,r=v(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function b(){return{a:F}}function x(){function e(e,t){return L=e.exports,P(L),f(),L}var t=b();return r.instantiateWasm?new Promise((n,i)=>{r.instantiateWasm(t,(t,r)=>{n(e(t,r))})}):(g!=null||(g=_()),e(y(g,t)[0]))}for(var S=e=>{for(;e.length>0;)e.shift()(r)},C=[],w=e=>C.push(e),T=[],E=e=>T.push(e),D=()=>2147483648,O=(e,t)=>Math.ceil(e/t)*t,k=e=>{var t=(e-N.buffer.byteLength+65535)/65536|0;try{return N.grow(t),f(),1}catch(e){}},A=e=>{var t=u.length;e>>>=0;var n=D();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),k(Math.min(n,O(Math.max(e,i),65536))))return!0}return!1},j=new Uint8Array(123),M=25;M>=0;--M)j[48+M]=52+M,j[65+M]=M,j[97+M]=26+M;if(j[43]=62,j[47]=63,r.noExitRuntime&&r.noExitRuntime,r.print&&r.print,r.printErr&&r.printErr,r.wasmBinary&&r.wasmBinary,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.preInit)for(typeof r.preInit==\`function\`&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.shift()();var N;function P(e){r._sort=e.d,r._malloc=e.e,r._free=e.f,N=e.b,e.__indirect_function_table}var F={a:A};function I(){p();function e(){var e;r.calledRun=!0,!s&&(m(),l==null||l(r),(e=r.onRuntimeInitialized)==null||e.call(r),h())}r.setStatus?(r.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>r.setStatus(\`\`),1),e()},1)):e()}var L=x();return I(),t=d?r:new Promise((e,t)=>{l=e}),t}),i.apply(this,arguments)}let a;function o(){return e(this,void 0,void 0,function*(){a=yield r()})}let s,c,l,u,d,f,p,m,h,g,_=0,v=0,y=!1,b=[],x=!0,S=!0,C=!1,w=!1,T=!1,E=65536,D=()=>e(void 0,void 0,void 0,function*(){if(C){w=!0;return}C=!0,w=!1,a||(yield o());let e=Math.pow(2,Math.ceil(Math.log2(s.vertexCount)));_<e&&(_>0&&(a._free(c),a._free(u),a._free(d),a._free(f),a._free(p),a._free(g)),_=e,c=a._malloc(64),u=a._malloc(_*4),d=a._malloc(3*_*4),f=a._malloc(_*4),p=a._malloc(_*4),g=a._malloc(_*4)),y||(m=a._malloc(E*4),h=a._malloc(E*4),y=!0),v<s.transforms.length&&(v>0&&a._free(l),v=s.transforms.length,l=a._malloc(v*4)),C=!1,w&&(w=!1,yield D())}),O=()=>{if(C||w||!a)return;C=!0,S&&(a.HEAPF32.set(s.positions,d/4),a.HEAPF32.set(s.transforms,l/4),a.HEAPU32.set(s.transformIndices,u/4),S=!1),a.HEAPF32.set(new Float32Array(b),c/4);let e=a._sort(c,l,u,s.vertexCount,d,f,p,m,h,g),t=Math.min(e,s.vertexCount),n=new Uint32Array(a.HEAPU32.buffer,p,t),r=new Uint32Array(n.slice().buffer);self.postMessage({depthIndex:r,generation:s.generation},[r.buffer]),C=!1,x=!1},k=()=>{T||(T=!0,x&&O(),setTimeout(()=>{T=!1,k()}))};self.onmessage=e=>new Promise(t=>{var n;if(e.data.warmup){o().finally(()=>t(!0));return}e.data.sortData&&(s={positions:e.data.sortData.positions,transforms:e.data.sortData.transforms,transformIndices:e.data.sortData.transformIndices,vertexCount:e.data.sortData.vertexCount,generation:(n=e.data.sortData.generation)==null?0:n},x=!0,S=!0,D()),e.data.viewProj?(e.data.viewProj.every(e=>b.includes(e))===!1&&(b=e.data.viewProj,x=!0),k(),t(!0)):t(!0)})})();`,bn=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,yn],{type:`text/javascript;charset=utf-8`});function xn(e){let t;try{if(t=bn&&(self.URL||self.webkitURL).createObjectURL(bn),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(yn),{name:e==null?void 0:e.name})}}var{Fn:Sn,vec2:Cn,vec3:wn,vec4:Tn,ivec2:En,float:U,int:Dn,uint:On,mat3:kn,mat4:An,bool:jn,If:Mn,Loop:Nn,Discard:Pn,Return:Fn,attribute:In,varyingProperty:Ln,uniform:Rn,uniformArray:zn,textureLoad:Bn,positionGeometry:Vn,cameraPosition:Hn,cameraProjectionMatrix:Un,cameraViewMatrix:Wn,viewportSize:Gn,abs:Kn,sign:qn,max:Jn,min:Yn,clamp:Xn,floor:Zn,fract:Qn,sqrt:$n,exp:er,sin:tr,cos:nr,normalize:rr,length:ir,dot:ar,mix:or,select:sr,transpose:cr,unpackHalf2x16:lr,colorSpaceToWorking:ur}=c.TSL,dr=Math.sqrt(8),fr=.3,pr=2048,mr=-12,hr=9,gr=.4886025119029199,_r=1.0925484,vr=-1.0925484,yr=.3153916,br=-1.0925484,xr=.5462742,Sr=Sn(([e])=>{let t=U(e),n=er(t.sub(1).div(254).mul(hr-mr).add(mr));return sr(t.equal(0),U(0),n)}).setLayout({name:`decodeLogScale`,type:`float`,inputs:[{name:`encoded`,type:`float`}]}),Cr=Sn(([e,t,n])=>{let r=U(e).div(255).mul(2).sub(1).toVar(),i=U(t).div(255).mul(2).sub(1).toVar(),a=U(1).sub(Kn(r)).sub(Kn(i)).toVar();Mn(a.lessThan(0),()=>{let e=r.toVar();r.assign(U(1).sub(Kn(i)).mul(sr(r.greaterThanEqual(0),U(1),U(-1)))),i.assign(U(1).sub(Kn(e)).mul(sr(i.greaterThanEqual(0),U(1),U(-1))))});let o=rr(wn(r,i,a)),s=U(n).div(255).mul(Math.PI).mul(.5),c=tr(s),l=nr(s);return Tn(o.mul(c),l)}).setLayout({name:`decodeQuatOctahedral`,type:`vec4`,inputs:[{name:`encX`,type:`float`},{name:`encY`,type:`float`},{name:`encZ`,type:`float`}]}),wr=Sn(([e])=>{let t=e.x,n=e.y,r=e.z,i=e.w;return kn(wn(U(1).sub(U(2).mul(n.mul(n).add(r.mul(r)))),U(2).mul(t.mul(n).sub(r.mul(i))),U(2).mul(t.mul(r).add(n.mul(i)))),wn(U(2).mul(t.mul(n).add(r.mul(i))),U(1).sub(U(2).mul(t.mul(t).add(r.mul(r)))),U(2).mul(n.mul(r).sub(t.mul(i)))),wn(U(2).mul(t.mul(r).sub(n.mul(i))),U(2).mul(n.mul(r).add(t.mul(i))),U(1).sub(U(2).mul(t.mul(t).add(n.mul(n))))))}).setLayout({name:`quatToMat3`,type:`mat3`,inputs:[{name:`q`,type:`vec4`}]});function Tr(e){let t=e===`RGBA32UI`?new c.DataTexture(new Uint32Array(4),1,1,c.RGBAIntegerFormat,c.UnsignedIntType):new c.DataTexture(new Uint32Array(1),1,1,c.RedIntegerFormat,c.UnsignedIntType);return t.minFilter=c.NearestFilter,t.magFilter=c.NearestFilter,t.generateMipmaps=!1,t.flipY=!1,t.needsUpdate=!0,t}function Er(){let e=new c.DataTexture(new Float32Array(4),1,1,c.RGBAFormat,c.FloatType);return e.minFilter=c.NearestFilter,e.magFilter=c.NearestFilter,e.generateMipmaps=!1,e.flipY=!1,e.needsUpdate=!0,e}var Dr=class extends c.NodeMaterial{constructor(e={}){var t,n,r;super(),this.isPBMGaussianSplattingMaterial=!0,this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.layerIndicesTexture=null,this.shTexture=null,this.shTextureSize=new c.Vector2(1,1),this.aggregationEnabled=!0,this.aggregationProgress=0,this.aggregationPointDuration=.6,this.aggregationBoundsMin=new c.Vector3,this.aggregationBoundsMax=new c.Vector3,this.layerClipperRanges=[],this.clipperMatricesInverse=[],this._uDataTex=null,this._uTransformsTex=null,this._uTransformIndicesTex=null,this._uLayerIndicesTex=null,this._uShTex=null,this._uShTextureSize=null,this._uAggregationEnabled=null,this._uAggregationProgress=null,this._uAggregationPointDuration=null,this._uAggregationBoundsMin=null,this._uAggregationBoundsMax=null,this._uLayerClipperRanges=null,this._uClipperMatricesInverse=null,this._cachedLayerCount=-1,this._cachedClipperCount=-1,this.type=`PBMGaussianSplattingNodeMaterial`,this.lights=!1,this.side=c.DoubleSide,this.transparent=!0,this.depthTest=!0,this.depthWrite=!1,this.blending=c.NormalBlending,this.maxShDegree=(t=e.maxShDegree)==null?0:t,this.numGsLayers=(n=e.numGsLayers)==null?0:n,this.numGsClippers=(r=e.numGsClippers)==null?0:r}customProgramCacheKey(){return super.customProgramCacheKey()+`,`+[this.maxShDegree,this.numGsLayers,this.numGsClippers].join(`,`)}syncDynamicUniforms(){this._uDataTex!==null&&(this.dataTexture&&this._uDataTex.value!==this.dataTexture&&(this._uDataTex.value=this.dataTexture),this.transformsTexture&&this._uTransformsTex.value!==this.transformsTexture&&(this._uTransformsTex.value=this.transformsTexture),this.transformIndicesTexture&&this._uTransformIndicesTex.value!==this.transformIndicesTexture&&(this._uTransformIndicesTex.value=this.transformIndicesTexture),this.layerIndicesTexture&&this._uLayerIndicesTex.value!==this.layerIndicesTexture&&(this._uLayerIndicesTex.value=this.layerIndicesTexture),this.shTexture&&this._uShTex.value!==this.shTexture&&(this._uShTex.value=this.shTexture),this._uAggregationEnabled.value=+!!this.aggregationEnabled,this._uAggregationProgress.value=this.aggregationProgress,this._uAggregationPointDuration.value=this.aggregationPointDuration)}_ensureUniforms(){var e,t,n,r,i;this._uDataTex===null?(this._uDataTex=Bn((e=this.dataTexture)==null?Tr(`RGBA32UI`):e),this._uTransformsTex=Bn((t=this.transformsTexture)==null?Er():t),this._uTransformIndicesTex=Bn((n=this.transformIndicesTexture)==null?Tr(`R32UI`):n),this._uLayerIndicesTex=Bn((r=this.layerIndicesTexture)==null?Tr(`R32UI`):r),this._uShTex=Bn((i=this.shTexture)==null?Er():i),this._uShTextureSize=Rn(this.shTextureSize),this._uAggregationEnabled=Rn(+!!this.aggregationEnabled),this._uAggregationProgress=Rn(this.aggregationProgress),this._uAggregationPointDuration=Rn(this.aggregationPointDuration),this._uAggregationBoundsMin=Rn(this.aggregationBoundsMin),this._uAggregationBoundsMax=Rn(this.aggregationBoundsMax),this.numGsClippers>0&&(this._uLayerClipperRanges=zn(this.layerClipperRanges.length?this.layerClipperRanges:[new c.Vector2],`vec2`),this._uClipperMatricesInverse=zn(this.clipperMatricesInverse.length?this.clipperMatricesInverse:[new c.Matrix4],`mat4`),this._cachedLayerCount=this.numGsLayers,this._cachedClipperCount=this.numGsClippers)):(this.dataTexture&&(this._uDataTex.value=this.dataTexture),this.transformsTexture&&(this._uTransformsTex.value=this.transformsTexture),this.transformIndicesTexture&&(this._uTransformIndicesTex.value=this.transformIndicesTexture),this.layerIndicesTexture&&(this._uLayerIndicesTex.value=this.layerIndicesTexture),this.shTexture&&(this._uShTex.value=this.shTexture),this._uShTextureSize.value=this.shTextureSize,this._uAggregationEnabled.value=+!!this.aggregationEnabled,this._uAggregationProgress.value=this.aggregationProgress,this._uAggregationPointDuration.value=this.aggregationPointDuration,this._uAggregationBoundsMin.value=this.aggregationBoundsMin,this._uAggregationBoundsMax.value=this.aggregationBoundsMax,this.numGsClippers>0&&(this._cachedLayerCount!==this.numGsLayers||this._cachedClipperCount!==this.numGsClippers||!this._uLayerClipperRanges)?(this._uLayerClipperRanges=zn(this.layerClipperRanges.length?this.layerClipperRanges:[new c.Vector2],`vec2`),this._uClipperMatricesInverse=zn(this.clipperMatricesInverse.length?this.clipperMatricesInverse:[new c.Matrix4],`mat4`),this._cachedLayerCount=this.numGsLayers,this._cachedClipperCount=this.numGsClippers):this.numGsClippers===0&&(this._uLayerClipperRanges=null,this._uClipperMatricesInverse=null,this._cachedLayerCount=0,this._cachedClipperCount=0))}_buildSHUv(e,t,n){let r=this.maxShDegree,i=0;r>=1&&(i+=9),r>=2&&(i+=15),r>=3&&(i+=21);let a=i;a%4!=0&&(a=(Math.floor(a/4)+1)*4);let o=e.mul(a/4).add(t/4).toInt(),s=n.x.toInt();return En(o.mod(s),o.div(s))}setup(e){this._ensureUniforms();let t=this._uDataTex,n=this._uTransformsTex,r=this._uTransformIndicesTex,i=this._uLayerIndicesTex,a=this._uShTex,o=this._uShTextureSize,s=this._uAggregationEnabled,l=this._uAggregationProgress,u=this._uAggregationPointDuration,d=this._uAggregationBoundsMin,f=this._uAggregationBoundsMax,p=this._uLayerClipperRanges,m=this._uClipperMatricesInverse,h=this,g=Ln(`vec4`,`vColorGS`),_=Ln(`vec2`,`vPositionGS`),v=Sn(()=>{let e=In(`splatIndex`,`float`).add(.5).toUint().toVar(),v=e.toInt(),y=e.bitAnd(On(2047)).toInt(),b=e.shiftRight(On(11)).toInt(),x=t.load(En(y,b)).toVar(),S=lr(x.y.toUint()),C=lr(x.z.toUint()),w=wn(S.x,S.y,C.x).toVar(),T=x.z.shiftRight(On(16)).bitAnd(On(255)),E=x.z.shiftRight(On(24)).bitAnd(On(255)),D=x.w.shiftRight(On(24)).bitAnd(On(255)),O=Cr(U(T),U(E),U(D)).toVar(),k=Sr(U(x.w.bitAnd(On(255)))),A=Sr(U(x.w.shiftRight(On(8)).bitAnd(On(255)))),j=Sr(U(x.w.shiftRight(On(16)).bitAnd(On(255)))),M=Tn(U(x.x.bitAnd(On(255))),U(x.x.shiftRight(On(8)).bitAnd(On(255))),U(x.x.shiftRight(On(16)).bitAnd(On(255))),U(x.x.shiftRight(On(24)).bitAnd(On(255)))).div(255).toVar(),N=e.bitAnd(On(1023)).toInt(),ee=e.shiftRight(On(10)).toInt(),P=r.load(En(N,ee)).x.toInt(),F=An(n.load(En(0,P)),n.load(En(1,P)),n.load(En(2,P)),n.load(En(3,P))).toVar(),te=An(n.load(En(5,P)),n.load(En(6,P)),n.load(En(7,P)),n.load(En(8,P))).toVar(),ne=Wn.mul(F).toVar(),I=F.mul(Tn(w,1)).toVar(),re=Tn(0,0,2,1).toVar(),ie=U(0).toVar(),L=jn(!1).toVar();Mn(s.equal(1).and(l.lessThan(1)),()=>{Mn(I.x.greaterThanEqual(d.x).and(I.x.lessThanEqual(f.x)).and(I.z.greaterThanEqual(d.z)).and(I.z.lessThanEqual(f.z)),()=>{L.assign(!0);let e=f.y.sub(d.y),t=sr(e.greaterThan(.001),Xn(I.y.sub(d.y).div(e),0,1),U(.5)),n=Xn(u,.01,1),r=U(1).sub(t).mul(U(1).sub(n)),i=Xn(l.sub(r).div(n),0,1).toVar(),a=i.mul(i).mul(U(3).sub(i.mul(2)));ie.assign(i.mul(i).mul(i));let o=d.add(f).mul(.5),s=ir(I.xyz.sub(o)),c=ar(w,wn(12.9898,78.233,45.164)),p=Qn(tr(c).mul(43758.5453)),m=c.mul(10),h=rr(wn(nr(m),or(-.7,.1,Qn(tr(c.mul(1.7)).mul(43758.5453))),tr(m))),g=U(1).sub(a).mul(U(1).add(p)),_=h.mul(s).mul(g);I.assign(Tn(I.xyz.add(_),I.w)),w.assign(te.mul(I).xyz)})});let ae=jn(!1).toVar();if(h.numGsClippers>0&&h.numGsLayers>0){let e=i.load(En(N,ee)).x.toInt().toVar();Mn(e.greaterThanEqual(0).and(e.lessThan(h.numGsLayers)),()=>{let t=p.element(e),n=t.x.add(.5).toInt(),r=t.y.add(.5).toInt(),i=n.add(r);Nn({start:Dn(0),end:Dn(h.numGsClippers),type:`int`},({i:e})=>{Mn(e.greaterThanEqual(n).and(e.lessThan(i)),()=>{let t=m.element(e).mul(I);Mn(t.x.greaterThan(-.5).and(t.x.lessThan(.5)).and(t.y.greaterThan(-.5)).and(t.y.lessThan(.5)).and(t.z.greaterThan(-.5)).and(t.z.lessThan(.5)),()=>{ae.assign(!0)})})})})}let R=ne.mul(Tn(w,1)).toVar(),z=Un.mul(R).toVar(),oe=z.w.mul(1.2),se=z.z.lessThan(z.w.negate()).or(z.z.greaterThan(z.w)),ce=z.x.lessThan(oe.negate()).or(z.x.greaterThan(oe)),le=z.y.lessThan(oe.negate()).or(z.y.greaterThan(oe)),ue=se.or(ce).or(le);return Mn(ae.not().and(ue.not()),()=>{let e=z.xyz.div(z.w),t=Gn,n=Cn(Un.element(0).element(0).mul(t.x).mul(.5),Un.element(1).element(1).mul(t.y).mul(.5)),r=wr(O),i=kn(wn(k,U(0),U(0)),wn(U(0),A,U(0)),wn(U(0),U(0),j)).mul(r),u=i.element(0),d=i.element(1),f=i.element(2),p=kn(wn(ar(u,u),ar(u,d),ar(u,f)),wn(ar(d,u),ar(d,d),ar(d,f)),wn(ar(f,u),ar(f,d),ar(f,f))),m=Un.element(3).element(3).greaterThan(.7),y=U(1).div(R.z.mul(R.z)),b=kn(wn(n.x.div(R.z),U(0),n.x.mul(R.x).mul(y).negate()),wn(U(0),n.y.div(R.z),n.y.mul(R.y).mul(y).negate()),wn(U(0),U(0),U(0))),x=kn(wn(n.x,U(0),U(0)),wn(U(0),n.y,U(0)),wn(U(0),U(0),U(0))),S=kn(sr(m,x.element(0),b.element(0)),sr(m,x.element(1),b.element(1)),sr(m,x.element(2),b.element(2))),C=ne,T=cr(kn(C.element(0).xyz,C.element(1).xyz,C.element(2).xyz)).mul(S),E=cr(T).mul(p).mul(T).toVar(),D=E.element(0).element(0).add(fr),N=E.element(1).element(1).add(fr),ee=E.element(0).element(1),P=D,F=N,I=ee,ae=P.mul(F).sub(I.mul(I)),oe=P.add(F).mul(.5),se=$n(Jn(.1,oe.mul(oe).sub(ae))),ce=oe.add(se),le=oe.sub(se);Mn(le.greaterThan(0),()=>{let n=rr(Cn(I,ce.sub(P))),r=Cn(n.y,n.x.negate()),i=n.mul(Yn($n(ce).mul(dr),U(pr))),u=r.mul(Yn($n(le).mul(dr),U(pr))),d=Cn(U(1).div(t.x),U(1).div(t.y)),f=Vn.xy,p=Cn(f.x.mul(i.x).add(f.y.mul(u.x)),f.x.mul(i.y).add(f.y.mul(u.y))).mul(d).mul(2).toVar();Mn(s.equal(1),()=>{let e=sr(L,ie,l.mul(l).mul(l));p.assign(p.mul(or(.1,1,e)))});let m=M.toVar();if(h.maxShDegree>=1){let e=te.mul(Tn(Hn,1)).xyz,t=rr(w.sub(e)),n=t.x,r=t.y,i=t.z,s=h._buildSHUv(v,0,o),c=h._buildSHUv(v,4,o),l=h._buildSHUv(v,8,o),u=a.load(s),d=a.load(c),f=a.load(l),p=u.rgb,g=wn(u.a,d.r,d.g),_=wn(d.b,d.a,f.r),y=p.mul(U(-.4886025119029199).mul(r)).add(g.mul(U(gr).mul(i))).add(_.mul(U(-.4886025119029199).mul(n)));if(m.assign(Tn(m.rgb.add(y),m.a)),h.maxShDegree>=2){let e=h._buildSHUv(v,12,o),t=h._buildSHUv(v,16,o),s=h._buildSHUv(v,20,o),c=a.load(e),l=a.load(t),u=a.load(s),d=f.gba,p=c.rgb,g=wn(c.a,l.r,l.g),_=wn(l.b,l.a,u.r),y=u.gba,b=n.mul(n),x=r.mul(r),S=i.mul(i),C=n.mul(r),w=r.mul(i),T=n.mul(i),E=d.mul(U(_r).mul(C)).add(p.mul(U(vr).mul(w))).add(g.mul(U(yr).mul(S.mul(2).sub(b).sub(x)))).add(_.mul(U(br).mul(T))).add(y.mul(U(xr).mul(b.sub(x))));m.assign(Tn(m.rgb.add(E),m.a))}}m.assign(Tn(Xn(m.rgb,wn(0),wn(1)),m.a)),g.assign(ur(m,c.SRGBColorSpace)),_.assign(f.mul(dr)),re.assign(Tn(e.xy.add(p),e.z,1))})}),re});this.vertexNode=v();let y=Sn(()=>{let e=ar(_,_);Pn(e.greaterThan(8));let t=er(e.mul(-.5)).mul(g.a);return Tn(g.rgb,t)});this.fragmentNode=y(),super.setup(e)}copy(e){return super.copy(e),this.dataTexture=e.dataTexture,this.transformsTexture=e.transformsTexture,this.transformIndicesTexture=e.transformIndicesTexture,this.layerIndicesTexture=e.layerIndicesTexture,this.shTexture=e.shTexture,this.shTextureSize.copy(e.shTextureSize),this.aggregationEnabled=e.aggregationEnabled,this.aggregationProgress=e.aggregationProgress,this.aggregationPointDuration=e.aggregationPointDuration,this.aggregationBoundsMin.copy(e.aggregationBoundsMin),this.aggregationBoundsMax.copy(e.aggregationBoundsMax),this.maxShDegree=e.maxShDegree,this.numGsLayers=e.numGsLayers,this.numGsClippers=e.numGsClippers,this.layerClipperRanges=e.layerClipperRanges.map(e=>e.clone()),this.clipperMatricesInverse=e.clipperMatricesInverse.map(e=>e.clone()),this._uDataTex=null,this._uTransformsTex=null,this._uTransformIndicesTex=null,this._uLayerIndicesTex=null,this._uShTex=null,this._uShTextureSize=null,this._uAggregationEnabled=null,this._uAggregationProgress=null,this._uAggregationPointDuration=null,this._uAggregationBoundsMin=null,this._uAggregationBoundsMax=null,this._uLayerClipperRanges=null,this._uClipperMatricesInverse=null,this._cachedLayerCount=-1,this._cachedClipperCount=-1,this}},Or=2,kr=class extends c.Mesh{constructor(){super(),this.renderData=null,this.needsRender=!1,this.sortWorker=null,this.depthIndex=new Uint32Array,this.splatIndexCapacity=0,this.activeSlot=null,this.pendingSlot=null,this.rebuildGeneration=0,this.forceClipperUniformRefresh=!1,this.incrementalUpdateInFlight=!1,this.freeSlotPool=[],this._scratchViewProj=new c.Matrix4,this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.layerIndicesTexture=null,this.shTexture=null,this.usedSHDegree=0,this.sortDataRebuilding=!1,this.onBeforeRender=(e,t,n,...r)=>{let i=n,a=this.collectObjects(t);if(a.length===0){this.geometry.instanceCount=0;return}let o=0;a.forEach(e=>{e.usedSHDegree>o&&(o=e.usedSHDegree)}),this.setMaxShDegree(o),this.isSceneNeedsRebuild(a)&&(this.tryStartIncrementalUpdate(a)||(this.startPendingRebuild(a),this.gsSceneState.lastClipperHash=``));let s=a.filter(e=>e.transformChanged);s.length>0&&(this.syncTransformsForSlot(this.activeSlot,s),this.syncTransformsForSlot(this.pendingSlot,s),s.forEach(e=>{e.transformChanged=!1,e.selectedChanged=!1})),this.activeSlot&&this.updateSlotTextures(this.activeSlot),this.pendingSlot&&this.updateSlotTextures(this.pendingSlot);let c=this._scratchViewProj.multiplyMatrices(i.perspectiveProjectionMatrix,i.matrixWorldInverse).elements;this.pendingSlot&&this.pendingSlot.renderData.initialBuildComplete&&this.pendingSlot.awaitingFirstSort?this.requestSort(this.pendingSlot,c):this.activeSlot&&this.requestSort(this.activeSlot,c);let l=this.getClipperHash(a);if((this.forceClipperUniformRefresh||l!==this.gsSceneState.lastClipperHash)&&(this.updateClipperUniforms(a),this.gsSceneState.lastClipperHash=l,this.forceClipperUniformRefresh=!1,this.needsRender=!0),this.activeSlot){let e=Math.min(this.usedSHDegree,this.activeSlot.renderData.maxShDegree);this.material.maxShDegree!==e&&(this.material.maxShDegree=e,this.material.needsUpdate=!0),e>0&&!this.activeSlot.textures.shTexture?this.createSHTexture(this.activeSlot):e===0&&this.activeSlot.textures.shTexture&&(this.activeSlot.textures.shTexture.dispose(),this.activeSlot.textures.shTexture=null),this.material.shTexture=this.activeSlot.textures.shTexture,this.renderData=this.activeSlot.renderData}else this.pendingSlot||(this.bindSlotTextures(null),this.material.maxShDegree!==0&&(this.material.maxShDegree=0,this.material.needsUpdate=!0),this.geometry.instanceCount=0);this.material.syncDynamicUniforms()};let e=this.createGeometry(),t=this.createMaterial();this.geometry=e,this.material=t,this.frustumCulled=!1,this.renderOrder=-99999999999,this.gsSceneState={lastObjectsHash:``,lastClipperHash:``},this.sortWorker=new xn,this.sortWorker.postMessage({warmup:!0}),vn.warmupWasm(),this.sortWorker.onmessage=e=>{if(e.data.depthIndex){let t=e.data.generation;if(this.pendingSlot&&t===this.pendingSlot.generation){this.pendingSlot.awaitingFirstSort=!1,this.swapPendingToActive(e.data.depthIndex);return}this.activeSlot&&t===this.activeSlot.generation&&(this.activeSlot.awaitingFirstSort=!1,this.applyDepthIndex(e.data.depthIndex))}}}ensureSplatIndexCapacity(e){let t=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return t;let n=this.getExpandedCapacity(e),r=t.array,i=new Float32Array(n);i.set(r.subarray(0,Math.min(r.length,n)));let a=new c.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(c.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=n,this.geometry._maxInstanceCount=n,a}getExpandedCapacity(e){let t=Math.max(this.splatIndexCapacity,1);for(;t<e;)t*=2;return t}createGeometry(){let e=new c.InstancedBufferGeometry,t=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]);e.setAttribute(`position`,new c.BufferAttribute(t,3));let n=new Uint16Array([0,1,2,0,2,3]);e.setIndex(new c.BufferAttribute(n,1)),this.splatIndexCapacity=1;let r=new Float32Array(this.splatIndexCapacity);for(let e=0;e<r.length;e++)r[e]=e;let i=new c.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(c.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}createMaterial(){return new Dr({numGsLayers:0,numGsClippers:0,maxShDegree:0})}createDefaultLayerClipperRanges(e){return Array.from({length:e},()=>new c.Vector2(-1,0))}createDefaultClipperMatrices(e){return Array.from({length:e},()=>new c.Matrix4)}createTextures(e,t){var n;let r;t&&t.dataTexture.image.width===e.width&&t.dataTexture.image.height===e.height?(r=t.dataTexture,r.image.data=e.data,r.needsUpdate=!0):(t&&t.dataTexture.dispose(),r=new c.DataTexture(e.data,e.width,e.height,c.RGBAIntegerFormat,c.UnsignedIntType),r.minFilter=c.NearestFilter,r.magFilter=c.NearestFilter,r.generateMipmaps=!1,r.flipY=!1,r.needsUpdate=!0);let i;t&&t.transformsTexture.image.width===e.transformsWidth&&t.transformsTexture.image.height===e.transformsHeight?(i=t.transformsTexture,i.image.data=e.transforms,i.needsUpdate=!0):(t&&t.transformsTexture.dispose(),i=new c.DataTexture(e.transforms,e.transformsWidth,e.transformsHeight,c.RGBAFormat,c.FloatType),i.minFilter=c.NearestFilter,i.magFilter=c.NearestFilter,i.generateMipmaps=!1,i.flipY=!1,i.needsUpdate=!0);let a;t&&t.transformIndicesTexture.image.width===e.transformIndicesWidth&&t.transformIndicesTexture.image.height===e.transformIndicesHeight?(a=t.transformIndicesTexture,a.image.data=e.transformIndices,a.needsUpdate=!0):(t&&t.transformIndicesTexture.dispose(),a=new c.DataTexture(e.transformIndices,e.transformIndicesWidth,e.transformIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType),a.minFilter=c.NearestFilter,a.magFilter=c.NearestFilter,a.generateMipmaps=!1,a.flipY=!1,a.needsUpdate=!0);let o;t&&t.layerIndicesTexture.image.width===e.layerIndicesWidth&&t.layerIndicesTexture.image.height===e.layerIndicesHeight?(o=t.layerIndicesTexture,o.image.data=e.layerIndices,o.needsUpdate=!0):(t&&t.layerIndicesTexture.dispose(),o=new c.DataTexture(e.layerIndices,e.layerIndicesWidth,e.layerIndicesHeight,c.RedIntegerFormat,c.UnsignedIntType),o.minFilter=c.NearestFilter,o.magFilter=c.NearestFilter,o.generateMipmaps=!1,o.flipY=!1,o.needsUpdate=!0);let s=(n=t==null?void 0:t.shTexture)==null?null:n;return{dataTexture:r,transformsTexture:i,transformIndicesTexture:a,layerIndicesTexture:o,shTexture:s}}createSHTexture(e){let{renderData:t,textures:n}=e;if(t.shDataReleased)return;n.shTexture&&(n.shTexture.dispose(),n.shTexture=null);let r=Math.min(this.usedSHDegree,t.maxShDegree),i=0;if(r>=1&&(i+=9),r>=2&&(i+=15),r>=3&&(i+=21),i===0)return;let a=i;a%4!=0&&(a=Math.ceil(a/4)*4);let o=t.numPoints*a/4,s=2048,l=Math.ceil(o/s),u=new Float32Array(s*l*4);for(let e=0;e<t.numPoints;e++){let n=a/4*e,i=0;if(t.sh1&&r>=1)for(let r=0;r<9;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh1[e*9+r],i++}if(t.sh2&&r>=2)for(let r=0;r<15;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh2[e*15+r],i++}if(t.sh3&&r>=3)for(let r=0;r<21;r++){let a=n+Math.floor(i/4),o=i%4,s=a*4+o;u[s]=t.sh3[e*21+r],i++}}n.shTexture=new c.DataTexture(u,s,l,c.RGBAFormat,c.FloatType),n.shTexture.minFilter=c.NearestFilter,n.shTexture.magFilter=c.NearestFilter,n.shTexture.generateMipmaps=!1,n.shTexture.flipY=!1,n.shTexture.needsUpdate=!0,this.material.shTextureSize.set(s,l),this.material.maxShDegree!==r&&(this.material.maxShDegree=r,this.material.needsUpdate=!0),e.renderData.releaseSHData()}setMaxShDegree(e){var t,n;if(e<0||e>2){console.warn(`现在只支持012三种阶数,你输入的是${e}`);return}let r=this.usedSHDegree;this.usedSHDegree=e,r!==e&&((t=this.activeSlot)!=null&&t.textures.shTexture&&(this.activeSlot.textures.shTexture.dispose(),this.activeSlot.textures.shTexture=null),(n=this.pendingSlot)!=null&&n.textures.shTexture&&(this.pendingSlot.textures.shTexture.dispose(),this.pendingSlot.textures.shTexture=null),this.material.maxShDegree!==e&&(this.material.maxShDegree=e,this.material.needsUpdate=!0),e===0?this.material.shTexture=null:this.activeSlot&&this.activeSlot.renderData.maxShDegree>0&&(this.createSHTexture(this.activeSlot),this.material.shTexture=this.activeSlot.textures.shTexture))}bindSlotTextures(e){if(!e){this.dataTexture=null,this.transformsTexture=null,this.transformIndicesTexture=null,this.layerIndicesTexture=null,this.shTexture=null,this.material.dataTexture=null,this.material.transformsTexture=null,this.material.transformIndicesTexture=null,this.material.layerIndicesTexture=null,this.material.shTexture=null;return}this.dataTexture=e.textures.dataTexture,this.transformsTexture=e.textures.transformsTexture,this.transformIndicesTexture=e.textures.transformIndicesTexture,this.layerIndicesTexture=e.textures.layerIndicesTexture,this.shTexture=e.textures.shTexture,this.material.dataTexture=this.dataTexture,this.material.transformsTexture=this.transformsTexture,this.material.transformIndicesTexture=this.transformIndicesTexture,this.material.layerIndicesTexture=this.layerIndicesTexture,this.material.shTexture=this.shTexture}disposeSlot(e){e&&(e.renderData.dispose(),this.disposeTextures(e.textures))}recycleSlot(e){if(e){if(this.freeSlotPool.length>=Or){let e=this.freeSlotPool.shift();this.disposeSlot(e)}e.renderData.releaseSortData(),e.renderData.releaseAggregatedData(),e.awaitingFirstSort=!0,e.sortDataUploaded=!1,this.freeSlotPool.push(e)}}disposeTextures(e){e.dataTexture.dispose(),e.transformsTexture.dispose(),e.transformIndicesTexture.dispose(),e.layerIndicesTexture.dispose(),e.shTexture&&(e.shTexture.dispose(),e.shTexture=null)}applyDepthIndex(e){var t;this.depthIndex=e;let n=this.depthIndex.length,r=this.ensureSplatIndexCapacity(n);r.array.set(this.depthIndex,0),(t=r.clearUpdateRanges)==null||t.call(r),r.addUpdateRange(0,n),r.needsUpdate=!0,this.geometry.instanceCount=this.depthIndex.length,this.needsRender=!0}swapPendingToActive(e){if(!this.pendingSlot)return;let t=this.activeSlot;this.activeSlot=this.pendingSlot,this.pendingSlot=null,this.renderData=this.activeSlot.renderData,this.ensureSplatIndexCapacity(this.activeSlot.renderData.numPoints),this.bindSlotTextures(this.activeSlot),this.activeSlot.sortDataUploaded=!0,this.forceClipperUniformRefresh=!0,this.applyDepthIndex(e),t&&this.recycleSlot(t)}createSlot(e){let t={generation:e.generation,renderData:e,textures:this.createTextures(e),awaitingFirstSort:!0,sortDataUploaded:!1};return this.usedSHDegree>0&&e.maxShDegree>0&&this.createSHTexture(t),t}updateSlotTextures(e){e.renderData.dataChanged&&(e.textures.dataTexture.needsUpdate=!0,e.renderData.dataChanged=!1),e.renderData.transformsChanged&&(e.textures.transformsTexture.needsUpdate=!0,e.renderData.indexDataReleased||(e.textures.transformIndicesTexture.needsUpdate=!0),e.renderData.transformsChanged=!1)}postSortData(e){var t;let n=e.renderData.positions,r=new Float32Array(e.renderData.transforms.slice().buffer),i=new Uint32Array(e.renderData.transformIndices.slice().buffer);(t=this.sortWorker)==null||t.postMessage({sortData:{positions:n,transforms:r,transformIndices:i,vertexCount:e.renderData.numPoints,generation:e.generation}},[n.buffer,r.buffer,i.buffer]),e.renderData.releaseSortData(),e.renderData.releaseIndexData(),e.sortDataUploaded=!0}requestSort(e,t){var n;if(e.renderData.initialBuildComplete){if(e.renderData.dataChanged||e.renderData.transformsChanged||!e.sortDataUploaded){if(e.renderData.sortDataReleased){this.sortDataRebuilding||(this.sortDataRebuilding=!0,e.renderData.rebuildSortData().then(()=>{this.sortDataRebuilding=!1,(this.activeSlot===e||this.pendingSlot===e)&&(e.sortDataUploaded=!1,this.needsRender=!0)}));return}this.postSortData(e)}(n=this.sortWorker)==null||n.postMessage({viewProj:t})}}syncTransformsForSlot(e,t){e&&t.forEach(t=>{e.renderData.splatIndices.has(t)&&e.renderData.updateTransform(t)})}collectObjects(e){let t=[];return e.traverse(e=>{e instanceof At&&e.visible&&t.push(e)}),t.sort((e,t)=>{let n=e.uuid+e.gsViewLayerKey,r=t.uuid+t.gsViewLayerKey;return n<r?-1:+(n>r)}),t}isSceneNeedsRebuild(e){let t=e.map(e=>`${e.uuid}:${e.gsViewLayerKey}`).join(`|`),n=t!==this.gsSceneState.lastObjectsHash;return this.gsSceneState.lastObjectsHash=t,n}getClipperHash(e){return e.map(e=>{let t=e.gsClippers.map(e=>{var t;return`${(t=e.floorIndex)==null?-1:t}:${e.clippingBoxMatrix.elements.join(`,`)}`}).join(`;`);return`${e.gsViewLayerKey}:${t}`}).join(`|`)}updateClipperCounts(e,t){let n=Math.max(0,e|0),r=Math.max(0,t|0);(this.material.numGsLayers!==n||this.material.numGsClippers!==r)&&(this.material.numGsLayers=n,this.material.numGsClippers=r,this.material.needsUpdate=!0)}updateClipperUniforms(e){var t,n,r,i;let a=(n=(t=this.activeSlot)==null?void 0:t.renderData)==null?null:n;if(!a){this.material.layerClipperRanges=[],this.material.clipperMatricesInverse=[],this.updateClipperCounts(0,0);return}let o=new Map;for(let t of e)o.has(t.gsViewLayerKey)||o.set(t.gsViewLayerKey,t.gsClippers);let s=a.layerKeys.length,c=0;for(let e of a.layerKeys)c+=((r=o.get(e))==null?[]:r).length;let l=this.createDefaultLayerClipperRanges(s),u=this.createDefaultClipperMatrices(c),d=0;for(let e of a.layerKeys){let t=a.layerKeyToIndex.get(e);if(t===void 0)continue;let n=(i=o.get(e))==null?[]:i,r=d,s=0;for(let e of n)u[d].copy(e.clippingBoxMatrix).invert(),d++,s++;s>0&&l[t].set(r,s)}this.material.layerClipperRanges=l,this.material.clipperMatricesInverse=u,this.updateClipperCounts(s,d)}startPendingRebuild(e){this.pendingSlot&&(this.recycleSlot(this.pendingSlot),this.pendingSlot=null),this.rebuildGeneration+=1;let t=new vn(e,this.rebuildGeneration),n=this.freeSlotPool.pop();if(n){n.renderData.dispose();let e=this.createTextures(t,n.textures);this.pendingSlot={generation:t.generation,renderData:t,textures:e,awaitingFirstSort:!0,sortDataUploaded:!1}}else this.pendingSlot=this.createSlot(t)}tryStartIncrementalUpdate(e){if(!this.activeSlot||this.pendingSlot||this.incrementalUpdateInFlight)return!1;let t=this.activeSlot.renderData.getObjectsInOrder();if(!this.activeSlot.renderData.canIncrementalAppend(e))return!1;let n=e.slice(t.length);if(n.length===0)return!1;this.incrementalUpdateInFlight=!0;let r=this.activeSlot;return r.renderData.appendObjects(n).then(e=>{e&&(this.activeSlot!==r||r.renderData.disposed||(r.textures=this.createTextures(r.renderData,r.textures),this.usedSHDegree>0&&r.renderData.maxShDegree>0&&this.createSHTexture(r),this.bindSlotTextures(r),this.ensureSplatIndexCapacity(r.renderData.numPoints),r.sortDataUploaded=!1,r.awaitingFirstSort=!0,this.forceClipperUniformRefresh=!0,this.gsSceneState.lastClipperHash=``,this.needsRender=!0))}).catch(e=>{console.warn(`Incremental append failed, fallback to rebuild:`,e)}).finally(()=>{this.incrementalUpdateInFlight=!1}),!0}dispose(){this.disposeSlot(this.pendingSlot),this.pendingSlot=null,this.disposeSlot(this.activeSlot),this.activeSlot=null;for(let e of this.freeSlotPool)this.disposeSlot(e);this.freeSlotPool.length=0,this.renderData=null,this.sortWorker&&this.sortWorker.terminate(),this.bindSlotTextures(null),this.geometry.dispose(),this.material.dispose()}},Ar=class extends c.MeshBasicMaterial{constructor(e){super(e),this.isPBMMaterial=!0,this.shaderType=`baisc`,this.type=`PBMMeshBasicMaterial`,Object.assign(this,Vt())}copy(e){return super.copy(e),Ht(this,e),this}},jr=class extends c.MeshBasicMaterial{constructor(e){super(e),this.isPBMMaterial=!0,this.shaderType=`panoOnly`,this.type=`PBMPanoOnlyMaterial`,Object.assign(this,Vt())}copy(e){return super.copy(e),Ht(this,e),this}},Mr=class extends c.MeshPhongMaterial{constructor(e){super(e),this.isPBMMaterial=!0,this.shaderType=`phong`,this.type=`PBMMeshPhongMaterial`,Object.assign(this,Vt())}copy(e){return super.copy(e),Ht(this,e),this}},Nr=class extends c.MeshPhysicalMaterial{constructor(e){super(e),this.isPBMMaterial=!0,this.shaderType=`standard`,this.type=`PBMMeshPhysicalMaterial`,Object.assign(this,Vt())}copy(e){return super.copy(e),Ht(this,e),this}};function Pr(e){switch(typeof e==`object`?e==null?void 0:e.shaderType:e){case`basic`:return new Ar;case`panoOnly`:return new jr;case`phong`:return new Mr;default:return new Nr}}c.Material;var{materialReference:Fr,attribute:Ir,float:Lr,vec3:Rr,vec4:zr,mat4:Br}=c.TSL;function Vr(e,t=0){let n=`float`,r=Ir(e,n),i=r.generate.bind(r);return r.generate=function(r){return r.hasGeometryAttribute(e)?i(r):r.generateConst(n,t)},Lr(r)}function W(e){return Lr(Fr(e,`float`)).toVar(e)}function Hr(e){return Rr(Fr(e,`vec3`)).toVar(e)}function Ur(e){return zr(Fr(e,`vec4`)).toVar(e)}function Wr(e){return Br(Fr(e,`mat4`)).toVar(e)}function Gr(e,t){let n=Fr(e,`cubeTexture`),r=n.setup;return n.setup=function(n){let i=r.call(this,n);return i&&(t&&(i.uvNode=t),i.getUniformHash=function(){return[e,this.value.uuid].join(`-`)}),i},zr(n).toVar(e)}function Kr(e,t){let n=Fr(e,`texture`),r=n.setup;return n.setup=function(n){let i=r.call(this,n);return i&&(t&&(i.uvNode=t),i.getUniformHash=function(){return[e,this.value.uuid].join(`-`)}),i},zr(n).toVar(e)}var{Fn:qr,vec3:Jr,vec4:Yr,float:Xr,abs:Zr,clamp:Qr,min:$r,mix:ei,step:ti,fract:ni,dot:ri,log2:ii,exp2:ai,pow:oi,normalize:si}=c.TSL,ci=qr(([e])=>{let t=Jr(e).toVar(),n=Yr(0,-1/3,2/3,-1),r=ei(Yr(t.b,t.g,n.w,n.z),Yr(t.g,t.b,n.x,n.y),ti(t.b,t.g)).toVar(),i=ei(Yr(r.x,r.y,r.w,t.r),Yr(t.r,r.y,r.z,r.x),ti(r.x,t.r)).toVar(),a=i.x.sub($r(i.w,i.y)),o=Xr(1e-10);return Jr(Zr(i.z.add(i.w.sub(i.y).div(a.mul(6).add(o)))),a.div(i.x.add(o)),i.x)}).setLayout({name:`FN_rgb2hsv`,type:`vec3`,inputs:[{name:`color`,type:`vec3`}]}),li=qr(([e])=>{let t=Jr(e).toVar(),n=Yr(1,2/3,1/3,3),r=Zr(ni(Jr(t.x,t.x,t.x).add(Jr(n.x,n.y,n.z))).mul(6).sub(Jr(n.w,n.w,n.w)));return t.z.mul(ei(Jr(n.x,n.x,n.x),Qr(r.sub(Jr(n.x,n.x,n.x)),0,1),t.y))}).setLayout({name:`FN_hsv2rgb`,type:`vec3`,inputs:[{name:`color`,type:`vec3`}]}),ui=qr(([e])=>ri(e,Yr(1/(256*256*256),1/(256*256),1/256,1))).setLayout({name:`FN_hsv2rgb`,type:`float`,inputs:[{name:`color`,type:`vec4`}]}),di=qr(([e,t,n,r,i,a,o])=>{let s=Qr(ii(t).sub(ii(i)).div(ii(a).sub(ii(i))),Xr(0),Xr(1)),c=Jr(oi(e.r,o),oi(e.g,o),oi(e.b,o)),l=ii(r),u=ii(n),d=Jr(l).add(c.mul(Jr(u.sub(l)))).mul(s);return Jr(ai(d.x),ai(d.y),ai(d.z))}).setLayout({name:`FN_hdrBoost`,type:`vec3`,inputs:[{name:`gainRGB`,type:`vec3`},{name:`maxDisplayBoost`,type:`float`},{name:`maxContentBoost`,type:`float`},{name:`minContentBoost`,type:`float`},{name:`capacityMin`,type:`float`},{name:`capacityMax`,type:`float`},{name:`gamma`,type:`float`}]}),fi=qr(([e,t,n])=>{let r=ri(e,t),i=e.mul(r),a=t.sub(i).div(n);return si(i.add(a))}).setLayout({name:`FN_zoomVector`,type:`vec3`,inputs:[{name:`direction`,type:`vec3`},{name:`vector`,type:`vec3`},{name:`zoom`,type:`float`}]}),pi=qr(([e,t,n,r])=>{let i=e.mul(Yr(0,0,0,1)).xyz,a=fi(n,si(r.sub(i)),t);return e.toMat3().transpose().mul(a)}).setLayout({name:`FN_sampleDirection`,type:`vec3`,inputs:[{name:`direction`,type:`mat4`},{name:`vector`,type:`float`},{name:`zoom`,type:`vec3`},{name:`positionWorld`,type:`vec3`}]}),mi=Math.PI*2;function hi(e){return e>=0&&e<mi?e:(e%mi+mi)%mi}function gi(e,t){let n=Math.abs(Math.cos(e.latitude)),r=-Math.sin(e.longitude)*n,i=-Math.sin(e.latitude),a=-Math.cos(e.longitude)*n;return t?t.set(r,i,a):new c.Vector3(r,i,a)}function _i(e){return{longitude:hi(-Math.atan2(e.x,-e.z)),latitude:-Math.asin(e.y/1)}}function vi(e){return(-e/Math.PI*180-90)/360+.25}function yi(e){return-((e-.25)*360+90)/180*Math.PI}var bi=Date.now();typeof performance<`u`&&(typeof performance.timeOrigin==`number`?bi=performance.timeOrigin:performance.timing!==void 0&&(bi=performance.timing.navigationStart));var G=typeof performance<`u`?(()=>bi+performance.now()):(()=>Date.now());function xi(e){return e-bi}var Si=1,Ci=.1,wi=2e3,Ti=Math.PI*2,Ei=Math.PI/2;function Di(e){return e>0&&e<=Ti?e:(e%Ti+Ti)%Ti}function Oi(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 ki=class extends c.Camera{constructor(e,t=Si,n=Ci,r=wi,i=new c.Vector2,a=new c.Vector2(512,512),o=1){super(),this.fov=e,this.aspect=t,this.near=n,this.far=r,this.perspToOrtho=i,this.resolution=a,this.pixelRatio=o,this.time=0,this.controllerMode=null,this.needsRender=!0,this.refineModel=!0,this.pose={longitude:0,latitude:0,fov:e,distance:0,offset:new c.Vector3},this.computePose(),this.perspectiveCamera=new c.PerspectiveCamera(this.fov,this.aspect,.001,this.far);let s=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),l=-.5*this.aspect*2*s;this.orthographicCamera=new c.OrthographicCamera(l,-l,s,-s,.001,this.far),this.computeProjectionMatrix(),this.lastValues={position:this.position.clone(),quaternion:this.quaternion.clone(),scale:this.scale.clone(),fov:this.fov,aspect:this.aspect,near:this.near,far:this.far,orthoDistance:this.orthoDistance,perspToOrtho:this.perspToOrtho.clone()},this.type=this.perspToOrtho.x<1?`PerspectiveCamera`:`OrthographicCamera`,this.autoNearFar=!0}get orthoDistance(){return this.pose.distance>1?this.pose.distance:1+(this.pose.distance-1)*this.perspToOrtho.x}get zoom(){return this.type===`OrthographicCamera`?this.orthographicCamera.zoom:this.type===`PerspectiveCamera`?this.perspectiveCamera.zoom:1}get top(){return this.type===`OrthographicCamera`?this.orthographicCamera.top:0}get bottom(){return this.type===`OrthographicCamera`?this.orthographicCamera.bottom:0}get left(){return this.type===`OrthographicCamera`?this.orthographicCamera.left:0}get right(){return this.type===`OrthographicCamera`?this.orthographicCamera.right:0}getDirection(e){return gi(this.pose,e)}computePose(e=0){this.updateMatrix();let t=this.matrix.elements;return this.pose.latitude=Math.asin(H(t[9],-1,1)),Math.abs(t[9])<.9999999?this.pose.longitude=Di(Math.atan2(t[8],t[10])):this.pose.longitude=Di(Math.atan2(-t[2],t[0])),this.pose.fov=this.fov,this.pose.distance=e,this.pose.offset=new c.Vector3(-t[8],-t[9],-t[10]).setLength(this.pose.distance).add(this.position),this}setFromPose(e){var t,n,r,i,a;let o=Di((t=e.longitude)==null?this.pose.longitude:t),s=Math.max(-Ei+1e-4,Math.min(Ei-1e-4,(n=e.latitude)==null?this.pose.latitude:n)),c=(r=e.fov)==null?this.pose.fov:r,l=(i=e.distance)==null?this.pose.distance:i,u=(a=e.offset)==null?this.pose.offset:a,d=gi({longitude:o,latitude:s}).normalize();return this.position.set(0,0,0),this.lookAt(d),this.position.add(u).sub(d.clone().setLength(l)),this.fov!==c&&(this.fov=c,this.perspectiveCamera.fov=c,this.updateProjectionMatrix()),this.updateMatrixWorld(!0),this.pose.longitude=o,this.pose.latitude=s,this.pose.fov=c,this.pose.distance=l,this.pose.offset.copy(u),this.needsRender=!0,this}copyPose(){return{longitude:this.pose.longitude,latitude:this.pose.latitude,fov:this.pose.fov,distance:this.pose.distance,offset:this.pose.offset.clone()}}computeProjectionMatrix(){Oi(this.orthographicCamera.projectionMatrix,this.perspectiveCamera.projectionMatrix,1-this.perspToOrtho.x,this.projectionMatrix),this.projectionMatrixInverse.copy(this.projectionMatrix).invert(),this.needsRender=!0}setViewOffset(e,t,n,r,i,a){this.perspectiveCamera.setViewOffset(e,t,n,r,i,a),this.orthographicCamera.setViewOffset(e,t,n,r,i,a),this.computeProjectionMatrix()}get view(){return this.perspectiveCamera.view?Object.assign({},this.perspectiveCamera.view):null}clearViewOffset(){this.perspectiveCamera.clearViewOffset(),this.orthographicCamera.clearViewOffset(),this.computeProjectionMatrix()}updateProjectionMatrix(){this.perspectiveCamera.coordinateSystem=this.coordinateSystem,this.orthographicCamera.coordinateSystem=this.coordinateSystem,this.perspectiveCamera.updateProjectionMatrix(),this.orthographicCamera.updateProjectionMatrix(),this.computeProjectionMatrix()}get perspectiveProjectionMatrix(){return this.perspectiveCamera.projectionMatrix}get perspectiveProjectionMatrixInverse(){return this.perspectiveCamera.projectionMatrixInverse}get orthographicProjectionMatrix(){return this.orthographicCamera.projectionMatrix}get orthographicProjectionMatrixInverse(){return this.orthographicCamera.projectionMatrixInverse}updateTime(e){this.time=e;let t=!1;if((this.lastValues.fov!==this.fov||this.lastValues.near!==this.near||this.lastValues.far!==this.far||this.lastValues.aspect!==this.aspect)&&(this.perspectiveCamera.coordinateSystem=this.coordinateSystem,this.perspectiveCamera.fov=this.fov,this.perspectiveCamera.near=this.near,this.perspectiveCamera.far=this.far,this.perspectiveCamera.aspect=this.aspect,this.perspectiveCamera.updateProjectionMatrix(),t=!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.orthoDistance!==this.orthoDistance||this.lastValues.aspect!==this.aspect){let e=Math.max(this.orthoDistance,.01)*Math.tan(.5*this.fov/180*Math.PI),n=-.5*this.aspect*2*e;this.orthographicCamera.coordinateSystem=this.coordinateSystem,this.orthographicCamera.left=n,this.orthographicCamera.right=-n,this.orthographicCamera.top=e,this.orthographicCamera.bottom=-e,this.orthographicCamera.near=this.near,this.orthographicCamera.far=this.far,this.orthographicCamera.updateProjectionMatrix(),t=!0}t&&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.orthoDistance=this.orthoDistance,this.lastValues.perspToOrtho.copy(this.perspToOrtho),this.type=this.perspToOrtho.x<1?`PerspectiveCamera`:`OrthographicCamera`}get isPerspectiveCamera(){return this.perspToOrtho.x<1}get isOrthographicCamera(){return this.perspToOrtho.x>=1}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.perspToOrtho.copy(e.perspToOrtho),this.updateTime(G()),this}},{vec2:Ai,vec3:ji,vec4:Mi,float:Ni,int:Pi,bool:Fi,normalize:Ii,mix:Li,min:Ri,step:zi,abs:Bi,clamp:Vi,length:Hi,smoothstep:Ui,pow:Wi,uniform:Gi,property:Ki,cameraViewMatrix:qi,positionWorld:Ji,Fn:Yi}=c.TSL,Xi=Mi(0,0,0,0),Zi=new c.Vector4,Qi=Gi(new c.Vector2(512,512)).onFrameUpdate(function(e){let t=e.camera;t instanceof ki?this.value.copy(t.resolution):e.renderer&&(e.renderer.getViewport(Zi),this.value.set(Zi.width,Zi.height))}),$i=Gi(1).onFrameUpdate(function(e){let t=e.camera;t instanceof ki?this.value=t.pixelRatio:e.renderer&&(this.value=e.renderer.getPixelRatio())}),ea=ji(qi.element(Pi(0)).element(Pi(2)),qi.element(Pi(1)).element(Pi(2)),qi.element(Pi(2)).element(Pi(2))).negate().normalize().toVarying(`v_cameraDirection`),ta=Ui(Ni(0),Ni(1),Vr(`_feature_id_rsmask`,0)).toVarying(`v_roofMark`),na=W(`progress`),ra=W(`maxDisplayBoost`),ia=W(`modelAlpha`),aa=Wr(`pano0Matrix`),oa=W(`pano0Zoom`),sa=Ur(`pano0Histogram`),ca=W(`pano0HdrMaxContentBoost`),la=W(`pano0HdrMinContentBoost`),ua=W(`pano0HdrCapacityMin`),da=W(`pano0HdrCapacityMax`),fa=W(`pano0HdrGamma`),pa=W(`pano0DepthMaxDepth`),ma=Wr(`pano1Matrix`),ha=W(`pano1Zoom`),ga=Ur(`pano1Histogram`),_a=W(`pano1HdrMaxContentBoost`),va=W(`pano1HdrMinContentBoost`),ya=W(`pano1HdrCapacityMin`),ba=W(`pano1HdrCapacityMax`),xa=W(`pano1HdrGamma`),Sa=W(`pano1DepthMaxDepth`),Ca=W(`panoFilterSaturationBias`),wa=W(`panoFilterContrastBias`),Ta=W(`panoFilterTemperatureBias`),Ea=W(`panoFilterTintBias`),Da=Wr(`refinedScreenProjectionMatrix`),Oa=Wr(`refinedScreenMatrixInverse`),ka=W(`refinedScreenOpacity`),Aa=W(`refinedScreenPano`),ja=W(`colorAlpha`);W(`brightness`);var Ma=W(`floorIndex`),Na=W(`shownFloorIndex`),Pa=Hr(`modelBoundingMin`),Fa=Hr(`modelBoundingMax`),Ia=Hr(`constantColor`),La=W(`pointScale`),Ra=W(`pointMinPixel`),za=W(`pointMaxPixel`),Ba=W(`colorSaturation`),Va=W(`colorBrightness`),Ha=Na.lessThan(-.01).or(Bi(Ma.sub(Na)).lessThan(.99)).toVar(`isCurrentFloor`),Ua=ta.greaterThan(.001).toVar(`isRoof`),Wa=Yi(()=>{let e=Fi().toVar(`isRoofCut`),t=Wi(Vi(ea.y.negate(),0,1),3),n=Fa.y.sub(t.mul(Fa.y.sub(Pa.y)));return e.assign(Ua.and(Ji.y.greaterThan(n))),e})(),Ga=aa.mul(Mi(0,0,0,1)).xyz.toVar(`pano0Origin`),Ka=pi(aa,oa,ea,Ji).toVar(`pano0SampleDirection`),qa=ma.mul(Mi(0,0,0,1)).xyz.toVar(`pano1Origin`),Ja=pi(ma,ha,ea,Ji).toVar(`pano1SampleDirection`),Ya=Gr(`pano0Map`,Ka).rgb.toVar(`pano0SdrColor`),Xa=Gr(`pano1Map`,Ja).rgb.toVar(`pano1SdrColor`),Za=Gr(`pano0GainMap`,Ka).rgb.toVar(`pano0GainColor`),Qa=Gr(`pano1GainMap`,Ja).rgb.toVar(`pano1GainColor`),$a=Yi(()=>{let e=ji().toVar(`pano0HdrColor`),t=di(Za,ra,ca,la,ua,da,fa);return e.assign(Ya.mul(t)),e})(),eo=Yi(()=>{let e=ji().toVar(`pano1HdrColor`),t=di(Qa,ra,_a,va,ya,ba,xa);return e.assign(Xa.mul(t)),e})(),to=Yi(()=>{let e=Mi().toVar(`refinedScreenColor`),t=Oa.mul(Mi(Ji,1)).toVar(),n=Li(oa,ha,Aa),r=fi(ji(0,0,1),Ii(t.xyz),n),i=Da.mul(Mi(r,1)).toVar();i.divAssign(i.w);let a=ji(i.x,i.y.negate(),0).add(1).div(2);e.assign(Kr(`refinedScreenMap`,a.xy)),e.a.mulAssign(ka);let o=zi(Bi(i.x),1).mul(zi(Bi(i.y),1)).mul(zi(t.z,0));return e.assign(Li(Xi,e,o)),e})(),no=Li(to,Xi,Aa).toVar(`refinedScreenPano0Color`),ro=Li(to,Xi,Ni(1).sub(Aa)).toVar(`refinedScreenPano1Color`),io=.03,ao=Yi(()=>{let e=Ni().toVar(`pano0DepthTrust`),t=Vi(Hi(Ji.sub(Ga)),0,Ni(pa)).toVar(),n=Bi(ui(Mi(Gr(`pano0DepthMap`,Ka))).mul(pa).sub(t)),r=Ni(io).mul(t);return e.assign(zi(r,n)),e})(),oo=Yi(()=>{let e=Ni().toVar(`pano1DepthTrust`),t=Vi(Hi(Ji.sub(qa)),0,Ni(Sa)).toVar(),n=Bi(ui(Mi(Gr(`pano1DepthMap`,Ja))).mul(Sa).sub(t)),r=Ni(io).mul(t);return e.assign(zi(r,n)),e})(),so=Yi(()=>{let e=ji().toVar(`gradientColor`),t=Ni(Ji.y.sub(Pa.y)).div(Fa.y.sub(Pa.y));return e.assign(Kr(`gradientTexture`,Ai(t,.5)).rgb),e})(),co=Li(Vi(Ni(.2).mul(Ri(Ni(1).add(ea.y),1)),0,1),Ni(1),Ni(Ha)).toVar(`floorOpacity`),lo=Ki(`vec3`).toVar(`pano0Color`),uo=Ki(`vec3`).toVar(`pano1Color`),{Fn:fo,vec2:po,vec3:mo,vec4:ho,float:go,clamp:_o,max:vo,mix:yo,step:bo}=c.TSL,xo=fo(([e,t])=>{let n=mo(e).toVar(),r=_o(t,-100,100);return n.r.assign(n.r.mul(go(1).add(r.div(300)))),n.b.assign(n.b.mul(go(1).sub(r.div(300)))),_o(n,0,1)}).setLayout({name:`FN_filterColorTemperature`,type:`vec3`,inputs:[{name:`color`,type:`vec3`},{name:`temperatureBias`,type:`float`}]}),So=fo(([e,t])=>{let n=mo(e).toVar(),r=_o(t,-100,100),i=go(1).add(r.mul(-.5).div(200).mul(bo(r,0))),a=go(1).sub(yo(r.mul(.5).div(200),r.div(200),bo(go(0),r))),o=go(1).add(r.mul(-.5).div(200).mul(bo(r,0)));return n.r.assign(n.r.mul(i)),n.g.assign(n.g.mul(a)),n.b.assign(n.b.mul(o)),_o(n,0,1)}).setLayout({name:`FN_filterColorTint`,type:`vec3`,inputs:[{name:`color`,type:`vec3`},{name:`tintBias`,type:`float`}]}),Co=fo(([e,t,n])=>{let r=mo(e).toVar(),i=t.y,a=t.z,o=t.w,s=_o(n,-1,1).toVar(),c=s.add(1).toVar(),l=s.mul(s).div(2).toVar(),u=c.sub(1).div(i).toVar(),d=go(1).sub(c).div(go(1).sub(i)).toVar(),f=c.sub(i).div(go(1).sub(i)).toVar(),p=go(1).div(o.sub(a)).toVar(),m=r.toVar(),h=vo(vo(r.r,r.g),r.b).toVar();m.assign(yo(m,m.mul(go(1).sub(l)).add(h.mul(l)),bo(s,0)));let g=yo(d.mul(m.r).add(f),u.mul(m.r).add(1),bo(m.r,i)),_=yo(d.mul(m.g).add(f),u.mul(m.g).add(1),bo(m.g,i)),v=yo(d.mul(m.b).add(f),u.mul(m.b).add(1),bo(m.b,i));return r.assign(m.sub(i).mul(mo(g,_,v).mul(p)).add(i)),_o(r,0,1)}).setLayout({name:`FN_filterContrast`,type:`vec3`,inputs:[{name:`color`,type:`vec3`},{name:`histogram`,type:`vec4`},{name:`contrastBias`,type:`float`}]}),wo=fo(([e,t])=>{let n=mo(e).toVar(),r=go(1).add(t),i=go(.299).mul(n.r).add(go(.587).mul(n.g)).add(go(.114).mul(n.b));return n.assign(n.sub(i).mul(r).add(i)),_o(n,0,1)}).setLayout({name:`FN_filterSaturation`,type:`vec3`,inputs:[{name:`color`,type:`vec3`},{name:`saturationBias`,type:`float`}]});function To(e,t,n,r,i){return fo(([a,o])=>{let s=mo(a).toVar(),c=ci(s).toVar();return c.z.assign(ho(i(po(c.z,0))).r),s.assign(li(c)),s.assign(_o(s,0,1)),s.assign(xo(s,n)),s.assign(So(s,r)),s.assign(Co(s,o,t)),s.assign(wo(s,e)),s})}var{Fn:Eo,vec3:Do,vec4:Oo,float:ko,acos:Ao,max:jo,min:Mo,mix:No,length:Po,distance:Fo,smoothstep:Io,screenCoordinate:Lo}=c.TSL;function Ro(e){return Eo(([t,n,r])=>{let i=Do().toVar();if(e.transition===`BLACK`){let e=Oo(.086,.106,.149,1),a=Ao(ko(-2).mul(r).add(1)).toVar();i.assign(No(t,e,Mo(ko(1),a))),i.assign(No(i,n,jo(ko(0),a.sub(Math.PI).add(1))))}else if(e.transition===`SPREAD`){let e=Qi.mul($i).div(2).toVar(),a=Po(e).mul(1.2),o=Fo(Lo.xy,e).div(a);i.assign(No(t,n,Io(0,.2,r.sub(o))))}else i.assign(No(t,n,r));return i})}var{vec3:zo,vec4:Bo,float:Vo,clamp:Ho,mix:Uo,Fn:Wo}=c.TSL;function Go(e){return Wo(([t])=>{if(e.useHDR?(lo.assign($a),uo.assign(eo)):(lo.assign(Ya),uo.assign(Xa)),e.useRefinedScreen&&(lo.assign(Uo(lo,no.rgb,no.a)),uo.assign(Uo(uo,ro.rgb,ro.a))),!e.useHDR&&e.usePanoFilter){let e=To(Ca,wa,Ta,Ea,e=>Kr(`panoFilterLutMap`,e));lo.assign(e(lo,sa)),uo.assign(e(uo,ga))}if(e.usePanoDepth){let e=Bo(t).toVar(`depthFallback`),n=Ho(na.mul(10),0,1),r=Ho(Vo(1).sub(na).mul(10),0,1);lo.assign(Uo(lo,Uo(lo,e,n),ao)),uo.assign(Uo(uo,Uo(uo,e,r),oo))}let n=zo(0).toVar(`panoColor`),r=Ro(e);return n.assign(r(lo,uo,na)),n})}var{Fn:Ko,vec3:qo,vec4:Jo,float:Yo,int:Xo,varyingProperty:Zo,attribute:Qo,positionGeometry:$o,positionWorld:es,positionView:ts,modelWorldMatrix:ns,cameraProjectionMatrix:rs,cameraPosition:is,normalize:as,clamp:os,length:ss,dot:cs,mix:ls,min:us,max:ds,Discard:fs,colorSpaceToWorking:ps,output:ms}=c.TSL;function hs(e,t){let n=e.pano0Map!=null&&e.pano1Map!=null,r=e.vertexMarks,i=e.floorStyle===`VISIBILITY`,a=e.gradientTexture!=null,o=e.refinedScreenMap!=null,s=e.panoFilterLutMap!=null,c=e.useHDR,l=e.colorStyle,u=e.transition;e.outputNode=Ko(()=>{i&&Ha.not().discard(),r&&Wa.discard();let e=Jo(0).toVar(`result`);if(e.assign(ms),l===`ALTITUDE`&&a?e.rgb.assign(so):l===`CONSTANT`&&e.rgb.assign(Ia),e.a.mulAssign(co.mul(ja)),n){let t=Go({transition:u,usePanoFilter:s,useRefinedScreen:o,useHDR:c,usePanoDepth:!1});e.assign(ls(Jo(t(ms),1),e,ia))}return e})()}function gs(e,t){let n=e.pano0Map!=null&&e.pano1Map!=null,r=e.refinedScreenMap!=null,i=e.panoFilterLutMap!=null,a=e.useHDR,o=e.transition;e.outputNode=Ko(()=>{let e=Jo(0).toVar(`result`);if(n){let t=Go({transition:o,usePanoFilter:i,useRefinedScreen:r,useHDR:a,usePanoDepth:!1});e.rgb.assign(t(ms))}return e.a.assign(Yo(1).sub(os(ia.mul(30),0,1))),e})()}function _s(e,t){e.positionNode=Qo(`instancePosition`,`vec3`);let n=t;n.addStack(),e.setupPosition(t),n.context.position=n.removeStack();let r=ts.z.negate(),i=rs.element(Xo(1)).element(Xo(1)),a=rs.element(Xo(2)).element(Xo(3)),o=Yo(0).sub(a),s=ls(Yo(1),r,o),c;if(e.pointSize===`ATTENUATION`){let e=Yo(1).div(i).mul(s).mul(2);c=Qi.y.mul(La).mul($i).div(e)}else c=La.mul($i);c=os(c,Ra.mul($i),za.mul($i));let l=za.mul($i);if(c=ds(c,us(Yo(1),l)),c=us(c,l),e.pointBack===`HIDDEN`&&!e.flatShading){let e=Qo(`instanceNormal`,`vec3`),t=as(ns.mul(Jo(e,0)).xyz),n=cs(as(is.sub(es)),t);c=ls(Yo(0),c,Yo(n.greaterThan(0)))}Zo(`float`,`v_pointSize`).assign(c);let u=Qi.y.mul($i),d=c.mul(Yo(2)).mul(s).div(i.mul(u)),f=$o.xy,p=ts,m=qo(f.x.mul(d),f.y.mul(d),Yo(0));return rs.mul(Jo(p.add(m),Yo(1)))}function vs(e,t){let n=e.gradientTexture!=null,r=e.colorStyle,i=e.pointBack,a=e.pointShape,o=e.flatShading;e.colorNode=Ko(()=>{let e;return e=r===`ALTITUDE`&&n?so:r===`CONSTANT`?Ia:ps(Qo(`instanceColor`,`vec3`),c.SRGBColorSpace),i===`DARK`&&!o&&(e=Ko(([e])=>{let t=qo(e).toVar(),n=Qo(`instanceNormal`,`vec3`),r=as(ns.mul(Jo(n,0)).xyz),i=cs(as(is.sub(es)),r);return t.assign(ls(t.mul(.8),t,Yo(i.greaterThan(0)))),t})(e)),e=Ko(([e])=>{let t=qo(e).toVar(),n=ci(t).toVar();return n.y.assign(n.y.add(Ba)),n.z.assign(n.z.add(Va)),t.assign(ds(li(n),Yo(0))),t})(e),e})(),e.outputNode=Ko(([e])=>{let t=Zo(`float`,`v_pointSize`);if(fs(t.lessThan(.001)),a===`CIRCLE`){let e=$o.xy,n=ss(e);fs(t.greaterThan(Yo(3)).and(n.greaterThan(.5)))}let n=Jo(e).toVar(`result`);return n.a.assign(co.mul(ia)),n})(ms)}var ys=new Ar,bs=class extends c.MeshBasicNodeMaterial{static get type(){return`PBMMeshBasicNodeMaterial`}constructor(e){super(e),this.isPBMMeshBasicNodeMaterial=!0,this.setDefaultValues(ys),this.setValues(e)}setup(e){hs(this,e),super.setup(e)}setupObserver(e){let t=super.setupObserver(e);return t.refreshUniforms.push(...Bt),t}},xs=new Mr,Ss=class extends c.MeshPhongNodeMaterial{static get type(){return`PBMMeshPhongNodeMaterial`}constructor(e){super(e),this.isPBMMeshPhongNodeMaterial=!0,this.setDefaultValues(xs),this.setValues(e)}setup(e){hs(this,e),super.setup(e)}setupObserver(e){let t=super.setupObserver(e);return t.refreshUniforms.push(...Bt),t}},Cs=new Nr,ws=class extends c.MeshPhysicalNodeMaterial{static get type(){return`PBMMeshPhysicalNodeMaterial`}constructor(e){super(e),this.isPBMMeshPhysicalNodeMaterial=!0,this.setDefaultValues(Cs),this.setValues(e)}setup(e){hs(this,e),super.setup(e)}setupObserver(e){let t=super.setupObserver(e);return t.refreshUniforms.push(...Bt),t}},Ts=new jr,Es=class extends c.MeshBasicNodeMaterial{static get type(){return`PBMPanoOnlyNodeMaterial`}constructor(e){super(e),this.isPBMPanoOnlyNodeMaterial=!0,this.setDefaultValues(Ts),this.setValues(e)}setup(e){gs(this,e),super.setup(e)}setupObserver(e){let t=super.setupObserver(e);return t.refreshUniforms.push(...Bt),t}},Ds=new Xt,Os=class extends c.NodeMaterial{static get type(){return`PBMPointCloudNodeMaterial`}constructor(){super(),this.isPBMPointCloudNodeMaterial=!0,this.setDefaultValues(Ds),this.lights=!1,this.side=c.DoubleSide}customProgramCacheKey(){return super.customProgramCacheKey()+`,`+[this.pointSize,this.pointShape,this.pointBack,this.colorStyle,this.floorStyle,this.vertexMarks,this.flatShading,!!this.gradientTexture].join(`,`)}setupVertex(e){return _s(this,e)}setup(e){vs(this,e),super.setup(e)}setupObserver(e){let t=super.setupObserver(e);return t.refreshUniforms.push(...Bt),t}};function ks(e){e.library.addMaterial(bs,`PBMMeshBasicMaterial`),e.library.addMaterial(Ss,`PBMMeshPhongMaterial`),e.library.addMaterial(ws,`PBMMeshPhysicalMaterial`),e.library.addMaterial(Es,`PBMPanoOnlyMaterial`),e.library.addMaterial(Os,`PBMPointCloudMaterial`)}var As=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),js=new c.Matrix4().copy(As).invert();function K(...e){}var Ms=[/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,/jsonp_([0-9a-z]+)([\?\#].*)?$/i],Ns=typeof location<`u`?location.href:``,Ps=/^https\:/.test(Ns),Fs=class extends Error{constructor(e,t,n){super(`[NETWORK]: request proxy error(type: ${t}, reason: ${n}): ${e}`)}},Is=class extends Error{constructor(e,t,n){super(`[NETWORK]: response error(type: ${t}, status: ${n}): ${e}`),this.httpStatus=n}},Ls=class extends Error{constructor(e,t,n){super(`[NETWORK]: request timeout(type: ${t}, timeout: ${n}ms): ${e}`)}};function Rs(e){if(!e)return{};let t={},n=e.trim().split(`
|
|
389
|
+
`);for(let e=0;e<n.length;e++){let r=n[e],i=r.indexOf(`:`),a=r.slice(0,i).trim().toLowerCase(),o=r.slice(i+1).trim();o&&(t[a]?t[a]+=`, `+o:t[a]=o)}return t}function zs(e){for(let t of Ms){let n=e.match(t);if(n)return`jsonp_`+n[1]}return null}function Bs(e){return zs(e)!==null}var Vs=class extends Lt{};function Hs(e,t={},n=K,r=K,i=K){let a=G(),o=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>Ps&&/^http\:/.test(e)?(console.warn(`The page at '${Ns}' was loaded over HTTPS, but requested an insecure element '${e}'. This request was automatically upgraded to HTTPS`),e.replace(/^http\:/,`https:`)):e).catch(n=>{var r;zs(e);let i=new Fs(o,`XMLHttpRequest`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`XMLHttpRequest`,`forbidden`,i.message),Promise.reject(i)}).then(e=>new Promise((s,c)=>{let l=zs(e);if(l){let i=window,u=null,d=!1,f=document.createElement(`script`);i[l]=p=>{var m,h;let g=G(),_=g-a;if(delete i[l],f.parentNode&&f.parentNode.removeChild(f),u!==null&&(window.clearTimeout(u),u=null),d===!0)return;if(p.indexOf(`data:`)!==0){let n=new Is(e,`XMLHttpRequest`,500);r(n),c(n),(m=t.networkSubscribe)==null||m.emit(`network`,e,`XMLHttpRequest`,`error`,n.message);return}let v=p.split(`,`),y=(v[0].match(/:(.*?);/)||[])[1],b=v[1];if(t.responseType===`arraybuffer`||t.responseType===`blob`){let e=atob(v[1]),n=e.length,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=e.charCodeAt(t);b=t.responseType===`arraybuffer`?r.buffer:new Blob([r],{type:y})}let x={body:b,meta:{origin:o,source:e,requestTime:a,responseTime:g,costs:_,headers:{}}};n(x),s(x),(h=t.networkSubscribe)==null||h.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(x.meta)),d=!0},f.src=e,document.body.appendChild(f),typeof t.timeout==`number`&&(u=window.setTimeout(()=>{var n;if(u=null,d!==!0){d=!0;let i=new Ls(e,`XMLHttpRequest`,t.timeout||NaN);r(i),c(i),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,i.message)}},t.timeout))}else{let l=!1,u=new XMLHttpRequest,d=()=>{u&&(u.removeEventListener(`timeout`,f,!1),u.removeEventListener(`progress`,p,!1),u.removeEventListener(`load`,m,!1),u.removeEventListener(`error`,h,!1)),u=null,d=K},f=function(){var n;if(l===!0)return;l=!0,d();let i=new Ls(e,`XMLHttpRequest`,t.timeout||NaN);r(i),c(i),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,i.message)},p=function(e){l!==!0&&e.lengthComputable&&(e.total<=0||i(e.loaded/e.total,e.loaded,e.total))},m=function(r){var i;if(l===!0)return;let c=this.status;if(c===0||c>=200&&c<400){l=!0,d();let c=G(),u=c-a,f=Rs(this.getAllResponseHeaders()),p=r.total,m={body:this.response,meta:{origin:o,source:e,requestTime:a,responseTime:c,costs:u,headers:f,size:p}};n(m),s(m),(i=t.networkSubscribe)==null||i.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(m.meta))}else h.call(this)},h=function(){var n;if(l===!0)return;l=!0,d();let i=new Is(e,`XMLHttpRequest`,this.status);r(i),c(i),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`error`,i.message)};u.addEventListener(`timeout`,f,!1),u.addEventListener(`progress`,p,!1),u.addEventListener(`load`,m,!1),u.addEventListener(`error`,h,!1),t.responseType&&(u.responseType=t.responseType),typeof t.timeout==`number`&&(u.timeout=t.timeout),u.open(`GET`,e,!0),u.send(null)}}))}var Us={};function Ws(e,t={}){let n=G(),r=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>Ps&&/^http\:/.test(e)?(console.warn(`The page at '${Ns}' was loaded over HTTPS, but requested an insecure element '${e}'. This request was automatically upgraded to HTTPS`),e.replace(/^http\:/,`https:`)):e).catch(n=>{var i;let a=new Fs(r,`Link`,n&&n.message?String(n.message):String(n));return(i=t.networkSubscribe)==null||i.emit(`network`,e,`Link`,`forbidden`,a.message),Promise.reject(a)}).then(e=>e in Us?Us[e]:Us[e]=new Promise((i,a)=>{let o=document.head||document.getElementsByTagName(`head`)[0],s=document.createElement(`link`),c=!1,l=null;s.onload=a=>{var o;if(l!==null&&(clearTimeout(l),l=null),c===!0)return;c=!0,i(),s.onerror=K,s.onload=K;let u=G(),d={origin:r,source:e,requestTime:n,responseTime:u,costs:u-n,headers:{}};(o=t.networkSubscribe)==null||o.emit(`network`,e,`Link`,`preload`,JSON.stringify(d))},s.onerror=n=>{var r;if(l!==null&&(clearTimeout(l),l=null),c===!0)return;c=!0,delete Us[e],o&&s.parentNode===o&&o.removeChild(s);let i=new Is(e,`Link`,0);a(i),s.onerror=K,s.onload=K,(r=t.networkSubscribe)==null||r.emit(`network`,e,`Link`,`error`,i.message)},typeof t.timeout==`number`&&(l=window.setTimeout(()=>{var a;if(l=null,c===!0)return;c=!0,i(),s.onerror=K,s.onload=K;let o=G(),u={origin:r,source:e,requestTime:n,responseTime:o,costs:o-n,headers:{}};(a=t.networkSubscribe)==null||a.emit(`network`,e,`Link`,`timeout`,JSON.stringify(u))},t.timeout)),s.rel=s.relList&&s.relList.supports(`prefetch`)?`prefetch`:`preload`,s.as=`fetch`,s.crossOrigin=``,s.fetchPriority=`high`,s.href=e,o&&o.appendChild(s)}))}function Gs(e,t={},n=K,r=K,i=K,a){let o=G(),s=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>Ps&&/^http\:/.test(e)?(console.warn(`The page at '${Ns}' was loaded over HTTPS, but requested an insecure element '${e}'. This request was automatically upgraded to HTTPS`),e.replace(/^http\:/,`https:`)):e).catch(n=>{var r;let i=new Fs(s,`Image`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`forbidden`,i.message),Promise.reject(i)}).then(e=>Bs(e)?Hs(e,{responseType:`blob`,networkSubscribe:t.networkSubscribe}).then(e=>URL.createObjectURL(e.body)):e).then(e=>new Promise((c,l)=>{let u=a==null?new Image:a,d=!1,f=null;typeof t.timeout==`number`&&(f=window.setTimeout(()=>{var n;if(u.onload=K,u.onerror=K,f=null,d===!0)return;d=!0;let i=new Ls(e,`Image`,t.timeout);r(i),l(i),(n=t.networkSubscribe)==null||n.emit(`network`,e,`Image`,`timeout`,i.message)},t.timeout)),u.onload=()=>{var r;if(u.onload=K,u.onerror=K,f!==null&&(clearTimeout(f),f=null),d===!0)return;let a=G(),l={headers:{},origin:s,source:e,requestTime:o,responseTime:a,costs:a-o};d=!0;let p={body:u,meta:l};i(1),n(p),c(p),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`ok`,JSON.stringify(p.meta))},u.onerror=()=>{var n;if(u.onload=K,u.onerror=K,f!==null&&(clearTimeout(f),f=null),d===!0)return;d=!0;let i=new Is(e,`Image`,0);r(i),l(i),(n=t.networkSubscribe)==null||n.emit(`network`,e,`Image`,`ok`,i.message)},i(0),u.src=e}))}var Ks=class{constructor(e={}){this.options=e}ajax(e,t={},n=K,r=K,i=K){var a;let o=this.options;return Hs(e,{responseType:t.responseType,timeout:(a=t.timeout)==null?o.timeout:a,get requestProxy(){var e;return(e=t.requestProxy)==null?o.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?o.networkSubscribe:e}},n,r,i)}loadImage(e,t={},n=K,r=K,i=K,a){var o;let s=this.options;return Gs(e,{timeout:(o=t.timeout)==null?s.timeout:o,get requestProxy(){var e;return(e=t.requestProxy)==null?s.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?s.networkSubscribe:e}},n,r,i,a)}preload(e,t={}){var n;let r=this.options;return Ws(e,{timeout:(n=t.timeout)==null?r.timeout:n,get requestProxy(){var e;return(e=t.requestProxy)==null?r.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?r.networkSubscribe:e}})}},qs=new Ks;function Js(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function Ys(e,t){let n={},r=new Set(t);for(let t of Object.keys(e))r.has(t)||(n[t]=e[t]);return n}function Xs(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}return t}var Zs=typeof document<`u`?document.createElement(`a`):{href:``};function Qs(e){return e.indexOf(`/`)===0||/^[0-9a-z]+\:/i.test(e)}function $s(e){if(typeof URL<`u`&&typeof location<`u`)return new URL(e,location.href).href;{Zs.href=e;let t=Zs.href;return Zs.href=``,t}}function ec(...e){let t=[];e=e.map(e=>(e==null?``:e).trim()).filter(e=>e.length>0&&!/^\/+$/.test(e));for(let n=0;n<e.length;n++){let r=n===0,i=n===e.length-1,a=e[n];r||(a=a.replace(/^\.\//,``).replace(/^\/+/,``)),i||(a=a.replace(/\/+$/,``)),t.push(a)}return t.join(`/`)}function tc(e,t=``){if((t[0]===`?`||t[0]===`&`)&&(t=t.slice(1)),!t)return e;let n=e.indexOf(`#`),r=``;return n>=0&&(r=e.slice(n),e=e.slice(0,n)),(e[e.length-1]===`?`||e[e.length-1]===`&`)&&(e=e.slice(0,-1)),e.indexOf(`?`)>=0?`${e}&${t}${r}`:`${e}?${t}${r}`}function nc(e){var t;let n=/^(http\:|https\:|file\:)?\/\/[^/]/.exec(e);if(!n)return e;let r=n[1]||``,i=e.slice(r.length+2),a=i.indexOf(`#`);a>=0&&(e.slice(a),i=e.slice(0,a));let o=i.indexOf(`?`);o>=0&&(e.slice(o),i=e.slice(0,o));let s=i.split(`/`),c=s.shift(),l=(t=s.pop())==null?``:t,u=[];for(let e of s)if(!(e===``||e===`.`)){if(e===`..`){u.pop();continue}u.push(e)}return r+`//`+c+`/`+u.join(`/`)+`/`+l}function rc(e){let t=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(e);if(t){let e=String(t[1]).trim().split(`.`).slice(1).reverse()[0];if(e)return`.`+e}return``}var ic=`data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAIAAUAmJaQAA3AA/vz0AAA=`,ac=`data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAGhbWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAsaWxvYwAAAABEAAACAAEAAAABAAAB3gAAABkAAgAAAAEAAAHJAAAAFQAAAEJpaW5mAAAAAAACAAAAGmluZmUCAAAAAAEAAGF2MDFDb2xvcgAAAAAaaW5mZQIAAAAAAgAAYXYwMUFscGhhAAAAABppcmVmAAAAAAAAAA5hdXhsAAIAAQABAAAA12lwcnAAAACxaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIAAoAAAAAUaXNwZQAAAAAAAAACAAAAAgAAAA5waXhpAAAAAAEIAAAADGF2MUOBABwAAAAAOGF1eEMAAAAAdXJuOm1wZWc6bXBlZ0I6Y2ljcDpzeXN0ZW1zOmF1eGlsaWFyeTphbHBoYQAAAAAeaXBtYQAAAAAAAAACAAEEAQKDBAACBAUGhwgAAAA2bWRhdBIACgQYADLVMgsWQBhhIAQqrNj/+BIACgUYADLEoDIOFkADDDDCQAACDaqCCb4=`,oc=`data:image/heif;base64,AAAAGGZ0eXBoZWljAAAAAG1pZjFoZWljAAABL21ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAHBpY3QAAAAAAAAAAAAAAAAAAAAADnBpdG0AAAAAAAEAAAAjaWluZgAAAAAAAQAAABVpbmZlAgAAAAABAABodmMxAAAAAK9pcHJwAAAAkmlwY28AAAB2aHZjQwEBYAAAAAAAAAAAAADwAPz9+PgAACcDoAABAB5AAQwG//8BYAAAAwAAAwAAAwAAAwAAAwAAreTLgSChAAEAI0IBBwFgAAADAAADAAADAAADAAADAAChInJJlreTLySZNdggogABAAdEAcA98DMkAAAAFGlzcGUAAAAAAAAAAgAAAAIAAAAVaXBtYQAAAAAAAAABAAECgQIAAAAiaWxvYwAAAABEQAABAAEAAAAAAU8AAQAAAAAAAAAOAAAAFm1kYXQAAAAKJgGvLvkQwuWM4A==`;function sc(e){return new Promise(t=>{if(typeof Image>`u`){t(!1);return}let n=new Image,r=setTimeout(()=>{n.onload=n.onerror=()=>{},clearTimeout(r),t(!1)},100);n.onload=n.onerror=()=>{n.onload=n.onerror=()=>{},clearTimeout(r),t(n.height===2)},n.src=e})}var cc=null;function lc(){return cc||(cc=Promise.all([sc(ic),sc(ac),sc(oc)]).then(e=>({webp:e[0],avif:e[1],heif:e[2]})))}var uc,dc=!1,fc=!1,pc=!1;lc().then(e=>{dc=e.avif,fc=e.webp,pc=e.heif});var mc=[`jpg`,`jpeg`,`png`,`heif`,`heic`,`webp`,`avif`];function hc(e){return mc.indexOf(e)>=0}var gc={"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`]}},_c=/^https?\:\/\/?([^\/]+)/;function vc(e){let t=e.match(_c);return t===null?null:t[1]}function yc(e,t,n){var r,i;let a=(i=(r=t[n])==null?t[t.length-1]:r)==null?e:i;return e.replace(_c,(e,t)=>e.slice(0,e.length-t.length)+a)}function bc(e,t,n){let[r,...i]=t.split(`.`);if(r===`texture`)return yc(e,n.texture,0);if(r===`pano`){let[t,r]=i;switch(r){case`front`:case`left`:case`up`:return yc(e,n.pano,0);case`down`:case`right`:case`back`:return yc(e,n.pano,1);default:break}}else if(r===`pano_tile`){let[t,r,a,o,s]=i,c=Math.pow(2,Number(a))*Number(o)+Number(s);if(!isNaN(c))return yc(e,n.tile,c%2)}else if(r===`model`){let[t]=i,r=Number(t);if(!isNaN(r))return yc(e,n.model,r%2)}return yc(e,n.default,0)}var xc=(e,t)=>{let n=e.split(`?`)[0],r=n.split(`.`).pop();if(r===`jpeg`&&(r=`jpg`),r===`heif`&&(r=`heic`),r&&!hc(r))return e;let i=[],{format:a,cut:o,quality:s,size:c,sharpen:l,forceUseExifOrientation:u}=t;if(a===`jpeg`&&(a=`jpg`),a===`heif`&&(a=`heic`),(!dc&&(a==null?r:a)===`avif`||!fc&&(a==null?r:a)===`webp`||!pc&&(a==null?r:a)===`heic`)&&(a=`jpg`),a!==void 0&&a!==r&&i.push(`format/${a}`),o!==void 0&&i.push(`cut/${o[2]}x${o[3]}x${o[0]}x${o[1]}`),s!==void 0){let e=a==null?r:a;e&&[`jpg`,`webp`,`heic`,`avif`].indexOf(e)>=0&&i.push(`quality/${s}`)}if(c!==void 0){let t=e.match(/\/cube_(\d+)\//);(t?Number(t[1]):NaN)!==Number(c)&&i.push(`thumbnail/${c}x`)}l!==void 0&&i.push(`sharpen/${l}`),u===!0&&i.push(`auto-orient`);let d=``;return i.length&&(d=`?imageMogr2/`+i.join(`/`)),n+d},Sc=(e,t)=>{let n=e.split(`?`)[0],r=n.split(`.`).pop();if(r===`jpeg`&&(r=`jpg`),r===`heif`&&(r=`heic`),r&&!hc(r))return e;let i=[],{format:a,cut:o,quality:s,size:c,sharpen:l}=t;if(a===`jpeg`&&(a=`jpg`),a===`heif`&&(a=`heic`),(!dc&&(a==null?r:a)===`avif`||!fc&&(a==null?r:a)===`webp`||!pc&&(a==null?r:a)===`heic`)&&(a=`jpg`),a!==void 0&&a!==r&&i.push(`format,${a}`),o!==void 0){let[e,t,n,r]=o;i.push(`crop,x_${e},y_${t},w_${n},h_${r},g_nw`)}if(s!==void 0&&s!==100){let e=a==null?r:a;e&&[`jpg`,`webp`,`heic`,`avif`].indexOf(e)>=0&&i.push(`quality,Q_${s}`)}c&&c!==2048&&i.push(`resize,w_${c}`),l!==void 0&&i.push(`sharpen,${l}`);let u=``;return i.length&&(u=`?x-oss-process=image/`+i.join(`/`)),n+u},Cc=9007199254740991;function wc(e){let t=Math.round(e);return Math.abs(t-e)<.001?t:Math.floor(e)}function Tc(e){return e=Object.assign({},e),e.size!==void 0&&(e.size=wc(H(e.size,0,Cc))),e.quality!==void 0&&(e.quality=wc(H(e.quality,0,100))),e.cut!==void 0&&(e.cut=[wc(H(e.cut[0],0,Cc)),wc(H(e.cut[1],0,Cc)),wc(H(e.cut[2],0,Cc)),wc(H(e.cut[3],0,Cc))]),e.sharpen!==void 0&&(e.sharpen=wc(H(e.sharpen,0,Cc))),e}function Ec(e,t){let n=Object.assign(Object.assign({},gc),t.mappings),r=vc(e);if(r===null)return e;t=Tc(t);let i=n[r];return i?(e=bc(e,t.key,i),/\.basis(\?|$)/.test(e)&&(e=e.replace(/\.basis(\?|$)/,`.jpg$1`)),i.type===`tencentCloud`?xc(e,t):i.type===`aliyun`?Sc(e,t):e):e}function Dc(e,t=Ec,n){let r=t(e,n);if(r===e&&n.cut)throw Error(`ImageURL: cut option not applied.`);return r}var Oc=/\/cube_(\d+)\//;function kc(e){let t=e.match(Oc);return t?Number(t[1]):null}function Ac(e,t){return e.replace(Oc,`/cube_${t}/`)}var jc=(uc=Math.log2)==null?(e=>Math.log(e)*Math.LOG2E):uc;function Mc(e){return Math.floor(Math.max(jc(e/512),0))}var Nc=(()=>{let e=G();return{requestAnimationFrame(t){let n=G(),r=H(16+(n-e),16,33),i=setTimeout(function(){t(xi(n+r))},r);return e=n+r,i},cancelAnimationFrame:e=>clearTimeout(e)}})(),Pc=typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`?{requestAnimationFrame:e=>requestAnimationFrame(e),cancelAnimationFrame:e=>cancelAnimationFrame(e)}:Nc,Fc=5,Ic=16,Lc=class e{static get shared(){return this.sharedInstance||(this.sharedInstance=new e),this.sharedInstance}static getFrameTime(){return Ic}constructor(){this.loopType=`raf`,this.frames=[],this.isAnimating=!1,this.context=null;let e=G();this.loop=(...t)=>{if(this.isAnimating===!1)return;let n=G(),r=Math.max(n-e,0);e=n,Ic=r;let i=this.frames.slice();for(let e=0;e<i.length;e++){let a=i[e];if(a.delay>0){--a.delay;continue}try{a.callback(n,r,...t)}catch(e){console.error(e)}a.calls++}for(let e=this.frames.length-1;e>=0;e--){let t=this.frames[e];t.once&&t.calls>0&&this.frames.splice(e,1)}this.requestId=this.requestAnimationFrame(this.loop)},this.start()}start(){this.isAnimating!==!0&&(this.isAnimating=!0,this.requestId=this.requestAnimationFrame(this.loop))}stop(){this.isAnimating=!1,this.cancelAnimationFrame(this.requestId)}setContext(e){e!==this.context&&(this.stop(),this.context=e,this.start())}getContext(){return this.context}setLoopType(e){e!==this.loopType&&(this.stop(),this.loopType=e,this.start())}getLoopType(){return this.loopType}requestAnimationFrame(e){let t;if(this.context?t=this.context:this.loopType===`raf`?t=Pc:this.loopType===`sto`&&(t=Nc),t)return t.requestAnimationFrame(e)}cancelAnimationFrame(e){let t;this.context?t=this.context:this.loopType===`raf`?t=Pc:this.loopType===`sto`&&(t=Nc),t&&t.cancelAnimationFrame(e)}remove(e){let t=this.frames.indexOf(e);t>=0&&this.frames.splice(t,1)}add(e,t=!1,n=0,r=Fc){let i={callback:e,once:t,delay:n,order:r,calls:0},a=this.frames.length;for(;--a>=0;)if(this.frames[a].order<=r){this.frames.splice(a+1,0,i);break}return a<0&&this.frames.unshift(i),()=>this.remove(i)}clear(){this.frames.length=0}},Rc=typeof createImageBitmap<`u`&&typeof ImageBitmap<`u`,zc=!1;function Bc(e){zc=e}function Vc(){return zc===!1?!1:Rc}function Hc(e={}){let t=e.onClose;return Object.assign(document.createElementNS(`http://www.w3.org/1999/xhtml`,`img`),{crossOrigin:``,close(){t&&t.call(this),this.onerror=this.onload=this.close=K,this.removeAttribute(`src`),t=void 0}})}function Uc(e){if(Vc())return createImageBitmap(e);{let t=URL.createObjectURL(e),n=function(){this.src===t&&URL.revokeObjectURL(t)};return new Promise((e,r)=>{let i=Hc({onClose:n});i.onload=()=>{i.src===t&&URL.revokeObjectURL(t),i.onload=i.onerror=K,Lc.shared.add(()=>{e(i)},!0)},i.onerror=()=>{let e=i.src;i.onload=i.onerror=K,i.close(),r(Error(`image load error: ${e}`))},i.decoding=`async`,i.src=t})}}var Wc=[];function Gc(e,t){let n=Wc.pop();if(n)return n.width=e,n.height=t,n;let r=Object.assign(document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`),{close:()=>{r.close=K,Wc.push(r)}});return r}function Kc(e,t){if(t&&(e.width>t.width||e.height>t.height)){let n=Gc(Math.min(e.width,t.width),Math.min(e.height,t.height)),r=n.getContext(`2d`);r.clearRect(0,0,n.width,n.height),r.drawImage(e,0,0,n.width,n.height),e.close();let i=new c.Texture(n);i.needsUpdate=!0,i.flipY=!0;let a=i.dispose;return i.dispose=function(){n.close(),a.call(i),i.dispose=a},i}else{let t=new c.Texture(e);t.needsUpdate=!0,typeof ImageBitmap<`u`&&e instanceof ImageBitmap?t.flipY=!1:t.flipY=!0,t.flipY===!1&&(t.repeat.y*=-1,t.offset.y+=1,t.updateMatrix());let n=t.dispose;return t.dispose=function(){this.image&&this.image.close(),n.call(t),t.dispose=n},t}}function qc(e){let t=new c.CubeTexture(e);t.needsUpdate=!0,t.flipY=!1;let n=t.dispose;return t.dispose=function(){if(Array.isArray(this.images))for(let e of this.images)e.close();n.call(t),t.dispose=n},t}var Jc=[`right`,`left`,`up`,`down`,`front`,`back`],Yc=class{loadTexture(e,t,n=K,r=K,i=K,a){var o,s,l,u,d,f,p;let m={};if(t.flipY!==void 0&&(m.flipY=t.flipY),t.format!==void 0)m.format=t.format;else{let t=rc(e);(t===`.jpg`||t===`.jpeg`)&&(m.format=c.RGBAFormat)}t.colorSpace!==void 0&&(m.colorSpace=t.colorSpace),m.generateMipmaps=(o=t.generateMipmaps)==null?!1:o,m.minFilter=(s=t.minFilter)==null?c.LinearFilter:s,m.magFilter=(l=t.magFilter)==null?c.LinearFilter:l,t.wrapS&&(m.wrapS=t.wrapS),t.wrapT&&(m.wrapT=t.wrapT);let h=(d=(u=t.imageURL)==null?void 0:u.options)==null?{key:`unknown`}:d;if(e=Dc(e,(f=t.imageURL)==null?void 0:f.transform,h),(p=t.viaAjax)==null?Vc:p)return t.fetcher.ajax(e,{timeout:t.timeout,responseType:`blob`},void 0,void 0,i).then(e=>Uc(e.body)).then(e=>Kc(e,t.maxSize)).then(e=>(Object.assign(e,m),e)).then(e=>{let t={meta:null,body:e};return n(t),t}).catch(e=>(r(e),Promise.reject(e)));{let a=null,o;return Promise.resolve().then(()=>Hc()).then(n=>(o=n,t.fetcher.loadImage(e,{timeout:t.timeout},void 0,void 0,i,n))).then(e=>(a=e.meta,Kc(e.body,t.maxSize))).then(e=>(Object.assign(e,m),e)).then(e=>{let t={meta:a,body:e};return n(t),t}).catch(e=>(o&&o.close(),r(e),Promise.reject(e)))}}loadCubeTexture(e,t,n=K,r=K,i=K,a){var o,s,l,u,d,f,p;let m={};if(t.format!==void 0)m.format=t.format;else{let t=!0;for(let n of Jc){let r=rc(e[n]);if(r!==`.jpg`&&r!==`.jpeg`){t=!1;break}}t&&(m.format=c.RGBAFormat)}m.generateMipmaps=(o=t.generateMipmaps)==null?!1:o,m.minFilter=(s=t.minFilter)==null?c.LinearFilter:s,m.magFilter=(l=t.magFilter)==null?c.LinearFilter:l,t.wrapS&&(m.wrapS=t.wrapS),t.wrapT&&(m.wrapT=t.wrapT);let h=[e[Jc[0]],e[Jc[1]],e[Jc[2]],e[Jc[3]],e[Jc[4]],e[Jc[5]]],g=[],_=[0,0,0,0,0,0],v=[];for(let e=0;e<6;e++){let n=(d=(u=t.imageURL)==null?void 0:u.options)==null?{key:`unknown`}:d,r=Dc(h[e],(f=t.imageURL)==null?void 0:f.transform,Object.assign(Object.assign({},n),{key:n.key+`.`+Jc[e]})),a=t=>{_[e]=t,i(_.reduce((e,t)=>e+t,0)/6)};if((p=t.viaAjax)!=null&&p){let n=t.fetcher.ajax(r,{timeout:t.timeout,responseType:`blob`},void 0,void 0,a).then(t=>(v[e]=t.meta,Uc(t.body)));g.push(n)}else{let n,i=Promise.resolve().then(()=>Hc()).then(e=>(n=e,t.fetcher.loadImage(r,{timeout:t.timeout},void 0,void 0,a,e))).then(t=>(v[e]=t.meta,t.body)).catch(e=>(n&&n.close(),Promise.reject(e)));g.push(i)}}return Promise.all(g).then(e=>qc(e)).then(e=>(Object.assign(e,Object.assign({colorSpace:c.SRGBColorSpace},m)),e)).then(e=>{let t={body:e,meta:v};return n(t),t}).catch(e=>{for(let e of g)e.then(e=>e.close()).catch(K);return r(e),Promise.reject(e)})}},Xc=l.Reader,Zc=l.util,Qc=l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto`]||(l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/pbm.proto`]={}),$c=Qc.Model=(()=>{function e(e){if(this.chunks=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.chunks=Zc.emptyArray,e.prototype.createAt=Zc.Long?Zc.Long.fromBits(0,0,!0):0,e.prototype.description=``,e.decode=function(e,t,n){e instanceof Xc||(e=Xc.create(e));let r=t===void 0?e.len:e.pos+t,i=new Qc.Model;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.chunks&&i.chunks.length||(i.chunks=[]),i.chunks.push(Qc.Chunk.decode(e,e.uint32()));break;case 2:i.createAt=e.uint64();break;case 3:i.description=e.string();break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Model`},e})();Qc.Chunk=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.vertices=null,e.prototype.faces=null,e.prototype.name=``,e.prototype.texture=``,e.decode=function(e,t,n){e instanceof Xc||(e=Xc.create(e));let r=t===void 0?e.len:e.pos+t,i=new Qc.Chunk;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.vertices=Qc.Vertices.decode(e,e.uint32());break;case 2:i.faces=Qc.Faces.decode(e,e.uint32());break;case 3:i.name=e.string();break;case 4:i.texture=e.string();break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`vertices`))throw Zc.ProtocolError(`missing required 'vertices'`,{instance:i});if(!i.hasOwnProperty(`faces`))throw Zc.ProtocolError(`missing required 'faces'`,{instance:i});if(!i.hasOwnProperty(`name`))throw Zc.ProtocolError(`missing required 'name'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Chunk`},e})(),Qc.Vertices=(()=>{function e(e){if(this.xyz=[],this.uvs=[],this.marks=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.xyz=Zc.emptyArray,e.prototype.uvs=Zc.emptyArray,e.prototype.marks=Zc.emptyArray,e.decode=function(e,t,n){e instanceof Xc||(e=Xc.create(e));let r=t===void 0?e.len:e.pos+t,i=new Qc.Vertices;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.xyz&&i.xyz.length||(i.xyz=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.xyz.push(e.float())}else i.xyz.push(e.float());break;case 2:if(i.uvs&&i.uvs.length||(i.uvs=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.uvs.push(e.float())}else i.uvs.push(e.float());break;case 3:if(i.marks&&i.marks.length||(i.marks=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.marks.push(e.int32())}else i.marks.push(e.int32());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Vertices`},e})(),Qc.Faces=(()=>{function e(e){if(this.indices=[],this.normals=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.indices=Zc.emptyArray,e.prototype.normals=Zc.emptyArray,e.decode=function(e,t,n){e instanceof Xc||(e=Xc.create(e));let r=t===void 0?e.len:e.pos+t,i=new Qc.Faces;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.indices&&i.indices.length||(i.indices=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.indices.push(e.uint32())}else i.indices.push(e.uint32());break;case 2:if(i.normals&&i.normals.length||(i.normals=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.normals.push(e.float())}else i.normals.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Faces`},e})(),Qc.VertexMark=(()=>{let e={},t=Object.create(e);return t[e[0]=`VERTEX_MARK_UNSPECIFIED`]=0,t[e[1]=`VERTEX_MARK_ROOF`]=1,t})();function el(e){return isNaN(e)||!isFinite(e)?0:e}function tl(e){let t=0;if(e instanceof u.BufferGeometry){for(let n in e.attributes){let r=e.getAttribute(n),i=4;`BYTES_PER_ELEMENT`in r.array&&typeof r.array.BYTES_PER_ELEMENT==`number`&&(i=r.array.BYTES_PER_ELEMENT),t+=el(r.count*r.itemSize*i)}let n=e.getIndex();if(n){let e=4;`BYTES_PER_ELEMENT`in n.array&&typeof n.array.BYTES_PER_ELEMENT==`number`&&(e=n.array.BYTES_PER_ELEMENT),t+=el(n.count*n.itemSize*e)}}return t}function nl(e){let t=[e.positions,e.colors,e.normals],n=0;for(let e of t){if(!e)continue;let t=4;`BYTES_PER_ELEMENT`in e&&typeof e.BYTES_PER_ELEMENT==`number`&&(t=e.BYTES_PER_ELEMENT);let r=e.length*t;isNaN(r)||!isFinite(r)||(n+=r)}return n}function rl(e){let t=[e.positions,e.rotations,e.scales,e.colors,e.sh1,e.sh2,e.sh3],n=0;for(let e of t){if(!e)continue;let t=4;`BYTES_PER_ELEMENT`in e&&typeof e.BYTES_PER_ELEMENT==`number`&&(t=e.BYTES_PER_ELEMENT);let r=e.length*t;isNaN(r)||!isFinite(r)||(n+=r)}return n}function il(e,t,n){return function(r,i,a){return((r+e-1)/e|0)*((i+t-1)/t|0)*n*a}}function al(e,t,n){return function(r,i,a){return(Math.max(r,e)*Math.max(i,t)/n|0)*a}}var ol=new Map([[u.RGB_S3TC_DXT1_Format,il(4,4,8)],[u.RGBA_S3TC_DXT1_Format,il(4,4,8)],[u.RGBA_S3TC_DXT3_Format,il(4,4,16)],[u.RGBA_S3TC_DXT5_Format,il(4,4,16)],[u.RGB_ETC1_Format,il(4,4,8)],[u.RGB_PVRTC_4BPPV1_Format,al(8,8,2)],[u.RGBA_PVRTC_4BPPV1_Format,al(8,8,2)],[u.RGB_PVRTC_2BPPV1_Format,al(16,8,4)],[u.RGBA_PVRTC_2BPPV1_Format,al(16,8,4)],[u.RGB_ETC2_Format,il(4,4,8)],[u.RGBA_ETC2_EAC_Format,il(4,4,16)],[u.RGBA_ASTC_4x4_Format,il(4,4,16)],[u.RGBA_ASTC_5x4_Format,il(5,4,16)],[u.RGBA_ASTC_5x5_Format,il(5,5,16)],[u.RGBA_ASTC_6x5_Format,il(6,5,16)],[u.RGBA_ASTC_6x6_Format,il(6,6,16)],[u.RGBA_ASTC_8x5_Format,il(8,5,16)],[u.RGBA_ASTC_8x6_Format,il(8,6,16)],[u.RGBA_ASTC_8x8_Format,il(8,8,16)],[u.RGBA_ASTC_10x5_Format,il(10,5,16)],[u.RGBA_ASTC_10x6_Format,il(10,6,16)],[u.RGBA_ASTC_10x8_Format,il(10,8,16)],[u.RGBA_ASTC_10x10_Format,il(10,10,16)],[u.RGBA_ASTC_12x10_Format,il(12,10,16)],[u.RGBA_ASTC_12x12_Format,il(12,12,16)],[u.RGBA_BPTC_Format,il(4,4,16)]]);function sl(e){let t=0,n=1;(e.generateMipmaps===!0||e.mipmaps&&e.mipmaps.length>1)&&(n=1.33);let r=e instanceof u.CompressedTexture?ol.get(e.format):void 0,i=[].concat(e.image);for(let e of i)if(e)if(e instanceof u.Texture)t+=sl(e);else{let{width:i=1,height:a=1,depth:o=1}=e;r?t+=el(r(i,a,o)*n):t+=el(i*a*o*4*n)}return t}var cl=new Set,ll=`map.alphaMap.bumpMap.normalMap.displacementMap.emissiveMap.specularMap.envMap.flipEnvMap.lightMap.aoMap.gradientMap.metalnessMap.roughnessMap.sheenColorMap.sheenRoughnessMap.clearcoatMap.clearcoatRoughnessMap.clearcoatNormalMap.iridescenceMap.iridescenceThicknessMap.transmissionMap.thicknessMap.anisotropyMap.specularColorMap.specularIntensityMap`.split(`.`);function ul(e){let t=0;if(cl.clear(),e instanceof u.ShaderMaterial)for(let n in e.uniforms){let r=e.uniforms[n],i=r&&r.value&&r.value instanceof u.Texture?r.value:void 0;i instanceof u.Texture&&(cl.has(i)||(t=sl(i),cl.add(i)))}else for(let n of ll){let r=e[n];r instanceof u.Texture&&(cl.has(r)||(t=sl(r),cl.add(r)))}return cl.clear(),t}var dl=new Set;function fl(e){let t=0;return dl.clear(),e.traverse(e=>{if(e instanceof At){t+=rl(e);return}if(e instanceof nn){t+=nl(e);return}if(e instanceof u.Mesh||e instanceof u.Line||e instanceof u.Points){let n=e.geometry;n instanceof u.BufferGeometry&&(dl.has(n)||(t+=tl(n),dl.add(n)));let r=[].concat(e.material);for(let e of r)e instanceof u.Material&&(dl.has(e)||(t+=ul(e),dl.add(e)))}}),dl.clear(),t}function pl(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t+1).replace(/\/(model)(\/|$)/,(e,t,n)=>`/materials`+n):``}function ml(e,t={}){var n,r,i,a,o,s,l;let u=(n=t.upAxis)==null?`Z`:n,d=(r=t.light)==null?!1:r,f=(i=t.fetcher)==null?qs:i,p=(a=t.onDownloadProgress)==null?K:a,m=(o=t.textureBaseUri)==null?pl(e):o,h=t.textureBaseUri===void 0?[]:((s=t.textureArray)==null?[]:s).slice(),g=Sl((l=t.textureOptions)==null?{}:l,h.length),_=new Map;for(let e of h){let t=Qs(e)?e:ec(m,e);_.set(t,bl(t,g,f))}let v={byteLength:0};return Promise.resolve().then(()=>f.ajax(e,{responseType:`arraybuffer`},void 0,void 0,p)).then(e=>{v.byteLength=e.body.byteLength;let t=new Uint8Array(e.body);return $c.decode(t)}).then(e=>xl(e,d,m,h,g,_,f)).then(t=>{_.clear();let n=new c.Group;n.name=e;for(let e of t.objects)n.add(e);return u===`Y`&&n.applyMatrix4(js),{type:`pbm`,modelUpAxis:`Z`,upAxis:u,uri:e,byteLength:v.byteLength,memoryUsage:fl(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}function hl(e){let t=e.match(/(group|floor)-?(\d+)/);return t?parseInt(t[2],10):0}function gl(e){let t=e.match(/(chunk)-?(\d+)/);return t?parseInt(t[2],10):0}function _l(e){let t=e.match(/(sub)-?(\d+)/);return t?parseInt(t[2],10):0}function vl(e){let t=hl(e.name),n=gl(e.name),r=_l(e.name);return t*1e6+n*1e3+r}function yl(e){var t,n,r;let i=typeof e.createAt==`number`?e.createAt:0,a=(t=e.description)==null?``:t,o=[],s=!0,c=!0;for(let t of e.chunks)if(!t.vertices.marks||t.vertices.marks.length===0){c=!1;break}for(let t of e.chunks)if(!t.faces.normals||t.faces.normals.length===0){s=!1;break}let l=e.chunks.sort((e,t)=>vl(e)-vl(t)),u=[];for(let e of l){let t=hl(e.name);u[t]||(u[t]=[]),u[t].push(e)}for(let e=0;e<u.length;e++){let t=u[e];if(t)if(s){let r=0;for(let e=0;e<t.length;e++){let n=t[e];r+=n.faces.indices.length}let s=new Float32Array(r*3),l=new Float32Array(r*2),u=new Float32Array(r*3),d=c?new Float32Array(r):void 0,f=[],p=[1/0,1/0,1/0,-1/0,-1/0,-1/0],m=0;for(let e=0;e<t.length;e++){let r=[1/0,1/0,1/0,-1/0,-1/0,-1/0],i=t[e],a=i.vertices.xyz,o=i.vertices.uvs,c=i.faces.indices,h=i.faces.normals,g=i.vertices.marks,_=c.length;for(let e=0;e<_;e++){let t=c[e],n=s[m*3+e*3]=a[t*3],i=s[m*3+e*3+1]=a[t*3+1],f=s[m*3+e*3+2]=a[t*3+2];d&&(d[m+e]=g[t]),l[m*2+e*2]=o[t*2],l[m*2+e*2+1]=o[t*2+1];let p=Math.floor(e/3)*3;u[m*3+e*3]=h[p],u[m*3+e*3+1]=h[p+1],u[m*3+e*3+2]=h[p+2],n<r[0]&&(r[0]=n),i<r[1]&&(r[1]=i),f<r[2]&&(r[2]=f),n>r[3]&&(r[3]=n),i>r[4]&&(r[4]=i),f>r[5]&&(r[5]=f)}r[0]<p[0]&&(p[0]=r[0]),r[1]<p[1]&&(p[1]=r[1]),r[2]<p[2]&&(p[2]=r[2]),r[3]>p[3]&&(p[3]=r[3]),r[4]>p[4]&&(p[4]=r[4]),r[5]>p[5]&&(p[5]=r[5]),f.push({materialIndex:e,name:i.name,chunkName:gl(i.name),start:m,count:i.faces.indices.length,texture:(n=i.texture)==null?void 0:n}),m+=_}let h={createAt:i,description:a,vertices:s,uvs:l,normals:u,masks:d,indices:null,floorIndex:e,groups:f,extents:p};o.push(h)}else{let n=0,s=0;for(let e=0;e<t.length;e++){let r=t[e];s+=r.vertices.xyz.length/3,n+=r.faces.indices.length}let l=new Float32Array(s*3),u=new Float32Array(s*2),d=new Float32Array(s),f=new Uint32Array(n),p=c?new Float32Array(n):void 0,m=[],h=[1/0,1/0,1/0,-1/0,-1/0,-1/0],g=0,_=0;for(let n=0;n<t.length;n++){let i=[1/0,1/0,1/0,-1/0,-1/0,-1/0],a=t[n],o=a.vertices.xyz,s=a.vertices.marks,c=a.vertices.uvs,v=a.faces.indices,y=o.length/3,b=v.length;for(let t=0;t<y;t++){let n=l[_*3+t*3]=o[t*3],r=l[_*3+t*3+1]=o[t*3+1],a=l[_*3+t*3+2]=o[t*3+2];p&&(p[_+t]=s[t]),u[_*2+t*2]=c[t*2],u[_*2+t*2+1]=c[t*2+1],d[_+t]=e,n<i[0]&&(i[0]=n),r<i[1]&&(i[1]=r),a<i[2]&&(i[2]=a),n>i[3]&&(i[3]=n),r>i[4]&&(i[4]=r),a>i[5]&&(i[5]=a)}i[0]<h[0]&&(h[0]=i[0]),i[1]<h[1]&&(h[1]=i[1]),i[2]<h[2]&&(h[2]=i[2]),i[3]>h[3]&&(h[3]=i[3]),i[4]>h[4]&&(h[4]=i[4]),i[5]>h[5]&&(h[5]=i[5]);for(let e=0;e<b;e++)f[g+e]=_+v[e];m.push({materialIndex:n,name:a.name,chunkName:gl(a.name),start:g,count:a.faces.indices.length,texture:(r=a.texture)==null?void 0:r}),_+=y,g+=b}let v={createAt:i,description:a,vertices:l,uvs:u,normals:void 0,masks:p,indices:f,floorIndex:e,groups:m,extents:h};o.push(v)}}return o}function bl(e,t,n){let r=Object.assign({key:`texture.pbm`},Js(t,[`format`,`quality`,`size`,`sharpen`,`forceUseExifOrientation`,`mappings`]));return new Yc().loadTexture(e,{imageURL:{transform:t.transform,options:r},colorSpace:c.SRGBColorSpace,wrapS:c.ClampToEdgeWrapping,wrapT:c.ClampToEdgeWrapping,minFilter:c.LinearFilter,maxSize:typeof r.size==`number`?new c.Vector2(r.size,r.size):void 0,fetcher:n}).then(e=>{let t=e.body;return t.needsUpdate=!0,t})}function xl(e,t,n,r,i,a,o){let s=yl(e),l=0,u=``,d=[],f={},p=new Set,m=0;for(let{createAt:e,description:t,vertices:i,masks:a,uvs:o,normals:h,indices:g,floorIndex:_,groups:v,extents:y}of s){let s=new c.Box3;s.min.x=y[0],s.min.y=y[1],s.min.z=y[2],s.max.x=y[3],s.max.y=y[4],s.max.z=y[5];let b=new c.BufferGeometry;b.setAttribute(`position`,new c.BufferAttribute(i,3)),b.setAttribute(`uv`,new c.BufferAttribute(o,2)),h&&b.setAttribute(`normal`,new c.BufferAttribute(h,3)),a&&b.setAttribute(`_feature_id_rsmask`,new c.BufferAttribute(a,1)),g&&b.setIndex(new c.BufferAttribute(g,1)),b.boundingBox=s,b.boundingSphere=s.getBoundingSphere(new c.Sphere);for(let e of v)b.addGroup(e.start,e.count,e.materialIndex);p.add(b);let x=[];for(let e of v){let t;if(e.texture){if(t=e.texture,r.length>0&&r.indexOf(e.texture)===-1){for(let i of r)if((Qs(i)?i:ec(n,i)).slice(e.texture.length*-1)===e.texture){t=i;break}console.warn(`At3d/Pbm texture not matched. Use ends-guessing mode. ${e.texture} -> ${t}`)}Qs(t)||(t=ec(n,t))}let i=new Ar;i.floorIndex=_,b.attributes.normal===void 0&&(i.flatShading=!0),b.attributes._feature_id_rsmask,x.push(i),t?(m++,f[t]?f[t].push(i):f[t]=[i]):i.color=new c.Color(16777215),p.add(i)}let S=new Ot(b,x);S.name=`model_floor_`+_,S.userData.createAt=e,S.userData.description=t,S.matrix.compose(S.position,S.quaternion,S.scale),S.matrixAutoUpdate=!1,S.frustumCulled=!1,l=e,u=t,d.push(S)}i=Sl(i,m);let h=[];for(let e of Object.keys(f)){let t;a&&(t=a.get(e)),t||(t=bl(e,i,o),a&&a.set(e,t)),h.push(t.then(t=>{for(let n of f[e])n.map&&(p.delete(n.map),n.map.dispose()),n.map=t,p.add(t);return t}).catch(()=>{for(let t of f[e])t.map&&(p.delete(t.map),t.map.dispose()),t.map=null,t.color=new c.Color(16777215);return null}))}return Promise.all(h).then(e=>{let t=e.filter(e=>e instanceof c.Texture);return{createAt:l,description:u,objects:d,textures:t,dispose:()=>{p.forEach(e=>{e.dispose()}),p.clear()}}})}function Sl(e,t){return e=Object.assign({},e),e.autoResize!==!1&&(t>96?e.size=Math.min(e.size||1/0,100):t>48?e.size=Math.min(e.size||1/0,200):t>24?e.size=Math.min(e.size||1/0,400):t>22?e.size=Math.min(e.size||1/0,800):t>5&&(e.size=Math.min(e.size||1/0,1024))),e}function Cl(){var e={};return e.OutWindow=function(){this._windowSize=0},e.OutWindow.prototype.create=function(e){(!this._buffer||this._windowSize!==e)&&(this._buffer=[]),this._windowSize=e,this._pos=0,this._streamPos=0},e.OutWindow.prototype.flush=function(){var e=this._pos-this._streamPos;if(e!==0){for(;e--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},e.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},e.OutWindow.prototype.setStream=function(e){this.releaseStream(),this._stream=e},e.OutWindow.prototype.init=function(e){e||(this._streamPos=0,this._pos=0)},e.OutWindow.prototype.copyBlock=function(e,t){var n=this._pos-e-1;for(n<0&&(n+=this._windowSize);t--;)n>=this._windowSize&&(n=0),this._buffer[this._pos++]=this._buffer[n++],this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.putByte=function(e){this._buffer[this._pos++]=e,this._pos>=this._windowSize&&this.flush()},e.OutWindow.prototype.getByte=function(e){var t=this._pos-e-1;return t<0&&(t+=this._windowSize),this._buffer[t]},e.RangeDecoder=function(){},e.RangeDecoder.prototype.setStream=function(e){this._stream=e},e.RangeDecoder.prototype.releaseStream=function(){this._stream=null},e.RangeDecoder.prototype.init=function(){var e=5;for(this._code=0,this._range=-1;e--;)this._code=this._code<<8|this._stream.readByte()},e.RangeDecoder.prototype.decodeDirectBits=function(e){for(var t=0,n=e,r;n--;)this._range>>>=1,r=this._code-this._range>>>31,this._code-=this._range&r-1,t=t<<1|1-r,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return t},e.RangeDecoder.prototype.decodeBit=function(e,t){var n=e[t],r=(this._range>>>11)*n;return(this._code^2147483648)<(r^2147483648)?(this._range=r,e[t]+=2048-n>>>5,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=r,this._code-=r,e[t]-=n>>>5,this._range&4278190080||(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},e.initBitModels=function(e,t){for(;t--;)e[t]=1024},e.BitTreeDecoder=function(e){this._models=[],this._numBitLevels=e},e.BitTreeDecoder.prototype.init=function(){e.initBitModels(this._models,1<<this._numBitLevels)},e.BitTreeDecoder.prototype.decode=function(e){for(var t=1,n=this._numBitLevels;n--;)t=t<<1|e.decodeBit(this._models,t);return t-(1<<this._numBitLevels)},e.BitTreeDecoder.prototype.reverseDecode=function(e){for(var t=1,n=0,r=0,i;r<this._numBitLevels;++r)i=e.decodeBit(this._models,t),t=t<<1|i,n|=i<<r;return n},e.reverseDecode2=function(e,t,n,r){for(var i=1,a=0,o=0,s;o<r;++o)s=n.decodeBit(e,t+i),i=i<<1|s,a|=s<<o;return a},e.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new e.BitTreeDecoder(8),this._numPosStates=0},e.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new e.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new e.BitTreeDecoder(3)},e.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(e.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},e.LenDecoder.prototype.decode=function(e,t){return e.decodeBit(this._choice,0)===0?this._lowCoder[t].decode(e):e.decodeBit(this._choice,1)===0?8+this._midCoder[t].decode(e):16+this._highCoder.decode(e)},e.Decoder2=function(){this._decoders=[]},e.Decoder2.prototype.init=function(){e.initBitModels(this._decoders,768)},e.Decoder2.prototype.decodeNormal=function(e){var t=1;do t=t<<1|e.decodeBit(this._decoders,t);while(t<256);return t&255},e.Decoder2.prototype.decodeWithMatchByte=function(e,t){var n=1,r,i;do if(r=t>>7&1,t<<=1,i=e.decodeBit(this._decoders,(1+r<<8)+n),n=n<<1|i,r!==i){for(;n<256;)n=n<<1|e.decodeBit(this._decoders,n);break}while(n<256);return n&255},e.LiteralDecoder=function(){},e.LiteralDecoder.prototype.create=function(t,n){var r;if(!(this._coders&&this._numPrevBits===n&&this._numPosBits===t))for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=n,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=new e.Decoder2},e.LiteralDecoder.prototype.init=function(){for(var e=1<<this._numPrevBits+this._numPosBits;e--;)this._coders[e].init()},e.LiteralDecoder.prototype.getDecoder=function(e,t){return this._coders[((e&this._posMask)<<this._numPrevBits)+((t&255)>>>8-this._numPrevBits)]},e.Decoder=function(){this._outWindow=new e.OutWindow,this._rangeDecoder=new e.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new e.BitTreeDecoder(4),this._lenDecoder=new e.LenDecoder,this._repLenDecoder=new e.LenDecoder,this._literalDecoder=new e.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new e.BitTreeDecoder(6),this._posSlotDecoder[1]=new e.BitTreeDecoder(6),this._posSlotDecoder[2]=new e.BitTreeDecoder(6),this._posSlotDecoder[3]=new e.BitTreeDecoder(6)},e.Decoder.prototype.setDictionarySize=function(e){return e<0?!1:(this._dictionarySize!==e&&(this._dictionarySize=e,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},e.Decoder.prototype.setLcLpPb=function(e,t,n){var r=1<<n;return e>8||t>4||n>4?!1:(this._literalDecoder.create(t,e),this._lenDecoder.create(r),this._repLenDecoder.create(r),this._posStateMask=r-1,!0)},e.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),e.initBitModels(this._isMatchDecoders,192),e.initBitModels(this._isRep0LongDecoders,192),e.initBitModels(this._isRepDecoders,12),e.initBitModels(this._isRepG0Decoders,12),e.initBitModels(this._isRepG1Decoders,12),e.initBitModels(this._isRepG2Decoders,12),e.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},e.Decoder.prototype.decode=function(t,n,r){var i=0,a=0,o=0,s=0,c=0,l=0,u=0,d,f,p,m,h,g;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(n),this.init();r<0||l<r;)if(d=l&this._posStateMask,this._rangeDecoder.decodeBit(this._isMatchDecoders,(i<<4)+d)===0)f=this._literalDecoder.getDecoder(l++,u),u=i>=7?f.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(a)):f.decodeNormal(this._rangeDecoder),this._outWindow.putByte(u),i=i<4?0:i-(i<10?3:6);else{if(this._rangeDecoder.decodeBit(this._isRepDecoders,i)===1)p=0,this._rangeDecoder.decodeBit(this._isRepG0Decoders,i)===0?this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(i<<4)+d)===0&&(i=i<7?9:11,p=1):(this._rangeDecoder.decodeBit(this._isRepG1Decoders,i)===0?m=o:(this._rangeDecoder.decodeBit(this._isRepG2Decoders,i)===0?m=s:(m=c,c=s),s=o),o=a,a=m),p===0&&(p=2+this._repLenDecoder.decode(this._rangeDecoder,d),i=i<7?8:11);else if(c=s,s=o,o=a,p=2+this._lenDecoder.decode(this._rangeDecoder,d),i=i<7?7:10,h=this._posSlotDecoder[p<=5?p-2:3].decode(this._rangeDecoder),h>=4){if(g=(h>>1)-1,a=(2|h&1)<<g,h<14)a+=e.reverseDecode2(this._posDecoders,a-h-1,this._rangeDecoder,g);else if(a+=this._rangeDecoder.decodeDirectBits(g-4)<<4,a+=this._posAlignDecoder.reverseDecode(this._rangeDecoder),a<0){if(a===-1)break;return!1}}else a=h;if(a>=l||a>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(a,p),l+=p,u=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},e.Decoder.prototype.setDecoderProperties=function(e){var t,n,r,i,a;return e.size<5||(t=e.readByte(),n=t%9,t=~~(t/9),r=t%5,i=~~(t/5),!this.setLcLpPb(n,r,i))?!1:(a=e.readByte(),a|=e.readByte()<<8,a|=e.readByte()<<16,a+=e.readByte()*16777216,this.setDictionarySize(a))},e.decompress=function(t,n,r,i){var a=new e.Decoder;if(!a.setDecoderProperties(t))throw`Incorrect stream properties`;if(!a.decode(n,r,i))throw`Error in data stream`;return!0},e.decompressFile=function(t,n){var r=new e.Decoder,i;if(!r.setDecoderProperties(t))throw`Incorrect stream properties`;if(i=t.readByte(),i|=t.readByte()<<8,i|=t.readByte()<<16,i+=t.readByte()*16777216,t.readByte(),t.readByte(),t.readByte(),t.readByte(),!r.decode(t,n,i))throw`Error in data stream`;return!0},e}var wl=Cl();function Tl(){function e(e){let t=new Uint8Array(256);for(let e=0;e<64;e++)t[`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charCodeAt(e)]=e;let n=e.length*.75,r=e.length,i,a=0,o,s,c,l;e[e.length-1]===`=`&&(n--,e[e.length-2]===`=`&&n--);let u=new ArrayBuffer(n),d=new Uint8Array(u);for(i=0;i<r;i+=4)o=t[e.charCodeAt(i)],s=t[e.charCodeAt(i+1)],c=t[e.charCodeAt(i+2)],l=t[e.charCodeAt(i+3)],d[a++]=o<<2|s>>4,d[a++]=(s&15)<<4|c>>2,d[a++]=(c&3)<<6|l&63;return u}return e(`AGFzbQEAAAABSg1gAABgAX8Bf2ACf38Bf2AEf39/fwBgA39/fwBgAX8AYAJ/fwBgA39/fwF/YAR/f39/AX9gAn9/AGABfwF/YAABf2AEf39/fwF/AhsCA2VudgVhYm9ydAADA2VudgZtZW1vcnkCAAEDJiUBAQkKAgoKCwsLCwsAAgoBAgQKAQYFCAoFBQQEBwgCBwwCAQAABAQBcAABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwc9BgZtZW1vcnkCAAV0YWJsZQEABXJlc2V0AA0KbmV3VThBcnJheQAQCnVucGFja1NpemUAFAZkZWNvZGUAIwgBJAkHAQBBAAsBJQqAViVoAQN/IABBgICAgARLBEAACyMBIgEgAEEBIABBAUsbakEHakF4cSICPwAiA0EQdEsEQCADIAIgAWtB//8DakGAgHxxQRB2IgAgAyAAShtAAEEASARAIABAAEEASARAAAsLCyACJAEgAQsbAQF/QQFBICAAQQdqZ2t0EAEiASAANgIAIAELkQMBAX8gAUUEQA8LIABBADoAACAAIAFqQQFrQQA6AAAgAUECTQRADwsgAEEBakEAOgAAIABBAmpBADoAACAAIAFqIgJBAmtBADoAACACQQNrQQA6AAAgAUEGTQRADwsgAEEDakEAOgAAIAAgAWpBBGtBADoAACABQQhNBEAPC0EAIABrQQNxIgIgAGoiAEEANgIAIAEgAmtBfHEiASAAakEEa0EANgIAIAFBCE0EQA8LIABBBGpBADYCACAAQQhqQQA2AgAgACABaiICQQxrQQA2AgAgAkEIa0EANgIAIAFBGE0EQA8LIABBDGpBADYCACAAQRBqQQA2AgAgAEEUakEANgIAIABBGGpBADYCACAAIAFqIgJBHGtBADYCACACQRhrQQA2AgAgAkEUa0EANgIAIAJBEGtBADYCACAAQQRxQRhqIgIgAGohACABIAJrIQEDQCABQSBPBEAgAEIANwMAIABBCGpCADcDACAAQRBqQgA3AwAgAEEYakIANwMAIAFBIGshASAAQSBqIQAMAQsLC1EBA38gAEH+////AEsEQEEAQSBBLUEnEAAACyAAQQJ0IgMQAiECQQgQASIBQQA2AgAgAUEANgIEIAEgAjYCACABIAA2AgQgAkEIaiADEAMgAQtmAQF/IAFB/P///wFLBEBBAEHAAEEXQSIQAAALIAFBAXQiARACIgJBCGogARADIABFBEBBDBABIQALIABBADYCACAAQQA2AgQgAEEANgIIIAAgAjYCACAAQQA2AgQgACABNgIIIAALCgBBDBABIAAQBQsuAQF/QQgQASIBQQA2AgAgAUEANgIEIAEgADYCBCABQQEgASgCBHQQBjYCACABC6EBAQR/QRAQASIBQQA2AgAgAUEANgIEIAFBADYCCCABQQA2AgxBEBAEIQIDQCAAQRBIBEBBAxAHIQMgAigCACAAQQJ0aiADNgIIIABBAWohAAwBCwsgASACNgIEQRAQBCECQQAhAANAIABBEEgEQEEDEAchAyACKAIAIABBAnRqIAM2AgggAEEBaiEADAELCyABIAI2AgggAUEIEAc2AgwgAQs0AQF/QRQQASIAQQA2AgAgAEEAOgAEIABBADYCCCAAQQA2AgwgAEEANgIQIABBDTYCCCAAC0IBAX9BGRABIgBBADYCACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEANgIUIABBADoAGCAAQQA2AhAgAAu1AgEEf0HQABABIgBBADoAACAAQQA2AgQgAEEANgIIIABBADYCDCAAQQA2AhAgAEEAOgAUIABBADYCGCAAQQA2AhwgAEEANgIgIABBADYCJCAAQQA2AiggAEEANgIsIABBADYCMCAAQQA2AjQgAEEANgI4IABBADYCPCAAQQA2AkAgAEEANgJEIABBADYCSCAAQQA2AkxBBBAEIQIDQCABQQRIBEBBBhAHIQMgAigCACABQQJ0aiADNgIIIAFBAWohAQwBCwsgACACNgIkIABBBBAHNgIoIABB8wAQBjYCLCAAQcABEAY2AjAgAEEMEAY2AjQgAEEMEAY2AjggAEEMEAY2AjwgAEEMEAY2AkAgAEHAARAGNgJEIAAQCDYCSCAAEAg2AkwgABAJNgIEIAAQCjYCCCAACx8BAX9BCBABIgBBADYCACAAQQA2AgQgABALNgIAIAALCgAjACQBEAwkAwthAQF/IAFB+P///wNLBEBBAEHAAEEXQSIQAAALIAEQAiICQQhqIAEQAyAARQRAQQwQASEACyAAQQA2AgAgAEEANgIEIABBADYCCCAAIAI2AgAgAEEANgIEIAAgATYCCCAACwoAQQwQASAAEA4LBgAgABAPCyoAIAEgACgCCE8EQEEAQcAAQSdBPxAAAAsgACgCBCABIAAoAgBqai0ACAssACABIAAoAghPBEBBAEHAAEEyQT8QAAALIAAoAgQgASAAKAIAamogAjoACAtkAQJ/QQ0QDyECA0AgAUENSARAIAIgASAAIAEQEUH/AXEQEiABQQFqIQEMAQsLQQAhAEEAIQEDQCABQQhIBEAgAiABQQVqEBFB/wFxIAFBA3R0IAByIQAgAUEBaiEBDAELCyAACwYAIAAQEwsnACAAIAEQDzYCCCAAQQA2AgwgACABNgIUIABBADoAGCAAQQA2AgALJAAgACgCCCAAKAIYEBUgAEGABiAAKAIMIAAtABRqdBAGNgIgC5UBAQR/IAEhBSAAIgYoAgAhASAAKAIEIQcgACgCCEEBdiEEIAJBAEgEfyACIARqIgBBACAAQQBKGwUgAiIAIAQgACAESBsLIQIgA0EASAR/IAMgBGoiAEEAIABBAEobBSADIgAgBCAAIARIGwshAwNAIAIgA05FBEAgAkEBdCABaiAHaiAFOwEIIAJBAWohAgwBCwsgBgssAQF/AkACQAJAIwRBAWsOAwEBAgALAAtB/////wchAQsgAEGACEEAIAEQFwvBAQECfyAAQQIQBjYCACAAKAIAIgEoAgAgASgCBGpBgAg7AQggACgCACICKAIAIQEgAigCBCABQQJqakGACDsBCCAAKAIMKAIAQQEkBBAYGkEAIQIDQCACQRBIBEAgAiAAKAIEKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAiAAKAIIKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACygCAEEBJAQQGBogAkEBaiECDAELCwuHAgEFfyAAIQJBgAYgACgCDCAALQAUanQhAQNAIAMgAUgEQCACKAIgIgQoAgAhBSAEKAIEIANBAXQgBWpqQYAIOwEIIANBAWohAwwBCwsgAiEBQQAhAgNAIAJBBEkEQCACIAEoAiQoAgAiAygCAEECdkkEfyACQQJ0IANqKAIIBQALKAIAQQEkBBAYGiACQQFqIQIMAQsLIAEoAigoAgBBASQEEBgaIAEoAixBASQEEBgaIAAoAjBBASQEEBgaIAAoAjRBASQEEBgaIAAoAjhBASQEEBgaIAAoAjxBASQEEBgaIAAoAkBBASQEEBgaIAAoAkRBASQEEBgaIAAoAkgQGSAAKAJMEBkLyAwBA38DQCABQQNxIAIgAhsEQCAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAgAkEBayECDAELCyAAQQNxRQRAA0AgAkEQTwRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAEEIaiABQQhqKAIANgIAIABBDGogAUEMaigCADYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsgAkEIcQRAIAAgASgCADYCACAAQQRqIAFBBGooAgA2AgAgAUEIaiEBIABBCGohAAsgAkEEcQRAIAAgASgCADYCACABQQRqIQEgAEEEaiEACyACQQJxBEAgACABLwEAOwEAIAFBAmohASAAQQJqIQALIAJBAXEEQCAAIAEtAAA6AAALDwsgAkEgTwRAAkACQAJAIABBA3EiA0EBRwRAIANBAkYNASADQQNGDQIMAwsgASgCACEFIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAAIAJBA2shAgNAIAJBEU8EQCAAIAFBAWooAgAiA0EIdCAFQRh2cjYCACAAQQRqIAFBBWooAgAiBUEIdCADQRh2cjYCACAAQQhqIAFBCWooAgAiA0EIdCAFQRh2cjYCACAAQQxqIAFBDWooAgAiBUEIdCADQRh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsMAgsgASgCACEFIAAgAS0AADoAACAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAAgAkECayECA0AgAkESTwRAIAAgAUECaigCACIDQRB0IAVBEHZyNgIAIABBBGogAUEGaigCACIFQRB0IANBEHZyNgIAIABBCGogAUEKaigCACIDQRB0IAVBEHZyNgIAIABBDGogAUEOaigCACIFQRB0IANBEHZyNgIAIAFBEGohASAAQRBqIQAgAkEQayECDAELCwwBCyABKAIAIQUgACIEQQFqIQAgASIDQQFqIQEgBCADLQAAOgAAIAJBAWshAgNAIAJBE08EQCAAIAFBA2ooAgAiA0EYdCAFQQh2cjYCACAAQQRqIAFBB2ooAgAiBUEYdCADQQh2cjYCACAAQQhqIAFBC2ooAgAiA0EYdCAFQQh2cjYCACAAQQxqIAFBD2ooAgAiBUEYdCADQQh2cjYCACABQRBqIQEgAEEQaiEAIAJBEGshAgwBCwsLCyACQRBxBEAgACABIgMtAAA6AAAgAEEBaiIBIAEgA0EBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiBEEBaiEAIAFBAWoiA0EBaiEBIAQgAy0AADoAAAsgAkEIcQRAIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiAyADIAFBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgMgAyABQQFqIgEtAAA6AABBAWoiBEEBaiEAIAFBAWoiA0EBaiEBIAQgAy0AADoAAAsgAkEEcQRAIAAgASIDLQAAOgAAIABBAWoiASABIANBAWoiAS0AADoAAEEBaiIDIAMgAUEBaiIBLQAAOgAAQQFqIgRBAWohACABQQFqIgNBAWohASAEIAMtAAA6AAALIAJBAnEEQCAAIAEtAAA6AAAgAEEBaiIEQQFqIQAgAUEBaiIDQQFqIQEgBCADLQAAOgAACyACQQFxBEAgACABLQAAOgAACwvVAgECfyAAIAFGBEAPCyABIAJqIABNIgNFBEAgACACaiABTSEDCyADBEAgACABIAIQGw8LIAAgAUkEQCABQQdxIABBB3FGBEADQCAAQQdxBEAgAkUEQA8LIAJBAWshAiAAIgRBAWohACABIgNBAWohASAEIAMtAAA6AAAMAQsLA0AgAkEITwRAIAAgASkDADcDACACQQhrIQIgAEEIaiEAIAFBCGohAQwBCwsLA0AgAgRAIAAiBEEBaiEAIAEiA0EBaiEBIAQgAy0AADoAACACQQFrIQIMAQsLBSABQQdxIABBB3FGBEADQCAAIAJqQQdxBEAgAkUEQA8LIAJBAWsiAiAAaiABIAJqLQAAOgAADAELCwNAIAJBCE8EQCACQQhrIgIgAGogASACaikDADcDAAwBCwsLA0AgAgRAIAJBAWsiAiAAaiABIAJqLQAAOgAADAELCwsL4AoBCH8gACgCACIGIgQoAgAgBCgCBGovAQgiCCABIgcoAgxBC3ZsIQQgBygCECAESQR/QYAQIAhrQf//A3FBBXYgCGohCCAHIAQ2AgxBAAUgCCAIQf//A3FBBXZrIQggByAHKAIQIARrNgIQIAcgBygCDCAEazYCDEEBCyAGKAIEIAYoAgBqIAg7AQggByIFKAIMIwJJBEAgBSAFKAIMQQh0NgIMIAUoAhBBCHQhByAFKAIAIQYgBSAFKAIIIglBAWo2AgggBSAGIAkQEUH/AXEgB3I2AhALQf//A3FFBEAgAiAAKAIEKAIAIgAoAgBBAnZJBH8gAkECdCAAaigCCAUACyEDIAEhBEEBIQgDQCAKIAMoAgRJBEAgAygCACIHKAIAIQEgBCgCECAHKAIEIAgiBUEBdCIIIAFqai8BCCIGIAQoAgxBC3ZsIglJBH9BgBAgBmtB//8DcUEFdiAGaiEGIAQgCTYCDEEABSAGIAZB//8DcUEFdmshBiAEIAQoAhAgCWs2AhAgBCAEKAIMIAlrNgIMQQELIAcoAgQgBygCACAFQQF0amogBjsBCCAEKAIMIwJJBEAgBCAEKAIMQQh0NgIMIAQoAhBBCHQhACAEKAIAIQUgBCAEKAIIIgFBAWo2AgggBCAFIAEQEUH/AXEgAHI2AhALQf//A3EgCGohCCAKQQFqIQoMAQsLIAhBASADKAIEdGsPCyAAKAIAIgooAgAhCCAFKAIQIAooAgQgCEECamovAQgiBCABKAIMQQt2bCIDSQR/IAUgAzYCDEEAIQlBgBAgBGtB//8DcUEFdiAEagUgBSAFKAIQIANrNgIQIAUgBSgCDCADazYCDEEBIQkgBCAEQf//A3FBBXZrCyEEIAoiBygCBCAHKAIAQQJqaiAEOwEIIAUiBigCDCMCSQRAIAYgBigCDEEIdDYCDCAGKAIQQQh0IQUgBigCACEHIAYgBigCCCIIQQFqNgIIIAYgByAIEBFB/wFxIAVyNgIQCyAJQf//A3FFBEAgAiAAKAIIKAIAIgAoAgBBAnZJBH8gAkECdCAAaigCCAUACyEJIAEhA0EBIQRBACECA0AgAiAJKAIESQRAIAMoAhAgCSgCACIFKAIEIAQiBkEBdCIEIAUoAgBqai8BCCIHIAMoAgxBC3ZsIghJBH9BgBAgB2tB//8DcUEFdiAHaiEHIAMgCDYCDEEABSAHIAdB//8DcUEFdmshByADIAMoAhAgCGs2AhAgAyADKAIMIAhrNgIMQQELIAUoAgQgBSgCACAGQQF0amogBzsBCCADKAIMIwJJBEAgAyADKAIMQQh0NgIMIAMoAhBBCHQhBSADKAIAIQcgAyADKAIIIgZBAWo2AgggAyAHIAYQEUH/AXEgBXI2AhALQf//A3EgBGohBCACQQFqIQIMAQsLIARBASAJKAIEdGtBCGoPCyAAKAIMIQQgASEDQQEhCUEAIQIDQCACIAQoAgRJBEAgBCgCACIIKAIAIQogAygCECAIKAIEIAogCSIHQQF0IgFqai8BCCIFIAMoAgxBC3ZsIgZJBH8gAyAGNgIMQQAhBkGAECAFa0H//wNxQQV2IAVqBSADIAMoAhAgBms2AhAgAyADKAIMIAZrNgIMQQEhBiAFIAVB//8DcUEFdmsLIQUgCCgCBCAIKAIAIAdBAXRqaiAFOwEIIAMoAgwjAkkEQCADIAMoAgxBCHQ2AgwgAygCEEEIdCEAIAMoAgAhBSADIAMoAggiCkEBajYCCCADIAUgChARQf8BcSAAcjYCEAsgBkH//wNxIAFqIQkgAkEBaiECDAELCyAJQQEgBCgCBHRrQRBqC5YCAQh/QQEhBwNAAkAgBiABTg0AIAIoAhAgACgCBCAAKAIAIAMgB2oiCUEBdGpqLwEIIgQgAigCDEELdmwiBUkEfyACIAU2AgxBACEFQYAQIARrQf//A3FBBXYgBGoFIAIgAigCECAFazYCECACIAIoAgwgBWs2AgxBASEFIAQgBEH//wNxQQV2awshBCAAKAIEIAAoAgAgCUEBdGpqIAQ7AQggAiIEKAIMIwJJBEAgBCAEKAIMQQh0NgIMIAQoAhBBCHQhCiAEKAIAIQsgBCAEKAIIIglBAWo2AgggBCALIAkQEUH/AXEgCnI2AhALIAVB//8DcSIEIAdBAXRqIQcgBCAGdCAIciEIIAZBAWohBgwBCwsgCAvwBAEIf0EDIAEgAUEDSxsiAiAAKAIkKAIAIgEoAgBBAnZJBH8gAkECdCABaigCCAUACyEEIAAoAgQhAkEBIQEDQCAHIAQoAgRJBEAgBCgCACIFKAIAIQMgAigCECAFKAIEIAFBAXQiCSADamovAQgiAyACKAIMQQt2bCIGSQR/IAIgBjYCDEEAIQhBgBAgA2tB//8DcUEFdiADagUgAiACKAIQIAZrNgIQIAIgAigCDCAGazYCDEEBIQggAyADQf//A3FBBXZrCyEDIAUoAgQgBSgCACABQQF0amogAzsBCCACKAIMIwJJBEAgAiACKAIMQQh0NgIMIAIoAhBBCHQhBiACKAIAIQUgAiACKAIIIgNBAWo2AgggAiAFIAMQEUH/AXEgBnI2AhALIAhB//8DcSAJaiEBIAdBAWohBwwBCwsgAUEBIAQoAgR0ayIBQQRJBEAgAQ8LIAFBAXFBAnIgAUEBdkEBayICdCEDIAFBDkkEfyAAKAIsIAIgACgCBCADIAFrEB4gA2oFIAAoAgQhASACQQRrIQJBACEEA0AgASABKAIMQQF2NgIMIAEgASgCECABKAIMazYCECABIAEoAhBBACABKAIQQR92ayIHIAEoAgxxajYCECABKAIQIAEoAgxGBEAgAUEBOgAECyABKAIMIwJJBEAgASABKAIMQQh0NgIMIAEoAhBBCHQhBSABKAIAIQggASABKAIIIgZBAWo2AgggASAIIAYQEUH/AXEgBXI2AhALIAdBAWogBEEBdGohBCACQQFrIgINAAsgBEEEdCADaiAAKAIoIgQoAgAgBCgCBCAAKAIEQQAQHmoLC9AcAQ9/IAAQGiAAKAIEIgdBADoABCAHKAIAIAcgBygCCCIDQQFqNgIIIAMQEUH/AXEEQCAHQQE6AAQLIAdBfzYCDCAHQQA2AhBBACEDA0AgA0EESARAIAcoAhBBCHQhBSAHKAIAIQwgByAHKAIIIghBAWo2AgggByAMIAgQEUH/AXEgBXI2AhAgA0EBaiEDDAELCyAHKAIQIAcoAgxGBEAgB0EBOgAECyABBEAgACgCCCACEA82AgQFIAAoAghBBBAPNgIEC0EAIQwDQAJAIAJFIAEgARsiBwR/IAAtAABFBSAHCwRAIAAoAgQoAhBFBEBBAw8LCyAAKAIwIgUoAgAhByAFKAIEIAAoAggoAgBBASAAKAIQdEEBa3EiCyAMQQR0Qf8BcWoiBkEBdCAHamovAQghAyAGIQcgACgCBCIEKAIMQQt2IANsIQggBCgCECAISQR/IAQgCDYCDEEAIQlBgBAgA2tB//8DcUEFdiADagUgBCAEKAIQIAhrNgIQIAQgBCgCDCAIazYCDEEBIQkgAyADQf//A3FBBXZrCyEIIAUiAygCBCADKAIAIAdBAXRqaiAIOwEIIAQiBigCDCMCSQRAIAYgBigCDEEIdDYCDCAGKAIQQQh0IQggBigCACEDIAYgBigCCCIHQQFqNgIIIAYgAyAHEBFB/wFxIAhyNgIQCyAJQf//A3FFBEAgAkUgASABGw0BIAwhCEEAIQYgACgCCCIFKAIMRSIEBH8gBS0AGEUFIAQLRQRAIAAoAggiBSgCCCIGKAIEQQEgBSgCDEwEfyAFKAIMQQFrBSAFKAIMIAUoAhRBAWtqCyAGKAIAamotAAghBgtBASEEIAAoAggoAgBBASAALQAUdEEBa3EgACgCDHQgBkEIIAAoAgxrdmpBgAZsIQcgCEEHTwRAIAAoAggiBigCCCIJKAIEIA5BAWoiDSAGKAIMTAR/IAYoAgwgDWsFIAYoAgwgBigCFCANa2oLIAkoAgBqai0ACCENA0ACQCANQf8BcUEHdiEGIA1BAXQhDSAAKAIgIgkoAgAhCyAJKAIEIAZBAWpBCHQgB2ogBGoiDEEBdCALamovAQgiCyAAKAIEIgMoAgxBC3ZsIQogAygCECAKSQR/QYAQIAtrQf//A3FBBXYgC2ohCyADIAo2AgxBAAUgCyALQf//A3FBBXZrIQsgAyADKAIQIAprNgIQIAMgAygCDCAKazYCDEEBCyEFIAkoAgQgCSgCACAMQQF0amogCzsBCCADIgooAgwjAkkEQCAKIAooAgxBCHQ2AgwgCigCEEEIdCEDIAooAgAhDCAKIAooAggiC0EBajYCCCAKIAwgCxARQf8BcSADcjYCEAsgBEEBdCAFciEEIAVB//8DcSAGRw0AIARB//8DcUGAAkkNAQsLCwNAIARBgAJJBEAgBEEBdCEJIAAoAiAiBSgCACEMIAUoAgQgBCAHaiIGQQF0IAxqai8BCCILIAAoAgQiDSgCDEELdmwhCiANKAIQIApJBH9BgBAgC2tB//8DcUEFdiALaiELIA0gCjYCDEEABSALIAtB//8DcUEFdmshCyANIA0oAhAgCms2AhAgDSANKAIMIAprNgIMQQELIAUoAgQgBSgCACAGQQF0amogCzsBCCANIgooAgwjAkkEQCAKIAooAgxBCHQ2AgwgCigCEEEIdCEGIAooAgAhBSAKIAooAggiDEEBajYCCCAKIAUgDBARQf8BcSAGcjYCEAsgCXIhBAwBCwsgACgCCCIDIAMoAgBBAWo2AgAgAygCCCELIAMgAygCDCIGQQFqNgIMIAsoAgQgCygCACAGamogBEGAAmsiCjoACCADKAIMIAMoAhRGBEAgA0EANgIMIANBAToAGAsgAygCBCgCCCADKAIQRgRAIAMgAygCBCIGKAIIQQF0EA82AgQgAygCBCgCACADKAIEKAIEakEIaiAGKAIAIAYoAgRqQQhqIAYoAggQHCAGKAIAGgsgAygCBCEJIAMgAygCECIMQQFqNgIQIAkoAgQgCSgCACAMamogCjoACCAIIgVBBEkEf0EABSAFQQNrIAVBBmsgBUEKSRsLIQwgAkEBayECDAILIAAoAjQiBigCACEFIAYoAgQgDCIDQQF0IAVqai8BCCIHIAAoAgQiCigCDEELdmwhBCAKKAIQIARJBH9BgBAgB2tB//8DcUEFdiAHaiEHIAogBDYCDEEABSAHIAdB//8DcUEFdmshByAKIAooAhAgBGs2AhAgCiAKKAIMIARrNgIMQQELIAMhBSAGIgMoAgAhDSADKAIEIAVBAXQgDWpqIAc7AQggCiIJKAIMIwJJBEAgCSAJKAIMQQh0NgIMIAkoAhBBCHQhBiAJKAIAIQMgCSAJKAIIIgVBAWo2AgggCSADIAUQEUH/AXEgBnI2AhALQf//A3EEQCACRSABIAEbDQEgACgCCCIIKAIMRSIEBH8gCC0AGEUFIAQLDQEgACgCOCIDKAIAIQggAygCBCAMQQF0IAhqai8BCCIEIAAoAgQiBSgCDEELdmwhByAFKAIQIAdJBH9BgBAgBGtB//8DcUEFdiAEaiEEIAUgBzYCDEEABSAEIARB//8DcUEFdmshBCAFIAUoAhAgB2s2AhAgBSAFKAIMIAdrNgIMQQELIAMoAgQgAygCACAMQQF0amogBDsBCCAFIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEFIAkoAgAhAyAJIAkoAggiCEEBajYCCCAJIAMgCBARQf8BcSAFcjYCEAtB//8DcQRAIAAoAjwiCCgCACEHIAgoAgQgDEEBdCAHamovAQgiBCAAKAIEIgUoAgxBC3ZsIQYgBSgCECAGSQR/QYAQIARrQf//A3FBBXYgBGohBCAFIAY2AgxBAAUgBCAEQf//A3FBBXZrIQQgBSAFKAIQIAZrNgIQIAUgBSgCDCAGazYCDEEBCyAIIgMoAgQgAygCACAMQQF0amogBDsBCCAFIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEIIAkoAgAhAyAJIAkoAggiB0EBajYCCCAJIAMgBxARQf8BcSAIcjYCEAtB//8DcQRAIAAoAkAiAygCACEKIAMoAgQgDEEBdCAKamovAQgiBiAAKAIEIgcoAgxBC3ZsIQQgBygCECAESQR/QYAQIAZrQf//A3FBBXYgBmohBiAHIAQ2AgxBAAUgBiAGQf//A3FBBXZrIQYgByAHKAIQIARrNgIQIAcgBygCDCAEazYCDEEBCyADKAIEIAMoAgAgDEEBdGpqIAY7AQggByIJKAIMIwJJBEAgCSAJKAIMQQh0NgIMIAkoAhBBCHQhCCAJKAIAIQMgCSAJKAIIIgpBAWo2AgggCSADIAoQEUH/AXEgCHI2AhALQf//A3EEQCARIQMgDyERBSAPIQMLIBAhDwUgECEDCyAOIRAgAyEOBSAAKAJEIgYoAgAhCiAGKAIEIAxBBHRB/wFxIAtqIgNBAXQgCmpqLwEIIgcgACgCBCIIKAIMQQt2bCEEIAgoAhAgBEkEf0GAECAHa0H//wNxQQV2IAdqIQcgCCAENgIMQQAFIAcgB0H//wNxQQV2ayEHIAggCCgCECAEazYCECAIIAgoAgwgBGs2AgxBAQsgAyEKIAYiAygCACENIAMoAgQgCkEBdCANamogBzsBCCAIIgkoAgwjAkkEQCAJIAkoAgxBCHQ2AgwgCSgCEEEIdCEIIAkoAgAhAyAJIAkoAggiCkEBajYCCCAJIAMgChARQf8BcSAIcjYCEAtB//8DcUUEQEEJQQsgDEEHSRshDCAAKAIIIQQgACgCCCIFKAIIIgMoAgQgDkEBaiIHIAUoAgxMBH8gBSgCDCAHawUgBSgCDCAFKAIUIAdragsgAygCAGpqLQAIIQcgBCAEKAIAQQFqNgIAIAQoAgghBSAEIAQoAgwiBkEBajYCDCAFKAIEIAUoAgAgBmpqIAc6AAggBCgCDCAEKAIURgRAIARBADYCDCAEQQE6ABgLIAQoAgQoAgggBCgCEEYEQCAEIAQoAgQiBigCCEEBdBAPNgIEIAQoAgQoAgAgBCgCBCgCBGpBCGogBigCACAGKAIEakEIaiAGKAIIEBwgBigCABoLIAQoAgQhAyAEIAQoAhAiCEEBajYCECADKAIEIAMoAgAgCGpqIAc6AAggAkEBayECDAQLCyAAKAJMIAAoAgQgCxAdIQtBCEELIAxBB0kbIQwFIA8hESAQIQ8gDiEQQQdBCiAMQQdJGyEMIAAgACgCSCAAKAIEIAsQHSILEB8iDkF/RgRAIAAoAgQoAhAEf0EBBUECCw8LIAJFIAEgARsNASAOIAAoAhhPIgUEfyAFBSAOIAAoAggiBCgCDEwiBgR/IAYFIAQtABgLRQsNAQtBACENIAAoAgghBSAOQQFqIQQgAiALQQJqIgtIIAEgARsEQEEBIQ0gAiELCyALIQYDQCAGQQBKBEAgBSIIKAIIIgkoAgQgBCAFKAIMTAR/IAUoAgwgBGsFIAUoAgwgBSgCFCAEa2oLIAkoAgBqai0ACCEHIAggCCgCAEEBajYCACAIKAIIIQMgCCAIKAIMIgpBAWo2AgwgAygCBCADKAIAIApqaiAHOgAIIAgoAgwgCCgCFEYEQCAIQQA2AgwgCEEBOgAYCyAIKAIEKAIIIAgoAhBGBEAgCCAIKAIEIgMoAghBAXQQDzYCBCAIKAIEKAIAIAgoAgQoAgRqQQhqIAMoAgAgAygCBGpBCGogAygCCBAcIAMoAgAaCyAIKAIEIQkgCCAIKAIQIgNBAWo2AhAgCSgCBCAJKAIAIANqaiAHOgAIIAZBAWshBgwBCwsgAiALayECIA1FDQELC0EBCyYBAX9BEBABIgQgADYCACAEIAE2AgQgBCACNgIIIAQgAzYCDCAEC7YEAQZ/IAAgATYCBEENEA8hAgNAAkAgA0ENTg0AIAIgAyABIAMQEUH/AXEQEiADQQFqIQMMAQsLIAAoAgAhBCACIQZBBBAPIgIoAgQgAigCAGogBigCBCAGKAIAai0ACCIDOgAIIANB/wFxQeEBTwRAQQBBgAFBoQFBDBAAAAsgAigCBCACKAIAQQFqaiADQf8BcUEJcCIHOgAIIAIoAgQgAigCAGogA0H/AXFBCW4iAzoACCADQQVwIQUgAigCBCACKAIAQQJqaiADQQVuIgM6AAggAigCBCACKAIAQQNqaiAFOgAIIAQgBzYCDCAEIAM2AhAgBCAFOgAUIARBADYCHEEAIQIDQAJAIAJBBE8NACAEIAQoAhwgBigCBCAGKAIAIAJBAWpqai0ACCACQQN0dHI2AhwgAkEBaiECDAELCyAEIAQoAhw2AhggBCgCGEGAIEkEQCAEQYAgNgIYC0EAIQJBACEFQQAhAwNAAkAgA0EITg0AIAYgA0EFahARQf8BcSIEQf8BRwRAQQEhBQsgBCADQQN0dCACciECIANBAWohAwwBCwsgACgCACAFRToAACAAKAIAKAIEIAE2AgAgACgCABAWAkAgACgCACAFIAIQICIBQQFGDQAgAUEDRwRAIAFBAkYEQCAFBEAgACgCACgCCCgCECACRw0DCwUMAgsLIAAoAgAoAgQtAAQaQQFBACAAKAIAKAIIKAIQIAAoAgAoAggoAgQQIQ8LQQBBAUEAQQAQIQsIACMDIAAQIgsWAEG4ASQAIwAkAUGAgIAIJAIQDCQDCwMAAQsLtwEEAEEICxcKAAAAdQBzAGUAIABzAHQAcgBpAGMAdABBIAsdDQAAAH4AbABpAGIALwBhAHIAcgBhAHkALgB0AHMAQcAACzkbAAAAfgBsAGkAYgAvAGkAbgB0AGUAcgBuAGEAbAAvAHQAeQBwAGUAZABhAHIAcgBhAHkALgB0AHMAQYABCzMYAAAAcwByAGMALwBsAHoAbQBhAC8AbAB6AG0AYQAtAGQAZQBjAG8AZABlAHIALgB0AHM=`)}function El(e,t,n){try{let r={data:t,offset:0,readByte(){return this.data[this.offset++]}},i=r.data.length,a={data:[],offset:0,writeByte(e){let t=Math.floor(this.offset/i);this.data[t]||(this.data[t]=new Uint8Array(i)),this.data[t][this.offset%i]=e,this.offset++}};e.decompressFile(r,a);let o=new Uint8Array(a.offset);for(let e=0;e<a.offset;e++)o[e]=a.data[Math.floor(e/i)][e%i];n(null,o)}catch(e){n(e)}}function Dl(e,t,n){try{let r=new WebAssembly.Memory({initial:16}),i=new WebAssembly.Module(e),a=new WebAssembly.Instance(i,{env:{memory:r,abort(){n(Error(`webAssembly abort`))}}}).exports,o=a.newU8Array(t.length);new Uint8Array(r.buffer,o+24,t.length).set(t);let s=a.decode(o),c=new Uint32Array(r.buffer,s,4),l=c[0],u=c[2],d=c[3];l?n(null,new Uint8Array(r.buffer,d+24,u).slice(0,u)):n(Error(`lzma deocder error`))}catch(e){n(e)}}var Ol=`
|
|
390
|
+
var decodeLZMA = (function() {
|
|
391
|
+
var LZMA = (${Cl.toString()})();
|
|
392
|
+
return function(data, callback) {
|
|
393
|
+
return (${El.toString()})(LZMA, data, callback);
|
|
394
|
+
}
|
|
395
|
+
})();
|
|
396
|
+
|
|
397
|
+
var decodeLZMAWithWASM = (function() {
|
|
398
|
+
var LZMA_WASM = (${Tl.toString()})();
|
|
399
|
+
return function(data, callback) {
|
|
400
|
+
return (${Dl.toString()})(LZMA_WASM, data, callback);
|
|
401
|
+
}
|
|
402
|
+
})();
|
|
403
|
+
|
|
404
|
+
self.onmessage = function(event) {
|
|
405
|
+
var packet = event.data;
|
|
406
|
+
if (!packet.id) {
|
|
407
|
+
postMessage({ id: packet.id, error: "No incoming id." });
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (!packet.data) {
|
|
411
|
+
postMessage({ id: packet.id, error: "No input data." });
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
if (packet.type == "decompress") {
|
|
415
|
+
if (packet.data.constructor !== Uint8Array) {
|
|
416
|
+
postMessage({ id: packet.id, error: "Input data is not Uint8Array." });
|
|
417
|
+
}
|
|
418
|
+
const callback = function(error, result) {
|
|
419
|
+
if (error) {
|
|
420
|
+
postMessage({ id: packet.id, error: error.toString() });
|
|
421
|
+
} else {
|
|
422
|
+
postMessage({ id: packet.id, result: result, error: null }, [ result.buffer ]);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
if (typeof WebAssembly !== "undefined" && WebAssembly.instantiate) {
|
|
426
|
+
decodeLZMAWithWASM(packet.data, callback);
|
|
427
|
+
} else {
|
|
428
|
+
decodeLZMA(packet.data, callback);
|
|
429
|
+
}
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
postMessage({ id: packet.id, error: "type never matched." });
|
|
433
|
+
};
|
|
434
|
+
`,kl=typeof Worker<`u`&&typeof Blob<`u`,Al=``;if(kl)try{let e=new Blob([Ol],{type:`text/javascript`});Al=URL.createObjectURL(e)}catch(e){}var jl=class{constructor(){if(!kl)throw Error(`LZMAWorker cannot work in this broswer.`);this.callCounter=0,this.requests={};let e=this.worker=new Worker(Al);e.onmessage=e=>{let{id:t,result:n,error:r}=e.data,i=this.getKey(t);this.requests[i]&&(r?this.requests[i](Error(r)):this.requests[i](null,n),delete this.requests[i])},e.onerror=e=>console.error(e)}getKey(e){return`key_`+String(e)}decompress(e,t){let n=++this.callCounter;this.requests[this.getKey(n)]=t,this.worker.postMessage({type:`decompress`,id:n,data:e},[e.buffer])}terminate(){this.worker.terminate()}};jl.support=kl;function Ml(e){return Array.prototype.reduce.call(e,(e,t,n)=>e|t<<n*8,0)}function Nl(e){let t=[],n=e.length;for(let i=0;i<n;i++){let n={data:e[i],offset:0,readByte(){return this.data[this.offset++]}},a=n.data.length,o={data:[],offset:0,writeByte(e){let t=Math.floor(this.offset/a);this.data[t]||(this.data[t]=new Uint8Array(a)),this.data[t][this.offset%a]=e,this.offset++}};wl.decompressFile(n,o);var r=new Uint8Array(o.offset);for(let e=0;e<o.offset;e++)r[e]=o.data[Math.floor(e/a)][e%a];t.push(r)}return t}function Pl(e){let t=[],n=e.length;for(let r=0;r<n;r++)t.push(new Promise((t,n)=>{let i=new jl;i.decompress(e[r],(e,r)=>{if(i.terminate(),e)return n(e);t(r)})}));return Promise.all(t)}function Fl(e){let t=new Uint8Array(e),n=Ml(t.slice(0,4));if(n>10)return Promise.reject(Error(`LZMA got too many sub chunks.`));let r=[],i=[],a=4+n*4;for(let e=0;e<n;e++)i[e]=Ml(t.slice(4+e*4,8+e*4)),e===n-1?r[e]=t.subarray(a,a+i[e]):r[e]=t.slice(a,a+i[e]),a+=i[e];return jl.support?Pl(r):Promise.resolve(Nl(r))}function Il(e,t={}){var n,r,i,a,o,s,l;let u=(n=t.upAxis)==null?`Z`:n,d=(r=t.light)==null?!1:r,f=(i=t.fetcher)==null?qs:i,p=(a=t.onDownloadProgress)==null?K:a,m=(o=t.textureBaseUri)==null?pl(e):o,h=t.textureBaseUri===void 0?[]:((s=t.textureArray)==null?[]:s).slice(),g=Sl((l=t.textureOptions)==null?{}:l,h.length),_=new Map;for(let e of h){let t=Qs(e)?e:ec(m,e);_.set(t,bl(t,g,f))}let v={byteLength:0};return Promise.resolve().then(()=>f.ajax(e,{responseType:`arraybuffer`},void 0,void 0,p)).then(e=>Fl(e.body)).then(e=>{let t={chunks:[],createAt:void 0,description:void 0};for(let n of e){let e=$c.decode(n);if(e.chunks.length){for(let n=0;n<e.chunks.length;n++)t.chunks.push(e.chunks[n]);t.createAt=e.createAt,t.description=e.description}}return t}).then(e=>xl(e,d,m,h,g,_,f)).then(t=>{_.clear();let n=new c.Group;n.name=e;for(let e of t.objects)n.add(e);return u===`Y`&&n.applyMatrix4(js),{type:`at3d`,modelUpAxis:`Z`,upAxis:u,uri:e,byteLength:v.byteLength,memoryUsage:fl(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}var Ll=l.Reader,Rl=l.util,q=l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto`]||(l.roots[`@REALSEE/FIVE:five/model/loaders/protobuf/dome.proto`]={}),zl=q.Model=(()=>{function e(e){if(this.meshes=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.meshes=Rl.emptyArray,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.Model;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.meshes&&i.meshes.length||(i.meshes=[]),i.meshes.push(q.Mesh.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Model`},e})();q.Mesh=(()=>{function e(e){if(this.chunks=[],this.matrix=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.name=``,e.prototype.chunks=Rl.emptyArray,e.prototype.matrix=Rl.emptyArray,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.Mesh;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.name=e.string();break;case 2:i.chunks&&i.chunks.length||(i.chunks=[]),i.chunks.push(q.Chunk.decode(e,e.uint32()));break;case 3:i.matrix&&i.matrix.length||(i.matrix=[]),i.matrix.push(q.Matrix.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`name`))throw Rl.ProtocolError(`missing required 'name'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Mesh`},e})(),q.Matrix=(()=>{function e(e){if(this.elements=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.elements=Rl.emptyArray,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.Matrix;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.elements&&i.elements.length||(i.elements=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.elements.push(e.float())}else i.elements.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Matrix`},e})(),q.Chunk=(()=>{function e(e){if(this.material=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.geometry=null,e.prototype.material=Rl.emptyArray,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.Chunk;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 2:i.geometry=q.Geometry.decode(e,e.uint32());break;case 3:i.material&&i.material.length||(i.material=[]),i.material.push(q.Material.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`geometry`))throw Rl.ProtocolError(`missing required 'geometry'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Chunk`},e})(),q.Geometry=(()=>{function e(e){if(this.groups=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.position=null,e.prototype.uv=null,e.prototype.uv2=null,e.prototype.normal=null,e.prototype.groups=Rl.emptyArray,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.Geometry;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.position=q.Position.decode(e,e.uint32());break;case 2:i.uv=q.UV.decode(e,e.uint32());break;case 3:i.uv2=q.UV.decode(e,e.uint32());break;case 4:i.normal=q.Normal.decode(e,e.uint32());break;case 5:i.groups&&i.groups.length||(i.groups=[]),i.groups.push(q.Group.decode(e,e.uint32()));break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`position`))throw Rl.ProtocolError(`missing required 'position'`,{instance:i});if(!i.hasOwnProperty(`normal`))throw Rl.ProtocolError(`missing required 'normal'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Geometry`},e})(),q.Position=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=Rl.emptyArray,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.Position;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Position`},e})(),q.UV=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=Rl.emptyArray,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.UV;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/UV`},e})(),q.Normal=(()=>{function e(e){if(this.array=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.array=Rl.emptyArray,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.Normal;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.array&&i.array.length||(i.array=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.array.push(e.float())}else i.array.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Normal`},e})(),q.Group=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.start=0,e.prototype.count=0,e.prototype.materialIndex=0,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.Group;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.start=e.uint32();break;case 2:i.count=e.uint32();break;case 3:i.materialIndex=e.uint32();break;default:e.skipType(t&7);break}}if(!i.hasOwnProperty(`start`))throw Rl.ProtocolError(`missing required 'start'`,{instance:i});if(!i.hasOwnProperty(`count`))throw Rl.ProtocolError(`missing required 'count'`,{instance:i});if(!i.hasOwnProperty(`materialIndex`))throw Rl.ProtocolError(`missing required 'materialIndex'`,{instance:i});return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Group`},e})(),q.Material=(()=>{function e(e){if(e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.kd=null,e.prototype.ks=null,e.prototype.ke=null,e.prototype.mapkd=``,e.prototype.mapks=``,e.prototype.mapke=``,e.prototype.norm=``,e.prototype.mapbump=``,e.prototype.bump=``,e.prototype.mapd=``,e.prototype.ns=0,e.prototype.d=0,e.prototype.tr=0,e.prototype.mapkdrepeat=``,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.Material;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:i.kd=q.Color.decode(e,e.uint32());break;case 2:i.ks=q.Color.decode(e,e.uint32());break;case 3:i.ke=q.Color.decode(e,e.uint32());break;case 4:i.mapkd=e.string();break;case 5:i.mapks=e.string();break;case 6:i.mapke=e.string();break;case 7:i.norm=e.string();break;case 8:i.mapbump=e.string();break;case 9:i.bump=e.string();break;case 10:i.mapd=e.string();break;case 11:i.ns=e.float();break;case 12:i.d=e.float();break;case 13:i.tr=e.float();break;case 14:i.mapkdrepeat=e.string();break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Material`},e})(),q.Color=(()=>{function e(e){if(this.rgb=[],e)for(let t=Object.keys(e),n=0;n<t.length;++n)e[t[n]]!=null&&(this[t[n]]=e[t[n]])}return e.prototype.rgb=Rl.emptyArray,e.decode=function(e,t,n){e instanceof Ll||(e=Ll.create(e));let r=t===void 0?e.len:e.pos+t,i=new q.Color;for(;e.pos<r;){let t=e.uint32();if(t===n)break;switch(t>>>3){case 1:if(i.rgb&&i.rgb.length||(i.rgb=[]),(t&7)==2){let t=e.uint32()+e.pos;for(;e.pos<t;)i.rgb.push(e.float())}else i.rgb.push(e.float());break;default:e.skipType(t&7);break}}return i},e.getTypeUrl=function(e){return e===void 0&&(e=`type.googleapis.com`),e+`/Color`},e})();function Bl(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?qs:r,s=(i=t.onDownloadProgress)==null?K:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(e=>{var n,r;return l.byteLength=e.body.byteLength,Kl(new Uint8Array(e.body),(n=t.light)==null?!0:n,t.textureBaseUri||``,(r=t.textureOptions)==null?{}:r,o)}).then(t=>{let n=new c.Group;n.matrixAutoUpdate=!1,a===`Z`&&n.applyMatrix4(As),n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(let e of t.objects)n.add(e);return{type:`dome`,modelUpAxis:`Y`,upAxis:a,uri:e,byteLength:l.byteLength,memoryUsage:fl(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}function Vl(e){let t=[0,0,0];for(let n=0;n<e.attributes.normal.array.length/9;n++)t[0]=e.attributes.normal.array[n*9],t[1]=e.attributes.normal.array[n*9+1],t[2]=e.attributes.normal.array[n*9+2],e.attributes.normal.array[n*9]=e.attributes.normal.array[n*9+6],e.attributes.normal.array[n*9+1]=e.attributes.normal.array[n*9+7],e.attributes.normal.array[n*9+2]=e.attributes.normal.array[n*9+8],e.attributes.normal.array[n*9+6]=t[0],e.attributes.normal.array[n*9+7]=t[1],e.attributes.normal.array[n*9+8]=t[2];for(let n=0;n<e.attributes.position.array.length/9;n++)t[0]=e.attributes.position.array[n*9],t[1]=e.attributes.position.array[n*9+1],t[2]=e.attributes.position.array[n*9+2],e.attributes.position.array[n*9]=e.attributes.position.array[n*9+6],e.attributes.position.array[n*9+1]=e.attributes.position.array[n*9+7],e.attributes.position.array[n*9+2]=e.attributes.position.array[n*9+8],e.attributes.position.array[n*9+6]=t[0],e.attributes.position.array[n*9+7]=t[1],e.attributes.position.array[n*9+8]=t[2];for(let n=0;n<e.attributes.uv.array.length/6;n++)t[0]=e.attributes.uv.array[n*6],t[1]=e.attributes.uv.array[n*6+1],e.attributes.uv.array[n*6]=e.attributes.uv.array[n*6+4],e.attributes.uv.array[n*6+1]=e.attributes.uv.array[n*6+5],e.attributes.uv.array[n*6+4]=t[0],e.attributes.uv.array[n*6+5]=t[1];e.attributes.normal.needsUpdate=!0,e.attributes.position.needsUpdate=!0,e.attributes.uv.needsUpdate=!0}function Hl({position:e,normal:t,uv:n,uv2:r,groups:i}){let a=new c.BufferGeometry;a.setAttribute(`position`,new c.BufferAttribute(new Float32Array(e.array),3)),t&&a.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(t.array),3)),n&&a.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(n.array),2)),r&&a.setAttribute(`uv2`,new c.BufferAttribute(new Float32Array(r.array),2));for(let e of i)a.addGroup(e.start,e.count,e.materialIndex);return a}function Ul(e,t,n,r,i,a,o){if(o.hasOwnProperty(e))return o[e];e=e.split(`?`)[0],Qs(e)||(e=ec(t,e)),e=e.replace(/\/\/vrlab-image\d*.ljcdn.com\//,`//vrlab-public.ljcdn.com/`),e.indexOf(`//`)===0&&(e=`https:`+e);let s=Object.assign({key:`texture.dome`,size:64},Js(n,[`quality`,`format`,`sharpen`,`forceUseExifOrientation`,`mappings`]));return o[e]=i.loadTexture(e,{imageURL:{transform:n.transform,options:s},wrapS:c.RepeatWrapping,wrapT:c.RepeatWrapping,fetcher:a}).then(e=>{let t=e.body;return r&&t.repeat.copy(r),t.needsUpdate=!0,t.updateMatrix(),t})}function Wl(e,t,n,r,i,a,o,s,l){let u=[],d=new Mr;if(s.add(d),e.kd&&(d.color=new c.Color().fromArray(e.kd.rgb).convertLinearToSRGB()),e.mapkd){let t=null;if(e.mapkdrepeat){let[n,r]=e.mapkdrepeat.split(/\s+/).map(e=>Number(e));t=new c.Vector2(n,r)}u.push(Ul(e.mapkd,n,r,t,i,a,o).then(e=>{e.colorSpace=c.SRGBColorSpace,d.map=e,s.add(e),l.add(e),d.needsUpdate=!0}).catch(K))}if(e.ks&&(d.specular=new c.Color().fromArray(e.ks.rgb).convertLinearToSRGB()),e.mapks&&u.push(Ul(e.mapks,n,r,null,i,a,o).then(e=>{d.specularMap=e,s.add(e),l.add(e)}).catch(K)),e.ke&&(d.emissive=new c.Color().fromArray(e.ke.rgb).convertLinearToSRGB()),e.mapke&&u.push(Ul(e.mapke,n,r,null,i,a,o).then(e=>{e.colorSpace=c.SRGBColorSpace,d.emissiveMap=e,s.add(e),l.add(e)}).catch(K)),e.norm&&u.push(Ul(e.norm,n,r,null,i,a,o).then(e=>{d.normalMap=e,s.add(e),l.add(e)}).catch(K)),e.mapbump&&u.push(Ul(e.mapbump,n,r,null,i,a,o).then(e=>{d.bumpMap=e,s.add(e),l.add(e)}).catch(K)),e.bump&&u.push(Ul(e.bump,n,r,null,i,a,o).then(e=>{d.bumpMap=e,s.add(e),l.add(e)}).catch(K)),typeof e.ns==`number`&&(d.shininess=e.ns),typeof e.d==`number`){let t=e.d;t>0&&t<1&&(d.opacity=t)}return d.floorIndex=0,{material:d,textureReady:Promise.all(u).then(K)}}function Gl(e){return zl.decode(e).meshes}function Kl(e,t,n,r,i){let a=[],o=[],s=new Set,l=Gl(e),u=new Yc,d=new c.Matrix4,f=new c.Vector3,p=new c.Quaternion,m=new c.Vector3,h={},g=new Set;for(let{name:e,chunks:_,matrix:v}of l)if(!(e===`Ceiling`||e===`CeilingDrop`))for(let l of v){d.elements=l.elements;let v=new c.Group;for(let e=0;e<_.length;e++){let a=Hl(_[e].geometry);a.applyMatrix4(d),d.decompose(f,p,m),m.x*m.y*m.z<0&&a.attributes.normal&&a.attributes.position&&a.attributes.uv&&Vl(a),s.add(a);let c=[];for(let a of _[e].material){let{material:e,textureReady:l}=Wl(a,t,n||``,r,u,i,h,s,g);o.push(l),c.push(e)}let l=new Ot(a,c);l.name=`chunk_`+e,l.matrix.compose(l.position,l.quaternion,l.scale),l.matrixAutoUpdate=!1,l.frustumCulled=!1,v.add(l)}v.name=e,a.push(v)}return Promise.all(o).catch(K).then(()=>({createAt:0,description:``,objects:a,textures:Array.from(g),dispose:()=>{s.forEach(e=>{e.dispose()}),s.clear()}}))}function ql(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?qs:r,s=(i=t.onDownloadProgress)==null?K:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(e=>(l.byteLength=e.body.byteLength,Fl(e.body))).then(e=>{let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;return e.forEach(e=>{n.set(e,r),r+=e.length}),n}).then(e=>{var n,r;return Kl(e,(n=t.light)==null?!0:n,t.textureBaseUri||``,(r=t.textureOptions)==null?{}:r,o)}).then(t=>{let n=new c.Group;n.matrixAutoUpdate=!1,a===`Z`&&n.applyMatrix4(As),n.matrix.compose(n.position,n.quaternion,n.scale),n.name=e;for(let e of t.objects)n.add(e);return{type:`domez`,modelUpAxis:`Y`,upAxis:`Z`,uri:e,byteLength:l.byteLength,memoryUsage:fl(n),scene:n,textures:t.textures,animations:[],dispose:()=>t.dispose()}})}var Jl=new c.Color;function Yl(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Xl(e,t,n){let r=t||e>1?e/n:e;return Yl(Math.min(Math.max(r,0),1))}function Zl(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Z`:n,s=(r=t.upAxis)==null?`Z`:r,l=(i=t.fetcher)==null?qs:i,u=(a=t.onDownloadProgress)==null?K:a,d=0;return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>(d=e.body.byteLength,e.body))).then(e=>{var n,r;return Ql(e,{propertyNameMapping:(n=t.propertyNameMapping)==null?{}:n,customPropertyMapping:(r=t.customPropertyMapping)==null?{}:r})}).then(({geometry:n})=>{var r,i,a,l,u,f,p,m,h,g;switch(t.type){case`geometry`:{let t=n;return o===`Y`&&t.applyMatrix4(As),s===`Y`&&t.applyMatrix4(js),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:tl(t),scene:t,textures:[],animations:[],dispose:()=>{n.dispose()}}}case`line`:{let t=`color`in n.attributes,r=new c.LineBasicMaterial({vertexColors:t}),i=new c.Line(n,r);return i.computeLineDistances(),o===`Y`&&i.applyMatrix4(As),s===`Y`&&i.applyMatrix4(js),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:fl(i),scene:i,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmMesh`:{let t=`color`in n.attributes,r=new Ar;r.vertexColors=t;let i=new Ot(n,[r]);return o===`Y`&&i.applyMatrix4(As),s===`Y`&&i.applyMatrix4(js),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:fl(i),scene:i,textures:[],animations:[],dispose:()=>{n.dispose(),r.dispose()}}}case`pbmPointCloud`:{let t=n.getAttribute(`position`),c=n.getAttribute(`color`),_=t.count,v=new Float32Array(t.array),y=new Float32Array(_*3);if(c){let e=c.array,t=Math.max(1,c.itemSize);if(c.normalized&&e.length>0){let n=c.array,o=`BYTES_PER_ELEMENT`in n?n.BYTES_PER_ELEMENT:1,s=Math.pow(2,o*8)-1;for(let n=0;n<_;n++){let o=n*t,c=n*3;y[c]=Xl((r=e[o])==null?0:r,!0,s),y[c+1]=Xl((a=(i=e[o+1])==null?e[o]:i)==null?0:a,!0,s),y[c+2]=Xl((u=(l=e[o+2])==null?e[o]:l)==null?0:u,!0,s)}}else{let n=c.array,r=`BYTES_PER_ELEMENT`in n?n.BYTES_PER_ELEMENT:1,i=Math.pow(2,r*8)-1;for(let n=0;n<_;n++){let r=n*t,a=n*3;y[a]=Xl((f=e[r])==null?0:f,!1,i),y[a+1]=Xl((m=(p=e[r+1])==null?e[r]:p)==null?0:m,!1,i),y[a+2]=Xl((g=(h=e[r+2])==null?e[r]:h)==null?0:g,!1,i)}}}let b=n.getAttribute(`normal`),x=new nn({numPoints:_,positions:v,colors:y,normals:b?$t({array:b.array,itemSize:b.itemSize,normalized:b.normalized},_):null});return o===`Y`&&x.applyMatrix4(As),s===`Y`&&x.applyMatrix4(js),{type:`ply`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:fl(x),scene:x,textures:[],animations:[],dispose:()=>{x.dispose()}}}default:break}throw Error(`Invalid Type: ${t.type}`)})}function Ql(e,t){let n=new Uint8Array(e),{headerText:r,headerLength:i}=du(n),a=eu(r,i,t);return a.format===`ascii`?{header:a,geometry:au(new TextDecoder().decode(n),a,t)}:{header:a,geometry:uu(e,a,t)}}function $l(e,t){let n={name:``,type:e[0]};return n.type===`list`?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],n.name in t.propertyNameMapping&&(n.name=t.propertyNameMapping[n.name]),n}function eu(e,t=0,n){let r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,i=``,a=r.exec(e);a!==null&&(i=a[1]);let o={format:``,version:``,comments:[],elements:[],headerLength:t,objInfo:``},s=i.split(/\r\n|\r|\n/),c=null;for(let e=0;e<s.length;e++){let t=s[e];if(t=t.trim(),t===``)continue;let r=t.split(/\s+/),i=r.shift();switch(t=r.join(` `),i){case`format`:o.format=r[0],o.version=r[1];break;case`comment`:o.comments.push(t);break;case`element`:c&&o.elements.push(c),c={name:r[0],count:parseInt(r[1]),properties:[]};break;case`property`:c&&c.properties.push($l(r,n));break;case`obj_info`:o.objInfo=t;break;default:console.log(`unhandled`,i,r)}}return c&&o.elements.push(c),o}function tu(e,t){switch(t){case`char`:case`uchar`:case`short`:case`ushort`:case`int`:case`uint`:case`int8`:case`uint8`:case`int16`:case`uint16`:case`int32`:case`uint32`:return parseInt(e);case`float`:case`double`:case`float32`:case`float64`:return parseFloat(e);default:throw Error(`unspport type: `+t)}}function nu(e,t){let n={};for(let r=0;r<e.length;r++){if(t.empty())return null;if(e[r].type===`list`){let i=[],a=tu(t.next(),e[r].countType);for(let n=0;n<a;n++){if(t.empty())return null;i.push(tu(t.next(),e[r].itemType))}n[e[r].name]=i}else n[e[r].name]=tu(t.next(),e[r].type)}return n}function ru(e){let t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(let n of Object.keys(e.customPropertyMapping))t[n]=[];return t}function iu(e){let t=e.map(e=>e.name);function n(e){for(let n=0,r=e.length;n<r;n++){let r=e[n];if(t.includes(r))return r}return null}return{attrX:n([`x`,`px`,`posx`])||`x`,attrY:n([`y`,`py`,`posy`])||`y`,attrZ:n([`z`,`pz`,`posz`])||`z`,attrNX:n([`nx`,`normalx`]),attrNY:n([`ny`,`normaly`]),attrNZ:n([`nz`,`normalz`]),attrS:n([`s`,`u`,`texture_u`,`tx`]),attrT:n([`t`,`v`,`texture_v`,`ty`]),attrR:n([`red`,`diffuse_red`,`r`,`diffuse_r`]),attrG:n([`green`,`diffuse_green`,`g`,`diffuse_g`]),attrB:n([`blue`,`diffuse_blue`,`b`,`diffuse_b`])}}function au(e,t,n){let r=ru(n),i=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,a,o=null;a=(o=i.exec(e))===null?[]:o[1].split(/\s+/);let s=new fu(a);loop:for(let e=0;e<t.elements.length;e++){let i=t.elements[e],a=iu(i.properties);for(let e=0;e<i.count;e++){let e=nu(i.properties,s);if(!e)break loop;su(r,i.name,e,a,n)}}return ou(r,n)}function ou(e,t){let n=new c.BufferGeometry;e.indices.length>0&&n.setIndex(e.indices),n.setAttribute(`position`,new c.Float32BufferAttribute(e.vertices,3)),e.normals.length>0&&n.setAttribute(`normal`,new c.Float32BufferAttribute(e.normals,3)),e.uvs.length>0&&n.setAttribute(`uv`,new c.Float32BufferAttribute(e.uvs,2)),e.colors.length>0&&n.setAttribute(`color`,new c.Float32BufferAttribute(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(n=n.toNonIndexed(),e.faceVertexUvs.length>0&&n.setAttribute(`uv`,new c.Float32BufferAttribute(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&n.setAttribute(`color`,new c.Float32BufferAttribute(e.faceVertexColors,3)));for(let r of Object.keys(t.customPropertyMapping))if(e[r].length>0){let{itemType:i,itemNames:a,normalized:o}=t.customPropertyMapping[r],s=a.length,l;switch(i){case`float32`:l=new c.Float32BufferAttribute(e[r],s,o);break;case`uint32`:l=new c.Uint32BufferAttribute(e[r],s,o);break;case`int32`:l=new c.Int32BufferAttribute(e[r],s,o);break;case`uint16`:l=new c.Uint16BufferAttribute(e[r],s,o);break;case`int16`:l=new c.Int16BufferAttribute(e[r],s,o);break;case`uint8`:l=new c.Uint8BufferAttribute(e[r],s,o);break;case`int8`:l=new c.Int8BufferAttribute(e[r],s,o);break;default:l=new c.Float32BufferAttribute(e[r],s,o);break}n.setAttribute(r,l)}return n.computeBoundingSphere(),n}function su(e,t,n,r,i){if(t===`vertex`){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&e.vertices.push(n[r.attrX],n[r.attrY],n[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&e.normals.push(n[r.attrNX],n[r.attrNY],n[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&e.uvs.push(n[r.attrS],n[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(Jl.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.colors.push(Jl.r,Jl.g,Jl.b));for(let t of Object.keys(i.customPropertyMapping))for(let r of i.customPropertyMapping[t].itemNames)e[t].push(n[r])}else if(t===`face`){let t=n.vertex_indices||n.vertex_index,i=n.texcoord;t.length===3?(e.indices.push(t[0],t[1],t[2]),i&&i.length===6&&(e.faceVertexUvs.push(i[0],i[1]),e.faceVertexUvs.push(i[2],i[3]),e.faceVertexUvs.push(i[4],i[5]))):t.length===4&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(Jl.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.faceVertexColors.push(Jl.r,Jl.g,Jl.b),e.faceVertexColors.push(Jl.r,Jl.g,Jl.b),e.faceVertexColors.push(Jl.r,Jl.g,Jl.b))}}function cu(e,t){let n={},r=0;for(let i=0;i<t.length;i++){let a=t[i],o=a.valueReader;if(a.type===`list`){let t=[],i=a.countReader.read(e+r);r+=a.countReader.size;for(let n=0;n<i;n++)t.push(o.read(e+r)),r+=o.size;n[a.name]=t}else n[a.name]=o.read(e+r),r+=o.size}return[n,r]}function lu(e,t,n){function r(e,t,n){switch(t){case`int8`:case`char`:return{read:t=>e.getInt8(t),size:1};case`uint8`:case`uchar`:return{read:t=>e.getUint8(t),size:1};case`int16`:case`short`:return{read:t=>e.getInt16(t,n),size:2};case`uint16`:case`ushort`:return{read:t=>e.getUint16(t,n),size:2};case`int32`:case`int`:return{read:t=>e.getInt32(t,n),size:4};case`uint32`:case`uint`:return{read:t=>e.getUint32(t,n),size:4};case`float32`:case`float`:return{read:t=>e.getFloat32(t,n),size:4};case`float64`:case`double`:return{read:t=>e.getFloat64(t,n),size:8};default:throw Error(`not support type: `+t)}}for(let i=0,a=e.length;i<a;i++){let a=e[i];a.type===`list`?(a.countReader=r(t,a.countType,n),a.valueReader=r(t,a.itemType,n)):a.valueReader=r(t,a.type,n)}}function uu(e,t,n){let r=ru(n),i=t.format===`binary_little_endian`,a=new DataView(e,t.headerLength),o,s=0;for(let e=0;e<t.elements.length;e++){let c=t.elements[e],l=c.properties,u=iu(l);lu(l,a,i);for(let e=0;e<c.count;e++){o=cu(s,l),s+=o[1];let e=o[0];su(r,c.name,e,u,n)}}return ou(r,n)}function du(e){let t=0,n=!0,r=``,i=[],a=new TextDecoder().decode(e.subarray(0,5)),o=/^ply\r\n/.test(a);do{let a=String.fromCharCode(e[t++]);a!==`
|
|
435
|
+
`&&a!==`\r`?r+=a:(r===`end_header`&&(n=!1),r!==``&&(i.push(r),r=``))}while(n&&t<e.length);return o===!0&&t++,{headerText:i.join(`\r`)+`\r`,headerLength:t}}var fu=class{constructor(e){this.arr=e,this.i=0}empty(){return this.i>=this.arr.length}next(){return this.arr[this.i++]}};function pu(e){if(typeof TextDecoder<`u`)return new TextDecoder().decode(e);let t=``;for(let n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}var mu={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},hu={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},gu={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},_u={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},vu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},yu={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv1`,TEXCOORD_2:`uv2`,TEXCOORD_3:`uv3`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},bu={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},xu={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete},Su={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`};function Cu(e){let t=[];for(let n in e)t.push(e[n]);return t}function wu(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Tu(e,t,n){let r=t||e>1?e/n:e;return wu(Math.min(Math.max(r,0),1))}function Eu(e){let t=Array.from(e);return()=>{for(let e of t)typeof e.dispose==`function`&&e.dispose(),typeof e.close==`function`&&e.close()}}var Du=class{constructor(e,t,n){if(this.json=e,this.json.materials){let e=new Set;for(let t of this.json.materials){if(typeof t.name!=`string`)continue;let n=0;for(;t.name;){let r=t.name+(n>0?`__${n}`:``);if(!e.has(r)){e.add(r),t.name=r;break}console.warn(`glTF: material name "${t.name}" duplicated.`),n++}}e.clear()}if(this.json.nodes){let e=new Set;for(let t of this.json.nodes){if(typeof t.name!=`string`)continue;let n=0;for(;t.name;){let r=t.name+(n>0?`__${n}`:``);if(!e.has(r)){e.add(r),t.name=r;break}console.warn(`glTF: node name "${t.name}" duplicated.`),n++}}e.clear()}this.extensions=t,this.options=n,this.cache=new Map,this.disposeSet=new Set,this.textureSet=new Set,this.nodeNamesUsed={}}dispose(){this.cache.clear(),this.disposeSet.forEach(e=>{typeof e.dispose==`function`&&e.dispose(),typeof e.close==`function`&&e.close()}),this.disposeSet.clear(),this.textureSet.clear(),this.extensions={},this.json={asset:{version:`unknown`}}}markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)}}parse(){let e=this.json,t=this.extensions;this.markDefs();for(let e of Cu(t))e.markDefs(this);return Promise.all(Cu(t).map(e=>e.prepare(this))).then(()=>{var t,n,r;return Promise.all([Promise.all(((t=e.scenes)==null?[]:t).map((e,t)=>this.loadScene(t))),Promise.all(((n=e.cameras)==null?[]:n).map((e,t)=>this.loadCamera(t))),Promise.all(((r=e.animations)==null?[]:r).map((e,t)=>this.loadAnimation(t)))])}).then(([t,n,r])=>({json:e,scene:t[e.scene||0],scenes:t,animations:r,cameras:n,textures:[],dispose:K})).then(e=>Promise.all(Cu(t).map(t=>t.emitResult(e,this))).then(()=>e)).then(e=>{let t=Array.from(this.textureSet),n=Eu(this.disposeSet);return Object.assign(e,{textures:t,dispose:n}),this.textureSet.clear(),this.disposeSet.clear(),this.dispose(),e})}loadCamera(e){let t=`camera:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Cu(this.extensions))if(r=t.loadCamera(e,this),r)break;if(!r){let t,n=this.json.cameras[e],i=n[n.type];i?n.type===`perspective`?t=new c.PerspectiveCamera(c.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type===`orthographic`?t=new c.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar):(console.warn(`glTF: Invalid camera type ${n.type}.`),t=new c.Camera):(console.warn(`glTF: Missing camera parameters.`),t=new c.Camera),n.name&&(t.name=n.name),r=Promise.resolve(t)}return this.cache.set(t,r),r}loadSkin(e){let t=`skin:`+e,n=this.cache.get(t);if(n)return n;let r,i=this.json.skins[e],a={joints:i.joints};return r=i.inverseBindMatrices===void 0?Promise.resolve(a):this.loadAccessor(i.inverseBindMatrices).then(e=>(e&&(a.inverseBindMatrices=e),a)),this.cache.set(t,r),r}loadAnimation(e){var t;let n=`animation:`+e,r=this.cache.get(n);if(r)return r;let i=null;for(let t of Cu(this.extensions))if(i=t.loadAnimation(e,this),i)break;if(!i){let n=this.json.animations[e],r=n.name?n.name:`animation_`+e,a=[],o=[],s=[],l=[],u=[];for(let e=0,r=n.channels.length;e<r;e++){let r=n.channels[e],i=n.samplers[r.sampler],c=r.target,d=c.node===void 0?c.id:c.node,f=n.parameters===void 0?i.input:n.parameters[i.input],p=n.parameters===void 0?i.output:n.parameters[i.output],m=(t=c.extensions)==null?{}:t;if(c.path===`pointer`&&m.KHR_animation_pointer&&m.KHR_animation_pointer.pointer&&/^\/nodes\/\d+\//.test(m.KHR_animation_pointer.pointer)){let e=m.KHR_animation_pointer.pointer.slice(1).split(`/`),t=Number(e[1]);a.push(this.loadNode(t))}else d===void 0?a.push(Promise.resolve(null)):a.push(this.loadNode(d));o.push(this.loadAccessor(f)),s.push(this.loadAccessor(p)),l.push(i),u.push(c)}i=Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(u)]).then(([e,t,n,i,a])=>{var o;let s=[];for(let r=0,l=e.length;r<l;r++){let l=e[r],u=t[r],d=n[r],f=i[r],p=a[r];l&&(l.updateMatrix(),l.matrixAutoUpdate=!0);let m=d.array;if(d.normalized){let e=Ou(m.constructor),t=new Float32Array(m.length);for(let n=0,r=m.length;n<r;n++)t[n]=m[n]*e;m=t}let h=f.interpolation===void 0?c.InterpolateLinear:xu[f.interpolation],g=(o=p.extensions)==null?{}:o;if(g.KHR_animation_pointer&&p.path&&p.path===`pointer`){let e=g.KHR_animation_pointer.pointer;if(e.indexOf(`/nodes/`)===0){let t=e.match(/^\/nodes\/(\d+)\/(.+)/);if(!t)continue;Number(t[1]);let n=t[2],r;switch(n){case`weights`:n=`morphTargetInfluences`,r=c.NumberKeyframeTrack;break;case`rotation`:n=`quaternion`,r=c.QuaternionKeyframeTrack;break;case`translation`:n=`position`,r=c.VectorKeyframeTrack;break;case`scale`:n=`scale`,r=c.VectorKeyframeTrack;break;case`extensions/KHR_node_visibility/visible`:n=`visible`,r=c.BooleanKeyframeTrack;break;default:break}if(!r)continue;let i=[];if(l){let e=l.name?l.name:l.uuid;n===`morphTargetInfluences`?l.traverse(e=>{e.morphTargetInfluences&&i.push(e.name?e.name:e.uuid)}):i.push(e)}for(let e=0,t=i.length;e<t;e++){let t=new r(`.nodes.${i[e]}.${n}`,u.array,r===c.BooleanKeyframeTrack?Array.from(m).map(e=>e>0):m,h);s.push(t)}}else if(e.indexOf(`/materials/`)===0){let t=e.match(/^\/materials\/(\d+)\/(.+)/);if(!t)continue;let n=Number(t[1]),r=t[2],i=this.json.materials[n].name,a;switch(r){case`pbrMetallicRoughness/baseColorFactor`:r=`color`,a=c.ColorKeyframeTrack;break;case`pbrMetallicRoughness/roughnessFactor`:r=`roughness`,a=c.NumberKeyframeTrack;break;case`pbrMetallicRoughness/metallicFactor`:r=`metalness`,a=c.NumberKeyframeTrack;break;case`emissiveFactor`:r=`emissive`,a=c.NumberKeyframeTrack;break;case`alphaCutoff`:r=`alphaTest`,a=c.NumberKeyframeTrack;break;case`occlusionTexture/strength`:r=`aoMapIntensity`,a=c.NumberKeyframeTrack;break;case`normalTexture/scale`:r=`normalScale`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale`:r=`map.repeat`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset`:r=`map.offset`,a=c.VectorKeyframeTrack;break;case`pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation`:r=`map.rotation`,a=c.NumberKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/scale`:r=`normalMap.repeat`,a=c.VectorKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/offset`:r=`normalMap.offset`,a=c.VectorKeyframeTrack;break;case`normalTexture/extensions/KHR_texture_transform/rotation`:r=`normalMap.rotation`,a=c.NumberKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/scale`:r=`emissiveMap.repeat`,a=c.VectorKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/offset`:r=`emissiveMap.offset`,a=c.VectorKeyframeTrack;break;case`emissiveTexture/extensions/KHR_texture_transform/rotation`:r=`emissiveMap.rotation`,a=c.NumberKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/scale`:r=`aoMap.repeat`,a=c.VectorKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/offset`:r=`aoMap.offset`,a=c.VectorKeyframeTrack;break;case`occlusionTexture/extensions/KHR_texture_transform/rotation`:r=`aoMap.rotation`,a=c.NumberKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale`:r=`clearcoatNormalMap.scale`,a=c.NumberKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset`:r=`clearcoatNormalMap.offset`,a=c.VectorKeyframeTrack;break;case`extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation`:r=`clearcoatNormalMap.rotation`,a=c.NumberKeyframeTrack;break;default:break}if(!a)continue;let o=new a(`.materials.${i}.${r}`,u.array,m,h);if(s.push(o),r===`color`&&d.itemSize===4){let e=new Float32Array(m.length/4);for(let t=0,n=m.length/4;t<n;t+=1)e[t]=m[t*4+3];let t=new c.NumberKeyframeTrack(`.materials.${i}.opacity`,u.array,e,h);s.push(t)}}else if(e.indexOf(`/cameras/`)===0){let t=e.match(/^\/cameras\/(\d+)\/(.+)/);if(!t)continue;let n=Number(t[1]),r=t[2],i=this.json.cameras[n].name,a;switch(r){case`perspective/yfov`:r=`fov`,a=c.NumberKeyframeTrack;break;case`perspective/znear`:case`orthographic/znear`:r=`near`,a=c.NumberKeyframeTrack;break;case`perspective/zfar`:case`orthographic/zfar`:r=`far`,a=c.NumberKeyframeTrack;break;case`perspective/aspect`:r=`aspect`,a=c.NumberKeyframeTrack;break;default:break}if(!a)continue;let o=new a(`.cameras.${i}.${r}`,u.array,m,h);s.push(o)}}else{let e;switch(bu[p.path]){case bu.weights:e=c.NumberKeyframeTrack;break;case bu.rotation:e=c.QuaternionKeyframeTrack;break;case bu.position:case bu.scale:default:e=c.VectorKeyframeTrack;break}let t=[];if(l){let e=l.name?l.name:l.uuid;bu[p.path]===bu.weights?l.traverse(e=>{e.morphTargetInfluences&&t.push(e.name?e.name:e.uuid)}):t.push(e)}let n=d.array;if(d.normalized){let e=Ou(n.constructor),t=new Float32Array(n.length);for(let r=0,i=n.length;r<i;r++)t[r]=n[r]*e;n=t}for(let r=0,i=t.length;r<i;r++){let i=new e(t[r]+`.`+bu[p.path],u.array,n,h);s.push(i)}}}return new c.AnimationClip(r,void 0,s)})}return this.cache.set(n,i),i}loadBuffer(e){let t=this.json.buffers[e];if(t.type&&t.type!==`arraybuffer`)throw Error(`glTF: `+t.type+` buffer type is not supported.`);let n=`buffer:`+e,r=this.cache.get(n);if(r)return r;let i=null;for(let t of Cu(this.extensions))if(i=t.loadBuffer(e,this),i)break;if(!i){let t=this.json.buffers[e];i=this.options.fetcher.ajax(this.resolveResouce(t.uri),{responseType:`arraybuffer`}).then(e=>e.body)}return this.cache.set(n,i),i}loadBufferView(e){let t=`bufferView:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Cu(this.extensions))if(r=t.loadBufferView(e,this),r)break;if(!r){let t=this.json.bufferViews[e];r=this.loadBuffer(t.buffer).then(e=>{let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}return this.cache.set(t,r),r}loadAccessor(e){let t=`accessor:`+e,n=this.cache.get(t);if(n)return n;let r=null;if(!r){let t=this.json.accessors[e];if(t.bufferView===void 0&&t.sparse===void 0)r=Promise.resolve(null);else{let e=[];t.bufferView===void 0?e.push(Promise.resolve(null)):e.push(this.loadBufferView(t.bufferView)),t.sparse!==void 0&&(e.push(this.loadBufferView(t.sparse.indices.bufferView)),e.push(this.loadBufferView(t.sparse.values.bufferView))),r=Promise.all(e).then(e=>{let n=e[0],r=vu[t.type],i=hu[t.componentType],a=i.BYTES_PER_ELEMENT,o=a*r,s=t.byteOffset||0,l=t.bufferView===void 0?void 0:this.json.bufferViews[t.bufferView].byteStride,u=t.normalized===!0,d,f;if(l&&l!==o){let e=Math.floor(s/l),o=`InterleavedBuffer:`+t.bufferView+`:`+t.componentType+`:`+e+`:`+t.count,p=this.cache.get(o);p||(d=new i(n,e*l,t.count*l/a),p=new c.InterleavedBuffer(d,l/a),this.cache.set(o,p)),f=new c.InterleavedBufferAttribute(p,r,s%l/a,u)}else d=n===null?new i(t.count*r):new i(n,s,t.count*r),f=new c.BufferAttribute(d,r,u);if(t.sparse!==void 0){let a=vu.SCALAR,o=hu[t.sparse.indices.componentType],s=t.sparse.indices.byteOffset||0,l=t.sparse.values.byteOffset||0,u=new o(e[1],s,t.sparse.count*a),d=new i(e[2],l,t.sparse.count*r);n!==null&&(f=new c.BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let e=0,t=u.length;e<t;e++){let t=u[e];if(f.setX(t,d[e*r]),r>=2&&f.setY(t,d[e*r+1]),r>=3&&f.setZ(t,d[e*r+2]),r>=4&&f.setW(t,d[e*r+3]),r>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}}return f})}}return this.cache.set(t,r),r}createPrimitiveKey(e){for(let t of Cu(this.extensions)){let n=t.createPrimitiveKey(e,this);if(n)return n}let t=``,n=Object.keys(e.attributes).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e.attributes[n[r]]+`;`;return e.indices+`:`+t+`:`+e.mode}loadGeometry(e){let t=null;for(let n of Cu(this.extensions))if(t=n.loadGeometry(e,this),t)break;return t||(t=this.addGeometryPrimitiveAttributes(new c.BufferGeometry,e)),t=t.then(e=>(this.disposeSet.add(e),e)),t}loadImage(e){let t=null;for(let n of Cu(this.extensions))if(t=n.loadImage(e,this),t)break;if(!t){let n=this.json.images[e];if(n.bufferView!==void 0){let e=this.json.bufferViews[n.bufferView];t=this.loadBuffer(e.buffer).then(t=>{let r=e.byteOffset||0,i=e.byteLength||0,a=new Uint8Array(t,r,i);return Uc(new Blob([a],{type:n.mimeType}))})}else if(n.uri){let e=this.resolveResouce(n.uri);t=Vc()?this.options.fetcher.ajax(e,{responseType:`blob`}).then(e=>{let t=e.body;return Uc(t)}):this.options.fetcher.loadImage(e,{},void 0,void 0,void 0,Hc()).then(e=>e.body)}else throw Error(`glTF: Invalid image defs.`)}return t=t.then(e=>(this.disposeSet.add(e),e)),t}loadMeshPrimitive(e,t){let n=null;for(let r of Cu(this.extensions))if(n=r.loadMeshPrimitive(e,t,this),n)break;if(!n){let r=this.loadGeometry(t),i=this.loadMaterial(t);n=Promise.all([r,i]).then(([n,r])=>{var i,a,o,s,l,u,d,f,p,m,h,g,_,v,y;let b=(i=t.mode)==null?mu.TRIANGLES:i,x;if(b===mu.TRIANGLES||b===mu.TRIANGLE_STRIP||b===mu.TRIANGLE_FAN)if(b===mu.TRIANGLE_STRIP?n=this.toGeometryTrianglesDrawMode(n,c.TriangleStripDrawMode):b===mu.TRIANGLE_FAN&&(n=this.toGeometryTrianglesDrawMode(n,c.TriangleFanDrawMode)),n.clearGroups(),n.addGroup(0,n.index?n.index.count:n.attributes.position.count,0),this.disposeSet.add(n),e.isSkinnedMesh){let e=new kt(n,[r]);this.normalizeSkinWeights(e),x=e}else x=new Ot(n,[r]);else if(b===mu.LINES)x=new c.LineSegments(n,r);else if(b===mu.LINE_STRIP)x=new c.Line(n,r);else if(b===mu.LINE_LOOP)x=new c.LineLoop(n,r);else if(b===mu.POINTS){let e=n.getAttribute(`position`),t=n.getAttribute(`color`),r=(a=e==null?void 0:e.count)==null?0:a,i=new Float32Array;if(e&&e.array instanceof Float32Array&&e.itemSize===3)i=e.array;else if(e){i=new Float32Array(r*3);let t=e.array,n=Math.max(1,e.itemSize);for(let e=0;e<r;e++){let r=e*n,a=e*3;i[a]=(o=t[r])==null?0:o,i[a+1]=(s=t[r+1])==null?0:s,i[a+2]=(l=t[r+2])==null?0:l}}let c=new Float32Array(r*3);if(t&&t.array instanceof Float32Array&&t.itemSize===3&&t.normalized!==!0)c=t.array;else if(t){let e=t.array,n=Math.max(1,t.itemSize);if(t.normalized&&e.length>0){let i=t.array,a=`BYTES_PER_ELEMENT`in i?i.BYTES_PER_ELEMENT:1,o=Math.pow(2,a*8)-1;for(let t=0;t<r;t++){let r=t*n,i=t*3;c[i]=Tu((u=e[r])==null?0:u,!0,o),c[i+1]=Tu((f=(d=e[r+1])==null?e[r]:d)==null?0:f,!0,o),c[i+2]=Tu((m=(p=e[r+2])==null?e[r]:p)==null?0:m,!0,o)}}else{let i=t.array,a=`BYTES_PER_ELEMENT`in i?i.BYTES_PER_ELEMENT:1,o=Math.pow(2,a*8)-1;for(let t=0;t<r;t++){let r=t*n,i=t*3;c[i]=Tu((h=e[r])==null?0:h,!1,o),c[i+1]=Tu((_=(g=e[r+1])==null?e[r]:g)==null?0:_,!1,o),c[i+2]=Tu((y=(v=e[r+2])==null?e[r]:v)==null?0:y,!1,o)}}}let b=n.getAttribute(`normal`),S=b?$t({array:b.array,itemSize:b.itemSize,normalized:b.normalized},r):null;x=new nn({numPoints:r,positions:i,colors:c,normals:S})}else throw Error(`glTF: Primitive mode unsupported: `+b);if(!(x instanceof nn)&&Object.keys(n.morphAttributes).length>0){if(e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)x.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){let t=e.extras.targetNames;if(x.morphTargetInfluences.length===t.length){x.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++)x.morphTargetDictionary[t[e]]=e}else console.warn(`glTF: Invalid extras.targetNames length. Ignoring names.`)}}return x})}return n}loadMesh(e){let t=null;for(let n of Cu(this.extensions))if(t=n.loadMesh(e,this),t)break;if(!t){let n=this.json.meshes[e],r=n.primitives;t=Promise.all(r.map(e=>this.loadMeshPrimitive(n,e))).then(t=>{for(let i=0;i<r.length;i++){let r=t[i];r.name=n.name||`mesh_`+e,r instanceof nn||this.assignFinalMaterial(r),t.push(r)}if(t.length===1)return t[0];let i=new c.Group;i.name=n.name;for(let e of t)i.add(e);return i})}return t}loadMaterial(e){var t;let n=(t=e.mode)==null?mu.TRIANGLES:t,r=`material:`+this.createPrimitiveKey(e),i=this.cache.get(r);if(i)return i;let a=null;for(let t of Cu(this.extensions))if(a=t.loadMaterial(e,this),a)break;if(!a){if(n===mu.TRIANGLES||n===mu.TRIANGLE_STRIP||n===mu.TRIANGLE_FAN)a=this.loadMaterialAsPBMMeshMaterial(e);else if(n===mu.LINES||n===mu.LINE_STRIP||n===mu.LINE_LOOP)a=this.loadMaterialAsLineBasicMaterial(e);else if(n===mu.POINTS)a=this.loadMaterialAsPointsMaterial(e);else throw Error(`glTF: Primitive mode unsupported: `+n);a=a.then(t=>Promise.all(Cu(this.extensions).map(n=>n.extendMaterial(t,e,this))).then(()=>t))}return a}loadMaterialAsPointsMaterial(e){let t=new c.ShaderMaterial;return this.disposeSet.add(t),Promise.resolve(t)}loadMaterialAsPBMMeshMaterial(e){let t=[],n=e.material===void 0?void 0:this.json.materials[e.material],r=n!=null&&n.extensions&&n.extensions.KHR_materials_unlit?new Ar:new Nr;if(r.color=new c.Color(1,1,1),r.opacity=1,r.colorAlpha=1,n){n.name&&(r.name=n.name);let e=n.pbrMetallicRoughness||{};if(Array.isArray(e.baseColorFactor)){let t=e.baseColorFactor;r.color=new c.Color().fromArray(t),r.colorAlpha=t[3],r.opacity=t[3]}e.baseColorTexture!==void 0&&t.push(this.createMaterialTexture(e.baseColorTexture).then(e=>{e.colorSpace=c.SRGBColorSpace,r.map=e,n.alphaMode===Su.MASK&&!(e instanceof c.CompressedTexture)&&e.minFilter!==c.LinearMipmapLinearFilter&&(e.minFilter=c.LinearMipmapLinearFilter,e.generateMipmaps=!0),this.disposeSet.add(e)})),r instanceof Nr&&(r.metalness=e.metallicFactor===void 0?1:e.metallicFactor,r.roughness=e.roughnessFactor===void 0?1:e.roughnessFactor,e.metallicRoughnessTexture!==void 0&&t.push(this.createMaterialTexture(e.metallicRoughnessTexture).then(e=>{r.roughnessMap=e,r.metalnessMap=e,this.disposeSet.add(e)}))),n.doubleSided===!0&&(r.side=c.DoubleSide);let i=n.alphaMode||Su.OPAQUE;if(r.alphaMode=`OPAQUE`,i===Su.BLEND?(r.alphaMode=`BLEND`,r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,i===Su.MASK&&(r.alphaMode=`MASK`,r.alphaTest=n.alphaCutoff===void 0?.5:n.alphaCutoff)),r instanceof Nr){if(n.normalTexture!==void 0&&(t.push(this.createMaterialTexture(n.normalTexture).then(e=>{this.disposeSet.add(e),r.normalMap=e})),r.normalScale=new c.Vector2(1,1),n.normalTexture.scale!==void 0)){let e=n.normalTexture.scale;r.normalScale.set(e,e)}n.occlusionTexture!==void 0&&(t.push(this.createMaterialTexture(n.occlusionTexture).then(e=>{r.aoMap=e,this.disposeSet.add(e)})),n.occlusionTexture.strength!==void 0&&(r.aoMapIntensity=n.occlusionTexture.strength)),n.emissiveFactor!==void 0&&(r.emissive=new c.Color().fromArray(n.emissiveFactor)),n.emissiveTexture!==void 0&&t.push(this.createMaterialTexture(n.emissiveTexture).then(e=>{e.colorSpace=c.SRGBColorSpace,r.emissiveMap=e,this.disposeSet.add(e)}))}}return this.disposeSet.add(r),Promise.all(t).then(()=>r)}loadMaterialAsLineBasicMaterial(e){let t=[],n=new c.LineBasicMaterial;if(n.color=new c.Color(1,1,1),n.opacity=1,e.material!==void 0){let t=this.json.materials[e.material];t.name&&(n.name=t.name);let r=t.pbrMetallicRoughness||{};if(Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;n.color.fromArray(e),n.opacity=e[3]}t.doubleSided===!0&&(n.side=c.DoubleSide);let i=t.alphaMode||Su.OPAQUE;i===Su.BLEND?(n.transparent=!0,n.depthWrite=!1):(n.transparent=!1,i===Su.MASK&&(n.alphaTest=t.alphaCutoff===void 0?.5:t.alphaCutoff))}return this.disposeSet.add(n),Promise.all(t).then(()=>n)}loadTexture(e){let t=`texture:`+e,n=this.cache.get(t);if(n)return n;let r=null;for(let t of Cu(this.extensions))if(r=t.loadTexture(e,this),r)break;if(!r){let t=this.json.textures[e];r=this.loadImage(t.source).then(e=>{let n=new c.Texture(e);n.needsUpdate=!0,n.flipY=!1,t.name&&(n.name=t.name);let r=(this.json.samplers||{})[t.sampler]||{};return n.magFilter=gu[r.magFilter]||c.LinearFilter,n.minFilter=gu[r.minFilter]||c.LinearMipmapLinearFilter,n.wrapS=_u[r.wrapS]||c.RepeatWrapping,n.wrapT=_u[r.wrapT]||c.RepeatWrapping,n.onUpdate=function(){e.close()},n})}return r=r.then(e=>(this.disposeSet.add(e),e)),this.cache.set(t,r),r}normalizeSkinWeights(e){let t=e.geometry,n=t.attributes.skinWeight,r=1;if(n.array instanceof Uint8Array?r=255:n.array instanceof Uint16Array?r=65535:n.array instanceof Uint32Array&&(r=4294967295),r>1){let e=n.count,i=n.itemSize,a=n.normalized,o=new c.BufferAttribute(new Float32Array(e*i),i,a);for(let t=0;t<e;t++)o.setX(t,n.getX(t)/r),o.setY(t,n.getY(t)/r),o.setZ(t,n.getZ(t)/r),o.setW(t,n.getW(t)/r);t.attributes.skinWeight=o}n.normalized||e.normalizeSkinWeights()}assignFinalMaterial(e){let t=e.geometry,n=[].concat(e.material),r=t.attributes.tangent!==void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;n=n.map(e=>{if(r||i||a){let t=`cloned-material:`+e.uuid+`:`;r&&(t+=`vertex-tangents:`),i&&(t+=`vertex-colors:`),a&&(t+=`flat-shading:`);let n=this.cache.get(t);n||(n=e.clone(),i&&(n.vertexColors=!0),a&&`flatShading`in n&&(n.flatShading=!0),r&&(n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.set(t,n)),e=n}return e}),Array.isArray(e.material)?e.material=n:e.material=n[0]}loadNodeAttachments(e){let t=[];for(let n of Cu(this.extensions)){let r=n.loadNodeAttachments(e,this);r&&t.push(r)}return t}loadNode(e){let t=`node:`+e,n=this.cache.get(t);if(n)return n;let r=this.json.nodes[e],i=[];r.mesh!==void 0&&i.push(this.loadMesh(r.mesh).then(e=>{if(r.weights!==void 0){let t=r.weights;e.traverse(e=>{if(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)for(let n=0,r=t.length;n<r;n++)e.morphTargetInfluences[n]=t[n]})}return e})),r.camera!==void 0&&i.push(this.loadCamera(r.camera));let a=this.loadNodeAttachments(e);for(let e of a)i.push(e);let o=Promise.all(i).then(e=>{let t;if(t=r.isBone===!0?new c.Bone:e.length>1?new c.Group:e.length===1?e[0]:new c.Object3D,t!==e[0])for(let n=0,r=e.length;n<r;n++)t.add(e[n]);if(r.name&&(t.userData.name=r.name,t.name=c.PropertyBinding.sanitizeNodeName(r.name)),r.matrix!==void 0){let e=new c.Matrix4;e.fromArray(r.matrix),t.applyMatrix4(e)}else r.translation!==void 0&&t.position.fromArray(r.translation),r.rotation!==void 0&&t.quaternion.fromArray(r.rotation),r.scale!==void 0&&t.scale.fromArray(r.scale);return o=o.then(e=>Promise.all(Cu(this.extensions).map(t=>t.extendNode(e,r,this))).then(()=>e)),t});return this.cache.set(t,o),o}loadScene(e){let t=this.json.scenes[e],n=new c.Group;t.name&&(n.name=t.name);let r=t.nodes||[],i=[];for(let e=0,t=r.length;e<t;e++)i.push(this.buildNodeHierarchy(r[e],n));return Promise.all(i).then(()=>n)}createMaterialTexture(e){return this.loadTexture(e.index).then(t=>{t instanceof c.CompressedTexture||(t.minFilter=c.LinearFilter,t.magFilter=c.LinearFilter,t.generateMipmaps=!1),e.texCoord!==void 0&&e.texCoord>0&&(t.channel=e.texCoord);for(let n of Cu(this.extensions)){let r=n.extendTexture(t,e,this);r&&(t=r)}return this.textureSet.add(t),this.disposeSet.add(t),t})}addGeometryPrimitiveAttributes(e,t){let n=t.attributes,r=[];for(let t in n){let i=yu[t]||t.toLowerCase();i in e.attributes||r.push(this.loadAccessor(n[t]).then(t=>{t&&e.setAttribute(i,t)}))}t.indices!==void 0&&!e.index&&r.push(this.loadAccessor(t.indices).then(t=>{t&&e.setIndex(t)}));let i=new c.Box3;if(n.POSITION!==void 0){let e=this.json.accessors[n.POSITION],t=e.min,r=e.max;if(t!==void 0&&r!==void 0){if(i.set(new c.Vector3(t[0],t[1],t[2]),new c.Vector3(r[0],r[1],r[2])),e.normalized){let t=Ou(hu[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else console.warn(`glTF: Missing min/max properties for accessor POSITION.`)}let a=t.targets;if(a!==void 0){let e=new c.Vector3,t=new c.Vector3;for(let n=0,r=a.length;n<r;n++){let r=a[n];if(r.POSITION!==void 0){let n=this.json.accessors[r.POSITION],i=n.min,a=n.max;if(i!==void 0&&a!==void 0){if(t.setX(Math.max(Math.abs(i[0]),Math.abs(a[0]))),t.setY(Math.max(Math.abs(i[1]),Math.abs(a[1]))),t.setZ(Math.max(Math.abs(i[2]),Math.abs(a[2]))),n.normalized){let e=Ou(hu[n.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`glTF: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new c.Sphere;return i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o,Promise.all(r).then(()=>{var n;let r=!1;if(t.material!==void 0){let e=this.json.materials[t.material];e.occlusionTexture&&((n=e.occlusionTexture.texCoord)==null?0:n)>0&&(r=!0)}if((r||this.options.copyUV2)&&e.attributes.uv&&!e.attributes.uv1&&e.setAttribute(`uv1`,e.attributes.uv),t.targets){let n=!1,r=!1;for(let e=0,i=t.targets.length;e<i;e++){let i=t.targets[e];if(i.POSITION!==void 0&&(n=!0),i.NORMAL!==void 0&&(r=!0),n&&r)break}if(!n&&!r)return e;let i=[];e.morphTargetsRelative=!0;for(let a=0,o=t.targets.length;a<o;a++){let o=t.targets[a];n?i.push(this.loadAccessor(o.POSITION).then(t=>{t&&(e.morphAttributes.position=e.morphAttributes.position||[],e.morphAttributes.position[a]=t)})):e.attributes.position&&(e.morphAttributes.position=e.morphAttributes.position||[],e.morphAttributes.position[a]=e.attributes.position),r?i.push(this.loadAccessor(o.NORMAL).then(t=>{t&&(e.morphAttributes.normal=e.morphAttributes.normal||[],e.morphAttributes.normal[a]=t)})):e.attributes.normal&&(e.morphAttributes.normal=e.morphAttributes.normal||[],e.morphAttributes.normal[a]=e.attributes.normal)}return Promise.all(i).then(()=>e)}else return e})}buildNodeHierarchy(e,t){let n=this.json.nodes[e];return this.loadNode(e).then(e=>{if(n.skin===void 0)return e;let t;return this.loadSkin(n.skin).then(e=>{t=e;let n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this.loadNode(t.joints[e]));return Promise.all(n)}).then(n=>(e.traverse(e=>{if(!(e instanceof c.SkinnedMesh))return;let r=[],i=[];for(let e=0,a=n.length;e<a;e++){let a=n[e];if(a instanceof c.Bone){r.push(a);let n=new c.Matrix4;t.inverseBindMatrices!==void 0&&n.fromArray(t.inverseBindMatrices.array,e*16),i.push(n)}else console.warn(`glTF: Joint "%s" could not be found.`,t.joints[e])}let a=new c.Skeleton(r,i);e.bind(a,e.matrixWorld)}),e))}).then(e=>{t.add(e);let r=[];if(n.children){let t=n.children;for(let n=0,i=t.length;n<i;n++){let i=t[n];r.push(this.buildNodeHierarchy(i,e))}}return Promise.all(r).then(()=>e)})}resolveResouce(e){return/^[a-z]{0,8}\:/i.test(e)?e:ec(this.options.resourcePath,tc(e,this.options.search))}toGeometryTrianglesDrawMode(e,t){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}}if(n===null)return console.error(`glTF: Undefined position attribute. Processing not possible.`),e;let r=n.count-2,i=[];if(t===c.TriangleFanDrawMode)for(let e=1;e<=r;e++)i.push(n.getX(0)),i.push(n.getX(e)),i.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(i.push(n.getX(e)),i.push(n.getX(e+1)),i.push(n.getX(e+2))):(i.push(n.getX(e+2)),i.push(n.getX(e+1)),i.push(n.getX(e)));i.length/3!==r&&console.error(`glTF: Unable to generate correct amount of triangles.`);let a=e.clone();return a.setIndex(i),this.disposeSet.add(a),a}};function Ou(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`glTF: Unsupported normalized accessor component type.`)}}var ku=!1,Au=null;function ju(){if(ku)return;ku=!0;let e=Au||(Au=c.PropertyBinding.findNode);c.PropertyBinding.findNode=function(t,n){let r=t,i=n;if(!i||typeof i!=`string`)return e(t,n);if(i.startsWith(`.materials.`)){let e=i.substring(11).substring(i.indexOf(`.`)),t=e.indexOf(`.`),n=t<0?e:e.substring(0,t),a=t<0?null:e.slice(t+1),o=null;return r.traverse(e=>{if(o!==null||e.type!==`Mesh`&&e.type!==`SkinnedMesh`)return;let t=[].concat(e.material);for(let e of t)e&&(e.uuid===n||e.name===n)&&(o=e,o!==null&&a&&(o=o[a]))}),o}else if(i.startsWith(`.nodes.`)||i.startsWith(`.lights.`)||i.startsWith(`.cameras.`)){let n=i.split(`.`),a;for(let e=1;e<n.length;e++){let t=n[e];if(t.length==36)a=r.getObjectByProperty(`uuid`,t);else if(a&&a[t]){let e=Number.parseInt(t),n=t;e>=0&&(n=e),a=a[n]}else{let e=r.getObjectByName(t);e&&(a=e)}}if(!a){let a=e(t,n[2]);return a||console.warn(`KHR_animation_pointer: Property binding not found`,i,r,r.name,n),a}return a}let a=e(t,n);if(!a){console.error(`THREE.PropertyBinding: Trying to update node for track: `+i+` but it wasn't found.`);let e=new c.Object3D;e.name=i,e.visible=!1,r.add(e),a=e}return a=e(t,n),a}}ju();var Mu=class{markDefs(e){}prepare(e){}emitResult(e,t){}createPrimitiveKey(e,t){}extendTexture(e,t,n){return null}loadBuffer(e,t){return null}loadBufferView(e,t){return null}loadImage(e,t){return null}loadTexture(e,t){return null}loadGeometry(e,t){return null}loadMaterial(e,t){return null}loadMeshPrimitive(e,t,n){return null}extendMaterial(e,t,n){return Promise.resolve()}loadMesh(e,t){return null}extendNode(e,t,n){return Promise.resolve()}loadNodeAttachments(e,t){return null}loadCamera(e,t){return null}loadAnimation(e,t){return null}},Nu=`KHR_binary_glTF`,Pu=class e extends Mu{static getMagic(e){return pu(new Uint8Array(e.slice(0,4)))}constructor(){super(),this.header={magic:``,version:0,length:0},this.content=``,this.body=null}loadGlbBinary(t){let n=new DataView(t,0,e.HEADER_LENGTH);if(this.header={magic:e.getMagic(t),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==e.HEADER_MAGIC)throw Error(`glTF:KHR_binary_glTF: Unsupported.`);if(this.header.version<2)throw Error(`glTF:KHR_binary_glTF: Legacy binary file detected.`);let r=new DataView(t,e.HEADER_LENGTH),i=0,a=null,o=null;for(;i<r.byteLength;){let n=r.getUint32(i,!0);if(i+=4,n===0)continue;let s=r.getUint32(i,!0);if(i+=4,s===e.CHUNK_TYPES.JSON)a=pu(new Uint8Array(t,e.HEADER_LENGTH+i,n));else if(s===e.CHUNK_TYPES.BIN){let r=e.HEADER_LENGTH+i;o=t.slice(r,r+n)}i+=n}if(a===null)throw Error(`glTF:${Nu}: JSON content not found.`);this.content=a,this.body=o}loadBuffer(e,t){return t.json.buffers[e].uri===void 0&&e===0&&this.body?Promise.resolve(this.body):null}clear(){this.body=null,this.content=``}};Pu.HEADER_MAGIC=`glTF`,Pu.HEADER_LENGTH=12,Pu.CHUNK_TYPES={JSON:1313821514,BIN:5130562};var Fu=`https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/`,Iu={position:`POSITION`,normal:`NORMAL`,color:`COLOR`,uv:`TEX_COORD`},Lu={position:`Float32Array`,normal:`Float32Array`,color:`Float32Array`,uv:`Float32Array`},Ru=new class{constructor(){this.decoderPath=Fu,this.decoderConfig={},this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=``}setDecoderPath(e){this.decoderPath=e}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}decodeDracoFile(e,t,n,r){let i={attributeIDs:n||Iu,attributeTypes:r||Lu,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t={attributeIDs:Iu,attributeTypes:Lu,useUniqueIDs:!1}){for(let e in t.attributeTypes){let n=t.attributeTypes[e];n.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[e]=n.name)}let n,r=this.workerNextTaskID++,i=e.byteLength,a=this._getWorker(r,i).then(i=>(n=i,new Promise((i,a)=>{n._callbacks[r]={resolve:i,reject:a},n.postMessage({type:`decode`,id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),a}_createGeometry(e){let t=new c.BufferGeometry;e.index&&t.setIndex(new c.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n],i=r.name,a=r.array,o=r.itemSize,s=!(a instanceof Float32Array||a instanceof Float64Array);t.setAttribute(i,new c.BufferAttribute(a,o,s))}return t}_initDecoder(){if(this.decoderPending)return this.decoderPending;if(typeof WebAssembly!=`object`||this.decoderConfig.type===`js`){let e=qs.ajax(this.decoderPath+`draco_decoder.js`,{responseType:`text`}).then(e=>e.body);this.decoderPending=e.then(e=>{let t=[`/* draco decoder */`,e,``,`/* worker */`,zu].join(`
|
|
436
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([t]))})}else{let e=qs.ajax(this.decoderPath+`draco_wasm_wrapper.js`,{responseType:`text`}).then(e=>e.body),t=qs.ajax(this.decoderPath+`draco_decoder.wasm`,{responseType:`arraybuffer`}).then(e=>e.body);this.decoderPending=Promise.all([e,t]).then(([e,t])=>{this.decoderConfig.wasmBinary=t;let n=[`/* draco decoder */`,e,``,`/* worker */`,zu].join(`
|
|
437
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([n]))})}return this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:`init`,decoderConfig:this.decoderConfig}),e.onmessage=t=>{let n=t.data;switch(n.type){case`decode`:e._callbacks[n.id].resolve(n);break;case`error`:e._callbacks[n.id].reject(n);break;default:console.error(`DRACO: Unexpected message, "`+n.type+`"`)}},this.workerPool.push(e)}else this.workerPool.sort((e,t)=>e._taskLoad>t._taskLoad?-1:1);let n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}},zu=`
|
|
438
|
+
let decoderConfig;
|
|
439
|
+
let decoderPending;
|
|
440
|
+
|
|
441
|
+
onmessage = function ( e ) {
|
|
442
|
+
|
|
443
|
+
const message = e.data;
|
|
444
|
+
|
|
445
|
+
switch ( message.type ) {
|
|
446
|
+
|
|
447
|
+
case 'init':
|
|
448
|
+
decoderConfig = message.decoderConfig;
|
|
449
|
+
decoderPending = new Promise( function ( resolve/*, reject*/ ) {
|
|
450
|
+
|
|
451
|
+
decoderConfig.onModuleLoaded = function ( draco ) {
|
|
452
|
+
|
|
453
|
+
// Module is Promise-like. Wrap before resolving to avoid loop.
|
|
454
|
+
resolve( { draco: draco } );
|
|
455
|
+
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
DracoDecoderModule( decoderConfig ); // eslint-disable-line no-undef
|
|
459
|
+
|
|
460
|
+
} );
|
|
461
|
+
break;
|
|
462
|
+
|
|
463
|
+
case 'decode':
|
|
464
|
+
const buffer = message.buffer;
|
|
465
|
+
const taskConfig = message.taskConfig;
|
|
466
|
+
decoderPending.then( ( module ) => {
|
|
467
|
+
|
|
468
|
+
const draco = module.draco;
|
|
469
|
+
const decoder = new draco.Decoder();
|
|
470
|
+
const decoderBuffer = new draco.DecoderBuffer();
|
|
471
|
+
decoderBuffer.Init( new Int8Array( buffer ), buffer.byteLength );
|
|
472
|
+
|
|
473
|
+
try {
|
|
474
|
+
|
|
475
|
+
const geometry = decodeGeometry( draco, decoder, decoderBuffer, taskConfig );
|
|
476
|
+
|
|
477
|
+
const buffers = geometry.attributes.map( ( attr ) => attr.array.buffer );
|
|
478
|
+
|
|
479
|
+
if ( geometry.index ) buffers.push( geometry.index.array.buffer );
|
|
480
|
+
|
|
481
|
+
self.postMessage( { type: 'decode', id: message.id, geometry }, buffers );
|
|
482
|
+
|
|
483
|
+
} catch ( error ) {
|
|
484
|
+
|
|
485
|
+
console.error( error );
|
|
486
|
+
|
|
487
|
+
self.postMessage( { type: 'error', id: message.id, error: error.message } );
|
|
488
|
+
|
|
489
|
+
} finally {
|
|
490
|
+
|
|
491
|
+
draco.destroy( decoderBuffer );
|
|
492
|
+
draco.destroy( decoder );
|
|
493
|
+
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
} );
|
|
497
|
+
break;
|
|
498
|
+
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
function decodeGeometry( draco, decoder, decoderBuffer, taskConfig ) {
|
|
504
|
+
|
|
505
|
+
const attributeIDs = taskConfig.attributeIDs;
|
|
506
|
+
const attributeTypes = taskConfig.attributeTypes;
|
|
507
|
+
|
|
508
|
+
let dracoGeometry;
|
|
509
|
+
let decodingStatus;
|
|
510
|
+
|
|
511
|
+
const geometryType = decoder.GetEncodedGeometryType( decoderBuffer );
|
|
512
|
+
|
|
513
|
+
if ( geometryType === draco.TRIANGULAR_MESH ) {
|
|
514
|
+
|
|
515
|
+
dracoGeometry = new draco.Mesh();
|
|
516
|
+
decodingStatus = decoder.DecodeBufferToMesh( decoderBuffer, dracoGeometry );
|
|
517
|
+
|
|
518
|
+
} else if ( geometryType === draco.POINT_CLOUD ) {
|
|
519
|
+
|
|
520
|
+
dracoGeometry = new draco.PointCloud();
|
|
521
|
+
decodingStatus = decoder.DecodeBufferToPointCloud( decoderBuffer, dracoGeometry );
|
|
522
|
+
|
|
523
|
+
} else {
|
|
524
|
+
|
|
525
|
+
throw new Error( 'THREE.DRACOLoader: Unexpected geometry type.' );
|
|
526
|
+
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if ( ! decodingStatus.ok() || dracoGeometry.ptr === 0 ) {
|
|
530
|
+
|
|
531
|
+
throw new Error( 'THREE.DRACOLoader: Decoding failed: ' + decodingStatus.error_msg() );
|
|
532
|
+
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
const geometry = { index: null, attributes: [] };
|
|
536
|
+
|
|
537
|
+
// Gather all vertex attributes.
|
|
538
|
+
for ( const attributeName in attributeIDs ) {
|
|
539
|
+
|
|
540
|
+
const attributeType = self[ attributeTypes[ attributeName ] ];
|
|
541
|
+
|
|
542
|
+
let attribute;
|
|
543
|
+
let attributeID;
|
|
544
|
+
|
|
545
|
+
// A Draco file may be created with default vertex attributes, whose attribute IDs
|
|
546
|
+
// are mapped 1:1 from their semantic name (POSITION, NORMAL, ...). Alternatively,
|
|
547
|
+
// a Draco file may contain a custom set of attributes, identified by known unique
|
|
548
|
+
// IDs. glTF files always do the latter, and .drc files typically do the former.
|
|
549
|
+
if ( taskConfig.useUniqueIDs ) {
|
|
550
|
+
|
|
551
|
+
attributeID = attributeIDs[ attributeName ];
|
|
552
|
+
attribute = decoder.GetAttributeByUniqueId( dracoGeometry, attributeID );
|
|
553
|
+
|
|
554
|
+
} else {
|
|
555
|
+
|
|
556
|
+
attributeID = decoder.GetAttributeId( dracoGeometry, draco[ attributeIDs[ attributeName ] ] );
|
|
557
|
+
|
|
558
|
+
if ( attributeID === - 1 ) continue;
|
|
559
|
+
|
|
560
|
+
attribute = decoder.GetAttribute( dracoGeometry, attributeID );
|
|
561
|
+
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
geometry.attributes.push( decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) );
|
|
565
|
+
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// Add index.
|
|
569
|
+
if ( geometryType === draco.TRIANGULAR_MESH ) {
|
|
570
|
+
|
|
571
|
+
geometry.index = decodeIndex( draco, decoder, dracoGeometry );
|
|
572
|
+
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
draco.destroy( dracoGeometry );
|
|
576
|
+
|
|
577
|
+
return geometry;
|
|
578
|
+
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
function decodeIndex( draco, decoder, dracoGeometry ) {
|
|
582
|
+
|
|
583
|
+
const numFaces = dracoGeometry.num_faces();
|
|
584
|
+
const numIndices = numFaces * 3;
|
|
585
|
+
const byteLength = numIndices * 4;
|
|
586
|
+
|
|
587
|
+
const ptr = draco._malloc( byteLength );
|
|
588
|
+
decoder.GetTrianglesUInt32Array( dracoGeometry, byteLength, ptr );
|
|
589
|
+
const index = new Uint32Array( draco.HEAPF32.buffer, ptr, numIndices ).slice();
|
|
590
|
+
draco._free( ptr );
|
|
591
|
+
|
|
592
|
+
return { array: index, itemSize: 1 };
|
|
593
|
+
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) {
|
|
597
|
+
|
|
598
|
+
const numComponents = attribute.num_components();
|
|
599
|
+
const numPoints = dracoGeometry.num_points();
|
|
600
|
+
const numValues = numPoints * numComponents;
|
|
601
|
+
const byteLength = numValues * attributeType.BYTES_PER_ELEMENT;
|
|
602
|
+
const dataType = getDracoDataType( draco, attributeType );
|
|
603
|
+
|
|
604
|
+
const ptr = draco._malloc( byteLength );
|
|
605
|
+
decoder.GetAttributeDataArrayForAllPoints( dracoGeometry, attribute, dataType, byteLength, ptr );
|
|
606
|
+
const array = new attributeType( draco.HEAPF32.buffer, ptr, numValues ).slice();
|
|
607
|
+
draco._free( ptr );
|
|
608
|
+
|
|
609
|
+
return {
|
|
610
|
+
name: attributeName,
|
|
611
|
+
array: array,
|
|
612
|
+
itemSize: numComponents
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
function getDracoDataType( draco, attributeType ) {
|
|
618
|
+
|
|
619
|
+
switch ( attributeType ) {
|
|
620
|
+
|
|
621
|
+
case Float32Array: return draco.DT_FLOAT32;
|
|
622
|
+
case Int8Array: return draco.DT_INT8;
|
|
623
|
+
case Int16Array: return draco.DT_INT16;
|
|
624
|
+
case Int32Array: return draco.DT_INT32;
|
|
625
|
+
case Uint8Array: return draco.DT_UINT8;
|
|
626
|
+
case Uint16Array: return draco.DT_UINT16;
|
|
627
|
+
case Uint32Array: return draco.DT_UINT32;
|
|
628
|
+
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
}
|
|
632
|
+
`,Bu=`KHR_draco_mesh_compression`,Vu=class extends Mu{loadGeometry(e,t){return e.extensions&&e.extensions[Bu]?this.decodePrimitive(e,t).then(n=>t.addGeometryPrimitiveAttributes(n,e)):null}decodePrimitive(e,t){let n=t.json,r=e.extensions[Bu].bufferView,i=e.extensions[Bu].attributes,a={},o={},s={};for(let e in i){let t=yu[e]||e.toLowerCase();a[t]=i[e]}for(let t in e.attributes){let r=yu[t]||t.toLowerCase();if(i[t]!==void 0){let i=n.accessors[e.attributes[t]];s[r]=hu[i.componentType],o[r]=i.normalized===!0}}return t.loadBufferView(r).then(e=>new Promise(t=>{Ru.decodeDracoFile(e,e=>{for(let t in e.attributes){let n=e.attributes[t],r=o[t];r!==void 0&&(n.normalized=r)}t(e)},a,s)}))}},Hu=class{constructor(e,t){this.disposed=!1,this.pool=t,this.workerCreator=e,this.queue=[],this.workers=[],this.workerResolvers=[],this.workerStatus=0}setWorkerCreator(e){this.workerCreator=e}initWorker(e){if(!this.workerCreator)throw Error(`workerCreator is not defined`);if(!this.workers[e]){let t=this.workerCreator(e);t.addEventListener(`message`,this.onMessage.bind(this,e)),this.workers[e]=t}}getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}onMessage(e,t){let n=this.workerResolvers[e];if(t.data&&`$$error`in t.data?n==null||n.reject(t.data.$$error):n==null||n.resolve(t.data),this.workerResolvers[e]=void 0,this.queue.length){let{resolve:t,reject:n,input:r,transfer:i}=this.queue.shift();this.workerResolvers[e]={resolve:t,reject:n},this.workers[e].postMessage(r,i)}else this.workerStatus^=1<<e}postMessage(e,t=[]){return new Promise((n,r)=>{if(this.disposed){r(Error(`disposed`));return}let i=this.getIdleWorker();i===-1?this.queue.push({resolve:n,reject:r,input:e,transfer:t}):(this.initWorker(i),this.workerStatus|=1<<i,this.workerResolvers[i]={resolve:n,reject:r},this.workers[i].postMessage(e,t))})}dispose(){this.disposed=!0,this.workers.forEach(e=>{e.terminate()}),this.workers.length=0,this.workerResolvers.forEach(e=>{e==null||e.reject(Error(`disposed`))}),this.workerResolvers.length=0,this.queue.forEach(e=>{e.reject(Error(`disposed`))}),this.queue.length=0,this.workerStatus=0}},Uu=`https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/basis/1.16/`,Wu=2,Gu=1,Ku=new class{constructor(){this.transcoderPath=Uu,this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Hu(null,4),this.workerSourceURL=``,this.workerConfig=null}setTranscoderPath(e){this.transcoderPath=e}detectSupport(e){var t;let n=e;return n.isWebGPURenderer===!0&&(t=n.backend)!=null&&t.device?this.workerConfig={astcSupported:n.hasFeature(`texture-compression-astc`),etc1Supported:n.hasFeature(`texture-compression-etc2`),etc2Supported:n.hasFeature(`texture-compression-etc2`),dxtSupported:n.hasFeature(`texture-compression-bc`),bptcSupported:n.hasFeature(`texture-compression-bc`),pvrtcSupported:!1}:n.extensions?this.workerConfig={astcSupported:!!n.extensions.get(`WEBGL_compressed_texture_astc`),etc1Supported:!!n.extensions.get(`WEBGL_compressed_texture_etc1`),etc2Supported:!!n.extensions.get(`WEBGL_compressed_texture_etc`),dxtSupported:!!n.extensions.get(`WEBGL_compressed_texture_s3tc`),bptcSupported:!!n.extensions.get(`EXT_texture_compression_bptc`),pvrtcSupported:!!n.extensions.get(`WEBGL_compressed_texture_pvrtc`)||!!n.extensions.get(`WEBKIT_WEBGL_compressed_texture_pvrtc`)}:this.workerConfig||(this.workerConfig={astcSupported:!1,etc1Supported:!1,etc2Supported:!1,dxtSupported:!1,bptcSupported:!1,pvrtcSupported:!1}),this}init(){if(!this.transcoderPending){let e=qs.ajax(this.transcoderPath+`basis_transcoder.js`,{responseType:`text`}).then(e=>e.body),t=qs.ajax(this.transcoderPath+`basis_transcoder.wasm`,{responseType:`arraybuffer`}).then(e=>e.body);this.transcoderPending=Promise.all([e,t]).then(([e,t])=>{let n=[`/* constants */`,`let _EngineFormat = `+JSON.stringify(Yu),`let _TranscoderFormat = `+JSON.stringify(Ju),`let _BasisFormat = `+JSON.stringify(qu),`/* basis_transcoder.js */`,e,`/* worker */`,Xu].join(`
|
|
633
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([n])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{let e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:`init`,config:this.workerConfig,transcoderBinary:t},[t]),e})})}return this.transcoderPending}parse(e){return this._createTexture([e])}_createTextureFrom(e){let{mipmaps:t,width:n,height:r,format:i,type:a,error:o,dfdTransferFn:s,dfdFlags:l}=e;if(a===`error`)return Promise.reject(o);let u=new c.CompressedTexture(t,n,r,i,c.UnsignedByteType);return u.minFilter=t.length===1?c.LinearFilter:c.LinearMipmapLinearFilter,u.magFilter=c.LinearFilter,u.generateMipmaps=!1,u.needsUpdate=!0,u.colorSpace=s===Wu?c.SRGBColorSpace:c.LinearSRGBColorSpace,u.premultiplyAlpha=!!(l&Gu),Promise.resolve(u)}_createTexture(e){return this.init().then(()=>this.workerPool.postMessage({type:`transcode`,buffers:e},e)).then(e=>this._createTextureFrom(e))}dispose(){return URL.revokeObjectURL(this.workerSourceURL),this.workerPool.dispose(),this}},qu={ETC1S:0,UASTC_4x4:1},Ju={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},Yu={RGBAFormat:c.RGBAFormat,RGBA_ASTC_4x4_Format:c.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:c.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:c.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:c.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:c.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:c.RGB_ETC1_Format,RGB_ETC2_Format:c.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:c.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:c.RGB_S3TC_DXT1_Format},Xu=`
|
|
634
|
+
|
|
635
|
+
let config;
|
|
636
|
+
let transcoderPending;
|
|
637
|
+
let BasisModule;
|
|
638
|
+
|
|
639
|
+
const EngineFormat = _EngineFormat; // eslint-disable-line no-undef
|
|
640
|
+
const TranscoderFormat = _TranscoderFormat; // eslint-disable-line no-undef
|
|
641
|
+
const BasisFormat = _BasisFormat; // eslint-disable-line no-undef
|
|
642
|
+
|
|
643
|
+
self.addEventListener( 'message', function ( e ) {
|
|
644
|
+
|
|
645
|
+
const message = e.data;
|
|
646
|
+
|
|
647
|
+
switch ( message.type ) {
|
|
648
|
+
|
|
649
|
+
case 'init':
|
|
650
|
+
config = message.config;
|
|
651
|
+
init( message.transcoderBinary );
|
|
652
|
+
break;
|
|
653
|
+
|
|
654
|
+
case 'transcode':
|
|
655
|
+
transcoderPending.then( () => {
|
|
656
|
+
|
|
657
|
+
try {
|
|
658
|
+
|
|
659
|
+
const { width, height, hasAlpha, mipmaps, format, dfdTransferFn, dfdFlags } = transcode( message.buffers[ 0 ] );
|
|
660
|
+
|
|
661
|
+
const buffers = [];
|
|
662
|
+
|
|
663
|
+
for ( let i = 0; i < mipmaps.length; ++ i ) {
|
|
664
|
+
|
|
665
|
+
buffers.push( mipmaps[ i ].data.buffer );
|
|
666
|
+
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
self.postMessage( { type: 'transcode', id: message.id, width, height, hasAlpha, mipmaps, format, dfdTransferFn, dfdFlags }, buffers );
|
|
670
|
+
|
|
671
|
+
} catch ( error ) {
|
|
672
|
+
|
|
673
|
+
console.error( error );
|
|
674
|
+
|
|
675
|
+
self.postMessage( { type: 'error', id: message.id, error: error.message } );
|
|
676
|
+
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
} );
|
|
680
|
+
break;
|
|
681
|
+
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
} );
|
|
685
|
+
|
|
686
|
+
function init( wasmBinary ) {
|
|
687
|
+
|
|
688
|
+
transcoderPending = new Promise( ( resolve ) => {
|
|
689
|
+
|
|
690
|
+
BasisModule = { wasmBinary, onRuntimeInitialized: resolve };
|
|
691
|
+
BASIS( BasisModule ); // eslint-disable-line no-undef
|
|
692
|
+
|
|
693
|
+
} ).then( () => {
|
|
694
|
+
|
|
695
|
+
BasisModule.initializeBasis();
|
|
696
|
+
|
|
697
|
+
if ( BasisModule.KTX2File === undefined ) {
|
|
698
|
+
|
|
699
|
+
console.warn( 'THREE.KTX2Loader: Please update Basis Universal transcoder.' );
|
|
700
|
+
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
} );
|
|
704
|
+
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
function transcode( buffer ) {
|
|
708
|
+
|
|
709
|
+
const ktx2File = new BasisModule.KTX2File( new Uint8Array( buffer ) );
|
|
710
|
+
|
|
711
|
+
function cleanup() {
|
|
712
|
+
|
|
713
|
+
ktx2File.close();
|
|
714
|
+
ktx2File.delete();
|
|
715
|
+
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
if ( ! ktx2File.isValid() ) {
|
|
719
|
+
|
|
720
|
+
cleanup();
|
|
721
|
+
throw new Error( 'THREE.KTX2Loader: Invalid or unsupported .ktx2 file' );
|
|
722
|
+
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
const basisFormat = ktx2File.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S;
|
|
726
|
+
const width = ktx2File.getWidth();
|
|
727
|
+
const height = ktx2File.getHeight();
|
|
728
|
+
const levels = ktx2File.getLevels();
|
|
729
|
+
const hasAlpha = ktx2File.getHasAlpha();
|
|
730
|
+
const dfdTransferFn = ktx2File.getDFDTransferFunc();
|
|
731
|
+
const dfdFlags = ktx2File.getDFDFlags();
|
|
732
|
+
|
|
733
|
+
const { transcoderFormat, engineFormat } = getTranscoderFormat( basisFormat, width, height, hasAlpha );
|
|
734
|
+
|
|
735
|
+
if ( ! width || ! height || ! levels ) {
|
|
736
|
+
|
|
737
|
+
cleanup();
|
|
738
|
+
throw new Error( 'THREE.KTX2Loader: Invalid texture' );
|
|
739
|
+
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
if ( ! ktx2File.startTranscoding() ) {
|
|
743
|
+
|
|
744
|
+
cleanup();
|
|
745
|
+
throw new Error( 'THREE.KTX2Loader: .startTranscoding failed' );
|
|
746
|
+
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
const mipmaps = [];
|
|
750
|
+
|
|
751
|
+
for ( let mip = 0; mip < levels; mip ++ ) {
|
|
752
|
+
|
|
753
|
+
const levelInfo = ktx2File.getImageLevelInfo( mip, 0, 0 );
|
|
754
|
+
const mipWidth = levelInfo.origWidth;
|
|
755
|
+
const mipHeight = levelInfo.origHeight;
|
|
756
|
+
const dst = new Uint8Array( ktx2File.getImageTranscodedSizeInBytes( mip, 0, 0, transcoderFormat ) );
|
|
757
|
+
|
|
758
|
+
const status = ktx2File.transcodeImage(
|
|
759
|
+
dst,
|
|
760
|
+
mip,
|
|
761
|
+
0,
|
|
762
|
+
0,
|
|
763
|
+
transcoderFormat,
|
|
764
|
+
0,
|
|
765
|
+
- 1,
|
|
766
|
+
- 1,
|
|
767
|
+
);
|
|
768
|
+
|
|
769
|
+
if ( ! status ) {
|
|
770
|
+
|
|
771
|
+
cleanup();
|
|
772
|
+
throw new Error( 'THREE.KTX2Loader: .transcodeImage failed.' );
|
|
773
|
+
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
mipmaps.push( { data: dst, width: mipWidth, height: mipHeight } );
|
|
777
|
+
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
cleanup();
|
|
781
|
+
|
|
782
|
+
return { width, height, hasAlpha, mipmaps, format: engineFormat, dfdTransferFn, dfdFlags };
|
|
783
|
+
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
//
|
|
787
|
+
|
|
788
|
+
// Optimal choice of a transcoder target format depends on the Basis format (ETC1S or UASTC),
|
|
789
|
+
// device capabilities, and texture dimensions. The list below ranks the formats separately
|
|
790
|
+
// for ETC1S and UASTC.
|
|
791
|
+
//
|
|
792
|
+
// In some cases, transcoding UASTC to RGBA32 might be preferred for higher quality (at
|
|
793
|
+
// significant memory cost) compared to ETC1/2, BC1/3, and PVRTC. The transcoder currently
|
|
794
|
+
// chooses RGBA32 only as a last resort and does not expose that option to the caller.
|
|
795
|
+
const FORMAT_OPTIONS = [
|
|
796
|
+
{
|
|
797
|
+
if: 'astcSupported',
|
|
798
|
+
basisFormat: [ BasisFormat.UASTC_4x4 ],
|
|
799
|
+
transcoderFormat: [ TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4 ],
|
|
800
|
+
engineFormat: [ EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format ],
|
|
801
|
+
priorityETC1S: Infinity,
|
|
802
|
+
priorityUASTC: 1,
|
|
803
|
+
needsPowerOfTwo: false,
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
if: 'bptcSupported',
|
|
807
|
+
basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],
|
|
808
|
+
transcoderFormat: [ TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5 ],
|
|
809
|
+
engineFormat: [ EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format ],
|
|
810
|
+
priorityETC1S: 3,
|
|
811
|
+
priorityUASTC: 2,
|
|
812
|
+
needsPowerOfTwo: false,
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
if: 'dxtSupported',
|
|
816
|
+
basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],
|
|
817
|
+
transcoderFormat: [ TranscoderFormat.BC1, TranscoderFormat.BC3 ],
|
|
818
|
+
engineFormat: [ EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format ],
|
|
819
|
+
priorityETC1S: 4,
|
|
820
|
+
priorityUASTC: 5,
|
|
821
|
+
needsPowerOfTwo: false,
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
if: 'etc2Supported',
|
|
825
|
+
basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],
|
|
826
|
+
transcoderFormat: [ TranscoderFormat.ETC1, TranscoderFormat.ETC2 ],
|
|
827
|
+
engineFormat: [ EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format ],
|
|
828
|
+
priorityETC1S: 1,
|
|
829
|
+
priorityUASTC: 3,
|
|
830
|
+
needsPowerOfTwo: false,
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
if: 'etc1Supported',
|
|
834
|
+
basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],
|
|
835
|
+
transcoderFormat: [ TranscoderFormat.ETC1, TranscoderFormat.ETC1 ],
|
|
836
|
+
engineFormat: [ EngineFormat.RGB_ETC1_Format, EngineFormat.RGB_ETC1_Format ],
|
|
837
|
+
priorityETC1S: 2,
|
|
838
|
+
priorityUASTC: 4,
|
|
839
|
+
needsPowerOfTwo: false,
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
if: 'pvrtcSupported',
|
|
843
|
+
basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],
|
|
844
|
+
transcoderFormat: [ TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA ],
|
|
845
|
+
engineFormat: [ EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format ],
|
|
846
|
+
priorityETC1S: 5,
|
|
847
|
+
priorityUASTC: 6,
|
|
848
|
+
needsPowerOfTwo: true,
|
|
849
|
+
},
|
|
850
|
+
];
|
|
851
|
+
|
|
852
|
+
const ETC1S_OPTIONS = FORMAT_OPTIONS.sort( function ( a, b ) {
|
|
853
|
+
|
|
854
|
+
return a.priorityETC1S - b.priorityETC1S;
|
|
855
|
+
|
|
856
|
+
} );
|
|
857
|
+
const UASTC_OPTIONS = FORMAT_OPTIONS.sort( function ( a, b ) {
|
|
858
|
+
|
|
859
|
+
return a.priorityUASTC - b.priorityUASTC;
|
|
860
|
+
|
|
861
|
+
} );
|
|
862
|
+
|
|
863
|
+
function getTranscoderFormat( basisFormat, width, height, hasAlpha ) {
|
|
864
|
+
|
|
865
|
+
let transcoderFormat;
|
|
866
|
+
let engineFormat;
|
|
867
|
+
|
|
868
|
+
const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS;
|
|
869
|
+
|
|
870
|
+
for ( let i = 0; i < options.length; i ++ ) {
|
|
871
|
+
|
|
872
|
+
const opt = options[ i ];
|
|
873
|
+
|
|
874
|
+
if ( ! config[ opt.if ] ) continue;
|
|
875
|
+
if ( ! opt.basisFormat.includes( basisFormat ) ) continue;
|
|
876
|
+
if ( opt.needsPowerOfTwo && ! ( isPowerOfTwo( width ) && isPowerOfTwo( height ) ) ) continue;
|
|
877
|
+
|
|
878
|
+
transcoderFormat = opt.transcoderFormat[ hasAlpha ? 1 : 0 ];
|
|
879
|
+
engineFormat = opt.engineFormat[ hasAlpha ? 1 : 0 ];
|
|
880
|
+
|
|
881
|
+
return { transcoderFormat, engineFormat };
|
|
882
|
+
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
console.warn( 'KTX2: No suitable compressed texture format found. Decoding to RGBA32.' );
|
|
886
|
+
|
|
887
|
+
transcoderFormat = TranscoderFormat.RGBA32;
|
|
888
|
+
engineFormat = EngineFormat.RGBAFormat;
|
|
889
|
+
|
|
890
|
+
return { transcoderFormat, engineFormat };
|
|
891
|
+
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
function isPowerOfTwo( value ) {
|
|
895
|
+
|
|
896
|
+
if ( value <= 2 ) return true;
|
|
897
|
+
|
|
898
|
+
return ( value & ( value - 1 ) ) === 0 && value !== 0;
|
|
899
|
+
|
|
900
|
+
}
|
|
901
|
+
`,Zu=`KHR_texture_basisu`,Qu=class extends Mu{loadTexture(e,t){let n=t.json.textures[e];if(!n.extensions||!n.extensions[Zu])return null;let r=n.extensions[Zu],i=t.json.images[r.source],a=null;if(i.bufferView!==void 0)a=t.loadBufferView(i.bufferView).then(e=>Ku.parse(e));else if(i.uri)a=t.options.fetcher.ajax(t.resolveResouce(i.uri),{responseType:`arraybuffer`}).then(e=>Ku.parse(e.body));else throw Error(`glTF: Invalid image defs.`);let o=(t.json.samplers||{})[n.sampler]||{};return a=a.then(e=>(e.magFilter=c.LinearFilter,e.minFilter=c.LinearFilter,e.wrapS=_u[o.wrapS]||c.RepeatWrapping,e.wrapT=_u[o.wrapT]||c.RepeatWrapping,e)),a}},$u=`KHR_texture_transform`,ed=class extends Mu{extendTexture(e,t,n){let r=t.extensions===void 0?void 0:t.extensions[$u];return r?(r.texCoord!==void 0&&console.warn(`glTF: Custom UV sets in "KHR_texture_transform" extension not yet supported.`),r.offset===void 0&&r.rotation===void 0&&r.scale===void 0?e:(e=e.clone(),e.needsUpdate=!0,r.offset!==void 0&&e.offset.fromArray(r.offset),r.rotation!==void 0&&(e.rotation=r.rotation),r.scale!==void 0&&e.repeat.fromArray(r.scale),e)):null}},td=class extends Mu{},nd=class extends Mu{},rd=`KHR_node_visibility`,id=class extends Mu{extendNode(e,t,n){var r;let i=[],a=(r=t.extensions)==null?{}:r;if(a[rd]){let t=a[rd];typeof t.visible==`boolean`&&(e.visible=t.visible)}return Promise.all(i).then(K)}},ad=class extends Mu{},od=`KHR_materials_clearcoat`,sd=class extends Mu{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof Nr||e instanceof c.MeshPhysicalMaterial||e instanceof c.MeshPhysicalNodeMaterial)){let a=(r=n.json.materials[t.material].extensions)==null?{}:r;if(a[od]){let t=a[od];if(t.clearcoatFactor!==void 0&&(e.clearcoat=t.clearcoatFactor),t.clearcoatTexture!==void 0&&i.push(n.createMaterialTexture(t.clearcoatTexture).then(t=>{e.clearcoatMap=t,n.disposeSet.add(t)})),t.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=t.clearcoatRoughnessFactor),t.clearcoatRoughnessTexture!==void 0&&i.push(n.createMaterialTexture(t.clearcoatRoughnessTexture).then(t=>{e.clearcoatRoughnessMap=t,n.disposeSet.add(t)})),t.clearcoatNormalTexture!==void 0&&(i.push(n.createMaterialTexture(t.clearcoatNormalTexture).then(t=>{e.clearcoatNormalMap=t,n.disposeSet.add(t)})),t.clearcoatNormalTexture.scale!==void 0)){let n=t.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new c.Vector2(n,n)}}}return Promise.all(i).then(K)}},cd=`KHR_materials_sheen`,ld=class extends Mu{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof Nr||e instanceof c.MeshPhysicalMaterial||e instanceof c.MeshPhysicalNodeMaterial)){let a=(r=n.json.materials[t.material].extensions)==null?{}:r;if(a[cd]){let t=a[cd];if(e.sheen=1,t.sheenColorFactor!==void 0){let n=t.sheenColorFactor;e.sheenColor=new c.Color().setRGB(n[0],n[1],n[2])}t.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=t.sheenRoughnessFactor),t.sheenColorTexture!==void 0&&i.push(n.createMaterialTexture(t.sheenColorTexture).then(t=>{t.colorSpace=c.SRGBColorSpace,e.sheenColorMap=t,n.disposeSet.add(t)})),t.sheenRoughnessTexture!==void 0&&i.push(n.createMaterialTexture(t.sheenRoughnessTexture).then(t=>{e.sheenRoughnessMap=t,n.disposeSet.add(t)}))}}return Promise.all(i).then(K)}},ud=`KHR_materials_transmission`,dd=class extends Mu{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof Nr||e instanceof c.MeshPhysicalMaterial||e instanceof c.MeshPhysicalNodeMaterial)){let a=(r=n.json.materials[t.material].extensions)==null?{}:r;if(a[ud]){let t=a[ud];t.transmissionFactor!==void 0&&(e.transmission=t.transmissionFactor,e.transmission>0&&(e.transparent=!0)),t.transmissionTexture!==void 0&&i.push(n.createMaterialTexture(t.transmissionTexture).then(t=>{e.transmissionMap=t,n.disposeSet.add(t)}))}}return Promise.all(i).then(K)}},fd=`KHR_materials_emissive_strength`,pd=class extends Mu{extendMaterial(e,t,n){var r;let i=[];if(t.material!==void 0&&(e instanceof Nr||e instanceof c.MeshStandardMaterial||e instanceof c.MeshStandardNodeMaterial)){let i=(r=n.json.materials[t.material].extensions)==null?{}:r;if(i[fd]){let t=i[fd];t.emissiveStrength!==void 0&&(e.emissiveIntensity=t.emissiveStrength)}}return Promise.all(i).then(K)}},md=(function(){"use strict";var e=`b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:78Yqdbk:qzezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlinalgic9Wfglawcj;cbffhOdndndndndnaHalco4fRbbalci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOaoRblaoRbbgAco4glalciSgCE86bbawcj;cbfaifglcGfaoclfaCfgORbbaAcl4ciGgCaCciSgCE86bbalcVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbalc7faOaCfgORbbaAciGgAaAciSgAE86bbalctfaOaAfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkaOaoRbwaoRbbgAcl4glalcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgORbbaAcsGgAaAcsSgAE86bbalcVfaOaAfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekaOao8Pbb83bbaOcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhPdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhHinaialRbbgAce4cbaAceG9R7aOfgO86bbaiadfhialcefhlaHcufgHmbkaCcefhCamcefgmad6hsamad9hmbkaPhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaPhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj;8ifcjjj98G::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb`,t=`b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;a9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;d8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgAclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb`,n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=`object`)return{supported:!1};var i=WebAssembly.validate(n)?t:e,a,o=WebAssembly.instantiate(s(i),{}).then(function(e){a=e.instance,a.exports.__wasm_call_ctors()});function s(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);t[n]=i>96?i-97:i>64?i-39:i+4}for(var a=0,n=0;n<e.length;++n)t[a++]=t[n]<60?r[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,a)}function c(e,t,n,r,i,o){var s=a.exports.sbrk,c=n+3&-4,l=s(c*r),u=s(i.length),d=new Uint8Array(a.exports.memory.buffer);d.set(i,u);var f=e(l,n,r,u,i.length);if(f==0&&o&&o(l,c,r),t.set(d.subarray(l,l+n*r)),s(l-s(0)),f!=0)throw Error(`Malformed buffer data: `+f)}var l={NONE:``,OCTAHEDRAL:`meshopt_decodeFilterOct`,QUATERNION:`meshopt_decodeFilterQuat`,EXPONENTIAL:`meshopt_decodeFilterExp`},u={ATTRIBUTES:`meshopt_decodeVertexBuffer`,TRIANGLES:`meshopt_decodeIndexBuffer`,INDICES:`meshopt_decodeIndexSequence`},d=[],f=0;function p(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function m(e){for(var t=`var instance; var ready = WebAssembly.instantiate(new Uint8Array([`+new Uint8Array(s(i))+`]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;`+c.toString()+g.toString(),n=new Blob([t],{type:`text/javascript`}),r=URL.createObjectURL(n),a=0;a<e;++a)d[a]=p(r);URL.revokeObjectURL(r)}function h(e,t,n,r,i){for(var a=d[0],o=1;o<d.length;++o)d[o].pending<a.pending&&(a=d[o]);return new Promise(function(o,s){var c=new Uint8Array(n),l=f++;a.pending+=e,a.requests[l]={resolve:o,reject:s},a.object.postMessage({id:l,count:e,size:t,source:c,mode:r,filter:i},[c.buffer])})}function g(e){o.then(function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);c(a.exports[t.mode],n,t.count,t.size,t.source,a.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:`resolve`,value:n},[n.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:`reject`,value:e})}})}return{ready:o,supported:!0,useWorkers:function(e){m(e)},decodeVertexBuffer:function(e,t,n,r,i){c(a.exports.meshopt_decodeVertexBuffer,e,t,n,r,a.exports[l[i]])},decodeIndexBuffer:function(e,t,n,r){c(a.exports.meshopt_decodeIndexBuffer,e,t,n,r)},decodeIndexSequence:function(e,t,n,r){c(a.exports.meshopt_decodeIndexSequence,e,t,n,r)},decodeGltfBuffer:function(e,t,n,r,i,o){c(a.exports[u[i]],e,t,n,r,a.exports[l[o]])},decodeGltfBufferAsync:function(e,t,n,r,i){return d.length>0?h(e,t,n,u[r],l[i]):o.then(function(){var o=new Uint8Array(e*t);return c(a.exports[u[r]],o,e,t,n,a.exports[l[i]]),o})}}})(),hd=`EXT_meshopt_compression`,gd=class extends Mu{loadBufferView(e,t){let n=t.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[hd]){let e=r.extensions[hd],i=t.loadBuffer(e.buffer);if(!md.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(hd)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return Promise.all([i,md.ready]).then(([t])=>{let n=e.byteOffset||0,r=e.byteLength||0,i=e.count,a=e.byteStride,o=new ArrayBuffer(i*a),s=new Uint8Array(t,n,r);return md.decodeGltfBuffer(new Uint8Array(o),i,a,s,e.mode,e.filter),o})}else return null}},_d=`EXT_texture_webp`,vd=class extends Mu{constructor(){super(...arguments),this.supportsWep=!1}prepare(e){return lc().then(e=>{this.supportsWep=e.webp})}loadTexture(e,t){let n=t.json.textures[e];if(!n.extensions||!n.extensions[_d]||!this.supportsWep)return null;let r=n.extensions[_d];return t.loadImage(r.source).then(e=>{let r=new c.Texture(e);r.needsUpdate=!0,r.flipY=!1,n.name&&(r.name=n.name);let i=(t.json.samplers||{})[n.sampler]||{};return r.magFilter=gu[i.magFilter]||c.LinearFilter,r.minFilter=gu[i.minFilter]||c.LinearMipmapLinearFilter,r.wrapS=_u[i.wrapS]||c.RepeatWrapping,r.wrapT=_u[i.wrapT]||c.RepeatWrapping,r.onUpdate=function(){e.close()},r})}},yd=`CESIUM_RTC`,bd=class extends Mu{emitResult(e,t){if(t.json.extensions[yd]&&t.json.extensions[yd].center){let n=t.json.extensions[yd].center;e.CESIUM_RTC={center:new c.Vector3().fromArray(n)}}}},xd=`REALSEE_materials_lightmap`,Sd=class extends Mu{extendMaterial(e,t,n){var r;let i=[];if(n.json.materials&&t.material!==void 0){let a=(r=n.json.materials[t.material].extensions)==null?void 0:r[xd];a&&(a.lightMapTexture!==void 0&&i.push(n.createMaterialTexture(a.lightMapTexture).then(t=>{e.lightMap=t})),a.lightMapIntensity!==void 0&&(e.lightMapIntensity=a.lightMapIntensity))}return Promise.all(i).then(()=>{})}},Cd=`KHR_gaussian_splatting`,wd=class extends Mu{loadMeshPrimitive(e,t,n){var r;let i=(r=t.extensions)==null?void 0:r[Cd];return i?this.loadGaussianSplating(i,n):null}loadGaussianSplating(e,t){return an(this,void 0,void 0,function*(){if(`extensions`in e&&e.extensions.KHR_gaussian_splatting_compression_spz_2){let n=t.extensions.KHR_gaussian_splatting_compression_spz_2;if(n)return n.load(e.extensions.KHR_gaussian_splatting_compression_spz_2,t)}if(`compression`in e&&e.compression.extension===`KHR_gaussian_splatting_compression_spz`){let n=t.extensions.KHR_gaussian_splatting_compression_spz;if(n)return n.load({bufferView:e.bufferView},t)}return Promise.resolve(new c.Points)})}},Td=new Float32Array(1),Ed=new Uint32Array(Td.buffer),Dd=typeof Float16Array<`u`,Od=Dd?new Float16Array(1):null,kd=Dd?new Uint16Array(Od.buffer):new Uint16Array(1);function Ad(e){if(Dd&&Od)return kd[0]=e,Od[0];let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0)if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return Ed[0]=i,Td[0]}var jd=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t);this.reader=n.getReader()}read(e){return an(this,void 0,void 0,function*(){for(;this.totalBytes<e;){let{value:e,done:t}=yield this.reader.read();if(t)break;this.chunks.push(e),this.totalBytes+=e.length}if(this.totalBytes<e)throw Error(`Unexpected EOF: needed ${e}, got ${this.totalBytes}`);let t=new Uint8Array(this.totalBytes),n=0;for(let e of this.chunks)t.set(e,n),n+=e.length;let r=t.subarray(0,e);return this.chunks=[t.subarray(e)],this.totalBytes-=e,r})}},Md=.28209479177387814,Nd=class{constructor({fileBytes:e}){this.version=-1,this.numSplats=0,this.shDegree=0,this.fractionalBits=0,this.flags=0,this.flagAntiAlias=!1,this.reserved=0,this.headerParsed=!1,this.parsed=!1,this.fileBytes=e instanceof ArrayBuffer?new Uint8Array(e):e,this.reader=new jd({fileBytes:this.fileBytes})}parseHeader(){return an(this,void 0,void 0,function*(){if(this.headerParsed)throw Error(`SPZ file header already parsed`);let e=new DataView((yield this.reader.read(16)).buffer);if(e.getUint32(0,!0)!==1347635022)throw Error(`Invalid SPZ file`);if(this.version=e.getUint32(4,!0),this.version<1||this.version>3)throw Error(`Unsupported SPZ version: ${this.version}`);this.numSplats=e.getUint32(8,!0),this.shDegree=e.getUint8(12),this.fractionalBits=e.getUint8(13),this.flags=e.getUint8(14),this.flagAntiAlias=(this.flags&1)!=0,this.reserved=e.getUint8(15),this.headerParsed=!0,this.parsed=!1})}parseSplats(e,t,n,r,i,a){return an(this,void 0,void 0,function*(){if(!this.headerParsed)throw Error(`SPZ file header must be parsed first`);if(this.parsed)throw Error(`SPZ file already parsed`);if(this.parsed=!0,this.version===1){let t=yield this.reader.read(this.numSplats*3*2),n=new Uint16Array(t.buffer);for(let t=0;t<this.numSplats;t++){let r=t*3,i=Ad(n[r]),a=Ad(n[r+1]),o=Ad(n[r+2]);e==null||e(t,i,a,o)}}else if(this.version===2||this.version===3){let t=1<<this.fractionalBits,n=yield this.reader.read(this.numSplats*3*3);for(let r=0;r<this.numSplats;r++){let i=r*9,a=((n[i+2]<<24|n[i+1]<<16|n[i]<<8)>>8)/t,o=((n[i+5]<<24|n[i+4]<<16|n[i+3]<<8)>>8)/t,s=((n[i+8]<<24|n[i+7]<<16|n[i+6]<<8)>>8)/t;e==null||e(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats);for(let n=0;n<this.numSplats;n++)t==null||t(n,e[n]/255)}{let e=yield this.reader.read(this.numSplats*3),t=Md/.15;for(let r=0;r<this.numSplats;r++){let i=r*3,a=(e[i]/255-.5)*t+.5,o=(e[i+1]/255-.5)*t+.5,s=(e[i+2]/255-.5)*t+.5;n==null||n(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,i=Math.exp(e[n]/16-10),a=Math.exp(e[n+1]/16-10),o=Math.exp(e[n+2]/16-10);r==null||r(t,i,a,o)}}if(this.version===3){let e=1/Math.sqrt(2),t=yield this.reader.read(this.numSplats*4);for(let n=0;n<this.numSplats;n++){let r=n*4,a=[0,0,0,0],o=[t[r],t[r+1],t[r+2],t[r+3]],s=o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24),c=s>>>30,l=s,u=0;for(let t=3;t>=0;--t)if(t!==c){let n=l&511,r=l>>>9&1;l>>>=10,a[t]=n/511*e,a[t]=r===0?a[t]:-a[t],u+=a[t]*a[t]}let d=1-u;a[c]=Math.sqrt(Math.max(d,0)),i==null||i(n,a[0],a[1],a[2],a[3])}}else{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,r=e[n]/127.5-1,a=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-a*a-o*o));i==null||i(t,r,a,o,s)}}if(a&&this.shDegree>=1){let e={1:3,2:8,3:15}[this.shDegree]||0,t=yield this.reader.read(this.numSplats*e*3),n=new Float32Array(9),r=this.shDegree>=2?new Float32Array(15):void 0,i=this.shDegree>=3?new Float32Array(21):void 0,o=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[o+e]-128)/128;if(o+=9,r){for(let e=0;e<15;++e)r[e]=(t[o+e]-128)/128;o+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[o+e]-128)/128;o+=21}let s=new Float32Array(n),c=r?new Float32Array(r):void 0,l=i?new Float32Array(i):void 0;a==null||a(e,s,c,l)}}})}};function Pd(e){return an(this,void 0,void 0,function*(){let t=new Nd({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),i=new Uint8Array(n*4),a=new Float32Array(n*3),o=new Float32Array(n*4),s,c,l;return t.shDegree>=1&&(s=new Float32Array(n*9)),t.shDegree>=2&&(c=new Float32Array(n*15)),t.shDegree>=3&&(l=new Float32Array(n*21)),yield t.parseSplats((e,t,n,i)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=i},(e,t)=>{i[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{i[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),i[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),i[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{a[e*3]=t,a[e*3+1]=n,a[e*3+2]=r},(e,t,n,r,i)=>{o[e*4]=i,o[e*4+1]=t,o[e*4+2]=n,o[e*4+3]=r},(e,t,n,r)=>{s&&t&&s.set(t,e*9),c&&n&&c.set(n,e*15),l&&r&&l.set(r,e*21)}),new At({numPoints:n,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l,shDegree:t.shDegree})})}function Fd(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?qs:i,l=(a=t.onDownloadProgress)==null?K:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>Pd(new Uint8Array(e))).then(t=>(o===`Z`&&(t.applyMatrix4(js),t.updateMatrix(),t.updateMatrixWorld(!0),t.transformChanged=!0),{type:`spz`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:fl(t),scene:t,textures:[],animations:[],dispose:()=>t.dispose()}))}var Id={KHR_binary_glTF:Pu,KHR_draco_mesh_compression:Vu,KHR_texture_basisu:Qu,KHR_texture_transform:ed,KHR_mesh_quantization:td,KHR_materials_unlit:nd,KHR_node_visibility:id,KHR_animation_pointer:ad,KHR_materials_clearcoat:sd,KHR_materials_sheen:ld,KHR_materials_transmission:dd,KHR_materials_emissive_strength:pd,EXT_meshopt_compression:gd,EXT_texture_webp:vd,CESIUM_RTC:bd,REALSEE_materials_lightmap:Sd,KHR_gaussian_splatting:wd,KHR_gaussian_splatting_compression_spz:class extends Mu{load(e,t){return an(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return an(this,void 0,void 0,function*(){return Promise.resolve().then(()=>Pd(e)).then(e=>(e.applyMatrix4(js),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}},KHR_gaussian_splatting_compression_spz_2:class extends Mu{constructor(){super()}load(e,t){return an(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return an(this,void 0,void 0,function*(){return Promise.resolve().then(()=>Pd(e)).then(e=>(e.applyMatrix4(js),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}}};function Ld(e,t){var n,r,i;let a={},o,s;if(typeof e==`string`)s=e;else if(Id.KHR_binary_glTF.getMagic(e)===Id.KHR_binary_glTF.HEADER_MAGIC){o=new Id.KHR_binary_glTF;try{o.loadGlbBinary(e)}catch(e){return Promise.reject(e)}a.KHR_binary_glTF=o,s=o.content}else s=pu(new Uint8Array(e));let c=JSON.parse(s);if(t.jsonModify&&(c=t.jsonModify(c)),c.asset===void 0||Number(c.asset.version[0])<2)return Promise.reject(Error(`glTF: Unsupported asset. glTF versions >=2.0 are supported.`));if(c.extensionsUsed){let e=c.extensionsRequired||[];for(let t=0;t<c.extensionsUsed.length;t++){let n=c.extensionsUsed[t];a[n]||(Id[n]?a[n]=new Id[n]:e.indexOf(n)>=0&&console.warn(`glTF: Unknown extension "`+n+`".`))}}return new Du(c,a,{copyUV2:(n=t.copyUV2)==null?!1:n,resourcePath:(r=t.resourcePath)==null?``:r,search:(i=t.search)==null?``:i,fetcher:t.fetcher}).parse().then(e=>(o&&o.clear(),e))}function Rd(e,t={}){var n,r,i,a,o;let s=(n=t.modelUpAxis)==null?`Y`:n,l=(r=t.upAxis)==null?`Z`:r,u=(i=t.fetcher)==null?qs:i,d=(a=t.onDownloadProgress)==null?K:a,f=(o=t.jsonModify)==null?K:o,p=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>(p=e.body.byteLength,e.body))).then(n=>{var r;return Ld(n,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var n,r,i;if(t.light===!1){let t=`KHR_materials_unlit`;if(e.extensionsUsed=(n=e.extensionsUsed)==null?[]:n,e.extensionsUsed.indexOf(t)===-1&&e.extensionsUsed.push(t),e.materials)for(let n of e.materials)n.extensions=(r=n.extensions)==null?{}:r,n.extensions[t]={}}return(i=f(e))==null?e:i},fetcher:u})}).then(t=>{var n;let r=new c.Matrix4;if(s===`Y`&&r.premultiply(As),t.CESIUM_RTC){let e=new c.Matrix4().setPosition(t.CESIUM_RTC.center);r.premultiply(e)}return l===`Y`&&r.premultiply(js),t.scene.applyMatrix4(r),{type:`gltf`,modelUpAxis:s,upAxis:l,uri:e,byteLength:p,memoryUsage:fl(t.scene),scene:t.scene,textures:t.textures,animations:t.animations,rtcCenter:(n=t.CESIUM_RTC)==null?void 0:n.center,dispose:()=>t.dispose()}})}var zd;(function(e){e[e.Outside=-1]=`Outside`,e[e.Intersecting=0]=`Intersecting`,e[e.Inside=1]=`Inside`})(zd||(zd={}));var Bd=1e-6,Vd=new c.Matrix4().identity(),Hd=new c.Vector3,Ud=new c.Matrix4,Wd=new c.Vector3,Gd=new c.Vector3,Kd=new c.Vector3,qd=new c.Vector3,Jd=new c.Box3,Yd=new c.Sphere,Xd=new c.Matrix4,Zd=new c.Ray,Qd=new c.Object3D,$d=new c.Frustum;function ef(e,t){let n=e.elements;return t.setFromRotationMatrix(Ud.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 tf=class e{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(e=[]){this.planes=e}setFromFrustum(e){return this.planes=e.planes.map(e=>e.clone()),this}setFromCamera(e){return Ud.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),$d.setFromProjectionMatrix(Ud),this.setFromFrustum($d),this}applyMatrix4(e){for(let t of this.planes)t.applyMatrix4(e)}copy(e){return this.planes=e.planes.map(e=>e.clone()),this}clone(){return new e().copy(this)}computeVisibility(e){let t=zd.Inside;for(let n of this.planes)switch(e.intersectPlane(n)){case zd.Outside:return zd.Outside;case zd.Intersecting:t=zd.Intersecting;break;default:}return t}computeVisibilityWithPlaneMask(t,n){if(n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;let r=e.MASK_INSIDE,i=Math.min(32,this.planes.length);for(let a=0;a<i;++a){let i=1<<a;if((n&i)===0)continue;let o=this.planes[a],s=t.intersectPlane(o);if(s===zd.Outside)return e.MASK_OUTSIDE;s===zd.Intersecting&&(r|=i)}return r}},nf=class e{constructor(){this.type=`box`,this.center=new c.Vector3,this.halfSize=new c.Vector3,this.rotation=new c.Matrix3}fromJson({box:e}){this.center.set(e[0],e[1],e[2]);let t=e[3],n=e[4],r=e[5],i=e[6],a=e[7],o=e[8],s=e[9],c=e[10],l=e[11],u=Math.max(Math.sqrt(t*t+n*n+r*r),.001),d=Math.max(Math.sqrt(i*i+a*a+o*o),.001),f=Math.max(Math.sqrt(s*s+c*c+l*l),.001);this.halfSize.set(u,d,f);let p=this.halfSize.toArray().reduce((e,t)=>e+t,0);return(isNaN(p)||p<=0)&&this.halfSize.setScalar(Bd),this.rotation.fromArray([t/u,n/u,r/u,i/d,a/d,o/d,s/f,c/f,l/f]),isNaN(this.rotation.toArray().reduce((e,t)=>e+t,0))&&this.rotation.identity(),this}toJson(){return this.rotation.extractBasis(Wd,Gd,Kd),{box:[...this.center.toArray(),...Wd.multiplyScalar(this.halfSize.x).toArray(),...Gd.multiplyScalar(this.halfSize.y).toArray(),...Kd.multiplyScalar(this.halfSize.z).toArray()]}}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return new e().copy(this)}applyMatrix4(e){return e.equals(Vd)?this:(Qd.position.copy(this.center),ef(this.rotation,Qd.quaternion),Qd.scale.copy(this.halfSize),Qd.matrix.compose(Qd.position,Qd.quaternion,Qd.scale),Qd.matrix.premultiply(e),Qd.matrix.decompose(Qd.position,Qd.quaternion,Qd.scale),this.center.copy(Qd.position),this.rotation.setFromMatrix4(Ud.makeRotationFromQuaternion(Qd.quaternion)),this.halfSize.copy(Qd.scale),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.rotation.elements,n=e.x-this.center.x,r=e.y-this.center.y,i=e.z-this.center.z,a=0,o;return o=n*t[0]+r*t[1]+i*t[2],o<0&&(o=-o),o-=this.halfSize.x,o>0&&(a+=o*o),o=n*t[3]+r*t[4]+i*t[5],o<0&&(o=-o),o-=this.halfSize.y,o>0&&(a+=o*o),o=n*t[6]+r*t[7]+i*t[8],o<0&&(o=-o),o-=this.halfSize.z,o>0&&(a+=o*o),a}distanceToPoint(e){return Math.sqrt(this.distanceSquaredToPoint(e))}distanceToPlane(e){let t=e.projectPoint(this.center,new c.Vector3);return this.distanceToPoint(t)}getBoundingBox(e){return e.makeEmpty(),this.rotation.extractBasis(Wd,Gd,Kd),Wd.setLength(this.halfSize.x),Gd.setLength(this.halfSize.y),Kd.setLength(this.halfSize.z),e.expandByPoint(Hd.copy(this.center).add(Wd)),e.expandByPoint(Hd.copy(this.center).sub(Wd)),e.expandByPoint(Hd.copy(this.center).add(Gd)),e.expandByPoint(Hd.copy(this.center).sub(Gd)),e.expandByPoint(Hd.copy(this.center).add(Kd)),e.expandByPoint(Hd.copy(this.center).sub(Kd)),e}toGeometry(){let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);Hd.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,0),Hd.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,3),Hd.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,6),Hd.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,9),Hd.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,12),Hd.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,15),Hd.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,18),Hd.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(t,21);let n=new c.BufferGeometry;return n.setIndex(new c.BufferAttribute(e,1)),n.setAttribute(`position`,new c.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n}intersectPlane(e){let t=this.center,n=e.normal,r=this.rotation.elements,i=this.halfSize,a=n.x,o=n.y,s=n.z,c=Math.abs(a*r[0]*i.x+o*r[1]*i.x+s*r[2]*i.x)+Math.abs(a*r[3]*i.y+o*r[4]*i.y+s*r[5]*i.y)+Math.abs(a*r[6]*i.z+o*r[7]*i.z+s*r[8]*i.z),l=n.dot(t)+e.constant;return l<=-c?zd.Outside:l>=c?zd.Inside:zd.Intersecting}intersectRay(e,t=0,n){if(qd.copy(this.halfSize).multiplyScalar(2),Jd.setFromCenterAndSize(Hd.set(0,0,0),qd),Jd.expandByScalar(t),this.rotation.extractBasis(Wd,Gd,Kd),Ud.makeBasis(Wd,Gd,Kd),Ud.setPosition(this.center),Xd.copy(Ud).invert(),Zd.copy(e).applyMatrix4(Xd),Jd.containsPoint(Zd.origin))return!0;let r=Zd.intersectBox(Jd,Hd);return r?n===void 0?!0:(n+=t,r.distanceToSquared(Zd.origin)<=n*n):!1}},rf=class e{constructor(){this.type=`sphere`,this.center=new c.Vector3,this.radius=-1}fromJson({sphere:e}){return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],Bd),this}toJson(){return{sphere:[...this.center.toArray(),this.radius]}}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}clone(){return new e().copy(this)}getBoundingBox(e){return e.setFromCenterAndSize(this.center,qd.set(1,1,1).multiplyScalar(this.radius*2)),e}toGeometry(){let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+Math.sin(n)*this.radius,e[t*6+2]=this.center.z+0,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+Math.sin(n)*this.radius,e[t*6+5]=this.center.z+0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+0,e[t*6+2]=this.center.z+Math.sin(n)*this.radius,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+0,e[t*6+5]=this.center.z+Math.sin(n)*this.radius}let t=new c.BufferGeometry;return t.setAttribute(`position`,new c.BufferAttribute(e,3)),t.computeBoundingBox(),t.computeBoundingSphere(),t}applyMatrix4(e){return e.equals(Vd)?this:(this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.distanceToPoint(e);return t*t}distanceToPoint(e){let t=this.center.distanceTo(e)-this.radius;return t<=0?0:t}distanceToPlane(e){let t=Math.abs(e.distanceToPoint(this.center));return Math.max(0,t-this.radius)}intersectPlane(e){let t=this.center,n=this.radius,r=e.normal.dot(t)+e.constant;return r<-n?zd.Outside:r<n?zd.Intersecting:zd.Inside}intersectRay(e,t=0,n){if(Yd.set(this.center,this.radius+t),Yd.containsPoint(e.origin))return!0;let r=e.intersectSphere(Yd,Hd);return r?n===void 0?!0:(n+=t,e.origin.distanceToSquared(r)<=n*n):!1}},af=class e{constructor(){throw this.type=`regin`,this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,Error(`Region bounding volume not supported.`)}fromJson({region:e}){return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this}toJson(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}}copy(e){return this.west=e.west,this.south=e.south,this.east=e.east,this.north=e.north,this.minHeight=e.minHeight,this.maxHeight=e.maxHeight,this}clone(){return new e().copy(this)}getBoundingBox(e){throw Error(`not implemented`)}toGeometry(){throw Error(`not implemented`)}applyMatrix4(e){throw Error(`not implemented`)}getCenter(e){throw Error(`not implemented`)}distanceToPoint(e){throw Error(`not implemented`)}distanceSquaredToPoint(e){throw Error(`not implemented`)}distanceToPlane(e){throw Error(`not implemented`)}intersectPlane(e){throw Error(`not implemented`)}intersectRay(e,t=0,n){throw Error(`not implemented`)}};function of(e){return e instanceof nf||e instanceof rf||e instanceof af}function sf(e){if(of(e))return e;if(`box`in e)return new nf().fromJson(e);if(`sphere`in e)return new rf().fromJson(e);if(`region`in e)return new af().fromJson(e);throw Error(`BoundingVolume ${JSON.stringify(e)} never suppored.`)}var cf=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(e=>new c.LineBasicMaterial({color:e,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})),lf=(()=>{let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),t=new Float32Array(24);Hd.set(1,1,1).toArray(t,0),Hd.set(-1,1,1).toArray(t,3),Hd.set(-1,-1,1).toArray(t,6),Hd.set(1,-1,1).toArray(t,9),Hd.set(1,1,-1).toArray(t,12),Hd.set(-1,1,-1).toArray(t,15),Hd.set(-1,-1,-1).toArray(t,18),Hd.set(1,-1,-1).toArray(t,21);let n=new c.BufferGeometry;return n.setIndex(new c.BufferAttribute(e,1)),n.setAttribute(`position`,new c.BufferAttribute(t,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n})(),uf=(()=>{let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=Math.sin(n),e[t*6+2]=0,n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=Math.sin(n),e[t*6+5]=0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=0,e[t*6+2]=Math.sin(n),n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=0,e[t*6+5]=Math.sin(n)}let t=new c.BufferGeometry;return t.setAttribute(`position`,new c.BufferAttribute(e,3)),t.computeBoundingBox(),t.computeBoundingSphere(),t})();function df(e,t=0){if(e instanceof nf){let n=new c.LineSegments(lf,cf[Math.min(t,cf.length-1)]);return n.position.copy(e.center),ef(e.rotation,n.quaternion),n.scale.set(e.halfSize.x,e.halfSize.y,e.halfSize.z),n.matrix.compose(n.position,n.quaternion,n.scale),n}else if(e instanceof rf){let n=new c.LineSegments(uf,cf[Math.min(t,cf.length-1)]);return n.position.copy(e.center),n.scale.set(e.radius,e.radius,e.radius),n.matrix.compose(n.position,n.quaternion,n.scale),n}return null}var ff=new c.Vector3,pf=new c.Plane,mf=new rf,hf=new nf,gf=class e{constructor(t,n,r,i){var a,o,s,l;this.parent=null,this.contentParent=null,this.floor=0,this.id=t,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,centerScreenY:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=i==null?null:i,this.contentParent=i?i.hasRenderContent?i:i.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=r,this.refine=(a=n.refine)==null?this.parent?this.parent.refine:`REPLACE`:a,this.transform=new c.Matrix4,n.transform&&this.transform.fromArray(n.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof n.geometricError==`number`?this.geometricError=n.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(s=(o=this.parent)==null?void 0:o.geometricError)==null?0:s,n.content&&n.content.uri?(this.content={uri:n.content.uri,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:G(),loadfailRetryDelay:0,byteLength:0,memoryUsage:0},n.content.group!==void 0&&(this.content.group=n.content.group),/\.json$/.test(this.content.uri)?this.type=`TILESET`:this.type=`SCENEGRAPH`):(this.content=null,this.type=`EMPTY`),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type===`SCENEGRAPH`&&(this.levelOfContent+=1),n.boundingVolume&&(this.boundingVolume=sf(n.boundingVolume).applyMatrix4(this.transform)),n.viewerRequestVolume&&(this.viewerRequestVolume=sf(n.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(l=n.extras)==null?{}:l,typeof this.extras.floor!=`number`&&i&&typeof i.extras.floor==`number`&&(this.extras.floor=i.extras.floor),typeof this.extras.floor==`number`&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),n.children?this.children=n.children.map((t,n)=>new e(`${this.id}.${n}`,t,r,this)):this.children=[]}traverse(e){e(this);for(let t of this.children)t.traverse(e)}updateState(e){this.state.frameNumber=e.frameNumber;let t=this.tileset.transform;if(this.boundingVolume){let n;n=this.boundingVolume instanceof nf?hf.copy(this.boundingVolume):this.boundingVolume instanceof rf?mf.copy(this.boundingVolume):this.boundingVolume.clone(),n.applyMatrix4(t),e.camera.type===`OrthographicCamera`?(pf.setFromNormalAndCoplanarPoint(e.camera.direction,e.camera.position),this.state.distanceToCamera=n.distanceToPlane(pf)):this.state.distanceToCamera=n.distanceToPoint(e.camera.position);let r=n.getCenter(ff).sub(e.camera.position);this.state.centerZDepth=e.camera.direction.dot(r),this.state.centerScreenY=e.camera.up.dot(r);let i=this.parent?this.parent.state.visibilityPlaneMask:tf.MASK_INDETERMINATE;this.state.visibilityPlaneMask=e.cullingVolume.computeVisibilityWithPlaneMask(n,i),this.state.visible=this.state.visibilityPlaneMask!==tf.MASK_OUTSIDE,e.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=tf.MASK_INDETERMINATE,this.state.visible=!0;if((this.levelOfContent<=e.minLevelOfDetail||this.geometricError>=e.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){let n;n=this.viewerRequestVolume instanceof nf?hf.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof rf?mf.copy(this.viewerRequestVolume):this.viewerRequestVolume.clone(),n.applyMatrix4(t),this.state.inRequestVolume=n.distanceSquaredToPoint(e.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(e,this.state.distanceToCamera,!1)}get selected(){return this.state.selectedFrameNumber===this.tileset.frameNumber}get hasChildren(){return this.children.length>0}get siblingIndex(){var e,t;return(t=(e=this.parent)==null?void 0:e.children.indexOf(this))==null?0:t}get hasTilesetContent(){return this.children.length>0&&this.type===`TILESET`}get hasRenderContent(){return this.type===`SCENEGRAPH`}get contentAvailable(){var e;return this.hasRenderContent&&((e=this.content)==null?void 0:e.loadState)===`READY`}get hasUnloadedContent(){var e;return((e=this.content)==null?void 0:e.loadState)===`UNLOADED`}get hasEmptyContent(){return this.type===`EMPTY`}get contentReady(){var e;return((e=this.content)==null?void 0:e.loadState)===`READY`||this.hasEmptyContent}get contentByteLength(){return this.content?this.content.byteLength:0}get contentMemoryUsage(){return this.content?this.content.memoryUsage:0}getScreenSpaceError(e,t,n){let r=this.tileset.transform.getMaxScaleOnAxis(),i=this.parent?this.parent.geometricError:this.tileset.geometricError,a=r*(n?i:this.geometricError);if(a===0)return 0;let o=e.height,s=e.sseDenominator;return e.camera.type===`OrthographicCamera`?a/(1/(e.camera.projectionMatrix.elements[5]/2)/o*.9):a/(Math.max(t,.001)*s/o)}getPriority(e){let t=this.refine===`ADD`||e.skipLevelOfDetail;if(t&&!this.state.visible||e.frameNumber-this.state.touchedFrameNumber>=1)return-1;let n=this.parent,r=n&&(!t||this.state.screenSpaceError===0)?n.state.screenSpaceError:this.state.screenSpaceError,i=this.tileset.root?this.tileset.root.state.screenSpaceError:0;return Math.max(i-r,0)}},_f=e=>Number(e);function vf(e,t=_f,n=!1){let r,i=1/0;for(let n of e){let e=t(n);e<=i&&(r=n,i=e)}return isFinite(i)||(i=0),n?[r,i]:r}function yf(e,t,n=(e,t)=>e===t){let r=e.length;if(r!==t.length)return!1;for(let i=0;i<r;i++)if(n(e[i],t[i])===!1)return!1;return!0}var bf=new Set;function xf(e){bf.clear();let t=[],n=e.length;for(let r=0;r<n;r++){let n=e[r];bf.has(n)||(t.push(n),bf.add(n))}return bf.clear(),t}var Sf=e=>e.distance,Cf=(e,t)=>e.distance-t.distance;function wf(e,t=!0,n=!1){if(n&&e.length>1){let t=vf(e,Sf);t?(e[0]=t,e.length=1):e.length=0}return t&&e.length>1&&e.sort(Cf),e}var Tf=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){var e,t;let n=this.indices,r=this.position;return n?n.array.length/((e=n.stride)==null?1:e):r.array.length/((t=r.stride)==null?3:t)}getPositionByIndex(e,t){var n,r,i,a;let o=this.indices,s=this.position,c=e;if(o){let t=o.array,i=(n=o.stride)==null?1:n,a=(r=o.offset)==null?0:r;c=t[e*i+a]}let l=s.array,u=(i=s.stride)==null?3:i,d=(a=s.offset)==null?0:a;return c=c*u+d,t.x=l[c],t.y=l[c+1],t.z=l[c+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},Ef=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function Df(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function Of(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var kf=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},Af=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},jf=class{constructor(e,t){this.min=e,this.max=t}},Mf=1e-6,Nf=new kf(0,0,0),Pf=new kf(0,0,0),Ff=new kf(0,0,0),If=new kf(0,0,0),Lf=class extends Tf{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionCount()/3,i=r>65535?new Uint32Array(r):new Uint16Array(r),a=new Float32Array(r*6),o=[],s=0,c=-1;if(n)for(let e=0;e<r;e+=1){let t=e*3,n=e*6,r,o,s,c,l,u,d;i[e]=e,this.getPositionByIndex(t,Pf),this.getPositionByIndex(t+1,Ff),this.getPositionByIndex(t+2,If),r=c=Pf.x,d=Ff.x,d<r&&(r=d),d>c&&(c=d),d=If.x,d<r&&(r=d),d>c&&(c=d),o=l=Pf.y,d=Ff.y,d<o&&(o=d),d>l&&(l=d),d=If.y,d<o&&(o=d),d>l&&(l=d),s=u=Pf.z,d=Ff.z,d<s&&(s=d),d>u&&(u=d),d=If.z,d<s&&(s=d),d>u&&(u=d),a[n]=r,a[n+1]=o,a[n+2]=s,a[n+3]=c,a[n+4]=l,a[n+5]=u}else{let e=1/0,t=1/0,o=1/0,s=-1/0,c=-1/0,l=-1/0;for(let n=0;n<r;n+=1){let r=n*3,u=n*6,d,f,p,m,h,g,_;i[n]=n,this.getPositionByIndex(r,Pf),this.getPositionByIndex(r+1,Ff),this.getPositionByIndex(r+2,If),d=m=Pf.x,_=Ff.x,_<d&&(d=_),_>m&&(m=_),_=If.x,_<d&&(d=_),_>m&&(m=_),f=h=Pf.y,_=Ff.y,_<f&&(f=_),_>h&&(h=_),_=If.y,_<f&&(f=_),_>h&&(h=_),p=g=Pf.z,_=Ff.z,_<p&&(p=_),_>g&&(g=_),_=If.z,_<p&&(p=_),_>g&&(g=_),a[u]=d,a[u+1]=f,a[u+2]=p,a[u+3]=m,a[u+4]=h,a[u+5]=g,d<e&&(e=d),m>s&&(s=m),f<t&&(t=f),h>c&&(c=h),p<o&&(o=p),g>l&&(l=g)}n=[e,t,o,s,c,l]}let l=new Ef(++c,n,0,r,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let r=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2],d.sort(f);for(let u=0;u<3;u++){let f=d[u],m=p[f]+p[f+3],h=r,g=l-1,_=-1,v;for(;h<=g;)_===-1?(v=i[h],a[v*6+f]+a[v*6+f+3]<m?h++:_=v):(v=i[g],a[v*6+f]+a[v*6+f+3]>=m?g--:(i[h]=v,i[g]=_,_=-1,h++,g--));if(h>r&&h<l){let u=new Ef(++c,zf(i,a,r,h,Mf),r,h,n.deepth+1);u.deepth<t&&u.endIndex-u.startIndex>e&&(o[s++]=u);let d=new Ef(++c,zf(i,a,h,l,Mf),h,l,n.deepth+1);d.deepth<t&&d.endIndex-d.startIndex>e&&(o[s++]=d),n.node0=u,n.node1=d,n.startIndex=0,n.endIndex=0;break}}}for(;s;)p(o[--s]);return this.offsetArray=i,this.rootNodePacked=Df(l,c+1),o.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],c=[],l;for(;(l=s.pop())!==void 0;){let r=l*36/4,u=Rf(e.x,i[r],i[r+3])-e.x,d=Rf(e.y,i[r+1],i[r+4])-e.y,f=Rf(e.z,i[r+2],i[r+5])-e.z;if(u*u+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];c.push(e)}let i=l*36/2,u=o[i+16],d=o[i+17];u&&s.push(u),d&&s.push(d)}}let u=c.length,d=new Float32Array(u*9);for(let e=0;e<u;e++){let t=c[e]*3;this.getPositionByIndex(t,Nf),d[e*9]=Nf.x,d[e*9+1]=Nf.y,d[e*9+2]=Nf.z,this.getPositionByIndex(t+1,Nf),d[e*9+3]=Nf.x,d[e*9+4]=Nf.y,d[e*9+5]=Nf.z,this.getPositionByIndex(t+2,Nf),d[e*9+6]=Nf.x,d[e*9+7]=Nf.y,d[e*9+8]=Nf.z}return d}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=new kf(1/t.x,1/t.y,1/t.z),f=[0],p,m=1/0,h=new jf(new kf(0,0,0),new kf(0,0,0)),g=new kf(0,0,0),_=new kf(0,0,0),v=new kf(0,0,0);for(;(p=f.pop())!==void 0;){let s=p*36/4;h.min.x=c[s],h.min.y=c[s+1],h.min.z=c[s+2],h.max.x=c[s+3],h.max.y=c[s+4],h.max.z=c[s+5];let y=Of(e,d,h,n);if(y===null||r&&y>m)continue;let b=e.x,x=e.y,S=e.z,C=t.x,w=t.y,T=t.z,E=l[s+6],D=l[s+7];for(let e=E;e<D;e++){let t=o[e],n=t*3;this.getPositionByIndex(n,g);let s=g.x,c=g.y,l=g.z;this.getPositionByIndex(n+1,_);let u=_.x,d=_.y,f=_.z;this.getPositionByIndex(n+2,v);let p=v.x,h=v.y,y=v.z,E=u-s,D=d-c,O=f-l,k=p-s,A=h-c,j=y-l,M=D*j-O*A,N=O*k-E*j,ee=E*A-D*k,P=C*M+w*N+T*ee,F;if(P>0)F=1;else if(P<0)F=-1,P=-P;else continue;let te=b-s,ne=x-c,I=S-l,re=F*(C*(ne*j-I*A)+w*(I*k-te*j)+T*(te*A-ne*k));if(re<0)continue;let ie=F*(C*(D*I-O*ne)+w*(O*te-E*I)+T*(E*ne-D*te));if(ie<0||re+ie>P)continue;let L=-F*(te*M+ne*N+I*ee);if(L<0)continue;let ae=L/P,R=new Af(g,_,v,t,new kf(b+C*ae,x+w*ae,S+T*ae));(!i||i(R))&&(r?ae<m&&(m=ae,a.length>0&&(a.length=0),a.push(R)):a.push(R))}let O=p*36/2,k=u[O+16],A=u[O+17];k&&f.push(k),A&&f.push(A)}return a}};function Rf(e,t,n){return e<t?t:e>n?n:e}function zf(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new kf(0,0,0),t=new kf(0,0,0),n=new kf(0,0,0),r=new kf(0,0,0);return function(i,a,o,s,c){t.subVectors(a,i),n.subVectors(o,i),r.crossVectors(t,n);let l=c.dot(r),u;if(l>0)u=1;else if(l<0)u=-1,l=-l;else return null;e.subVectors(s,i);let d=u*c.dot(n.crossVectors(e,n));if(d<0)return null;let f=u*c.dot(t.cross(e));if(f<0||d+f>l)return null;let p=-u*e.dot(r);if(p<0)return null;let m=p/l;return new kf(0,0,0).copy(c).multiplyScalar(m).add(s)}})();var Bf=1e-6,Vf=[`x`,`y`,`z`],Hf=new kf(0,0,0),Uf=class extends Tf{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionByIndex.bind(this),i=this.getPositionCount(),a=i>65535?new Uint32Array(i):new Uint16Array(i),o=[],s=0,c=-1;if(n)for(let e=0;e<i;e+=1)a[e]=e;else{r(0,Hf);let e=Hf.x,t=Hf.y,o=Hf.z,s=e,c=t,l=o;for(let n=0;n<i;n+=1){a[n]=n,r(n,Hf);let i=Hf.x,u=Hf.y,d=Hf.z;i<e?e=i:i>s&&(s=i),u<t?t=u:u>c&&(c=u),d<o?o=d:d>l&&(l=d)}n=[e,t,o,s,c,l]}let l=new Ef(++c,n,0,i,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let i=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2];let m=d.sort(f)[0],h=Vf[m],g=(p[m]+p[m+3])/2,_=i,v=l-1,y=-1,b;for(;_<=v;)y===-1?(b=a[_],r(b,Hf),Hf[h]<g?_++:y=b):(b=a[v],r(b,Hf),Hf[h]>=g?v--:(a[_]=b,a[v]=y,y=-1,_++,v--));if(_>i){let r=p.slice();r[m+3]=g+Bf;let a=new Ef(++c,r,i,_,n.deepth+1);a.deepth<t&&a.endIndex-a.startIndex>e&&(o[s++]=a),n.node0=a}if(l>_){let r=p.slice();r[m]=g-Bf;let i=new Ef(++c,r,_,l,n.deepth+1);i.deepth<t&&i.endIndex-i.startIndex>e&&(o[s++]=i),n.node1=i}n.startIndex=0,n.endIndex=0}for(;s;)p(o[--s]);return this.offsetArray=a,this.rootNodePacked=Df(l,c+1),o.length=0,this}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=n*n,f=new kf(1/t.x,1/t.y,1/t.z),p=[0],m,h=1/0,g=new jf(new kf(0,0,0),new kf(0,0,0)),_=new kf(0,0,0);for(;(m=p.pop())!==void 0;){let s=m*36/4;g.min.x=c[s],g.min.y=c[s+1],g.min.z=c[s+2],g.max.x=c[s+3],g.max.y=c[s+4],g.max.z=c[s+5];let v=Of(e,f,g,n);if(v===null||r&&v>h)continue;let y=l[s+6],b=l[s+7];for(let n=y;n<b;n++){let s=o[n];this.getPositionByIndex(s,_);let c=_.x,l=_.y,u=_.z,f=e.x,p=e.y,m=e.z,g=t.x,v=t.y,y=t.z,b=g*(c-f)+v*(l-p)+y*(u-m);if(b>0?(f+=g*b,p+=v*b,m+=y*b):b<0&&(b=0),g=c-f,v=l-p,y=u-m,g*g+v*v+y*y<=d){let e=new Af(_,_,_,s,new kf(f,p,m));(!i||i(e))&&(r?b<h&&(h=b,a.length>0&&(a.length=0),a.push(e)):a.push(e))}}let x=m*36/2,S=u[x+16],C=u[x+17];S&&p.push(S),C&&p.push(C)}return a}},Wf="(function(){var e=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){var e,t;let n=this.indices,r=this.position;return n?n.array.length/((e=n.stride)==null?1:e):r.array.length/((t=r.stride)==null?3:t)}getPositionByIndex(e,t){var n,r,i,a;let o=this.indices,s=this.position,c=e;if(o){let t=o.array,i=(n=o.stride)==null?1:n,a=(r=o.offset)==null?0:r;c=t[e*i+a]}let l=s.array,u=(i=s.stride)==null?3:i,d=(a=s.offset)==null?0:a;return c=c*u+d,t.x=l[c],t.y=l[c+1],t.z=l[c+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},t=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function n(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function r(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var i=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},a=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},o=class{constructor(e,t){this.min=e,this.max=t}};let s=1e-6,c=new i(0,0,0),l=new i(0,0,0),u=new i(0,0,0),d=new i(0,0,0);var f=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionCount()/3,o=a>65535?new Uint32Array(a):new Uint16Array(a),c=new Float32Array(a*6),f=[],p=0,h=-1;if(i)for(let e=0;e<a;e+=1){let t=e*3,n=e*6,r,i,a,s,f,p,m;o[e]=e,this.getPositionByIndex(t,l),this.getPositionByIndex(t+1,u),this.getPositionByIndex(t+2,d),r=s=l.x,m=u.x,m<r&&(r=m),m>s&&(s=m),m=d.x,m<r&&(r=m),m>s&&(s=m),i=f=l.y,m=u.y,m<i&&(i=m),m>f&&(f=m),m=d.y,m<i&&(i=m),m>f&&(f=m),a=p=l.z,m=u.z,m<a&&(a=m),m>p&&(p=m),m=d.z,m<a&&(a=m),m>p&&(p=m),c[n]=r,c[n+1]=i,c[n+2]=a,c[n+3]=s,c[n+4]=f,c[n+5]=p}else{let e=1/0,t=1/0,n=1/0,r=-1/0,s=-1/0,f=-1/0;for(let i=0;i<a;i+=1){let a=i*3,p=i*6,m,h,g,_,v,y,b;o[i]=i,this.getPositionByIndex(a,l),this.getPositionByIndex(a+1,u),this.getPositionByIndex(a+2,d),m=_=l.x,b=u.x,b<m&&(m=b),b>_&&(_=b),b=d.x,b<m&&(m=b),b>_&&(_=b),h=v=l.y,b=u.y,b<h&&(h=b),b>v&&(v=b),b=d.y,b<h&&(h=b),b>v&&(v=b),g=y=l.z,b=u.z,b<g&&(g=b),b>y&&(y=b),b=d.z,b<g&&(g=b),b>y&&(y=b),c[p]=m,c[p+1]=h,c[p+2]=g,c[p+3]=_,c[p+4]=v,c[p+5]=y,m<e&&(e=m),_>r&&(r=_),h<t&&(t=h),v>s&&(s=v),g<n&&(n=g),y>f&&(f=y)}i=[e,t,n,r,s,f]}let g=new t(++h,i,0,a,0);f[p++]=g;let _=[],v=[0,1,2],y=function(e,t){return _[t]-_[e]};function b(n){let i=n.startIndex,a=n.endIndex,l=n.extents;_[0]=l[3]-l[0],_[1]=l[4]-l[1],_[2]=l[5]-l[2],v.sort(y);for(let u=0;u<3;u++){let d=v[u],g=l[d]+l[d+3],_=i,y=a-1,b=-1,x;for(;_<=y;)b===-1?(x=o[_],c[x*6+d]+c[x*6+d+3]<g?_++:b=x):(x=o[y],c[x*6+d]+c[x*6+d+3]>=g?y--:(o[_]=x,o[y]=b,b=-1,_++,y--));if(_>i&&_<a){let l=new t(++h,m(o,c,i,_,s),i,_,n.deepth+1);l.deepth<r&&l.endIndex-l.startIndex>e&&(f[p++]=l);let u=new t(++h,m(o,c,_,a,s),_,a,n.deepth+1);u.deepth<r&&u.endIndex-u.startIndex>e&&(f[p++]=u),n.node0=l,n.node1=u,n.startIndex=0,n.endIndex=0;break}}}for(;p;)b(f[--p]);return this.offsetArray=o,this.rootNodePacked=n(g,h+1),f.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],l=[],u;for(;(u=s.pop())!==void 0;){let r=u*36/4,c=p(e.x,i[r],i[r+3])-e.x,d=p(e.y,i[r+1],i[r+4])-e.y,f=p(e.z,i[r+2],i[r+5])-e.z;if(c*c+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];l.push(e)}let i=u*36/2,c=o[i+16],d=o[i+17];c&&s.push(c),d&&s.push(d)}}let d=l.length,f=new Float32Array(d*9);for(let e=0;e<d;e++){let t=l[e]*3;this.getPositionByIndex(t,c),f[e*9]=c.x,f[e*9+1]=c.y,f[e*9+2]=c.z,this.getPositionByIndex(t+1,c),f[e*9+3]=c.x,f[e*9+4]=c.y,f[e*9+5]=c.z,this.getPositionByIndex(t+2,c),f[e*9+6]=c.x,f[e*9+7]=c.y,f[e*9+8]=c.z}return f}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=new i(1/t.x,1/t.y,1/t.z),g=[0],_,v=1/0,y=new o(new i(0,0,0),new i(0,0,0)),b=new i(0,0,0),x=new i(0,0,0),S=new i(0,0,0);for(;(_=g.pop())!==void 0;){let o=_*36/4;y.min.x=f[o],y.min.y=f[o+1],y.min.z=f[o+2],y.max.x=f[o+3],y.max.y=f[o+4],y.max.z=f[o+5];let d=r(e,h,y,n);if(d===null||s&&d>v)continue;let C=e.x,w=e.y,T=e.z,E=t.x,D=t.y,O=t.z,k=p[o+6],A=p[o+7];for(let e=k;e<A;e++){let t=u[e],n=t*3;this.getPositionByIndex(n,b);let r=b.x,o=b.y,d=b.z;this.getPositionByIndex(n+1,x);let f=x.x,p=x.y,m=x.z;this.getPositionByIndex(n+2,S);let h=S.x,g=S.y,_=S.z,y=f-r,k=p-o,A=m-d,j=h-r,M=g-o,N=_-d,P=k*N-A*M,F=A*j-y*N,I=y*M-k*j,L=E*P+D*F+O*I,R;if(L>0)R=1;else if(L<0)R=-1,L=-L;else continue;let z=C-r,B=w-o,V=T-d,H=R*(E*(B*N-V*M)+D*(V*j-z*N)+O*(z*M-B*j));if(H<0)continue;let U=R*(E*(k*V-A*B)+D*(A*z-y*V)+O*(y*B-k*z));if(U<0||H+U>L)continue;let W=-R*(z*P+B*F+V*I);if(W<0)continue;let G=W/L,K=new a(b,x,S,t,new i(C+E*G,w+D*G,T+O*G));(!c||c(K))&&(s?G<v&&(v=G,l.length>0&&(l.length=0),l.push(K)):l.push(K))}let j=_*36/2,M=m[j+16],N=m[j+17];M&&g.push(M),N&&g.push(N)}return l}};function p(e,t,n){return e<t?t:e>n?n:e}function m(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new i(0,0,0),t=new i(0,0,0),n=new i(0,0,0),r=new i(0,0,0);return function(a,o,s,c,l){t.subVectors(o,a),n.subVectors(s,a),r.crossVectors(t,n);let u=l.dot(r),d;if(u>0)d=1;else if(u<0)d=-1,u=-u;else return null;e.subVectors(c,a);let f=d*l.dot(n.crossVectors(e,n));if(f<0)return null;let p=d*l.dot(t.cross(e));if(p<0||f+p>u)return null;let m=-d*e.dot(r);if(m<0)return null;let h=m/u;return new i(0,0,0).copy(l).multiplyScalar(h).add(c)}})();let h=1e-6,g=[`x`,`y`,`z`],_=new i(0,0,0);var v=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionByIndex.bind(this),o=this.getPositionCount(),s=o>65535?new Uint32Array(o):new Uint16Array(o),c=[],l=0,u=-1;if(i)for(let e=0;e<o;e+=1)s[e]=e;else{a(0,_);let e=_.x,t=_.y,n=_.z,r=e,c=t,l=n;for(let i=0;i<o;i+=1){s[i]=i,a(i,_);let o=_.x,u=_.y,d=_.z;o<e?e=o:o>r&&(r=o),u<t?t=u:u>c&&(c=u),d<n?n=d:d>l&&(l=d)}i=[e,t,n,r,c,l]}let d=new t(++u,i,0,o,0);c[l++]=d;let f=[],p=[0,1,2],m=function(e,t){return f[t]-f[e]};function v(n){let i=n.startIndex,o=n.endIndex,d=n.extents;f[0]=d[3]-d[0],f[1]=d[4]-d[1],f[2]=d[5]-d[2];let v=p.sort(m)[0],y=g[v],b=(d[v]+d[v+3])/2,x=i,S=o-1,C=-1,w;for(;x<=S;)C===-1?(w=s[x],a(w,_),_[y]<b?x++:C=w):(w=s[S],a(w,_),_[y]>=b?S--:(s[x]=w,s[S]=C,C=-1,x++,S--));if(x>i){let a=d.slice();a[v+3]=b+h;let o=new t(++u,a,i,x,n.deepth+1);o.deepth<r&&o.endIndex-o.startIndex>e&&(c[l++]=o),n.node0=o}if(o>x){let i=d.slice();i[v]=b-h;let a=new t(++u,i,x,o,n.deepth+1);a.deepth<r&&a.endIndex-a.startIndex>e&&(c[l++]=a),n.node1=a}n.startIndex=0,n.endIndex=0}for(;l;)v(c[--l]);return this.offsetArray=s,this.rootNodePacked=n(d,u+1),c.length=0,this}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=n*n,g=new i(1/t.x,1/t.y,1/t.z),_=[0],v,y=1/0,b=new o(new i(0,0,0),new i(0,0,0)),x=new i(0,0,0);for(;(v=_.pop())!==void 0;){let o=v*36/4;b.min.x=f[o],b.min.y=f[o+1],b.min.z=f[o+2],b.max.x=f[o+3],b.max.y=f[o+4],b.max.z=f[o+5];let d=r(e,g,b,n);if(d===null||s&&d>y)continue;let S=p[o+6],C=p[o+7];for(let n=S;n<C;n++){let r=u[n];this.getPositionByIndex(r,x);let o=x.x,d=x.y,f=x.z,p=e.x,m=e.y,g=e.z,_=t.x,v=t.y,b=t.z,S=_*(o-p)+v*(d-m)+b*(f-g);if(S>0?(p+=_*S,m+=v*S,g+=b*S):S<0&&(S=0),_=o-p,v=d-m,b=f-g,_*_+v*v+b*b<=h){let e=new a(x,x,x,r,new i(p,m,g));(!c||c(e))&&(s?S<y&&(y=S,l.length>0&&(l.length=0),l.push(e)):l.push(e))}}let w=v*36/2,T=m[w+16],E=m[w+17];T&&_.push(T),E&&_.push(E)}return l}};function y(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}y(e=>Promise.resolve(e).then(e=>{let t=[],n=new Set;for(let r of e){let e;if(r.type===`mesh`)e=new f(r.attributes.position,r.indices);else if(r.type===`points`)e=new v(r.attributes.position,r.indices);else throw Error(`Invalid Type`);e.createTree(r.maxItemPerNode,r.maxTreeDepth,r.extents);let i={type:r.type,attributes:r.attributes,indices:r.indices,offsetArray:e.offsetArray,rootNodePacked:e.rootNodePacked};t.push(i);let a;for(let e in i.attributes){let t=i.attributes[e],r=t==null?void 0:t.array;r&&r.buffer instanceof ArrayBuffer&&n.add(r.buffer)}a=i.indices;let o=a==null?void 0:a.array;o&&o.buffer instanceof ArrayBuffer&&n.add(o.buffer),a=i.offsetArray,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),n.add(i.rootNodePacked)}return{output:t,transfer:Array.from(n)}}))})();",Gf=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Wf],{type:`text/javascript;charset=utf-8`});function Kf(e){let t;try{if(t=Gf&&(self.URL||self.webkitURL).createObjectURL(Gf),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Wf),{name:e==null?void 0:e.name})}}var qf=class e{constructor(e,t,n,r,i){this.a=e,this.b=t,this.c=n,this.normal=r&&r instanceof c.Vector3?r:new u.Vector3,this.materialIndex=i===void 0?0:i}clone(){return new e(this.a,this.b,this.c).copy(this)}copy(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.normal instanceof c.Vector3&&e.normal instanceof c.Vector3&&this.normal.copy(e.normal),this.materialIndex=e.materialIndex,this}},Jf=new Hu(()=>new Kf,4),Yf=()=>!0,Xf=new c.Ray,Zf=new c.Matrix3,Qf=new c.Matrix4,$f=new c.Vector3,ep=new c.Vector3,tp=new c.Vector3,np=new c.Vector3,rp=new WeakMap;function ip(e,t,n,r){var i,a;let o=e.matrixWorld;Qf.copy(o).invert(),Xf.copy(n.ray).applyMatrix4(Qf);let s=(i=n.hitFilter)==null?Yf:i,l=(a=n.firstHitOnly)==null?!1:a,u=e.geometry,d=e.material,f=u.groups,p=u.index,m=t.intersectRay(Xf.origin,Xf.direction,0,l,t=>{var r;let i=t.index,a=i*3,l;if(Array.isArray(d)){if(f){for(let e of f)if(a>=e.start&&a-e.start<e.count){l=d[(r=e.materialIndex)==null?0:r];break}}}else l=d;if(!l)return!1;let u=t.intersectionPoint,m=new c.Vector3(u.x,u.y,u.z).applyMatrix4(o),h=n.ray.origin.distanceTo(m);if(h<n.near||h>n.far)return!1;let g=t.pointA,_=t.pointB,v=t.pointC,y=c.Triangle.getNormal($f.set(g.x,g.y,g.z).applyMatrix4(o),ep.set(_.x,_.y,_.z).applyMatrix4(o),tp.set(v.x,v.y,v.z).applyMatrix4(o),new c.Vector3),b=n.ray.direction.dot(y);if(l.side===c.FrontSide&&b>=0||l.side===c.BackSide&&b<=0)return!1;let x={distance:h,object:e,face:new qf(p?p.array[a]:a,p?p.array[a+1]:a+1,p?p.array[a+2]:a+2,y),point:m,distanceToRay:0,faceIndex:i};return rp.set(t,x),s(x)}),h=m.length;for(let e=0;e<h;e++){let t=rp.get(m[e]);t&&r.push(t)}m.length=0}function ap(e,t){if(t){let t=e.getAttribute(`instanceNormal`);if(t instanceof c.BufferAttribute||t instanceof c.InterleavedBufferAttribute)return t}let n=e.getAttribute(`normal`);if(n instanceof c.BufferAttribute||n instanceof c.InterleavedBufferAttribute)return n}function op(e){return e instanceof c.BufferAttribute||e instanceof c.InterleavedBufferAttribute}function sp(e,t,n,r,i,a,o=!0){var s,l,u,d;let f=e.matrixWorld;Zf.getNormalMatrix(f),Qf.copy(f).invert(),Xf.copy(r.ray).applyMatrix4(Qf);let p=((l=(s=r.params.Points)==null?void 0:s.threshold)==null?1:l)*Qf.getMaxScaleOnAxis(),m=(u=r.hitFilter)==null?Yf:u,h=(d=r.firstHitOnly)==null?!1:d,g=o?t.index:null,_=ap(t,a),v=op(_),y=null;if(!v&&e instanceof nn){let t=e.normals;Zt(t,e.numPoints)&&(y=t)}let b=n.intersectRay(Xf.origin,Xf.direction,p,h,n=>{let i=n.intersectionPoint,a=new c.Vector3(i.x,i.y,i.z).applyMatrix4(f),o=r.ray.origin.distanceTo(a);if(o<r.near||o>r.far)return!1;let s=n.pointA,l=$f.set(s.x,s.y,s.z).applyMatrix4(f),u=a.distanceTo(l);if(u/o>.07)return!1;let d=n.index,p=g?g.array[d]:d,h;if(v&&_)h=new qf(p,p,p,new c.Vector3().fromBufferAttribute(_,p).applyNormalMatrix(Zf));else if(y)Qt(y,p,np),np.lengthSq()>1e-12&&(np.applyNormalMatrix(Zf),h=new qf(p,p,p,np.clone()));else{let e=t.getAttribute(`scale`),n=t.getAttribute(`rotation`);if(e instanceof c.BufferAttribute&&n instanceof c.BufferAttribute){let t=new c.Vector3().fromBufferAttribute(e,p).toArray(),i=new c.Vector4().fromBufferAttribute(n,p).toArray(),a=new c.Quaternion(i[1],i[2],i[3],i[0]),[{axis:o}]=[{axis:`x`,scale:t[0]},{axis:`y`,scale:t[1]},{axis:`z`,scale:t[2]}].sort((e,t)=>e.scale-t.scale),s=new c.Vector3(0,0,0);s[o]=1,s.applyQuaternion(a).applyNormalMatrix(Zf),r.ray.direction.dot(s)>0&&s.negate(),h=new qf(p,p,p,s)}}let b={distance:o,object:e,face:h,point:a,distanceToRay:u,index:d};return rp.set(n,b),m(b)}),x=b.length;for(let e=0;e<x;e++){let t=rp.get(b[e]);t&&i.push(t)}b.length=0}function cp(e,t,n,r){sp(e,e.geometry,t,n,r,!1,!0)}var lp=`__bvh_mesh__`,up=c.Mesh.prototype.raycast;function dp(e,t){let n=fp(this);n?ip(this,n,e,t):up.call(this,e,t)}function fp(e){let t=e[lp];return t instanceof Lf,t}function pp(e,t){Object.assign(e,{[lp]:t,raycast:dp})}var mp=`__bvh_points__`,hp=`__bvh_point_cloud__`,gp=c.Points.prototype.raycast;function _p(e,t){let n=xp(this);n?cp(this,n,e,t):gp.call(this,e,t)}function vp(e,t){let n=Sp(this);n?bp(this,n,e,t):nn.prototype.raycast.call(this,e,t)}var yp=new c.BufferGeometry;function bp(e,t,n,r){sp(e,yp,t,n,r,!1,!1)}function xp(e){let t=e[mp];return t instanceof Uf,t}function Sp(e){let t=e[hp];return t instanceof Uf?t:null}function Cp(e,t){Object.assign(e,{[hp]:t,raycast:vp})}function wp(e,t){Object.assign(e,{[mp]:t,raycast:_p})}function Tp(e){let t=e.attributes.position;return t instanceof c.InterleavedBufferAttribute?{array:t.data.array,stride:t.data.stride,offset:t.offset}:t instanceof c.BufferAttribute?{array:t.array}:null}function Ep(e){let t=[];return e.traverse(e=>{if(e instanceof nn){t.push({kind:`pointCloud`,obj:e});return}if((e instanceof c.Mesh||e instanceof c.Points)&&e.geometry instanceof c.BufferGeometry){if(e instanceof c.Points){t.push({kind:`points`,obj:e});return}t.push({kind:`mesh`,obj:e})}}),t}function Dp(e,t=!0,n=100,r=10){let i=Ep(e);if(t){let t=[];return Promise.resolve().then(()=>{let e=[];t=[];let a=new Set,o=null;for(let s=0;s<i.length;s++){let l=i[s];if(l.kind===`pointCloud`){let i=l.obj,o=i.positions;if(!(o.buffer instanceof ArrayBuffer))continue;let s={type:`points`,attributes:{position:{array:o,stride:3}},maxItemPerNode:n,maxTreeDepth:r,extents:i.getLocalBoundingBoxExtents()};e.push(s),t.push(l),a.add(o.buffer);continue}let u=l.obj.geometry;if(!(u instanceof c.BufferGeometry))continue;let d;if(l.kind===`mesh`?d=`mesh`:l.kind===`points`&&(d=`points`),!d)continue;let f=u.boundingBox,p=f?[f.min.x,f.min.y,f.min.z,f.max.x,f.max.y,f.max.z]:void 0,m={};if(l.kind===`points`){let e=Tp(u);if(!e)continue;m.position={array:e.array,stride:e.stride,offset:e.offset},o=e.array,o&&o.buffer instanceof ArrayBuffer&&a.add(o.buffer)}else for(let e in u.attributes){let t=u.attributes[e];t instanceof c.InterleavedBufferAttribute?(m[e]={array:t.data.array,stride:t.data.stride,offset:t.offset},o=t.data.array,o&&o.buffer instanceof ArrayBuffer&&a.add(o.buffer)):(m[e]={array:t.array},o=t.array,o&&o.buffer instanceof ArrayBuffer&&a.add(o.buffer))}let h,g=u.getIndex();g&&(g instanceof c.InterleavedBufferAttribute?(h={array:g.data.array,stride:g.data.stride,offset:g.offset},o=g.data.array,o&&o.buffer instanceof ArrayBuffer&&a.add(o.buffer)):(h={array:g.array},o=g.array,o&&o.buffer instanceof ArrayBuffer&&a.add(o.buffer)));let _={type:d,attributes:m,indices:h,maxItemPerNode:n,maxTreeDepth:r,extents:p};e.push(_),t.push(l)}return Jf.postMessage(e,Array.from(a))}).then(n=>{var r;for(let e=0;e<n.length;e++){let i=t[e],a=n[e];if(!i||!a)continue;if(i.kind===`pointCloud`){let e=i.obj,t=(r=a.attributes.position)==null?void 0:r.array;t instanceof Float32Array&&e.swapPositionsBuffer(t);let n=new Uf(a.attributes.position,a.indices);n.offsetArray=a.offsetArray,n.rootNodePacked=a.rootNodePacked,Cp(e,n);continue}let o=i.obj,s=o.geometry;if(!(s instanceof c.BufferGeometry))continue;for(let e in a.attributes){let t=a.attributes[e].array,n=s.attributes[e];n&&(n instanceof c.InterleavedBufferAttribute?n.data.array=t:n.array=t)}let l=s.getIndex();if(l&&a.indices){let e=a.indices.array;l instanceof c.InterleavedBufferAttribute?l.data.array=e:l.array=e}if(i.kind===`mesh`){let e=new Lf(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,pp(o,e)}else if(i.kind===`points`){let e=new Uf(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,wp(o,e)}}return e})}else return Promise.resolve().then(()=>{for(let e of i)if(e.kind===`mesh`){let t=e.obj,i=t.geometry,a=i.boundingBox,o=a?[a.min.x,a.min.y,a.min.z,a.max.x,a.max.y,a.max.z]:void 0;if(i instanceof c.BufferGeometry){let e,a,s=i.attributes.position;e=s instanceof c.InterleavedBufferAttribute?{array:s.data.array,stride:s.data.stride,offset:s.offset}:{array:s.array};let l=i.getIndex();l&&(a=l instanceof c.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new Lf(e,a);u.createTree(n,r,o),pp(t,u)}}else if(e.kind===`points`){let t=e.obj,i=t.geometry,a=i.boundingBox,o=a?[a.min.x,a.min.y,a.min.z,a.max.x,a.max.y,a.max.z]:void 0;if(i instanceof c.BufferGeometry){let e=Tp(i),a;if(!e)continue;let s=i.getIndex();s&&(a=s instanceof c.InterleavedBufferAttribute?{array:s.data.array,stride:s.data.stride,offset:s.offset}:{array:s.array});let l=new Uf(e,a);l.createTree(n,r,o),wp(t,l)}}else if(e.kind===`pointCloud`){let t=e.obj,i=new Uf({array:t.positions,stride:3});i.createTree(n,r,t.getLocalBoundingBoxExtents()),Cp(t,i)}return e})}function Op(e,t,n){return e+(t-e)*n}function kp(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t,s=e;return i*Math.pow(r,3)+a*Math.pow(r,2)+o*r+s}function Ap(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t;return 3*i*Math.pow(r,2)+2*a*r+o}function jp(e,t,n,r){let i=r[1]-r[0];return e=Mp(e,r),t=Mp(t,r),t-e>i/2?Op(e+i,t,n):e-t>i/2?Op(e-i,t,n):Op(e,t,n)}function Mp(e,t){let n=t[1]-t[0];return e<t[0]?Mp(e+n,t):e>=t[1]?Mp(e-n,t):e}function Np(e,t,n,r){return r?jp(e,t,n,r):Op(e,t,n)}function Pp(e){let t=Number(e);return isNaN(t)||!isFinite(t)?0:t}var J=class{constructor(e){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=G(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(let t in e){let n=e[t];typeof n==`object`?(this.value[t]=Pp(n.value),this.config[t]={circle:n.circle}):(this.value[t]=Pp(n),this.config[t]={circle:!1})}this.keyframes=[{progress:0,value:Object.assign({},this.value)},{progress:1,value:Object.assign({},this.value)}]}getProgress(e){let t=e-this.startTime;return t<0?0:t>=this.duration?1:1-kp(1,this.startVelocity,this.duration,t)}getValue(e){for(let t=1;t<this.keyframes.length;t++)if(this.keyframes[t].progress>e){let n=this.keyframes[t-1],r=this.keyframes[t],i={};for(let t in this.config){let a=(e-n.progress)/(r.progress-n.progress);i[t]=Np(n.value[t],r.value[t],a,this.config[t].circle)}return i}return Object.assign({},this.keyframes[this.keyframes.length-1].value)}getProgressVelocity(e){let t=e-this.startTime;return t>=this.duration?0:Ap(1,this.startVelocity,this.duration,t)}update(e){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)}getKeyFrameSegment(e){let t=this.getProgress(e);for(let e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t)return[this.keyframes[e-1],this.keyframes[e]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]}getTargetKeyframe(){return this.keyframes[this.keyframes.length-1]}set(e,t,n=0,r){var i;isNaN(t)&&(t=0),isNaN(n)&&(n=0),r=r==null?G():r;let a=this.getProgress(r),o=this.getValue(a),s={};for(let t in this.config)s[t]=(i=e[t])==null?o[t]:i;let c=[{progress:0,value:o},{progress:1,value:s}];return this.setKeyframes(c,t,n,r)}setKeyframes(e,t,n=0,r){if(e.length<2)throw Error(`keyframes invalid.`);return isNaN(t)&&(t=0),isNaN(n)&&(n=0),this.callbacks&&(this.callbacks[1](Error(`motion aborted.`)),this.callbacks=void 0),new Promise((i,a)=>{r=r==null?G():r,this.progress=0,this.ended=!1,this.startTime=r,this.startVelocity=n,this.keyframes=e,this.duration=t,t===0?(this.progress=1,this.value=Object.assign({},e[e.length-1].value)):this.value=Object.assign({},e[0].value),this.callbacks=[i,a]})}dispose(){this.callbacks&&(this.callbacks[1](Error(`motion dispose.`)),this.callbacks=void 0)}},Fp=Math.PI;2*Fp/3,2*Fp/4.5;var Ip=function(e){return e},Lp=function(e){return e*e*e},Rp=function(e){return e*e*e*e},zp=500,Bp=new WeakMap,Vp=new c.Vector3,Hp=new c.Matrix4,Up=class e extends c.Object3D{constructor(e,t,n,r=K){super(),this.clippers=[],this.name=e,this.materials=[],this.pbmObjects=[],this.contentObject=t,this.animations=n,this.appearMotion=new J({appear:0}),this.disposers=[r],this.add(t),t.traverse(e=>{if(e instanceof c.Mesh||e instanceof c.Points){let t=e.material;if(Array.isArray(t))for(let e=0;e<t.length;e++)this.materials.push(t[e]);else this.materials.push(t)}(e instanceof Ot||e instanceof kt)&&this.pbmObjects.push(e),e instanceof nn&&this.pbmObjects.push(e)})}generateBvhTree(){return Dp(this,!0,200,20)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.hitFilter;e.hitFilter=t=>{if(t.object instanceof nn&&t.object.pointBack===`HIDDEN`&&t.face&&t.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;let n=0,i=-1;if((t.object instanceof Ot||t.object instanceof kt)&&t.face){let e=Array.isArray(t.object.material)?t.object.material[t.face.materialIndex]:t.object.material;if(e){n=e.floorIndex,i=e.shownFloorIndex;for(let e of this.clippers)if(!(typeof e.floorIndex==`number`&&e.floorIndex!==n)&&(Hp.copy(e.clippingBoxMatrix).invert(),Vp.copy(t.point).applyMatrix4(Hp),Math.abs(Vp.x)<.5&&Math.abs(Vp.y)<.5&&Math.abs(Vp.z)<.5))return!1}}if(t.object instanceof nn){n=t.object.floorIndex,i=t.object.shownFloorIndex;for(let e of this.clippers)if(!(typeof e.floorIndex==`number`&&e.floorIndex!==n)&&(Hp.copy(e.clippingBoxMatrix).invert(),Vp.copy(t.point).applyMatrix4(Hp),Math.abs(Vp.x)<.5&&Math.abs(Vp.y)<.5&&Math.abs(Vp.z)<.5))return!1}let a=i;return e.floorIndex===void 0?e.floor!==void 0&&(a=e.floor===null?-1:e.floor):a=e.floorIndex,a>=0&&n!==a?!1:(Object.assign(t,{floorIndex:n,floor:n}),r?r.call(e,t):!0)};let i=this.children.slice(),a;for(;a=i.pop();)if(a.visible){a.raycast(e,n);for(let e=0,t=a.children.length;e<t;e++)i.push(a.children[e])}return e.hitFilter=r,wf(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n,r,i,a){let o=!1;r.visible&&i.state.selectedFrameNumber===i.tileset.frameNumber?this.appearMotion.getTargetKeyframe().value.appear!==1&&this.appearMotion.set({appear:1},zp).catch(K):this.appearMotion.getTargetKeyframe().value.appear!==0&&this.appearMotion.set({appear:0},0).catch(K),this.appearMotion.ended!==!0&&this.appearMotion.update(t.time),this.clippers=a.clippers;for(let r of this.pbmObjects)r instanceof Ot||r instanceof kt?Wp(r,this.appearMotion,e,t,n,i,a)===!0&&(o=!0):r instanceof nn?Gp(r,this.appearMotion,e,t,n,i,a)===!0&&(o=!0):r instanceof At&&Kp(r,this.appearMotion,e,t,n,i,a)===!0&&(o=!0);return o}dispose(){for(let e of this.disposers)e();this.disposers.length=0,this.pbmObjects.length=0}clone(){return new e(this.name,this.contentObject.clone(),this.animations)}};function Wp(e,t,n,r,i,a,o){let s=!1;Bp.get(e)!==o.versionNumber&&(Bp.set(e,o.versionNumber),s=!0,e.castShadow=o.castShadow,e.receiveShadow=o.receiveShadow);let c=e.material;for(let e of c)Ut(e)&&Yt(e,o);return s}function Gp(e,t,n,r,i,a,o){var s,c;let l=!1;if(o.pointAppearAnimation===!0&&a.refine===`ADD`&&a.tileset.rootMeta.pntsOrder===`RANDOM`){let n=a.tileset.currentMaxScreenSpaceError,r=a.state.screenSpaceError,i=(c=(s=a.parent)==null?void 0:s.state.screenSpaceError)==null?r:c,o=1;i!==r&&(o=(i-n)/(i-r)),o=H(o,0,1),o=Lp(o);let u=Math.floor(e.pointCount*o*t.value.appear);e.visiblePointCount!==u&&(e.visiblePointCount=u,l=!0)}return Bp.get(e)!==o.versionNumber&&(Bp.set(e,o.versionNumber),l=!0,e.castShadow=o.castShadow,e.receiveShadow=o.receiveShadow,e.visible=o.modelAlpha>0,e.pointScale=o.pointScale,e.pointMinPixel=o.pointMinPixel,e.pointMaxPixel=o.pointMaxPixel,e.pointSize=o.pointSize,e.pointShape=o.pointShape,e.pointBack=o.pointBack,e.maxDisplayBoost=o.maxDisplayBoost,e.opacity=o.opacity,e.modelAlpha=o.modelAlpha,e.brightness=o.brightness,e.floorStyle=o.floorStyle,e.shownFloorIndex=o.shownFloorIndex,e.colorStyle=o.colorStyle,e.constantColor.copy(o.constantColor),e.colorSaturation=o.colorSaturation,e.colorBrightness=o.colorBrightness,e.outlineGain=o.outlineGain,e.distanceGain=o.distanceGain,e.useAddBlend=o.useAddBlend,e.gradientTexture=o.gradientTexture,e.vertexMarks=o.vertexMarks,e.clippers=o.clippers,e.modelBoundingMin.copy(o.boundingBox.min),e.modelBoundingMax.copy(o.boundingBox.max),e.styleRevision++,Yt(e.material,o)),l}function Kp(e,t,n,r,i,a,o){let s=!1;return e.updateMatrix(),e.updateMatrixWorld(),e.usedSHDegree=o.gaussianSplattingSHDegree,e.lastMatrixWorld?e.transformChanged=!e.lastMatrixWorld.equals(e.matrixWorld):(e.lastMatrixWorld=new c.Matrix4,e.transformChanged=!0,s=!0),e.lastMatrixWorld.copy(e.matrixWorld),e.transformChanged&&(s=!0),s}var qp=class{constructor(e,t,n){this.id=e,this.name=t.name,this.visible=!1,this.tileset=n,this.transform=new c.Matrix4,t.transform&&this.transform.fromArray(t.transform),this.transform.premultiply(this.tileset.root.transform),this.content={uri:t.file,byteLength:0,memoryUsage:0,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:G(),loadfailRetryDelay:0,data:void 0}}},Jp=class e extends c.Object3D{constructor(e,t,n=K){super(),this.name=e,this.contentObject=t,this.name=e,this.add(t),this.disposers=[n]}update(e,t,n,r,i,a){let o=this.contentObject.material[2];return o.uniforms.dashOffset.value=(o.uniforms.dashOffset.value-.003)%(o.uniforms.dashSize.value.x+o.uniforms.dashSize.value.y),!0}dispose(){for(let e of this.disposers)e();this.disposers.length=0}clone(){return new e(this.name,this.contentObject.clone())}},Yp=new Map;function Xp(e,t,n){if(n&&n.has(t))return n.get(t);let r=t.refine===`ADD`||e.skipLevelOfDetail,i=t.parent,a=i&&(!r||t.state.screenSpaceError===0)?i.state.screenSpaceError:t.state.screenSpaceError,o=t.tileset.root?t.tileset.root.state.screenSpaceError:0,s=Math.max(o-a,0);return n&&n.set(t,s),s}var Zp=class{constructor(e,t){this.tileset=e,this.options=t,this.activeRequests=0,this.requestQueue=[]}reset(){for(let e of this.requestQueue)this.options.onTileSkip&&(e.tile.content&&this.tileset.options.tileUnloader(e.tile),this.options.onTileSkip(e.tile));this.requestQueue.length=0}update(e,t,n){let r=n.time,i=this.requestQueue,a=new Set(e);for(let e=0;e<i.length;e++){let t=i[e];if(a.has(t.tile)){a.delete(t.tile);continue}t.status===`WAITING`&&(i.splice(e,1),e--,this.options.onTileSkip&&this.options.onTileSkip(t.tile))}a.size>0&&(a.forEach(e=>{i.push({tile:e,status:`WAITING`,time:r,error:null})}),a.clear());let o=n.maxRequests;for(let e=0;e<i.length&&o>0;e++){let t=i[e];if(t.status===`DONE`)t.error===null?(o--,t.tile.content&&(t.tile.content.loadState=`READY`),this.options.onTileLoad&&this.options.onTileLoad(t.tile)):this.options.onTileError&&this.options.onTileError(t.tile,t.error),i.splice(e,1),e--;else if(t.status===`PENDING`&&r-t.time<1e3)break}switch(Yp.clear(),t){case`SCREEN_SPACE_ERROR`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?Xp(n,e.tile,Yp)-Xp(n,t.tile,Yp):e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_LEVEL_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.level===t.tile.level?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level-t.tile.level:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;default:break}if(o=Math.max(n.maxRequests-this.activeRequests,0),!n.skipLevelOfDetail){let e=0,t=i.length;for(let r=0;r<t;r++){let t=i[r].tile;if(t.hasTilesetContent||t.contentParent===null||t.contentParent.state.selectedFrameNumber===n.frameNumber){let t=i.splice(r,1);i.splice(e++,0,...t)}}}for(let e=0;e<i.length&&o>0;e++){let t=i[e];t.status===`WAITING`&&(o--,t.status=`PENDING`,t.time=r,this.activeRequests++,this.tileset.options.tileLoader(t.tile).catch(e=>{t.error=e}).then(()=>{t.status=`DONE`,t.tile.content&&t.tile.content.loadState===`READY`&&(t.tile.content.loadState=`LOADING`),this.activeRequests--}))}}},Qp=class{constructor(e,t,n){this.item=e,this.previous=t,this.next=n}},$p=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(e){let t=new Qp(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t}remove(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--}splice(e,t){e!==t&&(this.remove(t),this.insert(e,t))}insert(e,t){let n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,this._length++}toArray(){let e=[],t=this.head;for(;t;)e.push(t),t=t.next;return e}},em=class{constructor(e={}){this.options=e,this.cacheNodeMap=new WeakMap,this.list=new $p,this.sentinel=this.list.add(`sentinel`)}reset(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)}touchTile(e){let t=this.cacheNodeMap.get(e);t&&this.list.splice(this.sentinel,t)}loadTile(e){if(!this.cacheNodeMap.has(e)){let t=this.list.add(e);this.cacheNodeMap.set(e,t),this.options.onTileLoad&&this.options.onTileLoad(e)}}unloadTile(e){let t=this.cacheNodeMap.get(e);t&&(this.list.remove(t),this.cacheNodeMap.delete(e),this.options.onTileUnload&&this.options.onTileUnload(e))}unloadTiles(e){let t=this.list.head;for(;t!==this.sentinel&&e();){let e=t.item;t=t.next,this.unloadTile(e)}}toArray(){let e=[];for(let t of this.list.toArray())t.item!==`sentinel`&&e.push(t.item);return e}},tm=class{constructor(){this.map=new Map,this.array=[],this._length=0}get length(){return this._length}get(e){return this.array[e]}set(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)}delete(e){let t=this.map.get(e);t!==void 0&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)}push(e){if(!this.map.has(e)){let t=this._length++;this.array[t]=e,this.map.set(e,t)}}pop(){let e=this.array[--this._length];return this.map.delete(e),this.array[this._length]=void 0,e}reset(){this.array=[],this.map=new Map,this._length=0}find(e){return this.map.has(e)}peek(){return this.array[this._length-1]}},nm=class{constructor(e){this.tileset=e,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new tm}traverse(e,t,n=[]){this.reset()}reset(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0}updateTile(e,t){this.updateTileVisibility(e,t),e.state.shouldSelect=!1,e.state.finalResolution=!0}selectTile(e,t){this._canSelectTile&&e.contentAvailable&&e.state.selectedFrameNumber<t.frameNumber&&(e.state.selectedFrameNumber=t.frameNumber,this.tileset.selectedTiles.push(e),this.tileset.needsRefinedTiles.add(e))}loadTile(e,t){this._canSelectTile&&(e.state.requestedFrameNumber<t.frameNumber&&(e.state.requestedFrameNumber=t.frameNumber,e.content&&(e.content.loadState===`FAILED`&&t.time-e.content.loadStateUpdateTime>e.content.loadfailRetryDelay&&(e.content.loadState=`UNLOADED`,e.content.loadProgress=0,e.content.loadStateUpdateTime=t.time),e.content.loadState===`UNLOADED`&&this.tileset.requestedTiles.push(e))),this.tileset.needsRefinedTiles.add(e))}touchTile(e,t){this._canSelectTile&&(this.tileset.cache.touchTile(e),e.state.touchedFrameNumber=t.frameNumber)}canTraverse(e,t){return!e.state.inRequestVolume||e.hasRenderContent&&(e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError)||e.children.length===0?!1:e.levelOfContent<t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.hasTilesetContent?!0:e.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError}updateTileVisibility(e,t){if(e.updateState(t),!e.state.visible||!e.state.inRequestVolume)return;let n=e.children.length>0;if(e.hasTilesetContent&&n){let n=e.children[0];this.updateTileVisibility(n,t),e.state.visible=n.state.visible;return}if(this.meetsScreenSpaceErrorEarly(e,t)){e.state.visible=!1;return}if(e.refine===`REPLACE`&&n&&!this.anyChildrenVisible(e,t)){e.state.visible=!1;return}}anyChildrenVisible(e,t){let n=!1,r=e.children;for(let e of r)e.updateState(t),n=n||e.state.visible;return n}meetsScreenSpaceErrorEarly(e,t){let{parent:n}=e;return!n||n.refine!==`ADD`||n.levelOfContent<t.minLevelOfDetail||n.geometricError>t.maxGeometricError?!1:n.levelOfContent>t.maxLevelOfDetail||n.levelOfContent>=0&&n.geometricError<t.minGeometricError?!0:e.getScreenSpaceError(t,e.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError}sortTilesByDistanceToCamera(e){e.sort((e,t)=>t.state.distanceToCamera===0&&e.state.distanceToCamera===0?t.state.centerZDepth-e.state.centerZDepth:t.state.distanceToCamera-e.state.distanceToCamera)}},rm=class extends nm{constructor(e){super(e),this._traversalStack=new tm,this._emptyTraversalStack=new tm}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t));this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop(),r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=e.refine===`REPLACE`&&e.hasRenderContent,a=!1,o=!0;for(let e of r)if(e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.find(e)&&n.delete(e),n.push(e),a===!1&&(a=!0)):(i||t.loadSiblings)&&(this.loadTile(e,t),this.touchTile(e,t)),i){let n;n=e.state.inRequestVolume?e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t):!1,o=o&&n}return a||(o=!1),o}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}executeEmptyTraversal(e,t){let n=!0,r=this._emptyTraversalStack;for(r.push(e);r.length>0&&n;){let e=r.pop(),i=!e.hasRenderContent&&this.canTraverse(e,t);if(!i&&!e.contentAvailable&&(n=!1),this.updateTile(e,t),e.state.visible||(this.loadTile(e,t),this.touchTile(e,t)),i){let t=e.children;for(let e of t)r.find(e)&&r.delete(e),r.push(e)}}return n}},im=class extends nm{constructor(e){super(e),this.baseScreenSpaceError=1024,this.skipScreenSpaceErrorFactor=16,this.skipLevels=1,this._traversalStack=new tm,this._descendantTraversalStack=new tm,this._selectionTraversalStack=new tm,this._selectionTraversalancestorStack=new tm}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t));this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop();this.updateTileAncestorContentLinks(e,t);let r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.inBaseTraversal(e,this.baseScreenSpaceError)?(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):o?(this.loadTile(e,t),this.selectDesiredTile(e,t)):this.reachedSkippingThreshold(e)&&this.loadTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=!1;for(let e of r)e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.push(e),i===!1&&(i=!0)):t.loadSiblings&&(this.loadTile(e,t),this.touchTile(e,t));return i}selectDesiredTile(e,t){let n=e.contentAvailable?e:e.state.ancestorWithContentAvailable;n&&(n.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,t)}selectDescendants(e,t){let n=this._descendantTraversalStack;for(n.push(e);n.length>0;){let e=n.pop().children;for(let r of e)r.state.visible&&(r.contentAvailable?(this.updateTile(r,t),this.touchTile(r,t),this.selectTile(r,t)):n.push(r))}}reachedSkippingThreshold(e){let t=e.state.ancestorWithContent;return t!==null&&e.state.screenSpaceError<t.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>t.levelOfContent+this.skipLevels}updateTileAncestorContentLinks(e,t){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;let{parent:n}=e;if(!n)return;let r=!(n.hasRenderContent&&n.hasUnloadedContent)||n.state.requestedFrameNumber===t.frameNumber;e.state.ancestorWithContent=r?n:n.state.ancestorWithContent,e.state.ancestorWithContentAvailable=n.contentAvailable?n:n.state.ancestorWithContentAvailable}inBaseTraversal(e,t){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>t:e.state.screenSpaceError>t:!0}traverseAndSelect(e,t){let n=this._selectionTraversalStack,r=this._selectionTraversalancestorStack,i;for(n.push(e);n.length>0||r.length>0;){if(r.length>0){let e=r.peek();if(e.state.stackLength===n.length){r.pop(),e!==i&&(e.state.finalResolution=!1),this.selectTile(e,t);continue}}let e=n.pop();if(!e)continue;let a=this.canTraverse(e,t);if(e.state.shouldSelect)if(e.refine===`ADD`)this.selectTile(e,t);else{if(e.state.selectionDepth=r.length,e.state.selectionDepth>0&&(e.tileset.hasMixedContent=!0),i=e,!a){this.selectTile(e,t);continue}r.push(e),e.state.stackLength=n.length}if(a)for(let t of e.children)t.state.visible&&n.push(t)}}},am=class extends nm{constructor(e){super(e),this._traversalStack=new tm}canTraverse(e,t){return!(!e.state.inRequestVolume||e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError||e.children.length===0)}traverse(e,t,n){super.traverse(e,t,[]),this._traversalStack.reset(),e.updateState(t);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t));this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(n.push(e);n.length>0;){let e=n.pop(),r=e.refine===`ADD`,i=e.refine===`REPLACE`,a=this.canTraverse(e,t);a&&this.updateAndPushChildren(e,t,n),(r||i&&!a)&&(this.loadTile(e,t),this.touchTile(e,t),this.selectDesiredTile(e,t))}}updateAndPushChildren(e,t,n){let{children:r}=e;for(let e=0;e<r.length;++e){let i=r[e];i.updateState(t),i.state.visible&&n.push(i)}}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}},om=class{constructor(e,t){var n,r,i,a,o,s,l;if(this.id=e.tilesetUrl,this.transform=new c.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.maxAverageTileMemory=0,this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||``,gltfUpAxis:(n=e.asset.gltfUpAxis)==null?`Y`:n,overview:e.asset.overview,trajectories:(i=(r=e.asset.trajectories)==null?void 0:r.list)==null?[]:i,extras:e.asset.extras},this.rootMeta=(a=e.rootMeta)==null?{}:a,this.pointLength=(o=this.rootMeta.numTotalPoints)==null?1/0:o,this.floorLength=(s=this.rootMeta.numFloors)==null?1:s,this.properties=(l=e.properties)==null?{}:l,this.options=t,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new rm(this),this.skipTraverser=new im(this),this.mostDetailTraverser=new am(this),this.cache=new em({onTileLoad:e=>{this.cacheMemoryUsageInBytes+=e.contentMemoryUsage},onTileUnload:e=>{this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.unloadTiles.push(e)}}),this.requestScheduler=new Zp(this,{onTileSkip:e=>{},onTileLoad:e=>{var t;(t=e.content)!=null&&t.data&&(this.loadedTiles.add(e),this.cache.loadTile(e)),this.options.onTileLoad(e)},onTileError:(e,t)=>{this.options.onTileError(e,t)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new gf(`${this.id}#tile:0`,e.root,this),this.geometricError=e.geometricError,this.trajectories=[],this.asset.trajectories)for(let e=0;e<this.asset.trajectories.length;e++){let t=new qp(`${this.id}#trajectory:${e}`,this.asset.trajectories[e],this);this.trajectories.push(t)}}adjustScreenSpaceError(e){if(e.frameNumber%20==0)if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=e.maxScreenSpaceError),e.memoryAdjustedScreenSpaceError){let t=0,n=0,r=0;if(this.needsRefinedTiles.forEach(e=>{e.content&&(n++,t+=e.content.memoryUsage,e.content.loadState===`READY`&&r++)}),r<2||n<2)this.currentMaxScreenSpaceError=e.maxScreenSpaceError;else{let i=1024*1024,a=t/r*n,o=e.maxMemoryUsage*i,s=o-H(o*.2,32*i,128*i),c=this.currentMaxScreenSpaceError;if(a<s){let e=.3*Math.max(1-a/s,0);c-=e}else a>o&&(c+=.15);c=H(c,.5,e.maxScreenSpaceError),Math.abs(c-this.currentMaxScreenSpaceError)>=.1&&(this.currentMaxScreenSpaceError=c)}}else this.currentMaxScreenSpaceError=e.maxScreenSpaceError}getTraverser(e){return e.mostDetail?this.mostDetailTraverser:e.skipLevelOfDetail?this.skipTraverser:this.normalTraverser}reset(){this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();let e=[this.root],t;for(;t=e.pop();){for(let n=0,r=t.children.length;n<r;n++)e.push(t.children[n]);this.cache.unloadTile(t)}for(;this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}this.loadedTiles.clear()}update(e,t=[]){for(this.frameNumber=e.frameNumber,this.adjustScreenSpaceError(e),this.cache.reset(),this.getTraverser(e).traverse(this.root,e,t),this.cache.unloadTiles(()=>this.cacheMemoryUsageInBytes>e.maxMemoryUsage*1024*1024),this.requestScheduler.update(this.requestedTiles,e.requestOrder,e);this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}}};function sm(e,t){var n;if(e.content){let r=(n=e.content.uri)==null?e.content.url:n;typeof r==`string`&&!Qs(r)&&(e.content.uri=nc(ec(t,r)))}if(e.transform){let t=!1;for(let n=0;n<16;n++){let r=e.transform[n];if(typeof r!=`number`||isNaN(r)||!isFinite(r)){t=!0;break}}if(e.transform[15]===0&&(t=!0),t)throw Error(`Invalid Tile Transform: `+JSON.stringify(e.transform))}if(e.children)for(let n of e.children)sm(n,t);return e}function cm(e,t){e.tilesetUrl=t;let n=/^blob\:/.test(t)?``:t.slice(0,t.lastIndexOf(`/`)+1);if(e.asset||(e.asset={}),e.rootMeta||(e.rootMeta={}),e.rootMeta.taskParameters||(e.rootMeta.taskParameters={}),e.asset.overview){let t=e.asset.overview;Qs(t.imageFile)||(t.imageFile=nc(ec(n,t.imageFile))),Qs(t.worldFile)||(t.worldFile=nc(ec(n,t.worldFile)))}if(e.asset.trajectories)for(let t=0;t<e.asset.trajectories.list.length;t++){let r=e.asset.trajectories.list[t];r.file=nc(ec(n,r.file))}return sm(e.root,n),e}function lm(e){return new Promise(t=>setTimeout(t,e))}var um=new class{constructor(e){this.queue=[],this.concurrency=e,this.dequeuing=0}add(e,t=1e3){let n,r,i=new Promise((e,t)=>{n=e,r=t});return this.queue.unshift(()=>{let i=Promise.resolve().then(e);i.then(n,r);let a=lm(t);return Promise.race([i,a]).then(K,K)}),this.dequeue(),i}dequeue(){for(;this.dequeuing<this.concurrency&&this.queue.length>0;){let e=this.queue.pop();this.dequeuing++,e().catch(K).then(()=>{this.dequeuing--,this.dequeue()})}}}(1),dm=256;function fm(e){let t=e.image;return!!t&&t.width>0&&t.height>0}function pm(e,t){if(!fm(e))return Promise.resolve(e);let n=e.image;if(n&&(n==null?void 0:n.width)<dm&&(n==null?void 0:n.width)<dm)return t.initTexture(e),Promise.resolve(e);let r=!1,i=()=>{r=!0,e.removeEventListener(`dispose`,i)};return e.addEventListener(`dispose`,i),um.add(()=>new Promise(n=>{Lc.shared.add(()=>{fm(e)&&r===!1&&t.initTexture(e),e.removeEventListener(`dispose`,i),n(e)},!0)}))}function mm(e,t){return Promise.all(e.map(e=>pm(e,t)))}var hm=4;function gm(e,t,n){let r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=hm,e.version=r.getUint32(n,!0),n+=hm,e.byteLength=r.getUint32(n,!0),n+=hm,e.version!==1)throw Error(`3D Tile Version ${e.version} not supported`);return n}var _m;(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`})(_m||(_m={}));var vm={[_m.DOUBLE]:Float64Array,[_m.FLOAT]:Float32Array,[_m.UNSIGNED_SHORT]:Uint16Array,[_m.UNSIGNED_INT]:Uint32Array,[_m.UNSIGNED_BYTE]:Uint8Array,[_m.BYTE]:Int8Array,[_m.SHORT]:Int16Array,[_m.INT]:Int32Array},ym={DOUBLE:_m.DOUBLE,FLOAT:_m.FLOAT,UNSIGNED_SHORT:_m.UNSIGNED_SHORT,UNSIGNED_INT:_m.UNSIGNED_INT,UNSIGNED_BYTE:_m.UNSIGNED_BYTE,BYTE:_m.BYTE,SHORT:_m.SHORT,INT:_m.INT};function bm(e){let t=vm[e];if(!t)throw Error(`Failed to convert GL type`);return t}function xm(e){return bm(e).BYTES_PER_ELEMENT}function Sm(e,t,n=0,r){let i=bm(e);return n%xm(e)===0?new i(t,n,r==null?(t.byteLength-n)/xm(e):r):new i(r?t.slice(n,n+r*xm(e)):t.slice(n))}function Cm(e){let t=ym[e];if(!t)throw Error(`Failed to convert GL type`);return t}var wm=class{constructor(e,t){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=t;let n=this.getGlobalProperty(`POINTS_LENGTH`,_m.UNSIGNED_INT,1);n&&n.length&&(this.featuresLength=n[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(bm(t))([r]):Array.isArray(r)?new(bm(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=Cm(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,o=a[e];return o||(o=Sm(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=o),o}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=Sm(t,n),r[e]=i),i}},Tm=4,Em=`b3dm tile in legacy format.`;function Dm(e,t,n){let r=new TextDecoder(`utf8`),i=new Uint8Array(e,t,n);return r.decode(i)}function Om(e,t,n){return n=km(e,t,n),n=Am(e,t,n),n=jm(e,t,n),n}function km(e,t,n){let r=new DataView(t),i=0;e.header=e.header||{};let a=r.getUint32(n,!0);n+=Tm;let o=r.getUint32(n,!0);n+=Tm;let s=r.getUint32(n,!0);n+=Tm;let c=r.getUint32(n,!0);return n+=Tm,s>=570425344?(n-=Tm*2,i=a,s=o,c=0,a=0,o=0,console.warn(Em)):c>=570425344&&(n-=Tm,i=s,s=a,c=o,a=0,o=0,console.warn(Em)),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=c,e.header.batchLength=i,n}function Am(e,t,n){let{featureTableJsonByteLength:r,featureTableBinaryByteLength:i,batchLength:a}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:a||0},r&&r>0){let i=Dm(t,n,r);e.featureTableJson=JSON.parse(i)}n+=r||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0;let o=new wm(e.featureTableJson,e.featureTableBinary);if(Array.isArray(o.json.RTC_CENTER)){let t=o.json.RTC_CENTER;e.rtcCenter=[t[0],t[1],t[2]]}else{let t=o.getGlobalProperty(`RTC_CENTER`,_m.FLOAT,3);t&&(e.rtcCenter=[t[0],t[1],t[2]])}return n}function jm(e,t,n){let{batchTableJsonByteLength:r,batchTableBinaryByteLength:i}=e.header||{};if(r&&r>0){let a=Dm(t,n,r);e.batchTableJson=JSON.parse(a),n+=r,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,n,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=i)}return n}function Mm(e,t,n){let r=n===void 0?new Uint8Array(e).subarray(t):new Uint8Array(e).subarray(t,t+n);return new Uint8Array(r).buffer}function Nm(e,t,n){let r=e.byteLength-n;if(r===0)throw Error(`glTF byte length must be greater than 0.`);return n%4!=0&&console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),e.gltfArrayBuffer=Mm(t,n,r),e.byteLength}function Pm(e,t={}){var n,r,i,a,o;let s=(n=t.modelUpAxis)==null?`Y`:n,l=(r=t.upAxis)==null?`Z`:r,u=(i=t.fetcher)==null?qs:i,d=(a=t.onDownloadProgress)==null?K:a,f=(o=t.jsonModify)==null?K:o,p={uri:e,gltfUpAxis:s},m=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>(m=e.body.byteLength,e.body))).then(e=>Promise.resolve(0).then(t=>gm(p,e,t)).then(t=>Om(p,e,t)).then(t=>Nm(p,e,t))).then(()=>{var n;return Ld(p.gltfArrayBuffer,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,jsonModify(e){var n,r,i;if(t.light===!1){let t=`KHR_materials_unlit`;if(e.extensionsUsed=(n=e.extensionsUsed)==null?[]:n,e.extensionsUsed.indexOf(t)===-1&&e.extensionsUsed.push(t),e.materials)for(let n of e.materials)n.extensions=(r=n.extensions)==null?{}:r,n.extensions[t]={}}return(i=f(e))==null?e:i},fetcher:u})}).then(t=>{let n=new c.Matrix4;s===`Y`&&n.premultiply(As);let r;if(p.rtcCenter?r=new c.Vector3().fromArray(p.rtcCenter):t.CESIUM_RTC&&(r=new c.Vector3().copy(t.CESIUM_RTC.center)),r){let e=new c.Matrix4().setPosition(r);n.premultiply(e)}return l===`Y`&&n.premultiply(js),t.scene.applyMatrix4(n),p.featureTableBinary=void 0,p.batchTableBinary=void 0,p.gltfArrayBuffer=void 0,{type:`b3dm`,modelUpAxis:s,upAxis:l,uri:e,byteLength:m,memoryUsage:fl(t.scene),scene:t.scene,textures:t.textures,animations:t.animations,rtcCenter:r,dispose:()=>t.dispose()}})}var Fm="(function(){function e(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}var t;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(t||(t={}));let n={[t.DOUBLE]:Float64Array,[t.FLOAT]:Float32Array,[t.UNSIGNED_SHORT]:Uint16Array,[t.UNSIGNED_INT]:Uint32Array,[t.UNSIGNED_BYTE]:Uint8Array,[t.BYTE]:Int8Array,[t.SHORT]:Int16Array,[t.INT]:Int32Array},r={DOUBLE:t.DOUBLE,FLOAT:t.FLOAT,UNSIGNED_SHORT:t.UNSIGNED_SHORT,UNSIGNED_INT:t.UNSIGNED_INT,UNSIGNED_BYTE:t.UNSIGNED_BYTE,BYTE:t.BYTE,SHORT:t.SHORT,INT:t.INT};function i(e){let t=n[e];if(!t)throw Error(`Failed to convert GL type`);return t}function a(e){return i(e).BYTES_PER_ELEMENT}function o(e,t,n=0,r){let o=i(e);return n%a(e)===0?new o(t,n,r==null?(t.byteLength-n)/a(e):r):new o(r?t.slice(n,n+r*a(e)):t.slice(n))}function s(e){let t=r[e];if(!t)throw Error(`Failed to convert GL type`);return t}var c=class{constructor(e,n){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=n;let r=this.getGlobalProperty(`POINTS_LENGTH`,t.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(i(t))([r]):Array.isArray(r)?new(i(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=s(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,s=a[e];return s||(s=o(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=s),s}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=o(t,n),r[e]=i),i}};e(e=>Promise.resolve(e).then(e=>{let t=new c(e.featureTableJson,e.featureTableBinary),n=u(t),r=d(t),i=p(t),a=[];return n&&a.push(n.array.buffer),r&&a.push(r.array.buffer),i&&a.push(i.array.buffer),{output:{position:n,color:r,normal:i},transfer:a}}));let l=65535;function u(e){if(e.hasProperty(`POSITION`))return{array:e.getPropertyArray(`POSITION`,t.FLOAT,3),itemSize:3,normalized:!1};if(e.hasProperty(`POSITION_QUANTIZED`)){let n=e.getPropertyArray(`POSITION_QUANTIZED`,t.UNSIGNED_SHORT,3),r=e.getGlobalProperty(`QUANTIZED_VOLUME_SCALE`,t.FLOAT,3),i=e.getGlobalProperty(`QUANTIZED_VOLUME_OFFSET`,t.FLOAT,3);if(!r||!i)throw Error(`QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.`);let a=new Float32Array(n.length),o=n.length/3,s=r[0]/l,c=r[1]/l,u=r[2]/l,d=i[0],f=i[1],p=i[2];for(let e=0,t;e<o;e++)t=e*3,a[t]=n[t]*s+d,a[++t]=n[t]*c+f,a[++t]=n[t]*u+p;return{array:a,itemSize:3,normalized:!1}}return null}function d(e){if(e.hasProperty(`RGB`)){let n=e.getPropertyArray(`RGB`,t.UNSIGNED_BYTE,3),r=n.length/3,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t],i[++a]=n[++t],i[++a]=n[++t];return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`RGBA`))return{array:e.getPropertyArray(`RGBA`,t.UNSIGNED_BYTE,4),itemSize:4,normalized:!0};else if(e.hasProperty(`RGB565`)){let n=e.getPropertyArray(`RGB565`,t.UNSIGNED_SHORT,1),r=n.length,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=n[e],t=e*4,i[t]=(a>>11&31)<<3,i[++t]=(a>>5&63)<<2,i[++t]=(a&31)<<3;return{array:i,itemSize:4,normalized:!0}}return null}let f=2/255;function p(e){if(e.hasProperty(`NORMAL`)){let n=e.getPropertyArray(`NORMAL`,t.FLOAT,3),r=n.length/3,i=new Int8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t]*127,i[++a]=n[++t]*127,i[++a]=n[++t]*127;return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`NORMAL_OCT16P`)){let n=e.getPropertyArray(`NORMAL_OCT16P`,t.UNSIGNED_BYTE,2),r=n.length/2,i=new Int8Array(r*4);for(let e=0,t,a,o,s,c,l,u;e<r;e++)t=e*2,a=n[t]*f-1,o=n[++t]*f-1,c=a<0?-a:a,l=o<0?-o:o,s=1-(c+l),s<0&&(a=(1-l)*(a<0?-1:1),o=(1-c)*(o<0?-1:1)),u=Math.sqrt(a*a+o*o+s*s),t=e*4,i[t]=a/u*127,i[++t]=o/u*127,i[++t]=s/u*127;return{array:i,itemSize:4,normalized:!0}}return null}})();",Im=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Fm],{type:`text/javascript;charset=utf-8`});function Lm(e){let t;try{if(t=Im&&(self.URL||self.webkitURL).createObjectURL(Im),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Fm),{name:e==null?void 0:e.name})}}var Rm=new Hu(()=>new Lm,2);function zm(e,t,n){let r=new wm(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then(()=>{let e=r.getExtension(`3DTILES_draco_point_compression`);if(e)return Bm(e,r);{let e=r.buffer.slice();return Rm.postMessage({featureTableBinary:e,featureTableJson:r.json},[e.buffer])}}).then(t=>(e.attributes=t,n))}function Bm(e,t){return an(this,void 0,void 0,function*(){let n=e.properties||{},r=e.byteOffset,i=e.byteLength;if(!n||!Number.isFinite(r)||!i)throw Error(`Draco properties, byteOffset, and byteLength must be defined`);let a=t.buffer.slice(r,r+i),o=e.properties;return Ru.decodeGeometry(a.buffer,{attributeIDs:o,attributeTypes:{POSITION:`Float32Array`,NORMAL:`Float32Array`,RGB:`Uint8Array`,RGBA:`Uint8Array`},useUniqueIDs:!0}).then(e=>{let t=e.getAttribute(`POSITION`),n=e.getAttribute(`RGB`),r=e.getAttribute(`RGBA`),i=e.getAttribute(`NORMAL`),a;if(r)a=r;else if(n){let e=n.count,t=n.array,r=new Uint8Array(e*4);for(let n=0,i,a;n<e;n++)a=n*4,i=n*3,r[a]=t[i],r[++a]=t[++i],r[++a]=t[++i];a=new c.BufferAttribute(r,4,n.normalized)}return{position:t?{array:t.array,itemSize:t.itemSize,normalized:t.normalized}:null,color:a?{array:a.array,itemSize:a.itemSize,normalized:a.normalized}:null,normal:i?{array:i.array,itemSize:i.itemSize,normalized:i.normalized}:null}})})}function Vm(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Hm(e,t,n){let r=t||e>1?e/n:e;return Vm(Math.min(Math.max(r,0),1))}function Um(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?qs:r,s=(i=t.onDownloadProgress)==null?K:i,l={uri:e};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>gm(l,e,t)).then(t=>Om(l,e,t)).then(t=>zm(l,e,t))).then(()=>{var e;return Wm(l.attributes,{computeBoundingBox:(e=t.computeBoundingBox)==null?!0:e})}).then(e=>{let t=new c.Matrix4,n;if(l.rtcCenter&&(n=new c.Vector3().fromArray(l.rtcCenter)),n){let e=new c.Matrix4().setPosition(n);t.premultiply(e)}return a===`Y`&&t.premultiply(js),e.object.applyMatrix4(t),l.gltfArrayBuffer=void 0,l.featureTableBinary=void 0,l.batchTableBinary=void 0,l.attributes=void 0,{type:`pnts`,modelUpAxis:`Z`,upAxis:a,uri:l.uri,byteLength:l.byteLength,memoryUsage:fl(e.object),scene:e.object,textures:[],animations:[],rtcCenter:n,dispose:()=>e.dispose()}})}function Wm(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h;let g=(n=e.position)==null?void 0:n.array,_=(r=e.color)==null?void 0:r.array,v=e.position?Math.floor(e.position.array.length/e.position.itemSize):0,y=new Float32Array;if(e.position&&g instanceof Float32Array&&e.position.itemSize===3&&e.position.normalized!==!0)y=g.slice(0,v*3);else if(g&&e.position){y=new Float32Array(v*3);let t=g,n=Math.max(1,e.position.itemSize);for(let e=0;e<v;e++){let r=e*n,s=e*3;y[s]=(i=t[r])==null?0:i,y[s+1]=(a=t[r+1])==null?0:a,y[s+2]=(o=t[r+2])==null?0:o}}let b=new Uint8Array(v*3);if(_&&e.color&&_ instanceof Uint8Array&&e.color.itemSize===3&&e.color.normalized===!0)b=_;else if(_&&e.color&&_ instanceof Float32Array&&e.color.itemSize===3&&e.color.normalized!==!0)b=_;else if(_&&e.color){let t=_,n=Math.max(1,e.color.itemSize);if(e.color.normalized)if(_ instanceof Uint8Array){b=new Uint8Array(v*3);for(let e=0;e<v;e++){let r=e*n,i=e*3,a=(s=t[r])==null?0:s,o=(c=t[r+1])==null?a:c,u=(l=t[r+2])==null?a:l;b[i]=a,b[i+1]=o,b[i+2]=u}}else{b=new Float32Array(v*3);let e=_,r=`BYTES_PER_ELEMENT`in e?e.BYTES_PER_ELEMENT:1,i=Math.pow(2,r*8)-1;for(let e=0;e<v;e++){let r=e*n,a=e*3,o=(u=t[r])==null?0:u,s=(d=t[r+1])==null?o:d,c=(f=t[r+2])==null?o:f;b[a]=Hm(o,!0,i),b[a+1]=Hm(s,!0,i),b[a+2]=Hm(c,!0,i)}}else{b=new Float32Array(v*3);let e=_,r=`BYTES_PER_ELEMENT`in e?e.BYTES_PER_ELEMENT:1,i=Math.pow(2,r*8)-1;for(let e=0;e<v;e++){let r=e*n,a=e*3,o=(p=t[r])==null?0:p,s=(m=t[r+1])==null?o:m,c=(h=t[r+2])==null?o:h;b[a]=Hm(o,!1,i),b[a+1]=Hm(s,!1,i),b[a+2]=Hm(c,!1,i)}}}let x=e.normal?$t(e.normal,v):null,S=new nn({numPoints:v,positions:y,colors:b,normals:x});return S.matrix.compose(S.position,S.quaternion,S.scale),S.matrixAutoUpdate=!1,S.frustumCulled=!1,t.computeBoundingBox,Promise.resolve({object:S,dispose:()=>{S.dispose()}})}var Gm=/^[og]\s*(.+)?/,Km=/^mtllib /,qm=/^usemtl /,Jm=/^usemap /,Ym=/\s+/,Xm=new c.Color,Zm=class{constructor(){this.objects=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materials={},this.materialLibraries=[],this.startObject(``,!1)}startObject(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}let n=this.object&&typeof this.object.currentMaterial==`function`?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0),this.object={name:e||``,fromDeclaration:t!==!1,geometry:{vertices:[],hasNormal:!0,normals:[],hasColor:!0,colors:[],hasUV:!0,uvs:[],index:[],indexMap:{}},materials:[],smooth:!0,startMaterial:function(e,t){var n,r;let i=this._finalize(!1);i&&(i.inherited||((n=i.groupCount)==null?0:n)<=0)&&this.materials.splice((r=i.index)==null?0:r,1);let a={index:this.materials.length,name:e||``,mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:``,smooth:i===void 0?this.smooth:i.smooth,groupStart:i===void 0?0:i.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1,clone(){return this}};return t.clone=this.clone.bind(t),t}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t,n;let r=this.currentMaterial();if(r&&r.groupEnd===-1&&(r.groupEnd=this.geometry.index.length,r.groupCount=r.groupEnd-((t=r.groupStart)==null?0:t),r.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)((n=this.materials[e].groupCount)==null?0:n)<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),r}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)}finalize(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)}parseVertexIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3}parseNormalIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3}parseUVIndex(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2}addFace(e,t,n,r,i,a,o,s,c){let l=this.object.geometry,u=this.vertices.length,d=this.normals.length,f=this.uvs.length,p=this.parseVertexIndex(e,u),m=this.parseVertexIndex(t,u),h=this.parseVertexIndex(n,u),g=o===void 0?void 0:this.parseNormalIndex(o,d),_=s===void 0?void 0:this.parseNormalIndex(s,d),v=c===void 0?void 0:this.parseNormalIndex(c,d),y=r===void 0?void 0:this.parseUVIndex(r,f),b=i===void 0?void 0:this.parseUVIndex(i,f),x=a===void 0?void 0:this.parseUVIndex(a,f);l.hasNormal===!0&&(g===void 0||_===void 0||v===void 0)&&(l.hasNormal=!1),l.hasUV===!0&&(y===void 0||b===void 0||x===void 0)&&(l.hasUV=!1);let S=[p,y,g].join(`:`),C=l.indexMap[S];C===void 0&&(C=l.vertices.length/3,l.indexMap[S]=C,l.vertices.push(this.vertices[p+0],this.vertices[p+1],this.vertices[p+2]),l.hasColor&&(this.colors[p]===void 0?l.hasColor=!1:l.colors.push(this.colors[p+0],this.colors[p+1],this.colors[p+2])),l.hasNormal&&l.normals.push(this.normals[p+0],this.normals[p+1],this.normals[p+2]),l.hasUV&&l.uvs.push(this.uvs[y+0],this.uvs[y+1])),l.index.push(C);let w=[m,b,_].join(`:`),T=l.indexMap[w];T===void 0&&(T=l.vertices.length/3,l.indexMap[w]=T,l.vertices.push(this.vertices[m+0],this.vertices[m+1],this.vertices[m+2]),l.hasColor&&(this.colors[m]===void 0?l.hasColor=!1:l.colors.push(this.colors[m+0],this.colors[m+1],this.colors[m+2])),l.hasNormal&&l.normals.push(this.normals[m+0],this.normals[m+1],this.normals[m+2]),l.hasUV&&l.uvs.push(this.uvs[b+0],this.uvs[b+1])),l.index.push(T);let E=[h,x,v].join(`:`),D=l.indexMap[E];D===void 0&&(D=l.vertices.length/3,l.indexMap[E]=D,l.vertices.push(this.vertices[h+0],this.vertices[h+1],this.vertices[h+2]),l.hasColor&&(this.colors[h]===void 0?l.hasColor=!1:l.colors.push(this.colors[h+0],this.colors[h+1],this.colors[h+2])),l.hasNormal&&l.normals.push(this.normals[h+0],this.normals[h+1],this.normals[h+2]),l.hasUV&&l.uvs.push(this.uvs[x+0],this.uvs[x+1])),l.index.push(D)}};function Qm(e){let t=new Zm;e.indexOf(`\r
|
|
902
|
+
`)!==-1&&(e=e.replace(/\r\n/g,`
|
|
903
|
+
`)),e.indexOf(`\\
|
|
904
|
+
`)!==-1&&(e=e.replace(/\\\n/g,``));let n=e.split(`
|
|
905
|
+
`),r=[];for(let e=0,i=n.length;e<i;e++){let i=n[e].trimStart();if(i.length===0)continue;let a=i.charAt(0);if(a!==`#`){if(a===`v`){let e=i.split(Ym);switch(e[0]){case`v`:t.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?(Xm.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])),Xm.convertSRGBToLinear(),t.colors.push(Xm.r,Xm.g,Xm.b)):t.colors.push(void 0,void 0,void 0);break;case`vn`:t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:t.uvs.push(parseFloat(e[1]),parseFloat(e[2]));break}}else if(a===`f`){let e=i.slice(1).trim().split(Ym),n=[];for(let t=0,r=e.length;t<r;t++){let r=e[t];if(r.length>0){let e=r.split(`/`);n.push(e)}}let r=n[0];for(let e=1,i=n.length-1;e<i;e++){let i=n[e],a=n[e+1];t.addFace(r[0],i[0],a[0],r[1],i[1],a[1],r[2],i[2],a[2])}}else if(a!==`l`&&a!==`p`)if((r=Gm.exec(i))!==null){let e=(` `+r[0].slice(1).trim()).slice(1);t.startObject(e)}else if(qm.test(i))t.object.startMaterial(i.substring(7).trim(),t.materialLibraries);else if(Km.test(i))t.materialLibraries.push(i.substring(7).trim());else if(Jm.test(i))console.warn(`THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.`);else if(a===`s`){if(r=i.split(` `),r.length>1){let e=r[1].trim().toLowerCase();t.object.smooth=e!==`0`&&e!==`off`}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}}return t.finalize(),t}function $m(e,t,n){let r=new Yc,i=t.split(`
|
|
906
|
+
`),a={name:``},o=/\s+/,s={};for(let e=0;e<i.length;e++){let t=i[e];if(t=t.trim(),t.length===0||t.charAt(0)===`#`)continue;let n=t.indexOf(` `),r=n>=0?t.substring(0,n):t;r=r.toLowerCase();let c=n>=0?t.substring(n+1):``;if(c=c.trim(),r===`newmtl`)a={name:c},s[c]=a;else if(r===`ka`||r===`kd`||r===`ks`||r===`ke`){let e=c.split(o,3);a[r]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else(r===`map_kd`||r===`map_ks`||r===`map_ke`||r===`norm`||r===`map_bump`||r===`bump`||r===`map_d`||r===`ns`||r===`d`||r===`tr`)&&(a[r]=c)}function l(e){let t={url:``,scale:new c.Vector2(1,1),offset:new c.Vector2(0,0),bumpScale:1},n=e.split(/\s+/),r;return r=n.indexOf(`-bm`),r>=0&&(t.bumpScale=parseFloat(n[r+1]),n.splice(r,2)),r=n.indexOf(`-s`),r>=0&&(t.scale.set(parseFloat(n[r+1]),parseFloat(n[r+2])),n.splice(r,4)),r=n.indexOf(`-o`),r>=0&&(t.offset.set(parseFloat(n[r+1]),parseFloat(n[r+2])),n.splice(r,4)),t.url=n.join(` `).trim(),t}function u(e,t,i){let a=l(i),o=ec(n.path,a.url);return r.loadTexture(o,{fetcher:n.fetcher,colorSpace:t===`map`||t===`emissiveMap`?c.SRGBColorSpace:c.LinearSRGBColorSpace,minFilter:c.LinearFilter,magFilter:c.LinearFilter,wrapS:c.RepeatWrapping,wrapT:c.RepeatWrapping}).then(n=>{let r=n.body;return r.repeat.copy(a.scale),r.offset.copy(a.offset),e.bumpScale=a.bumpScale,e[t]=r,r})}return{name:e,create:e=>{let t=Pr(n.light?`phong`:`basic`),r=[],i=s[e];if(i){if(i.kd!==void 0&&t.color.fromArray(i.kd),i.ks!==void 0&&t.specular.fromArray(i.ks),i.ke!==void 0&&t.emissive.fromArray(i.ke),i.map_kd!==void 0&&r.push(u(t,`map`,i.map_kd)),i.map_ks!==void 0&&r.push(u(t,`specularMap`,i.map_ks)),i.map_ke!==void 0&&r.push(u(t,`emissiveMap`,i.map_ke)),i.norm!==void 0&&r.push(u(t,`normalMap`,i.norm)),i.map_bump!==void 0&&r.push(u(t,`bumpMap`,i.map_bump)),i.bump!==void 0&&r.push(u(t,`bumpMap`,i.bump)),i.map_d!==void 0&&r.push(u(t,`alphaMap`,i.map_d)),i.ns!==void 0&&(t.shininess=parseFloat(i.ns)),i.d!==void 0){let e=parseFloat(i.d);e<1&&(t.opacity=e,t.transparent=!0)}if(i.tr!==void 0){let e=parseFloat(i.tr);e>0&&(t.opacity=1-e,t.transparent=!0)}}return[t,Promise.all(r).then(e=>e)]}}}function eh(e,t){var n;let r=[],i=[],a=new c.Group;for(let o=0,s=e.objects.length;o<s;o++){let s=e.objects[o],l=s.geometry,u=s.materials,d=!1;if(l.vertices.length===0)continue;let f=new c.BufferGeometry;i.push(()=>f.dispose()),f.setAttribute(`position`,new c.BufferAttribute(new Float32Array(l.vertices),3)),l.normals.length>0&&f.setAttribute(`normal`,new c.BufferAttribute(new Float32Array(l.normals),3)),l.colors.length>0&&(d=!0,f.setAttribute(`color`,new c.BufferAttribute(new Float32Array(l.colors),3))),l.uvs.length>0&&f.setAttribute(`uv`,new c.BufferAttribute(new Float32Array(l.uvs),2)),l.index.length>0&&f.setIndex(new c.BufferAttribute(new Uint32Array(l.index),1)),f.computeBoundingBox(),f.computeBoundingSphere();let p=[];for(let n=0,a=u.length;n<a;n++){let a=u[n],o=a.name+`_`+a.smooth+`_`+d,s=e.materials[o];if(!s){let n=null;for(let{name:e,create:r}of t)e===a.mtllib&&(n=r(a.name));n||(n=[Pr(),Promise.resolve([])]),s=n[0],s.name=a.name,s.flatShading=!(a.smooth||f.attributes.normal),s.vertexColors=d,e.materials[o]=s;let c=n[1];r.push(c),i.push(()=>s.dispose())}p.push(s)}f.clearGroups();for(let e=0,t=u.length;e<t;e++){let t=u[e];t.groupCount&&f.addGroup((n=t.groupStart)==null?0:n,t.groupCount,e)}(!f.groups||f.groups.length===0)&&f.addGroup(0,f.index?f.index.count:f.attributes.position.count,0);let m=new Ot(f,p);m.name=s.name,a.add(m)}return Promise.all(r).then(e=>{let t=[];for(let n of e)t=t.concat(n);return{scene:a,textures:t,dispose:()=>i.forEach(e=>e())}})}function th(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Z`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?qs:i,l=(a=t.onDownloadProgress)==null?K:a,u=e.slice(0,e.lastIndexOf(`/`)+1),d=0,f;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(d=e.body.byteLength,new TextDecoder().decode(e.body))).then(e=>(f=Qm(e),Promise.all(f.materialLibraries.map(e=>{let n=ec(u,e),r=n.slice(0,n.lastIndexOf(`/`)+1);return c.ajax(n,{responseType:`text`}).then(n=>{var i;return $m(e,n.body,{path:r,light:(i=t.light)==null?!1:i,fetcher:c})})})))).then(e=>eh(f,e)).then(t=>(o===`Y`&&t.scene.applyMatrix4(As),s===`Y`&&t.scene.applyMatrix4(js),{type:`obj`,modelUpAxis:o,upAxis:s,uri:e,byteLength:d,memoryUsage:fl(t.scene),scene:t.scene,textures:t.textures,animations:[],dispose:()=>t.dispose()}))}var nh=Uint8Array,rh=Uint16Array,ih=Int32Array,ah=new nh([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),oh=new nh([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),sh=new nh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ch=function(e,t){for(var n=new rh(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ih(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},lh=ch(ah,2),uh=lh.b,dh=lh.r;uh[28]=258,dh[258]=28;var fh=ch(oh,0),ph=fh.b;fh.r;for(var mh=new rh(32768),hh=0;hh<32768;++hh){var gh=(hh&43690)>>1|(hh&21845)<<1;gh=(gh&52428)>>2|(gh&13107)<<2,gh=(gh&61680)>>4|(gh&3855)<<4,mh[hh]=((gh&65280)>>8|(gh&255)<<8)>>1}for(var _h=(function(e,t,n){for(var r=e.length,i=0,a=new rh(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new rh(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new rh(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[mh[d]>>c]=l}else for(s=new rh(r),i=0;i<r;++i)e[i]&&(s[i]=mh[o[e[i]-1]++]>>15-e[i]);return s}),vh=new nh(288),hh=0;hh<144;++hh)vh[hh]=8;for(var hh=144;hh<256;++hh)vh[hh]=9;for(var hh=256;hh<280;++hh)vh[hh]=7;for(var hh=280;hh<288;++hh)vh[hh]=8;for(var yh=new nh(32),hh=0;hh<32;++hh)yh[hh]=5;var bh=_h(vh,9,1),xh=_h(yh,5,1),Sh=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ch=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},wh=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Th=function(e){return(e+7)/8|0},Eh=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new nh(e.subarray(t,n))},Dh=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],Oh=function(e,t,n){var r=Error(t||Dh[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Oh),!n)throw r;return r},kh=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new nh(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new nh(i*3));var l=function(e){var t=n.length;if(e>t){var r=new nh(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=Ch(e,d,1);var v=Ch(e,d+1,3);if(d+=3,!v){var y=Th(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&Oh(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=bh,m=xh,h=9,g=5;else if(v==2){var S=Ch(e,d,31)+257,C=Ch(e,d+10,15)+4,w=S+Ch(e,d+5,31)+1;d+=14;for(var T=new nh(w),E=new nh(19),D=0;D<C;++D)E[sh[D]]=Ch(e,d+D*3,7);d+=C*3;for(var O=Sh(E),k=(1<<O)-1,A=_h(E,O,1),D=0;D<w;){var j=A[Ch(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+Ch(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+Ch(e,d,7),d+=3):y==18&&(N=11+Ch(e,d,127),d+=7);N--;)T[D++]=M}}var ee=T.subarray(0,S),P=T.subarray(S);h=Sh(ee),g=Sh(P),p=_h(ee,h,1),m=_h(P,g,1)}else Oh(1);if(d>_){c&&Oh(0);break}}s&&l(f+131072);for(var F=(1<<h)-1,te=(1<<g)-1,ne=d;;ne=d){var M=p[wh(e,d)&F],I=M>>4;if(d+=M&15,d>_){c&&Oh(0);break}if(M||Oh(2),I<256)n[f++]=I;else if(I==256){ne=d,p=null;break}else{var re=I-254;if(I>264){var D=I-257,ie=ah[D];re=Ch(e,d,(1<<ie)-1)+uh[D],d+=ie}var L=m[wh(e,d)&te],ae=L>>4;L||Oh(3),d+=L&15;var P=ph[ae];if(ae>3){var ie=oh[ae];P+=wh(e,d)&(1<<ie)-1,d+=ie}if(d>_){c&&Oh(0);break}s&&l(f+131072);var R=f+re;if(f<P){var z=a-P,oe=Math.min(P,R);for(z+f<0&&Oh(3);f<oe;++f)n[f]=r[z+f]}for(;f<R;++f)n[f]=n[f-P]}}t.l=p,t.p=ne,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?Eh(n,0,f):n.subarray(0,f)},Ah=new nh(0),jh=function(e,t){return e[t]|e[t+1]<<8},Mh=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Nh=function(e,t){return Mh(e,t)+Mh(e,t+4)*4294967296},Ph=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&Oh(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&Oh(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Fh(e,t){return kh(e,{i:2},t&&t.out,t&&t.dictionary)}function Ih(e,t){return kh(e.subarray(Ph(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var Lh=typeof TextDecoder<`u`&&new TextDecoder;try{Lh.decode(Ah,{stream:!0})}catch(e){}var Rh=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Eh(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function zh(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else if(Lh)return Lh.decode(e);else{var i=Rh(e),a=i.s,n=i.r;return n.length&&Oh(8),a}}var Bh=function(e,t){return t+30+jh(e,t+26)+jh(e,t+28)},Vh=function(e,t,n){var r=jh(e,t+28),i=zh(e.subarray(t+46,t+46+r),!(jh(e,t+8)&2048)),a=t+46+r,o=Mh(e,t+20),s=n&&o==4294967295?Hh(e,a):[o,Mh(e,t+24),Mh(e,t+42)],c=s[0],l=s[1],u=s[2];return[jh(e,t+10),c,l,i,a+jh(e,t+30)+jh(e,t+32),u]},Hh=function(e,t){for(;jh(e,t)!=1;t+=4+jh(e,t+2));return[Nh(e,t+12),Nh(e,t+4),Nh(e,t+20)]};function Uh(e,t){for(var n={},r=e.length-22;Mh(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Oh(13);var i=jh(e,r+8);if(!i)return{};var a=Mh(e,r+16),o=a==4294967295||i==65535;if(o){var s=Mh(e,r-12);o=Mh(e,s)==101075792,o&&(i=Mh(e,s+32),a=Mh(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=Vh(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=Bh(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=Fh(e.subarray(_,_+f),{out:new nh(p)}):Oh(14,`unknown compression type `+d):n[m]=Eh(e,_,_+f))}return n}function Wh(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?qs:r,s=(i=t.onDownloadProgress)==null?K:i,l=0;return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s).then(e=>(l=e.body.byteLength,e.body))).then(n=>{var r;return Gh(n,{light:t.light,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,fetcher:o})}).then(t=>{let n=t.scene,r=t.unitScale/100,i=new c.Matrix4;if(i.makeScale(r,r,r),t.upAxis===`X`)throw Error(`Cannot load fbx x upAxis`);return t.upAxis===`Y`&&i.premultiply(As),a===`Y`&&i.premultiply(js),n.applyMatrix4(i),{type:`fbx`,modelUpAxis:t.upAxis,upAxis:a,uri:e,byteLength:l,memoryUsage:fl(n),scene:n,textures:t.textures,animations:t.animations,dispose:()=>t.dispose()}})}function Gh(e,t){let n;if($h(e))n=new Xh().parse(e);else{let t=ug(e);if(!eg(t))throw Error(`THREE.FBXLoader: Unknown format.`);if(tg(t)<7e3)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+tg(t));n=new Yh().parse(t)}return new Kh(t).parse(n)}var Kh=class{constructor(e){var t,n,r;this.light=(t=e.light)==null?!0:t,this.resourcePath=(n=e.resourcePath)==null?``:n,this.search=(r=e.search)==null?``:r,this.fetcher=e.fetcher}parse(e){var t,n,r,i,a,o;let s=this.parseConnections(e),l=Object.assign(new c.Group,{animations:[]}),u=[],d=this.parseImages(e),f=this.parseTextures(e,d,s,u),p=this.parseMaterials(e,f,s),m=this.parseDeformers(e,s),h=new qh().parse(e,m,s);this.parseScene(e,m,h,p,s,l);let g=(n=(t=e.GlobalSettings.UpAxis)==null?void 0:t.value)==null?1:n,_=(i=(r=e.GlobalSettings.FrontAxis)==null?void 0:r.value)==null?2:i,v=(o=(a=e.GlobalSettings.UnitScaleFactor)==null?void 0:a.value)==null?1:o,y;if(e.GlobalSettings.AmbientColor){let t=e.GlobalSettings.AmbientColor.value,n=t[0],r=t[1],i=t[2];if(n!==0||r!==0||i!==0){let e=new c.Color().setRGB(n,r,i);y=new c.AmbientLight(e,1)}}return Promise.all(u).then(e=>{var t;return{scene:l,textures:e,ambientLight:y,upAxis:[`X`,`Y`,`Z`][g],frontAxis:[`X`,`Y`,`Z`][_],unitScale:v,animations:(t=l.animations)==null?[]:t,dispose:()=>{e.forEach(e=>e.dispose()),p.forEach(e=>e.dispose()),h.forEach(e=>e.dispose())}}})}parseConnections(e){let t=new Map;return`Connections`in e&&e.Connections.connections.forEach(function(e){let n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});let a={ID:r,relationship:i};t.get(n).parents.push(a),t.has(r)||t.set(r,{parents:[],children:[]});let o={ID:n,relationship:i};t.get(r).children.push(o)}),t}parseImages(e){let t={},n={};if(`Video`in e.Objects){let r=e.Objects.Video;for(let e in r){let i=r[e],a=parseInt(e);if(t[a]=i.RelativeFilename||i.Filename,`Content`in i){let t=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,a=typeof i.Content==`string`&&i.Content!==``;if(t||a){let t=this.parseImage(r[e]);n[i.RelativeFilename||i.Filename]=t}}}}for(let e in t){let r=t[e];n[r]===void 0?t[e]=t[e].split(`\\`).pop():t[e]=n[r]}return t}parseImage(e){let t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(`.`)+1).toLowerCase(),i;switch(r){case`bmp`:i=`image/bmp`;break;case`jpg`:case`jpeg`:i=`image/jpeg`;break;case`png`:i=`image/png`;break;case`tif`:i=`image/tiff`;break;case`tga`:i=`image/tga`;break;default:return}if(typeof t==`string`)return`data:`+i+`;base64,`+t;{let e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:i}))}}parseTextures(e,t,n,r){let i=new Map;if(`Texture`in e.Objects){let a=e.Objects.Texture;for(let e in a){let o=this.parseTexture(a[e],t,n,r);i.set(parseInt(e),o)}}return i}parseTexture(e,t,n,r){let i=this.loadTexture(e,t,n,r);i.ID=e.id,i.name=e.attrName;let a=e.WrapModeU,o=e.WrapModeV,s=a===void 0?0:a.value,l=o===void 0?0:o.value;if(i.wrapS=s===0?c.RepeatWrapping:c.ClampToEdgeWrapping,i.wrapT=l===0?c.RepeatWrapping:c.ClampToEdgeWrapping,e.Scaling){let t=e.Scaling.value;i.repeat.x=t[0],i.repeat.y=t[1]}if(e.Translation){let t=e.Translation.value;i.offset.x=t[0],i.offset.y=t[1]}return i}loadTexture(e,t,n,r){let i=n.get(e.id).children,a=``;i!==void 0&&i.length>0&&t[i[0].ID]!==void 0&&(a=t[i[0].ID]),a=ec(this.resourcePath,tc(a,this.search));let o=Object.assign(new c.Texture,{ID:0}),s;s=Vc()?this.fetcher.ajax(a,{responseType:`blob`}).then(e=>{let t=e.body;return Uc(t)}):this.fetcher.loadImage(a,{},void 0,void 0,void 0,Hc()).then(e=>e.body);let l=s.then(e=>(o.image=e,o.needsUpdate=!0,o)).catch(e=>(console.warn(e),o));return r.push(l),o}parseMaterials(e,t,n){let r=new Map;if(`Material`in e.Objects){let i=e.Objects.Material;for(let a in i){let o=this.parseMaterial(e,i[a],t,n);o!==null&&r.set(parseInt(a),o)}}return r}parseMaterial(e,t,n,r){let i=t.id,a=t.attrName,o=t.ShadingModel;if(typeof o==`object`&&(o=o.value),o=o.toLowerCase(),!r.has(i))return null;let s=Pr(this.light?`phong`:`basic`);s.name=a,t.BumpFactor&&(s.bumpScale=t.BumpFactor.value),t.Diffuse?s.color=new c.Color().fromArray(t.Diffuse.value):t.DiffuseColor&&(t.DiffuseColor.type===`Color`||t.DiffuseColor.type===`ColorRGB`)&&(s.color=new c.Color().fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(s.displacementScale=t.DisplacementFactor.value),t.Emissive?s.emissive=new c.Color().fromArray(t.Emissive.value):t.EmissiveColor&&(t.EmissiveColor.type===`Color`||t.EmissiveColor.type===`ColorRGB`)&&(s.emissive=new c.Color().fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(s.emissiveIntensity=parseFloat(t.EmissiveFactor.value));let l=1-(t.TransparencyFactor?parseFloat(t.TransparencyFactor.value):0);(l===1||l===0)&&(l=t.Opacity?parseFloat(t.Opacity.value):null,l===null&&(l=1-(t.TransparentColor?parseFloat(t.TransparentColor.value[0]):0))),s.opacity=l,s.opacity<1&&(s.transparent=!0),t.ReflectionFactor&&(s.reflectivity=t.ReflectionFactor.value),t.Shininess&&(s.shininess=t.Shininess.value),t.Specular?s.specular=new c.Color().fromArray(t.Specular.value):t.SpecularColor&&t.SpecularColor.type===`Color`&&(s.specular=new c.Color().fromArray(t.SpecularColor.value));let u=this;return r.get(i).children.forEach(function(t){let i=t.relationship;switch(i){case`Bump`:s.bumpMap=u.getTexture(e,n,t.ID,r);break;case`Maya|TEX_ao_map`:s.aoMap=u.getTexture(e,n,t.ID,r);break;case`DiffuseColor`:case`Maya|TEX_color_map`:s.map=u.getTexture(e,n,t.ID,r),s.map!==void 0&&(s.map.colorSpace=c.SRGBColorSpace);break;case`DisplacementColor`:s.displacementMap=u.getTexture(e,n,t.ID,r);break;case`EmissiveColor`:s.emissiveMap=u.getTexture(e,n,t.ID,r),s.emissiveMap!==void 0&&(s.emissiveMap.colorSpace=c.SRGBColorSpace);break;case`NormalMap`:case`Maya|TEX_normal_map`:s.normalMap=u.getTexture(e,n,t.ID,r);break;case`ReflectionColor`:s.envMap=u.getTexture(e,n,t.ID,r),s.envMap!==void 0&&(s.envMap.mapping=c.EquirectangularReflectionMapping,s.envMap.colorSpace=c.SRGBColorSpace);break;case`SpecularColor`:s.specularMap=u.getTexture(e,n,t.ID,r),s.specularMap!==void 0&&(s.specularMap.colorSpace=c.SRGBColorSpace);break;case`TransparentColor`:case`TransparencyFactor`:s.alphaMap=u.getTexture(e,n,t.ID,r),s.transparent=!0;break;default:console.warn(`THREE.FBXLoader: %s map is not supported in three.js, skipping texture.`,i);break}}),s}getTexture(e,t,n,r){return e.Objects.LayeredTexture&&n in e.Objects.LayeredTexture&&(console.warn(`THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.`),n=r.get(n).children[0].ID),t.get(n)}parseDeformers(e,t){let n={},r={};if(`Deformer`in e.Objects){let i=e.Objects.Deformer;for(let e in i){let a=i[e],o=t.get(parseInt(e));if(a.attrType===`Skin`){let t=this.parseSkeleton(o,i);t.ID=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: skeleton attached to more than one geometry is not supported.`),t.geometryID=o.parents[0].ID,n[e]=t}else if(a.attrType===`BlendShape`){let n={id:e};n.rawTargets=this.parseMorphTargets(o,i,t),n.id=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: morph target attached to more than one geometry is not supported.`),r[e]=n}}}return{skeletons:n,morphTargets:r}}parseSkeleton(e,t){let n=[];return e.children.forEach(function(e){let r=t[e.ID];if(r.attrType!==`Cluster`)return;let i={ID:e.ID,indices:[],weights:[],transformLink:new c.Matrix4().fromArray(r.TransformLink.a)};r.Indexes&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}),{ID:``,geometryID:0,rawBones:n,bones:[]}}parseMorphTargets(e,t,n){let r=[];for(let i=0;i<e.children.length;i++){let a=e.children[i],o=t[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a,geoID:0};if(o.attrType!==`BlendShapeChannel`)return;s.geoID=n.get(parseInt(a.ID)).children.filter(function(e){return e.relationship===void 0})[0].ID,r.push(s)}return r}parseScene(e,t,n,r,i,a){let o=this.parseModels(e,t.skeletons,n,r,i),s=e.Objects.Model,l=this;o.forEach(function(t){let n=s[t.ID];l.setLookAtProperties(e,t,n,i,a),i.get(t.ID).parents.forEach(function(e){let n=o.get(e.ID);n!==void 0&&n.add(t)}),t.parent===null&&a.add(t)}),this.bindSkeleton(e,t.skeletons,n,o,i),a.traverse(function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);let t=sg(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix(!0,!0)}});let u=new Jh().parse(e,i,a);a.children.length===1&&a.children[0]instanceof c.Group&&(a=a.children[0]),a.animations=u}parseModels(e,t,n,r,i){let a=new Map,o=e.Objects.Model;for(let s in o){let l=parseInt(s),u=o[s],d=i.get(l),f=this.buildSkeleton(d,t,l,u.attrName);if(!f){switch(u.attrType){case`Camera`:f=this.createCamera(e,d);break;case`Light`:f=this.createLight(e,d);break;case`Mesh`:f=this.createMesh(d,n,r);break;case`NurbsCurve`:case`LimbNode`:case`Root`:f=new c.Bone;break;default:f=new c.Group;break}f.name=u.attrName?c.PropertyBinding.sanitizeNodeName(u.attrName):``,f.userData.originalName=u.attrName,f.ID=l}this.getTransformData(f,u),a.set(l,f)}return a}buildSkeleton(e,t,n,r){let i=null;return e.parents.forEach(function(e){for(let a in t){let o=t[a];o.rawBones.forEach(function(t,a){if(t.ID===e.ID){let e=i;i=new c.Bone,i.matrixWorld.copy(t.transformLink),i.name=r?c.PropertyBinding.sanitizeNodeName(r):``,i.userData.originalName=r,i.ID=n,o.bones[a]=i,e!==null&&i.add(e)}})}}),i}createCamera(e,t){let n,r;if(t.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(r=n)}),r===void 0)n=new c.Object3D;else{let e=0;r.CameraProjectionType!==void 0&&r.CameraProjectionType.value===1&&(e=1);let t=1;r.NearPlane!==void 0&&(t=r.NearPlane.value/1e3);let i=1e3;r.FarPlane!==void 0&&(i=r.FarPlane.value/1e3);let a=window.innerWidth,o=window.innerHeight;r.AspectWidth!==void 0&&r.AspectHeight!==void 0&&(a=r.AspectWidth.value,o=r.AspectHeight.value);let s=a/o,l=45;r.FieldOfView!==void 0&&(l=r.FieldOfView.value);let u=r.FocalLength?r.FocalLength.value:null;switch(e){case 0:n=new c.PerspectiveCamera(l,s,t,i),u!==null&&n.setFocalLength(u);break;case 1:console.warn(`THREE.FBXLoader: Orthographic cameras not supported yet.`),n=new c.Object3D;break;default:console.warn(`THREE.FBXLoader: Unknown camera type `+e+`.`),n=new c.Object3D;break}}return n}createLight(e,t){let n,r;if(t.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(r=n)}),r===void 0)n=new c.Object3D;else{let e;e=r.LightType===void 0?0:r.LightType.value;let t=new c.Color(16777215);r.Color!==void 0&&(t=new c.Color().fromArray(r.Color.value));let i=r.Intensity===void 0?1:r.Intensity.value/100;r.CastLightOnObject!==void 0&&r.CastLightOnObject.value===0&&(i=0);let a=0;switch(r.FarAttenuationEnd!==void 0&&(a=r.EnableFarAttenuation!==void 0&&r.EnableFarAttenuation.value===0?0:r.FarAttenuationEnd.value),e){case 0:n=new c.PointLight(t,i,a,1);break;case 1:n=new c.DirectionalLight(t,i);break;case 2:let e=Math.PI/3;r.InnerAngle!==void 0&&(e=c.MathUtils.degToRad(r.InnerAngle.value));let o=0;r.OuterAngle!==void 0&&(o=c.MathUtils.degToRad(r.OuterAngle.value),o=Math.max(o,1)),n=new c.SpotLight(t,i,a,e,o,1);break;default:console.warn(`THREE.FBXLoader: Unknown light type `+r.LightType.value+`, defaulting to a PointLight.`),n=new c.PointLight(t,i);break}r.CastShadows!==void 0&&r.CastShadows.value===1&&(n.castShadow=!0)}return n}createMesh(e,t,n){let r,i=null,a=[];if(e.children.forEach(function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&a.push(n.get(e.ID))}),a.length===0){let e=Pr(this.light?`phong`:`basic`);e.color=new c.Color(13421772),a.push(e)}return`color`in i.attributes&&a.forEach(function(e){e.vertexColors=!0}),(!i.groups||i.groups.length===0)&&i.addGroup(0,i.index?i.index.count:i.attributes.position.count,0),i.FBX_Deformer?(a.forEach(function(e){e.skinning=!0}),r=new kt(i,a),r.normalizeSkinWeights()):r=new Ot(i,a),r}createCurve(e,t){let n=e.children.reduce(function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e},null),r=new c.LineBasicMaterial({name:``,color:3342591,linewidth:1});return new c.Line(n,r)}getTransformData(e,t){let n={};t.InheritType&&(n.inheritType=parseInt(t.InheritType.value)),t.RotationOrder?n.eulerOrder=cg(t.RotationOrder.value):n.eulerOrder=cg(0),t.Lcl_Translation&&(n.translation=t.Lcl_Translation.value),t.PreRotation&&(n.preRotation=t.PreRotation.value),t.Lcl_Rotation&&(n.rotation=t.Lcl_Rotation.value),t.PostRotation&&(n.postRotation=t.PostRotation.value),t.Lcl_Scaling&&(n.scale=t.Lcl_Scaling.value),t.ScalingOffset&&(n.scalingOffset=t.ScalingOffset.value),t.ScalingPivot&&(n.scalingPivot=t.ScalingPivot.value),t.RotationOffset&&(n.rotationOffset=t.RotationOffset.value),t.RotationPivot&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t,n,r,i){`LookAtProperty`in n&&r.get(t.ID).children.forEach(function(n){if(n.relationship===`LookAtProperty`){let r=e.Objects.Model[n.ID];if(r.Lcl_Translation){let e=r.Lcl_Translation.value;`target`in t&&t.target instanceof c.Object3D?(t.target.position.fromArray(e),i.add(t.target)):t.lookAt(new c.Vector3().fromArray(e))}}})}bindSkeleton(e,t,n,r,i){let a=this.parsePoseNodes(e);for(let e in t){let o=t[e];i.get(parseInt(o.ID)).parents.forEach(function(e){if(n.has(e.ID)){let t=e.ID;i.get(t).parents.forEach(function(e){if(r.has(e.ID)){let t=r.get(e.ID);t instanceof c.SkinnedMesh&&t.bind(new c.Skeleton(o.bones),a[e.ID])}})}})}}parsePoseNodes(e){let t={};if(e.Objects.Pose){let n=e.Objects.Pose;for(let e in n)if(n[e].attrType===`BindPose`&&n[e].NbPoseNodes>0){let r=n[e].PoseNode;Array.isArray(r)?r.forEach(function(e){t[e.Node]=new c.Matrix4().fromArray(e.Matrix.a)}):t[r.Node]=new c.Matrix4().fromArray(r.Matrix.a)}}return t}},qh=class{constructor(){this.negativeMaterialIndices=!1}parse(e,t,n){let r=new Map;if(`Geometry`in e.Objects){let i=e.Objects.Geometry;for(let a in i){let o=n.get(parseInt(a)),s=this.parseGeometry(e,o,i[a],t);r.set(parseInt(a),s)}}return this.negativeMaterialIndices===!0&&console.warn(`THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected.`),r}parseGeometry(e,t,n,r){switch(n.attrType){case`Mesh`:return this.parseMeshGeometry(e,t,n,r);case`NurbsCurve`:return this.parseNurbsGeometry(n)}}parseMeshGeometry(e,t,n,r){let i=r.skeletons,a=[],o=t.parents.map(function(t){return e.Objects.Model[t.ID]});if(o.length===0)return;let s=t.children.reduce(function(e,t){return i[t.ID]!==void 0&&(e=i[t.ID]),e},null);t.children.forEach(function(e){r.morphTargets[e.ID]!==void 0&&a.push(r.morphTargets[e.ID])});let c=o[0],l={};c.RotationOrder&&(l.eulerOrder=cg(c.RotationOrder.value)),c.InheritType&&(l.inheritType=parseInt(c.InheritType.value)),c.GeometricTranslation&&(l.translation=c.GeometricTranslation.value),c.GeometricRotation&&(l.rotation=c.GeometricRotation.value),c.GeometricScaling&&(l.scale=c.GeometricScaling.value);let u=sg(l);return this.genGeometry(e,n,s,a,u)}genGeometry(e,t,n,r,i){let a=new c.BufferGeometry;t.attrName&&(a.name=t.attrName);let o=this.parseGeoNode(t,n),s=this.genBuffers(o),l=new c.Float32BufferAttribute(s.vertex,3);if(l.applyMatrix4(i),a.setAttribute(`position`,l),s.colors.length>0&&a.setAttribute(`color`,new c.Float32BufferAttribute(s.colors,3)),n&&(a.setAttribute(`skinIndex`,new c.Uint16BufferAttribute(s.weightsIndices,4)),a.setAttribute(`skinWeight`,new c.Float32BufferAttribute(s.vertexWeights,4)),a.FBX_Deformer=n),s.normal.length>0){let e=new c.Matrix3().getNormalMatrix(i),t=new c.Float32BufferAttribute(s.normal,3);t.applyNormalMatrix(e),a.setAttribute(`normal`,t)}if(s.uvs.forEach(function(e,t){let n=t===0?`uv`:`uv${t}`;a.setAttribute(n,new c.Float32BufferAttribute(s.uvs[t],2))}),o.material&&o.material.mappingType!==`AllSame`){let e=s.materialIndex[0],t=0;if(s.materialIndex.forEach(function(n,r){n!==e&&(a.addGroup(t,r-t,e),e=n,t=r)}),a.groups.length>0){let t=a.groups[a.groups.length-1],n=t.start+t.count;n!==s.materialIndex.length&&a.addGroup(n,s.materialIndex.length-n,e)}a.groups.length===0&&a.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(e,a,t,r,i),a}parseGeoNode(e,t){let n={};if(n.vertexPositions=e.Vertices===void 0?[]:e.Vertices.a,n.vertexIndices=e.PolygonVertexIndex===void 0?[]:e.PolygonVertexIndex.a,e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(r,i){n.weightTable[r]===void 0&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],o=[],s=[],c=[],l=[],u=[],d=this;return e.vertexIndices.forEach(function(f,p){let m=0,h=!1;f<0&&(f^=-1,h=!0);let g=[],_=[];if(a.push(f*3,f*3+1,f*3+2),e.color){let t=ig(p,n,f,e.color);s.push(t[0],t[1],t[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(e){_.push(e.weight),g.push(e.id)}),_.length>4){i||(console.warn(`THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.`),i=!0);let e=[0,0,0,0],t=[0,0,0,0];_.forEach(function(n,r){let i=n,a=g[r];t.forEach(function(t,n,r){if(i>t){r[n]=i,i=t;let o=e[n];e[n]=a,a=o}})}),g=e,_=t}for(;_.length<4;)_.push(0),g.push(0);for(let e=0;e<4;++e)l.push(_[e]),u.push(g[e])}if(e.normal){let t=ig(p,n,f,e.normal);o.push(t[0],t[1],t[2])}e.material&&e.material.mappingType!==`AllSame`&&(m=ig(p,n,f,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(e,t){let r=ig(p,n,f,e);c[t]===void 0&&(c[t]=[]),c[t].push(r[0]),c[t].push(r[1])}),r++,h&&(d.genFace(t,e,a,m,o,s,c,l,u,r),n++,r=0,a=[],o=[],s=[],c=[],l=[],u=[])}),t}getNormalNewell(e){let t=new c.Vector3(0,0,0);for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t.x+=(r.y-i.y)*(r.z+i.z),t.y+=(r.z-i.z)*(r.x+i.x),t.z+=(r.x-i.x)*(r.y+i.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){let t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new c.Vector3(0,1,0):new c.Vector3(0,0,1)).cross(t).normalize();return{normal:t,tangent:n,bitangent:t.clone().cross(n).normalize()}}flattenVertex(e,t,n){return new c.Vector2(e.dot(t),e.dot(n))}genFace(e,t,n,r,i,a,o,s,l,u){let d;if(u>3){let e=[],r=t.baseVertexPositions||t.vertexPositions;for(let t=0;t<n.length;t+=3)e.push(new c.Vector3(r[n[t]],r[n[t+1]],r[n[t+2]]));let{tangent:i,bitangent:a}=this.getNormalTangentAndBitangent(e),o=[];for(let t of e)o.push(this.flattenVertex(t,i,a));d=c.ShapeUtils.triangulateShape(o,[])}else d=[[0,1,2]];for(let[c,u,f]of d)e.vertex.push(t.vertexPositions[n[c*3]]),e.vertex.push(t.vertexPositions[n[c*3+1]]),e.vertex.push(t.vertexPositions[n[c*3+2]]),e.vertex.push(t.vertexPositions[n[u*3]]),e.vertex.push(t.vertexPositions[n[u*3+1]]),e.vertex.push(t.vertexPositions[n[u*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),t.skeleton&&(e.vertexWeights.push(s[c*4]),e.vertexWeights.push(s[c*4+1]),e.vertexWeights.push(s[c*4+2]),e.vertexWeights.push(s[c*4+3]),e.vertexWeights.push(s[u*4]),e.vertexWeights.push(s[u*4+1]),e.vertexWeights.push(s[u*4+2]),e.vertexWeights.push(s[u*4+3]),e.vertexWeights.push(s[f*4]),e.vertexWeights.push(s[f*4+1]),e.vertexWeights.push(s[f*4+2]),e.vertexWeights.push(s[f*4+3]),e.weightsIndices.push(l[c*4]),e.weightsIndices.push(l[c*4+1]),e.weightsIndices.push(l[c*4+2]),e.weightsIndices.push(l[c*4+3]),e.weightsIndices.push(l[u*4]),e.weightsIndices.push(l[u*4+1]),e.weightsIndices.push(l[u*4+2]),e.weightsIndices.push(l[u*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3])),t.color&&(e.colors.push(a[c*3]),e.colors.push(a[c*3+1]),e.colors.push(a[c*3+2]),e.colors.push(a[u*3]),e.colors.push(a[u*3+1]),e.colors.push(a[u*3+2]),e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2])),t.material&&t.material.mappingType!==`AllSame`&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[c*3]),e.normal.push(i[c*3+1]),e.normal.push(i[c*3+2]),e.normal.push(i[u*3]),e.normal.push(i[u*3+1]),e.normal.push(i[u*3+2]),e.normal.push(i[f*3]),e.normal.push(i[f*3+1]),e.normal.push(i[f*3+2])),t.uv&&t.uv.forEach(function(t,n){e.uvs[n]===void 0&&(e.uvs[n]=[]),e.uvs[n].push(o[n][c*2]),e.uvs[n].push(o[n][c*2+1]),e.uvs[n].push(o[n][u*2]),e.uvs[n].push(o[n][u*2+1]),e.uvs[n].push(o[n][f*2]),e.uvs[n].push(o[n][f*2+1])})}addMorphTargets(e,t,n,r,i){if(r.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];let a=this;r.forEach(function(r){r.rawTargets.forEach(function(r){let o=e.Objects.Geometry[r.geoID];o!==void 0&&a.genMorphGeometry(t,n,o,i,r.name)})})}genMorphGeometry(e,t,n,r,i){var a;let o=t.Vertices===void 0?[]:t.Vertices.a,s=t.PolygonVertexIndex===void 0?[]:t.PolygonVertexIndex.a,l=n.Vertices===void 0?[]:n.Vertices.a,u=n.Indexes?n.Indexes.a:[],d=e.attributes.position.count*3,f=new Float32Array(d);for(let e=0;e<u.length;e++){let t=u[e]*3;f[t]=l[e*3],f[t+1]=l[e*3+1],f[t+2]=l[e*3+2]}let p={vertexIndices:s,vertexPositions:f,baseVertexPositions:o},m=this.genBuffers(p),h=new c.Float32BufferAttribute(m.vertex,3);h.name=i||n.attrName,h.applyMatrix4(r),(a=e.morphAttributes.position)==null||a.push(h)}parseNormals(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return n===`IndexToDirect`&&(e.NormalIndex?i=e.NormalIndex.a:e.NormalsIndex&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}parseUVs(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return n===`IndexToDirect`&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}}parseVertexColors(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];n===`IndexToDirect`&&(i=e.ColorIndex.a);for(let e=0,t=new c.Color;e<r.length;e+=4)t.fromArray(r,e),t.toArray(r,e);return{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}}parseMaterialIndices(e){let t=e.MappingInformationType,n=e.ReferenceInformationType;if(t===`NoMappingInformation`)return{dataSize:1,buffer:[0],indices:[0],mappingType:`AllSame`,referenceType:n};let r=e.Materials.a,i=[];for(let e=0;e<r.length;++e)i.push(e);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}parseNurbsGeometry(e){let t=parseInt(e.Order);if(isNaN(t))return console.error(`THREE.FBXLoader: Invalid Order %s given for geometry ID: %s`,e.Order,e.id),new c.BufferGeometry;let n=t-1,r=e.KnotVector.a,i=[],a=e.Points.a;for(let e=0,t=a.length;e<t;e+=4)i.push(new c.Vector4().fromArray(a,e));let o,s;if(e.Form===`Closed`)i.push(i[0]);else if(e.Form===`Periodic`){o=n,s=r.length-1-o;for(let e=0;e<n;++e)i.push(i[e])}let l=new pg(n,r,i,o,s).getPoints(i.length*12);return new c.BufferGeometry().setFromPoints(l)}},Jh=class{parse(e,t,n){let r=[],i=this.parseClips(e,t,n);if(i!==void 0)for(let e in i){let t=i[e],a=this.addClip(t,n);r.push(a)}return r}parseClips(e,t,n){if(e.Objects.AnimationCurve===void 0)return;let r=this.parseAnimationCurveNodes(e);this.parseAnimationCurves(e,r,t);let i=this.parseAnimationLayers(e,r,t,n);return this.parseAnimStacks(e,i,t)}parseAnimationCurveNodes(e){let t=e.Objects.AnimationCurveNode,n=new Map;for(let e in t){let r=t[e];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){let e={id:r.id,attr:r.attrName,curves:{}};n.set(e.id,e)}}return n}parseAnimationCurves(e,t,n){let r=e.Objects.AnimationCurve;for(let e in r){let i={id:r[e].id,times:r[e].KeyTime.a.map(ng),values:r[e].KeyValueFloat.a},a=n.get(i.id);if(a!==void 0){let e=a.parents[0].ID,n=a.parents[0].relationship,r=t.get(e);r&&(n.match(/X/)?r.curves.x=i:n.match(/Y/)?r.curves.y=i:n.match(/Z/)?r.curves.z=i:n.match(/DeformPercent/)&&t.has(e)&&(r.curves.morph=i))}}}parseAnimationLayers(e,t,n,r){let i=e.Objects.AnimationLayer,a=new Map;for(let o in i){let i=[],s=n.get(parseInt(o));s!==void 0&&(s.children.forEach((a,o)=>{if(t.has(a.ID)){let s=t.get(a.ID);if(s.curves.x!==void 0||s.curves.y!==void 0||s.curves.z!==void 0){if(i[o]===void 0){let t=n.get(a.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID;if(t!==void 0){let n=e.Objects.Model[t.toString()];if(n===void 0){console.warn(`THREE.FBXLoader: Encountered a unused curve.`,a);return}let s={modelName:n.attrName?c.PropertyBinding.sanitizeNodeName(n.attrName):``,ID:n.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new c.Matrix4,eulerOrder:``,preRotation:[0,0,0],postRotation:[0,0,0]};r.traverse(function(e){e.ID===n.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))}),s.transform||(s.transform=new c.Matrix4),n.PreRotation&&(s.preRotation=n.PreRotation.value),n.PostRotation&&(s.postRotation=n.PostRotation.value),i[o]=s}}i[o]&&(i[o][s.attr]=s)}else if(s.curves.morph!==void 0){if(i[o]===void 0){let t=n.get(a.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID,r=n.get(t).parents[0].ID,s=n.get(r).parents[0].ID,l=n.get(s).parents[0].ID,u=e.Objects.Model[l];i[o]={modelName:u.attrName?c.PropertyBinding.sanitizeNodeName(u.attrName):``,morphName:e.Objects.Deformer[t].attrName}}i[o][s.attr]=s}}}),a.set(parseInt(o),i))}return a}parseAnimStacks(e,t,n){let r=e.Objects.AnimationStack,i={};for(let e in r){let a=n.get(parseInt(e)).children;a.length>1&&console.warn(`THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.`);let o=t.get(a[0].ID);i[e]={name:r[e].attrName,layer:o}}return i}addClip(e,t){let n=[],r=this;return e.layer.forEach(function(e){n=n.concat(r.generateTracks(e,t))}),new c.AnimationClip(e.name,-1,n)}generateTracks(e,t){let n=[],r=new c.Vector3,i=new c.Vector3;e.transform&&e.transform.decompose(r,new c.Quaternion,i);let a=r.toArray(),o=i.toArray();if(e.T!==void 0&&Object.keys(e.T.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.T.curves,a,`position`);t!==void 0&&n.push(t)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let t=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);t!==void 0&&n.push(t)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.S.curves,o,`scale`);t!==void 0&&n.push(t)}if(e.DeformPercent!==void 0){let r=this.generateMorphTrack(e,t);r!==void 0&&n.push(r)}return n}generateVectorTrack(e,t,n,r){let i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new c.VectorKeyframeTrack(e+`.`+r,i,a)}generateRotationTrack(e,t,n,r,i){let a,o;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){let e=this.interpolateRotations(t.x,t.y,t.z,i);a=e[0],o=e[1]}let s=cg(0),l=new c.Quaternion,u=new c.Quaternion;n!==void 0&&(n=n.map(c.MathUtils.degToRad),n.push(s),l.setFromEuler(new c.Euler().fromArray(n))),r!==void 0&&(r=r.map(c.MathUtils.degToRad),r.push(s),u.setFromEuler(new c.Euler().fromArray(r)),u.invert());let d=new c.Quaternion,f=new c.Euler,p=[];if(!o||!a)return new c.QuaternionKeyframeTrack(e+`.quaternion`,[0],[0]);for(let e=0;e<o.length;e+=3)f.set(o[e],o[e+1],o[e+2],i),d.setFromEuler(f),d.premultiply(l),d.multiply(u),e>2&&new c.Quaternion().fromArray(p,(e-3)/3*4).dot(d)<0&&d.set(-d.x,-d.y,-d.z,-d.w),d.toArray(p,e/3*4);return new c.QuaternionKeyframeTrack(e+`.quaternion`,a,p)}generateMorphTrack(e,t){let n=e.DeformPercent.curves.morph,r=n.values.map(function(e){return e/100}),i=t.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new c.NumberKeyframeTrack(e.modelName+`.morphTargetInfluences[`+i+`]`,n.times,r)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(e,t){return e-t}),t.length>1){let e=1,n=t[0];for(let r=1;r<t.length;r++){let i=t[r];i!==n&&(t[e]=i,n=i,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){let r=n,i=[],a=-1,o=-1,s=-1;return e.forEach(function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),a!==-1){let e=t.x.values[a];i.push(e),r[0]=e}else i.push(r[0]);if(o!==-1){let e=t.y.values[o];i.push(e),r[1]=e}else i.push(r[1]);if(s!==-1){let e=t.z.values[s];i.push(e),r[2]=e}else i.push(r[2])}),i}interpolateRotations(e,t,n,r){let i=[],a=[];i.push(e.times[0]),a.push(c.MathUtils.degToRad(e.values[0])),a.push(c.MathUtils.degToRad(t.values[0])),a.push(c.MathUtils.degToRad(n.values[0]));for(let o=1;o<e.values.length;o++){let s=[e.values[o-1],t.values[o-1],n.values[o-1]];if(isNaN(s[0])||isNaN(s[1])||isNaN(s[2]))continue;let l=s.map(c.MathUtils.degToRad),u=[e.values[o],t.values[o],n.values[o]];if(isNaN(u[0])||isNaN(u[1])||isNaN(u[2]))continue;u.map(c.MathUtils.degToRad);let d=[u[0]-s[0],u[1]-s[1],u[2]-s[2]],f=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){let t=Math.max(...f)/180,n=new c.Euler(l[0],l[1],l[2],r),s=new c.Euler(l[0],l[1],l[2],r),u=new c.Quaternion().setFromEuler(n),d=new c.Quaternion().setFromEuler(s);u.dot(d)&&d.set(-d.x,-d.y,-d.z,-d.w);let p=e.times[o-1],m=e.times[o]-p,h=new c.Quaternion,g=new c.Euler;for(let e=0;e<1;e+=1/t)h.copy(u.clone().slerp(d.clone(),e)),i.push(p+e*m),g.setFromQuaternion(h,r),a.push(g.x),a.push(g.y),a.push(g.z)}else i.push(e.times[o]),a.push(c.MathUtils.degToRad(e.values[o])),a.push(c.MathUtils.degToRad(t.values[o])),a.push(c.MathUtils.degToRad(n.values[o]))}return[i,a]}},Yh=class{constructor(){this.allNodes=new Qh,this.nodeStack=[],this.currentIndent=0,this.currentPropName=``}getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),--this.currentIndent}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Qh,this.nodeStack=[],this.currentProp=[],this.currentPropName=``;let t=this,n=e.split(/[\r\n]+/);return n.forEach(function(e,r){let i=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(i||a)return;let o=e.match(`^\\t{`+t.currentIndent+`}(\\w+):(.*){`),s=e.match(`^\\t{`+t.currentIndent+`}(\\w+):[\\s\\t\\r\\n](.*)`),c=e.match(`^\\t{`+(t.currentIndent-1)+`}}`);o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++r]):c?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}),this.allNodes}parseNodeBegin(e,t){let n=t[1].trim().replace(/^"/,``).replace(/"$/,``),r=t[2].split(`,`).map(function(e){return e.trim().replace(/^"/,``).replace(/"$/,``)}),i={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,i):n in o?(n===`PoseNode`?o.PoseNode.push(i):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==``&&(o[n][a.id]=i)):typeof a.id==`number`?(o[n]={},o[n][a.id]=i):n!==`Properties70`&&(n===`PoseNode`?o[n]=[i]:o[n]=i),typeof a.id==`number`&&(i.id=a.id),a.name!==``&&(i.attrName=a.name),a.type!==``&&(i.attrType=a.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==``&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n=``,r=``;return e.length>1&&(n=e[1].replace(/^(\w+)::/,``),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,``).replace(/"$/,``).trim(),i=t[2].replace(/^"/,``).replace(/"$/,``).trim();r===`Content`&&i===`,`&&(i=n.replace(/"/g,``).replace(/,$/,``).trim());let a=this.getCurrentNode();if(a.name===`Properties70`){this.parseNodeSpecialProperty(e,r,i);return}if(r===`C`){let e=i.split(`,`).slice(1),t=parseInt(e[0]),n=parseInt(e[1]),o=i.split(`,`).slice(3);o=o.map(function(e){return e.trim().replace(/^"/,``)}),r=`connections`,i=[t,n],dg(i,o),a[r]===void 0&&(a[r]=[])}r===`Node`&&(a.id=i),r in a&&Array.isArray(a[r])?a[r].push(i):r===`a`?a.a=i:a[r]=i,this.setCurrentProp(a,r),r===`a`&&i.slice(-1)!==`,`&&(a.a=lg(i))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==`,`&&(t.a=lg(t.a))}parseNodeSpecialProperty(e,t,n){let r=n.split(`",`).map(function(e){return e.trim().replace(/^\"/,``).replace(/\s/,`_`)}),i=r[0],a=r[1],o=r[2],s=r[3],c=r[4];switch(a){case`int`:case`enum`:case`bool`:case`ULongLong`:case`double`:case`Number`:case`FieldOfView`:c=parseFloat(c);break;case`Color`:case`ColorRGB`:case`Vector3D`:case`Lcl_Translation`:case`Lcl_Rotation`:case`Lcl_Scaling`:c=lg(c);break}this.getPrevNode()[i]={type:a,type2:o,flag:s,value:c},this.setCurrentProp(this.getPrevNode(),i)}},Xh=class{parse(e){let t=new Zh(e);t.skip(23);let n=t.getUint32();if(n<6400)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+n);let r=new Qh;for(;!this.endOfContent(t);){let e=this.parseNode(t,n);e!==null&&r.add(e.name,e)}return r}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let a=e.getUint8(),o=e.getString(a);if(r===0)return null;let s=[];for(let t=0;t<i;t++)s.push(this.parseProperty(e));let c=s.length>0?s[0]:``,l=s.length>1?s[1]:``,u=s.length>2?s[2]:``;for(n.singleProperty=i===1&&e.getOffset()===r;r>e.getOffset();){let r=this.parseNode(e,t);r!==null&&this.parseSubNode(o,n,r)}return n.propertyList=s,typeof c==`number`&&(n.id=c),l!==``&&(n.attrName=l),u!==``&&(n.attrType=u),o!==``&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){let e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if(e===`Connections`&&n.name===`C`){let e=[];n.propertyList.forEach(function(t,n){n!==0&&e.push(t)}),t.connections===void 0&&(t.connections=[]),t.connections.push(e)}else if(n.name===`Properties70`)Object.keys(n).forEach(function(e){t[e]=n[e]});else if(e===`Properties70`&&n.name===`P`){let e=n.propertyList[0],r=n.propertyList[1],i=n.propertyList[2],a=n.propertyList[3],o;e.indexOf(`Lcl `)===0&&(e=e.replace(`Lcl `,`Lcl_`)),r.indexOf(`Lcl `)===0&&(r=r.replace(`Lcl `,`Lcl_`)),o=r===`Color`||r===`ColorRGB`||r===`Vector`||r===`Vector3D`||r.indexOf(`Lcl_`)===0?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[e]={type:r,type2:i,flag:a,value:o}}else t[n.name]===void 0?typeof n.id==`number`?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name===`PoseNode`?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){let t=e.getString(1),n;switch(t){case`C`:return e.getBoolean();case`D`:return e.getFloat64();case`F`:return e.getFloat32();case`I`:return e.getInt32();case`L`:return e.getInt64();case`R`:return n=e.getUint32(),e.getArrayBuffer(n);case`S`:return n=e.getUint32(),e.getString(n);case`Y`:return e.getInt16();case`b`:case`c`:case`d`:case`f`:case`i`:case`l`:let r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(i===0)switch(t){case`b`:case`c`:return e.getBooleanArray(r);case`d`:return e.getFloat64Array(r);case`f`:return e.getFloat32Array(r);case`i`:return e.getInt32Array(r);case`l`:return e.getInt64Array(r)}let o=new Zh(Ih(new Uint8Array(e.getArrayBuffer(a))).buffer);switch(t){case`b`:case`c`:return o.getBooleanArray(r);case`d`:return o.getFloat64Array(r);case`f`:return o.getFloat32Array(r);case`i`:return o.getInt32Array(r);case`l`:return o.getInt64Array(r)}break;default:throw Error(`THREE.FBXLoader: Unknown property type `+t)}}},Zh=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t===void 0?!0:t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)==1}getBooleanArray(e){let t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){let e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){let e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){let e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){let e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){let e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){let t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);let r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}},Qh=class{constructor(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}add(e,t){this[e]=t}};function $h(e){return e.byteLength>=21&&ug(e,0,21)===`Kaydara FBX Binary \0`}function eg(e){let t=[`K`,`a`,`y`,`d`,`a`,`r`,`a`,`\\`,`F`,`B`,`X`,`\\`,`B`,`i`,`n`,`a`,`r`,`y`,`\\`,`\\`],n=0;function r(t){let r=e[t-1];return e=e.slice(n+t),n++,r}for(let e=0;e<t.length;++e)if(r(1)===t[e])return!1;return!0}function tg(e){let t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw Error(`THREE.FBXLoader: Cannot find the version number for the file given.`)}function ng(e){return e/46186158e3}var rg=[];function ig(e,t,n,r){let i;switch(r.mappingType){case`ByPolygonVertex`:i=e;break;case`ByPolygon`:i=t;break;case`ByVertice`:i=n;break;case`AllSame`:i=r.indices[0];break;default:console.warn(`THREE.FBXLoader: unknown attribute mapping type `+r.mappingType),i=0}r.referenceType===`IndexToDirect`&&(i=r.indices[i]);let a=i*r.dataSize,o=a+r.dataSize;return fg(rg,r.buffer,a,o)}var ag=new c.Euler,og=new c.Vector3;function sg(e){let t=new c.Matrix4,n=new c.Matrix4,r=new c.Matrix4,i=new c.Matrix4,a=new c.Matrix4,o=new c.Matrix4,s=new c.Matrix4,l=new c.Matrix4,u=new c.Matrix4,d=new c.Matrix4,f=new c.Matrix4,p=new c.Matrix4,m=e.inheritType?e.inheritType:0;e.translation&&t.setPosition(og.fromArray(e.translation));let h=cg(0);if(e.preRotation){let t=e.preRotation.map(c.MathUtils.degToRad);t.push(h),n.makeRotationFromEuler(ag.fromArray(t))}if(e.rotation){let t=e.rotation.map(c.MathUtils.degToRad);t.push(e.eulerOrder||h),r.makeRotationFromEuler(ag.fromArray(t))}if(e.postRotation){let t=e.postRotation.map(c.MathUtils.degToRad);t.push(h),i.makeRotationFromEuler(ag.fromArray(t)),i.copy(i.clone().invert())}e.scale&&a.scale(og.fromArray(e.scale)),e.scalingOffset&&s.setPosition(og.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(og.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(og.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(og.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(f.copy(e.parentMatrix),d.copy(e.parentMatrixWorld));let g=n.clone().multiply(r).multiply(i),_=new c.Matrix4;_.extractRotation(d);let v=new c.Matrix4;v.copyPosition(d);let y=v.clone().invert().multiply(d),b=_.clone().invert().multiply(y),x=a,S=new c.Matrix4;if(m===0)S.copy(_).multiply(g).multiply(b).multiply(x);else if(m===1)S.copy(_).multiply(b).multiply(g).multiply(x);else{let e=new c.Matrix4().scale(new c.Vector3().setFromMatrixScale(f)).clone().invert(),t=b.clone().multiply(e);S.copy(_).multiply(g).multiply(t).multiply(x)}let C=u.clone().invert(),w=o.clone().invert(),T=t.clone().multiply(l).multiply(u).multiply(n).multiply(r).multiply(i).multiply(C).multiply(s).multiply(o).multiply(a).multiply(w),E=new c.Matrix4().copyPosition(T),D=d.clone().multiply(E);return p.copyPosition(D),T=p.clone().multiply(S),T.premultiply(d.clone().invert()),T}function cg(e){e=e||0;let t=[`ZYX`,`YZX`,`XZY`,`ZXY`,`YXZ`,`XYZ`];return e===6?(console.warn(`THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.`),t[0]):t[e]}function lg(e){return e.split(`,`).map(function(e){return parseFloat(e)})}function ug(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),new TextDecoder().decode(new Uint8Array(e,t,n))}function dg(e,t){for(let n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}function fg(e,t,n,r){for(let i=n,a=0;i<r;i++,a++)e[a]=t[i];return e}var pg=class extends c.Curve{constructor(e,t,n,r,i){super();let a=t?t.length-1:0,o=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||a;for(let e=0;e<o;++e){let t=n[e];this.controlPoints[e]=new c.Vector4(t.x,t.y,t.z,t.w)}}getPoint(e,t=new c.Vector3){let n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=gg(this.degree,this.knots,this.controlPoints,r);return i.w!==1&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}getTangent(e,t=new c.Vector3){let n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=xg(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n}toJSON(){let e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(e=>e.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(e=>new c.Vector4(e[0],e[1],e[2],e[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}};function mg(e,t,n){let r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;let i=e,a=r,o=Math.floor((i+a)/2);for(;t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function hg(e,t,n,r){let i=[],a=[],o=[];i[0]=1;for(let s=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[e+s]-t;let n=0;for(let e=0;e<s;++e){let t=o[e+1],r=a[s-e],c=i[e]/(t+r);i[e]=n+t*c,n=r*c}i[s]=n}return i}function gg(e,t,n,r){let i=mg(e,r,t),a=hg(i,r,e,t),o=new c.Vector4(0,0,0,0);for(let t=0;t<=e;++t){let r=n[i-e+t],s=a[t],c=r.w*s;o.x+=r.x*c,o.y+=r.y*c,o.z+=r.z*c,o.w+=r.w*s}return o}function _g(e,t,n,r,i){let a=[];for(let e=0;e<=n;++e)a[e]=0;let o=[];for(let e=0;e<=r;++e)o[e]=a.slice(0);let s=[];for(let e=0;e<=n;++e)s[e]=a.slice(0);s[0][0]=1;let c=a.slice(0),l=a.slice(0);for(let r=1;r<=n;++r){c[r]=t-i[e+1-r],l[r]=i[e+r]-t;let n=0;for(let e=0;e<r;++e){let t=l[e+1],i=c[r-e];s[r][e]=t+i;let a=s[e][r-1]/s[r][e];s[e][r]=n+t*a,n=i*a}s[r][r]=n}for(let e=0;e<=n;++e)o[0][e]=s[e][n];for(let e=0;e<=n;++e){let t=0,i=1,c=[];for(let e=0;e<=n;++e)c[e]=a.slice(0);c[0][0]=1;for(let a=1;a<=r;++a){let r=0,l=e-a,u=n-a;e>=a&&(c[i][0]=c[t][0]/s[u+1][l],r=c[i][0]*s[l][u]);let d=l>=-1?1:-l,f=e-1<=u?a-1:n-e;for(let e=d;e<=f;++e)c[i][e]=(c[t][e]-c[t][e-1])/s[u+1][l+e],r+=c[i][e]*s[l+e][u];e<=u&&(c[i][a]=-c[t][a-1]/s[u+1][e],r+=c[i][a]*s[e][u]),o[a][e]=r;let p=t;t=i,i=p}}let u=n;for(let e=1;e<=r;++e){for(let t=0;t<=n;++t)o[e][t]*=u;u*=n-e}return o}function vg(e,t,n,r,i){let a=i<e?i:e,o=[],s=mg(e,r,t),l=_g(s,r,e,a,t),u=[];for(let e=0;e<n.length;++e){let t=n[e].clone(),r=t.w;t.x*=r,t.y*=r,t.z*=r,u[e]=t}for(let t=0;t<=a;++t){let n=u[s-e].clone().multiplyScalar(l[t][0]);for(let r=1;r<=e;++r)n.add(u[s-e+r].clone().multiplyScalar(l[t][r]));o[t]=n}for(let e=a+1;e<=i+1;++e)o[e]=new c.Vector4(0,0,0);return o}function yg(e,t){let n=1;for(let t=2;t<=e;++t)n*=t;let r=1;for(let e=2;e<=t;++e)r*=e;for(let n=2;n<=e-t;++n)r*=n;return n/r}function bg(e){let t=e.length,n=[],r=[];for(let i=0;i<t;++i){let t=e[i];n[i]=new c.Vector3(t.x,t.y,t.z),r[i]=t.w}let i=[];for(let e=0;e<t;++e){let t=n[e].clone();for(let n=1;n<=e;++n)t.sub(i[e-n].clone().multiplyScalar(yg(e,n)*r[n]));i[e]=t.divideScalar(r[0])}return i}function xg(e,t,n,r,i){return bg(vg(e,t,n,r,i))}var Sg=new c.Vector3;function Cg(e,t){switch(t){case`D`:return new Float64Array(e);case`F`:return new Float32Array(e);case`L`:return new Int32Array(e);case`I`:return new Int16Array(e);default:return new Uint8Array(e)}}function wg(e,t={}){var n,r,i;let a=(n=t.upAxis)==null?`Z`:n,o=(r=t.fetcher)==null?qs:r,s=(i=t.onDownloadProgress)==null?K:i,l={byteLength:0};return Promise.resolve().then(()=>o.ajax(e,{responseType:`arraybuffer`},void 0,void 0,s)).then(n=>{var r,i;return l.byteLength=n.body.byteLength,Tg(new Uint8Array(n.body),{light:(r=t.light)==null?!0:r,color:t.color,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(i=e.split(`?`)[1])==null?``:i,fetcher:o})}).then(t=>{let n=new c.Group;return n.name=e,n.add(t.object),a===`Y`&&n.applyMatrix4(js),{type:`x3p`,modelUpAxis:`Z`,upAxis:a,uri:e,byteLength:l.byteLength,memoryUsage:fl(n),scene:n,textures:[],animations:[],dispose:()=>t.dispose()}})}function Tg(e,t){var n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,ee,P,F,te,ne,I,re,ie,L,ae,R,z,oe,se,ce,le,ue,de,fe,pe,me,he,ge;let _e=Uh(e),ve=``,ye=null;for(let e of Object.keys(_e))/(^|\/)main\.xml$/i.test(e)&&(ye=_e[e],ve=e.slice(0,e.lastIndexOf(`/`)+1));if(!ye)throw Error(`X3p: main.xml not found.`);if(typeof DOMParser>`u`)throw Error(`X3p: DOMParser not found.`);let be=(n=t.color)==null?new c.Color(10066329):n,xe=new DOMParser,Se=pu(ye),Ce=xe.parseFromString(Se,`text/xml`),we=Ce.querySelector(`Record1 Axes`),Te={x:{type:(a=(i=(r=we==null?void 0:we.querySelector(`CX AxisType`))==null?void 0:r.textContent)==null?void 0:i.toUpperCase())==null?`I`:a,dataType:(l=(s=(o=we==null?void 0:we.querySelector(`CX DataType`))==null?void 0:o.textContent)==null?void 0:s.toUpperCase())==null?`D`:l,increment:Number((d=(u=we==null?void 0:we.querySelector(`CX Increment`))==null?void 0:u.textContent)==null?`1`:d),offset:Number((p=(f=we==null?void 0:we.querySelector(`CX Offset`))==null?void 0:f.textContent)==null?`0`:p)},y:{type:(g=(h=(m=we==null?void 0:we.querySelector(`CY AxisType`))==null?void 0:m.textContent)==null?void 0:h.toUpperCase())==null?`I`:g,dataType:(y=(v=(_=we==null?void 0:we.querySelector(`CY DataType`))==null?void 0:_.textContent)==null?void 0:v.toUpperCase())==null?`D`:y,increment:Number((x=(b=we==null?void 0:we.querySelector(`CY Increment`))==null?void 0:b.textContent)==null?`1`:x),offset:Number((C=(S=we==null?void 0:we.querySelector(`CY Offset`))==null?void 0:S.textContent)==null?`0`:C)},z:{type:(E=(T=(w=we==null?void 0:we.querySelector(`CZ AxisType`))==null?void 0:w.textContent)==null?void 0:T.toUpperCase())==null?`A`:E,dataType:(k=(O=(D=we==null?void 0:we.querySelector(`CZ DataType`))==null?void 0:D.textContent)==null?void 0:O.toUpperCase())==null?`D`:k,increment:Number((j=(A=we==null?void 0:we.querySelector(`CZ Increment`))==null?void 0:A.textContent)==null?`1`:j),offset:Number((N=(M=we==null?void 0:we.querySelector(`CZ Offset`))==null?void 0:M.textContent)==null?`0`:N)}},Ee=null,De=Ce.querySelector(`Record1 Axes Rotation`);De&&(Ee=new c.Matrix3,Ee.set(Number((P=(ee=De.querySelector(`r11`))==null?void 0:ee.textContent)==null?0:P),Number((te=(F=De.querySelector(`r12`))==null?void 0:F.textContent)==null?0:te),Number((I=(ne=De.querySelector(`r13`))==null?void 0:ne.textContent)==null?0:I),Number((ie=(re=De.querySelector(`r21`))==null?void 0:re.textContent)==null?0:ie),Number((ae=(L=De.querySelector(`r22`))==null?void 0:L.textContent)==null?0:ae),Number((z=(R=De.querySelector(`r23`))==null?void 0:R.textContent)==null?0:z),Number((se=(oe=De.querySelector(`r31`))==null?void 0:oe.textContent)==null?0:se),Number((le=(ce=De.querySelector(`r32`))==null?void 0:ce.textContent)==null?0:le),Number((de=(ue=De.querySelector(`r33`))==null?void 0:ue.textContent)==null?0:de)));let Oe=(fe=Ce.querySelector(`Record3 DataLink PointDataLink`))==null?void 0:fe.textContent;if(typeof Oe!=`string`)throw Error(`X3p: PointDataLink not found.`);Oe=ec(ve,Oe);let ke=_e[Oe];if(!ke)throw Error(`X3p: ${Oe} not found.`);let Ae=Cg(ke.buffer,Te.z.dataType),je=Number((me=(pe=Ce.querySelector(`Record3 MatrixDimension SizeX`))==null?void 0:pe.textContent)==null?`0`:me),Me=Number((ge=(he=Ce.querySelector(`Record3 MatrixDimension SizeY`))==null?void 0:he.textContent)==null?`0`:ge),Ne=Math.floor(je-1),Pe=Math.floor(Me-1),Fe=Ne+1,B=Pe+1,Ie=new Float32Array(Fe*B*3),Le=new Float32Array(Fe*B*2),Re=new Uint32Array(Ne*Pe*6),ze=new c.Box3;for(let e=0;e<B;e++){let t=e*Te.y.increment+Te.y.offset;for(let n=0;n<Fe;n++){let r=e*Fe+n,i=n*Te.x.increment+Te.x.offset,a=Ae[r],o=!isNaN(a),s=o?a:NaN;Sg.set(i,-t,s),Ee&&Sg.applyMatrix3(Ee),o&&ze.expandByPoint(Sg),Ie[r*3+0]=Sg.x,Ie[r*3+1]=Sg.y,Ie[r*3+2]=Sg.z,Le[r*2+0]=n/Ne,Le[r*2+1]=1-e/Pe}}for(let e=0;e<Pe;e++)for(let t=0;t<Ne;t++){let n=t+Fe*e,r=t+Fe*(e+1),i=t+1+Fe*(e+1),a=t+1+Fe*e,o=(e*Ne+t)*6;Re[o+0]=n,Re[o+1]=r,Re[o+2]=a,Re[o+3]=r,Re[o+4]=i,Re[o+5]=a}let Be=new c.BufferGeometry;Be.setAttribute(`position`,new c.BufferAttribute(Ie,3)),Be.setAttribute(`uv`,new c.BufferAttribute(Le,2)),Be.setIndex(new c.BufferAttribute(Re,1)),(!Be.groups||Be.groups.length===0)&&Be.addGroup(0,Be.index?Be.index.count:Be.attributes.position.count,0),Be.boundingBox=ze;let Ve=Pr(t.light?`phong`:`basic`);return Ve.flatShading=!0,Ve.color.copy(be),{object:new Ot(Be,[Ve]),dispose:()=>{Be.dispose(),Ve.dispose()}}}function Eg(e){let t=e.length/32;if(e.length%32!=0)throw Error(`Invalid splat file: data length ${e.length} is not a multiple of 32`);let n=new Float32Array(3*t),r=new Float32Array(4*t),i=new Float32Array(3*t),a=new Uint8Array(4*t),o=new Float32Array(e.buffer),s=new Uint8Array(e.buffer);for(let e=0;e<t;e++)n[3*e+0]=o[8*e+0],n[3*e+1]=o[8*e+1],n[3*e+2]=o[8*e+2],i[3*e+0]=o[8*e+3+0],i[3*e+1]=o[8*e+3+1],i[3*e+2]=o[8*e+3+2],a[4*e+0]=s[32*e+24+0],a[4*e+1]=s[32*e+24+1],a[4*e+2]=s[32*e+24+2],a[4*e+3]=s[32*e+24+3],r[4*e+0]=(s[32*e+28+0]-128)/128,r[4*e+1]=(s[32*e+28+1]-128)/128,r[4*e+2]=(s[32*e+28+2]-128)/128,r[4*e+3]=(s[32*e+28+3]-128)/128;return{numPoints:t,positions:n,scales:i,rotations:r,colors:a}}function Dg(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?qs:i,l=(a=t.onDownloadProgress)==null?K:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>Eg(new Uint8Array(e))).then(t=>{let n=new At({positions:t.positions,scales:t.scales,rotations:t.rotations,colors:t.colors,numPoints:t.numPoints});return o===`Y`&&n.applyMatrix4(As),{type:`splat`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:fl(n),scene:n,textures:[],animations:[],dispose:()=>n.dispose()}})}var Og=new c.Matrix4,kg=5e3,Ag=1e3;function jg(e,t){e.name=t.id;let n=t.tileset.properties.floorInfo;e.traverse(e=>{if(`floor`in t.extras){if(e instanceof nn&&(e.floorIndex=t.extras.floor),e instanceof c.Mesh||e instanceof c.Points){let n=Array.isArray(e.material)?e.material:e.material?[e.material]:[];for(let e of n)Ut(e)&&(e.floorIndex=t.extras.floor),e.isPBMPointCloudMaterial&&(e.floorIndex=t.extras.floor)}}else if((e instanceof Ot||e instanceof kt)&&n){let r=new c.Box3().expandByObject(e).getCenter(new c.Vector3),i=0;for(let e=0;e<n.length;e++){let{ground:t,height:a}=n[e];if(r.y<t+a){i=e;break}}t.floor=i,t.tileset.floorLength=Math.max(t.tileset.floorLength,t.floor+1),e.material.forEach(e=>e.floorIndex=i)}})}function Mg(e,t){if(!e.content)return Promise.resolve(e);let n=e.content,r=tc(n.uri,t.search);if(e.type===`TILESET`){let i=Ec(r,{key:`model.${e.siblingIndex}`});return n.loadState=`LOADING`,n.loadStateUpdateTime=G(),t.fetcher.ajax(i,{responseType:`text`},void 0,void 0,(e,t,r)=>{n.loadState===`LOADING`&&(n.loadProgress=e)}).then(e=>e.body).then(e=>{let t=r.slice(0,r.lastIndexOf(`/`)+1);return cm(JSON.parse(e),t)}).then(t=>{n.loadState=`READY`,n.loadStateUpdateTime=G(),n.loadfailRetryDelay=0,e.children.length===0&&(e.children=[new gf(`${e.id}.0`,t.root,e.tileset,e)])}).then(()=>e).catch(e=>(n.loadState=`FAILED`,n.loadStateUpdateTime=G(),n.loadfailRetryDelay=Math.min(n.loadfailRetryDelay+1e3,5e3),Promise.reject(e)))}if(e.type===`SCENEGRAPH`){n.loadState=`LOADING`,n.loadStateUpdateTime=G();let i=(e,t,r)=>{n.loadState===`LOADING`&&(n.loadProgress=e,r&&(n.byteLength=r))};return Promise.resolve().then(()=>{var n,a,o,s,l,u,d,f,p,m,h,g;let _=``,[v,y]=r.split(`#`),b=(y||v).split(`?`)[0].match(/\.([0-9a-zA-Z]+)$/);if(b&&(_=b[1]),_===`b3dm`)return Pm(Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:e.tileset.asset.gltfUpAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,jg(t.scene,e),t));if(_===`pnts`)return Um(Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,computeBoundingBox:!1,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>{if(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,e.boundingVolume){let n=e.boundingVolume;t.scene.traverse(e=>{if(e instanceof nn){Og.copy(e.matrixWorld).invert();let t=new c.Box3;n.getBoundingBox(t),t.applyMatrix4(Og),e.setLocalBoundingBox(t)}})}return jg(t.scene,e),t});if(_===`glb`||_===`gltf`)return Rd(Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:e.tileset.asset.gltfUpAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,jg(t.scene,e),t));if(_===`at3d`)return Il(e.extras.at3d?r:Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(n=e.extras.at3d)==null?void 0:n.textureBaseUri,textureArray:(a=e.extras.at3d)==null?void 0:a.textureArray,textureOptions:(o=e.extras.at3d)==null?void 0:o.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`ply`)return Zl(e.extras.ply?r:Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:(s=e.extras.ply)==null?void 0:s.upAxis,type:`pbmPointCloud`,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`pbm`)return ml(e.extras.pbm?r:Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(l=e.extras.pbm)==null?void 0:l.textureBaseUri,textureArray:(u=e.extras.pbm)==null?void 0:u.textureArray,textureOptions:(d=e.extras.pbm)==null?void 0:d.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`dome`)return Bl(e.extras.dome?r:Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(f=e.extras.dome)==null?void 0:f.textureBaseUri,textureOptions:(p=e.extras.dome)==null?void 0:p.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`domez`)return ql(e.extras.domez?r:Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,textureBaseUri:(m=e.extras.domez)==null?void 0:m.textureBaseUri,textureOptions:(h=e.extras.domez)==null?void 0:h.textureOptions,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`obj`)return th(e.extras.obj?r:Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:(g=e.extras.obj)==null?void 0:g.upAxis,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`fbx`)return Wh(e.extras.fbx?r:Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`x3p`)return wg(e.extras.x3p?r:Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:t.light,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`spz`)return Fd(Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:`Z`,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t.scene.transformChanged=!0,t));if(_===`splat`)return Dg(Ec(r,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,fetcher:t.fetcher,onDownloadProgress:i}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));throw Error(`Invalid Tile content: ${r}`)}).then(r=>{let i={type:r.type,uri:r.uri,byteLength:r.byteLength,memoryUsage:r.memoryUsage,object:new Up(e.id,r.scene,r.animations,r.dispose)};return Promise.resolve().then(()=>{i.object.traverse(e=>{e.matrix.compose(e.position,e.quaternion,e.scale),e.matrixAutoUpdate=!1})}).then(()=>Promise.all([i.object.generateBvhTree(),t.renderer?mm(r.textures,t.renderer):null])).then(()=>(n.loadState=`READY`,n.loadStateUpdateTime=G(),n.loadfailRetryDelay=0,n.byteLength=i.byteLength,n.memoryUsage=i.memoryUsage,n.data=i,e)).catch(t=>(Ng(e),Promise.reject(t)))}).catch(e=>(n.loadState=`FAILED`,n.loadStateUpdateTime=G(),e instanceof Is&&e.httpStatus===0||e instanceof Ls||e instanceof Fs?n.loadfailRetryDelay=H(n.loadfailRetryDelay+Ag,Ag,kg):n.loadfailRetryDelay=1/0,Promise.reject(e)))}throw Error(`Invalid Tile type: ${e.type}`)}function Ng(e){e.content&&(e.content.data&&e.content.data.object.dispose(),e.content.data=void 0,e.content.loadState=`UNLOADED`,e.content.loadStateUpdateTime=G(),e.content.byteLength=0,e.content.memoryUsage=0)}var Pg=new c.Vector3,Fg=new c.Matrix3,Ig=new c.Matrix4,Lg=6378137,Rg=298.257223563;function zg(e){let t=Lg-Lg/Rg,n=(Lg*Lg-t*t)/(Lg*Lg),r=Math.sqrt(e.x*e.x+e.y*e.y),i=0,a=Math.atan2(e.z,r),o=0;for(;i++<1e3;){let t=Math.sin(a),i=Lg/Math.sqrt(1-n*t*t);o=r/Math.cos(a)-i;let s=Math.atan2(e.z/(i*(1-n)+o),r/(i+o));if(isNaN(s)||Math.abs(s-a)<1e-12)break;a=s}return e.set(a,Math.atan2(e.y,e.x),o)}function Bg(e){let{x:t,y:n,z:r}=e,i=Lg-Lg/Rg,a=(Lg*Lg-i*i)/(Lg*Lg),o=Math.sin(t),s=Math.cos(t),c=Math.sin(n),l=Math.cos(n),u=Lg/Math.sqrt(1-a*o*o),d=(u+r)*s*l,f=(u+r)*s*c,p=(i*i/(Lg*Lg)*u+r)*o;return e.set(d,f,p)}function Vg(e,t){let{x:n,y:r,z:i}=zg(Pg.copy(e)),a=Math.sin(n),o=Math.sin(r),s=Math.cos(n),c=Math.cos(r);t.fromArray([-o,-a*c,s*c,0,+c,-a*o,s*o,0,0,s,a,0,0,0,0,1]);let l=Fg.setFromMatrix4(t),u=Pg.copy(e).applyMatrix3(l).multiplyScalar(-1);t.setPosition(u);let d=Ig.fromArray([1,0,0,0,0,1,0,0,0,0,1,0,0,0,i,1]);return t.premultiply(d),t}var Hg=new c.Matrix4().fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),Ug=new c.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),Wg=new c.Matrix4().copy(Hg),Gg=new c.Matrix4().copy(Ug);function Kg(e,t={}){var n,r,i;let a,o,s;if(typeof e.tileset.rootMeta.creationTime==`string`)if(typeof e.tileset.rootMeta.numTotalPoints==`number`&&e.tileset.rootMeta.numTotalPoints>0){s=4,t.powerPreference===`high`&&(s=2),a=s/1.6;let c=0;if(((n=e.tileset.rootMeta.taskParameters)==null?void 0:n.point_homogenization)===`1`&&(r=e.tileset.rootMeta.taskParameters)!=null&&r.homo_point_density){let t=Number((i=e.tileset.rootMeta.taskParameters)==null?void 0:i.homo_point_density);isFinite(t)&&!isNaN(t)&&(c=t)}c<=0&&(c=.02),o=c*1.4}else s=5,t.powerPreference===`high`&&(s=4),a=0,o=.03;else s=6,a=0,o=.03,e.name===`aerophoto`?(s=12,t.powerPreference===`high`&&(s=10)):e.tileset.asset.extras&&typeof e.tileset.asset.extras.name==`string`&&/^matterport\b/i.test(e.tileset.asset.extras.name)&&(s=5,t.powerPreference===`high`&&(s=4));return{pointScale:o,pointMinPixel:a,maxScreenSpaceError:s}}var qg=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAABCAYAAACouxZ2AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAAQAAAAB7UD0+AAACA0lEQVRIDXWUW3YjIQxEwdnV/GT/q8kO3FO3pAJst3PSAaR6Cbszf//9XeMxxpjXmI+pVXudp2s6PC4dqHff9e6D7/PZLy46xQvG+sZvrfK8xgXUeq85yINe9bdmtOK1+kun5vjgq58a+eZPna9jvmjiserqG/+Whathvo3L3WhV89L9sXI/m18z2uene9ap/ftsuT9WZxoHXzW56/fpj8l7+tTw7P011NdpqnY19sRsfuHMA9u8oZWfDz4+fra/dfG1V60ydZ7qba1g7UNAeK0JP7ydD7/OqH6wO2f7HTq+B/lbL9qsB3/N1/UzR81XfPzw4tp5OPvRneacteq8Xo0xR3vuv/kPz0KtX0Nhg0eHuaNXdWI3X/ld427h++vzyp99V6VPrzWFhbv4ayay4oFecm198MmUXN/mL+x7npq/uJXBGb/MTw4+t+SvbLoTZnUW5uHhz7nWcTxT73OwXV7cxT9wbBf/0LnDBgcnHmtPLYba32Hp808sMy1u88yhr58n70/v4xX92GSN19l/2UsqGmiH94Hpxjcs+DO/ccpIVNVp62PUWXu//ur1GQy1Cf+GZ13rtNYN1po3/NI79fGXibHkq4z25xvV2pW3szpneXsW8SsreTe/NIPrtXMnH7wPf+LEN6tqhUVHj3XKD/72p9eafCeYB3zuonnbv7yqP8d/o4K6gRb1wbYAAAAASUVORK5CYII=`;function Jg(e){return Object.keys(e)}function Y(e,t){return e==t}function Yg(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}function Xg(e,t){return e instanceof c.Vector3&&t instanceof c.Vector3?e.equals(t):e===t}function Zg(e,t){return e instanceof c.Box3&&t instanceof c.Box3?e.equals(t):e===t}var Qg={castShadow:Y,receiveShadow:Y,vertexMarks:Y,pano0:Y,pano1:Y,pano0Depth:Y,pano1Depth:Y,panoFilter:Y,refinedScreen:Y,modelAlpha:Y,progress:Y,transition:Y,opacity:Y,floorStyle:Y,colorStyle:Y,constantColor:Xg,shownFloorIndex:Y,clippers:Yg,brightness:Y,useHDR:Y,maxDisplayBoost:Y,pointShape:Y,pointSize:Y,pointBack:Y,pointScale:Y,pointMinPixel:Y,pointMaxPixel:Y,pointAppearAnimation:Y,colorSaturation:Y,colorBrightness:Y,useAddBlend:Y,outlineGain:Y,distanceGain:Y,gradientTexture:Y,boundingBox:Zg,gaussianSplattingSHDegree:Y,minLevelOfDetail:Y,maxLevelOfDetail:Y,minGeometricError:Y,maxGeometricError:Y,panoramaMinGeometricError:Y,skipLevelOfDetail:Y,mostDetail:Y,loadSiblings:Y,cameraCulling:Y,maxMemoryUsage:Y,maxRequests:Y,requestOrder:Y,maxScreenSpaceError:Y,memoryAdjustedScreenSpaceError:Y,cacheCameras:Yg},$g=(()=>{let e;return e=typeof document<`u`?new c.TextureLoader().load(qg):new c.Texture,e.minFilter=c.NearestFilter,e.magFilter=c.NearestFilter,e.wrapS=c.RepeatWrapping,e.wrapT=c.RepeatWrapping,e})(),e_=Object.freeze(new c.Vector3(.6,.6,.6)),t_=Object.freeze([]),n_=Object.freeze(new c.Box3),r_=Object.freeze([]);function i_(){return{castShadow:void 0,receiveShadow:void 0,vertexMarks:void 0,pano0:void 0,pano1:void 0,pano0Depth:void 0,pano1Depth:void 0,panoFilter:void 0,refinedScreen:void 0,floorStyle:void 0,colorStyle:void 0,constantColor:void 0,shownFloorIndex:void 0,modelAlpha:void 0,opacity:void 0,progress:void 0,transition:void 0,clippers:void 0,brightness:void 0,useHDR:void 0,maxDisplayBoost:void 0,pointSize:void 0,pointBack:void 0,pointShape:void 0,pointScale:void 0,pointMaxPixel:void 0,pointMinPixel:void 0,pointAppearAnimation:void 0,gradientTexture:void 0,colorSaturation:void 0,colorBrightness:void 0,outlineGain:void 0,distanceGain:void 0,useAddBlend:void 0,boundingBox:void 0,gaussianSplattingSHDegree:void 0,minLevelOfDetail:void 0,maxLevelOfDetail:void 0,minGeometricError:void 0,maxGeometricError:void 0,panoramaMinGeometricError:void 0,skipLevelOfDetail:void 0,mostDetail:void 0,loadSiblings:void 0,cameraCulling:void 0,maxMemoryUsage:void 0,maxRequests:void 0,requestOrder:void 0,maxScreenSpaceError:void 0,memoryAdjustedScreenSpaceError:void 0,cacheCameras:void 0}}var a_={versionNumber:0,castShadow:!1,receiveShadow:!1,vertexMarks:!0,pano0:null,pano1:null,pano0Depth:null,pano1Depth:null,panoFilter:null,refinedScreen:null,floorStyle:`OPACITY`,colorStyle:`RGB`,constantColor:e_,shownFloorIndex:-1,modelAlpha:1,opacity:1,progress:0,transition:`FADE`,clippers:t_,brightness:1,useHDR:!1,maxDisplayBoost:1,pointSize:`ATTENUATION`,pointBack:`DARK`,pointShape:`CIRCLE`,pointScale:.02,pointMaxPixel:40,pointMinPixel:0,pointAppearAnimation:!0,gradientTexture:$g,colorSaturation:0,colorBrightness:0,outlineGain:0,distanceGain:0,useAddBlend:!1,boundingBox:n_,gaussianSplattingSHDegree:0,minLevelOfDetail:0,maxLevelOfDetail:20,minGeometricError:0,maxGeometricError:1e4,panoramaMinGeometricError:.04,skipLevelOfDetail:!1,mostDetail:!1,loadSiblings:!1,cameraCulling:!0,maxMemoryUsage:64,maxRequests:6,requestOrder:`SCREEN_SPACE_ERROR`,maxScreenSpaceError:4,memoryAdjustedScreenSpaceError:!1,cacheCameras:r_},o_=a_.versionNumber;function s_(e={}){return Object.assign(e,a_)}var c_=Jg(i_());function l_(e,t,n){let r=Qg[t];if(!r)return!1;Array.isArray(n)&&(n=n.slice());let i=e[t];return r(i,n)?!1:(e[t]=n,!0)}var X=class e{static createDefault(){return s_()}static resolveValueTo(t,...n){let r=s_(t);for(let t of n){let n=t instanceof e?t.versionNumber:++o_;r.versionNumber=r.versionNumber*31+n|0;for(let e of c_)t[e]!==void 0&&l_(r,e,t[e])}return r}static resolveValue(...t){if(typeof t[0]==`string`){let e=t.shift(),n=t,r=a_[e];for(let t of n)t[e]!==void 0&&(r=t[e]);return r}else{let n=t;return e.resolveValueTo({},...n)}}constructor(e){this.id=Mt(),this.versionNumber=++o_,this.unbind=new Map,this.value=i_(),e&&this.copy(e);for(let e of c_)Object.defineProperty(this,e,{get(){return this.value[e]}});Dt(this)}resolveValue(...t){return e.resolveValue(...t,this)}assignValue(e,t){let n=this.unbind.get(e);n&&(this.unbind.delete(e),n());let r=l_(this.value,e,t),i=this.value[e];if(i instanceof Rt){let t=i.on(`update`,()=>this.versionNumber=++o_);this.unbind.set(e,t)}return r}set(e,t){let n=!1;if(typeof e==`string`)t!==void 0&&this.assignValue(e,t)&&(n=!0);else{let t=e;for(let e of c_)t[e]!==void 0&&this.assignValue(e,t[e])&&(n=!0)}return n&&(this.versionNumber=++o_),this}reset(...e){let t=!1;for(let n of e)this.assignValue(n,void 0)&&(t=!0);return t&&(this.versionNumber=++o_),this}resetAll(){return this.reset(...c_)}copy(e){let t=!0;for(let n of c_)this.assignValue(n,e[n])&&(t=!0);return t&&(this.versionNumber=++o_),this}},u_=new c.Vector3,d_=new rf,f_=new nf,p_=new WeakMap,m_=new WeakMap,h_=new WeakMap,g_={TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15},__=(()=>{let e=new c.MeshBasicMaterial;return e.side=c.BackSide,e.color.setHex(16711935),e.colorWrite=!1,e.stencilWrite=!0,e.polygonOffset=!0,e.polygonOffsetFactor=2,e.polygonOffsetUnits=2,e.stencilRef=g_.TILE_MASK,e.stencilFunc=c.AlwaysStencilFunc,e.stencilFuncMask=g_.TILE_MASK,e.stencilZPass=c.ReplaceStencilOp,e.stencilWriteMask=g_.TILE_MASK,e})(),v_=(()=>{let e=new c.MeshBasicMaterial;return e.visible=!1,e})(),y_=new c.BufferGeometry,b_=new c.MeshBasicMaterial;function x_(e){let t;t=e instanceof c.Mesh?new c.Mesh(e.geometry,Array.isArray(e.material)?e.material.map(e=>e.transparent?v_:__):e.material&&e.material.transparent?v_:__):e instanceof c.Group?new c.Group:new c.Object3D,t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.compose(e.position,e.quaternion,e.scale),t.matrixAutoUpdate=!1,t.frustumCulled=e.frustumCulled,t.visible=e.visible;for(let n of e.children)t.add(x_(n));return t}var S_=class extends c.Object3D{constructor(e,t){var n,r;super(),this.parameter=new X,this.renderObjects=[],this.backfaceObjects=[],this.tileObjects=[],this.frameNumber=0,this.error=(n=t.error)==null?null:n,this.name=t.name,this.type=t.type,this.upAxis=t.upAxis,this.light=t.light,this.fetcher=t.fetcher,this.search=(r=t.search)==null?``:r,this.groundHeight=t.groundHeight,this.coordinateSystem=t.coordinateSystem,this.boundingBox=new c.Box3,this.autoRefine=!0,this.refined=!1,this.refineProgress=[0,0],this.loaded=!1,this.disposed=!1,this.clearStencilObject=new c.Mesh(y_,b_),this.clearStencilObject.frustumCulled=!1,this.clearStencilObject.onAfterRender=e=>e.clearStencil(),this.tileset=new om(e,{tileLoader:e=>this.loadContent(e),tileUnloader:e=>this.unloadContent(e),onTileLoad:e=>{this.onTileLoad&&this.onTileLoad(e)},onTileUnload:e=>{this.onTileUnload&&this.onTileUnload(e)},onTileError:(e,t)=>{this.onError&&this.onError(Object.assign(t,{tile:e})),console.error(`Tile error`,e.id,t)}}),this.tileset.root.boundingVolume&&this.tileset.root.boundingVolume.getBoundingBox(this.boundingBox),this.currentResolvedParameterValue=X.resolveValueTo({},this.parameter)}get viewerRequestVolume(){return this.tileset.root.viewerRequestVolume}set viewerRequestVolume(e){this.tileset.root.viewerRequestVolume=e}get tiles(){return this.tileset.selectedTiles}get trajectories(){return this.tileset.trajectories}getRecommendProps(e={}){return Kg(this,e)}loadContent(e){return Mg(e,{light:this.light,fetcher:this.fetcher,search:this.search,renderer:this.renderer}).then(t=>{if(e.type===`SCENEGRAPH`){if(this.disposed||!e.content)Ng(e);else if(e.content.data)if(e.content.data.type===`spz`){let t=e.content.data.object.children[0].boundingBox;this.boundingBox.union(t)}else this.boundingBox.expandByObject(e.content.data.object)}})}unloadContent(e){return Ng(e),Promise.resolve()}loadAllTilesets(){let e=t=>{let n=[];return this.tileset.root.traverse(e=>{var t;e.type===`TILESET`&&((t=e.content)==null?void 0:t.loadState)!==`READY`&&n.push(e)}),Promise.all(n.map(t=>this.loadContent(t).then(()=>e(t)))).then(()=>{})};return e(this.tileset.root)}intersectRaycaster(e,t){var n,r;let i=t==null?[]:t,a=[this.tileset.root],o=this.tileset.transform,s=(r=(n=e.params.Points)==null?void 0:n.threshold)==null?0:r,c=e.sortByDistance;e.sortByDistance=!1;let l,u=1/0;for(;l=a.pop();){let t;if(l.boundingVolume){let n;n=l.boundingVolume instanceof nf?f_.copy(l.boundingVolume):l.boundingVolume instanceof rf?d_.copy(l.boundingVolume):l.boundingVolume.clone(),n.applyMatrix4(o),t=n.intersectRay(e.ray,s,u)}else t=!0;if(t){for(let e=0,t=l.children.length;e<t;e++)a.push(l.children[e]);if(l.selected&&l.content&&l.content.data&&l.content.data.object.visible){let t=e.hitFilter;if(e.hitFilter=n=>{var r;return Object.assign(n,{model:(r=this.parent)==null?void 0:r,viewLayer:this,tile:l}),t?t.call(e,n):!0},l.content.data.object.intersectRaycaster(e,i),e.hitFilter=t,e.firstHitOnly){let e=i[0];e&&u>e.distance&&(u=e.distance)}}}}return e.sortByDistance=c,wf(i,e.sortByDistance,e.firstHitOnly),i}update(e,t,n,r){var i,a,o,s,l,u,d;this.renderer=e,this.frameNumber++;let f=!1,p=X.resolveValueTo(this.currentResolvedParameterValue,n.parameter,r.parameter,this.parameter);p_.get(this)!==p.versionNumber&&(p_.set(this,p.versionNumber),f=!0);let m=(s=this.visible&&((i=this.parent)==null?void 0:i.visible)&&((o=(a=this.parent)==null?void 0:a.parent)==null?void 0:o.visible))==null?!1:s,h=p.maxLevelOfDetail;h=Math.max(h,0);let g=Math.min(p.minLevelOfDetail,h);(!m||!this.loaded||!n.loaded)&&(h=Math.max(g,0));let _=p.maxMemoryUsage;m||(_=Math.min(0,_));let v=p.minGeometricError,y=p.maxRequests,b=p.memoryAdjustedScreenSpaceError;m||(b=!1),t.controllerMode===`Panorama`&&(p.modelAlpha<.1&&(v=p.panoramaMinGeometricError,b=!1),p.progress>=.01&&p.progress<=.99&&(y=0));let x=p.maxGeometricError;x=Math.max(v,x);let S={time:t.time,camera:{type:t.type,position:new c.Vector3().copy(t.position),direction:t.getDirection(new c.Vector3),up:new c.Vector3().copy(t.up).applyQuaternion(t.quaternion),projectionMatrix:t.projectionMatrix.clone(),visible:m&&t.visible,refine:t.refineModel},height:t.resolution.height,pixelRatio:t.pixelRatio,frameNumber:this.frameNumber,sseDenominator:2*Math.tan(.5*t.fov/180*Math.PI),cullingVolume:new tf().setFromCamera(t),minLevelOfDetail:g,maxLevelOfDetail:h,minGeometricError:v,maxGeometricError:x,skipLevelOfDetail:p.skipLevelOfDetail,mostDetail:p.mostDetail,loadSiblings:p.loadSiblings,cameraCulling:p.cameraCulling,maxMemoryUsage:_,maxRequests:y,requestOrder:p.requestOrder,maxScreenSpaceError:p.maxScreenSpaceError,memoryAdjustedScreenSpaceError:b},C=p.cacheCameras.map(e=>(e.updateProjectionMatrix(),Object.assign(Object.assign({},S),{camera:{type:t.type,position:new c.Vector3().copy(e.position),direction:e.getWorldDirection(new c.Vector3),up:new c.Vector3().copy(e.up),projectionMatrix:e.projectionMatrix.clone(),visible:e.visible,refine:!0},cullingVolume:new tf().setFromCamera(e)})));this.updateWorldMatrix(!0,!1),this.tileset.transform.equals(this.matrixWorld)||(this.tileset.transform.copy(this.matrixWorld),f=!0);let w=!this.autoRefine;if(w===!1&&p.progress>=.01&&p.progress<=.99){let e=new c.Vector3;p.pano0&&e.setFromMatrixPosition(p.pano0.matrix);let t=e.clone();p.pano1&&t.setFromMatrixPosition(p.pano1.matrix),e.distanceTo(t)<10&&(w=!0)}if(w||this.tileset.update(S,C),this.refined=!0,this.refineProgress[0]=0,this.refineProgress[1]=0,this.tileset.needsRefinedTiles.forEach(e=>{if(this.refineProgress[1]++,e.content){let t=e.content.loadState;if(t===`UNLOADED`||t===`LOADING`){this.refined=!1;return}}this.refineProgress[0]++}),this.loaded===!1&&this.autoRefine){this.loaded=!0;let e=!1;this.tileset.needsRefinedTiles.forEach(t=>{if(this.loaded!==!1&&t.content&&(t.state.visible&&(e=!0),p.minLevelOfDetail>=0)){if(S.skipLevelOfDetail){if(t.state.finalResolution){let e=t.state.ancestorWithContentAvailable,n=(e&&e.content?e.content:t.content).loadState;(n===`UNLOADED`||n===`LOADING`)&&(this.loaded=!1)}}else if(t.state.visible&&t.levelOfContent<=0){let e=t.content.loadState;(e===`UNLOADED`||e===`LOADING`)&&(this.loaded=!1)}}}),e&&this.tileset.selectedTiles.length===0&&this.tileset.frameNumber<500&&(this.loaded=!1),this.loaded===!0&&(this.refined=!1,this.refineProgress[1]++)}this.renderObjects.length=0,this.backfaceObjects.length=0,this.tileObjects.length=0;for(let e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);S.skipLevelOfDetail||this.tileset.selectedTiles.sort((e,t)=>e.floor===t.floor?e.levelOfContent===t.levelOfContent?e.state.distanceToCamera===t.state.distanceToCamera?e.state.centerZDepth-t.state.centerZDepth:e.state.distanceToCamera-t.state.distanceToCamera:t.levelOfContent-e.levelOfContent:e.floor-t.floor);let T=[];for(let r of this.tileset.selectedTiles){let i=(u=(l=r.content)==null?void 0:l.data)==null?void 0:u.object;if(!i)continue;let a=i.update(e,t,n,this,r,p);if(T.push(r.id),a&&(f=!0),this.tileset.hasMixedContent&&S.skipLevelOfDetail){if(!r.state.finalResolution){let e=x_(i);e.name=`skipBackface:`+i.name,this.backfaceObjects.push(e)}let e=r.state.selectionDepth,t=g_.TILE_MASK|e<<g_.SKIP_LOD_BIT_SHIFT,n=c.GreaterEqualStencilFunc,a=g_.SKIP_LOD_MASK,o=c.ReplaceStencilOp,s=g_.TILE_MASK|g_.SKIP_LOD_MASK;for(let e of i.materials)e.stencilWrite=!0,e.stencilRef=t,e.stencilFunc=n,e.stencilFuncMask=a,e.stencilZPass=o,e.stencilWriteMask=s}else for(let e of i.materials)e.stencilWrite=!1,e.stencilRef=g_.TILE_MASK,e.stencilFunc=c.AlwaysStencilFunc,e.stencilFuncMask=g_.TILE_MASK,e.stencilZPass=c.ReplaceStencilOp,e.stencilWriteMask=g_.TILE_MASK;this.tileObjects.push(i)}let E=T.toString();if(m_.get(this)!==E&&(m_.set(this,E),f=!0),S.skipLevelOfDetail&&this.backfaceObjects.length)for(let e=0;e<this.backfaceObjects.length;e++)this.renderObjects.push(this.backfaceObjects[e]);if(this.tileObjects.length)for(let e=0;e<this.tileObjects.length;e++)this.renderObjects.push(this.tileObjects[e]);S.skipLevelOfDetail&&this.renderObjects.push(this.clearStencilObject);let D=[];for(let r of this.tileset.selectedTrajectories){let i=(d=r.content.data)==null?void 0:d.object;if(!i)continue;let a=i.update(e,t,n,this,r,p);D.push(r.id),a&&(f=!0),this.renderObjects.push(i)}let O=D.toString();if(h_.get(this)!==O&&(h_.set(this,O),f=!0),this.parent){let e=this.parent.children.length+1,t=(Math.min(0,this.parent.children.indexOf(this))-e)*1e4+1;for(let e=0;e<this.renderObjects.length;e++){let n=this.renderObjects[e],r=e+t;n.traverse(e=>{(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)&&(e.renderOrder=r)})}}if(this.loaded)for(let e=0;e<this.renderObjects.length;e++)this.add(this.renderObjects[e]);return f}dispose(){this.disposed=!0,this.tileset.reset(),this.tileset.root.children.length=0,/^blob\:/.test(this.tileset.id)&&URL.revokeObjectURL(this.tileset.id);for(let e=this.children.length-1;e>=0;e--)this.remove(this.children[e]);this.refined=!1,this.loaded=!1,this.refineProgress[0]=this.refineProgress[1]=0,this.error=null,this.onError=void 0,this.renderer=void 0}get model(){return this.parent}get scene(){return this}get viewLayer(){return this}localToEnu(e){return e.applyMatrix4(Gg)}enuToLocal(e){return e.applyMatrix4(Wg)}enuToEcef(e){return e.applyMatrix4(this.coordinateSystem.enuToEcefMatrix)}ecefToEnu(e){return e.applyMatrix4(this.coordinateSystem.ecefToEnuMatrix)}localToEcef(e){return this.enuToEcef(this.localToEnu(e))}ecefToLocal(e){return this.enuToLocal(this.ecefToEnu(e))}localToLla(e){return zg(this.enuToEcef(this.localToEnu(e)))}llaToLocal(e){return this.enuToLocal(this.ecefToEnu(Bg(e)))}worldToEnu(e){return this.localToEnu(this.worldToLocal(e))}enuToWorld(e){return this.localToWorld(this.enuToLocal(e))}worldToEcef(e){return this.localToEcef(this.worldToLocal(e))}ecefToWorld(e){return this.localToWorld(this.ecefToLocal(e))}worldToLla(e){return this.localToLla(this.worldToLocal(e))}llaToWorld(e){return this.localToWorld(this.llaToLocal(e))}get coordinates(){u_.setScalar(0);let{x:e,y:t}=this.localToLla(u_);return[e,t].map(e=>(e/Math.PI*180).toFixed(6)).join(`,`)}getTransformMatrix4(e=new c.Matrix4){return e.copy(this.coordinateSystem.ecefToEnuMatrix),e.premultiply(Wg),e.premultiply(this.matrixWorld),e}coordinatesToWorldPoint(e){let t=new c.Vector3(e.latitude,e.longitude,e.altitude);return this.llaToWorld(t)}worldPointToCoordinates(e){return u_.copy(e),this.worldToLla(u_),{latitude:u_.x,longitude:u_.y,altitude:u_.z}}resetBrightness(){this.parameter.reset(`brightness`)}get minLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`minLevelOfDetail`,...e)}set minLevelOfDetail(e){this.parameter.set(`minLevelOfDetail`,e)}get maxLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxLevelOfDetail`,...e)}set maxLevelOfDetail(e){this.parameter.set(`maxLevelOfDetail`,e)}get minGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`minGeometricError`,...e)}set minGeometricError(e){this.parameter.set(`minGeometricError`,e)}get maxGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxGeometricError`,...e)}set maxGeometricError(e){this.parameter.set(`maxGeometricError`,e)}get panoramaMinGeometricError(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`panoramaMinGeometricError`,...e)}set panoramaMinGeometricError(e){this.parameter.set(`panoramaMinGeometricError`,e)}get skipLevelOfDetail(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`skipLevelOfDetail`,...e)}set skipLevelOfDetail(e){this.parameter.set(`skipLevelOfDetail`,e)}get mostDetail(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`mostDetail`,...e)}set mostDetail(e){this.parameter.set(`mostDetail`,e)}get loadSiblings(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`loadSiblings`,...e)}set loadSiblings(e){this.parameter.set(`loadSiblings`,e)}get maxMemoryUsage(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxMemoryUsage`,...e)}set maxMemoryUsage(e){this.parameter.set(`maxMemoryUsage`,e)}get maxRequests(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxRequests`,...e)}set maxRequests(e){this.parameter.set(`maxRequests`,e)}get requestOrder(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`requestOrder`,...e)}set requestOrder(e){this.parameter.set(`requestOrder`,e)}get maxScreenSpaceError(){let e=[];return this.parent&&this.parent.parameter instanceof X&&(e.unshift(this.parent.parameter),this.parent.parent&&this.parent.parent.parameter instanceof X&&e.unshift(this.parent.parent.parameter)),this.parameter.resolveValue(`maxScreenSpaceError`,...e)}set maxScreenSpaceError(e){this.parameter.set(`maxScreenSpaceError`,e)}},C_={};function w_(e,t){let n=C_[e];if(n){let e=n.get(t);if(e)return e}throw Error(`fetcher workCode:${t.workCode} never registered.`)}function T_(e,t,n){let r=C_[e];r||(r=C_[e]=new WeakMap),r.has(t)||r.set(t,n)}var E_=new c.Matrix4,D_=new c.Vector3,O_=new c.Matrix4;function k_(e,t,n){switch(e){case`Z`:n.identity();break;case`WGS84`:case`GCJ02`:case`BD09`:Vg(t,n);break;default:n.identity();break}return n}function A_(e){var t;let[n,r]=e.tilesetUrl.split(`#`),i=(t=(r||n).split(`?`)[1])==null?``:t;return e.fetcher.ajax(e.tilesetUrl,{responseType:`text`}).catch(e=>({error:e,body:JSON.stringify({asset:{version:`0.0`},geometricError:0,root:{geometricError:0}})})).then(t=>{var n;let r=`error`in t?t.error:null,a=cm(JSON.parse(t.body),e.tilesetUrl),{root:o,rootMeta:s={}}=a,l=e.upAxis;s.upAxis&&s.upAxis!==l&&(l=s.upAxis),`lodVersion`in a&&(l=`-Y`,`floorInfo`in a&&(a.properties=a.properties||{},a.properties.floorInfo=a.floorInfo.map(e=>({ground:-e.ground,height:e.height})),a.floorInfo=void 0),a.asset.tilesetVersion=String(a.lodVersion),a.lodVersion=void 0);let u=l,d=new c.Matrix4;u===`Y`?(u=`Z`,d.fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1])):u===`-Y`&&(u=`Z`,d.fromArray([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]));let f=o.boundingVolume?sf(o.boundingVolume):void 0;f&&o.transform&&f.applyMatrix4(O_.fromArray(o.transform));let p=null,m=new c.Matrix4,h=new c.Matrix4;return s.coordinate?(p=s.coordinate.ground_height,m.fromArray(s.coordinate.pose_ecef_to_enu),h.fromArray(s.coordinate.pose_enu_to_ecef)):(f?f.getCenter(D_):D_.setScalar(0),D_.applyMatrix4(d),k_(u,D_,m),h.copy(m).invert()),a.root={refine:(n=o.refine)==null?`REPLACE`:n,geometricError:o.geometricError,transform:O_.copy(d).premultiply(u===`Z`?E_:m).premultiply(Wg).toArray(),boundingVolume:f?f.toJson():void 0,children:[o]},new S_(a,{name:e.name,type:e.type,upAxis:l,light:e.light,fetcher:e.fetcher,search:i,groundHeight:p,coordinateSystem:{enuToEcefMatrix:h,ecefToEnuMatrix:m},error:r})})}function j_(e,t){var n;let r=e.layers.map(e=>({tilesetUrl:e.work.getURL(e.tileset),name:e.name,type:e.type,upAxis:e.upAxis,light:t.light,fetcher:t.fetcher}));if(e.file){let i=!1;for(let e of r)if(e.type===`mesh`){i=!0;break}if(i===!1){let i=rc(e.file)||`.at3d`,a=JSON.stringify({tilesetUrl:``,asset:{version:`0.0`},geometricError:0,root:{refine:`REPLACE`,geometricError:0,transform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],content:{uri:e.work.getURL(e.file)},extras:{[i.slice(1)]:{upAxis:e.upAxis,textureBaseUri:typeof e.textureBase==`string`?e.work.getURL(e.textureBase):void 0,textureArray:e.textures,textureOptions:(n=t.textureOptions)==null?{}:n}}},rootMeta:{coordinate:e.coordinate}});r.push({name:`fallback`,type:`mesh`,upAxis:`Z`,tilesetUrl:URL.createObjectURL(new Blob([a],{type:`application/json`})),fetcher:t.fetcher,light:t.light})}}let i=r.map(e=>A_(e).then(e=>e));return Promise.all(i)}function M_(e=1,t=1,n=1){let r=e/2,i=t/2,a=n/2,o=new Float32Array([-r,+i,+a,+r,+i,+a,+r,+i,-a,-r,+i,-a,-r,-i,+a,+r,-i,+a,+r,-i,-a,-r,-i,-a]),s=new Uint32Array([0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4,3,0,2,2,0,1,4,7,5,5,7,6]),l=new c.BufferGeometry;return l.setAttribute(`position`,new c.BufferAttribute(o,3)),l.setIndex(new c.BufferAttribute(s,1)),l.addGroup(0,l.index.count,0),l.computeBoundingBox(),l.computeBoundingSphere(),l}function N_(e,t){for(var n=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),i=new Set(Object.keys(e[0].morphAttributes)),a={},o={},s=new c.BufferGeometry,l=0,u=0;u<e.length;++u){var d=e[u];if(n!==(d.index!==null))return null;for(var f in d.attributes){if(!r.has(f))return null;a[f]===void 0&&(a[f]=[]),a[f].push(d.attributes[f])}for(var f in d.morphAttributes){if(!i.has(f))return null;o[f]===void 0&&(o[f]=[]),o[f].push(d.morphAttributes[f])}if(s.userData.mergedUserData=s.userData.mergedUserData||[],s.userData.mergedUserData.push(d.userData),t){var p;if(n)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return null;s.addGroup(l,p,u),l+=p}}if(n){for(var m=0,h=[],u=0;u<e.length;++u){for(var g=e[u].index,_=0;_<g.count;++_)h.push(g.getX(_)+m);m+=e[u].attributes.position.count}s.setIndex(h)}for(var f in a){var v=P_(a[f]);if(!v)return null;s.setAttribute(f,v)}for(var f in o){var y=o[f][0].length;if(y===0)break;s.morphAttributes=s.morphAttributes||{},s.morphAttributes[f]=[];for(var u=0;u<y;++u){for(var b=[],_=0;_<o[f].length;++_)b.push(o[f][_][u]);var x=P_(b);if(!x)return null;s.morphAttributes[f].push(x)}}return s}function P_(e){for(var t,n,r,i=0,a=0;a<e.length;++a){var o=e[a];if(o.isInterleavedBufferAttribute||(t===void 0&&(t=o.array.constructor),t!==o.array.constructor)||(n===void 0&&(n=o.itemSize),n!==o.itemSize)||(r===void 0&&(r=o.normalized),r!==o.normalized))return null;i+=o.array.length}for(var s=new t(i),l=0,a=0;a<e.length;++a)s.set(e[a].array,l),l+=e[a].array.length;return new c.BufferAttribute(s,n,r)}function F_(e,t=1e-4){t=Math.max(t,Number.EPSILON);for(var n={},r=e.getIndex(),i=e.getAttribute(`position`),a=r?r.count:i.count,o=0,s=Object.keys(e.attributes),l={},u={},d=[],f=[`getX`,`getY`,`getZ`,`getW`],p=0,m=s.length;p<m;p++){var h=s[p];l[h]=[];var g=e.morphAttributes[h];g&&(u[h]=Array(g.length).fill().map(()=>[]))}for(var _=Math.log10(1/t),v=Math.pow(10,_),p=0;p<a;p++){for(var y=r?r.getX(p):p,b=``,x=0,m=s.length;x<m;x++)for(var h=s[x],S=e.getAttribute(h),C=S.itemSize,w=0;w<C;w++)b+=`${~~(S[f[w]](y)*v)},`;if(b in n)d.push(n[b]);else{for(var x=0,m=s.length;x<m;x++)for(var h=s[x],S=e.getAttribute(h),g=e.morphAttributes[h],C=S.itemSize,T=l[h],E=u[h],w=0;w<C;w++){var D=f[w];if(T.push(S[D](y)),g)for(var O=0,k=g.length;O<k;O++)E[O].push(g[O][D](y))}n[b]=o,d.push(o),o++}}let A=e.clone();for(var p=0,m=s.length;p<m;p++){var h=s[p],j=e.getAttribute(h),M=new j.array.constructor(l[h]),S=new c.BufferAttribute(M,j.itemSize,j.normalized);if(A.setAttribute(h,S),h in u)for(var x=0;x<u[h].length;x++){var N=e.morphAttributes[h][x],M=new N.array.constructor(u[h][x]),ee=new c.BufferAttribute(M,N.itemSize,N.normalized);A.morphAttributes[h][x]=ee}}return A.setIndex(d),A}var I_=new c.Sphere,L_=new c.Matrix4,R_=new c.Matrix4;function z_(e,t,n=30/180*Math.PI){let r=Math.cos(n),i=[];for(let n of e.children)n instanceof S_&&n.tileset.selectedTiles.forEach(e=>{var n,a,o;let s=(a=(n=e.content)==null?void 0:n.data)==null?void 0:a.object;if(s&&s.visible){let e=[];if(s.traverseVisible(n=>{if(n instanceof c.Mesh){let r=fp(n);if(r){L_.copy(n.matrixWorld),R_.copy(L_).invert(),I_.copy(t).applyMatrix4(R_);let i=r.trianglesInSphere(I_.center,I_.radius),a=new c.BufferGeometry;a.setAttribute(`position`,new c.BufferAttribute(i,3)),a.applyMatrix4(n.matrixWorld),a=F_(a,.01),e.push(a)}}}),e.length===0)return;let n=[`a`,`b`,`c`],a=N_(e,!1),l=a.getAttribute(`position`).array,u=((o=a.getIndex())==null?void 0:o.array)||[],d=[],f=[];for(let e=0,t=l.length;e<t;e+=3){let t=new c.Vector3(l[e],l[e+1],l[e+2]);d.push(t)}for(let e=0,t=u.length;e<t;e+=3){let t=u[e],n=u[e+1],r=u[e+2],i=new c.Vector3().crossVectors(d[n].clone().sub(d[t]),d[r].clone().sub(d[t])).normalize();f.push({a:t,b:n,c:r,normal:i})}let p={};for(let e=0,t=f.length;e<t;e++){let t=f[e];for(let r=0;r<3;r++){let i=t[n[r]],a=t[n[(r+1)%3]],o=[Math.min(i,a),Math.max(i,a)],s=o[0]+`-`+o[1];p[s]===void 0?p[s]={index1:o[0],index2:o[1],face1:e}:p[s].face2=e}}for(let e in p){let t=p[e];if(t.face2===void 0||f[t.face1].normal.dot(f[t.face2].normal)<=r){let e=d[t.index1],n=d[t.index2];i.push(new c.Line3(e,n))}}d.length=0,f.length=0}});return i}var B_=new c.Box3,V_=new c.Box3,H_=new c.Box3,U_=class extends c.Object3D{constructor(e,t,n={}){var r;super(),this.disposed=!1,this.parameter=new X,this.outdated=!1,this.autoRefine=!0,this.metaPending=!1,this.loaded=!1,this.refined=!1,this.refineProgress=[0,0],this.boundingBox=new c.Box3,this.fiveId=e,this.needsRender=!1,this.work=t,this.name=t.workCode;let i=0;for(let e of t.observers)i=Math.max(i,e.floorIndex);if(this.floorLength=i+1,t.model){this.metaPending=!0;let e=j_(t.model,{fetcher:w_(this.fiveId,t),light:(r=n.light)==null?!1:r,textureOptions:n.textureOptions}),i=e=>this.dispatchEvent({type:`error`,error:e}),a=e=>this.dispatchEvent({type:`tileLoad`,tile:e}),o=e=>this.dispatchEvent({type:`tileUnload`,tile:e});this.initReady=e.then(e=>{var t;this.metaPending=!1;let n=null,r=null,s=null;for(let t of e){if(t.visible=!1,t.onError=i,t.onTileLoad=a,t.onTileUnload=o,t.error){i(t.error);continue}t.type===`mesh`?n===null&&(n=t):t.type===`point_cloud`?r===null&&(r=t):s===null&&(s=t)}let c=(t=n==null?r:n)==null?s:t;if(c&&(c.visible=!0),e.length)if(this.disposed)for(let t of e)t.dispose();else this.add(...e);return this}),this.loadedReady=new Promise(e=>{let t=()=>{e(this),this.removeEventListener(`load`,t),this.removeEventListener(`dispose`,t)};this.addEventListener(`load`,t),this.addEventListener(`dispose`,t)})}else this.refined=!0,this.loaded=!0,this.initReady=Promise.resolve(this),this.loadedReady=Promise.resolve(this);this.parameter.set(`boundingBox`,this.boundingBox.clone())}dispose(){this.disposed=!0;let e;for(;e=this.children[0];)typeof e.dispose==`function`&&e.dispose(),e.onError=void 0,e.onTileLoad=void 0,e.onTileUnload=void 0,this.remove(e);this.dispatchEvent({type:`dispose`})}get empty(){return this.children.length===0}get viewLayers(){return this.children}getEdgesBySphere(e,t=30/180*Math.PI){return z_(this,e,t)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.sortByDistance;e.sortByDistance=!1;for(let t=0,r=this.children.length;t<r;t++){let r=this.children[t];r.visible&&typeof r.intersectRaycaster==`function`&&r.intersectRaycaster(e,n)}return e.sortByDistance=r,wf(n,e.sortByDistance,e.firstHitOnly),n}update(e,t,n){let r=!1;this.needsRender===!0&&(this.needsRender=!1,r=!0);let i=this.loaded;this.refined=!this.metaPending,this.loaded=!this.metaPending,this.refineProgress[0]=this.refineProgress[1]=0,this.work.transform.equals(this.matrix)||(this.matrix.copy(this.work.transform),this.matrix.decompose(this.position,this.quaternion,this.scale),this.matrixAutoUpdate=!1,r=!0);for(let i of this.children)i.autoRefine=this.autoRefine,i.update(e,t,n,this)&&(r=!0),i.refined===!1&&(this.refined=!1),i.loaded===!1&&(this.loaded=!1),this.refineProgress[0]+=i.refineProgress[0],this.refineProgress[1]+=i.refineProgress[1];B_.makeEmpty(),H_.copy(this.work.observerBox),H_.isEmpty()||(H_.max.x+=1,H_.max.z+=1,H_.max.y+=1,--H_.min.x,--H_.min.z,B_.union(H_));for(let e of this.viewLayers)e.boundingBox.isEmpty()||(V_.copy(e.boundingBox),B_.union(V_));return B_.applyMatrix4(this.matrix),B_.equals(this.boundingBox)||(this.boundingBox.copy(B_),this.parameter.set(`boundingBox`,B_.clone())),i===!1&&this.loaded===!0&&this.dispatchEvent({type:`load`}),r}localToEnu(e){return e.applyMatrix4(Gg)}enuToLocal(e){return e.applyMatrix4(Wg)}worldToEnu(e){return this.localToEnu(this.worldToLocal(e))}enuToWorld(e){return this.localToWorld(this.enuToLocal(e))}get shownFloor(){return this.shownFloorIndex===-1?null:this.shownFloorIndex}set shownFloor(e){this.shownFloorIndex=e===null?-1:e}show(e){this.shownFloor=e==null?null:e,this.dispatchEvent({type:`changeShownFloor`,floorIndex:e==null?null:e})}get bounding(){return this.boundingBox}setMaterial(e){this.parameter.set(e)}getMaterial(){let e=[];return this.parent&&this.parent.parameter instanceof X&&e.unshift(this.parent.parameter),this.parameter.resolveValue(...e)}get shownFloorIndex(){let e=[];return this.parent&&this.parent.parameter instanceof X&&e.unshift(this.parent.parameter),this.parameter.resolveValue(...e).shownFloorIndex}set shownFloorIndex(e){this.parameter.set(`shownFloorIndex`,e)}get brightness(){let e=[];return this.parent&&this.parent.parameter instanceof X&&e.unshift(this.parent.parameter),this.parameter.resolveValue(...e).brightness}set brightness(e){this.parameter.set(`brightness`,e)}get clippers(){let e=[];return this.parent&&this.parent.parameter instanceof X&&e.unshift(this.parent.parameter),this.parameter.resolveValue(...e).clippers}set clippers(e){this.parameter.set(`clippers`,e)}resetBrightness(){this.parameter.reset(`brightness`);for(let e of this.viewLayers)e.resetBrightness()}};function Z(e,t,n){return Object.defineProperty(e,t,n)}var W_=M_(1,1,1);W_.applyMatrix4(new c.Matrix4().makeScale(-1,1,1));var G_=new WeakMap,K_=new c.Vector3(1,1,1),q_=new c.Box3,J_=new c.Vector3,Y_=new c.Box3,X_=new c.Vector3,Z_=new c.Vector3,Q_=class extends Ot{constructor(e={}){var t;let n=new jr;n.colorAlpha=0,n.alphaMode=`BLEND`,n.depthWrite=!1,n.transparent=!1,n.blending=c.CustomBlending,n.blendSrc=c.SrcAlphaFactor,n.blendDst=c.OneMinusSrcAlphaFactor,n.blendSrcAlpha=c.OneFactor,n.blendDstAlpha=c.OneMinusSrcAlphaFactor,n.floorIndex=-1,super(W_,[n]),this.name=(t=e.name)==null?``:t,this.frustumCulled=!1,this.renderOrder=-999999}update(e,t,n){let r=!1,i=X.resolveValue(n.parameter);q_.copy(i.boundingBox),q_.getSize(J_);let a=Math.min(J_.x/2,500);q_.min.x-=a,q_.max.x+=a;let o=Math.min(J_.y/2,500);q_.min.z-=o,q_.max.z+=o;let s=J_.length()/2;if(q_.max.y=Math.max(q_.max.y,s),q_.union(Y_.setFromCenterAndSize(t.position,K_)),q_.expandByScalar(1),q_.getCenter(X_),q_.getSize(Z_),X_.equals(this.position)||(this.position.copy(X_),r=!0),Z_.equals(this.scale)||(this.scale.copy(Z_),r=!0),G_.get(this)!==i.versionNumber){G_.set(this,i.versionNumber),r=!0;let e=this.material;for(let t of e)Yt(t,i),t.visible=t.opacity!==0}return r}dispose(){for(let e of this.material)e.dispose()}},$_=new c.Box3,ev=class extends c.Scene{constructor(e){super(),this.needsRender=!0,this.autoRefine=!0,this.boundingBox=new c.Box3,this.loaded=!1,this.refined=!1,this.refineProgress=[0,0],this.parameter=new X,this.fiveId=e.fiveId,this.boundingMesh=new Q_({name:`bounding`}),this.add(this.boundingMesh);let t=this.models=[];this.shownModels=[],this.updateModelMap=new Map,this.parameter.set(`boundingBox`,this.boundingBox.clone());let n=this;Z(t,`autoUpdate`,{get(){return n.autoRefine},set(e){n.autoRefine=e}}),Z(t,`bounding`,{get(){return n.boundingBox}}),Z(t,`loaded`,{get(){return n.loaded}}),Z(t,`refined`,{get(){return n.refined}}),Z(t,`refineProgress`,{get(){return n.refineProgress}}),Z(t,`cacheCameras`,{get(){return n.parameter.resolveValue().cacheCameras},set(e){n.parameter.set(`cacheCameras`,e)}}),Z(t,`intersectRaycaster`,{value:e=>n.intersectRaycaster(e)}),Z(t,`setMaterial`,{value:e=>n.setMaterial(e)}),Z(t,`getMaterial`,{value:()=>n.getMaterial()}),Z(t,`resetBrightness`,{value:()=>n.resetBrightness()})}setModels(e,t){let n=e.map(e=>{let n=this.shownModels.filter(t=>t.work.workCode===e.workCode)[0];if(n||(n=this.models.filter(t=>t.work.workCode===e.workCode)[0],n))return n.work=e,n;n=new U_(this.fiveId,e,{light:t.light,textureOptions:t.textureOptions});let r=t[`3d-tiles`];return n.initReady.then(()=>{if(r)if(typeof r==`function`)for(let e of n.viewLayers){let t=r(e,n);t&&(t.viewerRequestVolume&&(e.viewerRequestVolume=sf(t.viewerRequestVolume)),e.parameter.set(Ys(t,[`showLayers`])),t.showLayers===!1?e.visible=!1:Array.isArray(t.showLayers)&&(e.visible=t.showLayers.includes(e.name)))}else for(let e of n.viewLayers)r.viewerRequestVolume&&(e.viewerRequestVolume=sf(r.viewerRequestVolume)),e.parameter.set(Ys(r,[`showLayers`])),r.showLayers===!1?e.visible=!1:Array.isArray(r.showLayers)&&(e.visible=r.showLayers.includes(e.name))}),this.dispatchEvent({type:`model.create`,model:n}),n});for(let e=0;e<this.models.length;e++){let t=this.models[e];n.indexOf(t)===-1&&this.shownModels.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.models.length=0;for(let e=0;e<n.length;e++){let t=n[e];this.models.push(t)}if(t.forceReplaceImmediately&&!yf(this.models,this.shownModels)){for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.models.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.shownModels.length=0;for(let e=0;e<this.models.length;e++)this.shownModels.push(this.models[e])}return this.loaded=!1,this.refined=!1,this.models}get empty(){return this.boundingBox.isEmpty()}intersectRaycaster(e,t){let n=t==null?[]:t,r=this.shownModels.filter(e=>e.visible);if(r.length===1)r[0].intersectRaycaster(e,n);else{let t=e.sortByDistance;e.sortByDistance=!1;for(let t of r)t.intersectRaycaster(e,n);e.sortByDistance=t,wf(n,e.sortByDistance,e.firstHitOnly)}return n}update(e,t){let n=!1;$_.makeEmpty(),this.loaded=this.models.length>0,this.refined=this.models.length>0,this.refineProgress[0]=this.refineProgress[1]=0,this.updateModelMap.clear();for(let n=0;n<this.models.length;n++){let r=this.models[n];if(!this.updateModelMap.has(r)){let n=r.autoRefine;this.autoRefine===!1&&(r.autoRefine=!1);let i=r.update(e,t,this);r.autoRefine=n,this.updateModelMap.set(r,i)}r.loaded===!1&&(this.loaded=!1),r.refined===!1&&(this.refined=!1),this.refineProgress[0]+=r.refineProgress[0],this.refineProgress[1]+=r.refineProgress[1]}if((this.loaded===!0||this.models.length===0)&&!yf(this.models,this.shownModels)){for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.models.indexOf(t)===-1&&(t.dispose(),this.dispatchEvent({type:`model.dispose`,model:t}))}this.shownModels.length=0;for(let e=0;e<this.models.length;e++)this.shownModels.push(this.models[e]);n=!0}for(let n=0;n<this.shownModels.length;n++){let r=this.shownModels[n];if(!this.updateModelMap.has(r)){let n=r.autoRefine;(this.autoRefine===!1||this.models.indexOf(r)<0)&&(r.autoRefine=!1);let i=r.update(e,t,this);r.autoRefine=n,this.updateModelMap.set(r,i)}}for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];t instanceof U_&&this.remove(t)}for(let e=0;e<this.shownModels.length;e++){let t=this.shownModels[e];this.updateModelMap.get(t)===!0&&(n=!0),$_.union(t.boundingBox),this.add(t)}for(let e=0;e<this.models.length;e++){let t=this.models[e];this.shownModels.indexOf(t)===-1&&$_.union(t.boundingBox)}return $_.equals(this.boundingBox)||(this.boundingBox.copy($_),this.parameter.set(`boundingBox`,this.boundingBox.clone()),n=!0),this.boundingMesh.update(e,t,this)&&(n=!0),this.updateModelMap.clear(),this.needsRender=n,n}get bounding(){return this.boundingBox}setMaterial(e){this.parameter.set(e)}getMaterial(){return this.parameter.resolveValue()}resetBrightness(){this.parameter.reset(`brightness`);for(let e of this.models)e.resetBrightness()}dispose(){this.remove(this.boundingMesh),this.boundingMesh.dispose();for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];t instanceof U_&&this.remove(t)}let e=xf(this.models.concat(this.shownModels));for(let t=0;t<this.shownModels.length;t++)e[t].dispose();this.models.length=0,this.shownModels.length=0}};function tv(e){let t={};return e.mode!==void 0&&(t.mode=e.mode),e.panoIndex!==void 0&&(t.pano_index=e.panoIndex),e.longitude!==void 0&&(t.longitude=e.longitude),e.latitude!==void 0&&(t.latitude=e.latitude),e.fov!==void 0&&(t.fov=e.fov),e.distance!==void 0&&(t.distance=e.distance),e.offset!==void 0&&(t.offset=e.offset.toArray()),t}function nv(e){var t;if(e)return{file_url:e.file,material_base_url:e.textureBase,material_textures:(t=e.textures)==null?void 0:t.slice(),up_axis:e.upAxis,layers:e.layers.map(e=>({tileset_url:e.tileset,up_axis:e.upAxis,name:e.name,type:e.type}))}}function rv(e){return{index:e.index,derived_id:e.derivedId,derived_id_str:e.derivedIdStr,floor_index:e.floorIndex,position:e.position.toArray(),standing_position:e.standingPosition.toArray(),quaternion:{x:e.quaternion.x,y:e.quaternion.y,z:e.quaternion.z,w:e.quaternion.w},visible_nodes:e.accessibleNodes.slice(),accessible_nodes:e.accessibleNodes.slice()}}function iv(e){return{index:e.index,active:e.active,loadable:e.loadable,derived_id:e.derivedId,derived_id_str:e.derivedIdStr,size_list:e.images.sizeList.slice(),up:e.images.up,down:e.images.down,right:e.images.right,left:e.images.left,front:e.images.front,back:e.images.back,video:e.images.video?{matrix:e.images.video.matrix.toArray(),size:e.images.video.size.toArray(),source:e.images.video.source}:void 0}}function av(e){return{allow_hosts:e.allowHosts.slice(),expire_at:e.expire.getTime().toString(),project_id:e.projectId,code:e.workCode,name:e.name,base_url:e.baseURL,initial:tv(e.initial),model:nv(e.model),observers:e.observers.map(e=>rv(e)),panorama:{count:e.observers.length,list:e.observers.map(e=>iv(e))}}}function ov(e){let t=(e.x*2+1)*Math.PI,n=(.5-e.y)*Math.PI,r=Math.sin(n),i=Math.cos(n),a=Math.sin(t),o=Math.cos(t),s=i*a,l=r,u=i*o,d=Math.abs(s),f=Math.abs(l),p=Math.abs(u),m,h;if(d>=f&&d>=p){let e=1/d;s>0?(m=`right`,h=new c.Vector2(-u*e,l*e)):(m=`left`,h=new c.Vector2(u*e,l*e))}else if(f>=d&&f>=p){let e=1/f;l>0?(m=`up`,h=new c.Vector2(s*e,-u*e)):(m=`down`,h=new c.Vector2(s*e,u*e))}else{let e=1/p;u>0?(m=`front`,h=new c.Vector2(s*e,l*e)):(m=`back`,h=new c.Vector2(-s*e,l*e))}return h.x=(h.x+1)/2,h.y=1-(h.y+1)/2,[m,h]}function sv(e,t){let n=t.x*2-1,r=(1-t.y)*2-1,i=0,a=0,o=0;switch(e){case`right`:i=1,a=r,o=-n;break;case`left`:i=-1,a=r,o=n;break;case`up`:i=n,a=1,o=-r;break;case`down`:i=n,a=-1,o=r;break;case`front`:i=n,a=r,o=1;break;case`back`:i=-n,a=r,o=-1;break;default:throw Error(`Invalid cubFace: ${e}`)}let s=Math.sqrt(i*i+a*a+o*o);if(s===0)return new c.Vector2(.5,.5);i/=s,a/=s,o/=s;let l=Math.atan2(i,o),u=Math.asin(Math.max(-1,Math.min(1,a))),d=(l+Math.PI)/(2*Math.PI),f=(Math.PI/2-u)/Math.PI;return d%=1,d=d<0?d+1:d,f=Math.max(0,Math.min(1,f)),new c.Vector2(d,f)}function cv(e,t=`top-left`){let n=new c.Quaternion().setFromRotationMatrix(this.work.transform).invert(),r=new c.Quaternion().copy(this.quaternion).invert(),i=new c.Quaternion(0,1,0,0).invert(),a=new c.Vector3().copy(e).normalize().applyQuaternion(n).applyQuaternion(r).applyQuaternion(i),o=Math.atan2(a.x,-a.z),s=Math.asin(-a.y);if(t===`top-left`)return new c.Vector2(o/(Math.PI*2)+.5,s/Math.PI+.5);if(t===`bottom-left`)return new c.Vector2(o/(Math.PI*2)+.5,.5-s/Math.PI);throw Error(`Invalid uvOrigin ${t}`)}function lv(e,t=`top-left`){let n=0;if(t===`top-left`)n=1;else if(t===`bottom-left`)n=-1;else throw Error(`Invalid uvOrigin ${t}`);let r=new c.Quaternion().setFromRotationMatrix(this.work.transform),i=new c.Quaternion().copy(this.quaternion),a=new c.Quaternion(0,1,0,0),o=Math.PI*2*(e.x+.5),s=Math.PI*(e.y-.5),l=Math.abs(Math.cos(s)),u=Math.sin(o)*l,d=-Math.sin(s)*n,f=-Math.cos(o)*l;return new c.Vector3(u,d,f).applyQuaternion(a).applyQuaternion(i).applyQuaternion(r)}function uv(e,t=`top-left`){let n=ov(this.vectorToEquirectangularUv(e,`top-left`));if(t===`top-left`)return n;if(t===`bottom-left`){let[e,t]=n;return t.y=1-t.y,n}else throw Error(`Invalid uvOrigin ${t}`)}function dv(e,t,n=`top-left`){let r;if(n===`top-left`)r=t;else if(n===`bottom-left`)r=new c.Vector2().copy(t),r.y=1-r.y;else throw Error(`Invalid uvOrigin ${n}`);let i=sv(e,r);return this.equirectangularUvToVector(i)}function fv(){return new c.Vector3().copy(this.position).applyMatrix4(this.work.transform)}function pv(){return new c.Vector3().copy(this.standingPosition).applyMatrix4(this.work.transform)}function mv(e){return typeof e==`number`}function hv(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>typeof e!=`object`||!e?e:hv(e));{let t={};for(let n in e){let r=e[n];t[n]=typeof r!=`object`||!r?r:hv(r)}return t}}function gv(e){return e==null?`null`:Array.isArray(e)?`array`:typeof e==`object`?`dict`:`value`}function _v(e,t){let n=gv(e),r=gv(t);if(r===`null`)return e;if(r===`value`)return t;if(r!==n)return hv(t);if(r===`array`)for(let n=0;n<t.length;n++)e[n]=_v(e[n],t[n]);else if(r===`dict`)for(let n in t)e[n]=_v(e[n],t[n]);return e}function vv(e,t=!1){let n=typeof e;if(n===`string`)return JSON.stringify(e);if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e instanceof Array){let t=`[`,n=e.length-1,r=0;for(;r<n;r++)t+=vv(e[r],!1)+`,`;return n>-1&&(t+=vv(e[r],!1)),t+`]`}if(e instanceof Object){if(typeof e.toJSON==`function`)return vv(e.toJSON(),t);let n=Object.keys(e).sort(),r=n.length,i=``,a=0;for(;a<r;){let t=n[a],r=vv(e[t],!0);r!==void 0&&(a&&i!==``&&(i+=`,`),i+=JSON.stringify(t)+`:`+r),a++}return`{`+i+`}`}switch(n){case`function`:return JSON.stringify(e.toString());case`undefined`:return t?void 0:null;case`number`:return e;default:return isFinite(e)?e:null}}function yv(e){return vv(e,!1)}function bv(e){return`hash::${gt(yv(e))}`}var xv=/^(.*)\[(\d+)\]$/;function Sv(e){if(!isNaN(e.panoIndex)&&isFinite(e.panoIndex))return`${e.workCode}[${e.panoIndex}]`;throw Error(`Invalid Pano`)}function Cv(e){let t=e.match(xv);if(t){let[e,n,r]=t,i=Math.floor(Number(r));if(!isNaN(i)&&isFinite(i))return{workCode:n,panoIndex:i}}throw Error(`Invalid PanoId`)}function wv(e,t){return Sv(e)===Sv(t)}function Tv(e){return typeof e==`string`&&xv.test(e)}var Ev=`\\{([^\\}]+)\\}`;function Dv(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Ov(e){return RegExp(`^`+e.map(e=>Dv(e)).join(`(.+)`)+`$`)}var kv=class{constructor(e){this.strings=[],this.keys=[];let t=new RegExp(Ev,`g`),n,r=0;for(;(n=t.exec(e))!==null;)this.strings.push(e.slice(r,n.index)),this.keys.push(n[1]),r=n.index+n[0].length;this.strings.push(e.slice(r))}stringify(e){let t=[this.strings[0]];for(let n=0;n<this.keys.length;n++){let r=e[this.keys[n]];t.push(String(r),this.strings[n+1])}return t.join(``)}match(e){var t;this.matchRegexp=(t=this.matchRegexp)==null?Ov(this.strings):t;let n=e.match(this.matchRegexp);if(!n)return null;let r={};for(let e=0;e<this.keys.length;e++){let t=this.keys[e],i=n[e+1];if(r[t]!==i){if(r[t]!==void 0)return null;r[t]=i}}return r}};function Av(e){Object.freeze(e);let t=typeof e==`function`,n=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(e).forEach(function(r){n.call(e,r)&&(!t||r!==`caller`&&r!==`callee`&&r!==`arguments`)&&e[r]!==null&&(typeof e[r]==`object`||typeof e[r]==`function`)&&!Object.isFrozen(e[r])&&Av(e[r])}),e}var jv=/^[0-9a-z]+\:\/\/(([^:/?#]*)(?::[0-9]+)?)/i,Mv=Av(JSON.parse(function(...e){return arguments[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/rnyrr;p{/9/rnyrr;p|z/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/rnyrr;nv/9/;p{/9/pq{;p{/9/pnyp{|qr;vr/j`))),Nv=/^([^.]+)(\.([^.]+))*$/,Pv=typeof location<`u`?location.hostname:`localhost`;function Fv(e){return/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(e)}function Iv(e,t){if(!Nv.test(e)||!Nv.test(t))return!1;if(e===`*`)return!0;let n=e.split(`.`).reverse(),r=t.split(`.`).reverse();if(n.length<=1)return e===t;for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function Lv(e){if(/^blob\:/i.test(e)||/^data\:/i.test(e))return Pv;let t=e.match(jv);return t?t[2]:Pv}var Rv=()=>Error(`Invalid input.`),zv=()=>Error(`Invalid certificate.`),Bv=()=>Error(`Invalid signature.`),Vv=e=>Error(`Date(${e.toString()}) expired.`),Hv=e=>Error(`Host(${JSON.stringify(e)}) is not allowed.`);function Uv(e,t){let n={};for(let r of Object.keys(e))t.indexOf(r)===-1&&(n[r]=e[r]);return n}function Wv(e,t=!1){let n=typeof e;if(n===`string`)return JSON.stringify(e);if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e instanceof Array){let t=`[`,n=e.length-1,r=0;for(;r<n;r++)t+=Wv(e[r],!1)+`,`;return n>-1&&(t+=Wv(e[r],!1)),t+`]`}if(e instanceof Object){if(typeof e.toJSON==`function`)return Wv(e.toJSON(),t);let n=Object.keys(e).sort(),r=n.length,i=``,a=0;for(;a<r;){let t=n[a],r=Wv(e[t],!0);r!==void 0&&(a&&i!==``&&(i+=`,`),i+=JSON.stringify(t)+`:`+r),a++}return`{`+i+`}`}switch(n){case`function`:case`undefined`:return t?void 0:null;case`number`:return 0;default:return isFinite(e)?e:null}}function Gv(e){return String(Wv(e,!1))}function Kv(e){var t,n,r;let i={};try{i=typeof e==`string`?JSON.parse(e):e}catch(e){return Rv()}if(typeof i!=`object`)return Rv();let a=Pv,o=Date.now(),s=new Date(typeof i.expire_at==`string`&&/^\d+$/.test(i.expire_at)?Number(i.expire_at):i.expire_at),c=Array.isArray(i.allow_hosts)?i.allow_hosts:[];if(a.length===0||Fv(a)||Mv.filter(e=>Iv(e,a)).length>0){let e=String((t=i.certificate)==null?``:t);if(e)try{let t=new ht;return t.readCertPEM(e),Av({issuer:t.getSubjectString(),expire:s,allowHosts:c})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`[PARSE Error]: Invalid Certificate. `+t)}return Av({issuer:`none`,expire:s,allowHosts:c})}let l=String((n=i.certificate)==null?``:n);if(!l)return zv();let u=new ht;u.readCertPEM(l);let d=String((r=i._signature)==null?``:r);return!d||St(Gv(Uv(i,[`_signature`])),d,u)===!1?Bv():o<s.getTime()?Mv.concat(c).filter(e=>Iv(e,a)).length===0?Hv(a):Av({issuer:u.getSubjectString(),expire:s,allowHosts:c}):Vv(s)}function qv(e,t){let n=Lv(e);return Pv.length!==0&&!Fv(Pv)&&Mv.filter(e=>Iv(e,Pv)).length===0&&!Fv(n)&&Mv.concat(t).filter(e=>Iv(e,n)).length===0?Hv(n):e}var Jv=new Set,Yv=new c.Vector3(1,1,1),Xv=[`right`,`left`,`up`,`down`,`front`,`back`],Zv=[`gainmap_right`,`gainmap_left`,`gainmap_up`,`gainmap_down`,`gainmap_front`,`gainmap_back`],Qv={vectorToEquirectangularUv:cv,vectorToCubemapUv:uv,equirectangularUvToVector:lv,cubemapUvToVector:dv,getWorldPosition:fv,getWorldStandingPosition:pv};function $v(e,t){if(!Qs(e))return e;if(e.indexOf(t)===0)return e.slice(t.length);let n=t.replace(/^https\:/,`http:`);if(e.indexOf(n)===0)return e.slice(n.length);let r=t.replace(/^http\:/,`https:`);return e.indexOf(r)===0?e.slice(r.length):(console.warn(`${e} is not start with base_url(${t}).`),e)}function ey(e,t,n){return!Qs(e)&&typeof t==`string`&&t.length>0&&(e=ec(t,String(n),e)),e}function ty(e){for(let t=10;t>=0;t--)if(512*Math.pow(2,t)<=e)return t;return null}function ny(e){e=e.slice().sort((e,t)=>e.level-t.level);let t=[];for(let n of e){if(t.length===0){t.push(n);continue}let e=t[t.length-1];if(n.level>e.level){t.push(n);continue}if(n.size>e.size){t[t.length-1]=n;continue}}return t}function ry(e){let{manifest:t,baseURL:n}=e,r=[];return t.forEach((e,t)=>{let i={index:t,derived_id:e.derived_id,size_list:e.size_list,hdr_config:ec(n,e.cfg)};Xv.forEach(t=>{i[t]=ec(n,e[t])}),Zv.forEach(t=>{i[t]=ec(n,e[t])}),r.push(i)}),r}function iy(e,t){var n,r,i,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b,x;let S=[],C=null;for(let t of[].concat(e))if(`getURL`in t)C={allowHosts:t.allowHosts,expire:t.expire,issuer:t.issuer},S.push(av(t));else{let e=typeof t==`string`?JSON.parse(t):hv(t),n=Kv(e);if(n instanceof Error)return n;C===null&&(C=n),S.push(e)}if(C===null)return Error(`Empty`);Z(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:C.issuer}),Z(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(C.expire)}),Z(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(C.allowHosts)});let w=S.reduce((e,t)=>_v(e,t));Z(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:String((n=w.name)==null?`Unknown`:n)}),Z(t,`workCode`,{enumerable:!0,writable:!0,value:String(w.resource_code||w.basic_code||w.vr_code||w.code||w.project_id||w.work_code||w.workCode||Mt())}),Z(t,`projectId`,{enumerable:!0,writable:!0,value:w.project_id}),Z(t,`baseURL`,{enumerable:!0,writable:!0,value:(()=>{var e;let t=(e=w.base_url)==null?``:e;return t&&t[t.length-1]!==`/`&&(t+=`/`),t})()});let T;typeof w.model==`object`&&(T={},Z(T,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),Z(T,`file`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=w.model.file_url;if(e)return $v(e,t.baseURL)})()}),Z(T,`textureBase`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=w.model.material_base_url;return e&&(e=$v(e,t.baseURL)),e})()}),Z(T,`textures`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e;return Array.isArray(w.model.material_textures)&&(e=w.model.material_textures.slice(),Object.freeze(e)),e})()}),Z(T,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:w.model.up_axis}),Z(T,`coordinate`,{enumerable:!0,configurable:!1,writable:!1,value:hv(w.model.coordinate)}),Z(T,`layers`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e,n,r;let i=[];if(Array.isArray(w.model.layers)){for(let a of w.model.layers)if(a&&a.tileset_url){let o={};Z(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),Z(o,`name`,{enumerable:!0,configurable:!1,writable:!1,value:(e=a.name)==null?``:e}),Z(o,`type`,{enumerable:!0,configurable:!1,writable:!1,value:(n=a.type)==null?`mesh`:n}),Z(o,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:(r=a.up_axis)==null?`Z`:r}),Z(o,`tileset`,{enumerable:!0,configurable:!1,writable:!1,value:$v(a.tileset_url,t.baseURL)}),i.push(o)}}if(typeof w.model.tiles==`object`){let e=w.model.tiles;if(e&&e.tileset_url){let n={};Z(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),Z(n,`name`,{enumerable:!0,configurable:!1,writable:!1,value:`lod`}),Z(n,`type`,{enumerable:!0,configurable:!1,writable:!1,value:`mesh`}),Z(n,`upAxis`,{enumerable:!0,configurable:!1,writable:!1,value:`-Y`}),Z(n,`tileset`,{enumerable:!0,configurable:!1,writable:!1,value:$v(e.tileset_url,t.baseURL)}),i.push(n)}}return Object.freeze(i)})()})),Z(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:T});let E=[];if(Array.isArray(w.observers)&&w.panorama&&Array.isArray(w.panorama.list||w.panorama.info)){let e=w.observers,n=t.panoHDR?ry(t.panoHDR):(r=w.panorama.list||w.panorama.info)==null?[]:r,S=(u=(s=(a=(i=w.panorama)==null?void 0:i.pano_high_cube_base_url)==null?(o=w.panorama)==null?void 0:o.pano_cube_base_url:a)==null?(l=w.panorama)==null?void 0:l.base_url:s)==null?``:u,C=Math.min(e.length,n.length),T={};for(let e of Object.keys((d=w.panorama.pattern)==null?{}:d)){let t=e,n=w.panorama.pattern[t];if(typeof n==`string`){let e=new kv(n);T[t]=t=>e.stringify(t)}else T[t]=()=>n}let D=(e,t)=>{var n;let r=T[t];return(n=e[t])==null?r?r(e):void 0:n};for(let r=0;r<C;r++){let i=e[r],a=n[r],o=Object.create(Qv);Z(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),Z(o,`index`,{enumerable:!0,configurable:!1,writable:!1,value:r}),Z(o,`panoIndex`,{enumerable:!0,configurable:!1,writable:!1,value:r}),Z(o,`panoId`,{enumerable:!0,configurable:!1,writable:!1,value:Sv({workCode:t.workCode,panoIndex:r})}),Z(o,`floorIndex`,{enumerable:!0,configurable:!1,writable:!1,value:(f=i.floor_index)==null?i.floor:f}),Z(o,`derivedId`,{enumerable:!0,configurable:!1,writable:!1,value:(m=(p=i.derived_id)==null?D(a,`derived_id`):p)==null?0:m}),Z(o,`derivedIdStr`,{enumerable:!0,configurable:!1,writable:!1,value:(g=(h=i.derived_id_str)==null?D(a,`derived_id_str`):h)==null?String(o.derivedId):g}),Z(o,`active`,{enumerable:!0,configurable:!1,writable:!1,value:i.active!==!1&&D(a,`active`)!==!1}),Z(o,`loadable`,{enumerable:!0,configurable:!1,writable:!1,value:(v=(_=i.loadable)==null?D(a,`loadable`):_)==null?!1:v}),Z(o,`position`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Vector3().fromArray((y=i.position)==null?[0,0,0]:y))}),Z(o,`standingPosition`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Vector3().fromArray((x=(b=i.standing_position)==null?i.standingPosition:b)==null?[0,0,0]:x))}),Z(o,`quaternion`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Quaternion().fromArray(i.quaternion?[i.quaternion.x,i.quaternion.y,i.quaternion.z,i.quaternion.w]:[0,0,0,1]))}),Z(o,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new c.Matrix4().compose(o.position,o.quaternion,Yv))}),Z(o,`accessibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{if(Jv.clear(),i.accessible_nodes&&Array.isArray(i.accessible_nodes))for(let e of i.accessible_nodes)e>=C||e===r||Jv.add(e);else if(i.accessibleNodes&&Array.isArray(i.accessibleNodes))for(let e of i.accessibleNodes)e>=C||e===r||Jv.add(e);else if(i.visible_nodes&&Array.isArray(i.visible_nodes))for(let e of i.visible_nodes)e>=C||e===r||Jv.add(e);else if(i.visibleNodes&&Array.isArray(i.visibleNodes))for(let e of i.visibleNodes)e>=C||e===r||Jv.add(e);if(Jv.size===0)for(let e=0;e<C;e++)e!==r&&Jv.add(e);let e=Array.from(Jv);return Jv.clear(),Object.freeze(e)})()}),Z(o,`visibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:o.accessibleNodes}),Z(o,`images`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};Z(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t});for(let n of Xv)Z(e,n,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e;return $v(ey((e=D(a,n))==null?``:e,S,r),t.baseURL)})()});if(Z(e,`hdrConfig`,{enumerable:!0,configurable:!1,writable:!1,value:D(a,`hdr_config`)}),e.hdrConfig)for(let n of Zv)Z(e,n,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var e;return $v(ey((e=D(a,n))==null?``:e,S,r),t.baseURL)})()});return Z(e,`sizeList`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let t=kc(e[Xv[0]]),n=D(a,`size_list`),r=D(a,`tiles`);if(t){if(n){let e=n.slice().sort((e,t)=>e-t);return Object.freeze(e)}else if(r){let e=[t],n=r.slice().sort((e,t)=>e-t);for(let r of n){let n=512*Math.pow(2,r);n>t&&e.push(n)}return Object.freeze(e)}return Object.freeze([t])}return Object.freeze([])})()}),Z(e,`tiles`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let n=kc(e.front);if(!n)return;let i=e.sizeList.slice();if(i[0]){let e=ty(i[0]);if(e)for(let t=e-1;t>=0;t--)i.unshift(512*Math.pow(2,t))}if(i.length<=0)return;let o=[];for(let s of i){let i=ty(s);if(typeof i!=`number`)continue;let c={};if(Z(c,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),Z(c,`level`,{enumerable:!0,configurable:!1,writable:!1,value:i}),s>n){Z(c,`size`,{enumerable:!0,configurable:!1,writable:!1,value:s}),Z(c,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:1});for(let t of Xv)Z(c,t,{enumerable:!0,configurable:!1,writable:!1,value:Ac(e[t],s)});if(e.hdrConfig)for(let e of Zv)Z(c,e,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var n;return Ac($v(ey((n=D(a,e))==null?``:n,S,r),t.baseURL),s)})()})}else{Z(c,`size`,{enumerable:!0,configurable:!1,writable:!1,value:n}),Z(c,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:s/n});for(let t of Xv)Z(c,t,{enumerable:!0,configurable:!1,writable:!1,value:e[t]});if(e.hdrConfig)for(let e of Zv)Z(c,e,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{var n;return $v(ey((n=D(a,e))==null?``:n,S,r),t.baseURL)})()})}o.push(c)}return o=ny(o),Object.freeze(o)})()}),Z(e,`video`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=D(a,`video`),n;return e&&(n={},Z(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),Z(n,`source`,{enumerable:!0,configurable:!1,writable:!1,value:e.source}),Z(n,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Matrix4().fromArray(e.matrix)}),Z(n,`size`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Vector2().fromArray(e.size)})),n})()}),e})()}),E.push(o)}}Z(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(E)});let D={};if(Z(D,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),w.initial){if(t.observers.length>0){let e;mv(w.initial.panoIndex)?e=w.initial.panoIndex:mv(w.initial.pano_index)?e=w.initial.pano_index:mv(w.initial.pano)&&(e=w.initial.pano),typeof e==`number`&&(e=H(e,0,t.observers.length-1),Z(D,`panoIndex`,{enumerable:!0,writable:!0,value:e}))}if(w.initial.mode===`Panorama`&&t.observers.length===0||w.initial.mode===`Floorplan`||w.initial.mode===`Topview`||w.initial.mode===`Model`||w.initial.mode===`Mapview`?Z(D,`mode`,{enumerable:!0,writable:!0,value:w.initial.mode}):typeof D.panoIndex==`number`?Z(D,`mode`,{enumerable:!0,writable:!0,value:`Panorama`}):Z(D,`mode`,{enumerable:!0,writable:!0,value:`Mapview`}),mv(w.initial.latitude)&&Z(D,`latitude`,{enumerable:!0,writable:!0,value:w.initial.latitude}),mv(w.initial.longitude)?Z(D,`longitude`,{enumerable:!0,writable:!0,value:w.initial.longitude}):mv(w.initial.heading)&&Z(D,`longitude`,{enumerable:!0,writable:!0,value:yi(w.initial.heading)}),mv(w.initial.fov)&&Z(D,`fov`,{enumerable:!0,writable:!0,value:w.initial.fov}),mv(w.initial.distance)&&Z(D,`distance`,{enumerable:!0,writable:!0,value:w.initial.distance}),Array.isArray(w.initial.offset)){let e=w.initial.offset,t=[0,0,0].map((t,n)=>{let r=Number(e[n]);return isNaN(r)||!isFinite(r)?0:r});Z(D,`offset`,{enumerable:!0,writable:!0,value:new c.Vector3().fromArray(t)})}else typeof w.initial.offset==`object`&&typeof w.initial.offset.x==`number`&&typeof w.initial.offset.y==`number`&&typeof w.initial.offset.z==`number`&&Z(D,`offset`,{enumerable:!0,writable:!0,value:new c.Vector3().fromArray([w.initial.offset.x,w.initial.offset.y,w.initial.offset.z])})}return Z(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:D}),t}function ay(e,t){return Z(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:`null`}),Z(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),Z(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([`*`])}),Z(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:`Null`}),Z(t,`workCode`,{enumerable:!0,value:`null-`+Mt()}),Z(t,`baseURL`,{enumerable:!0,value:`/`}),Z(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),Z(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),Z(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};return Z(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),Z(e,`mode`,{enumerable:!0,writable:!0,value:`Mapview`}),e})()}),t}function oy(e,t){var n,r;return Z(t,`issuer`,{enumerable:!0,configurable:!1,writable:!1,value:`null`}),Z(t,`expire`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze(new Date)}),Z(t,`allowHosts`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([`*`])}),Z(t,`name`,{enumerable:!0,configurable:!1,writable:!1,value:String((n=e.name)==null?`Unknown`:n)}),Z(t,`workCode`,{enumerable:!0,writable:!0,value:(r=e.code)==null?Mt():r}),Z(t,`baseURL`,{enumerable:!0,writable:!0,value:`/`}),Z(t,`model`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),Z(t,`observers`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let n={};return Z(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),Z(n,`index`,{enumerable:!0,configurable:!1,writable:!1,value:0}),Z(n,`panoIndex`,{enumerable:!0,configurable:!1,writable:!1,value:0}),Z(n,`panoId`,{enumerable:!0,configurable:!1,writable:!1,value:Sv({workCode:t.workCode,panoIndex:0})}),Z(n,`floorIndex`,{enumerable:!0,configurable:!1,writable:!1,value:0}),Z(n,`derivedId`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),Z(n,`derivedIdStr`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),Z(n,`active`,{enumerable:!0,configurable:!1,writable:!1,value:!0}),Z(n,`loadable`,{enumerable:!0,configurable:!1,writable:!1,value:!1}),Z(n,`position`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Vector3(0,1.5,0)}),Z(n,`standingPosition`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Vector3(0,0,0)}),Z(n,`quaternion`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Quaternion(0,1,0,0)}),Z(n,`matrix`,{enumerable:!0,configurable:!1,writable:!1,value:new c.Matrix4().compose(n.position,n.quaternion,Yv)}),Z(n,`accessibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([])}),Z(n,`visibleNodes`,{enumerable:!0,configurable:!1,writable:!1,value:n.accessibleNodes}),Z(n,`images`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let n={};Z(n,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t});for(let t of Xv)Z(n,t,{enumerable:!0,configurable:!1,writable:!1,value:e[t]});return Z(n,`sizeList`,{enumerable:!0,configurable:!1,writable:!1,value:Object.freeze([e.size])}),Z(n,`tiles`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e=kc(n.front);if(!e)return;let r=n.sizeList.slice();if(r[0]){let e=ty(r[0]);if(e)for(let t=e-1;t>=0;t--)r.unshift(512*Math.pow(2,t))}if(r.length<=0)return;let i=[];for(let a of r){let r=ty(a);if(typeof r!=`number`)continue;let o={};if(Z(o,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),Z(o,`level`,{enumerable:!0,configurable:!1,writable:!1,value:r}),a>e){Z(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:a}),Z(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:1});for(let e of Xv)Z(o,e,{enumerable:!0,configurable:!1,writable:!1,value:Ac(n[e],a)})}else{Z(o,`size`,{enumerable:!0,configurable:!1,writable:!1,value:e}),Z(o,`scale`,{enumerable:!0,configurable:!1,writable:!1,value:a/e});for(let e of Xv)Z(o,e,{enumerable:!0,configurable:!1,writable:!1,value:n[e]})}i.push(o)}return i=ny(i),Object.freeze(i)})()}),Z(n,`video`,{enumerable:!0,configurable:!1,writable:!1,value:void 0}),n})()}),Object.freeze([n])})()}),Z(t,`initial`,{enumerable:!0,configurable:!1,writable:!1,value:(()=>{let e={};return Z(e,`work`,{enumerable:!1,configurable:!1,writable:!1,value:t}),Z(e,`mode`,{enumerable:!0,writable:!0,value:`Panorama`}),Z(e,`panoIndex`,{enumerable:!0,writable:!0,value:0}),e})()}),t}var sy=new WeakSet,cy=class{constructor(e,t){this.observerBox=new c.Box3,this.observerBox=new c.Box3,this.transform=new c.Matrix4,this.shortPath=!1,this.jsonp=!1,t.panoHDR&&(this.panoHDR=t.panoHDR);let n;if(n=e===null?ay(e,this):typeof e==`object`&&typeof e.size==`number`&&typeof e.up==`string`&&typeof e.down==`string`&&typeof e.right==`string`&&typeof e.left==`string`&&typeof e.front==`string`&&typeof e.back==`string`?oy(e,this):iy(e,this),n instanceof Error)throw Error(`[PARSE FAILED]: `+n.message+`
|
|
907
|
+
Error work input:
|
|
908
|
+
`+JSON.stringify(e));sy.add(this);for(let e of this.observers)this.observerBox.expandByPoint(e.position),this.observerBox.expandByPoint(e.standingPosition);t.baseURL&&(this.baseURL=t.baseURL),t.transform&&(Array.isArray(t.transform)?this.transform.fromArray(t.transform):this.transform.copy(t.transform)),typeof t.jsonp==`boolean`&&(this.jsonp=t.jsonp),typeof t.shortPath==`boolean`&&(this.shortPath=t.shortPath),t.workCode&&(typeof t.workCode==`string`?this.workCode=t.workCode:typeof t.workCode==`function`&&(this.workCode=t.workCode(e)));{let e=this;this.options={get transform(){return e.transform}},this.raw={get works(){return[JSON.stringify(av(e))]}}}}getURL(e){var t;if(!Qs(e)){if(this.jsonp===!0){e=e.replace(/([\?\#].*)?$/i,``);let t=gt(`${e}`).slice(0,7);e=`${e}.${t}.jsonp`}if(this.shortPath===!0){let n=e.replace(e,``).split(`.`),r=(t=n.shift())==null?``:t,i=n.join(`.`);e=gt(r)+(i?`.`+i:``)}e=ec(this.baseURL,e)}return e=$s(e),e}verifyURL(e){return typeof qv(this.getURL(e),this.allowHosts)==`string`}toJSON(){return av(this)}};cy.parse=ly;function ly(e,t){typeof e==`string`&&e.trim()[0]===`{`&&(e=JSON.parse(e));try{return new cy(e,t==null?{}:t)}catch(t){console.log(t);let n=t instanceof Error?t.message:String(t);throw Error(`[PARSE Error]: `+n+`
|
|
909
|
+
Error work input:
|
|
910
|
+
`+JSON.stringify(e))}}var uy=new c.Matrix4,dy=class{constructor(e){this.isResolved=!0,this.work=e.work,this.index=e.index,this.panoIndex=e.panoIndex,this.pano={panoIndex:e.panoIndex,workCode:e.work.workCode},this.panoId=Sv({panoIndex:e.panoIndex,workCode:e.work.workCode}),this.floorIndex=e.floorIndex,this.derivedId=e.derivedId,this.derivedIdStr=e.derivedIdStr,this.active=e.active,this.loadable=e.loadable,this.images=e.images,this.accessibleNodes=e.accessibleNodes,this.accessibleIds=e.accessibleNodes.map(t=>Sv({panoIndex:t,workCode:e.work.workCode})),this.visibleNodes=this.accessibleNodes,this.visibleIds=this.accessibleIds,this.position=new c.Vector3().copy(e.position).applyMatrix4(e.work.transform),this.standingPosition=new c.Vector3().copy(e.standingPosition).applyMatrix4(e.work.transform),this.quaternion=new c.Quaternion().setFromRotationMatrix(uy.makeRotationFromQuaternion(e.quaternion).premultiply(e.work.transform)),this.matrix=new c.Matrix4().copy(e.matrix).premultiply(e.work.transform)}};function fy(e){let t=new Set;for(let n of e){if(t.has(n.workCode))throw Error(`WorkCode:${n.workCode} duplicated.`);t.add(n.workCode)}t.clear();let n=e.map(e=>{if(sy.has(e))return e;{let t=ly(null);return t.workCode=e.workCode,t}});return Object.freeze(Object.assign(n,{get initial(){var e;return(e=n[0])==null?void 0:e.initial},getWork(e){for(let t of n)if(t.workCode===e)return t},getObserver(e){var t,r;let i=(t=n[0])==null?void 0:t.workCode,a=0;if(Tv(e)){let t=Cv(e);i=t.workCode,a=t.panoIndex}else typeof e==`number`?a=e:(i=e.workCode,a=e.panoIndex);return(r=this.getWork(i))==null?void 0:r.observers[a]},getResolvedObserver(e){let t=this.getObserver(e);if(t)return new dy(t)},toJSON(){return this.map(e=>({work:av(e),transform:e.transform.toArray()}))}}))}var py=class extends c.Timer{constructor(e=!0,t=!1){super(),this.autoStart=e,this.autoUpdate=t}update(e){return this.autoUpdate?this:super.update(e)}getDelta(){return this.autoUpdate&&super.update(),super.getDelta()}getElapsedTime(){return this.autoUpdate&&super.update(),super.getElapsed()}},my=class{constructor(e){var t;this.outputType=(t=e.outputType)==null?c.UnsignedByteType:t,this.status={endabledPassNumber:0,needsColorGBuffer:!1,needsDepthGBuffer:!1,needsNormalGBuffer:!1,version:`0|false|false|false`},this.gbuffer=new Map;let n={type:this.outputType,generateMipmaps:!1,minFilter:c.LinearFilter,magFilter:c.LinearFilter,format:c.RGBAFormat,depthBuffer:!0,stencilBuffer:!0};this.renderTarget1=new c.RenderTarget(1,1,n),this.renderTarget1.texture.name=`EffectComposer.rt1`,this.renderTarget2=new c.RenderTarget(1,1,n),this.renderTarget2.texture.name=`EffectComposer.rt2`,this.readBuffer=this.renderTarget1,this.writeBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.normalMaterial=new c.MeshNormalMaterial({flatShading:!0}),this.clock=new py(!0,!0)}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e)}insertPass(e,t){this.passes.splice(t,0,e)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}render(e){let t=!1;this.renderTarget1.texture.colorSpace=e.outputColorSpace,this.renderTarget2.texture.colorSpace=e.outputColorSpace;let n=this.clock.getDelta(),r=this.passes.filter(e=>e.enabled);for(let i=0;i<r.length;i++){let a=r[i],o=i===r.length-1;a.renderToScreen=this.renderToScreen&&o,a.renderToScreen&&(t=!0),a.gbuffer=this.gbuffer,a.render(e,this.writeBuffer,this.readBuffer,n,!1),a.gbuffer=null,a.needsSwap&&this.swapBuffers()}return t}setSize(e,t){this.renderTarget1.setSize(e,t),this.renderTarget2.setSize(e,t);for(let n=0;n<this.passes.length;n++)this.passes[n].setSize(e,t)}updateStatus(){let e=this.passes.filter(e=>e.enabled),t=!1,n=!1,r=!1;for(let i of e)if(`dependencies`in i&&Array.isArray(i.dependencies)){let e=i.dependencies;t===!1&&(t=e.indexOf(`color`)>=0),n===!1&&(n=e.indexOf(`depth`)>=0),r===!1&&(r=e.indexOf(`normal`)>=0)}let i=e.length;this.status.endabledPassNumber=i,this.status.needsColorGBuffer=t,this.status.needsDepthGBuffer=n,this.status.needsNormalGBuffer=r,this.status.version=`${i}|${t}|${n}|${r}`}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose()}},hy=class e{constructor(t){this._scene=new c.Scene,this._mesh=new c.Mesh(e.geometry,t),this._mesh.frustumCulled=!1,this._scene.add(this._mesh)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._scene,e.camera)}};hy.camera=new c.OrthographicCamera(-1,1,1,-1,0,1),hy.geometry=(()=>{let e=new c.PlaneGeometry(2,2,1,1);for(let t=1;t<e.attributes.uv.array.length;t+=2)e.attributes.uv.array[t]=1-e.attributes.uv.array[t];return e})();var gy=class{constructor(e){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!0,this.dependencies=e==null?[]:e}setSize(e,t){}render(e,t,n,r,i){}dispose(){}};gy.FullScreenQuad=hy;var _y=(0,d.uniform)(1),vy=(0,d.uniform)(1),yy=(0,d.uniform)(0),by=(0,d.uv)(),xy=(0,d.vec2)(by.x,by.y.mul(vy).add(yy)),Sy=(0,d.texture)(new c.Texture,xy),Cy=new c.NodeMaterial;Cy.fragmentNode=(0,d.vec4)(Sy.rgb,Sy.a.mul(_y)),Cy.transparent=!0,Cy.depthTest=!1,Cy.depthWrite=!1;var wy=new hy(Cy),Ty=(0,d.uniform)(new c.Color),Ey=(0,d.uniform)(1),Dy=new c.NodeMaterial;Dy.fragmentNode=(0,d.vec4)(Ty,Ey),Dy.transparent=!0,Dy.depthTest=!1,Dy.depthWrite=!1;var Oy=new hy(Dy);function ky(e,t,n=!1,r=1){t instanceof c.Texture?(Sy.value=t,_y.value=r,vy.value=n?-1:1,yy.value=+!!n,wy.render(e),Sy.value=null):(Ty.value.copy(t),Ey.value=r,Oy.render(e))}var Ay=256,jy=128,My={width:Ay,height:jy,data:new Uint8ClampedArray(Ay*jy*4)},Ny=256,Py=new Uint32Array(Ny);function Fy(e,t={peak:0,mean:0,min:0,max:0}){let n=0,r=0;for(let e=1;e<Ny;e++)Py[e]=0;for(let t=0;t<e.length;t++){let i=e[t],a=i.type===`rgb`?3:4,o=i.data.length/a;n+=o;let s=i.data;for(let e=0;e<o;e++){let t=e*a,n=s[t],i=s[t+1],o=s[t+2],c=Math.round(.299*n+.587*i+.114*o);Py[c]++,r+=c}}let i=r/n,a=0,o=0;for(let e=1;e<Ny;e++)Py[e]>o&&(o=Py[e],a=e);let s=0;for(let e=0;e<Ny;e++)if(Py[e]!==0){s=e;break}let c=Ny-1;for(let e=c;e>=0;e--)if(Py[e]!==0){c=e;break}return t.peak=a/(Ny-1),t.mean=i/255,t.min=s/(Ny-1),t.max=c/(Ny-1),t}var Iy=class{constructor(e,t,n,r){this.peak=e==null?0:e,this.mean=t==null?0:t,this.min=n==null?0:n,this.max=r==null?0:r}formPixels(...e){return Fy(e.map(e=>({data:e,type:`rgba`})),this),this}toJSON(){return{peak:this.peak,mean:this.mean,min:this.min,max:this.max}}toArray(){return[this.peak,this.mean,this.min,this.max]}toString(){return this.toArray().join(` `)}},Ly=Math.PI,Ry=Ly*2;function zy(e,t,n){if(e===t)return t;let r=t-e;return Math.abs(r)<=n?t:e+(r>0?1:-1)*n}function By(e,t,n){if(e.equals(t))return new c.Vector3().copy(t);let r=new c.Vector3().subVectors(t,e);return r.lengthSq()<n*n?r.copy(t):r.setLength(n).add(e)}function Vy(e,t,n){if(e.longitude===t.longitude&&e.latitude===t.latitude)return{longitude:t.longitude,latitude:t.latitude};let r=hi(e.longitude),i=e.latitude,a=hi(t.longitude),o=t.latitude;a-r>Ly?r+=Ry:r-a>Ly&&(r-=Ry);let s=n/Math.sqrt(Math.pow(a-r,2)+Math.pow(o-i,2));return s>=1?{longitude:t.longitude,latitude:t.latitude}:{longitude:r+(a-r)*s,latitude:i+(o-i)*s}}var Hy=64,Uy=(0,d.texture)(new c.Texture),Wy=(0,d.uniform)(0),Gy=(0,d.uniform)(1),Ky=(0,d.Fn)(([e])=>{let t=e.r.mul(.299).add(e.g.mul(.587)).add(e.b.mul(.114));return(0,d.vec3)(t,e.b.sub(t).mul(.493),e.r.sub(t).mul(.877))}),qy=(0,d.Fn)(([e])=>{let t=e.x,n=e.y,r=e.z;return(0,d.vec3)(t.add(r.mul(1/.877)),t.sub(n.mul(.39393)).sub(r.mul(.58081)),t.add(n.mul(1/.493)))}),Jy=(0,d.Fn)(()=>{let e=Uy.sample((0,d.uv)()),t=Ky(e.rgb).toVar(),n=(0,d.clamp)(t.x.sub(Wy).div(Gy.sub(Wy)),0,1);return t.x.assign(n),(0,d.vec4)(qy(t),e.a)}),Yy=new c.NodeMaterial;Yy.fragmentNode=Jy(),Yy.depthTest=!1,Yy.depthWrite=!1;var Xy=new hy(Yy);function Zy(e,t,n,r){Uy.value=t,Wy.value=n,Gy.value=r,Xy.render(e)}var Qy=class extends gy{constructor(){super(),this.histogram=new Iy,this.minValue=0,this.maxValue=1,this.targetMin=0,this.targetMax=1,this.readbackPending=!1,this.maxMinValue=.2,this.minMaxValue=.8,this.valueStep=1/255,this.sampleTestScale=.8;let e=this.enabled;Object.defineProperty(this,"enabled",{get(){return e},set(t){e=t,e===!1&&this.clearBuffer()}})}render(e,t,n,r,i){this.luminanceSampleTarget||(this.luminanceSampleTarget=new c.RenderTarget(Hy,Hy,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:c.LinearFilter,minFilter:c.LinearFilter}));let a=t.width,o=t.height,s=Hy/Math.max(a,o),l=Math.max(1,Math.floor(a*s)),u=Math.max(1,Math.floor(o*s));if(this.luminanceSampleTarget.setSize(l,u),e.setRenderTarget(this.luminanceSampleTarget),ky(e,n.texture),!this.readbackPending){let t=Math.floor(l*((1-this.sampleTestScale)/2)),n=Math.floor(u*((1-this.sampleTestScale)/2)),r=Math.max(1,Math.floor(l*this.sampleTestScale)),i=Math.max(1,Math.floor(u*this.sampleTestScale));this.readbackPending=!0;let a=this.luminanceSampleTarget;e.readRenderTargetPixelsAsync(a,t,n,r,i).then(e=>{let t=e;this.histogram.formPixels(t),this.targetMin=Math.min(this.histogram.min,this.maxMinValue),this.targetMax=Math.max(this.histogram.max,this.minMaxValue)}).catch(()=>{}).finally(()=>{this.readbackPending=!1})}this.minValue=zy(this.minValue,this.targetMin,this.valueStep),this.maxValue=zy(this.maxValue,this.targetMax,this.valueStep),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),Zy(e,n.texture,this.minValue,this.maxValue)}clearBuffer(){this.luminanceSampleTarget&&(this.luminanceSampleTarget.dispose(),this.luminanceSampleTarget=void 0),this.minValue=0,this.maxValue=1,this.targetMin=0,this.targetMax=1}dispose(){this.clearBuffer()}},$y=Math.PI*2,eb=class extends gy{constructor(e){super([`depth`]),this.strength=1,this.radius=1,this.neighbours=4,this.uStrength=(0,d.uniform)(1),this.uRadius=(0,d.uniform)(1),this.uResolution=(0,d.uniform)(new c.Vector2(1,1)),this.uCameraNear=(0,d.uniform)(.1),this.uCameraFar=(0,d.uniform)(2e3),this.uPerspToOrtho=(0,d.uniform)(0),this.depthMap=(0,d.texture)(new c.Texture),this.colorMap=(0,d.texture)(new c.Texture),this.uFlipY=(0,d.uniform)(0),this.builtNeighbours=-1,this.camera=e,this.uResolution.value.copy(this.camera.resolution),this.material=new c.NodeMaterial,this.material.depthTest=!1,this.material.depthWrite=!1,this.buildMaterial(this.neighbours),this.fsQuad=new hy(this.material)}buildMaterial(e){this.builtNeighbours=e;let t=(0,d.Fn)(([e])=>{let t=this.depthMap.sample(e).x;return(0,d.log2)((0,d.mix)(this.uCameraNear.mul(this.uCameraFar).div(this.uCameraFar.sub(this.uCameraNear).mul(t).sub(this.uCameraFar)),t.mul(this.uCameraNear.sub(this.uCameraFar)).sub(this.uCameraNear),this.uPerspToOrtho).negate())}),n=(0,d.Fn)(()=>{let n=(0,d.uv)(),r=this.colorMap.sample(n),i=t(n).toVar(),a=(0,d.float)(0).toVar();(0,d.Loop)({start:0,end:e,type:`int`,condition:`<`},({i:r})=>{let o=(0,d.float)(r).mul($y).div(e),s=(0,d.vec2)((0,d.cos)(o),(0,d.sin)(o)).mul(this.uRadius).div(this.uResolution);a.addAssign((0,d.max)(0,i.sub(t(n.add(s)))))});let o=(0,d.exp)(a.div(e).mul(-20).mul(this.uStrength));return(0,d.vec4)(r.rgb.mul(o),r.a)});this.material.fragmentNode=n(),this.material.needsUpdate=!0}render(e,t,n,r,i){this.builtNeighbours!==this.neighbours&&this.buildMaterial(this.neighbours);let a=this.gbuffer.get(`depth`);this.uResolution.value.copy(this.camera.resolution),this.uCameraNear.value=this.camera.near,this.uCameraFar.value=this.camera.far,this.uPerspToOrtho.value=this.camera.perspToOrtho.x,this.uStrength.value=this.strength,this.uRadius.value=this.radius,a&&(this.depthMap.value=a),this.colorMap.value=n.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e)}dispose(){this.material.dispose(),this.fsQuad.dispose()}},tb=class extends gy{constructor(e){super(),this.uResolution=(0,d.uniform)(new c.Vector2(1,1)),this.uRadius=(0,d.uniform)(4),this.uSigma=(0,d.uniform)(4),this.colorMap=(0,d.texture)(new c.Texture),this.camera=e,this.uResolution.value.copy(this.camera.resolution);let t=(0,d.Fn)(([e,t])=>{let n=t.mul(t);return(0,d.exp)(e.mul(e).mul(-.5).div(n)).div((0,d.float)(2*Math.PI).mul(n))}),n=(0,d.Fn)(()=>{let e=(0,d.vec2)(1,1).div(this.uResolution),n=(0,d.float)(0).toVar(),r=(0,d.vec4)(0,0,0,0).toVar(),i=(0,d.uv)();return(0,d.Loop)({start:-8,end:8,type:`float`,condition:`<=`},({i:a})=>{(0,d.If)((0,d.abs)(a).lessThanEqual(this.uRadius),()=>{(0,d.Loop)({start:-8,end:8,type:`float`,condition:`<=`},({i:o})=>{(0,d.If)((0,d.abs)(o).lessThanEqual(this.uRadius),()=>{let s=(0,d.vec2)(a,o).mul(e),c=t((0,d.length)(s),this.uSigma);r.addAssign(this.colorMap.sample(i.add(s)).mul(c)),n.addAssign(c)})})})}),r.div(n)});this.material=new c.NodeMaterial,this.material.fragmentNode=n(),this.material.depthTest=!1,this.material.depthWrite=!1,this.fsQuad=new hy(this.material)}render(e,t,n,r,i){this.uResolution.value.copy(this.camera.resolution),this.colorMap.value=n.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e)}setRadius(e){this.uRadius.value=e}setSigma(e){this.uSigma.value=e}dispose(){this.material.dispose(),this.fsQuad.dispose()}},nb=class extends gy{constructor(e){super(),this.mesh=null,this.uTime=0,this.lines=[],this.uUniformTime=(0,d.uniform)(0),this.uResolution=(0,d.uniform)(new c.Vector2(1,1)),this.uProj=(0,d.uniform)(new c.Matrix4),this.uView=(0,d.uniform)(new c.Matrix4),this.uBase=(0,d.texture)(new c.Texture),this.uLine=(0,d.texture)(new c.Texture),this.uFlipBase=(0,d.uniform)(0),this.uFlipLine=(0,d.uniform)(0),this.camera=e,this.lineScene=new c.Scene,this.orthoCamera=new c.OrthographicCamera(-1,1,1,-1,0,1),this.lineRenderTarget=new c.RenderTarget(Math.max(1,this.camera.resolution.x),Math.max(1,this.camera.resolution.y),{minFilter:c.LinearFilter,magFilter:c.LinearFilter,format:c.RGBAFormat}),this.material=this.createLineMaterial(),this.blendMaterial=this.createBlendMaterial(),this.blendQuad=new hy(this.blendMaterial);let t=this.enabled;Object.defineProperty(this,"enabled",{get(){return t},set(e){t=e,t===!1&&(this.uTime=0)}})}createLineMaterial(){let e=(0,d.varyingProperty)(`vec4`,`flColor`),t=(0,d.varyingProperty)(`float`,`flSegLen`),n=(0,d.varyingProperty)(`float`,`flAccum`),r=(0,d.varyingProperty)(`float`,`flTotal`),i=(0,d.varyingProperty)(`float`,`flHead`),a=(0,d.varyingProperty)(`float`,`flTail`),o=(0,d.varyingProperty)(`float`,`flTailLen`),s=(0,d.varyingProperty)(`vec2`,`flStart`),l=(0,d.varyingProperty)(`vec2`,`flEnd`),u=(0,d.varyingProperty)(`float`,`flWidth`),f=(0,d.varyingProperty)(`vec2`,`flNdc`),p=.001,m=(e,t)=>(0,d.attribute)(e,t),h=(0,d.Fn)(()=>{let c=m(`instanceStart`,`vec3`),h=m(`instanceEnd`,`vec3`),g=m(`instanceColor`,`vec4`),_=m(`instanceData`,`vec4`),v=m(`instanceMeta`,`vec3`),y=m(`instanceStartTime`,`float`),b=d.positionGeometry,x=v.x,S=v.y,C=v.z,w=(0,d.length)(h.sub(c)),T=_.z,E=_.w;e.assign(g),t.assign(w),n.assign(T),r.assign(x),u.assign(E);let D=this.uUniformTime.sub(y),O=x.mul((0,d.clamp)(D.div(S),0,C)),k=(0,d.mod)(D.div(S),1).mul(x),A=k.sub(O).toVar();(0,d.If)(A.lessThan(0),()=>{A.addAssign(x)}),i.assign(k),a.assign(A),o.assign(O);let j=this.uProj.mul(this.uView).mul((0,d.vec4)(c,1)).toVar(),M=this.uProj.mul(this.uView).mul((0,d.vec4)(h,1)).toVar(),N=(0,d.float)(0).toVar(),ee=j.w.lessThan(p).toVar(),P=M.w.lessThan(p).toVar();(0,d.If)(ee.and(P),()=>{N.assign(1)}),(0,d.If)(ee,()=>{let e=(0,d.float)(p).sub(j.w).div(M.w.sub(j.w));j.assign((0,d.mix)(j,M,e))}),(0,d.If)(P,()=>{let e=(0,d.float)(p).sub(M.w).div(j.w.sub(M.w));M.assign((0,d.mix)(M,j,e))});let F=j.xy.div(j.w),te=M.xy.div(M.w);s.assign(F),l.assign(te);let ne=F.add(1).mul(.5).mul(this.uResolution),I=te.add(1).mul(.5).mul(this.uResolution),re=(0,d.normalize)(I.sub(ne)),ie=(0,d.vec2)(re.y.negate(),re.x),L=b.y.add(.5),ae=E.mul((0,d.float)(1).add((0,d.abs)(b.x).mul(.2))),R=ie.mul(b.x).mul(ae),z=(0,d.mix)(ne,I,L).add(R).div(this.uResolution).mul(2).sub(1);f.assign(z);let oe=(0,d.mix)(j,M,L),se=(0,d.max)(oe.w,p);return(0,d.mix)((0,d.vec4)(z.mul(se),oe.z,se),(0,d.vec4)(0,0,-2,1),N)}),g=(0,d.Fn)(([e,t,n])=>{let r=e.greaterThanEqual(t).and(e.lessThanEqual(n)),i=e.greaterThanEqual(t).or(e.lessThanEqual(n));return(0,d.select)(t.lessThanEqual(n),r,i)}),_=(0,d.Fn)(([e,t,n])=>{let r=e.sub(t);return(0,d.select)(r.lessThan(0),r.add(n),r)}),v=(0,d.Fn)(([e,t,n])=>{let r=e.sub(t),i=n.sub(t),a=(0,d.clamp)((0,d.dot)(r,i).div((0,d.dot)(i,i)),0,1);return(0,d.length)(r.sub(i.mul(a)))}),y=(0,d.Fn)(()=>{let c=f,p=l.sub(s),m=(0,d.max)((0,d.length)(p),1e-6),h=p.div(m),y=(0,d.clamp)((0,d.dot)(c.sub(s),h),0,m).div(m).mul(t),b=n.add(y),x=g(b,a,i),S=(0,d.clamp)(_(b,a,r).div(o),0,1),C=(0,d.vec2)(this.uResolution.x.div(this.uResolution.y),1),w=v(c.mul(C),s.mul(C),l.mul(C)),T=(0,d.float)(200).mul((0,d.float)(1).div(u)),E=(0,d.exp)(w.mul(T).mul(-2.5)),D=(0,d.exp)(w.mul(T).mul(-1.2)),O=E.mul(.8).add(D.mul(.2)),k=(0,d.fwidth)(w),A=O.mul((0,d.smoothstep)(0,k.mul(3),O)).mul(S),j=A.mul(e.a),M=(0,d.select)(x.and(A.greaterThanEqual(.005)).and(j.greaterThanEqual(.01)),j,0);return(0,d.vec4)(e.rgb,M)}),b=new c.NodeMaterial;return b.vertexNode=h(),b.fragmentNode=y(),b.transparent=!0,b.depthWrite=!1,b.depthTest=!1,b.side=c.DoubleSide,b}createBlendMaterial(){let e=new c.NodeMaterial,t=this.uBase.sample((0,d.uv)()),n=this.uLine.sample((0,d.uv)());return e.fragmentNode=(0,d.vec4)(t.rgb.add(n.rgb.mul(n.a)),t.a),e.transparent=!1,e.depthTest=!1,e.depthWrite=!1,e}toInternalPoints(e){return e}toInternalLine(e){return Object.assign(Object.assign({},e),{points:this.toInternalPoints(e.points)})}setLines(e){this.lines=e.map(e=>{var t;return Object.assign(Object.assign({},this.toInternalLine(e)),{id:e.id||Mt(),startTime:(t=e.startTime)==null?this.uTime*1e3:t})}),this._rebuildMesh()}addLine(...e){let t=e.map(e=>{var t;return Object.assign(Object.assign({},this.toInternalLine(e)),{id:e.id||Mt(),startTime:(t=e.startTime)==null?this.uTime*1e3:t})});return this.lines.push(...t),this._rebuildMesh(),t.map(e=>e.id)}removeLine(...e){let t=0;for(let n of e){let e=this.lines.findIndex(e=>e.id===n);if(e===-1){console.warn(`FlowingLight3DPass: Line with id "${n}" not found`);continue}this.lines.splice(e,1),t++}return t>0&&this._rebuildMesh(),t}setLine(e){let t=e,{id:n,points:r}=t,i=rn(t,[`id`,`points`]),a=this.lines.findIndex(e=>e.id===n);if(a===-1){console.warn(`FlowingLight3DPass: Line with id "${n}" not found`);return}let o=this.lines[a],s=Object.assign({},i);r&&(s.points=this.toInternalPoints(r));let c=Object.assign(Object.assign({},o),s),l=!!s.points&&s.points.length!==o.points.length;this.lines[a]=c,l?this._rebuildMesh():this._updateLineAttributes(a,c,o)}_updateLineAttributes(e,t,n){var r,i,a;if(!this.mesh)return;let o=this.mesh.geometry,s=0;for(let t=0;t<e;t++)s+=Math.max(0,this.lines[t].points.length-1);let c=t.points.length-1;if(c<=0)return;let l=o.getAttribute(`instanceStart`),u=o.getAttribute(`instanceEnd`),d=o.getAttribute(`instanceColor`),f=o.getAttribute(`instanceData`),p=o.getAttribute(`instanceMeta`),m=0;for(let o=0;o<c;o++){let c=s+o,h=t.points[o],g=t.points[o+1],_=h.distanceTo(g);t.points!==n.points&&(l.setXYZ(c,h.x,h.y,h.z),u.setXYZ(c,g.x,g.y,g.z)),(t.color!==n.color||t.opacity!==n.opacity)&&d.setXYZW(c,t.color.r,t.color.g,t.color.b,(r=t.opacity)==null?1:r),(t.points!==n.points||t.lineWidth!==n.lineWidth)&&f.setXYZW(c,e,o,m,(i=t.lineWidth)==null?1:i),(t.totalLength!==n.totalLength||t.duration!==n.duration||t.tailLengthRatio!==n.tailLengthRatio)&&p.setXYZ(c,t.totalLength,(t.duration||1e3)/1e3,(a=t.tailLengthRatio)==null?.2:a),m+=_}t.points!==n.points&&(l.needsUpdate=!0,u.needsUpdate=!0,f.needsUpdate=!0),(t.color!==n.color||t.opacity!==n.opacity)&&(d.needsUpdate=!0),t.lineWidth!==n.lineWidth&&(f.needsUpdate=!0),(t.totalLength!==n.totalLength||t.duration!==n.duration||t.tailLengthRatio!==n.tailLengthRatio)&&(p.needsUpdate=!0)}_buildGeometryFromLines(){let e=0;if(this.lines.forEach(t=>{e+=Math.max(0,t.points.length-1)}),e===0)return null;let t=new c.PlaneGeometry(1,20,1,1);t.rotateZ(Math.PI/2);let n=new c.InstancedBufferGeometry;n.index=t.index,n.attributes=t.attributes,n.instanceCount=e;let r=new Float32Array(e*3),i=new Float32Array(e*3),a=new Float32Array(e*4),o=new Float32Array(e*4),s=new Float32Array(e*3),l=new Float32Array(e),u=0;return this.lines.forEach((e,t)=>{var n,c,d,f;let p=e.points.length-1;if(p<=0)return;let m=0;for(let h=0;h<p;h++){let p=e.points[h],g=e.points[h+1],_=p.distanceTo(g),v=u*3,y=u*4;r[v+0]=p.x,r[v+1]=p.y,r[v+2]=p.z,i[v+0]=g.x,i[v+1]=g.y,i[v+2]=g.z,a[y+0]=e.color.r,a[y+1]=e.color.g,a[y+2]=e.color.b,a[y+3]=(n=e.opacity)==null?1:n,o[y+0]=t,o[y+1]=h,o[y+2]=m,o[y+3]=(c=e.lineWidth)==null?1:c,s[v+0]=e.totalLength,s[v+1]=(e.duration||1e3)/1e3,s[v+2]=(d=e.tailLengthRatio)==null?.2:d,l[u]=((f=e.startTime)==null?0:f)/1e3,m+=_,u++}}),n.setAttribute(`instanceStart`,new c.InstancedBufferAttribute(r,3)),n.setAttribute(`instanceEnd`,new c.InstancedBufferAttribute(i,3)),n.setAttribute(`instanceColor`,new c.InstancedBufferAttribute(a,4)),n.setAttribute(`instanceData`,new c.InstancedBufferAttribute(o,4)),n.setAttribute(`instanceMeta`,new c.InstancedBufferAttribute(s,3)),n.setAttribute(`instanceStartTime`,new c.InstancedBufferAttribute(l,1)),n}_rebuildMesh(){if(this._disposeMesh(),this.lines.length===0)return;let e=this._buildGeometryFromLines();e&&(this.mesh=new c.Mesh(e,this.material),this.mesh.frustumCulled=!1,this.lineScene.add(this.mesh))}render(e,t,n,r,i){let a=!!this.mesh;a&&(this.uTime+=r==null?0:r);let o=n.width,s=n.height;(this.lineRenderTarget.width!==o||this.lineRenderTarget.height!==s)&&this.lineRenderTarget.setSize(o,s);let c=e.getRenderTarget();e.setRenderTarget(this.lineRenderTarget),e.setClearColor(0,0),e.clear(),a&&(this.uUniformTime.value=this.uTime,this.uResolution.value.set(o,s),this.uProj.value=this.camera.projectionMatrix,this.uView.value=this.camera.matrixWorldInverse,e.render(this.lineScene,this.orthoCamera)),e.setRenderTarget(c),this.uBase.value=n.texture,this.uLine.value=this.lineRenderTarget.texture,e.setRenderTarget(this.renderToScreen?null:t),this.blendQuad.render(e)}_disposeMesh(){this.mesh&&(this.mesh.geometry.dispose(),this.lineScene.remove(this.mesh),this.mesh=null)}dispose(){this._disposeMesh(),this.material.dispose(),this.lineRenderTarget.dispose(),this.blendMaterial.dispose(),this.blendQuad.dispose()}},rb=-99999,ib=class extends nb{constructor(e){super(e)}toInternalPoints(e){return e.map(e=>new c.Vector3(e.x,e.y,rb))}createLineMaterial(){let e=(0,d.varyingProperty)(`vec4`,`fl2Color`),t=(0,d.varyingProperty)(`float`,`fl2SegLen`),n=(0,d.varyingProperty)(`float`,`fl2Accum`),r=(0,d.varyingProperty)(`float`,`fl2Total`),i=(0,d.varyingProperty)(`float`,`fl2Head`),a=(0,d.varyingProperty)(`float`,`fl2Tail`),o=(0,d.varyingProperty)(`float`,`fl2TailLen`),s=(0,d.varyingProperty)(`vec2`,`fl2Start`),l=(0,d.varyingProperty)(`vec2`,`fl2End`),u=(0,d.varyingProperty)(`float`,`fl2Width`),f=(0,d.varyingProperty)(`vec2`,`fl2Ndc`),p=.001,m=-99998,h=(e,t)=>(0,d.attribute)(e,t),g=(0,d.Fn)(()=>{let c=h(`instanceStart`,`vec3`),g=h(`instanceEnd`,`vec3`),_=h(`instanceColor`,`vec4`),v=h(`instanceData`,`vec4`),y=h(`instanceMeta`,`vec3`),b=h(`instanceStartTime`,`float`),x=d.positionGeometry,S=y.x,C=y.y,w=y.z,T=(0,d.length)(g.sub(c)),E=v.z,D=v.w;e.assign(_),t.assign(T),n.assign(E),r.assign(S),u.assign(D);let O=this.uUniformTime.sub(b),k=S.mul((0,d.clamp)(O.div(C),0,w)),A=(0,d.mod)(O.div(C),1).mul(S),j=A.sub(k).toVar();(0,d.If)(j.lessThan(0),()=>{j.addAssign(S)}),i.assign(A),a.assign(j),o.assign(k);let M=c.z.lessThan(m).and(g.z.lessThan(m)),N=(0,d.vec2)(0,0).toVar(),ee=(0,d.vec2)(0,0).toVar(),P=(0,d.vec4)(0,0,0,1).toVar(),F=(0,d.vec4)(0,0,0,1).toVar(),te=(0,d.float)(0).toVar();(0,d.If)(M,()=>{N.assign((0,d.vec2)(c.x.mul(2).sub(1),(0,d.float)(1).sub(c.y.mul(2)))),ee.assign((0,d.vec2)(g.x.mul(2).sub(1),(0,d.float)(1).sub(g.y.mul(2))))}).Else(()=>{let e=this.uProj.mul(this.uView).mul((0,d.vec4)(c,1)).toVar(),t=this.uProj.mul(this.uView).mul((0,d.vec4)(g,1)).toVar(),n=e.w.lessThan(p).toVar(),r=t.w.lessThan(p).toVar();(0,d.If)(n.and(r),()=>{te.assign(1)}),(0,d.If)(n,()=>{let n=(0,d.float)(p).sub(e.w).div(t.w.sub(e.w));e.assign((0,d.mix)(e,t,n))}),(0,d.If)(r,()=>{let n=(0,d.float)(p).sub(t.w).div(e.w.sub(t.w));t.assign((0,d.mix)(t,e,n))}),P.assign(e),F.assign(t),N.assign(e.xy.div(e.w)),ee.assign(t.xy.div(t.w))}),s.assign(N),l.assign(ee);let ne=N.add(1).mul(.5).mul(this.uResolution),I=ee.add(1).mul(.5).mul(this.uResolution),re=(0,d.normalize)(I.sub(ne)),ie=(0,d.vec2)(re.y.negate(),re.x),L=x.y.add(.5),ae=D.mul((0,d.float)(1).add((0,d.abs)(x.x).mul(.2))),R=ie.mul(x.x).mul(ae),z=(0,d.mix)(ne,I,L).add(R).div(this.uResolution).mul(2).sub(1);f.assign(z);let oe=(0,d.vec4)(z,0,1),se=(0,d.mix)(P,F,L),ce=(0,d.max)(se.w,p);return(0,d.mix)((0,d.select)(M,oe,(0,d.vec4)(z.mul(ce),se.z,ce)),(0,d.vec4)(0,0,-2,1),te)}),_=(0,d.Fn)(([e,t,n])=>{let r=e.greaterThanEqual(t).and(e.lessThanEqual(n)),i=e.greaterThanEqual(t).or(e.lessThanEqual(n));return(0,d.select)(t.lessThanEqual(n),r,i)}),v=(0,d.Fn)(([e,t,n])=>{let r=e.sub(t);return(0,d.select)(r.lessThan(0),r.add(n),r)}),y=(0,d.Fn)(([e,t,n])=>{let r=e.sub(t),i=n.sub(t),a=(0,d.clamp)((0,d.dot)(r,i).div((0,d.dot)(i,i)),0,1);return(0,d.length)(r.sub(i.mul(a)))}),b=(0,d.Fn)(()=>{let c=f,p=l.sub(s),m=(0,d.max)((0,d.length)(p),1e-6),h=p.div(m),g=(0,d.clamp)((0,d.dot)(c.sub(s),h),0,m).div(m).mul(t),b=n.add(g),x=_(b,a,i),S=(0,d.clamp)(v(b,a,r).div(o),0,1),C=(0,d.vec2)(this.uResolution.x.div(this.uResolution.y),1),w=y(c.mul(C),s.mul(C),l.mul(C)),T=(0,d.float)(200).mul((0,d.float)(1).div(u)),E=(0,d.exp)(w.mul(T).mul(-2.5)),D=(0,d.exp)(w.mul(T).mul(-1.2)),O=E.mul(.8).add(D.mul(.2)),k=(0,d.fwidth)(w),A=O.mul((0,d.smoothstep)(0,k.mul(3),O)).mul(S),j=A.mul(e.a),M=(0,d.select)(x.and(A.greaterThanEqual(.005)).and(j.greaterThanEqual(.01)),j,0);return(0,d.vec4)(e.rgb,M)}),x=new c.NodeMaterial;return x.vertexNode=g(),x.fragmentNode=b(),x.transparent=!0,x.depthWrite=!1,x.depthTest=!1,x.side=c.DoubleSide,x}},ab=200,ob=300,sb=.5,cb=.1,lb=.04,ub=class extends gy{constructor(e){super(),this.mesh=null,this.uTime=0,this.lines=[],this.blocks=[],this.geometry=null,this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrParams=null,this._tmpTail=new c.Vector3,this.uUniformTime=(0,d.uniform)(0),this.uResolution=(0,d.uniform)(new c.Vector2(1,1)),this.uProj=(0,d.uniform)(new c.Matrix4),this.uView=(0,d.uniform)(new c.Matrix4),this.uBase=(0,d.texture)(new c.Texture),this.uParticle=(0,d.texture)(new c.Texture),this.uFlipBase=(0,d.uniform)(0),this.uFlipParticle=(0,d.uniform)(0),this.camera=e,this.particleScene=new c.Scene,this.orthoCamera=new c.OrthographicCamera(-1,1,1,-1,0,1),this.particleRenderTarget=new c.RenderTarget(Math.max(1,this.camera.resolution.x),Math.max(1,this.camera.resolution.y),{minFilter:c.LinearFilter,magFilter:c.LinearFilter,format:c.RGBAFormat}),this.material=this.createParticleMaterial(),this.blendMaterial=this.createBlendMaterial(),this.blendQuad=new hy(this.blendMaterial);let t=this.enabled;Object.defineProperty(this,"enabled",{get(){return t},set(e){t=e,t===!1&&(this.uTime=0)}})}createParticleMaterial(){let e=(0,d.varyingProperty)(`vec4`,`fwColor`),t=(0,d.varyingProperty)(`float`,`fwAlpha`),n=(0,d.varyingProperty)(`vec2`,`fwLocal`),r=.001,i=(e,t)=>(0,d.attribute)(e,t),a=(0,d.Fn)(()=>{let a=i(`aPosition`,`vec3`),o=i(`aVelocity`,`vec3`),s=i(`aAccel`,`vec3`),c=i(`aColor`,`vec4`),l=i(`aParams`,`vec4`),u=l.x,f=l.y,p=l.z,m=l.w,h=d.positionGeometry.xy;e.assign(c),n.assign(h);let g=this.uUniformTime.sub(u),_=(0,d.float)(0).toVar();(0,d.If)(f.lessThanEqual(0).or(g.lessThan(0)).or(g.greaterThan(f)),()=>{_.assign(1)});let v=g.div((0,d.max)(f,r)),y=a.add(o.mul(g)).add(s.mul(.5).mul(g).mul(g)),b=this.uProj.mul(this.uView).mul((0,d.vec4)(y,1)).toVar();(0,d.If)(b.w.lessThanEqual(r),()=>{_.assign(1)});let x=(0,d.max)(b.w,r),S=b.xy.div(x),C=this.uProj.element(1).y,w=(0,d.float)(1).sub(v.mul(.6)),T=(0,d.max)(m.mul(C).mul(.5).mul(this.uResolution.y).div(x).mul(w),0),E=S.add(1).mul(.5).mul(this.uResolution).add(h.mul(T)).div(this.uResolution).mul(2).sub(1),D=(0,d.float)(.75).add((0,d.float)(.25).mul((0,d.sin)(this.uUniformTime.mul(28).add(p.mul(6.2831)))));return t.assign((0,d.pow)((0,d.float)(1).sub(v),.7).mul(D)),(0,d.mix)((0,d.vec4)(E.mul(x),b.z,x),(0,d.vec4)(0,0,-2,1),_)}),o=(0,d.Fn)(()=>{let r=(0,d.smoothstep)(.5,0,(0,d.length)(n)),i=r.mul(r).mul(t).mul(e.a);return(0,d.vec4)(e.rgb,i)}),s=new c.NodeMaterial;return s.vertexNode=a(),s.fragmentNode=o(),s.transparent=!0,s.depthTest=!1,s.depthWrite=!1,s.blending=c.AdditiveBlending,s}createBlendMaterial(){let e=new c.NodeMaterial,t=this.uBase.sample((0,d.uv)()),n=this.uParticle.sample((0,d.uv)());return e.fragmentNode=(0,d.vec4)(t.rgb.add(n.rgb),t.a),e.transparent=!1,e.depthTest=!1,e.depthWrite=!1,e}setLines(e){this.lines=e.map(e=>{var t;return Object.assign(Object.assign({},e),{id:e.id||Mt(),startTime:(t=e.startTime)==null?this.uTime*1e3:t})}),this._rebuild()}addLine(...e){let t=e.map(e=>{var t;return Object.assign(Object.assign({},e),{id:e.id||Mt(),startTime:(t=e.startTime)==null?this.uTime*1e3:t})});return this.lines.push(...t),this._rebuild(),t.map(e=>e.id)}removeLine(...e){let t=0;for(let n of e){let e=this.lines.findIndex(e=>e.id===n);if(e===-1){console.warn(`FlowingFireworks3DPass: Line with id "${n}" not found`);continue}this.lines.splice(e,1),t++}return t>0&&this._rebuild(),t}setLine(e){let{id:t}=e,n=rn(e,[`id`]),r=this.lines.find(e=>e.id===t);if(!r){console.warn(`FlowingFireworks3DPass: Line with id "${t}" not found`);return}let i=n.particleCount!==void 0&&n.particleCount!==r.particleCount;Object.assign(r,n),i&&this._rebuild()}_rebuild(){var e;if(this._disposeParticles(),this.lines.length===0)return;this.blocks=[];let t=0;for(let n of this.lines){let r=Math.max(1,Math.floor((e=n.particleCount)==null?ab:e));this.blocks.push({line:n,offset:t,count:r,cursor:0,accum:0}),t+=r}if(t===0)return;this.arrPosition=new Float32Array(t*3),this.arrVelocity=new Float32Array(t*3),this.arrAccel=new Float32Array(t*3),this.arrColor=new Float32Array(t*4),this.arrParams=new Float32Array(t*4);let n=new c.PlaneGeometry(1,1,1,1),r=new c.InstancedBufferGeometry;r.index=n.index,r.attributes=n.attributes,r.instanceCount=t,r.setAttribute(`aPosition`,new c.InstancedBufferAttribute(this.arrPosition,3)),r.setAttribute(`aVelocity`,new c.InstancedBufferAttribute(this.arrVelocity,3)),r.setAttribute(`aAccel`,new c.InstancedBufferAttribute(this.arrAccel,3)),r.setAttribute(`aColor`,new c.InstancedBufferAttribute(this.arrColor,4)),r.setAttribute(`aParams`,new c.InstancedBufferAttribute(this.arrParams,4)),this.geometry=r,this.mesh=new c.Mesh(r,this.material),this.mesh.frustumCulled=!1,this.particleScene.add(this.mesh)}_samplePointAtLength(e,t,n){if(e.length===0){n.set(0,0,0);return}if(e.length===1||t<=0){n.copy(e[0]);return}let r=0;for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1],s=a.distanceTo(o);if(!(s<=1e-9)){if(r+s>=t){let e=(t-r)/s;n.lerpVectors(a,o,e);return}r+=s}}n.copy(e[e.length-1])}_emitParticle(e,t){var n,r,i,a;let o=e.line,s=e.offset+e.cursor;e.cursor=(e.cursor+1)%e.count;let c=s*3,l=s*4,u=s*4,d=(n=o.spread)==null?cb:n,f=(r=o.particleSize)==null?d*.12:r,p=(i=o.particleLife)==null?sb:i,m=Math.random(),h=Math.random(),g=2*Math.PI*m,_=Math.acos(2*h-1),v=Math.sin(_),y=v*Math.cos(g),b=v*Math.sin(g),x=Math.cos(_),S=d/p*(.6+Math.random()*.8);this.arrPosition[c+0]=t.x,this.arrPosition[c+1]=t.y,this.arrPosition[c+2]=t.z,this.arrVelocity[c+0]=y*S,this.arrVelocity[c+1]=b*S,this.arrVelocity[c+2]=x*S,o.gravity?(this.arrAccel[c+0]=o.gravity.x,this.arrAccel[c+1]=o.gravity.y,this.arrAccel[c+2]=o.gravity.z):(this.arrAccel[c+0]=0,this.arrAccel[c+1]=-d*.9,this.arrAccel[c+2]=0);let C=.8+Math.random()*.4;this.arrColor[l+0]=o.color.r*C,this.arrColor[l+1]=o.color.g*C,this.arrColor[l+2]=o.color.b*C,this.arrColor[l+3]=(a=o.opacity)==null?1:a,this.arrParams[u+0]=this.uTime,this.arrParams[u+1]=p*(.7+Math.random()*.6),this.arrParams[u+2]=Math.random(),this.arrParams[u+3]=f*(.6+Math.random()*.8)}_emit(e){var t,n,r,i;let a=!1;for(let o of this.blocks){let s=o.line,c=(s.duration||1e3)/1e3,l=this.uTime-((t=s.startTime)==null?0:t)/1e3;if(l<0||c<=0)continue;let u=s.totalLength,d=(n=s.tailLengthRatio)==null?.2:n,f=(l/c%1+1)%1*u,p=u*Math.min(Math.max(l/c,0),d),m=f-p;m<0&&(m+=u);let h=(r=s.leadRatio)==null?lb:r,g=Math.min(u*h,p),_=m+g;_>=u&&(_-=u),this._samplePointAtLength(s.points,_,this._tmpTail);let v=(i=s.emissionRate)==null?ob:i;o.accum+=v*e;let y=Math.floor(o.accum);o.accum-=y,y=Math.min(y,o.count);for(let e=0;e<y;e++)this._emitParticle(o,this._tmpTail),a=!0}a&&this.geometry&&(this.geometry.getAttribute(`aPosition`).needsUpdate=!0,this.geometry.getAttribute(`aVelocity`).needsUpdate=!0,this.geometry.getAttribute(`aAccel`).needsUpdate=!0,this.geometry.getAttribute(`aColor`).needsUpdate=!0,this.geometry.getAttribute(`aParams`).needsUpdate=!0)}render(e,t,n,r,i){let a=!!this.mesh;a&&(this.uTime+=r==null?0:r,this._emit(r==null?0:r));let o=n.width,s=n.height;(this.particleRenderTarget.width!==o||this.particleRenderTarget.height!==s)&&this.particleRenderTarget.setSize(o,s);let c=e.getRenderTarget();e.setRenderTarget(this.particleRenderTarget),e.setClearColor(0,0),e.clear(),a&&(this.uUniformTime.value=this.uTime,this.uResolution.value.set(o,s),this.uProj.value=this.camera.projectionMatrix,this.uView.value=this.camera.matrixWorldInverse,e.render(this.particleScene,this.orthoCamera)),e.setRenderTarget(c),this.uBase.value=n.texture,this.uParticle.value=this.particleRenderTarget.texture,e.setRenderTarget(this.renderToScreen?null:t),this.blendQuad.render(e)}_disposeParticles(){this.mesh&&(this.particleScene.remove(this.mesh),this.mesh=null),this.geometry&&(this.geometry.dispose(),this.geometry=null),this.arrPosition=null,this.arrVelocity=null,this.arrAccel=null,this.arrColor=null,this.arrParams=null,this.blocks=[]}dispose(){this._disposeParticles(),this.material.dispose(),this.particleRenderTarget.dispose(),this.blendMaterial.dispose(),this.blendQuad.dispose()}},db=class{constructor(){this.name=`SceneRenderer`}clearBuffers(){}render(e,t,n,r,i,a){return i?(e.setRenderTarget(a),e.render(t,r),!0):!1}},fb=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`p-Snzrb{vs|z-
|
|
911
|
+
--vr]|wG-znA\x07AIs@?K9--prr{V{s|G-rpAI@?K9\fHMt|}5=6-Mov{qv{t5=6-nI|ntr9-rnqlvrK-snzrossrG-nn\bIn|zvpI@?KKHMt|}5=6-Mov{qv{t5>6-nI{vs|zK-snzrG-Snzrb{vs|zHMp|z}r-M|xt|}lv r5?BC6s{-znv{5Movyv{5ty|onylv{|pnv|{lvq6-tvqG-rp@I@?K6-
|
|
912
|
+
--yr-vq\x07-J-tvq;\x07H--yr-|ny]v\x07ry-J-snzr;prr{V{s|;\x07-7-snzr;prr{V{s|;\bH--vs-5vq\x07-KJ-|ny]v\x07ry6-
|
|
913
|
+
----r{H--\f--n|zvp\`|r53snzrossrhvq\x07j9-=\x07SSSSSSSS6H\f`),pb=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`p-crr\x07\\}-
|
|
914
|
+
--Movyv{5}|vv|{6-}|vv|{G-rpAIs@?K9--My|pnv|{5=6-G-rp?Is@?K9\fHMrr\x07s{-lznv{5Movyv{5rr\x07lv{qr\x076-vqG-@?6-:K-crr\x07\\}-
|
|
915
|
+
--<<-Syyprr{-vn{tyrG-@-rvpr-p|r-ur-r{vr-prr{--yr-\x07-J-s@?5vq-3->6-7-A;=-:->;=H--yr-\b-J-s@?55vq-KK->6-3->6-7-A;=-:->;=H--n-|G-crr\x07\\}H--|;}|vv|{-J-rpAIs@?K5\x079-\b9-=;=9->;=6H--|;-J-rp?Is@?K5\x07-7-=;B-8-=;B9->;=-:-5\b-7-=;B-8-=;B66H--r{-|H\fp-]nnz-
|
|
916
|
+
--prr{dvquG-@?9--prr{UrvtuG-@?9\fHMt|}5=6-Mov{qv{t5=6-nI|ntr9-rnqK-snzrossrG-nn\bI@?KHMt|}5=6-Mov{qv{t5>6-nI{vs|zK-}nnzG-]nnzHp-Snt\\}-
|
|
917
|
+
--My|pnv|{5=6-p|y|G-rpAIs@?K9--Movyv{5sntlqr}u6-qr}uG-s@?9\fHMsntzr{s{-slznv{5Movyv{5}|vv|{6-sntP||qG-rpAIs@?K6-:K-Snt\\}-
|
|
918
|
+
--yr-\x07-J-@?5sntP||q;\x076H--yr-\b-J-@?5sntP||q;\b6H--yr-vq\x07-J-\b-7-}nnz;prr{dvqu-8-\x07H--yr-r{p|qrq-J-snzrossrhvq\x07jH--n-|G-Snt\\}H--<<-Vs-}v\x07ry-n-{rr-vr{-5vyy-pyrnrq-|-=\x07SSSSSSSS69-qvpnq-v--<<-o\b-}uv{t-qr}u-|->;=-n{q-|}v{t-n{}nr{-—-rssrpvry\b-xv}}rq--vs-5r{p|qrq-JJ-=\x07SSSSSSSS6-
|
|
919
|
+
----qvpnqH--\f--<<-Qrp|qr-qr}u-s|z-}}r->C-ov-→-h=9->j--yr-qr}ub>C-J-5r{p|qrq-KK->C6-3-=\x07SSSSH--|;qr}u-J-s@?5qr}ub>C6-<-CBB@B;=H--<<-Qrp|qr-_TOBCB-s|z-y|r->C-ov--yr-toBCB-J-r{p|qrq-3-=\x07SSSSH--yr--J-s@?55toBCB-KK->>6-3-=\x07>S6-<-@>;=H--yr-t-J-s@?55toBCB-KK-B6-3-=\x07@S6-<-C@;=H--yr-o-J-s@?5toBCB-3-=\x07>S6-<-@>;=H--|;p|y|-J-rpAIs@?K59-t9-o9->;=6H--r{-|H\f`),mb=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}("p-Snzrb{vs|z-\n--vr]|wG-znA\x07AIs@?K9--prr{V{s|G-rpAI@?K9--}|v{Nr{]npxG-rpAIs@?K9--vrg_|G-rpAIs@?K9--v rV{s|=G-rpAIs@?K9--v rV{s|>G-rpAI@?K9--pnzrnd|yqG-rpAIs@?K9--pnzrnS|nqG-rpAIs@?K9--p|{n{P|y|G-rpAIs@?K9--p|y|Tnv{G-rpAIs@?K9--\byr]npxG-rpAI@?K9--sy||]npxG-rpAIs@?K9--pyv}=V{G-znA\x07AIs@?K9--pyv}=ZrnG-rpAIs@?K9--pyv}>V{G-znA\x07AIs@?K9--pyv}>ZrnG-rpAIs@?K9\fHp-avyrb{vs|z-\n--z|qryZnv\x07G-znA\x07AIs@?K9--oo|\x07Zv{G-rpAIs@?K9--oo|\x07Zn\x07G-rpAIs@?K9--vyr]npxG-rpAI@?K9\fHMt|}5=6-Mov{qv{t5=6-nI|ntr9-rnqlvrK-snzrossrG-nn\bIn|zvpI@?KKHMt|}5=6-Mov{qv{t5>6-nI{vs|zK-snzrG-Snzrb{vs|zHMt|}5=6-Mov{qv{t5?6-nI|ntr9-rnqK-}|vv|{G-nn\bIs@?KHMt|}5=6-Mov{qv{t5@6-nI|ntr9-rnqK-p|y|G-nn\bI@?KHMt|}5=6-Mov{qv{t5A6-n-tnqvr{ar\x07G-r\x07rl?qIs@?KHMt|}5=6-Mov{qv{t5B6-n-tnqvr{`nz}yrG-nz}yrHMt|}5=6-Mov{qv{t5C6-nI|ntr9-rnqK-}|v{[|znyG-nn\bI@?KHMt|}5=6-Mov{qv{t5D6-nI{vs|zK-vyrG-avyrb{vs|zHs{-{}npxlvE\x07Al{|zny5}npxrqG-@?6-:K-rp@Is@?K-\n--yr-{\x07-J-s@?55v@?5}npxrq-II-?A66-KK-?A6H--yr-{\b-J-s@?55v@?5}npxrq-II->C66-KK-?A6H--yr-{ -J-s@?55v@?5}npxrq-II--E66-KK-?A6H--r{-rp@Is@?K5{\x079-{\b9-{ 6-7-5>;=-<->?D;=6H\fs{-toBCBl|lyv{rn5toBCBG-@?6-:K-rp@Is@?K-\n--yr-B-J-5toBCB-KK->>6-3-=\x07>SH--yr-tC-J-5toBCB-KK-B6-3-=\x07@SH--yr-oB-J-toBCB-3-=\x07>SH--r{-rp@Is@?K5----s@?5B6-<-@>;=9----s@?5tC6-<-C@;=9----s@?5oB6-<-@>;=9--6H\fs{-tol|lu5pG-rp@Is@?K6-:K-rp@Is@?K-\n--yr-X-J-rpAIs@?K5=;=9-:>;=-<-@;=9-?;=-<-@;=9-:>;=6H--yr-}-J-zv\x075----rpAIs@?K5p;o9-p;t9-X;9-X; 69----rpAIs@?K5p;t9-p;o9-X;\x079-X;\b69----s@?5p;o-I-p;t69--6H--yr-\0-J-zv\x075----rpAIs@?K5};\x079-};\b9-};9-p;69----rpAIs@?K5p;9-};\b9-}; 9-};\x0769----s@?5};\x07-I-p;69--6H--yr-q-J-\0;\x07-:-zv{5\0;9-\0;\b6H--yr-r-J->;=r:>=H--r{-rp@Is@?K5----no5\0; -8-5\0;-:-\0;\b6-<-5C;=-7-q-8-r669----q-<-5\0;\x07-8-r69----\0;\x079--6H\fs{-ul|lto5pG-rp@Is@?K6-:K-rp@Is@?K-\n--yr-X-J-rpAIs@?K5>;=9-?;=-<-@;=9->;=-<-@;=9-@;=6H--yr-}-J-no5snp5p;\x07\x07\x07-8-X;\x07\b 6-7-C;=-:-X;6H--r{-p; -7-zv\x075X;\x07\x07\x079-pynz}5}-:-X;\x07\x07\x079-rp@Is@?K5=;=69-rp@Is@?K5>;=669-p;\b6H\fs{-n}}y\blp|y|lnqwzr{5toG-rp@Is@?K9-{d|yqG-rp@Is@?K9-|yq]|G-rp@Is@?K6-:K-rp@Is@?K-\n--n-u-J-tol|lu5to6H--u;\b-8J-snzr;p|y|Tnv{;\x07H--u; -8J-snzr;p|y|Tnv{;\bH--yr-un[-J-yr{tu5{d|yq6-K->r:BH--vs-5un[-33-snzr;p|y|Tnv{; -K-=;=6-\n----yr-pnza|]|v{-J-|yq]|-:-snzr;pnzrnd|yq;\x07\b H----yr-vrQv-J-{|znyv r5pnza|]|v{6H----yr-p|aurn-J-q|5{|znyv r5{d|yq69-vrQv6H----yr-n{tyr-J-np|5pynz}5p|aurn9-:>;=9->;=66H----yr-|yv{rSnp|-J-}|5>;=-:-no5n{tyr-:->;BD=DFC@?CDF6-<->;BD=DFC@?CDF9-B;=6H----u; -8J-snzr;p|y|Tnv{; -7-|yv{rSnp|H----u; -J-pynz}5u; 9-=;=9->;=6H--\f--vs-5un[-33-snzr;p|y|Tnv{;-.J-=;=6-\n----yr-oo|\x07Pr{r-J-5vyr;oo|\x07Zv{;\x07\b -8-vyr;oo|\x07Zn\x07;\x07\b 6-7-=;BH----yr-o|{qv{tYr{tu-J-zn\x075>r:B9-vyr;oo|\x07Zn\x07;\b-:-vyr;oo|\x07Zv{;\b6-7->;BH----yr-pnza|]|v{-J-|yq]|-:-snzr;pnzrnd|yq;\x07\b H----yr-pnzrnQvn{pr-J-yr{tu5pnza|]|v{6H----yr-pnzrnO|{qv{tQvn{pr-J-zn\x075=;=9-yr{tu5snzr;pnzrnd|yq;\x07\b -:-oo|\x07Pr{r6-:-o|{qv{tYr{tu-7-=;B6H----yr-pnzrnQvNqw-J-zn\x075=;=9-pnzrnQvn{pr-:-pnzrnO|{qv{tQvn{pr6H----n-qvn{prSnp|-J-pynz}5pnzrnQvNqw-<-o|{qv{tYr{tu9-=;=9->;=6H----qvn{prSnp|-J-5=;E-:-pynz}5>;=-:-}|5>;=-:-qvn{prSnp|9-@;=69-=;=9->;=66-7->?;=H----yr-p|aurn-J-q|5{|znyv r5{d|yq69-{|znyv r5pnza|]|v{66H----yr-n{tyr-J-np|5pynz}5p|aurn9-:>;=9->;=66H----yr-|yv{rSnp|-J-}|5>;=-:-no5n{tyr-:->;BD=DFC@?CDF6-<->;BD=DFC@?CDF9-B;=6H----u; -8J-zv\x075u; -7-snzr;p|y|Tnv{;-7-qvn{prSnp|9-=;=9-|yv{rSnp|6H----u; -J-pynz}5u; 9-=;=9->;=6H--\f--r{-zn\x075ul|lto5u69-rp@Is@?K5=;=66H\f<<<-与-svr-}ozl}|v{py|q<rr\x07;tyy-一致:用-}|wrpv|{-分量-8-视空间- ,而非-pyv};。s{-}|v{lv rl}v\x07rylnr{nrq5--}|v{`v rZ|qrG-@?9--onr]|v{`v rG-s@?9--r|yv|{fG-s@?9--}|v{Nr{]npxG-rpAIs@?K9--vrg_|G-rpAIs@?K9--|yq]|G-rp@Is@?K96-:K-s@?-\n--n-}|v{`v r]v\x07ry-J-onr]|v{`v rH--vs-5}|v{`v rZ|qr-JJ->6-\n----yr-zg-J-q|5vrg_|;\x07\b 9-|yq]|6-8-vrg_|;H----yr-urvtu-J-}|v{Nr{]npx;\b-7-zv\x075>;=9-zn\x075:zg9->r:B69-}|v{Nr{]npx;\x076H----}|v{`v r]v\x07ry-J-r|yv|{f-7-onr]|v{`v r-<-zn\x075urvtu9->r:B6H--\f--r{-}|v{`v r]v\x07ryH\fs{-pyv}lr5v{G-znA\x07AIs@?K9-pyv}ZrnG-rpAIs@?K9-|yq]|G-rpAIs@?K9-sy||Vq\x07G-s@?6-:K-o||y-\n--vs-5pyv}Zrn;-I-=;B6-\n----r{-snyrH--\f--yr-pyv}Sy||-J-pyv}Zrn;\x07H--yr-sy||\\x-J-pyv}Sy||-I-:=;B-\v\v-no5sy||Vq\x07-:-pyv}Sy||6-I-=;FFH--vs-5.sy||\\x6-\n----r{-snyrH--\f--yr-}-J-v{-7-|yq]|H--vs-5};\x07-K-:=;B-33-};\x07-I-=;B-33-};\b-K-:=;B-33-};\b-I-=;B-33-}; -K-:=;B-33-}; -I-=;B6-\n----r{-rH--\f--r{-snyrH\fMp|z}r-M|xt|}lv r5?BC6s{-znv{5Movyv{5ty|onylv{|pnv|{lvq6-tvqG-rp@I@?K6-\n--yr-vq\x07-J-tvq;\x07H--yr-prr{dvqu-J-snzr;prr{V{s|;\x07H--yr-prr{Urvtu-J-snzr;prr{V{s|;\bH--yr-}|v{P|{-J-vyr;vyr]npx;\x07H--yr-}|v{`v rZ|qr-J-snzr;prr{V{s|;H--yr-}|v{`pnyr-J-snzr;v rV{s|=;\x07H--yr-}|v{Zv{]v\x07ry-J-snzr;v rV{s|=;\bH--yr-}|v{Zn\x07]v\x07ry-J-snzr;v rV{s|=; H--yr-}v\x07ry_nv|-J-snzr;v rV{s|=;H--yr-r|yv|{f-J-s@?5snzr;v rV{s|>;\x076H--yr-}|v{]v\x07ryUnqZn\x07-J-s@?5snzr;v rV{s|>;\b6H--yr-}|v{`un}r-J-snzr;v rV{s|>; H--yr-p|y|`\byr-J-snzr;\byr]npx;\x07H--yr-sy||`\byr-J-snzr;\byr]npx;\bH--yr-}|v{Onpx-J-snzr;\byr]npx; H--yr-synt-J-vyr;vyr]npx;\bH--yr-un[|zny-J-5synt-3->6-.J-=H--yr-sy||Vq\x07-J-snzr;sy||]npx;\x07H--yr-u|{Sy||-J-snzr;sy||]npx;\bH--yr-z|qryNy}un-J-snzr;sy||]npx;H--vs-5vq\x07-KJ-}|v{P|{6-\n----r{H--\f--yr-onr-J-vq\x07-7-@H--yr-}|-J-rp@Is@?K5}|vv|{honrj9-}|vv|{honr-8->j9-}|vv|{honr-8-?j6H--yr-|yq]|A-J-vyr;z|qryZnv\x07-7-rpAIs@?K5}|9->;=6H--yr-|yq]|-J-|yq]|A;\x07\b H--n-{d|yq-J-rp@Is@?K5=;=6H--vs-5un[|zny6-\n----yr-{Y|pny-J-{}npxlvE\x07Al{|zny5}|v{[|znyhvq\x07j6H----{d|yq-J-{|znyv r5zn@\x07@Is@?K5------vyr;z|qryZnv\x07h=j;\x07\b 9------vyr;z|qryZnv\x07h>j;\x07\b 9------vyr;z|qryZnv\x07h?j;\x07\b 9----6-7-{Y|pny6H--\f--yr-vPr{Sy||-J-u|{Sy||-I-:=;=>-\v\v-no5sy||Vq\x07-:-u|{Sy||6-I-=;FFH--vs-5sy||`\byr-JJ-=-33-.vPr{Sy||6-\n----r{H--\f--vs-5pyv}lr5snzr;pyv}=V{9-snzr;pyv}=Zrn9-|yq]|A9-sy||Vq\x0766-\n----r{H--\f--vs-5pyv}lr5snzr;pyv}>V{9-snzr;pyv}>Zrn9-|yq]|A9-sy||Vq\x0766-\n----r{H--\f--n-sy||\\}npv\b-J->;=H--vs-5.vPr{Sy||-33-sy||`\byr-JJ->6-\n----sy||\\}npv\b-J-pynz}5=;?-7-zv{5>;=-8-snzr;pnzrnS|nq;\b9->;=69-=;=9->;=6H--\f--yr-pyv}-J-snzr;vr]|w-7-vyr;z|qryZnv\x07-7-rpAIs@?K5}|9->;=6H--vs-5no5pyv};6-I->r:C6-\n----r{H--\f--n-{qp-J-pyv};\x07\b -<-pyv};H--yr-p\x07s-J-5{qp;\x07-7-=;B-8-=;B6-7-s@?5prr{dvqu6H--yr-p\bs-J-5>;=-:-5{qp;\b-7-=;B-8-=;B66-7-s@?5prr{Urvtu6H--yr-p\x07-J-v@?5p\x07s6H--yr-p\b-J-v@?5p\bs6H--n-qr}u=>-J-pynz}5{qp; 9-=;=9->;=6H--yr-qr}ub>C-J-@?5qr}u=>-7-CBB@B;=6H--n-to-J-toBCBl|lyv{rn5p|y|hvq\x07j-3-=\x07SSSS6H--vs-5p|y|`\byr-JJ-?6-\n----to-J-snzr;p|{n{P|y|;\x07\b H--\f-ryr-vs-5p|y|`\byr-JJ->6-\n----yr-qr{|z-J-zn\x075vyr;oo|\x07Zn\x07;\b-:-vyr;oo|\x07Zv{;\b9->r:C6H----yr-Tnq-J-5|yq]|;\b-:-vyr;oo|\x07Zv{;\b6-<-qr{|zH----to-J-r\x07r`nz}yrYrry5tnqvr{ar\x079-tnqvr{`nz}yr9-rp?Is@?K5pynz}5Tnq9-=;=9->;=69-=;B69-=;=6;toH--\f--vs-5no5snzr;p|y|Tnv{;\x076-K->r:C-\v\v-no5snzr;p|y|Tnv{;\b6-K->r:C-\v\v------snzr;p|y|Tnv{; -K->r:C-\v\v-no5snzr;p|y|Tnv{;6-K->r:C6-\n----to-J-n}}y\blp|y|lnqwzr{5to9-{d|yq9-|yq]|6H--\f--vs-5un[|zny-33-}|v{Onpx-JJ->6-\n----yr-pnzQv-J-{|znyv r5snzr;pnzrnd|yq;\x07\b -:-|yq]|6H----vs-5q|5pnzQv9-{d|yq6-I-=;=6-\n------r{H----\f--\f-ryr-vs-5un[|zny-33-}|v{Onpx-JJ-?6-\n----yr-pnzQv-J-{|znyv r5snzr;pnzrnd|yq;\x07\b -:-|yq]|6H----vs-5q|5pnzQv9-{d|yq6-I-=;=6-\n------to-7J-=;EH----\f--\f--yr-ny}un-J-pynz}5z|qryNy}un-7-sy||\\}npv\b9-=;=9->;=6H--vs-5ny}un-I->r:A6-\n----r{H--\f--to-7J-ny}unH--to-7J-zn\x075vyr;oo|\x07Zn\x07;9-=;===>6H--yr-B-J-@?5pynz}5to;-7-@>;=9-=;=9-@>;=66H--yr-tC-J-@?5pynz}5to;t-7-C@;=9-=;=9-C@;=66H--yr-oB-J-@?5pynz}5to;o-7-@>;=9-=;=9-@>;=66H--yr-p|y|]npxrq-J-5B-II->>6-\v-5tC-II-B6-\v-oBH--yr-r{p|qrq-J-5qr}ub>C-II->C6-\v-5p|y|]npxrq-3-=\x07SSSS6H--yr-onr]|v{`v r-J-}|v{`pnyr-7-}v\x07ry_nv|H--n-}|v{`v r]v\x07ry-J-}|v{lv rl}v\x07rylnr{nrq5----}|v{`v rZ|qr9----onr]|v{`v r9----r|yv|{f9----snzr;}|v{Nr{]npx9----snzr;vrg_|9----|yq]|9--6H--}|v{`v r]v\x07ry-J-pynz}5}|v{`v r]v\x07ry9-}|v{Zv{]v\x07ry-7-}v\x07ry_nv|9-}|v{Zn\x07]v\x07ry-7-}v\x07ry_nv|6H--vs-5}|v{`v rZ|qr-JJ->6-\n----}|v{`v r]v\x07ry-J-zv{5}|v{`v r]v\x07ry9-}|v{]v\x07ryUnqZn\x076H--\f--}|v{`v r]v\x07ry-J-zn\x075}|v{`v r]v\x07ry9->;=6H--yr--J-v@?5prr{dvqu6H--yr-u-J-v@?5prr{Urvtu6H--vs-5}|v{`v r]v\x07ry-IJ->;=6-\n----vs-5p\x07-KJ-=-33-p\x07-I--33-p\b-KJ-=-33-p\b-I-u6-\n------yr-}v\x07ryVq\x07-J-@?5p\b6-7-prr{dvqu-8-@?5p\x076H------n|zvpZv{53snzrossrh}v\x07ryVq\x07j9-r{p|qrq6H----\f----r{H--\f--yr-unys`v r-J-}|v{`v r]v\x07ry-7-=;BH--yr-p\x07\\ss-J-p\x07s-:-=;BH--yr-p\b\\ss-J-p\bs-:-=;BH--yr-}\x07`n-J-zn\x075v@?5prvy5p\x07\\ss-:-unys`v r669-=6H--yr-}\x07R{q-J-zv{5v@?5sy||5p\x07\\ss-8-unys`v r669--:->6H--yr-}\b`n-J-zn\x075v@?5prvy5p\b\\ss-:-unys`v r669-=6H--yr-}\bR{q-J-zv{5v@?5sy||5p\b\\ss-8-unys`v r669-u-:->6H--yr-{rrqPvpyrZnx-J-}|v{`un}r-JJ->-33-}|v{`v r]v\x07ry-K-@;=H--yr-nqv`\0-J-unys`v r-7-unys`v rH--s|-5n-}\bG-v@?-J-}\b`nH-}\b-IJ-}\bR{qH-}\b-J-}\b-8->6-\n----s|-5n-}\x07G-v@?-J-}\x07`nH-}\x07-IJ-}\x07R{qH-}\x07-J-}\x07-8->6-\n------vs-5{rrqPvpyrZnx6-\n--------yr-qq\x07-J-5s@?5}\x076-8-=;B6-:-p\x07sH--------yr-qq\b-J-5s@?5}\b6-8-=;B6-:-p\bsH--------vs-5qq\x07-7-qq\x07-8-qq\b-7-qq\b-K-nqv`\x006-\n----------p|{v{rH--------\f------\f------yr-}v\x07ryVq\x07-J-@?5}\b6-7-prr{dvqu-8-@?5}\x076H------n|zvpZv{53snzrossrh}v\x07ryVq\x07j9-r{p|qrq6H----\f--\f\f");function hb(e,t,n){let r=Math.round(e*31)&31,i=Math.round(t*63)&63,a=Math.round(n*31)&31;return r<<11|i<<5|a}function gb(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}var Q=class e{constructor(t,n){this.width=0,this.height=0,this.pointBuffer=null,this.colorBuffer=null,this.normalBuffer=null,this.framebuffer=null,this.clearBindGroup=null,this.rasterizeBindGroup=null,this.displayBindGroup=null,this.pointCount=0,this.frameUniformScratch=new ArrayBuffer(e.FRAME_UNIFORM_SIZE),this.tileUniformScratch=new ArrayBuffer(e.TILE_UNIFORM_SIZE),this.pointSizeUniformState={sizeMode:1,pointScale:.02,pointMinPixel:0,pointMaxPixel:40,pixelRatio:1,resolutionY:1,hardPixelMax:12,pointShape:1,maxDisplayBoost:1},this.ready=!1,this.lastBoundComputePipeline=null,this.pointCloudCache=new Map,this.rasterizeBindGroupCache=new Map,this.tileUniformBufferCache=new Map,this.tileDisposeListeners=new Map,this.packedColorScratch=new Uint32Array,this.packedNormalScratch=new Uint32Array,this.tmpVec3a=new c.Vector3,this.tmpVec3b=new c.Vector3,this.tmpVec3c=new c.Vector3,this.tmpVec3d=new c.Vector3,this.device=t,this.format=n,this.frameUniformBuffer=t.createBuffer({size:e.FRAME_UNIFORM_SIZE,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.displayParamsBuffer=t.createBuffer({size:8,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});let r=new DataView(this.frameUniformScratch),i=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);new Float32Array(this.frameUniformScratch,0,16).set(i),r.setUint32(e.OFFSET_SCREEN_WIDTH,0,!0),r.setUint32(e.OFFSET_SCREEN_HEIGHT,0,!0),r.setUint32(e.OFFSET_POINT_SIZE_MODE,this.pointSizeUniformState.sizeMode,!0),r.setFloat32(e.OFFSET_POINT_SCALE,this.pointSizeUniformState.pointScale,!0),r.setFloat32(e.OFFSET_POINT_MIN_PIXEL,this.pointSizeUniformState.pointMinPixel,!0),r.setFloat32(e.OFFSET_POINT_MAX_PIXEL,this.pointSizeUniformState.pointMaxPixel,!0),r.setFloat32(e.OFFSET_PIXEL_RATIO,this.pointSizeUniformState.pixelRatio,!0),r.setUint32(e.OFFSET_RESOLUTION_Y,Math.round(this.pointSizeUniformState.resolutionY),!0),r.setUint32(e.OFFSET_POINT_PIXEL_HARD_MAX,Math.round(this.pointSizeUniformState.hardPixelMax),!0),r.setUint32(e.OFFSET_POINT_SHAPE,this.pointSizeUniformState.pointShape,!0),t.queue.writeBuffer(this.frameUniformBuffer,0,this.frameUniformScratch);let a=t.createShaderModule({code:fb}),o=t.createShaderModule({code:mb}),s=t.createShaderModule({code:pb});this.clearPipeline=t.createComputePipeline({layout:`auto`,compute:{module:a,entryPoint:`main`}}),this.rasterizePipeline=t.createComputePipeline({layout:`auto`,compute:{module:o,entryPoint:`main`}}),this.fullscreenQuadPipeline=t.createRenderPipeline({layout:`auto`,vertex:{module:s,entryPoint:`vs_main`},fragment:{module:s,entryPoint:`fs_main`,targets:[{format:this.format}]},primitive:{topology:`triangle-list`},depthStencil:{format:`depth24plus`,depthWriteEnabled:!0,depthCompare:`less`}}),this.fullscreenQuadPipelineAdditive=t.createRenderPipeline({layout:`auto`,vertex:{module:s,entryPoint:`vs_main`},fragment:{module:s,entryPoint:`fs_main`,targets:[{format:this.format,blend:{color:{srcFactor:`one`,dstFactor:`one`,operation:`add`},alpha:{srcFactor:`one`,dstFactor:`one`,operation:`add`}}}]},primitive:{topology:`triangle-list`},depthStencil:{format:`depth24plus`,depthWriteEnabled:!0,depthCompare:`less`}}),this.placeholderGradientTexture=t.createTexture({size:{width:1,height:1},format:`rgba8unorm`,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST}),this.placeholderGradientView=this.placeholderGradientTexture.createView(),t.queue.writeTexture({texture:this.placeholderGradientTexture},new Uint8Array([128,128,128,255]),{offset:0,bytesPerRow:4},{width:1,height:1,depthOrArrayLayers:1}),this.gradientSampler=t.createSampler({magFilter:`linear`,minFilter:`linear`,addressModeU:`clamp-to-edge`,addressModeV:`clamp-to-edge`})}setPointCloud(e,t,n,r,i,a){var o,s,c,l;let u=(o=i==null?void 0:i.positionsVersion)==null?0:o,d=(s=i==null?void 0:i.colorsVersion)==null?0:s,f=(c=e.styleRevision)==null?0:c,p=this.pointCloudCache.get(e);if(p&&p.count===r&&p.positionsRef===t&&p.colorsRef===n&&p.positionsVersion===u&&p.colorsVersion===d&&p.styleRevision===f)this.pointBuffer=p.pointBuffer,this.colorBuffer=p.colorBuffer,this.pointCount=p.count,this.normalBuffer=p.normalBuffer;else{p&&(p.pointBuffer.destroy(),p.colorBuffer.destroy(),p.normalBuffer.destroy(),this.rasterizeBindGroupCache.delete(e));let i=this.device.createBuffer({size:Math.max(12,r*12),usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});this.device.queue.writeBuffer(i,0,t.buffer,t.byteOffset,r*12);let a=this.device.createBuffer({size:Math.max(4,r*4),usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});if(this.packedColorScratch.length<r&&(this.packedColorScratch=new Uint32Array(r)),n instanceof Uint8Array)for(let e=0;e<r;e++){let t=e*3,r=gb(n[t]/255),i=gb(n[t+1]/255),a=gb(n[t+2]/255);this.packedColorScratch[e]=hb(r,i,a)}else for(let e=0;e<r;e++){let t=e*3;this.packedColorScratch[e]=hb(n[t],n[t+1],n[t+2])}this.device.queue.writeBuffer(a,0,this.packedColorScratch.buffer,0,r*4);let o=this.device.createBuffer({size:Math.max(4,r*4),usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});this.packedNormalScratch.length<r&&(this.packedNormalScratch=new Uint32Array(r));let s=this.packedNormalScratch,c=e.normals;if(Zt(c,r))for(let e=0;e<r;e++){let t=e*4;s[e]=c[t]&255|(c[t+1]&255)<<8|(c[t+2]&255)<<16}else for(let e=0;e<r;e++)s[e]=8323072;this.device.queue.writeBuffer(o,0,s.buffer,s.byteOffset,r*4),this.pointCloudCache.set(e,{pointBuffer:i,colorBuffer:a,normalBuffer:o,count:r,positionsRef:t,colorsRef:n,positionsVersion:u,colorsVersion:d,styleRevision:f}),this.registerTileDisposer(e),this.pointBuffer=i,this.colorBuffer=a,this.normalBuffer=o,this.pointCount=r}let m=(l=a==null?void 0:a.gradientView)==null?this.placeholderGradientView:l,h=this.normalBuffer;if(!h)return;let g=this.ensureTileUniformBuffer(e);this.bindRasterizeGroup(e,g,m,h),this.ready=!!this.framebuffer&&!!this.rasterizeBindGroup}beginPointCloudFrame(t,n,r){r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);let i=r.elements,a=new DataView(this.frameUniformScratch);for(let t=0;t<16;t++)a.setFloat32(e.OFFSET_VIEW_PROJ+t*4,i[t],!0);this.writeFrameUniformsDataView(a,n,t,r),this.device.queue.writeBuffer(this.frameUniformBuffer,0,this.frameUniformScratch)}writeTileUniform(e,t){let n=this.ensureTileUniformBuffer(e),r=new DataView(this.tileUniformScratch);this.writeTileUniformsDataView(r,e,t),this.device.queue.writeBuffer(n,0,this.tileUniformScratch)}setPointSizeParams(e){var t;this.pointSizeUniformState.sizeMode=+(e.sizeMode===`ATTENUATION`),this.pointSizeUniformState.pointScale=Math.max(0,e.pointScale),this.pointSizeUniformState.pointMinPixel=Math.max(0,e.pointMinPixel),this.pointSizeUniformState.pointMaxPixel=Math.max(this.pointSizeUniformState.pointMinPixel,e.pointMaxPixel),this.pointSizeUniformState.pixelRatio=Math.max(.1,e.pixelRatio),this.pointSizeUniformState.resolutionY=Math.max(1,e.resolutionY),this.pointSizeUniformState.pointShape=+(e.pointShape===`CIRCLE`);let n=(t=e.maxDisplayBoost)==null?this.pointSizeUniformState.maxDisplayBoost:t;this.pointSizeUniformState.maxDisplayBoost=Math.max(.1,n),this.pointSizeUniformState.hardPixelMax=Math.round(Math.min(96,Math.max(1,this.pointSizeUniformState.pointMaxPixel*this.pointSizeUniformState.pixelRatio)))}getPlaceholderGradientView(){return this.placeholderGradientView}static tileFlags(e,t){let n=0;return Zt(e.normals,t)&&(n|=1),e.useAddBlend&&(n|=8),n}writePointAttenuationUniforms(t,n){let r=n.projectionMatrix.elements,i=n.matrixWorldInverse.elements;t.setFloat32(e.OFFSET_POINT_ATTEN_PACK,-r[11],!0),t.setFloat32(e.OFFSET_POINT_ATTEN_PACK+4,2/r[5],!0),t.setFloat32(e.OFFSET_POINT_ATTEN_PACK+8,0,!0),t.setFloat32(e.OFFSET_POINT_ATTEN_PACK+12,0,!0),t.setFloat32(e.OFFSET_VIEW_Z_ROW,i[2],!0),t.setFloat32(e.OFFSET_VIEW_Z_ROW+4,i[6],!0),t.setFloat32(e.OFFSET_VIEW_Z_ROW+8,i[10],!0),t.setFloat32(e.OFFSET_VIEW_Z_ROW+12,i[14],!0)}writeFrameUniformsDataView(t,n,r,i){var a,o;t.setUint32(e.OFFSET_SCREEN_WIDTH,this.width,!0),t.setUint32(e.OFFSET_SCREEN_HEIGHT,this.height,!0),t.setUint32(e.OFFSET_SCREEN_WIDTH+8,0,!0),this.writePointAttenuationUniforms(t,r),t.setUint32(e.OFFSET_POINT_SIZE_MODE,this.pointSizeUniformState.sizeMode,!0),t.setFloat32(e.OFFSET_POINT_SCALE,this.pointSizeUniformState.pointScale,!0),t.setFloat32(e.OFFSET_POINT_MIN_PIXEL,this.pointSizeUniformState.pointMinPixel,!0),t.setFloat32(e.OFFSET_POINT_MAX_PIXEL,this.pointSizeUniformState.pointMaxPixel,!0),t.setFloat32(e.OFFSET_PIXEL_RATIO,this.pointSizeUniformState.pixelRatio,!0),t.setUint32(e.OFFSET_RESOLUTION_Y,Math.round(this.pointSizeUniformState.resolutionY),!0),t.setUint32(e.OFFSET_POINT_PIXEL_HARD_MAX,Math.round(this.pointSizeUniformState.hardPixelMax),!0),t.setUint32(e.OFFSET_POINT_SHAPE,this.pointSizeUniformState.pointShape,!0);let s=n.colorStyle===`ALTITUDE`?1:n.colorStyle===`CONSTANT`?2:0,c=+(n.floorStyle===`OPACITY`),l=n.pointBack===`HIDDEN`?1:n.pointBack===`DARK`?2:0;r.updateMatrixWorld(!0);let u=r.getWorldPosition(this.tmpVec3c);t.setFloat32(e.OFFSET_CAMERA_WORLD,u.x,!0),t.setFloat32(e.OFFSET_CAMERA_WORLD+4,u.y,!0),t.setFloat32(e.OFFSET_CAMERA_WORLD+8,u.z,!0),t.setFloat32(e.OFFSET_CAMERA_WORLD+12,0,!0);let d=this.tmpVec3d.set(0,0,-1).applyQuaternion(r.quaternion);t.setFloat32(e.OFFSET_CAMERA_FORWARD,d.x,!0),t.setFloat32(e.OFFSET_CAMERA_FORWARD+4,d.y,!0),t.setFloat32(e.OFFSET_CAMERA_FORWARD+8,d.z,!0),t.setFloat32(e.OFFSET_CAMERA_FORWARD+12,0,!0),t.setFloat32(e.OFFSET_CONSTANT_COLOR,n.constantColor.x,!0),t.setFloat32(e.OFFSET_CONSTANT_COLOR+4,n.constantColor.y,!0),t.setFloat32(e.OFFSET_CONSTANT_COLOR+8,n.constantColor.z,!0),t.setFloat32(e.OFFSET_CONSTANT_COLOR+12,1,!0),t.setFloat32(e.OFFSET_COLOR_GAIN,n.colorSaturation,!0),t.setFloat32(e.OFFSET_COLOR_GAIN+4,n.colorBrightness,!0),t.setFloat32(e.OFFSET_COLOR_GAIN+8,n.outlineGain,!0),t.setFloat32(e.OFFSET_COLOR_GAIN+12,n.distanceGain,!0),t.setUint32(e.OFFSET_STYLE_PACK,s,!0),t.setUint32(e.OFFSET_STYLE_PACK+4,c,!0),t.setUint32(e.OFFSET_STYLE_PACK+8,l,!0),t.setUint32(e.OFFSET_STYLE_PACK+12,0,!0),t.setFloat32(e.OFFSET_FLOOR_PACK,n.floorIndex,!0),t.setFloat32(e.OFFSET_FLOOR_PACK+4,n.shownFloorIndex,!0),t.setFloat32(e.OFFSET_FLOOR_PACK+8,n.opacity,!0),t.setFloat32(e.OFFSET_FLOOR_PACK+12,n.modelAlpha,!0);let f=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);for(let n=0;n<16;n++)t.setFloat32(e.OFFSET_CLIP0_INV+n*4,f[n],!0),t.setFloat32(e.OFFSET_CLIP1_INV+n*4,f[n],!0);t.setFloat32(e.OFFSET_CLIP0_META+12,0,!0),t.setFloat32(e.OFFSET_CLIP1_META+12,0,!0);let p=n.clippers;if(p.length>0){let n=p[0];i.copy(n.clippingBoxMatrix).invert();let r=i.elements;for(let n=0;n<16;n++)t.setFloat32(e.OFFSET_CLIP0_INV+n*4,r[n],!0);t.setFloat32(e.OFFSET_CLIP0_META,(a=n.floorIndex)==null?-1:a,!0),t.setFloat32(e.OFFSET_CLIP0_META+12,1,!0)}if(p.length>1){let n=p[1];i.copy(n.clippingBoxMatrix).invert();let r=i.elements;for(let n=0;n<16;n++)t.setFloat32(e.OFFSET_CLIP1_INV+n*4,r[n],!0);t.setFloat32(e.OFFSET_CLIP1_META,(o=n.floorIndex)==null?-1:o,!0),t.setFloat32(e.OFFSET_CLIP1_META+12,1,!0)}}writeTileUniformsDataView(t,n,r){let i=n.matrixWorld.elements;for(let n=0;n<16;n++)t.setFloat32(e.OFFSET_TILE_MODEL+n*4,i[n],!0);let a=this.tmpVec3a.copy(n.modelBoundingMin),o=this.tmpVec3b.copy(n.modelBoundingMax);t.setFloat32(e.OFFSET_TILE_BBOX_MIN,a.x,!0),t.setFloat32(e.OFFSET_TILE_BBOX_MIN+4,a.y,!0),t.setFloat32(e.OFFSET_TILE_BBOX_MIN+8,a.z,!0),t.setFloat32(e.OFFSET_TILE_BBOX_MIN+12,0,!0),t.setFloat32(e.OFFSET_TILE_BBOX_MAX,o.x,!0),t.setFloat32(e.OFFSET_TILE_BBOX_MAX+4,o.y,!0),t.setFloat32(e.OFFSET_TILE_BBOX_MAX+8,o.z,!0),t.setFloat32(e.OFFSET_TILE_BBOX_MAX+12,n.brightness,!0),t.setUint32(e.OFFSET_TILE_PACK,r,!0),t.setUint32(e.OFFSET_TILE_PACK+4,e.tileFlags(n,r),!0)}resize(t,n){var r;t<=0||n<=0||(this.width=t,this.height=n,(r=this.framebuffer)==null||r.destroy(),this.framebuffer=this.device.createBuffer({size:t*n*4,usage:GPUBufferUsage.STORAGE}),this.device.queue.writeBuffer(this.displayParamsBuffer,0,new Uint32Array([t,n])),this.device.queue.writeBuffer(this.frameUniformBuffer,e.OFFSET_SCREEN_WIDTH,new Uint32Array([t,n])),this.rasterizeBindGroupCache.clear(),this.rasterizeBindGroup=null,this.ready=!1,this.recreateBindGroups())}encodeFramebufferClear(e){!this.clearBindGroup||!this.framebuffer||(e.setPipeline(this.clearPipeline),this.lastBoundComputePipeline=this.clearPipeline,e.setBindGroup(0,this.clearBindGroup),e.dispatchWorkgroups(Math.ceil(this.width*this.height/256)))}encodeRasterize(e){if(!this.ready||!this.rasterizeBindGroup||!this.pointBuffer||!this.colorBuffer||this.pointCount<=0)return;let t=this.rasterizePipeline;this.lastBoundComputePipeline!==t&&(e.setPipeline(t),this.lastBoundComputePipeline=t),e.setBindGroup(0,this.rasterizeBindGroup),e.dispatchWorkgroups(Math.ceil(this.pointCount/256))}encodeFramebufferDisplay(e,t){if(!this.displayBindGroup||!this.framebuffer)return;let n=t!=null&&t.additive?this.fullscreenQuadPipelineAdditive:this.fullscreenQuadPipeline;e.setPipeline(n),e.setBindGroup(0,this.displayBindGroup),e.draw(3)}submitMergedPointCloudFrame(e,t,n,r){var i,a,o;let s=(i=r==null?void 0:r.clear)==null?!0:i,c=(a=r==null?void 0:r.display)==null?!0:a,l=(o=r==null?void 0:r.displayAdditive)==null?!1:o,u=this.device.createCommandEncoder(),d=u.beginComputePass();if(this.lastBoundComputePipeline=null,s&&this.encodeFramebufferClear(d),n(d),d.end(),c){let n=u.beginRenderPass({colorAttachments:[{view:e,loadOp:`load`,storeOp:`store`}],depthStencilAttachment:{view:t,depthLoadOp:`load`,depthStoreOp:`store`}});this.encodeFramebufferDisplay(n,{additive:l}),n.end()}this.device.queue.submit([u.finish()])}dispose(){var e;for(let[e,t]of this.tileDisposeListeners)try{e.removeEventListener(`dispose`,t)}catch(e){}this.tileDisposeListeners.clear();for(let e of this.pointCloudCache.values())e.pointBuffer.destroy(),e.colorBuffer.destroy(),e.normalBuffer.destroy();this.pointCloudCache.clear();for(let e of this.tileUniformBufferCache.values())e.destroy();this.tileUniformBufferCache.clear(),this.rasterizeBindGroupCache.clear(),(e=this.framebuffer)==null||e.destroy(),this.frameUniformBuffer.destroy(),this.displayParamsBuffer.destroy(),this.placeholderGradientTexture.destroy(),this.pointBuffer=null,this.colorBuffer=null,this.normalBuffer=null,this.framebuffer=null,this.clearBindGroup=null,this.rasterizeBindGroup=null,this.displayBindGroup=null,this.ready=!1}registerTileDisposer(e){if(this.tileDisposeListeners.has(e))return;let t=e;if(typeof t.addEventListener!=`function`)return;let n=()=>{this.releaseTileResources(e)};this.tileDisposeListeners.set(e,n),t.addEventListener(`dispose`,n)}releaseTileResources(e){let t=this.pointCloudCache.get(e);t&&(t.pointBuffer.destroy(),t.colorBuffer.destroy(),t.normalBuffer.destroy(),this.pointCloudCache.delete(e)),this.rasterizeBindGroupCache.delete(e);let n=this.tileUniformBufferCache.get(e);n&&(n.destroy(),this.tileUniformBufferCache.delete(e));let r=this.tileDisposeListeners.get(e);if(r){try{e.removeEventListener(`dispose`,r)}catch(e){}this.tileDisposeListeners.delete(e)}}recreateBindGroups(){this.clearBindGroup=null,this.rasterizeBindGroup=null,this.displayBindGroup=null,this.ready=!1,this.framebuffer&&(this.clearBindGroup=this.device.createBindGroup({layout:this.clearPipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.framebuffer}},{binding:1,resource:{buffer:this.frameUniformBuffer}}]}),this.displayBindGroup=this.device.createBindGroup({layout:this.fullscreenQuadPipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.framebuffer}},{binding:1,resource:{buffer:this.displayParamsBuffer}}]}),this.ready=!1)}ensureTileUniformBuffer(t){let n=this.tileUniformBufferCache.get(t);return n||(n=this.device.createBuffer({size:e.TILE_UNIFORM_SIZE,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.tileUniformBufferCache.set(t,n),this.registerTileDisposer(t)),n}bindRasterizeGroup(e,t,n,r){if(!this.framebuffer||!this.pointBuffer||!this.colorBuffer){this.rasterizeBindGroup=null;return}let i=this.rasterizeBindGroupCache.get(e);if(i&&i.pointBuffer===this.pointBuffer&&i.colorBuffer===this.colorBuffer&&i.normalBuffer===r&&i.tileUniformBuffer===t&&i.gradientView===n){this.rasterizeBindGroup=i.bindGroup;return}let a=this.device.createBindGroup({layout:this.rasterizePipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.framebuffer}},{binding:1,resource:{buffer:this.frameUniformBuffer}},{binding:2,resource:{buffer:this.pointBuffer}},{binding:3,resource:{buffer:this.colorBuffer}},{binding:4,resource:n},{binding:5,resource:this.gradientSampler},{binding:6,resource:{buffer:r}},{binding:7,resource:{buffer:t}}]});this.rasterizeBindGroupCache.set(e,{bindGroup:a,pointBuffer:this.pointBuffer,colorBuffer:this.colorBuffer,normalBuffer:r,tileUniformBuffer:t,gradientView:n}),this.rasterizeBindGroup=a}};Q.FRAME_UNIFORM_SIZE=512,Q.TILE_UNIFORM_SIZE=256,Q.OFFSET_VIEW_PROJ=0,Q.OFFSET_SCREEN_WIDTH=64,Q.OFFSET_SCREEN_HEIGHT=68,Q.OFFSET_POINT_SIZE_MODE=76,Q.OFFSET_POINT_ATTEN_PACK=80,Q.OFFSET_VIEW_Z_ROW=96,Q.OFFSET_POINT_SCALE=112,Q.OFFSET_POINT_MIN_PIXEL=116,Q.OFFSET_POINT_MAX_PIXEL=120,Q.OFFSET_PIXEL_RATIO=124,Q.OFFSET_RESOLUTION_Y=128,Q.OFFSET_POINT_PIXEL_HARD_MAX=132,Q.OFFSET_POINT_SHAPE=136,Q.OFFSET_CAMERA_WORLD=144,Q.OFFSET_CAMERA_FORWARD=160,Q.OFFSET_CONSTANT_COLOR=176,Q.OFFSET_COLOR_GAIN=192,Q.OFFSET_STYLE_PACK=208,Q.OFFSET_FLOOR_PACK=224,Q.OFFSET_CLIP0_INV=240,Q.OFFSET_CLIP0_META=304,Q.OFFSET_CLIP1_INV=320,Q.OFFSET_CLIP1_META=384,Q.OFFSET_TILE_MODEL=0,Q.OFFSET_TILE_BBOX_MIN=64,Q.OFFSET_TILE_BBOX_MAX=80,Q.OFFSET_TILE_PACK=96;var _b=new c.Matrix4,vb=class{constructor(e){var t;this.renderMode=`default`,this.computeRenderer=null,this.useComputePointCloud=null,this.compositeRenderTarget=null,this.lastWidth=0,this.lastHeight=0,this.gpuTextureViewCache=new WeakMap,this.outputType=(t=e==null?void 0:e.outputType)==null?c.UnsignedByteType:t,this.composer=new my(e),this.composerVersion=``,this.renderMode=`default`,this.sceneRenders={default:new db}}render(e,t,n,r,i){var a,o;let s=e.domElement,l=s.width,u=s.height;if(l<=0||u<=0)return!1;this.composer.updateStatus();let{endabledPassNumber:d,needsColorGBuffer:f,needsDepthGBuffer:p,version:m}=this.composer.status,h=d>0,g=e.getRenderTarget();if((l!==this.lastWidth||u!==this.lastHeight)&&(this.lastWidth=l,this.lastHeight=u,(a=this.compositeRenderTarget)==null||a.dispose(),this.compositeRenderTarget=new c.RenderTarget(l,u,{type:this.outputType}),this.compositeRenderTarget.depthTexture=new c.DepthTexture(l,u),(o=this.computeRenderer)==null||o.resize(l,u),i=!0),!this.compositeRenderTarget)return e.setRenderTarget(g),!1;!i&&h&&m!==this.composerVersion&&(i=!0),this.composerVersion=m,i&&this.renderSceneToComposite(e,t,n,r);let _=!1;return h?(this.composer.setSize(l,u),this.composer.gbuffer.clear(),f&&this.composer.gbuffer.set(`color`,this.compositeRenderTarget.texture),p&&this.compositeRenderTarget.depthTexture&&this.composer.gbuffer.set(`depth`,this.compositeRenderTarget.depthTexture),e.setRenderTarget(this.composer.readBuffer),ky(e,this.compositeRenderTarget.texture),_=this.composer.render(e)):i&&(e.setRenderTarget(null),ky(e,this.compositeRenderTarget.texture),_=!0),e.setRenderTarget(g),_}renderSceneToComposite(e,t,n,r){if(!this.compositeRenderTarget)return;r.updateMatrixWorld(!0),t.updateMatrixWorld(!0);let i=[];if(t.traverse(e=>{e instanceof nn&&i.push(e)}),i.length===0){e.setRenderTarget(this.compositeRenderTarget),e.clear(!0,!0,!0),e.render(t,r);return}if(this.useComputePointCloud===null)try{let t=e.backend;this.useComputePointCloud=(t==null?void 0:t.isWebGPUBackend)===!0&&!!(t!=null&&t.device)}catch(e){this.useComputePointCloud=!1}this.useComputePointCloud?this.renderPointCloudCompute(e,t,i,r):(e.setRenderTarget(this.compositeRenderTarget),e.clear(!0,!0,!0),e.render(t,r))}renderPointCloudCompute(e,t,n,r){var i;if(this.computeRenderer===null)try{let t=e.backend.device;if(!t)return;this.computeRenderer=new Q(t,`rgba8unorm`),this.computeRenderer.resize(this.lastWidth,this.lastHeight)}catch(e){return}e.setRenderTarget(this.compositeRenderTarget),e.clear(!0,!0,!0);let a=this.getCompositeTargetViews(e),o=Math.max(.1,r.pixelRatio||e.getPixelRatio()),s=Math.max(1,((i=r.resolution)==null?void 0:i.y)||this.lastHeight),c=[];for(let e of n)e.visible&&e.layers.test(r.layers)&&Math.max(0,Math.min(e.visiblePointCount,e.numPoints))!==0&&c.push(e);if(a&&c.length>0){let t=c.some(e=>e.useAddBlend),n=c[0];this.computeRenderer.setPointSizeParams({sizeMode:n.pointSize,pointShape:n.pointShape,pointScale:n.pointScale,pointMinPixel:n.pointMinPixel,pointMaxPixel:n.pointMaxPixel,pixelRatio:o,resolutionY:s,maxDisplayBoost:n.maxDisplayBoost}),this.computeRenderer.submitMergedPointCloudFrame(a.colorView,a.depthView,t=>{var i;this.computeRenderer.beginPointCloudFrame(r,n,_b);for(let n of c){let r=Math.max(0,Math.min(n.visiblePointCount,n.numPoints)),a=(i=this.getCachedGpuTextureView(e,n.gradientTexture))==null?this.computeRenderer.getPlaceholderGradientView():i;this.computeRenderer.setPointCloud(n,n.positions,n.colors,r,{positionsVersion:n.positionVersion,colorsVersion:n.styleRevision},{gradientView:a}),this.computeRenderer.writeTileUniform(n,r),this.computeRenderer.encodeRasterize(t)}},{displayAdditive:t})}let l=[];for(let e of n)e.visible&&(e.visible=!1,l.push(e));let u=e.autoClear,d=e.autoClearColor,f=e.autoClearDepth,p=e.autoClearStencil;e.autoClear=!1,e.autoClearColor=!1,e.autoClearDepth=!1,e.autoClearStencil=!1,e.setRenderTarget(this.compositeRenderTarget),e.render(t,r),e.autoClear=u,e.autoClearColor=d,e.autoClearDepth=f,e.autoClearStencil=p;for(let e of l)e.visible=!0}dispose(){var e,t;this.composer.dispose(),(e=this.computeRenderer)==null||e.dispose(),this.computeRenderer=null,(t=this.compositeRenderTarget)==null||t.dispose(),this.compositeRenderTarget=null}getCompositeTargetViews(e){var t;if(!((t=this.compositeRenderTarget)!=null&&t.depthTexture))return null;try{let t=e.backend,n=t.get(this.compositeRenderTarget.texture),r=t.get(this.compositeRenderTarget.depthTexture),i=n==null?void 0:n.texture,a=r==null?void 0:r.texture;return!i||!a?null:{colorView:i.createView(),depthView:a.createView()}}catch(e){return null}}getCachedGpuTextureView(e,t){var n;if(!t)return null;try{let r=e.backend,i=(n=r==null?void 0:r.get)==null?void 0:n.call(r,t),a=i==null?void 0:i.texture;if(!a)return null;let o=this.gpuTextureViewCache.get(a);return o||(o=a.createView(),this.gpuTextureViewCache.set(a,o)),o}catch(e){return null}}},yb=1579548,bb=typeof navigator<`u`&&navigator.gpu!==void 0;typeof window<`u`&&bb&&navigator.gpu.requestAdapter().then(e=>{e||(bb=!1)}).catch(K);var xb=class extends c.WebGPURenderer{constructor({antialias:e=!1,logarithmicDepthBuffer:t,outputType:n=c.UnsignedByteType}){super({antialias:e,alpha:!0,depth:!0,logarithmicDepthBuffer:t,outputType:n}),this._backendReady=!1,bb===!1&&console.warn(`设备不支持开启 WEBGPU`),this.outputColorSpace=c.SRGBColorSpace,this.setClearColor(yb,1),this.ready=this.init().then(()=>{this._backendReady=!0})}get isInitialized(){return this._backendReady}},Sb=new c.Matrix4,Cb=new c.Frustum,wb=new c.Vector2,Tb=new WeakMap;function Eb(e){let t=!1;return e.needsRender===!0?(e.needsRender=!1,t=!0):e.mixer&&e.mixer.stats.actions.inUse>0&&(t=!0),t}var Db=class extends c.Scene{constructor(){super(...arguments),this.needsRender=!1}add(...e){return super.add(...e)}remove(...e){return super.remove(...e)}update(e,t){let n=!1,r;return t instanceof ki?(r=t.time,wb.copy(t.resolution)):(r=G(),e.getSize(wb)),Sb.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Cb.setFromProjectionMatrix(Sb),this.traverseVisible(e=>{if(e.setResolution&&e.setResolution(wb.x,wb.y),e.setTime&&e.setTime(r),e.mixer instanceof c.AnimationMixer){let t=e.mixer,n=Tb.get(t);n||(n=new py,Tb.set(t,n)),n.update(r),t.update(n.getDelta())}(e instanceof c.Mesh||e instanceof c.Line||e instanceof c.Points)&&(!e.frustumCulled||Cb.intersectsObject(e))&&(Eb(e)&&(n=!0),e.traverseAncestors(e=>{Eb(e)&&(n=!0)}))}),this.needsRender=n,n}},Ob=e=>e*(2-e),kb=(()=>{let 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 c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r})(),Ab=(0,d.vec2)(.5,.5),jb=(0,d.float)(.017);function Mb(e,t){let n=(0,d.length)(Ab.sub(e));return(0,d.smoothstep)(t,t.add(jb),n)}function Nb(e,t){let n=(0,d.length)(Ab.sub(e));return(0,d.float)(1).sub((0,d.smoothstep)(t.sub(jb),t,n))}function Pb(e){let t={baseColor:(0,d.uniform)(new c.Color(e)),circleScale:(0,d.uniform)(1),ringScale:(0,d.uniform)(1),ringOpacity:(0,d.uniform)(1),loadingAngle:(0,d.uniform)(0),loadingOpacity:(0,d.uniform)(0),progress:(0,d.uniform)(0),progressOpacity:(0,d.uniform)(0),expand0:(0,d.uniform)(0),expand1:(0,d.uniform)(0),expandOpacity:(0,d.uniform)(0),opacity:(0,d.uniform)(0),tapScale:(0,d.uniform)(1),tapOpacity:(0,d.uniform)(1),disable:(0,d.uniform)(0)},n=(0,d.uv)(),r=(0,d.vec4)(1,1,1,(0,d.float)(.8).add((0,d.abs)((0,d.normalize)((0,d.vec2)(1,-1)).dot(n.sub(Ab))).mul(1.5)).clamp(0,1).mul(t.tapOpacity).mul(Mb(n,(0,d.float)(.15).mul(t.circleScale).mul(t.tapScale))).mul(Nb(n,(0,d.float)(.234).mul(t.circleScale).mul(t.tapScale)))),i=(0,d.vec4)(1,1,1,(0,d.float)(.5).add((0,d.abs)((0,d.normalize)((0,d.vec2)(1,1)).dot(n.sub(Ab)))).clamp(0,1).mul(t.tapOpacity).mul(t.ringOpacity).mul(Mb(n,(0,d.float)(.27).mul(t.ringScale).mul(t.tapScale))).mul(Nb(n,(0,d.float)(.32).mul(t.ringScale).mul(t.tapScale)))),a=(0,d.mod)(d.PI.sub((0,d.atan)(Ab.x.sub(n.x),Ab.y.sub(n.y))).add(t.loadingAngle),d.PI2),o=(0,d.vec4)(1,1,1,(0,d.float)(1).sub((0,d.smoothstep)((0,d.float)(0),d.PI2,a)).mul(.4).add(.1).mul(t.tapOpacity).mul(t.loadingOpacity).mul(Mb(n,(0,d.float)(.208).mul(t.circleScale).mul(t.tapScale))).mul(Nb(n,(0,d.float)(.3).mul(t.circleScale).mul(t.tapScale)))),s=d.PI.add((0,d.atan)(Ab.x.sub(n.x),Ab.y.sub(n.y))),l=(0,d.vec4)(1,1,1,(0,d.float)(1).sub((0,d.step)(t.progress.mul(d.PI2),s)).mul(.5).mul(t.tapOpacity).mul(t.progressOpacity).mul(Mb(n,(0,d.float)(.208).mul(t.circleScale).mul(t.tapScale))).mul(Nb(n,(0,d.float)(.3).mul(t.circleScale).mul(t.tapScale)))),u=(0,d.float)(.2).add((0,d.float)(.23).mul(t.expand0)),f=(0,d.length)(Ab.sub(n)),p=(0,d.vec4)(1,1,1,(0,d.float)(1).sub(u.sub(f).div(.2).clamp(0,1)).mul(.8).mul((0,d.float)(1).sub((0,d.abs)(t.expand0.sub(.5)).mul(2)).mul(1.2).clamp(0,1)).mul(t.expandOpacity).mul(Nb(n,u))),m=(0,d.float)(.2).add((0,d.float)(.23).mul(t.expand1)),h=(0,d.length)(Ab.sub(n)),g=(0,d.vec4)(1,1,1,(0,d.float)(1).sub(m.sub(h).div(.2).clamp(0,1)).mul(.8).mul((0,d.float)(1).sub((0,d.abs)(t.expand1.sub(.5)).mul(2)).mul(1.2).clamp(0,1)).mul(t.expandOpacity).mul(Nb(n,m))),_=(0,d.vec4)(1,1,1,(0,d.float)(.5).mul(Nb(n,(0,d.float)(.32).mul(t.circleScale).mul(t.tapScale)))),v=(0,d.vec4)(1,1,1,0);v=(0,d.mix)(v,g,g.w),v=(0,d.mix)(v,p,p.w),v=(0,d.mix)(v,l,l.w),v=(0,d.mix)(v,o,o.w),v=(0,d.mix)(v,r,r.w),v=(0,d.mix)(v,i,i.w),v=(0,d.mix)(v,_,t.disable);let y=(0,d.vec4)(v.xyz.mul(t.baseColor),v.w.mul(t.opacity).mul(t.opacity)),b=new c.NodeMaterial;return b.fragmentNode=y,b.blending=c.CustomBlending,b.blendSrc=c.SrcAlphaFactor,b.blendDst=c.OneMinusSrcAlphaFactor,b.blendSrcAlpha=c.OneFactor,b.blendDstAlpha=c.OneMinusSrcAlphaFactor,b.depthWrite=!1,b.transparent=!0,{material:b,u:t}}var Fb=class extends c.Object3D{constructor(e={}){var t,n;super();let r=(t=e.color)==null?16777215:t,i=(n=e.scale)==null?1:n;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new J({progress:0}),this.ringMotion=new J({scale:1,opacity:1}),this.tapMotion=new J({scale:1,opacity:1}),this.loadingOpacityMotion=new J({opacity:0}),this.progressMotion=new J({progress:0}),this.progressOpacityMotion=new J({opacity:0}),this.opacityMotion=new J({opacity:0}),this.disableMotion=new J({progress:0});let{material:a,u:o}=Pb(r);this.panoU=o,this.panoMesh=new c.Mesh(kb,a),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(i,1,i),this.add(this.panoMesh),this.currentStartTime=G(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=H(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(K),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(K).then(()=>{this.progressMotion.set({progress:0},0).catch(K)}):this.progressMotion.set({progress:H(e*1.2,0,1)},100).catch(K)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=H(e,0,1),this.opacityMotion.set({opacity:e},200).catch(K))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:+!!e},2e3).catch(K),this.current=e,this.current===!0&&(this.currentStartTime=G()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:+!!e},500).catch(K))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:+!!e},500).catch(K))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(K),this.progressMotion.set({progress:0},0).catch(K),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:+(this.progress>0)},300).catch(K),this.progressMotion.set({progress:this.progress},120).catch(K)}).catch(K)):Promise.resolve()}updateTime(e,t){if(this.progressMotion.ended||(this.progressMotion.update(e),this.panoU.progress.value=this.progressMotion.value.progress,this.needsRender=!0),this.progressOpacityMotion.ended||(this.progressOpacityMotion.update(e),this.panoU.progressOpacity.value=this.progressOpacityMotion.value.opacity,this.needsRender=!0),this.opacityMotion.ended||(this.opacityMotion.update(e),this.panoU.opacity.value=this.opacityMotion.value.opacity,this.needsRender=!0),this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoU.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoU.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoU.tapOpacity.value=this.tapMotion.value.opacity,this.panoU.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoU.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=1+Math.sin(Math.PI*t)/25*this.currentMotion.value.progress;this.panoU.circleScale.value=e,this.needsRender=!0}}{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoU.expand0.value=Ob(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoU.expand1.value=Ob(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(this.currentMotion.value.progress>.2&&this.progress===0&&this.loading===!1&&(e-this.currentStartTime-1e3)/2e3%5<2?this.ringMotion.getTargetKeyframe().value.scale!==.8&&this.ringMotion.set({scale:.8,opacity:0},600).catch(K):this.ringMotion.getTargetKeyframe().value.scale!==1&&this.ringMotion.set({scale:1,opacity:1},600).catch(K),!this.ringMotion.ended){let{scale:t,opacity:n}=this.ringMotion.value;this.ringMotion.update(e),this.panoU.ringScale.value=t,this.panoU.ringOpacity.value=n,this.needsRender=!0}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoU.disable.value=t,this.needsRender=!0}}dispose(){this.ringMotion.dispose(),this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}},Ib=e=>e*(2-e),Lb=(()=>{let 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 c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r})(),Rb=(0,d.vec2)(.5,.5),zb=(0,d.float)(.017);function Bb(e,t){let n=(0,d.length)(Rb.sub(e));return(0,d.smoothstep)(t,t.add(zb),n)}function Vb(e,t){let n=(0,d.length)(Rb.sub(e));return(0,d.float)(1).sub((0,d.smoothstep)(t.sub(zb),t,n))}function Hb(e){let t={baseColor:(0,d.uniform)(new c.Color(e)),circleScale:(0,d.uniform)(1),circleOpacity:(0,d.uniform)(1),loadingAngle:(0,d.uniform)(0),loadingOpacity:(0,d.uniform)(0),progress:(0,d.uniform)(0),progressOpacity:(0,d.uniform)(0),expand0:(0,d.uniform)(0),expand1:(0,d.uniform)(0),expandOpacity:(0,d.uniform)(0),opacity:(0,d.uniform)(0),tapScale:(0,d.uniform)(1),tapOpacity:(0,d.uniform)(1),disable:(0,d.uniform)(0)},n=(0,d.uv)(),r=(0,d.vec4)(1,1,1,(0,d.float)(.8).add((0,d.abs)((0,d.normalize)((0,d.vec2)(1,-1)).dot(n.sub(Rb))).mul(1.5)).clamp(0,1).mul((0,d.step)(t.progress,(0,d.float)(0))).mul(t.tapOpacity).mul(Bb(n,(0,d.float)(.2).mul(t.circleScale).mul(t.tapScale))).mul(Vb(n,(0,d.float)(.3).mul(t.circleScale).mul(t.tapScale)))),i=(0,d.mod)(d.PI.sub((0,d.atan)(Rb.x.sub(n.x),Rb.y.sub(n.y))).add(t.loadingAngle),d.PI2),a=(0,d.vec4)(1,1,1,(0,d.float)(1).sub((0,d.smoothstep)((0,d.float)(0),d.PI2,i)).mul(.9).add(.1).mul(t.tapOpacity).mul(t.loadingOpacity).mul(Bb(n,(0,d.float)(.2).mul(t.circleScale).mul(t.tapScale))).mul(Vb(n,(0,d.float)(.3).mul(t.circleScale).mul(t.tapScale)))),o=d.PI.add((0,d.atan)(Rb.x.sub(n.x),Rb.y.sub(n.y))),s=(0,d.float)(1).sub((0,d.step)(t.progress.mul(d.PI2),o)),l=(0,d.float)(.04),u=t.progress.mul(d.PI2),f=(0,d.step)((0,d.length)((0,d.vec2)(Rb.x.add((0,d.float)(0).sin().mul(.25)),Rb.y.add((0,d.float)(0).cos().mul(.25))).sub(n)),l),p=(0,d.step)((0,d.length)((0,d.vec2)(Rb.x.add(u.sin().mul(.25)),Rb.y.add(u.cos().mul(.25))).sub(n)),l),m=(0,d.vec4)(1,1,1,s.add(f).add(p).clamp(0,1).mul(.9).mul(t.tapOpacity).mul(t.progressOpacity).mul(Bb(n,(0,d.float)(.2).mul(t.circleScale).mul(t.tapScale))).mul(Vb(n,(0,d.float)(.3).mul(t.circleScale).mul(t.tapScale)))),h=(0,d.float)(.25).add((0,d.float)(.25).mul(t.expand0)),g=(0,d.length)(Rb.sub(n)),_=(0,d.vec4)(1,1,1,(0,d.float)(1).sub(h.sub(g).div(.2).clamp(0,1)).mul(.8).mul((0,d.float)(1).sub((0,d.abs)(t.expand0.sub(.5)).mul(2)).mul(1.2).clamp(0,1)).mul(t.expandOpacity).mul(Vb(n,h))),v=(0,d.float)(.25).add((0,d.float)(.23).mul(t.expand1)),y=(0,d.length)(Rb.sub(n)),b=(0,d.vec4)(1,1,1,(0,d.float)(1).sub(v.sub(y).div(.2).clamp(0,1)).mul(.8).mul((0,d.float)(1).sub((0,d.abs)(t.expand1.sub(.5)).mul(2)).mul(1.2).clamp(0,1)).mul(t.expandOpacity).mul(Vb(n,v))),x=(0,d.vec4)(1,1,1,(0,d.float)(.5).mul(t.tapOpacity).mul(Vb(n,(0,d.float)(.32).mul(t.circleScale).mul(t.tapScale)))),S=(0,d.vec4)(1,1,1,0);S=(0,d.mix)(S,b,b.w),S=(0,d.mix)(S,_,_.w),S=(0,d.mix)(S,r,r.w),S=(0,d.mix)(S,m,m.w),S=(0,d.mix)(S,a,a.w),S=(0,d.mix)(S,x,t.disable);let C=(0,d.vec4)(S.xyz.mul(t.baseColor),S.w.mul(t.opacity).mul(t.opacity)),w=new c.NodeMaterial;return w.fragmentNode=C,w.blending=c.CustomBlending,w.blendSrc=c.SrcAlphaFactor,w.blendDst=c.OneMinusSrcAlphaFactor,w.blendSrcAlpha=c.OneFactor,w.blendDstAlpha=c.OneMinusSrcAlphaFactor,w.depthWrite=!1,w.transparent=!0,{material:w,u:t}}var Ub=class extends c.Object3D{constructor(e={}){var t,n;super();let r=(t=e.color)==null?16777215:t,i=(n=e.scale)==null?1:n;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new J({progress:0}),this.tapMotion=new J({scale:1,opacity:1}),this.loadingOpacityMotion=new J({opacity:0}),this.progressMotion=new J({progress:0}),this.progressOpacityMotion=new J({opacity:0}),this.opacityMotion=new J({opacity:0}),this.disableMotion=new J({progress:0});let{material:a,u:o}=Hb(r);this.panoU=o,this.panoMesh=new c.Mesh(Lb,a),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(i,1,i),this.add(this.panoMesh),this.currentStartTime=G(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=H(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(K),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(K).then(()=>{this.progressMotion.set({progress:0},0).catch(K)}):this.progressMotion.set({progress:H(e*1.2,0,1)},100).catch(K)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=H(e,0,1),this.opacityMotion.set({opacity:e},200).catch(K))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:+!!e},2e3).catch(K),this.current=e,this.current===!0&&(this.currentStartTime=G()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:+!!e},500).catch(K))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:+!!e},500).catch(K))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(K),this.progressMotion.set({progress:0},0).catch(K),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:+(this.progress>0)},300).catch(K),this.progressMotion.set({progress:this.progress},120).catch(K)}).catch(K)):Promise.resolve()}updateTime(e,t){if(this.progressMotion.ended||(this.progressMotion.update(e),this.panoU.progress.value=this.progressMotion.value.progress,this.needsRender=!0),this.progressOpacityMotion.ended||(this.progressOpacityMotion.update(e),this.panoU.progressOpacity.value=this.progressOpacityMotion.value.opacity,this.needsRender=!0),this.opacityMotion.ended||(this.opacityMotion.update(e),this.panoU.opacity.value=this.opacityMotion.value.opacity,this.needsRender=!0),this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoU.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoU.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoU.tapOpacity.value=this.tapMotion.value.opacity,this.panoU.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoU.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.panoU.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=1+Math.sin(Math.PI*t)/25*this.currentMotion.value.progress;this.panoU.circleScale.value=e,this.needsRender=!0}}{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoU.expand0.value=Ib(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoU.expand1.value=Ib(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoU.disable.value=t,this.needsRender=!0}}dispose(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}},Wb=e=>e*(2-e),Gb=(()=>{let 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 c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r})(),Kb=`
|
|
920
|
+
varying vec2 vUv;
|
|
921
|
+
#include <common>
|
|
922
|
+
#include <logdepthbuf_pars_vertex>
|
|
923
|
+
void main() {
|
|
924
|
+
vUv = uv;
|
|
925
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
926
|
+
#include <logdepthbuf_vertex>
|
|
927
|
+
}
|
|
928
|
+
`,qb=`
|
|
929
|
+
#if defined(USE_MAP)
|
|
930
|
+
uniform sampler2D map;
|
|
931
|
+
uniform float mapAlpha;
|
|
932
|
+
#endif
|
|
933
|
+
#if defined(USE_BORDER)
|
|
934
|
+
uniform float borderWidth;
|
|
935
|
+
uniform vec3 borderColor;
|
|
936
|
+
#endif
|
|
937
|
+
uniform vec3 baseColor;
|
|
938
|
+
uniform float circleScale;
|
|
939
|
+
uniform float circleOpacity;
|
|
940
|
+
uniform float loadingAngle;
|
|
941
|
+
uniform float loadingOpacity;
|
|
942
|
+
uniform float progress;
|
|
943
|
+
uniform float progressOpacity;
|
|
944
|
+
uniform float expand0;
|
|
945
|
+
uniform float expand1;
|
|
946
|
+
uniform float expandOpacity;
|
|
947
|
+
uniform float opacity;
|
|
948
|
+
uniform float tapScale;
|
|
949
|
+
uniform float tapOpacity;
|
|
950
|
+
uniform float disable;
|
|
951
|
+
varying vec2 vUv;
|
|
952
|
+
|
|
953
|
+
#include <common>
|
|
954
|
+
#include <logdepthbuf_pars_fragment>
|
|
955
|
+
#define SMOOTH_DIST 0.017
|
|
956
|
+
#define CENTER vec2(0.5, 0.5)
|
|
957
|
+
|
|
958
|
+
float inside(float innerDist) {
|
|
959
|
+
float dist = length(CENTER - vUv);
|
|
960
|
+
return smoothstep(innerDist, innerDist + SMOOTH_DIST, dist);
|
|
961
|
+
}
|
|
962
|
+
float outside(float outerDist) {
|
|
963
|
+
float dist = length(CENTER - vUv);
|
|
964
|
+
return 1.0 - smoothstep(outerDist - SMOOTH_DIST, outerDist, dist);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
vec4 create_circle() {
|
|
968
|
+
float dist = length(CENTER - vUv);
|
|
969
|
+
float radius = 0.3 * circleScale * tapScale;
|
|
970
|
+
#if defined(USE_MAP)
|
|
971
|
+
float delta = radius / 0.5;
|
|
972
|
+
vec2 deltaUv = (vUv - CENTER) / delta + CENTER;
|
|
973
|
+
vec4 image = texture2D(map, deltaUv);
|
|
974
|
+
image.a = image.a * mapAlpha;
|
|
975
|
+
#if defined(USE_COLOR)
|
|
976
|
+
image = vec4(baseColor, 1.0) * image;
|
|
977
|
+
#endif
|
|
978
|
+
#endif
|
|
979
|
+
#if defined(USE_REVERSE)
|
|
980
|
+
image = vec4(baseColor, 1.0 - image.a);
|
|
981
|
+
#else
|
|
982
|
+
#if defined(USE_BORDER)
|
|
983
|
+
float borderDist = clamp(borderWidth, 0.0, 1.0);
|
|
984
|
+
float clipAlpha = inside(radius - borderDist * radius);
|
|
985
|
+
float gradient = clamp(borderWidth * 2.0 + abs(dot(normalize(vec2(1.0, -1.0)), vUv - CENTER)), 0.0, 1.0);
|
|
986
|
+
vec4 borderColor = vec4(borderColor, clipAlpha * gradient);
|
|
987
|
+
image = mix(borderColor, image, image.a);
|
|
988
|
+
#endif
|
|
989
|
+
#endif
|
|
990
|
+
return vec4(image.rgb, image.a * circleOpacity * tapOpacity * outside(radius));
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
vec4 create_disable() {
|
|
994
|
+
float dist = length(CENTER - vUv);
|
|
995
|
+
return vec4(baseColor, 0.5 * tapOpacity * outside(0.32 * circleScale * tapScale));
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
vec4 create_loading() {
|
|
999
|
+
float angle = PI - atan(CENTER.x - vUv.x, CENTER.y - vUv.y);
|
|
1000
|
+
angle = mod(angle + loadingAngle, PI2);
|
|
1001
|
+
float gradient = (1.0 - smoothstep(0.0, PI2, angle)) * 0.9 + 0.1;
|
|
1002
|
+
float radius = 0.3 * circleScale * tapScale;
|
|
1003
|
+
float inner = inside(radius - 0.2 * radius);
|
|
1004
|
+
#if defined(USE_BORDER)
|
|
1005
|
+
float borderDist = clamp(borderWidth, 0.0, 1.0);
|
|
1006
|
+
inner = inside(radius - borderDist * radius);
|
|
1007
|
+
#endif
|
|
1008
|
+
return vec4(baseColor, gradient * tapOpacity * loadingOpacity * inner * outside(radius));
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
vec4 create_progress() {
|
|
1012
|
+
float angle = PI + atan(CENTER.x - vUv.x, CENTER.y - vUv.y);
|
|
1013
|
+
float bar = (1.0 - step(progress * PI2, angle)) * 0.7;
|
|
1014
|
+
float radius = 0.3 * circleScale * tapScale;
|
|
1015
|
+
float inner = inside(radius - 0.2 * radius);
|
|
1016
|
+
#if defined(USE_BORDER)
|
|
1017
|
+
float borderDist = clamp(borderWidth, 0.0, 1.0);
|
|
1018
|
+
inner = inside(radius - borderDist * radius);
|
|
1019
|
+
#endif
|
|
1020
|
+
return vec4(baseColor, bar * tapOpacity * progressOpacity * inner * outside(radius));
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
vec4 create_expand0() {
|
|
1024
|
+
float width = 0.2;
|
|
1025
|
+
float radius = 0.25 + (0.5 - 0.25) * expand0;
|
|
1026
|
+
float dist = length(CENTER - vUv);
|
|
1027
|
+
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);
|
|
1028
|
+
return vec4(baseColor, gradient * expandOpacity * outside(radius));
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
vec4 create_expand1() {
|
|
1032
|
+
float width = 0.2;
|
|
1033
|
+
float radius = 0.25 + (0.48 - 0.25) * expand1;
|
|
1034
|
+
float dist = length(CENTER - vUv);
|
|
1035
|
+
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);
|
|
1036
|
+
return vec4(baseColor, gradient * expandOpacity * outside(radius));
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
void main() {
|
|
1040
|
+
#include <logdepthbuf_fragment>
|
|
1041
|
+
gl_FragColor = vec4(baseColor, 0);
|
|
1042
|
+
|
|
1043
|
+
vec4 expand1Color = create_expand1();
|
|
1044
|
+
gl_FragColor = mix(gl_FragColor, expand1Color, expand1Color.a);
|
|
1045
|
+
|
|
1046
|
+
vec4 expand0Color = create_expand0();
|
|
1047
|
+
gl_FragColor = mix(gl_FragColor, expand0Color, expand0Color.a);
|
|
1048
|
+
|
|
1049
|
+
vec4 circleColor = create_circle();
|
|
1050
|
+
gl_FragColor = mix(gl_FragColor, circleColor, circleColor.a);
|
|
1051
|
+
|
|
1052
|
+
vec4 progressColor = create_progress();
|
|
1053
|
+
gl_FragColor = mix(gl_FragColor, progressColor, progressColor.a);
|
|
1054
|
+
|
|
1055
|
+
vec4 loadingColor = create_loading();
|
|
1056
|
+
gl_FragColor = mix(gl_FragColor, loadingColor, loadingColor.a);
|
|
1057
|
+
|
|
1058
|
+
gl_FragColor = mix(gl_FragColor, create_disable(), disable);
|
|
1059
|
+
|
|
1060
|
+
gl_FragColor = vec4(gl_FragColor.rgb, gl_FragColor.a * opacity);
|
|
1061
|
+
}
|
|
1062
|
+
`,Jb=class extends c.Object3D{constructor(e={}){var t,n,r,i,a,o,s;super();let l=(t=e.color)==null?16777215:t,u=(n=e.scale)==null?1:n,d=e.map,f=(r=e.mapAlpha)==null?1:r,p=(i=e.mapUseColor)==null?!1:i,m=(a=e.mapUseReverse)==null?!1:a,h=(o=e.borderWidth)==null?.1:o,g=(s=e.borderColor)==null?16777215:s;this.progress=0,this.opacity=0,this.loading=!1,this.current=!1,this.disabled=!1,this.currentMotion=new J({progress:0}),this.tapMotion=new J({scale:1,opacity:1}),this.loadingOpacityMotion=new J({opacity:0}),this.progressMotion=new J({progress:0}),this.progressOpacityMotion=new J({opacity:0}),this.opacityMotion=new J({opacity:0}),this.disableMotion=new J({progress:0}),this.panoMesh=new c.Mesh(Gb,new c.ShaderMaterial({blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,depthWrite:!1,transparent:!0,vertexShader:Kb,fragmentShader:qb,defines:{USE_COLOR:p,USE_MAP:d!==void 0,USE_BORDER:h>0,USE_REVERSE:m},uniforms:{baseColor:{value:new c.Color(l)},circleScale:{value:1},circleOpacity:{value:1},loadingAngle:{value:0},loadingOpacity:{value:0},progress:{value:0},progressOpacity:{value:0},expand0:{value:0},expand1:{value:0},expandOpacity:{value:0},opacity:{value:0},tapScale:{value:1},tapOpacity:{value:1},disable:{value:0},map:{value:d},mapAlpha:{value:f},borderWidth:{value:h},borderColor:{value:new c.Color(g)}}})),this.renderOrder=-2,this.panoMesh.renderOrder=-2,this.panoMesh.position.y=.004,this.panoMesh.scale.set(u,1,u),this.add(this.panoMesh),this.currentStartTime=G(),this.needsRender=!0}setProgress(e){this.setDisabled(!1),this.setLoading(!1),this.progress!==e&&(e=H(e,0,1),this.tapMotion.ended&&(this.progress===0&&this.progressOpacityMotion.set({opacity:1},500).catch(K),e===0?this.progressOpacityMotion.set({opacity:0},500).catch(K).then(()=>{this.progressMotion.set({progress:0},0).catch(K)}):this.progressMotion.set({progress:H(e*1.2,0,1)},100).catch(K)),this.progress=e)}setOpacity(e){this.opacity!==e&&(this.opacity=e=H(e,0,1),this.opacityMotion.set({opacity:e},200).catch(K))}setCurrent(e){this.current!==e&&(this.currentMotion.set({progress:+!!e},2e3).catch(K),this.current=e,this.current===!0&&(this.currentStartTime=G()))}setLoading(e){this.loading!==e&&(this.loading=e,this.disabled===!0&&this.setDisabled(!1),this.loadingOpacityMotion.set({opacity:+!!e},500).catch(K))}setDisabled(e){this.disabled!==e&&(this.disabled=e,this.loading===!0&&this.setLoading(!1),this.disableMotion.set({progress:+!!e},500).catch(K))}tap(){return this.tapMotion.ended?(this.progressOpacityMotion.set({opacity:0},0).catch(K),this.progressMotion.set({progress:0},0).catch(K),this.tapMotion.setKeyframes([{progress:0,value:{scale:1,opacity:1}},{progress:.3,value:{scale:.85,opacity:.5}},{progress:.8,value:{scale:1.05,opacity:.6}},{progress:1,value:{scale:1,opacity:1}}],600).then(()=>{this.progressOpacityMotion.set({opacity:+(this.progress>0)},300).catch(K),this.progressMotion.set({progress:this.progress},120).catch(K)}).catch(K)):Promise.resolve()}updateTime(e,t){if(!this.progressMotion.ended){this.progressMotion.update(e);let t=this.progressMotion.value.progress;this.panoMesh.material.uniforms.progress.value=t,this.needsRender=!0}if(!this.progressOpacityMotion.ended){this.progressOpacityMotion.update(e);let t=this.progressOpacityMotion.value.opacity;this.panoMesh.material.uniforms.progressOpacity.value=t,this.needsRender=!0}if(!this.opacityMotion.ended){this.opacityMotion.update(e);let t=this.opacityMotion.value.opacity;this.panoMesh.material.uniforms.opacity.value=t,this.needsRender=!0}if(this.visible=this.opacityMotion.value.opacity!==0,(!this.loadingOpacityMotion.ended||this.loadingOpacityMotion.value.opacity>0)&&(this.loadingOpacityMotion.update(e),this.panoMesh.material.uniforms.loadingOpacity.value=this.loadingOpacityMotion.value.opacity,this.panoMesh.material.uniforms.loadingAngle.value=e/120%(Math.PI*2),this.needsRender=!0),this.tapMotion.ended||(this.tapMotion.update(e),this.panoMesh.material.uniforms.tapOpacity.value=this.tapMotion.value.opacity,this.panoMesh.material.uniforms.tapScale.value=this.tapMotion.value.scale,this.needsRender=!0),this.panoMesh.material.uniforms.circleOpacity.value=Math.max(.6,1-Math.max(this.loadingOpacityMotion.value.opacity,this.progressOpacityMotion.value.opacity)),this.current||!this.currentMotion.ended){this.currentMotion.update(e),this.panoMesh.material.uniforms.expandOpacity.value=this.currentMotion.value.progress;{let t=(e-this.currentStartTime-1500)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand0.value=Wb(e)*this.currentMotion.value.progress,this.needsRender=!0}}{let t=(e-this.currentStartTime-1e3)/2e3;if(t%5<2){let e=t%1;this.panoMesh.material.uniforms.expand1.value=Wb(e)*this.currentMotion.value.progress,this.needsRender=!0}}}if(!this.disableMotion.ended){let{progress:t}=this.disableMotion.value;this.disableMotion.update(e),this.panoMesh.material.uniforms.disable.value=t,this.needsRender=!0}}dispose(){this.tapMotion.dispose(),this.progressMotion.dispose(),this.progressOpacityMotion.dispose(),this.opacityMotion.dispose(),this.currentMotion.dispose(),this.panoMesh.material.dispose()}};function Yb(e,t,n){let r=Math.abs(e-t);return r<.001||n!==void 0&&Math.abs(n-r)<.001}function Xb(e,t,n){return!Yb(e,t,n)}function Zb(e,t){return e.distanceTo(t)<.001}function Qb(e,t){return!Zb(e,t)}function $b(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}var ex,tx=typeof navigator<`u`?((ex=navigator==null?void 0:navigator.userAgent)==null?``:ex).toLowerCase():`node`;(()=>{try{let e=document.createElement(`canvas`);return!!(window.WebGLRenderingContext&&(e.getContext(`webgl`)||e.getContext(`experimental-webgl`)))}catch(e){return!1}})(),typeof history<`u`&&`pushState`in history&&`replaceState`in history&&`state`in history;var nx=/android/i.test(tx)||/webos/i.test(tx)||/ipad|iphone|ipod/i.test(tx)||/iemobile/i.test(tx)||/opera mini/i.test(tx)||/blackberry/i.test(tx)||/windows phone/i.test(tx);function $(e,t){let n=!1,r={type:e,timeStamp:G(),get defaultPrevented(){return n},preventDefault(){n=!0}};for(let e of Object.keys(t))e in r||(r[e]=t[e]);return r}function rx(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 ix(e,t){return e.workCode===t.workCode&&e.mode===t.mode&&e.panoIndex===t.panoIndex&&Yb(e.longitude,t.longitude,Math.PI*2)&&Yb(e.latitude,t.latitude)&&Yb(e.fov,t.fov)&&Zb(e.offset,t.offset)&&Yb(e.distance,t.distance)}function ax(e,t){e.longitude=t.longitude,e.latitude=t.latitude,e.fov=t.fov,e.distance=t.distance,e.offset.copy(t.offset)}function ox(e){return{longitude:e.longitude,latitude:e.latitude,fov:e.fov,offset:e.offset.clone(),distance:e.distance}}function sx(e){switch(e){case`Floorplan`:return!0;case`Mapview`:return!0;default:return!1}}function cx(e){switch(e){case`Panorama`:return!0;case`Model`:return!0;default:return!1}}function lx(e){for(let t in e)return!1;return!0}var ux=(0,d.uniform)(1),dx=(0,d.uv)(),fx=(0,d.float)(6.2831852),px=(0,d.float)(3.1415926),mx=fx.mul(dx.x),hx=px.mul(dx.y.sub(.5)),gx=hx.cos().abs(),_x=(0,d.normalize)((0,d.vec3)(mx.sin().negate().mul(gx),hx.sin().mul(ux),mx.cos().negate().mul(gx))),vx=(0,d.cubeTexture)(new c.CubeTexture,_x),yx=new c.NodeMaterial;yx.fragmentNode=vx,yx.transparent=!0,yx.depthTest=!1,yx.depthWrite=!1;var bx=new hy(yx);function xx(e,t,n){vx.value=t,ux.value=n?-1:1,bx.render(e),vx.value=null}var Sx=new c.Color,Cx=0,wx=1;function Tx(e,t,n,r){return an(this,void 0,void 0,function*(){let i=new c.RenderTarget(r.width,r.height,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:c.LinearFilter,minFilter:c.LinearFilter}),a=e.getRenderTarget();e.getClearColor(Sx);let o=e.getClearAlpha(),s=e.autoClear,l=e.autoClearColor,u=e.autoClearDepth,d=e.autoClearStencil;e.autoClear=!0,e.autoClearColor=!0,e.autoClearDepth=!0,e.autoClearStencil=!0,e.setRenderTarget(i),e.setClearColor(Cx,wx),xx(e,t,n),e.setRenderTarget(a),e.setClearColor(Sx,o),e.autoClear=s,e.autoClearColor=l,e.autoClearDepth=u,e.autoClearStencil=d;let f=yield e.readRenderTargetPixelsAsync(i,0,0,r.width,r.height);return r.data.set(f),i.dispose(),r})}var Ex=(function(e,t,n,r){"use strict";var i=[``,`webkit`,`Moz`,`MS`,`ms`,`o`],a=t.createElement?t.createElement(`div`):r,o=`function`,s=Math.round,c=Math.abs,l=Date.now;function u(e,t,n){return setTimeout(v(e,n),t)}function d(e,t,n){return Array.isArray(e)?(f(e,n[t],n),!0):!1}function f(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==r)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function p(t,n,r){var i=`DEPRECATED METHOD: `+n+`
|
|
1063
|
+
`+r+` AT
|
|
1064
|
+
`;return function(){var n=Error(`get-stack-trace`),r=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,``).replace(/^\s+at\s+/gm,``).replace(/^Object.<anonymous>\s*\(/gm,`{anonymous}()@`):`Unknown Stack Trace`,a=e.console&&(e.console.warn||e.console.log);return a&&a.call(e.console,i,r),t.apply(this,arguments)}}var m=typeof Object.assign==`function`?Object.assign:function(e){if(e===r||e===null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==r&&i!==null)for(var a in i)i.hasOwnProperty(a)&&(t[a]=i[a])}return t},h=p(function(e,t,n){for(var i=Object.keys(t),a=0;a<i.length;)(!n||n&&e[i[a]]===r)&&(e[i[a]]=t[i[a]]),a++;return e},`extend`,"Use `assign`."),g=p(function(e,t){return h(e,t,!0)},`merge`,"Use `assign`.");function _(e,t,n){var r=t.prototype,i=e.prototype=Object.create(r);i.constructor=e,i._super=r,n&&m(i,n)}function v(e,t){return function(){return e.apply(t,arguments)}}function y(e,t){return typeof e==o?e.apply(t&&t[0]||r,t):e}function b(e,t){return e===r?t:e}function x(e,t,n){f(T(t),function(t){e.addEventListener(t,n,!1)})}function S(e,t,n){f(T(t),function(t){e.removeEventListener(t,n,!1)})}function C(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function w(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function E(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function D(e){return Array.prototype.slice.call(e,0)}function O(e,t,n){for(var r=[],i=[],a=0;a<e.length;){var o=t?e[a][t]:e[a];E(i,o)<0&&r.push(e[a]),i[a]=o,a++}return n&&(r=t?r.sort(function(e,n){return e[t]>n[t]}):r.sort()),r}function k(e,t){for(var n,a,o=t[0].toUpperCase()+t.slice(1),s=0;s<i.length;){if(n=i[s],a=n?n+o:t,a in e)return a;s++}return r}var A=1;function j(){return A++}function M(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var N=/mobile|tablet|ip(ad|hone|od)|android/i,ee=`ontouchstart`in e,P=k(e,`PointerEvent`)!==r,F=ee&&N.test(navigator.userAgent),te=`touch`,ne=`pen`,I=`mouse`,re=`kinect`,ie=25,L=1,ae=2,R=4,z=8,oe=1,se=2,ce=4,le=8,ue=16,de=se|ce,fe=le|ue,pe=de|fe,me=[`x`,`y`],he=[`clientX`,`clientY`];function ge(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()}ge.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(M(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(M(this.element),this.evWin,this.domHandler)}};function _e(e){var t;return t=e.options.inputClass||(P?Le:F?Ge:ee?Ye:Ne),new t(e,ve)}function ve(e,t,n){var r=n.pointers.length,i=n.changedPointers.length,a=t&L&&r-i===0,o=t&(R|z)&&r-i===0;n.isFirst=!!a,n.isFinal=!!o,a&&(e.session={}),n.eventType=t,ye(e,n),e.emit(`hammer.input`,n),e.recognize(n),e.session.prevInput=n}function ye(e,t){var n=e.session,r=t.pointers,i=r.length;n.firstInput||(n.firstInput=Se(t)),i>1&&!n.firstMultiple?n.firstMultiple=Se(t):i===1&&(n.firstMultiple=!1);var a=n.firstInput,o=n.firstMultiple,s=o?o.center:a.center,u=t.center=Ce(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=De(s,u),t.distance=Ee(s,u),be(n,t),t.offsetDirection=Te(t.deltaX,t.deltaY);var d=we(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=d.x,t.overallVelocityY=d.y,t.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,t.scale=o?ke(o.pointers,r):1,t.rotation=o?Oe(o.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,xe(n,t);var f=e.element;C(t.srcEvent.target,f)&&(f=t.srcEvent.target),t.target=f}function be(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},a=e.prevInput||{};(t.eventType===L||a.eventType===R)&&(i=e.prevDelta={x:a.deltaX||0,y:a.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function xe(e,t){var n=e.lastInterval||t,i=t.timeStamp-n.timeStamp,a,o,s,l;if(t.eventType!=z&&(i>ie||n.velocity===r)){var u=t.deltaX-n.deltaX,d=t.deltaY-n.deltaY,f=we(i,u,d);o=f.x,s=f.y,a=c(f.x)>c(f.y)?f.x:f.y,l=Te(u,d),e.lastInterval=t}else a=n.velocity,o=n.velocityX,s=n.velocityY,l=n.direction;t.velocity=a,t.velocityX=o,t.velocityY=s,t.direction=l}function Se(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:s(e.pointers[n].clientX),clientY:s(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:Ce(t),deltaX:e.deltaX,deltaY:e.deltaY}}function Ce(e){var t=e.length;if(t===1)return{x:s(e[0].clientX),y:s(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:s(n/t),y:s(r/t)}}function we(e,t,n){return{x:t/e||0,y:n/e||0}}function Te(e,t){return e===t?oe:c(e)>=c(t)?e<0?se:ce:t<0?le:ue}function Ee(e,t,n){n||(n=me);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function De(e,t,n){n||(n=me);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.atan2(i,r)*180/Math.PI}function Oe(e,t){return De(t[1],t[0],he)+De(e[1],e[0],he)}function ke(e,t){return Ee(t[0],t[1],he)/Ee(e[0],e[1],he)}var Ae={mousedown:L,mousemove:ae,mouseup:R},je=`mousedown`,Me=`mousemove mouseup`;function Ne(){this.evEl=je,this.evWin=Me,this.pressed=!1,ge.apply(this,arguments)}_(Ne,ge,{handler:function(e){var t=Ae[e.type];t&L&&(e.button===0||e.button===2)&&(this.pressed=!0),t&ae&&e.which!==1&&(t=R),this.pressed&&(t&R&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:I,srcEvent:e}))}});var Pe={pointerdown:L,pointermove:ae,pointerup:R,pointercancel:z,pointerout:z},Fe={2:te,3:ne,4:I,5:re},B=`pointerdown`,Ie=`pointermove pointerup pointercancel`;e.MSPointerEvent&&!e.PointerEvent&&(B=`MSPointerDown`,Ie=`MSPointerMove MSPointerUp MSPointerCancel`);function Le(){this.evEl=B,this.evWin=Ie,ge.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}_(Le,ge,{handler:function(e){var t=this.store,n=!1,r=!1,i=Pe[e.type.toLowerCase().replace(`ms`,``)],a=Fe[e.pointerType]||e.pointerType,o=a==te,s=E(t,e.pointerId,`pointerId`);i&L&&(e.button===0||e.button===2||o)?s<0&&(t.push(e),s=t.length-1):i&(R|z)?n=!0:!o&&e.buttons===0&&(n=!0,r=!0,i=Pe.pointerup),!(s<0)&&(r||(t[s]=e),this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:t[s]}),n&&t.splice(s,1))}});var Re={touchstart:L,touchmove:ae,touchend:R,touchcancel:z},ze=`touchstart`,Be=`touchstart touchmove touchend touchcancel`;function Ve(){this.evTarget=ze,this.evWin=Be,this.started=!1,ge.apply(this,arguments)}_(Ve,ge,{handler:function(e){var t=Re[e.type];if(t===L&&(this.started=!0),this.started){var n=He.call(this,e,t);t&(R|z)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:te,srcEvent:e})}}});function He(e,t){var n=D(e.touches),r=D(e.changedTouches);return t&(R|z)&&(n=O(n.concat(r),`identifier`,!0)),[n,r]}var Ue={touchstart:L,touchmove:ae,touchend:R,touchcancel:z},We=`touchstart touchmove touchend touchcancel`;function Ge(){this.evTarget=We,this.targetIds={},ge.apply(this,arguments)}_(Ge,ge,{handler:function(e){var t=Ue[e.type],n=Ke.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:te,srcEvent:e})}});function Ke(e,t){var n=D(e.touches),r=this.targetIds;if(t&(L|ae)&&n.length===1)return r[n[0].identifier]=!0,[n,n];var i,a,o=D(e.changedTouches),s=[],c=this.target;if(a=n.filter(function(e){return C(e.target,c)}),t===L)for(i=0;i<a.length;)r[a[i].identifier]=!0,i++;for(i=0;i<o.length;)r[o[i].identifier]&&s.push(o[i]),t&(R|z)&&delete r[o[i].identifier],i++;if(s.length)return[O(a.concat(s),`identifier`,!0),s]}var qe=2500,Je=25;function Ye(){ge.apply(this,arguments);var e=v(this.handler,this);this.touch=new Ge(this.manager,e),this.mouse=new Ne(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}_(Ye,ge,{handler:function(e,t,n){var r=n.pointerType==te,i=n.pointerType==I;if(!(i&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)Xe.call(this,t,n);else if(i&&Qe.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Xe(e,t){e&L?(this.primaryTouch=t.changedPointers[0].identifier,Ze.call(this,t)):e&(R|z)&&Ze.call(this,t)}function Ze(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)},qe)}}function Qe(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],a=Math.abs(t-i.x),o=Math.abs(n-i.y);if(a<=Je&&o<=Je)return!0}return!1}var $e=a?k(a.style,`touchAction`):r,et=$e!==r,tt=`compute`,nt=`auto`,rt=`manipulation`,it=`none`,at=`pan-x`,ot=`pan-y`,st=ut();function ct(e,t){this.manager=e,this.set(t)}ct.prototype={set:function(e){e==tt&&(e=this.compute()),et&&this.manager.element.style&&st[e]&&(this.manager.element.style[$e]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return f(this.manager.recognizers,function(t){y(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),lt(e.join(` `))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented){t.preventDefault();return}var r=this.actions,i=w(r,it)&&!st[it],a=w(r,ot)&&!st[ot],o=w(r,at)&&!st[at];if(i){var s=e.pointers.length===1,c=e.distance<2,l=e.deltaTime<250;if(s&&c&&l)return}if(!(o&&a)&&(i||a&&n&de||o&&n&fe))return this.preventSrc(t)},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};function lt(e){if(w(e,it))return it;var t=w(e,at),n=w(e,ot);return t&&n?it:t||n?t?at:ot:w(e,rt)?rt:nt}function ut(){if(!et)return!1;var t={},n=e.CSS&&e.CSS.supports;return[`auto`,`manipulation`,`pan-y`,`pan-x`,`pan-x pan-y`,`none`].forEach(function(r){t[r]=n?e.CSS.supports(`touch-action`,r):!0}),t}var dt=1,ft=2,pt=4,V=8,mt=V,ht=16,gt=32;function _t(e){this.options=m({},this.defaults,e||{}),this.id=j(),this.manager=null,this.options.enable=b(this.options.enable,!0),this.state=dt,this.simultaneous={},this.requireFail=[]}_t.prototype={defaults:{},set:function(e){return m(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(d(e,`recognizeWith`,this))return this;var t=this.simultaneous;return e=bt(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,`dropRecognizeWith`,this)?this:(e=bt(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(d(e,`requireFailure`,this))return this;var t=this.requireFail;return e=bt(e,this),E(t,e)===-1&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,`dropRequireFailure`,this))return this;e=bt(e,this);var t=E(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<V&&r(t.options.event+vt(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=V&&r(t.options.event+vt(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=gt},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(gt|dt)))return!1;e++}return!0},recognize:function(e){var t=m({},e);if(!y(this.options.enable,[this,t])){this.reset(),this.state=gt;return}this.state&(mt|ht|gt)&&(this.state=dt),this.state=this.process(t),this.state&(ft|pt|V|ht)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}};function vt(e){return e&ht?`cancel`:e&V?`end`:e&pt?`move`:e&ft?`start`:``}function yt(e){return e==ue?`down`:e==le?`up`:e==se?`left`:e==ce?`right`:``}function bt(e,t){var n=t.manager;return n?n.get(e):e}function xt(){_t.apply(this,arguments)}_(xt,_t,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return t===0||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,r=t&(ft|pt),i=this.attrTest(e);return r&&(n&z||!i)?t|ht:r||i?n&R?t|V:t&ft?t|pt:ft:gt}});function St(){xt.apply(this,arguments),this.pX=null,this.pY=null}_(St,xt,{defaults:{event:`pan`,threshold:10,pointers:1,direction:pe},getTouchAction:function(){var e=this.options.direction,t=[];return e&de&&t.push(ot),e&fe&&t.push(at),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,a=e.deltaX,o=e.deltaY;return i&t.direction||(t.direction&de?(i=a===0?oe:a<0?se:ce,n=a!=this.pX,r=Math.abs(e.deltaX)):(i=o===0?oe:o<0?le:ue,n=o!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return xt.prototype.attrTest.call(this,e)&&(this.state&ft||!(this.state&ft)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=yt(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}});function Ct(){xt.apply(this,arguments)}_(Ct,xt,{defaults:{event:`pinch`,threshold:0,pointers:2},getTouchAction:function(){return[it]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&ft)},emit:function(e){if(e.scale!==1){var t=e.scale<1?`in`:`out`;e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}});function wt(){_t.apply(this,arguments),this._timer=null,this._input=null}_(wt,_t,{defaults:{event:`press`,pointers:1,time:251,threshold:9},getTouchAction:function(){return[nt]},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&(R|z)&&!i)this.reset();else if(e.eventType&L)this.reset(),this._timer=u(function(){this.state=mt,this.tryEmit()},t.time,this);else if(e.eventType&R)return mt;return gt},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===mt&&(e&&e.eventType&R?this.manager.emit(this.options.event+`up`,e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function Tt(){xt.apply(this,arguments)}_(Tt,xt,{defaults:{event:`rotate`,threshold:0,pointers:2},getTouchAction:function(){return[it]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&ft)}});function Et(){xt.apply(this,arguments)}_(Et,xt,{defaults:{event:`swipe`,threshold:10,velocity:.3,direction:de|fe,pointers:1},getTouchAction:function(){return St.prototype.getTouchAction.call(this)},attrTest:function(e){var t=this.options.direction,n;return t&(de|fe)?n=e.overallVelocity:t&de?n=e.overallVelocityX:t&fe&&(n=e.overallVelocityY),this._super.attrTest.call(this,e)&&t&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&c(n)>this.options.velocity&&e.eventType&R},emit:function(e){var t=yt(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}});function Dt(){_t.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}_(Dt,_t,{defaults:{event:`tap`,pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[rt]},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&L&&this.count===0)return this.failTimeout();if(r&&i&&n){if(e.eventType!=R)return this.failTimeout();var a=this.pTime?e.timeStamp-this.pTime<t.interval:!0,o=!this.pCenter||Ee(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!o||!a?this.count=1:this.count+=1,this._input=e,this.count%t.taps===0)return this.hasRequireFailures()?(this._timer=u(function(){this.state=mt,this.tryEmit()},t.interval,this),ft):mt}return gt},failTimeout:function(){return this._timer=u(function(){this.state=gt},this.options.interval,this),gt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==mt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Ot(e,t){return t=t||{},t.recognizers=b(t.recognizers,Ot.defaults.preset),new jt(e,t)}Ot.VERSION=`2.0.7`,Ot.defaults={domEvents:!1,touchAction:tt,enable:!0,inputTarget:null,inputClass:null,preset:[[Tt,{enable:!1}],[Ct,{enable:!1},[`rotate`]],[Et,{direction:de}],[St,{direction:de},[`swipe`]],[Dt],[Dt,{event:`doubletap`,taps:2},[`tap`]],[wt]],cssProps:{userSelect:`none`,touchSelect:`none`,touchCallout:`none`,contentZooming:`none`,userDrag:`none`,tapHighlightColor:`rgba(0,0,0,0)`}};var kt=1,At=2;function jt(e,t){this.options=m({},Ot.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=_e(this),this.touchAction=new ct(this,this.options.touchAction),Mt(this,!0),f(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}jt.prototype={set:function(e){return m(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?At:kt},recognize:function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var n,r=this.recognizers,i=t.curRecognizer;(!i||i&&i.state&mt)&&(i=t.curRecognizer=null);for(var a=0;a<r.length;)n=r[a],t.stopped!==At&&(!i||n==i||n.canRecognizeWith(i))?n.recognize(e):n.reset(),!i&&n.state&(ft|pt|V)&&(i=t.curRecognizer=n),a++}},get:function(e){if(e instanceof _t)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(d(e,`add`,this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(d(e,`remove`,this))return this;if(e=this.get(e),e){var t=this.recognizers,n=E(t,e);n!==-1&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==r&&t!==r){var n=this.handlers;return f(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==r){var n=this.handlers;return f(T(e),function(e){t?n[e]&&n[e].splice(E(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&H(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(!(!n||!n.length)){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},destroy:function(){this.element&&Mt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Mt(e,t){var n=e.element;if(n.style){var r;f(e.options.cssProps,function(i,a){r=k(n.style,a),t?(e.oldCssProps[r]=n.style[r],n.style[r]=i):n.style[r]=e.oldCssProps[r]||``}),t||(e.oldCssProps={})}}function H(e,n){var r=t.createEvent(`Event`);r.initEvent(e,!0,!0),r.gesture=n,n.target.dispatchEvent(r)}return m(Ot,{INPUT_START:L,INPUT_MOVE:ae,INPUT_END:R,INPUT_CANCEL:z,STATE_POSSIBLE:dt,STATE_BEGAN:ft,STATE_CHANGED:pt,STATE_ENDED:V,STATE_RECOGNIZED:mt,STATE_CANCELLED:ht,STATE_FAILED:gt,DIRECTION_NONE:oe,DIRECTION_LEFT:se,DIRECTION_RIGHT:ce,DIRECTION_UP:le,DIRECTION_DOWN:ue,DIRECTION_HORIZONTAL:de,DIRECTION_VERTICAL:fe,DIRECTION_ALL:pe,Manager:jt,Input:ge,TouchAction:ct,TouchInput:Ge,MouseInput:Ne,PointerEventInput:Le,TouchMouseInput:Ye,SingleTouchInput:Ve,Recognizer:_t,AttrRecognizer:xt,Tap:Dt,Pan:St,Swipe:Et,Pinch:Ct,Rotate:Tt,Press:wt,on:x,off:S,each:f,merge:g,extend:h,assign:m,inherit:_,bindFn:v,prefixed:k}),Ot})(typeof window<`u`?window:{},typeof document<`u`?document:{},`Hammer`),Dx=class e extends Lt{static parseArgs(t){return t instanceof e?t:Object.assign({},t)}static initAnimationEndState(e){var t,n,r,i,a,o,s,c;let l=this.parseArgs(e),{state:u,currentState:d}=l.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=l.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex};return Object.assign(Object.assign({},f),{mode:``,longitude:(i=u.longitude)==null?d.longitude:i,latitude:(a=u.latitude)==null?d.latitude:a,fov:(o=u.fov)==null?d.fov:o,offset:(s=u.offset)==null?d.offset:s,distance:(c=u.distance)==null?d.distance:c})}constructor(t){var n,r,i;super();let a=e.parseArgs(t);this.mode=``,this.pending=new Set,this.userAction=a.initial.userAction,this.destroyed=!1,this.fiveId=a.fiveId,this.scene=a.scene,this.modelScene=a.modelScene,this.xrCustomObjectsScene=a.xrCustomObjectsScene,this.helper=a.helper,this.camera=a.camera,this.renderer=a.renderer,this.viewport=a.viewport,this.element=a.element,this.enableWheel=a.enableWheel,this.works=a.works,this.imageOptions=a.imageOptions,this.videoTexture=a.videoTexture,this.extraElements=a.extraElements,this.initial=a.initial,this.currentPano=typeof this.initial.state.panoIndex==`number`?{workCode:(i=(n=this.initial.state.workCode)==null?(r=a.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:this.initial.state.panoIndex}:{workCode:this.initial.currentState.workCode,panoIndex:this.initial.currentState.panoIndex},this.needsRender=!0,this.cameraMotion=new J({longitude:{value:this.camera.pose.longitude,circle:[0,Math.PI*2]},latitude:this.camera.pose.latitude,fov:this.camera.pose.fov}),this.inMomentumMovement=null,this.eventUnbinds=[a.element].concat(a.extraElements||[]).map(e=>this.bindEvents(e)),this.initAnimationIsReady=!1,this.pending.add(`init-animation`),this.initAnimationReady=new Promise(e=>{Lc.shared.add(()=>{this.initAnimation().then(()=>{this.initAnimationIsReady=!0,this.pending.delete(`init-animation`),e()})},!0,0)})}updateConfiguration(e){return!0}destroy(){var e;this.stopMomentumMovement(),this.destroyed=!0,this.off(),this.cameraMotion.dispose();for(let e of this.eventUnbinds)e();this.panState=void 0,(e=this.pressState)==null||e.stop(),this.pressState=void 0}isReady(){return this.inMomentumMovement===null&&this.pending.size===0&&this.cameraMotion.ended===!0}bindExtraElement(e){for(let t of this.eventUnbinds)if(t.element===e)return;this.eventUnbinds.push(this.bindEvents(e))}unbindExtraElement(e){let t=[];for(let n of this.eventUnbinds)n.element===e?n():t.push(n);this.eventUnbinds=t}updateModel(e){this.needsRender=!0}updateWork(e,t,n,r){return this.works=e,this.userAction=r,!1}updateTime(e,t,...n){if(this.destroyed)return;let r={};this.cameraMotion.ended&&(this.cameraMotion.update(e),r.longitude=this.cameraMotion.value.longitude,r.latitude=this.cameraMotion.value.latitude,r.fov=this.cameraMotion.value.fov),lx(r)&&this.setCamera(r)}render(){return!1}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={};return e.longitude!==void 0&&(r.longitude=e.longitude),e.latitude!==void 0&&(r.latitude=e.latitude),e.fov!==void 0&&(r.fov=e.fov),this.cameraMotion.set(r,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.cameraMotion.setKeyframes(r,t)})}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(G())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance})}initAnimation(){let{state:t,currentState:n,duration:r,userAction:i}=this.initial,a=e.initAnimationEndState(this);return this.userAction=i,this.emit(`initAnimation.start`,$(`initAnimation.start`,{state:a,userAction:this.userAction})),this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:a,userAction:this.userAction})),Promise.resolve()}setCamera(e={}){var t,n,r,i,a;let o=(t=e.longitude)==null?this.camera.pose.longitude:t,s=(n=e.latitude)==null?this.camera.pose.latitude:n,c=(r=e.fov)==null?this.camera.pose.fov:r,l=(i=e.distance)==null?this.camera.pose.distance:i,u=(a=e.offset)==null?this.camera.pose.offset:a,d=Xb(o,this.camera.pose.longitude,Math.PI*2)||Xb(s,this.camera.pose.latitude),f=Xb(c,this.camera.pose.fov),p=Xb(l,this.camera.pose.distance),m=Qb(u,this.camera.pose.offset);(f||d||m||p)&&(this.camera.setFromPose({longitude:o,latitude:s,fov:c,distance:l,offset:u}),this.emit(`camera.update`,$(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:s,fov:c,offset:u,distance:l})})),this.needsRender=!0)}stopMomentumMovement(){if(this.inMomentumMovement&&this.inMomentumMovement.event&&!this.inMomentumMovement.event.defaultPrevented&&!this.inMomentumMovement.event.isFinal){let e=$(`gesture.momentum`,Object.assign(Object.assign({},this.inMomentumMovement.event),{isFirst:!1,isFinal:!0}));this.emit(`gesture.momentum`,e)}this.inMomentumMovement=null}onPanGesture(e){this.stopMomentumMovement(),this.emit(`gesture.pan`,e)}onTapGesture(e){this.stopMomentumMovement(),this.emit(`gesture.tap`,e)}onDblTapGesture(e){this.stopMomentumMovement(),this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(e.type=`gesture.tap`,this.onTapGesture(e))}onPressGesture(e){this.stopMomentumMovement(),this.emit(`gesture.press`,e)}onPinchGesture(e){this.stopMomentumMovement(),this.emit(`gesture.pinch`,e)}onMouseWheel(e){this.stopMomentumMovement(),this.emit(`gesture.mousewheel`,e)}onMouseMove(e){this.stopMomentumMovement(),this.emit(`gesture.mousemove`,e)}relativeClientPosition(e){let{top:t,left:n,width:r,height:i}=this.element.getBoundingClientRect();return n+=r*this.viewport.left,t+=i*(1-this.viewport.bottom-this.viewport.height),r*=this.viewport.width,i*=this.viewport.height,new c.Vector2((e.x-n)/r*2-1,-(e.y-t)/i*2+1)}createRaycasterFromCamera(e,t){let n=new c.Raycaster;return n.params.Points={threshold:.1},n.firstHitOnly=!0,n.near=t.near,n.far=t.far,n.setFromCamera(e,this.camera),n}bindEvents(e){let t=e=>{let t=this.relativeClientPosition(e);return!(Math.abs(t.x)>1||Math.abs(t.y)>1)},n=e=>({button:`button`in e?e.button:0,buttons:`buttons`in e?e.buttons:0,shiftKey:`shiftKey`in e?e.shiftKey:!1,ctrlKey:`ctrlKey`in e?e.ctrlKey:!1,altKey:`altKey`in e?e.altKey:!1,metaKey:`metaKey`in e?e.metaKey:!1}),r=new Ex.Manager(e),i=e=>e.session.firstInput||null,a=new Ex.Pan({threshold:10,pointers:0}),o=new Ex.Tap({interval:410}),s=new Ex.Pinch({threshold:0,pointers:2});r.add([a,o,s]),r.on(`panstart pan`,e=>{let a=n(e.srcEvent),o=i(r);if(o&&!t(o.center))return;let s=$(`gesture.pan`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})}),isFirst:e.isFirst,isFinal:e.isFinal,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))});this.emit(`gesture.create`,s),this.onPanGesture(s),v()}),r.on(`tap`,e=>{let a=n(e.srcEvent);if(e.pointerType===`mouse`&&a.button!==0)return;let o=i(r);if(o&&!t(o.center))return;let s=$(`gesture.tap`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})}),isFirst:!0,isFinal:!0,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))});this.emit(`gesture.create`,s),this.onTapGesture(s),v()}),r.on(`pinchstart pinch pinchend`,e=>{let a=n(e.srcEvent),o=i(r);if(o&&!t(o.center))return;let s=$(`gesture.pinch`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{var t;let n=this.relativeClientPosition(e),r=new c.Raycaster;return r.params.Points={threshold:.1},r.setFromCamera(n,this.camera),Object.assign(Object.assign({x:e.x,y:e.y,delta:(t=e.delta)==null?0:t},a),{coords:n,raycaster:r})}),isFirst:e.type===`pinchstart`,isFinal:e.type===`pinchend`,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))});this.emit(`gesture.create`,s),this.onPinchGesture(s),v()}),r.on(`dbltap`,e=>{let a=n(e.srcEvent);if(e.pointerType===`mouse`&&a.button!==0)return;let o=i(r);if(o&&!t(o.center))return;let s=$(`gesture.dbltap`,{target:e.target,pointerType:e.pointerType,srcEvent:e.srcEvent,pointers:e.pointers.map(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})}),isFirst:!0,isFinal:!0,scale:e.scale,center:(e=>{let t=this.relativeClientPosition(e),n=this.createRaycasterFromCamera(t,this.camera);return Object.assign(Object.assign({x:e.x,y:e.y,delta:0},a),{coords:t,raycaster:n})})(e.center),velocityX:e.velocityX,velocityY:e.velocityY,overallVelocityX:e.overallVelocityX,overallVelocityY:e.overallVelocityY,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))});this.emit(`gesture.create`,s),this.onDblTapGesture(s),v()});let l=null,u=null,d=(e,t,r)=>{let i={x:r.clientX,y:r.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),n(r)),{delta:0}),c=e===`pinchend`?t:t-r.deltaY/280;return $(`gesture.pinch`,{target:r.target,pointerType:`mouse`,srcEvent:r,pointers:[Object.assign({},s)],isFirst:e===`pinchstart`,isFinal:e===`pinchend`,scale:H(c,.1,10),center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))})},f=e=>{var r;if(t({x:e.clientX,y:e.clientY})){if(e.preventDefault(),e.ctrlKey){let t=(r=l==null?void 0:l.prevEvent.scale)==null?1:r,n=d(l?`pinch`:`pinchstart`,t,e);this.emit(`gesture.create`,n),l===null?l={firstEvent:n,prevEvent:n}:l.prevEvent=n,this.emit(`gesture.create`,n),this.onPinchGesture(n),u!==null&&window.clearTimeout(u),u=window.setTimeout(()=>{var t;u=null;let n=d(`pinchend`,(t=l==null?void 0:l.prevEvent.scale)==null?1:t,e);this.emit(`gesture.create`,n),l=null,this.onPinchGesture(n)},200)}else{let t=(Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX)/-60,r=this.mouseWheelState!==void 0,i={x:e.clientX,y:e.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),n(e)),{delta:t}),c=$(`gesture.mousewheel`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},s)],isFirst:r,isFinal:!1,scale:0,center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))});this.emit(`gesture.create`,c),this.onMouseWheel(c),this.mouseWheelState&&clearTimeout(this.mouseWheelState.timer),this.mouseWheelState={timer:setTimeout(()=>{this.mouseWheelState=void 0;let t=$(`gesture.mousewheel`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign(Object.assign({},s),{delta:0})],isFirst:!1,isFinal:!0,scale:0,center:Object.assign(Object.assign({},s),{delta:0}),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))});this.emit(`gesture.create`,t),this.onMouseWheel(t)},100)}}v()}},p=e=>{if(nx)return;if(!t({x:e.clientX,y:e.clientY})){m();return}let r=!1;this.mouseMoveState||(r=!0);let i={x:e.clientX,y:e.clientY},a=this.relativeClientPosition(i),o=this.createRaycasterFromCamera(a,this.camera),s=Object.assign(Object.assign(Object.assign(Object.assign({},i),{coords:a,raycaster:o}),n(e)),{delta:0}),c=$(`gesture.mousemove`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},s)],isFirst:r,isFinal:!1,scale:0,center:Object.assign({},s),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))});this.emit(`gesture.create`,c),this.mouseMoveState={timeStamp:G(),event:c},this.onMouseMove(c),this.pressState&&Math.abs(e.clientX-this.pressState.event.center.y)>10&&Math.abs(e.clientY-this.pressState.event.center.y)>10&&v()},m=()=>{if(this.mouseMoveState){let e=$(this.mouseMoveState.event.type,Object.assign(Object.assign({},this.mouseMoveState.event),{isFinal:!0}));this.emit(`gesture.create`,e),this.mouseMoveState=void 0,this.onMouseMove(e)}v()},h=e=>{if(!t(e.center)){v();return}let n=!1;this.pressState||(n=!0,this.pressState={event:e,timeStamp:G(),stop:K});let r=G()-this.pressState.timeStamp,i=$(this.pressState.event.type,Object.assign(Object.assign({},this.pressState.event),{isFirst:n,isFinal:!1,center:Object.assign(Object.assign({},this.pressState.event.center),{delta:r}),pointers:this.pressState.event.pointers.map(e=>Object.assign(Object.assign({},e),{delta:r}))}));this.emit(`gesture.create`,i),this.onPressGesture(i),this.pressState&&(this.pressState.stop=Lc.shared.add(t=>{h(e)},!0,1))},g=e=>{if(v(),e.touches.length>1||e.changedTouches.length<=0)return;let t={x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY},r=this.relativeClientPosition(t),i=this.createRaycasterFromCamera(r,this.camera),a=Object.assign(Object.assign(Object.assign(Object.assign({},t),{coords:r,raycaster:i}),n(e)),{delta:0}),o=$(`gesture.press`,{target:e.target,pointerType:`touch`,srcEvent:e,pointers:[Object.assign({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))});this.emit(`gesture.create`,o),h(o)},_=e=>{v();let t={x:e.clientX,y:e.clientY},r=this.relativeClientPosition(t),i=this.createRaycasterFromCamera(r,this.camera),a=Object.assign(Object.assign(Object.assign(Object.assign({},t),{coords:r,raycaster:i}),n(e)),{delta:0}),o=$(`gesture.press`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},a)],isFirst:!1,isFinal:!1,scale:0,center:a,velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))});this.emit(`gesture.create`,o),h(o)},v=()=>{var e;if(this.pressState){let t=G()-this.pressState.timeStamp,n=$(this.pressState.event.type,Object.assign(Object.assign({},this.pressState.event),{center:Object.assign(Object.assign({},this.pressState.event.center),{delta:t}),isFirst:!1,isFinal:!0,pointers:this.pressState.event.pointers.map(e=>Object.assign(Object.assign({},e),{delta:t}))}));this.emit(`gesture.create`,n),this.onPressGesture(n),(e=this.pressState)==null||e.stop(),this.pressState=void 0}},y=null,b=e=>{var t,r,i;let a=!1,o=!1;switch(e.type){case`gesturestart`:a=!0;break;case`gestureend`:o=!0;break;default:break}let s={x:(t=e.clientX)==null?0:t,y:(r=e.clientY)==null?0:r},c=this.relativeClientPosition(s),l=this.createRaycasterFromCamera(c,this.camera),u=Object.assign(Object.assign(Object.assign(Object.assign({},s),{coords:c,raycaster:l}),n(e)),{delta:0});return $(`gesture.pinch`,{target:e.target,pointerType:`mouse`,srcEvent:e,pointers:[Object.assign({},u)],isFirst:a,isFinal:o,scale:(i=e.scale)==null?1:i,center:Object.assign({},u),velocityX:0,velocityY:0,overallVelocityX:0,overallVelocityY:0,userAction:!0,state:Object.assign(Object.assign({mode:this.mode},this.currentPano),ox(this.camera.pose))})},x=e=>{if(e.preventDefault(),nx)return;let n=b(e);this.emit(`gesture.create`,n),y={firstEvent:n};let r=y.firstEvent;r&&!t(r.center)||this.onPinchGesture(n)},S=e=>{if(e.preventDefault(),nx||!y)return;let n=y.firstEvent;if(n&&!t(n.center))return;let r=b(e);this.emit(`gesture.create`,r),this.onPinchGesture(r)},C=e=>{if(e.preventDefault(),nx||!y)return;let n=y.firstEvent;if(y=null,n&&!t(n.center))return;let r=b(e);this.emit(`gesture.create`,r),this.onPinchGesture(r)},w=t=>{if(t&&typeof t.preventDefault==`function`&&t.currentTarget===e&&t.preventDefault(),typeof getSelection==`function`){let e=getSelection();e&&e.focusNode&&(e.removeAllRanges&&e.removeAllRanges(),e.empty&&e.empty())}};return this.enableWheel&&e.addEventListener(`wheel`,f,{passive:!1}),e.addEventListener(`mousemove`,p,!1),e.addEventListener(`mouseout`,m,!1),e.addEventListener(`touchstart`,g,{passive:!0}),e.addEventListener(`touchend`,v,!1),e.addEventListener(`touchcancel`,v,!1),e.addEventListener(`mousedown`,_,!1),e.addEventListener(`mouseup`,v,!1),e.addEventListener(`gesturestart`,x,{passive:!1}),e.addEventListener(`gesturechange`,S,{passive:!1}),e.addEventListener(`gestureend`,C,{passive:!1}),e.addEventListener(`touchstart`,w,{passive:!1}),e.addEventListener(`contextmenu`,w,!1),Object.assign(()=>{r.destroy(),e.removeEventListener(`wheel`,f,!1),e.removeEventListener(`mousemove`,p,!1),e.removeEventListener(`mouseout`,m,!1),e.removeEventListener(`touchstart`,g,!1),e.removeEventListener(`touchend`,v,!1),e.removeEventListener(`touchcancel`,v,!1),e.removeEventListener(`mousedown`,_,!1),e.removeEventListener(`mouseup`,v,!1),e.removeEventListener(`gesturestart`,x,!1),e.removeEventListener(`gesturechange`,S,!1),e.removeEventListener(`gestureend`,C,!1),e.removeEventListener(`touchstart`,w,!1),e.removeEventListener(`contextmenu`,w,!1)},{element:e})}},Ox=new c.CircleGeometry(.1,16),kx=(0,d.uv)(),Ax=(0,d.vec2)(.5,.5).sub(kx).length(),jx=(0,d.float)(.01),Mx=(0,d.float)(.49),Nx=(0,d.float)(.29),Px=(0,d.float)(1).sub((0,d.smoothstep)(Mx.sub(jx),Mx,Ax)),Fx=(0,d.smoothstep)(Nx,Nx.add(jx),Ax),Ix=(0,d.vec4)(.576,.635,1,.3),Lx=(0,d.vec4)(1,1,1,(0,d.abs)(Ax.sub(Mx.add(Nx).div(2))).div(Mx.sub(Nx)).mul(1.5).add(.1).clamp(0,1)),Rx=(0,d.mix)(Ix,Lx,Lx.w),zx=(0,d.vec4)(Rx.xyz,Rx.w.mul(Px).mul(Fx)),Bx=new c.NodeMaterial;Bx.fragmentNode=zx,Bx.side=c.DoubleSide,Bx.blending=c.CustomBlending,Bx.blendSrc=c.SrcAlphaFactor,Bx.blendDst=c.OneMinusSrcAlphaFactor,Bx.blendSrcAlpha=c.OneFactor,Bx.blendDstAlpha=c.OneMinusSrcAlphaFactor,Bx.depthWrite=!1,Bx.transparent=!0;var Vx=class extends c.Object3D{constructor(){super(),this.ringMesh=new c.Mesh(Ox,Bx),this.ringMesh.position.z=.01,this.ringMesh.renderOrder=9999999999,this.add(this.ringMesh)}dispose(){this.remove(this.ringMesh)}},Hx={gamma:1,minContentBoost:1,maxContentBoost:1,hdrCapacityMin:1,hdrCapacityMax:1};function Ux(e,t){let n=Number(e);return isNaN(n)||!isFinite(n)?t:n}function Wx(e){return e&&typeof e==`object`?{gamma:Ux(e.gamma,Hx.gamma),maxContentBoost:Ux(e.maxContentBoost,Hx.maxContentBoost),minContentBoost:Ux(e.minContentBoost,Hx.minContentBoost),hdrCapacityMin:Ux(e.hdrCapacityMin,Hx.hdrCapacityMin),hdrCapacityMax:Ux(e.hdrCapacityMax,Hx.hdrCapacityMax)}:Object.assign({},Hx)}var Gx=new c.Box3,Kx=new c.Vector3,qx={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultFov:80,maxFov:120,minFov:20,maxLatitude:Math.PI/2,minLatitude:-Math.PI/2,intersectMeshCreator:()=>new Vx},Jx=class e extends Dx{static distanceFromModel(e,t,n){let r=e.boundingBox,i=r.isEmpty()?10:Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),1/2);i=isNaN(i)||!isFinite(i)?1:i;let a=i/2/Math.tan(Math.PI*t/360);return n<1&&(a/=n),isNaN(a)||!isFinite(a)?i:a}static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{defaultLongitude:(n=t.defaultLongitude)==null?qx.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?qx.defaultLatitude:r,defaultFov:(i=t.defaultFov)==null?qx.defaultFov:i,maxFov:(a=t.maxFov)==null?qx.maxFov:a,minFov:(o=t.minFov)==null?qx.minFov:o,maxLatitude:(s=t.maxLatitude)==null?qx.maxLatitude:s,minLatitude:(c=t.minLatitude)==null?qx.minLatitude:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?qx.intersectMeshCreator:l})}static initAnimationEndState(t){var n,r,i,a,o,s,l;let u=this.parseArgs(t),{state:d,currentState:f}=t.initial,p=typeof d.panoIndex==`number`?{workCode:(i=(n=d.workCode)==null?(r=u.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:d.panoIndex}:{workCode:f.workCode,panoIndex:f.panoIndex},m=(a=d.fov)==null?u.defaultFov:a,h=(o=d.longitude)==null?sx(f.mode)?f.longitude:u.defaultLongitude:o,g=H(typeof u.minLatitude==`function`?u.minLatitude(m):u.minLatitude,-Math.PI/2,Math.PI/2),_=H(typeof u.maxLatitude==`function`?u.maxLatitude(m):u.maxLatitude,-Math.PI/2,Math.PI/2),v=H((s=d.latitude)==null?f.mode===`Floorplan`?f.latitude:u.defaultLatitude:s,g,_),y=d.offset?d.offset.clone():t.modelScene.boundingBox.getCenter(new c.Vector3),b=(l=d.distance)==null?e.distanceFromModel(u.modelScene,u.defaultFov,u.camera.aspect):l;return Object.assign(Object.assign({},p),{mode:`Floorplan`,longitude:h,latitude:v,fov:m,offset:y,distance:b})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Floorplan`,this.defaultLongitude=n.defaultLongitude,this.defaultLatitude=n.defaultLatitude,this.defaultFov=n.defaultFov,this.maxFov=n.maxFov,this.minFov=n.minFov,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.locationMotion=new J({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new J({modelAlpha:this.modelScene.parameter.resolveValue().modelAlpha}),this.perspToOrthoMotion=new J({perspToOrtho:this.camera.perspToOrtho.x}),this.pendingTextureId=null,this.textureLoader=new Yc,this.intersectMeshCreator=n.intersectMeshCreator,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return!0}destroy(){super.destroy(),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(e,t,n,r){var i;return this.works=e,this.updateCamera(t,(i=n.duration)==null?0:i,r),!0}updateModel(t){super.updateModel(t);let n=t.boundingBox.getCenter(new c.Vector3),r=e.distanceFromModel(t,this.defaultFov,this.camera.aspect);this.updateCamera({offset:n,distance:r},0,!0)}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,t,...n){if(this.destroyed)return;let r={},i={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),r.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),r.progress=1,r.pano0=r.pano1=t}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended||(this.locationMotion.update(e),i.distance=this.locationMotion.value.distance,i.offset=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z)),this.cameraMotion.ended||(this.cameraMotion.update(e),i.longitude=this.cameraMotion.value.longitude,i.latitude=this.cameraMotion.value.latitude,i.fov=this.cameraMotion.value.fov),lx(r)||this.modelScene.parameter.set(r),lx(i)||this.setCamera(i),this.intersectMesh&&this.intersectMesh.parent){let e=H(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1)}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(G())[1],t=this.locationMotion.getKeyFrameSegment(G())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new c.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s=Js(o,[`longitude`,`latitude`,`fov`]),c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,$(`initAnimation.start`,{state:o,userAction:this.userAction})),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(K),this.perspToOrthoMotion.set({perspToOrtho:0},i).catch(K),this.cameraMotion.set(s,i).catch(K),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),ox(this.camera.pose));this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}updateRenderSize(e){this.needsRender=!0}getForwardObserverOrNot(e){let[t]=this.modelScene.intersectRaycaster(e);if(!t)return null;let n=[];for(let t of this.works){let r=this.modelScene.models.find(e=>e.work===t);if(!(!r||r.visible===!1)&&!(t.observers.length<=0)&&(Gx.copy(t.observerBox).expandByScalar(10).applyMatrix4(t.transform),Gx.containsPoint(e.ray.origin)||e.ray.intersectsBox(Gx)))for(let e of t.observers)n.push(e)}let[r,i]=vf(n,e=>Kx.copy(e.standingPosition).applyMatrix4(e.work.transform).distanceTo(t.point),!0);return r&&i<Math.max(r.standingPosition.distanceTo(this.camera.position)/5,10)?r:null}coordinatesForOffset(e){let t=this.renderer.getSize(new c.Vector2);return{longitude:-2*e.x/(t.x*this.viewport.width),latitude:2*e.y/(t.y*this.viewport.height)}}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.998,a.longitude+=i.longitude,a.latitude+=i.latitude;let o=hi(this.cameraMotion.value.longitude+a.longitude),s=this.cameraMotion.value.fov,c=H(typeof this.minLatitude==`function`?this.minLatitude(s):this.minLatitude,-Math.PI/2,Math.PI/2),l=H(typeof this.maxLatitude==`function`?this.maxLatitude(s):this.maxLatitude,-Math.PI/2,Math.PI/2),u=H(this.cameraMotion.value.latitude+a.latitude,c,l),d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:o,latitude:u,fov:this.cameraMotion.value.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),f=!(i.longitude>1e-4||i.longitude<-1e-4||i.latitude>1e-4||i.latitude<-1e-4),p=$(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:f,state:d}));if(this.inMomentumMovement.event=p,this.emit(`gesture.momentum`,p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:o,latitude:u},0).catch(K),f?this.inMomentumMovement=null:Lc.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n)return;let r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.relativeClientPosition(e.center),a=1,o=this.camera.pose.latitude;Math.abs(o)>Math.PI/6&&(a=o<0?i.y<0?-1:1:i.y>0?-1:1),r.x*=a;let s=this.coordinatesForOffset(r),c=hi(this.cameraMotion.value.longitude+s.longitude),l=this.camera.pose.fov,u=H(typeof this.minLatitude==`function`?this.minLatitude(l):this.minLatitude,-Math.PI/2,Math.PI/2),d=H(typeof this.maxLatitude==`function`?this.maxLatitude(l):this.maxLatitude,-Math.PI/2,Math.PI/2),f=H(this.cameraMotion.value.latitude+s.latitude,u,d);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(f=this.cameraMotion.value.latitude);let p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:c,latitude:f,fov:l,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.state=p,this.emit(`gesture.pan`,e),!e.defaultPrevented&&(this.cameraMotion.set({longitude:p.longitude,latitude:p.latitude},0).catch(K),e.isFinal)){let t=e.velocityX*a,n=e.velocityY;this.inMomentumMovement={uuid:Mt()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:t,y:n}),0)}}onPinchGesture(e){var t;if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.panState=void 0,this.pinchState=void 0),n===void 0)return;let r=H(n/e.scale,this.minFov,this.maxFov),i=H(typeof this.minLatitude==`function`?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),a=H(typeof this.maxLatitude==`function`?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),o=H(this.cameraMotion.value.latitude,i,a);e.state.fov=r,e.state.latitude=o,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r,latitude:o},0).catch(K),this.onPanGesture(e))}onMouseMove(e){var t,n;if(!this.intersectMesh.parent||this.panState)return;if(this.emit(`gesture.mousemove`,e),e.defaultPrevented){this.hideIntersectMesh();return}let r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}let[i]=this.modelScene.intersectRaycaster(r),a=$(`intersect.update`,{raycaster:r,intersection:i==null?null:i,object:this.intersectMesh});if(this.emit(`intersect.update`,a),a.defaultPrevented){this.hideIntersectMesh();return}if(i){let e=(n=(t=i.face)==null?void 0:t.normal)==null?new c.Vector3().copy(r.ray.direction).multiplyScalar(-1):n,a=e.clone(),o=i.point.clone();this.intersectMesh.position.copy(o);let s=o.clone().add(a);if(this.intersectMesh.lookAt(s),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(o);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onMouseWheel(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let{minFov:t,maxFov:n}=this,r=H(this.camera.fov-e.center.delta,t,n),i=H(typeof this.minLatitude==`function`?this.minLatitude(r):this.minLatitude,-Math.PI/2,Math.PI/2),a=H(typeof this.maxLatitude==`function`?this.maxLatitude(r):this.maxLatitude,-Math.PI/2,Math.PI/2),o=H(this.cameraMotion.value.latitude,i,a);e.state.fov=r,e.state.latitude=o,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&this.cameraMotion.set({fov:r,latitude:o},0).catch(K)}onTapGesture(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();let n=e.center.raycaster,r=this.getForwardObserverOrNot(n);if(!r)this.emit(`gesture.tap`,e);else{let n={longitude:this.camera.pose.longitude,latitude:0},i=Object.assign(Object.assign({},e.state),{mode:`Panorama`,workCode:r.work.workCode,panoIndex:r.panoIndex,longitude:n.longitude,latitude:n.latitude,offset:r?r.position.clone():new c.Vector3,distance:0});if(e.state=i,this.emit(`gesture.tap`,e),!e.defaultPrevented&&(this.emit(`pano.select`,$(`pano.select`,{prevPano:this.currentPano,state:i,userAction:e.userAction,options:n,progress:0,error:null})),r&&r.active)){let e=this.pendingTextureId=Mt(),a=Sv({panoIndex:r.panoIndex,workCode:r.work.workCode}),o={right:r.images.work.getURL(r.images.right),left:r.images.work.getURL(r.images.left),up:r.images.work.getURL(r.images.up),down:r.images.work.getURL(r.images.down),front:r.images.work.getURL(r.images.front),back:r.images.work.getURL(r.images.back)},s=this.imageOptions.transform,l=Object.assign({key:`pano.${a}`},Js(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),u=`pano:`+bv([o,l,s]),d=this.modelScene.parameter,f;if(d.pano0&&d.pano0.map.name===u?f=d.pano0:d.pano1&&d.pano1.map.name===u&&(f=d.pano1),f)d.pano0&&d.pano0.map!==f.map&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==f.map&&d.pano1.map!==((t=d.pano0)==null?void 0:t.map)&&d.pano1.map.dispose(),d.set({pano0:f,pano1:f}),this.emit(`pano.request`,$(`pano.request`,{userAction:!0,prevPano:this.currentPano,progress:0,state:i,options:n,error:null}));else{let t,f=``;r.images.hdrConfig&&(t={right:r.images.work.getURL(r.images.gainmap_right),left:r.images.work.getURL(r.images.gainmap_left),up:r.images.work.getURL(r.images.gainmap_up),down:r.images.work.getURL(r.images.gainmap_down),front:r.images.work.getURL(r.images.gainmap_front),back:r.images.work.getURL(r.images.gainmap_back)},f=r.images.work.getURL(r.images.hdrConfig));let p=this.textureLoader.loadCubeTexture(o,{imageURL:{transform:s,options:l},format:c.RGBAFormat,viaAjax:!0,fetcher:w_(this.fiveId,r.work)},void 0,void 0,void 0,this.renderer),m=f?[fetch(f).then(e=>e.json()),this.textureLoader.loadCubeTexture(t,{imageURL:{transform:s,options:l},format:c.RGBAFormat,viaAjax:!0,fetcher:w_(this.fiveId,r.work)},void 0,void 0,void 0,this.renderer)]:[];Promise.all([p,...m]).then(t=>an(this,[t],void 0,function*([t,o,s]){var l,f;let{body:p}=t;if(this.destroyed||this.pendingTextureId!==e){p.dispose();return}this.pendingTextureId=null,p.name=u;let m=Array.isArray(p.image)?p.image[0]:p.image,h=(l=m==null?void 0:m.width)==null?2048:l,g=yield Tx(this.renderer,p,!0,My),_=new Iy().formPixels(g.data),v={panoId:a,map:p,mapSize:h,mapHistogram:new c.Vector4().fromArray(_.toArray()),matrix:r.matrix.clone().premultiply(r.work.transform),zoom:1,hdrConfig:o?Object.assign({map:s.body},Wx(o)):void 0};d.pano0&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==((f=d.pano0)==null?void 0:f.map)&&d.pano1.map.dispose(),d.set({pano0:v,pano1:v}),this.emit(`pano.request`,$(`pano.request`,{userAction:!0,prevPano:this.currentPano,progress:0,state:i,options:n,error:null}))})).catch(t=>{this.destroyed||this.pendingTextureId!==e||(this.pendingTextureId=null)})}}}}onDblTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.cameraMotion.value.fov,n=this.minFov-t<t-this.defaultFov?this.minFov:this.defaultFov;e.state.fov=n,this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:n},360).catch(K),this.hideIntersectMesh())}hideIntersectMesh(){this.intersectMesh.visible=!1,this.needsRender=!0}},Yx=Object.assign(Object.assign({},Ys(qx,[`defaultLongitude`,`defaultLatitude`,`maxLatitude`,`minLatitude`])),{defaultLongitude:0,defaultLatitude:Math.PI/2}),Xx=class e extends Jx{static parseArgs(t){var n,r;if(t instanceof e)return t;let i=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2,defaultLongitude:(n=t.defaultLongitude)==null?Yx.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?Yx.defaultLatitude:r});return super.parseArgs(i)}static initAnimationEndState(e){var t,n;let r=this.parseArgs(e),i=super.initAnimationEndState(Object.assign(Object.assign({},r),{initial:Object.assign(Object.assign({},r.initial),{state:Object.assign(Object.assign({},r.initial.state),{longitude:(t=r.initial.state.longitude)==null?r.defaultLongitude:t,latitude:(n=r.initial.state.latitude)==null?r.defaultLatitude:n})})}));return Object.assign(Object.assign({},i),{mode:`Topview`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Topview`}updateConfiguration(e){return super.updateConfiguration(Object.assign({},e))}updateModel(e){this.needsRender=!0;let t=this.modelScene.boundingBox.getCenter(new c.Vector3);this.locationMotion.set({x:t.x,y:t.y,z:t.z,distance:Jx.distanceFromModel(this.modelScene,this.defaultFov,this.camera.aspect)},0).catch(K),this.hideIntersectMesh()}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.y,z:t.value.offset.z}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={longitude:o.longitude,latitude:o.latitude,fov:o.fov},c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,$(`initAnimation.start`,{state:o,userAction:this.userAction})),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(K),this.perspToOrthoMotion.set({perspToOrtho:1},i).catch(K),this.cameraMotion.set(s,i).catch(K),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),ox(this.camera.pose));this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}requestMomentumMovement(){this.inMomentumMovement=null}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n)return;let r={x:e.center.x-t.x,y:e.center.y-t.y},i=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),a=this.locationMotion.value.distance;a*=Math.tan(this.cameraMotion.value.fov/2*Math.PI/180);let o=this.renderer.getSize(new c.Vector2),s=2*r.x*a/o.y,l=2*r.y*a/o.y,u=new c.Vector3;u.setFromMatrixColumn(this.camera.matrix,0),u.multiplyScalar(-s),i.add(u),u.setFromMatrixColumn(this.camera.matrix,1),u.multiplyScalar(l),i.add(u);let d=this.modelScene.boundingBox.getCenter(new c.Vector3),f=this.modelScene.boundingBox.getSize(new c.Vector3),p=Math.max(f.x,f.y,f.z)/2;i.clamp(d.clone().sub(new c.Vector3().setScalar(p)),d.clone().add(new c.Vector3().setScalar(p))),e.state=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:0,latitude:Math.PI/2,fov:this.cameraMotion.value.fov,offset:i,distance:this.locationMotion.value.distance}),this.emit(`gesture.pan`,e),!e.defaultPrevented&&this.locationMotion.set({x:i.x,y:i.y,z:i.z},0).catch(K)}onPinchGesture(e){var t;if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.pinchState=void 0),n===void 0)return;let r=H(n/e.scale,this.minFov,this.maxFov);e.state.fov=r,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:r},0).catch(K),e.type=`gesture.pan`,this.onPanGesture(e))}onMouseWheel(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement();let t=H(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov);e.state.fov=t,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&this.cameraMotion.set({fov:t},0).catch(K)}},Zx={defaultLatitude:0,defaultFov:90,maxFov:120,minFov:20,maxLatitude:e=>Math.PI/2-e/2/180*Math.PI,minLatitude:e=>-Math.PI/2+e/2/180*Math.PI,moveSpeed:3.6,intersectMeshCreator:()=>new Vx,aerialObserverMinHeight:5},Qx=class e extends Dx{static parseArgs(t){var n,r,i,a,o,s,c,l,u;if(t instanceof e)return t;let d=super.parseArgs(t);return Object.assign(Object.assign({},d),{defaultLatitude:(n=t.defaultLatitude)==null?Zx.defaultLatitude:n,defaultFov:(r=t.defaultFov)==null?Zx.defaultFov:r,maxFov:(i=t.maxFov)==null?Zx.maxFov:i,minFov:(a=t.minFov)==null?Zx.minFov:a,maxLatitude:(o=t.maxLatitude)==null?Zx.maxLatitude:o,minLatitude:(s=t.minLatitude)==null?Zx.minLatitude:s,moveSpeed:(c=t.moveSpeed)==null?Zx.moveSpeed:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?Zx.intersectMeshCreator:l,aerialObserverMinHeight:(u=t.aerialObserverMinHeight)==null?Zx.aerialObserverMinHeight:u})}static initAnimationEndState(e){var t,n,r,i,a,o;let s=this.parseArgs(e),l=s.works,{state:u,currentState:d}=e.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=s.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex},p=l.getObserver(f),m=H((i=u.fov)==null?cx(d.mode)?d.fov:s.defaultFov:i,s.minFov,s.maxFov),h=(a=u.longitude)==null?d.longitude:a,g=H(typeof s.minLatitude==`function`?s.minLatitude(m):s.minLatitude,-Math.PI/2,Math.PI/2),_=H(typeof s.maxLatitude==`function`?s.maxLatitude(m):s.maxLatitude,-Math.PI/2,Math.PI/2),v=H((o=u.latitude)==null?cx(d.mode)?d.latitude:s.defaultLatitude:o,g,_),y=new c.Vector3;return p&&y.copy(p.position).applyMatrix4(p.work.transform),{workCode:f.workCode,panoIndex:f.panoIndex,mode:`PanoramaLike`,longitude:h,latitude:v,fov:m,offset:y,distance:0}}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`PanoramaLike`,this.defaultLatitude=n.defaultLatitude,this.defaultFov=n.defaultFov,this.maxFov=n.maxFov,this.minFov=n.minFov,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.moveSpeed=n.moveSpeed,this.intersectMeshCreator=n.intersectMeshCreator,this.aerialObserverMinHeight=n.aerialObserverMinHeight,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.defaultFov!==void 0&&this.defaultFov!==e.defaultFov&&(this.defaultFov=e.defaultFov),e.maxFov!==void 0&&this.maxFov!==e.maxFov&&(this.maxFov=e.maxFov),e.minFov!==void 0&&this.minFov!==e.minFov&&(this.minFov=e.minFov),e.moveSpeed!==void 0&&this.moveSpeed!==e.moveSpeed&&(this.moveSpeed=e.moveSpeed),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return e.aerialObserverMinHeight!==void 0&&this.aerialObserverMinHeight!==e.aerialObserverMinHeight&&(this.aerialObserverMinHeight=e.aerialObserverMinHeight),!0}destroy(){super.destroy(),this.intersectMesh&&(this.helper.remove(this.intersectMesh),this.intersectMesh.dispose()),this.panState=void 0}isReady(){return this.panState||this.pinchState?!1:super.isReady()}calculateMovingDuration(e,t){switch(typeof e){case`function`:return e(t,this.moveSpeed);case`number`:return e;case`string`:return Number(e);default:return H(t,2,5)/this.moveSpeed*1e3}}hideIntersectMesh(){this.intersectMesh.visible=!1,this.needsRender=!0}coordinatesForOffset(e){let t=this.cameraMotion.value.fov,n=this.camera.aspect,r=this.renderer.getSize(new c.Vector2);return{longitude:2*e.x/(r.x*this.viewport.width)*t/95*n,latitude:-2*e.y/(r.y*this.viewport.height)*t/95}}cameraBounce(){let{longitude:e,latitude:t,fov:n}=this.cameraMotion.value,r=[{progress:0,value:{longitude:e,latitude:t,fov:n}},{progress:.5,value:{longitude:e,latitude:t,fov:n*.98}},{progress:1,value:{longitude:e,latitude:t,fov:n}}];this.cameraMotion.setKeyframes(r,500).catch(K)}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.99,a.longitude+=i.longitude,a.latitude+=i.latitude;let o=this.cameraMotion.value.fov,s=hi(this.cameraMotion.value.longitude+a.longitude),c=H(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),l=H(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),u=H(this.cameraMotion.value.latitude+a.latitude,c,l),d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:s,latitude:u,fov:o,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance}),f=!(i.longitude>1e-4||i.longitude<-1e-4||i.latitude>1e-4||i.latitude<-1e-4),p=$(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:f,state:d}));if(this.inMomentumMovement.event=p,this.emit(`gesture.momentum`,p),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:s,latitude:u},0).catch(K),f?this.inMomentumMovement=null:Lc.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=this.panState,n=e.pointers.length;if(e.isFinal?this.panState=void 0:this.panState={pointerLength:n,x:e.center.x,y:e.center.y},t===void 0||t.pointerLength!==n)return;let r={x:e.center.x-t.x,y:e.center.y-t.y},i=this.coordinatesForOffset(r),a=hi(this.cameraMotion.value.longitude+i.longitude),o=this.cameraMotion.value.fov,s=H(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),c=H(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),l=H(this.cameraMotion.value.latitude+i.latitude,s,c);this.camera.aspect<1&&Math.abs(e.overallVelocityX)>.2&&Math.atan2(Math.abs(e.overallVelocityY),Math.abs(e.overallVelocityX))<Math.PI/6.923&&(l=this.cameraMotion.value.latitude);let u=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:a,latitude:l,fov:o,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});if(e.state=u,this.emit(`gesture.pan`,e),e.defaultPrevented)return;let d={longitude:u.longitude,latitude:u.latitude,fov:u.fov};if(this.cameraMotion.set(d,0).catch(K),e.isFinal){let t=e.velocityX,n=e.velocityY*.6;Math.abs(n)>.5&&Math.abs(t)<.5&&(t=0),this.inMomentumMovement={uuid:Mt()},this.requestMomentumMovement(e,!0,this.coordinatesForOffset({x:t,y:n}),0)}}onPinchGesture(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();let n=(t=this.pinchState)==null?void 0:t.fov,r=e.scale;if(e.isFirst){this.pinchState={x:e.center.x,y:e.center.y,fov:this.cameraMotion.value.fov};return}if(e.isFinal&&(this.pinchState=void 0),n===void 0)return;let i=H(n/r,this.minFov,this.maxFov),a=H(typeof this.minLatitude==`function`?this.minLatitude(i):this.minLatitude,-Math.PI/2,Math.PI/2),o=H(typeof this.maxLatitude==`function`?this.maxLatitude(i):this.maxLatitude,-Math.PI/2,Math.PI/2),s=H(this.cameraMotion.value.latitude,a,o);e.state.fov=i,e.state.latitude=s,this.emit(`gesture.pinch`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:i,latitude:s},0).catch(K),e.type=`gesture.pan`,this.onPanGesture(e))}onMouseWheel(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=H(this.cameraMotion.value.fov-e.center.delta,this.minFov,this.maxFov),n=H(typeof this.minLatitude==`function`?this.minLatitude(t):this.minLatitude,-Math.PI/2,Math.PI/2),r=H(typeof this.maxLatitude==`function`?this.maxLatitude(t):this.maxLatitude,-Math.PI/2,Math.PI/2),i=H(this.cameraMotion.value.latitude,n,r);e.state.fov=t,e.state.latitude=i,this.emit(`gesture.mousewheel`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:t,latitude:i},0).catch(K),this.onMouseMove(e))}onMouseMove(e){var t,n;if(!this.intersectMesh.parent||this.panState||(this.emit(`gesture.mousemove`,e),e.defaultPrevented))return;let r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent){this.hideIntersectMesh();return}r.floorIndex=-1;let[i]=this.modelScene.intersectRaycaster(r),a=$(`intersect.update`,{raycaster:r,intersection:i==null?null:i,object:this.intersectMesh});if(this.emit(`intersect.update`,a),a.defaultPrevented){this.hideIntersectMesh();return}if(i){let e=(n=(t=i.face)==null?void 0:t.normal)==null?new c.Vector3().copy(r.ray.direction).multiplyScalar(-1):n,a=e.clone(),o=i.point.clone();this.intersectMesh.position.copy(o);let s=o.clone().add(a);if(this.intersectMesh.lookAt(s),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(o);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onDblTapGesture(e){this.userAction=e.userAction,this.stopMomentumMovement();let t=this.cameraMotion.value.fov,n=2,r=this.works.getObserver(this.currentPano);if(r){let e=r.images.tiles;e&&e.length&&(n=Math.max(...e.map(e=>e.level)))}let i=Math.max(40-n*5,this.minFov,5),a=i-t<t-this.defaultFov?i:this.defaultFov;e.state.fov=a,this.emit(`gesture.dbltap`,e),!e.defaultPrevented&&(this.cameraMotion.set({fov:a},360).catch(K),this.hideIntersectMesh())}},$x=`data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw`,eS;function tS(){return eS||(eS=new Promise(e=>{let t,n=document.createElement(`video`);n.muted=!0,n.src=$x,n.addEventListener(`timeupdate`,function r(){n.removeEventListener(`timeupdate`,r,!1),clearTimeout(t);let i=document.createElement(`canvas`);i.width=i.height=1;let a=i.getContext(`2d`);if(!a){e(!1);return}a.drawImage(n,0,0,1,1);let{data:o}=a.getImageData(0,0,1,1);o[3]>10?e(!0):e(!1)},!1),n.addEventListener(`canplay`,function e(){n.removeEventListener(`canplay`,e,!1),n.play()},!1),t=window.setTimeout(()=>e(!1),1e3)}))}var nS=[`right`,`left`,`up`,`down`,`front`,`back`];function rS(e,t,n,r){let i=new c.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=-n+.5-r,i.max.z=-n+.5;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=-t+.5-r,i.max.z=-t+.5,i.min.y=-n+.5-r,i.max.y=-n+.5;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=-n+.5-r,i.max.y=-n+.5;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=-n+.5-r,i.max.y=-n+.5;break;case`back`:i.min.z=.5,i.max.z=.5,i.min.x=-t+.5-r,i.max.x=-t+.5,i.min.y=-n+.5-r,i.max.y=-n+.5;break;default:break}return i.applyMatrix4(new c.Matrix4().makeRotationY(Math.PI))}var iS=(e,t)=>{if(e.level>=t)return;let n=e.level+1,r=e.size/2,i=[new c.Vector2(e.position.x,e.position.y),new c.Vector2(e.position.x+r,e.position.y),new c.Vector2(e.position.x,e.position.y+r),new c.Vector2(e.position.x+r,e.position.y+r)];for(let a of i){let i={face:e.face,level:n,size:r,position:a,box:rS(e.face,a.x,a.y,r),parent:e,children:[]};e.children.push(i),iS(i,t)}};function aS(e,t){let n={level:0,face:e,position:new c.Vector2(0,0),size:1,box:rS(e,0,0,1),parent:null,children:[]};return iS(n,t),n}function oS(e){return{children:nS.map(t=>aS(t,e)),maxLevel:e}}function sS(e,t){for(let n of e.children)t(n)!==!1&&sS(n,t)}var cS,lS=new c.Vector3,uS=new c.Quaternion,dS=new c.Matrix4,fS=new c.Matrix4,pS=new c.Matrix4,mS=new c.Matrix4,hS=new c.Matrix4,gS=new c.Quaternion,_S=new c.Matrix4,vS=0,yS=new c.Color,bS=(cS=Math.SQRT1_2)==null?Math.sqrt(2):cS,xS={up:new c.Quaternion(bS,0,0,bS),down:new c.Quaternion(-bS,0,0,bS),left:new c.Quaternion(0,bS,0,bS),right:new c.Quaternion(0,-bS,0,bS),front:new c.Quaternion(0,0,0,1),back:new c.Quaternion(0,1,0,0)},SS=(()=>{let e=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),t=new Float32Array([0,0,1,0,0,1,1,1]),n=new Uint32Array([0,1,2,1,3,2]),r=new c.BufferGeometry;return r.setAttribute(`position`,new c.BufferAttribute(e,3)),r.setAttribute(`uv`,new c.BufferAttribute(t,2)),r.setIndex(new c.BufferAttribute(n,1)),r.computeBoundingBox(),r})(),CS=null;function wS(){return CS||(CS=new c.DataTexture(new Uint8Array([255,255,255,255]),1,1),CS.needsUpdate=!0),CS}function TS(){return{enabled:(0,d.uniform)(0),maxDisplayBoost:(0,d.uniform)(1),gamma:(0,d.uniform)(1),minContentBoost:(0,d.uniform)(1),maxContentBoost:(0,d.uniform)(1),hdrCapacityMin:(0,d.uniform)(1),hdrCapacityMax:(0,d.uniform)(1)}}function ES(e,t){let n=(0,d.log2)(t.maxDisplayBoost),r=(0,d.log2)(t.hdrCapacityMin),i=(0,d.log2)(t.hdrCapacityMax).sub(r),a=(0,d.clamp)(n.sub(r).div((0,d.max)(i,(0,d.float)(1e-6))),(0,d.float)(0),(0,d.float)(1)).mul((0,d.step)((0,d.float)(1e-6),i)),o=t.gamma,s=(0,d.vec3)((0,d.pow)(e.r,o),(0,d.pow)(e.g,o),(0,d.pow)(e.b,o)),c=(0,d.log2)(t.minContentBoost),l=(0,d.log2)(t.maxContentBoost),u=(0,d.vec3)(c).add(s.mul((0,d.vec3)(l.sub(c)))).mul(a);return(0,d.vec3)((0,d.exp2)(u.x),(0,d.exp2)(u.y),(0,d.exp2)(u.z))}var DS=class extends c.NodeMaterial{constructor(e){super(),this.map=null,this.flipY=!0,this.level=-1,this._hdr=e,this._mapNode=(0,d.texture)(wS()),this._gainNode=(0,d.texture)(wS()),this.depthTest=!0,this.depthWrite=!1,this.transparent=!0,this.setupNode()}setupNode(){let e=(0,d.uv)(),t=(0,d.vec3)(e.x,e.y,0),n=(0,d.materialReference)(`opacity`,`float`),r=this._mapNode.sample(t.xy),i=ES(this._gainNode.sample(t.xy).rgb,this._hdr),a=(0,d.vec4)((0,d.mix)(r.rgb,r.rgb.mul(i),this._hdr.enabled),r.a.mul(n));this.outputNode=a}setMap(e){this.map=e,this._mapNode.value=e==null?wS():e}setGain(e){this._gainNode.value=e==null?wS():e}},OS=class extends c.Mesh{constructor(e,t,n){super(SS,new DS(n)),this.disposed=!1,e.box.getCenter(this.position),this.quaternion.multiplyQuaternions(new c.Quaternion().setFromAxisAngle(new c.Vector3(0,1,0),-Math.PI),xS[e.face]),this.scale.setScalar(e.size),this.node=e,this.name=`tiling:tile`,this.material.level=e.level,this.material.visible=!1,this.material.polygonOffset=!0,this.material.polygonOffsetFactor=-e.level,this.material.polygonOffsetUnits=-e.level,this.activeTime=-1,this.frustumCulled=!1,this.renderOrder=e.level,this.appearDuration=0,this.appearMotion=new J({appear:0}),t.then(([e,t])=>{this.colorTexture=e,this.gainmapTexture=t,this.disposed?(e.dispose(),t==null||t.dispose()):(this.material.setMap(e),this.material.setGain(t),this.material.visible=!0,this.appearMotion.set({appear:1},this.appearDuration*1e3).catch(K))}).catch(K)}updateTime(e){let t=!1;if(this.disposed)return t;this.appearMotion.ended===!1&&this.appearMotion.update(e),this.activeTime=e;let n=Lp(this.appearMotion.value.appear);return this.material.opacity!==n&&(this.material.opacity=n,t=!0),this.material.transparent=!0,t}dispose(){this.disposed=!0,this.material.map&&this.material.map.dispose(),this.material.dispose()}},kS=M_(20,20,20);kS.applyMatrix4(new c.Matrix4().makeScale(-1,1,1));var AS=class extends c.NodeMaterial{constructor(e){super();let t=(0,d.normalize)(d.positionLocal),n=(0,d.vec3)(t.x,t.y,t.z);this._mapNode=(0,d.cubeTexture)(new c.CubeTexture,n),this._gainNode=(0,d.cubeTexture)(new c.CubeTexture,n);let r=ES(this._gainNode.rgb,e);this.fragmentNode=(0,d.vec4)((0,d.mix)(this._mapNode.rgb,this._mapNode.rgb.mul(r),e.enabled),1),this.depthTest=!0,this.depthWrite=!0,this.transparent=!1}get map(){return this._mapNode.value}set map(e){this._mapNode.value=e}set gainMap(e){this._gainNode.value=e==null?null:e}},jS=class extends c.Mesh{constructor(e){super(kS,new AS(e)),this.disposed=!1,this.frustumCulled=!1,this.renderOrder=9999}update(e,t,n){if(this.disposed){this.material.map=null,this.material.gainMap=null,this.visible=!1;return}this.material.map=t,n&&(this.material.gainMap=n),this.visible=t!==null}dispose(){this.disposed=!0,this.material.dispose()}},MS=class{constructor(e){this.prevHDRKey=``,this.forceRenderWhenNextUpdate=!0,this.fiveId=e.fiveId,this.disposed=!1,this.level=0,this.pedding=0,this.maxRequest=1,this.appearDuration=.5,this.maxCacheTile=48,this.imageOptions={},this.hdrUniforms=TS(),this.boundingMesh=new jS(this.hdrUniforms),this.boundingMesh.frustumCulled=!1,this.textureLoader=new Yc,this.observer=null,this.tileTree=oS(0),this.tileMeshes=new Map,this.frustum=new c.Frustum,this.scene=new c.Scene,this.camera=new c.PerspectiveCamera(90,1,.1,100),this.scene.add(this.boundingMesh),this.renderTarget=new c.RenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1,generateMipmaps:!1,magFilter:c.LinearFilter,minFilter:c.LinearFilter,wrapS:c.ClampToEdgeWrapping,wrapT:c.ClampToEdgeWrapping,type:c.HalfFloatType}),this.renderTarget.texture.colorSpace=c.LinearSRGBColorSpace}dispose(){this.setObserver(null),this.renderTarget.dispose(),this.boundingMesh.dispose(),this.disposed=!0}cleanup(){this.tileMeshes.forEach(e=>{e.dispose(),this.scene.remove(e)}),this.tileMeshes.clear(),this.forceRenderWhenNextUpdate=!0}setObserver(e){var t,n,r,i;if(this.disposed||this.observer===e)return;this.cleanup(),this.observer=e;let a=(i=(r=(n=(t=this.observer)==null?void 0:t.images.tiles)==null?void 0:n.slice().sort((e,t)=>t.level-e.level)[0])==null?void 0:r.level)==null?0:i;this.tileTree=oS(a)}update(e){var t,n,r,i,a,o,s,l;let u=this.forceRenderWhenNextUpdate;if(this.disposed)return u;let{time:d,resolution:f,pixelRatio:p,renderer:m,cameraMatrix:h,cameraProjectionMatrix:g,panoMap:_,panoMatrix:v,panoZoom:y,minLevel:b,level:x,gainMap:S,useHDR:C,maxDisplayBoost:w,hdrConfig:T}=e;this.boundingMesh.update(d,_,S),this.hdrUniforms.enabled.value=+!!C,this.hdrUniforms.maxDisplayBoost.value=w==null?1:w,this.hdrUniforms.gamma.value=(t=T==null?void 0:T.gamma)==null?1:t,this.hdrUniforms.minContentBoost.value=(n=T==null?void 0:T.minContentBoost)==null?1:n,this.hdrUniforms.maxContentBoost.value=(r=T==null?void 0:T.maxContentBoost)==null?1:r,this.hdrUniforms.hdrCapacityMin.value=(i=T==null?void 0:T.hdrCapacityMin)==null?1:i,this.hdrUniforms.hdrCapacityMax.value=(a=T==null?void 0:T.hdrCapacityMax)==null?1:a;let E=`${this.hdrUniforms.enabled.value}|${this.hdrUniforms.maxDisplayBoost.value}|${this.hdrUniforms.gamma.value}|${this.hdrUniforms.minContentBoost.value}|${this.hdrUniforms.maxContentBoost.value}|${this.hdrUniforms.hdrCapacityMin.value}|${this.hdrUniforms.hdrCapacityMax.value}`;if(E!==this.prevHDRKey&&(this.prevHDRKey=E,u=!0),this.observer===null)return(this.renderTarget.width!==1||this.renderTarget.height!==1)&&(this.renderTarget.setSize(1,1),u=!0),!1;this.level=H(x,0,this.tileTree.maxLevel);let D=Math.floor(f.width*p),O=Math.floor(f.height*p),k=Math.max(D,O),A=(l=(s=(o=m.backend.device)==null?void 0:o.limits)==null?void 0:s.maxTextureDimension2D)==null?8192:l;k>A&&(D=Math.floor(D/k*A),O=Math.floor(O/k*A)),(this.renderTarget.width!==D||this.renderTarget.height!==O)&&this.renderTarget.setSize(D,O),this.scene.matrix.equals(v)||(this.scene.matrix.copy(v),this.scene.matrixWorld.copy(this.scene.matrix),this.scene.matrix.decompose(this.scene.position,this.scene.quaternion,this.scene.scale),this.scene.matrixAutoUpdate=!1,u=!0);let j=uS.setFromRotationMatrix(h),M=dS.compose(this.scene.position,j,this.scene.scale);this.camera.matrix.equals(M)||(this.camera.matrix.copy(M),this.camera.matrixWorld.copy(this.camera.matrix),this.camera.position.copy(this.scene.position),this.camera.quaternion.copy(j),this.camera.scale.copy(this.scene.scale),u=!0);let N=fS.copy(g);N.elements[0]*=y,N.elements[5]*=y,this.camera.projectionMatrix.equals(N)||(this.camera.projectionMatrix.copy(N),this.camera.projectionMatrixInverse.copy(this.camera.projectionMatrix).invert(),u=!0),gS.copy(this.scene.quaternion).invert(),_S.makeRotationFromQuaternion(gS),pS.copy(this.camera.matrix),pS.setPosition(0,0,0),pS.premultiply(_S),mS.copy(pS).invert(),hS.multiplyMatrices(this.camera.projectionMatrix,mS),this.frustum.setFromProjectionMatrix(hS);let ee=this.frustum.planes[5].normal,P=[];x>=b&&sS(this.tileTree,e=>{if(!(e.level<b)){if(e.level>x||!this.frustum.intersectsBox(e.box))return!1;P.push(e)}});let F=new WeakMap;P.sort((e,t)=>{if(e.level!==t.level)return e.level-t.level;let n=F.get(e);n===void 0&&(n=e.box.getCenter(lS).angleTo(ee),F.set(e,n));let r=F.get(t);return r===void 0&&(r=t.box.getCenter(lS).angleTo(ee),F.set(t,r)),n-r});let te=new WeakSet,ne=this.observer.images.tiles;if(ne)for(let e of P){let t=ne.find(t=>t.level===e.level);if(!t)continue;te.add(e);let n=this.tileMeshes.get(e);if(n){n.appearDuration=this.appearDuration,n.updateTime(d)&&(u=!0);continue}if(this.pedding>=this.maxRequest)continue;let r=Math.pow(2,e.level)*e.position.y,i=Math.pow(2,e.level)*e.position.x,a=`${Sv({panoIndex:this.observer.panoIndex,workCode:this.observer.work.workCode})}.${e.face}.${e.level}.${r}.${i}`,o=t.work.getURL(t[e.face]),s=t[`gainmap_${e.face}`],l=t.size,f=this.imageOptions.transform,p=Object.assign(Object.assign({},Js(this.imageOptions,[`format`,`sharpen`,`forceUseExifOrientation`,`mappings`])),{key:`pano_tile.${a}`,size:t.scale>=1?void 0:l*e.size*t.scale,cut:e.size===1?void 0:[l*e.position.x,l*e.position.y,l*e.size,l*e.size]});e.level===1&&t.scale>=.5&&(p.format===`jpg`||/\.jpg$/.test(o))&&(p.size=void 0,p.quality||(p.quality=70)),e.size===1&&console.warn(`tile: ${p.key} should not appear.`),this.pedding++;let h=Promise.all([this.textureLoader.loadTexture(o,{imageURL:{transform:f,options:p},colorSpace:c.SRGBColorSpace,minFilter:c.LinearFilter,magFilter:c.LinearFilter,generateMipmaps:!1,fetcher:w_(this.fiveId,this.observer.work)}).then(e=>e.body),s?this.textureLoader.loadTexture(s,{imageURL:{transform:f,options:p},colorSpace:c.SRGBColorSpace,minFilter:c.LinearFilter,magFilter:c.LinearFilter,generateMipmaps:!1,fetcher:w_(this.fiveId,this.observer.work)}).then(e=>e.body):Promise.resolve()]);h.then(([e,t])=>Promise.all([pm(e,m),t?pm(t,m):Promise.resolve()])).then(e=>(this.pedding--,e),e=>(this.pedding--,Promise.reject(e))),n=new OS(e,h,this.hdrUniforms),n.name=`tiling:tile-${a}`,n.visible=!1,n.appearDuration=this.appearDuration,this.tileMeshes.set(e,n),this.scene.add(n),n.updateTime(d),u=!0}let I=[],re=[];this.tileMeshes.forEach((e,t)=>{te.has(t)?I.push(e):re.push(e);let n=t.level>=b&&t.level<=x;e.visible!==n&&(e.visible=n,u=!0)});let ie=re.sort((e,t)=>t.activeTime-e.activeTime).slice(Math.max(0,this.maxCacheTile-I.length));for(let e of ie)this.tileMeshes.delete(e.node),this.scene.remove(e),e.dispose(),u=!0;if(u){let e=m.getRenderTarget(),t=m.getClearColor(yS),n=m.getClearAlpha(),r=m.autoClear,i=m.autoClearColor,a=m.autoClearDepth,o=m.autoClearStencil;m.autoClear=!0,m.autoClearColor=!0,m.autoClearDepth=!0,m.autoClearStencil=!0,m.setRenderTarget(this.renderTarget),m.setClearColor(new c.Color(0,0,0),vS),m.render(this.scene,this.camera),m.setRenderTarget(e),m.setClearColor(t,n),m.autoClear=r,m.autoClearColor=i,m.autoClearDepth=a,m.autoClearStencil=o}return this.forceRenderWhenNextUpdate=!1,u}},NS=new c.Matrix4().makeRotationAxis(new c.Vector3(0,1,0),Math.PI),PS=M_(2,2,2);PS.applyMatrix4(new c.Matrix4().makeScale(-1,1,1));var FS=`
|
|
1065
|
+
|
|
1066
|
+
#if defined(USE_PANO_VIDEO)
|
|
1067
|
+
varying vec3 worldPosition;
|
|
1068
|
+
#endif
|
|
1069
|
+
|
|
1070
|
+
void main() {
|
|
1071
|
+
vec4 transformed = vec4(position, 1.0);
|
|
1072
|
+
#if defined(USE_PANO_VIDEO)
|
|
1073
|
+
worldPosition = (modelMatrix * transformed).xyz;
|
|
1074
|
+
#endif
|
|
1075
|
+
gl_Position = projectionMatrix * modelViewMatrix * transformed;
|
|
1076
|
+
}
|
|
1077
|
+
`,IS=`
|
|
1078
|
+
#define FLIP_CUBE_MAP -1.0
|
|
1079
|
+
|
|
1080
|
+
uniform vec2 size;
|
|
1081
|
+
uniform mat4 matrix;
|
|
1082
|
+
uniform mat4 panoMatrix;
|
|
1083
|
+
uniform mat4 fixMatrix;
|
|
1084
|
+
uniform float alpha;
|
|
1085
|
+
uniform sampler2D map;
|
|
1086
|
+
|
|
1087
|
+
#if defined(USE_PANO_VIDEO)
|
|
1088
|
+
varying vec3 worldPosition;
|
|
1089
|
+
#endif
|
|
1090
|
+
|
|
1091
|
+
#include <common>
|
|
1092
|
+
void main() {
|
|
1093
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
1094
|
+
#if defined(USE_PANO_VIDEO)
|
|
1095
|
+
|
|
1096
|
+
vec3 cameraToVertex = normalize(worldPosition - cameraPosition);
|
|
1097
|
+
cameraToVertex = cameraToVertex * mat3(panoMatrix);
|
|
1098
|
+
cameraToVertex = vec3(FLIP_CUBE_MAP * cameraToVertex.x, cameraToVertex.yz);
|
|
1099
|
+
|
|
1100
|
+
vec4 mapCoods = vec4(cameraToVertex, 1.0) * (fixMatrix * matrix);
|
|
1101
|
+
vec2 uv = vec2(
|
|
1102
|
+
0.5 + mapCoods.x / mapCoods.z / size.x,
|
|
1103
|
+
0.5 - mapCoods.y / mapCoods.z / size.y
|
|
1104
|
+
);
|
|
1105
|
+
vec4 videoColor = texture2D(map, uv);
|
|
1106
|
+
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)));
|
|
1107
|
+
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)));
|
|
1108
|
+
gl_FragColor = vec4(videoColor.rgb, match * blendAlpha * alpha);
|
|
1109
|
+
|
|
1110
|
+
#endif
|
|
1111
|
+
}
|
|
1112
|
+
`,LS=class{constructor(){this.material=new c.ShaderMaterial({vertexShader:FS,fragmentShader:IS,uniforms:{size:new c.Uniform(new c.Vector2),matrix:new c.Uniform(new c.Matrix4),fixMatrix:new c.Uniform(NS),panoMatrix:new c.Uniform(new c.Matrix4),alpha:new c.Uniform(1),map:new c.Uniform(null)},depthTest:!1,depthWrite:!1,defines:{USE_PANO_VIDEO:!1},blending:c.CustomBlending,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendSrcAlpha:c.OneFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor}),this.object=new c.Mesh(PS,this.material),this.object.visible=!1,this.object.renderOrder=-1,this.object.frustumCulled=!1,this.object.name=`pano-video`,this.alphaMotion=new J({alpha:0})}setMaterial(e){e?(this.material.uniforms.size.value.copy(e.size),this.material.uniforms.matrix.value.copy(e.matrix),this.material.uniforms.panoMatrix.value.copy(e.panoMatrix),this.material.uniforms.map.value=e.map,this.alphaMotion.set({alpha:e.alpha},500).catch(K)):(this.material.uniforms.size.value.setScalar(0),this.material.uniforms.matrix.value.identity(),this.material.uniforms.panoMatrix.value.identity(),this.material.uniforms.map.value=null,this.material.uniforms.alpha.value=0,this.alphaMotion.set({alpha:0},0).catch(K));let t=e!==null;t!==this.material.defines.USE_PANO_VIDEO&&(this.material.defines.USE_PANO_VIDEO=t,this.material.needsUpdate=!0,this.object.visible=e!==null)}updateTime(e){this.alphaMotion.ended||(this.alphaMotion.update(e),this.material.uniforms.alpha.value=this.alphaMotion.value.alpha)}dispose(){this.material.dispose()}},RS=new c.Color(0,0,0),zS=new c.Color,BS=new c.ShaderMaterial({vertexShader:`
|
|
1113
|
+
#include <common>
|
|
1114
|
+
#include <uv_pars_vertex>
|
|
1115
|
+
#include <morphtarget_pars_vertex>
|
|
1116
|
+
#include <skinning_pars_vertex>
|
|
1117
|
+
#include <logdepthbuf_pars_vertex>
|
|
1118
|
+
#include <clipping_planes_pars_vertex>
|
|
1119
|
+
|
|
1120
|
+
varying vec4 vFinalPosition;
|
|
1121
|
+
|
|
1122
|
+
void main() {
|
|
1123
|
+
|
|
1124
|
+
#include <uv_vertex>
|
|
1125
|
+
|
|
1126
|
+
#include <skinbase_vertex>
|
|
1127
|
+
|
|
1128
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
1129
|
+
|
|
1130
|
+
#include <beginnormal_vertex>
|
|
1131
|
+
#include <morphnormal_vertex>
|
|
1132
|
+
#include <skinnormal_vertex>
|
|
1133
|
+
|
|
1134
|
+
#endif
|
|
1135
|
+
|
|
1136
|
+
#include <begin_vertex>
|
|
1137
|
+
#include <morphtarget_vertex>
|
|
1138
|
+
#include <skinning_vertex>
|
|
1139
|
+
|
|
1140
|
+
#include <project_vertex>
|
|
1141
|
+
#include <logdepthbuf_vertex>
|
|
1142
|
+
#include <clipping_planes_vertex>
|
|
1143
|
+
|
|
1144
|
+
vFinalPosition = vec4(transformed, 1.0);
|
|
1145
|
+
#ifdef USE_INSTANCING
|
|
1146
|
+
vFinalPosition = instanceMatrix * vFinalPosition;
|
|
1147
|
+
#endif
|
|
1148
|
+
vFinalPosition = modelMatrix * vFinalPosition;
|
|
1149
|
+
|
|
1150
|
+
}
|
|
1151
|
+
`,fragmentShader:`
|
|
1152
|
+
#include <common>
|
|
1153
|
+
#include <packing>
|
|
1154
|
+
#include <uv_pars_fragment>
|
|
1155
|
+
#include <map_pars_fragment>
|
|
1156
|
+
#include <alphamap_pars_fragment>
|
|
1157
|
+
#include <logdepthbuf_pars_fragment>
|
|
1158
|
+
#include <clipping_planes_pars_fragment>
|
|
1159
|
+
|
|
1160
|
+
uniform float maxDepth;
|
|
1161
|
+
varying vec4 vFinalPosition;
|
|
1162
|
+
|
|
1163
|
+
void main() {
|
|
1164
|
+
|
|
1165
|
+
#include <clipping_planes_fragment>
|
|
1166
|
+
|
|
1167
|
+
vec4 diffuseColor = vec4( 1.0 );
|
|
1168
|
+
|
|
1169
|
+
#include <map_fragment>
|
|
1170
|
+
#include <alphamap_fragment>
|
|
1171
|
+
#include <alphatest_fragment>
|
|
1172
|
+
|
|
1173
|
+
#include <logdepthbuf_fragment>
|
|
1174
|
+
|
|
1175
|
+
vec3 cameraVertex = vFinalPosition.xyz - cameraPosition;
|
|
1176
|
+
float cameraDepth = length(cameraVertex);
|
|
1177
|
+
gl_FragColor = packDepthToRGBA(clamp(cameraDepth / maxDepth, 0.0, 1.0));
|
|
1178
|
+
}
|
|
1179
|
+
`,uniforms:{maxDepth:new c.Uniform(0)}});function VS(e,t,n,r=1e3){BS.uniforms.maxDepth.value=r,e.getClearColor(zS);let i=e.getClearAlpha(),a=t.overrideMaterial;t.overrideMaterial=BS,e.setClearColor(RS,0),n.update(e,t),e.setClearColor(zS,i),t.overrideMaterial=a}var HS=Ip,US=new c.Raycaster,WS=new c.Vector3,GS=[new c.Vector3(0,0,0).multiplyScalar(.1),new c.Vector3(1,0,0).multiplyScalar(.1),new c.Vector3(-.5,0,-Math.sqrt(3)/2).multiplyScalar(.1),new c.Vector3(-.5,0,Math.sqrt(3)/2).multiplyScalar(.1)],KS=Object.assign(Object.assign({},Zx),{maxAccessibleDistance:5,panoTapTriggerRadius:.5,panoCircleMeshCreator:(e,t)=>e.position.distanceTo(e.standingPosition)>t.aerialObserverMinHeight?new Ub:new Fb,adjustPanoCircleMeshPositionBasedOnModel:!1,tileLevelForFov:((e,t)=>{var n;let r=e=>e/180*Math.PI,i=(n=Math.log2)==null?(e=>Math.log(e)*Math.LOG2E):n,a=t.height/2/Math.tan(r(e/2))*Math.tan(r(45))*2,o=Math.max(i(a/512),0);return o<2.3&&o>.1&&(o=1),o=o%1>.75?Math.ceil(o):Math.floor(o),o}),tileAppearDuration:.5,tileMaxRequest:3,flyEffectUseDepthBuffer:!1}),qS=class e extends Qx{static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{maxAccessibleDistance:(n=t.maxAccessibleDistance)==null?KS.maxAccessibleDistance:n,panoTapTriggerRadius:(r=t.panoTapTriggerRadius)==null?KS.panoTapTriggerRadius:r,panoCircleMeshCreator:(i=t.panoCircleMeshCreator)==null?KS.panoCircleMeshCreator:i,adjustPanoCircleMeshPositionBasedOnModel:(a=t.adjustPanoCircleMeshPositionBasedOnModel)==null?KS.adjustPanoCircleMeshPositionBasedOnModel:a,tileLevelForFov:(o=t.tileLevelForFov)==null?KS.tileLevelForFov:o,tileAppearDuration:(s=t.tileAppearDuration)==null?KS.tileAppearDuration:s,tileMaxRequest:(c=t.tileMaxRequest)==null?KS.tileMaxRequest:c,flyEffectUseDepthBuffer:(l=t.flyEffectUseDepthBuffer)==null?KS.flyEffectUseDepthBuffer:l})}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`Panorama`})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Panorama`,this.initAnimationed=!1,this.maxAccessibleDistance=n.maxAccessibleDistance,this.panoTapTriggerRadius=n.panoTapTriggerRadius,this.panoCircleMeshCreator=n.panoCircleMeshCreator,this.adjustPanoCircleMeshPositionBasedOnModel=n.adjustPanoCircleMeshPositionBasedOnModel,this.tileLevelForFov=n.tileLevelForFov,this.tileAppearDuration=n.tileAppearDuration,this.tileMaxRequest=n.tileMaxRequest,this.flyEffectUseDepthBuffer=n.flyEffectUseDepthBuffer,this.adjustPanoCircleMeshPositionFix=new Map;let{pano0:r,pano1:i}=this.modelScene.parameter.resolveValue();r&&(i==null?void 0:i.map)!==r.map&&(this.modelScene.parameter.set({pano0:i}),r.map.dispose());let a=new Set;r&&a.add(r),i&&a.add(i),this.panoMeshes=new Map,this.locationMotion=new J({count:0,distance:this.camera.pose.distance}),this.modelAlphaMotion=new J({modelAlpha:this.modelScene.parameter.resolveValue().modelAlpha}),this.perspToOrthoMotion=new J({perspToOrtho:this.camera.perspToOrtho.x}),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=Mt()]={panoId:Sv(this.currentPano),panoPicture:this.modelScene.parameter.resolveValue().pano1,position:this.camera.pose.offset.clone(),effect:`fly`,effectEasing:HS,fixCameraTransform:new c.Matrix4},this.panoPictureObserverMap=new WeakMap,this.textureLoader=new Yc,this.tiling=new MS({fiveId:this.fiveId}),this.panoVideo=new LS,this.scene.add(this.panoVideo.object),this.accessibleObserverFloorCheckCount=0}get tileLevel(){return this.tiling.level}updateConfiguration(e){return super.updateConfiguration(e)===!1?!1:(e.maxAccessibleDistance!==void 0&&this.maxAccessibleDistance!==e.maxAccessibleDistance&&(this.maxAccessibleDistance=e.maxAccessibleDistance),e.panoTapTriggerRadius!==void 0&&this.panoTapTriggerRadius!==e.panoTapTriggerRadius&&(this.panoTapTriggerRadius=e.panoTapTriggerRadius),e.panoCircleMeshCreator!==void 0&&this.panoCircleMeshCreator!==e.panoCircleMeshCreator&&(this.panoCircleMeshCreator=e.panoCircleMeshCreator,this.panoMeshes&&(this.panoMeshes.forEach(e=>{this.helper.remove(e),e.dispose()}),this.panoMeshes.clear())),e.tileLevelForFov!==void 0&&this.tileLevelForFov!==e.tileLevelForFov&&(this.tileLevelForFov=e.tileLevelForFov),e.tileMaxRequest!==void 0&&this.tileMaxRequest!==e.tileMaxRequest&&(this.tileMaxRequest=e.tileMaxRequest),e.flyEffectUseDepthBuffer!==void 0&&this.flyEffectUseDepthBuffer!==e.flyEffectUseDepthBuffer&&(this.flyEffectUseDepthBuffer=e.flyEffectUseDepthBuffer),e.adjustPanoCircleMeshPositionBasedOnModel!==void 0&&this.adjustPanoCircleMeshPositionBasedOnModel!==e.adjustPanoCircleMeshPositionBasedOnModel&&(this.adjustPanoCircleMeshPositionBasedOnModel=e.adjustPanoCircleMeshPositionBasedOnModel,this.adjustPanoCircleMeshPositionBasedOnModel||this.adjustPanoCircleMeshPositionFix.clear()),!0)}destroy(){super.destroy(),this.tiling.dispose(),this.modelScene.parameter.set({refinedScreen:null,pano0Depth:null,pano1Depth:null}),this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0),this.locationMotion.dispose(),this.pendingTextureTask=void 0,this.panoMeshes&&(this.panoMeshes.forEach(e=>{this.helper.remove(e),e.dispose()}),this.panoMeshes.clear());let e=this.videoTexture.image;e.pause(),e.oncanplay=K,e.ontimeupdate=K,this.scene.remove(this.panoVideo.object),this.panoVideo.setMaterial(null),this.panoVideo.dispose();let{pano0:t,pano1:n}=this.modelScene.parameter.resolveValue();for(let e of Object.keys(this.panoResources)){let r=this.panoResources[e];if(r.panoPicture){let e=r.panoPicture.map;e&&e!==(t==null?void 0:t.map)&&e!==(n==null?void 0:n.map)&&(e.dispose(),r.panoPicture=null)}delete this.panoResources[e]}}isReady(){return this.locationMotion.ended===!0?super.isReady():!1}isTileReady(){let e=this.tiling.pedding<=0;return this.initAnimationed&&e}updateWork(t,n,r,i){this.userAction=i,this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));return(a.workCode!==this.currentPano.workCode||a.panoIndex!==this.currentPano.panoIndex||a.longitude!==this.cameraMotion.value.longitude||a.latitude!==this.cameraMotion.value.latitude||a.fov!==this.cameraMotion.value.fov)&&(this.initAnimationed=!1,this.moveToPano({workCode:a.workCode,panoIndex:a.panoIndex},{effect:r.effect,duration:r.duration,longitude:a.longitude,latitude:a.latitude,fov:a.fov,moveEndCallback:()=>{this.initAnimationed=!0},moveCancelCallback:()=>{this.initAnimationed=!0}},i)),!0}updateModel(e){this.modelScene=e,this.hideIntersectMesh()}updateTime(e,t,...n){var r,i,a,o,s,l,u;if(this.destroyed)return;let d={},f={},p=this.camera.getDirection(new c.Vector3),m=this.locationMotion.keyframes[0],h=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[g,_]=this.locationMotion.getKeyFrameSegment(e),v=this.panoResourceFromLocationMotionKeyframe(g),y=this.panoResourceFromLocationMotionKeyframe(_),b=this.panoResourceFromLocationMotionKeyframe(m),x=this.panoResourceFromLocationMotionKeyframe(h),S=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),f.longitude=this.cameraMotion.value.longitude,f.latitude=this.cameraMotion.value.latitude,f.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),d.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let t=this.locationMotion.value.count-_.value.count+1,n=new c.Vector3().copy(v.position),a=new c.Vector3().copy(y.position);if(d.progress=y.effectEasing(t),t>=.01&&t<=.99&&(d.progress=H(y.effectEasing(t),.01,.99)),y.panoPicture&&(t<1?v.panoPicture&&(d.pano0=v.panoPicture):d.pano0=y.panoPicture,d.pano1=y.panoPicture),y.effect===`montage`?d.transition=`BLACK`:y.effect===`spread`?d.transition=`SPREAD`:d.transition=`FADE`,y.effect===`zoomin`||y.effect===`zoomout`?d.progress=Math.pow(t,3):y.effect===`model`&&this.camera.pose.distance<.01&&(d.modelAlpha=1-Math.pow(H(Math.abs(t-.5)*2,0,1),4)),t<1&&y.effect!==`fly`&&y.effect!==`model`){if(d.pano0&&v.panoPicture){let e={panoId:d.pano0.panoId,map:d.pano0.map,mapHistogram:d.pano0.mapHistogram,mapSize:d.pano0.mapSize,zoom:d.pano0.zoom,matrix:v.panoPicture.matrix.clone().premultiply(v.fixCameraTransform).setPosition(y.position),hdrConfig:d.pano0.hdrConfig?Object.assign({},d.pano0.hdrConfig):void 0},t=this.panoPictureObserverMap.get(d.pano0);t&&this.panoPictureObserverMap.set(e,t),d.pano0=e}n.copy(a),S=!0}f.distance=this.locationMotion.value.distance,f.offset=new c.Vector3(n.x+(a.x-n.x)*t,n.y+(a.y-n.y)*t,n.z+(a.z-n.z)*t);let o=[],s=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(o.push(t),n>this.locationMotion.progress&&s.push(t))}for(let e of Object.keys(this.panoResources)){if(s.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.panoPicture){let e=t.panoPicture.map;if(e){if(e===((r=d.pano0)==null?void 0:r.map)||e===((i=d.pano1)==null?void 0:i.map))continue;e.dispose(),t.panoPicture=null}}o.indexOf(e)>=0||delete this.panoResources[e]}let l=Cv(y.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,$(`pano.moving`,{userAction:this.userAction,prevPano:Cv(b.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},Cv(x.panoId)),{mode:this.mode}),ox(this.camera.pose)),f),options:{},progress:this.locationMotion.progress,error:null}))}lx(d)===!1&&this.modelScene.parameter.set(d),!this.modelScene.parameter.pano0&&this.modelScene.parameter.pano1&&this.modelScene.parameter.set(`pano0`,this.modelScene.parameter.pano1),lx(f)===!1&&this.setCamera(f);let C=this.works.getObserver(this.currentPano),w=this.locationMotion.ended?this.getForwardObserverOrNot(this.camera):null,T=this.works.getObserver(v.panoId),E=this.works.getObserver(y.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&C){let e=[],t=C.work.observers;for(let n of C.accessibleNodes){let r=t[n];r&&e.push(r)}let n=new Map;if(e.sort((e,t)=>{let r=n.get(e);r===void 0&&(r=e.standingPosition.distanceTo(C.standingPosition),n.set(e,r));let i=n.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(C.standingPosition),n.set(t,i)),r-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let t=e[this.accessibleObserverFloorCheckCount],n=this.modelScene.models.find(e=>e.work===(t==null?void 0:t.work));if(t&&n&&n.visible){let e=.3,r=.005,i=t.standingPosition.clone().applyMatrix4(t.work.transform),a=Sv({panoIndex:t.panoIndex,workCode:t.work.workCode}),o=GS.map(t=>{US.ray.origin.copy(i),US.ray.origin.add(WS.copy(t).setY(e)),US.ray.direction.set(0,-1,0),US.firstHitOnly=!0,US.floorIndex=-1;let[a]=n.intersectRaycaster(US);return a&&a.distance-r<=e?new c.Vector3().copy(i).setY(a.point.y+r):i});o.sort((e,t)=>t.y-e.y);let s=o[Math.floor(o.length/2)],[l]=o.filter(e=>e.distanceTo(s)<=.05);if(l){let e=new c.Vector4(i.x,i.y,i.z,l.y-i.y),t=this.adjustPanoCircleMeshPositionFix.get(a);t&&!e.equals(t)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(a,e)}}this.accessibleObserverFloorCheckCount++}}let D=new Map;if(T)for(let e of T.accessibleNodes){let t=T.work.observers[e];if(t){let e=Sv({panoIndex:t.panoIndex,workCode:t.work.workCode});D.set(e,t)}}if(E)for(let e of E.accessibleNodes){let t=E.work.observers[e];if(t){let e=Sv({panoIndex:t.panoIndex,workCode:t.work.workCode});D.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{D.get(t)?D.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),D.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),D.delete(t)}),this.panoMeshes.forEach((e,t)=>{let n=this.works.getObserver(t);if(n){let r=n.position.distanceTo(n.standingPosition)>this.aerialObserverMinHeight;if(r)e.position.copy(n.position).applyMatrix4(n.work.transform),e.scale.setScalar(18);else{e.position.copy(n.standingPosition).applyMatrix4(n.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(n.panoId);t&&(WS.set(t.x,t.y,t.z),WS.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let i=this.camera.position.clone().setY(e.position.y),a=new c.Vector3().copy(e.position).sub(i).normalize();if(t===Sv(this.currentPano)){let t=H((.5-i.distanceTo(e.position))/.5,0,1);a.multiplyScalar(1-t).add(p.clone().multiplyScalar(t))}if(a.length()>0){let t=r?-Math.PI/2:0,n=Math.atan2(a.x,a.z);e.quaternion.setFromEuler(new c.Euler(t,n,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||S)this.panoMeshes.forEach(n=>{n.setOpacity(0),n.setCurrent(!1),n.updateTime&&n.updateTime(e,t),n.visible=!1});else if(C){let n=C.work.observers,[,r]=vf(C.accessibleNodes,e=>{let t=n[e];return!t||!t.active?1/0:C.standingPosition.distanceTo(t.standingPosition)},!0);r=H(r,3,1/0);let i=C.accessibleNodes.concat(C.panoIndex).map(e=>Sv({panoIndex:e,workCode:C.work.workCode}));this.panoMeshes.forEach((n,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=n.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!n.loading&&n.progress===0&&w!==null&&Sv({panoIndex:w.panoIndex,workCode:w.work.workCode})===a;let t=n.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=t<.01?0:H(r/t,.1,.85)}o&&o===E&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&n.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue().modelAlpha>0&&(c=0),n.setCurrent(s),n.setOpacity(c),n.updateTime&&n.updateTime(e,t)})}{let e=(a=this.modelScene.parameter.progress)==null?1:a,t=Math.round(e),n=this.modelScene.parameter.pano0,r=this.modelScene.parameter.pano1,i=t===0?n:r,l;if(i&&(l=this.works.getObserver(i.panoId),l||(l=this.panoPictureObserverMap.get(i))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(Vc()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!l||!i||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:null,gainMap:void 0,panoMatrix:new c.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Mc(i.mapSize),a=e+1,u=new c.Vector2().copy(this.camera.resolution).multiplyScalar(this.camera.pixelRatio),d=Math.floor(this.tileLevelForFov(this.camera.fov,u)),f=d>e?d:0;this.tiling.setObserver(l);let p={renderer:this.renderer,resolution:this.camera.resolution,pixelRatio:this.camera.pixelRatio,time:this.camera.time,cameraMatrix:this.camera.matrixWorld,cameraProjectionMatrix:this.camera.projectionMatrix,panoMap:i.map,gainMap:(o=i.hdrConfig)==null?void 0:o.map,panoMatrix:i.matrix,panoZoom:i.zoom,minLevel:a,level:f,useHDR:this.modelScene.parameter.useHDR,maxDisplayBoost:this.modelScene.parameter.maxDisplayBoost,hdrConfig:i.hdrConfig?Object.assign({},i.hdrConfig):void 0},m=this.tiling.update(p),h={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:t,opacity:(n==null?void 0:n.panoId)===(r==null?void 0:r.panoId)?1:Rp(Math.abs(((s=this.modelScene.parameter.progress)==null?0:s)-.5)*2)},g=this.modelScene.parameter.refinedScreen;(m||h.pano!==(g==null?void 0:g.pano)||h.opacity!==(g==null?void 0:g.opacity))&&this.modelScene.parameter.set(`refinedScreen`,h)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),C&&C.images.video&&(this.needsRender=!0),this.intersectMesh&&this.intersectMesh.parent&&C&&C.position.y-C.standingPosition.y>10){let e=H(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=y.effect,{pano0:t,pano1:n}=this.modelScene.parameter;if(t&&n&&t!==n&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((l=this.modelScene.parameter.pano0Depth)==null?void 0:l.panoId)!==t.panoId||((u=this.modelScene.parameter.pano1Depth)==null?void 0:u.panoId)!==n.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new c.CubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new c.CubeRenderTarget(512,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,generateMipmaps:!1});let e=new c.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(t.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,VS(this.renderer,this.modelScene,e,500);let r=new c.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);r.matrix.copy(n.matrix),r.matrixWorld.copy(r.matrix),r.matrixAutoUpdate=!1,VS(this.renderer,this.modelScene,r,500),this.modelScene.parameter.set({pano0Depth:{panoId:t.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:n.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(G())[1],t=this.locationMotion.getKeyFrameSegment(G())[1],n=this.panoResourceFromLocationMotionKeyframe(t),r=this.works.getObserver(n.panoId);return{workCode:r?r.work.workCode:this.currentPano.workCode,panoIndex:r?r.panoIndex:this.currentPano.panoIndex,mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:r?r.position.clone().applyMatrix4(r.work.transform):this.camera.position.clone(),distance:this.locationMotion.value.distance}}moveToPano(e,t,n){var r,i,a;let o=(r=t.effect)==null?`fly`:r;this.userAction=n,this.stopMomentumMovement();let s=Sv(e),l=this.works.getObserver(e);if(!l)throw Error(`Invalid PanoId ${JSON.stringify(e)}`);let u=kc(l.images.up),d=this.imageOptions.size;d===void 0&&l&&u&&(d=Number(u)),d===void 0&&(d=2048);let f=this.imageOptions.transform,p=Object.assign({key:`pano.${s}`},Js(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),m={right:l.images.work.getURL(l.images.right),left:l.images.work.getURL(l.images.left),up:l.images.work.getURL(l.images.up),down:l.images.work.getURL(l.images.down),front:l.images.work.getURL(l.images.front),back:l.images.work.getURL(l.images.back)},h,g=``;l.images.hdrConfig&&(h={right:l.images.work.getURL(l.images.gainmap_right),left:l.images.work.getURL(l.images.gainmap_left),up:l.images.work.getURL(l.images.gainmap_up),down:l.images.work.getURL(l.images.gainmap_down),front:l.images.work.getURL(l.images.gainmap_front),back:l.images.work.getURL(l.images.gainmap_back)},g=l.images.work.getURL(l.images.hdrConfig));let _=`pano:`+bv([m,p,f]);if(this.pendingTextureTask){if(this.pendingTextureTask.hash===_)return;{let e=this.pendingTextureTask.panoId;(i=this.panoMeshes.get(e))==null||i.setProgress(0),this.emit(`pano.texture.abort`,$(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:{panoIndex:l.panoIndex,workCode:l.work.workCode}}))}}let v=`move-to-pano-`+s;this.pending.add(v);let y=this.modelScene.parameter,b;if(y.pano0&&y.pano0.map.name===_?b=y.pano0:y.pano1&&y.pano1.map.name===_&&(b=y.pano1),b){let n={panoId:s,effect:o,effectEasing:(a=t.effectEasing)==null?HS:a,panoPicture:{panoId:b.panoId,map:b.map,mapHistogram:b.mapHistogram,mapSize:b.mapSize,matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1,hdrConfig:b.hdrConfig?Object.assign({},b.hdrConfig):void 0},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};n.panoPicture&&this.panoPictureObserverMap.set(n.panoPicture,l),this.pendingTextureTask=void 0,Lc.shared.add(()=>{this.pending.delete(v),this.doMoveToPano(e,n,t)},!0,1);return}this.pendingTextureTask={panoId:s,hash:_,onLoad:(n,r)=>an(this,void 0,void 0,function*(){var i,a;let u=n.body;if(this.destroyed)u.dispose();else{u.name=_;let n=Array.isArray(u.image)?u.image[0]:u.image,d=(i=n==null?void 0:n.width)==null?2048:i,{data:f}=yield Tx(this.renderer,u,!0,My),p=new Iy().formPixels(f),m={panoId:s,effect:o,effectEasing:(a=t.effectEasing)==null?HS:a,panoPicture:{panoId:s,map:u,mapSize:d,mapHistogram:new c.Vector4().fromArray(p.toArray()),matrix:l.matrix.clone().premultiply(l.work.transform),zoom:1,hdrConfig:r},position:l.position.clone().applyMatrix4(l.work.transform),fixCameraTransform:new c.Matrix4};m.panoPicture&&this.panoPictureObserverMap.set(m.panoPicture,l),this.doMoveToPano(e,m,t)}}),onError:n=>{let r=Object.assign(Object.assign(Object.assign({},e),{mode:this.mode}),ox(this.camera.pose));this.emit(`pano.error`,$(`pano.error`,{error:n,userAction:this.userAction,options:t,prevPano:this.currentPano,progress:0,state:r})),this.emit(`pano.cancel`,$(`pano.cancel`,{error:n,userAction:this.userAction,options:t,prevPano:this.currentPano,progress:0,state:r})),this.emit(`error`,n),t.moveCancelCallback&&t.moveCancelCallback()}};let x=this.panoMeshes.get(s);x&&x.tap&&x.tap();let S=[this.textureLoader.loadCubeTexture(m,{imageURL:{transform:f,options:p},format:c.RGBAFormat,viaAjax:!0,fetcher:w_(this.fiveId,l.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,$(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingTextureTask)==null?void 0:n.hash)===_&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)];g&&S.push(fetch(g).then(e=>e.json()),this.textureLoader.loadCubeTexture(h,{imageURL:{transform:f,options:p},format:c.RGBAFormat,viaAjax:!0,fetcher:w_(this.fiveId,l.work)},void 0,void 0,void 0,this.renderer)),Promise.all(S).then(([t,n,r])=>{var i,a;this.pending.delete(v),((i=this.pendingTextureTask)==null?void 0:i.hash)===_?(this.pendingTextureTask.onLoad(t,n&&Object.assign({map:r.body},Wx(n))),this.pendingTextureTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,$(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}))}).catch(t=>{var n,r;this.pending.delete(v),((n=this.pendingTextureTask)==null?void 0:n.hash)===_&&(this.pendingTextureTask.onError(t),this.pendingTextureTask=void 0,(r=this.panoMeshes.get(s))==null||r.setProgress(0)),this.emit(`pano.texture.error`,$(`pano.texture.error`,{error:t,progress:0,meta:null,pano:e})),this.emit(`error`,t)}),this.emit(`pano.texture.load`,$(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{duration:n,effect:r,userAction:i}=this.initial;this.userAction=i;let a=e.initAnimationEndState(this),o={workCode:a.workCode,panoIndex:a.panoIndex},s={modelAlpha:0},c={perspToOrtho:0},l=!1;this.moveToPano(o,{longitude:a.longitude,latitude:a.latitude,fov:a.fov,effect:r,duration:n,moveStartCallback:e=>{l=!0,this.perspToOrthoMotion.set(c,n).catch(K),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:s}],n).catch(K),this.emit(`initAnimation.start`,$(`initAnimation.start`,{state:e,userAction:this.userAction}))},moveEndCallback:e=>{this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:e,userAction:this.userAction})),this.initAnimationed=!0,t()},moveCancelCallback:()=>{let e=Object.assign(Object.assign(Object.assign({},o),{mode:this.mode}),ox(this.camera.pose));l===!1&&this.emit(`initAnimation.start`,$(`initAnimation.start`,{state:e,userAction:this.userAction})),this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:e,userAction:this.userAction})),this.initAnimationed=!0,t()}},i)})}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}locationMotionKeyframesLength(e){let t=0;for(let n=1;n<e.length;n++){let r=this.panoResourceFromLocationMotionKeyframe(e[n-1]).position,i=this.panoResourceFromLocationMotionKeyframe(e[n]).position,a=r.distanceTo(i)*(e[n].value.count-e[n-1].value.count);t+=a}return t}doMoveToPano(e,t,n={}){var r,i,a,o,s,l,u,d,f,p,m;let h=G(),g=Mt();this.panoResources[g]=t;let _,v,y;if(this.locationMotion.ended){let[e,n]=this.locationMotion.getKeyFrameSegment(h),i=this.locationMotion.value,a=((r=this.panoResourceFromLocationMotionKeyframe(n))==null?this.camera:r).position,o=t.position;_=Math.max(a.distanceTo(o),1),v=[{key:n.key,progress:0,value:Object.assign(Object.assign({},i),{count:0})},{key:g,progress:1,value:{distance:0,count:1}}],y=0}else{let[e,n]=this.locationMotion.getKeyFrameSegment(h),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(n).position,o=t.position,s=n.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;_=c+Math.max(a.distanceTo(o),1),v=[{key:e.key,progress:0,value:Object.assign({},r)},{key:n.key,progress:c/_,value:n.value},{key:g,progress:1,value:{count:n.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(v);y=l===0||l===0?0:this.locationMotion.getProgressVelocity(h)*l/u}let b=t.effect===`instant`?0:this.calculateMovingDuration(n.duration,t.effect===`fly`||t.effect===`model`?_:0),x={longitude:n.longitude,latitude:n.latitude,fov:n.fov},S=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(i=x.longitude)==null?this.camera.pose.longitude:i,latitude:(a=x.latitude)==null?this.camera.pose.latitude:a,fov:(o=x.fov)==null?this.camera.pose.fov:o,offset:t.position.clone(),distance:this.camera.pose.distance}),C=this.currentPano;if(this.emit(`pano.moveTo`,$(`pano.moveTo`,{options:n,prevPano:C,progress:0,state:S,userAction:this.userAction,error:null})),n.moveStartCallback&&n.moveStartCallback(S),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=K,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),t.effect===`fly`||t.effect===`model`)this.cameraMotion.set(x,b).catch(K);else{let e=gi({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),n=gi({longitude:(s=x.longitude)==null?this.cameraMotion.value.longitude:s,latitude:(l=x.latitude)==null?this.cameraMotion.value.latitude:l}),r=new c.Object3D;r.lookAt(e);let i=new c.Matrix4().makeRotationFromQuaternion(r.quaternion);r.lookAt(n);let a=new c.Matrix4().makeRotationFromQuaternion(r.quaternion),o=i.clone().invert().premultiply(a),h=this.cameraMotion.value.fov,g=(u=x.fov)==null?this.cameraMotion.value.fov:u,_=1;t.effect===`zoomin`?_=1.5:t.effect===`zoomout`&&(_=.4);let y=H(g*_,1,170);for(let e=0;e<v.length-1;e++){let t=v[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(o),e.panoPicture&&(e.panoPicture.zoom=Math.tan(y/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(d=x.longitude)==null?this.cameraMotion.value.longitude:d,latitude:(f=x.latitude)==null?this.cameraMotion.value.latitude:f,fov:y}},{progress:1,value:{longitude:(p=x.longitude)==null?this.cameraMotion.value.longitude:p,latitude:(m=x.latitude)==null?this.cameraMotion.value.latitude:m,fov:g}}],b).catch(K)}this.locationMotion.setKeyframes(v,b,y).then(()=>{for(let e of this.modelScene.children)e instanceof U_&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});this.emit(`pano.arrived`,$(`pano.arrived`,{options:n,prevPano:C,progress:1,state:t,userAction:this.userAction,error:null})),n.moveEndCallback&&n.moveEndCallback(t);let r=this.works.getObserver(e);if(r&&r.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:r.images.video.size.clone(),matrix:r.images.video.matrix.clone(),panoMatrix:r.matrix.clone().premultiply(r.work.transform),alpha:1},t=Mt(),n=this.videoTexture.image;n.setAttribute(`uuid`,t),n.oncanplay=K,n.ontimeupdate=K,tS().then(i=>{i&&r.images.video&&n.getAttribute(`uuid`)===t&&(n.oncanplay=()=>{n.oncanplay=K,n.play()},n.ontimeupdate=()=>{n.currentTime>.5&&(n.ontimeupdate=K,this.panoVideo.setMaterial(e))},n.src=r.images.video.source)}).catch((()=>{n.removeAttribute(`uuid`)}))}else{let e=this.videoTexture.image;e.removeAttribute(`uuid`),e.oncanplay=K,e.ontimeupdate=K}},()=>{this.emit(`pano.cancel`,$(`pano.cancel`,{options:n,prevPano:C,progress:0,state:S,userAction:this.userAction,error:null})),n.moveCancelCallback&&n.moveCancelCallback()})}getForwardObserverOrNot(e,t){let n=this.works.getObserver(this.currentPano);if(!n)return null;let r=t==null?new c.Raycaster(e.position.clone(),e.getWorldDirection(new c.Vector3)):t;r.params.Points={threshold:.1},r.firstHitOnly=!0,r.floorIndex=-1;let i=n.standingPosition.clone().applyMatrix4(n.work.transform);if(n.position.clone().applyMatrix4(n.work.transform).distanceTo(r.ray.origin)>1){let e=new c.Raycaster(r.ray.origin,new c.Vector3(0,-1,0));e.firstHitOnly=r.firstHitOnly,e.floorIndex=r.floorIndex;let[t]=this.modelScene.intersectRaycaster(e);t&&t.distance<=2?i.copy(t.point):i.copy(r.ray.origin).add(new c.Vector3(0,-1.5,0))}let[a]=this.modelScene.intersectRaycaster(r),o=(a?a.point:r.ray.origin.clone().add(r.ray.direction.clone().normalize().multiplyScalar(3))).clone().sub(i).normalize();if(o.length()===0)return null;let s=n.work.observers,l=n.accessibleNodes.filter(t=>{if(t===this.currentPano.panoIndex&&n.work.workCode===this.currentPano.workCode)return!1;let r=s[t];if(!r)return!1;let i=r.standingPosition.clone().applyMatrix4(r.work.transform).project(e);return Math.abs(i.z)>1||Math.abs(i.x)>1||Math.abs(i.y)>1?!1:r.loadable||r.active}),u=new Map,d=l.slice().sort((e,t)=>{let n=s[e],r=u.get(n);r===void 0&&(r=WS.copy(n.standingPosition).applyMatrix4(n.work.transform).distanceTo(i),u.set(n,r));let a=s[t],o=u.get(a);return o===void 0&&(o=WS.copy(a.standingPosition).applyMatrix4(a.work.transform).distanceTo(i),u.set(a,o)),r-o});u.clear();for(let e of[Math.PI/8,Math.PI/6,Math.PI/4,Math.PI/3])for(let t of d){let n=s[t];if(n){let t=WS.copy(n.standingPosition).applyMatrix4(n.work.transform).sub(i);if(t&&t.length()!==0&&o.angleTo(t)<e)return n}}let f=null;if(t){let n=t.ray.intersectBox(this.modelScene.boundingBox,WS);n&&(n.project(e),Math.abs(n.z)<=1&&(f=n.clone()))}else f=new c.Vector3(0,0,0);if(f){let t=n.accessibleNodes.filter(t=>{if(t===this.currentPano.panoIndex&&n.work.workCode===this.currentPano.workCode)return!1;let r=s[t];if(!r)return!1;let i=r.position.clone().applyMatrix4(r.work.transform).project(e);return Math.abs(i.z)>1||Math.abs(i.x)>1||Math.abs(i.y)>1?!1:r.loadable||r.active}),r=new Map,i=t.slice().sort((t,n)=>{let i=s[t],a=r.get(i);a===void 0&&(a=WS.copy(i.position).applyMatrix4(i.work.transform).distanceTo(e.position),r.set(i,a));let o=s[n],c=r.get(o);return c===void 0&&(c=WS.copy(o.position).applyMatrix4(o.work.transform).distanceTo(e.position),r.set(o,c)),a-c});r.clear();for(let t of i){let n=s[t];if(n){let t=WS.copy(n.position).applyMatrix4(n.work.transform);if(t.project(e),Math.abs(t.z)>1)continue;if(Math.pow(f.x-t.x,2)+Math.pow(f.y-t.y,2)<Math.pow(.4,2))return n}}}return null}onTapGesture(e){var t;if(this.userAction=e.userAction,this.stopMomentumMovement(),!this.initAnimationed)return;let n=e.center.raycaster;n.floorIndex=-1;let r=this.camera.getDirection(new c.Vector3).setY(0),i=null,a=this.works.getObserver(this.currentPano);if(!a)return;let o=a.work.observers,s=a.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&a.work.workCode===this.currentPano.workCode)return!1;let t=o[e];return!t||WS.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[l]=this.modelScene.intersectRaycaster(n);if(l){let[e,n]=vf(s,e=>{let t=o[e];return t?WS.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(l.point):1/0},!0);typeof e==`number`&&n<this.panoTapTriggerRadius&&(i=(t=o[e])==null?null:t)}if(i||(i=this.getForwardObserverOrNot(this.camera,n)),i&&i.panoId===Sv(this.currentPano)&&(i=null),i&&!this.locationMotion.ended){for(let e of this.locationMotion.keyframes)if(this.panoResourceFromLocationMotionKeyframe(e).panoId===i.panoId){i=null;break}}if(!i)this.emit(`gesture.tap`,e),e.defaultPrevented||this.locationMotion.ended===!0&&this.cameraBounce();else{let t={},n=Math.PI/6,o=Math.PI/12,s=i.position.clone().applyMatrix4(i.work.transform).setY(0).sub(a.position.clone().applyMatrix4(i.work.transform).setY(0)).normalize(),c=[],l=[],u=[],d=i.work.observers;for(let e of i.accessibleNodes){if(i.panoIndex===e||e===this.currentPano.panoIndex&&i.work.workCode===this.currentPano.workCode)continue;let t=d[e];if(!t)continue;let r=t.position.clone().applyMatrix4(t.work.transform).sub(i.position.clone().applyMatrix4(i.work.transform)).setY(0).normalize();s.angleTo(r)<n&&u.push(r)}let[f]=(u.length>0?u:[...c,...l]).slice().sort((e,t)=>e.angleTo(s)-t.angleTo(s));if(f&&f.angleTo(r)>o&&(t.longitude=Math.atan2(-f.x,-f.z)),this.cameraMotion.value.latitude<-Math.PI/4){let n=e.state.fov;t.latitude=H(0,H(typeof this.minLatitude==`function`?this.minLatitude(n):this.minLatitude,-Math.PI/2,Math.PI/2),H(typeof this.maxLatitude==`function`?this.maxLatitude(n):this.maxLatitude,-Math.PI/2,Math.PI/2))}let p=Object.assign({},e.state);if(p.workCode=i.work.workCode,p.panoIndex=i.panoIndex,t.longitude!==void 0&&(p.longitude=t.longitude),t.latitude!==void 0&&(p.latitude=t.latitude),t.fov!==void 0&&(p.fov=t.fov),p.distance=0,p.offset=i.position.clone(),e.state=p,this.emit(`gesture.tap`,e),!e.defaultPrevented){if(this.emit(`pano.select`,$(`pano.select`,{prevPano:this.currentPano,state:p,userAction:e.userAction,options:t,progress:0,error:null})),i&&!i.active){let e=Sv({panoIndex:i.panoIndex,workCode:i.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}i&&i.active&&this.emit(`pano.request`,$(`pano.request`,{userAction:e.userAction,prevPano:this.currentPano,progress:0,state:p,options:t,error:null}))}}}},JS=new c.Vector3(0,1.6,0),YS=new c.Box3,XS=new c.Vector3,ZS=Object.assign({},Zx),QS=class e extends Qx{static parseArgs(t){return t instanceof e?t:super.parseArgs(t)}static initAnimationEndState(e){var t,n,r,i,a,o;let s=this.parseArgs(e),l=s.works,{state:u,currentState:d}=e.initial,f=typeof u.panoIndex==`number`?{workCode:(r=(t=u.workCode)==null?(n=s.works[0])==null?void 0:n.workCode:t)==null?``:r,panoIndex:u.panoIndex}:{workCode:d.workCode,panoIndex:d.panoIndex},p=l.getObserver(f),m=H((i=u.fov)==null?!p||cx(d.mode)?d.fov:s.defaultFov:i,s.minFov,s.maxFov),h=(a=u.longitude)==null?d.longitude:a,g=H(typeof s.minLatitude==`function`?s.minLatitude(m):s.minLatitude,-Math.PI/2,Math.PI/2),_=H(typeof s.maxLatitude==`function`?s.maxLatitude(m):s.maxLatitude,-Math.PI/2,Math.PI/2),v=H((o=u.latitude)==null?!p||cx(d.mode)?d.latitude:s.defaultLatitude:o,g,_),y=new c.Vector3;if(s.initial.state.offset)y.copy(s.initial.state.offset);else if(p)y.copy(p.position).applyMatrix4(p.work.transform);else{let e=gi(d).setLength(d.distance);y.copy(s.initial.currentState.offset).sub(e)}return{workCode:f.workCode,panoIndex:f.panoIndex,mode:`Model`,longitude:h,latitude:v,fov:m,offset:y,distance:0}}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Model`,this.locationMotion=new J({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new J({modelAlpha:this.modelScene.parameter.resolveValue().modelAlpha}),this.perspToOrthoMotion=new J({perspToOrtho:this.camera.perspToOrtho.x})}updateConfiguration(e){return super.updateConfiguration(e)}destroy(){super.destroy(),this.locationMotion.dispose()}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(t,n,r,i){this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));return(a.workCode!==this.currentPano.workCode||a.panoIndex!==this.currentPano.panoIndex||a.longitude!==this.cameraMotion.value.longitude||a.latitude!==this.cameraMotion.value.latitude||a.fov!==this.cameraMotion.value.fov)&&this.moveToPosition(a.offset,{duration:0,longitude:a.longitude,latitude:a.latitude,fov:a.fov},i),!0}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return r.distance=0,e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:0,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,t,...n){if(this.destroyed)return;let r={},i={};if(this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),r.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),r.progress=1,r.pano0=r.pano1=t}if(this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),!this.locationMotion.ended){this.locationMotion.update(e),i.distance=this.locationMotion.value.distance,i.offset=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z);let t=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),n=[];for(let e of this.works){let r=this.modelScene.models.find(t=>t.work===e);if(!(!r||r.visible===!1)&&!(e.observers.length<=0)&&(YS.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),YS.containsPoint(t)))for(let t of e.observers)n.push(t)}let r=vf(n,e=>XS.copy(e.position).applyMatrix4(e.work.transform).distanceTo(t));this.currentPano=r?{workCode:r.work.workCode,panoIndex:r.panoIndex}:{workCode:``,panoIndex:0}}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),lx(r)||this.modelScene.parameter.set(r),lx(i)||this.setCamera(i);let a=this.works.getObserver(this.currentPano);if(this.intersectMesh&&this.intersectMesh.parent&&a&&a.position.y-a.standingPosition.y>10){let e=H(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1)}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={modelAlpha:1},c={perspToOrtho:0},l={longitude:o.longitude,latitude:o.latitude,fov:o.fov,duration:i,moveStartCallback:e=>{this.perspToOrthoMotion.set(c,i).catch(K),this.modelAlphaMotion.set(s,i).catch(K),this.emit(`initAnimation.start`,$(`initAnimation.start`,{state:e,userAction:this.userAction}))},moveEndCallback:e=>{this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:e,userAction:this.userAction})),t()},moveCancelCallback:()=>{let e=this.currentPano,n=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance});this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:n,userAction:this.userAction})),t()}};this.moveToPosition(o.offset,l,a)})}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(G())[1],t=this.locationMotion.getKeyFrameSegment(G())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,offset:new c.Vector3(t.value.x,t.value.y,t.value.z),distance:t.value.distance})}moveToPano(e,t={},n){let r=this.works.getObserver(e);if(r){let e=new c.Vector3().copy(r.position).applyMatrix4(r.work.transform);this.moveToPosition(e,t,n)}}moveToPosition(e,t={},n){var r,i,a;this.userAction=n,this.stopMomentumMovement();let o=G(),s=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),l=s.distanceTo(e),u=this.locationMotion.getProgressVelocity(o),d=0;for(let e=1;e<this.locationMotion.keyframes.length;e++){let{x:t,y:n,z:r}=this.locationMotion.keyframes[e-1].value,{x:i,y:a,z:o}=this.locationMotion.keyframes[e].value;d+=Math.sqrt(Math.pow(i-t,2)+Math.pow(a-n,2)+Math.pow(o-r,2))}let f=l===0?0:u*d/l,p=this.calculateMovingDuration(t.duration,l),m={x:e.x,y:e.y,z:e.z,distance:0},h={longitude:t.longitude,latitude:t.latitude,fov:t.fov},g=[];for(let e of this.works){let t=this.modelScene.models.find(t=>t.work===e);if(!(!t||t.visible===!1)&&!(e.observers.length<=0)&&(YS.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),YS.containsPoint(s)))for(let t of e.observers)g.push(t)}let _=vf(g,e=>XS.copy(e.position).applyMatrix4(e.work.transform).distanceTo(s)),v=_?{workCode:_.work.workCode,panoIndex:_.panoIndex}:{workCode:``,panoIndex:0},y=Object.assign(Object.assign({},v),{mode:this.mode,longitude:(r=h.longitude)==null?this.camera.pose.longitude:r,latitude:(i=h.latitude)==null?this.camera.pose.latitude:i,fov:(a=h.fov)==null?this.camera.pose.fov:a,offset:e.clone(),distance:0}),b=this.currentPano;this.emit(`pano.moveTo`,$(`pano.moveTo`,{options:t,prevPano:b,progress:0,state:y,userAction:this.userAction,error:null})),t.moveStartCallback&&t.moveStartCallback(y),this.cameraMotion.set(h,p).catch(K),this.locationMotion.set(m,p,f).then(()=>{for(let e of this.modelScene.children)e instanceof U_&&e.show();let e=Object.assign(Object.assign(Object.assign({},v),{mode:this.mode}),ox(this.camera.pose));this.emit(`pano.arrived`,$(`pano.arrived`,{options:t,prevPano:b,progress:0,state:e,userAction:this.userAction,error:null})),t.moveEndCallback&&t.moveEndCallback(e)},()=>{t.moveCancelCallback&&t.moveCancelCallback(),this.emit(`pano.cancel`,$(`pano.cancel`,{options:t,prevPano:b,progress:0,state:y,userAction:this.userAction,error:null}))})}onTapGesture(e){let t=e.center.raycaster;this.stopMomentumMovement();let[n]=this.modelScene.intersectRaycaster(t);if(n&&n.face){let e=n.face.normal,t=n.point;if(new c.Vector3(0,1,0).angleTo(e)>Math.PI/3){let r=new c.Raycaster;r.firstHitOnly=!0;let i=e.clone().setLength(.3).add(t);r.set(i,new c.Vector3(0,-1,0)),n=this.modelScene.intersectRaycaster(r)[0]}}if(n){let t=new c.Vector3().copy(n.point).add(JS),r=[];for(let e of this.works){let n=this.modelScene.models.find(t=>t.work===e);if(!(!n||n.visible===!1)&&!(e.observers.length<=0)&&(YS.copy(e.observerBox).expandByScalar(10).applyMatrix4(e.transform),YS.containsPoint(t)))for(let t of e.observers)r.push(t)}let[i,a]=vf(r,e=>XS.copy(e.position).applyMatrix4(e.work.transform).distanceTo(t),!0);i&&a<5&&(t.y=XS.copy(i.position).applyMatrix4(i.work.transform).y),e.state.offset.copy(t),e.state.distance=0,this.emit(`gesture.tap`,e),e.defaultPrevented||this.moveToPosition(t,{},!0)}else this.emit(`gesture.tap`,e),e.defaultPrevented||this.cameraBounce()}},$S=new c.Box3,eC=new c.Vector3,tC=.5,nC=Math.PI/7,rC={defaultLongitude:Math.PI/4,defaultLatitude:Math.PI/4,defaultDistance:150,maxLatitude:Math.PI/2,minLatitude:0,cameraType:`auto`,cameraFence:null,intersectMeshCreator:()=>new Vx},iC={Floorplan:Jx,Topview:Xx,Panorama:qS,Model:QS,Mapview:class e extends Dx{static parseArgs(t){var n,r,i,a,o,s,c,l;if(t instanceof e)return t;let u=super.parseArgs(t);return Object.assign(Object.assign({},u),{defaultLongitude:(n=t.defaultLongitude)==null?rC.defaultLongitude:n,defaultLatitude:(r=t.defaultLatitude)==null?rC.defaultLatitude:r,defaultDistance:(i=t.defaultDistance)==null?rC.defaultDistance:i,maxLatitude:(a=t.maxLatitude)==null?rC.maxLatitude:a,minLatitude:(o=t.minLatitude)==null?rC.minLatitude:o,cameraType:(s=t.cameraType)==null?rC.cameraType:s,cameraFence:(c=t.cameraFence)==null?rC.cameraFence:c,intersectMeshCreator:(l=t.intersectMeshCreator)==null?rC.intersectMeshCreator:l})}static distanceFromModel(e,t,n){let r=e.boundingBox,i=r.isEmpty()?10:Math.pow(Math.pow(r.max.x-r.min.x+1,2)+Math.pow(r.max.y-r.min.y+1,2)+Math.pow(r.max.z-r.min.z+1,2),1/2);i=isNaN(i)||!isFinite(i)?1:i;let a=i/2/Math.tan(Math.PI*t/360);return n<1&&(a/=n),isNaN(a)||!isFinite(a)?i:a}static initAnimationEndState(t){var n,r,i,a,o,s,l;let u=this.parseArgs(t),d=u.works,f=u.modelScene,{state:p,currentState:m}=t.initial,h=typeof p.panoIndex==`number`?{workCode:(i=(n=p.workCode)==null?(r=u.works[0])==null?void 0:r.workCode:n)==null?``:i,panoIndex:p.panoIndex}:{workCode:m.workCode,panoIndex:m.panoIndex},g=(a=p.fov)==null?60:a,_=H(typeof u.minLatitude==`function`?u.minLatitude(g):u.minLatitude,-Math.PI/2,Math.PI/2),v=H(typeof u.maxLatitude==`function`?u.maxLatitude(g):u.maxLatitude,-Math.PI/2,Math.PI/2),y=H((o=p.latitude)==null?sx(m.mode)?m.latitude:u.defaultLatitude:o,_,v),b=e.distanceFromModel(u.modelScene,g,u.camera.aspect),x=new c.Vector3,S=(s=p.distance)==null?Math.min(u.defaultDistance,b):s,C=(l=p.longitude)==null?sx(m.mode)?m.longitude:u.defaultLongitude:l;if(p.offset)x.copy(p.offset);else{let e=d.getObserver(h);u.defaultDistance<b&&e?(x.copy(e.position).applyMatrix4(e.work.transform),p.longitude===void 0&&(C=m.longitude)):(f.boundingBox.getCenter(x),S=b)}return Object.assign(Object.assign({},h),{mode:`Mapview`,longitude:C,latitude:y,fov:g,offset:x,distance:S})}constructor(t){let n=e.parseArgs(t);super(n),this.mode=`Mapview`,this.defaultLongitude=n.defaultLongitude,this.defaultLatitude=n.defaultLatitude,this.defaultDistance=n.defaultDistance,this.maxLatitude=n.maxLatitude,this.minLatitude=n.minLatitude,this.cameraType=n.cameraType,this.cameraFence=n.cameraFence,this.locationMotion=new J({x:this.camera.pose.offset.x,y:this.camera.pose.offset.y,z:this.camera.pose.offset.z,distance:this.camera.pose.distance}),this.modelAlphaMotion=new J({modelAlpha:this.modelScene.parameter.resolveValue().modelAlpha}),this.perspToOrthoMotion=new J({perspToOrtho:this.camera.perspToOrtho.x}),this.pendingTextureId=null,this.textureLoader=new Yc,this.intersectMeshCreator=n.intersectMeshCreator,this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=`intersect`,this.intersectMesh.visible=!1,this.helper.add(this.intersectMesh)}updateConfiguration(e){if(super.updateConfiguration(e)===!1)return!1;if(e.defaultLongitude!==void 0&&this.defaultLongitude!==e.defaultLongitude&&(this.defaultLongitude=e.defaultLongitude),e.defaultLatitude!==void 0&&this.defaultLatitude!==e.defaultLatitude&&(this.defaultLatitude=e.defaultLatitude),e.defaultDistance!==void 0&&this.defaultDistance!==e.defaultDistance&&(this.defaultDistance=e.defaultDistance),e.maxLatitude!==void 0&&this.maxLatitude!==e.maxLatitude&&(this.maxLatitude=e.maxLatitude),e.minLatitude!==void 0&&this.minLatitude!==e.minLatitude&&(this.minLatitude=e.minLatitude),e.cameraType!==void 0&&this.cameraType!==e.cameraType&&(this.cameraType=e.cameraType),this.cameraFence instanceof c.Box3&&e.cameraFence instanceof c.Box3||this.cameraFence instanceof c.Sphere&&e.cameraFence instanceof c.Sphere?this.cameraFence.equals(e.cameraFence)||(this.cameraFence=e.cameraFence):e.cameraFence!==void 0&&(this.cameraFence=e.cameraFence),e.intersectMeshCreator!==void 0&&this.intersectMeshCreator!==e.intersectMeshCreator){this.intersectMeshCreator=e.intersectMeshCreator;let t=this.intersectMesh;this.intersectMesh=this.intersectMeshCreator(),this.intersectMesh.name=t.name,this.intersectMesh.visible=t.visible;let n=this.intersectMesh.parent;n&&n.add(this.intersectMesh),t.dispose()}return!0}destroy(){super.destroy(),this.pendingTextureId=null,this.locationMotion.dispose(),this.panState=void 0,this.intersectMesh.dispose(),this.helper.remove(this.intersectMesh)}isReady(){return this.locationMotion.ended===!1?!1:super.isReady()}updateWork(t,n,r,i){this.userAction=i,this.works=t;let a=e.initAnimationEndState(Object.assign(Object.assign({},this),{initial:{currentState:Object.assign(Object.assign({},this.currentPano),this.camera.pose),duration:r.duration,effect:r.effect,state:n,userAction:i}}));this.currentPano={workCode:a.workCode,panoIndex:a.panoIndex};let o={longitude:a.longitude,latitude:a.latitude,fov:a.fov},s={x:a.offset.x,y:a.offset.y,z:a.offset.z,distance:a.distance};return(o.longitude!==this.cameraMotion.value.longitude||o.latitude!==this.cameraMotion.value.latitude||o.fov!==this.cameraMotion.value.fov)&&this.cameraMotion.set(o,r.duration).catch(K),(s.x!==this.locationMotion.value.x||s.y!==this.locationMotion.value.y||s.z!==this.locationMotion.value.z||s.distance!==this.locationMotion.value.distance)&&this.locationMotion.set(s,r.duration).catch(K),!0}updateModel(e){super.updateModel(e),this.hideIntersectMesh()}updateCamera(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r={},i={};return e.distance!==void 0&&(r.distance=e.distance),e.offset!==void 0&&(r.x=e.offset.x,r.y=e.offset.y,r.z=e.offset.z),e.longitude!==void 0&&(i.longitude=e.longitude),e.latitude!==void 0&&(i.latitude=e.latitude),e.fov!==void 0&&(i.fov=e.fov),this.locationMotion.set(r,t).catch(K),this.cameraMotion.set(i,t).catch(K)})}updateCameraWithKeyframes(e,t,n){return this.initAnimationReady.then(()=>{this.userAction=n,this.stopMomentumMovement();let r=[],i=[];for(let t of e)r.push({key:t.key,progress:t.progress,value:{distance:t.value.distance,x:t.value.offset.x,y:t.value.offset.x,z:t.value.offset.x}}),i.push({key:t.key,progress:t.progress,value:{longitude:t.value.longitude,latitude:t.value.latitude,fov:t.value.fov}});return this.locationMotion.setKeyframes(r,t).catch(K),this.cameraMotion.setKeyframes(e,t)})}updateTime(e,t){if(this.destroyed)return;let n={},r={};if(this.locationMotion.ended||(this.locationMotion.update(e),r.distance=this.locationMotion.value.distance,r.offset=new c.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),this.modelAlphaMotion.ended||(this.modelAlphaMotion.update(e),n.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.modelScene.parameter.modelAlpha===0&&this.modelScene.parameter.progress!==1){let{pano0:e,pano1:t}=this.modelScene.parameter;e&&e.map!==(t==null?void 0:t.map)&&e.map.dispose(),n.progress=1,n.pano0=n.pano1=t}let i=0;if(this.cameraType===`auto`?i=+(Math.abs(Math.PI/2-this.cameraMotion.value.latitude)<.02||Math.abs(-Math.PI/2-this.cameraMotion.value.latitude)<.02):this.cameraType===`perspective`?i=0:this.cameraType===`orthographic`&&(i=1),this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho!==i&&this.perspToOrthoMotion.set({perspToOrtho:i},500).catch(K),this.perspToOrthoMotion.ended||(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),lx(n)||this.modelScene.parameter.set(n),lx(r)||this.setCamera(r),this.cameraFence&&!this.panState&&!this.pinchState&&!this.mouseWheelState&&!this.inMomentumMovement&&this.locationMotion.ended&&this.perspToOrthoMotion.ended&&this.cameraMotion.ended){let e=gi(this.camera.pose,new c.Vector3),t=new c.Vector3().copy(this.camera.pose.offset).sub(e.clone().multiplyScalar(this.camera.pose.distance));if(this.cameraFence.distanceToPoint(t)>.01){let e=this.cameraFence.clampPoint(t,new c.Vector3),n=this.camera.pose.offset.clone().add(e).sub(t),r=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:n,distance:this.camera.pose.distance});this.fixFinalState(r),this.locationMotion.set({x:r.offset.x,y:r.offset.y,z:r.offset.z,distance:r.distance},300).catch(K)}}if(this.intersectMesh&&this.intersectMesh.parent){let e=H(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1)}getTargetState(){let e=this.cameraMotion.getKeyFrameSegment(G())[1],t=this.locationMotion.getKeyFrameSegment(G())[1];return Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:e.value.longitude,latitude:e.value.latitude,fov:e.value.fov,distance:t.value.distance,offset:new c.Vector3(t.value.x,t.value.y,t.value.z)})}initAnimation(){return this.destroyed?Promise.resolve():new Promise(t=>{let{state:n,currentState:r,duration:i,userAction:a}=this.initial;this.userAction=a;let o=e.initAnimationEndState(this),s={longitude:o.longitude,latitude:o.latitude,fov:o.fov},c={x:o.offset.x,y:o.offset.y,z:o.offset.z,distance:o.distance};this.emit(`initAnimation.start`,$(`initAnimation.start`,{state:o,userAction:this.userAction})),this.perspToOrthoMotion.set({perspToOrtho:0},i).catch(K),this.modelAlphaMotion.set({modelAlpha:1},i/3).catch(K),this.cameraMotion.set(s,i).catch(K),this.locationMotion.set(c,i).then(()=>{this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:o,userAction:this.userAction}))},e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),ox(this.camera.pose));this.emit(`initAnimation.end`,$(`initAnimation.end`,{state:t,userAction:this.userAction}))}).then(()=>{t()})})}getForwardObserverOrNot(e){let[t]=this.modelScene.intersectRaycaster(e);if(!t)return null;let n=[];for(let t of this.works){let r=this.modelScene.models.find(e=>e.work===t);if(!(!r||r.visible===!1)&&!(t.observers.length<=0)&&($S.copy(t.observerBox).expandByScalar(10).applyMatrix4(t.transform),$S.containsPoint(e.ray.origin)||e.ray.intersectsBox($S)))for(let e of t.observers)n.push(e)}let[r,i]=vf(n,e=>eC.copy(e.standingPosition).applyMatrix4(e.work.transform).distanceTo(t.point),!0);return r&&i<Math.max(r.standingPosition.distanceTo(this.camera.position)/5,10)?r:null}coordinatesForOffset(e){let t=this.renderer.getSize(new c.Vector2);return{longitude:-2*e.x/(t.x*this.viewport.width),latitude:2*e.y/(t.y*this.viewport.height)}}requestMomentumMovement(e,t,n,r){if(this.inMomentumMovement===null)return;r=Math.max(r,1);let i=Object.assign({},n),a={longitude:0,latitude:0,x:0,y:0,z:0};for(let e=0;e<r;e++)i.longitude*=.996,i.latitude*=.996*.998,i.x*=.99,i.y*=.99,i.z*=.99,a.longitude+=i.longitude,a.latitude+=i.latitude,a.x+=i.x,a.y+=i.y,a.z+=i.z;let o=this.cameraMotion.value.fov,s=hi(this.cameraMotion.value.longitude+a.longitude),l=H(typeof this.minLatitude==`function`?this.minLatitude(o):this.minLatitude,-Math.PI/2,Math.PI/2),u=H(typeof this.maxLatitude==`function`?this.maxLatitude(o):this.maxLatitude,-Math.PI/2,Math.PI/2),d=H(this.cameraMotion.value.latitude+a.latitude,l,u),f=new c.Vector3(this.locationMotion.value.x+a.x,this.locationMotion.value.y+a.y,this.locationMotion.value.z+a.z),p=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:s,latitude:d,offset:f,fov:o,distance:this.locationMotion.value.distance}),m=e.state.offset.clone().sub(gi(e.state).setLength(p.distance)),h=!(Math.abs(i.longitude)>1e-4||Math.abs(i.latitude)>1e-4||Math.abs(i.x)>1e-4||Math.abs(i.y)>1e-4||Math.abs(i.z)>1e-4);(this.cameraFence?this.cameraFence.containsPoint(m):!0)===!1&&(h=!0);let g=$(`gesture.momentum`,Object.assign(Object.assign({},e),{isFirst:t,isFinal:h,state:p}));if(this.inMomentumMovement.event=g,this.emit(`gesture.momentum`,g),e.defaultPrevented){this.inMomentumMovement=null;return}this.inMomentumMovement&&(this.cameraMotion.set({longitude:s,latitude:d},0).catch(K),this.locationMotion.set({x:p.offset.x,y:p.offset.y,z:p.offset.z,distance:p.distance},0).catch(K),h?this.inMomentumMovement=null:Lc.shared.add((t,n)=>{this.requestMomentumMovement(e,!1,i,n)},!0))}fixFinalState(e){if(this.perspToOrthoMotion.getTargetKeyframe().value.perspToOrtho===1)return;let t=gi(e,new c.Vector3),n=new c.Vector3().copy(e.offset).sub(t.clone().setLength(e.distance)),r=new c.Raycaster(n,t);r.params.Points={threshold:.1},r.firstHitOnly=!0,r.hitFilter=e=>e.distance>tC+r.near,r.near=this.camera.near,r.far=this.camera.far;let i;if(i=this.modelScene.intersectRaycaster(r)[0],i&&i.distance<this.camera.near&&(i=void 0),!i){let e=new c.Plane(new c.Vector3(0,1,0),-this.modelScene.boundingBox.min.y),t=r.ray.intersectPlane(e,new c.Vector3);if(t){let e=t.distanceTo(r.ray.origin);e<1e3&&e>=r.near&&(i={distance:e,floorIndex:0,floor:0,point:t,object:this.scene,face:null})}}if(!i){let r=Math.max(e.distance,3);i={distance:r,floorIndex:0,floor:0,point:n.clone().add(t.clone().setLength(r)),object:this.scene,face:null}}i.distance>=this.camera.near&&Xb(e.distance,i.distance)&&(e.distance=i.distance,e.offset=i.point)}onPanGesture(e){this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=e.pointers.length,n=this.panState,r=0,i=!1;e.pointerType===`mouse`&&(r=e.center.buttons,i=e.center.shiftKey),n&&r===0&&n.buttons!==0&&(r=n.buttons);let a=n==null?void 0:n.target;if(!a){let t=this.relativeClientPosition(e.center),n=this.createRaycasterFromCamera(t,this.camera);a=new c.Vector3().copy(n.ray.direction).multiplyScalar(3).add(n.ray.origin);let[r]=this.modelScene.intersectRaycaster(n);if(!r&&n.ray.direction.y<-.3){let e=new c.Plane(new c.Vector3(0,1,0),0),t=n.ray.intersectPlane(e,new c.Vector3);if(t){let e=t.distanceTo(n.ray.origin);e<1e4&&e>=n.near&&(r={distance:e,floorIndex:0,floor:0,point:t,object:this.scene})}}if(r)a.copy(r.point);else{let e=new c.Vector3().copy(this.camera.pose.offset).sub(this.camera.position).normalize(),t=new c.Plane().setFromNormalAndCoplanarPoint(e,this.camera.pose.offset);n.ray.intersectPlane(t,a)}}if(e.isFinal?this.panState=void 0:this.panState={target:a,buttons:r,pointerLength:t,x:e.center.x,y:e.center.y},!(n===void 0||n.pointerLength!==t))if(t>1||r===2||i){let t={x:e.center.x-n.x,y:e.center.y-n.y},r=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),i=gi(this.cameraMotion.value).setLength(this.locationMotion.value.distance).add(r),a=new c.Vector3().copy(i).sub(n.target).length();a*=Math.tan(this.camera.pose.fov/2*Math.PI/180);let o=this.renderer.getSize(new c.Vector2),s=2*t.x*a/o.y,l=2*t.y*a/o.y,u=new c.Vector3;u.setFromMatrixColumn(this.camera.matrix,0),u.multiplyScalar(-s),r.add(u),this.camera.pose.latitude<nC?u.setFromMatrixColumn(this.camera.matrix,1):(u.setFromMatrixColumn(this.camera.matrix,0),u.crossVectors(this.camera.up,u)),u.multiplyScalar(l),r.add(u);let d=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:r,distance:this.camera.pose.distance});if(e.state=d,this.emit(`gesture.pan`,e),e.defaultPrevented)return;if(this.locationMotion.set({x:d.offset.x,y:d.offset.y,z:d.offset.z},0).catch(K),e.isFinal&&(this.fixFinalState(d),Object.assign(e,{__fixFinalState:!0}),this.locationMotion.set({distance:d.distance,x:d.offset.x,y:d.offset.y,z:d.offset.z},0).catch(K)),e.isFinal){let t=this.renderer.getSize(new c.Vector2),n=2*e.velocityX*a/t.y,r=2*e.velocityY*a/t.y,i=new c.Vector3,o=new c.Vector3;i.setFromMatrixColumn(this.camera.matrix,0),i.multiplyScalar(-n),o.add(i),this.camera.pose.latitude<nC?i.setFromMatrixColumn(this.camera.matrix,1):(i.setFromMatrixColumn(this.camera.matrix,0),i.crossVectors(this.camera.up,i)),i.multiplyScalar(r),o.add(i),this.inMomentumMovement={uuid:Mt()},this.requestMomentumMovement(e,!0,{longitude:0,latitude:0,x:o.x,y:o.y,z:o.z},0)}}else{let t={x:e.center.x-n.x,y:e.center.y-n.y},r=this.coordinatesForOffset(t),i=hi(this.cameraMotion.value.longitude+r.longitude),a=this.camera.pose.fov,o=H(typeof this.minLatitude==`function`?this.minLatitude(a):this.minLatitude,-Math.PI/2,Math.PI/2),s=H(typeof this.maxLatitude==`function`?this.maxLatitude(a):this.maxLatitude,-Math.PI/2,Math.PI/2),c=H(this.cameraMotion.value.latitude+r.latitude,o,s);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);let l=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:i,latitude:c,fov:a,offset:this.camera.pose.offset,distance:this.camera.pose.distance});if(e.isFinal&&Object.assign(e,{__fixFinalState:!0}),e.state=l,this.emit(`gesture.pan`,e),e.defaultPrevented)return;if(e.isFinal?this.locationMotion.set({distance:l.distance,x:l.offset.x,y:l.offset.y,z:l.offset.z},0).catch(K):this.cameraMotion.set({longitude:l.longitude,latitude:l.latitude},0).catch(K),e.isFinal){let t=e.velocityX,n=e.velocityY;this.inMomentumMovement={uuid:Mt()},this.requestMomentumMovement(e,!0,Object.assign(Object.assign({},this.coordinatesForOffset({x:t,y:n})),{x:0,y:0,z:0}),0)}}}onPinchGesture(t){var n;if(!this.initAnimationIsReady)return;this.userAction=t.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let r=(n=this.pinchState)==null?void 0:n.distance;if(t.isFirst){this.pinchState={x:t.center.x,y:t.center.y,scale:1,distance:this.locationMotion.value.distance};return}if(r===void 0)return;let i=this.modelScene.boundingBox.getCenter(new c.Vector3),a=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),o=H(r/t.scale,tC,1/0),s=t.state.offset.clone().sub(gi(t.state).setLength(o)),l=this.modelScene.boundingBox.containsPoint(s),u;if(!l&&this.pinchState&&this.pinchState.scale>t.scale&&i.distanceTo(s)>a?u=t.state.distance:(u=o,this.pinchState&&(this.pinchState.scale=t.scale)),t.state.distance=u,this.emit(`gesture.pinch`,t),!t.defaultPrevented&&(this.locationMotion.set({distance:t.state.distance},0).catch(K),t.pointerType!==`mouse`&&(t.type=`gesture.pan`,this.onPanGesture(t)),t.isFinal)){if(!(`__fixFinalState`in t)){let e=t.state;this.fixFinalState(t.state);let n={x:e.offset.x,y:e.offset.y,z:e.offset.z,distance:e.distance};this.locationMotion.set(n,0).catch(K)}this.panState=void 0,this.pinchState=void 0}}onMouseMove(e){var t,n;if(!this.intersectMesh.parent||this.panState||this.pinchState||this.mouseWheelState||(this.emit(`gesture.mousemove`,e),e.defaultPrevented))return;let r=e.center.raycaster;if(e.isFinal&&this.intersectMesh.parent&&this.intersectMesh.visible===!0){this.hideIntersectMesh();return}let[i]=this.modelScene.intersectRaycaster(r),a=$(`intersect.update`,{raycaster:r,intersection:i==null?null:i,object:this.intersectMesh});if(this.emit(`intersect.update`,a),a.defaultPrevented){this.hideIntersectMesh();return}if(i){let e=(n=(t=i.face)==null?void 0:t.normal)==null?new c.Vector3().copy(r.ray.direction).multiplyScalar(-1):n,a=e.clone(),o=i.point.clone();this.intersectMesh.position.copy(o);let s=o.clone().add(a);if(this.intersectMesh.lookAt(s),Math.abs(e.y)>.99){let e=this.camera.position.clone().sub(o);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0}else this.hideIntersectMesh()}onMouseWheel(t){if(this.initAnimationIsReady)if(this.userAction=t.userAction,this.stopMomentumMovement(),this.hideIntersectMesh(),t.isFinal){let e=Object.assign(Object.assign({},this.currentPano),{mode:this.mode,longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov,offset:new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),distance:this.locationMotion.value.distance});if(this.fixFinalState(e),this.emit(`gesture.mousewheel`,t),t.defaultPrevented)return;let n={x:e.offset.x,y:e.offset.y,z:e.offset.z,distance:e.distance};this.locationMotion.set(n,0).catch(K)}else{let n=e.distanceFromModel(this.modelScene,this.cameraMotion.value.fov,this.camera.aspect),r=new c.Vector3(this.locationMotion.value.x,this.locationMotion.value.y,this.locationMotion.value.z),i=gi(this.cameraMotion.value,new c.Vector3).negate(),a=new c.Ray(r,i).intersectBox(this.modelScene.boundingBox,new c.Vector3);a&&(n+=a.distanceTo(r));let o=Math.max(this.locationMotion.value.distance-this.camera.near,0),s=t.center.delta/10*Math.max(o/5,.1);if(o<=n||s>0)if(this.locationMotion.value.distance-s>=tC){let e=this.locationMotion.value.distance-s;t.state.distance=e}else{let e=gi(this.cameraMotion.value);e.setLength(s),t.state.offset.add(e)}if(this.emit(`gesture.mousewheel`,t),t.defaultPrevented)return;this.locationMotion.set({distance:t.state.distance,x:t.state.offset.x,y:t.state.offset.y,z:t.state.offset.z},0).catch(K)}}onTapGesture(e){var t;this.userAction=e.userAction,this.stopMomentumMovement();let n=e.center.raycaster,r=this.getForwardObserverOrNot(n);if(!r)this.emit(`gesture.tap`,e);else{let n={longitude:this.camera.pose.longitude,latitude:0},i=Object.assign(Object.assign({},e.state),{mode:`Panorama`,workCode:r.work.workCode,panoIndex:r.panoIndex,longitude:n.longitude,latitude:n.latitude,offset:r?r.position.clone():new c.Vector3,distance:0});if(e.state=i,this.emit(`gesture.tap`,e),!e.defaultPrevented&&(this.emit(`pano.select`,$(`pano.select`,{prevPano:this.currentPano,state:i,userAction:e.userAction,options:n,progress:0,error:null})),r&&r.active)){let e=this.pendingTextureId=Mt(),a=Sv({panoIndex:r.panoIndex,workCode:r.work.workCode}),o={right:r.images.work.getURL(r.images.right),left:r.images.work.getURL(r.images.left),up:r.images.work.getURL(r.images.up),down:r.images.work.getURL(r.images.down),front:r.images.work.getURL(r.images.front),back:r.images.work.getURL(r.images.back)},s=this.imageOptions.transform,l=Object.assign({key:`pano.${a}`},Js(this.imageOptions,[`format`,`size`,`quality`,`sharpen`,`forceUseExifOrientation`,`mappings`])),u=`pano:`+bv([o,l,s]),d=this.modelScene.parameter,f;if(d.pano0&&d.pano0.map.name===u?f=d.pano0:d.pano1&&d.pano1.map.name===u&&(f=d.pano1),f)d.pano0&&d.pano0.map!==f.map&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==f.map&&d.pano1.map!==((t=d.pano0)==null?void 0:t.map)&&d.pano1.map.dispose(),d.set({pano0:f,pano1:f}),this.emit(`pano.request`,$(`pano.request`,{userAction:!0,prevPano:this.currentPano,progress:0,state:i,options:n,error:null}));else{let t,f=``;r.images.hdrConfig&&(t={right:r.images.work.getURL(r.images.gainmap_right),left:r.images.work.getURL(r.images.gainmap_left),up:r.images.work.getURL(r.images.gainmap_up),down:r.images.work.getURL(r.images.gainmap_down),front:r.images.work.getURL(r.images.gainmap_front),back:r.images.work.getURL(r.images.gainmap_back)},f=r.images.work.getURL(r.images.hdrConfig));let p=this.textureLoader.loadCubeTexture(o,{imageURL:{transform:s,options:l},format:c.RGBAFormat,viaAjax:!0,fetcher:w_(this.fiveId,r.work)},void 0,void 0,void 0,this.renderer),m=f?[fetch(f).then(e=>e.json()),this.textureLoader.loadCubeTexture(t,{imageURL:{transform:s,options:l},format:c.RGBAFormat,viaAjax:!0,fetcher:w_(this.fiveId,r.work)},void 0,void 0,void 0,this.renderer)]:[];Promise.all([p,...m]).then(t=>an(this,[t],void 0,function*([t,o,s]){var l,f;let{body:p}=t;if(this.destroyed||this.pendingTextureId!==e){p.dispose();return}this.pendingTextureId=null,p.name=u;let m=Array.isArray(p.image)?p.image[0]:p.image,h=(l=m==null?void 0:m.width)==null?2048:l,g=yield Tx(this.renderer,p,!0,My),_=new Iy().formPixels(g.data),v={panoId:a,map:p,mapSize:h,mapHistogram:new c.Vector4().fromArray(_.toArray()),matrix:r.matrix.clone().premultiply(r.work.transform),zoom:1,hdrConfig:o?Object.assign({map:s.body},Wx(o)):void 0};d.pano0&&d.pano0.map.dispose(),d.pano1&&d.pano1.map!==((f=d.pano0)==null?void 0:f.map)&&d.pano1.map.dispose(),d.set({pano0:v,pano1:v}),this.emit(`pano.request`,$(`pano.request`,{userAction:!0,prevPano:this.currentPano,progress:0,state:i,options:n,error:null}))})).catch(t=>{this.destroyed||this.pendingTextureId!==e||(this.pendingTextureId=null)})}}}}onDblTapGesture(e){if(!this.initAnimationIsReady)return;this.userAction=e.userAction,this.stopMomentumMovement(),this.hideIntersectMesh();let t=e.state,n=e.center.raycaster,r=n.ray.origin.clone().add(n.ray.direction.clone().setLength(3)),i=1,[a]=this.modelScene.intersectRaycaster(n);if(a&&(r=a.point.clone(),i=a.distance>4/2?1:3),e.state.distance=i,e.state.offset=r,this.emit(`gesture.dbltap`,e),e.defaultPrevented)return;let o={x:t.offset.x,y:t.offset.y,z:t.offset.z,distance:t.distance};this.locationMotion.set(o,360).catch(K),this.hideIntersectMesh()}hideIntersectMesh(){this.intersectMesh.visible===!0&&(this.intersectMesh.visible=!1,this.needsRender=!0)}}},aC={Floorplan:qx,Topview:Yx,Panorama:KS,Model:ZS,Mapview:rC},oC=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.create,initAnimation.start,initAnimation.end,camera.update,intersect.update,pano.select,pano.moveTo,pano.moving,pano.arrived,pano.cancel,pano.error,pano.texture.load,pano.texture.progress,pano.texture.success,pano.texture.error,pano.texture.abort,xr.session.start,xr.session.end,xr.gesture.tap,xr.gesture.press,xr.gesture.buttonUp,xr.gesture.buttonDown,xr.controller.update`.split(`,`);function sC(e){e.on(`initAnimation.start`,t=>{e.emit(`initAnimationWillStart`,t.state.panoIndex,t.state,t.userAction)}),e.on(`initAnimation.end`,t=>{e.emit(`initAnimationEnded`,t.state.panoIndex,t.state,t.userAction)}),e.on(`gesture.pan`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pan`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPanGesture`,t.state,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pan`,t.pointers,t.isFinal),e.emit(`panGesture`,t.state,t.isFinal))}),e.on(`gesture.tap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`tap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`tap`,t.pointers,t.isFinal),e.emit(`tapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.dbltap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`dbltap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsDblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`dbltap`,t.pointers,t.isFinal),e.emit(`dblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.press`,t=>{let n=!1;n=e.emit(`wantsGesture`,`press`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`press`,t.pointers,t.isFinal),e.emit(`pressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),e.on(`gesture.pinch`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pinch`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPinchGesture`,t.scale,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pinch`,t.pointers,t.isFinal),e.emit(`pinchGesture`,t.scale,t.state.fov,t.isFinal))}),e.on(`gesture.mousewheel`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseWheel`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsMouseWheel`,t.center.delta,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseWheel`,t.pointers,t.isFinal),e.emit(`mouseWheel`,t.center.delta,t.state.fov,t.isFinal))}),e.on(`gesture.mousemove`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseMove`,t.pointers,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseMove`,t.pointers,t.isFinal),n=e.emit(`wantsChangeCameraFov`,t.state.fov),n&&t.preventDefault())}),e.on(`gesture.momentum`,t=>{let n=!1;n=e.emit(`wantsInteriaPan`,t.state),n&&t.preventDefault(),t.defaultPrevented||e.emit(`interiaPan`,t.state,t.isFinal)}),e.on(`camera.update`,t=>{e.emit(`cameraFovUpdate`,t.state.fov,t.userAction),e.emit(`cameraDirectionUpdate`,t.state,t.userAction);let n=gi(t.state);n.setLength(t.state.distance);let r=t.state.offset.clone().sub(n);e.emit(`cameraPositionUpdate`,r,t.userAction),e.emit(`cameraUpdate`,t.state,t.userAction)}),e.on(`intersect.update`,t=>{if(t.intersection){let n=!1;n=e.emit(`wantsShowIntersectionOnModel`,t.raycaster),n&&t.preventDefault(),t.defaultPrevented||e.emit(`intersectionOnModelUpdate`,t.intersection,t.object)}else e.emit(`intersectionHidden`)}),e.on(`pano.request`,t=>{let n=e.emit(`wantsMoveToPano`,t.state.panoIndex,t.options,t.userAction);n||(n=e.emit(`wantsToMoveToPano`,t.state.panoIndex,t.options,t.userAction)),n&&t.preventDefault(),t.defaultPrevented||e.emit(`panoWillLoad`,t.state.panoIndex)}),e.on(`pano.select`,t=>{e.emit(`panoSelected`,t.state.panoIndex)}),e.on(`pano.moveTo`,t=>{e.emit(`panoLoaded`,t.state.panoIndex),e.emit(`moveToPano`,t.state.panoIndex,t.userAction),e.emit(`panoWillArrive`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.moving`,t=>{e.emit(`movingToPano`,t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),e.on(`pano.arrived`,t=>{e.emit(`panoArrived`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.cancel`,t=>{e.emit(`moveToPanoCanceled`,t.state.panoIndex)}),e.on(`pano.error`,t=>{e.emit(`panoLoadError`,t.error,t.state.panoIndex)}),e.on(`pano.texture.load`,t=>{e.emit(`textureStartLoad`,t.pano.panoIndex)}),e.on(`pano.texture.success`,t=>{e.emit(`textureLoaded`,t.pano.panoIndex,t.meta)}),e.on(`pano.texture.error`,t=>{e.emit(`textureError`,t.error,t.pano.panoIndex)}),e.on(`pano.texture.abort`,t=>{e.emit(`textureAbort`,t.pano.panoIndex)}),e.on(`pano.texture.progress`,t=>{e.emit(`textureLoading`,t.progress,t.pano.panoIndex)}),e.on(`xr.session.start`,t=>{e.emit(`webXRSessionStart`)}),e.on(`xr.session.end`,t=>{e.emit(`webXRSessionEnd`)}),e.on(`xr.gesture.tap`,t=>{e.emit(`webXRControllerEvent`,`tap`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.press`,t=>{e.emit(`webXRControllerEvent`,`press`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonUp`,t=>{e.emit(`webXRControllerEvent`,`buttonUp`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonDown`,t=>{e.emit(`webXRControllerEvent`,`buttonDown`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.controller.update`,t=>{e.emit(`webXRControllerRayUpdate`,{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&e.emit(`webXRAxesUpdate`,`left`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&e.emit(`webXRAxesUpdate`,`right`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),e.on(`works.request`,t=>{e.emit(`willLoad`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.load`,t=>{e.emit(`load`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.ready`,t=>{e.emit(`loaded`,t.input,t.works[0])}),e.on(`state.change`,t=>{e.emit(`stateChange`,t.state,t.userAction)}),e.on(`currentState.change`,t=>{e.emit(`currentStateChange`,t.state,t.userAction)}),e.on(`state.set`,t=>{e.emit(`setState`,t.state)}),e.on(`state.synced`,t=>{e.emit(`stateSynced`,t.state)}),e.on(`model.request`,t=>{e.emit(`modelWillLoad`,t.work.model)}),e.on(`model.error`,t=>{e.emit(`modelLoadError`,t.error,t.model)}),e.on(`model.load`,t=>{e.emit(`modelLoaded`,t.model)}),e.on(`model.changeShownFloor`,t=>{e.emit(`modelShownFloorChange`,t.model.shownFloor,t.model.floorLength)}),e.on(`render`,t=>{e.emit(`renderFrame`,t.needsRender)}),e.on(`mode.change.request`,t=>{e.emit(`wantsChangeMode`,t.mode,t.prevMode)}),e.on(`mode.change`,t=>{e.emit(`modeChange`,t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),e.on(`helpers.visible`,t=>{e.emit(`helpersVisibleChange`,t.object.visible)}),e.on(`network.resource`,t=>{e.emit(`network`,t.source,t.requestType,t.requestState,t.detail)})}function cC(){if(typeof window<`u`){let e=document.createElement(`video`);e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin=``;let t=()=>{document.removeEventListener(`touchstart`,t,!1),document.removeEventListener(`mousedown`,t,!1),e.muted=!1};return document.addEventListener(`touchstart`,t,!1),document.addEventListener(`mousedown`,t,!1),e}else return{}}function lC(){let e=new c.Group;e.name=`internalLights`;{let t=new c.DirectionalLight(16777215,.1);t.name=`direction0`,t.position.copy(new c.Vector3(0,1,0)),e.add(t)}{let t=new c.DirectionalLight(16777215,.1);t.name=`direction1`,t.position.copy(new c.Vector3(-1,-1,-1)),e.add(t)}{let t=new c.DirectionalLight(16777215,.3);t.name=`direction2`,t.position.copy(new c.Vector3(1,1,1)),e.add(t)}{let t=new c.AmbientLight(16777215,.6);t.name=`ambient0`,e.add(t)}return e}function uC(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function dC(){var e;if(typeof document<`u`){let t=document.getElementsByTagName(`meta`);for(let n=0;n<t.length;n++){let r=t[n];if(r.getAttribute(`name`)===`viewport`){let t=uC((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var fC=1e3,pC=90,mC=e=>e.replace(`//vrlab-public.ljcdn.com/`,`//vr-public.realsee-cdn.cn/`).replace(`//vrlab-image4.ljcdn.com/`,`//vr-image-4.realsee-cdn.cn/`).replace(`//vrlab-image3.ljcdn.com/`,`//vr-image-3.realsee-cdn.cn/`).replace(`//vrlab-image2.ljcdn.com/`,`//vr-image-2.realsee-cdn.cn/`).replace(`//vrlab-image1.ljcdn.com/`,`//vr-image-1.realsee-cdn.cn/`),hC=new c.Sphere,gC=new c.Box3,_C=new c.Vector4,vC=new c.Vector4,yC=new c.Color,bC=new c.Vector2,xC=new WeakMap,SC=fy([ly(null)]),CC={},wC=class e extends Lt{static get version(){return`1.0.0-alpha.1`}static get dracoPath(){return Ru.decoderPath}static set dracoPath(e){Ru.setDecoderPath(e)}static get ktx2Path(){return Ku.transcoderPath}static set ktx2Path(e){Ku.setTranscoderPath(e)}static get useNativeImageBitmap(){return Vc()}static set useNativeImageBitmap(e){Bc(e)}constructor(e={}){var t,n,r,i,a,o,s,l,u,d,f;if(super(),this.pbmGaussianSplattingRenderMesh=null,this.fiveId=Mt(),CC[this.fiveId]=this,this.currentUpdateArgs={time:G(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!0,this.onlyRenderIfNeeds=(t=e.onlyRenderIfNeeds)==null?!0:t,this.imageOptions=Object.assign({},(n=e.imageOptions)==null?{}:n),this.textureOptions=Object.assign({},(r=e.textureOptions)==null?{}:r),this.poweredByRealsee=(i=e.poweredByRealsee)==null?!0:i,this.backgroundColor=new c.Color((a=e.backgroundColor)==null?1579548:a),this.backgroundAlpha=(o=e.backgroundAlpha)==null?1:o,this.extraElements=[],this.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview)},this.fps={testCount:0,testTime:G()},this.modeChangeDuration=(s=e.modeChangeDuration)==null?fC:s,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof xb&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new xb({outputType:e.enableHDR?c.HalfFloatType:void 0,logarithmicDepthBuffer:e.logarithmicDepthBuffer});let t=dC();this.renderer.setPixelRatio(t===1?window.devicePixelRatio:1),this.renderer.setSize(512,512),this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha)}catch(e){let t=e instanceof Error?e:Error(String(e));this.throwError(t)}this.getPixelsRenderTarget=new c.RenderTarget(1,1,{colorSpace:(d=(u=this.renderer)==null?void 0:u.outputColorSpace)==null?c.SRGBColorSpace:d,generateMipmaps:!1}),this.renderer&&ks(this.renderer),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new ki(pC),this.scene=new Db,this.scene.background=this.backgroundColor,this.xrCustomObjectsScene=new c.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.requestProxy=(f=e.requestProxy)==null?mC:f,this.networkSubscribe=new Vs,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,$(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new c.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),xC.set(this,SC),this.modelScene=new ev({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(SC,{forceReplaceImmediately:!0});Z(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new c.VideoTexture(e.videoInstance||cC());let m=lC();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=Lc.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{this.needsRender=!0};if(this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,h,!1),this.removeEventListeners=()=>{this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,h,!1)},this.loadWorkTask=this.prepare(),this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}sC(this),this.fiveRenderer=new vb({outputType:e.enableHDR?c.HalfFloatType:void 0}),this.adaptiveLuminancePass=new Qy,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new eb(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),this.pbmGaussianSplattingRenderMesh=new kr,this.scene.add(this.pbmGaussianSplattingRenderMesh)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}prepare(){return Promise.all([lc().catch(K)]).then(K)}dispose(){var e;if(this.destroyed===!0)return;delete CC[this.fiveId],this.emit(`dispose`),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);let t=this.getElement();t&&t.parentNode&&t.parentNode.removeChild(t);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((e=n.pano0)==null?void 0:e.map)&&n.pano1.map.dispose(),n.reset(`pano0`,`pano1`),this.modelScene.dispose(),xC.set(this,SC),this.renderer&&(!(this.renderer instanceof xb)||this.renderer.isInitialized)&&this.renderer.render(new c.Scene,new c.Camera),this.fiveRenderer.dispose(),this.renderer instanceof xb&&this.renderer.dispose()}setViewport(e){Object.assign(this.viewport,e),this.needsRender=!0}get boundingMesh(){return this.modelScene.boundingMesh}get helperVisible(){return this.helperGroup.visible}set helperVisible(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit(`helpers.visible`,$(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,Xs(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,Xs(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,Xs(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,Xs(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,Xs(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),this.currentMode===`Panorama`&&(r=!0,n=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),t&&n&&this.controller&&this.currentMode&&(!this.controller.updateConfiguration(this.controllerInits[this.currentMode])||r)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}appendTo(e,t={}){if(!this.renderer)return;if(!(this.renderer instanceof xb)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i,a,o,s;if(!this.renderer)return;let c=this.renderer.domElement.parentNode,{width:l=(n=c==null?void 0:c.offsetWidth)==null?512:n,height:u=(r=c==null?void 0:c.offsetHeight)==null?512:r}=e;if(l=Math.max(1,l),u=Math.max(1,u),!t){let e=dC(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(l,u)*t,n=Math.min((s=(o=(a=this.renderer.backend.device)==null?void 0:a.limits)==null?void 0:o.maxTextureDimension2D)==null?8192:s,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(l,u),this.needsRender=!0;let d=G(),f=d-this.currentUpdateArgs.time,p=this.currentUpdateArgs.args;this.updateTime(d,f,...p)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return xC.get(this)||SC}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>$b(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(t,n,r,i=!0){var a,o,s,l,u,d,f,p,m,h;let g={};typeof r==`number`?g.duration=r:typeof r==`object`&&Object.assign(g,r),this.works===SC&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(t))for(let e of t)e instanceof cy?v.push(e):typeof e!=`string`&&`work`in e?v.push(ly(e.work,e)):v.push(ly(e));else t instanceof cy?v.push(t):v.push(ly(t));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=fy(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);n===void 0&&(n=`inherit`),n===`inherit`&&this.works===SC&&(n=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(a=x.mode)==null?S?`Panorama`:`Mapview`:a,T={};if(n===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{n={mode:b};let e=(s=(o=y[0])==null?void 0:o.observers)==null?void 0:s[this.panoIndex];e?(n.workCode=e.work.workCode,n.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(n.workCode=y.initial.work.workCode,n.panoIndex=y.initial.panoIndex):n.mode===`Panorama`&&(n.mode=`Mapview`),n.mode===b&&(n.longitude=this.camera.pose.longitude,n.latitude=this.camera.pose.latitude,n.fov=this.camera.pose.fov)}}if(n===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof n==`object`){if(w=(u=n.mode)==null?b:u,typeof n.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=n.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:n.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:n.longitude,latitude:n.latitude,fov:n.fov,distance:n.distance,offset:n.offset?new c.Vector3().copy(n.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;w===`Panorama`&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,$(`works.request`,{input:t,works:y,userAction:i}));let O=(e,t,r)=>{let a=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),r);n===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:a,duration:E,effect:D,userAction:i}},this.commonParams()),this.controllerInits[e]),c=iC[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},i)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=iC[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i}))}this.controller=this.applyController(e,s);let t=$(`mode.change`,{prevMode:b,mode:e,state:c,userAction:i});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.state.workCode=this.pano.workCode,this.state.panoIndex=this.pano.panoIndex,this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};xC.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),ax(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,$(`camera.update`,{state:this.getCurrentState(),userAction:i})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(K),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,$(`works.load`,{input:t,userAction:i,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,$(`works.ready`,{input:t,userAction:i,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var t;this.controller&&(this.controller.destroy(),this.controller=void 0);let n=this.modelScene.parameter;n.pano0&&n.pano0.map.dispose(),n.pano1&&n.pano1.map!==((t=n.pano0)==null?void 0:t.map)&&n.pano1.map.dispose(),n.set({pano0:null,pano1:null,modelAlpha:1}),xC.set(this,SC),this.modelScene.setModels(SC,{forceReplaceImmediately:!0}),this.renderer&&this.modelScene.update(this.renderer,this.camera),this.needsRender=!0,this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.camera.setFromPose({distance:0,fov:pC,longitude:0,latitude:0,offset:new c.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if(t===e.Mode.Panorama&&!this.works.getObserver(m)){let e=Error(`PanoId ${Sv(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model?!wv(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(K):(wv(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(K));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=iC[t].initAnimationEndState(r),o=$(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=$(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=Lc.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),Lc.shared.setContext(null)),_()})}getPixels(e,t,n,r,i,a,o){return an(this,void 0,void 0,function*(){if(!this.renderer)throw Error(`renderer is not initialized.`);let s=G(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new c.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof t==`number`&&(p=t),typeof n==`number`&&(m=n),typeof r==`number`&&(h=r),g=i,_=a,b=o):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&this.controller instanceof iC.Panorama&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(s),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=this.renderer.getClearColor(yC),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(s),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,P=ee*4;if(b){if(b.length!==P)throw Error(`buffer length is not equals pixels ${P}`)}else b=new Uint8Array(P);let F=yield this.renderer.readRenderTargetPixelsAsync(C,0,0,M,N),te=M*4;if(F.length===P)b.set(F);else{let e=Math.ceil(te/256)*256;for(let t=0;t<N;t++){let n=t*e;b.set(F.subarray(n,n+te),t*te)}}if(!_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b})}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=t.getClearColor(yC),c=t.getClearAlpha(),l=t.getViewport(_C),u=t.getScissor(vC),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(bC),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;this.controller&&this.controller.render()&&(y=!1),y&&this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender),this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&Lc.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&Ku.detectSupport(this.renderer),this.syncingState=this.syncState(e,t),this.controller&&this.controller.updateTime(e,t,...n),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){let e=this.modelScene.loaded,t=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),e===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),Lc.shared.add(()=>{this.emit(`models.load`,$(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&Lc.shared.add(()=>{this.emit(`models.refined`,$(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){gC.makeEmpty(),gC.expandByObject(this.modelScene.boundingMesh);let t=gC.getBoundingSphere(hC),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius);let r=H(n/500,.001,.1),i=H(n,800);this.camera.near!==r&&(this.camera.near=r),this.camera.far!==i&&(this.camera.far=i),this.camera.updateTime(e)}if(this.renderer){let e=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=e}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.pbmGaussianSplattingRenderMesh&&this.pbmGaussianSplattingRenderMesh.needsRender===!0&&(this.pbmGaussianSplattingRenderMesh.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused===!0||this.renderer instanceof xb&&!this.renderer.isInitialized)return;let r=$(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,$(`render`,{needsRender:i})),this.hasListener(`fps`)&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit(`fps`,this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof xb&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=K){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=G();return Promise.all(r.map(e=>{let t=Sv({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},Js(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Ec(i,r);return w_(this.fiveId,n.work).preload(a)})).then(()=>{let e=G()-i;return t(e),e})}project2d(e,t=!1){if(!this.renderer)return null;if(t){let t=this.camera.position,n=e.clone().sub(t),r=new c.Raycaster(t,n.clone().normalize());r.params.Points={threshold:.1};let[i]=this.modelScene.intersectRaycaster(r);if(i&&i.distance+.01<n.length())return null}let n=e.clone().project(this.camera);if(Math.abs(n.z)>1)return null;let r=this.renderer.getSize(new c.Vector2),i=r.x*this.viewport.width,a=r.y*this.viewport.height,o=r.x*this.viewport.left+(n.x+1)/2*i,s=r.y*(1-this.viewport.bottom-this.viewport.height)+(-n.y+1)/2*a;return new c.Vector2(o,s)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,t=!1,n=!0){var r,i,a,o,s,l,u,d,f,p;e=Js(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof c.Vector3)&&(e.offset=new c.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(i=(r=this.work)==null?void 0:r.workCode)==null?``:i,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(a=e.mode)==null?this.state.mode:a,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){let t={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(t.longitude=e.longitude),typeof e.latitude==`number`&&(t.latitude=e.latitude),typeof e.fov==`number`&&(t.fov=e.fov),typeof e.distance==`number`&&(t.distance=e.distance),e.offset instanceof c.Vector3&&(t.offset=e.offset);let n=Object.assign(Object.assign({initial:{state:t,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),r=iC[h].initAnimationEndState(n);g=r.longitude,_=r.latitude,v=r.fov,y=r.offset,b=r.distance}else g=(o=e.longitude)==null?this.state.longitude:o,_=(s=e.latitude)==null?this.state.latitude:s,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,$(`state.set`,{userAction:n,state:x})),ix(this.state,x)||(rx(this.state,x),this.controller&&n&&(this.controller.userAction=!1),t&&this.state.mode===x.mode&&(this.syncingState=this.syncState(G(),0,t),this.syncingState&&((f=this.controller)==null||f.updateTime(G(),0),this.syncingState=!1)),this.emit(`state.change`,$(`state.change`,{userAction:n,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state))}syncState(t,n,r=!1){let i=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){let e={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,e,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof iC.Model){if(Qb(this.camera.pose.offset,this.state.offset)){let e={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,Object.assign(Object.assign({},e),{duration:r?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!wv(e,this.pano)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`){let t={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(e,t,!1),!0}}if(this.controller instanceof iC.Floorplan||this.controller instanceof iC.Topview||this.controller instanceof iC.Mapview){let e=.2,t=Math.PI/45,n=r?this.state.fov:zy(this.camera.pose.fov,this.state.fov,1),i=Math.abs(this.camera.pose.distance-this.state.distance),a=i>e*15?i/15:.2,o=r?this.state.distance:zy(this.camera.pose.distance,this.state.distance,a),s=this.camera.pose.offset.distanceTo(this.state.offset),l=s>e*15?s/15:e,u=r?new c.Vector3().copy(this.state.offset):By(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Vy({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},t);if(Xb(n,this.camera.pose.fov)||Qb(u,this.camera.pose.offset)||Xb(o,this.camera.pose.distance)||Xb(d,this.camera.pose.longitude,Math.PI*2)||Xb(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:n};return Object.assign(e,{distance:o}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(K),this.controller.locationMotion.set(e,0).catch(K),!0}}else{let e=Math.PI/45,t=r?this.state.fov:zy(this.camera.pose.fov,this.state.fov,1),{longitude:n,latitude:i}=r?{longitude:this.state.longitude,latitude:this.state.latitude}:Vy({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),a=this.state.distance,o=new c.Vector3().copy(this.state.offset);if(Xb(a,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),Qb(o,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),Xb(n,this.camera.pose.longitude,Math.PI*2)||Xb(i,this.camera.pose.latitude)||Xb(t,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:n,latitude:i,fov:t},0).catch(K),!0}if(this.stateSynced=!0,i===!1&&this.emit(`state.synced`,$(`state.synced`,{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){let t=this.currentMode;if(!(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)||this.modelScene.loaded){let e=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(let t of e)this.controller instanceof iC.Panorama&&t.tile===!0?this.readyCallbacks.push(t):t()}}return!1}ready(e={}){return new Promise(t=>{var n;this.readyCallbacks.push(Object.assign(t,{tile:(n=e.tile)==null?!1:n}))}).then(()=>this.model.initReady).then(K)}requestFullscreen(){var e;if(!nx)return;let t=(e=this.getElement())==null?void 0:e.parentNode;t&&`requestFullscreen`in t&&typeof document<`u`&&document.fullscreenElement===null&&t.requestFullscreen()}exitFullscreen(){typeof document<`u`&&document.fullscreenElement&&`exitFullscreen`in document&&document.exitFullscreen()}throwError(e){this.hasListener(`error`)?this.emit(`error`,e):console.error(e)}bindModel(e){let t=()=>{Lc.shared.add(()=>{this.emit(`model.load`,$(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,$(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,$(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,$(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,$(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,$(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new Ks({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=qv(e,r);return t instanceof Error?Promise.reject(t):t})}});T_(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(e,t){if(!this.renderer)throw Error(`renderer is not initialized.`);let n=iC[e];this.currentMode=e;let r=new n(t);for(let e of oC)r.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let n=iC[e].initAnimationEndState(t),r=t.initial.userAction;ix(this.state,n)||(rx(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,$(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return r.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!ix(this.state,n)&&(rx(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,$(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),r.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!ix(this.state,n)&&(rx(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),r.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!ix(this.state,n)&&(rx(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),r.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!ix(this.state,n)&&(rx(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),r.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!ix(this.state,n)&&(rx(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),r.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!ix(this.state,n)&&(rx(this.state,n),this.emit(`state.change`,$(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),r.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,$(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),r.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),r.on(`error`,e=>this.throwError(e)),r}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let t=new c.Object3D;t.matrix.copy(e.matrix).premultiply(e.work.transform),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixAutoUpdate=!1;let n=new c.Vector3(0,0,-1);n.applyQuaternion(this.camera.quaternion);let r=t.quaternion.clone().invert();return n.applyQuaternion(r),{theta:Math.atan2(n.x,-n.z),phi:-Math.asin(n.y),lookAtVector:n}}}return null}addPass(e){this.fiveRenderer.composer.addPass(e)}removePass(e){let t=this.fiveRenderer.composer.passes.indexOf(e);t!==-1&&this.fiveRenderer.composer.passes.splice(t,1)}insertPass(e,t){this.fiveRenderer.composer.insertPass(e,t)}get renderMode(){return this.fiveRenderer.renderMode}set renderMode(e){this.fiveRenderer.renderMode=e}get enableEDL(){return this.eyeDomeLightingPass.enabled}set enableEDL(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0}get enableAdaptiveLuminance(){return this.adaptiveLuminancePass.enabled}set enableAdaptiveLuminance(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0}};wC.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`},typeof window<`u`&&Object.assign(window,{__FIVE_DEBUG__:{THREE:c,constructor:wC,instances:CC}}),exports.AdaptiveLuminancePass=Qy,exports.AnimationFrameLoop=Lc,exports.BoundingMesh=Q_,exports.Camera=ki,exports.EffectComposer=my,exports.EyeDomeLightingPass=eb,exports.Fetcher=Ks,exports.Five=wC,exports.FivePass=gy,exports.FiveRenderer=vb,exports.FlowingFireworks3DPass=ub,exports.FlowingLight2DPass=ib,exports.FlowingLight3DPass=nb,exports.FullScreenQuad=hy,exports.GaussianBlurPass=tb,exports.Histogram=Iy,exports.InternalWebGPURenderer=xb,exports.Model=U_,exports.ModelScene=ev,exports.Motion=J,exports.NetworkSubscribe=Vs,exports.PBMGSObject=At,exports.PBMGaussianSplattingObject=At,exports.PBMGaussianSplattingNodeMaterial=Dr,exports.PBMGaussianSplattingRenderMesh=kr,exports.PBMGroup=Ct,exports.PBMMesh=Ot,exports.PBMMeshBasicMaterial=Ar,exports.PBMMeshBasicNodeMaterial=bs,exports.PBMMeshPanoOnlyMaterial=jr,exports.PBMMeshPanoOnlyNodeMaterial=Es,exports.PBMMeshPhongMaterial=Mr,exports.PBMMeshPhongNodeMaterial=Ss,exports.PBMMeshPhysicalMaterial=Nr,exports.PBMMeshPhysicalNodeMaterial=ws,exports.PBMPanoFilter=zt,exports.PBMPointCloud=nn,exports.PBMSkinnedMesh=kt,exports.PBMUpdateable=Rt,exports.PROXY_CONTROLLER_EVENT_NAMES=oC,exports.PanoCircleMesh=Fb,exports.PanoCircleMeshCustom=Jb,exports.PanoCircleMeshSolid=Ub,exports.Parameter=X,exports.Scene=Db,exports.Subscribe=Lt,exports.TextureLoader=Yc,exports.Tile=gf,exports.Tile3D=S_,exports.Tile3DModel=S_,exports.TileCache=em,exports.TileNode=Up,exports.TileRequestScheduler=Zp,exports.Tileset=om,exports.Trajectory=qp,exports.TrajectoryNode=Jp,exports.Work=cy,exports.WorkResolvedObserver=dy,exports.controllersDefaultInitArgs=aC,exports.coordinatesToVector=gi,exports.createDebugBoundingMesh=df,exports.createWorks=fy,exports.defaultImageURLTransform=Ec,exports.draco=Ru,exports.getViewportScale=dC,exports.headingToLongitude=yi,exports.imageSupport=lc,exports.isBoundingVolume=of,exports.isPanoId=Tv,exports.loadAt3d=Il,exports.loadDome=Bl,exports.loadDomez=ql,exports.loadGltf=Rd,exports.loadPbm=ml,exports.loadPly=Zl,exports.longitudeToHeading=vi,exports.makeBoundingVolume=sf,exports.panoEqual=wv,exports.panoParse=Cv,exports.panoStringify=Sv,exports.parseWork=ly,exports.registerPBMMaterials=ks,exports.vectorToCoordinates=_i,exports.workToJson=av;
|