earthsdk3-ue 3.5.0-beta.13 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -88,7 +88,7 @@ Msg: ${e}`;console.warn(t)}};g.verboseLogLevel=5,function(r){r.LIST_STREAMERS="l
|
|
|
88
88
|
void main() {
|
|
89
89
|
gl_FragColor = texture2D(u_image, v_texCoord);
|
|
90
90
|
}
|
|
91
|
-
`}}class Ja{static deepCopyGamepad(A){return JSON.parse(JSON.stringify({buttons:A.buttons.map(e=>JSON.parse(JSON.stringify({pressed:e.pressed,touched:e.touched}))),axes:A.axes}))}}class Zd{constructor(A){this.toStreamerMessagesProvider=A,this.controllers=[]}updateStatus(A,e,t){if(A.gamepad){const n=e.getPose(A.gripSpace,t);if(!n)return;let s=0;A.profiles.includes("htc-vive")?s=1:A.profiles.includes("oculus-touch")&&(s=2),this.toStreamerMessagesProvider.toStreamerHandlers.get("XRSystem")([s]);let i=2;switch(A.handedness){case"left":i=0;break;case"right":i=1}const o=n.transform.matrix,a=[];for(let u=0;u<16;u++)a[u]=new Float32Array([o[u]])[0];this.toStreamerMessagesProvider.toStreamerHandlers.get("XRControllerTransform")([a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15],i]),this.controllers[i]===void 0&&(this.controllers[i]={prevState:void 0,currentState:void 0,id:void 0},this.controllers[i].prevState=Ja.deepCopyGamepad(A.gamepad)),this.controllers[i].currentState=Ja.deepCopyGamepad(A.gamepad);const l=this.controllers[i],d=l.currentState,h=l.prevState;for(let u=0;u<d.buttons.length;u++){const f=d.buttons[u],B=h.buttons[u];f.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([i,u,B.pressed?1:0]):!f.pressed&&B.pressed&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([i,u,0]),f.touched&&!f.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([i,3,B.touched?1:0]):!f.touched&&B.touched&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([i,3,0])}for(let u=0;u<d.axes.length;u++)this.toStreamerMessagesProvider.toStreamerHandlers.get("XRAnalog")([i,u,d.axes[u]]);this.controllers[i].prevState=d}}}class za{constructor(A){this.xrSession=null,this.webRtcController=A,this.xrControllers=[],this.xrGamepadController=new Zd(this.webRtcController.streamMessageController),this.onSessionEnded=new EventTarget,this.onSessionStarted=new EventTarget,this.onFrame=new EventTarget}xrClicked(){this.xrSession?this.xrSession.end():navigator.xr.requestSession("immersive-vr").then(A=>{this.onXrSessionStarted(A)})}onXrSessionEnded(){g.Log(g.GetStackTrace(),"XR Session ended"),this.xrSession=null,this.onSessionEnded.dispatchEvent(new Event("xrSessionEnded"))}onXrSessionStarted(A){g.Log(g.GetStackTrace(),"XR Session started"),this.xrSession=A,this.xrSession.addEventListener("end",()=>{this.onXrSessionEnded()});const e=document.createElement("canvas");this.gl=e.getContext("webgl2",{xrCompatible:!0}),this.xrSession.updateRenderState({baseLayer:new XRWebGLLayer(this.xrSession,this.gl)});const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,Xa.vertexShader()),this.gl.compileShader(t);const n=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(n,Xa.fragmentShader()),this.gl.compileShader(n);const s=this.gl.createProgram();this.gl.attachShader(s,t),this.gl.attachShader(s,n),this.gl.linkProgram(s),this.gl.useProgram(s),this.positionLocation=this.gl.getAttribLocation(s,"a_position"),this.texcoordLocation=this.gl.getAttribLocation(s,"a_texCoord"),this.positionBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),this.gl.enableVertexAttribArray(this.positionLocation);const i=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.texcoordBuffer=this.gl.createBuffer(),this.resolutionLocation=this.gl.getUniformLocation(s,"u_resolution"),this.offsetLocation=this.gl.getUniformLocation(s,"u_offset"),A.requestReferenceSpace("local").then(o=>{this.xrRefSpace=o,this.xrSession.requestAnimationFrame((a,l)=>this.onXrFrame(a,l))}),this.onSessionStarted.dispatchEvent(new Event("xrSessionStarted"))}onXrFrame(A,e){const t=e.getViewerPose(this.xrRefSpace);if(t){const n=t.transform.matrix,s=[];for(let o=0;o<16;o++)s[o]=new Float32Array([n[o]])[0];this.webRtcController.streamMessageController.toStreamerHandlers.get("XRHMDTransform")([s[0],s[4],s[8],s[12],s[1],s[5],s[9],s[13],s[2],s[6],s[10],s[14],s[3],s[7],s[11],s[15]]);const i=this.xrSession.renderState.baseLayer;this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,i.framebuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.webRtcController.videoPlayer.getVideoElement()),this.render(this.webRtcController.videoPlayer.getVideoElement())}this.webRtcController.config.isFlagEnabled(Q.XRControllerInput)&&this.xrSession.inputSources.forEach((n,s,i)=>{this.xrGamepadController.updateStatus(n,e,this.xrRefSpace)},this),this.xrSession.requestAnimationFrame((n,s)=>this.onXrFrame(n,s)),this.onFrame.dispatchEvent(new ya({time:A,frame:e}))}render(A){if(!this.gl)return;const e=this.xrSession.renderState.baseLayer;let t,n,s,i,o;this.gl.viewport(0,0,e.framebufferWidth,e.framebufferHeight),this.gl.uniform4f(this.offsetLocation,1,1,0,0),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,A.videoWidth,0,0,A.videoHeight,0,A.videoHeight,A.videoWidth,0,A.videoWidth,A.videoHeight]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),t=2,n=this.gl.FLOAT,s=!1,i=0,o=0,this.gl.vertexAttribPointer(this.positionLocation,t,n,s,i,o),this.gl.enableVertexAttribArray(this.texcoordLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),t=2,n=this.gl.FLOAT,s=!1,i=0,o=0,this.gl.vertexAttribPointer(this.texcoordLocation,t,n,s,i,o),this.gl.uniform2f(this.resolutionLocation,A.videoWidth,A.videoHeight);const a=this.gl.TRIANGLES;o=0,this.gl.drawArrays(a,o,6)}static isSessionSupported(A){return navigator.xr?navigator.xr.isSessionSupported(A):new Promise(()=>!1)}}class qd{constructor(A){this.editTextButton=null,this.hiddenInput=null,"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(A)}unquantizeAndDenormalizeUnsigned(A,e){return null}createOnScreenKeyboardHelpers(A){this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.id="hiddenInput",this.hiddenInput.maxLength=0,A.appendChild(this.hiddenInput)),this.editTextButton||(this.editTextButton=document.createElement("button"),this.editTextButton.id="editTextButton",this.editTextButton.innerHTML="edit text",A.appendChild(this.editTextButton),this.editTextButton.classList.add("hiddenState"),this.editTextButton.addEventListener("touchend",e=>{this.hiddenInput.focus(),e.preventDefault()}))}showOnScreenKeyboard(A){if(A.showOnScreenKeyboard){this.editTextButton.classList.remove("hiddenState");const e=this.unquantizeAndDenormalizeUnsigned(A.x,A.y);this.editTextButton.style.top=e.y.toString()+"px",this.editTextButton.style.left=(e.x-40).toString()+"px"}else this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur()}}class jd{constructor(A,e){this._showActionOrErrorOnDisconnect=!0,this.allowConsoleCommands=!1,this.config=A,e!=null&&e.videoElementParent&&(this._videoElementParent=e.videoElementParent),this._eventEmitter=new Ia,this.configureSettings(),this.setWebRtcPlayerController(new Wa(this.config,this)),this.onScreenKeyboardHelper=new qd(this.videoElementParent),this.onScreenKeyboardHelper.unquantizeAndDenormalizeUnsigned=(t,n)=>this._webRtcController.requestUnquantizedAndDenormalizeUnsigned(t,n),this._activateOnScreenKeyboard=t=>this.onScreenKeyboardHelper.showOnScreenKeyboard(t),this._webXrController=new za(this._webRtcController)}get videoElementParent(){return this._videoElementParent||(this._videoElementParent=document.createElement("div"),this._videoElementParent.id="videoElementParent"),this._videoElementParent}configureSettings(){this.config._addOnSettingChangedListener(Q.IsQualityController,A=>{A!==!0||this._webRtcController.isQualityController||this._webRtcController.sendRequestQualityControlOwnership()}),this.config._addOnSettingChangedListener(Q.AFKDetection,A=>{this._webRtcController.setAfkEnabled(A)}),this.config._addOnSettingChangedListener(Q.MatchViewportResolution,()=>{this._webRtcController.videoPlayer.updateVideoStreamSize()}),this.config._addOnSettingChangedListener(Q.HoveringMouseMode,A=>{this.config.setFlagLabel(Q.HoveringMouseMode,`Control Scheme: ${A?"Hovering":"Locked"} Mouse`),this._webRtcController.setMouseInputEnabled(this.config.isFlagEnabled(Q.MouseInput))}),this.config._addOnSettingChangedListener(Q.KeyboardInput,A=>{this._webRtcController.setKeyboardInputEnabled(A)}),this.config._addOnSettingChangedListener(Q.MouseInput,A=>{this._webRtcController.setMouseInputEnabled(A)}),this.config._addOnSettingChangedListener(Q.TouchInput,A=>{this._webRtcController.setTouchInputEnabled(A)}),this.config._addOnSettingChangedListener(Q.GamepadInput,A=>{this._webRtcController.setGamePadInputEnabled(A)}),this.config._addOnNumericSettingChangedListener(b.MinQP,A=>{g.Log(g.GetStackTrace(),"-------- Sending MinQP --------",7),this._webRtcController.sendEncoderMinQP(A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(b.MaxQP,A=>{g.Log(g.GetStackTrace(),"-------- Sending encoder settings --------",7),this._webRtcController.sendEncoderMaxQP(A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(b.WebRTCMinBitrate,A=>{g.Log(g.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMinBitrate(1e3*A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(b.WebRTCMaxBitrate,A=>{g.Log(g.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMaxBitrate(1e3*A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(b.WebRTCFPS,A=>{g.Log(g.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCFps(A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnOptionSettingChangedListener(_.PreferredCodec,A=>{this._webRtcController&&this._webRtcController.setPreferredCodec(A)}),this.config._registerOnChangeEvents(this._eventEmitter)}_activateOnScreenKeyboard(A){throw new Error("Method not implemented.")}_onInputControlOwnership(A){this._inputController=A}setWebRtcPlayerController(A){this._webRtcController=A,this._webRtcController.setPreferredCodec(this.config.getSettingOption(_.PreferredCodec).selected),this._webRtcController.resizePlayerStyle(),this.checkForAutoConnect()}connect(){this._eventEmitter.dispatchEvent(new Ba),this._webRtcController.connectToSignallingServer()}reconnect(){this._eventEmitter.dispatchEvent(new wa),this._webRtcController.restartStreamAutomatically()}disconnect(){this._eventEmitter.dispatchEvent(new fa),this._webRtcController.close()}play(){this._onStreamLoading(),this._webRtcController.playStream()}checkForAutoConnect(){this.config.isFlagEnabled(Q.AutoConnect)&&(this._onWebRtcAutoConnect(),this._webRtcController.connectToSignallingServer())}_onWebRtcAutoConnect(){this._eventEmitter.dispatchEvent(new sa),this._showActionOrErrorOnDisconnect=!0}_onWebRtcSdp(){this._eventEmitter.dispatchEvent(new na)}_onStreamLoading(){this._eventEmitter.dispatchEvent(new ga)}_onDisconnect(A){this._webRtcController.getDisconnectMessageOverride()!=""&&this._webRtcController.getDisconnectMessageOverride()!==void 0&&this._webRtcController.getDisconnectMessageOverride()!=null&&(A=this._webRtcController.getDisconnectMessageOverride(),this._webRtcController.setDisconnectMessageOverride("")),this._eventEmitter.dispatchEvent(new la({eventString:A,showActionOrErrorOnDisconnect:this._showActionOrErrorOnDisconnect})),this._showActionOrErrorOnDisconnect==0&&(this._showActionOrErrorOnDisconnect=!0)}_onWebRtcConnecting(){this._eventEmitter.dispatchEvent(new ia)}_onWebRtcConnected(){this._eventEmitter.dispatchEvent(new oa)}_onWebRtcFailed(){this._eventEmitter.dispatchEvent(new aa)}_onVideoInitialized(){this._eventEmitter.dispatchEvent(new ha),this._videoStartTime=Date.now()}_onLatencyTestResult(A){this._eventEmitter.dispatchEvent(new Ua({latencyTimings:A}))}_onVideoStats(A){this._videoStartTime&&this._videoStartTime!==void 0||(this._videoStartTime=Date.now()),A.handleSessionStatistics(this._videoStartTime,this._inputController,this._webRtcController.videoAvgQp),this._eventEmitter.dispatchEvent(new Fa({aggregatedStats:A}))}_onVideoEncoderAvgQP(A){this._eventEmitter.dispatchEvent(new ra({avgQP:A}))}_onInitialSettings(A){var e;this._eventEmitter.dispatchEvent(new Ea({settings:A})),A.PixelStreamingSettings&&(this.allowConsoleCommands=(e=A.PixelStreamingSettings.AllowPixelStreamingCommands)!==null&&e!==void 0&&e,this.allowConsoleCommands===!1&&g.Info(g.GetStackTrace(),"-AllowPixelStreamingCommands=false, sending arbitrary console commands from browser to UE is disabled."));const t=this.config.useUrlParams,n=new URLSearchParams(window.location.search);A.EncoderSettings&&(this.config.setNumericSetting(b.MinQP,t&&n.has(b.MinQP)?Number.parseInt(n.get(b.MinQP)):A.EncoderSettings.MinQP),this.config.setNumericSetting(b.MaxQP,t&&n.has(b.MaxQP)?Number.parseInt(n.get(b.MaxQP)):A.EncoderSettings.MaxQP)),A.WebRTCSettings&&(this.config.setNumericSetting(b.WebRTCMinBitrate,t&&n.has(b.WebRTCMinBitrate)?Number.parseInt(n.get(b.WebRTCMinBitrate)):A.WebRTCSettings.MinBitrate/1e3),this.config.setNumericSetting(b.WebRTCMaxBitrate,t&&n.has(b.WebRTCMaxBitrate)?Number.parseInt(n.get(b.WebRTCMaxBitrate)):A.WebRTCSettings.MaxBitrate/1e3),this.config.setNumericSetting(b.WebRTCFPS,t&&n.has(b.WebRTCFPS)?Number.parseInt(n.get(b.WebRTCFPS)):A.WebRTCSettings.FPS))}_onQualityControlOwnership(A){this.config.setFlagEnabled(Q.IsQualityController,A)}_onPlayerCount(A){this._eventEmitter.dispatchEvent(new Sa({count:A}))}requestLatencyTest(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendLatencyTest(),!0)}requestShowFps(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendShowFps(),!0)}requestIframe(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendIframeRequest(),!0)}emitUIInteraction(A){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.emitUIInteraction(A),!0)}emitCommand(A){return!(!this._webRtcController.videoPlayer.isVideoReady()||!this.allowConsoleCommands&&"ConsoleCommand"in A||(this._webRtcController.emitCommand(A),0))}emitConsoleCommand(A){return!(!this.allowConsoleCommands||!this._webRtcController.videoPlayer.isVideoReady()||(this._webRtcController.emitConsoleCommand(A),0))}addResponseEventListener(A,e){this._webRtcController.responseController.addResponseEventListener(A,e)}removeResponseEventListener(A){this._webRtcController.responseController.removeResponseEventListener(A)}dispatchEvent(A){return this._eventEmitter.dispatchEvent(A)}addEventListener(A,e){this._eventEmitter.addEventListener(A,e)}removeEventListener(A,e){this._eventEmitter.removeEventListener(A,e)}toggleXR(){this.webXrController.xrClicked()}setSignallingUrlBuilder(A){this._webRtcController.signallingUrlBuilder=A}get webSocketController(){return this._webRtcController.webSocketController}get webXrController(){return this._webXrController}}T.Dz,T.g$,T.Lt,T.Q9,T.qf,T.hV,T.z$,T.J0;var Ya=T.De;T.$C,T.al,T._W,T.tz,T.Nu,T.zg,T.vp;var pe=T.vU;T.wF,T.rv,T.Nh,T.ss,T.qW,T.QL,T.cf,T.eM;var $a=T.Yd;T.iM,T.qy,T.ce;var Za=T.sK;T.Ok,T.q5;var qa=T.g;T.xl,T.I,T.bx,T.dD,T.Ib,T.Az,T.Iw,T.qY,T.db,T.mR,T.Tn,T.rV,T.gh,T.Mi,T.j,T.YB,T.i5;var Au=T.x_;T.Am,T.eR,T.r8,T.u3,T.vd,T.iV,T.jZ,T.SW,T.ZH,T.Ni,T.lh,T.bq,T.$f,T.eu,T.Ax,T.Mc;const eu={Response:1},Ur={UIInteraction:50,MouseWheel:75};class tu extends c.HasOwner{constructor(e,t){super(e);p(this,"_processResponseFn",e=>this.esUeViewer.processResponse(e));p(this,"_inner");this._uri=t,this._inner=new WebSocket(this._uri),this.d(()=>{this._inner.close()}),this._innerInit()}get esUeViewer(){return this.owner}get uri(){return this._uri}get inner(){return this._inner}_innerInit(){this.inner.onmessage=e=>{if(this.isDestroyed())return;let t=new FileReader;t.onload=n=>{if(this.isDestroyed())return;let s=n.target.result,i=new Uint32Array(s),o=0;if(i[0]===eu.Response){o+=4;let a=i[o/4];o+=4;for(let l=0;l<a;l++){let d=i[o/4];o+=4;let h=new TextDecoder("utf-8").decode(s.slice(o,o+d));o+=d,this._processResponseFn(h)}}},t.readAsArrayBuffer(e.data)},this.inner.onopen=()=>{this.isDestroyed()||(console.warn("earthsdk message websocket server connected:",this.uri),console.log("%c[EarthSDK websocket open]","background: #a6ec99; color: black","open"),this.owner.dispatchEvent(new CustomEvent("esmsgwsopen",{detail:"websocket open"})))},this._inner.onclose=e=>{this.isDestroyed()||(console.log("%c[EarthSDK websocket close ]","background: red; color: black","error"),this.owner.dispatchEvent(new CustomEvent("error",{detail:"websocket close"})))},this._inner.onerror=e=>{this.isDestroyed()||(console.log("%c[EarthSDK websocket error ]","background: red; color: black","error"),this.owner.dispatchEvent(new CustomEvent("error",{detail:"websocket error"})))}}sendInputData(e){const t=this.inner;if(t.readyState!==WebSocket.OPEN)return;const s=new Uint8Array(e)[0];if(s>=Ur.UIInteraction&&s<=Ur.MouseWheel){const i=new ArrayBuffer(e.byteLength+4);return new DataView(i).setUint32(0,e.byteLength,!0),new Uint8Array(i,4).set(new Uint8Array(e)),t.send(new DataView(i)),!0}else return!1}emitDescriptorWithString(e,t){let n=new TextEncoder().encode(t),s=new DataView(new ArrayBuffer(3+n.length)),i=0;s.setUint8(i,e),i++,s.setUint16(i,n.length,!0),i+=2;for(let o=0;o<n.length;o++)s.setUint8(i,n[o]),i+=1;try{this.sendInputData(s.buffer)}catch(o){console.error(`data.buffer.size: ${s.buffer.byteLength} 独立通道 sendInputData error: ${o}`,o)}}destroyImpl(){this._inner&&this._inner.close()}}window.g_emitDescriptor_maxBytes=3e4;let ru=-1;$a.SetLoggerVerbosity(1);class nu extends c.Destroyable{constructor(e,t){super();p(this,"_eventTarget",new EventTarget);p(this,"debug",!1);p(this,"uiInteractionCallbacks",new Map);p(this,"_pixelStream");p(this,"_esMsgWsWrapper");this._domOrDomId=e,this._options=t;const n=typeof this._domOrDomId=="string"?document.getElementById(this._domOrDomId):this._domOrDomId;if(!n)throw new Error(`ESUEViewer container${this._domOrDomId} error!`);console.log(`PSUEViewer init _options ${this._options}`);const{url:s,esmsgWsUri:i}=this._options;this._pixelStream=this._initPixelStream(n,s),this.d(()=>{this._pixelStream.disconnect()}),this._handerPixelStreamEvent(),this._esMsgWsWrapper=this._initEsMsgWsWrapper(i);const o=this;if(o.esMsgWsWrapper){const a=o.webRtcController.sendMessageController.dataChannelSender.sendData;o.webRtcController.sendMessageController.dataChannelSender.constructor.prototype.sendData=function(l){o.esMsgWsWrapper?o.esMsgWsWrapper.sendInputData(l):a.call(this,l)}}}get eventTarget(){return this._eventTarget}addEventListener(e,t,n){return this.eventTarget.addEventListener(e,t,n)}removeEventListener(e,t,n){return this.eventTarget.removeEventListener(e,t,n)}dispatchEvent(e){return this.eventTarget.dispatchEvent(e)}_initPixelStream(e,t){const n=new Ya({initialSettings:{AutoPlayVideo:!0,AutoConnect:!0,StartVideoMuted:!1,SuppressBrowserKeys:!1,[Au.SignallingServerUrl]:t}});return n.setFlagEnabled(pe.BrowserSendOffer,!1),n.setFlagEnabled(pe.HoveringMouseMode,!0),n.setFlagEnabled(pe.MatchViewportResolution,!0),n.setNumericSetting(Za.MaxReconnectAttempts,0),new qa(n,{videoElementParent:e})}get pixelStream(){return this._pixelStream}_initEsMsgWsWrapper(e){return e?this.dv(new tu(this,e)):void 0}get esMsgWsWrapper(){return this._esMsgWsWrapper}get esWebSocketReady(){var e;return((e=this.esMsgWsWrapper)==null?void 0:e.inner.readyState)===1}_handerPixelStreamEvent(){this.pixelStream.addEventListener("videoInitialized",()=>{console.log("%c[EarthSDK webrtc videoInitialized]","background: #a6ec99; color: black","videoInitialized"),this.dispatchEvent(new CustomEvent("videoinited",{detail:"videoinited"}))}),this.pixelStream.addEventListener("webRtcFailed",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webRtc webRtcFailed]","background: red; color: black","webRtcFailed"),this.dispatchEvent(new CustomEvent("error",{detail:"webRtcFailed"})),this.pixelStream.disconnect())}),this.pixelStream.addEventListener("webRtcDisconnected",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webRtc webRtcDisconnected]","background: red; color: black","webRtcDisconnected"),this.dispatchEvent(new CustomEvent("error",{detail:"webRtcDisconnected"})),this.pixelStream.disconnect())}),this.pixelStream.addEventListener("webRtcConnected",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webrtc webRtcConnected]","background: #a6ec99; color: black","webRtcConnected"),this.dispatchEvent(new CustomEvent("webRtcConnected",{detail:"webRtcConnected"})))}),this.pixelStream.addResponseEventListener("esueviewer",e=>{this.processResponse(e)})}resolveCallback(e){let t={};try{t=JSON.parse(e)}catch{return!1}let n=t.callid;if(typeof n!="string"||!this.uiInteractionCallbacks.has(n))return!1;let s=this.uiInteractionCallbacks.get(n);return typeof s!="function"?!1:(s(t),this.uiInteractionCallbacks.delete(n),!0)}processResponse(e){if(this.debug??!1)try{const t=JSON.parse(e);if(t.ers=t.ers&&t.ers.filter(n=>n.et!=="mouseMoveEvent"),!(t.ers&&t.ers.length>0||t.frs&&t.frs.length>0))return;console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}this.resolveCallback(e)||this.dispatchEvent(new CustomEvent("ueevent",{detail:e}))}emitUIInteraction(e,t){typeof t=="function"&&(e.callid=c.createGuid(),this.uiInteractionCallbacks.set(e.callid,t)),this.pixelStream.emitUIInteraction(e)}get webRtcController(){return this.pixelStream._webRtcController}emitUIInteractionForBigData(e,t){typeof t=="function"&&(e.callid=c.createGuid(),this.uiInteractionCallbacks.set(e.callid,t));const n=JSON.stringify(e),s=window.g_emitDescriptor_maxBytes,i=n.length,o=++ru;if(this.esMsgWsWrapper){if(i<s){this.esMsgWsWrapper.emitDescriptorWithString(Ur.UIInteraction,`${o}-0/1-`+n);return}const a=Math.ceil(i/s)|0;[...new Array(a).keys()].map(d=>n.slice(d*s,(d+1)*s)).forEach((d,h)=>{this.esMsgWsWrapper&&this.esMsgWsWrapper.emitDescriptorWithString(Ur.UIInteraction,`${o}-${h}/${a}-`+d)})}}emitCommand(e){this.pixelStream.emitCommand(e)}getVideoSize(){const e=this.webRtcController.videoPlayer.getVideoElement();return{width:e.videoWidth,height:e.videoHeight}}resizeUEVideo(e,t){let n={Resolution:{Width:e,Height:t}};console.log(`resizeUEVideo emitCommand ${e} ${t} begin`),this.emitCommand(n)}}class su extends c.Destroyable{constructor(e,t,n){super();p(this,"_instance");p(this,"_event",this.dv(new c.Event));this._container=e,this._wsuri=t,this._esmsgWsUri=n,this._instance=this.dv(new nu(this._container,{url:this._wsuri,esmsgWsUri:this._esmsgWsUri})),this.instanceInit()}get webSocketReady(){return this._instance.esWebSocketReady}get event(){return this._event}get debug(){return this._instance.debug}set debug(e){this._instance.debug=e}instanceInit(){if("addEventListener"in this._instance){["esmsgwsopen","error","videoinited","ueevent","webRtcConnected"].forEach(t=>{const n=s=>{this._event.emit(t,s.detail)};this._instance.addEventListener(t,n),this.dispose(()=>this._instance.removeEventListener(t,n))});return}this.dispose(this._instance.errorEvent.disposableOn(e=>{this._event.emit("error",e.detail)})),this.dispose(this._instance.webRtcConnectedEvent.disposableOn(e=>{this._event.emit("webRtcConnected",e.detail)})),this.dispose(this._instance.videoinitedEvent.disposableOn(e=>{this._event.emit("videoinited",e.detail)})),this.dispose(this._instance.ueevent.disposableOn(e=>{this._event.emit("ueevent",e.detail)}))}emitUIInteractionForBigData(e,t){return new Promise((n,s)=>{const i=(...o)=>{n(o),t&&t(...o)};try{this._instance.emitUIInteractionForBigData(e,i)}catch(o){console.warn(`emitUIInteraction发生错误:${o}`),s(o)}})}getVideoSize(){return this._instance.getVideoSize()}resize(e,t){this._instance.resizeUEVideo(e,t)}}class iu extends Ve{constructor(e,t,n,s){super();p(this,"_esueViewerWrapper");p(this,"_ueFuncResultWithIdsEvent",this.dv(new c.Event));p(this,"_ueFuncWithIdAndResultCallbacks",[]);p(this,"_waitingUeFuncIdAndResultCallbacks",new Map);p(this,"_waitingUeCalls",new Set);p(this,"_ueEvent",this.dv(new c.Event));p(this,"_errorEvent",this.dv(new c.Event));p(this,"_readyEvent",this.dv(new c.Event));p(this,"_esmsgwsopen",this.dv(c.react(!1)));p(this,"_videoinited",this.dv(c.react(!1)));p(this,"_webRtcConnected",this.dv(c.react(!1)));this._ueViewer=s,console.log("CSTMPSViewer init ! 以官方像素流 + 独立通信的模式启动!");const i=this._ueViewer;this._esueViewerWrapper=this.dv(new su(e,t,n));const o=this._esueViewerWrapper;{const f=()=>o.debug=i.debug??!1;f(),this.d(i.debugChanged.don(f))}let a=!1;{const f=()=>{if(a)return;const B=o.webSocketReady;if(this.videoinited&&this.webRtcConnected&&B){console.log("%c[EarthSDK: esmsgWebSocket && videoinited && webRtcConnected]","background: #a6ec99; color: black");const w={eventType:"init",params:{}};o.emitUIInteractionForBigData(w),this._readyEvent.emit(),a=!0}};this.d(this.videoinitedChanged.don(()=>{f()})),this.d(this.webRtcConnectedChanged.don(()=>{f()})),this.d(this.esmsgwsopenChanged.don(()=>{f()}))}this.d(o.event.don((f,B)=>{if(f==="error")this._errorEvent.emit(B);else if(f==="ueevent"){const w=JSON.parse(B);if(w.t==="cr"){const v=w;if(v.frs&&this._ueFuncResultWithIdsEvent.emit(v.frs),v.ers)for(let m of v.ers)this._ueEvent.emit(m)}}else f==="webRtcConnected"?this.webRtcConnected=!0:f==="videoinited"?this.videoinited=!0:f==="esmsgwsopen"&&(this.esmsgwsopen=!0)}));{const f=this.dv(c.createAnimateFrame());let B,w;f.start(()=>{if(B!==e.offsetWidth||w!==e.offsetHeight){if(B=e.offsetWidth,w=e.offsetHeight,B===void 0||w===void 0||!Number.isFinite(B)||!Number.isFinite(w)||B<0||w<0){console.warn(`lastWidth === undefined || lastHeight === undefined || !Number.isFinite(lastWidth) || !Number.isFinite(lastHeight) || lastWidth < 0 || lastHeight < 0 ${B} ${w}`);return}o.resize(B,w),console.log(`resize: ${B} ${w}`)}})}this.d(this._ueFuncResultWithIdsEvent.don(f=>{for(const B of f){const w=this._waitingUeFuncIdAndResultCallbacks.get(B.fid);w&&(this._waitingUeFuncIdAndResultCallbacks.delete(B.fid),w.resultCallback(B.r))}}));let l=0;const d=f=>{const B={n:l++,tt:Date.now(),t:"c",fs:f};this._waitingUeCalls.add(B),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(B,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd()),this._esueViewerWrapper.emitUIInteractionForBigData(B,()=>{this._waitingUeCalls.delete(B)})},h=()=>{if(!a||this._ueFuncWithIdAndResultCallbacks.length===0)return;const f=this._ueFuncWithIdAndResultCallbacks.map(([B])=>B);for(const[B,w]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(B.fid,w);this._ueFuncWithIdAndResultCallbacks.length=0;{const B=window.g_emitDescriptor_maxBytes,w=f.map(H=>({f:H,s:JSON.stringify(H).length}));let v=w.length,m=0,F=0,E=[];do{do{const{f:H,s:S}=w[m];if(E.push(H),++m,F+S>B||E.length>=20)break}while(m<v);E.length>0&&(i.debug&&console.log(`传送${E.length}条消息...`),d([...E]),E.length=0,F=0)}while(m<v)}};this.dv(c.createInterval()).start(h,50),this.d(()=>console.log("UeCloudViewer正在销毁..."))}get esueViewerWrapper(){return this._esueViewerWrapper}get errorEvent(){return this._errorEvent}get readyEvent(){return this._readyEvent}get esmsgwsopen(){return this._esmsgwsopen.value}set esmsgwsopen(e){this._esmsgwsopen.value=e}get esmsgwsopenChanged(){return this._esmsgwsopen.changed}get videoinited(){return this._videoinited.value}set videoinited(e){this._videoinited.value=e}get videoinitedChanged(){return this._videoinited.changed}get webRtcConnected(){return this._webRtcConnected.value}set webRtcConnected(e){this._webRtcConnected.value=e}get webRtcConnectedChanged(){return this._webRtcConnected.changed}resize(e,t){this.esueViewerWrapper.resize(e,t)}callUeFunc(e){return new Promise(t=>{const s={fid:c.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,{timeStamp:Date.now(),ueFunc:e,resultCallback:t}])})}disposableOnUeEvent(e,t){(this._ueViewer.debug??!1)&&console.log(`disposableOnUeEvent from UeCloudViewer, type:${e}`);const n=c.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.don(o=>{o.et===e&&o.eid===n&&t(o)});return()=>{i(),s()}}}function ou(r){let A="";const e=new Uint8Array(r),t=e.length;for(let n=0;n<t;n++)A+=String.fromCharCode(e[n]);return btoa(A)}const au=r=>{const A={type:"input",inputdata:ou(r)};return JSON.stringify(A)};function lu(r){return typeof r=="string"?document.getElementById(r):r}window.g_emitDescriptor_maxBytes=3e4,console.log("全局可设置消息体最大字节, window.g_emitDescriptor_maxBytes 默认 30000 。");let cu=-1;$a.SetLoggerVerbosity(1);class du extends c.Destroyable{constructor(e,t){super();p(this,"debug",!1);p(this,"_error",this.dv(new c.Event));p(this,"_connected",this.dv(new c.Event));p(this,"_ueevent",this.dv(new c.Event));p(this,"_pixelStream");p(this,"uiInteractionCallbacks",new Map);this._container=e,this._option=t;const n=new Ya({initialSettings:{HoveringMouse:!0,AutoPlayVideo:!0,AutoConnect:!0,StartVideoMuted:!1,SuppressBrowserKeys:!1,ss:this._option.ws},useUrlParams:!0});n.setFlagEnabled(pe.BrowserSendOffer,!1),n.setFlagEnabled(pe.HoveringMouseMode,!0),n.setFlagEnabled(pe.MatchViewportResolution,!0),n.setNumericSetting(Za.MaxReconnectAttempts,0),this._pixelStream=new qa(n,{videoElementParent:this.container}),this.d(()=>{this._pixelStream.disconnect()});{const s=this.pixelStream.webSocketController.webSocket,i=this._pixelStream._webRtcController.sendMessageController.dataChannelSender.sendData;this._pixelStream._webRtcController.sendMessageController.dataChannelSender.constructor.prototype.sendData=function(o){s?s.send(au(o)):i.call(this,o)}}{const s=i=>{const o=this._pixelStream._webRtcController.mouseController;setTimeout(()=>{const a=o.coordinateConverter.normalizeAndQuantizeUnsigned(i.offsetX,i.offsetY),d=o.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp");d&&d([i.button,a.x,a.y]),i.preventDefault()})};this.container.addEventListener("dblclick",s),this.d(()=>{this.container.removeEventListener("dblclick",s)})}["error","close","open"].forEach(i=>{const o=()=>{this.isDestroyed()||(i==="open"?this.connected.emit("webSocketOpen"):i==="close"?this.error.emit("webSocketClose"):i==="error"&&this.error.emit("webSocketError"))};this.pixelStream.webSocketController.webSocket.addEventListener(i,o),this.d(()=>{this.pixelStream.webSocketController.webSocket.removeEventListener(i,o)})}),["videoInitialized","webRtcConnected","webRtcDisconnected","webRtcFailed"].forEach(i=>{const o=()=>{this.isDestroyed()||(i==="webRtcConnected"||i==="videoInitialized"?this.connected.emit(i):(i==="webRtcDisconnected"||i==="webRtcFailed")&&(this.error.emit(i),this.pixelStream.disconnect()))};this.pixelStream.addEventListener(i,o),this.d(()=>{this.pixelStream.removeEventListener(i,o)})}),this.pixelStream.addResponseEventListener("handle_responses",s=>{this.processResponse(s)}),this.d(()=>{this.pixelStream.removeResponseEventListener("handle_responses")})}get error(){return this._error}get connected(){return this._connected}get ueevent(){return this._ueevent}get container(){return lu(this._container)}get pixelStream(){return this._pixelStream}get webSocketReady(){return this.pixelStream.webSocketController.webSocket.readyState===1}processResponse(e){if(this.debug??!1)try{const t=JSON.parse(e);console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}this.resolveCallback(e)||this.ueevent.emit(e)}emitUIInteractionForBigData(e,t){typeof t=="function"&&(e.callid=c.createGuid(),this.uiInteractionCallbacks.set(e.callid,t));const n=JSON.stringify(e),s=window.g_emitDescriptor_maxBytes??3e4,i=n.length,o=++cu;if(i<s){const d={type:"earthsdk",time:new Date().getTime(),params:`${o}-0/1-`+n};this.sendData(JSON.stringify(d));return}const a=Math.ceil(i/s)|0;[...new Array(a).keys()].map(d=>n.slice(d*s,(d+1)*s)).forEach((d,h)=>{const u={type:"earthsdk",time:new Date().getTime(),params:`${o}-${h}/${a}-`+d};this.sendData(JSON.stringify(u))})}sendData(e){this.pixelStream.webSocketController.webSocket.send(e)}resolveCallback(e){let t={};try{t=JSON.parse(e)}catch{return!1}let n=t.callid;if(typeof n!="string"||!this.uiInteractionCallbacks.has(n))return!1;let s=this.uiInteractionCallbacks.get(n);return typeof s!="function"?!1:(s(t),this.uiInteractionCallbacks.delete(n),!0)}getVideoSize(){const e=this._pixelStream._webRtcController.videoPlayer.getVideoElement();return{width:e.videoWidth,height:e.videoHeight}}emitCommand(e){this.pixelStream.emitCommand(e)}emitUIInteraction(){console.log("emitUIInteraction 像素流初始化"),this.pixelStream.emitUIInteraction("像素流初始化")}resizeUEVideo(e,t){const n={Resolution:{Width:e,Height:t}};console.log(`resizeUEVideo emitCommand ${e} ${t} begin`),this.emitCommand(n)}}class uu extends c.Destroyable{constructor(e,t,n){super();p(this,"_instance");p(this,"_event",this.dv(new c.Event));this._container=e,this._wsuri=t,this._esmsgWsUri=n,this._instance=this.dv(new du(this._container,{ws:this._wsuri})),this.d(this._instance.connected.don(s=>{this._event.emit(s,s),console.log(`%c[EarthSDK] ${s}`,"background: #a6ec99; color: black")})),this.d(this._instance.error.don(s=>{this._event.emit("errorEvent",s),console.log(`%c[EarthSDK] ${s}`,"background: red; color: black")})),this.d(this._instance.ueevent.don(s=>{this._event.emit("ueevent",s)}))}get instance(){return this._instance}get event(){return this._event}get debug(){return this._instance.debug}set debug(e){this._instance.debug=e}emitUIInteractionForBigData(e,t){return new Promise((n,s)=>{const i=(...o)=>{n(o),t&&t(...o)};try{this._instance.emitUIInteractionForBigData(e,i)}catch(o){console.warn(`emitUIInteraction发生错误:${o}`),s(o)}})}getVideoSize(){return this._instance.getVideoSize()}resize(e,t){this._instance.resizeUEVideo(e,t)}}class hu extends Ve{constructor(e,t,n,s){super();p(this,"_videoInitialized",this.dv(c.react(!1)));p(this,"_webRtcConnected",this.dv(c.react(!1)));p(this,"_webSocketOpen",this.dv(c.react(!1)));p(this,"_ue5ViewerWrapper");p(this,"_ueFuncResultWithIdsEvent",this.dv(new c.Event));p(this,"_ueFuncWithIdAndResultCallbacks",[]);p(this,"_waitingUeFuncIdAndResultCallbacks",new Map);p(this,"_waitingUeCalls",new Set);p(this,"_ueEvent",this.dv(new c.Event));p(this,"_errorEvent",this.dv(new c.Event));p(this,"_readyEvent",this.dv(new c.Event));this._ueViewer=s,console.log("INNPSViewer init ! 以内置信令服务器模式启动!");const i=this._ueViewer,o=this.dv(new uu(e,t,n));this._ue5ViewerWrapper=o;{const u=()=>o.debug=i.debug??!1;u(),this.d(i.debugChanged.don(u))}{let u=!1;const f=this.dv(c.createNextAnimateFrameEvent(this._videoInitialized.changed,this._webRtcConnected.changed,this._webSocketOpen.changed));this.d(f.don(()=>{if(u)return;const B=this._ue5ViewerWrapper.instance.webSocketReady;if(this.videoInitialized&&this.webRtcConnected&&B){this._ue5ViewerWrapper.instance.emitUIInteraction(),this._readyEvent.emit(),u=!0,console.log("%c[EarthSDK videoInitialized && webRtcConnected && webSocketReady]","background: #a6ec99; color: black");const w={eventType:"init",params:{}};this._ue5ViewerWrapper.emitUIInteractionForBigData(w)}else console.warn("webSocketReady",B),u=!1}))}this.d(o.event.don((u,f)=>{if(u==="errorEvent")this._errorEvent.emit(f);else if(u==="videoInitialized")this._videoInitialized.value=!0;else if(u==="webRtcConnected")this._webRtcConnected.value=!0;else if(u==="webSocketOpen")this._webSocketOpen.value=!0;else if(u==="ueevent"){const B=JSON.parse(f);if(B.t==="cr"){const w=B;if(w.frs&&this._ueFuncResultWithIdsEvent.emit(w.frs),w.ers)for(let v of w.ers)this._ueEvent.emit(v)}}}));{const u=this.dv(c.createAnimateFrame());let f,B,w;u.start(()=>{if(f!==e.offsetWidth||B!==e.offsetHeight||w!==i.resolutionScale){if(f=e.offsetWidth,B=e.offsetHeight,f===void 0||B===void 0||!Number.isFinite(f)||!Number.isFinite(B)||f<0||B<0){console.warn(`lastWidth === undefined || lastHeight === undefined || !Number.isFinite(lastWidth) || !Number.isFinite(lastHeight) || lastWidth < 0 || lastHeight < 0 ${f} ${B}`);return}w=i.resolutionScale,o.resize(f/w,B/w)}})}this.d(this._ueFuncResultWithIdsEvent.don(u=>{for(const f of u){const B=this._waitingUeFuncIdAndResultCallbacks.get(f.fid);B&&(this._waitingUeFuncIdAndResultCallbacks.delete(f.fid),B.resultCallback(f.r))}}));let a=0;const l=u=>{const f={n:a++,tt:Date.now(),t:"c",fs:u};this._waitingUeCalls.add(f),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(f,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd()),this._ue5ViewerWrapper.emitUIInteractionForBigData(f,()=>{this._waitingUeCalls.delete(f)})},d=()=>{if(!this._ue5ViewerWrapper.instance.webSocketReady||this._ueFuncWithIdAndResultCallbacks.length===0)return;const f=this._ueFuncWithIdAndResultCallbacks.map(([B])=>B);for(const[B,w]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(B.fid,w);this._ueFuncWithIdAndResultCallbacks.length=0;{const B=window.g_emitDescriptor_maxBytes,w=f.map(H=>({f:H,s:JSON.stringify(H).length}));let v=w.length,m=0,F=0,E=[];do{do{const{f:H,s:S}=w[m];if(E.push(H),++m,F+S>B||E.length>=20)break}while(m<v);E.length>0&&(i.debug&&console.log(`传送${E.length}条消息...`),l([...E]),E.length=0,F=0)}while(m<v)}};this.dv(c.createInterval()).start(d,50),this.d(()=>console.log("UeCloudViewer正在销毁..."))}get videoInitialized(){return this._videoInitialized.value}get webRtcConnected(){return this._webRtcConnected.value}get webSocketOpen(){return this._webSocketOpen.value}get ue5ViewerWrapper(){return this._ue5ViewerWrapper}get errorEvent(){return this._errorEvent}get readyEvent(){return this._readyEvent}resize(e,t){this.ue5ViewerWrapper.resize(e,t)}callUeFunc(e){return new Promise(t=>{const s={fid:c.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,{timeStamp:Date.now(),ueFunc:e,resultCallback:t}])})}disposableOnUeEvent(e,t){const n=c.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.don(o=>{o.et===e&&o.eid===n&&t(o)});return()=>{i(),s()}}}class gu extends c.Destroyable{constructor(e,t,n,s){super();p(this,"_onRuntimeInitialized",this.dv(new c.Event));p(this,"_vIframe",null);this._ueViewer=s;const i=this._ueViewer;{const o=document.createElement("iframe");this._vIframe=o,o.style.cssText="width: 100%; height: 100%; margin: 0; padding: 0; border: none; outline: none;",e.appendChild(o),this.d(()=>{o&&e.removeChild(o)});const a=c.ESSceneObject.getStrFromEnv(n+`/web/${t}.html`);o.src=a,o.onload=()=>{const l=o.contentWindow;if(!l){console.error("iframeWindow is null");return}console.log("iwindow.Module",l.Module),l.Module.onRuntimeInitialized=()=>{this._onRuntimeInitialized.emit(),i.setStatus("Created"),i.setStatusLog("创建成功"),l.Module.UE4_resizeCanvas(),l.console.log("创建成功__________________________________________")}}}}get onRuntimeInitialized(){return this._onRuntimeInitialized}get vIframe(){return this._vIframe}}const ja=typeof TextDecoder<"u"?new TextDecoder:void 0,Bu=(r,A=0,e=NaN)=>{const t=A+e;let n=A;for(;r[n]&&!(n>=t);)++n;if(n-A>16&&r.buffer&&ja)return ja.decode(r.subarray(A,n));let s="";for(;A<n;){var i=r[A++];if(!(i&128)){s+=String.fromCharCode(i);continue}var o=r[A++]&63;if((i&224)==192){s+=String.fromCharCode((i&31)<<6|o);continue}var a=r[A++]&63;if((i&240)==224?i=(i&15)<<12|o<<6|a:((i&248)!=240&&console.warn("Invalid UTF-8 leading byte encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),i=(i&7)<<18|o<<12|a<<6|r[A++]&63),i<65536)s+=String.fromCharCode(i);else{var l=i-65536;s+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return s};class fu extends c.Destroyable{constructor(A,e,t){super();{const n=()=>{const a=Qn(e);e.setGlobalProperty(a)};n();const s=mr(),i=[];s.forEach(a=>{const l=e[a+"Changed"];i.push(l)});const o=this.dv(c.createNextAnimateFrameEvent(...i));this.d(o.don(n))}this.d(e.propChanged.don(n=>{if(n.objId==="")try{Object.keys(n.props).forEach(s=>{const i=n.props[s]===null?void 0:n.props[s];e[s]=i})}catch(s){console.error("ueViewer propChanged:"+s)}})),e.useCustomInteraction=!1,this.dv(new c.ViewerCustomInteraction(e,A)),this.dv(new c.ObjResettingWithEvent(e.statusUpdateIntervalChanged,n=>{if((e.statusUpdateInterval??.5)===0)return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("statusUpdate",o=>{e.statusUpdateEvent.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.propChangedListeningChanged,()=>{if(!(e.propChangedListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("propChanged",i=>{e.propChanged.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(e.objectEventListeningChanged,()=>{if(!(e.objectEventListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("objectEvent",i=>{e.objectEvent.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(e.widgetEventListeningChanged,()=>{if(!(e.widgetEventListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("widgetEvent",i=>{e.widgetEvent.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(e.speechRecognitionListeningChanged,()=>{if(!(e.speechRecognitionListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("speechRecognition",i=>{e.speechRecognition.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(e.customMessageListeningChanged,()=>{if(!(e.customMessageListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("customMessage",i=>{e.customMessage.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(e.editingEventListeningChanged,()=>{if(!(e.editingEventListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("editingEvent",i=>{i.objectIDs=i.objectIDs.map(o=>{var a;return((a=c.ESSceneObject.getSceneObjById(o))==null?void 0:a.parentID)??o}),e.editingEvent.emit(i)})),s})),this.ad(t.disposableOnUeEvent("cameraChanged",()=>{e.cameraChanged.emit()}))}}let wu=-1;class pu extends Ve{constructor(e,t,n="${earthsdk3-ue-h5-assets-script-dir}",s){super();p(this,"_ueFuncResultWithIdsEvent",this.dv(new c.Event));p(this,"_ueFuncWithIdAndResultCallbacks",[]);p(this,"_waitingUeFuncIdAndResultCallbacks",new Map);p(this,"_waitingUeCalls",new Map);p(this,"_ueEvent",this.dv(new c.Event));this._ueViewer=s;const i=this._ueViewer,o=this.dv(new gu(e,t,n,i));let a=!1,l=null;this.d(o.onRuntimeInitialized.don(()=>{var f;if(a=!0,(f=o==null?void 0:o.vIframe)!=null&&f.contentWindow){l=o.vIframe.contentWindow;const B=o.vIframe.contentWindow.document.getElementById("mainarea");B?this.dv(new fu(B,i,this)):console.error("h5Container is null")}else{console.error("iframeWindow is null");return}l.UE_JSHTML5Communication?l.UE_JSHTML5Communication.UESendMessageToJS=B=>{try{const w=Bu(l.HEAPU8,B),v=JSON.parse(w);if(i.debug&&(console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(v,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()),v.t==="cr"){const m=v;if(m.frs&&this._ueFuncResultWithIdsEvent.emit(m.frs),m.ers)for(let F of m.ers)this._ueEvent.emit(F)}v.callid&&this._waitingUeCalls.has(v.callid)&&(this._waitingUeCalls.delete(v.callid),console.log(`waitingUeCalls.delete:${v.callid} end`))}catch(w){console.error("UE_JSHTML5Communication.UESendMessageToJS error:",w)}}:console.error("UE_JSHTML5Communication UESendMessageToJS not found")})),this.dispose(this._ueFuncResultWithIdsEvent.disposableOn(f=>{for(const B of f){const w=this._waitingUeFuncIdAndResultCallbacks.get(B.fid);w&&(this._waitingUeFuncIdAndResultCallbacks.delete(B.fid),w(B.r))}}));let d=0;const h=()=>{if(!a||!l||!l.UE_JSHTML5Communication||!l.UE_JSHTML5Communication.JSSendMessageToUE||this._ueFuncWithIdAndResultCallbacks.length===0)return;const f=this._ueFuncWithIdAndResultCallbacks.map(([S])=>S),B={n:d++,tt:Date.now(),t:"c",fs:f,callid:c.createGuid()};for(const[S,U]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(S.fid,U);this._ueFuncWithIdAndResultCallbacks.length=0,this._waitingUeCalls.set(B.callid,B),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(B,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd());const w=JSON.stringify(B),v=window.g_emitDescriptor_maxBytes??3e4,m=w.length,F=++wu;if(m<v){const S=`${F}-0/1-`+w;l.UE_JSHTML5Communication.JSSendMessageToUE(S);return}const E=Math.ceil(m/v)|0;[...new Array(E).keys()].map(S=>w.slice(S*v,(S+1)*v)).forEach((S,U)=>{const D=`${F}-${U}/${E}-`+S;l.UE_JSHTML5Communication.JSSendMessageToUE(D)})};this.dv(c.createInterval()).start(h,50)}processResponse(e){if(this._ueViewer.debug??!1)try{const t=JSON.parse(e);console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}}callUeFunc(e){return new Promise(t=>{const s={fid:c.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,t])})}disposableOnUeEvent(e,t){const n=c.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.disposableOn(o=>{o.et===e&&o.eid===n&&((this._ueViewer.debug??!1)&&console.log(`callback, type:${e} eid:${n} ueEvent:${JSON.stringify(o)}`),t(o))});return()=>{i(),s()}}}let Cu=-1;class vu extends Ve{constructor(e,t){super();p(this,"_ueFuncResultWithIdsEvent",this.dv(new c.Event));p(this,"_ueFuncWithIdAndResultCallbacks",[]);p(this,"_waitingUeFuncIdAndResultCallbacks",new Map);p(this,"_waitingUeCalls",new Set);p(this,"_ueEvent",this.dv(new c.Event));this._ueViewer=t;const n=this._ueViewer;let s=!1;const i={eventType:"init",params:{}};window.ue.es.oncommand(JSON.stringify(i)),s=!0,window.calljs=(d,h)=>{if(n.debug&&console.log(`calljs eventName:${d} eventDetailStr:${h}`),d==="ueevent"||d==="commanFinish")try{const u=JSON.parse(h);if(u.t==="cr"){const f=u;if(f.frs&&this._ueFuncResultWithIdsEvent.emit(f.frs),f.ers)for(let B of f.ers)this._ueEvent.emit(B)}}catch(u){console.error(u)}},this.dispose(this._ueFuncResultWithIdsEvent.disposableOn(d=>{for(const h of d){const u=this._waitingUeFuncIdAndResultCallbacks.get(h.fid);u&&(this._waitingUeFuncIdAndResultCallbacks.delete(h.fid),u(h.r))}}));let o=0;const a=()=>{if(!s||this._ueFuncWithIdAndResultCallbacks.length===0)return;const d=this._ueFuncWithIdAndResultCallbacks.map(([f])=>f),h={n:o++,tt:Date.now(),t:"c",fs:d};for(const[f,B]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(f.fid,B);this._ueFuncWithIdAndResultCallbacks.length=0,this._waitingUeCalls.add(h),n.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(h,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd());const u=++Cu;window.ue.es.oncommand(`${u}-0/1-`+JSON.stringify(h)).then(()=>{this._waitingUeCalls.delete(h)})};this.dv(c.createInterval()).start(a,50)}callUeFunc(e){return new Promise(t=>{const s={fid:c.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,t])})}disposableOnUeEvent(e,t){const n=c.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.disposableOn(o=>{o.et===e&&o.eid===n&&((this._ueViewer.debug??!1)&&console.log(`callback, type:${e} eid:${n} ueEvent:${JSON.stringify(o)}`),t(o))});return()=>{i(),s()}}}class mu extends c.Destroyable{constructor(A,e){super();{const t=()=>{const o=Qn(A);A.setGlobalProperty(o)};t();const n=mr(),s=[];n.forEach(o=>{const a=A[o+"Changed"];s.push(a)});const i=this.dv(c.createNextAnimateFrameEvent(...s));this.d(i.don(t))}this.d(A.propChanged.don(t=>{if(t.objId==="")try{Object.keys(t.props).forEach(n=>{const s=t.props[n]===null?void 0:t.props[n];A[n]=s})}catch(n){console.error("ueViewer propChanged:"+n)}})),this.dv(new c.ObjResettingWithEvent(A.statusUpdateIntervalChanged,t=>{if((A.statusUpdateInterval??.5)===0)return;const s=new c.Destroyable;return s.d(e.disposableOnUeEvent("statusUpdate",i=>{A.statusUpdateEvent.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(A.propChangedListeningChanged,()=>{if(!(A.propChangedListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("propChanged",s=>{A.propChanged.emit(s)})),n})),this.dv(new c.ObjResettingWithEvent(A.objectEventListeningChanged,()=>{if(!(A.objectEventListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("objectEvent",s=>{A.objectEvent.emit(s)})),n})),this.dv(new c.ObjResettingWithEvent(A.widgetEventListeningChanged,()=>{if(!(A.widgetEventListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("widgetEvent",s=>{A.widgetEvent.emit(s)})),n})),this.dv(new c.ObjResettingWithEvent(A.speechRecognitionListeningChanged,()=>{if(!(A.speechRecognitionListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("speechRecognition",s=>{A.speechRecognition.emit(s)})),n})),this.dv(new c.ObjResettingWithEvent(A.customMessageListeningChanged,()=>{if(!(A.customMessageListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("customMessage",s=>{A.customMessage.emit(s)})),n})),this.dv(new c.ObjResettingWithEvent(A.editingEventListeningChanged,()=>{if(!(A.editingEventListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("editingEvent",s=>{s.objectIDs=s.objectIDs.map(i=>{var o;return((o=c.ESSceneObject.getSceneObjById(i))==null?void 0:o.parentID)??i}),A.editingEvent.emit(s)})),n})),this.ad(e.disposableOnUeEvent("cameraChanged",()=>{A.cameraChanged.emit()}))}}class Fu extends c.Destroyable{constructor(A,e,t){super();{const s=()=>{const l=Qn(e);e.setGlobalProperty(l)};s();const i=mr(),o=[];i.forEach(l=>{const d=e[l+"Changed"];o.push(d)});const a=this.dv(c.createNextAnimateFrameEvent(...o));this.d(a.don(s))}this.d(e.propChanged.don(s=>{if(s.objId==="")try{Object.keys(s.props).forEach(i=>{const o=s.props[i]===null?void 0:s.props[i];e[i]=o})}catch(i){console.error("ueViewer propChanged:"+i)}}));const n=document.createElement("div");n.style.width="100%",n.style.height="100%",n.style.position="absolute",n.style.overflow="hidden",n.style.top="0",n.style.left="0",n.style.zIndex="0",n.style.backgroundColor="rgba(255,0,0,0)",n.setAttribute("masker","大屏顶层div,用于模拟鼠标事件和控制UE鼠标事件是否生效"),A.appendChild(n),this.d(()=>{n&&A&&A.removeChild(n)});{const s=(l,d)=>{window.ue.esinput.setinterceptevent(d),l.preventDefault()},i=l=>{s(l,!1)},o=l=>{s(l,!0)},a=l=>{s(l,!1)};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",o),n.addEventListener("mousemove",a),this.d(()=>{n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",o),n.removeEventListener("mousemove",a)})}e.useCustomInteraction=!1,this.dv(new c.ViewerCustomInteraction(e,n)),this.dv(new c.ObjResettingWithEvent(e.statusUpdateIntervalChanged,s=>{if((e.statusUpdateInterval??.5)===0)return;const o=new c.Destroyable;return o.d(t.disposableOnUeEvent("statusUpdate",a=>{e.statusUpdateEvent.emit(a)})),o})),this.dv(new c.ObjResettingWithEvent(e.propChangedListeningChanged,()=>{if(!(e.propChangedListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("propChanged",o=>{e.propChanged.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.objectEventListeningChanged,()=>{if(!(e.objectEventListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("objectEvent",o=>{e.objectEvent.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.widgetEventListeningChanged,()=>{if(!(e.widgetEventListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("widgetEvent",o=>{e.widgetEvent.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.speechRecognitionListeningChanged,()=>{if(!(e.speechRecognitionListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("speechRecognition",o=>{e.speechRecognition.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.customMessageListeningChanged,()=>{if(!(e.customMessageListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("customMessage",o=>{e.customMessage.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.editingEventListeningChanged,()=>{if(!(e.editingEventListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("editingEvent",o=>{o.objectIDs=o.objectIDs.map(a=>{var l;return((l=c.ESSceneObject.getSceneObjById(a))==null?void 0:l.parentID)??a}),e.editingEvent.emit(o)})),i})),this.ad(t.disposableOnUeEvent("cameraChanged",()=>{e.cameraChanged.emit()}))}}class Qu extends c.Destroyable{constructor(e,t,n){super();p(this,"_reconnectEvent",this.dv(new c.Event));const s=(h,u)=>h.hasOwnProperty(u);let i=0,o;this.d(()=>{o&&clearTimeout(o)});const l=new URLSearchParams(window.location.search).get("eswebview")==="true",d=()=>{if(window.ue.esinput){n.setStatus("Creating"),console.log("存在(window.ue && window.ue.es && window.ue.esinput 需要适配新版ESWebView 鼠标穿透), 开始创建UeFalseCloudViewer..."),n.setStatusLog("开始创建本地视口...");const h=this.dv(new vu(e,n));this.d(()=>n.viewer=void 0),n.viewer=h,n.setStatus("Created"),n.setStatusLog("本地视口创建成功!"),this.dv(new Fu(e,n,h))}else n.setStatus("Error"),n.setStatusLog("请升级 ESWebView !"),this.d(()=>n.viewer=void 0),n.viewer=void 0};if(window.ue&&window.ue.es)d();else if(l){const h=setInterval(()=>{window.ue&&window.ue.es&&(clearInterval(h),d())},200)}else if(s(t.options,"ws")||s(t.options,"uri")&&s(t.options,"app")){n.setStatus("Creating"),n.setStatusLog("开始创建云渲染视口...");let h;this.d(()=>{n.setStatus("Raw"),n.setStatusLog(""),e&&h&&e.removeChild(h)&&(h=void 0)});const u=this.dv(c.createProcessingFromAsyncFunc(async f=>{n.viewer&&!n.viewer.isDestroyed()&&n.viewer.destroy(),n.viewer=void 0,h&&e.removeChild(h)&&(h=void 0),h=document.createElement("div"),h.setAttribute("earthsdk3-ue","earthsdk3-ue-videoContainer"),h.style.cssText="position:relative; height: 100%;width:100%;",e.appendChild(h);let B,w,v;if(s(t.options,"ws")){const{ws:H,esmsg:S,uselnternalSignallingServer:U}=t.options;B=H,w=S,v=U??!1}if(s(t.options,"uri")&&s(t.options,"app")){const{offsetWidth:H,offsetHeight:S}=h;let{uri:U,app:D,token:R}=t.options;U.endsWith("/")||(U+="/");const M=R?`?essstoken=${R}`:"",O=`/${D}/${H??1920}/${S??1080}`+M;console.log(`请求信令服务器: ${U}instance${O}`);const iA=await f.promise(fetch(`${U}instance${O}`,{method:"GET"})),Y=await f.promise(iA.json());if(Y&&Y.status!=="ok"){n.setStatus("Error"),n.setStatusLog(`信令服务器请求失败 ${Y.status}`),this._reconnectEvent.emit(void 0);return}else{console.log(`信令服务器请求成功! ${JSON.stringify(Y,void 0," ")}`),await c.sleep(2e3);const{server:G,esmsg:q,instanceId:SA,useInternalSignallingServer:oA}=Y;if(!SA){n.setStatus("Error"),n.setStatusLog("检查信令服务器版本,返回数据错误! "),console.log("信令服务器返回数据错误!不包含instanceId!请升级到 ESSS V3.0+ 版本!"),this._reconnectEvent.emit(void 0);return}B=G,w=q,v=oA??!1,n.esssResponse=Y}}const m=this.dv(v?new hu(h,B,w,n):new iu(h,B,w,n));this.d(()=>n.viewer=void 0),this.d(m.errorEvent.don(H=>{const S=`[${H}]:像素流连接错误!`;n.setStatus("Error"),n.setStatusLog(S),this._reconnectEvent.emit(m)})),await f.promise(new Promise(H=>this.d(m.readyEvent.donce(H)))),n.setStatus("Created"),n.setStatusLog("云渲染视口创建成功!"),i=0,o&&clearTimeout(o),o=void 0;const{offsetWidth:F,offsetHeight:E}=h;m.resize(F*window.devicePixelRatio,E*window.devicePixelRatio),n.viewer=m,this.d(()=>n.viewer=void 0),this.dv(new mu(n,m))}));u.start(),this.d(this._reconnectEvent.don(f=>{o===void 0&&(f&&!f.isDestroyed()&&f.destroy(),n.viewer&&!n.viewer.isDestroyed()&&n.viewer.destroy(),n.viewer=void 0,n.autoReconnect&&(n.setStatus("Reconnecting"),n.setStatusLog("正在尝试重新连接..."),i=i+5e3>3e4?3e4:i+5e3,console.warn(`间隔:${i/1e3}s,正在尝试重新连接...`),o=window.setTimeout(()=>{u.restart()},i)))})),this.d(u.errorEvent.don(f=>{n.setStatus("Error"),n.setStatusLog("云渲染视口创建失败!"),console.warn("云渲染视口创建失败!",f),this._reconnectEvent.emit(void 0)}))}else if(s(t.options,"project")){const h=t,u=h.options.project,f=h.options.baseUrl;n.setStatus("Creating"),n.setStatusLog("下载编译中...");const B=this.dv(new pu(e,u,f,n));n.viewer=B,this.d(()=>n.viewer=void 0)}else n.setStatus("Error"),n.setStatusLog("视口创建失败!"),console.warn("视口创建失败: 参数错误!")}}const ne=class ne extends c.ESViewer{constructor(e){super(e);p(this,"_viewer",this.dv(c.react(void 0)));p(this,"_esssResponse");p(this,"_speechRecognition",this.dv(new c.Event));p(this,"_propChanged",this.dv(new c.Event));p(this,"_objectEvent",this.dv(new c.Event));p(this,"_widgetEvent",this.dv(new c.Event));p(this,"_customMessage",this.dv(new c.Event));p(this,"_statusUpdateEvent",this.dv(new c.Event));p(this,"_statusUpdateEventdon",(()=>{this.d(this.statusUpdateEvent.don(e=>{this._statusInfo.fps=e.FPS??0,this._statusInfo.length=e.length??0,this._statusInfo.position=e.position??[0,0,0],this._statusInfo.rotation=e.rotation??[0,0,0]}))})());if(e.type!=="ESUeViewer")throw new Error("option.type must be ESUeViewer");const t=e;this.d(this._viewer.changed.don(()=>{this.viewerChanged.emit(this.viewer)})),this.dv(new c.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new Qu(this.subContainer,t,this)}))}get defaultProps(){return ne.createDefaultProps()}set viewer(e){this._viewer.value=e}get viewer(){return this._viewer.value}get esssResponse(){return this._esssResponse}set esssResponse(e){this._esssResponse=e}get speechRecognition(){return this._speechRecognition}get propChanged(){return this._propChanged}get objectEvent(){return this._objectEvent}get widgetEvent(){return this._widgetEvent}get customMessage(){return this._customMessage}get statusUpdateEvent(){return this._statusUpdateEvent}async uePositionToLonLatAlt(e){if(!this.viewer){console.warn("UEPositionToLonLatAlt: viewer is undefined");return}return await Co(this.viewer,e)}async changeNavigationMode(e){if(!this.viewer){console.warn("ChangeNavigationMode: viewer is undefined");return}const t=await TA(this.viewer,e);return t&&!t.error&&(this._navigationMode.value=e.mode),t}async resetWithCurrentCamera(e){if(!this.viewer){console.warn("resetWithCurrentCamera: viewer is undefined");return}return await En(this.viewer,e)}async getAllSocketNamesByActorTag(e){if(!this.viewer){console.warn("GetAllSocketNamesByActorTag: viewer is undefined");return}return await vo(this.viewer,e)}async getBoundSphere(e){if(!this.viewer){console.warn("getBoundSphere: viewer is undefined");return}return await Fo(this.viewer,e)}async getBoundSphereWithChildren(e){if(!this.viewer){console.warn("getBoundSphereWithChildren: viewer is undefined");return}return await Qo(this.viewer,e)}async getStrokeMaterialParamInfo(e){if(!this.viewer){console.warn("GetStrokeMaterialParamInfo: viewer is undefined");return}return await Uo(this.viewer,e)}async getFillMaterialParamInfo(e){if(!this.viewer){console.warn("getFillMaterialParamInfo: viewer is undefined");return}return await Eo(this.viewer,e)}async getGlobalProperty(e){if(!this.viewer){console.warn("getGlobalProperty: viewer is undefined");return}return await yo(this.viewer,e)}async getObjectByInfo(e){if(!this.viewer){console.warn("GetObjectByInfo: viewer is undefined");return}return await So(this.viewer,e)}async defaultCameraFlyIn(e=1){if(!this.viewer){console.warn("DefaultCameraFlyIn: viewer is undefined");return}return await Zi(this.viewer,e)}async startVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await qi(this.viewer)}async stopVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await ji(this.viewer)}async mountPakFiles(e){if(!this.viewer){console.warn("mountPakFiles:viewer is undefined");return}return await Ao(this.viewer,e)}async generateMemReport(){if(!this.viewer){console.warn("generateMemReport:viewer is undefined");return}return await eo(this.viewer)}async quit(){if(!this.viewer){console.warn("Quit: viewer is undefined");return}return await co(this.viewer)}async bindActorByTag(e,t){if(!this.viewer){console.warn("BindActorByTag: viewer is undefined");return}return await Io(this.viewer,e,t)}async restoreOriginalScene(){if(!this.viewer){console.warn("RestoreOriginalScene: viewer is undefined");return}return await To(this.viewer)}async unBindActorByID(e){if(!this.viewer){console.warn("UnBindActorByID: viewer is undefined");return}return await Ho(this.viewer,e)}async unBindActorByTag(e){if(!this.viewer){console.warn("UnBindActorByTag: viewer is undefined");return}return await Lo(this.viewer,e)}async createActorByClass(e,t){if(!this.viewer){console.warn("CreateActorByClass: viewer is undefined");return}return await bo(this.viewer,e,t)}async bind3DTilesetByTag(e,t){if(!this.viewer){console.warn("Bind3DTilesetByTag: viewer is undefined");return}return await Mo(this.viewer,e,t)}async unBind3DTilesetByTag(e){if(!this.viewer){console.warn("UnBind3DTilesetByTag: viewer is undefined");return}return await Do(this.viewer,e)}async unBind3DTilesetById(e){if(!this.viewer){console.warn("UnBind3DTilesetById: viewer is undefined");return}return await Ro(this.viewer,e)}async bindImageryByTag(e,t,n){if(!this.viewer){console.warn("BindImageryByTag: viewer is undefined");return}return await xo(this.viewer,e,t,n)}async unBindImageryByTag(e,t){if(!this.viewer){console.warn("UnBindImageryByTag: viewer is undefined");return}return await Po(this.viewer,e,t)}async unBindImageryById(e){if(!this.viewer){console.warn("UnBindImageryById: viewer is undefined");return}return await Ko(this.viewer,e)}async getIdByComponentNameAndHitItem(e,t,n){if(!this.viewer){console.warn("GetIdByComponentNameAndHitItem: viewer is undefined");return}return await Go(this.viewer,e,t,n)}async getCameraRelativeHeight(e="ECC_Visibility"){if(!this.viewer){console.warn("GetCameraRelativeHeight: viewer is undefined");return}return await ko(this.viewer,e)}async saveStringToFile(e,t,n){if(!this.viewer){console.warn("SaveStringToFile: viewer is undefined");return}return await No(this.viewer,e,t,n)}async highlightActorByTag(e,t=!0){if(!this.viewer){console.warn("HighlightActorByTag: viewer is undefined");return}return await _o(this.viewer,e,t)}async sendCustomMessage(e){if(!this.viewer){console.warn("SendCustomMessage: viewer is undefined");return}return await Vo(this.viewer,e)}async getStatus(){if(!this.viewer){console.warn("GetStatus:viewer is undefined");return}return await Oo(this.viewer)}async getTilesetMaterialIDList(){if(!this.viewer){console.warn("GetTilesetMaterialIDList:viewer is undefined");return}return await zo(this.viewer)}async pick(e,t,n){if(!this.viewer)return;let s=e;if(e&&window.ue&&this.container){const[i,o]=e,{x:a,y:l}=this.container.getBoundingClientRect();s=[a+i,l+o]}return await uo(this.viewer,s,t,n)}async pickPosition(e){if(!this.viewer)return;let t=e;if(e&&window.ue&&this.container){const[n,s]=e,{x:i,y:o}=this.container.getBoundingClientRect();t=[i+n,o+s]}return await ho(this.viewer,t)}async quickPickPosition(e){return await this.pickPosition(e)}async getTerrainHeight(e){return await this.getHeightByLonLat(e[0],e[1])??void 0}async flyIn(e,t=[0,0,0],n=1,s="default"){if(!this.viewer)return;const i=await Ke(this.viewer,void 0,e,t,n,s);if(i)return i.endType===0&&console.warn(`flyTo:flyTo is end! endType:${i.endType}`),i.endType===1&&console.warn(`flyTo:飞行中断! endType:${i.endType}`),i}async flyTo(e,t,n="default"){if(!this.viewer)return;const s=await Be(this.viewer,void 0,void 0,e,t,n);if(s)return s.endType===0&&console.warn(`flyTo:flyTo is end! endType:${s.endType}`),s.endType===1&&console.warn(`flyTo:飞行中断! endType:${s.endType}`),s}flyToBoundingSphere(e,t,n=1){const s=[[e[0],e[1],0],[e[0],e[3],0],[e[2],e[3],0],[e[2],e[1],0]],i=c.getGeoBoundingSphereFromPositions(s);if(!i)return;const{center:o,radius:a}=i,l={distance:t??a,heading:0,pitch:-90,flyDuration:n,hDelta:0,pDelta:0};this.flyTo(l,o)}getCurrentCameraInfo(){const{position:e,rotation:t}=this._statusInfo;return{position:e,rotation:t}}getLengthInPixel(){return this._statusInfo.length}async changeToWalk(e,t=4.2,n=1.6){if(!this.viewer)return;const s={mode:"Walk",position:e,jumpZVelocity:t,eyeHeight:n},i=await TA(this.viewer,s);return i&&!i.error&&(this._navigationMode.value=s.mode),i}async changeToMap(){if(!this.viewer)return;const e={mode:"Map"},t=await TA(this.viewer,e);return t&&!t.error&&(this._navigationMode.value=e.mode),t}async changeToRotateGlobe(e=38,t=1e7,n=60){if(!this.viewer)return;const s={mode:"RotateGlobe",latitude:e,height:t,cycleTime:n},i=await TA(this.viewer,s);return i&&!i.error&&(this._navigationMode.value=s.mode),i}async changeToLine(e,t=10,n=10,s=!0,i=10,o="auto"){if(!this.viewer)return;const a={mode:"Line",geoLineStringId:e,speed:t,heightOffset:n,loop:s,turnRateDPS:i,lineMode:o},l=await TA(this.viewer,a);return l&&!l.error&&(this._navigationMode.value=a.mode),l}async changeToUserDefined(e){if(!this.viewer)return;const t={mode:"UserDefined",userDefinedPawn:e},n=await TA(this.viewer,t);return n&&!n.error&&(this._navigationMode.value=t.mode),n}async changeToRotatePoint(e,t=5e4,n=60,s=0,i=-30){if(!this.viewer)return;const o={mode:"RotatePoint",position:e,distance:t,orbitPeriod:n,heading:s,pitch:i},a=await TA(this.viewer,o);return a&&!a.error&&(this._navigationMode.value=o.mode),a}async changeToFollow(e,t=0,n=0,s=-30,i=!0){if(!this.viewer)return;const o={mode:"Follow",objectId:e,distance:t,heading:n,pitch:s,relativeRotation:i},a=await TA(this.viewer,o);return a&&!a.error&&(this._navigationMode.value=o.mode),a}getFPS(){return this._statusInfo.fps}async getVersion(){const e=window.g_XE3CopyRights??{};if(!this.viewer)return e;const t=await mo(this.viewer);return e.esforue=t,e}async getHeightByLonLat(e,t,n="ECC_Visibility"){if(!this.viewer)return null;const s=await go(this.viewer,e,t,n);return s&&s.height!==void 0?s.height:null}async getHeightsByLonLats(e,t="ECC_Visibility"){return this.viewer?await Bo(this.viewer,e,t):void 0}async capture(e=64,t=64){return this.viewer?await fo(this.viewer,e,t):void 0}async partialCapture(e,t=[64,64]){if(!this.viewer){console.warn("partialCapture:viewer is undefined");return}return await wo(this.viewer,e,t)}async lonLatAltToScreenPosition(e){if(!this.viewer)return;const t=await po(this.viewer,e);return t&&[t.X,t.Y]}async setGlobalProperty(e){if(this.viewer)return await lo(this.viewer,e)}async startEditing(e,t,n){n=Object.assign({useKeyToSwitch:!0,callSource:"outer"},n);const s=e.components.main??e;if(!s||!this.viewer||t==null)return;const i=Array.isArray(t)?[...t]:[t];return s.editingID=`${n.callSource}_${c.createGuid()}`,await Wo(this.viewer,s.id,s.editingID,i,n.useKeyToSwitch)}async stopEditing(){if(this.viewer)return await Xo(this.viewer)}async moveObjects(e){if(!this.viewer)return;const t=[],n=c.createGuid();for(let s=0;s<e.length;s++){const i=e[s],o=i.components.main??i;o.editingID=n,o&&t.push(o.id)}if(t.length!==0)return await Jo(this.viewer,t,n)}};p(ne,"type",ne.register("ESUeViewer",ne)),p(ne,"defaults",{...ge});let LA=ne;(r=>{r.createDefaultProps=()=>({...c.ESViewer.createDefaultProps(),...Yi(),resolutionScale:1,autoReconnect:!1,propChangedListening:void 0,objectEventListening:void 0,widgetEventListening:void 0,speechRecognitionListening:void 0,customMessageListening:void 0})})(LA||(LA={})),c.extendClassProps(LA.prototype,LA.createDefaultProps);class qA extends c.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(!t)return;const n=this.ad(c.react(!1));A.components.main||this.d(this.createdEvent.don(()=>{const s=this.constructor.propValFuncs,i=A.defaultProps,o=Object.keys(i).filter(f=>s[f]!==null);o.push(...this.constructor.forceUeUpdateProps);const a=A.constructor.defaults,l={val:{}},d=[];for(let f of o){const B=f+"Changed",w=A[B];d.push(w);const v=s[f];if(v===null)throw console.error("vf === null error"),new Error("vf === null error");const m=()=>{const F=A[f]??a[f]??A.constructor[`default${f.charAt(0).toUpperCase()+f.slice(1)}`];let E=v?v(F,this,e,A):F;if(E===void 0){console.warn(`UE自动更新的属性,不应该为undefined! 属性名:${f} 对象名:${A.name} 对象id: ${A.id}`);return}l.val[f]=E};m(),this.d(w.don(m))}const h=()=>{t.callUeFunc({f:"update",p:{id:A.id,...l.val}}),l.val={}},u=this.dv(c.createNextAnimateFrameEvent(...d));this.d(u.don(h)),this.d(n.changed.don(h)),this.d(A.flushEvent.don(()=>u.flush()))})),A.components.main||(this.d(()=>{n.value&&Un(t,A.id)}),t.callUeFunc({f:"create",p:{type:A.typeName,id:A.id}}).then(()=>{n.value=!0}).catch(s=>console.error(s)))}}p(qA,"propValFuncs",{ref:null,devTags:null,extras:null,execOnceFuncStr:null,updateFuncStr:null,toDestroyFuncStr:null}),p(qA,"forceUeUpdateProps",[]);class cA extends qA{constructor(A,e){super(A,e);const t=e.viewer;t&&(this.d(A.flyToEvent.don(n=>{Be(t,A.id,n)})),this.d(A.flyInEvent.don(n=>{var s,i;Ke(t,A.id,(s=A.flyInParam)==null?void 0:s.position,(i=A.flyInParam)==null?void 0:i.rotation,n??1)})),this.d(A.calcFlyToParamEvent.don(()=>{YA(t,A.id)})),this.d(A.calcFlyInParamEvent.don(()=>{const n=e.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:i}=n;A.flyInParam={position:s,rotation:i,flyDuration:1}})),this.d(e.propChanged.don(n=>{n.objId===A.id&&Object.keys(n.props).forEach(s=>{const i=n.props[s]===null?void 0:n.props[s];A[s]=i})})))}}class P extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t)return;const n=()=>{A.editing||t.callUeFunc({f:"update",p:{id:A.id,position:A.position,rotation:A.rotation}})},s=this.dv(c.createNextAnimateFrameEvent(A.positionChanged,A.rotationChanged,A.editingChanged));this.d(s.don(()=>{setTimeout(n,0)})),this.d(A.smoothMoveEvent.don((a,l)=>{_e(t,A.id,a,l)})),this.d(A.smoothMoveWithRotationEvent.don((a,l,d)=>{Ge(t,A.id,a,l,d)})),this.d(A.smoothMoveOnGroundEvent.don((a,l,d,h)=>{ke(t,A.id,a,l,h,d)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((a,l,d,h,u)=>{Ne(t,A.id,a,l,d,h,u)})),this.d(A.smoothMoveKeepPitchEvent.don(async(a,l)=>{const d=await t.callUeFunc({f:"SmoothMoveKeepPitch",p:{id:A.id,Destination:a,Time:l}});d.error&&console.error("SmoothMoveKeepPitch:",d.error)})),this.d(A.automaticLandingEvent.don(a=>{const l=[A.position[0],A.position[1]];e.getHeightByLonLat(A.position[0],A.position[1],"Visibility").then(d=>{d!==null&&(A.position=[...l,d],A.collision=a)})}));const i=async(a,l,d,h)=>{const{viewer:u}=a;if(!u){console.error("SmoothMoveRelatively: ueViewer.viewer is undefined");return}const f=await u.callUeFunc({f:"SmoothMoveRelatively",p:{id:l,RelativePosition:d,Time:h}});return f.error&&console.error("SmoothMoveRelatively:",f.error),f};this.d(A.smoothMoveRelativelyEvent.don((a,l)=>{i(e,A.id,a,l)}));const o=async(a,l,d,h,u)=>{const{viewer:f}=a;if(!f){console.error("SmoothMoveRelativelyWithRotation: ueViewer.viewer is undefined");return}const B=await f.callUeFunc({f:"SmoothMoveRelativelyWithRotation",p:{id:l,RelativePosition:d,NewRotation:h,Time:u}});return B.error&&console.error("SmoothMoveRelativelyWithRotation:",B.error),B};this.d(A.smoothMoveRelativelyWithRotationEvent.don((a,l,d)=>{o(e,A.id,a,l,d)}))}}class rA extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t)return;const n=()=>{A.editing||t.callUeFunc({f:"update",p:{id:A.id,points:A.points}})},s=this.dv(c.createNextAnimateFrameEvent(A.pointsChanged,A.editingChanged));this.d(s.don(()=>{setTimeout(n,0)}))}}p(rA,"propValFuncs",{...cA.propValFuncs,pointStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),strokeStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),fillStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})})});class QA extends P{constructor(A,e){super(A,e),e.viewer&&this.d(e.widgetEvent.don(n=>{if(n.objId!==A.id)return;const{type:s,add:i}=n;A.widgetEvent.emit({type:s,add:i})}))}}class Pn extends P{constructor(A,e){super(A,e),e.viewer}}p(Pn,"propValFuncs",{...P.propValFuncs,pointStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),strokeStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),fillStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})})});class Er extends Pn{constructor(A,e){super(A,e),e.viewer}}const Al=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag但对应的Actor不是3dTileset,无法绑定";default:return"未知错误"}},ht=class ht extends c.EngineObject{constructor(e,t){super(e,t);p(this,"_styleColor",this.dv(c.react([])));p(this,"_styleVisable",this.dv(c.react([])));const n=t.viewer;if(!n){console.warn("UeES3DTileset: viewer is undefined!");return}let s,i;const o=async()=>{!s&&!i||await n.callUeFunc({f:"update",p:{id:e.id,url:e.url,show:e.show,collision:e.collision,allowPicking:e.allowPicking,flyToParam:e.flyToParam??c.ES3DTileset.defaultFlyToParam,flyInParam:e.flyInParam??c.ES3DTileset.defaultFlyInParam,highlightID:e.highlightID,highlightColor:e.highlightColor,highlight:e.highlight,materialMode:e.materialMode,maximumScreenSpaceError:e.maximumScreenSpaceError,colorMode:Reflect.has(e,"colorMode")?e.colorMode:void 0,offset:e.offset,rotation:e.rotation,cacheBytes:e.cacheBytes,colorBlendMode:e.colorBlendMode,materialOverrideMap:e.materialOverrideMap}})},a=this.dv(c.createNextAnimateFrameEvent(e.urlChanged,e.showChanged,e.flyToParamChanged,e.flyInParamChanged,e.collisionChanged,e.allowPickingChanged,e.highlightIDChanged,e.highlightColorChanged,e.highlightChanged,e.materialModeChanged,e.maximumScreenSpaceErrorChanged,e.offsetChanged,e.rotationChanged,e.cacheBytesChanged,e.colorBlendModeChanged,e.materialOverrideMapChanged));o(),this.d(a.don(o)),Reflect.has(e,"colorMode")&&this.d(e.colorModeChanged.don(()=>o()));const l=this.dv(c.react(void 0));{const h=this.dv(c.createNextAnimateFrameEvent(e.actorTagChanged,e.urlChanged)),u=()=>{e.actorTag?l.value={type:"ActorTag",actorTag:e.actorTag}:e.url?l.value={type:"CreatedUrl",url:e.url}:l.value=void 0,e.editing=!1};u(),this.d(h.don(u))}const d=async()=>{const{id:h}=e;if(s!==void 0){s=void 0;try{const u=await t.unBind3DTilesetById(h);if(!u)return;if(u.error!==""){console.warn(`UeES3DTileset UnBind3DTilesetById: ${u.error}`);return}}catch(u){console.warn(`UeES3DTileset UnBind3DTilesetById: ${u}`);return}}if(i!==void 0){i=void 0;try{const u=await n.callUeFunc({f:"destroy",p:{id:h}});if(!u)return;if(u.error!==""){console.warn(`UeES3DTileset Destroy: ${u.error}`);return}}catch(u){console.warn(`UeES3DTileset Destroy: ${u}`);return}}};this.d(()=>{d()});{const h=this.dv(c.createProcessingFromAsyncFunc(async f=>{if(l.value===void 0){await f.promise(d());return}if(l.value.type==="ActorTag"){const{actorTag:B}=l.value;if(s!==B&&await f.promise(d()),s!==void 0||B===void 0)return;try{s=B;const w=await f.promise(t.bind3DTilesetByTag(e.id,B));if(!w)return;if(w.error!==""){console.warn(`UeES3DTileset Bind3DTilesetByTag: ${w.error}`);return}if(w.re.type!==0)if(w.re.type===1)console.warn(`UeES3DTileset Bind3DTilesetByTag: ${Al(w.re.type)}`);else{console.warn(`UeES3DTileset Bind3DTilesetByTag: ${Al(w.re.type)}`);return}}catch(w){console.warn(`UeES3DTileset Bind3DTilesetByTag: ${w}`);return}}else if(l.value.type==="CreatedUrl"){const{url:B}=l.value;if(B!==i&&await d(),i!==void 0||B===void 0)return;try{i=B;const w=await f.promise(n.callUeFunc({f:"create",p:{type:e.typeName,id:e.id}}));if(!w)return;if(w.error!==""){console.warn(`UeES3DTileset create: ${w.error}`);return}}catch(w){console.warn(`UeES3DTileset create: ${w}`);return}}await f.promise(o())})),u=async()=>{h.restart()};u(),this.d(l.changed.don(u))}this.d(e.refreshTilesetEvent.don(()=>{$i(n,e.id)})),this.d(e.flyToEvent.don(async(h,u)=>{if(!s&&!i)return;const f=await Be(n,e.id,h);let B="over";f===void 0?B="error":f.endType===0?B="over":f.endType===1&&(B="cancelled"),e.flyOverEvent.emit(u,B,t)})),this.d(e.calcFlyToParamEvent.don(()=>{!s&&!i||YA(n,e.id)})),this.d(e.calcFlyInParamEvent.don(async()=>{if(!s&&!i||!t.actived)return;const h=await t.getCurrentCameraInfo();if(!h)return;const{position:u,rotation:f}=h;e.flyInParam={position:u,rotation:f,flyDuration:1}})),this.d(t.propChanged.don(h=>{!s&&!i||h.objId===e.id&&Object.keys(h.props).forEach(u=>{const f=h.props[u]===null?void 0:h.props[u];e[u]=f})})),this.d(t.objectEvent.don(h=>{!s&&!i||h.id!==e.id||h.type!=="3DTilesetReady"||e.tilesetReady.emit(h.p)}));{const h=async(w,v)=>{if(!s&&!i)return;const m=await n.callUeFunc({f:"SetFeatureColor",p:{id:e.id,featureName:w,json:v}});if(m&&m.error!==""){console.warn(`UeES3DTileset SetFeatureColor: ${m.error}`);return}},u=async(w,v)=>{if(!s&&!i)return;const m=await n.callUeFunc({f:"SetFeatureVisable",p:{id:e.id,featureName:w,json:v}});if(m&&m.error!==""){console.warn(`UeES3DTileset SetFeatureVisable: ${m.error}`);return}},f=async()=>{if(!s&&!i)return;const w=await n.callUeFunc({f:"ResetFeatureStyle",p:{id:e.id}});if(w&&w.error!==""){console.warn(`UeES3DTileset ResetFeatureStyle: ${w.error}`);return}},B=async w=>{if(!s&&!i)return;const v=await n.callUeFunc({f:"SetFeatureStyle",p:{id:e.id,json:w}});if(v&&v.error!==""){console.warn(`UeES3DTileset SetFeatureStyle: ${v.error}`);return}};this.d(e.setFeatureColorEvent.don((w,v)=>{const m=[...this.styleColor,...v];this.styleColor=[...m],h(w,m)})),this.d(e.setFeatureVisableEvent.don((w,v)=>{const m=[...this.styleVisable,...v];this.styleVisable=[...m],u(w,m)})),this.d(e.resetFeatureStyleEvent.don(()=>{f(),this.styleColor=[],this.styleVisable=[]})),this.d(e.setFeatureStyleEvent.don(w=>{B(w)}))}{const h=async()=>{if(!s&&!i){e._featureTableResultEvent.emit(void 0);return}try{const u=await n.callUeFunc({f:"GetFeatureTable",p:{id:e.id}});u.error!==""&&console.warn(`UeES3DTileset GetFeatureTable: ${u.error}`),e._featureTableResultEvent.emit(u.re.table)}catch(u){console.warn(`UeES3DTileset GetFeatureTable: ${u}`),e._featureTableResultEvent.emit(void 0)}};this.d(e.getFeatureTableEvent.don(()=>{h()}))}{const h=async()=>{if(!s&&!i){e.getMaterialNameListEvent.emit(void 0);return}try{const u=await n.callUeFunc({f:"GetMaterialNameList",p:{id:e.id}});u.error!==""&&console.warn(`UeES3DTileset GetMaterialNameList: ${u.error}`),e.getMaterialNameListEvent.emit(u.re.materialNameList)}catch(u){console.warn(`UeES3DTileset GetMaterialNameList: ${u}`),e.getMaterialNameListEvent.emit(void 0)}};this.ad(e.getMaterialNameListEvent.don(u=>{u=="start"&&h()}))}}get styleColor(){return this._styleColor.value}set styleColor(e){this._styleColor.value=e}get styleVisable(){return this._styleVisable.value}set styleVisable(e){this._styleVisable.value=e}};p(ht,"type",ht.register("ESUeViewer",c.ES3DTileset.type,ht));let yr=ht;const el=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag对应的Actor是地形,无法绑定";case 4:return"没搜索到ComponentTag,无法绑定";default:return"未知错误"}},gt=class gt extends c.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}let n,s;const i=this.dv(c.react(void 0)),o=this.ad(c.reactJson(""));{const h=()=>{if(typeof A.url=="string")o.value=c.ESSceneObject.context.getStrFromEnv(A.url);else{const u=A.url;u.url=c.ESSceneObject.context.getStrFromEnv(u.url),o.value=u}};h(),this.ad(A.urlChanged.don(h))}const a=async()=>{if(!n&&!s)return;let h=A.targetID??c.ESImageryLayer.defaults.targetID;if(h&&h!=""){const u=c.ESSceneObject.getSceneObject(h);h=u?(u.components.main??u).id:h}await t.callUeFunc({f:"update",p:{id:A.id,show:A.show??!0,rectangle:A.rectangle??[-180,-90,180,90],collision:A.collision??!0,allowPicking:A.allowPicking??!1,flyToParam:A.flyToParam??c.ESImageryLayer.defaultFlyToParam,flyInParam:A.flyInParam??c.ESImageryLayer.defaultFlyInParam,url:o.value??"",zIndex:A.zIndex??0,maximumLevel:A.maximumLevel??c.ESImageryLayer.defaults.maximumLevel,minimumLevel:A.minimumLevel??c.ESImageryLayer.defaults.minimumLevel,options:A.options??c.ESImageryLayer.defaults.options,targetID:h,opacity:A.opacity??c.ESImageryLayer.defaults.opacity,splitDirection:A.splitDirection??c.ESImageryLayer.defaults.splitDirection}})},l=this.dv(c.createNextAnimateFrameEvent(A.showChanged,o.changed,A.flyToParamChanged,A.flyInParamChanged,A.zIndexChanged,A.collisionChanged,A.allowPickingChanged,A.maximumLevelChanged,A.minimumLevelChanged,A.rectangleChanged,A.optionsChanged,A.targetIDChanged,A.opacityChanged,A.splitDirectionChanged));this.d(l.don(a));const d=async()=>{const{id:h}=A;if(n!==void 0){n=void 0;try{const u=await e.unBindImageryById(h);if(!u)return;if(u.error!==""){console.warn(`UeESImageryLayer UnImageryByID: ${u.error}`);return}}catch(u){console.warn(`UeESImageryLayer UnImageryByID promise: ${u}`);return}}if(s!==void 0){s=void 0;try{const u=await t.callUeFunc({f:"destroy",p:{id:h,test:"UeESImageryLayer"}});if(!u)return;if(u.error!==""){console.warn(`UeESImageryLayer Destroy: ${u.error}`);return}}catch(u){console.warn(`UeESImageryLayer Destroy promise: ${u}`);return}}};this.d(()=>{d()});{const h=this.dv(c.createProcessingFromAsyncFunc(async f=>{if(i.value===void 0){await f.promise(d());return}if(i.value.type==="ActorTag"){const{actorTag:B,componentTag:w}=i.value;if(n!==B&&await f.promise(d()),n!==void 0||B===void 0)return;try{n=B;const v=await f.promise(e.bindImageryByTag(A.id,B,w));if(!v)return;if(v.error!==""){console.warn(`ESImageryLayer BindImageryByTag: ${v.error}`);return}if(v.re.type!==0)if(v.re.type===1)console.warn(`ESImageryLayer BindImageryByTag: ${el(v.re.type)}`);else{console.warn(`ESImageryLayer BindImageryByTag: ${el(v.re.type)}`);return}}catch(v){console.warn(`ESImageryLayer BindImageryByTag promise: ${v}`);return}}else if(i.value.type==="CreatedUrl"){const{url:B}=i.value;if(B!==s&&await f.promise(d()),s!==void 0||B===void 0)return;try{s=B;const w=await f.promise(t.callUeFunc({f:"create",p:{type:"ESImageryLayer",id:A.id}}));if(!w)return;if(w.error!==""){console.warn(`ESImageryLayer create: ${w.error}`);return}}catch{console.warn("ESImageryLayer create: create promise error");return}}await f.promise(a())})),u=async()=>{h.restart()};u(),this.d(i.changed.don(u))}{const h=this.dv(c.createNextAnimateFrameEvent(A.actorTagChanged,o.changed,A.componentTagChanged)),u=()=>{A.actorTag&&A.componentTag?i.value={type:"ActorTag",actorTag:A.actorTag,componentTag:A.componentTag}:o.value?i.value={type:"CreatedUrl",url:o.value}:i.value=void 0};u(),this.d(h.don(u))}this.d(A.flyToEvent.don(async(h,u)=>{if(!n&&!s)return;const f=await Be(t,A.id,h);let B="over";f===void 0?B="error":f.endType===0?B="over":f.endType===1&&(B="cancelled"),A.flyOverEvent.emit(u,B,e)})),this.d(A.flyInEvent.don(async(h,u)=>{var w,v;if(!n&&!s)return;const f=await Ke(t,A.id,(w=A.flyInParam)==null?void 0:w.position,(v=A.flyInParam)==null?void 0:v.rotation,h??1);let B="over";f===void 0?B="error":f.endType===0?B="over":f.endType===1&&(B="cancelled"),A.flyOverEvent.emit(u,B,e)})),this.d(A.calcFlyToParamEvent.don(()=>{!n&&!s||YA(t,A.id)})),this.d(A.calcFlyInParamEvent.don(async()=>{if(!e.actived)return;const h=await e.getCurrentCameraInfo();if(!h)return;const{position:u,rotation:f}=h;A.flyInParam={position:u,rotation:f,flyDuration:1}})),this.d(e.propChanged.don(h=>{!n&&!s||h.objId===A.id&&Object.keys(h.props).forEach(u=>{const f=h.props[u]===null?void 0:h.props[u];A[u]=f})}))}};p(gt,"type",gt.register("ESUeViewer",c.ESImageryLayer.type,gt));let Kn=gt;const se=class se extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(se,"type",se.register("ESUeViewer",c.ESTerrainLayer.type,se)),p(se,"forceUeUpdateProps",[...cA.forceUeUpdateProps,"url"]),p(se,"propValFuncs",{...cA.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(A):(A.url=c.ESSceneObject.context.getStrFromEnv(A.url),A),czmMaxzoom:null,czmMinzoom:null});let Gn=se;const Bt=class Bt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Bt,"type",Bt.register("ESUeViewer",c.ESAlarm.type,Bt));let kn=Bt;const ft=class ft extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ft,"type",ft.register("ESUeViewer",c.ESApertureEffect.type,ft));let Nn=ft;const wt=class wt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(wt,"type",wt.register("ESUeViewer",c.ESGeoPolygon.type,wt));let dA=wt;const pt=class pt extends dA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i=c.ESAreaMeasurement.defaults.fillStyle;try{i={...A.fillStyle??c.ESAreaMeasurement.defaults.fillStyle}}catch(o){console.error("ESAreaMeasurement fillStyle 属性类型错误!",o),i={...c.ESAreaMeasurement.defaults.fillStyle}}i.materialParams=JSON.stringify(i.materialParams),t.callUeFunc({f:"update",p:{id:A.id,stroked:A.stroked??c.ESAreaMeasurement.defaults.stroked,fillStyle:i,filled:A.filled??c.ESAreaMeasurement.defaults.filled}}),console.log(i)},s=this.dv(c.createNextAnimateFrameEvent(A.fillStyleChanged,A.strokedChanged,A.filledChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};p(pt,"type",pt.register("ESUeViewer",c.ESAreaMeasurement.type,pt));let _n=pt;const Ct=class Ct extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Ct,"type",Ct.register("ESUeViewer",c.ESBlastParticleSystem.type,Ct));let Vn=Ct;const Le=class Le extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};p(Le,"type",Le.register("ESUeViewer",c.ESBoxClipping.type,Le)),p(Le,"propValFuncs",{...P.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let On=Le;const vt=class vt extends P{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.dispose(A.flyInEvent.don((n,s,i="default")=>{const{id:o,duration:a,position:l,rotation:d}=A;Ke(t,o,l,d,a??n,i)})),this.dispose(A.resetWithCurrentCameraEvent.don(()=>{En(t,A.id)})),this.dispose(A.captureEvent.don((n,s)=>{e.capture(n,s).then(o=>{o&&(A.thumbnail=o)})}))}};p(vt,"type",vt.register("ESUeViewer",c.ESCameraView.type,vt));let Wn=vt;const mt=class mt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(mt,"type",mt.register("ESUeViewer",c.ESCameraVisibleRange.type,mt));let Xn=mt;const Ft=class Ft extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Ft,"type",Ft.register("ESUeViewer",c.ESCar.type,Ft));let Jn=Ft;const Qt=class Qt extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i=c.ESClassification.defaults.fillStyle;try{i={...A.fillStyle??c.ESClassification.defaults.fillStyle}}catch(o){console.error("ESClassification fillStyle 属性类型错误!",o),i={...c.ESClassification.defaults.fillStyle}}i.materialParams=JSON.stringify(i.materialParams),t.callUeFunc({f:"update",p:{id:A.id,filled:A.filled??c.ESClassification.defaults.filled,fillStyle:i}})},s=this.dv(c.createNextAnimateFrameEvent(A.fillStyleChanged,A.filledChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};p(Qt,"type",Qt.register("ESUeViewer",c.ESClassification.type,Qt));let zn=Qt;const be=class be extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};p(be,"type",be.register("ESUeViewer",c.ESClippingPlane.type,be)),p(be,"propValFuncs",{...P.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let Yn=be;const Ut=class Ut extends P{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=this.ad(c.reactJson(""));{const o=()=>{if(typeof A.url=="string")n.value=c.ESSceneObject.context.getStrFromEnv(A.url??c.ESDataMesh.defaults.url);else{const a=A.url;a.url=c.ESSceneObject.context.getStrFromEnv(a.url??c.ESDataMesh.defaults.url),n.value=a}};o(),this.ad(A.urlChanged.don(o))}const s=()=>{const o=A.colorStops??c.ESDataMesh.defaults.colorStops;t.callUeFunc({f:"update",p:{id:A.id,url:n.value??c.ESDataMesh.defaults.url,currentTime:A.currentTime??c.ESDataMesh.defaults.currentTime,minPropValue:A.minPropValue??c.ESDataMesh.defaults.minPropValue,maxPropValue:A.maxPropValue??c.ESDataMesh.defaults.maxPropValue,colorStops:JSON.stringify(o)}})},i=this.dv(c.createNextAnimateFrameEvent(n.changed,A.currentTimeChanged,A.minPropValueChanged,A.maxPropValueChanged,A.colorStopsChanged));this.d(i.don(s)),this.d(A.createdEvent.don(s))}};p(Ut,"type",Ut.register("ESUeViewer",c.ESDataMesh.type,Ut));let $n=Ut;const Et=class Et extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Et,"type",Et.register("ESUeViewer",c.ESDatasmithRuntimeModel.type,Et));let Zn=Et;const yt=class yt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(yt,"type",yt.register("ESUeViewer",c.ESDirectionMeasurement.type,yt));let qn=yt;const St=class St extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i;try{i={...A.strokeStyle??c.ESDistanceMeasurement.defaults.strokeStyle}}catch(o){console.error("ESDistanceMeasurement strokeStyle 属性类型错误!",o),i={...c.ESDistanceMeasurement.defaults.strokeStyle}}t.callUeFunc({f:"update",p:{id:A.id,strokeStyle:i}})},s=this.dv(c.createNextAnimateFrameEvent(A.strokeStyleChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};p(St,"type",St.register("ESUeViewer",c.ESDistanceMeasurement.type,St));let jn=St;const It=class It extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(It,"type",It.register("ESUeViewer",c.ESLocalPolygon.type,It));let Sr=It;const Tt=class Tt extends Sr{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Tt,"type",Tt.register("ESUeViewer",c.ESDynamicWater.type,Tt));let As=Tt;const Ht=class Ht extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(e.widgetEvent.don(n=>{if(n.objId!==A.id)return;const{type:s,properties:i}=n;A.widgetEvent.emit({type:s,properties:i})}))}};p(Ht,"type",Ht.register("ESUeViewer",c.ESEntityCluster.type,Ht));let es=Ht;const Me=class Me extends dA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Me,"type",Me.register("ESUeViewer",c.ESExcavate.type,Me)),p(Me,"propValFuncs",{...dA.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let ts=Me;const Lt=class Lt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Lt,"type",Lt.register("ESUeViewer",c.ESFireParticleSystem.type,Lt));let rs=Lt;const bt=class bt extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=this.ad(c.reactJson(""));{const o=()=>{if(typeof A.url=="string")n.value=c.ESSceneObject.context.getStrFromEnv(A.url);else{const a=A.url;a.url=c.ESSceneObject.context.getStrFromEnv(a.url),n.value=a}};o(),this.ad(A.urlChanged.don(o))}const s=()=>{t.callUeFunc({f:"update",p:{id:A.id,url:n.value??c.ESForestTileset.defaults.url,treeTypes:A.treeTypes??c.ESForestTileset.defaults.treeTypes,xiaoBanWidget:A.xiaoBanWidget??c.ESForestTileset.defaults.xiaoBanWidget,youShiSZ:A.youShiSZ??c.ESForestTileset.defaults.youShiSZ,diLei:A.diLei??c.ESForestTileset.defaults.diLei,senLinLB:A.senLinLB??c.ESForestTileset.defaults.senLinLB,labelMaterial:A.labelMaterial??c.ESForestTileset.defaults.labelMaterial,heightOffset:A.heightOffset??c.ESForestTileset.defaults.heightOffset}})},i=this.dv(c.createNextAnimateFrameEvent(n.changed,A.treeTypesChanged,A.xiaoBanWidgetChanged,A.youShiSZChanged,A.diLeiChanged,A.senLinLBChanged,A.labelMaterialChanged,A.heightOffsetChanged));this.d(i.don(s)),this.d(A.createdEvent.don(s))}};p(bt,"type",bt.register("ESUeViewer",c.ESForestTileset.type,bt));let ns=bt;/*!
|
|
91
|
+
`}}class Ja{static deepCopyGamepad(A){return JSON.parse(JSON.stringify({buttons:A.buttons.map(e=>JSON.parse(JSON.stringify({pressed:e.pressed,touched:e.touched}))),axes:A.axes}))}}class Zd{constructor(A){this.toStreamerMessagesProvider=A,this.controllers=[]}updateStatus(A,e,t){if(A.gamepad){const n=e.getPose(A.gripSpace,t);if(!n)return;let s=0;A.profiles.includes("htc-vive")?s=1:A.profiles.includes("oculus-touch")&&(s=2),this.toStreamerMessagesProvider.toStreamerHandlers.get("XRSystem")([s]);let i=2;switch(A.handedness){case"left":i=0;break;case"right":i=1}const o=n.transform.matrix,a=[];for(let u=0;u<16;u++)a[u]=new Float32Array([o[u]])[0];this.toStreamerMessagesProvider.toStreamerHandlers.get("XRControllerTransform")([a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15],i]),this.controllers[i]===void 0&&(this.controllers[i]={prevState:void 0,currentState:void 0,id:void 0},this.controllers[i].prevState=Ja.deepCopyGamepad(A.gamepad)),this.controllers[i].currentState=Ja.deepCopyGamepad(A.gamepad);const l=this.controllers[i],d=l.currentState,h=l.prevState;for(let u=0;u<d.buttons.length;u++){const f=d.buttons[u],B=h.buttons[u];f.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([i,u,B.pressed?1:0]):!f.pressed&&B.pressed&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([i,u,0]),f.touched&&!f.pressed?this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonPressed")([i,3,B.touched?1:0]):!f.touched&&B.touched&&this.toStreamerMessagesProvider.toStreamerHandlers.get("XRButtonReleased")([i,3,0])}for(let u=0;u<d.axes.length;u++)this.toStreamerMessagesProvider.toStreamerHandlers.get("XRAnalog")([i,u,d.axes[u]]);this.controllers[i].prevState=d}}}class za{constructor(A){this.xrSession=null,this.webRtcController=A,this.xrControllers=[],this.xrGamepadController=new Zd(this.webRtcController.streamMessageController),this.onSessionEnded=new EventTarget,this.onSessionStarted=new EventTarget,this.onFrame=new EventTarget}xrClicked(){this.xrSession?this.xrSession.end():navigator.xr.requestSession("immersive-vr").then(A=>{this.onXrSessionStarted(A)})}onXrSessionEnded(){g.Log(g.GetStackTrace(),"XR Session ended"),this.xrSession=null,this.onSessionEnded.dispatchEvent(new Event("xrSessionEnded"))}onXrSessionStarted(A){g.Log(g.GetStackTrace(),"XR Session started"),this.xrSession=A,this.xrSession.addEventListener("end",()=>{this.onXrSessionEnded()});const e=document.createElement("canvas");this.gl=e.getContext("webgl2",{xrCompatible:!0}),this.xrSession.updateRenderState({baseLayer:new XRWebGLLayer(this.xrSession,this.gl)});const t=this.gl.createShader(this.gl.VERTEX_SHADER);this.gl.shaderSource(t,Xa.vertexShader()),this.gl.compileShader(t);const n=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(n,Xa.fragmentShader()),this.gl.compileShader(n);const s=this.gl.createProgram();this.gl.attachShader(s,t),this.gl.attachShader(s,n),this.gl.linkProgram(s),this.gl.useProgram(s),this.positionLocation=this.gl.getAttribLocation(s,"a_position"),this.texcoordLocation=this.gl.getAttribLocation(s,"a_texCoord"),this.positionBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),this.gl.enableVertexAttribArray(this.positionLocation);const i=this.gl.createTexture();this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.texcoordBuffer=this.gl.createBuffer(),this.resolutionLocation=this.gl.getUniformLocation(s,"u_resolution"),this.offsetLocation=this.gl.getUniformLocation(s,"u_offset"),A.requestReferenceSpace("local").then(o=>{this.xrRefSpace=o,this.xrSession.requestAnimationFrame((a,l)=>this.onXrFrame(a,l))}),this.onSessionStarted.dispatchEvent(new Event("xrSessionStarted"))}onXrFrame(A,e){const t=e.getViewerPose(this.xrRefSpace);if(t){const n=t.transform.matrix,s=[];for(let o=0;o<16;o++)s[o]=new Float32Array([n[o]])[0];this.webRtcController.streamMessageController.toStreamerHandlers.get("XRHMDTransform")([s[0],s[4],s[8],s[12],s[1],s[5],s[9],s[13],s[2],s[6],s[10],s[14],s[3],s[7],s[11],s[15]]);const i=this.xrSession.renderState.baseLayer;this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,i.framebuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.webRtcController.videoPlayer.getVideoElement()),this.render(this.webRtcController.videoPlayer.getVideoElement())}this.webRtcController.config.isFlagEnabled(Q.XRControllerInput)&&this.xrSession.inputSources.forEach((n,s,i)=>{this.xrGamepadController.updateStatus(n,e,this.xrRefSpace)},this),this.xrSession.requestAnimationFrame((n,s)=>this.onXrFrame(n,s)),this.onFrame.dispatchEvent(new ya({time:A,frame:e}))}render(A){if(!this.gl)return;const e=this.xrSession.renderState.baseLayer;let t,n,s,i,o;this.gl.viewport(0,0,e.framebufferWidth,e.framebufferHeight),this.gl.uniform4f(this.offsetLocation,1,1,0,0),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,A.videoWidth,0,0,A.videoHeight,0,A.videoHeight,A.videoWidth,0,A.videoWidth,A.videoHeight]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.positionBuffer),t=2,n=this.gl.FLOAT,s=!1,i=0,o=0,this.gl.vertexAttribPointer(this.positionLocation,t,n,s,i,o),this.gl.enableVertexAttribArray(this.texcoordLocation),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.texcoordBuffer),t=2,n=this.gl.FLOAT,s=!1,i=0,o=0,this.gl.vertexAttribPointer(this.texcoordLocation,t,n,s,i,o),this.gl.uniform2f(this.resolutionLocation,A.videoWidth,A.videoHeight);const a=this.gl.TRIANGLES;o=0,this.gl.drawArrays(a,o,6)}static isSessionSupported(A){return navigator.xr?navigator.xr.isSessionSupported(A):new Promise(()=>!1)}}class qd{constructor(A){this.editTextButton=null,this.hiddenInput=null,"ontouchstart"in document.documentElement&&this.createOnScreenKeyboardHelpers(A)}unquantizeAndDenormalizeUnsigned(A,e){return null}createOnScreenKeyboardHelpers(A){this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.id="hiddenInput",this.hiddenInput.maxLength=0,A.appendChild(this.hiddenInput)),this.editTextButton||(this.editTextButton=document.createElement("button"),this.editTextButton.id="editTextButton",this.editTextButton.innerHTML="edit text",A.appendChild(this.editTextButton),this.editTextButton.classList.add("hiddenState"),this.editTextButton.addEventListener("touchend",e=>{this.hiddenInput.focus(),e.preventDefault()}))}showOnScreenKeyboard(A){if(A.showOnScreenKeyboard){this.editTextButton.classList.remove("hiddenState");const e=this.unquantizeAndDenormalizeUnsigned(A.x,A.y);this.editTextButton.style.top=e.y.toString()+"px",this.editTextButton.style.left=(e.x-40).toString()+"px"}else this.editTextButton.classList.add("hiddenState"),this.hiddenInput.blur()}}class jd{constructor(A,e){this._showActionOrErrorOnDisconnect=!0,this.allowConsoleCommands=!1,this.config=A,e!=null&&e.videoElementParent&&(this._videoElementParent=e.videoElementParent),this._eventEmitter=new Ia,this.configureSettings(),this.setWebRtcPlayerController(new Wa(this.config,this)),this.onScreenKeyboardHelper=new qd(this.videoElementParent),this.onScreenKeyboardHelper.unquantizeAndDenormalizeUnsigned=(t,n)=>this._webRtcController.requestUnquantizedAndDenormalizeUnsigned(t,n),this._activateOnScreenKeyboard=t=>this.onScreenKeyboardHelper.showOnScreenKeyboard(t),this._webXrController=new za(this._webRtcController)}get videoElementParent(){return this._videoElementParent||(this._videoElementParent=document.createElement("div"),this._videoElementParent.id="videoElementParent"),this._videoElementParent}configureSettings(){this.config._addOnSettingChangedListener(Q.IsQualityController,A=>{A!==!0||this._webRtcController.isQualityController||this._webRtcController.sendRequestQualityControlOwnership()}),this.config._addOnSettingChangedListener(Q.AFKDetection,A=>{this._webRtcController.setAfkEnabled(A)}),this.config._addOnSettingChangedListener(Q.MatchViewportResolution,()=>{this._webRtcController.videoPlayer.updateVideoStreamSize()}),this.config._addOnSettingChangedListener(Q.HoveringMouseMode,A=>{this.config.setFlagLabel(Q.HoveringMouseMode,`Control Scheme: ${A?"Hovering":"Locked"} Mouse`),this._webRtcController.setMouseInputEnabled(this.config.isFlagEnabled(Q.MouseInput))}),this.config._addOnSettingChangedListener(Q.KeyboardInput,A=>{this._webRtcController.setKeyboardInputEnabled(A)}),this.config._addOnSettingChangedListener(Q.MouseInput,A=>{this._webRtcController.setMouseInputEnabled(A)}),this.config._addOnSettingChangedListener(Q.TouchInput,A=>{this._webRtcController.setTouchInputEnabled(A)}),this.config._addOnSettingChangedListener(Q.GamepadInput,A=>{this._webRtcController.setGamePadInputEnabled(A)}),this.config._addOnNumericSettingChangedListener(b.MinQP,A=>{g.Log(g.GetStackTrace(),"-------- Sending MinQP --------",7),this._webRtcController.sendEncoderMinQP(A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(b.MaxQP,A=>{g.Log(g.GetStackTrace(),"-------- Sending encoder settings --------",7),this._webRtcController.sendEncoderMaxQP(A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(b.WebRTCMinBitrate,A=>{g.Log(g.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMinBitrate(1e3*A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(b.WebRTCMaxBitrate,A=>{g.Log(g.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMaxBitrate(1e3*A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(b.WebRTCFPS,A=>{g.Log(g.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCFps(A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnOptionSettingChangedListener(_.PreferredCodec,A=>{this._webRtcController&&this._webRtcController.setPreferredCodec(A)}),this.config._registerOnChangeEvents(this._eventEmitter)}_activateOnScreenKeyboard(A){throw new Error("Method not implemented.")}_onInputControlOwnership(A){this._inputController=A}setWebRtcPlayerController(A){this._webRtcController=A,this._webRtcController.setPreferredCodec(this.config.getSettingOption(_.PreferredCodec).selected),this._webRtcController.resizePlayerStyle(),this.checkForAutoConnect()}connect(){this._eventEmitter.dispatchEvent(new Ba),this._webRtcController.connectToSignallingServer()}reconnect(){this._eventEmitter.dispatchEvent(new wa),this._webRtcController.restartStreamAutomatically()}disconnect(){this._eventEmitter.dispatchEvent(new fa),this._webRtcController.close()}play(){this._onStreamLoading(),this._webRtcController.playStream()}checkForAutoConnect(){this.config.isFlagEnabled(Q.AutoConnect)&&(this._onWebRtcAutoConnect(),this._webRtcController.connectToSignallingServer())}_onWebRtcAutoConnect(){this._eventEmitter.dispatchEvent(new sa),this._showActionOrErrorOnDisconnect=!0}_onWebRtcSdp(){this._eventEmitter.dispatchEvent(new na)}_onStreamLoading(){this._eventEmitter.dispatchEvent(new ga)}_onDisconnect(A){this._webRtcController.getDisconnectMessageOverride()!=""&&this._webRtcController.getDisconnectMessageOverride()!==void 0&&this._webRtcController.getDisconnectMessageOverride()!=null&&(A=this._webRtcController.getDisconnectMessageOverride(),this._webRtcController.setDisconnectMessageOverride("")),this._eventEmitter.dispatchEvent(new la({eventString:A,showActionOrErrorOnDisconnect:this._showActionOrErrorOnDisconnect})),this._showActionOrErrorOnDisconnect==0&&(this._showActionOrErrorOnDisconnect=!0)}_onWebRtcConnecting(){this._eventEmitter.dispatchEvent(new ia)}_onWebRtcConnected(){this._eventEmitter.dispatchEvent(new oa)}_onWebRtcFailed(){this._eventEmitter.dispatchEvent(new aa)}_onVideoInitialized(){this._eventEmitter.dispatchEvent(new ha),this._videoStartTime=Date.now()}_onLatencyTestResult(A){this._eventEmitter.dispatchEvent(new Ua({latencyTimings:A}))}_onVideoStats(A){this._videoStartTime&&this._videoStartTime!==void 0||(this._videoStartTime=Date.now()),A.handleSessionStatistics(this._videoStartTime,this._inputController,this._webRtcController.videoAvgQp),this._eventEmitter.dispatchEvent(new Fa({aggregatedStats:A}))}_onVideoEncoderAvgQP(A){this._eventEmitter.dispatchEvent(new ra({avgQP:A}))}_onInitialSettings(A){var e;this._eventEmitter.dispatchEvent(new Ea({settings:A})),A.PixelStreamingSettings&&(this.allowConsoleCommands=(e=A.PixelStreamingSettings.AllowPixelStreamingCommands)!==null&&e!==void 0&&e,this.allowConsoleCommands===!1&&g.Info(g.GetStackTrace(),"-AllowPixelStreamingCommands=false, sending arbitrary console commands from browser to UE is disabled."));const t=this.config.useUrlParams,n=new URLSearchParams(window.location.search);A.EncoderSettings&&(this.config.setNumericSetting(b.MinQP,t&&n.has(b.MinQP)?Number.parseInt(n.get(b.MinQP)):A.EncoderSettings.MinQP),this.config.setNumericSetting(b.MaxQP,t&&n.has(b.MaxQP)?Number.parseInt(n.get(b.MaxQP)):A.EncoderSettings.MaxQP)),A.WebRTCSettings&&(this.config.setNumericSetting(b.WebRTCMinBitrate,t&&n.has(b.WebRTCMinBitrate)?Number.parseInt(n.get(b.WebRTCMinBitrate)):A.WebRTCSettings.MinBitrate/1e3),this.config.setNumericSetting(b.WebRTCMaxBitrate,t&&n.has(b.WebRTCMaxBitrate)?Number.parseInt(n.get(b.WebRTCMaxBitrate)):A.WebRTCSettings.MaxBitrate/1e3),this.config.setNumericSetting(b.WebRTCFPS,t&&n.has(b.WebRTCFPS)?Number.parseInt(n.get(b.WebRTCFPS)):A.WebRTCSettings.FPS))}_onQualityControlOwnership(A){this.config.setFlagEnabled(Q.IsQualityController,A)}_onPlayerCount(A){this._eventEmitter.dispatchEvent(new Sa({count:A}))}requestLatencyTest(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendLatencyTest(),!0)}requestShowFps(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendShowFps(),!0)}requestIframe(){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.sendIframeRequest(),!0)}emitUIInteraction(A){return!!this._webRtcController.videoPlayer.isVideoReady()&&(this._webRtcController.emitUIInteraction(A),!0)}emitCommand(A){return!(!this._webRtcController.videoPlayer.isVideoReady()||!this.allowConsoleCommands&&"ConsoleCommand"in A||(this._webRtcController.emitCommand(A),0))}emitConsoleCommand(A){return!(!this.allowConsoleCommands||!this._webRtcController.videoPlayer.isVideoReady()||(this._webRtcController.emitConsoleCommand(A),0))}addResponseEventListener(A,e){this._webRtcController.responseController.addResponseEventListener(A,e)}removeResponseEventListener(A){this._webRtcController.responseController.removeResponseEventListener(A)}dispatchEvent(A){return this._eventEmitter.dispatchEvent(A)}addEventListener(A,e){this._eventEmitter.addEventListener(A,e)}removeEventListener(A,e){this._eventEmitter.removeEventListener(A,e)}toggleXR(){this.webXrController.xrClicked()}setSignallingUrlBuilder(A){this._webRtcController.signallingUrlBuilder=A}get webSocketController(){return this._webRtcController.webSocketController}get webXrController(){return this._webXrController}}T.Dz,T.g$,T.Lt,T.Q9,T.qf,T.hV,T.z$,T.J0;var Ya=T.De;T.$C,T.al,T._W,T.tz,T.Nu,T.zg,T.vp;var pe=T.vU;T.wF,T.rv,T.Nh,T.ss,T.qW,T.QL,T.cf,T.eM;var $a=T.Yd;T.iM,T.qy,T.ce;var Za=T.sK;T.Ok,T.q5;var qa=T.g;T.xl,T.I,T.bx,T.dD,T.Ib,T.Az,T.Iw,T.qY,T.db,T.mR,T.Tn,T.rV,T.gh,T.Mi,T.j,T.YB,T.i5;var Au=T.x_;T.Am,T.eR,T.r8,T.u3,T.vd,T.iV,T.jZ,T.SW,T.ZH,T.Ni,T.lh,T.bq,T.$f,T.eu,T.Ax,T.Mc;const eu={Response:1},Ur={UIInteraction:50,MouseWheel:75};class tu extends c.HasOwner{constructor(e,t){super(e);p(this,"_processResponseFn",e=>this.esUeViewer.processResponse(e));p(this,"_inner");this._uri=t,this._inner=new WebSocket(this._uri),this.d(()=>{this._inner.close()}),this._innerInit()}get esUeViewer(){return this.owner}get uri(){return this._uri}get inner(){return this._inner}_innerInit(){this.inner.onmessage=e=>{if(this.isDestroyed())return;let t=new FileReader;t.onload=n=>{if(this.isDestroyed())return;let s=n.target.result,i=new Uint32Array(s),o=0;if(i[0]===eu.Response){o+=4;let a=i[o/4];o+=4;for(let l=0;l<a;l++){let d=i[o/4];o+=4;let h=new TextDecoder("utf-8").decode(s.slice(o,o+d));o+=d,this._processResponseFn(h)}}},t.readAsArrayBuffer(e.data)},this.inner.onopen=()=>{this.isDestroyed()||(console.warn("earthsdk message websocket server connected:",this.uri),console.log("%c[EarthSDK websocket open]","background: #a6ec99; color: black","open"),this.owner.dispatchEvent(new CustomEvent("esmsgwsopen",{detail:"websocket open"})))},this._inner.onclose=e=>{this.isDestroyed()||(console.log("%c[EarthSDK websocket close ]","background: red; color: black","error"),this.owner.dispatchEvent(new CustomEvent("error",{detail:"websocket close"})))},this._inner.onerror=e=>{this.isDestroyed()||(console.log("%c[EarthSDK websocket error ]","background: red; color: black","error"),this.owner.dispatchEvent(new CustomEvent("error",{detail:"websocket error"})))}}sendInputData(e){const t=this.inner;if(t.readyState!==WebSocket.OPEN)return;const s=new Uint8Array(e)[0];if(s>=Ur.UIInteraction&&s<=Ur.MouseWheel){const i=new ArrayBuffer(e.byteLength+4);return new DataView(i).setUint32(0,e.byteLength,!0),new Uint8Array(i,4).set(new Uint8Array(e)),t.send(new DataView(i)),!0}else return!1}emitDescriptorWithString(e,t){let n=new TextEncoder().encode(t),s=new DataView(new ArrayBuffer(3+n.length)),i=0;s.setUint8(i,e),i++,s.setUint16(i,n.length,!0),i+=2;for(let o=0;o<n.length;o++)s.setUint8(i,n[o]),i+=1;try{this.sendInputData(s.buffer)}catch(o){console.error(`data.buffer.size: ${s.buffer.byteLength} 独立通道 sendInputData error: ${o}`,o)}}destroyImpl(){this._inner&&this._inner.close()}}window.g_emitDescriptor_maxBytes=3e4;let ru=-1;$a.SetLoggerVerbosity(1);class nu extends c.Destroyable{constructor(e,t){super();p(this,"_eventTarget",new EventTarget);p(this,"debug",!1);p(this,"uiInteractionCallbacks",new Map);p(this,"_pixelStream");p(this,"_esMsgWsWrapper");this._domOrDomId=e,this._options=t;const n=typeof this._domOrDomId=="string"?document.getElementById(this._domOrDomId):this._domOrDomId;if(!n)throw new Error(`ESUEViewer container${this._domOrDomId} error!`);console.log(`PSUEViewer init _options ${this._options}`);const{url:s,esmsgWsUri:i}=this._options;this._pixelStream=this._initPixelStream(n,s),this.d(()=>{this._pixelStream.disconnect()}),this._handerPixelStreamEvent(),this._esMsgWsWrapper=this._initEsMsgWsWrapper(i);const o=this;if(o.esMsgWsWrapper){const a=o.webRtcController.sendMessageController.dataChannelSender.sendData;o.webRtcController.sendMessageController.dataChannelSender.constructor.prototype.sendData=function(l){o.esMsgWsWrapper?o.esMsgWsWrapper.sendInputData(l):a.call(this,l)}}}get eventTarget(){return this._eventTarget}addEventListener(e,t,n){return this.eventTarget.addEventListener(e,t,n)}removeEventListener(e,t,n){return this.eventTarget.removeEventListener(e,t,n)}dispatchEvent(e){return this.eventTarget.dispatchEvent(e)}_initPixelStream(e,t){const n=new Ya({initialSettings:{AutoPlayVideo:!0,AutoConnect:!0,StartVideoMuted:!1,SuppressBrowserKeys:!1,[Au.SignallingServerUrl]:t}});return n.setFlagEnabled(pe.BrowserSendOffer,!1),n.setFlagEnabled(pe.HoveringMouseMode,!0),n.setFlagEnabled(pe.MatchViewportResolution,!0),n.setNumericSetting(Za.MaxReconnectAttempts,0),new qa(n,{videoElementParent:e})}get pixelStream(){return this._pixelStream}_initEsMsgWsWrapper(e){return e?this.dv(new tu(this,e)):void 0}get esMsgWsWrapper(){return this._esMsgWsWrapper}get esWebSocketReady(){var e;return((e=this.esMsgWsWrapper)==null?void 0:e.inner.readyState)===1}_handerPixelStreamEvent(){this.pixelStream.addEventListener("videoInitialized",()=>{console.log("%c[EarthSDK webrtc videoInitialized]","background: #a6ec99; color: black","videoInitialized"),this.dispatchEvent(new CustomEvent("videoinited",{detail:"videoinited"}))}),this.pixelStream.addEventListener("webRtcFailed",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webRtc webRtcFailed]","background: red; color: black","webRtcFailed"),this.dispatchEvent(new CustomEvent("error",{detail:"webRtcFailed"})),this.pixelStream.disconnect())}),this.pixelStream.addEventListener("webRtcDisconnected",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webRtc webRtcDisconnected]","background: red; color: black","webRtcDisconnected"),this.dispatchEvent(new CustomEvent("error",{detail:"webRtcDisconnected"})),this.pixelStream.disconnect())}),this.pixelStream.addEventListener("webRtcConnected",()=>{this.isDestroyed()||(console.log("%c[EarthSDK webrtc webRtcConnected]","background: #a6ec99; color: black","webRtcConnected"),this.dispatchEvent(new CustomEvent("webRtcConnected",{detail:"webRtcConnected"})))}),this.pixelStream.addResponseEventListener("esueviewer",e=>{this.processResponse(e)})}resolveCallback(e){let t={};try{t=JSON.parse(e)}catch{return!1}let n=t.callid;if(typeof n!="string"||!this.uiInteractionCallbacks.has(n))return!1;let s=this.uiInteractionCallbacks.get(n);return typeof s!="function"?!1:(s(t),this.uiInteractionCallbacks.delete(n),!0)}processResponse(e){if(this.debug??!1)try{const t=JSON.parse(e);if(t.ers=t.ers&&t.ers.filter(n=>n.et!=="mouseMoveEvent"),!(t.ers&&t.ers.length>0||t.frs&&t.frs.length>0))return;console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}this.resolveCallback(e)||this.dispatchEvent(new CustomEvent("ueevent",{detail:e}))}emitUIInteraction(e,t){typeof t=="function"&&(e.callid=c.createGuid(),this.uiInteractionCallbacks.set(e.callid,t)),this.pixelStream.emitUIInteraction(e)}get webRtcController(){return this.pixelStream._webRtcController}emitUIInteractionForBigData(e,t){typeof t=="function"&&(e.callid=c.createGuid(),this.uiInteractionCallbacks.set(e.callid,t));const n=JSON.stringify(e),s=window.g_emitDescriptor_maxBytes,i=n.length,o=++ru;if(this.esMsgWsWrapper){if(i<s){this.esMsgWsWrapper.emitDescriptorWithString(Ur.UIInteraction,`${o}-0/1-`+n);return}const a=Math.ceil(i/s)|0;[...new Array(a).keys()].map(d=>n.slice(d*s,(d+1)*s)).forEach((d,h)=>{this.esMsgWsWrapper&&this.esMsgWsWrapper.emitDescriptorWithString(Ur.UIInteraction,`${o}-${h}/${a}-`+d)})}}emitCommand(e){this.pixelStream.emitCommand(e)}getVideoSize(){const e=this.webRtcController.videoPlayer.getVideoElement();return{width:e.videoWidth,height:e.videoHeight}}resizeUEVideo(e,t){let n={Resolution:{Width:e,Height:t}};console.log(`resizeUEVideo emitCommand ${e} ${t} begin`),this.emitCommand(n)}}class su extends c.Destroyable{constructor(e,t,n){super();p(this,"_instance");p(this,"_event",this.dv(new c.Event));this._container=e,this._wsuri=t,this._esmsgWsUri=n,this._instance=this.dv(new nu(this._container,{url:this._wsuri,esmsgWsUri:this._esmsgWsUri})),this.instanceInit()}get webSocketReady(){return this._instance.esWebSocketReady}get event(){return this._event}get debug(){return this._instance.debug}set debug(e){this._instance.debug=e}instanceInit(){if("addEventListener"in this._instance){["esmsgwsopen","error","videoinited","ueevent","webRtcConnected"].forEach(t=>{const n=s=>{this._event.emit(t,s.detail)};this._instance.addEventListener(t,n),this.dispose(()=>this._instance.removeEventListener(t,n))});return}this.dispose(this._instance.errorEvent.disposableOn(e=>{this._event.emit("error",e.detail)})),this.dispose(this._instance.webRtcConnectedEvent.disposableOn(e=>{this._event.emit("webRtcConnected",e.detail)})),this.dispose(this._instance.videoinitedEvent.disposableOn(e=>{this._event.emit("videoinited",e.detail)})),this.dispose(this._instance.ueevent.disposableOn(e=>{this._event.emit("ueevent",e.detail)}))}emitUIInteractionForBigData(e,t){return new Promise((n,s)=>{const i=(...o)=>{n(o),t&&t(...o)};try{this._instance.emitUIInteractionForBigData(e,i)}catch(o){console.warn(`emitUIInteraction发生错误:${o}`),s(o)}})}getVideoSize(){return this._instance.getVideoSize()}resize(e,t){this._instance.resizeUEVideo(e,t)}}class iu extends Ve{constructor(e,t,n,s){super();p(this,"_esueViewerWrapper");p(this,"_ueFuncResultWithIdsEvent",this.dv(new c.Event));p(this,"_ueFuncWithIdAndResultCallbacks",[]);p(this,"_waitingUeFuncIdAndResultCallbacks",new Map);p(this,"_waitingUeCalls",new Set);p(this,"_ueEvent",this.dv(new c.Event));p(this,"_errorEvent",this.dv(new c.Event));p(this,"_readyEvent",this.dv(new c.Event));p(this,"_esmsgwsopen",this.dv(c.react(!1)));p(this,"_videoinited",this.dv(c.react(!1)));p(this,"_webRtcConnected",this.dv(c.react(!1)));this._ueViewer=s,console.log("CSTMPSViewer init ! 以官方像素流 + 独立通信的模式启动!");const i=this._ueViewer;this._esueViewerWrapper=this.dv(new su(e,t,n));const o=this._esueViewerWrapper;{const f=()=>o.debug=i.debug??!1;f(),this.d(i.debugChanged.don(f))}let a=!1;{const f=()=>{if(a)return;const B=o.webSocketReady;if(this.videoinited&&this.webRtcConnected&&B){console.log("%c[EarthSDK: esmsgWebSocket && videoinited && webRtcConnected]","background: #a6ec99; color: black");const w={eventType:"init",params:{}};o.emitUIInteractionForBigData(w),this._readyEvent.emit(),a=!0}};this.d(this.videoinitedChanged.don(()=>{f()})),this.d(this.webRtcConnectedChanged.don(()=>{f()})),this.d(this.esmsgwsopenChanged.don(()=>{f()}))}this.d(o.event.don((f,B)=>{if(f==="error")this._errorEvent.emit(B);else if(f==="ueevent"){const w=JSON.parse(B);if(w.t==="cr"){const v=w;if(v.frs&&this._ueFuncResultWithIdsEvent.emit(v.frs),v.ers)for(let m of v.ers)this._ueEvent.emit(m)}}else f==="webRtcConnected"?this.webRtcConnected=!0:f==="videoinited"?this.videoinited=!0:f==="esmsgwsopen"&&(this.esmsgwsopen=!0)}));{const f=this.dv(c.createAnimateFrame());let B,w;f.start(()=>{if(B!==e.offsetWidth||w!==e.offsetHeight){if(B=e.offsetWidth,w=e.offsetHeight,B===void 0||w===void 0||!Number.isFinite(B)||!Number.isFinite(w)||B<0||w<0){console.warn(`lastWidth === undefined || lastHeight === undefined || !Number.isFinite(lastWidth) || !Number.isFinite(lastHeight) || lastWidth < 0 || lastHeight < 0 ${B} ${w}`);return}o.resize(B,w),console.log(`resize: ${B} ${w}`)}})}this.d(this._ueFuncResultWithIdsEvent.don(f=>{for(const B of f){const w=this._waitingUeFuncIdAndResultCallbacks.get(B.fid);w&&(this._waitingUeFuncIdAndResultCallbacks.delete(B.fid),w.resultCallback(B.r))}}));let l=0;const d=f=>{const B={n:l++,tt:Date.now(),t:"c",fs:f};this._waitingUeCalls.add(B),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(B,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd()),this._esueViewerWrapper.emitUIInteractionForBigData(B,()=>{this._waitingUeCalls.delete(B)})},h=()=>{if(!a||this._ueFuncWithIdAndResultCallbacks.length===0)return;const f=this._ueFuncWithIdAndResultCallbacks.map(([B])=>B);for(const[B,w]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(B.fid,w);this._ueFuncWithIdAndResultCallbacks.length=0;{const B=window.g_emitDescriptor_maxBytes,w=f.map(H=>({f:H,s:JSON.stringify(H).length}));let v=w.length,m=0,F=0,E=[];do{do{const{f:H,s:S}=w[m];if(E.push(H),++m,F+S>B||E.length>=20)break}while(m<v);E.length>0&&(i.debug&&console.log(`传送${E.length}条消息...`),d([...E]),E.length=0,F=0)}while(m<v)}};this.dv(c.createInterval()).start(h,50),this.d(()=>console.log("UeCloudViewer正在销毁..."))}get esueViewerWrapper(){return this._esueViewerWrapper}get errorEvent(){return this._errorEvent}get readyEvent(){return this._readyEvent}get esmsgwsopen(){return this._esmsgwsopen.value}set esmsgwsopen(e){this._esmsgwsopen.value=e}get esmsgwsopenChanged(){return this._esmsgwsopen.changed}get videoinited(){return this._videoinited.value}set videoinited(e){this._videoinited.value=e}get videoinitedChanged(){return this._videoinited.changed}get webRtcConnected(){return this._webRtcConnected.value}set webRtcConnected(e){this._webRtcConnected.value=e}get webRtcConnectedChanged(){return this._webRtcConnected.changed}resize(e,t){this.esueViewerWrapper.resize(e,t)}callUeFunc(e){return new Promise(t=>{const s={fid:c.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,{timeStamp:Date.now(),ueFunc:e,resultCallback:t}])})}disposableOnUeEvent(e,t){(this._ueViewer.debug??!1)&&console.log(`disposableOnUeEvent from UeCloudViewer, type:${e}`);const n=c.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.don(o=>{o.et===e&&o.eid===n&&t(o)});return()=>{i(),s()}}}function ou(r){let A="";const e=new Uint8Array(r),t=e.length;for(let n=0;n<t;n++)A+=String.fromCharCode(e[n]);return btoa(A)}const au=r=>{const A={type:"input",inputdata:ou(r)};return JSON.stringify(A)};function lu(r){return typeof r=="string"?document.getElementById(r):r}window.g_emitDescriptor_maxBytes=3e4,console.log("全局可设置消息体最大字节, window.g_emitDescriptor_maxBytes 默认 30000 。");let cu=-1;$a.SetLoggerVerbosity(1);class du extends c.Destroyable{constructor(e,t){super();p(this,"debug",!1);p(this,"_error",this.dv(new c.Event));p(this,"_connected",this.dv(new c.Event));p(this,"_ueevent",this.dv(new c.Event));p(this,"_pixelStream");p(this,"uiInteractionCallbacks",new Map);this._container=e,this._option=t;const n=new Ya({initialSettings:{HoveringMouse:!0,AutoPlayVideo:!0,AutoConnect:!0,StartVideoMuted:!1,SuppressBrowserKeys:!1,ss:this._option.ws},useUrlParams:!0});n.setFlagEnabled(pe.BrowserSendOffer,!1),n.setFlagEnabled(pe.HoveringMouseMode,!0),n.setFlagEnabled(pe.MatchViewportResolution,!0),n.setNumericSetting(Za.MaxReconnectAttempts,0),this._pixelStream=new qa(n,{videoElementParent:this.container}),this.d(()=>{this._pixelStream.disconnect()});{const s=this.pixelStream.webSocketController.webSocket,i=this._pixelStream._webRtcController.sendMessageController.dataChannelSender.sendData;this._pixelStream._webRtcController.sendMessageController.dataChannelSender.constructor.prototype.sendData=function(o){s?s.send(au(o)):i.call(this,o)}}{const s=i=>{const o=this._pixelStream._webRtcController.mouseController;setTimeout(()=>{const a=o.coordinateConverter.normalizeAndQuantizeUnsigned(i.offsetX,i.offsetY),d=o.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp");d&&d([i.button,a.x,a.y]),i.preventDefault()})};this.container.addEventListener("dblclick",s),this.d(()=>{this.container.removeEventListener("dblclick",s)})}["error","close","open"].forEach(i=>{const o=()=>{this.isDestroyed()||(i==="open"?this.connected.emit("webSocketOpen"):i==="close"?this.error.emit("webSocketClose"):i==="error"&&this.error.emit("webSocketError"))};this.pixelStream.webSocketController.webSocket.addEventListener(i,o),this.d(()=>{this.pixelStream.webSocketController.webSocket.removeEventListener(i,o)})}),["videoInitialized","webRtcConnected","webRtcDisconnected","webRtcFailed"].forEach(i=>{const o=()=>{this.isDestroyed()||(i==="webRtcConnected"||i==="videoInitialized"?this.connected.emit(i):(i==="webRtcDisconnected"||i==="webRtcFailed")&&(this.error.emit(i),this.pixelStream.disconnect()))};this.pixelStream.addEventListener(i,o),this.d(()=>{this.pixelStream.removeEventListener(i,o)})}),this.pixelStream.addResponseEventListener("handle_responses",s=>{this.processResponse(s)}),this.d(()=>{this.pixelStream.removeResponseEventListener("handle_responses")})}get error(){return this._error}get connected(){return this._connected}get ueevent(){return this._ueevent}get container(){return lu(this._container)}get pixelStream(){return this._pixelStream}get webSocketReady(){return this.pixelStream.webSocketController.webSocket.readyState===1}processResponse(e){if(this.debug??!1)try{const t=JSON.parse(e);console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}this.resolveCallback(e)||this.ueevent.emit(e)}emitUIInteractionForBigData(e,t){typeof t=="function"&&(e.callid=c.createGuid(),this.uiInteractionCallbacks.set(e.callid,t));const n=JSON.stringify(e),s=window.g_emitDescriptor_maxBytes??3e4,i=n.length,o=++cu;if(i<s){const d={type:"earthsdk",time:new Date().getTime(),params:`${o}-0/1-`+n};this.sendData(JSON.stringify(d));return}const a=Math.ceil(i/s)|0;[...new Array(a).keys()].map(d=>n.slice(d*s,(d+1)*s)).forEach((d,h)=>{const u={type:"earthsdk",time:new Date().getTime(),params:`${o}-${h}/${a}-`+d};this.sendData(JSON.stringify(u))})}sendData(e){this.pixelStream.webSocketController.webSocket.send(e)}resolveCallback(e){let t={};try{t=JSON.parse(e)}catch{return!1}let n=t.callid;if(typeof n!="string"||!this.uiInteractionCallbacks.has(n))return!1;let s=this.uiInteractionCallbacks.get(n);return typeof s!="function"?!1:(s(t),this.uiInteractionCallbacks.delete(n),!0)}getVideoSize(){const e=this._pixelStream._webRtcController.videoPlayer.getVideoElement();return{width:e.videoWidth,height:e.videoHeight}}emitCommand(e){this.pixelStream.emitCommand(e)}emitUIInteraction(){console.log("emitUIInteraction 像素流初始化"),this.pixelStream.emitUIInteraction("像素流初始化")}resizeUEVideo(e,t){const n={Resolution:{Width:e,Height:t}};console.log(`resizeUEVideo emitCommand ${e} ${t} begin`),this.emitCommand(n)}}class uu extends c.Destroyable{constructor(e,t,n){super();p(this,"_instance");p(this,"_event",this.dv(new c.Event));this._container=e,this._wsuri=t,this._esmsgWsUri=n,this._instance=this.dv(new du(this._container,{ws:this._wsuri})),this.d(this._instance.connected.don(s=>{this._event.emit(s,s),console.log(`%c[EarthSDK] ${s}`,"background: #a6ec99; color: black")})),this.d(this._instance.error.don(s=>{this._event.emit("errorEvent",s),console.log(`%c[EarthSDK] ${s}`,"background: red; color: black")})),this.d(this._instance.ueevent.don(s=>{this._event.emit("ueevent",s)}))}get instance(){return this._instance}get event(){return this._event}get debug(){return this._instance.debug}set debug(e){this._instance.debug=e}emitUIInteractionForBigData(e,t){return new Promise((n,s)=>{const i=(...o)=>{n(o),t&&t(...o)};try{this._instance.emitUIInteractionForBigData(e,i)}catch(o){console.warn(`emitUIInteraction发生错误:${o}`),s(o)}})}getVideoSize(){return this._instance.getVideoSize()}resize(e,t){this._instance.resizeUEVideo(e,t)}}class hu extends Ve{constructor(e,t,n,s){super();p(this,"_videoInitialized",this.dv(c.react(!1)));p(this,"_webRtcConnected",this.dv(c.react(!1)));p(this,"_webSocketOpen",this.dv(c.react(!1)));p(this,"_ue5ViewerWrapper");p(this,"_ueFuncResultWithIdsEvent",this.dv(new c.Event));p(this,"_ueFuncWithIdAndResultCallbacks",[]);p(this,"_waitingUeFuncIdAndResultCallbacks",new Map);p(this,"_waitingUeCalls",new Set);p(this,"_ueEvent",this.dv(new c.Event));p(this,"_errorEvent",this.dv(new c.Event));p(this,"_readyEvent",this.dv(new c.Event));this._ueViewer=s,console.log("INNPSViewer init ! 以内置信令服务器模式启动!");const i=this._ueViewer,o=this.dv(new uu(e,t,n));this._ue5ViewerWrapper=o;{const u=()=>o.debug=i.debug??!1;u(),this.d(i.debugChanged.don(u))}{let u=!1;const f=this.dv(c.createNextAnimateFrameEvent(this._videoInitialized.changed,this._webRtcConnected.changed,this._webSocketOpen.changed));this.d(f.don(()=>{if(u)return;const B=this._ue5ViewerWrapper.instance.webSocketReady;if(this.videoInitialized&&this.webRtcConnected&&B){this._ue5ViewerWrapper.instance.emitUIInteraction(),this._readyEvent.emit(),u=!0,console.log("%c[EarthSDK videoInitialized && webRtcConnected && webSocketReady]","background: #a6ec99; color: black");const w={eventType:"init",params:{}};this._ue5ViewerWrapper.emitUIInteractionForBigData(w)}else console.warn("webSocketReady",B),u=!1}))}this.d(o.event.don((u,f)=>{if(u==="errorEvent")this._errorEvent.emit(f);else if(u==="videoInitialized")this._videoInitialized.value=!0;else if(u==="webRtcConnected")this._webRtcConnected.value=!0;else if(u==="webSocketOpen")this._webSocketOpen.value=!0;else if(u==="ueevent"){const B=JSON.parse(f);if(B.t==="cr"){const w=B;if(w.frs&&this._ueFuncResultWithIdsEvent.emit(w.frs),w.ers)for(let v of w.ers)this._ueEvent.emit(v)}}}));{const u=this.dv(c.createAnimateFrame());let f,B,w;u.start(()=>{if(f!==e.offsetWidth||B!==e.offsetHeight||w!==i.resolutionScale){if(f=e.offsetWidth,B=e.offsetHeight,f===void 0||B===void 0||!Number.isFinite(f)||!Number.isFinite(B)||f<0||B<0){console.warn(`lastWidth === undefined || lastHeight === undefined || !Number.isFinite(lastWidth) || !Number.isFinite(lastHeight) || lastWidth < 0 || lastHeight < 0 ${f} ${B}`);return}w=i.resolutionScale,o.resize(f/w,B/w)}})}this.d(this._ueFuncResultWithIdsEvent.don(u=>{for(const f of u){const B=this._waitingUeFuncIdAndResultCallbacks.get(f.fid);B&&(this._waitingUeFuncIdAndResultCallbacks.delete(f.fid),B.resultCallback(f.r))}}));let a=0;const l=u=>{const f={n:a++,tt:Date.now(),t:"c",fs:u};this._waitingUeCalls.add(f),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(f,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd()),this._ue5ViewerWrapper.emitUIInteractionForBigData(f,()=>{this._waitingUeCalls.delete(f)})},d=()=>{if(!this._ue5ViewerWrapper.instance.webSocketReady||this._ueFuncWithIdAndResultCallbacks.length===0)return;const f=this._ueFuncWithIdAndResultCallbacks.map(([B])=>B);for(const[B,w]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(B.fid,w);this._ueFuncWithIdAndResultCallbacks.length=0;{const B=window.g_emitDescriptor_maxBytes,w=f.map(H=>({f:H,s:JSON.stringify(H).length}));let v=w.length,m=0,F=0,E=[];do{do{const{f:H,s:S}=w[m];if(E.push(H),++m,F+S>B||E.length>=20)break}while(m<v);E.length>0&&(i.debug&&console.log(`传送${E.length}条消息...`),l([...E]),E.length=0,F=0)}while(m<v)}};this.dv(c.createInterval()).start(d,50),this.d(()=>console.log("UeCloudViewer正在销毁..."))}get videoInitialized(){return this._videoInitialized.value}get webRtcConnected(){return this._webRtcConnected.value}get webSocketOpen(){return this._webSocketOpen.value}get ue5ViewerWrapper(){return this._ue5ViewerWrapper}get errorEvent(){return this._errorEvent}get readyEvent(){return this._readyEvent}resize(e,t){this.ue5ViewerWrapper.resize(e,t)}callUeFunc(e){return new Promise(t=>{const s={fid:c.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,{timeStamp:Date.now(),ueFunc:e,resultCallback:t}])})}disposableOnUeEvent(e,t){const n=c.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.don(o=>{o.et===e&&o.eid===n&&t(o)});return()=>{i(),s()}}}class gu extends c.Destroyable{constructor(e,t,n,s){super();p(this,"_onRuntimeInitialized",this.dv(new c.Event));p(this,"_vIframe",null);this._ueViewer=s;const i=this._ueViewer;{const o=document.createElement("iframe");this._vIframe=o,o.style.cssText="width: 100%; height: 100%; margin: 0; padding: 0; border: none; outline: none;",e.appendChild(o),this.d(()=>{o&&e.removeChild(o)});const a=c.ESSceneObject.getStrFromEnv(n+`/web/${t}.html`);o.src=a,o.onload=()=>{const l=o.contentWindow;if(!l){console.error("iframeWindow is null");return}console.log("iwindow.Module",l.Module),l.Module.onRuntimeInitialized=()=>{this._onRuntimeInitialized.emit(),i.setStatus("Created"),i.setStatusLog("创建成功"),l.Module.UE4_resizeCanvas(),l.console.log("创建成功__________________________________________")}}}}get onRuntimeInitialized(){return this._onRuntimeInitialized}get vIframe(){return this._vIframe}}const ja=typeof TextDecoder<"u"?new TextDecoder:void 0,Bu=(r,A=0,e=NaN)=>{const t=A+e;let n=A;for(;r[n]&&!(n>=t);)++n;if(n-A>16&&r.buffer&&ja)return ja.decode(r.subarray(A,n));let s="";for(;A<n;){var i=r[A++];if(!(i&128)){s+=String.fromCharCode(i);continue}var o=r[A++]&63;if((i&224)==192){s+=String.fromCharCode((i&31)<<6|o);continue}var a=r[A++]&63;if((i&240)==224?i=(i&15)<<12|o<<6|a:((i&248)!=240&&console.warn("Invalid UTF-8 leading byte encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),i=(i&7)<<18|o<<12|a<<6|r[A++]&63),i<65536)s+=String.fromCharCode(i);else{var l=i-65536;s+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return s};class fu extends c.Destroyable{constructor(A,e,t){super();{const n=()=>{const a=Qn(e);e.setGlobalProperty(a)};n();const s=mr(),i=[];s.forEach(a=>{const l=e[a+"Changed"];i.push(l)});const o=this.dv(c.createNextAnimateFrameEvent(...i));this.d(o.don(n))}this.d(e.propChanged.don(n=>{if(n.objId==="")try{Object.keys(n.props).forEach(s=>{const i=n.props[s]===null?void 0:n.props[s];e[s]=i})}catch(s){console.error("ueViewer propChanged:"+s)}})),e.useCustomInteraction=!1,this.dv(new c.ViewerCustomInteraction(e,A)),this.dv(new c.ObjResettingWithEvent(e.statusUpdateIntervalChanged,n=>{if((e.statusUpdateInterval??.5)===0)return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("statusUpdate",o=>{e.statusUpdateEvent.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.propChangedListeningChanged,()=>{if(!(e.propChangedListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("propChanged",i=>{e.propChanged.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(e.objectEventListeningChanged,()=>{if(!(e.objectEventListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("objectEvent",i=>{e.objectEvent.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(e.widgetEventListeningChanged,()=>{if(!(e.widgetEventListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("widgetEvent",i=>{e.widgetEvent.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(e.speechRecognitionListeningChanged,()=>{if(!(e.speechRecognitionListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("speechRecognition",i=>{e.speechRecognition.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(e.customMessageListeningChanged,()=>{if(!(e.customMessageListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("customMessage",i=>{e.customMessage.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(e.editingEventListeningChanged,()=>{if(!(e.editingEventListening??!0))return;const s=new c.Destroyable;return s.d(t.disposableOnUeEvent("editingEvent",i=>{i.objectIDs=i.objectIDs.map(o=>{var a;return((a=c.ESSceneObject.getSceneObjById(o))==null?void 0:a.parentID)??o}),e.editingEvent.emit(i)})),s})),this.ad(t.disposableOnUeEvent("cameraChanged",()=>{e.cameraChanged.emit()}))}}let wu=-1;class pu extends Ve{constructor(e,t,n="${earthsdk3-ue-h5-assets-script-dir}",s){super();p(this,"_ueFuncResultWithIdsEvent",this.dv(new c.Event));p(this,"_ueFuncWithIdAndResultCallbacks",[]);p(this,"_waitingUeFuncIdAndResultCallbacks",new Map);p(this,"_waitingUeCalls",new Map);p(this,"_ueEvent",this.dv(new c.Event));this._ueViewer=s;const i=this._ueViewer,o=this.dv(new gu(e,t,n,i));let a=!1,l=null;this.d(o.onRuntimeInitialized.don(()=>{var f;if(a=!0,(f=o==null?void 0:o.vIframe)!=null&&f.contentWindow){l=o.vIframe.contentWindow;const B=o.vIframe.contentWindow.document.getElementById("mainarea");B?this.dv(new fu(B,i,this)):console.error("h5Container is null")}else{console.error("iframeWindow is null");return}l.UE_JSHTML5Communication?l.UE_JSHTML5Communication.UESendMessageToJS=B=>{try{const w=Bu(l.HEAPU8,B),v=JSON.parse(w);if(i.debug&&(console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(v,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()),v.t==="cr"){const m=v;if(m.frs&&this._ueFuncResultWithIdsEvent.emit(m.frs),m.ers)for(let F of m.ers)this._ueEvent.emit(F)}v.callid&&this._waitingUeCalls.has(v.callid)&&(this._waitingUeCalls.delete(v.callid),console.log(`waitingUeCalls.delete:${v.callid} end`))}catch(w){console.error("UE_JSHTML5Communication.UESendMessageToJS error:",w)}}:console.error("UE_JSHTML5Communication UESendMessageToJS not found")})),this.dispose(this._ueFuncResultWithIdsEvent.disposableOn(f=>{for(const B of f){const w=this._waitingUeFuncIdAndResultCallbacks.get(B.fid);w&&(this._waitingUeFuncIdAndResultCallbacks.delete(B.fid),w(B.r))}}));let d=0;const h=()=>{if(!a||!l||!l.UE_JSHTML5Communication||!l.UE_JSHTML5Communication.JSSendMessageToUE||this._ueFuncWithIdAndResultCallbacks.length===0)return;const f=this._ueFuncWithIdAndResultCallbacks.map(([S])=>S),B={n:d++,tt:Date.now(),t:"c",fs:f,callid:c.createGuid()};for(const[S,U]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(S.fid,U);this._ueFuncWithIdAndResultCallbacks.length=0,this._waitingUeCalls.set(B.callid,B),i.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(B,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd());const w=JSON.stringify(B),v=window.g_emitDescriptor_maxBytes??3e4,m=w.length,F=++wu;if(m<v){const S=`${F}-0/1-`+w;l.UE_JSHTML5Communication.JSSendMessageToUE(S);return}const E=Math.ceil(m/v)|0;[...new Array(E).keys()].map(S=>w.slice(S*v,(S+1)*v)).forEach((S,U)=>{const D=`${F}-${U}/${E}-`+S;l.UE_JSHTML5Communication.JSSendMessageToUE(D)})};this.dv(c.createInterval()).start(h,50)}processResponse(e){if(this._ueViewer.debug??!1)try{const t=JSON.parse(e);console.group("%cUE => JS"," background-color:#006EFF;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(t,void 0,"")}`," border:1px dashed #006EFF;border-radius:5px;padding:10px;line-height:25px;color:#006EFF;"),console.groupEnd()}catch(t){console.error(`processResponse(${e}) error: ${t}`,t)}}callUeFunc(e){return new Promise(t=>{const s={fid:c.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,t])})}disposableOnUeEvent(e,t){const n=c.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.disposableOn(o=>{o.et===e&&o.eid===n&&((this._ueViewer.debug??!1)&&console.log(`callback, type:${e} eid:${n} ueEvent:${JSON.stringify(o)}`),t(o))});return()=>{i(),s()}}}let Cu=-1;class vu extends Ve{constructor(e,t){super();p(this,"_ueFuncResultWithIdsEvent",this.dv(new c.Event));p(this,"_ueFuncWithIdAndResultCallbacks",[]);p(this,"_waitingUeFuncIdAndResultCallbacks",new Map);p(this,"_waitingUeCalls",new Set);p(this,"_ueEvent",this.dv(new c.Event));this._ueViewer=t;const n=this._ueViewer;let s=!1;const i={eventType:"init",params:{}};window.ue.es.oncommand(JSON.stringify(i)),s=!0,window.calljs=(d,h)=>{if(n.debug&&console.log(`calljs eventName:${d} eventDetailStr:${h}`),d==="ueevent"||d==="commanFinish")try{const u=JSON.parse(h);if(u.t==="cr"){const f=u;if(f.frs&&this._ueFuncResultWithIdsEvent.emit(f.frs),f.ers)for(let B of f.ers)this._ueEvent.emit(B)}}catch(u){console.error(u)}},this.dispose(this._ueFuncResultWithIdsEvent.disposableOn(d=>{for(const h of d){const u=this._waitingUeFuncIdAndResultCallbacks.get(h.fid);u&&(this._waitingUeFuncIdAndResultCallbacks.delete(h.fid),u(h.r))}}));let o=0;const a=()=>{if(!s||this._ueFuncWithIdAndResultCallbacks.length===0)return;const d=this._ueFuncWithIdAndResultCallbacks.map(([f])=>f),h={n:o++,tt:Date.now(),t:"c",fs:d};for(const[f,B]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(f.fid,B);this._ueFuncWithIdAndResultCallbacks.length=0,this._waitingUeCalls.add(h),n.debug&&(console.group("%cxe2 => ue"," background-color:green;color:#ffffff;font-weight:bold;padding:4px;border-radius:5px;"),console.log(`%c${JSON.stringify(h,void 0,"")}`," border:1px dashed green;border-radius:5px;padding:10px;line-height:25px;color:green;"),console.groupEnd());const u=++Cu;window.ue.es.oncommand(`${u}-0/1-`+JSON.stringify(h)).then(()=>{this._waitingUeCalls.delete(h)})};this.dv(c.createInterval()).start(a,50)}callUeFunc(e){return new Promise(t=>{const s={fid:c.createGuid(),...e};this._ueFuncWithIdAndResultCallbacks.push([s,t])})}disposableOnUeEvent(e,t){const n=c.createGuid();this.callUeFunc({f:"addEventListener",p:{et:e,eid:n}});const s=()=>{this.callUeFunc({f:"removeEventListener",p:{eid:n}})},i=this._ueEvent.disposableOn(o=>{o.et===e&&o.eid===n&&((this._ueViewer.debug??!1)&&console.log(`callback, type:${e} eid:${n} ueEvent:${JSON.stringify(o)}`),t(o))});return()=>{i(),s()}}}class mu extends c.Destroyable{constructor(A,e){super();{const t=()=>{const o=Qn(A);A.setGlobalProperty(o)};t();const n=mr(),s=[];n.forEach(o=>{const a=A[o+"Changed"];s.push(a)});const i=this.dv(c.createNextAnimateFrameEvent(...s));this.d(i.don(t))}this.d(A.propChanged.don(t=>{if(t.objId==="")try{Object.keys(t.props).forEach(n=>{const s=t.props[n]===null?void 0:t.props[n];A[n]=s})}catch(n){console.error("ueViewer propChanged:"+n)}})),this.dv(new c.ObjResettingWithEvent(A.statusUpdateIntervalChanged,t=>{if((A.statusUpdateInterval??.5)===0)return;const s=new c.Destroyable;return s.d(e.disposableOnUeEvent("statusUpdate",i=>{A.statusUpdateEvent.emit(i)})),s})),this.dv(new c.ObjResettingWithEvent(A.propChangedListeningChanged,()=>{if(!(A.propChangedListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("propChanged",s=>{A.propChanged.emit(s)})),n})),this.dv(new c.ObjResettingWithEvent(A.objectEventListeningChanged,()=>{if(!(A.objectEventListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("objectEvent",s=>{A.objectEvent.emit(s)})),n})),this.dv(new c.ObjResettingWithEvent(A.widgetEventListeningChanged,()=>{if(!(A.widgetEventListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("widgetEvent",s=>{A.widgetEvent.emit(s)})),n})),this.dv(new c.ObjResettingWithEvent(A.speechRecognitionListeningChanged,()=>{if(!(A.speechRecognitionListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("speechRecognition",s=>{A.speechRecognition.emit(s)})),n})),this.dv(new c.ObjResettingWithEvent(A.customMessageListeningChanged,()=>{if(!(A.customMessageListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("customMessage",s=>{A.customMessage.emit(s)})),n})),this.dv(new c.ObjResettingWithEvent(A.editingEventListeningChanged,()=>{if(!(A.editingEventListening??!0))return;const n=new c.Destroyable;return n.d(e.disposableOnUeEvent("editingEvent",s=>{s.objectIDs=s.objectIDs.map(i=>{var o;return((o=c.ESSceneObject.getSceneObjById(i))==null?void 0:o.parentID)??i}),A.editingEvent.emit(s)})),n})),this.ad(e.disposableOnUeEvent("cameraChanged",()=>{A.cameraChanged.emit()}))}}class Fu extends c.Destroyable{constructor(A,e,t){super();{const s=()=>{const l=Qn(e);e.setGlobalProperty(l)};s();const i=mr(),o=[];i.forEach(l=>{const d=e[l+"Changed"];o.push(d)});const a=this.dv(c.createNextAnimateFrameEvent(...o));this.d(a.don(s))}this.d(e.propChanged.don(s=>{if(s.objId==="")try{Object.keys(s.props).forEach(i=>{const o=s.props[i]===null?void 0:s.props[i];e[i]=o})}catch(i){console.error("ueViewer propChanged:"+i)}}));const n=document.createElement("div");n.style.width="100%",n.style.height="100%",n.style.position="absolute",n.style.overflow="hidden",n.style.top="0",n.style.left="0",n.style.zIndex="0",n.style.backgroundColor="rgba(255,0,0,0)",n.setAttribute("masker","大屏顶层div,用于模拟鼠标事件和控制UE鼠标事件是否生效"),A.appendChild(n),this.d(()=>{n&&A&&A.removeChild(n)});{const s=(l,d)=>{window.ue.esinput.setinterceptevent(d),l.preventDefault()},i=l=>{s(l,!1)},o=l=>{s(l,!0)},a=l=>{s(l,!1)};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",o),n.addEventListener("mousemove",a),this.d(()=>{n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",o),n.removeEventListener("mousemove",a)})}e.useCustomInteraction=!1,this.dv(new c.ViewerCustomInteraction(e,n)),this.dv(new c.ObjResettingWithEvent(e.statusUpdateIntervalChanged,s=>{if((e.statusUpdateInterval??.5)===0)return;const o=new c.Destroyable;return o.d(t.disposableOnUeEvent("statusUpdate",a=>{e.statusUpdateEvent.emit(a)})),o})),this.dv(new c.ObjResettingWithEvent(e.propChangedListeningChanged,()=>{if(!(e.propChangedListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("propChanged",o=>{e.propChanged.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.objectEventListeningChanged,()=>{if(!(e.objectEventListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("objectEvent",o=>{e.objectEvent.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.widgetEventListeningChanged,()=>{if(!(e.widgetEventListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("widgetEvent",o=>{e.widgetEvent.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.speechRecognitionListeningChanged,()=>{if(!(e.speechRecognitionListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("speechRecognition",o=>{e.speechRecognition.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.customMessageListeningChanged,()=>{if(!(e.customMessageListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("customMessage",o=>{e.customMessage.emit(o)})),i})),this.dv(new c.ObjResettingWithEvent(e.editingEventListeningChanged,()=>{if(!(e.editingEventListening??!0))return;const i=new c.Destroyable;return i.d(t.disposableOnUeEvent("editingEvent",o=>{o.objectIDs=o.objectIDs.map(a=>{var l;return((l=c.ESSceneObject.getSceneObjById(a))==null?void 0:l.parentID)??a}),e.editingEvent.emit(o)})),i})),this.ad(t.disposableOnUeEvent("cameraChanged",()=>{e.cameraChanged.emit()}))}}class Qu extends c.Destroyable{constructor(e,t,n){super();p(this,"_reconnectEvent",this.dv(new c.Event));const s=(h,u)=>h.hasOwnProperty(u);let i=0,o;this.d(()=>{o&&clearTimeout(o)});const l=new URLSearchParams(window.location.search).get("eswebview")==="true",d=()=>{if(window.ue.esinput){n.setStatus("Creating"),console.log("存在(window.ue && window.ue.es && window.ue.esinput 需要适配新版ESWebView 鼠标穿透), 开始创建UeFalseCloudViewer..."),n.setStatusLog("开始创建本地视口...");const h=this.dv(new vu(e,n));this.d(()=>n.viewer=void 0),n.viewer=h,n.setStatus("Created"),n.setStatusLog("本地视口创建成功!"),this.dv(new Fu(e,n,h))}else n.setStatus("Error"),n.setStatusLog("请升级 ESWebView !"),this.d(()=>n.viewer=void 0),n.viewer=void 0};if(window.ue&&window.ue.es)d();else if(l){const h=setInterval(()=>{window.ue&&window.ue.es&&(clearInterval(h),d())},200)}else if(s(t.options,"ws")||s(t.options,"uri")&&s(t.options,"app")){n.setStatus("Creating"),n.setStatusLog("开始创建云渲染视口...");let h;this.d(()=>{n.setStatus("Raw"),n.setStatusLog(""),e&&h&&e.removeChild(h)&&(h=void 0)});const u=this.dv(c.createProcessingFromAsyncFunc(async f=>{n.viewer&&!n.viewer.isDestroyed()&&n.viewer.destroy(),n.viewer=void 0,h&&e.removeChild(h)&&(h=void 0),h=document.createElement("div"),h.setAttribute("earthsdk3-ue","earthsdk3-ue-videoContainer"),h.style.cssText="position:relative; height: 100%;width:100%;",e.appendChild(h);let B,w,v;if(s(t.options,"ws")){const{ws:H,esmsg:S,uselnternalSignallingServer:U}=t.options;B=H,w=S,v=U??!1}if(s(t.options,"uri")&&s(t.options,"app")){const{offsetWidth:H,offsetHeight:S}=h;let{uri:U,app:D,token:R}=t.options;U.endsWith("/")||(U+="/");const M=R?`?essstoken=${R}`:"",O=`/${D}/${H??1920}/${S??1080}`+M;console.log(`请求信令服务器: ${U}instance${O}`);const iA=await f.promise(fetch(`${U}instance${O}`,{method:"GET"})),Y=await f.promise(iA.json());if(Y&&Y.status!=="ok"){n.setStatus("Error"),n.setStatusLog(`信令服务器请求失败 ${Y.status}`),this._reconnectEvent.emit(void 0);return}else{console.log(`信令服务器请求成功! ${JSON.stringify(Y,void 0," ")}`),await c.sleep(2e3);const{server:G,esmsg:q,instanceId:SA,useInternalSignallingServer:oA}=Y;if(!SA){n.setStatus("Error"),n.setStatusLog("检查信令服务器版本,返回数据错误! "),console.log("信令服务器返回数据错误!不包含instanceId!请升级到 ESSS V3.0+ 版本!"),this._reconnectEvent.emit(void 0);return}B=G,w=q,v=oA??!1,n.esssResponse=Y}}const m=this.dv(v?new hu(h,B,w,n):new iu(h,B,w,n));this.d(()=>n.viewer=void 0),this.d(m.errorEvent.don(H=>{const S=`[${H}]:像素流连接错误!`;n.setStatus("Error"),n.setStatusLog(S),this._reconnectEvent.emit(m)})),await f.promise(new Promise(H=>this.d(m.readyEvent.donce(H)))),n.setStatus("Created"),n.setStatusLog("云渲染视口创建成功!"),i=0,o&&clearTimeout(o),o=void 0;const{offsetWidth:F,offsetHeight:E}=h;m.resize(F*window.devicePixelRatio,E*window.devicePixelRatio),n.viewer=m,this.d(()=>n.viewer=void 0),this.dv(new mu(n,m))}));u.start(),this.d(this._reconnectEvent.don(f=>{o===void 0&&(f&&!f.isDestroyed()&&f.destroy(),n.viewer&&!n.viewer.isDestroyed()&&n.viewer.destroy(),n.viewer=void 0,n.autoReconnect&&(n.setStatus("Reconnecting"),n.setStatusLog("正在尝试重新连接..."),i=i+5e3>3e4?3e4:i+5e3,console.warn(`间隔:${i/1e3}s,正在尝试重新连接...`),o=window.setTimeout(()=>{u.restart()},i)))})),this.d(u.errorEvent.don(f=>{n.setStatus("Error"),n.setStatusLog("云渲染视口创建失败!"),console.warn("云渲染视口创建失败!",f),this._reconnectEvent.emit(void 0)}))}else if(s(t.options,"project")){const h=t,u=h.options.project,f=h.options.baseUrl;n.setStatus("Creating"),n.setStatusLog("下载编译中...");const B=this.dv(new pu(e,u,f,n));n.viewer=B,this.d(()=>n.viewer=void 0)}else n.setStatus("Error"),n.setStatusLog("视口创建失败!"),console.warn("视口创建失败: 参数错误!")}}const ne=class ne extends c.ESViewer{constructor(e){super(e);p(this,"_viewer",this.dv(c.react(void 0)));p(this,"_esssResponse");p(this,"_speechRecognition",this.dv(new c.Event));p(this,"_propChanged",this.dv(new c.Event));p(this,"_objectEvent",this.dv(new c.Event));p(this,"_widgetEvent",this.dv(new c.Event));p(this,"_customMessage",this.dv(new c.Event));p(this,"_statusUpdateEvent",this.dv(new c.Event));p(this,"_statusUpdateEventdon",(()=>{this.d(this.statusUpdateEvent.don(e=>{this._statusInfo.fps=e.FPS??0,this._statusInfo.length=e.length??0,this._statusInfo.position=e.position??[0,0,0],this._statusInfo.rotation=e.rotation??[0,0,0]}))})());if(e.type!=="ESUeViewer")throw new Error("option.type must be ESUeViewer");const t=e;this.d(this._viewer.changed.don(()=>{this.viewerChanged.emit(this.viewer)})),this.dv(new c.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new Qu(this.subContainer,t,this)}))}get defaultProps(){return ne.createDefaultProps()}set viewer(e){this._viewer.value=e}get viewer(){return this._viewer.value}get esssResponse(){return this._esssResponse}set esssResponse(e){this._esssResponse=e}get speechRecognition(){return this._speechRecognition}get propChanged(){return this._propChanged}get objectEvent(){return this._objectEvent}get widgetEvent(){return this._widgetEvent}get customMessage(){return this._customMessage}get statusUpdateEvent(){return this._statusUpdateEvent}async uePositionToLonLatAlt(e){if(!this.viewer){console.warn("UEPositionToLonLatAlt: viewer is undefined");return}return await Co(this.viewer,e)}async changeNavigationMode(e){if(!this.viewer){console.warn("ChangeNavigationMode: viewer is undefined");return}const t=await TA(this.viewer,e);return t&&!t.error&&(this._navigationMode.value=e.mode),t}async resetWithCurrentCamera(e){if(!this.viewer){console.warn("resetWithCurrentCamera: viewer is undefined");return}return await En(this.viewer,e)}async getAllSocketNamesByActorTag(e){if(!this.viewer){console.warn("GetAllSocketNamesByActorTag: viewer is undefined");return}return await vo(this.viewer,e)}async getBoundSphere(e){if(!this.viewer){console.warn("getBoundSphere: viewer is undefined");return}return await Fo(this.viewer,e)}async getBoundSphereWithChildren(e){if(!this.viewer){console.warn("getBoundSphereWithChildren: viewer is undefined");return}return await Qo(this.viewer,e)}async getStrokeMaterialParamInfo(e){if(!this.viewer){console.warn("GetStrokeMaterialParamInfo: viewer is undefined");return}return await Uo(this.viewer,e)}async getFillMaterialParamInfo(e){if(!this.viewer){console.warn("getFillMaterialParamInfo: viewer is undefined");return}return await Eo(this.viewer,e)}async getGlobalProperty(e){if(!this.viewer){console.warn("getGlobalProperty: viewer is undefined");return}return await yo(this.viewer,e)}async getObjectByInfo(e){if(!this.viewer){console.warn("GetObjectByInfo: viewer is undefined");return}return await So(this.viewer,e)}async defaultCameraFlyIn(e=1){if(!this.viewer){console.warn("DefaultCameraFlyIn: viewer is undefined");return}return await Zi(this.viewer,e)}async startVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await qi(this.viewer)}async stopVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await ji(this.viewer)}async mountPakFiles(e){if(!this.viewer){console.warn("mountPakFiles:viewer is undefined");return}return await Ao(this.viewer,e)}async generateMemReport(){if(!this.viewer){console.warn("generateMemReport:viewer is undefined");return}return await eo(this.viewer)}async quit(){if(!this.viewer){console.warn("Quit: viewer is undefined");return}return await co(this.viewer)}async bindActorByTag(e,t){if(!this.viewer){console.warn("BindActorByTag: viewer is undefined");return}return await Io(this.viewer,e,t)}async restoreOriginalScene(){if(!this.viewer){console.warn("RestoreOriginalScene: viewer is undefined");return}return await To(this.viewer)}async unBindActorByID(e){if(!this.viewer){console.warn("UnBindActorByID: viewer is undefined");return}return await Ho(this.viewer,e)}async unBindActorByTag(e){if(!this.viewer){console.warn("UnBindActorByTag: viewer is undefined");return}return await Lo(this.viewer,e)}async createActorByClass(e,t){if(!this.viewer){console.warn("CreateActorByClass: viewer is undefined");return}return await bo(this.viewer,e,t)}async bind3DTilesetByTag(e,t){if(!this.viewer){console.warn("Bind3DTilesetByTag: viewer is undefined");return}return await Mo(this.viewer,e,t)}async unBind3DTilesetByTag(e){if(!this.viewer){console.warn("UnBind3DTilesetByTag: viewer is undefined");return}return await Do(this.viewer,e)}async unBind3DTilesetById(e){if(!this.viewer){console.warn("UnBind3DTilesetById: viewer is undefined");return}return await Ro(this.viewer,e)}async bindImageryByTag(e,t,n){if(!this.viewer){console.warn("BindImageryByTag: viewer is undefined");return}return await xo(this.viewer,e,t,n)}async unBindImageryByTag(e,t){if(!this.viewer){console.warn("UnBindImageryByTag: viewer is undefined");return}return await Po(this.viewer,e,t)}async unBindImageryById(e){if(!this.viewer){console.warn("UnBindImageryById: viewer is undefined");return}return await Ko(this.viewer,e)}async getIdByComponentNameAndHitItem(e,t,n){if(!this.viewer){console.warn("GetIdByComponentNameAndHitItem: viewer is undefined");return}return await Go(this.viewer,e,t,n)}async getCameraRelativeHeight(e="ECC_Visibility"){if(!this.viewer){console.warn("GetCameraRelativeHeight: viewer is undefined");return}return await ko(this.viewer,e)}async saveStringToFile(e,t,n){if(!this.viewer){console.warn("SaveStringToFile: viewer is undefined");return}return await No(this.viewer,e,t,n)}async highlightActorByTag(e,t=!0){if(!this.viewer){console.warn("HighlightActorByTag: viewer is undefined");return}return await _o(this.viewer,e,t)}async sendCustomMessage(e){if(!this.viewer){console.warn("SendCustomMessage: viewer is undefined");return}return await Vo(this.viewer,e)}async getStatus(){if(!this.viewer){console.warn("GetStatus:viewer is undefined");return}return await Oo(this.viewer)}async getTilesetMaterialIDList(){if(!this.viewer){console.warn("GetTilesetMaterialIDList:viewer is undefined");return}return await zo(this.viewer)}async pick(e,t,n){if(!this.viewer)return;let s=e;if(e&&window.ue&&this.container){const[i,o]=e,{x:a,y:l}=this.container.getBoundingClientRect();s=[a+i,l+o]}return await uo(this.viewer,s,t,n)}async pickPosition(e){if(!this.viewer)return;let t=e;if(e&&window.ue&&this.container){const[n,s]=e,{x:i,y:o}=this.container.getBoundingClientRect();t=[i+n,o+s]}return await ho(this.viewer,t)}async quickPickPosition(e){return await this.pickPosition(e)}async getTerrainHeight(e){return await this.getHeightByLonLat(e[0],e[1])??void 0}async flyIn(e,t=[0,0,0],n=1,s="default"){if(!this.viewer)return;const i=await Ke(this.viewer,void 0,e,t,n,s);if(i)return i.endType===0&&console.warn(`flyTo:flyTo is end! endType:${i.endType}`),i.endType===1&&console.warn(`flyTo:飞行中断! endType:${i.endType}`),i}async flyTo(e,t,n="default"){if(!this.viewer)return;const s=await Be(this.viewer,void 0,void 0,e,t,n);if(s)return s.endType===0&&console.warn(`flyTo:flyTo is end! endType:${s.endType}`),s.endType===1&&console.warn(`flyTo:飞行中断! endType:${s.endType}`),s}flyToBoundingSphere(e,t,n=1){const s=[[e[0],e[1],0],[e[0],e[3],0],[e[2],e[3],0],[e[2],e[1],0]],i=c.getGeoBoundingSphereFromPositions(s);if(!i)return;const{center:o,radius:a}=i,l={distance:t??a,heading:0,pitch:-90,flyDuration:n,hDelta:0,pDelta:0};this.flyTo(l,o)}getCurrentCameraInfo(){const{position:e,rotation:t}=this._statusInfo;return{position:e,rotation:t}}transformFlyParam(e,t){}getLengthInPixel(){return this._statusInfo.length}async changeToWalk(e,t=4.2,n=1.6){if(!this.viewer)return;const s={mode:"Walk",position:e,jumpZVelocity:t,eyeHeight:n},i=await TA(this.viewer,s);return i&&!i.error&&(this._navigationMode.value=s.mode),i}async changeToMap(){if(!this.viewer)return;const e={mode:"Map"},t=await TA(this.viewer,e);return t&&!t.error&&(this._navigationMode.value=e.mode),t}async changeToRotateGlobe(e=38,t=1e7,n=60){if(!this.viewer)return;const s={mode:"RotateGlobe",latitude:e,height:t,cycleTime:n},i=await TA(this.viewer,s);return i&&!i.error&&(this._navigationMode.value=s.mode),i}async changeToLine(e,t=10,n=10,s=!0,i=10,o="auto"){if(!this.viewer)return;const a={mode:"Line",geoLineStringId:e,speed:t,heightOffset:n,loop:s,turnRateDPS:i,lineMode:o},l=await TA(this.viewer,a);return l&&!l.error&&(this._navigationMode.value=a.mode),l}async changeToUserDefined(e){if(!this.viewer)return;const t={mode:"UserDefined",userDefinedPawn:e},n=await TA(this.viewer,t);return n&&!n.error&&(this._navigationMode.value=t.mode),n}async changeToRotatePoint(e,t=5e4,n=60,s=0,i=-30){if(!this.viewer)return;const o={mode:"RotatePoint",position:e,distance:t,orbitPeriod:n,heading:s,pitch:i},a=await TA(this.viewer,o);return a&&!a.error&&(this._navigationMode.value=o.mode),a}async changeToFollow(e,t=0,n=0,s=-30,i=!0){if(!this.viewer)return;const o={mode:"Follow",objectId:e,distance:t,heading:n,pitch:s,relativeRotation:i},a=await TA(this.viewer,o);return a&&!a.error&&(this._navigationMode.value=o.mode),a}getFPS(){return this._statusInfo.fps}async getVersion(){const e=window.g_XE3CopyRights??{};if(!this.viewer)return e;const t=await mo(this.viewer);return e.esforue=t,e}async getHeightByLonLat(e,t,n="ECC_Visibility"){if(!this.viewer)return null;const s=await go(this.viewer,e,t,n);return s&&s.height!==void 0?s.height:null}async getHeightsByLonLats(e,t="ECC_Visibility"){return this.viewer?await Bo(this.viewer,e,t):void 0}async capture(e=64,t=64){return this.viewer?await fo(this.viewer,e,t):void 0}async partialCapture(e,t=[64,64]){if(!this.viewer){console.warn("partialCapture:viewer is undefined");return}return await wo(this.viewer,e,t)}async lonLatAltToScreenPosition(e){if(!this.viewer)return;const t=await po(this.viewer,e);return t&&[t.X,t.Y]}async setGlobalProperty(e){if(this.viewer)return await lo(this.viewer,e)}async startEditing(e,t,n){n=Object.assign({useKeyToSwitch:!0,callSource:"outer"},n);const s=e.components.main??e;if(!s||!this.viewer||t==null)return;const i=Array.isArray(t)?[...t]:[t];return s.editingID=`${n.callSource}_${c.createGuid()}`,await Wo(this.viewer,s.id,s.editingID,i,n.useKeyToSwitch)}async stopEditing(){if(this.viewer)return await Xo(this.viewer)}async moveObjects(e){if(!this.viewer)return;const t=[],n=c.createGuid();for(let s=0;s<e.length;s++){const i=e[s],o=i.components.main??i;o.editingID=n,o&&t.push(o.id)}if(t.length!==0)return await Jo(this.viewer,t,n)}};p(ne,"type",ne.register("ESUeViewer",ne)),p(ne,"defaults",{...ge});let LA=ne;(r=>{r.createDefaultProps=()=>({...c.ESViewer.createDefaultProps(),...Yi(),resolutionScale:1,autoReconnect:!1,propChangedListening:void 0,objectEventListening:void 0,widgetEventListening:void 0,speechRecognitionListening:void 0,customMessageListening:void 0})})(LA||(LA={})),c.extendClassProps(LA.prototype,LA.createDefaultProps);class qA extends c.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(!t)return;const n=this.ad(c.react(!1));A.components.main||this.d(this.createdEvent.don(()=>{const s=this.constructor.propValFuncs,i=A.defaultProps,o=Object.keys(i).filter(f=>s[f]!==null);o.push(...this.constructor.forceUeUpdateProps);const a=A.constructor.defaults,l={val:{}},d=[];for(let f of o){const B=f+"Changed",w=A[B];d.push(w);const v=s[f];if(v===null)throw console.error("vf === null error"),new Error("vf === null error");const m=()=>{const F=A[f]??a[f]??A.constructor[`default${f.charAt(0).toUpperCase()+f.slice(1)}`];let E=v?v(F,this,e,A):F;if(E===void 0){console.warn(`UE自动更新的属性,不应该为undefined! 属性名:${f} 对象名:${A.name} 对象id: ${A.id}`);return}l.val[f]=E};m(),this.d(w.don(m))}const h=()=>{t.callUeFunc({f:"update",p:{id:A.id,...l.val}}),l.val={}},u=this.dv(c.createNextAnimateFrameEvent(...d));this.d(u.don(h)),this.d(n.changed.don(h)),this.d(A.flushEvent.don(()=>u.flush()))})),A.components.main||(this.d(()=>{n.value&&Un(t,A.id)}),t.callUeFunc({f:"create",p:{type:A.typeName,id:A.id}}).then(()=>{n.value=!0}).catch(s=>console.error(s)))}}p(qA,"propValFuncs",{ref:null,devTags:null,extras:null,execOnceFuncStr:null,updateFuncStr:null,toDestroyFuncStr:null}),p(qA,"forceUeUpdateProps",[]);class cA extends qA{constructor(A,e){super(A,e);const t=e.viewer;t&&(this.d(A.flyToEvent.don(n=>{Be(t,A.id,n)})),this.d(A.flyInEvent.don(n=>{var s,i;Ke(t,A.id,(s=A.flyInParam)==null?void 0:s.position,(i=A.flyInParam)==null?void 0:i.rotation,n??1)})),this.d(A.calcFlyToParamEvent.don(()=>{YA(t,A.id)})),this.d(A.calcFlyInParamEvent.don(()=>{const n=e.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:i}=n;A.flyInParam={position:s,rotation:i,flyDuration:1}})),this.d(e.propChanged.don(n=>{n.objId===A.id&&Object.keys(n.props).forEach(s=>{const i=n.props[s]===null?void 0:n.props[s];A[s]=i})})))}}class P extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t)return;const n=()=>{A.editing||t.callUeFunc({f:"update",p:{id:A.id,position:A.position,rotation:A.rotation}})},s=this.dv(c.createNextAnimateFrameEvent(A.positionChanged,A.rotationChanged,A.editingChanged));this.d(s.don(()=>{setTimeout(n,0)})),this.d(A.smoothMoveEvent.don((a,l)=>{_e(t,A.id,a,l)})),this.d(A.smoothMoveWithRotationEvent.don((a,l,d)=>{Ge(t,A.id,a,l,d)})),this.d(A.smoothMoveOnGroundEvent.don((a,l,d,h)=>{ke(t,A.id,a,l,h,d)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((a,l,d,h,u)=>{Ne(t,A.id,a,l,d,h,u)})),this.d(A.smoothMoveKeepPitchEvent.don(async(a,l)=>{const d=await t.callUeFunc({f:"SmoothMoveKeepPitch",p:{id:A.id,Destination:a,Time:l}});d.error&&console.error("SmoothMoveKeepPitch:",d.error)})),this.d(A.automaticLandingEvent.don(a=>{const l=[A.position[0],A.position[1]];e.getHeightByLonLat(A.position[0],A.position[1],"Visibility").then(d=>{d!==null&&(A.position=[...l,d],A.collision=a)})}));const i=async(a,l,d,h)=>{const{viewer:u}=a;if(!u){console.error("SmoothMoveRelatively: ueViewer.viewer is undefined");return}const f=await u.callUeFunc({f:"SmoothMoveRelatively",p:{id:l,RelativePosition:d,Time:h}});return f.error&&console.error("SmoothMoveRelatively:",f.error),f};this.d(A.smoothMoveRelativelyEvent.don((a,l)=>{i(e,A.id,a,l)}));const o=async(a,l,d,h,u)=>{const{viewer:f}=a;if(!f){console.error("SmoothMoveRelativelyWithRotation: ueViewer.viewer is undefined");return}const B=await f.callUeFunc({f:"SmoothMoveRelativelyWithRotation",p:{id:l,RelativePosition:d,NewRotation:h,Time:u}});return B.error&&console.error("SmoothMoveRelativelyWithRotation:",B.error),B};this.d(A.smoothMoveRelativelyWithRotationEvent.don((a,l,d)=>{o(e,A.id,a,l,d)}))}}class rA extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t)return;const n=()=>{A.editing||t.callUeFunc({f:"update",p:{id:A.id,points:A.points}})},s=this.dv(c.createNextAnimateFrameEvent(A.pointsChanged,A.editingChanged));this.d(s.don(()=>{setTimeout(n,0)}))}}p(rA,"propValFuncs",{...cA.propValFuncs,pointStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),strokeStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),fillStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})})});class QA extends P{constructor(A,e){super(A,e),e.viewer&&this.d(e.widgetEvent.don(n=>{if(n.objId!==A.id)return;const{type:s,add:i}=n;A.widgetEvent.emit({type:s,add:i})}))}}class Pn extends P{constructor(A,e){super(A,e),e.viewer}}p(Pn,"propValFuncs",{...P.propValFuncs,pointStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),strokeStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})}),fillStyle:A=>({...A,materialParams:JSON.stringify(A.materialParams??{})})});class Er extends Pn{constructor(A,e){super(A,e),e.viewer}}const Al=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag但对应的Actor不是3dTileset,无法绑定";default:return"未知错误"}},ht=class ht extends c.EngineObject{constructor(e,t){super(e,t);p(this,"_styleColor",this.dv(c.react([])));p(this,"_styleVisable",this.dv(c.react([])));const n=t.viewer;if(!n){console.warn("UeES3DTileset: viewer is undefined!");return}let s,i;const o=async()=>{!s&&!i||await n.callUeFunc({f:"update",p:{id:e.id,url:e.url,show:e.show,collision:e.collision,allowPicking:e.allowPicking,flyToParam:e.flyToParam??c.ES3DTileset.defaultFlyToParam,flyInParam:e.flyInParam??c.ES3DTileset.defaultFlyInParam,highlightID:e.highlightID,highlightColor:e.highlightColor,highlight:e.highlight,materialMode:e.materialMode,maximumScreenSpaceError:e.maximumScreenSpaceError,colorMode:Reflect.has(e,"colorMode")?e.colorMode:void 0,offset:e.offset,rotation:e.rotation,cacheBytes:e.cacheBytes,colorBlendMode:e.colorBlendMode,materialOverrideMap:e.materialOverrideMap}})},a=this.dv(c.createNextAnimateFrameEvent(e.urlChanged,e.showChanged,e.flyToParamChanged,e.flyInParamChanged,e.collisionChanged,e.allowPickingChanged,e.highlightIDChanged,e.highlightColorChanged,e.highlightChanged,e.materialModeChanged,e.maximumScreenSpaceErrorChanged,e.offsetChanged,e.rotationChanged,e.cacheBytesChanged,e.colorBlendModeChanged,e.materialOverrideMapChanged));o(),this.d(a.don(o)),Reflect.has(e,"colorMode")&&this.d(e.colorModeChanged.don(()=>o()));const l=this.dv(c.react(void 0));{const h=this.dv(c.createNextAnimateFrameEvent(e.actorTagChanged,e.urlChanged)),u=()=>{e.actorTag?l.value={type:"ActorTag",actorTag:e.actorTag}:e.url?l.value={type:"CreatedUrl",url:e.url}:l.value=void 0,e.editing=!1};u(),this.d(h.don(u))}const d=async()=>{const{id:h}=e;if(s!==void 0){s=void 0;try{const u=await t.unBind3DTilesetById(h);if(!u)return;if(u.error!==""){console.warn(`UeES3DTileset UnBind3DTilesetById: ${u.error}`);return}}catch(u){console.warn(`UeES3DTileset UnBind3DTilesetById: ${u}`);return}}if(i!==void 0){i=void 0;try{const u=await n.callUeFunc({f:"destroy",p:{id:h}});if(!u)return;if(u.error!==""){console.warn(`UeES3DTileset Destroy: ${u.error}`);return}}catch(u){console.warn(`UeES3DTileset Destroy: ${u}`);return}}};this.d(()=>{d()});{const h=this.dv(c.createProcessingFromAsyncFunc(async f=>{if(l.value===void 0){await f.promise(d());return}if(l.value.type==="ActorTag"){const{actorTag:B}=l.value;if(s!==B&&await f.promise(d()),s!==void 0||B===void 0)return;try{s=B;const w=await f.promise(t.bind3DTilesetByTag(e.id,B));if(!w)return;if(w.error!==""){console.warn(`UeES3DTileset Bind3DTilesetByTag: ${w.error}`);return}if(w.re.type!==0)if(w.re.type===1)console.warn(`UeES3DTileset Bind3DTilesetByTag: ${Al(w.re.type)}`);else{console.warn(`UeES3DTileset Bind3DTilesetByTag: ${Al(w.re.type)}`);return}}catch(w){console.warn(`UeES3DTileset Bind3DTilesetByTag: ${w}`);return}}else if(l.value.type==="CreatedUrl"){const{url:B}=l.value;if(B!==i&&await d(),i!==void 0||B===void 0)return;try{i=B;const w=await f.promise(n.callUeFunc({f:"create",p:{type:e.typeName,id:e.id}}));if(!w)return;if(w.error!==""){console.warn(`UeES3DTileset create: ${w.error}`);return}}catch(w){console.warn(`UeES3DTileset create: ${w}`);return}}await f.promise(o())})),u=async()=>{h.restart()};u(),this.d(l.changed.don(u))}this.d(e.refreshTilesetEvent.don(()=>{$i(n,e.id)})),this.d(e.flyToEvent.don(async(h,u)=>{if(!s&&!i)return;const f=await Be(n,e.id,h);let B="over";f===void 0?B="error":f.endType===0?B="over":f.endType===1&&(B="cancelled"),e.flyOverEvent.emit(u,B,t)})),this.d(e.calcFlyToParamEvent.don(()=>{!s&&!i||YA(n,e.id)})),this.d(e.calcFlyInParamEvent.don(async()=>{if(!s&&!i||!t.actived)return;const h=await t.getCurrentCameraInfo();if(!h)return;const{position:u,rotation:f}=h;e.flyInParam={position:u,rotation:f,flyDuration:1}})),this.d(t.propChanged.don(h=>{!s&&!i||h.objId===e.id&&Object.keys(h.props).forEach(u=>{const f=h.props[u]===null?void 0:h.props[u];e[u]=f})})),this.d(t.objectEvent.don(h=>{!s&&!i||h.id!==e.id||h.type!=="3DTilesetReady"||e.tilesetReady.emit(h.p)}));{const h=async(w,v)=>{if(!s&&!i)return;const m=await n.callUeFunc({f:"SetFeatureColor",p:{id:e.id,featureName:w,json:v}});if(m&&m.error!==""){console.warn(`UeES3DTileset SetFeatureColor: ${m.error}`);return}},u=async(w,v)=>{if(!s&&!i)return;const m=await n.callUeFunc({f:"SetFeatureVisable",p:{id:e.id,featureName:w,json:v}});if(m&&m.error!==""){console.warn(`UeES3DTileset SetFeatureVisable: ${m.error}`);return}},f=async()=>{if(!s&&!i)return;const w=await n.callUeFunc({f:"ResetFeatureStyle",p:{id:e.id}});if(w&&w.error!==""){console.warn(`UeES3DTileset ResetFeatureStyle: ${w.error}`);return}},B=async w=>{if(!s&&!i)return;const v=await n.callUeFunc({f:"SetFeatureStyle",p:{id:e.id,json:w}});if(v&&v.error!==""){console.warn(`UeES3DTileset SetFeatureStyle: ${v.error}`);return}};this.d(e.setFeatureColorEvent.don((w,v)=>{const m=[...this.styleColor,...v];this.styleColor=[...m],h(w,m)})),this.d(e.setFeatureVisableEvent.don((w,v)=>{const m=[...this.styleVisable,...v];this.styleVisable=[...m],u(w,m)})),this.d(e.resetFeatureStyleEvent.don(()=>{f(),this.styleColor=[],this.styleVisable=[]})),this.d(e.setFeatureStyleEvent.don(w=>{B(w)}))}{const h=async()=>{if(!s&&!i){e._featureTableResultEvent.emit(void 0);return}try{const u=await n.callUeFunc({f:"GetFeatureTable",p:{id:e.id}});u.error!==""&&console.warn(`UeES3DTileset GetFeatureTable: ${u.error}`),e._featureTableResultEvent.emit(u.re.table)}catch(u){console.warn(`UeES3DTileset GetFeatureTable: ${u}`),e._featureTableResultEvent.emit(void 0)}};this.d(e.getFeatureTableEvent.don(()=>{h()}))}{const h=async()=>{if(!s&&!i){e.getMaterialNameListEvent.emit(void 0);return}try{const u=await n.callUeFunc({f:"GetMaterialNameList",p:{id:e.id}});u.error!==""&&console.warn(`UeES3DTileset GetMaterialNameList: ${u.error}`),e.getMaterialNameListEvent.emit(u.re.materialNameList)}catch(u){console.warn(`UeES3DTileset GetMaterialNameList: ${u}`),e.getMaterialNameListEvent.emit(void 0)}};this.ad(e.getMaterialNameListEvent.don(u=>{u=="start"&&h()}))}}get styleColor(){return this._styleColor.value}set styleColor(e){this._styleColor.value=e}get styleVisable(){return this._styleVisable.value}set styleVisable(e){this._styleVisable.value=e}};p(ht,"type",ht.register("ESUeViewer",c.ES3DTileset.type,ht));let yr=ht;const el=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag对应的Actor是地形,无法绑定";case 4:return"没搜索到ComponentTag,无法绑定";default:return"未知错误"}},gt=class gt extends c.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}let n,s;const i=this.dv(c.react(void 0)),o=this.ad(c.reactJson(""));{const h=()=>{if(typeof A.url=="string")o.value=c.ESSceneObject.context.getStrFromEnv(A.url);else{const u=A.url;u.url=c.ESSceneObject.context.getStrFromEnv(u.url),o.value=u}};h(),this.ad(A.urlChanged.don(h))}const a=async()=>{if(!n&&!s)return;let h=A.targetID??c.ESImageryLayer.defaults.targetID;if(h&&h!=""){const u=c.ESSceneObject.getSceneObject(h);h=u?(u.components.main??u).id:h}await t.callUeFunc({f:"update",p:{id:A.id,show:A.show??!0,rectangle:A.rectangle??[-180,-90,180,90],collision:A.collision??!0,allowPicking:A.allowPicking??!1,flyToParam:A.flyToParam??c.ESImageryLayer.defaultFlyToParam,flyInParam:A.flyInParam??c.ESImageryLayer.defaultFlyInParam,url:o.value??"",zIndex:A.zIndex??0,maximumLevel:A.maximumLevel??c.ESImageryLayer.defaults.maximumLevel,minimumLevel:A.minimumLevel??c.ESImageryLayer.defaults.minimumLevel,options:A.options??c.ESImageryLayer.defaults.options,targetID:h,opacity:A.opacity??c.ESImageryLayer.defaults.opacity,splitDirection:A.splitDirection??c.ESImageryLayer.defaults.splitDirection}})},l=this.dv(c.createNextAnimateFrameEvent(A.showChanged,o.changed,A.flyToParamChanged,A.flyInParamChanged,A.zIndexChanged,A.collisionChanged,A.allowPickingChanged,A.maximumLevelChanged,A.minimumLevelChanged,A.rectangleChanged,A.optionsChanged,A.targetIDChanged,A.opacityChanged,A.splitDirectionChanged));this.d(l.don(a));const d=async()=>{const{id:h}=A;if(n!==void 0){n=void 0;try{const u=await e.unBindImageryById(h);if(!u)return;if(u.error!==""){console.warn(`UeESImageryLayer UnImageryByID: ${u.error}`);return}}catch(u){console.warn(`UeESImageryLayer UnImageryByID promise: ${u}`);return}}if(s!==void 0){s=void 0;try{const u=await t.callUeFunc({f:"destroy",p:{id:h,test:"UeESImageryLayer"}});if(!u)return;if(u.error!==""){console.warn(`UeESImageryLayer Destroy: ${u.error}`);return}}catch(u){console.warn(`UeESImageryLayer Destroy promise: ${u}`);return}}};this.d(()=>{d()});{const h=this.dv(c.createProcessingFromAsyncFunc(async f=>{if(i.value===void 0){await f.promise(d());return}if(i.value.type==="ActorTag"){const{actorTag:B,componentTag:w}=i.value;if(n!==B&&await f.promise(d()),n!==void 0||B===void 0)return;try{n=B;const v=await f.promise(e.bindImageryByTag(A.id,B,w));if(!v)return;if(v.error!==""){console.warn(`ESImageryLayer BindImageryByTag: ${v.error}`);return}if(v.re.type!==0)if(v.re.type===1)console.warn(`ESImageryLayer BindImageryByTag: ${el(v.re.type)}`);else{console.warn(`ESImageryLayer BindImageryByTag: ${el(v.re.type)}`);return}}catch(v){console.warn(`ESImageryLayer BindImageryByTag promise: ${v}`);return}}else if(i.value.type==="CreatedUrl"){const{url:B}=i.value;if(B!==s&&await f.promise(d()),s!==void 0||B===void 0)return;try{s=B;const w=await f.promise(t.callUeFunc({f:"create",p:{type:"ESImageryLayer",id:A.id}}));if(!w)return;if(w.error!==""){console.warn(`ESImageryLayer create: ${w.error}`);return}}catch{console.warn("ESImageryLayer create: create promise error");return}}await f.promise(a())})),u=async()=>{h.restart()};u(),this.d(i.changed.don(u))}{const h=this.dv(c.createNextAnimateFrameEvent(A.actorTagChanged,o.changed,A.componentTagChanged)),u=()=>{A.actorTag&&A.componentTag?i.value={type:"ActorTag",actorTag:A.actorTag,componentTag:A.componentTag}:o.value?i.value={type:"CreatedUrl",url:o.value}:i.value=void 0};u(),this.d(h.don(u))}this.d(A.flyToEvent.don(async(h,u)=>{if(!n&&!s)return;const f=await Be(t,A.id,h);let B="over";f===void 0?B="error":f.endType===0?B="over":f.endType===1&&(B="cancelled"),A.flyOverEvent.emit(u,B,e)})),this.d(A.flyInEvent.don(async(h,u)=>{var w,v;if(!n&&!s)return;const f=await Ke(t,A.id,(w=A.flyInParam)==null?void 0:w.position,(v=A.flyInParam)==null?void 0:v.rotation,h??1);let B="over";f===void 0?B="error":f.endType===0?B="over":f.endType===1&&(B="cancelled"),A.flyOverEvent.emit(u,B,e)})),this.d(A.calcFlyToParamEvent.don(()=>{!n&&!s||YA(t,A.id)})),this.d(A.calcFlyInParamEvent.don(async()=>{if(!e.actived)return;const h=await e.getCurrentCameraInfo();if(!h)return;const{position:u,rotation:f}=h;A.flyInParam={position:u,rotation:f,flyDuration:1}})),this.d(e.propChanged.don(h=>{!n&&!s||h.objId===A.id&&Object.keys(h.props).forEach(u=>{const f=h.props[u]===null?void 0:h.props[u];A[u]=f})}))}};p(gt,"type",gt.register("ESUeViewer",c.ESImageryLayer.type,gt));let Kn=gt;const se=class se extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(se,"type",se.register("ESUeViewer",c.ESTerrainLayer.type,se)),p(se,"forceUeUpdateProps",[...cA.forceUeUpdateProps,"url"]),p(se,"propValFuncs",{...cA.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(A):(A.url=c.ESSceneObject.context.getStrFromEnv(A.url),A),czmMaxzoom:null,czmMinzoom:null});let Gn=se;const Bt=class Bt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Bt,"type",Bt.register("ESUeViewer",c.ESAlarm.type,Bt));let kn=Bt;const ft=class ft extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ft,"type",ft.register("ESUeViewer",c.ESApertureEffect.type,ft));let Nn=ft;const wt=class wt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(wt,"type",wt.register("ESUeViewer",c.ESGeoPolygon.type,wt));let dA=wt;const pt=class pt extends dA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i=c.ESAreaMeasurement.defaults.fillStyle;try{i={...A.fillStyle??c.ESAreaMeasurement.defaults.fillStyle}}catch(o){console.error("ESAreaMeasurement fillStyle 属性类型错误!",o),i={...c.ESAreaMeasurement.defaults.fillStyle}}i.materialParams=JSON.stringify(i.materialParams),t.callUeFunc({f:"update",p:{id:A.id,stroked:A.stroked??c.ESAreaMeasurement.defaults.stroked,fillStyle:i,filled:A.filled??c.ESAreaMeasurement.defaults.filled}}),console.log(i)},s=this.dv(c.createNextAnimateFrameEvent(A.fillStyleChanged,A.strokedChanged,A.filledChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};p(pt,"type",pt.register("ESUeViewer",c.ESAreaMeasurement.type,pt));let _n=pt;const Ct=class Ct extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Ct,"type",Ct.register("ESUeViewer",c.ESBlastParticleSystem.type,Ct));let Vn=Ct;const Le=class Le extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};p(Le,"type",Le.register("ESUeViewer",c.ESBoxClipping.type,Le)),p(Le,"propValFuncs",{...P.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let On=Le;const vt=class vt extends P{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.dispose(A.flyInEvent.don((n,s,i="default")=>{const{id:o,duration:a,position:l,rotation:d}=A;Ke(t,o,l,d,a??n,i)})),this.dispose(A.resetWithCurrentCameraEvent.don(()=>{En(t,A.id)})),this.dispose(A.captureEvent.don((n,s)=>{e.capture(n,s).then(o=>{o&&(A.thumbnail=o)})}))}};p(vt,"type",vt.register("ESUeViewer",c.ESCameraView.type,vt));let Wn=vt;const mt=class mt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(mt,"type",mt.register("ESUeViewer",c.ESCameraVisibleRange.type,mt));let Xn=mt;const Ft=class Ft extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Ft,"type",Ft.register("ESUeViewer",c.ESCar.type,Ft));let Jn=Ft;const Qt=class Qt extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i=c.ESClassification.defaults.fillStyle;try{i={...A.fillStyle??c.ESClassification.defaults.fillStyle}}catch(o){console.error("ESClassification fillStyle 属性类型错误!",o),i={...c.ESClassification.defaults.fillStyle}}i.materialParams=JSON.stringify(i.materialParams),t.callUeFunc({f:"update",p:{id:A.id,filled:A.filled??c.ESClassification.defaults.filled,fillStyle:i}})},s=this.dv(c.createNextAnimateFrameEvent(A.fillStyleChanged,A.filledChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};p(Qt,"type",Qt.register("ESUeViewer",c.ESClassification.type,Qt));let zn=Qt;const be=class be extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};p(be,"type",be.register("ESUeViewer",c.ESClippingPlane.type,be)),p(be,"propValFuncs",{...P.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let Yn=be;const Ut=class Ut extends P{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=this.ad(c.reactJson(""));{const o=()=>{if(typeof A.url=="string")n.value=c.ESSceneObject.context.getStrFromEnv(A.url??c.ESDataMesh.defaults.url);else{const a=A.url;a.url=c.ESSceneObject.context.getStrFromEnv(a.url??c.ESDataMesh.defaults.url),n.value=a}};o(),this.ad(A.urlChanged.don(o))}const s=()=>{const o=A.colorStops??c.ESDataMesh.defaults.colorStops;t.callUeFunc({f:"update",p:{id:A.id,url:n.value??c.ESDataMesh.defaults.url,currentTime:A.currentTime??c.ESDataMesh.defaults.currentTime,minPropValue:A.minPropValue??c.ESDataMesh.defaults.minPropValue,maxPropValue:A.maxPropValue??c.ESDataMesh.defaults.maxPropValue,colorStops:JSON.stringify(o)}})},i=this.dv(c.createNextAnimateFrameEvent(n.changed,A.currentTimeChanged,A.minPropValueChanged,A.maxPropValueChanged,A.colorStopsChanged));this.d(i.don(s)),this.d(A.createdEvent.don(s))}};p(Ut,"type",Ut.register("ESUeViewer",c.ESDataMesh.type,Ut));let $n=Ut;const Et=class Et extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Et,"type",Et.register("ESUeViewer",c.ESDatasmithRuntimeModel.type,Et));let Zn=Et;const yt=class yt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(yt,"type",yt.register("ESUeViewer",c.ESDirectionMeasurement.type,yt));let qn=yt;const St=class St extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{let i;try{i={...A.strokeStyle??c.ESDistanceMeasurement.defaults.strokeStyle}}catch(o){console.error("ESDistanceMeasurement strokeStyle 属性类型错误!",o),i={...c.ESDistanceMeasurement.defaults.strokeStyle}}t.callUeFunc({f:"update",p:{id:A.id,strokeStyle:i}})},s=this.dv(c.createNextAnimateFrameEvent(A.strokeStyleChanged));this.d(s.don(n)),this.d(A.createdEvent.don(n))}};p(St,"type",St.register("ESUeViewer",c.ESDistanceMeasurement.type,St));let jn=St;const It=class It extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(It,"type",It.register("ESUeViewer",c.ESLocalPolygon.type,It));let Sr=It;const Tt=class Tt extends Sr{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Tt,"type",Tt.register("ESUeViewer",c.ESDynamicWater.type,Tt));let As=Tt;const Ht=class Ht extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(e.widgetEvent.don(n=>{if(n.objId!==A.id)return;const{type:s,properties:i}=n;A.widgetEvent.emit({type:s,properties:i})}))}};p(Ht,"type",Ht.register("ESUeViewer",c.ESEntityCluster.type,Ht));let es=Ht;const Me=class Me extends dA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Me,"type",Me.register("ESUeViewer",c.ESExcavate.type,Me)),p(Me,"propValFuncs",{...dA.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let ts=Me;const Lt=class Lt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Lt,"type",Lt.register("ESUeViewer",c.ESFireParticleSystem.type,Lt));let rs=Lt;const bt=class bt extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=this.ad(c.reactJson(""));{const o=()=>{if(typeof A.url=="string")n.value=c.ESSceneObject.context.getStrFromEnv(A.url);else{const a=A.url;a.url=c.ESSceneObject.context.getStrFromEnv(a.url),n.value=a}};o(),this.ad(A.urlChanged.don(o))}const s=()=>{t.callUeFunc({f:"update",p:{id:A.id,url:n.value??c.ESForestTileset.defaults.url,treeTypes:A.treeTypes??c.ESForestTileset.defaults.treeTypes,xiaoBanWidget:A.xiaoBanWidget??c.ESForestTileset.defaults.xiaoBanWidget,youShiSZ:A.youShiSZ??c.ESForestTileset.defaults.youShiSZ,diLei:A.diLei??c.ESForestTileset.defaults.diLei,senLinLB:A.senLinLB??c.ESForestTileset.defaults.senLinLB,labelMaterial:A.labelMaterial??c.ESForestTileset.defaults.labelMaterial,heightOffset:A.heightOffset??c.ESForestTileset.defaults.heightOffset}})},i=this.dv(c.createNextAnimateFrameEvent(n.changed,A.treeTypesChanged,A.xiaoBanWidgetChanged,A.youShiSZChanged,A.diLeiChanged,A.senLinLBChanged,A.labelMaterialChanged,A.heightOffsetChanged));this.d(i.don(s)),this.d(A.createdEvent.don(s))}};p(bt,"type",bt.register("ESUeViewer",c.ESForestTileset.type,bt));let ns=bt;/*!
|
|
92
92
|
* html2canvas 1.4.1 <https://html2canvas.hertzen.com>
|
|
93
93
|
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
|
94
94
|
* Released under MIT License
|
|
@@ -109,10 +109,10 @@ Msg: ${e}`;console.warn(t)}};g.verboseLogLevel=5,function(r){r.LIST_STREAMERS="l
|
|
|
109
109
|
content: "" !important;
|
|
110
110
|
display: none !important;
|
|
111
111
|
}`,cw=function(r){dw(r,"."+$s+aw+Jc+`
|
|
112
|
-
.`+Zs+lw+Jc)},dw=function(r,A){var e=r.ownerDocument;if(e){var t=e.createElement("style");t.textContent=A,r.appendChild(t)}},zc=function(){function r(){}return r.getOrigin=function(A){var e=r._link;return e?(e.href=A,e.href=e.href,e.protocol+e.hostname+e.port):"about:blank"},r.isSameOrigin=function(A){return r.getOrigin(A)===r._origin},r.setContext=function(A){r._link=A.document.createElement("a"),r._origin=r.getOrigin(A.location.href)},r._origin="about:blank",r}(),uw=function(){function r(A,e){this.context=A,this._options=e,this._cache={}}return r.prototype.addImage=function(A){var e=Promise.resolve();return this.has(A)||(js(A)||fw(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),e},r.prototype.match=function(A){return this._cache[A]},r.prototype.loadImage=function(A){return uA(this,void 0,void 0,function(){var e,t,n,s,i=this;return nA(this,function(o){switch(o.label){case 0:return e=zc.isSameOrigin(A),t=!qs(A)&&this._options.useCORS===!0&&tA.SUPPORT_CORS_IMAGES&&!e,n=!qs(A)&&!e&&!js(A)&&typeof this._options.proxy=="string"&&tA.SUPPORT_CORS_XHR&&!t,!e&&this._options.allowTaint===!1&&!qs(A)&&!js(A)&&!n&&!t?[2]:(s=A,n?[4,this.proxy(s)]:[3,2]);case 1:s=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(a,l){var d=new Image;d.onload=function(){return a(d)},d.onerror=l,(ww(s)||t)&&(d.crossOrigin="anonymous"),d.src=s,d.complete===!0&&setTimeout(function(){return a(d)},500),i._options.imageTimeout>0&&setTimeout(function(){return l("Timed out ("+i._options.imageTimeout+"ms) loading image")},i._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},r.prototype.has=function(A){return typeof this._cache[A]<"u"},r.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},r.prototype.proxy=function(A){var e=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=A.substring(0,256);return new Promise(function(s,i){var o=tA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(o==="text")s(a.response);else{var h=new FileReader;h.addEventListener("load",function(){return s(h.result)},!1),h.addEventListener("error",function(u){return i(u)},!1),h.readAsDataURL(a.response)}else i("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=i;var l=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+l+"url="+encodeURIComponent(A)+"&responseType="+o),o!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=o),e._options.imageTimeout){var d=e._options.imageTimeout;a.timeout=d,a.ontimeout=function(){return i("Timed out ("+d+"ms) proxying "+n)}}a.send()})},r}(),hw=/^data:image\/svg\+xml/i,gw=/^data:image\/.*;base64,/i,Bw=/^data:image\/.*/i,fw=function(r){return tA.SUPPORT_SVG_DRAWING||!pw(r)},qs=function(r){return Bw.test(r)},ww=function(r){return gw.test(r)},js=function(r){return r.substr(0,4)==="blob"},pw=function(r){return r.substr(-3).toLowerCase()==="svg"||hw.test(r)},y=function(){function r(A,e){this.type=0,this.x=A,this.y=e}return r.prototype.add=function(A,e){return new r(this.x+A,this.y+e)},r}(),Ie=function(r,A,e){return new y(r.x+(A.x-r.x)*e,r.y+(A.y-r.y)*e)},Bn=function(){function r(A,e,t,n){this.type=1,this.start=A,this.startControl=e,this.endControl=t,this.end=n}return r.prototype.subdivide=function(A,e){var t=Ie(this.start,this.startControl,A),n=Ie(this.startControl,this.endControl,A),s=Ie(this.endControl,this.end,A),i=Ie(t,n,A),o=Ie(n,s,A),a=Ie(i,o,A);return e?new r(this.start,t,i,a):new r(a,o,s,this.end)},r.prototype.add=function(A,e){return new r(this.start.add(A,e),this.startControl.add(A,e),this.endControl.add(A,e),this.end.add(A,e))},r.prototype.reverse=function(){return new r(this.end,this.endControl,this.startControl,this.start)},r}(),pA=function(r){return r.type===1},Cw=function(){function r(A){var e=A.styles,t=A.bounds,n=st(e.borderTopLeftRadius,t.width,t.height),s=n[0],i=n[1],o=st(e.borderTopRightRadius,t.width,t.height),a=o[0],l=o[1],d=st(e.borderBottomRightRadius,t.width,t.height),h=d[0],u=d[1],f=st(e.borderBottomLeftRadius,t.width,t.height),B=f[0],w=f[1],v=[];v.push((s+a)/t.width),v.push((B+h)/t.width),v.push((i+w)/t.height),v.push((l+u)/t.height);var m=Math.max.apply(Math,v);m>1&&(s/=m,i/=m,a/=m,l/=m,h/=m,u/=m,B/=m,w/=m);var F=t.width-a,E=t.height-u,H=t.width-h,S=t.height-w,U=e.borderTopWidth,D=e.borderRightWidth,R=e.borderBottomWidth,M=e.borderLeftWidth,O=N(e.paddingTop,A.bounds.width),iA=N(e.paddingRight,A.bounds.width),Y=N(e.paddingBottom,A.bounds.width),G=N(e.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||i>0?V(t.left+M/3,t.top+U/3,s-M/3,i-U/3,K.TOP_LEFT):new y(t.left+M/3,t.top+U/3),this.topRightBorderDoubleOuterBox=s>0||i>0?V(t.left+F,t.top+U/3,a-D/3,l-U/3,K.TOP_RIGHT):new y(t.left+t.width-D/3,t.top+U/3),this.bottomRightBorderDoubleOuterBox=h>0||u>0?V(t.left+H,t.top+E,h-D/3,u-R/3,K.BOTTOM_RIGHT):new y(t.left+t.width-D/3,t.top+t.height-R/3),this.bottomLeftBorderDoubleOuterBox=B>0||w>0?V(t.left+M/3,t.top+S,B-M/3,w-R/3,K.BOTTOM_LEFT):new y(t.left+M/3,t.top+t.height-R/3),this.topLeftBorderDoubleInnerBox=s>0||i>0?V(t.left+M*2/3,t.top+U*2/3,s-M*2/3,i-U*2/3,K.TOP_LEFT):new y(t.left+M*2/3,t.top+U*2/3),this.topRightBorderDoubleInnerBox=s>0||i>0?V(t.left+F,t.top+U*2/3,a-D*2/3,l-U*2/3,K.TOP_RIGHT):new y(t.left+t.width-D*2/3,t.top+U*2/3),this.bottomRightBorderDoubleInnerBox=h>0||u>0?V(t.left+H,t.top+E,h-D*2/3,u-R*2/3,K.BOTTOM_RIGHT):new y(t.left+t.width-D*2/3,t.top+t.height-R*2/3),this.bottomLeftBorderDoubleInnerBox=B>0||w>0?V(t.left+M*2/3,t.top+S,B-M*2/3,w-R*2/3,K.BOTTOM_LEFT):new y(t.left+M*2/3,t.top+t.height-R*2/3),this.topLeftBorderStroke=s>0||i>0?V(t.left+M/2,t.top+U/2,s-M/2,i-U/2,K.TOP_LEFT):new y(t.left+M/2,t.top+U/2),this.topRightBorderStroke=s>0||i>0?V(t.left+F,t.top+U/2,a-D/2,l-U/2,K.TOP_RIGHT):new y(t.left+t.width-D/2,t.top+U/2),this.bottomRightBorderStroke=h>0||u>0?V(t.left+H,t.top+E,h-D/2,u-R/2,K.BOTTOM_RIGHT):new y(t.left+t.width-D/2,t.top+t.height-R/2),this.bottomLeftBorderStroke=B>0||w>0?V(t.left+M/2,t.top+S,B-M/2,w-R/2,K.BOTTOM_LEFT):new y(t.left+M/2,t.top+t.height-R/2),this.topLeftBorderBox=s>0||i>0?V(t.left,t.top,s,i,K.TOP_LEFT):new y(t.left,t.top),this.topRightBorderBox=a>0||l>0?V(t.left+F,t.top,a,l,K.TOP_RIGHT):new y(t.left+t.width,t.top),this.bottomRightBorderBox=h>0||u>0?V(t.left+H,t.top+E,h,u,K.BOTTOM_RIGHT):new y(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=B>0||w>0?V(t.left,t.top+S,B,w,K.BOTTOM_LEFT):new y(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||i>0?V(t.left+M,t.top+U,Math.max(0,s-M),Math.max(0,i-U),K.TOP_LEFT):new y(t.left+M,t.top+U),this.topRightPaddingBox=a>0||l>0?V(t.left+Math.min(F,t.width-D),t.top+U,F>t.width+D?0:Math.max(0,a-D),Math.max(0,l-U),K.TOP_RIGHT):new y(t.left+t.width-D,t.top+U),this.bottomRightPaddingBox=h>0||u>0?V(t.left+Math.min(H,t.width-M),t.top+Math.min(E,t.height-R),Math.max(0,h-D),Math.max(0,u-R),K.BOTTOM_RIGHT):new y(t.left+t.width-D,t.top+t.height-R),this.bottomLeftPaddingBox=B>0||w>0?V(t.left+M,t.top+Math.min(S,t.height-R),Math.max(0,B-M),Math.max(0,w-R),K.BOTTOM_LEFT):new y(t.left+M,t.top+t.height-R),this.topLeftContentBox=s>0||i>0?V(t.left+M+G,t.top+U+O,Math.max(0,s-(M+G)),Math.max(0,i-(U+O)),K.TOP_LEFT):new y(t.left+M+G,t.top+U+O),this.topRightContentBox=a>0||l>0?V(t.left+Math.min(F,t.width+M+G),t.top+U+O,F>t.width+M+G?0:a-M+G,l-(U+O),K.TOP_RIGHT):new y(t.left+t.width-(D+iA),t.top+U+O),this.bottomRightContentBox=h>0||u>0?V(t.left+Math.min(H,t.width-(M+G)),t.top+Math.min(E,t.height+U+O),Math.max(0,h-(D+iA)),u-(R+Y),K.BOTTOM_RIGHT):new y(t.left+t.width-(D+iA),t.top+t.height-(R+Y)),this.bottomLeftContentBox=B>0||w>0?V(t.left+M+G,t.top+S,Math.max(0,B-(M+G)),w-(R+Y),K.BOTTOM_LEFT):new y(t.left+M+G,t.top+t.height-(R+Y))}return r}(),K;(function(r){r[r.TOP_LEFT=0]="TOP_LEFT",r[r.TOP_RIGHT=1]="TOP_RIGHT",r[r.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",r[r.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(K||(K={}));var V=function(r,A,e,t,n){var s=4*((Math.sqrt(2)-1)/3),i=e*s,o=t*s,a=r+e,l=A+t;switch(n){case K.TOP_LEFT:return new Bn(new y(r,l),new y(r,l-o),new y(a-i,A),new y(a,A));case K.TOP_RIGHT:return new Bn(new y(r,A),new y(r+i,A),new y(a,l-o),new y(a,l));case K.BOTTOM_RIGHT:return new Bn(new y(a,A),new y(a,A+o),new y(r+i,l),new y(r,l));case K.BOTTOM_LEFT:default:return new Bn(new y(a,l),new y(a-i,l),new y(r,A+o),new y(r,A))}},fn=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},vw=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},wn=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},mw=function(){function r(A,e,t){this.offsetX=A,this.offsetY=e,this.matrix=t,this.type=0,this.target=6}return r}(),pn=function(){function r(A,e){this.path=A,this.target=e,this.type=1}return r}(),Fw=function(){function r(A){this.opacity=A,this.type=2,this.target=6}return r}(),Qw=function(r){return r.type===0},Yc=function(r){return r.type===1},Uw=function(r){return r.type===2},$c=function(r,A){return r.length===A.length?r.some(function(e,t){return e===A[t]}):!1},Ew=function(r,A,e,t,n){return r.map(function(s,i){switch(i){case 0:return s.add(A,e);case 1:return s.add(A+t,e);case 2:return s.add(A+t,e+n);case 3:return s.add(A,e+n)}return s})},Zc=function(){function r(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r}(),qc=function(){function r(A,e){if(this.container=A,this.parent=e,this.effects=[],this.curves=new Cw(this.container),this.container.styles.opacity<1&&this.effects.push(new Fw(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new mw(t,n,s))}if(this.container.styles.overflowX!==0){var i=fn(this.curves),o=wn(this.curves);$c(i,o)?this.effects.push(new pn(i,6)):(this.effects.push(new pn(i,2)),this.effects.push(new pn(o,4)))}}return r.prototype.getEffects=function(A){for(var e=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Yc(a)});if(e||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),e=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var i=fn(t.curves),o=wn(t.curves);$c(i,o)||n.unshift(new pn(o,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return Z(a.target,A)})},r}(),Ai=function(r,A,e,t){r.container.elements.forEach(function(n){var s=Z(n.flags,4),i=Z(n.flags,2),o=new qc(n,r);Z(n.styles.display,2048)&&t.push(o);var a=Z(n.flags,8)?[]:t;if(s||i){var l=s||n.styles.isPositioned()?e:A,d=new Zc(o);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var u=0;l.negativeZIndex.some(function(B,w){return h>B.element.container.styles.zIndex.order?(u=w,!1):u>0}),l.negativeZIndex.splice(u,0,d)}else if(h>0){var f=0;l.positiveZIndex.some(function(B,w){return h>=B.element.container.styles.zIndex.order?(f=w+1,!1):f>0}),l.positiveZIndex.splice(f,0,d)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(d)}else n.styles.isFloating()?l.nonPositionedFloats.push(d):l.nonPositionedInlineLevel.push(d);Ai(o,d,s?d:e,a)}else n.styles.isInlineLevel()?A.inlineLevel.push(o):A.nonInlineLevel.push(o),Ai(o,A,e,a);Z(n.flags,8)&&jc(n,a)})},jc=function(r,A){for(var e=r instanceof Vs?r.start:1,t=r instanceof Vs?r.reversed:!1,n=0;n<A.length;n++){var s=A[n];s.container instanceof Uc&&typeof s.container.value=="number"&&s.container.value!==0&&(e=s.container.value),s.listValue=dt(e,s.container.styles.listStyleType,!0),e+=t?-1:1}},yw=function(r){var A=new qc(r,null),e=new Zc(A),t=[];return Ai(A,e,e,t),jc(A.container,t),e},Ad=function(r,A){switch(A){case 0:return CA(r.topLeftBorderBox,r.topLeftPaddingBox,r.topRightBorderBox,r.topRightPaddingBox);case 1:return CA(r.topRightBorderBox,r.topRightPaddingBox,r.bottomRightBorderBox,r.bottomRightPaddingBox);case 2:return CA(r.bottomRightBorderBox,r.bottomRightPaddingBox,r.bottomLeftBorderBox,r.bottomLeftPaddingBox);case 3:default:return CA(r.bottomLeftBorderBox,r.bottomLeftPaddingBox,r.topLeftBorderBox,r.topLeftPaddingBox)}},Sw=function(r,A){switch(A){case 0:return CA(r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox,r.topRightBorderBox,r.topRightBorderDoubleOuterBox);case 1:return CA(r.topRightBorderBox,r.topRightBorderDoubleOuterBox,r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox);case 2:return CA(r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox,r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox);case 3:default:return CA(r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox,r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox)}},Iw=function(r,A){switch(A){case 0:return CA(r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox,r.topRightBorderDoubleInnerBox,r.topRightPaddingBox);case 1:return CA(r.topRightBorderDoubleInnerBox,r.topRightPaddingBox,r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox);case 2:return CA(r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox,r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox);case 3:default:return CA(r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox,r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox)}},Tw=function(r,A){switch(A){case 0:return Cn(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return Cn(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return Cn(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);case 3:default:return Cn(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},Cn=function(r,A){var e=[];return pA(r)?e.push(r.subdivide(.5,!1)):e.push(r),pA(A)?e.push(A.subdivide(.5,!0)):e.push(A),e},CA=function(r,A,e,t){var n=[];return pA(r)?n.push(r.subdivide(.5,!1)):n.push(r),pA(e)?n.push(e.subdivide(.5,!0)):n.push(e),pA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),pA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},ed=function(r){var A=r.bounds,e=r.styles;return A.add(e.borderLeftWidth,e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth),-(e.borderTopWidth+e.borderBottomWidth))},vn=function(r){var A=r.styles,e=r.bounds,t=N(A.paddingLeft,e.width),n=N(A.paddingRight,e.width),s=N(A.paddingTop,e.width),i=N(A.paddingBottom,e.width);return e.add(t+A.borderLeftWidth,s+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+t+n),-(A.borderTopWidth+A.borderBottomWidth+s+i))},Hw=function(r,A){return r===0?A.bounds:r===2?vn(A):ed(A)},Lw=function(r,A){return r===0?A.bounds:r===2?vn(A):ed(A)},ei=function(r,A,e){var t=Hw(He(r.styles.backgroundOrigin,A),r),n=Lw(He(r.styles.backgroundClip,A),r),s=bw(He(r.styles.backgroundSize,A),e,t),i=s[0],o=s[1],a=st(He(r.styles.backgroundPosition,A),t.width-i,t.height-o),l=Mw(He(r.styles.backgroundRepeat,A),a,s,t,n),d=Math.round(t.left+a[0]),h=Math.round(t.top+a[1]);return[l,d,h,i,o]},Te=function(r){return k(r)&&r.value===Ue.AUTO},mn=function(r){return typeof r=="number"},bw=function(r,A,e){var t=A[0],n=A[1],s=A[2],i=r[0],o=r[1];if(!i)return[0,0];if(z(i)&&o&&z(o))return[N(i,e.width),N(o,e.height)];var a=mn(s);if(k(i)&&(i.value===Ue.CONTAIN||i.value===Ue.COVER)){if(mn(s)){var l=e.width/e.height;return l<s!=(i.value===Ue.COVER)?[e.width,e.width/s]:[e.height*s,e.height]}return[e.width,e.height]}var d=mn(t),h=mn(n),u=d||h;if(Te(i)&&(!o||Te(o))){if(d&&h)return[t,n];if(!a&&!u)return[e.width,e.height];if(u&&a){var f=d?t:n*s,B=h?n:t/s;return[f,B]}var w=d?t:e.width,v=h?n:e.height;return[w,v]}if(a){var m=0,F=0;return z(i)?m=N(i,e.width):z(o)&&(F=N(o,e.height)),Te(i)?m=F*s:(!o||Te(o))&&(F=m/s),[m,F]}var E=null,H=null;if(z(i)?E=N(i,e.width):o&&z(o)&&(H=N(o,e.height)),E!==null&&(!o||Te(o))&&(H=d&&h?E/t*n:e.height),H!==null&&Te(i)&&(E=d&&h?H/n*t:e.width),E!==null&&H!==null)return[E,H];throw new Error("Unable to calculate background-size for element")},He=function(r,A){var e=r[A];return typeof e>"u"?r[0]:e},Mw=function(r,A,e,t,n){var s=A[0],i=A[1],o=e[0],a=e[1];switch(r){case 2:return[new y(Math.round(t.left),Math.round(t.top+i)),new y(Math.round(t.left+t.width),Math.round(t.top+i)),new y(Math.round(t.left+t.width),Math.round(a+t.top+i)),new y(Math.round(t.left),Math.round(a+t.top+i))];case 3:return[new y(Math.round(t.left+s),Math.round(t.top)),new y(Math.round(t.left+s+o),Math.round(t.top)),new y(Math.round(t.left+s+o),Math.round(t.height+t.top)),new y(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new y(Math.round(t.left+s),Math.round(t.top+i)),new y(Math.round(t.left+s+o),Math.round(t.top+i)),new y(Math.round(t.left+s+o),Math.round(t.top+i+a)),new y(Math.round(t.left+s),Math.round(t.top+i+a))];default:return[new y(Math.round(n.left),Math.round(n.top)),new y(Math.round(n.left+n.width),Math.round(n.top)),new y(Math.round(n.left+n.width),Math.round(n.height+n.top)),new y(Math.round(n.left),Math.round(n.height+n.top))]}},Dw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",td="Hidden Text",Rw=function(){function r(A){this._data={},this._document=A}return r.prototype.parseMetrics=function(A,e){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),i=this._document.body;t.style.visibility="hidden",t.style.fontFamily=A,t.style.fontSize=e,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",i.appendChild(t),n.src=Dw,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=A,s.style.fontSize=e,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(td)),t.appendChild(s),t.appendChild(n);var o=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(td)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return i.removeChild(t),{baseline:o,middle:a}},r.prototype.getMetrics=function(A,e){var t=A+" "+e;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(A,e)),this._data[t]},r}(),rd=function(){function r(A,e){this.context=A,this.options=e}return r}(),xw=1e4,Pw=function(r){mA(A,r);function A(e,t){var n=r.call(this,e,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new Rw(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return A.prototype.applyEffects=function(e){for(var t=this;this._activeEffects.length;)this.popEffect();e.forEach(function(n){return t.applyEffect(n)})},A.prototype.applyEffect=function(e){this.ctx.save(),Uw(e)&&(this.ctx.globalAlpha=e.opacity),Qw(e)&&(this.ctx.translate(e.offsetX,e.offsetY),this.ctx.transform(e.matrix[0],e.matrix[1],e.matrix[2],e.matrix[3],e.matrix[4],e.matrix[5]),this.ctx.translate(-e.offsetX,-e.offsetY)),Yc(e)&&(this.path(e.path),this.ctx.clip()),this._activeEffects.push(e)},A.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},A.prototype.renderStack=function(e){return uA(this,void 0,void 0,function(){var t;return nA(this,function(n){switch(n.label){case 0:return t=e.element.container.styles,t.isVisible()?[4,this.renderStackContent(e)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(e){return uA(this,void 0,void 0,function(){return nA(this,function(t){switch(t.label){case 0:if(Z(e.container.flags,16))debugger;return e.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(e)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(e,t,n){var s=this;if(t===0)this.ctx.fillText(e.text,e.bounds.left,e.bounds.top+n);else{var i=_s(e.text);i.reduce(function(o,a){return s.ctx.fillText(a,o,e.bounds.top+n),o+s.ctx.measureText(a).width},e.bounds.left)}},A.prototype.createFontStyle=function(e){var t=e.fontVariant.filter(function(i){return i==="normal"||i==="small-caps"}).join(""),n=_w(e.fontFamily).join(", "),s=nt(e.fontSize)?""+e.fontSize.number+e.fontSize.unit:e.fontSize.number+"px";return[[e.fontStyle,t,e.fontWeight,s,n].join(" "),n,s]},A.prototype.renderTextNode=function(e,t){return uA(this,void 0,void 0,function(){var n,s,i,o,a,l,d,h,u=this;return nA(this,function(f){return n=this.createFontStyle(t),s=n[0],i=n[1],o=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(i,o),l=a.baseline,d=a.middle,h=t.paintOrder,e.textBounds.forEach(function(B){h.forEach(function(w){switch(w){case 0:u.ctx.fillStyle=j(t.color),u.renderTextWithLetterSpacing(B,t.letterSpacing,l);var v=t.textShadow;v.length&&B.text.trim().length&&(v.slice(0).reverse().forEach(function(m){u.ctx.shadowColor=j(m.color),u.ctx.shadowOffsetX=m.offsetX.number*u.options.scale,u.ctx.shadowOffsetY=m.offsetY.number*u.options.scale,u.ctx.shadowBlur=m.blur.number,u.renderTextWithLetterSpacing(B,t.letterSpacing,l)}),u.ctx.shadowColor="",u.ctx.shadowOffsetX=0,u.ctx.shadowOffsetY=0,u.ctx.shadowBlur=0),t.textDecorationLine.length&&(u.ctx.fillStyle=j(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(m){switch(m){case 1:u.ctx.fillRect(B.bounds.left,Math.round(B.bounds.top+l),B.bounds.width,1);break;case 2:u.ctx.fillRect(B.bounds.left,Math.round(B.bounds.top),B.bounds.width,1);break;case 3:u.ctx.fillRect(B.bounds.left,Math.ceil(B.bounds.top+d),B.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&B.text.trim().length&&(u.ctx.strokeStyle=j(t.webkitTextStrokeColor),u.ctx.lineWidth=t.webkitTextStrokeWidth,u.ctx.lineJoin=window.chrome?"miter":"round",u.ctx.strokeText(B.text,B.bounds.left,B.bounds.top+l)),u.ctx.strokeStyle="",u.ctx.lineWidth=0,u.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(e,t,n){if(n&&e.intrinsicWidth>0&&e.intrinsicHeight>0){var s=vn(e),i=wn(t);this.path(i),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,e.intrinsicWidth,e.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(e){return uA(this,void 0,void 0,function(){var t,n,s,i,o,a,F,F,l,d,h,u,H,f,B,S,w,v,m,F,E,H,S;return nA(this,function(U){switch(U.label){case 0:this.applyEffects(e.getEffects(4)),t=e.container,n=e.curves,s=t.styles,i=0,o=t.textNodes,U.label=1;case 1:return i<o.length?(a=o[i],[4,this.renderTextNode(a,s)]):[3,4];case 2:U.sent(),U.label=3;case 3:return i++,[3,1];case 4:if(!(t instanceof mc))return[3,8];U.label=5;case 5:return U.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return F=U.sent(),this.renderReplacedElement(t,n,F),[3,8];case 7:return U.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Fc&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof Qc))return[3,12];U.label=9;case 9:return U.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return F=U.sent(),this.renderReplacedElement(t,n,F),[3,12];case 11:return U.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof Ic&&t.tree?(l=new A(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,l.render(t.tree)]):[3,14];case 13:d=U.sent(),t.width&&t.height&&this.ctx.drawImage(d,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),U.label=14;case 14:if(t instanceof Os&&(h=Math.min(t.bounds.width,t.bounds.height),t.type===ln?t.checked&&(this.ctx.save(),this.path([new y(t.bounds.left+h*.39363,t.bounds.top+h*.79),new y(t.bounds.left+h*.16,t.bounds.top+h*.5549),new y(t.bounds.left+h*.27347,t.bounds.top+h*.44071),new y(t.bounds.left+h*.39694,t.bounds.top+h*.5649),new y(t.bounds.left+h*.72983,t.bounds.top+h*.23),new y(t.bounds.left+h*.84,t.bounds.top+h*.34085),new y(t.bounds.left+h*.39363,t.bounds.top+h*.79)]),this.ctx.fillStyle=j(Ec),this.ctx.fill(),this.ctx.restore()):t.type===cn&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+h/2,t.bounds.top+h/2,h/4,0,Math.PI*2,!0),this.ctx.fillStyle=j(Ec),this.ctx.fill(),this.ctx.restore())),Kw(t)&&t.value.length){switch(u=this.createFontStyle(s),H=u[0],f=u[1],B=this.fontMetrics.getMetrics(H,f).baseline,this.ctx.font=H,this.ctx.fillStyle=j(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=kw(t.styles.textAlign),S=vn(t),w=0,t.styles.textAlign){case 1:w+=S.width/2;break;case 2:w+=S.width;break}v=S.add(w,0,0,-S.height/2+1),this.ctx.save(),this.path([new y(S.left,S.top),new y(S.left+S.width,S.top),new y(S.left+S.width,S.top+S.height),new y(S.left,S.top+S.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new lt(t.value,v),s.letterSpacing,B),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Z(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(m=t.styles.listStyleImage,m.type!==0)return[3,18];F=void 0,E=m.url,U.label=15;case 15:return U.trys.push([15,17,,18]),[4,this.context.cache.match(E)];case 16:return F=U.sent(),this.ctx.drawImage(F,t.bounds.left-(F.width+10),t.bounds.top),[3,18];case 17:return U.sent(),this.context.logger.error("Error loading list-style-image "+E),[3,18];case 18:return[3,20];case 19:e.listValue&&t.styles.listStyleType!==-1&&(H=this.createFontStyle(s)[0],this.ctx.font=H,this.ctx.fillStyle=j(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",S=new bA(t.bounds.left,t.bounds.top+N(t.styles.paddingTop,t.bounds.width),t.bounds.width,tc(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new lt(e.listValue,S),s.letterSpacing,tc(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),U.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(e){return uA(this,void 0,void 0,function(){var t,n,m,s,i,m,o,a,m,l,d,m,h,u,m,f,B,m,w,v,m;return nA(this,function(F){switch(F.label){case 0:if(Z(e.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(e.element)];case 1:F.sent(),t=0,n=e.negativeZIndex,F.label=2;case 2:return t<n.length?(m=n[t],[4,this.renderStack(m)]):[3,5];case 3:F.sent(),F.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(e.element)];case 6:F.sent(),s=0,i=e.nonInlineLevel,F.label=7;case 7:return s<i.length?(m=i[s],[4,this.renderNode(m)]):[3,10];case 8:F.sent(),F.label=9;case 9:return s++,[3,7];case 10:o=0,a=e.nonPositionedFloats,F.label=11;case 11:return o<a.length?(m=a[o],[4,this.renderStack(m)]):[3,14];case 12:F.sent(),F.label=13;case 13:return o++,[3,11];case 14:l=0,d=e.nonPositionedInlineLevel,F.label=15;case 15:return l<d.length?(m=d[l],[4,this.renderStack(m)]):[3,18];case 16:F.sent(),F.label=17;case 17:return l++,[3,15];case 18:h=0,u=e.inlineLevel,F.label=19;case 19:return h<u.length?(m=u[h],[4,this.renderNode(m)]):[3,22];case 20:F.sent(),F.label=21;case 21:return h++,[3,19];case 22:f=0,B=e.zeroOrAutoZIndexOrTransformedOrOpacity,F.label=23;case 23:return f<B.length?(m=B[f],[4,this.renderStack(m)]):[3,26];case 24:F.sent(),F.label=25;case 25:return f++,[3,23];case 26:w=0,v=e.positiveZIndex,F.label=27;case 27:return w<v.length?(m=v[w],[4,this.renderStack(m)]):[3,30];case 28:F.sent(),F.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},A.prototype.mask=function(e){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(e.slice(0).reverse()),this.ctx.closePath()},A.prototype.path=function(e){this.ctx.beginPath(),this.formatPath(e),this.ctx.closePath()},A.prototype.formatPath=function(e){var t=this;e.forEach(function(n,s){var i=pA(n)?n.start:n;s===0?t.ctx.moveTo(i.x,i.y):t.ctx.lineTo(i.x,i.y),pA(n)&&t.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},A.prototype.renderRepeat=function(e,t,n,s){this.path(e),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},A.prototype.resizeImage=function(e,t,n){var s;if(e.width===t&&e.height===n)return e;var i=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,o=i.createElement("canvas");o.width=Math.max(1,t),o.height=Math.max(1,n);var a=o.getContext("2d");return a.drawImage(e,0,0,e.width,e.height,0,0,t,n),o},A.prototype.renderBackgroundImage=function(e){return uA(this,void 0,void 0,function(){var t,n,s,i,o,a;return nA(this,function(l){switch(l.label){case 0:t=e.styles.backgroundImage.length-1,n=function(d){var h,u,f,O,oA,gA,G,q,R,B,O,oA,gA,G,q,w,v,m,F,E,H,S,U,D,R,M,O,iA,Y,G,q,SA,oA,gA,ce,IA,zA,de,ue,xA,he,PA;return nA(this,function(Pe){switch(Pe.label){case 0:if(d.type!==0)return[3,5];h=void 0,u=d.url,Pe.label=1;case 1:return Pe.trys.push([1,3,,4]),[4,s.context.cache.match(u)];case 2:return h=Pe.sent(),[3,4];case 3:return Pe.sent(),s.context.logger.error("Error loading background-image "+u),[3,4];case 4:return h&&(f=ei(e,t,[h.width,h.height,h.width/h.height]),O=f[0],oA=f[1],gA=f[2],G=f[3],q=f[4],R=s.ctx.createPattern(s.resizeImage(h,G,q),"repeat"),s.renderRepeat(O,R,oA,gA)),[3,6];case 5:Fg(d)?(B=ei(e,t,[null,null,null]),O=B[0],oA=B[1],gA=B[2],G=B[3],q=B[4],w=wg(d.angle,G,q),v=w[0],m=w[1],F=w[2],E=w[3],H=w[4],S=document.createElement("canvas"),S.width=G,S.height=q,U=S.getContext("2d"),D=U.createLinearGradient(m,E,F,H),Wl(d.stops,v).forEach(function(vr){return D.addColorStop(vr.stop,j(vr.color))}),U.fillStyle=D,U.fillRect(0,0,G,q),G>0&&q>0&&(R=s.ctx.createPattern(S,"repeat"),s.renderRepeat(O,R,oA,gA))):Qg(d)&&(M=ei(e,t,[null,null,null]),O=M[0],iA=M[1],Y=M[2],G=M[3],q=M[4],SA=d.position.length===0?[Ss]:d.position,oA=N(SA[0],G),gA=N(SA[SA.length-1],q),ce=pg(d,oA,gA,G,q),IA=ce[0],zA=ce[1],IA>0&&zA>0&&(de=s.ctx.createRadialGradient(iA+oA,Y+gA,0,iA+oA,Y+gA,IA),Wl(d.stops,IA*2).forEach(function(vr){return de.addColorStop(vr.stop,j(vr.color))}),s.path(O),s.ctx.fillStyle=de,IA!==zA?(ue=e.bounds.left+.5*e.bounds.width,xA=e.bounds.top+.5*e.bounds.height,he=zA/IA,PA=1/he,s.ctx.save(),s.ctx.translate(ue,xA),s.ctx.transform(1,0,0,he,0,0),s.ctx.translate(-ue,-xA),s.ctx.fillRect(iA,PA*(Y-xA)+xA,G,q*PA),s.ctx.restore()):s.ctx.fill())),Pe.label=6;case 6:return t--,[2]}})},s=this,i=0,o=e.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return i<o.length?(a=o[i],[5,n(a)]):[3,4];case 2:l.sent(),l.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(e,t,n){return uA(this,void 0,void 0,function(){return nA(this,function(s){return this.path(Ad(n,t)),this.ctx.fillStyle=j(e),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(e,t,n,s){return uA(this,void 0,void 0,function(){var i,o;return nA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(e,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return i=Sw(s,n),this.path(i),this.ctx.fillStyle=j(e),this.ctx.fill(),o=Iw(s,n),this.path(o),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(e){return uA(this,void 0,void 0,function(){var t,n,s,i,o,a,l,d,h=this;return nA(this,function(u){switch(u.label){case 0:return this.applyEffects(e.getEffects(2)),t=e.container.styles,n=!OA(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],i=Gw(He(t.backgroundClip,0),e.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),OA(t.backgroundColor)||(this.ctx.fillStyle=j(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(e.container)]):[3,2];case 1:u.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(f){h.ctx.save();var B=fn(e.curves),w=f.inset?0:xw,v=Ew(B,-w+(f.inset?1:-1)*f.spread.number,(f.inset?1:-1)*f.spread.number,f.spread.number*(f.inset?-2:2),f.spread.number*(f.inset?-2:2));f.inset?(h.path(B),h.ctx.clip(),h.mask(v)):(h.mask(B),h.ctx.clip(),h.path(v)),h.ctx.shadowOffsetX=f.offsetX.number+w,h.ctx.shadowOffsetY=f.offsetY.number,h.ctx.shadowColor=j(f.color),h.ctx.shadowBlur=f.blur.number,h.ctx.fillStyle=f.inset?j(f.color):"rgba(0,0,0,1)",h.ctx.fill(),h.ctx.restore()}),u.label=2;case 2:o=0,a=0,l=s,u.label=3;case 3:return a<l.length?(d=l[a],d.style!==0&&!OA(d.color)&&d.width>0?d.style!==2?[3,5]:[4,this.renderDashedDottedBorder(d.color,d.width,o,e.curves,2)]:[3,11]):[3,13];case 4:return u.sent(),[3,11];case 5:return d.style!==3?[3,7]:[4,this.renderDashedDottedBorder(d.color,d.width,o,e.curves,3)];case 6:return u.sent(),[3,11];case 7:return d.style!==4?[3,9]:[4,this.renderDoubleBorder(d.color,d.width,o,e.curves)];case 8:return u.sent(),[3,11];case 9:return[4,this.renderSolidBorder(d.color,o,e.curves)];case 10:u.sent(),u.label=11;case 11:o++,u.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(e,t,n,s,i){return uA(this,void 0,void 0,function(){var o,a,l,d,h,u,f,B,w,v,m,F,E,H,S,U,S,U;return nA(this,function(D){return this.ctx.save(),o=Tw(s,n),a=Ad(s,n),i===2&&(this.path(a),this.ctx.clip()),pA(a[0])?(l=a[0].start.x,d=a[0].start.y):(l=a[0].x,d=a[0].y),pA(a[1])?(h=a[1].end.x,u=a[1].end.y):(h=a[1].x,u=a[1].y),n===0||n===2?f=Math.abs(l-h):f=Math.abs(d-u),this.ctx.beginPath(),i===3?this.formatPath(o):this.formatPath(a.slice(0,2)),B=t<3?t*3:t*2,w=t<3?t*2:t,i===3&&(B=t,w=t),v=!0,f<=B*2?v=!1:f<=B*2+w?(m=f/(2*B+w),B*=m,w*=m):(F=Math.floor((f+w)/(B+w)),E=(f-F*B)/(F-1),H=(f-(F+1)*B)/F,w=H<=0||Math.abs(w-E)<Math.abs(w-H)?E:H),v&&(i===3?this.ctx.setLineDash([0,B+w]):this.ctx.setLineDash([B,w])),i===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=j(e),this.ctx.stroke(),this.ctx.setLineDash([]),i===2&&(pA(a[0])&&(S=a[3],U=a[0],this.ctx.beginPath(),this.formatPath([new y(S.end.x,S.end.y),new y(U.start.x,U.start.y)]),this.ctx.stroke()),pA(a[1])&&(S=a[1],U=a[2],this.ctx.beginPath(),this.formatPath([new y(S.end.x,S.end.y),new y(U.start.x,U.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(e){return uA(this,void 0,void 0,function(){var t;return nA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=j(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=yw(e),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A}(rd),Kw=function(r){return r instanceof Sc||r instanceof yc?!0:r instanceof Os&&r.type!==cn&&r.type!==ln},Gw=function(r,A){switch(r){case 0:return fn(A);case 2:return vw(A);case 1:default:return wn(A)}},kw=function(r){switch(r){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Nw=["-apple-system","system-ui"],_w=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(A){return Nw.indexOf(A)===-1}):r},Vw=function(r){mA(A,r);function A(e,t){var n=r.call(this,e,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return A.prototype.render=function(e){return uA(this,void 0,void 0,function(){var t,n;return nA(this,function(s){switch(s.label){case 0:return t=Ns(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e),[4,Ow(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=j(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},A}(rd),Ow=function(r){return new Promise(function(A,e){var t=new Image;t.onload=function(){A(t)},t.onerror=e,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},Ww=function(){function r(A){var e=A.id,t=A.enabled;this.id=e,this.enabled=t,this.start=Date.now()}return r.prototype.debug=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.prototype.getTime=function(){return Date.now()-this.start},r.prototype.info=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Ir([this.id,this.getTime()+"ms"],A))},r.prototype.warn=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.prototype.error=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.instances={},r}(),Xw=function(){function r(A,e){var t;this.windowBounds=e,this.instanceName="#"+r.instanceCount++,this.logger=new Ww({id:this.instanceName,enabled:A.logging}),this.cache=(t=A.cache)!==null&&t!==void 0?t:new uw(this,A)}return r.instanceCount=1,r}(),Jw=function(r,A){return A===void 0&&(A={}),zw(r,A)};typeof window<"u"&&zc.setContext(window);var zw=function(r,A){return uA(void 0,void 0,void 0,function(){var e,t,n,s,i,o,a,l,d,h,u,f,B,w,v,m,F,E,H,S,D,U,D,R,M,O,iA,Y,G,q,SA,oA,gA,ce,IA,zA,de,ue,xA,he;return nA(this,function(PA){switch(PA.label){case 0:if(!r||typeof r!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(e=r.ownerDocument,!e)throw new Error("Element is not attached to a Document");if(t=e.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(R=A.allowTaint)!==null&&R!==void 0?R:!1,imageTimeout:(M=A.imageTimeout)!==null&&M!==void 0?M:15e3,proxy:A.proxy,useCORS:(O=A.useCORS)!==null&&O!==void 0?O:!1},s=is({logging:(iA=A.logging)!==null&&iA!==void 0?iA:!0,cache:A.cache},n),i={windowWidth:(Y=A.windowWidth)!==null&&Y!==void 0?Y:t.innerWidth,windowHeight:(G=A.windowHeight)!==null&&G!==void 0?G:t.innerHeight,scrollX:(q=A.scrollX)!==null&&q!==void 0?q:t.pageXOffset,scrollY:(SA=A.scrollY)!==null&&SA!==void 0?SA:t.pageYOffset},o=new bA(i.scrollX,i.scrollY,i.windowWidth,i.windowHeight),a=new Xw(s,o),l=(oA=A.foreignObjectRendering)!==null&&oA!==void 0?oA:!1,d={allowTaint:(gA=A.allowTaint)!==null&&gA!==void 0?gA:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:l,copyStyles:l},a.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),h=new Xc(a,r,d),u=h.clonedReferenceElement,u?[4,h.toIFrame(e,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return f=PA.sent(),B=Xs(u)||Yf(u)?Uu(u.ownerDocument):Tr(a,u),w=B.width,v=B.height,m=B.left,F=B.top,E=Yw(a,u,A.backgroundColor),H={canvas:A.canvas,backgroundColor:E,scale:(IA=(ce=A.scale)!==null&&ce!==void 0?ce:t.devicePixelRatio)!==null&&IA!==void 0?IA:1,x:((zA=A.x)!==null&&zA!==void 0?zA:0)+m,y:((de=A.y)!==null&&de!==void 0?de:0)+F,width:(ue=A.width)!==null&&ue!==void 0?ue:Math.ceil(w),height:(xA=A.height)!==null&&xA!==void 0?xA:Math.ceil(v)},l?(a.logger.debug("Document cloned, using foreign object rendering"),D=new Vw(a,H),[4,D.render(u)]):[3,3];case 2:return S=PA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+m+","+F+" with size "+w+"x"+v+" using computed rendering"),a.logger.debug("Starting DOM parsing"),U=Hc(a,u),E===U.styles.backgroundColor&&(U.styles.backgroundColor=DA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+H.x+","+H.y+" with size "+H.width+"x"+H.height),D=new Pw(a,H),[4,D.render(U)];case 4:S=PA.sent(),PA.label=5;case 5:return(!((he=A.removeContainer)!==null&&he!==void 0)||he)&&(Xc.destroy(f)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,S]}})})},Yw=function(r,A,e){var t=A.ownerDocument,n=t.documentElement?it(r,getComputedStyle(t.documentElement).backgroundColor):DA.TRANSPARENT,s=t.body?it(r,getComputedStyle(t.body).backgroundColor):DA.TRANSPARENT,i=typeof e=="string"?it(r,e):e===null?DA.TRANSPARENT:4294967295;return A===t.documentElement?OA(n)?OA(s)?i:s:n:i};const Mt=class Mt extends c.EngineObject{constructor(A,e){super(A,e),this.ad(new c.ObjResettingWithEvent(A.renderInUEChanged,()=>A.renderInUE?new sd(A,e):new nd(A,e)))}};p(Mt,"type",Mt.register("ESUeViewer",c.ESGeoDiv.type,Mt));let ti=Mt;class nd extends c.Destroyable{constructor(e,t){super();p(this,"_screenPosition",this.disposeVar(c.reactArrayWithUndefined(void 0)));const n=t.viewer;if(!n){console.warn("viewer is undefined!");return}const s=this.disposeVar(new c.ESTextLabel);s.parentID=e.id,e.components.disposableAdd(s,!0),s.show=!1,this.dispose(c.bind([s,"position"],[e,"position"])),this.dispose(c.bind([s,"rotation"],[e,"rotation"])),this.dispose(c.bind([s,"flyToParam"],[e,"flyToParam"])),this.dispose(c.bind([s,"flyInParam"],[e,"flyInParam"])),this.dispose(e.calcFlyToParamEvent.disposableOn(()=>{YA(n,s.id)})),this.dispose(e.calcFlyInParamEvent.disposableOn(async()=>{if(!t.actived)return;const a=await t.getCurrentCameraInfo();if(!a)return;const{position:l,rotation:d}=a;e.flyInParam={position:l,rotation:d,flyDuration:1}})),this.dispose(e.smoothMoveEvent.disposableOn((a,l)=>{_e(n,s.id,a,l)})),this.dispose(e.smoothMoveWithRotationEvent.disposableOn((a,l,d)=>{Ge(n,s.id,a,l,d)})),this.dispose(e.smoothMoveOnGroundEvent.disposableOn((a,l,d,h)=>{ke(n,s.id,a,l,h,d)})),this.dispose(e.smoothMoveWithRotationOnGroundEvent.disposableOn((a,l,d,h,u)=>{Ne(n,s.id,a,l,d,h,u)})),this.dispose(e.flyToEvent.disposableOn((a,l)=>{s.flyTo(a)})),this.dispose(e.flyInEvent.don(a=>{s.flyIn(a)}));const i=this._screenPosition,o=this.disposeVar(new c.ESCustomDiv);o.parentID=e.id,t.add(o),this.dispose(()=>t.delete(o)),this.dispose(c.bind([o,"allowPicking"],[e,"allowPicking"]));{const a=this.disposeVar(c.createAnimateFrame()),l=()=>{e.show?a.restart(void 0,async()=>{if(!e.position)return;const d=await t.lonLatAltToScreenPosition(e.position);if(!this.isDestroyed())if(!d)this._screenPosition.value=void 0;else{const[h,u]=d;h===-1&&u===-1?this._screenPosition.value=void 0:this._screenPosition.value=[h,u]}}):a.cancel()};l(),this.dispose(e.showChanged.disposableOn(l))}{const a=()=>class extends c.Destroyable{constructor(u,f,B){if(super(),this._subContainer=u,!B)return;if(!e.instanceClass)throw new Error("!sceneObject.instanceClass");const w=new c.PosFloatDiv,v=w.element;this._subContainer.appendChild(v),this.dispose(()=>this._subContainer.removeChild(v)),v.onclick=m=>{(e.allowPicking??!1)&&e.pickedEvent.emit(new c.ESJPickedResult({div:v,pointerEvent:m},e,void 0,void 0,void 0,[m.x,m.y]))};{const m=()=>{e.editing?v.children[0].style.pointerEvents="none":v.children[0].style.pointerEvents="all"};m(),this.d(e.editingChanged.don(m))}{const m=()=>{const E=e.show;i.value&&E?(w.show=!0,w.winPos=[...i.value]):(w.show=!1,w.winPos=[0,0])};m();const F=this.disposeVar(c.createNextAnimateFrameEvent(e.showChanged,i.changed));this.dispose(F.disposableOn(m))}{const m=()=>{const[F,E]=e.anchor??c.ESGeoDiv.defaults.anchor;w.originRatioX=F,w.originRatioY=E};m(),this.dispose(e.anchorChanged.disposableOn(m))}{const m=()=>{w.opacity=e.opacity??c.ESGeoDiv.defaults.opacity};m(),this.dispose(e.opacityChanged.disposableOn(m))}this.disposeVar(new e.instanceClass(w.contentDiv,e,B))}},l=()=>{try{e.instanceClass?o.instanceClass=a():o.instanceClass=void 0}catch(h){console.error(h)}};l();const d=this.dv(c.createNextAnimateFrameEvent(e.instanceClassChanged,e.opacityChanged,e.anchorChanged,e.editingChanged,e.showChanged,e.allowPickingChanged));this.d(d.don(l))}}get screenPosition(){return this._screenPosition.value}get screenPositionChanged(){return this._screenPosition.changed}set screenPosition(e){this._screenPosition.value=e}}class sd extends c.Destroyable{constructor(e,t){super();p(this,"_imageLabel");p(this,"_hasClassDivAndPos",{});this._imageLabel=this.dv(new c.ESImageLabel),this._imageLabel.isHoverZoom=!1,this._imageLabel.parentID=e.id;const n=t.viewer;if(!n){console.warn("viewer is undefined!");return}const s=this._imageLabel;e.components.disposableAdd(s,!0);{const i=()=>{if(!n)return;if(!e.instanceClass)throw new Error("!sceneObject.instanceClass");const l=document.createElement("div"),d=this.dv(new e.instanceClass(l,e,t))._container;if(d.style.opacity=e.opacity.toString()??c.ESGeoDiv.defaults.opacity,d.style.position="fixed",d.style.zIndex="-1",d.style.top="0px",!document.body.contains(d)){document.body.appendChild(d);let u=d?d.querySelectorAll("*[class]"):[];for(let f=0;f<u.length;f++){const B=u[f];var h=B.getBoundingClientRect();this._hasClassDivAndPos[B.className]=[B.offsetLeft,B.offsetTop,B.offsetLeft+h.width,B.offsetTop+h.height]}}Jw(d,{backgroundColor:null,allowTaint:!0,useCORS:!0,width:d.offsetWidth,height:d.offsetHeight,scale:1}).then(u=>{document.body.contains(d)&&document.body.removeChild(d),s.url=u.toDataURL(),s.show=e.show}).catch(()=>{document.body.contains(d)&&document.body.removeChild(d)})},o=()=>{try{e.instanceClass?i():(s.url="",s.show=!1)}catch(l){console.error(l)}};o();const a=this.dv(c.createNextAnimateFrameEvent(e.instanceClassChanged,e.opacityChanged));this.d(a.don(o))}{const i=()=>{s.show=e.show};s.show=!1,this.ad(e.showChanged.don(i))}this.d(c.track([s,"anchor"],[e,"anchor"])),this.d(c.bind([s,"position"],[e,"position"])),this.d(c.bind([s,"rotation"],[e,"rotation"])),this.d(c.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(c.bind([s,"flyInParam"],[e,"flyInParam"])),this.d(c.bind([s,"allowPicking"],[e,"allowPicking"])),this.d(c.bind([s,"scale"],[e,"scale"])),this.d(c.track([s,"minVisibleDistance"],[e,"minVisibleDistance"])),this.d(c.track([s,"maxVisibleDistance"],[e,"maxVisibleDistance"])),this.ad(e.automaticLandingEvent.don(()=>{s.automaticLanding()})),this.d(t.widgetEvent.don(i=>{if(i.objId!==this._imageLabel.id)return;const{type:o,add:a}=i;if(o==="leftClick"&&a){const l=(a==null?void 0:a.classNames)??[],d=Object.keys(this._hasClassDivAndPos);for(let h=0;h<d.length;h++){const u=d[h];let f=this._hasClassDivAndPos[u];a&&a.mouseRelativePos&&a.mouseRelativePos[0]>=f[0]&&a.mouseRelativePos[0]<=f[2]&&a.mouseRelativePos[1]>=f[1]&&a.mouseRelativePos[1]<=f[3]&&l.push(u)}a.classNames=l}e.widgetEvent.emit({type:o,add:a})})),this.d(e.calcFlyToParamEvent.don(()=>{YA(n,s.id)})),this.d(e.calcFlyInParamEvent.don(()=>{const i=t.getCurrentCameraInfo();if(!i)return;const{position:o,rotation:a}=i;e.flyInParam={position:o,rotation:a,flyDuration:1}})),this.d(e.smoothMoveEvent.don((i,o)=>{_e(n,s.id,i,o)})),this.d(e.smoothMoveWithRotationEvent.don((i,o,a)=>{Ge(n,s.id,i,o,a)})),this.d(e.smoothMoveOnGroundEvent.don((i,o,a,l)=>{ke(n,s.id,i,o,l,a)})),this.d(e.smoothMoveWithRotationOnGroundEvent.don((i,o,a,l,d)=>{Ne(n,s.id,i,o,a,l,d)})),this.d(e.flyToEvent.don((i,o)=>{s.flyTo(i)})),this.d(e.flyInEvent.don(i=>{s.flyIn(i)}))}}const Dt=class Dt extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.flyToFeatureIndexEvent.don((n,s)=>{t.callUeFunc({f:"flyToFeatureIndex",p:{id:A.id,index:n,duration:s}})})),this.d(A.flyToFeatureEvent.don((n,s,i)=>{t.callUeFunc({f:"flyToFeature",p:{id:A.id,key:n,value:s,duration:i}})}))}};p(Dt,"type",Dt.register("ESUeViewer",c.ESGeoJson.type,Dt));let ri=Dt;const Rt=class Rt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Rt,"type",Rt.register("ESUeViewer",c.ESGeoLineString.type,Rt));let Fn=Rt;const xt=class xt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(xt,"type",xt.register("ESUeViewer",c.ESGeoRectangle.type,xt));let ni=xt;const Pt=class Pt extends dA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Pt,"type",Pt.register("ESUeViewer",c.ESGeoWater.type,Pt));let si=Pt;const ie=class ie extends P{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.setNodePositionEvent.don((n,s)=>{io(t,A.id,n,s)})),this.d(A.setNodeRotationEvent.don((n,s)=>{oo(t,A.id,n,s)})),this.d(A.setNodeScaleEvent.don((n,s)=>{ao(t,A.id,n,s)}))}};p(ie,"forceUeUpdateProps",[...P.forceUeUpdateProps,"url"]),p(ie,"propValFuncs",{...P.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(c.rpToap(A)):(A.url=c.ESSceneObject.context.getStrFromEnv(c.rpToap(A.url)),A),czmMaximumScale:null,czmMinimumPixelSize:null,czmNativeScale:null,czmColor:null}),p(ie,"type",ie.register("ESUeViewer",c.ESGltfModel.type,ie));let ii=ie;const Kt=class Kt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Kt,"type",Kt.register("ESUeViewer",c.ESHeightMeasurement.type,Kt));let oi=Kt;const Gt=class Gt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=async(i,o,a,l)=>{const{viewer:d}=i;if(!d){console.error("AIMoveTo: ueViewer.viewer is undefined");return}const h=await d.callUeFunc({f:"AIMoveTo",p:{id:o,Destination:a,Time:l}});return h.error&&console.error("AIMoveTo:",h.error),h};this.d(A.aiMoveToEvent.don((i,o)=>{n(e,A.id,i,o)}));const s=async(i,o)=>{const{viewer:a}=i;if(!a){console.error("StopAIMove: ueViewer.viewer is undefined");return}const l=await a.callUeFunc({f:"StopAIMove",p:{id:o}});return l.error&&console.error("StopAIMove:",l.error),l};this.d(A.stopAIMoveEvent.don(()=>{s(e,A.id)}))}};p(Gt,"type",Gt.register("ESUeViewer",c.ESHuman.type,Gt));let ai=Gt;const oe=class oe extends QA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}A.anchor=[.5,1]}};p(oe,"type",oe.register("ESUeViewer",c.ESImageLabel.type,oe)),p(oe,"forceUeUpdateProps",[...QA.forceUeUpdateProps,"url"]),p(oe,"propValFuncs",{...QA.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(c.rpToap(A)):(A.url=c.ESSceneObject.context.getStrFromEnv(c.rpToap(A.url)),A)});let li=oe;const kt=class kt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(kt,"type",kt.register("ESUeViewer",c.ESLevelRuntimeModel.type,kt));let ci=kt;const Nt=class Nt extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Nt,"type",Nt.register("ESUeViewer",c.ESLocalCircle.type,Nt));let di=Nt;const _t=class _t extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(_t,"type",_t.register("ESUeViewer",c.ESLocalPolygonZ.type,_t));let ui=_t;const Vt=class Vt extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Vt,"type",Vt.register("ESUeViewer",c.ESLocalRectangle.type,Vt));let hi=Vt;const Ot=class Ot extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Ot,"type",Ot.register("ESUeViewer",c.ESLocalSkyBox.type,Ot));let gi=Ot;const Wt=class Wt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Wt,"type",Wt.register("ESUeViewer",c.ESLocationMeasurement.type,Wt));let Bi=Wt;const Xt=class Xt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Xt,"type",Xt.register("ESUeViewer",c.ESPipeFence.type,Xt));let fi=Xt;const Jt=class Jt extends Fn{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Jt,"type",Jt.register("ESUeViewer",c.ESPipeline.type,Jt));let wi=Jt;const zt=class zt extends yr{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.highlightFeatureEvent.don(n=>{const s=typeof n=="number"?n.toString():n;to(t,A.id,s)})),this.d(A.highlightFeatureAndFlyToEvent.don((n,s,i,o)=>{const a=typeof n=="number"?n.toString():n;ro(t,A.id,a,o??1)})),this.d(A.setLayerVisibleEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,no(t,A.id,i)})),this.d(A.setLayerColorEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,so(t,A.id,i)}))}};p(zt,"type",zt.register("ESUeViewer",c.ESPipeserTileset.type,zt));let pi=zt;const Yt=class Yt extends dA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Yt,"type",Yt.register("ESUeViewer",c.ESPit.type,Yt));let Ci=Yt;const $t=class $t extends QA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.ad(A.getInitialStyleEvent.don(async()=>{try{const n=await t.callUeFunc({f:"GetInitialStyle",p:{id:A.id}});n.error!=""&&console.error("getInitialStyleEvent:",n.error),A.initialStyle.value=structuredClone(n.re)}catch(n){console.error("getInitialStyleEvent:",n),A.initialStyle.value=void 0}}))}};p($t,"type",$t.register("ESUeViewer",c.ESPoi2D.type,$t));let vi=$t;const Zt=class Zt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Zt,"type",Zt.register("ESUeViewer",c.ESPoi3D.type,Zt));let mi=Zt;const ae=class ae extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ae,"type",ae.register("ESUeViewer",c.ESPoiTileset.type,ae)),p(ae,"forceUeUpdateProps",[...cA.forceUeUpdateProps,"url"]),p(ae,"propValFuncs",{...cA.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(A):(A.url=c.ESSceneObject.context.getStrFromEnv(A.url),A)});let Fi=ae;const qt=class qt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(qt,"type",qt.register("ESUeViewer",c.ESPolygonFence.type,qt));let Qi=qt;const De=class De extends dA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(De,"type",De.register("ESUeViewer",c.ESPolygonFlattenedPlane.type,De)),p(De,"propValFuncs",{...dA.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let Ui=De;const jt=class jt extends dA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(jt,"type",jt.register("ESUeViewer",c.ESPolygonWithHole.type,jt));let Ei=jt;const Ar=class Ar extends qA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(()=>{A.ids=[]}),this.d(A.highlightInner3DtilesetEvent.don(n=>{n.highlight=!0})),this.d(A.removeHighlightInner3DtilesetEvent.don(n=>{n.highlight=!1}));{const n=o=>{o=o.toLocaleLowerCase();let a=[255,255,255,1];if(o.startsWith("#")){if(o.length===4){let l=parseInt(o[1]+o[1],16),d=parseInt(o[2]+o[2],16),h=parseInt(o[3]+o[3],16);a=[l,d,h,1]}else if(o.length===7){let l=parseInt(o.substring(1,3),16),d=parseInt(o.substring(3,5),16),h=parseInt(o.substring(5,7),16);a=[l,d,h,1]}}else if(o.startsWith("rgba")){let l=o.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/);if(l){let d=parseInt(l[1]),h=parseInt(l[2]),u=parseInt(l[3]),f=parseFloat(l[4]);a=[d,h,u,f]}}else if(o.startsWith("rgb")){let l=o.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);if(l){let d=parseInt(l[1]),h=parseInt(l[2]),u=parseInt(l[3]);a=[d,h,u,1]}}else console.error("color类型只能为#rrggbb、#rgb、rgba(r,g,b,a)、rgb(r,g,b)");return[a[0]/255,a[1]/255,a[2]/255,a[3]]},s=()=>{const o=A.layerConfig;if(!o)return;const a=[];o.forEach(l=>{o.filter(h=>h.dataset==l.dataset).length==1?a.push({condition:[{field:"dataset",op:"==",value:l.dataset}],color:n(l.value.color??"rgb(255,255,255)"),show:l.value.visible}):a.push({condition:[{field:"layer",op:"==",value:l.layer},{field:"dataset",op:"==",value:l.dataset}],color:n(l.value.color??"rgb(255,255,255)"),show:l.value.visible})}),A.setFeatureStyle(a)};s();const i=this.dv(c.createNextAnimateFrameEvent(A.layerConfigChanged,A.colorBlendModeChanged));this.d(i.don(()=>{s()}))}}};p(Ar,"type",Ar.register("ESUeViewer",c.ESRtsTileset.type,Ar));let yi=Ar;const er=class er extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(A.addTreesEvent.don(n=>{c.addTreesCallFunc(e,A.id,n)})),this.d(A.removeAllTreesEvent.don(()=>{c.removeAllTreesCallFunc(e,A.id)})),this.d(A.updateTreeParamsEvent.don(n=>{c.updateTreeParamsCallFunc(e,A.id,n)})),this.d(A.cutDownTreesEvent.don((n,s)=>{c.cutDownTreesCallFunc(e,A.id,n,s)})),this.d(A.growthSimulationEvent.don((n,s,i)=>{c.growthSimulationCallFunc(e,A.id,n,s,i)}))}};p(er,"type",er.register("ESUeViewer",c.ESSeparateFoliage.type,er));let Si=er;const tr=class tr extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(tr,"type",tr.register("ESUeViewer",c.ESSubmergingAnalysis.type,tr));let Ii=tr;const rr=class rr extends dA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.stopEvent.don(()=>{t.callUeFunc({f:"Stop",p:{id:A.id}})}))}};p(rr,"type",rr.register("ESUeViewer",c.ESSunshineAnalysis.type,rr));let Ti=rr;const nr=class nr extends dA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})}))}};p(nr,"type",nr.register("ESUeViewer",c.ESSurfaceAreaMeasurement.type,nr));let Hi=nr;const sr=class sr extends QA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(sr,"type",sr.register("ESUeViewer",c.ESTextLabel.type,sr));let Li=sr;const Re=class Re extends QA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.callFunctionEvent.don(async(n,s)=>{const i=await yn(t,A.id,n,s);A.__callFunctionResultEvent.emit(i)}))}};p(Re,"type",Re.register("ESUeViewer",c.ESUEWidget.type,Re)),p(Re,"propValFuncs",{...QA.propValFuncs,info:A=>JSON.stringify(A??{})});let bi=Re;const id=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"未搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag但对应的Actor不是场景原有的,而是新建的,无法绑定";case 4:return"搜索到ActorTag对应的Actor是地形或3DTileset,无法绑定";default:return"未知错误"}},$w=r=>{switch(r){case 0:return"创建成功";case 1:return"未找到对应的资源,无法创建";case 2:return"Id与场景中现有的ActorTag重复,创建后可能出现问题,创建失败";default:return"未知错误"}},ir=class ir extends c.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn(`${A.id} UeESUnrealActor viewer is undefined!`);return}this.d(()=>{Un(t,A.id)});const n=async()=>{l()||await t.callUeFunc({f:"update",p:{id:A.id,name:A.name,show:A.show,rotation:A.rotation,flyToParam:A.flyToParam??c.ESUnrealActor.defaultFlyToParam,flyInParam:A.flyInParam??c.ESUnrealActor.defaultFlyInParam,highlight:A.highlight,collision:A.collision,scale:A.scale,minVisibleDistance:A.minVisibleDistance,maxVisibleDistance:A.maxVisibleDistance}})},s=this.dv(c.createNextAnimateFrameEvent(A.showChanged,A.nameChanged,A.rotationChanged,A.flyToParamChanged,A.flyInParamChanged,A.highlightChanged,A.collisionChanged,A.scaleChanged,A.minVisibleDistanceChanged,A.maxVisibleDistanceChanged));this.d(s.don(n)),this.d(A.flushEvent.don(()=>s.flush()));let i,o;const a=async()=>{l()||(await t.callUeFunc({f:"update",p:{id:A.id,position:A.position}}),(e.debug??!1)&&console.log(`updatePostion:${A.position},actorTag:${A.actorTag},actorClass:${A.actorClass}`))},l=()=>!i&&!o?(console.warn(`${A.id} 未绑定ActorTag或未创建ActorClass!`),!0):!1,d=async()=>{const{id:u}=A,f=await e.unBindActorByID(u);f&&f.error!==""&&console.warn(`${A.id} UeESUnrealActor UnBindActorByID: ${f.error}`),i=void 0;const B=await t.callUeFunc({f:"destroy",p:{id:u}});if(B&&B.error!==""){console.warn(`${A.id} UeESUnrealActor DestroyActorByID: ${B.error}`);return}o=void 0},h=this.dv(c.react({type:"ActorClass",actorClass:"default"}));{const u=this.dv(c.createNextAnimateFrameEvent(A.actorClassChanged,A.actorTagChanged)),f=async()=>{A.actorTag!==""?h.value={type:"ActorTag",actorTag:A.actorTag}:h.value={type:"ActorClass",actorClass:A.actorClass===""?"default":A.actorClass}};f(),this.d(u.don(f)),this.d(A.flushEvent.don(()=>u.flush()))}{const u=this.dv(c.createProcessingFromAsyncFunc(async B=>{if(await B.promise(d()),A.lastActorStatus="null",h.value.type==="ActorTag"){const{actorTag:w}=h.value;try{const v=await B.promise(e.bindActorByTag(A.id,w));if(!v)return;if(v.error!==""){console.warn(`${A.id} UeESUnrealActor BindActorByTag:${w},${v.error}`);return}if(v.re.type===0)A.lastActorStatus="bound",i=w;else if(v.re.type===1)A.lastActorStatus="bound",i=w,console.warn(`${A.id} UeESUnrealActor BindActorByTag:${w},${id(v.re.type)}`);else{i=void 0,console.warn(`${A.id} UeESUnrealActor BindActorByTag error:${w}, ${id(v.re.type)}`);return}}catch(v){console.warn(`${A.id} UeESUnrealActor BindActorByTag catch error:${w}, ${v}`);return}}else if(h.value.type==="ActorClass"){const{actorClass:w}=h.value;try{const v=await B.promise(e.createActorByClass(A.id,w));if(!v)return;if(v.error!==""){console.warn(`${A.id} UeESUnrealActor CreateActorByClass error :${w}, ${v.error}`);return}if(v.re.type===0)w!=="default"&&(A.lastActorStatus="created"),o=w;else{console.warn(`${A.id} UeESUnrealActor CreateActorByClass error type :${w},${$w(v.re.type)}`);return}}catch(v){console.warn(`${A.id} UeESUnrealActor CreateActorByClass error catch :${w}, ${JSON.stringify(v)}`);return}}await B.promise(n()),await B.promise(a())})),f=async()=>{u.restart()};f(),this.d(h.changed.don(f))}this.d(A.positionChanged.don(a)),this.d(A.callFunctionEvent.don(async(u,f)=>{if(l()){A.__callFunctionResultEvent.emit(void 0);return}const B=await yn(t,A.id,u,f);A.__callFunctionResultEvent.emit(B)})),this.d(A.smoothMoveEvent.don((u,f)=>{l()||_e(t,A.id,u,f)})),this.d(A.smoothMoveWithRotationEvent.don((u,f,B)=>{l()||Ge(t,A.id,u,f,B)})),this.d(A.smoothMoveOnGroundEvent.don((u,f,B,w)=>{l()||ke(t,A.id,u,f,w,B)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((u,f,B,w,v)=>{l()||Ne(t,A.id,u,f,B,w,v)})),this.d(A.automaticLandingEvent.don(u=>{if(l())return;const f=[A.position[0],A.position[1]];e.getHeightByLonLat(A.position[0],A.position[1],"Visibility").then(B=>{B!==null&&(A.position=[...f,B],A.collision=u)})})),this.d(A.flyToEvent.don(async(u,f)=>{if(l())return;const B=await Be(t,A.id,u);let w="over";B===void 0?w="error":B.endType===0?w="over":B.endType===1&&(w="cancelled"),A.flyOverEvent.emit(f,w,e)})),this.d(A.calcFlyToParamEvent.don(()=>{l()||YA(t,A.id)})),this.d(A.calcFlyInParamEvent.don(async()=>{if(!e.actived)return;const u=await e.getCurrentCameraInfo();if(!u)return;const{position:f,rotation:B}=u;A.flyInParam={position:f,rotation:B,flyDuration:1}})),this.d(e.propChanged.don(u=>{l()||u.objId===A.id&&Object.keys(u.props).forEach(f=>{const B=u.props[f]===null?void 0:u.props[f];A[f]=B})}))}};p(ir,"type",ir.register("ESUeViewer",c.ESUnrealActor.type,ir));let Mi=ir;const or=class or extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(or,"type",or.register("ESUeViewer",c.ESVideoFusion.type,or));let Di=or;const ar=class ar extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ar,"type",ar.register("ESUeViewer",c.ESViewShed.type,ar));let Ri=ar;const lr=class lr extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};p(lr,"type",lr.register("ESUeViewer",c.ESVisibilityAnalysis.type,lr));let xi=lr;const cr=class cr extends dA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.ad(c.track([A,"volume"],[A,"cutAndFillVolume"])),this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.clearEvent.don(()=>{t.callUeFunc({f:"Clear",p:{id:A.id}})}))}};p(cr,"type",cr.register("ESUeViewer",c.ESVolumeMeasurement.type,cr));let Pi=cr;const xe=class xe extends QA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(xe,"type",xe.register("ESUeViewer",c.ESWidget.type,xe)),p(xe,"propValFuncs",{...QA.propValFuncs,info:A=>JSON.stringify(A??{})});let Ki=xe;const dr=class dr extends c.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}A.poi.actorTag=A.human.id,A.poi.positionOffset=[0,0,A.poiOffsetHeight-.8],this.d(A.poiOffsetHeightChanged.don(()=>{A.poi.positionOffset=[0,0,A.poiOffsetHeight-.8]})),this.d(()=>{A.poi.actorTag=""})}};p(dr,"type",dr.register("ESUeViewer",c.ESHumanPoi.type,dr));let Gi=dr;c.ESSceneObject.context.getStrFromEnv(c.ESNavigator.defaults.imgUrl);const ur=class ur extends c.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=this.disposeVar(new c.ESCustomDiv);e.add(n),this.dispose(()=>e.delete(n)),this.dispose(c.track([n,"show"],[A,"show"])),n.instanceClass=class extends c.Destroyable{constructor(i,o,a){super(),this._subContainer=i;const l=document.createElement("div");this._subContainer.appendChild(l),this.dispose(()=>this._subContainer.removeChild(l));{const u=async()=>{const f=await e.getCurrentCameraInfo(),B=f==null?void 0:f.position,v=[...f==null?void 0:f.rotation];v[0]=360,e.flyIn(B,v)};l.addEventListener("click",u),l.style.cursor="pointer",this.dispose(()=>l.removeEventListener("click",u))}{const u=()=>{l.style.width=`${A.cssSize?A.cssSize:c.ESNavigator.defaults.cssSize}px`,l.style.height=`${A.cssSize?A.cssSize:c.ESNavigator.defaults.cssSize}px`};u(),A.dispose(A.cssSizeChanged.disposableOn(u))}l.style.position="fixed";{const u=()=>{l.style.top=`${A.cssPosition?A.cssPosition[0]:c.ESNavigator.defaults.cssPosition[0]}px`,l.style.right=`${A.cssPosition?A.cssPosition[1]:c.ESNavigator.defaults.cssPosition[1]}px`};u(),A.dispose(A.cssPositionChanged.disposableOn(u))}l.style.transition=" right 0.4s linear",l.style.cursor="pointer";const d=document.createElement("div");l.appendChild(d),this.dispose(()=>l.removeChild(d)),d.style.width="100%",d.style.height="100%",d.style.position="relative";const h=document.createElement("img");d.appendChild(h),this.dispose(()=>d.removeChild(h)),h.style.width="100%",h.style.height="100%",h.style.border="none";{const u=()=>h.src=A.imgUrl;u(),A.dispose(A.imgUrlChanged.disposableOn(u))}{const u=()=>{const v=-e.getCurrentCameraInfo().rotation[0];h.style.transform=`rotate(${v}deg)`};let f;const B=async()=>{u(),A.show?(l.style.display="block",f=setInterval(()=>{u()},1e3)):(l.style.display="none",clearInterval(f))};this.dispose(A.showChanged.disposableOn(B)),B(),this.dispose(()=>clearInterval(f))}h.style.transformOrigin="50% 50%"}}}};p(ur,"type",ur.register("ESUeViewer",c.ESNavigator.type,ur));let ki=ur;const le=class le extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}{const n=()=>{t.callUeFunc({f:"update",p:{id:A.id,materialMode:A.materialMode}})};this.dispose(A.materialModeChanged.disposableOn(n))}}};p(le,"type",le.register("ESUeViewer",c.ESPath.type,le)),p(le,"forceUeUpdateProps",[...rA.forceUeUpdateProps]),p(le,"propValFuncs",{...rA.propValFuncs});let Ni=le;async function Zw(r){navigator.clipboard.writeText(r).then(function(){console.log("复制成功")},function(A){console.log("复制失败")})}const hr=class hr extends c.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=this.disposeVar(new c.ESCustomDiv);e.add(n),this.dispose(()=>e.delete(n)),n.instanceClass=class extends c.Destroyable{constructor(i,o,a){if(super(),this._subContainer=i,!a||!(a instanceof LA))return;const l=document.createElement("div");this._subContainer.appendChild(l),this.dispose(()=>this._subContainer.removeChild(l)),l.style.width="100%",l.style.position="absolute",l.style.height=`${c.ESViewerStatusBar.defaults.height}px`,l.style.left="0",l.style.bottom="0",l.style.color="#fff",l.style.padding="0 20px 0 0",l.style.boxSizing="border-box",l.style.lineHeight=`${c.ESViewerStatusBar.defaults.height}px`,l.style.zIndex="100",l.style.alignContent="center",l.style.justifyContent="space-between";const d=document.createElement("span");l.appendChild(d),this.dispose(()=>l.removeChild(d));const h=document.createElement("span");d.appendChild(h),this.dispose(()=>d.removeChild(h));const u=document.createElement("span");d.appendChild(u),u.addEventListener("dblclick",function(){let B=u.innerHTML;B.startsWith("鼠标位置")&&(B=B.slice(5)),Zw(B)}),u.style.cursor="pointer",this.dispose(()=>d.removeChild(u));const f=document.createElement("span");l.appendChild(f),this.dispose(()=>l.removeChild(f));{const B=()=>{l.style.height=(A.height??c.ESViewerStatusBar.defaults.height)+"px",l.style.lineHeight=(A.height??c.ESViewerStatusBar.defaults.height)+"px"};this.dispose(A.heightChanged.disposableOn(B)),B()}{const B=()=>{l.style.fontSize=(A.fontSize??c.ESViewerStatusBar.defaults.fontSize)+"px"};this.dispose(A.fontSizeChanged.disposableOn(B)),B()}{const B=()=>{A.bgColor?l.style.background=`rgba(${A.bgColor[0]*255},${A.bgColor[1]*255},${A.bgColor[2]*255},${A.bgColor[3]})`:l.style.background=`rgba(${c.ESViewerStatusBar.defaults.bgColor[0]},${c.ESViewerStatusBar.defaults.bgColor[1]},${c.ESViewerStatusBar.defaults.bgColor[2]},${c.ESViewerStatusBar.defaults.bgColor[3]})`};this.dispose(A.bgColorChanged.disposableOn(B)),B()}a.getVersion().then(B=>{B&&(f.innerText=`Ue 版本 : ${B[0]} `)}).catch(B=>{console.log(B)});{const B=()=>{let m="",F="";m+=`帧率:${a.getFPS().toFixed(0)}FPS`,h.innerText=m;const E=e.getCurrentCameraInfo();m+=` 经度: ${E.position[0].toFixed(5)}° 纬度: ${E.position[1].toFixed(5)}° 高度: ${E.position[2].toFixed(2)}米 偏航角: ${E.rotation[0].toFixed(2)}° 俯仰角: ${E.rotation[1].toFixed(2)}° 翻滚角:${E.rotation[2].toFixed(2)}° `,h.innerText=m,e.pick().then(H=>{if(H){const{pickResult:S}=H;if(S&&S.position){const{position:U}=S;F+=`鼠标位置:${U[0].toFixed(5)}° ${U[1].toFixed(5)}° ${U[2].toFixed(2)}m`}else F+="暂时无法获取鼠标位置...";u.innerText=F}}).catch(H=>{console.log(H)})};let w;const v=async()=>{B(),A.show?(l.style.display="flex",w=setInterval(()=>{B()},1e3)):(l.style.display="none",clearInterval(w))};this.dispose(A.showChanged.disposableOn(v)),v(),this.dispose(()=>clearInterval(w))}}}}};p(hr,"type",hr.register("ESUeViewer",c.ESViewerStatusBar.type,hr));let _i=hr;const gr=class gr extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(gr,"type",gr.register("ESUeViewer",c.ESGaussianSplatting.type,gr));let Vi=gr;const Br=class Br extends qA{constructor(e,t){super(e,t);p(this,"_es3DTileset",this.dv(new c.ES3DTileset));if(!t.viewer){console.warn("viewer is undefined!");return}this.es3DTileset.parentID=e.id;{const s=this._es3DTileset;e.components.disposableAdd(s,!0),this.d(c.track([s,"allowPicking"],[e,"allowPicking"])),this.d(c.track([s,"collision"],[e,"collision"])),this.d(c.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(c.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(c.track([s,"url"],[e,"url"])),this.d(c.track([s,"actorTag"],[e,"actorTag"])),this.d(c.track([s,"materialMode"],[e,"materialMode"])),this.d(c.track([s,"highlight"],[e,"highlight"])),this.d(c.track([s,"maximumScreenSpaceError"],[e,"maximumScreenSpaceError"])),this.d(c.track([s,"highlightID"],[e,"highlightID"])),this.d(c.track([s,"highlightColor"],[e,"highlightColor"])),this.d(c.bind([s,"offset"],[e,"offset"])),this.d(c.bind([s,"rotation"],[e,"rotation"])),this.d(c.track([s,"czmImageBasedLightingFactor"],[e,"czmImageBasedLightingFactor"])),this.d(c.track([s,"czmLuminanceAtZenith"],[e,"czmLuminanceAtZenith"])),this.d(c.track([s,"czmMaximumMemoryUsage"],[e,"czmMaximumMemoryUsage"])),this.d(c.track([s,"czmClassificationType"],[e,"czmClassificationType"])),this.d(c.track([s,"czmStyleJson"],[e,"czmStyleJson"])),this.d(c.track([s,"czmBackFaceCulling"],[e,"czmBackFaceCulling"])),this.d(c.track([s,"czmDebugShowBoundingVolume"],[e,"czmDebugShowBoundingVolume"])),this.d(c.track([s,"czmDebugShowContentBoundingVolume"],[e,"czmDebugShowContentBoundingVolume"])),this.d(c.track([s,"colorBlendMode"],[e,"colorBlendMode"])),this.d(c.track([s,"cacheBytes"],[e,"cacheBytes"])),this.d(c.track([s,"clippingPlaneEnabled"],[e,"clippingPlaneEnabled"])),this.d(c.track([s,"unionClippingRegions"],[e,"unionClippingRegions"])),this.d(c.track([s,"clippingPlaneEdgeColor"],[e,"clippingPlaneEdgeColor"])),this.d(c.track([s,"clippingPlaneEdgeWidth"],[e,"clippingPlaneEdgeWidth"])),this.d(c.track([s,"materialParams"],[e,"materialParams"])),this.d(c.bind([s,"supportEdit"],[e,"supportEdit"])),this.d(c.bind([s,"clippingPlanesId"],[e,"clippingPlanesId"])),this.d(c.bind([s,"clippingPlaneIds"],[e,"clippingPlaneIds"])),this.d(c.bind([s,"flattenedPlaneId"],[e,"flattenedPlaneId"])),this.d(c.bind([s,"flattenedPlaneEnabled"],[e,"flattenedPlaneEnabled"])),this.d(c.bind([s,"clippingPlaneId"],[e,"clippingPlaneId"])),this.d(c.bind([s,"excavateId"],[e,"excavateId"]))}{const s=this._es3DTileset;this.d(e.refreshTilesetEvent.don(()=>{s.refreshTileset()})),this.d(e.highlightFeatureEvent.don((...i)=>{s.highlightFeature(...i)})),this.d(e.highlightFeatureAndFlyToEvent.don((...i)=>{s.highlightFeatureAndFlyTo(...i)})),this.d(e.setFeatureColorEvent.don((...i)=>{s.setFeatureColor(...i)})),this.d(e.setFeatureVisableEvent.don((...i)=>{s.setFeatureVisable(...i)})),this.d(e.resetFeatureStyleEvent.don((...i)=>{s.resetFeatureStyle(...i)})),this.d(e.flyInEvent.don((...i)=>{s.flyIn(i[0])})),this.d(e.flyToEvent.don((...i)=>{s.flyTo(i[0])})),this.d(e.calcFlyToParamEvent.don((...i)=>{s.calcFlyToParam(...i)})),this.d(e.calcFlyInParamEvent.don((...i)=>{s.calcFlyInParam(...i)}))}{const s=this._es3DTileset;this.d(s.tilesetReady.don(i=>{e.tilesetReady.emit(i)})),this.d(s.pickedEvent.don(i=>{i.assign({sceneObject:e}),e.pickedEvent.emit(i)}))}{const s=()=>{this.es3DTileset.show=e.show};s(),this.d(e.showChanged.don(()=>{s()}))}}get es3DTileset(){return this._es3DTileset}};p(Br,"type",Br.register("ESUeViewer",c.ESRtsFeatureEditing.type,Br));let Oi=Br;const fr=class fr extends qA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(fr,"type",fr.register("ESUeViewer",c.ESMsTileset.type,fr));let Wi=fr;const wr=class wr extends dA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{t.callUeFunc({f:"update",p:{id:A.id,height:A.height??c.ESGeoExtrudedPolygon.defaults.height,extrudedHeight:A.extrudedHeight??c.ESGeoExtrudedPolygon.defaults.extrudedHeight,perPositionHeight:A.perPositionHeight??c.ESGeoExtrudedPolygon.defaults.perPositionHeight}})},s=this.disposeVar(c.createNextAnimateFrameEvent(A.heightChanged,A.extrudedHeightChanged,A.perPositionHeightChanged));this.dispose(s.disposableOn(n)),this.dispose(A.createdEvent.disposableOn(n))}};p(wr,"type",wr.register("ESUeViewer",c.ESGeoExtrudedPolygon.type,wr));let Xi=wr;const pr=class pr extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(pr,"type",pr.register("ESUeViewer",c.ESStaticMesh.type,pr));let Ji=pr;const Cr=class Cr extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.clearEvent.don(()=>{t.callUeFunc({f:"Clear",p:{id:A.id}})}))}};p(Cr,"type",Cr.register("ESUeViewer",c.ESSkylineAnalysis.type,Cr));let zi=Cr;C.copyright=void 0;try{const r="earthsdk3-ue",A="3.5.0-beta.13",e="2025-10-15T08:26:43.000Z",t="北京西部世界科技有限公司",n="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",s="d85e1020200203ea0aca1c05ac3f93f1f4e4574e",o=((Date.now()-1760516803e3)/36e5).toFixed(1),a=`%c🌏 ${r}%c ${A}.${s.slice(0,8)}.${e} (距今${o}个小时)
|
|
112
|
+
.`+Zs+lw+Jc)},dw=function(r,A){var e=r.ownerDocument;if(e){var t=e.createElement("style");t.textContent=A,r.appendChild(t)}},zc=function(){function r(){}return r.getOrigin=function(A){var e=r._link;return e?(e.href=A,e.href=e.href,e.protocol+e.hostname+e.port):"about:blank"},r.isSameOrigin=function(A){return r.getOrigin(A)===r._origin},r.setContext=function(A){r._link=A.document.createElement("a"),r._origin=r.getOrigin(A.location.href)},r._origin="about:blank",r}(),uw=function(){function r(A,e){this.context=A,this._options=e,this._cache={}}return r.prototype.addImage=function(A){var e=Promise.resolve();return this.has(A)||(js(A)||fw(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),e},r.prototype.match=function(A){return this._cache[A]},r.prototype.loadImage=function(A){return uA(this,void 0,void 0,function(){var e,t,n,s,i=this;return nA(this,function(o){switch(o.label){case 0:return e=zc.isSameOrigin(A),t=!qs(A)&&this._options.useCORS===!0&&tA.SUPPORT_CORS_IMAGES&&!e,n=!qs(A)&&!e&&!js(A)&&typeof this._options.proxy=="string"&&tA.SUPPORT_CORS_XHR&&!t,!e&&this._options.allowTaint===!1&&!qs(A)&&!js(A)&&!n&&!t?[2]:(s=A,n?[4,this.proxy(s)]:[3,2]);case 1:s=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(a,l){var d=new Image;d.onload=function(){return a(d)},d.onerror=l,(ww(s)||t)&&(d.crossOrigin="anonymous"),d.src=s,d.complete===!0&&setTimeout(function(){return a(d)},500),i._options.imageTimeout>0&&setTimeout(function(){return l("Timed out ("+i._options.imageTimeout+"ms) loading image")},i._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},r.prototype.has=function(A){return typeof this._cache[A]<"u"},r.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},r.prototype.proxy=function(A){var e=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=A.substring(0,256);return new Promise(function(s,i){var o=tA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(o==="text")s(a.response);else{var h=new FileReader;h.addEventListener("load",function(){return s(h.result)},!1),h.addEventListener("error",function(u){return i(u)},!1),h.readAsDataURL(a.response)}else i("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=i;var l=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+l+"url="+encodeURIComponent(A)+"&responseType="+o),o!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=o),e._options.imageTimeout){var d=e._options.imageTimeout;a.timeout=d,a.ontimeout=function(){return i("Timed out ("+d+"ms) proxying "+n)}}a.send()})},r}(),hw=/^data:image\/svg\+xml/i,gw=/^data:image\/.*;base64,/i,Bw=/^data:image\/.*/i,fw=function(r){return tA.SUPPORT_SVG_DRAWING||!pw(r)},qs=function(r){return Bw.test(r)},ww=function(r){return gw.test(r)},js=function(r){return r.substr(0,4)==="blob"},pw=function(r){return r.substr(-3).toLowerCase()==="svg"||hw.test(r)},y=function(){function r(A,e){this.type=0,this.x=A,this.y=e}return r.prototype.add=function(A,e){return new r(this.x+A,this.y+e)},r}(),Ie=function(r,A,e){return new y(r.x+(A.x-r.x)*e,r.y+(A.y-r.y)*e)},Bn=function(){function r(A,e,t,n){this.type=1,this.start=A,this.startControl=e,this.endControl=t,this.end=n}return r.prototype.subdivide=function(A,e){var t=Ie(this.start,this.startControl,A),n=Ie(this.startControl,this.endControl,A),s=Ie(this.endControl,this.end,A),i=Ie(t,n,A),o=Ie(n,s,A),a=Ie(i,o,A);return e?new r(this.start,t,i,a):new r(a,o,s,this.end)},r.prototype.add=function(A,e){return new r(this.start.add(A,e),this.startControl.add(A,e),this.endControl.add(A,e),this.end.add(A,e))},r.prototype.reverse=function(){return new r(this.end,this.endControl,this.startControl,this.start)},r}(),pA=function(r){return r.type===1},Cw=function(){function r(A){var e=A.styles,t=A.bounds,n=st(e.borderTopLeftRadius,t.width,t.height),s=n[0],i=n[1],o=st(e.borderTopRightRadius,t.width,t.height),a=o[0],l=o[1],d=st(e.borderBottomRightRadius,t.width,t.height),h=d[0],u=d[1],f=st(e.borderBottomLeftRadius,t.width,t.height),B=f[0],w=f[1],v=[];v.push((s+a)/t.width),v.push((B+h)/t.width),v.push((i+w)/t.height),v.push((l+u)/t.height);var m=Math.max.apply(Math,v);m>1&&(s/=m,i/=m,a/=m,l/=m,h/=m,u/=m,B/=m,w/=m);var F=t.width-a,E=t.height-u,H=t.width-h,S=t.height-w,U=e.borderTopWidth,D=e.borderRightWidth,R=e.borderBottomWidth,M=e.borderLeftWidth,O=N(e.paddingTop,A.bounds.width),iA=N(e.paddingRight,A.bounds.width),Y=N(e.paddingBottom,A.bounds.width),G=N(e.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||i>0?V(t.left+M/3,t.top+U/3,s-M/3,i-U/3,K.TOP_LEFT):new y(t.left+M/3,t.top+U/3),this.topRightBorderDoubleOuterBox=s>0||i>0?V(t.left+F,t.top+U/3,a-D/3,l-U/3,K.TOP_RIGHT):new y(t.left+t.width-D/3,t.top+U/3),this.bottomRightBorderDoubleOuterBox=h>0||u>0?V(t.left+H,t.top+E,h-D/3,u-R/3,K.BOTTOM_RIGHT):new y(t.left+t.width-D/3,t.top+t.height-R/3),this.bottomLeftBorderDoubleOuterBox=B>0||w>0?V(t.left+M/3,t.top+S,B-M/3,w-R/3,K.BOTTOM_LEFT):new y(t.left+M/3,t.top+t.height-R/3),this.topLeftBorderDoubleInnerBox=s>0||i>0?V(t.left+M*2/3,t.top+U*2/3,s-M*2/3,i-U*2/3,K.TOP_LEFT):new y(t.left+M*2/3,t.top+U*2/3),this.topRightBorderDoubleInnerBox=s>0||i>0?V(t.left+F,t.top+U*2/3,a-D*2/3,l-U*2/3,K.TOP_RIGHT):new y(t.left+t.width-D*2/3,t.top+U*2/3),this.bottomRightBorderDoubleInnerBox=h>0||u>0?V(t.left+H,t.top+E,h-D*2/3,u-R*2/3,K.BOTTOM_RIGHT):new y(t.left+t.width-D*2/3,t.top+t.height-R*2/3),this.bottomLeftBorderDoubleInnerBox=B>0||w>0?V(t.left+M*2/3,t.top+S,B-M*2/3,w-R*2/3,K.BOTTOM_LEFT):new y(t.left+M*2/3,t.top+t.height-R*2/3),this.topLeftBorderStroke=s>0||i>0?V(t.left+M/2,t.top+U/2,s-M/2,i-U/2,K.TOP_LEFT):new y(t.left+M/2,t.top+U/2),this.topRightBorderStroke=s>0||i>0?V(t.left+F,t.top+U/2,a-D/2,l-U/2,K.TOP_RIGHT):new y(t.left+t.width-D/2,t.top+U/2),this.bottomRightBorderStroke=h>0||u>0?V(t.left+H,t.top+E,h-D/2,u-R/2,K.BOTTOM_RIGHT):new y(t.left+t.width-D/2,t.top+t.height-R/2),this.bottomLeftBorderStroke=B>0||w>0?V(t.left+M/2,t.top+S,B-M/2,w-R/2,K.BOTTOM_LEFT):new y(t.left+M/2,t.top+t.height-R/2),this.topLeftBorderBox=s>0||i>0?V(t.left,t.top,s,i,K.TOP_LEFT):new y(t.left,t.top),this.topRightBorderBox=a>0||l>0?V(t.left+F,t.top,a,l,K.TOP_RIGHT):new y(t.left+t.width,t.top),this.bottomRightBorderBox=h>0||u>0?V(t.left+H,t.top+E,h,u,K.BOTTOM_RIGHT):new y(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=B>0||w>0?V(t.left,t.top+S,B,w,K.BOTTOM_LEFT):new y(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||i>0?V(t.left+M,t.top+U,Math.max(0,s-M),Math.max(0,i-U),K.TOP_LEFT):new y(t.left+M,t.top+U),this.topRightPaddingBox=a>0||l>0?V(t.left+Math.min(F,t.width-D),t.top+U,F>t.width+D?0:Math.max(0,a-D),Math.max(0,l-U),K.TOP_RIGHT):new y(t.left+t.width-D,t.top+U),this.bottomRightPaddingBox=h>0||u>0?V(t.left+Math.min(H,t.width-M),t.top+Math.min(E,t.height-R),Math.max(0,h-D),Math.max(0,u-R),K.BOTTOM_RIGHT):new y(t.left+t.width-D,t.top+t.height-R),this.bottomLeftPaddingBox=B>0||w>0?V(t.left+M,t.top+Math.min(S,t.height-R),Math.max(0,B-M),Math.max(0,w-R),K.BOTTOM_LEFT):new y(t.left+M,t.top+t.height-R),this.topLeftContentBox=s>0||i>0?V(t.left+M+G,t.top+U+O,Math.max(0,s-(M+G)),Math.max(0,i-(U+O)),K.TOP_LEFT):new y(t.left+M+G,t.top+U+O),this.topRightContentBox=a>0||l>0?V(t.left+Math.min(F,t.width+M+G),t.top+U+O,F>t.width+M+G?0:a-M+G,l-(U+O),K.TOP_RIGHT):new y(t.left+t.width-(D+iA),t.top+U+O),this.bottomRightContentBox=h>0||u>0?V(t.left+Math.min(H,t.width-(M+G)),t.top+Math.min(E,t.height+U+O),Math.max(0,h-(D+iA)),u-(R+Y),K.BOTTOM_RIGHT):new y(t.left+t.width-(D+iA),t.top+t.height-(R+Y)),this.bottomLeftContentBox=B>0||w>0?V(t.left+M+G,t.top+S,Math.max(0,B-(M+G)),w-(R+Y),K.BOTTOM_LEFT):new y(t.left+M+G,t.top+t.height-(R+Y))}return r}(),K;(function(r){r[r.TOP_LEFT=0]="TOP_LEFT",r[r.TOP_RIGHT=1]="TOP_RIGHT",r[r.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",r[r.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(K||(K={}));var V=function(r,A,e,t,n){var s=4*((Math.sqrt(2)-1)/3),i=e*s,o=t*s,a=r+e,l=A+t;switch(n){case K.TOP_LEFT:return new Bn(new y(r,l),new y(r,l-o),new y(a-i,A),new y(a,A));case K.TOP_RIGHT:return new Bn(new y(r,A),new y(r+i,A),new y(a,l-o),new y(a,l));case K.BOTTOM_RIGHT:return new Bn(new y(a,A),new y(a,A+o),new y(r+i,l),new y(r,l));case K.BOTTOM_LEFT:default:return new Bn(new y(a,l),new y(a-i,l),new y(r,A+o),new y(r,A))}},fn=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},vw=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},wn=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},mw=function(){function r(A,e,t){this.offsetX=A,this.offsetY=e,this.matrix=t,this.type=0,this.target=6}return r}(),pn=function(){function r(A,e){this.path=A,this.target=e,this.type=1}return r}(),Fw=function(){function r(A){this.opacity=A,this.type=2,this.target=6}return r}(),Qw=function(r){return r.type===0},Yc=function(r){return r.type===1},Uw=function(r){return r.type===2},$c=function(r,A){return r.length===A.length?r.some(function(e,t){return e===A[t]}):!1},Ew=function(r,A,e,t,n){return r.map(function(s,i){switch(i){case 0:return s.add(A,e);case 1:return s.add(A+t,e);case 2:return s.add(A+t,e+n);case 3:return s.add(A,e+n)}return s})},Zc=function(){function r(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r}(),qc=function(){function r(A,e){if(this.container=A,this.parent=e,this.effects=[],this.curves=new Cw(this.container),this.container.styles.opacity<1&&this.effects.push(new Fw(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new mw(t,n,s))}if(this.container.styles.overflowX!==0){var i=fn(this.curves),o=wn(this.curves);$c(i,o)?this.effects.push(new pn(i,6)):(this.effects.push(new pn(i,2)),this.effects.push(new pn(o,4)))}}return r.prototype.getEffects=function(A){for(var e=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Yc(a)});if(e||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),e=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var i=fn(t.curves),o=wn(t.curves);$c(i,o)||n.unshift(new pn(o,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return Z(a.target,A)})},r}(),Ai=function(r,A,e,t){r.container.elements.forEach(function(n){var s=Z(n.flags,4),i=Z(n.flags,2),o=new qc(n,r);Z(n.styles.display,2048)&&t.push(o);var a=Z(n.flags,8)?[]:t;if(s||i){var l=s||n.styles.isPositioned()?e:A,d=new Zc(o);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var u=0;l.negativeZIndex.some(function(B,w){return h>B.element.container.styles.zIndex.order?(u=w,!1):u>0}),l.negativeZIndex.splice(u,0,d)}else if(h>0){var f=0;l.positiveZIndex.some(function(B,w){return h>=B.element.container.styles.zIndex.order?(f=w+1,!1):f>0}),l.positiveZIndex.splice(f,0,d)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(d)}else n.styles.isFloating()?l.nonPositionedFloats.push(d):l.nonPositionedInlineLevel.push(d);Ai(o,d,s?d:e,a)}else n.styles.isInlineLevel()?A.inlineLevel.push(o):A.nonInlineLevel.push(o),Ai(o,A,e,a);Z(n.flags,8)&&jc(n,a)})},jc=function(r,A){for(var e=r instanceof Vs?r.start:1,t=r instanceof Vs?r.reversed:!1,n=0;n<A.length;n++){var s=A[n];s.container instanceof Uc&&typeof s.container.value=="number"&&s.container.value!==0&&(e=s.container.value),s.listValue=dt(e,s.container.styles.listStyleType,!0),e+=t?-1:1}},yw=function(r){var A=new qc(r,null),e=new Zc(A),t=[];return Ai(A,e,e,t),jc(A.container,t),e},Ad=function(r,A){switch(A){case 0:return CA(r.topLeftBorderBox,r.topLeftPaddingBox,r.topRightBorderBox,r.topRightPaddingBox);case 1:return CA(r.topRightBorderBox,r.topRightPaddingBox,r.bottomRightBorderBox,r.bottomRightPaddingBox);case 2:return CA(r.bottomRightBorderBox,r.bottomRightPaddingBox,r.bottomLeftBorderBox,r.bottomLeftPaddingBox);case 3:default:return CA(r.bottomLeftBorderBox,r.bottomLeftPaddingBox,r.topLeftBorderBox,r.topLeftPaddingBox)}},Sw=function(r,A){switch(A){case 0:return CA(r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox,r.topRightBorderBox,r.topRightBorderDoubleOuterBox);case 1:return CA(r.topRightBorderBox,r.topRightBorderDoubleOuterBox,r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox);case 2:return CA(r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox,r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox);case 3:default:return CA(r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox,r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox)}},Iw=function(r,A){switch(A){case 0:return CA(r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox,r.topRightBorderDoubleInnerBox,r.topRightPaddingBox);case 1:return CA(r.topRightBorderDoubleInnerBox,r.topRightPaddingBox,r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox);case 2:return CA(r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox,r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox);case 3:default:return CA(r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox,r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox)}},Tw=function(r,A){switch(A){case 0:return Cn(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return Cn(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return Cn(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);case 3:default:return Cn(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},Cn=function(r,A){var e=[];return pA(r)?e.push(r.subdivide(.5,!1)):e.push(r),pA(A)?e.push(A.subdivide(.5,!0)):e.push(A),e},CA=function(r,A,e,t){var n=[];return pA(r)?n.push(r.subdivide(.5,!1)):n.push(r),pA(e)?n.push(e.subdivide(.5,!0)):n.push(e),pA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),pA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},ed=function(r){var A=r.bounds,e=r.styles;return A.add(e.borderLeftWidth,e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth),-(e.borderTopWidth+e.borderBottomWidth))},vn=function(r){var A=r.styles,e=r.bounds,t=N(A.paddingLeft,e.width),n=N(A.paddingRight,e.width),s=N(A.paddingTop,e.width),i=N(A.paddingBottom,e.width);return e.add(t+A.borderLeftWidth,s+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+t+n),-(A.borderTopWidth+A.borderBottomWidth+s+i))},Hw=function(r,A){return r===0?A.bounds:r===2?vn(A):ed(A)},Lw=function(r,A){return r===0?A.bounds:r===2?vn(A):ed(A)},ei=function(r,A,e){var t=Hw(He(r.styles.backgroundOrigin,A),r),n=Lw(He(r.styles.backgroundClip,A),r),s=bw(He(r.styles.backgroundSize,A),e,t),i=s[0],o=s[1],a=st(He(r.styles.backgroundPosition,A),t.width-i,t.height-o),l=Mw(He(r.styles.backgroundRepeat,A),a,s,t,n),d=Math.round(t.left+a[0]),h=Math.round(t.top+a[1]);return[l,d,h,i,o]},Te=function(r){return k(r)&&r.value===Ue.AUTO},mn=function(r){return typeof r=="number"},bw=function(r,A,e){var t=A[0],n=A[1],s=A[2],i=r[0],o=r[1];if(!i)return[0,0];if(z(i)&&o&&z(o))return[N(i,e.width),N(o,e.height)];var a=mn(s);if(k(i)&&(i.value===Ue.CONTAIN||i.value===Ue.COVER)){if(mn(s)){var l=e.width/e.height;return l<s!=(i.value===Ue.COVER)?[e.width,e.width/s]:[e.height*s,e.height]}return[e.width,e.height]}var d=mn(t),h=mn(n),u=d||h;if(Te(i)&&(!o||Te(o))){if(d&&h)return[t,n];if(!a&&!u)return[e.width,e.height];if(u&&a){var f=d?t:n*s,B=h?n:t/s;return[f,B]}var w=d?t:e.width,v=h?n:e.height;return[w,v]}if(a){var m=0,F=0;return z(i)?m=N(i,e.width):z(o)&&(F=N(o,e.height)),Te(i)?m=F*s:(!o||Te(o))&&(F=m/s),[m,F]}var E=null,H=null;if(z(i)?E=N(i,e.width):o&&z(o)&&(H=N(o,e.height)),E!==null&&(!o||Te(o))&&(H=d&&h?E/t*n:e.height),H!==null&&Te(i)&&(E=d&&h?H/n*t:e.width),E!==null&&H!==null)return[E,H];throw new Error("Unable to calculate background-size for element")},He=function(r,A){var e=r[A];return typeof e>"u"?r[0]:e},Mw=function(r,A,e,t,n){var s=A[0],i=A[1],o=e[0],a=e[1];switch(r){case 2:return[new y(Math.round(t.left),Math.round(t.top+i)),new y(Math.round(t.left+t.width),Math.round(t.top+i)),new y(Math.round(t.left+t.width),Math.round(a+t.top+i)),new y(Math.round(t.left),Math.round(a+t.top+i))];case 3:return[new y(Math.round(t.left+s),Math.round(t.top)),new y(Math.round(t.left+s+o),Math.round(t.top)),new y(Math.round(t.left+s+o),Math.round(t.height+t.top)),new y(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new y(Math.round(t.left+s),Math.round(t.top+i)),new y(Math.round(t.left+s+o),Math.round(t.top+i)),new y(Math.round(t.left+s+o),Math.round(t.top+i+a)),new y(Math.round(t.left+s),Math.round(t.top+i+a))];default:return[new y(Math.round(n.left),Math.round(n.top)),new y(Math.round(n.left+n.width),Math.round(n.top)),new y(Math.round(n.left+n.width),Math.round(n.height+n.top)),new y(Math.round(n.left),Math.round(n.height+n.top))]}},Dw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",td="Hidden Text",Rw=function(){function r(A){this._data={},this._document=A}return r.prototype.parseMetrics=function(A,e){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),i=this._document.body;t.style.visibility="hidden",t.style.fontFamily=A,t.style.fontSize=e,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",i.appendChild(t),n.src=Dw,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=A,s.style.fontSize=e,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(td)),t.appendChild(s),t.appendChild(n);var o=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(td)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return i.removeChild(t),{baseline:o,middle:a}},r.prototype.getMetrics=function(A,e){var t=A+" "+e;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(A,e)),this._data[t]},r}(),rd=function(){function r(A,e){this.context=A,this.options=e}return r}(),xw=1e4,Pw=function(r){mA(A,r);function A(e,t){var n=r.call(this,e,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new Rw(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return A.prototype.applyEffects=function(e){for(var t=this;this._activeEffects.length;)this.popEffect();e.forEach(function(n){return t.applyEffect(n)})},A.prototype.applyEffect=function(e){this.ctx.save(),Uw(e)&&(this.ctx.globalAlpha=e.opacity),Qw(e)&&(this.ctx.translate(e.offsetX,e.offsetY),this.ctx.transform(e.matrix[0],e.matrix[1],e.matrix[2],e.matrix[3],e.matrix[4],e.matrix[5]),this.ctx.translate(-e.offsetX,-e.offsetY)),Yc(e)&&(this.path(e.path),this.ctx.clip()),this._activeEffects.push(e)},A.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},A.prototype.renderStack=function(e){return uA(this,void 0,void 0,function(){var t;return nA(this,function(n){switch(n.label){case 0:return t=e.element.container.styles,t.isVisible()?[4,this.renderStackContent(e)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(e){return uA(this,void 0,void 0,function(){return nA(this,function(t){switch(t.label){case 0:if(Z(e.container.flags,16))debugger;return e.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(e)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(e,t,n){var s=this;if(t===0)this.ctx.fillText(e.text,e.bounds.left,e.bounds.top+n);else{var i=_s(e.text);i.reduce(function(o,a){return s.ctx.fillText(a,o,e.bounds.top+n),o+s.ctx.measureText(a).width},e.bounds.left)}},A.prototype.createFontStyle=function(e){var t=e.fontVariant.filter(function(i){return i==="normal"||i==="small-caps"}).join(""),n=_w(e.fontFamily).join(", "),s=nt(e.fontSize)?""+e.fontSize.number+e.fontSize.unit:e.fontSize.number+"px";return[[e.fontStyle,t,e.fontWeight,s,n].join(" "),n,s]},A.prototype.renderTextNode=function(e,t){return uA(this,void 0,void 0,function(){var n,s,i,o,a,l,d,h,u=this;return nA(this,function(f){return n=this.createFontStyle(t),s=n[0],i=n[1],o=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(i,o),l=a.baseline,d=a.middle,h=t.paintOrder,e.textBounds.forEach(function(B){h.forEach(function(w){switch(w){case 0:u.ctx.fillStyle=j(t.color),u.renderTextWithLetterSpacing(B,t.letterSpacing,l);var v=t.textShadow;v.length&&B.text.trim().length&&(v.slice(0).reverse().forEach(function(m){u.ctx.shadowColor=j(m.color),u.ctx.shadowOffsetX=m.offsetX.number*u.options.scale,u.ctx.shadowOffsetY=m.offsetY.number*u.options.scale,u.ctx.shadowBlur=m.blur.number,u.renderTextWithLetterSpacing(B,t.letterSpacing,l)}),u.ctx.shadowColor="",u.ctx.shadowOffsetX=0,u.ctx.shadowOffsetY=0,u.ctx.shadowBlur=0),t.textDecorationLine.length&&(u.ctx.fillStyle=j(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(m){switch(m){case 1:u.ctx.fillRect(B.bounds.left,Math.round(B.bounds.top+l),B.bounds.width,1);break;case 2:u.ctx.fillRect(B.bounds.left,Math.round(B.bounds.top),B.bounds.width,1);break;case 3:u.ctx.fillRect(B.bounds.left,Math.ceil(B.bounds.top+d),B.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&B.text.trim().length&&(u.ctx.strokeStyle=j(t.webkitTextStrokeColor),u.ctx.lineWidth=t.webkitTextStrokeWidth,u.ctx.lineJoin=window.chrome?"miter":"round",u.ctx.strokeText(B.text,B.bounds.left,B.bounds.top+l)),u.ctx.strokeStyle="",u.ctx.lineWidth=0,u.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(e,t,n){if(n&&e.intrinsicWidth>0&&e.intrinsicHeight>0){var s=vn(e),i=wn(t);this.path(i),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,e.intrinsicWidth,e.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(e){return uA(this,void 0,void 0,function(){var t,n,s,i,o,a,F,F,l,d,h,u,H,f,B,S,w,v,m,F,E,H,S;return nA(this,function(U){switch(U.label){case 0:this.applyEffects(e.getEffects(4)),t=e.container,n=e.curves,s=t.styles,i=0,o=t.textNodes,U.label=1;case 1:return i<o.length?(a=o[i],[4,this.renderTextNode(a,s)]):[3,4];case 2:U.sent(),U.label=3;case 3:return i++,[3,1];case 4:if(!(t instanceof mc))return[3,8];U.label=5;case 5:return U.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return F=U.sent(),this.renderReplacedElement(t,n,F),[3,8];case 7:return U.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Fc&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof Qc))return[3,12];U.label=9;case 9:return U.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return F=U.sent(),this.renderReplacedElement(t,n,F),[3,12];case 11:return U.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof Ic&&t.tree?(l=new A(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,l.render(t.tree)]):[3,14];case 13:d=U.sent(),t.width&&t.height&&this.ctx.drawImage(d,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),U.label=14;case 14:if(t instanceof Os&&(h=Math.min(t.bounds.width,t.bounds.height),t.type===ln?t.checked&&(this.ctx.save(),this.path([new y(t.bounds.left+h*.39363,t.bounds.top+h*.79),new y(t.bounds.left+h*.16,t.bounds.top+h*.5549),new y(t.bounds.left+h*.27347,t.bounds.top+h*.44071),new y(t.bounds.left+h*.39694,t.bounds.top+h*.5649),new y(t.bounds.left+h*.72983,t.bounds.top+h*.23),new y(t.bounds.left+h*.84,t.bounds.top+h*.34085),new y(t.bounds.left+h*.39363,t.bounds.top+h*.79)]),this.ctx.fillStyle=j(Ec),this.ctx.fill(),this.ctx.restore()):t.type===cn&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+h/2,t.bounds.top+h/2,h/4,0,Math.PI*2,!0),this.ctx.fillStyle=j(Ec),this.ctx.fill(),this.ctx.restore())),Kw(t)&&t.value.length){switch(u=this.createFontStyle(s),H=u[0],f=u[1],B=this.fontMetrics.getMetrics(H,f).baseline,this.ctx.font=H,this.ctx.fillStyle=j(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=kw(t.styles.textAlign),S=vn(t),w=0,t.styles.textAlign){case 1:w+=S.width/2;break;case 2:w+=S.width;break}v=S.add(w,0,0,-S.height/2+1),this.ctx.save(),this.path([new y(S.left,S.top),new y(S.left+S.width,S.top),new y(S.left+S.width,S.top+S.height),new y(S.left,S.top+S.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new lt(t.value,v),s.letterSpacing,B),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Z(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(m=t.styles.listStyleImage,m.type!==0)return[3,18];F=void 0,E=m.url,U.label=15;case 15:return U.trys.push([15,17,,18]),[4,this.context.cache.match(E)];case 16:return F=U.sent(),this.ctx.drawImage(F,t.bounds.left-(F.width+10),t.bounds.top),[3,18];case 17:return U.sent(),this.context.logger.error("Error loading list-style-image "+E),[3,18];case 18:return[3,20];case 19:e.listValue&&t.styles.listStyleType!==-1&&(H=this.createFontStyle(s)[0],this.ctx.font=H,this.ctx.fillStyle=j(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",S=new bA(t.bounds.left,t.bounds.top+N(t.styles.paddingTop,t.bounds.width),t.bounds.width,tc(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new lt(e.listValue,S),s.letterSpacing,tc(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),U.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(e){return uA(this,void 0,void 0,function(){var t,n,m,s,i,m,o,a,m,l,d,m,h,u,m,f,B,m,w,v,m;return nA(this,function(F){switch(F.label){case 0:if(Z(e.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(e.element)];case 1:F.sent(),t=0,n=e.negativeZIndex,F.label=2;case 2:return t<n.length?(m=n[t],[4,this.renderStack(m)]):[3,5];case 3:F.sent(),F.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(e.element)];case 6:F.sent(),s=0,i=e.nonInlineLevel,F.label=7;case 7:return s<i.length?(m=i[s],[4,this.renderNode(m)]):[3,10];case 8:F.sent(),F.label=9;case 9:return s++,[3,7];case 10:o=0,a=e.nonPositionedFloats,F.label=11;case 11:return o<a.length?(m=a[o],[4,this.renderStack(m)]):[3,14];case 12:F.sent(),F.label=13;case 13:return o++,[3,11];case 14:l=0,d=e.nonPositionedInlineLevel,F.label=15;case 15:return l<d.length?(m=d[l],[4,this.renderStack(m)]):[3,18];case 16:F.sent(),F.label=17;case 17:return l++,[3,15];case 18:h=0,u=e.inlineLevel,F.label=19;case 19:return h<u.length?(m=u[h],[4,this.renderNode(m)]):[3,22];case 20:F.sent(),F.label=21;case 21:return h++,[3,19];case 22:f=0,B=e.zeroOrAutoZIndexOrTransformedOrOpacity,F.label=23;case 23:return f<B.length?(m=B[f],[4,this.renderStack(m)]):[3,26];case 24:F.sent(),F.label=25;case 25:return f++,[3,23];case 26:w=0,v=e.positiveZIndex,F.label=27;case 27:return w<v.length?(m=v[w],[4,this.renderStack(m)]):[3,30];case 28:F.sent(),F.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},A.prototype.mask=function(e){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(e.slice(0).reverse()),this.ctx.closePath()},A.prototype.path=function(e){this.ctx.beginPath(),this.formatPath(e),this.ctx.closePath()},A.prototype.formatPath=function(e){var t=this;e.forEach(function(n,s){var i=pA(n)?n.start:n;s===0?t.ctx.moveTo(i.x,i.y):t.ctx.lineTo(i.x,i.y),pA(n)&&t.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},A.prototype.renderRepeat=function(e,t,n,s){this.path(e),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},A.prototype.resizeImage=function(e,t,n){var s;if(e.width===t&&e.height===n)return e;var i=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,o=i.createElement("canvas");o.width=Math.max(1,t),o.height=Math.max(1,n);var a=o.getContext("2d");return a.drawImage(e,0,0,e.width,e.height,0,0,t,n),o},A.prototype.renderBackgroundImage=function(e){return uA(this,void 0,void 0,function(){var t,n,s,i,o,a;return nA(this,function(l){switch(l.label){case 0:t=e.styles.backgroundImage.length-1,n=function(d){var h,u,f,O,oA,gA,G,q,R,B,O,oA,gA,G,q,w,v,m,F,E,H,S,U,D,R,M,O,iA,Y,G,q,SA,oA,gA,ce,IA,zA,de,ue,xA,he,PA;return nA(this,function(Pe){switch(Pe.label){case 0:if(d.type!==0)return[3,5];h=void 0,u=d.url,Pe.label=1;case 1:return Pe.trys.push([1,3,,4]),[4,s.context.cache.match(u)];case 2:return h=Pe.sent(),[3,4];case 3:return Pe.sent(),s.context.logger.error("Error loading background-image "+u),[3,4];case 4:return h&&(f=ei(e,t,[h.width,h.height,h.width/h.height]),O=f[0],oA=f[1],gA=f[2],G=f[3],q=f[4],R=s.ctx.createPattern(s.resizeImage(h,G,q),"repeat"),s.renderRepeat(O,R,oA,gA)),[3,6];case 5:Fg(d)?(B=ei(e,t,[null,null,null]),O=B[0],oA=B[1],gA=B[2],G=B[3],q=B[4],w=wg(d.angle,G,q),v=w[0],m=w[1],F=w[2],E=w[3],H=w[4],S=document.createElement("canvas"),S.width=G,S.height=q,U=S.getContext("2d"),D=U.createLinearGradient(m,E,F,H),Wl(d.stops,v).forEach(function(vr){return D.addColorStop(vr.stop,j(vr.color))}),U.fillStyle=D,U.fillRect(0,0,G,q),G>0&&q>0&&(R=s.ctx.createPattern(S,"repeat"),s.renderRepeat(O,R,oA,gA))):Qg(d)&&(M=ei(e,t,[null,null,null]),O=M[0],iA=M[1],Y=M[2],G=M[3],q=M[4],SA=d.position.length===0?[Ss]:d.position,oA=N(SA[0],G),gA=N(SA[SA.length-1],q),ce=pg(d,oA,gA,G,q),IA=ce[0],zA=ce[1],IA>0&&zA>0&&(de=s.ctx.createRadialGradient(iA+oA,Y+gA,0,iA+oA,Y+gA,IA),Wl(d.stops,IA*2).forEach(function(vr){return de.addColorStop(vr.stop,j(vr.color))}),s.path(O),s.ctx.fillStyle=de,IA!==zA?(ue=e.bounds.left+.5*e.bounds.width,xA=e.bounds.top+.5*e.bounds.height,he=zA/IA,PA=1/he,s.ctx.save(),s.ctx.translate(ue,xA),s.ctx.transform(1,0,0,he,0,0),s.ctx.translate(-ue,-xA),s.ctx.fillRect(iA,PA*(Y-xA)+xA,G,q*PA),s.ctx.restore()):s.ctx.fill())),Pe.label=6;case 6:return t--,[2]}})},s=this,i=0,o=e.styles.backgroundImage.slice(0).reverse(),l.label=1;case 1:return i<o.length?(a=o[i],[5,n(a)]):[3,4];case 2:l.sent(),l.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(e,t,n){return uA(this,void 0,void 0,function(){return nA(this,function(s){return this.path(Ad(n,t)),this.ctx.fillStyle=j(e),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(e,t,n,s){return uA(this,void 0,void 0,function(){var i,o;return nA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(e,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return i=Sw(s,n),this.path(i),this.ctx.fillStyle=j(e),this.ctx.fill(),o=Iw(s,n),this.path(o),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(e){return uA(this,void 0,void 0,function(){var t,n,s,i,o,a,l,d,h=this;return nA(this,function(u){switch(u.label){case 0:return this.applyEffects(e.getEffects(2)),t=e.container.styles,n=!OA(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],i=Gw(He(t.backgroundClip,0),e.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),OA(t.backgroundColor)||(this.ctx.fillStyle=j(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(e.container)]):[3,2];case 1:u.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(f){h.ctx.save();var B=fn(e.curves),w=f.inset?0:xw,v=Ew(B,-w+(f.inset?1:-1)*f.spread.number,(f.inset?1:-1)*f.spread.number,f.spread.number*(f.inset?-2:2),f.spread.number*(f.inset?-2:2));f.inset?(h.path(B),h.ctx.clip(),h.mask(v)):(h.mask(B),h.ctx.clip(),h.path(v)),h.ctx.shadowOffsetX=f.offsetX.number+w,h.ctx.shadowOffsetY=f.offsetY.number,h.ctx.shadowColor=j(f.color),h.ctx.shadowBlur=f.blur.number,h.ctx.fillStyle=f.inset?j(f.color):"rgba(0,0,0,1)",h.ctx.fill(),h.ctx.restore()}),u.label=2;case 2:o=0,a=0,l=s,u.label=3;case 3:return a<l.length?(d=l[a],d.style!==0&&!OA(d.color)&&d.width>0?d.style!==2?[3,5]:[4,this.renderDashedDottedBorder(d.color,d.width,o,e.curves,2)]:[3,11]):[3,13];case 4:return u.sent(),[3,11];case 5:return d.style!==3?[3,7]:[4,this.renderDashedDottedBorder(d.color,d.width,o,e.curves,3)];case 6:return u.sent(),[3,11];case 7:return d.style!==4?[3,9]:[4,this.renderDoubleBorder(d.color,d.width,o,e.curves)];case 8:return u.sent(),[3,11];case 9:return[4,this.renderSolidBorder(d.color,o,e.curves)];case 10:u.sent(),u.label=11;case 11:o++,u.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(e,t,n,s,i){return uA(this,void 0,void 0,function(){var o,a,l,d,h,u,f,B,w,v,m,F,E,H,S,U,S,U;return nA(this,function(D){return this.ctx.save(),o=Tw(s,n),a=Ad(s,n),i===2&&(this.path(a),this.ctx.clip()),pA(a[0])?(l=a[0].start.x,d=a[0].start.y):(l=a[0].x,d=a[0].y),pA(a[1])?(h=a[1].end.x,u=a[1].end.y):(h=a[1].x,u=a[1].y),n===0||n===2?f=Math.abs(l-h):f=Math.abs(d-u),this.ctx.beginPath(),i===3?this.formatPath(o):this.formatPath(a.slice(0,2)),B=t<3?t*3:t*2,w=t<3?t*2:t,i===3&&(B=t,w=t),v=!0,f<=B*2?v=!1:f<=B*2+w?(m=f/(2*B+w),B*=m,w*=m):(F=Math.floor((f+w)/(B+w)),E=(f-F*B)/(F-1),H=(f-(F+1)*B)/F,w=H<=0||Math.abs(w-E)<Math.abs(w-H)?E:H),v&&(i===3?this.ctx.setLineDash([0,B+w]):this.ctx.setLineDash([B,w])),i===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=j(e),this.ctx.stroke(),this.ctx.setLineDash([]),i===2&&(pA(a[0])&&(S=a[3],U=a[0],this.ctx.beginPath(),this.formatPath([new y(S.end.x,S.end.y),new y(U.start.x,U.start.y)]),this.ctx.stroke()),pA(a[1])&&(S=a[1],U=a[2],this.ctx.beginPath(),this.formatPath([new y(S.end.x,S.end.y),new y(U.start.x,U.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(e){return uA(this,void 0,void 0,function(){var t;return nA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=j(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=yw(e),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A}(rd),Kw=function(r){return r instanceof Sc||r instanceof yc?!0:r instanceof Os&&r.type!==cn&&r.type!==ln},Gw=function(r,A){switch(r){case 0:return fn(A);case 2:return vw(A);case 1:default:return wn(A)}},kw=function(r){switch(r){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Nw=["-apple-system","system-ui"],_w=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(A){return Nw.indexOf(A)===-1}):r},Vw=function(r){mA(A,r);function A(e,t){var n=r.call(this,e,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return A.prototype.render=function(e){return uA(this,void 0,void 0,function(){var t,n;return nA(this,function(s){switch(s.label){case 0:return t=Ns(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e),[4,Ow(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=j(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},A}(rd),Ow=function(r){return new Promise(function(A,e){var t=new Image;t.onload=function(){A(t)},t.onerror=e,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},Ww=function(){function r(A){var e=A.id,t=A.enabled;this.id=e,this.enabled=t,this.start=Date.now()}return r.prototype.debug=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.prototype.getTime=function(){return Date.now()-this.start},r.prototype.info=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Ir([this.id,this.getTime()+"ms"],A))},r.prototype.warn=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.prototype.error=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Ir([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.instances={},r}(),Xw=function(){function r(A,e){var t;this.windowBounds=e,this.instanceName="#"+r.instanceCount++,this.logger=new Ww({id:this.instanceName,enabled:A.logging}),this.cache=(t=A.cache)!==null&&t!==void 0?t:new uw(this,A)}return r.instanceCount=1,r}(),Jw=function(r,A){return A===void 0&&(A={}),zw(r,A)};typeof window<"u"&&zc.setContext(window);var zw=function(r,A){return uA(void 0,void 0,void 0,function(){var e,t,n,s,i,o,a,l,d,h,u,f,B,w,v,m,F,E,H,S,D,U,D,R,M,O,iA,Y,G,q,SA,oA,gA,ce,IA,zA,de,ue,xA,he;return nA(this,function(PA){switch(PA.label){case 0:if(!r||typeof r!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(e=r.ownerDocument,!e)throw new Error("Element is not attached to a Document");if(t=e.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(R=A.allowTaint)!==null&&R!==void 0?R:!1,imageTimeout:(M=A.imageTimeout)!==null&&M!==void 0?M:15e3,proxy:A.proxy,useCORS:(O=A.useCORS)!==null&&O!==void 0?O:!1},s=is({logging:(iA=A.logging)!==null&&iA!==void 0?iA:!0,cache:A.cache},n),i={windowWidth:(Y=A.windowWidth)!==null&&Y!==void 0?Y:t.innerWidth,windowHeight:(G=A.windowHeight)!==null&&G!==void 0?G:t.innerHeight,scrollX:(q=A.scrollX)!==null&&q!==void 0?q:t.pageXOffset,scrollY:(SA=A.scrollY)!==null&&SA!==void 0?SA:t.pageYOffset},o=new bA(i.scrollX,i.scrollY,i.windowWidth,i.windowHeight),a=new Xw(s,o),l=(oA=A.foreignObjectRendering)!==null&&oA!==void 0?oA:!1,d={allowTaint:(gA=A.allowTaint)!==null&&gA!==void 0?gA:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:l,copyStyles:l},a.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),h=new Xc(a,r,d),u=h.clonedReferenceElement,u?[4,h.toIFrame(e,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return f=PA.sent(),B=Xs(u)||Yf(u)?Uu(u.ownerDocument):Tr(a,u),w=B.width,v=B.height,m=B.left,F=B.top,E=Yw(a,u,A.backgroundColor),H={canvas:A.canvas,backgroundColor:E,scale:(IA=(ce=A.scale)!==null&&ce!==void 0?ce:t.devicePixelRatio)!==null&&IA!==void 0?IA:1,x:((zA=A.x)!==null&&zA!==void 0?zA:0)+m,y:((de=A.y)!==null&&de!==void 0?de:0)+F,width:(ue=A.width)!==null&&ue!==void 0?ue:Math.ceil(w),height:(xA=A.height)!==null&&xA!==void 0?xA:Math.ceil(v)},l?(a.logger.debug("Document cloned, using foreign object rendering"),D=new Vw(a,H),[4,D.render(u)]):[3,3];case 2:return S=PA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+m+","+F+" with size "+w+"x"+v+" using computed rendering"),a.logger.debug("Starting DOM parsing"),U=Hc(a,u),E===U.styles.backgroundColor&&(U.styles.backgroundColor=DA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+H.x+","+H.y+" with size "+H.width+"x"+H.height),D=new Pw(a,H),[4,D.render(U)];case 4:S=PA.sent(),PA.label=5;case 5:return(!((he=A.removeContainer)!==null&&he!==void 0)||he)&&(Xc.destroy(f)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,S]}})})},Yw=function(r,A,e){var t=A.ownerDocument,n=t.documentElement?it(r,getComputedStyle(t.documentElement).backgroundColor):DA.TRANSPARENT,s=t.body?it(r,getComputedStyle(t.body).backgroundColor):DA.TRANSPARENT,i=typeof e=="string"?it(r,e):e===null?DA.TRANSPARENT:4294967295;return A===t.documentElement?OA(n)?OA(s)?i:s:n:i};const Mt=class Mt extends c.EngineObject{constructor(A,e){super(A,e),this.ad(new c.ObjResettingWithEvent(A.renderInUEChanged,()=>A.renderInUE?new sd(A,e):new nd(A,e)))}};p(Mt,"type",Mt.register("ESUeViewer",c.ESGeoDiv.type,Mt));let ti=Mt;class nd extends c.Destroyable{constructor(e,t){super();p(this,"_screenPosition",this.disposeVar(c.reactArrayWithUndefined(void 0)));const n=t.viewer;if(!n){console.warn("viewer is undefined!");return}const s=this.disposeVar(new c.ESTextLabel);s.parentID=e.id,e.components.disposableAdd(s,!0),s.show=!1,this.dispose(c.bind([s,"position"],[e,"position"])),this.dispose(c.bind([s,"rotation"],[e,"rotation"])),this.dispose(c.bind([s,"flyToParam"],[e,"flyToParam"])),this.dispose(c.bind([s,"flyInParam"],[e,"flyInParam"])),this.dispose(e.calcFlyToParamEvent.disposableOn(()=>{YA(n,s.id)})),this.dispose(e.calcFlyInParamEvent.disposableOn(async()=>{if(!t.actived)return;const a=await t.getCurrentCameraInfo();if(!a)return;const{position:l,rotation:d}=a;e.flyInParam={position:l,rotation:d,flyDuration:1}})),this.dispose(e.smoothMoveEvent.disposableOn((a,l)=>{_e(n,s.id,a,l)})),this.dispose(e.smoothMoveWithRotationEvent.disposableOn((a,l,d)=>{Ge(n,s.id,a,l,d)})),this.dispose(e.smoothMoveOnGroundEvent.disposableOn((a,l,d,h)=>{ke(n,s.id,a,l,h,d)})),this.dispose(e.smoothMoveWithRotationOnGroundEvent.disposableOn((a,l,d,h,u)=>{Ne(n,s.id,a,l,d,h,u)})),this.dispose(e.flyToEvent.disposableOn((a,l)=>{s.flyTo(a)})),this.dispose(e.flyInEvent.don(a=>{s.flyIn(a)}));const i=this._screenPosition,o=this.disposeVar(new c.ESCustomDiv);o.parentID=e.id,t.add(o),this.dispose(()=>t.delete(o)),this.dispose(c.bind([o,"allowPicking"],[e,"allowPicking"]));{const a=this.disposeVar(c.createAnimateFrame()),l=()=>{e.show?a.restart(void 0,async()=>{if(!e.position)return;const d=await t.lonLatAltToScreenPosition(e.position);if(!this.isDestroyed())if(!d)this._screenPosition.value=void 0;else{const[h,u]=d;h===-1&&u===-1?this._screenPosition.value=void 0:this._screenPosition.value=[h,u]}}):a.cancel()};l(),this.dispose(e.showChanged.disposableOn(l))}{const a=()=>class extends c.Destroyable{constructor(u,f,B){if(super(),this._subContainer=u,!B)return;if(!e.instanceClass)throw new Error("!sceneObject.instanceClass");const w=new c.PosFloatDiv,v=w.element;this._subContainer.appendChild(v),this.dispose(()=>this._subContainer.removeChild(v)),v.onclick=m=>{(e.allowPicking??!1)&&e.pickedEvent.emit(new c.ESJPickedResult({div:v,pointerEvent:m},e,void 0,void 0,void 0,[m.x,m.y]))};{const m=()=>{e.editing?v.children[0].style.pointerEvents="none":v.children[0].style.pointerEvents="all"};m(),this.d(e.editingChanged.don(m))}{const m=()=>{const E=e.show;i.value&&E?(w.show=!0,w.winPos=[...i.value]):(w.show=!1,w.winPos=[0,0])};m();const F=this.disposeVar(c.createNextAnimateFrameEvent(e.showChanged,i.changed));this.dispose(F.disposableOn(m))}{const m=()=>{const[F,E]=e.anchor??c.ESGeoDiv.defaults.anchor;w.originRatioX=F,w.originRatioY=E};m(),this.dispose(e.anchorChanged.disposableOn(m))}{const m=()=>{w.opacity=e.opacity??c.ESGeoDiv.defaults.opacity};m(),this.dispose(e.opacityChanged.disposableOn(m))}this.disposeVar(new e.instanceClass(w.contentDiv,e,B))}},l=()=>{try{e.instanceClass?o.instanceClass=a():o.instanceClass=void 0}catch(h){console.error(h)}};l();const d=this.dv(c.createNextAnimateFrameEvent(e.instanceClassChanged,e.opacityChanged,e.anchorChanged,e.editingChanged,e.showChanged,e.allowPickingChanged));this.d(d.don(l))}}get screenPosition(){return this._screenPosition.value}get screenPositionChanged(){return this._screenPosition.changed}set screenPosition(e){this._screenPosition.value=e}}class sd extends c.Destroyable{constructor(e,t){super();p(this,"_imageLabel");p(this,"_hasClassDivAndPos",{});this._imageLabel=this.dv(new c.ESImageLabel),this._imageLabel.isHoverZoom=!1,this._imageLabel.parentID=e.id;const n=t.viewer;if(!n){console.warn("viewer is undefined!");return}const s=this._imageLabel;e.components.disposableAdd(s,!0);{const i=()=>{if(!n)return;if(!e.instanceClass)throw new Error("!sceneObject.instanceClass");const l=document.createElement("div"),d=this.dv(new e.instanceClass(l,e,t))._container;if(d.style.opacity=e.opacity.toString()??c.ESGeoDiv.defaults.opacity,d.style.position="fixed",d.style.zIndex="-1",d.style.top="0px",!document.body.contains(d)){document.body.appendChild(d);let u=d?d.querySelectorAll("*[class]"):[];for(let f=0;f<u.length;f++){const B=u[f];var h=B.getBoundingClientRect();this._hasClassDivAndPos[B.className]=[B.offsetLeft,B.offsetTop,B.offsetLeft+h.width,B.offsetTop+h.height]}}Jw(d,{backgroundColor:null,allowTaint:!0,useCORS:!0,width:d.offsetWidth,height:d.offsetHeight,scale:1}).then(u=>{document.body.contains(d)&&document.body.removeChild(d),s.url=u.toDataURL(),s.show=e.show}).catch(()=>{document.body.contains(d)&&document.body.removeChild(d)})},o=()=>{try{e.instanceClass?i():(s.url="",s.show=!1)}catch(l){console.error(l)}};o();const a=this.dv(c.createNextAnimateFrameEvent(e.instanceClassChanged,e.opacityChanged));this.d(a.don(o))}{const i=()=>{s.show=e.show};s.show=!1,this.ad(e.showChanged.don(i))}this.d(c.track([s,"anchor"],[e,"anchor"])),this.d(c.bind([s,"position"],[e,"position"])),this.d(c.bind([s,"rotation"],[e,"rotation"])),this.d(c.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(c.bind([s,"flyInParam"],[e,"flyInParam"])),this.d(c.bind([s,"allowPicking"],[e,"allowPicking"])),this.d(c.bind([s,"scale"],[e,"scale"])),this.d(c.track([s,"minVisibleDistance"],[e,"minVisibleDistance"])),this.d(c.track([s,"maxVisibleDistance"],[e,"maxVisibleDistance"])),this.ad(e.automaticLandingEvent.don(()=>{s.automaticLanding()})),this.d(t.widgetEvent.don(i=>{if(i.objId!==this._imageLabel.id)return;const{type:o,add:a}=i;if(o==="leftClick"&&a){const l=(a==null?void 0:a.classNames)??[],d=Object.keys(this._hasClassDivAndPos);for(let h=0;h<d.length;h++){const u=d[h];let f=this._hasClassDivAndPos[u];a&&a.mouseRelativePos&&a.mouseRelativePos[0]>=f[0]&&a.mouseRelativePos[0]<=f[2]&&a.mouseRelativePos[1]>=f[1]&&a.mouseRelativePos[1]<=f[3]&&l.push(u)}a.classNames=l}e.widgetEvent.emit({type:o,add:a})})),this.d(e.calcFlyToParamEvent.don(()=>{YA(n,s.id)})),this.d(e.calcFlyInParamEvent.don(()=>{const i=t.getCurrentCameraInfo();if(!i)return;const{position:o,rotation:a}=i;e.flyInParam={position:o,rotation:a,flyDuration:1}})),this.d(e.smoothMoveEvent.don((i,o)=>{_e(n,s.id,i,o)})),this.d(e.smoothMoveWithRotationEvent.don((i,o,a)=>{Ge(n,s.id,i,o,a)})),this.d(e.smoothMoveOnGroundEvent.don((i,o,a,l)=>{ke(n,s.id,i,o,l,a)})),this.d(e.smoothMoveWithRotationOnGroundEvent.don((i,o,a,l,d)=>{Ne(n,s.id,i,o,a,l,d)})),this.d(e.flyToEvent.don((i,o)=>{s.flyTo(i)})),this.d(e.flyInEvent.don(i=>{s.flyIn(i)}))}}const Dt=class Dt extends cA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.flyToFeatureIndexEvent.don((n,s)=>{t.callUeFunc({f:"flyToFeatureIndex",p:{id:A.id,index:n,duration:s}})})),this.d(A.flyToFeatureEvent.don((n,s,i)=>{t.callUeFunc({f:"flyToFeature",p:{id:A.id,key:n,value:s,duration:i}})}))}};p(Dt,"type",Dt.register("ESUeViewer",c.ESGeoJson.type,Dt));let ri=Dt;const Rt=class Rt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Rt,"type",Rt.register("ESUeViewer",c.ESGeoLineString.type,Rt));let Fn=Rt;const xt=class xt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(xt,"type",xt.register("ESUeViewer",c.ESGeoRectangle.type,xt));let ni=xt;const Pt=class Pt extends dA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Pt,"type",Pt.register("ESUeViewer",c.ESGeoWater.type,Pt));let si=Pt;const ie=class ie extends P{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.setNodePositionEvent.don((n,s)=>{io(t,A.id,n,s)})),this.d(A.setNodeRotationEvent.don((n,s)=>{oo(t,A.id,n,s)})),this.d(A.setNodeScaleEvent.don((n,s)=>{ao(t,A.id,n,s)}))}};p(ie,"forceUeUpdateProps",[...P.forceUeUpdateProps,"url"]),p(ie,"propValFuncs",{...P.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(c.rpToap(A)):(A.url=c.ESSceneObject.context.getStrFromEnv(c.rpToap(A.url)),A),czmMaximumScale:null,czmMinimumPixelSize:null,czmNativeScale:null,czmColor:null}),p(ie,"type",ie.register("ESUeViewer",c.ESGltfModel.type,ie));let ii=ie;const Kt=class Kt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Kt,"type",Kt.register("ESUeViewer",c.ESHeightMeasurement.type,Kt));let oi=Kt;const Gt=class Gt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=async(i,o,a,l)=>{const{viewer:d}=i;if(!d){console.error("AIMoveTo: ueViewer.viewer is undefined");return}const h=await d.callUeFunc({f:"AIMoveTo",p:{id:o,Destination:a,Time:l}});return h.error&&console.error("AIMoveTo:",h.error),h};this.d(A.aiMoveToEvent.don((i,o)=>{n(e,A.id,i,o)}));const s=async(i,o)=>{const{viewer:a}=i;if(!a){console.error("StopAIMove: ueViewer.viewer is undefined");return}const l=await a.callUeFunc({f:"StopAIMove",p:{id:o}});return l.error&&console.error("StopAIMove:",l.error),l};this.d(A.stopAIMoveEvent.don(()=>{s(e,A.id)}))}};p(Gt,"type",Gt.register("ESUeViewer",c.ESHuman.type,Gt));let ai=Gt;const oe=class oe extends QA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}A.anchor=[.5,1]}};p(oe,"type",oe.register("ESUeViewer",c.ESImageLabel.type,oe)),p(oe,"forceUeUpdateProps",[...QA.forceUeUpdateProps,"url"]),p(oe,"propValFuncs",{...QA.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(c.rpToap(A)):(A.url=c.ESSceneObject.context.getStrFromEnv(c.rpToap(A.url)),A)});let li=oe;const kt=class kt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(kt,"type",kt.register("ESUeViewer",c.ESLevelRuntimeModel.type,kt));let ci=kt;const Nt=class Nt extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Nt,"type",Nt.register("ESUeViewer",c.ESLocalCircle.type,Nt));let di=Nt;const _t=class _t extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(_t,"type",_t.register("ESUeViewer",c.ESLocalPolygonZ.type,_t));let ui=_t;const Vt=class Vt extends Er{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Vt,"type",Vt.register("ESUeViewer",c.ESLocalRectangle.type,Vt));let hi=Vt;const Ot=class Ot extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Ot,"type",Ot.register("ESUeViewer",c.ESLocalSkyBox.type,Ot));let gi=Ot;const Wt=class Wt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Wt,"type",Wt.register("ESUeViewer",c.ESLocationMeasurement.type,Wt));let Bi=Wt;const Xt=class Xt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Xt,"type",Xt.register("ESUeViewer",c.ESPipeFence.type,Xt));let fi=Xt;const Jt=class Jt extends Fn{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Jt,"type",Jt.register("ESUeViewer",c.ESPipeline.type,Jt));let wi=Jt;const zt=class zt extends yr{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.highlightFeatureEvent.don(n=>{const s=typeof n=="number"?n.toString():n;to(t,A.id,s)})),this.d(A.highlightFeatureAndFlyToEvent.don((n,s,i,o)=>{const a=typeof n=="number"?n.toString():n;ro(t,A.id,a,o??1)})),this.d(A.setLayerVisibleEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,no(t,A.id,i)})),this.d(A.setLayerColorEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,so(t,A.id,i)}))}};p(zt,"type",zt.register("ESUeViewer",c.ESPipeserTileset.type,zt));let pi=zt;const Yt=class Yt extends dA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Yt,"type",Yt.register("ESUeViewer",c.ESPit.type,Yt));let Ci=Yt;const $t=class $t extends QA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.ad(A.getInitialStyleEvent.don(async()=>{try{const n=await t.callUeFunc({f:"GetInitialStyle",p:{id:A.id}});n.error!=""&&console.error("getInitialStyleEvent:",n.error),A.initialStyle.value=structuredClone(n.re)}catch(n){console.error("getInitialStyleEvent:",n),A.initialStyle.value=void 0}}))}};p($t,"type",$t.register("ESUeViewer",c.ESPoi2D.type,$t));let vi=$t;const Zt=class Zt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Zt,"type",Zt.register("ESUeViewer",c.ESPoi3D.type,Zt));let mi=Zt;const ae=class ae extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ae,"type",ae.register("ESUeViewer",c.ESPoiTileset.type,ae)),p(ae,"forceUeUpdateProps",[...cA.forceUeUpdateProps,"url"]),p(ae,"propValFuncs",{...cA.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(A):(A.url=c.ESSceneObject.context.getStrFromEnv(A.url),A)});let Fi=ae;const qt=class qt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(qt,"type",qt.register("ESUeViewer",c.ESPolygonFence.type,qt));let Qi=qt;const De=class De extends dA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(De,"type",De.register("ESUeViewer",c.ESPolygonFlattenedPlane.type,De)),p(De,"propValFuncs",{...dA.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let Ui=De;const jt=class jt extends dA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(jt,"type",jt.register("ESUeViewer",c.ESPolygonWithHole.type,jt));let Ei=jt;const Ar=class Ar extends qA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(()=>{A.ids=[]}),this.d(A.highlightInner3DtilesetEvent.don(n=>{n.highlight=!0})),this.d(A.removeHighlightInner3DtilesetEvent.don(n=>{n.highlight=!1}));{const n=o=>{o=o.toLocaleLowerCase();let a=[255,255,255,1];if(o.startsWith("#")){if(o.length===4){let l=parseInt(o[1]+o[1],16),d=parseInt(o[2]+o[2],16),h=parseInt(o[3]+o[3],16);a=[l,d,h,1]}else if(o.length===7){let l=parseInt(o.substring(1,3),16),d=parseInt(o.substring(3,5),16),h=parseInt(o.substring(5,7),16);a=[l,d,h,1]}}else if(o.startsWith("rgba")){let l=o.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/);if(l){let d=parseInt(l[1]),h=parseInt(l[2]),u=parseInt(l[3]),f=parseFloat(l[4]);a=[d,h,u,f]}}else if(o.startsWith("rgb")){let l=o.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);if(l){let d=parseInt(l[1]),h=parseInt(l[2]),u=parseInt(l[3]);a=[d,h,u,1]}}else console.error("color类型只能为#rrggbb、#rgb、rgba(r,g,b,a)、rgb(r,g,b)");return[a[0]/255,a[1]/255,a[2]/255,a[3]]},s=()=>{const o=A.layerConfig;if(!o)return;const a=[];o.forEach(l=>{o.filter(h=>h.dataset==l.dataset).length==1?a.push({condition:[{field:"dataset",op:"==",value:l.dataset}],color:n(l.value.color??"rgb(255,255,255)"),show:l.value.visible}):a.push({condition:[{field:"layer",op:"==",value:l.layer},{field:"dataset",op:"==",value:l.dataset}],color:n(l.value.color??"rgb(255,255,255)"),show:l.value.visible})}),A.setFeatureStyle(a)};s();const i=this.dv(c.createNextAnimateFrameEvent(A.layerConfigChanged,A.colorBlendModeChanged));this.d(i.don(()=>{s()}))}}};p(Ar,"type",Ar.register("ESUeViewer",c.ESRtsTileset.type,Ar));let yi=Ar;const er=class er extends cA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}this.d(A.addTreesEvent.don(n=>{c.addTreesCallFunc(e,A.id,n)})),this.d(A.removeAllTreesEvent.don(()=>{c.removeAllTreesCallFunc(e,A.id)})),this.d(A.updateTreeParamsEvent.don(n=>{c.updateTreeParamsCallFunc(e,A.id,n)})),this.d(A.cutDownTreesEvent.don((n,s)=>{c.cutDownTreesCallFunc(e,A.id,n,s)})),this.d(A.growthSimulationEvent.don((n,s,i)=>{c.growthSimulationCallFunc(e,A.id,n,s,i)}))}};p(er,"type",er.register("ESUeViewer",c.ESSeparateFoliage.type,er));let Si=er;const tr=class tr extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(tr,"type",tr.register("ESUeViewer",c.ESSubmergingAnalysis.type,tr));let Ii=tr;const rr=class rr extends dA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.stopEvent.don(()=>{t.callUeFunc({f:"Stop",p:{id:A.id}})}))}};p(rr,"type",rr.register("ESUeViewer",c.ESSunshineAnalysis.type,rr));let Ti=rr;const nr=class nr extends dA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})}))}};p(nr,"type",nr.register("ESUeViewer",c.ESSurfaceAreaMeasurement.type,nr));let Hi=nr;const sr=class sr extends QA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(sr,"type",sr.register("ESUeViewer",c.ESTextLabel.type,sr));let Li=sr;const Re=class Re extends QA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.callFunctionEvent.don(async(n,s)=>{const i=await yn(t,A.id,n,s);A.__callFunctionResultEvent.emit(i)}))}};p(Re,"type",Re.register("ESUeViewer",c.ESUEWidget.type,Re)),p(Re,"propValFuncs",{...QA.propValFuncs,info:A=>JSON.stringify(A??{})});let bi=Re;const id=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"未搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag但对应的Actor不是场景原有的,而是新建的,无法绑定";case 4:return"搜索到ActorTag对应的Actor是地形或3DTileset,无法绑定";default:return"未知错误"}},$w=r=>{switch(r){case 0:return"创建成功";case 1:return"未找到对应的资源,无法创建";case 2:return"Id与场景中现有的ActorTag重复,创建后可能出现问题,创建失败";default:return"未知错误"}},ir=class ir extends c.EngineObject{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn(`${A.id} UeESUnrealActor viewer is undefined!`);return}this.d(()=>{Un(t,A.id)});const n=async()=>{l()||await t.callUeFunc({f:"update",p:{id:A.id,name:A.name,show:A.show,rotation:A.rotation,flyToParam:A.flyToParam??c.ESUnrealActor.defaultFlyToParam,flyInParam:A.flyInParam??c.ESUnrealActor.defaultFlyInParam,highlight:A.highlight,collision:A.collision,scale:A.scale,minVisibleDistance:A.minVisibleDistance,maxVisibleDistance:A.maxVisibleDistance}})},s=this.dv(c.createNextAnimateFrameEvent(A.showChanged,A.nameChanged,A.rotationChanged,A.flyToParamChanged,A.flyInParamChanged,A.highlightChanged,A.collisionChanged,A.scaleChanged,A.minVisibleDistanceChanged,A.maxVisibleDistanceChanged));this.d(s.don(n)),this.d(A.flushEvent.don(()=>s.flush()));let i,o;const a=async()=>{l()||(await t.callUeFunc({f:"update",p:{id:A.id,position:A.position}}),(e.debug??!1)&&console.log(`updatePostion:${A.position},actorTag:${A.actorTag},actorClass:${A.actorClass}`))},l=()=>!i&&!o?(console.warn(`${A.id} 未绑定ActorTag或未创建ActorClass!`),!0):!1,d=async()=>{const{id:u}=A,f=await e.unBindActorByID(u);f&&f.error!==""&&console.warn(`${A.id} UeESUnrealActor UnBindActorByID: ${f.error}`),i=void 0;const B=await t.callUeFunc({f:"destroy",p:{id:u}});if(B&&B.error!==""){console.warn(`${A.id} UeESUnrealActor DestroyActorByID: ${B.error}`);return}o=void 0},h=this.dv(c.react({type:"ActorClass",actorClass:"default"}));{const u=this.dv(c.createNextAnimateFrameEvent(A.actorClassChanged,A.actorTagChanged)),f=async()=>{A.actorTag!==""?h.value={type:"ActorTag",actorTag:A.actorTag}:h.value={type:"ActorClass",actorClass:A.actorClass===""?"default":A.actorClass}};f(),this.d(u.don(f)),this.d(A.flushEvent.don(()=>u.flush()))}{const u=this.dv(c.createProcessingFromAsyncFunc(async B=>{if(await B.promise(d()),A.lastActorStatus="null",h.value.type==="ActorTag"){const{actorTag:w}=h.value;try{const v=await B.promise(e.bindActorByTag(A.id,w));if(!v)return;if(v.error!==""){console.warn(`${A.id} UeESUnrealActor BindActorByTag:${w},${v.error}`);return}if(v.re.type===0)A.lastActorStatus="bound",i=w;else if(v.re.type===1)A.lastActorStatus="bound",i=w,console.warn(`${A.id} UeESUnrealActor BindActorByTag:${w},${id(v.re.type)}`);else{i=void 0,console.warn(`${A.id} UeESUnrealActor BindActorByTag error:${w}, ${id(v.re.type)}`);return}}catch(v){console.warn(`${A.id} UeESUnrealActor BindActorByTag catch error:${w}, ${v}`);return}}else if(h.value.type==="ActorClass"){const{actorClass:w}=h.value;try{const v=await B.promise(e.createActorByClass(A.id,w));if(!v)return;if(v.error!==""){console.warn(`${A.id} UeESUnrealActor CreateActorByClass error :${w}, ${v.error}`);return}if(v.re.type===0)w!=="default"&&(A.lastActorStatus="created"),o=w;else{console.warn(`${A.id} UeESUnrealActor CreateActorByClass error type :${w},${$w(v.re.type)}`);return}}catch(v){console.warn(`${A.id} UeESUnrealActor CreateActorByClass error catch :${w}, ${JSON.stringify(v)}`);return}}await B.promise(n()),await B.promise(a())})),f=async()=>{u.restart()};f(),this.d(h.changed.don(f))}this.d(A.positionChanged.don(a)),this.d(A.callFunctionEvent.don(async(u,f)=>{if(l()){A.__callFunctionResultEvent.emit(void 0);return}const B=await yn(t,A.id,u,f);A.__callFunctionResultEvent.emit(B)})),this.d(A.smoothMoveEvent.don((u,f)=>{l()||_e(t,A.id,u,f)})),this.d(A.smoothMoveWithRotationEvent.don((u,f,B)=>{l()||Ge(t,A.id,u,f,B)})),this.d(A.smoothMoveOnGroundEvent.don((u,f,B,w)=>{l()||ke(t,A.id,u,f,w,B)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((u,f,B,w,v)=>{l()||Ne(t,A.id,u,f,B,w,v)})),this.d(A.automaticLandingEvent.don(u=>{if(l())return;const f=[A.position[0],A.position[1]];e.getHeightByLonLat(A.position[0],A.position[1],"Visibility").then(B=>{B!==null&&(A.position=[...f,B],A.collision=u)})})),this.d(A.flyToEvent.don(async(u,f)=>{if(l())return;const B=await Be(t,A.id,u);let w="over";B===void 0?w="error":B.endType===0?w="over":B.endType===1&&(w="cancelled"),A.flyOverEvent.emit(f,w,e)})),this.d(A.calcFlyToParamEvent.don(()=>{l()||YA(t,A.id)})),this.d(A.calcFlyInParamEvent.don(async()=>{if(!e.actived)return;const u=await e.getCurrentCameraInfo();if(!u)return;const{position:f,rotation:B}=u;A.flyInParam={position:f,rotation:B,flyDuration:1}})),this.d(e.propChanged.don(u=>{l()||u.objId===A.id&&Object.keys(u.props).forEach(f=>{const B=u.props[f]===null?void 0:u.props[f];A[f]=B})}))}};p(ir,"type",ir.register("ESUeViewer",c.ESUnrealActor.type,ir));let Mi=ir;const or=class or extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(or,"type",or.register("ESUeViewer",c.ESVideoFusion.type,or));let Di=or;const ar=class ar extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ar,"type",ar.register("ESUeViewer",c.ESViewShed.type,ar));let Ri=ar;const lr=class lr extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};p(lr,"type",lr.register("ESUeViewer",c.ESVisibilityAnalysis.type,lr));let xi=lr;const cr=class cr extends dA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.ad(c.track([A,"volume"],[A,"cutAndFillVolume"])),this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.clearEvent.don(()=>{t.callUeFunc({f:"Clear",p:{id:A.id}})}))}};p(cr,"type",cr.register("ESUeViewer",c.ESVolumeMeasurement.type,cr));let Pi=cr;const xe=class xe extends QA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(xe,"type",xe.register("ESUeViewer",c.ESWidget.type,xe)),p(xe,"propValFuncs",{...QA.propValFuncs,info:A=>JSON.stringify(A??{})});let Ki=xe;const dr=class dr extends c.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}A.poi.actorTag=A.human.id,A.poi.positionOffset=[0,0,A.poiOffsetHeight-.8],this.d(A.poiOffsetHeightChanged.don(()=>{A.poi.positionOffset=[0,0,A.poiOffsetHeight-.8]})),this.d(()=>{A.poi.actorTag=""})}};p(dr,"type",dr.register("ESUeViewer",c.ESHumanPoi.type,dr));let Gi=dr;c.ESSceneObject.context.getStrFromEnv(c.ESNavigator.defaults.imgUrl);const ur=class ur extends c.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=this.disposeVar(new c.ESCustomDiv);e.add(n),this.dispose(()=>e.delete(n)),this.dispose(c.track([n,"show"],[A,"show"])),n.instanceClass=class extends c.Destroyable{constructor(i,o,a){super(),this._subContainer=i;const l=document.createElement("div");this._subContainer.appendChild(l),this.dispose(()=>this._subContainer.removeChild(l));{const u=async()=>{const f=await e.getCurrentCameraInfo(),B=f==null?void 0:f.position,v=[...f==null?void 0:f.rotation];v[0]=360,e.flyIn(B,v)};l.addEventListener("click",u),l.style.cursor="pointer",this.dispose(()=>l.removeEventListener("click",u))}{const u=()=>{l.style.width=`${A.cssSize?A.cssSize:c.ESNavigator.defaults.cssSize}px`,l.style.height=`${A.cssSize?A.cssSize:c.ESNavigator.defaults.cssSize}px`};u(),A.dispose(A.cssSizeChanged.disposableOn(u))}l.style.position="fixed";{const u=()=>{l.style.top=`${A.cssPosition?A.cssPosition[0]:c.ESNavigator.defaults.cssPosition[0]}px`,l.style.right=`${A.cssPosition?A.cssPosition[1]:c.ESNavigator.defaults.cssPosition[1]}px`};u(),A.dispose(A.cssPositionChanged.disposableOn(u))}l.style.transition=" right 0.4s linear",l.style.cursor="pointer";const d=document.createElement("div");l.appendChild(d),this.dispose(()=>l.removeChild(d)),d.style.width="100%",d.style.height="100%",d.style.position="relative";const h=document.createElement("img");d.appendChild(h),this.dispose(()=>d.removeChild(h)),h.style.width="100%",h.style.height="100%",h.style.border="none";{const u=()=>h.src=A.imgUrl;u(),A.dispose(A.imgUrlChanged.disposableOn(u))}{const u=()=>{const v=-e.getCurrentCameraInfo().rotation[0];h.style.transform=`rotate(${v}deg)`};let f;const B=async()=>{u(),A.show?(l.style.display="block",f=setInterval(()=>{u()},1e3)):(l.style.display="none",clearInterval(f))};this.dispose(A.showChanged.disposableOn(B)),B(),this.dispose(()=>clearInterval(f))}h.style.transformOrigin="50% 50%"}}}};p(ur,"type",ur.register("ESUeViewer",c.ESNavigator.type,ur));let ki=ur;const le=class le extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}{const n=()=>{t.callUeFunc({f:"update",p:{id:A.id,materialMode:A.materialMode}})};this.dispose(A.materialModeChanged.disposableOn(n))}}};p(le,"type",le.register("ESUeViewer",c.ESPath.type,le)),p(le,"forceUeUpdateProps",[...rA.forceUeUpdateProps]),p(le,"propValFuncs",{...rA.propValFuncs});let Ni=le;async function Zw(r){navigator.clipboard.writeText(r).then(function(){console.log("复制成功")},function(A){console.log("复制失败")})}const hr=class hr extends c.EngineObject{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}const n=this.disposeVar(new c.ESCustomDiv);e.add(n),this.dispose(()=>e.delete(n)),n.instanceClass=class extends c.Destroyable{constructor(i,o,a){if(super(),this._subContainer=i,!a||!(a instanceof LA))return;const l=document.createElement("div");this._subContainer.appendChild(l),this.dispose(()=>this._subContainer.removeChild(l)),l.style.width="100%",l.style.position="absolute",l.style.height=`${c.ESViewerStatusBar.defaults.height}px`,l.style.left="0",l.style.bottom="0",l.style.color="#fff",l.style.padding="0 20px 0 0",l.style.boxSizing="border-box",l.style.lineHeight=`${c.ESViewerStatusBar.defaults.height}px`,l.style.zIndex="100",l.style.alignContent="center",l.style.justifyContent="space-between";const d=document.createElement("span");l.appendChild(d),this.dispose(()=>l.removeChild(d));const h=document.createElement("span");d.appendChild(h),this.dispose(()=>d.removeChild(h));const u=document.createElement("span");d.appendChild(u),u.addEventListener("dblclick",function(){let B=u.innerHTML;B.startsWith("鼠标位置")&&(B=B.slice(5)),Zw(B)}),u.style.cursor="pointer",this.dispose(()=>d.removeChild(u));const f=document.createElement("span");l.appendChild(f),this.dispose(()=>l.removeChild(f));{const B=()=>{l.style.height=(A.height??c.ESViewerStatusBar.defaults.height)+"px",l.style.lineHeight=(A.height??c.ESViewerStatusBar.defaults.height)+"px"};this.dispose(A.heightChanged.disposableOn(B)),B()}{const B=()=>{l.style.fontSize=(A.fontSize??c.ESViewerStatusBar.defaults.fontSize)+"px"};this.dispose(A.fontSizeChanged.disposableOn(B)),B()}{const B=()=>{A.bgColor?l.style.background=`rgba(${A.bgColor[0]*255},${A.bgColor[1]*255},${A.bgColor[2]*255},${A.bgColor[3]})`:l.style.background=`rgba(${c.ESViewerStatusBar.defaults.bgColor[0]},${c.ESViewerStatusBar.defaults.bgColor[1]},${c.ESViewerStatusBar.defaults.bgColor[2]},${c.ESViewerStatusBar.defaults.bgColor[3]})`};this.dispose(A.bgColorChanged.disposableOn(B)),B()}a.getVersion().then(B=>{B&&(f.innerText=`Ue 版本 : ${B[0]} `)}).catch(B=>{console.log(B)});{const B=()=>{let m="",F="";m+=`帧率:${a.getFPS().toFixed(0)}FPS`,h.innerText=m;const E=e.getCurrentCameraInfo();m+=` 经度: ${E.position[0].toFixed(5)}° 纬度: ${E.position[1].toFixed(5)}° 高度: ${E.position[2].toFixed(2)}米 偏航角: ${E.rotation[0].toFixed(2)}° 俯仰角: ${E.rotation[1].toFixed(2)}° 翻滚角:${E.rotation[2].toFixed(2)}° `,h.innerText=m,e.pick().then(H=>{if(H){const{pickResult:S}=H;if(S&&S.position){const{position:U}=S;F+=`鼠标位置:${U[0].toFixed(5)}° ${U[1].toFixed(5)}° ${U[2].toFixed(2)}m`}else F+="暂时无法获取鼠标位置...";u.innerText=F}}).catch(H=>{console.log(H)})};let w;const v=async()=>{B(),A.show?(l.style.display="flex",w=setInterval(()=>{B()},1e3)):(l.style.display="none",clearInterval(w))};this.dispose(A.showChanged.disposableOn(v)),v(),this.dispose(()=>clearInterval(w))}}}}};p(hr,"type",hr.register("ESUeViewer",c.ESViewerStatusBar.type,hr));let _i=hr;const gr=class gr extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(gr,"type",gr.register("ESUeViewer",c.ESGaussianSplatting.type,gr));let Vi=gr;const Br=class Br extends qA{constructor(e,t){super(e,t);p(this,"_es3DTileset",this.dv(new c.ES3DTileset));if(!t.viewer){console.warn("viewer is undefined!");return}this.es3DTileset.parentID=e.id;{const s=this._es3DTileset;e.components.disposableAdd(s,!0),this.d(c.track([s,"allowPicking"],[e,"allowPicking"])),this.d(c.track([s,"collision"],[e,"collision"])),this.d(c.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(c.bind([s,"flyToParam"],[e,"flyToParam"])),this.d(c.track([s,"url"],[e,"url"])),this.d(c.track([s,"actorTag"],[e,"actorTag"])),this.d(c.track([s,"materialMode"],[e,"materialMode"])),this.d(c.track([s,"highlight"],[e,"highlight"])),this.d(c.track([s,"maximumScreenSpaceError"],[e,"maximumScreenSpaceError"])),this.d(c.track([s,"highlightID"],[e,"highlightID"])),this.d(c.track([s,"highlightColor"],[e,"highlightColor"])),this.d(c.bind([s,"offset"],[e,"offset"])),this.d(c.bind([s,"rotation"],[e,"rotation"])),this.d(c.track([s,"czmImageBasedLightingFactor"],[e,"czmImageBasedLightingFactor"])),this.d(c.track([s,"czmLuminanceAtZenith"],[e,"czmLuminanceAtZenith"])),this.d(c.track([s,"czmMaximumMemoryUsage"],[e,"czmMaximumMemoryUsage"])),this.d(c.track([s,"czmClassificationType"],[e,"czmClassificationType"])),this.d(c.track([s,"czmStyleJson"],[e,"czmStyleJson"])),this.d(c.track([s,"czmBackFaceCulling"],[e,"czmBackFaceCulling"])),this.d(c.track([s,"czmDebugShowBoundingVolume"],[e,"czmDebugShowBoundingVolume"])),this.d(c.track([s,"czmDebugShowContentBoundingVolume"],[e,"czmDebugShowContentBoundingVolume"])),this.d(c.track([s,"colorBlendMode"],[e,"colorBlendMode"])),this.d(c.track([s,"cacheBytes"],[e,"cacheBytes"])),this.d(c.track([s,"clippingPlaneEnabled"],[e,"clippingPlaneEnabled"])),this.d(c.track([s,"unionClippingRegions"],[e,"unionClippingRegions"])),this.d(c.track([s,"clippingPlaneEdgeColor"],[e,"clippingPlaneEdgeColor"])),this.d(c.track([s,"clippingPlaneEdgeWidth"],[e,"clippingPlaneEdgeWidth"])),this.d(c.track([s,"materialParams"],[e,"materialParams"])),this.d(c.bind([s,"supportEdit"],[e,"supportEdit"])),this.d(c.bind([s,"clippingPlanesId"],[e,"clippingPlanesId"])),this.d(c.bind([s,"clippingPlaneIds"],[e,"clippingPlaneIds"])),this.d(c.bind([s,"flattenedPlaneId"],[e,"flattenedPlaneId"])),this.d(c.bind([s,"flattenedPlaneEnabled"],[e,"flattenedPlaneEnabled"])),this.d(c.bind([s,"clippingPlaneId"],[e,"clippingPlaneId"])),this.d(c.bind([s,"excavateId"],[e,"excavateId"]))}{const s=this._es3DTileset;this.d(e.refreshTilesetEvent.don(()=>{s.refreshTileset()})),this.d(e.highlightFeatureEvent.don((...i)=>{s.highlightFeature(...i)})),this.d(e.highlightFeatureAndFlyToEvent.don((...i)=>{s.highlightFeatureAndFlyTo(...i)})),this.d(e.setFeatureColorEvent.don((...i)=>{s.setFeatureColor(...i)})),this.d(e.setFeatureVisableEvent.don((...i)=>{s.setFeatureVisable(...i)})),this.d(e.resetFeatureStyleEvent.don((...i)=>{s.resetFeatureStyle(...i)})),this.d(e.flyInEvent.don((...i)=>{s.flyIn(i[0])})),this.d(e.flyToEvent.don((...i)=>{s.flyTo(i[0])})),this.d(e.calcFlyToParamEvent.don((...i)=>{s.calcFlyToParam(...i)})),this.d(e.calcFlyInParamEvent.don((...i)=>{s.calcFlyInParam(...i)}))}{const s=this._es3DTileset;this.d(s.tilesetReady.don(i=>{e.tilesetReady.emit(i)})),this.d(s.pickedEvent.don(i=>{i.assign({sceneObject:e}),e.pickedEvent.emit(i)}))}{const s=()=>{this.es3DTileset.show=e.show};s(),this.d(e.showChanged.don(()=>{s()}))}}get es3DTileset(){return this._es3DTileset}};p(Br,"type",Br.register("ESUeViewer",c.ESRtsFeatureEditing.type,Br));let Oi=Br;const fr=class fr extends qA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(fr,"type",fr.register("ESUeViewer",c.ESMsTileset.type,fr));let Wi=fr;const wr=class wr extends dA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}const n=()=>{t.callUeFunc({f:"update",p:{id:A.id,height:A.height??c.ESGeoExtrudedPolygon.defaults.height,extrudedHeight:A.extrudedHeight??c.ESGeoExtrudedPolygon.defaults.extrudedHeight,perPositionHeight:A.perPositionHeight??c.ESGeoExtrudedPolygon.defaults.perPositionHeight}})},s=this.disposeVar(c.createNextAnimateFrameEvent(A.heightChanged,A.extrudedHeightChanged,A.perPositionHeightChanged));this.dispose(s.disposableOn(n)),this.dispose(A.createdEvent.disposableOn(n))}};p(wr,"type",wr.register("ESUeViewer",c.ESGeoExtrudedPolygon.type,wr));let Xi=wr;const pr=class pr extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(pr,"type",pr.register("ESUeViewer",c.ESStaticMesh.type,pr));let Ji=pr;const Cr=class Cr extends rA{constructor(A,e){super(A,e);const t=e.viewer;if(!t){console.warn("viewer is undefined!");return}this.d(A.startEvent.don(()=>{t.callUeFunc({f:"Start",p:{id:A.id}})})),this.d(A.clearEvent.don(()=>{t.callUeFunc({f:"Clear",p:{id:A.id}})}))}};p(Cr,"type",Cr.register("ESUeViewer",c.ESSkylineAnalysis.type,Cr));let zi=Cr;C.copyright=void 0;try{const r="earthsdk3-ue",A="3.5.0",e="2025-10-30T00:53:02.000Z",t="北京西部世界科技有限公司",n="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",s="cda73626e40b80da99887fe7a1decdbccc6aa5d9",o=((Date.now()-1761785582e3)/36e5).toFixed(1),a=`%c🌏 ${r}%c ${A}.${s.slice(0,8)}.${e} (距今${o}个小时)
|
|
113
113
|
%c${n?n+`
|
|
114
114
|
`:""}当前网站正在使用${r},此软件版权归${t}所有
|
|
115
|
-
`;C.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","
|
|
115
|
+
`;C.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","cda73626e40b80da99887fe7a1decdbccc6aa5d9")},get info(){return a},get date(){return"2025-10-30T00:53:02.000Z"},get author(){return"suplyang"},get version(){return"3.5.0"},get name(){return"earthsdk3-ue"},get commitId(){return"cda73626e40b80da99887fe7a1decdbccc6aa5d9"},print(l=!1){!l&&window._xe2_no_copy_print||console.info(this.info,`
|
|
116
116
|
font-size: 18px;
|
|
117
117
|
font-weight: 1000;
|
|
118
118
|
line-height: 1;
|