mapv-cloudrenderengine 2.4.3 → 2.4.5
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 +1 @@
|
|
|
1
|
-
import{Vector2 as e,Vector3 as t,Quaternion as i,Matrix4 as s,MathUtils as a,Euler as o,Matrix3 as n,Layers as r,FileLoader as l,Color as h,Group as d,MeshBasicMaterial as c,PlaneBufferGeometry as u,Mesh as p,SpriteMaterial as m,Sprite as g}from"three";import f from"earcut";import*as y from"@tweenjs/tween.js";import b from"axios";import x from"@mars3d/heatmap.js";const v={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"},S={VOLUMETRIC_CLOUDS:"Volumetric Clouds",STATIC_CLOUDS:"Static Clouds",DYNAMIC_CLOUDS:"2D Dynamic Clouds",NO_CLOUDS:"No Clouds",VOLUMETRIC_AURORA:"Volumetric Aurora"},N={SKY_ATMOSPHERE:"Sky Atmosphere",SIMPLIFIED_COLOR:"Simplified Color"},U={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"},w={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"},C={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",SET_PLANE_POI_MODE:"Scene_setPlanePoiMode"},T={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"},O={ADD:"Gis_AddCommonGISLayer",REMOVE:"Gis_RemoveCommonGISLayer",DESTORY:"Gis_DestoryCommonGISLayer",DESTORY_ALL:"Gis_DestoryAllGenerationLayer",UPDATE:"Gis_UpdateCommonGISLayer",VISIBLE:"Gis_VisibleCommonGISLayer"},z={ENABLE_DRAW:"Gis_enableDraw",CLOSE_DRAW:"Gis_closeDraw",ENABLE_MEASURE:"Gis_enableMeasure",CLOSE_MEASURE:"Gis_closeMeasure",DESTORY_DRAW:"Gis_clearDraw",DESTORY_MEASURE:"Gis_clearMeasure"},R={SOLID:"solid",DASHED:"dashed",ARROW:"arrow",GRADIENT:"gradient"},E={CENTER:"Ground_Center",STAND:"Stand",SIDE:"Ground_Side",SIDE:"Cylinder"},I={LINEAR:"Linear",CURVE:"Curve",CONSTANT:"Constant"},A={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},M={LockedMouse:0,HoveringMouse:1},D={controlScheme:M.HoveringMouse,suppressBrowserKeys:!1,fakeMouseWithTouches:!1},L={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},P={MainButton:0,AuxiliaryButton:1,SecondaryButton:2,FourthButton:3,FifthButton:4},k={PrimaryButton:1,SecondaryButton:2,AuxiliaryButton:4,FourthButton:8,FifthButton:16},B={BackSpace:8,Shift:16,Control:17,Alt:18,RightShift:253,RightControl:254,RightAlt:255},_={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 F=Object.freeze({__proto__:null,ApplicationControl:T,CameraControl:w,ControlSchemeType:M,DrawAndMeasureControl:z,GisControl:O,InteractMOD:U,LineDirectionOptions:E,LineSplineTypeOptions:I,LineTypeOptions:R,MessageType:L,MouseButton:P,MouseButtonsMask:k,ParticleKind:_,SceneControl:C,SkyColorMode:N,SkyMode:S,SpecialKeyCodes:B,ToClientMessageType:A,UDS:v,WS_OPEN_STATE:1,inputOptions:D});class W{constructor(e,t={}){this.cloudRender=e,this.weather=t.weather||v.PARTLY_CLOUDY,this.hour=t.hour||8,this.minute=t.minute||10,this.weatherType=v,this.init()}changeWeather(e){if(!e)return;Object.values(v).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);const i=(this.hour<10?"0"+this.hour:""+this.hour)+(this.minute<10?"0"+this.minute:""+this.minute);this.cloudRender.emitUIInteraction({excuteName:"Scene_changeTime",params:{Time:i}})}setVolumeFog(e,t=1e3){const i=Math.max(Math.min(1e5,t),10);this.cloudRender.emitUIInteraction({excuteName:"Scene_setVolumenFog",params:{Enable:e,Distance:100*i}})}setAtmosphericFog(e=.0075){const t=Math.max(Math.min(1,e),0);this.cloudRender.emitUIInteraction({excuteName:"Scene_setBaseFog",params:{BaseFogDensity:t}})}setSkyMode(e){if(!e)return!1;if(Object.values(S).indexOf(e)<0)return!1;this.cloudRender.emitUIInteraction({excuteName:"Scene_setSkyMode",params:{SkyMode:e}})}setSkyColorMode(e){if(!e)return!1;if(Object.values(N).indexOf(e)<0)return!1;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 H=function(e){e=void 0!==e?e:{},this.forceTURN=e.forceTURN;let t=this;const i=new URLSearchParams(window.location.search);this.cfg=void 0!==e.peerConnectionOptions?e.peerConnectionOptions:{},this.cfg.sdpSemantics="unified-plan",this.cfg.offerExtmapAllowMixed=!1,i.has("ForceTURN")&&(this.forceTURN=i.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=i.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=i.has("useMic"),this.useMic||console.log("Microphone access is not enabled. Pass ?useMic in the url to enable it.");let s="localhost"===location.hostname||"127.0.0.1"===location.hostname,a="https:"===location.protocol;!this.useMic||s||a||(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=i.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 e=document.createElement("video");if(e.id="streamingVideo",e.playsInline=!0,e.disablepictureinpicture=!0,e.muted=t.startVideoMuted,e.addEventListener("loadedmetadata",(function(e){t.onVideoInitialised&&t.onVideoInitialised()}),!0),"requestVideoFrameCallback"in HTMLVideoElement.prototype){const i=(s,a)=>{if(a.receiveTime&&a.expectedDisplayTime){let e=a.presentationTime-a.receiveTime;t.aggregatedStats||(t.aggregatedStats={}),t.aggregatedStats.receiveToCompositeMs=e}e.requestVideoFrameCallback(i)};e.requestVideoFrameCallback(i)}return e},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,"|")},r=function(e){console.info("Browser ICE gathering |",e.srcElement.iceGatheringState,"|")},l=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){e.track.kind;for(const i of e.streams)t.availableVideoStreams.has(i.id)||t.availableVideoStreams.set(i.id,i);t.video.srcObject=e.streams[0],e.track.onunmute=()=>{t.video.srcObject=e.streams[0],t.onNewVideoTrack(e.streams)}}else h(e.streams[0])},h=function(e){if(t.video.srcObject!=e&&t.video.srcObject&&t.video.srcObject!==e){let i=document.createElement("Audio");if(i.srcObject=e,t.autoPlayAudio)i.play();else{let e=function(){i.play(),t.video.removeEventListener("click",e)};t.video.addEventListener("click",e)}console.log("Created new audio element to play seperate audio stream.")}},d=function(e){console.log("Data channel created for us by browser as we are a receiving peer."),t.dcClient=e.channel,c(t.dcClient)},c=function(e){try{return e.binaryType="arraybuffer",e.onopen=function(e){console.log("Data channel connected"),t.onDataChannelConnected&&t.onDataChannelConnected()},e.onclose=function(e){console.log("Data channel connected",e)},e.onmessage=function(e){if(t.onDataChannelMessage)if("string"==typeof e.data){const i=function(e){var t,i,s=new Array;t=e.length;for(var a=0;a<t;a++)(i=e.charCodeAt(a))>=65536&&i<=1114111?(s.push(i>>18&7|240),s.push(i>>12&63|128),s.push(i>>6&63|128),s.push(63&i|128)):i>=2048&&i<=65535?(s.push(i>>12&15|224),s.push(i>>6&63|128),s.push(63&i|128)):i>=128&&i<=2047?(s.push(i>>6&31|192),s.push(63&i|128)):s.push(255&i);return new Uint8Array(s).buffer}(e.data);t.onDataChannelMessage(i)}else t.onDataChannelMessage(e.data)},e.onerror=function(e){console.error("Data channel error",e)},e}catch(e){return console.warn("No data channel",e),null}},u=function(e){let i=e.candidate;i&&i.candidate&&(console.log("%c[Browser ICE candidate]","background: violet; color: black","| Type=",i.type,"| Protocol=",i.protocol,"| Address=",i.address,"| Port=",i.port,"|"),t.onWebRtcCandidate(i))},p=function(e){e.sdp=e.sdp.replace("useinbandfec=1","useinbandfec=1;stereo=1;sprop-maxcapturerate=48000")},m=function(e){e.onsignalingstatechange=o,e.oniceconnectionstatechange=n,e.onicegatheringstatechange=r,e.ontrack=l,e.onicecandidate=u,e.ondatachannel=d},g=async function(e){let i=e.getTransceivers().length>0;if(e.addTransceiver("video",{direction:"recvonly"}),t.useMic){let s=!!t.useMic&&{autoGainControl:!1,channelCount:1,echoCancellation:!1,latency:0,noiseSuppression:!1,sampleRate:48e3,volume:1};const a=await navigator.mediaDevices.getUserMedia({video:!1,audio:s});if(a)if(i){for(let t of e.getTransceivers())if(t&&t.receiver&&t.receiver.track&&"audio"===t.receiver.track.kind)for(const e of a.getTracks())e.kind&&"audio"==e.kind&&(t.sender.replaceTrack(e),t.direction="sendrecv")}else for(const t of a.getTracks())t.kind&&"audio"==t.kind&&e.addTransceiver(t,{direction:"sendrecv"});else e.addTransceiver("audio",{direction:"recvonly"})}else e.addTransceiver("audio",{direction:"recvonly"})};this.setVideoEnabled=function(e){t.video.srcObject.getTracks().forEach((t=>t.enabled=e))},this.startLatencyTest=function(e){t.video&&(t.latencyTestTimings.Reset(),t.latencyTestTimings.TestStartTimeMs=Date.now(),e(t.latencyTestTimings.TestStartTimeMs))},this.handleCandidateFromServer=function(e){let i=new RTCIceCandidate(e);console.log("%c[Unreal ICE candidate]","background: pink; color: black","| Type=",i.type,"| Protocol=",i.protocol,"| Address=",i.address,"| Port=",i.port,"|"),t.forceTURN&&i.candidate.indexOf("relay")<0?console.warn("Dropping candidate because it was not TURN relay.","| Type=",i.type,"| Protocol=",i.protocol,"| Address=",i.address,"| Port=",i.port,"|"):t.pcClient.addIceCandidate(i).catch((function(e){console.error("Failed to add ICE candidate",e)}))},this.createOffer=function(){t.pcClient&&(console.log("Closing existing PeerConnection"),t.pcClient.close(),t.pcClient=null),t.pcClient=new RTCPeerConnection(t.cfg),m(t.pcClient),g(t.pcClient).finally((function(){var e;t.dcClient=function(e,t,i){let s=e.createDataChannel(t,i);return console.log(`Created datachannel (${t})`),c(s),s}(t.pcClient,"cirrus",t.dataChannelOptions),(e=t.pcClient).createOffer(t.sdpConstraints).then((function(i){p(i),e.setLocalDescription(i),t.onWebRtcOffer&&t.onWebRtcOffer(i)}),(function(){console.warn("Couldn't create offer")}))}))},this.receiveOffer=function(e){let i=new RTCSessionDescription(e);t.pcClient||(console.log("Creating a new PeerConnection in the browser.",t.cfg),t.pcClient=new RTCPeerConnection(t.cfg),m(t.pcClient),t.pcClient.setRemoteDescription(i).then((()=>{g(t.pcClient).finally((function(){t.pcClient.createAnswer().then((e=>t.pcClient.setLocalDescription(e))).then((()=>{t.onWebRtcAnswer&&t.onWebRtcAnswer(t.pcClient.currentLocalDescription)})).then((()=>{let e=t.pcClient.getReceivers();for(let t of e)t.playoutDelayHint=0})).catch((e=>console.error("createAnswer() failed:",e)))}))})))},this.receiveAnswer=function(e){let i=new RTCSessionDescription(e);t.pcClient.setRemoteDescription(i);let s=t.pcClient.getReceivers();for(let e of s)e.playoutDelayHint=0},this.close=function(){t.pcClient&&(console.log("Closing existing peerClient"),t.pcClient.close(),t.pcClient=null),t.aggregateStatsIntervalId&&clearInterval(t.aggregateStatsIntervalId)},this.send=function(e){if(t.dcClient&&"open"==t.dcClient.readyState)try{t.dcClient.send(e)}catch(e){console.error("dcClient.send error: ",e)}},this.getStats=function(e){t.pcClient&&e&&t.pcClient.getStats(null).then((t=>{e(t)}))},this.aggregateStats=function(e){let i=(t.aggregatedStats||(t.aggregatedStats={}),function(e){let i={};e.forEach((e=>{"inbound-rtp"!=e.type||e.isRemote||"video"!=e.mediaType&&!e.id.toLowerCase().includes("video")||(i.timestamp=e.timestamp,i.bytesReceived=e.bytesReceived,i.framesDecoded=e.framesDecoded,i.packetsLost=e.packetsLost,i.bytesReceivedStart=t.aggregatedStats&&t.aggregatedStats.bytesReceivedStart?t.aggregatedStats.bytesReceivedStart:e.bytesReceived,i.framesDecodedStart=t.aggregatedStats&&t.aggregatedStats.framesDecodedStart?t.aggregatedStats.framesDecodedStart:e.framesDecoded,i.timestampStart=t.aggregatedStats&&t.aggregatedStats.timestampStart?t.aggregatedStats.timestampStart:e.timestamp,t.aggregatedStats&&t.aggregatedStats.timestamp&&(t.aggregatedStats.bytesReceived&&(i.bitrate=8*(i.bytesReceived-t.aggregatedStats.bytesReceived)/(i.timestamp-t.aggregatedStats.timestamp),i.bitrate=Math.floor(i.bitrate),i.lowBitrate=t.aggregatedStats.lowBitrate&&t.aggregatedStats.lowBitrate<i.bitrate?t.aggregatedStats.lowBitrate:i.bitrate,i.highBitrate=t.aggregatedStats.highBitrate&&t.aggregatedStats.highBitrate>i.bitrate?t.aggregatedStats.highBitrate:i.bitrate),t.aggregatedStats.bytesReceivedStart&&(i.avgBitrate=8*(i.bytesReceived-t.aggregatedStats.bytesReceivedStart)/(i.timestamp-t.aggregatedStats.timestampStart),i.avgBitrate=Math.floor(i.avgBitrate)),t.aggregatedStats.framesDecoded&&(i.framerate=(i.framesDecoded-t.aggregatedStats.framesDecoded)/((i.timestamp-t.aggregatedStats.timestamp)/1e3),i.framerate=Math.floor(i.framerate),i.lowFramerate=t.aggregatedStats.lowFramerate&&t.aggregatedStats.lowFramerate<i.framerate?t.aggregatedStats.lowFramerate:i.framerate,i.highFramerate=t.aggregatedStats.highFramerate&&t.aggregatedStats.highFramerate>i.framerate?t.aggregatedStats.highFramerate:i.framerate),t.aggregatedStats.framesDecodedStart&&(i.avgframerate=(i.framesDecoded-t.aggregatedStats.framesDecodedStart)/((i.timestamp-t.aggregatedStats.timestampStart)/1e3),i.avgframerate=Math.floor(i.avgframerate)))),"track"!=e.type||"video_label"!=e.trackIdentifier&&"video"!=e.kind||(i.framesDropped=e.framesDropped,i.framesReceived=e.framesReceived,i.framesDroppedPercentage=e.framesDropped/e.framesReceived*100,i.frameHeight=e.frameHeight,i.frameWidth=e.frameWidth,i.frameHeightStart=t.aggregatedStats&&t.aggregatedStats.frameHeightStart?t.aggregatedStats.frameHeightStart:e.frameHeight,i.frameWidthStart=t.aggregatedStats&&t.aggregatedStats.frameWidthStart?t.aggregatedStats.frameWidthStart:e.frameWidth),"candidate-pair"==e.type&&e.hasOwnProperty("currentRoundTripTime")&&0!=e.currentRoundTripTime&&(i.currentRoundTripTime=e.currentRoundTripTime)})),t.aggregatedStats.receiveToCompositeMs&&(i.receiveToCompositeMs=t.aggregatedStats.receiveToCompositeMs,t.latencyTestTimings.SetFrameDisplayDeltaTime(t.aggregatedStats.receiveToCompositeMs)),t.aggregatedStats=i,t.onAggregatedStats&&t.onAggregatedStats(i)});t.aggregateStatsIntervalId=setInterval((()=>{t.getStats(i)}),e)}};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if("undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===i&&s.firstChild?s.insertBefore(a,s.firstChild):s.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}("/* 视频流送的视频组件样式 */\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}");class G{addEventListener(e,t){void 0===this._listeners&&(this._listeners={}),this._needsDispatchedToUE=!1;const 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){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;this._needsDispatchedToUE=!1;const i=this._listeners[e];if(void 0!==i){const s=i.indexOf(t);-1!==s&&(i.splice(s,1),this._needsDispatchedToUE=!0,this._dispatchRemoveListenerTypes||(this._dispatchRemoveListenerTypes=[]),this._dispatchRemoveListenerTypes.push(e))}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const i=t.slice(0);for(let t=0,s=i.length;t<s;t++)e.index=t,i[t].call(this,e);e.target=null}}}class V extends G{constructor(t){super(),this.haveEvents="GamepadEvent"in window,this.haveWebkitEvents="WebKitGamepadEvent"in window,this.cloudRenderEngine=t,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 e(0,0),this.selection=[],this.logMessages=!1,this.inputOptions=t.inputOptions,this.playerElement&&(this.playerElement.tabIndex<10&&(this.playerElement.tabIndex=1e3),this.playerElement.addEventListener("contextmenu",(e=>{e.preventDefault()}),!1))}updateObjectsWithEvent(){const e=new Map;this.scene&&this.scene.children.length&&this.scene.children.forEach(((t,i)=>{t._listeners&&e.set(t.uuid,t)})),this.interactiveObjects.clear(),this.interactiveObjects=e}isKeyCodeBrowserKey(e){return e>=112&&e<=123||9===e}getKeyCode(e){return e.keyCode===B.Shift&&"ShiftRight"===e.code?B.RightShift:e.keyCode===B.Control&&"ControlRight"===e.code?B.RightControl:e.keyCode===B.Alt&&"AltRight"===e.code?B.RightAlt:e.keyCode}registerKeyboardEvents(){const e=this;document.onkeydown=function(t){e.print_inputs&&console.log(`key down ${t.keyCode}, repeat = ${t.repeat}`),e.cloudRenderEngine.sendInputData(new Uint8Array([L.KeyDown,e.getKeyCode(t),t.repeat]).buffer),t.keyCode===B.BackSpace&&document.onkeypress({charCode:B.BackSpace}),e.inputOptions.suppressBrowserKeys&&e.isKeyCodeBrowserKey(t.keyCode)&&t.preventDefault()},document.onkeyup=function(t){e.print_inputs&&console.log(`key up ${t.keyCode}`),e.cloudRenderEngine.sendInputData(new Uint8Array([L.KeyUp,e.getKeyCode(t)]).buffer),e.inputOptions.suppressBrowserKeys&&e.isKeyCodeBrowserKey(t.keyCode)&&t.preventDefault()},document.onkeypress=function(t){e.print_inputs&&console.log(`key press ${t.charCode}`);let i=new DataView(new ArrayBuffer(3));i.setUint8(0,L.KeyPress),i.setUint16(1,t.charCode,!0),e.cloudRenderEngine.sendInputData(i.buffer)}}resizePlayerStyleToFillWindow(e){let t=e.getElementsByTagName("VIDEO"),i=window.innerHeight/window.innerWidth,s=e.clientHeight/e.clientWidth,a=t.videoHeight/t.videoWidth;isNaN(a)?(this.styleWidth=window.innerWidth,this.styleHeight=window.innerHeight,this.styleTop=0,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):i<s?(this.styleWidth=Math.floor(window.innerHeight/a),this.styleHeight=window.innerHeight,this.styleTop=0,this.styleLeft=Math.floor(.5*(window.innerWidth-this.styleWidth)),e.style="top: "+this.styleTop+"px; left: "+this.styleLeft+"px; width: "+this.styleWidth+"px; height: "+this.styleHeight+"px; cursor: "+this.styleCursor+"; "+this.styleAdditional):(this.styleWidth=window.innerWidth,this.styleHeight=Math.floor(window.innerWidth*a),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){let t=e.getElementsByTagName("VIDEO");if(t.length>0){this.styleWidth=t[0].videoWidth,this.styleHeight=t[0].videoHeight;let i=Math.floor(.5*(window.innerHeight-this.styleHeight)),s=Math.floor(.5*(window.innerWidth-this.styleWidth));this.styleTop=i>0?i:0,this.styleLeft=s>0?s: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";let 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,a=document.getElementById("enlarge-display-to-fill-window-tgl"),o=document.getElementById("player");if(null!==a&&a.checked){let a=window.innerWidth/window.innerHeight;let o=this.cloudRenderEngine.freezeFrame.width/this.cloudRenderEngine.freezeFrame.height;a<o?(e=window.innerWidth,t=Math.floor(window.innerWidth/o),i=Math.floor(.5*(window.innerHeight-t)),s=0):(e=Math.floor(window.innerHeight*o),t=window.innerHeight,i=0,s=Math.floor(.5*(window.innerWidth-e)))}else{let a=o.offsetWidth/o.offsetHeight;let n=this.cloudRenderEngine.freezeFrame.width/this.cloudRenderEngine.freezeFrame.height;a<n?(e=o.offsetWidth,t=Math.floor(o.offsetWidth/n),i=Math.floor(.5*(o.offsetHeight-t)),s=0):(e=Math.floor(o.offsetHeight*n),t=o.offsetHeight,i=0,s=Math.floor(.5*(o.offsetWidth-e)))}let n=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",n.style.width=e+"px",n.style.height=t+"px",n.style.left=s+"px",n.style.top=i+"px"}}resizePlayerStyle(e){let t=document.getElementById("player");if(!t)return;if(this.cloudRenderEngine.updateVideoStreamSize(),t.classList.contains("fixed-size"))return void this.setupMouseAndFreezeFrame(t);let i=document.getElementById("enlarge-display-to-fill-window-tgl"),s=window.innerWidth<t.videoWidth||window.innerHeight<t.videoHeight;null!==i?i.checked||s?this.resizePlayerStyleToFillWindow(t):this.resizePlayerStyleToActualSize(t):this.resizePlayerStyleToArbitrarySize(t),this.setupMouseAndFreezeFrame(t)}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 e=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)}));let t=document.getElementById("enlarge-display-to-fill-window-tgl");null!==t&&(t.onchange=function(t){e.resizePlayerStyle()}),this.cloudRenderEngine.qualityControlOwnershipCheckBox=document.getElementById("quality-control-ownership-tgl"),null!==this.cloudRenderEngine.qualityControlOwnershipCheckBox&&(this.cloudRenderEngine.qualityControlOwnershipCheckBox.onchange=function(t){e.cloudRenderEngine.requestQualityControl()});let i=document.getElementById("encoder-params-submit");null!==i&&(i.onclick=function(t){let i=document.getElementById("encoder-min-qp-text").value,s=document.getElementById("encoder-max-qp-text").value;e.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.Encoder.MinQP "+i}),e.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.Encoder.MaxQP "+s})});let s=document.getElementById("webrtc-params-submit");null!==s&&(s.onclick=function(t){let i=document.getElementById("webrtc-fps-text").value,s=1e3*document.getElementById("webrtc-min-bitrate-text").value,a=1e3*document.getElementById("webrtc-max-bitrate-text").value;e.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.Fps "+i}),e.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.MinBitrate "+s}),e.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.MaxBitrate "+a})});let a=document.getElementById("show-fps-button");null!==a&&(a.onclick=function(t){e.cloudRenderEngine.emitCommand({ConsoleCommand:"Stat FPS"})});let o=document.getElementById("match-viewport-res-tgl");null!==o&&(o.onchange=function(t){e.cloudRenderEngine.matchViewportResolution=o.checked});let n=document.getElementById("show-stats-tgl");null!==n&&(n.onchange=function(e){document.getElementById("statsContainer").style.display=e.target.checked?"block":"none"});let r=document.getElementById("test-latency-button");r&&(r.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 l=document.getElementById("stream-select"),h=document.getElementById("track-select");l&&(l.onchange=function(t){const i=e.cloudRenderEngine.webRtcPlayerObj.availableVideoStreams.get(l.value);e.cloudRenderEngine.webRtcPlayerObj.video.srcObject=i,e.cloudRenderEngine.streamTrackSource=i,e.cloudRenderEngine.webRtcPlayerObj.video.play(),e.cloudRenderEngine.updateTrackList()},h&&(h.onchange=function(t){if(e.cloudRenderEngine.streamTrackSource||(e.cloudRenderEngine.streamTrackSource=e.cloudRenderEngine.webRtcPlayerObj.availableVideoStreams.get(l.value)),e.cloudRenderEngine.streamTrackSource)for(const t of e.cloudRenderEngine.streamTrackSource.getVideoTracks())if(t.id===h.value){e.cloudRenderEngine.webRtcPlayerObj.video.srcObject=new MediaStream([t]),e.cloudRenderEngine.webRtcPlayerObj.video.play(),l.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}`);let a=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(e,t),o=this.cloudRenderEngine.normalizeAndQuantizeSigned(i,s),n=new DataView(new ArrayBuffer(9));n.setUint8(0,L.MouseMove),n.setUint16(1,a.x,!0),n.setUint16(3,a.y,!0),n.setInt16(5,o.x,!0),n.setInt16(7,o.y,!0),this.cloudRenderEngine.sendInputData(n.buffer)}emitMouseDown(e,t,i){this.print_inputs&&console.log(`mouse button ${e} down at (${t}, ${i})`);let s=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),a=new DataView(new ArrayBuffer(6));a.setUint8(0,L.MouseDown),a.setUint8(1,e),a.setUint16(2,s.x,!0),a.setUint16(4,s.y,!0),this.cloudRenderEngine.sendInputData(a.buffer)}emitMouseUp(e,t,i){this.print_inputs&&console.log(`mouse button ${e} up at (${t}, ${i})`);let s=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),a=new DataView(new ArrayBuffer(6));a.setUint8(0,L.MouseUp),a.setUint8(1,e),a.setUint16(2,s.x,!0),a.setUint16(4,s.y,!0),this.cloudRenderEngine.sendInputData(a.buffer)}emitMouseWheel(e,t,i){this.print_inputs&&console.log(`mouse wheel with delta ${e} at (${t}, ${i})`);let s=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),a=new DataView(new ArrayBuffer(7));a.setUint8(0,L.MouseWheel),a.setInt16(1,e,!0),a.setUint16(3,s.x,!0),a.setUint16(5,s.y,!0),this.cloudRenderEngine.sendInputData(a.buffer)}releaseMouseButtons(e,t,i){e&k.PrimaryButton&&this.emitMouseUp(P.MainButton,t,i),e&k.SecondaryButton&&this.emitMouseUp(P.SecondaryButton,t,i),e&k.AuxiliaryButton&&this.emitMouseUp(P.AuxiliaryButton,t,i),e&k.FourthButton&&this.emitMouseUp(P.FourthButton,t,i),e&k.FifthButton&&this.emitMouseUp(P.FifthButton,t,i)}pressMouseButtons(e,t,i){e&k.PrimaryButton&&this.emitMouseDown(P.MainButton,t,i),e&k.SecondaryButton&&this.emitMouseDown(P.SecondaryButton,t,i),e&k.AuxiliaryButton&&this.emitMouseDown(P.AuxiliaryButton,t,i),e&k.FourthButton&&this.emitMouseDown(P.FourthButton,t,i),e&k.FifthButton&&this.emitMouseDown(P.FifthButton,t,i)}registerInputs(e){e&&(this.registerMouseEnterAndLeaveEvents(e),this.registerTouchEvents(e))}registerMouseEnterAndLeaveEvents(e){const t=this;e.onmouseenter=function(i){t.print_inputs&&console.log("mouse enter");let s=new DataView(new ArrayBuffer(1));s.setUint8(0,L.MouseEnter),t.cloudRenderEngine.sendInputData(s.buffer),e.pressMouseButtons(i)},e.onmouseleave=function(i){t.print_inputs&&console.log("mouse leave");let s=new DataView(new ArrayBuffer(1));s.setUint8(0,L.MouseLeave),t.cloudRenderEngine.sendInputData(s.buffer),e.releaseMouseButtons(i)}}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(e){const t=this;let i=[9,8,7,6,5,4,3,2,1,0],s={};function a(e){let t=i.pop();void 0===t&&console.log("exhausted touch indentifiers"),s[e.identifier]=t}function o(i,a){let o=new DataView(new ArrayBuffer(2+7*a.length));o.setUint8(0,i),o.setUint8(1,a.length);let n=2;for(let i=0;i<a.length;i++){let r=a[i],l=r.clientX-e.offsetLeft,h=r.clientY-e.offsetTop;t.print_inputs&&console.log(`F${s[r.identifier]}=(${l}, ${h})`);let d=t.cloudRenderEngine.normalizeAndQuantizeUnsigned(l,h);o.setUint16(n,d.x,!0),n+=2,o.setUint16(n,d.y,!0),n+=2,o.setUint8(n,s[r.identifier],!0),n+=1,o.setUint8(n,255*r.force,!0),n+=1,o.setUint8(n,d.inRange?1:0,!0),n+=1}t.cloudRenderEngine.sendInputData(o.buffer)}if(this.inputOptions.fakeMouseWithTouches){let i;e.ontouchstart=function(s){if(void 0===i){let a=s.changedTouches[0];i={id:a.identifier,x:a.clientX-t.playerElementClientRect.left,y:a.clientY-t.playerElementClientRect.top},e.onmouseenter(s),t.emitMouseDown(P.MainButton,i.x,i.y)}s.preventDefault()},e.ontouchend=function(s){for(let a=0;a<s.changedTouches.length;a++){let o=s.changedTouches[a];if(o.identifier===i.id){let a=o.clientX-t.playerElementClientRect.left,n=o.clientY-t.playerElementClientRect.top;t.emitMouseUp(P.MainButton,a,n),e.onmouseleave(s),i=void 0;break}}s.preventDefault()},e.ontouchmove=function(e){for(let s=0;s<e.touches.length;s++){let a=e.touches[s];if(a.identifier===i.id){let e=a.clientX-t.playerElementClientRect.left,s=a.clientY-t.playerElementClientRect.top;t.emitMouseMove(e,s,e-i.x,s-i.y),i.x=e,i.y=s;break}}e.preventDefault()}}else e.ontouchstart=function(e){for(let t=0;t<e.changedTouches.length;t++)a(e.changedTouches[t]);t.print_inputs&&console.log("touch start"),o(L.TouchStart,e.changedTouches),e.preventDefault()},e.ontouchend=function(e){t.print_inputs&&console.log("touch end"),o(L.TouchEnd,e.changedTouches);for(let t=0;t<e.changedTouches.length;t++)a=e.changedTouches[t],i.push(s[a.identifier]),delete s[a.identifier];var a;e.preventDefault()},e.ontouchmove=function(e){t.print_inputs&&console.log("touch move"),o(L.TouchMove,e.touches),e.preventDefault()}}callRespone(e){const{uuid:t,classType:i}=e;if(this.interactiveObjects.has(t)){this.interactiveObjects.get(t).dispatchEvent(e)}else"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 J=0;const Y=new t,q=new i,X=new s,K=new t,Q=new t,Z=new t,ee=new i,te=new t(1,0,0),ie=new t(0,1,0),se=new t(0,0,1),ae={type:"added"},oe={type:"removed"};class ne extends G{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:J++}),this.uuid=a.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ne.DEFAULT_UP.clone();const e=new t,l=new o,h=new i,d=new t(1,1,1);l._onChange((function(){h.setFromEuler(l,!1)})),h._onChange((function(){l.setFromQuaternion(h,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:l},quaternion:{configurable:!0,enumerable:!0,value:h},scale:{configurable:!0,enumerable:!0,value:d},modelViewMatrix:{value:new s},normalMatrix:{value:new n}}),this.matrix=new s,this.matrixWorld=new s,this.matrixAutoUpdate=ne.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=ne.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new r,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 q.setFromAxisAngle(e,t),this.quaternion.multiply(q),this}rotateOnWorldAxis(e,t){return q.setFromAxisAngle(e,t),this.quaternion.premultiply(q),this}rotateX(e){return this.rotateOnAxis(te,e)}rotateY(e){return this.rotateOnAxis(ie,e)}rotateZ(e){return this.rotateOnAxis(se,e)}translateOnAxis(e,t){return Y.copy(e).applyQuaternion(this.quaternion),this.position.add(Y.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(te,e)}translateY(e){return this.translateOnAxis(ie,e)}translateZ(e){return this.translateOnAxis(se,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(X.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?K.copy(e):K.set(e,t,i);const s=this.parent;this.updateWorldMatrix(!0,!1),Q.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?X.lookAt(Q,K,this.up):X.lookAt(K,Q,this.up),this.quaternion.setFromRotationMatrix(X),s&&(X.extractRotation(s.matrixWorld),q.setFromRotationMatrix(X),this.quaternion.premultiply(q.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(ae)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(oe)),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(oe)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),X.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),X.multiply(e.parent.matrixWorld)),e.applyMatrix4(X),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,s=this.children.length;i<s;i++){const s=this.children[i].getObjectByProperty(e,t);if(void 0!==s)return s}}getObjectsByProperty(e,t){let i=[];this[e]===t&&i.push(this);for(let s=0,a=this.children.length;s<a;s++){const a=this.children[s].getObjectsByProperty(e,t);a.length>0&&(i=i.concat(a))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Q,e,Z),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Q,ee,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,s=t.length;i<s;i++){const s=t[i];!0!==s.matrixWorldAutoUpdate&&!0!==e||s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const 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){const e=this.children;for(let t=0,i=e.length;t<i;t++){const i=e[t];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const s={};function a(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),!0===this.castShadow&&(s.castShadow=!0),!0===this.receiveShadow&&(s.receiveShadow=!0),!1===this.visible&&(s.visible=!1),!1===this.frustumCulled&&(s.frustumCulled=!1),0!==this.renderOrder&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=a(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const i=t.shapes;if(Array.isArray(i))for(let t=0,s=i.length;t<s;t++){const s=i[t];a(e.shapes,s)}else a(e.shapes,i)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(a(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let i=0,s=this.material.length;i<s;i++)t.push(a(e.materials,this.material[i]));s.material=t}else s.material=a(e.materials,this.material);if(this.children.length>0){s.children=[];for(let t=0;t<this.children.length;t++)s.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let t=0;t<this.animations.length;t++){const i=this.animations[t];s.animations.push(a(e.animations,i))}}if(t){const t=o(e.geometries),s=o(e.materials),a=o(e.textures),n=o(e.images),r=o(e.shapes),l=o(e.skeletons),h=o(e.animations),d=o(e.nodes);t.length>0&&(i.geometries=t),s.length>0&&(i.materials=s),a.length>0&&(i.textures=a),n.length>0&&(i.images=n),r.length>0&&(i.shapes=r),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),d.length>0&&(i.nodes=d)}return i.object=s,i;function o(e){const t=[];for(const i in e){const s=e[i];delete s.metadata,t.push(s)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const i=e.children[t];this.add(i.clone())}return this}}ne.DEFAULT_UP=new t(0,1,0),ne.DEFAULT_MATRIX_AUTO_UPDATE=!0,ne.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class re extends ne{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){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.backgroundIntensity=this.backgroundIntensity),t}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 le extends ne{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new s,this._level=0,this._levelChange=0,this.projectionMatrix=new s,this.projectionMatrixInverse=new s;let e=new t,i=-9999,a=-9999,o=-9999,n=-180,r=180,l=-89,h=0,d=-9999,c=-9999;this.needsUpdate=!1,this.worldLocation=new t,this.sphereLocation=new t,this.constrainPolygon=[],Object.defineProperties(this,{minLocation:{configurable:!0,enumerable:!0,get:()=>e,set:t=>{t&&(e.x=t.x,e.y=t.y,e.z=t.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:()=>a,set:e=>{e&&(a=e,this.needsUpdate=!0)}},maxLocationZ:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.needsUpdate=!0)}},minYaw:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{void 0!==e&&(n=e,this.needsUpdate=!0)}},maxYaw:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{void 0!==e&&(r=e,this.needsUpdate=!0)}},minPitch:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{void 0!==e&&(l=e,this.needsUpdate=!0)}},maxPitch:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{void 0!==e&&(h=e,this.needsUpdate=!0)}},minSpringArm:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{void 0!==e&&(d=e,this.needsUpdate=!0)}},maxSpringArm:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{void 0!==e&&(c=e,this.needsUpdate=!0)}},name:{configurable:!1,enumerable:!0,value:name}})}get level(){return this._level}set level(e){const t=Math.floor(e);this._levelChange=this._level-t,this._level=t}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);const 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&&e.length>2&&(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&&t.length>2&&(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 he=function(e){return e.flat(1/0)},de=function(e){if(!Array.isArray(e))throw new Error("Input must be an array");return e.map((e=>parseInt(e,10)))};function ce(e){if(!e)return[];let t=null;return t=e.features?e.features:Array.isArray(e)?e:[e],JSON.parse(JSON.stringify(t))}function pe(e){const t=[];let i=null,s=null;return ce(e).forEach((e=>{var a,o;fe(null==e||null===(a=e.geometry)||void 0===a?void 0:a.coordinates,2),i=f.flatten(null==e||null===(o=e.geometry)||void 0===o?void 0:o.coordinates),s=f(i.vertices,i.holes,i.dimensions);const n=function(e){let t=1/0,i=1/0,s=-1/0,a=-1/0;const o=[];for(let o=0;o<e.length/3;o++){let n=e[3*o],r=e[3*o+1];t>n&&(t=n),i>r&&(i=r),s<n&&(s=n),a<r&&(a=r)}const n=1/(s-t),r=1/(a-i);for(let s=0;s<e.length/3;s++){const a=n*(e[3*s]-t),l=r*(e[3*s+1]-i);o.push({x:a,y:l})}return o}(i.vertices);t.push({vertices:i.vertices,triangles:s,uvs:n})})),t}function me(e,t){const i=ce(e);return i.forEach((e=>{var i;let s=null==e||null===(i=e.geometry)||void 0===i?void 0:i.coordinates;fe(s,1),e.geometry.coordinates=he(s),t&&(e.geometry.coordinates.push(e.geometry.coordinates[0]),e.geometry.coordinates.push(e.geometry.coordinates[1]),e.geometry.coordinates.push(e.geometry.coordinates[2]))})),i}function ge(e){const t=ce(e);return t.forEach((e=>{var t;let i=null==e||null===(t=e.geometry)||void 0===t?void 0:t.coordinates;!function(e){e.type||(e.type="Feature");const t=e.geometry.type,i={Point:0,MultiPoint:1,LineString:1,MultiLineString:2,Polygon:2,MultiPolygon:3};Object.keys(i).includes(t)&&fe(e.geometry.coordinates,i[t])}(e),e.geometry.coordinates=he(i)})),t}const fe=(e,t)=>{if(e)if(0===t)e[2]||(e[2]=0);else for(const i of e)fe(i,t-1)};const ye=new l;function be(e,t){ye.load(e,(e=>{const i=new FileReader;i.readAsDataURL(e),i.onloadend=e=>{t(e.target.result)}}),null,(e=>{t(!1)}))}function xe(e,t="image/png"){return e.toDataURL(t)}function ve(e){return-1!==e.indexOf("data:")&&-1!==e.indexOf("base64")}function Se(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 Ne(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 Ue(e,t,i,s){const{xScale:a}=i,[o,n]=s,{text:r,fontSize:l,fontFamily:h,color:d,textAlign:c,icon:u}=t;let p;if(r||"number"==typeof r||u)if(r&&u)console.warn("BasicLabel Warning:text和icon不要同时设置");else{if(p=r,e.font=`${l*a}px ${h}`,e.fillStyle=d,e.textAlign=c||"left",e.textBaseline="top",u){let e=u;-1!==u.indexOf("&")&&(e=u.replace("&","&")),-1!==u.indexOf("&")&&(e=u.replace("&","&")),p=new Function('return ("'+`${e}`.replace("&#x","\\u").replace(";","")+'")')()}e.measureText(p).width,e.fillText(p,o,n)}}async function we(e,t){const{height:i,width:s,backgroundImage:o,borderRadius:n,borderColor:r,borderWidth:l,backgroundColor:h}=e,d=s,c=i,u=document.createElement("canvas"),p=u.getContext("2d"),m=a.ceilPowerOfTwo(d),g={width:m,height:m*(c/d),factor:{xScale:m/d,yScale:m/d}};u.width=g.width,u.height=g.height;const{xScale:f,yScale:y}=g.factor;if(o){const e=await Se(o,"");p.drawImage(e,0,0,d*f,c*y)}else(r||h)&&(p.strokeStyle=r,p.fillStyle=h,p.lineWidth=l?l*f:1*f,Ne(p,p.lineWidth*f,p.lineWidth*y,(d-2*p.lineWidth)*f,(c-2*p.lineWidth)*y,n?n*f:0),h&&p.fill(),r&&p.stroke());return t&&async function(e,t,i){const{paddingTop:s,paddingLeft:a,width:o,height:n}=t;let r=0,l=0,h=0,d=0;const{xScale:c,yScale:u}=t.factor,p=a?a*c:0,m=s?s*u:0,g=[p,m],f=Object.keys(i);for(let s=0;s<f.length;s++){const n=i[f[s]],{width:y,height:b,text:x,marginRight:v,marginBottom:S,backgroundImage:N,borderRadius:U,borderColor:w,borderWidth:C,backgroundColor:T,position:O,id:z}=n;if(O){const[e,t]=O;g[0]=p+e*c,g[1]=m+t*u,r=0,l=0,h=0,d=0}if(y&&b){if(g[0]+y*c>o&&(h+=r,h+b*u<=l?(g[0]=d,g[1]+=r):(g[0]=a?a*c:0,g[1]+=r,l=0,d=0)),N)try{const t=await Se(N,"");e.drawImage(t,g[0],g[1],y*c,b*u)}catch(e){console.log(e)}else T&&(e.strokeStyle=w,e.fillStyle=T,e.lineWidth=C?C*c:1*c,Ne(n,g[0]+n.lineWidth*c,g[1]+n.lineWidth*c,(y-2*n.lineWidth)*c,(b-2*n.lineWidth)*u,U?U*c:0),T&&e.fill(),w&&e.stroke());if(x){const[i,s]=O,a=[g[0]+i*c,g[1]+s*u];Ue(e,n,t.factor,a)}g[0]+=(y+(v||0))*c,r=(b+(S||0))*u,r>l&&(l=r,d=g[0])}else if(x){const[i,s]=O,a=[g[0]+i*c,g[1]+s*u];Ue(e,n,t.factor,a)}}}(p,g,t),u}function Ce(e,t={}){if(!e)return!1;const i=document.createElement("canvas"),s=i.getContext("2d"),a=t.scale||1,o=t.fontSize||18,n=t.fontface||"Arial",r=t.borderThickness||0,l=t.backgroundColor||{r:0,g:0,b:0,a:1},h=t.borderColor||{r:0,g:0,b:0,a:1},d=t.strokeStyle||{r:255,g:0,b:0,a:1},c=t.textColor||{r:255,g:0,b:0,a:1};s.font="Bold "+o*a+"px "+n;const u=s.measureText(e).width*a,p=u+2*r*a,m=o*a*1.4+2*r*a;i.width=t.width||p,i.height=t.height||m,s.font="Bold "+o*a+"px "+n;const{r:g,g:f,b:y,a:b}=l;if(s.fillStyle="rgba("+g+","+f+","+y+","+b+")",s.fillRect(0,0,i.width,i.height),t.drawRoundRect){const{r:e,g:t,b:i,a:n}=h;s.strokeStyle="rgba("+e+","+t+","+i+","+n+")",s.lineWidth=r*a,Ne(s,r/2,r/2,u+r+10*a,o*a*1.4+r,6)}if(s.fill(),s.stroke(),t.drawStrokeStyle){const{r:t,g:n,b:l,a:h}=d;s.strokeStyle="rgba("+t+","+n+","+l+","+h+")",s.strokeText(e,(r+5)*a+.5*(i.width-p),.5*(i.height-m)+(o+r)*a)}const{r:x,g:v,b:S,a:N}=c;return s.fillStyle="rgba("+x+","+v+","+S+","+N+")",s.fillText(e,(r+5)*a+.5*(i.width-p),.5*(i.height-m)+(o+r)*a),i}ye.setResponseType("blob");class Te extends ne{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&&(this._map=e,ve(e)?(this.texture=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0):be(e,(e=>{e&&(this.texture=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)})))}constructor(e={}){super(e);let s=e.name;const n=new h(1,1,1);e.color&&(n.r=a.clamp(e.color.r,0,1),n.g=a.clamp(e.color.g,0,1),n.b=a.clamp(e.color.b,0,1));const r=new h(1,1,1);e.color2?(r.r=a.clamp(e.color2.r,0,1),r.g=a.clamp(e.color2.g,0,1),r.b=a.clamp(e.color2.b,0,1)):(r.r=n.r,r.g=n.g,r.b=n.b);let l=void 0===e.size?10:e.size,d=void 0===e.sizeAttenuation||e.sizeAttenuation,c=void 0===e.gardientDirection?1:e.gardientDirection,u=void 0===e.brightness?0:e.brightness,p=void 0===e.scroll?0:e.scroll,m=this.childIndex=-1,g=void 0===e.speed?.2:e.speed,f=void 0===e.roughness?1:e.roughness,y=void 0===e.metallic?0:e.metallic;this.map=e.map||null;let b=void 0===e.opacity?1:e.opacity,x=void 0===e.uvRotateSpeed?0:e.uvRotateSpeed,v=void 0===e.WPOScaleAnimateSpeed?0:e.WPOScaleAnimateSpeed,S=void 0===e.WPOMinAnimateScale?1:e.WPOMinAnimateScale,N=void 0===e.WPOMaxAnimateScale?2:e.WPOMaxAnimateScale;const U=new h(1,1,1);e.brightnessColor&&(U.r=a.clamp(e.brightnessColor.r,0,1),U.g=a.clamp(e.brightnessColor.g,0,1),U.b=a.clamp(e.brightnessColor.b,0,1));const w=e.position||new t,C=new o;e.rotation&&(C.x=a.clamp(e.rotation.x,-180,180),C.y=a.clamp(e.rotation.y,-180,180),C.z=a.clamp(e.rotation.z,-180,180));const T=new i,O=new t(1,1,1);e.scale&&(O.x=e.scale.x,O.y=e.scale.y,O.z=e.scale.z);const z=new t(0,0,0);e.offset&&(z.x=e.offset.x,z.y=e.offset.y,z.z=e.offset.z),this.isInstance=e.isInstance||!1,this.transparent=e.transparent||b<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,C._onChange((function(){T.setFromEuler(C,!1),this.matrixNeedsUpdate=!0})),T._onChange((function(){C.setFromQuaternion(T,void 0,!1),this.matrixNeedsUpdate=!0})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,get:()=>w,set:e=>{e&&(w.x=e.x,w.y=e.y,w.z=e.z,this.matrixNeedsUpdate=!0)}},childIndex:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e!==m&&(m=e)}},rotation:{configurable:!0,enumerable:!0,get:()=>C,set:e=>{e&&(C.x=a.clamp(e.x,-180,180),C.y=a.clamp(e.y,-180,180),C.z=a.clamp(e.z,-180,180),this.matrixNeedsUpdate=!0)}},quaternion:{writable:!0,configurable:!0,value:T,enumerable:!0},scale:{configurable:!0,enumerable:!0,get:()=>O,set:e=>{e&&(O.x=e.x,O.y=e.y,O.z=e.z,this.matrixNeedsUpdate=!0)}},offset:{configurable:!0,enumerable:!0,get:()=>z,set:e=>{e&&(z.x=e.x,z.y=e.y,z.z=e.z,this.matrixNeedsUpdate=!0)}},color:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n.r=e.r,n.g=e.g,n.b=e.b,e.a&&(b=e.a),this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},color2:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r.r=e.r,r.g=e.g,r.b=e.b,e.a&&(b=e.a),this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},gardientDirection:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{void 0!==e&&(c=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},scroll:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{void 0!==e&&(p=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},uvRotateSpeed:{configurable:!0,enumerable:!0,get:()=>x,set:e=>{void 0!==e&&(x=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOMaxAnimateScale:{configurable:!0,enumerable:!0,get:()=>N,set:e=>{void 0!==e&&(N=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOMinAnimateScale:{configurable:!0,enumerable:!0,get:()=>S,set:e=>{void 0!==e&&(S=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOScaleAnimateSpeed:{configurable:!0,enumerable:!0,get:()=>v,set:e=>{void 0!==e&&(v=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},speed:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{void 0!==e&&(g=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},brightness:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{void 0!==e&&(u=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},roughness:{configurable:!0,enumerable:!0,get:()=>f,set:e=>{f=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},metallic:{configurable:!0,enumerable:!0,get:()=>y,set:e=>{y=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},opacity:{configurable:!0,enumerable:!0,get:()=>b,set:e=>{this.transparent=e<1,b=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},brightnessColor:{configurable:!0,enumerable:!0,get:()=>U,set:e=>{e&&(U.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:s,writable:!0},size:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{void 0!==e&&(l=e,this.overtimeInstanceIndex=[],this.materialNeedsUpdate=!0)}},sizeAttenuation:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{void 0!==e&&(d=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={}){if(!e.to)return!1;const{from:t={},to:i={},duration:s=3e3,easing:a="Linear",loop:o=!1,stayEnd:n=!0}=e;t.position||delete t.position,t.rotation||delete t.rotation,t.scale||delete t.scale,i.position||delete i.position,i.rotation||delete i.rotation,i.scale||delete i.scale,i.animateOffset||delete i.animateOffset,this.animateNeedsUpdate=!0,this.animateJson={Status:"play",From:t,To:i,Duration:s,Easing:a,Loop:o,StayEnd:n};const r=new y.Tween({ratio:0}).to({ratio:1},e.duration||3e3).start();return o&&r.repeat(1/0),this.tween=null,this.tween=r,this.tween}stopAnimate(e=1e3){this.animateNeedsUpdate=!0,this.animateJson={Status:"stop",DelayTime:e},this.tween&&this.tween.stop(),this.tween=null}setData(e){const t=ce(e);if(t.length<1)return!1;const i=t[0].geometry.type.toLowerCase();if(this.isInstance&&["point","multipoint"].indexOf(i)<0)return!1;let s={};switch(i){case"point":case"multipoint":s=ge(t);break;case"linestring":case"multilinestring":s=me(t);break;case"polygon":case"multipolygon":s=pe(t)}if(this.isInstance){const{data:e,overtimeInstanceIndex:t,datas:i}=function(e,t){if(!e||e.length<1)return{data:t,datas:t,overtimeInstanceIndex:[]};const i=[],s=[],a=[],o=[];for(let a=0;a<e.length;a++){const{geometry:n,properties:r={}}=e[a],{coordinates:l}=n,{rotation:h={x:0,y:0,z:0},scale:d={x:1,y:1,z:1}}=r;let c=!1;for(let e=0;e<t.length;e++){const{geometry:s,properties:a={}}=t[e],{coordinates:n}=s,{rotation:r={x:0,y:0,z:0},scale:u={x:1,y:1,z:1}}=a;if(l.length===n.length&&l.every(((e,t)=>e===n[t]))&&(h.x===r.x&&h.y===r.y&&h.z===r.z&&d.x===u.x&&d.y===u.y&&d.z===u.z&&!(i.indexOf(e)>-1))){i.push(e),c=!0,o.push(t[e]);break}}c||s.push(a)}for(let e=0;e<t.length;e++)i.indexOf(e)<0&&(a.push(t[e]),o.push(t[e]));return{data:a,overtimeInstanceIndex:s,datas:o}}(this.datas,s);(e.length>0||t.length>0)&&(this.datas=i,this.data=e,this.overtimeInstanceIndex=t,this.materialNeedsUpdate=!0)}else this.data=s}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}:h,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}}class Oe extends Te{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=pe(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 ze(e,t){const i=e[0],s=e[1],a=t[0],o=t[1];return Math.sqrt((i-a)*(i-a)+(s-o)*(s-o))}function Re(e,t,i){const s=Math.abs(ze(e,t)),a=Math.abs(ze(e,i)),o=Math.abs(ze(t,i)),n=(s+a+o)/2;return 2*Math.sqrt(Math.abs(n*(n-s)*(n-a)*(n-o)))/s}function Ee(e,t,i,s,a){if(i<s){let o=0,n=0;const r=e[i],l=e[s];for(let t=i+1;t<s;t++){const i=Re(r,l,e[t]);i>o&&(o=i,n=t)}o>=a&&(t.push(e[n]),Ee(e,t,i,n,a),Ee(e,t,n,s,a))}return t}function Ie(e,t=10,i=1){if(!(e&&e.length>2))return null;e.forEach(((e,t)=>{e.id=t}));const s=Ee(e,[],0,e.length-i,t);s.push(e[0]),s.push(e[e.length-1]);const a=s.sort(((e,t)=>e.id<t.id?-1:e.id>t.id?1:0));return a.forEach((e=>{e.id=0})),a}class Ae extends Te{constructor(e={}){super(e),this.type="Line";let t=e.style||R.SOLID,i=e.splineType||I.LINEAR,s=e.direction||E.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;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;let d={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?e.a:1,this.materialNeedsUpdate=!0)}},strokeWidth:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e,this.materialNeedsUpdate=!0)}}})}setData(e){if(this.isDilution){const t=ce(e);t.forEach(((e,t)=>{const i=e.geometry.coordinates,s=i.length;let a=1;const[o,n,r]=i[0],[l,h,d]=i[s-1];o===l&&n===h&&r===d&&(a=2),e.geometry.coordinates=Ie(i,this.interval,a)})),(e={}).features=t}this.data=me(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 Me extends Te{constructor(e={}){super(e);let i=e.size||4;this.type="Point",Object.defineProperties(this,{size:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=Number(e),i&&(this.scale=new t(i,i,i),this.matrixNeedsUpdate=!0)}}})}setData(e){this.data=ge(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 De extends Te{constructor(e){super(e),this.type="Cube"}}class Le extends Te{constructor(e={}){super(e),this.type="MeasureArea";let t=void 0===e.textDisplay||e.textDisplay;const i=e.textColor||new h(1,0,0);let s=e.fontSize||18,a=e.textBorderColor||new h(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 Pe extends Te{constructor(e={}){super(e),this.type="MeasureLine";let t=e.style||R.SOLID,i=e.splineType||I.LINEAR,s=e.direction||E.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 d=e.strokeWidth||1,c=void 0===e.textDisplay||e.textDisplay;const u=e.textColor||new h(1,0,0);let p=e.fontSize||18,m=e.textBorderColor||new h(1,0,0),g=e.textBorderWidth||1,f=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:()=>f,set:e=>{e&&(f=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?e.a:1)}},strokeWidth:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d=e)}},textDisplay:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{e&&(c=e)}},fontSize:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{e&&(p=e)}},textColor:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{e&&(u.r=e.r,u.g=e.g,u.b=e.b)}},textBorderWidth:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g=e)}},textBorderColor:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e&&(m.r=e.r,m.g=e.g,m.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 ke extends Te{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 h(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 Be extends Te{constructor(e={}){super(e),this.type="LocationPoint",this.EPSG=e.EPSG||"epsg:4326";const t=e.textColor||new h(1,0,0);let i=e.fontSize||18,s=e.textBorderColor||new h(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}}const _e=b.create();_e.interceptors.request.use((e=>{const t=localStorage.getItem("authToken");return t&&(e.headers.Authorization=`Bearer ${t}`),e}),(e=>Promise.reject(e))),_e.interceptors.response.use((e=>e),(e=>(e.response&&401===e.response.status&&localStorage.removeItem("authToken"),Promise.reject(e))));class Fe{constructor(){}static host="";static tag="";static _username="admin";static _password="admin";static _currentProject;static set username(e){this._username=e,this._SaveToken()}static get username(){return this._username}static set password(e){this._password=e,this._SaveToken()}static get password(){return this._password}static _SaveToken(){localStorage.setItem("authToken",btoa(`${this._username}:${this._password}`))}}Fe.GetProjectCommon=async function(){if(Fe.host){return await _e.get(`${Fe.host}/api/configs/projects/common`)}console.error("请先设置Host地址")},Fe.getProjectCommon=Fe.GetProjectCommon,Fe.GetProjectByNodeId=async function(e){if(Fe.host){return await _e.get(`${Fe.host}/api/configs/projects/${e}`)}console.error("请先设置Host地址")},Fe.getProjectByNodeId=Fe.GetProjectByNodeId,Fe.GetAllCapacity=async function(){if(Fe.host){return(await _e.get(`${Fe.host}/api/nodes/capacity`)).data.data[""===Fe.tag?"all":Fe.tag]}},Fe.getAllCapacity=Fe.GetAllCapacity,Fe.GetAllCapacityInfo=async function(){if(Fe.host){return(await _e.get(`${Fe.host}/api/nodes/capacity`)).data.data}},Fe.getAllCapacityInfo=Fe.GetAllCapacityInfo,Fe.GetAllNodes=async function(){if(Fe.host){return await _e.get(`${Fe.host}/api/nodes/all`)}},Fe.getAllNodes=Fe.GetAllNodes,Fe.GetAliveNodes=async function(){if(Fe.host){return await _e.get(`${Fe.host}/api/nodes/list`)}},Fe.getAliveNodes=Fe.GetAliveNodes,Fe.CreateTask=async function(e){const t=Fe.tag||"",i=await _e.post(`${Fe.host}/api/tasks/create`,{project:e,tag:"all"===t?"":t});return Fe._currentProject=i.data,i.data},Fe.createTask=Fe.CreateTask,Fe.KillTask=async function(e){if(Fe.host){const t=await _e.post(`${Fe.host}/api/tasks/kill/${e}`);return Fe._currentProject=null,t}},Fe.killTask=Fe.KillTask,Fe._SaveToken(),"undefined"==typeof ue&&(window.ue={});const We=window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.requestAnimationFrame;class He extends G{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.printStats=(null==e?void 0:e.printStats)||!1,this.printInputs=(null==e?void 0:e.printInputs)||!1,this.connectOnLoad=(null==e?void 0:e.connectOnLoad)||!0,this.isReconnection=(null==e?void 0:e.isReconnection)||!1,this.ws,this.wsURL=null==e?void 0:e.wsUrl,this.projectName=void 0===e.projectName?"default":e.projectName,this.renderMode=(null==e?void 0:e.renderMode)||"cloud",this.matchmakerIP=null==e?void 0:e.matchmakerIP,this.matchmakerPort=(null==e?void 0:e.matchmakerPort)||"90",this.scene=new re,this.scene.engine=this,this.qualityController=!1,this.qualityControlOwnershipCheckBox,this.matchViewportResolution=(null==e?void 0:e.matchViewportResolution)||!1,this.resolution=(null==e?void 0:e.resolution)||[0,0],this.lastTimeResized=(new Date).getTime(),this.resizeTimeout,this.onDataChannelConnected;const{controlScheme:t=D.controlScheme,suppressBrowserKeys:i=D.suppressBrowserKeys,fakeMouseWithTouches:s=D.fakeMouseWithTouches}=(null==e?void 0:e.inputOptions)||{};if(this.inputOptions={controlScheme:t,suppressBrowserKeys:i,fakeMouseWithTouches:s},this.eventHandler=new V(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(),"inner"===this.renderMode){var a;const e=this;"undefined"!=typeof ue&&null!==(a=ue)&&void 0!==a&&a.interface&&(ue.interface.webUILoaded=function(){e._initWebUI()})}}static DispatchServer=Fe;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:U.OBJECT_BOUNDINGBOX,params:this.objectBBox.toJSON()}):this.emitUIInteraction({excuteName:O.VISIBLE,params:e.toJSON()}),e.visibleNeedsUpdate=!1),e.visible&&(e.matrixNeedsUpdate||e.materialNeedsUpdate||e.animateNeedsUpdate)&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:T.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?this.emitUIInteraction({excuteName:C.EVENT_LAYER_BUILDING,params:e.toJSON()}):"SlopeAnalysis"===e.type?this.emitUIInteraction({excuteName:C.UPDATA_SLOPE_ANALYSIS,params:e.toJSON()}):this.emitUIInteraction({excuteName:O.UPDATE,params:e.toJSON()}),e.matrixNeedsUpdate=!1,e.materialNeedsUpdate=!1,e.animateNeedsUpdate=!1),e.visible&&e.messageNeedsUpdate&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:T.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):this.emitUIInteraction({excuteName:O.UPDATE,params:e.toJSON()}),e.messageNeedsUpdate=!1),e.followNeedsUpdate&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:T.FOLLOW_TRAFFIC_STREAM_ITEM,params:e.toJSON(!1)}):"AutonomousVehicle"===e.type&&this.emitUIInteraction({excuteName:O.UPDATE,params:e.toJSON()}),e.followNeedsUpdate=!1)})),this.camera&&this.camera.needsUpdate&&(this.camera.constrainPolygonNeedsUpdate?(this.emitUIInteraction({excuteName:w.Constrain_Shape,params:this.camera.toJSON()}),this.camera.constrainPolygonNeedsUpdate=!1):this.emitUIInteraction({excuteName:w.UPDATE,params:this.camera.toJSON()}),this.camera.needsUpdate=!1)}),1e3/e)}eventListenerUpdate(e){e&&e._needsDispatchedToUE&&(e._dispatchAddListenerTypes&&e._dispatchAddListenerTypes.length>0&&(this.emitUIInteraction({excuteName:T.ADD_EVENT_LISTENER,params:{type:e.type,name:e.name,uuid:e.uuid,EventType:e._dispatchAddListenerTypes}}),e._dispatchAddListenerTypes=[]),e._dispatchRemoveListenerTypes&&e._dispatchRemoveListenerTypes.length>0&&(this.emitUIInteraction({excuteName:T.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)||void 0===e||e.removeFromParent(),this.camera=null);this.camera=new le,this.camera.type="Camera",this.camera.addEventListener("cameraChange",(e=>{var t,i,s,o,n,r;const l=e.content.camera;this.camera.position.x=l.Location.longitude,this.camera.position.y=l.Location.latitude,this.camera.position.z=l.Location.altitude,this.camera.rotation.x=a.degToRad(l.Rotate.roll),this.camera.rotation.y=a.degToRad(l.Rotate.pitch),this.camera.rotation.z=a.degToRad(l.Rotate.yaw),this.camera.roll=l.Rotate.roll,this.camera.pitch=l.Rotate.pitch,this.camera.yaw=l.Rotate.yaw,this.camera.worldLocation.x=null==l||null===(t=l.Position)||void 0===t?void 0:t.x,this.camera.worldLocation.y=null==l||null===(i=l.Position)||void 0===i?void 0:i.y,this.camera.worldLocation.z=null==l||null===(s=l.Position)||void 0===s?void 0:s.z,this.camera.sphereLocation.x=null==l||null===(o=l.SphereLocation)||void 0===o?void 0:o.longitude,this.camera.sphereLocation.y=null==l||null===(n=l.SphereLocation)||void 0===n?void 0:n.latitude,this.camera.sphereLocation.z=null==l||null===(r=l.SphereLocation)||void 0===r?void 0:r.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 De({color:new h(1,1,0)}),this.scene.add(this.objectBBox),this.objectBBox.visible=!1,this.emitUIInteraction({excuteName:U.OBJECT_BOUNDINGBOX,params:this.objectBBox.toJSON()})}_initWebUI(){const e=this;ue.interface.webUIMessage=function(t){e.eventHandler.callRespone(t)},console.log("页面及其所有资源已完全加载"),setTimeout((()=>{e.UDS||(e.UDS=new W(e,e.UDSParams)),e.camera||(console.log("initOthers start"),e.initOthers(),console.log("initOthers end -> ",e.camera)),e.dispatchEvent({type:"videoInitialised"})}),1e3),je((new Date).getTime())}scanGamepads(){let e=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[];for(let t=0;t<e.length;t++)e[t]&&e[t].index in this.controllers&&(this.controllers[e[t].index].currentState=e[t])}updateStatus(){for(j in this.scanGamepads(),this.controllers){let e=this.controllers[j],t=e.currentState,i=e.prevState;for(let e=0;e<t.buttons.length;e++){let 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){let i=parseFloat(t.axes[e].toFixed(4)),s=-parseFloat(t.axes[e+1].toFixed(4));0===e?(this.emitControllerAxisMove(j,1,i),this.emitControllerAxisMove(j,2,s)):2===e&&(this.emitControllerAxisMove(j,3,i),this.emitControllerAxisMove(j,4,s))}this.controllers[j].prevState=t}We(this.updateStatus)}emitControllerButtonPressed(e,t,i){Data=new DataView(new ArrayBuffer(4)),Data.setUint8(0,L.GamepadButtonPressed),Data.setUint8(1,e),Data.setUint8(2,t),Data.setUint8(3,i)}emitControllerButtonReleased(e,t){Data=new DataView(new ArrayBuffer(3)),Data.setUint8(0,L.GamepadButtonReleased),Data.setUint8(1,e),Data.setUint8(2,t)}emitControllerAxisMove(e,t,i){Data=new DataView(new ArrayBuffer(11)),Data.setUint8(0,L.GamepadAnalog),Data.setUint8(1,e),Data.setUint8(2,t),Data.setFloat64(3,i,!0),this.sendInputData(Data.buffer)}setupToggleWithUrlParams(e,t){let i=document.getElementById(e);i&&(i.checked=new URLSearchParams(window.location.search).has(t),i.addEventListener("change",(e=>{const i=new URLSearchParams(window.location.search);e.currentTarget.checked?i.set(t,"true"):i.delete(t),window.history.replaceState({},"",""!==i.toString()?`${location.pathname}?${i}`:`${location.pathname}`)})))}updateStreamList(){const e=document.getElementById("stream-select");for(let t=e.options.length-1;t>=0;t--)e.remove(t);e.value=null;for(const[t,i]of this.webRtcPlayerObj.availableVideoStreams){let i=document.createElement("option");i.value=t,i.innerHTML=t,e.appendChild(i),null==e.value&&(e.value=t)}this.updateTrackList()}updateTrackList(){const e=document.getElementById("stream-select"),t=document.getElementById("track-select"),i=this.webRtcPlayerObj.availableVideoStreams.get(e.value);for(let e=t.options.length-1;e>=0;e--)t.remove(e);t.value=null;for(const e of i.getVideoTracks()){let i=document.createElement("option");i.value=e.id,i.innerHTML=e.label,t.appendChild(i),e.selected&&(t.value=e.id)}}sendStartLatencyTest(){const e=this;if(!this.webRtcPlayerObj)return;this.webRtcPlayerObj.startLatencyTest((function(t){let i={StartTime:t};e.emitDescriptor(L.LatencyTest,i)}))}setOverlay(e,t,i){let s=document.getElementById("videoPlayOverlay");if(!s){let e=document.getElementById("player");s=document.createElement("div"),s.id="videoPlayOverlay",e&&e.appendChild(s)}for(;s.lastChild;)s.removeChild(s.lastChild);t&&s.appendChild(t),i&&s.addEventListener("click",(function e(t){i(t),s.removeEventListener("click",e)}));let a=s.classList;for(let e=a.length-1;e>=0;e--)a.remove(a[e]);s.classList.add(e)}showConnectOverlay(){let e=document.createElement("div");e.id="playButton",e.innerHTML="点击开始",this.setOverlay("clickableState",e,(e=>{this.connect(),this.startAfkWarningTimer()}))}showTextOverlay(e){let t=document.createElement("div");t.id="messageOverlay",t.innerHTML=e||"",this.setOverlay("textDisplayState",t)}playVideoStream(){const e=this;e.webRtcPlayerObj&&this.webRtcPlayerObj.video?(e.webRtcPlayerObj.video.play().catch((function(t){console.error(t),console.log("Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),e.showPlayOverlay()})),e.requestInitialSettings(),e.requestQualityControl(),e.eventHandler.showFreezeFrameOverlay(),e.hideOverlay()):console.error("Could not player video stream because this.webRtcPlayerObj.video was not valid.")}showPlayOverlay(){let 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==M.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 i=this;function s(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);let t=e.slice(5);if(this.freezeFrame.jpeg){let e=new Uint8Array(this.freezeFrame.jpeg.length+t.length);e.set(this.freezeFrame.jpeg,0),e.set(t,this.freezeFrame.jpeg.length),this.freezeFrame.jpeg=e}else this.freezeFrame.jpeg=t,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(){let e=btoa(this.freezeFrame.jpeg.reduce(((e,t)=>e+String.fromCharCode(t)),"")),t=document.getElementById("this.freezeFrameOverlay").childNodes[0];t.src="data:image/jpeg;base64,"+e,t.onload=function(){i.freezeFrame.height=t.naturalHeight,i.freezeFrame.width=t.naturalWidth,i.resizeFreezeFrameOverlay(),i.shouldShowPlayOverlay?(i.showPlayOverlay(),i.eventHandler.resizePlayerStyle()):i.eventHandler.showFreezeFrameOverlay()}}()):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 H({...t,forceTURN:this.forceTURN}),e.appendChild(this.webRtcPlayerObj.video),e.appendChild(this.freezeFrameOverlay),this.connectOnLoad&&(this.webRtcPlayerObj.video.muted=!0),this.webRtcPlayerObj.onWebRtcOffer=function(e){if(i.ws&&1===i.ws.readyState){let t=JSON.stringify(e);console.log("%c[Outbound SS message (offer)]","background: lightgreen; color: black",e),i.ws.send(t)}},this.webRtcPlayerObj.onWebRtcCandidate=function(e){i.ws&&1===i.ws.readyState&&i.ws.send(JSON.stringify({type:"iceCandidate",candidate:e}))},this.webRtcPlayerObj.onWebRtcAnswer=function(e){if(i.ws&&1===i.ws.readyState){let t=JSON.stringify(e);console.log("%c[Outbound SS message (answer)]","background: lightgreen; color: black",e),i.ws.send(t)}},this.webRtcPlayerObj.onVideoInitialised=function(){i.ws&&1===i.ws.readyState&&(i.shouldShowPlayOverlay?(i.showPlayOverlay(),i.eventHandler.resizePlayerStyle()):(i.eventHandler.resizePlayerStyle(),i.playVideoStream()),0!==i.resolution[0]&&0!==i.resolution[1]&&i.changeResolution(i.resolution[0],i.resolution[1]))},this.webRtcPlayerObj.onDataChannelConnected=function(){i.ws&&1===i.ws.readyState&&(i.showTextOverlay("云渲染服务连接成功,等待画面推送中"),i.requestQualityControl(),setTimeout((()=>{i.UDS||(i.UDS=new W(i,i.UDSParams)),i.camera||i.initOthers(),i.dispatchEvent({type:"videoInitialised"})}),1e3))},this.webRtcPlayerObj.onNewVideoTrack=function(e){var t,s;null!=i&&null!==(t=i.webRtcPlayerObj)&&void 0!==t&&t.onVideoInitialised&&(null==i||null===(s=i.webRtcPlayerObj)||void 0===s||s.onVideoInitialised());i.isShowTestUI&&i.updateStreamList()},this.webRtcPlayerObj.onDataChannelMessage=function(e){let t=new Uint8Array(e);if(t[0]===A.QualityControlOwnership){let e=0!==t[1];console.log("Received quality controller message, will control quality: "+e),i.qualityController=e,i.qualityControlOwnershipCheckBox&&(i.qualityControlOwnershipCheckBox.disabled=e,i.qualityControlOwnershipCheckBox.checked=e)}else if(t[0]===A.Response){let t=new TextDecoder("utf-16").decode(e.slice(1));i.eventHandler.callRespone(JSON.parse(t))}else if(t[0]===A.Command){let t=new TextDecoder("utf-16").decode(e.slice(1));console.log(t);let s=JSON.parse(t);"onScreenKeyboard"===s.command&&i.showOnScreenKeyboard(s)}else if(t[0]===A.FreezeFrame)s(t);else if(t[0]===A.UnfreezeFrame)i.eventHandler.invalidateFreezeFrameOverlay();else if(t[0]===A.VideoEncoderAvgQP)i.videoEncoderQP=new TextDecoder("utf-16").decode(e.slice(1));else if(t[0]==A.LatencyTest){let t=new TextDecoder("utf-16").decode(e.slice(1));console.log("Got latency timings from UE."),console.log(t);let s=JSON.parse(t);i.webRtcPlayerObj&&i.webRtcPlayerObj.latencyTestTimings.SetUETimings(s)}else if(t[0]==A.InitialSettings){if(!i.isShowTestUI)return;let t=new TextDecoder("utf-16").decode(e.slice(1)),s=JSON.parse(t);if(s.PixelStreaming){if(!1===s.PixelStreaming.AllowPixelStreamingCommands){if(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")){let e=document.createElement("p");e.innerText="(Disabled by -AllowPixelStreamingCommands=false)",e.classList="subtitle-text",e.id="warning-elem-webrtc",document.getElementById("webRTCSettingsHeader").appendChild(e)}if(!document.getElementById("warning-elem-encoder")){let e=document.createElement("p");e.innerText="(Disabled by -AllowPixelStreamingCommands=false)",e.classList="subtitle-text",e.id="warning-elem-encoder",document.getElementById("encoderSettingsHeader").appendChild(e)}console.warn("-AllowPixelStreamingCommands=false, sending console commands from browser to UE is disabled, including toggling FPS and changing encoder settings from the browser.")}s.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."))}s.Encoder&&(document.getElementById("encoder-min-qp-text").value=s.Encoder.MinQP,document.getElementById("encoder-max-qp-text").value=s.Encoder.MaxQP),s.WebRTC&&(document.getElementById("webrtc-fps-text").value=s.WebRTC.FPS,document.getElementById("webrtc-min-bitrate-text").value=s.WebRTC.MinBitrate/1e3,document.getElementById("webrtc-max-bitrate-text").value=s.WebRTC.MaxBitrate/1e3)}else if(t[0]==A.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"));let t=new TextDecoder("utf-16").decode(e.slice(1));console.log(t),this.file.extension=t}(t);else if(t[0]==A.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"));let t=new TextDecoder("utf-16").decode(e.slice(1));console.log(t),this.file.mimetype=t}(t);else if(t[0]==A.FileContents)!function(e){if(!this.file.receiving)return;this.file.size=Math.ceil(new DataView(e.slice(1,5).buffer).getInt32(0,!0)/16379);let t=e.slice(5);if(this.file.data.push(t),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");const 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`);let i=new Blob(this.file.data,{type:this.file.mimetype}),s=document.createElement("a");s.setAttribute("href",URL.createObjectURL(i)),s.setAttribute("download",`transfer.${this.file.extension}`);let a=$(s);a.appendTo("body"),a.remove()}else 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}`))}(t);else if(t[0]==A.Mouse){const t=new TextDecoder("utf-16").decode(e.slice(1));this.eventHandler.dispatchMouseEvent(t)}else if(t[0]==A.Keyboard){const t=new TextDecoder("utf-16").decode(e.slice(1));this.eventHandler.dispatchKeyboardEvent(t)}else t[0]==A.InputControlOwnership||t[0]==A.Protocol?new TextDecoder("utf-16").decode(e.slice(1)):console.error(`unrecognized data received, packet ID ${t[0]}`)},this.eventHandler.registerInputs(this.webRtcPlayerObj.video),"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(e),this.webRtcPlayerObj.video}setupStats(){this.webRtcPlayerObj.aggregateStats(1e3);let e=3e5,t=e;this.webRtcPlayerObj.onAggregatedStats=i=>{let s=new Intl.NumberFormat(window.navigator.language,{maximumFractionDigits:0}),a=new Intl.NumberFormat(window.navigator.language,{maximumFractionDigits:0,minimumIntegerDigits:2}),o=(i.timestamp-i.timestampStart)/1e3,n=[],r=[60,60];for(let e=0;e<r.length;e++)n.push(o%r[e]),o/=r[e];n.push(o);let l=n[0],h=Math.floor(n[1]),d=Math.floor([n[2]]),c="B",u=i.hasOwnProperty("bytesReceived")?i.bytesReceived:0,p=["kB","MB","GB"];for(let e=0;e<p.length&&!(u<1e5);e++)u/=1e3,c=p[e];i.receivedBytes=""+u+p;let m=document.getElementById("qualityStatus"),g=function(e){let t=e,i=1,s=setInterval((function(){i-=.1,m.style=`opacity: ${Math.abs(2*(i-.5))}`,i<=.1&&(0==--t?clearInterval(s):i=1)}),100/e)};let f="",y="lime";this.videoEncoderQP>35?(y="red",g(2),f+=`<div style="color: ${y}">Very blocky encoding quality</div>`):this.videoEncoderQP>26&&(y="orange",g(1),f+=`<div style="color: ${y}">Blocky encoding quality</div>`),m.className=`${y}Status`,f+=`<div>Duration: ${a.format(d)}:${a.format(h)}:${a.format(l)}</div>`,f+=`<div>Video Resolution: ${i.hasOwnProperty("frameWidth")&&i.frameWidth&&i.hasOwnProperty("frameHeight")&&i.frameHeight?i.frameWidth+"x"+i.frameHeight:"Chrome only"}</div>`,f+=`<div>Received (${c}): ${s.format(u)}</div>`,f+=`<div>Frames Decoded: ${i.hasOwnProperty("framesDecoded")?s.format(i.framesDecoded):"Chrome only"}</div>`,f+=`<div>Packets Lost: ${i.hasOwnProperty("packetsLost")?s.format(i.packetsLost):"Chrome only"}</div>`,f+=`<div>Framerate: ${i.hasOwnProperty("framerate")?s.format(i.framerate):"Chrome only"}</div>`,f+=`<div>Frames dropped: ${i.hasOwnProperty("framesDropped")?s.format(i.framesDropped):"Chrome only"}</div>`,f+=`<div>Net RTT (ms): ${i.hasOwnProperty("currentRoundTripTime")?s.format(1e3*i.currentRoundTripTime):"Can't calculate"}</div>`,f+=`<div>Browser receive to composite (ms): ${i.hasOwnProperty("receiveToCompositeMs")?s.format(i.receiveToCompositeMs):"Chrome only"}</div>`,f+=`<div style="color: ${y}">Bitrate (kbps): ${i.hasOwnProperty("bitrate")?s.format(i.bitrate):"Chrome only"}</div>`,f+=`<div style="color: ${y}">Video Quantization Parameter: ${this.videoEncoderQP}</div>`,document.getElementById("stats").innerHTML=f,this.printStats&&i.timestampStart&&i.timestamp-i.timestampStart>t&&(this.ws&&1===this.ws.readyState&&(console.log(`-> SS: stats\n${JSON.stringify(i)}`),this.ws.send(JSON.stringify({type:"stats",data:i}))),t+=e),this.dispatchEvent({type:"aggregatedStats",data:i})},this.webRtcPlayerObj.latencyTestTimings.OnAllLatencyTimingsReady=function(e){if(!e.BrowserReceiptTimeMs)return;let t=e.BrowserReceiptTimeMs-e.TestStartTimeMs,i=e.UEEncodeMs,s=e.UECaptureToSendMs,a=e.UETransmissionTimeMs-e.UEReceiptTimeMs,o=t-a,n=null,r=null;e.FrameDisplayDeltaTimeMs&&e.BrowserReceiptTimeMs&&(n=e.FrameDisplayDeltaTimeMs+o+("string"==typeof s?0:s),r=e.FrameDisplayDeltaTimeMs+(t-o-a));let l="";l+=`<div>Net latency RTT (ms): ${o.toFixed(2)}</div>`,l+=`<div>UE Encode (ms): ${"string"==typeof i?i:i.toFixed(2)}</div>`,l+=`<div>UE Send to capture (ms): ${"string"==typeof s?s:s.toFixed(2)}</div>`,l+=`<div>UE probe duration (ms): ${a.toFixed(2)}</div>`,l+=e.FrameDisplayDeltaTimeMs&&e.BrowserReceiptTimeMs?`<div>Browser composite latency (ms): ${e.FrameDisplayDeltaTimeMs.toFixed(2)}</div>`:"",l+=r?`<div>Total browser latency (ms): ${r.toFixed(2)}</div>`:"",l+=n?`<div>Total latency (ms): ${n.toFixed(2)}</div>`:"",document.getElementById("LatencyStats").innerHTML=l}}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(){if(!this.matchViewportResolution)return;if((new Date).getTime()-this.lastTimeResized>1e4){let e=document.getElementById("player");if(!e)return;let t={ConsoleCommand:"setres "+e.clientWidth+"x"+e.clientHeight};this.emitCommand(t),console.log(t),this.lastTimeResized=(new Date).getTime()}else console.log("Resizing too often - skipping")}emitDescriptor(e,t){let i=function(e){let t=JSON.stringify(e);return t.replace(/\r\n/g,"").replace(/\n/g,"").replace(/\s+/g,""),t}(t);const s=49152;if(2*i.length>67108864)return console.error("数据量超出最大传输范围6.4MB!"),!1;if(2*i.length<s)return this.sendStringBufferData(e,i),!1;const a=Math.ceil(2*i.length/s);for(let t=0;t<a;t++){const o=i.slice(.5*t*s,24576*(t+1));this.sendStringBufferData(e,o,a,t+1)}}sendStringBufferData(e,t,i=1,s=1){let a;const o={total:i,index:s,content:t};a=JSON.stringify(o);const n=new DataView(new ArrayBuffer(3+2*a.length));let r=0;n.setUint8(r,e),r++,n.setUint16(r,a.length,!0),r+=2;for(let e=0;e<a.length;e++)n.setUint16(r,a.charCodeAt(e),!0),r+=2;this.sendInputData(n.buffer)}emitUIInteraction(e){var t,i;(console.log(e),"cloud"===this.renderMode)?this.emitDescriptor(L.UIInteraction,e):"undefined"!=typeof ue&&null!==(t=ue)&&void 0!==t&&null!==(i=t.interface)&&void 0!==i&&i.broadcast?ue.interface.broadcast(JSON.stringify(e)):console.warn("ue.interface.broadcast is not available in this environment.")}emitCommand(e){this.emitDescriptor(L.Command,e)}requestInitialSettings(){this.sendInputData(new Uint8Array([L.RequestInitialSettings]).buffer)}requestQualityControl(){this.qualityController||this.sendInputData(new Uint8Array([L.RequestQualityControl]).buffer)}setupNormalizeAndQuantize(){let e=document.getElementById("player"),t=e.getElementsByTagName("video");if(e&&t.length>0){let i=e.clientHeight/e.clientWidth,s=t[0].videoHeight/t[0].videoWidth;if(i>s){this.printInputs&&console.log("Setup Normalize and Quantize for playerAspectRatio > videoAspectRatio");let t=i/s;this.normalizeAndQuantizeUnsigned=(i,s)=>{let a=i/e.clientWidth,o=t*(s/e.clientHeight-.5)+.5;return a<0||a>1||o<0||o>1?{inRange:!1,x:65535,y:65535}:{inRange:!0,x:65536*a,y:65536*o}},this.unquantizeAndDenormalizeUnsigned=(i,s)=>{let a=(s/65536-.5)/t+.5;return{x:i/65536*e.clientWidth,y:a*e.clientHeight}},this.normalizeAndQuantizeSigned=(i,s)=>({x:32767*(i/(.5*e.clientWidth)),y:32767*(t*s/(.5*e.clientHeight))})}else{this.printInputs&&console.log("Setup Normalize and Quantize for playerAspectRatio <= videoAspectRatio");let t=s/i;this.normalizeAndQuantizeUnsigned=(i,s)=>{let a=t*(i/e.clientWidth-.5)+.5,o=s/e.clientHeight;return a<0||a>1||o<0||o>1?{inRange:!1,x:65535,y:65535}:{inRange:!0,x:65536*a,y:65536*o}},this.unquantizeAndDenormalizeUnsigned=(i,s)=>{let a=s/65536;return{x:((i/65536-.5)/t+.5)*e.clientWidth,y:a*e.clientHeight}},this.normalizeAndQuantizeSigned=(i,s)=>({x:32767*(t*i/(.5*e.clientWidth)),y:32767*(s/(.5*e.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){if(e.showOnScreenKeyboard){this.editTextButton.classList.remove("hiddenState");let t=this.unquantizeAndDenormalizeUnsigned(e.x,e.y);this.editTextButton.style.top=t.y.toString()+"px",this.editTextButton.style.left=(t.x-40).toString()+"px"}else this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur()}start(e,t){let i=document.getElementById("qualityStatus");i&&(i.className="grey-status");let s=document.getElementById("stats");s&&(s.innerHTML="Not connected"),!this.connectOnLoad||this.isReconnection?(this.showConnectOverlay(),this.eventHandler.invalidateFreezeFrameOverlay(),this.shouldShowPlayOverlay=!0,this.eventHandler.resizePlayerStyle()):(console.log("直接链接~~~~~~"),this.connect(e,t))}buildingGrowthAnimate(e){const{state:t="play",group:i=1,duration:s=3e3,startHeight:a=0,endHeight:o=100,loop:n=!1,easing:r="Linear",sliceColor:l={r:1,g:0,b:0},sliceBrightness:h=30,colorHeight:d=100}=e;this.emitUIInteraction({excuteName:U.BUILD_GROWTHANIMATE,params:JSON.stringify({State:t,Group:i,Duration:s,StartHeight:a,EndHeight:o,Loop:n,Easing:r,SliceColor:l,SliceBrightness:h,ColorHeight:d})})}changeResolution(e,t){void 0!==e&&void 0!==t?this.emitUIInteraction({excuteName:T.CONSOLE_COMMAND,params:{Command:"r.SetRes "+e+"x"+t}}):console.warn("传入的参数为空")}excuteEngineConsoleCommand(e){void 0!==e?this.emitUIInteraction({excuteName:T.CONSOLE_COMMAND,params:{Command:e}}):console.warn("传入的参数为空")}Swtich3DTilesMode(e){const{mode:t,tilesName:i}=e;this.emitUIInteraction({excuteName:C.SWITCH_TERRAIN_MODE,params:{Mode:t,TilesName:i}})}enable3DTilesByName(e){const{enable:t=!0,tilesName:i}=e;this.emitUIInteraction({excuteName:C.ENABLE_3DTILES_BY_NAME,params:{Enable:t,TilesName:i}})}hidden3DTilesItem(e){let{hiddenList:t=[],tilesName:i}=e;Array.isArray(t)||(t=[]),this.emitUIInteraction({excuteName:C.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:T.RESET_WORLD_CENTER,params:{Center:{Latitude:a.clamp(e,-180,180),Longitude:a.clamp(t,-90,90),Altitude:a.clamp(i,-500,8848)}}})}SetPlanePOIMode(e){const{enable:t=!1,cullingScale:i=2,aspectRatio:s=1.777778,cameraFov:a=90,maxTilesCullingDistance:o=1e3,maxPOICullingDistance:n=2e3,poiSimplifyDistance:r=1500,maxLoadedPoiTilesNum:l=5}=e;this.emitUIInteraction({excuteName:C.SET_PLANE_POI_MODE,params:{EnablePoi:t,CullingScale:i,AspectRatio:s,CameraFov:a,MaxTilesCullingDistance:o,MaxPOICullingDistance:n,PoiSimplifyDistance:r,MaxLoadedPoiTilesNum:l}})}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:w.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){let{multiplier:t=1,x:i=0,y:s=0}=e;this.emitUIInteraction({excuteName:w.MOVE,params:{Multiplier:t,ActionValue:{x:i,y:s}}})}rotateCamera(e){let{multiplier:t=1,yaw:i=0,pitch:s=0}=e;this.emitUIInteraction({excuteName:w.ROTATE,params:{Multiplier:t,ActionValue:{x:i,y:s}}})}zoomIn(e=1){this.emitUIInteraction({excuteName:w.ZOOM_IN,params:{Multiplier:e}})}zoomOut(e=1){this.emitUIInteraction({excuteName:w.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}){var i,s,a;if(!e)return!1;this.emitUIInteraction({excuteName:w.FOCUS_ON,params:{uuid:null==e?void 0:e.uuid,type:null==e?void 0:e.type,rotation:{Roll:null==t||null===(i=t.rotation)||void 0===i?void 0:i.roll,Pitch:null==t||null===(s=t.rotation)||void 0===s?void 0:s.pitch,Yaw:null==t||null===(a=t.rotation)||void 0===a?void 0:a.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(e,t={}){const{lockAll:i=!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}=t;if(!e||e.length<2)return!1;u&&this.camera.addEventListener("navigationStart",u);const m=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];m.push(i[0],i[1],i[2]||10,i[3]||0,i[4]||0,i[5]||0)}setTimeout((()=>{this.emitUIInteraction({excuteName:w.NAVIGATION,params:JSON.stringify({jsondata:m,Speed:s,Name:n,Time:a,IgnoreLag:o,LockAll:i,PatrolType:r,FollowRotation:l,RayDetectionDistance:d,FinishDestory:h})})}),100),(p||c)&&(p?this.camera.addEventListener("navigationFinish",p):this.camera.addEventListener("navigationFinish",c))}pauseNavigation(e={}){const{patrolType:t="default"}=e;this.emitUIInteraction({excuteName:w.NAVIGATION_PAUSE,params:{State:0,PatrolType:t}})}resumeNavigation(e={}){const{patrolType:t="default"}=e;this.emitUIInteraction({excuteName:w.NAVIGATION_PAUSE,params:{State:1,PatrolType:t}})}stopNavigation(e={}){const{patrolType:t="default",delayTime:i=100}=e;setTimeout((()=>{this.emitUIInteraction({excuteName:w.NAVIGATION_STOP,params:{PatrolType:t}})}),i)}enableDataLayerByName(e,t){this.emitUIInteraction({excuteName:U.ENABLE_DATALAYER,params:{Visible:t,DataLayerName:e}})}project(e,t){if(!e)return!1;this.emitUIInteraction({excuteName:w.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:w.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:C.GET_ALTITUDE,params:i})}),100)}exit(){this.emitUIInteraction({excuteName:T.EXIT_CLIENT})}restartLevel(){return!1}restartGame(){this.emitUIInteraction({excuteName:T.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:T.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?this.emitUIInteraction({excuteName:C.EVENT_LAYER_BUILDING,params:e.toJSON(!1)}):"SlopeAnalysis"===e.type?this.emitUIInteraction({excuteName:C.UPDATA_SLOPE_ANALYSIS,params:e.toJSON()}):this.emitUIInteraction({excuteName:O.ADD,params:e.toJSON(!1)}))}removeFromScene(e){this.destoryObject(e)}removeAllFromScene(){this.emitUIInteraction({excuteName:O.DESTORY_ALL}),this.scene.clear()}destoryObject(e){e&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:T.CLOSE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?(e.buildingState="destory",this.emitUIInteraction({excuteName:C.EVENT_LAYER_BUILDING,params:e.toJSON(!1)})):this.emitUIInteraction({excuteName:O.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 d,this.scene.add(this.drawAndMeasureGroup)),"measure"===e)switch(this.editMode="measure",s=z.ENABLE_MEASURE,t.toLowerCase()){case"polygon":case"measurearea":if(this.drawAndMeasureGroup.measureArea)this.drawAndMeasureGroup.measureArea.updateParameters(i);else{const e=new Le(i);this.drawAndMeasureGroup.measureArea=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.measureArea.toJSON();break;case"line":case"measureline":if(this.drawAndMeasureGroup.measureLine)this.drawAndMeasureGroup.measureLine.updateParameters(i);else{const e=new Pe(i);this.drawAndMeasureGroup.measureLine=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.measureLine.toJSON();break;case"surfaceline":if(this.drawAndMeasureGroup.surfaceline)this.drawAndMeasureGroup.surfaceline.updateParameters(i);else{const e=new ke(i);this.drawAndMeasureGroup.surfaceline=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.surfaceline.toJSON();break;default:if(this.drawAndMeasureGroup.locationPoint)this.drawAndMeasureGroup.locationPoint.updateParameters(i);else{const e=new Be(i);this.drawAndMeasureGroup.locationPoint=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.locationPoint.toJSON()}else switch(this.editMode="draw",s=z.ENABLE_DRAW,t){case"polygon":if(this.drawAndMeasureGroup.polygon)for(const e in i)this.drawAndMeasureGroup.polygon[e]!==i[e]&&(this.drawAndMeasureGroup.polygon[e]=i[e]);else{const e=new Oe(i);this.drawAndMeasureGroup.polygon=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.polygon.toJSON();break;case"line":if(this.drawAndMeasureGroup.line)for(const e in i)this.drawAndMeasureGroup.line[e]!==i[e]&&(this.drawAndMeasureGroup.line[e]=i[e]);else{const e=new Ae(i);this.drawAndMeasureGroup.line=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.line.toJSON();break;default:if(this.drawAndMeasureGroup.point)for(const e in i)this.drawAndMeasureGroup.point[e]!==i[e]&&(this.drawAndMeasureGroup.point[e]=i[e]);else{const e=new Me(i);this.drawAndMeasureGroup.point=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.point.toJSON()}this.emitUIInteraction({ExcuteName:s,params:a})}closeEdit(){if(this.editMode){let e=z.CLOSE_DRAW;"measure"===this.editMode&&(e=z.CLOSE_MEASURE),this.emitUIInteraction({ExcuteName:e})}}setFPS(e=!1){this.emitUIInteraction({ExcuteName:U.ENABLE_FPS,params:{state:e}})}removeAllEditObjects(e="all",t=["point","line","polygon","surfaceline"]){if(!this.drawAndMeasureGroup||this.drawAndMeasureGroup.children.length<1)return;const i=[];if(e)switch(e){case"draw":(!Array.isArray(t)||t.length<1)&&(t=["point","line","polygon"]),t.indexOf("polygon")>-1&&this.drawAndMeasureGroup.polygon&&(i.push(this.drawAndMeasureGroup.polygon.uuid),this.drawAndMeasureGroup.polygon.removeFromParent(),this.drawAndMeasureGroup.polygon=null),t.indexOf("line")>-1&&this.drawAndMeasureGroup.line&&(i.push(this.drawAndMeasureGroup.line.uuid),this.drawAndMeasureGroup.line.removeFromParent(),this.drawAndMeasureGroup.line=null),t.indexOf("point")>-1&&this.drawAndMeasureGroup.point&&(i.push(this.drawAndMeasureGroup.point.uuid),this.drawAndMeasureGroup.point.removeFromParent(),this.drawAndMeasureGroup.point=null),this.emitUIInteraction({ExcuteName:z.DESTORY_DRAW,params:{uuids:i,Classes:t}});break;case"measure":(!Array.isArray(t)||t.length<1)&&(t=["point","line","polygon","surfaceline"]);let e=t.indexOf("polygon");e>-1&&(t.splice(e,1),t.push("MeasureArea")),e>-1&&this.drawAndMeasureGroup.measureArea&&(i.push(this.drawAndMeasureGroup.measureArea.uuid),this.drawAndMeasureGroup.measureArea.removeFromParent(),this.drawAndMeasureGroup.measureArea=null),e=t.indexOf("line"),e>-1&&(t.splice(e,1),t.push("MeasureLine")),e>-1&&this.drawAndMeasureGroup.measureLine&&(i.push(this.drawAndMeasureGroup.measureLine.uuid),this.drawAndMeasureGroup.measureLine.removeFromParent(),this.drawAndMeasureGroup.measureLine=null),e=t.indexOf("point"),e>-1&&(t.splice(e,1),t.push("LocationPoint")),e>-1&&this.drawAndMeasureGroup.locationPoint&&(i.push(this.drawAndMeasureGroup.locationPoint.uuid),this.drawAndMeasureGroup.locationPoint.removeFromParent(),this.drawAndMeasureGroup.locationPoint=null),e=t.indexOf("surfaceline"),e>-1&&(t.splice(e,1),t.push("SurfaceLine")),e>-1&&this.drawAndMeasureGroup.surfaceline&&(i.push(this.drawAndMeasureGroup.surfaceline.uuid),this.drawAndMeasureGroup.surfaceline.removeFromParent(),this.drawAndMeasureGroup.surfaceline=null),this.emitUIInteraction({ExcuteName:z.DESTORY_MEASURE,params:{uuids:i,Classes:t}});break;case"all":this.emitUIInteraction({ExcuteName:z.DESTORY_DRAW,params:{uuids:i,Classes:["Point","Line","Polygon"]}}),this.emitUIInteraction({ExcuteName:z.DESTORY_MEASURE,params:{uuids:i,Classes:["MeasureArea","MeasureLine","LocationPoint","SurfaceLine"]}}),this.drawAndMeasureGroup.children=[],this.scene.remove(this.drawAndMeasureGroup),this.drawAndMeasureGroup=null}}async connect(e=()=>{},t=()=>{}){const i=this,s=s=>{console.log("connectToStreamer wsURL :>> ",s),window.WebSocket=window.WebSocket||window.MozWebSocket,window.WebSocket?(i.reclickToStart&&clearTimeout(i.reclickToStart),i.ws=new WebSocket(s),i.ws.onopen=function(e){i.connected||(i.dispatchEvent({type:"connected"}),i.connected=!0),console.log(`${s} WebSocket connection`),i.startPSHeartbeat(),console.log("Start the heartbeat detection of the signaling server.")},i.ws.onmessage=function(e){let t=JSON.parse(e.data);"config"===t.type?(console.log("%c[Inbound SS (config)]","background: lightblue; color: black",t),i.onConfig(t)):"playerCount"===t.type?console.log("%c[Inbound SS (playerCount)]","background: lightblue; color: black",t):"offer"===t.type?(console.log("%c[Inbound SS (offer)]","background: lightblue; color: black",t),i.onWebRtcOffer(t)):"answer"===t.type?(console.log("%c[Inbound SS (answer)]","background: lightblue; color: black",t),i.onWebRtcAnswer(t)):"iceCandidate"===t.type?i.onWebRtcIce(t.candidate):"warning"===t.type&&t.warning?console.warn(t.warning):"pong"===t.type?console.log("pong",t.time):console.error("Invalid SS message type",t.type)},i.ws.onerror=function(e){console.log(`WS error: ${JSON.stringify(e)}`),i.stopPSHeartbeat(),i.dispatchEvent({type:"signalingServerError"})},i.ws.onclose=function(s){console.log(`WS closed: ${JSON.stringify(s.code)} - ${s.reason}`),i.stopPSHeartbeat(),i.ws=void 0,i.isReconnection=!0,i.connected&&(i.connected=!1);let a=document.getElementById("player");i.webRtcPlayerObj&&(a.removeChild(i.webRtcPlayerObj.video),i.webRtcPlayerObj.close(),i.webRtcPlayerObj=void 0),i.showTextOverlay("云渲染服务未正常连接"),i.reclickToStart=setTimeout((()=>{i.connect(e,t)}),1500)}):alert("Your browser doesn't support WebSocket")};if(i.wsURL)s(i.wsURL);else if(He.DispatchServer.host){console.log(`用新版调度服务启动 ${He.DispatchServer.host}/api/tasks/create`);const a=await He.DispatchServer.CreateTask(i.projectName);0===a.status?(i.forceTURN=a.data.useTurnServer,i.wsURL=`ws://${a.data.host}:${a.data.port}`,i.currentTask=a,s(i.wsURL),e&&e("Successfully created task: "+a)):(console.error("Failed to create task:"+a.message),t&&t("Failed to create task: "+a.message))}else{if(!i.matchmakerIP)return console.error("Needs a matchmaker's IP"),!1;{const e=`http://${i.matchmakerIP}:${i.matchmakerPort}/gpuserver?project=${i.projectName}`;try{const t=await b.get(e);if(t.data&&t.data.error)return console.error(t.data.error),!1;i.wsURL=`ws://${t.data.gpuServer}:${t.data.port}`,s(i.wsURL)}catch(e){console.error(e)}}}}startPSHeartbeat(){He.DispatchServer.host&&(this.heartbeatInterval=setInterval((()=>{this.ws.readyState===WebSocket.OPEN&&(this.ws.send('{"type":"ping"}'),console.log("Heartbeat send: Ping"))}),2e3))}stopPSHeartbeat(){this.heartbeatInterval&&clearInterval(this.heartbeatInterval)}onConfig(e){let t=document.getElementById("player"),i=this.setupWebRtcPlayer(t,e);switch(this.eventHandler.resizePlayerStyle(),this.inputOptions.controlScheme){case M.HoveringMouse:this.eventHandler.registerHoveringMouseEvents(i);break;case M.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;if(!s){let t=e.split("://");const i=t[1].split("/")[0],a=i.includes(":")?i.split(":")[0]:i;s=`${t[0]}://${a}/twin/assetApi/getStaticResourceUrl`}t||(t={all:1,common:1,project_id:"418690084255052706"}),this.emitUIInteraction({excuteName:U.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(e=()=>{},t=()=>{}){"cloud"==this.renderMode&&(this.eventHandler.setupHtmlEvents(),this.eventHandler.setupFreezeFrameOverlay(),this.eventHandler.registerKeyboardEvents(),this.start(e,t),je((new Date).getTime()))}}function je(){We(je),y.update()}class Ge extends Te{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=me(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 Ve(e){switch(e){case 0:return"DoNotFcaeToCamera";case 1:default:return"FacetoCamera_XYZ";case 2:return"FacetoCamera_Y";case 3:return"FacetoCamera_Z"}}class Je extends Te{constructor(e={}){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum;let t=e.pivot||{x:.5,y:.5};this.visible=void 0===e.visible||e.visible,this.isGlobalPOI=void 0!==e.isGlobalPOI&&e.isGlobalPOI;let i=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;this.renderType=e.renderType||0,this.openCollision=void 0!==e.openCollision&&e.openCollision;let c=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=ge(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:Ve(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 $e extends Te{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};this.renderType=e.renderType||0,this.fadeIn=void 0===e.fadeIn||e.fadeIn,this.openCollision=void 0!==e.openCollision&&e.openCollision;let c=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,f=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:()=>f,set:e=>{f=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=ge(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:Ve(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 Ye(e,t){const i={};if(Object.assign(i,t),i.style){const{width:t,height:s,borderRadius:a,borderWidth:o,paddingTop:n,paddingLeft:r}=i.style;i.style.width=t*e,i.style.height=s*e,a&&(i.style.borderRadius=a*e),o&&(i.style.borderWidth=o*e),n&&(i.style.paddingTop=n*e),r&&(i.style.paddingLeft=r*e)}return i.content&&i.content.forEach((t=>{for(let i in t)"number"==typeof t[i]&&"id"!==i&&(t[i]=t[i]*e);const{position:i}=t;i&&(t.position=i.map((t=>t*e))),t.textList&&t.textList.forEach((t=>{t.fontSize=t.fontSize*e,t.position=t.position.map((t=>t*e))}))})),i}class qe extends Te{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;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;let i=e;("mesh"===this.labelType||this.sizeAttenuation)&&(i=Ye(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={}){this.style,this.mainView=document.createElement("canvas");const t=await qe.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=Ye(this.renderScale,{content:e}).content);const i=this.drawCanvas.getContext("2d"),{width:s,height:a}=this.drawCanvas;i.clearRect(0,0,s,a),i.drawImage(this.mainView,0,0,s,a),await qe.renderContent(this.style,e,this.drawCanvas,this.factor),this.texture=xe(this.drawCanvas),this.dispatchEvent({type:"contentLoaded",label:this})}updateContent(e={}){let t=e;("mesh"===this.labelType||this.sizeAttenuation)&&(t=Ye(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:default:return"FacetoCamera_XYZ";case 2:return"FacetoCamera_Y";case 3:return"FacetoCamera_Z"}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){const{height:i,width:s,backgroundImage:o,borderRadius:n,borderColor:r,borderWidth:l,backgroundColor:h,clip:d}=e,c=s,u=i,p=t.getContext("2d"),m=a.ceilPowerOfTwo(c),g={width:m,height:m*(u/c),factor:{xScale:m/c,yScale:m/c}};t.width=g.width,t.height=g.height;const{xScale:f,yScale:y}=g.factor;if(o){const e=await qe.loadImg(o,"");p.drawImage(e,0,0,c*f,u*y)}else(r||h)&&(p.strokeStyle=r,p.fillStyle=h,p.lineWidth=l?l*f:1*f,qe.roundRect(p,p.lineWidth*f,p.lineWidth*y,(c-2*p.lineWidth)*f,(u-2*p.lineWidth)*y,n?n*f:0),h&&p.fill(),r&&p.stroke());if(d){const[e,t,i,s]=d;p.beginPath(),p.moveTo(s*c*f,e*u*y),p.lineTo((1-t)*c*f,e*u*y),p.lineTo((1-t)*c*f,(1-i)*u*y),p.lineTo(s*c*f,(1-i)*u*y),p.lineTo(s*c*f,e*u*y),p.closePath(),p.clip()}return g}static async renderContent(e,t,i,s){const a=i.getContext("2d"),{width:o,height:n}=i,{paddingTop:r,paddingLeft:l}=e;let h=0,d=0,c=0,u=0;const{xScale:p,yScale:m}=s,g=l?l*p:0,f=r?r*m:0,y=[g,f],b=[];for(let e=0;e<t.length;e++){const i=t[e],{width:r,height:x,textList:v,marginRight:S,marginBottom:N,backgroundImage:U,borderRadius:w,borderColor:C,borderWidth:T,backgroundColor:O,position:z,id:R,activeInfo:E={}}=i;if(z){const[e,t]=z;y[0]=g+e*p,y[1]=f+t*m,h=0,d=0,c=0,u=0}if(r&&x){if(y[0]+r*p>o&&(c+=h,c+x*m<=d?(y[0]=u,y[1]+=h):(y[0]=l?l*p:0,y[1]+=h,d=0,u=0)),U)try{const e=await qe.loadImg(U,"");a.drawImage(e,y[0],y[1],r*p,x*m)}catch(e){console.warn(e)}else O&&(a.strokeStyle=C,a.fillStyle=O,a.lineWidth=T?T*p:1*p,qe.roundRect(a,y[0]+a.lineWidth*p,y[1]+a.lineWidth*p,(r-2*a.lineWidth)*p,(x-2*a.lineWidth)*m,w?w*p:0),O&&a.fill(),C&&a.stroke());v&&v.forEach((e=>{const[t,i]=e.position,o=[y[0]+t*p,y[1]+i*m];qe.drawText(a,e,s,o)}));const e=y[0]===(l?l*p:0)*p?-.16:-1.3,t=-(n-y[1]-25*m)*(2.05/(107*m))+.1;if(R){const{position:i,style:s={width:5,height:.95}}=E,a=qe.addActiveArea(i||{x:e,y:t},s);a.customId=R,b.push(a)}y[0]+=(r+(S||0))*p,h=(x+(N||0))*m,h>d&&(d=h,u=y[0])}else v&&v.forEach((e=>{const[t,i]=e.position,o=[y[0]+t*p,y[1]+i*m];qe.drawText(a,e,s,o)}))}return b}static getRectangle(e,t,i,s={}){const a=new c({map:i,transparent:!0,fog:!0,depthWrite:!1,...s});a.map&&(a.map.needsUpdate=!0),a.transparent=!0;const o=(.01*e).toFixed(2),n=(.01*t).toFixed(2),r=new u(Number(o),Number(n),1,1),l=new p(r,a);return l.setWidth=o,l.setHeight=n,l}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){const{fontSize:i,fontFamily:s,color:a,text:o}=t,n=e.getContext("2d");n.font=`${i}px ${s}`,n.fillStyle=a,n.textAlign="left";return n.measureText(o).width}static drawText(e,t,i,s){const{xScale:a}=i,[o,n]=s,{text:r,fontSize:l,fontFamily:h,color:d,textAlign:c,icon:u}=t;let p;if(r||"number"==typeof r||u)if(r&&u)console.warn("BasicLabel Warning:text和icon不要同时设置");else{if(p=r,e.font=`${l*a}px ${h}`,e.fillStyle=d,e.textAlign=c||"left",e.textBaseline="top",u){let e=u;-1!==u.indexOf("&")&&(e=u.replace("&","&")),-1!==u.indexOf("&")&&(e=u.replace("&","&")),p=new Function('return ("'+`${e}`.replace("&#x","\\u").replace(";","")+'")')()}e.measureText(p).width,e.fillText(p,o,n)}}static addActiveArea(e,t){const{width:i,height:s}=t,{x:a,y:o}=e,n=new m({depthTest:!0,depthWrite:!1,transparent:!0,sizeAttenuation:!0,opacity:0}),r=new g(n);return r.scale.set(i,s,1),r.material.color=new h("#58d2d4"),r.center.set(a,o),r}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 Xe extends Te{constructor(e){super(e),this.type="Cone"}}class Ke extends Te{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashCar"}}class Qe extends Te{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashCarCrash"}}class Ze extends Te{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashPeople"}}class et extends Te{constructor(e){super(e),this.type="Cylinder"}}class tt extends Te{constructor(e){super(e),this.type="Decal"}toJSON(e=!0){if(this.animateJson){const{From:e,To:t}=this.animateJson;if(e&&e.scale){const{x:t,z:i}=e.scale;e.scale.x=i,e.scale.z=t}if(t&&t.scale){const{x:e,z:i}=t.scale;t.scale.x=i,t.scale.z=e}}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}: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 it extends Te{constructor(e){super(e),this.type="Plane"}}class st extends Te{constructor(e){super(e),this.type="QuadPyramid"}}class at extends Te{constructor(e){super(e),this.type="Sphere"}}class ot extends Te{constructor(e){super(e),this.type="TrafficCone"}}class nt extends Te{constructor(e){super(e),this.type="Circle"}}class rt extends Te{constructor(e){super(e),this.type="Torus"}}class lt extends Te{constructor(e){super(e),this.type="Tube"}}class ht extends Te{constructor(e){super(e),this.type="DiamondSign"}}class dt extends Te{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=a.clamp(e.duration||1,0,100),this.data=e.data;const t=e.particle||{};let i,s=t.bound||{x:100,y:100,z:0},o=t.scaleBoxXY||1,n=t.noiseStrength||0,r=t.grayPower||1,l=parseInt(t.countX,10)||400,h=parseInt(t.countY,10)||400;this.particleMaxHeight=t.maxHeight||0,"noiseMap"in t&&(this.noiseMap=i=t.noiseMap,ve(i)||be(i,(e=>{e&&(this.noiseMap=i=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 s},set:function(e){e&&"particle"===this.kind&&(s.x=e.x,s.y=e.y,s.z=e.z,this.matrixNeedsUpdate=!0)}},scaleBoxXY:{enumerable:!0,get:function(){return o},set:function(e){console.log(e,o,this.kind),e!==o&&"particle"===this.kind&&(o=e,this.matrixNeedsUpdate=!0)}},noiseStrength:{enumerable:!0,get:function(){return n},set:function(e){e!==n&&"particle"===this.kind&&(n=e,this.matrixNeedsUpdate=!0)}},grayPower:{configurable:!0,enumerable:!0,get:function(){return r},set:function(e){e!==r&&"particle"===this.kind&&(r=e,this.matrixNeedsUpdate=!0)}},countX:{configurable:!0,enumerable:!0,get:function(){return l},set:function(e){e!==l&&"particle"===this.kind&&(l=parseInt(e,10),this.matrixNeedsUpdate=!0)}},countY:{configurable:!0,enumerable:!0,get:function(){return h},set:function(e){e!==h&&"particle"===this.kind&&(h=parseInt(e,10),this.matrixNeedsUpdate=!0)}}})}init(){if("particle"===this.kind&&this.data.length<2)return void console.error("数据量过少,无法绘制粒子热力图");const i=function(e,t,i,s,a,o){if(!e||e.length<1)return!1;let n=1/0,r=-1/0,l={longitude:1/0,latitude:1/0},h={longitude:-1/0,latitude:-1/0};for(let a=0,o=e.length;a<o;a++){let o=s?e[a][s]:e[a].value;n=Math.min(o,n),r=Math.max(o,r),t&&(e[a].x=e[a][t]),i&&(e[a].y=e[a][i]),s&&(e[a].value=e[a][s]),e[a].longitude&&e[a].latitude&&(l.longitude=Math.min(l.longitude,e[a].longitude),l.latitude=Math.min(l.latitude,e[a].latitude),h.longitude=Math.max(h.longitude,e[a].longitude),h.latitude=Math.max(h.latitude,e[a].latitude))}if(e[0].longitude&&e[0].latitude){if(!e[0].hasOwnProperty("x")&&!e[0].hasOwnProperty("y"))for(let t=0,i=e.length;t<i;t++){const i=h.longitude-l.longitude,s=h.latitude-l.latitude;e[t].x=Math.round(a*(e[t].longitude-l.longitude)/i),e[t].y=Math.round(o*(e[t].latitude-l.latitude)/s)}return{min:n,max:r,bbox:{min:l,max:h}}}return{min:n,max:r}}(this.data,this.xName,this.yName,this.valueName,this.width,this.height);if(i&&(void 0===this.min&&(this.min=i.min),void 0===this.max&&(this.max=i.max),i.bbox)){if(!this.center){const 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}}if(!this.size&&"particle"!==this.kind){const 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}let s=this.data,a=this.max,o=this.min;if(this.heatmapInstance)this.heatmapInstance.configure(this.getConfig()),this.heatmapInstance.setData({max:a,min:o,data:s}),this.heatmapInstance.repaint();else{this.container||(this.container=ct(this.width,this.height));const e=function(e){if(!e)return!1;const t=e.container||ct(e);let i=x.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});return i}(this.getConfig());e&&(this.heatmapInstance=e,this.heatmapInstance.setData({max:a,min:o,data:s}))}this.canvas||(this.canvas=this.container.children[0]),this.texture=xe(this.canvas),this.materialNeedsUpdate=!0,this.center||(this.center=new t(0,0,10)),"particle"!==this.kind&&(this.size||(this.size=new e(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=a.clamp(e,.1,100)),this.init()}getGeojsonData(){if(this.container&&this.heatmapInstance){var e;const t=(this.maxHeight-this.minHeight)/(this.max-this.min),i=this.heatmapInstance._renderer._palette,s=[],a=this.size.x/this.width,o=this.size.y/this.height,n=1/256,r=null===(e=this.heatmapInstance)||void 0===e?void 0:e.getData().data;for(let e=0,l=r.length;e<l;e++){const 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)*t+this.minHeight,u=Math.floor((d-this.min)/(this.max-this.min)*252),p=r[e].radius,m={r:i[4*u]*n,g:i[4*u+1]*n,b:i[4*u+2]*n};if(c<1)continue;const g={type:"Feature",properties:{id:e,height:c,color:m,xSize:p,ySize:p},geometry:{type:"Point",coordinates:[a*(l-.5*this.width)/1e5,o*(h-.5*this.height)/1e5]}};s.push(g)}return s}return!1}toJSON(e=!0){if(e&&this.visibleNeedsUpdate&&(!this.visible||!this.materialNeedsUpdate))return{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};if("texture"===this.kind.toLowerCase())return{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};if("particle"===this.kind.toLowerCase())return{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};const t=this.getGeojsonData();return{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:t}}}function ct(e,t){const i=document.createElement("div");i.style.width=e?e+"px":"512px",i.style.height=t?t+"px":"512px",i.style.top="0px",i.style.display="none";return document.getElementsByTagName("body")[0].appendChild(i),i}class ut extends Te{constructor(e={}){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum,this.type="Particle";let t=e.kind||_.FIRE_SMALL,i=e.spawnRate||30,s=e.brightness||3,o=e.lifeTime||1;const n=new h(1,0,1);e.brightnessColor&&(n.r=a.clamp(e.brightnessColor.r,0,1),n.g=a.clamp(e.brightnessColor.g,0,1),n.b=a.clamp(e.brightnessColor.b,0,1));let r=e.speed||5,l=e.height||200,d=e.width||.01,c=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:()=>n,set:e=>{e&&(n.r=e.r,n.g=e.g,n.b=e.b,n.a=1,this.materialNeedsUpdate=!0)}},speed:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},height:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},width:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}},zVelocity:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{c=e,this.materialNeedsUpdate=!0}},lifeTime:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=ge(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 pt extends ne{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 ne,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 t,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 mt extends Ae{constructor(e={}){super(e),this.name=e.name||"",this.type="FastRoadCondition",this.colors=e.colors||{1:(new h).setStyle("#00ff00"),2:(new h).setStyle("#ffff00"),3:(new h).setStyle("#ff0000"),4:(new h).setStyle("#ff00ff")}}setData(e,t="condition"){this.data=me(e),this.data.forEach((e=>{const i=e.properties[t],s=this.colors[i]||this.colors[1];e.properties.color={r:s.r,g:s.g,b:s.b,a:s.a||1}}))}}class gt extends ne{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 s=e.coneColor||new h(1,1,1),a=e.groundColor||new h(1,1,1),n=e.fenceColor||new h(1,1,1);let r=e.brightness||0,l=e.roughness||1,d=e.metallic||0;this.coneMap=e.coneMap||null,this.groundMap=e.groundMap||null,this.fenceMap=e.fenceMap||null,this.fenceHeight=e.fenceHeight||1;let c=e.coneOpacity||s.a||1,u=e.groundOpacity||a.a||1,p=e.fenceOpacity||n.a||1;const m=e.bloomColor||null,g=e.position||new t,f=e.rotation||new o,y=new i,b=e.scale||new t(1,1,1),x=e.coneScale||new t(1,1,1),v=e.offset||new t(0,0,0);let S=!1;f._onChange((function(){y.setFromEuler(f,!1),this.matrixNeedsUpdate=!0})),y._onChange((function(){f.setFromQuaternion(y,void 0,!1),this.matrixNeedsUpdate=!0})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g.x=e.x,g.y=e.y,g.z=e.z,this.matrixNeedsUpdate=!0)}},rotation:{configurable:!0,enumerable:!0,value:f},quaternion:{configurable:!0,enumerable:!0,value:y},scale:{configurable:!0,enumerable:!0,get:()=>b,set:e=>{e&&(b.x=e.x,b.y=e.y,b.z=e.z,this.matrixNeedsUpdate=!0)}},coneScale:{configurable:!0,enumerable:!0,get:()=>x,set:e=>{e&&(x.x=e.x,x.y=e.y,x.z=e.z,this.matrixNeedsUpdate=!0)}},offset:{configurable:!0,enumerable:!0,get:()=>v,set:e=>{e&&(v.x=e.x,v.y=e.y,v.z=e.z,this.matrixNeedsUpdate=!0)}},coneColor:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.r=e.r,s.g=e.g,s.b=e.b,e.a&&(c=e.a),this.materialNeedsUpdate=!0)}},groundColor:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a.r=e.r,a.g=e.g,a.b=e.b,e.a&&(u=e.a),this.materialNeedsUpdate=!0)}},fenceColor:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n.r=e.r,n.g=e.g,n.b=e.b,e.a&&(p=e.a),this.materialNeedsUpdate=!0)}},coneOpacity:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{c=e,this.materialNeedsUpdate=!0}},groundOpacity:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{u=e,this.materialNeedsUpdate=!0}},fenceOpacity:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{p=e,this.materialNeedsUpdate=!0}},brightness:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{void 0!==e&&(r=e,this.materialNeedsUpdate=!0)}},roughness:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},metallic:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}},bloomColor:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e&&(m.copy(e),this.materialNeedsUpdate=!0)}},transparent:{configurable:!0,enumerable:!0,get:()=>S,set:e=>{S=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 Oe,this.add(this.ground),this.fence=new Ae,this.add(this.fence),this.cone=new ot,this.add(this.cone)}setData(e,t=!0){this.data=me(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 ft extends Te{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(e=!0){return!e||!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?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 yt extends ne{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 i=e.deviceAutoUpdate||!1,s=Math.max(1,e.deviceAutoUpdateInterval||2),a=void 0===e.renderNum?15:e.renderNum,o=void 0===e.searchMode?"coord":e.searchMode,n=void 0===e.tileLevel?16:e.tileLevel,r=void 0!==e.rtEnable&&e.rtEnable,l=e.rtUrl,h=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 t,Object.defineProperties(this,{deviceAutoUpdate:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.messageNeedsUpdate=!0)}},deviceAutoUpdateInterval:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=Math.max(e,2),this.messageNeedsUpdate=!0)}},renderNum:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.messageNeedsUpdate=!0)}},searchMode:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.messageNeedsUpdate=!0)}},tileLevel:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e,this.messageNeedsUpdate=!0)}},rtEnable:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.messageNeedsUpdate=!0}},rtUrl:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l=e,this.messageNeedsUpdate=!0)}},rtTilelLevel:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=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}},i=e.params;if(void 0!==i.opacity&&(i.color.a=i.opacity),i.color&&(t.config.material.Color={r:i.color.r,g:i.color.g,b:i.color.b,a:i.color.a||1}),i.brightnessColor&&(t.config.material.BrightnessColor={r:i.brightnessColor.r,g:i.brightnessColor.g,b:i.brightnessColor.b,a:1}),i.text){const e=Ce(i.text,i.textStyle);t.config.material.Texture=xe(e)}else i.map&&(ve(i.map)?t.config.material.Texture=i.map:be(i.map,(e=>{e&&(t.config.material.Texture=e)})));void 0!==i.metallic&&(t.config.material.Metallic=i.metallic),void 0!==i.roughness&&(t.config.material.Roughness=i.roughness),void 0!==i.brightness&&(t.config.material.Brightness=i.brightness),i.position&&(t.config.transform||(t.config.transform={}),t.config.transform.Location={x:i.position.x,y:i.position.y,z:i.position.z}),i.scale&&(t.config.transform||(t.config.transform={}),t.config.transform.Scale={x:i.scale.x,y:i.scale.y,z:i.scale.z}),i.rotation&&(t.config.transform||(t.config.transform={}),t.config.transform.Rotation={x:i.rotation.x,y:i.rotation.y,z:i.rotation.z}),void 0!==i.scroll&&(t.config.scroll=a.clamp(i.scroll,-1,1)),void 0!==i.speed&&(t.config.speed=i.speed),void 0!==i.animationIndex&&(t.config.animationIndex=i.animationIndex),void 0!==i.animationLoop&&(t.config.animationLoop=i.animationLoop),void 0!==i.animationSpeed&&(t.config.animationSpeed=i.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){const 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 bt extends Te{constructor(e={color:{r:0,g:1,b:0,a:1},brightness:1,speed:.2}){super(e),this.type="Radar"}}class xt extends Te{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:1,speed:2}){super(e),this.type="Ripple"}}class vt extends Te{constructor(e){super(e),this.type="Soil"}}class St extends Te{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 Nt extends Te{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 Ut extends Te{constructor(e){super(e),this.type="TriangleWarning"}}class wt extends Te{constructor(e){super(e),this.type="Bucket"}}class Ct extends Te{constructor(e){super(e),this.type="InundationAnalysis"}}class Tt extends Te{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 Ot extends Te{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 zt extends Te{constructor(e){super(e),this.type="CarPark";const i=e.position||new t;let s=e.rotation||new o;const n=e.scale||new t(1,1,1),r=e.color||{r:1,g:1,b:1,a:1};var l;Object.defineProperties(this,{position:{enumerable:!0,get:function(){return i},set:e=>{e&&(i.x=e.x,i.y=e.y,i.z=e.z,this.matrixNeedsUpdate=!0)}},rotation:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.x=a.clamp(e.x,-180,180),s.y=a.clamp(e.y,-180,180),s.z=a.clamp(e.z,-180,180),this.matrixNeedsUpdate=!0)}},scale:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n.x=e.x,n.y=e.y,n.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:()=>r,set:e=>{e&&(r.r=e.r,r.g=e.g,r.b=e.b,r.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=i,this.rotation=s,this.scale=n,this.modelType=(l=e.modelType,isNaN(l)||l<3||l>6&&l<12||l>16?3:l),this.speed=Number(e.speed)||36,this.endState=e.endState||!1,this.color=r,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}}}class Rt extends ne{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 i=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 t,Object.defineProperties(this,{brightness:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=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 Et extends Te{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};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;let i=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 It extends ne{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 i=e.url,s=e.header,a=void 0===e.labelRenderScale?1:e.labelRenderScale,o=void 0===e.labelRenderType?1:e.labelRenderType,n=void 0===e.labelBrightness?1:e.labelBrightness,r=void 0===e.followMode?"Third":e.followMode;this.followRotation=void 0===e.followRotation?{Roll:!1,Pitch:!1,Yaw:!0}:e.follow;let l=void 0===e.followZoom?0:e.followZoom,h=void 0!==e.switchScale&&e.switchScale,d=void 0===e.minViewPortHeight?30:e.minViewPortHeight,c=void 0===e.maxViewPortHeight?300:e.maxViewPortHeight,u=void 0===e.minScale?1:e.minScale,p=void 0===e.maxScale?2:e.maxScale,m=void 0===e.controlTypeList?[]:e.controlTypeList,g=void 0!==e.predictionEnable&&e.predictionEnable,f=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 t,Object.defineProperties(this,{url:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.messageNeedsUpdate=!0)}},header:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.messageNeedsUpdate=!0)}},labelRenderScale:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.materialNeedsUpdate=!0)}},labelBrightness:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e,this.materialNeedsUpdate=!0)}},predictionLineStyle:{configurable:!0,enumerable:!0,get:()=>f,set:e=>{e&&(f=e,this.materialNeedsUpdate=!0)}},labelRenderType:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.materialNeedsUpdate=!0)}},predictionEnable:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g=e,this.materialNeedsUpdate=!0)}},followMode:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e,this.followNeedsUpdate=!0)}},followZoom:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l=e,this.materialNeedsUpdate=!0)}},switchScale:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e,this.materialNeedsUpdate=!0)}},minViewPortHeight:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d=e,this.materialNeedsUpdate=!0)}},maxViewPortHeight:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{e&&(c=e,this.materialNeedsUpdate=!0)}},minScale:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{e&&(u=e,this.materialNeedsUpdate=!0)}},maxScale:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{e&&(p=e,this.materialNeedsUpdate=!0)}},controlTypeList:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{m=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 At extends Te{constructor(e){super(e),this.type="QuadPyramidTop"}}class Mt extends Te{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=ge(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:Ve(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 Dt extends Te{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 Lt extends Te{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 Pt=[{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 kt extends Te{constructor(e={}){super(e),this.type="SlopeAnalysis";let t=e.range||null,i=_t(e.minAngle,!0),s=_t(e.maxAngle,!1),a=Bt(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=_t(e,!0),this.materialNeedsUpdate=!0}},maxAngle:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=_t(e,!1),this.materialNeedsUpdate=!0}},colorRange:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=Bt(e),this.materialNeedsUpdate=!0}},useSlopeAnalysis:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,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 Bt(e){if(e&&e instanceof Object){let t=0,i=0;for(const s in e)i=s,t++;if(0===i)return{25:Pt[0],40:Pt[1],55:Pt[2],70:Pt[3],80:Pt[4],90:Pt[5]};for(let s=t;s<6;s++)i<25?(i=40,e[i]=Pt[1]):i<40.00001?(i=55,e[i]=Pt[2]):i<55.00001?(i=70,e[i]=Pt[3]):i<70.00001?(i=80,e[i]=Pt[4]):i<80.00001?(i=90,e[i]=Pt[5]):i<90.00001?(i=91,e[i]=Pt[5]):(i+=s,e[i]=Pt[5]);return e}return{25:Pt[0],40:Pt[1],55:Pt[2],70:Pt[3],80:Pt[4],90:Pt[5]}}function _t(e=0,t=!0){return t?e<=0?0:e:e<=0?90:e}class Ft extends Te{constructor(e={}){super(e),this.pointType="pointType"in e?e.pointType.toLowerCase():"iconpoint";const t=e.pointStyle||{};t.renderType=0,t.openCollision=!1,this.pointJSON=Wt(this.pointType,t),this.clusterStyle=e.clusterStyle||{};for(const e in this.clusterStyle){const t=this.clusterStyle[e];this.clusterStyle[e]=Wt(this.pointType,t)}let i=e.minPixelDistance||100;this.type="ClusterPoint",Object.defineProperties(this,{minPixelDistance:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{let t=Number(e);t&&i!==t&&(i=t,this.materialNeedsUpdate=!0)}}})}setData(e){this.data=ge(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 Wt(e,t){let i;switch(e){case"basiclabel":i=new qe(t).toJSON();case"iconpoint":i=new Je(t).toJSON();case"textpoint":i=new $e(t).toJSON();default:i=new Je(t).toJSON()}return t.clusterText&&(i.ClusterText=t.clusterText),i}class Ht extends ne{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.visible=void 0===e.visible||e.visible}}class jt extends Ht{constructor(e){super(e),this.type="UserInfoLightLayer";let i=e.url,s=e.header,a=void 0===e.brightness?1:e.brightness,o=void 0===e.lightAltitude?1:e.lightAltitude,n=void 0===e.renderScale?1:e.renderScale,r=void 0===e.renderTilesNum?3:e.renderTilesNum,l=void 0===e.updateCheckInterval?2:e.updateCheckInterval,h=void 0===e.maxUpdateHeight?1e3:e.maxUpdateHeight,d=void 0===e.centerDetectDistance?3e3:e.centerDetectDistance;this.guidingLine={enable:!0,color:{r:.171441,g:.223228,b:.376262}},e.guidingLine&&(this.guidingLine.enable=void 0===e.guidingLine.enable||e.guidingLine.enable,this.guidingLine.color=void 0===e.guidingLine.color?{r:.171441,g:.223228,b:.376262}:e.guidingLine.color),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 t,Object.defineProperties(this,{url:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},header:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},lightAltitude:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},renderScale:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},renderTilesNum:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},updateCheckInterval:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},centerDetectDistance:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}},brightness:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}},maxUpdateHeight:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=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,GuidingLine:this.guidingLine,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 Gt extends Ae{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 Vt extends Te{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=ge(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}}class Jt extends Ht{constructor(e={}){super(e),this.name=e.name||"",this.type="LargeRoadCondition",this.defaultColors={1:{r:.015625,g:0,b:0,a:1},2:{r:.043403,g:.001204,b:.001635,a:1},3:{r:.078125,g:.058385,b:0,a:1},4:{r:207e-6,g:.109375,b:0,a:1}};let i=e.roadGeoJsonUrl||"",s=e.roadConditionUrl||"",a=e.layerGroupName||"",o=void 0===e.heightOffset?.7:e.heightOffset,n=void 0===e.camFOV?90:e.camFOV,r=void 0===e.aspectRatio?1:e.aspectRatio,l=e.colors||this.defaultColors,h=this.validateColors(l)?l:this.defaultColors,d=this.getValidBrightnessList(e.brightnessList);this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.offset=new t,Object.defineProperties(this,{roadGeoJsonUrl:{enumerable:!0,get:function(){return i},set:function(e){e&&(i=e,this.materialNeedsUpdate=!0)}},roadConditionUrl:{enumerable:!0,get:function(){return s},set:function(e){e&&(s=e,this.materialNeedsUpdate=!0)}},layerGroupName:{enumerable:!0,get:function(){return a},set:function(e){e&&(a=e,this.materialNeedsUpdate=!0)}},heightOffset:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{void 0!==e&&(o=e,this.materialNeedsUpdate=!0)}},camFOV:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{void 0!==e&&(n=e,this.materialNeedsUpdate=!0)}},aspectRatio:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{void 0!==e&&(r=e,this.materialNeedsUpdate=!0)}},colors:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{void 0!==e&&(h=this.validateColors(e)?e:this.defaultColors,this.materialNeedsUpdate=!0)}},brightnessList:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{void 0!==e&&(d=this.getValidBrightnessList(e),this.materialNeedsUpdate=!0)}}})}getValidBrightnessList(e){return Array.isArray(e)&&4===e.length&&this.allElementsGreaterThanZero(e)?e:[15,15,15,15]}allElementsGreaterThanZero(e){return e.every((function(e){return"number"==typeof e&&e>=0}))}validateColors(e){if("object"!=typeof e||null===e)return console.error("Invalid color format: Colors should be a non-null object."),!1;for(const t in this.defaultColors)if(this.defaultColors.hasOwnProperty(t)){if(!e.hasOwnProperty(t))return console.error(`Missing color key: ${t}`),!1;const i=e[t];if(!this.isValidColorComponent(i))return console.error(`Invalid color components at key: ${t}`),!1}return!0}isValidColorComponent(e){if("object"!=typeof e||null===e)return!1;const{r:t,g:i,b:s,a:a}=e;return this.isNumberInRange(t)&&this.isNumberInRange(i)&&this.isNumberInRange(s)&&this.isNumberInRange(a)}isNumberInRange(e){return"number"==typeof e&&e>=0&&e<=1}dispose(){return!1}toJSON(e=!0){return{RoadGeoJsonUrl:this.roadGeoJsonUrl,LayerGroupName:this.layerGroupName,RoadConditionUrl:this.roadConditionUrl,HeightOffset:this.heightOffset,CamFOV:this.camFOV,AspectRatio:this.aspectRatio,Colors:this.colors,BrightnessList:this.brightnessList,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}}}const $t={version:"2.4.3",name:"CloudRenderEngine",author:["liran23"]};class Yt extends ne{constructor(e){super(e),this.type="IndoorMap",this.url=e.url,this.mpoi="",this.floor=999,this.floorList=[];let i=e.layeringHeight||500,s=e.layeringBaseHeight||300;this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.animateNeedsUpdate=!1,this.offset=new t,Object.defineProperties(this,{layeringHeight:{enumerable:!0,get:function(){return i},set:function(e){e!==i&&(i=e,this.materialNeedsUpdate=!0)}},layeringBaseHeight:{enumerable:!0,get:function(){return s},set:function(e){e!==s&&(s=e,this.materialNeedsUpdate=!0)}}})}dispose(){return!1}async getIndoorDataByCenter(e,t=500){const i=this._getBoundingBox(e,t);return await this._requestDataList(i.minLng,i.minLat,i.maxLng,i.maxLat)}async _requestDataList(e,t,i,s){var a,o;const n=`http://${this.url}/indoor/query/?minX=${e}&minY=${t}&maxX=${i}&maxY=${s}`,r=await b.get(n);var l;return 0!==(null==r||null===(a=r.data)||void 0===a?void 0:a.status)?(console.error((null==r||null===(l=r.data)||void 0===l?void 0:l.message)||"获取室内数据失败"),[]):null===(o=r.data)||void 0===o?void 0:o.indoor}_getBoundingBox(e,t=500){const i=t/111e3,s=t/(111320*Math.cos(e.lat*Math.PI/180));return{minLat:e.lat-i,maxLat:e.lat+i,minLng:e.lng-s,maxLng:e.lng+s}}openIndoor(e){console.log("params --\x3e ",e);const{mpoi:t="",floor:i=0,floorList:s=[],buildingCenter:a={}}=e;this.mpoi=t,this.floor=i,this.floorList=s,this.buildingCenter=a,this.materialNeedsUpdate=!0}closeIndoor(){this.mpoi="close",this.floor="",this.materialNeedsUpdate=!0}convertFloorString(e){if(e.startsWith("B"))return-parseInt(e.substring(1),10);if(e.startsWith("F"))return parseInt(e.substring(1),10);throw new Error("Invalid floor string")}convertFloorStringToArray(e){return e.split("|").map((e=>{if(e.startsWith("B"))return-parseInt(e.substring(1),10);if(e.startsWith("F"))return parseInt(e.substring(1),10);throw new Error("Invalid floor string")}))}hideBuildings(e){if(Array.isArray(e)){if((e=de(e)).sort(((e,t)=>e-t)),e.length===this.floorList.length)this.floor=999;else{let t=this.floorList.filter((t=>!e.includes(t)));this.floor=t[t.length-1]}this.eventName="Hide",this.floorNum=e,this.animateNeedsUpdate=!0}else console.error("hideBuildings numbers必须为数组")}showBuildings(e){Array.isArray(e)?((e=de(e)).sort(((e,t)=>e-t)),this.eventName="Show",this.floorNum=e,this.floor=e[e.length-1],this.animateNeedsUpdate=!0):console.error("showBuildings numbers必须为数组")}toJSON(e=!0){return{Url:this.url,Mpoi:this.mpoi,Floor:this.floor,LayeringHeight:this.layeringHeight,LayeringBaseHeight:this.layeringBaseHeight,BuildingCenter:this.buildingCenter,FloorNum:this.floorNum,FloorList:this.floorList,EventName:this.eventName,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,animateNeedsUpdate:this.animateNeedsUpdate,type:this.type,uuid:this.uuid}}}class qt extends Te{constructor(e={}){super(e),this.roadGeoJsonUrl=e.roadGeoJsonUrl,this.roadConditionUrl=e.roadConditionUrl;let t=void 0===e.cityList?[]:e.cityList,i=void 0===e.event?"":e.event,s=void 0===e.folderName?"RenderResult":e.folderName;Object.defineProperties(this,{cityList:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e)}},event:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.materialNeedsUpdate=!0)}},folderName:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e)}}}),this.type="EarthRoadCondition"}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},RoadConditionUrl:this.roadConditionUrl,RoadGeoJsonUrl:this.roadGeoJsonUrl,FolderName:this.folderName,CityList:this.cityList,Event:this.event,type:this.type,uuid:this.uuid,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 super.copy(e,t),this}}class Xt extends Te{constructor(e={}){super(e);let t=void 0===e.cityList?[]:e.cityList,i=void 0===e.event?"":e.event,s=void 0===e.folderName?"RenderResult":e.folderName,a=void 0===e.operateData?[]:e.operateData;Object.defineProperties(this,{operateData:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e)}},cityList:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e)}},event:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.materialNeedsUpdate=!0)}},folderName:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e)}}}),this.type="EarthCityRank"}changeCityColor(e){this.cityList=e,this.event="ColorChange"}renderResult(e,t){this.folderName=t,this.cityList=e,this.event="Render"}visAll(){this.operateData=[],this.event="VisAll"}previewAll(){this.operateData=[],this.event="Preview"}previewSingleCity(e,t){this.cityList=e;const i=this.cityList.map((e=>e.CityName)),s=i.indexOf(t);-1!==s?s!==i.length-1?(this.operateData=[t,i[s+1]],this.event="Preview"):console.warn("非法参数,最后一个城市不能预览"):console.warn("没有该城市数据")}focusCity(e){this.operateData=[e],this.event="Focus"}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},OperateData:this.operateData,FolderName:this.folderName,CityList:this.cityList,Opacity:this.opacity,Event:this.event,type:this.type,uuid:this.uuid,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 super.copy(e,t),this}}class Kt extends Te{constructor(e={}){super(e);let t=void 0===e.cityList?[]:e.cityList,i=void 0===e.event?"":e.event,s=void 0===e.folderName?"RenderResult":e.folderName,a=void 0===e.sceneBrightness?7:e.sceneBrightness,o=void 0===e.operateData?[]:e.operateData,n=void 0===e.brightness?0:e.brightness;Object.defineProperties(this,{sceneBrightness:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e)}},operateData:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e)}},brightness:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{void 0!==e&&(n=e)}},cityList:{configurable:!0,enumerable:!0,get:()=>t,set:e=>{e&&(t=e)}},event:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.materialNeedsUpdate=!0)}},folderName:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e)}}}),this.type="EarthCityHeatMap"}changeHeatmapCoefficient(e,t){this.cityList=e,this.operateData=[t],this.event="ChangeHeatmapCoefficient"}changeSceneBrightness(e){this.sceneBrightness=e,this.event="changeSceneBrightness"}changeBrightness(e){this.brightness=e,this.event="changeBrightness"}renderResult(e,t){this.folderName=t,this.cityList=e,this.event="Render"}visAll(){this.operateData=[],this.event="VisAll"}previewAll(){this.operateData=[],this.event="Preview"}previewSingleCity(e,t){this.cityList=e;const i=this.cityList.map((e=>e.CityName)),s=i.indexOf(t);-1!==s?s!==i.length-1?(this.operateData=[t,i[s+1]],this.event="Preview"):console.warn("非法参数,最后一个城市不能预览"):console.warn("没有该城市数据")}focusCity(e){this.operateData=[e],this.event="Focus"}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},Brightness:this.brightness,SceneBrightness:this.sceneBrightness,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},OperateData:this.operateData,FolderName:this.folderName,CityList:this.cityList,Opacity:this.opacity,Event:this.event,type:this.type,uuid:this.uuid,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 super.copy(e,t),this}}export{yt as AssetLayer,It as AutonomousVehicleLayer,qe as BasicLabel,wt as Bucket,zt as CarPark,nt as Circle,He as CloudRenderEngine,Ft as ClusterPoint,F as CommonConstant,Xe as Cone,gt as ConstructionLayer,De as Cube,et as Cylinder,tt as Decal,St as Diamond,ht as DiamondSign,Ke as FlashCar,Qe as FlashCarCrash,Ze as FlashPeople,dt as Heatmap,ft as I3DTileLayer,Je as IconPoint,Yt as IndoorMap,jt as InfoLightLayer,Ct as Inundation,Jt as LargeRoadCondition,Dt as LayerBuilding,Vt as Light,Ae as Line,Lt as MockCarStream,Ge as ODLine,ut as Particle,it as Plane,Me as Point,Oe as Polygon,st as QuadPyramid,At as QuadPyramidTop,bt as Radar,xt as Ripple,mt as RoadCondition,Et as RoadName,Gt as RoutePlan,Kt as SequencerEarthCityHeatmap,Xt as SequencerEarthCityRank,qt as SequencerEarthRoadCondition,Te as Shape,Tt as Skyline,kt as SlopeAnalysis,vt as Soil,at as Sphere,$e as TextPoint,rt as Torus,ot as TrafficCone,pt as TrafficLayer,Rt as TrafficLightLayer,Nt as TrafficShape,Ut as TriangleWarning,lt as Tube,W as UltralDynamicSky,$t as VersionInfo,Ot as VisualField,Mt as WebViewPoint,xe as convertCanvas2Base64,we as drawCanvas,Ce as drawTextToImage,be as loadImageAsBase64};
|
|
1
|
+
import{Vector2 as e,Vector3 as t,Quaternion as i,Matrix4 as s,MathUtils as a,Euler as o,Matrix3 as n,Layers as r,FileLoader as l,Color as h,Group as d,MeshBasicMaterial as c,PlaneBufferGeometry as u,Mesh as p,SpriteMaterial as m,Sprite as g}from"three";import f from"earcut";import*as y from"@tweenjs/tween.js";import b from"axios";import x from"@mars3d/heatmap.js";const v={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"},S={VOLUMETRIC_CLOUDS:"Volumetric Clouds",STATIC_CLOUDS:"Static Clouds",DYNAMIC_CLOUDS:"2D Dynamic Clouds",NO_CLOUDS:"No Clouds",VOLUMETRIC_AURORA:"Volumetric Aurora"},N={SKY_ATMOSPHERE:"Sky Atmosphere",SIMPLIFIED_COLOR:"Simplified Color"},U={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"},w={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"},C={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",SET_PLANE_POI_MODE:"Scene_setPlanePoiMode"},T={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"},O={ADD:"Gis_AddCommonGISLayer",REMOVE:"Gis_RemoveCommonGISLayer",DESTORY:"Gis_DestoryCommonGISLayer",DESTORY_ALL:"Gis_DestoryAllGenerationLayer",UPDATE:"Gis_UpdateCommonGISLayer",VISIBLE:"Gis_VisibleCommonGISLayer"},z={ENABLE_DRAW:"Gis_enableDraw",CLOSE_DRAW:"Gis_closeDraw",ENABLE_MEASURE:"Gis_enableMeasure",CLOSE_MEASURE:"Gis_closeMeasure",DESTORY_DRAW:"Gis_clearDraw",DESTORY_MEASURE:"Gis_clearMeasure"},R={SOLID:"solid",DASHED:"dashed",ARROW:"arrow",GRADIENT:"gradient"},E={CENTER:"Ground_Center",STAND:"Stand",SIDE:"Ground_Side",SIDE:"Cylinder"},I={LINEAR:"Linear",CURVE:"Curve",CONSTANT:"Constant"},M={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},A={LockedMouse:0,HoveringMouse:1},D={controlScheme:A.HoveringMouse,suppressBrowserKeys:!1,fakeMouseWithTouches:!1},P={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},L={MainButton:0,AuxiliaryButton:1,SecondaryButton:2,FourthButton:3,FifthButton:4},k={PrimaryButton:1,SecondaryButton:2,AuxiliaryButton:4,FourthButton:8,FifthButton:16},B={BackSpace:8,Shift:16,Control:17,Alt:18,RightShift:253,RightControl:254,RightAlt:255},_={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 F=Object.freeze({__proto__:null,ApplicationControl:T,CameraControl:w,ControlSchemeType:A,DrawAndMeasureControl:z,GisControl:O,InteractMOD:U,LineDirectionOptions:E,LineSplineTypeOptions:I,LineTypeOptions:R,MessageType:P,MouseButton:L,MouseButtonsMask:k,ParticleKind:_,SceneControl:C,SkyColorMode:N,SkyMode:S,SpecialKeyCodes:B,ToClientMessageType:M,UDS:v,WS_OPEN_STATE:1,inputOptions:D});class W{constructor(e,t={}){this.cloudRender=e,this.weather=t.weather||v.PARTLY_CLOUDY,this.hour=t.hour||8,this.minute=t.minute||10,this.weatherType=v,this.init()}changeWeather(e){if(!e)return;Object.values(v).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);const i=(this.hour<10?"0"+this.hour:""+this.hour)+(this.minute<10?"0"+this.minute:""+this.minute);this.cloudRender.emitUIInteraction({excuteName:"Scene_changeTime",params:{Time:i}})}setVolumeFog(e,t=1e3){const i=Math.max(Math.min(1e5,t),10);this.cloudRender.emitUIInteraction({excuteName:"Scene_setVolumenFog",params:{Enable:e,Distance:100*i}})}setAtmosphericFog(e=.0075){const t=Math.max(Math.min(1,e),0);this.cloudRender.emitUIInteraction({excuteName:"Scene_setBaseFog",params:{BaseFogDensity:t}})}setSkyMode(e){if(!e)return!1;if(Object.values(S).indexOf(e)<0)return!1;this.cloudRender.emitUIInteraction({excuteName:"Scene_setSkyMode",params:{SkyMode:e}})}setSkyColorMode(e){if(!e)return!1;if(Object.values(N).indexOf(e)<0)return!1;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 H=function(e){e=void 0!==e?e:{},this.forceTURN=e.forceTURN;let t=this;const i=new URLSearchParams(window.location.search);this.cfg=void 0!==e.peerConnectionOptions?e.peerConnectionOptions:{},this.cfg.sdpSemantics="unified-plan",this.cfg.offerExtmapAllowMixed=!1,i.has("ForceTURN")&&(this.forceTURN=i.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=i.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=i.has("useMic"),this.useMic||console.log("Microphone access is not enabled. Pass ?useMic in the url to enable it.");let s="localhost"===location.hostname||"127.0.0.1"===location.hostname,a="https:"===location.protocol;!this.useMic||s||a||(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=i.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 e=document.createElement("video");if(e.id="streamingVideo",e.playsInline=!0,e.disablepictureinpicture=!0,e.muted=t.startVideoMuted,e.addEventListener("loadedmetadata",(function(e){t.onVideoInitialised&&t.onVideoInitialised()}),!0),"requestVideoFrameCallback"in HTMLVideoElement.prototype){const i=(s,a)=>{if(a.receiveTime&&a.expectedDisplayTime){let e=a.presentationTime-a.receiveTime;t.aggregatedStats||(t.aggregatedStats={}),t.aggregatedStats.receiveToCompositeMs=e}e.requestVideoFrameCallback(i)};e.requestVideoFrameCallback(i)}return e},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,"|")},r=function(e){console.info("Browser ICE gathering |",e.srcElement.iceGatheringState,"|")},l=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){e.track.kind;for(const i of e.streams)t.availableVideoStreams.has(i.id)||t.availableVideoStreams.set(i.id,i);t.video.srcObject=e.streams[0],e.track.onunmute=()=>{t.video.srcObject=e.streams[0],t.onNewVideoTrack(e.streams)}}else h(e.streams[0])},h=function(e){if(t.video.srcObject!=e&&t.video.srcObject&&t.video.srcObject!==e){let i=document.createElement("Audio");if(i.srcObject=e,t.autoPlayAudio)i.play();else{let e=function(){i.play(),t.video.removeEventListener("click",e)};t.video.addEventListener("click",e)}console.log("Created new audio element to play seperate audio stream.")}},d=function(e){console.log("Data channel created for us by browser as we are a receiving peer."),t.dcClient=e.channel,c(t.dcClient)},c=function(e){try{return e.binaryType="arraybuffer",e.onopen=function(e){console.log("Data channel connected"),t.onDataChannelConnected&&t.onDataChannelConnected()},e.onclose=function(e){console.log("Data channel connected",e)},e.onmessage=function(e){if(t.onDataChannelMessage)if("string"==typeof e.data){const i=function(e){var t,i,s=new Array;t=e.length;for(var a=0;a<t;a++)(i=e.charCodeAt(a))>=65536&&i<=1114111?(s.push(i>>18&7|240),s.push(i>>12&63|128),s.push(i>>6&63|128),s.push(63&i|128)):i>=2048&&i<=65535?(s.push(i>>12&15|224),s.push(i>>6&63|128),s.push(63&i|128)):i>=128&&i<=2047?(s.push(i>>6&31|192),s.push(63&i|128)):s.push(255&i);return new Uint8Array(s).buffer}(e.data);t.onDataChannelMessage(i)}else t.onDataChannelMessage(e.data)},e.onerror=function(e){console.error("Data channel error",e)},e}catch(e){return console.warn("No data channel",e),null}},u=function(e){let i=e.candidate;i&&i.candidate&&(console.log("%c[Browser ICE candidate]","background: violet; color: black","| Type=",i.type,"| Protocol=",i.protocol,"| Address=",i.address,"| Port=",i.port,"|"),t.onWebRtcCandidate(i))},p=function(e){e.sdp=e.sdp.replace("useinbandfec=1","useinbandfec=1;stereo=1;sprop-maxcapturerate=48000")},m=function(e){e.onsignalingstatechange=o,e.oniceconnectionstatechange=n,e.onicegatheringstatechange=r,e.ontrack=l,e.onicecandidate=u,e.ondatachannel=d},g=async function(e){let i=e.getTransceivers().length>0;if(e.addTransceiver("video",{direction:"recvonly"}),t.useMic){let s=!!t.useMic&&{autoGainControl:!1,channelCount:1,echoCancellation:!1,latency:0,noiseSuppression:!1,sampleRate:48e3,volume:1};const a=await navigator.mediaDevices.getUserMedia({video:!1,audio:s});if(a)if(i){for(let t of e.getTransceivers())if(t&&t.receiver&&t.receiver.track&&"audio"===t.receiver.track.kind)for(const e of a.getTracks())e.kind&&"audio"==e.kind&&(t.sender.replaceTrack(e),t.direction="sendrecv")}else for(const t of a.getTracks())t.kind&&"audio"==t.kind&&e.addTransceiver(t,{direction:"sendrecv"});else e.addTransceiver("audio",{direction:"recvonly"})}else e.addTransceiver("audio",{direction:"recvonly"})};this.setVideoEnabled=function(e){t.video.srcObject.getTracks().forEach((t=>t.enabled=e))},this.startLatencyTest=function(e){t.video&&(t.latencyTestTimings.Reset(),t.latencyTestTimings.TestStartTimeMs=Date.now(),e(t.latencyTestTimings.TestStartTimeMs))},this.handleCandidateFromServer=function(e){let i=new RTCIceCandidate(e);console.log("%c[Unreal ICE candidate]","background: pink; color: black","| Type=",i.type,"| Protocol=",i.protocol,"| Address=",i.address,"| Port=",i.port,"|"),t.forceTURN&&i.candidate.indexOf("relay")<0?console.warn("Dropping candidate because it was not TURN relay.","| Type=",i.type,"| Protocol=",i.protocol,"| Address=",i.address,"| Port=",i.port,"|"):t.pcClient.addIceCandidate(i).catch((function(e){console.error("Failed to add ICE candidate",e)}))},this.createOffer=function(){t.pcClient&&(console.log("Closing existing PeerConnection"),t.pcClient.close(),t.pcClient=null),t.pcClient=new RTCPeerConnection(t.cfg),m(t.pcClient),g(t.pcClient).finally((function(){var e;t.dcClient=function(e,t,i){let s=e.createDataChannel(t,i);return console.log(`Created datachannel (${t})`),c(s),s}(t.pcClient,"cirrus",t.dataChannelOptions),(e=t.pcClient).createOffer(t.sdpConstraints).then((function(i){p(i),e.setLocalDescription(i),t.onWebRtcOffer&&t.onWebRtcOffer(i)}),(function(){console.warn("Couldn't create offer")}))}))},this.receiveOffer=function(e){let i=new RTCSessionDescription(e);t.pcClient||(console.log("Creating a new PeerConnection in the browser.",t.cfg),t.pcClient=new RTCPeerConnection(t.cfg),m(t.pcClient),t.pcClient.setRemoteDescription(i).then((()=>{g(t.pcClient).finally((function(){t.pcClient.createAnswer().then((e=>t.pcClient.setLocalDescription(e))).then((()=>{t.onWebRtcAnswer&&t.onWebRtcAnswer(t.pcClient.currentLocalDescription)})).then((()=>{let e=t.pcClient.getReceivers();for(let t of e)t.playoutDelayHint=0})).catch((e=>console.error("createAnswer() failed:",e)))}))})))},this.receiveAnswer=function(e){let i=new RTCSessionDescription(e);t.pcClient.setRemoteDescription(i);let s=t.pcClient.getReceivers();for(let e of s)e.playoutDelayHint=0},this.close=function(){t.pcClient&&(console.log("Closing existing peerClient"),t.pcClient.close(),t.pcClient=null),t.aggregateStatsIntervalId&&clearInterval(t.aggregateStatsIntervalId)},this.send=function(e){if(t.dcClient&&"open"==t.dcClient.readyState)try{t.dcClient.send(e)}catch(e){console.error("dcClient.send error: ",e)}},this.getStats=function(e){t.pcClient&&e&&t.pcClient.getStats(null).then((t=>{e(t)}))},this.aggregateStats=function(e){let i=(t.aggregatedStats||(t.aggregatedStats={}),function(e){let i={};e.forEach((e=>{"inbound-rtp"!=e.type||e.isRemote||"video"!=e.mediaType&&!e.id.toLowerCase().includes("video")||(i.timestamp=e.timestamp,i.bytesReceived=e.bytesReceived,i.framesDecoded=e.framesDecoded,i.packetsLost=e.packetsLost,i.bytesReceivedStart=t.aggregatedStats&&t.aggregatedStats.bytesReceivedStart?t.aggregatedStats.bytesReceivedStart:e.bytesReceived,i.framesDecodedStart=t.aggregatedStats&&t.aggregatedStats.framesDecodedStart?t.aggregatedStats.framesDecodedStart:e.framesDecoded,i.timestampStart=t.aggregatedStats&&t.aggregatedStats.timestampStart?t.aggregatedStats.timestampStart:e.timestamp,t.aggregatedStats&&t.aggregatedStats.timestamp&&(t.aggregatedStats.bytesReceived&&(i.bitrate=8*(i.bytesReceived-t.aggregatedStats.bytesReceived)/(i.timestamp-t.aggregatedStats.timestamp),i.bitrate=Math.floor(i.bitrate),i.lowBitrate=t.aggregatedStats.lowBitrate&&t.aggregatedStats.lowBitrate<i.bitrate?t.aggregatedStats.lowBitrate:i.bitrate,i.highBitrate=t.aggregatedStats.highBitrate&&t.aggregatedStats.highBitrate>i.bitrate?t.aggregatedStats.highBitrate:i.bitrate),t.aggregatedStats.bytesReceivedStart&&(i.avgBitrate=8*(i.bytesReceived-t.aggregatedStats.bytesReceivedStart)/(i.timestamp-t.aggregatedStats.timestampStart),i.avgBitrate=Math.floor(i.avgBitrate)),t.aggregatedStats.framesDecoded&&(i.framerate=(i.framesDecoded-t.aggregatedStats.framesDecoded)/((i.timestamp-t.aggregatedStats.timestamp)/1e3),i.framerate=Math.floor(i.framerate),i.lowFramerate=t.aggregatedStats.lowFramerate&&t.aggregatedStats.lowFramerate<i.framerate?t.aggregatedStats.lowFramerate:i.framerate,i.highFramerate=t.aggregatedStats.highFramerate&&t.aggregatedStats.highFramerate>i.framerate?t.aggregatedStats.highFramerate:i.framerate),t.aggregatedStats.framesDecodedStart&&(i.avgframerate=(i.framesDecoded-t.aggregatedStats.framesDecodedStart)/((i.timestamp-t.aggregatedStats.timestampStart)/1e3),i.avgframerate=Math.floor(i.avgframerate)))),"track"!=e.type||"video_label"!=e.trackIdentifier&&"video"!=e.kind||(i.framesDropped=e.framesDropped,i.framesReceived=e.framesReceived,i.framesDroppedPercentage=e.framesDropped/e.framesReceived*100,i.frameHeight=e.frameHeight,i.frameWidth=e.frameWidth,i.frameHeightStart=t.aggregatedStats&&t.aggregatedStats.frameHeightStart?t.aggregatedStats.frameHeightStart:e.frameHeight,i.frameWidthStart=t.aggregatedStats&&t.aggregatedStats.frameWidthStart?t.aggregatedStats.frameWidthStart:e.frameWidth),"candidate-pair"==e.type&&e.hasOwnProperty("currentRoundTripTime")&&0!=e.currentRoundTripTime&&(i.currentRoundTripTime=e.currentRoundTripTime)})),t.aggregatedStats.receiveToCompositeMs&&(i.receiveToCompositeMs=t.aggregatedStats.receiveToCompositeMs,t.latencyTestTimings.SetFrameDisplayDeltaTime(t.aggregatedStats.receiveToCompositeMs)),t.aggregatedStats=i,t.onAggregatedStats&&t.onAggregatedStats(i)});t.aggregateStatsIntervalId=setInterval((()=>{t.getStats(i)}),e)}};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if("undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===i&&s.firstChild?s.insertBefore(a,s.firstChild):s.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}("/* 视频流送的视频组件样式 */\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}");class G{addEventListener(e,t){void 0===this._listeners&&(this._listeners={}),this._needsDispatchedToUE=!1;const 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){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;this._needsDispatchedToUE=!1;const i=this._listeners[e];if(void 0!==i){const s=i.indexOf(t);-1!==s&&(i.splice(s,1),this._needsDispatchedToUE=!0,this._dispatchRemoveListenerTypes||(this._dispatchRemoveListenerTypes=[]),this._dispatchRemoveListenerTypes.push(e))}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const i=t.slice(0);for(let t=0,s=i.length;t<s;t++)e.index=t,i[t].call(this,e);e.target=null}}}class V extends G{constructor(t){super(),this.haveEvents="GamepadEvent"in window,this.haveWebkitEvents="WebKitGamepadEvent"in window,this.cloudRenderEngine=t,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 e(0,0),this.selection=[],this.logMessages=!1,this.inputOptions=t.inputOptions,this.playerElement&&(this.playerElement.tabIndex<10&&(this.playerElement.tabIndex=1e3),this.playerElement.addEventListener("contextmenu",(e=>{e.preventDefault()}),!1))}updateObjectsWithEvent(){const e=new Map;this.scene&&this.scene.children.length&&this.scene.children.forEach(((t,i)=>{t._listeners&&e.set(t.uuid,t)})),this.interactiveObjects.clear(),this.interactiveObjects=e}isKeyCodeBrowserKey(e){return e>=112&&e<=123||9===e}getKeyCode(e){return e.keyCode===B.Shift&&"ShiftRight"===e.code?B.RightShift:e.keyCode===B.Control&&"ControlRight"===e.code?B.RightControl:e.keyCode===B.Alt&&"AltRight"===e.code?B.RightAlt:e.keyCode}registerKeyboardEvents(){const e=this;document.onkeydown=function(t){e.print_inputs&&console.log(`key down ${t.keyCode}, repeat = ${t.repeat}`),e.cloudRenderEngine.sendInputData(new Uint8Array([P.KeyDown,e.getKeyCode(t),t.repeat]).buffer),t.keyCode===B.BackSpace&&document.onkeypress({charCode:B.BackSpace}),e.inputOptions.suppressBrowserKeys&&e.isKeyCodeBrowserKey(t.keyCode)&&t.preventDefault()},document.onkeyup=function(t){e.print_inputs&&console.log(`key up ${t.keyCode}`),e.cloudRenderEngine.sendInputData(new Uint8Array([P.KeyUp,e.getKeyCode(t)]).buffer),e.inputOptions.suppressBrowserKeys&&e.isKeyCodeBrowserKey(t.keyCode)&&t.preventDefault()},document.onkeypress=function(t){e.print_inputs&&console.log(`key press ${t.charCode}`);let i=new DataView(new ArrayBuffer(3));i.setUint8(0,P.KeyPress),i.setUint16(1,t.charCode,!0),e.cloudRenderEngine.sendInputData(i.buffer)}}resizePlayerStyleToFillWindow(e){let t=e.getElementsByTagName("VIDEO"),i=window.innerHeight/window.innerWidth,s=e.clientHeight/e.clientWidth,a=t.videoHeight/t.videoWidth;isNaN(a)?(this.styleWidth=window.innerWidth,this.styleHeight=window.innerHeight,this.styleTop=0,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):i<s?(this.styleWidth=Math.floor(window.innerHeight/a),this.styleHeight=window.innerHeight,this.styleTop=0,this.styleLeft=Math.floor(.5*(window.innerWidth-this.styleWidth)),e.style="top: "+this.styleTop+"px; left: "+this.styleLeft+"px; width: "+this.styleWidth+"px; height: "+this.styleHeight+"px; cursor: "+this.styleCursor+"; "+this.styleAdditional):(this.styleWidth=window.innerWidth,this.styleHeight=Math.floor(window.innerWidth*a),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){let t=e.getElementsByTagName("VIDEO");if(t.length>0){this.styleWidth=t[0].videoWidth,this.styleHeight=t[0].videoHeight;let i=Math.floor(.5*(window.innerHeight-this.styleHeight)),s=Math.floor(.5*(window.innerWidth-this.styleWidth));this.styleTop=i>0?i:0,this.styleLeft=s>0?s: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";let 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,a=document.getElementById("enlarge-display-to-fill-window-tgl"),o=document.getElementById("player");if(null!==a&&a.checked){let a=window.innerWidth/window.innerHeight;let o=this.cloudRenderEngine.freezeFrame.width/this.cloudRenderEngine.freezeFrame.height;a<o?(e=window.innerWidth,t=Math.floor(window.innerWidth/o),i=Math.floor(.5*(window.innerHeight-t)),s=0):(e=Math.floor(window.innerHeight*o),t=window.innerHeight,i=0,s=Math.floor(.5*(window.innerWidth-e)))}else{let a=o.offsetWidth/o.offsetHeight;let n=this.cloudRenderEngine.freezeFrame.width/this.cloudRenderEngine.freezeFrame.height;a<n?(e=o.offsetWidth,t=Math.floor(o.offsetWidth/n),i=Math.floor(.5*(o.offsetHeight-t)),s=0):(e=Math.floor(o.offsetHeight*n),t=o.offsetHeight,i=0,s=Math.floor(.5*(o.offsetWidth-e)))}let n=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",n.style.width=e+"px",n.style.height=t+"px",n.style.left=s+"px",n.style.top=i+"px"}}resizePlayerStyle(e){let t=document.getElementById("player");if(!t)return;if(this.cloudRenderEngine.updateVideoStreamSize(),t.classList.contains("fixed-size"))return void this.setupMouseAndFreezeFrame(t);let i=document.getElementById("enlarge-display-to-fill-window-tgl"),s=window.innerWidth<t.videoWidth||window.innerHeight<t.videoHeight;null!==i?i.checked||s?this.resizePlayerStyleToFillWindow(t):this.resizePlayerStyleToActualSize(t):this.resizePlayerStyleToArbitrarySize(t),this.setupMouseAndFreezeFrame(t)}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 e=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)}));let t=document.getElementById("enlarge-display-to-fill-window-tgl");null!==t&&(t.onchange=function(t){e.resizePlayerStyle()}),this.cloudRenderEngine.qualityControlOwnershipCheckBox=document.getElementById("quality-control-ownership-tgl"),null!==this.cloudRenderEngine.qualityControlOwnershipCheckBox&&(this.cloudRenderEngine.qualityControlOwnershipCheckBox.onchange=function(t){e.cloudRenderEngine.requestQualityControl()});let i=document.getElementById("encoder-params-submit");null!==i&&(i.onclick=function(t){let i=document.getElementById("encoder-min-qp-text").value,s=document.getElementById("encoder-max-qp-text").value;e.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.Encoder.MinQP "+i}),e.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.Encoder.MaxQP "+s})});let s=document.getElementById("webrtc-params-submit");null!==s&&(s.onclick=function(t){let i=document.getElementById("webrtc-fps-text").value,s=1e3*document.getElementById("webrtc-min-bitrate-text").value,a=1e3*document.getElementById("webrtc-max-bitrate-text").value;e.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.Fps "+i}),e.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.MinBitrate "+s}),e.cloudRenderEngine.emitCommand({ConsoleCommand:"PixelStreaming.WebRTC.MaxBitrate "+a})});let a=document.getElementById("show-fps-button");null!==a&&(a.onclick=function(t){e.cloudRenderEngine.emitCommand({ConsoleCommand:"Stat FPS"})});let o=document.getElementById("match-viewport-res-tgl");null!==o&&(o.onchange=function(t){e.cloudRenderEngine.matchViewportResolution=o.checked});let n=document.getElementById("show-stats-tgl");null!==n&&(n.onchange=function(e){document.getElementById("statsContainer").style.display=e.target.checked?"block":"none"});let r=document.getElementById("test-latency-button");r&&(r.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 l=document.getElementById("stream-select"),h=document.getElementById("track-select");l&&(l.onchange=function(t){const i=e.cloudRenderEngine.webRtcPlayerObj.availableVideoStreams.get(l.value);e.cloudRenderEngine.webRtcPlayerObj.video.srcObject=i,e.cloudRenderEngine.streamTrackSource=i,e.cloudRenderEngine.webRtcPlayerObj.video.play(),e.cloudRenderEngine.updateTrackList()},h&&(h.onchange=function(t){if(e.cloudRenderEngine.streamTrackSource||(e.cloudRenderEngine.streamTrackSource=e.cloudRenderEngine.webRtcPlayerObj.availableVideoStreams.get(l.value)),e.cloudRenderEngine.streamTrackSource)for(const t of e.cloudRenderEngine.streamTrackSource.getVideoTracks())if(t.id===h.value){e.cloudRenderEngine.webRtcPlayerObj.video.srcObject=new MediaStream([t]),e.cloudRenderEngine.webRtcPlayerObj.video.play(),l.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}`);let a=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(e,t),o=this.cloudRenderEngine.normalizeAndQuantizeSigned(i,s),n=new DataView(new ArrayBuffer(9));n.setUint8(0,P.MouseMove),n.setUint16(1,a.x,!0),n.setUint16(3,a.y,!0),n.setInt16(5,o.x,!0),n.setInt16(7,o.y,!0),this.cloudRenderEngine.sendInputData(n.buffer)}emitMouseDown(e,t,i){this.print_inputs&&console.log(`mouse button ${e} down at (${t}, ${i})`);let s=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),a=new DataView(new ArrayBuffer(6));a.setUint8(0,P.MouseDown),a.setUint8(1,e),a.setUint16(2,s.x,!0),a.setUint16(4,s.y,!0),this.cloudRenderEngine.sendInputData(a.buffer)}emitMouseUp(e,t,i){this.print_inputs&&console.log(`mouse button ${e} up at (${t}, ${i})`);let s=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),a=new DataView(new ArrayBuffer(6));a.setUint8(0,P.MouseUp),a.setUint8(1,e),a.setUint16(2,s.x,!0),a.setUint16(4,s.y,!0),this.cloudRenderEngine.sendInputData(a.buffer)}emitMouseWheel(e,t,i){this.print_inputs&&console.log(`mouse wheel with delta ${e} at (${t}, ${i})`);let s=this.cloudRenderEngine.normalizeAndQuantizeUnsigned(t,i),a=new DataView(new ArrayBuffer(7));a.setUint8(0,P.MouseWheel),a.setInt16(1,e,!0),a.setUint16(3,s.x,!0),a.setUint16(5,s.y,!0),this.cloudRenderEngine.sendInputData(a.buffer)}releaseMouseButtons(e,t,i){e&k.PrimaryButton&&this.emitMouseUp(L.MainButton,t,i),e&k.SecondaryButton&&this.emitMouseUp(L.SecondaryButton,t,i),e&k.AuxiliaryButton&&this.emitMouseUp(L.AuxiliaryButton,t,i),e&k.FourthButton&&this.emitMouseUp(L.FourthButton,t,i),e&k.FifthButton&&this.emitMouseUp(L.FifthButton,t,i)}pressMouseButtons(e,t,i){e&k.PrimaryButton&&this.emitMouseDown(L.MainButton,t,i),e&k.SecondaryButton&&this.emitMouseDown(L.SecondaryButton,t,i),e&k.AuxiliaryButton&&this.emitMouseDown(L.AuxiliaryButton,t,i),e&k.FourthButton&&this.emitMouseDown(L.FourthButton,t,i),e&k.FifthButton&&this.emitMouseDown(L.FifthButton,t,i)}registerInputs(e){e&&(this.registerMouseEnterAndLeaveEvents(e),this.registerTouchEvents(e))}registerMouseEnterAndLeaveEvents(e){const t=this;e.onmouseenter=function(i){t.print_inputs&&console.log("mouse enter");let s=new DataView(new ArrayBuffer(1));s.setUint8(0,P.MouseEnter),t.cloudRenderEngine.sendInputData(s.buffer),e.pressMouseButtons(i)},e.onmouseleave=function(i){t.print_inputs&&console.log("mouse leave");let s=new DataView(new ArrayBuffer(1));s.setUint8(0,P.MouseLeave),t.cloudRenderEngine.sendInputData(s.buffer),e.releaseMouseButtons(i)}}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(e){const t=this;let i=[9,8,7,6,5,4,3,2,1,0],s={};function a(e){let t=i.pop();void 0===t&&console.log("exhausted touch indentifiers"),s[e.identifier]=t}function o(i,a){let o=new DataView(new ArrayBuffer(2+7*a.length));o.setUint8(0,i),o.setUint8(1,a.length);let n=2;for(let i=0;i<a.length;i++){let r=a[i],l=r.clientX-e.offsetLeft,h=r.clientY-e.offsetTop;t.print_inputs&&console.log(`F${s[r.identifier]}=(${l}, ${h})`);let d=t.cloudRenderEngine.normalizeAndQuantizeUnsigned(l,h);o.setUint16(n,d.x,!0),n+=2,o.setUint16(n,d.y,!0),n+=2,o.setUint8(n,s[r.identifier],!0),n+=1,o.setUint8(n,255*r.force,!0),n+=1,o.setUint8(n,d.inRange?1:0,!0),n+=1}t.cloudRenderEngine.sendInputData(o.buffer)}if(this.inputOptions.fakeMouseWithTouches){let i;e.ontouchstart=function(s){if(void 0===i){let a=s.changedTouches[0];i={id:a.identifier,x:a.clientX-t.playerElementClientRect.left,y:a.clientY-t.playerElementClientRect.top},e.onmouseenter(s),t.emitMouseDown(L.MainButton,i.x,i.y)}s.preventDefault()},e.ontouchend=function(s){for(let a=0;a<s.changedTouches.length;a++){let o=s.changedTouches[a];if(o.identifier===i.id){let a=o.clientX-t.playerElementClientRect.left,n=o.clientY-t.playerElementClientRect.top;t.emitMouseUp(L.MainButton,a,n),e.onmouseleave(s),i=void 0;break}}s.preventDefault()},e.ontouchmove=function(e){for(let s=0;s<e.touches.length;s++){let a=e.touches[s];if(a.identifier===i.id){let e=a.clientX-t.playerElementClientRect.left,s=a.clientY-t.playerElementClientRect.top;t.emitMouseMove(e,s,e-i.x,s-i.y),i.x=e,i.y=s;break}}e.preventDefault()}}else e.ontouchstart=function(e){for(let t=0;t<e.changedTouches.length;t++)a(e.changedTouches[t]);t.print_inputs&&console.log("touch start"),o(P.TouchStart,e.changedTouches),e.preventDefault()},e.ontouchend=function(e){t.print_inputs&&console.log("touch end"),o(P.TouchEnd,e.changedTouches);for(let t=0;t<e.changedTouches.length;t++)a=e.changedTouches[t],i.push(s[a.identifier]),delete s[a.identifier];var a;e.preventDefault()},e.ontouchmove=function(e){t.print_inputs&&console.log("touch move"),o(P.TouchMove,e.touches),e.preventDefault()}}callRespone(e){const{uuid:t,classType:i}=e;if(this.interactiveObjects.has(t)){this.interactiveObjects.get(t).dispatchEvent(e)}else"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 J=0;const Y=new t,q=new i,X=new s,K=new t,Q=new t,Z=new t,ee=new i,te=new t(1,0,0),ie=new t(0,1,0),se=new t(0,0,1),ae={type:"added"},oe={type:"removed"};class ne extends G{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:J++}),this.uuid=a.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ne.DEFAULT_UP.clone();const e=new t,l=new o,h=new i,d=new t(1,1,1);l._onChange((function(){h.setFromEuler(l,!1)})),h._onChange((function(){l.setFromQuaternion(h,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:l},quaternion:{configurable:!0,enumerable:!0,value:h},scale:{configurable:!0,enumerable:!0,value:d},modelViewMatrix:{value:new s},normalMatrix:{value:new n}}),this.matrix=new s,this.matrixWorld=new s,this.matrixAutoUpdate=ne.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=ne.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new r,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 q.setFromAxisAngle(e,t),this.quaternion.multiply(q),this}rotateOnWorldAxis(e,t){return q.setFromAxisAngle(e,t),this.quaternion.premultiply(q),this}rotateX(e){return this.rotateOnAxis(te,e)}rotateY(e){return this.rotateOnAxis(ie,e)}rotateZ(e){return this.rotateOnAxis(se,e)}translateOnAxis(e,t){return Y.copy(e).applyQuaternion(this.quaternion),this.position.add(Y.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(te,e)}translateY(e){return this.translateOnAxis(ie,e)}translateZ(e){return this.translateOnAxis(se,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(X.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?K.copy(e):K.set(e,t,i);const s=this.parent;this.updateWorldMatrix(!0,!1),Q.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?X.lookAt(Q,K,this.up):X.lookAt(K,Q,this.up),this.quaternion.setFromRotationMatrix(X),s&&(X.extractRotation(s.matrixWorld),q.setFromRotationMatrix(X),this.quaternion.premultiply(q.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(ae)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(oe)),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(oe)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),X.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),X.multiply(e.parent.matrixWorld)),e.applyMatrix4(X),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,s=this.children.length;i<s;i++){const s=this.children[i].getObjectByProperty(e,t);if(void 0!==s)return s}}getObjectsByProperty(e,t){let i=[];this[e]===t&&i.push(this);for(let s=0,a=this.children.length;s<a;s++){const a=this.children[s].getObjectsByProperty(e,t);a.length>0&&(i=i.concat(a))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Q,e,Z),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Q,ee,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let i=0,s=t.length;i<s;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,s=t.length;i<s;i++){const s=t[i];!0!==s.matrixWorldAutoUpdate&&!0!==e||s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const 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){const e=this.children;for(let t=0,i=e.length;t<i;t++){const i=e[t];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const s={};function a(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),!0===this.castShadow&&(s.castShadow=!0),!0===this.receiveShadow&&(s.receiveShadow=!0),!1===this.visible&&(s.visible=!1),!1===this.frustumCulled&&(s.frustumCulled=!1),0!==this.renderOrder&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=a(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const i=t.shapes;if(Array.isArray(i))for(let t=0,s=i.length;t<s;t++){const s=i[t];a(e.shapes,s)}else a(e.shapes,i)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(a(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let i=0,s=this.material.length;i<s;i++)t.push(a(e.materials,this.material[i]));s.material=t}else s.material=a(e.materials,this.material);if(this.children.length>0){s.children=[];for(let t=0;t<this.children.length;t++)s.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let t=0;t<this.animations.length;t++){const i=this.animations[t];s.animations.push(a(e.animations,i))}}if(t){const t=o(e.geometries),s=o(e.materials),a=o(e.textures),n=o(e.images),r=o(e.shapes),l=o(e.skeletons),h=o(e.animations),d=o(e.nodes);t.length>0&&(i.geometries=t),s.length>0&&(i.materials=s),a.length>0&&(i.textures=a),n.length>0&&(i.images=n),r.length>0&&(i.shapes=r),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),d.length>0&&(i.nodes=d)}return i.object=s,i;function o(e){const t=[];for(const i in e){const s=e[i];delete s.metadata,t.push(s)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const i=e.children[t];this.add(i.clone())}return this}}ne.DEFAULT_UP=new t(0,1,0),ne.DEFAULT_MATRIX_AUTO_UPDATE=!0,ne.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class re extends ne{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){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.backgroundIntensity=this.backgroundIntensity),t}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 le extends ne{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new s,this._level=0,this._levelChange=0,this.projectionMatrix=new s,this.projectionMatrixInverse=new s;let e=new t,i=-9999,a=-9999,o=-9999,n=-180,r=180,l=-89,h=0,d=-9999,c=-9999;this.needsUpdate=!1,this.worldLocation=new t,this.sphereLocation=new t,this.constrainPolygon=[],Object.defineProperties(this,{minLocation:{configurable:!0,enumerable:!0,get:()=>e,set:t=>{t&&(e.x=t.x,e.y=t.y,e.z=t.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:()=>a,set:e=>{e&&(a=e,this.needsUpdate=!0)}},maxLocationZ:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.needsUpdate=!0)}},minYaw:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{void 0!==e&&(n=e,this.needsUpdate=!0)}},maxYaw:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{void 0!==e&&(r=e,this.needsUpdate=!0)}},minPitch:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{void 0!==e&&(l=e,this.needsUpdate=!0)}},maxPitch:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{void 0!==e&&(h=e,this.needsUpdate=!0)}},minSpringArm:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{void 0!==e&&(d=e,this.needsUpdate=!0)}},maxSpringArm:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{void 0!==e&&(c=e,this.needsUpdate=!0)}},name:{configurable:!1,enumerable:!0,value:name}})}get level(){return this._level}set level(e){const t=Math.floor(e);this._levelChange=this._level-t,this._level=t}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);const 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&&e.length>2&&(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&&t.length>2&&(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 he=function(e){return e.flat(1/0)},de=function(e){if(!Array.isArray(e))throw new Error("Input must be an array");return e.map((e=>parseInt(e,10)))};function ce(e){if(!e)return[];let t=null;return t=e.features?e.features:Array.isArray(e)?e:[e],JSON.parse(JSON.stringify(t))}function pe(e){const t=[];let i=null,s=null;return ce(e).forEach((e=>{var a,o;fe(null==e||null===(a=e.geometry)||void 0===a?void 0:a.coordinates,2),i=f.flatten(null==e||null===(o=e.geometry)||void 0===o?void 0:o.coordinates),s=f(i.vertices,i.holes,i.dimensions);const n=function(e){let t=1/0,i=1/0,s=-1/0,a=-1/0;const o=[];for(let o=0;o<e.length/3;o++){let n=e[3*o],r=e[3*o+1];t>n&&(t=n),i>r&&(i=r),s<n&&(s=n),a<r&&(a=r)}const n=1/(s-t),r=1/(a-i);for(let s=0;s<e.length/3;s++){const a=n*(e[3*s]-t),l=r*(e[3*s+1]-i);o.push({x:a,y:l})}return o}(i.vertices);t.push({vertices:i.vertices,triangles:s,uvs:n})})),t}function me(e,t){const i=ce(e);return i.forEach((e=>{var i;let s=null==e||null===(i=e.geometry)||void 0===i?void 0:i.coordinates;fe(s,1),e.geometry.coordinates=he(s),t&&(e.geometry.coordinates.push(e.geometry.coordinates[0]),e.geometry.coordinates.push(e.geometry.coordinates[1]),e.geometry.coordinates.push(e.geometry.coordinates[2]))})),i}function ge(e){const t=ce(e);return t.forEach((e=>{var t;let i=null==e||null===(t=e.geometry)||void 0===t?void 0:t.coordinates;!function(e){e.type||(e.type="Feature");const t=e.geometry.type,i={Point:0,MultiPoint:1,LineString:1,MultiLineString:2,Polygon:2,MultiPolygon:3};Object.keys(i).includes(t)&&fe(e.geometry.coordinates,i[t])}(e),e.geometry.coordinates=he(i)})),t}const fe=(e,t)=>{if(e)if(0===t)e[2]||(e[2]=0);else for(const i of e)fe(i,t-1)};const ye=new l;function be(e,t){ye.load(e,(e=>{const i=new FileReader;i.readAsDataURL(e),i.onloadend=e=>{t(e.target.result)}}),null,(e=>{t(!1)}))}function xe(e,t="image/png"){return e.toDataURL(t)}function ve(e){return-1!==e.indexOf("data:")&&-1!==e.indexOf("base64")}function Se(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 Ne(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 Ue(e,t,i,s){const{xScale:a}=i,[o,n]=s,{text:r,fontSize:l,fontFamily:h,color:d,textAlign:c,icon:u}=t;let p;if(r||"number"==typeof r||u)if(r&&u)console.warn("BasicLabel Warning:text和icon不要同时设置");else{if(p=r,e.font=`${l*a}px ${h}`,e.fillStyle=d,e.textAlign=c||"left",e.textBaseline="top",u){let e=u;-1!==u.indexOf("&")&&(e=u.replace("&","&")),-1!==u.indexOf("&")&&(e=u.replace("&","&")),p=new Function('return ("'+`${e}`.replace("&#x","\\u").replace(";","")+'")')()}e.measureText(p).width,e.fillText(p,o,n)}}async function we(e,t){const{height:i,width:s,backgroundImage:o,borderRadius:n,borderColor:r,borderWidth:l,backgroundColor:h}=e,d=s,c=i,u=document.createElement("canvas"),p=u.getContext("2d"),m=a.ceilPowerOfTwo(d),g={width:m,height:m*(c/d),factor:{xScale:m/d,yScale:m/d}};u.width=g.width,u.height=g.height;const{xScale:f,yScale:y}=g.factor;if(o){const e=await Se(o,"");p.drawImage(e,0,0,d*f,c*y)}else(r||h)&&(p.strokeStyle=r,p.fillStyle=h,p.lineWidth=l?l*f:1*f,Ne(p,p.lineWidth*f,p.lineWidth*y,(d-2*p.lineWidth)*f,(c-2*p.lineWidth)*y,n?n*f:0),h&&p.fill(),r&&p.stroke());return t&&async function(e,t,i){const{paddingTop:s,paddingLeft:a,width:o,height:n}=t;let r=0,l=0,h=0,d=0;const{xScale:c,yScale:u}=t.factor,p=a?a*c:0,m=s?s*u:0,g=[p,m],f=Object.keys(i);for(let s=0;s<f.length;s++){const n=i[f[s]],{width:y,height:b,text:x,marginRight:v,marginBottom:S,backgroundImage:N,borderRadius:U,borderColor:w,borderWidth:C,backgroundColor:T,position:O,id:z}=n;if(O){const[e,t]=O;g[0]=p+e*c,g[1]=m+t*u,r=0,l=0,h=0,d=0}if(y&&b){if(g[0]+y*c>o&&(h+=r,h+b*u<=l?(g[0]=d,g[1]+=r):(g[0]=a?a*c:0,g[1]+=r,l=0,d=0)),N)try{const t=await Se(N,"");e.drawImage(t,g[0],g[1],y*c,b*u)}catch(e){console.log(e)}else T&&(e.strokeStyle=w,e.fillStyle=T,e.lineWidth=C?C*c:1*c,Ne(n,g[0]+n.lineWidth*c,g[1]+n.lineWidth*c,(y-2*n.lineWidth)*c,(b-2*n.lineWidth)*u,U?U*c:0),T&&e.fill(),w&&e.stroke());if(x){const[i,s]=O,a=[g[0]+i*c,g[1]+s*u];Ue(e,n,t.factor,a)}g[0]+=(y+(v||0))*c,r=(b+(S||0))*u,r>l&&(l=r,d=g[0])}else if(x){const[i,s]=O,a=[g[0]+i*c,g[1]+s*u];Ue(e,n,t.factor,a)}}}(p,g,t),u}function Ce(e,t={}){if(!e)return!1;const i=document.createElement("canvas"),s=i.getContext("2d"),a=t.scale||1,o=t.fontSize||18,n=t.fontface||"Arial",r=t.borderThickness||0,l=t.backgroundColor||{r:0,g:0,b:0,a:1},h=t.borderColor||{r:0,g:0,b:0,a:1},d=t.strokeStyle||{r:255,g:0,b:0,a:1},c=t.textColor||{r:255,g:0,b:0,a:1};s.font="Bold "+o*a+"px "+n;const u=s.measureText(e).width*a,p=u+2*r*a,m=o*a*1.4+2*r*a;i.width=t.width||p,i.height=t.height||m,s.font="Bold "+o*a+"px "+n;const{r:g,g:f,b:y,a:b}=l;if(s.fillStyle="rgba("+g+","+f+","+y+","+b+")",s.fillRect(0,0,i.width,i.height),t.drawRoundRect){const{r:e,g:t,b:i,a:n}=h;s.strokeStyle="rgba("+e+","+t+","+i+","+n+")",s.lineWidth=r*a,Ne(s,r/2,r/2,u+r+10*a,o*a*1.4+r,6)}if(s.fill(),s.stroke(),t.drawStrokeStyle){const{r:t,g:n,b:l,a:h}=d;s.strokeStyle="rgba("+t+","+n+","+l+","+h+")",s.strokeText(e,(r+5)*a+.5*(i.width-p),.5*(i.height-m)+(o+r)*a)}const{r:x,g:v,b:S,a:N}=c;return s.fillStyle="rgba("+x+","+v+","+S+","+N+")",s.fillText(e,(r+5)*a+.5*(i.width-p),.5*(i.height-m)+(o+r)*a),i}ye.setResponseType("blob");class Te extends ne{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&&(this._map=e,ve(e)?(this.texture=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0):be(e,(e=>{e&&(this.texture=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)})))}constructor(e={}){super(e);let s=e.name;const n=new h(1,1,1);e.color&&(n.r=a.clamp(e.color.r,0,1),n.g=a.clamp(e.color.g,0,1),n.b=a.clamp(e.color.b,0,1));const r=new h(1,1,1);e.color2?(r.r=a.clamp(e.color2.r,0,1),r.g=a.clamp(e.color2.g,0,1),r.b=a.clamp(e.color2.b,0,1)):(r.r=n.r,r.g=n.g,r.b=n.b);let l=void 0===e.size?10:e.size,d=void 0===e.sizeAttenuation||e.sizeAttenuation,c=void 0===e.gardientDirection?1:e.gardientDirection,u=void 0===e.brightness?0:e.brightness,p=void 0===e.scroll?0:e.scroll,m=this.childIndex=-1,g=void 0===e.speed?.2:e.speed,f=void 0===e.roughness?1:e.roughness,y=void 0===e.metallic?0:e.metallic;this.map=e.map||null;let b=void 0===e.opacity?1:e.opacity,x=void 0===e.uvRotateSpeed?0:e.uvRotateSpeed,v=void 0===e.WPOScaleAnimateSpeed?0:e.WPOScaleAnimateSpeed,S=void 0===e.WPOMinAnimateScale?1:e.WPOMinAnimateScale,N=void 0===e.WPOMaxAnimateScale?2:e.WPOMaxAnimateScale;const U=new h(1,1,1);e.brightnessColor&&(U.r=a.clamp(e.brightnessColor.r,0,1),U.g=a.clamp(e.brightnessColor.g,0,1),U.b=a.clamp(e.brightnessColor.b,0,1));const w=e.position||new t,C=new o;e.rotation&&(C.x=a.clamp(e.rotation.x,-180,180),C.y=a.clamp(e.rotation.y,-180,180),C.z=a.clamp(e.rotation.z,-180,180));const T=new i,O=new t(1,1,1);e.scale&&(O.x=e.scale.x,O.y=e.scale.y,O.z=e.scale.z);const z=new t(0,0,0);e.offset&&(z.x=e.offset.x,z.y=e.offset.y,z.z=e.offset.z),this.isInstance=e.isInstance||!1,this.transparent=e.transparent||b<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,C._onChange((function(){T.setFromEuler(C,!1),this.matrixNeedsUpdate=!0})),T._onChange((function(){C.setFromQuaternion(T,void 0,!1),this.matrixNeedsUpdate=!0})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,get:()=>w,set:e=>{e&&(w.x=e.x,w.y=e.y,w.z=e.z,this.matrixNeedsUpdate=!0)}},childIndex:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e!==m&&(m=e)}},rotation:{configurable:!0,enumerable:!0,get:()=>C,set:e=>{e&&(C.x=a.clamp(e.x,-180,180),C.y=a.clamp(e.y,-180,180),C.z=a.clamp(e.z,-180,180),this.matrixNeedsUpdate=!0)}},quaternion:{writable:!0,configurable:!0,value:T,enumerable:!0},scale:{configurable:!0,enumerable:!0,get:()=>O,set:e=>{e&&(O.x=e.x,O.y=e.y,O.z=e.z,this.matrixNeedsUpdate=!0)}},offset:{configurable:!0,enumerable:!0,get:()=>z,set:e=>{e&&(z.x=e.x,z.y=e.y,z.z=e.z,this.matrixNeedsUpdate=!0)}},color:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n.r=e.r,n.g=e.g,n.b=e.b,e.a&&(b=e.a),this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},color2:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r.r=e.r,r.g=e.g,r.b=e.b,e.a&&(b=e.a),this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},gardientDirection:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{void 0!==e&&(c=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},scroll:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{void 0!==e&&(p=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},uvRotateSpeed:{configurable:!0,enumerable:!0,get:()=>x,set:e=>{void 0!==e&&(x=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOMaxAnimateScale:{configurable:!0,enumerable:!0,get:()=>N,set:e=>{void 0!==e&&(N=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOMinAnimateScale:{configurable:!0,enumerable:!0,get:()=>S,set:e=>{void 0!==e&&(S=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},WPOScaleAnimateSpeed:{configurable:!0,enumerable:!0,get:()=>v,set:e=>{void 0!==e&&(v=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},speed:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{void 0!==e&&(g=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},brightness:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{void 0!==e&&(u=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0)}},roughness:{configurable:!0,enumerable:!0,get:()=>f,set:e=>{f=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},metallic:{configurable:!0,enumerable:!0,get:()=>y,set:e=>{y=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},opacity:{configurable:!0,enumerable:!0,get:()=>b,set:e=>{this.transparent=e<1,b=e,this.overtimeInstanceIndex=[],this.data=[],this.materialNeedsUpdate=!0}},brightnessColor:{configurable:!0,enumerable:!0,get:()=>U,set:e=>{e&&(U.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:s,writable:!0},size:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{void 0!==e&&(l=e,this.overtimeInstanceIndex=[],this.materialNeedsUpdate=!0)}},sizeAttenuation:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{void 0!==e&&(d=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={}){if(!e.to)return!1;const{from:t={},to:i={},duration:s=3e3,easing:a="Linear",loop:o=!1,stayEnd:n=!0}=e;t.position||delete t.position,t.rotation||delete t.rotation,t.scale||delete t.scale,i.position||delete i.position,i.rotation||delete i.rotation,i.scale||delete i.scale,i.animateOffset||delete i.animateOffset,this.animateNeedsUpdate=!0,this.animateJson={Status:"play",From:t,To:i,Duration:s,Easing:a,Loop:o,StayEnd:n};const r=new y.Tween({ratio:0}).to({ratio:1},e.duration||3e3).start();return o&&r.repeat(1/0),this.tween=null,this.tween=r,this.tween}stopAnimate(e=1e3){this.animateNeedsUpdate=!0,this.animateJson={Status:"stop",DelayTime:e},this.tween&&this.tween.stop(),this.tween=null}setData(e){const t=ce(e);if(t.length<1)return!1;const i=t[0].geometry.type.toLowerCase();if(this.isInstance&&["point","multipoint"].indexOf(i)<0)return!1;let s={};switch(i){case"point":case"multipoint":s=ge(t);break;case"linestring":case"multilinestring":s=me(t);break;case"polygon":case"multipolygon":s=pe(t)}if(this.isInstance){const{data:e,overtimeInstanceIndex:t,datas:i}=function(e,t){if(!e||e.length<1)return{data:t,datas:t,overtimeInstanceIndex:[]};const i=[],s=[],a=[],o=[];for(let a=0;a<e.length;a++){const{geometry:n,properties:r={}}=e[a],{coordinates:l}=n,{rotation:h={x:0,y:0,z:0},scale:d={x:1,y:1,z:1}}=r;let c=!1;for(let e=0;e<t.length;e++){const{geometry:s,properties:a={}}=t[e],{coordinates:n}=s,{rotation:r={x:0,y:0,z:0},scale:u={x:1,y:1,z:1}}=a;if(l.length===n.length&&l.every(((e,t)=>e===n[t]))&&(h.x===r.x&&h.y===r.y&&h.z===r.z&&d.x===u.x&&d.y===u.y&&d.z===u.z&&!(i.indexOf(e)>-1))){i.push(e),c=!0,o.push(t[e]);break}}c||s.push(a)}for(let e=0;e<t.length;e++)i.indexOf(e)<0&&(a.push(t[e]),o.push(t[e]));return{data:a,overtimeInstanceIndex:s,datas:o}}(this.datas,s);(e.length>0||t.length>0)&&(this.datas=i,this.data=e,this.overtimeInstanceIndex=t,this.materialNeedsUpdate=!0)}else this.data=s}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}:h,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}}class Oe extends Te{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=pe(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 ze(e,t){const i=e[0],s=e[1],a=t[0],o=t[1];return Math.sqrt((i-a)*(i-a)+(s-o)*(s-o))}function Re(e,t,i){const s=Math.abs(ze(e,t)),a=Math.abs(ze(e,i)),o=Math.abs(ze(t,i)),n=(s+a+o)/2;return 2*Math.sqrt(Math.abs(n*(n-s)*(n-a)*(n-o)))/s}function Ee(e,t,i,s,a){if(i<s){let o=0,n=0;const r=e[i],l=e[s];for(let t=i+1;t<s;t++){const i=Re(r,l,e[t]);i>o&&(o=i,n=t)}o>=a&&(t.push(e[n]),Ee(e,t,i,n,a),Ee(e,t,n,s,a))}return t}function Ie(e,t=10,i=1){if(!(e&&e.length>2))return null;e.forEach(((e,t)=>{e.id=t}));const s=Ee(e,[],0,e.length-i,t);s.push(e[0]),s.push(e[e.length-1]);const a=s.sort(((e,t)=>e.id<t.id?-1:e.id>t.id?1:0));return a.forEach((e=>{e.id=0})),a}class Me extends Te{constructor(e={}){super(e),this.type="Line";let t=e.style||R.SOLID,i=e.splineType||I.LINEAR,s=e.direction||E.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;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;let d={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?e.a:1,this.materialNeedsUpdate=!0)}},strokeWidth:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e,this.materialNeedsUpdate=!0)}}})}setData(e){if(this.isDilution){const t=ce(e);t.forEach(((e,t)=>{const i=e.geometry.coordinates,s=i.length;let a=1;const[o,n,r]=i[0],[l,h,d]=i[s-1];o===l&&n===h&&r===d&&(a=2),e.geometry.coordinates=Ie(i,this.interval,a)})),(e={}).features=t}this.data=me(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 Ae extends Te{constructor(e={}){super(e);let i=e.size||4;this.type="Point",Object.defineProperties(this,{size:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=Number(e),i&&(this.scale=new t(i,i,i),this.matrixNeedsUpdate=!0)}}})}setData(e){this.data=ge(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 De extends Te{constructor(e){super(e),this.type="Cube"}}class Pe extends Te{constructor(e={}){super(e),this.type="MeasureArea";let t=void 0===e.textDisplay||e.textDisplay;const i=e.textColor||new h(1,0,0);let s=e.fontSize||18,a=e.textBorderColor||new h(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 Le extends Te{constructor(e={}){super(e),this.type="MeasureLine";let t=e.style||R.SOLID,i=e.splineType||I.LINEAR,s=e.direction||E.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 d=e.strokeWidth||1,c=void 0===e.textDisplay||e.textDisplay;const u=e.textColor||new h(1,0,0);let p=e.fontSize||18,m=e.textBorderColor||new h(1,0,0),g=e.textBorderWidth||1,f=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:()=>f,set:e=>{e&&(f=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?e.a:1)}},strokeWidth:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d=e)}},textDisplay:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{e&&(c=e)}},fontSize:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{e&&(p=e)}},textColor:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{e&&(u.r=e.r,u.g=e.g,u.b=e.b)}},textBorderWidth:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g=e)}},textBorderColor:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e&&(m.r=e.r,m.g=e.g,m.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 ke extends Te{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 h(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 Be extends Te{constructor(e={}){super(e),this.type="LocationPoint",this.EPSG=e.EPSG||"epsg:4326";const t=e.textColor||new h(1,0,0);let i=e.fontSize||18,s=e.textBorderColor||new h(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}}const _e=b.create();_e.interceptors.request.use((e=>{const t=localStorage.getItem("authToken");return t&&(e.headers.Authorization=`Bearer ${t}`),e}),(e=>Promise.reject(e))),_e.interceptors.response.use((e=>e),(e=>(e.response&&401===e.response.status&&localStorage.removeItem("authToken"),Promise.reject(e))));class Fe{constructor(){}static host="";static tag="";static _username="admin";static _password="admin";static _currentProject;static set username(e){this._username=e,this._SaveToken()}static get username(){return this._username}static set password(e){this._password=e,this._SaveToken()}static get password(){return this._password}static _SaveToken(){localStorage.setItem("authToken",btoa(`${this._username}:${this._password}`))}}Fe.GetProjectCommon=async function(){if(Fe.host){return await _e.get(`${Fe.host}/api/configs/projects/common`)}console.error("请先设置Host地址")},Fe.getProjectCommon=Fe.GetProjectCommon,Fe.GetProjectByNodeId=async function(e){if(Fe.host){return await _e.get(`${Fe.host}/api/configs/projects/${e}`)}console.error("请先设置Host地址")},Fe.getProjectByNodeId=Fe.GetProjectByNodeId,Fe.GetAllCapacity=async function(){if(Fe.host){return(await _e.get(`${Fe.host}/api/nodes/capacity`)).data.data[""===Fe.tag?"all":Fe.tag]}},Fe.getAllCapacity=Fe.GetAllCapacity,Fe.GetAllCapacityInfo=async function(){if(Fe.host){return(await _e.get(`${Fe.host}/api/nodes/capacity`)).data.data}},Fe.getAllCapacityInfo=Fe.GetAllCapacityInfo,Fe.GetAllNodes=async function(){if(Fe.host){return await _e.get(`${Fe.host}/api/nodes/all`)}},Fe.getAllNodes=Fe.GetAllNodes,Fe.GetAliveNodes=async function(){if(Fe.host){return await _e.get(`${Fe.host}/api/nodes/list`)}},Fe.getAliveNodes=Fe.GetAliveNodes,Fe.CreateTask=async function(e){const t=Fe.tag||"",i=await _e.post(`${Fe.host}/api/tasks/create`,{project:e,tag:"all"===t?"":t});return Fe._currentProject=i.data,i.data},Fe.createTask=Fe.CreateTask,Fe.KillTask=async function(e){if(Fe.host){const t=await _e.post(`${Fe.host}/api/tasks/kill/${e}`);return Fe._currentProject=null,t}},Fe.killTask=Fe.KillTask,Fe._SaveToken(),"undefined"==typeof ue&&(window.ue={});const We=window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.requestAnimationFrame;class He extends G{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.printStats=(null==e?void 0:e.printStats)||!1,this.printInputs=(null==e?void 0:e.printInputs)||!1,this.connectOnLoad=(null==e?void 0:e.connectOnLoad)||!0,this.isReconnection=(null==e?void 0:e.isReconnection)||!1,this.ws,this.wsURL=null==e?void 0:e.wsUrl,this.projectName=void 0===e.projectName?"default":e.projectName,this.renderMode=(null==e?void 0:e.renderMode)||"cloud",this.matchmakerIP=null==e?void 0:e.matchmakerIP,this.matchmakerPort=(null==e?void 0:e.matchmakerPort)||"90",this.scene=new re,this.scene.engine=this,this.qualityController=!1,this.qualityControlOwnershipCheckBox,this.matchViewportResolution=(null==e?void 0:e.matchViewportResolution)||!1,this.resolution=(null==e?void 0:e.resolution)||[0,0],this.lastTimeResized=(new Date).getTime(),this.resizeTimeout,this.onDataChannelConnected;const{controlScheme:t=D.controlScheme,suppressBrowserKeys:i=D.suppressBrowserKeys,fakeMouseWithTouches:s=D.fakeMouseWithTouches}=(null==e?void 0:e.inputOptions)||{};if(this.inputOptions={controlScheme:t,suppressBrowserKeys:i,fakeMouseWithTouches:s},this.eventHandler=new V(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(),"inner"===this.renderMode){var a;const e=this;"undefined"!=typeof ue&&null!==(a=ue)&&void 0!==a&&a.interface&&(ue.interface.webUILoaded=function(){e._initWebUI()})}}static DispatchServer=Fe;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:U.OBJECT_BOUNDINGBOX,params:this.objectBBox.toJSON()}):this.emitUIInteraction({excuteName:O.VISIBLE,params:e.toJSON()}),e.visibleNeedsUpdate=!1),e.visible&&(e.matrixNeedsUpdate||e.materialNeedsUpdate||e.animateNeedsUpdate)&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:T.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?this.emitUIInteraction({excuteName:C.EVENT_LAYER_BUILDING,params:e.toJSON()}):"SlopeAnalysis"===e.type?this.emitUIInteraction({excuteName:C.UPDATA_SLOPE_ANALYSIS,params:e.toJSON()}):this.emitUIInteraction({excuteName:O.UPDATE,params:e.toJSON()}),e.matrixNeedsUpdate=!1,e.materialNeedsUpdate=!1,e.animateNeedsUpdate=!1),e.visible&&e.messageNeedsUpdate&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:T.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):this.emitUIInteraction({excuteName:O.UPDATE,params:e.toJSON()}),e.messageNeedsUpdate=!1),e.followNeedsUpdate&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:T.FOLLOW_TRAFFIC_STREAM_ITEM,params:e.toJSON(!1)}):"AutonomousVehicle"===e.type&&this.emitUIInteraction({excuteName:O.UPDATE,params:e.toJSON()}),e.followNeedsUpdate=!1)})),this.camera&&this.camera.needsUpdate&&(this.camera.constrainPolygonNeedsUpdate?(this.emitUIInteraction({excuteName:w.Constrain_Shape,params:this.camera.toJSON()}),this.camera.constrainPolygonNeedsUpdate=!1):this.emitUIInteraction({excuteName:w.UPDATE,params:this.camera.toJSON()}),this.camera.needsUpdate=!1)}),1e3/e)}eventListenerUpdate(e){e&&e._needsDispatchedToUE&&(e._dispatchAddListenerTypes&&e._dispatchAddListenerTypes.length>0&&(this.emitUIInteraction({excuteName:T.ADD_EVENT_LISTENER,params:{type:e.type,name:e.name,uuid:e.uuid,EventType:e._dispatchAddListenerTypes}}),e._dispatchAddListenerTypes=[]),e._dispatchRemoveListenerTypes&&e._dispatchRemoveListenerTypes.length>0&&(this.emitUIInteraction({excuteName:T.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)||void 0===e||e.removeFromParent(),this.camera=null);this.camera=new le,this.camera.type="Camera",this.camera.addEventListener("cameraChange",(e=>{var t,i,s,o,n,r;const l=e.content.camera;this.camera.position.x=l.Location.longitude,this.camera.position.y=l.Location.latitude,this.camera.position.z=l.Location.altitude,this.camera.rotation.x=a.degToRad(l.Rotate.roll),this.camera.rotation.y=a.degToRad(l.Rotate.pitch),this.camera.rotation.z=a.degToRad(l.Rotate.yaw),this.camera.roll=l.Rotate.roll,this.camera.pitch=l.Rotate.pitch,this.camera.yaw=l.Rotate.yaw,this.camera.worldLocation.x=null==l||null===(t=l.Position)||void 0===t?void 0:t.x,this.camera.worldLocation.y=null==l||null===(i=l.Position)||void 0===i?void 0:i.y,this.camera.worldLocation.z=null==l||null===(s=l.Position)||void 0===s?void 0:s.z,this.camera.sphereLocation.x=null==l||null===(o=l.SphereLocation)||void 0===o?void 0:o.longitude,this.camera.sphereLocation.y=null==l||null===(n=l.SphereLocation)||void 0===n?void 0:n.latitude,this.camera.sphereLocation.z=null==l||null===(r=l.SphereLocation)||void 0===r?void 0:r.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 De({color:new h(1,1,0)}),this.scene.add(this.objectBBox),this.objectBBox.visible=!1,this.emitUIInteraction({excuteName:U.OBJECT_BOUNDINGBOX,params:this.objectBBox.toJSON()})}_initWebUI(){const e=this;ue.interface.webUIMessage=function(t){e.eventHandler.callRespone(t)},console.log("页面及其所有资源已完全加载"),setTimeout((()=>{e.UDS||(e.UDS=new W(e,e.UDSParams)),e.camera||(console.log("initOthers start"),e.initOthers(),console.log("initOthers end -> ",e.camera)),e.dispatchEvent({type:"videoInitialised"})}),1e3),je((new Date).getTime())}scanGamepads(){let e=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[];for(let t=0;t<e.length;t++)e[t]&&e[t].index in this.controllers&&(this.controllers[e[t].index].currentState=e[t])}updateStatus(){for(j in this.scanGamepads(),this.controllers){let e=this.controllers[j],t=e.currentState,i=e.prevState;for(let e=0;e<t.buttons.length;e++){let 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){let i=parseFloat(t.axes[e].toFixed(4)),s=-parseFloat(t.axes[e+1].toFixed(4));0===e?(this.emitControllerAxisMove(j,1,i),this.emitControllerAxisMove(j,2,s)):2===e&&(this.emitControllerAxisMove(j,3,i),this.emitControllerAxisMove(j,4,s))}this.controllers[j].prevState=t}We(this.updateStatus)}emitControllerButtonPressed(e,t,i){Data=new DataView(new ArrayBuffer(4)),Data.setUint8(0,P.GamepadButtonPressed),Data.setUint8(1,e),Data.setUint8(2,t),Data.setUint8(3,i)}emitControllerButtonReleased(e,t){Data=new DataView(new ArrayBuffer(3)),Data.setUint8(0,P.GamepadButtonReleased),Data.setUint8(1,e),Data.setUint8(2,t)}emitControllerAxisMove(e,t,i){Data=new DataView(new ArrayBuffer(11)),Data.setUint8(0,P.GamepadAnalog),Data.setUint8(1,e),Data.setUint8(2,t),Data.setFloat64(3,i,!0),this.sendInputData(Data.buffer)}setupToggleWithUrlParams(e,t){let i=document.getElementById(e);i&&(i.checked=new URLSearchParams(window.location.search).has(t),i.addEventListener("change",(e=>{const i=new URLSearchParams(window.location.search);e.currentTarget.checked?i.set(t,"true"):i.delete(t),window.history.replaceState({},"",""!==i.toString()?`${location.pathname}?${i}`:`${location.pathname}`)})))}updateStreamList(){const e=document.getElementById("stream-select");for(let t=e.options.length-1;t>=0;t--)e.remove(t);e.value=null;for(const[t,i]of this.webRtcPlayerObj.availableVideoStreams){let i=document.createElement("option");i.value=t,i.innerHTML=t,e.appendChild(i),null==e.value&&(e.value=t)}this.updateTrackList()}updateTrackList(){const e=document.getElementById("stream-select"),t=document.getElementById("track-select"),i=this.webRtcPlayerObj.availableVideoStreams.get(e.value);for(let e=t.options.length-1;e>=0;e--)t.remove(e);t.value=null;for(const e of i.getVideoTracks()){let i=document.createElement("option");i.value=e.id,i.innerHTML=e.label,t.appendChild(i),e.selected&&(t.value=e.id)}}sendStartLatencyTest(){const e=this;if(!this.webRtcPlayerObj)return;this.webRtcPlayerObj.startLatencyTest((function(t){let i={StartTime:t};e.emitDescriptor(P.LatencyTest,i)}))}setOverlay(e,t,i){let s=document.getElementById("videoPlayOverlay");if(!s){let e=document.getElementById("player");s=document.createElement("div"),s.id="videoPlayOverlay",e&&e.appendChild(s)}for(;s.lastChild;)s.removeChild(s.lastChild);t&&s.appendChild(t),i&&s.addEventListener("click",(function e(t){i(t),s.removeEventListener("click",e)}));let a=s.classList;for(let e=a.length-1;e>=0;e--)a.remove(a[e]);s.classList.add(e)}showConnectOverlay(){let e=document.createElement("div");e.id="playButton",e.innerHTML="点击开始",this.setOverlay("clickableState",e,(e=>{this.connect(),this.startAfkWarningTimer()}))}showTextOverlay(e){let t=document.createElement("div");t.id="messageOverlay",t.innerHTML=e||"",this.setOverlay("textDisplayState",t)}playVideoStream(){const e=this;e.webRtcPlayerObj&&this.webRtcPlayerObj.video?(e.webRtcPlayerObj.video.play().catch((function(t){console.error(t),console.log("Browser does not support autoplaying video without interaction - to resolve this we are going to show the play button overlay."),e.showPlayOverlay()})),e.requestInitialSettings(),e.requestQualityControl(),e.eventHandler.showFreezeFrameOverlay(),e.hideOverlay()):console.error("Could not player video stream because this.webRtcPlayerObj.video was not valid.")}showPlayOverlay(){let 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==A.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 i=this;function s(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);let t=e.slice(5);if(this.freezeFrame.jpeg){let e=new Uint8Array(this.freezeFrame.jpeg.length+t.length);e.set(this.freezeFrame.jpeg,0),e.set(t,this.freezeFrame.jpeg.length),this.freezeFrame.jpeg=e}else this.freezeFrame.jpeg=t,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(){let e=btoa(this.freezeFrame.jpeg.reduce(((e,t)=>e+String.fromCharCode(t)),"")),t=document.getElementById("this.freezeFrameOverlay").childNodes[0];t.src="data:image/jpeg;base64,"+e,t.onload=function(){i.freezeFrame.height=t.naturalHeight,i.freezeFrame.width=t.naturalWidth,i.resizeFreezeFrameOverlay(),i.shouldShowPlayOverlay?(i.showPlayOverlay(),i.eventHandler.resizePlayerStyle()):i.eventHandler.showFreezeFrameOverlay()}}()):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 H({...t,forceTURN:this.forceTURN}),e.appendChild(this.webRtcPlayerObj.video),e.appendChild(this.freezeFrameOverlay),this.connectOnLoad&&(this.webRtcPlayerObj.video.muted=!0),this.webRtcPlayerObj.onWebRtcOffer=function(e){if(i.ws&&1===i.ws.readyState){let t=JSON.stringify(e);console.log("%c[Outbound SS message (offer)]","background: lightgreen; color: black",e),i.ws.send(t)}},this.webRtcPlayerObj.onWebRtcCandidate=function(e){i.ws&&1===i.ws.readyState&&i.ws.send(JSON.stringify({type:"iceCandidate",candidate:e}))},this.webRtcPlayerObj.onWebRtcAnswer=function(e){if(i.ws&&1===i.ws.readyState){let t=JSON.stringify(e);console.log("%c[Outbound SS message (answer)]","background: lightgreen; color: black",e),i.ws.send(t)}},this.webRtcPlayerObj.onVideoInitialised=function(){i.ws&&1===i.ws.readyState&&(i.shouldShowPlayOverlay?(i.showPlayOverlay(),i.eventHandler.resizePlayerStyle()):(i.eventHandler.resizePlayerStyle(),i.playVideoStream()),0!==i.resolution[0]&&0!==i.resolution[1]&&i.changeResolution(i.resolution[0],i.resolution[1]))},this.webRtcPlayerObj.onDataChannelConnected=function(){i.ws&&1===i.ws.readyState&&(i.showTextOverlay("云渲染服务连接成功,等待画面推送中"),i.requestQualityControl(),setTimeout((()=>{i.UDS||(i.UDS=new W(i,i.UDSParams)),i.camera||i.initOthers(),i.dispatchEvent({type:"videoInitialised"})}),1e3))},this.webRtcPlayerObj.onNewVideoTrack=function(e){var t,s;null!=i&&null!==(t=i.webRtcPlayerObj)&&void 0!==t&&t.onVideoInitialised&&(null==i||null===(s=i.webRtcPlayerObj)||void 0===s||s.onVideoInitialised());i.isShowTestUI&&i.updateStreamList()},this.webRtcPlayerObj.onDataChannelMessage=function(e){let t=new Uint8Array(e);if(t[0]===M.QualityControlOwnership){let e=0!==t[1];console.log("Received quality controller message, will control quality: "+e),i.qualityController=e,i.qualityControlOwnershipCheckBox&&(i.qualityControlOwnershipCheckBox.disabled=e,i.qualityControlOwnershipCheckBox.checked=e)}else if(t[0]===M.Response){let t=new TextDecoder("utf-16").decode(e.slice(1));i.eventHandler.callRespone(JSON.parse(t))}else if(t[0]===M.Command){let t=new TextDecoder("utf-16").decode(e.slice(1));console.log(t);let s=JSON.parse(t);"onScreenKeyboard"===s.command&&i.showOnScreenKeyboard(s)}else if(t[0]===M.FreezeFrame)s(t);else if(t[0]===M.UnfreezeFrame)i.eventHandler.invalidateFreezeFrameOverlay();else if(t[0]===M.VideoEncoderAvgQP)i.videoEncoderQP=new TextDecoder("utf-16").decode(e.slice(1));else if(t[0]==M.LatencyTest){let t=new TextDecoder("utf-16").decode(e.slice(1));console.log("Got latency timings from UE."),console.log(t);let s=JSON.parse(t);i.webRtcPlayerObj&&i.webRtcPlayerObj.latencyTestTimings.SetUETimings(s)}else if(t[0]==M.InitialSettings){if(!i.isShowTestUI)return;let t=new TextDecoder("utf-16").decode(e.slice(1)),s=JSON.parse(t);if(s.PixelStreaming){if(!1===s.PixelStreaming.AllowPixelStreamingCommands){if(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")){let e=document.createElement("p");e.innerText="(Disabled by -AllowPixelStreamingCommands=false)",e.classList="subtitle-text",e.id="warning-elem-webrtc",document.getElementById("webRTCSettingsHeader").appendChild(e)}if(!document.getElementById("warning-elem-encoder")){let e=document.createElement("p");e.innerText="(Disabled by -AllowPixelStreamingCommands=false)",e.classList="subtitle-text",e.id="warning-elem-encoder",document.getElementById("encoderSettingsHeader").appendChild(e)}console.warn("-AllowPixelStreamingCommands=false, sending console commands from browser to UE is disabled, including toggling FPS and changing encoder settings from the browser.")}s.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."))}s.Encoder&&(document.getElementById("encoder-min-qp-text").value=s.Encoder.MinQP,document.getElementById("encoder-max-qp-text").value=s.Encoder.MaxQP),s.WebRTC&&(document.getElementById("webrtc-fps-text").value=s.WebRTC.FPS,document.getElementById("webrtc-min-bitrate-text").value=s.WebRTC.MinBitrate/1e3,document.getElementById("webrtc-max-bitrate-text").value=s.WebRTC.MaxBitrate/1e3)}else if(t[0]==M.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"));let t=new TextDecoder("utf-16").decode(e.slice(1));console.log(t),this.file.extension=t}(t);else if(t[0]==M.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"));let t=new TextDecoder("utf-16").decode(e.slice(1));console.log(t),this.file.mimetype=t}(t);else if(t[0]==M.FileContents)!function(e){if(!this.file.receiving)return;this.file.size=Math.ceil(new DataView(e.slice(1,5).buffer).getInt32(0,!0)/16379);let t=e.slice(5);if(this.file.data.push(t),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");const 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`);let i=new Blob(this.file.data,{type:this.file.mimetype}),s=document.createElement("a");s.setAttribute("href",URL.createObjectURL(i)),s.setAttribute("download",`transfer.${this.file.extension}`);let a=$(s);a.appendTo("body"),a.remove()}else 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}`))}(t);else if(t[0]==M.Mouse){const t=new TextDecoder("utf-16").decode(e.slice(1));this.eventHandler.dispatchMouseEvent(t)}else if(t[0]==M.Keyboard){const t=new TextDecoder("utf-16").decode(e.slice(1));this.eventHandler.dispatchKeyboardEvent(t)}else t[0]==M.InputControlOwnership||t[0]==M.Protocol?new TextDecoder("utf-16").decode(e.slice(1)):console.error(`unrecognized data received, packet ID ${t[0]}`)},this.eventHandler.registerInputs(this.webRtcPlayerObj.video),"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(e),this.webRtcPlayerObj.video}setupStats(){this.webRtcPlayerObj.aggregateStats(1e3);let e=3e5,t=e;this.webRtcPlayerObj.onAggregatedStats=i=>{let s=new Intl.NumberFormat(window.navigator.language,{maximumFractionDigits:0}),a=new Intl.NumberFormat(window.navigator.language,{maximumFractionDigits:0,minimumIntegerDigits:2}),o=(i.timestamp-i.timestampStart)/1e3,n=[],r=[60,60];for(let e=0;e<r.length;e++)n.push(o%r[e]),o/=r[e];n.push(o);let l=n[0],h=Math.floor(n[1]),d=Math.floor([n[2]]),c="B",u=i.hasOwnProperty("bytesReceived")?i.bytesReceived:0,p=["kB","MB","GB"];for(let e=0;e<p.length&&!(u<1e5);e++)u/=1e3,c=p[e];i.receivedBytes=""+u+p;let m=document.getElementById("qualityStatus"),g=function(e){let t=e,i=1,s=setInterval((function(){i-=.1,m.style=`opacity: ${Math.abs(2*(i-.5))}`,i<=.1&&(0==--t?clearInterval(s):i=1)}),100/e)};let f="",y="lime";this.videoEncoderQP>35?(y="red",g(2),f+=`<div style="color: ${y}">Very blocky encoding quality</div>`):this.videoEncoderQP>26&&(y="orange",g(1),f+=`<div style="color: ${y}">Blocky encoding quality</div>`),m.className=`${y}Status`,f+=`<div>Duration: ${a.format(d)}:${a.format(h)}:${a.format(l)}</div>`,f+=`<div>Video Resolution: ${i.hasOwnProperty("frameWidth")&&i.frameWidth&&i.hasOwnProperty("frameHeight")&&i.frameHeight?i.frameWidth+"x"+i.frameHeight:"Chrome only"}</div>`,f+=`<div>Received (${c}): ${s.format(u)}</div>`,f+=`<div>Frames Decoded: ${i.hasOwnProperty("framesDecoded")?s.format(i.framesDecoded):"Chrome only"}</div>`,f+=`<div>Packets Lost: ${i.hasOwnProperty("packetsLost")?s.format(i.packetsLost):"Chrome only"}</div>`,f+=`<div>Framerate: ${i.hasOwnProperty("framerate")?s.format(i.framerate):"Chrome only"}</div>`,f+=`<div>Frames dropped: ${i.hasOwnProperty("framesDropped")?s.format(i.framesDropped):"Chrome only"}</div>`,f+=`<div>Net RTT (ms): ${i.hasOwnProperty("currentRoundTripTime")?s.format(1e3*i.currentRoundTripTime):"Can't calculate"}</div>`,f+=`<div>Browser receive to composite (ms): ${i.hasOwnProperty("receiveToCompositeMs")?s.format(i.receiveToCompositeMs):"Chrome only"}</div>`,f+=`<div style="color: ${y}">Bitrate (kbps): ${i.hasOwnProperty("bitrate")?s.format(i.bitrate):"Chrome only"}</div>`,f+=`<div style="color: ${y}">Video Quantization Parameter: ${this.videoEncoderQP}</div>`,document.getElementById("stats").innerHTML=f,this.printStats&&i.timestampStart&&i.timestamp-i.timestampStart>t&&(this.ws&&1===this.ws.readyState&&(console.log(`-> SS: stats\n${JSON.stringify(i)}`),this.ws.send(JSON.stringify({type:"stats",data:i}))),t+=e),this.dispatchEvent({type:"aggregatedStats",data:i})},this.webRtcPlayerObj.latencyTestTimings.OnAllLatencyTimingsReady=function(e){if(!e.BrowserReceiptTimeMs)return;let t=e.BrowserReceiptTimeMs-e.TestStartTimeMs,i=e.UEEncodeMs,s=e.UECaptureToSendMs,a=e.UETransmissionTimeMs-e.UEReceiptTimeMs,o=t-a,n=null,r=null;e.FrameDisplayDeltaTimeMs&&e.BrowserReceiptTimeMs&&(n=e.FrameDisplayDeltaTimeMs+o+("string"==typeof s?0:s),r=e.FrameDisplayDeltaTimeMs+(t-o-a));let l="";l+=`<div>Net latency RTT (ms): ${o.toFixed(2)}</div>`,l+=`<div>UE Encode (ms): ${"string"==typeof i?i:i.toFixed(2)}</div>`,l+=`<div>UE Send to capture (ms): ${"string"==typeof s?s:s.toFixed(2)}</div>`,l+=`<div>UE probe duration (ms): ${a.toFixed(2)}</div>`,l+=e.FrameDisplayDeltaTimeMs&&e.BrowserReceiptTimeMs?`<div>Browser composite latency (ms): ${e.FrameDisplayDeltaTimeMs.toFixed(2)}</div>`:"",l+=r?`<div>Total browser latency (ms): ${r.toFixed(2)}</div>`:"",l+=n?`<div>Total latency (ms): ${n.toFixed(2)}</div>`:"",document.getElementById("LatencyStats").innerHTML=l}}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(){if(!this.matchViewportResolution)return;if((new Date).getTime()-this.lastTimeResized>1e4){let e=document.getElementById("player");if(!e)return;let t={ConsoleCommand:"setres "+e.clientWidth+"x"+e.clientHeight};this.emitCommand(t),console.log(t),this.lastTimeResized=(new Date).getTime()}else console.log("Resizing too often - skipping")}emitDescriptor(e,t){let i=function(e){let t=JSON.stringify(e);return t.replace(/\r\n/g,"").replace(/\n/g,"").replace(/\s+/g,""),t}(t);const s=49152;if(2*i.length>67108864)return console.error("数据量超出最大传输范围6.4MB!"),!1;if(2*i.length<s)return this.sendStringBufferData(e,i),!1;const a=Math.ceil(2*i.length/s);for(let t=0;t<a;t++){const o=i.slice(.5*t*s,24576*(t+1));this.sendStringBufferData(e,o,a,t+1)}}sendStringBufferData(e,t,i=1,s=1){let a;const o={total:i,index:s,content:t};a=JSON.stringify(o);const n=new DataView(new ArrayBuffer(3+2*a.length));let r=0;n.setUint8(r,e),r++,n.setUint16(r,a.length,!0),r+=2;for(let e=0;e<a.length;e++)n.setUint16(r,a.charCodeAt(e),!0),r+=2;this.sendInputData(n.buffer)}emitUIInteraction(e){var t,i;(console.log(e),"cloud"===this.renderMode)?this.emitDescriptor(P.UIInteraction,e):"undefined"!=typeof ue&&null!==(t=ue)&&void 0!==t&&null!==(i=t.interface)&&void 0!==i&&i.broadcast?ue.interface.broadcast(JSON.stringify(e)):console.warn("ue.interface.broadcast is not available in this environment.")}emitCommand(e){this.emitDescriptor(P.Command,e)}requestInitialSettings(){this.sendInputData(new Uint8Array([P.RequestInitialSettings]).buffer)}requestQualityControl(){this.qualityController||this.sendInputData(new Uint8Array([P.RequestQualityControl]).buffer)}setupNormalizeAndQuantize(){let e=document.getElementById("player"),t=e.getElementsByTagName("video");if(e&&t.length>0){let i=e.clientHeight/e.clientWidth,s=t[0].videoHeight/t[0].videoWidth;if(i>s){this.printInputs&&console.log("Setup Normalize and Quantize for playerAspectRatio > videoAspectRatio");let t=i/s;this.normalizeAndQuantizeUnsigned=(i,s)=>{let a=i/e.clientWidth,o=t*(s/e.clientHeight-.5)+.5;return a<0||a>1||o<0||o>1?{inRange:!1,x:65535,y:65535}:{inRange:!0,x:65536*a,y:65536*o}},this.unquantizeAndDenormalizeUnsigned=(i,s)=>{let a=(s/65536-.5)/t+.5;return{x:i/65536*e.clientWidth,y:a*e.clientHeight}},this.normalizeAndQuantizeSigned=(i,s)=>({x:32767*(i/(.5*e.clientWidth)),y:32767*(t*s/(.5*e.clientHeight))})}else{this.printInputs&&console.log("Setup Normalize and Quantize for playerAspectRatio <= videoAspectRatio");let t=s/i;this.normalizeAndQuantizeUnsigned=(i,s)=>{let a=t*(i/e.clientWidth-.5)+.5,o=s/e.clientHeight;return a<0||a>1||o<0||o>1?{inRange:!1,x:65535,y:65535}:{inRange:!0,x:65536*a,y:65536*o}},this.unquantizeAndDenormalizeUnsigned=(i,s)=>{let a=s/65536;return{x:((i/65536-.5)/t+.5)*e.clientWidth,y:a*e.clientHeight}},this.normalizeAndQuantizeSigned=(i,s)=>({x:32767*(t*i/(.5*e.clientWidth)),y:32767*(s/(.5*e.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){if(e.showOnScreenKeyboard){this.editTextButton.classList.remove("hiddenState");let t=this.unquantizeAndDenormalizeUnsigned(e.x,e.y);this.editTextButton.style.top=t.y.toString()+"px",this.editTextButton.style.left=(t.x-40).toString()+"px"}else this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur()}start(e,t){let i=document.getElementById("qualityStatus");i&&(i.className="grey-status");let s=document.getElementById("stats");s&&(s.innerHTML="Not connected"),!this.connectOnLoad||this.isReconnection?(this.showConnectOverlay(),this.eventHandler.invalidateFreezeFrameOverlay(),this.shouldShowPlayOverlay=!0,this.eventHandler.resizePlayerStyle()):(console.log("直接链接~~~~~~"),this.connect(e,t))}buildingGrowthAnimate(e){const{state:t="play",group:i=1,duration:s=3e3,startHeight:a=0,endHeight:o=100,loop:n=!1,easing:r="Linear",sliceColor:l={r:1,g:0,b:0},sliceBrightness:h=30,colorHeight:d=100}=e;this.emitUIInteraction({excuteName:U.BUILD_GROWTHANIMATE,params:JSON.stringify({State:t,Group:i,Duration:s,StartHeight:a,EndHeight:o,Loop:n,Easing:r,SliceColor:l,SliceBrightness:h,ColorHeight:d})})}changeResolution(e,t){void 0!==e&&void 0!==t?this.emitUIInteraction({excuteName:T.CONSOLE_COMMAND,params:{Command:"r.SetRes "+e+"x"+t}}):console.warn("传入的参数为空")}excuteEngineConsoleCommand(e){void 0!==e?this.emitUIInteraction({excuteName:T.CONSOLE_COMMAND,params:{Command:e}}):console.warn("传入的参数为空")}Swtich3DTilesMode(e){const{mode:t,tilesName:i}=e;this.emitUIInteraction({excuteName:C.SWITCH_TERRAIN_MODE,params:{Mode:t,TilesName:i}})}enable3DTilesByName(e){const{enable:t=!0,tilesName:i}=e;this.emitUIInteraction({excuteName:C.ENABLE_3DTILES_BY_NAME,params:{Enable:t,TilesName:i}})}hidden3DTilesItem(e){let{hiddenList:t=[],tilesName:i}=e;Array.isArray(t)||(t=[]),this.emitUIInteraction({excuteName:C.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:T.RESET_WORLD_CENTER,params:{Center:{Latitude:a.clamp(e,-180,180),Longitude:a.clamp(t,-90,90),Altitude:a.clamp(i,-500,8848)}}})}SetPlanePOIMode(e){const{enable:t=!1,cullingScale:i=2,aspectRatio:s=1.777778,cameraFov:a=90,maxTilesCullingDistance:o=1e3,maxPOICullingDistance:n=2e3,poiSimplifyDistance:r=1500,maxLoadedPoiTilesNum:l=5}=e;this.emitUIInteraction({excuteName:C.SET_PLANE_POI_MODE,params:{EnablePoi:t,CullingScale:i,AspectRatio:s,CameraFov:a,MaxTilesCullingDistance:o,MaxPOICullingDistance:n,PoiSimplifyDistance:r,MaxLoadedPoiTilesNum:l}})}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:w.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){let{multiplier:t=1,x:i=0,y:s=0}=e;this.emitUIInteraction({excuteName:w.MOVE,params:{Multiplier:t,ActionValue:{x:i,y:s}}})}rotateCamera(e){let{multiplier:t=1,yaw:i=0,pitch:s=0}=e;this.emitUIInteraction({excuteName:w.ROTATE,params:{Multiplier:t,ActionValue:{x:i,y:s}}})}zoomIn(e=1){this.emitUIInteraction({excuteName:w.ZOOM_IN,params:{Multiplier:e}})}zoomOut(e=1){this.emitUIInteraction({excuteName:w.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}){var i,s,a;if(!e)return!1;this.emitUIInteraction({excuteName:w.FOCUS_ON,params:{uuid:null==e?void 0:e.uuid,type:null==e?void 0:e.type,rotation:{Roll:null==t||null===(i=t.rotation)||void 0===i?void 0:i.roll,Pitch:null==t||null===(s=t.rotation)||void 0===s?void 0:s.pitch,Yaw:null==t||null===(a=t.rotation)||void 0===a?void 0:a.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(e,t={}){const{lockAll:i=!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}=t;if(!e||e.length<2)return!1;u&&this.camera.addEventListener("navigationStart",u);const m=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];m.push(i[0],i[1],i[2]||10,i[3]||0,i[4]||0,i[5]||0)}setTimeout((()=>{this.emitUIInteraction({excuteName:w.NAVIGATION,params:JSON.stringify({jsondata:m,Speed:s,Name:n,Time:a,IgnoreLag:o,LockAll:i,PatrolType:r,FollowRotation:l,RayDetectionDistance:d,FinishDestory:h})})}),100),(p||c)&&(p?this.camera.addEventListener("navigationFinish",p):this.camera.addEventListener("navigationFinish",c))}pauseNavigation(e={}){const{patrolType:t="default"}=e;this.emitUIInteraction({excuteName:w.NAVIGATION_PAUSE,params:{State:0,PatrolType:t}})}resumeNavigation(e={}){const{patrolType:t="default"}=e;this.emitUIInteraction({excuteName:w.NAVIGATION_PAUSE,params:{State:1,PatrolType:t}})}stopNavigation(e={}){const{patrolType:t="default",delayTime:i=100}=e;setTimeout((()=>{this.emitUIInteraction({excuteName:w.NAVIGATION_STOP,params:{PatrolType:t}})}),i)}enableDataLayerByName(e,t){this.emitUIInteraction({excuteName:U.ENABLE_DATALAYER,params:{Visible:t,DataLayerName:e}})}project(e,t){if(!e)return!1;this.emitUIInteraction({excuteName:w.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:w.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:C.GET_ALTITUDE,params:i})}),100)}exit(){this.emitUIInteraction({excuteName:T.EXIT_CLIENT})}restartLevel(){return!1}restartGame(){this.emitUIInteraction({excuteName:T.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:T.CREATE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?this.emitUIInteraction({excuteName:C.EVENT_LAYER_BUILDING,params:e.toJSON(!1)}):"SlopeAnalysis"===e.type?this.emitUIInteraction({excuteName:C.UPDATA_SLOPE_ANALYSIS,params:e.toJSON()}):this.emitUIInteraction({excuteName:O.ADD,params:e.toJSON(!1)}))}removeFromScene(e){this.destoryObject(e)}removeAllFromScene(){this.emitUIInteraction({excuteName:O.DESTORY_ALL}),this.scene.clear()}destoryObject(e){e&&("TrafficLayer"===e.type?this.emitUIInteraction({excuteName:T.CLOSE_TRAFFIC_STREAM,params:e.toJSON(!1)}):"LayerBuilding"===e.type?(e.buildingState="destory",this.emitUIInteraction({excuteName:C.EVENT_LAYER_BUILDING,params:e.toJSON(!1)})):this.emitUIInteraction({excuteName:O.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 d,this.scene.add(this.drawAndMeasureGroup)),"measure"===e)switch(this.editMode="measure",s=z.ENABLE_MEASURE,t.toLowerCase()){case"polygon":case"measurearea":if(this.drawAndMeasureGroup.measureArea)this.drawAndMeasureGroup.measureArea.updateParameters(i);else{const e=new Pe(i);this.drawAndMeasureGroup.measureArea=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.measureArea.toJSON();break;case"line":case"measureline":if(this.drawAndMeasureGroup.measureLine)this.drawAndMeasureGroup.measureLine.updateParameters(i);else{const e=new Le(i);this.drawAndMeasureGroup.measureLine=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.measureLine.toJSON();break;case"surfaceline":if(this.drawAndMeasureGroup.surfaceline)this.drawAndMeasureGroup.surfaceline.updateParameters(i);else{const e=new ke(i);this.drawAndMeasureGroup.surfaceline=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.surfaceline.toJSON();break;default:if(this.drawAndMeasureGroup.locationPoint)this.drawAndMeasureGroup.locationPoint.updateParameters(i);else{const e=new Be(i);this.drawAndMeasureGroup.locationPoint=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.locationPoint.toJSON()}else switch(this.editMode="draw",s=z.ENABLE_DRAW,t){case"polygon":if(this.drawAndMeasureGroup.polygon)for(const e in i)this.drawAndMeasureGroup.polygon[e]!==i[e]&&(this.drawAndMeasureGroup.polygon[e]=i[e]);else{const e=new Oe(i);this.drawAndMeasureGroup.polygon=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.polygon.toJSON();break;case"line":if(this.drawAndMeasureGroup.line)for(const e in i)this.drawAndMeasureGroup.line[e]!==i[e]&&(this.drawAndMeasureGroup.line[e]=i[e]);else{const e=new Me(i);this.drawAndMeasureGroup.line=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.line.toJSON();break;default:if(this.drawAndMeasureGroup.point)for(const e in i)this.drawAndMeasureGroup.point[e]!==i[e]&&(this.drawAndMeasureGroup.point[e]=i[e]);else{const e=new Ae(i);this.drawAndMeasureGroup.point=e,this.drawAndMeasureGroup.add(e)}a=this.drawAndMeasureGroup.point.toJSON()}this.emitUIInteraction({ExcuteName:s,params:a})}closeEdit(){if(this.editMode){let e=z.CLOSE_DRAW;"measure"===this.editMode&&(e=z.CLOSE_MEASURE),this.emitUIInteraction({ExcuteName:e})}}setFPS(e=!1){this.emitUIInteraction({ExcuteName:U.ENABLE_FPS,params:{state:e}})}removeAllEditObjects(e="all",t=["point","line","polygon","surfaceline"]){if(!this.drawAndMeasureGroup||this.drawAndMeasureGroup.children.length<1)return;const i=[];if(e)switch(e){case"draw":(!Array.isArray(t)||t.length<1)&&(t=["point","line","polygon"]),t.indexOf("polygon")>-1&&this.drawAndMeasureGroup.polygon&&(i.push(this.drawAndMeasureGroup.polygon.uuid),this.drawAndMeasureGroup.polygon.removeFromParent(),this.drawAndMeasureGroup.polygon=null),t.indexOf("line")>-1&&this.drawAndMeasureGroup.line&&(i.push(this.drawAndMeasureGroup.line.uuid),this.drawAndMeasureGroup.line.removeFromParent(),this.drawAndMeasureGroup.line=null),t.indexOf("point")>-1&&this.drawAndMeasureGroup.point&&(i.push(this.drawAndMeasureGroup.point.uuid),this.drawAndMeasureGroup.point.removeFromParent(),this.drawAndMeasureGroup.point=null),this.emitUIInteraction({ExcuteName:z.DESTORY_DRAW,params:{uuids:i,Classes:t}});break;case"measure":(!Array.isArray(t)||t.length<1)&&(t=["point","line","polygon","surfaceline"]);let e=t.indexOf("polygon");e>-1&&(t.splice(e,1),t.push("MeasureArea")),e>-1&&this.drawAndMeasureGroup.measureArea&&(i.push(this.drawAndMeasureGroup.measureArea.uuid),this.drawAndMeasureGroup.measureArea.removeFromParent(),this.drawAndMeasureGroup.measureArea=null),e=t.indexOf("line"),e>-1&&(t.splice(e,1),t.push("MeasureLine")),e>-1&&this.drawAndMeasureGroup.measureLine&&(i.push(this.drawAndMeasureGroup.measureLine.uuid),this.drawAndMeasureGroup.measureLine.removeFromParent(),this.drawAndMeasureGroup.measureLine=null),e=t.indexOf("point"),e>-1&&(t.splice(e,1),t.push("LocationPoint")),e>-1&&this.drawAndMeasureGroup.locationPoint&&(i.push(this.drawAndMeasureGroup.locationPoint.uuid),this.drawAndMeasureGroup.locationPoint.removeFromParent(),this.drawAndMeasureGroup.locationPoint=null),e=t.indexOf("surfaceline"),e>-1&&(t.splice(e,1),t.push("SurfaceLine")),e>-1&&this.drawAndMeasureGroup.surfaceline&&(i.push(this.drawAndMeasureGroup.surfaceline.uuid),this.drawAndMeasureGroup.surfaceline.removeFromParent(),this.drawAndMeasureGroup.surfaceline=null),this.emitUIInteraction({ExcuteName:z.DESTORY_MEASURE,params:{uuids:i,Classes:t}});break;case"all":this.emitUIInteraction({ExcuteName:z.DESTORY_DRAW,params:{uuids:i,Classes:["Point","Line","Polygon"]}}),this.emitUIInteraction({ExcuteName:z.DESTORY_MEASURE,params:{uuids:i,Classes:["MeasureArea","MeasureLine","LocationPoint","SurfaceLine"]}}),this.drawAndMeasureGroup.children=[],this.scene.remove(this.drawAndMeasureGroup),this.drawAndMeasureGroup=null}}async connect(e=()=>{},t=()=>{}){const i=this,s=s=>{console.log("connectToStreamer wsURL :>> ",s),window.WebSocket=window.WebSocket||window.MozWebSocket,window.WebSocket?(i.reclickToStart&&clearTimeout(i.reclickToStart),i.ws=new WebSocket(s),i.ws.onopen=function(e){i.connected||(i.dispatchEvent({type:"connected"}),i.connected=!0),console.log(`${s} WebSocket connection`),i.startPSHeartbeat(),console.log("Start the heartbeat detection of the signaling server.")},i.ws.onmessage=function(e){let t=JSON.parse(e.data);"config"===t.type?(console.log("%c[Inbound SS (config)]","background: lightblue; color: black",t),i.onConfig(t)):"playerCount"===t.type?console.log("%c[Inbound SS (playerCount)]","background: lightblue; color: black",t):"offer"===t.type?(console.log("%c[Inbound SS (offer)]","background: lightblue; color: black",t),i.onWebRtcOffer(t)):"answer"===t.type?(console.log("%c[Inbound SS (answer)]","background: lightblue; color: black",t),i.onWebRtcAnswer(t)):"iceCandidate"===t.type?i.onWebRtcIce(t.candidate):"warning"===t.type&&t.warning?console.warn(t.warning):"pong"===t.type?console.log("pong",t.time):console.error("Invalid SS message type",t.type)},i.ws.onerror=function(e){console.log(`WS error: ${JSON.stringify(e)}`),i.stopPSHeartbeat(),i.dispatchEvent({type:"signalingServerError"})},i.ws.onclose=function(s){console.log(`WS closed: ${JSON.stringify(s.code)} - ${s.reason}`),i.stopPSHeartbeat(),i.ws=void 0,i.isReconnection=!0,i.connected&&(i.connected=!1);let a=document.getElementById("player");i.webRtcPlayerObj&&(a.removeChild(i.webRtcPlayerObj.video),i.webRtcPlayerObj.close(),i.webRtcPlayerObj=void 0),i.showTextOverlay("云渲染服务未正常连接"),i.reclickToStart=setTimeout((()=>{i.connect(e,t)}),1500)}):alert("Your browser doesn't support WebSocket")};if(i.wsURL)s(i.wsURL);else if(He.DispatchServer.host){console.log(`用新版调度服务启动 ${He.DispatchServer.host}/api/tasks/create`);const a=await He.DispatchServer.CreateTask(i.projectName);0===a.status?(i.forceTURN=a.data.useTurnServer,i.wsURL=`ws://${a.data.host}:${a.data.port}`,i.currentTask=a,s(i.wsURL),e&&e("Successfully created task: "+a)):(console.error("Failed to create task:"+a.message),t&&t("Failed to create task: "+a.message))}else{if(!i.matchmakerIP)return console.error("Needs a matchmaker's IP"),!1;{const e=`http://${i.matchmakerIP}:${i.matchmakerPort}/gpuserver?project=${i.projectName}`;try{const t=await b.get(e);if(t.data&&t.data.error)return console.error(t.data.error),!1;i.wsURL=`ws://${t.data.gpuServer}:${t.data.port}`,s(i.wsURL)}catch(e){console.error(e)}}}}startPSHeartbeat(){He.DispatchServer.host&&(this.heartbeatInterval=setInterval((()=>{this.ws.readyState===WebSocket.OPEN&&(this.ws.send('{"type":"ping"}'),console.log("Heartbeat send: Ping"))}),2e3))}stopPSHeartbeat(){this.heartbeatInterval&&clearInterval(this.heartbeatInterval)}onConfig(e){let t=document.getElementById("player"),i=this.setupWebRtcPlayer(t,e);switch(this.eventHandler.resizePlayerStyle(),this.inputOptions.controlScheme){case A.HoveringMouse:this.eventHandler.registerHoveringMouseEvents(i);break;case A.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;if(!s){let t=e.split("://");const i=t[1].split("/")[0],a=i.includes(":")?i.split(":")[0]:i;s=`${t[0]}://${a}/twin/assetApi/getStaticResourceUrl`}t||(t={all:1,common:1,project_id:"418690084255052706"}),this.emitUIInteraction({excuteName:U.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(e=()=>{},t=()=>{}){"cloud"==this.renderMode&&(this.eventHandler.setupHtmlEvents(),this.eventHandler.setupFreezeFrameOverlay(),this.eventHandler.registerKeyboardEvents(),this.start(e,t),je((new Date).getTime()))}}function je(){We(je),y.update()}class Ge extends Te{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=me(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 Ve(e){switch(e){case 0:return"DoNotFcaeToCamera";case 1:default:return"FacetoCamera_XYZ";case 2:return"FacetoCamera_Y";case 3:return"FacetoCamera_Z"}}class Je extends Te{constructor(e={}){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum;let t=e.pivot||{x:.5,y:.5};this.visible=void 0===e.visible||e.visible,this.isGlobalPOI=void 0!==e.isGlobalPOI&&e.isGlobalPOI;let i=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;this.renderType=e.renderType||0,this.openCollision=void 0!==e.openCollision&&e.openCollision;let c=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=ge(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:Ve(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 $e extends Te{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};this.renderType=e.renderType||0,this.fadeIn=void 0===e.fadeIn||e.fadeIn,this.openCollision=void 0!==e.openCollision&&e.openCollision;let c=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,f=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:()=>f,set:e=>{f=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=ge(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:Ve(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 Ye(e,t){const i={};if(Object.assign(i,t),i.style){const{width:t,height:s,borderRadius:a,borderWidth:o,paddingTop:n,paddingLeft:r}=i.style;i.style.width=t*e,i.style.height=s*e,a&&(i.style.borderRadius=a*e),o&&(i.style.borderWidth=o*e),n&&(i.style.paddingTop=n*e),r&&(i.style.paddingLeft=r*e)}return i.content&&i.content.forEach((t=>{for(let i in t)"number"==typeof t[i]&&"id"!==i&&(t[i]=t[i]*e);const{position:i}=t;i&&(t.position=i.map((t=>t*e))),t.textList&&t.textList.forEach((t=>{t.fontSize=t.fontSize*e,t.position=t.position.map((t=>t*e))}))})),i}class qe extends Te{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;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;let i=e;("mesh"===this.labelType||this.sizeAttenuation)&&(i=Ye(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={}){this.style,this.mainView=document.createElement("canvas");const t=await qe.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=Ye(this.renderScale,{content:e}).content);const i=this.drawCanvas.getContext("2d"),{width:s,height:a}=this.drawCanvas;i.clearRect(0,0,s,a),i.drawImage(this.mainView,0,0,s,a),await qe.renderContent(this.style,e,this.drawCanvas,this.factor),this.texture=xe(this.drawCanvas),this.dispatchEvent({type:"contentLoaded",label:this})}updateContent(e={}){let t=e;("mesh"===this.labelType||this.sizeAttenuation)&&(t=Ye(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:default:return"FacetoCamera_XYZ";case 2:return"FacetoCamera_Y";case 3:return"FacetoCamera_Z"}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){const{height:i,width:s,backgroundImage:o,borderRadius:n,borderColor:r,borderWidth:l,backgroundColor:h,clip:d}=e,c=s,u=i,p=t.getContext("2d"),m=a.ceilPowerOfTwo(c),g={width:m,height:m*(u/c),factor:{xScale:m/c,yScale:m/c}};t.width=g.width,t.height=g.height;const{xScale:f,yScale:y}=g.factor;if(o){const e=await qe.loadImg(o,"");p.drawImage(e,0,0,c*f,u*y)}else(r||h)&&(p.strokeStyle=r,p.fillStyle=h,p.lineWidth=l?l*f:1*f,qe.roundRect(p,p.lineWidth*f,p.lineWidth*y,(c-2*p.lineWidth)*f,(u-2*p.lineWidth)*y,n?n*f:0),h&&p.fill(),r&&p.stroke());if(d){const[e,t,i,s]=d;p.beginPath(),p.moveTo(s*c*f,e*u*y),p.lineTo((1-t)*c*f,e*u*y),p.lineTo((1-t)*c*f,(1-i)*u*y),p.lineTo(s*c*f,(1-i)*u*y),p.lineTo(s*c*f,e*u*y),p.closePath(),p.clip()}return g}static async renderContent(e,t,i,s){const a=i.getContext("2d"),{width:o,height:n}=i,{paddingTop:r,paddingLeft:l}=e;let h=0,d=0,c=0,u=0;const{xScale:p,yScale:m}=s,g=l?l*p:0,f=r?r*m:0,y=[g,f],b=[];for(let e=0;e<t.length;e++){const i=t[e],{width:r,height:x,textList:v,marginRight:S,marginBottom:N,backgroundImage:U,borderRadius:w,borderColor:C,borderWidth:T,backgroundColor:O,position:z,id:R,activeInfo:E={}}=i;if(z){const[e,t]=z;y[0]=g+e*p,y[1]=f+t*m,h=0,d=0,c=0,u=0}if(r&&x){if(y[0]+r*p>o&&(c+=h,c+x*m<=d?(y[0]=u,y[1]+=h):(y[0]=l?l*p:0,y[1]+=h,d=0,u=0)),U)try{const e=await qe.loadImg(U,"");a.drawImage(e,y[0],y[1],r*p,x*m)}catch(e){console.warn(e)}else O&&(a.strokeStyle=C,a.fillStyle=O,a.lineWidth=T?T*p:1*p,qe.roundRect(a,y[0]+a.lineWidth*p,y[1]+a.lineWidth*p,(r-2*a.lineWidth)*p,(x-2*a.lineWidth)*m,w?w*p:0),O&&a.fill(),C&&a.stroke());v&&v.forEach((e=>{const[t,i]=e.position,o=[y[0]+t*p,y[1]+i*m];qe.drawText(a,e,s,o)}));const e=y[0]===(l?l*p:0)*p?-.16:-1.3,t=-(n-y[1]-25*m)*(2.05/(107*m))+.1;if(R){const{position:i,style:s={width:5,height:.95}}=E,a=qe.addActiveArea(i||{x:e,y:t},s);a.customId=R,b.push(a)}y[0]+=(r+(S||0))*p,h=(x+(N||0))*m,h>d&&(d=h,u=y[0])}else v&&v.forEach((e=>{const[t,i]=e.position,o=[y[0]+t*p,y[1]+i*m];qe.drawText(a,e,s,o)}))}return b}static getRectangle(e,t,i,s={}){const a=new c({map:i,transparent:!0,fog:!0,depthWrite:!1,...s});a.map&&(a.map.needsUpdate=!0),a.transparent=!0;const o=(.01*e).toFixed(2),n=(.01*t).toFixed(2),r=new u(Number(o),Number(n),1,1),l=new p(r,a);return l.setWidth=o,l.setHeight=n,l}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){const{fontSize:i,fontFamily:s,color:a,text:o}=t,n=e.getContext("2d");n.font=`${i}px ${s}`,n.fillStyle=a,n.textAlign="left";return n.measureText(o).width}static drawText(e,t,i,s){const{xScale:a}=i,[o,n]=s,{text:r,fontSize:l,fontFamily:h,color:d,textAlign:c,icon:u}=t;let p;if(r||"number"==typeof r||u)if(r&&u)console.warn("BasicLabel Warning:text和icon不要同时设置");else{if(p=r,e.font=`${l*a}px ${h}`,e.fillStyle=d,e.textAlign=c||"left",e.textBaseline="top",u){let e=u;-1!==u.indexOf("&")&&(e=u.replace("&","&")),-1!==u.indexOf("&")&&(e=u.replace("&","&")),p=new Function('return ("'+`${e}`.replace("&#x","\\u").replace(";","")+'")')()}e.measureText(p).width,e.fillText(p,o,n)}}static addActiveArea(e,t){const{width:i,height:s}=t,{x:a,y:o}=e,n=new m({depthTest:!0,depthWrite:!1,transparent:!0,sizeAttenuation:!0,opacity:0}),r=new g(n);return r.scale.set(i,s,1),r.material.color=new h("#58d2d4"),r.center.set(a,o),r}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 Xe extends Te{constructor(e){super(e),this.type="Cone"}}class Ke extends Te{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashCar"}}class Qe extends Te{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashCarCrash"}}class Ze extends Te{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:100}){super(e),this.type="FlashPeople"}}class et extends Te{constructor(e){super(e),this.type="Cylinder"}}class tt extends Te{constructor(e){super(e),this.type="Decal"}toJSON(e=!0){if(this.animateJson){const{From:e,To:t}=this.animateJson;if(e&&e.scale){const{x:t,z:i}=e.scale;e.scale.x=i,e.scale.z=t}if(t&&t.scale){const{x:e,z:i}=t.scale;t.scale.x=i,t.scale.z=e}}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}: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 it extends Te{constructor(e){super(e),this.type="Plane"}}class st extends Te{constructor(e){super(e),this.type="QuadPyramid"}}class at extends Te{constructor(e){super(e),this.type="Sphere"}}class ot extends Te{constructor(e){super(e),this.type="TrafficCone"}}class nt extends Te{constructor(e){super(e),this.type="Circle"}}class rt extends Te{constructor(e){super(e),this.type="Torus"}}class lt extends Te{constructor(e){super(e),this.type="Tube"}}class ht extends Te{constructor(e){super(e),this.type="DiamondSign"}}class dt extends Te{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=a.clamp(e.duration||1,0,100),this.data=e.data;const t=e.particle||{};let i,s=t.bound||{x:100,y:100,z:0},o=t.scaleBoxXY||1,n=t.noiseStrength||0,r=t.grayPower||1,l=parseInt(t.countX,10)||400,h=parseInt(t.countY,10)||400;this.particleMaxHeight=t.maxHeight||0,"noiseMap"in t&&(this.noiseMap=i=t.noiseMap,ve(i)||be(i,(e=>{e&&(this.noiseMap=i=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 s},set:function(e){e&&"particle"===this.kind&&(s.x=e.x,s.y=e.y,s.z=e.z,this.matrixNeedsUpdate=!0)}},scaleBoxXY:{enumerable:!0,get:function(){return o},set:function(e){console.log(e,o,this.kind),e!==o&&"particle"===this.kind&&(o=e,this.matrixNeedsUpdate=!0)}},noiseStrength:{enumerable:!0,get:function(){return n},set:function(e){e!==n&&"particle"===this.kind&&(n=e,this.matrixNeedsUpdate=!0)}},grayPower:{configurable:!0,enumerable:!0,get:function(){return r},set:function(e){e!==r&&"particle"===this.kind&&(r=e,this.matrixNeedsUpdate=!0)}},countX:{configurable:!0,enumerable:!0,get:function(){return l},set:function(e){e!==l&&"particle"===this.kind&&(l=parseInt(e,10),this.matrixNeedsUpdate=!0)}},countY:{configurable:!0,enumerable:!0,get:function(){return h},set:function(e){e!==h&&"particle"===this.kind&&(h=parseInt(e,10),this.matrixNeedsUpdate=!0)}}})}init(){if("particle"===this.kind&&this.data.length<2)return void console.error("数据量过少,无法绘制粒子热力图");const i=function(e,t,i,s,a,o){if(!e||e.length<1)return!1;let n=1/0,r=-1/0,l={longitude:1/0,latitude:1/0},h={longitude:-1/0,latitude:-1/0};for(let a=0,o=e.length;a<o;a++){let o=s?e[a][s]:e[a].value;n=Math.min(o,n),r=Math.max(o,r),t&&(e[a].x=e[a][t]),i&&(e[a].y=e[a][i]),s&&(e[a].value=e[a][s]),e[a].longitude&&e[a].latitude&&(l.longitude=Math.min(l.longitude,e[a].longitude),l.latitude=Math.min(l.latitude,e[a].latitude),h.longitude=Math.max(h.longitude,e[a].longitude),h.latitude=Math.max(h.latitude,e[a].latitude))}if(e[0].longitude&&e[0].latitude){if(!e[0].hasOwnProperty("x")&&!e[0].hasOwnProperty("y"))for(let t=0,i=e.length;t<i;t++){const i=h.longitude-l.longitude,s=h.latitude-l.latitude;e[t].x=Math.round(a*(e[t].longitude-l.longitude)/i),e[t].y=Math.round(o*(e[t].latitude-l.latitude)/s)}return{min:n,max:r,bbox:{min:l,max:h}}}return{min:n,max:r}}(this.data,this.xName,this.yName,this.valueName,this.width,this.height);if(i&&(void 0===this.min&&(this.min=i.min),void 0===this.max&&(this.max=i.max),i.bbox)){if(!this.center){const 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}}if(!this.size&&"particle"!==this.kind){const 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}let s=this.data,a=this.max,o=this.min;if(this.heatmapInstance)this.heatmapInstance.configure(this.getConfig()),this.heatmapInstance.setData({max:a,min:o,data:s}),this.heatmapInstance.repaint();else{this.container||(this.container=ct(this.width,this.height));const e=function(e){if(!e)return!1;const t=e.container||ct(e);let i=x.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});return i}(this.getConfig());e&&(this.heatmapInstance=e,this.heatmapInstance.setData({max:a,min:o,data:s}))}this.canvas||(this.canvas=this.container.children[0]),this.texture=xe(this.canvas),this.materialNeedsUpdate=!0,this.center||(this.center=new t(0,0,10)),"particle"!==this.kind&&(this.size||(this.size=new e(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=a.clamp(e,.1,100)),this.init()}getGeojsonData(){if(this.container&&this.heatmapInstance){var e;const t=(this.maxHeight-this.minHeight)/(this.max-this.min),i=this.heatmapInstance._renderer._palette,s=[],a=this.size.x/this.width,o=this.size.y/this.height,n=1/256,r=null===(e=this.heatmapInstance)||void 0===e?void 0:e.getData().data;for(let e=0,l=r.length;e<l;e++){const 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)*t+this.minHeight,u=Math.floor((d-this.min)/(this.max-this.min)*252),p=r[e].radius,m={r:i[4*u]*n,g:i[4*u+1]*n,b:i[4*u+2]*n};if(c<1)continue;const g={type:"Feature",properties:{id:e,height:c,color:m,xSize:p,ySize:p},geometry:{type:"Point",coordinates:[a*(l-.5*this.width)/1e5,o*(h-.5*this.height)/1e5]}};s.push(g)}return s}return!1}toJSON(e=!0){if(e&&this.visibleNeedsUpdate&&(!this.visible||!this.materialNeedsUpdate))return{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};if("texture"===this.kind.toLowerCase())return{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};if("particle"===this.kind.toLowerCase())return{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};const t=this.getGeojsonData();return{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:t}}}function ct(e,t){const i=document.createElement("div");i.style.width=e?e+"px":"512px",i.style.height=t?t+"px":"512px",i.style.top="0px",i.style.display="none";return document.getElementsByTagName("body")[0].appendChild(i),i}class ut extends Te{constructor(e={}){super(e),this.renderNum=void 0===e.renderNum?20:e.renderNum,this.type="Particle";let t=e.kind||_.FIRE_SMALL,i=e.spawnRate||30,s=e.brightness||3,o=e.lifeTime||1;const n=new h(1,0,1);e.brightnessColor&&(n.r=a.clamp(e.brightnessColor.r,0,1),n.g=a.clamp(e.brightnessColor.g,0,1),n.b=a.clamp(e.brightnessColor.b,0,1));let r=e.speed||5,l=e.height||200,d=e.width||.01,c=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:()=>n,set:e=>{e&&(n.r=e.r,n.g=e.g,n.b=e.b,n.a=1,this.materialNeedsUpdate=!0)}},speed:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},height:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},width:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}},zVelocity:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{c=e,this.materialNeedsUpdate=!0}},lifeTime:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}}})}setData(e){this.data=ge(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 pt extends ne{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 ne,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 t,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 mt extends Me{constructor(e={}){super(e),this.name=e.name||"",this.type="FastRoadCondition",this.colors=e.colors||{1:(new h).setStyle("#00ff00"),2:(new h).setStyle("#ffff00"),3:(new h).setStyle("#ff0000"),4:(new h).setStyle("#ff00ff")}}setData(e,t="condition"){this.data=me(e),this.data.forEach((e=>{const i=e.properties[t],s=this.colors[i]||this.colors[1];e.properties.color={r:s.r,g:s.g,b:s.b,a:s.a||1}}))}}class gt extends ne{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 s=e.coneColor||new h(1,1,1),a=e.groundColor||new h(1,1,1),n=e.fenceColor||new h(1,1,1);let r=e.brightness||0,l=e.roughness||1,d=e.metallic||0;this.coneMap=e.coneMap||null,this.groundMap=e.groundMap||null,this.fenceMap=e.fenceMap||null,this.fenceHeight=e.fenceHeight||1;let c=e.coneOpacity||s.a||1,u=e.groundOpacity||a.a||1,p=e.fenceOpacity||n.a||1;const m=e.bloomColor||null,g=e.position||new t,f=e.rotation||new o,y=new i,b=e.scale||new t(1,1,1),x=e.coneScale||new t(1,1,1),v=e.offset||new t(0,0,0);let S=!1;f._onChange((function(){y.setFromEuler(f,!1),this.matrixNeedsUpdate=!0})),y._onChange((function(){f.setFromQuaternion(y,void 0,!1),this.matrixNeedsUpdate=!0})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g.x=e.x,g.y=e.y,g.z=e.z,this.matrixNeedsUpdate=!0)}},rotation:{configurable:!0,enumerable:!0,value:f},quaternion:{configurable:!0,enumerable:!0,value:y},scale:{configurable:!0,enumerable:!0,get:()=>b,set:e=>{e&&(b.x=e.x,b.y=e.y,b.z=e.z,this.matrixNeedsUpdate=!0)}},coneScale:{configurable:!0,enumerable:!0,get:()=>x,set:e=>{e&&(x.x=e.x,x.y=e.y,x.z=e.z,this.matrixNeedsUpdate=!0)}},offset:{configurable:!0,enumerable:!0,get:()=>v,set:e=>{e&&(v.x=e.x,v.y=e.y,v.z=e.z,this.matrixNeedsUpdate=!0)}},coneColor:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.r=e.r,s.g=e.g,s.b=e.b,e.a&&(c=e.a),this.materialNeedsUpdate=!0)}},groundColor:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a.r=e.r,a.g=e.g,a.b=e.b,e.a&&(u=e.a),this.materialNeedsUpdate=!0)}},fenceColor:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n.r=e.r,n.g=e.g,n.b=e.b,e.a&&(p=e.a),this.materialNeedsUpdate=!0)}},coneOpacity:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{c=e,this.materialNeedsUpdate=!0}},groundOpacity:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{u=e,this.materialNeedsUpdate=!0}},fenceOpacity:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{p=e,this.materialNeedsUpdate=!0}},brightness:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{void 0!==e&&(r=e,this.materialNeedsUpdate=!0)}},roughness:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},metallic:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}},bloomColor:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{e&&(m.copy(e),this.materialNeedsUpdate=!0)}},transparent:{configurable:!0,enumerable:!0,get:()=>S,set:e=>{S=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 Oe,this.add(this.ground),this.fence=new Me,this.add(this.fence),this.cone=new ot,this.add(this.cone)}setData(e,t=!0){this.data=me(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 ft extends Te{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(e=!0){return!e||!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?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 yt extends ne{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 i=e.deviceAutoUpdate||!1,s=Math.max(1,e.deviceAutoUpdateInterval||2),a=void 0===e.renderNum?15:e.renderNum,o=void 0===e.searchMode?"coord":e.searchMode,n=void 0===e.tileLevel?16:e.tileLevel,r=void 0!==e.rtEnable&&e.rtEnable,l=e.rtUrl,h=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 t,Object.defineProperties(this,{deviceAutoUpdate:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.messageNeedsUpdate=!0)}},deviceAutoUpdateInterval:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=Math.max(e,2),this.messageNeedsUpdate=!0)}},renderNum:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.messageNeedsUpdate=!0)}},searchMode:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.messageNeedsUpdate=!0)}},tileLevel:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e,this.messageNeedsUpdate=!0)}},rtEnable:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.messageNeedsUpdate=!0}},rtUrl:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l=e,this.messageNeedsUpdate=!0)}},rtTilelLevel:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=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}},i=e.params;if(void 0!==i.opacity&&(i.color.a=i.opacity),i.color&&(t.config.material.Color={r:i.color.r,g:i.color.g,b:i.color.b,a:i.color.a||1}),i.brightnessColor&&(t.config.material.BrightnessColor={r:i.brightnessColor.r,g:i.brightnessColor.g,b:i.brightnessColor.b,a:1}),i.text){const e=Ce(i.text,i.textStyle);t.config.material.Texture=xe(e)}else i.map&&(ve(i.map)?t.config.material.Texture=i.map:be(i.map,(e=>{e&&(t.config.material.Texture=e)})));void 0!==i.metallic&&(t.config.material.Metallic=i.metallic),void 0!==i.roughness&&(t.config.material.Roughness=i.roughness),void 0!==i.brightness&&(t.config.material.Brightness=i.brightness),i.position&&(t.config.transform||(t.config.transform={}),t.config.transform.Location={x:i.position.x,y:i.position.y,z:i.position.z}),i.scale&&(t.config.transform||(t.config.transform={}),t.config.transform.Scale={x:i.scale.x,y:i.scale.y,z:i.scale.z}),i.rotation&&(t.config.transform||(t.config.transform={}),t.config.transform.Rotation={x:i.rotation.x,y:i.rotation.y,z:i.rotation.z}),void 0!==i.scroll&&(t.config.scroll=a.clamp(i.scroll,-1,1)),void 0!==i.speed&&(t.config.speed=i.speed),void 0!==i.animationIndex&&(t.config.animationIndex=i.animationIndex),void 0!==i.animationLoop&&(t.config.animationLoop=i.animationLoop),void 0!==i.animationSpeed&&(t.config.animationSpeed=i.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){const 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 bt extends Te{constructor(e={color:{r:0,g:1,b:0,a:1},brightness:1,speed:.2}){super(e),this.type="Radar"}}class xt extends Te{constructor(e={color:{r:1,g:0,b:0,a:1},brightness:1,speed:2}){super(e),this.type="Ripple"}}class vt extends Te{constructor(e){super(e),this.type="Soil"}}class St extends Te{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 Nt extends Te{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 Ut extends Te{constructor(e){super(e),this.type="TriangleWarning"}}class wt extends Te{constructor(e){super(e),this.type="Bucket"}}class Ct extends Te{constructor(e){super(e),this.type="InundationAnalysis"}}class Tt extends Te{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 Ot extends Te{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 zt extends Te{constructor(e){super(e),this.type="CarPark";const i=e.position||new t;let s=e.rotation||new o;const n=e.scale||new t(1,1,1),r=e.color||{r:1,g:1,b:1,a:1};var l;Object.defineProperties(this,{position:{enumerable:!0,get:function(){return i},set:e=>{e&&(i.x=e.x,i.y=e.y,i.z=e.z,this.matrixNeedsUpdate=!0)}},rotation:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s.x=a.clamp(e.x,-180,180),s.y=a.clamp(e.y,-180,180),s.z=a.clamp(e.z,-180,180),this.matrixNeedsUpdate=!0)}},scale:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n.x=e.x,n.y=e.y,n.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:()=>r,set:e=>{e&&(r.r=e.r,r.g=e.g,r.b=e.b,r.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=i,this.rotation=s,this.scale=n,this.modelType=(l=e.modelType,isNaN(l)||l<3||l>6&&l<12||l>16?3:l),this.speed=Number(e.speed)||36,this.endState=e.endState||!1,this.color=r,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}}}class Rt extends ne{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 i=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 t,Object.defineProperties(this,{brightness:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=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 Et extends Te{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};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;let i=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 It extends ne{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 i=e.url,s=e.header,a=void 0===e.labelRenderScale?1:e.labelRenderScale,o=void 0===e.labelRenderType?1:e.labelRenderType,n=void 0===e.labelBrightness?1:e.labelBrightness,r=void 0===e.followMode?"Third":e.followMode;this.followRotation=void 0===e.followRotation?{Roll:!1,Pitch:!1,Yaw:!0}:e.follow;let l=void 0===e.followZoom?0:e.followZoom,h=void 0!==e.switchScale&&e.switchScale,d=void 0===e.minViewPortHeight?30:e.minViewPortHeight,c=void 0===e.maxViewPortHeight?300:e.maxViewPortHeight,u=void 0===e.minScale?1:e.minScale,p=void 0===e.maxScale?2:e.maxScale,m=void 0===e.controlTypeList?[]:e.controlTypeList,g=void 0!==e.predictionEnable&&e.predictionEnable,f=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 t,Object.defineProperties(this,{url:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e,this.messageNeedsUpdate=!0)}},header:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.messageNeedsUpdate=!0)}},labelRenderScale:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e,this.materialNeedsUpdate=!0)}},labelBrightness:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e,this.materialNeedsUpdate=!0)}},predictionLineStyle:{configurable:!0,enumerable:!0,get:()=>f,set:e=>{e&&(f=e,this.materialNeedsUpdate=!0)}},labelRenderType:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=e,this.materialNeedsUpdate=!0)}},predictionEnable:{configurable:!0,enumerable:!0,get:()=>g,set:e=>{e&&(g=e,this.materialNeedsUpdate=!0)}},followMode:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e,this.followNeedsUpdate=!0)}},followZoom:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{e&&(l=e,this.materialNeedsUpdate=!0)}},switchScale:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e,this.materialNeedsUpdate=!0)}},minViewPortHeight:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{e&&(d=e,this.materialNeedsUpdate=!0)}},maxViewPortHeight:{configurable:!0,enumerable:!0,get:()=>c,set:e=>{e&&(c=e,this.materialNeedsUpdate=!0)}},minScale:{configurable:!0,enumerable:!0,get:()=>u,set:e=>{e&&(u=e,this.materialNeedsUpdate=!0)}},maxScale:{configurable:!0,enumerable:!0,get:()=>p,set:e=>{e&&(p=e,this.materialNeedsUpdate=!0)}},controlTypeList:{configurable:!0,enumerable:!0,get:()=>m,set:e=>{m=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 Mt extends Te{constructor(e){super(e),this.type="QuadPyramidTop"}}class At extends Te{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=ge(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:Ve(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 Dt extends Te{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 Pt extends Te{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 Lt=[{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 kt extends Te{constructor(e={}){super(e),this.type="SlopeAnalysis";let t=e.range||null,i=_t(e.minAngle,!0),s=_t(e.maxAngle,!1),a=Bt(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=_t(e,!0),this.materialNeedsUpdate=!0}},maxAngle:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=_t(e,!1),this.materialNeedsUpdate=!0}},colorRange:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=Bt(e),this.materialNeedsUpdate=!0}},useSlopeAnalysis:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,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 Bt(e){if(e&&e instanceof Object){let t=0,i=0;for(const s in e)i=s,t++;if(0===i)return{25:Lt[0],40:Lt[1],55:Lt[2],70:Lt[3],80:Lt[4],90:Lt[5]};for(let s=t;s<6;s++)i<25?(i=40,e[i]=Lt[1]):i<40.00001?(i=55,e[i]=Lt[2]):i<55.00001?(i=70,e[i]=Lt[3]):i<70.00001?(i=80,e[i]=Lt[4]):i<80.00001?(i=90,e[i]=Lt[5]):i<90.00001?(i=91,e[i]=Lt[5]):(i+=s,e[i]=Lt[5]);return e}return{25:Lt[0],40:Lt[1],55:Lt[2],70:Lt[3],80:Lt[4],90:Lt[5]}}function _t(e=0,t=!0){return t?e<=0?0:e:e<=0?90:e}class Ft extends Te{constructor(e={}){super(e),this.pointType="pointType"in e?e.pointType.toLowerCase():"iconpoint";const t=e.pointStyle||{};t.renderType=0,t.openCollision=!1,this.pointJSON=Wt(this.pointType,t),this.clusterStyle=e.clusterStyle||{};for(const e in this.clusterStyle){const t=this.clusterStyle[e];this.clusterStyle[e]=Wt(this.pointType,t)}let i=e.minPixelDistance||100;this.type="ClusterPoint",Object.defineProperties(this,{minPixelDistance:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{let t=Number(e);t&&i!==t&&(i=t,this.materialNeedsUpdate=!0)}}})}setData(e){this.data=ge(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 Wt(e,t){let i;switch(e){case"basiclabel":i=new qe(t).toJSON();case"iconpoint":i=new Je(t).toJSON();case"textpoint":i=new $e(t).toJSON();default:i=new Je(t).toJSON()}return t.clusterText&&(i.ClusterText=t.clusterText),i}class Ht extends ne{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.visible=void 0===e.visible||e.visible}}class jt extends Ht{constructor(e){super(e),this.type="UserInfoLightLayer";let i=e.url,s=e.header,a=void 0===e.brightness?1:e.brightness,o=void 0===e.lightAltitude?1:e.lightAltitude,n=void 0===e.renderScale?1:e.renderScale,r=void 0===e.renderTilesNum?3:e.renderTilesNum,l=void 0===e.updateCheckInterval?2:e.updateCheckInterval,h=void 0===e.maxUpdateHeight?1e3:e.maxUpdateHeight,d=void 0===e.centerDetectDistance?3e3:e.centerDetectDistance;this.guidingLine={enable:!0,color:{r:.171441,g:.223228,b:.376262}},e.guidingLine&&(this.guidingLine.enable=void 0===e.guidingLine.enable||e.guidingLine.enable,this.guidingLine.color=void 0===e.guidingLine.color?{r:.171441,g:.223228,b:.376262}:e.guidingLine.color),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 t,Object.defineProperties(this,{url:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{i=e,this.materialNeedsUpdate=!0}},header:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{s=e,this.materialNeedsUpdate=!0}},lightAltitude:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{o=e,this.materialNeedsUpdate=!0}},renderScale:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{n=e,this.materialNeedsUpdate=!0}},renderTilesNum:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{r=e,this.materialNeedsUpdate=!0}},updateCheckInterval:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e,this.materialNeedsUpdate=!0}},centerDetectDistance:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{d=e,this.materialNeedsUpdate=!0}},brightness:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{a=e,this.materialNeedsUpdate=!0}},maxUpdateHeight:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{h=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,GuidingLine:this.guidingLine,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 Gt extends Me{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 Vt extends Te{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=ge(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}}class Jt extends Ht{constructor(e={}){super(e),this.name=e.name||"",this.type="LargeRoadCondition",this.defaultColors={1:{r:.015625,g:0,b:0,a:1},2:{r:.043403,g:.001204,b:.001635,a:1},3:{r:.078125,g:.058385,b:0,a:1},4:{r:207e-6,g:.109375,b:0,a:1}};let i=e.roadGeoJsonUrl||"",s=e.roadConditionUrl||"",a=e.layerGroupName||"",o=void 0===e.heightOffset?.7:e.heightOffset,n=void 0===e.camFOV?90:e.camFOV,r=void 0===e.aspectRatio?1:e.aspectRatio,l=e.colors||this.defaultColors,h=this.validateColors(l)?l:this.defaultColors,d=this.getValidBrightnessList(e.brightnessList);this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.offset=new t,Object.defineProperties(this,{roadGeoJsonUrl:{enumerable:!0,get:function(){return i},set:function(e){e&&(i=e,this.materialNeedsUpdate=!0)}},roadConditionUrl:{enumerable:!0,get:function(){return s},set:function(e){e&&(s=e,this.materialNeedsUpdate=!0)}},layerGroupName:{enumerable:!0,get:function(){return a},set:function(e){e&&(a=e,this.materialNeedsUpdate=!0)}},heightOffset:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{void 0!==e&&(o=e,this.materialNeedsUpdate=!0)}},camFOV:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{void 0!==e&&(n=e,this.materialNeedsUpdate=!0)}},aspectRatio:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{void 0!==e&&(r=e,this.materialNeedsUpdate=!0)}},colors:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{void 0!==e&&(h=this.validateColors(e)?e:this.defaultColors,this.materialNeedsUpdate=!0)}},brightnessList:{configurable:!0,enumerable:!0,get:()=>d,set:e=>{void 0!==e&&(d=this.getValidBrightnessList(e),this.materialNeedsUpdate=!0)}}})}getValidBrightnessList(e){return Array.isArray(e)&&4===e.length&&this.allElementsGreaterThanZero(e)?e:[15,15,15,15]}allElementsGreaterThanZero(e){return e.every((function(e){return"number"==typeof e&&e>=0}))}validateColors(e){if("object"!=typeof e||null===e)return console.error("Invalid color format: Colors should be a non-null object."),!1;for(const t in this.defaultColors)if(this.defaultColors.hasOwnProperty(t)){if(!e.hasOwnProperty(t))return console.error(`Missing color key: ${t}`),!1;const i=e[t];if(!this.isValidColorComponent(i))return console.error(`Invalid color components at key: ${t}`),!1}return!0}isValidColorComponent(e){if("object"!=typeof e||null===e)return!1;const{r:t,g:i,b:s,a:a}=e;return this.isNumberInRange(t)&&this.isNumberInRange(i)&&this.isNumberInRange(s)&&this.isNumberInRange(a)}isNumberInRange(e){return"number"==typeof e&&e>=0&&e<=1}dispose(){return!1}toJSON(e=!0){return{RoadGeoJsonUrl:this.roadGeoJsonUrl,LayerGroupName:this.layerGroupName,RoadConditionUrl:this.roadConditionUrl,HeightOffset:this.heightOffset,CamFOV:this.camFOV,AspectRatio:this.aspectRatio,Colors:this.colors,BrightnessList:this.brightnessList,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}}}const $t={version:"2.4.5",name:"CloudRenderEngine",author:["liran23"]};class Yt extends ne{constructor(e){super(e),this.type="IndoorMap",this.url=e.url,this.mpoi="",this.floor=999,this.floorList=[];let i=e.layeringHeight||500,s=e.layeringBaseHeight||300;this.messageNeedsUpdate=!1,this.materialNeedsUpdate=!1,this.matrixNeedsUpdate=!1,this.animateNeedsUpdate=!1,this.offset=new t,Object.defineProperties(this,{layeringHeight:{enumerable:!0,get:function(){return i},set:function(e){e!==i&&(i=e,this.materialNeedsUpdate=!0)}},layeringBaseHeight:{enumerable:!0,get:function(){return s},set:function(e){e!==s&&(s=e,this.materialNeedsUpdate=!0)}}})}dispose(){return!1}async getIndoorDataByCenter(e,t=500){const i=this._getBoundingBox(e,t);return await this._requestDataList(i.minLng,i.minLat,i.maxLng,i.maxLat)}async _requestDataList(e,t,i,s){var a,o;const n=`http://${this.url}/indoor/query/?minX=${e}&minY=${t}&maxX=${i}&maxY=${s}`,r=await b.get(n);var l;return 0!==(null==r||null===(a=r.data)||void 0===a?void 0:a.status)?(console.error((null==r||null===(l=r.data)||void 0===l?void 0:l.message)||"获取室内数据失败"),[]):null===(o=r.data)||void 0===o?void 0:o.indoor}_getBoundingBox(e,t=500){const i=t/111e3,s=t/(111320*Math.cos(e.lat*Math.PI/180));return{minLat:e.lat-i,maxLat:e.lat+i,minLng:e.lng-s,maxLng:e.lng+s}}openIndoor(e){console.log("params --\x3e ",e);const{mpoi:t="",floor:i=0,floorList:s=[],buildingCenter:a={}}=e;this.mpoi=t,this.floor=i,this.floorList=s,this.buildingCenter=a,this.materialNeedsUpdate=!0}closeIndoor(){this.mpoi="close",this.floor="",this.materialNeedsUpdate=!0}convertFloorString(e){if(e.startsWith("B"))return-parseInt(e.substring(1),10);if(e.startsWith("F"))return parseInt(e.substring(1),10);throw new Error("Invalid floor string")}convertFloorStringToArray(e){return e.split("|").map((e=>{if(e.startsWith("B"))return-parseInt(e.substring(1),10);if(e.startsWith("F"))return parseInt(e.substring(1),10);throw new Error("Invalid floor string")}))}hideBuildings(e){if(Array.isArray(e)){if((e=de(e)).sort(((e,t)=>e-t)),e.length===this.floorList.length)this.floor=999;else{let t=this.floorList.filter((t=>!e.includes(t)));this.floor=t[t.length-1]}this.eventName="Hide",this.floorNum=e,this.animateNeedsUpdate=!0}else console.error("hideBuildings numbers必须为数组")}showBuildings(e){Array.isArray(e)?((e=de(e)).sort(((e,t)=>e-t)),this.eventName="Show",this.floorNum=e,this.floor=e[e.length-1],this.animateNeedsUpdate=!0):console.error("showBuildings numbers必须为数组")}toJSON(e=!0){return{Url:this.url,Mpoi:this.mpoi,Floor:this.floor,LayeringHeight:this.layeringHeight,LayeringBaseHeight:this.layeringBaseHeight,BuildingCenter:this.buildingCenter,FloorNum:this.floorNum,FloorList:this.floorList,EventName:this.eventName,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,messageNeedsUpdate:this.messageNeedsUpdate,animateNeedsUpdate:this.animateNeedsUpdate,type:this.type,uuid:this.uuid}}}class qt extends Te{constructor(e={}){super(e);const t=["Video","Picture"];let i=void 0===e.cityList?[]:e.cityList,s=void 0===e.event?"":e.event,a=void 0===e.folderName?"RenderResult":e.folderName,o=void 0===e.renderMode?"Video":e.renderMode,n=void 0===e.sceneBrightness?7:e.sceneBrightness,r=void 0===e.operateData?[]:e.operateData,l=void 0===e.brightness?0:e.brightness,h=void 0===e.renderFrame?60:e.renderFrame;Object.defineProperties(this,{renderMode:{configurable:!0,enumerable:!0,get:()=>o,set:e=>{e&&(o=t.includes(e)?e:"Video")}},renderFrame:{configurable:!0,enumerable:!0,get:()=>h,set:e=>{e&&(h=e)}},sceneBrightness:{configurable:!0,enumerable:!0,get:()=>n,set:e=>{e&&(n=e)}},operateData:{configurable:!0,enumerable:!0,get:()=>r,set:e=>{e&&(r=e)}},brightness:{configurable:!0,enumerable:!0,get:()=>l,set:e=>{void 0!==e&&(l=e)}},cityList:{configurable:!0,enumerable:!0,get:()=>i,set:e=>{e&&(i=e)}},event:{configurable:!0,enumerable:!0,get:()=>s,set:e=>{e&&(s=e,this.materialNeedsUpdate=!0)}},folderName:{configurable:!0,enumerable:!0,get:()=>a,set:e=>{e&&(a=e)}}})}changeRenderMode(e){this.renderMode=e}changeRenderFrame(e){this.renderFrame=e,this.event="ChangeRenderFrame"}changeCityColor(e){this.cityList=e,this.event="ColorChange"}changeHeatmapCoefficient(e,t){this.cityList=e,this.operateData=[t],this.event="CoefficientChange"}changeSceneBrightness(e){this.sceneBrightness=e,this.event="changeSceneBrightness"}changeBrightness(e){this.brightness=e,this.event="changeBrightness"}renderResult(e,t){this.folderName=t,this.cityList=e,this.event="Render"}visAll(){this.operateData=[],this.event="VisAll"}previewAll(){this.operateData=[],this.event="Preview"}previewSingleCity(e,t){this.cityList=e;const i=this.cityList.map((e=>e.CityName)),s=i.indexOf(t);-1!==s?s!==i.length-1?(this.operateData=[t,i[s+1]],this.event="Preview"):console.warn("非法参数,最后一个城市不能预览"):console.warn("没有该城市数据")}focusCity(e){this.operateData=[e],this.event="Focus"}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},Brightness:this.brightness,SceneBrightness:this.sceneBrightness,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},OperateData:this.operateData,FolderName:this.folderName,RenderFrame:this.renderFrame,RenderMode:this.renderMode,CityList:this.cityList,Opacity:this.opacity,Event:this.event,type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible}}copy(e,t=!0){return super.copy(e,t),this}}class Xt extends qt{constructor(e={}){super(e),this.roadGeoJsonUrl=e.roadGeoJsonUrl,this.roadConditionUrl=e.roadConditionUrl,this.type="EarthRoadCondition"}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},RoadConditionUrl:this.roadConditionUrl,RenderFrame:this.renderFrame,RenderMode:this.renderMode,RoadGeoJsonUrl:this.roadGeoJsonUrl,FolderName:this.folderName,CityList:this.cityList,Event:this.event,type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible}}copy(e,t=!0){return super.copy(e,t),this}}class Kt extends qt{constructor(e={}){super(e),this.type="EarthCityRank"}changeRenderFrame(e){this.renderFrame=e,this.event="ChangeRenderFrame"}changeCityColor(e){this.cityList=e,this.event="ColorChange"}renderResult(e,t){this.folderName=t,this.cityList=e,this.event="Render"}visAll(){this.operateData=[],this.event="VisAll"}previewAll(){this.operateData=[],this.event="Preview"}previewSingleCity(e,t){this.cityList=e;const i=this.cityList.map((e=>e.CityName)),s=i.indexOf(t);-1!==s?s!==i.length-1?(this.operateData=[t,i[s+1]],this.event="Preview"):console.warn("非法参数,最后一个城市不能预览"):console.warn("没有该城市数据")}focusCity(e){this.operateData=[e],this.event="Focus"}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},OperateData:this.operateData,FolderName:this.folderName,RenderFrame:this.renderFrame,RenderMode:this.renderMode,CityList:this.cityList,Opacity:this.opacity,Event:this.event,type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible}}copy(e,t=!0){return super.copy(e,t),this}}class Qt extends qt{constructor(e={}){super(e),this.type="EarthCityHeatMap"}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},Brightness:this.brightness,SceneBrightness:this.sceneBrightness,Offset:{x:this.offset.x,y:this.offset.y,z:this.offset.z},OperateData:this.operateData,FolderName:this.folderName,RenderFrame:this.renderFrame,RenderMode:this.renderMode,CityList:this.cityList,Opacity:this.opacity,Event:this.event,type:this.type,uuid:this.uuid,matrixNeedsUpdate:this.matrixNeedsUpdate,materialNeedsUpdate:this.materialNeedsUpdate,visible:this.visible}}copy(e,t=!0){return super.copy(e,t),this}}export{yt as AssetLayer,It as AutonomousVehicleLayer,qe as BasicLabel,wt as Bucket,zt as CarPark,nt as Circle,He as CloudRenderEngine,Ft as ClusterPoint,F as CommonConstant,Xe as Cone,gt as ConstructionLayer,De as Cube,et as Cylinder,tt as Decal,St as Diamond,ht as DiamondSign,Ke as FlashCar,Qe as FlashCarCrash,Ze as FlashPeople,dt as Heatmap,ft as I3DTileLayer,Je as IconPoint,Yt as IndoorMap,jt as InfoLightLayer,Ct as Inundation,Jt as LargeRoadCondition,Dt as LayerBuilding,Vt as Light,Me as Line,Pt as MockCarStream,Ge as ODLine,ut as Particle,it as Plane,Ae as Point,Oe as Polygon,st as QuadPyramid,Mt as QuadPyramidTop,bt as Radar,xt as Ripple,mt as RoadCondition,Et as RoadName,Gt as RoutePlan,Qt as SequencerEarthCityHeatmap,Kt as SequencerEarthCityRank,Xt as SequencerEarthRoadCondition,Te as Shape,Tt as Skyline,kt as SlopeAnalysis,vt as Soil,at as Sphere,$e as TextPoint,rt as Torus,ot as TrafficCone,pt as TrafficLayer,Rt as TrafficLightLayer,Nt as TrafficShape,Ut as TriangleWarning,lt as Tube,W as UltralDynamicSky,$t as VersionInfo,Ot as VisualField,At as WebViewPoint,xe as convertCanvas2Base64,we as drawCanvas,Ce as drawTextToImage,be as loadImageAsBase64};
|