earthsdk3-ue 3.8.0 → 3.9.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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 $a{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 tu{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=$a.deepCopyGamepad(A.gamepad)),this.controllers[i].currentState=$a.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 tu(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,Ya.vertexShader()),this.gl.compileShader(t);const n=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(n,Ya.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 Ta({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 ru{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 nu{constructor(A,e){this._showActionOrErrorOnDisconnect=!0,this.allowConsoleCommands=!1,this.config=A,e!=null&&e.videoElementParent&&(this._videoElementParent=e.videoElementParent),this._eventEmitter=new La,this.configureSettings(),this.setWebRtcPlayerController(new za(this.config,this)),this.onScreenKeyboardHelper=new ru(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(M.MinQP,A=>{g.Log(g.GetStackTrace(),"-------- Sending MinQP --------",7),this._webRtcController.sendEncoderMinQP(A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(M.MaxQP,A=>{g.Log(g.GetStackTrace(),"-------- Sending encoder settings --------",7),this._webRtcController.sendEncoderMaxQP(A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(M.WebRTCMinBitrate,A=>{g.Log(g.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMinBitrate(1e3*A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(M.WebRTCMaxBitrate,A=>{g.Log(g.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMaxBitrate(1e3*A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(M.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 pa),this._webRtcController.connectToSignallingServer()}reconnect(){this._eventEmitter.dispatchEvent(new va),this._webRtcController.restartStreamAutomatically()}disconnect(){this._eventEmitter.dispatchEvent(new Ca),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 aa),this._showActionOrErrorOnDisconnect=!0}_onWebRtcSdp(){this._eventEmitter.dispatchEvent(new oa)}_onStreamLoading(){this._eventEmitter.dispatchEvent(new wa)}_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 ua({eventString:A,showActionOrErrorOnDisconnect:this._showActionOrErrorOnDisconnect})),this._showActionOrErrorOnDisconnect==0&&(this._showActionOrErrorOnDisconnect=!0)}_onWebRtcConnecting(){this._eventEmitter.dispatchEvent(new la)}_onWebRtcConnected(){this._eventEmitter.dispatchEvent(new ca)}_onWebRtcFailed(){this._eventEmitter.dispatchEvent(new da)}_onVideoInitialized(){this._eventEmitter.dispatchEvent(new fa),this._videoStartTime=Date.now()}_onLatencyTestResult(A){this._eventEmitter.dispatchEvent(new Sa({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 Ea({aggregatedStats:A}))}_onVideoEncoderAvgQP(A){this._eventEmitter.dispatchEvent(new ia({avgQP:A}))}_onInitialSettings(A){var e;this._eventEmitter.dispatchEvent(new Ia({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(M.MinQP,t&&n.has(M.MinQP)?Number.parseInt(n.get(M.MinQP)):A.EncoderSettings.MinQP),this.config.setNumericSetting(M.MaxQP,t&&n.has(M.MaxQP)?Number.parseInt(n.get(M.MaxQP)):A.EncoderSettings.MaxQP)),A.WebRTCSettings&&(this.config.setNumericSetting(M.WebRTCMinBitrate,t&&n.has(M.WebRTCMinBitrate)?Number.parseInt(n.get(M.WebRTCMinBitrate)):A.WebRTCSettings.MinBitrate/1e3),this.config.setNumericSetting(M.WebRTCMaxBitrate,t&&n.has(M.WebRTCMaxBitrate)?Number.parseInt(n.get(M.WebRTCMaxBitrate)):A.WebRTCSettings.MaxBitrate/1e3),this.config.setNumericSetting(M.WebRTCFPS,t&&n.has(M.WebRTCFPS)?Number.parseInt(n.get(M.WebRTCFPS)):A.WebRTCSettings.FPS))}_onQualityControlOwnership(A){this.config.setFlagEnabled(Q.IsQualityController,A)}_onPlayerCount(A){this._eventEmitter.dispatchEvent(new Ha({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 qa=T.De;T.$C,T.al,T._W,T.tz,T.Nu,T.zg,T.vp,T.vU,T.wF,T.rv,T.Nh,T.ss,T.qW,T.QL,T.cf,T.eM;var ja=T.Yd;T.iM,T.qy,T.ce;var Al=T.sK;T.Ok,T.q5;var el=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 tl=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 su={Response:1},Er={UIInteraction:50,MouseWheel:75};class iu 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]===su.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>=Er.UIInteraction&&s<=Er.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 ou=-1;ja.SetLoggerVerbosity(1);class au 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 qa({initialSettings:{AutoConnect:!0,AutoPlayVideo:!0,StartVideoMuted:!0,UseMic:!1,ForceMonoAudio:!1,KeyboardInput:!0,MouseInput:!0,TouchInput:!0,GamepadInput:!0,XRControllerInput:!0,SuppressBrowserKeys:!1,HoveringMouse:!0,FakeMouseWithTouches:!1,BrowserSendOffer:!1,ForceTURN:!1,PreferSFU:!1,IsQualityController:!0,MatchViewportResolution:!0,AFKDetection:!1,[tl.SignallingServerUrl]:t}});return n.setNumericSetting(Al.MaxReconnectAttempts,0),new el(n,{videoElementParent:e})}get pixelStream(){return this._pixelStream}_initEsMsgWsWrapper(e){return e?this.dv(new iu(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=++ou;if(this.esMsgWsWrapper){if(i<s){this.esMsgWsWrapper.emitDescriptorWithString(Er.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(Er.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 lu 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 au(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 cu extends Oe{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 lu(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:y}=w[m];if(E.push(H),++m,F+y>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 du(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 uu=r=>{const A={type:"input",inputdata:du(r)};return JSON.stringify(A)};function hu(r){return typeof r=="string"?document.getElementById(r):r}window.g_emitDescriptor_maxBytes=3e4;let gu=-1;ja.SetLoggerVerbosity(1);class Bu 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 qa({initialSettings:{AutoConnect:!0,AutoPlayVideo:!0,StartVideoMuted:!0,UseMic:!1,ForceMonoAudio:!1,KeyboardInput:!0,MouseInput:!0,TouchInput:!0,GamepadInput:!0,XRControllerInput:!0,SuppressBrowserKeys:!1,HoveringMouse:!0,FakeMouseWithTouches:!1,BrowserSendOffer:!1,ForceTURN:!1,PreferSFU:!1,IsQualityController:!0,MatchViewportResolution:!0,AFKDetection:!1,[tl.SignallingServerUrl]:this._option.ws}});n.setNumericSetting(Al.MaxReconnectAttempts,0),this._pixelStream=new el(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(uu(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 hu(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=++gu;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 fu 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 Bu(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 wu extends Oe{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 fu(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:y}=w[m];if(E.push(H),++m,F+y>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 pu 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 rl=typeof TextDecoder<"u"?new TextDecoder:void 0,Cu=(r,A=0,e=NaN)=>{const t=A+e;let n=A;for(;r[n]&&!(n>=t);)++n;if(n-A>16&&r.buffer&&rl)return rl.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 vu extends c.Destroyable{constructor(A,e,t){super();{const n=()=>{const a=Un(e);e.setGlobalProperty(a)};n();const s=Fr(),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 mu=-1;class Fu extends Oe{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 pu(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 vu(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=Cu(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(([y])=>y),B={n:d++,tt:Date.now(),t:"c",fs:f,callid:c.createGuid()};for(const[y,U]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(y.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=++mu;if(m<v){const y=`${F}-0/1-`+w;l.UE_JSHTML5Communication.JSSendMessageToUE(y);return}const E=Math.ceil(m/v)|0;[...new Array(E).keys()].map(y=>w.slice(y*v,(y+1)*v)).forEach((y,U)=>{const D=`${F}-${U}/${E}-`+y;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 Qu=-1;class Uu extends Oe{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("init-0/1-"+JSON.stringify(i)).then(()=>{s=!0}).catch(d=>{console.error(d)}),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=++Qu;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 Eu extends c.Destroyable{constructor(A,e){super();{const t=()=>{const o=Un(A);A.setGlobalProperty(o)};t();const n=Fr(),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 yu extends c.Destroyable{constructor(A,e,t){super();{const s=()=>{const l=Un(e);e.setGlobalProperty(l)};s();const i=Fr(),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 Su 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 Uu(e,n));this.d(()=>n.viewer=void 0),n.viewer=h,n.setStatus("Created"),n.setStatusLog("本地视口创建成功!"),this.dv(new yu(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,m;if(s(t.options,"ws")){const{ws:y,esmsg:U,uselnternalSignallingServer:D,silentTime:R}=t.options;B=y,w=U,v=D??!1,m=R??0}if(s(t.options,"uri")&&s(t.options,"app")){const{offsetWidth:y,offsetHeight:U}=h;let{uri:D,app:R,token:b,silentTime:W}=t.options;D.endsWith("/")||(D+="/");const iA=b?`?essstoken=${b}`:"",oA=`/${R}/${y??1920}/${U??1080}`+iA;console.log(`请求信令服务器: ${D}instance${oA}`);const G=await f.promise(fetch(`${D}instance${oA}`,{method:"GET"})),O=await f.promise(G.json());if(O&&O.status!=="ok"){n.setStatus("Error"),n.setStatusLog(`信令服务器请求失败 ${O.status}`),this._reconnectEvent.emit(void 0);return}else{console.log(`信令服务器请求成功! ${JSON.stringify(O,void 0," ")}`);const{server:SA,esmsg:aA,instanceId:lA,useInternalSignallingServer:xA}=O;if(!lA){n.setStatus("Error"),n.setStatusLog("检查信令服务器版本,返回数据错误! "),console.log("信令服务器返回数据错误!不包含instanceId!请升级到 ESSS V3.0+ 版本!"),this._reconnectEvent.emit(void 0);return}B=SA,w=aA,v=xA??!1,m=W??0,n.esssResponse=O}}console.log(`静默 ${m}s...`),await f.promise(c.sleep((m??0)*1e3)),console.log(`静默 ${m}s...done!`);const F=this.dv(v?new wu(h,B,w,n):new cu(h,B,w,n));this.d(()=>n.viewer=void 0),this.d(F.errorEvent.don(y=>{const U=`[${y}]:像素流连接错误!`;n.setStatus("Error"),n.setStatusLog(U),this._reconnectEvent.emit(F)})),await f.promise(new Promise(y=>this.d(F.readyEvent.donce(y)))),n.setStatus("Created"),n.setStatusLog("云渲染视口创建成功!"),i=0,o&&clearTimeout(o),o=void 0;const{offsetWidth:E,offsetHeight:H}=h;F.resize(E*window.devicePixelRatio,H*window.devicePixelRatio),n.viewer=F,this.d(()=>n.viewer=void 0),this.dv(new Eu(n,F))}));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 Fu(e,u,f,n));n.viewer=B,this.d(()=>n.viewer=void 0)}else n.setStatus("Error"),n.setStatusLog("视口创建失败!"),console.warn("视口创建失败: 参数错误!")}}const se=class se 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 Su(this.subContainer,t,this)}))}get defaultProps(){return se.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 Fo(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 yn(this.viewer,e)}async getAllSocketNamesByActorTag(e){if(!this.viewer){console.warn("GetAllSocketNamesByActorTag: viewer is undefined");return}return await Qo(this.viewer,e)}async getBoundSphere(e){if(!this.viewer){console.warn("getBoundSphere: viewer is undefined");return}return await Eo(this.viewer,e)}async getBoundSphereWithChildren(e){if(!this.viewer){console.warn("getBoundSphereWithChildren: viewer is undefined");return}return await yo(this.viewer,e)}async getStrokeMaterialParamInfo(e){if(!this.viewer){console.warn("GetStrokeMaterialParamInfo: viewer is undefined");return}return await So(this.viewer,e)}async getFillMaterialParamInfo(e){if(!this.viewer){console.warn("getFillMaterialParamInfo: viewer is undefined");return}return await Io(this.viewer,e)}async getGlobalProperty(e){if(!this.viewer){console.warn("getGlobalProperty: viewer is undefined");return}return await To(this.viewer,e)}async getObjectByInfo(e){if(!this.viewer){console.warn("GetObjectByInfo: viewer is undefined");return}return await Ho(this.viewer,e)}async defaultCameraFlyIn(e=1){if(!this.viewer){console.warn("DefaultCameraFlyIn: viewer is undefined");return}return await Ao(this.viewer,e)}async startVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await eo(this.viewer)}async stopVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await to(this.viewer)}async mountPakFiles(e){if(!this.viewer){console.warn("mountPakFiles:viewer is undefined");return}return await ro(this.viewer,e)}async generateMemReport(){if(!this.viewer){console.warn("generateMemReport:viewer is undefined");return}return await no(this.viewer)}async quit(){if(!this.viewer){console.warn("Quit: viewer is undefined");return}return await go(this.viewer)}async bindActorByTag(e,t){if(!this.viewer){console.warn("BindActorByTag: viewer is undefined");return}return await Lo(this.viewer,e,t)}async restoreOriginalScene(){if(!this.viewer){console.warn("RestoreOriginalScene: viewer is undefined");return}return await bo(this.viewer)}async unBindActorByID(e){if(!this.viewer){console.warn("UnBindActorByID: viewer is undefined");return}return await Mo(this.viewer,e)}async unBindActorByTag(e){if(!this.viewer){console.warn("UnBindActorByTag: viewer is undefined");return}return await Do(this.viewer,e)}async createActorByClass(e,t){if(!this.viewer){console.warn("CreateActorByClass: viewer is undefined");return}return await Ro(this.viewer,e,t)}async bind3DTilesetByTag(e,t){if(!this.viewer){console.warn("Bind3DTilesetByTag: viewer is undefined");return}return await xo(this.viewer,e,t)}async unBind3DTilesetByTag(e){if(!this.viewer){console.warn("UnBind3DTilesetByTag: viewer is undefined");return}return await Po(this.viewer,e)}async unBind3DTilesetById(e){if(!this.viewer){console.warn("UnBind3DTilesetById: viewer is undefined");return}return await Ko(this.viewer,e)}async bindImageryByTag(e,t,n){if(!this.viewer){console.warn("BindImageryByTag: viewer is undefined");return}return await Go(this.viewer,e,t,n)}async unBindImageryByTag(e,t){if(!this.viewer){console.warn("UnBindImageryByTag: viewer is undefined");return}return await ko(this.viewer,e,t)}async unBindImageryById(e){if(!this.viewer){console.warn("UnBindImageryById: viewer is undefined");return}return await No(this.viewer,e)}async getIdByComponentNameAndHitItem(e,t,n){if(!this.viewer){console.warn("GetIdByComponentNameAndHitItem: viewer is undefined");return}return await _o(this.viewer,e,t,n)}async getCameraRelativeHeight(e="ECC_Visibility"){if(!this.viewer){console.warn("GetCameraRelativeHeight: viewer is undefined");return}return await Vo(this.viewer,e)}async saveStringToFile(e,t,n){if(!this.viewer){console.warn("SaveStringToFile: viewer is undefined");return}return await Oo(this.viewer,e,t,n)}async highlightActorByTag(e,t=!0){if(!this.viewer){console.warn("HighlightActorByTag: viewer is undefined");return}return await Wo(this.viewer,e,t)}async sendCustomMessage(e){if(!this.viewer){console.warn("SendCustomMessage: viewer is undefined");return}return await Xo(this.viewer,e)}async getStatus(){if(!this.viewer){console.warn("GetStatus:viewer is undefined");return}return await Jo(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 Bo(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 fo(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 Ge(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 we(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 Uo(this.viewer);return e.esforue=t,e}async getHeightByLonLat(e,t,n="ECC_Visibility"){if(!this.viewer)return null;const s=await wo(this.viewer,e,t,n);return s&&s.height!==void 0?s.height:null}async getHeightsByLonLats(e,t="ECC_Visibility"){return this.viewer?await po(this.viewer,e,t):void 0}async capture(e=64,t=64){return this.viewer?await Co(this.viewer,e,t):void 0}async partialCapture(e,t=[64,64]){if(!this.viewer){console.warn("partialCapture:viewer is undefined");return}return await vo(this.viewer,e,t)}async lonLatAltToScreenPosition(e){if(!this.viewer)return;const t=await mo(this.viewer,e);return t&&[t.X,t.Y]}async setGlobalProperty(e){if(this.viewer)return await ho(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 zo(this.viewer,s.id,s.editingID,i,n.useKeyToSwitch)}async stopEditing(){if(this.viewer)return await Yo(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 $o(this.viewer,t,n)}};p(se,"type",se.register("ESUeViewer",se)),p(se,"defaults",{...fe});let LA=se;(r=>{r.createDefaultProps=()=>({...c.ESViewer.createDefaultProps(),...qi(),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 jA 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&&En(t,A.id)}),t.callUeFunc({f:"create",p:{type:A.typeName,id:A.id}}).then(()=>{n.value=!0}).catch(s=>console.error(s)))}}p(jA,"propValFuncs",{ref:null,devTags:null,extras:null,execOnceFuncStr:null,updateFuncStr:null,toDestroyFuncStr:null}),p(jA,"forceUeUpdateProps",[]);class Y extends jA{constructor(A,e){super(A,e);const t=e.viewer;t&&(this.d(A.flyToEvent.don(n=>{we(t,A.id,n)})),this.d(A.flyInEvent.don(n=>{var s,i;Ge(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(()=>{$A(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 Y{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)=>{Ve(t,A.id,a,l)})),this.d(A.smoothMoveWithRotationEvent.don((a,l,d)=>{ke(t,A.id,a,l,d)})),this.d(A.smoothMoveOnGroundEvent.don((a,l,d,h)=>{Ne(t,A.id,a,l,h,d)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((a,l,d,h,u)=>{_e(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 Y{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",{...Y.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 Kn extends P{constructor(A,e){super(A,e),e.viewer}}p(Kn,"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 yr extends Kn{constructor(A,e){super(A,e),e.viewer}}const nl=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag但对应的Actor不是3dTileset,无法绑定";default:return"未知错误"}},gt=class gt 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: ${nl(w.re.type)}`);else{console.warn(`UeES3DTileset Bind3DTilesetByTag: ${nl(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(()=>{ji(n,e.id)})),this.d(e.flyToEvent.don(async(h,u)=>{if(!s&&!i)return;const f=await we(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||$A(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(gt,"type",gt.register("ESUeViewer",c.ES3DTileset.type,gt));let Sr=gt;const sl=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag对应的Actor是地形,无法绑定";case 4:return"没搜索到ComponentTag,无法绑定";default:return"未知错误"}},Bt=class Bt 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: ${sl(v.re.type)}`);else{console.warn(`ESImageryLayer BindImageryByTag: ${sl(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 we(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 Ge(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||$A(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(Bt,"type",Bt.register("ESUeViewer",c.ESImageryLayer.type,Bt));let Gn=Bt;const ie=class ie extends Y{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ie,"type",ie.register("ESUeViewer",c.ESTerrainLayer.type,ie)),p(ie,"forceUeUpdateProps",[...Y.forceUeUpdateProps,"url"]),p(ie,"propValFuncs",{...Y.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 kn=ie;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.ESAlarm.type,ft));let Nn=ft;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.ESApertureEffect.type,wt));let _n=wt;const pt=class pt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(pt,"type",pt.register("ESUeViewer",c.ESGeoPolygon.type,pt));let uA=pt;const Ct=class Ct extends uA{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(Ct,"type",Ct.register("ESUeViewer",c.ESAreaMeasurement.type,Ct));let Vn=Ct;const vt=class vt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(vt,"type",vt.register("ESUeViewer",c.ESBlastParticleSystem.type,vt));let On=vt;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.ESBoxClipping.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 Wn=be;const mt=class mt 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;Ge(t,o,l,d,a??n,i)})),this.dispose(A.resetWithCurrentCameraEvent.don(()=>{yn(t,A.id)})),this.dispose(A.captureEvent.don((n,s)=>{e.capture(n,s).then(o=>{o&&(A.thumbnail=o)})}))}};p(mt,"type",mt.register("ESUeViewer",c.ESCameraView.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.ESCameraVisibleRange.type,Ft));let Jn=Ft;const Qt=class Qt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Qt,"type",Qt.register("ESUeViewer",c.ESCar.type,Qt));let zn=Qt;const Ut=class Ut 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(Ut,"type",Ut.register("ESUeViewer",c.ESClassification.type,Ut));let Yn=Ut;const Me=class Me extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};p(Me,"type",Me.register("ESUeViewer",c.ESClippingPlane.type,Me)),p(Me,"propValFuncs",{...P.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let $n=Me;const Et=class Et 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(Et,"type",Et.register("ESUeViewer",c.ESDataMesh.type,Et));let Zn=Et;const yt=class yt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(yt,"type",yt.register("ESUeViewer",c.ESDatasmithRuntimeModel.type,yt));let qn=yt;const St=class St extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(St,"type",St.register("ESUeViewer",c.ESDirectionMeasurement.type,St));let jn=St;const It=class It 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(It,"type",It.register("ESUeViewer",c.ESDistanceMeasurement.type,It));let As=It;const Tt=class Tt extends yr{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Tt,"type",Tt.register("ESUeViewer",c.ESLocalPolygon.type,Tt));let Ir=Tt;const Ht=class Ht extends Ir{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Ht,"type",Ht.register("ESUeViewer",c.ESDynamicWater.type,Ht));let es=Ht;const Lt=class Lt extends Y{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(Lt,"type",Lt.register("ESUeViewer",c.ESEntityCluster.type,Lt));let ts=Lt;const De=class De extends uA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(De,"type",De.register("ESUeViewer",c.ESExcavate.type,De)),p(De,"propValFuncs",{...uA.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let rs=De;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.ESFireParticleSystem.type,bt));let ns=bt;const Mt=class Mt extends Y{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(Mt,"type",Mt.register("ESUeViewer",c.ESForestTileset.type,Mt));let ss=Mt;/*!
|
|
91
|
+
`}}class $a{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 tu{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=$a.deepCopyGamepad(A.gamepad)),this.controllers[i].currentState=$a.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 tu(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,Ya.vertexShader()),this.gl.compileShader(t);const n=this.gl.createShader(this.gl.FRAGMENT_SHADER);this.gl.shaderSource(n,Ya.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 Ta({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 ru{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 nu{constructor(A,e){this._showActionOrErrorOnDisconnect=!0,this.allowConsoleCommands=!1,this.config=A,e!=null&&e.videoElementParent&&(this._videoElementParent=e.videoElementParent),this._eventEmitter=new La,this.configureSettings(),this.setWebRtcPlayerController(new za(this.config,this)),this.onScreenKeyboardHelper=new ru(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(M.MinQP,A=>{g.Log(g.GetStackTrace(),"-------- Sending MinQP --------",7),this._webRtcController.sendEncoderMinQP(A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(M.MaxQP,A=>{g.Log(g.GetStackTrace(),"-------- Sending encoder settings --------",7),this._webRtcController.sendEncoderMaxQP(A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(M.WebRTCMinBitrate,A=>{g.Log(g.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMinBitrate(1e3*A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(M.WebRTCMaxBitrate,A=>{g.Log(g.GetStackTrace(),"-------- Sending web rtc settings --------",7),this._webRtcController.sendWebRTCMaxBitrate(1e3*A),g.Log(g.GetStackTrace(),"-------------------------------------------",7)}),this.config._addOnNumericSettingChangedListener(M.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 pa),this._webRtcController.connectToSignallingServer()}reconnect(){this._eventEmitter.dispatchEvent(new va),this._webRtcController.restartStreamAutomatically()}disconnect(){this._eventEmitter.dispatchEvent(new Ca),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 aa),this._showActionOrErrorOnDisconnect=!0}_onWebRtcSdp(){this._eventEmitter.dispatchEvent(new oa)}_onStreamLoading(){this._eventEmitter.dispatchEvent(new wa)}_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 ua({eventString:A,showActionOrErrorOnDisconnect:this._showActionOrErrorOnDisconnect})),this._showActionOrErrorOnDisconnect==0&&(this._showActionOrErrorOnDisconnect=!0)}_onWebRtcConnecting(){this._eventEmitter.dispatchEvent(new la)}_onWebRtcConnected(){this._eventEmitter.dispatchEvent(new ca)}_onWebRtcFailed(){this._eventEmitter.dispatchEvent(new da)}_onVideoInitialized(){this._eventEmitter.dispatchEvent(new fa),this._videoStartTime=Date.now()}_onLatencyTestResult(A){this._eventEmitter.dispatchEvent(new Sa({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 Ea({aggregatedStats:A}))}_onVideoEncoderAvgQP(A){this._eventEmitter.dispatchEvent(new ia({avgQP:A}))}_onInitialSettings(A){var e;this._eventEmitter.dispatchEvent(new Ia({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(M.MinQP,t&&n.has(M.MinQP)?Number.parseInt(n.get(M.MinQP)):A.EncoderSettings.MinQP),this.config.setNumericSetting(M.MaxQP,t&&n.has(M.MaxQP)?Number.parseInt(n.get(M.MaxQP)):A.EncoderSettings.MaxQP)),A.WebRTCSettings&&(this.config.setNumericSetting(M.WebRTCMinBitrate,t&&n.has(M.WebRTCMinBitrate)?Number.parseInt(n.get(M.WebRTCMinBitrate)):A.WebRTCSettings.MinBitrate/1e3),this.config.setNumericSetting(M.WebRTCMaxBitrate,t&&n.has(M.WebRTCMaxBitrate)?Number.parseInt(n.get(M.WebRTCMaxBitrate)):A.WebRTCSettings.MaxBitrate/1e3),this.config.setNumericSetting(M.WebRTCFPS,t&&n.has(M.WebRTCFPS)?Number.parseInt(n.get(M.WebRTCFPS)):A.WebRTCSettings.FPS))}_onQualityControlOwnership(A){this.config.setFlagEnabled(Q.IsQualityController,A)}_onPlayerCount(A){this._eventEmitter.dispatchEvent(new Ha({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 qa=T.De;T.$C,T.al,T._W,T.tz,T.Nu,T.zg,T.vp,T.vU,T.wF,T.rv,T.Nh,T.ss,T.qW,T.QL,T.cf,T.eM;var ja=T.Yd;T.iM,T.qy,T.ce;var Al=T.sK;T.Ok,T.q5;var el=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 tl=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 su={Response:1},Er={UIInteraction:50,MouseWheel:75};class iu 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]===su.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>=Er.UIInteraction&&s<=Er.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 ou=-1;ja.SetLoggerVerbosity(1);class au 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 qa({initialSettings:{AutoConnect:!0,AutoPlayVideo:!0,StartVideoMuted:!0,UseMic:!1,ForceMonoAudio:!1,KeyboardInput:!0,MouseInput:!0,TouchInput:!0,GamepadInput:!0,XRControllerInput:!0,SuppressBrowserKeys:!1,HoveringMouse:!0,FakeMouseWithTouches:!1,BrowserSendOffer:!1,ForceTURN:!1,PreferSFU:!1,IsQualityController:!0,MatchViewportResolution:!0,AFKDetection:!1,[tl.SignallingServerUrl]:t}});return n.setNumericSetting(Al.MaxReconnectAttempts,0),new el(n,{videoElementParent:e})}get pixelStream(){return this._pixelStream}_initEsMsgWsWrapper(e){return e?this.dv(new iu(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=++ou;if(this.esMsgWsWrapper){if(i<s){this.esMsgWsWrapper.emitDescriptorWithString(Er.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(Er.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 lu 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 au(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 cu extends Oe{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 lu(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:y}=w[m];if(E.push(H),++m,F+y>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 du(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 uu=r=>{const A={type:"input",inputdata:du(r)};return JSON.stringify(A)};function hu(r){return typeof r=="string"?document.getElementById(r):r}window.g_emitDescriptor_maxBytes=3e4;let gu=-1;ja.SetLoggerVerbosity(1);class Bu 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 qa({initialSettings:{AutoConnect:!0,AutoPlayVideo:!0,StartVideoMuted:!0,UseMic:!1,ForceMonoAudio:!1,KeyboardInput:!0,MouseInput:!0,TouchInput:!0,GamepadInput:!0,XRControllerInput:!0,SuppressBrowserKeys:!1,HoveringMouse:!0,FakeMouseWithTouches:!1,BrowserSendOffer:!1,ForceTURN:!1,PreferSFU:!1,IsQualityController:!0,MatchViewportResolution:!0,AFKDetection:!1,[tl.SignallingServerUrl]:this._option.ws}});n.setNumericSetting(Al.MaxReconnectAttempts,0),this._pixelStream=new el(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(uu(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 hu(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=++gu;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 fu 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 Bu(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 wu extends Oe{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 fu(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:y}=w[m];if(E.push(H),++m,F+y>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 pu 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 rl=typeof TextDecoder<"u"?new TextDecoder:void 0,Cu=(r,A=0,e=NaN)=>{const t=A+e;let n=A;for(;r[n]&&!(n>=t);)++n;if(n-A>16&&r.buffer&&rl)return rl.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 vu extends c.Destroyable{constructor(A,e,t){super();{const n=()=>{const a=Un(e);e.setGlobalProperty(a)};n();const s=Fr(),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 mu=-1;class Fu extends Oe{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 pu(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 vu(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=Cu(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(([y])=>y),B={n:d++,tt:Date.now(),t:"c",fs:f,callid:c.createGuid()};for(const[y,U]of this._ueFuncWithIdAndResultCallbacks)this._waitingUeFuncIdAndResultCallbacks.set(y.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=++mu;if(m<v){const y=`${F}-0/1-`+w;l.UE_JSHTML5Communication.JSSendMessageToUE(y);return}const E=Math.ceil(m/v)|0;[...new Array(E).keys()].map(y=>w.slice(y*v,(y+1)*v)).forEach((y,U)=>{const D=`${F}-${U}/${E}-`+y;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 Qu=-1;class Uu extends Oe{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("init-0/1-"+JSON.stringify(i)).then(()=>{s=!0}).catch(d=>{console.error(d)}),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=++Qu;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 Eu extends c.Destroyable{constructor(A,e){super();{const t=()=>{const o=Un(A);A.setGlobalProperty(o)};t();const n=Fr(),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 yu extends c.Destroyable{constructor(A,e,t){super();{const s=()=>{const l=Un(e);e.setGlobalProperty(l)};s();const i=Fr(),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 Su 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 Uu(e,n));this.d(()=>n.viewer=void 0),n.viewer=h,n.setStatus("Created"),n.setStatusLog("本地视口创建成功!"),this.dv(new yu(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,m;if(s(t.options,"ws")){const{ws:y,esmsg:U,uselnternalSignallingServer:D,silentTime:R}=t.options;B=y,w=U,v=D??!1,m=R??0}if(s(t.options,"uri")&&s(t.options,"app")){const{offsetWidth:y,offsetHeight:U}=h;let{uri:D,app:R,token:b,silentTime:W}=t.options;D.endsWith("/")||(D+="/");const iA=b?`?essstoken=${b}`:"",oA=`/${R}/${y??1920}/${U??1080}`+iA;console.log(`请求信令服务器: ${D}instance${oA}`);const G=await f.promise(fetch(`${D}instance${oA}`,{method:"GET"})),O=await f.promise(G.json());if(O&&O.status!=="ok"){n.setStatus("Error"),n.setStatusLog(`信令服务器请求失败 ${O.status}`),this._reconnectEvent.emit(void 0);return}else{console.log(`信令服务器请求成功! ${JSON.stringify(O,void 0," ")}`);const{server:SA,esmsg:aA,instanceId:lA,useInternalSignallingServer:xA}=O;if(!lA){n.setStatus("Error"),n.setStatusLog("检查信令服务器版本,返回数据错误! "),console.log("信令服务器返回数据错误!不包含instanceId!请升级到 ESSS V3.0+ 版本!"),this._reconnectEvent.emit(void 0);return}B=SA,w=aA,v=xA??!1,m=W??0,n.esssResponse=O}}console.log(`静默 ${m}s...`),await f.promise(c.sleep((m??0)*1e3)),console.log(`静默 ${m}s...done!`);const F=this.dv(v?new wu(h,B,w,n):new cu(h,B,w,n));this.d(()=>n.viewer=void 0),this.d(F.errorEvent.don(y=>{const U=`[${y}]:像素流连接错误!`;n.setStatus("Error"),n.setStatusLog(U),this._reconnectEvent.emit(F)})),await f.promise(new Promise(y=>this.d(F.readyEvent.donce(y)))),n.setStatus("Created"),n.setStatusLog("云渲染视口创建成功!"),i=0,o&&clearTimeout(o),o=void 0;const{offsetWidth:E,offsetHeight:H}=h;F.resize(E,H),n.viewer=F,this.d(()=>n.viewer=void 0),this.dv(new Eu(n,F))}));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 Fu(e,u,f,n));n.viewer=B,this.d(()=>n.viewer=void 0)}else n.setStatus("Error"),n.setStatusLog("视口创建失败!"),console.warn("视口创建失败: 参数错误!")}}const se=class se 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 Su(this.subContainer,t,this)}))}get defaultProps(){return se.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 Fo(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 yn(this.viewer,e)}async getAllSocketNamesByActorTag(e){if(!this.viewer){console.warn("GetAllSocketNamesByActorTag: viewer is undefined");return}return await Qo(this.viewer,e)}async getBoundSphere(e){if(!this.viewer){console.warn("getBoundSphere: viewer is undefined");return}return await Eo(this.viewer,e)}async getBoundSphereWithChildren(e){if(!this.viewer){console.warn("getBoundSphereWithChildren: viewer is undefined");return}return await yo(this.viewer,e)}async getStrokeMaterialParamInfo(e){if(!this.viewer){console.warn("GetStrokeMaterialParamInfo: viewer is undefined");return}return await So(this.viewer,e)}async getFillMaterialParamInfo(e){if(!this.viewer){console.warn("getFillMaterialParamInfo: viewer is undefined");return}return await Io(this.viewer,e)}async getGlobalProperty(e){if(!this.viewer){console.warn("getGlobalProperty: viewer is undefined");return}return await To(this.viewer,e)}async getObjectByInfo(e){if(!this.viewer){console.warn("GetObjectByInfo: viewer is undefined");return}return await Ho(this.viewer,e)}async defaultCameraFlyIn(e=1){if(!this.viewer){console.warn("DefaultCameraFlyIn: viewer is undefined");return}return await Ao(this.viewer,e)}async startVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await eo(this.viewer)}async stopVoice(){if(!this.viewer){console.warn("startVoice:viewer is undefined");return}return await to(this.viewer)}async mountPakFiles(e){if(!this.viewer){console.warn("mountPakFiles:viewer is undefined");return}return await ro(this.viewer,e)}async generateMemReport(){if(!this.viewer){console.warn("generateMemReport:viewer is undefined");return}return await no(this.viewer)}async quit(){if(!this.viewer){console.warn("Quit: viewer is undefined");return}return await go(this.viewer)}async bindActorByTag(e,t){if(!this.viewer){console.warn("BindActorByTag: viewer is undefined");return}return await Lo(this.viewer,e,t)}async restoreOriginalScene(){if(!this.viewer){console.warn("RestoreOriginalScene: viewer is undefined");return}return await bo(this.viewer)}async unBindActorByID(e){if(!this.viewer){console.warn("UnBindActorByID: viewer is undefined");return}return await Mo(this.viewer,e)}async unBindActorByTag(e){if(!this.viewer){console.warn("UnBindActorByTag: viewer is undefined");return}return await Do(this.viewer,e)}async createActorByClass(e,t){if(!this.viewer){console.warn("CreateActorByClass: viewer is undefined");return}return await Ro(this.viewer,e,t)}async bind3DTilesetByTag(e,t){if(!this.viewer){console.warn("Bind3DTilesetByTag: viewer is undefined");return}return await xo(this.viewer,e,t)}async unBind3DTilesetByTag(e){if(!this.viewer){console.warn("UnBind3DTilesetByTag: viewer is undefined");return}return await Po(this.viewer,e)}async unBind3DTilesetById(e){if(!this.viewer){console.warn("UnBind3DTilesetById: viewer is undefined");return}return await Ko(this.viewer,e)}async bindImageryByTag(e,t,n){if(!this.viewer){console.warn("BindImageryByTag: viewer is undefined");return}return await Go(this.viewer,e,t,n)}async unBindImageryByTag(e,t){if(!this.viewer){console.warn("UnBindImageryByTag: viewer is undefined");return}return await ko(this.viewer,e,t)}async unBindImageryById(e){if(!this.viewer){console.warn("UnBindImageryById: viewer is undefined");return}return await No(this.viewer,e)}async getIdByComponentNameAndHitItem(e,t,n){if(!this.viewer){console.warn("GetIdByComponentNameAndHitItem: viewer is undefined");return}return await _o(this.viewer,e,t,n)}async getCameraRelativeHeight(e="ECC_Visibility"){if(!this.viewer){console.warn("GetCameraRelativeHeight: viewer is undefined");return}return await Vo(this.viewer,e)}async saveStringToFile(e,t,n){if(!this.viewer){console.warn("SaveStringToFile: viewer is undefined");return}return await Oo(this.viewer,e,t,n)}async highlightActorByTag(e,t=!0){if(!this.viewer){console.warn("HighlightActorByTag: viewer is undefined");return}return await Wo(this.viewer,e,t)}async sendCustomMessage(e){if(!this.viewer){console.warn("SendCustomMessage: viewer is undefined");return}return await Xo(this.viewer,e)}async getStatus(){if(!this.viewer){console.warn("GetStatus:viewer is undefined");return}return await Jo(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 Bo(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 fo(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 Ge(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 we(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 Uo(this.viewer);return e.esforue=t,e}async getHeightByLonLat(e,t,n="ECC_Visibility"){if(!this.viewer)return null;const s=await wo(this.viewer,e,t,n);return s&&s.height!==void 0?s.height:null}async getHeightsByLonLats(e,t="ECC_Visibility"){return this.viewer?await po(this.viewer,e,t):void 0}async capture(e=64,t=64){return this.viewer?await Co(this.viewer,e,t):void 0}async partialCapture(e,t=[64,64]){if(!this.viewer){console.warn("partialCapture:viewer is undefined");return}return await vo(this.viewer,e,t)}async lonLatAltToScreenPosition(e){if(!this.viewer)return;const t=await mo(this.viewer,e);return t&&[t.X,t.Y]}async setGlobalProperty(e){if(this.viewer)return await ho(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 zo(this.viewer,s.id,s.editingID,i,n.useKeyToSwitch)}async stopEditing(){if(this.viewer)return await Yo(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 $o(this.viewer,t,n)}};p(se,"type",se.register("ESUeViewer",se)),p(se,"defaults",{...fe});let LA=se;(r=>{r.createDefaultProps=()=>({...c.ESViewer.createDefaultProps(),...qi(),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 jA 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&&En(t,A.id)}),t.callUeFunc({f:"create",p:{type:A.typeName,id:A.id}}).then(()=>{n.value=!0}).catch(s=>console.error(s)))}}p(jA,"propValFuncs",{ref:null,devTags:null,extras:null,execOnceFuncStr:null,updateFuncStr:null,toDestroyFuncStr:null}),p(jA,"forceUeUpdateProps",[]);class Y extends jA{constructor(A,e){super(A,e);const t=e.viewer;t&&(this.d(A.flyToEvent.don(n=>{we(t,A.id,n)})),this.d(A.flyInEvent.don(n=>{var s,i;Ge(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(()=>{$A(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 Y{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)=>{Ve(t,A.id,a,l)})),this.d(A.smoothMoveWithRotationEvent.don((a,l,d)=>{ke(t,A.id,a,l,d)})),this.d(A.smoothMoveOnGroundEvent.don((a,l,d,h)=>{Ne(t,A.id,a,l,h,d)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((a,l,d,h,u)=>{_e(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 Y{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",{...Y.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 Kn extends P{constructor(A,e){super(A,e),e.viewer}}p(Kn,"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 yr extends Kn{constructor(A,e){super(A,e),e.viewer}}const nl=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag但对应的Actor不是3dTileset,无法绑定";default:return"未知错误"}},gt=class gt 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: ${nl(w.re.type)}`);else{console.warn(`UeES3DTileset Bind3DTilesetByTag: ${nl(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(()=>{ji(n,e.id)})),this.d(e.flyToEvent.don(async(h,u)=>{if(!s&&!i)return;const f=await we(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||$A(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(gt,"type",gt.register("ESUeViewer",c.ES3DTileset.type,gt));let Sr=gt;const sl=r=>{switch(r){case 0:return"成功绑定";case 1:return"解绑之前的内容,成功绑定";case 2:return"没搜索到ActorTag,无法绑定";case 3:return"搜索到ActorTag对应的Actor是地形,无法绑定";case 4:return"没搜索到ComponentTag,无法绑定";default:return"未知错误"}},Bt=class Bt 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: ${sl(v.re.type)}`);else{console.warn(`ESImageryLayer BindImageryByTag: ${sl(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 we(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 Ge(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||$A(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(Bt,"type",Bt.register("ESUeViewer",c.ESImageryLayer.type,Bt));let Gn=Bt;const ie=class ie extends Y{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ie,"type",ie.register("ESUeViewer",c.ESTerrainLayer.type,ie)),p(ie,"forceUeUpdateProps",[...Y.forceUeUpdateProps,"url"]),p(ie,"propValFuncs",{...Y.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 kn=ie;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.ESAlarm.type,ft));let Nn=ft;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.ESApertureEffect.type,wt));let _n=wt;const pt=class pt extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(pt,"type",pt.register("ESUeViewer",c.ESGeoPolygon.type,pt));let uA=pt;const Ct=class Ct extends uA{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(Ct,"type",Ct.register("ESUeViewer",c.ESAreaMeasurement.type,Ct));let Vn=Ct;const vt=class vt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(vt,"type",vt.register("ESUeViewer",c.ESBlastParticleSystem.type,vt));let On=vt;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.ESBoxClipping.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 Wn=be;const mt=class mt 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;Ge(t,o,l,d,a??n,i)})),this.dispose(A.resetWithCurrentCameraEvent.don(()=>{yn(t,A.id)})),this.dispose(A.captureEvent.don((n,s)=>{e.capture(n,s).then(o=>{o&&(A.thumbnail=o)})}))}};p(mt,"type",mt.register("ESUeViewer",c.ESCameraView.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.ESCameraVisibleRange.type,Ft));let Jn=Ft;const Qt=class Qt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Qt,"type",Qt.register("ESUeViewer",c.ESCar.type,Qt));let zn=Qt;const Ut=class Ut 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(Ut,"type",Ut.register("ESUeViewer",c.ESClassification.type,Ut));let Yn=Ut;const Me=class Me extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is underfined!");return}}};p(Me,"type",Me.register("ESUeViewer",c.ESClippingPlane.type,Me)),p(Me,"propValFuncs",{...P.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let $n=Me;const Et=class Et 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(Et,"type",Et.register("ESUeViewer",c.ESDataMesh.type,Et));let Zn=Et;const yt=class yt extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(yt,"type",yt.register("ESUeViewer",c.ESDatasmithRuntimeModel.type,yt));let qn=yt;const St=class St extends rA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(St,"type",St.register("ESUeViewer",c.ESDirectionMeasurement.type,St));let jn=St;const It=class It 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(It,"type",It.register("ESUeViewer",c.ESDistanceMeasurement.type,It));let As=It;const Tt=class Tt extends yr{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Tt,"type",Tt.register("ESUeViewer",c.ESLocalPolygon.type,Tt));let Ir=Tt;const Ht=class Ht extends Ir{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Ht,"type",Ht.register("ESUeViewer",c.ESDynamicWater.type,Ht));let es=Ht;const Lt=class Lt extends Y{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(Lt,"type",Lt.register("ESUeViewer",c.ESEntityCluster.type,Lt));let ts=Lt;const De=class De extends uA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(De,"type",De.register("ESUeViewer",c.ESExcavate.type,De)),p(De,"propValFuncs",{...uA.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let rs=De;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.ESFireParticleSystem.type,bt));let ns=bt;const Mt=class Mt extends Y{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(Mt,"type",Mt.register("ESUeViewer",c.ESForestTileset.type,Mt));let ss=Mt;/*!
|
|
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
|
}`,gw=function(r){Bw(r,"."+Zs+uw+Zc+`
|
|
112
|
-
.`+qs+hw+Zc)},Bw=function(r,A){var e=r.ownerDocument;if(e){var t=e.createElement("style");t.textContent=A,r.appendChild(t)}},qc=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}(),fw=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)||(Ai(A)||vw(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 hA(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=qc.isSameOrigin(A),t=!js(A)&&this._options.useCORS===!0&&tA.SUPPORT_CORS_IMAGES&&!e,n=!js(A)&&!e&&!Ai(A)&&typeof this._options.proxy=="string"&&tA.SUPPORT_CORS_XHR&&!t,!e&&this._options.allowTaint===!1&&!js(A)&&!Ai(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,(mw(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}(),ww=/^data:image\/svg\+xml/i,pw=/^data:image\/.*;base64,/i,Cw=/^data:image\/.*/i,vw=function(r){return tA.SUPPORT_SVG_DRAWING||!Fw(r)},js=function(r){return Cw.test(r)},mw=function(r){return pw.test(r)},Ai=function(r){return r.substr(0,4)==="blob"},Fw=function(r){return r.substr(-3).toLowerCase()==="svg"||ww.test(r)},S=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}(),Te=function(r,A,e){return new S(r.x+(A.x-r.x)*e,r.y+(A.y-r.y)*e)},fn=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=Te(this.start,this.startControl,A),n=Te(this.startControl,this.endControl,A),s=Te(this.endControl,this.end,A),i=Te(t,n,A),o=Te(n,s,A),a=Te(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},Qw=function(){function r(A){var e=A.styles,t=A.bounds,n=it(e.borderTopLeftRadius,t.width,t.height),s=n[0],i=n[1],o=it(e.borderTopRightRadius,t.width,t.height),a=o[0],l=o[1],d=it(e.borderBottomRightRadius,t.width,t.height),h=d[0],u=d[1],f=it(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,y=t.height-w,U=e.borderTopWidth,D=e.borderRightWidth,R=e.borderBottomWidth,b=e.borderLeftWidth,W=N(e.paddingTop,A.bounds.width),iA=N(e.paddingRight,A.bounds.width),oA=N(e.paddingBottom,A.bounds.width),G=N(e.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||i>0?V(t.left+b/3,t.top+U/3,s-b/3,i-U/3,K.TOP_LEFT):new S(t.left+b/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 S(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 S(t.left+t.width-D/3,t.top+t.height-R/3),this.bottomLeftBorderDoubleOuterBox=B>0||w>0?V(t.left+b/3,t.top+y,B-b/3,w-R/3,K.BOTTOM_LEFT):new S(t.left+b/3,t.top+t.height-R/3),this.topLeftBorderDoubleInnerBox=s>0||i>0?V(t.left+b*2/3,t.top+U*2/3,s-b*2/3,i-U*2/3,K.TOP_LEFT):new S(t.left+b*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 S(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 S(t.left+t.width-D*2/3,t.top+t.height-R*2/3),this.bottomLeftBorderDoubleInnerBox=B>0||w>0?V(t.left+b*2/3,t.top+y,B-b*2/3,w-R*2/3,K.BOTTOM_LEFT):new S(t.left+b*2/3,t.top+t.height-R*2/3),this.topLeftBorderStroke=s>0||i>0?V(t.left+b/2,t.top+U/2,s-b/2,i-U/2,K.TOP_LEFT):new S(t.left+b/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 S(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 S(t.left+t.width-D/2,t.top+t.height-R/2),this.bottomLeftBorderStroke=B>0||w>0?V(t.left+b/2,t.top+y,B-b/2,w-R/2,K.BOTTOM_LEFT):new S(t.left+b/2,t.top+t.height-R/2),this.topLeftBorderBox=s>0||i>0?V(t.left,t.top,s,i,K.TOP_LEFT):new S(t.left,t.top),this.topRightBorderBox=a>0||l>0?V(t.left+F,t.top,a,l,K.TOP_RIGHT):new S(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 S(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=B>0||w>0?V(t.left,t.top+y,B,w,K.BOTTOM_LEFT):new S(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||i>0?V(t.left+b,t.top+U,Math.max(0,s-b),Math.max(0,i-U),K.TOP_LEFT):new S(t.left+b,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 S(t.left+t.width-D,t.top+U),this.bottomRightPaddingBox=h>0||u>0?V(t.left+Math.min(H,t.width-b),t.top+Math.min(E,t.height-R),Math.max(0,h-D),Math.max(0,u-R),K.BOTTOM_RIGHT):new S(t.left+t.width-D,t.top+t.height-R),this.bottomLeftPaddingBox=B>0||w>0?V(t.left+b,t.top+Math.min(y,t.height-R),Math.max(0,B-b),Math.max(0,w-R),K.BOTTOM_LEFT):new S(t.left+b,t.top+t.height-R),this.topLeftContentBox=s>0||i>0?V(t.left+b+G,t.top+U+W,Math.max(0,s-(b+G)),Math.max(0,i-(U+W)),K.TOP_LEFT):new S(t.left+b+G,t.top+U+W),this.topRightContentBox=a>0||l>0?V(t.left+Math.min(F,t.width+b+G),t.top+U+W,F>t.width+b+G?0:a-b+G,l-(U+W),K.TOP_RIGHT):new S(t.left+t.width-(D+iA),t.top+U+W),this.bottomRightContentBox=h>0||u>0?V(t.left+Math.min(H,t.width-(b+G)),t.top+Math.min(E,t.height+U+W),Math.max(0,h-(D+iA)),u-(R+oA),K.BOTTOM_RIGHT):new S(t.left+t.width-(D+iA),t.top+t.height-(R+oA)),this.bottomLeftContentBox=B>0||w>0?V(t.left+b+G,t.top+y,Math.max(0,B-(b+G)),w-(R+oA),K.BOTTOM_LEFT):new S(t.left+b+G,t.top+t.height-(R+oA))}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 fn(new S(r,l),new S(r,l-o),new S(a-i,A),new S(a,A));case K.TOP_RIGHT:return new fn(new S(r,A),new S(r+i,A),new S(a,l-o),new S(a,l));case K.BOTTOM_RIGHT:return new fn(new S(a,A),new S(a,A+o),new S(r+i,l),new S(r,l));case K.BOTTOM_LEFT:default:return new fn(new S(a,l),new S(a-i,l),new S(r,A+o),new S(r,A))}},wn=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},Uw=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},pn=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},Ew=function(){function r(A,e,t){this.offsetX=A,this.offsetY=e,this.matrix=t,this.type=0,this.target=6}return r}(),Cn=function(){function r(A,e){this.path=A,this.target=e,this.type=1}return r}(),yw=function(){function r(A){this.opacity=A,this.type=2,this.target=6}return r}(),Sw=function(r){return r.type===0},jc=function(r){return r.type===1},Iw=function(r){return r.type===2},Ad=function(r,A){return r.length===A.length?r.some(function(e,t){return e===A[t]}):!1},Tw=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})},ed=function(){function r(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r}(),td=function(){function r(A,e){if(this.container=A,this.parent=e,this.effects=[],this.curves=new Qw(this.container),this.container.styles.opacity<1&&this.effects.push(new yw(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 Ew(t,n,s))}if(this.container.styles.overflowX!==0){var i=wn(this.curves),o=pn(this.curves);Ad(i,o)?this.effects.push(new Cn(i,6)):(this.effects.push(new Cn(i,2)),this.effects.push(new Cn(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!jc(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=wn(t.curves),o=pn(t.curves);Ad(i,o)||n.unshift(new Cn(o,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return q(a.target,A)})},r}(),ei=function(r,A,e,t){r.container.elements.forEach(function(n){var s=q(n.flags,4),i=q(n.flags,2),o=new td(n,r);q(n.styles.display,2048)&&t.push(o);var a=q(n.flags,8)?[]:t;if(s||i){var l=s||n.styles.isPositioned()?e:A,d=new ed(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);ei(o,d,s?d:e,a)}else n.styles.isInlineLevel()?A.inlineLevel.push(o):A.nonInlineLevel.push(o),ei(o,A,e,a);q(n.flags,8)&&rd(n,a)})},rd=function(r,A){for(var e=r instanceof Os?r.start:1,t=r instanceof Os?r.reversed:!1,n=0;n<A.length;n++){var s=A[n];s.container instanceof Ic&&typeof s.container.value=="number"&&s.container.value!==0&&(e=s.container.value),s.listValue=ut(e,s.container.styles.listStyleType,!0),e+=t?-1:1}},Hw=function(r){var A=new td(r,null),e=new ed(A),t=[];return ei(A,e,e,t),rd(A.container,t),e},nd=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)}},Lw=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)}},bw=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)}},Mw=function(r,A){switch(A){case 0:return vn(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return vn(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return vn(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);case 3:default:return vn(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},vn=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},sd=function(r){var A=r.bounds,e=r.styles;return A.add(e.borderLeftWidth,e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth),-(e.borderTopWidth+e.borderBottomWidth))},mn=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))},Dw=function(r,A){return r===0?A.bounds:r===2?mn(A):sd(A)},Rw=function(r,A){return r===0?A.bounds:r===2?mn(A):sd(A)},ti=function(r,A,e){var t=Dw(Le(r.styles.backgroundOrigin,A),r),n=Rw(Le(r.styles.backgroundClip,A),r),s=xw(Le(r.styles.backgroundSize,A),e,t),i=s[0],o=s[1],a=it(Le(r.styles.backgroundPosition,A),t.width-i,t.height-o),l=Pw(Le(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]},He=function(r){return k(r)&&r.value===Ee.AUTO},Fn=function(r){return typeof r=="number"},xw=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($(i)&&o&&$(o))return[N(i,e.width),N(o,e.height)];var a=Fn(s);if(k(i)&&(i.value===Ee.CONTAIN||i.value===Ee.COVER)){if(Fn(s)){var l=e.width/e.height;return l<s!=(i.value===Ee.COVER)?[e.width,e.width/s]:[e.height*s,e.height]}return[e.width,e.height]}var d=Fn(t),h=Fn(n),u=d||h;if(He(i)&&(!o||He(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 $(i)?m=N(i,e.width):$(o)&&(F=N(o,e.height)),He(i)?m=F*s:(!o||He(o))&&(F=m/s),[m,F]}var E=null,H=null;if($(i)?E=N(i,e.width):o&&$(o)&&(H=N(o,e.height)),E!==null&&(!o||He(o))&&(H=d&&h?E/t*n:e.height),H!==null&&He(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")},Le=function(r,A){var e=r[A];return typeof e>"u"?r[0]:e},Pw=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 S(Math.round(t.left),Math.round(t.top+i)),new S(Math.round(t.left+t.width),Math.round(t.top+i)),new S(Math.round(t.left+t.width),Math.round(a+t.top+i)),new S(Math.round(t.left),Math.round(a+t.top+i))];case 3:return[new S(Math.round(t.left+s),Math.round(t.top)),new S(Math.round(t.left+s+o),Math.round(t.top)),new S(Math.round(t.left+s+o),Math.round(t.height+t.top)),new S(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new S(Math.round(t.left+s),Math.round(t.top+i)),new S(Math.round(t.left+s+o),Math.round(t.top+i)),new S(Math.round(t.left+s+o),Math.round(t.top+i+a)),new S(Math.round(t.left+s),Math.round(t.top+i+a))];default:return[new S(Math.round(n.left),Math.round(n.top)),new S(Math.round(n.left+n.width),Math.round(n.top)),new S(Math.round(n.left+n.width),Math.round(n.height+n.top)),new S(Math.round(n.left),Math.round(n.height+n.top))]}},Kw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",id="Hidden Text",Gw=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=Kw,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(id)),t.appendChild(s),t.appendChild(n);var o=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(id)),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}(),od=function(){function r(A,e){this.context=A,this.options=e}return r}(),kw=1e4,Nw=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 Gw(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(),Iw(e)&&(this.ctx.globalAlpha=e.opacity),Sw(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)),jc(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 hA(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 hA(this,void 0,void 0,function(){return nA(this,function(t){switch(t.label){case 0:if(q(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=Vs(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=Xw(e.fontFamily).join(", "),s=st(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 hA(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=mn(e),i=pn(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 hA(this,void 0,void 0,function(){var t,n,s,i,o,a,F,F,l,d,h,u,H,f,B,y,w,v,m,F,E,H,y;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 Ec))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 yc&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof Sc))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 bc&&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 Ws&&(h=Math.min(t.bounds.width,t.bounds.height),t.type===cn?t.checked&&(this.ctx.save(),this.path([new S(t.bounds.left+h*.39363,t.bounds.top+h*.79),new S(t.bounds.left+h*.16,t.bounds.top+h*.5549),new S(t.bounds.left+h*.27347,t.bounds.top+h*.44071),new S(t.bounds.left+h*.39694,t.bounds.top+h*.5649),new S(t.bounds.left+h*.72983,t.bounds.top+h*.23),new S(t.bounds.left+h*.84,t.bounds.top+h*.34085),new S(t.bounds.left+h*.39363,t.bounds.top+h*.79)]),this.ctx.fillStyle=j(Tc),this.ctx.fill(),this.ctx.restore()):t.type===dn&&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(Tc),this.ctx.fill(),this.ctx.restore())),_w(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=Ow(t.styles.textAlign),y=mn(t),w=0,t.styles.textAlign){case 1:w+=y.width/2;break;case 2:w+=y.width;break}v=y.add(w,0,0,-y.height/2+1),this.ctx.save(),this.path([new S(y.left,y.top),new S(y.left+y.width,y.top),new S(y.left+y.width,y.top+y.height),new S(y.left,y.top+y.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new ct(t.value,v),s.letterSpacing,B),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!q(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",y=new bA(t.bounds.left,t.bounds.top+N(t.styles.paddingTop,t.bounds.width),t.bounds.width,ic(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new ct(e.listValue,y),s.letterSpacing,ic(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 hA(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(q(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 hA(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,W,aA,lA,G,O,R,B,W,aA,lA,G,O,w,v,m,F,E,H,y,U,D,R,b,W,iA,oA,G,O,SA,aA,lA,xA,IA,YA,he,ge,PA,Be,KA;return nA(this,function(Ke){switch(Ke.label){case 0:if(d.type!==0)return[3,5];h=void 0,u=d.url,Ke.label=1;case 1:return Ke.trys.push([1,3,,4]),[4,s.context.cache.match(u)];case 2:return h=Ke.sent(),[3,4];case 3:return Ke.sent(),s.context.logger.error("Error loading background-image "+u),[3,4];case 4:return h&&(f=ti(e,t,[h.width,h.height,h.width/h.height]),W=f[0],aA=f[1],lA=f[2],G=f[3],O=f[4],R=s.ctx.createPattern(s.resizeImage(h,G,O),"repeat"),s.renderRepeat(W,R,aA,lA)),[3,6];case 5:yg(d)?(B=ti(e,t,[null,null,null]),W=B[0],aA=B[1],lA=B[2],G=B[3],O=B[4],w=mg(d.angle,G,O),v=w[0],m=w[1],F=w[2],E=w[3],H=w[4],y=document.createElement("canvas"),y.width=G,y.height=O,U=y.getContext("2d"),D=U.createLinearGradient(m,E,F,H),Yl(d.stops,v).forEach(function(mr){return D.addColorStop(mr.stop,j(mr.color))}),U.fillStyle=D,U.fillRect(0,0,G,O),G>0&&O>0&&(R=s.ctx.createPattern(y,"repeat"),s.renderRepeat(W,R,aA,lA))):Sg(d)&&(b=ti(e,t,[null,null,null]),W=b[0],iA=b[1],oA=b[2],G=b[3],O=b[4],SA=d.position.length===0?[Is]:d.position,aA=N(SA[0],G),lA=N(SA[SA.length-1],O),xA=Fg(d,aA,lA,G,O),IA=xA[0],YA=xA[1],IA>0&&YA>0&&(he=s.ctx.createRadialGradient(iA+aA,oA+lA,0,iA+aA,oA+lA,IA),Yl(d.stops,IA*2).forEach(function(mr){return he.addColorStop(mr.stop,j(mr.color))}),s.path(W),s.ctx.fillStyle=he,IA!==YA?(ge=e.bounds.left+.5*e.bounds.width,PA=e.bounds.top+.5*e.bounds.height,Be=YA/IA,KA=1/Be,s.ctx.save(),s.ctx.translate(ge,PA),s.ctx.transform(1,0,0,Be,0,0),s.ctx.translate(-ge,-PA),s.ctx.fillRect(iA,KA*(oA-PA)+PA,G,O*KA),s.ctx.restore()):s.ctx.fill())),Ke.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 hA(this,void 0,void 0,function(){return nA(this,function(s){return this.path(nd(n,t)),this.ctx.fillStyle=j(e),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(e,t,n,s){return hA(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=Lw(s,n),this.path(i),this.ctx.fillStyle=j(e),this.ctx.fill(),o=bw(s,n),this.path(o),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(e){return hA(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=!WA(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=Vw(Le(t.backgroundClip,0),e.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),WA(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=wn(e.curves),w=f.inset?0:kw,v=Tw(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&&!WA(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 hA(this,void 0,void 0,function(){var o,a,l,d,h,u,f,B,w,v,m,F,E,H,y,U,y,U;return nA(this,function(D){return this.ctx.save(),o=Mw(s,n),a=nd(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])&&(y=a[3],U=a[0],this.ctx.beginPath(),this.formatPath([new S(y.end.x,y.end.y),new S(U.start.x,U.start.y)]),this.ctx.stroke()),pA(a[1])&&(y=a[1],U=a[2],this.ctx.beginPath(),this.formatPath([new S(y.end.x,y.end.y),new S(U.start.x,U.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(e){return hA(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=Hw(e),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A}(od),_w=function(r){return r instanceof Lc||r instanceof Hc?!0:r instanceof Ws&&r.type!==dn&&r.type!==cn},Vw=function(r,A){switch(r){case 0:return wn(A);case 2:return Uw(A);case 1:default:return pn(A)}},Ow=function(r){switch(r){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Ww=["-apple-system","system-ui"],Xw=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(A){return Ww.indexOf(A)===-1}):r},Jw=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 hA(this,void 0,void 0,function(){var t,n;return nA(this,function(s){switch(s.label){case 0:return t=_s(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e),[4,zw(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}(od),zw=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))})},Yw=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,Tr([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,Tr([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,Tr([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,Tr([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.instances={},r}(),$w=function(){function r(A,e){var t;this.windowBounds=e,this.instanceName="#"+r.instanceCount++,this.logger=new Yw({id:this.instanceName,enabled:A.logging}),this.cache=(t=A.cache)!==null&&t!==void 0?t:new fw(this,A)}return r.instanceCount=1,r}(),Zw=function(r,A){return A===void 0&&(A={}),qw(r,A)};typeof window<"u"&&qc.setContext(window);var qw=function(r,A){return hA(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,y,D,U,D,R,b,W,iA,oA,G,O,SA,aA,lA,xA,IA,YA,he,ge,PA,Be;return nA(this,function(KA){switch(KA.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:(b=A.imageTimeout)!==null&&b!==void 0?b:15e3,proxy:A.proxy,useCORS:(W=A.useCORS)!==null&&W!==void 0?W:!1},s=os({logging:(iA=A.logging)!==null&&iA!==void 0?iA:!0,cache:A.cache},n),i={windowWidth:(oA=A.windowWidth)!==null&&oA!==void 0?oA:t.innerWidth,windowHeight:(G=A.windowHeight)!==null&&G!==void 0?G:t.innerHeight,scrollX:(O=A.scrollX)!==null&&O!==void 0?O: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 $w(s,o),l=(aA=A.foreignObjectRendering)!==null&&aA!==void 0?aA:!1,d={allowTaint:(lA=A.allowTaint)!==null&&lA!==void 0?lA:!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 $c(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=KA.sent(),B=Js(u)||jf(u)?Iu(u.ownerDocument):Hr(a,u),w=B.width,v=B.height,m=B.left,F=B.top,E=jw(a,u,A.backgroundColor),H={canvas:A.canvas,backgroundColor:E,scale:(IA=(xA=A.scale)!==null&&xA!==void 0?xA:t.devicePixelRatio)!==null&&IA!==void 0?IA:1,x:((YA=A.x)!==null&&YA!==void 0?YA:0)+m,y:((he=A.y)!==null&&he!==void 0?he:0)+F,width:(ge=A.width)!==null&&ge!==void 0?ge:Math.ceil(w),height:(PA=A.height)!==null&&PA!==void 0?PA:Math.ceil(v)},l?(a.logger.debug("Document cloned, using foreign object rendering"),D=new Jw(a,H),[4,D.render(u)]):[3,3];case 2:return y=KA.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=Dc(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 Nw(a,H),[4,D.render(U)];case 4:y=KA.sent(),KA.label=5;case 5:return(!((Be=A.removeContainer)!==null&&Be!==void 0)||Be)&&($c.destroy(f)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,y]}})})},jw=function(r,A,e){var t=A.ownerDocument,n=t.documentElement?ot(r,getComputedStyle(t.documentElement).backgroundColor):DA.TRANSPARENT,s=t.body?ot(r,getComputedStyle(t.body).backgroundColor):DA.TRANSPARENT,i=typeof e=="string"?ot(r,e):e===null?DA.TRANSPARENT:4294967295;return A===t.documentElement?WA(n)?WA(s)?i:s:n:i};const Dt=class Dt extends c.EngineObject{constructor(A,e){super(A,e),this.ad(new c.ObjResettingWithEvent(A.renderInUEChanged,()=>A.renderInUE?new ld(A,e):new ad(A,e)))}};p(Dt,"type",Dt.register("ESUeViewer",c.ESGeoDiv.type,Dt));let ri=Dt;class ad 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,this.ad(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(()=>{$A(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)=>{Ve(n,s.id,a,l)})),this.dispose(e.smoothMoveWithRotationEvent.disposableOn((a,l,d)=>{ke(n,s.id,a,l,d)})),this.dispose(e.smoothMoveOnGroundEvent.disposableOn((a,l,d,h)=>{Ne(n,s.id,a,l,h,d)})),this.dispose(e.smoothMoveWithRotationOnGroundEvent.disposableOn((a,l,d,h,u)=>{_e(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=()=>{let E=e.show;if(!E)w.show=E,w.winPos=[0,0];else if(i.value){const H=t.getCurrentCameraInfo(),y=c.getDistancesFromPositions([e.position,H.position],"NONE")[0];e.minVisibleDistance<e.maxVisibleDistance?E=e.minVisibleDistance<y&&y<e.maxVisibleDistance:e.maxVisibleDistance==0&&(E=y>e.minVisibleDistance),w.show=E,w.winPos=[...i.value]}};m();const F=this.disposeVar(c.createNextAnimateFrameEvent(e.showChanged,i.changed,t.cameraChanged,e.maxVisibleDistanceChanged,e.minVisibleDistanceChanged));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 ld 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;this.ad(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]}}Zw(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(()=>{$A(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)=>{Ve(n,s.id,i,o)})),this.d(e.smoothMoveWithRotationEvent.don((i,o,a)=>{ke(n,s.id,i,o,a)})),this.d(e.smoothMoveOnGroundEvent.don((i,o,a,l)=>{Ne(n,s.id,i,o,l,a)})),this.d(e.smoothMoveWithRotationOnGroundEvent.don((i,o,a,l,d)=>{_e(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 oe=class oe extends Y{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}})})),this.ad(A.setFeatureStyleEvent.don(n=>{t.callUeFunc({f:"setFeatureStyle",p:{id:A.id,json:n}})})),this.ad(A.resetFeatureStyleEvent.don(()=>{t.callUeFunc({f:"resetFeatureStyle",p:{id:A.id}})}))}};p(oe,"type",oe.register("ESUeViewer",c.ESGeoJson.type,oe)),p(oe,"forceUeUpdateProps",[...Y.forceUeUpdateProps,"url"]),p(oe,"propValFuncs",{...Y.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(A):A});let ni=oe;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 Qn=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 si=xt;const Pt=class Pt extends uA{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 ii=Pt;const ae=class ae 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)=>{lo(t,A.id,n,s)})),this.d(A.setNodeRotationEvent.don((n,s)=>{co(t,A.id,n,s)})),this.d(A.setNodeScaleEvent.don((n,s)=>{uo(t,A.id,n,s)}))}};p(ae,"forceUeUpdateProps",[...P.forceUeUpdateProps,"url"]),p(ae,"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(ae,"type",ae.register("ESUeViewer",c.ESGltfModel.type,ae));let oi=ae;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 ai=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 li=Gt;const le=class le extends QA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}A.anchor=[.5,1]}};p(le,"type",le.register("ESUeViewer",c.ESImageLabel.type,le)),p(le,"forceUeUpdateProps",[...QA.forceUeUpdateProps,"url"]),p(le,"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 ci=le;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 di=kt;const Nt=class Nt extends yr{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 ui=Nt;const _t=class _t extends Y{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 hi=_t;const Vt=class Vt extends yr{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 gi=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 Bi=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 fi=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 wi=Xt;const Jt=class Jt extends Qn{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 pi=Jt;const zt=class zt extends Sr{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;so(t,A.id,s)})),this.d(A.highlightFeatureAndFlyToEvent.don((n,s,i,o)=>{const a=typeof n=="number"?n.toString():n;io(t,A.id,a,o??1)})),this.d(A.setLayerVisibleEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,oo(t,A.id,i)})),this.d(A.setLayerColorEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,ao(t,A.id,i)}))}};p(zt,"type",zt.register("ESUeViewer",c.ESPipeserTileset.type,zt));let Ci=zt;const Yt=class Yt extends uA{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 vi=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 mi=$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 Fi=Zt;const ce=class ce extends Y{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ce,"type",ce.register("ESUeViewer",c.ESPoiTileset.type,ce)),p(ce,"forceUeUpdateProps",[...Y.forceUeUpdateProps,"url"]),p(ce,"propValFuncs",{...Y.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(A):(A.url=c.ESSceneObject.context.getStrFromEnv(A.url),A)});let Qi=ce;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 Ui=qt;const Re=class Re extends uA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Re,"type",Re.register("ESUeViewer",c.ESPolygonFlattenedPlane.type,Re)),p(Re,"propValFuncs",{...uA.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let Ei=Re;const jt=class jt extends uA{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 yi=jt;const Ar=class Ar extends jA{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 Si=Ar;const er=class er extends Y{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 Ii=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 Ti=tr;const rr=class rr extends uA{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 Hi=rr;const nr=class nr extends uA{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 Li=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 bi=sr;const xe=class xe 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 Sn(t,A.id,n,s);A.__callFunctionResultEvent.emit(i)}))}};p(xe,"type",xe.register("ESUeViewer",c.ESUEWidget.type,xe)),p(xe,"propValFuncs",{...QA.propValFuncs,info:A=>JSON.stringify(A??{})});let Mi=xe;const cd=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"未知错误"}},Ap=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(()=>{En(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},${cd(v.re.type)}`);else{i=void 0,console.warn(`${A.id} UeESUnrealActor BindActorByTag error:${w}, ${cd(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},${Ap(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 Sn(t,A.id,u,f);A.__callFunctionResultEvent.emit(B)})),this.d(A.smoothMoveEvent.don((u,f)=>{l()||Ve(t,A.id,u,f)})),this.d(A.smoothMoveWithRotationEvent.don((u,f,B)=>{l()||ke(t,A.id,u,f,B)})),this.d(A.smoothMoveOnGroundEvent.don((u,f,B,w)=>{l()||Ne(t,A.id,u,f,w,B)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((u,f,B,w,v)=>{l()||_e(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 we(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()||$A(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 Di=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 Ri=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 xi=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 Pi=lr;const cr=class cr extends uA{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 Ki=cr;const Pe=class Pe extends QA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Pe,"type",Pe.register("ESUeViewer",c.ESWidget.type,Pe)),p(Pe,"propValFuncs",{...QA.propValFuncs,info:A=>JSON.stringify(A??{})});let Gi=Pe;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 ki=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 Ni=ur;const de=class de 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(de,"type",de.register("ESUeViewer",c.ESPath.type,de)),p(de,"forceUeUpdateProps",[...rA.forceUeUpdateProps]),p(de,"propValFuncs",{...rA.propValFuncs});let _i=de;async function ep(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)),ep(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:y}=H;if(y&&y.position){const{position:U}=y;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 Vi=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 Oi=gr;const Br=class Br extends jA{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 Wi=Br;const fr=class fr extends jA{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 Xi=fr;const wr=class wr extends uA{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 Ji=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 zi=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 Yi=Cr;const ue=class ue extends Y{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ue,"type",ue.register("ESUeViewer",c.ESMVTLayer.type,ue)),p(ue,"forceUeUpdateProps",[...Y.forceUeUpdateProps,"url"]),p(ue,"propValFuncs",{...Y.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(A):(A.url=c.ESSceneObject.context.getStrFromEnv(A.url),A),czmSplitDirection:null,czmAlpha:null,czmBrightness:null,czmContrast:null,czmHue:null,czmSaturation:null,czmGamma:null});let $i=ue;const vr=class vr extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("UeESCylinder: viewer is null");return}}};p(vr,"type",vr.register("ESUeViewer",c.ESCylinder.type,vr));let Zi=vr;C.copyright=void 0;try{const r="earthsdk3-ue",A="3.8.0",e="2026-03-17T10:22:10.000Z",t="北京西部世界科技有限公司",n="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",s="1e99c385a1837e0da74a77cf540c0719f97d8ba1",o=((Date.now()-177374293e4)/36e5).toFixed(1),a=`%c🌏 ${r}%c ${A}.${s.slice(0,8)}.${e} (距今${o}个小时)
|
|
112
|
+
.`+qs+hw+Zc)},Bw=function(r,A){var e=r.ownerDocument;if(e){var t=e.createElement("style");t.textContent=A,r.appendChild(t)}},qc=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}(),fw=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)||(Ai(A)||vw(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 hA(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=qc.isSameOrigin(A),t=!js(A)&&this._options.useCORS===!0&&tA.SUPPORT_CORS_IMAGES&&!e,n=!js(A)&&!e&&!Ai(A)&&typeof this._options.proxy=="string"&&tA.SUPPORT_CORS_XHR&&!t,!e&&this._options.allowTaint===!1&&!js(A)&&!Ai(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,(mw(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}(),ww=/^data:image\/svg\+xml/i,pw=/^data:image\/.*;base64,/i,Cw=/^data:image\/.*/i,vw=function(r){return tA.SUPPORT_SVG_DRAWING||!Fw(r)},js=function(r){return Cw.test(r)},mw=function(r){return pw.test(r)},Ai=function(r){return r.substr(0,4)==="blob"},Fw=function(r){return r.substr(-3).toLowerCase()==="svg"||ww.test(r)},S=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}(),Te=function(r,A,e){return new S(r.x+(A.x-r.x)*e,r.y+(A.y-r.y)*e)},fn=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=Te(this.start,this.startControl,A),n=Te(this.startControl,this.endControl,A),s=Te(this.endControl,this.end,A),i=Te(t,n,A),o=Te(n,s,A),a=Te(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},Qw=function(){function r(A){var e=A.styles,t=A.bounds,n=it(e.borderTopLeftRadius,t.width,t.height),s=n[0],i=n[1],o=it(e.borderTopRightRadius,t.width,t.height),a=o[0],l=o[1],d=it(e.borderBottomRightRadius,t.width,t.height),h=d[0],u=d[1],f=it(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,y=t.height-w,U=e.borderTopWidth,D=e.borderRightWidth,R=e.borderBottomWidth,b=e.borderLeftWidth,W=N(e.paddingTop,A.bounds.width),iA=N(e.paddingRight,A.bounds.width),oA=N(e.paddingBottom,A.bounds.width),G=N(e.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||i>0?V(t.left+b/3,t.top+U/3,s-b/3,i-U/3,K.TOP_LEFT):new S(t.left+b/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 S(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 S(t.left+t.width-D/3,t.top+t.height-R/3),this.bottomLeftBorderDoubleOuterBox=B>0||w>0?V(t.left+b/3,t.top+y,B-b/3,w-R/3,K.BOTTOM_LEFT):new S(t.left+b/3,t.top+t.height-R/3),this.topLeftBorderDoubleInnerBox=s>0||i>0?V(t.left+b*2/3,t.top+U*2/3,s-b*2/3,i-U*2/3,K.TOP_LEFT):new S(t.left+b*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 S(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 S(t.left+t.width-D*2/3,t.top+t.height-R*2/3),this.bottomLeftBorderDoubleInnerBox=B>0||w>0?V(t.left+b*2/3,t.top+y,B-b*2/3,w-R*2/3,K.BOTTOM_LEFT):new S(t.left+b*2/3,t.top+t.height-R*2/3),this.topLeftBorderStroke=s>0||i>0?V(t.left+b/2,t.top+U/2,s-b/2,i-U/2,K.TOP_LEFT):new S(t.left+b/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 S(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 S(t.left+t.width-D/2,t.top+t.height-R/2),this.bottomLeftBorderStroke=B>0||w>0?V(t.left+b/2,t.top+y,B-b/2,w-R/2,K.BOTTOM_LEFT):new S(t.left+b/2,t.top+t.height-R/2),this.topLeftBorderBox=s>0||i>0?V(t.left,t.top,s,i,K.TOP_LEFT):new S(t.left,t.top),this.topRightBorderBox=a>0||l>0?V(t.left+F,t.top,a,l,K.TOP_RIGHT):new S(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 S(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=B>0||w>0?V(t.left,t.top+y,B,w,K.BOTTOM_LEFT):new S(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||i>0?V(t.left+b,t.top+U,Math.max(0,s-b),Math.max(0,i-U),K.TOP_LEFT):new S(t.left+b,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 S(t.left+t.width-D,t.top+U),this.bottomRightPaddingBox=h>0||u>0?V(t.left+Math.min(H,t.width-b),t.top+Math.min(E,t.height-R),Math.max(0,h-D),Math.max(0,u-R),K.BOTTOM_RIGHT):new S(t.left+t.width-D,t.top+t.height-R),this.bottomLeftPaddingBox=B>0||w>0?V(t.left+b,t.top+Math.min(y,t.height-R),Math.max(0,B-b),Math.max(0,w-R),K.BOTTOM_LEFT):new S(t.left+b,t.top+t.height-R),this.topLeftContentBox=s>0||i>0?V(t.left+b+G,t.top+U+W,Math.max(0,s-(b+G)),Math.max(0,i-(U+W)),K.TOP_LEFT):new S(t.left+b+G,t.top+U+W),this.topRightContentBox=a>0||l>0?V(t.left+Math.min(F,t.width+b+G),t.top+U+W,F>t.width+b+G?0:a-b+G,l-(U+W),K.TOP_RIGHT):new S(t.left+t.width-(D+iA),t.top+U+W),this.bottomRightContentBox=h>0||u>0?V(t.left+Math.min(H,t.width-(b+G)),t.top+Math.min(E,t.height+U+W),Math.max(0,h-(D+iA)),u-(R+oA),K.BOTTOM_RIGHT):new S(t.left+t.width-(D+iA),t.top+t.height-(R+oA)),this.bottomLeftContentBox=B>0||w>0?V(t.left+b+G,t.top+y,Math.max(0,B-(b+G)),w-(R+oA),K.BOTTOM_LEFT):new S(t.left+b+G,t.top+t.height-(R+oA))}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 fn(new S(r,l),new S(r,l-o),new S(a-i,A),new S(a,A));case K.TOP_RIGHT:return new fn(new S(r,A),new S(r+i,A),new S(a,l-o),new S(a,l));case K.BOTTOM_RIGHT:return new fn(new S(a,A),new S(a,A+o),new S(r+i,l),new S(r,l));case K.BOTTOM_LEFT:default:return new fn(new S(a,l),new S(a-i,l),new S(r,A+o),new S(r,A))}},wn=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},Uw=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},pn=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},Ew=function(){function r(A,e,t){this.offsetX=A,this.offsetY=e,this.matrix=t,this.type=0,this.target=6}return r}(),Cn=function(){function r(A,e){this.path=A,this.target=e,this.type=1}return r}(),yw=function(){function r(A){this.opacity=A,this.type=2,this.target=6}return r}(),Sw=function(r){return r.type===0},jc=function(r){return r.type===1},Iw=function(r){return r.type===2},Ad=function(r,A){return r.length===A.length?r.some(function(e,t){return e===A[t]}):!1},Tw=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})},ed=function(){function r(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r}(),td=function(){function r(A,e){if(this.container=A,this.parent=e,this.effects=[],this.curves=new Qw(this.container),this.container.styles.opacity<1&&this.effects.push(new yw(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 Ew(t,n,s))}if(this.container.styles.overflowX!==0){var i=wn(this.curves),o=pn(this.curves);Ad(i,o)?this.effects.push(new Cn(i,6)):(this.effects.push(new Cn(i,2)),this.effects.push(new Cn(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!jc(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=wn(t.curves),o=pn(t.curves);Ad(i,o)||n.unshift(new Cn(o,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return q(a.target,A)})},r}(),ei=function(r,A,e,t){r.container.elements.forEach(function(n){var s=q(n.flags,4),i=q(n.flags,2),o=new td(n,r);q(n.styles.display,2048)&&t.push(o);var a=q(n.flags,8)?[]:t;if(s||i){var l=s||n.styles.isPositioned()?e:A,d=new ed(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);ei(o,d,s?d:e,a)}else n.styles.isInlineLevel()?A.inlineLevel.push(o):A.nonInlineLevel.push(o),ei(o,A,e,a);q(n.flags,8)&&rd(n,a)})},rd=function(r,A){for(var e=r instanceof Os?r.start:1,t=r instanceof Os?r.reversed:!1,n=0;n<A.length;n++){var s=A[n];s.container instanceof Ic&&typeof s.container.value=="number"&&s.container.value!==0&&(e=s.container.value),s.listValue=ut(e,s.container.styles.listStyleType,!0),e+=t?-1:1}},Hw=function(r){var A=new td(r,null),e=new ed(A),t=[];return ei(A,e,e,t),rd(A.container,t),e},nd=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)}},Lw=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)}},bw=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)}},Mw=function(r,A){switch(A){case 0:return vn(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return vn(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return vn(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);case 3:default:return vn(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},vn=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},sd=function(r){var A=r.bounds,e=r.styles;return A.add(e.borderLeftWidth,e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth),-(e.borderTopWidth+e.borderBottomWidth))},mn=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))},Dw=function(r,A){return r===0?A.bounds:r===2?mn(A):sd(A)},Rw=function(r,A){return r===0?A.bounds:r===2?mn(A):sd(A)},ti=function(r,A,e){var t=Dw(Le(r.styles.backgroundOrigin,A),r),n=Rw(Le(r.styles.backgroundClip,A),r),s=xw(Le(r.styles.backgroundSize,A),e,t),i=s[0],o=s[1],a=it(Le(r.styles.backgroundPosition,A),t.width-i,t.height-o),l=Pw(Le(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]},He=function(r){return k(r)&&r.value===Ee.AUTO},Fn=function(r){return typeof r=="number"},xw=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($(i)&&o&&$(o))return[N(i,e.width),N(o,e.height)];var a=Fn(s);if(k(i)&&(i.value===Ee.CONTAIN||i.value===Ee.COVER)){if(Fn(s)){var l=e.width/e.height;return l<s!=(i.value===Ee.COVER)?[e.width,e.width/s]:[e.height*s,e.height]}return[e.width,e.height]}var d=Fn(t),h=Fn(n),u=d||h;if(He(i)&&(!o||He(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 $(i)?m=N(i,e.width):$(o)&&(F=N(o,e.height)),He(i)?m=F*s:(!o||He(o))&&(F=m/s),[m,F]}var E=null,H=null;if($(i)?E=N(i,e.width):o&&$(o)&&(H=N(o,e.height)),E!==null&&(!o||He(o))&&(H=d&&h?E/t*n:e.height),H!==null&&He(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")},Le=function(r,A){var e=r[A];return typeof e>"u"?r[0]:e},Pw=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 S(Math.round(t.left),Math.round(t.top+i)),new S(Math.round(t.left+t.width),Math.round(t.top+i)),new S(Math.round(t.left+t.width),Math.round(a+t.top+i)),new S(Math.round(t.left),Math.round(a+t.top+i))];case 3:return[new S(Math.round(t.left+s),Math.round(t.top)),new S(Math.round(t.left+s+o),Math.round(t.top)),new S(Math.round(t.left+s+o),Math.round(t.height+t.top)),new S(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new S(Math.round(t.left+s),Math.round(t.top+i)),new S(Math.round(t.left+s+o),Math.round(t.top+i)),new S(Math.round(t.left+s+o),Math.round(t.top+i+a)),new S(Math.round(t.left+s),Math.round(t.top+i+a))];default:return[new S(Math.round(n.left),Math.round(n.top)),new S(Math.round(n.left+n.width),Math.round(n.top)),new S(Math.round(n.left+n.width),Math.round(n.height+n.top)),new S(Math.round(n.left),Math.round(n.height+n.top))]}},Kw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",id="Hidden Text",Gw=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=Kw,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(id)),t.appendChild(s),t.appendChild(n);var o=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(id)),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}(),od=function(){function r(A,e){this.context=A,this.options=e}return r}(),kw=1e4,Nw=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 Gw(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(),Iw(e)&&(this.ctx.globalAlpha=e.opacity),Sw(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)),jc(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 hA(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 hA(this,void 0,void 0,function(){return nA(this,function(t){switch(t.label){case 0:if(q(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=Vs(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=Xw(e.fontFamily).join(", "),s=st(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 hA(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=mn(e),i=pn(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 hA(this,void 0,void 0,function(){var t,n,s,i,o,a,F,F,l,d,h,u,H,f,B,y,w,v,m,F,E,H,y;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 Ec))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 yc&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof Sc))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 bc&&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 Ws&&(h=Math.min(t.bounds.width,t.bounds.height),t.type===cn?t.checked&&(this.ctx.save(),this.path([new S(t.bounds.left+h*.39363,t.bounds.top+h*.79),new S(t.bounds.left+h*.16,t.bounds.top+h*.5549),new S(t.bounds.left+h*.27347,t.bounds.top+h*.44071),new S(t.bounds.left+h*.39694,t.bounds.top+h*.5649),new S(t.bounds.left+h*.72983,t.bounds.top+h*.23),new S(t.bounds.left+h*.84,t.bounds.top+h*.34085),new S(t.bounds.left+h*.39363,t.bounds.top+h*.79)]),this.ctx.fillStyle=j(Tc),this.ctx.fill(),this.ctx.restore()):t.type===dn&&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(Tc),this.ctx.fill(),this.ctx.restore())),_w(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=Ow(t.styles.textAlign),y=mn(t),w=0,t.styles.textAlign){case 1:w+=y.width/2;break;case 2:w+=y.width;break}v=y.add(w,0,0,-y.height/2+1),this.ctx.save(),this.path([new S(y.left,y.top),new S(y.left+y.width,y.top),new S(y.left+y.width,y.top+y.height),new S(y.left,y.top+y.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new ct(t.value,v),s.letterSpacing,B),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!q(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",y=new bA(t.bounds.left,t.bounds.top+N(t.styles.paddingTop,t.bounds.width),t.bounds.width,ic(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new ct(e.listValue,y),s.letterSpacing,ic(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 hA(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(q(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 hA(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,W,aA,lA,G,O,R,B,W,aA,lA,G,O,w,v,m,F,E,H,y,U,D,R,b,W,iA,oA,G,O,SA,aA,lA,xA,IA,YA,he,ge,PA,Be,KA;return nA(this,function(Ke){switch(Ke.label){case 0:if(d.type!==0)return[3,5];h=void 0,u=d.url,Ke.label=1;case 1:return Ke.trys.push([1,3,,4]),[4,s.context.cache.match(u)];case 2:return h=Ke.sent(),[3,4];case 3:return Ke.sent(),s.context.logger.error("Error loading background-image "+u),[3,4];case 4:return h&&(f=ti(e,t,[h.width,h.height,h.width/h.height]),W=f[0],aA=f[1],lA=f[2],G=f[3],O=f[4],R=s.ctx.createPattern(s.resizeImage(h,G,O),"repeat"),s.renderRepeat(W,R,aA,lA)),[3,6];case 5:yg(d)?(B=ti(e,t,[null,null,null]),W=B[0],aA=B[1],lA=B[2],G=B[3],O=B[4],w=mg(d.angle,G,O),v=w[0],m=w[1],F=w[2],E=w[3],H=w[4],y=document.createElement("canvas"),y.width=G,y.height=O,U=y.getContext("2d"),D=U.createLinearGradient(m,E,F,H),Yl(d.stops,v).forEach(function(mr){return D.addColorStop(mr.stop,j(mr.color))}),U.fillStyle=D,U.fillRect(0,0,G,O),G>0&&O>0&&(R=s.ctx.createPattern(y,"repeat"),s.renderRepeat(W,R,aA,lA))):Sg(d)&&(b=ti(e,t,[null,null,null]),W=b[0],iA=b[1],oA=b[2],G=b[3],O=b[4],SA=d.position.length===0?[Is]:d.position,aA=N(SA[0],G),lA=N(SA[SA.length-1],O),xA=Fg(d,aA,lA,G,O),IA=xA[0],YA=xA[1],IA>0&&YA>0&&(he=s.ctx.createRadialGradient(iA+aA,oA+lA,0,iA+aA,oA+lA,IA),Yl(d.stops,IA*2).forEach(function(mr){return he.addColorStop(mr.stop,j(mr.color))}),s.path(W),s.ctx.fillStyle=he,IA!==YA?(ge=e.bounds.left+.5*e.bounds.width,PA=e.bounds.top+.5*e.bounds.height,Be=YA/IA,KA=1/Be,s.ctx.save(),s.ctx.translate(ge,PA),s.ctx.transform(1,0,0,Be,0,0),s.ctx.translate(-ge,-PA),s.ctx.fillRect(iA,KA*(oA-PA)+PA,G,O*KA),s.ctx.restore()):s.ctx.fill())),Ke.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 hA(this,void 0,void 0,function(){return nA(this,function(s){return this.path(nd(n,t)),this.ctx.fillStyle=j(e),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(e,t,n,s){return hA(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=Lw(s,n),this.path(i),this.ctx.fillStyle=j(e),this.ctx.fill(),o=bw(s,n),this.path(o),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(e){return hA(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=!WA(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=Vw(Le(t.backgroundClip,0),e.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),WA(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=wn(e.curves),w=f.inset?0:kw,v=Tw(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&&!WA(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 hA(this,void 0,void 0,function(){var o,a,l,d,h,u,f,B,w,v,m,F,E,H,y,U,y,U;return nA(this,function(D){return this.ctx.save(),o=Mw(s,n),a=nd(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])&&(y=a[3],U=a[0],this.ctx.beginPath(),this.formatPath([new S(y.end.x,y.end.y),new S(U.start.x,U.start.y)]),this.ctx.stroke()),pA(a[1])&&(y=a[1],U=a[2],this.ctx.beginPath(),this.formatPath([new S(y.end.x,y.end.y),new S(U.start.x,U.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(e){return hA(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=Hw(e),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A}(od),_w=function(r){return r instanceof Lc||r instanceof Hc?!0:r instanceof Ws&&r.type!==dn&&r.type!==cn},Vw=function(r,A){switch(r){case 0:return wn(A);case 2:return Uw(A);case 1:default:return pn(A)}},Ow=function(r){switch(r){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Ww=["-apple-system","system-ui"],Xw=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(A){return Ww.indexOf(A)===-1}):r},Jw=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 hA(this,void 0,void 0,function(){var t,n;return nA(this,function(s){switch(s.label){case 0:return t=_s(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,e),[4,zw(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}(od),zw=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))})},Yw=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,Tr([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,Tr([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,Tr([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,Tr([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},r.instances={},r}(),$w=function(){function r(A,e){var t;this.windowBounds=e,this.instanceName="#"+r.instanceCount++,this.logger=new Yw({id:this.instanceName,enabled:A.logging}),this.cache=(t=A.cache)!==null&&t!==void 0?t:new fw(this,A)}return r.instanceCount=1,r}(),Zw=function(r,A){return A===void 0&&(A={}),qw(r,A)};typeof window<"u"&&qc.setContext(window);var qw=function(r,A){return hA(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,y,D,U,D,R,b,W,iA,oA,G,O,SA,aA,lA,xA,IA,YA,he,ge,PA,Be;return nA(this,function(KA){switch(KA.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:(b=A.imageTimeout)!==null&&b!==void 0?b:15e3,proxy:A.proxy,useCORS:(W=A.useCORS)!==null&&W!==void 0?W:!1},s=os({logging:(iA=A.logging)!==null&&iA!==void 0?iA:!0,cache:A.cache},n),i={windowWidth:(oA=A.windowWidth)!==null&&oA!==void 0?oA:t.innerWidth,windowHeight:(G=A.windowHeight)!==null&&G!==void 0?G:t.innerHeight,scrollX:(O=A.scrollX)!==null&&O!==void 0?O: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 $w(s,o),l=(aA=A.foreignObjectRendering)!==null&&aA!==void 0?aA:!1,d={allowTaint:(lA=A.allowTaint)!==null&&lA!==void 0?lA:!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 $c(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=KA.sent(),B=Js(u)||jf(u)?Iu(u.ownerDocument):Hr(a,u),w=B.width,v=B.height,m=B.left,F=B.top,E=jw(a,u,A.backgroundColor),H={canvas:A.canvas,backgroundColor:E,scale:(IA=(xA=A.scale)!==null&&xA!==void 0?xA:t.devicePixelRatio)!==null&&IA!==void 0?IA:1,x:((YA=A.x)!==null&&YA!==void 0?YA:0)+m,y:((he=A.y)!==null&&he!==void 0?he:0)+F,width:(ge=A.width)!==null&&ge!==void 0?ge:Math.ceil(w),height:(PA=A.height)!==null&&PA!==void 0?PA:Math.ceil(v)},l?(a.logger.debug("Document cloned, using foreign object rendering"),D=new Jw(a,H),[4,D.render(u)]):[3,3];case 2:return y=KA.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=Dc(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 Nw(a,H),[4,D.render(U)];case 4:y=KA.sent(),KA.label=5;case 5:return(!((Be=A.removeContainer)!==null&&Be!==void 0)||Be)&&($c.destroy(f)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,y]}})})},jw=function(r,A,e){var t=A.ownerDocument,n=t.documentElement?ot(r,getComputedStyle(t.documentElement).backgroundColor):DA.TRANSPARENT,s=t.body?ot(r,getComputedStyle(t.body).backgroundColor):DA.TRANSPARENT,i=typeof e=="string"?ot(r,e):e===null?DA.TRANSPARENT:4294967295;return A===t.documentElement?WA(n)?WA(s)?i:s:n:i};const Dt=class Dt extends c.EngineObject{constructor(A,e){super(A,e),this.ad(new c.ObjResettingWithEvent(A.renderInUEChanged,()=>A.renderInUE?new ld(A,e):new ad(A,e)))}};p(Dt,"type",Dt.register("ESUeViewer",c.ESGeoDiv.type,Dt));let ri=Dt;class ad 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,this.ad(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(()=>{$A(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)=>{Ve(n,s.id,a,l)})),this.dispose(e.smoothMoveWithRotationEvent.disposableOn((a,l,d)=>{ke(n,s.id,a,l,d)})),this.dispose(e.smoothMoveOnGroundEvent.disposableOn((a,l,d,h)=>{Ne(n,s.id,a,l,h,d)})),this.dispose(e.smoothMoveWithRotationOnGroundEvent.disposableOn((a,l,d,h,u)=>{_e(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=()=>{let E=e.show;if(!E)w.show=E,w.winPos=[0,0];else if(i.value){const H=t.getCurrentCameraInfo(),y=c.getDistancesFromPositions([e.position,H.position],"NONE")[0];e.minVisibleDistance<e.maxVisibleDistance?E=e.minVisibleDistance<y&&y<e.maxVisibleDistance:e.maxVisibleDistance==0&&(E=y>e.minVisibleDistance),w.show=E,w.winPos=[...i.value]}};m();const F=this.disposeVar(c.createNextAnimateFrameEvent(e.showChanged,i.changed,t.cameraChanged,e.maxVisibleDistanceChanged,e.minVisibleDistanceChanged));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 ld 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;this.ad(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]}}Zw(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(()=>{$A(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)=>{Ve(n,s.id,i,o)})),this.d(e.smoothMoveWithRotationEvent.don((i,o,a)=>{ke(n,s.id,i,o,a)})),this.d(e.smoothMoveOnGroundEvent.don((i,o,a,l)=>{Ne(n,s.id,i,o,l,a)})),this.d(e.smoothMoveWithRotationOnGroundEvent.don((i,o,a,l,d)=>{_e(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 oe=class oe extends Y{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}})})),this.ad(A.setFeatureStyleEvent.don(n=>{t.callUeFunc({f:"setFeatureStyle",p:{id:A.id,json:n}})})),this.ad(A.resetFeatureStyleEvent.don(()=>{t.callUeFunc({f:"resetFeatureStyle",p:{id:A.id}})}))}};p(oe,"type",oe.register("ESUeViewer",c.ESGeoJson.type,oe)),p(oe,"forceUeUpdateProps",[...Y.forceUeUpdateProps,"url"]),p(oe,"propValFuncs",{...Y.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(A):A});let ni=oe;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 Qn=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 si=xt;const Pt=class Pt extends uA{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 ii=Pt;const ae=class ae 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)=>{lo(t,A.id,n,s)})),this.d(A.setNodeRotationEvent.don((n,s)=>{co(t,A.id,n,s)})),this.d(A.setNodeScaleEvent.don((n,s)=>{uo(t,A.id,n,s)}))}};p(ae,"forceUeUpdateProps",[...P.forceUeUpdateProps,"url"]),p(ae,"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(ae,"type",ae.register("ESUeViewer",c.ESGltfModel.type,ae));let oi=ae;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 ai=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 li=Gt;const le=class le extends QA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}A.anchor=[.5,1]}};p(le,"type",le.register("ESUeViewer",c.ESImageLabel.type,le)),p(le,"forceUeUpdateProps",[...QA.forceUeUpdateProps,"url"]),p(le,"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 ci=le;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 di=kt;const Nt=class Nt extends yr{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 ui=Nt;const _t=class _t extends Y{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 hi=_t;const Vt=class Vt extends yr{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 gi=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 Bi=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 fi=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 wi=Xt;const Jt=class Jt extends Qn{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 pi=Jt;const zt=class zt extends Sr{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;so(t,A.id,s)})),this.d(A.highlightFeatureAndFlyToEvent.don((n,s,i,o)=>{const a=typeof n=="number"?n.toString():n;io(t,A.id,a,o??1)})),this.d(A.setLayerVisibleEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,oo(t,A.id,i)})),this.d(A.setLayerColorEvent.don((n,s)=>{let i="";typeof s!="string"?i=JSON.stringify(s):i=s,ao(t,A.id,i)}))}};p(zt,"type",zt.register("ESUeViewer",c.ESPipeserTileset.type,zt));let Ci=zt;const Yt=class Yt extends uA{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 vi=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 mi=$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 Fi=Zt;const ce=class ce extends Y{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ce,"type",ce.register("ESUeViewer",c.ESPoiTileset.type,ce)),p(ce,"forceUeUpdateProps",[...Y.forceUeUpdateProps,"url"]),p(ce,"propValFuncs",{...Y.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(A):(A.url=c.ESSceneObject.context.getStrFromEnv(A.url),A)});let Qi=ce;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 Ui=qt;const Re=class Re extends uA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Re,"type",Re.register("ESUeViewer",c.ESPolygonFlattenedPlane.type,Re)),p(Re,"propValFuncs",{...uA.propValFuncs,targetID:A=>{if(!A)return"";const e=c.ESSceneObject.getSceneObject(A);return e?(e.components.main??e).id:A}});let Ei=Re;const jt=class jt extends uA{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 yi=jt;const Ar=class Ar extends jA{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 Si=Ar;const er=class er extends Y{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 Ii=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 Ti=tr;const rr=class rr extends uA{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 Hi=rr;const nr=class nr extends uA{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 Li=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 bi=sr;const xe=class xe 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 Sn(t,A.id,n,s);A.__callFunctionResultEvent.emit(i)}))}};p(xe,"type",xe.register("ESUeViewer",c.ESUEWidget.type,xe)),p(xe,"propValFuncs",{...QA.propValFuncs,info:A=>JSON.stringify(A??{})});let Mi=xe;const cd=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"未知错误"}},Ap=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(()=>{En(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},${cd(v.re.type)}`);else{i=void 0,console.warn(`${A.id} UeESUnrealActor BindActorByTag error:${w}, ${cd(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},${Ap(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 Sn(t,A.id,u,f);A.__callFunctionResultEvent.emit(B)})),this.d(A.smoothMoveEvent.don((u,f)=>{l()||Ve(t,A.id,u,f)})),this.d(A.smoothMoveWithRotationEvent.don((u,f,B)=>{l()||ke(t,A.id,u,f,B)})),this.d(A.smoothMoveOnGroundEvent.don((u,f,B,w)=>{l()||Ne(t,A.id,u,f,w,B)})),this.d(A.smoothMoveWithRotationOnGroundEvent.don((u,f,B,w,v)=>{l()||_e(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 we(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()||$A(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 Di=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 Ri=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 xi=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 Pi=lr;const cr=class cr extends uA{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 Ki=cr;const Pe=class Pe extends QA{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(Pe,"type",Pe.register("ESUeViewer",c.ESWidget.type,Pe)),p(Pe,"propValFuncs",{...QA.propValFuncs,info:A=>JSON.stringify(A??{})});let Gi=Pe;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 ki=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 Ni=ur;const de=class de 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(de,"type",de.register("ESUeViewer",c.ESPath.type,de)),p(de,"forceUeUpdateProps",[...rA.forceUeUpdateProps]),p(de,"propValFuncs",{...rA.propValFuncs});let _i=de;async function ep(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)),ep(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:y}=H;if(y&&y.position){const{position:U}=y;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 Vi=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 Oi=gr;const Br=class Br extends jA{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 Wi=Br;const fr=class fr extends jA{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 Xi=fr;const wr=class wr extends uA{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 Ji=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 zi=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 Yi=Cr;const ue=class ue extends Y{constructor(A,e){if(super(A,e),!e.viewer){console.warn("viewer is undefined!");return}}};p(ue,"type",ue.register("ESUeViewer",c.ESMVTLayer.type,ue)),p(ue,"forceUeUpdateProps",[...Y.forceUeUpdateProps,"url"]),p(ue,"propValFuncs",{...Y.propValFuncs,url:A=>typeof A=="string"?c.ESSceneObject.context.getStrFromEnv(A):(A.url=c.ESSceneObject.context.getStrFromEnv(A.url),A),czmSplitDirection:null,czmAlpha:null,czmBrightness:null,czmContrast:null,czmHue:null,czmSaturation:null,czmGamma:null});let $i=ue;const vr=class vr extends P{constructor(A,e){if(super(A,e),!e.viewer){console.warn("UeESCylinder: viewer is null");return}}};p(vr,"type",vr.register("ESUeViewer",c.ESCylinder.type,vr));let Zi=vr;C.copyright=void 0;try{const r="earthsdk3-ue",A="3.9.0-beta.1",e="2026-03-20T06:52:52.000Z",t="北京西部世界科技有限公司",n="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",s="43bdc4410f861ef6dc6562290800fd228c01d3c1",o=((Date.now()-1773989572e3)/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}","43bdc4410f861ef6dc6562290800fd228c01d3c1")},get info(){return a},get date(){return"2026-03-20T06:52:52.000Z"},get author(){return"suplyang"},get version(){return"3.9.0-beta.1"},get name(){return"earthsdk3-ue"},get commitId(){return"43bdc4410f861ef6dc6562290800fd228c01d3c1"},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;
|