mapv-cloudrenderengine 2.0.9 → 2.1.0

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.
@@ -1,2 +1,2 @@
1
- import{Vector2,Vector3,Quaternion,Matrix4,MathUtils,Euler,Matrix3,Layers,FileLoader,Color as Color$1,Group,MeshBasicMaterial,PlaneBufferGeometry,Mesh,SpriteMaterial,Sprite}from"three";import earcut from"earcut";import{Tween,update}from"@tweenjs/tween.js";import axios from"axios";import h337 from"@mars3d/heatmap.js";const UDS={CLEAR_SKIES:"clearSkies",PARTLY_CLOUDY:"partlyCloudy",CLOUDY:"cloudy",FOGGY:"foggy",OVERCAST:"overcast",RAIN:"rain",LIGHT_RAIN:"lightRain",THUNDER_STORM:"thunderstorm",SNOW:"snow",LIGHT_SNOW:"lightSnow",BLIZZARD:"blizzard",SAND_DUST_CALM:"sandDustCalm",SAND_DUST_STORM:"sandDustStorm"},SkyMode={VOLUMETRIC_CLOUDS:"Volumetric Clouds",STATIC_CLOUDS:"Static Clouds",DYNAMIC_CLOUDS:"2D Dynamic Clouds",NO_CLOUDS:"No Clouds",VOLUMETRIC_AURORA:"Volumetric Aurora"},SkyColorMode={SKY_ATMOSPHERE:"Sky Atmosphere",SIMPLIFIED_COLOR:"Simplified Color"},InteractMOD={SET_MOUSE_CURSOR_SHOW:"setMouseCursorShow",SET_CLICK_EVENT:"setClickEvent",SET_EDIT_STATUS:"setEditStatus",SWITCH_EDIT_MODE:"switchEditMode",SAVE_EDIT_RESULT:"saveEditResult",ZOOM_IN:"zoomIn",ZOOM_OUT:"zoomOut",EXIT:"exitClient",ENABLE_TERRAIN:"enableTerrain",ENABLE_POI:"enablePOIByTag",PRELOAD_LOCATION:"preLoadLocation",FOCUS_ACTOR_BY_ID:"focusActorByID",ENABLE_DATALAYER:"Scene_enableDataLayerByName",ENABLE_FPS:"Scene_setFPS",OBJECT_BOUNDINGBOX:"Interact_objectBoundingBox",ASSET_MODEL:"Gis_generateAssetModel",BUILD_GROWTHANIMATE:"Interact_buildGrowth"},CameraControl={NAVIGATION:"Camera_navigation",NAVIGATION_PAUSE:"Camera_navigationPause",NAVIGATION_STOP:"Camera_navigationStop",MOVE_TO:"Camera_moveTo",ZOOM_IN:"Camera_zoomIn",ZOOM_OUT:"Camera_zoomOut",PROJECT:"Camera_project",UNPROJECT:"Camera_unproject",UPDATE:"Camera_update",FOCUS_ON:"Camera_focusOn",Constrain_Shape:"Camera_constrainShape",MOVE:"Camera_move",ROTATE:"Camera_rotate",RESET_CAMERA_FOCUS:"Camera_resetCameraFocus"},SceneControl={ENABLE_3DTILES_BY_NAME:"Scene_enableTilesByName",SWITCH_TERRAIN_MODE:"Scene_switchTerrainMode",HIDDEN_3DTILES_ITEM:"Scene_hiddenTilesItem",EVENT_LAYER_BUILDING:"Scene_eventLayerBuilding",UPDATA_SLOPE_ANALYSIS:"Scene_updateSlopeAnalysis",GET_ALTITUDE:"Scene_getAltitude"},ApplicationControl={EXIT_CLIENT:"Application_exitClient",RESTART_LEVEL:"Application_restartLevel",RESTART_GAME:"Application_restartGame",CREATE_TRAFFIC_STREAM:"Application_createTrafficStream",CLOSE_TRAFFIC_STREAM:"Application_closeTrafficStream",FOLLOW_TRAFFIC_STREAM_ITEM:"Application_followTrafficStreamItem",ADD_EVENT_LISTENER:"Application_addEvent",REMOVE_EVENT_LISTENER:"Application_removeEvent",RESET_WORLD_CENTER:"Application_resetWorldCenter",CONSOLE_COMMAND:"Application_ConsoleCommand"},GisControl={ADD:"Gis_AddCommonGISLayer",REMOVE:"Gis_RemoveCommonGISLayer",DESTORY:"Gis_DestoryCommonGISLayer",DESTORY_ALL:"Gis_DestoryAllGenerationLayer",UPDATE:"Gis_UpdateCommonGISLayer",VISIBLE:"Gis_VisibleCommonGISLayer"},DrawAndMeasureControl={ENABLE_DRAW:"Gis_enableDraw",CLOSE_DRAW:"Gis_closeDraw",ENABLE_MEASURE:"Gis_enableMeasure",CLOSE_MEASURE:"Gis_closeMeasure",DESTORY_DRAW:"Gis_clearDraw",DESTORY_MEASURE:"Gis_clearMeasure"},LineTypeOptions={SOLID:"solid",DASHED:"dashed",ARROW:"arrow",GRADIENT:"gradient"},LineDirectionOptions={CENTER:"Ground_Center",STAND:"Stand",SIDE:"Cylinder"},LineSplineTypeOptions={LINEAR:"Linear",CURVE:"Curve",CONSTANT:"Constant"},WS_OPEN_STATE=1,ToClientMessageType={QualityControlOwnership:0,Response:1,Command:2,FreezeFrame:3,UnfreezeFrame:4,VideoEncoderAvgQP:5,LatencyTest:6,InitialSettings:7,FileExtension:8,FileMimeType:9,FileContents:10,Mouse:21,Keyboard:22,InputControlOwnership:12,Protocol:255},ControlSchemeType={LockedMouse:0,HoveringMouse:1},inputOptions={controlScheme:ControlSchemeType.HoveringMouse,suppressBrowserKeys:!1,fakeMouseWithTouches:!1},MessageType={IFrameRequest:0,RequestQualityControl:1,FpsRequest:2,AverageBitrateRequest:3,StartStreaming:4,StopStreaming:5,LatencyTest:6,RequestInitialSettings:7,UIInteraction:50,Command:51,KeyDown:60,KeyUp:61,KeyPress:62,MouseEnter:70,MouseLeave:71,MouseDown:72,MouseUp:73,MouseMove:74,MouseWheel:75,TouchStart:80,TouchEnd:81,TouchMove:82,GamepadButtonPressed:90,GamepadButtonReleased:91,GamepadAnalog:92},MouseButton={MainButton:0,AuxiliaryButton:1,SecondaryButton:2,FourthButton:3,FifthButton:4},MouseButtonsMask={PrimaryButton:1,SecondaryButton:2,AuxiliaryButton:4,FourthButton:8,FifthButton:16},SpecialKeyCodes={BackSpace:8,Shift:16,Control:17,Alt:18,RightShift:253,RightControl:254,RightAlt:255},ParticleKind={FIRE_BIG:"P_Fire_Big",FIRE_SMALL:"P_Fire_Small",FIRE_FLAMETHROWER:"P_Flamethrower",SMOKE_SMALL_BLACK:"P_Smoke_A",SMOKE_BIG_BLACK:"P_Smoke_B",SMOKE_SMALL_YELLOW:"P_Smoke_C",SMOKE_BIG_YELLOW:"P_Smoke_D",SPARK_A:"P_Sparks_E",FOG_MASS:"P_Mass_Fog",NS_Spark:"NS_Spark",NS_Firefly:"NS_Firefly"};var CommonConstant=Object.freeze({__proto__:null,UDS:UDS,InteractMOD:InteractMOD,WS_OPEN_STATE:WS_OPEN_STATE,ToClientMessageType:ToClientMessageType,ControlSchemeType:ControlSchemeType,inputOptions:inputOptions,MessageType:MessageType,MouseButton:MouseButton,MouseButtonsMask:MouseButtonsMask,SpecialKeyCodes:SpecialKeyCodes,GisControl:GisControl,DrawAndMeasureControl:DrawAndMeasureControl,LineTypeOptions:LineTypeOptions,LineDirectionOptions:LineDirectionOptions,LineSplineTypeOptions:LineSplineTypeOptions,ParticleKind:ParticleKind,CameraControl:CameraControl,ApplicationControl:ApplicationControl,SkyMode:SkyMode,SkyColorMode:SkyColorMode,SceneControl:SceneControl});class UltralDynamicSky{constructor(e,t={}){this.cloudRender=e,this.weather=t.weather||UDS.PARTLY_CLOUDY,this.hour=t.hour||8,this.minute=t.minute||10,this.init()}changeWeather(e){!e||Object.values(UDS).indexOf(e)<0||(this.weather=e,this.cloudRender.emitUIInteraction({excuteName:"Scene_changeWeather",params:{WeatherType:e}}))}changeTime(e=10,t=10){this.hour=e,this.minute=Math.floor(10*t/6);e=this.hour<10?"0"+this.hour:""+this.hour,t=this.minute<10?"0"+this.minute:""+this.minute;this.cloudRender.emitUIInteraction({excuteName:"Scene_changeTime",params:{Time:e+t}})}setVolumeFog(e,t=1e3){t=Math.max(Math.min(1e5,t),10);this.cloudRender.emitUIInteraction({excuteName:"Scene_setVolumenFog",params:{Enable:e,Distance:100*t}})}setAtmosphericFog(e=.0075){e=Math.max(Math.min(1,e),0);this.cloudRender.emitUIInteraction({excuteName:"Scene_setBaseFog",params:{BaseFogDensity:e}})}setSkyMode(e){return!(!e||Object.values(SkyMode).indexOf(e)<0)&&void this.cloudRender.emitUIInteraction({excuteName:"Scene_setSkyMode",params:{SkyMode:e}})}setSkyColorMode(e){return!(!e||Object.values(SkyColorMode).indexOf(e)<0)&&void this.cloudRender.emitUIInteraction({excuteName:"Scene_setSkyColorMode",params:{SkyColorMode:e}})}changeWeatherEffectParameters(e){this.cloudRender.emitUIInteraction({excuteName:"Scene_changeWeatherEffects",params:JSON.stringify(e)})}init(){this.changeWeather(this.weather),this.changeTime(this.hour,this.minute)}}const webRtcPlayer=function(e){e=void 0!==e?e:{};let r=this;var t=new URLSearchParams(window.location.search),e=(this.cfg=void 0!==e.peerConnectionOptions?e.peerConnectionOptions:{},this.cfg.sdpSemantics="unified-plan",this.cfg.offerExtmapAllowMixed=!1,this.forceTURN=t.has("ForceTURN"),this.forceTURN&&(console.log("Forcing TURN usage by setting ICE Transport Policy in peer connection config."),this.cfg.iceTransportPolicy="relay"),this.cfg.bundlePolicy="balanced",this.forceMaxBundle=t.has("ForceMaxBundle"),this.forceMaxBundle&&(this.cfg.bundlePolicy="max-bundle"),this.pcClient=null,this.dcClient=null,this.tnClient=null,this.sdpConstraints={offerToReceiveAudio:1,offerToReceiveVideo:1,voiceActivityDetection:!1},this.dataChannelOptions={ordered:!0,maxPacketLifeTime:3e3},this.startVideoMuted=void 0!==e.startVideoMuted&&e.startVideoMuted,this.autoPlayAudio=void 0===e.autoPlayAudio||e.autoPlayAudio,this.useMic=t.has("useMic"),this.useMic||console.log("Microphone access is not enabled. Pass ?useMic in the url to enable it."),"localhost"===location.hostname||"127.0.0.1"===location.hostname),i="https:"===location.protocol;function s(e){e.onsignalingstatechange=o,e.oniceconnectionstatechange=n,e.onicegatheringstatechange=l,e.ontrack=h,e.onicecandidate=m,e.ondatachannel=c}async function a(e){var t=0<e.getTransceivers().length;if(e.addTransceiver("video",{direction:"recvonly"}),r.useMic){var i=!!r.useMic&&{autoGainControl:!1,channelCount:1,echoCancellation:!1,latency:0,noiseSuppression:!1,sampleRate:48e3,volume:1},s=await navigator.mediaDevices.getUserMedia({video:!1,audio:i});if(s)if(t){for(var a of e.getTransceivers())if(a&&a.receiver&&a.receiver.track&&"audio"===a.receiver.track.kind)for(const o of s.getTracks())o.kind&&"audio"==o.kind&&(a.sender.replaceTrack(o),a.direction="sendrecv")}else for(const n of s.getTracks())n.kind&&"audio"==n.kind&&e.addTransceiver(n,{direction:"sendrecv"});else e.addTransceiver("audio",{direction:"recvonly"})}else e.addTransceiver("audio",{direction:"recvonly"})}!this.useMic||e||i||(this.useMic=!1,console.error("Microphone access in the browser will not work if you are not on HTTPS or localhost. Disabling mic access."),console.error("For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'")),this.preferSFU=t.has("preferSFU"),console.log(this.preferSFU?"The browser will signal it would prefer an SFU connection. Remove ?preferSFU from the url to signal for P2P usage.":"The browser will signal for a P2P connection. Pass ?preferSFU in the url to signal for SFU usage."),this.latencyTestTimings={TestStartTimeMs:null,UEReceiptTimeMs:null,UEEncodeMs:null,UECaptureToSendMs:null,UETransmissionTimeMs:null,BrowserReceiptTimeMs:null,FrameDisplayDeltaTimeMs:null,Reset:function(){this.TestStartTimeMs=null,this.UEReceiptTimeMs=null,this.UEEncodeMs=null,this.UECaptureToSendMs=null,this.UETransmissionTimeMs=null,this.BrowserReceiptTimeMs=null,this.FrameDisplayDeltaTimeMs=null},SetUETimings:function(e){this.UEReceiptTimeMs=e.ReceiptTimeMs,this.UEEncodeMs=e.EncodeMs,this.UECaptureToSendMs=e.CaptureToSendMs,this.UETransmissionTimeMs=e.TransmissionTimeMs,this.BrowserReceiptTimeMs=Date.now(),this.OnAllLatencyTimingsReady(this)},SetFrameDisplayDeltaTime:function(e){null==this.FrameDisplayDeltaTimeMs&&(this.FrameDisplayDeltaTimeMs=Math.round(e),this.OnAllLatencyTimingsReady(this))},OnAllLatencyTimingsReady:function(e){}},this.createWebRtcVideo=function(){let i=document.createElement("video");if(i.id="streamingVideo",i.playsInline=!0,i.disablepictureinpicture=!0,i.muted=r.startVideoMuted,i.addEventListener("loadedmetadata",function(e){r.onVideoInitialised&&r.onVideoInitialised()},!0),"requestVideoFrameCallback"in HTMLVideoElement.prototype){const s=(e,t)=>{t.receiveTime&&t.expectedDisplayTime&&(t=t.presentationTime-t.receiveTime,r.aggregatedStats||(r.aggregatedStats={}),r.aggregatedStats.receiveToCompositeMs=t),i.requestVideoFrameCallback(s)};i.requestVideoFrameCallback(s)}return i},this.video=this.createWebRtcVideo(),this.availableVideoStreams=new Map;const o=function(e){console.info("Signaling state change. |",e.srcElement.signalingState,"|")},n=function(e){console.info("Browser ICE connection |",e.srcElement.iceConnectionState,"|")},l=function(e){console.info("Browser ICE gathering |",e.srcElement.iceGatheringState,"|")},h=function(e){if(e.track&&console.log("Got track. | Kind="+e.track.kind+" | Id="+e.track.id+" | readyState="+e.track.readyState+" |"),"audio"==e.track.kind)d(e.streams[0]);else{e.track.kind;for(const t of e.streams)r.availableVideoStreams.has(t.id)||r.availableVideoStreams.set(t.id,t);r.video.srcObject=e.streams[0],e.track.onunmute=()=>{r.video.srcObject=e.streams[0],r.onNewVideoTrack(e.streams)}}},d=function(e){if(r.video.srcObject!=e&&r.video.srcObject&&r.video.srcObject!==e){let t=document.createElement("Audio");if(t.srcObject=e,r.autoPlayAudio)t.play();else{let e=function(){t.play(),r.video.removeEventListener("click",e)};r.video.addEventListener("click",e)}console.log("Created new audio element to play seperate audio stream.")}},c=function(e){console.log("Data channel created for us by browser as we are a receiving peer."),r.dcClient=e.channel,p(r.dcClient)},u=function(e){for(var t,i=new Array,s=e.length,a=0;a<s;a++)65536<=(t=e.charCodeAt(a))&&t<=1114111?(i.push(t>>18&7|240),i.push(t>>12&63|128),i.push(t>>6&63|128),i.push(63&t|128)):2048<=t&&t<=65535?(i.push(t>>12&15|224),i.push(t>>6&63|128),i.push(63&t|128)):128<=t&&t<=2047?(i.push(t>>6&31|192),i.push(63&t|128)):i.push(255&t);return new Uint8Array(i).buffer},p=function(e){try{return e.binaryType="arraybuffer",e.onopen=function(e){console.log("Data channel connected"),r.onDataChannelConnected&&r.onDataChannelConnected()},e.onclose=function(e){console.log("Data channel connected",e)},e.onmessage=function(e){var t;r.onDataChannelMessage&&("string"==typeof e.data?(t=u(e.data),r.onDataChannelMessage(t)):r.onDataChannelMessage(e.data))},e.onerror=function(e){console.error("Data channel error",e)},e}catch(e){return console.warn("No data channel",e),null}},m=function(e){e=e.candidate;e&&e.candidate&&(console.log("%c[Browser ICE candidate]","background: violet; color: black","| Type=",e.type,"| Protocol=",e.protocol,"| Address=",e.address,"| Port=",e.port,"|"),r.onWebRtcCandidate(e))},g=function(e){e.sdp=e.sdp.replace("useinbandfec=1","useinbandfec=1;stereo=1;sprop-maxcapturerate=48000")};this.setVideoEnabled=function(t){r.video.srcObject.getTracks().forEach(e=>e.enabled=t)},this.startLatencyTest=function(e){r.video&&(r.latencyTestTimings.Reset(),r.latencyTestTimings.TestStartTimeMs=Date.now(),e(r.latencyTestTimings.TestStartTimeMs))},this.handleCandidateFromServer=function(e){e=new RTCIceCandidate(e);console.log("%c[Unreal ICE candidate]","background: pink; color: black","| Type=",e.type,"| Protocol=",e.protocol,"| Address=",e.address,"| Port=",e.port,"|"),r.forceTURN&&e.candidate.indexOf("relay")<0?console.warn("Dropping candidate because it was not TURN relay.","| Type=",e.type,"| Protocol=",e.protocol,"| Address=",e.address,"| Port=",e.port,"|"):r.pcClient.addIceCandidate(e).catch(function(e){console.error("Failed to add ICE candidate",e)})},this.createOffer=function(){r.pcClient&&(console.log("Closing existing PeerConnection"),r.pcClient.close(),r.pcClient=null),r.pcClient=new RTCPeerConnection(r.cfg),s(r.pcClient),a(r.pcClient).finally(function(){var t;r.dcClient=function(e,t,i){e=e.createDataChannel(t,i);return console.log(`Created datachannel (${t})`),p(e),e}(r.pcClient,"cirrus",r.dataChannelOptions),(t=r.pcClient).createOffer(r.sdpConstraints).then(function(e){g(e),t.setLocalDescription(e),r.onWebRtcOffer&&r.onWebRtcOffer(e)},function(){console.warn("Couldn't create offer")})})},this.receiveOffer=function(e){e=new RTCSessionDescription(e);r.pcClient||(console.log("Creating a new PeerConnection in the browser."),r.pcClient=new RTCPeerConnection(r.cfg),s(r.pcClient),r.pcClient.setRemoteDescription(e).then(()=>{a(r.pcClient).finally(function(){r.pcClient.createAnswer().then(e=>r.pcClient.setLocalDescription(e)).then(()=>{r.onWebRtcAnswer&&r.onWebRtcAnswer(r.pcClient.currentLocalDescription)}).then(()=>{var e;for(e of r.pcClient.getReceivers())e.playoutDelayHint=0}).catch(e=>console.error("createAnswer() failed:",e))})}))},this.receiveAnswer=function(e){var t,e=new RTCSessionDescription(e),e=(r.pcClient.setRemoteDescription(e),r.pcClient.getReceivers());for(t of e)t.playoutDelayHint=0},this.close=function(){r.pcClient&&(console.log("Closing existing peerClient"),r.pcClient.close(),r.pcClient=null),r.aggregateStatsIntervalId&&clearInterval(r.aggregateStatsIntervalId)},this.send=function(e){if(r.dcClient&&"open"==r.dcClient.readyState)try{r.dcClient.send(e)}catch(e){console.error("dcClient.send error: ",e)}},this.getStats=function(t){r.pcClient&&t&&r.pcClient.getStats(null).then(e=>{t(e)})},this.aggregateStats=function(e){r.aggregatedStats||(r.aggregatedStats={});let t=function(e){let t={};e.forEach(e=>{"inbound-rtp"!=e.type||e.isRemote||"video"!=e.mediaType&&!e.id.toLowerCase().includes("video")||(t.timestamp=e.timestamp,t.bytesReceived=e.bytesReceived,t.framesDecoded=e.framesDecoded,t.packetsLost=e.packetsLost,t.bytesReceivedStart=r.aggregatedStats&&r.aggregatedStats.bytesReceivedStart?r.aggregatedStats.bytesReceivedStart:e.bytesReceived,t.framesDecodedStart=r.aggregatedStats&&r.aggregatedStats.framesDecodedStart?r.aggregatedStats.framesDecodedStart:e.framesDecoded,t.timestampStart=r.aggregatedStats&&r.aggregatedStats.timestampStart?r.aggregatedStats.timestampStart:e.timestamp,r.aggregatedStats&&r.aggregatedStats.timestamp&&(r.aggregatedStats.bytesReceived&&(t.bitrate=8*(t.bytesReceived-r.aggregatedStats.bytesReceived)/(t.timestamp-r.aggregatedStats.timestamp),t.bitrate=Math.floor(t.bitrate),t.lowBitrate=r.aggregatedStats.lowBitrate&&r.aggregatedStats.lowBitrate<t.bitrate?r.aggregatedStats.lowBitrate:t.bitrate,t.highBitrate=r.aggregatedStats.highBitrate&&r.aggregatedStats.highBitrate>t.bitrate?r.aggregatedStats.highBitrate:t.bitrate),r.aggregatedStats.bytesReceivedStart&&(t.avgBitrate=8*(t.bytesReceived-r.aggregatedStats.bytesReceivedStart)/(t.timestamp-r.aggregatedStats.timestampStart),t.avgBitrate=Math.floor(t.avgBitrate)),r.aggregatedStats.framesDecoded&&(t.framerate=(t.framesDecoded-r.aggregatedStats.framesDecoded)/((t.timestamp-r.aggregatedStats.timestamp)/1e3),t.framerate=Math.floor(t.framerate),t.lowFramerate=r.aggregatedStats.lowFramerate&&r.aggregatedStats.lowFramerate<t.framerate?r.aggregatedStats.lowFramerate:t.framerate,t.highFramerate=r.aggregatedStats.highFramerate&&r.aggregatedStats.highFramerate>t.framerate?r.aggregatedStats.highFramerate:t.framerate),r.aggregatedStats.framesDecodedStart)&&(t.avgframerate=(t.framesDecoded-r.aggregatedStats.framesDecodedStart)/((t.timestamp-r.aggregatedStats.timestampStart)/1e3),t.avgframerate=Math.floor(t.avgframerate))),"track"!=e.type||"video_label"!=e.trackIdentifier&&"video"!=e.kind||(t.framesDropped=e.framesDropped,t.framesReceived=e.framesReceived,t.framesDroppedPercentage=e.framesDropped/e.framesReceived*100,t.frameHeight=e.frameHeight,t.frameWidth=e.frameWidth,t.frameHeightStart=r.aggregatedStats&&r.aggregatedStats.frameHeightStart?r.aggregatedStats.frameHeightStart:e.frameHeight,t.frameWidthStart=r.aggregatedStats&&r.aggregatedStats.frameWidthStart?r.aggregatedStats.frameWidthStart:e.frameWidth),"candidate-pair"==e.type&&e.hasOwnProperty("currentRoundTripTime")&&0!=e.currentRoundTripTime&&(t.currentRoundTripTime=e.currentRoundTripTime)}),r.aggregatedStats.receiveToCompositeMs&&(t.receiveToCompositeMs=r.aggregatedStats.receiveToCompositeMs,r.latencyTestTimings.SetFrameDisplayDeltaTime(r.aggregatedStats.receiveToCompositeMs)),r.aggregatedStats=t,r.onAggregatedStats&&r.onAggregatedStats(t)};r.aggregateStatsIntervalId=setInterval(()=>{r.getStats(t)},e)}};function styleInject(e,t){var i,s,t=(t=void 0===t?{}:t).insertAt;e&&"undefined"!=typeof document&&(i=document.head||document.getElementsByTagName("head")[0],(s=document.createElement("style")).type="text/css","top"===t&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e)))}var css_248z="/* 视频流送的视频组件样式 */\nvideo {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n\n/* 视频流送的整体根组件属性 */\n#player {\n width: 100%;\n height: 100%;\n position: relative;\n background-color: #000;\n}\n\n/* 如果不是链接后直接加载(即connect_on_load: false)那么便会显示该画面,用于配置显示蒙版的样式 */\n#videoPlayOverlay {\n z-index: 30;\n position: absolute;\n font-size: 1.8em;\n width: 100%;\n height: 100%;\n color: white;\n background-color: rgba(100, 100, 100, .7);\n}\n\n/* State for element to be clickable */\n/* 待开始页面显示状态的样式 */\n.clickableState {\n align-items: center;\n justify-content: center;\n display: flex;\n cursor: pointer;\n}\n\n.textDisplayState {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n/* State to hide overlay, WebRTC communication is in progress and or is playing */\n/* 待开始页面隐藏 */\n.hiddenState {\n display: none;\n}\n\n/* 如果不是链接后直接加载(即connect_on_load: false)那么便会显示该按钮文字,用于配置显示样式 */\n#playButton {\n display: inline-block;\n height: auto;\n}";styleInject(css_248z);class EventDispatcher{addEventListener(e,t){void 0===this._listeners&&(this._listeners={}),this._needsDispatchedToUE=!1;var i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&(i[e].push(t),this._needsDispatchedToUE=!0,this._dispatchAddListenerTypes||(this._dispatchAddListenerTypes=[]),this._dispatchAddListenerTypes.push(e))}hasEventListener(e,t){var i;return void 0!==this._listeners&&void 0!==(i=this._listeners)[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){var i,s;void 0!==this._listeners&&(this._needsDispatchedToUE=!1,void 0!==(i=this._listeners[e]))&&-1!==(s=i.indexOf(t))&&(i.splice(s,1),this._needsDispatchedToUE=!0,this._dispatchRemoveListenerTypes||(this._dispatchRemoveListenerTypes=[]),this._dispatchRemoveListenerTypes.push(e))}dispatchEvent(i){if(void 0!==this._listeners){var e=this._listeners[i.type];if(void 0!==e){i.target=this;var s=e.slice(0);for(let e=0,t=s.length;e<t;e++)s[i.index=e].call(this,i);i.target=null}}}}class EventHandler extends EventDispatcher{constructor(e){super(),this.haveEvents="GamepadEvent"in window,this.haveWebkitEvents="WebKitGamepadEvent"in window,this.cloudRenderEngine=e,this.playerElement=document.getElementById("player"),this.promiseResponses=[],this.scene=this.cloudRenderEngine.scene,this.interactiveObjects=new Map,this.blacklist=new Set,this.mousedownTime=null,this.mouse=new Vector2(0,0),this.selection=[],this.logMessages=!1,this.inputOptions=e.inputOptions,this.playerElement&&(this.playerElement.tabIndex<10&&(this.playerElement.tabIndex=1e3),this.playerElement.addEventListener("contextmenu",e=>{e.preventDefault()},!1))}updateObjectsWithEvent(){const i=new Map;this.scene&&this.scene.children.length&&this.scene.children.forEach((e,t)=>{e._listeners&&i.set(e.uuid,e)}),this.interactiveObjects.clear(),this.interactiveObjects=i}isKeyCodeBrowserKey(e){return 112<=e&&e<=123||9===e}getKeyCode(e){return e.keyCode===SpecialKeyCodes.Shift&&"ShiftRight"===e.code?SpecialKeyCodes.RightShift:e.keyCode===SpecialKeyCodes.Control&&"ControlRight"===e.code?SpecialKeyCodes.RightControl:e.keyCode===SpecialKeyCodes.Alt&&"AltRight"===e.code?SpecialKeyCodes.RightAlt:e.keyCode}registerKeyboardEvents(){const i=this;document.onkeydown=function(e){i.print_inputs&&console.log(`key down ${e.keyCode}, repeat = `+e.repeat),i.cloudRenderEngine.sendInputData(new Uint8Array([MessageType.KeyDown,i.getKeyCode(e),e.repeat]).buffer),e.keyCode===SpecialKeyCodes.BackSpace&&document.onkeypress({charCode:SpecialKeyCodes.BackSpace}),i.inputOptions.suppressBrowserKeys&&i.isKeyCodeBrowserKey(e.keyCode)&&e.preventDefault()},document.onkeyup=function(e){i.print_inputs&&console.log("key up "+e.keyCode),i.cloudRenderEngine.sendInputData(new Uint8Array([MessageType.KeyUp,i.getKeyCode(e)]).buffer),i.inputOptions.suppressBrowserKeys&&i.isKeyCodeBrowserKey(e.keyCode)&&e.preventDefault()},document.onkeypress=function(e){i.print_inputs&&console.log("key press "+e.charCode);var t=new DataView(new ArrayBuffer(3));t.setUint8(0,MessageType.KeyPress),t.setUint16(1,e.charCode,!0),i.cloudRenderEngine.sendInputData(t.buffer)}}resizePlayerStyleToFillWindow(e){var t=e.getElementsByTagName("VIDEO"),i=window.innerHeight/window.innerWidth,s=e.clientHeight/e.clientWidth,t=t.videoHeight/t.videoWidth;isNaN(t)?(this.styleWidth=window.innerWidth,this.styleHeight=window.innerHeight,this.styleTop=0,this.styleLeft=0):i<s?(this.styleWidth=Math.floor(window.innerHeight/t),this.styleHeight=window.innerHeight,this.styleTop=0,this.styleLeft=Math.floor(.5*(window.innerWidth-this.styleWidth))):(this.styleWidth=window.innerWidth,this.styleHeight=Math.floor(window.innerWidth*t),this.styleTop=Math.floor(.5*(window.innerHeight-this.styleHeight)),this.styleLeft=0),e.style="top: "+this.styleTop+"px; left: "+this.styleLeft+"px; width: "+this.styleWidth+"px; height: "+this.styleHeight+"px; cursor: "+this.styleCursor+"; "+this.styleAdditional}resizePlayerStyleToActualSize(e){var t,i=e.getElementsByTagName("VIDEO");0<i.length&&(this.styleWidth=i[0].videoWidth,this.styleHeight=i[0].videoHeight,i=Math.floor(.5*(window.innerHeight-this.styleHeight)),t=Math.floor(.5*(window.innerWidth-this.styleWidth)),this.styleTop=0<i?i:0,this.styleLeft=0<t?t:0,e.style="top: "+this.styleTop+"px; left: "+this.styleLeft+"px; width: "+this.styleWidth+"px; height: "+this.styleHeight+"px; cursor: "+this.styleCursor+"; "+this.styleAdditional)}resizePlayerStyleToArbitrarySize(e){e.style="top: 0px; left: 0px; width: "+this.styleWidth+"px; height: "+this.styleHeight+"px; cursor: "+this.styleCursor+"; "+this.styleAdditional}setupFreezeFrameOverlay(){this.cloudRenderEngine.freezeFrameOverlay=document.createElement("div"),this.cloudRenderEngine.freezeFrameOverlay.id="this.cloudRenderEngine.freezeFrameOverlay",this.cloudRenderEngine.freezeFrameOverlay.style.display="none",this.cloudRenderEngine.freezeFrameOverlay.style.pointerEvents="none",this.cloudRenderEngine.freezeFrameOverlay.style.position="absolute",this.cloudRenderEngine.freezeFrameOverlay.style.zIndex="20";var e=document.createElement("img");e.style.position="absolute",this.cloudRenderEngine.freezeFrameOverlay.appendChild(e)}showFreezeFrameOverlay(){this.cloudRenderEngine.freezeFrame.valid&&(this.cloudRenderEngine.freezeFrameOverlay.classList.add("freezeframeBackground"),this.cloudRenderEngine.freezeFrameOverlay.style.display="block")}invalidateFreezeFrameOverlay(){this.cloudRenderEngine.freezeFrameOverlay.style.display="none",this.cloudRenderEngine.freezeFrame.valid=!1,this.cloudRenderEngine.freezeFrameOverlay.classList.remove("freezeframeBackground"),this.cloudRenderEngine.webRtcPlayerObj&&this.cloudRenderEngine.webRtcPlayerObj.setVideoEnabled(!0)}resizeFreezeFrameOverlay(){if(0!==this.cloudRenderEngine.freezeFrame.width&&0!==this.cloudRenderEngine.freezeFrame.height){let e=0,t=0,i=0,s=0;var a=document.getElementById("enlarge-display-to-fill-window-tgl"),o=document.getElementById("player"),a=(s=null!==a&&a.checked?window.innerWidth/window.innerHeight<(a=this.cloudRenderEngine.freezeFrame.width/this.cloudRenderEngine.freezeFrame.height)?(e=window.innerWidth,t=Math.floor(window.innerWidth/a),i=Math.floor(.5*(window.innerHeight-t)),0):(e=Math.floor(window.innerHeight*a),t=window.innerHeight,i=0,Math.floor(.5*(window.innerWidth-e))):o.offsetWidth/o.offsetHeight<(a=this.cloudRenderEngine.freezeFrame.width/this.cloudRenderEngine.freezeFrame.height)?(e=o.offsetWidth,t=Math.floor(o.offsetWidth/a),i=Math.floor(.5*(o.offsetHeight-t)),0):(e=Math.floor(o.offsetHeight*a),t=o.offsetHeight,i=0,Math.floor(.5*(o.offsetWidth-e))),document.getElementById("this.cloudRenderEngine.freezeFrameOverlay").childNodes[0]);this.cloudRenderEngine.freezeFrameOverlay.style.width=o.offsetWidth+"px",this.cloudRenderEngine.freezeFrameOverlay.style.height=o.offsetHeight+"px",this.cloudRenderEngine.freezeFrameOverlay.style.left="0px",this.cloudRenderEngine.freezeFrameOverlay.style.top="0px",a.style.width=e+"px",a.style.height=t+"px",a.style.left=s+"px",a.style.top=i+"px"}}resizePlayerStyle(e){var t,i,s=document.getElementById("player");s&&(this.cloudRenderEngine.updateVideoStreamSize(),s.classList.contains("fixed-size")||(t=document.getElementById("enlarge-display-to-fill-window-tgl"),i=window.innerWidth<s.videoWidth||window.innerHeight<s.videoHeight,null!==t?t.checked||i?this.resizePlayerStyleToFillWindow(s):this.resizePlayerStyleToActualSize(s):this.resizePlayerStyleToArbitrarySize(s)),this.setupMouseAndFreezeFrame(s))}setupMouseAndFreezeFrame(e){this.playerElementClientRect=e.getBoundingClientRect(),this.cloudRenderEngine.setupNormalizeAndQuantize(),this.resizeFreezeFrameOverlay()}onOrientationChange(e){const t=this;clearTimeout(this._orientationChangeTimeout),this._orientationChangeTimeout=setTimeout(function(){t.resizePlayerStyle()},500)}setupHtmlEvents(){const a=this;if(window.addEventListener("resize",e=>{this.resizePlayerStyle(e)},!0),window.addEventListener("orientationchange",e=>{this.onOrientationChange(e)}),this.haveEvents?(window.addEventListener("gamepadconnected",e=>{this.gamepadConnectHandler(e)}),window.addEventListener("gamepaddisconnected",e=>{this.gamepadDisconnectHandler(e)})):this.haveWebkitEvents&&(window.addEventListener("webkitgamepadconnected",e=>{this.gamepadConnectHandler(e)}),window.addEventListener("webkitgamepaddisconnected",e=>{this.gamepadDisconnectHandler(e)})),this.cloudRenderEngine.isShowTestUI){document.getElementById("overlayButton").addEventListener("click",e=>{this.onExpandOverlay_Click(e)});var e=document.getElementById("enlarge-display-to-fill-window-tgl"),e=(null!==e&&(e.onchange=function(e){a.resizePlayerStyle()}),this.cloudRenderEngine.qualityControlOwnershipCheckBox=document.getElementById("quality-control-ownership-tgl"),null!==this.cloudRenderEngine.qualityControlOwnershipCheckBox&&(this.cloudRenderEngine.qualityControlOwnershipCheckBox.onchange=function(e){a.cloudRenderEngine.requestQualityControl()}),document.getElementById("encoder-params-submit")),e=(null!==e&&(e.onclick=function(e){var t=document.getElementById("encoder-min-qp-text").value,i=document.getElementById("encoder-max-qp-text").value;a.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.Encoder.MinQP "+t}),a.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.Encoder.MaxQP "+i})}),document.getElementById("webrtc-params-submit")),e=(null!==e&&(e.onclick=function(e){var t=document.getElementById("webrtc-fps-text").value,i=1e3*document.getElementById("webrtc-min-bitrate-text").value,s=1e3*document.getElementById("webrtc-max-bitrate-text").value;a.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.Fps "+t}),a.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.MinBitrate "+i}),a.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.MaxBitrate "+s})}),document.getElementById("show-fps-button"));null!==e&&(e.onclick=function(e){a.cloudRenderEngine.emitCommand({ConsoleCommand:"Stat FPS"})});let t=document.getElementById("match-viewport-res-tgl");null!==t&&(t.onchange=function(e){a.cloudRenderEngine.matchViewportResolution=t.checked});e=document.getElementById("show-stats-tgl"),e=(null!==e&&(e.onchange=function(e){document.getElementById("statsContainer").style.display=e.target.checked?"block":"none"}),document.getElementById("test-latency-button"));e&&(e.onclick=()=>{this.sendStartLatencyTest()}),this.cloudRenderEngine.setupToggleWithUrlParams("prefer-sfu-tgl","preferSFU"),this.cloudRenderEngine.setupToggleWithUrlParams("use-mic-tgl","useMic"),this.cloudRenderEngine.setupToggleWithUrlParams("force-turn-tgl","ForceTURN");let i=document.getElementById("stream-select"),s=document.getElementById("track-select");i&&(i.onchange=function(e){var t=a.cloudRenderEngine.webRtcPlayerObj.availableVideoStreams.get(i.value);a.cloudRenderEngine.webRtcPlayerObj.video.srcObject=t,a.cloudRenderEngine.streamTrackSource=t,a.cloudRenderEngine.webRtcPlayerObj.video.play(),a.cloudRenderEngine.updateTrackList()},s)&&(s.onchange=function(e){if(a.cloudRenderEngine.streamTrackSource||(a.cloudRenderEngine.streamTrackSource=a.cloudRenderEngine.webRtcPlayerObj.availableVideoStreams.get(i.value)),a.cloudRenderEngine.streamTrackSource)for(const t of a.cloudRenderEngine.streamTrackSource.getVideoTracks())if(t.id===s.value){a.cloudRenderEngine.webRtcPlayerObj.video.srcObject=new MediaStream([t]),a.cloudRenderEngine.webRtcPlayerObj.video.play(),i.value="";break}})}}onExpandOverlay_Click(){document.getElementById("overlay").classList.toggle("overlay-shown")}gamepadConnectHandler(e){console.log("Gamepad connect handler")}gamepadDisconnectHandler(e){console.log("Gamepad disconnect handler"),console.log("gamepad: "+e.gamepad.id+" disconnected"),delete this.cloudRenderEngine.controllers[e.gamepad.index]}emitMouseMove(e,t,i,s){this.cloudRenderEngine.print_inputs&&console.log(`emitMouseMove x: ${e}, y:${t}, dX: ${i}, dY: `+s);e=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(e,t),t=this.cloudRenderEngine.normalizeAndQuantizeSigned(i,s),i=new DataView(new ArrayBuffer(9));i.setUint8(0,MessageType.MouseMove),i.setUint16(1,e.x,!0),i.setUint16(3,e.y,!0),i.setInt16(5,t.x,!0),i.setInt16(7,t.y,!0),this.cloudRenderEngine.sendInputData(i.buffer)}emitMouseDown(e,t,i){this.print_inputs&&console.log(`mouse button ${e} down at (${t}, ${i})`);t=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),i=new DataView(new ArrayBuffer(6));i.setUint8(0,MessageType.MouseDown),i.setUint8(1,e),i.setUint16(2,t.x,!0),i.setUint16(4,t.y,!0),this.cloudRenderEngine.sendInputData(i.buffer)}emitMouseUp(e,t,i){this.print_inputs&&console.log(`mouse button ${e} up at (${t}, ${i})`);t=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),i=new DataView(new ArrayBuffer(6));i.setUint8(0,MessageType.MouseUp),i.setUint8(1,e),i.setUint16(2,t.x,!0),i.setUint16(4,t.y,!0),this.cloudRenderEngine.sendInputData(i.buffer)}emitMouseWheel(e,t,i){this.print_inputs&&console.log(`mouse wheel with delta ${e} at (${t}, ${i})`);t=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),i=new DataView(new ArrayBuffer(7));i.setUint8(0,MessageType.MouseWheel),i.setInt16(1,e,!0),i.setUint16(3,t.x,!0),i.setUint16(5,t.y,!0),this.cloudRenderEngine.sendInputData(i.buffer)}releaseMouseButtons(e,t,i){e&MouseButtonsMask.PrimaryButton&&this.emitMouseUp(MouseButton.MainButton,t,i),e&MouseButtonsMask.SecondaryButton&&this.emitMouseUp(MouseButton.SecondaryButton,t,i),e&MouseButtonsMask.AuxiliaryButton&&this.emitMouseUp(MouseButton.AuxiliaryButton,t,i),e&MouseButtonsMask.FourthButton&&this.emitMouseUp(MouseButton.FourthButton,t,i),e&MouseButtonsMask.FifthButton&&this.emitMouseUp(MouseButton.FifthButton,t,i)}pressMouseButtons(e,t,i){e&MouseButtonsMask.PrimaryButton&&this.emitMouseDown(MouseButton.MainButton,t,i),e&MouseButtonsMask.SecondaryButton&&this.emitMouseDown(MouseButton.SecondaryButton,t,i),e&MouseButtonsMask.AuxiliaryButton&&this.emitMouseDown(MouseButton.AuxiliaryButton,t,i),e&MouseButtonsMask.FourthButton&&this.emitMouseDown(MouseButton.FourthButton,t,i),e&MouseButtonsMask.FifthButton&&this.emitMouseDown(MouseButton.FifthButton,t,i)}registerInputs(e){e&&(this.registerMouseEnterAndLeaveEvents(e),this.registerTouchEvents(e))}registerMouseEnterAndLeaveEvents(i){const s=this;i.onmouseenter=function(e){s.print_inputs&&console.log("mouse enter");var t=new DataView(new ArrayBuffer(1));t.setUint8(0,MessageType.MouseEnter),s.cloudRenderEngine.sendInputData(t.buffer),i.pressMouseButtons(e)},i.onmouseleave=function(e){s.print_inputs&&console.log("mouse leave");var t=new DataView(new ArrayBuffer(1));t.setUint8(0,MessageType.MouseLeave),s.cloudRenderEngine.sendInputData(t.buffer),i.releaseMouseButtons(e)}}registerLockedMouseEvents(e){const t=this;let i=e.width/2,s=e.height/2;function a(){document.pointerLockElement===e||document.mozPointerLockElement===e?(console.log("Pointer locked"),document.addEventListener("mousemove",o,!1)):(console.log("The pointer lock status is now unlocked"),document.removeEventListener("mousemove",o,!1))}function o(e){i+=e.movementX,s+=e.movementY,i>t.styleWidth&&(i-=t.styleWidth),s>t.styleHeight&&(s-=t.styleHeight),i<0&&(i=t.styleWidth+i),s<0&&(s=t.styleHeight-s),t.emitMouseMove(i,s,e.movementX,e.movementY)}e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock,e.onclick=function(){e.requestPointerLock()},document.addEventListener("pointerlockchange",a,!1),document.addEventListener("mozpointerlockchange",a,!1),e.onmousedown=function(e){t.emitMouseDown(e.button,i,s)},e.onmouseup=function(e){t.emitMouseUp(e.button,i,s)},e.onmousewheel=function(e){t.emitMouseWheel(e.wheelDelta,i,s)},e.pressMouseButtons=function(e){t.pressMouseButtons(e.buttons,i,s)},e.releaseMouseButtons=function(e){t.releaseMouseButtons(e.buttons,i,s)}}registerHoveringMouseEvents(e){const t=this;e.onpointermove=function(e){t.emitMouseMove(e.offsetX,e.offsetY,e.movementX,e.movementY),e.preventDefault()},e.onpointerdown=function(e){t.emitMouseDown(e.button,e.offsetX,e.offsetY),e.preventDefault()},e.onpointerup=function(e){t.emitMouseUp(e.button,e.offsetX,e.offsetY),e.preventDefault()},e.oncontextmenu=function(e){t.emitMouseUp(e.button,e.offsetX,e.offsetY),e.preventDefault()},"onmousewheel"in e?e.onmousewheel=function(e){t.emitMouseWheel(e.wheelDelta,e.offsetX,e.offsetY),e.preventDefault()}:e.addEventListener("DOMMouseScroll",function(e){t.emitMouseWheel(-120*e.detail,e.offsetX,e.offsetY),e.preventDefault()},!1),e.pressMouseButtons=function(e){t.pressMouseButtons(e.buttons,e.offsetX,e.offsetY)},e.releaseMouseButtons=function(e){t.releaseMouseButtons(e.buttons,e.offsetX,e.offsetY)}}registerTouchEvents(r){const l=this;let a=[9,8,7,6,5,4,3,2,1,0],h={};function o(e,t){var i=new DataView(new ArrayBuffer(2+7*t.length));i.setUint8(0,e),i.setUint8(1,t.length);let s=2;for(let e=0;e<t.length;e++){var a=t[e],o=a.clientX-r.offsetLeft,n=a.clientY-r.offsetTop,o=(l.print_inputs&&console.log(`F${h[a.identifier]}=(${o}, ${n})`),l.cloudRenderEngine.normalizeAndQuantizeUnsigned(o,n));i.setUint16(s,o.x,!0),s+=2,i.setUint16(s,o.y,!0),s+=2,i.setUint8(s,h[a.identifier],!0),s+=1,i.setUint8(s,255*a.force,!0),s+=1,i.setUint8(s,o.inRange?1:0,!0),s+=1}l.cloudRenderEngine.sendInputData(i.buffer)}if(this.inputOptions.fakeMouseWithTouches){let a;r.ontouchstart=function(e){var t;void 0===a&&(t=e.changedTouches[0],a={id:t.identifier,x:t.clientX-l.playerElementClientRect.left,y:t.clientY-l.playerElementClientRect.top},r.onmouseenter(e),l.emitMouseDown(MouseButton.MainButton,a.x,a.y)),e.preventDefault()},r.ontouchend=function(t){for(let e=0;e<t.changedTouches.length;e++){var i=t.changedTouches[e];if(i.identifier===a.id){var s=i.clientX-l.playerElementClientRect.left,i=i.clientY-l.playerElementClientRect.top;l.emitMouseUp(MouseButton.MainButton,s,i),r.onmouseleave(t),a=void 0;break}}t.preventDefault()},r.ontouchmove=function(t){for(let e=0;e<t.touches.length;e++){var i=t.touches[e];if(i.identifier===a.id){var s=i.clientX-l.playerElementClientRect.left,i=i.clientY-l.playerElementClientRect.top;l.emitMouseMove(s,i,s-a.x,i-a.y),a.x=s,a.y=i;break}}t.preventDefault()}}else r.ontouchstart=function(t){for(let e=0;e<t.changedTouches.length;e++)i=t.changedTouches[e],(s=void 0)===(s=a.pop())&&console.log("exhausted touch indentifiers"),h[i.identifier]=s;var i,s;l.print_inputs&&console.log("touch start"),o(MessageType.TouchStart,t.changedTouches),t.preventDefault()},r.ontouchend=function(t){l.print_inputs&&console.log("touch end"),o(MessageType.TouchEnd,t.changedTouches);for(let e=0;e<t.changedTouches.length;e++)i=t.changedTouches[e],a.push(h[i.identifier]),delete h[i.identifier];var i;t.preventDefault()},r.ontouchmove=function(e){l.print_inputs&&console.log("touch move"),o(MessageType.TouchMove,e.touches),e.preventDefault()}}callRespone(e){var{uuid:t,classType:i}=e;this.interactiveObjects.has(t)?this.interactiveObjects.get(t).dispatchEvent(e):"cloudrenderengine"===i.toLowerCase()?this.cloudRenderEngine.dispatchEvent(e):"scene"===i.toLowerCase()?this.scene&&this.scene.dispatchEvent(e):"camera"===i.toLowerCase()&&this.cloudRenderEngine.camera&&this.cloudRenderEngine.camera.dispatchEvent(e)}}let _object3DId=0;const _v1=new Vector3,_q1=new Quaternion,_m1=new Matrix4,_target=new Vector3,_position=new Vector3,_scale=new Vector3,_quaternion=new Quaternion,_xAxis=new Vector3(1,0,0),_yAxis=new Vector3(0,1,0),_zAxis=new Vector3(0,0,1),_addedEvent={type:"added"},_removedEvent={type:"removed"};class Object3D extends EventDispatcher{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:_object3DId++}),this.uuid=MathUtils.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Object3D.DEFAULT_UP.clone();var e=new Vector3;const t=new Euler,i=new Quaternion;var s=new Vector3(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=Object3D.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return _q1.setFromAxisAngle(e,t),this.quaternion.multiply(_q1),this}rotateOnWorldAxis(e,t){return _q1.setFromAxisAngle(e,t),this.quaternion.premultiply(_q1),this}rotateX(e){return this.rotateOnAxis(_xAxis,e)}rotateY(e){return this.rotateOnAxis(_yAxis,e)}rotateZ(e){return this.rotateOnAxis(_zAxis,e)}translateOnAxis(e,t){return _v1.copy(e).applyQuaternion(this.quaternion),this.position.add(_v1.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(_xAxis,e)}translateY(e){return this.translateOnAxis(_yAxis,e)}translateZ(e){return this.translateOnAxis(_zAxis,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(_m1.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?_target.copy(e):_target.set(e,t,i);e=this.parent;this.updateWorldMatrix(!0,!1),_position.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_m1.lookAt(_position,_target,this.up):_m1.lookAt(_target,_position,this.up),this.quaternion.setFromRotationMatrix(_m1),e&&(_m1.extractRotation(e.matrixWorld),_q1.setFromRotationMatrix(_m1),this.quaternion.premultiply(_q1.invert()))}add(e){if(1<arguments.length)for(let e=0;e<arguments.length;e++)this.add(arguments[e]);else e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),(e.parent=this).children.push(e),e.dispatchEvent(_addedEvent)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e);return this}remove(e){if(1<arguments.length)for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);else{var t=this.children.indexOf(e);-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(_removedEvent))}return this}removeFromParent(){var e=this.parent;return null!==e&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){var t=this.children[e];t.parent=null,t.dispatchEvent(_removedEvent)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),_m1.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),_m1.multiply(e.parent.matrixWorld)),e.applyMatrix4(_m1),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(i,s){if(this[i]===s)return this;for(let e=0,t=this.children.length;e<t;e++){var a=this.children[e].getObjectByProperty(i,s);if(void 0!==a)return a}}getObjectsByProperty(i,s){let a=[];this[i]===s&&a.push(this);for(let e=0,t=this.children.length;e<t;e++){var o=this.children[e].getObjectsByProperty(i,s);0<o.length&&(a=a.concat(o))}return a}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position,e,_scale),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position,_quaternion,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(i){i(this);var s=this.children;for(let e=0,t=s.length;e<t;e++)s[e].traverse(i)}traverseVisible(i){if(!1!==this.visible){i(this);var s=this.children;for(let e=0,t=s.length;e<t;e++)s[e].traverseVisible(i)}}traverseAncestors(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(i){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),i=!(this.matrixWorldNeedsUpdate=!1));var s=this.children;for(let e=0,t=s.length;e<t;e++){var a=s[e];!0!==a.matrixWorldAutoUpdate&&!0!==i||a.updateMatrixWorld(i)}}updateWorldMatrix(e,t){var i=this.parent;if(!0===e&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){var s=this.children;for(let e=0,t=s.length;e<t;e++){var a=s[e];!0===a.matrixWorldAutoUpdate&&a.updateWorldMatrix(!1,!0)}}}toJSON(i){var e,t,s,a,o,n,r=void 0===i||"string"==typeof i,l={},h=(r&&(i={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},l.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"}),{});function d(e,t){return void 0===e[t.uuid]&&(e[t.uuid]=t.toJSON(i)),t.uuid}if(h.uuid=this.uuid,h.type=this.type,""!==this.name&&(h.name=this.name),!0===this.castShadow&&(h.castShadow=!0),!0===this.receiveShadow&&(h.receiveShadow=!0),!1===this.visible&&(h.visible=!1),!1===this.frustumCulled&&(h.frustumCulled=!1),0!==this.renderOrder&&(h.renderOrder=this.renderOrder),0<Object.keys(this.userData).length&&(h.userData=this.userData),h.layers=this.layers.mask,h.matrix=this.matrix.toArray(),h.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(h.matrixAutoUpdate=!1),this.isInstancedMesh&&(h.type="InstancedMesh",h.count=this.count,h.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor)&&(h.instanceColor=this.instanceColor.toJSON()),this.isScene)this.background&&(this.background.isColor?h.background=this.background.toJSON():this.background.isTexture&&(h.background=this.background.toJSON(i).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(h.environment=this.environment.toJSON(i).uuid);else if(this.isMesh||this.isLine||this.isPoints){h.geometry=d(i.geometries,this.geometry);var c=this.geometry.parameters;if(void 0!==c&&void 0!==c.shapes){var u=c.shapes;if(Array.isArray(u))for(let e=0,t=u.length;e<t;e++){var p=u[e];d(i.shapes,p)}else d(i.shapes,u)}}if(this.isSkinnedMesh&&(h.bindMode=this.bindMode,h.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton)&&(d(i.skeletons,this.skeleton),h.skeleton=this.skeleton.uuid),void 0!==this.material)if(Array.isArray(this.material)){var m=[];for(let e=0,t=this.material.length;e<t;e++)m.push(d(i.materials,this.material[e]));h.material=m}else h.material=d(i.materials,this.material);if(0<this.children.length){h.children=[];for(let e=0;e<this.children.length;e++)h.children.push(this.children[e].toJSON(i).object)}if(0<this.animations.length){h.animations=[];for(let e=0;e<this.animations.length;e++){var g=this.animations[e];h.animations.push(d(i.animations,g))}}return r&&(c=y(i.geometries),r=y(i.materials),e=y(i.textures),t=y(i.images),s=y(i.shapes),a=y(i.skeletons),o=y(i.animations),n=y(i.nodes),0<c.length&&(l.geometries=c),0<r.length&&(l.materials=r),0<e.length&&(l.textures=e),0<t.length&&(l.images=t),0<s.length&&(l.shapes=s),0<a.length&&(l.skeletons=a),0<o.length&&(l.animations=o),0<n.length)&&(l.nodes=n),l.object=h,l;function y(e){var t=[];for(const s in e){var i=e[s];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){var i=t.children[e];this.add(i.clone())}return this}}Object3D.DEFAULT_UP=new Vector3(0,1,0),Object3D.DEFAULT_MATRIX_AUTO_UPDATE=!0,Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Scene extends Object3D{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.childrenSet=new Set,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){e=super.toJSON(e);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),0<this.backgroundBlurriness&&(e.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.backgroundIntensity=this.backgroundIntensity),e}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Camera extends Object3D{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this._level=0,this._levelChange=0,this.projectionMatrix=new Matrix4,this.projectionMatrixInverse=new Matrix4;let t=new Vector3,i=-9999,s=-9999,a=-9999,o=-180,n=180,r=-89,l=0,h=-9999,d=-9999;this.needsUpdate=!1,this.worldLocation=new Vector3,this.sphereLocation=new Vector3,this.constrainPolygon=[],Object.defineProperties(this,{minLocation:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t.x=e.x,t.y=e.y,t.z=e.z,this.needsUpdate=!0)}},maxLocationX:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.needsUpdate=!0)}},maxLocationY:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.needsUpdate=!0)}},maxLocationZ:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.needsUpdate=!0)}},minYaw:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{void 0!==e&&(o=e,this.needsUpdate=!0)}},maxYaw:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{void 0!==e&&(n=e,this.needsUpdate=!0)}},minPitch:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{void 0!==e&&(r=e,this.needsUpdate=!0)}},maxPitch:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{void 0!==e&&(l=e,this.needsUpdate=!0)}},minSpringArm:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{void 0!==e&&(h=e,this.needsUpdate=!0)}},maxSpringArm:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{void 0!==e&&(d=e,this.needsUpdate=!0)}},name:{configurable:!1,enumerable:!0,value:name}})}get level(){return this._level}set level(e){e=Math.floor(e);this._levelChange=this._level-e,this._level=e}copy(e,t){return super.copy(e,t),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}setConstrainPolygon(e){e&&2<e.length&&(this.constrainPolygon=[],e.forEach((e,t)=>{this.constrainPolygon.push({x:e[0],y:e[1]})}),this.constrainHeight=-1,this.needsUpdate=!0,this.constrainPolygonNeedsUpdate=!0)}setConstrainShape(e,t){t&&2<t.length&&(this.constrainPolygon=[],t.forEach((e,t)=>{this.constrainPolygon.push({x:e[0],y:e[1],z:e[2]})}),this.constrainHeight=e,this.needsUpdate=!0,this.constrainShapeNeedsUpdate=!0)}clone(){return(new this.constructor).copy(this)}toJSON(){return{shape:this.constrainPolygon&&this.constrainPolygon.length?this.constrainPolygon:null,ConstrainHeight:void 0===this.constrainHeight?-1:this.constrainHeight,MaxLocationX:this.maxLocationX,MaxLocationY:this.maxLocationY,MaxLocationZ:this.maxLocationZ,MinYaw:this.minYaw,MaxYaw:this.maxYaw,MinPitch:this.minPitch,MaxPitch:this.maxPitch,MinSpringArm:this.minSpringArm,MaxSpringArm:this.maxSpringArm,type:this.type,name:this.name,uuid:this.uuid}}}const flattenArray=function(e){return e.flat(1/0)};function getGeoFeatures(e){if(!e)return[];let t=null;return t=e.features||(Array.isArray(e)?e:[e]),JSON.parse(JSON.stringify(t))}function getProcessedPolygonData(e){const i=[];let s,a;return getGeoFeatures(e).forEach(e=>{fixCoordiates(null==e||null==(t=e.geometry)?void 0:t.coordinates,2),s=earcut.flatten(null==e||null==(t=e.geometry)?void 0:t.coordinates),a=earcut(s.vertices,s.holes,s.dimensions);var t,e=getPolygonUV(s.vertices);i.push({vertices:s.vertices,triangles:a,uvs:e})}),i}function getUELineData(e,i){e=getGeoFeatures(e);return e.forEach(e=>{var t=null==e||null==(t=e.geometry)?void 0:t.coordinates;fixCoordiates(t,1),e.geometry.coordinates=flattenArray(t),i&&(e.geometry.coordinates.push(e.geometry.coordinates[0]),e.geometry.coordinates.push(e.geometry.coordinates[1]),e.geometry.coordinates.push(e.geometry.coordinates[2]))}),e}function getUEPointData(e){e=getGeoFeatures(e);return e.forEach(e=>{var t=null==e||null==(t=e.geometry)?void 0:t.coordinates;fixFeature(e),e.geometry.coordinates=flattenArray(t)}),e}const fixCoordiates=(e,t)=>{if(e)if(0===t)e[2]||(e[2]=0);else for(const i of e)fixCoordiates(i,t-1)};function fixFeature(e){e.type||(e.type="Feature");var t=e.geometry.type,i={Point:0,MultiPoint:1,LineString:1,MultiLineString:2,Polygon:2,MultiPolygon:3};return Object.keys(i).includes(t)&&fixCoordiates(e.geometry.coordinates,i[t]),e}function getPolygonUV(t){let i=1/0,s=1/0,a=-1/0,o=-1/0;var n=[];for(let e=0;e<t.length/3;e++){var r=t[3*e],l=t[3*e+1];i>r&&(i=r),s>l&&(s=l),a<r&&(a=r),o<l&&(o=l)}var h=1/(a-i),d=1/(o-s);for(let e=0;e<t.length/3;e++){var c=t[3*e],u=t[3*e+1],c=h*(c-i),u=d*(u-s);n.push({x:c,y:u})}return n}const fileLoader=new FileLoader;function loadImageAsBase64(e,i){fileLoader.load(e,e=>{var t=new FileReader;t.readAsDataURL(e),t.onloadend=e=>{i(e.target.result)}},null,e=>{i(!1)})}function convertCanvas2Base64(e,t="image/png"){return e.toDataURL(t)}function isBase64(e){return-1!==e.indexOf("data:")&&-1!==e.indexOf("base64")}function loadImg(e,t="https://mapdata.bj.bcebos.com"){const i=new Image;return i.crossOrigin="Anonymous",i.src=t+e,new Promise((e,t)=>{i.addEventListener("load",()=>{e(i)}),i.onerror=e=>{t(e)}})}function roundRect(e,t,i,s,a,o){e.beginPath(),e.moveTo(t+o,i),e.lineTo(t+s-o,i),e.quadraticCurveTo(t+s,i,t+s,i+o),e.lineTo(t+s,i+a-o),e.quadraticCurveTo(t+s,i+a,t+s-o,i+a),e.lineTo(t+o,i+a),e.quadraticCurveTo(t,i+a,t,i+a-o),e.lineTo(t,i+o),e.quadraticCurveTo(t,i,t+o,i),e.closePath()}function drawText(e,t,i,s){var i=i["xScale"],[s,a]=s,{text:t,fontSize:o,fontFamily:n,color:r,textAlign:l,icon:h}=t;let d;if(t||"number"==typeof t||h)if(t&&h)console.warn("BasicLabel Warning:text和icon不要同时设置");else{if(d=t,e.font=o*i+"px "+n,e.fillStyle=r,e.textAlign=l||"left",e.textBaseline="top",h){let e=h;-1!==h.indexOf("&amp;")&&(e=h.replace("&amp;","&")),-1!==h.indexOf("&amp")&&(e=h.replace("&amp","&")),d=new Function('return ("'+(""+e).replace("&#x","\\u").replace(";","")+'")')()}e.measureText(d).width;e.fillText(d,s,a)}}async function drawCanvas(e,t){var{height:e,width:i,backgroundImage:s,borderRadius:a,borderColor:o,borderWidth:n,backgroundColor:r}=e,l=document.createElement("canvas"),h=l.getContext("2d"),d=MathUtils.ceilPowerOfTwo(i),d={width:d,height:d*(e/i),factor:{xScale:d/i,yScale:d/i}},{xScale:c,yScale:u}=(l.width=d.width,l.height=d.height,d.factor);return s?(s=await loadImg(s,""),h.drawImage(s,0,0,i*c,e*u)):(o||r)&&(h.strokeStyle=o,h.fillStyle=r,h.lineWidth=n?n*c:+c,roundRect(h,h.lineWidth*c,h.lineWidth*u,(i-2*h.lineWidth)*c,(e-2*h.lineWidth)*u,a?a*c:0),r&&h.fill(),o)&&h.stroke(),t&&drawContent(h,d,t),l}async function drawContent(t,i,s){var{paddingTop:e,paddingLeft:a,width:o}=i;let n=0,r=0,l=0,h=0;var{xScale:d,yScale:c}=i.factor,u=a?a*d:0,p=e?e*c:0,m=[u,p],g=Object.keys(s);for(let e=0;e<g.length;e++){var y,f,b=s[g[e]],{width:x,height:v,text:S,marginRight:C,marginBottom:U,backgroundImage:N,borderRadius:w,borderColor:T,borderWidth:O,backgroundColor:M,position:z}=b;if(z&&([y,f]=z,m[0]=u+y*d,m[1]=p+f*c,n=0,r=0,l=0,h=0),x&&v){if(o<m[0]+x*d&&((l+=n)+v*c<=r?(m[0]=h,m[1]+=n):(m[0]=a?a*d:0,m[1]+=n,r=0,h=0)),N)try{var E=await loadImg(N,"");t.drawImage(E,m[0],m[1],x*d,v*c)}catch(e){console.log(e)}else M&&(t.strokeStyle=T,t.fillStyle=M,t.lineWidth=O?O*d:+d,roundRect(b,m[0]+b.lineWidth*d,m[1]+b.lineWidth*d,(x-2*b.lineWidth)*d,(v-2*b.lineWidth)*c,w?w*d:0),M&&t.fill(),T)&&t.stroke();S&&([y,f]=z,drawText(t,b,i.factor,[m[0]+y*d,m[1]+f*c])),m[0]+=(x+(C||0))*d,(n=(v+(U||0))*c)>r&&(r=n,h=m[0])}else S&&([N,O]=z,drawText(t,b,i.factor,[m[0]+N*d,m[1]+O*c]))}}function drawTextToImage(e,t={}){var i,s,a,o,n,r,l,h,d,c,u,p,m,g,y;return!!e&&(s=(i=document.createElement("canvas")).getContext("2d"),a=t.scale||1,o=t.fontSize||18,c=t.fontface||"Arial",n=t.borderThickness||0,u=t.backgroundColor||{r:0,g:0,b:0,a:1},d=t.borderColor||{r:0,g:0,b:0,a:1},y=t.strokeStyle||{r:255,g:0,b:0,a:1},r=t.textColor||{r:255,g:0,b:0,a:1},s.font="Bold "+o*a+"px "+c,l=(g=s.measureText(e).width*a)+2*n*a,h=o*a*1.4+2*n*a,{r:c,g:u,b:p,a:m}=(i.width=t.width||l,i.height=t.height||h,s.font="Bold "+o*a+"px "+c,u),{r:m,g,b:t,a:y}=(s.fillStyle="rgba("+c+","+u+","+p+","+m+")",s.fillRect(0,0,i.width,i.height),t.drawRoundRect&&({r:c,g:u,b:p,a:m}=d,s.strokeStyle="rgba("+c+","+u+","+p+","+m+")",s.lineWidth=n*a,roundRect(s,n/2,n/2,g+n+10*a,o*a*1.4+n,6)),s.fill(),s.stroke(),t.drawStrokeStyle&&({r:d,g:c,b:u,a:p}=y,s.strokeStyle="rgba("+d+","+c+","+u+","+p+")",s.strokeText(e,(n+5)*a+.5*(i.width-l),.5*(i.height-h)+(o+n)*a)),r),s.fillStyle="rgba("+m+","+g+","+t+","+y+")",s.fillText(e,(n+5)*a+.5*(i.width-l),.5*(i.height-h)+(o+n)*a),i)}fileLoader.setResponseType("blob");class Shape extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),this.visibleNeedsUpdate=!0,this._visible=e&&!0}get map(){return this._map}set map(e){e&&(isBase64(this._map=e)?(this.texture=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0):loadImageAsBase64(e,e=>{e&&(this.texture=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}))}constructor(e={}){super(e);var t=e.name;const i=new Color$1(1,1,1),s=(e.color&&(i.r=MathUtils.clamp(e.color.r,0,1),i.g=MathUtils.clamp(e.color.g,0,1),i.b=MathUtils.clamp(e.color.b,0,1)),new Color$1(1,1,1));e.color2?(s.r=MathUtils.clamp(e.color2.r,0,1),s.g=MathUtils.clamp(e.color2.g,0,1),s.b=MathUtils.clamp(e.color2.b,0,1)):(s.r=i.r,s.g=i.g,s.b=i.b);let a=void 0===e.size?10:e.size,o=void 0===e.sizeAttenuation||e.sizeAttenuation,n=void 0===e.gardientDirection?1:e.gardientDirection,r=void 0===e.brightness?0:e.brightness,l=void 0===e.scroll?0:e.scroll,h=this.childIndex=-1,d=void 0===e.speed?.2:e.speed,c=void 0===e.roughness?1:e.roughness,u=void 0===e.metallic?0:e.metallic,p=(this.map=e.map||null,void 0===e.opacity?1:e.opacity),m=void 0===e.uvRotateSpeed?0:e.uvRotateSpeed,g=void 0===e.WPOScaleAnimateSpeed?0:e.WPOScaleAnimateSpeed,y=void 0===e.WPOMinAnimateScale?1:e.WPOMinAnimateScale,f=void 0===e.WPOMaxAnimateScale?2:e.WPOMaxAnimateScale;const b=new Color$1(1,1,1),x=(e.brightnessColor&&(b.r=MathUtils.clamp(e.brightnessColor.r,0,1),b.g=MathUtils.clamp(e.brightnessColor.g,0,1),b.b=MathUtils.clamp(e.brightnessColor.b,0,1)),e.position||new Vector3),v=new Euler,S=(e.rotation&&(v.x=MathUtils.clamp(e.rotation.x,-180,180),v.y=MathUtils.clamp(e.rotation.y,-180,180),v.z=MathUtils.clamp(e.rotation.z,-180,180)),new Quaternion),C=new Vector3(1,1,1),U=(e.scale&&(C.x=e.scale.x,C.y=e.scale.y,C.z=e.scale.z),new Vector3(0,0,0));e.offset&&(U.x=e.offset.x,U.y=e.offset.y,U.z=e.offset.z),this.isInstance=e.isInstance||!1,this.transparent=e.transparent||p<1,this.depthTest=!("depthTest"in e)||e.depthTest,this.renderNum=void 0===e.renderNum?20:e.renderNum,this._visible=void 0===e.visible||e.visible,v._onChange(function(){S.setFromEuler(v,!1),this.matrixNeedsUpdate=!0}),S._onChange(function(){v.setFromQuaternion(S,void 0,!1),this.matrixNeedsUpdate=!0}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,get:()=>x,set:e=>{e&&(x.x=e.x,x.y=e.y,x.z=e.z,this.matrixNeedsUpdate=!0)}},childIndex:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e!==h&&(h=e)}},rotation:{configurable:!0,enumerable:!0,get:()=>v,set:e=>{e&&(v.x=MathUtils.clamp(e.x,-180,180),v.y=MathUtils.clamp(e.y,-180,180),v.z=MathUtils.clamp(e.z,-180,180),this.matrixNeedsUpdate=!0)}},quaternion:{writable:!0,configurable:!0,value:S,enumerable:!0},scale:{configurable:!0,enumerable:!0,get:()=>C,set:e=>{e&&(C.x=e.x,C.y=e.y,C.z=e.z,this.matrixNeedsUpdate=!0)}},offset:{configurable:!0,enumerable:!0,get:()=>U,set:e=>{e&&(U.x=e.x,U.y=e.y,U.z=e.z,this.matrixNeedsUpdate=!0)}},color:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i.r=e.r,i.g=e.g,i.b=e.b,e.a&&(p=e.a),this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},color2:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.r=e.r,s.g=e.g,s.b=e.b,e.a&&(p=e.a),this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},gardientDirection:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{void 0!==e&&(n=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},scroll:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{void 0!==e&&(l=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},uvRotateSpeed:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{void 0!==e&&(m=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOMaxAnimateScale:{configurable:!0,enumerable:!0,get:()=>f,set:e=>{void 0!==e&&(f=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOMinAnimateScale:{configurable:!0,enumerable:!0,get:()=>y,set:e=>{void 0!==e&&(y=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOScaleAnimateSpeed:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{void 0!==e&&(g=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},speed:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{void 0!==e&&(d=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},brightness:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{void 0!==e&&(r=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},roughness:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{c=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},metallic:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{u=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},opacity:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{this.transparent=e<1,p=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},brightnessColor:{configurable:!0,enumerable:!0,get:()=>b,set:e=>{e&&(b.copy(e),this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},_layerName:{configurable:!1,enumerable:!1,value:"CommonGISLayer",writable:!0},_cloudControlType:{configurable:!1,enumerable:!1,value:"Gis",writable:!0},type:{configurable:!1,enumerable:!0,value:"Shape",writable:!0},name:{configurable:!1,enumerable:!0,value:t,writable:!0},size:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{void 0!==e&&(a=e,this.overtimeInstanceIndex=[],this.materialNeedsUpdate=!0)}},sizeAttenuation:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{void 0!==e&&(o=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}}}),e.data&&this.setData(e.data),this.matrixNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.visibleNeedsUpdate=!1,this.animateNeedsUpdate=!1}animate(e={}){var t,i,s,a,o,n;return!!e.to&&({from:n={},to:t={},duration:i=3e3,easing:s="Linear",loop:a=!1,stayEnd:o=!0}=e,n.position||delete n.position,n.rotation||delete n.rotation,n.scale||delete n.scale,t.position||delete t.position,t.rotation||delete t.rotation,t.scale||delete t.scale,t.animateOffset||delete t.animateOffset,this.animateNeedsUpdate=!0,this.animateJson={Status:"play",From:n,To:t,Duration:i,Easing:s,Loop:a,StayEnd:o},n=new Tween({ratio:0}).to({ratio:1},e.duration||3e3).start(),a&&n.repeat(1/0),this.tween=null,this.tween=n,this.tween)}stopAnimate(e=1e3){this.animateNeedsUpdate=!0,this.animateJson={Status:"stop",DelayTime:e},this.tween&&this.tween.stop(),this.tween=null}setData(e){var t=getGeoFeatures(e);if(t.length<1)return!1;var i,s,e=t[0].geometry.type.toLowerCase();if(this.isInstance&&["point","multipoint"].indexOf(e)<0)return!1;let a={};switch(e){case"point":case"multipoint":a=getUEPointData(t);break;case"linestring":case"multilinestring":a=getUELineData(t);break;case"polygon":case"multipolygon":a=getProcessedPolygonData(t)}this.isInstance?({data:e,overtimeInstanceIndex:i,datas:s}=mergePointData(this.datas,a),(0<e.length||0<i.length)&&(this.datas=s,this.data=e,this.overtimeInstanceIndex=i,this.materialNeedsUpdate=!0)):this.data=a}toJSON(e=!0){return!this.visibleNeedsUpdate||!e||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,DepthTest:this.depthTest,Scroll:this.scroll,Speed:this.speed,Texture:this.texture,GardientDirection:this.gardientDirection,RotateSpeed:this.uvRotateSpeed,ScaleAnimateSpeed:this.WPOScaleAnimateSpeed,MinAnimateScale:this.WPOMinAnimateScale,MaxAnimateScale:this.WPOMaxAnimateScale,Color2:{r:this.color2.r,g:this.color2.g,b:this.color2.b,a:this.opacity},BrightnessColor:this.brightnessColor?{r:this.brightnessColor.r,g:this.brightnessColor.g,b:this.brightnessColor.b,a:1}:Color$1,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,animateNeedsUpdate:!this.isInstance&&this.animateNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid,jsondata:!e||this.isInstance?this.data:null,AnimateJson:this.animateNeedsUpdate?this.animateJson:null,Size:this.size,SizeAttenuation:this.sizeAttenuation,RenderNum:this.renderNum,ChildIndex:this.isInstance?-1:this.childIndex,IsInstance:this.isInstance,OvertimeInstanceIndex:this.overtimeInstanceIndex}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid,ChildIndex:this.childIndex}}dispose(){this.traverse(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose(),e.texture=null}),this.data=null,this.datas=null,this.texture=null}copy(e,t=!0){return this.color.copy(e.color),this.brightness=e.brightness,this.metallic=e.metallic,this.roughness=e.roughness,this.opacity=e.opacity,this.transparent=e.transparent,this.texture=e.texture,this.brightnessColor.copy(e.brightnessColor),this.offset.copy(e.offset),super.copy(e,t),this}}function mergePointData(i,s){if(!i||i.length<1)return{data:s,datas:s,overtimeInstanceIndex:[]};var a=[],o=[],t=[],n=[];for(let e=0;e<i.length;e++){var{geometry:r,properties:l={}}=i[e],h=r["coordinates"],{rotation:d={x:0,y:0,z:0},scale:c={x:1,y:1,z:1}}=l;let t=!1;for(let e=0;e<s.length;e++){var{geometry:u,properties:p={}}=s[e];const g=u["coordinates"];var{rotation:u={x:0,y:0,z:0},scale:p={x:1,y:1,z:1}}=p,m=h.length===g.length&&h.every((e,t)=>e===g[t]);if(m&&(d.x===u.x&&d.y===u.y&&d.z===u.z&&c.x===p.x&&c.y===p.y&&c.z===p.z&&!(-1<a.indexOf(e)))){a.push(e),t=!0,n.push(s[e]);break}}t||o.push(e)}for(let e=0;e<s.length;e++)a.indexOf(e)<0&&(t.push(s[e]),n.push(s[e]));return{data:t,overtimeInstanceIndex:o,datas:n}}class Polygon extends Shape{constructor(e={}){super(e),this.type="Polygon";let t=e.fillStyle||"Empty",i=void 0===e.speedX?.25:e.speedX,s=void 0===e.speedY?.25:e.speedY,a=void 0===e.rotateAngle?0:e.rotateAngle,o=void 0===e.tile?.5:e.tile;Object.defineProperties(this,{fillStyle:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e,this.materialNeedsUpdate=!0)}},rotateAngle:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.materialNeedsUpdate=!0)}},tile:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.materialNeedsUpdate=!0)}},speedX:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.materialNeedsUpdate=!0)}},speedY:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.materialNeedsUpdate=!0)}}})}setData(e){this.data=getProcessedPolygonData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,FillStyle:this.fillStyle,SpeedX:this.speedX,SpeedY:this.speedY,RotateAngle:this.rotateAngle,Tile:this.tile,Transparent:this.transparent,Texture:this.texture,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}function calculationDistance(e,t){var i=e[0],e=e[1],s=t[0],t=t[1];return Math.sqrt((i-s)*(i-s)+(e-t)*(e-t))}function distToSegment(e,t,i){var s=Math.abs(calculationDistance(e,t)),e=Math.abs(calculationDistance(e,i)),t=Math.abs(calculationDistance(t,i)),i=(s+e+t)/2;return 2*Math.sqrt(Math.abs(i*(i-s)*(i-e)*(i-t)))/s}function compressLine(s,e,a,o,n){if(a<o){let t=0,i=0;var r=s[a],l=s[o];for(let e=a+1;e<o;e++){var h=distToSegment(r,l,s[e]);h>t&&(t=h,i=e)}t>=n&&(e.push(s[i]),compressLine(s,e,a,i,n),compressLine(s,e,i,o,n))}return e}function douglasPeucker(e,t=10,i=1){if(!(e&&2<e.length))return null;e.forEach((e,t)=>{e.id=t});i=compressLine(e,[],0,e.length-i,t),i.push(e[0]),i.push(e[e.length-1]),t=i.sort((e,t)=>e.id<t.id?-1:e.id>t.id?1:0);return t.forEach(e=>{e.id=0}),t}class Line extends Shape{constructor(e={}){super(e),this.type="Line";let t=e.style||LineTypeOptions.SOLID,i=e.splineType||LineSplineTypeOptions.LINEAR,s=e.direction||LineDirectionOptions.CENTER,a=e.width||4,o=e.tilling||5,n=e.speed||1,r=void 0!==e.openStroke&&e.openStroke;const l=e.strokeColor||null;let h=e.strokeWidth||1,d=(this.isDilution=e.isDilution||!1,this.interval=e.interval||1e-5,this.visible=void 0===e.visible||e.visible,this.collision=void 0!==e.collision&&e.collision,{enable:!1,speedX:1,speedY:0,uvRotation:0,u:0,v:0});e.lineUVOption&&(d.enable=void 0!==e.lineUVOption.enable&&e.lineUVOption.enable,d.speedX=void 0===e.lineUVOption.speedX?1:e.lineUVOption.speedX,d.speedY=void 0===e.lineUVOption.speedY?0:e.lineUVOption.speedY,d.uvRotation=void 0===e.lineUVOption.uvRotation?0:e.lineUVOption.uvRotation,d.u=void 0===e.lineUVOption.u?0:e.lineUVOption.u,d.v=void 0===e.lineUVOption.v?0:e.lineUVOption.v),this.renderType=void 0===e.renderType?0:e.renderType,this.section_Length=void 0===e.section_Length?100:e.section_Length,Object.defineProperties(this,{style:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e,this.materialNeedsUpdate=!0)}},lineUVOption:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d.enable=void 0!==e.enable&&e.enable,d.speedX=void 0===e.speedX?1:e.speedX,d.speedY=void 0===e.speedY?0:e.speedY,d.uvRotation=void 0===e.uvRotation?0:e.uvRotation,d.u=void 0===e.u?0:e.u,d.v=void 0===e.v?0:e.v,this.materialNeedsUpdate=!0)}},splineType:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.materialNeedsUpdate=!0)}},direction:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.materialNeedsUpdate=!0)}},width:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.materialNeedsUpdate=!0)}},tilling:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.materialNeedsUpdate=!0)}},speed:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e,this.materialNeedsUpdate=!0)}},openStroke:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e,this.materialNeedsUpdate=!0)}},strokeColor:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l.r=e.r,l.g=e.g,l.b=e.b,l.a=e.a||1,this.materialNeedsUpdate=!0)}},strokeWidth:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e,this.materialNeedsUpdate=!0)}}})}setData(e){var t;this.isDilution&&((t=getGeoFeatures(e)).forEach((e,t)=>{var i=e.geometry.coordinates,s=i.length;let a=1;var[o,n,r]=i[0],[s,l,h]=i[s-1];o===s&&n===l&&r===h&&(a=2),e.geometry.coordinates=douglasPeucker(i,this.interval,a)}),(e={}).features=t),this.data=getUELineData(e)}updataLineColor(e){Array.isArray(e)&&e.length===this.data.length&&(this.colordata=e,this.materialNeedsUpdate=!0)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Collision:this.collision,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Style:this.style,Spline_Type:this.splineType,MeshDirection:this.direction,RenderType:this.renderType,Section_Length:this.section_Length,Width:this.width,Tilling:this.tilling,Speed:this.speed,Open_Stroke:this.openStroke,Stroke_Color:this.strokeColor?{r:this.strokeColor.r,g:this.strokeColor.g,b:this.strokeColor.b,a:1}:null,Stroke_Width:this.strokeWidth,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,LineUVOption:this.lineUVOption,colordata:this.colordata}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.style=e.style,this.splineType=e.splineType,this.direction=e.direction,this.width=e.width,this.tilling=e.tilling,this.speed=e.speed,this.openStroke=e.openStroke,this.strokeColor=e.strokeColor,this.strokeWidth=e.strokeWidth,super.copy(e,t),this}}class Point extends Shape{constructor(e={}){super(e);let t=e.size||4;this.type="Point",Object.defineProperties(this,{size:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{(t=Number(e))&&(this.scale=new Vector3(t,t,t),this.matrixNeedsUpdate=!0)}}})}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Size:this.size,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.size=e.size,super.copy(e,t),this}}class Cube extends Shape{constructor(e){super(e),this.type="Cube"}}class MeasureArea extends Shape{constructor(e={}){super(e),this.type="MeasureArea";let t=void 0===e.textDisplay||e.textDisplay;const i=e.textColor||new Color$1(1,0,0);let s=e.fontSize||18,a=e.textBorderColor||new Color$1(1,0,0),o=e.textBorderWidth||1,n=void 0===e.measureCoef?1:e.measureCoef,r=void 0===e.measureCoefType?0:e.measureCoefType;Object.defineProperties(this,{textDisplay:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e)}},measureCoef:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e)}},measureCoefType:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e)}},fontSize:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e)}},textColor:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i.r=e.r,i.g=e.g,i.b=e.b)}},textBorderWidth:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e)}},textBorderColor:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a.r=e.r,a.g=e.g,a.b=e.b)}}})}updateParameters(e){for(const t in e)this[t]!==e[t]&&(this[t]=e[t])}toJSON(e=!0){return e&&this.visibleNeedsUpdate&&!this.materialNeedsUpdate?{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid}:{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,FontSize:this.fontSize,TextDisplay:this.textDisplay,TextColor:{r:this.textColor.r,g:this.textColor.g,b:this.textColor.b,a:1},TextBorderColor:{r:this.textBorderColor.r,g:this.textBorderColor.g,b:this.textBorderColor.b,a:1},TextBorderWidth:this.textBorderWidth,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,MeasureCoefType:this.measureCoefType,MeasureCoef:this.measureCoef}}copy(e,t=!0){return this.fontSize=e.fontSize,this.textDisplay=e.textDisplay,this.textColor=e.textColor,this.textBorderColor=e.textBorderColor,this.textBorderWidth=e.textBorderWidth,this.measureCoefType=e.measureCoefType,this.measureCoef=e.measureCoef,super.copy(e,t),this}}class MeasureLine extends Shape{constructor(e={}){super(e),this.type="MeasureLine";let t=e.style||LineTypeOptions.SOLID,i=e.splineType||LineSplineTypeOptions.LINEAR,s=e.direction||LineDirectionOptions.CENTER,a=e.width||4,o=e.tilling||300,n=e.speed||1,r=void 0!==e.openStroke&&e.openStroke;const l=e.strokeColor||null;let h=e.strokeWidth||1,d=void 0===e.textDisplay||e.textDisplay;const c=e.textColor||new Color$1(1,0,0);let u=e.fontSize||18,p=e.textBorderColor||new Color$1(1,0,0),m=e.textBorderWidth||1,g=void 0===e.measureCoef?1:e.measureCoef,y=void 0===e.measureCoefType?0:e.measureCoefType;Object.defineProperties(this,{style:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e)}},measureCoef:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g=e)}},measureCoefType:{configurable:!0,enumerable:!0,get:()=>y,set:e=>{e&&(y=e)}},splineType:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e)}},direction:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e)}},width:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e)}},tilling:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e)}},speed:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e)}},openStroke:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e)}},strokeColor:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l.r=e.r,l.g=e.g,l.b=e.b,l.a=e.a||1)}},strokeWidth:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e)}},textDisplay:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d=e)}},fontSize:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{e&&(u=e)}},textColor:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{e&&(c.r=e.r,c.g=e.g,c.b=e.b)}},textBorderWidth:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e&&(m=e)}},textBorderColor:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{e&&(p.r=e.r,p.g=e.g,p.b=e.b)}}})}updateParameters(e){for(const t in e)this[t]!==e[t]&&(this[t]=e[t])}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Style:this.style,Spline_Type:this.splineType,MeshDirection:this.direction,Width:this.width,Tilling:this.tilling,Speed:this.speed,Open_Stroke:this.openStroke,Stroke_Color:this.strokeColor?{r:this.strokeColor.r,g:this.strokeColor.g,b:this.strokeColor.b,a:1}:null,Stroke_Width:this.strokeWidth,FontSize:this.fontSize,TextColor:{r:this.textColor.r,g:this.textColor.g,b:this.textColor.b,a:1},TextDisplay:this.textDisplay,TextBorderColor:{r:this.textBorderColor.r,g:this.textBorderColor.g,b:this.textBorderColor.b,a:1},TextBorderWidth:this.textBorderWidth,MeasureCoefType:this.measureCoefType,MeasureCoef:this.measureCoef}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.style=e.style,this.splineType=e.splineType,this.direction=e.direction,this.width=e.width,this.tilling=e.tilling,this.speed=e.speed,this.openStroke=e.openStroke,this.strokeColor=e.strokeColor,this.strokeWidth=e.strokeWidth,this.fontSize=e.fontSize,this.textColor=e.textColor,this.textDisplay=e.textDisplay,this.textBorderColor=e.textBorderColor,this.textBorderWidth=e.textBorderWidth,this.measureCoefType=e.measureCoefType,this.measureCoef=e.measureCoef,super.copy(e,t),this}}class SurfaceLine extends Shape{constructor(e={}){super(e),this.type="SurfaceLine";let t=e.rayDistance||100,i=e.width||4,s=e.rayDetectionDistance||500;const a=e.textColor||new Color$1(1,0,0);let o=e.fontSize||18,n=e.linePixel||1024;Object.defineProperties(this,{width:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e)}},rayDistance:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e!==t&&(t=e)}},rayDetectionDistance:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e!==s&&(s=e)}},linePixel:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e!==n&&(n=e)}},fontSize:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e)}},textColor:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a.r=e.r,a.g=e.g,a.b=e.b)}}})}updateParameters(e){for(const t in e)this[t]!==e[t]&&(this[t]=e[t])}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Style:"solid",Spline_Type:"Curve",MeshDirection:"Ground_Center",Width:this.width,FontSize:this.fontSize,TextColor:{r:this.textColor.r,g:this.textColor.g,b:this.textColor.b,a:1},LinePixel:this.linePixel}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.style="solid",this.splineType="Curve",this.direction="Ground_Center",this.width=e.width,this.fontSize=e.fontSize,this.textColor=e.textColor,this.textDisplay=e.textDisplay,this.textBorderColor=e.textBorderColor,this.textBorderWidth=e.textBorderWidth,super.copy(e,t),this}}class LocationPoint extends Shape{constructor(e={}){super(e),this.type="LocationPoint",this.EPSG=e.EPSG||"epsg:4326";const t=e.textColor||new Color$1(1,0,0);let i=e.fontSize||18,s=e.textBorderColor||new Color$1(1,0,0),a=e.textBorderWidth||1;Object.defineProperties(this,{fontSize:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e)}},textColor:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t.r=e.r,t.g=e.g,t.b=e.b)}},textBorderWidth:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e)}},textBorderColor:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.r=e.r,s.g=e.g,s.b=e.b)}}})}updateParameters(e){for(const t in e)this[t]!==e[t]&&(this[t]=e[t])}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,FontSize:this.fontSize,TextColor:{r:this.textColor.r,g:this.textColor.g,b:this.textColor.b,a:1},EPSG:this.EPSG,TextBorderColor:{r:this.textBorderColor.r,g:this.textBorderColor.g,b:this.textBorderColor.b,a:1},TextBorderWidth:this.textBorderWidth,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.fontSize=e.fontSize,this.textColor=e.textColor,this.textBorderColor=e.textBorderColor,this.EPSG=e.EPSG,this.textBorderWidth=e.textBorderWidth,super.copy(e,t),this}}function compress(e){e=JSON.stringify(e);return e.replace(/\r\n/g,"").replace(/\n/g,"").replace(/\s+/g,""),e}const rAF=window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.requestAnimationFrame;class CloudRenderApp extends EventDispatcher{constructor(e){super(),this.type="CloudRenderEngine",this.controllers=(null==e?void 0:e.controllers)||{},this.kbEvent=document.createEvent("KeyboardEvent"),this.initMethod=void 0!==this.kbEvent.initKeyboardEvent?"initKeyboardEvent":"initKeyEvent",this.webRtcPlayerObj=null,this.print_stats=(null==e?void 0:e.print_stats)||!1,this.print_inputs=(null==e?void 0:e.print_inputs)||!1,this.connect_on_load=(null==e?void 0:e.connect_on_load)||!1,this.is_reconnection=(null==e?void 0:e.is_reconnection)||!1,this.ws,this.wsURL=null==e?void 0:e.wsUrl,this.projectName=null==e?void 0:e.projectName,this.matchmakerIP=null==e?void 0:e.matchmakerIP,this.matchmakerPort=(null==e?void 0:e.matchmakerPort)||"90",this.scene=new Scene,(this.scene.engine=this).qualityController=!1,this.qualityControlOwnershipCheckBox,this.matchViewportResolution=(null==e?void 0:e.matchViewportResolution)||!1,this.lastTimeResized=(new Date).getTime(),this.resizeTimeout,this.onDataChannelConnected;var{controlScheme:t=inputOptions.controlScheme,suppressBrowserKeys:i=inputOptions.suppressBrowserKeys,fakeMouseWithTouches:s=inputOptions.fakeMouseWithTouches}=(null==e?void 0:e.inputOptions)||{};this.inputOptions={controlScheme:t,suppressBrowserKeys:i,fakeMouseWithTouches:s},this.eventHandler=new EventHandler(this),this.freezeFrameOverlay=null,this.shouldShowPlayOverlay=null==e?void 0:e.shouldShowPlayOverlay,this.freezeFrame={receiving:!1,size:0,jpeg:void 0,height:0,width:0,valid:!1},this.file={mimetype:"",extension:"",receiving:!1,size:0,data:[],valid:!1,timestampStart:void 0},this.afk=(null==e?void 0:e.afk)||{enabled:!1,warnTimeout:120,closeTimeout:10,active:!1,overlay:void 0,warnTimer:void 0,countdown:0,countdownTimer:void 0},this.editTextButton=void 0,this.hiddenInput=void 0,this.t0=Date.now(),this.dataTransferFrequence=20,this.streamTrackSource=null,this.VideoEncoderQP=(null==e?void 0:e.VideoEncoderQP)||"N/A",this.UDSParams=(null==e?void 0:e.UDSParams)||{},this.UDS,this.styleWidth,this.styleHeight,this.styleTop,this.styleLeft,this.styleCursor=(null==e?void 0:e.styleCursor)||"default",this.styleAdditional,this._orientationChangeTimeout,this.playerElementClientRect=void 0,this.normalizeAndQuantizeUnsigned=void 0,this.normalizeAndQuantizeSigned=void 0,this.isShowTestUI=null==e?void 0:e.isShowTestUI,setTimeout(()=>{this.interval(this.dataTransferFrequence)},1e3),this.initObjectBBox()}interval(e=5){setInterval(()=>{this.eventHandler.updateObjectsWithEvent(),this.eventListenerUpdate(this),this.eventListenerUpdate(this.camera),this.scene.traverse(e=>{this.eventListenerUpdate(e),e.visibleNeedsUpdate&&(e.uuid===this.objectBBox.uuid?this.emitUIInteraction({excuteName:InteractMOD.OBJECT_BOUNDINGBOX,params:this.objectBBox.toJSON()}):this.emitUIInteraction({excuteName:GisControl.VISIBLE,params:e.toJSON()}),e.visibleNeedsUpdate=!1),e.visible&&(e.matrixNeedsUpdate||e.materialNeedsUpdate||e.animateNeedsUpdate)&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:ApplicationControl.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?this.emitUIInteraction({excuteName:SceneControl.EVENT_LAYER_BUILDING,params:e.toJSON()}):"SlopeAnalysis"===e.type?this.emitUIInteraction({excuteName:SceneControl.UPDATA_SLOPE_ANALYSIS,params:e.toJSON()}):this.emitUIInteraction({excuteName:GisControl.UPDATE,params:e.toJSON()}),e.matrixNeedsUpdate=!1,e.materialNeedsUpdate=!1,e.animateNeedsUpdate=!1),e.visible&&e.messageNeedsUpdate&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:ApplicationControl.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):this.emitUIInteraction({excuteName:GisControl.UPDATE,params:e.toJSON()}),e.messageNeedsUpdate=!1),e.followNeedsUpdate&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:ApplicationControl.FOLLOW_TRAFFIC_STREAM_ITEM,params:e.toJSON(!1)}):"AutonomousVehicle"===e.type&&this.emitUIInteraction({excuteName:GisControl.UPDATE,params:e.toJSON()}),e.followNeedsUpdate=!1)}),this.camera&&this.camera.needsUpdate&&(this.camera.constrainPolygonNeedsUpdate?(this.emitUIInteraction({excuteName:CameraControl.Constrain_Shape,params:this.camera.toJSON()}),this.camera.constrainPolygonNeedsUpdate=!1):this.emitUIInteraction({excuteName:CameraControl.UPDATE,params:this.camera.toJSON()}),this.camera.needsUpdate=!1)},1e3/e)}eventListenerUpdate(e){e&&e._needsDispatchedToUE&&(e._dispatchAddListenerTypes&&0<e._dispatchAddListenerTypes.length&&(this.emitUIInteraction({excuteName:ApplicationControl.ADD_EVENT_LISTENER,params:{type:e.type,name:e.name,uuid:e.uuid,EventType:e._dispatchAddListenerTypes}}),e._dispatchAddListenerTypes=[]),e._dispatchRemoveListenerTypes&&0<e._dispatchRemoveListenerTypes.length&&(this.emitUIInteraction({excuteName:ApplicationControl.REMOVE_EVENT_LISTENER,params:{type:e.type,name:e.name,uuid:e.uuid,EventType:e._dispatchRemoveListenerTypes}}),e._dispatchRemoveListenerTypes=[]),e._needsDispatchedToUE=!1,e._dispatchName=null)}log(e){console.log(Math.floor(Date.now()-this.t0)+": "+e)}initCamera(){var e;this.camera&&(null!=(e=this.camera)&&e.removeFromParent(),this.camera=null),this.camera=new Camera,this.camera.type="Camera",this.camera.addEventListener("cameraChange",e=>{var t,i=e.content.camera;this.camera.position.x=i.Location.longitude,this.camera.position.y=i.Location.latitude,this.camera.position.z=i.Location.altitude,this.camera.rotation.x=MathUtils.degToRad(i.Rotate.roll),this.camera.rotation.y=MathUtils.degToRad(i.Rotate.pitch),this.camera.rotation.z=MathUtils.degToRad(i.Rotate.yaw),this.camera.roll=i.Rotate.roll,this.camera.pitch=i.Rotate.pitch,this.camera.yaw=i.Rotate.yaw,this.camera.worldLocation.x=null==i||null==(t=i.Position)?void 0:t.x,this.camera.worldLocation.y=null==i||null==(t=i.Position)?void 0:t.y,this.camera.worldLocation.z=null==i||null==(t=i.Position)?void 0:t.z,this.camera.sphereLocation.x=null==i||null==(t=i.SphereLocation)?void 0:t.longitude,this.camera.sphereLocation.y=null==i||null==(t=i.SphereLocation)?void 0:t.latitude,this.camera.sphereLocation.z=null==i||null==(t=i.SphereLocation)?void 0:t.altitude,this.level=Math.ceil(Math.max(Math.log2(103300/this.camera.worldLocation.z),0)),this.dispatchEvent({type:"camera_changed",data:e})})}initObjectBBox(){if(this.objectBBox)return!1;this.objectBBox=new Cube({color:new Color$1(1,1,0)}),this.scene.add(this.objectBBox),this.objectBBox.visible=!1,this.emitUIInteraction({excuteName:InteractMOD.OBJECT_BOUNDINGBOX,params:this.objectBBox.toJSON()})}scanGamepads(){var t=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[];for(let e=0;e<t.length;e++)t[e]&&t[e].index in this.controllers&&(this.controllers[t[e].index].currentState=t[e])}updateStatus(){for(j in this.scanGamepads(),this.controllers){var e=this.controllers[j],t=e.currentState,i=e.prevState;for(let e=0;e<t.buttons.length;e++){var s=t.buttons[e],a=i.buttons[e];s.pressed&&!a.pressed?6==e?this.emitControllerAxisMove(j,5,s.value):7==e?this.emitControllerAxisMove(j,6,s.value):this.emitControllerButtonPressed(j,e,0):!s.pressed&&a.pressed?6==e?this.emitControllerAxisMove(j,5,0):7==e?this.emitControllerAxisMove(j,6,0):this.emitControllerButtonReleased(j,e):s.pressed&&a.pressed&&(6==e?this.emitControllerAxisMove(j,5,s.value):7==e?this.emitControllerAxisMove(j,6,s.value):this.emitControllerButtonPressed(j,e,1))}for(let e=0;e<t.axes.length;e+=2){var o=parseFloat(t.axes[e].toFixed(4)),n=-parseFloat(t.axes[e+1].toFixed(4));0===e?(this.emitControllerAxisMove(j,1,o),this.emitControllerAxisMove(j,2,n)):2===e&&(this.emitControllerAxisMove(j,3,o),this.emitControllerAxisMove(j,4,n))}this.controllers[j].prevState=t}rAF(this.updateStatus)}emitControllerButtonPressed(e,t,i){(Data=new DataView(new ArrayBuffer(4))).setUint8(0,MessageType.GamepadButtonPressed),Data.setUint8(1,e),Data.setUint8(2,t),Data.setUint8(3,i)}emitControllerButtonReleased(e,t){(Data=new DataView(new ArrayBuffer(3))).setUint8(0,MessageType.GamepadButtonReleased),Data.setUint8(1,e),Data.setUint8(2,t)}emitControllerAxisMove(e,t,i){(Data=new DataView(new ArrayBuffer(11))).setUint8(0,MessageType.GamepadAnalog),Data.setUint8(1,e),Data.setUint8(2,t),Data.setFloat64(3,i,!0),this.sendInputData(Data.buffer)}setupToggleWithUrlParams(e,i){e=document.getElementById(e);e&&(e.checked=new URLSearchParams(window.location.search).has(i),e.addEventListener("change",e=>{var t=new URLSearchParams(window.location.search);e.currentTarget.checked?t.set(i,"true"):t.delete(i),window.history.replaceState({},"",""!==t.toString()?location.pathname+"?"+t:""+location.pathname)}))}updateStreamList(){var e,t,i=document.getElementById("stream-select");for(let e=i.options.length-1;0<=e;e--)i.remove(e);i.value=null;for([e,t]of this.webRtcPlayerObj.availableVideoStreams){var s=document.createElement("option");s.value=e,s.innerHTML=e,i.appendChild(s),null==i.value&&(i.value=e)}this.updateTrackList()}updateTrackList(){var e=document.getElementById("stream-select"),t=document.getElementById("track-select"),e=this.webRtcPlayerObj.availableVideoStreams.get(e.value);for(let e=t.options.length-1;0<=e;e--)t.remove(e);t.value=null;for(const s of e.getVideoTracks()){var i=document.createElement("option");i.value=s.id,i.innerHTML=s.label,t.appendChild(i),s.selected&&(t.value=s.id)}}sendStartLatencyTest(){const t=this;this.webRtcPlayerObj&&this.webRtcPlayerObj.startLatencyTest(function(e){e={StartTime:e};t.emitDescriptor(MessageType.LatencyTest,e)})}setOverlay(e,t,i){let s=document.getElementById("videoPlayOverlay");var a;for(s||(a=document.getElementById("player"),(s=document.createElement("div")).id="videoPlayOverlay",a&&a.appendChild(s));s.lastChild;)s.removeChild(s.lastChild);t&&s.appendChild(t),i&&s.addEventListener("click",function e(t){i(t),s.removeEventListener("click",e)});var o=s.classList;for(let e=o.length-1;0<=e;e--)o.remove(o[e]);s.classList.add(e)}showConnectOverlay(){var e=document.createElement("div");e.id="playButton",e.innerHTML="点击开始",this.setOverlay("clickableState",e,e=>{this.connect(),this.startAfkWarningTimer()})}showTextOverlay(e){var t=document.createElement("div");t.id="messageOverlay",t.innerHTML=e||"",this.setOverlay("textDisplayState",t)}playVideoStream(){const t=this;t.webRtcPlayerObj&&this.webRtcPlayerObj.video?(t.webRtcPlayerObj.video.play().catch(function(e){console.error(e),console.log("Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),t.showPlayOverlay()}),t.requestInitialSettings(),t.requestQualityControl(),t.eventHandler.showFreezeFrameOverlay(),t.hideOverlay()):console.error("Could not player video stream because this.webRtcPlayerObj.video was not valid.")}showPlayOverlay(){var e=document.createElement("img");e.id="playButton",e.src="/images/Play.png",e.alt="Start Streaming",this.setOverlay("clickableState",e,e=>{this.playVideoStream()}),this.shouldShowPlayOverlay=!1}updateAfkOverlayText(){this.afk.overlay.innerHTML="<center>No activity detected<br>Disconnecting in "+this.afk.countdown+" seconds<br>Click to continue<br></center>"}showAfkOverlay(){this.stopAfkWarningTimer(),this.afk.overlay=document.createElement("div"),this.afk.overlay.id="afkOverlay",this.setOverlay("clickableState",this.afk.overlay,e=>{this.hideOverlay(),clearInterval(this.afk.countdownTimer),this.startAfkWarningTimer()}),this.afk.countdown=this.afk.closeTimeout,this.updateAfkOverlayText(),this.inputOptions.controlScheme==ControlSchemeType.LockedMouse&&document.exitPointerLock(),this.afk.countdownTimer=setInterval(function(){this.afk.countdown--,0==this.afk.countdown?(this.hideOverlay(),this.ws.close()):this.updateAfkOverlayText()},1e3)}hideOverlay(){this.setOverlay("hiddenState")}startAfkWarningTimer(){this.afk.active=this.afk.enabled,this.resetAfkWarningTimer()}stopAfkWarningTimer(){this.afk.active=!1}resetAfkWarningTimer(){const e=this;this.afk.active&&(clearTimeout(this.afk.warnTimer),this.afk.warnTimer=setTimeout(function(){e.showAfkOverlay()},1e3*e.afk.warnTimeout))}createWebRtcOffer(){this.webRtcPlayerObj?(console.log("Creating offer"),this.showTextOverlay("云渲染服务连接中,请稍等"),this.webRtcPlayerObj.createOffer()):(console.log("WebRTC player not setup, cannot create offer"),this.showTextOverlay("云渲染服务连接失败,无法获取画面"))}sendInputData(e){this.webRtcPlayerObj&&(this.resetAfkWarningTimer(),this.webRtcPlayerObj.send(e))}setupWebRtcPlayer(e,t){const a=this;function o(e){this.freezeFrame.receiving||(this.freezeFrame.receiving=!0,this.freezeFrame.valid=!1,this.freezeFrame.size=0,this.freezeFrame.jpeg=void 0),this.freezeFrame.size=new DataView(e.slice(1,5).buffer).getInt32(0,!0);var t,e=e.slice(5);this.freezeFrame.jpeg?((t=new Uint8Array(this.freezeFrame.jpeg.length+e.length)).set(this.freezeFrame.jpeg,0),t.set(e,this.freezeFrame.jpeg.length),this.freezeFrame.jpeg=t):(this.freezeFrame.jpeg=e,this.freezeFrame.receiving=!0,console.log(`received first chunk of freeze frame: ${this.freezeFrame.jpeg.length}/`+this.freezeFrame.size)),this.freezeFrame.jpeg.length===this.freezeFrame.size?(this.freezeFrame.receiving=!1,this.freezeFrame.valid=!0,console.log("received complete freeze frame "+this.freezeFrame.size),function(){var e=btoa(this.freezeFrame.jpeg.reduce((e,t)=>e+String.fromCharCode(t),""));let t=document.getElementById("this.freezeFrameOverlay").childNodes[0];t.src="data:image/jpeg;base64,"+e,t.onload=function(){a.freezeFrame.height=t.naturalHeight,a.freezeFrame.width=t.naturalWidth,a.resizeFreezeFrameOverlay(),a.shouldShowPlayOverlay?(a.showPlayOverlay(),a.eventHandler.resizePlayerStyle()):a.eventHandler.showFreezeFrameOverlay(),a.webRtcPlayerObj.setVideoEnabled(!1)}}()):this.freezeFrame.jpeg.length>this.freezeFrame.size&&(console.error(`received bigger freeze frame than advertised: ${this.freezeFrame.jpeg.length}/`+this.freezeFrame.size),this.freezeFrame.jpeg=void 0,this.freezeFrame.receiving=!1)}return this.webRtcPlayerObj=new webRtcPlayer(t),e.appendChild(this.webRtcPlayerObj.video),e.appendChild(this.freezeFrameOverlay),this.connect_on_load&&(this.webRtcPlayerObj.video.muted=!0),this.webRtcPlayerObj.onWebRtcOffer=function(e){var t;a.ws&&a.ws.readyState===WS_OPEN_STATE&&(t=JSON.stringify(e),console.log("%c[Outbound SS message (offer)]","background: lightgreen; color: black",e),a.ws.send(t))},this.webRtcPlayerObj.onWebRtcCandidate=function(e){a.ws&&a.ws.readyState===WS_OPEN_STATE&&a.ws.send(JSON.stringify({type:"iceCandidate",candidate:e}))},this.webRtcPlayerObj.onWebRtcAnswer=function(e){var t;a.ws&&a.ws.readyState===WS_OPEN_STATE&&(t=JSON.stringify(e),console.log("%c[Outbound SS message (answer)]","background: lightgreen; color: black",e),a.ws.send(t))},this.webRtcPlayerObj.onVideoInitialised=function(){a.ws&&a.ws.readyState===WS_OPEN_STATE&&(a.shouldShowPlayOverlay?(a.showPlayOverlay(),a.eventHandler.resizePlayerStyle()):(a.eventHandler.resizePlayerStyle(),a.playVideoStream()))},this.webRtcPlayerObj.onDataChannelConnected=function(){a.ws&&a.ws.readyState===WS_OPEN_STATE&&(a.showTextOverlay("云渲染服务连接成功,等待画面推送中"),a.requestQualityControl(),setTimeout(()=>{a.UDS||(a.UDS=new UltralDynamicSky(a,a.UDSParams)),a.camera||a.initOthers(),a.dispatchEvent({type:"videoInitialised"})},1e3))},this.webRtcPlayerObj.onNewVideoTrack=function(e){var t;null!==a&&void 0!==a&&null!=(t=a.webRtcPlayerObj)&&t.onVideoInitialised&&null!==a&&void 0!==a&&null!=(t=a.webRtcPlayerObj)&&t.onVideoInitialised(),a.isShowTestUI&&a.updateStreamList()},this.webRtcPlayerObj.onDataChannelMessage=function(e){var t,i,s=new Uint8Array(e);s[0]===ToClientMessageType.QualityControlOwnership?(i=0!==s[1],console.log("Received quality controller message, will control quality: "+i),a.qualityController=i,a.qualityControlOwnershipCheckBox&&(a.qualityControlOwnershipCheckBox.disabled=i,a.qualityControlOwnershipCheckBox.checked=i)):s[0]===ToClientMessageType.Response?(i=new TextDecoder("utf-16").decode(e.slice(1)),a.eventHandler.callRespone(JSON.parse(i))):s[0]===ToClientMessageType.Command?(i=new TextDecoder("utf-16").decode(e.slice(1)),console.log(i),"onScreenKeyboard"===(i=JSON.parse(i)).command&&a.showOnScreenKeyboard(i)):s[0]===ToClientMessageType.FreezeFrame?o(s):s[0]===ToClientMessageType.UnfreezeFrame?a.eventHandler.invalidateFreezeFrameOverlay():s[0]===ToClientMessageType.VideoEncoderAvgQP?a.VideoEncoderQP=new TextDecoder("utf-16").decode(e.slice(1)):s[0]==ToClientMessageType.LatencyTest?(i=new TextDecoder("utf-16").decode(e.slice(1)),console.log("Got latency timings from UE."),console.log(i),i=JSON.parse(i),a.webRtcPlayerObj&&a.webRtcPlayerObj.latencyTestTimings.SetUETimings(i)):s[0]==ToClientMessageType.InitialSettings?a.isShowTestUI&&(i=new TextDecoder("utf-16").decode(e.slice(1)),(i=JSON.parse(i)).PixelStreaming&&(!1===i.PixelStreaming.AllowPixelStreamingCommands&&(document.getElementById("encoder-min-qp-text").disabled=!0,document.getElementById("encoder-max-qp-text").disabled=!0,document.getElementById("webrtc-fps-text").disabled=!0,document.getElementById("webrtc-min-bitrate-text").disabled=!0,document.getElementById("webrtc-max-bitrate-text").disabled=!0,document.getElementById("show-fps-button").disabled=!0,document.getElementById("encoder-params-submit").disabled=!0,document.getElementById("webrtc-params-submit").disabled=!0,document.getElementById("warning-elem-webrtc")||((t=document.createElement("p")).innerText="(Disabled by -AllowPixelStreamingCommands=false)",t.classList="subtitle-text",t.id="warning-elem-webrtc",document.getElementById("webRTCSettingsHeader").appendChild(t)),document.getElementById("warning-elem-encoder")||((t=document.createElement("p")).innerText="(Disabled by -AllowPixelStreamingCommands=false)",t.classList="subtitle-text",t.id="warning-elem-encoder",document.getElementById("encoderSettingsHeader").appendChild(t)),console.warn("-AllowPixelStreamingCommands=false, sending console commands from browser to UE is disabled, including toggling FPS and changing encoder settings from the browser.")),i.PixelStreaming.DisableLatencyTest)&&(document.getElementById("test-latency-button").disabled=!0,document.getElementById("test-latency-button").title="Disabled by -PixelStreamingDisableLatencyTester=true",console.warn("-PixelStreamingDisableLatencyTester=true, requesting latency report from the the browser to UE is disabled.")),i.Encoder&&(document.getElementById("encoder-min-qp-text").value=i.Encoder.MinQP,document.getElementById("encoder-max-qp-text").value=i.Encoder.MaxQP),i.WebRTC)&&(document.getElementById("webrtc-fps-text").value=i.WebRTC.FPS,document.getElementById("webrtc-min-bitrate-text").value=i.WebRTC.MinBitrate/1e3,document.getElementById("webrtc-max-bitrate-text").value=i.WebRTC.MaxBitrate/1e3):s[0]==ToClientMessageType.FileExtension?function(e){this.file.receiving||(this.file.mimetype="",this.file.extension="",this.file.receiving=!0,this.file.valid=!1,this.file.size=0,this.file.data=[],this.file.timestampStart=(new Date).getTime(),console.log("Received first chunk of this.file")),e=new TextDecoder("utf-16").decode(e.slice(1)),console.log(e),this.file.extension=e}(s):s[0]==ToClientMessageType.FileMimeType?function(e){this.file.receiving||(this.file.mimetype="",this.file.extension="",this.file.receiving=!0,this.file.valid=!1,this.file.size=0,this.file.data=[],this.file.timestampStart=(new Date).getTime(),console.log("Received first chunk of this.file")),e=new TextDecoder("utf-16").decode(e.slice(1)),console.log(e),this.file.mimetype=e}(s):s[0]==ToClientMessageType.FileContents?function(e){var t;this.file.receiving&&(this.file.size=Math.ceil(new DataView(e.slice(1,5).buffer).getInt32(0,!0)/16379),e=e.slice(5),this.file.data.push(e),console.log(`Received this.file chunk: ${this.file.data.length}/`+this.file.size),this.file.data.length===this.file.size?(this.file.receiving=!1,this.file.valid=!0,console.log("Received complete this.file"),e=(new Date).getTime()-this.file.timestampStart,t=Math.round(16*this.file.size*1024/e),console.log(`Average transfer bitrate: ${t}kb/s over ${e/1e3} seconds`),t=new Blob(this.file.data,{type:this.file.mimetype}),(e=document.createElement("a")).setAttribute("href",URL.createObjectURL(t)),e.setAttribute("download","transfer."+this.file.extension),(t=$(e)).appendTo("body"),t.remove()):this.file.data.length>this.file.size&&(this.file.receiving=!1,console.error(`Received bigger this.file than advertised: ${this.file.data.length}/`+this.file.size)))}(s):s[0]==ToClientMessageType.Mouse?(t=new TextDecoder("utf-16").decode(e.slice(1)),this.eventHandler.dispatchMouseEvent(t)):s[0]==ToClientMessageType.Keyboard?(i=new TextDecoder("utf-16").decode(e.slice(1)),this.eventHandler.dispatchKeyboardEvent(i)):s[0]==ToClientMessageType.InputControlOwnership||s[0]==ToClientMessageType.Protocol?new TextDecoder("utf-16").decode(e.slice(1)):console.error("unrecognized data received, packet ID "+s[0])},this.eventHandler.registerInputs(this.webRtcPlayerObj.video),"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(e),this.webRtcPlayerObj.video}setupStats(){this.webRtcPlayerObj.aggregateStats(1e3);let y=3e5;this.webRtcPlayerObj.onAggregatedStats=e=>{var t=new Intl.NumberFormat(window.navigator.language,{maximumFractionDigits:0}),i=new Intl.NumberFormat(window.navigator.language,{maximumFractionDigits:0,minimumIntegerDigits:2});let s=(e.timestamp-e.timestampStart)/1e3;var a=[],o=[60,60];for(let e=0;e<o.length;e++)a.push(s%o[e]),s/=o[e];a.push(s);var n=a[0],r=Math.floor(a[1]),l=Math.floor([a[2]]);let h="B",d=e.hasOwnProperty("bytesReceived")?e.bytesReceived:0;var c=["kB","MB","GB"];for(let e=0;e<c.length&&!(d<1e5);e++)d/=1e3,h=c[e];e.receivedBytes=""+d+c;let u=document.getElementById("qualityStatus");function p(e){let t=e,i=1,s=setInterval(function(){i-=.1,u.style="opacity: "+Math.abs(2*(i-.5)),i<=.1&&(0==--t?clearInterval(s):i=1)},100/e)}let m="",g="lime";35<this.VideoEncoderQP?(g="red",p(2),m+=`<div style="color: ${g}">Very blocky encoding quality</div>`):26<this.VideoEncoderQP&&(g="orange",p(1),m+=`<div style="color: ${g}">Blocky encoding quality</div>`),u.className=g+"Status",m=(m=(m=(m=(m=(m=(m=(m=(m=(m=(m+=`<div>Duration: ${i.format(l)}:${i.format(r)}:${i.format(n)}</div>`)+`<div>Video Resolution: ${e.hasOwnProperty("frameWidth")&&e.frameWidth&&e.hasOwnProperty("frameHeight")&&e.frameHeight?e.frameWidth+"x"+e.frameHeight:"Chrome only"}</div>`)+`<div>Received (${h}): ${t.format(d)}</div>`)+`<div>Frames Decoded: ${e.hasOwnProperty("framesDecoded")?t.format(e.framesDecoded):"Chrome only"}</div>`)+`<div>Packets Lost: ${e.hasOwnProperty("packetsLost")?t.format(e.packetsLost):"Chrome only"}</div>`)+`<div>Framerate: ${e.hasOwnProperty("framerate")?t.format(e.framerate):"Chrome only"}</div>`)+`<div>Frames dropped: ${e.hasOwnProperty("framesDropped")?t.format(e.framesDropped):"Chrome only"}</div>`)+`<div>Net RTT (ms): ${e.hasOwnProperty("currentRoundTripTime")?t.format(1e3*e.currentRoundTripTime):"Can't calculate"}</div>`)+`<div>Browser receive to composite (ms): ${e.hasOwnProperty("receiveToCompositeMs")?t.format(e.receiveToCompositeMs):"Chrome only"}</div>`)+`<div style="color: ${g}">Bitrate (kbps): ${e.hasOwnProperty("bitrate")?t.format(e.bitrate):"Chrome only"}</div>`)+`<div style="color: ${g}">Video Quantization Parameter: ${this.VideoEncoderQP}</div>`,document.getElementById("stats").innerHTML=m,this.print_stats&&e.timestampStart&&e.timestamp-e.timestampStart>y&&(this.ws&&this.ws.readyState===WS_OPEN_STATE&&(console.log(`-> SS: stats
2
- `+JSON.stringify(e)),this.ws.send(JSON.stringify({type:"stats",data:e}))),y+=3e5),this.dispatchEvent({type:"aggregatedStats",data:e})},this.webRtcPlayerObj.latencyTestTimings.OnAllLatencyTimingsReady=function(i){if(i.BrowserReceiptTimeMs){var s=i.BrowserReceiptTimeMs-i.TestStartTimeMs,a=i.UEEncodeMs,o=i.UECaptureToSendMs,n=i.UETransmissionTimeMs-i.UEReceiptTimeMs,r=s-n;let e=null,t=null;i.FrameDisplayDeltaTimeMs&&i.BrowserReceiptTimeMs&&(e=i.FrameDisplayDeltaTimeMs+r+("string"==typeof o?0:o),t=i.FrameDisplayDeltaTimeMs+(s-r-n));s="",s=(s=(s=(s=(s=(s=(s+=`<div>Net latency RTT (ms): ${r.toFixed(2)}</div>`)+`<div>UE Encode (ms): ${"string"==typeof a?a:a.toFixed(2)}</div>`)+`<div>UE Send to capture (ms): ${"string"==typeof o?o:o.toFixed(2)}</div>`)+`<div>UE probe duration (ms): ${n.toFixed(2)}</div>`)+(i.FrameDisplayDeltaTimeMs&&i.BrowserReceiptTimeMs?`<div>Browser composite latency (ms): ${i.FrameDisplayDeltaTimeMs.toFixed(2)}</div>`:""))+(t?`<div>Total browser latency (ms): ${t.toFixed(2)}</div>`:""))+(e?`<div>Total latency (ms): ${e.toFixed(2)}</div>`:"");document.getElementById("LatencyStats").innerHTML=s}}}onWebRtcOffer(e){this.webRtcPlayerObj.receiveOffer(e),this.isShowTestUI&&this.setupStats()}onWebRtcAnswer(e){this.webRtcPlayerObj.receiveAnswer(e),this.isShowTestUI&&this.setupStats()}onWebRtcIce(e){this.webRtcPlayerObj&&this.webRtcPlayerObj.handleCandidateFromServer(e)}updateVideoStreamSize(){var e;this.matchViewportResolution&&(1e4<(new Date).getTime()-this.lastTimeResized?(e=document.getElementById("player"))&&(e={ConsoleCommand:"setres "+e.clientWidth+"x"+e.clientHeight},this.emitCommand(e),console.log(e),this.lastTimeResized=(new Date).getTime()):console.log("Resizing too often - skipping"))}emitDescriptor(t,e){var i=compress(e),s=49152;if(67108864<2*i.length)return console.error("数据量超出最大传输范围6.4MB!"),!1;if(2*i.length<s)return this.sendStringBufferData(t,i),!1;var a=Math.ceil(2*i.length/s);for(let e=0;e<a;e++){var o=i.slice(.5*e*s,24576*(e+1));this.sendStringBufferData(t,o,a,e+1)}}sendStringBufferData(e,t,i=1,s=1){var a=JSON.stringify({total:i,index:s,content:t}),o=new DataView(new ArrayBuffer(3+2*a.length));let n=0;o.setUint8(n,e),n++,o.setUint16(n,a.length,!0),n+=2;for(let e=0;e<a.length;e++)o.setUint16(n,a.charCodeAt(e),!0),n+=2;this.sendInputData(o.buffer)}emitUIInteraction(e){console.log(e),this.emitDescriptor(MessageType.UIInteraction,e)}emitCommand(e){this.emitDescriptor(MessageType.Command,e)}requestInitialSettings(){this.sendInputData(new Uint8Array([MessageType.RequestInitialSettings]).buffer)}requestQualityControl(){this.qualityController||this.sendInputData(new Uint8Array([MessageType.RequestQualityControl]).buffer)}setupNormalizeAndQuantize(){let s=document.getElementById("player");var e=s.getElementsByTagName("video");if(s&&0<e.length){var t=s.clientHeight/s.clientWidth,e=e[0].videoHeight/e[0].videoWidth;if(e<t){this.print_inputs&&console.log("Setup Normalize and Quantize for playerAspectRatio > videoAspectRatio");let i=t/e;this.normalizeAndQuantizeUnsigned=(e,t)=>{e/=s.clientWidth,t=i*(t/s.clientHeight-.5)+.5;return e<0||1<e||t<0||1<t?{inRange:!1,x:65535,y:65535}:{inRange:!0,x:65536*e,y:65536*t}},this.unquantizeAndDenormalizeUnsigned=(e,t)=>{e/=65536,t=(t/65536-.5)/i+.5;return{x:e*s.clientWidth,y:t*s.clientHeight}},this.normalizeAndQuantizeSigned=(e,t)=>{return{x:32767*(e/(.5*s.clientWidth)),y:32767*(i*t/(.5*s.clientHeight))}}}else{this.print_inputs&&console.log("Setup Normalize and Quantize for playerAspectRatio <= videoAspectRatio");let i=e/t;this.normalizeAndQuantizeUnsigned=(e,t)=>{e=i*(e/s.clientWidth-.5)+.5,t/=s.clientHeight;return e<0||1<e||t<0||1<t?{inRange:!1,x:65535,y:65535}:{inRange:!0,x:65536*e,y:65536*t}},this.unquantizeAndDenormalizeUnsigned=(e,t)=>{t/=65536;return{x:((e/65536-.5)/i+.5)*s.clientWidth,y:t*s.clientHeight}},this.normalizeAndQuantizeSigned=(e,t)=>{return{x:32767*(i*e/(.5*s.clientWidth)),y:32767*(t/(.5*s.clientHeight))}}}}}createOnScreenKeyboardHelpers(e){const t=this;null===document.getElementById("this.hiddenInput")&&(this.hiddenInput=document.createElement("input"),this.hiddenInput.id="this.hiddenInput",this.hiddenInput.maxLength=0,e.appendChild(this.hiddenInput)),null===document.getElementById("this.editTextButton")&&(this.editTextButton=document.createElement("button"),this.editTextButton.id="this.editTextButton",this.editTextButton.innerHTML="edit text",e.appendChild(this.editTextButton),this.editTextButton.classList.add("hiddenState"),this.editTextButton.addEventListener("click",function(){t.hiddenInput.focus()}))}showOnScreenKeyboard(e){e.showOnScreenKeyboard?(this.editTextButton.classList.remove("hiddenState"),e=this.unquantizeAndDenormalizeUnsigned(e.x,e.y),this.editTextButton.style.top=e.y.toString()+"px",this.editTextButton.style.left=(e.x-40).toString()+"px"):(this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur())}start(){var e=document.getElementById("qualityStatus"),e=(e&&(e.className="grey-status"),document.getElementById("stats"));e&&(e.innerHTML="Not connected"),!this.connect_on_load||this.is_reconnection?(this.showConnectOverlay(),this.eventHandler.invalidateFreezeFrameOverlay(),this.shouldShowPlayOverlay=!0,this.eventHandler.resizePlayerStyle()):(console.log("直接链接~~~~~~"),this.connect())}buildingGrowthAnimate(e){var{state:e="play",group:t=1,duration:i=3e3,startHeight:s=0,endHeight:a=100,loop:o=!1,easing:n="Linear",sliceColor:r={r:1,g:0,b:0},sliceBrightness:l=30,colorHeight:h=100}=e;this.emitUIInteraction({excuteName:InteractMOD.BUILD_GROWTHANIMATE,params:JSON.stringify({State:e,Group:t,Duration:i,StartHeight:s,EndHeight:a,Loop:o,Easing:n,SliceColor:r,SliceBrightness:l,ColorHeight:h})})}changeResolution(e,t){void 0===e||void 0===t?console.warn("传入的参数为空"):this.emitUIInteraction({excuteName:ApplicationControl.CONSOLE_COMMAND,params:{Command:"r.SetRes "+e+"x"+t}})}excuteEngineConsoleCommand(e){void 0===e?console.warn("传入的参数为空"):this.emitUIInteraction({excuteName:ApplicationControl.CONSOLE_COMMAND,params:{Command:e}})}Swtich3DTilesMode(e){var{mode:e,tilesName:t}=e;this.emitUIInteraction({excuteName:SceneControl.SWITCH_TERRAIN_MODE,params:{Mode:e,TilesName:t}})}enable3DTilesByName(e){var{enable:e=!0,tilesName:t}=e;this.emitUIInteraction({excuteName:SceneControl.ENABLE_3DTILES_BY_NAME,params:{Enable:e,TilesName:t}})}hidden3DTilesItem(e){let{hiddenList:t=[],tilesName:i}=e;Array.isArray(t)||(t=[]),this.emitUIInteraction({excuteName:SceneControl.HIDDEN_3DTILES_ITEM,params:{HiddenList:t,TilesName:i}})}changeWeather(e){console.warn("方法被移除,请使用UDS设置天气"),e&&this.UDS.changeWeather(e)}changeTime(e=8,t=10){console.warn("方法被移除,请使用UDS设置时间"),this.UDS.changeTime(e,t)}setWorldCenterPoint(e,t,i=10){if(void 0===e||void 0===t)return console.warn("传入的参数为空"),!1;this.emitUIInteraction({excuteName:ApplicationControl.RESET_WORLD_CENTER,params:{Center:{Latitude:MathUtils.clamp(e,-180,180),Longitude:MathUtils.clamp(t,-90,90),Altitude:MathUtils.clamp(i,-500,8848)}}})}moveTo(e,t={roll:0,pitch:0,yaw:0},i={duration:1,preload:!1,endLineDetect:!1,detectLength:5e4,flyOverLongitude:!1,zoom:-1,number:0,isGlobalMove:!1,globalCityCenter:null,callback:null}){if(!e)return!1;this.emitUIInteraction({excuteName:CameraControl.MOVE_TO,params:{Longitude:null==e?void 0:e.x,Latitude:null==e?void 0:e.y,Altitude:null==e?void 0:e.z,rotation:{Roll:null==t?void 0:t.roll,Pitch:null==t?void 0:t.pitch,Yaw:null==t?void 0:t.yaw},Duration:null==i?void 0:i.duration,Preload:null==i?void 0:i.preload,EndLineDetect:null==i?void 0:i.endLineDetect,DetectLength:null==i?void 0:i.detectLength,FlyOverLongitude:null==i?void 0:i.flyOverLongitude,Zoom:null==i?void 0:i.zoom,Number:null==i?void 0:i.number,IsGlobalMove:null==i?void 0:i.isGlobalMove,GlobalCityCenter:null==i?void 0:i.globalCityCenter}}),null!=i&&i.callback&&this.camera.addEventListener("moveTo",i.callback)}moveCamera(e){var{multiplier:e=1,x:t=0,y:i=0}=e;this.emitUIInteraction({excuteName:CameraControl.MOVE,params:{Multiplier:e,ActionValue:{x:t,y:i}}})}rotateCamera(e){var{multiplier:e=1,yaw:t=0,pitch:i=0}=e;this.emitUIInteraction({excuteName:CameraControl.ROTATE,params:{Multiplier:e,ActionValue:{x:t,y:i}}})}zoomIn(e=1){this.emitUIInteraction({excuteName:CameraControl.ZOOM_IN,params:{Multiplier:e}})}zoomOut(e=1){this.emitUIInteraction({excuteName:CameraControl.ZOOM_OUT,params:{Multiplier:e}})}focusOn(e,t={duration:1,index:-1,preload:!1,rotation:{roll:0,pitch:0,yaw:0},flyOverLongitude:!1,callback:null}){if(!e)return!1;this.emitUIInteraction({excuteName:CameraControl.FOCUS_ON,params:{uuid:null==e?void 0:e.uuid,type:null==e?void 0:e.type,rotation:{Roll:null==t||null==(e=t.rotation)?void 0:e.roll,Pitch:null==t||null==(e=t.rotation)?void 0:e.pitch,Yaw:null==t||null==(e=t.rotation)?void 0:e.yaw},Duration:null==t?void 0:t.duration,Preload:null==t?void 0:t.preload,Index:null==t?void 0:t.index,FlyOverLongitude:null==t?void 0:t.flyOverLongitude}}),null!=t&&t.callback&&this.camera.addEventListener("focusOn",t.callback)}navigateByKeypoints(i,e={}){const{lockAll:t=!0,speed:s=36,time:a=0,ignoreLag:o=!1,name:n="",patrolType:r="default",followRotation:l={Roll:!1,Pitch:!1,Yaw:!1},finishDestory:h=!0,rayDetectionDistance:d=1e3,callback:c=null,startCallback:u=null,finishCallback:p=null}=e;if(!i||i.length<2)return!1;u&&this.camera.addEventListener("navigationStart",u);const m=[];for(let e=0,t=i.length;e<t;e++){var g=i[e];m.push(g[0],g[1],g[2]||10,g[3]||0,g[4]||0,g[5]||0)}setTimeout(()=>{this.emitUIInteraction({excuteName:CameraControl.NAVIGATION,params:JSON.stringify({jsondata:m,Speed:s,Name:n,Time:a,IgnoreLag:o,LockAll:t,PatrolType:r,FollowRotation:l,RayDetectionDistance:d,FinishDestory:h})})},100),(p||c)&&(p?this.camera.addEventListener("navigationFinish",p):this.camera.addEventListener("navigationFinish",c))}pauseNavigation(e={}){var{patrolType:e="default"}=e;this.emitUIInteraction({excuteName:CameraControl.NAVIGATION_PAUSE,params:{State:0,PatrolType:e}})}resumeNavigation(e={}){var{patrolType:e="default"}=e;this.emitUIInteraction({excuteName:CameraControl.NAVIGATION_PAUSE,params:{State:1,PatrolType:e}})}stopNavigation(e={}){const{patrolType:t="default",delayTime:i=100}=e;setTimeout(()=>{this.emitUIInteraction({excuteName:CameraControl.NAVIGATION_STOP,params:{PatrolType:t}})},i)}enableDataLayerByName(e,t){this.emitUIInteraction({excuteName:InteractMOD.ENABLE_DATALAYER,params:{Visible:t,DataLayerName:e}})}project(e,t){if(!e)return!1;this.emitUIInteraction({excuteName:CameraControl.PROJECT,params:{Position:{x:e.x,y:e.y,z:e.z}}}),this.camera.addEventListener("project",t)}unproject(e,t){if(!e)return!1;this.emitUIInteraction({excuteName:CameraControl.UNPROJECT,params:{Position:{x:e.x,y:e.y}}}),this.camera.addEventListener("unproject",t)}getAltitudeFromCoordinate(e,t){if(!e)return!1;const i={Coordinate:e.coordinate,DetectLength:e.detectLength||100};this.addEventListener("getAltitude",t),setTimeout(()=>{this.emitUIInteraction({excuteName:SceneControl.GET_ALTITUDE,params:i})},100)}exit(){this.emitUIInteraction({excuteName:ApplicationControl.EXIT_CLIENT})}restartLevel(){return!1}restartGame(){this.emitUIInteraction({excuteName:ApplicationControl.RESTART_GAME}),this.dispatchEvent({type:"gameResarted"})}addToScene(e){e&&(this.scene.add(e),e.materialNeedsUpdate=!1,e.matrixNeedsUpdate=!1,e.animateNeedsUpdate=!1,"TrafficLayer"===e.type?this.emitUIInteraction({excuteName:ApplicationControl.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?this.emitUIInteraction({excuteName:SceneControl.EVENT_LAYER_BUILDING,params:e.toJSON(!1)}):"SlopeAnalysis"===e.type?this.emitUIInteraction({excuteName:SceneControl.UPDATA_SLOPE_ANALYSIS,params:e.toJSON()}):this.emitUIInteraction({excuteName:GisControl.ADD,params:e.toJSON(!1)}))}removeFromScene(e){this.destoryObject(e)}removeAllFromScene(){this.emitUIInteraction({excuteName:GisControl.DESTORY_ALL}),this.scene.clear()}destoryObject(e){e&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:ApplicationControl.CLOSE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?(e.buildingState="destory",this.emitUIInteraction({excuteName:SceneControl.EVENT_LAYER_BUILDING,params:e.toJSON(!1)})):this.emitUIInteraction({excuteName:GisControl.DESTORY,uuid:e.uuid}),e.dispose&&e.dispose(),this.scene.remove(e))}enableEdit(e,t,i){let s=null,a={};if(this.drawAndMeasureGroup||(this.drawAndMeasureGroup=new Group,this.scene.add(this.drawAndMeasureGroup)),"measure"===e)switch(this.editMode="measure",s=DrawAndMeasureControl.ENABLE_MEASURE,t.toLowerCase()){case"polygon":case"measurearea":this.drawAndMeasureGroup.measureArea?this.drawAndMeasureGroup.measureArea.updateParameters(i):(o=new MeasureArea(i),this.drawAndMeasureGroup.measureArea=o,this.drawAndMeasureGroup.add(o)),a=this.drawAndMeasureGroup.measureArea.toJSON();break;case"line":case"measureline":this.drawAndMeasureGroup.measureLine?this.drawAndMeasureGroup.measureLine.updateParameters(i):(o=new MeasureLine(i),this.drawAndMeasureGroup.measureLine=o,this.drawAndMeasureGroup.add(o)),a=this.drawAndMeasureGroup.measureLine.toJSON();break;case"surfaceline":this.drawAndMeasureGroup.surfaceline?this.drawAndMeasureGroup.surfaceline.updateParameters(i):(o=new SurfaceLine(i),this.drawAndMeasureGroup.surfaceline=o,this.drawAndMeasureGroup.add(o)),a=this.drawAndMeasureGroup.surfaceline.toJSON();break;default:var o;this.drawAndMeasureGroup.locationPoint?this.drawAndMeasureGroup.locationPoint.updateParameters(i):(o=new LocationPoint(i),this.drawAndMeasureGroup.locationPoint=o,this.drawAndMeasureGroup.add(o)),a=this.drawAndMeasureGroup.locationPoint.toJSON()}else switch(this.editMode="draw",s=DrawAndMeasureControl.ENABLE_DRAW,t){case"polygon":if(this.drawAndMeasureGroup.polygon)for(const r in i)this.drawAndMeasureGroup.polygon[r]!==i[r]&&(this.drawAndMeasureGroup.polygon[r]=i[r]);else{var n=new Polygon(i);this.drawAndMeasureGroup.polygon=n,this.drawAndMeasureGroup.add(n)}a=this.drawAndMeasureGroup.polygon.toJSON();break;case"line":if(this.drawAndMeasureGroup.line)for(const l in i)this.drawAndMeasureGroup.line[l]!==i[l]&&(this.drawAndMeasureGroup.line[l]=i[l]);else{n=new Line(i);this.drawAndMeasureGroup.line=n,this.drawAndMeasureGroup.add(n)}a=this.drawAndMeasureGroup.line.toJSON();break;default:if(this.drawAndMeasureGroup.point)for(const h in i)this.drawAndMeasureGroup.point[h]!==i[h]&&(this.drawAndMeasureGroup.point[h]=i[h]);else{n=new Point(i);this.drawAndMeasureGroup.point=n,this.drawAndMeasureGroup.add(n)}a=this.drawAndMeasureGroup.point.toJSON()}this.emitUIInteraction({ExcuteName:s,params:a})}closeEdit(){if(this.editMode){let e=DrawAndMeasureControl.CLOSE_DRAW;"measure"===this.editMode&&(e=DrawAndMeasureControl.CLOSE_MEASURE),this.emitUIInteraction({ExcuteName:e})}}setFPS(e=!1){this.emitUIInteraction({ExcuteName:InteractMOD.ENABLE_FPS,params:{state:e}})}removeAllEditObjects(e="all",t=["point","line","polygon","surfaceline"]){if(this.drawAndMeasureGroup&&!(this.drawAndMeasureGroup.children.length<1)){var i=[];if(e)switch(e){case"draw":-1<(t=!Array.isArray(t)||t.length<1?["point","line","polygon"]:t).indexOf("polygon")&&this.drawAndMeasureGroup.polygon&&(i.push(this.drawAndMeasureGroup.polygon.uuid),this.drawAndMeasureGroup.polygon.removeFromParent(),this.drawAndMeasureGroup.polygon=null),-1<t.indexOf("line")&&this.drawAndMeasureGroup.line&&(i.push(this.drawAndMeasureGroup.line.uuid),this.drawAndMeasureGroup.line.removeFromParent(),this.drawAndMeasureGroup.line=null),-1<t.indexOf("point")&&this.drawAndMeasureGroup.point&&(i.push(this.drawAndMeasureGroup.point.uuid),this.drawAndMeasureGroup.point.removeFromParent(),this.drawAndMeasureGroup.point=null),this.emitUIInteraction({ExcuteName:DrawAndMeasureControl.DESTORY_DRAW,params:{uuids:i,Classes:t}});break;case"measure":var s=(t=!Array.isArray(t)||t.length<1?["point","line","polygon","surfaceline"]:t).indexOf("polygon");-1<s&&(t.splice(s,1),t.push("MeasureArea")),-1<s&&this.drawAndMeasureGroup.measureArea&&(i.push(this.drawAndMeasureGroup.measureArea.uuid),this.drawAndMeasureGroup.measureArea.removeFromParent(),this.drawAndMeasureGroup.measureArea=null),-1<(s=t.indexOf("line"))&&(t.splice(s,1),t.push("MeasureLine")),-1<s&&this.drawAndMeasureGroup.measureLine&&(i.push(this.drawAndMeasureGroup.measureLine.uuid),this.drawAndMeasureGroup.measureLine.removeFromParent(),this.drawAndMeasureGroup.measureLine=null),-1<(s=t.indexOf("point"))&&(t.splice(s,1),t.push("LocationPoint")),-1<s&&this.drawAndMeasureGroup.locationPoint&&(i.push(this.drawAndMeasureGroup.locationPoint.uuid),this.drawAndMeasureGroup.locationPoint.removeFromParent(),this.drawAndMeasureGroup.locationPoint=null),-1<(s=t.indexOf("surfaceline"))&&(t.splice(s,1),t.push("SurfaceLine")),-1<s&&this.drawAndMeasureGroup.surfaceline&&(i.push(this.drawAndMeasureGroup.surfaceline.uuid),this.drawAndMeasureGroup.surfaceline.removeFromParent(),this.drawAndMeasureGroup.surfaceline=null),this.emitUIInteraction({ExcuteName:DrawAndMeasureControl.DESTORY_MEASURE,params:{uuids:i,Classes:t}});break;case"all":this.emitUIInteraction({ExcuteName:DrawAndMeasureControl.DESTORY_DRAW,params:{uuids:i,Classes:["Point","Line","Polygon"]}}),this.emitUIInteraction({ExcuteName:DrawAndMeasureControl.DESTORY_MEASURE,params:{uuids:i,Classes:["MeasureArea","MeasureLine","LocationPoint","SurfaceLine"]}}),this.drawAndMeasureGroup.children=[],this.scene.remove(this.drawAndMeasureGroup),this.drawAndMeasureGroup=null}}}connect(){const t=this,i=e=>{window.WebSocket=window.WebSocket||window.MozWebSocket,window.WebSocket?(t.reclickToStart&&clearTimeout(t.reclickToStart),t.ws=new WebSocket(e),t.ws.onmessage=function(e){t.connected||(t.dispatchEvent({type:"connected"}),t.connected=!0);e=JSON.parse(e.data);"config"===e.type?(console.log("%c[Inbound SS (config)]","background: lightblue; color: black",e),t.onConfig(e)):"playerCount"===e.type?console.log("%c[Inbound SS (playerCount)]","background: lightblue; color: black",e):"offer"===e.type?(console.log("%c[Inbound SS (offer)]","background: lightblue; color: black",e),t.onWebRtcOffer(e)):"answer"===e.type?(console.log("%c[Inbound SS (answer)]","background: lightblue; color: black",e),t.onWebRtcAnswer(e)):"iceCandidate"===e.type?t.onWebRtcIce(e.candidate):"warning"===e.type&&e.warning?console.warn(e.warning):"pong"===e.type?console.log("pong",e.time):console.error("Invalid SS message type",e.type)},t.ws.onerror=function(e){console.log("WS error: "+JSON.stringify(e))},t.ws.onclose=function(e){console.log(`WS closed: ${JSON.stringify(e.code)} - `+e.reason),t.ws=void 0,t.is_reconnection=!0,t.connected&&(t.dispatchEvent({type:"disconnected"}),t.connected=!1);e=document.getElementById("player");t.webRtcPlayerObj&&(e.removeChild(t.webRtcPlayerObj.video),t.webRtcPlayerObj.close(),t.webRtcPlayerObj=void 0),t.showTextOverlay("云渲染服务未正常连接"),t.reclickToStart=setTimeout(()=>{t.connect()},4e3)}):alert("Your browser doesn't support WebSocket")};var e;return t.wsURL||this.projectName?t.wsURL||this.matchmakerIP?void(t.wsURL?i(t.wsURL):(e=`http://${this.matchmakerIP}:${this.matchmakerPort}/gpuserver?project=`+this.projectName,axios.get(e).then(e=>{if(e.data&&e.data.error)return console.error(e.data.error),!1;e=`ws://${e.data.gpuServer}:`+e.data.port;i(e)}).catch(e=>{console.error(e)}))):(console.error("Needs a matchmaker's IP"),!1):(console.error("Needs a projectName"),!1)}onConfig(e){var t=document.getElementById("player"),i=this.setupWebRtcPlayer(t,e);switch(this.eventHandler.resizePlayerStyle(),this.inputOptions.controlScheme){case ControlSchemeType.HoveringMouse:this.eventHandler.registerHoveringMouseEvents(i);break;case ControlSchemeType.LockedMouse:this.eventHandler.registerLockedMouseEvents(i);break;default:console.log("ERROR: Unknown control scheme "+this.inputOptions.controlScheme),this.eventHandler.registerLockedMouseEvents(i)}}setupModelInfo(e,t,i,s){if(!e)return!1;var a,o;s||(o=(o=(a=e.split("://"))[1].split("/")[0]).includes(":")?o.split(":")[0]:o,s=a[0]+`://${o}/twin/assetApi/getStaticResourceUrl`),t=t||{all:1,common:1,project_id:"418690084255052706"},this.emitUIInteraction({excuteName:InteractMOD.ASSET_MODEL,params:{ModInfoUrl:e,StaticResourceURL:s,ModInfoBody:t,ModInfoHeader:i}})}initOthers(){this.initCamera(),document.addEventListener("keydown",e=>{(116===e.keyCode||e.ctrlKey&&82===e.keyCode)&&(window._frash_=!0)}),window.onbeforeunload=()=>{this.levelReady||window._frash_||(this.levelReady=!0),window._frash_=!1}}load(){this.eventHandler.setupHtmlEvents(),this.eventHandler.setupFreezeFrameOverlay(),this.eventHandler.registerKeyboardEvents(),this.start(),animate((new Date).getTime())}}function animate(){rAF(animate),update()}class ODLine extends Shape{constructor(e={}){super(e),this.parameters=e,this.renderNum=void 0===e.renderNum?20:e.renderNum,this.visible=void 0===e.visible||e.visible;let t=e.width||1,i=e.circleScale||50,s=void 0!==e.startHide&&e.startHide,a=void 0!==e.endHide&&e.endHide,o=e.speed||.5,n=e.opacity||.02,r=e.brightness||100,l=e.angle||40;this.type="ODLine",Object.defineProperties(this,{angle:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},width:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},circleScale:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},startHide:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},endHide:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}},speed:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},opacity:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},brightness:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=getUELineData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Angle:this.angle,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Width:this.width,CircleScale:this.circleScale,StartHide:this.startHide,EndHide:this.endHide,Speed:this.speed,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,RenderNum:this.renderNum}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.width=e.width,this.circleScale=e.circleScale,this.speed=e.speed,this.startHide=e.startHide,this.endHide=e.endHide,super.copy(e,t),this}}function getFinalFaceType(e){switch(e){case 0:return"DoNotFcaeToCamera";case 1:return"FacetoCamera_XYZ";case 2:return"FacetoCamera_Y";case 3:return"FacetoCamera_Z";default:return"FacetoCamera_XYZ"}}class IconPoint extends Shape{constructor(e={}){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum;let t=e.pivot||{x:.5,y:.5},i=(this.visible=void 0===e.visible||e.visible,this.isGlobalPOI=void 0!==e.isGlobalPOI&&e.isGlobalPOI,e.text||null),s=e.iconUrl||"",a=e.texture||"",o=e.width||32,n=e.height||32,r=e.iconPathName||"",l=void 0===e.hideText||e.hideText,h=void 0!==e.hideImage&&e.hideImage,d=e.renderScale||1,c=(this.renderType=e.renderType||0,this.openCollision=void 0!==e.openCollision&&e.openCollision,0===e.faceType?0:e.faceType||1),u=void 0!==e.switchScale&&e.switchScale,p=e.minScale||0,m=e.maxScale||0,g=e.fontSize||12;this.fadeIn=void 0===e.fadeIn||e.fadeIn,this.type="IconPoint",Object.defineProperties(this,{pivot:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},text:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},iconUrl:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},texture:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}},width:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},height:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},faceType:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{c=e,this.materialNeedsUpdate=!0}},switchScale:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{u=e,this.materialNeedsUpdate=!0}},minScale:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{p=e,this.materialNeedsUpdate=!0}},maxScale:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{m=e,this.materialNeedsUpdate=!0}},iconPathName:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},hideText:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},hideImage:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=e,this.materialNeedsUpdate=!0}},renderScale:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}},fontSize:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{g=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Pivot:this.pivot,Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,IconUrl:this.iconUrl,Width:this.width,Height:this.height,IconPathName:this.iconPathName,IsGlobalPOI:this.isGlobalPOI,HideText:this.hideText,HideImage:this.hideImage,RenderScale:this.renderScale,FontSize:this.fontSize,RenderType:this.renderType,FadeIn:this.fadeIn,OpenCollision:this.openCollision,FaceType:getFinalFaceType(this.faceType),SwitchScale:this.switchScale,MaxScale:this.maxScale,MinScale:this.minScale,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,Size:this.size,SizeAttenuation:this.sizeAttenuation,RenderNum:this.renderNum}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},FadeIn:this.fadeIn,type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.iconUrl=e.iconUrl,this.width=e.width,this.height=e.height,this.iconPathName=e.iconPathName,this.hideText=e.hideText,this.hideImage=e.hideImage,this.renderScale=e.renderScale,this.fontSize=e.fontSize,super.copy(e,t),this}}class TextPoint extends Shape{constructor(e={}){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum,this.visible=void 0===e.visible||e.visible,this.isGlobalPOI=void 0!==e.isGlobalPOI&&e.isGlobalPOI;let t=e.backgroundColor||{r:0,g:0,b:0,a:0},i=e.backgroundImage||"",s=this.getMargin(e.margin)||{Top:0,Right:0,Bottom:0,Left:0},a=e.fontSize||24,o=e.fontWeight||"Regular",n=e.borderWidth||0,r=e.borderColor||{r:0,g:0,b:0,a:1},l=e.shadowColor||{r:0,g:0,b:0,a:1},h=e.shadowOffset||{x:0,y:0},d=e.pivot||{x:.5,y:.5},c=(this.renderType=e.renderType||0,this.fadeIn=void 0===e.fadeIn||e.fadeIn,this.openCollision=void 0!==e.openCollision&&e.openCollision,0===e.faceType?0:e.faceType||1),u=void 0!==e.switchScale&&e.switchScale,p=e.minDistance||0,m=e.maxDistance||0,g=void 0===e.minScale?1:e.minScale,y=void 0===e.maxScale?1:e.maxScale;this.autoWrap=e.autoWrap||!1,this.type="TextPoint",Object.defineProperties(this,{backgroundImage:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},backgroundColor:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},margin:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=this.getMargin(e),this.materialNeedsUpdate=!0}},fontSize:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}},fontWeight:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},borderWidth:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},borderColor:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},shadowColor:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},shadowOffset:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=e,this.materialNeedsUpdate=!0}},pivot:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}},faceType:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{c=e,this.materialNeedsUpdate=!0}},switchScale:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{u=e,this.materialNeedsUpdate=!0}},minDistance:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{p=e,this.materialNeedsUpdate=!0}},maxDistance:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{m=e,this.materialNeedsUpdate=!0}},minScale:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{g=e,this.materialNeedsUpdate=!0}},maxScale:{configurable:!0,enumerable:!0,get:()=>y,set:e=>{y=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=getUEPointData(e)}getMargin(e){let t;if(Array.isArray(e))return e.length<2?t={Top:e[0]||0,Right:e[0]||0,Bottom:e[0]||0,Left:e[0]||0}:e.length<3?t={Top:e[0]||0,Right:e[1]||0,Bottom:e[0]||0,Left:e[1]||0}:e.length<4?t={Top:e[0]||0,Right:e[1]||0,Bottom:e[2]||0,Left:e[1]||0}:e.length<5&&(t={Top:e[0]||0,Right:e[1]||0,Bottom:e[2]||0,Left:e[3]||0}),t}toJSON(e=!0){return e&&this.visibleNeedsUpdate&&!this.materialNeedsUpdate?{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,FadeIn:this.fadeIn,type:this.type,name:this.name,uuid:this.uuid}:{Pivot:this.pivot,Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},BackgroundColor:{r:this.backgroundColor.r,g:this.backgroundColor.g,b:this.backgroundColor.b,a:this.backgroundColor.a},BackgroundImageURL:this.backgroundImage,IsGlobalPOI:this.isGlobalPOI,Margin:this.margin,AutoWrap:this.autoWrap,Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,FontWeight:this.fontWeight,FontSize:this.fontSize,BorderWidth:this.borderWidth,BorderColor:this.borderColor,ShadowColor:this.shadowColor,ShadowOffset:this.shadowOffset,RenderType:this.renderType,FadeIn:this.fadeIn,OpenCollision:this.openCollision,FaceType:getFinalFaceType(this.faceType),SwitchScale:this.switchScale,MinDistance:this.minDistance,MaxDistance:this.maxDistance,MaxScale:this.maxScale,MinScale:this.minScale,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,RenderNum:this.renderNum}}copy(e,t=!0){return this.fontWeight=e.fontWeight,this.fontSize=e.fontSize,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.shadowColor=e.shadowColor,this.shadowOffset=e.shadowOffset,super.copy(e,t),this}}function setLabelScale(s,e){var t,i,a,o,n,r={};return Object.assign(r,e),r.style&&({width:e,height:t,borderRadius:i,borderWidth:a,paddingTop:o,paddingLeft:n}=r.style,r.style.width=e*s,r.style.height=t*s,i&&(r.style.borderRadius=i*s),a&&(r.style.borderWidth=a*s),o&&(r.style.paddingTop=o*s),n)&&(r.style.paddingLeft=n*s),r.content&&r.content.forEach(e=>{for(var t in e)"number"==typeof e[t]&&"id"!==t&&(e[t]=e[t]*s);var i=e["position"];i&&(e.position=i.map(e=>e*s)),e.textList&&e.textList.forEach(e=>{e.fontSize=e.fontSize*s,e.position=e.position.map(e=>e*s)})}),r}class BasicLabel extends Shape{constructor(e){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum,this.name=e.name||"",this.pivot=e.pivot||{x:.5,y:.5},this.offset=e.offset||{x:0,y:0,z:0},this.sizeAttenuation=e.sizeAttenuation||!1,this.constructionConfig=e.constructionConfig||{},this.labelType=e.labelType||"sprite",this.hideText=e.hideText||!1,this.faceType=0===e.faceType?0:e.faceType||1,this.switchScale=e.switchScale||!1,this.renderType=e.renderType||0;let t=e.renderScale||.3,i=(this.minScale=e.minScale||1,this.maxScale=e.maxScale||1,this.type="IconPoint",this.visible=void 0===e.visible||e.visible,this.fadeIn=void 0===e.fadeIn||e.fadeIn,e);"mesh"!==this.labelType&&!this.sizeAttenuation||(i=setLabelScale(t,e)),this.style=i.style,this.drawCanvas=document.createElement("canvas"),this.animationCanvas=document.createElement("canvas"),this.mainView=null,this.sprite=null,this.texture=null,this.animateId=null,this.size=e.size||20,this.extraProps={args:e},i.style?(this.init(i).then(()=>{this.materialNeedsUpdate=!0}),Object.defineProperties(this,{renderScale:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}}})):console.warn("请正确设置BasicLabel的style")}async init(e={}){var{}=this.style,t=(this.mainView=document.createElement("canvas"),await BasicLabel.initBackGround(this.style,this.mainView));this.drawCanvas.width=this.animationCanvas.width=t.width,this.drawCanvas.height=this.animationCanvas.height=t.height,this.factor=t.factor,this.width=t.width,this.height=t.height,this.dispatchEvent({type:"loaded",label:this}),e.content&&await this.drawContent(e.content,!0)}async drawContent(e,t=!1){t||"mesh"!==this.labelType&&!this.sizeAttenuation||(e=setLabelScale(this.renderScale,{content:e}).content);var t=this.drawCanvas.getContext("2d"),{width:i,height:s}=this.drawCanvas;t.clearRect(0,0,i,s),t.drawImage(this.mainView,0,0,i,s),await BasicLabel.renderContent(this.style,e,this.drawCanvas,this.factor),this.texture=convertCanvas2Base64(this.drawCanvas),this.dispatchEvent({type:"contentLoaded",label:this})}updateContent(e={}){let t=e;"mesh"!==this.labelType&&!this.sizeAttenuation||(t=setLabelScale(this.renderScale,e)),this.extraProps={args:e},t.style&&(this.style=t.style),this.init(t).then(()=>{this.materialNeedsUpdate=!0})}getFinalFaceType(e){if(e)switch(e){case 0:return"DoNotFcaeToCamera";case 1:return"FacetoCamera_XYZ";case 2:return"FacetoCamera_Y";case 3:return"FacetoCamera_Z";default:return"FacetoCamera_XYZ"}return"FacetoCamera_XYZ"}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Pivot:this.pivot,Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,HideText:this.hideText,RenderType:this.renderType,FadeIn:this.fadeIn,OpenCollision:this.openCollision,FaceType:this.getFinalFaceType(this.faceType),SwitchScale:this.switchScale,MaxScale:this.maxScale,MinScale:this.minScale,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:1,y:1,z:1},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Width:this.width,Height:this.height,RenderScale:this.renderScale,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,Size:this.size,SizeAttenuation:this.sizeAttenuation,RenderNum:this.renderNum}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},FadeIn:this.fadeIn,type:this.type,name:this.name,uuid:this.uuid}}dispose(){this.children=[],this.sprite=null,this.texture=null,this.drawCanvas=null,this.animationCanvas=null,this.mainView=null}static async initBackGround(e,t){var{height:e,width:i,backgroundImage:s,borderRadius:a,borderColor:o,borderWidth:n,backgroundColor:r,clip:l}=e,h=t.getContext("2d"),d=MathUtils.ceilPowerOfTwo(i),d={width:d,height:d*(e/i),factor:{xScale:d/i,yScale:d/i}},{xScale:t,yScale:c}=(t.width=d.width,t.height=d.height,d.factor);return s?(s=await BasicLabel.loadImg(s,""),h.drawImage(s,0,0,i*t,e*c)):(o||r)&&(h.strokeStyle=o,h.fillStyle=r,h.lineWidth=n?n*t:+t,BasicLabel.roundRect(h,h.lineWidth*t,h.lineWidth*c,(i-2*h.lineWidth)*t,(e-2*h.lineWidth)*c,a?a*t:0),r&&h.fill(),o)&&h.stroke(),l&&([s,n,a,r]=l,h.beginPath(),h.moveTo(r*i*t,s*e*c),h.lineTo((1-n)*i*t,s*e*c),h.lineTo((1-n)*i*t,(1-a)*e*c),h.lineTo(r*i*t,(1-a)*e*c),h.lineTo(r*i*t,s*e*c),h.closePath(),h.clip()),d}static async renderContent(t,i,e,s){const a=e.getContext("2d");var{width:o,height:n}=e,{paddingTop:e,paddingLeft:r}=t;let l=0,h=0,d=0,c=0;const{xScale:u,yScale:p}=s;var m=r?r*u:0,g=e?e*p:0;const y=[m,g];var f=[];for(let e=0;e<i.length;e++){var{width:b,height:x,textList:v,marginRight:S,marginBottom:C,backgroundImage:U,borderRadius:N,borderColor:w,borderWidth:T,backgroundColor:O,position:M,id:z,activeInfo:E={}}=i[e];if(M&&([M,A]=M,y[0]=m+M*u,y[1]=g+A*p,l=0,h=0,d=0,c=0),b&&x){if(y[0]+b*u>o&&((d+=l)+x*p<=h?(y[0]=c,y[1]+=l):(y[0]=r?r*u:0,y[1]+=l,h=0,c=0)),U)try{var R=await BasicLabel.loadImg(U,"");a.drawImage(R,y[0],y[1],b*u,x*p)}catch(e){console.warn(e)}else O&&(a.strokeStyle=w,a.fillStyle=O,a.lineWidth=T?T*u:+u,BasicLabel.roundRect(a,y[0]+a.lineWidth*u,y[1]+a.lineWidth*u,(b-2*a.lineWidth)*u,(x-2*a.lineWidth)*p,N?N*u:0),O&&a.fill(),w)&&a.stroke();v&&v.forEach(e=>{var[t,i]=e.position,t=[y[0]+t*u,y[1]+i*p];BasicLabel.drawText(a,e,s,t)});var M=y[0]===(r?r*u:0)*u?-.16:-1.3,A=-(n-y[1]-25*p)*(2.05/(107*p))+.1;if(z){const{position:I,style:t={width:5,height:.95}}=E;U=BasicLabel.addActiveArea(I||{x:M,y:A},t);U.customId=z,f.push(U)}y[0]+=(b+(S||0))*u,(l=(x+(C||0))*p)>h&&(h=l,c=y[0])}else v&&v.forEach(e=>{var[t,i]=e.position,t=[y[0]+t*u,y[1]+i*p];BasicLabel.drawText(a,e,s,t)})}return f}static getRectangle(e,t,i,s={}){i=new MeshBasicMaterial({map:i,transparent:!0,fog:!0,depthWrite:!1,...s}),i.map&&(i.map.needsUpdate=!0),i.transparent=!0,s=(.01*e).toFixed(2),e=(.01*t).toFixed(2),t=new PlaneBufferGeometry(Number(s),Number(e),1,1),t=new Mesh(t,i);return t.setWidth=s,t.setHeight=e,t}static loadImg(e,t=""){const i=new Image;return i.crossOrigin="Anonymous",i.src=t+e,new Promise((e,t)=>{i.addEventListener("load",()=>{e(i)}),i.onerror=e=>{t(e)}})}static getTextWidth(e,t){var{fontSize:t,fontFamily:i,color:s,text:a}=t,e=e.getContext("2d"),t=(e.font=t+"px "+i,e.fillStyle=s,e.textAlign="left",e.measureText(a).width);return t}static drawText(e,t,i,s){var i=i["xScale"],[s,a]=s,{text:t,fontSize:o,fontFamily:n,color:r,textAlign:l,icon:h}=t;let d;if(t||"number"==typeof t||h)if(t&&h)console.warn("BasicLabel Warning:text和icon不要同时设置");else{if(d=t,e.font=o*i+"px "+n,e.fillStyle=r,e.textAlign=l||"left",e.textBaseline="top",h){let e=h;-1!==h.indexOf("&amp;")&&(e=h.replace("&amp;","&")),-1!==h.indexOf("&amp")&&(e=h.replace("&amp","&")),d=new Function('return ("'+(""+e).replace("&#x","\\u").replace(";","")+'")')()}e.measureText(d).width;e.fillText(d,s,a)}}static addActiveArea(e,t){var{width:t,height:i}=t,{x:e,y:s}=e,a=new SpriteMaterial({depthTest:!0,depthWrite:!1,transparent:!0,sizeAttenuation:!0,opacity:0}),a=new Sprite(a);return a.scale.set(t,i,1),a.material.color=new Color$1("#58d2d4"),a.center.set(e,s),a}static roundRect(e,t,i,s,a,o){e.beginPath(),e.moveTo(t+o,i),e.lineTo(t+s-o,i),e.quadraticCurveTo(t+s,i,t+s,i+o),e.lineTo(t+s,i+a-o),e.quadraticCurveTo(t+s,i+a,t+s-o,i+a),e.lineTo(t+o,i+a),e.quadraticCurveTo(t,i+a,t,i+a-o),e.lineTo(t,i+o),e.quadraticCurveTo(t,i,t+o,i),e.closePath()}}class Cone extends Shape{constructor(e){super(e),this.type="Cone"}}class FlashCar extends Shape{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashCar"}}class FlashCarCrash extends Shape{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashCarCrash"}}class FlashPeople extends Shape{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashPeople"}}class Cylinder extends Shape{constructor(e){super(e),this.type="Cylinder"}}class Decal extends Shape{constructor(e){super(e),this.type="Decal"}toJSON(e=!0){var t,i,s,a;return this.animateJson&&({From:a,To:t}=this.animateJson,a&&a.scale&&({x:i,z:s}=a.scale,a.scale.x=s,a.scale.z=i),t)&&t.scale&&({x:s,z:a}=t.scale,t.scale.x=a,t.scale.z=s),!this.visibleNeedsUpdate||!e||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Scroll:this.scroll,Speed:this.speed,Texture:this.texture,GardientDirection:this.gardientDirection,Color2:{r:this.color2.r,g:this.color2.g,b:this.color2.b,a:this.opacity},BrightnessColor:this.brightnessColor?{r:this.brightnessColor.r,g:this.brightnessColor.g,b:this.brightnessColor.b,a:1}:Color,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.z,y:this.scale.y,z:this.scale.x},Rotation:{x:this.rotation.x,y:this.rotation.y+90,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,animateNeedsUpdate:this.animateNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid,jsondata:e?null:this.data,animateJson:this.animateNeedsUpdate?this.animateJson:null,Size:this.size,SizeAttenuation:this.sizeAttenuation}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.z,y:this.scale.y,z:this.scale.x},Rotation:{x:this.rotation.x,y:this.rotation.y+90,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}class Plane extends Shape{constructor(e){super(e),this.type="Plane"}}class QuadPyramid extends Shape{constructor(e){super(e),this.type="QuadPyramid"}}class Sphere extends Shape{constructor(e){super(e),this.type="Sphere"}}class TrafficCone extends Shape{constructor(e){super(e),this.type="TrafficCone"}}class Circle extends Shape{constructor(e){super(e),this.type="Circle"}}class Torus extends Shape{constructor(e){super(e),this.type="Torus"}}class Tube extends Shape{constructor(e){super(e),this.type="Tube"}}class DiamondSign extends Shape{constructor(e){super(e),this.type="DiamondSign"}}class Heatmap extends Shape{constructor(e){super(e),this.type="Heatmap",this.kind=e.kind||"texture",this.visible=void 0===e.visible||e.visible,this.container=e.container,this.width=e.width||512,this.height=e.height||512,this.min=e.min,this.max=e.max,this.xName=e.xName,this.yName=e.yName,this.valueName=e.valueName,this.backgroundColor=e.backgroundColor,this.gradient=e.gradient,this.radius=e.radius||40,this.blur=e.blur||.85,this.opacity=e.opacity,this.minOpacity=e.minOpacity||0,this.maxOpacity=e.maxOpacity||1,this.heatmapInstance=null,this.size=e.size||null,this.center=e.center,this.minHeight=e.minHeight||0,this.maxHeight=e.maxHeight||500,this.duration=MathUtils.clamp(e.duration||1,0,100),this.data=e.data;e=e.particle||{};let t=e.bound||{x:100,y:100,z:0},i=e.scaleBoxXY||1,s=e.noiseStrength||0,a,o=e.grayPower||1,n=parseInt(e.countX,10)||400,r=parseInt(e.countY,10)||400;this.particleMaxHeight=e.maxHeight||0,"noiseMap"in e&&(this.noiseMap=a=e.noiseMap,isBase64(a)||loadImageAsBase64(a,e=>{e&&(this.noiseMap=a=e)})),"particle"===this.kind&&(this.gradient={0:"rgb(0, 0, 0)",1:"rgb(256, 256, 256)"}),this.init(),Object.defineProperties(this,{bound:{enumerable:!0,get:function(){return t},set:function(e){e&&"particle"===this.kind&&(t.x=e.x,t.y=e.y,t.z=e.z,this.matrixNeedsUpdate=!0)}},scaleBoxXY:{enumerable:!0,get:function(){return i},set:function(e){console.log(e,i,this.kind),e!==i&&"particle"===this.kind&&(i=e,this.matrixNeedsUpdate=!0)}},noiseStrength:{enumerable:!0,get:function(){return s},set:function(e){e!==s&&"particle"===this.kind&&(s=e,this.matrixNeedsUpdate=!0)}},grayPower:{configurable:!0,enumerable:!0,get:function(){return o},set:function(e){e!==o&&"particle"===this.kind&&(o=e,this.matrixNeedsUpdate=!0)}},countX:{configurable:!0,enumerable:!0,get:function(){return n},set:function(e){e!==n&&"particle"===this.kind&&(n=parseInt(e,10),this.matrixNeedsUpdate=!0)}},countY:{configurable:!0,enumerable:!0,get:function(){return r},set:function(e){e!==r&&"particle"===this.kind&&(r=parseInt(e,10),this.matrixNeedsUpdate=!0)}}})}init(){var e,t,i,s;"particle"===this.kind&&this.data.length<2?console.error("数据量过少,无法绘制粒子热力图"):((i=processData(this.data,this.xName,this.yName,this.valueName,this.width,this.height))&&(void 0===this.min&&(this.min=i.min),void 0===this.max&&(this.max=i.max),i.bbox)&&(this.center||(e=.5*(i.bbox.min.longitude+i.bbox.max.longitude),t=.5*(i.bbox.min.latitude+i.bbox.max.latitude),this.center={x:e,y:t,z:10}),this.size||"particle"!==this.kind&&(e=i.bbox.max.longitude-i.bbox.min.longitude,t=i.bbox.max.latitude-i.bbox.min.latitude,this.size={x:1e5*e,y:1e5*t}),this.bbox=i.bbox),e=this.data,t=this.max,i=this.min,this.heatmapInstance?(this.heatmapInstance.configure(this.getConfig()),this.heatmapInstance.setData({max:t,min:i,data:e}),this.heatmapInstance.repaint()):(this.container||(this.container=creatContainer(this.width,this.height)),(s=draw(this.getConfig()))&&(this.heatmapInstance=s,this.heatmapInstance.setData({max:t,min:i,data:e}))),this.canvas||(this.canvas=this.container.children[0]),this.texture=convertCanvas2Base64(this.canvas),this.materialNeedsUpdate=!0,this.center||(this.center=new Vector3(0,0,10)),"particle"!==this.kind&&(this.size||(this.size=new Vector2(this.width,this.height)),this.scale.set(this.size.x,this.size.y,200)),this.position.set(this.center.x,this.center.y,this.center.z))}setData(e){return!1}getConfig(){return{container:this.container,backgroundColor:this.backgroundColor,gradient:this.gradient,radius:this.radius,opacity:this.opacity,maxOpacity:this.maxOpacity||1,minOpacity:this.minOpacity||0,blur:this.blur||0,width:this.width,height:this.height}}repaint(e){e&&(this.duration=MathUtils.clamp(e,.1,100)),this.init()}getGeojsonData(){if(this.container&&this.heatmapInstance){var e,i=(this.maxHeight-this.minHeight)/(this.max-this.min),s=this.heatmapInstance._renderer._palette,a=[],o=this.size.x/this.width,n=this.size.y/this.height,r=null==(e=this.heatmapInstance)?void 0:e.getData().data;for(let e=0,t=r.length;e<t;e++){var l=parseInt(r[e].x,10),h=parseInt(r[e].y,10),d=Math.max(Math.min(r[e].value,this.max),this.min),c=(d-this.min)*i+this.minHeight,d=Math.floor((d-this.min)/(this.max-this.min)*252),u=r[e].radius,d={r:s[4*d]*(1/256),g:s[4*d+1]*(1/256),b:s[4*d+2]*(1/256)};c<1||(c={type:"Feature",properties:{id:e,height:c,color:d,xSize:u,ySize:u},geometry:{type:"Point",coordinates:[o*(l-.5*this.width)/1e5,n*(h-.5*this.height)/1e5]}},a.push(c))}return a}return!1}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?"texture"===this.kind.toLowerCase()?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,Duration:this.duration,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,Kind:this.kind,uuid:this.uuid}:"particle"===this.kind.toLowerCase()?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,Duration:this.duration,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,Kind:this.kind,uuid:this.uuid,Bound:this.bound,ScaleBoxXY:this.scaleBoxXY,NoiseStrength:this.noiseStrength,NoiseMap:this.noiseMap,GrayPower:this.grayPower,MaxHeight:this.particleMaxHeight||this.maxHeight,countX:this.countX,countY:this.countY,Min:this.bbox.min,Max:this.bbox.max}:(e=this.getGeojsonData(),{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,Kind:this.kind,uuid:this.uuid,jsondata:e}):{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}function creatContainer(e,t){var i=document.createElement("div");return i.style.width=e?e+"px":"512px",i.style.height=t?t+"px":"512px",i.style.top="0px",i.style.display="none",document.getElementsByTagName("body")[0].appendChild(i),i}function processData(i,s,a,o,n,r){if(!i||i.length<1)return!1;let l=1/0,h=-1/0;var d={longitude:1/0,latitude:1/0},c={longitude:-1/0,latitude:-1/0};for(let e=0,t=i.length;e<t;e++){var u=o?i[e][o]:i[e].value;l=Math.min(u,l),h=Math.max(u,h),s&&(i[e].x=i[e][s]),a&&(i[e].y=i[e][a]),o&&(i[e].value=i[e][o]),i[e].longitude&&i[e].latitude&&(d.longitude=Math.min(d.longitude,i[e].longitude),d.latitude=Math.min(d.latitude,i[e].latitude),c.longitude=Math.max(c.longitude,i[e].longitude),c.latitude=Math.max(c.latitude,i[e].latitude))}if(i[0].longitude&&i[0].latitude){if(!i[0].hasOwnProperty("x")&&!i[0].hasOwnProperty("y"))for(let e=0,t=i.length;e<t;e++){var p=c.latitude-d.latitude;i[e].x=Math.round(n*(i[e].longitude-d.longitude)/(c.longitude-d.longitude)),i[e].y=Math.round(r*(i[e].latitude-d.latitude)/p)}return{min:l,max:h,bbox:{min:d,max:c}}}return{min:l,max:h}}function draw(e){var t;return!!e&&(t=e.container||creatContainer(e),h337.create({container:t,backgroundColor:e.backgroundColor||"rgba(0,0,0,.95)",gradient:e.gradient||{0:"rgb(50, 50, 256)",.1:"rgb(50, 250, 56)",.5:"rgb(250, 250, 56)",1:"rgb(250, 50, 56)"},radius:e.radius||40,opacity:e.opacity,maxOpacity:e.maxOpacity||1,minOpacity:e.minOpacity||0}))}class Particle extends Shape{constructor(e={}){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum,this.type="Particle";let t=e.kind||ParticleKind.FIRE_SMALL,i=e.spawnRate||30,s=e.brightness||3,a=e.lifeTime||1;const o=new Color$1(1,0,1);e.brightnessColor&&(o.r=MathUtils.clamp(e.brightnessColor.r,0,1),o.g=MathUtils.clamp(e.brightnessColor.g,0,1),o.b=MathUtils.clamp(e.brightnessColor.b,0,1));let n=e.speed||5,r=e.height||200,l=e.width||.01,h=e.zVelocity||100;this.thickness=e.thickness||.2,Object.defineProperties(this,{kind:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},spawnRate:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},brightness:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},brightnessColor:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o.r=e.r,o.g=e.g,o.b=e.b,o.a=1,this.materialNeedsUpdate=!0)}},speed:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},height:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},width:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},zVelocity:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=e,this.materialNeedsUpdate=!0}},lifeTime:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,BrightnessColor:this.brightnessColor?{r:this.brightnessColor.r,g:this.brightnessColor.g,b:this.brightnessColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},SpawnRate:this.spawnRate,Speed:this.speed,Height:this.height,ZVelocity:this.zVelocity,LifeTime:this.lifeTime,Width:this.width,Kind:this.kind,type:this.type,uuid:this.uuid,Thickness:this.thickness,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,RenderNum:this.renderNum}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.size=e.size,this.kind=e.kind,this.thickness=e.thickness,super.copy(e,t),this}}class TrafficLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}get labelVisible(){return this.label.visible}set labelVisible(e){e!==this.label.visible&&(this.materialNeedsUpdate=!0,this.label.visible=e&&!0)}get message(){return this._message}set message(e){this.messageNeedsUpdate=!0,this._message=e}constructor(e){super(),this.type="TrafficLayer",this.url=e.url,this.eventName=e.eventName||"geo_window_state",this.interval=e.interval||100,this._message=null,this.message=e.message,this.query=e.query,this.label=new Object3D,this.label.visible=void 0!==e._labelVisible&&e._labelVisible,this.rayDetectionDistance=e.rayDetectionDistance||0,this.uiRenderDistance=e.uiRenderDistance||5e4,this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.followNeedsUpdate=!1,this.labelVisible=e.labelVisible,this.offset=new Vector3,this.handShakePath=e.handShakePath||"socket.io",this.namespace=e.namespace||"/",this.carRenderDistance=e.carRenderDistance||3e5,this.labelGroup=e.labelGroup||"highSpeed",this.labelScale=void 0===e.labelScale?1:e.labelScale,this.labelRenderType=void 0===e.labelRenderType?0:e.labelRenderType,this.isSubsection=e.isSubsection||!1}setLabelVisible(e){e!==this.label.visible&&(this.materialNeedsUpdate=!0,this.label.visible=e)}getLabelVisible(){return this.label.visible}dispose(){return!1}followTraffic(e){this.isFollow=null==e?void 0:e.isFollow,this.followCarId=null==e?void 0:e.carId,this.followCarPlateNumber=null==e?void 0:e.plateNumber,this.followColor=(null==e?void 0:e.color)||{r:0,g:1,b:.8},this.followRotations=(null==e?void 0:e.followRotations)||{Roll:!1,Pitch:!1,Yaw:!1},this.followNeedsUpdate=!0}initEventListener(){}toJSON(e=0){return{Url:this.url,EventName:this.eventName,LabelVisible:this.labelVisible,LabelGroup:this.labelGroup,LabelScale:this.labelScale,LabelRenderType:this.labelRenderType,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,Id:this.followCarId,Namespace:this.namespace,HandShakePath:this.handShakePath,FollowColor:this.followColor||{r:0,g:1,b:.8},FollowRotation:this.followRotations||{Roll:!1,Pitch:!1,Yaw:!1},Plate:this.followCarPlateNumber,IsFollow:this.isFollow,Content:this.content,Message:this.message,Query:this.query,RayDetectionDistance:this.rayDetectionDistance,UIRenderDistance:this.uiRenderDistance,CarRenderDistance:this.carRenderDistance,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},IsSubsection:this.isSubsection}}}class RoadCondition extends Line{constructor(e={}){super(e),this.name=e.name||"",this.type="RoadCondition",this.colors=e.colors||{1:(new Color$1).setStyle("#00ff00"),2:(new Color$1).setStyle("#ffff00"),3:(new Color$1).setStyle("#ff0000"),4:(new Color$1).setStyle("#ff00ff")}}setData(e,i="condition"){this.data=getUELineData(e),this.data.forEach(e=>{var t=e.properties[i],t=this.colors[t]||this.colors[1];e.properties.color={r:t.r,g:t.g,b:t.b,a:t.a||1}})}}class ConstructionLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}get coneMap(){return this.cone.map}set coneMap(e){e&&(this.cone.map=e,this.materialNeedsUpdate=!0)}get groundMap(){return this.ground.map}set groundMap(e){e&&(this.ground.map=e,this.materialNeedsUpdate=!0)}get fenceMap(){return this.fence.map}set fenceMap(e){e&&(this.fence.map=e,this.materialNeedsUpdate=!0)}get fenceHeight(){return this._fenceHeight}set fenceHeight(e){e&&(this._fenceHeight=e)}constructor(e={}){super(e),this.initChild();const t=e.coneColor||new Color$1(1,1,1),i=e.groundColor||new Color$1(1,1,1),s=e.fenceColor||new Color$1(1,1,1);let a=e.brightness||0,o=e.roughness||1,n=e.metallic||0,r=(this.coneMap=e.coneMap||null,this.groundMap=e.groundMap||null,this.fenceMap=e.fenceMap||null,this.fenceHeight=e.fenceHeight||1,e.coneOpacity||t.a||1),l=e.groundOpacity||i.a||1,h=e.fenceOpacity||s.a||1;const d=e.bloomColor||null,c=e.position||new Vector3,u=e.rotation||new Euler,p=new Quaternion,m=e.scale||new Vector3(1,1,1),g=e.coneScale||new Vector3(1,1,1),y=e.offset||new Vector3(0,0,0);let f=!1;u._onChange(function(){p.setFromEuler(u,!1),this.matrixNeedsUpdate=!0}),p._onChange(function(){u.setFromQuaternion(p,void 0,!1),this.matrixNeedsUpdate=!0}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{e&&(c.x=e.x,c.y=e.y,c.z=e.z,this.matrixNeedsUpdate=!0)}},rotation:{configurable:!0,enumerable:!0,value:u},quaternion:{configurable:!0,enumerable:!0,value:p},scale:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e&&(m.x=e.x,m.y=e.y,m.z=e.z,this.matrixNeedsUpdate=!0)}},coneScale:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g.x=e.x,g.y=e.y,g.z=e.z,this.matrixNeedsUpdate=!0)}},offset:{configurable:!0,enumerable:!0,get:()=>y,set:e=>{e&&(y.x=e.x,y.y=e.y,y.z=e.z,this.matrixNeedsUpdate=!0)}},coneColor:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t.r=e.r,t.g=e.g,t.b=e.b,e.a&&(r=e.a),this.materialNeedsUpdate=!0)}},groundColor:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i.r=e.r,i.g=e.g,i.b=e.b,e.a&&(l=e.a),this.materialNeedsUpdate=!0)}},fenceColor:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.r=e.r,s.g=e.g,s.b=e.b,e.a&&(h=e.a),this.materialNeedsUpdate=!0)}},coneOpacity:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},groundOpacity:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},fenceOpacity:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=e,this.materialNeedsUpdate=!0}},brightness:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{void 0!==e&&(a=e,this.materialNeedsUpdate=!0)}},roughness:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},metallic:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},bloomColor:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d.copy(e),this.materialNeedsUpdate=!0)}},transparent:{configurable:!0,enumerable:!0,get:()=>f,set:e=>{f=e&&1,this.materialNeedsUpdate=!0}},_visible:{configurable:!0,enumerable:!0,value:!0},_layerName:{configurable:!1,enumerable:!1,value:"CommonGISLayer"},_cloudControlType:{configurable:!1,enumerable:!1,value:"Gis"},type:{configurable:!0,enumerable:!0,value:"Construction"}}),this.matrixNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.visibleNeedsUpdate=!1}initChild(){this.ground=new Polygon,this.add(this.ground),this.fence=new Line,this.add(this.fence),this.cone=new TrafficCone,this.add(this.cone)}setData(e,t=!0){this.data=getUELineData(e,t)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:1,g:1,b:1,a:1},ConeColor:{r:this.coneColor.r,g:this.coneColor.g,b:this.coneColor.b,a:this.coneOpacity},GroundColor:{r:this.groundColor.r,g:this.groundColor.g,b:this.groundColor.b,a:this.groundOpacity},FenceColor:{r:this.fenceColor.r,g:this.fenceColor.g,b:this.fenceColor.b,a:this.fenceOpacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:1,ConeOpacity:this.coneOpacity,GroundOpacity:this.groundOpacity,FenceOpacity:this.fenceOpacity,Transparent:this.transparent,GroundTexture:this.ground.map,ConeTexture:this.cone.map,FenceTexture:this.fence.map,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},ConeScale:{x:this.coneScale.x,y:this.coneScale.y,z:this.coneScale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,groundUuid:this.ground.uuid,coneUuid:this.cone.uuid,fenceUuid:this.fence.uuid,jsondata:e?null:this.data,FenceWidth:this.fenceHeight}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}dispose(){this.traverse(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose(),e.texture=null}),this.data=null,this.texture=null}}class I3DTileLayer extends Shape{get url(){return this._url}set url(e){e!==this._url&&(this.visibleNeedsUpdate=!0,this._url=e)}constructor(e){super(e),this.name=e.name||"",this.url=e.url,this._enableSlope=!1,this.token=e.token||null,this.type="i3DTileLayer",this.initialize()}initialize(){if(!this.url)return!1}slopeAnalysis(e,t={}){this._enableSlope=e&&!0,this.slopeParams={},e&&Object.assign(this.slopeParams,t)}toJSON(){return!isUpdate||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},Token:this.token,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,Url:this.url||null,EnableSlope:this._enableSlope,SlopeParams:this._enableSlope?this.slopeParams:null}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}dispose(){this.traverse(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose(),e.texture=null}),this.url=null,this.texture=null}}class AssetLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}get body(){return this._body}set body(e){this.messageNeedsUpdate=!0,this._body=e}constructor(e){super(e),this.type="AssetLayer",this.url=e.url,this.header=e.header,this.body=e.body,this.messageNeedsUpdate=!1,this.childNeedsUpdate=!1;let t=e.deviceAutoUpdate||!1,i=Math.max(1,e.deviceAutoUpdateInterval||2),s=void 0===e.renderNum?15:e.renderNum,a=void 0===e.searchMode?"coord":e.searchMode,o=void 0===e.tileLevel?16:e.tileLevel,n=void 0!==e.rtEnable&&e.rtEnable,r=e.rtUrl,l=void 0===e.rtTilelLevel?17:e.rtTilelLevel;this.maxUpdateHeight=void 0===e.maxUpdateHeight?1e3:e.maxUpdateHeight,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.offset=new Vector3,Object.defineProperties(this,{deviceAutoUpdate:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e,this.messageNeedsUpdate=!0)}},deviceAutoUpdateInterval:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=Math.max(e,2),this.messageNeedsUpdate=!0)}},renderNum:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.messageNeedsUpdate=!0)}},searchMode:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.messageNeedsUpdate=!0)}},tileLevel:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.messageNeedsUpdate=!0)}},rtEnable:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.messageNeedsUpdate=!0}},rtUrl:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e,this.messageNeedsUpdate=!0)}},rtTilelLevel:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l=e,this.messageNeedsUpdate=!0)}}})}addChildren(e){if(!e||e.length<1)return!1;this.childOperate="add",this.childrenContent=[],e.forEach((e,t)=>{this.childrenContent.push({uuid:e.uuid,point_id:e.point_id,config:{material:{},transform:null}})}),this.childNeedsUpdate=!0,this.materialNeedsUpdate=!0}removeChild(e){e&&(e instanceof Array?this.removeChildren(e):this.removeChildren([e]))}removeChildren(e){if(!e||e.length<1)return!1;this.childOperate="remove",this.childrenContent=[],e.forEach((e,t)=>{this.childrenContent.push({uuid:e.uuid,point_id:e.point_id,config:{material:{},transform:null}})}),this.childNeedsUpdate=!0,this.materialNeedsUpdate=!0}updateChild(e){if(!e)return!1;e instanceof Array?this.updateChildren(e):this.updateChildren([e])}updateChildren(e){if(!e||e.length<1)return!1;this.childrenContent=[],this.childOperate="update",this.childNeedsUpdate=!0,this.materialNeedsUpdate=!0,e.forEach((e,t)=>{this.updateChildContent(e)})}updateChildContent(e){if(!e.uuid)return!1;const t={uuid:e.uuid,point_id:e.point_id,config:{material:{},transform:null}};var i,e=e.params;void 0!==e.opacity&&(e.color.a=e.opacity),e.color&&(t.config.material.Color={r:e.color.r,g:e.color.g,b:e.color.b,a:e.color.a||1}),e.brightnessColor&&(t.config.material.BrightnessColor={r:e.brightnessColor.r,g:e.brightnessColor.g,b:e.brightnessColor.b,a:1}),e.text?(i=drawTextToImage(e.text,e.textStyle),t.config.material.Texture=convertCanvas2Base64(i)):e.map&&(isBase64(e.map)?t.config.material.Texture=e.map:loadImageAsBase64(e.map,e=>{e&&(t.config.material.Texture=e)})),void 0!==e.metallic&&(t.config.material.Metallic=e.metallic),void 0!==e.roughness&&(t.config.material.Roughness=e.roughness),void 0!==e.brightness&&(t.config.material.Brightness=e.brightness),e.position&&(t.config.transform||(t.config.transform={}),t.config.transform.Location={x:e.position.x,y:e.position.y,z:e.position.z}),e.scale&&(t.config.transform||(t.config.transform={}),t.config.transform.Scale={x:e.scale.x,y:e.scale.y,z:e.scale.z}),e.rotation&&(t.config.transform||(t.config.transform={}),t.config.transform.Rotation={x:e.rotation.x,y:e.rotation.y,z:e.rotation.z}),void 0!==e.scroll&&(t.config.scroll=MathUtils.clamp(e.scroll,-1,1)),void 0!==e.speed&&(t.config.speed=e.speed),void 0!==e.animationIndex&&(t.config.animationIndex=e.animationIndex),void 0!==e.animationLoop&&(t.config.animationLoop=e.animationLoop),void 0!==e.animationSpeed&&(t.config.animationSpeed=e.animationSpeed),this.childrenContent.push(t)}updateChildAnimation(e){if(!e)return!1;e instanceof Array?this.updateChildrenAnimation(e):this.updateChildrenAnimation([e])}updateChildrenAnimation(e){if(!e||e.length<1)return!1;this.childrenContent=[],e.forEach((e,t)=>{this.updateChildContent(e)}),this.childOperate="animation",this.childNeedsUpdate=!0,this.materialNeedsUpdate=!0}toJSON(e=0){var t={DeviceUrl:this.url,DeviceBody:this.body,DeviceHeader:this.header,SearchMode:this.searchMode,TileLevel:this.tileLevel,RenderNum:this.renderNum,RTUrl:this.rtUrl,RTEnable:this.rtEnable,RTTileLevel:this.rtTilelLevel,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,content:this.materialNeedsUpdate?this.childrenContent:null,childOperate:this.childOperate,AutoUpdate:this.deviceAutoUpdate,AutoUpdateInterval:this.deviceAutoUpdateInterval,MaxUpdateHeight:this.maxUpdateHeight};return this.childNeedsUpdate&&(this.childNeedsUpdate=!1,this.childOperate=null,this.materialNeedsUpdate=!0),t}}class Radar extends Shape{constructor(e={color:{r:0,g:1,b:0,a:1},brightness:1,speed:.2}){super(e),this.type="Radar"}}class Ripple extends Shape{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:1,speed:2}){super(e),this.type="Ripple"}}class Soil extends Shape{constructor(e){super(e),this.type="Soil"}}class Diamond extends Shape{constructor(e={gardientDirection:-1,color:{r:0,g:.48,b:.0047,a:1},color2:{r:.43,g:1,b:.42,a:1}}){super(e),this.type="Diamond"}}class TrafficShape extends Shape{constructor(e){super(e),this.type="CommonCar";let t=void 0===e.carType?3:e.carType;Object.defineProperties(this,{carType:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{void 0!==e&&(t=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}}})}toJSON(e=!0){return!this.visibleNeedsUpdate||!e||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Scroll:this.scroll,Speed:this.speed,Texture:this.texture,GardientDirection:this.gardientDirection,Color2:{r:this.color2.r,g:this.color2.g,b:this.color2.b,a:this.opacity},BrightnessColor:this.brightnessColor?{r:this.brightnessColor.r,g:this.brightnessColor.g,b:this.brightnessColor.b,a:1}:this.color,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,animateNeedsUpdate:!this.isInstance&&this.animateNeedsUpdate,visible:this.visible,type:this.type,CarType:this.carType,name:this.name,uuid:this.uuid,jsondata:!e||this.isInstance?this.data:null,animateJson:this.animateNeedsUpdate?this.animateJson:null,Size:this.size,SizeAttenuation:this.sizeAttenuation,ChildIndex:this.isInstance?-1:this.childIndex,IsInstance:this.isInstance,overtimeInstanceIndex:this.overtimeInstanceIndex}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}class TriangleWarning extends Shape{constructor(e){super(e),this.type="TriangleWarning"}}class Bucket extends Shape{constructor(e){super(e),this.type="Bucket"}}class Inundation extends Shape{constructor(e){super(e),this.type="InundationAnalysis"}}class Skyline extends Shape{constructor(e){super(e),this.type="SkylineAnalysis";let t=e.distance||120,i=e.lineWidth||1;Object.defineProperties(this,{distance:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},lineWidth:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}}})}toJSON(e=0){return{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Distance:this.distance,LineWidth:this.lineWidth}}}class VisualField extends Shape{constructor(e){super(e),this.type="VisualFieldAnalysis";let t=e.fov||60,i=e.maxDistacne||5,s=e.rexYX||.5,a=e.reslution||1024;Object.defineProperties(this,{fov:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},maxDistacne:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},rexYX:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},reslution:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}}})}toJSON(e=0){return{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,FOV:this.fov,MaxDistacne:this.maxDistacne,RexYX:this.rexYX,Reslution:this.reslution,Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z}}}}class CarPark extends Shape{constructor(e){super(e),this.type="CarPark";const t=e.position||new Vector3;let i=e.rotation||new Euler;const s=e.scale||new Vector3(1,1,1),a=e.color||{r:1,g:1,b:1,a:1};Object.defineProperties(this,{position:{enumerable:!0,get:function(){return t},set:e=>{e&&(t.x=e.x,t.y=e.y,t.z=e.z,this.matrixNeedsUpdate=!0)}},rotation:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i.x=MathUtils.clamp(e.x,-180,180),i.y=MathUtils.clamp(e.y,-180,180),i.z=MathUtils.clamp(e.z,-180,180),this.matrixNeedsUpdate=!0)}},scale:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.x=e.x,s.y=e.y,s.z=e.z,this.matrixNeedsUpdate=!0)}},modelType:{configurable:!0,enumerable:!0,get:()=>this._modelType,set:e=>{e&&(this._modelType=e)}},color:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a.r=e.r,a.g=e.g,a.b=e.b,a.a=e.a||1,this.materialNeedsUpdate=!0)}},parkType:{configurable:!0,enumerable:!0,get:()=>this._parkType,set:e=>{e&&("out"===e.toLowerCase?this._parkType="out":this._parkType="in")}}}),this.position=t,this.rotation=i,this.scale=s,this.modelType=isModelType(e.modelType),this.speed=Number(e.speed)||36,this.endState=e.endState||!1,this.color=a,this.parkType=e.parkType||"in"}toJSON(e=!0){return!this.visibleNeedsUpdate||!e||this.visible&&this.materialNeedsUpdate?{Position:{x:this.position.x,y:this.position.y,z:this.position.z},Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.color.a},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Speed:this.speed,ModelType:this.modelType,EndState:this.endState,Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,animateNeedsUpdate:this.animateNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid,jsondata:e?null:this.data,ParkType:this.parkType}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}function isModelType(e){return isNaN(e)||e<3||6<e&&e<12||16<e?3:e}class TrafficLightLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}get message(){return this._body}set message(e){this.messageNeedsUpdate=!0,this._body=e}constructor(e){super(e),this.type="TrafficLight",this.url=e.url,this.header=e.header,this.message=e.message;let t=void 0===e.brightness?1:e.brightness;this.lightAltitude=void 0===e.lightAltitude?1:e.lightAltitude,this.renderScale=void 0===e.renderScale?1:e.renderScale,this.rayDetection={enable:!1,distance:0,displacementHeight:0},e.rayDetection&&(this.rayDetection.enable=void 0!==e.rayDetection.enable&&e.rayDetection.enable,this.rayDetection.distance=void 0===e.rayDetection.distance?0:e.rayDetection.distance,this.rayDetection.displacementHeight=void 0===e.rayDetection.displacementHeight?0:e.rayDetection.displacementHeight),this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.offset=new Vector3,Object.defineProperties(this,{brightness:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}}})}dispose(){return!1}toJSON(e=0){return{Url:this.url,Message:this.message,Header:this.header,RenderScale:this.renderScale,LightAltitude:this.lightAltitude,RayDetection:this.rayDetection,Brightness:this.brightness,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid}}}class RoadName extends Shape{constructor(e){super(e),this.type="RoadName",this.fontSize=e.fontSize||14,this.rayDetectionDistance="rayDetectionDistance"in e?e.rayDetectionDistance:500,this.displacementHeight="displacementHeight"in e?e.displacementHeight:40*this.scale.z,this.data=e.data||[],this.filename=e.filename||null;let t=e.color||{r:1,g:1,b:1,a:1},i=(this.openCollision=e.openCollision||!1,this.switchScale=e.switchScale||!1,this.minScale="minScale"in e?e.minScale:1,this.maxScale="maxScale"in e?e.maxScale:2,this.minDistance=e.minDistance||0,this.maxDistance=e.maxDistance||5e3,e.switchPitchRotate||!1);this.minPitch="minPitch"in e?e.minPitch:0,this.maxPitch="maxPitch"in e?e.maxPitch:90,this.collisionScale=e.collisionScale||2,this.brightness=e.brightness||1,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return t},set:function(e){e!==t&&(t=e,this.materialNeedsUpdate=!0)}},switchPitchRotate:{enumerable:!0,get:function(){return i},set:function(e){e!==i&&(i=e,this.materialNeedsUpdate=!0)}}})}toJSON(e=!0){return!this.visibleNeedsUpdate||!e||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.z,y:this.scale.y,z:this.scale.x},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid,jsondata:this.data,rayDetectionDistance:this.rayDetectionDistance,displacementHeight:this.displacementHeight,FileName:this.filename,FontSize:this.fontSize,OpenCollision:this.openCollision,SwitchScale:this.switchScale,MinScale:this.minScale,MaxScale:this.maxScale,MinDistance:this.minDistance,MaxDistance:this.maxDistance,SwitchPitchRotate:this.switchPitchRotate,MinPitch:this.minPitch,MaxPitch:this.maxPitch,CollisionScale:this.collisionScale,ShadowColor:this.shadowColor,ShadowOffset:this.shadowOffset,Brightness:this.brightness}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.z,y:this.scale.y,z:this.scale.x},Rotation:{x:this.rotation.x,y:this.rotation.y+90,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}class AutonomousVehicleLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}constructor(e){super(e),this.type="AutonomousVehicle";let t=e.url,i=e.header,s=void 0===e.labelRenderScale?1:e.labelRenderScale,a=void 0===e.labelRenderType?1:e.labelRenderType,o=void 0===e.labelBrightness?1:e.labelBrightness,n=void 0===e.followMode?"Third":e.followMode,r=(this.followRotation=void 0===e.followRotation?{Roll:!1,Pitch:!1,Yaw:!0}:e.follow,void 0===e.followZoom?0:e.followZoom),l=void 0!==e.switchScale&&e.switchScale,h=void 0===e.minViewPortHeight?30:e.minViewPortHeight,d=void 0===e.maxViewPortHeight?300:e.maxViewPortHeight,c=void 0===e.minScale?1:e.minScale,u=void 0===e.maxScale?2:e.maxScale,p=void 0===e.controlTypeList?[]:e.controlTypeList,m=void 0!==e.predictionEnable&&e.predictionEnable,g=void 0===e.predictionLineStyle?{}:e.predictionLineStyle;this.rayDetection={enable:!1,distance:0},e.rayDetection&&(this.rayDetection.enable=void 0!==e.rayDetection.enable&&e.rayDetection.enable,this.rayDetection.distance=void 0===e.rayDetection.distance?0:e.rayDetection.distance),this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.followNeedsUpdate=!1,this.offset=new Vector3,Object.defineProperties(this,{url:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e,this.messageNeedsUpdate=!0)}},header:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.messageNeedsUpdate=!0)}},labelRenderScale:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.materialNeedsUpdate=!0)}},labelBrightness:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.materialNeedsUpdate=!0)}},predictionLineStyle:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g=e,this.materialNeedsUpdate=!0)}},labelRenderType:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.materialNeedsUpdate=!0)}},predictionEnable:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e&&(m=e,this.materialNeedsUpdate=!0)}},followMode:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e,this.followNeedsUpdate=!0)}},followZoom:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e,this.materialNeedsUpdate=!0)}},switchScale:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l=e,this.materialNeedsUpdate=!0)}},minViewPortHeight:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e,this.materialNeedsUpdate=!0)}},maxViewPortHeight:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d=e,this.materialNeedsUpdate=!0)}},minScale:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{e&&(c=e,this.materialNeedsUpdate=!0)}},maxScale:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{e&&(u=e,this.materialNeedsUpdate=!0)}},controlTypeList:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{p=e||[]}}})}dispose(){return!1}toJSON(e=!0){return e&&this.visibleNeedsUpdate?{Url:this.url,Header:this.header,LabelRenderScale:this.labelRenderScale,LabelRenderType:this.labelRenderType,RayDetection:this.rayDetection,ControlTypeList:this.controlTypeList,FollowMode:this.followMode,SwitchScale:this.switchScale,MinViewPortHeight:this.minViewPortHeight,MaxViewPortHeight:this.maxViewPortHeight,FollowRotation:this.followRotation,LabelBrightness:this.labelBrightness,MinScale:this.minScale,MaxScale:this.maxScale,FollowZoom:this.followZoom,PredictionLineStyle:this.predictionLineStyle,PredictionEnable:this.predictionEnable,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid}:{Url:this.url,Header:this.header,LabelRenderScale:this.labelRenderScale,LabelRenderType:this.labelRenderType,RayDetection:this.rayDetection,FollowMode:this.followMode,SwitchScale:this.switchScale,MinViewPortHeight:this.minViewPortHeight,MaxViewPortHeight:this.maxViewPortHeight,FollowRotation:this.followRotation,FollowZoom:this.followZoom,LabelBrightness:this.labelBrightness,PredictionLineStyle:this.predictionLineStyle,PredictionEnable:this.predictionEnable,MinScale:this.minScale,MaxScale:this.maxScale,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid}}}class QuadPyramidTop extends Shape{constructor(e){super(e),this.type="QuadPyramidTop"}}class WebViewPoint extends Shape{constructor(e={}){super(e),this.visible=void 0===e.visible||e.visible;let t=e.url||"",i=e.size||{x:300,y:200},s=0===e.faceType?0:e.faceType||1,a=e.pivot||{x:.5,y:.5},o=void 0!==e.switchScale&&e.switchScale,n=e.minDistance||0,r=e.maxDistance||0,l=void 0===e.minScale?1:e.minScale,h=void 0===e.maxScale?1:e.maxScale;this.type="WebViewPoint",Object.defineProperties(this,{url:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},size:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},pivot:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}},faceType:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},switchScale:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},minDistance:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},maxDistance:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},minScale:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},maxScale:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return e&&this.visibleNeedsUpdate&&!this.materialNeedsUpdate?{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,FadeIn:this.fadeIn,type:this.type,name:this.name,uuid:this.uuid}:{Pivot:this.pivot,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,FaceType:getFinalFaceType(this.faceType),SwitchScale:this.switchScale,MinDistance:this.minDistance,MaxDistance:this.maxDistance,MaxScale:this.maxScale,MinScale:this.minScale,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,URL:this.url,Size:this.size,Brightness:this.brightness}}copy(e,t=!0){return this.fontWeight=e.fontWeight,this.fontSize=e.fontSize,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.shadowColor=e.shadowColor,this.shadowOffset=e.shadowOffset,super.copy(e,t),this}}class LayerBuilding extends Shape{constructor(e={}){super(e),this.type="LayerBuilding";let t=e.buildingName||"all",i=e.layeringHeight||500,s=e.layeringBaseHeight||300,a=e.floorPullDir||{x:5e3,y:0,z:0};this.hiddenDefault=void 0===e.HiddenDefault||e.HiddenDefault,this.floorNum=0,this.eventName="",this.buildingState="create",this.isLayering={},this.isLayering[t]=!1,Object.defineProperties(this,{layeringHeight:{enumerable:!0,get:function(){return i},set:function(e){e!==i&&(i=e,this.materialNeedsUpdate=!0,this.buildingState="update")}},buildingName:{enumerable:!0,get:function(){return t},set:function(e){e&&e!==t&&(t=e,this.materialNeedsUpdate=!0,this.buildingState="update")}},layeringBaseHeight:{enumerable:!0,get:function(){return s},set:function(e){e!==s&&(s=e,this.materialNeedsUpdate=!0,this.buildingState="update")}},floorPullDir:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a.x=e.x,a.y=e.y,a.z=e.z,this.materialNeedsUpdate=!0,this.buildingState="update")}}})}layeringBuilding(){if(this.eventName="Layering",this.animateNeedsUpdate=!0,this.buildingState="update","all"===this.buildingName)for(const e in this.isLayering)this.isLayering[e]=!0;else this.isLayering[this.buildingName]=!0}backBuildingToNormal(){if(this.eventName="BackToNormal",this.animateNeedsUpdate=!0,this.buildingState="update","all"===this.buildingName)for(const e in this.isLayering)this.isLayering[e]=!1;else this.isLayering[this.buildingName]=!1}pullBuilding(e){if(void 0===this.isLayering[this.buildingName]){if(!this.isLayering.all)return void console.warn("该建筑物不在分解状态")}else if(!1===this.isLayering[this.buildingName])return void console.warn("该建筑物不在分解状态");e?(this.eventName="Pull",this.floorNum=e,this.animateNeedsUpdate=!0,this.buildingState="update"):console.warn("请输入有效楼层")}pushBuilding(e){if(void 0===this.isLayering[this.buildingName]){if(!this.isLayering.all)return void console.warn("该建筑物不在分解状态")}else if(!this.isLayering[this.buildingName])return void console.warn("该建筑物不在分解状态");e?(this.eventName="Push",this.floorNum=e,this.animateNeedsUpdate=!0,this.buildingState="update"):console.warn("请输入有效楼层")}hideBuildings(e){Array.isArray(e)?(this.eventName="Hide",this.floorNum=e,this.animateNeedsUpdate=!0,this.buildingState="update"):console.error("numbers必须为数组")}showBuildings(e){Array.isArray(e)?(this.eventName="Show",this.floorNum=e,this.animateNeedsUpdate=!0,this.buildingState="update"):console.error("numbers必须为数组")}hideAboveFloor(e){0!==e&&(this.eventName="HideAboveFloor",this.floorNum=e,this.animateNeedsUpdate=!0,this.buildingState="update")}showAll(){this.eventName="ShowAll",this.animateNeedsUpdate=!0,this.buildingState="update"}hideAll(){this.eventName="HideAll",this.animateNeedsUpdate=!0,this.buildingState="update"}toJSON(){return{type:this.type,name:this.name,uuid:this.uuid,BuildingName:this.buildingName,LayeringHeight:this.layeringHeight,LayeringBaseHeight:this.layeringBaseHeight,FloorPullDir:this.floorPullDir,FloorNum:this.floorNum,EventName:this.eventName,materialNeedsUpdate:this.materialNeedsUpdate,animateNeedsUpdate:this.animateNeedsUpdate,BuildingState:this.buildingState,HiddenDefault:this.hiddenDefault}}}class MockCarStream extends Shape{constructor(e={}){super(e),this.type="MockCarStream",this.renderNum=void 0===e.renderNum?20:e.renderNum,this.enableTrigger=void 0!==e.enableTrigger&&e.enableTrigger;let t=e.runOnTheGround||!1,i=e.lanesNumber||1,s=e.forwardInterval||1e3,a=e.forwardSpeed||200,o=e.splineLoop||!1,n=e.randomBool||!1,r=e.randomForwardOffset||0,l=e.laneWidth||300,h=e.rotationOffset||0,d=e.scaleOffset||{x:1,y:1,z:1};Object.defineProperties(this,{runOnTheGround:{enumerable:!0,get:()=>t,set:e=>{t!==e&&(t=e,this.materialNeedsUpdate=!0)}},lanesNumber:{enumerable:!0,get:()=>i,set:e=>{i!==e&&(i=e,this.materialNeedsUpdate=!0)}},forwardInterval:{enumerable:!0,get:()=>s,set:e=>{s!==e&&(s=e,this.materialNeedsUpdate=!0)}},forwardSpeed:{enumerable:!0,get:()=>a,set:e=>{a!==e&&(a=e,this.materialNeedsUpdate=!0)}},splineLoop:{enumerable:!0,get:()=>o,set:e=>{o!==e&&(o=e,this.materialNeedsUpdate=!0)}},randomBool:{enumerable:!0,get:()=>n,set:e=>{n!==e&&(n=e,this.materialNeedsUpdate=!0)}},randomForwardOffset:{enumerable:!0,get:()=>r,set:e=>{r!==e&&(r=e,this.materialNeedsUpdate=!0)}},laneWidth:{enumerable:!0,get:()=>l,set:e=>{l!==e&&(l=e,this.materialNeedsUpdate=!0)}},rotationOffset:{enumerable:!0,get:()=>h,set:e=>{h!==e&&(h=e,this.materialNeedsUpdate=!0)}},scaleOffset:{enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}}})}toJSON(e=0){return{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},EnableTrigger:this.enableTrigger,type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},RunOnTheGround:this.runOnTheGround,LanesNumber:this.lanesNumber,ForwardInterval:this.forwardInterval,ForwardSpeed:this.forwardSpeed,SplineLoop:this.splineLoop,RandomBool:this.randomBool,RandomForwardOffset:this.randomForwardOffset,LaneWidth:this.laneWidth,RotationOffset:this.rotationOffset,ScaleOffset:this.scaleOffset,jsondata:this.data,RenderNum:this.renderNum}}}const cR=[{r:.685325,g:1,b:.298996},{r:.963023,g:1,b:.198688},{r:1,g:.710181,b:.235817},{r:1,g:.440705,b:.156314},{r:1,g:.310357,b:.150163},{r:1,g:.219426,b:.155697}];class SlopeAnalysis extends Shape{constructor(e={}){super(e),this.type="SlopeAnalysis";let t=e.range||null,i=testAngle(e.minAngle,!0),s=testAngle(e.maxAngle,!1),a=testColorRange(e.colorRange),o=e.useSlopeAnalysis||!1,n=e.tilePathFieldName||"";Object.defineProperties(this,{tilePathFieldName:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},range:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},minAngle:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=testAngle(e,!0),this.materialNeedsUpdate=!0}},maxAngle:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=testAngle(e,!1),this.materialNeedsUpdate=!0}},colorRange:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=testColorRange(e),this.materialNeedsUpdate=!0}},useSlopeAnalysis:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{(o=e)&&(this.materialNeedsUpdate=!0)}}})}toJSON(e=0){return{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,jsonData:this.range,MinAngle:this.minAngle,MaxAngle:this.maxAngle,ColorRange:this.colorRange,UseSlopeAnalysis:Number(this.useSlopeAnalysis),TilePathFieldName:this.tilePathFieldName}}}function testColorRange(s){if(s&&s instanceof Object){let t=0,i=0;for(const e in s)i=e,t++;if(0===i)return{25:cR[0],40:cR[1],55:cR[2],70:cR[3],80:cR[4],90:cR[5]};for(let e=t;e<6;e++)i<25?s[i=40]=cR[1]:i<40.00001?s[i=55]=cR[2]:i<55.00001?s[i=70]=cR[3]:i<70.00001?s[i=80]=cR[4]:i<80.00001?s[i=90]=cR[5]:i<90.00001?s[i=91]=cR[5]:s[i+=e]=cR[5];return s}return{25:cR[0],40:cR[1],55:cR[2],70:cR[3],80:cR[4],90:cR[5]}}function testAngle(e=0,t=!0){return t?e<=0?0:e:e<=0?90:e}class ClusterPoint extends Shape{constructor(e={}){super(e),this.pointType="pointType"in e?e.pointType.toLowerCase():"iconpoint";var t=e.pointStyle||{};t.renderType=0,t.openCollision=!1,this.pointJSON=switchPointType(this.pointType,t),this.clusterStyle=e.clusterStyle||{};for(const a in this.clusterStyle){var i=this.clusterStyle[a];this.clusterStyle[a]=switchPointType(this.pointType,i)}let s=e.minPixelDistance||100;this.type="ClusterPoint",Object.defineProperties(this,{minPixelDistance:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e=Number(e);e&&s!==e&&(s=e,this.materialNeedsUpdate=!0)}}})}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,MinPixelDistance:this.minPixelDistance,PointJSON:this.pointJSON,PointType:this.pointType,ClusterStyle:this.clusterStyle}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.size=e.size,super.copy(e,t),this}}function switchPointType(e,t){let i;switch(e){case"basiclabel":i=new BasicLabel(t).toJSON();case"iconpoint":i=new IconPoint(t).toJSON();case"textpoint":i=new TextPoint(t).toJSON();default:i=new IconPoint(t).toJSON()}return t.clusterText&&(i.ClusterText=t.clusterText),i}class InfoLightLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}constructor(e){super(e),this.type="UserInfoLightLayer",this.url=e.url,this.header=e.header;let t=void 0===e.brightness?1:e.brightness;this.lightAltitude=void 0===e.lightAltitude?1:e.lightAltitude,this.renderScale=void 0===e.renderScale?1:e.renderScale,this.renderTilesNum=void 0===e.renderTilesNum?3:e.renderTilesNum,this.updateCheckInterval=void 0===e.updateCheckInterval?2:e.updateCheckInterval,this.maxUpdateHeight=void 0===e.maxUpdateHeight?1e3:e.maxUpdateHeight,this.centerDetectDistance=void 0===e.centerDetectDistance?3e3:e.centerDetectDistance,this.rayDetection={enable:!1,distance:0,displacementHeight:0},e.rayDetection&&(this.rayDetection.enable=void 0!==e.rayDetection.enable&&e.rayDetection.enable,this.rayDetection.distance=void 0===e.rayDetection.distance?0:e.rayDetection.distance,this.rayDetection.displacementHeight=void 0===e.rayDetection.displacementHeight?0:e.rayDetection.displacementHeight),this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.offset=new Vector3,Object.defineProperties(this,{brightness:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}}})}dispose(){return!1}toJSON(e=0){return{Url:this.url,Header:this.header,RenderScale:this.renderScale,LightAltitude:this.lightAltitude,CenterDetectDistance:this.centerDetectDistance,RayDetection:this.rayDetection,Brightness:this.brightness,RenderTilesNum:this.renderTilesNum,UpdateCheckInterval:this.updateCheckInterval,MaxUpdateHeight:this.maxUpdateHeight,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid}}}class RoutePlan extends Line{constructor(e={}){super(e),this.name=e.name||"",this.type="RoutePlan";let t=e.url;this.messageNeedsUpdate=!1,Object.defineProperties(this,{url:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e,this.messageNeedsUpdate=!0)}}})}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},URL:this.url,Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Collision:this.collision,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Style:this.style,Spline_Type:this.splineType,MeshDirection:this.direction,RenderType:this.renderType,Section_Length:this.section_Length,Width:this.width,Tilling:this.tilling,Speed:this.speed,Open_Stroke:this.openStroke,Stroke_Color:this.strokeColor?{r:this.strokeColor.r,g:this.strokeColor.g,b:this.strokeColor.b,a:1}:null,Stroke_Width:this.strokeWidth,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,LineUVOption:this.lineUVOption,colordata:this.colordata}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.style=e.style,this.splineType=e.splineType,this.direction=e.direction,this.width=e.width,this.tilling=e.tilling,this.speed=e.speed,this.openStroke=e.openStroke,this.strokeColor=e.strokeColor,this.strokeWidth=e.strokeWidth,super.copy(e,t),this}}class Light extends Shape{constructor(e={}){super(e),this.visible=void 0===e.visible||e.visible,this.lightType=void 0===e.lightType?"PointLight":e.lightType,this.pointLightStyle=void 0===e.pointLightStyle?{intensity:8,color:{r:1,g:1,b:1}}:e.pointLightStyle,this.spotLightStyle=void 0===e.spotLightStyle?{intensity:8,color:{r:1,g:1,b:1},innerConeAngle:0,outerConeAngle:44}:e.spotLightStyle,this.rectLightStyle=void 0===e.rectLightStyle?{intensity:8,color:{r:1,g:1,b:1},barnDoorAngle:88,barnDoorlength:20}:e.rectLightStyle,this.type="Light"}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return e&&this.visibleNeedsUpdate&&!this.materialNeedsUpdate?{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid}:{Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,LightType:this.lightType,PointLightStyle:this.pointLightStyle,SpotLightStyle:this.spotLightStyle,RectLightStyle:this.rectLightStyle,visible:this.visible}}copy(e,t=!0){return this.fontWeight=e.fontWeight,this.fontSize=e.fontSize,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.shadowColor=e.shadowColor,this.shadowOffset=e.shadowOffset,super.copy(e,t),this}}export{AssetLayer,AutonomousVehicleLayer,BasicLabel,Bucket,CarPark,Circle,CloudRenderApp as CloudRenderEngine,ClusterPoint,CommonConstant,Cone,ConstructionLayer,Cube,Cylinder,Decal,Diamond,DiamondSign,FlashCar,FlashCarCrash,FlashPeople,Heatmap,I3DTileLayer,IconPoint,InfoLightLayer,Inundation,LayerBuilding,Light,Line,MockCarStream,ODLine,Particle,Plane,Point,Polygon,QuadPyramid,QuadPyramidTop,Radar,Ripple,RoadCondition,RoadName,RoutePlan,Shape,Skyline,SlopeAnalysis,Soil,Sphere,TextPoint,Torus,TrafficCone,TrafficLayer,TrafficLightLayer,TrafficShape,TriangleWarning,Tube,UltralDynamicSky,VisualField,WebViewPoint,convertCanvas2Base64,drawCanvas,drawTextToImage,loadImageAsBase64};
1
+ import{Vector2,Vector3,Quaternion,Matrix4,MathUtils,Euler,Matrix3,Layers,FileLoader,Color as Color$1,Group,MeshBasicMaterial,PlaneBufferGeometry,Mesh,SpriteMaterial,Sprite}from"three";import earcut from"earcut";import{Tween,update}from"@tweenjs/tween.js";import axios from"axios";import h337 from"@mars3d/heatmap.js";const UDS={CLEAR_SKIES:"clearSkies",PARTLY_CLOUDY:"partlyCloudy",CLOUDY:"cloudy",FOGGY:"foggy",OVERCAST:"overcast",RAIN:"rain",LIGHT_RAIN:"lightRain",THUNDER_STORM:"thunderstorm",SNOW:"snow",LIGHT_SNOW:"lightSnow",BLIZZARD:"blizzard",SAND_DUST_CALM:"sandDustCalm",SAND_DUST_STORM:"sandDustStorm"},SkyMode={VOLUMETRIC_CLOUDS:"Volumetric Clouds",STATIC_CLOUDS:"Static Clouds",DYNAMIC_CLOUDS:"2D Dynamic Clouds",NO_CLOUDS:"No Clouds",VOLUMETRIC_AURORA:"Volumetric Aurora"},SkyColorMode={SKY_ATMOSPHERE:"Sky Atmosphere",SIMPLIFIED_COLOR:"Simplified Color"},InteractMOD={SET_MOUSE_CURSOR_SHOW:"setMouseCursorShow",SET_CLICK_EVENT:"setClickEvent",SET_EDIT_STATUS:"setEditStatus",SWITCH_EDIT_MODE:"switchEditMode",SAVE_EDIT_RESULT:"saveEditResult",ZOOM_IN:"zoomIn",ZOOM_OUT:"zoomOut",EXIT:"exitClient",ENABLE_TERRAIN:"enableTerrain",ENABLE_POI:"enablePOIByTag",PRELOAD_LOCATION:"preLoadLocation",FOCUS_ACTOR_BY_ID:"focusActorByID",ENABLE_DATALAYER:"Scene_enableDataLayerByName",ENABLE_FPS:"Scene_setFPS",OBJECT_BOUNDINGBOX:"Interact_objectBoundingBox",ASSET_MODEL:"Gis_generateAssetModel",BUILD_GROWTHANIMATE:"Interact_buildGrowth"},CameraControl={NAVIGATION:"Camera_navigation",NAVIGATION_PAUSE:"Camera_navigationPause",NAVIGATION_STOP:"Camera_navigationStop",MOVE_TO:"Camera_moveTo",ZOOM_IN:"Camera_zoomIn",ZOOM_OUT:"Camera_zoomOut",PROJECT:"Camera_project",UNPROJECT:"Camera_unproject",UPDATE:"Camera_update",FOCUS_ON:"Camera_focusOn",Constrain_Shape:"Camera_constrainShape",MOVE:"Camera_move",ROTATE:"Camera_rotate",RESET_CAMERA_FOCUS:"Camera_resetCameraFocus"},SceneControl={ENABLE_3DTILES_BY_NAME:"Scene_enableTilesByName",SWITCH_TERRAIN_MODE:"Scene_switchTerrainMode",HIDDEN_3DTILES_ITEM:"Scene_hiddenTilesItem",EVENT_LAYER_BUILDING:"Scene_eventLayerBuilding",UPDATA_SLOPE_ANALYSIS:"Scene_updateSlopeAnalysis",GET_ALTITUDE:"Scene_getAltitude"},ApplicationControl={EXIT_CLIENT:"Application_exitClient",RESTART_LEVEL:"Application_restartLevel",RESTART_GAME:"Application_restartGame",CREATE_TRAFFIC_STREAM:"Application_createTrafficStream",CLOSE_TRAFFIC_STREAM:"Application_closeTrafficStream",FOLLOW_TRAFFIC_STREAM_ITEM:"Application_followTrafficStreamItem",ADD_EVENT_LISTENER:"Application_addEvent",REMOVE_EVENT_LISTENER:"Application_removeEvent",RESET_WORLD_CENTER:"Application_resetWorldCenter",CONSOLE_COMMAND:"Application_ConsoleCommand"},GisControl={ADD:"Gis_AddCommonGISLayer",REMOVE:"Gis_RemoveCommonGISLayer",DESTORY:"Gis_DestoryCommonGISLayer",DESTORY_ALL:"Gis_DestoryAllGenerationLayer",UPDATE:"Gis_UpdateCommonGISLayer",VISIBLE:"Gis_VisibleCommonGISLayer"},DrawAndMeasureControl={ENABLE_DRAW:"Gis_enableDraw",CLOSE_DRAW:"Gis_closeDraw",ENABLE_MEASURE:"Gis_enableMeasure",CLOSE_MEASURE:"Gis_closeMeasure",DESTORY_DRAW:"Gis_clearDraw",DESTORY_MEASURE:"Gis_clearMeasure"},LineTypeOptions={SOLID:"solid",DASHED:"dashed",ARROW:"arrow",GRADIENT:"gradient"},LineDirectionOptions={CENTER:"Ground_Center",STAND:"Stand",SIDE:"Cylinder"},LineSplineTypeOptions={LINEAR:"Linear",CURVE:"Curve",CONSTANT:"Constant"},WS_OPEN_STATE=1,ToClientMessageType={QualityControlOwnership:0,Response:1,Command:2,FreezeFrame:3,UnfreezeFrame:4,VideoEncoderAvgQP:5,LatencyTest:6,InitialSettings:7,FileExtension:8,FileMimeType:9,FileContents:10,Mouse:21,Keyboard:22,InputControlOwnership:12,Protocol:255},ControlSchemeType={LockedMouse:0,HoveringMouse:1},inputOptions={controlScheme:ControlSchemeType.HoveringMouse,suppressBrowserKeys:!1,fakeMouseWithTouches:!1},MessageType={IFrameRequest:0,RequestQualityControl:1,FpsRequest:2,AverageBitrateRequest:3,StartStreaming:4,StopStreaming:5,LatencyTest:6,RequestInitialSettings:7,UIInteraction:50,Command:51,KeyDown:60,KeyUp:61,KeyPress:62,MouseEnter:70,MouseLeave:71,MouseDown:72,MouseUp:73,MouseMove:74,MouseWheel:75,TouchStart:80,TouchEnd:81,TouchMove:82,GamepadButtonPressed:90,GamepadButtonReleased:91,GamepadAnalog:92},MouseButton={MainButton:0,AuxiliaryButton:1,SecondaryButton:2,FourthButton:3,FifthButton:4},MouseButtonsMask={PrimaryButton:1,SecondaryButton:2,AuxiliaryButton:4,FourthButton:8,FifthButton:16},SpecialKeyCodes={BackSpace:8,Shift:16,Control:17,Alt:18,RightShift:253,RightControl:254,RightAlt:255},ParticleKind={FIRE_BIG:"P_Fire_Big",FIRE_SMALL:"P_Fire_Small",FIRE_FLAMETHROWER:"P_Flamethrower",SMOKE_SMALL_BLACK:"P_Smoke_A",SMOKE_BIG_BLACK:"P_Smoke_B",SMOKE_SMALL_YELLOW:"P_Smoke_C",SMOKE_BIG_YELLOW:"P_Smoke_D",SPARK_A:"P_Sparks_E",FOG_MASS:"P_Mass_Fog",NS_Spark:"NS_Spark",NS_Firefly:"NS_Firefly"};var CommonConstant=Object.freeze({__proto__:null,UDS:UDS,InteractMOD:InteractMOD,WS_OPEN_STATE:WS_OPEN_STATE,ToClientMessageType:ToClientMessageType,ControlSchemeType:ControlSchemeType,inputOptions:inputOptions,MessageType:MessageType,MouseButton:MouseButton,MouseButtonsMask:MouseButtonsMask,SpecialKeyCodes:SpecialKeyCodes,GisControl:GisControl,DrawAndMeasureControl:DrawAndMeasureControl,LineTypeOptions:LineTypeOptions,LineDirectionOptions:LineDirectionOptions,LineSplineTypeOptions:LineSplineTypeOptions,ParticleKind:ParticleKind,CameraControl:CameraControl,ApplicationControl:ApplicationControl,SkyMode:SkyMode,SkyColorMode:SkyColorMode,SceneControl:SceneControl});class UltralDynamicSky{constructor(e,t={}){this.cloudRender=e,this.weather=t.weather||UDS.PARTLY_CLOUDY,this.hour=t.hour||8,this.minute=t.minute||10,this.init()}changeWeather(e){!e||Object.values(UDS).indexOf(e)<0||(this.weather=e,this.cloudRender.emitUIInteraction({excuteName:"Scene_changeWeather",params:{WeatherType:e}}))}changeTime(e=10,t=10){this.hour=e,this.minute=Math.floor(10*t/6);e=this.hour<10?"0"+this.hour:""+this.hour,t=this.minute<10?"0"+this.minute:""+this.minute;this.cloudRender.emitUIInteraction({excuteName:"Scene_changeTime",params:{Time:e+t}})}setVolumeFog(e,t=1e3){t=Math.max(Math.min(1e5,t),10);this.cloudRender.emitUIInteraction({excuteName:"Scene_setVolumenFog",params:{Enable:e,Distance:100*t}})}setAtmosphericFog(e=.0075){e=Math.max(Math.min(1,e),0);this.cloudRender.emitUIInteraction({excuteName:"Scene_setBaseFog",params:{BaseFogDensity:e}})}setSkyMode(e){return!(!e||Object.values(SkyMode).indexOf(e)<0)&&void this.cloudRender.emitUIInteraction({excuteName:"Scene_setSkyMode",params:{SkyMode:e}})}setSkyColorMode(e){return!(!e||Object.values(SkyColorMode).indexOf(e)<0)&&void this.cloudRender.emitUIInteraction({excuteName:"Scene_setSkyColorMode",params:{SkyColorMode:e}})}changeWeatherEffectParameters(e){this.cloudRender.emitUIInteraction({excuteName:"Scene_changeWeatherEffects",params:JSON.stringify(e)})}init(){this.changeWeather(this.weather),this.changeTime(this.hour,this.minute)}}const webRtcPlayer=function(e){this.forceTURN=(e=void 0!==e?e:{}).forceTURN;let r=this;var t=new URLSearchParams(window.location.search),e=(this.cfg=void 0!==e.peerConnectionOptions?e.peerConnectionOptions:{},this.cfg.sdpSemantics="unified-plan",this.cfg.offerExtmapAllowMixed=!1,t.has("ForceTURN")&&(this.forceTURN=t.has("ForceTURN")),this.forceTURN&&(console.log("Forcing TURN usage by setting ICE Transport Policy in peer connection config."),this.cfg.iceTransportPolicy="relay"),this.cfg.bundlePolicy="balanced",this.forceMaxBundle=t.has("ForceMaxBundle"),this.forceMaxBundle&&(this.cfg.bundlePolicy="max-bundle"),this.pcClient=null,this.dcClient=null,this.tnClient=null,this.sdpConstraints={offerToReceiveAudio:1,offerToReceiveVideo:1,voiceActivityDetection:!1},this.dataChannelOptions={ordered:!0,maxPacketLifeTime:3e3},this.startVideoMuted=void 0!==e.startVideoMuted&&e.startVideoMuted,this.autoPlayAudio=void 0===e.autoPlayAudio||e.autoPlayAudio,this.useMic=t.has("useMic"),this.useMic||console.log("Microphone access is not enabled. Pass ?useMic in the url to enable it."),"localhost"===location.hostname||"127.0.0.1"===location.hostname),i="https:"===location.protocol;function s(e){e.onsignalingstatechange=o,e.oniceconnectionstatechange=n,e.onicegatheringstatechange=l,e.ontrack=h,e.onicecandidate=m,e.ondatachannel=c}async function a(e){var t=0<e.getTransceivers().length;if(e.addTransceiver("video",{direction:"recvonly"}),r.useMic){var i=!!r.useMic&&{autoGainControl:!1,channelCount:1,echoCancellation:!1,latency:0,noiseSuppression:!1,sampleRate:48e3,volume:1},s=await navigator.mediaDevices.getUserMedia({video:!1,audio:i});if(s)if(t){for(var a of e.getTransceivers())if(a&&a.receiver&&a.receiver.track&&"audio"===a.receiver.track.kind)for(const o of s.getTracks())o.kind&&"audio"==o.kind&&(a.sender.replaceTrack(o),a.direction="sendrecv")}else for(const n of s.getTracks())n.kind&&"audio"==n.kind&&e.addTransceiver(n,{direction:"sendrecv"});else e.addTransceiver("audio",{direction:"recvonly"})}else e.addTransceiver("audio",{direction:"recvonly"})}!this.useMic||e||i||(this.useMic=!1,console.error("Microphone access in the browser will not work if you are not on HTTPS or localhost. Disabling mic access."),console.error("For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'")),this.preferSFU=t.has("preferSFU"),console.log(this.preferSFU?"The browser will signal it would prefer an SFU connection. Remove ?preferSFU from the url to signal for P2P usage.":"The browser will signal for a P2P connection. Pass ?preferSFU in the url to signal for SFU usage."),this.latencyTestTimings={TestStartTimeMs:null,UEReceiptTimeMs:null,UEEncodeMs:null,UECaptureToSendMs:null,UETransmissionTimeMs:null,BrowserReceiptTimeMs:null,FrameDisplayDeltaTimeMs:null,Reset:function(){this.TestStartTimeMs=null,this.UEReceiptTimeMs=null,this.UEEncodeMs=null,this.UECaptureToSendMs=null,this.UETransmissionTimeMs=null,this.BrowserReceiptTimeMs=null,this.FrameDisplayDeltaTimeMs=null},SetUETimings:function(e){this.UEReceiptTimeMs=e.ReceiptTimeMs,this.UEEncodeMs=e.EncodeMs,this.UECaptureToSendMs=e.CaptureToSendMs,this.UETransmissionTimeMs=e.TransmissionTimeMs,this.BrowserReceiptTimeMs=Date.now(),this.OnAllLatencyTimingsReady(this)},SetFrameDisplayDeltaTime:function(e){null==this.FrameDisplayDeltaTimeMs&&(this.FrameDisplayDeltaTimeMs=Math.round(e),this.OnAllLatencyTimingsReady(this))},OnAllLatencyTimingsReady:function(e){}},this.createWebRtcVideo=function(){let i=document.createElement("video");if(i.id="streamingVideo",i.playsInline=!0,i.disablepictureinpicture=!0,i.muted=r.startVideoMuted,i.addEventListener("loadedmetadata",function(e){r.onVideoInitialised&&r.onVideoInitialised()},!0),"requestVideoFrameCallback"in HTMLVideoElement.prototype){const s=(e,t)=>{t.receiveTime&&t.expectedDisplayTime&&(t=t.presentationTime-t.receiveTime,r.aggregatedStats||(r.aggregatedStats={}),r.aggregatedStats.receiveToCompositeMs=t),i.requestVideoFrameCallback(s)};i.requestVideoFrameCallback(s)}return i},this.video=this.createWebRtcVideo(),this.availableVideoStreams=new Map;const o=function(e){console.info("Signaling state change. |",e.srcElement.signalingState,"|")},n=function(e){console.info("Browser ICE connection |",e.srcElement.iceConnectionState,"|")},l=function(e){console.info("Browser ICE gathering |",e.srcElement.iceGatheringState,"|")},h=function(e){if(e.track&&console.log("Got track. | Kind="+e.track.kind+" | Id="+e.track.id+" | readyState="+e.track.readyState+" |"),"audio"==e.track.kind)d(e.streams[0]);else{e.track.kind;for(const t of e.streams)r.availableVideoStreams.has(t.id)||r.availableVideoStreams.set(t.id,t);r.video.srcObject=e.streams[0],e.track.onunmute=()=>{r.video.srcObject=e.streams[0],r.onNewVideoTrack(e.streams)}}},d=function(e){if(r.video.srcObject!=e&&r.video.srcObject&&r.video.srcObject!==e){let t=document.createElement("Audio");if(t.srcObject=e,r.autoPlayAudio)t.play();else{let e=function(){t.play(),r.video.removeEventListener("click",e)};r.video.addEventListener("click",e)}console.log("Created new audio element to play seperate audio stream.")}},c=function(e){console.log("Data channel created for us by browser as we are a receiving peer."),r.dcClient=e.channel,p(r.dcClient)},u=function(e){for(var t,i=new Array,s=e.length,a=0;a<s;a++)65536<=(t=e.charCodeAt(a))&&t<=1114111?(i.push(t>>18&7|240),i.push(t>>12&63|128),i.push(t>>6&63|128),i.push(63&t|128)):2048<=t&&t<=65535?(i.push(t>>12&15|224),i.push(t>>6&63|128),i.push(63&t|128)):128<=t&&t<=2047?(i.push(t>>6&31|192),i.push(63&t|128)):i.push(255&t);return new Uint8Array(i).buffer},p=function(e){try{return e.binaryType="arraybuffer",e.onopen=function(e){console.log("Data channel connected"),r.onDataChannelConnected&&r.onDataChannelConnected()},e.onclose=function(e){console.log("Data channel connected",e)},e.onmessage=function(e){var t;r.onDataChannelMessage&&("string"==typeof e.data?(t=u(e.data),r.onDataChannelMessage(t)):r.onDataChannelMessage(e.data))},e.onerror=function(e){console.error("Data channel error",e)},e}catch(e){return console.warn("No data channel",e),null}},m=function(e){e=e.candidate;e&&e.candidate&&(console.log("%c[Browser ICE candidate]","background: violet; color: black","| Type=",e.type,"| Protocol=",e.protocol,"| Address=",e.address,"| Port=",e.port,"|"),r.onWebRtcCandidate(e))},g=function(e){e.sdp=e.sdp.replace("useinbandfec=1","useinbandfec=1;stereo=1;sprop-maxcapturerate=48000")};this.setVideoEnabled=function(t){r.video.srcObject.getTracks().forEach(e=>e.enabled=t)},this.startLatencyTest=function(e){r.video&&(r.latencyTestTimings.Reset(),r.latencyTestTimings.TestStartTimeMs=Date.now(),e(r.latencyTestTimings.TestStartTimeMs))},this.handleCandidateFromServer=function(e){e=new RTCIceCandidate(e);console.log("%c[Unreal ICE candidate]","background: pink; color: black","| Type=",e.type,"| Protocol=",e.protocol,"| Address=",e.address,"| Port=",e.port,"|"),r.forceTURN&&e.candidate.indexOf("relay")<0?console.warn("Dropping candidate because it was not TURN relay.","| Type=",e.type,"| Protocol=",e.protocol,"| Address=",e.address,"| Port=",e.port,"|"):r.pcClient.addIceCandidate(e).catch(function(e){console.error("Failed to add ICE candidate",e)})},this.createOffer=function(){r.pcClient&&(console.log("Closing existing PeerConnection"),r.pcClient.close(),r.pcClient=null),r.pcClient=new RTCPeerConnection(r.cfg),s(r.pcClient),a(r.pcClient).finally(function(){var t;r.dcClient=function(e,t,i){e=e.createDataChannel(t,i);return console.log(`Created datachannel (${t})`),p(e),e}(r.pcClient,"cirrus",r.dataChannelOptions),(t=r.pcClient).createOffer(r.sdpConstraints).then(function(e){g(e),t.setLocalDescription(e),r.onWebRtcOffer&&r.onWebRtcOffer(e)},function(){console.warn("Couldn't create offer")})})},this.receiveOffer=function(e){e=new RTCSessionDescription(e);r.pcClient||(console.log("Creating a new PeerConnection in the browser."),r.pcClient=new RTCPeerConnection(r.cfg),s(r.pcClient),r.pcClient.setRemoteDescription(e).then(()=>{a(r.pcClient).finally(function(){r.pcClient.createAnswer().then(e=>r.pcClient.setLocalDescription(e)).then(()=>{r.onWebRtcAnswer&&r.onWebRtcAnswer(r.pcClient.currentLocalDescription)}).then(()=>{var e;for(e of r.pcClient.getReceivers())e.playoutDelayHint=0}).catch(e=>console.error("createAnswer() failed:",e))})}))},this.receiveAnswer=function(e){var t,e=new RTCSessionDescription(e),e=(r.pcClient.setRemoteDescription(e),r.pcClient.getReceivers());for(t of e)t.playoutDelayHint=0},this.close=function(){r.pcClient&&(console.log("Closing existing peerClient"),r.pcClient.close(),r.pcClient=null),r.aggregateStatsIntervalId&&clearInterval(r.aggregateStatsIntervalId)},this.send=function(e){if(r.dcClient&&"open"==r.dcClient.readyState)try{r.dcClient.send(e)}catch(e){console.error("dcClient.send error: ",e)}},this.getStats=function(t){r.pcClient&&t&&r.pcClient.getStats(null).then(e=>{t(e)})},this.aggregateStats=function(e){r.aggregatedStats||(r.aggregatedStats={});let t=function(e){let t={};e.forEach(e=>{"inbound-rtp"!=e.type||e.isRemote||"video"!=e.mediaType&&!e.id.toLowerCase().includes("video")||(t.timestamp=e.timestamp,t.bytesReceived=e.bytesReceived,t.framesDecoded=e.framesDecoded,t.packetsLost=e.packetsLost,t.bytesReceivedStart=r.aggregatedStats&&r.aggregatedStats.bytesReceivedStart?r.aggregatedStats.bytesReceivedStart:e.bytesReceived,t.framesDecodedStart=r.aggregatedStats&&r.aggregatedStats.framesDecodedStart?r.aggregatedStats.framesDecodedStart:e.framesDecoded,t.timestampStart=r.aggregatedStats&&r.aggregatedStats.timestampStart?r.aggregatedStats.timestampStart:e.timestamp,r.aggregatedStats&&r.aggregatedStats.timestamp&&(r.aggregatedStats.bytesReceived&&(t.bitrate=8*(t.bytesReceived-r.aggregatedStats.bytesReceived)/(t.timestamp-r.aggregatedStats.timestamp),t.bitrate=Math.floor(t.bitrate),t.lowBitrate=r.aggregatedStats.lowBitrate&&r.aggregatedStats.lowBitrate<t.bitrate?r.aggregatedStats.lowBitrate:t.bitrate,t.highBitrate=r.aggregatedStats.highBitrate&&r.aggregatedStats.highBitrate>t.bitrate?r.aggregatedStats.highBitrate:t.bitrate),r.aggregatedStats.bytesReceivedStart&&(t.avgBitrate=8*(t.bytesReceived-r.aggregatedStats.bytesReceivedStart)/(t.timestamp-r.aggregatedStats.timestampStart),t.avgBitrate=Math.floor(t.avgBitrate)),r.aggregatedStats.framesDecoded&&(t.framerate=(t.framesDecoded-r.aggregatedStats.framesDecoded)/((t.timestamp-r.aggregatedStats.timestamp)/1e3),t.framerate=Math.floor(t.framerate),t.lowFramerate=r.aggregatedStats.lowFramerate&&r.aggregatedStats.lowFramerate<t.framerate?r.aggregatedStats.lowFramerate:t.framerate,t.highFramerate=r.aggregatedStats.highFramerate&&r.aggregatedStats.highFramerate>t.framerate?r.aggregatedStats.highFramerate:t.framerate),r.aggregatedStats.framesDecodedStart)&&(t.avgframerate=(t.framesDecoded-r.aggregatedStats.framesDecodedStart)/((t.timestamp-r.aggregatedStats.timestampStart)/1e3),t.avgframerate=Math.floor(t.avgframerate))),"track"!=e.type||"video_label"!=e.trackIdentifier&&"video"!=e.kind||(t.framesDropped=e.framesDropped,t.framesReceived=e.framesReceived,t.framesDroppedPercentage=e.framesDropped/e.framesReceived*100,t.frameHeight=e.frameHeight,t.frameWidth=e.frameWidth,t.frameHeightStart=r.aggregatedStats&&r.aggregatedStats.frameHeightStart?r.aggregatedStats.frameHeightStart:e.frameHeight,t.frameWidthStart=r.aggregatedStats&&r.aggregatedStats.frameWidthStart?r.aggregatedStats.frameWidthStart:e.frameWidth),"candidate-pair"==e.type&&e.hasOwnProperty("currentRoundTripTime")&&0!=e.currentRoundTripTime&&(t.currentRoundTripTime=e.currentRoundTripTime)}),r.aggregatedStats.receiveToCompositeMs&&(t.receiveToCompositeMs=r.aggregatedStats.receiveToCompositeMs,r.latencyTestTimings.SetFrameDisplayDeltaTime(r.aggregatedStats.receiveToCompositeMs)),r.aggregatedStats=t,r.onAggregatedStats&&r.onAggregatedStats(t)};r.aggregateStatsIntervalId=setInterval(()=>{r.getStats(t)},e)}};function styleInject(e,t){var i,s,t=(t=void 0===t?{}:t).insertAt;e&&"undefined"!=typeof document&&(i=document.head||document.getElementsByTagName("head")[0],(s=document.createElement("style")).type="text/css","top"===t&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e)))}var css_248z="/* 视频流送的视频组件样式 */\nvideo {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n\n/* 视频流送的整体根组件属性 */\n#player {\n width: 100%;\n height: 100%;\n position: relative;\n background-color: #000;\n}\n\n/* 如果不是链接后直接加载(即connect_on_load: false)那么便会显示该画面,用于配置显示蒙版的样式 */\n#videoPlayOverlay {\n z-index: 30;\n position: absolute;\n font-size: 1.8em;\n width: 100%;\n height: 100%;\n color: white;\n background-color: rgba(100, 100, 100, .7);\n}\n\n/* State for element to be clickable */\n/* 待开始页面显示状态的样式 */\n.clickableState {\n align-items: center;\n justify-content: center;\n display: flex;\n cursor: pointer;\n}\n\n.textDisplayState {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n/* State to hide overlay, WebRTC communication is in progress and or is playing */\n/* 待开始页面隐藏 */\n.hiddenState {\n display: none;\n}\n\n/* 如果不是链接后直接加载(即connect_on_load: false)那么便会显示该按钮文字,用于配置显示样式 */\n#playButton {\n display: inline-block;\n height: auto;\n}";styleInject(css_248z);class EventDispatcher{addEventListener(e,t){void 0===this._listeners&&(this._listeners={}),this._needsDispatchedToUE=!1;var i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&(i[e].push(t),this._needsDispatchedToUE=!0,this._dispatchAddListenerTypes||(this._dispatchAddListenerTypes=[]),this._dispatchAddListenerTypes.push(e))}hasEventListener(e,t){var i;return void 0!==this._listeners&&void 0!==(i=this._listeners)[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){var i,s;void 0!==this._listeners&&(this._needsDispatchedToUE=!1,void 0!==(i=this._listeners[e]))&&-1!==(s=i.indexOf(t))&&(i.splice(s,1),this._needsDispatchedToUE=!0,this._dispatchRemoveListenerTypes||(this._dispatchRemoveListenerTypes=[]),this._dispatchRemoveListenerTypes.push(e))}dispatchEvent(i){if(void 0!==this._listeners){var e=this._listeners[i.type];if(void 0!==e){i.target=this;var s=e.slice(0);for(let e=0,t=s.length;e<t;e++)s[i.index=e].call(this,i);i.target=null}}}}class EventHandler extends EventDispatcher{constructor(e){super(),this.haveEvents="GamepadEvent"in window,this.haveWebkitEvents="WebKitGamepadEvent"in window,this.cloudRenderEngine=e,this.playerElement=document.getElementById("player"),this.promiseResponses=[],this.scene=this.cloudRenderEngine.scene,this.interactiveObjects=new Map,this.blacklist=new Set,this.mousedownTime=null,this.mouse=new Vector2(0,0),this.selection=[],this.logMessages=!1,this.inputOptions=e.inputOptions,this.playerElement&&(this.playerElement.tabIndex<10&&(this.playerElement.tabIndex=1e3),this.playerElement.addEventListener("contextmenu",e=>{e.preventDefault()},!1))}updateObjectsWithEvent(){const i=new Map;this.scene&&this.scene.children.length&&this.scene.children.forEach((e,t)=>{e._listeners&&i.set(e.uuid,e)}),this.interactiveObjects.clear(),this.interactiveObjects=i}isKeyCodeBrowserKey(e){return 112<=e&&e<=123||9===e}getKeyCode(e){return e.keyCode===SpecialKeyCodes.Shift&&"ShiftRight"===e.code?SpecialKeyCodes.RightShift:e.keyCode===SpecialKeyCodes.Control&&"ControlRight"===e.code?SpecialKeyCodes.RightControl:e.keyCode===SpecialKeyCodes.Alt&&"AltRight"===e.code?SpecialKeyCodes.RightAlt:e.keyCode}registerKeyboardEvents(){const i=this;document.onkeydown=function(e){i.print_inputs&&console.log(`key down ${e.keyCode}, repeat = `+e.repeat),i.cloudRenderEngine.sendInputData(new Uint8Array([MessageType.KeyDown,i.getKeyCode(e),e.repeat]).buffer),e.keyCode===SpecialKeyCodes.BackSpace&&document.onkeypress({charCode:SpecialKeyCodes.BackSpace}),i.inputOptions.suppressBrowserKeys&&i.isKeyCodeBrowserKey(e.keyCode)&&e.preventDefault()},document.onkeyup=function(e){i.print_inputs&&console.log("key up "+e.keyCode),i.cloudRenderEngine.sendInputData(new Uint8Array([MessageType.KeyUp,i.getKeyCode(e)]).buffer),i.inputOptions.suppressBrowserKeys&&i.isKeyCodeBrowserKey(e.keyCode)&&e.preventDefault()},document.onkeypress=function(e){i.print_inputs&&console.log("key press "+e.charCode);var t=new DataView(new ArrayBuffer(3));t.setUint8(0,MessageType.KeyPress),t.setUint16(1,e.charCode,!0),i.cloudRenderEngine.sendInputData(t.buffer)}}resizePlayerStyleToFillWindow(e){var t=e.getElementsByTagName("VIDEO"),i=window.innerHeight/window.innerWidth,s=e.clientHeight/e.clientWidth,t=t.videoHeight/t.videoWidth;isNaN(t)?(this.styleWidth=window.innerWidth,this.styleHeight=window.innerHeight,this.styleTop=0,this.styleLeft=0):i<s?(this.styleWidth=Math.floor(window.innerHeight/t),this.styleHeight=window.innerHeight,this.styleTop=0,this.styleLeft=Math.floor(.5*(window.innerWidth-this.styleWidth))):(this.styleWidth=window.innerWidth,this.styleHeight=Math.floor(window.innerWidth*t),this.styleTop=Math.floor(.5*(window.innerHeight-this.styleHeight)),this.styleLeft=0),e.style="top: "+this.styleTop+"px; left: "+this.styleLeft+"px; width: "+this.styleWidth+"px; height: "+this.styleHeight+"px; cursor: "+this.styleCursor+"; "+this.styleAdditional}resizePlayerStyleToActualSize(e){var t,i=e.getElementsByTagName("VIDEO");0<i.length&&(this.styleWidth=i[0].videoWidth,this.styleHeight=i[0].videoHeight,i=Math.floor(.5*(window.innerHeight-this.styleHeight)),t=Math.floor(.5*(window.innerWidth-this.styleWidth)),this.styleTop=0<i?i:0,this.styleLeft=0<t?t:0,e.style="top: "+this.styleTop+"px; left: "+this.styleLeft+"px; width: "+this.styleWidth+"px; height: "+this.styleHeight+"px; cursor: "+this.styleCursor+"; "+this.styleAdditional)}resizePlayerStyleToArbitrarySize(e){e.style="top: 0px; left: 0px; width: "+this.styleWidth+"px; height: "+this.styleHeight+"px; cursor: "+this.styleCursor+"; "+this.styleAdditional}setupFreezeFrameOverlay(){this.cloudRenderEngine.freezeFrameOverlay=document.createElement("div"),this.cloudRenderEngine.freezeFrameOverlay.id="this.cloudRenderEngine.freezeFrameOverlay",this.cloudRenderEngine.freezeFrameOverlay.style.display="none",this.cloudRenderEngine.freezeFrameOverlay.style.pointerEvents="none",this.cloudRenderEngine.freezeFrameOverlay.style.position="absolute",this.cloudRenderEngine.freezeFrameOverlay.style.zIndex="20";var e=document.createElement("img");e.style.position="absolute",this.cloudRenderEngine.freezeFrameOverlay.appendChild(e)}showFreezeFrameOverlay(){this.cloudRenderEngine.freezeFrame.valid&&(this.cloudRenderEngine.freezeFrameOverlay.classList.add("freezeframeBackground"),this.cloudRenderEngine.freezeFrameOverlay.style.display="block")}invalidateFreezeFrameOverlay(){this.cloudRenderEngine.freezeFrameOverlay.style.display="none",this.cloudRenderEngine.freezeFrame.valid=!1,this.cloudRenderEngine.freezeFrameOverlay.classList.remove("freezeframeBackground"),this.cloudRenderEngine.webRtcPlayerObj&&this.cloudRenderEngine.webRtcPlayerObj.setVideoEnabled(!0)}resizeFreezeFrameOverlay(){if(0!==this.cloudRenderEngine.freezeFrame.width&&0!==this.cloudRenderEngine.freezeFrame.height){let e=0,t=0,i=0,s=0;var a=document.getElementById("enlarge-display-to-fill-window-tgl"),o=document.getElementById("player"),a=(s=null!==a&&a.checked?window.innerWidth/window.innerHeight<(a=this.cloudRenderEngine.freezeFrame.width/this.cloudRenderEngine.freezeFrame.height)?(e=window.innerWidth,t=Math.floor(window.innerWidth/a),i=Math.floor(.5*(window.innerHeight-t)),0):(e=Math.floor(window.innerHeight*a),t=window.innerHeight,i=0,Math.floor(.5*(window.innerWidth-e))):o.offsetWidth/o.offsetHeight<(a=this.cloudRenderEngine.freezeFrame.width/this.cloudRenderEngine.freezeFrame.height)?(e=o.offsetWidth,t=Math.floor(o.offsetWidth/a),i=Math.floor(.5*(o.offsetHeight-t)),0):(e=Math.floor(o.offsetHeight*a),t=o.offsetHeight,i=0,Math.floor(.5*(o.offsetWidth-e))),document.getElementById("this.cloudRenderEngine.freezeFrameOverlay").childNodes[0]);this.cloudRenderEngine.freezeFrameOverlay.style.width=o.offsetWidth+"px",this.cloudRenderEngine.freezeFrameOverlay.style.height=o.offsetHeight+"px",this.cloudRenderEngine.freezeFrameOverlay.style.left="0px",this.cloudRenderEngine.freezeFrameOverlay.style.top="0px",a.style.width=e+"px",a.style.height=t+"px",a.style.left=s+"px",a.style.top=i+"px"}}resizePlayerStyle(e){var t,i,s=document.getElementById("player");s&&(this.cloudRenderEngine.updateVideoStreamSize(),s.classList.contains("fixed-size")||(t=document.getElementById("enlarge-display-to-fill-window-tgl"),i=window.innerWidth<s.videoWidth||window.innerHeight<s.videoHeight,null!==t?t.checked||i?this.resizePlayerStyleToFillWindow(s):this.resizePlayerStyleToActualSize(s):this.resizePlayerStyleToArbitrarySize(s)),this.setupMouseAndFreezeFrame(s))}setupMouseAndFreezeFrame(e){this.playerElementClientRect=e.getBoundingClientRect(),this.cloudRenderEngine.setupNormalizeAndQuantize(),this.resizeFreezeFrameOverlay()}onOrientationChange(e){const t=this;clearTimeout(this._orientationChangeTimeout),this._orientationChangeTimeout=setTimeout(function(){t.resizePlayerStyle()},500)}setupHtmlEvents(){const a=this;if(window.addEventListener("resize",e=>{this.resizePlayerStyle(e)},!0),window.addEventListener("orientationchange",e=>{this.onOrientationChange(e)}),this.haveEvents?(window.addEventListener("gamepadconnected",e=>{this.gamepadConnectHandler(e)}),window.addEventListener("gamepaddisconnected",e=>{this.gamepadDisconnectHandler(e)})):this.haveWebkitEvents&&(window.addEventListener("webkitgamepadconnected",e=>{this.gamepadConnectHandler(e)}),window.addEventListener("webkitgamepaddisconnected",e=>{this.gamepadDisconnectHandler(e)})),this.cloudRenderEngine.isShowTestUI){document.getElementById("overlayButton").addEventListener("click",e=>{this.onExpandOverlay_Click(e)});var e=document.getElementById("enlarge-display-to-fill-window-tgl"),e=(null!==e&&(e.onchange=function(e){a.resizePlayerStyle()}),this.cloudRenderEngine.qualityControlOwnershipCheckBox=document.getElementById("quality-control-ownership-tgl"),null!==this.cloudRenderEngine.qualityControlOwnershipCheckBox&&(this.cloudRenderEngine.qualityControlOwnershipCheckBox.onchange=function(e){a.cloudRenderEngine.requestQualityControl()}),document.getElementById("encoder-params-submit")),e=(null!==e&&(e.onclick=function(e){var t=document.getElementById("encoder-min-qp-text").value,i=document.getElementById("encoder-max-qp-text").value;a.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.Encoder.MinQP "+t}),a.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.Encoder.MaxQP "+i})}),document.getElementById("webrtc-params-submit")),e=(null!==e&&(e.onclick=function(e){var t=document.getElementById("webrtc-fps-text").value,i=1e3*document.getElementById("webrtc-min-bitrate-text").value,s=1e3*document.getElementById("webrtc-max-bitrate-text").value;a.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.Fps "+t}),a.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.MinBitrate "+i}),a.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.MaxBitrate "+s})}),document.getElementById("show-fps-button"));null!==e&&(e.onclick=function(e){a.cloudRenderEngine.emitCommand({ConsoleCommand:"Stat FPS"})});let t=document.getElementById("match-viewport-res-tgl");null!==t&&(t.onchange=function(e){a.cloudRenderEngine.matchViewportResolution=t.checked});e=document.getElementById("show-stats-tgl"),e=(null!==e&&(e.onchange=function(e){document.getElementById("statsContainer").style.display=e.target.checked?"block":"none"}),document.getElementById("test-latency-button"));e&&(e.onclick=()=>{this.sendStartLatencyTest()}),this.cloudRenderEngine.setupToggleWithUrlParams("prefer-sfu-tgl","preferSFU"),this.cloudRenderEngine.setupToggleWithUrlParams("use-mic-tgl","useMic"),this.cloudRenderEngine.setupToggleWithUrlParams("force-turn-tgl","ForceTURN");let i=document.getElementById("stream-select"),s=document.getElementById("track-select");i&&(i.onchange=function(e){var t=a.cloudRenderEngine.webRtcPlayerObj.availableVideoStreams.get(i.value);a.cloudRenderEngine.webRtcPlayerObj.video.srcObject=t,a.cloudRenderEngine.streamTrackSource=t,a.cloudRenderEngine.webRtcPlayerObj.video.play(),a.cloudRenderEngine.updateTrackList()},s)&&(s.onchange=function(e){if(a.cloudRenderEngine.streamTrackSource||(a.cloudRenderEngine.streamTrackSource=a.cloudRenderEngine.webRtcPlayerObj.availableVideoStreams.get(i.value)),a.cloudRenderEngine.streamTrackSource)for(const t of a.cloudRenderEngine.streamTrackSource.getVideoTracks())if(t.id===s.value){a.cloudRenderEngine.webRtcPlayerObj.video.srcObject=new MediaStream([t]),a.cloudRenderEngine.webRtcPlayerObj.video.play(),i.value="";break}})}}onExpandOverlay_Click(){document.getElementById("overlay").classList.toggle("overlay-shown")}gamepadConnectHandler(e){console.log("Gamepad connect handler")}gamepadDisconnectHandler(e){console.log("Gamepad disconnect handler"),console.log("gamepad: "+e.gamepad.id+" disconnected"),delete this.cloudRenderEngine.controllers[e.gamepad.index]}emitMouseMove(e,t,i,s){this.cloudRenderEngine.print_inputs&&console.log(`emitMouseMove x: ${e}, y:${t}, dX: ${i}, dY: `+s);e=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(e,t),t=this.cloudRenderEngine.normalizeAndQuantizeSigned(i,s),i=new DataView(new ArrayBuffer(9));i.setUint8(0,MessageType.MouseMove),i.setUint16(1,e.x,!0),i.setUint16(3,e.y,!0),i.setInt16(5,t.x,!0),i.setInt16(7,t.y,!0),this.cloudRenderEngine.sendInputData(i.buffer)}emitMouseDown(e,t,i){this.print_inputs&&console.log(`mouse button ${e} down at (${t}, ${i})`);t=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),i=new DataView(new ArrayBuffer(6));i.setUint8(0,MessageType.MouseDown),i.setUint8(1,e),i.setUint16(2,t.x,!0),i.setUint16(4,t.y,!0),this.cloudRenderEngine.sendInputData(i.buffer)}emitMouseUp(e,t,i){this.print_inputs&&console.log(`mouse button ${e} up at (${t}, ${i})`);t=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),i=new DataView(new ArrayBuffer(6));i.setUint8(0,MessageType.MouseUp),i.setUint8(1,e),i.setUint16(2,t.x,!0),i.setUint16(4,t.y,!0),this.cloudRenderEngine.sendInputData(i.buffer)}emitMouseWheel(e,t,i){this.print_inputs&&console.log(`mouse wheel with delta ${e} at (${t}, ${i})`);t=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),i=new DataView(new ArrayBuffer(7));i.setUint8(0,MessageType.MouseWheel),i.setInt16(1,e,!0),i.setUint16(3,t.x,!0),i.setUint16(5,t.y,!0),this.cloudRenderEngine.sendInputData(i.buffer)}releaseMouseButtons(e,t,i){e&MouseButtonsMask.PrimaryButton&&this.emitMouseUp(MouseButton.MainButton,t,i),e&MouseButtonsMask.SecondaryButton&&this.emitMouseUp(MouseButton.SecondaryButton,t,i),e&MouseButtonsMask.AuxiliaryButton&&this.emitMouseUp(MouseButton.AuxiliaryButton,t,i),e&MouseButtonsMask.FourthButton&&this.emitMouseUp(MouseButton.FourthButton,t,i),e&MouseButtonsMask.FifthButton&&this.emitMouseUp(MouseButton.FifthButton,t,i)}pressMouseButtons(e,t,i){e&MouseButtonsMask.PrimaryButton&&this.emitMouseDown(MouseButton.MainButton,t,i),e&MouseButtonsMask.SecondaryButton&&this.emitMouseDown(MouseButton.SecondaryButton,t,i),e&MouseButtonsMask.AuxiliaryButton&&this.emitMouseDown(MouseButton.AuxiliaryButton,t,i),e&MouseButtonsMask.FourthButton&&this.emitMouseDown(MouseButton.FourthButton,t,i),e&MouseButtonsMask.FifthButton&&this.emitMouseDown(MouseButton.FifthButton,t,i)}registerInputs(e){e&&(this.registerMouseEnterAndLeaveEvents(e),this.registerTouchEvents(e))}registerMouseEnterAndLeaveEvents(i){const s=this;i.onmouseenter=function(e){s.print_inputs&&console.log("mouse enter");var t=new DataView(new ArrayBuffer(1));t.setUint8(0,MessageType.MouseEnter),s.cloudRenderEngine.sendInputData(t.buffer),i.pressMouseButtons(e)},i.onmouseleave=function(e){s.print_inputs&&console.log("mouse leave");var t=new DataView(new ArrayBuffer(1));t.setUint8(0,MessageType.MouseLeave),s.cloudRenderEngine.sendInputData(t.buffer),i.releaseMouseButtons(e)}}registerLockedMouseEvents(e){const t=this;let i=e.width/2,s=e.height/2;function a(){document.pointerLockElement===e||document.mozPointerLockElement===e?(console.log("Pointer locked"),document.addEventListener("mousemove",o,!1)):(console.log("The pointer lock status is now unlocked"),document.removeEventListener("mousemove",o,!1))}function o(e){i+=e.movementX,s+=e.movementY,i>t.styleWidth&&(i-=t.styleWidth),s>t.styleHeight&&(s-=t.styleHeight),i<0&&(i=t.styleWidth+i),s<0&&(s=t.styleHeight-s),t.emitMouseMove(i,s,e.movementX,e.movementY)}e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock,e.onclick=function(){e.requestPointerLock()},document.addEventListener("pointerlockchange",a,!1),document.addEventListener("mozpointerlockchange",a,!1),e.onmousedown=function(e){t.emitMouseDown(e.button,i,s)},e.onmouseup=function(e){t.emitMouseUp(e.button,i,s)},e.onmousewheel=function(e){t.emitMouseWheel(e.wheelDelta,i,s)},e.pressMouseButtons=function(e){t.pressMouseButtons(e.buttons,i,s)},e.releaseMouseButtons=function(e){t.releaseMouseButtons(e.buttons,i,s)}}registerHoveringMouseEvents(e){const t=this;e.onpointermove=function(e){t.emitMouseMove(e.offsetX,e.offsetY,e.movementX,e.movementY),e.preventDefault()},e.onpointerdown=function(e){t.emitMouseDown(e.button,e.offsetX,e.offsetY),e.preventDefault()},e.onpointerup=function(e){t.emitMouseUp(e.button,e.offsetX,e.offsetY),e.preventDefault()},e.oncontextmenu=function(e){t.emitMouseUp(e.button,e.offsetX,e.offsetY),e.preventDefault()},"onmousewheel"in e?e.onmousewheel=function(e){t.emitMouseWheel(e.wheelDelta,e.offsetX,e.offsetY),e.preventDefault()}:e.addEventListener("DOMMouseScroll",function(e){t.emitMouseWheel(-120*e.detail,e.offsetX,e.offsetY),e.preventDefault()},!1),e.pressMouseButtons=function(e){t.pressMouseButtons(e.buttons,e.offsetX,e.offsetY)},e.releaseMouseButtons=function(e){t.releaseMouseButtons(e.buttons,e.offsetX,e.offsetY)}}registerTouchEvents(r){const l=this;let a=[9,8,7,6,5,4,3,2,1,0],h={};function o(e,t){var i=new DataView(new ArrayBuffer(2+7*t.length));i.setUint8(0,e),i.setUint8(1,t.length);let s=2;for(let e=0;e<t.length;e++){var a=t[e],o=a.clientX-r.offsetLeft,n=a.clientY-r.offsetTop,o=(l.print_inputs&&console.log(`F${h[a.identifier]}=(${o}, ${n})`),l.cloudRenderEngine.normalizeAndQuantizeUnsigned(o,n));i.setUint16(s,o.x,!0),s+=2,i.setUint16(s,o.y,!0),s+=2,i.setUint8(s,h[a.identifier],!0),s+=1,i.setUint8(s,255*a.force,!0),s+=1,i.setUint8(s,o.inRange?1:0,!0),s+=1}l.cloudRenderEngine.sendInputData(i.buffer)}if(this.inputOptions.fakeMouseWithTouches){let a;r.ontouchstart=function(e){var t;void 0===a&&(t=e.changedTouches[0],a={id:t.identifier,x:t.clientX-l.playerElementClientRect.left,y:t.clientY-l.playerElementClientRect.top},r.onmouseenter(e),l.emitMouseDown(MouseButton.MainButton,a.x,a.y)),e.preventDefault()},r.ontouchend=function(t){for(let e=0;e<t.changedTouches.length;e++){var i=t.changedTouches[e];if(i.identifier===a.id){var s=i.clientX-l.playerElementClientRect.left,i=i.clientY-l.playerElementClientRect.top;l.emitMouseUp(MouseButton.MainButton,s,i),r.onmouseleave(t),a=void 0;break}}t.preventDefault()},r.ontouchmove=function(t){for(let e=0;e<t.touches.length;e++){var i=t.touches[e];if(i.identifier===a.id){var s=i.clientX-l.playerElementClientRect.left,i=i.clientY-l.playerElementClientRect.top;l.emitMouseMove(s,i,s-a.x,i-a.y),a.x=s,a.y=i;break}}t.preventDefault()}}else r.ontouchstart=function(t){for(let e=0;e<t.changedTouches.length;e++)i=t.changedTouches[e],(s=void 0)===(s=a.pop())&&console.log("exhausted touch indentifiers"),h[i.identifier]=s;var i,s;l.print_inputs&&console.log("touch start"),o(MessageType.TouchStart,t.changedTouches),t.preventDefault()},r.ontouchend=function(t){l.print_inputs&&console.log("touch end"),o(MessageType.TouchEnd,t.changedTouches);for(let e=0;e<t.changedTouches.length;e++)i=t.changedTouches[e],a.push(h[i.identifier]),delete h[i.identifier];var i;t.preventDefault()},r.ontouchmove=function(e){l.print_inputs&&console.log("touch move"),o(MessageType.TouchMove,e.touches),e.preventDefault()}}callRespone(e){var{uuid:t,classType:i}=e;this.interactiveObjects.has(t)?this.interactiveObjects.get(t).dispatchEvent(e):"cloudrenderengine"===i.toLowerCase()?this.cloudRenderEngine.dispatchEvent(e):"scene"===i.toLowerCase()?this.scene&&this.scene.dispatchEvent(e):"camera"===i.toLowerCase()&&this.cloudRenderEngine.camera&&this.cloudRenderEngine.camera.dispatchEvent(e)}}let _object3DId=0;const _v1=new Vector3,_q1=new Quaternion,_m1=new Matrix4,_target=new Vector3,_position=new Vector3,_scale=new Vector3,_quaternion=new Quaternion,_xAxis=new Vector3(1,0,0),_yAxis=new Vector3(0,1,0),_zAxis=new Vector3(0,0,1),_addedEvent={type:"added"},_removedEvent={type:"removed"};class Object3D extends EventDispatcher{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:_object3DId++}),this.uuid=MathUtils.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Object3D.DEFAULT_UP.clone();var e=new Vector3;const t=new Euler,i=new Quaternion;var s=new Vector3(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=Object3D.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return _q1.setFromAxisAngle(e,t),this.quaternion.multiply(_q1),this}rotateOnWorldAxis(e,t){return _q1.setFromAxisAngle(e,t),this.quaternion.premultiply(_q1),this}rotateX(e){return this.rotateOnAxis(_xAxis,e)}rotateY(e){return this.rotateOnAxis(_yAxis,e)}rotateZ(e){return this.rotateOnAxis(_zAxis,e)}translateOnAxis(e,t){return _v1.copy(e).applyQuaternion(this.quaternion),this.position.add(_v1.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(_xAxis,e)}translateY(e){return this.translateOnAxis(_yAxis,e)}translateZ(e){return this.translateOnAxis(_zAxis,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(_m1.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?_target.copy(e):_target.set(e,t,i);e=this.parent;this.updateWorldMatrix(!0,!1),_position.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_m1.lookAt(_position,_target,this.up):_m1.lookAt(_target,_position,this.up),this.quaternion.setFromRotationMatrix(_m1),e&&(_m1.extractRotation(e.matrixWorld),_q1.setFromRotationMatrix(_m1),this.quaternion.premultiply(_q1.invert()))}add(e){if(1<arguments.length)for(let e=0;e<arguments.length;e++)this.add(arguments[e]);else e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),(e.parent=this).children.push(e),e.dispatchEvent(_addedEvent)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e);return this}remove(e){if(1<arguments.length)for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);else{var t=this.children.indexOf(e);-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(_removedEvent))}return this}removeFromParent(){var e=this.parent;return null!==e&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){var t=this.children[e];t.parent=null,t.dispatchEvent(_removedEvent)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),_m1.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),_m1.multiply(e.parent.matrixWorld)),e.applyMatrix4(_m1),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(i,s){if(this[i]===s)return this;for(let e=0,t=this.children.length;e<t;e++){var a=this.children[e].getObjectByProperty(i,s);if(void 0!==a)return a}}getObjectsByProperty(i,s){let a=[];this[i]===s&&a.push(this);for(let e=0,t=this.children.length;e<t;e++){var o=this.children[e].getObjectsByProperty(i,s);0<o.length&&(a=a.concat(o))}return a}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position,e,_scale),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position,_quaternion,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(i){i(this);var s=this.children;for(let e=0,t=s.length;e<t;e++)s[e].traverse(i)}traverseVisible(i){if(!1!==this.visible){i(this);var s=this.children;for(let e=0,t=s.length;e<t;e++)s[e].traverseVisible(i)}}traverseAncestors(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(i){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),i=!(this.matrixWorldNeedsUpdate=!1));var s=this.children;for(let e=0,t=s.length;e<t;e++){var a=s[e];!0!==a.matrixWorldAutoUpdate&&!0!==i||a.updateMatrixWorld(i)}}updateWorldMatrix(e,t){var i=this.parent;if(!0===e&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){var s=this.children;for(let e=0,t=s.length;e<t;e++){var a=s[e];!0===a.matrixWorldAutoUpdate&&a.updateWorldMatrix(!1,!0)}}}toJSON(i){var e,t,s,a,o,n,r=void 0===i||"string"==typeof i,l={},h=(r&&(i={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},l.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"}),{});function d(e,t){return void 0===e[t.uuid]&&(e[t.uuid]=t.toJSON(i)),t.uuid}if(h.uuid=this.uuid,h.type=this.type,""!==this.name&&(h.name=this.name),!0===this.castShadow&&(h.castShadow=!0),!0===this.receiveShadow&&(h.receiveShadow=!0),!1===this.visible&&(h.visible=!1),!1===this.frustumCulled&&(h.frustumCulled=!1),0!==this.renderOrder&&(h.renderOrder=this.renderOrder),0<Object.keys(this.userData).length&&(h.userData=this.userData),h.layers=this.layers.mask,h.matrix=this.matrix.toArray(),h.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(h.matrixAutoUpdate=!1),this.isInstancedMesh&&(h.type="InstancedMesh",h.count=this.count,h.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor)&&(h.instanceColor=this.instanceColor.toJSON()),this.isScene)this.background&&(this.background.isColor?h.background=this.background.toJSON():this.background.isTexture&&(h.background=this.background.toJSON(i).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(h.environment=this.environment.toJSON(i).uuid);else if(this.isMesh||this.isLine||this.isPoints){h.geometry=d(i.geometries,this.geometry);var c=this.geometry.parameters;if(void 0!==c&&void 0!==c.shapes){var u=c.shapes;if(Array.isArray(u))for(let e=0,t=u.length;e<t;e++){var p=u[e];d(i.shapes,p)}else d(i.shapes,u)}}if(this.isSkinnedMesh&&(h.bindMode=this.bindMode,h.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton)&&(d(i.skeletons,this.skeleton),h.skeleton=this.skeleton.uuid),void 0!==this.material)if(Array.isArray(this.material)){var m=[];for(let e=0,t=this.material.length;e<t;e++)m.push(d(i.materials,this.material[e]));h.material=m}else h.material=d(i.materials,this.material);if(0<this.children.length){h.children=[];for(let e=0;e<this.children.length;e++)h.children.push(this.children[e].toJSON(i).object)}if(0<this.animations.length){h.animations=[];for(let e=0;e<this.animations.length;e++){var g=this.animations[e];h.animations.push(d(i.animations,g))}}return r&&(c=y(i.geometries),r=y(i.materials),e=y(i.textures),t=y(i.images),s=y(i.shapes),a=y(i.skeletons),o=y(i.animations),n=y(i.nodes),0<c.length&&(l.geometries=c),0<r.length&&(l.materials=r),0<e.length&&(l.textures=e),0<t.length&&(l.images=t),0<s.length&&(l.shapes=s),0<a.length&&(l.skeletons=a),0<o.length&&(l.animations=o),0<n.length)&&(l.nodes=n),l.object=h,l;function y(e){var t=[];for(const s in e){var i=e[s];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){var i=t.children[e];this.add(i.clone())}return this}}Object3D.DEFAULT_UP=new Vector3(0,1,0),Object3D.DEFAULT_MATRIX_AUTO_UPDATE=!0,Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Scene extends Object3D{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.childrenSet=new Set,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){e=super.toJSON(e);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),0<this.backgroundBlurriness&&(e.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.backgroundIntensity=this.backgroundIntensity),e}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Camera extends Object3D{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this._level=0,this._levelChange=0,this.projectionMatrix=new Matrix4,this.projectionMatrixInverse=new Matrix4;let t=new Vector3,i=-9999,s=-9999,a=-9999,o=-180,n=180,r=-89,l=0,h=-9999,d=-9999;this.needsUpdate=!1,this.worldLocation=new Vector3,this.sphereLocation=new Vector3,this.constrainPolygon=[],Object.defineProperties(this,{minLocation:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t.x=e.x,t.y=e.y,t.z=e.z,this.needsUpdate=!0)}},maxLocationX:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.needsUpdate=!0)}},maxLocationY:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.needsUpdate=!0)}},maxLocationZ:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.needsUpdate=!0)}},minYaw:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{void 0!==e&&(o=e,this.needsUpdate=!0)}},maxYaw:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{void 0!==e&&(n=e,this.needsUpdate=!0)}},minPitch:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{void 0!==e&&(r=e,this.needsUpdate=!0)}},maxPitch:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{void 0!==e&&(l=e,this.needsUpdate=!0)}},minSpringArm:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{void 0!==e&&(h=e,this.needsUpdate=!0)}},maxSpringArm:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{void 0!==e&&(d=e,this.needsUpdate=!0)}},name:{configurable:!1,enumerable:!0,value:name}})}get level(){return this._level}set level(e){e=Math.floor(e);this._levelChange=this._level-e,this._level=e}copy(e,t){return super.copy(e,t),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}setConstrainPolygon(e){e&&2<e.length&&(this.constrainPolygon=[],e.forEach((e,t)=>{this.constrainPolygon.push({x:e[0],y:e[1]})}),this.constrainHeight=-1,this.needsUpdate=!0,this.constrainPolygonNeedsUpdate=!0)}setConstrainShape(e,t){t&&2<t.length&&(this.constrainPolygon=[],t.forEach((e,t)=>{this.constrainPolygon.push({x:e[0],y:e[1],z:e[2]})}),this.constrainHeight=e,this.needsUpdate=!0,this.constrainShapeNeedsUpdate=!0)}clone(){return(new this.constructor).copy(this)}toJSON(){return{shape:this.constrainPolygon&&this.constrainPolygon.length?this.constrainPolygon:null,ConstrainHeight:void 0===this.constrainHeight?-1:this.constrainHeight,MaxLocationX:this.maxLocationX,MaxLocationY:this.maxLocationY,MaxLocationZ:this.maxLocationZ,MinYaw:this.minYaw,MaxYaw:this.maxYaw,MinPitch:this.minPitch,MaxPitch:this.maxPitch,MinSpringArm:this.minSpringArm,MaxSpringArm:this.maxSpringArm,type:this.type,name:this.name,uuid:this.uuid}}}const flattenArray=function(e){return e.flat(1/0)};function getGeoFeatures(e){if(!e)return[];let t=null;return t=e.features||(Array.isArray(e)?e:[e]),JSON.parse(JSON.stringify(t))}function getProcessedPolygonData(e){const i=[];let s,a;return getGeoFeatures(e).forEach(e=>{fixCoordiates(null==e||null==(t=e.geometry)?void 0:t.coordinates,2),s=earcut.flatten(null==e||null==(t=e.geometry)?void 0:t.coordinates),a=earcut(s.vertices,s.holes,s.dimensions);var t,e=getPolygonUV(s.vertices);i.push({vertices:s.vertices,triangles:a,uvs:e})}),i}function getUELineData(e,i){e=getGeoFeatures(e);return e.forEach(e=>{var t=null==e||null==(t=e.geometry)?void 0:t.coordinates;fixCoordiates(t,1),e.geometry.coordinates=flattenArray(t),i&&(e.geometry.coordinates.push(e.geometry.coordinates[0]),e.geometry.coordinates.push(e.geometry.coordinates[1]),e.geometry.coordinates.push(e.geometry.coordinates[2]))}),e}function getUEPointData(e){e=getGeoFeatures(e);return e.forEach(e=>{var t=null==e||null==(t=e.geometry)?void 0:t.coordinates;fixFeature(e),e.geometry.coordinates=flattenArray(t)}),e}const fixCoordiates=(e,t)=>{if(e)if(0===t)e[2]||(e[2]=0);else for(const i of e)fixCoordiates(i,t-1)};function fixFeature(e){e.type||(e.type="Feature");var t=e.geometry.type,i={Point:0,MultiPoint:1,LineString:1,MultiLineString:2,Polygon:2,MultiPolygon:3};return Object.keys(i).includes(t)&&fixCoordiates(e.geometry.coordinates,i[t]),e}function getPolygonUV(t){let i=1/0,s=1/0,a=-1/0,o=-1/0;var n=[];for(let e=0;e<t.length/3;e++){var r=t[3*e],l=t[3*e+1];i>r&&(i=r),s>l&&(s=l),a<r&&(a=r),o<l&&(o=l)}var h=1/(a-i),d=1/(o-s);for(let e=0;e<t.length/3;e++){var c=t[3*e],u=t[3*e+1],c=h*(c-i),u=d*(u-s);n.push({x:c,y:u})}return n}const fileLoader=new FileLoader;function loadImageAsBase64(e,i){fileLoader.load(e,e=>{var t=new FileReader;t.readAsDataURL(e),t.onloadend=e=>{i(e.target.result)}},null,e=>{i(!1)})}function convertCanvas2Base64(e,t="image/png"){return e.toDataURL(t)}function isBase64(e){return-1!==e.indexOf("data:")&&-1!==e.indexOf("base64")}function loadImg(e,t="https://mapdata.bj.bcebos.com"){const i=new Image;return i.crossOrigin="Anonymous",i.src=t+e,new Promise((e,t)=>{i.addEventListener("load",()=>{e(i)}),i.onerror=e=>{t(e)}})}function roundRect(e,t,i,s,a,o){e.beginPath(),e.moveTo(t+o,i),e.lineTo(t+s-o,i),e.quadraticCurveTo(t+s,i,t+s,i+o),e.lineTo(t+s,i+a-o),e.quadraticCurveTo(t+s,i+a,t+s-o,i+a),e.lineTo(t+o,i+a),e.quadraticCurveTo(t,i+a,t,i+a-o),e.lineTo(t,i+o),e.quadraticCurveTo(t,i,t+o,i),e.closePath()}function drawText(e,t,i,s){var i=i["xScale"],[s,a]=s,{text:t,fontSize:o,fontFamily:n,color:r,textAlign:l,icon:h}=t;let d;if(t||"number"==typeof t||h)if(t&&h)console.warn("BasicLabel Warning:text和icon不要同时设置");else{if(d=t,e.font=o*i+"px "+n,e.fillStyle=r,e.textAlign=l||"left",e.textBaseline="top",h){let e=h;-1!==h.indexOf("&amp;")&&(e=h.replace("&amp;","&")),-1!==h.indexOf("&amp")&&(e=h.replace("&amp","&")),d=new Function('return ("'+(""+e).replace("&#x","\\u").replace(";","")+'")')()}e.measureText(d).width;e.fillText(d,s,a)}}async function drawCanvas(e,t){var{height:e,width:i,backgroundImage:s,borderRadius:a,borderColor:o,borderWidth:n,backgroundColor:r}=e,l=document.createElement("canvas"),h=l.getContext("2d"),d=MathUtils.ceilPowerOfTwo(i),d={width:d,height:d*(e/i),factor:{xScale:d/i,yScale:d/i}},{xScale:c,yScale:u}=(l.width=d.width,l.height=d.height,d.factor);return s?(s=await loadImg(s,""),h.drawImage(s,0,0,i*c,e*u)):(o||r)&&(h.strokeStyle=o,h.fillStyle=r,h.lineWidth=n?n*c:+c,roundRect(h,h.lineWidth*c,h.lineWidth*u,(i-2*h.lineWidth)*c,(e-2*h.lineWidth)*u,a?a*c:0),r&&h.fill(),o)&&h.stroke(),t&&drawContent(h,d,t),l}async function drawContent(t,i,s){var{paddingTop:e,paddingLeft:a,width:o}=i;let n=0,r=0,l=0,h=0;var{xScale:d,yScale:c}=i.factor,u=a?a*d:0,p=e?e*c:0,m=[u,p],g=Object.keys(s);for(let e=0;e<g.length;e++){var y,f,b=s[g[e]],{width:x,height:v,text:S,marginRight:C,marginBottom:U,backgroundImage:N,borderRadius:w,borderColor:T,borderWidth:O,backgroundColor:M,position:z}=b;if(z&&([y,f]=z,m[0]=u+y*d,m[1]=p+f*c,n=0,r=0,l=0,h=0),x&&v){if(o<m[0]+x*d&&((l+=n)+v*c<=r?(m[0]=h,m[1]+=n):(m[0]=a?a*d:0,m[1]+=n,r=0,h=0)),N)try{var R=await loadImg(N,"");t.drawImage(R,m[0],m[1],x*d,v*c)}catch(e){console.log(e)}else M&&(t.strokeStyle=T,t.fillStyle=M,t.lineWidth=O?O*d:+d,roundRect(b,m[0]+b.lineWidth*d,m[1]+b.lineWidth*d,(x-2*b.lineWidth)*d,(v-2*b.lineWidth)*c,w?w*d:0),M&&t.fill(),T)&&t.stroke();S&&([y,f]=z,drawText(t,b,i.factor,[m[0]+y*d,m[1]+f*c])),m[0]+=(x+(C||0))*d,(n=(v+(U||0))*c)>r&&(r=n,h=m[0])}else S&&([N,O]=z,drawText(t,b,i.factor,[m[0]+N*d,m[1]+O*c]))}}function drawTextToImage(e,t={}){var i,s,a,o,n,r,l,h,d,c,u,p,m,g,y;return!!e&&(s=(i=document.createElement("canvas")).getContext("2d"),a=t.scale||1,o=t.fontSize||18,c=t.fontface||"Arial",n=t.borderThickness||0,u=t.backgroundColor||{r:0,g:0,b:0,a:1},d=t.borderColor||{r:0,g:0,b:0,a:1},y=t.strokeStyle||{r:255,g:0,b:0,a:1},r=t.textColor||{r:255,g:0,b:0,a:1},s.font="Bold "+o*a+"px "+c,l=(g=s.measureText(e).width*a)+2*n*a,h=o*a*1.4+2*n*a,{r:c,g:u,b:p,a:m}=(i.width=t.width||l,i.height=t.height||h,s.font="Bold "+o*a+"px "+c,u),{r:m,g,b:t,a:y}=(s.fillStyle="rgba("+c+","+u+","+p+","+m+")",s.fillRect(0,0,i.width,i.height),t.drawRoundRect&&({r:c,g:u,b:p,a:m}=d,s.strokeStyle="rgba("+c+","+u+","+p+","+m+")",s.lineWidth=n*a,roundRect(s,n/2,n/2,g+n+10*a,o*a*1.4+n,6)),s.fill(),s.stroke(),t.drawStrokeStyle&&({r:d,g:c,b:u,a:p}=y,s.strokeStyle="rgba("+d+","+c+","+u+","+p+")",s.strokeText(e,(n+5)*a+.5*(i.width-l),.5*(i.height-h)+(o+n)*a)),r),s.fillStyle="rgba("+m+","+g+","+t+","+y+")",s.fillText(e,(n+5)*a+.5*(i.width-l),.5*(i.height-h)+(o+n)*a),i)}fileLoader.setResponseType("blob");class Shape extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),this.visibleNeedsUpdate=!0,this._visible=e&&!0}get map(){return this._map}set map(e){e&&(isBase64(this._map=e)?(this.texture=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0):loadImageAsBase64(e,e=>{e&&(this.texture=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}))}constructor(e={}){super(e);var t=e.name;const i=new Color$1(1,1,1),s=(e.color&&(i.r=MathUtils.clamp(e.color.r,0,1),i.g=MathUtils.clamp(e.color.g,0,1),i.b=MathUtils.clamp(e.color.b,0,1)),new Color$1(1,1,1));e.color2?(s.r=MathUtils.clamp(e.color2.r,0,1),s.g=MathUtils.clamp(e.color2.g,0,1),s.b=MathUtils.clamp(e.color2.b,0,1)):(s.r=i.r,s.g=i.g,s.b=i.b);let a=void 0===e.size?10:e.size,o=void 0===e.sizeAttenuation||e.sizeAttenuation,n=void 0===e.gardientDirection?1:e.gardientDirection,r=void 0===e.brightness?0:e.brightness,l=void 0===e.scroll?0:e.scroll,h=this.childIndex=-1,d=void 0===e.speed?.2:e.speed,c=void 0===e.roughness?1:e.roughness,u=void 0===e.metallic?0:e.metallic,p=(this.map=e.map||null,void 0===e.opacity?1:e.opacity),m=void 0===e.uvRotateSpeed?0:e.uvRotateSpeed,g=void 0===e.WPOScaleAnimateSpeed?0:e.WPOScaleAnimateSpeed,y=void 0===e.WPOMinAnimateScale?1:e.WPOMinAnimateScale,f=void 0===e.WPOMaxAnimateScale?2:e.WPOMaxAnimateScale;const b=new Color$1(1,1,1),x=(e.brightnessColor&&(b.r=MathUtils.clamp(e.brightnessColor.r,0,1),b.g=MathUtils.clamp(e.brightnessColor.g,0,1),b.b=MathUtils.clamp(e.brightnessColor.b,0,1)),e.position||new Vector3),v=new Euler,S=(e.rotation&&(v.x=MathUtils.clamp(e.rotation.x,-180,180),v.y=MathUtils.clamp(e.rotation.y,-180,180),v.z=MathUtils.clamp(e.rotation.z,-180,180)),new Quaternion),C=new Vector3(1,1,1),U=(e.scale&&(C.x=e.scale.x,C.y=e.scale.y,C.z=e.scale.z),new Vector3(0,0,0));e.offset&&(U.x=e.offset.x,U.y=e.offset.y,U.z=e.offset.z),this.isInstance=e.isInstance||!1,this.transparent=e.transparent||p<1,this.depthTest=!("depthTest"in e)||e.depthTest,this.renderNum=void 0===e.renderNum?20:e.renderNum,this._visible=void 0===e.visible||e.visible,v._onChange(function(){S.setFromEuler(v,!1),this.matrixNeedsUpdate=!0}),S._onChange(function(){v.setFromQuaternion(S,void 0,!1),this.matrixNeedsUpdate=!0}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,get:()=>x,set:e=>{e&&(x.x=e.x,x.y=e.y,x.z=e.z,this.matrixNeedsUpdate=!0)}},childIndex:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e!==h&&(h=e)}},rotation:{configurable:!0,enumerable:!0,get:()=>v,set:e=>{e&&(v.x=MathUtils.clamp(e.x,-180,180),v.y=MathUtils.clamp(e.y,-180,180),v.z=MathUtils.clamp(e.z,-180,180),this.matrixNeedsUpdate=!0)}},quaternion:{writable:!0,configurable:!0,value:S,enumerable:!0},scale:{configurable:!0,enumerable:!0,get:()=>C,set:e=>{e&&(C.x=e.x,C.y=e.y,C.z=e.z,this.matrixNeedsUpdate=!0)}},offset:{configurable:!0,enumerable:!0,get:()=>U,set:e=>{e&&(U.x=e.x,U.y=e.y,U.z=e.z,this.matrixNeedsUpdate=!0)}},color:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i.r=e.r,i.g=e.g,i.b=e.b,e.a&&(p=e.a),this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},color2:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.r=e.r,s.g=e.g,s.b=e.b,e.a&&(p=e.a),this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},gardientDirection:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{void 0!==e&&(n=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},scroll:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{void 0!==e&&(l=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},uvRotateSpeed:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{void 0!==e&&(m=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOMaxAnimateScale:{configurable:!0,enumerable:!0,get:()=>f,set:e=>{void 0!==e&&(f=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOMinAnimateScale:{configurable:!0,enumerable:!0,get:()=>y,set:e=>{void 0!==e&&(y=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOScaleAnimateSpeed:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{void 0!==e&&(g=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},speed:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{void 0!==e&&(d=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},brightness:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{void 0!==e&&(r=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},roughness:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{c=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},metallic:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{u=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},opacity:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{this.transparent=e<1,p=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},brightnessColor:{configurable:!0,enumerable:!0,get:()=>b,set:e=>{e&&(b.copy(e),this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},_layerName:{configurable:!1,enumerable:!1,value:"CommonGISLayer",writable:!0},_cloudControlType:{configurable:!1,enumerable:!1,value:"Gis",writable:!0},type:{configurable:!1,enumerable:!0,value:"Shape",writable:!0},name:{configurable:!1,enumerable:!0,value:t,writable:!0},size:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{void 0!==e&&(a=e,this.overtimeInstanceIndex=[],this.materialNeedsUpdate=!0)}},sizeAttenuation:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{void 0!==e&&(o=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}}}),e.data&&this.setData(e.data),this.matrixNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.visibleNeedsUpdate=!1,this.animateNeedsUpdate=!1}animate(e={}){var t,i,s,a,o,n;return!!e.to&&({from:n={},to:t={},duration:i=3e3,easing:s="Linear",loop:a=!1,stayEnd:o=!0}=e,n.position||delete n.position,n.rotation||delete n.rotation,n.scale||delete n.scale,t.position||delete t.position,t.rotation||delete t.rotation,t.scale||delete t.scale,t.animateOffset||delete t.animateOffset,this.animateNeedsUpdate=!0,this.animateJson={Status:"play",From:n,To:t,Duration:i,Easing:s,Loop:a,StayEnd:o},n=new Tween({ratio:0}).to({ratio:1},e.duration||3e3).start(),a&&n.repeat(1/0),this.tween=null,this.tween=n,this.tween)}stopAnimate(e=1e3){this.animateNeedsUpdate=!0,this.animateJson={Status:"stop",DelayTime:e},this.tween&&this.tween.stop(),this.tween=null}setData(e){var t=getGeoFeatures(e);if(t.length<1)return!1;var i,s,e=t[0].geometry.type.toLowerCase();if(this.isInstance&&["point","multipoint"].indexOf(e)<0)return!1;let a={};switch(e){case"point":case"multipoint":a=getUEPointData(t);break;case"linestring":case"multilinestring":a=getUELineData(t);break;case"polygon":case"multipolygon":a=getProcessedPolygonData(t)}this.isInstance?({data:e,overtimeInstanceIndex:i,datas:s}=mergePointData(this.datas,a),(0<e.length||0<i.length)&&(this.datas=s,this.data=e,this.overtimeInstanceIndex=i,this.materialNeedsUpdate=!0)):this.data=a}toJSON(e=!0){return!this.visibleNeedsUpdate||!e||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,DepthTest:this.depthTest,Scroll:this.scroll,Speed:this.speed,Texture:this.texture,GardientDirection:this.gardientDirection,RotateSpeed:this.uvRotateSpeed,ScaleAnimateSpeed:this.WPOScaleAnimateSpeed,MinAnimateScale:this.WPOMinAnimateScale,MaxAnimateScale:this.WPOMaxAnimateScale,Color2:{r:this.color2.r,g:this.color2.g,b:this.color2.b,a:this.opacity},BrightnessColor:this.brightnessColor?{r:this.brightnessColor.r,g:this.brightnessColor.g,b:this.brightnessColor.b,a:1}:Color$1,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,animateNeedsUpdate:!this.isInstance&&this.animateNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid,jsondata:!e||this.isInstance?this.data:null,AnimateJson:this.animateNeedsUpdate?this.animateJson:null,Size:this.size,SizeAttenuation:this.sizeAttenuation,RenderNum:this.renderNum,ChildIndex:this.isInstance?-1:this.childIndex,IsInstance:this.isInstance,OvertimeInstanceIndex:this.overtimeInstanceIndex}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid,ChildIndex:this.childIndex}}dispose(){this.traverse(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose(),e.texture=null}),this.data=null,this.datas=null,this.texture=null}copy(e,t=!0){return this.color.copy(e.color),this.brightness=e.brightness,this.metallic=e.metallic,this.roughness=e.roughness,this.opacity=e.opacity,this.transparent=e.transparent,this.texture=e.texture,this.brightnessColor.copy(e.brightnessColor),this.offset.copy(e.offset),super.copy(e,t),this}}function mergePointData(i,s){if(!i||i.length<1)return{data:s,datas:s,overtimeInstanceIndex:[]};var a=[],o=[],t=[],n=[];for(let e=0;e<i.length;e++){var{geometry:r,properties:l={}}=i[e],h=r["coordinates"],{rotation:d={x:0,y:0,z:0},scale:c={x:1,y:1,z:1}}=l;let t=!1;for(let e=0;e<s.length;e++){var{geometry:u,properties:p={}}=s[e];const g=u["coordinates"];var{rotation:u={x:0,y:0,z:0},scale:p={x:1,y:1,z:1}}=p,m=h.length===g.length&&h.every((e,t)=>e===g[t]);if(m&&(d.x===u.x&&d.y===u.y&&d.z===u.z&&c.x===p.x&&c.y===p.y&&c.z===p.z&&!(-1<a.indexOf(e)))){a.push(e),t=!0,n.push(s[e]);break}}t||o.push(e)}for(let e=0;e<s.length;e++)a.indexOf(e)<0&&(t.push(s[e]),n.push(s[e]));return{data:t,overtimeInstanceIndex:o,datas:n}}class Polygon extends Shape{constructor(e={}){super(e),this.type="Polygon";let t=e.fillStyle||"Empty",i=void 0===e.speedX?.25:e.speedX,s=void 0===e.speedY?.25:e.speedY,a=void 0===e.rotateAngle?0:e.rotateAngle,o=void 0===e.tile?.5:e.tile;Object.defineProperties(this,{fillStyle:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e,this.materialNeedsUpdate=!0)}},rotateAngle:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.materialNeedsUpdate=!0)}},tile:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.materialNeedsUpdate=!0)}},speedX:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.materialNeedsUpdate=!0)}},speedY:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.materialNeedsUpdate=!0)}}})}setData(e){this.data=getProcessedPolygonData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,FillStyle:this.fillStyle,SpeedX:this.speedX,SpeedY:this.speedY,RotateAngle:this.rotateAngle,Tile:this.tile,Transparent:this.transparent,Texture:this.texture,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}function calculationDistance(e,t){var i=e[0],e=e[1],s=t[0],t=t[1];return Math.sqrt((i-s)*(i-s)+(e-t)*(e-t))}function distToSegment(e,t,i){var s=Math.abs(calculationDistance(e,t)),e=Math.abs(calculationDistance(e,i)),t=Math.abs(calculationDistance(t,i)),i=(s+e+t)/2;return 2*Math.sqrt(Math.abs(i*(i-s)*(i-e)*(i-t)))/s}function compressLine(s,e,a,o,n){if(a<o){let t=0,i=0;var r=s[a],l=s[o];for(let e=a+1;e<o;e++){var h=distToSegment(r,l,s[e]);h>t&&(t=h,i=e)}t>=n&&(e.push(s[i]),compressLine(s,e,a,i,n),compressLine(s,e,i,o,n))}return e}function douglasPeucker(e,t=10,i=1){if(!(e&&2<e.length))return null;e.forEach((e,t)=>{e.id=t});i=compressLine(e,[],0,e.length-i,t),i.push(e[0]),i.push(e[e.length-1]),t=i.sort((e,t)=>e.id<t.id?-1:e.id>t.id?1:0);return t.forEach(e=>{e.id=0}),t}class Line extends Shape{constructor(e={}){super(e),this.type="Line";let t=e.style||LineTypeOptions.SOLID,i=e.splineType||LineSplineTypeOptions.LINEAR,s=e.direction||LineDirectionOptions.CENTER,a=e.width||4,o=e.tilling||5,n=e.speed||1,r=void 0!==e.openStroke&&e.openStroke;const l=e.strokeColor||null;let h=e.strokeWidth||1,d=(this.isDilution=e.isDilution||!1,this.interval=e.interval||1e-5,this.visible=void 0===e.visible||e.visible,this.collision=void 0!==e.collision&&e.collision,{enable:!1,speedX:1,speedY:0,uvRotation:0,u:0,v:0});e.lineUVOption&&(d.enable=void 0!==e.lineUVOption.enable&&e.lineUVOption.enable,d.speedX=void 0===e.lineUVOption.speedX?1:e.lineUVOption.speedX,d.speedY=void 0===e.lineUVOption.speedY?0:e.lineUVOption.speedY,d.uvRotation=void 0===e.lineUVOption.uvRotation?0:e.lineUVOption.uvRotation,d.u=void 0===e.lineUVOption.u?0:e.lineUVOption.u,d.v=void 0===e.lineUVOption.v?0:e.lineUVOption.v),this.renderType=void 0===e.renderType?0:e.renderType,this.section_Length=void 0===e.section_Length?100:e.section_Length,Object.defineProperties(this,{style:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e,this.materialNeedsUpdate=!0)}},lineUVOption:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d.enable=void 0!==e.enable&&e.enable,d.speedX=void 0===e.speedX?1:e.speedX,d.speedY=void 0===e.speedY?0:e.speedY,d.uvRotation=void 0===e.uvRotation?0:e.uvRotation,d.u=void 0===e.u?0:e.u,d.v=void 0===e.v?0:e.v,this.materialNeedsUpdate=!0)}},splineType:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.materialNeedsUpdate=!0)}},direction:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.materialNeedsUpdate=!0)}},width:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.materialNeedsUpdate=!0)}},tilling:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.materialNeedsUpdate=!0)}},speed:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e,this.materialNeedsUpdate=!0)}},openStroke:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e,this.materialNeedsUpdate=!0)}},strokeColor:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l.r=e.r,l.g=e.g,l.b=e.b,l.a=e.a||1,this.materialNeedsUpdate=!0)}},strokeWidth:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e,this.materialNeedsUpdate=!0)}}})}setData(e){var t;this.isDilution&&((t=getGeoFeatures(e)).forEach((e,t)=>{var i=e.geometry.coordinates,s=i.length;let a=1;var[o,n,r]=i[0],[s,l,h]=i[s-1];o===s&&n===l&&r===h&&(a=2),e.geometry.coordinates=douglasPeucker(i,this.interval,a)}),(e={}).features=t),this.data=getUELineData(e)}updataLineColor(e){Array.isArray(e)&&e.length===this.data.length&&(this.colordata=e,this.materialNeedsUpdate=!0)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Collision:this.collision,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Style:this.style,Spline_Type:this.splineType,MeshDirection:this.direction,RenderType:this.renderType,Section_Length:this.section_Length,Width:this.width,Tilling:this.tilling,Speed:this.speed,Open_Stroke:this.openStroke,Stroke_Color:this.strokeColor?{r:this.strokeColor.r,g:this.strokeColor.g,b:this.strokeColor.b,a:1}:null,Stroke_Width:this.strokeWidth,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,LineUVOption:this.lineUVOption,colordata:this.colordata}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.style=e.style,this.splineType=e.splineType,this.direction=e.direction,this.width=e.width,this.tilling=e.tilling,this.speed=e.speed,this.openStroke=e.openStroke,this.strokeColor=e.strokeColor,this.strokeWidth=e.strokeWidth,super.copy(e,t),this}}class Point extends Shape{constructor(e={}){super(e);let t=e.size||4;this.type="Point",Object.defineProperties(this,{size:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{(t=Number(e))&&(this.scale=new Vector3(t,t,t),this.matrixNeedsUpdate=!0)}}})}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Size:this.size,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.size=e.size,super.copy(e,t),this}}class Cube extends Shape{constructor(e){super(e),this.type="Cube"}}class MeasureArea extends Shape{constructor(e={}){super(e),this.type="MeasureArea";let t=void 0===e.textDisplay||e.textDisplay;const i=e.textColor||new Color$1(1,0,0);let s=e.fontSize||18,a=e.textBorderColor||new Color$1(1,0,0),o=e.textBorderWidth||1,n=void 0===e.measureCoef?1:e.measureCoef,r=void 0===e.measureCoefType?0:e.measureCoefType;Object.defineProperties(this,{textDisplay:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e)}},measureCoef:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e)}},measureCoefType:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e)}},fontSize:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e)}},textColor:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i.r=e.r,i.g=e.g,i.b=e.b)}},textBorderWidth:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e)}},textBorderColor:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a.r=e.r,a.g=e.g,a.b=e.b)}}})}updateParameters(e){for(const t in e)this[t]!==e[t]&&(this[t]=e[t])}toJSON(e=!0){return e&&this.visibleNeedsUpdate&&!this.materialNeedsUpdate?{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid}:{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,FontSize:this.fontSize,TextDisplay:this.textDisplay,TextColor:{r:this.textColor.r,g:this.textColor.g,b:this.textColor.b,a:1},TextBorderColor:{r:this.textBorderColor.r,g:this.textBorderColor.g,b:this.textBorderColor.b,a:1},TextBorderWidth:this.textBorderWidth,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,MeasureCoefType:this.measureCoefType,MeasureCoef:this.measureCoef}}copy(e,t=!0){return this.fontSize=e.fontSize,this.textDisplay=e.textDisplay,this.textColor=e.textColor,this.textBorderColor=e.textBorderColor,this.textBorderWidth=e.textBorderWidth,this.measureCoefType=e.measureCoefType,this.measureCoef=e.measureCoef,super.copy(e,t),this}}class MeasureLine extends Shape{constructor(e={}){super(e),this.type="MeasureLine";let t=e.style||LineTypeOptions.SOLID,i=e.splineType||LineSplineTypeOptions.LINEAR,s=e.direction||LineDirectionOptions.CENTER,a=e.width||4,o=e.tilling||300,n=e.speed||1,r=void 0!==e.openStroke&&e.openStroke;const l=e.strokeColor||null;let h=e.strokeWidth||1,d=void 0===e.textDisplay||e.textDisplay;const c=e.textColor||new Color$1(1,0,0);let u=e.fontSize||18,p=e.textBorderColor||new Color$1(1,0,0),m=e.textBorderWidth||1,g=void 0===e.measureCoef?1:e.measureCoef,y=void 0===e.measureCoefType?0:e.measureCoefType;Object.defineProperties(this,{style:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e)}},measureCoef:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g=e)}},measureCoefType:{configurable:!0,enumerable:!0,get:()=>y,set:e=>{e&&(y=e)}},splineType:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e)}},direction:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e)}},width:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e)}},tilling:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e)}},speed:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e)}},openStroke:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e)}},strokeColor:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l.r=e.r,l.g=e.g,l.b=e.b,l.a=e.a||1)}},strokeWidth:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e)}},textDisplay:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d=e)}},fontSize:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{e&&(u=e)}},textColor:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{e&&(c.r=e.r,c.g=e.g,c.b=e.b)}},textBorderWidth:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e&&(m=e)}},textBorderColor:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{e&&(p.r=e.r,p.g=e.g,p.b=e.b)}}})}updateParameters(e){for(const t in e)this[t]!==e[t]&&(this[t]=e[t])}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Style:this.style,Spline_Type:this.splineType,MeshDirection:this.direction,Width:this.width,Tilling:this.tilling,Speed:this.speed,Open_Stroke:this.openStroke,Stroke_Color:this.strokeColor?{r:this.strokeColor.r,g:this.strokeColor.g,b:this.strokeColor.b,a:1}:null,Stroke_Width:this.strokeWidth,FontSize:this.fontSize,TextColor:{r:this.textColor.r,g:this.textColor.g,b:this.textColor.b,a:1},TextDisplay:this.textDisplay,TextBorderColor:{r:this.textBorderColor.r,g:this.textBorderColor.g,b:this.textBorderColor.b,a:1},TextBorderWidth:this.textBorderWidth,MeasureCoefType:this.measureCoefType,MeasureCoef:this.measureCoef}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.style=e.style,this.splineType=e.splineType,this.direction=e.direction,this.width=e.width,this.tilling=e.tilling,this.speed=e.speed,this.openStroke=e.openStroke,this.strokeColor=e.strokeColor,this.strokeWidth=e.strokeWidth,this.fontSize=e.fontSize,this.textColor=e.textColor,this.textDisplay=e.textDisplay,this.textBorderColor=e.textBorderColor,this.textBorderWidth=e.textBorderWidth,this.measureCoefType=e.measureCoefType,this.measureCoef=e.measureCoef,super.copy(e,t),this}}class SurfaceLine extends Shape{constructor(e={}){super(e),this.type="SurfaceLine";let t=e.rayDistance||100,i=e.width||4,s=e.rayDetectionDistance||500;const a=e.textColor||new Color$1(1,0,0);let o=e.fontSize||18,n=e.linePixel||1024;Object.defineProperties(this,{width:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e)}},rayDistance:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e!==t&&(t=e)}},rayDetectionDistance:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e!==s&&(s=e)}},linePixel:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e!==n&&(n=e)}},fontSize:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e)}},textColor:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a.r=e.r,a.g=e.g,a.b=e.b)}}})}updateParameters(e){for(const t in e)this[t]!==e[t]&&(this[t]=e[t])}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Style:"solid",Spline_Type:"Curve",MeshDirection:"Ground_Center",Width:this.width,FontSize:this.fontSize,TextColor:{r:this.textColor.r,g:this.textColor.g,b:this.textColor.b,a:1},LinePixel:this.linePixel}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.style="solid",this.splineType="Curve",this.direction="Ground_Center",this.width=e.width,this.fontSize=e.fontSize,this.textColor=e.textColor,this.textDisplay=e.textDisplay,this.textBorderColor=e.textBorderColor,this.textBorderWidth=e.textBorderWidth,super.copy(e,t),this}}class LocationPoint extends Shape{constructor(e={}){super(e),this.type="LocationPoint",this.EPSG=e.EPSG||"epsg:4326";const t=e.textColor||new Color$1(1,0,0);let i=e.fontSize||18,s=e.textBorderColor||new Color$1(1,0,0),a=e.textBorderWidth||1;Object.defineProperties(this,{fontSize:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e)}},textColor:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t.r=e.r,t.g=e.g,t.b=e.b)}},textBorderWidth:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e)}},textBorderColor:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.r=e.r,s.g=e.g,s.b=e.b)}}})}updateParameters(e){for(const t in e)this[t]!==e[t]&&(this[t]=e[t])}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,FontSize:this.fontSize,TextColor:{r:this.textColor.r,g:this.textColor.g,b:this.textColor.b,a:1},EPSG:this.EPSG,TextBorderColor:{r:this.textBorderColor.r,g:this.textBorderColor.g,b:this.textBorderColor.b,a:1},TextBorderWidth:this.textBorderWidth,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.fontSize=e.fontSize,this.textColor=e.textColor,this.textBorderColor=e.textBorderColor,this.EPSG=e.EPSG,this.textBorderWidth=e.textBorderWidth,super.copy(e,t),this}}function compress(e){e=JSON.stringify(e);return e.replace(/\r\n/g,"").replace(/\n/g,"").replace(/\s+/g,""),e}const rAF=window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.requestAnimationFrame;class CloudRenderApp extends EventDispatcher{constructor(e){super(),this.type="CloudRenderEngine",this.controllers=(null==e?void 0:e.controllers)||{},this.kbEvent=document.createEvent("KeyboardEvent"),this.initMethod=void 0!==this.kbEvent.initKeyboardEvent?"initKeyboardEvent":"initKeyEvent",this.webRtcPlayerObj=null,this.forceTURN=void 0!==e.forceTURN&&e.forceTURN,this.print_stats=(null==e?void 0:e.print_stats)||!1,this.print_inputs=(null==e?void 0:e.print_inputs)||!1,this.connect_on_load=(null==e?void 0:e.connect_on_load)||!1,this.is_reconnection=(null==e?void 0:e.is_reconnection)||!1,this.ws,this.wsURL=null==e?void 0:e.wsUrl,this.projectName=null==e?void 0:e.projectName,this.matchmakerIP=null==e?void 0:e.matchmakerIP,this.matchmakerPort=(null==e?void 0:e.matchmakerPort)||"90",this.scene=new Scene,(this.scene.engine=this).qualityController=!1,this.qualityControlOwnershipCheckBox,this.matchViewportResolution=(null==e?void 0:e.matchViewportResolution)||!1,this.lastTimeResized=(new Date).getTime(),this.resizeTimeout,this.onDataChannelConnected;var{controlScheme:t=inputOptions.controlScheme,suppressBrowserKeys:i=inputOptions.suppressBrowserKeys,fakeMouseWithTouches:s=inputOptions.fakeMouseWithTouches}=(null==e?void 0:e.inputOptions)||{};this.inputOptions={controlScheme:t,suppressBrowserKeys:i,fakeMouseWithTouches:s},this.eventHandler=new EventHandler(this),this.freezeFrameOverlay=null,this.shouldShowPlayOverlay=null==e?void 0:e.shouldShowPlayOverlay,this.freezeFrame={receiving:!1,size:0,jpeg:void 0,height:0,width:0,valid:!1},this.file={mimetype:"",extension:"",receiving:!1,size:0,data:[],valid:!1,timestampStart:void 0},this.afk=(null==e?void 0:e.afk)||{enabled:!1,warnTimeout:120,closeTimeout:10,active:!1,overlay:void 0,warnTimer:void 0,countdown:0,countdownTimer:void 0},this.editTextButton=void 0,this.hiddenInput=void 0,this.t0=Date.now(),this.dataTransferFrequence=20,this.streamTrackSource=null,this.VideoEncoderQP=(null==e?void 0:e.VideoEncoderQP)||"N/A",this.UDSParams=(null==e?void 0:e.UDSParams)||{},this.UDS,this.styleWidth,this.styleHeight,this.styleTop,this.styleLeft,this.styleCursor=(null==e?void 0:e.styleCursor)||"default",this.styleAdditional,this._orientationChangeTimeout,this.playerElementClientRect=void 0,this.normalizeAndQuantizeUnsigned=void 0,this.normalizeAndQuantizeSigned=void 0,this.isShowTestUI=null==e?void 0:e.isShowTestUI,setTimeout(()=>{this.interval(this.dataTransferFrequence)},1e3),this.initObjectBBox()}interval(e=5){setInterval(()=>{this.eventHandler.updateObjectsWithEvent(),this.eventListenerUpdate(this),this.eventListenerUpdate(this.camera),this.scene.traverse(e=>{this.eventListenerUpdate(e),e.visibleNeedsUpdate&&(e.uuid===this.objectBBox.uuid?this.emitUIInteraction({excuteName:InteractMOD.OBJECT_BOUNDINGBOX,params:this.objectBBox.toJSON()}):this.emitUIInteraction({excuteName:GisControl.VISIBLE,params:e.toJSON()}),e.visibleNeedsUpdate=!1),e.visible&&(e.matrixNeedsUpdate||e.materialNeedsUpdate||e.animateNeedsUpdate)&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:ApplicationControl.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?this.emitUIInteraction({excuteName:SceneControl.EVENT_LAYER_BUILDING,params:e.toJSON()}):"SlopeAnalysis"===e.type?this.emitUIInteraction({excuteName:SceneControl.UPDATA_SLOPE_ANALYSIS,params:e.toJSON()}):this.emitUIInteraction({excuteName:GisControl.UPDATE,params:e.toJSON()}),e.matrixNeedsUpdate=!1,e.materialNeedsUpdate=!1,e.animateNeedsUpdate=!1),e.visible&&e.messageNeedsUpdate&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:ApplicationControl.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):this.emitUIInteraction({excuteName:GisControl.UPDATE,params:e.toJSON()}),e.messageNeedsUpdate=!1),e.followNeedsUpdate&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:ApplicationControl.FOLLOW_TRAFFIC_STREAM_ITEM,params:e.toJSON(!1)}):"AutonomousVehicle"===e.type&&this.emitUIInteraction({excuteName:GisControl.UPDATE,params:e.toJSON()}),e.followNeedsUpdate=!1)}),this.camera&&this.camera.needsUpdate&&(this.camera.constrainPolygonNeedsUpdate?(this.emitUIInteraction({excuteName:CameraControl.Constrain_Shape,params:this.camera.toJSON()}),this.camera.constrainPolygonNeedsUpdate=!1):this.emitUIInteraction({excuteName:CameraControl.UPDATE,params:this.camera.toJSON()}),this.camera.needsUpdate=!1)},1e3/e)}eventListenerUpdate(e){e&&e._needsDispatchedToUE&&(e._dispatchAddListenerTypes&&0<e._dispatchAddListenerTypes.length&&(this.emitUIInteraction({excuteName:ApplicationControl.ADD_EVENT_LISTENER,params:{type:e.type,name:e.name,uuid:e.uuid,EventType:e._dispatchAddListenerTypes}}),e._dispatchAddListenerTypes=[]),e._dispatchRemoveListenerTypes&&0<e._dispatchRemoveListenerTypes.length&&(this.emitUIInteraction({excuteName:ApplicationControl.REMOVE_EVENT_LISTENER,params:{type:e.type,name:e.name,uuid:e.uuid,EventType:e._dispatchRemoveListenerTypes}}),e._dispatchRemoveListenerTypes=[]),e._needsDispatchedToUE=!1,e._dispatchName=null)}log(e){console.log(Math.floor(Date.now()-this.t0)+": "+e)}initCamera(){var e;this.camera&&(null!=(e=this.camera)&&e.removeFromParent(),this.camera=null),this.camera=new Camera,this.camera.type="Camera",this.camera.addEventListener("cameraChange",e=>{var t,i=e.content.camera;this.camera.position.x=i.Location.longitude,this.camera.position.y=i.Location.latitude,this.camera.position.z=i.Location.altitude,this.camera.rotation.x=MathUtils.degToRad(i.Rotate.roll),this.camera.rotation.y=MathUtils.degToRad(i.Rotate.pitch),this.camera.rotation.z=MathUtils.degToRad(i.Rotate.yaw),this.camera.roll=i.Rotate.roll,this.camera.pitch=i.Rotate.pitch,this.camera.yaw=i.Rotate.yaw,this.camera.worldLocation.x=null==i||null==(t=i.Position)?void 0:t.x,this.camera.worldLocation.y=null==i||null==(t=i.Position)?void 0:t.y,this.camera.worldLocation.z=null==i||null==(t=i.Position)?void 0:t.z,this.camera.sphereLocation.x=null==i||null==(t=i.SphereLocation)?void 0:t.longitude,this.camera.sphereLocation.y=null==i||null==(t=i.SphereLocation)?void 0:t.latitude,this.camera.sphereLocation.z=null==i||null==(t=i.SphereLocation)?void 0:t.altitude,this.level=Math.ceil(Math.max(Math.log2(103300/this.camera.worldLocation.z),0)),this.dispatchEvent({type:"camera_changed",data:e})})}initObjectBBox(){if(this.objectBBox)return!1;this.objectBBox=new Cube({color:new Color$1(1,1,0)}),this.scene.add(this.objectBBox),this.objectBBox.visible=!1,this.emitUIInteraction({excuteName:InteractMOD.OBJECT_BOUNDINGBOX,params:this.objectBBox.toJSON()})}scanGamepads(){var t=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[];for(let e=0;e<t.length;e++)t[e]&&t[e].index in this.controllers&&(this.controllers[t[e].index].currentState=t[e])}updateStatus(){for(j in this.scanGamepads(),this.controllers){var e=this.controllers[j],t=e.currentState,i=e.prevState;for(let e=0;e<t.buttons.length;e++){var s=t.buttons[e],a=i.buttons[e];s.pressed&&!a.pressed?6==e?this.emitControllerAxisMove(j,5,s.value):7==e?this.emitControllerAxisMove(j,6,s.value):this.emitControllerButtonPressed(j,e,0):!s.pressed&&a.pressed?6==e?this.emitControllerAxisMove(j,5,0):7==e?this.emitControllerAxisMove(j,6,0):this.emitControllerButtonReleased(j,e):s.pressed&&a.pressed&&(6==e?this.emitControllerAxisMove(j,5,s.value):7==e?this.emitControllerAxisMove(j,6,s.value):this.emitControllerButtonPressed(j,e,1))}for(let e=0;e<t.axes.length;e+=2){var o=parseFloat(t.axes[e].toFixed(4)),n=-parseFloat(t.axes[e+1].toFixed(4));0===e?(this.emitControllerAxisMove(j,1,o),this.emitControllerAxisMove(j,2,n)):2===e&&(this.emitControllerAxisMove(j,3,o),this.emitControllerAxisMove(j,4,n))}this.controllers[j].prevState=t}rAF(this.updateStatus)}emitControllerButtonPressed(e,t,i){(Data=new DataView(new ArrayBuffer(4))).setUint8(0,MessageType.GamepadButtonPressed),Data.setUint8(1,e),Data.setUint8(2,t),Data.setUint8(3,i)}emitControllerButtonReleased(e,t){(Data=new DataView(new ArrayBuffer(3))).setUint8(0,MessageType.GamepadButtonReleased),Data.setUint8(1,e),Data.setUint8(2,t)}emitControllerAxisMove(e,t,i){(Data=new DataView(new ArrayBuffer(11))).setUint8(0,MessageType.GamepadAnalog),Data.setUint8(1,e),Data.setUint8(2,t),Data.setFloat64(3,i,!0),this.sendInputData(Data.buffer)}setupToggleWithUrlParams(e,i){e=document.getElementById(e);e&&(e.checked=new URLSearchParams(window.location.search).has(i),e.addEventListener("change",e=>{var t=new URLSearchParams(window.location.search);e.currentTarget.checked?t.set(i,"true"):t.delete(i),window.history.replaceState({},"",""!==t.toString()?location.pathname+"?"+t:""+location.pathname)}))}updateStreamList(){var e,t,i=document.getElementById("stream-select");for(let e=i.options.length-1;0<=e;e--)i.remove(e);i.value=null;for([e,t]of this.webRtcPlayerObj.availableVideoStreams){var s=document.createElement("option");s.value=e,s.innerHTML=e,i.appendChild(s),null==i.value&&(i.value=e)}this.updateTrackList()}updateTrackList(){var e=document.getElementById("stream-select"),t=document.getElementById("track-select"),e=this.webRtcPlayerObj.availableVideoStreams.get(e.value);for(let e=t.options.length-1;0<=e;e--)t.remove(e);t.value=null;for(const s of e.getVideoTracks()){var i=document.createElement("option");i.value=s.id,i.innerHTML=s.label,t.appendChild(i),s.selected&&(t.value=s.id)}}sendStartLatencyTest(){const t=this;this.webRtcPlayerObj&&this.webRtcPlayerObj.startLatencyTest(function(e){e={StartTime:e};t.emitDescriptor(MessageType.LatencyTest,e)})}setOverlay(e,t,i){let s=document.getElementById("videoPlayOverlay");var a;for(s||(a=document.getElementById("player"),(s=document.createElement("div")).id="videoPlayOverlay",a&&a.appendChild(s));s.lastChild;)s.removeChild(s.lastChild);t&&s.appendChild(t),i&&s.addEventListener("click",function e(t){i(t),s.removeEventListener("click",e)});var o=s.classList;for(let e=o.length-1;0<=e;e--)o.remove(o[e]);s.classList.add(e)}showConnectOverlay(){var e=document.createElement("div");e.id="playButton",e.innerHTML="点击开始",this.setOverlay("clickableState",e,e=>{this.connect(),this.startAfkWarningTimer()})}showTextOverlay(e){var t=document.createElement("div");t.id="messageOverlay",t.innerHTML=e||"",this.setOverlay("textDisplayState",t)}playVideoStream(){const t=this;t.webRtcPlayerObj&&this.webRtcPlayerObj.video?(t.webRtcPlayerObj.video.play().catch(function(e){console.error(e),console.log("Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),t.showPlayOverlay()}),t.requestInitialSettings(),t.requestQualityControl(),t.eventHandler.showFreezeFrameOverlay(),t.hideOverlay()):console.error("Could not player video stream because this.webRtcPlayerObj.video was not valid.")}showPlayOverlay(){var e=document.createElement("img");e.id="playButton",e.src="/images/Play.png",e.alt="Start Streaming",this.setOverlay("clickableState",e,e=>{this.playVideoStream()}),this.shouldShowPlayOverlay=!1}updateAfkOverlayText(){this.afk.overlay.innerHTML="<center>No activity detected<br>Disconnecting in "+this.afk.countdown+" seconds<br>Click to continue<br></center>"}showAfkOverlay(){this.stopAfkWarningTimer(),this.afk.overlay=document.createElement("div"),this.afk.overlay.id="afkOverlay",this.setOverlay("clickableState",this.afk.overlay,e=>{this.hideOverlay(),clearInterval(this.afk.countdownTimer),this.startAfkWarningTimer()}),this.afk.countdown=this.afk.closeTimeout,this.updateAfkOverlayText(),this.inputOptions.controlScheme==ControlSchemeType.LockedMouse&&document.exitPointerLock(),this.afk.countdownTimer=setInterval(function(){this.afk.countdown--,0==this.afk.countdown?(this.hideOverlay(),this.ws.close()):this.updateAfkOverlayText()},1e3)}hideOverlay(){this.setOverlay("hiddenState")}startAfkWarningTimer(){this.afk.active=this.afk.enabled,this.resetAfkWarningTimer()}stopAfkWarningTimer(){this.afk.active=!1}resetAfkWarningTimer(){const e=this;this.afk.active&&(clearTimeout(this.afk.warnTimer),this.afk.warnTimer=setTimeout(function(){e.showAfkOverlay()},1e3*e.afk.warnTimeout))}createWebRtcOffer(){this.webRtcPlayerObj?(console.log("Creating offer"),this.showTextOverlay("云渲染服务连接中,请稍等"),this.webRtcPlayerObj.createOffer()):(console.log("WebRTC player not setup, cannot create offer"),this.showTextOverlay("云渲染服务连接失败,无法获取画面"))}sendInputData(e){this.webRtcPlayerObj&&(this.resetAfkWarningTimer(),this.webRtcPlayerObj.send(e))}setupWebRtcPlayer(e,t){const a=this;function o(e){this.freezeFrame.receiving||(this.freezeFrame.receiving=!0,this.freezeFrame.valid=!1,this.freezeFrame.size=0,this.freezeFrame.jpeg=void 0),this.freezeFrame.size=new DataView(e.slice(1,5).buffer).getInt32(0,!0);var t,e=e.slice(5);this.freezeFrame.jpeg?((t=new Uint8Array(this.freezeFrame.jpeg.length+e.length)).set(this.freezeFrame.jpeg,0),t.set(e,this.freezeFrame.jpeg.length),this.freezeFrame.jpeg=t):(this.freezeFrame.jpeg=e,this.freezeFrame.receiving=!0,console.log(`received first chunk of freeze frame: ${this.freezeFrame.jpeg.length}/`+this.freezeFrame.size)),this.freezeFrame.jpeg.length===this.freezeFrame.size?(this.freezeFrame.receiving=!1,this.freezeFrame.valid=!0,console.log("received complete freeze frame "+this.freezeFrame.size),function(){var e=btoa(this.freezeFrame.jpeg.reduce((e,t)=>e+String.fromCharCode(t),""));let t=document.getElementById("this.freezeFrameOverlay").childNodes[0];t.src="data:image/jpeg;base64,"+e,t.onload=function(){a.freezeFrame.height=t.naturalHeight,a.freezeFrame.width=t.naturalWidth,a.resizeFreezeFrameOverlay(),a.shouldShowPlayOverlay?(a.showPlayOverlay(),a.eventHandler.resizePlayerStyle()):a.eventHandler.showFreezeFrameOverlay(),a.webRtcPlayerObj.setVideoEnabled(!1)}}()):this.freezeFrame.jpeg.length>this.freezeFrame.size&&(console.error(`received bigger freeze frame than advertised: ${this.freezeFrame.jpeg.length}/`+this.freezeFrame.size),this.freezeFrame.jpeg=void 0,this.freezeFrame.receiving=!1)}return this.webRtcPlayerObj=new webRtcPlayer({...t,forceTURN:this.forceTURN}),e.appendChild(this.webRtcPlayerObj.video),e.appendChild(this.freezeFrameOverlay),this.connect_on_load&&(this.webRtcPlayerObj.video.muted=!0),this.webRtcPlayerObj.onWebRtcOffer=function(e){var t;a.ws&&a.ws.readyState===WS_OPEN_STATE&&(t=JSON.stringify(e),console.log("%c[Outbound SS message (offer)]","background: lightgreen; color: black",e),a.ws.send(t))},this.webRtcPlayerObj.onWebRtcCandidate=function(e){a.ws&&a.ws.readyState===WS_OPEN_STATE&&a.ws.send(JSON.stringify({type:"iceCandidate",candidate:e}))},this.webRtcPlayerObj.onWebRtcAnswer=function(e){var t;a.ws&&a.ws.readyState===WS_OPEN_STATE&&(t=JSON.stringify(e),console.log("%c[Outbound SS message (answer)]","background: lightgreen; color: black",e),a.ws.send(t))},this.webRtcPlayerObj.onVideoInitialised=function(){a.ws&&a.ws.readyState===WS_OPEN_STATE&&(a.shouldShowPlayOverlay?(a.showPlayOverlay(),a.eventHandler.resizePlayerStyle()):(a.eventHandler.resizePlayerStyle(),a.playVideoStream()))},this.webRtcPlayerObj.onDataChannelConnected=function(){a.ws&&a.ws.readyState===WS_OPEN_STATE&&(a.showTextOverlay("云渲染服务连接成功,等待画面推送中"),a.requestQualityControl(),setTimeout(()=>{a.UDS||(a.UDS=new UltralDynamicSky(a,a.UDSParams)),a.camera||a.initOthers(),a.dispatchEvent({type:"videoInitialised"})},1e3))},this.webRtcPlayerObj.onNewVideoTrack=function(e){var t;null!==a&&void 0!==a&&null!=(t=a.webRtcPlayerObj)&&t.onVideoInitialised&&null!==a&&void 0!==a&&null!=(t=a.webRtcPlayerObj)&&t.onVideoInitialised(),a.isShowTestUI&&a.updateStreamList()},this.webRtcPlayerObj.onDataChannelMessage=function(e){var t,i,s=new Uint8Array(e);s[0]===ToClientMessageType.QualityControlOwnership?(i=0!==s[1],console.log("Received quality controller message, will control quality: "+i),a.qualityController=i,a.qualityControlOwnershipCheckBox&&(a.qualityControlOwnershipCheckBox.disabled=i,a.qualityControlOwnershipCheckBox.checked=i)):s[0]===ToClientMessageType.Response?(i=new TextDecoder("utf-16").decode(e.slice(1)),a.eventHandler.callRespone(JSON.parse(i))):s[0]===ToClientMessageType.Command?(i=new TextDecoder("utf-16").decode(e.slice(1)),console.log(i),"onScreenKeyboard"===(i=JSON.parse(i)).command&&a.showOnScreenKeyboard(i)):s[0]===ToClientMessageType.FreezeFrame?o(s):s[0]===ToClientMessageType.UnfreezeFrame?a.eventHandler.invalidateFreezeFrameOverlay():s[0]===ToClientMessageType.VideoEncoderAvgQP?a.VideoEncoderQP=new TextDecoder("utf-16").decode(e.slice(1)):s[0]==ToClientMessageType.LatencyTest?(i=new TextDecoder("utf-16").decode(e.slice(1)),console.log("Got latency timings from UE."),console.log(i),i=JSON.parse(i),a.webRtcPlayerObj&&a.webRtcPlayerObj.latencyTestTimings.SetUETimings(i)):s[0]==ToClientMessageType.InitialSettings?a.isShowTestUI&&(i=new TextDecoder("utf-16").decode(e.slice(1)),(i=JSON.parse(i)).PixelStreaming&&(!1===i.PixelStreaming.AllowPixelStreamingCommands&&(document.getElementById("encoder-min-qp-text").disabled=!0,document.getElementById("encoder-max-qp-text").disabled=!0,document.getElementById("webrtc-fps-text").disabled=!0,document.getElementById("webrtc-min-bitrate-text").disabled=!0,document.getElementById("webrtc-max-bitrate-text").disabled=!0,document.getElementById("show-fps-button").disabled=!0,document.getElementById("encoder-params-submit").disabled=!0,document.getElementById("webrtc-params-submit").disabled=!0,document.getElementById("warning-elem-webrtc")||((t=document.createElement("p")).innerText="(Disabled by -AllowPixelStreamingCommands=false)",t.classList="subtitle-text",t.id="warning-elem-webrtc",document.getElementById("webRTCSettingsHeader").appendChild(t)),document.getElementById("warning-elem-encoder")||((t=document.createElement("p")).innerText="(Disabled by -AllowPixelStreamingCommands=false)",t.classList="subtitle-text",t.id="warning-elem-encoder",document.getElementById("encoderSettingsHeader").appendChild(t)),console.warn("-AllowPixelStreamingCommands=false, sending console commands from browser to UE is disabled, including toggling FPS and changing encoder settings from the browser.")),i.PixelStreaming.DisableLatencyTest)&&(document.getElementById("test-latency-button").disabled=!0,document.getElementById("test-latency-button").title="Disabled by -PixelStreamingDisableLatencyTester=true",console.warn("-PixelStreamingDisableLatencyTester=true, requesting latency report from the the browser to UE is disabled.")),i.Encoder&&(document.getElementById("encoder-min-qp-text").value=i.Encoder.MinQP,document.getElementById("encoder-max-qp-text").value=i.Encoder.MaxQP),i.WebRTC)&&(document.getElementById("webrtc-fps-text").value=i.WebRTC.FPS,document.getElementById("webrtc-min-bitrate-text").value=i.WebRTC.MinBitrate/1e3,document.getElementById("webrtc-max-bitrate-text").value=i.WebRTC.MaxBitrate/1e3):s[0]==ToClientMessageType.FileExtension?function(e){this.file.receiving||(this.file.mimetype="",this.file.extension="",this.file.receiving=!0,this.file.valid=!1,this.file.size=0,this.file.data=[],this.file.timestampStart=(new Date).getTime(),console.log("Received first chunk of this.file")),e=new TextDecoder("utf-16").decode(e.slice(1)),console.log(e),this.file.extension=e}(s):s[0]==ToClientMessageType.FileMimeType?function(e){this.file.receiving||(this.file.mimetype="",this.file.extension="",this.file.receiving=!0,this.file.valid=!1,this.file.size=0,this.file.data=[],this.file.timestampStart=(new Date).getTime(),console.log("Received first chunk of this.file")),e=new TextDecoder("utf-16").decode(e.slice(1)),console.log(e),this.file.mimetype=e}(s):s[0]==ToClientMessageType.FileContents?function(e){var t;this.file.receiving&&(this.file.size=Math.ceil(new DataView(e.slice(1,5).buffer).getInt32(0,!0)/16379),e=e.slice(5),this.file.data.push(e),console.log(`Received this.file chunk: ${this.file.data.length}/`+this.file.size),this.file.data.length===this.file.size?(this.file.receiving=!1,this.file.valid=!0,console.log("Received complete this.file"),e=(new Date).getTime()-this.file.timestampStart,t=Math.round(16*this.file.size*1024/e),console.log(`Average transfer bitrate: ${t}kb/s over ${e/1e3} seconds`),t=new Blob(this.file.data,{type:this.file.mimetype}),(e=document.createElement("a")).setAttribute("href",URL.createObjectURL(t)),e.setAttribute("download","transfer."+this.file.extension),(t=$(e)).appendTo("body"),t.remove()):this.file.data.length>this.file.size&&(this.file.receiving=!1,console.error(`Received bigger this.file than advertised: ${this.file.data.length}/`+this.file.size)))}(s):s[0]==ToClientMessageType.Mouse?(t=new TextDecoder("utf-16").decode(e.slice(1)),this.eventHandler.dispatchMouseEvent(t)):s[0]==ToClientMessageType.Keyboard?(i=new TextDecoder("utf-16").decode(e.slice(1)),this.eventHandler.dispatchKeyboardEvent(i)):s[0]==ToClientMessageType.InputControlOwnership||s[0]==ToClientMessageType.Protocol?new TextDecoder("utf-16").decode(e.slice(1)):console.error("unrecognized data received, packet ID "+s[0])},this.eventHandler.registerInputs(this.webRtcPlayerObj.video),"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(e),this.webRtcPlayerObj.video}setupStats(){this.webRtcPlayerObj.aggregateStats(1e3);let y=3e5;this.webRtcPlayerObj.onAggregatedStats=e=>{var t=new Intl.NumberFormat(window.navigator.language,{maximumFractionDigits:0}),i=new Intl.NumberFormat(window.navigator.language,{maximumFractionDigits:0,minimumIntegerDigits:2});let s=(e.timestamp-e.timestampStart)/1e3;var a=[],o=[60,60];for(let e=0;e<o.length;e++)a.push(s%o[e]),s/=o[e];a.push(s);var n=a[0],r=Math.floor(a[1]),l=Math.floor([a[2]]);let h="B",d=e.hasOwnProperty("bytesReceived")?e.bytesReceived:0;var c=["kB","MB","GB"];for(let e=0;e<c.length&&!(d<1e5);e++)d/=1e3,h=c[e];e.receivedBytes=""+d+c;let u=document.getElementById("qualityStatus");function p(e){let t=e,i=1,s=setInterval(function(){i-=.1,u.style="opacity: "+Math.abs(2*(i-.5)),i<=.1&&(0==--t?clearInterval(s):i=1)},100/e)}let m="",g="lime";35<this.VideoEncoderQP?(g="red",p(2),m+=`<div style="color: ${g}">Very blocky encoding quality</div>`):26<this.VideoEncoderQP&&(g="orange",p(1),m+=`<div style="color: ${g}">Blocky encoding quality</div>`),u.className=g+"Status",m=(m=(m=(m=(m=(m=(m=(m=(m=(m=(m+=`<div>Duration: ${i.format(l)}:${i.format(r)}:${i.format(n)}</div>`)+`<div>Video Resolution: ${e.hasOwnProperty("frameWidth")&&e.frameWidth&&e.hasOwnProperty("frameHeight")&&e.frameHeight?e.frameWidth+"x"+e.frameHeight:"Chrome only"}</div>`)+`<div>Received (${h}): ${t.format(d)}</div>`)+`<div>Frames Decoded: ${e.hasOwnProperty("framesDecoded")?t.format(e.framesDecoded):"Chrome only"}</div>`)+`<div>Packets Lost: ${e.hasOwnProperty("packetsLost")?t.format(e.packetsLost):"Chrome only"}</div>`)+`<div>Framerate: ${e.hasOwnProperty("framerate")?t.format(e.framerate):"Chrome only"}</div>`)+`<div>Frames dropped: ${e.hasOwnProperty("framesDropped")?t.format(e.framesDropped):"Chrome only"}</div>`)+`<div>Net RTT (ms): ${e.hasOwnProperty("currentRoundTripTime")?t.format(1e3*e.currentRoundTripTime):"Can't calculate"}</div>`)+`<div>Browser receive to composite (ms): ${e.hasOwnProperty("receiveToCompositeMs")?t.format(e.receiveToCompositeMs):"Chrome only"}</div>`)+`<div style="color: ${g}">Bitrate (kbps): ${e.hasOwnProperty("bitrate")?t.format(e.bitrate):"Chrome only"}</div>`)+`<div style="color: ${g}">Video Quantization Parameter: ${this.VideoEncoderQP}</div>`,document.getElementById("stats").innerHTML=m,this.print_stats&&e.timestampStart&&e.timestamp-e.timestampStart>y&&(this.ws&&this.ws.readyState===WS_OPEN_STATE&&(console.log(`-> SS: stats
2
+ `+JSON.stringify(e)),this.ws.send(JSON.stringify({type:"stats",data:e}))),y+=3e5),this.dispatchEvent({type:"aggregatedStats",data:e})},this.webRtcPlayerObj.latencyTestTimings.OnAllLatencyTimingsReady=function(i){if(i.BrowserReceiptTimeMs){var s=i.BrowserReceiptTimeMs-i.TestStartTimeMs,a=i.UEEncodeMs,o=i.UECaptureToSendMs,n=i.UETransmissionTimeMs-i.UEReceiptTimeMs,r=s-n;let e=null,t=null;i.FrameDisplayDeltaTimeMs&&i.BrowserReceiptTimeMs&&(e=i.FrameDisplayDeltaTimeMs+r+("string"==typeof o?0:o),t=i.FrameDisplayDeltaTimeMs+(s-r-n));s="",s=(s=(s=(s=(s=(s=(s+=`<div>Net latency RTT (ms): ${r.toFixed(2)}</div>`)+`<div>UE Encode (ms): ${"string"==typeof a?a:a.toFixed(2)}</div>`)+`<div>UE Send to capture (ms): ${"string"==typeof o?o:o.toFixed(2)}</div>`)+`<div>UE probe duration (ms): ${n.toFixed(2)}</div>`)+(i.FrameDisplayDeltaTimeMs&&i.BrowserReceiptTimeMs?`<div>Browser composite latency (ms): ${i.FrameDisplayDeltaTimeMs.toFixed(2)}</div>`:""))+(t?`<div>Total browser latency (ms): ${t.toFixed(2)}</div>`:""))+(e?`<div>Total latency (ms): ${e.toFixed(2)}</div>`:"");document.getElementById("LatencyStats").innerHTML=s}}}onWebRtcOffer(e){this.webRtcPlayerObj.receiveOffer(e),this.isShowTestUI&&this.setupStats()}onWebRtcAnswer(e){this.webRtcPlayerObj.receiveAnswer(e),this.isShowTestUI&&this.setupStats()}onWebRtcIce(e){this.webRtcPlayerObj&&this.webRtcPlayerObj.handleCandidateFromServer(e)}updateVideoStreamSize(){var e;this.matchViewportResolution&&(1e4<(new Date).getTime()-this.lastTimeResized?(e=document.getElementById("player"))&&(e={ConsoleCommand:"setres "+e.clientWidth+"x"+e.clientHeight},this.emitCommand(e),console.log(e),this.lastTimeResized=(new Date).getTime()):console.log("Resizing too often - skipping"))}emitDescriptor(t,e){var i=compress(e),s=49152;if(67108864<2*i.length)return console.error("数据量超出最大传输范围6.4MB!"),!1;if(2*i.length<s)return this.sendStringBufferData(t,i),!1;var a=Math.ceil(2*i.length/s);for(let e=0;e<a;e++){var o=i.slice(.5*e*s,24576*(e+1));this.sendStringBufferData(t,o,a,e+1)}}sendStringBufferData(e,t,i=1,s=1){var a=JSON.stringify({total:i,index:s,content:t}),o=new DataView(new ArrayBuffer(3+2*a.length));let n=0;o.setUint8(n,e),n++,o.setUint16(n,a.length,!0),n+=2;for(let e=0;e<a.length;e++)o.setUint16(n,a.charCodeAt(e),!0),n+=2;this.sendInputData(o.buffer)}emitUIInteraction(e){console.log(e),this.emitDescriptor(MessageType.UIInteraction,e)}emitCommand(e){this.emitDescriptor(MessageType.Command,e)}requestInitialSettings(){this.sendInputData(new Uint8Array([MessageType.RequestInitialSettings]).buffer)}requestQualityControl(){this.qualityController||this.sendInputData(new Uint8Array([MessageType.RequestQualityControl]).buffer)}setupNormalizeAndQuantize(){let s=document.getElementById("player");var e=s.getElementsByTagName("video");if(s&&0<e.length){var t=s.clientHeight/s.clientWidth,e=e[0].videoHeight/e[0].videoWidth;if(e<t){this.print_inputs&&console.log("Setup Normalize and Quantize for playerAspectRatio > videoAspectRatio");let i=t/e;this.normalizeAndQuantizeUnsigned=(e,t)=>{e/=s.clientWidth,t=i*(t/s.clientHeight-.5)+.5;return e<0||1<e||t<0||1<t?{inRange:!1,x:65535,y:65535}:{inRange:!0,x:65536*e,y:65536*t}},this.unquantizeAndDenormalizeUnsigned=(e,t)=>{e/=65536,t=(t/65536-.5)/i+.5;return{x:e*s.clientWidth,y:t*s.clientHeight}},this.normalizeAndQuantizeSigned=(e,t)=>{return{x:32767*(e/(.5*s.clientWidth)),y:32767*(i*t/(.5*s.clientHeight))}}}else{this.print_inputs&&console.log("Setup Normalize and Quantize for playerAspectRatio <= videoAspectRatio");let i=e/t;this.normalizeAndQuantizeUnsigned=(e,t)=>{e=i*(e/s.clientWidth-.5)+.5,t/=s.clientHeight;return e<0||1<e||t<0||1<t?{inRange:!1,x:65535,y:65535}:{inRange:!0,x:65536*e,y:65536*t}},this.unquantizeAndDenormalizeUnsigned=(e,t)=>{t/=65536;return{x:((e/65536-.5)/i+.5)*s.clientWidth,y:t*s.clientHeight}},this.normalizeAndQuantizeSigned=(e,t)=>{return{x:32767*(i*e/(.5*s.clientWidth)),y:32767*(t/(.5*s.clientHeight))}}}}}createOnScreenKeyboardHelpers(e){const t=this;null===document.getElementById("this.hiddenInput")&&(this.hiddenInput=document.createElement("input"),this.hiddenInput.id="this.hiddenInput",this.hiddenInput.maxLength=0,e.appendChild(this.hiddenInput)),null===document.getElementById("this.editTextButton")&&(this.editTextButton=document.createElement("button"),this.editTextButton.id="this.editTextButton",this.editTextButton.innerHTML="edit text",e.appendChild(this.editTextButton),this.editTextButton.classList.add("hiddenState"),this.editTextButton.addEventListener("click",function(){t.hiddenInput.focus()}))}showOnScreenKeyboard(e){e.showOnScreenKeyboard?(this.editTextButton.classList.remove("hiddenState"),e=this.unquantizeAndDenormalizeUnsigned(e.x,e.y),this.editTextButton.style.top=e.y.toString()+"px",this.editTextButton.style.left=(e.x-40).toString()+"px"):(this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur())}start(){var e=document.getElementById("qualityStatus"),e=(e&&(e.className="grey-status"),document.getElementById("stats"));e&&(e.innerHTML="Not connected"),!this.connect_on_load||this.is_reconnection?(this.showConnectOverlay(),this.eventHandler.invalidateFreezeFrameOverlay(),this.shouldShowPlayOverlay=!0,this.eventHandler.resizePlayerStyle()):(console.log("直接链接~~~~~~"),this.connect())}buildingGrowthAnimate(e){var{state:e="play",group:t=1,duration:i=3e3,startHeight:s=0,endHeight:a=100,loop:o=!1,easing:n="Linear",sliceColor:r={r:1,g:0,b:0},sliceBrightness:l=30,colorHeight:h=100}=e;this.emitUIInteraction({excuteName:InteractMOD.BUILD_GROWTHANIMATE,params:JSON.stringify({State:e,Group:t,Duration:i,StartHeight:s,EndHeight:a,Loop:o,Easing:n,SliceColor:r,SliceBrightness:l,ColorHeight:h})})}changeResolution(e,t){void 0===e||void 0===t?console.warn("传入的参数为空"):this.emitUIInteraction({excuteName:ApplicationControl.CONSOLE_COMMAND,params:{Command:"r.SetRes "+e+"x"+t}})}excuteEngineConsoleCommand(e){void 0===e?console.warn("传入的参数为空"):this.emitUIInteraction({excuteName:ApplicationControl.CONSOLE_COMMAND,params:{Command:e}})}Swtich3DTilesMode(e){var{mode:e,tilesName:t}=e;this.emitUIInteraction({excuteName:SceneControl.SWITCH_TERRAIN_MODE,params:{Mode:e,TilesName:t}})}enable3DTilesByName(e){var{enable:e=!0,tilesName:t}=e;this.emitUIInteraction({excuteName:SceneControl.ENABLE_3DTILES_BY_NAME,params:{Enable:e,TilesName:t}})}hidden3DTilesItem(e){let{hiddenList:t=[],tilesName:i}=e;Array.isArray(t)||(t=[]),this.emitUIInteraction({excuteName:SceneControl.HIDDEN_3DTILES_ITEM,params:{HiddenList:t,TilesName:i}})}changeWeather(e){console.warn("方法被移除,请使用UDS设置天气"),e&&this.UDS.changeWeather(e)}changeTime(e=8,t=10){console.warn("方法被移除,请使用UDS设置时间"),this.UDS.changeTime(e,t)}setWorldCenterPoint(e,t,i=10){if(void 0===e||void 0===t)return console.warn("传入的参数为空"),!1;this.emitUIInteraction({excuteName:ApplicationControl.RESET_WORLD_CENTER,params:{Center:{Latitude:MathUtils.clamp(e,-180,180),Longitude:MathUtils.clamp(t,-90,90),Altitude:MathUtils.clamp(i,-500,8848)}}})}moveTo(e,t={roll:0,pitch:0,yaw:0},i={duration:1,preload:!1,endLineDetect:!1,detectLength:5e4,flyOverLongitude:!1,zoom:-1,number:0,isGlobalMove:!1,globalCityCenter:null,callback:null}){if(!e)return!1;this.emitUIInteraction({excuteName:CameraControl.MOVE_TO,params:{Longitude:null==e?void 0:e.x,Latitude:null==e?void 0:e.y,Altitude:null==e?void 0:e.z,rotation:{Roll:null==t?void 0:t.roll,Pitch:null==t?void 0:t.pitch,Yaw:null==t?void 0:t.yaw},Duration:null==i?void 0:i.duration,Preload:null==i?void 0:i.preload,EndLineDetect:null==i?void 0:i.endLineDetect,DetectLength:null==i?void 0:i.detectLength,FlyOverLongitude:null==i?void 0:i.flyOverLongitude,Zoom:null==i?void 0:i.zoom,Number:null==i?void 0:i.number,IsGlobalMove:null==i?void 0:i.isGlobalMove,GlobalCityCenter:null==i?void 0:i.globalCityCenter}}),null!=i&&i.callback&&this.camera.addEventListener("moveTo",i.callback)}moveCamera(e){var{multiplier:e=1,x:t=0,y:i=0}=e;this.emitUIInteraction({excuteName:CameraControl.MOVE,params:{Multiplier:e,ActionValue:{x:t,y:i}}})}rotateCamera(e){var{multiplier:e=1,yaw:t=0,pitch:i=0}=e;this.emitUIInteraction({excuteName:CameraControl.ROTATE,params:{Multiplier:e,ActionValue:{x:t,y:i}}})}zoomIn(e=1){this.emitUIInteraction({excuteName:CameraControl.ZOOM_IN,params:{Multiplier:e}})}zoomOut(e=1){this.emitUIInteraction({excuteName:CameraControl.ZOOM_OUT,params:{Multiplier:e}})}focusOn(e,t={duration:1,index:-1,preload:!1,rotation:{roll:0,pitch:0,yaw:0},flyOverLongitude:!1,callback:null}){if(!e)return!1;this.emitUIInteraction({excuteName:CameraControl.FOCUS_ON,params:{uuid:null==e?void 0:e.uuid,type:null==e?void 0:e.type,rotation:{Roll:null==t||null==(e=t.rotation)?void 0:e.roll,Pitch:null==t||null==(e=t.rotation)?void 0:e.pitch,Yaw:null==t||null==(e=t.rotation)?void 0:e.yaw},Duration:null==t?void 0:t.duration,Preload:null==t?void 0:t.preload,Index:null==t?void 0:t.index,FlyOverLongitude:null==t?void 0:t.flyOverLongitude}}),null!=t&&t.callback&&this.camera.addEventListener("focusOn",t.callback)}navigateByKeypoints(i,e={}){const{lockAll:t=!0,speed:s=36,time:a=0,ignoreLag:o=!1,name:n="",patrolType:r="default",followRotation:l={Roll:!1,Pitch:!1,Yaw:!1},finishDestory:h=!0,rayDetectionDistance:d=1e3,callback:c=null,startCallback:u=null,finishCallback:p=null}=e;if(!i||i.length<2)return!1;u&&this.camera.addEventListener("navigationStart",u);const m=[];for(let e=0,t=i.length;e<t;e++){var g=i[e];m.push(g[0],g[1],g[2]||10,g[3]||0,g[4]||0,g[5]||0)}setTimeout(()=>{this.emitUIInteraction({excuteName:CameraControl.NAVIGATION,params:JSON.stringify({jsondata:m,Speed:s,Name:n,Time:a,IgnoreLag:o,LockAll:t,PatrolType:r,FollowRotation:l,RayDetectionDistance:d,FinishDestory:h})})},100),(p||c)&&(p?this.camera.addEventListener("navigationFinish",p):this.camera.addEventListener("navigationFinish",c))}pauseNavigation(e={}){var{patrolType:e="default"}=e;this.emitUIInteraction({excuteName:CameraControl.NAVIGATION_PAUSE,params:{State:0,PatrolType:e}})}resumeNavigation(e={}){var{patrolType:e="default"}=e;this.emitUIInteraction({excuteName:CameraControl.NAVIGATION_PAUSE,params:{State:1,PatrolType:e}})}stopNavigation(e={}){const{patrolType:t="default",delayTime:i=100}=e;setTimeout(()=>{this.emitUIInteraction({excuteName:CameraControl.NAVIGATION_STOP,params:{PatrolType:t}})},i)}enableDataLayerByName(e,t){this.emitUIInteraction({excuteName:InteractMOD.ENABLE_DATALAYER,params:{Visible:t,DataLayerName:e}})}project(e,t){if(!e)return!1;this.emitUIInteraction({excuteName:CameraControl.PROJECT,params:{Position:{x:e.x,y:e.y,z:e.z}}}),this.camera.addEventListener("project",t)}unproject(e,t){if(!e)return!1;this.emitUIInteraction({excuteName:CameraControl.UNPROJECT,params:{Position:{x:e.x,y:e.y}}}),this.camera.addEventListener("unproject",t)}getAltitudeFromCoordinate(e,t){if(!e)return!1;const i={Coordinate:e.coordinate,DetectLength:e.detectLength||100};this.addEventListener("getAltitude",t),setTimeout(()=>{this.emitUIInteraction({excuteName:SceneControl.GET_ALTITUDE,params:i})},100)}exit(){this.emitUIInteraction({excuteName:ApplicationControl.EXIT_CLIENT})}restartLevel(){return!1}restartGame(){this.emitUIInteraction({excuteName:ApplicationControl.RESTART_GAME}),this.dispatchEvent({type:"gameResarted"})}addToScene(e){e&&(this.scene.add(e),e.materialNeedsUpdate=!1,e.matrixNeedsUpdate=!1,e.animateNeedsUpdate=!1,"TrafficLayer"===e.type?this.emitUIInteraction({excuteName:ApplicationControl.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?this.emitUIInteraction({excuteName:SceneControl.EVENT_LAYER_BUILDING,params:e.toJSON(!1)}):"SlopeAnalysis"===e.type?this.emitUIInteraction({excuteName:SceneControl.UPDATA_SLOPE_ANALYSIS,params:e.toJSON()}):this.emitUIInteraction({excuteName:GisControl.ADD,params:e.toJSON(!1)}))}removeFromScene(e){this.destoryObject(e)}removeAllFromScene(){this.emitUIInteraction({excuteName:GisControl.DESTORY_ALL}),this.scene.clear()}destoryObject(e){e&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:ApplicationControl.CLOSE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?(e.buildingState="destory",this.emitUIInteraction({excuteName:SceneControl.EVENT_LAYER_BUILDING,params:e.toJSON(!1)})):this.emitUIInteraction({excuteName:GisControl.DESTORY,uuid:e.uuid}),e.dispose&&e.dispose(),this.scene.remove(e))}enableEdit(e,t,i){let s=null,a={};if(this.drawAndMeasureGroup||(this.drawAndMeasureGroup=new Group,this.scene.add(this.drawAndMeasureGroup)),"measure"===e)switch(this.editMode="measure",s=DrawAndMeasureControl.ENABLE_MEASURE,t.toLowerCase()){case"polygon":case"measurearea":this.drawAndMeasureGroup.measureArea?this.drawAndMeasureGroup.measureArea.updateParameters(i):(o=new MeasureArea(i),this.drawAndMeasureGroup.measureArea=o,this.drawAndMeasureGroup.add(o)),a=this.drawAndMeasureGroup.measureArea.toJSON();break;case"line":case"measureline":this.drawAndMeasureGroup.measureLine?this.drawAndMeasureGroup.measureLine.updateParameters(i):(o=new MeasureLine(i),this.drawAndMeasureGroup.measureLine=o,this.drawAndMeasureGroup.add(o)),a=this.drawAndMeasureGroup.measureLine.toJSON();break;case"surfaceline":this.drawAndMeasureGroup.surfaceline?this.drawAndMeasureGroup.surfaceline.updateParameters(i):(o=new SurfaceLine(i),this.drawAndMeasureGroup.surfaceline=o,this.drawAndMeasureGroup.add(o)),a=this.drawAndMeasureGroup.surfaceline.toJSON();break;default:var o;this.drawAndMeasureGroup.locationPoint?this.drawAndMeasureGroup.locationPoint.updateParameters(i):(o=new LocationPoint(i),this.drawAndMeasureGroup.locationPoint=o,this.drawAndMeasureGroup.add(o)),a=this.drawAndMeasureGroup.locationPoint.toJSON()}else switch(this.editMode="draw",s=DrawAndMeasureControl.ENABLE_DRAW,t){case"polygon":if(this.drawAndMeasureGroup.polygon)for(const r in i)this.drawAndMeasureGroup.polygon[r]!==i[r]&&(this.drawAndMeasureGroup.polygon[r]=i[r]);else{var n=new Polygon(i);this.drawAndMeasureGroup.polygon=n,this.drawAndMeasureGroup.add(n)}a=this.drawAndMeasureGroup.polygon.toJSON();break;case"line":if(this.drawAndMeasureGroup.line)for(const l in i)this.drawAndMeasureGroup.line[l]!==i[l]&&(this.drawAndMeasureGroup.line[l]=i[l]);else{n=new Line(i);this.drawAndMeasureGroup.line=n,this.drawAndMeasureGroup.add(n)}a=this.drawAndMeasureGroup.line.toJSON();break;default:if(this.drawAndMeasureGroup.point)for(const h in i)this.drawAndMeasureGroup.point[h]!==i[h]&&(this.drawAndMeasureGroup.point[h]=i[h]);else{n=new Point(i);this.drawAndMeasureGroup.point=n,this.drawAndMeasureGroup.add(n)}a=this.drawAndMeasureGroup.point.toJSON()}this.emitUIInteraction({ExcuteName:s,params:a})}closeEdit(){if(this.editMode){let e=DrawAndMeasureControl.CLOSE_DRAW;"measure"===this.editMode&&(e=DrawAndMeasureControl.CLOSE_MEASURE),this.emitUIInteraction({ExcuteName:e})}}setFPS(e=!1){this.emitUIInteraction({ExcuteName:InteractMOD.ENABLE_FPS,params:{state:e}})}removeAllEditObjects(e="all",t=["point","line","polygon","surfaceline"]){if(this.drawAndMeasureGroup&&!(this.drawAndMeasureGroup.children.length<1)){var i=[];if(e)switch(e){case"draw":-1<(t=!Array.isArray(t)||t.length<1?["point","line","polygon"]:t).indexOf("polygon")&&this.drawAndMeasureGroup.polygon&&(i.push(this.drawAndMeasureGroup.polygon.uuid),this.drawAndMeasureGroup.polygon.removeFromParent(),this.drawAndMeasureGroup.polygon=null),-1<t.indexOf("line")&&this.drawAndMeasureGroup.line&&(i.push(this.drawAndMeasureGroup.line.uuid),this.drawAndMeasureGroup.line.removeFromParent(),this.drawAndMeasureGroup.line=null),-1<t.indexOf("point")&&this.drawAndMeasureGroup.point&&(i.push(this.drawAndMeasureGroup.point.uuid),this.drawAndMeasureGroup.point.removeFromParent(),this.drawAndMeasureGroup.point=null),this.emitUIInteraction({ExcuteName:DrawAndMeasureControl.DESTORY_DRAW,params:{uuids:i,Classes:t}});break;case"measure":var s=(t=!Array.isArray(t)||t.length<1?["point","line","polygon","surfaceline"]:t).indexOf("polygon");-1<s&&(t.splice(s,1),t.push("MeasureArea")),-1<s&&this.drawAndMeasureGroup.measureArea&&(i.push(this.drawAndMeasureGroup.measureArea.uuid),this.drawAndMeasureGroup.measureArea.removeFromParent(),this.drawAndMeasureGroup.measureArea=null),-1<(s=t.indexOf("line"))&&(t.splice(s,1),t.push("MeasureLine")),-1<s&&this.drawAndMeasureGroup.measureLine&&(i.push(this.drawAndMeasureGroup.measureLine.uuid),this.drawAndMeasureGroup.measureLine.removeFromParent(),this.drawAndMeasureGroup.measureLine=null),-1<(s=t.indexOf("point"))&&(t.splice(s,1),t.push("LocationPoint")),-1<s&&this.drawAndMeasureGroup.locationPoint&&(i.push(this.drawAndMeasureGroup.locationPoint.uuid),this.drawAndMeasureGroup.locationPoint.removeFromParent(),this.drawAndMeasureGroup.locationPoint=null),-1<(s=t.indexOf("surfaceline"))&&(t.splice(s,1),t.push("SurfaceLine")),-1<s&&this.drawAndMeasureGroup.surfaceline&&(i.push(this.drawAndMeasureGroup.surfaceline.uuid),this.drawAndMeasureGroup.surfaceline.removeFromParent(),this.drawAndMeasureGroup.surfaceline=null),this.emitUIInteraction({ExcuteName:DrawAndMeasureControl.DESTORY_MEASURE,params:{uuids:i,Classes:t}});break;case"all":this.emitUIInteraction({ExcuteName:DrawAndMeasureControl.DESTORY_DRAW,params:{uuids:i,Classes:["Point","Line","Polygon"]}}),this.emitUIInteraction({ExcuteName:DrawAndMeasureControl.DESTORY_MEASURE,params:{uuids:i,Classes:["MeasureArea","MeasureLine","LocationPoint","SurfaceLine"]}}),this.drawAndMeasureGroup.children=[],this.scene.remove(this.drawAndMeasureGroup),this.drawAndMeasureGroup=null}}}connect(){const t=this,i=e=>{window.WebSocket=window.WebSocket||window.MozWebSocket,window.WebSocket?(t.reclickToStart&&clearTimeout(t.reclickToStart),t.ws=new WebSocket(e),t.ws.onmessage=function(e){t.connected||(t.dispatchEvent({type:"connected"}),t.connected=!0);e=JSON.parse(e.data);"config"===e.type?(console.log("%c[Inbound SS (config)]","background: lightblue; color: black",e),t.onConfig(e)):"playerCount"===e.type?console.log("%c[Inbound SS (playerCount)]","background: lightblue; color: black",e):"offer"===e.type?(console.log("%c[Inbound SS (offer)]","background: lightblue; color: black",e),t.onWebRtcOffer(e)):"answer"===e.type?(console.log("%c[Inbound SS (answer)]","background: lightblue; color: black",e),t.onWebRtcAnswer(e)):"iceCandidate"===e.type?t.onWebRtcIce(e.candidate):"warning"===e.type&&e.warning?console.warn(e.warning):"pong"===e.type?console.log("pong",e.time):console.error("Invalid SS message type",e.type)},t.ws.onerror=function(e){console.log("WS error: "+JSON.stringify(e))},t.ws.onclose=function(e){console.log(`WS closed: ${JSON.stringify(e.code)} - `+e.reason),t.ws=void 0,t.is_reconnection=!0,t.connected&&(t.dispatchEvent({type:"disconnected"}),t.connected=!1);e=document.getElementById("player");t.webRtcPlayerObj&&(e.removeChild(t.webRtcPlayerObj.video),t.webRtcPlayerObj.close(),t.webRtcPlayerObj=void 0),t.showTextOverlay("云渲染服务未正常连接"),t.reclickToStart=setTimeout(()=>{t.connect()},4e3)}):alert("Your browser doesn't support WebSocket")};var e;return t.wsURL||this.projectName?t.wsURL||this.matchmakerIP?void(t.wsURL?i(t.wsURL):(e=`http://${this.matchmakerIP}:${this.matchmakerPort}/gpuserver?project=`+this.projectName,axios.get(e).then(e=>{if(e.data&&e.data.error)return console.error(e.data.error),!1;e=`ws://${e.data.gpuServer}:`+e.data.port;i(e)}).catch(e=>{console.error(e)}))):(console.error("Needs a matchmaker's IP"),!1):(console.error("Needs a projectName"),!1)}onConfig(e){var t=document.getElementById("player"),i=this.setupWebRtcPlayer(t,e);switch(this.eventHandler.resizePlayerStyle(),this.inputOptions.controlScheme){case ControlSchemeType.HoveringMouse:this.eventHandler.registerHoveringMouseEvents(i);break;case ControlSchemeType.LockedMouse:this.eventHandler.registerLockedMouseEvents(i);break;default:console.log("ERROR: Unknown control scheme "+this.inputOptions.controlScheme),this.eventHandler.registerLockedMouseEvents(i)}}setupModelInfo(e,t,i,s){if(!e)return!1;var a,o;s||(o=(o=(a=e.split("://"))[1].split("/")[0]).includes(":")?o.split(":")[0]:o,s=a[0]+`://${o}/twin/assetApi/getStaticResourceUrl`),t=t||{all:1,common:1,project_id:"418690084255052706"},this.emitUIInteraction({excuteName:InteractMOD.ASSET_MODEL,params:{ModInfoUrl:e,StaticResourceURL:s,ModInfoBody:t,ModInfoHeader:i}})}initOthers(){this.initCamera(),document.addEventListener("keydown",e=>{(116===e.keyCode||e.ctrlKey&&82===e.keyCode)&&(window._frash_=!0)}),window.onbeforeunload=()=>{this.levelReady||window._frash_||(this.levelReady=!0),window._frash_=!1}}load(){this.eventHandler.setupHtmlEvents(),this.eventHandler.setupFreezeFrameOverlay(),this.eventHandler.registerKeyboardEvents(),this.start(),animate((new Date).getTime())}}function animate(){rAF(animate),update()}class ODLine extends Shape{constructor(e={}){super(e),this.parameters=e,this.renderNum=void 0===e.renderNum?20:e.renderNum,this.visible=void 0===e.visible||e.visible;let t=e.width||1,i=e.circleScale||50,s=void 0!==e.startHide&&e.startHide,a=void 0!==e.endHide&&e.endHide,o=e.speed||.5,n=e.opacity||.02,r=e.brightness||100,l=e.angle||40;this.type="ODLine",Object.defineProperties(this,{angle:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},width:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},circleScale:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},startHide:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},endHide:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}},speed:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},opacity:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},brightness:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=getUELineData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Angle:this.angle,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Width:this.width,CircleScale:this.circleScale,StartHide:this.startHide,EndHide:this.endHide,Speed:this.speed,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,RenderNum:this.renderNum}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.width=e.width,this.circleScale=e.circleScale,this.speed=e.speed,this.startHide=e.startHide,this.endHide=e.endHide,super.copy(e,t),this}}function getFinalFaceType(e){switch(e){case 0:return"DoNotFcaeToCamera";case 1:return"FacetoCamera_XYZ";case 2:return"FacetoCamera_Y";case 3:return"FacetoCamera_Z";default:return"FacetoCamera_XYZ"}}class IconPoint extends Shape{constructor(e={}){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum;let t=e.pivot||{x:.5,y:.5},i=(this.visible=void 0===e.visible||e.visible,this.isGlobalPOI=void 0!==e.isGlobalPOI&&e.isGlobalPOI,e.text||null),s=e.iconUrl||"",a=e.texture||"",o=e.width||32,n=e.height||32,r=e.iconPathName||"",l=void 0===e.hideText||e.hideText,h=void 0!==e.hideImage&&e.hideImage,d=e.renderScale||1,c=(this.renderType=e.renderType||0,this.openCollision=void 0!==e.openCollision&&e.openCollision,0===e.faceType?0:e.faceType||1),u=void 0!==e.switchScale&&e.switchScale,p=e.minScale||0,m=e.maxScale||0,g=e.fontSize||12;this.fadeIn=void 0===e.fadeIn||e.fadeIn,this.type="IconPoint",Object.defineProperties(this,{pivot:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},text:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},iconUrl:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},texture:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}},width:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},height:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},faceType:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{c=e,this.materialNeedsUpdate=!0}},switchScale:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{u=e,this.materialNeedsUpdate=!0}},minScale:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{p=e,this.materialNeedsUpdate=!0}},maxScale:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{m=e,this.materialNeedsUpdate=!0}},iconPathName:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},hideText:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},hideImage:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=e,this.materialNeedsUpdate=!0}},renderScale:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}},fontSize:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{g=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Pivot:this.pivot,Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,IconUrl:this.iconUrl,Width:this.width,Height:this.height,IconPathName:this.iconPathName,IsGlobalPOI:this.isGlobalPOI,HideText:this.hideText,HideImage:this.hideImage,RenderScale:this.renderScale,FontSize:this.fontSize,RenderType:this.renderType,FadeIn:this.fadeIn,OpenCollision:this.openCollision,FaceType:getFinalFaceType(this.faceType),SwitchScale:this.switchScale,MaxScale:this.maxScale,MinScale:this.minScale,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,Size:this.size,SizeAttenuation:this.sizeAttenuation,RenderNum:this.renderNum}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},FadeIn:this.fadeIn,type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.iconUrl=e.iconUrl,this.width=e.width,this.height=e.height,this.iconPathName=e.iconPathName,this.hideText=e.hideText,this.hideImage=e.hideImage,this.renderScale=e.renderScale,this.fontSize=e.fontSize,super.copy(e,t),this}}class TextPoint extends Shape{constructor(e={}){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum,this.visible=void 0===e.visible||e.visible,this.isGlobalPOI=void 0!==e.isGlobalPOI&&e.isGlobalPOI;let t=e.backgroundColor||{r:0,g:0,b:0,a:0},i=e.backgroundImage||"",s=this.getMargin(e.margin)||{Top:0,Right:0,Bottom:0,Left:0},a=e.fontSize||24,o=e.fontWeight||"Regular",n=e.borderWidth||0,r=e.borderColor||{r:0,g:0,b:0,a:1},l=e.shadowColor||{r:0,g:0,b:0,a:1},h=e.shadowOffset||{x:0,y:0},d=e.pivot||{x:.5,y:.5},c=(this.renderType=e.renderType||0,this.fadeIn=void 0===e.fadeIn||e.fadeIn,this.openCollision=void 0!==e.openCollision&&e.openCollision,0===e.faceType?0:e.faceType||1),u=void 0!==e.switchScale&&e.switchScale,p=e.minDistance||0,m=e.maxDistance||0,g=void 0===e.minScale?1:e.minScale,y=void 0===e.maxScale?1:e.maxScale;this.autoWrap=e.autoWrap||!1,this.type="TextPoint",Object.defineProperties(this,{backgroundImage:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},backgroundColor:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},margin:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=this.getMargin(e),this.materialNeedsUpdate=!0}},fontSize:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}},fontWeight:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},borderWidth:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},borderColor:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},shadowColor:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},shadowOffset:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=e,this.materialNeedsUpdate=!0}},pivot:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}},faceType:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{c=e,this.materialNeedsUpdate=!0}},switchScale:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{u=e,this.materialNeedsUpdate=!0}},minDistance:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{p=e,this.materialNeedsUpdate=!0}},maxDistance:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{m=e,this.materialNeedsUpdate=!0}},minScale:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{g=e,this.materialNeedsUpdate=!0}},maxScale:{configurable:!0,enumerable:!0,get:()=>y,set:e=>{y=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=getUEPointData(e)}getMargin(e){let t;if(Array.isArray(e))return e.length<2?t={Top:e[0]||0,Right:e[0]||0,Bottom:e[0]||0,Left:e[0]||0}:e.length<3?t={Top:e[0]||0,Right:e[1]||0,Bottom:e[0]||0,Left:e[1]||0}:e.length<4?t={Top:e[0]||0,Right:e[1]||0,Bottom:e[2]||0,Left:e[1]||0}:e.length<5&&(t={Top:e[0]||0,Right:e[1]||0,Bottom:e[2]||0,Left:e[3]||0}),t}toJSON(e=!0){return e&&this.visibleNeedsUpdate&&!this.materialNeedsUpdate?{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,FadeIn:this.fadeIn,type:this.type,name:this.name,uuid:this.uuid}:{Pivot:this.pivot,Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},BackgroundColor:{r:this.backgroundColor.r,g:this.backgroundColor.g,b:this.backgroundColor.b,a:this.backgroundColor.a},BackgroundImageURL:this.backgroundImage,IsGlobalPOI:this.isGlobalPOI,Margin:this.margin,AutoWrap:this.autoWrap,Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,FontWeight:this.fontWeight,FontSize:this.fontSize,BorderWidth:this.borderWidth,BorderColor:this.borderColor,ShadowColor:this.shadowColor,ShadowOffset:this.shadowOffset,RenderType:this.renderType,FadeIn:this.fadeIn,OpenCollision:this.openCollision,FaceType:getFinalFaceType(this.faceType),SwitchScale:this.switchScale,MinDistance:this.minDistance,MaxDistance:this.maxDistance,MaxScale:this.maxScale,MinScale:this.minScale,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,RenderNum:this.renderNum}}copy(e,t=!0){return this.fontWeight=e.fontWeight,this.fontSize=e.fontSize,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.shadowColor=e.shadowColor,this.shadowOffset=e.shadowOffset,super.copy(e,t),this}}function setLabelScale(s,e){var t,i,a,o,n,r={};return Object.assign(r,e),r.style&&({width:e,height:t,borderRadius:i,borderWidth:a,paddingTop:o,paddingLeft:n}=r.style,r.style.width=e*s,r.style.height=t*s,i&&(r.style.borderRadius=i*s),a&&(r.style.borderWidth=a*s),o&&(r.style.paddingTop=o*s),n)&&(r.style.paddingLeft=n*s),r.content&&r.content.forEach(e=>{for(var t in e)"number"==typeof e[t]&&"id"!==t&&(e[t]=e[t]*s);var i=e["position"];i&&(e.position=i.map(e=>e*s)),e.textList&&e.textList.forEach(e=>{e.fontSize=e.fontSize*s,e.position=e.position.map(e=>e*s)})}),r}class BasicLabel extends Shape{constructor(e){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum,this.name=e.name||"",this.pivot=e.pivot||{x:.5,y:.5},this.offset=e.offset||{x:0,y:0,z:0},this.sizeAttenuation=e.sizeAttenuation||!1,this.constructionConfig=e.constructionConfig||{},this.labelType=e.labelType||"sprite",this.hideText=e.hideText||!1,this.faceType=0===e.faceType?0:e.faceType||1,this.switchScale=e.switchScale||!1,this.renderType=e.renderType||0;let t=e.renderScale||.3,i=(this.minScale=e.minScale||1,this.maxScale=e.maxScale||1,this.type="IconPoint",this.visible=void 0===e.visible||e.visible,this.fadeIn=void 0===e.fadeIn||e.fadeIn,e);"mesh"!==this.labelType&&!this.sizeAttenuation||(i=setLabelScale(t,e)),this.style=i.style,this.drawCanvas=document.createElement("canvas"),this.animationCanvas=document.createElement("canvas"),this.mainView=null,this.sprite=null,this.texture=null,this.animateId=null,this.size=e.size||20,this.extraProps={args:e},i.style?(this.init(i).then(()=>{this.materialNeedsUpdate=!0}),Object.defineProperties(this,{renderScale:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}}})):console.warn("请正确设置BasicLabel的style")}async init(e={}){var{}=this.style,t=(this.mainView=document.createElement("canvas"),await BasicLabel.initBackGround(this.style,this.mainView));this.drawCanvas.width=this.animationCanvas.width=t.width,this.drawCanvas.height=this.animationCanvas.height=t.height,this.factor=t.factor,this.width=t.width,this.height=t.height,this.dispatchEvent({type:"loaded",label:this}),e.content&&await this.drawContent(e.content,!0)}async drawContent(e,t=!1){t||"mesh"!==this.labelType&&!this.sizeAttenuation||(e=setLabelScale(this.renderScale,{content:e}).content);var t=this.drawCanvas.getContext("2d"),{width:i,height:s}=this.drawCanvas;t.clearRect(0,0,i,s),t.drawImage(this.mainView,0,0,i,s),await BasicLabel.renderContent(this.style,e,this.drawCanvas,this.factor),this.texture=convertCanvas2Base64(this.drawCanvas),this.dispatchEvent({type:"contentLoaded",label:this})}updateContent(e={}){let t=e;"mesh"!==this.labelType&&!this.sizeAttenuation||(t=setLabelScale(this.renderScale,e)),this.extraProps={args:e},t.style&&(this.style=t.style),this.init(t).then(()=>{this.materialNeedsUpdate=!0})}getFinalFaceType(e){if(e)switch(e){case 0:return"DoNotFcaeToCamera";case 1:return"FacetoCamera_XYZ";case 2:return"FacetoCamera_Y";case 3:return"FacetoCamera_Z";default:return"FacetoCamera_XYZ"}return"FacetoCamera_XYZ"}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Pivot:this.pivot,Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,HideText:this.hideText,RenderType:this.renderType,FadeIn:this.fadeIn,OpenCollision:this.openCollision,FaceType:this.getFinalFaceType(this.faceType),SwitchScale:this.switchScale,MaxScale:this.maxScale,MinScale:this.minScale,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:1,y:1,z:1},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Width:this.width,Height:this.height,RenderScale:this.renderScale,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,Size:this.size,SizeAttenuation:this.sizeAttenuation,RenderNum:this.renderNum}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},FadeIn:this.fadeIn,type:this.type,name:this.name,uuid:this.uuid}}dispose(){this.children=[],this.sprite=null,this.texture=null,this.drawCanvas=null,this.animationCanvas=null,this.mainView=null}static async initBackGround(e,t){var{height:e,width:i,backgroundImage:s,borderRadius:a,borderColor:o,borderWidth:n,backgroundColor:r,clip:l}=e,h=t.getContext("2d"),d=MathUtils.ceilPowerOfTwo(i),d={width:d,height:d*(e/i),factor:{xScale:d/i,yScale:d/i}},{xScale:t,yScale:c}=(t.width=d.width,t.height=d.height,d.factor);return s?(s=await BasicLabel.loadImg(s,""),h.drawImage(s,0,0,i*t,e*c)):(o||r)&&(h.strokeStyle=o,h.fillStyle=r,h.lineWidth=n?n*t:+t,BasicLabel.roundRect(h,h.lineWidth*t,h.lineWidth*c,(i-2*h.lineWidth)*t,(e-2*h.lineWidth)*c,a?a*t:0),r&&h.fill(),o)&&h.stroke(),l&&([s,n,a,r]=l,h.beginPath(),h.moveTo(r*i*t,s*e*c),h.lineTo((1-n)*i*t,s*e*c),h.lineTo((1-n)*i*t,(1-a)*e*c),h.lineTo(r*i*t,(1-a)*e*c),h.lineTo(r*i*t,s*e*c),h.closePath(),h.clip()),d}static async renderContent(t,i,e,s){const a=e.getContext("2d");var{width:o,height:n}=e,{paddingTop:e,paddingLeft:r}=t;let l=0,h=0,d=0,c=0;const{xScale:u,yScale:p}=s;var m=r?r*u:0,g=e?e*p:0;const y=[m,g];var f=[];for(let e=0;e<i.length;e++){var{width:b,height:x,textList:v,marginRight:S,marginBottom:C,backgroundImage:U,borderRadius:N,borderColor:w,borderWidth:T,backgroundColor:O,position:M,id:z,activeInfo:R={}}=i[e];if(M&&([M,A]=M,y[0]=m+M*u,y[1]=g+A*p,l=0,h=0,d=0,c=0),b&&x){if(y[0]+b*u>o&&((d+=l)+x*p<=h?(y[0]=c,y[1]+=l):(y[0]=r?r*u:0,y[1]+=l,h=0,c=0)),U)try{var E=await BasicLabel.loadImg(U,"");a.drawImage(E,y[0],y[1],b*u,x*p)}catch(e){console.warn(e)}else O&&(a.strokeStyle=w,a.fillStyle=O,a.lineWidth=T?T*u:+u,BasicLabel.roundRect(a,y[0]+a.lineWidth*u,y[1]+a.lineWidth*u,(b-2*a.lineWidth)*u,(x-2*a.lineWidth)*p,N?N*u:0),O&&a.fill(),w)&&a.stroke();v&&v.forEach(e=>{var[t,i]=e.position,t=[y[0]+t*u,y[1]+i*p];BasicLabel.drawText(a,e,s,t)});var M=y[0]===(r?r*u:0)*u?-.16:-1.3,A=-(n-y[1]-25*p)*(2.05/(107*p))+.1;if(z){const{position:I,style:t={width:5,height:.95}}=R;U=BasicLabel.addActiveArea(I||{x:M,y:A},t);U.customId=z,f.push(U)}y[0]+=(b+(S||0))*u,(l=(x+(C||0))*p)>h&&(h=l,c=y[0])}else v&&v.forEach(e=>{var[t,i]=e.position,t=[y[0]+t*u,y[1]+i*p];BasicLabel.drawText(a,e,s,t)})}return f}static getRectangle(e,t,i,s={}){i=new MeshBasicMaterial({map:i,transparent:!0,fog:!0,depthWrite:!1,...s}),i.map&&(i.map.needsUpdate=!0),i.transparent=!0,s=(.01*e).toFixed(2),e=(.01*t).toFixed(2),t=new PlaneBufferGeometry(Number(s),Number(e),1,1),t=new Mesh(t,i);return t.setWidth=s,t.setHeight=e,t}static loadImg(e,t=""){const i=new Image;return i.crossOrigin="Anonymous",i.src=t+e,new Promise((e,t)=>{i.addEventListener("load",()=>{e(i)}),i.onerror=e=>{t(e)}})}static getTextWidth(e,t){var{fontSize:t,fontFamily:i,color:s,text:a}=t,e=e.getContext("2d"),t=(e.font=t+"px "+i,e.fillStyle=s,e.textAlign="left",e.measureText(a).width);return t}static drawText(e,t,i,s){var i=i["xScale"],[s,a]=s,{text:t,fontSize:o,fontFamily:n,color:r,textAlign:l,icon:h}=t;let d;if(t||"number"==typeof t||h)if(t&&h)console.warn("BasicLabel Warning:text和icon不要同时设置");else{if(d=t,e.font=o*i+"px "+n,e.fillStyle=r,e.textAlign=l||"left",e.textBaseline="top",h){let e=h;-1!==h.indexOf("&amp;")&&(e=h.replace("&amp;","&")),-1!==h.indexOf("&amp")&&(e=h.replace("&amp","&")),d=new Function('return ("'+(""+e).replace("&#x","\\u").replace(";","")+'")')()}e.measureText(d).width;e.fillText(d,s,a)}}static addActiveArea(e,t){var{width:t,height:i}=t,{x:e,y:s}=e,a=new SpriteMaterial({depthTest:!0,depthWrite:!1,transparent:!0,sizeAttenuation:!0,opacity:0}),a=new Sprite(a);return a.scale.set(t,i,1),a.material.color=new Color$1("#58d2d4"),a.center.set(e,s),a}static roundRect(e,t,i,s,a,o){e.beginPath(),e.moveTo(t+o,i),e.lineTo(t+s-o,i),e.quadraticCurveTo(t+s,i,t+s,i+o),e.lineTo(t+s,i+a-o),e.quadraticCurveTo(t+s,i+a,t+s-o,i+a),e.lineTo(t+o,i+a),e.quadraticCurveTo(t,i+a,t,i+a-o),e.lineTo(t,i+o),e.quadraticCurveTo(t,i,t+o,i),e.closePath()}}class Cone extends Shape{constructor(e){super(e),this.type="Cone"}}class FlashCar extends Shape{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashCar"}}class FlashCarCrash extends Shape{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashCarCrash"}}class FlashPeople extends Shape{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashPeople"}}class Cylinder extends Shape{constructor(e){super(e),this.type="Cylinder"}}class Decal extends Shape{constructor(e){super(e),this.type="Decal"}toJSON(e=!0){var t,i,s,a;return this.animateJson&&({From:a,To:t}=this.animateJson,a&&a.scale&&({x:i,z:s}=a.scale,a.scale.x=s,a.scale.z=i),t)&&t.scale&&({x:s,z:a}=t.scale,t.scale.x=a,t.scale.z=s),!this.visibleNeedsUpdate||!e||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Scroll:this.scroll,Speed:this.speed,Texture:this.texture,GardientDirection:this.gardientDirection,Color2:{r:this.color2.r,g:this.color2.g,b:this.color2.b,a:this.opacity},BrightnessColor:this.brightnessColor?{r:this.brightnessColor.r,g:this.brightnessColor.g,b:this.brightnessColor.b,a:1}:Color,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.z,y:this.scale.y,z:this.scale.x},Rotation:{x:this.rotation.x,y:this.rotation.y+90,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,animateNeedsUpdate:this.animateNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid,jsondata:e?null:this.data,animateJson:this.animateNeedsUpdate?this.animateJson:null,Size:this.size,SizeAttenuation:this.sizeAttenuation}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.z,y:this.scale.y,z:this.scale.x},Rotation:{x:this.rotation.x,y:this.rotation.y+90,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}class Plane extends Shape{constructor(e){super(e),this.type="Plane"}}class QuadPyramid extends Shape{constructor(e){super(e),this.type="QuadPyramid"}}class Sphere extends Shape{constructor(e){super(e),this.type="Sphere"}}class TrafficCone extends Shape{constructor(e){super(e),this.type="TrafficCone"}}class Circle extends Shape{constructor(e){super(e),this.type="Circle"}}class Torus extends Shape{constructor(e){super(e),this.type="Torus"}}class Tube extends Shape{constructor(e){super(e),this.type="Tube"}}class DiamondSign extends Shape{constructor(e){super(e),this.type="DiamondSign"}}class Heatmap extends Shape{constructor(e){super(e),this.type="Heatmap",this.kind=e.kind||"texture",this.visible=void 0===e.visible||e.visible,this.container=e.container,this.width=e.width||512,this.height=e.height||512,this.min=e.min,this.max=e.max,this.xName=e.xName,this.yName=e.yName,this.valueName=e.valueName,this.backgroundColor=e.backgroundColor,this.gradient=e.gradient,this.radius=e.radius||40,this.blur=e.blur||.85,this.opacity=e.opacity,this.minOpacity=e.minOpacity||0,this.maxOpacity=e.maxOpacity||1,this.heatmapInstance=null,this.size=e.size||null,this.center=e.center,this.minHeight=e.minHeight||0,this.maxHeight=e.maxHeight||500,this.duration=MathUtils.clamp(e.duration||1,0,100),this.data=e.data;e=e.particle||{};let t=e.bound||{x:100,y:100,z:0},i=e.scaleBoxXY||1,s=e.noiseStrength||0,a,o=e.grayPower||1,n=parseInt(e.countX,10)||400,r=parseInt(e.countY,10)||400;this.particleMaxHeight=e.maxHeight||0,"noiseMap"in e&&(this.noiseMap=a=e.noiseMap,isBase64(a)||loadImageAsBase64(a,e=>{e&&(this.noiseMap=a=e)})),"particle"===this.kind&&(this.gradient={0:"rgb(0, 0, 0)",1:"rgb(256, 256, 256)"}),this.init(),Object.defineProperties(this,{bound:{enumerable:!0,get:function(){return t},set:function(e){e&&"particle"===this.kind&&(t.x=e.x,t.y=e.y,t.z=e.z,this.matrixNeedsUpdate=!0)}},scaleBoxXY:{enumerable:!0,get:function(){return i},set:function(e){console.log(e,i,this.kind),e!==i&&"particle"===this.kind&&(i=e,this.matrixNeedsUpdate=!0)}},noiseStrength:{enumerable:!0,get:function(){return s},set:function(e){e!==s&&"particle"===this.kind&&(s=e,this.matrixNeedsUpdate=!0)}},grayPower:{configurable:!0,enumerable:!0,get:function(){return o},set:function(e){e!==o&&"particle"===this.kind&&(o=e,this.matrixNeedsUpdate=!0)}},countX:{configurable:!0,enumerable:!0,get:function(){return n},set:function(e){e!==n&&"particle"===this.kind&&(n=parseInt(e,10),this.matrixNeedsUpdate=!0)}},countY:{configurable:!0,enumerable:!0,get:function(){return r},set:function(e){e!==r&&"particle"===this.kind&&(r=parseInt(e,10),this.matrixNeedsUpdate=!0)}}})}init(){var e,t,i,s;"particle"===this.kind&&this.data.length<2?console.error("数据量过少,无法绘制粒子热力图"):((i=processData(this.data,this.xName,this.yName,this.valueName,this.width,this.height))&&(void 0===this.min&&(this.min=i.min),void 0===this.max&&(this.max=i.max),i.bbox)&&(this.center||(e=.5*(i.bbox.min.longitude+i.bbox.max.longitude),t=.5*(i.bbox.min.latitude+i.bbox.max.latitude),this.center={x:e,y:t,z:10}),this.size||"particle"!==this.kind&&(e=i.bbox.max.longitude-i.bbox.min.longitude,t=i.bbox.max.latitude-i.bbox.min.latitude,this.size={x:1e5*e,y:1e5*t}),this.bbox=i.bbox),e=this.data,t=this.max,i=this.min,this.heatmapInstance?(this.heatmapInstance.configure(this.getConfig()),this.heatmapInstance.setData({max:t,min:i,data:e}),this.heatmapInstance.repaint()):(this.container||(this.container=creatContainer(this.width,this.height)),(s=draw(this.getConfig()))&&(this.heatmapInstance=s,this.heatmapInstance.setData({max:t,min:i,data:e}))),this.canvas||(this.canvas=this.container.children[0]),this.texture=convertCanvas2Base64(this.canvas),this.materialNeedsUpdate=!0,this.center||(this.center=new Vector3(0,0,10)),"particle"!==this.kind&&(this.size||(this.size=new Vector2(this.width,this.height)),this.scale.set(this.size.x,this.size.y,200)),this.position.set(this.center.x,this.center.y,this.center.z))}setData(e){return!1}getConfig(){return{container:this.container,backgroundColor:this.backgroundColor,gradient:this.gradient,radius:this.radius,opacity:this.opacity,maxOpacity:this.maxOpacity||1,minOpacity:this.minOpacity||0,blur:this.blur||0,width:this.width,height:this.height}}repaint(e){e&&(this.duration=MathUtils.clamp(e,.1,100)),this.init()}getGeojsonData(){if(this.container&&this.heatmapInstance){var e,i=(this.maxHeight-this.minHeight)/(this.max-this.min),s=this.heatmapInstance._renderer._palette,a=[],o=this.size.x/this.width,n=this.size.y/this.height,r=null==(e=this.heatmapInstance)?void 0:e.getData().data;for(let e=0,t=r.length;e<t;e++){var l=parseInt(r[e].x,10),h=parseInt(r[e].y,10),d=Math.max(Math.min(r[e].value,this.max),this.min),c=(d-this.min)*i+this.minHeight,d=Math.floor((d-this.min)/(this.max-this.min)*252),u=r[e].radius,d={r:s[4*d]*(1/256),g:s[4*d+1]*(1/256),b:s[4*d+2]*(1/256)};c<1||(c={type:"Feature",properties:{id:e,height:c,color:d,xSize:u,ySize:u},geometry:{type:"Point",coordinates:[o*(l-.5*this.width)/1e5,n*(h-.5*this.height)/1e5]}},a.push(c))}return a}return!1}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?"texture"===this.kind.toLowerCase()?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,Duration:this.duration,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,Kind:this.kind,uuid:this.uuid}:"particle"===this.kind.toLowerCase()?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,Duration:this.duration,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,Kind:this.kind,uuid:this.uuid,Bound:this.bound,ScaleBoxXY:this.scaleBoxXY,NoiseStrength:this.noiseStrength,NoiseMap:this.noiseMap,GrayPower:this.grayPower,MaxHeight:this.particleMaxHeight||this.maxHeight,countX:this.countX,countY:this.countY,Min:this.bbox.min,Max:this.bbox.max}:(e=this.getGeojsonData(),{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,Kind:this.kind,uuid:this.uuid,jsondata:e}):{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}function creatContainer(e,t){var i=document.createElement("div");return i.style.width=e?e+"px":"512px",i.style.height=t?t+"px":"512px",i.style.top="0px",i.style.display="none",document.getElementsByTagName("body")[0].appendChild(i),i}function processData(i,s,a,o,n,r){if(!i||i.length<1)return!1;let l=1/0,h=-1/0;var d={longitude:1/0,latitude:1/0},c={longitude:-1/0,latitude:-1/0};for(let e=0,t=i.length;e<t;e++){var u=o?i[e][o]:i[e].value;l=Math.min(u,l),h=Math.max(u,h),s&&(i[e].x=i[e][s]),a&&(i[e].y=i[e][a]),o&&(i[e].value=i[e][o]),i[e].longitude&&i[e].latitude&&(d.longitude=Math.min(d.longitude,i[e].longitude),d.latitude=Math.min(d.latitude,i[e].latitude),c.longitude=Math.max(c.longitude,i[e].longitude),c.latitude=Math.max(c.latitude,i[e].latitude))}if(i[0].longitude&&i[0].latitude){if(!i[0].hasOwnProperty("x")&&!i[0].hasOwnProperty("y"))for(let e=0,t=i.length;e<t;e++){var p=c.latitude-d.latitude;i[e].x=Math.round(n*(i[e].longitude-d.longitude)/(c.longitude-d.longitude)),i[e].y=Math.round(r*(i[e].latitude-d.latitude)/p)}return{min:l,max:h,bbox:{min:d,max:c}}}return{min:l,max:h}}function draw(e){var t;return!!e&&(t=e.container||creatContainer(e),h337.create({container:t,backgroundColor:e.backgroundColor||"rgba(0,0,0,.95)",gradient:e.gradient||{0:"rgb(50, 50, 256)",.1:"rgb(50, 250, 56)",.5:"rgb(250, 250, 56)",1:"rgb(250, 50, 56)"},radius:e.radius||40,opacity:e.opacity,maxOpacity:e.maxOpacity||1,minOpacity:e.minOpacity||0}))}class Particle extends Shape{constructor(e={}){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum,this.type="Particle";let t=e.kind||ParticleKind.FIRE_SMALL,i=e.spawnRate||30,s=e.brightness||3,a=e.lifeTime||1;const o=new Color$1(1,0,1);e.brightnessColor&&(o.r=MathUtils.clamp(e.brightnessColor.r,0,1),o.g=MathUtils.clamp(e.brightnessColor.g,0,1),o.b=MathUtils.clamp(e.brightnessColor.b,0,1));let n=e.speed||5,r=e.height||200,l=e.width||.01,h=e.zVelocity||100;this.thickness=e.thickness||.2,Object.defineProperties(this,{kind:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},spawnRate:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},brightness:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},brightnessColor:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o.r=e.r,o.g=e.g,o.b=e.b,o.a=1,this.materialNeedsUpdate=!0)}},speed:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},height:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},width:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},zVelocity:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=e,this.materialNeedsUpdate=!0}},lifeTime:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,BrightnessColor:this.brightnessColor?{r:this.brightnessColor.r,g:this.brightnessColor.g,b:this.brightnessColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},SpawnRate:this.spawnRate,Speed:this.speed,Height:this.height,ZVelocity:this.zVelocity,LifeTime:this.lifeTime,Width:this.width,Kind:this.kind,type:this.type,uuid:this.uuid,Thickness:this.thickness,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,RenderNum:this.renderNum}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.size=e.size,this.kind=e.kind,this.thickness=e.thickness,super.copy(e,t),this}}class TrafficLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}get labelVisible(){return this.label.visible}set labelVisible(e){e!==this.label.visible&&(this.materialNeedsUpdate=!0,this.label.visible=e&&!0)}get message(){return this._message}set message(e){this.messageNeedsUpdate=!0,this._message=e}constructor(e){super(),this.type="TrafficLayer",this.url=e.url,this.eventName=e.eventName||"geo_window_state",this.interval=e.interval||100,this._message=null,this.message=e.message,this.query=e.query,this.label=new Object3D,this.label.visible=void 0!==e._labelVisible&&e._labelVisible,this.rayDetectionDistance=e.rayDetectionDistance||0,this.uiRenderDistance=e.uiRenderDistance||5e4,this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.followNeedsUpdate=!1,this.labelVisible=e.labelVisible,this.offset=new Vector3,this.handShakePath=e.handShakePath||"socket.io",this.namespace=e.namespace||"/",this.carRenderDistance=e.carRenderDistance||3e5,this.labelGroup=e.labelGroup||"highSpeed",this.labelScale=void 0===e.labelScale?1:e.labelScale,this.labelRenderType=void 0===e.labelRenderType?0:e.labelRenderType,this.isSubsection=e.isSubsection||!1}setLabelVisible(e){e!==this.label.visible&&(this.materialNeedsUpdate=!0,this.label.visible=e)}getLabelVisible(){return this.label.visible}dispose(){return!1}followTraffic(e){this.isFollow=null==e?void 0:e.isFollow,this.followCarId=null==e?void 0:e.carId,this.followCarPlateNumber=null==e?void 0:e.plateNumber,this.followColor=(null==e?void 0:e.color)||{r:0,g:1,b:.8},this.followRotations=(null==e?void 0:e.followRotations)||{Roll:!1,Pitch:!1,Yaw:!1},this.followNeedsUpdate=!0}initEventListener(){}toJSON(e=0){return{Url:this.url,EventName:this.eventName,LabelVisible:this.labelVisible,LabelGroup:this.labelGroup,LabelScale:this.labelScale,LabelRenderType:this.labelRenderType,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,Id:this.followCarId,Namespace:this.namespace,HandShakePath:this.handShakePath,FollowColor:this.followColor||{r:0,g:1,b:.8},FollowRotation:this.followRotations||{Roll:!1,Pitch:!1,Yaw:!1},Plate:this.followCarPlateNumber,IsFollow:this.isFollow,Content:this.content,Message:this.message,Query:this.query,RayDetectionDistance:this.rayDetectionDistance,UIRenderDistance:this.uiRenderDistance,CarRenderDistance:this.carRenderDistance,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},IsSubsection:this.isSubsection}}}class RoadCondition extends Line{constructor(e={}){super(e),this.name=e.name||"",this.type="RoadCondition",this.colors=e.colors||{1:(new Color$1).setStyle("#00ff00"),2:(new Color$1).setStyle("#ffff00"),3:(new Color$1).setStyle("#ff0000"),4:(new Color$1).setStyle("#ff00ff")}}setData(e,i="condition"){this.data=getUELineData(e),this.data.forEach(e=>{var t=e.properties[i],t=this.colors[t]||this.colors[1];e.properties.color={r:t.r,g:t.g,b:t.b,a:t.a||1}})}}class ConstructionLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}get coneMap(){return this.cone.map}set coneMap(e){e&&(this.cone.map=e,this.materialNeedsUpdate=!0)}get groundMap(){return this.ground.map}set groundMap(e){e&&(this.ground.map=e,this.materialNeedsUpdate=!0)}get fenceMap(){return this.fence.map}set fenceMap(e){e&&(this.fence.map=e,this.materialNeedsUpdate=!0)}get fenceHeight(){return this._fenceHeight}set fenceHeight(e){e&&(this._fenceHeight=e)}constructor(e={}){super(e),this.initChild();const t=e.coneColor||new Color$1(1,1,1),i=e.groundColor||new Color$1(1,1,1),s=e.fenceColor||new Color$1(1,1,1);let a=e.brightness||0,o=e.roughness||1,n=e.metallic||0,r=(this.coneMap=e.coneMap||null,this.groundMap=e.groundMap||null,this.fenceMap=e.fenceMap||null,this.fenceHeight=e.fenceHeight||1,e.coneOpacity||t.a||1),l=e.groundOpacity||i.a||1,h=e.fenceOpacity||s.a||1;const d=e.bloomColor||null,c=e.position||new Vector3,u=e.rotation||new Euler,p=new Quaternion,m=e.scale||new Vector3(1,1,1),g=e.coneScale||new Vector3(1,1,1),y=e.offset||new Vector3(0,0,0);let f=!1;u._onChange(function(){p.setFromEuler(u,!1),this.matrixNeedsUpdate=!0}),p._onChange(function(){u.setFromQuaternion(p,void 0,!1),this.matrixNeedsUpdate=!0}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{e&&(c.x=e.x,c.y=e.y,c.z=e.z,this.matrixNeedsUpdate=!0)}},rotation:{configurable:!0,enumerable:!0,value:u},quaternion:{configurable:!0,enumerable:!0,value:p},scale:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e&&(m.x=e.x,m.y=e.y,m.z=e.z,this.matrixNeedsUpdate=!0)}},coneScale:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g.x=e.x,g.y=e.y,g.z=e.z,this.matrixNeedsUpdate=!0)}},offset:{configurable:!0,enumerable:!0,get:()=>y,set:e=>{e&&(y.x=e.x,y.y=e.y,y.z=e.z,this.matrixNeedsUpdate=!0)}},coneColor:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t.r=e.r,t.g=e.g,t.b=e.b,e.a&&(r=e.a),this.materialNeedsUpdate=!0)}},groundColor:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i.r=e.r,i.g=e.g,i.b=e.b,e.a&&(l=e.a),this.materialNeedsUpdate=!0)}},fenceColor:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.r=e.r,s.g=e.g,s.b=e.b,e.a&&(h=e.a),this.materialNeedsUpdate=!0)}},coneOpacity:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},groundOpacity:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},fenceOpacity:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=e,this.materialNeedsUpdate=!0}},brightness:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{void 0!==e&&(a=e,this.materialNeedsUpdate=!0)}},roughness:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},metallic:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},bloomColor:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d.copy(e),this.materialNeedsUpdate=!0)}},transparent:{configurable:!0,enumerable:!0,get:()=>f,set:e=>{f=e&&1,this.materialNeedsUpdate=!0}},_visible:{configurable:!0,enumerable:!0,value:!0},_layerName:{configurable:!1,enumerable:!1,value:"CommonGISLayer"},_cloudControlType:{configurable:!1,enumerable:!1,value:"Gis"},type:{configurable:!0,enumerable:!0,value:"Construction"}}),this.matrixNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.visibleNeedsUpdate=!1}initChild(){this.ground=new Polygon,this.add(this.ground),this.fence=new Line,this.add(this.fence),this.cone=new TrafficCone,this.add(this.cone)}setData(e,t=!0){this.data=getUELineData(e,t)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:1,g:1,b:1,a:1},ConeColor:{r:this.coneColor.r,g:this.coneColor.g,b:this.coneColor.b,a:this.coneOpacity},GroundColor:{r:this.groundColor.r,g:this.groundColor.g,b:this.groundColor.b,a:this.groundOpacity},FenceColor:{r:this.fenceColor.r,g:this.fenceColor.g,b:this.fenceColor.b,a:this.fenceOpacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:1,ConeOpacity:this.coneOpacity,GroundOpacity:this.groundOpacity,FenceOpacity:this.fenceOpacity,Transparent:this.transparent,GroundTexture:this.ground.map,ConeTexture:this.cone.map,FenceTexture:this.fence.map,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},ConeScale:{x:this.coneScale.x,y:this.coneScale.y,z:this.coneScale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,groundUuid:this.ground.uuid,coneUuid:this.cone.uuid,fenceUuid:this.fence.uuid,jsondata:e?null:this.data,FenceWidth:this.fenceHeight}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}dispose(){this.traverse(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose(),e.texture=null}),this.data=null,this.texture=null}}class I3DTileLayer extends Shape{get url(){return this._url}set url(e){e!==this._url&&(this.visibleNeedsUpdate=!0,this._url=e)}constructor(e){super(e),this.name=e.name||"",this.url=e.url,this._enableSlope=!1,this.token=e.token||null,this.type="i3DTileLayer",this.initialize()}initialize(){if(!this.url)return!1}slopeAnalysis(e,t={}){this._enableSlope=e&&!0,this.slopeParams={},e&&Object.assign(this.slopeParams,t)}toJSON(){return!isUpdate||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},Token:this.token,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,Url:this.url||null,EnableSlope:this._enableSlope,SlopeParams:this._enableSlope?this.slopeParams:null}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}dispose(){this.traverse(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose(),e.texture=null}),this.url=null,this.texture=null}}class AssetLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}get body(){return this._body}set body(e){this.messageNeedsUpdate=!0,this._body=e}constructor(e){super(e),this.type="AssetLayer",this.url=e.url,this.header=e.header,this.body=e.body,this.messageNeedsUpdate=!1,this.childNeedsUpdate=!1;let t=e.deviceAutoUpdate||!1,i=Math.max(1,e.deviceAutoUpdateInterval||2),s=void 0===e.renderNum?15:e.renderNum,a=void 0===e.searchMode?"coord":e.searchMode,o=void 0===e.tileLevel?16:e.tileLevel,n=void 0!==e.rtEnable&&e.rtEnable,r=e.rtUrl,l=void 0===e.rtTilelLevel?17:e.rtTilelLevel;this.maxUpdateHeight=void 0===e.maxUpdateHeight?1e3:e.maxUpdateHeight,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.offset=new Vector3,Object.defineProperties(this,{deviceAutoUpdate:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e,this.messageNeedsUpdate=!0)}},deviceAutoUpdateInterval:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=Math.max(e,2),this.messageNeedsUpdate=!0)}},renderNum:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.messageNeedsUpdate=!0)}},searchMode:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.messageNeedsUpdate=!0)}},tileLevel:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.messageNeedsUpdate=!0)}},rtEnable:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.messageNeedsUpdate=!0}},rtUrl:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e,this.messageNeedsUpdate=!0)}},rtTilelLevel:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l=e,this.messageNeedsUpdate=!0)}}})}addChildren(e){if(!e||e.length<1)return!1;this.childOperate="add",this.childrenContent=[],e.forEach((e,t)=>{this.childrenContent.push({uuid:e.uuid,point_id:e.point_id,config:{material:{},transform:null}})}),this.childNeedsUpdate=!0,this.materialNeedsUpdate=!0}removeChild(e){e&&(e instanceof Array?this.removeChildren(e):this.removeChildren([e]))}removeChildren(e){if(!e||e.length<1)return!1;this.childOperate="remove",this.childrenContent=[],e.forEach((e,t)=>{this.childrenContent.push({uuid:e.uuid,point_id:e.point_id,config:{material:{},transform:null}})}),this.childNeedsUpdate=!0,this.materialNeedsUpdate=!0}updateChild(e){if(!e)return!1;e instanceof Array?this.updateChildren(e):this.updateChildren([e])}updateChildren(e){if(!e||e.length<1)return!1;this.childrenContent=[],this.childOperate="update",this.childNeedsUpdate=!0,this.materialNeedsUpdate=!0,e.forEach((e,t)=>{this.updateChildContent(e)})}updateChildContent(e){if(!e.uuid)return!1;const t={uuid:e.uuid,point_id:e.point_id,config:{material:{},transform:null}};var i,e=e.params;void 0!==e.opacity&&(e.color.a=e.opacity),e.color&&(t.config.material.Color={r:e.color.r,g:e.color.g,b:e.color.b,a:e.color.a||1}),e.brightnessColor&&(t.config.material.BrightnessColor={r:e.brightnessColor.r,g:e.brightnessColor.g,b:e.brightnessColor.b,a:1}),e.text?(i=drawTextToImage(e.text,e.textStyle),t.config.material.Texture=convertCanvas2Base64(i)):e.map&&(isBase64(e.map)?t.config.material.Texture=e.map:loadImageAsBase64(e.map,e=>{e&&(t.config.material.Texture=e)})),void 0!==e.metallic&&(t.config.material.Metallic=e.metallic),void 0!==e.roughness&&(t.config.material.Roughness=e.roughness),void 0!==e.brightness&&(t.config.material.Brightness=e.brightness),e.position&&(t.config.transform||(t.config.transform={}),t.config.transform.Location={x:e.position.x,y:e.position.y,z:e.position.z}),e.scale&&(t.config.transform||(t.config.transform={}),t.config.transform.Scale={x:e.scale.x,y:e.scale.y,z:e.scale.z}),e.rotation&&(t.config.transform||(t.config.transform={}),t.config.transform.Rotation={x:e.rotation.x,y:e.rotation.y,z:e.rotation.z}),void 0!==e.scroll&&(t.config.scroll=MathUtils.clamp(e.scroll,-1,1)),void 0!==e.speed&&(t.config.speed=e.speed),void 0!==e.animationIndex&&(t.config.animationIndex=e.animationIndex),void 0!==e.animationLoop&&(t.config.animationLoop=e.animationLoop),void 0!==e.animationSpeed&&(t.config.animationSpeed=e.animationSpeed),this.childrenContent.push(t)}updateChildAnimation(e){if(!e)return!1;e instanceof Array?this.updateChildrenAnimation(e):this.updateChildrenAnimation([e])}updateChildrenAnimation(e){if(!e||e.length<1)return!1;this.childrenContent=[],e.forEach((e,t)=>{this.updateChildContent(e)}),this.childOperate="animation",this.childNeedsUpdate=!0,this.materialNeedsUpdate=!0}toJSON(e=0){var t={DeviceUrl:this.url,DeviceBody:this.body,DeviceHeader:this.header,SearchMode:this.searchMode,TileLevel:this.tileLevel,RenderNum:this.renderNum,RTUrl:this.rtUrl,RTEnable:this.rtEnable,RTTileLevel:this.rtTilelLevel,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,content:this.materialNeedsUpdate?this.childrenContent:null,childOperate:this.childOperate,AutoUpdate:this.deviceAutoUpdate,AutoUpdateInterval:this.deviceAutoUpdateInterval,MaxUpdateHeight:this.maxUpdateHeight};return this.childNeedsUpdate&&(this.childNeedsUpdate=!1,this.childOperate=null,this.materialNeedsUpdate=!0),t}}class Radar extends Shape{constructor(e={color:{r:0,g:1,b:0,a:1},brightness:1,speed:.2}){super(e),this.type="Radar"}}class Ripple extends Shape{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:1,speed:2}){super(e),this.type="Ripple"}}class Soil extends Shape{constructor(e){super(e),this.type="Soil"}}class Diamond extends Shape{constructor(e={gardientDirection:-1,color:{r:0,g:.48,b:.0047,a:1},color2:{r:.43,g:1,b:.42,a:1}}){super(e),this.type="Diamond"}}class TrafficShape extends Shape{constructor(e){super(e),this.type="CommonCar";let t=void 0===e.carType?3:e.carType;Object.defineProperties(this,{carType:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{void 0!==e&&(t=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}}})}toJSON(e=!0){return!this.visibleNeedsUpdate||!e||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Scroll:this.scroll,Speed:this.speed,Texture:this.texture,GardientDirection:this.gardientDirection,Color2:{r:this.color2.r,g:this.color2.g,b:this.color2.b,a:this.opacity},BrightnessColor:this.brightnessColor?{r:this.brightnessColor.r,g:this.brightnessColor.g,b:this.brightnessColor.b,a:1}:this.color,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,animateNeedsUpdate:!this.isInstance&&this.animateNeedsUpdate,visible:this.visible,type:this.type,CarType:this.carType,name:this.name,uuid:this.uuid,jsondata:!e||this.isInstance?this.data:null,animateJson:this.animateNeedsUpdate?this.animateJson:null,Size:this.size,SizeAttenuation:this.sizeAttenuation,ChildIndex:this.isInstance?-1:this.childIndex,IsInstance:this.isInstance,overtimeInstanceIndex:this.overtimeInstanceIndex}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}class TriangleWarning extends Shape{constructor(e){super(e),this.type="TriangleWarning"}}class Bucket extends Shape{constructor(e){super(e),this.type="Bucket"}}class Inundation extends Shape{constructor(e){super(e),this.type="InundationAnalysis"}}class Skyline extends Shape{constructor(e){super(e),this.type="SkylineAnalysis";let t=e.distance||120,i=e.lineWidth||1;Object.defineProperties(this,{distance:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},lineWidth:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}}})}toJSON(e=0){return{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Distance:this.distance,LineWidth:this.lineWidth}}}class VisualField extends Shape{constructor(e){super(e),this.type="VisualFieldAnalysis";let t=e.fov||60,i=e.maxDistacne||5,s=e.rexYX||.5,a=e.reslution||1024;Object.defineProperties(this,{fov:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},maxDistacne:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},rexYX:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},reslution:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}}})}toJSON(e=0){return{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,FOV:this.fov,MaxDistacne:this.maxDistacne,RexYX:this.rexYX,Reslution:this.reslution,Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z}}}}class CarPark extends Shape{constructor(e){super(e),this.type="CarPark";const t=e.position||new Vector3;let i=e.rotation||new Euler;const s=e.scale||new Vector3(1,1,1),a=e.color||{r:1,g:1,b:1,a:1};Object.defineProperties(this,{position:{enumerable:!0,get:function(){return t},set:e=>{e&&(t.x=e.x,t.y=e.y,t.z=e.z,this.matrixNeedsUpdate=!0)}},rotation:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i.x=MathUtils.clamp(e.x,-180,180),i.y=MathUtils.clamp(e.y,-180,180),i.z=MathUtils.clamp(e.z,-180,180),this.matrixNeedsUpdate=!0)}},scale:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.x=e.x,s.y=e.y,s.z=e.z,this.matrixNeedsUpdate=!0)}},modelType:{configurable:!0,enumerable:!0,get:()=>this._modelType,set:e=>{e&&(this._modelType=e)}},color:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a.r=e.r,a.g=e.g,a.b=e.b,a.a=e.a||1,this.materialNeedsUpdate=!0)}},parkType:{configurable:!0,enumerable:!0,get:()=>this._parkType,set:e=>{e&&("out"===e.toLowerCase?this._parkType="out":this._parkType="in")}}}),this.position=t,this.rotation=i,this.scale=s,this.modelType=isModelType(e.modelType),this.speed=Number(e.speed)||36,this.endState=e.endState||!1,this.color=a,this.parkType=e.parkType||"in"}toJSON(e=!0){return!this.visibleNeedsUpdate||!e||this.visible&&this.materialNeedsUpdate?{Position:{x:this.position.x,y:this.position.y,z:this.position.z},Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.color.a},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Speed:this.speed,ModelType:this.modelType,EndState:this.endState,Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,animateNeedsUpdate:this.animateNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid,jsondata:e?null:this.data,ParkType:this.parkType}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}function isModelType(e){return isNaN(e)||e<3||6<e&&e<12||16<e?3:e}class TrafficLightLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}get message(){return this._body}set message(e){this.messageNeedsUpdate=!0,this._body=e}constructor(e){super(e),this.type="TrafficLight",this.url=e.url,this.header=e.header,this.message=e.message;let t=void 0===e.brightness?1:e.brightness;this.lightAltitude=void 0===e.lightAltitude?1:e.lightAltitude,this.renderScale=void 0===e.renderScale?1:e.renderScale,this.rayDetection={enable:!1,distance:0,displacementHeight:0},e.rayDetection&&(this.rayDetection.enable=void 0!==e.rayDetection.enable&&e.rayDetection.enable,this.rayDetection.distance=void 0===e.rayDetection.distance?0:e.rayDetection.distance,this.rayDetection.displacementHeight=void 0===e.rayDetection.displacementHeight?0:e.rayDetection.displacementHeight),this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.offset=new Vector3,Object.defineProperties(this,{brightness:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}}})}dispose(){return!1}toJSON(e=0){return{Url:this.url,Message:this.message,Header:this.header,RenderScale:this.renderScale,LightAltitude:this.lightAltitude,RayDetection:this.rayDetection,Brightness:this.brightness,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid}}}class RoadName extends Shape{constructor(e){super(e),this.type="RoadName",this.fontSize=e.fontSize||14,this.rayDetectionDistance="rayDetectionDistance"in e?e.rayDetectionDistance:500,this.displacementHeight="displacementHeight"in e?e.displacementHeight:40*this.scale.z,this.data=e.data||[],this.filename=e.filename||null;let t=e.color||{r:1,g:1,b:1,a:1},i=(this.openCollision=e.openCollision||!1,this.switchScale=e.switchScale||!1,this.minScale="minScale"in e?e.minScale:1,this.maxScale="maxScale"in e?e.maxScale:2,this.minDistance=e.minDistance||0,this.maxDistance=e.maxDistance||5e3,e.switchPitchRotate||!1);this.minPitch="minPitch"in e?e.minPitch:0,this.maxPitch="maxPitch"in e?e.maxPitch:90,this.collisionScale=e.collisionScale||2,this.brightness=e.brightness||1,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return t},set:function(e){e!==t&&(t=e,this.materialNeedsUpdate=!0)}},switchPitchRotate:{enumerable:!0,get:function(){return i},set:function(e){e!==i&&(i=e,this.materialNeedsUpdate=!0)}}})}toJSON(e=!0){return!this.visibleNeedsUpdate||!e||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.z,y:this.scale.y,z:this.scale.x},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid,jsondata:this.data,rayDetectionDistance:this.rayDetectionDistance,displacementHeight:this.displacementHeight,FileName:this.filename,FontSize:this.fontSize,OpenCollision:this.openCollision,SwitchScale:this.switchScale,MinScale:this.minScale,MaxScale:this.maxScale,MinDistance:this.minDistance,MaxDistance:this.maxDistance,SwitchPitchRotate:this.switchPitchRotate,MinPitch:this.minPitch,MaxPitch:this.maxPitch,CollisionScale:this.collisionScale,ShadowColor:this.shadowColor,ShadowOffset:this.shadowOffset,Brightness:this.brightness}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.z,y:this.scale.y,z:this.scale.x},Rotation:{x:this.rotation.x,y:this.rotation.y+90,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}}class AutonomousVehicleLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}constructor(e){super(e),this.type="AutonomousVehicle";let t=e.url,i=e.header,s=void 0===e.labelRenderScale?1:e.labelRenderScale,a=void 0===e.labelRenderType?1:e.labelRenderType,o=void 0===e.labelBrightness?1:e.labelBrightness,n=void 0===e.followMode?"Third":e.followMode,r=(this.followRotation=void 0===e.followRotation?{Roll:!1,Pitch:!1,Yaw:!0}:e.follow,void 0===e.followZoom?0:e.followZoom),l=void 0!==e.switchScale&&e.switchScale,h=void 0===e.minViewPortHeight?30:e.minViewPortHeight,d=void 0===e.maxViewPortHeight?300:e.maxViewPortHeight,c=void 0===e.minScale?1:e.minScale,u=void 0===e.maxScale?2:e.maxScale,p=void 0===e.controlTypeList?[]:e.controlTypeList,m=void 0!==e.predictionEnable&&e.predictionEnable,g=void 0===e.predictionLineStyle?{}:e.predictionLineStyle;this.rayDetection={enable:!1,distance:0},e.rayDetection&&(this.rayDetection.enable=void 0!==e.rayDetection.enable&&e.rayDetection.enable,this.rayDetection.distance=void 0===e.rayDetection.distance?0:e.rayDetection.distance),this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.followNeedsUpdate=!1,this.offset=new Vector3,Object.defineProperties(this,{url:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e,this.messageNeedsUpdate=!0)}},header:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.messageNeedsUpdate=!0)}},labelRenderScale:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.materialNeedsUpdate=!0)}},labelBrightness:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.materialNeedsUpdate=!0)}},predictionLineStyle:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g=e,this.materialNeedsUpdate=!0)}},labelRenderType:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.materialNeedsUpdate=!0)}},predictionEnable:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e&&(m=e,this.materialNeedsUpdate=!0)}},followMode:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e,this.followNeedsUpdate=!0)}},followZoom:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e,this.materialNeedsUpdate=!0)}},switchScale:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l=e,this.materialNeedsUpdate=!0)}},minViewPortHeight:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e,this.materialNeedsUpdate=!0)}},maxViewPortHeight:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d=e,this.materialNeedsUpdate=!0)}},minScale:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{e&&(c=e,this.materialNeedsUpdate=!0)}},maxScale:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{e&&(u=e,this.materialNeedsUpdate=!0)}},controlTypeList:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{p=e||[]}}})}dispose(){return!1}toJSON(e=!0){return e&&this.visibleNeedsUpdate?{Url:this.url,Header:this.header,LabelRenderScale:this.labelRenderScale,LabelRenderType:this.labelRenderType,RayDetection:this.rayDetection,ControlTypeList:this.controlTypeList,FollowMode:this.followMode,SwitchScale:this.switchScale,MinViewPortHeight:this.minViewPortHeight,MaxViewPortHeight:this.maxViewPortHeight,FollowRotation:this.followRotation,LabelBrightness:this.labelBrightness,MinScale:this.minScale,MaxScale:this.maxScale,FollowZoom:this.followZoom,PredictionLineStyle:this.predictionLineStyle,PredictionEnable:this.predictionEnable,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid}:{Url:this.url,Header:this.header,LabelRenderScale:this.labelRenderScale,LabelRenderType:this.labelRenderType,RayDetection:this.rayDetection,FollowMode:this.followMode,SwitchScale:this.switchScale,MinViewPortHeight:this.minViewPortHeight,MaxViewPortHeight:this.maxViewPortHeight,FollowRotation:this.followRotation,FollowZoom:this.followZoom,LabelBrightness:this.labelBrightness,PredictionLineStyle:this.predictionLineStyle,PredictionEnable:this.predictionEnable,MinScale:this.minScale,MaxScale:this.maxScale,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid}}}class QuadPyramidTop extends Shape{constructor(e){super(e),this.type="QuadPyramidTop"}}class WebViewPoint extends Shape{constructor(e={}){super(e),this.visible=void 0===e.visible||e.visible;let t=e.url||"",i=e.size||{x:300,y:200},s=0===e.faceType?0:e.faceType||1,a=e.pivot||{x:.5,y:.5},o=void 0!==e.switchScale&&e.switchScale,n=e.minDistance||0,r=e.maxDistance||0,l=void 0===e.minScale?1:e.minScale,h=void 0===e.maxScale?1:e.maxScale;this.type="WebViewPoint",Object.defineProperties(this,{url:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},size:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},pivot:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}},faceType:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},switchScale:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},minDistance:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},maxDistance:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},minScale:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},maxScale:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return e&&this.visibleNeedsUpdate&&!this.materialNeedsUpdate?{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,FadeIn:this.fadeIn,type:this.type,name:this.name,uuid:this.uuid}:{Pivot:this.pivot,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,FaceType:getFinalFaceType(this.faceType),SwitchScale:this.switchScale,MinDistance:this.minDistance,MaxDistance:this.maxDistance,MaxScale:this.maxScale,MinScale:this.minScale,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,URL:this.url,Size:this.size,Brightness:this.brightness}}copy(e,t=!0){return this.fontWeight=e.fontWeight,this.fontSize=e.fontSize,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.shadowColor=e.shadowColor,this.shadowOffset=e.shadowOffset,super.copy(e,t),this}}class LayerBuilding extends Shape{constructor(e={}){super(e),this.type="LayerBuilding";let t=e.buildingName||"all",i=e.layeringHeight||500,s=e.layeringBaseHeight||300,a=e.floorPullDir||{x:5e3,y:0,z:0};this.hiddenDefault=void 0===e.HiddenDefault||e.HiddenDefault,this.floorNum=0,this.eventName="",this.buildingState="create",this.isLayering={},this.isLayering[t]=!1,Object.defineProperties(this,{layeringHeight:{enumerable:!0,get:function(){return i},set:function(e){e!==i&&(i=e,this.materialNeedsUpdate=!0,this.buildingState="update")}},buildingName:{enumerable:!0,get:function(){return t},set:function(e){e&&e!==t&&(t=e,this.materialNeedsUpdate=!0,this.buildingState="update")}},layeringBaseHeight:{enumerable:!0,get:function(){return s},set:function(e){e!==s&&(s=e,this.materialNeedsUpdate=!0,this.buildingState="update")}},floorPullDir:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a.x=e.x,a.y=e.y,a.z=e.z,this.materialNeedsUpdate=!0,this.buildingState="update")}}})}layeringBuilding(){if(this.eventName="Layering",this.animateNeedsUpdate=!0,this.buildingState="update","all"===this.buildingName)for(const e in this.isLayering)this.isLayering[e]=!0;else this.isLayering[this.buildingName]=!0}backBuildingToNormal(){if(this.eventName="BackToNormal",this.animateNeedsUpdate=!0,this.buildingState="update","all"===this.buildingName)for(const e in this.isLayering)this.isLayering[e]=!1;else this.isLayering[this.buildingName]=!1}pullBuilding(e){if(void 0===this.isLayering[this.buildingName]){if(!this.isLayering.all)return void console.warn("该建筑物不在分解状态")}else if(!1===this.isLayering[this.buildingName])return void console.warn("该建筑物不在分解状态");e?(this.eventName="Pull",this.floorNum=e,this.animateNeedsUpdate=!0,this.buildingState="update"):console.warn("请输入有效楼层")}pushBuilding(e){if(void 0===this.isLayering[this.buildingName]){if(!this.isLayering.all)return void console.warn("该建筑物不在分解状态")}else if(!this.isLayering[this.buildingName])return void console.warn("该建筑物不在分解状态");e?(this.eventName="Push",this.floorNum=e,this.animateNeedsUpdate=!0,this.buildingState="update"):console.warn("请输入有效楼层")}hideBuildings(e){Array.isArray(e)?(this.eventName="Hide",this.floorNum=e,this.animateNeedsUpdate=!0,this.buildingState="update"):console.error("numbers必须为数组")}showBuildings(e){Array.isArray(e)?(this.eventName="Show",this.floorNum=e,this.animateNeedsUpdate=!0,this.buildingState="update"):console.error("numbers必须为数组")}hideAboveFloor(e){0!==e&&(this.eventName="HideAboveFloor",this.floorNum=e,this.animateNeedsUpdate=!0,this.buildingState="update")}showAll(){this.eventName="ShowAll",this.animateNeedsUpdate=!0,this.buildingState="update"}hideAll(){this.eventName="HideAll",this.animateNeedsUpdate=!0,this.buildingState="update"}toJSON(){return{type:this.type,name:this.name,uuid:this.uuid,BuildingName:this.buildingName,LayeringHeight:this.layeringHeight,LayeringBaseHeight:this.layeringBaseHeight,FloorPullDir:this.floorPullDir,FloorNum:this.floorNum,EventName:this.eventName,materialNeedsUpdate:this.materialNeedsUpdate,animateNeedsUpdate:this.animateNeedsUpdate,BuildingState:this.buildingState,HiddenDefault:this.hiddenDefault}}}class MockCarStream extends Shape{constructor(e={}){super(e),this.type="MockCarStream",this.renderNum=void 0===e.renderNum?20:e.renderNum,this.enableTrigger=void 0!==e.enableTrigger&&e.enableTrigger;let t=e.runOnTheGround||!1,i=e.lanesNumber||1,s=e.forwardInterval||1e3,a=e.forwardSpeed||200,o=e.splineLoop||!1,n=e.randomBool||!1,r=e.randomForwardOffset||0,l=e.laneWidth||300,h=e.rotationOffset||0,d=e.scaleOffset||{x:1,y:1,z:1};Object.defineProperties(this,{runOnTheGround:{enumerable:!0,get:()=>t,set:e=>{t!==e&&(t=e,this.materialNeedsUpdate=!0)}},lanesNumber:{enumerable:!0,get:()=>i,set:e=>{i!==e&&(i=e,this.materialNeedsUpdate=!0)}},forwardInterval:{enumerable:!0,get:()=>s,set:e=>{s!==e&&(s=e,this.materialNeedsUpdate=!0)}},forwardSpeed:{enumerable:!0,get:()=>a,set:e=>{a!==e&&(a=e,this.materialNeedsUpdate=!0)}},splineLoop:{enumerable:!0,get:()=>o,set:e=>{o!==e&&(o=e,this.materialNeedsUpdate=!0)}},randomBool:{enumerable:!0,get:()=>n,set:e=>{n!==e&&(n=e,this.materialNeedsUpdate=!0)}},randomForwardOffset:{enumerable:!0,get:()=>r,set:e=>{r!==e&&(r=e,this.materialNeedsUpdate=!0)}},laneWidth:{enumerable:!0,get:()=>l,set:e=>{l!==e&&(l=e,this.materialNeedsUpdate=!0)}},rotationOffset:{enumerable:!0,get:()=>h,set:e=>{h!==e&&(h=e,this.materialNeedsUpdate=!0)}},scaleOffset:{enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}}})}toJSON(e=0){return{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},EnableTrigger:this.enableTrigger,type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},RunOnTheGround:this.runOnTheGround,LanesNumber:this.lanesNumber,ForwardInterval:this.forwardInterval,ForwardSpeed:this.forwardSpeed,SplineLoop:this.splineLoop,RandomBool:this.randomBool,RandomForwardOffset:this.randomForwardOffset,LaneWidth:this.laneWidth,RotationOffset:this.rotationOffset,ScaleOffset:this.scaleOffset,jsondata:this.data,RenderNum:this.renderNum}}}const cR=[{r:.685325,g:1,b:.298996},{r:.963023,g:1,b:.198688},{r:1,g:.710181,b:.235817},{r:1,g:.440705,b:.156314},{r:1,g:.310357,b:.150163},{r:1,g:.219426,b:.155697}];class SlopeAnalysis extends Shape{constructor(e={}){super(e),this.type="SlopeAnalysis";let t=e.range||null,i=testAngle(e.minAngle,!0),s=testAngle(e.maxAngle,!1),a=testColorRange(e.colorRange),o=e.useSlopeAnalysis||!1,n=e.tilePathFieldName||"";Object.defineProperties(this,{tilePathFieldName:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},range:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}},minAngle:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=testAngle(e,!0),this.materialNeedsUpdate=!0}},maxAngle:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=testAngle(e,!1),this.materialNeedsUpdate=!0}},colorRange:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=testColorRange(e),this.materialNeedsUpdate=!0}},useSlopeAnalysis:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{(o=e)&&(this.materialNeedsUpdate=!0)}}})}toJSON(e=0){return{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Opacity:this.opacity,Transparent:this.transparent,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,jsonData:this.range,MinAngle:this.minAngle,MaxAngle:this.maxAngle,ColorRange:this.colorRange,UseSlopeAnalysis:Number(this.useSlopeAnalysis),TilePathFieldName:this.tilePathFieldName}}}function testColorRange(s){if(s&&s instanceof Object){let t=0,i=0;for(const e in s)i=e,t++;if(0===i)return{25:cR[0],40:cR[1],55:cR[2],70:cR[3],80:cR[4],90:cR[5]};for(let e=t;e<6;e++)i<25?s[i=40]=cR[1]:i<40.00001?s[i=55]=cR[2]:i<55.00001?s[i=70]=cR[3]:i<70.00001?s[i=80]=cR[4]:i<80.00001?s[i=90]=cR[5]:i<90.00001?s[i=91]=cR[5]:s[i+=e]=cR[5];return s}return{25:cR[0],40:cR[1],55:cR[2],70:cR[3],80:cR[4],90:cR[5]}}function testAngle(e=0,t=!0){return t?e<=0?0:e:e<=0?90:e}class ClusterPoint extends Shape{constructor(e={}){super(e),this.pointType="pointType"in e?e.pointType.toLowerCase():"iconpoint";var t=e.pointStyle||{};t.renderType=0,t.openCollision=!1,this.pointJSON=switchPointType(this.pointType,t),this.clusterStyle=e.clusterStyle||{};for(const a in this.clusterStyle){var i=this.clusterStyle[a];this.clusterStyle[a]=switchPointType(this.pointType,i)}let s=e.minPixelDistance||100;this.type="ClusterPoint",Object.defineProperties(this,{minPixelDistance:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e=Number(e);e&&s!==e&&(s=e,this.materialNeedsUpdate=!0)}}})}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,MinPixelDistance:this.minPixelDistance,PointJSON:this.pointJSON,PointType:this.pointType,ClusterStyle:this.clusterStyle}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.size=e.size,super.copy(e,t),this}}function switchPointType(e,t){let i;switch(e){case"basiclabel":i=new BasicLabel(t).toJSON();case"iconpoint":i=new IconPoint(t).toJSON();case"textpoint":i=new TextPoint(t).toJSON();default:i=new IconPoint(t).toJSON()}return t.clusterText&&(i.ClusterText=t.clusterText),i}class InfoLightLayer extends Object3D{get visible(){return this._visible}set visible(e){void 0===this._visible&&(this._visible=!0),e!==this._visible&&(this.visibleNeedsUpdate=!0,this._visible=e&&!0)}constructor(e){super(e),this.type="UserInfoLightLayer",this.url=e.url,this.header=e.header;let t=void 0===e.brightness?1:e.brightness;this.lightAltitude=void 0===e.lightAltitude?1:e.lightAltitude,this.renderScale=void 0===e.renderScale?1:e.renderScale,this.renderTilesNum=void 0===e.renderTilesNum?3:e.renderTilesNum,this.updateCheckInterval=void 0===e.updateCheckInterval?2:e.updateCheckInterval,this.maxUpdateHeight=void 0===e.maxUpdateHeight?1e3:e.maxUpdateHeight,this.centerDetectDistance=void 0===e.centerDetectDistance?3e3:e.centerDetectDistance,this.rayDetection={enable:!1,distance:0,displacementHeight:0},e.rayDetection&&(this.rayDetection.enable=void 0!==e.rayDetection.enable&&e.rayDetection.enable,this.rayDetection.distance=void 0===e.rayDetection.distance?0:e.rayDetection.distance,this.rayDetection.displacementHeight=void 0===e.rayDetection.displacementHeight?0:e.rayDetection.displacementHeight),this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.offset=new Vector3,Object.defineProperties(this,{brightness:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{t=e,this.materialNeedsUpdate=!0}}})}dispose(){return!1}toJSON(e=0){return{Url:this.url,Header:this.header,RenderScale:this.renderScale,LightAltitude:this.lightAltitude,CenterDetectDistance:this.centerDetectDistance,RayDetection:this.rayDetection,Brightness:this.brightness,RenderTilesNum:this.renderTilesNum,UpdateCheckInterval:this.updateCheckInterval,MaxUpdateHeight:this.maxUpdateHeight,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid}}}class RoutePlan extends Line{constructor(e={}){super(e),this.name=e.name||"",this.type="RoutePlan";let t=e.url;this.messageNeedsUpdate=!1,Object.defineProperties(this,{url:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e,this.messageNeedsUpdate=!0)}}})}toJSON(e=!0){return!e||!this.visibleNeedsUpdate||this.visible&&this.materialNeedsUpdate?{Color:{r:this.color.r,g:this.color.g,b:this.color.b,a:this.opacity},URL:this.url,Brightness:this.brightness,Metallic:this.metallic,Roughness:this.roughness,Opacity:this.opacity,Transparent:this.transparent,Collision:this.collision,Texture:this.texture,BloomColor:this.bloomColor?{r:this.bloomColor.r,g:this.bloomColor.g,b:this.bloomColor.b,a:1}:null,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,visible:this.visible,type:this.type,uuid:this.uuid,jsondata:e?null:this.data,Style:this.style,Spline_Type:this.splineType,MeshDirection:this.direction,RenderType:this.renderType,Section_Length:this.section_Length,Width:this.width,Tilling:this.tilling,Speed:this.speed,Open_Stroke:this.openStroke,Stroke_Color:this.strokeColor?{r:this.strokeColor.r,g:this.strokeColor.g,b:this.strokeColor.b,a:1}:null,Stroke_Width:this.strokeWidth,animateNeedsUpdate:this.animateNeedsUpdate,animateJson:this.animateNeedsUpdate?this.animateJson:null,LineUVOption:this.lineUVOption,colordata:this.colordata}:{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,name:this.name,uuid:this.uuid}}copy(e,t=!0){return this.style=e.style,this.splineType=e.splineType,this.direction=e.direction,this.width=e.width,this.tilling=e.tilling,this.speed=e.speed,this.openStroke=e.openStroke,this.strokeColor=e.strokeColor,this.strokeWidth=e.strokeWidth,super.copy(e,t),this}}class Light extends Shape{constructor(e={}){super(e),this.visible=void 0===e.visible||e.visible,this.lightType=void 0===e.lightType?"PointLight":e.lightType,this.pointLightStyle=void 0===e.pointLightStyle?{intensity:8,color:{r:1,g:1,b:1}}:e.pointLightStyle,this.spotLightStyle=void 0===e.spotLightStyle?{intensity:8,color:{r:1,g:1,b:1},innerConeAngle:0,outerConeAngle:44}:e.spotLightStyle,this.rectLightStyle=void 0===e.rectLightStyle?{intensity:8,color:{r:1,g:1,b:1},barnDoorAngle:88,barnDoorlength:20}:e.rectLightStyle,this.type="Light"}setData(e){this.data=getUEPointData(e)}toJSON(e=!0){return e&&this.visibleNeedsUpdate&&!this.materialNeedsUpdate?{matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible,type:this.type,name:this.name,uuid:this.uuid}:{Position:{x:this.position.x,y:this.position.y,z:this.position.z},Scale:{x:this.scale.x,y:this.scale.y,z:this.scale.z},Rotation:{x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},type:this.type,uuid:this.uuid,jsondata:e?null:this.data,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,LightType:this.lightType,PointLightStyle:this.pointLightStyle,SpotLightStyle:this.spotLightStyle,RectLightStyle:this.rectLightStyle,visible:this.visible}}copy(e,t=!0){return this.fontWeight=e.fontWeight,this.fontSize=e.fontSize,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.shadowColor=e.shadowColor,this.shadowOffset=e.shadowOffset,super.copy(e,t),this}}export{AssetLayer,AutonomousVehicleLayer,BasicLabel,Bucket,CarPark,Circle,CloudRenderApp as CloudRenderEngine,ClusterPoint,CommonConstant,Cone,ConstructionLayer,Cube,Cylinder,Decal,Diamond,DiamondSign,FlashCar,FlashCarCrash,FlashPeople,Heatmap,I3DTileLayer,IconPoint,InfoLightLayer,Inundation,LayerBuilding,Light,Line,MockCarStream,ODLine,Particle,Plane,Point,Polygon,QuadPyramid,QuadPyramidTop,Radar,Ripple,RoadCondition,RoadName,RoutePlan,Shape,Skyline,SlopeAnalysis,Soil,Sphere,TextPoint,Torus,TrafficCone,TrafficLayer,TrafficLightLayer,TrafficShape,TriangleWarning,Tube,UltralDynamicSky,VisualField,WebViewPoint,convertCanvas2Base64,drawCanvas,drawTextToImage,loadImageAsBase64};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapv-cloudrenderengine",
3
- "version": "2.0.9",
3
+ "version": "2.1.0",
4
4
  "main": "/dist/cloudrenderengine.js",
5
5
  "author": "liran23,wema,wuxiaoya",
6
6
  "license": "ISC",